4735 lines
2.7 MiB
Plaintext
4735 lines
2.7 MiB
Plaintext
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-ChceY9yO.js","assets/index-CABTxMIu.js","assets/index-BrgMj9EV.js","assets/index-cXSkcoY5.js","assets/index-BC17We5c.js","assets/index-1eVFoYiz.js","assets/index-qccrkHdW.js","assets/index-DqhC_Kf2.js","assets/index-CjdSldoM.js","assets/index-DUIOFOyZ.js","assets/index-4LSWdctC.js","assets/index-VPHTxbPF.js","assets/index-CW1rGHDh.js","assets/index-kursAkdO.js","assets/index-DxrtMfYz.js","assets/index-Jvlk4AK9.js","assets/index-BRzSNedJ.js","assets/index-Q4rtX3NF.js","assets/index-1rpfjieq.js","assets/index-CX1yQM68.js","assets/dockerfile-BKs6k2Af.js","assets/simple-mode-GW_nhZxv.js","assets/factor-kuTfRLto.js","assets/nsis-LdVXkNf5.js","assets/pug-DukmZTjD.js","assets/javascript-qCveANmP.js","assets/index-BLzV9qSf.js","assets/index-wuYSPDJ9.js"])))=>i.map(i=>d[i]);
|
||
var WTe=Object.defineProperty;var tY=t=>{throw TypeError(t)};var GTe=(t,e,n)=>e in t?WTe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Ui=(t,e,n)=>GTe(t,typeof e!="symbol"?e+"":e,n),xM=(t,e,n)=>e.has(t)||tY("Cannot "+n);var O=(t,e,n)=>(xM(t,e,"read from private field"),n?n.call(t):e.get(t)),te=(t,e,n)=>e.has(t)?tY("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),W=(t,e,n,r)=>(xM(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Ot=(t,e,n)=>(xM(t,e,"access private method"),n);var IC=(t,e,n,r)=>({set _(i){W(t,e,i,n)},get _(){return O(t,e,r)}});function KTe(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function PF(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ece={exports:{}},J8={};/**
|
||
* @license React
|
||
* react-jsx-runtime.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var YTe=Symbol.for("react.transitional.element"),ZTe=Symbol.for("react.fragment");function tce(t,e,n){var r=null;if(n!==void 0&&(r=""+n),e.key!==void 0&&(r=""+e.key),"key"in e){n={};for(var i in e)i!=="key"&&(n[i]=e[i])}else n=e;return e=n.ref,{$$typeof:YTe,type:t,key:r,ref:e!==void 0?e:null,props:n}}J8.Fragment=ZTe;J8.jsx=tce;J8.jsxs=tce;ece.exports=J8;var m=ece.exports,nce={exports:{}},e9={},rce={exports:{}},ice={};/**
|
||
* @license React
|
||
* scheduler.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/(function(t){function e(G,ee){var J=G.length;G.push(ee);e:for(;0<J;){var oe=J-1>>>1,B=G[oe];if(0<i(B,ee))G[oe]=ee,G[J]=B,J=oe;else break e}}function n(G){return G.length===0?null:G[0]}function r(G){if(G.length===0)return null;var ee=G[0],J=G.pop();if(J!==ee){G[0]=J;e:for(var oe=0,B=G.length,$e=B>>>1;oe<$e;){var Ye=2*(oe+1)-1,$=G[Ye],Re=Ye+1,ke=G[Re];if(0>i($,J))Re<B&&0>i(ke,$)?(G[oe]=ke,G[Re]=J,oe=Re):(G[oe]=$,G[Ye]=J,oe=Ye);else if(Re<B&&0>i(ke,J))G[oe]=ke,G[Re]=J,oe=Re;else break e}}return ee}function i(G,ee){var J=G.sortIndex-ee.sortIndex;return J!==0?J:G.id-ee.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,d=null,h=3,f=!1,p=!1,g=!1,y=!1,v=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function S(G){for(var ee=n(c);ee!==null;){if(ee.callback===null)r(c);else if(ee.startTime<=G)r(c),ee.sortIndex=ee.expirationTime,e(l,ee);else break;ee=n(c)}}function k(G){if(g=!1,S(G),!p)if(n(l)!==null)p=!0,T||(T=!0,P());else{var ee=n(c);ee!==null&&re(k,ee.startTime-G)}}var T=!1,E=-1,C=5,R=-1;function M(){return y?!0:!(t.unstable_now()-R<C)}function D(){if(y=!1,T){var G=t.unstable_now();R=G;var ee=!0;try{e:{p=!1,g&&(g=!1,b(E),E=-1),f=!0;var J=h;try{t:{for(S(G),d=n(l);d!==null&&!(d.expirationTime>G&&M());){var oe=d.callback;if(typeof oe=="function"){d.callback=null,h=d.priorityLevel;var B=oe(d.expirationTime<=G);if(G=t.unstable_now(),typeof B=="function"){d.callback=B,S(G),ee=!0;break t}d===n(l)&&r(l),S(G)}else r(l);d=n(l)}if(d!==null)ee=!0;else{var $e=n(c);$e!==null&&re(k,$e.startTime-G),ee=!1}}break e}finally{d=null,h=J,f=!1}ee=void 0}}finally{ee?P():T=!1}}}var P;if(typeof _=="function")P=function(){_(D)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,Z=z.port2;z.port1.onmessage=D,P=function(){Z.postMessage(null)}}else P=function(){v(D,0)};function re(G,ee){E=v(function(){G(t.unstable_now())},ee)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(G){G.callback=null},t.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<G?Math.floor(1e3/G):5},t.unstable_getCurrentPriorityLevel=function(){return h},t.unstable_next=function(G){switch(h){case 1:case 2:case 3:var ee=3;break;default:ee=h}var J=h;h=ee;try{return G()}finally{h=J}},t.unstable_requestPaint=function(){y=!0},t.unstable_runWithPriority=function(G,ee){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var J=h;h=G;try{return ee()}finally{h=J}},t.unstable_scheduleCallback=function(G,ee,J){var oe=t.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?oe+J:oe):J=oe,G){case 1:var B=-1;break;case 2:B=250;break;case 5:B=1073741823;break;case 4:B=1e4;break;default:B=5e3}return B=J+B,G={id:u++,callback:ee,priorityLevel:G,startTime:J,expirationTime:B,sortIndex:-1},J>oe?(G.sortIndex=J,e(c,G),n(l)===null&&G===n(c)&&(g?(b(E),E=-1):g=!0,re(k,J-oe))):(G.sortIndex=B,e(l,G),p||f||(p=!0,T||(T=!0,P()))),G},t.unstable_shouldYield=M,t.unstable_wrapCallback=function(G){var ee=h;return function(){var J=h;h=ee;try{return G.apply(this,arguments)}finally{h=J}}}})(ice);rce.exports=ice;var XTe=rce.exports,sce={exports:{}},Kt={};/**
|
||
* @license React
|
||
* react.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var LF=Symbol.for("react.transitional.element"),QTe=Symbol.for("react.portal"),JTe=Symbol.for("react.fragment"),e6e=Symbol.for("react.strict_mode"),t6e=Symbol.for("react.profiler"),n6e=Symbol.for("react.consumer"),r6e=Symbol.for("react.context"),i6e=Symbol.for("react.forward_ref"),s6e=Symbol.for("react.suspense"),o6e=Symbol.for("react.memo"),oce=Symbol.for("react.lazy"),a6e=Symbol.for("react.activity"),nY=Symbol.iterator;function l6e(t){return t===null||typeof t!="object"?null:(t=nY&&t[nY]||t["@@iterator"],typeof t=="function"?t:null)}var ace={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},lce=Object.assign,cce={};function Ix(t,e,n){this.props=t,this.context=e,this.refs=cce,this.updater=n||ace}Ix.prototype.isReactComponent={};Ix.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};Ix.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function uce(){}uce.prototype=Ix.prototype;function zF(t,e,n){this.props=t,this.context=e,this.refs=cce,this.updater=n||ace}var jF=zF.prototype=new uce;jF.constructor=zF;lce(jF,Ix.prototype);jF.isPureReactComponent=!0;var rY=Array.isArray;function aP(){}var Pr={H:null,A:null,T:null,S:null},dce=Object.prototype.hasOwnProperty;function BF(t,e,n){var r=n.ref;return{$$typeof:LF,type:t,key:e,ref:r!==void 0?r:null,props:n}}function c6e(t,e){return BF(t.type,e,t.props)}function FF(t){return typeof t=="object"&&t!==null&&t.$$typeof===LF}function u6e(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var iY=/\/+/g;function _M(t,e){return typeof t=="object"&&t!==null&&t.key!=null?u6e(""+t.key):e.toString(36)}function d6e(t){switch(t.status){case"fulfilled":return t.value;case"rejected":throw t.reason;default:switch(typeof t.status=="string"?t.then(aP,aP):(t.status="pending",t.then(function(e){t.status==="pending"&&(t.status="fulfilled",t.value=e)},function(e){t.status==="pending"&&(t.status="rejected",t.reason=e)})),t.status){case"fulfilled":return t.value;case"rejected":throw t.reason}}throw t}function sv(t,e,n,r,i){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(s){case"bigint":case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case LF:case QTe:o=!0;break;case oce:return o=t._init,sv(o(t._payload),e,n,r,i)}}if(o)return i=i(t),o=r===""?"."+_M(t,0):r,rY(i)?(n="",o!=null&&(n=o.replace(iY,"$&/")+"/"),sv(i,e,n,"",function(c){return c})):i!=null&&(FF(i)&&(i=c6e(i,n+(i.key==null||t&&t.key===i.key?"":(""+i.key).replace(iY,"$&/")+"/")+o)),e.push(i)),1;o=0;var a=r===""?".":r+":";if(rY(t))for(var l=0;l<t.length;l++)r=t[l],s=a+_M(r,l),o+=sv(r,e,n,s,i);else if(l=l6e(t),typeof l=="function")for(t=l.call(t),l=0;!(r=t.next()).done;)r=r.value,s=a+_M(r,l++),o+=sv(r,e,n,s,i);else if(s==="object"){if(typeof t.then=="function")return sv(d6e(t),e,n,r,i);throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.")}return o}function RC(t,e,n){if(t==null)return t;var r=[],i=0;return sv(t,r,"","",function(s){return e.call(n,s,i++)}),r}function h6e(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var sY=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},f6e={map:RC,forEach:function(t,e,n){RC(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return RC(t,function(){e++}),e},toArray:function(t){return RC(t,function(e){return e})||[]},only:function(t){if(!FF(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};Kt.Activity=a6e;Kt.Children=f6e;Kt.Component=Ix;Kt.Fragment=JTe;Kt.Profiler=t6e;Kt.PureComponent=zF;Kt.StrictMode=e6e;Kt.Suspense=s6e;Kt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Pr;Kt.__COMPILER_RUNTIME={__proto__:null,c:function(t){return Pr.H.useMemoCache(t)}};Kt.cache=function(t){return function(){return t.apply(null,arguments)}};Kt.cacheSignal=function(){return null};Kt.cloneElement=function(t,e,n){if(t==null)throw Error("The argument must be a React element, but you passed "+t+".");var r=lce({},t.props),i=t.key;if(e!=null)for(s in e.key!==void 0&&(i=""+e.key),e)!dce.call(e,s)||s==="key"||s==="__self"||s==="__source"||s==="ref"&&e.ref===void 0||(r[s]=e[s]);var s=arguments.length-2;if(s===1)r.children=n;else if(1<s){for(var o=Array(s),a=0;a<s;a++)o[a]=arguments[a+2];r.children=o}return BF(t.type,i,r)};Kt.createContext=function(t){return t={$$typeof:r6e,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null},t.Provider=t,t.Consumer={$$typeof:n6e,_context:t},t};Kt.createElement=function(t,e,n){var r,i={},s=null;if(e!=null)for(r in e.key!==void 0&&(s=""+e.key),e)dce.call(e,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(i[r]=e[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var a=Array(o),l=0;l<o;l++)a[l]=arguments[l+2];i.children=a}if(t&&t.defaultProps)for(r in o=t.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return BF(t,s,i)};Kt.createRef=function(){return{current:null}};Kt.forwardRef=function(t){return{$$typeof:i6e,render:t}};Kt.isValidElement=FF;Kt.lazy=function(t){return{$$typeof:oce,_payload:{_status:-1,_result:t},_init:h6e}};Kt.memo=function(t,e){return{$$typeof:o6e,type:t,compare:e===void 0?null:e}};Kt.startTransition=function(t){var e=Pr.T,n={};Pr.T=n;try{var r=t(),i=Pr.S;i!==null&&i(n,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(aP,sY)}catch(s){sY(s)}finally{e!==null&&n.types!==null&&(e.types=n.types),Pr.T=e}};Kt.unstable_useCacheRefresh=function(){return Pr.H.useCacheRefresh()};Kt.use=function(t){return Pr.H.use(t)};Kt.useActionState=function(t,e,n){return Pr.H.useActionState(t,e,n)};Kt.useCallback=function(t,e){return Pr.H.useCallback(t,e)};Kt.useContext=function(t){return Pr.H.useContext(t)};Kt.useDebugValue=function(){};Kt.useDeferredValue=function(t,e){return Pr.H.useDeferredValue(t,e)};Kt.useEffect=function(t,e){return Pr.H.useEffect(t,e)};Kt.useEffectEvent=function(t){return Pr.H.useEffectEvent(t)};Kt.useId=function(){return Pr.H.useId()};Kt.useImperativeHandle=function(t,e,n){return Pr.H.useImperativeHandle(t,e,n)};Kt.useInsertionEffect=function(t,e){return Pr.H.useInsertionEffect(t,e)};Kt.useLayoutEffect=function(t,e){return Pr.H.useLayoutEffect(t,e)};Kt.useMemo=function(t,e){return Pr.H.useMemo(t,e)};Kt.useOptimistic=function(t,e){return Pr.H.useOptimistic(t,e)};Kt.useReducer=function(t,e,n){return Pr.H.useReducer(t,e,n)};Kt.useRef=function(t){return Pr.H.useRef(t)};Kt.useState=function(t){return Pr.H.useState(t)};Kt.useSyncExternalStore=function(t,e,n){return Pr.H.useSyncExternalStore(t,e,n)};Kt.useTransition=function(){return Pr.H.useTransition()};Kt.version="19.2.4";sce.exports=Kt;var x=sce.exports;const Be=PF(x),hce=KTe({__proto__:null,default:Be},[x]);var fce={exports:{}},zo={};/**
|
||
* @license React
|
||
* react-dom.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var p6e=x;function pce(t){var e="https://react.dev/errors/"+t;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function Hf(){}var Ao={d:{f:Hf,r:function(){throw Error(pce(522))},D:Hf,C:Hf,L:Hf,m:Hf,X:Hf,S:Hf,M:Hf},p:0,findDOMNode:null},m6e=Symbol.for("react.portal");function g6e(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:m6e,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}var h_=p6e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function t9(t,e){if(t==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}zo.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ao;zo.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(pce(299));return g6e(t,e,null,n)};zo.flushSync=function(t){var e=h_.T,n=Ao.p;try{if(h_.T=null,Ao.p=2,t)return t()}finally{h_.T=e,Ao.p=n,Ao.d.f()}};zo.preconnect=function(t,e){typeof t=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,Ao.d.C(t,e))};zo.prefetchDNS=function(t){typeof t=="string"&&Ao.d.D(t)};zo.preinit=function(t,e){if(typeof t=="string"&&e&&typeof e.as=="string"){var n=e.as,r=t9(n,e.crossOrigin),i=typeof e.integrity=="string"?e.integrity:void 0,s=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;n==="style"?Ao.d.S(t,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:s}):n==="script"&&Ao.d.X(t,{crossOrigin:r,integrity:i,fetchPriority:s,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};zo.preinitModule=function(t,e){if(typeof t=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var n=t9(e.as,e.crossOrigin);Ao.d.M(t,{crossOrigin:n,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&Ao.d.M(t)};zo.preload=function(t,e){if(typeof t=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var n=e.as,r=t9(n,e.crossOrigin);Ao.d.L(t,n,{crossOrigin:r,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};zo.preloadModule=function(t,e){if(typeof t=="string")if(e){var n=t9(e.as,e.crossOrigin);Ao.d.m(t,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:n,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else Ao.d.m(t)};zo.requestFormReset=function(t){Ao.d.r(t)};zo.unstable_batchedUpdates=function(t,e){return t(e)};zo.useFormState=function(t,e,n){return h_.H.useFormState(t,e,n)};zo.useFormStatus=function(){return h_.H.useHostTransitionStatus()};zo.version="19.2.4";function mce(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(mce)}catch(t){console.error(t)}}mce(),fce.exports=zo;var nc=fce.exports;const gce=PF(nc);/**
|
||
* @license React
|
||
* react-dom-client.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var Qi=XTe,yce=x,y6e=nc;function Ce(t){var e="https://react.dev/errors/"+t;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function vce(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function j5(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function bce(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function wce(t){if(t.tag===31){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function oY(t){if(j5(t)!==t)throw Error(Ce(188))}function v6e(t){var e=t.alternate;if(!e){if(e=j5(t),e===null)throw Error(Ce(188));return e!==t?null:t}for(var n=t,r=e;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return oY(i),t;if(s===r)return oY(i),e;s=s.sibling}throw Error(Ce(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o)throw Error(Ce(189))}}if(n.alternate!==r)throw Error(Ce(190))}if(n.tag!==3)throw Error(Ce(188));return n.stateNode.current===n?t:e}function xce(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t;for(t=t.child;t!==null;){if(e=xce(t),e!==null)return e;t=t.sibling}return null}var Lr=Object.assign,b6e=Symbol.for("react.element"),MC=Symbol.for("react.transitional.element"),f4=Symbol.for("react.portal"),Av=Symbol.for("react.fragment"),_ce=Symbol.for("react.strict_mode"),lP=Symbol.for("react.profiler"),Sce=Symbol.for("react.consumer"),Ch=Symbol.for("react.context"),VF=Symbol.for("react.forward_ref"),cP=Symbol.for("react.suspense"),uP=Symbol.for("react.suspense_list"),$F=Symbol.for("react.memo"),dp=Symbol.for("react.lazy"),dP=Symbol.for("react.activity"),w6e=Symbol.for("react.memo_cache_sentinel"),aY=Symbol.iterator;function z2(t){return t===null||typeof t!="object"?null:(t=aY&&t[aY]||t["@@iterator"],typeof t=="function"?t:null)}var x6e=Symbol.for("react.client.reference");function hP(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===x6e?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Av:return"Fragment";case lP:return"Profiler";case _ce:return"StrictMode";case cP:return"Suspense";case uP:return"SuspenseList";case dP:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case f4:return"Portal";case Ch:return t.displayName||"Context";case Sce:return(t._context.displayName||"Context")+".Consumer";case VF:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case $F:return e=t.displayName||null,e!==null?e:hP(t.type)||"Memo";case dp:e=t._payload,t=t._init;try{return hP(t(e))}catch{}}return null}var p4=Array.isArray,Bt=yce.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Wn=y6e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,r1={pending:!1,data:null,method:null,action:null},fP=[],Iv=-1;function kd(t){return{current:t}}function ps(t){0>Iv||(t.current=fP[Iv],fP[Iv]=null,Iv--)}function Ir(t,e){Iv++,fP[Iv]=t.current,t.current=e}var nd=kd(null),mS=kd(null),om=kd(null),vA=kd(null);function bA(t,e){switch(Ir(om,e),Ir(mS,t),Ir(nd,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?fZ(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=fZ(e),t=Hde(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}ps(nd),Ir(nd,t)}function Tw(){ps(nd),ps(mS),ps(om)}function pP(t){t.memoizedState!==null&&Ir(vA,t);var e=nd.current,n=Hde(e,t.type);e!==n&&(Ir(mS,t),Ir(nd,n))}function wA(t){mS.current===t&&(ps(nd),ps(mS)),vA.current===t&&(ps(vA),ES._currentValue=r1)}var SM,lY;function sg(t){if(SM===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);SM=e&&e[1]||"",lY=-1<n.stack.indexOf(`
|
||
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
||
`+SM+t+lY}var kM=!1;function CM(t,e){if(!t||kM)return"";kM=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(e){var d=function(){throw Error()};if(Object.defineProperty(d.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(d,[])}catch(f){var h=f}Reflect.construct(t,[],d)}else{try{d.call()}catch(f){h=f}t.call(d.prototype)}}else{try{throw Error()}catch(f){h=f}(d=t())&&typeof d.catch=="function"&&d.catch(function(){})}}catch(f){if(f&&h&&typeof f.stack=="string")return[f.stack,h.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 s=r.DetermineComponentFrameRoot(),o=s[0],a=s[1];if(o&&a){var l=o.split(`
|
||
`),c=a.split(`
|
||
`);for(i=r=0;r<l.length&&!l[r].includes("DetermineComponentFrameRoot");)r++;for(;i<c.length&&!c[i].includes("DetermineComponentFrameRoot");)i++;if(r===l.length||i===c.length)for(r=l.length-1,i=c.length-1;1<=r&&0<=i&&l[r]!==c[i];)i--;for(;1<=r&&0<=i;r--,i--)if(l[r]!==c[i]){if(r!==1||i!==1)do if(r--,i--,0>i||l[r]!==c[i]){var u=`
|
||
`+l[r].replace(" at new "," at ");return t.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",t.displayName)),u}while(1<=r&&0<=i);break}}}finally{kM=!1,Error.prepareStackTrace=n}return(n=t?t.displayName||t.name:"")?sg(n):""}function _6e(t,e){switch(t.tag){case 26:case 27:case 5:return sg(t.type);case 16:return sg("Lazy");case 13:return t.child!==e&&e!==null?sg("Suspense Fallback"):sg("Suspense");case 19:return sg("SuspenseList");case 0:case 15:return CM(t.type,!1);case 11:return CM(t.type.render,!1);case 1:return CM(t.type,!0);case 31:return sg("Activity");default:return""}}function cY(t){try{var e="",n=null;do e+=_6e(t,n),n=t,t=t.return;while(t);return e}catch(r){return`
|
||
Error generating stack: `+r.message+`
|
||
`+r.stack}}var mP=Object.prototype.hasOwnProperty,HF=Qi.unstable_scheduleCallback,EM=Qi.unstable_cancelCallback,S6e=Qi.unstable_shouldYield,k6e=Qi.unstable_requestPaint,Ga=Qi.unstable_now,C6e=Qi.unstable_getCurrentPriorityLevel,kce=Qi.unstable_ImmediatePriority,Cce=Qi.unstable_UserBlockingPriority,xA=Qi.unstable_NormalPriority,E6e=Qi.unstable_LowPriority,Ece=Qi.unstable_IdlePriority,T6e=Qi.log,A6e=Qi.unstable_setDisableYieldValue,B5=null,Ka=null;function Kp(t){if(typeof T6e=="function"&&A6e(t),Ka&&typeof Ka.setStrictMode=="function")try{Ka.setStrictMode(B5,t)}catch{}}var Ya=Math.clz32?Math.clz32:M6e,I6e=Math.log,R6e=Math.LN2;function M6e(t){return t>>>=0,t===0?32:31-(I6e(t)/R6e|0)|0}var NC=256,OC=262144,DC=4194304;function og(t){var e=t&42;if(e!==0)return e;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function n9(t,e,n){var r=t.pendingLanes;if(r===0)return 0;var i=0,s=t.suspendedLanes,o=t.pingedLanes;t=t.warmLanes;var a=r&134217727;return a!==0?(r=a&~s,r!==0?i=og(r):(o&=a,o!==0?i=og(o):n||(n=a&~t,n!==0&&(i=og(n))))):(a=r&~s,a!==0?i=og(a):o!==0?i=og(o):n||(n=r&~t,n!==0&&(i=og(n)))),i===0?0:e!==0&&e!==i&&!(e&s)&&(s=i&-i,n=e&-e,s>=n||s===32&&(n&4194048)!==0)?e:i}function F5(t,e){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&e)===0}function N6e(t,e){switch(t){case 1:case 2:case 4:case 8:case 64:return e+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 e+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 Tce(){var t=DC;return DC<<=1,!(DC&62914560)&&(DC=4194304),t}function TM(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function V5(t,e){t.pendingLanes|=e,e!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function O6e(t,e,n,r,i,s){var o=t.pendingLanes;t.pendingLanes=n,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=n,t.entangledLanes&=n,t.errorRecoveryDisabledLanes&=n,t.shellSuspendCounter=0;var a=t.entanglements,l=t.expirationTimes,c=t.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ya(n),d=1<<u;a[u]=0,l[u]=-1;var h=c[u];if(h!==null)for(c[u]=null,u=0;u<h.length;u++){var f=h[u];f!==null&&(f.lane&=-536870913)}n&=~d}r!==0&&Ace(t,r,0),s!==0&&i===0&&t.tag!==0&&(t.suspendedLanes|=s&~(o&~e))}function Ace(t,e,n){t.pendingLanes|=e,t.suspendedLanes&=~e;var r=31-Ya(e);t.entangledLanes|=e,t.entanglements[r]=t.entanglements[r]|1073741824|n&261930}function Ice(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-Ya(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}function Rce(t,e){var n=e&-e;return n=n&42?1:UF(n),n&(t.suspendedLanes|e)?0:n}function UF(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function qF(t){return t&=-t,2<t?8<t?t&134217727?32:268435456:8:2}function Mce(){var t=Wn.p;return t!==0?t:(t=window.event,t===void 0?32:ehe(t.type))}function uY(t,e){var n=Wn.p;try{return Wn.p=t,e()}finally{Wn.p=n}}var h0=Math.random().toString(36).slice(2),Es="__reactFiber$"+h0,ga="__reactProps$"+h0,Rx="__reactContainer$"+h0,gP="__reactEvents$"+h0,D6e="__reactListeners$"+h0,P6e="__reactHandles$"+h0,dY="__reactResources$"+h0,$5="__reactMarker$"+h0;function WF(t){delete t[Es],delete t[ga],delete t[gP],delete t[D6e],delete t[P6e]}function Rv(t){var e=t[Es];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Rx]||n[Es]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=vZ(t);t!==null;){if(n=t[Es])return n;t=vZ(t)}return e}t=n,n=t.parentNode}return null}function Mx(t){if(t=t[Es]||t[Rx]){var e=t.tag;if(e===5||e===6||e===13||e===31||e===26||e===27||e===3)return t}return null}function m4(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t.stateNode;throw Error(Ce(33))}function Wv(t){var e=t[dY];return e||(e=t[dY]={hoistableStyles:new Map,hoistableScripts:new Map}),e}function us(t){t[$5]=!0}var Nce=new Set,Oce={};function hy(t,e){Aw(t,e),Aw(t+"Capture",e)}function Aw(t,e){for(Oce[t]=e,t=0;t<e.length;t++)Nce.add(e[t])}var L6e=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]*$"),hY={},fY={};function z6e(t){return mP.call(fY,t)?!0:mP.call(hY,t)?!1:L6e.test(t)?fY[t]=!0:(hY[t]=!0,!1)}function ST(t,e,n){if(z6e(e))if(n===null)t.removeAttribute(e);else{switch(typeof n){case"undefined":case"function":case"symbol":t.removeAttribute(e);return;case"boolean":var r=e.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){t.removeAttribute(e);return}}t.setAttribute(e,""+n)}}function PC(t,e,n){if(n===null)t.removeAttribute(e);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(e);return}t.setAttribute(e,""+n)}}function Vd(t,e,n,r){if(r===null)t.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttributeNS(e,n,""+r)}}function El(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Dce(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function j6e(t,e,n){var r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e);if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function yP(t){if(!t._valueTracker){var e=Dce(t)?"checked":"value";t._valueTracker=j6e(t,e,""+t[e])}}function Pce(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=Dce(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function _A(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var B6e=/[\n"\\]/g;function Ml(t){return t.replace(B6e,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function vP(t,e,n,r,i,s,o,a){t.name="",o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?t.type=o:t.removeAttribute("type"),e!=null?o==="number"?(e===0&&t.value===""||t.value!=e)&&(t.value=""+El(e)):t.value!==""+El(e)&&(t.value=""+El(e)):o!=="submit"&&o!=="reset"||t.removeAttribute("value"),e!=null?bP(t,o,El(e)):n!=null?bP(t,o,El(n)):r!=null&&t.removeAttribute("value"),i==null&&s!=null&&(t.defaultChecked=!!s),i!=null&&(t.checked=i&&typeof i!="function"&&typeof i!="symbol"),a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?t.name=""+El(a):t.removeAttribute("name")}function Lce(t,e,n,r,i,s,o,a){if(s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(t.type=s),e!=null||n!=null){if(!(s!=="submit"&&s!=="reset"||e!=null)){yP(t);return}n=n!=null?""+El(n):"",e=e!=null?""+El(e):n,a||e===t.value||(t.value=e),t.defaultValue=e}r=r??i,r=typeof r!="function"&&typeof r!="symbol"&&!!r,t.checked=a?t.checked:!!r,t.defaultChecked=!!r,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(t.name=o),yP(t)}function bP(t,e,n){e==="number"&&_A(t.ownerDocument)===t||t.defaultValue===""+n||(t.defaultValue=""+n)}function Gv(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i<n.length;i++)e["$"+n[i]]=!0;for(n=0;n<t.length;n++)i=e.hasOwnProperty("$"+t[n].value),t[n].selected!==i&&(t[n].selected=i),i&&r&&(t[n].defaultSelected=!0)}else{for(n=""+El(n),e=null,i=0;i<t.length;i++){if(t[i].value===n){t[i].selected=!0,r&&(t[i].defaultSelected=!0);return}e!==null||t[i].disabled||(e=t[i])}e!==null&&(e.selected=!0)}}function zce(t,e,n){if(e!=null&&(e=""+El(e),e!==t.value&&(t.value=e),n==null)){t.defaultValue!==e&&(t.defaultValue=e);return}t.defaultValue=n!=null?""+El(n):""}function jce(t,e,n,r){if(e==null){if(r!=null){if(n!=null)throw Error(Ce(92));if(p4(r)){if(1<r.length)throw Error(Ce(93));r=r[0]}n=r}n==null&&(n=""),e=n}n=El(e),t.defaultValue=n,r=t.textContent,r===n&&r!==""&&r!==null&&(t.value=r),yP(t)}function Iw(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var F6e=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 pY(t,e,n){var r=e.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?r?t.setProperty(e,""):e==="float"?t.cssFloat="":t[e]="":r?t.setProperty(e,n):typeof n!="number"||n===0||F6e.has(e)?e==="float"?t.cssFloat=n:t[e]=(""+n).trim():t[e]=n+"px"}function Bce(t,e,n){if(e!=null&&typeof e!="object")throw Error(Ce(62));if(t=t.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||e!=null&&e.hasOwnProperty(r)||(r.indexOf("--")===0?t.setProperty(r,""):r==="float"?t.cssFloat="":t[r]="");for(var i in e)r=e[i],e.hasOwnProperty(i)&&n[i]!==r&&pY(t,i,r)}else for(var s in e)e.hasOwnProperty(s)&&pY(t,s,e[s])}function GF(t){if(t.indexOf("-")===-1)return!1;switch(t){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 V6e=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"]]),$6e=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function kT(t){return $6e.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Eh(){}var wP=null;function KF(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Mv=null,Kv=null;function mY(t){var e=Mx(t);if(e&&(t=e.stateNode)){var n=t[ga]||null;e:switch(t=e.stateNode,e.type){case"input":if(vP(t,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Ml(""+e)+'"][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var i=r[ga]||null;if(!i)throw Error(Ce(90));vP(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(e=0;e<n.length;e++)r=n[e],r.form===t.form&&Pce(r)}break e;case"textarea":zce(t,n.value,n.defaultValue);break e;case"select":e=n.value,e!=null&&Gv(t,!!n.multiple,e,!1)}}}var AM=!1;function Fce(t,e,n){if(AM)return t(e,n);AM=!0;try{var r=t(e);return r}finally{if(AM=!1,(Mv!==null||Kv!==null)&&(p9(),Mv&&(e=Mv,t=Kv,Kv=Mv=null,mY(e),t)))for(e=0;e<t.length;e++)mY(t[e])}}function gS(t,e){var n=t.stateNode;if(n===null)return null;var r=n[ga]||null;if(r===null)return null;n=r[e];e:switch(e){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)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(Ce(231,e,typeof n));return n}var Zh=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xP=!1;if(Zh)try{var j2={};Object.defineProperty(j2,"passive",{get:function(){xP=!0}}),window.addEventListener("test",j2,j2),window.removeEventListener("test",j2,j2)}catch{xP=!1}var Yp=null,YF=null,CT=null;function Vce(){if(CT)return CT;var t,e=YF,n=e.length,r,i="value"in Yp?Yp.value:Yp.textContent,s=i.length;for(t=0;t<n&&e[t]===i[t];t++);var o=n-t;for(r=1;r<=o&&e[n-r]===i[s-r];r++);return CT=i.slice(t,1<r?1-r:void 0)}function ET(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function LC(){return!0}function gY(){return!1}function ba(t){function e(n,r,i,s,o){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in t)t.hasOwnProperty(a)&&(n=t[a],this[a]=n?n(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?LC:gY,this.isPropagationStopped=gY,this}return Lr(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=LC)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=LC)},persist:function(){},isPersistent:LC}),e}var fy={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},r9=ba(fy),H5=Lr({},fy,{view:0,detail:0}),H6e=ba(H5),IM,RM,B2,i9=Lr({},H5,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ZF,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==B2&&(B2&&t.type==="mousemove"?(IM=t.screenX-B2.screenX,RM=t.screenY-B2.screenY):RM=IM=0,B2=t),IM)},movementY:function(t){return"movementY"in t?t.movementY:RM}}),yY=ba(i9),U6e=Lr({},i9,{dataTransfer:0}),q6e=ba(U6e),W6e=Lr({},H5,{relatedTarget:0}),MM=ba(W6e),G6e=Lr({},fy,{animationName:0,elapsedTime:0,pseudoElement:0}),K6e=ba(G6e),Y6e=Lr({},fy,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Z6e=ba(Y6e),X6e=Lr({},fy,{data:0}),vY=ba(X6e),Q6e={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},J6e={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},eAe={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function tAe(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=eAe[t])?!!e[t]:!1}function ZF(){return tAe}var nAe=Lr({},H5,{key:function(t){if(t.key){var e=Q6e[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=ET(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?J6e[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ZF,charCode:function(t){return t.type==="keypress"?ET(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?ET(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),rAe=ba(nAe),iAe=Lr({},i9,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),bY=ba(iAe),sAe=Lr({},H5,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ZF}),oAe=ba(sAe),aAe=Lr({},fy,{propertyName:0,elapsedTime:0,pseudoElement:0}),lAe=ba(aAe),cAe=Lr({},i9,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),uAe=ba(cAe),dAe=Lr({},fy,{newState:0,oldState:0}),hAe=ba(dAe),fAe=[9,13,27,32],XF=Zh&&"CompositionEvent"in window,f_=null;Zh&&"documentMode"in document&&(f_=document.documentMode);var pAe=Zh&&"TextEvent"in window&&!f_,$ce=Zh&&(!XF||f_&&8<f_&&11>=f_),wY=" ",xY=!1;function Hce(t,e){switch(t){case"keyup":return fAe.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Uce(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Nv=!1;function mAe(t,e){switch(t){case"compositionend":return Uce(e);case"keypress":return e.which!==32?null:(xY=!0,wY);case"textInput":return t=e.data,t===wY&&xY?null:t;default:return null}}function gAe(t,e){if(Nv)return t==="compositionend"||!XF&&Hce(t,e)?(t=Vce(),CT=YF=Yp=null,Nv=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return $ce&&e.locale!=="ko"?null:e.data;default:return null}}var yAe={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 _Y(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!yAe[t.type]:e==="textarea"}function qce(t,e,n,r){Mv?Kv?Kv.push(r):Kv=[r]:Mv=r,e=FA(e,"onChange"),0<e.length&&(n=new r9("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var p_=null,yS=null;function vAe(t){Fde(t,0)}function s9(t){var e=m4(t);if(Pce(e))return t}function SY(t,e){if(t==="change")return e}var Wce=!1;if(Zh){var NM;if(Zh){var OM="oninput"in document;if(!OM){var kY=document.createElement("div");kY.setAttribute("oninput","return;"),OM=typeof kY.oninput=="function"}NM=OM}else NM=!1;Wce=NM&&(!document.documentMode||9<document.documentMode)}function CY(){p_&&(p_.detachEvent("onpropertychange",Gce),yS=p_=null)}function Gce(t){if(t.propertyName==="value"&&s9(yS)){var e=[];qce(e,yS,t,KF(t)),Fce(vAe,e)}}function bAe(t,e,n){t==="focusin"?(CY(),p_=e,yS=n,p_.attachEvent("onpropertychange",Gce)):t==="focusout"&&CY()}function wAe(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return s9(yS)}function xAe(t,e){if(t==="click")return s9(e)}function _Ae(t,e){if(t==="input"||t==="change")return s9(e)}function SAe(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var rl=typeof Object.is=="function"?Object.is:SAe;function vS(t,e){if(rl(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!mP.call(e,i)||!rl(t[i],e[i]))return!1}return!0}function EY(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function TY(t,e){var n=EY(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=EY(n)}}function Kce(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Kce(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Yce(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var e=_A(t.document);e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=_A(t.document)}return e}function QF(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}var kAe=Zh&&"documentMode"in document&&11>=document.documentMode,Ov=null,_P=null,m_=null,SP=!1;function AY(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;SP||Ov==null||Ov!==_A(r)||(r=Ov,"selectionStart"in r&&QF(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),m_&&vS(m_,r)||(m_=r,r=FA(_P,"onSelect"),0<r.length&&(e=new r9("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=Ov)))}function U0(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var Dv={animationend:U0("Animation","AnimationEnd"),animationiteration:U0("Animation","AnimationIteration"),animationstart:U0("Animation","AnimationStart"),transitionrun:U0("Transition","TransitionRun"),transitionstart:U0("Transition","TransitionStart"),transitioncancel:U0("Transition","TransitionCancel"),transitionend:U0("Transition","TransitionEnd")},DM={},Zce={};Zh&&(Zce=document.createElement("div").style,"AnimationEvent"in window||(delete Dv.animationend.animation,delete Dv.animationiteration.animation,delete Dv.animationstart.animation),"TransitionEvent"in window||delete Dv.transitionend.transition);function py(t){if(DM[t])return DM[t];if(!Dv[t])return t;var e=Dv[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in Zce)return DM[t]=e[n];return t}var Xce=py("animationend"),Qce=py("animationiteration"),Jce=py("animationstart"),CAe=py("transitionrun"),EAe=py("transitionstart"),TAe=py("transitioncancel"),eue=py("transitionend"),tue=new Map,kP="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(" ");kP.push("scrollEnd");function ru(t,e){tue.set(t,e),hy(e,[t])}var SA=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},_l=[],Pv=0,JF=0;function o9(){for(var t=Pv,e=JF=Pv=0;e<t;){var n=_l[e];_l[e++]=null;var r=_l[e];_l[e++]=null;var i=_l[e];_l[e++]=null;var s=_l[e];if(_l[e++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}s!==0&&nue(n,i,s)}}function a9(t,e,n,r){_l[Pv++]=t,_l[Pv++]=e,_l[Pv++]=n,_l[Pv++]=r,JF|=r,t.lanes|=r,t=t.alternate,t!==null&&(t.lanes|=r)}function eV(t,e,n,r){return a9(t,e,n,r),kA(t)}function my(t,e){return a9(t,null,null,e),kA(t)}function nue(t,e,n){t.lanes|=n;var r=t.alternate;r!==null&&(r.lanes|=n);for(var i=!1,s=t.return;s!==null;)s.childLanes|=n,r=s.alternate,r!==null&&(r.childLanes|=n),s.tag===22&&(t=s.stateNode,t===null||t._visibility&1||(i=!0)),t=s,s=s.return;return t.tag===3?(s=t.stateNode,i&&e!==null&&(i=31-Ya(n),t=s.hiddenUpdates,r=t[i],r===null?t[i]=[e]:r.push(e),e.lane=n|536870912),s):null}function kA(t){if(50<k_)throw k_=0,qP=null,Error(Ce(185));for(var e=t.return;e!==null;)t=e,e=t.return;return t.tag===3?t.stateNode:null}var Lv={};function AAe(t,e,n,r){this.tag=t,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=e,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 Ba(t,e,n,r){return new AAe(t,e,n,r)}function tV(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Lh(t,e){var n=t.alternate;return n===null?(n=Ba(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&65011712,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n.refCleanup=t.refCleanup,n}function rue(t,e){t.flags&=65011714;var n=t.alternate;return n===null?(t.childLanes=0,t.lanes=e,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,t.type=n.type,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),t}function TT(t,e,n,r,i,s){var o=0;if(r=t,typeof t=="function")tV(t)&&(o=1);else if(typeof t=="string")o=O7e(t,n,nd.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case dP:return t=Ba(31,n,e,i),t.elementType=dP,t.lanes=s,t;case Av:return i1(n.children,i,s,e);case _ce:o=8,i|=24;break;case lP:return t=Ba(12,n,e,i|2),t.elementType=lP,t.lanes=s,t;case cP:return t=Ba(13,n,e,i),t.elementType=cP,t.lanes=s,t;case uP:return t=Ba(19,n,e,i),t.elementType=uP,t.lanes=s,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Ch:o=10;break e;case Sce:o=9;break e;case VF:o=11;break e;case $F:o=14;break e;case dp:o=16,r=null;break e}o=29,n=Error(Ce(130,t===null?"null":typeof t,"")),r=null}return e=Ba(o,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function i1(t,e,n,r){return t=Ba(7,t,r,e),t.lanes=n,t}function PM(t,e,n){return t=Ba(6,t,null,e),t.lanes=n,t}function iue(t){var e=Ba(18,null,null,0);return e.stateNode=t,e}function LM(t,e,n){return e=Ba(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}var IY=new WeakMap;function Nl(t,e){if(typeof t=="object"&&t!==null){var n=IY.get(t);return n!==void 0?n:(e={value:t,source:e,stack:cY(e)},IY.set(t,e),e)}return{value:t,source:e,stack:cY(e)}}var zv=[],jv=0,CA=null,bS=0,Tl=[],Al=0,Im=null,qu=1,Wu="";function ah(t,e){zv[jv++]=bS,zv[jv++]=CA,CA=t,bS=e}function sue(t,e,n){Tl[Al++]=qu,Tl[Al++]=Wu,Tl[Al++]=Im,Im=t;var r=qu;t=Wu;var i=32-Ya(r)-1;r&=~(1<<i),n+=1;var s=32-Ya(e)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,qu=1<<32-Ya(e)+i|n<<i|r,Wu=s+t}else qu=1<<s|n<<i|r,Wu=t}function nV(t){t.return!==null&&(ah(t,1),sue(t,1,0))}function rV(t){for(;t===CA;)CA=zv[--jv],zv[jv]=null,bS=zv[--jv],zv[jv]=null;for(;t===Im;)Im=Tl[--Al],Tl[Al]=null,Wu=Tl[--Al],Tl[Al]=null,qu=Tl[--Al],Tl[Al]=null}function oue(t,e){Tl[Al++]=qu,Tl[Al++]=Wu,Tl[Al++]=Im,qu=e.id,Wu=e.overflow,Im=t}var Ts=null,Or=null,Nn=!1,am=null,Ol=!1,CP=Error(Ce(519));function Rm(t){var e=Error(Ce(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw wS(Nl(e,t)),CP}function RY(t){var e=t.stateNode,n=t.type,r=t.memoizedProps;switch(e[Es]=t,e[ga]=r,n){case"dialog":gn("cancel",e),gn("close",e);break;case"iframe":case"object":case"embed":gn("load",e);break;case"video":case"audio":for(n=0;n<kS.length;n++)gn(kS[n],e);break;case"source":gn("error",e);break;case"img":case"image":case"link":gn("error",e),gn("load",e);break;case"details":gn("toggle",e);break;case"input":gn("invalid",e),Lce(e,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":gn("invalid",e);break;case"textarea":gn("invalid",e),jce(e,r.value,r.defaultValue,r.children)}n=r.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||e.textContent===""+n||r.suppressHydrationWarning===!0||$de(e.textContent,n)?(r.popover!=null&&(gn("beforetoggle",e),gn("toggle",e)),r.onScroll!=null&&gn("scroll",e),r.onScrollEnd!=null&&gn("scrollend",e),r.onClick!=null&&(e.onclick=Eh),e=!0):e=!1,e||Rm(t,!0)}function MY(t){for(Ts=t.return;Ts;)switch(Ts.tag){case 5:case 31:case 13:Ol=!1;return;case 27:case 3:Ol=!0;return;default:Ts=Ts.return}}function $y(t){if(t!==Ts)return!1;if(!Nn)return MY(t),Nn=!0,!1;var e=t.tag,n;if((n=e!==3&&e!==27)&&((n=e===5)&&(n=t.type,n=!(n!=="form"&&n!=="button")||ZP(t.type,t.memoizedProps)),n=!n),n&&Or&&Rm(t),MY(t),e===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(Ce(317));Or=yZ(t)}else if(e===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(Ce(317));Or=yZ(t)}else e===27?(e=Or,f0(t.type)?(t=eL,eL=null,Or=t):Or=e):Or=Ts?ql(t.stateNode.nextSibling):null;return!0}function A1(){Or=Ts=null,Nn=!1}function zM(){var t=am;return t!==null&&(na===null?na=t:na.push.apply(na,t),am=null),t}function wS(t){am===null?am=[t]:am.push(t)}var EP=kd(null),gy=null,Th=null;function bp(t,e,n){Ir(EP,e._currentValue),e._currentValue=n}function zh(t){t._currentValue=EP.current,ps(EP)}function TP(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function AP(t,e,n,r){var i=t.child;for(i!==null&&(i.return=t);i!==null;){var s=i.dependencies;if(s!==null){var o=i.child;s=s.firstContext;e:for(;s!==null;){var a=s;s=i;for(var l=0;l<e.length;l++)if(a.context===e[l]){s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),TP(s.return,n,t),r||(o=null);break e}s=a.next}}else if(i.tag===18){if(o=i.return,o===null)throw Error(Ce(341));o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),TP(o,n,t),o=null}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}}function Nx(t,e,n,r){t=null;for(var i=e,s=!1;i!==null;){if(!s){if(i.flags&524288)s=!0;else if(i.flags&262144)break}if(i.tag===10){var o=i.alternate;if(o===null)throw Error(Ce(387));if(o=o.memoizedProps,o!==null){var a=i.type;rl(i.pendingProps.value,o.value)||(t!==null?t.push(a):t=[a])}}else if(i===vA.current){if(o=i.alternate,o===null)throw Error(Ce(387));o.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(t!==null?t.push(ES):t=[ES])}i=i.return}t!==null&&AP(e,t,n,r),e.flags|=262144}function EA(t){for(t=t.firstContext;t!==null;){if(!rl(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function I1(t){gy=t,Th=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Rs(t){return aue(gy,t)}function zC(t,e){return gy===null&&I1(t),aue(t,e)}function aue(t,e){var n=e._currentValue;if(e={context:e,memoizedValue:n,next:null},Th===null){if(t===null)throw Error(Ce(308));Th=e,t.dependencies={lanes:0,firstContext:e},t.flags|=524288}else Th=Th.next=e;return n}var IAe=typeof AbortController<"u"?AbortController:function(){var t=[],e=this.signal={aborted:!1,addEventListener:function(n,r){t.push(r)}};this.abort=function(){e.aborted=!0,t.forEach(function(n){return n()})}},RAe=Qi.unstable_scheduleCallback,MAe=Qi.unstable_NormalPriority,Ti={$$typeof:Ch,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function iV(){return{controller:new IAe,data:new Map,refCount:0}}function U5(t){t.refCount--,t.refCount===0&&RAe(MAe,function(){t.controller.abort()})}var g_=null,IP=0,Rw=0,Yv=null;function NAe(t,e){if(g_===null){var n=g_=[];IP=0,Rw=IV(),Yv={status:"pending",value:void 0,then:function(r){n.push(r)}}}return IP++,e.then(NY,NY),e}function NY(){if(--IP===0&&g_!==null){Yv!==null&&(Yv.status="fulfilled");var t=g_;g_=null,Rw=0,Yv=null;for(var e=0;e<t.length;e++)(0,t[e])()}}function OAe(t,e){var n=[],r={status:"pending",value:null,reason:null,then:function(i){n.push(i)}};return t.then(function(){r.status="fulfilled",r.value=e;for(var i=0;i<n.length;i++)(0,n[i])(e)},function(i){for(r.status="rejected",r.reason=i,i=0;i<n.length;i++)(0,n[i])(void 0)}),r}var OY=Bt.S;Bt.S=function(t,e){xde=Ga(),typeof e=="object"&&e!==null&&typeof e.then=="function"&&NAe(t,e),OY!==null&&OY(t,e)};var s1=kd(null);function sV(){var t=s1.current;return t!==null?t:br.pooledCache}function AT(t,e){e===null?Ir(s1,s1.current):Ir(s1,e.pool)}function lue(){var t=sV();return t===null?null:{parent:Ti._currentValue,pool:t}}var Ox=Error(Ce(460)),oV=Error(Ce(474)),l9=Error(Ce(542)),TA={then:function(){}};function DY(t){return t=t.status,t==="fulfilled"||t==="rejected"}function cue(t,e,n){switch(n=t[n],n===void 0?t.push(e):n!==e&&(e.then(Eh,Eh),e=n),e.status){case"fulfilled":return e.value;case"rejected":throw t=e.reason,LY(t),t;default:if(typeof e.status=="string")e.then(Eh,Eh);else{if(t=br,t!==null&&100<t.shellSuspendCounter)throw Error(Ce(482));t=e,t.status="pending",t.then(function(r){if(e.status==="pending"){var i=e;i.status="fulfilled",i.value=r}},function(r){if(e.status==="pending"){var i=e;i.status="rejected",i.reason=r}})}switch(e.status){case"fulfilled":return e.value;case"rejected":throw t=e.reason,LY(t),t}throw o1=e,Ox}}function ag(t){try{var e=t._init;return e(t._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(o1=n,Ox):n}}var o1=null;function PY(){if(o1===null)throw Error(Ce(459));var t=o1;return o1=null,t}function LY(t){if(t===Ox||t===l9)throw Error(Ce(483))}var Zv=null,xS=0;function jC(t){var e=xS;return xS+=1,Zv===null&&(Zv=[]),cue(Zv,t,e)}function F2(t,e){e=e.props.ref,t.ref=e!==void 0?e:null}function BC(t,e){throw e.$$typeof===b6e?Error(Ce(525)):(t=Object.prototype.toString.call(e),Error(Ce(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)))}function uue(t){function e(v,b){if(t){var _=v.deletions;_===null?(v.deletions=[b],v.flags|=16):_.push(b)}}function n(v,b){if(!t)return null;for(;b!==null;)e(v,b),b=b.sibling;return null}function r(v){for(var b=new Map;v!==null;)v.key!==null?b.set(v.key,v):b.set(v.index,v),v=v.sibling;return b}function i(v,b){return v=Lh(v,b),v.index=0,v.sibling=null,v}function s(v,b,_){return v.index=_,t?(_=v.alternate,_!==null?(_=_.index,_<b?(v.flags|=67108866,b):_):(v.flags|=67108866,b)):(v.flags|=1048576,b)}function o(v){return t&&v.alternate===null&&(v.flags|=67108866),v}function a(v,b,_,S){return b===null||b.tag!==6?(b=PM(_,v.mode,S),b.return=v,b):(b=i(b,_),b.return=v,b)}function l(v,b,_,S){var k=_.type;return k===Av?u(v,b,_.props.children,S,_.key):b!==null&&(b.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===dp&&ag(k)===b.type)?(b=i(b,_.props),F2(b,_),b.return=v,b):(b=TT(_.type,_.key,_.props,null,v.mode,S),F2(b,_),b.return=v,b)}function c(v,b,_,S){return b===null||b.tag!==4||b.stateNode.containerInfo!==_.containerInfo||b.stateNode.implementation!==_.implementation?(b=LM(_,v.mode,S),b.return=v,b):(b=i(b,_.children||[]),b.return=v,b)}function u(v,b,_,S,k){return b===null||b.tag!==7?(b=i1(_,v.mode,S,k),b.return=v,b):(b=i(b,_),b.return=v,b)}function d(v,b,_){if(typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint")return b=PM(""+b,v.mode,_),b.return=v,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case MC:return _=TT(b.type,b.key,b.props,null,v.mode,_),F2(_,b),_.return=v,_;case f4:return b=LM(b,v.mode,_),b.return=v,b;case dp:return b=ag(b),d(v,b,_)}if(p4(b)||z2(b))return b=i1(b,v.mode,_,null),b.return=v,b;if(typeof b.then=="function")return d(v,jC(b),_);if(b.$$typeof===Ch)return d(v,zC(v,b),_);BC(v,b)}return null}function h(v,b,_,S){var k=b!==null?b.key:null;if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return k!==null?null:a(v,b,""+_,S);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case MC:return _.key===k?l(v,b,_,S):null;case f4:return _.key===k?c(v,b,_,S):null;case dp:return _=ag(_),h(v,b,_,S)}if(p4(_)||z2(_))return k!==null?null:u(v,b,_,S,null);if(typeof _.then=="function")return h(v,b,jC(_),S);if(_.$$typeof===Ch)return h(v,b,zC(v,_),S);BC(v,_)}return null}function f(v,b,_,S,k){if(typeof S=="string"&&S!==""||typeof S=="number"||typeof S=="bigint")return v=v.get(_)||null,a(b,v,""+S,k);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case MC:return v=v.get(S.key===null?_:S.key)||null,l(b,v,S,k);case f4:return v=v.get(S.key===null?_:S.key)||null,c(b,v,S,k);case dp:return S=ag(S),f(v,b,_,S,k)}if(p4(S)||z2(S))return v=v.get(_)||null,u(b,v,S,k,null);if(typeof S.then=="function")return f(v,b,_,jC(S),k);if(S.$$typeof===Ch)return f(v,b,_,zC(b,S),k);BC(b,S)}return null}function p(v,b,_,S){for(var k=null,T=null,E=b,C=b=0,R=null;E!==null&&C<_.length;C++){E.index>C?(R=E,E=null):R=E.sibling;var M=h(v,E,_[C],S);if(M===null){E===null&&(E=R);break}t&&E&&M.alternate===null&&e(v,E),b=s(M,b,C),T===null?k=M:T.sibling=M,T=M,E=R}if(C===_.length)return n(v,E),Nn&&ah(v,C),k;if(E===null){for(;C<_.length;C++)E=d(v,_[C],S),E!==null&&(b=s(E,b,C),T===null?k=E:T.sibling=E,T=E);return Nn&&ah(v,C),k}for(E=r(E);C<_.length;C++)R=f(E,v,C,_[C],S),R!==null&&(t&&R.alternate!==null&&E.delete(R.key===null?C:R.key),b=s(R,b,C),T===null?k=R:T.sibling=R,T=R);return t&&E.forEach(function(D){return e(v,D)}),Nn&&ah(v,C),k}function g(v,b,_,S){if(_==null)throw Error(Ce(151));for(var k=null,T=null,E=b,C=b=0,R=null,M=_.next();E!==null&&!M.done;C++,M=_.next()){E.index>C?(R=E,E=null):R=E.sibling;var D=h(v,E,M.value,S);if(D===null){E===null&&(E=R);break}t&&E&&D.alternate===null&&e(v,E),b=s(D,b,C),T===null?k=D:T.sibling=D,T=D,E=R}if(M.done)return n(v,E),Nn&&ah(v,C),k;if(E===null){for(;!M.done;C++,M=_.next())M=d(v,M.value,S),M!==null&&(b=s(M,b,C),T===null?k=M:T.sibling=M,T=M);return Nn&&ah(v,C),k}for(E=r(E);!M.done;C++,M=_.next())M=f(E,v,C,M.value,S),M!==null&&(t&&M.alternate!==null&&E.delete(M.key===null?C:M.key),b=s(M,b,C),T===null?k=M:T.sibling=M,T=M);return t&&E.forEach(function(P){return e(v,P)}),Nn&&ah(v,C),k}function y(v,b,_,S){if(typeof _=="object"&&_!==null&&_.type===Av&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case MC:e:{for(var k=_.key;b!==null;){if(b.key===k){if(k=_.type,k===Av){if(b.tag===7){n(v,b.sibling),S=i(b,_.props.children),S.return=v,v=S;break e}}else if(b.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===dp&&ag(k)===b.type){n(v,b.sibling),S=i(b,_.props),F2(S,_),S.return=v,v=S;break e}n(v,b);break}else e(v,b);b=b.sibling}_.type===Av?(S=i1(_.props.children,v.mode,S,_.key),S.return=v,v=S):(S=TT(_.type,_.key,_.props,null,v.mode,S),F2(S,_),S.return=v,v=S)}return o(v);case f4:e:{for(k=_.key;b!==null;){if(b.key===k)if(b.tag===4&&b.stateNode.containerInfo===_.containerInfo&&b.stateNode.implementation===_.implementation){n(v,b.sibling),S=i(b,_.children||[]),S.return=v,v=S;break e}else{n(v,b);break}else e(v,b);b=b.sibling}S=LM(_,v.mode,S),S.return=v,v=S}return o(v);case dp:return _=ag(_),y(v,b,_,S)}if(p4(_))return p(v,b,_,S);if(z2(_)){if(k=z2(_),typeof k!="function")throw Error(Ce(150));return _=k.call(_),g(v,b,_,S)}if(typeof _.then=="function")return y(v,b,jC(_),S);if(_.$$typeof===Ch)return y(v,b,zC(v,_),S);BC(v,_)}return typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint"?(_=""+_,b!==null&&b.tag===6?(n(v,b.sibling),S=i(b,_),S.return=v,v=S):(n(v,b),S=PM(_,v.mode,S),S.return=v,v=S),o(v)):n(v,b)}return function(v,b,_,S){try{xS=0;var k=y(v,b,_,S);return Zv=null,k}catch(E){if(E===Ox||E===l9)throw E;var T=Ba(29,E,null,v.mode);return T.lanes=S,T.return=v,T}finally{}}}var R1=uue(!0),due=uue(!1),hp=!1;function aV(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function RP(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function lm(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function cm(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,Un&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,e=kA(t),nue(t,null,n),e}return a9(t,r,e,n),kA(t)}function y_(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194048)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Ice(t,n)}}function jM(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=e:s=s.next=e}else i=s=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,callbacks:r.callbacks},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}var MP=!1;function v_(){if(MP){var t=Yv;if(t!==null)throw t}}function b_(t,e,n,r){MP=!1;var i=t.updateQueue;hp=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var u=t.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(s!==null){var d=i.baseState;o=0,u=c=l=null,a=s;do{var h=a.lane&-536870913,f=h!==a.lane;if(f?(An&h)===h:(r&h)===h){h!==0&&h===Rw&&(MP=!0),u!==null&&(u=u.next={lane:0,tag:a.tag,payload:a.payload,callback:null,next:null});e:{var p=t,g=a;h=e;var y=n;switch(g.tag){case 1:if(p=g.payload,typeof p=="function"){d=p.call(y,d,h);break e}d=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=g.payload,h=typeof p=="function"?p.call(y,d,h):p,h==null)break e;d=Lr({},d,h);break e;case 2:hp=!0}}h=a.callback,h!==null&&(t.flags|=64,f&&(t.flags|=8192),f=i.callbacks,f===null?i.callbacks=[h]:f.push(h))}else f={lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=f,l=d):u=u.next=f,o|=h;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;f=a,a=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);u===null&&(l=d),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=u,s===null&&(i.shared.lanes=0),Nm|=o,t.lanes=o,t.memoizedState=d}}function hue(t,e){if(typeof t!="function")throw Error(Ce(191,t));t.call(e)}function fue(t,e){var n=t.callbacks;if(n!==null)for(t.callbacks=null,t=0;t<n.length;t++)hue(n[t],e)}var Mw=kd(null),AA=kd(0);function zY(t,e){t=ef,Ir(AA,t),Ir(Mw,e),ef=t|e.baseLanes}function NP(){Ir(AA,ef),Ir(Mw,Mw.current)}function lV(){ef=AA.current,ps(Mw),ps(AA)}var il=kd(null),Ul=null;function wp(t){var e=t.alternate;Ir(yi,yi.current&1),Ir(il,t),Ul===null&&(e===null||Mw.current!==null||e.memoizedState!==null)&&(Ul=t)}function OP(t){Ir(yi,yi.current),Ir(il,t),Ul===null&&(Ul=t)}function pue(t){t.tag===22?(Ir(yi,yi.current),Ir(il,t),Ul===null&&(Ul=t)):xp()}function xp(){Ir(yi,yi.current),Ir(il,il.current)}function za(t){ps(il),Ul===t&&(Ul=null),ps(yi)}var yi=kd(0);function IA(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||QP(n)||JP(n)))return e}else if(e.tag===19&&(e.memoizedProps.revealOrder==="forwards"||e.memoizedProps.revealOrder==="backwards"||e.memoizedProps.revealOrder==="unstable_legacy-backwards"||e.memoizedProps.revealOrder==="together")){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Xh=0,Xt=null,lr=null,Ci=null,RA=!1,Xv=!1,M1=!1,MA=0,_S=0,Qv=null,DAe=0;function si(){throw Error(Ce(321))}function cV(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!rl(t[n],e[n]))return!1;return!0}function uV(t,e,n,r,i,s){return Xh=s,Xt=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Bt.H=t===null||t.memoizedState===null?que:xV,M1=!1,s=n(r,i),M1=!1,Xv&&(s=gue(e,n,r,i)),mue(t),s}function mue(t){Bt.H=SS;var e=lr!==null&&lr.next!==null;if(Xh=0,Ci=lr=Xt=null,RA=!1,_S=0,Qv=null,e)throw Error(Ce(300));t===null||Ii||(t=t.dependencies,t!==null&&EA(t)&&(Ii=!0))}function gue(t,e,n,r){Xt=t;var i=0;do{if(Xv&&(Qv=null),_S=0,Xv=!1,25<=i)throw Error(Ce(301));if(i+=1,Ci=lr=null,t.updateQueue!=null){var s=t.updateQueue;s.lastEffect=null,s.events=null,s.stores=null,s.memoCache!=null&&(s.memoCache.index=0)}Bt.H=Wue,s=e(n,r)}while(Xv);return s}function PAe(){var t=Bt.H,e=t.useState()[0];return e=typeof e.then=="function"?q5(e):e,t=t.useState()[0],(lr!==null?lr.memoizedState:null)!==t&&(Xt.flags|=1024),e}function dV(){var t=MA!==0;return MA=0,t}function hV(t,e,n){e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~n}function fV(t){if(RA){for(t=t.memoizedState;t!==null;){var e=t.queue;e!==null&&(e.pending=null),t=t.next}RA=!1}Xh=0,Ci=lr=Xt=null,Xv=!1,_S=MA=0,Qv=null}function wo(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ci===null?Xt.memoizedState=Ci=t:Ci=Ci.next=t,Ci}function bi(){if(lr===null){var t=Xt.alternate;t=t!==null?t.memoizedState:null}else t=lr.next;var e=Ci===null?Xt.memoizedState:Ci.next;if(e!==null)Ci=e,lr=t;else{if(t===null)throw Xt.alternate===null?Error(Ce(467)):Error(Ce(310));lr=t,t={memoizedState:lr.memoizedState,baseState:lr.baseState,baseQueue:lr.baseQueue,queue:lr.queue,next:null},Ci===null?Xt.memoizedState=Ci=t:Ci=Ci.next=t}return Ci}function c9(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function q5(t){var e=_S;return _S+=1,Qv===null&&(Qv=[]),t=cue(Qv,t,e),e=Xt,(Ci===null?e.memoizedState:Ci.next)===null&&(e=e.alternate,Bt.H=e===null||e.memoizedState===null?que:xV),t}function u9(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return q5(t);if(t.$$typeof===Ch)return Rs(t)}throw Error(Ce(438,String(t)))}function pV(t){var e=null,n=Xt.updateQueue;if(n!==null&&(e=n.memoCache),e==null){var r=Xt.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(e={data:r.data.map(function(i){return i.slice()}),index:0})))}if(e==null&&(e={data:[],index:0}),n===null&&(n=c9(),Xt.updateQueue=n),n.memoCache=e,n=e.data[e.index],n===void 0)for(n=e.data[e.index]=Array(t),r=0;r<t;r++)n[r]=w6e;return e.index++,n}function Qh(t,e){return typeof e=="function"?e(t):e}function IT(t){var e=bi();return mV(e,lr,t)}function mV(t,e,n){var r=t.queue;if(r===null)throw Error(Ce(311));r.lastRenderedReducer=n;var i=t.baseQueue,s=r.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}e.baseQueue=i=s,r.pending=null}if(s=t.baseState,i===null)t.memoizedState=s;else{e=i.next;var a=o=null,l=null,c=e,u=!1;do{var d=c.lane&-536870913;if(d!==c.lane?(An&d)===d:(Xh&d)===d){var h=c.revertLane;if(h===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),d===Rw&&(u=!0);else if((Xh&h)===h){c=c.next,h===Rw&&(u=!0);continue}else d={lane:0,revertLane:c.revertLane,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(a=l=d,o=s):l=l.next=d,Xt.lanes|=h,Nm|=h;d=c.action,M1&&n(s,d),s=c.hasEagerState?c.eagerState:n(s,d)}else h={lane:d,revertLane:c.revertLane,gesture:c.gesture,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(a=l=h,o=s):l=l.next=h,Xt.lanes|=d,Nm|=d;c=c.next}while(c!==null&&c!==e);if(l===null?o=s:l.next=a,!rl(s,t.memoizedState)&&(Ii=!0,u&&(n=Yv,n!==null)))throw n;t.memoizedState=s,t.baseState=o,t.baseQueue=l,r.lastRenderedState=s}return i===null&&(r.lanes=0),[t.memoizedState,r.dispatch]}function BM(t){var e=bi(),n=e.queue;if(n===null)throw Error(Ce(311));n.lastRenderedReducer=t;var r=n.dispatch,i=n.pending,s=e.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do s=t(s,o.action),o=o.next;while(o!==i);rl(s,e.memoizedState)||(Ii=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),n.lastRenderedState=s}return[s,r]}function yue(t,e,n){var r=Xt,i=bi(),s=Nn;if(s){if(n===void 0)throw Error(Ce(407));n=n()}else n=e();var o=!rl((lr||i).memoizedState,n);if(o&&(i.memoizedState=n,Ii=!0),i=i.queue,gV(wue.bind(null,r,i,t),[t]),i.getSnapshot!==e||o||Ci!==null&&Ci.memoizedState.tag&1){if(r.flags|=2048,Nw(9,{destroy:void 0},bue.bind(null,r,i,n,e),null),br===null)throw Error(Ce(349));s||Xh&127||vue(r,e,n)}return n}function vue(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Xt.updateQueue,e===null?(e=c9(),Xt.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function bue(t,e,n,r){e.value=n,e.getSnapshot=r,xue(e)&&_ue(t)}function wue(t,e,n){return n(function(){xue(e)&&_ue(t)})}function xue(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!rl(t,n)}catch{return!0}}function _ue(t){var e=my(t,2);e!==null&&fa(e,t,2)}function DP(t){var e=wo();if(typeof t=="function"){var n=t;if(t=n(),M1){Kp(!0);try{n()}finally{Kp(!1)}}}return e.memoizedState=e.baseState=t,e.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qh,lastRenderedState:t},e}function Sue(t,e,n,r){return t.baseState=n,mV(t,lr,typeof r=="function"?r:Qh)}function LAe(t,e,n,r,i){if(h9(t))throw Error(Ce(485));if(t=e.action,t!==null){var s={payload:i,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(o){s.listeners.push(o)}};Bt.T!==null?n(!0):s.isTransition=!1,r(s),n=e.pending,n===null?(s.next=e.pending=s,kue(e,s)):(s.next=n.next,e.pending=n.next=s)}}function kue(t,e){var n=e.action,r=e.payload,i=t.state;if(e.isTransition){var s=Bt.T,o={};Bt.T=o;try{var a=n(i,r),l=Bt.S;l!==null&&l(o,a),jY(t,e,a)}catch(c){PP(t,e,c)}finally{s!==null&&o.types!==null&&(s.types=o.types),Bt.T=s}}else try{s=n(i,r),jY(t,e,s)}catch(c){PP(t,e,c)}}function jY(t,e,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(r){BY(t,e,r)},function(r){return PP(t,e,r)}):BY(t,e,n)}function BY(t,e,n){e.status="fulfilled",e.value=n,Cue(e),t.state=n,e=t.pending,e!==null&&(n=e.next,n===e?t.pending=null:(n=n.next,e.next=n,kue(t,n)))}function PP(t,e,n){var r=t.pending;if(t.pending=null,r!==null){r=r.next;do e.status="rejected",e.reason=n,Cue(e),e=e.next;while(e!==r)}t.action=null}function Cue(t){t=t.listeners;for(var e=0;e<t.length;e++)(0,t[e])()}function Eue(t,e){return e}function FY(t,e){if(Nn){var n=br.formState;if(n!==null){e:{var r=Xt;if(Nn){if(Or){t:{for(var i=Or,s=Ol;i.nodeType!==8;){if(!s){i=null;break t}if(i=ql(i.nextSibling),i===null){i=null;break t}}s=i.data,i=s==="F!"||s==="F"?i:null}if(i){Or=ql(i.nextSibling),r=i.data==="F!";break e}}Rm(r)}r=!1}r&&(e=n[0])}}return n=wo(),n.memoizedState=n.baseState=e,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eue,lastRenderedState:e},n.queue=r,n=$ue.bind(null,Xt,r),r.dispatch=n,r=DP(!1),s=wV.bind(null,Xt,!1,r.queue),r=wo(),i={state:e,dispatch:null,action:t,pending:null},r.queue=i,n=LAe.bind(null,Xt,i,s,n),i.dispatch=n,r.memoizedState=t,[e,n,!1]}function VY(t){var e=bi();return Tue(e,lr,t)}function Tue(t,e,n){if(e=mV(t,e,Eue)[0],t=IT(Qh)[0],typeof e=="object"&&e!==null&&typeof e.then=="function")try{var r=q5(e)}catch(o){throw o===Ox?l9:o}else r=e;e=bi();var i=e.queue,s=i.dispatch;return n!==e.memoizedState&&(Xt.flags|=2048,Nw(9,{destroy:void 0},zAe.bind(null,i,n),null)),[r,s,t]}function zAe(t,e){t.action=e}function $Y(t){var e=bi(),n=lr;if(n!==null)return Tue(e,n,t);bi(),e=e.memoizedState,n=bi();var r=n.queue.dispatch;return n.memoizedState=t,[e,r,!1]}function Nw(t,e,n,r){return t={tag:t,create:n,deps:r,inst:e,next:null},e=Xt.updateQueue,e===null&&(e=c9(),Xt.updateQueue=e),n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t),t}function Aue(){return bi().memoizedState}function RT(t,e,n,r){var i=wo();Xt.flags|=t,i.memoizedState=Nw(1|e,{destroy:void 0},n,r===void 0?null:r)}function d9(t,e,n,r){var i=bi();r=r===void 0?null:r;var s=i.memoizedState.inst;lr!==null&&r!==null&&cV(r,lr.memoizedState.deps)?i.memoizedState=Nw(e,s,n,r):(Xt.flags|=t,i.memoizedState=Nw(1|e,s,n,r))}function HY(t,e){RT(8390656,8,t,e)}function gV(t,e){d9(2048,8,t,e)}function jAe(t){Xt.flags|=4;var e=Xt.updateQueue;if(e===null)e=c9(),Xt.updateQueue=e,e.events=[t];else{var n=e.events;n===null?e.events=[t]:n.push(t)}}function Iue(t){var e=bi().memoizedState;return jAe({ref:e,nextImpl:t}),function(){if(Un&2)throw Error(Ce(440));return e.impl.apply(void 0,arguments)}}function Rue(t,e){return d9(4,2,t,e)}function Mue(t,e){return d9(4,4,t,e)}function Nue(t,e){if(typeof e=="function"){t=t();var n=e(t);return function(){typeof n=="function"?n():e(null)}}if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function Oue(t,e,n){n=n!=null?n.concat([t]):null,d9(4,4,Nue.bind(null,e,t),n)}function yV(){}function Due(t,e){var n=bi();e=e===void 0?null:e;var r=n.memoizedState;return e!==null&&cV(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function Pue(t,e){var n=bi();e=e===void 0?null:e;var r=n.memoizedState;if(e!==null&&cV(e,r[1]))return r[0];if(r=t(),M1){Kp(!0);try{t()}finally{Kp(!1)}}return n.memoizedState=[r,e],r}function vV(t,e,n){return n===void 0||Xh&1073741824&&!(An&261930)?t.memoizedState=e:(t.memoizedState=n,t=Sde(),Xt.lanes|=t,Nm|=t,n)}function Lue(t,e,n,r){return rl(n,e)?n:Mw.current!==null?(t=vV(t,n,r),rl(t,e)||(Ii=!0),t):!(Xh&42)||Xh&1073741824&&!(An&261930)?(Ii=!0,t.memoizedState=n):(t=Sde(),Xt.lanes|=t,Nm|=t,e)}function zue(t,e,n,r,i){var s=Wn.p;Wn.p=s!==0&&8>s?s:8;var o=Bt.T,a={};Bt.T=a,wV(t,!1,e,n);try{var l=i(),c=Bt.S;if(c!==null&&c(a,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=OAe(l,r);w_(t,e,u,Za(t))}else w_(t,e,r,Za(t))}catch(d){w_(t,e,{then:function(){},status:"rejected",reason:d},Za())}finally{Wn.p=s,o!==null&&a.types!==null&&(o.types=a.types),Bt.T=o}}function BAe(){}function LP(t,e,n,r){if(t.tag!==5)throw Error(Ce(476));var i=jue(t).queue;zue(t,i,e,r1,n===null?BAe:function(){return Bue(t),n(r)})}function jue(t){var e=t.memoizedState;if(e!==null)return e;e={memoizedState:r1,baseState:r1,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qh,lastRenderedState:r1},next:null};var n={};return e.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qh,lastRenderedState:n},next:null},t.memoizedState=e,t=t.alternate,t!==null&&(t.memoizedState=e),e}function Bue(t){var e=jue(t);e.next===null&&(e=t.alternate.memoizedState),w_(t,e.next.queue,{},Za())}function bV(){return Rs(ES)}function Fue(){return bi().memoizedState}function Vue(){return bi().memoizedState}function FAe(t){for(var e=t.return;e!==null;){switch(e.tag){case 24:case 3:var n=Za();t=lm(n);var r=cm(e,t,n);r!==null&&(fa(r,e,n),y_(r,e,n)),e={cache:iV()},t.payload=e;return}e=e.return}}function VAe(t,e,n){var r=Za();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},h9(t)?Hue(e,n):(n=eV(t,e,n,r),n!==null&&(fa(n,t,r),Uue(n,e,r)))}function $ue(t,e,n){var r=Za();w_(t,e,n,r)}function w_(t,e,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(h9(t))Hue(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,rl(a,o))return a9(t,e,i,0),br===null&&o9(),!1}catch{}finally{}if(n=eV(t,e,i,r),n!==null)return fa(n,t,r),Uue(n,e,r),!0}return!1}function wV(t,e,n,r){if(r={lane:2,revertLane:IV(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},h9(t)){if(e)throw Error(Ce(479))}else e=eV(t,n,r,2),e!==null&&fa(e,t,2)}function h9(t){var e=t.alternate;return t===Xt||e!==null&&e===Xt}function Hue(t,e){Xv=RA=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function Uue(t,e,n){if(n&4194048){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Ice(t,n)}}var SS={readContext:Rs,use:u9,useCallback:si,useContext:si,useEffect:si,useImperativeHandle:si,useLayoutEffect:si,useInsertionEffect:si,useMemo:si,useReducer:si,useRef:si,useState:si,useDebugValue:si,useDeferredValue:si,useTransition:si,useSyncExternalStore:si,useId:si,useHostTransitionStatus:si,useFormState:si,useActionState:si,useOptimistic:si,useMemoCache:si,useCacheRefresh:si};SS.useEffectEvent=si;var que={readContext:Rs,use:u9,useCallback:function(t,e){return wo().memoizedState=[t,e===void 0?null:e],t},useContext:Rs,useEffect:HY,useImperativeHandle:function(t,e,n){n=n!=null?n.concat([t]):null,RT(4194308,4,Nue.bind(null,e,t),n)},useLayoutEffect:function(t,e){return RT(4194308,4,t,e)},useInsertionEffect:function(t,e){RT(4,2,t,e)},useMemo:function(t,e){var n=wo();e=e===void 0?null:e;var r=t();if(M1){Kp(!0);try{t()}finally{Kp(!1)}}return n.memoizedState=[r,e],r},useReducer:function(t,e,n){var r=wo();if(n!==void 0){var i=n(e);if(M1){Kp(!0);try{n(e)}finally{Kp(!1)}}}else i=e;return r.memoizedState=r.baseState=i,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:i},r.queue=t,t=t.dispatch=VAe.bind(null,Xt,t),[r.memoizedState,t]},useRef:function(t){var e=wo();return t={current:t},e.memoizedState=t},useState:function(t){t=DP(t);var e=t.queue,n=$ue.bind(null,Xt,e);return e.dispatch=n,[t.memoizedState,n]},useDebugValue:yV,useDeferredValue:function(t,e){var n=wo();return vV(n,t,e)},useTransition:function(){var t=DP(!1);return t=zue.bind(null,Xt,t.queue,!0,!1),wo().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,e,n){var r=Xt,i=wo();if(Nn){if(n===void 0)throw Error(Ce(407));n=n()}else{if(n=e(),br===null)throw Error(Ce(349));An&127||vue(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,HY(wue.bind(null,r,s,t),[t]),r.flags|=2048,Nw(9,{destroy:void 0},bue.bind(null,r,s,n,e),null),n},useId:function(){var t=wo(),e=br.identifierPrefix;if(Nn){var n=Wu,r=qu;n=(r&~(1<<32-Ya(r)-1)).toString(32)+n,e="_"+e+"R_"+n,n=MA++,0<n&&(e+="H"+n.toString(32)),e+="_"}else n=DAe++,e="_"+e+"r_"+n.toString(32)+"_";return t.memoizedState=e},useHostTransitionStatus:bV,useFormState:FY,useActionState:FY,useOptimistic:function(t){var e=wo();e.memoizedState=e.baseState=t;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return e.queue=n,e=wV.bind(null,Xt,!0,n),n.dispatch=e,[t,e]},useMemoCache:pV,useCacheRefresh:function(){return wo().memoizedState=FAe.bind(null,Xt)},useEffectEvent:function(t){var e=wo(),n={impl:t};return e.memoizedState=n,function(){if(Un&2)throw Error(Ce(440));return n.impl.apply(void 0,arguments)}}},xV={readContext:Rs,use:u9,useCallback:Due,useContext:Rs,useEffect:gV,useImperativeHandle:Oue,useInsertionEffect:Rue,useLayoutEffect:Mue,useMemo:Pue,useReducer:IT,useRef:Aue,useState:function(){return IT(Qh)},useDebugValue:yV,useDeferredValue:function(t,e){var n=bi();return Lue(n,lr.memoizedState,t,e)},useTransition:function(){var t=IT(Qh)[0],e=bi().memoizedState;return[typeof t=="boolean"?t:q5(t),e]},useSyncExternalStore:yue,useId:Fue,useHostTransitionStatus:bV,useFormState:VY,useActionState:VY,useOptimistic:function(t,e){var n=bi();return Sue(n,lr,t,e)},useMemoCache:pV,useCacheRefresh:Vue};xV.useEffectEvent=Iue;var Wue={readContext:Rs,use:u9,useCallback:Due,useContext:Rs,useEffect:gV,useImperativeHandle:Oue,useInsertionEffect:Rue,useLayoutEffect:Mue,useMemo:Pue,useReducer:BM,useRef:Aue,useState:function(){return BM(Qh)},useDebugValue:yV,useDeferredValue:function(t,e){var n=bi();return lr===null?vV(n,t,e):Lue(n,lr.memoizedState,t,e)},useTransition:function(){var t=BM(Qh)[0],e=bi().memoizedState;return[typeof t=="boolean"?t:q5(t),e]},useSyncExternalStore:yue,useId:Fue,useHostTransitionStatus:bV,useFormState:$Y,useActionState:$Y,useOptimistic:function(t,e){var n=bi();return lr!==null?Sue(n,lr,t,e):(n.baseState=t,[t,n.queue.dispatch])},useMemoCache:pV,useCacheRefresh:Vue};Wue.useEffectEvent=Iue;function FM(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Lr({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var zP={enqueueSetState:function(t,e,n){t=t._reactInternals;var r=Za(),i=lm(r);i.payload=e,n!=null&&(i.callback=n),e=cm(t,i,r),e!==null&&(fa(e,t,r),y_(e,t,r))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=Za(),i=lm(r);i.tag=1,i.payload=e,n!=null&&(i.callback=n),e=cm(t,i,r),e!==null&&(fa(e,t,r),y_(e,t,r))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=Za(),r=lm(n);r.tag=2,e!=null&&(r.callback=e),e=cm(t,r,n),e!==null&&(fa(e,t,n),y_(e,t,n))}};function UY(t,e,n,r,i,s,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,s,o):e.prototype&&e.prototype.isPureReactComponent?!vS(n,r)||!vS(i,s):!0}function qY(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&zP.enqueueReplaceState(e,e.state,null)}function N1(t,e){var n=e;if("ref"in e){n={};for(var r in e)r!=="ref"&&(n[r]=e[r])}if(t=t.defaultProps){n===e&&(n=Lr({},n));for(var i in t)n[i]===void 0&&(n[i]=t[i])}return n}function Gue(t){SA(t)}function Kue(t){console.error(t)}function Yue(t){SA(t)}function NA(t,e){try{var n=t.onUncaughtError;n(e.value,{componentStack:e.stack})}catch(r){setTimeout(function(){throw r})}}function WY(t,e,n){try{var r=t.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:e.tag===1?e.stateNode:null})}catch(i){setTimeout(function(){throw i})}}function jP(t,e,n){return n=lm(n),n.tag=3,n.payload={element:null},n.callback=function(){NA(t,e)},n}function Zue(t){return t=lm(t),t.tag=3,t}function Xue(t,e,n,r){var i=n.type.getDerivedStateFromError;if(typeof i=="function"){var s=r.value;t.payload=function(){return i(s)},t.callback=function(){WY(e,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(t.callback=function(){WY(e,n,r),typeof i!="function"&&(um===null?um=new Set([this]):um.add(this));var a=r.stack;this.componentDidCatch(r.value,{componentStack:a!==null?a:""})})}function $Ae(t,e,n,r,i){if(n.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(e=n.alternate,e!==null&&Nx(e,n,i,!0),n=il.current,n!==null){switch(n.tag){case 31:case 13:return Ul===null?zA():n.alternate===null&&ui===0&&(ui=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===TA?n.flags|=16384:(e=n.updateQueue,e===null?n.updateQueue=new Set([r]):e.add(r),XM(t,r,i)),!1;case 22:return n.flags|=65536,r===TA?n.flags|=16384:(e=n.updateQueue,e===null?(e={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=e):(n=e.retryQueue,n===null?e.retryQueue=new Set([r]):n.add(r)),XM(t,r,i)),!1}throw Error(Ce(435,n.tag))}return XM(t,r,i),zA(),!1}if(Nn)return e=il.current,e!==null?(!(e.flags&65536)&&(e.flags|=256),e.flags|=65536,e.lanes=i,r!==CP&&(t=Error(Ce(422),{cause:r}),wS(Nl(t,n)))):(r!==CP&&(e=Error(Ce(423),{cause:r}),wS(Nl(e,n))),t=t.current.alternate,t.flags|=65536,i&=-i,t.lanes|=i,r=Nl(r,n),i=jP(t.stateNode,r,i),jM(t,i),ui!==4&&(ui=2)),!1;var s=Error(Ce(520),{cause:r});if(s=Nl(s,n),S_===null?S_=[s]:S_.push(s),ui!==4&&(ui=2),e===null)return!0;r=Nl(r,n),n=e;do{switch(n.tag){case 3:return n.flags|=65536,t=i&-i,n.lanes|=t,t=jP(n.stateNode,r,t),jM(n,t),!1;case 1:if(e=n.type,s=n.stateNode,(n.flags&128)===0&&(typeof e.getDerivedStateFromError=="function"||s!==null&&typeof s.componentDidCatch=="function"&&(um===null||!um.has(s))))return n.flags|=65536,i&=-i,n.lanes|=i,i=Zue(i),Xue(i,t,n,r),jM(n,i),!1}n=n.return}while(n!==null);return!1}var _V=Error(Ce(461)),Ii=!1;function xs(t,e,n,r){e.child=t===null?due(e,null,n,r):R1(e,t.child,n,r)}function GY(t,e,n,r,i){n=n.render;var s=e.ref;if("ref"in r){var o={};for(var a in r)a!=="ref"&&(o[a]=r[a])}else o=r;return I1(e),r=uV(t,e,n,o,s,i),a=dV(),t!==null&&!Ii?(hV(t,e,i),Jh(t,e,i)):(Nn&&a&&nV(e),e.flags|=1,xs(t,e,r,i),e.child)}function KY(t,e,n,r,i){if(t===null){var s=n.type;return typeof s=="function"&&!tV(s)&&s.defaultProps===void 0&&n.compare===null?(e.tag=15,e.type=s,Que(t,e,s,r,i)):(t=TT(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(s=t.child,!SV(t,i)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:vS,n(o,r)&&t.ref===e.ref)return Jh(t,e,i)}return e.flags|=1,t=Lh(s,r),t.ref=e.ref,t.return=e,e.child=t}function Que(t,e,n,r,i){if(t!==null){var s=t.memoizedProps;if(vS(s,r)&&t.ref===e.ref)if(Ii=!1,e.pendingProps=r=s,SV(t,i))t.flags&131072&&(Ii=!0);else return e.lanes=t.lanes,Jh(t,e,i)}return BP(t,e,n,r,i)}function Jue(t,e,n,r){var i=r.children,s=t!==null?t.memoizedState:null;if(t===null&&e.stateNode===null&&(e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if(e.flags&128){if(s=s!==null?s.baseLanes|n:n,t!==null){for(r=e.child=t.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~s}else r=0,e.child=null;return YY(t,e,s,n,r)}if(n&536870912)e.memoizedState={baseLanes:0,cachePool:null},t!==null&&AT(e,s!==null?s.cachePool:null),s!==null?zY(e,s):NP(),pue(e);else return r=e.lanes=536870912,YY(t,e,s!==null?s.baseLanes|n:n,n,r)}else s!==null?(AT(e,s.cachePool),zY(e,s),xp(),e.memoizedState=null):(t!==null&&AT(e,null),NP(),xp());return xs(t,e,i,n),e.child}function g4(t,e){return t!==null&&t.tag===22||e.stateNode!==null||(e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),e.sibling}function YY(t,e,n,r,i){var s=sV();return s=s===null?null:{parent:Ti._currentValue,pool:s},e.memoizedState={baseLanes:n,cachePool:s},t!==null&&AT(e,null),NP(),pue(e),t!==null&&Nx(t,e,r,!0),e.childLanes=i,null}function MT(t,e){return e=OA({mode:e.mode,children:e.children},t.mode),e.ref=t.ref,t.child=e,e.return=t,e}function ZY(t,e,n){return R1(e,t.child,null,n),t=MT(e,e.pendingProps),t.flags|=2,za(e),e.memoizedState=null,t}function HAe(t,e,n){var r=e.pendingProps,i=(e.flags&128)!==0;if(e.flags&=-129,t===null){if(Nn){if(r.mode==="hidden")return t=MT(e,r),e.lanes=536870912,g4(null,t);if(OP(e),(t=Or)?(t=qde(t,Ol),t=t!==null&&t.data==="&"?t:null,t!==null&&(e.memoizedState={dehydrated:t,treeContext:Im!==null?{id:qu,overflow:Wu}:null,retryLane:536870912,hydrationErrors:null},n=iue(t),n.return=e,e.child=n,Ts=e,Or=null)):t=null,t===null)throw Rm(e);return e.lanes=536870912,null}return MT(e,r)}var s=t.memoizedState;if(s!==null){var o=s.dehydrated;if(OP(e),i)if(e.flags&256)e.flags&=-257,e=ZY(t,e,n);else if(e.memoizedState!==null)e.child=t.child,e.flags|=128,e=null;else throw Error(Ce(558));else if(Ii||Nx(t,e,n,!1),i=(n&t.childLanes)!==0,Ii||i){if(r=br,r!==null&&(o=Rce(r,n),o!==0&&o!==s.retryLane))throw s.retryLane=o,my(t,o),fa(r,t,o),_V;zA(),e=ZY(t,e,n)}else t=s.treeContext,Or=ql(o.nextSibling),Ts=e,Nn=!0,am=null,Ol=!1,t!==null&&oue(e,t),e=MT(e,r),e.flags|=4096;return e}return t=Lh(t.child,{mode:r.mode,children:r.children}),t.ref=e.ref,e.child=t,t.return=e,t}function NT(t,e){var n=e.ref;if(n===null)t!==null&&t.ref!==null&&(e.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(Ce(284));(t===null||t.ref!==n)&&(e.flags|=4194816)}}function BP(t,e,n,r,i){return I1(e),n=uV(t,e,n,r,void 0,i),r=dV(),t!==null&&!Ii?(hV(t,e,i),Jh(t,e,i)):(Nn&&r&&nV(e),e.flags|=1,xs(t,e,n,i),e.child)}function XY(t,e,n,r,i,s){return I1(e),e.updateQueue=null,n=gue(e,r,n,i),mue(t),r=dV(),t!==null&&!Ii?(hV(t,e,s),Jh(t,e,s)):(Nn&&r&&nV(e),e.flags|=1,xs(t,e,n,s),e.child)}function QY(t,e,n,r,i){if(I1(e),e.stateNode===null){var s=Lv,o=n.contextType;typeof o=="object"&&o!==null&&(s=Rs(o)),s=new n(r,s),e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=zP,e.stateNode=s,s._reactInternals=e,s=e.stateNode,s.props=r,s.state=e.memoizedState,s.refs={},aV(e),o=n.contextType,s.context=typeof o=="object"&&o!==null?Rs(o):Lv,s.state=e.memoizedState,o=n.getDerivedStateFromProps,typeof o=="function"&&(FM(e,n,o,r),s.state=e.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(o=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),o!==s.state&&zP.enqueueReplaceState(s,s.state,null),b_(e,r,s,i),v_(),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308),r=!0}else if(t===null){s=e.stateNode;var a=e.memoizedProps,l=N1(n,a);s.props=l;var c=s.context,u=n.contextType;o=Lv,typeof u=="object"&&u!==null&&(o=Rs(u));var d=n.getDerivedStateFromProps;u=typeof d=="function"||typeof s.getSnapshotBeforeUpdate=="function",a=e.pendingProps!==a,u||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a||c!==o)&&qY(e,s,r,o),hp=!1;var h=e.memoizedState;s.state=h,b_(e,r,s,i),v_(),c=e.memoizedState,a||h!==c||hp?(typeof d=="function"&&(FM(e,n,d,r),c=e.memoizedState),(l=hp||UY(e,n,l,r,h,c,o))?(u||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(e.flags|=4194308)):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=c),s.props=r,s.state=c,s.context=o,r=l):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{s=e.stateNode,RP(t,e),o=e.memoizedProps,u=N1(n,o),s.props=u,d=e.pendingProps,h=s.context,c=n.contextType,l=Lv,typeof c=="object"&&c!==null&&(l=Rs(c)),a=n.getDerivedStateFromProps,(c=typeof a=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(o!==d||h!==l)&&qY(e,s,r,l),hp=!1,h=e.memoizedState,s.state=h,b_(e,r,s,i),v_();var f=e.memoizedState;o!==d||h!==f||hp||t!==null&&t.dependencies!==null&&EA(t.dependencies)?(typeof a=="function"&&(FM(e,n,a,r),f=e.memoizedState),(u=hp||UY(e,n,u,r,h,f,l)||t!==null&&t.dependencies!==null&&EA(t.dependencies))?(c||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,f,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,f,l)),typeof s.componentDidUpdate=="function"&&(e.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof s.componentDidUpdate!="function"||o===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=f),s.props=r,s.state=f,s.context=l,r=u):(typeof s.componentDidUpdate!="function"||o===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),r=!1)}return s=r,NT(t,e),r=(e.flags&128)!==0,s||r?(s=e.stateNode,n=r&&typeof n.getDerivedStateFromError!="function"?null:s.render(),e.flags|=1,t!==null&&r?(e.child=R1(e,t.child,null,i),e.child=R1(e,null,n,i)):xs(t,e,n,i),e.memoizedState=s.state,t=e.child):t=Jh(t,e,i),t}function JY(t,e,n,r){return A1(),e.flags|=256,xs(t,e,n,r),e.child}var VM={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function $M(t){return{baseLanes:t,cachePool:lue()}}function HM(t,e,n){return t=t!==null?t.childLanes&~n:0,e&&(t|=Ha),t}function ede(t,e,n){var r=e.pendingProps,i=!1,s=(e.flags&128)!==0,o;if((o=s)||(o=t!==null&&t.memoizedState===null?!1:(yi.current&2)!==0),o&&(i=!0,e.flags&=-129),o=(e.flags&32)!==0,e.flags&=-33,t===null){if(Nn){if(i?wp(e):xp(),(t=Or)?(t=qde(t,Ol),t=t!==null&&t.data!=="&"?t:null,t!==null&&(e.memoizedState={dehydrated:t,treeContext:Im!==null?{id:qu,overflow:Wu}:null,retryLane:536870912,hydrationErrors:null},n=iue(t),n.return=e,e.child=n,Ts=e,Or=null)):t=null,t===null)throw Rm(e);return JP(t)?e.lanes=32:e.lanes=536870912,null}var a=r.children;return r=r.fallback,i?(xp(),i=e.mode,a=OA({mode:"hidden",children:a},i),r=i1(r,i,n,null),a.return=e,r.return=e,a.sibling=r,e.child=a,r=e.child,r.memoizedState=$M(n),r.childLanes=HM(t,o,n),e.memoizedState=VM,g4(null,r)):(wp(e),FP(e,a))}var l=t.memoizedState;if(l!==null&&(a=l.dehydrated,a!==null)){if(s)e.flags&256?(wp(e),e.flags&=-257,e=UM(t,e,n)):e.memoizedState!==null?(xp(),e.child=t.child,e.flags|=128,e=null):(xp(),a=r.fallback,i=e.mode,r=OA({mode:"visible",children:r.children},i),a=i1(a,i,n,null),a.flags|=2,r.return=e,a.return=e,r.sibling=a,e.child=r,R1(e,t.child,null,n),r=e.child,r.memoizedState=$M(n),r.childLanes=HM(t,o,n),e.memoizedState=VM,e=g4(null,r));else if(wp(e),JP(a)){if(o=a.nextSibling&&a.nextSibling.dataset,o)var c=o.dgst;o=c,r=Error(Ce(419)),r.stack="",r.digest=o,wS({value:r,source:null,stack:null}),e=UM(t,e,n)}else if(Ii||Nx(t,e,n,!1),o=(n&t.childLanes)!==0,Ii||o){if(o=br,o!==null&&(r=Rce(o,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,my(t,r),fa(o,t,r),_V;QP(a)||zA(),e=UM(t,e,n)}else QP(a)?(e.flags|=192,e.child=t.child,e=null):(t=l.treeContext,Or=ql(a.nextSibling),Ts=e,Nn=!0,am=null,Ol=!1,t!==null&&oue(e,t),e=FP(e,r.children),e.flags|=4096);return e}return i?(xp(),a=r.fallback,i=e.mode,l=t.child,c=l.sibling,r=Lh(l,{mode:"hidden",children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,c!==null?a=Lh(c,a):(a=i1(a,i,n,null),a.flags|=2),a.return=e,r.return=e,r.sibling=a,e.child=r,g4(null,r),r=e.child,a=t.child.memoizedState,a===null?a=$M(n):(i=a.cachePool,i!==null?(l=Ti._currentValue,i=i.parent!==l?{parent:l,pool:l}:i):i=lue(),a={baseLanes:a.baseLanes|n,cachePool:i}),r.memoizedState=a,r.childLanes=HM(t,o,n),e.memoizedState=VM,g4(t.child,r)):(wp(e),n=t.child,t=n.sibling,n=Lh(n,{mode:"visible",children:r.children}),n.return=e,n.sibling=null,t!==null&&(o=e.deletions,o===null?(e.deletions=[t],e.flags|=16):o.push(t)),e.child=n,e.memoizedState=null,n)}function FP(t,e){return e=OA({mode:"visible",children:e},t.mode),e.return=t,t.child=e}function OA(t,e){return t=Ba(22,t,null,e),t.lanes=0,t}function UM(t,e,n){return R1(e,t.child,null,n),t=FP(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function eZ(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),TP(t.return,e,n)}function qM(t,e,n,r,i,s){var o=t.memoizedState;o===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:s}:(o.isBackwards=e,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=s)}function tde(t,e,n){var r=e.pendingProps,i=r.revealOrder,s=r.tail;r=r.children;var o=yi.current,a=(o&2)!==0;if(a?(o=o&1|2,e.flags|=128):o&=1,Ir(yi,o),xs(t,e,r,n),r=Nn?bS:0,!a&&t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&eZ(t,n,e);else if(t.tag===19)eZ(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(i){case"forwards":for(n=e.child,i=null;n!==null;)t=n.alternate,t!==null&&IA(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),qM(e,!1,i,n,s,r);break;case"backwards":case"unstable_legacy-backwards":for(n=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&IA(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}qM(e,!0,n,null,s,r);break;case"together":qM(e,!1,null,null,void 0,r);break;default:e.memoizedState=null}return e.child}function Jh(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Nm|=e.lanes,!(n&e.childLanes))if(t!==null){if(Nx(t,e,n,!1),(n&e.childLanes)===0)return null}else return null;if(t!==null&&e.child!==t.child)throw Error(Ce(153));if(e.child!==null){for(t=e.child,n=Lh(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=Lh(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function SV(t,e){return t.lanes&e?!0:(t=t.dependencies,!!(t!==null&&EA(t)))}function UAe(t,e,n){switch(e.tag){case 3:bA(e,e.stateNode.containerInfo),bp(e,Ti,t.memoizedState.cache),A1();break;case 27:case 5:pP(e);break;case 4:bA(e,e.stateNode.containerInfo);break;case 10:bp(e,e.type,e.memoizedProps.value);break;case 31:if(e.memoizedState!==null)return e.flags|=128,OP(e),null;break;case 13:var r=e.memoizedState;if(r!==null)return r.dehydrated!==null?(wp(e),e.flags|=128,null):n&e.child.childLanes?ede(t,e,n):(wp(e),t=Jh(t,e,n),t!==null?t.sibling:null);wp(e);break;case 19:var i=(t.flags&128)!==0;if(r=(n&e.childLanes)!==0,r||(Nx(t,e,n,!1),r=(n&e.childLanes)!==0),i){if(r)return tde(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ir(yi,yi.current),r)break;return null;case 22:return e.lanes=0,Jue(t,e,n,e.pendingProps);case 24:bp(e,Ti,t.memoizedState.cache)}return Jh(t,e,n)}function nde(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps)Ii=!0;else{if(!SV(t,n)&&!(e.flags&128))return Ii=!1,UAe(t,e,n);Ii=!!(t.flags&131072)}else Ii=!1,Nn&&e.flags&1048576&&sue(e,bS,e.index);switch(e.lanes=0,e.tag){case 16:e:{var r=e.pendingProps;if(t=ag(e.elementType),e.type=t,typeof t=="function")tV(t)?(r=N1(t,r),e.tag=1,e=QY(null,e,t,r,n)):(e.tag=0,e=BP(null,e,t,r,n));else{if(t!=null){var i=t.$$typeof;if(i===VF){e.tag=11,e=GY(null,e,t,r,n);break e}else if(i===$F){e.tag=14,e=KY(null,e,t,r,n);break e}}throw e=hP(t)||t,Error(Ce(306,e,""))}}return e;case 0:return BP(t,e,e.type,e.pendingProps,n);case 1:return r=e.type,i=N1(r,e.pendingProps),QY(t,e,r,i,n);case 3:e:{if(bA(e,e.stateNode.containerInfo),t===null)throw Error(Ce(387));r=e.pendingProps;var s=e.memoizedState;i=s.element,RP(t,e),b_(e,r,null,n);var o=e.memoizedState;if(r=o.cache,bp(e,Ti,r),r!==s.cache&&AP(e,[Ti],n,!0),v_(),r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){e=JY(t,e,r,n);break e}else if(r!==i){i=Nl(Error(Ce(424)),e),wS(i),e=JY(t,e,r,n);break e}else{switch(t=e.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(Or=ql(t.firstChild),Ts=e,Nn=!0,am=null,Ol=!0,n=due(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(A1(),r===i){e=Jh(t,e,n);break e}xs(t,e,r,n)}e=e.child}return e;case 26:return NT(t,e),t===null?(n=wZ(e.type,null,e.pendingProps,null))?e.memoizedState=n:Nn||(n=e.type,t=e.pendingProps,r=VA(om.current).createElement(n),r[Es]=e,r[ga]=t,Ns(r,n,t),us(r),e.stateNode=r):e.memoizedState=wZ(e.type,t.memoizedProps,e.pendingProps,t.memoizedState),null;case 27:return pP(e),t===null&&Nn&&(r=e.stateNode=Wde(e.type,e.pendingProps,om.current),Ts=e,Ol=!0,i=Or,f0(e.type)?(eL=i,Or=ql(r.firstChild)):Or=i),xs(t,e,e.pendingProps.children,n),NT(t,e),t===null&&(e.flags|=4194304),e.child;case 5:return t===null&&Nn&&((i=r=Or)&&(r=w7e(r,e.type,e.pendingProps,Ol),r!==null?(e.stateNode=r,Ts=e,Or=ql(r.firstChild),Ol=!1,i=!0):i=!1),i||Rm(e)),pP(e),i=e.type,s=e.pendingProps,o=t!==null?t.memoizedProps:null,r=s.children,ZP(i,s)?r=null:o!==null&&ZP(i,o)&&(e.flags|=32),e.memoizedState!==null&&(i=uV(t,e,PAe,null,null,n),ES._currentValue=i),NT(t,e),xs(t,e,r,n),e.child;case 6:return t===null&&Nn&&((t=n=Or)&&(n=x7e(n,e.pendingProps,Ol),n!==null?(e.stateNode=n,Ts=e,Or=null,t=!0):t=!1),t||Rm(e)),null;case 13:return ede(t,e,n);case 4:return bA(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=R1(e,null,r,n):xs(t,e,r,n),e.child;case 11:return GY(t,e,e.type,e.pendingProps,n);case 7:return xs(t,e,e.pendingProps,n),e.child;case 8:return xs(t,e,e.pendingProps.children,n),e.child;case 12:return xs(t,e,e.pendingProps.children,n),e.child;case 10:return r=e.pendingProps,bp(e,e.type,r.value),xs(t,e,r.children,n),e.child;case 9:return i=e.type._context,r=e.pendingProps.children,I1(e),i=Rs(i),r=r(i),e.flags|=1,xs(t,e,r,n),e.child;case 14:return KY(t,e,e.type,e.pendingProps,n);case 15:return Que(t,e,e.type,e.pendingProps,n);case 19:return tde(t,e,n);case 31:return HAe(t,e,n);case 22:return Jue(t,e,n,e.pendingProps);case 24:return I1(e),r=Rs(Ti),t===null?(i=sV(),i===null&&(i=br,s=iV(),i.pooledCache=s,s.refCount++,s!==null&&(i.pooledCacheLanes|=n),i=s),e.memoizedState={parent:r,cache:i},aV(e),bp(e,Ti,i)):(t.lanes&n&&(RP(t,e),b_(e,null,null,n),v_()),i=t.memoizedState,s=e.memoizedState,i.parent!==r?(i={parent:r,cache:r},e.memoizedState=i,e.lanes===0&&(e.memoizedState=e.updateQueue.baseState=i),bp(e,Ti,r)):(r=s.cache,bp(e,Ti,r),r!==i.cache&&AP(e,[Ti],n,!0))),xs(t,e,e.pendingProps.children,n),e.child;case 29:throw e.pendingProps}throw Error(Ce(156,e.tag))}function $d(t){t.flags|=4}function WM(t,e,n,r,i){if((e=(t.mode&32)!==0)&&(e=!1),e){if(t.flags|=16777216,(i&335544128)===i)if(t.stateNode.complete)t.flags|=8192;else if(Ede())t.flags|=8192;else throw o1=TA,oV}else t.flags&=-16777217}function tZ(t,e){if(e.type!=="stylesheet"||e.state.loading&4)t.flags&=-16777217;else if(t.flags|=16777216,!Yde(e))if(Ede())t.flags|=8192;else throw o1=TA,oV}function FC(t,e){e!==null&&(t.flags|=4),t.flags&16384&&(e=t.tag!==22?Tce():536870912,t.lanes|=e,Ow|=e)}function V2(t,e){if(!Nn)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function Mr(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function qAe(t,e,n){var r=e.pendingProps;switch(rV(e),e.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mr(e),null;case 1:return Mr(e),null;case 3:return n=e.stateNode,r=null,t!==null&&(r=t.memoizedState.cache),e.memoizedState.cache!==r&&(e.flags|=2048),zh(Ti),Tw(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&($y(e)?$d(e):t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,zM())),Mr(e),null;case 26:var i=e.type,s=e.memoizedState;return t===null?($d(e),s!==null?(Mr(e),tZ(e,s)):(Mr(e),WM(e,i,null,r,n))):s?s!==t.memoizedState?($d(e),Mr(e),tZ(e,s)):(Mr(e),e.flags&=-16777217):(t=t.memoizedProps,t!==r&&$d(e),Mr(e),WM(e,i,t,r,n)),null;case 27:if(wA(e),n=om.current,i=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==r&&$d(e);else{if(!r){if(e.stateNode===null)throw Error(Ce(166));return Mr(e),null}t=nd.current,$y(e)?RY(e):(t=Wde(i,r,n),e.stateNode=t,$d(e))}return Mr(e),null;case 5:if(wA(e),i=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==r&&$d(e);else{if(!r){if(e.stateNode===null)throw Error(Ce(166));return Mr(e),null}if(s=nd.current,$y(e))RY(e);else{var o=VA(om.current);switch(s){case 1:s=o.createElementNS("http://www.w3.org/2000/svg",i);break;case 2:s=o.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;default:switch(i){case"svg":s=o.createElementNS("http://www.w3.org/2000/svg",i);break;case"math":s=o.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;case"script":s=o.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof r.is=="string"?o.createElement("select",{is:r.is}):o.createElement("select"),r.multiple?s.multiple=!0:r.size&&(s.size=r.size);break;default:s=typeof r.is=="string"?o.createElement(i,{is:r.is}):o.createElement(i)}}s[Es]=e,s[ga]=r;e:for(o=e.child;o!==null;){if(o.tag===5||o.tag===6)s.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===e)break e;for(;o.sibling===null;){if(o.return===null||o.return===e)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}e.stateNode=s;e:switch(Ns(s,i,r),i){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&$d(e)}}return Mr(e),WM(e,e.type,t===null?null:t.memoizedProps,e.pendingProps,n),null;case 6:if(t&&e.stateNode!=null)t.memoizedProps!==r&&$d(e);else{if(typeof r!="string"&&e.stateNode===null)throw Error(Ce(166));if(t=om.current,$y(e)){if(t=e.stateNode,n=e.memoizedProps,r=null,i=Ts,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}t[Es]=e,t=!!(t.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||$de(t.nodeValue,n)),t||Rm(e,!0)}else t=VA(t).createTextNode(r),t[Es]=e,e.stateNode=t}return Mr(e),null;case 31:if(n=e.memoizedState,t===null||t.memoizedState!==null){if(r=$y(e),n!==null){if(t===null){if(!r)throw Error(Ce(318));if(t=e.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(Ce(557));t[Es]=e}else A1(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Mr(e),t=!1}else n=zM(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=n),t=!0;if(!t)return e.flags&256?(za(e),e):(za(e),null);if(e.flags&128)throw Error(Ce(558))}return Mr(e),null;case 13:if(r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(i=$y(e),r!==null&&r.dehydrated!==null){if(t===null){if(!i)throw Error(Ce(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Ce(317));i[Es]=e}else A1(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Mr(e),i=!1}else i=zM(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=i),i=!0;if(!i)return e.flags&256?(za(e),e):(za(e),null)}return za(e),e.flags&128?(e.lanes=n,e):(n=r!==null,t=t!==null&&t.memoizedState!==null,n&&(r=e.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),s=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(s=r.memoizedState.cachePool.pool),s!==i&&(r.flags|=2048)),n!==t&&n&&(e.child.flags|=8192),FC(e,e.updateQueue),Mr(e),null);case 4:return Tw(),t===null&&RV(e.stateNode.containerInfo),Mr(e),null;case 10:return zh(e.type),Mr(e),null;case 19:if(ps(yi),r=e.memoizedState,r===null)return Mr(e),null;if(i=(e.flags&128)!==0,s=r.rendering,s===null)if(i)V2(r,!1);else{if(ui!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(s=IA(t),s!==null){for(e.flags|=128,V2(r,!1),t=s.updateQueue,e.updateQueue=t,FC(e,t),e.subtreeFlags=0,t=n,n=e.child;n!==null;)rue(n,t),n=n.sibling;return Ir(yi,yi.current&1|2),Nn&&ah(e,r.treeForkCount),e.child}t=t.sibling}r.tail!==null&&Ga()>PA&&(e.flags|=128,i=!0,V2(r,!1),e.lanes=4194304)}else{if(!i)if(t=IA(s),t!==null){if(e.flags|=128,i=!0,t=t.updateQueue,e.updateQueue=t,FC(e,t),V2(r,!0),r.tail===null&&r.tailMode==="hidden"&&!s.alternate&&!Nn)return Mr(e),null}else 2*Ga()-r.renderingStartTime>PA&&n!==536870912&&(e.flags|=128,i=!0,V2(r,!1),e.lanes=4194304);r.isBackwards?(s.sibling=e.child,e.child=s):(t=r.last,t!==null?t.sibling=s:e.child=s,r.last=s)}return r.tail!==null?(t=r.tail,r.rendering=t,r.tail=t.sibling,r.renderingStartTime=Ga(),t.sibling=null,n=yi.current,Ir(yi,i?n&1|2:n&1),Nn&&ah(e,r.treeForkCount),t):(Mr(e),null);case 22:case 23:return za(e),lV(),r=e.memoizedState!==null,t!==null?t.memoizedState!==null!==r&&(e.flags|=8192):r&&(e.flags|=8192),r?n&536870912&&!(e.flags&128)&&(Mr(e),e.subtreeFlags&6&&(e.flags|=8192)):Mr(e),n=e.updateQueue,n!==null&&FC(e,n.retryQueue),n=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),r=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),r!==n&&(e.flags|=2048),t!==null&&ps(s1),null;case 24:return n=null,t!==null&&(n=t.memoizedState.cache),e.memoizedState.cache!==n&&(e.flags|=2048),zh(Ti),Mr(e),null;case 25:return null;case 30:return null}throw Error(Ce(156,e.tag))}function WAe(t,e){switch(rV(e),e.tag){case 1:return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return zh(Ti),Tw(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 26:case 27:case 5:return wA(e),null;case 31:if(e.memoizedState!==null){if(za(e),e.alternate===null)throw Error(Ce(340));A1()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 13:if(za(e),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Ce(340));A1()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return ps(yi),null;case 4:return Tw(),null;case 10:return zh(e.type),null;case 22:case 23:return za(e),lV(),t!==null&&ps(s1),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 24:return zh(Ti),null;case 25:return null;default:return null}}function rde(t,e){switch(rV(e),e.tag){case 3:zh(Ti),Tw();break;case 26:case 27:case 5:wA(e);break;case 4:Tw();break;case 31:e.memoizedState!==null&&za(e);break;case 13:za(e);break;case 19:ps(yi);break;case 10:zh(e.type);break;case 22:case 23:za(e),lV(),t!==null&&ps(s1);break;case 24:zh(Ti)}}function W5(t,e){try{var n=e.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var i=r.next;n=i;do{if((n.tag&t)===t){r=void 0;var s=n.create,o=n.inst;r=s(),o.destroy=r}n=n.next}while(n!==i)}}catch(a){rr(e,e.return,a)}}function Mm(t,e,n){try{var r=e.updateQueue,i=r!==null?r.lastEffect:null;if(i!==null){var s=i.next;r=s;do{if((r.tag&t)===t){var o=r.inst,a=o.destroy;if(a!==void 0){o.destroy=void 0,i=e;var l=n,c=a;try{c()}catch(u){rr(i,l,u)}}}r=r.next}while(r!==s)}}catch(u){rr(e,e.return,u)}}function ide(t){var e=t.updateQueue;if(e!==null){var n=t.stateNode;try{fue(e,n)}catch(r){rr(t,t.return,r)}}}function sde(t,e,n){n.props=N1(t.type,t.memoizedProps),n.state=t.memoizedState;try{n.componentWillUnmount()}catch(r){rr(t,e,r)}}function x_(t,e){try{var n=t.ref;if(n!==null){switch(t.tag){case 26:case 27:case 5:var r=t.stateNode;break;case 30:r=t.stateNode;break;default:r=t.stateNode}typeof n=="function"?t.refCleanup=n(r):n.current=r}}catch(i){rr(t,e,i)}}function Gu(t,e){var n=t.ref,r=t.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(i){rr(t,e,i)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(i){rr(t,e,i)}else n.current=null}function ode(t){var e=t.type,n=t.memoizedProps,r=t.stateNode;try{e:switch(e){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(i){rr(t,t.return,i)}}function GM(t,e,n){try{var r=t.stateNode;p7e(r,t.type,n,e),r[ga]=e}catch(i){rr(t,t.return,i)}}function ade(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&f0(t.type)||t.tag===4}function KM(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||ade(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&f0(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function VP(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(t,e):(e=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,e.appendChild(t),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Eh));else if(r!==4&&(r===27&&f0(t.type)&&(n=t.stateNode,e=null),t=t.child,t!==null))for(VP(t,e,n),t=t.sibling;t!==null;)VP(t,e,n),t=t.sibling}function DA(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(r===27&&f0(t.type)&&(n=t.stateNode),t=t.child,t!==null))for(DA(t,e,n),t=t.sibling;t!==null;)DA(t,e,n),t=t.sibling}function lde(t){var e=t.stateNode,n=t.memoizedProps;try{for(var r=t.type,i=e.attributes;i.length;)e.removeAttributeNode(i[0]);Ns(e,r,n),e[Es]=t,e[ga]=n}catch(s){rr(t,t.return,s)}}var _h=!1,Ei=!1,YM=!1,nZ=typeof WeakSet=="function"?WeakSet:Set,cs=null;function GAe(t,e){if(t=t.containerInfo,KP=qA,t=Yce(t),QF(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,c=0,u=0,d=t,h=null;t:for(;;){for(var f;d!==n||i!==0&&d.nodeType!==3||(a=o+i),d!==s||r!==0&&d.nodeType!==3||(l=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(f=d.firstChild)!==null;)h=d,d=f;for(;;){if(d===t)break t;if(h===n&&++c===i&&(a=o),h===s&&++u===r&&(l=o),(f=d.nextSibling)!==null)break;d=h,h=d.parentNode}d=f}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(YP={focusedElem:t,selectionRange:n},qA=!1,cs=e;cs!==null;)if(e=cs,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,cs=t;else for(;cs!==null;){switch(e=cs,s=e.alternate,t=e.flags,e.tag){case 0:if(t&4&&(t=e.updateQueue,t=t!==null?t.events:null,t!==null))for(n=0;n<t.length;n++)i=t[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if(t&1024&&s!==null){t=void 0,n=e,i=s.memoizedProps,s=s.memoizedState,r=n.stateNode;try{var p=N1(n.type,i);t=r.getSnapshotBeforeUpdate(p,s),r.__reactInternalSnapshotBeforeUpdate=t}catch(g){rr(n,n.return,g)}}break;case 3:if(t&1024){if(t=e.stateNode.containerInfo,n=t.nodeType,n===9)XP(t);else if(n===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":XP(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(t&1024)throw Error(Ce(163))}if(t=e.sibling,t!==null){t.return=e.return,cs=t;break}cs=e.return}}function cde(t,e,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Ud(t,n),r&4&&W5(5,n);break;case 1:if(Ud(t,n),r&4)if(t=n.stateNode,e===null)try{t.componentDidMount()}catch(o){rr(n,n.return,o)}else{var i=N1(n.type,e.memoizedProps);e=e.memoizedState;try{t.componentDidUpdate(i,e,t.__reactInternalSnapshotBeforeUpdate)}catch(o){rr(n,n.return,o)}}r&64&&ide(n),r&512&&x_(n,n.return);break;case 3:if(Ud(t,n),r&64&&(t=n.updateQueue,t!==null)){if(e=null,n.child!==null)switch(n.child.tag){case 27:case 5:e=n.child.stateNode;break;case 1:e=n.child.stateNode}try{fue(t,e)}catch(o){rr(n,n.return,o)}}break;case 27:e===null&&r&4&&lde(n);case 26:case 5:Ud(t,n),e===null&&r&4&&ode(n),r&512&&x_(n,n.return);break;case 12:Ud(t,n);break;case 31:Ud(t,n),r&4&&hde(t,n);break;case 13:Ud(t,n),r&4&&fde(t,n),r&64&&(t=n.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(n=n7e.bind(null,n),_7e(t,n))));break;case 22:if(r=n.memoizedState!==null||_h,!r){e=e!==null&&e.memoizedState!==null||Ei,i=_h;var s=Ei;_h=r,(Ei=e)&&!s?Jd(t,n,(n.subtreeFlags&8772)!==0):Ud(t,n),_h=i,Ei=s}break;case 30:break;default:Ud(t,n)}}function ude(t){var e=t.alternate;e!==null&&(t.alternate=null,ude(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&WF(e)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Br=null,ta=!1;function Hd(t,e,n){for(n=n.child;n!==null;)dde(t,e,n),n=n.sibling}function dde(t,e,n){if(Ka&&typeof Ka.onCommitFiberUnmount=="function")try{Ka.onCommitFiberUnmount(B5,n)}catch{}switch(n.tag){case 26:Ei||Gu(n,e),Hd(t,e,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Ei||Gu(n,e);var r=Br,i=ta;f0(n.type)&&(Br=n.stateNode,ta=!1),Hd(t,e,n),C_(n.stateNode),Br=r,ta=i;break;case 5:Ei||Gu(n,e);case 6:if(r=Br,i=ta,Br=null,Hd(t,e,n),Br=r,ta=i,Br!==null)if(ta)try{(Br.nodeType===9?Br.body:Br.nodeName==="HTML"?Br.ownerDocument.body:Br).removeChild(n.stateNode)}catch(s){rr(n,e,s)}else try{Br.removeChild(n.stateNode)}catch(s){rr(n,e,s)}break;case 18:Br!==null&&(ta?(t=Br,mZ(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,n.stateNode),zw(t)):mZ(Br,n.stateNode));break;case 4:r=Br,i=ta,Br=n.stateNode.containerInfo,ta=!0,Hd(t,e,n),Br=r,ta=i;break;case 0:case 11:case 14:case 15:Mm(2,n,e),Ei||Mm(4,n,e),Hd(t,e,n);break;case 1:Ei||(Gu(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"&&sde(n,e,r)),Hd(t,e,n);break;case 21:Hd(t,e,n);break;case 22:Ei=(r=Ei)||n.memoizedState!==null,Hd(t,e,n),Ei=r;break;default:Hd(t,e,n)}}function hde(t,e){if(e.memoizedState===null&&(t=e.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{zw(t)}catch(n){rr(e,e.return,n)}}}function fde(t,e){if(e.memoizedState===null&&(t=e.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{zw(t)}catch(n){rr(e,e.return,n)}}function KAe(t){switch(t.tag){case 31:case 13:case 19:var e=t.stateNode;return e===null&&(e=t.stateNode=new nZ),e;case 22:return t=t.stateNode,e=t._retryCache,e===null&&(e=t._retryCache=new nZ),e;default:throw Error(Ce(435,t.tag))}}function VC(t,e){var n=KAe(t);e.forEach(function(r){if(!n.has(r)){n.add(r);var i=r7e.bind(null,t,r);r.then(i,i)}})}function qo(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r],s=t,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 27:if(f0(a.type)){Br=a.stateNode,ta=!1;break e}break;case 5:Br=a.stateNode,ta=!1;break e;case 3:case 4:Br=a.stateNode.containerInfo,ta=!0;break e}a=a.return}if(Br===null)throw Error(Ce(160));dde(s,o,i),Br=null,ta=!1,s=i.alternate,s!==null&&(s.return=null),i.return=null}if(e.subtreeFlags&13886)for(e=e.child;e!==null;)pde(e,t),e=e.sibling}var Ac=null;function pde(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:qo(e,t),Wo(t),r&4&&(Mm(3,t,t.return),W5(3,t),Mm(5,t,t.return));break;case 1:qo(e,t),Wo(t),r&512&&(Ei||n===null||Gu(n,n.return)),r&64&&_h&&(t=t.updateQueue,t!==null&&(r=t.callbacks,r!==null&&(n=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var i=Ac;if(qo(e,t),Wo(t),r&512&&(Ei||n===null||Gu(n,n.return)),r&4){var s=n!==null?n.memoizedState:null;if(r=t.memoizedState,n===null)if(r===null)if(t.stateNode===null){e:{r=t.type,n=t.memoizedProps,i=i.ownerDocument||i;t:switch(r){case"title":s=i.getElementsByTagName("title")[0],(!s||s[$5]||s[Es]||s.namespaceURI==="http://www.w3.org/2000/svg"||s.hasAttribute("itemprop"))&&(s=i.createElement(r),i.head.insertBefore(s,i.querySelector("head > title"))),Ns(s,r,n),s[Es]=t,us(s),r=s;break e;case"link":var o=_Z("link","href",i).get(r+(n.href||""));if(o){for(var a=0;a<o.length;a++)if(s=o[a],s.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&s.getAttribute("rel")===(n.rel==null?null:n.rel)&&s.getAttribute("title")===(n.title==null?null:n.title)&&s.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(a,1);break t}}s=i.createElement(r),Ns(s,r,n),i.head.appendChild(s);break;case"meta":if(o=_Z("meta","content",i).get(r+(n.content||""))){for(a=0;a<o.length;a++)if(s=o[a],s.getAttribute("content")===(n.content==null?null:""+n.content)&&s.getAttribute("name")===(n.name==null?null:n.name)&&s.getAttribute("property")===(n.property==null?null:n.property)&&s.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&s.getAttribute("charset")===(n.charSet==null?null:n.charSet)){o.splice(a,1);break t}}s=i.createElement(r),Ns(s,r,n),i.head.appendChild(s);break;default:throw Error(Ce(468,r))}s[Es]=t,us(s),r=s}t.stateNode=r}else SZ(i,t.type,t.stateNode);else t.stateNode=xZ(i,r,t.memoizedProps);else s!==r?(s===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):s.count--,r===null?SZ(i,t.type,t.stateNode):xZ(i,r,t.memoizedProps)):r===null&&t.stateNode!==null&&GM(t,t.memoizedProps,n.memoizedProps)}break;case 27:qo(e,t),Wo(t),r&512&&(Ei||n===null||Gu(n,n.return)),n!==null&&r&4&&GM(t,t.memoizedProps,n.memoizedProps);break;case 5:if(qo(e,t),Wo(t),r&512&&(Ei||n===null||Gu(n,n.return)),t.flags&32){i=t.stateNode;try{Iw(i,"")}catch(p){rr(t,t.return,p)}}r&4&&t.stateNode!=null&&(i=t.memoizedProps,GM(t,i,n!==null?n.memoizedProps:i)),r&1024&&(YM=!0);break;case 6:if(qo(e,t),Wo(t),r&4){if(t.stateNode===null)throw Error(Ce(162));r=t.memoizedProps,n=t.stateNode;try{n.nodeValue=r}catch(p){rr(t,t.return,p)}}break;case 3:if(PT=null,i=Ac,Ac=$A(e.containerInfo),qo(e,t),Ac=i,Wo(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{zw(e.containerInfo)}catch(p){rr(t,t.return,p)}YM&&(YM=!1,mde(t));break;case 4:r=Ac,Ac=$A(t.stateNode.containerInfo),qo(e,t),Wo(t),Ac=r;break;case 12:qo(e,t),Wo(t);break;case 31:qo(e,t),Wo(t),r&4&&(r=t.updateQueue,r!==null&&(t.updateQueue=null,VC(t,r)));break;case 13:qo(e,t),Wo(t),t.child.flags&8192&&t.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(f9=Ga()),r&4&&(r=t.updateQueue,r!==null&&(t.updateQueue=null,VC(t,r)));break;case 22:i=t.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,c=_h,u=Ei;if(_h=c||i,Ei=u||l,qo(e,t),Ei=u,_h=c,Wo(t),r&8192)e:for(e=t.stateNode,e._visibility=i?e._visibility&-2:e._visibility|1,i&&(n===null||l||_h||Ei||lg(t)),n=null,e=t;;){if(e.tag===5||e.tag===26){if(n===null){l=n=e;try{if(s=l.stateNode,i)o=s.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{a=l.stateNode;var d=l.memoizedProps.style,h=d!=null&&d.hasOwnProperty("display")?d.display:null;a.style.display=h==null||typeof h=="boolean"?"":(""+h).trim()}}catch(p){rr(l,l.return,p)}}}else if(e.tag===6){if(n===null){l=e;try{l.stateNode.nodeValue=i?"":l.memoizedProps}catch(p){rr(l,l.return,p)}}}else if(e.tag===18){if(n===null){l=e;try{var f=l.stateNode;i?gZ(f,!0):gZ(l.stateNode,!1)}catch(p){rr(l,l.return,p)}}}else if((e.tag!==22&&e.tag!==23||e.memoizedState===null||e===t)&&e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;n===e&&(n=null),e=e.return}n===e&&(n=null),e.sibling.return=e.return,e=e.sibling}r&4&&(r=t.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,VC(t,n))));break;case 19:qo(e,t),Wo(t),r&4&&(r=t.updateQueue,r!==null&&(t.updateQueue=null,VC(t,r)));break;case 30:break;case 21:break;default:qo(e,t),Wo(t)}}function Wo(t){var e=t.flags;if(e&2){try{for(var n,r=t.return;r!==null;){if(ade(r)){n=r;break}r=r.return}if(n==null)throw Error(Ce(160));switch(n.tag){case 27:var i=n.stateNode,s=KM(t);DA(t,s,i);break;case 5:var o=n.stateNode;n.flags&32&&(Iw(o,""),n.flags&=-33);var a=KM(t);DA(t,a,o);break;case 3:case 4:var l=n.stateNode.containerInfo,c=KM(t);VP(t,c,l);break;default:throw Error(Ce(161))}}catch(u){rr(t,t.return,u)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function mde(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var e=t;mde(e),e.tag===5&&e.flags&1024&&e.stateNode.reset(),t=t.sibling}}function Ud(t,e){if(e.subtreeFlags&8772)for(e=e.child;e!==null;)cde(t,e.alternate,e),e=e.sibling}function lg(t){for(t=t.child;t!==null;){var e=t;switch(e.tag){case 0:case 11:case 14:case 15:Mm(4,e,e.return),lg(e);break;case 1:Gu(e,e.return);var n=e.stateNode;typeof n.componentWillUnmount=="function"&&sde(e,e.return,n),lg(e);break;case 27:C_(e.stateNode);case 26:case 5:Gu(e,e.return),lg(e);break;case 22:e.memoizedState===null&&lg(e);break;case 30:lg(e);break;default:lg(e)}t=t.sibling}}function Jd(t,e,n){for(n=n&&(e.subtreeFlags&8772)!==0,e=e.child;e!==null;){var r=e.alternate,i=t,s=e,o=s.flags;switch(s.tag){case 0:case 11:case 15:Jd(i,s,n),W5(4,s);break;case 1:if(Jd(i,s,n),r=s,i=r.stateNode,typeof i.componentDidMount=="function")try{i.componentDidMount()}catch(c){rr(r,r.return,c)}if(r=s,i=r.updateQueue,i!==null){var a=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)hue(l[i],a)}catch(c){rr(r,r.return,c)}}n&&o&64&&ide(s),x_(s,s.return);break;case 27:lde(s);case 26:case 5:Jd(i,s,n),n&&r===null&&o&4&&ode(s),x_(s,s.return);break;case 12:Jd(i,s,n);break;case 31:Jd(i,s,n),n&&o&4&&hde(i,s);break;case 13:Jd(i,s,n),n&&o&4&&fde(i,s);break;case 22:s.memoizedState===null&&Jd(i,s,n),x_(s,s.return);break;case 30:break;default:Jd(i,s,n)}e=e.sibling}}function kV(t,e){var n=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),t=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(t=e.memoizedState.cachePool.pool),t!==n&&(t!=null&&t.refCount++,n!=null&&U5(n))}function CV(t,e){t=null,e.alternate!==null&&(t=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==t&&(e.refCount++,t!=null&&U5(t))}function gc(t,e,n,r){if(e.subtreeFlags&10256)for(e=e.child;e!==null;)gde(t,e,n,r),e=e.sibling}function gde(t,e,n,r){var i=e.flags;switch(e.tag){case 0:case 11:case 15:gc(t,e,n,r),i&2048&&W5(9,e);break;case 1:gc(t,e,n,r);break;case 3:gc(t,e,n,r),i&2048&&(t=null,e.alternate!==null&&(t=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==t&&(e.refCount++,t!=null&&U5(t)));break;case 12:if(i&2048){gc(t,e,n,r),t=e.stateNode;try{var s=e.memoizedProps,o=s.id,a=s.onPostCommit;typeof a=="function"&&a(o,e.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(l){rr(e,e.return,l)}}else gc(t,e,n,r);break;case 31:gc(t,e,n,r);break;case 13:gc(t,e,n,r);break;case 23:break;case 22:s=e.stateNode,o=e.alternate,e.memoizedState!==null?s._visibility&2?gc(t,e,n,r):__(t,e):s._visibility&2?gc(t,e,n,r):(s._visibility|=2,ov(t,e,n,r,(e.subtreeFlags&10256)!==0||!1)),i&2048&&kV(o,e);break;case 24:gc(t,e,n,r),i&2048&&CV(e.alternate,e);break;default:gc(t,e,n,r)}}function ov(t,e,n,r,i){for(i=i&&((e.subtreeFlags&10256)!==0||!1),e=e.child;e!==null;){var s=t,o=e,a=n,l=r,c=o.flags;switch(o.tag){case 0:case 11:case 15:ov(s,o,a,l,i),W5(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState!==null?u._visibility&2?ov(s,o,a,l,i):__(s,o):(u._visibility|=2,ov(s,o,a,l,i)),i&&c&2048&&kV(o.alternate,o);break;case 24:ov(s,o,a,l,i),i&&c&2048&&CV(o.alternate,o);break;default:ov(s,o,a,l,i)}e=e.sibling}}function __(t,e){if(e.subtreeFlags&10256)for(e=e.child;e!==null;){var n=t,r=e,i=r.flags;switch(r.tag){case 22:__(n,r),i&2048&&kV(r.alternate,r);break;case 24:__(n,r),i&2048&&CV(r.alternate,r);break;default:__(n,r)}e=e.sibling}}var y4=8192;function Hy(t,e,n){if(t.subtreeFlags&y4)for(t=t.child;t!==null;)yde(t,e,n),t=t.sibling}function yde(t,e,n){switch(t.tag){case 26:Hy(t,e,n),t.flags&y4&&t.memoizedState!==null&&D7e(n,Ac,t.memoizedState,t.memoizedProps);break;case 5:Hy(t,e,n);break;case 3:case 4:var r=Ac;Ac=$A(t.stateNode.containerInfo),Hy(t,e,n),Ac=r;break;case 22:t.memoizedState===null&&(r=t.alternate,r!==null&&r.memoizedState!==null?(r=y4,y4=16777216,Hy(t,e,n),y4=r):Hy(t,e,n));break;default:Hy(t,e,n)}}function vde(t){var e=t.alternate;if(e!==null&&(t=e.child,t!==null)){e.child=null;do e=t.sibling,t.sibling=null,t=e;while(t!==null)}}function $2(t){var e=t.deletions;if(t.flags&16){if(e!==null)for(var n=0;n<e.length;n++){var r=e[n];cs=r,wde(r,t)}vde(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)bde(t),t=t.sibling}function bde(t){switch(t.tag){case 0:case 11:case 15:$2(t),t.flags&2048&&Mm(9,t,t.return);break;case 3:$2(t);break;case 12:$2(t);break;case 22:var e=t.stateNode;t.memoizedState!==null&&e._visibility&2&&(t.return===null||t.return.tag!==13)?(e._visibility&=-3,OT(t)):$2(t);break;default:$2(t)}}function OT(t){var e=t.deletions;if(t.flags&16){if(e!==null)for(var n=0;n<e.length;n++){var r=e[n];cs=r,wde(r,t)}vde(t)}for(t=t.child;t!==null;){switch(e=t,e.tag){case 0:case 11:case 15:Mm(8,e,e.return),OT(e);break;case 22:n=e.stateNode,n._visibility&2&&(n._visibility&=-3,OT(e));break;default:OT(e)}t=t.sibling}}function wde(t,e){for(;cs!==null;){var n=cs;switch(n.tag){case 0:case 11:case 15:Mm(8,n,e);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:U5(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,cs=r;else e:for(n=t;cs!==null;){r=cs;var i=r.sibling,s=r.return;if(ude(r),r===n){cs=null;break e}if(i!==null){i.return=s,cs=i;break e}cs=s}}}var YAe={getCacheForType:function(t){var e=Rs(Ti),n=e.data.get(t);return n===void 0&&(n=t(),e.data.set(t,n)),n},cacheSignal:function(){return Rs(Ti).controller.signal}},ZAe=typeof WeakMap=="function"?WeakMap:Map,Un=0,br=null,vn=null,An=0,nr=0,Pa=null,Zp=!1,Dx=!1,EV=!1,ef=0,ui=0,Nm=0,a1=0,TV=0,Ha=0,Ow=0,S_=null,na=null,$P=!1,f9=0,xde=0,PA=1/0,LA=null,um=null,Ki=0,dm=null,Dw=null,jh=0,HP=0,UP=null,_de=null,k_=0,qP=null;function Za(){return Un&2&&An!==0?An&-An:Bt.T!==null?IV():Mce()}function Sde(){if(Ha===0)if(!(An&536870912)||Nn){var t=OC;OC<<=1,!(OC&3932160)&&(OC=262144),Ha=t}else Ha=536870912;return t=il.current,t!==null&&(t.flags|=32),Ha}function fa(t,e,n){(t===br&&(nr===2||nr===9)||t.cancelPendingCommit!==null)&&(Pw(t,0),Xp(t,An,Ha,!1)),V5(t,n),(!(Un&2)||t!==br)&&(t===br&&(!(Un&2)&&(a1|=n),ui===4&&Xp(t,An,Ha,!1)),Cd(t))}function kde(t,e,n){if(Un&6)throw Error(Ce(327));var r=!n&&(e&127)===0&&(e&t.expiredLanes)===0||F5(t,e),i=r?JAe(t,e):ZM(t,e,!0),s=r;do{if(i===0){Dx&&!r&&Xp(t,e,0,!1);break}else{if(n=t.current.alternate,s&&!XAe(n)){i=ZM(t,e,!1),s=!1;continue}if(i===2){if(s=e,t.errorRecoveryDisabledLanes&s)var o=0;else o=t.pendingLanes&-536870913,o=o!==0?o:o&536870912?536870912:0;if(o!==0){e=o;e:{var a=t;i=S_;var l=a.current.memoizedState.isDehydrated;if(l&&(Pw(a,o).flags|=256),o=ZM(a,o,!1),o!==2){if(EV&&!l){a.errorRecoveryDisabledLanes|=s,a1|=s,i=4;break e}s=na,na=i,s!==null&&(na===null?na=s:na.push.apply(na,s))}i=o}if(s=!1,i!==2)continue}}if(i===1){Pw(t,0),Xp(t,e,0,!0);break}e:{switch(r=t,s=i,s){case 0:case 1:throw Error(Ce(345));case 4:if((e&4194048)!==e)break;case 6:Xp(r,e,Ha,!Zp);break e;case 2:na=null;break;case 3:case 5:break;default:throw Error(Ce(329))}if((e&62914560)===e&&(i=f9+300-Ga(),10<i)){if(Xp(r,e,Ha,!Zp),n9(r,0,!0)!==0)break e;jh=e,r.timeoutHandle=Ude(rZ.bind(null,r,n,na,LA,$P,e,Ha,a1,Ow,Zp,s,"Throttled",-0,0),i);break e}rZ(r,n,na,LA,$P,e,Ha,a1,Ow,Zp,s,null,-0,0)}}break}while(!0);Cd(t)}function rZ(t,e,n,r,i,s,o,a,l,c,u,d,h,f){if(t.timeoutHandle=-1,d=e.subtreeFlags,d&8192||(d&16785408)===16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Eh},yde(e,s,d);var p=(s&62914560)===s?f9-Ga():(s&4194048)===s?xde-Ga():0;if(p=P7e(d,p),p!==null){jh=s,t.cancelPendingCommit=p(sZ.bind(null,t,e,s,n,r,i,o,a,l,u,d,null,h,f)),Xp(t,s,o,!c);return}}sZ(t,e,s,n,r,i,o,a,l)}function XAe(t){for(var e=t;;){var n=e.tag;if((n===0||n===11||n===15)&&e.flags&16384&&(n=e.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],s=i.getSnapshot;i=i.value;try{if(!rl(s(),i))return!1}catch{return!1}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Xp(t,e,n,r){e&=~TV,e&=~a1,t.suspendedLanes|=e,t.pingedLanes&=~e,r&&(t.warmLanes|=e),r=t.expirationTimes;for(var i=e;0<i;){var s=31-Ya(i),o=1<<s;r[s]=-1,i&=~o}n!==0&&Ace(t,n,e)}function p9(){return Un&6?!0:(G5(0),!1)}function AV(){if(vn!==null){if(nr===0)var t=vn.return;else t=vn,Th=gy=null,fV(t),Zv=null,xS=0,t=vn;for(;t!==null;)rde(t.alternate,t),t=t.return;vn=null}}function Pw(t,e){var n=t.timeoutHandle;n!==-1&&(t.timeoutHandle=-1,y7e(n)),n=t.cancelPendingCommit,n!==null&&(t.cancelPendingCommit=null,n()),jh=0,AV(),br=t,vn=n=Lh(t.current,null),An=e,nr=0,Pa=null,Zp=!1,Dx=F5(t,e),EV=!1,Ow=Ha=TV=a1=Nm=ui=0,na=S_=null,$P=!1,e&8&&(e|=e&32);var r=t.entangledLanes;if(r!==0)for(t=t.entanglements,r&=e;0<r;){var i=31-Ya(r),s=1<<i;e|=t[i],r&=~s}return ef=e,o9(),n}function Cde(t,e){Xt=null,Bt.H=SS,e===Ox||e===l9?(e=PY(),nr=3):e===oV?(e=PY(),nr=4):nr=e===_V?8:e!==null&&typeof e=="object"&&typeof e.then=="function"?6:1,Pa=e,vn===null&&(ui=1,NA(t,Nl(e,t.current)))}function Ede(){var t=il.current;return t===null?!0:(An&4194048)===An?Ul===null:(An&62914560)===An||An&536870912?t===Ul:!1}function Tde(){var t=Bt.H;return Bt.H=SS,t===null?SS:t}function Ade(){var t=Bt.A;return Bt.A=YAe,t}function zA(){ui=4,Zp||(An&4194048)!==An&&il.current!==null||(Dx=!0),!(Nm&134217727)&&!(a1&134217727)||br===null||Xp(br,An,Ha,!1)}function ZM(t,e,n){var r=Un;Un|=2;var i=Tde(),s=Ade();(br!==t||An!==e)&&(LA=null,Pw(t,e)),e=!1;var o=ui;e:do try{if(nr!==0&&vn!==null){var a=vn,l=Pa;switch(nr){case 8:AV(),o=6;break e;case 3:case 2:case 9:case 6:il.current===null&&(e=!0);var c=nr;if(nr=0,Pa=null,Bv(t,a,l,c),n&&Dx){o=0;break e}break;default:c=nr,nr=0,Pa=null,Bv(t,a,l,c)}}QAe(),o=ui;break}catch(u){Cde(t,u)}while(!0);return e&&t.shellSuspendCounter++,Th=gy=null,Un=r,Bt.H=i,Bt.A=s,vn===null&&(br=null,An=0,o9()),o}function QAe(){for(;vn!==null;)Ide(vn)}function JAe(t,e){var n=Un;Un|=2;var r=Tde(),i=Ade();br!==t||An!==e?(LA=null,PA=Ga()+500,Pw(t,e)):Dx=F5(t,e);e:do try{if(nr!==0&&vn!==null){e=vn;var s=Pa;t:switch(nr){case 1:nr=0,Pa=null,Bv(t,e,s,1);break;case 2:case 9:if(DY(s)){nr=0,Pa=null,iZ(e);break}e=function(){nr!==2&&nr!==9||br!==t||(nr=7),Cd(t)},s.then(e,e);break e;case 3:nr=7;break e;case 4:nr=5;break e;case 7:DY(s)?(nr=0,Pa=null,iZ(e)):(nr=0,Pa=null,Bv(t,e,s,7));break;case 5:var o=null;switch(vn.tag){case 26:o=vn.memoizedState;case 5:case 27:var a=vn;if(o?Yde(o):a.stateNode.complete){nr=0,Pa=null;var l=a.sibling;if(l!==null)vn=l;else{var c=a.return;c!==null?(vn=c,m9(c)):vn=null}break t}}nr=0,Pa=null,Bv(t,e,s,5);break;case 6:nr=0,Pa=null,Bv(t,e,s,6);break;case 8:AV(),ui=6;break e;default:throw Error(Ce(462))}}e7e();break}catch(u){Cde(t,u)}while(!0);return Th=gy=null,Bt.H=r,Bt.A=i,Un=n,vn!==null?0:(br=null,An=0,o9(),ui)}function e7e(){for(;vn!==null&&!S6e();)Ide(vn)}function Ide(t){var e=nde(t.alternate,t,ef);t.memoizedProps=t.pendingProps,e===null?m9(t):vn=e}function iZ(t){var e=t,n=e.alternate;switch(e.tag){case 15:case 0:e=XY(n,e,e.pendingProps,e.type,void 0,An);break;case 11:e=XY(n,e,e.pendingProps,e.type.render,e.ref,An);break;case 5:fV(e);default:rde(n,e),e=vn=rue(e,ef),e=nde(n,e,ef)}t.memoizedProps=t.pendingProps,e===null?m9(t):vn=e}function Bv(t,e,n,r){Th=gy=null,fV(e),Zv=null,xS=0;var i=e.return;try{if($Ae(t,i,e,n,An)){ui=1,NA(t,Nl(n,t.current)),vn=null;return}}catch(s){if(i!==null)throw vn=i,s;ui=1,NA(t,Nl(n,t.current)),vn=null;return}e.flags&32768?(Nn||r===1?t=!0:Dx||An&536870912?t=!1:(Zp=t=!0,(r===2||r===9||r===3||r===6)&&(r=il.current,r!==null&&r.tag===13&&(r.flags|=16384))),Rde(e,t)):m9(e)}function m9(t){var e=t;do{if(e.flags&32768){Rde(e,Zp);return}t=e.return;var n=qAe(e.alternate,e,ef);if(n!==null){vn=n;return}if(e=e.sibling,e!==null){vn=e;return}vn=e=t}while(e!==null);ui===0&&(ui=5)}function Rde(t,e){do{var n=WAe(t.alternate,t);if(n!==null){n.flags&=32767,vn=n;return}if(n=t.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!e&&(t=t.sibling,t!==null)){vn=t;return}vn=t=n}while(t!==null);ui=6,vn=null}function sZ(t,e,n,r,i,s,o,a,l){t.cancelPendingCommit=null;do g9();while(Ki!==0);if(Un&6)throw Error(Ce(327));if(e!==null){if(e===t.current)throw Error(Ce(177));if(s=e.lanes|e.childLanes,s|=JF,O6e(t,n,s,o,a,l),t===br&&(vn=br=null,An=0),Dw=e,dm=t,jh=n,HP=s,UP=i,_de=r,e.subtreeFlags&10256||e.flags&10256?(t.callbackNode=null,t.callbackPriority=0,i7e(xA,function(){return Pde(),null})):(t.callbackNode=null,t.callbackPriority=0),r=(e.flags&13878)!==0,e.subtreeFlags&13878||r){r=Bt.T,Bt.T=null,i=Wn.p,Wn.p=2,o=Un,Un|=4;try{GAe(t,e,n)}finally{Un=o,Wn.p=i,Bt.T=r}}Ki=1,Mde(),Nde(),Ode()}}function Mde(){if(Ki===1){Ki=0;var t=dm,e=Dw,n=(e.flags&13878)!==0;if(e.subtreeFlags&13878||n){n=Bt.T,Bt.T=null;var r=Wn.p;Wn.p=2;var i=Un;Un|=4;try{pde(e,t);var s=YP,o=Yce(t.containerInfo),a=s.focusedElem,l=s.selectionRange;if(o!==a&&a&&a.ownerDocument&&Kce(a.ownerDocument.documentElement,a)){if(l!==null&&QF(a)){var c=l.start,u=l.end;if(u===void 0&&(u=c),"selectionStart"in a)a.selectionStart=c,a.selectionEnd=Math.min(u,a.value.length);else{var d=a.ownerDocument||document,h=d&&d.defaultView||window;if(h.getSelection){var f=h.getSelection(),p=a.textContent.length,g=Math.min(l.start,p),y=l.end===void 0?g:Math.min(l.end,p);!f.extend&&g>y&&(o=y,y=g,g=o);var v=TY(a,g),b=TY(a,y);if(v&&b&&(f.rangeCount!==1||f.anchorNode!==v.node||f.anchorOffset!==v.offset||f.focusNode!==b.node||f.focusOffset!==b.offset)){var _=d.createRange();_.setStart(v.node,v.offset),f.removeAllRanges(),g>y?(f.addRange(_),f.extend(b.node,b.offset)):(_.setEnd(b.node,b.offset),f.addRange(_))}}}}for(d=[],f=a;f=f.parentNode;)f.nodeType===1&&d.push({element:f,left:f.scrollLeft,top:f.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<d.length;a++){var S=d[a];S.element.scrollLeft=S.left,S.element.scrollTop=S.top}}qA=!!KP,YP=KP=null}finally{Un=i,Wn.p=r,Bt.T=n}}t.current=e,Ki=2}}function Nde(){if(Ki===2){Ki=0;var t=dm,e=Dw,n=(e.flags&8772)!==0;if(e.subtreeFlags&8772||n){n=Bt.T,Bt.T=null;var r=Wn.p;Wn.p=2;var i=Un;Un|=4;try{cde(t,e.alternate,e)}finally{Un=i,Wn.p=r,Bt.T=n}}Ki=3}}function Ode(){if(Ki===4||Ki===3){Ki=0,k6e();var t=dm,e=Dw,n=jh,r=_de;e.subtreeFlags&10256||e.flags&10256?Ki=5:(Ki=0,Dw=dm=null,Dde(t,t.pendingLanes));var i=t.pendingLanes;if(i===0&&(um=null),qF(n),e=e.stateNode,Ka&&typeof Ka.onCommitFiberRoot=="function")try{Ka.onCommitFiberRoot(B5,e,void 0,(e.current.flags&128)===128)}catch{}if(r!==null){e=Bt.T,i=Wn.p,Wn.p=2,Bt.T=null;try{for(var s=t.onRecoverableError,o=0;o<r.length;o++){var a=r[o];s(a.value,{componentStack:a.stack})}}finally{Bt.T=e,Wn.p=i}}jh&3&&g9(),Cd(t),i=t.pendingLanes,n&261930&&i&42?t===qP?k_++:(k_=0,qP=t):k_=0,G5(0)}}function Dde(t,e){(t.pooledCacheLanes&=e)===0&&(e=t.pooledCache,e!=null&&(t.pooledCache=null,U5(e)))}function g9(){return Mde(),Nde(),Ode(),Pde()}function Pde(){if(Ki!==5)return!1;var t=dm,e=HP;HP=0;var n=qF(jh),r=Bt.T,i=Wn.p;try{Wn.p=32>n?32:n,Bt.T=null,n=UP,UP=null;var s=dm,o=jh;if(Ki=0,Dw=dm=null,jh=0,Un&6)throw Error(Ce(331));var a=Un;if(Un|=4,bde(s.current),gde(s,s.current,o,n),Un=a,G5(0,!1),Ka&&typeof Ka.onPostCommitFiberRoot=="function")try{Ka.onPostCommitFiberRoot(B5,s)}catch{}return!0}finally{Wn.p=i,Bt.T=r,Dde(t,e)}}function oZ(t,e,n){e=Nl(n,e),e=jP(t.stateNode,e,2),t=cm(t,e,2),t!==null&&(V5(t,2),Cd(t))}function rr(t,e,n){if(t.tag===3)oZ(t,t,n);else for(;e!==null;){if(e.tag===3){oZ(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(um===null||!um.has(r))){t=Nl(n,t),n=Zue(2),r=cm(e,n,2),r!==null&&(Xue(n,r,e,t),V5(r,2),Cd(r));break}}e=e.return}}function XM(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new ZAe;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(EV=!0,i.add(n),t=t7e.bind(null,t,e,n),e.then(t,t))}function t7e(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),t.pingedLanes|=t.suspendedLanes&n,t.warmLanes&=~n,br===t&&(An&n)===n&&(ui===4||ui===3&&(An&62914560)===An&&300>Ga()-f9?!(Un&2)&&Pw(t,0):TV|=n,Ow===An&&(Ow=0)),Cd(t)}function Lde(t,e){e===0&&(e=Tce()),t=my(t,e),t!==null&&(V5(t,e),Cd(t))}function n7e(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Lde(t,n)}function r7e(t,e){var n=0;switch(t.tag){case 31:case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;case 22:r=t.stateNode._retryCache;break;default:throw Error(Ce(314))}r!==null&&r.delete(e),Lde(t,n)}function i7e(t,e){return HF(t,e)}var jA=null,av=null,WP=!1,BA=!1,QM=!1,Qp=0;function Cd(t){t!==av&&t.next===null&&(av===null?jA=av=t:av=av.next=t),BA=!0,WP||(WP=!0,o7e())}function G5(t,e){if(!QM&&BA){QM=!0;do for(var n=!1,r=jA;r!==null;){if(t!==0){var i=r.pendingLanes;if(i===0)var s=0;else{var o=r.suspendedLanes,a=r.pingedLanes;s=(1<<31-Ya(42|t)+1)-1,s&=i&~(o&~a),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(n=!0,aZ(r,s))}else s=An,s=n9(r,r===br?s:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(s&3)||F5(r,s)||(n=!0,aZ(r,s));r=r.next}while(n);QM=!1}}function s7e(){zde()}function zde(){BA=WP=!1;var t=0;Qp!==0&&g7e()&&(t=Qp);for(var e=Ga(),n=null,r=jA;r!==null;){var i=r.next,s=jde(r,e);s===0?(r.next=null,n===null?jA=i:n.next=i,i===null&&(av=n)):(n=r,(t!==0||s&3)&&(BA=!0)),r=i}Ki!==0&&Ki!==5||G5(t),Qp!==0&&(Qp=0)}function jde(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,s=t.pendingLanes&-62914561;0<s;){var o=31-Ya(s),a=1<<o,l=i[o];l===-1?(!(a&n)||a&r)&&(i[o]=N6e(a,e)):l<=e&&(t.expiredLanes|=a),s&=~a}if(e=br,n=An,n=n9(t,t===e?n:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),r=t.callbackNode,n===0||t===e&&(nr===2||nr===9)||t.cancelPendingCommit!==null)return r!==null&&r!==null&&EM(r),t.callbackNode=null,t.callbackPriority=0;if(!(n&3)||F5(t,n)){if(e=n&-n,e===t.callbackPriority)return e;switch(r!==null&&EM(r),qF(n)){case 2:case 8:n=Cce;break;case 32:n=xA;break;case 268435456:n=Ece;break;default:n=xA}return r=Bde.bind(null,t),n=HF(n,r),t.callbackPriority=e,t.callbackNode=n,e}return r!==null&&r!==null&&EM(r),t.callbackPriority=2,t.callbackNode=null,2}function Bde(t,e){if(Ki!==0&&Ki!==5)return t.callbackNode=null,t.callbackPriority=0,null;var n=t.callbackNode;if(g9()&&t.callbackNode!==n)return null;var r=An;return r=n9(t,t===br?r:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),r===0?null:(kde(t,r,e),jde(t,Ga()),t.callbackNode!=null&&t.callbackNode===n?Bde.bind(null,t):null)}function aZ(t,e){if(g9())return null;kde(t,e,!0)}function o7e(){v7e(function(){Un&6?HF(kce,s7e):zde()})}function IV(){if(Qp===0){var t=Rw;t===0&&(t=NC,NC<<=1,!(NC&261888)&&(NC=256)),Qp=t}return Qp}function lZ(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:kT(""+t)}function cZ(t,e){var n=e.ownerDocument.createElement("input");return n.name=e.name,n.value=e.value,t.id&&n.setAttribute("form",t.id),e.parentNode.insertBefore(n,e),t=new FormData(t),n.parentNode.removeChild(n),t}function a7e(t,e,n,r,i){if(e==="submit"&&n&&n.stateNode===i){var s=lZ((i[ga]||null).action),o=r.submitter;o&&(e=(e=o[ga]||null)?lZ(e.formAction):o.getAttribute("formAction"),e!==null&&(s=e,o=null));var a=new r9("action","action",null,r,i);t.push({event:a,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Qp!==0){var l=o?cZ(i,o):new FormData(i);LP(n,{pending:!0,data:l,method:i.method,action:s},null,l)}}else typeof s=="function"&&(a.preventDefault(),l=o?cZ(i,o):new FormData(i),LP(n,{pending:!0,data:l,method:i.method,action:s},s,l))},currentTarget:i}]})}}for(var JM=0;JM<kP.length;JM++){var eN=kP[JM],l7e=eN.toLowerCase(),c7e=eN[0].toUpperCase()+eN.slice(1);ru(l7e,"on"+c7e)}ru(Xce,"onAnimationEnd");ru(Qce,"onAnimationIteration");ru(Jce,"onAnimationStart");ru("dblclick","onDoubleClick");ru("focusin","onFocus");ru("focusout","onBlur");ru(CAe,"onTransitionRun");ru(EAe,"onTransitionStart");ru(TAe,"onTransitionCancel");ru(eue,"onTransitionEnd");Aw("onMouseEnter",["mouseout","mouseover"]);Aw("onMouseLeave",["mouseout","mouseover"]);Aw("onPointerEnter",["pointerout","pointerover"]);Aw("onPointerLeave",["pointerout","pointerover"]);hy("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));hy("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));hy("onBeforeInput",["compositionend","keypress","textInput","paste"]);hy("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));hy("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));hy("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var kS="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(" "),u7e=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(kS));function Fde(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],i=r.event;r=r.listeners;e:{var s=void 0;if(e)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==s&&i.isPropagationStopped())break e;s=a,i.currentTarget=c;try{s(i)}catch(u){SA(u)}i.currentTarget=null,s=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==s&&i.isPropagationStopped())break e;s=a,i.currentTarget=c;try{s(i)}catch(u){SA(u)}i.currentTarget=null,s=l}}}}function gn(t,e){var n=e[gP];n===void 0&&(n=e[gP]=new Set);var r=t+"__bubble";n.has(r)||(Vde(e,t,2,!1),n.add(r))}function tN(t,e,n){var r=0;e&&(r|=4),Vde(n,t,r,e)}var $C="_reactListening"+Math.random().toString(36).slice(2);function RV(t){if(!t[$C]){t[$C]=!0,Nce.forEach(function(n){n!=="selectionchange"&&(u7e.has(n)||tN(n,!1,t),tN(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[$C]||(e[$C]=!0,tN("selectionchange",!1,e))}}function Vde(t,e,n,r){switch(ehe(e)){case 2:var i=j7e;break;case 8:i=B7e;break;default:i=DV}n=i.bind(null,e,n,t),i=void 0,!xP||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(i=!0),r?i!==void 0?t.addEventListener(e,n,{capture:!0,passive:i}):t.addEventListener(e,n,!0):i!==void 0?t.addEventListener(e,n,{passive:i}):t.addEventListener(e,n,!1)}function nN(t,e,n,r,i){var s=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;a!==null;){if(o=Rv(a),o===null)return;if(l=o.tag,l===5||l===6||l===26||l===27){r=s=o;continue e}a=a.parentNode}}r=r.return}Fce(function(){var c=s,u=KF(n),d=[];e:{var h=tue.get(t);if(h!==void 0){var f=r9,p=t;switch(t){case"keypress":if(ET(n)===0)break e;case"keydown":case"keyup":f=rAe;break;case"focusin":p="focus",f=MM;break;case"focusout":p="blur",f=MM;break;case"beforeblur":case"afterblur":f=MM;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=yY;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=q6e;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=oAe;break;case Xce:case Qce:case Jce:f=K6e;break;case eue:f=lAe;break;case"scroll":case"scrollend":f=H6e;break;case"wheel":f=uAe;break;case"copy":case"cut":case"paste":f=Z6e;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=bY;break;case"toggle":case"beforetoggle":f=hAe}var g=(e&4)!==0,y=!g&&(t==="scroll"||t==="scrollend"),v=g?h!==null?h+"Capture":null:h;g=[];for(var b=c,_;b!==null;){var S=b;if(_=S.stateNode,S=S.tag,S!==5&&S!==26&&S!==27||_===null||v===null||(S=gS(b,v),S!=null&&g.push(CS(b,S,_))),y)break;b=b.return}0<g.length&&(h=new f(h,p,null,n,u),d.push({event:h,listeners:g}))}}if(!(e&7)){e:{if(h=t==="mouseover"||t==="pointerover",f=t==="mouseout"||t==="pointerout",h&&n!==wP&&(p=n.relatedTarget||n.fromElement)&&(Rv(p)||p[Rx]))break e;if((f||h)&&(h=u.window===u?u:(h=u.ownerDocument)?h.defaultView||h.parentWindow:window,f?(p=n.relatedTarget||n.toElement,f=c,p=p?Rv(p):null,p!==null&&(y=j5(p),g=p.tag,p!==y||g!==5&&g!==27&&g!==6)&&(p=null)):(f=null,p=c),f!==p)){if(g=yY,S="onMouseLeave",v="onMouseEnter",b="mouse",(t==="pointerout"||t==="pointerover")&&(g=bY,S="onPointerLeave",v="onPointerEnter",b="pointer"),y=f==null?h:m4(f),_=p==null?h:m4(p),h=new g(S,b+"leave",f,n,u),h.target=y,h.relatedTarget=_,S=null,Rv(u)===c&&(g=new g(v,b+"enter",p,n,u),g.target=_,g.relatedTarget=y,S=g),y=S,f&&p)t:{for(g=d7e,v=f,b=p,_=0,S=v;S;S=g(S))_++;S=0;for(var k=b;k;k=g(k))S++;for(;0<_-S;)v=g(v),_--;for(;0<S-_;)b=g(b),S--;for(;_--;){if(v===b||b!==null&&v===b.alternate){g=v;break t}v=g(v),b=g(b)}g=null}else g=null;f!==null&&uZ(d,h,f,g,!1),p!==null&&y!==null&&uZ(d,y,p,g,!0)}}e:{if(h=c?m4(c):window,f=h.nodeName&&h.nodeName.toLowerCase(),f==="select"||f==="input"&&h.type==="file")var T=SY;else if(_Y(h))if(Wce)T=_Ae;else{T=wAe;var E=bAe}else f=h.nodeName,!f||f.toLowerCase()!=="input"||h.type!=="checkbox"&&h.type!=="radio"?c&&GF(c.elementType)&&(T=SY):T=xAe;if(T&&(T=T(t,c))){qce(d,T,n,u);break e}E&&E(t,h,c),t==="focusout"&&c&&h.type==="number"&&c.memoizedProps.value!=null&&bP(h,"number",h.value)}switch(E=c?m4(c):window,t){case"focusin":(_Y(E)||E.contentEditable==="true")&&(Ov=E,_P=c,m_=null);break;case"focusout":m_=_P=Ov=null;break;case"mousedown":SP=!0;break;case"contextmenu":case"mouseup":case"dragend":SP=!1,AY(d,n,u);break;case"selectionchange":if(kAe)break;case"keydown":case"keyup":AY(d,n,u)}var C;if(XF)e:{switch(t){case"compositionstart":var R="onCompositionStart";break e;case"compositionend":R="onCompositionEnd";break e;case"compositionupdate":R="onCompositionUpdate";break e}R=void 0}else Nv?Hce(t,n)&&(R="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(R="onCompositionStart");R&&($ce&&n.locale!=="ko"&&(Nv||R!=="onCompositionStart"?R==="onCompositionEnd"&&Nv&&(C=Vce()):(Yp=u,YF="value"in Yp?Yp.value:Yp.textContent,Nv=!0)),E=FA(c,R),0<E.length&&(R=new vY(R,t,null,n,u),d.push({event:R,listeners:E}),C?R.data=C:(C=Uce(n),C!==null&&(R.data=C)))),(C=pAe?mAe(t,n):gAe(t,n))&&(R=FA(c,"onBeforeInput"),0<R.length&&(E=new vY("onBeforeInput","beforeinput",null,n,u),d.push({event:E,listeners:R}),E.data=C)),a7e(d,t,c,n,u)}Fde(d,e)})}function CS(t,e,n){return{instance:t,listener:e,currentTarget:n}}function FA(t,e){for(var n=e+"Capture",r=[];t!==null;){var i=t,s=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||s===null||(i=gS(t,n),i!=null&&r.unshift(CS(t,i,s)),i=gS(t,e),i!=null&&r.push(CS(t,i,s))),t.tag===3)return r;t=t.return}return[]}function d7e(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function uZ(t,e,n,r,i){for(var s=e._reactName,o=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(a=a.tag,l!==null&&l===r)break;a!==5&&a!==26&&a!==27||c===null||(l=c,i?(c=gS(n,s),c!=null&&o.unshift(CS(n,c,l))):i||(c=gS(n,s),c!=null&&o.push(CS(n,c,l)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var h7e=/\r\n?/g,f7e=/\u0000|\uFFFD/g;function dZ(t){return(typeof t=="string"?t:""+t).replace(h7e,`
|
||
`).replace(f7e,"")}function $de(t,e){return e=dZ(e),dZ(t)===e}function or(t,e,n,r,i,s){switch(n){case"children":typeof r=="string"?e==="body"||e==="textarea"&&r===""||Iw(t,r):(typeof r=="number"||typeof r=="bigint")&&e!=="body"&&Iw(t,""+r);break;case"className":PC(t,"class",r);break;case"tabIndex":PC(t,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":PC(t,n,r);break;case"style":Bce(t,r,s);break;case"data":if(e!=="object"){PC(t,"data",r);break}case"src":case"href":if(r===""&&(e!=="a"||n!=="href")){t.removeAttribute(n);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){t.removeAttribute(n);break}r=kT(""+r),t.setAttribute(n,r);break;case"action":case"formAction":if(typeof r=="function"){t.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 s=="function"&&(n==="formAction"?(e!=="input"&&or(t,e,"name",i.name,i,null),or(t,e,"formEncType",i.formEncType,i,null),or(t,e,"formMethod",i.formMethod,i,null),or(t,e,"formTarget",i.formTarget,i,null)):(or(t,e,"encType",i.encType,i,null),or(t,e,"method",i.method,i,null),or(t,e,"target",i.target,i,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){t.removeAttribute(n);break}r=kT(""+r),t.setAttribute(n,r);break;case"onClick":r!=null&&(t.onclick=Eh);break;case"onScroll":r!=null&&gn("scroll",t);break;case"onScrollEnd":r!=null&&gn("scrollend",t);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(Ce(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(Ce(60));t.innerHTML=n}}break;case"multiple":t.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":t.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"){t.removeAttribute("xlink:href");break}n=kT(""+r),t.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"?t.setAttribute(n,""+r):t.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":r&&typeof r!="function"&&typeof r!="symbol"?t.setAttribute(n,""):t.removeAttribute(n);break;case"capture":case"download":r===!0?t.setAttribute(n,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?t.setAttribute(n,r):t.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?t.setAttribute(n,r):t.removeAttribute(n);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?t.removeAttribute(n):t.setAttribute(n,r);break;case"popover":gn("beforetoggle",t),gn("toggle",t),ST(t,"popover",r);break;case"xlinkActuate":Vd(t,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":Vd(t,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":Vd(t,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":Vd(t,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":Vd(t,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":Vd(t,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":Vd(t,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":Vd(t,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":Vd(t,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":ST(t,"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=V6e.get(n)||n,ST(t,n,r))}}function GP(t,e,n,r,i,s){switch(n){case"style":Bce(t,r,s);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(Ce(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(Ce(60));t.innerHTML=n}}break;case"children":typeof r=="string"?Iw(t,r):(typeof r=="number"||typeof r=="bigint")&&Iw(t,""+r);break;case"onScroll":r!=null&&gn("scroll",t);break;case"onScrollEnd":r!=null&&gn("scrollend",t);break;case"onClick":r!=null&&(t.onclick=Eh);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Oce.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(i=n.endsWith("Capture"),e=n.slice(2,i?n.length-7:void 0),s=t[ga]||null,s=s!=null?s[n]:null,typeof s=="function"&&t.removeEventListener(e,s,i),typeof r=="function")){typeof s!="function"&&s!==null&&(n in t?t[n]=null:t.hasAttribute(n)&&t.removeAttribute(n)),t.addEventListener(e,r,i);break e}n in t?t[n]=r:r===!0?t.setAttribute(n,""):ST(t,n,r)}}}function Ns(t,e,n){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":gn("error",t),gn("load",t);var r=!1,i=!1,s;for(s in n)if(n.hasOwnProperty(s)){var o=n[s];if(o!=null)switch(s){case"src":r=!0;break;case"srcSet":i=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(Ce(137,e));default:or(t,e,s,o,n,null)}}i&&or(t,e,"srcSet",n.srcSet,n,null),r&&or(t,e,"src",n.src,n,null);return;case"input":gn("invalid",t);var a=s=o=i=null,l=null,c=null;for(r in n)if(n.hasOwnProperty(r)){var u=n[r];if(u!=null)switch(r){case"name":i=u;break;case"type":o=u;break;case"checked":l=u;break;case"defaultChecked":c=u;break;case"value":s=u;break;case"defaultValue":a=u;break;case"children":case"dangerouslySetInnerHTML":if(u!=null)throw Error(Ce(137,e));break;default:or(t,e,r,u,n,null)}}Lce(t,s,a,l,c,o,i,!1);return;case"select":gn("invalid",t),r=o=s=null;for(i in n)if(n.hasOwnProperty(i)&&(a=n[i],a!=null))switch(i){case"value":s=a;break;case"defaultValue":o=a;break;case"multiple":r=a;default:or(t,e,i,a,n,null)}e=s,n=o,t.multiple=!!r,e!=null?Gv(t,!!r,e,!1):n!=null&&Gv(t,!!r,n,!0);return;case"textarea":gn("invalid",t),s=i=r=null;for(o in n)if(n.hasOwnProperty(o)&&(a=n[o],a!=null))switch(o){case"value":r=a;break;case"defaultValue":i=a;break;case"children":s=a;break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(Ce(91));break;default:or(t,e,o,a,n,null)}jce(t,r,i,s);return;case"option":for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case"selected":t.selected=r&&typeof r!="function"&&typeof r!="symbol";break;default:or(t,e,l,r,n,null)}return;case"dialog":gn("beforetoggle",t),gn("toggle",t),gn("cancel",t),gn("close",t);break;case"iframe":case"object":gn("load",t);break;case"video":case"audio":for(r=0;r<kS.length;r++)gn(kS[r],t);break;case"image":gn("error",t),gn("load",t);break;case"details":gn("toggle",t);break;case"embed":case"source":case"link":gn("error",t),gn("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(c in n)if(n.hasOwnProperty(c)&&(r=n[c],r!=null))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(Ce(137,e));default:or(t,e,c,r,n,null)}return;default:if(GF(e)){for(u in n)n.hasOwnProperty(u)&&(r=n[u],r!==void 0&&GP(t,e,u,r,n,void 0));return}}for(a in n)n.hasOwnProperty(a)&&(r=n[a],r!=null&&or(t,e,a,r,n,null))}function p7e(t,e,n,r){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var i=null,s=null,o=null,a=null,l=null,c=null,u=null;for(f in n){var d=n[f];if(n.hasOwnProperty(f)&&d!=null)switch(f){case"checked":break;case"value":break;case"defaultValue":l=d;default:r.hasOwnProperty(f)||or(t,e,f,null,r,d)}}for(var h in r){var f=r[h];if(d=n[h],r.hasOwnProperty(h)&&(f!=null||d!=null))switch(h){case"type":s=f;break;case"name":i=f;break;case"checked":c=f;break;case"defaultChecked":u=f;break;case"value":o=f;break;case"defaultValue":a=f;break;case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(Ce(137,e));break;default:f!==d&&or(t,e,h,f,r,d)}}vP(t,o,a,l,c,u,s,i);return;case"select":f=o=a=h=null;for(s in n)if(l=n[s],n.hasOwnProperty(s)&&l!=null)switch(s){case"value":break;case"multiple":f=l;default:r.hasOwnProperty(s)||or(t,e,s,null,r,l)}for(i in r)if(s=r[i],l=n[i],r.hasOwnProperty(i)&&(s!=null||l!=null))switch(i){case"value":h=s;break;case"defaultValue":a=s;break;case"multiple":o=s;default:s!==l&&or(t,e,i,s,r,l)}e=a,n=o,r=f,h!=null?Gv(t,!!n,h,!1):!!r!=!!n&&(e!=null?Gv(t,!!n,e,!0):Gv(t,!!n,n?[]:"",!1));return;case"textarea":f=h=null;for(a in n)if(i=n[a],n.hasOwnProperty(a)&&i!=null&&!r.hasOwnProperty(a))switch(a){case"value":break;case"children":break;default:or(t,e,a,null,r,i)}for(o in r)if(i=r[o],s=n[o],r.hasOwnProperty(o)&&(i!=null||s!=null))switch(o){case"value":h=i;break;case"defaultValue":f=i;break;case"children":break;case"dangerouslySetInnerHTML":if(i!=null)throw Error(Ce(91));break;default:i!==s&&or(t,e,o,i,r,s)}zce(t,h,f);return;case"option":for(var p in n)if(h=n[p],n.hasOwnProperty(p)&&h!=null&&!r.hasOwnProperty(p))switch(p){case"selected":t.selected=!1;break;default:or(t,e,p,null,r,h)}for(l in r)if(h=r[l],f=n[l],r.hasOwnProperty(l)&&h!==f&&(h!=null||f!=null))switch(l){case"selected":t.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:or(t,e,l,h,r,f)}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)h=n[g],n.hasOwnProperty(g)&&h!=null&&!r.hasOwnProperty(g)&&or(t,e,g,null,r,h);for(c in r)if(h=r[c],f=n[c],r.hasOwnProperty(c)&&h!==f&&(h!=null||f!=null))switch(c){case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(Ce(137,e));break;default:or(t,e,c,h,r,f)}return;default:if(GF(e)){for(var y in n)h=n[y],n.hasOwnProperty(y)&&h!==void 0&&!r.hasOwnProperty(y)&&GP(t,e,y,void 0,r,h);for(u in r)h=r[u],f=n[u],!r.hasOwnProperty(u)||h===f||h===void 0&&f===void 0||GP(t,e,u,h,r,f);return}}for(var v in n)h=n[v],n.hasOwnProperty(v)&&h!=null&&!r.hasOwnProperty(v)&&or(t,e,v,null,r,h);for(d in r)h=r[d],f=n[d],!r.hasOwnProperty(d)||h===f||h==null&&f==null||or(t,e,d,h,r,f)}function hZ(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function m7e(){if(typeof performance.getEntriesByType=="function"){for(var t=0,e=0,n=performance.getEntriesByType("resource"),r=0;r<n.length;r++){var i=n[r],s=i.transferSize,o=i.initiatorType,a=i.duration;if(s&&a&&hZ(o)){for(o=0,a=i.responseEnd,r+=1;r<n.length;r++){var l=n[r],c=l.startTime;if(c>a)break;var u=l.transferSize,d=l.initiatorType;u&&hZ(d)&&(l=l.responseEnd,o+=u*(l<a?1:(a-c)/(l-c)))}if(--r,e+=8*(s+o)/(i.duration/1e3),t++,10<t)break}}if(0<t)return e/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var KP=null,YP=null;function VA(t){return t.nodeType===9?t:t.ownerDocument}function fZ(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Hde(t,e){if(t===0)switch(e){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&e==="foreignObject"?0:t}function ZP(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.children=="bigint"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var rN=null;function g7e(){var t=window.event;return t&&t.type==="popstate"?t===rN?!1:(rN=t,!0):(rN=null,!1)}var Ude=typeof setTimeout=="function"?setTimeout:void 0,y7e=typeof clearTimeout=="function"?clearTimeout:void 0,pZ=typeof Promise=="function"?Promise:void 0,v7e=typeof queueMicrotask=="function"?queueMicrotask:typeof pZ<"u"?function(t){return pZ.resolve(null).then(t).catch(b7e)}:Ude;function b7e(t){setTimeout(function(){throw t})}function f0(t){return t==="head"}function mZ(t,e){var n=e,r=0;do{var i=n.nextSibling;if(t.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"||n==="/&"){if(r===0){t.removeChild(i),zw(e);return}r--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")r++;else if(n==="html")C_(t.ownerDocument.documentElement);else if(n==="head"){n=t.ownerDocument.head,C_(n);for(var s=n.firstChild;s;){var o=s.nextSibling,a=s.nodeName;s[$5]||a==="SCRIPT"||a==="STYLE"||a==="LINK"&&s.rel.toLowerCase()==="stylesheet"||n.removeChild(s),s=o}}else n==="body"&&C_(t.ownerDocument.body);n=i}while(n);zw(e)}function gZ(t,e){var n=t;t=0;do{var r=n.nextSibling;if(n.nodeType===1?e?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(e?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(t===0)break;t--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||t++;n=r}while(n)}function XP(t){var e=t.firstChild;for(e&&e.nodeType===10&&(e=e.nextSibling);e;){var n=e;switch(e=e.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":XP(n),WF(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}t.removeChild(n)}}function w7e(t,e,n,r){for(;t.nodeType===1;){var i=n;if(t.nodeName.toLowerCase()!==e.toLowerCase()){if(!r&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(r){if(!t[$5])switch(e){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(s=t.getAttribute("rel"),s==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(s!==i.rel||t.getAttribute("href")!==(i.href==null||i.href===""?null:i.href)||t.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin)||t.getAttribute("title")!==(i.title==null?null:i.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(s=t.getAttribute("src"),(s!==(i.src==null?null:i.src)||t.getAttribute("type")!==(i.type==null?null:i.type)||t.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin))&&s&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(e==="input"&&t.type==="hidden"){var s=i.name==null?null:""+i.name;if(i.type==="hidden"&&t.getAttribute("name")===s)return t}else return t;if(t=ql(t.nextSibling),t===null)break}return null}function x7e(t,e,n){if(e==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=ql(t.nextSibling),t===null))return null;return t}function qde(t,e){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!e||(t=ql(t.nextSibling),t===null))return null;return t}function QP(t){return t.data==="$?"||t.data==="$~"}function JP(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function _7e(t,e){var n=t.ownerDocument;if(t.data==="$~")t._reactRetry=e;else if(t.data!=="$?"||n.readyState!=="loading")e();else{var r=function(){e(),n.removeEventListener("DOMContentLoaded",r)};n.addEventListener("DOMContentLoaded",r),t._reactRetry=r}}function ql(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?"||e==="$~"||e==="&"||e==="F!"||e==="F")break;if(e==="/$"||e==="/&")return null}}return t}var eL=null;function yZ(t){t=t.nextSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"||n==="/&"){if(e===0)return ql(t.nextSibling);e--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||e++}t=t.nextSibling}return null}function vZ(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(e===0)return t;e--}else n!=="/$"&&n!=="/&"||e++}t=t.previousSibling}return null}function Wde(t,e,n){switch(e=VA(n),t){case"html":if(t=e.documentElement,!t)throw Error(Ce(452));return t;case"head":if(t=e.head,!t)throw Error(Ce(453));return t;case"body":if(t=e.body,!t)throw Error(Ce(454));return t;default:throw Error(Ce(451))}}function C_(t){for(var e=t.attributes;e.length;)t.removeAttributeNode(e[0]);WF(t)}var Zl=new Map,bZ=new Set;function $A(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var wf=Wn.d;Wn.d={f:S7e,r:k7e,D:C7e,C:E7e,L:T7e,m:A7e,X:R7e,S:I7e,M:M7e};function S7e(){var t=wf.f(),e=p9();return t||e}function k7e(t){var e=Mx(t);e!==null&&e.tag===5&&e.type==="form"?Bue(e):wf.r(t)}var Px=typeof document>"u"?null:document;function Gde(t,e,n){var r=Px;if(r&&typeof e=="string"&&e){var i=Ml(e);i='link[rel="'+t+'"][href="'+i+'"]',typeof n=="string"&&(i+='[crossorigin="'+n+'"]'),bZ.has(i)||(bZ.add(i),t={rel:t,crossOrigin:n,href:e},r.querySelector(i)===null&&(e=r.createElement("link"),Ns(e,"link",t),us(e),r.head.appendChild(e)))}}function C7e(t){wf.D(t),Gde("dns-prefetch",t,null)}function E7e(t,e){wf.C(t,e),Gde("preconnect",t,e)}function T7e(t,e,n){wf.L(t,e,n);var r=Px;if(r&&t&&e){var i='link[rel="preload"][as="'+Ml(e)+'"]';e==="image"&&n&&n.imageSrcSet?(i+='[imagesrcset="'+Ml(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(i+='[imagesizes="'+Ml(n.imageSizes)+'"]')):i+='[href="'+Ml(t)+'"]';var s=i;switch(e){case"style":s=Lw(t);break;case"script":s=Lx(t)}Zl.has(s)||(t=Lr({rel:"preload",href:e==="image"&&n&&n.imageSrcSet?void 0:t,as:e},n),Zl.set(s,t),r.querySelector(i)!==null||e==="style"&&r.querySelector(K5(s))||e==="script"&&r.querySelector(Y5(s))||(e=r.createElement("link"),Ns(e,"link",t),us(e),r.head.appendChild(e)))}}function A7e(t,e){wf.m(t,e);var n=Px;if(n&&t){var r=e&&typeof e.as=="string"?e.as:"script",i='link[rel="modulepreload"][as="'+Ml(r)+'"][href="'+Ml(t)+'"]',s=i;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=Lx(t)}if(!Zl.has(s)&&(t=Lr({rel:"modulepreload",href:t},e),Zl.set(s,t),n.querySelector(i)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Y5(s)))return}r=n.createElement("link"),Ns(r,"link",t),us(r),n.head.appendChild(r)}}}function I7e(t,e,n){wf.S(t,e,n);var r=Px;if(r&&t){var i=Wv(r).hoistableStyles,s=Lw(t);e=e||"default";var o=i.get(s);if(!o){var a={loading:0,preload:null};if(o=r.querySelector(K5(s)))a.loading=5;else{t=Lr({rel:"stylesheet",href:t,"data-precedence":e},n),(n=Zl.get(s))&&MV(t,n);var l=o=r.createElement("link");us(l),Ns(l,"link",t),l._p=new Promise(function(c,u){l.onload=c,l.onerror=u}),l.addEventListener("load",function(){a.loading|=1}),l.addEventListener("error",function(){a.loading|=2}),a.loading|=4,DT(o,e,r)}o={type:"stylesheet",instance:o,count:1,state:a},i.set(s,o)}}}function R7e(t,e){wf.X(t,e);var n=Px;if(n&&t){var r=Wv(n).hoistableScripts,i=Lx(t),s=r.get(i);s||(s=n.querySelector(Y5(i)),s||(t=Lr({src:t,async:!0},e),(e=Zl.get(i))&&NV(t,e),s=n.createElement("script"),us(s),Ns(s,"link",t),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},r.set(i,s))}}function M7e(t,e){wf.M(t,e);var n=Px;if(n&&t){var r=Wv(n).hoistableScripts,i=Lx(t),s=r.get(i);s||(s=n.querySelector(Y5(i)),s||(t=Lr({src:t,async:!0,type:"module"},e),(e=Zl.get(i))&&NV(t,e),s=n.createElement("script"),us(s),Ns(s,"link",t),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},r.set(i,s))}}function wZ(t,e,n,r){var i=(i=om.current)?$A(i):null;if(!i)throw Error(Ce(446));switch(t){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(e=Lw(n.href),n=Wv(i).hoistableStyles,r=n.get(e),r||(r={type:"style",instance:null,count:0,state:null},n.set(e,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){t=Lw(n.href);var s=Wv(i).hoistableStyles,o=s.get(t);if(o||(i=i.ownerDocument||i,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(t,o),(s=i.querySelector(K5(t)))&&!s._p&&(o.instance=s,o.state.loading=5),Zl.has(t)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Zl.set(t,n),s||N7e(i,t,n,o.state))),e&&r===null)throw Error(Ce(528,""));return o}if(e&&r!==null)throw Error(Ce(529,""));return null;case"script":return e=n.async,n=n.src,typeof n=="string"&&e&&typeof e!="function"&&typeof e!="symbol"?(e=Lx(n),n=Wv(i).hoistableScripts,r=n.get(e),r||(r={type:"script",instance:null,count:0,state:null},n.set(e,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(Ce(444,t))}}function Lw(t){return'href="'+Ml(t)+'"'}function K5(t){return'link[rel="stylesheet"]['+t+"]"}function Kde(t){return Lr({},t,{"data-precedence":t.precedence,precedence:null})}function N7e(t,e,n,r){t.querySelector('link[rel="preload"][as="style"]['+e+"]")?r.loading=1:(e=t.createElement("link"),r.preload=e,e.addEventListener("load",function(){return r.loading|=1}),e.addEventListener("error",function(){return r.loading|=2}),Ns(e,"link",n),us(e),t.head.appendChild(e))}function Lx(t){return'[src="'+Ml(t)+'"]'}function Y5(t){return"script[async]"+t}function xZ(t,e,n){if(e.count++,e.instance===null)switch(e.type){case"style":var r=t.querySelector('style[data-href~="'+Ml(n.href)+'"]');if(r)return e.instance=r,us(r),r;var i=Lr({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(t.ownerDocument||t).createElement("style"),us(r),Ns(r,"style",i),DT(r,n.precedence,t),e.instance=r;case"stylesheet":i=Lw(n.href);var s=t.querySelector(K5(i));if(s)return e.state.loading|=4,e.instance=s,us(s),s;r=Kde(n),(i=Zl.get(i))&&MV(r,i),s=(t.ownerDocument||t).createElement("link"),us(s);var o=s;return o._p=new Promise(function(a,l){o.onload=a,o.onerror=l}),Ns(s,"link",r),e.state.loading|=4,DT(s,n.precedence,t),e.instance=s;case"script":return s=Lx(n.src),(i=t.querySelector(Y5(s)))?(e.instance=i,us(i),i):(r=n,(i=Zl.get(s))&&(r=Lr({},n),NV(r,i)),t=t.ownerDocument||t,i=t.createElement("script"),us(i),Ns(i,"link",r),t.head.appendChild(i),e.instance=i);case"void":return null;default:throw Error(Ce(443,e.type))}else e.type==="stylesheet"&&!(e.state.loading&4)&&(r=e.instance,e.state.loading|=4,DT(r,n.precedence,t));return e.instance}function DT(t,e,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=r.length?r[r.length-1]:null,s=i,o=0;o<r.length;o++){var a=r[o];if(a.dataset.precedence===e)s=a;else if(s!==i)break}s?s.parentNode.insertBefore(t,s.nextSibling):(e=n.nodeType===9?n.head:n,e.insertBefore(t,e.firstChild))}function MV(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.title==null&&(t.title=e.title)}function NV(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.integrity==null&&(t.integrity=e.integrity)}var PT=null;function _Z(t,e,n){if(PT===null){var r=new Map,i=PT=new Map;i.set(n,r)}else i=PT,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(t))return r;for(r.set(t,null),n=n.getElementsByTagName(t),i=0;i<n.length;i++){var s=n[i];if(!(s[$5]||s[Es]||t==="link"&&s.getAttribute("rel")==="stylesheet")&&s.namespaceURI!=="http://www.w3.org/2000/svg"){var o=s.getAttribute(e)||"";o=t+o;var a=r.get(o);a?a.push(s):r.set(o,[s])}}return r}function SZ(t,e,n){t=t.ownerDocument||t,t.head.insertBefore(n,e==="title"?t.querySelector("head > title"):null)}function O7e(t,e,n){if(n===1||e.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof e.precedence!="string"||typeof e.href!="string"||e.href==="")break;return!0;case"link":if(typeof e.rel!="string"||typeof e.href!="string"||e.href===""||e.onLoad||e.onError)break;switch(e.rel){case"stylesheet":return t=e.disabled,typeof e.precedence=="string"&&t==null;default:return!0}case"script":if(e.async&&typeof e.async!="function"&&typeof e.async!="symbol"&&!e.onLoad&&!e.onError&&e.src&&typeof e.src=="string")return!0}return!1}function Yde(t){return!(t.type==="stylesheet"&&!(t.state.loading&3))}function D7e(t,e,n,r){if(n.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var i=Lw(r.href),s=e.querySelector(K5(i));if(s){e=s._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(t.count++,t=HA.bind(t),e.then(t,t)),n.state.loading|=4,n.instance=s,us(s);return}s=e.ownerDocument||e,r=Kde(r),(i=Zl.get(i))&&MV(r,i),s=s.createElement("link"),us(s);var o=s;o._p=new Promise(function(a,l){o.onload=a,o.onerror=l}),Ns(s,"link",r),n.instance=s}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(n,e),(e=n.state.preload)&&!(n.state.loading&3)&&(t.count++,n=HA.bind(t),e.addEventListener("load",n),e.addEventListener("error",n))}}var iN=0;function P7e(t,e){return t.stylesheets&&t.count===0&<(t,t.stylesheets),0<t.count||0<t.imgCount?function(n){var r=setTimeout(function(){if(t.stylesheets&<(t,t.stylesheets),t.unsuspend){var s=t.unsuspend;t.unsuspend=null,s()}},6e4+e);0<t.imgBytes&&iN===0&&(iN=62500*m7e());var i=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&<(t,t.stylesheets),t.unsuspend)){var s=t.unsuspend;t.unsuspend=null,s()}},(t.imgBytes>iN?50:800)+e);return t.unsuspend=n,function(){t.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function HA(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)LT(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var UA=null;function LT(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,UA=new Map,e.forEach(L7e,t),UA=null,HA.call(t))}function L7e(t,e){if(!(e.state.loading&4)){var n=UA.get(t);if(n)var r=n.get(null);else{n=new Map,UA.set(t,n);for(var i=t.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s<i.length;s++){var o=i[s];(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=e.instance,o=i.getAttribute("data-precedence"),s=n.get(o)||r,s===r&&n.set(null,i),n.set(o,i),this.count++,r=HA.bind(this),i.addEventListener("load",r),i.addEventListener("error",r),s?s.parentNode.insertBefore(i,s.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(i,t.firstChild)),e.state.loading|=4}}var ES={$$typeof:Ch,Provider:null,Consumer:null,_currentValue:r1,_currentValue2:r1,_threadCount:0};function z7e(t,e,n,r,i,s,o,a,l){this.tag=1,this.containerInfo=t,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=TM(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=TM(0),this.hiddenUpdates=TM(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=s,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function Zde(t,e,n,r,i,s,o,a,l,c,u,d){return t=new z7e(t,e,n,o,l,c,u,d,a),e=1,s===!0&&(e|=24),s=Ba(3,null,null,e),t.current=s,s.stateNode=t,e=iV(),e.refCount++,t.pooledCache=e,e.refCount++,s.memoizedState={element:r,isDehydrated:n,cache:e},aV(s),t}function Xde(t){return t?(t=Lv,t):Lv}function Qde(t,e,n,r,i,s){i=Xde(i),r.context===null?r.context=i:r.pendingContext=i,r=lm(e),r.payload={element:n},s=s===void 0?null:s,s!==null&&(r.callback=s),n=cm(t,r,e),n!==null&&(fa(n,t,e),y_(n,t,e))}function kZ(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function OV(t,e){kZ(t,e),(t=t.alternate)&&kZ(t,e)}function Jde(t){if(t.tag===13||t.tag===31){var e=my(t,67108864);e!==null&&fa(e,t,67108864),OV(t,67108864)}}function CZ(t){if(t.tag===13||t.tag===31){var e=Za();e=UF(e);var n=my(t,e);n!==null&&fa(n,t,e),OV(t,e)}}var qA=!0;function j7e(t,e,n,r){var i=Bt.T;Bt.T=null;var s=Wn.p;try{Wn.p=2,DV(t,e,n,r)}finally{Wn.p=s,Bt.T=i}}function B7e(t,e,n,r){var i=Bt.T;Bt.T=null;var s=Wn.p;try{Wn.p=8,DV(t,e,n,r)}finally{Wn.p=s,Bt.T=i}}function DV(t,e,n,r){if(qA){var i=tL(r);if(i===null)nN(t,e,r,WA,n),EZ(t,r);else if(V7e(i,t,e,n,r))r.stopPropagation();else if(EZ(t,r),e&4&&-1<F7e.indexOf(t)){for(;i!==null;){var s=Mx(i);if(s!==null)switch(s.tag){case 3:if(s=s.stateNode,s.current.memoizedState.isDehydrated){var o=og(s.pendingLanes);if(o!==0){var a=s;for(a.pendingLanes|=2,a.entangledLanes|=2;o;){var l=1<<31-Ya(o);a.entanglements[1]|=l,o&=~l}Cd(s),!(Un&6)&&(PA=Ga()+500,G5(0))}}break;case 31:case 13:a=my(s,2),a!==null&&fa(a,s,2),p9(),OV(s,2)}if(s=tL(r),s===null&&nN(t,e,r,WA,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else nN(t,e,r,null,n)}}function tL(t){return t=KF(t),PV(t)}var WA=null;function PV(t){if(WA=null,t=Rv(t),t!==null){var e=j5(t);if(e===null)t=null;else{var n=e.tag;if(n===13){if(t=bce(e),t!==null)return t;t=null}else if(n===31){if(t=wce(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null)}}return WA=t,null}function ehe(t){switch(t){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(C6e()){case kce:return 2;case Cce:return 8;case xA:case E6e:return 32;case Ece:return 268435456;default:return 32}default:return 32}}var nL=!1,hm=null,fm=null,pm=null,TS=new Map,AS=new Map,_p=[],F7e="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 EZ(t,e){switch(t){case"focusin":case"focusout":hm=null;break;case"dragenter":case"dragleave":fm=null;break;case"mouseover":case"mouseout":pm=null;break;case"pointerover":case"pointerout":TS.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":AS.delete(e.pointerId)}}function H2(t,e,n,r,i,s){return t===null||t.nativeEvent!==s?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},e!==null&&(e=Mx(e),e!==null&&Jde(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function V7e(t,e,n,r,i){switch(e){case"focusin":return hm=H2(hm,t,e,n,r,i),!0;case"dragenter":return fm=H2(fm,t,e,n,r,i),!0;case"mouseover":return pm=H2(pm,t,e,n,r,i),!0;case"pointerover":var s=i.pointerId;return TS.set(s,H2(TS.get(s)||null,t,e,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,AS.set(s,H2(AS.get(s)||null,t,e,n,r,i)),!0}return!1}function the(t){var e=Rv(t.target);if(e!==null){var n=j5(e);if(n!==null){if(e=n.tag,e===13){if(e=bce(n),e!==null){t.blockedOn=e,uY(t.priority,function(){CZ(n)});return}}else if(e===31){if(e=wce(n),e!==null){t.blockedOn=e,uY(t.priority,function(){CZ(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function zT(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=tL(t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);wP=r,n.target.dispatchEvent(r),wP=null}else return e=Mx(n),e!==null&&Jde(e),t.blockedOn=n,!1;e.shift()}return!0}function TZ(t,e,n){zT(t)&&n.delete(e)}function $7e(){nL=!1,hm!==null&&zT(hm)&&(hm=null),fm!==null&&zT(fm)&&(fm=null),pm!==null&&zT(pm)&&(pm=null),TS.forEach(TZ),AS.forEach(TZ)}function HC(t,e){t.blockedOn===e&&(t.blockedOn=null,nL||(nL=!0,Qi.unstable_scheduleCallback(Qi.unstable_NormalPriority,$7e)))}var UC=null;function AZ(t){UC!==t&&(UC=t,Qi.unstable_scheduleCallback(Qi.unstable_NormalPriority,function(){UC===t&&(UC=null);for(var e=0;e<t.length;e+=3){var n=t[e],r=t[e+1],i=t[e+2];if(typeof r!="function"){if(PV(r||n)===null)continue;break}var s=Mx(n);s!==null&&(t.splice(e,3),e-=3,LP(s,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function zw(t){function e(l){return HC(l,t)}hm!==null&&HC(hm,t),fm!==null&&HC(fm,t),pm!==null&&HC(pm,t),TS.forEach(e),AS.forEach(e);for(var n=0;n<_p.length;n++){var r=_p[n];r.blockedOn===t&&(r.blockedOn=null)}for(;0<_p.length&&(n=_p[0],n.blockedOn===null);)the(n),n.blockedOn===null&&_p.shift();if(n=(t.ownerDocument||t).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],s=n[r+1],o=i[ga]||null;if(typeof s=="function")o||AZ(n);else if(o){var a=null;if(s&&s.hasAttribute("formAction")){if(i=s,o=s[ga]||null)a=o.formAction;else if(PV(i)!==null)continue}else a=o.action;typeof a=="function"?n[r+1]=a:(n.splice(r,3),r-=3),AZ(n)}}}function nhe(){function t(s){s.canIntercept&&s.info==="react-transition"&&s.intercept({handler:function(){return new Promise(function(o){return i=o})},focusReset:"manual",scroll:"manual"})}function e(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var s=navigation.currentEntry;s&&s.url!=null&&navigation.navigate(s.url,{state:s.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,i=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",e),navigation.addEventListener("navigateerror",e),setTimeout(n,100),function(){r=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",e),navigation.removeEventListener("navigateerror",e),i!==null&&(i(),i=null)}}}function LV(t){this._internalRoot=t}y9.prototype.render=LV.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(Ce(409));var n=e.current,r=Za();Qde(n,r,t,e,null,null)};y9.prototype.unmount=LV.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Qde(t.current,2,null,t,null,null),p9(),e[Rx]=null}};function y9(t){this._internalRoot=t}y9.prototype.unstable_scheduleHydration=function(t){if(t){var e=Mce();t={blockedOn:null,target:t,priority:e};for(var n=0;n<_p.length&&e!==0&&e<_p[n].priority;n++);_p.splice(n,0,t),n===0&&the(t)}};var IZ=yce.version;if(IZ!=="19.2.4")throw Error(Ce(527,IZ,"19.2.4"));Wn.findDOMNode=function(t){var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(Ce(188)):(t=Object.keys(t).join(","),Error(Ce(268,t)));return t=v6e(e),t=t!==null?xce(t):null,t=t===null?null:t.stateNode,t};var H7e={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Bt,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var qC=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qC.isDisabled&&qC.supportsFiber)try{B5=qC.inject(H7e),Ka=qC}catch{}}e9.createRoot=function(t,e){if(!vce(t))throw Error(Ce(299));var n=!1,r="",i=Gue,s=Kue,o=Yue;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onUncaughtError!==void 0&&(i=e.onUncaughtError),e.onCaughtError!==void 0&&(s=e.onCaughtError),e.onRecoverableError!==void 0&&(o=e.onRecoverableError)),e=Zde(t,1,!1,null,null,n,r,null,i,s,o,nhe),t[Rx]=e.current,RV(t),new LV(e)};e9.hydrateRoot=function(t,e,n){if(!vce(t))throw Error(Ce(299));var r=!1,i="",s=Gue,o=Kue,a=Yue,l=null;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onUncaughtError!==void 0&&(s=n.onUncaughtError),n.onCaughtError!==void 0&&(o=n.onCaughtError),n.onRecoverableError!==void 0&&(a=n.onRecoverableError),n.formState!==void 0&&(l=n.formState)),e=Zde(t,1,!0,e,n??null,r,i,l,s,o,a,nhe),e.context=Xde(null),n=e.current,r=Za(),r=UF(r),i=lm(r),i.callback=null,cm(n,i,r),n=r,e.current.lanes=n,V5(e,n),Cd(e),t[Rx]=e.current,RV(t),new y9(e)};e9.version="19.2.4";function rhe(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(rhe)}catch(t){console.error(t)}}rhe(),nce.exports=e9;var U7e=nce.exports;/**
|
||
* react-router v7.13.0
|
||
*
|
||
* Copyright (c) Remix Software Inc.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE.md file in the root directory of this source tree.
|
||
*
|
||
* @license MIT
|
||
*/var RZ="popstate";function q7e(t={}){function e(r,i){let{pathname:s,search:o,hash:a}=r.location;return rL("",{pathname:s,search:o,hash:a},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:IS(i)}return G7e(e,n,null,t)}function Jr(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Wc(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function W7e(){return Math.random().toString(36).substring(2,10)}function MZ(t,e){return{usr:t.state,key:t.key,idx:e}}function rL(t,e,n=null,r){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?zx(e):e,state:n,key:e&&e.key||r||W7e()}}function IS({pathname:t="/",search:e="",hash:n=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function zx(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substring(n),t=t.substring(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substring(r),t=t.substring(0,r)),t&&(e.pathname=t)}return e}function G7e(t,e,n,r={}){let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,a="POP",l=null,c=u();c==null&&(c=0,o.replaceState({...o.state,idx:c},""));function u(){return(o.state||{idx:null}).idx}function d(){a="POP";let y=u(),v=y==null?null:y-c;c=y,l&&l({action:a,location:g.location,delta:v})}function h(y,v){a="PUSH";let b=rL(g.location,y,v);c=u()+1;let _=MZ(b,c),S=g.createHref(b);try{o.pushState(_,"",S)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;i.location.assign(S)}s&&l&&l({action:a,location:g.location,delta:1})}function f(y,v){a="REPLACE";let b=rL(g.location,y,v);c=u();let _=MZ(b,c),S=g.createHref(b);o.replaceState(_,"",S),s&&l&&l({action:a,location:g.location,delta:0})}function p(y){return K7e(y)}let g={get action(){return a},get location(){return t(i,o)},listen(y){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(RZ,d),l=y,()=>{i.removeEventListener(RZ,d),l=null}},createHref(y){return e(i,y)},createURL:p,encodeLocation(y){let v=p(y);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:h,replace:f,go(y){return o.go(y)}};return g}function K7e(t,e=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Jr(n,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:IS(t);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function ihe(t,e,n="/"){return Y7e(t,e,n,!1)}function Y7e(t,e,n,r){let i=typeof e=="string"?zx(e):e,s=tf(i.pathname||"/",n);if(s==null)return null;let o=she(t);Z7e(o);let a=null;for(let l=0;a==null&&l<o.length;++l){let c=a8e(s);a=s8e(o[l],c,r)}return a}function she(t,e=[],n=[],r="",i=!1){let s=(o,a,l=i,c)=>{let u={relativePath:c===void 0?o.path||"":c,caseSensitive:o.caseSensitive===!0,childrenIndex:a,route:o};if(u.relativePath.startsWith("/")){if(!u.relativePath.startsWith(r)&&l)return;Jr(u.relativePath.startsWith(r),`Absolute route path "${u.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(r.length)}let d=Bh([r,u.relativePath]),h=n.concat(u);o.children&&o.children.length>0&&(Jr(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),she(o.children,e,h,d,l)),!(o.path==null&&!o.index)&&e.push({path:d,score:r8e(d,o.index),routesMeta:h})};return t.forEach((o,a)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))s(o,a);else for(let c of ohe(o.path))s(o,a,!0,c)}),e}function ohe(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=ohe(r.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function Z7e(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:i8e(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var X7e=/^:[\w-]+$/,Q7e=3,J7e=2,e8e=1,t8e=10,n8e=-2,NZ=t=>t==="*";function r8e(t,e){let n=t.split("/"),r=n.length;return n.some(NZ)&&(r+=n8e),e&&(r+=J7e),n.filter(i=>!NZ(i)).reduce((i,s)=>i+(X7e.test(s)?Q7e:s===""?e8e:t8e),r)}function i8e(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function s8e(t,e,n=!1){let{routesMeta:r}=t,i={},s="/",o=[];for(let a=0;a<r.length;++a){let l=r[a],c=a===r.length-1,u=s==="/"?e:e.slice(s.length)||"/",d=GA({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},u),h=l.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=GA({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},u)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:Bh([s,d.pathname]),pathnameBase:d8e(Bh([s,d.pathnameBase])),route:h}),d.pathnameBase!=="/"&&(s=Bh([s,d.pathnameBase]))}return o}function GA(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=o8e(t.path,t.caseSensitive,t.end),i=e.match(n);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),a=i.slice(1);return{params:r.reduce((c,{paramName:u,isOptional:d},h)=>{if(u==="*"){let p=a[h]||"";o=s.slice(0,s.length-p.length).replace(/(.)\/+$/,"$1")}const f=a[h];return d&&!f?c[u]=void 0:c[u]=(f||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:t}}function o8e(t,e=!1,n=!0){Wc(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function a8e(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Wc(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function tf(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}var l8e=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function c8e(t,e="/"){let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?zx(t):t,s;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?s=OZ(n.substring(1),"/"):s=OZ(n,e)):s=e,{pathname:s,search:h8e(r),hash:f8e(i)}}function OZ(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function sN(t,e,n,r){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function u8e(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function ahe(t){let e=u8e(t);return e.map((n,r)=>r===e.length-1?n.pathname:n.pathnameBase)}function lhe(t,e,n,r=!1){let i;typeof t=="string"?i=zx(t):(i={...t},Jr(!i.pathname||!i.pathname.includes("?"),sN("?","pathname","search",i)),Jr(!i.pathname||!i.pathname.includes("#"),sN("#","pathname","hash",i)),Jr(!i.search||!i.search.includes("#"),sN("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=n;else{let d=e.length-1;if(!r&&o.startsWith("..")){let h=o.split("/");for(;h[0]==="..";)h.shift(),d-=1;i.pathname=h.join("/")}a=d>=0?e[d]:"/"}let l=c8e(i,a),c=o&&o!=="/"&&o.endsWith("/"),u=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}var Bh=t=>t.join("/").replace(/\/\/+/g,"/"),d8e=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),h8e=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,f8e=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,p8e=class{constructor(t,e,n,r=!1){this.status=t,this.statusText=e||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function m8e(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function g8e(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var che=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function uhe(t,e){let n=t;if(typeof n!="string"||!l8e.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(che)try{let s=new URL(window.location.href),o=n.startsWith("//")?new URL(s.protocol+n):new URL(n),a=tf(o.pathname,e);o.origin===s.origin&&a!=null?n=a+o.search+o.hash:i=!0}catch{Wc(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var dhe=["POST","PUT","PATCH","DELETE"];new Set(dhe);var y8e=["GET",...dhe];new Set(y8e);var jx=x.createContext(null);jx.displayName="DataRouter";var v9=x.createContext(null);v9.displayName="DataRouterState";var v8e=x.createContext(!1),hhe=x.createContext({isTransitioning:!1});hhe.displayName="ViewTransition";var b8e=x.createContext(new Map);b8e.displayName="Fetchers";var w8e=x.createContext(null);w8e.displayName="Await";var rc=x.createContext(null);rc.displayName="Navigation";var Z5=x.createContext(null);Z5.displayName="Location";var Ed=x.createContext({outlet:null,matches:[],isDataRoute:!1});Ed.displayName="Route";var zV=x.createContext(null);zV.displayName="RouteError";var fhe="REACT_ROUTER_ERROR",x8e="REDIRECT",_8e="ROUTE_ERROR_RESPONSE";function S8e(t){if(t.startsWith(`${fhe}:${x8e}:{`))try{let e=JSON.parse(t.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function k8e(t){if(t.startsWith(`${fhe}:${_8e}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new p8e(e.status,e.statusText,e.data)}catch{}}function C8e(t,{relative:e}={}){Jr(X5(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=x.useContext(rc),{hash:i,pathname:s,search:o}=J5(t,{relative:e}),a=s;return n!=="/"&&(a=s==="/"?n:Bh([n,s])),r.createHref({pathname:a,search:o,hash:i})}function X5(){return x.useContext(Z5)!=null}function xf(){return Jr(X5(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(Z5).location}var phe="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function mhe(t){x.useContext(rc).static||x.useLayoutEffect(t)}function oo(){let{isDataRoute:t}=x.useContext(Ed);return t?j8e():E8e()}function E8e(){Jr(X5(),"useNavigate() may be used only in the context of a <Router> component.");let t=x.useContext(jx),{basename:e,navigator:n}=x.useContext(rc),{matches:r}=x.useContext(Ed),{pathname:i}=xf(),s=JSON.stringify(ahe(r)),o=x.useRef(!1);return mhe(()=>{o.current=!0}),x.useCallback((l,c={})=>{if(Wc(o.current,phe),!o.current)return;if(typeof l=="number"){n.go(l);return}let u=lhe(l,JSON.parse(s),i,c.relative==="path");t==null&&e!=="/"&&(u.pathname=u.pathname==="/"?e:Bh([e,u.pathname])),(c.replace?n.replace:n.push)(u,c.state,c)},[e,n,s,i,t])}x.createContext(null);function Q5(){let{matches:t}=x.useContext(Ed),e=t[t.length-1];return e?e.params:{}}function J5(t,{relative:e}={}){let{matches:n}=x.useContext(Ed),{pathname:r}=xf(),i=JSON.stringify(ahe(n));return x.useMemo(()=>lhe(t,JSON.parse(i),r,e==="path"),[t,i,r,e])}function T8e(t,e){return ghe(t,e)}function ghe(t,e,n,r,i){var b;Jr(X5(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=x.useContext(rc),{matches:o}=x.useContext(Ed),a=o[o.length-1],l=a?a.params:{},c=a?a.pathname:"/",u=a?a.pathnameBase:"/",d=a&&a.route;{let _=d&&d.path||"";vhe(c,!d||_.endsWith("*")||_.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${_}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
||
|
||
Please change the parent <Route path="${_}"> to <Route path="${_==="/"?"*":`${_}/*`}">.`)}let h=xf(),f;if(e){let _=typeof e=="string"?zx(e):e;Jr(u==="/"||((b=_.pathname)==null?void 0:b.startsWith(u)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${_.pathname}" was given in the \`location\` prop.`),f=_}else f=h;let p=f.pathname||"/",g=p;if(u!=="/"){let _=u.replace(/^\//,"").split("/");g="/"+p.replace(/^\//,"").split("/").slice(_.length).join("/")}let y=ihe(t,{pathname:g});Wc(d||y!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),Wc(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let v=N8e(y&&y.map(_=>Object.assign({},_,{params:Object.assign({},l,_.params),pathname:Bh([u,s.encodeLocation?s.encodeLocation(_.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?u:Bh([u,s.encodeLocation?s.encodeLocation(_.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathnameBase])})),o,n,r,i);return e&&v?x.createElement(Z5.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...f},navigationType:"POP"}},v):v}function A8e(){let t=z8e(),e=m8e(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",t),o=x.createElement(x.Fragment,null,x.createElement("p",null,"💿 Hey developer 👋"),x.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",x.createElement("code",{style:s},"ErrorBoundary")," or"," ",x.createElement("code",{style:s},"errorElement")," prop on your route.")),x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},e),n?x.createElement("pre",{style:i},n):null,o)}var I8e=x.createElement(A8e,null),yhe=class extends x.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError?this.props.onError(t,e):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const n=k8e(t.digest);n&&(t=n)}let e=t!==void 0?x.createElement(Ed.Provider,{value:this.props.routeContext},x.createElement(zV.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?x.createElement(R8e,{error:t},e):e}};yhe.contextType=v8e;var oN=new WeakMap;function R8e({children:t,error:e}){let{basename:n}=x.useContext(rc);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=S8e(e.digest);if(r){let i=oN.get(e);if(i)throw i;let s=uhe(r.location,n);if(che&&!oN.get(e))if(s.isExternal||r.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:r.replace}));throw oN.set(e,o),o}return x.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return t}function M8e({routeContext:t,match:e,children:n}){let r=x.useContext(jx);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),x.createElement(Ed.Provider,{value:t},n)}function N8e(t,e=[],n=null,r=null,i=null){if(t==null){if(!n)return null;if(n.errors)t=n.matches;else if(e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let s=t,o=n==null?void 0:n.errors;if(o!=null){let u=s.findIndex(d=>d.route.id&&(o==null?void 0:o[d.route.id])!==void 0);Jr(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,u+1))}let a=!1,l=-1;if(n)for(let u=0;u<s.length;u++){let d=s[u];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(l=u),d.route.id){let{loaderData:h,errors:f}=n,p=d.route.loader&&!h.hasOwnProperty(d.route.id)&&(!f||f[d.route.id]===void 0);if(d.route.lazy||p){a=!0,l>=0?s=s.slice(0,l+1):s=[s[0]];break}}}let c=n&&r?(u,d)=>{var h,f;r(u,{location:n.location,params:((f=(h=n.matches)==null?void 0:h[0])==null?void 0:f.params)??{},unstable_pattern:g8e(n.matches),errorInfo:d})}:void 0;return s.reduceRight((u,d,h)=>{let f,p=!1,g=null,y=null;n&&(f=o&&d.route.id?o[d.route.id]:void 0,g=d.route.errorElement||I8e,a&&(l<0&&h===0?(vhe("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),p=!0,y=null):l===h&&(p=!0,y=d.route.hydrateFallbackElement||null)));let v=e.concat(s.slice(0,h+1)),b=()=>{let _;return f?_=g:p?_=y:d.route.Component?_=x.createElement(d.route.Component,null):d.route.element?_=d.route.element:_=u,x.createElement(M8e,{match:d,routeContext:{outlet:u,matches:v,isDataRoute:n!=null},children:_})};return n&&(d.route.ErrorBoundary||d.route.errorElement||h===0)?x.createElement(yhe,{location:n.location,revalidation:n.revalidation,component:g,error:f,children:b(),routeContext:{outlet:null,matches:v,isDataRoute:!0},onError:c}):b()},null)}function jV(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function O8e(t){let e=x.useContext(jx);return Jr(e,jV(t)),e}function D8e(t){let e=x.useContext(v9);return Jr(e,jV(t)),e}function P8e(t){let e=x.useContext(Ed);return Jr(e,jV(t)),e}function BV(t){let e=P8e(t),n=e.matches[e.matches.length-1];return Jr(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function L8e(){return BV("useRouteId")}function z8e(){var r;let t=x.useContext(zV),e=D8e("useRouteError"),n=BV("useRouteError");return t!==void 0?t:(r=e.errors)==null?void 0:r[n]}function j8e(){let{router:t}=O8e("useNavigate"),e=BV("useNavigate"),n=x.useRef(!1);return mhe(()=>{n.current=!0}),x.useCallback(async(i,s={})=>{Wc(n.current,phe),n.current&&(typeof i=="number"?await t.navigate(i):await t.navigate(i,{fromRouteId:e,...s}))},[t,e])}var DZ={};function vhe(t,e,n){!e&&!DZ[t]&&(DZ[t]=!0,Wc(!1,n))}x.memo(B8e);function B8e({routes:t,future:e,state:n,onError:r}){return ghe(t,void 0,n,r,e)}function eh(t){Jr(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function F8e({basename:t="/",children:e=null,location:n,navigationType:r="POP",navigator:i,static:s=!1,unstable_useTransitions:o}){Jr(!X5(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let a=t.replace(/^\/*/,"/"),l=x.useMemo(()=>({basename:a,navigator:i,static:s,unstable_useTransitions:o,future:{}}),[a,i,s,o]);typeof n=="string"&&(n=zx(n));let{pathname:c="/",search:u="",hash:d="",state:h=null,key:f="default"}=n,p=x.useMemo(()=>{let g=tf(c,a);return g==null?null:{location:{pathname:g,search:u,hash:d,state:h,key:f},navigationType:r}},[a,c,u,d,h,f,r]);return Wc(p!=null,`<Router basename="${a}"> is not able to match the URL "${c}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),p==null?null:x.createElement(rc.Provider,{value:l},x.createElement(Z5.Provider,{children:e,value:p}))}function V8e({children:t,location:e}){return T8e(iL(t),e)}function iL(t,e=[]){let n=[];return x.Children.forEach(t,(r,i)=>{if(!x.isValidElement(r))return;let s=[...e,i];if(r.type===x.Fragment){n.push.apply(n,iL(r.props.children,s));return}Jr(r.type===eh,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Jr(!r.props.index||!r.props.children,"An index route cannot have child routes.");let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=iL(r.props.children,s)),n.push(o)}),n}var jT="get",BT="application/x-www-form-urlencoded";function b9(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function $8e(t){return b9(t)&&t.tagName.toLowerCase()==="button"}function H8e(t){return b9(t)&&t.tagName.toLowerCase()==="form"}function U8e(t){return b9(t)&&t.tagName.toLowerCase()==="input"}function q8e(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function W8e(t,e){return t.button===0&&(!e||e==="_self")&&!q8e(t)}function sL(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function G8e(t,e){let n=sL(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(s=>{n.append(i,s)})}),n}var WC=null;function K8e(){if(WC===null)try{new FormData(document.createElement("form"),0),WC=!1}catch{WC=!0}return WC}var Y8e=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function aN(t){return t!=null&&!Y8e.has(t)?(Wc(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${BT}"`),null):t}function Z8e(t,e){let n,r,i,s,o;if(H8e(t)){let a=t.getAttribute("action");r=a?tf(a,e):null,n=t.getAttribute("method")||jT,i=aN(t.getAttribute("enctype"))||BT,s=new FormData(t)}else if($8e(t)||U8e(t)&&(t.type==="submit"||t.type==="image")){let a=t.form;if(a==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=t.getAttribute("formaction")||a.getAttribute("action");if(r=l?tf(l,e):null,n=t.getAttribute("formmethod")||a.getAttribute("method")||jT,i=aN(t.getAttribute("formenctype"))||aN(a.getAttribute("enctype"))||BT,s=new FormData(a,t),!K8e()){let{name:c,type:u,value:d}=t;if(u==="image"){let h=c?`${c}.`:"";s.append(`${h}x`,"0"),s.append(`${h}y`,"0")}else c&&s.append(c,d)}}else{if(b9(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=jT,r=null,i=BT,o=t}return s&&i==="text/plain"&&(o=s,s=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:s,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function FV(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function X8e(t,e,n,r){let i=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return n?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname==="/"?i.pathname=`_root.${r}`:e&&tf(i.pathname,e)==="/"?i.pathname=`${e.replace(/\/$/,"")}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${r}`,i}async function Q8e(t,e){if(t.id in e)return e[t.id];try{let n=await import(t.module);return e[t.id]=n,n}catch(n){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function J8e(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function e9e(t,e,n){let r=await Promise.all(t.map(async i=>{let s=e.routes[i.route.id];if(s){let o=await Q8e(s,n);return o.links?o.links():[]}return[]}));return i9e(r.flat(1).filter(J8e).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function PZ(t,e,n,r,i,s){let o=(l,c)=>n[c]?l.route.id!==n[c].route.id:!0,a=(l,c)=>{var u;return n[c].pathname!==l.pathname||((u=n[c].route.path)==null?void 0:u.endsWith("*"))&&n[c].params["*"]!==l.params["*"]};return s==="assets"?e.filter((l,c)=>o(l,c)||a(l,c)):s==="data"?e.filter((l,c)=>{var d;let u=r.routes[l.route.id];if(!u||!u.hasLoader)return!1;if(o(l,c)||a(l,c))return!0;if(l.route.shouldRevalidate){let h=l.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:((d=n[0])==null?void 0:d.params)||{},nextUrl:new URL(t,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof h=="boolean")return h}return!0}):[]}function t9e(t,e,{includeHydrateFallback:n}={}){return n9e(t.map(r=>{let i=e.routes[r.route.id];if(!i)return[];let s=[i.module];return i.clientActionModule&&(s=s.concat(i.clientActionModule)),i.clientLoaderModule&&(s=s.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(s=s.concat(i.hydrateFallbackModule)),i.imports&&(s=s.concat(i.imports)),s}).flat(1))}function n9e(t){return[...new Set(t)]}function r9e(t){let e={},n=Object.keys(t).sort();for(let r of n)e[r]=t[r];return e}function i9e(t,e){let n=new Set;return new Set(e),t.reduce((r,i)=>{let s=JSON.stringify(r9e(i));return n.has(s)||(n.add(s),r.push({key:s,link:i})),r},[])}function bhe(){let t=x.useContext(jx);return FV(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function s9e(){let t=x.useContext(v9);return FV(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var VV=x.createContext(void 0);VV.displayName="FrameworkContext";function whe(){let t=x.useContext(VV);return FV(t,"You must render this element inside a <HydratedRouter> element"),t}function o9e(t,e){let n=x.useContext(VV),[r,i]=x.useState(!1),[s,o]=x.useState(!1),{onFocus:a,onBlur:l,onMouseEnter:c,onMouseLeave:u,onTouchStart:d}=e,h=x.useRef(null);x.useEffect(()=>{if(t==="render"&&o(!0),t==="viewport"){let g=v=>{v.forEach(b=>{o(b.isIntersecting)})},y=new IntersectionObserver(g,{threshold:.5});return h.current&&y.observe(h.current),()=>{y.disconnect()}}},[t]),x.useEffect(()=>{if(r){let g=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(g)}}},[r]);let f=()=>{i(!0)},p=()=>{i(!1),o(!1)};return n?t!=="intent"?[s,h,{}]:[s,h,{onFocus:U2(a,f),onBlur:U2(l,p),onMouseEnter:U2(c,f),onMouseLeave:U2(u,p),onTouchStart:U2(d,f)}]:[!1,h,{}]}function U2(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function a9e({page:t,...e}){let{router:n}=bhe(),r=x.useMemo(()=>ihe(n.routes,t,n.basename),[n.routes,t,n.basename]);return r?x.createElement(c9e,{page:t,matches:r,...e}):null}function l9e(t){let{manifest:e,routeModules:n}=whe(),[r,i]=x.useState([]);return x.useEffect(()=>{let s=!1;return e9e(t,e,n).then(o=>{s||i(o)}),()=>{s=!0}},[t,e,n]),r}function c9e({page:t,matches:e,...n}){let r=xf(),{future:i,manifest:s,routeModules:o}=whe(),{basename:a}=bhe(),{loaderData:l,matches:c}=s9e(),u=x.useMemo(()=>PZ(t,e,c,s,r,"data"),[t,e,c,s,r]),d=x.useMemo(()=>PZ(t,e,c,s,r,"assets"),[t,e,c,s,r]),h=x.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let g=new Set,y=!1;if(e.forEach(b=>{var S;let _=s.routes[b.route.id];!_||!_.hasLoader||(!u.some(k=>k.route.id===b.route.id)&&b.route.id in l&&((S=o[b.route.id])!=null&&S.shouldRevalidate)||_.hasClientLoader?y=!0:g.add(b.route.id))}),g.size===0)return[];let v=X8e(t,a,i.unstable_trailingSlashAwareDataRequests,"data");return y&&g.size>0&&v.searchParams.set("_routes",e.filter(b=>g.has(b.route.id)).map(b=>b.route.id).join(",")),[v.pathname+v.search]},[a,i.unstable_trailingSlashAwareDataRequests,l,r,s,u,e,t,o]),f=x.useMemo(()=>t9e(d,s),[d,s]),p=l9e(d);return x.createElement(x.Fragment,null,h.map(g=>x.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...n})),f.map(g=>x.createElement("link",{key:g,rel:"modulepreload",href:g,...n})),p.map(({key:g,link:y})=>x.createElement("link",{key:g,nonce:n.nonce,...y,crossOrigin:y.crossOrigin??n.crossOrigin})))}function u9e(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var d9e=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{d9e&&(window.__reactRouterVersion="7.13.0")}catch{}function h9e({basename:t,children:e,unstable_useTransitions:n,window:r}){let i=x.useRef();i.current==null&&(i.current=q7e({window:r,v5Compat:!0}));let s=i.current,[o,a]=x.useState({action:s.action,location:s.location}),l=x.useCallback(c=>{n===!1?a(c):x.startTransition(()=>a(c))},[n]);return x.useLayoutEffect(()=>s.listen(l),[s,l]),x.createElement(F8e,{basename:t,children:e,location:o.location,navigationType:o.action,navigator:s,unstable_useTransitions:n})}var xhe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_he=x.forwardRef(function({onClick:e,discover:n="render",prefetch:r="none",relative:i,reloadDocument:s,replace:o,state:a,target:l,to:c,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:h,...f},p){let{basename:g,unstable_useTransitions:y}=x.useContext(rc),v=typeof c=="string"&&xhe.test(c),b=uhe(c,g);c=b.to;let _=C8e(c,{relative:i}),[S,k,T]=o9e(r,f),E=g9e(c,{replace:o,state:a,target:l,preventScrollReset:u,relative:i,viewTransition:d,unstable_defaultShouldRevalidate:h,unstable_useTransitions:y});function C(M){e&&e(M),M.defaultPrevented||E(M)}let R=x.createElement("a",{...f,...T,href:b.absoluteURL||_,onClick:b.isExternal||s?e:C,ref:u9e(p,k),target:l,"data-discover":!v&&n==="render"?"true":void 0});return S&&!v?x.createElement(x.Fragment,null,R,x.createElement(a9e,{page:_})):R});_he.displayName="Link";var f9e=x.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:r="",end:i=!1,style:s,to:o,viewTransition:a,children:l,...c},u){let d=J5(o,{relative:c.relative}),h=xf(),f=x.useContext(v9),{navigator:p,basename:g}=x.useContext(rc),y=f!=null&&_9e(d)&&a===!0,v=p.encodeLocation?p.encodeLocation(d).pathname:d.pathname,b=h.pathname,_=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;n||(b=b.toLowerCase(),_=_?_.toLowerCase():null,v=v.toLowerCase()),_&&g&&(_=tf(_,g)||_);const S=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let k=b===v||!i&&b.startsWith(v)&&b.charAt(S)==="/",T=_!=null&&(_===v||!i&&_.startsWith(v)&&_.charAt(v.length)==="/"),E={isActive:k,isPending:T,isTransitioning:y},C=k?e:void 0,R;typeof r=="function"?R=r(E):R=[r,k?"active":null,T?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let M=typeof s=="function"?s(E):s;return x.createElement(_he,{...c,"aria-current":C,className:R,ref:u,style:M,to:o,viewTransition:a},typeof l=="function"?l(E):l)});f9e.displayName="NavLink";var p9e=x.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:r,replace:i,state:s,method:o=jT,action:a,onSubmit:l,relative:c,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:h,...f},p)=>{let{unstable_useTransitions:g}=x.useContext(rc),y=w9e(),v=x9e(a,{relative:c}),b=o.toLowerCase()==="get"?"get":"post",_=typeof a=="string"&&xhe.test(a),S=k=>{if(l&&l(k),k.defaultPrevented)return;k.preventDefault();let T=k.nativeEvent.submitter,E=(T==null?void 0:T.getAttribute("formmethod"))||o,C=()=>y(T||k.currentTarget,{fetcherKey:e,method:E,navigate:n,replace:i,state:s,relative:c,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:h});g&&n!==!1?x.startTransition(()=>C()):C()};return x.createElement("form",{ref:p,method:b,action:v,onSubmit:r?l:S,...f,"data-discover":!_&&t==="render"?"true":void 0})});p9e.displayName="Form";function m9e(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function She(t){let e=x.useContext(jx);return Jr(e,m9e(t)),e}function g9e(t,{target:e,replace:n,state:r,preventScrollReset:i,relative:s,viewTransition:o,unstable_defaultShouldRevalidate:a,unstable_useTransitions:l}={}){let c=oo(),u=xf(),d=J5(t,{relative:s});return x.useCallback(h=>{if(W8e(h,e)){h.preventDefault();let f=n!==void 0?n:IS(u)===IS(d),p=()=>c(t,{replace:f,state:r,preventScrollReset:i,relative:s,viewTransition:o,unstable_defaultShouldRevalidate:a});l?x.startTransition(()=>p()):p()}},[u,c,d,n,r,e,t,i,s,o,a,l])}function y9e(t){Wc(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let e=x.useRef(sL(t)),n=x.useRef(!1),r=xf(),i=x.useMemo(()=>G8e(r.search,n.current?null:e.current),[r.search]),s=oo(),o=x.useCallback((a,l)=>{const c=sL(typeof a=="function"?a(new URLSearchParams(i)):a);n.current=!0,s("?"+c,l)},[s,i]);return[i,o]}var v9e=0,b9e=()=>`__${String(++v9e)}__`;function w9e(){let{router:t}=She("useSubmit"),{basename:e}=x.useContext(rc),n=L8e(),r=t.fetch,i=t.navigate;return x.useCallback(async(s,o={})=>{let{action:a,method:l,encType:c,formData:u,body:d}=Z8e(s,e);if(o.navigate===!1){let h=o.fetcherKey||b9e();await r(h,n,o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:u,body:d,formMethod:o.method||l,formEncType:o.encType||c,flushSync:o.flushSync})}else await i(o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:u,body:d,formMethod:o.method||l,formEncType:o.encType||c,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,i,e,n])}function x9e(t,{relative:e}={}){let{basename:n}=x.useContext(rc),r=x.useContext(Ed);Jr(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),s={...J5(t||".",{relative:e})},o=xf();if(t==null){s.search=o.search;let a=new URLSearchParams(s.search),l=a.getAll("index");if(l.some(u=>u==="")){a.delete("index"),l.filter(d=>d).forEach(d=>a.append("index",d));let u=a.toString();s.search=u?`?${u}`:""}}return(!t||t===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:Bh([n,s.pathname])),IS(s)}function _9e(t,{relative:e}={}){let n=x.useContext(hhe);Jr(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=She("useViewTransitionState"),i=J5(t,{relative:e});if(!n.isTransitioning)return!1;let s=tf(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=tf(n.nextLocation.pathname,r)||n.nextLocation.pathname;return GA(i.pathname,o)!=null||GA(i.pathname,s)!=null}function S9e({children:t}){return m.jsx(h9e,{children:t})}function LZ(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function w9(...t){return e=>{let n=!1;const r=t.map(i=>{const s=LZ(i,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():LZ(t[i],null)}}}}function Jt(...t){return x.useCallback(w9(...t),t)}function O1(t){const e=k9e(t),n=x.forwardRef((r,i)=>{const{children:s,...o}=r,a=x.Children.toArray(s),l=a.find(E9e);if(l){const c=l.props.children,u=a.map(d=>d===l?x.Children.count(c)>1?x.Children.only(null):x.isValidElement(c)?c.props.children:null:d);return m.jsx(e,{...o,ref:i,children:x.isValidElement(c)?x.cloneElement(c,void 0,u):null})}return m.jsx(e,{...o,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}var $V=O1("Slot");function k9e(t){const e=x.forwardRef((n,r)=>{const{children:i,...s}=n;if(x.isValidElement(i)){const o=A9e(i),a=T9e(s,i.props);return i.type!==x.Fragment&&(a.ref=r?w9(r,o):o),x.cloneElement(i,a)}return x.Children.count(i)>1?x.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var khe=Symbol("radix.slottable");function C9e(t){const e=({children:n})=>m.jsx(m.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=khe,e}function E9e(t){return x.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===khe}function T9e(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function A9e(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var I9e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xt=I9e.reduce((t,e)=>{const n=O1(`Primitive.${e}`),r=x.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Che(t,e){t&&nc.flushSync(()=>t.dispatchEvent(e))}var Ehe=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"}),R9e="VisuallyHidden",The=x.forwardRef((t,e)=>m.jsx(xt.span,{...t,ref:e,style:{...Ehe,...t.style}}));The.displayName=R9e;var M9e=The;function N9e(t,e){const n=x.createContext(e),r=s=>{const{children:o,...a}=s,l=x.useMemo(()=>a,Object.values(a));return m.jsx(n.Provider,{value:l,children:o})};r.displayName=t+"Provider";function i(s){const o=x.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[r,i]}function ao(t,e=[]){let n=[];function r(s,o){const a=x.createContext(o),l=n.length;n=[...n,o];const c=d=>{var v;const{scope:h,children:f,...p}=d,g=((v=h==null?void 0:h[t])==null?void 0:v[l])||a,y=x.useMemo(()=>p,Object.values(p));return m.jsx(g.Provider,{value:y,children:f})};c.displayName=s+"Provider";function u(d,h){var g;const f=((g=h==null?void 0:h[t])==null?void 0:g[l])||a,p=x.useContext(f);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const i=()=>{const s=n.map(o=>x.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return x.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,O9e(i,...e)]}function O9e(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return x.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}function HV(t){const e=t+"CollectionProvider",[n,r]=ao(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=g=>{const{scope:y,children:v}=g,b=Be.useRef(null),_=Be.useRef(new Map).current;return m.jsx(i,{scope:y,itemMap:_,collectionRef:b,children:v})};o.displayName=e;const a=t+"CollectionSlot",l=O1(a),c=Be.forwardRef((g,y)=>{const{scope:v,children:b}=g,_=s(a,v),S=Jt(y,_.collectionRef);return m.jsx(l,{ref:S,children:b})});c.displayName=a;const u=t+"CollectionItemSlot",d="data-radix-collection-item",h=O1(u),f=Be.forwardRef((g,y)=>{const{scope:v,children:b,..._}=g,S=Be.useRef(null),k=Jt(y,S),T=s(u,v);return Be.useEffect(()=>(T.itemMap.set(S,{ref:S,..._}),()=>void T.itemMap.delete(S))),m.jsx(h,{[d]:"",ref:k,children:b})});f.displayName=u;function p(g){const y=s(t+"CollectionConsumer",g);return Be.useCallback(()=>{const b=y.collectionRef.current;if(!b)return[];const _=Array.from(b.querySelectorAll(`[${d}]`));return Array.from(y.itemMap.values()).sort((T,E)=>_.indexOf(T.ref.current)-_.indexOf(E.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:o,Slot:c,ItemSlot:f},p,r]}function et(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}var zi=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},D9e=hce[" useInsertionEffect ".trim().toString()]||zi;function gd({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,o]=P9e({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:i;{const u=x.useRef(t!==void 0);x.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const c=x.useCallback(u=>{var d;if(a){const h=L9e(u)?u(t):u;h!==t&&((d=o.current)==null||d.call(o,h))}else s(u)},[a,t,s,o]);return[l,c]}function P9e({defaultProp:t,onChange:e}){const[n,r]=x.useState(t),i=x.useRef(n),s=x.useRef(e);return D9e(()=>{s.current=e},[e]),x.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function L9e(t){return typeof t=="function"}function z9e(t,e){return x.useReducer((n,r)=>e[n][r]??n,t)}var Fs=t=>{const{present:e,children:n}=t,r=j9e(e),i=typeof n=="function"?n({present:r.isPresent}):x.Children.only(n),s=Jt(r.ref,B9e(i));return typeof n=="function"||r.isPresent?x.cloneElement(i,{ref:s}):null};Fs.displayName="Presence";function j9e(t){const[e,n]=x.useState(),r=x.useRef(null),i=x.useRef(t),s=x.useRef("none"),o=t?"mounted":"unmounted",[a,l]=z9e(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const c=GC(r.current);s.current=a==="mounted"?c:"none"},[a]),zi(()=>{const c=r.current,u=i.current;if(u!==t){const h=s.current,f=GC(c);t?l("MOUNT"):f==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),zi(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=f=>{const g=GC(r.current).includes(CSS.escape(f.animationName));if(f.target===e&&g&&(l("ANIMATION_END"),!i.current)){const y=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},h=f=>{f.target===e&&(s.current=GC(r.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:x.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function GC(t){return(t==null?void 0:t.animationName)||"none"}function B9e(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var F9e=hce[" useId ".trim().toString()]||(()=>{}),V9e=0;function zc(t){const[e,n]=x.useState(F9e());return zi(()=>{n(r=>r??String(V9e++))},[t]),t||(e?`radix-${e}`:"")}var $9e=x.createContext(void 0);function Bx(t){const e=x.useContext($9e);return t||e||"ltr"}function ds(t){const e=x.useRef(t);return x.useEffect(()=>{e.current=t}),x.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function H9e(t,e=globalThis==null?void 0:globalThis.document){const n=ds(t);x.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var U9e="DismissableLayer",oL="dismissableLayer.update",q9e="dismissableLayer.pointerDownOutside",W9e="dismissableLayer.focusOutside",zZ,Ahe=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),e3=x.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=t,c=x.useContext(Ahe),[u,d]=x.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=x.useState({}),p=Jt(e,E=>d(E)),g=Array.from(c.layers),[y]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(y),b=u?g.indexOf(u):-1,_=c.layersWithOutsidePointerEventsDisabled.size>0,S=b>=v,k=Y9e(E=>{const C=E.target,R=[...c.branches].some(M=>M.contains(C));!S||R||(i==null||i(E),o==null||o(E),E.defaultPrevented||a==null||a())},h),T=Z9e(E=>{const C=E.target;[...c.branches].some(M=>M.contains(C))||(s==null||s(E),o==null||o(E),E.defaultPrevented||a==null||a())},h);return H9e(E=>{b===c.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},h),x.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(zZ=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),jZ(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=zZ)}},[u,h,n,c]),x.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),jZ())},[u,c]),x.useEffect(()=>{const E=()=>f({});return document.addEventListener(oL,E),()=>document.removeEventListener(oL,E)},[]),m.jsx(xt.div,{...l,ref:p,style:{pointerEvents:_?S?"auto":"none":void 0,...t.style},onFocusCapture:et(t.onFocusCapture,T.onFocusCapture),onBlurCapture:et(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:et(t.onPointerDownCapture,k.onPointerDownCapture)})});e3.displayName=U9e;var G9e="DismissableLayerBranch",K9e=x.forwardRef((t,e)=>{const n=x.useContext(Ahe),r=x.useRef(null),i=Jt(e,r);return x.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),m.jsx(xt.div,{...t,ref:i})});K9e.displayName=G9e;function Y9e(t,e=globalThis==null?void 0:globalThis.document){const n=ds(t),r=x.useRef(!1),i=x.useRef(()=>{});return x.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){Ihe(q9e,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function Z9e(t,e=globalThis==null?void 0:globalThis.document){const n=ds(t),r=x.useRef(!1);return x.useEffect(()=>{const i=s=>{s.target&&!r.current&&Ihe(W9e,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function jZ(){const t=new CustomEvent(oL);document.dispatchEvent(t)}function Ihe(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?Che(i,s):i.dispatchEvent(s)}var lN="focusScope.autoFocusOnMount",cN="focusScope.autoFocusOnUnmount",BZ={bubbles:!1,cancelable:!0},X9e="FocusScope",x9=x.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=x.useState(null),c=ds(i),u=ds(s),d=x.useRef(null),h=Jt(e,g=>l(g)),f=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let g=function(_){if(f.paused||!a)return;const S=_.target;a.contains(S)?d.current=S:np(d.current,{select:!0})},y=function(_){if(f.paused||!a)return;const S=_.relatedTarget;S!==null&&(a.contains(S)||np(d.current,{select:!0}))},v=function(_){if(document.activeElement===document.body)for(const k of _)k.removedNodes.length>0&&np(a)};document.addEventListener("focusin",g),document.addEventListener("focusout",y);const b=new MutationObserver(v);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",y),b.disconnect()}}},[r,a,f.paused]),x.useEffect(()=>{if(a){VZ.add(f);const g=document.activeElement;if(!a.contains(g)){const v=new CustomEvent(lN,BZ);a.addEventListener(lN,c),a.dispatchEvent(v),v.defaultPrevented||(Q9e(rIe(Rhe(a)),{select:!0}),document.activeElement===g&&np(a))}return()=>{a.removeEventListener(lN,c),setTimeout(()=>{const v=new CustomEvent(cN,BZ);a.addEventListener(cN,u),a.dispatchEvent(v),v.defaultPrevented||np(g??document.body,{select:!0}),a.removeEventListener(cN,u),VZ.remove(f)},0)}}},[a,c,u,f]);const p=x.useCallback(g=>{if(!n&&!r||f.paused)return;const y=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,v=document.activeElement;if(y&&v){const b=g.currentTarget,[_,S]=J9e(b);_&&S?!g.shiftKey&&v===S?(g.preventDefault(),n&&np(_,{select:!0})):g.shiftKey&&v===_&&(g.preventDefault(),n&&np(S,{select:!0})):v===b&&g.preventDefault()}},[n,r,f.paused]);return m.jsx(xt.div,{tabIndex:-1,...o,ref:h,onKeyDown:p})});x9.displayName=X9e;function Q9e(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(np(r,{select:e}),document.activeElement!==n)return}function J9e(t){const e=Rhe(t),n=FZ(e,t),r=FZ(e.reverse(),t);return[n,r]}function Rhe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function FZ(t,e){for(const n of t)if(!eIe(n,{upTo:e}))return n}function eIe(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function tIe(t){return t instanceof HTMLInputElement&&"select"in t}function np(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&tIe(t)&&e&&t.select()}}var VZ=nIe();function nIe(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=$Z(t,e),t.unshift(e)},remove(e){var n;t=$Z(t,e),(n=t[0])==null||n.resume()}}}function $Z(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function rIe(t){return t.filter(e=>e.tagName!=="A")}var iIe="Portal",t3=x.forwardRef((t,e)=>{var a;const{container:n,...r}=t,[i,s]=x.useState(!1);zi(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?gce.createPortal(m.jsx(xt.div,{...r,ref:e}),o):null});t3.displayName=iIe;var uN=0;function UV(){x.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??HZ()),document.body.insertAdjacentElement("beforeend",t[1]??HZ()),uN++,()=>{uN===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),uN--}},[])}function HZ(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Bu=function(){return Bu=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Bu.apply(this,arguments)};function Mhe(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function sIe(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}var FT="right-scroll-bar-position",VT="width-before-scroll-bar",oIe="with-scroll-bars-hidden",aIe="--removed-body-scroll-bar-size";function dN(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function lIe(t,e){var n=x.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=e,n.facade}var cIe=typeof window<"u"?x.useLayoutEffect:x.useEffect,UZ=new WeakMap;function uIe(t,e){var n=lIe(null,function(r){return t.forEach(function(i){return dN(i,r)})});return cIe(function(){var r=UZ.get(n);if(r){var i=new Set(r),s=new Set(t),o=n.current;i.forEach(function(a){s.has(a)||dN(a,null)}),s.forEach(function(a){i.has(a)||dN(a,o)})}UZ.set(n,t)},[t]),n}function dIe(t){return t}function hIe(t,e){e===void 0&&(e=dIe);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(s){var o=e(s,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(r=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(s),o=n}var l=function(){var u=o;o=[],u.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){o.push(u),c()},filter:function(u){return o=o.filter(u),n}}}};return i}function fIe(t){t===void 0&&(t={});var e=hIe(null);return e.options=Bu({async:!0,ssr:!1},t),e}var Nhe=function(t){var e=t.sideCar,n=Mhe(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return x.createElement(r,Bu({},n))};Nhe.isSideCarExport=!0;function pIe(t,e){return t.useMedium(e),Nhe}var Ohe=fIe(),hN=function(){},_9=x.forwardRef(function(t,e){var n=x.useRef(null),r=x.useState({onScrollCapture:hN,onWheelCapture:hN,onTouchMoveCapture:hN}),i=r[0],s=r[1],o=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,u=t.enabled,d=t.shards,h=t.sideCar,f=t.noRelative,p=t.noIsolation,g=t.inert,y=t.allowPinchZoom,v=t.as,b=v===void 0?"div":v,_=t.gapMode,S=Mhe(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=h,T=uIe([n,e]),E=Bu(Bu({},S),i);return x.createElement(x.Fragment,null,u&&x.createElement(k,{sideCar:Ohe,removeScrollBar:c,shards:d,noRelative:f,noIsolation:p,inert:g,setCallbacks:s,allowPinchZoom:!!y,lockRef:n,gapMode:_}),o?x.cloneElement(x.Children.only(a),Bu(Bu({},E),{ref:T})):x.createElement(b,Bu({},E,{className:l,ref:T}),a))});_9.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};_9.classNames={fullWidth:VT,zeroRight:FT};var mIe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function gIe(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=mIe();return e&&t.setAttribute("nonce",e),t}function yIe(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function vIe(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var bIe=function(){var t=0,e=null;return{add:function(n){t==0&&(e=gIe())&&(yIe(e,n),vIe(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},wIe=function(){var t=bIe();return function(e,n){x.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},Dhe=function(){var t=wIe(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},xIe={left:0,top:0,right:0,gap:0},fN=function(t){return parseInt(t||"",10)||0},_Ie=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[fN(n),fN(r),fN(i)]},SIe=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return xIe;var e=_Ie(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},kIe=Dhe(),Jv="data-scroll-locked",CIe=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),`
|
||
.`.concat(oIe,` {
|
||
overflow: hidden `).concat(r,`;
|
||
padding-right: `).concat(a,"px ").concat(r,`;
|
||
}
|
||
body[`).concat(Jv,`] {
|
||
overflow: hidden `).concat(r,`;
|
||
overscroll-behavior: contain;
|
||
`).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
|
||
padding-left: `.concat(i,`px;
|
||
padding-top: `).concat(s,`px;
|
||
padding-right: `).concat(o,`px;
|
||
margin-left:0;
|
||
margin-top:0;
|
||
margin-right: `).concat(a,"px ").concat(r,`;
|
||
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
|
||
}
|
||
|
||
.`).concat(FT,` {
|
||
right: `).concat(a,"px ").concat(r,`;
|
||
}
|
||
|
||
.`).concat(VT,` {
|
||
margin-right: `).concat(a,"px ").concat(r,`;
|
||
}
|
||
|
||
.`).concat(FT," .").concat(FT,` {
|
||
right: 0 `).concat(r,`;
|
||
}
|
||
|
||
.`).concat(VT," .").concat(VT,` {
|
||
margin-right: 0 `).concat(r,`;
|
||
}
|
||
|
||
body[`).concat(Jv,`] {
|
||
`).concat(aIe,": ").concat(a,`px;
|
||
}
|
||
`)},qZ=function(){var t=parseInt(document.body.getAttribute(Jv)||"0",10);return isFinite(t)?t:0},EIe=function(){x.useEffect(function(){return document.body.setAttribute(Jv,(qZ()+1).toString()),function(){var t=qZ()-1;t<=0?document.body.removeAttribute(Jv):document.body.setAttribute(Jv,t.toString())}},[])},TIe=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;EIe();var s=x.useMemo(function(){return SIe(i)},[i]);return x.createElement(kIe,{styles:CIe(s,!e,i,n?"":"!important")})},aL=!1;if(typeof window<"u")try{var KC=Object.defineProperty({},"passive",{get:function(){return aL=!0,!0}});window.addEventListener("test",KC,KC),window.removeEventListener("test",KC,KC)}catch{aL=!1}var Uy=aL?{passive:!1}:!1,AIe=function(t){return t.tagName==="TEXTAREA"},Phe=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!AIe(t)&&n[e]==="visible")},IIe=function(t){return Phe(t,"overflowY")},RIe=function(t){return Phe(t,"overflowX")},WZ=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=Lhe(t,r);if(i){var s=zhe(t,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},MIe=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},NIe=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},Lhe=function(t,e){return t==="v"?IIe(e):RIe(e)},zhe=function(t,e){return t==="v"?MIe(e):NIe(e)},OIe=function(t,e){return t==="h"&&e==="rtl"?-1:1},DIe=function(t,e,n,r,i){var s=OIe(t,window.getComputedStyle(e).direction),o=s*r,a=n.target,l=e.contains(a),c=!1,u=o>0,d=0,h=0;do{if(!a)break;var f=zhe(t,a),p=f[0],g=f[1],y=f[2],v=g-y-s*p;(p||v)&&Lhe(t,a)&&(d+=v,h+=p);var b=a.parentNode;a=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(u&&Math.abs(d)<1||!u&&Math.abs(h)<1)&&(c=!0),c},YC=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},GZ=function(t){return[t.deltaX,t.deltaY]},KZ=function(t){return t&&"current"in t?t.current:t},PIe=function(t,e){return t[0]===e[0]&&t[1]===e[1]},LIe=function(t){return`
|
||
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
||
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
||
`)},zIe=0,qy=[];function jIe(t){var e=x.useRef([]),n=x.useRef([0,0]),r=x.useRef(),i=x.useState(zIe++)[0],s=x.useState(Dhe)[0],o=x.useRef(t);x.useEffect(function(){o.current=t},[t]),x.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var g=sIe([t.lockRef.current],(t.shards||[]).map(KZ),!0).filter(Boolean);return g.forEach(function(y){return y.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),g.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=x.useCallback(function(g,y){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!o.current.allowPinchZoom;var v=YC(g),b=n.current,_="deltaX"in g?g.deltaX:b[0]-v[0],S="deltaY"in g?g.deltaY:b[1]-v[1],k,T=g.target,E=Math.abs(_)>Math.abs(S)?"h":"v";if("touches"in g&&E==="h"&&T.type==="range")return!1;var C=window.getSelection(),R=C&&C.anchorNode,M=R?R===T||R.contains(T):!1;if(M)return!1;var D=WZ(E,T);if(!D)return!0;if(D?k=E:(k=E==="v"?"h":"v",D=WZ(E,T)),!D)return!1;if(!r.current&&"changedTouches"in g&&(_||S)&&(r.current=k),!k)return!0;var P=r.current||k;return DIe(P,y,g,P==="h"?_:S)},[]),l=x.useCallback(function(g){var y=g;if(!(!qy.length||qy[qy.length-1]!==s)){var v="deltaY"in y?GZ(y):YC(y),b=e.current.filter(function(k){return k.name===y.type&&(k.target===y.target||y.target===k.shadowParent)&&PIe(k.delta,v)})[0];if(b&&b.should){y.cancelable&&y.preventDefault();return}if(!b){var _=(o.current.shards||[]).map(KZ).filter(Boolean).filter(function(k){return k.contains(y.target)}),S=_.length>0?a(y,_[0]):!o.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),c=x.useCallback(function(g,y,v,b){var _={name:g,delta:y,target:v,should:b,shadowParent:BIe(v)};e.current.push(_),setTimeout(function(){e.current=e.current.filter(function(S){return S!==_})},1)},[]),u=x.useCallback(function(g){n.current=YC(g),r.current=void 0},[]),d=x.useCallback(function(g){c(g.type,GZ(g),g.target,a(g,t.lockRef.current))},[]),h=x.useCallback(function(g){c(g.type,YC(g),g.target,a(g,t.lockRef.current))},[]);x.useEffect(function(){return qy.push(s),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",l,Uy),document.addEventListener("touchmove",l,Uy),document.addEventListener("touchstart",u,Uy),function(){qy=qy.filter(function(g){return g!==s}),document.removeEventListener("wheel",l,Uy),document.removeEventListener("touchmove",l,Uy),document.removeEventListener("touchstart",u,Uy)}},[]);var f=t.removeScrollBar,p=t.inert;return x.createElement(x.Fragment,null,p?x.createElement(s,{styles:LIe(i)}):null,f?x.createElement(TIe,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function BIe(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const FIe=pIe(Ohe,jIe);var S9=x.forwardRef(function(t,e){return x.createElement(_9,Bu({},t,{ref:e,sideCar:FIe}))});S9.classNames=_9.classNames;var VIe=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Wy=new WeakMap,ZC=new WeakMap,XC={},pN=0,jhe=function(t){return t&&(t.host||jhe(t.parentNode))},$Ie=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=jhe(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},HIe=function(t,e,n,r){var i=$Ie(e,Array.isArray(t)?t:[t]);XC[n]||(XC[n]=new WeakMap);var s=XC[n],o=[],a=new Set,l=new Set(i),c=function(d){!d||a.has(d)||(a.add(d),c(d.parentNode))};i.forEach(c);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(h){if(a.has(h))u(h);else try{var f=h.getAttribute(r),p=f!==null&&f!=="false",g=(Wy.get(h)||0)+1,y=(s.get(h)||0)+1;Wy.set(h,g),s.set(h,y),o.push(h),g===1&&p&&ZC.set(h,!0),y===1&&h.setAttribute(n,"true"),p||h.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",h,v)}})};return u(e),a.clear(),pN++,function(){o.forEach(function(d){var h=Wy.get(d)-1,f=s.get(d)-1;Wy.set(d,h),s.set(d,f),h||(ZC.has(d)||d.removeAttribute(r),ZC.delete(d)),f||d.removeAttribute(n)}),pN--,pN||(Wy=new WeakMap,Wy=new WeakMap,ZC=new WeakMap,XC={})}},qV=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=VIe(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),HIe(r,i,n,"aria-hidden")):function(){return null}},k9="Dialog",[Bhe]=ao(k9),[UIe,iu]=Bhe(k9),Fhe=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=x.useRef(null),l=x.useRef(null),[c,u]=gd({prop:r,defaultProp:i??!1,onChange:s,caller:k9});return m.jsx(UIe,{scope:e,triggerRef:a,contentRef:l,contentId:zc(),titleId:zc(),descriptionId:zc(),open:c,onOpenChange:u,onOpenToggle:x.useCallback(()=>u(d=>!d),[u]),modal:o,children:n})};Fhe.displayName=k9;var Vhe="DialogTrigger",qIe=x.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=iu(Vhe,n),s=Jt(e,i.triggerRef);return m.jsx(xt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":KV(i.open),...r,ref:s,onClick:et(t.onClick,i.onOpenToggle)})});qIe.displayName=Vhe;var WV="DialogPortal",[WIe,$he]=Bhe(WV,{forceMount:void 0}),Hhe=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=iu(WV,e);return m.jsx(WIe,{scope:e,forceMount:n,children:x.Children.map(r,o=>m.jsx(Fs,{present:n||s.open,children:m.jsx(t3,{asChild:!0,container:i,children:o})}))})};Hhe.displayName=WV;var KA="DialogOverlay",Uhe=x.forwardRef((t,e)=>{const n=$he(KA,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=iu(KA,t.__scopeDialog);return s.modal?m.jsx(Fs,{present:r||s.open,children:m.jsx(KIe,{...i,ref:e})}):null});Uhe.displayName=KA;var GIe=O1("DialogOverlay.RemoveScroll"),KIe=x.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=iu(KA,n);return m.jsx(S9,{as:GIe,allowPinchZoom:!0,shards:[i.contentRef],children:m.jsx(xt.div,{"data-state":KV(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),D1="DialogContent",qhe=x.forwardRef((t,e)=>{const n=$he(D1,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=iu(D1,t.__scopeDialog);return m.jsx(Fs,{present:r||s.open,children:s.modal?m.jsx(YIe,{...i,ref:e}):m.jsx(ZIe,{...i,ref:e})})});qhe.displayName=D1;var YIe=x.forwardRef((t,e)=>{const n=iu(D1,t.__scopeDialog),r=x.useRef(null),i=Jt(e,n.contentRef,r);return x.useEffect(()=>{const s=r.current;if(s)return qV(s)},[]),m.jsx(Whe,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:et(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:et(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:et(t.onFocusOutside,s=>s.preventDefault())})}),ZIe=x.forwardRef((t,e)=>{const n=iu(D1,t.__scopeDialog),r=x.useRef(!1),i=x.useRef(!1);return m.jsx(Whe,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),Whe=x.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=iu(D1,n),l=x.useRef(null),c=Jt(e,l);return UV(),m.jsxs(m.Fragment,{children:[m.jsx(x9,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:m.jsx(e3,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":KV(a.open),...o,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),m.jsxs(m.Fragment,{children:[m.jsx(XIe,{titleId:a.titleId}),m.jsx(JIe,{contentRef:l,descriptionId:a.descriptionId})]})]})}),GV="DialogTitle",Ghe=x.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=iu(GV,n);return m.jsx(xt.h2,{id:i.titleId,...r,ref:e})});Ghe.displayName=GV;var Khe="DialogDescription",Yhe=x.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=iu(Khe,n);return m.jsx(xt.p,{id:i.descriptionId,...r,ref:e})});Yhe.displayName=Khe;var Zhe="DialogClose",Xhe=x.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=iu(Zhe,n);return m.jsx(xt.button,{type:"button",...r,ref:e,onClick:et(t.onClick,()=>i.onOpenChange(!1))})});Xhe.displayName=Zhe;function KV(t){return t?"open":"closed"}var Qhe="DialogTitleWarning",[dRt,Jhe]=N9e(Qhe,{contentName:D1,titleName:GV,docsSlug:"dialog"}),XIe=({titleId:t})=>{const e=Jhe(Qhe),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
||
|
||
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
||
|
||
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return x.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},QIe="DialogDescriptionWarning",JIe=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Jhe(QIe).contentName}}.`;return x.useEffect(()=>{var s;const i=(s=t.current)==null?void 0:s.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},efe=Fhe,tfe=Hhe,nfe=Uhe,rfe=qhe,ife=Ghe,eRe=Yhe,YV=Xhe,sfe={exports:{}},ofe={};/**
|
||
* @license React
|
||
* use-sync-external-store-shim.production.js
|
||
*
|
||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var jw=x;function tRe(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var nRe=typeof Object.is=="function"?Object.is:tRe,rRe=jw.useState,iRe=jw.useEffect,sRe=jw.useLayoutEffect,oRe=jw.useDebugValue;function aRe(t,e){var n=e(),r=rRe({inst:{value:n,getSnapshot:e}}),i=r[0].inst,s=r[1];return sRe(function(){i.value=n,i.getSnapshot=e,mN(i)&&s({inst:i})},[t,n,e]),iRe(function(){return mN(i)&&s({inst:i}),t(function(){mN(i)&&s({inst:i})})},[t]),oRe(n),n}function mN(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!nRe(t,n)}catch{return!0}}function lRe(t,e){return e()}var cRe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?lRe:aRe;ofe.useSyncExternalStore=jw.useSyncExternalStore!==void 0?jw.useSyncExternalStore:cRe;sfe.exports=ofe;var uRe=sfe.exports;function dRe(){return uRe.useSyncExternalStore(hRe,()=>!0,()=>!1)}function hRe(){return()=>{}}var ZV="Avatar",[fRe]=ao(ZV),[pRe,afe]=fRe(ZV),lfe=x.forwardRef((t,e)=>{const{__scopeAvatar:n,...r}=t,[i,s]=x.useState("idle");return m.jsx(pRe,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:s,children:m.jsx(xt.span,{...r,ref:e})})});lfe.displayName=ZV;var cfe="AvatarImage",ufe=x.forwardRef((t,e)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...s}=t,o=afe(cfe,n),a=mRe(r,s),l=ds(c=>{i(c),o.onImageLoadingStatusChange(c)});return zi(()=>{a!=="idle"&&l(a)},[a,l]),a==="loaded"?m.jsx(xt.img,{...s,ref:e,src:r}):null});ufe.displayName=cfe;var dfe="AvatarFallback",hfe=x.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:r,...i}=t,s=afe(dfe,n),[o,a]=x.useState(r===void 0);return x.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>a(!0),r);return()=>window.clearTimeout(l)}},[r]),o&&s.imageLoadingStatus!=="loaded"?m.jsx(xt.span,{...i,ref:e}):null});hfe.displayName=dfe;function YZ(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function mRe(t,{referrerPolicy:e,crossOrigin:n}){const r=dRe(),i=x.useRef(null),s=r?(i.current||(i.current=new window.Image),i.current):null,[o,a]=x.useState(()=>YZ(s,t));return zi(()=>{a(YZ(s,t))},[s,t]),zi(()=>{const l=d=>()=>{a(d)};if(!s)return;const c=l("loaded"),u=l("error");return s.addEventListener("load",c),s.addEventListener("error",u),e&&(s.referrerPolicy=e),typeof n=="string"&&(s.crossOrigin=n),()=>{s.removeEventListener("load",c),s.removeEventListener("error",u)}},[s,n,e]),o}var gRe=lfe,yRe=ufe,vRe=hfe;function C9(t){const e=x.useRef({value:t,previous:t});return x.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function E9(t){const[e,n]=x.useState(void 0);return zi(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=t.offsetWidth,a=t.offsetHeight;n({width:o,height:a})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var T9="Checkbox",[bRe]=ao(T9),[wRe,XV]=bRe(T9);function xRe(t){const{__scopeCheckbox:e,checked:n,children:r,defaultChecked:i,disabled:s,form:o,name:a,onCheckedChange:l,required:c,value:u="on",internal_do_not_use_render:d}=t,[h,f]=gd({prop:n,defaultProp:i??!1,onChange:l,caller:T9}),[p,g]=x.useState(null),[y,v]=x.useState(null),b=x.useRef(!1),_=p?!!o||!!p.closest("form"):!0,S={checked:h,disabled:s,setChecked:f,control:p,setControl:g,name:a,form:o,value:u,hasConsumerStoppedPropagationRef:b,required:c,defaultChecked:mm(i)?!1:i,isFormControl:_,bubbleInput:y,setBubbleInput:v};return m.jsx(wRe,{scope:e,...S,children:_Re(d)?d(S):r})}var ffe="CheckboxTrigger",pfe=x.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:n,...r},i)=>{const{control:s,value:o,disabled:a,checked:l,required:c,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:h,isFormControl:f,bubbleInput:p}=XV(ffe,t),g=Jt(i,u),y=x.useRef(l);return x.useEffect(()=>{const v=s==null?void 0:s.form;if(v){const b=()=>d(y.current);return v.addEventListener("reset",b),()=>v.removeEventListener("reset",b)}},[s,d]),m.jsx(xt.button,{type:"button",role:"checkbox","aria-checked":mm(l)?"mixed":l,"aria-required":c,"data-state":wfe(l),"data-disabled":a?"":void 0,disabled:a,value:o,...r,ref:g,onKeyDown:et(e,v=>{v.key==="Enter"&&v.preventDefault()}),onClick:et(n,v=>{d(b=>mm(b)?!0:!b),p&&f&&(h.current=v.isPropagationStopped(),h.current||v.stopPropagation())})})});pfe.displayName=ffe;var mfe=x.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:s,required:o,disabled:a,value:l,onCheckedChange:c,form:u,...d}=t;return m.jsx(xRe,{__scopeCheckbox:n,checked:i,defaultChecked:s,disabled:a,required:o,onCheckedChange:c,name:r,form:u,value:l,internal_do_not_use_render:({isFormControl:h})=>m.jsxs(m.Fragment,{children:[m.jsx(pfe,{...d,ref:e,__scopeCheckbox:n}),h&&m.jsx(bfe,{__scopeCheckbox:n})]})})});mfe.displayName=T9;var gfe="CheckboxIndicator",yfe=x.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:r,...i}=t,s=XV(gfe,n);return m.jsx(Fs,{present:r||mm(s.checked)||s.checked===!0,children:m.jsx(xt.span,{"data-state":wfe(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:e,style:{pointerEvents:"none",...t.style}})})});yfe.displayName=gfe;var vfe="CheckboxBubbleInput",bfe=x.forwardRef(({__scopeCheckbox:t,...e},n)=>{const{control:r,hasConsumerStoppedPropagationRef:i,checked:s,defaultChecked:o,required:a,disabled:l,name:c,value:u,form:d,bubbleInput:h,setBubbleInput:f}=XV(vfe,t),p=Jt(n,f),g=C9(s),y=E9(r);x.useEffect(()=>{const b=h;if(!b)return;const _=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(_,"checked").set,T=!i.current;if(g!==s&&k){const E=new Event("click",{bubbles:T});b.indeterminate=mm(s),k.call(b,mm(s)?!1:s),b.dispatchEvent(E)}},[h,g,s,i]);const v=x.useRef(mm(s)?!1:s);return m.jsx(xt.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??v.current,required:a,disabled:l,name:c,value:u,form:d,...e,tabIndex:-1,ref:p,style:{...e.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});bfe.displayName=vfe;function _Re(t){return typeof t=="function"}function mm(t){return t==="indeterminate"}function wfe(t){return mm(t)?"indeterminate":t?"checked":"unchecked"}const SRe=["top","right","bottom","left"],Om=Math.min,ja=Math.max,YA=Math.round,QC=Math.floor,rd=t=>({x:t,y:t}),kRe={left:"right",right:"left",bottom:"top",top:"bottom"},CRe={start:"end",end:"start"};function lL(t,e,n){return ja(t,Om(e,n))}function nf(t,e){return typeof t=="function"?t(e):t}function rf(t){return t.split("-")[0]}function Fx(t){return t.split("-")[1]}function QV(t){return t==="x"?"y":"x"}function JV(t){return t==="y"?"height":"width"}const ERe=new Set(["top","bottom"]);function Ku(t){return ERe.has(rf(t))?"y":"x"}function e$(t){return QV(Ku(t))}function TRe(t,e,n){n===void 0&&(n=!1);const r=Fx(t),i=e$(t),s=JV(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=ZA(o)),[o,ZA(o)]}function ARe(t){const e=ZA(t);return[cL(t),e,cL(e)]}function cL(t){return t.replace(/start|end/g,e=>CRe[e])}const ZZ=["left","right"],XZ=["right","left"],IRe=["top","bottom"],RRe=["bottom","top"];function MRe(t,e,n){switch(t){case"top":case"bottom":return n?e?XZ:ZZ:e?ZZ:XZ;case"left":case"right":return e?IRe:RRe;default:return[]}}function NRe(t,e,n,r){const i=Fx(t);let s=MRe(rf(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(cL)))),s}function ZA(t){return t.replace(/left|right|bottom|top/g,e=>kRe[e])}function ORe(t){return{top:0,right:0,bottom:0,left:0,...t}}function xfe(t){return typeof t!="number"?ORe(t):{top:t,right:t,bottom:t,left:t}}function XA(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function QZ(t,e,n){let{reference:r,floating:i}=t;const s=Ku(e),o=e$(e),a=JV(o),l=rf(e),c=s==="y",u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let f;switch(l){case"top":f={x:u,y:r.y-i.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-i.width,y:d};break;default:f={x:r.x,y:r.y}}switch(Fx(e)){case"start":f[o]-=h*(n&&c?-1:1);break;case"end":f[o]+=h*(n&&c?-1:1);break}return f}async function DRe(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:f=0}=nf(e,t),p=xfe(f),y=a[h?d==="floating"?"reference":"floating":d],v=XA(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),b=d==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),S=await(s.isElement==null?void 0:s.isElement(_))?await(s.getScale==null?void 0:s.getScale(_))||{x:1,y:1}:{x:1,y:1},k=XA(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:_,strategy:l}):b);return{top:(v.top-k.top+p.top)/S.y,bottom:(k.bottom-v.bottom+p.bottom)/S.y,left:(v.left-k.left+p.left)/S.x,right:(k.right-v.right+p.right)/S.x}}const PRe=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:d}=QZ(c,r,l),h=r,f={},p=0;for(let y=0;y<a.length;y++){var g;const{name:v,fn:b}=a[y],{x:_,y:S,data:k,reset:T}=await b({x:u,y:d,initialPlacement:r,placement:h,strategy:i,middlewareData:f,rects:c,platform:{...o,detectOverflow:(g=o.detectOverflow)!=null?g:DRe},elements:{reference:t,floating:e}});u=_??u,d=S??d,f={...f,[v]:{...f[v],...k}},T&&p<=50&&(p++,typeof T=="object"&&(T.placement&&(h=T.placement),T.rects&&(c=T.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):T.rects),{x:u,y:d}=QZ(c,h,l)),y=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:f}},LRe=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=nf(t,e)||{};if(c==null)return{};const d=xfe(u),h={x:n,y:r},f=e$(i),p=JV(f),g=await o.getDimensions(c),y=f==="y",v=y?"top":"left",b=y?"bottom":"right",_=y?"clientHeight":"clientWidth",S=s.reference[p]+s.reference[f]-h[f]-s.floating[p],k=h[f]-s.reference[f],T=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let E=T?T[_]:0;(!E||!await(o.isElement==null?void 0:o.isElement(T)))&&(E=a.floating[_]||s.floating[p]);const C=S/2-k/2,R=E/2-g[p]/2-1,M=Om(d[v],R),D=Om(d[b],R),P=M,z=E-g[p]-D,Z=E/2-g[p]/2+C,re=lL(P,Z,z),G=!l.arrow&&Fx(i)!=null&&Z!==re&&s.reference[p]/2-(Z<P?M:D)-g[p]/2<0,ee=G?Z<P?Z-P:Z-z:0;return{[f]:h[f]+ee,data:{[f]:re,centerOffset:Z-re-ee,...G&&{alignmentOffset:ee}},reset:G}}}),zRe=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...y}=nf(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const v=rf(i),b=Ku(a),_=rf(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),k=h||(_||!g?[ZA(a)]:ARe(a)),T=p!=="none";!h&&T&&k.push(...NRe(a,g,p,S));const E=[a,...k],C=await l.detectOverflow(e,y),R=[];let M=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&R.push(C[v]),d){const Z=TRe(i,o,S);R.push(C[Z[0]],C[Z[1]])}if(M=[...M,{placement:i,overflows:R}],!R.every(Z=>Z<=0)){var D,P;const Z=(((D=s.flip)==null?void 0:D.index)||0)+1,re=E[Z];if(re&&(!(d==="alignment"?b!==Ku(re):!1)||M.every(J=>Ku(J.placement)===b?J.overflows[0]>0:!0)))return{data:{index:Z,overflows:M},reset:{placement:re}};let G=(P=M.filter(ee=>ee.overflows[0]<=0).sort((ee,J)=>ee.overflows[1]-J.overflows[1])[0])==null?void 0:P.placement;if(!G)switch(f){case"bestFit":{var z;const ee=(z=M.filter(J=>{if(T){const oe=Ku(J.placement);return oe===b||oe==="y"}return!0}).map(J=>[J.placement,J.overflows.filter(oe=>oe>0).reduce((oe,B)=>oe+B,0)]).sort((J,oe)=>J[1]-oe[1])[0])==null?void 0:z[0];ee&&(G=ee);break}case"initialPlacement":G=a;break}if(i!==G)return{reset:{placement:G}}}return{}}}};function JZ(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function eX(t){return SRe.some(e=>t[e]>=0)}const jRe=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...s}=nf(t,e);switch(i){case"referenceHidden":{const o=await r.detectOverflow(e,{...s,elementContext:"reference"}),a=JZ(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:eX(a)}}}case"escaped":{const o=await r.detectOverflow(e,{...s,altBoundary:!0}),a=JZ(o,n.floating);return{data:{escapedOffsets:a,escaped:eX(a)}}}default:return{}}}}},_fe=new Set(["left","top"]);async function BRe(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=rf(n),a=Fx(n),l=Ku(n)==="y",c=_fe.has(o)?-1:1,u=s&&l?-1:1,d=nf(e,t);let{mainAxis:h,crossAxis:f,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof p=="number"&&(f=a==="end"?p*-1:p),l?{x:f*u,y:h*c}:{x:h*c,y:f*u}}const FRe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=e,l=await BRe(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},VRe=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i,platform:s}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:v=>{let{x:b,y:_}=v;return{x:b,y:_}}},...c}=nf(t,e),u={x:n,y:r},d=await s.detectOverflow(e,c),h=Ku(rf(i)),f=QV(h);let p=u[f],g=u[h];if(o){const v=f==="y"?"top":"left",b=f==="y"?"bottom":"right",_=p+d[v],S=p-d[b];p=lL(_,p,S)}if(a){const v=h==="y"?"top":"left",b=h==="y"?"bottom":"right",_=g+d[v],S=g-d[b];g=lL(_,g,S)}const y=l.fn({...e,[f]:p,[h]:g});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[f]:o,[h]:a}}}}}},$Re=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=nf(t,e),u={x:n,y:r},d=Ku(i),h=QV(d);let f=u[h],p=u[d];const g=nf(a,e),y=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const _=h==="y"?"height":"width",S=s.reference[h]-s.floating[_]+y.mainAxis,k=s.reference[h]+s.reference[_]-y.mainAxis;f<S?f=S:f>k&&(f=k)}if(c){var v,b;const _=h==="y"?"width":"height",S=_fe.has(rf(i)),k=s.reference[d]-s.floating[_]+(S&&((v=o.offset)==null?void 0:v[d])||0)+(S?0:y.crossAxis),T=s.reference[d]+s.reference[_]+(S?0:((b=o.offset)==null?void 0:b[d])||0)-(S?y.crossAxis:0);p<k?p=k:p>T&&(p=T)}return{[h]:f,[d]:p}}}},HRe=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:s,platform:o,elements:a}=e,{apply:l=()=>{},...c}=nf(t,e),u=await o.detectOverflow(e,c),d=rf(i),h=Fx(i),f=Ku(i)==="y",{width:p,height:g}=s.floating;let y,v;d==="top"||d==="bottom"?(y=d,v=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(v=d,y=h==="end"?"top":"bottom");const b=g-u.top-u.bottom,_=p-u.left-u.right,S=Om(g-u[y],b),k=Om(p-u[v],_),T=!e.middlewareData.shift;let E=S,C=k;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(C=_),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(E=b),T&&!h){const M=ja(u.left,0),D=ja(u.right,0),P=ja(u.top,0),z=ja(u.bottom,0);f?C=p-2*(M!==0||D!==0?M+D:ja(u.left,u.right)):E=g-2*(P!==0||z!==0?P+z:ja(u.top,u.bottom))}await l({...e,availableWidth:C,availableHeight:E});const R=await o.getDimensions(a.floating);return p!==R.width||g!==R.height?{reset:{rects:!0}}:{}}}};function A9(){return typeof window<"u"}function Vx(t){return Sfe(t)?(t.nodeName||"").toLowerCase():"#document"}function Xa(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Td(t){var e;return(e=(Sfe(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Sfe(t){return A9()?t instanceof Node||t instanceof Xa(t).Node:!1}function Gc(t){return A9()?t instanceof Element||t instanceof Xa(t).Element:!1}function yd(t){return A9()?t instanceof HTMLElement||t instanceof Xa(t).HTMLElement:!1}function tX(t){return!A9()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Xa(t).ShadowRoot}const URe=new Set(["inline","contents"]);function n3(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=Kc(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!URe.has(i)}const qRe=new Set(["table","td","th"]);function WRe(t){return qRe.has(Vx(t))}const GRe=[":popover-open",":modal"];function I9(t){return GRe.some(e=>{try{return t.matches(e)}catch{return!1}})}const KRe=["transform","translate","scale","rotate","perspective"],YRe=["transform","translate","scale","rotate","perspective","filter"],ZRe=["paint","layout","strict","content"];function t$(t){const e=n$(),n=Gc(t)?Kc(t):t;return KRe.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||YRe.some(r=>(n.willChange||"").includes(r))||ZRe.some(r=>(n.contain||"").includes(r))}function XRe(t){let e=Dm(t);for(;yd(e)&&!Bw(e);){if(t$(e))return e;if(I9(e))return null;e=Dm(e)}return null}function n$(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const QRe=new Set(["html","body","#document"]);function Bw(t){return QRe.has(Vx(t))}function Kc(t){return Xa(t).getComputedStyle(t)}function R9(t){return Gc(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Dm(t){if(Vx(t)==="html")return t;const e=t.assignedSlot||t.parentNode||tX(t)&&t.host||Td(t);return tX(e)?e.host:e}function kfe(t){const e=Dm(t);return Bw(e)?t.ownerDocument?t.ownerDocument.body:t.body:yd(e)&&n3(e)?e:kfe(e)}function RS(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=kfe(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=Xa(i);if(s){const a=uL(o);return e.concat(o,o.visualViewport||[],n3(i)?i:[],a&&n?RS(a):[])}return e.concat(i,RS(i,[],n))}function uL(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Cfe(t){const e=Kc(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=yd(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,a=YA(n)!==s||YA(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function r$(t){return Gc(t)?t:t.contextElement}function eb(t){const e=r$(t);if(!yd(e))return rd(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=Cfe(e);let o=(s?YA(n.width):n.width)/r,a=(s?YA(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const JRe=rd(0);function Efe(t){const e=Xa(t);return!n$()||!e.visualViewport?JRe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function eMe(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Xa(t)?!1:e}function P1(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=r$(t);let o=rd(1);e&&(r?Gc(r)&&(o=eb(r)):o=eb(t));const a=eMe(s,n,r)?Efe(s):rd(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(s){const h=Xa(s),f=r&&Gc(r)?Xa(r):r;let p=h,g=uL(p);for(;g&&r&&f!==p;){const y=eb(g),v=g.getBoundingClientRect(),b=Kc(g),_=v.left+(g.clientLeft+parseFloat(b.paddingLeft))*y.x,S=v.top+(g.clientTop+parseFloat(b.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,d*=y.y,l+=_,c+=S,p=Xa(g),g=uL(p)}}return XA({width:u,height:d,x:l,y:c})}function M9(t,e){const n=R9(t).scrollLeft;return e?e.left+n:P1(Td(t)).left+n}function Tfe(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-M9(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function tMe(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=Td(r),a=e?I9(e.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=rd(1);const u=rd(0),d=yd(r);if((d||!d&&!s)&&((Vx(r)!=="body"||n3(o))&&(l=R9(r)),yd(r))){const f=P1(r);c=eb(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}const h=o&&!d&&!s?Tfe(o,l):rd(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function nMe(t){return Array.from(t.getClientRects())}function rMe(t){const e=Td(t),n=R9(t),r=t.ownerDocument.body,i=ja(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=ja(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+M9(t);const a=-n.scrollTop;return Kc(r).direction==="rtl"&&(o+=ja(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const nX=25;function iMe(t,e){const n=Xa(t),r=Td(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const u=n$();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=M9(r);if(c<=0){const u=r.ownerDocument,d=u.body,h=getComputedStyle(d),f=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,p=Math.abs(r.clientWidth-d.clientWidth-f);p<=nX&&(s-=p)}else c<=nX&&(s+=c);return{width:s,height:o,x:a,y:l}}const sMe=new Set(["absolute","fixed"]);function oMe(t,e){const n=P1(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=yd(t)?eb(t):rd(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function rX(t,e,n){let r;if(e==="viewport")r=iMe(t,n);else if(e==="document")r=rMe(Td(t));else if(Gc(e))r=oMe(e,n);else{const i=Efe(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return XA(r)}function Afe(t,e){const n=Dm(t);return n===e||!Gc(n)||Bw(n)?!1:Kc(n).position==="fixed"||Afe(n,e)}function aMe(t,e){const n=e.get(t);if(n)return n;let r=RS(t,[],!1).filter(a=>Gc(a)&&Vx(a)!=="body"),i=null;const s=Kc(t).position==="fixed";let o=s?Dm(t):t;for(;Gc(o)&&!Bw(o);){const a=Kc(o),l=t$(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&sMe.has(i.position)||n3(o)&&!l&&Afe(t,o))?r=r.filter(u=>u!==o):i=a,o=Dm(o)}return e.set(t,r),r}function lMe(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?I9(e)?[]:aMe(e,this._c):[].concat(n),r],a=o[0],l=o.reduce((c,u)=>{const d=rX(e,u,i);return c.top=ja(d.top,c.top),c.right=Om(d.right,c.right),c.bottom=Om(d.bottom,c.bottom),c.left=ja(d.left,c.left),c},rX(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function cMe(t){const{width:e,height:n}=Cfe(t);return{width:e,height:n}}function uMe(t,e,n){const r=yd(e),i=Td(e),s=n==="fixed",o=P1(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=rd(0);function c(){l.x=M9(i)}if(r||!r&&!s)if((Vx(e)!=="body"||n3(i))&&(a=R9(e)),r){const f=P1(e,!0,s,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else i&&c();s&&!r&&i&&c();const u=i&&!r&&!s?Tfe(i,a):rd(0),d=o.left+a.scrollLeft-l.x-u.x,h=o.top+a.scrollTop-l.y-u.y;return{x:d,y:h,width:o.width,height:o.height}}function gN(t){return Kc(t).position==="static"}function iX(t,e){if(!yd(t)||Kc(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Td(t)===n&&(n=n.ownerDocument.body),n}function Ife(t,e){const n=Xa(t);if(I9(t))return n;if(!yd(t)){let i=Dm(t);for(;i&&!Bw(i);){if(Gc(i)&&!gN(i))return i;i=Dm(i)}return n}let r=iX(t,e);for(;r&&WRe(r)&&gN(r);)r=iX(r,e);return r&&Bw(r)&&gN(r)&&!t$(r)?n:r||XRe(t)||n}const dMe=async function(t){const e=this.getOffsetParent||Ife,n=this.getDimensions,r=await n(t.floating);return{reference:uMe(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function hMe(t){return Kc(t).direction==="rtl"}const fMe={convertOffsetParentRelativeRectToViewportRelativeRect:tMe,getDocumentElement:Td,getClippingRect:lMe,getOffsetParent:Ife,getElementRects:dMe,getClientRects:nMe,getDimensions:cMe,getScale:eb,isElement:Gc,isRTL:hMe};function Rfe(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function pMe(t,e){let n=null,r;const i=Td(t);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const c=t.getBoundingClientRect(),{left:u,top:d,width:h,height:f}=c;if(a||e(),!h||!f)return;const p=QC(d),g=QC(i.clientWidth-(u+h)),y=QC(i.clientHeight-(d+f)),v=QC(u),_={rootMargin:-p+"px "+-g+"px "+-y+"px "+-v+"px",threshold:ja(0,Om(1,l))||1};let S=!0;function k(T){const E=T[0].intersectionRatio;if(E!==l){if(!S)return o();E?o(!1,E):r=setTimeout(()=>{o(!1,1e-7)},1e3)}E===1&&!Rfe(c,t.getBoundingClientRect())&&o(),S=!1}try{n=new IntersectionObserver(k,{..._,root:i.ownerDocument})}catch{n=new IntersectionObserver(k,_)}n.observe(t)}return o(!0),s}function mMe(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=r$(t),u=i||s?[...c?RS(c):[],...RS(e)]:[];u.forEach(v=>{i&&v.addEventListener("scroll",n,{passive:!0}),s&&v.addEventListener("resize",n)});const d=c&&a?pMe(c,n):null;let h=-1,f=null;o&&(f=new ResizeObserver(v=>{let[b]=v;b&&b.target===c&&f&&(f.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var _;(_=f)==null||_.observe(e)})),n()}),c&&!l&&f.observe(c),f.observe(e));let p,g=l?P1(t):null;l&&y();function y(){const v=P1(t);g&&!Rfe(g,v)&&n(),g=v,p=requestAnimationFrame(y)}return n(),()=>{var v;u.forEach(b=>{i&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),d==null||d(),(v=f)==null||v.disconnect(),f=null,l&&cancelAnimationFrame(p)}}const gMe=FRe,yMe=VRe,vMe=zRe,bMe=HRe,wMe=jRe,sX=LRe,xMe=$Re,_Me=(t,e,n)=>{const r=new Map,i={platform:fMe,...n},s={...i.platform,_c:r};return PRe(t,e,{...i,platform:s})};var SMe=typeof document<"u",kMe=function(){},$T=SMe?x.useLayoutEffect:kMe;function QA(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!QA(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&t.$$typeof)&&!QA(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function Mfe(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function oX(t,e){const n=Mfe(t);return Math.round(e*n)/n}function yN(t){const e=x.useRef(t);return $T(()=>{e.current=t}),e}function CMe(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=t,[u,d]=x.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[h,f]=x.useState(r);QA(h,r)||f(r);const[p,g]=x.useState(null),[y,v]=x.useState(null),b=x.useCallback(J=>{J!==T.current&&(T.current=J,g(J))},[]),_=x.useCallback(J=>{J!==E.current&&(E.current=J,v(J))},[]),S=s||p,k=o||y,T=x.useRef(null),E=x.useRef(null),C=x.useRef(u),R=l!=null,M=yN(l),D=yN(i),P=yN(c),z=x.useCallback(()=>{if(!T.current||!E.current)return;const J={placement:e,strategy:n,middleware:h};D.current&&(J.platform=D.current),_Me(T.current,E.current,J).then(oe=>{const B={...oe,isPositioned:P.current!==!1};Z.current&&!QA(C.current,B)&&(C.current=B,nc.flushSync(()=>{d(B)}))})},[h,e,n,D,P]);$T(()=>{c===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,d(J=>({...J,isPositioned:!1})))},[c]);const Z=x.useRef(!1);$T(()=>(Z.current=!0,()=>{Z.current=!1}),[]),$T(()=>{if(S&&(T.current=S),k&&(E.current=k),S&&k){if(M.current)return M.current(S,k,z);z()}},[S,k,z,M,R]);const re=x.useMemo(()=>({reference:T,floating:E,setReference:b,setFloating:_}),[b,_]),G=x.useMemo(()=>({reference:S,floating:k}),[S,k]),ee=x.useMemo(()=>{const J={position:n,left:0,top:0};if(!G.floating)return J;const oe=oX(G.floating,u.x),B=oX(G.floating,u.y);return a?{...J,transform:"translate("+oe+"px, "+B+"px)",...Mfe(G.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:oe,top:B}},[n,a,G.floating,u.x,u.y]);return x.useMemo(()=>({...u,update:z,refs:re,elements:G,floatingStyles:ee}),[u,z,re,G,ee])}const EMe=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?sX({element:r.current,padding:i}).fn(n):{}:r?sX({element:r,padding:i}).fn(n):{}}}},TMe=(t,e)=>({...gMe(t),options:[t,e]}),AMe=(t,e)=>({...yMe(t),options:[t,e]}),IMe=(t,e)=>({...xMe(t),options:[t,e]}),RMe=(t,e)=>({...vMe(t),options:[t,e]}),MMe=(t,e)=>({...bMe(t),options:[t,e]}),NMe=(t,e)=>({...wMe(t),options:[t,e]}),OMe=(t,e)=>({...EMe(t),options:[t,e]});var DMe="Arrow",Nfe=x.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...s}=t;return m.jsx(xt.svg,{...s,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});Nfe.displayName=DMe;var PMe=Nfe,i$="Popper",[Ofe,$x]=ao(i$),[LMe,Dfe]=Ofe(i$),Pfe=t=>{const{__scopePopper:e,children:n}=t,[r,i]=x.useState(null);return m.jsx(LMe,{scope:e,anchor:r,onAnchorChange:i,children:n})};Pfe.displayName=i$;var Lfe="PopperAnchor",zfe=x.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,s=Dfe(Lfe,n),o=x.useRef(null),a=Jt(e,o),l=x.useRef(null);return x.useEffect(()=>{const c=l.current;l.current=(r==null?void 0:r.current)||o.current,c!==l.current&&s.onAnchorChange(l.current)}),r?null:m.jsx(xt.div,{...i,ref:a})});zfe.displayName=Lfe;var s$="PopperContent",[zMe,jMe]=Ofe(s$),jfe=x.forwardRef((t,e)=>{var _e,Ne,Ue,at,ct,H;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:f="optimized",onPlaced:p,...g}=t,y=Dfe(s$,n),[v,b]=x.useState(null),_=Jt(e,Y=>b(Y)),[S,k]=x.useState(null),T=E9(S),E=(T==null?void 0:T.width)??0,C=(T==null?void 0:T.height)??0,R=r+(s!=="center"?"-"+s:""),M=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(c)?c:[c],P=D.length>0,z={padding:M,boundary:D.filter(FMe),altBoundary:P},{refs:Z,floatingStyles:re,placement:G,isPositioned:ee,middlewareData:J}=CMe({strategy:"fixed",placement:R,whileElementsMounted:(...Y)=>mMe(...Y,{animationFrame:f==="always"}),elements:{reference:y.anchor},middleware:[TMe({mainAxis:i+C,alignmentAxis:o}),l&&AMe({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?IMe():void 0,...z}),l&&RMe({...z}),MMe({...z,apply:({elements:Y,rects:se,availableWidth:me,availableHeight:de})=>{const{width:ie,height:Te}=se.reference,he=Y.floating.style;he.setProperty("--radix-popper-available-width",`${me}px`),he.setProperty("--radix-popper-available-height",`${de}px`),he.setProperty("--radix-popper-anchor-width",`${ie}px`),he.setProperty("--radix-popper-anchor-height",`${Te}px`)}}),S&&OMe({element:S,padding:a}),VMe({arrowWidth:E,arrowHeight:C}),h&&NMe({strategy:"referenceHidden",...z})]}),[oe,B]=Vfe(G),$e=ds(p);zi(()=>{ee&&($e==null||$e())},[ee,$e]);const Ye=(_e=J.arrow)==null?void 0:_e.x,$=(Ne=J.arrow)==null?void 0:Ne.y,Re=((Ue=J.arrow)==null?void 0:Ue.centerOffset)!==0,[ke,Me]=x.useState();return zi(()=>{v&&Me(window.getComputedStyle(v).zIndex)},[v]),m.jsx("div",{ref:Z.setFloating,"data-radix-popper-content-wrapper":"",style:{...re,transform:ee?re.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ke,"--radix-popper-transform-origin":[(at=J.transformOrigin)==null?void 0:at.x,(ct=J.transformOrigin)==null?void 0:ct.y].join(" "),...((H=J.hide)==null?void 0:H.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:m.jsx(zMe,{scope:n,placedSide:oe,onArrowChange:k,arrowX:Ye,arrowY:$,shouldHideArrow:Re,children:m.jsx(xt.div,{"data-side":oe,"data-align":B,...g,ref:_,style:{...g.style,animation:ee?void 0:"none"}})})})});jfe.displayName=s$;var Bfe="PopperArrow",BMe={top:"bottom",right:"left",bottom:"top",left:"right"},Ffe=x.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,s=jMe(Bfe,r),o=BMe[s.placedSide];return m.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:m.jsx(PMe,{...i,ref:n,style:{...i.style,display:"block"}})})});Ffe.displayName=Bfe;function FMe(t){return t!==null}var VMe=t=>({name:"transformOrigin",options:t,fn(e){var y,v,b;const{placement:n,rects:r,middlewareData:i}=e,o=((y=i.arrow)==null?void 0:y.centerOffset)!==0,a=o?0:t.arrowWidth,l=o?0:t.arrowHeight,[c,u]=Vfe(n),d={start:"0%",center:"50%",end:"100%"}[u],h=(((v=i.arrow)==null?void 0:v.x)??0)+a/2,f=(((b=i.arrow)==null?void 0:b.y)??0)+l/2;let p="",g="";return c==="bottom"?(p=o?d:`${h}px`,g=`${-l}px`):c==="top"?(p=o?d:`${h}px`,g=`${r.floating.height+l}px`):c==="right"?(p=`${-l}px`,g=o?d:`${f}px`):c==="left"&&(p=`${r.floating.width+l}px`,g=o?d:`${f}px`),{data:{x:p,y:g}}}});function Vfe(t){const[e,n="center"]=t.split("-");return[e,n]}var o$=Pfe,a$=zfe,l$=jfe,c$=Ffe,vN="rovingFocusGroup.onEntryFocus",$Me={bubbles:!1,cancelable:!0},r3="RovingFocusGroup",[dL,$fe,HMe]=HV(r3),[UMe,Hx]=ao(r3,[HMe]),[qMe,WMe]=UMe(r3),Hfe=x.forwardRef((t,e)=>m.jsx(dL.Provider,{scope:t.__scopeRovingFocusGroup,children:m.jsx(dL.Slot,{scope:t.__scopeRovingFocusGroup,children:m.jsx(GMe,{...t,ref:e})})}));Hfe.displayName=r3;var GMe=x.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=t,h=x.useRef(null),f=Jt(e,h),p=Bx(s),[g,y]=gd({prop:o,defaultProp:a??null,onChange:l,caller:r3}),[v,b]=x.useState(!1),_=ds(c),S=$fe(n),k=x.useRef(!1),[T,E]=x.useState(0);return x.useEffect(()=>{const C=h.current;if(C)return C.addEventListener(vN,_),()=>C.removeEventListener(vN,_)},[_]),m.jsx(qMe,{scope:n,orientation:r,dir:p,loop:i,currentTabStopId:g,onItemFocus:x.useCallback(C=>y(C),[y]),onItemShiftTab:x.useCallback(()=>b(!0),[]),onFocusableItemAdd:x.useCallback(()=>E(C=>C+1),[]),onFocusableItemRemove:x.useCallback(()=>E(C=>C-1),[]),children:m.jsx(xt.div,{tabIndex:v||T===0?-1:0,"data-orientation":r,...d,ref:f,style:{outline:"none",...t.style},onMouseDown:et(t.onMouseDown,()=>{k.current=!0}),onFocus:et(t.onFocus,C=>{const R=!k.current;if(C.target===C.currentTarget&&R&&!v){const M=new CustomEvent(vN,$Me);if(C.currentTarget.dispatchEvent(M),!M.defaultPrevented){const D=S().filter(G=>G.focusable),P=D.find(G=>G.active),z=D.find(G=>G.id===g),re=[P,z,...D].filter(Boolean).map(G=>G.ref.current);Wfe(re,u)}}k.current=!1}),onBlur:et(t.onBlur,()=>b(!1))})})}),Ufe="RovingFocusGroupItem",qfe=x.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...a}=t,l=zc(),c=s||l,u=WMe(Ufe,n),d=u.currentTabStopId===c,h=$fe(n),{onFocusableItemAdd:f,onFocusableItemRemove:p,currentTabStopId:g}=u;return x.useEffect(()=>{if(r)return f(),()=>p()},[r,f,p]),m.jsx(dL.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:m.jsx(xt.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:e,onMouseDown:et(t.onMouseDown,y=>{r?u.onItemFocus(c):y.preventDefault()}),onFocus:et(t.onFocus,()=>u.onItemFocus(c)),onKeyDown:et(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){u.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const v=ZMe(y,u.orientation,u.dir);if(v!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let _=h().filter(S=>S.focusable).map(S=>S.ref.current);if(v==="last")_.reverse();else if(v==="prev"||v==="next"){v==="prev"&&_.reverse();const S=_.indexOf(y.currentTarget);_=u.loop?XMe(_,S+1):_.slice(S+1)}setTimeout(()=>Wfe(_))}}),children:typeof o=="function"?o({isCurrentTabStop:d,hasTabStop:g!=null}):o})})});qfe.displayName=Ufe;var KMe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function YMe(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function ZMe(t,e,n){const r=YMe(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return KMe[r]}function Wfe(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function XMe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var u$=Hfe,d$=qfe,hL=["Enter"," "],QMe=["ArrowDown","PageUp","Home"],Gfe=["ArrowUp","PageDown","End"],JMe=[...QMe,...Gfe],eNe={ltr:[...hL,"ArrowRight"],rtl:[...hL,"ArrowLeft"]},tNe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},i3="Menu",[MS,nNe,rNe]=HV(i3),[yy,Kfe]=ao(i3,[rNe,$x,Hx]),N9=$x(),Yfe=Hx(),[iNe,vy]=yy(i3),[sNe,s3]=yy(i3),Zfe=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=t,a=N9(e),[l,c]=x.useState(null),u=x.useRef(!1),d=ds(s),h=Bx(i);return x.useEffect(()=>{const f=()=>{u.current=!0,document.addEventListener("pointerdown",p,{capture:!0,once:!0}),document.addEventListener("pointermove",p,{capture:!0,once:!0})},p=()=>u.current=!1;return document.addEventListener("keydown",f,{capture:!0}),()=>{document.removeEventListener("keydown",f,{capture:!0}),document.removeEventListener("pointerdown",p,{capture:!0}),document.removeEventListener("pointermove",p,{capture:!0})}},[]),m.jsx(o$,{...a,children:m.jsx(iNe,{scope:e,open:n,onOpenChange:d,content:l,onContentChange:c,children:m.jsx(sNe,{scope:e,onClose:x.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:h,modal:o,children:r})})})};Zfe.displayName=i3;var oNe="MenuAnchor",h$=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=N9(n);return m.jsx(a$,{...i,...r,ref:e})});h$.displayName=oNe;var f$="MenuPortal",[aNe,Xfe]=yy(f$,{forceMount:void 0}),Qfe=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,s=vy(f$,e);return m.jsx(aNe,{scope:e,forceMount:n,children:m.jsx(Fs,{present:n||s.open,children:m.jsx(t3,{asChild:!0,container:i,children:r})})})};Qfe.displayName=f$;var Wl="MenuContent",[lNe,p$]=yy(Wl),Jfe=x.forwardRef((t,e)=>{const n=Xfe(Wl,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=vy(Wl,t.__scopeMenu),o=s3(Wl,t.__scopeMenu);return m.jsx(MS.Provider,{scope:t.__scopeMenu,children:m.jsx(Fs,{present:r||s.open,children:m.jsx(MS.Slot,{scope:t.__scopeMenu,children:o.modal?m.jsx(cNe,{...i,ref:e}):m.jsx(uNe,{...i,ref:e})})})})}),cNe=x.forwardRef((t,e)=>{const n=vy(Wl,t.__scopeMenu),r=x.useRef(null),i=Jt(e,r);return x.useEffect(()=>{const s=r.current;if(s)return qV(s)},[]),m.jsx(m$,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:et(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),uNe=x.forwardRef((t,e)=>{const n=vy(Wl,t.__scopeMenu);return m.jsx(m$,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),dNe=O1("MenuContent.ScrollLock"),m$=x.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:f,disableOutsideScroll:p,...g}=t,y=vy(Wl,n),v=s3(Wl,n),b=N9(n),_=Yfe(n),S=nNe(n),[k,T]=x.useState(null),E=x.useRef(null),C=Jt(e,E,y.onContentChange),R=x.useRef(0),M=x.useRef(""),D=x.useRef(0),P=x.useRef(null),z=x.useRef("right"),Z=x.useRef(0),re=p?S9:x.Fragment,G=p?{as:dNe,allowPinchZoom:!0}:void 0,ee=oe=>{var _e,Ne;const B=M.current+oe,$e=S().filter(Ue=>!Ue.disabled),Ye=document.activeElement,$=(_e=$e.find(Ue=>Ue.ref.current===Ye))==null?void 0:_e.textValue,Re=$e.map(Ue=>Ue.textValue),ke=SNe(Re,B,$),Me=(Ne=$e.find(Ue=>Ue.textValue===ke))==null?void 0:Ne.ref.current;(function Ue(at){M.current=at,window.clearTimeout(R.current),at!==""&&(R.current=window.setTimeout(()=>Ue(""),1e3))})(B),Me&&setTimeout(()=>Me.focus())};x.useEffect(()=>()=>window.clearTimeout(R.current),[]),UV();const J=x.useCallback(oe=>{var $e,Ye;return z.current===(($e=P.current)==null?void 0:$e.side)&&CNe(oe,(Ye=P.current)==null?void 0:Ye.area)},[]);return m.jsx(lNe,{scope:n,searchRef:M,onItemEnter:x.useCallback(oe=>{J(oe)&&oe.preventDefault()},[J]),onItemLeave:x.useCallback(oe=>{var B;J(oe)||((B=E.current)==null||B.focus(),T(null))},[J]),onTriggerLeave:x.useCallback(oe=>{J(oe)&&oe.preventDefault()},[J]),pointerGraceTimerRef:D,onPointerGraceIntentChange:x.useCallback(oe=>{P.current=oe},[]),children:m.jsx(re,{...G,children:m.jsx(x9,{asChild:!0,trapped:i,onMountAutoFocus:et(s,oe=>{var B;oe.preventDefault(),(B=E.current)==null||B.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:m.jsx(e3,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:f,children:m.jsx(u$,{asChild:!0,..._,dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:k,onCurrentTabStopIdChange:T,onEntryFocus:et(l,oe=>{v.isUsingKeyboardRef.current||oe.preventDefault()}),preventScrollOnEntryFocus:!0,children:m.jsx(l$,{role:"menu","aria-orientation":"vertical","data-state":mpe(y.open),"data-radix-menu-content":"",dir:v.dir,...b,...g,ref:C,style:{outline:"none",...g.style},onKeyDown:et(g.onKeyDown,oe=>{const $e=oe.target.closest("[data-radix-menu-content]")===oe.currentTarget,Ye=oe.ctrlKey||oe.altKey||oe.metaKey,$=oe.key.length===1;$e&&(oe.key==="Tab"&&oe.preventDefault(),!Ye&&$&&ee(oe.key));const Re=E.current;if(oe.target!==Re||!JMe.includes(oe.key))return;oe.preventDefault();const Me=S().filter(_e=>!_e.disabled).map(_e=>_e.ref.current);Gfe.includes(oe.key)&&Me.reverse(),xNe(Me)}),onBlur:et(t.onBlur,oe=>{oe.currentTarget.contains(oe.target)||(window.clearTimeout(R.current),M.current="")}),onPointerMove:et(t.onPointerMove,NS(oe=>{const B=oe.target,$e=Z.current!==oe.clientX;if(oe.currentTarget.contains(B)&&$e){const Ye=oe.clientX>Z.current?"right":"left";z.current=Ye,Z.current=oe.clientX}}))})})})})})})});Jfe.displayName=Wl;var hNe="MenuGroup",g$=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return m.jsx(xt.div,{role:"group",...r,ref:e})});g$.displayName=hNe;var fNe="MenuLabel",epe=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return m.jsx(xt.div,{...r,ref:e})});epe.displayName=fNe;var JA="MenuItem",aX="menu.itemSelect",O9=x.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,s=x.useRef(null),o=s3(JA,t.__scopeMenu),a=p$(JA,t.__scopeMenu),l=Jt(e,s),c=x.useRef(!1),u=()=>{const d=s.current;if(!n&&d){const h=new CustomEvent(aX,{bubbles:!0,cancelable:!0});d.addEventListener(aX,f=>r==null?void 0:r(f),{once:!0}),Che(d,h),h.defaultPrevented?c.current=!1:o.onClose()}};return m.jsx(tpe,{...i,ref:l,disabled:n,onClick:et(t.onClick,u),onPointerDown:d=>{var h;(h=t.onPointerDown)==null||h.call(t,d),c.current=!0},onPointerUp:et(t.onPointerUp,d=>{var h;c.current||(h=d.currentTarget)==null||h.click()}),onKeyDown:et(t.onKeyDown,d=>{const h=a.searchRef.current!=="";n||h&&d.key===" "||hL.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});O9.displayName=JA;var tpe=x.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=t,o=p$(JA,n),a=Yfe(n),l=x.useRef(null),c=Jt(e,l),[u,d]=x.useState(!1),[h,f]=x.useState("");return x.useEffect(()=>{const p=l.current;p&&f((p.textContent??"").trim())},[s.children]),m.jsx(MS.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:m.jsx(d$,{asChild:!0,...a,focusable:!r,children:m.jsx(xt.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:et(t.onPointerMove,NS(p=>{r?o.onItemLeave(p):(o.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:et(t.onPointerLeave,NS(p=>o.onItemLeave(p))),onFocus:et(t.onFocus,()=>d(!0)),onBlur:et(t.onBlur,()=>d(!1))})})})}),pNe="MenuCheckboxItem",npe=x.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return m.jsx(ape,{scope:t.__scopeMenu,checked:n,children:m.jsx(O9,{role:"menuitemcheckbox","aria-checked":e7(n)?"mixed":n,...i,ref:e,"data-state":v$(n),onSelect:et(i.onSelect,()=>r==null?void 0:r(e7(n)?!0:!n),{checkForDefaultPrevented:!1})})})});npe.displayName=pNe;var rpe="MenuRadioGroup",[mNe,gNe]=yy(rpe,{value:void 0,onValueChange:()=>{}}),ipe=x.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,s=ds(r);return m.jsx(mNe,{scope:t.__scopeMenu,value:n,onValueChange:s,children:m.jsx(g$,{...i,ref:e})})});ipe.displayName=rpe;var spe="MenuRadioItem",ope=x.forwardRef((t,e)=>{const{value:n,...r}=t,i=gNe(spe,t.__scopeMenu),s=n===i.value;return m.jsx(ape,{scope:t.__scopeMenu,checked:s,children:m.jsx(O9,{role:"menuitemradio","aria-checked":s,...r,ref:e,"data-state":v$(s),onSelect:et(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});ope.displayName=spe;var y$="MenuItemIndicator",[ape,yNe]=yy(y$,{checked:!1}),lpe=x.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,s=yNe(y$,n);return m.jsx(Fs,{present:r||e7(s.checked)||s.checked===!0,children:m.jsx(xt.span,{...i,ref:e,"data-state":v$(s.checked)})})});lpe.displayName=y$;var vNe="MenuSeparator",cpe=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return m.jsx(xt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});cpe.displayName=vNe;var bNe="MenuArrow",upe=x.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=N9(n);return m.jsx(c$,{...i,...r,ref:e})});upe.displayName=bNe;var wNe="MenuSub",[hRt,dpe]=yy(wNe),v4="MenuSubTrigger",hpe=x.forwardRef((t,e)=>{const n=vy(v4,t.__scopeMenu),r=s3(v4,t.__scopeMenu),i=dpe(v4,t.__scopeMenu),s=p$(v4,t.__scopeMenu),o=x.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,c={__scopeMenu:t.__scopeMenu},u=x.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return x.useEffect(()=>u,[u]),x.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),m.jsx(h$,{asChild:!0,...c,children:m.jsx(tpe,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":mpe(n.open),...t,ref:w9(e,i.onTriggerChange),onClick:d=>{var h;(h=t.onClick)==null||h.call(t,d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:et(t.onPointerMove,NS(d=>{s.onItemEnter(d),!d.defaultPrevented&&!t.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:et(t.onPointerLeave,NS(d=>{var f,p;u();const h=(f=n.content)==null?void 0:f.getBoundingClientRect();if(h){const g=(p=n.content)==null?void 0:p.dataset.side,y=g==="right",v=y?-5:5,b=h[y?"left":"right"],_=h[y?"right":"left"];s.onPointerGraceIntentChange({area:[{x:d.clientX+v,y:d.clientY},{x:b,y:h.top},{x:_,y:h.top},{x:_,y:h.bottom},{x:b,y:h.bottom}],side:g}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(d),d.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:et(t.onKeyDown,d=>{var f;const h=s.searchRef.current!=="";t.disabled||h&&d.key===" "||eNe[r.dir].includes(d.key)&&(n.onOpenChange(!0),(f=n.content)==null||f.focus(),d.preventDefault())})})})});hpe.displayName=v4;var fpe="MenuSubContent",ppe=x.forwardRef((t,e)=>{const n=Xfe(Wl,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=vy(Wl,t.__scopeMenu),o=s3(Wl,t.__scopeMenu),a=dpe(fpe,t.__scopeMenu),l=x.useRef(null),c=Jt(e,l);return m.jsx(MS.Provider,{scope:t.__scopeMenu,children:m.jsx(Fs,{present:r||s.open,children:m.jsx(MS.Slot,{scope:t.__scopeMenu,children:m.jsx(m$,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:c,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var d;o.isUsingKeyboardRef.current&&((d=l.current)==null||d.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:et(t.onFocusOutside,u=>{u.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:et(t.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:et(t.onKeyDown,u=>{var f;const d=u.currentTarget.contains(u.target),h=tNe[o.dir].includes(u.key);d&&h&&(s.onOpenChange(!1),(f=a.trigger)==null||f.focus(),u.preventDefault())})})})})})});ppe.displayName=fpe;function mpe(t){return t?"open":"closed"}function e7(t){return t==="indeterminate"}function v$(t){return e7(t)?"indeterminate":t?"checked":"unchecked"}function xNe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function _Ne(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function SNe(t,e,n){const i=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let o=_Ne(t,Math.max(s,0));i.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function kNe(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,o=e.length-1;s<e.length;o=s++){const a=e[s],l=e[o],c=a.x,u=a.y,d=l.x,h=l.y;u>r!=h>r&&n<(d-c)*(r-u)/(h-u)+c&&(i=!i)}return i}function CNe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return kNe(n,e)}function NS(t){return e=>e.pointerType==="mouse"?t(e):void 0}var ENe=Zfe,TNe=h$,ANe=Qfe,INe=Jfe,RNe=g$,MNe=epe,NNe=O9,ONe=npe,DNe=ipe,PNe=ope,LNe=lpe,zNe=cpe,jNe=upe,BNe=hpe,FNe=ppe,D9="DropdownMenu",[VNe]=ao(D9,[Kfe]),jo=Kfe(),[$Ne,gpe]=VNe(D9),ype=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=t,l=jo(e),c=x.useRef(null),[u,d]=gd({prop:i,defaultProp:s??!1,onChange:o,caller:D9});return m.jsx($Ne,{scope:e,triggerId:zc(),triggerRef:c,contentId:zc(),open:u,onOpenChange:d,onOpenToggle:x.useCallback(()=>d(h=>!h),[d]),modal:a,children:m.jsx(ENe,{...l,open:u,onOpenChange:d,dir:r,modal:a,children:n})})};ype.displayName=D9;var vpe="DropdownMenuTrigger",bpe=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=t,s=gpe(vpe,n),o=jo(n);return m.jsx(TNe,{asChild:!0,...o,children:m.jsx(xt.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:w9(e,s.triggerRef),onPointerDown:et(t.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:et(t.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});bpe.displayName=vpe;var HNe="DropdownMenuPortal",wpe=t=>{const{__scopeDropdownMenu:e,...n}=t,r=jo(e);return m.jsx(ANe,{...r,...n})};wpe.displayName=HNe;var xpe="DropdownMenuContent",_pe=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=gpe(xpe,n),s=jo(n),o=x.useRef(!1);return m.jsx(INe,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:e,onCloseAutoFocus:et(t.onCloseAutoFocus,a=>{var l;o.current||(l=i.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:et(t.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!i.modal||u)&&(o.current=!0)}),style:{...t.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)"}})});_pe.displayName=xpe;var UNe="DropdownMenuGroup",qNe=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=jo(n);return m.jsx(RNe,{...i,...r,ref:e})});qNe.displayName=UNe;var WNe="DropdownMenuLabel",GNe=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=jo(n);return m.jsx(MNe,{...i,...r,ref:e})});GNe.displayName=WNe;var KNe="DropdownMenuItem",Spe=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=jo(n);return m.jsx(NNe,{...i,...r,ref:e})});Spe.displayName=KNe;var YNe="DropdownMenuCheckboxItem",ZNe=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=jo(n);return m.jsx(ONe,{...i,...r,ref:e})});ZNe.displayName=YNe;var XNe="DropdownMenuRadioGroup",QNe=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=jo(n);return m.jsx(DNe,{...i,...r,ref:e})});QNe.displayName=XNe;var JNe="DropdownMenuRadioItem",eOe=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=jo(n);return m.jsx(PNe,{...i,...r,ref:e})});eOe.displayName=JNe;var tOe="DropdownMenuItemIndicator",nOe=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=jo(n);return m.jsx(LNe,{...i,...r,ref:e})});nOe.displayName=tOe;var rOe="DropdownMenuSeparator",iOe=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=jo(n);return m.jsx(zNe,{...i,...r,ref:e})});iOe.displayName=rOe;var sOe="DropdownMenuArrow",oOe=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=jo(n);return m.jsx(jNe,{...i,...r,ref:e})});oOe.displayName=sOe;var aOe="DropdownMenuSubTrigger",lOe=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=jo(n);return m.jsx(BNe,{...i,...r,ref:e})});lOe.displayName=aOe;var cOe="DropdownMenuSubContent",uOe=x.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=jo(n);return m.jsx(FNe,{...i,...r,ref:e,style:{...t.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)"}})});uOe.displayName=cOe;var dOe=ype,hOe=bpe,fOe=wpe,pOe=_pe,mOe=Spe,gOe="Label",kpe=x.forwardRef((t,e)=>m.jsx(xt.label,{...t,ref:e,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=t.onMouseDown)==null||i.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));kpe.displayName=gOe;var yOe=kpe;function fL(t,[e,n]){return Math.min(n,Math.max(e,t))}var b$="Progress",w$=100,[vOe]=ao(b$),[bOe,wOe]=vOe(b$),Cpe=x.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:i,getValueLabel:s=xOe,...o}=t;(i||i===0)&&!lX(i)&&console.error(_Oe(`${i}`,"Progress"));const a=lX(i)?i:w$;r!==null&&!cX(r,a)&&console.error(SOe(`${r}`,"Progress"));const l=cX(r,a)?r:null,c=t7(l)?s(l,a):void 0;return m.jsx(bOe,{scope:n,value:l,max:a,children:m.jsx(xt.div,{"aria-valuemax":a,"aria-valuemin":0,"aria-valuenow":t7(l)?l:void 0,"aria-valuetext":c,role:"progressbar","data-state":Ape(l,a),"data-value":l??void 0,"data-max":a,...o,ref:e})})});Cpe.displayName=b$;var Epe="ProgressIndicator",Tpe=x.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,i=wOe(Epe,n);return m.jsx(xt.div,{"data-state":Ape(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:e})});Tpe.displayName=Epe;function xOe(t,e){return`${Math.round(t/e*100)}%`}function Ape(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function t7(t){return typeof t=="number"}function lX(t){return t7(t)&&!isNaN(t)&&t>0}function cX(t,e){return t7(t)&&!isNaN(t)&&t<=e&&t>=0}function _Oe(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${w$}\`.`}function SOe(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be:
|
||
- a positive number
|
||
- less than the value passed to \`max\` (or ${w$} if no \`max\` prop is set)
|
||
- \`null\` or \`undefined\` if the progress is indeterminate.
|
||
|
||
Defaulting to \`null\`.`}var kOe=Cpe,COe=Tpe,x$="Radio",[EOe,Ipe]=ao(x$),[TOe,AOe]=EOe(x$),Rpe=x.forwardRef((t,e)=>{const{__scopeRadio:n,name:r,checked:i=!1,required:s,disabled:o,value:a="on",onCheck:l,form:c,...u}=t,[d,h]=x.useState(null),f=Jt(e,y=>h(y)),p=x.useRef(!1),g=d?c||!!d.closest("form"):!0;return m.jsxs(TOe,{scope:n,checked:i,disabled:o,children:[m.jsx(xt.button,{type:"button",role:"radio","aria-checked":i,"data-state":Dpe(i),"data-disabled":o?"":void 0,disabled:o,value:a,...u,ref:f,onClick:et(t.onClick,y=>{i||l==null||l(),g&&(p.current=y.isPropagationStopped(),p.current||y.stopPropagation())})}),g&&m.jsx(Ope,{control:d,bubbles:!p.current,name:r,value:a,checked:i,required:s,disabled:o,form:c,style:{transform:"translateX(-100%)"}})]})});Rpe.displayName=x$;var Mpe="RadioIndicator",Npe=x.forwardRef((t,e)=>{const{__scopeRadio:n,forceMount:r,...i}=t,s=AOe(Mpe,n);return m.jsx(Fs,{present:r||s.checked,children:m.jsx(xt.span,{"data-state":Dpe(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:e})})});Npe.displayName=Mpe;var IOe="RadioBubbleInput",Ope=x.forwardRef(({__scopeRadio:t,control:e,checked:n,bubbles:r=!0,...i},s)=>{const o=x.useRef(null),a=Jt(o,s),l=C9(n),c=E9(e);return x.useEffect(()=>{const u=o.current;if(!u)return;const d=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(d,"checked").set;if(l!==n&&f){const p=new Event("click",{bubbles:r});f.call(u,n),u.dispatchEvent(p)}},[l,n,r]),m.jsx(xt.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:a,style:{...i.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Ope.displayName=IOe;function Dpe(t){return t?"checked":"unchecked"}var ROe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],P9="RadioGroup",[MOe]=ao(P9,[Hx,Ipe]),Ppe=Hx(),Lpe=Ipe(),[NOe,OOe]=MOe(P9),zpe=x.forwardRef((t,e)=>{const{__scopeRadioGroup:n,name:r,defaultValue:i,value:s,required:o=!1,disabled:a=!1,orientation:l,dir:c,loop:u=!0,onValueChange:d,...h}=t,f=Ppe(n),p=Bx(c),[g,y]=gd({prop:s,defaultProp:i??null,onChange:d,caller:P9});return m.jsx(NOe,{scope:n,name:r,required:o,disabled:a,value:g,onValueChange:y,children:m.jsx(u$,{asChild:!0,...f,orientation:l,dir:p,loop:u,children:m.jsx(xt.div,{role:"radiogroup","aria-required":o,"aria-orientation":l,"data-disabled":a?"":void 0,dir:p,...h,ref:e})})})});zpe.displayName=P9;var jpe="RadioGroupItem",Bpe=x.forwardRef((t,e)=>{const{__scopeRadioGroup:n,disabled:r,...i}=t,s=OOe(jpe,n),o=s.disabled||r,a=Ppe(n),l=Lpe(n),c=x.useRef(null),u=Jt(e,c),d=s.value===i.value,h=x.useRef(!1);return x.useEffect(()=>{const f=g=>{ROe.includes(g.key)&&(h.current=!0)},p=()=>h.current=!1;return document.addEventListener("keydown",f),document.addEventListener("keyup",p),()=>{document.removeEventListener("keydown",f),document.removeEventListener("keyup",p)}},[]),m.jsx(d$,{asChild:!0,...a,focusable:!o,active:d,children:m.jsx(Rpe,{disabled:o,required:s.required,checked:d,...l,...i,name:s.name,ref:u,onCheck:()=>s.onValueChange(i.value),onKeyDown:et(f=>{f.key==="Enter"&&f.preventDefault()}),onFocus:et(i.onFocus,()=>{var f;h.current&&((f=c.current)==null||f.click())})})})});Bpe.displayName=jpe;var DOe="RadioGroupIndicator",Fpe=x.forwardRef((t,e)=>{const{__scopeRadioGroup:n,...r}=t,i=Lpe(n);return m.jsx(Npe,{...i,...r,ref:e})});Fpe.displayName=DOe;var POe=zpe,LOe=Bpe,zOe=Fpe;function jOe(t,e){return x.useReducer((n,r)=>e[n][r]??n,t)}var _$="ScrollArea",[Vpe]=ao(_$),[BOe,ic]=Vpe(_$),$pe=x.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:s=600,...o}=t,[a,l]=x.useState(null),[c,u]=x.useState(null),[d,h]=x.useState(null),[f,p]=x.useState(null),[g,y]=x.useState(null),[v,b]=x.useState(0),[_,S]=x.useState(0),[k,T]=x.useState(!1),[E,C]=x.useState(!1),R=Jt(e,D=>l(D)),M=Bx(i);return m.jsx(BOe,{scope:n,type:r,dir:M,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:u,content:d,onContentChange:h,scrollbarX:f,onScrollbarXChange:p,scrollbarXEnabled:k,onScrollbarXEnabledChange:T,scrollbarY:g,onScrollbarYChange:y,scrollbarYEnabled:E,onScrollbarYEnabledChange:C,onCornerWidthChange:b,onCornerHeightChange:S,children:m.jsx(xt.div,{dir:M,...o,ref:R,style:{position:"relative","--radix-scroll-area-corner-width":v+"px","--radix-scroll-area-corner-height":_+"px",...t.style}})})});$pe.displayName=_$;var Hpe="ScrollAreaViewport",Upe=x.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:i,...s}=t,o=ic(Hpe,n),a=x.useRef(null),l=Jt(e,a,o.onViewportChange);return m.jsxs(m.Fragment,{children:[m.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),m.jsx(xt.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:m.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Upe.displayName=Hpe;var Ad="ScrollAreaScrollbar",qpe=x.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=ic(Ad,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=t.orientation==="horizontal";return x.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?m.jsx(FOe,{...r,ref:e,forceMount:n}):i.type==="scroll"?m.jsx(VOe,{...r,ref:e,forceMount:n}):i.type==="auto"?m.jsx(Wpe,{...r,ref:e,forceMount:n}):i.type==="always"?m.jsx(S$,{...r,ref:e}):null});qpe.displayName=Ad;var FOe=x.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=ic(Ad,t.__scopeScrollArea),[s,o]=x.useState(!1);return x.useEffect(()=>{const a=i.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),o(!0)},u=()=>{l=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",u)}}},[i.scrollArea,i.scrollHideDelay]),m.jsx(Fs,{present:n||s,children:m.jsx(Wpe,{"data-state":s?"visible":"hidden",...r,ref:e})})}),VOe=x.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=ic(Ad,t.__scopeScrollArea),s=t.orientation==="horizontal",o=z9(()=>l("SCROLL_END"),100),[a,l]=jOe("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return x.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,i.scrollHideDelay,l]),x.useEffect(()=>{const c=i.viewport,u=s?"scrollLeft":"scrollTop";if(c){let d=c[u];const h=()=>{const f=c[u];d!==f&&(l("SCROLL"),o()),d=f};return c.addEventListener("scroll",h),()=>c.removeEventListener("scroll",h)}},[i.viewport,s,l,o]),m.jsx(Fs,{present:n||a!=="hidden",children:m.jsx(S$,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:et(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:et(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),Wpe=x.forwardRef((t,e)=>{const n=ic(Ad,t.__scopeScrollArea),{forceMount:r,...i}=t,[s,o]=x.useState(!1),a=t.orientation==="horizontal",l=z9(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,u=n.viewport.offsetHeight<n.viewport.scrollHeight;o(a?c:u)}},10);return Fw(n.viewport,l),Fw(n.content,l),m.jsx(Fs,{present:r||s,children:m.jsx(S$,{"data-state":s?"visible":"hidden",...i,ref:e})})}),S$=x.forwardRef((t,e)=>{const{orientation:n="vertical",...r}=t,i=ic(Ad,t.__scopeScrollArea),s=x.useRef(null),o=x.useRef(0),[a,l]=x.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=Xpe(a.viewport,a.content),u={...r,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:h=>s.current=h,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:h=>o.current=h};function d(h,f){return GOe(h,o.current,a,f)}return n==="horizontal"?m.jsx($Oe,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollLeft,f=uX(h,a,i.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollLeft=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollLeft=d(h,i.dir))}}):n==="vertical"?m.jsx(HOe,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollTop,f=uX(h,a);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollTop=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollTop=d(h))}}):null}),$Oe=x.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,s=ic(Ad,t.__scopeScrollArea),[o,a]=x.useState(),l=x.useRef(null),c=Jt(e,l,s.onScrollbarXChange);return x.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),m.jsx(Kpe,{"data-orientation":"horizontal",...i,ref:c,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":L9(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.x),onDragScroll:u=>t.onDragScroll(u.x),onWheelScroll:(u,d)=>{if(s.viewport){const h=s.viewport.scrollLeft+u.deltaX;t.onWheelScroll(h),Jpe(h,d)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:r7(o.paddingLeft),paddingEnd:r7(o.paddingRight)}})}})}),HOe=x.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,s=ic(Ad,t.__scopeScrollArea),[o,a]=x.useState(),l=x.useRef(null),c=Jt(e,l,s.onScrollbarYChange);return x.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),m.jsx(Kpe,{"data-orientation":"vertical",...i,ref:c,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":L9(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.y),onDragScroll:u=>t.onDragScroll(u.y),onWheelScroll:(u,d)=>{if(s.viewport){const h=s.viewport.scrollTop+u.deltaY;t.onWheelScroll(h),Jpe(h,d)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:r7(o.paddingTop),paddingEnd:r7(o.paddingBottom)}})}})}),[UOe,Gpe]=Vpe(Ad),Kpe=x.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:d,...h}=t,f=ic(Ad,n),[p,g]=x.useState(null),y=Jt(e,R=>g(R)),v=x.useRef(null),b=x.useRef(""),_=f.viewport,S=r.content-r.viewport,k=ds(u),T=ds(l),E=z9(d,10);function C(R){if(v.current){const M=R.clientX-v.current.left,D=R.clientY-v.current.top;c({x:M,y:D})}}return x.useEffect(()=>{const R=M=>{const D=M.target;(p==null?void 0:p.contains(D))&&k(M,S)};return document.addEventListener("wheel",R,{passive:!1}),()=>document.removeEventListener("wheel",R,{passive:!1})},[_,p,S,k]),x.useEffect(T,[r,T]),Fw(p,E),Fw(f.content,E),m.jsx(UOe,{scope:n,scrollbar:p,hasThumb:i,onThumbChange:ds(s),onThumbPointerUp:ds(o),onThumbPositionChange:T,onThumbPointerDown:ds(a),children:m.jsx(xt.div,{...h,ref:y,style:{position:"absolute",...h.style},onPointerDown:et(t.onPointerDown,R=>{R.button===0&&(R.target.setPointerCapture(R.pointerId),v.current=p.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),C(R))}),onPointerMove:et(t.onPointerMove,C),onPointerUp:et(t.onPointerUp,R=>{const M=R.target;M.hasPointerCapture(R.pointerId)&&M.releasePointerCapture(R.pointerId),document.body.style.webkitUserSelect=b.current,f.viewport&&(f.viewport.style.scrollBehavior=""),v.current=null})})})}),n7="ScrollAreaThumb",Ype=x.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Gpe(n7,t.__scopeScrollArea);return m.jsx(Fs,{present:n||i.hasThumb,children:m.jsx(qOe,{ref:e,...r})})}),qOe=x.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...i}=t,s=ic(n7,n),o=Gpe(n7,n),{onThumbPositionChange:a}=o,l=Jt(e,d=>o.onThumbChange(d)),c=x.useRef(void 0),u=z9(()=>{c.current&&(c.current(),c.current=void 0)},100);return x.useEffect(()=>{const d=s.viewport;if(d){const h=()=>{if(u(),!c.current){const f=KOe(d,a);c.current=f,a()}};return a(),d.addEventListener("scroll",h),()=>d.removeEventListener("scroll",h)}},[s.viewport,u,a]),m.jsx(xt.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:et(t.onPointerDownCapture,d=>{const f=d.target.getBoundingClientRect(),p=d.clientX-f.left,g=d.clientY-f.top;o.onThumbPointerDown({x:p,y:g})}),onPointerUp:et(t.onPointerUp,o.onThumbPointerUp)})});Ype.displayName=n7;var k$="ScrollAreaCorner",Zpe=x.forwardRef((t,e)=>{const n=ic(k$,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?m.jsx(WOe,{...t,ref:e}):null});Zpe.displayName=k$;var WOe=x.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,i=ic(k$,n),[s,o]=x.useState(0),[a,l]=x.useState(0),c=!!(s&&a);return Fw(i.scrollbarX,()=>{var d;const u=((d=i.scrollbarX)==null?void 0:d.offsetHeight)||0;i.onCornerHeightChange(u),l(u)}),Fw(i.scrollbarY,()=>{var d;const u=((d=i.scrollbarY)==null?void 0:d.offsetWidth)||0;i.onCornerWidthChange(u),o(u)}),c?m.jsx(xt.div,{...r,ref:e,style:{width:s,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function r7(t){return t?parseInt(t,10):0}function Xpe(t,e){const n=t/e;return isNaN(n)?0:n}function L9(t){const e=Xpe(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function GOe(t,e,n,r="ltr"){const i=L9(n),s=i/2,o=e||s,a=i-o,l=n.scrollbar.paddingStart+o,c=n.scrollbar.size-n.scrollbar.paddingEnd-a,u=n.content-n.viewport,d=r==="ltr"?[0,u]:[u*-1,0];return Qpe([l,c],d)(t)}function uX(t,e,n="ltr"){const r=L9(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-i,o=e.content-e.viewport,a=s-r,l=n==="ltr"?[0,o]:[o*-1,0],c=fL(t,l);return Qpe([0,o],[0,a])(c)}function Qpe(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function Jpe(t,e){return t>0&&t<e}var KOe=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return function i(){const s={left:t.scrollLeft,top:t.scrollTop},o=n.left!==s.left,a=n.top!==s.top;(o||a)&&e(),n=s,r=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(r)};function z9(t,e){const n=ds(t),r=x.useRef(0);return x.useEffect(()=>()=>window.clearTimeout(r.current),[]),x.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function Fw(t,e){const n=ds(e);zi(()=>{let r=0;if(t){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(t),()=>{window.cancelAnimationFrame(r),i.unobserve(t)}}},[t,n])}var YOe=$pe,ZOe=Upe,XOe=Zpe,QOe=[" ","Enter","ArrowUp","ArrowDown"],JOe=[" ","Enter"],L1="Select",[j9,B9,eDe]=HV(L1),[Ux]=ao(L1,[eDe,$x]),F9=$x(),[tDe,p0]=Ux(L1),[nDe,rDe]=Ux(L1),eme=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:s,value:o,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:h,required:f,form:p}=t,g=F9(e),[y,v]=x.useState(null),[b,_]=x.useState(null),[S,k]=x.useState(!1),T=Bx(c),[E,C]=gd({prop:r,defaultProp:i??!1,onChange:s,caller:L1}),[R,M]=gd({prop:o,defaultProp:a,onChange:l,caller:L1}),D=x.useRef(null),P=y?p||!!y.closest("form"):!0,[z,Z]=x.useState(new Set),re=Array.from(z).map(G=>G.props.value).join(";");return m.jsx(o$,{...g,children:m.jsxs(tDe,{required:f,scope:e,trigger:y,onTriggerChange:v,valueNode:b,onValueNodeChange:_,valueNodeHasChildren:S,onValueNodeHasChildrenChange:k,contentId:zc(),value:R,onValueChange:M,open:E,onOpenChange:C,dir:T,triggerPointerDownPosRef:D,disabled:h,children:[m.jsx(j9.Provider,{scope:e,children:m.jsx(nDe,{scope:t.__scopeSelect,onNativeOptionAdd:x.useCallback(G=>{Z(ee=>new Set(ee).add(G))},[]),onNativeOptionRemove:x.useCallback(G=>{Z(ee=>{const J=new Set(ee);return J.delete(G),J})},[]),children:n})}),P?m.jsxs(_me,{"aria-hidden":!0,required:f,tabIndex:-1,name:u,autoComplete:d,value:R,onChange:G=>M(G.target.value),disabled:h,form:p,children:[R===void 0?m.jsx("option",{value:""}):null,Array.from(z)]},re):null]})})};eme.displayName=L1;var tme="SelectTrigger",nme=x.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...i}=t,s=F9(n),o=p0(tme,n),a=o.disabled||r,l=Jt(e,o.onTriggerChange),c=B9(n),u=x.useRef("touch"),[d,h,f]=kme(g=>{const y=c().filter(_=>!_.disabled),v=y.find(_=>_.value===o.value),b=Cme(y,g,v);b!==void 0&&o.onValueChange(b.value)}),p=g=>{a||(o.onOpenChange(!0),f()),g&&(o.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return m.jsx(a$,{asChild:!0,...s,children:m.jsx(xt.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:a,"data-disabled":a?"":void 0,"data-placeholder":Sme(o.value)?"":void 0,...i,ref:l,onClick:et(i.onClick,g=>{g.currentTarget.focus(),u.current!=="mouse"&&p(g)}),onPointerDown:et(i.onPointerDown,g=>{u.current=g.pointerType;const y=g.target;y.hasPointerCapture(g.pointerId)&&y.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(p(g),g.preventDefault())}),onKeyDown:et(i.onKeyDown,g=>{const y=d.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&h(g.key),!(y&&g.key===" ")&&QOe.includes(g.key)&&(p(),g.preventDefault())})})})});nme.displayName=tme;var rme="SelectValue",ime=x.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,children:s,placeholder:o="",...a}=t,l=p0(rme,n),{onValueNodeHasChildrenChange:c}=l,u=s!==void 0,d=Jt(e,l.onValueNodeChange);return zi(()=>{c(u)},[c,u]),m.jsx(xt.span,{...a,ref:d,style:{pointerEvents:"none"},children:Sme(l.value)?m.jsx(m.Fragment,{children:o}):s})});ime.displayName=rme;var iDe="SelectIcon",sme=x.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...i}=t;return m.jsx(xt.span,{"aria-hidden":!0,...i,ref:e,children:r||"▼"})});sme.displayName=iDe;var sDe="SelectPortal",ome=t=>m.jsx(t3,{asChild:!0,...t});ome.displayName=sDe;var z1="SelectContent",ame=x.forwardRef((t,e)=>{const n=p0(z1,t.__scopeSelect),[r,i]=x.useState();if(zi(()=>{i(new DocumentFragment)},[]),!n.open){const s=r;return s?nc.createPortal(m.jsx(lme,{scope:t.__scopeSelect,children:m.jsx(j9.Slot,{scope:t.__scopeSelect,children:m.jsx("div",{children:t.children})})}),s):null}return m.jsx(cme,{...t,ref:e})});ame.displayName=z1;var xc=10,[lme,m0]=Ux(z1),oDe="SelectContentImpl",aDe=O1("SelectContent.RemoveScroll"),cme=x.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:o,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:h,collisionPadding:f,sticky:p,hideWhenDetached:g,avoidCollisions:y,...v}=t,b=p0(z1,n),[_,S]=x.useState(null),[k,T]=x.useState(null),E=Jt(e,_e=>S(_e)),[C,R]=x.useState(null),[M,D]=x.useState(null),P=B9(n),[z,Z]=x.useState(!1),re=x.useRef(!1);x.useEffect(()=>{if(_)return qV(_)},[_]),UV();const G=x.useCallback(_e=>{const[Ne,...Ue]=P().map(H=>H.ref.current),[at]=Ue.slice(-1),ct=document.activeElement;for(const H of _e)if(H===ct||(H==null||H.scrollIntoView({block:"nearest"}),H===Ne&&k&&(k.scrollTop=0),H===at&&k&&(k.scrollTop=k.scrollHeight),H==null||H.focus(),document.activeElement!==ct))return},[P,k]),ee=x.useCallback(()=>G([C,_]),[G,C,_]);x.useEffect(()=>{z&&ee()},[z,ee]);const{onOpenChange:J,triggerPointerDownPosRef:oe}=b;x.useEffect(()=>{if(_){let _e={x:0,y:0};const Ne=at=>{var ct,H;_e={x:Math.abs(Math.round(at.pageX)-(((ct=oe.current)==null?void 0:ct.x)??0)),y:Math.abs(Math.round(at.pageY)-(((H=oe.current)==null?void 0:H.y)??0))}},Ue=at=>{_e.x<=10&&_e.y<=10?at.preventDefault():_.contains(at.target)||J(!1),document.removeEventListener("pointermove",Ne),oe.current=null};return oe.current!==null&&(document.addEventListener("pointermove",Ne),document.addEventListener("pointerup",Ue,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Ne),document.removeEventListener("pointerup",Ue,{capture:!0})}}},[_,J,oe]),x.useEffect(()=>{const _e=()=>J(!1);return window.addEventListener("blur",_e),window.addEventListener("resize",_e),()=>{window.removeEventListener("blur",_e),window.removeEventListener("resize",_e)}},[J]);const[B,$e]=kme(_e=>{const Ne=P().filter(ct=>!ct.disabled),Ue=Ne.find(ct=>ct.ref.current===document.activeElement),at=Cme(Ne,_e,Ue);at&&setTimeout(()=>at.ref.current.focus())}),Ye=x.useCallback((_e,Ne,Ue)=>{const at=!re.current&&!Ue;(b.value!==void 0&&b.value===Ne||at)&&(R(_e),at&&(re.current=!0))},[b.value]),$=x.useCallback(()=>_==null?void 0:_.focus(),[_]),Re=x.useCallback((_e,Ne,Ue)=>{const at=!re.current&&!Ue;(b.value!==void 0&&b.value===Ne||at)&&D(_e)},[b.value]),ke=r==="popper"?pL:ume,Me=ke===pL?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:h,collisionPadding:f,sticky:p,hideWhenDetached:g,avoidCollisions:y}:{};return m.jsx(lme,{scope:n,content:_,viewport:k,onViewportChange:T,itemRefCallback:Ye,selectedItem:C,onItemLeave:$,itemTextRefCallback:Re,focusSelectedItem:ee,selectedItemText:M,position:r,isPositioned:z,searchRef:B,children:m.jsx(S9,{as:aDe,allowPinchZoom:!0,children:m.jsx(x9,{asChild:!0,trapped:b.open,onMountAutoFocus:_e=>{_e.preventDefault()},onUnmountAutoFocus:et(i,_e=>{var Ne;(Ne=b.trigger)==null||Ne.focus({preventScroll:!0}),_e.preventDefault()}),children:m.jsx(e3,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:_e=>_e.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:m.jsx(ke,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:_e=>_e.preventDefault(),...v,...Me,onPlaced:()=>Z(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:et(v.onKeyDown,_e=>{const Ne=_e.ctrlKey||_e.altKey||_e.metaKey;if(_e.key==="Tab"&&_e.preventDefault(),!Ne&&_e.key.length===1&&$e(_e.key),["ArrowUp","ArrowDown","Home","End"].includes(_e.key)){let at=P().filter(ct=>!ct.disabled).map(ct=>ct.ref.current);if(["ArrowUp","End"].includes(_e.key)&&(at=at.slice().reverse()),["ArrowUp","ArrowDown"].includes(_e.key)){const ct=_e.target,H=at.indexOf(ct);at=at.slice(H+1)}setTimeout(()=>G(at)),_e.preventDefault()}})})})})})})});cme.displayName=oDe;var lDe="SelectItemAlignedPosition",ume=x.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...i}=t,s=p0(z1,n),o=m0(z1,n),[a,l]=x.useState(null),[c,u]=x.useState(null),d=Jt(e,E=>u(E)),h=B9(n),f=x.useRef(!1),p=x.useRef(!0),{viewport:g,selectedItem:y,selectedItemText:v,focusSelectedItem:b}=o,_=x.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&c&&g&&y&&v){const E=s.trigger.getBoundingClientRect(),C=c.getBoundingClientRect(),R=s.valueNode.getBoundingClientRect(),M=v.getBoundingClientRect();if(s.dir!=="rtl"){const ct=M.left-C.left,H=R.left-ct,Y=E.left-H,se=E.width+Y,me=Math.max(se,C.width),de=window.innerWidth-xc,ie=fL(H,[xc,Math.max(xc,de-me)]);a.style.minWidth=se+"px",a.style.left=ie+"px"}else{const ct=C.right-M.right,H=window.innerWidth-R.right-ct,Y=window.innerWidth-E.right-H,se=E.width+Y,me=Math.max(se,C.width),de=window.innerWidth-xc,ie=fL(H,[xc,Math.max(xc,de-me)]);a.style.minWidth=se+"px",a.style.right=ie+"px"}const D=h(),P=window.innerHeight-xc*2,z=g.scrollHeight,Z=window.getComputedStyle(c),re=parseInt(Z.borderTopWidth,10),G=parseInt(Z.paddingTop,10),ee=parseInt(Z.borderBottomWidth,10),J=parseInt(Z.paddingBottom,10),oe=re+G+z+J+ee,B=Math.min(y.offsetHeight*5,oe),$e=window.getComputedStyle(g),Ye=parseInt($e.paddingTop,10),$=parseInt($e.paddingBottom,10),Re=E.top+E.height/2-xc,ke=P-Re,Me=y.offsetHeight/2,_e=y.offsetTop+Me,Ne=re+G+_e,Ue=oe-Ne;if(Ne<=Re){const ct=D.length>0&&y===D[D.length-1].ref.current;a.style.bottom="0px";const H=c.clientHeight-g.offsetTop-g.offsetHeight,Y=Math.max(ke,Me+(ct?$:0)+H+ee),se=Ne+Y;a.style.height=se+"px"}else{const ct=D.length>0&&y===D[0].ref.current;a.style.top="0px";const Y=Math.max(Re,re+g.offsetTop+(ct?Ye:0)+Me)+Ue;a.style.height=Y+"px",g.scrollTop=Ne-Re+g.offsetTop}a.style.margin=`${xc}px 0`,a.style.minHeight=B+"px",a.style.maxHeight=P+"px",r==null||r(),requestAnimationFrame(()=>f.current=!0)}},[h,s.trigger,s.valueNode,a,c,g,y,v,s.dir,r]);zi(()=>_(),[_]);const[S,k]=x.useState();zi(()=>{c&&k(window.getComputedStyle(c).zIndex)},[c]);const T=x.useCallback(E=>{E&&p.current===!0&&(_(),b==null||b(),p.current=!1)},[_,b]);return m.jsx(uDe,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:f,onScrollButtonChange:T,children:m.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:m.jsx(xt.div,{...i,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});ume.displayName=lDe;var cDe="SelectPopperPosition",pL=x.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=xc,...s}=t,o=F9(n);return m.jsx(l$,{...o,...s,ref:e,align:r,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});pL.displayName=cDe;var[uDe,C$]=Ux(z1,{}),mL="SelectViewport",dme=x.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...i}=t,s=m0(mL,n),o=C$(mL,n),a=Jt(e,s.onViewportChange),l=x.useRef(0);return m.jsxs(m.Fragment,{children:[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}),m.jsx(j9.Slot,{scope:n,children:m.jsx(xt.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:et(i.onScroll,c=>{const u=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:h}=o;if(h!=null&&h.current&&d){const f=Math.abs(l.current-u.scrollTop);if(f>0){const p=window.innerHeight-xc*2,g=parseFloat(d.style.minHeight),y=parseFloat(d.style.height),v=Math.max(g,y);if(v<p){const b=v+f,_=Math.min(p,b),S=b-_;d.style.height=_+"px",d.style.bottom==="0px"&&(u.scrollTop=S>0?S:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});dme.displayName=mL;var hme="SelectGroup",[dDe,hDe]=Ux(hme),fDe=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=zc();return m.jsx(dDe,{scope:n,id:i,children:m.jsx(xt.div,{role:"group","aria-labelledby":i,...r,ref:e})})});fDe.displayName=hme;var fme="SelectLabel",pDe=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=hDe(fme,n);return m.jsx(xt.div,{id:i.id,...r,ref:e})});pDe.displayName=fme;var i7="SelectItem",[mDe,pme]=Ux(i7),mme=x.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...o}=t,a=p0(i7,n),l=m0(i7,n),c=a.value===r,[u,d]=x.useState(s??""),[h,f]=x.useState(!1),p=Jt(e,b=>{var _;return(_=l.itemRefCallback)==null?void 0:_.call(l,b,r,i)}),g=zc(),y=x.useRef("touch"),v=()=>{i||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return m.jsx(mDe,{scope:n,value:r,disabled:i,textId:g,isSelected:c,onItemTextChange:x.useCallback(b=>{d(_=>_||((b==null?void 0:b.textContent)??"").trim())},[]),children:m.jsx(j9.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:m.jsx(xt.div,{role:"option","aria-labelledby":g,"data-highlighted":h?"":void 0,"aria-selected":c&&h,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:p,onFocus:et(o.onFocus,()=>f(!0)),onBlur:et(o.onBlur,()=>f(!1)),onClick:et(o.onClick,()=>{y.current!=="mouse"&&v()}),onPointerUp:et(o.onPointerUp,()=>{y.current==="mouse"&&v()}),onPointerDown:et(o.onPointerDown,b=>{y.current=b.pointerType}),onPointerMove:et(o.onPointerMove,b=>{var _;y.current=b.pointerType,i?(_=l.onItemLeave)==null||_.call(l):y.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:et(o.onPointerLeave,b=>{var _;b.currentTarget===document.activeElement&&((_=l.onItemLeave)==null||_.call(l))}),onKeyDown:et(o.onKeyDown,b=>{var S;((S=l.searchRef)==null?void 0:S.current)!==""&&b.key===" "||(JOe.includes(b.key)&&v(),b.key===" "&&b.preventDefault())})})})})});mme.displayName=i7;var b4="SelectItemText",gme=x.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,...s}=t,o=p0(b4,n),a=m0(b4,n),l=pme(b4,n),c=rDe(b4,n),[u,d]=x.useState(null),h=Jt(e,v=>d(v),l.onItemTextChange,v=>{var b;return(b=a.itemTextRefCallback)==null?void 0:b.call(a,v,l.value,l.disabled)}),f=u==null?void 0:u.textContent,p=x.useMemo(()=>m.jsx("option",{value:l.value,disabled:l.disabled,children:f},l.value),[l.disabled,l.value,f]),{onNativeOptionAdd:g,onNativeOptionRemove:y}=c;return zi(()=>(g(p),()=>y(p)),[g,y,p]),m.jsxs(m.Fragment,{children:[m.jsx(xt.span,{id:l.textId,...s,ref:h}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?nc.createPortal(s.children,o.valueNode):null]})});gme.displayName=b4;var yme="SelectItemIndicator",vme=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return pme(yme,n).isSelected?m.jsx(xt.span,{"aria-hidden":!0,...r,ref:e}):null});vme.displayName=yme;var gL="SelectScrollUpButton",bme=x.forwardRef((t,e)=>{const n=m0(gL,t.__scopeSelect),r=C$(gL,t.__scopeSelect),[i,s]=x.useState(!1),o=Jt(e,r.onScrollButtonChange);return zi(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;s(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?m.jsx(xme,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});bme.displayName=gL;var yL="SelectScrollDownButton",wme=x.forwardRef((t,e)=>{const n=m0(yL,t.__scopeSelect),r=C$(yL,t.__scopeSelect),[i,s]=x.useState(!1),o=Jt(e,r.onScrollButtonChange);return zi(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;s(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?m.jsx(xme,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});wme.displayName=yL;var xme=x.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=t,s=m0("SelectScrollButton",n),o=x.useRef(null),a=B9(n),l=x.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return x.useEffect(()=>()=>l(),[l]),zi(()=>{var u;const c=a().find(d=>d.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),m.jsx(xt.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:et(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:et(i.onPointerMove,()=>{var c;(c=s.onItemLeave)==null||c.call(s),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:et(i.onPointerLeave,()=>{l()})})}),gDe="SelectSeparator",yDe=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return m.jsx(xt.div,{"aria-hidden":!0,...r,ref:e})});yDe.displayName=gDe;var vL="SelectArrow",vDe=x.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=F9(n),s=p0(vL,n),o=m0(vL,n);return s.open&&o.position==="popper"?m.jsx(c$,{...i,...r,ref:e}):null});vDe.displayName=vL;var bDe="SelectBubbleInput",_me=x.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const i=x.useRef(null),s=Jt(r,i),o=C9(e);return x.useEffect(()=>{const a=i.current;if(!a)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==e&&u){const d=new Event("change",{bubbles:!0});u.call(a,e),a.dispatchEvent(d)}},[o,e]),m.jsx(xt.select,{...n,style:{...Ehe,...n.style},ref:s,defaultValue:e})});_me.displayName=bDe;function Sme(t){return t===""||t===void 0}function kme(t){const e=ds(t),n=x.useRef(""),r=x.useRef(0),i=x.useCallback(o=>{const a=n.current+o;e(a),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[e]),s=x.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return x.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}function Cme(t,e,n){const i=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let o=wDe(t,Math.max(s,0));i.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function wDe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var xDe=eme,_De=nme,SDe=ime,kDe=sme,CDe=ome,EDe=ame,TDe=dme,ADe=mme,IDe=gme,RDe=vme,MDe=bme,NDe=wme,ODe="Separator",dX="horizontal",DDe=["horizontal","vertical"],Eme=x.forwardRef((t,e)=>{const{decorative:n,orientation:r=dX,...i}=t,s=PDe(r)?r:dX,a=n?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return m.jsx(xt.div,{"data-orientation":s,...a,...i,ref:e})});Eme.displayName=ODe;function PDe(t){return DDe.includes(t)}var LDe=Eme,V9="Switch",[zDe]=ao(V9),[jDe,BDe]=zDe(V9),Tme=x.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:s,required:o,disabled:a,value:l="on",onCheckedChange:c,form:u,...d}=t,[h,f]=x.useState(null),p=Jt(e,_=>f(_)),g=x.useRef(!1),y=h?u||!!h.closest("form"):!0,[v,b]=gd({prop:i,defaultProp:s??!1,onChange:c,caller:V9});return m.jsxs(jDe,{scope:n,checked:v,disabled:a,children:[m.jsx(xt.button,{type:"button",role:"switch","aria-checked":v,"aria-required":o,"data-state":Mme(v),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:p,onClick:et(t.onClick,_=>{b(S=>!S),y&&(g.current=_.isPropagationStopped(),g.current||_.stopPropagation())})}),y&&m.jsx(Rme,{control:h,bubbles:!g.current,name:r,value:l,checked:v,required:o,disabled:a,form:u,style:{transform:"translateX(-100%)"}})]})});Tme.displayName=V9;var Ame="SwitchThumb",Ime=x.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,i=BDe(Ame,n);return m.jsx(xt.span,{"data-state":Mme(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:e})});Ime.displayName=Ame;var FDe="SwitchBubbleInput",Rme=x.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...i},s)=>{const o=x.useRef(null),a=Jt(o,s),l=C9(n),c=E9(e);return x.useEffect(()=>{const u=o.current;if(!u)return;const d=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(d,"checked").set;if(l!==n&&f){const p=new Event("click",{bubbles:r});f.call(u,n),u.dispatchEvent(p)}},[l,n,r]),m.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:a,style:{...i.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Rme.displayName=FDe;function Mme(t){return t?"checked":"unchecked"}var VDe=Tme,$De=Ime,$9="Tabs",[HDe]=ao($9,[Hx]),Nme=Hx(),[UDe,E$]=HDe($9),Ome=x.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:s,orientation:o="horizontal",dir:a,activationMode:l="automatic",...c}=t,u=Bx(a),[d,h]=gd({prop:r,onChange:i,defaultProp:s??"",caller:$9});return m.jsx(UDe,{scope:n,baseId:zc(),value:d,onValueChange:h,orientation:o,dir:u,activationMode:l,children:m.jsx(xt.div,{dir:u,"data-orientation":o,...c,ref:e})})});Ome.displayName=$9;var Dme="TabsList",Pme=x.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...i}=t,s=E$(Dme,n),o=Nme(n);return m.jsx(u$,{asChild:!0,...o,orientation:s.orientation,dir:s.dir,loop:r,children:m.jsx(xt.div,{role:"tablist","aria-orientation":s.orientation,...i,ref:e})})});Pme.displayName=Dme;var Lme="TabsTrigger",zme=x.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...s}=t,o=E$(Lme,n),a=Nme(n),l=Fme(o.baseId,r),c=Vme(o.baseId,r),u=r===o.value;return m.jsx(d$,{asChild:!0,...a,focusable:!i,active:u,children:m.jsx(xt.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...s,ref:e,onMouseDown:et(t.onMouseDown,d=>{!i&&d.button===0&&d.ctrlKey===!1?o.onValueChange(r):d.preventDefault()}),onKeyDown:et(t.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&o.onValueChange(r)}),onFocus:et(t.onFocus,()=>{const d=o.activationMode!=="manual";!u&&!i&&d&&o.onValueChange(r)})})})});zme.displayName=Lme;var jme="TabsContent",Bme=x.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:i,children:s,...o}=t,a=E$(jme,n),l=Fme(a.baseId,r),c=Vme(a.baseId,r),u=r===a.value,d=x.useRef(u);return x.useEffect(()=>{const h=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(h)},[]),m.jsx(Fs,{present:i||u,children:({present:h})=>m.jsx(xt.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:c,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:d.current?"0s":void 0},children:h&&s})})});Bme.displayName=jme;function Fme(t,e){return`${t}-trigger-${e}`}function Vme(t,e){return`${t}-content-${e}`}var qDe=Ome,WDe=Pme,GDe=zme,KDe=Bme,[H9]=ao("Tooltip",[$x]),U9=$x(),$me="TooltipProvider",YDe=700,bL="tooltip.open",[ZDe,T$]=H9($me),Hme=t=>{const{__scopeTooltip:e,delayDuration:n=YDe,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=t,o=x.useRef(!0),a=x.useRef(!1),l=x.useRef(0);return x.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),m.jsx(ZDe,{scope:e,isOpenDelayedRef:o,delayDuration:n,onOpen:x.useCallback(()=>{window.clearTimeout(l.current),o.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:x.useCallback(c=>{a.current=c},[]),disableHoverableContent:i,children:s})};Hme.displayName=$me;var OS="Tooltip",[XDe,o3]=H9(OS),Ume=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=t,l=T$(OS,t.__scopeTooltip),c=U9(e),[u,d]=x.useState(null),h=zc(),f=x.useRef(0),p=o??l.disableHoverableContent,g=a??l.delayDuration,y=x.useRef(!1),[v,b]=gd({prop:r,defaultProp:i??!1,onChange:E=>{E?(l.onOpen(),document.dispatchEvent(new CustomEvent(bL))):l.onClose(),s==null||s(E)},caller:OS}),_=x.useMemo(()=>v?y.current?"delayed-open":"instant-open":"closed",[v]),S=x.useCallback(()=>{window.clearTimeout(f.current),f.current=0,y.current=!1,b(!0)},[b]),k=x.useCallback(()=>{window.clearTimeout(f.current),f.current=0,b(!1)},[b]),T=x.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{y.current=!0,b(!0),f.current=0},g)},[g,b]);return x.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),m.jsx(o$,{...c,children:m.jsx(XDe,{scope:e,contentId:h,open:v,stateAttribute:_,trigger:u,onTriggerChange:d,onTriggerEnter:x.useCallback(()=>{l.isOpenDelayedRef.current?T():S()},[l.isOpenDelayedRef,T,S]),onTriggerLeave:x.useCallback(()=>{p?k():(window.clearTimeout(f.current),f.current=0)},[k,p]),onOpen:S,onClose:k,disableHoverableContent:p,children:n})})};Ume.displayName=OS;var wL="TooltipTrigger",qme=x.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=o3(wL,n),s=T$(wL,n),o=U9(n),a=x.useRef(null),l=Jt(e,a,i.onTriggerChange),c=x.useRef(!1),u=x.useRef(!1),d=x.useCallback(()=>c.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),m.jsx(a$,{asChild:!0,...o,children:m.jsx(xt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:et(t.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:et(t.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:et(t.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:et(t.onFocus,()=>{c.current||i.onOpen()}),onBlur:et(t.onBlur,i.onClose),onClick:et(t.onClick,i.onClose)})})});qme.displayName=wL;var A$="TooltipPortal",[QDe,JDe]=H9(A$,{forceMount:void 0}),Wme=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:i}=t,s=o3(A$,e);return m.jsx(QDe,{scope:e,forceMount:n,children:m.jsx(Fs,{present:n||s.open,children:m.jsx(t3,{asChild:!0,container:i,children:r})})})};Wme.displayName=A$;var Vw="TooltipContent",Gme=x.forwardRef((t,e)=>{const n=JDe(Vw,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=t,o=o3(Vw,t.__scopeTooltip);return m.jsx(Fs,{present:r||o.open,children:o.disableHoverableContent?m.jsx(Kme,{side:i,...s,ref:e}):m.jsx(ePe,{side:i,...s,ref:e})})}),ePe=x.forwardRef((t,e)=>{const n=o3(Vw,t.__scopeTooltip),r=T$(Vw,t.__scopeTooltip),i=x.useRef(null),s=Jt(e,i),[o,a]=x.useState(null),{trigger:l,onClose:c}=n,u=i.current,{onPointerInTransitChange:d}=r,h=x.useCallback(()=>{a(null),d(!1)},[d]),f=x.useCallback((p,g)=>{const y=p.currentTarget,v={x:p.clientX,y:p.clientY},b=iPe(v,y.getBoundingClientRect()),_=sPe(v,b),S=oPe(g.getBoundingClientRect()),k=lPe([..._,...S]);a(k),d(!0)},[d]);return x.useEffect(()=>()=>h(),[h]),x.useEffect(()=>{if(l&&u){const p=y=>f(y,u),g=y=>f(y,l);return l.addEventListener("pointerleave",p),u.addEventListener("pointerleave",g),()=>{l.removeEventListener("pointerleave",p),u.removeEventListener("pointerleave",g)}}},[l,u,f,h]),x.useEffect(()=>{if(o){const p=g=>{const y=g.target,v={x:g.clientX,y:g.clientY},b=(l==null?void 0:l.contains(y))||(u==null?void 0:u.contains(y)),_=!aPe(v,o);b?h():_&&(h(),c())};return document.addEventListener("pointermove",p),()=>document.removeEventListener("pointermove",p)}},[l,u,o,c,h]),m.jsx(Kme,{...t,ref:s})}),[tPe,nPe]=H9(OS,{isInside:!1}),rPe=C9e("TooltipContent"),Kme=x.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=t,l=o3(Vw,n),c=U9(n),{onClose:u}=l;return x.useEffect(()=>(document.addEventListener(bL,u),()=>document.removeEventListener(bL,u)),[u]),x.useEffect(()=>{if(l.trigger){const d=h=>{const f=h.target;f!=null&&f.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),m.jsx(e3,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:m.jsxs(l$,{"data-state":l.stateAttribute,...c,...a,ref:e,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[m.jsx(rPe,{children:r}),m.jsx(tPe,{scope:n,isInside:!0,children:m.jsx(M9e,{id:l.contentId,role:"tooltip",children:i||r})})]})})});Gme.displayName=Vw;var Yme="TooltipArrow",Zme=x.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=U9(n);return nPe(Yme,n).isInside?null:m.jsx(c$,{...i,...r,ref:e})});Zme.displayName=Yme;function iPe(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),s=Math.abs(e.left-t.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function sPe(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function oPe(t){const{top:e,right:n,bottom:r,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:r},{x:i,y:r}]}function aPe(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,o=e.length-1;s<e.length;o=s++){const a=e[s],l=e[o],c=a.x,u=a.y,d=l.x,h=l.y;u>r!=h>r&&n<(d-c)*(r-u)/(h-u)+c&&(i=!i)}return i}function lPe(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),cPe(e)}function cPe(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const i=t[r];for(;e.length>=2;){const s=e[e.length-1],o=e[e.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const i=t[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var uPe=Hme,dPe=Ume,hPe=qme,fPe=Wme,pPe=Gme,mPe=Zme;function Xme(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=Xme(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function ji(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=Xme(t))&&(r&&(r+=" "),r+=e);return r}const gPe=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r<t.length;r++)n[r]=t[r];for(let r=0;r<e.length;r++)n[t.length+r]=e[r];return n},yPe=(t,e)=>({classGroupId:t,validator:e}),Qme=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),s7="-",hX=[],vPe="arbitrary..",bPe=t=>{const e=xPe(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return wPe(o);const a=o.split(s7),l=a[0]===""&&a.length>1?1:0;return Jme(a,l,e)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=r[o],c=n[o];return l?c?gPe(c,l):l:c||hX}return n[o]||hX}}},Jme=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const i=t[e],s=n.nextPart.get(i);if(s){const c=Jme(t,e+1,s);if(c)return c}const o=n.validators;if(o===null)return;const a=e===0?t.join(s7):t.slice(e).join(s7),l=o.length;for(let c=0;c<l;c++){const u=o[c];if(u.validator(a))return u.classGroupId}},wPe=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?vPe+r:void 0})(),xPe=t=>{const{theme:e,classGroups:n}=t;return _Pe(n,e)},_Pe=(t,e)=>{const n=Qme();for(const r in t){const i=t[r];I$(i,n,r,e)}return n},I$=(t,e,n,r)=>{const i=t.length;for(let s=0;s<i;s++){const o=t[s];SPe(o,e,n,r)}},SPe=(t,e,n,r)=>{if(typeof t=="string"){kPe(t,e,n);return}if(typeof t=="function"){CPe(t,e,n,r);return}EPe(t,e,n,r)},kPe=(t,e,n)=>{const r=t===""?e:e0e(e,t);r.classGroupId=n},CPe=(t,e,n,r)=>{if(TPe(t)){I$(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(yPe(n,t))},EPe=(t,e,n,r)=>{const i=Object.entries(t),s=i.length;for(let o=0;o<s;o++){const[a,l]=i[o];I$(l,e0e(e,a),n,r)}},e0e=(t,e)=>{let n=t;const r=e.split(s7),i=r.length;for(let s=0;s<i;s++){const o=r[s];let a=n.nextPart.get(o);a||(a=Qme(),n.nextPart.set(o,a)),n=a}return n},TPe=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,APe=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const i=(s,o)=>{n[s]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(s){let o=n[s];if(o!==void 0)return o;if((o=r[s])!==void 0)return i(s,o),o},set(s,o){s in n?n[s]=o:i(s,o)}}},xL="!",fX=":",IPe=[],pX=(t,e,n,r,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),RPe=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=i=>{const s=[];let o=0,a=0,l=0,c;const u=i.length;for(let g=0;g<u;g++){const y=i[g];if(o===0&&a===0){if(y===fX){s.push(i.slice(l,g)),l=g+1;continue}if(y==="/"){c=g;continue}}y==="["?o++:y==="]"?o--:y==="("?a++:y===")"&&a--}const d=s.length===0?i:i.slice(l);let h=d,f=!1;d.endsWith(xL)?(h=d.slice(0,-1),f=!0):d.startsWith(xL)&&(h=d.slice(1),f=!0);const p=c&&c>l?c-l:void 0;return pX(s,f,h,p)};if(e){const i=e+fX,s=r;r=o=>o.startsWith(i)?s(o.slice(i.length)):pX(IPe,!1,o,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},MPe=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let s=0;s<n.length;s++){const o=n[s],a=o[0]==="[",l=e.has(o);a||l?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(o)):i.push(o)}return i.length>0&&(i.sort(),r.push(...i)),r}},NPe=t=>({cache:APe(t.cacheSize),parseClassName:RPe(t),sortModifiers:MPe(t),...bPe(t)}),OPe=/\s+/,DPe=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=e,o=[],a=t.trim().split(OPe);let l="";for(let c=a.length-1;c>=0;c-=1){const u=a[c],{isExternal:d,modifiers:h,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:g}=n(u);if(d){l=u+(l.length>0?" "+l:l);continue}let y=!!g,v=r(y?p.substring(0,g):p);if(!v){if(!y){l=u+(l.length>0?" "+l:l);continue}if(v=r(p),!v){l=u+(l.length>0?" "+l:l);continue}y=!1}const b=h.length===0?"":h.length===1?h[0]:s(h).join(":"),_=f?b+xL:b,S=_+v;if(o.indexOf(S)>-1)continue;o.push(S);const k=i(v,y);for(let T=0;T<k.length;++T){const E=k[T];o.push(_+E)}l=u+(l.length>0?" "+l:l)}return l},PPe=(...t)=>{let e=0,n,r,i="";for(;e<t.length;)(n=t[e++])&&(r=t0e(n))&&(i&&(i+=" "),i+=r);return i},t0e=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=t0e(t[r]))&&(n&&(n+=" "),n+=e);return n},LPe=(t,...e)=>{let n,r,i,s;const o=l=>{const c=e.reduce((u,d)=>d(u),t());return n=NPe(c),r=n.cache.get,i=n.cache.set,s=a,a(l)},a=l=>{const c=r(l);if(c)return c;const u=DPe(l,n);return i(l,u),u};return s=o,(...l)=>s(PPe(...l))},zPe=[],qi=t=>{const e=n=>n[t]||zPe;return e.isThemeGetter=!0,e},n0e=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,r0e=/^\((?:(\w[\w-]*):)?(.+)\)$/i,jPe=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,BPe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,FPe=/\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$/,VPe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$Pe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,HPe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Uf=t=>jPe.test(t),ln=t=>!!t&&!Number.isNaN(Number(t)),qf=t=>!!t&&Number.isInteger(Number(t)),bN=t=>t.endsWith("%")&&ln(t.slice(0,-1)),qd=t=>BPe.test(t),i0e=()=>!0,UPe=t=>FPe.test(t)&&!VPe.test(t),R$=()=>!1,qPe=t=>$Pe.test(t),WPe=t=>HPe.test(t),GPe=t=>!gt(t)&&!yt(t),KPe=t=>g0(t,a0e,R$),gt=t=>n0e.test(t),q0=t=>g0(t,l0e,UPe),mX=t=>g0(t,nLe,ln),YPe=t=>g0(t,u0e,i0e),ZPe=t=>g0(t,c0e,R$),gX=t=>g0(t,s0e,R$),XPe=t=>g0(t,o0e,WPe),JC=t=>g0(t,d0e,qPe),yt=t=>r0e.test(t),q2=t=>by(t,l0e),QPe=t=>by(t,c0e),yX=t=>by(t,s0e),JPe=t=>by(t,a0e),eLe=t=>by(t,o0e),eE=t=>by(t,d0e,!0),tLe=t=>by(t,u0e,!0),g0=(t,e,n)=>{const r=n0e.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},by=(t,e,n=!1)=>{const r=r0e.exec(t);return r?r[1]?e(r[1]):n:!1},s0e=t=>t==="position"||t==="percentage",o0e=t=>t==="image"||t==="url",a0e=t=>t==="length"||t==="size"||t==="bg-size",l0e=t=>t==="length",nLe=t=>t==="number",c0e=t=>t==="family-name",u0e=t=>t==="number"||t==="weight",d0e=t=>t==="shadow",rLe=()=>{const t=qi("color"),e=qi("font"),n=qi("text"),r=qi("font-weight"),i=qi("tracking"),s=qi("leading"),o=qi("breakpoint"),a=qi("container"),l=qi("spacing"),c=qi("radius"),u=qi("shadow"),d=qi("inset-shadow"),h=qi("text-shadow"),f=qi("drop-shadow"),p=qi("blur"),g=qi("perspective"),y=qi("aspect"),v=qi("ease"),b=qi("animate"),_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...S(),yt,gt],T=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],C=()=>[yt,gt,l],R=()=>[Uf,"full","auto",...C()],M=()=>[qf,"none","subgrid",yt,gt],D=()=>["auto",{span:["full",qf,yt,gt]},qf,yt,gt],P=()=>[qf,"auto",yt,gt],z=()=>["auto","min","max","fr",yt,gt],Z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],re=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...C()],ee=()=>[Uf,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...C()],J=()=>[Uf,"screen","full","dvw","lvw","svw","min","max","fit",...C()],oe=()=>[Uf,"screen","full","lh","dvh","lvh","svh","min","max","fit",...C()],B=()=>[t,yt,gt],$e=()=>[...S(),yX,gX,{position:[yt,gt]}],Ye=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",JPe,KPe,{size:[yt,gt]}],Re=()=>[bN,q2,q0],ke=()=>["","none","full",c,yt,gt],Me=()=>["",ln,q2,q0],_e=()=>["solid","dashed","dotted","double"],Ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ue=()=>[ln,bN,yX,gX],at=()=>["","none",p,yt,gt],ct=()=>["none",ln,yt,gt],H=()=>["none",ln,yt,gt],Y=()=>[ln,yt,gt],se=()=>[Uf,"full",...C()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[qd],breakpoint:[qd],color:[i0e],container:[qd],"drop-shadow":[qd],ease:["in","out","in-out"],font:[GPe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[qd],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[qd],shadow:[qd],spacing:["px",ln],text:[qd],"text-shadow":[qd],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Uf,gt,yt,y]}],container:["container"],columns:[{columns:[ln,gt,yt,a]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"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:k()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:R()}],"inset-x":[{"inset-x":R()}],"inset-y":[{"inset-y":R()}],start:[{"inset-s":R(),start:R()}],end:[{"inset-e":R(),end:R()}],"inset-bs":[{"inset-bs":R()}],"inset-be":[{"inset-be":R()}],top:[{top:R()}],right:[{right:R()}],bottom:[{bottom:R()}],left:[{left:R()}],visibility:["visible","invisible","collapse"],z:[{z:[qf,"auto",yt,gt]}],basis:[{basis:[Uf,"full","auto",a,...C()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ln,Uf,"auto","initial","none",gt]}],grow:[{grow:["",ln,yt,gt]}],shrink:[{shrink:["",ln,yt,gt]}],order:[{order:[qf,"first","last","none",yt,gt]}],"grid-cols":[{"grid-cols":M()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":M()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":z()}],"auto-rows":[{"auto-rows":z()}],gap:[{gap:C()}],"gap-x":[{"gap-x":C()}],"gap-y":[{"gap-y":C()}],"justify-content":[{justify:[...Z(),"normal"]}],"justify-items":[{"justify-items":[...re(),"normal"]}],"justify-self":[{"justify-self":["auto",...re()]}],"align-content":[{content:["normal",...Z()]}],"align-items":[{items:[...re(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...re(),{baseline:["","last"]}]}],"place-content":[{"place-content":Z()}],"place-items":[{"place-items":[...re(),"baseline"]}],"place-self":[{"place-self":["auto",...re()]}],p:[{p:C()}],px:[{px:C()}],py:[{py:C()}],ps:[{ps:C()}],pe:[{pe:C()}],pbs:[{pbs:C()}],pbe:[{pbe:C()}],pt:[{pt:C()}],pr:[{pr:C()}],pb:[{pb:C()}],pl:[{pl:C()}],m:[{m:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mbs:[{mbs:G()}],mbe:[{mbe:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":C()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":C()}],"space-y-reverse":["space-y-reverse"],size:[{size:ee()}],"inline-size":[{inline:["auto",...J()]}],"min-inline-size":[{"min-inline":["auto",...J()]}],"max-inline-size":[{"max-inline":["none",...J()]}],"block-size":[{block:["auto",...oe()]}],"min-block-size":[{"min-block":["auto",...oe()]}],"max-block-size":[{"max-block":["none",...oe()]}],w:[{w:[a,"screen",...ee()]}],"min-w":[{"min-w":[a,"screen","none",...ee()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...ee()]}],h:[{h:["screen","lh",...ee()]}],"min-h":[{"min-h":["screen","lh","none",...ee()]}],"max-h":[{"max-h":["screen","lh",...ee()]}],"font-size":[{text:["base",n,q2,q0]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,tLe,YPe]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",bN,gt]}],"font-family":[{font:[QPe,ZPe,e]}],"font-features":[{"font-features":[gt]}],"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,yt,gt]}],"line-clamp":[{"line-clamp":[ln,"none",yt,mX]}],leading:[{leading:[s,...C()]}],"list-image":[{"list-image":["none",yt,gt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",yt,gt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[..._e(),"wavy"]}],"text-decoration-thickness":[{decoration:[ln,"from-font","auto",yt,q0]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[ln,"auto",yt,gt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:C()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",yt,gt]}],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",yt,gt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:$e()}],"bg-repeat":[{bg:Ye()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},qf,yt,gt],radial:["",yt,gt],conic:[qf,yt,gt]},eLe,XPe]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:Re()}],"gradient-via-pos":[{via:Re()}],"gradient-to-pos":[{to:Re()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:ke()}],"rounded-s":[{"rounded-s":ke()}],"rounded-e":[{"rounded-e":ke()}],"rounded-t":[{"rounded-t":ke()}],"rounded-r":[{"rounded-r":ke()}],"rounded-b":[{"rounded-b":ke()}],"rounded-l":[{"rounded-l":ke()}],"rounded-ss":[{"rounded-ss":ke()}],"rounded-se":[{"rounded-se":ke()}],"rounded-ee":[{"rounded-ee":ke()}],"rounded-es":[{"rounded-es":ke()}],"rounded-tl":[{"rounded-tl":ke()}],"rounded-tr":[{"rounded-tr":ke()}],"rounded-br":[{"rounded-br":ke()}],"rounded-bl":[{"rounded-bl":ke()}],"border-w":[{border:Me()}],"border-w-x":[{"border-x":Me()}],"border-w-y":[{"border-y":Me()}],"border-w-s":[{"border-s":Me()}],"border-w-e":[{"border-e":Me()}],"border-w-bs":[{"border-bs":Me()}],"border-w-be":[{"border-be":Me()}],"border-w-t":[{"border-t":Me()}],"border-w-r":[{"border-r":Me()}],"border-w-b":[{"border-b":Me()}],"border-w-l":[{"border-l":Me()}],"divide-x":[{"divide-x":Me()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Me()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[..._e(),"hidden","none"]}],"divide-style":[{divide:[..._e(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-bs":[{"border-bs":B()}],"border-color-be":[{"border-be":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}],"divide-color":[{divide:B()}],"outline-style":[{outline:[..._e(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ln,yt,gt]}],"outline-w":[{outline:["",ln,q2,q0]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",u,eE,JC]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",d,eE,JC]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:Me()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[ln,q0]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":Me()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",h,eE,JC]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[ln,yt,gt]}],"mix-blend":[{"mix-blend":[...Ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ne()}],"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":[ln]}],"mask-image-linear-from-pos":[{"mask-linear-from":Ue()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ue()}],"mask-image-linear-from-color":[{"mask-linear-from":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"mask-image-t-from-pos":[{"mask-t-from":Ue()}],"mask-image-t-to-pos":[{"mask-t-to":Ue()}],"mask-image-t-from-color":[{"mask-t-from":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"mask-image-r-from-pos":[{"mask-r-from":Ue()}],"mask-image-r-to-pos":[{"mask-r-to":Ue()}],"mask-image-r-from-color":[{"mask-r-from":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"mask-image-b-from-pos":[{"mask-b-from":Ue()}],"mask-image-b-to-pos":[{"mask-b-to":Ue()}],"mask-image-b-from-color":[{"mask-b-from":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"mask-image-l-from-pos":[{"mask-l-from":Ue()}],"mask-image-l-to-pos":[{"mask-l-to":Ue()}],"mask-image-l-from-color":[{"mask-l-from":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"mask-image-x-from-pos":[{"mask-x-from":Ue()}],"mask-image-x-to-pos":[{"mask-x-to":Ue()}],"mask-image-x-from-color":[{"mask-x-from":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"mask-image-y-from-pos":[{"mask-y-from":Ue()}],"mask-image-y-to-pos":[{"mask-y-to":Ue()}],"mask-image-y-from-color":[{"mask-y-from":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[yt,gt]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ue()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ue()}],"mask-image-radial-from-color":[{"mask-radial-from":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"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":S()}],"mask-image-conic-pos":[{"mask-conic":[ln]}],"mask-image-conic-from-pos":[{"mask-conic-from":Ue()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ue()}],"mask-image-conic-from-color":[{"mask-conic-from":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:$e()}],"mask-repeat":[{mask:Ye()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",yt,gt]}],filter:[{filter:["","none",yt,gt]}],blur:[{blur:at()}],brightness:[{brightness:[ln,yt,gt]}],contrast:[{contrast:[ln,yt,gt]}],"drop-shadow":[{"drop-shadow":["","none",f,eE,JC]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",ln,yt,gt]}],"hue-rotate":[{"hue-rotate":[ln,yt,gt]}],invert:[{invert:["",ln,yt,gt]}],saturate:[{saturate:[ln,yt,gt]}],sepia:[{sepia:["",ln,yt,gt]}],"backdrop-filter":[{"backdrop-filter":["","none",yt,gt]}],"backdrop-blur":[{"backdrop-blur":at()}],"backdrop-brightness":[{"backdrop-brightness":[ln,yt,gt]}],"backdrop-contrast":[{"backdrop-contrast":[ln,yt,gt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ln,yt,gt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ln,yt,gt]}],"backdrop-invert":[{"backdrop-invert":["",ln,yt,gt]}],"backdrop-opacity":[{"backdrop-opacity":[ln,yt,gt]}],"backdrop-saturate":[{"backdrop-saturate":[ln,yt,gt]}],"backdrop-sepia":[{"backdrop-sepia":["",ln,yt,gt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":C()}],"border-spacing-x":[{"border-spacing-x":C()}],"border-spacing-y":[{"border-spacing-y":C()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",yt,gt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ln,"initial",yt,gt]}],ease:[{ease:["linear","initial",v,yt,gt]}],delay:[{delay:[ln,yt,gt]}],animate:[{animate:["none",b,yt,gt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,yt,gt]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:ct()}],"rotate-x":[{"rotate-x":ct()}],"rotate-y":[{"rotate-y":ct()}],"rotate-z":[{"rotate-z":ct()}],scale:[{scale:H()}],"scale-x":[{"scale-x":H()}],"scale-y":[{"scale-y":H()}],"scale-z":[{"scale-z":H()}],"scale-3d":["scale-3d"],skew:[{skew:Y()}],"skew-x":[{"skew-x":Y()}],"skew-y":[{"skew-y":Y()}],transform:[{transform:[yt,gt,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:se()}],"translate-x":[{"translate-x":se()}],"translate-y":[{"translate-y":se()}],"translate-z":[{"translate-z":se()}],"translate-none":["translate-none"],accent:[{accent:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",yt,gt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mbs":[{"scroll-mbs":C()}],"scroll-mbe":[{"scroll-mbe":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pbs":[{"scroll-pbs":C()}],"scroll-pbe":[{"scroll-pbe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",yt,gt]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[ln,q2,q0,mX]}],stroke:[{stroke:["none",...B()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},iLe=LPe(rLe);function He(...t){return iLe(ji(t))}function o7(t){return(t.split("@")[0]??"").slice(0,2).toUpperCase()}function h0e(t){return[...new Set(t)]}function sLe({delayDuration:t=0,...e}){return m.jsx(uPe,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function tb({...t}){return m.jsx(dPe,{"data-slot":"tooltip",...t})}function nb({...t}){return m.jsx(hPe,{"data-slot":"tooltip-trigger",...t})}function rb({className:t,sideOffset:e=0,children:n,...r}){return m.jsx(fPe,{children:m.jsxs(pPe,{"data-slot":"tooltip-content",sideOffset:e,className:He("data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 rounded-md px-3 py-1.5 text-xs bg-foreground text-background z-50 w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin)",t),...r,children:[n,m.jsx(mPe,{className:"size-2.5 rotate-45 rounded-[2px] bg-foreground fill-foreground z-50 translate-y-[calc(-50%_-_2px)]"})]})})}const vX=t=>{let e;const n=new Set,r=(c,u)=>{const d=typeof c=="function"?c(e):c;if(!Object.is(d,e)){const h=e;e=u??(typeof d!="object"||d===null)?d:Object.assign({},e,d),n.forEach(f=>f(e,h))}},i=()=>e,a={setState:r,getState:i,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=e=t(r,i,a);return a},oLe=t=>t?vX(t):vX,aLe=t=>t;function lLe(t,e=aLe){const n=Be.useSyncExternalStore(t.subscribe,Be.useCallback(()=>e(t.getState()),[t,e]),Be.useCallback(()=>e(t.getInitialState()),[t,e]));return Be.useDebugValue(n),n}const bX=t=>{const e=oLe(t),n=r=>lLe(e,r);return Object.assign(n,e),n},_f=t=>t?bX(t):bX,cLe=()=>{};var wX={};/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const f0e=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=i&63|128):(i&64512)===55296&&r+1<t.length&&(t.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(t.charCodeAt(++r)&1023),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},uLe=function(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=t[n++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){const s=t[n++],o=t[n++],a=t[n++],l=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[r++]=String.fromCharCode(55296+(l>>10)),e[r++]=String.fromCharCode(56320+(l&1023))}else{const s=t[n++],o=t[n++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},p0e={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i<t.length;i+=3){const s=t[i],o=i+1<t.length,a=o?t[i+1]:0,l=i+2<t.length,c=l?t[i+2]:0,u=s>>2,d=(s&3)<<4|a>>4;let h=(a&15)<<2|c>>6,f=c&63;l||(f=64,o||(h=64)),r.push(n[u],n[d],n[h],n[f])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(f0e(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):uLe(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i<t.length;){const s=n[t.charAt(i++)],a=i<t.length?n[t.charAt(i)]:0;++i;const c=i<t.length?n[t.charAt(i)]:64;++i;const d=i<t.length?n[t.charAt(i)]:64;if(++i,s==null||a==null||c==null||d==null)throw new dLe;const h=s<<2|a>>4;if(r.push(h),c!==64){const f=a<<4&240|c>>2;if(r.push(f),d!==64){const p=c<<6&192|d;r.push(p)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class dLe extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const hLe=function(t){const e=f0e(t);return p0e.encodeByteArray(e,!0)},a7=function(t){return hLe(t).replace(/\./g,"")},m0e=function(t){try{return p0e.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
|
||
* @license
|
||
* Copyright 2022 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function fLe(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
|
||
* @license
|
||
* Copyright 2022 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const pLe=()=>fLe().__FIREBASE_DEFAULTS__,mLe=()=>{if(typeof process>"u"||typeof wX>"u")return;const t=wX.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},gLe=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&m0e(t[1]);return e&&JSON.parse(e)},q9=()=>{try{return cLe()||pLe()||mLe()||gLe()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},g0e=t=>{var e,n;return(n=(e=q9())==null?void 0:e.emulatorHosts)==null?void 0:n[t]},yLe=t=>{const e=g0e(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(n+1),10);return e[0]==="["?[e.substring(1,n-1),r]:[e.substring(0,n),r]},y0e=()=>{var t;return(t=q9())==null?void 0:t.config},v0e=t=>{var e;return(e=q9())==null?void 0:e[`_${t}`]};/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class vLe{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}}/**
|
||
* @license
|
||
* Copyright 2025 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function qx(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function b0e(t){return(await fetch(t,{credentials:"include"})).ok}/**
|
||
* @license
|
||
* Copyright 2021 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function bLe(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n={alg:"none",type:"JWT"},r=e||"demo-project",i=t.iat||0,s=t.sub||t.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o={iss:`https://securetoken.google.com/${r}`,aud:r,iat:i,exp:i+3600,auth_time:i,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}},...t};return[a7(JSON.stringify(n)),a7(JSON.stringify(o)),""].join(".")}const E_={};function wLe(){const t={prod:[],emulator:[]};for(const e of Object.keys(E_))E_[e]?t.emulator.push(e):t.prod.push(e);return t}function xLe(t){let e=document.getElementById(t),n=!1;return e||(e=document.createElement("div"),e.setAttribute("id",t),n=!0),{created:n,element:e}}let xX=!1;function w0e(t,e){if(typeof window>"u"||typeof document>"u"||!qx(window.location.host)||E_[t]===e||E_[t]||xX)return;E_[t]=e;function n(h){return`__firebase__banner__${h}`}const r="__firebase__banner",s=wLe().prod.length>0;function o(){const h=document.getElementById(r);h&&h.remove()}function a(h){h.style.display="flex",h.style.background="#7faaf0",h.style.position="fixed",h.style.bottom="5px",h.style.left="5px",h.style.padding=".5em",h.style.borderRadius="5px",h.style.alignItems="center"}function l(h,f){h.setAttribute("width","24"),h.setAttribute("id",f),h.setAttribute("height","24"),h.setAttribute("viewBox","0 0 24 24"),h.setAttribute("fill","none"),h.style.marginLeft="-6px"}function c(){const h=document.createElement("span");return h.style.cursor="pointer",h.style.marginLeft="16px",h.style.fontSize="24px",h.innerHTML=" ×",h.onclick=()=>{xX=!0,o()},h}function u(h,f){h.setAttribute("id",f),h.innerText="Learn more",h.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",h.setAttribute("target","__blank"),h.style.paddingLeft="5px",h.style.textDecoration="underline"}function d(){const h=xLe(r),f=n("text"),p=document.getElementById(f)||document.createElement("span"),g=n("learnmore"),y=document.getElementById(g)||document.createElement("a"),v=n("preprendIcon"),b=document.getElementById(v)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(h.created){const _=h.element;a(_),u(y,g);const S=c();l(b,v),_.append(b,p,y,S),document.body.appendChild(_)}s?(p.innerText="Preview backend disconnected.",b.innerHTML=`<g clip-path="url(#clip0_6013_33858)">
|
||
<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_6013_33858">
|
||
<rect width="24" height="24" fill="white"/>
|
||
</clipPath>
|
||
</defs>`):(b.innerHTML=`<g clip-path="url(#clip0_6083_34804)">
|
||
<path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_6083_34804">
|
||
<rect width="24" height="24" fill="white"/>
|
||
</clipPath>
|
||
</defs>`,p.innerText="Preview backend running in this workspace."),p.setAttribute("id",f)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",d):d()}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function io(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function _Le(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(io())}function SLe(){var e;const t=(e=q9())==null?void 0:e.forceEnvironment;if(t==="node")return!0;if(t==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function kLe(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function CLe(){const t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function ELe(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function TLe(){const t=io();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function ALe(){return!SLe()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function ILe(){try{return typeof indexedDB=="object"}catch{return!1}}function RLe(){return new Promise((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)==null?void 0:s.message)||"")}}catch(n){e(n)}})}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const MLe="FirebaseError";class Sf extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=MLe,Object.setPrototypeOf(this,Sf.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,a3.prototype.create)}}class a3{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){const r=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?NLe(s,r):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new Sf(i,a,r)}}function NLe(t,e){return t.replace(OLe,(n,r)=>{const i=e[r];return i!=null?String(i):`<${r}?>`})}const OLe=/\{\$([^}]+)}/g;function DLe(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function sf(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const i of n){if(!r.includes(i))return!1;const s=t[i],o=e[i];if(_X(s)&&_X(o)){if(!sf(s,o))return!1}else if(s!==o)return!1}for(const i of r)if(!n.includes(i))return!1;return!0}function _X(t){return t!==null&&typeof t=="object"}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function l3(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function PLe(t,e){const n=new LLe(t,e);return n.subscribe.bind(n)}class LLe{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,r){let i;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");zLe(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:r},i.next===void 0&&(i.next=wN),i.error===void 0&&(i.error=wN),i.complete===void 0&&(i.complete=wN);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n<this.observers.length;n++)this.sendOne(n,e)}sendOne(e,n){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function zLe(t,e){if(typeof t!="object"||t===null)return!1;for(const n of e)if(n in t&&typeof t[n]=="function")return!0;return!1}function wN(){}/**
|
||
* @license
|
||
* Copyright 2021 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function Ds(t){return t&&t._delegate?t._delegate:t}class j1{constructor(e,n,r){this.name=e,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const cg="[DEFAULT]";/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class jLe{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){const r=new vLe;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const i=this.getOrInitializeService({instanceIdentifier:n});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){const n=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),r=(e==null?void 0:e.optional)??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(i){if(r)return null;throw i}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(FLe(e))try{this.getOrInitializeService({instanceIdentifier:cg})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(n);try{const s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=cg){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=cg){return this.instances.has(e)}getOptions(e=cg){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:n={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const i=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[s,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(s);r===a&&o.resolve(i)}return i}onInit(e,n){const r=this.normalizeInstanceIdentifier(n),i=this.onInitCallbacks.get(r)??new Set;i.add(e),this.onInitCallbacks.set(r,i);const s=this.instances.get(r);return s&&e(s,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,n){const r=this.onInitCallbacks.get(n);if(r)for(const i of r)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:BLe(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=cg){return this.component?this.component.multipleInstances?e:cg:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function BLe(t){return t===cg?void 0:t}function FLe(t){return t.instantiationMode==="EAGER"}/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class VLe{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const n=new jLe(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/var kn;(function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"})(kn||(kn={}));const $Le={debug:kn.DEBUG,verbose:kn.VERBOSE,info:kn.INFO,warn:kn.WARN,error:kn.ERROR,silent:kn.SILENT},HLe=kn.INFO,ULe={[kn.DEBUG]:"log",[kn.VERBOSE]:"log",[kn.INFO]:"info",[kn.WARN]:"warn",[kn.ERROR]:"error"},qLe=(t,e,...n)=>{if(e<t.logLevel)return;const r=new Date().toISOString(),i=ULe[e];if(i)console[i](`[${r}] ${t.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class M${constructor(e){this.name=e,this._logLevel=HLe,this._logHandler=qLe,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in kn))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?$Le[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,kn.DEBUG,...e),this._logHandler(this,kn.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,kn.VERBOSE,...e),this._logHandler(this,kn.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,kn.INFO,...e),this._logHandler(this,kn.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,kn.WARN,...e),this._logHandler(this,kn.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,kn.ERROR,...e),this._logHandler(this,kn.ERROR,...e)}}const WLe=(t,e)=>e.some(n=>t instanceof n);let SX,kX;function GLe(){return SX||(SX=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function KLe(){return kX||(kX=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const x0e=new WeakMap,_L=new WeakMap,_0e=new WeakMap,xN=new WeakMap,N$=new WeakMap;function YLe(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(gm(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&x0e.set(n,t)}).catch(()=>{}),N$.set(e,t),e}function ZLe(t){if(_L.has(t))return;const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});_L.set(t,e)}let SL={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return _L.get(t);if(e==="objectStoreNames")return t.objectStoreNames||_0e.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return gm(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function XLe(t){SL=t(SL)}function QLe(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(_N(this),e,...n);return _0e.set(r,e.sort?e.sort():[e]),gm(r)}:KLe().includes(t)?function(...e){return t.apply(_N(this),e),gm(x0e.get(this))}:function(...e){return gm(t.apply(_N(this),e))}}function JLe(t){return typeof t=="function"?QLe(t):(t instanceof IDBTransaction&&ZLe(t),WLe(t,GLe())?new Proxy(t,SL):t)}function gm(t){if(t instanceof IDBRequest)return YLe(t);if(xN.has(t))return xN.get(t);const e=JLe(t);return e!==t&&(xN.set(t,e),N$.set(e,t)),e}const _N=t=>N$.get(t);function eze(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=gm(o);return r&&o.addEventListener("upgradeneeded",l=>{r(gm(o.result),l.oldVersion,l.newVersion,gm(o.transaction),l)}),n&&o.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),a.then(l=>{s&&l.addEventListener("close",()=>s()),i&&l.addEventListener("versionchange",c=>i(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}const tze=["get","getKey","getAll","getAllKeys","count"],nze=["put","add","delete","clear"],SN=new Map;function CX(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(SN.get(e))return SN.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=nze.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||tze.includes(n)))return;const s=async function(o,...a){const l=this.transaction(o,i?"readwrite":"readonly");let c=l.store;return r&&(c=c.index(a.shift())),(await Promise.all([c[n](...a),i&&l.done]))[0]};return SN.set(e,s),s}XLe(t=>({...t,get:(e,n,r)=>CX(e,n)||t.get(e,n,r),has:(e,n)=>!!CX(e,n)||t.has(e,n)}));/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class rze{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(ize(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function ize(t){const e=t.getComponent();return(e==null?void 0:e.type)==="VERSION"}const kL="@firebase/app",EX="0.14.9";/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const of=new M$("@firebase/app"),sze="@firebase/app-compat",oze="@firebase/analytics-compat",aze="@firebase/analytics",lze="@firebase/app-check-compat",cze="@firebase/app-check",uze="@firebase/auth",dze="@firebase/auth-compat",hze="@firebase/database",fze="@firebase/data-connect",pze="@firebase/database-compat",mze="@firebase/functions",gze="@firebase/functions-compat",yze="@firebase/installations",vze="@firebase/installations-compat",bze="@firebase/messaging",wze="@firebase/messaging-compat",xze="@firebase/performance",_ze="@firebase/performance-compat",Sze="@firebase/remote-config",kze="@firebase/remote-config-compat",Cze="@firebase/storage",Eze="@firebase/storage-compat",Tze="@firebase/firestore",Aze="@firebase/ai",Ize="@firebase/firestore-compat",Rze="firebase",Mze="12.10.0";/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const CL="[DEFAULT]",Nze={[kL]:"fire-core",[sze]:"fire-core-compat",[aze]:"fire-analytics",[oze]:"fire-analytics-compat",[cze]:"fire-app-check",[lze]:"fire-app-check-compat",[uze]:"fire-auth",[dze]:"fire-auth-compat",[hze]:"fire-rtdb",[fze]:"fire-data-connect",[pze]:"fire-rtdb-compat",[mze]:"fire-fn",[gze]:"fire-fn-compat",[yze]:"fire-iid",[vze]:"fire-iid-compat",[bze]:"fire-fcm",[wze]:"fire-fcm-compat",[xze]:"fire-perf",[_ze]:"fire-perf-compat",[Sze]:"fire-rc",[kze]:"fire-rc-compat",[Cze]:"fire-gcs",[Eze]:"fire-gcs-compat",[Tze]:"fire-fst",[Ize]:"fire-fst-compat",[Aze]:"fire-vertex","fire-js":"fire-js",[Rze]:"fire-js-all"};/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const l7=new Map,Oze=new Map,EL=new Map;function TX(t,e){try{t.container.addComponent(e)}catch(n){of.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function $w(t){const e=t.name;if(EL.has(e))return of.debug(`There were multiple attempts to register component ${e}.`),!1;EL.set(e,t);for(const n of l7.values())TX(n,t);for(const n of Oze.values())TX(n,t);return!0}function O$(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function Rc(t){return t==null?!1:t.settings!==void 0}/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const Dze={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},ym=new a3("app","Firebase",Dze);/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class Pze{constructor(e,n,r){this._isDeleted=!1,this._options={...e},this._config={...n},this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new j1("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw ym.create("app-deleted",{appName:this._name})}}/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const Wx=Mze;function S0e(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r={name:CL,automaticDataCollectionEnabled:!0,...e},i=r.name;if(typeof i!="string"||!i)throw ym.create("bad-app-name",{appName:String(i)});if(n||(n=y0e()),!n)throw ym.create("no-options");const s=l7.get(i);if(s){if(sf(n,s.options)&&sf(r,s.config))return s;throw ym.create("duplicate-app",{appName:i})}const o=new VLe(i);for(const l of EL.values())o.addComponent(l);const a=new Pze(n,r,o);return l7.set(i,a),a}function k0e(t=CL){const e=l7.get(t);if(!e&&t===CL&&y0e())return S0e();if(!e)throw ym.create("no-app",{appName:t});return e}function vm(t,e,n){let r=Nze[t]??t;n&&(r+=`-${n}`);const i=r.match(/\s|\//),s=e.match(/\s|\//);if(i||s){const o=[`Unable to register library "${r}" with version "${e}":`];i&&o.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&s&&o.push("and"),s&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),of.warn(o.join(" "));return}$w(new j1(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}/**
|
||
* @license
|
||
* Copyright 2021 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const Lze="firebase-heartbeat-database",zze=1,DS="firebase-heartbeat-store";let kN=null;function C0e(){return kN||(kN=eze(Lze,zze,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(DS)}catch(n){console.warn(n)}}}}).catch(t=>{throw ym.create("idb-open",{originalErrorMessage:t.message})})),kN}async function jze(t){try{const n=(await C0e()).transaction(DS),r=await n.objectStore(DS).get(E0e(t));return await n.done,r}catch(e){if(e instanceof Sf)of.warn(e.message);else{const n=ym.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});of.warn(n.message)}}}async function AX(t,e){try{const r=(await C0e()).transaction(DS,"readwrite");await r.objectStore(DS).put(e,E0e(t)),await r.done}catch(n){if(n instanceof Sf)of.warn(n.message);else{const r=ym.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});of.warn(r.message)}}}function E0e(t){return`${t.name}!${t.options.appId}`}/**
|
||
* @license
|
||
* Copyright 2021 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const Bze=1024,Fze=30;class Vze{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new Hze(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,n;try{const i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=IX();if(((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)==null?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s))return;if(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats.length>Fze){const o=Uze(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(o,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){of.warn(r)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const n=IX(),{heartbeatsToSend:r,unsentEntries:i}=$ze(this._heartbeatsCache.heartbeats),s=a7(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return of.warn(n),""}}}function IX(){return new Date().toISOString().substring(0,10)}function $ze(t,e=Bze){const n=[];let r=t.slice();for(const i of t){const s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),RX(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),RX(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class Hze{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return ILe()?RLe().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await jze(this.app);return n!=null&&n.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return AX(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return AX(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function RX(t){return a7(JSON.stringify({version:2,heartbeats:t})).length}function Uze(t){if(t.length===0)return-1;let e=0,n=t[0].date;for(let r=1;r<t.length;r++)t[r].date<n&&(n=t[r].date,e=r);return e}/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function qze(t){$w(new j1("platform-logger",e=>new rze(e),"PRIVATE")),$w(new j1("heartbeat",e=>new Vze(e),"PRIVATE")),vm(kL,EX,t),vm(kL,EX,"esm2020"),vm("fire-js","")}qze("");function T0e(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const Wze=T0e,A0e=new a3("auth","Firebase",T0e());/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const c7=new M$("@firebase/auth");function Gze(t,...e){c7.logLevel<=kn.WARN&&c7.warn(`Auth (${Wx}): ${t}`,...e)}function HT(t,...e){c7.logLevel<=kn.ERROR&&c7.error(`Auth (${Wx}): ${t}`,...e)}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function af(t,...e){throw D$(t,...e)}function id(t,...e){return D$(t,...e)}function I0e(t,e,n){const r={...Wze(),[e]:n};return new a3("auth","Firebase",r).create(e,{appName:t.name})}function bm(t){return I0e(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function D$(t,...e){if(typeof t!="string"){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return A0e.create(t,...e)}function Ft(t,e,...n){if(!t)throw D$(e,...n)}function Ah(t){const e="INTERNAL ASSERTION FAILED: "+t;throw HT(e),new Error(e)}function lf(t,e){t||Ah(e)}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function TL(){var t;return typeof self<"u"&&((t=self.location)==null?void 0:t.href)||""}function Kze(){return MX()==="http:"||MX()==="https:"}function MX(){var t;return typeof self<"u"&&((t=self.location)==null?void 0:t.protocol)||null}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function Yze(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(Kze()||CLe()||"connection"in navigator)?navigator.onLine:!0}function Zze(){if(typeof navigator>"u")return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class c3{constructor(e,n){this.shortDelay=e,this.longDelay=n,lf(n>e,"Short delay should be less than long delay!"),this.isMobile=_Le()||ELe()}get(){return Yze()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function P$(t,e){lf(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class R0e{static initialize(e,n,r){this.fetchImpl=e,n&&(this.headersImpl=n),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;Ah("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;Ah("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;Ah("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const Xze={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const Qze=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Jze=new c3(3e4,6e4);function W9(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function Gx(t,e,n,r,i={}){return M0e(t,i,async()=>{let s={},o={};r&&(e==="GET"?o=r:s={body:JSON.stringify(r)});const a=l3({key:t.config.apiKey,...o}).slice(1),l=await t._getAdditionalHeaders();l["Content-Type"]="application/json",t.languageCode&&(l["X-Firebase-Locale"]=t.languageCode);const c={method:e,headers:l,...s};return kLe()||(c.referrerPolicy="no-referrer"),t.emulatorConfig&&qx(t.emulatorConfig.host)&&(c.credentials="include"),R0e.fetch()(await O0e(t,t.config.apiHost,n,a),c)})}async function M0e(t,e,n){t._canInitEmulator=!1;const r={...Xze,...e};try{const i=new eje(t),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();const o=await s.json();if("needConfirmation"in o)throw tE(t,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{const a=s.ok?o.errorMessage:o.error.message,[l,c]=a.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw tE(t,"credential-already-in-use",o);if(l==="EMAIL_EXISTS")throw tE(t,"email-already-in-use",o);if(l==="USER_DISABLED")throw tE(t,"user-disabled",o);const u=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(c)throw I0e(t,u,c);af(t,u)}}catch(i){if(i instanceof Sf)throw i;af(t,"network-request-failed",{message:String(i)})}}async function N0e(t,e,n,r,i={}){const s=await Gx(t,e,n,r,i);return"mfaPendingCredential"in s&&af(t,"multi-factor-auth-required",{_serverResponse:s}),s}async function O0e(t,e,n,r){const i=`${e}${n}?${r}`,s=t,o=s.config.emulator?P$(t.config,i):`${t.config.apiScheme}://${i}`;return Qze.includes(n)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(o).toString():o}class eje{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(id(this.auth,"network-request-failed")),Jze.get())})}}function tE(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=id(t,e,r);return i.customData._tokenResponse=n,i}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/async function tje(t,e){return Gx(t,"POST","/v1/accounts:delete",e)}async function u7(t,e){return Gx(t,"POST","/v1/accounts:lookup",e)}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function T_(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function nje(t,e=!1){const n=Ds(t),r=await n.getIdToken(e),i=L$(r);Ft(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");const s=typeof i.firebase=="object"?i.firebase:void 0,o=s==null?void 0:s.sign_in_provider;return{claims:i,token:r,authTime:T_(CN(i.auth_time)),issuedAtTime:T_(CN(i.iat)),expirationTime:T_(CN(i.exp)),signInProvider:o||null,signInSecondFactor:(s==null?void 0:s.sign_in_second_factor)||null}}function CN(t){return Number(t)*1e3}function L$(t){const[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return HT("JWT malformed, contained fewer than 3 sections"),null;try{const i=m0e(n);return i?JSON.parse(i):(HT("Failed to decode base64 JWT payload"),null)}catch(i){return HT("Caught error parsing JWT payload as JSON",i==null?void 0:i.toString()),null}}function NX(t){const e=L$(t);return Ft(e,"internal-error"),Ft(typeof e.exp<"u","internal-error"),Ft(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/async function PS(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof Sf&&rje(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function rje({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class ije{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){const n=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),n}else{this.errorBackoff=3e4;const r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;const n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(e==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class AL{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=T_(this.lastLoginAt),this.creationTime=T_(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/async function d7(t){var d;const e=t.auth,n=await t.getIdToken(),r=await PS(t,u7(e,{idToken:n}));Ft(r==null?void 0:r.users.length,e,"internal-error");const i=r.users[0];t._notifyReloadListener(i);const s=(d=i.providerUserInfo)!=null&&d.length?D0e(i.providerUserInfo):[],o=oje(t.providerData,s),a=t.isAnonymous,l=!(t.email&&i.passwordHash)&&!(o!=null&&o.length),c=a?l:!1,u={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:o,metadata:new AL(i.createdAt,i.lastLoginAt),isAnonymous:c};Object.assign(t,u)}async function sje(t){const e=Ds(t);await d7(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function oje(t,e){return[...t.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function D0e(t){return t.map(({providerId:e,...n})=>({providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}))}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/async function aje(t,e){const n=await M0e(t,{},async()=>{const r=l3({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=t.config,o=await O0e(t,i,"/v1/token",`key=${s}`),a=await t._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";const l={method:"POST",headers:a,body:r};return t.emulatorConfig&&qx(t.emulatorConfig.host)&&(l.credentials="include"),R0e.fetch()(o,l)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function lje(t,e){return Gx(t,"POST","/v2/accounts:revokeToken",W9(t,e))}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class ib{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Ft(e.idToken,"internal-error"),Ft(typeof e.idToken<"u","internal-error"),Ft(typeof e.refreshToken<"u","internal-error");const n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):NX(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){Ft(e.length!==0,"internal-error");const n=NX(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(Ft(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){const{accessToken:r,refreshToken:i,expiresIn:s}=await aje(e,n);this.updateTokensAndExpiration(r,i,Number(s))}updateTokensAndExpiration(e,n,r){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,n){const{refreshToken:r,accessToken:i,expirationTime:s}=n,o=new ib;return r&&(Ft(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),i&&(Ft(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(Ft(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new ib,this.toJSON())}_performRefresh(){return Ah("not implemented")}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function Wf(t,e){Ft(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}class Oc{constructor({uid:e,auth:n,stsTokenManager:r,...i}){this.providerId="firebase",this.proactiveRefresh=new ije(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new AL(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const n=await PS(this,this.stsTokenManager.getToken(this.auth,e));return Ft(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return nje(this,e)}reload(){return sje(this)}_assign(e){this!==e&&(Ft(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>({...n})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const n=new Oc({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){Ft(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),n&&await d7(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Rc(this.auth.app))return Promise.reject(bm(this.auth));const e=await this.getIdToken();return await PS(this,tje(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){const r=n.displayName??void 0,i=n.email??void 0,s=n.phoneNumber??void 0,o=n.photoURL??void 0,a=n.tenantId??void 0,l=n._redirectEventId??void 0,c=n.createdAt??void 0,u=n.lastLoginAt??void 0,{uid:d,emailVerified:h,isAnonymous:f,providerData:p,stsTokenManager:g}=n;Ft(d&&g,e,"internal-error");const y=ib.fromJSON(this.name,g);Ft(typeof d=="string",e,"internal-error"),Wf(r,e.name),Wf(i,e.name),Ft(typeof h=="boolean",e,"internal-error"),Ft(typeof f=="boolean",e,"internal-error"),Wf(s,e.name),Wf(o,e.name),Wf(a,e.name),Wf(l,e.name),Wf(c,e.name),Wf(u,e.name);const v=new Oc({uid:d,auth:e,email:i,emailVerified:h,displayName:r,isAnonymous:f,photoURL:o,phoneNumber:s,tenantId:a,stsTokenManager:y,createdAt:c,lastLoginAt:u});return p&&Array.isArray(p)&&(v.providerData=p.map(b=>({...b}))),l&&(v._redirectEventId=l),v}static async _fromIdTokenResponse(e,n,r=!1){const i=new ib;i.updateFromServerResponse(n);const s=new Oc({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await d7(s),s}static async _fromGetAccountInfoResponse(e,n,r){const i=n.users[0];Ft(i.localId!==void 0,"internal-error");const s=i.providerUserInfo!==void 0?D0e(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!(s!=null&&s.length),a=new ib;a.updateFromIdToken(r);const l=new Oc({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),c={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new AL(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!(s!=null&&s.length)};return Object.assign(l,c),l}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const OX=new Map;function Ih(t){lf(t instanceof Function,"Expected a class definition");let e=OX.get(t);return e?(lf(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,OX.set(t,e),e)}/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class P0e{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){const n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}}P0e.type="NONE";const DX=P0e;/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function UT(t,e,n){return`firebase:${t}:${e}:${n}`}class sb{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;const{config:i,name:s}=this.auth;this.fullUserKey=UT(this.userKey,i.apiKey,s),this.fullPersistenceKey=UT("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){const n=await u7(this.auth,{idToken:e}).catch(()=>{});return n?Oc._fromGetAccountInfoResponse(this.auth,n,e):null}return Oc._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,r="authUser"){if(!n.length)return new sb(Ih(DX),e,r);const i=(await Promise.all(n.map(async c=>{if(await c._isAvailable())return c}))).filter(c=>c);let s=i[0]||Ih(DX);const o=UT(r,e.config.apiKey,e.name);let a=null;for(const c of n)try{const u=await c._get(o);if(u){let d;if(typeof u=="string"){const h=await u7(e,{idToken:u}).catch(()=>{});if(!h)break;d=await Oc._fromGetAccountInfoResponse(e,h,u)}else d=Oc._fromJSON(e,u);c!==s&&(a=d),s=c;break}}catch{}const l=i.filter(c=>c._shouldAllowMigration);return!s._shouldAllowMigration||!l.length?new sb(s,e,r):(s=l[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async c=>{if(c!==s)try{await c._remove(o)}catch{}})),new sb(s,e,r))}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function PX(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(B0e(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(L0e(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(V0e(e))return"Blackberry";if($0e(e))return"Webos";if(z0e(e))return"Safari";if((e.includes("chrome/")||j0e(e))&&!e.includes("edge/"))return"Chrome";if(F0e(e))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=t.match(n);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function L0e(t=io()){return/firefox\//i.test(t)}function z0e(t=io()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function j0e(t=io()){return/crios\//i.test(t)}function B0e(t=io()){return/iemobile/i.test(t)}function F0e(t=io()){return/android/i.test(t)}function V0e(t=io()){return/blackberry/i.test(t)}function $0e(t=io()){return/webos/i.test(t)}function z$(t=io()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function cje(t=io()){var e;return z$(t)&&!!((e=window.navigator)!=null&&e.standalone)}function uje(){return TLe()&&document.documentMode===10}function H0e(t=io()){return z$(t)||F0e(t)||$0e(t)||V0e(t)||/windows phone/i.test(t)||B0e(t)}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function U0e(t,e=[]){let n;switch(t){case"Browser":n=PX(io());break;case"Worker":n=`${PX(io())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Wx}/${r}`}/**
|
||
* @license
|
||
* Copyright 2022 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class dje{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const r=s=>new Promise((o,a)=>{try{const l=e(s);o(l)}catch(l){a(l)}});r.onAbort=n,this.queue.push(r);const i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const n=[];try{for(const r of this.queue)await r(e),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(const i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/**
|
||
* @license
|
||
* Copyright 2023 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/async function hje(t,e={}){return Gx(t,"GET","/v2/passwordPolicy",W9(t,e))}/**
|
||
* @license
|
||
* Copyright 2023 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const fje=6;class pje{constructor(e){var r;const n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??fje,n.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=n.maxPasswordLength),n.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=n.containsLowercaseCharacter),n.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=n.containsUppercaseCharacter),n.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=n.containsNumericCharacter),n.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=n.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=((r=e.allowedNonAlphanumericCharacters)==null?void 0:r.join(""))??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const n={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,n),this.validatePasswordCharacterOptions(e,n),n.isValid&&(n.isValid=n.meetsMinPasswordLength??!0),n.isValid&&(n.isValid=n.meetsMaxPasswordLength??!0),n.isValid&&(n.isValid=n.containsLowercaseLetter??!0),n.isValid&&(n.isValid=n.containsUppercaseLetter??!0),n.isValid&&(n.isValid=n.containsNumericCharacter??!0),n.isValid&&(n.isValid=n.containsNonAlphanumericCharacter??!0),n}validatePasswordLengthOptions(e,n){const r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let i=0;i<e.length;i++)r=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(n,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class mje{constructor(e,n,r,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new LX(this),this.idTokenSubscription=new LX(this),this.beforeStateQueue=new dje(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=A0e,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(s=>this._resolvePersistenceManagerAvailable=s)}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=Ih(n)),this._initializationPromise=this.queue(async()=>{var r,i,s;if(!this._deleted&&(this.persistenceManager=await sb.create(this,e),(r=this._resolvePersistenceManagerAvailable)==null||r.call(this),!this._deleted)){if((i=this._popupRedirectResolver)!=null&&i._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((s=this.currentUser)==null?void 0:s.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const n=await u7(this,{idToken:e}),r=await Oc._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(r)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var s;if(Rc(this.app)){const o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(s=this.redirectUser)==null?void 0:s._redirectEventId,a=r==null?void 0:r._redirectEventId,l=await this.tryRedirectSignIn(e);(!o||o===a)&&(l!=null&&l.user)&&(r=l.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(o){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Ft(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await d7(e)}catch(n){if((n==null?void 0:n.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=Zze()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Rc(this.app))return Promise.reject(bm(this));const n=e?Ds(e):null;return n&&Ft(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&Ft(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return Rc(this.app)?Promise.reject(bm(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Rc(this.app)?Promise.reject(bm(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Ih(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await hje(this),n=new pje(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new a3("auth","Firebase",e())}onAuthStateChanged(e,n,r){return this.registerStateListener(this.authStateSubscription,e,n,r)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,r){return this.registerStateListener(this.idTokenSubscription,e,n,r)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){const n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await lje(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)==null?void 0:e.toJSON()}}async _setRedirectUser(e,n){const r=await this.getOrInitRedirectPersistenceManager(n);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const n=e&&Ih(e)||this._popupRedirectResolver;Ft(n,this,"argument-error"),this.redirectPersistenceManager=await sb.create(this,[Ih(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,r;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)==null?void 0:n._redirectEventId)===e?this._currentUser:((r=this.redirectUser)==null?void 0:r._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=((n=this.currentUser)==null?void 0:n.uid)??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,i){if(this._deleted)return()=>{};const s=typeof n=="function"?n:n.next.bind(n);let o=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(Ft(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){const l=e.addObserver(n,r,i);return()=>{o=!0,l()}}else{const l=e.addObserver(n);return()=>{o=!0,l()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return Ft(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=U0e(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var i;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await((i=this.heartbeatServiceProvider.getImmediate({optional:!0}))==null?void 0:i.getHeartbeatsHeader());n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var n;if(Rc(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await((n=this.appCheckServiceProvider.getImmediate({optional:!0}))==null?void 0:n.getToken());return e!=null&&e.error&&Gze(`Error while retrieving App Check token: ${e.error}`),e==null?void 0:e.token}}function G9(t){return Ds(t)}class LX{constructor(e){this.auth=e,this.observer=null,this.addObserver=PLe(n=>this.observer=n)}get next(){return Ft(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/let j$={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function gje(t){j$=t}function yje(t){return j$.loadJS(t)}function vje(){return j$.gapiScript}function bje(t){return`__${t}${Math.floor(Math.random()*1e6)}`}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function wje(t,e){const n=O$(t,"auth");if(n.isInitialized()){const i=n.getImmediate(),s=n.getOptions();if(sf(s,e??{}))return i;af(i,"already-initialized")}return n.initialize({options:e})}function xje(t,e){const n=(e==null?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Ih);e!=null&&e.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function _je(t,e,n){const r=G9(t);Ft(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const i=!1,s=q0e(e),{host:o,port:a}=Sje(e),l=a===null?"":`:${a}`,c={url:`${s}//${o}${l}/`},u=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator){Ft(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),Ft(sf(c,r.config.emulator)&&sf(u,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=c,r.emulatorConfig=u,r.settings.appVerificationDisabledForTesting=!0,qx(o)?(b0e(`${s}//${o}${l}`),w0e("Auth",!0)):kje()}function q0e(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function Sje(t){const e=q0e(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const s=i[1];return{host:s,port:zX(r.substr(s.length+1))}}else{const[s,o]=r.split(":");return{host:s,port:zX(o)}}}function zX(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}function kje(){function t(){const e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t())}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class W0e{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return Ah("not implemented")}_getIdTokenResponse(e){return Ah("not implemented")}_linkToIdToken(e,n){return Ah("not implemented")}_getReauthenticationResolver(e){return Ah("not implemented")}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/async function ob(t,e){return N0e(t,"POST","/v1/accounts:signInWithIdp",W9(t,e))}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const Cje="http://localhost";class B1 extends W0e{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const n=new B1(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):af("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i,...s}=n;if(!r||!i)return null;const o=new B1(r,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){const n=this.buildRequest();return ob(e,n)}_linkToIdToken(e,n){const r=this.buildRequest();return r.idToken=n,ob(e,r)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,ob(e,n)}buildRequest(){const e={requestUri:Cje,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=l3(n)}return e}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class G0e{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class u3 extends G0e{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class Sp extends u3{constructor(){super("facebook.com")}static credential(e){return B1._fromParams({providerId:Sp.PROVIDER_ID,signInMethod:Sp.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Sp.credentialFromTaggedObject(e)}static credentialFromError(e){return Sp.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Sp.credential(e.oauthAccessToken)}catch{return null}}}Sp.FACEBOOK_SIGN_IN_METHOD="facebook.com";Sp.PROVIDER_ID="facebook.com";/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class kp extends u3{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return B1._fromParams({providerId:kp.PROVIDER_ID,signInMethod:kp.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return kp.credentialFromTaggedObject(e)}static credentialFromError(e){return kp.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return kp.credential(n,r)}catch{return null}}}kp.GOOGLE_SIGN_IN_METHOD="google.com";kp.PROVIDER_ID="google.com";/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class Cp extends u3{constructor(){super("github.com")}static credential(e){return B1._fromParams({providerId:Cp.PROVIDER_ID,signInMethod:Cp.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Cp.credentialFromTaggedObject(e)}static credentialFromError(e){return Cp.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Cp.credential(e.oauthAccessToken)}catch{return null}}}Cp.GITHUB_SIGN_IN_METHOD="github.com";Cp.PROVIDER_ID="github.com";/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class Ep extends u3{constructor(){super("twitter.com")}static credential(e,n){return B1._fromParams({providerId:Ep.PROVIDER_ID,signInMethod:Ep.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return Ep.credentialFromTaggedObject(e)}static credentialFromError(e){return Ep.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return Ep.credential(n,r)}catch{return null}}}Ep.TWITTER_SIGN_IN_METHOD="twitter.com";Ep.PROVIDER_ID="twitter.com";/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class F1{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,i=!1){const s=await Oc._fromIdTokenResponse(e,r,i),o=jX(r);return new F1({user:s,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);const i=jX(r);return new F1({user:e,providerId:i,_tokenResponse:r,operationType:n})}}function jX(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class h7 extends Sf{constructor(e,n,r,i){super(n.code,n.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,h7.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,i){return new h7(e,n,r,i)}}function K0e(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?h7._fromErrorAndOperation(t,s,e,r):s})}async function Eje(t,e,n=!1){const r=await PS(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return F1._forOperation(t,"link",r)}/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/async function Tje(t,e,n=!1){const{auth:r}=t;if(Rc(r.app))return Promise.reject(bm(r));const i="reauthenticate";try{const s=await PS(t,K0e(r,i,e,t),n);Ft(s.idToken,r,"internal-error");const o=L$(s.idToken);Ft(o,r,"internal-error");const{sub:a}=o;return Ft(t.uid===a,r,"user-mismatch"),F1._forOperation(t,i,s)}catch(s){throw(s==null?void 0:s.code)==="auth/user-not-found"&&af(r,"user-mismatch"),s}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/async function Aje(t,e,n=!1){if(Rc(t.app))return Promise.reject(bm(t));const r="signIn",i=await K0e(t,r,e),s=await F1._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/async function Ije(t,e){return N0e(t,"POST","/v1/accounts:signInWithCustomToken",W9(t,e))}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/async function Rje(t,e){if(Rc(t.app))return Promise.reject(bm(t));const n=G9(t),r=await Ije(n,{token:e,returnSecureToken:!0}),i=await F1._fromIdTokenResponse(n,"signIn",r);return await n._updateCurrentUser(i.user),i}function Mje(t,e,n,r){return Ds(t).onIdTokenChanged(e,n,r)}function Nje(t,e,n){return Ds(t).beforeAuthStateChanged(e,n)}function Oje(t){return Ds(t).signOut()}const f7="__sak";/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class Y0e{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(f7,"1"),this.storage.removeItem(f7),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){const n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const Dje=1e3,Pje=10;class Z0e extends Y0e{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=H0e(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),i=this.localCache[n];r!==i&&e(n,i,r)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,l)=>{this.notifyListeners(o,l)});return}const r=e.key;n?this.detachListener():this.stopPolling();const i=()=>{const o=this.storage.getItem(r);!n&&this.localCache[r]===o||this.notifyListeners(r,o)},s=this.storage.getItem(r);uje()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Pje):i()}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:r}),!0)})},Dje)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){const n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}}Z0e.type="LOCAL";const Lje=Z0e;/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class X0e extends Y0e{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}}X0e.type="SESSION";const Q0e=X0e;/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function zje(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class K9{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;const r=new K9(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const n=e,{eventId:r,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!(o!=null&&o.size))return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:i});const a=Array.from(o).map(async c=>c(n.origin,s)),l=await zje(a);n.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:l})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}K9.receivers=[];/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function B$(t="",e=10){let n="";for(let r=0;r<e;r++)n+=Math.floor(Math.random()*10);return t+n}/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class jje{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,n,r=50){const i=typeof MessageChannel<"u"?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let s,o;return new Promise((a,l)=>{const c=B$("",20);i.port1.start();const u=setTimeout(()=>{l(new Error("unsupported_event"))},r);o={messageChannel:i,onMessage(d){const h=d;if(h.data.eventId===c)switch(h.data.status){case"ack":clearTimeout(u),s=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(h.data.response);break;default:clearTimeout(u),clearTimeout(s),l(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:c,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function sd(){return window}function Bje(t){sd().location.href=t}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC.
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function J0e(){return typeof sd().WorkerGlobalScope<"u"&&typeof sd().importScripts=="function"}async function Fje(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Vje(){var t;return((t=navigator==null?void 0:navigator.serviceWorker)==null?void 0:t.controller)||null}function $je(){return J0e()?self:null}/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const ege="firebaseLocalStorageDb",Hje=1,p7="firebaseLocalStorage",tge="fbase_key";class d3{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}}function Y9(t,e){return t.transaction([p7],e?"readwrite":"readonly").objectStore(p7)}function Uje(){const t=indexedDB.deleteDatabase(ege);return new d3(t).toPromise()}function IL(){const t=indexedDB.open(ege,Hje);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const r=t.result;try{r.createObjectStore(p7,{keyPath:tge})}catch(i){n(i)}}),t.addEventListener("success",async()=>{const r=t.result;r.objectStoreNames.contains(p7)?e(r):(r.close(),await Uje(),e(await IL()))})})}async function BX(t,e,n){const r=Y9(t,!0).put({[tge]:e,value:n});return new d3(r).toPromise()}async function qje(t,e){const n=Y9(t,!1).get(e),r=await new d3(n).toPromise();return r===void 0?null:r.value}function FX(t,e){const n=Y9(t,!0).delete(e);return new d3(n).toPromise()}const Wje=800,Gje=3;class nge{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await IL(),this.db)}async _withRetries(e){let n=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(n++>Gje)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return J0e()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=K9._getInstance($je()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var n,r;if(this.activeServiceWorker=await Fje(),!this.activeServiceWorker)return;this.sender=new jje(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&(n=e[0])!=null&&n.fulfilled&&(r=e[0])!=null&&r.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Vje()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await IL();return await BX(e,f7,"1"),await FX(e,f7),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>BX(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){const n=await this._withRetries(r=>qje(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>FX(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(i=>{const s=Y9(i,!1).getAll();return new d3(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(e.length!==0)for(const{fbase_key:i,value:s}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(const i of Object.keys(this.localCache))this.localCache[i]&&!r.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Wje)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}}nge.type="LOCAL";const Kje=nge;new c3(3e4,6e4);/**
|
||
* @license
|
||
* Copyright 2021 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function Yje(t,e){return e?Ih(e):(Ft(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class F$ extends W0e{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return ob(e,this._buildIdpRequest())}_linkToIdToken(e,n){return ob(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return ob(e,this._buildIdpRequest())}_buildIdpRequest(e){const n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}}function Zje(t){return Aje(t.auth,new F$(t),t.bypassAuthState)}function Xje(t){const{auth:e,user:n}=t;return Ft(n,e,"internal-error"),Tje(n,new F$(t),t.bypassAuthState)}async function Qje(t){const{auth:e,user:n}=t;return Ft(n,e,"internal-error"),Eje(n,new F$(t),t.bypassAuthState)}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class rge{constructor(e,n,r,i,s=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:n,sessionId:r,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}const l={auth:this.auth,requestUri:n,sessionId:r,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(l))}catch(c){this.reject(c)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return Zje;case"linkViaPopup":case"linkViaRedirect":return Qje;case"reauthViaPopup":case"reauthViaRedirect":return Xje;default:af(this.auth,"internal-error")}}resolve(e){lf(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){lf(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const Jje=new c3(2e3,1e4);class Fv extends rge{constructor(e,n,r,i,s){super(e,n,i,s),this.provider=r,this.authWindow=null,this.pollId=null,Fv.currentPopupAction&&Fv.currentPopupAction.cancel(),Fv.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return Ft(e,this.auth,"internal-error"),e}async onExecution(){lf(this.filter.length===1,"Popup operations only handle one event");const e=B$();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(id(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)==null?void 0:e.associatedEvent)||null}cancel(){this.reject(id(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Fv.currentPopupAction=null}pollUserCancellation(){const e=()=>{var n,r;if((r=(n=this.authWindow)==null?void 0:n.window)!=null&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(id(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,Jje.get())};e()}}Fv.currentPopupAction=null;/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const eBe="pendingRedirect",qT=new Map;class tBe extends rge{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=qT.get(this.auth._key());if(!e){try{const r=await nBe(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}qT.set(this.auth._key(),e)}return this.bypassAuthState||qT.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function nBe(t,e){const n=sBe(e),r=iBe(t);if(!await r._isAvailable())return!1;const i=await r._get(n)==="true";return await r._remove(n),i}function rBe(t,e){qT.set(t._key(),e)}function iBe(t){return Ih(t._redirectPersistence)}function sBe(t){return UT(eBe,t.config.apiKey,t.name)}async function oBe(t,e,n=!1){if(Rc(t.app))return Promise.reject(bm(t));const r=G9(t),i=Yje(r,e),o=await new tBe(r,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const aBe=10*60*1e3;class lBe{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(n=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!cBe(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var r;if(e.error&&!ige(e)){const i=((r=e.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(id(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){const r=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=aBe&&this.cachedEventUids.clear(),this.cachedEventUids.has(VX(e))}saveEventToCache(e){this.cachedEventUids.add(VX(e)),this.lastProcessedEventTime=Date.now()}}function VX(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function ige({type:t,error:e}){return t==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function cBe(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return ige(t);default:return!1}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/async function uBe(t,e={}){return Gx(t,"GET","/v1/projects",e)}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const dBe=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,hBe=/^https?/;async function fBe(t){if(t.config.emulator)return;const{authorizedDomains:e}=await uBe(t);for(const n of e)try{if(pBe(n))return}catch{}af(t,"unauthorized-domain")}function pBe(t){const e=TL(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const o=new URL(t);return o.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===r}if(!hBe.test(n))return!1;if(dBe.test(t))return r===t;const i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC.
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const mBe=new c3(3e4,6e4);function $X(){const t=sd().___jsl;if(t!=null&&t.H){for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let n=0;n<t.CP.length;n++)t.CP[n]=null}}function gBe(t){return new Promise((e,n)=>{var i,s,o;function r(){$X(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{$X(),n(id(t,"network-request-failed"))},timeout:mBe.get()})}if((s=(i=sd().gapi)==null?void 0:i.iframes)!=null&&s.Iframe)e(gapi.iframes.getContext());else if((o=sd().gapi)!=null&&o.load)r();else{const a=bje("iframefcb");return sd()[a]=()=>{gapi.load?r():n(id(t,"network-request-failed"))},yje(`${vje()}?onload=${a}`).catch(l=>n(l))}}).catch(e=>{throw WT=null,e})}let WT=null;function yBe(t){return WT=WT||gBe(t),WT}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC.
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const vBe=new c3(5e3,15e3),bBe="__/auth/iframe",wBe="emulator/auth/iframe",xBe={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},_Be=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function SBe(t){const e=t.config;Ft(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?P$(e,wBe):`https://${t.config.authDomain}/${bBe}`,r={apiKey:e.apiKey,appName:t.name,v:Wx},i=_Be.get(t.config.apiHost);i&&(r.eid=i);const s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${l3(r).slice(1)}`}async function kBe(t){const e=await yBe(t),n=sd().gapi;return Ft(n,t,"internal-error"),e.open({where:document.body,url:SBe(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:xBe,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});const o=id(t,"network-request-failed"),a=sd().setTimeout(()=>{s(o)},vBe.get());function l(){sd().clearTimeout(a),i(r)}r.ping(l).then(l,()=>{s(o)})}))}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC.
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const CBe={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},EBe=500,TBe=600,ABe="_blank",IBe="http://localhost";class HX{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function RBe(t,e,n,r=EBe,i=TBe){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const l={...CBe,width:r.toString(),height:i.toString(),top:s,left:o},c=io().toLowerCase();n&&(a=j0e(c)?ABe:n),L0e(c)&&(e=e||IBe,l.scrollbars="yes");const u=Object.entries(l).reduce((h,[f,p])=>`${h}${f}=${p},`,"");if(cje(c)&&a!=="_self")return MBe(e||"",a),new HX(null);const d=window.open(e||"",a,u);Ft(d,t,"popup-blocked");try{d.focus()}catch{}return new HX(d)}function MBe(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}/**
|
||
* @license
|
||
* Copyright 2021 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const NBe="__/auth/handler",OBe="emulator/auth/handler",DBe=encodeURIComponent("fac");async function UX(t,e,n,r,i,s){Ft(t.config.authDomain,t,"auth-domain-config-required"),Ft(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Wx,eventId:i};if(e instanceof G0e){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",DLe(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[u,d]of Object.entries({}))o[u]=d}if(e instanceof u3){const u=e.getScopes().filter(d=>d!=="");u.length>0&&(o.scopes=u.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const u of Object.keys(a))a[u]===void 0&&delete a[u];const l=await t._getAppCheckToken(),c=l?`#${DBe}=${encodeURIComponent(l)}`:"";return`${PBe(t)}?${l3(a).slice(1)}${c}`}function PBe({config:t}){return t.emulator?P$(t,OBe):`https://${t.authDomain}/${NBe}`}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const EN="webStorageSupport";class LBe{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Q0e,this._completeRedirectFn=oBe,this._overrideRedirectResult=rBe}async _openPopup(e,n,r,i){var o;lf((o=this.eventManagers[e._key()])==null?void 0:o.manager,"_initialize() not called before _openPopup()");const s=await UX(e,n,r,TL(),i);return RBe(e,s,B$())}async _openRedirect(e,n,r,i){await this._originValidation(e);const s=await UX(e,n,r,TL(),i);return Bje(s),new Promise(()=>{})}_initialize(e){const n=e._key();if(this.eventManagers[n]){const{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(lf(s,"If manager is not set, promise should be"),s)}const r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){const n=await kBe(e),r=new lBe(e);return n.register("authEvent",i=>(Ft(i==null?void 0:i.authEvent,e,"invalid-auth-event"),{status:r.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=n,r}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(EN,{type:EN},i=>{var o;const s=(o=i==null?void 0:i[0])==null?void 0:o[EN];s!==void 0&&n(!!s),af(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=fBe(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return H0e()||z0e()||z$()}}const zBe=LBe;var qX="@firebase/auth",WX="1.12.1";/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class jBe{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)==null?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const n=this.auth.onIdTokenChanged(r=>{e((r==null?void 0:r.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){Ft(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function BBe(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function FBe(t){$w(new j1("auth",(e,{options:n})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=r.options;Ft(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const l={apiKey:o,authDomain:a,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:U0e(t)},c=new mje(r,i,s,l);return xje(c,n),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),$w(new j1("auth-internal",e=>{const n=G9(e.getProvider("auth").getImmediate());return(r=>new jBe(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),vm(qX,WX,BBe(t)),vm(qX,WX,"esm2020")}/**
|
||
* @license
|
||
* Copyright 2021 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const VBe=5*60,$Be=v0e("authIdTokenMaxAge")||VBe;let GX=null;const HBe=t=>async e=>{const n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>$Be)return;const i=n==null?void 0:n.token;GX!==i&&(GX=i,await fetch(t,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function UBe(t=k0e()){const e=O$(t,"auth");if(e.isInitialized())return e.getImmediate();const n=wje(t,{popupRedirectResolver:zBe,persistence:[Kje,Lje,Q0e]}),r=v0e("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const s=new URL(r,location.origin);if(location.origin===s.origin){const o=HBe(s.toString());Nje(n,o,()=>o(n.currentUser)),Mje(n,a=>o(a))}}const i=g0e("auth");return i&&_je(n,`http://${i}`),n}function qBe(){var t;return((t=document.getElementsByTagName("head"))==null?void 0:t[0])??document}gje({loadJS(t){return new Promise((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=i=>{const s=id("internal-error");s.customData=i,n(s)},r.type="text/javascript",r.charset="UTF-8",qBe().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});FBe("Browser");const WBe={dev:{orionUrl:"https://orion.dev.flowy.live",pusherUrl:"wss://pusher.dev.flowy.live/ws",firebase:{apiKey:"AIzaSyDF_fbk7tDY9tNxUiOwwi--2nYZWZygMGk",appId:"1:1006580076785:web:e2a0736d60a78e02b15950",authDomain:"flowy-dev-440017.firebaseapp.com",messagingSenderId:"1006580076785",projectId:"flowy-dev-440017",storageBucket:"flowy-dev-440017.firebasestorage.app"},sentryDsn:"https://4bb3af832825929eeec8ab4edd56930f@o4511282312118272.ingest.us.sentry.io/4511282313494528"}},Z9=WBe.dev,GBe="dev",TN="auth_token",Rh=_f(t=>({token:localStorage.getItem(TN),setToken:e=>{localStorage.setItem(TN,e),t({token:e})},clearToken:()=>{localStorage.removeItem(TN),t({token:null})}}));function pe(t,e,n){function r(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,l);const c=o.prototype,u=Object.keys(c);for(let d=0;d<u.length;d++){const h=u[d];h in a||(a[h]=c[h].bind(a))}}const i=(n==null?void 0:n.Parent)??Object;class s extends i{}Object.defineProperty(s,"name",{value:t});function o(a){var l;const c=n!=null&&n.Parent?new s:this;r(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const u of c._zod.deferred)u();return c}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>{var l,c;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(c=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:c.has(t)}}),Object.defineProperty(o,"name",{value:t}),o}class ab extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class sge extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const oge={};function Pm(t){return oge}function age(t){const e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,i])=>e.indexOf(+r)===-1).map(([r,i])=>i)}function RL(t,e){return typeof e=="bigint"?e.toString():e}function X9(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function V$(t){return t==null}function $$(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function KBe(t,e){const n=(t.toString().split(".")[1]||"").length,r=e.toString();let i=(r.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(r)){const l=r.match(/\d?e-(\d?)/);l!=null&&l[1]&&(i=Number.parseInt(l[1]))}const s=n>i?n:i,o=Number.parseInt(t.toFixed(s).replace(".","")),a=Number.parseInt(e.toFixed(s).replace(".",""));return o%a/10**s}const KX=Symbol("evaluating");function Qn(t,e,n){let r;Object.defineProperty(t,e,{get(){if(r!==KX)return r===void 0&&(r=KX,r=n()),r},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function wy(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function y0(...t){const e={};for(const n of t){const r=Object.getOwnPropertyDescriptors(n);Object.assign(e,r)}return Object.defineProperties({},e)}function YX(t){return JSON.stringify(t)}function YBe(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const lge="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function LS(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const ZBe=X9(()=>{var t;if(typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)!=null&&t.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Hw(t){if(LS(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const n=e.prototype;return!(LS(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function cge(t){return Hw(t)?{...t}:Array.isArray(t)?[...t]:t}const XBe=new Set(["string","number","symbol"]);function Uw(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function v0(t,e,n){const r=new t._zod.constr(e??t._zod.def);return(!e||n!=null&&n.parent)&&(r._zod.parent=t),r}function kt(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function QBe(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const JBe={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function eFe(t,e){const n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=y0(t._zod.def,{get shape(){const o={};for(const a in e){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(o[a]=n.shape[a])}return wy(this,"shape",o),o},checks:[]});return v0(t,s)}function tFe(t,e){const n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=y0(t._zod.def,{get shape(){const o={...t._zod.def.shape};for(const a in e){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete o[a]}return wy(this,"shape",o),o},checks:[]});return v0(t,s)}function nFe(t,e){if(!Hw(e))throw new Error("Invalid input to extend: expected a plain object");const n=t._zod.def.checks;if(n&&n.length>0){const s=t._zod.def.shape;for(const o in e)if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=y0(t._zod.def,{get shape(){const s={...t._zod.def.shape,...e};return wy(this,"shape",s),s}});return v0(t,i)}function rFe(t,e){if(!Hw(e))throw new Error("Invalid input to safeExtend: expected a plain object");const n=y0(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e};return wy(this,"shape",r),r}});return v0(t,n)}function iFe(t,e){const n=y0(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return wy(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:[]});return v0(t,n)}function sFe(t,e,n){const i=e._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const o=y0(e._zod.def,{get shape(){const a=e._zod.def.shape,l={...a};if(n)for(const c in n){if(!(c in a))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(l[c]=t?new t({type:"optional",innerType:a[c]}):a[c])}else for(const c in a)l[c]=t?new t({type:"optional",innerType:a[c]}):a[c];return wy(this,"shape",l),l},checks:[]});return v0(e,o)}function oFe(t,e,n){const r=y0(e._zod.def,{get shape(){const i=e._zod.def.shape,s={...i};if(n)for(const o in n){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(s[o]=new t({type:"nonoptional",innerType:i[o]}))}else for(const o in i)s[o]=new t({type:"nonoptional",innerType:i[o]});return wy(this,"shape",s),s}});return v0(e,r)}function Vv(t,e=0){var n;if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(((n=t.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function $v(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function nE(t){return typeof t=="string"?t:t==null?void 0:t.message}function Lm(t,e,n){var i,s,o,a,l,c;const r={...t,path:t.path??[]};if(!t.message){const u=nE((o=(s=(i=t.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:o.call(s,t))??nE((a=e==null?void 0:e.error)==null?void 0:a.call(e,t))??nE((l=n.customError)==null?void 0:l.call(n,t))??nE((c=n.localeError)==null?void 0:c.call(n,t))??"Invalid input";r.message=u}return delete r.inst,delete r.continue,e!=null&&e.reportInput||delete r.input,r}function H$(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function zS(...t){const[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}const uge=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,RL,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},dge=pe("$ZodError",uge),hge=pe("$ZodError",uge,{Parent:Error});function aFe(t,e=n=>n.message){const n={},r=[];for(const i of t.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:n}}function lFe(t,e=n=>n.message){const n={_errors:[]},r=i=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(o=>r({issues:o}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(e(s));else{let o=n,a=0;for(;a<s.path.length;){const l=s.path[a];a===s.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(e(s))):o[l]=o[l]||{_errors:[]},o=o[l],a++}}};return r(t),n}const U$=t=>(e,n,r,i)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},o=e._zod.run({value:n,issues:[]},s);if(o instanceof Promise)throw new ab;if(o.issues.length){const a=new((i==null?void 0:i.Err)??t)(o.issues.map(l=>Lm(l,s,Pm())));throw lge(a,i==null?void 0:i.callee),a}return o.value},q$=t=>async(e,n,r,i)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let o=e._zod.run({value:n,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){const a=new((i==null?void 0:i.Err)??t)(o.issues.map(l=>Lm(l,s,Pm())));throw lge(a,i==null?void 0:i.callee),a}return o.value},Q9=t=>(e,n,r)=>{const i=r?{...r,async:!1}:{async:!1},s=e._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new ab;return s.issues.length?{success:!1,error:new(t??dge)(s.issues.map(o=>Lm(o,i,Pm())))}:{success:!0,data:s.value}},cFe=Q9(hge),J9=t=>async(e,n,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=e._zod.run({value:n,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(o=>Lm(o,i,Pm())))}:{success:!0,data:s.value}},uFe=J9(hge),dFe=t=>(e,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return U$(t)(e,n,i)},hFe=t=>(e,n,r)=>U$(t)(e,n,r),fFe=t=>async(e,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return q$(t)(e,n,i)},pFe=t=>async(e,n,r)=>q$(t)(e,n,r),mFe=t=>(e,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Q9(t)(e,n,i)},gFe=t=>(e,n,r)=>Q9(t)(e,n,r),yFe=t=>async(e,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return J9(t)(e,n,i)},vFe=t=>async(e,n,r)=>J9(t)(e,n,r),bFe=/^[cC][^\s-]{8,}$/,wFe=/^[0-9a-z]+$/,xFe=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,_Fe=/^[0-9a-vA-V]{20}$/,SFe=/^[A-Za-z0-9]{27}$/,kFe=/^[a-zA-Z0-9_-]{21}$/,CFe=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,EFe=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ZX=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,TFe=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,AFe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function IFe(){return new RegExp(AFe,"u")}const RFe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,MFe=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,NFe=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,OFe=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,DFe=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,fge=/^[A-Za-z0-9_-]*$/,PFe=/^\+[1-9]\d{6,14}$/,pge="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",LFe=new RegExp(`^${pge}$`);function mge(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function zFe(t){return new RegExp(`^${mge(t)}$`)}function jFe(t){const e=mge({precision:t.precision}),n=["Z"];t.local&&n.push(""),t.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${e}(?:${n.join("|")})`;return new RegExp(`^${pge}T(?:${r})$`)}const BFe=t=>{const e=t?`[\\s\\S]{${(t==null?void 0:t.minimum)??0},${(t==null?void 0:t.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},FFe=/^-?\d+$/,gge=/^-?\d+(?:\.\d+)?$/,VFe=/^(?:true|false)$/i,$Fe=/^[^A-Z]*$/,HFe=/^[^a-z]*$/,wa=pe("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),yge={number:"number",bigint:"bigint",object:"date"},vge=pe("$ZodCheckLessThan",(t,e)=>{wa.init(t,e);const n=yge[typeof e.value];t._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),bge=pe("$ZodCheckGreaterThan",(t,e)=>{wa.init(t,e);const n=yge[typeof e.value];t._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),UFe=pe("$ZodCheckMultipleOf",(t,e)=>{wa.init(t,e),t._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=e.value)}),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%e.value===BigInt(0):KBe(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort})}}),qFe=pe("$ZodCheckNumberFormat",(t,e)=>{var o;wa.init(t,e),e.format=e.format||"float64";const n=(o=e.format)==null?void 0:o.includes("int"),r=n?"int":"number",[i,s]=JBe[e.format];t._zod.onattach.push(a=>{const l=a._zod.bag;l.format=e.format,l.minimum=i,l.maximum=s,n&&(l.pattern=FFe)}),t._zod.check=a=>{const l=a.value;if(n){if(!Number.isInteger(l)){a.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:l,inst:t});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,inclusive:!0,continue:!e.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,inclusive:!0,continue:!e.abort});return}}l<i&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),l>s&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inclusive:!0,inst:t,continue:!e.abort})}}),WFe=pe("$ZodCheckMaxLength",(t,e)=>{var n;wa.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!V$(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const o=H$(i);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),GFe=pe("$ZodCheckMinLength",(t,e)=>{var n;wa.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!V$(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const o=H$(i);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),KFe=pe("$ZodCheckLengthEquals",(t,e)=>{var n;wa.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!V$(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=r=>{const i=r.value,s=i.length;if(s===e.length)return;const o=H$(i),a=s>e.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:t,continue:!e.abort})}}),eI=pe("$ZodCheckStringFormat",(t,e)=>{var n,r;wa.init(t,e),t._zod.onattach.push(i=>{const s=i._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(n=t._zod).check??(n.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(r=t._zod).check??(r.check=()=>{})}),YFe=pe("$ZodCheckRegex",(t,e)=>{eI.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),ZFe=pe("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=$Fe),eI.init(t,e)}),XFe=pe("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=HFe),eI.init(t,e)}),QFe=pe("$ZodCheckIncludes",(t,e)=>{wa.init(t,e);const n=Uw(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${n}`:n);e.pattern=r,t._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),JFe=pe("$ZodCheckStartsWith",(t,e)=>{wa.init(t,e);const n=new RegExp(`^${Uw(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:t,continue:!e.abort})}}),eVe=pe("$ZodCheckEndsWith",(t,e)=>{wa.init(t,e);const n=new RegExp(`.*${Uw(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:t,continue:!e.abort})}}),tVe=pe("$ZodCheckOverwrite",(t,e)=>{wa.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class nVe{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
|
||
`).filter(o=>o),i=Math.min(...r.map(o=>o.length-o.trimStart().length)),s=r.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(const o of s)this.content.push(o)}compile(){const e=Function,n=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new e(...n,i.join(`
|
||
`))}}const rVe={major:4,minor:3,patch:6},Hr=pe("$ZodType",(t,e)=>{var i;var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=rVe;const r=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&r.unshift(t);for(const s of r)for(const o of s._zod.onattach)o(t);if(r.length===0)(n=t._zod).deferred??(n.deferred=[]),(i=t._zod.deferred)==null||i.push(()=>{t._zod.run=t._zod.parse});else{const s=(a,l,c)=>{let u=Vv(a),d;for(const h of l){if(h._zod.def.when){if(!h._zod.def.when(a))continue}else if(u)continue;const f=a.issues.length,p=h._zod.check(a);if(p instanceof Promise&&(c==null?void 0:c.async)===!1)throw new ab;if(d||p instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await p,a.issues.length!==f&&(u||(u=Vv(a,f)))});else{if(a.issues.length===f)continue;u||(u=Vv(a,f))}}return d?d.then(()=>a):a},o=(a,l,c)=>{if(Vv(a))return a.aborted=!0,a;const u=s(l,r,c);if(u instanceof Promise){if(c.async===!1)throw new ab;return u.then(d=>t._zod.parse(d,c))}return t._zod.parse(u,c)};t._zod.run=(a,l)=>{if(l.skipChecks)return t._zod.parse(a,l);if(l.direction==="backward"){const u=t._zod.parse({value:a.value,issues:[]},{...l,skipChecks:!0});return u instanceof Promise?u.then(d=>o(d,a,l)):o(u,a,l)}const c=t._zod.parse(a,l);if(c instanceof Promise){if(l.async===!1)throw new ab;return c.then(u=>s(u,r,l))}return s(c,r,l)}}Qn(t,"~standard",()=>({validate:s=>{var o;try{const a=cFe(t,s);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return uFe(t,s).then(l=>{var c;return l.success?{value:l.data}:{issues:(c=l.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}))}),W$=pe("$ZodString",(t,e)=>{var n;Hr.init(t,e),t._zod.pattern=[...((n=t==null?void 0:t._zod.bag)==null?void 0:n.patterns)??[]].pop()??BFe(t._zod.bag),t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),Ur=pe("$ZodStringFormat",(t,e)=>{eI.init(t,e),W$.init(t,e)}),iVe=pe("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=EFe),Ur.init(t,e)}),sVe=pe("$ZodUUID",(t,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=ZX(r))}else e.pattern??(e.pattern=ZX());Ur.init(t,e)}),oVe=pe("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=TFe),Ur.init(t,e)}),aVe=pe("$ZodURL",(t,e)=>{Ur.init(t,e),t._zod.check=n=>{try{const r=n.value.trim(),i=new URL(r);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:n.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort})),e.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort})}}}),lVe=pe("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=IFe()),Ur.init(t,e)}),cVe=pe("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=kFe),Ur.init(t,e)}),uVe=pe("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=bFe),Ur.init(t,e)}),dVe=pe("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=wFe),Ur.init(t,e)}),hVe=pe("$ZodULID",(t,e)=>{e.pattern??(e.pattern=xFe),Ur.init(t,e)}),fVe=pe("$ZodXID",(t,e)=>{e.pattern??(e.pattern=_Fe),Ur.init(t,e)}),pVe=pe("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=SFe),Ur.init(t,e)}),mVe=pe("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=jFe(e)),Ur.init(t,e)}),gVe=pe("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=LFe),Ur.init(t,e)}),yVe=pe("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=zFe(e)),Ur.init(t,e)}),vVe=pe("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=CFe),Ur.init(t,e)}),bVe=pe("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=RFe),Ur.init(t,e),t._zod.bag.format="ipv4"}),wVe=pe("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=MFe),Ur.init(t,e),t._zod.bag.format="ipv6",t._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort})}}}),xVe=pe("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=NFe),Ur.init(t,e)}),_Ve=pe("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=OFe),Ur.init(t,e),t._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[i,s]=r;if(!s)throw new Error;const o=Number(s);if(`${o}`!==s)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${i}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort})}}});function wge(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const SVe=pe("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=DFe),Ur.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=n=>{wge(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function kVe(t){if(!fge.test(t))return!1;const e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return wge(n)}const CVe=pe("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=fge),Ur.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=n=>{kVe(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),EVe=pe("$ZodE164",(t,e)=>{e.pattern??(e.pattern=PFe),Ur.init(t,e)});function TVe(t,e=null){try{const n=t.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}const AVe=pe("$ZodJWT",(t,e)=>{Ur.init(t,e),t._zod.check=n=>{TVe(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),xge=pe("$ZodNumber",(t,e)=>{Hr.init(t,e),t._zod.pattern=t._zod.bag.pattern??gge,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=Number(n.value)}catch{}const i=n.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;const s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...s?{received:s}:{}}),n}}),IVe=pe("$ZodNumberFormat",(t,e)=>{qFe.init(t,e),xge.init(t,e)}),RVe=pe("$ZodBoolean",(t,e)=>{Hr.init(t,e),t._zod.pattern=VFe,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=!!n.value}catch{}const i=n.value;return typeof i=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),n}}),MVe=pe("$ZodUnknown",(t,e)=>{Hr.init(t,e),t._zod.parse=n=>n}),NVe=pe("$ZodNever",(t,e)=>{Hr.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)}),OVe=pe("$ZodDate",(t,e)=>{Hr.init(t,e),t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=new Date(n.value)}catch{}const i=n.value,s=i instanceof Date;return s&&!Number.isNaN(i.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:i,...s?{received:"Invalid Date"}:{},inst:t}),n}});function XX(t,e,n){t.issues.length&&e.issues.push(...$v(n,t.issues)),e.value[n]=t.value}const DVe=pe("$ZodArray",(t,e)=>{Hr.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:t}),n;n.value=Array(i.length);const s=[];for(let o=0;o<i.length;o++){const a=i[o],l=e.element._zod.run({value:a,issues:[]},r);l instanceof Promise?s.push(l.then(c=>XX(c,n,o))):XX(l,n,o)}return s.length?Promise.all(s).then(()=>n):n}});function m7(t,e,n,r,i){if(t.issues.length){if(i&&!(n in r))return;e.issues.push(...$v(n,t.issues))}t.value===void 0?n in r&&(e.value[n]=void 0):e.value[n]=t.value}function _ge(t){var r,i,s,o;const e=Object.keys(t.shape);for(const a of e)if(!((o=(s=(i=(r=t.shape)==null?void 0:r[a])==null?void 0:i._zod)==null?void 0:s.traits)!=null&&o.has("$ZodType")))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const n=QBe(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}function Sge(t,e,n,r,i,s){const o=[],a=i.keySet,l=i.catchall._zod,c=l.def.type,u=l.optout==="optional";for(const d in e){if(a.has(d))continue;if(c==="never"){o.push(d);continue}const h=l.run({value:e[d],issues:[]},r);h instanceof Promise?t.push(h.then(f=>m7(f,n,d,e,u))):m7(h,n,d,e,u)}return o.length&&n.issues.push({code:"unrecognized_keys",keys:o,input:e,inst:s}),t.length?Promise.all(t).then(()=>n):n}const PVe=pe("$ZodObject",(t,e)=>{Hr.init(t,e);const n=Object.getOwnPropertyDescriptor(e,"shape");if(!(n!=null&&n.get)){const a=e.shape;Object.defineProperty(e,"shape",{get:()=>{const l={...a};return Object.defineProperty(e,"shape",{value:l}),l}})}const r=X9(()=>_ge(e));Qn(t._zod,"propValues",()=>{const a=e.shape,l={};for(const c in a){const u=a[c]._zod;if(u.values){l[c]??(l[c]=new Set);for(const d of u.values)l[c].add(d)}}return l});const i=LS,s=e.catchall;let o;t._zod.parse=(a,l)=>{o??(o=r.value);const c=a.value;if(!i(c))return a.issues.push({expected:"object",code:"invalid_type",input:c,inst:t}),a;a.value={};const u=[],d=o.shape;for(const h of o.keys){const f=d[h],p=f._zod.optout==="optional",g=f._zod.run({value:c[h],issues:[]},l);g instanceof Promise?u.push(g.then(y=>m7(y,a,h,c,p))):m7(g,a,h,c,p)}return s?Sge(u,c,a,l,r.value,t):u.length?Promise.all(u).then(()=>a):a}}),LVe=pe("$ZodObjectJIT",(t,e)=>{PVe.init(t,e);const n=t._zod.parse,r=X9(()=>_ge(e)),i=h=>{var _;const f=new nVe(["shape","payload","ctx"]),p=r.value,g=S=>{const k=YX(S);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};f.write("const input = payload.value;");const y=Object.create(null);let v=0;for(const S of p.keys)y[S]=`key_${v++}`;f.write("const newResult = {};");for(const S of p.keys){const k=y[S],T=YX(S),E=h[S],C=((_=E==null?void 0:E._zod)==null?void 0:_.optout)==="optional";f.write(`const ${k} = ${g(S)};`),C?f.write(`
|
||
if (${k}.issues.length) {
|
||
if (${T} in input) {
|
||
payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
|
||
...iss,
|
||
path: iss.path ? [${T}, ...iss.path] : [${T}]
|
||
})));
|
||
}
|
||
}
|
||
|
||
if (${k}.value === undefined) {
|
||
if (${T} in input) {
|
||
newResult[${T}] = undefined;
|
||
}
|
||
} else {
|
||
newResult[${T}] = ${k}.value;
|
||
}
|
||
|
||
`):f.write(`
|
||
if (${k}.issues.length) {
|
||
payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
|
||
...iss,
|
||
path: iss.path ? [${T}, ...iss.path] : [${T}]
|
||
})));
|
||
}
|
||
|
||
if (${k}.value === undefined) {
|
||
if (${T} in input) {
|
||
newResult[${T}] = undefined;
|
||
}
|
||
} else {
|
||
newResult[${T}] = ${k}.value;
|
||
}
|
||
|
||
`)}f.write("payload.value = newResult;"),f.write("return payload;");const b=f.compile();return(S,k)=>b(h,S,k)};let s;const o=LS,a=!oge.jitless,c=a&&ZBe.value,u=e.catchall;let d;t._zod.parse=(h,f)=>{d??(d=r.value);const p=h.value;return o(p)?a&&c&&(f==null?void 0:f.async)===!1&&f.jitless!==!0?(s||(s=i(e.shape)),h=s(h,f),u?Sge([],p,h,f,d,t):h):n(h,f):(h.issues.push({expected:"object",code:"invalid_type",input:p,inst:t}),h)}});function QX(t,e,n,r){for(const s of t)if(s.issues.length===0)return e.value=s.value,e;const i=t.filter(s=>!Vv(s));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(s=>s.issues.map(o=>Lm(o,r,Pm())))}),e)}const kge=pe("$ZodUnion",(t,e)=>{Hr.init(t,e),Qn(t._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),Qn(t._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),Qn(t._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),Qn(t._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){const i=e.options.map(s=>s._zod.pattern);return new RegExp(`^(${i.map(s=>$$(s.source)).join("|")})$`)}});const n=e.options.length===1,r=e.options[0]._zod.run;t._zod.parse=(i,s)=>{if(n)return r(i,s);let o=!1;const a=[];for(const l of e.options){const c=l._zod.run({value:i.value,issues:[]},s);if(c instanceof Promise)a.push(c),o=!0;else{if(c.issues.length===0)return c;a.push(c)}}return o?Promise.all(a).then(l=>QX(l,i,t,s)):QX(a,i,t,s)}}),zVe=pe("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,kge.init(t,e);const n=t._zod.parse;Qn(t._zod,"propValues",()=>{const i={};for(const s of e.options){const o=s._zod.propValues;if(!o||Object.keys(o).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(const[a,l]of Object.entries(o)){i[a]||(i[a]=new Set);for(const c of l)i[a].add(c)}}return i});const r=X9(()=>{var o;const i=e.options,s=new Map;for(const a of i){const l=(o=a._zod.propValues)==null?void 0:o[e.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(const c of l){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,a)}}return s});t._zod.parse=(i,s)=>{const o=i.value;if(!LS(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:t}),i;const a=r.value.get(o==null?void 0:o[e.discriminator]);return a?a._zod.run(i,s):e.unionFallback?n(i,s):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:o,path:[e.discriminator],inst:t}),i)}}),jVe=pe("$ZodIntersection",(t,e)=>{Hr.init(t,e),t._zod.parse=(n,r)=>{const i=n.value,s=e.left._zod.run({value:i,issues:[]},r),o=e.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([l,c])=>JX(n,l,c)):JX(n,s,o)}});function ML(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Hw(t)&&Hw(e)){const n=Object.keys(e),r=Object.keys(t).filter(s=>n.indexOf(s)!==-1),i={...t,...e};for(const s of r){const o=ML(t[s],e[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<t.length;r++){const i=t[r],s=e[r],o=ML(i,s);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function JX(t,e,n){const r=new Map;let i;for(const a of e.issues)if(a.code==="unrecognized_keys"){i??(i=a);for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else t.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else t.issues.push(a);const s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&i&&t.issues.push({...i,keys:s}),Vv(t))return t;const o=ML(e.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return t.value=o.data,t}const BVe=pe("$ZodRecord",(t,e)=>{Hr.init(t,e),t._zod.parse=(n,r)=>{const i=n.value;if(!Hw(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),n;const s=[],o=e.keyType._zod.values;if(o){n.value={};const a=new Set;for(const c of o)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){a.add(typeof c=="number"?c.toString():c);const u=e.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?s.push(u.then(d=>{d.issues.length&&n.issues.push(...$v(c,d.issues)),n.value[c]=d.value})):(u.issues.length&&n.issues.push(...$v(c,u.issues)),n.value[c]=u.value)}let l;for(const c in i)a.has(c)||(l=l??[],l.push(c));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:l})}else{n.value={};for(const a of Reflect.ownKeys(i)){if(a==="__proto__")continue;let l=e.keyType._zod.run({value:a,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&gge.test(a)&&l.issues.length){const d=e.keyType._zod.run({value:Number(a),issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(l=d)}if(l.issues.length){e.mode==="loose"?n.value[a]=i[a]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(d=>Lm(d,r,Pm())),input:a,path:[a],inst:t});continue}const u=e.valueType._zod.run({value:i[a],issues:[]},r);u instanceof Promise?s.push(u.then(d=>{d.issues.length&&n.issues.push(...$v(a,d.issues)),n.value[l.value]=d.value})):(u.issues.length&&n.issues.push(...$v(a,u.issues)),n.value[l.value]=u.value)}}return s.length?Promise.all(s).then(()=>n):n}}),FVe=pe("$ZodEnum",(t,e)=>{Hr.init(t,e);const n=age(e.entries),r=new Set(n);t._zod.values=r,t._zod.pattern=new RegExp(`^(${n.filter(i=>XBe.has(typeof i)).map(i=>typeof i=="string"?Uw(i):i.toString()).join("|")})$`),t._zod.parse=(i,s)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:n,input:o,inst:t}),i}}),VVe=pe("$ZodLiteral",(t,e)=>{if(Hr.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(e.values);t._zod.values=n,t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Uw(r):r?Uw(r.toString()):String(r)).join("|")})$`),t._zod.parse=(r,i)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:e.values,input:s,inst:t}),r}}),$Ve=pe("$ZodTransform",(t,e)=>{Hr.init(t,e),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new sge(t.constructor.name);const i=e.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(n.value=o,n));if(i instanceof Promise)throw new ab;return n.value=i,n}});function eQ(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}const Cge=pe("$ZodOptional",(t,e)=>{Hr.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Qn(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Qn(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${$$(n.source)})?$`):void 0}),t._zod.parse=(n,r)=>{if(e.innerType._zod.optin==="optional"){const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>eQ(s,n.value)):eQ(i,n.value)}return n.value===void 0?n:e.innerType._zod.run(n,r)}}),HVe=pe("$ZodExactOptional",(t,e)=>{Cge.init(t,e),Qn(t._zod,"values",()=>e.innerType._zod.values),Qn(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(n,r)=>e.innerType._zod.run(n,r)}),UVe=pe("$ZodNullable",(t,e)=>{Hr.init(t,e),Qn(t._zod,"optin",()=>e.innerType._zod.optin),Qn(t._zod,"optout",()=>e.innerType._zod.optout),Qn(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${$$(n.source)}|null)$`):void 0}),Qn(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(n,r)=>n.value===null?n:e.innerType._zod.run(n,r)}),qVe=pe("$ZodDefault",(t,e)=>{Hr.init(t,e),t._zod.optin="optional",Qn(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);if(n.value===void 0)return n.value=e.defaultValue,n;const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>tQ(s,e)):tQ(i,e)}});function tQ(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const WVe=pe("$ZodPrefault",(t,e)=>{Hr.init(t,e),t._zod.optin="optional",Qn(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=e.defaultValue),e.innerType._zod.run(n,r))}),GVe=pe("$ZodNonOptional",(t,e)=>{Hr.init(t,e),Qn(t._zod,"values",()=>{const n=e.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),t._zod.parse=(n,r)=>{const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>nQ(s,t)):nQ(i,t)}});function nQ(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const KVe=pe("$ZodCatch",(t,e)=>{Hr.init(t,e),Qn(t._zod,"optin",()=>e.innerType._zod.optin),Qn(t._zod,"optout",()=>e.innerType._zod.optout),Qn(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>(n.value=s.value,s.issues.length&&(n.value=e.catchValue({...n,error:{issues:s.issues.map(o=>Lm(o,r,Pm()))},input:n.value}),n.issues=[]),n)):(n.value=i.value,i.issues.length&&(n.value=e.catchValue({...n,error:{issues:i.issues.map(s=>Lm(s,r,Pm()))},input:n.value}),n.issues=[]),n)}}),YVe=pe("$ZodPipe",(t,e)=>{Hr.init(t,e),Qn(t._zod,"values",()=>e.in._zod.values),Qn(t._zod,"optin",()=>e.in._zod.optin),Qn(t._zod,"optout",()=>e.out._zod.optout),Qn(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=e.out._zod.run(n,r);return s instanceof Promise?s.then(o=>rE(o,e.in,r)):rE(s,e.in,r)}const i=e.in._zod.run(n,r);return i instanceof Promise?i.then(s=>rE(s,e.out,r)):rE(i,e.out,r)}});function rE(t,e,n){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},n)}const ZVe=pe("$ZodReadonly",(t,e)=>{Hr.init(t,e),Qn(t._zod,"propValues",()=>e.innerType._zod.propValues),Qn(t._zod,"values",()=>e.innerType._zod.values),Qn(t._zod,"optin",()=>{var n,r;return(r=(n=e.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),Qn(t._zod,"optout",()=>{var n,r;return(r=(n=e.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(rQ):rQ(i)}});function rQ(t){return t.value=Object.freeze(t.value),t}const XVe=pe("$ZodCustom",(t,e)=>{wa.init(t,e),Hr.init(t,e),t._zod.parse=(n,r)=>n,t._zod.check=n=>{const r=n.value,i=e.fn(r);if(i instanceof Promise)return i.then(s=>iQ(s,n,r,t));iQ(i,n,r,t)}});function iQ(t,e,n,r){if(!t){const i={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),e.issues.push(zS(i))}}var sQ;class QVe{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){const r=n[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const n=this._map.get(e);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){const n=e._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const i={...r,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function JVe(){return new QVe}(sQ=globalThis).__zod_globalRegistry??(sQ.__zod_globalRegistry=JVe());const w4=globalThis.__zod_globalRegistry;function e$e(t,e){return new t({type:"string",...kt(e)})}function t$e(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...kt(e)})}function oQ(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...kt(e)})}function n$e(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...kt(e)})}function r$e(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...kt(e)})}function i$e(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...kt(e)})}function s$e(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...kt(e)})}function o$e(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...kt(e)})}function a$e(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...kt(e)})}function l$e(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...kt(e)})}function c$e(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...kt(e)})}function u$e(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...kt(e)})}function d$e(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...kt(e)})}function h$e(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...kt(e)})}function f$e(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...kt(e)})}function p$e(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...kt(e)})}function m$e(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...kt(e)})}function g$e(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...kt(e)})}function y$e(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...kt(e)})}function v$e(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...kt(e)})}function b$e(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...kt(e)})}function w$e(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...kt(e)})}function x$e(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...kt(e)})}function _$e(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...kt(e)})}function S$e(t,e){return new t({type:"string",format:"date",check:"string_format",...kt(e)})}function k$e(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...kt(e)})}function C$e(t,e){return new t({type:"string",format:"duration",check:"string_format",...kt(e)})}function E$e(t,e){return new t({type:"number",checks:[],...kt(e)})}function T$e(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...kt(e)})}function A$e(t,e){return new t({type:"boolean",...kt(e)})}function I$e(t){return new t({type:"unknown"})}function R$e(t,e){return new t({type:"never",...kt(e)})}function M$e(t,e){return new t({type:"date",coerce:!0,...kt(e)})}function aQ(t,e){return new vge({check:"less_than",...kt(e),value:t,inclusive:!1})}function GT(t,e){return new vge({check:"less_than",...kt(e),value:t,inclusive:!0})}function lQ(t,e){return new bge({check:"greater_than",...kt(e),value:t,inclusive:!1})}function KT(t,e){return new bge({check:"greater_than",...kt(e),value:t,inclusive:!0})}function cQ(t,e){return new UFe({check:"multiple_of",...kt(e),value:t})}function Ege(t,e){return new WFe({check:"max_length",...kt(e),maximum:t})}function g7(t,e){return new GFe({check:"min_length",...kt(e),minimum:t})}function Tge(t,e){return new KFe({check:"length_equals",...kt(e),length:t})}function N$e(t,e){return new YFe({check:"string_format",format:"regex",...kt(e),pattern:t})}function O$e(t){return new ZFe({check:"string_format",format:"lowercase",...kt(t)})}function D$e(t){return new XFe({check:"string_format",format:"uppercase",...kt(t)})}function P$e(t,e){return new QFe({check:"string_format",format:"includes",...kt(e),includes:t})}function L$e(t,e){return new JFe({check:"string_format",format:"starts_with",...kt(e),prefix:t})}function z$e(t,e){return new eVe({check:"string_format",format:"ends_with",...kt(e),suffix:t})}function Kx(t){return new tVe({check:"overwrite",tx:t})}function j$e(t){return Kx(e=>e.normalize(t))}function B$e(){return Kx(t=>t.trim())}function F$e(){return Kx(t=>t.toLowerCase())}function V$e(){return Kx(t=>t.toUpperCase())}function $$e(){return Kx(t=>YBe(t))}function H$e(t,e,n){return new t({type:"array",element:e,...kt(n)})}function U$e(t,e,n){return new t({type:"custom",check:"custom",fn:e,...kt(n)})}function q$e(t){const e=W$e(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(zS(r,n.value,e._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),i.continue??(i.continue=!e._zod.def.abort),n.issues.push(zS(i))}},t(n.value,n)));return e}function W$e(t,e){const n=new wa({check:"custom",...kt(e)});return n._zod.check=t,n}function Age(t){let e=(t==null?void 0:t.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:(t==null?void 0:t.metadata)??w4,target:e,unrepresentable:(t==null?void 0:t.unrepresentable)??"throw",override:(t==null?void 0:t.override)??(()=>{}),io:(t==null?void 0:t.io)??"output",counter:0,seen:new Map,cycles:(t==null?void 0:t.cycles)??"ref",reused:(t==null?void 0:t.reused)??"inline",external:(t==null?void 0:t.external)??void 0}}function Pi(t,e,n={path:[],schemaPath:[]}){var u,d;var r;const i=t._zod.def,s=e.seen.get(t);if(s)return s.count++,n.schemaPath.includes(t)&&(s.cycle=n.path),s.schema;const o={schema:{},count:1,cycle:void 0,path:n.path};e.seen.set(t,o);const a=(d=(u=t._zod).toJSONSchema)==null?void 0:d.call(u);if(a)o.schema=a;else{const h={...n,schemaPath:[...n.schemaPath,t],path:n.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,o.schema,h);else{const p=o.schema,g=e.processors[i.type];if(!g)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);g(t,e,p,h)}const f=t._zod.parent;f&&(o.ref||(o.ref=f),Pi(f,e,h),e.seen.get(f).isParent=!0)}const l=e.metadataRegistry.get(t);return l&&Object.assign(o.schema,l),e.io==="input"&&mo(t)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(t).schema}function Ige(t,e){var o,a,l,c;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const u of t.seen.entries()){const d=(o=t.metadataRegistry.get(u[0]))==null?void 0:o.id;if(d){const h=r.get(d);if(h&&h!==u[0])throw new Error(`Duplicate schema id "${d}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(d,u[0])}}const i=u=>{var g;const d=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const y=(g=t.external.registry.get(u[0]))==null?void 0:g.id,v=t.external.uri??(_=>_);if(y)return{ref:v(y)};const b=u[1].defId??u[1].schema.id??`schema${t.counter++}`;return u[1].defId=b,{defId:b,ref:`${v("__shared")}#/${d}/${b}`}}if(u[1]===n)return{ref:"#"};const f=`#/${d}/`,p=u[1].schema.id??`__schema${t.counter++}`;return{defId:p,ref:f+p}},s=u=>{if(u[1].schema.$ref)return;const d=u[1],{ref:h,defId:f}=i(u);d.def={...d.schema},f&&(d.defId=f);const p=d.schema;for(const g in p)delete p[g];p.$ref=h};if(t.cycles==="throw")for(const u of t.seen.entries()){const d=u[1];if(d.cycle)throw new Error(`Cycle detected: #/${(a=d.cycle)==null?void 0:a.join("/")}/<root>
|
||
|
||
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of t.seen.entries()){const d=u[1];if(e===u[0]){s(u);continue}if(t.external){const f=(l=t.external.registry.get(u[0]))==null?void 0:l.id;if(e!==u[0]&&f){s(u);continue}}if((c=t.metadataRegistry.get(u[0]))==null?void 0:c.id){s(u);continue}if(d.cycle){s(u);continue}if(d.count>1&&t.reused==="ref"){s(u);continue}}}function Rge(t,e){var o,a,l;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=c=>{const u=t.seen.get(c);if(u.ref===null)return;const d=u.def??u.schema,h={...d},f=u.ref;if(u.ref=null,f){r(f);const g=t.seen.get(f),y=g.schema;if(y.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(d.allOf=d.allOf??[],d.allOf.push(y)):Object.assign(d,y),Object.assign(d,h),c._zod.parent===f)for(const b in d)b==="$ref"||b==="allOf"||b in h||delete d[b];if(y.$ref&&g.def)for(const b in d)b==="$ref"||b==="allOf"||b in g.def&&JSON.stringify(d[b])===JSON.stringify(g.def[b])&&delete d[b]}const p=c._zod.parent;if(p&&p!==f){r(p);const g=t.seen.get(p);if(g!=null&&g.schema.$ref&&(d.$ref=g.schema.$ref,g.def))for(const y in d)y==="$ref"||y==="allOf"||y in g.def&&JSON.stringify(d[y])===JSON.stringify(g.def[y])&&delete d[y]}t.override({zodSchema:c,jsonSchema:d,path:u.path??[]})};for(const c of[...t.seen.entries()].reverse())r(c[0]);const i={};if(t.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":t.target,(o=t.external)!=null&&o.uri){const c=(a=t.external.registry.get(e))==null?void 0:a.id;if(!c)throw new Error("Schema is missing an `id` property");i.$id=t.external.uri(c)}Object.assign(i,n.def??n.schema);const s=((l=t.external)==null?void 0:l.defs)??{};for(const c of t.seen.entries()){const u=c[1];u.def&&u.defId&&(s[u.defId]=u.def)}t.external||Object.keys(s).length>0&&(t.target==="draft-2020-12"?i.$defs=s:i.definitions=s);try{const c=JSON.parse(JSON.stringify(i));return Object.defineProperty(c,"~standard",{value:{...e["~standard"],jsonSchema:{input:y7(e,"input",t.processors),output:y7(e,"output",t.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function mo(t,e){const n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);const r=t._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return mo(r.element,n);if(r.type==="set")return mo(r.valueType,n);if(r.type==="lazy")return mo(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return mo(r.innerType,n);if(r.type==="intersection")return mo(r.left,n)||mo(r.right,n);if(r.type==="record"||r.type==="map")return mo(r.keyType,n)||mo(r.valueType,n);if(r.type==="pipe")return mo(r.in,n)||mo(r.out,n);if(r.type==="object"){for(const i in r.shape)if(mo(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(mo(i,n))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(mo(i,n))return!0;return!!(r.rest&&mo(r.rest,n))}return!1}const G$e=(t,e={})=>n=>{const r=Age({...n,processors:e});return Pi(t,r),Ige(r,t),Rge(r,t)},y7=(t,e,n={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=Age({...i??{},target:s,io:e,processors:n});return Pi(t,o),Ige(o,t),Rge(o,t)},K$e={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Y$e=(t,e,n,r)=>{const i=n;i.type="string";const{minimum:s,maximum:o,format:a,patterns:l,contentEncoding:c}=t._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),a&&(i.format=K$e[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),c&&(i.contentEncoding=c),l&&l.size>0){const u=[...l];u.length===1?i.pattern=u[0].source:u.length>1&&(i.allOf=[...u.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},Z$e=(t,e,n,r)=>{const i=n,{minimum:s,maximum:o,format:a,multipleOf:l,exclusiveMaximum:c,exclusiveMinimum:u}=t._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number",typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof s=="number"&&(i.minimum=s,typeof u=="number"&&e.target!=="draft-04"&&(u>=s?delete i.minimum:delete i.exclusiveMinimum)),typeof c=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c),typeof o=="number"&&(i.maximum=o,typeof c=="number"&&e.target!=="draft-04"&&(c<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof l=="number"&&(i.multipleOf=l)},X$e=(t,e,n,r)=>{n.type="boolean"},Q$e=(t,e,n,r)=>{n.not={}},J$e=(t,e,n,r)=>{},eHe=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},tHe=(t,e,n,r)=>{const i=t._zod.def,s=age(i.entries);s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),n.enum=s},nHe=(t,e,n,r)=>{const i=t._zod.def,s=[];for(const o of i.values)if(o===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(o))}else s.push(o);if(s.length!==0)if(s.length===1){const o=s[0];n.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?n.enum=[o]:n.const=o}else s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),s.every(o=>typeof o=="boolean")&&(n.type="boolean"),s.every(o=>o===null)&&(n.type="null"),n.enum=s},rHe=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},iHe=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},sHe=(t,e,n,r)=>{const i=n,s=t._zod.def,{minimum:o,maximum:a}=t._zod.bag;typeof o=="number"&&(i.minItems=o),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=Pi(s.element,e,{...r,path:[...r.path,"items"]})},oHe=(t,e,n,r)=>{var c;const i=n,s=t._zod.def;i.type="object",i.properties={};const o=s.shape;for(const u in o)i.properties[u]=Pi(o[u],e,{...r,path:[...r.path,"properties",u]});const a=new Set(Object.keys(o)),l=new Set([...a].filter(u=>{const d=s.shape[u]._zod;return e.io==="input"?d.optin===void 0:d.optout===void 0}));l.size>0&&(i.required=Array.from(l)),((c=s.catchall)==null?void 0:c._zod.def.type)==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=Pi(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},aHe=(t,e,n,r)=>{const i=t._zod.def,s=i.inclusive===!1,o=i.options.map((a,l)=>Pi(a,e,{...r,path:[...r.path,s?"oneOf":"anyOf",l]}));s?n.oneOf=o:n.anyOf=o},lHe=(t,e,n,r)=>{const i=t._zod.def,s=Pi(i.left,e,{...r,path:[...r.path,"allOf",0]}),o=Pi(i.right,e,{...r,path:[...r.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,l=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];n.allOf=l},cHe=(t,e,n,r)=>{const i=n,s=t._zod.def;i.type="object";const o=s.keyType,a=o._zod.bag,l=a==null?void 0:a.patterns;if(s.mode==="loose"&&l&&l.size>0){const u=Pi(s.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const d of l)i.patternProperties[d.source]=u}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=Pi(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=Pi(s.valueType,e,{...r,path:[...r.path,"additionalProperties"]});const c=o._zod.values;if(c){const u=[...c].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(i.required=u)}},uHe=(t,e,n,r)=>{const i=t._zod.def,s=Pi(i.innerType,e,r),o=e.seen.get(t);e.target==="openapi-3.0"?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},dHe=(t,e,n,r)=>{const i=t._zod.def;Pi(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType},hHe=(t,e,n,r)=>{const i=t._zod.def;Pi(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},fHe=(t,e,n,r)=>{const i=t._zod.def;Pi(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,e.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},pHe=(t,e,n,r)=>{const i=t._zod.def;Pi(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o},mHe=(t,e,n,r)=>{const i=t._zod.def,s=e.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;Pi(s,e,r);const o=e.seen.get(t);o.ref=s},gHe=(t,e,n,r)=>{const i=t._zod.def;Pi(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,n.readOnly=!0},Mge=(t,e,n,r)=>{const i=t._zod.def;Pi(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType},yHe=pe("ZodISODateTime",(t,e)=>{mVe.init(t,e),ti.init(t,e)});function vHe(t){return _$e(yHe,t)}const bHe=pe("ZodISODate",(t,e)=>{gVe.init(t,e),ti.init(t,e)});function wHe(t){return S$e(bHe,t)}const xHe=pe("ZodISOTime",(t,e)=>{yVe.init(t,e),ti.init(t,e)});function _He(t){return k$e(xHe,t)}const SHe=pe("ZodISODuration",(t,e)=>{vVe.init(t,e),ti.init(t,e)});function kHe(t){return C$e(SHe,t)}const Nge=(t,e)=>{dge.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>lFe(t,n)},flatten:{value:n=>aFe(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,RL,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,RL,2)}},isEmpty:{get(){return t.issues.length===0}}})},CHe=pe("ZodError",Nge),sc=pe("ZodError",Nge,{Parent:Error}),EHe=U$(sc),THe=q$(sc),AHe=Q9(sc),IHe=J9(sc),RHe=dFe(sc),MHe=hFe(sc),NHe=fFe(sc),OHe=pFe(sc),DHe=mFe(sc),PHe=gFe(sc),LHe=yFe(sc),zHe=vFe(sc),qr=pe("ZodType",(t,e)=>(Hr.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:y7(t,"input"),output:y7(t,"output")}}),t.toJSONSchema=G$e(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...n)=>t.clone(y0(e,{checks:[...e.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),t.with=t.check,t.clone=(n,r)=>v0(t,n,r),t.brand=()=>t,t.register=(n,r)=>(n.add(t,r),t),t.parse=(n,r)=>EHe(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>AHe(t,n,r),t.parseAsync=async(n,r)=>THe(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>IHe(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>RHe(t,n,r),t.decode=(n,r)=>MHe(t,n,r),t.encodeAsync=async(n,r)=>NHe(t,n,r),t.decodeAsync=async(n,r)=>OHe(t,n,r),t.safeEncode=(n,r)=>DHe(t,n,r),t.safeDecode=(n,r)=>PHe(t,n,r),t.safeEncodeAsync=async(n,r)=>LHe(t,n,r),t.safeDecodeAsync=async(n,r)=>zHe(t,n,r),t.refine=(n,r)=>t.check(OUe(n,r)),t.superRefine=n=>t.check(DUe(n)),t.overwrite=n=>t.check(Kx(n)),t.optional=()=>fQ(t),t.exactOptional=()=>wUe(t),t.nullable=()=>pQ(t),t.nullish=()=>fQ(pQ(t)),t.nonoptional=n=>EUe(t,n),t.array=()=>Qa(t),t.or=n=>uUe([t,n]),t.and=n=>pUe(t,n),t.transform=n=>mQ(t,vUe(n)),t.default=n=>SUe(t,n),t.prefault=n=>CUe(t,n),t.catch=n=>AUe(t,n),t.pipe=n=>mQ(t,n),t.readonly=()=>MUe(t),t.describe=n=>{const r=t.clone();return w4.add(r,{description:n}),r},Object.defineProperty(t,"description",{get(){var n;return(n=w4.get(t))==null?void 0:n.description},configurable:!0}),t.meta=(...n)=>{if(n.length===0)return w4.get(t);const r=t.clone();return w4.add(r,n[0]),r},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=n=>n(t),t)),Oge=pe("_ZodString",(t,e)=>{W$.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(r,i,s)=>Y$e(t,r,i);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,t.regex=(...r)=>t.check(N$e(...r)),t.includes=(...r)=>t.check(P$e(...r)),t.startsWith=(...r)=>t.check(L$e(...r)),t.endsWith=(...r)=>t.check(z$e(...r)),t.min=(...r)=>t.check(g7(...r)),t.max=(...r)=>t.check(Ege(...r)),t.length=(...r)=>t.check(Tge(...r)),t.nonempty=(...r)=>t.check(g7(1,...r)),t.lowercase=r=>t.check(O$e(r)),t.uppercase=r=>t.check(D$e(r)),t.trim=()=>t.check(B$e()),t.normalize=(...r)=>t.check(j$e(...r)),t.toLowerCase=()=>t.check(F$e()),t.toUpperCase=()=>t.check(V$e()),t.slugify=()=>t.check($$e())}),jHe=pe("ZodString",(t,e)=>{W$.init(t,e),Oge.init(t,e),t.email=n=>t.check(t$e(BHe,n)),t.url=n=>t.check(o$e(FHe,n)),t.jwt=n=>t.check(x$e(tUe,n)),t.emoji=n=>t.check(a$e(VHe,n)),t.guid=n=>t.check(oQ(uQ,n)),t.uuid=n=>t.check(n$e(iE,n)),t.uuidv4=n=>t.check(r$e(iE,n)),t.uuidv6=n=>t.check(i$e(iE,n)),t.uuidv7=n=>t.check(s$e(iE,n)),t.nanoid=n=>t.check(l$e($He,n)),t.guid=n=>t.check(oQ(uQ,n)),t.cuid=n=>t.check(c$e(HHe,n)),t.cuid2=n=>t.check(u$e(UHe,n)),t.ulid=n=>t.check(d$e(qHe,n)),t.base64=n=>t.check(v$e(QHe,n)),t.base64url=n=>t.check(b$e(JHe,n)),t.xid=n=>t.check(h$e(WHe,n)),t.ksuid=n=>t.check(f$e(GHe,n)),t.ipv4=n=>t.check(p$e(KHe,n)),t.ipv6=n=>t.check(m$e(YHe,n)),t.cidrv4=n=>t.check(g$e(ZHe,n)),t.cidrv6=n=>t.check(y$e(XHe,n)),t.e164=n=>t.check(w$e(eUe,n)),t.datetime=n=>t.check(vHe(n)),t.date=n=>t.check(wHe(n)),t.time=n=>t.check(_He(n)),t.duration=n=>t.check(kHe(n))});function vt(t){return e$e(jHe,t)}const ti=pe("ZodStringFormat",(t,e)=>{Ur.init(t,e),Oge.init(t,e)}),BHe=pe("ZodEmail",(t,e)=>{oVe.init(t,e),ti.init(t,e)}),uQ=pe("ZodGUID",(t,e)=>{iVe.init(t,e),ti.init(t,e)}),iE=pe("ZodUUID",(t,e)=>{sVe.init(t,e),ti.init(t,e)}),FHe=pe("ZodURL",(t,e)=>{aVe.init(t,e),ti.init(t,e)}),VHe=pe("ZodEmoji",(t,e)=>{lVe.init(t,e),ti.init(t,e)}),$He=pe("ZodNanoID",(t,e)=>{cVe.init(t,e),ti.init(t,e)}),HHe=pe("ZodCUID",(t,e)=>{uVe.init(t,e),ti.init(t,e)}),UHe=pe("ZodCUID2",(t,e)=>{dVe.init(t,e),ti.init(t,e)}),qHe=pe("ZodULID",(t,e)=>{hVe.init(t,e),ti.init(t,e)}),WHe=pe("ZodXID",(t,e)=>{fVe.init(t,e),ti.init(t,e)}),GHe=pe("ZodKSUID",(t,e)=>{pVe.init(t,e),ti.init(t,e)}),KHe=pe("ZodIPv4",(t,e)=>{bVe.init(t,e),ti.init(t,e)}),YHe=pe("ZodIPv6",(t,e)=>{wVe.init(t,e),ti.init(t,e)}),ZHe=pe("ZodCIDRv4",(t,e)=>{xVe.init(t,e),ti.init(t,e)}),XHe=pe("ZodCIDRv6",(t,e)=>{_Ve.init(t,e),ti.init(t,e)}),QHe=pe("ZodBase64",(t,e)=>{SVe.init(t,e),ti.init(t,e)}),JHe=pe("ZodBase64URL",(t,e)=>{CVe.init(t,e),ti.init(t,e)}),eUe=pe("ZodE164",(t,e)=>{EVe.init(t,e),ti.init(t,e)}),tUe=pe("ZodJWT",(t,e)=>{AVe.init(t,e),ti.init(t,e)}),Dge=pe("ZodNumber",(t,e)=>{xge.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(r,i,s)=>Z$e(t,r,i),t.gt=(r,i)=>t.check(lQ(r,i)),t.gte=(r,i)=>t.check(KT(r,i)),t.min=(r,i)=>t.check(KT(r,i)),t.lt=(r,i)=>t.check(aQ(r,i)),t.lte=(r,i)=>t.check(GT(r,i)),t.max=(r,i)=>t.check(GT(r,i)),t.int=r=>t.check(dQ(r)),t.safe=r=>t.check(dQ(r)),t.positive=r=>t.check(lQ(0,r)),t.nonnegative=r=>t.check(KT(0,r)),t.negative=r=>t.check(aQ(0,r)),t.nonpositive=r=>t.check(GT(0,r)),t.multipleOf=(r,i)=>t.check(cQ(r,i)),t.step=(r,i)=>t.check(cQ(r,i)),t.finite=()=>t;const n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=!0,t.format=n.format??null});function Js(t){return E$e(Dge,t)}const nUe=pe("ZodNumberFormat",(t,e)=>{IVe.init(t,e),Dge.init(t,e)});function dQ(t){return T$e(nUe,t)}const rUe=pe("ZodBoolean",(t,e)=>{RVe.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(n,r,i)=>X$e(t,n,r)});function h3(t){return A$e(rUe,t)}const iUe=pe("ZodUnknown",(t,e)=>{MVe.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(n,r,i)=>J$e()});function hQ(){return I$e(iUe)}const sUe=pe("ZodNever",(t,e)=>{NVe.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Q$e(t,n,r)});function oUe(t){return R$e(sUe,t)}const aUe=pe("ZodDate",(t,e)=>{OVe.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(r,i,s)=>eHe(t,r),t.min=(r,i)=>t.check(KT(r,i)),t.max=(r,i)=>t.check(GT(r,i));const n=t._zod.bag;t.minDate=n.minimum?new Date(n.minimum):null,t.maxDate=n.maximum?new Date(n.maximum):null}),lUe=pe("ZodArray",(t,e)=>{DVe.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(n,r,i)=>sHe(t,n,r,i),t.element=e.element,t.min=(n,r)=>t.check(g7(n,r)),t.nonempty=n=>t.check(g7(1,n)),t.max=(n,r)=>t.check(Ege(n,r)),t.length=(n,r)=>t.check(Tge(n,r)),t.unwrap=()=>t.element});function Qa(t,e){return H$e(lUe,t,e)}const cUe=pe("ZodObject",(t,e)=>{LVe.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(n,r,i)=>oHe(t,n,r,i),Qn(t,"shape",()=>e.shape),t.keyof=()=>f3(Object.keys(t._zod.def.shape)),t.catchall=n=>t.clone({...t._zod.def,catchall:n}),t.passthrough=()=>t.clone({...t._zod.def,catchall:hQ()}),t.loose=()=>t.clone({...t._zod.def,catchall:hQ()}),t.strict=()=>t.clone({...t._zod.def,catchall:oUe()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=n=>nFe(t,n),t.safeExtend=n=>rFe(t,n),t.merge=n=>iFe(t,n),t.pick=n=>eFe(t,n),t.omit=n=>tFe(t,n),t.partial=(...n)=>sFe(Lge,t,n[0]),t.required=(...n)=>oFe(zge,t,n[0])});function Kn(t,e){const n={type:"object",shape:t??{},...kt(e)};return new cUe(n)}const Pge=pe("ZodUnion",(t,e)=>{kge.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(n,r,i)=>aHe(t,n,r,i),t.options=e.options});function uUe(t,e){return new Pge({type:"union",options:t,...kt(e)})}const dUe=pe("ZodDiscriminatedUnion",(t,e)=>{Pge.init(t,e),zVe.init(t,e)});function hUe(t,e,n){return new dUe({type:"union",options:e,discriminator:t,...kt(n)})}const fUe=pe("ZodIntersection",(t,e)=>{jVe.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(n,r,i)=>lHe(t,n,r,i)});function pUe(t,e){return new fUe({type:"intersection",left:t,right:e})}const mUe=pe("ZodRecord",(t,e)=>{BVe.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(n,r,i)=>cHe(t,n,r,i),t.keyType=e.keyType,t.valueType=e.valueType});function G$(t,e,n){return new mUe({type:"record",keyType:t,valueType:e,...kt(n)})}const NL=pe("ZodEnum",(t,e)=>{FVe.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(r,i,s)=>tHe(t,r,i),t.enum=e.entries,t.options=Object.values(e.entries);const n=new Set(Object.keys(e.entries));t.extract=(r,i)=>{const s={};for(const o of r)if(n.has(o))s[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new NL({...e,checks:[],...kt(i),entries:s})},t.exclude=(r,i)=>{const s={...e.entries};for(const o of r)if(n.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new NL({...e,checks:[],...kt(i),entries:s})}});function f3(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new NL({type:"enum",entries:n,...kt(e)})}const gUe=pe("ZodLiteral",(t,e)=>{VVe.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(n,r,i)=>nHe(t,n,r),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function Gf(t,e){return new gUe({type:"literal",values:Array.isArray(t)?t:[t],...kt(e)})}const yUe=pe("ZodTransform",(t,e)=>{$Ve.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(n,r,i)=>iHe(t,n),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new sge(t.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(zS(s,n.value,e));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),n.issues.push(zS(o))}};const i=e.transform(n.value,n);return i instanceof Promise?i.then(s=>(n.value=s,n)):(n.value=i,n)}});function vUe(t){return new yUe({type:"transform",transform:t})}const Lge=pe("ZodOptional",(t,e)=>{Cge.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Mge(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function fQ(t){return new Lge({type:"optional",innerType:t})}const bUe=pe("ZodExactOptional",(t,e)=>{HVe.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Mge(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function wUe(t){return new bUe({type:"optional",innerType:t})}const xUe=pe("ZodNullable",(t,e)=>{UVe.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(n,r,i)=>uHe(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function pQ(t){return new xUe({type:"nullable",innerType:t})}const _Ue=pe("ZodDefault",(t,e)=>{qVe.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(n,r,i)=>hHe(t,n,r,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function SUe(t,e){return new _Ue({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():cge(e)}})}const kUe=pe("ZodPrefault",(t,e)=>{WVe.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(n,r,i)=>fHe(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function CUe(t,e){return new kUe({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():cge(e)}})}const zge=pe("ZodNonOptional",(t,e)=>{GVe.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(n,r,i)=>dHe(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function EUe(t,e){return new zge({type:"nonoptional",innerType:t,...kt(e)})}const TUe=pe("ZodCatch",(t,e)=>{KVe.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(n,r,i)=>pHe(t,n,r,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function AUe(t,e){return new TUe({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const IUe=pe("ZodPipe",(t,e)=>{YVe.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(n,r,i)=>mHe(t,n,r,i),t.in=e.in,t.out=e.out});function mQ(t,e){return new IUe({type:"pipe",in:t,out:e})}const RUe=pe("ZodReadonly",(t,e)=>{ZVe.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(n,r,i)=>gHe(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function MUe(t){return new RUe({type:"readonly",innerType:t})}const NUe=pe("ZodCustom",(t,e)=>{XVe.init(t,e),qr.init(t,e),t._zod.processJSONSchema=(n,r,i)=>rHe(t,n)});function OUe(t,e={}){return U$e(NUe,t,e)}function DUe(t){return q$e(t)}function ya(t){return M$e(aUe,t)}class qw extends Error{constructor(e,n){super(n),this.status=e,this.name="ApiError"}}class jge extends Error{constructor(e){super("Daily message limit reached"),this.networkId=e,this.name="QuotaExceededError"}}const PUe=/^Error invoking remote method '[^']+':\s*/;function gQ(t){return t.replace(PUe,"").replace(/^Error:\s*/,"").trim()}function zm(t){return t instanceof qw?t.status===401?"Please sign in again.":t.status===403?"You don't have permission to do that.":t.status===404?"Not found.":t.status===408||t.status===429?"Please try again in a moment.":t.status>=500?"Something went wrong on our end. Please try again.":gQ(t.message)||"Request failed.":t instanceof CHe?"Received unexpected data from the server.":t instanceof TypeError&&/fetch|network/i.test(t.message)?"Network error. Check your connection.":t instanceof Error&&gQ(t.message)||"Something went wrong."}let YT=null,ZT=null;function LUe(t){YT=t.capture,ZT=t.breadcrumb}function Zi(t,e){console.error("[error]",t,e??{}),ZT==null||ZT(t,e)}function tI(t,e){console.error("[error]",t,e??{}),YT==null||YT(t,e)}const v7=Kn({id:vt(),created_at:ya(),email:vt().email(),email_prefix:vt(),email_notifications_enabled:h3(),avatar_object_id:vt().nullable().optional()}),OL=Kn({id:vt(),name:vt(),admin_human:v7,humans:Qa(v7),created_at:ya()}),zUe=Qa(OL);Kn({name:vt()});Kn({email_addresses:Qa(vt().email())});const jUe=Kn({network_id:vt(),network_name:vt(),email:vt(),created_at:ya()}),yQ=Qa(jUe);Kn({network_id:vt(),name:vt(),content_type:vt(),content_length:Js()});const BUe=Kn({object_id:vt(),upload_url:vt(),upload_headers:G$(vt(),vt())}),FUe=Kn({id:vt(),name:vt(),content_type:vt(),content_length:Js(),contains_content:h3(),created_at:ya()}),VUe=Kn({name:vt(),description:vt().optional()}),$Ue=Kn({name:vt(),color:vt().optional()}),HUe=Kn({word:vt(),start:Js(),end:Js()}),UUe=Kn({text:vt(),start:Js(),end:Js()}),qUe=Kn({sentences:Qa(UUe),start:Js(),end:Js()}),WUe=Kn({transcript:vt(),words:Qa(HUe),paragraphs:Qa(qUe)}),GUe=Kn({object_id:vt(),mime_type:vt(),duration_ms:Js(),size_bytes:Js(),transcript:WUe.optional(),source:f3(["camera","screen"]).optional(),transcoded_object_id:vt().optional(),transcoded_mime_type:vt().optional()}),KUe=Kn({object_id:vt(),filename:vt(),mime_type:vt(),size_bytes:Js()}),YUe=Kn({content:vt(),edited_at:ya().optional()}),ZUe=Kn({text:vt(),done:h3()}),XUe=Kn({title:vt(),notes:vt().optional(),checklist:Qa(ZUe).optional(),assigned_to:vt().optional(),done:h3()}),QUe=Kn({title:vt(),start_at:ya(),end_at:ya().optional(),notes:vt().optional()}),JUe=Kn({title:vt(),content:vt()}),sE=G$(vt(),Qa(vt())).optional(),Gy={deleted_at:ya().optional(),deleted_by_human_id:vt().optional()},b7=["👍","❤️","🔥","👀","✅","❓","😂"],Kf=Kn({id:vt(),created_at:ya(),created_by_human_id:vt(),updated_at:ya().optional()}),A_=hUe("type",[Kf.extend({type:Gf("stream"),properties:VUe,visible_to:Qa(vt()),playback_markers:G$(vt(),ya()).optional(),last_child_created_at:ya().optional(),huddle_active_participants:Qa(vt()).optional()}),Kf.extend({type:Gf("folder"),properties:$Ue,visible_to:Qa(vt())}),Kf.extend({type:Gf("media"),properties:GUe,reactions:sE,...Gy}),Kf.extend({type:Gf("file"),properties:KUe,...Gy}),Kf.extend({type:Gf("text"),properties:YUe,reactions:sE,...Gy}),Kf.extend({type:Gf("task"),properties:XUe,reactions:sE,...Gy}),Kf.extend({type:Gf("event"),properties:QUe,reactions:sE,...Gy}),Kf.extend({type:Gf("paper"),properties:JUe,...Gy})]),DL=new Set(["stream","folder"]);function Bge(t){return DL.has(t)}function od(t){return"deleted_at"in t&&t.deleted_at!=null}const eqe=Kn({token:vt(),server_url:vt()});Kn({email:vt().email()});Kn({email:vt().email(),code:vt()});const tqe=Kn({human:v7,token:vt()}),nqe=Kn({token:vt()}),rqe=f3(["monthly","annual"]),Fge=f3(["free","pro"]),iqe=f3(["active","trialing","past_due","canceled","incomplete","incomplete_expired","unpaid"]),sqe=Kn({plan:Fge,plan_status:iqe,cadence:rqe.nullable(),seats:Js().int(),current_period_end:ya().nullable(),cancel_at_period_end:h3(),price_monthly_cents:Js().int(),price_annual_cents:Js().int()}),oqe=Kn({url:vt().url()}),aqe=Kn({url:vt().url()}),lqe=Kn({plan:Fge,used:Js().int().nonnegative(),limit:Js().int().nonnegative().nullable(),reset_at:ya()});class cqe{constructor(e){Ui(this,"config");this.config=e}async send(e,n,r={}){const i={...r.headers},s=this.config.getToken();s&&(i.Authorization=`Bearer ${s}`);const o=await fetch(`${this.config.baseUrl}${n}`,{method:e,headers:i,body:r.body});if(o.status===401)throw this.config.onUnauthorized(),new qw(401,"Unauthorized");if(!o.ok){const a=await o.text().catch(()=>"Unknown error");throw new qw(o.status,a)}return o}async fetch(e,n,r){return this.send(e,n,{headers:r?{"Content-Type":"application/json"}:void 0,body:r?JSON.stringify(r):void 0})}async request(e,n,r,i){const o=await(await this.fetch(n,r,i)).json();return e.parse(o)}async requestVoid(e,n,r){await this.fetch(e,n,r)}async requestCode(e){await this.requestVoid("POST","/auth/request-code",e)}async signIn(e){return this.request(tqe,"POST","/auth/sign-in",e)}async me(){return this.request(v7,"GET","/auth/me")}async signOut(){await this.requestVoid("POST","/auth/sign-out")}async getFirebaseToken(){return this.request(nqe,"POST","/auth/firebase-token")}async getParticleDownloadUrl(e){return(await(await this.fetch("GET",`/particles/${e}/download`)).json()).url}async updateSettings(e){await this.requestVoid("PATCH","/humans/me/settings",e)}async updateAvatar(e){await this.send("PUT","/humans/me/avatar",{headers:{"Content-Type":e.type||"image/jpeg"},body:e})}async deleteAvatar(){await this.requestVoid("DELETE","/humans/me/avatar")}async getAvatarDownloadUrl(e){return(await(await this.fetch("GET",`/humans/avatar/${e}`)).json()).url}async prepareUpload(e){return this.request(BUe,"POST","/depot/upload",e)}async confirmUpload(e){return this.request(FUe,"POST",`/depot/objects/${e}/confirm`)}async listNetworks(){return this.request(zUe,"GET","/networks")}async createNetwork(e){return this.request(OL,"POST","/networks",e)}async getNetwork(e){return this.request(OL,"GET",`/networks/${e}`)}async addMembers(e,n){await this.requestVoid("POST",`/networks/${e}/members`,n)}async removeMember(e,n){await this.requestVoid("DELETE",`/networks/${e}/members/${n}`)}async listNetworkInvitations(e){return this.request(yQ,"GET",`/networks/${e}/invitations`)}async listMyInvitations(){return this.request(yQ,"GET","/invitations")}async acceptInvitation(e){await this.requestVoid("POST","/invitations/accept",e)}async revokeInvitation(e,n){await this.requestVoid("DELETE",`/networks/${e}/invitations`,n)}async getLivekitToken(e,n){return this.request(eqe,"POST","/livekit/token",{network_id:e,stream_id:n})}async getNetworkBilling(e){return this.request(sqe,"GET",`/networks/${e}/billing`)}async createCheckoutSession(e,n){return this.request(oqe,"POST",`/networks/${e}/billing/checkout-session`,{cadence:n})}async createPortalSession(e){return this.request(aqe,"POST",`/networks/${e}/billing/portal-session`)}async getNetworkUsage(e){return this.request(lqe,"GET",`/networks/${e}/usage`)}async getLinkMetadata(e){return await(await this.fetch("GET",`/metadata?url=${encodeURIComponent(e)}`)).json()}}const Bn=new cqe({baseUrl:Z9.orionUrl,getToken:()=>Rh.getState().token,onUnauthorized:()=>Rh.getState().clearToken()});var uqe="firebase",dqe="12.10.0";/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/vm(uqe,dqe,"app");var vQ=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
|
||
Copyright The Closure Library Authors.
|
||
SPDX-License-Identifier: Apache-2.0
|
||
*/var wm,Vge;(function(){var t;/** @license
|
||
|
||
Copyright The Closure Library Authors.
|
||
SPDX-License-Identifier: Apache-2.0
|
||
*/function e(E,C){function R(){}R.prototype=C.prototype,E.F=C.prototype,E.prototype=new R,E.prototype.constructor=E,E.D=function(M,D,P){for(var z=Array(arguments.length-2),Z=2;Z<arguments.length;Z++)z[Z-2]=arguments[Z];return C.prototype[D].apply(M,z)}}function n(){this.blockSize=-1}function r(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.C=Array(this.blockSize),this.o=this.h=0,this.u()}e(r,n),r.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function i(E,C,R){R||(R=0);const M=Array(16);if(typeof C=="string")for(var D=0;D<16;++D)M[D]=C.charCodeAt(R++)|C.charCodeAt(R++)<<8|C.charCodeAt(R++)<<16|C.charCodeAt(R++)<<24;else for(D=0;D<16;++D)M[D]=C[R++]|C[R++]<<8|C[R++]<<16|C[R++]<<24;C=E.g[0],R=E.g[1],D=E.g[2];let P=E.g[3],z;z=C+(P^R&(D^P))+M[0]+3614090360&4294967295,C=R+(z<<7&4294967295|z>>>25),z=P+(D^C&(R^D))+M[1]+3905402710&4294967295,P=C+(z<<12&4294967295|z>>>20),z=D+(R^P&(C^R))+M[2]+606105819&4294967295,D=P+(z<<17&4294967295|z>>>15),z=R+(C^D&(P^C))+M[3]+3250441966&4294967295,R=D+(z<<22&4294967295|z>>>10),z=C+(P^R&(D^P))+M[4]+4118548399&4294967295,C=R+(z<<7&4294967295|z>>>25),z=P+(D^C&(R^D))+M[5]+1200080426&4294967295,P=C+(z<<12&4294967295|z>>>20),z=D+(R^P&(C^R))+M[6]+2821735955&4294967295,D=P+(z<<17&4294967295|z>>>15),z=R+(C^D&(P^C))+M[7]+4249261313&4294967295,R=D+(z<<22&4294967295|z>>>10),z=C+(P^R&(D^P))+M[8]+1770035416&4294967295,C=R+(z<<7&4294967295|z>>>25),z=P+(D^C&(R^D))+M[9]+2336552879&4294967295,P=C+(z<<12&4294967295|z>>>20),z=D+(R^P&(C^R))+M[10]+4294925233&4294967295,D=P+(z<<17&4294967295|z>>>15),z=R+(C^D&(P^C))+M[11]+2304563134&4294967295,R=D+(z<<22&4294967295|z>>>10),z=C+(P^R&(D^P))+M[12]+1804603682&4294967295,C=R+(z<<7&4294967295|z>>>25),z=P+(D^C&(R^D))+M[13]+4254626195&4294967295,P=C+(z<<12&4294967295|z>>>20),z=D+(R^P&(C^R))+M[14]+2792965006&4294967295,D=P+(z<<17&4294967295|z>>>15),z=R+(C^D&(P^C))+M[15]+1236535329&4294967295,R=D+(z<<22&4294967295|z>>>10),z=C+(D^P&(R^D))+M[1]+4129170786&4294967295,C=R+(z<<5&4294967295|z>>>27),z=P+(R^D&(C^R))+M[6]+3225465664&4294967295,P=C+(z<<9&4294967295|z>>>23),z=D+(C^R&(P^C))+M[11]+643717713&4294967295,D=P+(z<<14&4294967295|z>>>18),z=R+(P^C&(D^P))+M[0]+3921069994&4294967295,R=D+(z<<20&4294967295|z>>>12),z=C+(D^P&(R^D))+M[5]+3593408605&4294967295,C=R+(z<<5&4294967295|z>>>27),z=P+(R^D&(C^R))+M[10]+38016083&4294967295,P=C+(z<<9&4294967295|z>>>23),z=D+(C^R&(P^C))+M[15]+3634488961&4294967295,D=P+(z<<14&4294967295|z>>>18),z=R+(P^C&(D^P))+M[4]+3889429448&4294967295,R=D+(z<<20&4294967295|z>>>12),z=C+(D^P&(R^D))+M[9]+568446438&4294967295,C=R+(z<<5&4294967295|z>>>27),z=P+(R^D&(C^R))+M[14]+3275163606&4294967295,P=C+(z<<9&4294967295|z>>>23),z=D+(C^R&(P^C))+M[3]+4107603335&4294967295,D=P+(z<<14&4294967295|z>>>18),z=R+(P^C&(D^P))+M[8]+1163531501&4294967295,R=D+(z<<20&4294967295|z>>>12),z=C+(D^P&(R^D))+M[13]+2850285829&4294967295,C=R+(z<<5&4294967295|z>>>27),z=P+(R^D&(C^R))+M[2]+4243563512&4294967295,P=C+(z<<9&4294967295|z>>>23),z=D+(C^R&(P^C))+M[7]+1735328473&4294967295,D=P+(z<<14&4294967295|z>>>18),z=R+(P^C&(D^P))+M[12]+2368359562&4294967295,R=D+(z<<20&4294967295|z>>>12),z=C+(R^D^P)+M[5]+4294588738&4294967295,C=R+(z<<4&4294967295|z>>>28),z=P+(C^R^D)+M[8]+2272392833&4294967295,P=C+(z<<11&4294967295|z>>>21),z=D+(P^C^R)+M[11]+1839030562&4294967295,D=P+(z<<16&4294967295|z>>>16),z=R+(D^P^C)+M[14]+4259657740&4294967295,R=D+(z<<23&4294967295|z>>>9),z=C+(R^D^P)+M[1]+2763975236&4294967295,C=R+(z<<4&4294967295|z>>>28),z=P+(C^R^D)+M[4]+1272893353&4294967295,P=C+(z<<11&4294967295|z>>>21),z=D+(P^C^R)+M[7]+4139469664&4294967295,D=P+(z<<16&4294967295|z>>>16),z=R+(D^P^C)+M[10]+3200236656&4294967295,R=D+(z<<23&4294967295|z>>>9),z=C+(R^D^P)+M[13]+681279174&4294967295,C=R+(z<<4&4294967295|z>>>28),z=P+(C^R^D)+M[0]+3936430074&4294967295,P=C+(z<<11&4294967295|z>>>21),z=D+(P^C^R)+M[3]+3572445317&4294967295,D=P+(z<<16&4294967295|z>>>16),z=R+(D^P^C)+M[6]+76029189&4294967295,R=D+(z<<23&4294967295|z>>>9),z=C+(R^D^P)+M[9]+3654602809&4294967295,C=R+(z<<4&4294967295|z>>>28),z=P+(C^R^D)+M[12]+3873151461&4294967295,P=C+(z<<11&4294967295|z>>>21),z=D+(P^C^R)+M[15]+530742520&4294967295,D=P+(z<<16&4294967295|z>>>16),z=R+(D^P^C)+M[2]+3299628645&4294967295,R=D+(z<<23&4294967295|z>>>9),z=C+(D^(R|~P))+M[0]+4096336452&4294967295,C=R+(z<<6&4294967295|z>>>26),z=P+(R^(C|~D))+M[7]+1126891415&4294967295,P=C+(z<<10&4294967295|z>>>22),z=D+(C^(P|~R))+M[14]+2878612391&4294967295,D=P+(z<<15&4294967295|z>>>17),z=R+(P^(D|~C))+M[5]+4237533241&4294967295,R=D+(z<<21&4294967295|z>>>11),z=C+(D^(R|~P))+M[12]+1700485571&4294967295,C=R+(z<<6&4294967295|z>>>26),z=P+(R^(C|~D))+M[3]+2399980690&4294967295,P=C+(z<<10&4294967295|z>>>22),z=D+(C^(P|~R))+M[10]+4293915773&4294967295,D=P+(z<<15&4294967295|z>>>17),z=R+(P^(D|~C))+M[1]+2240044497&4294967295,R=D+(z<<21&4294967295|z>>>11),z=C+(D^(R|~P))+M[8]+1873313359&4294967295,C=R+(z<<6&4294967295|z>>>26),z=P+(R^(C|~D))+M[15]+4264355552&4294967295,P=C+(z<<10&4294967295|z>>>22),z=D+(C^(P|~R))+M[6]+2734768916&4294967295,D=P+(z<<15&4294967295|z>>>17),z=R+(P^(D|~C))+M[13]+1309151649&4294967295,R=D+(z<<21&4294967295|z>>>11),z=C+(D^(R|~P))+M[4]+4149444226&4294967295,C=R+(z<<6&4294967295|z>>>26),z=P+(R^(C|~D))+M[11]+3174756917&4294967295,P=C+(z<<10&4294967295|z>>>22),z=D+(C^(P|~R))+M[2]+718787259&4294967295,D=P+(z<<15&4294967295|z>>>17),z=R+(P^(D|~C))+M[9]+3951481745&4294967295,E.g[0]=E.g[0]+C&4294967295,E.g[1]=E.g[1]+(D+(z<<21&4294967295|z>>>11))&4294967295,E.g[2]=E.g[2]+D&4294967295,E.g[3]=E.g[3]+P&4294967295}r.prototype.v=function(E,C){C===void 0&&(C=E.length);const R=C-this.blockSize,M=this.C;let D=this.h,P=0;for(;P<C;){if(D==0)for(;P<=R;)i(this,E,P),P+=this.blockSize;if(typeof E=="string"){for(;P<C;)if(M[D++]=E.charCodeAt(P++),D==this.blockSize){i(this,M),D=0;break}}else for(;P<C;)if(M[D++]=E[P++],D==this.blockSize){i(this,M),D=0;break}}this.h=D,this.o+=C},r.prototype.A=function(){var E=Array((this.h<56?this.blockSize:this.blockSize*2)-this.h);E[0]=128;for(var C=1;C<E.length-8;++C)E[C]=0;C=this.o*8;for(var R=E.length-8;R<E.length;++R)E[R]=C&255,C/=256;for(this.v(E),E=Array(16),C=0,R=0;R<4;++R)for(let M=0;M<32;M+=8)E[C++]=this.g[R]>>>M&255;return E};function s(E,C){var R=a;return Object.prototype.hasOwnProperty.call(R,E)?R[E]:R[E]=C(E)}function o(E,C){this.h=C;const R=[];let M=!0;for(let D=E.length-1;D>=0;D--){const P=E[D]|0;M&&P==C||(R[D]=P,M=!1)}this.g=R}var a={};function l(E){return-128<=E&&E<128?s(E,function(C){return new o([C|0],C<0?-1:0)}):new o([E|0],E<0?-1:0)}function c(E){if(isNaN(E)||!isFinite(E))return d;if(E<0)return y(c(-E));const C=[];let R=1;for(let M=0;E>=R;M++)C[M]=E/R|0,R*=4294967296;return new o(C,0)}function u(E,C){if(E.length==0)throw Error("number format error: empty string");if(C=C||10,C<2||36<C)throw Error("radix out of range: "+C);if(E.charAt(0)=="-")return y(u(E.substring(1),C));if(E.indexOf("-")>=0)throw Error('number format error: interior "-" character');const R=c(Math.pow(C,8));let M=d;for(let P=0;P<E.length;P+=8){var D=Math.min(8,E.length-P);const z=parseInt(E.substring(P,P+D),C);D<8?(D=c(Math.pow(C,D)),M=M.j(D).add(c(z))):(M=M.j(R),M=M.add(c(z)))}return M}var d=l(0),h=l(1),f=l(16777216);t=o.prototype,t.m=function(){if(g(this))return-y(this).m();let E=0,C=1;for(let R=0;R<this.g.length;R++){const M=this.i(R);E+=(M>=0?M:4294967296+M)*C,C*=4294967296}return E},t.toString=function(E){if(E=E||10,E<2||36<E)throw Error("radix out of range: "+E);if(p(this))return"0";if(g(this))return"-"+y(this).toString(E);const C=c(Math.pow(E,6));var R=this;let M="";for(;;){const D=S(R,C).g;R=v(R,D.j(C));let P=((R.g.length>0?R.g[0]:R.h)>>>0).toString(E);if(R=D,p(R))return P+M;for(;P.length<6;)P="0"+P;M=P+M}},t.i=function(E){return E<0?0:E<this.g.length?this.g[E]:this.h};function p(E){if(E.h!=0)return!1;for(let C=0;C<E.g.length;C++)if(E.g[C]!=0)return!1;return!0}function g(E){return E.h==-1}t.l=function(E){return E=v(this,E),g(E)?-1:p(E)?0:1};function y(E){const C=E.g.length,R=[];for(let M=0;M<C;M++)R[M]=~E.g[M];return new o(R,~E.h).add(h)}t.abs=function(){return g(this)?y(this):this},t.add=function(E){const C=Math.max(this.g.length,E.g.length),R=[];let M=0;for(let D=0;D<=C;D++){let P=M+(this.i(D)&65535)+(E.i(D)&65535),z=(P>>>16)+(this.i(D)>>>16)+(E.i(D)>>>16);M=z>>>16,P&=65535,z&=65535,R[D]=z<<16|P}return new o(R,R[R.length-1]&-2147483648?-1:0)};function v(E,C){return E.add(y(C))}t.j=function(E){if(p(this)||p(E))return d;if(g(this))return g(E)?y(this).j(y(E)):y(y(this).j(E));if(g(E))return y(this.j(y(E)));if(this.l(f)<0&&E.l(f)<0)return c(this.m()*E.m());const C=this.g.length+E.g.length,R=[];for(var M=0;M<2*C;M++)R[M]=0;for(M=0;M<this.g.length;M++)for(let D=0;D<E.g.length;D++){const P=this.i(M)>>>16,z=this.i(M)&65535,Z=E.i(D)>>>16,re=E.i(D)&65535;R[2*M+2*D]+=z*re,b(R,2*M+2*D),R[2*M+2*D+1]+=P*re,b(R,2*M+2*D+1),R[2*M+2*D+1]+=z*Z,b(R,2*M+2*D+1),R[2*M+2*D+2]+=P*Z,b(R,2*M+2*D+2)}for(E=0;E<C;E++)R[E]=R[2*E+1]<<16|R[2*E];for(E=C;E<2*C;E++)R[E]=0;return new o(R,0)};function b(E,C){for(;(E[C]&65535)!=E[C];)E[C+1]+=E[C]>>>16,E[C]&=65535,C++}function _(E,C){this.g=E,this.h=C}function S(E,C){if(p(C))throw Error("division by zero");if(p(E))return new _(d,d);if(g(E))return C=S(y(E),C),new _(y(C.g),y(C.h));if(g(C))return C=S(E,y(C)),new _(y(C.g),C.h);if(E.g.length>30){if(g(E)||g(C))throw Error("slowDivide_ only works with positive integers.");for(var R=h,M=C;M.l(E)<=0;)R=k(R),M=k(M);var D=T(R,1),P=T(M,1);for(M=T(M,2),R=T(R,2);!p(M);){var z=P.add(M);z.l(E)<=0&&(D=D.add(R),P=z),M=T(M,1),R=T(R,1)}return C=v(E,D.j(C)),new _(D,C)}for(D=d;E.l(C)>=0;){for(R=Math.max(1,Math.floor(E.m()/C.m())),M=Math.ceil(Math.log(R)/Math.LN2),M=M<=48?1:Math.pow(2,M-48),P=c(R),z=P.j(C);g(z)||z.l(E)>0;)R-=M,P=c(R),z=P.j(C);p(P)&&(P=h),D=D.add(P),E=v(E,z)}return new _(D,E)}t.B=function(E){return S(this,E).h},t.and=function(E){const C=Math.max(this.g.length,E.g.length),R=[];for(let M=0;M<C;M++)R[M]=this.i(M)&E.i(M);return new o(R,this.h&E.h)},t.or=function(E){const C=Math.max(this.g.length,E.g.length),R=[];for(let M=0;M<C;M++)R[M]=this.i(M)|E.i(M);return new o(R,this.h|E.h)},t.xor=function(E){const C=Math.max(this.g.length,E.g.length),R=[];for(let M=0;M<C;M++)R[M]=this.i(M)^E.i(M);return new o(R,this.h^E.h)};function k(E){const C=E.g.length+1,R=[];for(let M=0;M<C;M++)R[M]=E.i(M)<<1|E.i(M-1)>>>31;return new o(R,E.h)}function T(E,C){const R=C>>5;C%=32;const M=E.g.length-R,D=[];for(let P=0;P<M;P++)D[P]=C>0?E.i(P+R)>>>C|E.i(P+R+1)<<32-C:E.i(P+R);return new o(D,E.h)}r.prototype.digest=r.prototype.A,r.prototype.reset=r.prototype.u,r.prototype.update=r.prototype.v,Vge=r,o.prototype.add=o.prototype.add,o.prototype.multiply=o.prototype.j,o.prototype.modulo=o.prototype.B,o.prototype.compare=o.prototype.l,o.prototype.toNumber=o.prototype.m,o.prototype.toString=o.prototype.toString,o.prototype.getBits=o.prototype.i,o.fromNumber=c,o.fromString=u,wm=o}).apply(typeof vQ<"u"?vQ:typeof self<"u"?self:typeof window<"u"?window:{});var oE=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
|
||
Copyright The Closure Library Authors.
|
||
SPDX-License-Identifier: Apache-2.0
|
||
*/var $ge,x4,Hge,XT,PL,Uge,qge,Wge;(function(){var t,e=Object.defineProperty;function n(w){w=[typeof globalThis=="object"&&globalThis,w,typeof window=="object"&&window,typeof self=="object"&&self,typeof oE=="object"&&oE];for(var I=0;I<w.length;++I){var L=w[I];if(L&&L.Math==Math)return L}throw Error("Cannot find global object")}var r=n(this);function i(w,I){if(I)e:{var L=r;w=w.split(".");for(var V=0;V<w.length-1;V++){var ae=w[V];if(!(ae in L))break e;L=L[ae]}w=w[w.length-1],V=L[w],I=I(V),I!=V&&I!=null&&e(L,w,{configurable:!0,writable:!0,value:I})}}i("Symbol.dispose",function(w){return w||Symbol("Symbol.dispose")}),i("Array.prototype.values",function(w){return w||function(){return this[Symbol.iterator]()}}),i("Object.entries",function(w){return w||function(I){var L=[],V;for(V in I)Object.prototype.hasOwnProperty.call(I,V)&&L.push([V,I[V]]);return L}});/** @license
|
||
|
||
Copyright The Closure Library Authors.
|
||
SPDX-License-Identifier: Apache-2.0
|
||
*/var s=s||{},o=this||self;function a(w){var I=typeof w;return I=="object"&&w!=null||I=="function"}function l(w,I,L){return w.call.apply(w.bind,arguments)}function c(w,I,L){return c=l,c.apply(null,arguments)}function u(w,I){var L=Array.prototype.slice.call(arguments,1);return function(){var V=L.slice();return V.push.apply(V,arguments),w.apply(this,V)}}function d(w,I){function L(){}L.prototype=I.prototype,w.Z=I.prototype,w.prototype=new L,w.prototype.constructor=w,w.Ob=function(V,ae,ce){for(var Xe=Array(arguments.length-2),sn=2;sn<arguments.length;sn++)Xe[sn-2]=arguments[sn];return I.prototype[ae].apply(V,Xe)}}var h=typeof AsyncContext<"u"&&typeof AsyncContext.Snapshot=="function"?w=>w&&AsyncContext.Snapshot.wrap(w):w=>w;function f(w){const I=w.length;if(I>0){const L=Array(I);for(let V=0;V<I;V++)L[V]=w[V];return L}return[]}function p(w,I){for(let V=1;V<arguments.length;V++){const ae=arguments[V];var L=typeof ae;if(L=L!="object"?L:ae?Array.isArray(ae)?"array":L:"null",L=="array"||L=="object"&&typeof ae.length=="number"){L=w.length||0;const ce=ae.length||0;w.length=L+ce;for(let Xe=0;Xe<ce;Xe++)w[L+Xe]=ae[Xe]}else w.push(ae)}}class g{constructor(I,L){this.i=I,this.j=L,this.h=0,this.g=null}get(){let I;return this.h>0?(this.h--,I=this.g,this.g=I.next,I.next=null):I=this.i(),I}}function y(w){o.setTimeout(()=>{throw w},0)}function v(){var w=E;let I=null;return w.g&&(I=w.g,w.g=w.g.next,w.g||(w.h=null),I.next=null),I}class b{constructor(){this.h=this.g=null}add(I,L){const V=_.get();V.set(I,L),this.h?this.h.next=V:this.g=V,this.h=V}}var _=new g(()=>new S,w=>w.reset());class S{constructor(){this.next=this.g=this.h=null}set(I,L){this.h=I,this.g=L,this.next=null}reset(){this.next=this.g=this.h=null}}let k,T=!1,E=new b,C=()=>{const w=Promise.resolve(void 0);k=()=>{w.then(R)}};function R(){for(var w;w=v();){try{w.h.call(w.g)}catch(L){y(L)}var I=_;I.j(w),I.h<100&&(I.h++,w.next=I.g,I.g=w)}T=!1}function M(){this.u=this.u,this.C=this.C}M.prototype.u=!1,M.prototype.dispose=function(){this.u||(this.u=!0,this.N())},M.prototype[Symbol.dispose]=function(){this.dispose()},M.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function D(w,I){this.type=w,this.g=this.target=I,this.defaultPrevented=!1}D.prototype.h=function(){this.defaultPrevented=!0};var P=function(){if(!o.addEventListener||!Object.defineProperty)return!1;var w=!1,I=Object.defineProperty({},"passive",{get:function(){w=!0}});try{const L=()=>{};o.addEventListener("test",L,I),o.removeEventListener("test",L,I)}catch{}return w}();function z(w){return/^[\s\xa0]*$/.test(w)}function Z(w,I){D.call(this,w?w.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,w&&this.init(w,I)}d(Z,D),Z.prototype.init=function(w,I){const L=this.type=w.type,V=w.changedTouches&&w.changedTouches.length?w.changedTouches[0]:null;this.target=w.target||w.srcElement,this.g=I,I=w.relatedTarget,I||(L=="mouseover"?I=w.fromElement:L=="mouseout"&&(I=w.toElement)),this.relatedTarget=I,V?(this.clientX=V.clientX!==void 0?V.clientX:V.pageX,this.clientY=V.clientY!==void 0?V.clientY:V.pageY,this.screenX=V.screenX||0,this.screenY=V.screenY||0):(this.clientX=w.clientX!==void 0?w.clientX:w.pageX,this.clientY=w.clientY!==void 0?w.clientY:w.pageY,this.screenX=w.screenX||0,this.screenY=w.screenY||0),this.button=w.button,this.key=w.key||"",this.ctrlKey=w.ctrlKey,this.altKey=w.altKey,this.shiftKey=w.shiftKey,this.metaKey=w.metaKey,this.pointerId=w.pointerId||0,this.pointerType=w.pointerType,this.state=w.state,this.i=w,w.defaultPrevented&&Z.Z.h.call(this)},Z.prototype.h=function(){Z.Z.h.call(this);const w=this.i;w.preventDefault?w.preventDefault():w.returnValue=!1};var re="closure_listenable_"+(Math.random()*1e6|0),G=0;function ee(w,I,L,V,ae){this.listener=w,this.proxy=null,this.src=I,this.type=L,this.capture=!!V,this.ha=ae,this.key=++G,this.da=this.fa=!1}function J(w){w.da=!0,w.listener=null,w.proxy=null,w.src=null,w.ha=null}function oe(w,I,L){for(const V in w)I.call(L,w[V],V,w)}function B(w,I){for(const L in w)I.call(void 0,w[L],L,w)}function $e(w){const I={};for(const L in w)I[L]=w[L];return I}const Ye="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function $(w,I){let L,V;for(let ae=1;ae<arguments.length;ae++){V=arguments[ae];for(L in V)w[L]=V[L];for(let ce=0;ce<Ye.length;ce++)L=Ye[ce],Object.prototype.hasOwnProperty.call(V,L)&&(w[L]=V[L])}}function Re(w){this.src=w,this.g={},this.h=0}Re.prototype.add=function(w,I,L,V,ae){const ce=w.toString();w=this.g[ce],w||(w=this.g[ce]=[],this.h++);const Xe=Me(w,I,V,ae);return Xe>-1?(I=w[Xe],L||(I.fa=!1)):(I=new ee(I,this.src,ce,!!V,ae),I.fa=L,w.push(I)),I};function ke(w,I){const L=I.type;if(L in w.g){var V=w.g[L],ae=Array.prototype.indexOf.call(V,I,void 0),ce;(ce=ae>=0)&&Array.prototype.splice.call(V,ae,1),ce&&(J(I),w.g[L].length==0&&(delete w.g[L],w.h--))}}function Me(w,I,L,V){for(let ae=0;ae<w.length;++ae){const ce=w[ae];if(!ce.da&&ce.listener==I&&ce.capture==!!L&&ce.ha==V)return ae}return-1}var _e="closure_lm_"+(Math.random()*1e6|0),Ne={};function Ue(w,I,L,V,ae){if(Array.isArray(I)){for(let ce=0;ce<I.length;ce++)Ue(w,I[ce],L,V,ae);return null}return L=Te(L),w&&w[re]?w.J(I,L,a(V)?!!V.capture:!1,ae):at(w,I,L,!1,V,ae)}function at(w,I,L,V,ae,ce){if(!I)throw Error("Invalid event type");const Xe=a(ae)?!!ae.capture:!!ae;let sn=de(w);if(sn||(w[_e]=sn=new Re(w)),L=sn.add(I,L,V,Xe,ce),L.proxy)return L;if(V=ct(),L.proxy=V,V.src=w,V.listener=L,w.addEventListener)P||(ae=Xe),ae===void 0&&(ae=!1),w.addEventListener(I.toString(),V,ae);else if(w.attachEvent)w.attachEvent(se(I.toString()),V);else if(w.addListener&&w.removeListener)w.addListener(V);else throw Error("addEventListener and attachEvent are unavailable.");return L}function ct(){function w(L){return I.call(w.src,w.listener,L)}const I=me;return w}function H(w,I,L,V,ae){if(Array.isArray(I))for(var ce=0;ce<I.length;ce++)H(w,I[ce],L,V,ae);else V=a(V)?!!V.capture:!!V,L=Te(L),w&&w[re]?(w=w.i,ce=String(I).toString(),ce in w.g&&(I=w.g[ce],L=Me(I,L,V,ae),L>-1&&(J(I[L]),Array.prototype.splice.call(I,L,1),I.length==0&&(delete w.g[ce],w.h--)))):w&&(w=de(w))&&(I=w.g[I.toString()],w=-1,I&&(w=Me(I,L,V,ae)),(L=w>-1?I[w]:null)&&Y(L))}function Y(w){if(typeof w!="number"&&w&&!w.da){var I=w.src;if(I&&I[re])ke(I.i,w);else{var L=w.type,V=w.proxy;I.removeEventListener?I.removeEventListener(L,V,w.capture):I.detachEvent?I.detachEvent(se(L),V):I.addListener&&I.removeListener&&I.removeListener(V),(L=de(I))?(ke(L,w),L.h==0&&(L.src=null,I[_e]=null)):J(w)}}}function se(w){return w in Ne?Ne[w]:Ne[w]="on"+w}function me(w,I){if(w.da)w=!0;else{I=new Z(I,this);const L=w.listener,V=w.ha||w.src;w.fa&&Y(w),w=L.call(V,I)}return w}function de(w){return w=w[_e],w instanceof Re?w:null}var ie="__closure_events_fn_"+(Math.random()*1e9>>>0);function Te(w){return typeof w=="function"?w:(w[ie]||(w[ie]=function(I){return w.handleEvent(I)}),w[ie])}function he(){M.call(this),this.i=new Re(this),this.M=this,this.G=null}d(he,M),he.prototype[re]=!0,he.prototype.removeEventListener=function(w,I,L,V){H(this,w,I,L,V)};function we(w,I){var L,V=w.G;if(V)for(L=[];V;V=V.G)L.push(V);if(w=w.M,V=I.type||I,typeof I=="string")I=new D(I,w);else if(I instanceof D)I.target=I.target||w;else{var ae=I;I=new D(V,w),$(I,ae)}ae=!0;let ce,Xe;if(L)for(Xe=L.length-1;Xe>=0;Xe--)ce=I.g=L[Xe],ae=ye(ce,V,!0,I)&&ae;if(ce=I.g=w,ae=ye(ce,V,!0,I)&&ae,ae=ye(ce,V,!1,I)&&ae,L)for(Xe=0;Xe<L.length;Xe++)ce=I.g=L[Xe],ae=ye(ce,V,!1,I)&&ae}he.prototype.N=function(){if(he.Z.N.call(this),this.i){var w=this.i;for(const I in w.g){const L=w.g[I];for(let V=0;V<L.length;V++)J(L[V]);delete w.g[I],w.h--}}this.G=null},he.prototype.J=function(w,I,L,V){return this.i.add(String(w),I,!1,L,V)},he.prototype.K=function(w,I,L,V){return this.i.add(String(w),I,!0,L,V)};function ye(w,I,L,V){if(I=w.i.g[String(I)],!I)return!0;I=I.concat();let ae=!0;for(let ce=0;ce<I.length;++ce){const Xe=I[ce];if(Xe&&!Xe.da&&Xe.capture==L){const sn=Xe.listener,Hi=Xe.ha||Xe.src;Xe.fa&&ke(w.i,Xe),ae=sn.call(Hi,V)!==!1&&ae}}return ae&&!V.defaultPrevented}function Ge(w,I){if(typeof w!="function")if(w&&typeof w.handleEvent=="function")w=c(w.handleEvent,w);else throw Error("Invalid listener argument");return Number(I)>2147483647?-1:o.setTimeout(w,I||0)}function Pe(w){w.g=Ge(()=>{w.g=null,w.i&&(w.i=!1,Pe(w))},w.l);const I=w.h;w.h=null,w.m.apply(null,I)}class tt extends M{constructor(I,L){super(),this.m=I,this.l=L,this.h=null,this.i=!1,this.g=null}j(I){this.h=arguments,this.g?this.i=!0:Pe(this)}N(){super.N(),this.g&&(o.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function ft(w){M.call(this),this.h=w,this.g={}}d(ft,M);var ne=[];function fe(w){oe(w.g,function(I,L){this.g.hasOwnProperty(L)&&Y(I)},w),w.g={}}ft.prototype.N=function(){ft.Z.N.call(this),fe(this)},ft.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var Le=o.JSON.stringify,Ze=o.JSON.parse,rt=class{stringify(w){return o.JSON.stringify(w,void 0)}parse(w){return o.JSON.parse(w,void 0)}};function un(){}function Yt(){}var _n={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function kr(){D.call(this,"d")}d(kr,D);function In(){D.call(this,"c")}d(In,D);var Vt={},zr=null;function Ee(){return zr=zr||new he}Vt.Ia="serverreachability";function St(w){D.call(this,Vt.Ia,w)}d(St,D);function Ke(w){const I=Ee();we(I,new St(I))}Vt.STAT_EVENT="statevent";function Sn(w,I){D.call(this,Vt.STAT_EVENT,w),this.stat=I}d(Sn,D);function en(w){const I=Ee();we(I,new Sn(I,w))}Vt.Ja="timingevent";function Vi(w,I){D.call(this,Vt.Ja,w),this.size=I}d(Vi,D);function wt(w,I){if(typeof w!="function")throw Error("Fn must not be null and must be a function");return o.setTimeout(function(){w()},I)}function pn(){this.g=!0}pn.prototype.ua=function(){this.g=!1};function tr(w,I,L,V,ae,ce){w.info(function(){if(w.g)if(ce){var Xe="",sn=ce.split("&");for(let hr=0;hr<sn.length;hr++){var Hi=sn[hr].split("=");if(Hi.length>1){const ns=Hi[0];Hi=Hi[1];const fu=ns.split("_");Xe=fu.length>=2&&fu[1]=="type"?Xe+(ns+"="+Hi+"&"):Xe+(ns+"=redacted&")}}}else Xe=null;else Xe=ce;return"XMLHTTP REQ ("+V+") [attempt "+ae+"]: "+I+`
|
||
`+L+`
|
||
`+Xe})}function ni(w,I,L,V,ae,ce,Xe){w.info(function(){return"XMLHTTP RESP ("+V+") [ attempt "+ae+"]: "+I+`
|
||
`+L+`
|
||
`+ce+" "+Xe})}function _i(w,I,L,V){w.info(function(){return"XMLHTTP TEXT ("+I+"): "+jr(w,L)+(V?" "+V:"")})}function qt(w,I){w.info(function(){return"TIMEOUT: "+I})}pn.prototype.info=function(){};function jr(w,I){if(!w.g)return I;if(!I)return null;try{const ce=JSON.parse(I);if(ce){for(w=0;w<ce.length;w++)if(Array.isArray(ce[w])){var L=ce[w];if(!(L.length<2)){var V=L[1];if(Array.isArray(V)&&!(V.length<1)){var ae=V[0];if(ae!="noop"&&ae!="stop"&&ae!="close")for(let Xe=1;Xe<V.length;Xe++)V[Xe]=""}}}}return Le(ce)}catch{return I}}var Ho={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},Si={ib:"complete",Fb:"success",ERROR:"error",Ga:"abort",xb:"ready",yb:"readystatechange",TIMEOUT:"timeout",sb:"incrementaldata",wb:"progress",lb:"downloadprogress",Nb:"uploadprogress"},fi;function ml(){}d(ml,un),ml.prototype.g=function(){return new XMLHttpRequest},fi=new ml;function $i(w){return encodeURIComponent(String(w))}function z0(w){var I=1;w=w.split(":");const L=[];for(;I>0&&w.length;)L.push(w.shift()),I--;return w.length&&L.push(w.join(":")),L}function Gr(w,I,L,V){this.j=w,this.i=I,this.l=L,this.S=V||1,this.V=new ft(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new Ca}function Ca(){this.i=null,this.g="",this.h=!1}var Lf={},Bd={};function Fd(w,I,L){w.M=1,w.A=By(gs(I)),w.u=L,w.R=!0,cu(w,null)}function cu(w,I){w.F=Date.now(),hu(w),w.B=gs(w.A);var L=w.B,V=w.S;Array.isArray(V)||(V=[String(V)]),OK(L.i,"t",V),w.C=0,L=w.j.L,w.h=new Ca,w.g=XK(w.j,L?I:null,!w.u),w.P>0&&(w.O=new tt(c(w.Y,w,w.g),w.P)),I=w.V,L=w.g,V=w.ba;var ae="readystatechange";Array.isArray(ae)||(ae&&(ne[0]=ae.toString()),ae=ne);for(let ce=0;ce<ae.length;ce++){const Xe=Ue(L,ae[ce],V||I.handleEvent,!1,I.h||I);if(!Xe)break;I.g[Xe.key]=Xe}I=w.J?$e(w.J):{},w.u?(w.v||(w.v="POST"),I["Content-Type"]="application/x-www-form-urlencoded",w.g.ea(w.B,w.v,w.u,I)):(w.v="GET",w.g.ea(w.B,w.v,null,I)),Ke(),tr(w.i,w.v,w.B,w.l,w.S,w.u)}Gr.prototype.ba=function(w){w=w.target;const I=this.O;I&&Ff(w)==3?I.j():this.Y(w)},Gr.prototype.Y=function(w){try{if(w==this.g)e:{const sn=Ff(this.g),Hi=this.g.ya(),hr=this.g.ca();if(!(sn<3)&&(sn!=3||this.g&&(this.h.h||this.g.la()||FK(this.g)))){this.K||sn!=4||Hi==7||(Hi==8||hr<=0?Ke(3):Ke(2)),jf(this);var I=this.g.ca();this.X=I;var L=uu(this);if(this.o=I==200,ni(this.i,this.v,this.B,this.l,this.S,sn,I),this.o){if(this.U&&!this.L){t:{if(this.g){var V,ae=this.g;if((V=ae.g?ae.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!z(V)){var ce=V;break t}}ce=null}if(w=ce)_i(this.i,this.l,w,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,hc(this,w);else{this.o=!1,this.m=3,en(12),Ea(this),dc(this);break e}}if(this.R){w=!0;let ns;for(;!this.K&&this.C<L.length;)if(ns=Uo(this,L),ns==Bd){sn==4&&(this.m=4,en(14),w=!1),_i(this.i,this.l,null,"[Incomplete Response]");break}else if(ns==Lf){this.m=4,en(15),_i(this.i,this.l,L,"[Invalid Chunk]"),w=!1;break}else _i(this.i,this.l,ns,null),hc(this,ns);if(du(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),sn!=4||L.length!=0||this.h.h||(this.m=1,en(16),w=!1),this.o=this.o&&w,!w)_i(this.i,this.l,L,"[Invalid Chunked Response]"),Ea(this),dc(this);else if(L.length>0&&!this.W){this.W=!0;var Xe=this.j;Xe.g==this&&Xe.aa&&!Xe.P&&(Xe.j.info("Great, no buffering proxy detected. Bytes received: "+L.length),bM(Xe),Xe.P=!0,en(11))}}else _i(this.i,this.l,L,null),hc(this,L);sn==4&&Ea(this),this.o&&!this.K&&(sn==4?GK(this.j,this):(this.o=!1,hu(this)))}else UTe(this.g),I==400&&L.indexOf("Unknown SID")>0?(this.m=3,en(12)):(this.m=0,en(13)),Ea(this),dc(this)}}}catch{}finally{}};function uu(w){if(!du(w))return w.g.la();const I=FK(w.g);if(I==="")return"";let L="";const V=I.length,ae=Ff(w.g)==4;if(!w.h.i){if(typeof TextDecoder>"u")return Ea(w),dc(w),"";w.h.i=new o.TextDecoder}for(let ce=0;ce<V;ce++)w.h.h=!0,L+=w.h.i.decode(I[ce],{stream:!(ae&&ce==V-1)});return I.length=0,w.h.g+=L,w.C=0,w.h.g}function du(w){return w.g?w.v=="GET"&&w.M!=2&&w.j.Aa:!1}function Uo(w,I){var L=w.C,V=I.indexOf(`
|
||
`,L);return V==-1?Bd:(L=Number(I.substring(L,V)),isNaN(L)?Lf:(V+=1,V+L>I.length?Bd:(I=I.slice(V,V+L),w.C=V+L,I)))}Gr.prototype.cancel=function(){this.K=!0,Ea(this)};function hu(w){w.T=Date.now()+w.H,zf(w,w.H)}function zf(w,I){if(w.D!=null)throw Error("WatchDog timer not null");w.D=wt(c(w.aa,w),I)}function jf(w){w.D&&(o.clearTimeout(w.D),w.D=null)}Gr.prototype.aa=function(){this.D=null;const w=Date.now();w-this.T>=0?(qt(this.i,this.B),this.M!=2&&(Ke(),en(17)),Ea(this),this.m=2,dc(this)):zf(this,this.T-w)};function dc(w){w.j.I==0||w.K||GK(w.j,w)}function Ea(w){jf(w);var I=w.O;I&&typeof I.dispose=="function"&&I.dispose(),w.O=null,fe(w.V),w.g&&(I=w.g,w.g=null,I.abort(),I.dispose())}function hc(w,I){try{var L=w.j;if(L.I!=0&&(L.g==w||Qe(L.h,w))){if(!w.L&&Qe(L.h,w)&&L.I==3){try{var V=L.Ba.g.parse(I)}catch{V=null}if(Array.isArray(V)&&V.length==3){var ae=V;if(ae[0]==0){e:if(!L.v){if(L.g)if(L.g.F+3e3<w.F)EC(L),kC(L);else break e;vM(L),en(18)}}else L.xa=ae[1],0<L.xa-L.K&&ae[2]<37500&&L.F&&L.A==0&&!L.C&&(L.C=wt(c(L.Va,L),6e3));ge(L.h)<=1&&L.ta&&(L.ta=void 0)}else $0(L,11)}else if((w.L||L.g==w)&&EC(L),!z(I))for(ae=L.Ba.g.parse(I),I=0;I<ae.length;I++){let hr=ae[I];const ns=hr[0];if(!(ns<=L.K))if(L.K=ns,hr=hr[1],L.I==2)if(hr[0]=="c"){L.M=hr[1],L.ba=hr[2];const fu=hr[3];fu!=null&&(L.ka=fu,L.j.info("VER="+L.ka));const H0=hr[4];H0!=null&&(L.za=H0,L.j.info("SVER="+L.za));const Vf=hr[5];Vf!=null&&typeof Vf=="number"&&Vf>0&&(V=1.5*Vf,L.O=V,L.j.info("backChannelRequestTimeoutMs_="+V)),V=L;const $f=w.g;if($f){const AC=$f.g?$f.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(AC){var ce=V.h;ce.g||AC.indexOf("spdy")==-1&&AC.indexOf("quic")==-1&&AC.indexOf("h2")==-1||(ce.j=ce.l,ce.g=new Set,ce.h&&(mn(ce,ce.h),ce.h=null))}if(V.G){const wM=$f.g?$f.g.getResponseHeader("X-HTTP-Session-Id"):null;wM&&(V.wa=wM,dr(V.J,V.G,wM))}}L.I=3,L.l&&L.l.ra(),L.aa&&(L.T=Date.now()-w.F,L.j.info("Handshake RTT: "+L.T+"ms")),V=L;var Xe=w;if(V.na=ZK(V,V.L?V.ba:null,V.W),Xe.L){Zt(V.h,Xe);var sn=Xe,Hi=V.O;Hi&&(sn.H=Hi),sn.D&&(jf(sn),hu(sn)),V.g=Xe}else qK(V);L.i.length>0&&CC(L)}else hr[0]!="stop"&&hr[0]!="close"||$0(L,7);else L.I==3&&(hr[0]=="stop"||hr[0]=="close"?hr[0]=="stop"?$0(L,7):yM(L):hr[0]!="noop"&&L.l&&L.l.qa(hr),L.A=0)}}Ke(4)}catch{}}var fc=class{constructor(w,I){this.g=w,this.map=I}};function pt(w){this.l=w||10,o.PerformanceNavigationTiming?(w=o.performance.getEntriesByType("navigation"),w=w.length>0&&(w[0].nextHopProtocol=="hq"||w[0].nextHopProtocol=="h2")):w=!!(o.chrome&&o.chrome.loadTimes&&o.chrome.loadTimes()&&o.chrome.loadTimes().wasFetchedViaSpdy),this.j=w?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function U(w){return w.h?!0:w.g?w.g.size>=w.j:!1}function ge(w){return w.h?1:w.g?w.g.size:0}function Qe(w,I){return w.h?w.h==I:w.g?w.g.has(I):!1}function mn(w,I){w.g?w.g.add(I):w.h=I}function Zt(w,I){w.h&&w.h==I?w.h=null:w.g&&w.g.has(I)&&w.g.delete(I)}pt.prototype.cancel=function(){if(this.i=$n(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const w of this.g.values())w.cancel();this.g.clear()}};function $n(w){if(w.h!=null)return w.i.concat(w.h.G);if(w.g!=null&&w.g.size!==0){let I=w.i;for(const L of w.g.values())I=I.concat(L.G);return I}return f(w.i)}var ts=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function fo(w,I){if(w){w=w.split("&");for(let L=0;L<w.length;L++){const V=w[L].indexOf("=");let ae,ce=null;V>=0?(ae=w[L].substring(0,V),ce=w[L].substring(V+1)):ae=w[L],I(ae,ce?decodeURIComponent(ce.replace(/\+/g," ")):"")}}}function Kr(w){this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1;let I;w instanceof Kr?(this.l=w.l,ur(this,w.j),this.o=w.o,this.g=w.g,pc(this,w.u),this.h=w.h,Ta(this,DK(w.i)),this.m=w.m):w&&(I=String(w).match(ts))?(this.l=!1,ur(this,I[1]||"",!0),this.o=j0(I[2]||""),this.g=j0(I[3]||"",!0),pc(this,I[4]),this.h=j0(I[5]||"",!0),Ta(this,I[6]||"",!0),this.m=j0(I[7]||"")):(this.l=!1,this.i=new F0(null,this.l))}Kr.prototype.toString=function(){const w=[];var I=this.j;I&&w.push(mc(I,N2,!0),":");var L=this.g;return(L||I=="file")&&(w.push("//"),(I=this.o)&&w.push(mc(I,N2,!0),"@"),w.push($i(L).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),L=this.u,L!=null&&w.push(":",String(L))),(L=this.h)&&(this.g&&L.charAt(0)!="/"&&w.push("/"),w.push(mc(L,L.charAt(0)=="/"?Ct:zn,!0))),(L=this.i.toString())&&w.push("?",L),(L=this.m)&&w.push("#",mc(L,Ln)),w.join("")},Kr.prototype.resolve=function(w){const I=gs(this);let L=!!w.j;L?ur(I,w.j):L=!!w.o,L?I.o=w.o:L=!!w.g,L?I.g=w.g:L=w.u!=null;var V=w.h;if(L)pc(I,w.u);else if(L=!!w.h){if(V.charAt(0)!="/")if(this.g&&!this.h)V="/"+V;else{var ae=I.h.lastIndexOf("/");ae!=-1&&(V=I.h.slice(0,ae+1)+V)}if(ae=V,ae==".."||ae==".")V="";else if(ae.indexOf("./")!=-1||ae.indexOf("/.")!=-1){V=ae.lastIndexOf("/",0)==0,ae=ae.split("/");const ce=[];for(let Xe=0;Xe<ae.length;){const sn=ae[Xe++];sn=="."?V&&Xe==ae.length&&ce.push(""):sn==".."?((ce.length>1||ce.length==1&&ce[0]!="")&&ce.pop(),V&&Xe==ae.length&&ce.push("")):(ce.push(sn),V=!0)}V=ce.join("/")}else V=ae}return L?I.h=V:L=w.i.toString()!=="",L?Ta(I,DK(w.i)):L=!!w.m,L&&(I.m=w.m),I};function gs(w){return new Kr(w)}function ur(w,I,L){w.j=L?j0(I,!0):I,w.j&&(w.j=w.j.replace(/:$/,""))}function pc(w,I){if(I){if(I=Number(I),isNaN(I)||I<0)throw Error("Bad port number "+I);w.u=I}else w.u=null}function Ta(w,I,L){I instanceof F0?(w.i=I,jTe(w.i,w.l)):(L||(I=mc(I,Tt)),w.i=new F0(I,w.l))}function dr(w,I,L){w.i.set(I,L)}function By(w){return dr(w,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^Date.now()).toString(36)),w}function j0(w,I){return w?I?decodeURI(w.replace(/%25/g,"%2525")):decodeURIComponent(w):""}function mc(w,I,L){return typeof w=="string"?(w=encodeURI(w).replace(I,B0),L&&(w=w.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),w):null}function B0(w){return w=w.charCodeAt(0),"%"+(w>>4&15).toString(16)+(w&15).toString(16)}var N2=/[#\/\?@]/g,zn=/[#\?:]/g,Ct=/[#\?]/g,Tt=/[#\?@]/g,Ln=/#/g;function F0(w,I){this.h=this.g=null,this.i=w||null,this.j=!!I}function V0(w){w.g||(w.g=new Map,w.h=0,w.i&&fo(w.i,function(I,L){w.add(decodeURIComponent(I.replace(/\+/g," ")),L)}))}t=F0.prototype,t.add=function(w,I){V0(this),this.i=null,w=Fy(this,w);let L=this.g.get(w);return L||this.g.set(w,L=[]),L.push(I),this.h+=1,this};function RK(w,I){V0(w),I=Fy(w,I),w.g.has(I)&&(w.i=null,w.h-=w.g.get(I).length,w.g.delete(I))}function MK(w,I){return V0(w),I=Fy(w,I),w.g.has(I)}t.forEach=function(w,I){V0(this),this.g.forEach(function(L,V){L.forEach(function(ae){w.call(I,ae,V,this)},this)},this)};function NK(w,I){V0(w);let L=[];if(typeof I=="string")MK(w,I)&&(L=L.concat(w.g.get(Fy(w,I))));else for(w=Array.from(w.g.values()),I=0;I<w.length;I++)L=L.concat(w[I]);return L}t.set=function(w,I){return V0(this),this.i=null,w=Fy(this,w),MK(this,w)&&(this.h-=this.g.get(w).length),this.g.set(w,[I]),this.h+=1,this},t.get=function(w,I){return w?(w=NK(this,w),w.length>0?String(w[0]):I):I};function OK(w,I,L){RK(w,I),L.length>0&&(w.i=null,w.g.set(Fy(w,I),f(L)),w.h+=L.length)}t.toString=function(){if(this.i)return this.i;if(!this.g)return"";const w=[],I=Array.from(this.g.keys());for(let V=0;V<I.length;V++){var L=I[V];const ae=$i(L);L=NK(this,L);for(let ce=0;ce<L.length;ce++){let Xe=ae;L[ce]!==""&&(Xe+="="+$i(L[ce])),w.push(Xe)}}return this.i=w.join("&")};function DK(w){const I=new F0;return I.i=w.i,w.g&&(I.g=new Map(w.g),I.h=w.h),I}function Fy(w,I){return I=String(I),w.j&&(I=I.toLowerCase()),I}function jTe(w,I){I&&!w.j&&(V0(w),w.i=null,w.g.forEach(function(L,V){const ae=V.toLowerCase();V!=ae&&(RK(this,V),OK(this,ae,L))},w)),w.j=I}function BTe(w,I){const L=new pn;if(o.Image){const V=new Image;V.onload=u(Bf,L,"TestLoadImage: loaded",!0,I,V),V.onerror=u(Bf,L,"TestLoadImage: error",!1,I,V),V.onabort=u(Bf,L,"TestLoadImage: abort",!1,I,V),V.ontimeout=u(Bf,L,"TestLoadImage: timeout",!1,I,V),o.setTimeout(function(){V.ontimeout&&V.ontimeout()},1e4),V.src=w}else I(!1)}function FTe(w,I){const L=new pn,V=new AbortController,ae=setTimeout(()=>{V.abort(),Bf(L,"TestPingServer: timeout",!1,I)},1e4);fetch(w,{signal:V.signal}).then(ce=>{clearTimeout(ae),ce.ok?Bf(L,"TestPingServer: ok",!0,I):Bf(L,"TestPingServer: server error",!1,I)}).catch(()=>{clearTimeout(ae),Bf(L,"TestPingServer: error",!1,I)})}function Bf(w,I,L,V,ae){try{ae&&(ae.onload=null,ae.onerror=null,ae.onabort=null,ae.ontimeout=null),V(L)}catch{}}function VTe(){this.g=new rt}function mM(w){this.i=w.Sb||null,this.h=w.ab||!1}d(mM,un),mM.prototype.g=function(){return new _C(this.i,this.h)};function _C(w,I){he.call(this),this.H=w,this.o=I,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}d(_C,he),t=_C.prototype,t.open=function(w,I){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.F=w,this.D=I,this.readyState=1,D2(this)},t.send=function(w){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const I={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};w&&(I.body=w),(this.H||o).fetch(new Request(this.D,I)).then(this.Pa.bind(this),this.ga.bind(this))},t.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&this.readyState!=4&&(this.g=!1,O2(this)),this.readyState=0},t.Pa=function(w){if(this.g&&(this.l=w,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=w.headers,this.readyState=2,D2(this)),this.g&&(this.readyState=3,D2(this),this.g)))if(this.responseType==="arraybuffer")w.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(typeof o.ReadableStream<"u"&&"body"in w){if(this.j=w.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.B=new TextDecoder;PK(this)}else w.text().then(this.Oa.bind(this),this.ga.bind(this))};function PK(w){w.j.read().then(w.Ma.bind(w)).catch(w.ga.bind(w))}t.Ma=function(w){if(this.g){if(this.o&&w.value)this.response.push(w.value);else if(!this.o){var I=w.value?w.value:new Uint8Array(0);(I=this.B.decode(I,{stream:!w.done}))&&(this.response=this.responseText+=I)}w.done?O2(this):D2(this),this.readyState==3&&PK(this)}},t.Oa=function(w){this.g&&(this.response=this.responseText=w,O2(this))},t.Na=function(w){this.g&&(this.response=w,O2(this))},t.ga=function(){this.g&&O2(this)};function O2(w){w.readyState=4,w.l=null,w.j=null,w.B=null,D2(w)}t.setRequestHeader=function(w,I){this.A.append(w,I)},t.getResponseHeader=function(w){return this.h&&this.h.get(w.toLowerCase())||""},t.getAllResponseHeaders=function(){if(!this.h)return"";const w=[],I=this.h.entries();for(var L=I.next();!L.done;)L=L.value,w.push(L[0]+": "+L[1]),L=I.next();return w.join(`\r
|
||
`)};function D2(w){w.onreadystatechange&&w.onreadystatechange.call(w)}Object.defineProperty(_C.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(w){this.m=w?"include":"same-origin"}});function LK(w){let I="";return oe(w,function(L,V){I+=V,I+=":",I+=L,I+=`\r
|
||
`}),I}function gM(w,I,L){e:{for(V in L){var V=!1;break e}V=!0}V||(L=LK(L),typeof w=="string"?L!=null&&$i(L):dr(w,I,L))}function ri(w){he.call(this),this.headers=new Map,this.L=w||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}d(ri,he);var $Te=/^https?$/i,HTe=["POST","PUT"];t=ri.prototype,t.Fa=function(w){this.H=w},t.ea=function(w,I,L,V){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+w);I=I?I.toUpperCase():"GET",this.D=w,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():fi.g(),this.g.onreadystatechange=h(c(this.Ca,this));try{this.B=!0,this.g.open(I,String(w),!0),this.B=!1}catch(ce){zK(this,ce);return}if(w=L||"",L=new Map(this.headers),V)if(Object.getPrototypeOf(V)===Object.prototype)for(var ae in V)L.set(ae,V[ae]);else if(typeof V.keys=="function"&&typeof V.get=="function")for(const ce of V.keys())L.set(ce,V.get(ce));else throw Error("Unknown input type for opt_headers: "+String(V));V=Array.from(L.keys()).find(ce=>ce.toLowerCase()=="content-type"),ae=o.FormData&&w instanceof o.FormData,!(Array.prototype.indexOf.call(HTe,I,void 0)>=0)||V||ae||L.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[ce,Xe]of L)this.g.setRequestHeader(ce,Xe);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(w),this.v=!1}catch(ce){zK(this,ce)}};function zK(w,I){w.h=!1,w.g&&(w.j=!0,w.g.abort(),w.j=!1),w.l=I,w.o=5,jK(w),SC(w)}function jK(w){w.A||(w.A=!0,we(w,"complete"),we(w,"error"))}t.abort=function(w){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=w||7,we(this,"complete"),we(this,"abort"),SC(this))},t.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),SC(this,!0)),ri.Z.N.call(this)},t.Ca=function(){this.u||(this.B||this.v||this.j?BK(this):this.Xa())},t.Xa=function(){BK(this)};function BK(w){if(w.h&&typeof s<"u"){if(w.v&&Ff(w)==4)setTimeout(w.Ca.bind(w),0);else if(we(w,"readystatechange"),Ff(w)==4){w.h=!1;try{const ce=w.ca();e:switch(ce){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var I=!0;break e;default:I=!1}var L;if(!(L=I)){var V;if(V=ce===0){let Xe=String(w.D).match(ts)[1]||null;!Xe&&o.self&&o.self.location&&(Xe=o.self.location.protocol.slice(0,-1)),V=!$Te.test(Xe?Xe.toLowerCase():"")}L=V}if(L)we(w,"complete"),we(w,"success");else{w.o=6;try{var ae=Ff(w)>2?w.g.statusText:""}catch{ae=""}w.l=ae+" ["+w.ca()+"]",jK(w)}}finally{SC(w)}}}}function SC(w,I){if(w.g){w.m&&(clearTimeout(w.m),w.m=null);const L=w.g;w.g=null,I||we(w,"ready");try{L.onreadystatechange=null}catch{}}}t.isActive=function(){return!!this.g};function Ff(w){return w.g?w.g.readyState:0}t.ca=function(){try{return Ff(this)>2?this.g.status:-1}catch{return-1}},t.la=function(){try{return this.g?this.g.responseText:""}catch{return""}},t.La=function(w){if(this.g){var I=this.g.responseText;return w&&I.indexOf(w)==0&&(I=I.substring(w.length)),Ze(I)}};function FK(w){try{if(!w.g)return null;if("response"in w.g)return w.g.response;switch(w.F){case"":case"text":return w.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in w.g)return w.g.mozResponseArrayBuffer}return null}catch{return null}}function UTe(w){const I={};w=(w.g&&Ff(w)>=2&&w.g.getAllResponseHeaders()||"").split(`\r
|
||
`);for(let V=0;V<w.length;V++){if(z(w[V]))continue;var L=z0(w[V]);const ae=L[0];if(L=L[1],typeof L!="string")continue;L=L.trim();const ce=I[ae]||[];I[ae]=ce,ce.push(L)}B(I,function(V){return V.join(", ")})}t.ya=function(){return this.o},t.Ha=function(){return typeof this.l=="string"?this.l:String(this.l)};function P2(w,I,L){return L&&L.internalChannelParams&&L.internalChannelParams[w]||I}function VK(w){this.za=0,this.i=[],this.j=new pn,this.ba=this.na=this.J=this.W=this.g=this.wa=this.G=this.H=this.u=this.U=this.o=null,this.Ya=this.V=0,this.Sa=P2("failFast",!1,w),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=P2("baseRetryDelayMs",5e3,w),this.Za=P2("retryDelaySeedMs",1e4,w),this.Ta=P2("forwardChannelMaxRetries",2,w),this.va=P2("forwardChannelRequestTimeoutMs",2e4,w),this.ma=w&&w.xmlHttpFactory||void 0,this.Ua=w&&w.Rb||void 0,this.Aa=w&&w.useFetchStreams||!1,this.O=void 0,this.L=w&&w.supportsCrossDomainXhr||!1,this.M="",this.h=new pt(w&&w.concurrentRequestLimit),this.Ba=new VTe,this.S=w&&w.fastHandshake||!1,this.R=w&&w.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=w&&w.Pb||!1,w&&w.ua&&this.j.ua(),w&&w.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&w&&w.detectBufferingProxy||!1,this.ia=void 0,w&&w.longPollingTimeout&&w.longPollingTimeout>0&&(this.ia=w.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}t=VK.prototype,t.ka=8,t.I=1,t.connect=function(w,I,L,V){en(0),this.W=w,this.H=I||{},L&&V!==void 0&&(this.H.OSID=L,this.H.OAID=V),this.F=this.X,this.J=ZK(this,null,this.W),CC(this)};function yM(w){if($K(w),w.I==3){var I=w.V++,L=gs(w.J);if(dr(L,"SID",w.M),dr(L,"RID",I),dr(L,"TYPE","terminate"),L2(w,L),I=new Gr(w,w.j,I),I.M=2,I.A=By(gs(L)),L=!1,o.navigator&&o.navigator.sendBeacon)try{L=o.navigator.sendBeacon(I.A.toString(),"")}catch{}!L&&o.Image&&(new Image().src=I.A,L=!0),L||(I.g=XK(I.j,null),I.g.ea(I.A)),I.F=Date.now(),hu(I)}YK(w)}function kC(w){w.g&&(bM(w),w.g.cancel(),w.g=null)}function $K(w){kC(w),w.v&&(o.clearTimeout(w.v),w.v=null),EC(w),w.h.cancel(),w.m&&(typeof w.m=="number"&&o.clearTimeout(w.m),w.m=null)}function CC(w){if(!U(w.h)&&!w.m){w.m=!0;var I=w.Ea;k||C(),T||(k(),T=!0),E.add(I,w),w.D=0}}function qTe(w,I){return ge(w.h)>=w.h.j-(w.m?1:0)?!1:w.m?(w.i=I.G.concat(w.i),!0):w.I==1||w.I==2||w.D>=(w.Sa?0:w.Ta)?!1:(w.m=wt(c(w.Ea,w,I),KK(w,w.D)),w.D++,!0)}t.Ea=function(w){if(this.m)if(this.m=null,this.I==1){if(!w){this.V=Math.floor(Math.random()*1e5),w=this.V++;const ae=new Gr(this,this.j,w);let ce=this.o;if(this.U&&(ce?(ce=$e(ce),$(ce,this.U)):ce=this.U),this.u!==null||this.R||(ae.J=ce,ce=null),this.S)e:{for(var I=0,L=0;L<this.i.length;L++){t:{var V=this.i[L];if("__data__"in V.map&&(V=V.map.__data__,typeof V=="string")){V=V.length;break t}V=void 0}if(V===void 0)break;if(I+=V,I>4096){I=L;break e}if(I===4096||L===this.i.length-1){I=L+1;break e}}I=1e3}else I=1e3;I=UK(this,ae,I),L=gs(this.J),dr(L,"RID",w),dr(L,"CVER",22),this.G&&dr(L,"X-HTTP-Session-Id",this.G),L2(this,L),ce&&(this.R?I="headers="+$i(LK(ce))+"&"+I:this.u&&gM(L,this.u,ce)),mn(this.h,ae),this.Ra&&dr(L,"TYPE","init"),this.S?(dr(L,"$req",I),dr(L,"SID","null"),ae.U=!0,Fd(ae,L,null)):Fd(ae,L,I),this.I=2}}else this.I==3&&(w?HK(this,w):this.i.length==0||U(this.h)||HK(this))};function HK(w,I){var L;I?L=I.l:L=w.V++;const V=gs(w.J);dr(V,"SID",w.M),dr(V,"RID",L),dr(V,"AID",w.K),L2(w,V),w.u&&w.o&&gM(V,w.u,w.o),L=new Gr(w,w.j,L,w.D+1),w.u===null&&(L.J=w.o),I&&(w.i=I.G.concat(w.i)),I=UK(w,L,1e3),L.H=Math.round(w.va*.5)+Math.round(w.va*.5*Math.random()),mn(w.h,L),Fd(L,V,I)}function L2(w,I){w.H&&oe(w.H,function(L,V){dr(I,V,L)}),w.l&&oe({},function(L,V){dr(I,V,L)})}function UK(w,I,L){L=Math.min(w.i.length,L);const V=w.l?c(w.l.Ka,w.l,w):null;e:{var ae=w.i;let sn=-1;for(;;){const Hi=["count="+L];sn==-1?L>0?(sn=ae[0].g,Hi.push("ofs="+sn)):sn=0:Hi.push("ofs="+sn);let hr=!0;for(let ns=0;ns<L;ns++){var ce=ae[ns].g;const fu=ae[ns].map;if(ce-=sn,ce<0)sn=Math.max(0,ae[ns].g-100),hr=!1;else try{ce="req"+ce+"_"||"";try{var Xe=fu instanceof Map?fu:Object.entries(fu);for(const[H0,Vf]of Xe){let $f=Vf;a(Vf)&&($f=Le(Vf)),Hi.push(ce+H0+"="+encodeURIComponent($f))}}catch(H0){throw Hi.push(ce+"type="+encodeURIComponent("_badmap")),H0}}catch{V&&V(fu)}}if(hr){Xe=Hi.join("&");break e}}Xe=void 0}return w=w.i.splice(0,L),I.G=w,Xe}function qK(w){if(!w.g&&!w.v){w.Y=1;var I=w.Da;k||C(),T||(k(),T=!0),E.add(I,w),w.A=0}}function vM(w){return w.g||w.v||w.A>=3?!1:(w.Y++,w.v=wt(c(w.Da,w),KK(w,w.A)),w.A++,!0)}t.Da=function(){if(this.v=null,WK(this),this.aa&&!(this.P||this.g==null||this.T<=0)){var w=4*this.T;this.j.info("BP detection timer enabled: "+w),this.B=wt(c(this.Wa,this),w)}},t.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,en(10),kC(this),WK(this))};function bM(w){w.B!=null&&(o.clearTimeout(w.B),w.B=null)}function WK(w){w.g=new Gr(w,w.j,"rpc",w.Y),w.u===null&&(w.g.J=w.o),w.g.P=0;var I=gs(w.na);dr(I,"RID","rpc"),dr(I,"SID",w.M),dr(I,"AID",w.K),dr(I,"CI",w.F?"0":"1"),!w.F&&w.ia&&dr(I,"TO",w.ia),dr(I,"TYPE","xmlhttp"),L2(w,I),w.u&&w.o&&gM(I,w.u,w.o),w.O&&(w.g.H=w.O);var L=w.g;w=w.ba,L.M=1,L.A=By(gs(I)),L.u=null,L.R=!0,cu(L,w)}t.Va=function(){this.C!=null&&(this.C=null,kC(this),vM(this),en(19))};function EC(w){w.C!=null&&(o.clearTimeout(w.C),w.C=null)}function GK(w,I){var L=null;if(w.g==I){EC(w),bM(w),w.g=null;var V=2}else if(Qe(w.h,I))L=I.G,Zt(w.h,I),V=1;else return;if(w.I!=0){if(I.o)if(V==1){L=I.u?I.u.length:0,I=Date.now()-I.F;var ae=w.D;V=Ee(),we(V,new Vi(V,L)),CC(w)}else qK(w);else if(ae=I.m,ae==3||ae==0&&I.X>0||!(V==1&&qTe(w,I)||V==2&&vM(w)))switch(L&&L.length>0&&(I=w.h,I.i=I.i.concat(L)),ae){case 1:$0(w,5);break;case 4:$0(w,10);break;case 3:$0(w,6);break;default:$0(w,2)}}}function KK(w,I){let L=w.Qa+Math.floor(Math.random()*w.Za);return w.isActive()||(L*=2),L*I}function $0(w,I){if(w.j.info("Error code "+I),I==2){var L=c(w.bb,w),V=w.Ua;const ae=!V;V=new Kr(V||"//www.google.com/images/cleardot.gif"),o.location&&o.location.protocol=="http"||ur(V,"https"),By(V),ae?BTe(V.toString(),L):FTe(V.toString(),L)}else en(2);w.I=0,w.l&&w.l.pa(I),YK(w),$K(w)}t.bb=function(w){w?(this.j.info("Successfully pinged google.com"),en(2)):(this.j.info("Failed to ping google.com"),en(1))};function YK(w){if(w.I=0,w.ja=[],w.l){const I=$n(w.h);(I.length!=0||w.i.length!=0)&&(p(w.ja,I),p(w.ja,w.i),w.h.i.length=0,f(w.i),w.i.length=0),w.l.oa()}}function ZK(w,I,L){var V=L instanceof Kr?gs(L):new Kr(L);if(V.g!="")I&&(V.g=I+"."+V.g),pc(V,V.u);else{var ae=o.location;V=ae.protocol,I=I?I+"."+ae.hostname:ae.hostname,ae=+ae.port;const ce=new Kr(null);V&&ur(ce,V),I&&(ce.g=I),ae&&pc(ce,ae),L&&(ce.h=L),V=ce}return L=w.G,I=w.wa,L&&I&&dr(V,L,I),dr(V,"VER",w.ka),L2(w,V),V}function XK(w,I,L){if(I&&!w.L)throw Error("Can't create secondary domain capable XhrIo object.");return I=w.Aa&&!w.ma?new ri(new mM({ab:L})):new ri(w.ma),I.Fa(w.L),I}t.isActive=function(){return!!this.l&&this.l.isActive(this)};function QK(){}t=QK.prototype,t.ra=function(){},t.qa=function(){},t.pa=function(){},t.oa=function(){},t.isActive=function(){return!0},t.Ka=function(){};function TC(){}TC.prototype.g=function(w,I){return new Aa(w,I)};function Aa(w,I){he.call(this),this.g=new VK(I),this.l=w,this.h=I&&I.messageUrlParams||null,w=I&&I.messageHeaders||null,I&&I.clientProtocolHeaderRequired&&(w?w["X-Client-Protocol"]="webchannel":w={"X-Client-Protocol":"webchannel"}),this.g.o=w,w=I&&I.initMessageHeaders||null,I&&I.messageContentType&&(w?w["X-WebChannel-Content-Type"]=I.messageContentType:w={"X-WebChannel-Content-Type":I.messageContentType}),I&&I.sa&&(w?w["X-WebChannel-Client-Profile"]=I.sa:w={"X-WebChannel-Client-Profile":I.sa}),this.g.U=w,(w=I&&I.Qb)&&!z(w)&&(this.g.u=w),this.A=I&&I.supportsCrossDomainXhr||!1,this.v=I&&I.sendRawJson||!1,(I=I&&I.httpSessionIdParam)&&!z(I)&&(this.g.G=I,w=this.h,w!==null&&I in w&&(w=this.h,I in w&&delete w[I])),this.j=new Vy(this)}d(Aa,he),Aa.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},Aa.prototype.close=function(){yM(this.g)},Aa.prototype.o=function(w){var I=this.g;if(typeof w=="string"){var L={};L.__data__=w,w=L}else this.v&&(L={},L.__data__=Le(w),w=L);I.i.push(new fc(I.Ya++,w)),I.I==3&&CC(I)},Aa.prototype.N=function(){this.g.l=null,delete this.j,yM(this.g),delete this.g,Aa.Z.N.call(this)};function JK(w){kr.call(this),w.__headers__&&(this.headers=w.__headers__,this.statusCode=w.__status__,delete w.__headers__,delete w.__status__);var I=w.__sm__;if(I){e:{for(const L in I){w=L;break e}w=void 0}(this.i=w)&&(w=this.i,I=I!==null&&w in I?I[w]:void 0),this.data=I}else this.data=w}d(JK,kr);function eY(){In.call(this),this.status=1}d(eY,In);function Vy(w){this.g=w}d(Vy,QK),Vy.prototype.ra=function(){we(this.g,"a")},Vy.prototype.qa=function(w){we(this.g,new JK(w))},Vy.prototype.pa=function(w){we(this.g,new eY)},Vy.prototype.oa=function(){we(this.g,"b")},TC.prototype.createWebChannel=TC.prototype.g,Aa.prototype.send=Aa.prototype.o,Aa.prototype.open=Aa.prototype.m,Aa.prototype.close=Aa.prototype.close,Wge=function(){return new TC},qge=function(){return Ee()},Uge=Vt,PL={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},Ho.NO_ERROR=0,Ho.TIMEOUT=8,Ho.HTTP_ERROR=6,XT=Ho,Si.COMPLETE="complete",Hge=Si,Yt.EventType=_n,_n.OPEN="a",_n.CLOSE="b",_n.ERROR="c",_n.MESSAGE="d",he.prototype.listen=he.prototype.J,x4=Yt,ri.prototype.listenOnce=ri.prototype.K,ri.prototype.getLastError=ri.prototype.Ha,ri.prototype.getLastErrorCode=ri.prototype.ya,ri.prototype.getStatus=ri.prototype.ca,ri.prototype.getResponseJson=ri.prototype.La,ri.prototype.getResponseText=ri.prototype.la,ri.prototype.send=ri.prototype.ea,ri.prototype.setWithCredentials=ri.prototype.Fa,$ge=ri}).apply(typeof oE<"u"?oE:typeof self<"u"?self:typeof window<"u"?window:{});/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class Ks{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}Ks.UNAUTHENTICATED=new Ks(null),Ks.GOOGLE_CREDENTIALS=new Ks("google-credentials-uid"),Ks.FIRST_PARTY=new Ks("first-party-uid"),Ks.MOCK_USER=new Ks("mock-user");/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/let Yx="12.10.0";function hqe(t){Yx=t}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*//**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const V1=new M$("@firebase/firestore");function lv(){return V1.logLevel}function dt(t,...e){if(V1.logLevel<=kn.DEBUG){const n=e.map(K$);V1.debug(`Firestore (${Yx}): ${t}`,...n)}}function cf(t,...e){if(V1.logLevel<=kn.ERROR){const n=e.map(K$);V1.error(`Firestore (${Yx}): ${t}`,...n)}}function $1(t,...e){if(V1.logLevel<=kn.WARN){const n=e.map(K$);V1.warn(`Firestore (${Yx}): ${t}`,...n)}}function K$(t){if(typeof t=="string")return t;try{return function(n){return JSON.stringify(n)}(t)}catch{return t}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function Pt(t,e,n){let r="Unexpected state";typeof e=="string"?r=e:n=e,Gge(t,r,n)}function Gge(t,e,n){let r=`FIRESTORE (${Yx}) INTERNAL ASSERTION FAILED: ${e} (ID: ${t.toString(16)})`;if(n!==void 0)try{r+=" CONTEXT: "+JSON.stringify(n)}catch{r+=" CONTEXT: "+n}throw cf(r),new Error(r)}function er(t,e,n,r){let i="Unexpected state";typeof n=="string"?i=n:r=n,t||Gge(e,i,r)}function Gt(t,e){return t}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const Se={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class it extends Sf{constructor(e,n){super(e,n),this.code=e,this.message=n,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class xm{constructor(){this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class Kge{constructor(e,n){this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class fqe{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,n){e.enqueueRetryable(()=>n(Ks.UNAUTHENTICATED))}shutdown(){}}class pqe{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,n){this.changeListener=n,e.enqueueRetryable(()=>n(this.token.user))}shutdown(){this.changeListener=null}}class mqe{constructor(e){this.t=e,this.currentUser=Ks.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,n){er(this.o===void 0,42304);let r=this.i;const i=l=>this.i!==r?(r=this.i,n(l)):Promise.resolve();let s=new xm;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new xm,e.enqueueRetryable(()=>i(this.currentUser))};const o=()=>{const l=s;e.enqueueRetryable(async()=>{await l.promise,await i(this.currentUser)})},a=l=>{dt("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=l,this.o&&(this.auth.addAuthTokenListener(this.o),o())};this.t.onInit(l=>a(l)),setTimeout(()=>{if(!this.auth){const l=this.t.getImmediate({optional:!0});l?a(l):(dt("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new xm)}},0),o()}getToken(){const e=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then(r=>this.i!==e?(dt("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(er(typeof r.accessToken=="string",31837,{l:r}),new Kge(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return er(e===null||typeof e=="string",2055,{h:e}),new Ks(e)}}class gqe{constructor(e,n,r){this.P=e,this.T=n,this.I=r,this.type="FirstParty",this.user=Ks.FIRST_PARTY,this.R=new Map}A(){return this.I?this.I():null}get headers(){this.R.set("X-Goog-AuthUser",this.P);const e=this.A();return e&&this.R.set("Authorization",e),this.T&&this.R.set("X-Goog-Iam-Authorization-Token",this.T),this.R}}class yqe{constructor(e,n,r){this.P=e,this.T=n,this.I=r}getToken(){return Promise.resolve(new gqe(this.P,this.T,this.I))}start(e,n){e.enqueueRetryable(()=>n(Ks.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class bQ{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class vqe{constructor(e,n){this.V=n,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,Rc(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,n){er(this.o===void 0,3512);const r=s=>{s.error!=null&&dt("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${s.error.message}`);const o=s.token!==this.m;return this.m=s.token,dt("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?n(s.token):Promise.resolve()};this.o=s=>{e.enqueueRetryable(()=>r(s))};const i=s=>{dt("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=s,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(s=>i(s)),setTimeout(()=>{if(!this.appCheck){const s=this.V.getImmediate({optional:!0});s?i(s):dt("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new bQ(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(n=>n?(er(typeof n.token=="string",44558,{tokenResult:n}),this.m=n.token,new bQ(n.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function bqe(t){const e=typeof self<"u"&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(n);else for(let r=0;r<t;r++)n[r]=Math.floor(256*Math.random());return n}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class Y${static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=62*Math.floor(4.129032258064516);let r="";for(;r.length<20;){const i=bqe(40);for(let s=0;s<i.length;++s)r.length<20&&i[s]<n&&(r+=e.charAt(i[s]%62))}return r}}function Cn(t,e){return t<e?-1:t>e?1:0}function LL(t,e){const n=Math.min(t.length,e.length);for(let r=0;r<n;r++){const i=t.charAt(r),s=e.charAt(r);if(i!==s)return AN(i)===AN(s)?Cn(i,s):AN(i)?1:-1}return Cn(t.length,e.length)}const wqe=55296,xqe=57343;function AN(t){const e=t.charCodeAt(0);return e>=wqe&&e<=xqe}function Ww(t,e,n){return t.length===e.length&&t.every((r,i)=>n(r,e[i]))}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const wQ="__name__";class Iu{constructor(e,n,r){n===void 0?n=0:n>e.length&&Pt(637,{offset:n,range:e.length}),r===void 0?r=e.length-n:r>e.length-n&&Pt(1746,{length:r,range:e.length-n}),this.segments=e,this.offset=n,this.len=r}get length(){return this.len}isEqual(e){return Iu.comparator(this,e)===0}child(e){const n=this.segments.slice(this.offset,this.limit());return e instanceof Iu?e.forEach(r=>{n.push(r)}):n.push(e),this.construct(n)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length<this.length)return!1;for(let n=0;n<this.length;n++)if(this.get(n)!==e.get(n))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let n=0;n<this.length;n++)if(this.get(n)!==e.get(n))return!1;return!0}forEach(e){for(let n=this.offset,r=this.limit();n<r;n++)e(this.segments[n])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,n){const r=Math.min(e.length,n.length);for(let i=0;i<r;i++){const s=Iu.compareSegments(e.get(i),n.get(i));if(s!==0)return s}return Cn(e.length,n.length)}static compareSegments(e,n){const r=Iu.isNumericId(e),i=Iu.isNumericId(n);return r&&!i?-1:!r&&i?1:r&&i?Iu.extractNumericId(e).compare(Iu.extractNumericId(n)):LL(e,n)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return wm.fromString(e.substring(4,e.length-2))}}class Ar extends Iu{construct(e,n,r){return new Ar(e,n,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const n=[];for(const r of e){if(r.indexOf("//")>=0)throw new it(Se.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);n.push(...r.split("/").filter(i=>i.length>0))}return new Ar(n)}static emptyPath(){return new Ar([])}}const _qe=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class As extends Iu{construct(e,n,r){return new As(e,n,r)}static isValidIdentifier(e){return _qe.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),As.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===wQ}static keyField(){return new As([wQ])}static fromServerFormat(e){const n=[];let r="",i=0;const s=()=>{if(r.length===0)throw new it(Se.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(r),r=""};let o=!1;for(;i<e.length;){const a=e[i];if(a==="\\"){if(i+1===e.length)throw new it(Se.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const l=e[i+1];if(l!=="\\"&&l!=="."&&l!=="`")throw new it(Se.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=l,i+=2}else a==="`"?(o=!o,i++):a!=="."||o?(r+=a,i++):(s(),i++)}if(s(),o)throw new it(Se.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new As(n)}static emptyPath(){return new As([])}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class At{constructor(e){this.path=e}static fromPath(e){return new At(Ar.fromString(e))}static fromName(e){return new At(Ar.fromString(e).popFirst(5))}static empty(){return new At(Ar.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&Ar.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,n){return Ar.comparator(e.path,n.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new At(new Ar(e.slice()))}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function Yge(t,e,n){if(!n)throw new it(Se.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function Sqe(t,e,n,r){if(e===!0&&r===!0)throw new it(Se.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}function xQ(t){if(!At.isDocumentKey(t))throw new it(Se.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function _Q(t){if(At.isDocumentKey(t))throw new it(Se.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function Zge(t){return typeof t=="object"&&t!==null&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null)}function nI(t){if(t===void 0)return"undefined";if(t===null)return"null";if(typeof t=="string")return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if(typeof t=="number"||typeof t=="boolean")return""+t;if(typeof t=="object"){if(t instanceof Array)return"an array";{const e=function(r){return r.constructor?r.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return typeof t=="function"?"a function":Pt(12329,{type:typeof t})}function Fh(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new it(Se.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=nI(t);throw new it(Se.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}function kqe(t,e){if(e<=0)throw new it(Se.INVALID_ARGUMENT,`Function ${t}() requires a positive number, but it was: ${e}.`)}/**
|
||
* @license
|
||
* Copyright 2025 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function Ri(t,e){const n={typeString:t};return e&&(n.value=e),n}function p3(t,e){if(!Zge(t))throw new it(Se.INVALID_ARGUMENT,"JSON must be an object");let n;for(const r in e)if(e[r]){const i=e[r].typeString,s="value"in e[r]?{value:e[r].value}:void 0;if(!(r in t)){n=`JSON missing required field: '${r}'`;break}const o=t[r];if(i&&typeof o!==i){n=`JSON field '${r}' must be a ${i}.`;break}if(s!==void 0&&o!==s.value){n=`Expected '${r}' field to equal '${s.value}'`;break}}if(n)throw new it(Se.INVALID_ARGUMENT,n);return!0}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const SQ=-62135596800,kQ=1e6;class ir{static now(){return ir.fromMillis(Date.now())}static fromDate(e){return ir.fromMillis(e.getTime())}static fromMillis(e){const n=Math.floor(e/1e3),r=Math.floor((e-1e3*n)*kQ);return new ir(n,r)}constructor(e,n){if(this.seconds=e,this.nanoseconds=n,n<0)throw new it(Se.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new it(Se.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(e<SQ)throw new it(Se.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new it(Se.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/kQ}_compareTo(e){return this.seconds===e.seconds?Cn(this.nanoseconds,e.nanoseconds):Cn(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:ir._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(p3(e,ir._jsonSchema))return new ir(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-SQ;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}ir._jsonSchemaVersion="firestore/timestamp/1.0",ir._jsonSchema={type:Ri("string",ir._jsonSchemaVersion),seconds:Ri("number"),nanoseconds:Ri("number")};/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class $t{static fromTimestamp(e){return new $t(e)}static min(){return new $t(new ir(0,0))}static max(){return new $t(new ir(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/**
|
||
* @license
|
||
* Copyright 2021 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const jS=-1;function Cqe(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,i=$t.fromTimestamp(r===1e9?new ir(n+1,0):new ir(n,r));return new jm(i,At.empty(),e)}function Eqe(t){return new jm(t.readTime,t.key,jS)}class jm{constructor(e,n,r){this.readTime=e,this.documentKey=n,this.largestBatchId=r}static min(){return new jm($t.min(),At.empty(),jS)}static max(){return new jm($t.max(),At.empty(),jS)}}function Tqe(t,e){let n=t.readTime.compareTo(e.readTime);return n!==0?n:(n=At.comparator(t.documentKey,e.documentKey),n!==0?n:Cn(t.largestBatchId,e.largestBatchId))}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const Aqe="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class Iqe{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/async function Zx(t){if(t.code!==Se.FAILED_PRECONDITION||t.message!==Aqe)throw t;dt("LocalStore","Unexpectedly lost primary lease")}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class Ae{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(n=>{this.isDone=!0,this.result=n,this.nextCallback&&this.nextCallback(n)},n=>{this.isDone=!0,this.error=n,this.catchCallback&&this.catchCallback(n)})}catch(e){return this.next(void 0,e)}next(e,n){return this.callbackAttached&&Pt(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new Ae((r,i)=>{this.nextCallback=s=>{this.wrapSuccess(e,s).next(r,i)},this.catchCallback=s=>{this.wrapFailure(n,s).next(r,i)}})}toPromise(){return new Promise((e,n)=>{this.next(e,n)})}wrapUserFunction(e){try{const n=e();return n instanceof Ae?n:Ae.resolve(n)}catch(n){return Ae.reject(n)}}wrapSuccess(e,n){return e?this.wrapUserFunction(()=>e(n)):Ae.resolve(n)}wrapFailure(e,n){return e?this.wrapUserFunction(()=>e(n)):Ae.reject(n)}static resolve(e){return new Ae((n,r)=>{n(e)})}static reject(e){return new Ae((n,r)=>{r(e)})}static waitFor(e){return new Ae((n,r)=>{let i=0,s=0,o=!1;e.forEach(a=>{++i,a.next(()=>{++s,o&&s===i&&n()},l=>r(l))}),o=!0,s===i&&n()})}static or(e){let n=Ae.resolve(!1);for(const r of e)n=n.next(i=>i?Ae.resolve(i):r());return n}static forEach(e,n){const r=[];return e.forEach((i,s)=>{r.push(n.call(this,i,s))}),this.waitFor(r)}static mapArray(e,n){return new Ae((r,i)=>{const s=e.length,o=new Array(s);let a=0;for(let l=0;l<s;l++){const c=l;n(e[c]).next(u=>{o[c]=u,++a,a===s&&r(o)},u=>i(u))}})}static doWhile(e,n){return new Ae((r,i)=>{const s=()=>{e()===!0?n().next(()=>{s()},i):r()};s()})}}function Rqe(t){const e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)}function Xx(t){return t.name==="IndexedDbTransactionError"}/**
|
||
* @license
|
||
* Copyright 2018 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class rI{constructor(e,n){this.previousValue=e,n&&(n.sequenceNumberHandler=r=>this.ae(r),this.ue=r=>n.writeSequenceNumber(r))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ue&&this.ue(e),e}}rI.ce=-1;/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const Z$=-1;function iI(t){return t==null}function w7(t){return t===0&&1/t==-1/0}function Mqe(t){return typeof t=="number"&&Number.isInteger(t)&&!w7(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const Xge="";function Nqe(t){let e="";for(let n=0;n<t.length;n++)e.length>0&&(e=CQ(e)),e=Oqe(t.get(n),e);return CQ(e)}function Oqe(t,e){let n=e;const r=t.length;for(let i=0;i<r;i++){const s=t.charAt(i);switch(s){case"\0":n+="";break;case Xge:n+="";break;default:n+=s}}return n}function CQ(t){return t+Xge+""}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function EQ(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function b0(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function Qge(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class ei{constructor(e,n){this.comparator=e,this.root=n||Ss.EMPTY}insert(e,n){return new ei(this.comparator,this.root.insert(e,n,this.comparator).copy(null,null,Ss.BLACK,null,null))}remove(e){return new ei(this.comparator,this.root.remove(e,this.comparator).copy(null,null,Ss.BLACK,null,null))}get(e){let n=this.root;for(;!n.isEmpty();){const r=this.comparator(e,n.key);if(r===0)return n.value;r<0?n=n.left:r>0&&(n=n.right)}return null}indexOf(e){let n=0,r=this.root;for(;!r.isEmpty();){const i=this.comparator(e,r.key);if(i===0)return n+r.left.size;i<0?r=r.left:(n+=r.left.size+1,r=r.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((n,r)=>(e(n,r),!1))}toString(){const e=[];return this.inorderTraversal((n,r)=>(e.push(`${n}:${r}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new aE(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new aE(this.root,e,this.comparator,!1)}getReverseIterator(){return new aE(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new aE(this.root,e,this.comparator,!0)}}class aE{constructor(e,n,r,i){this.isReverse=i,this.nodeStack=[];let s=1;for(;!e.isEmpty();)if(s=n?r(e.key,n):1,n&&i&&(s*=-1),s<0)e=this.isReverse?e.left:e.right;else{if(s===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const n={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return n}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class Ss{constructor(e,n,r,i,s){this.key=e,this.value=n,this.color=r??Ss.RED,this.left=i??Ss.EMPTY,this.right=s??Ss.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,n,r,i,s){return new Ss(e??this.key,n??this.value,r??this.color,i??this.left,s??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,n,r){let i=this;const s=r(e,i.key);return i=s<0?i.copy(null,null,null,i.left.insert(e,n,r),null):s===0?i.copy(null,n,null,null,null):i.copy(null,null,null,null,i.right.insert(e,n,r)),i.fixUp()}removeMin(){if(this.left.isEmpty())return Ss.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,n){let r,i=this;if(n(e,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(e,n),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),n(e,i.key)===0){if(i.right.isEmpty())return Ss.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,n))}return i.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,Ss.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,Ss.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,n)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw Pt(43730,{key:this.key,value:this.value});if(this.right.isRed())throw Pt(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw Pt(27949);return e+(this.isRed()?0:1)}}Ss.EMPTY=null,Ss.RED=!0,Ss.BLACK=!1;Ss.EMPTY=new class{constructor(){this.size=0}get key(){throw Pt(57766)}get value(){throw Pt(16141)}get color(){throw Pt(16727)}get left(){throw Pt(29726)}get right(){throw Pt(36894)}copy(e,n,r,i,s){return this}insert(e,n,r){return new Ss(e,n)}remove(e,n){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class Xi{constructor(e){this.comparator=e,this.data=new ei(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((n,r)=>(e(n),!1))}forEachInRange(e,n){const r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){const i=r.getNext();if(this.comparator(i.key,e[1])>=0)return;n(i.key)}}forEachWhile(e,n){let r;for(r=n!==void 0?this.data.getIteratorFrom(n):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){const n=this.data.getIteratorFrom(e);return n.hasNext()?n.getNext().key:null}getIterator(){return new TQ(this.data.getIterator())}getIteratorFrom(e){return new TQ(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let n=this;return n.size<e.size&&(n=e,e=this),e.forEach(r=>{n=n.add(r)}),n}isEqual(e){if(!(e instanceof Xi)||this.size!==e.size)return!1;const n=this.data.getIterator(),r=e.data.getIterator();for(;n.hasNext();){const i=n.getNext().key,s=r.getNext().key;if(this.comparator(i,s)!==0)return!1}return!0}toArray(){const e=[];return this.forEach(n=>{e.push(n)}),e}toString(){const e=[];return this.forEach(n=>e.push(n)),"SortedSet("+e.toString()+")"}copy(e){const n=new Xi(this.comparator);return n.data=e,n}}class TQ{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class Ua{constructor(e){this.fields=e,e.sort(As.comparator)}static empty(){return new Ua([])}unionWith(e){let n=new Xi(As.comparator);for(const r of this.fields)n=n.add(r);for(const r of e)n=n.add(r);return new Ua(n.toArray())}covers(e){for(const n of this.fields)if(n.isPrefixOf(e))return!0;return!1}isEqual(e){return Ww(this.fields,e.fields,(n,r)=>n.isEqual(r))}}/**
|
||
* @license
|
||
* Copyright 2023 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class Jge extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class Ps{constructor(e){this.binaryString=e}static fromBase64String(e){const n=function(i){try{return atob(i)}catch(s){throw typeof DOMException<"u"&&s instanceof DOMException?new Jge("Invalid base64 string: "+s):s}}(e);return new Ps(n)}static fromUint8Array(e){const n=function(i){let s="";for(let o=0;o<i.length;++o)s+=String.fromCharCode(i[o]);return s}(e);return new Ps(n)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return function(n){return btoa(n)}(this.binaryString)}toUint8Array(){return function(n){const r=new Uint8Array(n.length);for(let i=0;i<n.length;i++)r[i]=n.charCodeAt(i);return r}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return Cn(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}Ps.EMPTY_BYTE_STRING=new Ps("");const Dqe=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Bm(t){if(er(!!t,39018),typeof t=="string"){let e=0;const n=Dqe.exec(t);if(er(!!n,46558,{timestamp:t}),n[1]){let i=n[1];i=(i+"000000000").substr(0,9),e=Number(i)}const r=new Date(t);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:gi(t.seconds),nanos:gi(t.nanos)}}function gi(t){return typeof t=="number"?t:typeof t=="string"?Number(t):0}function Fm(t){return typeof t=="string"?Ps.fromBase64String(t):Ps.fromUint8Array(t)}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const e1e="server_timestamp",t1e="__type__",n1e="__previous_value__",r1e="__local_write_time__";function X$(t){var n,r;return((r=(((n=t==null?void 0:t.mapValue)==null?void 0:n.fields)||{})[t1e])==null?void 0:r.stringValue)===e1e}function sI(t){const e=t.mapValue.fields[n1e];return X$(e)?sI(e):e}function BS(t){const e=Bm(t.mapValue.fields[r1e].timestampValue);return new ir(e.seconds,e.nanos)}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class Pqe{constructor(e,n,r,i,s,o,a,l,c,u,d){this.databaseId=e,this.appId=n,this.persistenceKey=r,this.host=i,this.ssl=s,this.forceLongPolling=o,this.autoDetectLongPolling=a,this.longPollingOptions=l,this.useFetchStreams=c,this.isUsingEmulator=u,this.apiKey=d}}const x7="(default)";class FS{constructor(e,n){this.projectId=e,this.database=n||x7}static empty(){return new FS("","")}get isDefaultDatabase(){return this.database===x7}isEqual(e){return e instanceof FS&&e.projectId===this.projectId&&e.database===this.database}}function Lqe(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new it(Se.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new FS(t.options.projectId,e)}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const i1e="__type__",zqe="__max__",lE={mapValue:{}},s1e="__vector__",_7="value";function Vm(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?X$(t)?4:Bqe(t)?9007199254740991:jqe(t)?10:11:Pt(28295,{value:t})}function vd(t,e){if(t===e)return!0;const n=Vm(t);if(n!==Vm(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return BS(t).isEqual(BS(e));case 3:return function(i,s){if(typeof i.timestampValue=="string"&&typeof s.timestampValue=="string"&&i.timestampValue.length===s.timestampValue.length)return i.timestampValue===s.timestampValue;const o=Bm(i.timestampValue),a=Bm(s.timestampValue);return o.seconds===a.seconds&&o.nanos===a.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(i,s){return Fm(i.bytesValue).isEqual(Fm(s.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(i,s){return gi(i.geoPointValue.latitude)===gi(s.geoPointValue.latitude)&&gi(i.geoPointValue.longitude)===gi(s.geoPointValue.longitude)}(t,e);case 2:return function(i,s){if("integerValue"in i&&"integerValue"in s)return gi(i.integerValue)===gi(s.integerValue);if("doubleValue"in i&&"doubleValue"in s){const o=gi(i.doubleValue),a=gi(s.doubleValue);return o===a?w7(o)===w7(a):isNaN(o)&&isNaN(a)}return!1}(t,e);case 9:return Ww(t.arrayValue.values||[],e.arrayValue.values||[],vd);case 10:case 11:return function(i,s){const o=i.mapValue.fields||{},a=s.mapValue.fields||{};if(EQ(o)!==EQ(a))return!1;for(const l in o)if(o.hasOwnProperty(l)&&(a[l]===void 0||!vd(o[l],a[l])))return!1;return!0}(t,e);default:return Pt(52216,{left:t})}}function VS(t,e){return(t.values||[]).find(n=>vd(n,e))!==void 0}function Gw(t,e){if(t===e)return 0;const n=Vm(t),r=Vm(e);if(n!==r)return Cn(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Cn(t.booleanValue,e.booleanValue);case 2:return function(s,o){const a=gi(s.integerValue||s.doubleValue),l=gi(o.integerValue||o.doubleValue);return a<l?-1:a>l?1:a===l?0:isNaN(a)?isNaN(l)?0:-1:1}(t,e);case 3:return AQ(t.timestampValue,e.timestampValue);case 4:return AQ(BS(t),BS(e));case 5:return LL(t.stringValue,e.stringValue);case 6:return function(s,o){const a=Fm(s),l=Fm(o);return a.compareTo(l)}(t.bytesValue,e.bytesValue);case 7:return function(s,o){const a=s.split("/"),l=o.split("/");for(let c=0;c<a.length&&c<l.length;c++){const u=Cn(a[c],l[c]);if(u!==0)return u}return Cn(a.length,l.length)}(t.referenceValue,e.referenceValue);case 8:return function(s,o){const a=Cn(gi(s.latitude),gi(o.latitude));return a!==0?a:Cn(gi(s.longitude),gi(o.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return IQ(t.arrayValue,e.arrayValue);case 10:return function(s,o){var h,f,p,g;const a=s.fields||{},l=o.fields||{},c=(h=a[_7])==null?void 0:h.arrayValue,u=(f=l[_7])==null?void 0:f.arrayValue,d=Cn(((p=c==null?void 0:c.values)==null?void 0:p.length)||0,((g=u==null?void 0:u.values)==null?void 0:g.length)||0);return d!==0?d:IQ(c,u)}(t.mapValue,e.mapValue);case 11:return function(s,o){if(s===lE.mapValue&&o===lE.mapValue)return 0;if(s===lE.mapValue)return 1;if(o===lE.mapValue)return-1;const a=s.fields||{},l=Object.keys(a),c=o.fields||{},u=Object.keys(c);l.sort(),u.sort();for(let d=0;d<l.length&&d<u.length;++d){const h=LL(l[d],u[d]);if(h!==0)return h;const f=Gw(a[l[d]],c[u[d]]);if(f!==0)return f}return Cn(l.length,u.length)}(t.mapValue,e.mapValue);default:throw Pt(23264,{he:n})}}function AQ(t,e){if(typeof t=="string"&&typeof e=="string"&&t.length===e.length)return Cn(t,e);const n=Bm(t),r=Bm(e),i=Cn(n.seconds,r.seconds);return i!==0?i:Cn(n.nanos,r.nanos)}function IQ(t,e){const n=t.values||[],r=e.values||[];for(let i=0;i<n.length&&i<r.length;++i){const s=Gw(n[i],r[i]);if(s)return s}return Cn(n.length,r.length)}function Kw(t){return zL(t)}function zL(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(n){const r=Bm(n);return`time(${r.seconds},${r.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?function(n){return Fm(n).toBase64()}(t.bytesValue):"referenceValue"in t?function(n){return At.fromName(n).toString()}(t.referenceValue):"geoPointValue"in t?function(n){return`geo(${n.latitude},${n.longitude})`}(t.geoPointValue):"arrayValue"in t?function(n){let r="[",i=!0;for(const s of n.values||[])i?i=!1:r+=",",r+=zL(s);return r+"]"}(t.arrayValue):"mapValue"in t?function(n){const r=Object.keys(n.fields||{}).sort();let i="{",s=!0;for(const o of r)s?s=!1:i+=",",i+=`${o}:${zL(n.fields[o])}`;return i+"}"}(t.mapValue):Pt(61005,{value:t})}function QT(t){switch(Vm(t)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const e=sI(t);return e?16+QT(e):16;case 5:return 2*t.stringValue.length;case 6:return Fm(t.bytesValue).approximateByteSize();case 7:return t.referenceValue.length;case 9:return function(r){return(r.values||[]).reduce((i,s)=>i+QT(s),0)}(t.arrayValue);case 10:case 11:return function(r){let i=0;return b0(r.fields,(s,o)=>{i+=s.length+QT(o)}),i}(t.mapValue);default:throw Pt(13486,{value:t})}}function RQ(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function jL(t){return!!t&&"integerValue"in t}function Q$(t){return!!t&&"arrayValue"in t}function MQ(t){return!!t&&"nullValue"in t}function NQ(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function JT(t){return!!t&&"mapValue"in t}function jqe(t){var n,r;return((r=(((n=t==null?void 0:t.mapValue)==null?void 0:n.fields)||{})[i1e])==null?void 0:r.stringValue)===s1e}function I_(t){if(t.geoPointValue)return{geoPointValue:{...t.geoPointValue}};if(t.timestampValue&&typeof t.timestampValue=="object")return{timestampValue:{...t.timestampValue}};if(t.mapValue){const e={mapValue:{fields:{}}};return b0(t.mapValue.fields,(n,r)=>e.mapValue.fields[n]=I_(r)),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=I_(t.arrayValue.values[n]);return e}return{...t}}function Bqe(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue===zqe}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class la{constructor(e){this.value=e}static empty(){return new la({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let n=this.value;for(let r=0;r<e.length-1;++r)if(n=(n.mapValue.fields||{})[e.get(r)],!JT(n))return null;return n=(n.mapValue.fields||{})[e.lastSegment()],n||null}}set(e,n){this.getFieldsMap(e.popLast())[e.lastSegment()]=I_(n)}setAll(e){let n=As.emptyPath(),r={},i=[];e.forEach((o,a)=>{if(!n.isImmediateParentOf(a)){const l=this.getFieldsMap(n);this.applyChanges(l,r,i),r={},i=[],n=a.popLast()}o?r[a.lastSegment()]=I_(o):i.push(a.lastSegment())});const s=this.getFieldsMap(n);this.applyChanges(s,r,i)}delete(e){const n=this.field(e.popLast());JT(n)&&n.mapValue.fields&&delete n.mapValue.fields[e.lastSegment()]}isEqual(e){return vd(this.value,e.value)}getFieldsMap(e){let n=this.value;n.mapValue.fields||(n.mapValue={fields:{}});for(let r=0;r<e.length;++r){let i=n.mapValue.fields[e.get(r)];JT(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},n.mapValue.fields[e.get(r)]=i),n=i}return n.mapValue.fields}applyChanges(e,n,r){b0(n,(i,s)=>e[i]=s);for(const i of r)delete e[i]}clone(){return new la(I_(this.value))}}function o1e(t){const e=[];return b0(t.fields,(n,r)=>{const i=new As([n]);if(JT(r)){const s=o1e(r.mapValue).fields;if(s.length===0)e.push(i);else for(const o of s)e.push(i.child(o))}else e.push(i)}),new Ua(e)}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class Xs{constructor(e,n,r,i,s,o,a){this.key=e,this.documentType=n,this.version=r,this.readTime=i,this.createTime=s,this.data=o,this.documentState=a}static newInvalidDocument(e){return new Xs(e,0,$t.min(),$t.min(),$t.min(),la.empty(),0)}static newFoundDocument(e,n,r,i){return new Xs(e,1,n,$t.min(),r,i,0)}static newNoDocument(e,n){return new Xs(e,2,n,$t.min(),$t.min(),la.empty(),0)}static newUnknownDocument(e,n){return new Xs(e,3,n,$t.min(),$t.min(),la.empty(),2)}convertToFoundDocument(e,n){return!this.createTime.isEqual($t.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=n,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=la.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=la.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=$t.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof Xs&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new Xs(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}/**
|
||
* @license
|
||
* Copyright 2022 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class S7{constructor(e,n){this.position=e,this.inclusive=n}}function OQ(t,e,n){let r=0;for(let i=0;i<t.position.length;i++){const s=e[i],o=t.position[i];if(s.field.isKeyField()?r=At.comparator(At.fromName(o.referenceValue),n.key):r=Gw(o,n.data.field(s.field)),s.dir==="desc"&&(r*=-1),r!==0)break}return r}function DQ(t,e){if(t===null)return e===null;if(e===null||t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!vd(t.position[n],e.position[n]))return!1;return!0}/**
|
||
* @license
|
||
* Copyright 2022 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class $S{constructor(e,n="asc"){this.field=e,this.dir=n}}function Fqe(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}/**
|
||
* @license
|
||
* Copyright 2022 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class a1e{}class Ai extends a1e{constructor(e,n,r){super(),this.field=e,this.op=n,this.value=r}static create(e,n,r){return e.isKeyField()?n==="in"||n==="not-in"?this.createKeyFieldInFilter(e,n,r):new $qe(e,n,r):n==="array-contains"?new qqe(e,r):n==="in"?new Wqe(e,r):n==="not-in"?new Gqe(e,r):n==="array-contains-any"?new Kqe(e,r):new Ai(e,n,r)}static createKeyFieldInFilter(e,n,r){return n==="in"?new Hqe(e,r):new Uqe(e,r)}matches(e){const n=e.data.field(this.field);return this.op==="!="?n!==null&&n.nullValue===void 0&&this.matchesComparison(Gw(n,this.value)):n!==null&&Vm(this.value)===Vm(n)&&this.matchesComparison(Gw(n,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return e===0;case"!=":return e!==0;case">":return e>0;case">=":return e>=0;default:return Pt(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Yc extends a1e{constructor(e,n){super(),this.filters=e,this.op=n,this.Pe=null}static create(e,n){return new Yc(e,n)}matches(e){return l1e(this)?this.filters.find(n=>!n.matches(e))===void 0:this.filters.find(n=>n.matches(e))!==void 0}getFlattenedFilters(){return this.Pe!==null||(this.Pe=this.filters.reduce((e,n)=>e.concat(n.getFlattenedFilters()),[])),this.Pe}getFilters(){return Object.assign([],this.filters)}}function l1e(t){return t.op==="and"}function c1e(t){return Vqe(t)&&l1e(t)}function Vqe(t){for(const e of t.filters)if(e instanceof Yc)return!1;return!0}function BL(t){if(t instanceof Ai)return t.field.canonicalString()+t.op.toString()+Kw(t.value);if(c1e(t))return t.filters.map(e=>BL(e)).join(",");{const e=t.filters.map(n=>BL(n)).join(",");return`${t.op}(${e})`}}function u1e(t,e){return t instanceof Ai?function(r,i){return i instanceof Ai&&r.op===i.op&&r.field.isEqual(i.field)&&vd(r.value,i.value)}(t,e):t instanceof Yc?function(r,i){return i instanceof Yc&&r.op===i.op&&r.filters.length===i.filters.length?r.filters.reduce((s,o,a)=>s&&u1e(o,i.filters[a]),!0):!1}(t,e):void Pt(19439)}function d1e(t){return t instanceof Ai?function(n){return`${n.field.canonicalString()} ${n.op} ${Kw(n.value)}`}(t):t instanceof Yc?function(n){return n.op.toString()+" {"+n.getFilters().map(d1e).join(" ,")+"}"}(t):"Filter"}class $qe extends Ai{constructor(e,n,r){super(e,n,r),this.key=At.fromName(r.referenceValue)}matches(e){const n=At.comparator(e.key,this.key);return this.matchesComparison(n)}}class Hqe extends Ai{constructor(e,n){super(e,"in",n),this.keys=h1e("in",n)}matches(e){return this.keys.some(n=>n.isEqual(e.key))}}class Uqe extends Ai{constructor(e,n){super(e,"not-in",n),this.keys=h1e("not-in",n)}matches(e){return!this.keys.some(n=>n.isEqual(e.key))}}function h1e(t,e){var n;return(((n=e.arrayValue)==null?void 0:n.values)||[]).map(r=>At.fromName(r.referenceValue))}class qqe extends Ai{constructor(e,n){super(e,"array-contains",n)}matches(e){const n=e.data.field(this.field);return Q$(n)&&VS(n.arrayValue,this.value)}}class Wqe extends Ai{constructor(e,n){super(e,"in",n)}matches(e){const n=e.data.field(this.field);return n!==null&&VS(this.value.arrayValue,n)}}class Gqe extends Ai{constructor(e,n){super(e,"not-in",n)}matches(e){if(VS(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const n=e.data.field(this.field);return n!==null&&n.nullValue===void 0&&!VS(this.value.arrayValue,n)}}class Kqe extends Ai{constructor(e,n){super(e,"array-contains-any",n)}matches(e){const n=e.data.field(this.field);return!(!Q$(n)||!n.arrayValue.values)&&n.arrayValue.values.some(r=>VS(this.value.arrayValue,r))}}/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class Yqe{constructor(e,n=null,r=[],i=[],s=null,o=null,a=null){this.path=e,this.collectionGroup=n,this.orderBy=r,this.filters=i,this.limit=s,this.startAt=o,this.endAt=a,this.Te=null}}function PQ(t,e=null,n=[],r=[],i=null,s=null,o=null){return new Yqe(t,e,n,r,i,s,o)}function J$(t){const e=Gt(t);if(e.Te===null){let n=e.path.canonicalString();e.collectionGroup!==null&&(n+="|cg:"+e.collectionGroup),n+="|f:",n+=e.filters.map(r=>BL(r)).join(","),n+="|ob:",n+=e.orderBy.map(r=>function(s){return s.field.canonicalString()+s.dir}(r)).join(","),iI(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=e.startAt.inclusive?"b:":"a:",n+=e.startAt.position.map(r=>Kw(r)).join(",")),e.endAt&&(n+="|ub:",n+=e.endAt.inclusive?"a:":"b:",n+=e.endAt.position.map(r=>Kw(r)).join(",")),e.Te=n}return e.Te}function eH(t,e){if(t.limit!==e.limit||t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n<t.orderBy.length;n++)if(!Fqe(t.orderBy[n],e.orderBy[n]))return!1;if(t.filters.length!==e.filters.length)return!1;for(let n=0;n<t.filters.length;n++)if(!u1e(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!DQ(t.startAt,e.startAt)&&DQ(t.endAt,e.endAt)}function FL(t){return At.isDocumentKey(t.path)&&t.collectionGroup===null&&t.filters.length===0}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class Qx{constructor(e,n=null,r=[],i=[],s=null,o="F",a=null,l=null){this.path=e,this.collectionGroup=n,this.explicitOrderBy=r,this.filters=i,this.limit=s,this.limitType=o,this.startAt=a,this.endAt=l,this.Ie=null,this.Ee=null,this.Re=null,this.startAt,this.endAt}}function Zqe(t,e,n,r,i,s,o,a){return new Qx(t,e,n,r,i,s,o,a)}function oI(t){return new Qx(t)}function LQ(t){return t.filters.length===0&&t.limit===null&&t.startAt==null&&t.endAt==null&&(t.explicitOrderBy.length===0||t.explicitOrderBy.length===1&&t.explicitOrderBy[0].field.isKeyField())}function Xqe(t){return At.isDocumentKey(t.path)&&t.collectionGroup===null&&t.filters.length===0}function f1e(t){return t.collectionGroup!==null}function R_(t){const e=Gt(t);if(e.Ie===null){e.Ie=[];const n=new Set;for(const s of e.explicitOrderBy)e.Ie.push(s),n.add(s.field.canonicalString());const r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(o){let a=new Xi(As.comparator);return o.filters.forEach(l=>{l.getFlattenedFilters().forEach(c=>{c.isInequality()&&(a=a.add(c.field))})}),a})(e).forEach(s=>{n.has(s.canonicalString())||s.isKeyField()||e.Ie.push(new $S(s,r))}),n.has(As.keyField().canonicalString())||e.Ie.push(new $S(As.keyField(),r))}return e.Ie}function ad(t){const e=Gt(t);return e.Ee||(e.Ee=Qqe(e,R_(t))),e.Ee}function Qqe(t,e){if(t.limitType==="F")return PQ(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map(i=>{const s=i.dir==="desc"?"asc":"desc";return new $S(i.field,s)});const n=t.endAt?new S7(t.endAt.position,t.endAt.inclusive):null,r=t.startAt?new S7(t.startAt.position,t.startAt.inclusive):null;return PQ(t.path,t.collectionGroup,e,t.filters,t.limit,n,r)}}function VL(t,e){const n=t.filters.concat([e]);return new Qx(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function Jqe(t,e){const n=t.explicitOrderBy.concat([e]);return new Qx(t.path,t.collectionGroup,n,t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}function k7(t,e,n){return new Qx(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function aI(t,e){return eH(ad(t),ad(e))&&t.limitType===e.limitType}function p1e(t){return`${J$(ad(t))}|lt:${t.limitType}`}function cv(t){return`Query(target=${function(n){let r=n.path.canonicalString();return n.collectionGroup!==null&&(r+=" collectionGroup="+n.collectionGroup),n.filters.length>0&&(r+=`, filters: [${n.filters.map(i=>d1e(i)).join(", ")}]`),iI(n.limit)||(r+=", limit: "+n.limit),n.orderBy.length>0&&(r+=`, orderBy: [${n.orderBy.map(i=>function(o){return`${o.field.canonicalString()} (${o.dir})`}(i)).join(", ")}]`),n.startAt&&(r+=", startAt: ",r+=n.startAt.inclusive?"b:":"a:",r+=n.startAt.position.map(i=>Kw(i)).join(",")),n.endAt&&(r+=", endAt: ",r+=n.endAt.inclusive?"a:":"b:",r+=n.endAt.position.map(i=>Kw(i)).join(",")),`Target(${r})`}(ad(t))}; limitType=${t.limitType})`}function lI(t,e){return e.isFoundDocument()&&function(r,i){const s=i.key.path;return r.collectionGroup!==null?i.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(s):At.isDocumentKey(r.path)?r.path.isEqual(s):r.path.isImmediateParentOf(s)}(t,e)&&function(r,i){for(const s of R_(r))if(!s.field.isKeyField()&&i.data.field(s.field)===null)return!1;return!0}(t,e)&&function(r,i){for(const s of r.filters)if(!s.matches(i))return!1;return!0}(t,e)&&function(r,i){return!(r.startAt&&!function(o,a,l){const c=OQ(o,a,l);return o.inclusive?c<=0:c<0}(r.startAt,R_(r),i)||r.endAt&&!function(o,a,l){const c=OQ(o,a,l);return o.inclusive?c>=0:c>0}(r.endAt,R_(r),i))}(t,e)}function eWe(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}function m1e(t){return(e,n)=>{let r=!1;for(const i of R_(t)){const s=tWe(i,e,n);if(s!==0)return s;r=r||i.field.isKeyField()}return 0}}function tWe(t,e,n){const r=t.field.isKeyField()?At.comparator(e.key,n.key):function(s,o,a){const l=o.data.field(s),c=a.data.field(s);return l!==null&&c!==null?Gw(l,c):Pt(42886)}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return Pt(19790,{direction:t.dir})}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class xy{constructor(e,n){this.mapKeyFn=e,this.equalsFn=n,this.inner={},this.innerSize=0}get(e){const n=this.mapKeyFn(e),r=this.inner[n];if(r!==void 0){for(const[i,s]of r)if(this.equalsFn(i,e))return s}}has(e){return this.get(e)!==void 0}set(e,n){const r=this.mapKeyFn(e),i=this.inner[r];if(i===void 0)return this.inner[r]=[[e,n]],void this.innerSize++;for(let s=0;s<i.length;s++)if(this.equalsFn(i[s][0],e))return void(i[s]=[e,n]);i.push([e,n]),this.innerSize++}delete(e){const n=this.mapKeyFn(e),r=this.inner[n];if(r===void 0)return!1;for(let i=0;i<r.length;i++)if(this.equalsFn(r[i][0],e))return r.length===1?delete this.inner[n]:r.splice(i,1),this.innerSize--,!0;return!1}forEach(e){b0(this.inner,(n,r)=>{for(const[i,s]of r)e(i,s)})}isEmpty(){return Qge(this.inner)}size(){return this.innerSize}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const nWe=new ei(At.comparator);function uf(){return nWe}const g1e=new ei(At.comparator);function _4(...t){let e=g1e;for(const n of t)e=e.insert(n.key,n);return e}function y1e(t){let e=g1e;return t.forEach((n,r)=>e=e.insert(n,r.overlayedDocument)),e}function kg(){return M_()}function v1e(){return M_()}function M_(){return new xy(t=>t.toString(),(t,e)=>t.isEqual(e))}const rWe=new ei(At.comparator),iWe=new Xi(At.comparator);function Tn(...t){let e=iWe;for(const n of t)e=e.add(n);return e}const sWe=new Xi(Cn);function oWe(){return sWe}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function tH(t,e){if(t.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:w7(e)?"-0":e}}function b1e(t){return{integerValue:""+t}}function aWe(t,e){return Mqe(e)?b1e(e):tH(t,e)}/**
|
||
* @license
|
||
* Copyright 2018 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class cI{constructor(){this._=void 0}}function lWe(t,e,n){return t instanceof HS?function(i,s){const o={fields:{[t1e]:{stringValue:e1e},[r1e]:{timestampValue:{seconds:i.seconds,nanos:i.nanoseconds}}}};return s&&X$(s)&&(s=sI(s)),s&&(o.fields[n1e]=s),{mapValue:o}}(n,e):t instanceof Yw?x1e(t,e):t instanceof Zw?_1e(t,e):function(i,s){const o=w1e(i,s),a=zQ(o)+zQ(i.Ae);return jL(o)&&jL(i.Ae)?b1e(a):tH(i.serializer,a)}(t,e)}function cWe(t,e,n){return t instanceof Yw?x1e(t,e):t instanceof Zw?_1e(t,e):n}function w1e(t,e){return t instanceof C7?function(r){return jL(r)||function(s){return!!s&&"doubleValue"in s}(r)}(e)?e:{integerValue:0}:null}class HS extends cI{}class Yw extends cI{constructor(e){super(),this.elements=e}}function x1e(t,e){const n=S1e(e);for(const r of t.elements)n.some(i=>vd(i,r))||n.push(r);return{arrayValue:{values:n}}}class Zw extends cI{constructor(e){super(),this.elements=e}}function _1e(t,e){let n=S1e(e);for(const r of t.elements)n=n.filter(i=>!vd(i,r));return{arrayValue:{values:n}}}class C7 extends cI{constructor(e,n){super(),this.serializer=e,this.Ae=n}}function zQ(t){return gi(t.integerValue||t.doubleValue)}function S1e(t){return Q$(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class nH{constructor(e,n){this.field=e,this.transform=n}}function uWe(t,e){return t.field.isEqual(e.field)&&function(r,i){return r instanceof Yw&&i instanceof Yw||r instanceof Zw&&i instanceof Zw?Ww(r.elements,i.elements,vd):r instanceof C7&&i instanceof C7?vd(r.Ae,i.Ae):r instanceof HS&&i instanceof HS}(t.transform,e.transform)}class dWe{constructor(e,n){this.version=e,this.transformResults=n}}class ld{constructor(e,n){this.updateTime=e,this.exists=n}static none(){return new ld}static exists(e){return new ld(void 0,e)}static updateTime(e){return new ld(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function e6(t,e){return t.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(t.updateTime):t.exists===void 0||t.exists===e.isFoundDocument()}let uI=class{};function k1e(t,e){if(!t.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return t.isNoDocument()?new E1e(t.key,ld.none()):new m3(t.key,t.data,ld.none());{const n=t.data,r=la.empty();let i=new Xi(As.comparator);for(let s of e.fields)if(!i.has(s)){let o=n.field(s);o===null&&s.length>1&&(s=s.popLast(),o=n.field(s)),o===null?r.delete(s):r.set(s,o),i=i.add(s)}return new w0(t.key,r,new Ua(i.toArray()),ld.none())}}function hWe(t,e,n){t instanceof m3?function(i,s,o){const a=i.value.clone(),l=BQ(i.fieldTransforms,s,o.transformResults);a.setAll(l),s.convertToFoundDocument(o.version,a).setHasCommittedMutations()}(t,e,n):t instanceof w0?function(i,s,o){if(!e6(i.precondition,s))return void s.convertToUnknownDocument(o.version);const a=BQ(i.fieldTransforms,s,o.transformResults),l=s.data;l.setAll(C1e(i)),l.setAll(a),s.convertToFoundDocument(o.version,l).setHasCommittedMutations()}(t,e,n):function(i,s,o){s.convertToNoDocument(o.version).setHasCommittedMutations()}(0,e,n)}function N_(t,e,n,r){return t instanceof m3?function(s,o,a,l){if(!e6(s.precondition,o))return a;const c=s.value.clone(),u=FQ(s.fieldTransforms,l,o);return c.setAll(u),o.convertToFoundDocument(o.version,c).setHasLocalMutations(),null}(t,e,n,r):t instanceof w0?function(s,o,a,l){if(!e6(s.precondition,o))return a;const c=FQ(s.fieldTransforms,l,o),u=o.data;return u.setAll(C1e(s)),u.setAll(c),o.convertToFoundDocument(o.version,u).setHasLocalMutations(),a===null?null:a.unionWith(s.fieldMask.fields).unionWith(s.fieldTransforms.map(d=>d.field))}(t,e,n,r):function(s,o,a){return e6(s.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):a}(t,e,n)}function fWe(t,e){let n=null;for(const r of t.fieldTransforms){const i=e.data.field(r.field),s=w1e(r.transform,i||null);s!=null&&(n===null&&(n=la.empty()),n.set(r.field,s))}return n||null}function jQ(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(r,i){return r===void 0&&i===void 0||!(!r||!i)&&Ww(r,i,(s,o)=>uWe(s,o))}(t.fieldTransforms,e.fieldTransforms)&&(t.type===0?t.value.isEqual(e.value):t.type!==1||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class m3 extends uI{constructor(e,n,r,i=[]){super(),this.key=e,this.value=n,this.precondition=r,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class w0 extends uI{constructor(e,n,r,i,s=[]){super(),this.key=e,this.data=n,this.fieldMask=r,this.precondition=i,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function C1e(t){const e=new Map;return t.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}}),e}function BQ(t,e,n){const r=new Map;er(t.length===n.length,32656,{Ve:n.length,de:t.length});for(let i=0;i<n.length;i++){const s=t[i],o=s.transform,a=e.data.field(s.field);r.set(s.field,cWe(o,a,n[i]))}return r}function FQ(t,e,n){const r=new Map;for(const i of t){const s=i.transform,o=n.data.field(i.field);r.set(i.field,lWe(s,o,e))}return r}class E1e extends uI{constructor(e,n){super(),this.key=e,this.precondition=n,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class pWe extends uI{constructor(e,n){super(),this.key=e,this.precondition=n,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class mWe{constructor(e,n,r,i){this.batchId=e,this.localWriteTime=n,this.baseMutations=r,this.mutations=i}applyToRemoteDocument(e,n){const r=n.mutationResults;for(let i=0;i<this.mutations.length;i++){const s=this.mutations[i];s.key.isEqual(e.key)&&hWe(s,e,r[i])}}applyToLocalView(e,n){for(const r of this.baseMutations)r.key.isEqual(e.key)&&(n=N_(r,e,n,this.localWriteTime));for(const r of this.mutations)r.key.isEqual(e.key)&&(n=N_(r,e,n,this.localWriteTime));return n}applyToLocalDocumentSet(e,n){const r=v1e();return this.mutations.forEach(i=>{const s=e.get(i.key),o=s.overlayedDocument;let a=this.applyToLocalView(o,s.mutatedFields);a=n.has(i.key)?null:a;const l=k1e(o,a);l!==null&&r.set(i.key,l),o.isValidDocument()||o.convertToNoDocument($t.min())}),r}keys(){return this.mutations.reduce((e,n)=>e.add(n.key),Tn())}isEqual(e){return this.batchId===e.batchId&&Ww(this.mutations,e.mutations,(n,r)=>jQ(n,r))&&Ww(this.baseMutations,e.baseMutations,(n,r)=>jQ(n,r))}}class rH{constructor(e,n,r,i){this.batch=e,this.commitVersion=n,this.mutationResults=r,this.docVersions=i}static from(e,n,r){er(e.mutations.length===r.length,58842,{me:e.mutations.length,fe:r.length});let i=function(){return rWe}();const s=e.mutations;for(let o=0;o<s.length;o++)i=i.insert(s[o].key,r[o].version);return new rH(e,n,r,i)}}/**
|
||
* @license
|
||
* Copyright 2022 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class gWe{constructor(e,n){this.largestBatchId=e,this.mutation=n}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{
|
||
largestBatchId: ${this.largestBatchId},
|
||
mutation: ${this.mutation.toString()}
|
||
}`}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class yWe{constructor(e,n){this.count=e,this.unchangedNames=n}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/var ki,On;function vWe(t){switch(t){case Se.OK:return Pt(64938);case Se.CANCELLED:case Se.UNKNOWN:case Se.DEADLINE_EXCEEDED:case Se.RESOURCE_EXHAUSTED:case Se.INTERNAL:case Se.UNAVAILABLE:case Se.UNAUTHENTICATED:return!1;case Se.INVALID_ARGUMENT:case Se.NOT_FOUND:case Se.ALREADY_EXISTS:case Se.PERMISSION_DENIED:case Se.FAILED_PRECONDITION:case Se.ABORTED:case Se.OUT_OF_RANGE:case Se.UNIMPLEMENTED:case Se.DATA_LOSS:return!0;default:return Pt(15467,{code:t})}}function T1e(t){if(t===void 0)return cf("GRPC error has no .code"),Se.UNKNOWN;switch(t){case ki.OK:return Se.OK;case ki.CANCELLED:return Se.CANCELLED;case ki.UNKNOWN:return Se.UNKNOWN;case ki.DEADLINE_EXCEEDED:return Se.DEADLINE_EXCEEDED;case ki.RESOURCE_EXHAUSTED:return Se.RESOURCE_EXHAUSTED;case ki.INTERNAL:return Se.INTERNAL;case ki.UNAVAILABLE:return Se.UNAVAILABLE;case ki.UNAUTHENTICATED:return Se.UNAUTHENTICATED;case ki.INVALID_ARGUMENT:return Se.INVALID_ARGUMENT;case ki.NOT_FOUND:return Se.NOT_FOUND;case ki.ALREADY_EXISTS:return Se.ALREADY_EXISTS;case ki.PERMISSION_DENIED:return Se.PERMISSION_DENIED;case ki.FAILED_PRECONDITION:return Se.FAILED_PRECONDITION;case ki.ABORTED:return Se.ABORTED;case ki.OUT_OF_RANGE:return Se.OUT_OF_RANGE;case ki.UNIMPLEMENTED:return Se.UNIMPLEMENTED;case ki.DATA_LOSS:return Se.DATA_LOSS;default:return Pt(39323,{code:t})}}(On=ki||(ki={}))[On.OK=0]="OK",On[On.CANCELLED=1]="CANCELLED",On[On.UNKNOWN=2]="UNKNOWN",On[On.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",On[On.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",On[On.NOT_FOUND=5]="NOT_FOUND",On[On.ALREADY_EXISTS=6]="ALREADY_EXISTS",On[On.PERMISSION_DENIED=7]="PERMISSION_DENIED",On[On.UNAUTHENTICATED=16]="UNAUTHENTICATED",On[On.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",On[On.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",On[On.ABORTED=10]="ABORTED",On[On.OUT_OF_RANGE=11]="OUT_OF_RANGE",On[On.UNIMPLEMENTED=12]="UNIMPLEMENTED",On[On.INTERNAL=13]="INTERNAL",On[On.UNAVAILABLE=14]="UNAVAILABLE",On[On.DATA_LOSS=15]="DATA_LOSS";/**
|
||
* @license
|
||
* Copyright 2023 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function bWe(){return new TextEncoder}/**
|
||
* @license
|
||
* Copyright 2022 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const wWe=new wm([4294967295,4294967295],0);function VQ(t){const e=bWe().encode(t),n=new Vge;return n.update(e),new Uint8Array(n.digest())}function $Q(t){const e=new DataView(t.buffer),n=e.getUint32(0,!0),r=e.getUint32(4,!0),i=e.getUint32(8,!0),s=e.getUint32(12,!0);return[new wm([n,r],0),new wm([i,s],0)]}class iH{constructor(e,n,r){if(this.bitmap=e,this.padding=n,this.hashCount=r,n<0||n>=8)throw new S4(`Invalid padding: ${n}`);if(r<0)throw new S4(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new S4(`Invalid hash count: ${r}`);if(e.length===0&&n!==0)throw new S4(`Invalid padding when bitmap length is 0: ${n}`);this.ge=8*e.length-n,this.pe=wm.fromNumber(this.ge)}ye(e,n,r){let i=e.add(n.multiply(wm.fromNumber(r)));return i.compare(wWe)===1&&(i=new wm([i.getBits(0),i.getBits(1)],0)),i.modulo(this.pe).toNumber()}we(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(this.ge===0)return!1;const n=VQ(e),[r,i]=$Q(n);for(let s=0;s<this.hashCount;s++){const o=this.ye(r,i,s);if(!this.we(o))return!1}return!0}static create(e,n,r){const i=e%8==0?0:8-e%8,s=new Uint8Array(Math.ceil(e/8)),o=new iH(s,i,n);return r.forEach(a=>o.insert(a)),o}insert(e){if(this.ge===0)return;const n=VQ(e),[r,i]=$Q(n);for(let s=0;s<this.hashCount;s++){const o=this.ye(r,i,s);this.be(o)}}be(e){const n=Math.floor(e/8),r=e%8;this.bitmap[n]|=1<<r}}class S4 extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class dI{constructor(e,n,r,i,s){this.snapshotVersion=e,this.targetChanges=n,this.targetMismatches=r,this.documentUpdates=i,this.resolvedLimboDocuments=s}static createSynthesizedRemoteEventForCurrentChange(e,n,r){const i=new Map;return i.set(e,g3.createSynthesizedTargetChangeForCurrentChange(e,n,r)),new dI($t.min(),i,new ei(Cn),uf(),Tn())}}class g3{constructor(e,n,r,i,s){this.resumeToken=e,this.current=n,this.addedDocuments=r,this.modifiedDocuments=i,this.removedDocuments=s}static createSynthesizedTargetChangeForCurrentChange(e,n,r){return new g3(r,n,Tn(),Tn(),Tn())}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class t6{constructor(e,n,r,i){this.Se=e,this.removedTargetIds=n,this.key=r,this.De=i}}class A1e{constructor(e,n){this.targetId=e,this.Ce=n}}class I1e{constructor(e,n,r=Ps.EMPTY_BYTE_STRING,i=null){this.state=e,this.targetIds=n,this.resumeToken=r,this.cause=i}}class HQ{constructor(){this.ve=0,this.Fe=UQ(),this.Me=Ps.EMPTY_BYTE_STRING,this.xe=!1,this.Oe=!0}get current(){return this.xe}get resumeToken(){return this.Me}get Ne(){return this.ve!==0}get Be(){return this.Oe}Le(e){e.approximateByteSize()>0&&(this.Oe=!0,this.Me=e)}ke(){let e=Tn(),n=Tn(),r=Tn();return this.Fe.forEach((i,s)=>{switch(s){case 0:e=e.add(i);break;case 2:n=n.add(i);break;case 1:r=r.add(i);break;default:Pt(38017,{changeType:s})}}),new g3(this.Me,this.xe,e,n,r)}Ke(){this.Oe=!1,this.Fe=UQ()}qe(e,n){this.Oe=!0,this.Fe=this.Fe.insert(e,n)}Ue(e){this.Oe=!0,this.Fe=this.Fe.remove(e)}$e(){this.ve+=1}We(){this.ve-=1,er(this.ve>=0,3241,{ve:this.ve})}Qe(){this.Oe=!0,this.xe=!0}}class xWe{constructor(e){this.Ge=e,this.ze=new Map,this.je=uf(),this.He=cE(),this.Je=cE(),this.Ze=new ei(Cn)}Xe(e){for(const n of e.Se)e.De&&e.De.isFoundDocument()?this.Ye(n,e.De):this.et(n,e.key,e.De);for(const n of e.removedTargetIds)this.et(n,e.key,e.De)}tt(e){this.forEachTarget(e,n=>{const r=this.nt(n);switch(e.state){case 0:this.rt(n)&&r.Le(e.resumeToken);break;case 1:r.We(),r.Ne||r.Ke(),r.Le(e.resumeToken);break;case 2:r.We(),r.Ne||this.removeTarget(n);break;case 3:this.rt(n)&&(r.Qe(),r.Le(e.resumeToken));break;case 4:this.rt(n)&&(this.it(n),r.Le(e.resumeToken));break;default:Pt(56790,{state:e.state})}})}forEachTarget(e,n){e.targetIds.length>0?e.targetIds.forEach(n):this.ze.forEach((r,i)=>{this.rt(i)&&n(i)})}st(e){const n=e.targetId,r=e.Ce.count,i=this.ot(n);if(i){const s=i.target;if(FL(s))if(r===0){const o=new At(s.path);this.et(n,o,Xs.newNoDocument(o,$t.min()))}else er(r===1,20013,{expectedCount:r});else{const o=this._t(n);if(o!==r){const a=this.ut(e),l=a?this.ct(a,e,o):1;if(l!==0){this.it(n);const c=l===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ze=this.Ze.insert(n,c)}}}}}ut(e){const n=e.Ce.unchangedNames;if(!n||!n.bits)return null;const{bits:{bitmap:r="",padding:i=0},hashCount:s=0}=n;let o,a;try{o=Fm(r).toUint8Array()}catch(l){if(l instanceof Jge)return $1("Decoding the base64 bloom filter in existence filter failed ("+l.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw l}try{a=new iH(o,i,s)}catch(l){return $1(l instanceof S4?"BloomFilter error: ":"Applying bloom filter failed: ",l),null}return a.ge===0?null:a}ct(e,n,r){return n.Ce.count===r-this.Pt(e,n.targetId)?0:2}Pt(e,n){const r=this.Ge.getRemoteKeysForTarget(n);let i=0;return r.forEach(s=>{const o=this.Ge.ht(),a=`projects/${o.projectId}/databases/${o.database}/documents/${s.path.canonicalString()}`;e.mightContain(a)||(this.et(n,s,null),i++)}),i}Tt(e){const n=new Map;this.ze.forEach((s,o)=>{const a=this.ot(o);if(a){if(s.current&&FL(a.target)){const l=new At(a.target.path);this.It(l).has(o)||this.Et(o,l)||this.et(o,l,Xs.newNoDocument(l,e))}s.Be&&(n.set(o,s.ke()),s.Ke())}});let r=Tn();this.Je.forEach((s,o)=>{let a=!0;o.forEachWhile(l=>{const c=this.ot(l);return!c||c.purpose==="TargetPurposeLimboResolution"||(a=!1,!1)}),a&&(r=r.add(s))}),this.je.forEach((s,o)=>o.setReadTime(e));const i=new dI(e,n,this.Ze,this.je,r);return this.je=uf(),this.He=cE(),this.Je=cE(),this.Ze=new ei(Cn),i}Ye(e,n){if(!this.rt(e))return;const r=this.Et(e,n.key)?2:0;this.nt(e).qe(n.key,r),this.je=this.je.insert(n.key,n),this.He=this.He.insert(n.key,this.It(n.key).add(e)),this.Je=this.Je.insert(n.key,this.Rt(n.key).add(e))}et(e,n,r){if(!this.rt(e))return;const i=this.nt(e);this.Et(e,n)?i.qe(n,1):i.Ue(n),this.Je=this.Je.insert(n,this.Rt(n).delete(e)),this.Je=this.Je.insert(n,this.Rt(n).add(e)),r&&(this.je=this.je.insert(n,r))}removeTarget(e){this.ze.delete(e)}_t(e){const n=this.nt(e).ke();return this.Ge.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size}$e(e){this.nt(e).$e()}nt(e){let n=this.ze.get(e);return n||(n=new HQ,this.ze.set(e,n)),n}Rt(e){let n=this.Je.get(e);return n||(n=new Xi(Cn),this.Je=this.Je.insert(e,n)),n}It(e){let n=this.He.get(e);return n||(n=new Xi(Cn),this.He=this.He.insert(e,n)),n}rt(e){const n=this.ot(e)!==null;return n||dt("WatchChangeAggregator","Detected inactive target",e),n}ot(e){const n=this.ze.get(e);return n&&n.Ne?null:this.Ge.At(e)}it(e){this.ze.set(e,new HQ),this.Ge.getRemoteKeysForTarget(e).forEach(n=>{this.et(e,n,null)})}Et(e,n){return this.Ge.getRemoteKeysForTarget(e).has(n)}}function cE(){return new ei(At.comparator)}function UQ(){return new ei(At.comparator)}const _We={asc:"ASCENDING",desc:"DESCENDING"},SWe={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},kWe={and:"AND",or:"OR"};class CWe{constructor(e,n){this.databaseId=e,this.useProto3Json=n}}function $L(t,e){return t.useProto3Json||iI(e)?e:{value:e}}function E7(t,e){return t.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function R1e(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function EWe(t,e){return E7(t,e.toTimestamp())}function cd(t){return er(!!t,49232),$t.fromTimestamp(function(n){const r=Bm(n);return new ir(r.seconds,r.nanos)}(t))}function sH(t,e){return HL(t,e).canonicalString()}function HL(t,e){const n=function(i){return new Ar(["projects",i.projectId,"databases",i.database])}(t).child("documents");return e===void 0?n:n.child(e)}function M1e(t){const e=Ar.fromString(t);return er(L1e(e),10190,{key:e.toString()}),e}function UL(t,e){return sH(t.databaseId,e.path)}function IN(t,e){const n=M1e(e);if(n.get(1)!==t.databaseId.projectId)throw new it(Se.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new it(Se.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new At(O1e(n))}function N1e(t,e){return sH(t.databaseId,e)}function TWe(t){const e=M1e(t);return e.length===4?Ar.emptyPath():O1e(e)}function qL(t){return new Ar(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function O1e(t){return er(t.length>4&&t.get(4)==="documents",29091,{key:t.toString()}),t.popFirst(5)}function qQ(t,e,n){return{name:UL(t,e),fields:n.value.mapValue.fields}}function AWe(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(c){return c==="NO_CHANGE"?0:c==="ADD"?1:c==="REMOVE"?2:c==="CURRENT"?3:c==="RESET"?4:Pt(39313,{state:c})}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],s=function(c,u){return c.useProto3Json?(er(u===void 0||typeof u=="string",58123),Ps.fromBase64String(u||"")):(er(u===void 0||u instanceof Buffer||u instanceof Uint8Array,16193),Ps.fromUint8Array(u||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(c){const u=c.code===void 0?Se.UNKNOWN:T1e(c.code);return new it(u,c.message||"")}(o);n=new I1e(r,i,s,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const i=IN(t,r.document.name),s=cd(r.document.updateTime),o=r.document.createTime?cd(r.document.createTime):$t.min(),a=new la({mapValue:{fields:r.document.fields}}),l=Xs.newFoundDocument(i,s,o,a),c=r.targetIds||[],u=r.removedTargetIds||[];n=new t6(c,u,l.key,l)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const i=IN(t,r.document),s=r.readTime?cd(r.readTime):$t.min(),o=Xs.newNoDocument(i,s),a=r.removedTargetIds||[];n=new t6([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const i=IN(t,r.document),s=r.removedTargetIds||[];n=new t6([],s,i,null)}else{if(!("filter"in e))return Pt(11601,{Vt:e});{e.filter;const r=e.filter;r.targetId;const{count:i=0,unchangedNames:s}=r,o=new yWe(i,s),a=r.targetId;n=new A1e(a,o)}}return n}function IWe(t,e){let n;if(e instanceof m3)n={update:qQ(t,e.key,e.value)};else if(e instanceof E1e)n={delete:UL(t,e.key)};else if(e instanceof w0)n={update:qQ(t,e.key,e.data),updateMask:jWe(e.fieldMask)};else{if(!(e instanceof pWe))return Pt(16599,{dt:e.type});n={verify:UL(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(r=>function(s,o){const a=o.transform;if(a instanceof HS)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof Yw)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof Zw)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof C7)return{fieldPath:o.field.canonicalString(),increment:a.Ae};throw Pt(20930,{transform:o.transform})}(0,r))),e.precondition.isNone||(n.currentDocument=function(i,s){return s.updateTime!==void 0?{updateTime:EWe(i,s.updateTime)}:s.exists!==void 0?{exists:s.exists}:Pt(27497)}(t,e.precondition)),n}function RWe(t,e){return t&&t.length>0?(er(e!==void 0,14353),t.map(n=>function(i,s){let o=i.updateTime?cd(i.updateTime):cd(s);return o.isEqual($t.min())&&(o=cd(s)),new dWe(o,i.transformResults||[])}(n,e))):[]}function MWe(t,e){return{documents:[N1e(t,e.path)]}}function NWe(t,e){const n={structuredQuery:{}},r=e.path;let i;e.collectionGroup!==null?(i=r,n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(i=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=N1e(t,i);const s=function(c){if(c.length!==0)return P1e(Yc.create(c,"and"))}(e.filters);s&&(n.structuredQuery.where=s);const o=function(c){if(c.length!==0)return c.map(u=>function(h){return{field:uv(h.field),direction:PWe(h.dir)}}(u))}(e.orderBy);o&&(n.structuredQuery.orderBy=o);const a=$L(t,e.limit);return a!==null&&(n.structuredQuery.limit=a),e.startAt&&(n.structuredQuery.startAt=function(c){return{before:c.inclusive,values:c.position}}(e.startAt)),e.endAt&&(n.structuredQuery.endAt=function(c){return{before:!c.inclusive,values:c.position}}(e.endAt)),{ft:n,parent:i}}function OWe(t){let e=TWe(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let i=null;if(r>0){er(r===1,65062);const u=n.from[0];u.allDescendants?i=u.collectionId:e=e.child(u.collectionId)}let s=[];n.where&&(s=function(d){const h=D1e(d);return h instanceof Yc&&c1e(h)?h.getFilters():[h]}(n.where));let o=[];n.orderBy&&(o=function(d){return d.map(h=>function(p){return new $S(dv(p.field),function(y){switch(y){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(p.direction))}(h))}(n.orderBy));let a=null;n.limit&&(a=function(d){let h;return h=typeof d=="object"?d.value:d,iI(h)?null:h}(n.limit));let l=null;n.startAt&&(l=function(d){const h=!!d.before,f=d.values||[];return new S7(f,h)}(n.startAt));let c=null;return n.endAt&&(c=function(d){const h=!d.before,f=d.values||[];return new S7(f,h)}(n.endAt)),Zqe(e,i,o,s,a,"F",l,c)}function DWe(t,e){const n=function(i){switch(i){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return Pt(28987,{purpose:i})}}(e.purpose);return n==null?null:{"goog-listen-tags":n}}function D1e(t){return t.unaryFilter!==void 0?function(n){switch(n.unaryFilter.op){case"IS_NAN":const r=dv(n.unaryFilter.field);return Ai.create(r,"==",{doubleValue:NaN});case"IS_NULL":const i=dv(n.unaryFilter.field);return Ai.create(i,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=dv(n.unaryFilter.field);return Ai.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=dv(n.unaryFilter.field);return Ai.create(o,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return Pt(61313);default:return Pt(60726)}}(t):t.fieldFilter!==void 0?function(n){return Ai.create(dv(n.fieldFilter.field),function(i){switch(i){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return Pt(58110);default:return Pt(50506)}}(n.fieldFilter.op),n.fieldFilter.value)}(t):t.compositeFilter!==void 0?function(n){return Yc.create(n.compositeFilter.filters.map(r=>D1e(r)),function(i){switch(i){case"AND":return"and";case"OR":return"or";default:return Pt(1026)}}(n.compositeFilter.op))}(t):Pt(30097,{filter:t})}function PWe(t){return _We[t]}function LWe(t){return SWe[t]}function zWe(t){return kWe[t]}function uv(t){return{fieldPath:t.canonicalString()}}function dv(t){return As.fromServerFormat(t.fieldPath)}function P1e(t){return t instanceof Ai?function(n){if(n.op==="=="){if(NQ(n.value))return{unaryFilter:{field:uv(n.field),op:"IS_NAN"}};if(MQ(n.value))return{unaryFilter:{field:uv(n.field),op:"IS_NULL"}}}else if(n.op==="!="){if(NQ(n.value))return{unaryFilter:{field:uv(n.field),op:"IS_NOT_NAN"}};if(MQ(n.value))return{unaryFilter:{field:uv(n.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:uv(n.field),op:LWe(n.op),value:n.value}}}(t):t instanceof Yc?function(n){const r=n.getFilters().map(i=>P1e(i));return r.length===1?r[0]:{compositeFilter:{op:zWe(n.op),filters:r}}}(t):Pt(54877,{filter:t})}function jWe(t){const e=[];return t.fields.forEach(n=>e.push(n.canonicalString())),{fieldPaths:e}}function L1e(t){return t.length>=4&&t.get(0)==="projects"&&t.get(2)==="databases"}function z1e(t){return!!t&&typeof t._toProto=="function"&&t._protoValueType==="ProtoValue"}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class Jp{constructor(e,n,r,i,s=$t.min(),o=$t.min(),a=Ps.EMPTY_BYTE_STRING,l=null){this.target=e,this.targetId=n,this.purpose=r,this.sequenceNumber=i,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=a,this.expectedCount=l}withSequenceNumber(e){return new Jp(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,n){return new Jp(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new Jp(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new Jp(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class BWe{constructor(e){this.yt=e}}function FWe(t){const e=OWe({parent:t.parent,structuredQuery:t.structuredQuery});return t.limitType==="LAST"?k7(e,e.limit,"L"):e}/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class VWe{constructor(){this.Sn=new $We}addToCollectionParentIndex(e,n){return this.Sn.add(n),Ae.resolve()}getCollectionParents(e,n){return Ae.resolve(this.Sn.getEntries(n))}addFieldIndex(e,n){return Ae.resolve()}deleteFieldIndex(e,n){return Ae.resolve()}deleteAllFieldIndexes(e){return Ae.resolve()}createTargetIndexes(e,n){return Ae.resolve()}getDocumentsMatchingTarget(e,n){return Ae.resolve(null)}getIndexType(e,n){return Ae.resolve(0)}getFieldIndexes(e,n){return Ae.resolve([])}getNextCollectionGroupToUpdate(e){return Ae.resolve(null)}getMinOffset(e,n){return Ae.resolve(jm.min())}getMinOffsetFromCollectionGroup(e,n){return Ae.resolve(jm.min())}updateCollectionGroup(e,n,r){return Ae.resolve()}updateIndexEntries(e,n){return Ae.resolve()}}class $We{constructor(){this.index={}}add(e){const n=e.lastSegment(),r=e.popLast(),i=this.index[n]||new Xi(Ar.comparator),s=!i.has(r);return this.index[n]=i.add(r),s}has(e){const n=e.lastSegment(),r=e.popLast(),i=this.index[n];return i&&i.has(r)}getEntries(e){return(this.index[e]||new Xi(Ar.comparator)).toArray()}}/**
|
||
* @license
|
||
* Copyright 2018 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const WQ={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},j1e=41943040;class ia{static withCacheSize(e){return new ia(e,ia.DEFAULT_COLLECTION_PERCENTILE,ia.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,n,r){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=n,this.maximumSequenceNumbersToCollect=r}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/ia.DEFAULT_COLLECTION_PERCENTILE=10,ia.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,ia.DEFAULT=new ia(j1e,ia.DEFAULT_COLLECTION_PERCENTILE,ia.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),ia.DISABLED=new ia(-1,0,0);/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class Xw{constructor(e){this.sr=e}next(){return this.sr+=2,this.sr}static _r(){return new Xw(0)}static ar(){return new Xw(-1)}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const GQ="LruGarbageCollector",HWe=1048576;function KQ([t,e],[n,r]){const i=Cn(t,n);return i===0?Cn(e,r):i}class UWe{constructor(e){this.Pr=e,this.buffer=new Xi(KQ),this.Tr=0}Ir(){return++this.Tr}Er(e){const n=[e,this.Ir()];if(this.buffer.size<this.Pr)this.buffer=this.buffer.add(n);else{const r=this.buffer.last();KQ(n,r)<0&&(this.buffer=this.buffer.delete(r).add(n))}}get maxValue(){return this.buffer.last()[0]}}class qWe{constructor(e,n,r){this.garbageCollector=e,this.asyncQueue=n,this.localStore=r,this.Rr=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.Ar(6e4)}stop(){this.Rr&&(this.Rr.cancel(),this.Rr=null)}get started(){return this.Rr!==null}Ar(e){dt(GQ,`Garbage collection scheduled in ${e}ms`),this.Rr=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,async()=>{this.Rr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(n){Xx(n)?dt(GQ,"Ignoring IndexedDB error during garbage collection: ",n):await Zx(n)}await this.Ar(3e5)})}}class WWe{constructor(e,n){this.Vr=e,this.params=n}calculateTargetCount(e,n){return this.Vr.dr(e).next(r=>Math.floor(n/100*r))}nthSequenceNumber(e,n){if(n===0)return Ae.resolve(rI.ce);const r=new UWe(n);return this.Vr.forEachTarget(e,i=>r.Er(i.sequenceNumber)).next(()=>this.Vr.mr(e,i=>r.Er(i))).next(()=>r.maxValue)}removeTargets(e,n,r){return this.Vr.removeTargets(e,n,r)}removeOrphanedDocuments(e,n){return this.Vr.removeOrphanedDocuments(e,n)}collect(e,n){return this.params.cacheSizeCollectionThreshold===-1?(dt("LruGarbageCollector","Garbage collection skipped; disabled"),Ae.resolve(WQ)):this.getCacheSize(e).next(r=>r<this.params.cacheSizeCollectionThreshold?(dt("LruGarbageCollector",`Garbage collection skipped; Cache size ${r} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),WQ):this.gr(e,n))}getCacheSize(e){return this.Vr.getCacheSize(e)}gr(e,n){let r,i,s,o,a,l,c;const u=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(d=>(d>this.params.maximumSequenceNumbersToCollect?(dt("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${d}`),i=this.params.maximumSequenceNumbersToCollect):i=d,o=Date.now(),this.nthSequenceNumber(e,i))).next(d=>(r=d,a=Date.now(),this.removeTargets(e,r,n))).next(d=>(s=d,l=Date.now(),this.removeOrphanedDocuments(e,r))).next(d=>(c=Date.now(),lv()<=kn.DEBUG&&dt("LruGarbageCollector",`LRU Garbage Collection
|
||
Counted targets in ${o-u}ms
|
||
Determined least recently used ${i} in `+(a-o)+`ms
|
||
Removed ${s} targets in `+(l-a)+`ms
|
||
Removed ${d} documents in `+(c-l)+`ms
|
||
Total Duration: ${c-u}ms`),Ae.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:s,documentsRemoved:d})))}}function GWe(t,e){return new WWe(t,e)}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class KWe{constructor(){this.changes=new xy(e=>e.toString(),(e,n)=>e.isEqual(n)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,n){this.assertNotApplied(),this.changes.set(e,Xs.newInvalidDocument(e).setReadTime(n))}getEntry(e,n){this.assertNotApplied();const r=this.changes.get(n);return r!==void 0?Ae.resolve(r):this.getFromCache(e,n)}getEntries(e,n){return this.getAllFromCache(e,n)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*//**
|
||
* @license
|
||
* Copyright 2022 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class YWe{constructor(e,n){this.overlayedDocument=e,this.mutatedFields=n}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class ZWe{constructor(e,n,r,i){this.remoteDocumentCache=e,this.mutationQueue=n,this.documentOverlayCache=r,this.indexManager=i}getDocument(e,n){let r=null;return this.documentOverlayCache.getOverlay(e,n).next(i=>(r=i,this.remoteDocumentCache.getEntry(e,n))).next(i=>(r!==null&&N_(r.mutation,i,Ua.empty(),ir.now()),i))}getDocuments(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.getLocalViewOfDocuments(e,r,Tn()).next(()=>r))}getLocalViewOfDocuments(e,n,r=Tn()){const i=kg();return this.populateOverlays(e,i,n).next(()=>this.computeViews(e,n,i,r).next(s=>{let o=_4();return s.forEach((a,l)=>{o=o.insert(a,l.overlayedDocument)}),o}))}getOverlayedDocuments(e,n){const r=kg();return this.populateOverlays(e,r,n).next(()=>this.computeViews(e,n,r,Tn()))}populateOverlays(e,n,r){const i=[];return r.forEach(s=>{n.has(s)||i.push(s)}),this.documentOverlayCache.getOverlays(e,i).next(s=>{s.forEach((o,a)=>{n.set(o,a)})})}computeViews(e,n,r,i){let s=uf();const o=M_(),a=function(){return M_()}();return n.forEach((l,c)=>{const u=r.get(c.key);i.has(c.key)&&(u===void 0||u.mutation instanceof w0)?s=s.insert(c.key,c):u!==void 0?(o.set(c.key,u.mutation.getFieldMask()),N_(u.mutation,c,u.mutation.getFieldMask(),ir.now())):o.set(c.key,Ua.empty())}),this.recalculateAndSaveOverlays(e,s).next(l=>(l.forEach((c,u)=>o.set(c,u)),n.forEach((c,u)=>a.set(c,new YWe(u,o.get(c)??null))),a))}recalculateAndSaveOverlays(e,n){const r=M_();let i=new ei((o,a)=>o-a),s=Tn();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,n).next(o=>{for(const a of o)a.keys().forEach(l=>{const c=n.get(l);if(c===null)return;let u=r.get(l)||Ua.empty();u=a.applyToLocalView(c,u),r.set(l,u);const d=(i.get(a.batchId)||Tn()).add(l);i=i.insert(a.batchId,d)})}).next(()=>{const o=[],a=i.getReverseIterator();for(;a.hasNext();){const l=a.getNext(),c=l.key,u=l.value,d=v1e();u.forEach(h=>{if(!s.has(h)){const f=k1e(n.get(h),r.get(h));f!==null&&d.set(h,f),s=s.add(h)}}),o.push(this.documentOverlayCache.saveOverlays(e,c,d))}return Ae.waitFor(o)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,n,r,i){return Xqe(n)?this.getDocumentsMatchingDocumentQuery(e,n.path):f1e(n)?this.getDocumentsMatchingCollectionGroupQuery(e,n,r,i):this.getDocumentsMatchingCollectionQuery(e,n,r,i)}getNextDocuments(e,n,r,i){return this.remoteDocumentCache.getAllFromCollectionGroup(e,n,r,i).next(s=>{const o=i-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,n,r.largestBatchId,i-s.size):Ae.resolve(kg());let a=jS,l=s;return o.next(c=>Ae.forEach(c,(u,d)=>(a<d.largestBatchId&&(a=d.largestBatchId),s.get(u)?Ae.resolve():this.remoteDocumentCache.getEntry(e,u).next(h=>{l=l.insert(u,h)}))).next(()=>this.populateOverlays(e,c,s)).next(()=>this.computeViews(e,l,c,Tn())).next(u=>({batchId:a,changes:y1e(u)})))})}getDocumentsMatchingDocumentQuery(e,n){return this.getDocument(e,new At(n)).next(r=>{let i=_4();return r.isFoundDocument()&&(i=i.insert(r.key,r)),i})}getDocumentsMatchingCollectionGroupQuery(e,n,r,i){const s=n.collectionGroup;let o=_4();return this.indexManager.getCollectionParents(e,s).next(a=>Ae.forEach(a,l=>{const c=function(d,h){return new Qx(h,null,d.explicitOrderBy.slice(),d.filters.slice(),d.limit,d.limitType,d.startAt,d.endAt)}(n,l.child(s));return this.getDocumentsMatchingCollectionQuery(e,c,r,i).next(u=>{u.forEach((d,h)=>{o=o.insert(d,h)})})}).next(()=>o))}getDocumentsMatchingCollectionQuery(e,n,r,i){let s;return this.documentOverlayCache.getOverlaysForCollection(e,n.path,r.largestBatchId).next(o=>(s=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,n,r,s,i))).next(o=>{s.forEach((l,c)=>{const u=c.getKey();o.get(u)===null&&(o=o.insert(u,Xs.newInvalidDocument(u)))});let a=_4();return o.forEach((l,c)=>{const u=s.get(l);u!==void 0&&N_(u.mutation,c,Ua.empty(),ir.now()),lI(n,c)&&(a=a.insert(l,c))}),a})}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class XWe{constructor(e){this.serializer=e,this.Nr=new Map,this.Br=new Map}getBundleMetadata(e,n){return Ae.resolve(this.Nr.get(n))}saveBundleMetadata(e,n){return this.Nr.set(n.id,function(i){return{id:i.id,version:i.version,createTime:cd(i.createTime)}}(n)),Ae.resolve()}getNamedQuery(e,n){return Ae.resolve(this.Br.get(n))}saveNamedQuery(e,n){return this.Br.set(n.name,function(i){return{name:i.name,query:FWe(i.bundledQuery),readTime:cd(i.readTime)}}(n)),Ae.resolve()}}/**
|
||
* @license
|
||
* Copyright 2022 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class QWe{constructor(){this.overlays=new ei(At.comparator),this.Lr=new Map}getOverlay(e,n){return Ae.resolve(this.overlays.get(n))}getOverlays(e,n){const r=kg();return Ae.forEach(n,i=>this.getOverlay(e,i).next(s=>{s!==null&&r.set(i,s)})).next(()=>r)}saveOverlays(e,n,r){return r.forEach((i,s)=>{this.bt(e,n,s)}),Ae.resolve()}removeOverlaysForBatchId(e,n,r){const i=this.Lr.get(r);return i!==void 0&&(i.forEach(s=>this.overlays=this.overlays.remove(s)),this.Lr.delete(r)),Ae.resolve()}getOverlaysForCollection(e,n,r){const i=kg(),s=n.length+1,o=new At(n.child("")),a=this.overlays.getIteratorFrom(o);for(;a.hasNext();){const l=a.getNext().value,c=l.getKey();if(!n.isPrefixOf(c.path))break;c.path.length===s&&l.largestBatchId>r&&i.set(l.getKey(),l)}return Ae.resolve(i)}getOverlaysForCollectionGroup(e,n,r,i){let s=new ei((c,u)=>c-u);const o=this.overlays.getIterator();for(;o.hasNext();){const c=o.getNext().value;if(c.getKey().getCollectionGroup()===n&&c.largestBatchId>r){let u=s.get(c.largestBatchId);u===null&&(u=kg(),s=s.insert(c.largestBatchId,u)),u.set(c.getKey(),c)}}const a=kg(),l=s.getIterator();for(;l.hasNext()&&(l.getNext().value.forEach((c,u)=>a.set(c,u)),!(a.size()>=i)););return Ae.resolve(a)}bt(e,n,r){const i=this.overlays.get(r.key);if(i!==null){const o=this.Lr.get(i.largestBatchId).delete(r.key);this.Lr.set(i.largestBatchId,o)}this.overlays=this.overlays.insert(r.key,new gWe(n,r));let s=this.Lr.get(n);s===void 0&&(s=Tn(),this.Lr.set(n,s)),this.Lr.set(n,s.add(r.key))}}/**
|
||
* @license
|
||
* Copyright 2024 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class JWe{constructor(){this.sessionToken=Ps.EMPTY_BYTE_STRING}getSessionToken(e){return Ae.resolve(this.sessionToken)}setSessionToken(e,n){return this.sessionToken=n,Ae.resolve()}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class oH{constructor(){this.kr=new Xi(ls.Kr),this.qr=new Xi(ls.Ur)}isEmpty(){return this.kr.isEmpty()}addReference(e,n){const r=new ls(e,n);this.kr=this.kr.add(r),this.qr=this.qr.add(r)}$r(e,n){e.forEach(r=>this.addReference(r,n))}removeReference(e,n){this.Wr(new ls(e,n))}Qr(e,n){e.forEach(r=>this.removeReference(r,n))}Gr(e){const n=new At(new Ar([])),r=new ls(n,e),i=new ls(n,e+1),s=[];return this.qr.forEachInRange([r,i],o=>{this.Wr(o),s.push(o.key)}),s}zr(){this.kr.forEach(e=>this.Wr(e))}Wr(e){this.kr=this.kr.delete(e),this.qr=this.qr.delete(e)}jr(e){const n=new At(new Ar([])),r=new ls(n,e),i=new ls(n,e+1);let s=Tn();return this.qr.forEachInRange([r,i],o=>{s=s.add(o.key)}),s}containsKey(e){const n=new ls(e,0),r=this.kr.firstAfterOrEqual(n);return r!==null&&e.isEqual(r.key)}}class ls{constructor(e,n){this.key=e,this.Hr=n}static Kr(e,n){return At.comparator(e.key,n.key)||Cn(e.Hr,n.Hr)}static Ur(e,n){return Cn(e.Hr,n.Hr)||At.comparator(e.key,n.key)}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class eGe{constructor(e,n){this.indexManager=e,this.referenceDelegate=n,this.mutationQueue=[],this.Yn=1,this.Jr=new Xi(ls.Kr)}checkEmpty(e){return Ae.resolve(this.mutationQueue.length===0)}addMutationBatch(e,n,r,i){const s=this.Yn;this.Yn++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new mWe(s,n,r,i);this.mutationQueue.push(o);for(const a of i)this.Jr=this.Jr.add(new ls(a.key,s)),this.indexManager.addToCollectionParentIndex(e,a.key.path.popLast());return Ae.resolve(o)}lookupMutationBatch(e,n){return Ae.resolve(this.Zr(n))}getNextMutationBatchAfterBatchId(e,n){const r=n+1,i=this.Xr(r),s=i<0?0:i;return Ae.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return Ae.resolve(this.mutationQueue.length===0?Z$:this.Yn-1)}getAllMutationBatches(e){return Ae.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,n){const r=new ls(n,0),i=new ls(n,Number.POSITIVE_INFINITY),s=[];return this.Jr.forEachInRange([r,i],o=>{const a=this.Zr(o.Hr);s.push(a)}),Ae.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(e,n){let r=new Xi(Cn);return n.forEach(i=>{const s=new ls(i,0),o=new ls(i,Number.POSITIVE_INFINITY);this.Jr.forEachInRange([s,o],a=>{r=r.add(a.Hr)})}),Ae.resolve(this.Yr(r))}getAllMutationBatchesAffectingQuery(e,n){const r=n.path,i=r.length+1;let s=r;At.isDocumentKey(s)||(s=s.child(""));const o=new ls(new At(s),0);let a=new Xi(Cn);return this.Jr.forEachWhile(l=>{const c=l.key.path;return!!r.isPrefixOf(c)&&(c.length===i&&(a=a.add(l.Hr)),!0)},o),Ae.resolve(this.Yr(a))}Yr(e){const n=[];return e.forEach(r=>{const i=this.Zr(r);i!==null&&n.push(i)}),n}removeMutationBatch(e,n){er(this.ei(n.batchId,"removed")===0,55003),this.mutationQueue.shift();let r=this.Jr;return Ae.forEach(n.mutations,i=>{const s=new ls(i.key,n.batchId);return r=r.delete(s),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(()=>{this.Jr=r})}nr(e){}containsKey(e,n){const r=new ls(n,0),i=this.Jr.firstAfterOrEqual(r);return Ae.resolve(n.isEqual(i&&i.key))}performConsistencyCheck(e){return this.mutationQueue.length,Ae.resolve()}ei(e,n){return this.Xr(e)}Xr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Zr(e){const n=this.Xr(e);return n<0||n>=this.mutationQueue.length?null:this.mutationQueue[n]}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class tGe{constructor(e){this.ti=e,this.docs=function(){return new ei(At.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,n){const r=n.key,i=this.docs.get(r),s=i?i.size:0,o=this.ti(n);return this.docs=this.docs.insert(r,{document:n.mutableCopy(),size:o}),this.size+=o-s,this.indexManager.addToCollectionParentIndex(e,r.path.popLast())}removeEntry(e){const n=this.docs.get(e);n&&(this.docs=this.docs.remove(e),this.size-=n.size)}getEntry(e,n){const r=this.docs.get(n);return Ae.resolve(r?r.document.mutableCopy():Xs.newInvalidDocument(n))}getEntries(e,n){let r=uf();return n.forEach(i=>{const s=this.docs.get(i);r=r.insert(i,s?s.document.mutableCopy():Xs.newInvalidDocument(i))}),Ae.resolve(r)}getDocumentsMatchingQuery(e,n,r,i){let s=uf();const o=n.path,a=new At(o.child("__id-9223372036854775808__")),l=this.docs.getIteratorFrom(a);for(;l.hasNext();){const{key:c,value:{document:u}}=l.getNext();if(!o.isPrefixOf(c.path))break;c.path.length>o.length+1||Tqe(Eqe(u),r)<=0||(i.has(u.key)||lI(n,u))&&(s=s.insert(u.key,u.mutableCopy()))}return Ae.resolve(s)}getAllFromCollectionGroup(e,n,r,i){Pt(9500)}ni(e,n){return Ae.forEach(this.docs,r=>n(r))}newChangeBuffer(e){return new nGe(this)}getSize(e){return Ae.resolve(this.size)}}class nGe extends KWe{constructor(e){super(),this.Mr=e}applyChanges(e){const n=[];return this.changes.forEach((r,i)=>{i.isValidDocument()?n.push(this.Mr.addEntry(e,i)):this.Mr.removeEntry(r)}),Ae.waitFor(n)}getFromCache(e,n){return this.Mr.getEntry(e,n)}getAllFromCache(e,n){return this.Mr.getEntries(e,n)}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class rGe{constructor(e){this.persistence=e,this.ri=new xy(n=>J$(n),eH),this.lastRemoteSnapshotVersion=$t.min(),this.highestTargetId=0,this.ii=0,this.si=new oH,this.targetCount=0,this.oi=Xw._r()}forEachTarget(e,n){return this.ri.forEach((r,i)=>n(i)),Ae.resolve()}getLastRemoteSnapshotVersion(e){return Ae.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return Ae.resolve(this.ii)}allocateTargetId(e){return this.highestTargetId=this.oi.next(),Ae.resolve(this.highestTargetId)}setTargetsMetadata(e,n,r){return r&&(this.lastRemoteSnapshotVersion=r),n>this.ii&&(this.ii=n),Ae.resolve()}lr(e){this.ri.set(e.target,e);const n=e.targetId;n>this.highestTargetId&&(this.oi=new Xw(n),this.highestTargetId=n),e.sequenceNumber>this.ii&&(this.ii=e.sequenceNumber)}addTargetData(e,n){return this.lr(n),this.targetCount+=1,Ae.resolve()}updateTargetData(e,n){return this.lr(n),Ae.resolve()}removeTargetData(e,n){return this.ri.delete(n.target),this.si.Gr(n.targetId),this.targetCount-=1,Ae.resolve()}removeTargets(e,n,r){let i=0;const s=[];return this.ri.forEach((o,a)=>{a.sequenceNumber<=n&&r.get(a.targetId)===null&&(this.ri.delete(o),s.push(this.removeMatchingKeysForTargetId(e,a.targetId)),i++)}),Ae.waitFor(s).next(()=>i)}getTargetCount(e){return Ae.resolve(this.targetCount)}getTargetData(e,n){const r=this.ri.get(n)||null;return Ae.resolve(r)}addMatchingKeys(e,n,r){return this.si.$r(n,r),Ae.resolve()}removeMatchingKeys(e,n,r){this.si.Qr(n,r);const i=this.persistence.referenceDelegate,s=[];return i&&n.forEach(o=>{s.push(i.markPotentiallyOrphaned(e,o))}),Ae.waitFor(s)}removeMatchingKeysForTargetId(e,n){return this.si.Gr(n),Ae.resolve()}getMatchingKeysForTargetId(e,n){const r=this.si.jr(n);return Ae.resolve(r)}containsKey(e,n){return Ae.resolve(this.si.containsKey(n))}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class B1e{constructor(e,n){this._i={},this.overlays={},this.ai=new rI(0),this.ui=!1,this.ui=!0,this.ci=new JWe,this.referenceDelegate=e(this),this.li=new rGe(this),this.indexManager=new VWe,this.remoteDocumentCache=function(i){return new tGe(i)}(r=>this.referenceDelegate.hi(r)),this.serializer=new BWe(n),this.Pi=new XWe(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.ui=!1,Promise.resolve()}get started(){return this.ui}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let n=this.overlays[e.toKey()];return n||(n=new QWe,this.overlays[e.toKey()]=n),n}getMutationQueue(e,n){let r=this._i[e.toKey()];return r||(r=new eGe(n,this.referenceDelegate),this._i[e.toKey()]=r),r}getGlobalsCache(){return this.ci}getTargetCache(){return this.li}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Pi}runTransaction(e,n,r){dt("MemoryPersistence","Starting transaction:",e);const i=new iGe(this.ai.next());return this.referenceDelegate.Ti(),r(i).next(s=>this.referenceDelegate.Ii(i).next(()=>s)).toPromise().then(s=>(i.raiseOnCommittedEvent(),s))}Ei(e,n){return Ae.or(Object.values(this._i).map(r=>()=>r.containsKey(e,n)))}}class iGe extends Iqe{constructor(e){super(),this.currentSequenceNumber=e}}class aH{constructor(e){this.persistence=e,this.Ri=new oH,this.Ai=null}static Vi(e){return new aH(e)}get di(){if(this.Ai)return this.Ai;throw Pt(60996)}addReference(e,n,r){return this.Ri.addReference(r,n),this.di.delete(r.toString()),Ae.resolve()}removeReference(e,n,r){return this.Ri.removeReference(r,n),this.di.add(r.toString()),Ae.resolve()}markPotentiallyOrphaned(e,n){return this.di.add(n.toString()),Ae.resolve()}removeTarget(e,n){this.Ri.Gr(n.targetId).forEach(i=>this.di.add(i.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,n.targetId).next(i=>{i.forEach(s=>this.di.add(s.toString()))}).next(()=>r.removeTargetData(e,n))}Ti(){this.Ai=new Set}Ii(e){const n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return Ae.forEach(this.di,r=>{const i=At.fromPath(r);return this.mi(e,i).next(s=>{s||n.removeEntry(i,$t.min())})}).next(()=>(this.Ai=null,n.apply(e)))}updateLimboDocument(e,n){return this.mi(e,n).next(r=>{r?this.di.delete(n.toString()):this.di.add(n.toString())})}hi(e){return 0}mi(e,n){return Ae.or([()=>Ae.resolve(this.Ri.containsKey(n)),()=>this.persistence.getTargetCache().containsKey(e,n),()=>this.persistence.Ei(e,n)])}}class T7{constructor(e,n){this.persistence=e,this.fi=new xy(r=>Nqe(r.path),(r,i)=>r.isEqual(i)),this.garbageCollector=GWe(this,n)}static Vi(e,n){return new T7(e,n)}Ti(){}Ii(e){return Ae.resolve()}forEachTarget(e,n){return this.persistence.getTargetCache().forEachTarget(e,n)}dr(e){const n=this.pr(e);return this.persistence.getTargetCache().getTargetCount(e).next(r=>n.next(i=>r+i))}pr(e){let n=0;return this.mr(e,r=>{n++}).next(()=>n)}mr(e,n){return Ae.forEach(this.fi,(r,i)=>this.wr(e,r,i).next(s=>s?Ae.resolve():n(i)))}removeTargets(e,n,r){return this.persistence.getTargetCache().removeTargets(e,n,r)}removeOrphanedDocuments(e,n){let r=0;const i=this.persistence.getRemoteDocumentCache(),s=i.newChangeBuffer();return i.ni(e,o=>this.wr(e,o,n).next(a=>{a||(r++,s.removeEntry(o,$t.min()))})).next(()=>s.apply(e)).next(()=>r)}markPotentiallyOrphaned(e,n){return this.fi.set(n,e.currentSequenceNumber),Ae.resolve()}removeTarget(e,n){const r=n.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,r)}addReference(e,n,r){return this.fi.set(r,e.currentSequenceNumber),Ae.resolve()}removeReference(e,n,r){return this.fi.set(r,e.currentSequenceNumber),Ae.resolve()}updateLimboDocument(e,n){return this.fi.set(n,e.currentSequenceNumber),Ae.resolve()}hi(e){let n=e.key.toString().length;return e.isFoundDocument()&&(n+=QT(e.data.value)),n}wr(e,n,r){return Ae.or([()=>this.persistence.Ei(e,n),()=>this.persistence.getTargetCache().containsKey(e,n),()=>{const i=this.fi.get(n);return Ae.resolve(i!==void 0&&i>r)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class lH{constructor(e,n,r,i){this.targetId=e,this.fromCache=n,this.Ts=r,this.Is=i}static Es(e,n){let r=Tn(),i=Tn();for(const s of n.docChanges)switch(s.type){case 0:r=r.add(s.doc.key);break;case 1:i=i.add(s.doc.key)}return new lH(e,n.fromCache,r,i)}}/**
|
||
* @license
|
||
* Copyright 2023 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class sGe{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class oGe{constructor(){this.Rs=!1,this.As=!1,this.Vs=100,this.ds=function(){return ALe()?8:Rqe(io())>0?6:4}()}initialize(e,n){this.fs=e,this.indexManager=n,this.Rs=!0}getDocumentsMatchingQuery(e,n,r,i){const s={result:null};return this.gs(e,n).next(o=>{s.result=o}).next(()=>{if(!s.result)return this.ps(e,n,i,r).next(o=>{s.result=o})}).next(()=>{if(s.result)return;const o=new sGe;return this.ys(e,n,o).next(a=>{if(s.result=a,this.As)return this.ws(e,n,o,a.size)})}).next(()=>s.result)}ws(e,n,r,i){return r.documentReadCount<this.Vs?(lv()<=kn.DEBUG&&dt("QueryEngine","SDK will not create cache indexes for query:",cv(n),"since it only creates cache indexes for collection contains","more than or equal to",this.Vs,"documents"),Ae.resolve()):(lv()<=kn.DEBUG&&dt("QueryEngine","Query:",cv(n),"scans",r.documentReadCount,"local documents and returns",i,"documents as results."),r.documentReadCount>this.ds*i?(lv()<=kn.DEBUG&&dt("QueryEngine","The SDK decides to create cache indexes for query:",cv(n),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,ad(n))):Ae.resolve())}gs(e,n){if(LQ(n))return Ae.resolve(null);let r=ad(n);return this.indexManager.getIndexType(e,r).next(i=>i===0?null:(n.limit!==null&&i===1&&(n=k7(n,null,"F"),r=ad(n)),this.indexManager.getDocumentsMatchingTarget(e,r).next(s=>{const o=Tn(...s);return this.fs.getDocuments(e,o).next(a=>this.indexManager.getMinOffset(e,r).next(l=>{const c=this.bs(n,a);return this.Ss(n,c,o,l.readTime)?this.gs(e,k7(n,null,"F")):this.Ds(e,c,n,l)}))})))}ps(e,n,r,i){return LQ(n)||i.isEqual($t.min())?Ae.resolve(null):this.fs.getDocuments(e,r).next(s=>{const o=this.bs(n,s);return this.Ss(n,o,r,i)?Ae.resolve(null):(lv()<=kn.DEBUG&&dt("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),cv(n)),this.Ds(e,o,n,Cqe(i,jS)).next(a=>a))})}bs(e,n){let r=new Xi(m1e(e));return n.forEach((i,s)=>{lI(e,s)&&(r=r.add(s))}),r}Ss(e,n,r,i){if(e.limit===null)return!1;if(r.size!==n.size)return!0;const s=e.limitType==="F"?n.last():n.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(i)>0)}ys(e,n,r){return lv()<=kn.DEBUG&&dt("QueryEngine","Using full collection scan to execute query:",cv(n)),this.fs.getDocumentsMatchingQuery(e,n,jm.min(),r)}Ds(e,n,r,i){return this.fs.getDocumentsMatchingQuery(e,r,i).next(s=>(n.forEach(o=>{s=s.insert(o.key,o)}),s))}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const cH="LocalStore",aGe=3e8;class lGe{constructor(e,n,r,i){this.persistence=e,this.Cs=n,this.serializer=i,this.vs=new ei(Cn),this.Fs=new xy(s=>J$(s),eH),this.Ms=new Map,this.xs=e.getRemoteDocumentCache(),this.li=e.getTargetCache(),this.Pi=e.getBundleCache(),this.Os(r)}Os(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new ZWe(this.xs,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.xs.setIndexManager(this.indexManager),this.Cs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",n=>e.collect(n,this.vs))}}function cGe(t,e,n,r){return new lGe(t,e,n,r)}async function F1e(t,e){const n=Gt(t);return await n.persistence.runTransaction("Handle user change","readonly",r=>{let i;return n.mutationQueue.getAllMutationBatches(r).next(s=>(i=s,n.Os(e),n.mutationQueue.getAllMutationBatches(r))).next(s=>{const o=[],a=[];let l=Tn();for(const c of i){o.push(c.batchId);for(const u of c.mutations)l=l.add(u.key)}for(const c of s){a.push(c.batchId);for(const u of c.mutations)l=l.add(u.key)}return n.localDocuments.getDocuments(r,l).next(c=>({Ns:c,removedBatchIds:o,addedBatchIds:a}))})})}function uGe(t,e){const n=Gt(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const i=e.batch.keys(),s=n.xs.newChangeBuffer({trackRemovals:!0});return function(a,l,c,u){const d=c.batch,h=d.keys();let f=Ae.resolve();return h.forEach(p=>{f=f.next(()=>u.getEntry(l,p)).next(g=>{const y=c.docVersions.get(p);er(y!==null,48541),g.version.compareTo(y)<0&&(d.applyToRemoteDocument(g,c),g.isValidDocument()&&(g.setReadTime(c.commitVersion),u.addEntry(g)))})}),f.next(()=>a.mutationQueue.removeMutationBatch(l,d))}(n,r,e,s).next(()=>s.apply(r)).next(()=>n.mutationQueue.performConsistencyCheck(r)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(r,i,e.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(a){let l=Tn();for(let c=0;c<a.mutationResults.length;++c)a.mutationResults[c].transformResults.length>0&&(l=l.add(a.batch.mutations[c].key));return l}(e))).next(()=>n.localDocuments.getDocuments(r,i))})}function V1e(t){const e=Gt(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",n=>e.li.getLastRemoteSnapshotVersion(n))}function dGe(t,e){const n=Gt(t),r=e.snapshotVersion;let i=n.vs;return n.persistence.runTransaction("Apply remote event","readwrite-primary",s=>{const o=n.xs.newChangeBuffer({trackRemovals:!0});i=n.vs;const a=[];e.targetChanges.forEach((u,d)=>{const h=i.get(d);if(!h)return;a.push(n.li.removeMatchingKeys(s,u.removedDocuments,d).next(()=>n.li.addMatchingKeys(s,u.addedDocuments,d)));let f=h.withSequenceNumber(s.currentSequenceNumber);e.targetMismatches.get(d)!==null?f=f.withResumeToken(Ps.EMPTY_BYTE_STRING,$t.min()).withLastLimboFreeSnapshotVersion($t.min()):u.resumeToken.approximateByteSize()>0&&(f=f.withResumeToken(u.resumeToken,r)),i=i.insert(d,f),function(g,y,v){return g.resumeToken.approximateByteSize()===0||y.snapshotVersion.toMicroseconds()-g.snapshotVersion.toMicroseconds()>=aGe?!0:v.addedDocuments.size+v.modifiedDocuments.size+v.removedDocuments.size>0}(h,f,u)&&a.push(n.li.updateTargetData(s,f))});let l=uf(),c=Tn();if(e.documentUpdates.forEach(u=>{e.resolvedLimboDocuments.has(u)&&a.push(n.persistence.referenceDelegate.updateLimboDocument(s,u))}),a.push(hGe(s,o,e.documentUpdates).next(u=>{l=u.Bs,c=u.Ls})),!r.isEqual($t.min())){const u=n.li.getLastRemoteSnapshotVersion(s).next(d=>n.li.setTargetsMetadata(s,s.currentSequenceNumber,r));a.push(u)}return Ae.waitFor(a).next(()=>o.apply(s)).next(()=>n.localDocuments.getLocalViewOfDocuments(s,l,c)).next(()=>l)}).then(s=>(n.vs=i,s))}function hGe(t,e,n){let r=Tn(),i=Tn();return n.forEach(s=>r=r.add(s)),e.getEntries(t,r).next(s=>{let o=uf();return n.forEach((a,l)=>{const c=s.get(a);l.isFoundDocument()!==c.isFoundDocument()&&(i=i.add(a)),l.isNoDocument()&&l.version.isEqual($t.min())?(e.removeEntry(a,l.readTime),o=o.insert(a,l)):!c.isValidDocument()||l.version.compareTo(c.version)>0||l.version.compareTo(c.version)===0&&c.hasPendingWrites?(e.addEntry(l),o=o.insert(a,l)):dt(cH,"Ignoring outdated watch update for ",a,". Current version:",c.version," Watch version:",l.version)}),{Bs:o,Ls:i}})}function fGe(t,e){const n=Gt(t);return n.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=Z$),n.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function pGe(t,e){const n=Gt(t);return n.persistence.runTransaction("Allocate target","readwrite",r=>{let i;return n.li.getTargetData(r,e).next(s=>s?(i=s,Ae.resolve(i)):n.li.allocateTargetId(r).next(o=>(i=new Jp(e,o,"TargetPurposeListen",r.currentSequenceNumber),n.li.addTargetData(r,i).next(()=>i))))}).then(r=>{const i=n.vs.get(r.targetId);return(i===null||r.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(n.vs=n.vs.insert(r.targetId,r),n.Fs.set(e,r.targetId)),r})}async function WL(t,e,n){const r=Gt(t),i=r.vs.get(e),s=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",s,o=>r.persistence.referenceDelegate.removeTarget(o,i))}catch(o){if(!Xx(o))throw o;dt(cH,`Failed to update sequence numbers for target ${e}: ${o}`)}r.vs=r.vs.remove(e),r.Fs.delete(i.target)}function YQ(t,e,n){const r=Gt(t);let i=$t.min(),s=Tn();return r.persistence.runTransaction("Execute query","readwrite",o=>function(l,c,u){const d=Gt(l),h=d.Fs.get(u);return h!==void 0?Ae.resolve(d.vs.get(h)):d.li.getTargetData(c,u)}(r,o,ad(e)).next(a=>{if(a)return i=a.lastLimboFreeSnapshotVersion,r.li.getMatchingKeysForTargetId(o,a.targetId).next(l=>{s=l})}).next(()=>r.Cs.getDocumentsMatchingQuery(o,e,n?i:$t.min(),n?s:Tn())).next(a=>(mGe(r,eWe(e),a),{documents:a,ks:s})))}function mGe(t,e,n){let r=t.Ms.get(e)||$t.min();n.forEach((i,s)=>{s.readTime.compareTo(r)>0&&(r=s.readTime)}),t.Ms.set(e,r)}class ZQ{constructor(){this.activeTargetIds=oWe()}Qs(e){this.activeTargetIds=this.activeTargetIds.add(e)}Gs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Ws(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class gGe{constructor(){this.vo=new ZQ,this.Fo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,n,r){}addLocalQueryTarget(e,n=!0){return n&&this.vo.Qs(e),this.Fo[e]||"not-current"}updateQueryState(e,n,r){this.Fo[e]=n}removeLocalQueryTarget(e){this.vo.Gs(e)}isLocalQueryTarget(e){return this.vo.activeTargetIds.has(e)}clearQueryState(e){delete this.Fo[e]}getAllActiveQueryTargets(){return this.vo.activeTargetIds}isActiveQueryTarget(e){return this.vo.activeTargetIds.has(e)}start(){return this.vo=new ZQ,Promise.resolve()}handleUserChange(e,n,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class yGe{Mo(e){}shutdown(){}}/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const XQ="ConnectivityMonitor";class QQ{constructor(){this.xo=()=>this.Oo(),this.No=()=>this.Bo(),this.Lo=[],this.ko()}Mo(e){this.Lo.push(e)}shutdown(){window.removeEventListener("online",this.xo),window.removeEventListener("offline",this.No)}ko(){window.addEventListener("online",this.xo),window.addEventListener("offline",this.No)}Oo(){dt(XQ,"Network connectivity changed: AVAILABLE");for(const e of this.Lo)e(0)}Bo(){dt(XQ,"Network connectivity changed: UNAVAILABLE");for(const e of this.Lo)e(1)}static v(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
|
||
* @license
|
||
* Copyright 2023 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/let uE=null;function GL(){return uE===null?uE=function(){return 268435456+Math.round(2147483648*Math.random())}():uE++,"0x"+uE.toString(16)}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const RN="RestConnection",vGe={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery",ExecutePipeline:"executePipeline"};class bGe{get Ko(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const n=e.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.qo=n+"://"+e.host,this.Uo=`projects/${r}/databases/${i}`,this.$o=this.databaseId.database===x7?`project_id=${r}`:`project_id=${r}&database_id=${i}`}Wo(e,n,r,i,s){const o=GL(),a=this.Qo(e,n.toUriEncodedString());dt(RN,`Sending RPC '${e}' ${o}:`,a,r);const l={"google-cloud-resource-prefix":this.Uo,"x-goog-request-params":this.$o};this.Go(l,i,s);const{host:c}=new URL(a),u=qx(c);return this.zo(e,a,l,r,u).then(d=>(dt(RN,`Received RPC '${e}' ${o}: `,d),d),d=>{throw $1(RN,`RPC '${e}' ${o} failed with error: `,d,"url: ",a,"request:",r),d})}jo(e,n,r,i,s,o){return this.Wo(e,n,r,i,s)}Go(e,n,r){e["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+Yx}(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),n&&n.headers.forEach((i,s)=>e[s]=i),r&&r.headers.forEach((i,s)=>e[s]=i)}Qo(e,n){const r=vGe[e];let i=`${this.qo}/v1/${n}:${r}`;return this.databaseInfo.apiKey&&(i=`${i}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),i}terminate(){}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class wGe{constructor(e){this.Ho=e.Ho,this.Jo=e.Jo}Zo(e){this.Xo=e}Yo(e){this.e_=e}t_(e){this.n_=e}onMessage(e){this.r_=e}close(){this.Jo()}send(e){this.Ho(e)}i_(){this.Xo()}s_(){this.e_()}o_(e){this.n_(e)}__(e){this.r_(e)}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const $s="WebChannelConnection",W2=(t,e,n)=>{t.listen(e,r=>{try{n(r)}catch(i){setTimeout(()=>{throw i},0)}})};class lb extends bGe{constructor(e){super(e),this.a_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}static u_(){if(!lb.c_){const e=qge();W2(e,Uge.STAT_EVENT,n=>{n.stat===PL.PROXY?dt($s,"STAT_EVENT: detected buffering proxy"):n.stat===PL.NOPROXY&&dt($s,"STAT_EVENT: detected no buffering proxy")}),lb.c_=!0}}zo(e,n,r,i,s){const o=GL();return new Promise((a,l)=>{const c=new $ge;c.setWithCredentials(!0),c.listenOnce(Hge.COMPLETE,()=>{try{switch(c.getLastErrorCode()){case XT.NO_ERROR:const d=c.getResponseJson();dt($s,`XHR for RPC '${e}' ${o} received:`,JSON.stringify(d)),a(d);break;case XT.TIMEOUT:dt($s,`RPC '${e}' ${o} timed out`),l(new it(Se.DEADLINE_EXCEEDED,"Request time out"));break;case XT.HTTP_ERROR:const h=c.getStatus();if(dt($s,`RPC '${e}' ${o} failed with status:`,h,"response text:",c.getResponseText()),h>0){let f=c.getResponseJson();Array.isArray(f)&&(f=f[0]);const p=f==null?void 0:f.error;if(p&&p.status&&p.message){const g=function(v){const b=v.toLowerCase().replace(/_/g,"-");return Object.values(Se).indexOf(b)>=0?b:Se.UNKNOWN}(p.status);l(new it(g,p.message))}else l(new it(Se.UNKNOWN,"Server responded with status "+c.getStatus()))}else l(new it(Se.UNAVAILABLE,"Connection failed."));break;default:Pt(9055,{l_:e,streamId:o,h_:c.getLastErrorCode(),P_:c.getLastError()})}}finally{dt($s,`RPC '${e}' ${o} completed.`)}});const u=JSON.stringify(i);dt($s,`RPC '${e}' ${o} sending request:`,i),c.send(n,"POST",u,r,15)})}T_(e,n,r){const i=GL(),s=[this.qo,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=this.createWebChannelTransport(),a={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},l=this.longPollingOptions.timeoutSeconds;l!==void 0&&(a.longPollingTimeout=Math.round(1e3*l)),this.useFetchStreams&&(a.useFetchStreams=!0),this.Go(a.initMessageHeaders,n,r),a.encodeInitMessageHeaders=!0;const c=s.join("");dt($s,`Creating RPC '${e}' stream ${i}: ${c}`,a);const u=o.createWebChannel(c,a);this.I_(u);let d=!1,h=!1;const f=new wGe({Ho:p=>{h?dt($s,`Not sending because RPC '${e}' stream ${i} is closed:`,p):(d||(dt($s,`Opening RPC '${e}' stream ${i} transport.`),u.open(),d=!0),dt($s,`RPC '${e}' stream ${i} sending:`,p),u.send(p))},Jo:()=>u.close()});return W2(u,x4.EventType.OPEN,()=>{h||(dt($s,`RPC '${e}' stream ${i} transport opened.`),f.i_())}),W2(u,x4.EventType.CLOSE,()=>{h||(h=!0,dt($s,`RPC '${e}' stream ${i} transport closed`),f.o_(),this.E_(u))}),W2(u,x4.EventType.ERROR,p=>{h||(h=!0,$1($s,`RPC '${e}' stream ${i} transport errored. Name:`,p.name,"Message:",p.message),f.o_(new it(Se.UNAVAILABLE,"The operation could not be completed")))}),W2(u,x4.EventType.MESSAGE,p=>{var g;if(!h){const y=p.data[0];er(!!y,16349);const v=y,b=(v==null?void 0:v.error)||((g=v[0])==null?void 0:g.error);if(b){dt($s,`RPC '${e}' stream ${i} received error:`,b);const _=b.status;let S=function(E){const C=ki[E];if(C!==void 0)return T1e(C)}(_),k=b.message;_==="NOT_FOUND"&&k.includes("database")&&k.includes("does not exist")&&k.includes(this.databaseId.database)&&$1(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),S===void 0&&(S=Se.INTERNAL,k="Unknown error status: "+_+" with message "+b.message),h=!0,f.o_(new it(S,k)),u.close()}else dt($s,`RPC '${e}' stream ${i} received:`,y),f.__(y)}}),lb.u_(),setTimeout(()=>{f.s_()},0),f}terminate(){this.a_.forEach(e=>e.close()),this.a_=[]}I_(e){this.a_.push(e)}E_(e){this.a_=this.a_.filter(n=>n===e)}Go(e,n,r){super.Go(e,n,r),this.databaseInfo.apiKey&&(e["x-goog-api-key"]=this.databaseInfo.apiKey)}createWebChannelTransport(){return Wge()}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function xGe(t){return new lb(t)}function MN(){return typeof document<"u"?document:null}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function hI(t){return new CWe(t,!0)}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/lb.c_=!1;class $1e{constructor(e,n,r=1e3,i=1.5,s=6e4){this.Ci=e,this.timerId=n,this.R_=r,this.A_=i,this.V_=s,this.d_=0,this.m_=null,this.f_=Date.now(),this.reset()}reset(){this.d_=0}g_(){this.d_=this.V_}p_(e){this.cancel();const n=Math.floor(this.d_+this.y_()),r=Math.max(0,Date.now()-this.f_),i=Math.max(0,n-r);i>0&&dt("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.d_} ms, delay with jitter: ${n} ms, last attempt: ${r} ms ago)`),this.m_=this.Ci.enqueueAfterDelay(this.timerId,i,()=>(this.f_=Date.now(),e())),this.d_*=this.A_,this.d_<this.R_&&(this.d_=this.R_),this.d_>this.V_&&(this.d_=this.V_)}w_(){this.m_!==null&&(this.m_.skipDelay(),this.m_=null)}cancel(){this.m_!==null&&(this.m_.cancel(),this.m_=null)}y_(){return(Math.random()-.5)*this.d_}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const JQ="PersistentStream";class H1e{constructor(e,n,r,i,s,o,a,l){this.Ci=e,this.b_=r,this.S_=i,this.connection=s,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=a,this.listener=l,this.state=0,this.D_=0,this.C_=null,this.v_=null,this.stream=null,this.F_=0,this.M_=new $1e(e,n)}x_(){return this.state===1||this.state===5||this.O_()}O_(){return this.state===2||this.state===3}start(){this.F_=0,this.state!==4?this.auth():this.N_()}async stop(){this.x_()&&await this.close(0)}B_(){this.state=0,this.M_.reset()}L_(){this.O_()&&this.C_===null&&(this.C_=this.Ci.enqueueAfterDelay(this.b_,6e4,()=>this.k_()))}K_(e){this.q_(),this.stream.send(e)}async k_(){if(this.O_())return this.close(0)}q_(){this.C_&&(this.C_.cancel(),this.C_=null)}U_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(e,n){this.q_(),this.U_(),this.M_.cancel(),this.D_++,e!==4?this.M_.reset():n&&n.code===Se.RESOURCE_EXHAUSTED?(cf(n.toString()),cf("Using maximum backoff delay to prevent overloading the backend."),this.M_.g_()):n&&n.code===Se.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.W_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.t_(n)}W_(){}auth(){this.state=1;const e=this.Q_(this.D_),n=this.D_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,i])=>{this.D_===n&&this.G_(r,i)},r=>{e(()=>{const i=new it(Se.UNKNOWN,"Fetching auth token failed: "+r.message);return this.z_(i)})})}G_(e,n){const r=this.Q_(this.D_);this.stream=this.j_(e,n),this.stream.Zo(()=>{r(()=>this.listener.Zo())}),this.stream.Yo(()=>{r(()=>(this.state=2,this.v_=this.Ci.enqueueAfterDelay(this.S_,1e4,()=>(this.O_()&&(this.state=3),Promise.resolve())),this.listener.Yo()))}),this.stream.t_(i=>{r(()=>this.z_(i))}),this.stream.onMessage(i=>{r(()=>++this.F_==1?this.H_(i):this.onNext(i))})}N_(){this.state=5,this.M_.p_(async()=>{this.state=0,this.start()})}z_(e){return dt(JQ,`close with error: ${e}`),this.stream=null,this.close(4,e)}Q_(e){return n=>{this.Ci.enqueueAndForget(()=>this.D_===e?n():(dt(JQ,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class _Ge extends H1e{constructor(e,n,r,i,s,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",n,r,i,o),this.serializer=s}j_(e,n){return this.connection.T_("Listen",e,n)}H_(e){return this.onNext(e)}onNext(e){this.M_.reset();const n=AWe(this.serializer,e),r=function(s){if(!("targetChange"in s))return $t.min();const o=s.targetChange;return o.targetIds&&o.targetIds.length?$t.min():o.readTime?cd(o.readTime):$t.min()}(e);return this.listener.J_(n,r)}Z_(e){const n={};n.database=qL(this.serializer),n.addTarget=function(s,o){let a;const l=o.target;if(a=FL(l)?{documents:MWe(s,l)}:{query:NWe(s,l).ft},a.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){a.resumeToken=R1e(s,o.resumeToken);const c=$L(s,o.expectedCount);c!==null&&(a.expectedCount=c)}else if(o.snapshotVersion.compareTo($t.min())>0){a.readTime=E7(s,o.snapshotVersion.toTimestamp());const c=$L(s,o.expectedCount);c!==null&&(a.expectedCount=c)}return a}(this.serializer,e);const r=DWe(this.serializer,e);r&&(n.labels=r),this.K_(n)}X_(e){const n={};n.database=qL(this.serializer),n.removeTarget=e,this.K_(n)}}class SGe extends H1e{constructor(e,n,r,i,s,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",n,r,i,o),this.serializer=s}get Y_(){return this.F_>0}start(){this.lastStreamToken=void 0,super.start()}W_(){this.Y_&&this.ea([])}j_(e,n){return this.connection.T_("Write",e,n)}H_(e){return er(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,er(!e.writeResults||e.writeResults.length===0,55816),this.listener.ta()}onNext(e){er(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.M_.reset();const n=RWe(e.writeResults,e.commitTime),r=cd(e.commitTime);return this.listener.na(r,n)}ra(){const e={};e.database=qL(this.serializer),this.K_(e)}ea(e){const n={streamToken:this.lastStreamToken,writes:e.map(r=>IWe(this.serializer,r))};this.K_(n)}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class kGe{}class CGe extends kGe{constructor(e,n,r,i){super(),this.authCredentials=e,this.appCheckCredentials=n,this.connection=r,this.serializer=i,this.ia=!1}sa(){if(this.ia)throw new it(Se.FAILED_PRECONDITION,"The client has already been terminated.")}Wo(e,n,r,i){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,o])=>this.connection.Wo(e,HL(n,r),i,s,o)).catch(s=>{throw s.name==="FirebaseError"?(s.code===Se.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),s):new it(Se.UNKNOWN,s.toString())})}jo(e,n,r,i,s){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,a])=>this.connection.jo(e,HL(n,r),i,o,a,s)).catch(o=>{throw o.name==="FirebaseError"?(o.code===Se.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new it(Se.UNKNOWN,o.toString())})}terminate(){this.ia=!0,this.connection.terminate()}}function EGe(t,e,n,r){return new CGe(t,e,n,r)}class TGe{constructor(e,n){this.asyncQueue=e,this.onlineStateHandler=n,this.state="Unknown",this.oa=0,this._a=null,this.aa=!0}ua(){this.oa===0&&(this.ca("Unknown"),this._a=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this._a=null,this.la("Backend didn't respond within 10 seconds."),this.ca("Offline"),Promise.resolve())))}ha(e){this.state==="Online"?this.ca("Unknown"):(this.oa++,this.oa>=1&&(this.Pa(),this.la(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ca("Offline")))}set(e){this.Pa(),this.oa=0,e==="Online"&&(this.aa=!1),this.ca(e)}ca(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}la(e){const n=`Could not reach Cloud Firestore backend. ${e}
|
||
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.aa?(cf(n),this.aa=!1):dt("OnlineStateTracker",n)}Pa(){this._a!==null&&(this._a.cancel(),this._a=null)}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const H1="RemoteStore";class AGe{constructor(e,n,r,i,s){this.localStore=e,this.datastore=n,this.asyncQueue=r,this.remoteSyncer={},this.Ta=[],this.Ia=new Map,this.Ea=new Set,this.Ra=[],this.Aa=s,this.Aa.Mo(o=>{r.enqueueAndForget(async()=>{_y(this)&&(dt(H1,"Restarting streams for network reachability change."),await async function(l){const c=Gt(l);c.Ea.add(4),await y3(c),c.Va.set("Unknown"),c.Ea.delete(4),await fI(c)}(this))})}),this.Va=new TGe(r,i)}}async function fI(t){if(_y(t))for(const e of t.Ra)await e(!0)}async function y3(t){for(const e of t.Ra)await e(!1)}function U1e(t,e){const n=Gt(t);n.Ia.has(e.targetId)||(n.Ia.set(e.targetId,e),fH(n)?hH(n):Jx(n).O_()&&dH(n,e))}function uH(t,e){const n=Gt(t),r=Jx(n);n.Ia.delete(e),r.O_()&&q1e(n,e),n.Ia.size===0&&(r.O_()?r.L_():_y(n)&&n.Va.set("Unknown"))}function dH(t,e){if(t.da.$e(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo($t.min())>0){const n=t.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(n)}Jx(t).Z_(e)}function q1e(t,e){t.da.$e(e),Jx(t).X_(e)}function hH(t){t.da=new xWe({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),At:e=>t.Ia.get(e)||null,ht:()=>t.datastore.serializer.databaseId}),Jx(t).start(),t.Va.ua()}function fH(t){return _y(t)&&!Jx(t).x_()&&t.Ia.size>0}function _y(t){return Gt(t).Ea.size===0}function W1e(t){t.da=void 0}async function IGe(t){t.Va.set("Online")}async function RGe(t){t.Ia.forEach((e,n)=>{dH(t,e)})}async function MGe(t,e){W1e(t),fH(t)?(t.Va.ha(e),hH(t)):t.Va.set("Unknown")}async function NGe(t,e,n){if(t.Va.set("Online"),e instanceof I1e&&e.state===2&&e.cause)try{await async function(i,s){const o=s.cause;for(const a of s.targetIds)i.Ia.has(a)&&(await i.remoteSyncer.rejectListen(a,o),i.Ia.delete(a),i.da.removeTarget(a))}(t,e)}catch(r){dt(H1,"Failed to remove targets %s: %s ",e.targetIds.join(","),r),await A7(t,r)}else if(e instanceof t6?t.da.Xe(e):e instanceof A1e?t.da.st(e):t.da.tt(e),!n.isEqual($t.min()))try{const r=await V1e(t.localStore);n.compareTo(r)>=0&&await function(s,o){const a=s.da.Tt(o);return a.targetChanges.forEach((l,c)=>{if(l.resumeToken.approximateByteSize()>0){const u=s.Ia.get(c);u&&s.Ia.set(c,u.withResumeToken(l.resumeToken,o))}}),a.targetMismatches.forEach((l,c)=>{const u=s.Ia.get(l);if(!u)return;s.Ia.set(l,u.withResumeToken(Ps.EMPTY_BYTE_STRING,u.snapshotVersion)),q1e(s,l);const d=new Jp(u.target,l,c,u.sequenceNumber);dH(s,d)}),s.remoteSyncer.applyRemoteEvent(a)}(t,n)}catch(r){dt(H1,"Failed to raise snapshot:",r),await A7(t,r)}}async function A7(t,e,n){if(!Xx(e))throw e;t.Ea.add(1),await y3(t),t.Va.set("Offline"),n||(n=()=>V1e(t.localStore)),t.asyncQueue.enqueueRetryable(async()=>{dt(H1,"Retrying IndexedDB access"),await n(),t.Ea.delete(1),await fI(t)})}function G1e(t,e){return e().catch(n=>A7(t,n,e))}async function pI(t){const e=Gt(t),n=$m(e);let r=e.Ta.length>0?e.Ta[e.Ta.length-1].batchId:Z$;for(;OGe(e);)try{const i=await fGe(e.localStore,r);if(i===null){e.Ta.length===0&&n.L_();break}r=i.batchId,DGe(e,i)}catch(i){await A7(e,i)}K1e(e)&&Y1e(e)}function OGe(t){return _y(t)&&t.Ta.length<10}function DGe(t,e){t.Ta.push(e);const n=$m(t);n.O_()&&n.Y_&&n.ea(e.mutations)}function K1e(t){return _y(t)&&!$m(t).x_()&&t.Ta.length>0}function Y1e(t){$m(t).start()}async function PGe(t){$m(t).ra()}async function LGe(t){const e=$m(t);for(const n of t.Ta)e.ea(n.mutations)}async function zGe(t,e,n){const r=t.Ta.shift(),i=rH.from(r,e,n);await G1e(t,()=>t.remoteSyncer.applySuccessfulWrite(i)),await pI(t)}async function jGe(t,e){e&&$m(t).Y_&&await async function(r,i){if(function(o){return vWe(o)&&o!==Se.ABORTED}(i.code)){const s=r.Ta.shift();$m(r).B_(),await G1e(r,()=>r.remoteSyncer.rejectFailedWrite(s.batchId,i)),await pI(r)}}(t,e),K1e(t)&&Y1e(t)}async function eJ(t,e){const n=Gt(t);n.asyncQueue.verifyOperationInProgress(),dt(H1,"RemoteStore received new credentials");const r=_y(n);n.Ea.add(3),await y3(n),r&&n.Va.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.Ea.delete(3),await fI(n)}async function BGe(t,e){const n=Gt(t);e?(n.Ea.delete(2),await fI(n)):e||(n.Ea.add(2),await y3(n),n.Va.set("Unknown"))}function Jx(t){return t.ma||(t.ma=function(n,r,i){const s=Gt(n);return s.sa(),new _Ge(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(t.datastore,t.asyncQueue,{Zo:IGe.bind(null,t),Yo:RGe.bind(null,t),t_:MGe.bind(null,t),J_:NGe.bind(null,t)}),t.Ra.push(async e=>{e?(t.ma.B_(),fH(t)?hH(t):t.Va.set("Unknown")):(await t.ma.stop(),W1e(t))})),t.ma}function $m(t){return t.fa||(t.fa=function(n,r,i){const s=Gt(n);return s.sa(),new SGe(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(t.datastore,t.asyncQueue,{Zo:()=>Promise.resolve(),Yo:PGe.bind(null,t),t_:jGe.bind(null,t),ta:LGe.bind(null,t),na:zGe.bind(null,t)}),t.Ra.push(async e=>{e?(t.fa.B_(),await pI(t)):(await t.fa.stop(),t.Ta.length>0&&(dt(H1,`Stopping write stream with ${t.Ta.length} pending writes`),t.Ta=[]))})),t.fa}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class pH{constructor(e,n,r,i,s){this.asyncQueue=e,this.timerId=n,this.targetTimeMs=r,this.op=i,this.removalCallback=s,this.deferred=new xm,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(o=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,n,r,i,s){const o=Date.now()+r,a=new pH(e,n,o,i,s);return a.start(r),a}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new it(Se.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function mH(t,e){if(cf("AsyncQueue",`${e}: ${t}`),Xx(t))return new it(Se.UNAVAILABLE,`${e}: ${t}`);throw t}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class cb{static emptySet(e){return new cb(e.comparator)}constructor(e){this.comparator=e?(n,r)=>e(n,r)||At.comparator(n.key,r.key):(n,r)=>At.comparator(n.key,r.key),this.keyedMap=_4(),this.sortedSet=new ei(this.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const n=this.keyedMap.get(e);return n?this.sortedSet.indexOf(n):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((n,r)=>(e(n),!1))}add(e){const n=this.delete(e.key);return n.copy(n.keyedMap.insert(e.key,e),n.sortedSet.insert(e,null))}delete(e){const n=this.get(e);return n?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(n)):this}isEqual(e){if(!(e instanceof cb)||this.size!==e.size)return!1;const n=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;n.hasNext();){const i=n.getNext().key,s=r.getNext().key;if(!i.isEqual(s))return!1}return!0}toString(){const e=[];return this.forEach(n=>{e.push(n.toString())}),e.length===0?"DocumentSet ()":`DocumentSet (
|
||
`+e.join(`
|
||
`)+`
|
||
)`}copy(e,n){const r=new cb;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=n,r}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class tJ{constructor(){this.ga=new ei(At.comparator)}track(e){const n=e.doc.key,r=this.ga.get(n);r?e.type!==0&&r.type===3?this.ga=this.ga.insert(n,e):e.type===3&&r.type!==1?this.ga=this.ga.insert(n,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.ga=this.ga.insert(n,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.ga=this.ga.insert(n,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.ga=this.ga.remove(n):e.type===1&&r.type===2?this.ga=this.ga.insert(n,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.ga=this.ga.insert(n,{type:2,doc:e.doc}):Pt(63341,{Vt:e,pa:r}):this.ga=this.ga.insert(n,e)}ya(){const e=[];return this.ga.inorderTraversal((n,r)=>{e.push(r)}),e}}class Qw{constructor(e,n,r,i,s,o,a,l,c){this.query=e,this.docs=n,this.oldDocs=r,this.docChanges=i,this.mutatedKeys=s,this.fromCache=o,this.syncStateChanged=a,this.excludesMetadataChanges=l,this.hasCachedResults=c}static fromInitialDocuments(e,n,r,i,s){const o=[];return n.forEach(a=>{o.push({type:0,doc:a})}),new Qw(e,n,cb.emptySet(n),o,r,i,!0,!1,s)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&aI(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const n=this.docChanges,r=e.docChanges;if(n.length!==r.length)return!1;for(let i=0;i<n.length;i++)if(n[i].type!==r[i].type||!n[i].doc.isEqual(r[i].doc))return!1;return!0}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class FGe{constructor(){this.wa=void 0,this.ba=[]}Sa(){return this.ba.some(e=>e.Da())}}class VGe{constructor(){this.queries=nJ(),this.onlineState="Unknown",this.Ca=new Set}terminate(){(function(n,r){const i=Gt(n),s=i.queries;i.queries=nJ(),s.forEach((o,a)=>{for(const l of a.ba)l.onError(r)})})(this,new it(Se.ABORTED,"Firestore shutting down"))}}function nJ(){return new xy(t=>p1e(t),aI)}async function Z1e(t,e){const n=Gt(t);let r=3;const i=e.query;let s=n.queries.get(i);s?!s.Sa()&&e.Da()&&(r=2):(s=new FGe,r=e.Da()?0:1);try{switch(r){case 0:s.wa=await n.onListen(i,!0);break;case 1:s.wa=await n.onListen(i,!1);break;case 2:await n.onFirstRemoteStoreListen(i)}}catch(o){const a=mH(o,`Initialization of query '${cv(e.query)}' failed`);return void e.onError(a)}n.queries.set(i,s),s.ba.push(e),e.va(n.onlineState),s.wa&&e.Fa(s.wa)&&gH(n)}async function X1e(t,e){const n=Gt(t),r=e.query;let i=3;const s=n.queries.get(r);if(s){const o=s.ba.indexOf(e);o>=0&&(s.ba.splice(o,1),s.ba.length===0?i=e.Da()?0:1:!s.Sa()&&e.Da()&&(i=2))}switch(i){case 0:return n.queries.delete(r),n.onUnlisten(r,!0);case 1:return n.queries.delete(r),n.onUnlisten(r,!1);case 2:return n.onLastRemoteStoreUnlisten(r);default:return}}function $Ge(t,e){const n=Gt(t);let r=!1;for(const i of e){const s=i.query,o=n.queries.get(s);if(o){for(const a of o.ba)a.Fa(i)&&(r=!0);o.wa=i}}r&&gH(n)}function HGe(t,e,n){const r=Gt(t),i=r.queries.get(e);if(i)for(const s of i.ba)s.onError(n);r.queries.delete(e)}function gH(t){t.Ca.forEach(e=>{e.next()})}var KL,rJ;(rJ=KL||(KL={})).Ma="default",rJ.Cache="cache";class Q1e{constructor(e,n,r){this.query=e,this.xa=n,this.Oa=!1,this.Na=null,this.onlineState="Unknown",this.options=r||{}}Fa(e){if(!this.options.includeMetadataChanges){const r=[];for(const i of e.docChanges)i.type!==3&&r.push(i);e=new Qw(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let n=!1;return this.Oa?this.Ba(e)&&(this.xa.next(e),n=!0):this.La(e,this.onlineState)&&(this.ka(e),n=!0),this.Na=e,n}onError(e){this.xa.error(e)}va(e){this.onlineState=e;let n=!1;return this.Na&&!this.Oa&&this.La(this.Na,e)&&(this.ka(this.Na),n=!0),n}La(e,n){if(!e.fromCache||!this.Da())return!0;const r=n!=="Offline";return(!this.options.Ka||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||n==="Offline")}Ba(e){if(e.docChanges.length>0)return!0;const n=this.Na&&this.Na.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!n)&&this.options.includeMetadataChanges===!0}ka(e){e=Qw.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Oa=!0,this.xa.next(e)}Da(){return this.options.source!==KL.Cache}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class J1e{constructor(e){this.key=e}}class eye{constructor(e){this.key=e}}class UGe{constructor(e,n){this.query=e,this.Za=n,this.Xa=null,this.hasCachedResults=!1,this.current=!1,this.Ya=Tn(),this.mutatedKeys=Tn(),this.eu=m1e(e),this.tu=new cb(this.eu)}get nu(){return this.Za}ru(e,n){const r=n?n.iu:new tJ,i=n?n.tu:this.tu;let s=n?n.mutatedKeys:this.mutatedKeys,o=i,a=!1;const l=this.query.limitType==="F"&&i.size===this.query.limit?i.last():null,c=this.query.limitType==="L"&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((u,d)=>{const h=i.get(u),f=lI(this.query,d)?d:null,p=!!h&&this.mutatedKeys.has(h.key),g=!!f&&(f.hasLocalMutations||this.mutatedKeys.has(f.key)&&f.hasCommittedMutations);let y=!1;h&&f?h.data.isEqual(f.data)?p!==g&&(r.track({type:3,doc:f}),y=!0):this.su(h,f)||(r.track({type:2,doc:f}),y=!0,(l&&this.eu(f,l)>0||c&&this.eu(f,c)<0)&&(a=!0)):!h&&f?(r.track({type:0,doc:f}),y=!0):h&&!f&&(r.track({type:1,doc:h}),y=!0,(l||c)&&(a=!0)),y&&(f?(o=o.add(f),s=g?s.add(u):s.delete(u)):(o=o.delete(u),s=s.delete(u)))}),this.query.limit!==null)for(;o.size>this.query.limit;){const u=this.query.limitType==="F"?o.last():o.first();o=o.delete(u.key),s=s.delete(u.key),r.track({type:1,doc:u})}return{tu:o,iu:r,Ss:a,mutatedKeys:s}}su(e,n){return e.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations}applyChanges(e,n,r,i){const s=this.tu;this.tu=e.tu,this.mutatedKeys=e.mutatedKeys;const o=e.iu.ya();o.sort((u,d)=>function(f,p){const g=y=>{switch(y){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Pt(20277,{Vt:y})}};return g(f)-g(p)}(u.type,d.type)||this.eu(u.doc,d.doc)),this.ou(r),i=i??!1;const a=n&&!i?this._u():[],l=this.Ya.size===0&&this.current&&!i?1:0,c=l!==this.Xa;return this.Xa=l,o.length!==0||c?{snapshot:new Qw(this.query,e.tu,s,o,e.mutatedKeys,l===0,c,!1,!!r&&r.resumeToken.approximateByteSize()>0),au:a}:{au:a}}va(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({tu:this.tu,iu:new tJ,mutatedKeys:this.mutatedKeys,Ss:!1},!1)):{au:[]}}uu(e){return!this.Za.has(e)&&!!this.tu.has(e)&&!this.tu.get(e).hasLocalMutations}ou(e){e&&(e.addedDocuments.forEach(n=>this.Za=this.Za.add(n)),e.modifiedDocuments.forEach(n=>{}),e.removedDocuments.forEach(n=>this.Za=this.Za.delete(n)),this.current=e.current)}_u(){if(!this.current)return[];const e=this.Ya;this.Ya=Tn(),this.tu.forEach(r=>{this.uu(r.key)&&(this.Ya=this.Ya.add(r.key))});const n=[];return e.forEach(r=>{this.Ya.has(r)||n.push(new eye(r))}),this.Ya.forEach(r=>{e.has(r)||n.push(new J1e(r))}),n}cu(e){this.Za=e.ks,this.Ya=Tn();const n=this.ru(e.documents);return this.applyChanges(n,!0)}lu(){return Qw.fromInitialDocuments(this.query,this.tu,this.mutatedKeys,this.Xa===0,this.hasCachedResults)}}const yH="SyncEngine";class qGe{constructor(e,n,r){this.query=e,this.targetId=n,this.view=r}}class WGe{constructor(e){this.key=e,this.hu=!1}}class GGe{constructor(e,n,r,i,s,o){this.localStore=e,this.remoteStore=n,this.eventManager=r,this.sharedClientState=i,this.currentUser=s,this.maxConcurrentLimboResolutions=o,this.Pu={},this.Tu=new xy(a=>p1e(a),aI),this.Iu=new Map,this.Eu=new Set,this.Ru=new ei(At.comparator),this.Au=new Map,this.Vu=new oH,this.du={},this.mu=new Map,this.fu=Xw.ar(),this.onlineState="Unknown",this.gu=void 0}get isPrimaryClient(){return this.gu===!0}}async function KGe(t,e,n=!0){const r=oye(t);let i;const s=r.Tu.get(e);return s?(r.sharedClientState.addLocalQueryTarget(s.targetId),i=s.view.lu()):i=await tye(r,e,n,!0),i}async function YGe(t,e){const n=oye(t);await tye(n,e,!0,!1)}async function tye(t,e,n,r){const i=await pGe(t.localStore,ad(e)),s=i.targetId,o=t.sharedClientState.addLocalQueryTarget(s,n);let a;return r&&(a=await ZGe(t,e,s,o==="current",i.resumeToken)),t.isPrimaryClient&&n&&U1e(t.remoteStore,i),a}async function ZGe(t,e,n,r,i){t.pu=(d,h,f)=>async function(g,y,v,b){let _=y.view.ru(v);_.Ss&&(_=await YQ(g.localStore,y.query,!1).then(({documents:E})=>y.view.ru(E,_)));const S=b&&b.targetChanges.get(y.targetId),k=b&&b.targetMismatches.get(y.targetId)!=null,T=y.view.applyChanges(_,g.isPrimaryClient,S,k);return sJ(g,y.targetId,T.au),T.snapshot}(t,d,h,f);const s=await YQ(t.localStore,e,!0),o=new UGe(e,s.ks),a=o.ru(s.documents),l=g3.createSynthesizedTargetChangeForCurrentChange(n,r&&t.onlineState!=="Offline",i),c=o.applyChanges(a,t.isPrimaryClient,l);sJ(t,n,c.au);const u=new qGe(e,n,o);return t.Tu.set(e,u),t.Iu.has(n)?t.Iu.get(n).push(e):t.Iu.set(n,[e]),c.snapshot}async function XGe(t,e,n){const r=Gt(t),i=r.Tu.get(e),s=r.Iu.get(i.targetId);if(s.length>1)return r.Iu.set(i.targetId,s.filter(o=>!aI(o,e))),void r.Tu.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(i.targetId),r.sharedClientState.isActiveQueryTarget(i.targetId)||await WL(r.localStore,i.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(i.targetId),n&&uH(r.remoteStore,i.targetId),YL(r,i.targetId)}).catch(Zx)):(YL(r,i.targetId),await WL(r.localStore,i.targetId,!0))}async function QGe(t,e){const n=Gt(t),r=n.Tu.get(e),i=n.Iu.get(r.targetId);n.isPrimaryClient&&i.length===1&&(n.sharedClientState.removeLocalQueryTarget(r.targetId),uH(n.remoteStore,r.targetId))}async function JGe(t,e,n){const r=oKe(t);try{const i=await function(o,a){const l=Gt(o),c=ir.now(),u=a.reduce((f,p)=>f.add(p.key),Tn());let d,h;return l.persistence.runTransaction("Locally write mutations","readwrite",f=>{let p=uf(),g=Tn();return l.xs.getEntries(f,u).next(y=>{p=y,p.forEach((v,b)=>{b.isValidDocument()||(g=g.add(v))})}).next(()=>l.localDocuments.getOverlayedDocuments(f,p)).next(y=>{d=y;const v=[];for(const b of a){const _=fWe(b,d.get(b.key).overlayedDocument);_!=null&&v.push(new w0(b.key,_,o1e(_.value.mapValue),ld.exists(!0)))}return l.mutationQueue.addMutationBatch(f,c,v,a)}).next(y=>{h=y;const v=y.applyToLocalDocumentSet(d,g);return l.documentOverlayCache.saveOverlays(f,y.batchId,v)})}).then(()=>({batchId:h.batchId,changes:y1e(d)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(i.batchId),function(o,a,l){let c=o.du[o.currentUser.toKey()];c||(c=new ei(Cn)),c=c.insert(a,l),o.du[o.currentUser.toKey()]=c}(r,i.batchId,n),await v3(r,i.changes),await pI(r.remoteStore)}catch(i){const s=mH(i,"Failed to persist write");n.reject(s)}}async function nye(t,e){const n=Gt(t);try{const r=await dGe(n.localStore,e);e.targetChanges.forEach((i,s)=>{const o=n.Au.get(s);o&&(er(i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size<=1,22616),i.addedDocuments.size>0?o.hu=!0:i.modifiedDocuments.size>0?er(o.hu,14607):i.removedDocuments.size>0&&(er(o.hu,42227),o.hu=!1))}),await v3(n,r,e)}catch(r){await Zx(r)}}function iJ(t,e,n){const r=Gt(t);if(r.isPrimaryClient&&n===0||!r.isPrimaryClient&&n===1){const i=[];r.Tu.forEach((s,o)=>{const a=o.view.va(e);a.snapshot&&i.push(a.snapshot)}),function(o,a){const l=Gt(o);l.onlineState=a;let c=!1;l.queries.forEach((u,d)=>{for(const h of d.ba)h.va(a)&&(c=!0)}),c&&gH(l)}(r.eventManager,e),i.length&&r.Pu.J_(i),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function eKe(t,e,n){const r=Gt(t);r.sharedClientState.updateQueryState(e,"rejected",n);const i=r.Au.get(e),s=i&&i.key;if(s){let o=new ei(At.comparator);o=o.insert(s,Xs.newNoDocument(s,$t.min()));const a=Tn().add(s),l=new dI($t.min(),new Map,new ei(Cn),o,a);await nye(r,l),r.Ru=r.Ru.remove(s),r.Au.delete(e),vH(r)}else await WL(r.localStore,e,!1).then(()=>YL(r,e,n)).catch(Zx)}async function tKe(t,e){const n=Gt(t),r=e.batch.batchId;try{const i=await uGe(n.localStore,e);iye(n,r,null),rye(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await v3(n,i)}catch(i){await Zx(i)}}async function nKe(t,e,n){const r=Gt(t);try{const i=await function(o,a){const l=Gt(o);return l.persistence.runTransaction("Reject batch","readwrite-primary",c=>{let u;return l.mutationQueue.lookupMutationBatch(c,a).next(d=>(er(d!==null,37113),u=d.keys(),l.mutationQueue.removeMutationBatch(c,d))).next(()=>l.mutationQueue.performConsistencyCheck(c)).next(()=>l.documentOverlayCache.removeOverlaysForBatchId(c,u,a)).next(()=>l.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(c,u)).next(()=>l.localDocuments.getDocuments(c,u))})}(r.localStore,e);iye(r,e,n),rye(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await v3(r,i)}catch(i){await Zx(i)}}function rye(t,e){(t.mu.get(e)||[]).forEach(n=>{n.resolve()}),t.mu.delete(e)}function iye(t,e,n){const r=Gt(t);let i=r.du[r.currentUser.toKey()];if(i){const s=i.get(e);s&&(n?s.reject(n):s.resolve(),i=i.remove(e)),r.du[r.currentUser.toKey()]=i}}function YL(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.Iu.get(e))t.Tu.delete(r),n&&t.Pu.yu(r,n);t.Iu.delete(e),t.isPrimaryClient&&t.Vu.Gr(e).forEach(r=>{t.Vu.containsKey(r)||sye(t,r)})}function sye(t,e){t.Eu.delete(e.path.canonicalString());const n=t.Ru.get(e);n!==null&&(uH(t.remoteStore,n),t.Ru=t.Ru.remove(e),t.Au.delete(n),vH(t))}function sJ(t,e,n){for(const r of n)r instanceof J1e?(t.Vu.addReference(r.key,e),rKe(t,r)):r instanceof eye?(dt(yH,"Document no longer in limbo: "+r.key),t.Vu.removeReference(r.key,e),t.Vu.containsKey(r.key)||sye(t,r.key)):Pt(19791,{wu:r})}function rKe(t,e){const n=e.key,r=n.path.canonicalString();t.Ru.get(n)||t.Eu.has(r)||(dt(yH,"New document in limbo: "+n),t.Eu.add(r),vH(t))}function vH(t){for(;t.Eu.size>0&&t.Ru.size<t.maxConcurrentLimboResolutions;){const e=t.Eu.values().next().value;t.Eu.delete(e);const n=new At(Ar.fromString(e)),r=t.fu.next();t.Au.set(r,new WGe(n)),t.Ru=t.Ru.insert(n,r),U1e(t.remoteStore,new Jp(ad(oI(n.path)),r,"TargetPurposeLimboResolution",rI.ce))}}async function v3(t,e,n){const r=Gt(t),i=[],s=[],o=[];r.Tu.isEmpty()||(r.Tu.forEach((a,l)=>{o.push(r.pu(l,e,n).then(c=>{var u;if((c||n)&&r.isPrimaryClient){const d=c?!c.fromCache:(u=n==null?void 0:n.targetChanges.get(l.targetId))==null?void 0:u.current;r.sharedClientState.updateQueryState(l.targetId,d?"current":"not-current")}if(c){i.push(c);const d=lH.Es(l.targetId,c);s.push(d)}}))}),await Promise.all(o),r.Pu.J_(i),await async function(l,c){const u=Gt(l);try{await u.persistence.runTransaction("notifyLocalViewChanges","readwrite",d=>Ae.forEach(c,h=>Ae.forEach(h.Ts,f=>u.persistence.referenceDelegate.addReference(d,h.targetId,f)).next(()=>Ae.forEach(h.Is,f=>u.persistence.referenceDelegate.removeReference(d,h.targetId,f)))))}catch(d){if(!Xx(d))throw d;dt(cH,"Failed to update sequence numbers: "+d)}for(const d of c){const h=d.targetId;if(!d.fromCache){const f=u.vs.get(h),p=f.snapshotVersion,g=f.withLastLimboFreeSnapshotVersion(p);u.vs=u.vs.insert(h,g)}}}(r.localStore,s))}async function iKe(t,e){const n=Gt(t);if(!n.currentUser.isEqual(e)){dt(yH,"User change. New user:",e.toKey());const r=await F1e(n.localStore,e);n.currentUser=e,function(s,o){s.mu.forEach(a=>{a.forEach(l=>{l.reject(new it(Se.CANCELLED,o))})}),s.mu.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await v3(n,r.Ns)}}function sKe(t,e){const n=Gt(t),r=n.Au.get(e);if(r&&r.hu)return Tn().add(r.key);{let i=Tn();const s=n.Iu.get(e);if(!s)return i;for(const o of s){const a=n.Tu.get(o);i=i.unionWith(a.view.nu)}return i}}function oye(t){const e=Gt(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=nye.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=sKe.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=eKe.bind(null,e),e.Pu.J_=$Ge.bind(null,e.eventManager),e.Pu.yu=HGe.bind(null,e.eventManager),e}function oKe(t){const e=Gt(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=tKe.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=nKe.bind(null,e),e}class I7{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=hI(e.databaseInfo.databaseId),this.sharedClientState=this.Du(e),this.persistence=this.Cu(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Fu(e,this.localStore),this.indexBackfillerScheduler=this.Mu(e,this.localStore)}Fu(e,n){return null}Mu(e,n){return null}vu(e){return cGe(this.persistence,new oGe,e.initialUser,this.serializer)}Cu(e){return new B1e(aH.Vi,this.serializer)}Du(e){return new gGe}async terminate(){var e,n;(e=this.gcScheduler)==null||e.stop(),(n=this.indexBackfillerScheduler)==null||n.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}I7.provider={build:()=>new I7};class aKe extends I7{constructor(e){super(),this.cacheSizeBytes=e}Fu(e,n){er(this.persistence.referenceDelegate instanceof T7,46915);const r=this.persistence.referenceDelegate.garbageCollector;return new qWe(r,e.asyncQueue,n)}Cu(e){const n=this.cacheSizeBytes!==void 0?ia.withCacheSize(this.cacheSizeBytes):ia.DEFAULT;return new B1e(r=>T7.Vi(r,n),this.serializer)}}class ZL{async initialize(e,n){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(n),this.remoteStore=this.createRemoteStore(n),this.eventManager=this.createEventManager(n),this.syncEngine=this.createSyncEngine(n,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>iJ(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=iKe.bind(null,this.syncEngine),await BGe(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new VGe}()}createDatastore(e){const n=hI(e.databaseInfo.databaseId),r=xGe(e.databaseInfo);return EGe(e.authCredentials,e.appCheckCredentials,r,n)}createRemoteStore(e){return function(r,i,s,o,a){return new AGe(r,i,s,o,a)}(this.localStore,this.datastore,e.asyncQueue,n=>iJ(this.syncEngine,n,0),function(){return QQ.v()?new QQ:new yGe}())}createSyncEngine(e,n){return function(i,s,o,a,l,c,u){const d=new GGe(i,s,o,a,l,c);return u&&(d.gu=!0),d}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,n)}async terminate(){var e,n;await async function(i){const s=Gt(i);dt(H1,"RemoteStore shutting down."),s.Ea.add(5),await y3(s),s.Aa.shutdown(),s.Va.set("Unknown")}(this.remoteStore),(e=this.datastore)==null||e.terminate(),(n=this.eventManager)==null||n.terminate()}}ZL.provider={build:()=>new ZL};/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*//**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class aye{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Ou(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Ou(this.observer.error,e):cf("Uncaught Error in snapshot listener:",e.toString()))}Nu(){this.muted=!0}Ou(e,n){setTimeout(()=>{this.muted||e(n)},0)}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const Hm="FirestoreClient";class lKe{constructor(e,n,r,i,s){this.authCredentials=e,this.appCheckCredentials=n,this.asyncQueue=r,this._databaseInfo=i,this.user=Ks.UNAUTHENTICATED,this.clientId=Y$.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=s,this.authCredentials.start(r,async o=>{dt(Hm,"Received user=",o.uid),await this.authCredentialListener(o),this.user=o}),this.appCheckCredentials.start(r,o=>(dt(Hm,"Received new app check token=",o),this.appCheckCredentialListener(o,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this._databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new xm;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(n){const r=mH(n,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function NN(t,e){t.asyncQueue.verifyOperationInProgress(),dt(Hm,"Initializing OfflineComponentProvider");const n=t.configuration;await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener(async i=>{r.isEqual(i)||(await F1e(e.localStore,i),r=i)}),e.persistence.setDatabaseDeletedListener(()=>t.terminate()),t._offlineComponents=e}async function oJ(t,e){t.asyncQueue.verifyOperationInProgress();const n=await cKe(t);dt(Hm,"Initializing OnlineComponentProvider"),await e.initialize(n,t.configuration),t.setCredentialChangeListener(r=>eJ(e.remoteStore,r)),t.setAppCheckTokenChangeListener((r,i)=>eJ(e.remoteStore,i)),t._onlineComponents=e}async function cKe(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){dt(Hm,"Using user provided OfflineComponentProvider");try{await NN(t,t._uninitializedComponentsProvider._offline)}catch(e){const n=e;if(!function(i){return i.name==="FirebaseError"?i.code===Se.FAILED_PRECONDITION||i.code===Se.UNIMPLEMENTED:!(typeof DOMException<"u"&&i instanceof DOMException)||i.code===22||i.code===20||i.code===11}(n))throw n;$1("Error using user provided cache. Falling back to memory cache: "+n),await NN(t,new I7)}}else dt(Hm,"Using default OfflineComponentProvider"),await NN(t,new aKe(void 0));return t._offlineComponents}async function lye(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(dt(Hm,"Using user provided OnlineComponentProvider"),await oJ(t,t._uninitializedComponentsProvider._online)):(dt(Hm,"Using default OnlineComponentProvider"),await oJ(t,new ZL))),t._onlineComponents}function uKe(t){return lye(t).then(e=>e.syncEngine)}async function XL(t){const e=await lye(t),n=e.eventManager;return n.onListen=KGe.bind(null,e.syncEngine),n.onUnlisten=XGe.bind(null,e.syncEngine),n.onFirstRemoteStoreListen=YGe.bind(null,e.syncEngine),n.onLastRemoteStoreUnlisten=QGe.bind(null,e.syncEngine),n}function dKe(t,e,n,r){const i=new aye(r),s=new Q1e(e,i,n);return t.asyncQueue.enqueueAndForget(async()=>Z1e(await XL(t),s)),()=>{i.Nu(),t.asyncQueue.enqueueAndForget(async()=>X1e(await XL(t),s))}}function hKe(t,e,n={}){const r=new xm;return t.asyncQueue.enqueueAndForget(async()=>function(s,o,a,l,c){const u=new aye({next:h=>{u.Nu(),o.enqueueAndForget(()=>X1e(s,d));const f=h.docs.has(a);!f&&h.fromCache?c.reject(new it(Se.UNAVAILABLE,"Failed to get document because the client is offline.")):f&&h.fromCache&&l&&l.source==="server"?c.reject(new it(Se.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):c.resolve(h)},error:h=>c.reject(h)}),d=new Q1e(oI(a.path),u,{includeMetadataChanges:!0,Ka:!0});return Z1e(s,d)}(await XL(t),t.asyncQueue,e,n,r)),r.promise}function fKe(t,e){const n=new xm;return t.asyncQueue.enqueueAndForget(async()=>JGe(await uKe(t),e,n)),n.promise}/**
|
||
* @license
|
||
* Copyright 2023 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function cye(t){const e={};return t.timeoutSeconds!==void 0&&(e.timeoutSeconds=t.timeoutSeconds),e}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const pKe="ComponentProvider",aJ=new Map;function mKe(t,e,n,r,i){return new Pqe(t,e,n,i.host,i.ssl,i.experimentalForceLongPolling,i.experimentalAutoDetectLongPolling,cye(i.experimentalLongPollingOptions),i.useFetchStreams,i.isUsingEmulator,r)}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const uye="firestore.googleapis.com",lJ=!0;class cJ{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new it(Se.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=uye,this.ssl=lJ}else this.host=e.host,this.ssl=e.ssl??lJ;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=j1e;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<HWe)throw new it(Se.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}Sqe("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=cye(e.experimentalLongPollingOptions??{}),function(r){if(r.timeoutSeconds!==void 0){if(isNaN(r.timeoutSeconds))throw new it(Se.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (must not be NaN)`);if(r.timeoutSeconds<5)throw new it(Se.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (minimum allowed value is 5)`);if(r.timeoutSeconds>30)throw new it(Se.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(r,i){return r.timeoutSeconds===i.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class mI{constructor(e,n,r,i){this._authCredentials=e,this._appCheckCredentials=n,this._databaseId=r,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new cJ({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new it(Se.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new it(Se.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new cJ(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new fqe;switch(r.type){case"firstParty":return new yqe(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new it(Se.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(n){const r=aJ.get(n);r&&(dt(pKe,"Removing Datastore"),aJ.delete(n),r.terminate())}(this),Promise.resolve()}}function gKe(t,e,n,r={}){var c;t=Fh(t,mI);const i=qx(e),s=t._getSettings(),o={...s,emulatorOptions:t._getEmulatorOptions()},a=`${e}:${n}`;i&&(b0e(`https://${a}`),w0e("Firestore",!0)),s.host!==uye&&s.host!==a&&$1("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const l={...s,host:a,ssl:i,emulatorOptions:r};if(!sf(l,o)&&(t._setSettings(l),r.mockUserToken)){let u,d;if(typeof r.mockUserToken=="string")u=r.mockUserToken,d=Ks.MOCK_USER;else{u=bLe(r.mockUserToken,(c=t._app)==null?void 0:c.options.projectId);const h=r.mockUserToken.sub||r.mockUserToken.user_id;if(!h)throw new it(Se.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");d=new Ks(h)}t._authCredentials=new pqe(new Kge(u,d))}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/let e2=class dye{constructor(e,n,r){this.converter=n,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new dye(this.firestore,e,this._query)}};class vi{constructor(e,n,r){this.converter=n,this._key=r,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new _m(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new vi(this.firestore,e,this._key)}toJSON(){return{type:vi._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,n,r){if(p3(n,vi._jsonSchema))return new vi(e,r||null,new At(Ar.fromString(n.referencePath)))}}vi._jsonSchemaVersion="firestore/documentReference/1.0",vi._jsonSchema={type:Ri("string",vi._jsonSchemaVersion),referencePath:Ri("string")};class _m extends e2{constructor(e,n,r){super(e,n,oI(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new vi(this.firestore,null,new At(e))}withConverter(e){return new _m(this.firestore,e,this._path)}}function yKe(t,e,...n){if(t=Ds(t),Yge("collection","path",e),t instanceof mI){const r=Ar.fromString(e,...n);return _Q(r),new _m(t,null,r)}{if(!(t instanceof vi||t instanceof _m))throw new it(Se.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Ar.fromString(e,...n));return _Q(r),new _m(t.firestore,null,r)}}function hye(t,e,...n){if(t=Ds(t),arguments.length===1&&(e=Y$.newId()),Yge("doc","path",e),t instanceof mI){const r=Ar.fromString(e,...n);return xQ(r),new vi(t,null,new At(r))}{if(!(t instanceof vi||t instanceof _m))throw new it(Se.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Ar.fromString(e,...n));return xQ(r),new vi(t.firestore,t instanceof _m?t.converter:null,new At(r))}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const uJ="AsyncQueue";class dJ{constructor(e=Promise.resolve()){this.Yu=[],this.ec=!1,this.tc=[],this.nc=null,this.rc=!1,this.sc=!1,this.oc=[],this.M_=new $1e(this,"async_queue_retry"),this._c=()=>{const r=MN();r&&dt(uJ,"Visibility state changed to "+r.visibilityState),this.M_.w_()},this.ac=e;const n=MN();n&&typeof n.addEventListener=="function"&&n.addEventListener("visibilitychange",this._c)}get isShuttingDown(){return this.ec}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.uc(),this.cc(e)}enterRestrictedMode(e){if(!this.ec){this.ec=!0,this.sc=e||!1;const n=MN();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this._c)}}enqueue(e){if(this.uc(),this.ec)return new Promise(()=>{});const n=new xm;return this.cc(()=>this.ec&&this.sc?Promise.resolve():(e().then(n.resolve,n.reject),n.promise)).then(()=>n.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Yu.push(e),this.lc()))}async lc(){if(this.Yu.length!==0){try{await this.Yu[0](),this.Yu.shift(),this.M_.reset()}catch(e){if(!Xx(e))throw e;dt(uJ,"Operation failed with retryable error: "+e)}this.Yu.length>0&&this.M_.p_(()=>this.lc())}}cc(e){const n=this.ac.then(()=>(this.rc=!0,e().catch(r=>{throw this.nc=r,this.rc=!1,cf("INTERNAL UNHANDLED ERROR: ",hJ(r)),r}).then(r=>(this.rc=!1,r))));return this.ac=n,n}enqueueAfterDelay(e,n,r){this.uc(),this.oc.indexOf(e)>-1&&(n=0);const i=pH.createAndSchedule(this,e,n,r,s=>this.hc(s));return this.tc.push(i),i}uc(){this.nc&&Pt(47125,{Pc:hJ(this.nc)})}verifyOperationInProgress(){}async Tc(){let e;do e=this.ac,await e;while(e!==this.ac)}Ic(e){for(const n of this.tc)if(n.timerId===e)return!0;return!1}Ec(e){return this.Tc().then(()=>{this.tc.sort((n,r)=>n.targetTimeMs-r.targetTimeMs);for(const n of this.tc)if(n.skipDelay(),e!=="all"&&n.timerId===e)break;return this.Tc()})}Rc(e){this.oc.push(e)}hc(e){const n=this.tc.indexOf(e);this.tc.splice(n,1)}}function hJ(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+`
|
||
`+t.stack),e}class Jw extends mI{constructor(e,n,r,i){super(e,n,r,i),this.type="firestore",this._queue=new dJ,this._persistenceKey=(i==null?void 0:i.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new dJ(e),this._firestoreClient=void 0,await e}}}function vKe(t,e){const n=typeof t=="object"?t:k0e(),r=typeof t=="string"?t:x7,i=O$(n,"firestore").getImmediate({identifier:r});if(!i._initialized){const s=yLe("firestore");s&&gKe(i,...s)}return i}function bH(t){if(t._terminated)throw new it(Se.FAILED_PRECONDITION,"The client has already been terminated.");return t._firestoreClient||bKe(t),t._firestoreClient}function bKe(t){var r,i,s,o;const e=t._freezeSettings(),n=mKe(t._databaseId,((r=t._app)==null?void 0:r.options.appId)||"",t._persistenceKey,(i=t._app)==null?void 0:i.options.apiKey,e);t._componentsProvider||(s=e.localCache)!=null&&s._offlineComponentProvider&&((o=e.localCache)!=null&&o._onlineComponentProvider)&&(t._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),t._firestoreClient=new lKe(t._authCredentials,t._appCheckCredentials,t._queue,n,t._componentsProvider&&function(l){const c=l==null?void 0:l._online.build();return{_offline:l==null?void 0:l._offline.build(c),_online:c}}(t._componentsProvider))}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class Dl{constructor(e){this._byteString=e}static fromBase64String(e){try{return new Dl(Ps.fromBase64String(e))}catch(n){throw new it(Se.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(e){return new Dl(Ps.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:Dl._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(p3(e,Dl._jsonSchema))return Dl.fromBase64String(e.bytes)}}Dl._jsonSchemaVersion="firestore/bytes/1.0",Dl._jsonSchema={type:Ri("string",Dl._jsonSchemaVersion),bytes:Ri("string")};/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class gI{constructor(...e){for(let n=0;n<e.length;++n)if(e[n].length===0)throw new it(Se.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new As(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class t2{constructor(e){this._methodName=e}}/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class ud{constructor(e,n){if(!isFinite(e)||e<-90||e>90)throw new it(Se.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(n)||n<-180||n>180)throw new it(Se.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=e,this._long=n}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return Cn(this._lat,e._lat)||Cn(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:ud._jsonSchemaVersion}}static fromJSON(e){if(p3(e,ud._jsonSchema))return new ud(e.latitude,e.longitude)}}ud._jsonSchemaVersion="firestore/geoPoint/1.0",ud._jsonSchema={type:Ri("string",ud._jsonSchemaVersion),latitude:Ri("number"),longitude:Ri("number")};/**
|
||
* @license
|
||
* Copyright 2024 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class jc{constructor(e){this._values=(e||[]).map(n=>n)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(r,i){if(r.length!==i.length)return!1;for(let s=0;s<r.length;++s)if(r[s]!==i[s])return!1;return!0}(this._values,e._values)}toJSON(){return{type:jc._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(p3(e,jc._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every(n=>typeof n=="number"))return new jc(e.vectorValues);throw new it(Se.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}jc._jsonSchemaVersion="firestore/vectorValue/1.0",jc._jsonSchema={type:Ri("string",jc._jsonSchemaVersion),vectorValues:Ri("object")};/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/const wKe=/^__.*__$/;class xKe{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return this.fieldMask!==null?new w0(e,this.data,this.fieldMask,n,this.fieldTransforms):new m3(e,this.data,n,this.fieldTransforms)}}class fye{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return new w0(e,this.data,this.fieldMask,n,this.fieldTransforms)}}function pye(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Pt(40011,{dataSource:t})}}class yI{constructor(e,n,r,i,s,o){this.settings=e,this.databaseId=n,this.serializer=r,this.ignoreUndefinedProperties=i,s===void 0&&this.validatePath(),this.fieldTransforms=s||[],this.fieldMask=o||[]}get path(){return this.settings.path}get dataSource(){return this.settings.dataSource}contextWith(e){return new yI({...this.settings,...e},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}childContextForField(e){var i;const n=(i=this.path)==null?void 0:i.child(e),r=this.contextWith({path:n,arrayElement:!1});return r.validatePathSegment(e),r}childContextForFieldPath(e){var i;const n=(i=this.path)==null?void 0:i.child(e),r=this.contextWith({path:n,arrayElement:!1});return r.validatePath(),r}childContextForArray(e){return this.contextWith({path:void 0,arrayElement:!0})}createError(e){return R7(e,this.settings.methodName,this.settings.hasConverter||!1,this.path,this.settings.targetDoc)}contains(e){return this.fieldMask.find(n=>e.isPrefixOf(n))!==void 0||this.fieldTransforms.find(n=>e.isPrefixOf(n.field))!==void 0}validatePath(){if(this.path)for(let e=0;e<this.path.length;e++)this.validatePathSegment(this.path.get(e))}validatePathSegment(e){if(e.length===0)throw this.createError("Document fields must not be empty");if(pye(this.dataSource)&&wKe.test(e))throw this.createError('Document fields cannot begin and end with "__"')}}class _Ke{constructor(e,n,r){this.databaseId=e,this.ignoreUndefinedProperties=n,this.serializer=r||hI(e)}createContext(e,n,r,i=!1){return new yI({dataSource:e,methodName:n,targetDoc:r,path:As.emptyPath(),arrayElement:!1,hasConverter:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function wH(t){const e=t._freezeSettings(),n=hI(t._databaseId);return new _Ke(t._databaseId,!!e.ignoreUndefinedProperties,n)}function SKe(t,e,n,r,i,s={}){const o=t.createContext(s.merge||s.mergeFields?2:0,e,n,i);kH("Data must be an object, but it was:",o,r);const a=gye(r,o);let l,c;if(s.merge)l=new Ua(o.fieldMask),c=o.fieldTransforms;else if(s.mergeFields){const u=[];for(const d of s.mergeFields){const h=U1(e,d,n);if(!o.contains(h))throw new it(Se.INVALID_ARGUMENT,`Field '${h}' is specified in your field mask but missing from your input data.`);bye(u,h)||u.push(h)}l=new Ua(u),c=o.fieldTransforms.filter(d=>l.covers(d.field))}else l=null,c=o.fieldTransforms;return new xKe(new la(a),l,c)}class b3 extends t2{_toFieldTransform(e){if(e.dataSource!==2)throw e.dataSource===1?e.createError(`${this._methodName}() can only appear at the top level of your update data`):e.createError(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof b3}}function mye(t,e,n){return new yI({dataSource:3,targetDoc:e.settings.targetDoc,methodName:t._methodName,arrayElement:n},e.databaseId,e.serializer,e.ignoreUndefinedProperties)}class xH extends t2{_toFieldTransform(e){return new nH(e.path,new HS)}isEqual(e){return e instanceof xH}}class _H extends t2{constructor(e,n){super(e),this.Ac=n}_toFieldTransform(e){const n=mye(this,e,!0),r=this.Ac.map(s=>Sy(s,n)),i=new Yw(r);return new nH(e.path,i)}isEqual(e){return e instanceof _H&&sf(this.Ac,e.Ac)}}class SH extends t2{constructor(e,n){super(e),this.Ac=n}_toFieldTransform(e){const n=mye(this,e,!0),r=this.Ac.map(s=>Sy(s,n)),i=new Zw(r);return new nH(e.path,i)}isEqual(e){return e instanceof SH&&sf(this.Ac,e.Ac)}}function kKe(t,e,n,r){const i=t.createContext(1,e,n);kH("Data must be an object, but it was:",i,r);const s=[],o=la.empty();b0(r,(l,c)=>{const u=vye(e,l,n);c=Ds(c);const d=i.childContextForFieldPath(u);if(c instanceof b3)s.push(u);else{const h=Sy(c,d);h!=null&&(s.push(u),o.set(u,h))}});const a=new Ua(s);return new fye(o,a,i.fieldTransforms)}function CKe(t,e,n,r,i,s){const o=t.createContext(1,e,n),a=[U1(e,r,n)],l=[i];if(s.length%2!=0)throw new it(Se.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let h=0;h<s.length;h+=2)a.push(U1(e,s[h])),l.push(s[h+1]);const c=[],u=la.empty();for(let h=a.length-1;h>=0;--h)if(!bye(c,a[h])){const f=a[h];let p=l[h];p=Ds(p);const g=o.childContextForFieldPath(f);if(p instanceof b3)c.push(f);else{const y=Sy(p,g);y!=null&&(c.push(f),u.set(f,y))}}const d=new Ua(c);return new fye(u,d,o.fieldTransforms)}function EKe(t,e,n,r=!1){return Sy(n,t.createContext(r?4:3,e))}function Sy(t,e){if(yye(t=Ds(t)))return kH("Unsupported field value:",e,t),gye(t,e);if(t instanceof t2)return function(r,i){if(!pye(i.dataSource))throw i.createError(`${r._methodName}() can only be used with update() and set()`);if(!i.path)throw i.createError(`${r._methodName}() is not currently supported inside arrays`);const s=r._toFieldTransform(i);s&&i.fieldTransforms.push(s)}(t,e),null;if(t===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.arrayElement&&e.dataSource!==4)throw e.createError("Nested arrays are not supported");return function(r,i){const s=[];let o=0;for(const a of r){let l=Sy(a,i.childContextForArray(o));l==null&&(l={nullValue:"NULL_VALUE"}),s.push(l),o++}return{arrayValue:{values:s}}}(t,e)}return function(r,i){if((r=Ds(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return aWe(i.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const s=ir.fromDate(r);return{timestampValue:E7(i.serializer,s)}}if(r instanceof ir){const s=new ir(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:E7(i.serializer,s)}}if(r instanceof ud)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof Dl)return{bytesValue:R1e(i.serializer,r._byteString)};if(r instanceof vi){const s=i.databaseId,o=r.firestore._databaseId;if(!o.isEqual(s))throw i.createError(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${s.projectId}/${s.database}`);return{referenceValue:sH(r.firestore._databaseId||i.databaseId,r._key.path)}}if(r instanceof jc)return function(o,a){const l=o instanceof jc?o.toArray():o;return{mapValue:{fields:{[i1e]:{stringValue:s1e},[_7]:{arrayValue:{values:l.map(u=>{if(typeof u!="number")throw a.createError("VectorValues must only contain numeric values.");return tH(a.serializer,u)})}}}}}}(r,i);if(z1e(r))return r._toProto(i.serializer);throw i.createError(`Unsupported field value: ${nI(r)}`)}(t,e)}function gye(t,e){const n={};return Qge(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):b0(t,(r,i)=>{const s=Sy(i,e.childContextForField(r));s!=null&&(n[r]=s)}),{mapValue:{fields:n}}}function yye(t){return!(typeof t!="object"||t===null||t instanceof Array||t instanceof Date||t instanceof ir||t instanceof ud||t instanceof Dl||t instanceof vi||t instanceof t2||t instanceof jc||z1e(t))}function kH(t,e,n){if(!yye(n)||!Zge(n)){const r=nI(n);throw r==="an object"?e.createError(t+" a custom object"):e.createError(t+" "+r)}}function U1(t,e,n){if((e=Ds(e))instanceof gI)return e._internalPath;if(typeof e=="string")return vye(t,e);throw R7("Field path arguments must be of type string or ",t,!1,void 0,n)}const TKe=new RegExp("[~\\*/\\[\\]]");function vye(t,e,n){if(e.search(TKe)>=0)throw R7(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new gI(...e.split("."))._internalPath}catch{throw R7(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function R7(t,e,n,r,i){const s=r&&!r.isEmpty(),o=i!==void 0;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let l="";return(s||o)&&(l+=" (found",s&&(l+=` in field ${r}`),o&&(l+=` in document ${i}`),l+=")"),new it(Se.INVALID_ARGUMENT,a+t+l)}function bye(t,e){return t.some(n=>n.isEqual(e))}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class AKe{convertValue(e,n="none"){switch(Vm(e)){case 0:return null;case 1:return e.booleanValue;case 2:return gi(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,n);case 5:return e.stringValue;case 6:return this.convertBytes(Fm(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,n);case 11:return this.convertObject(e.mapValue,n);case 10:return this.convertVectorValue(e.mapValue);default:throw Pt(62114,{value:e})}}convertObject(e,n){return this.convertObjectMap(e.fields,n)}convertObjectMap(e,n="none"){const r={};return b0(e,(i,s)=>{r[i]=this.convertValue(s,n)}),r}convertVectorValue(e){var r,i,s;const n=(s=(i=(r=e.fields)==null?void 0:r[_7].arrayValue)==null?void 0:i.values)==null?void 0:s.map(o=>gi(o.doubleValue));return new jc(n)}convertGeoPoint(e){return new ud(gi(e.latitude),gi(e.longitude))}convertArray(e,n){return(e.values||[]).map(r=>this.convertValue(r,n))}convertServerTimestamp(e,n){switch(n){case"previous":const r=sI(e);return r==null?null:this.convertValue(r,n);case"estimate":return this.convertTimestamp(BS(e));default:return null}}convertTimestamp(e){const n=Bm(e);return new ir(n.seconds,n.nanos)}convertDocumentKey(e,n){const r=Ar.fromString(e);er(L1e(r),9688,{name:e});const i=new FS(r.get(1),r.get(3)),s=new At(r.popFirst(5));return i.isEqual(n)||cf(`Document ${s} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${n.projectId}/${n.database}) instead.`),s}}/**
|
||
* @license
|
||
* Copyright 2024 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class wye extends AKe{constructor(e){super(),this.firestore=e}convertBytes(e){return new Dl(e)}convertReference(e){const n=this.convertDocumentKey(e,this.firestore._databaseId);return new vi(this.firestore,null,n)}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function xye(){return new b3("deleteField")}function df(){return new xH("serverTimestamp")}function IKe(...t){return new _H("arrayUnion",t)}function RKe(...t){return new SH("arrayRemove",t)}const fJ="@firebase/firestore",pJ="4.12.0";/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function mJ(t){return function(n,r){if(typeof n!="object"||n===null)return!1;const i=n;for(const s of r)if(s in i&&typeof i[s]=="function")return!0;return!1}(t,["next","error","complete"])}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/class _ye{constructor(e,n,r,i,s){this._firestore=e,this._userDataWriter=n,this._key=r,this._document=i,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new vi(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new MKe(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){var e;return((e=this._document)==null?void 0:e.data.clone().value.mapValue.fields)??void 0}get(e){if(this._document){const n=this._document.data.field(U1("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n)}}}class MKe extends _ye{data(){return super.data()}}/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function NKe(t){if(t.limitType==="L"&&t.explicitOrderBy.length===0)throw new it(Se.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class CH{}class EH extends CH{}function k4(t,e,...n){let r=[];e instanceof CH&&r.push(e),r=r.concat(n),function(s){const o=s.filter(l=>l instanceof TH).length,a=s.filter(l=>l instanceof vI).length;if(o>1||o>0&&a>0)throw new it(Se.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(r);for(const i of r)t=i._apply(t);return t}class vI extends EH{constructor(e,n,r){super(),this._field=e,this._op=n,this._value=r,this.type="where"}static _create(e,n,r){return new vI(e,n,r)}_apply(e){const n=this._parse(e);return Cye(e._query,n),new e2(e.firestore,e.converter,VL(e._query,n))}_parse(e){const n=wH(e.firestore);return function(s,o,a,l,c,u,d){let h;if(c.isKeyField()){if(u==="array-contains"||u==="array-contains-any")throw new it(Se.INVALID_ARGUMENT,`Invalid Query. You can't perform '${u}' queries on documentId().`);if(u==="in"||u==="not-in"){yJ(d,u);const p=[];for(const g of d)p.push(gJ(l,s,g));h={arrayValue:{values:p}}}else h=gJ(l,s,d)}else u!=="in"&&u!=="not-in"&&u!=="array-contains-any"||yJ(d,u),h=EKe(a,o,d,u==="in"||u==="not-in");return Ai.create(c,u,h)}(e._query,"where",n,e.firestore._databaseId,this._field,this._op,this._value)}}function bI(t,e,n){const r=e,i=U1("where",t);return vI._create(i,r,n)}class TH extends CH{constructor(e,n){super(),this.type=e,this._queryConstraints=n}static _create(e,n){return new TH(e,n)}_parse(e){const n=this._queryConstraints.map(r=>r._parse(e)).filter(r=>r.getFilters().length>0);return n.length===1?n[0]:Yc.create(n,this._getOperator())}_apply(e){const n=this._parse(e);return n.getFilters().length===0?e:(function(i,s){let o=i;const a=s.getFlattenedFilters();for(const l of a)Cye(o,l),o=VL(o,l)}(e._query,n),new e2(e.firestore,e.converter,VL(e._query,n)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}class AH extends EH{constructor(e,n){super(),this._field=e,this._direction=n,this.type="orderBy"}static _create(e,n){return new AH(e,n)}_apply(e){const n=function(i,s,o){if(i.startAt!==null)throw new it(Se.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(i.endAt!==null)throw new it(Se.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new $S(s,o)}(e._query,this._field,this._direction);return new e2(e.firestore,e.converter,Jqe(e._query,n))}}function Sye(t,e="asc"){const n=e,r=U1("orderBy",t);return AH._create(r,n)}class IH extends EH{constructor(e,n,r){super(),this.type=e,this._limit=n,this._limitType=r}static _create(e,n,r){return new IH(e,n,r)}_apply(e){return new e2(e.firestore,e.converter,k7(e._query,this._limit,this._limitType))}}function kye(t){return kqe("limit",t),IH._create("limit",t,"F")}function gJ(t,e,n){if(typeof(n=Ds(n))=="string"){if(n==="")throw new it(Se.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!f1e(e)&&n.indexOf("/")!==-1)throw new it(Se.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(Ar.fromString(n));if(!At.isDocumentKey(r))throw new it(Se.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return RQ(t,new At(r))}if(n instanceof vi)return RQ(t,n._key);throw new it(Se.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${nI(n)}.`)}function yJ(t,e){if(!Array.isArray(t)||t.length===0)throw new it(Se.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function Cye(t,e){const n=function(i,s){for(const o of i)for(const a of o.getFlattenedFilters())if(s.indexOf(a.op)>=0)return a.op;return null}(t.filters,function(i){switch(i){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(n!==null)throw n===e.op?new it(Se.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new it(Se.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}function OKe(t,e,n){let r;return r=t?t.toFirestore(e):e,r}class C4{constructor(e,n){this.hasPendingWrites=e,this.fromCache=n}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class l1 extends _ye{constructor(e,n,r,i,s,o){super(e,n,r,i,o),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const n=new n6(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(n,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,n={}){if(this._document){const r=this._document.data.field(U1("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,n.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new it(Se.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,n={};return n.type=l1._jsonSchemaVersion,n.bundle="",n.bundleSource="DocumentSnapshot",n.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?n:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),n.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),n)}}l1._jsonSchemaVersion="firestore/documentSnapshot/1.0",l1._jsonSchema={type:Ri("string",l1._jsonSchemaVersion),bundleSource:Ri("string","DocumentSnapshot"),bundleName:Ri("string"),bundle:Ri("string")};class n6 extends l1{data(e={}){return super.data(e)}}class ub{constructor(e,n,r,i){this._firestore=e,this._userDataWriter=n,this._snapshot=i,this.metadata=new C4(i.hasPendingWrites,i.fromCache),this.query=r}get docs(){const e=[];return this.forEach(n=>e.push(n)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,n){this._snapshot.docs.forEach(r=>{e.call(n,new n6(this._firestore,this._userDataWriter,r.key,r,new C4(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const n=!!e.includeMetadataChanges;if(n&&this._snapshot.excludesMetadataChanges)throw new it(Se.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===n||(this._cachedChanges=function(i,s){if(i._snapshot.oldDocs.isEmpty()){let o=0;return i._snapshot.docChanges.map(a=>{const l=new n6(i._firestore,i._userDataWriter,a.doc.key,a.doc,new C4(i._snapshot.mutatedKeys.has(a.doc.key),i._snapshot.fromCache),i.query.converter);return a.doc,{type:"added",doc:l,oldIndex:-1,newIndex:o++}})}{let o=i._snapshot.oldDocs;return i._snapshot.docChanges.filter(a=>s||a.type!==3).map(a=>{const l=new n6(i._firestore,i._userDataWriter,a.doc.key,a.doc,new C4(i._snapshot.mutatedKeys.has(a.doc.key),i._snapshot.fromCache),i.query.converter);let c=-1,u=-1;return a.type!==0&&(c=o.indexOf(a.doc.key),o=o.delete(a.doc.key)),a.type!==1&&(o=o.add(a.doc),u=o.indexOf(a.doc.key)),{type:DKe(a.type),doc:l,oldIndex:c,newIndex:u}})}}(this,n),this._cachedChangesIncludeMetadataChanges=n),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new it(Se.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=ub._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=Y$.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const n=[],r=[],i=[];return this.docs.forEach(s=>{s._document!==null&&(n.push(s._document),r.push(this._userDataWriter.convertObjectMap(s._document.data.value.mapValue.fields,"previous")),i.push(s.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function DKe(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Pt(61501,{type:t})}}/**
|
||
* @license
|
||
* Copyright 2022 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/ub._jsonSchemaVersion="firestore/querySnapshot/1.0",ub._jsonSchema={type:Ri("string",ub._jsonSchemaVersion),bundleSource:Ri("string","QuerySnapshot"),bundleName:Ri("string"),bundle:Ri("string")};/**
|
||
* @license
|
||
* Copyright 2020 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/function PKe(t){t=Fh(t,vi);const e=Fh(t.firestore,Jw),n=bH(e);return hKe(n,t._key).then(r=>Aye(e,t,r))}function ky(t,e,n,...r){t=Fh(t,vi);const i=Fh(t.firestore,Jw),s=wH(i);let o;return o=typeof(e=Ds(e))=="string"||e instanceof gI?CKe(s,"updateDoc",t._key,e,n,r):kKe(s,"updateDoc",t._key,e),Tye(i,[o.toMutation(t._key,ld.exists(!0))])}function Eye(t,e){const n=Fh(t.firestore,Jw),r=hye(t),i=OKe(t.converter,e),s=wH(t.firestore);return Tye(n,[SKe(s,"addDoc",r._key,i,t.converter!==null,{}).toMutation(r._key,ld.exists(!1))]).then(()=>r)}function RH(t,...e){var c,u,d;t=Ds(t);let n={includeMetadataChanges:!1,source:"default"},r=0;typeof e[r]!="object"||mJ(e[r])||(n=e[r++]);const i={includeMetadataChanges:n.includeMetadataChanges,source:n.source};if(mJ(e[r])){const h=e[r];e[r]=(c=h.next)==null?void 0:c.bind(h),e[r+1]=(u=h.error)==null?void 0:u.bind(h),e[r+2]=(d=h.complete)==null?void 0:d.bind(h)}let s,o,a;if(t instanceof vi)o=Fh(t.firestore,Jw),a=oI(t._key.path),s={next:h=>{e[r]&&e[r](Aye(o,t,h))},error:e[r+1],complete:e[r+2]};else{const h=Fh(t,e2);o=Fh(h.firestore,Jw),a=h._query;const f=new wye(o);s={next:p=>{e[r]&&e[r](new ub(o,f,h,p))},error:e[r+1],complete:e[r+2]},NKe(t._query)}const l=bH(o);return dKe(l,a,i,s)}function Tye(t,e){const n=bH(t);return fKe(n,e)}function Aye(t,e,n){const r=n.docs.get(e._key),i=new wye(t);return new l1(t,i,e._key,r,new C4(n.hasPendingWrites,n.fromCache),e.converter)}(function(e,n=!0){hqe(Wx),$w(new j1("firestore",(r,{instanceIdentifier:i,options:s})=>{const o=r.getProvider("app").getImmediate(),a=new Jw(new mqe(r.getProvider("auth-internal")),new vqe(o,r.getProvider("app-check-internal")),Lqe(o,i),o);return s={useFetchStreams:n,...s},a._setSettings(s),a},"PUBLIC").setMultipleInstances(!0)),vm(fJ,pJ,e),vm(fJ,pJ,"esm2020")})();const Iye=S0e(Z9.firebase),Rye=UBe(Iye),Mye=vKe(Iye);async function vJ(){try{const{token:t}=await Bn.getFirebaseToken();await Rje(Rye,t)}catch(t){Zi(t,{scope:"auth.firebase"})}}const Dn=_f(t=>({status:"idle",user:null,isRequestingCode:!1,isSigningIn:!1,isSigningOut:!1,error:null,restoreSession:async()=>{if(!Rh.getState().token){t({status:"unauthenticated"});return}t({status:"restoring"});try{const n=await Bn.me();await vJ(),t({status:"authenticated",user:n})}catch(n){Zi(n,{scope:"auth.restore"}),Rh.getState().clearToken(),t({status:"unauthenticated",user:null})}},refreshUser:async()=>{const e=await Bn.me();t({user:e})},requestCode:async e=>{t({isRequestingCode:!0,error:null});try{await Bn.requestCode({email:e})}catch(n){const r=n instanceof qw?n.message:"Failed to send code";throw t({error:r}),n}finally{t({isRequestingCode:!1})}},signIn:async(e,n)=>{t({isSigningIn:!0,error:null});try{const{human:r,token:i}=await Bn.signIn({email:e,code:n});Rh.getState().setToken(i),await vJ(),t({status:"authenticated",user:r})}catch(r){const i=r instanceof qw?r.message:"Failed to sign in";throw t({error:i}),r}finally{t({isSigningIn:!1})}},signOut:async()=>{t({isSigningOut:!0});try{await Bn.signOut()}catch(e){Zi(e,{scope:"auth.signOut"})}finally{await Oje(Rye).catch(e=>Zi(e,{scope:"auth.firebaseSignOut"})),Rh.getState().clearToken(),t({status:"unauthenticated",user:null,isSigningOut:!1,error:null})}},clearError:()=>t({error:null})}));Rh.subscribe((t,e)=>{e.token&&!t.token&&Dn.getState().status==="authenticated"&&Dn.setState({status:"unauthenticated",user:null,error:null})});/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Nye=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const LKe=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const zKe=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const bJ=t=>{const e=zKe(t);return e.charAt(0).toUpperCase()+e.slice(1)};/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/var jKe={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"};/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const BKe=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const FKe=x.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>x.createElement("svg",{ref:l,...jKe,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Nye("lucide",i),...!s&&!BKe(a)&&{"aria-hidden":"true"},...a},[...o.map(([c,u])=>x.createElement(c,u)),...Array.isArray(s)?s:[s]]));/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Nt=(t,e)=>{const n=x.forwardRef(({className:r,...i},s)=>x.createElement(FKe,{ref:s,iconNode:e,className:Nye(`lucide-${LKe(bJ(t))}`,`lucide-${t}`,r),...i}));return n.displayName=bJ(t),n};/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const VKe=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],MH=Nt("arrow-left",VKe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const $Ke=[["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"}]],HKe=Nt("book-open",$Ke);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const UKe=[["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"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],Oye=Nt("calendar-days",UKe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const qKe=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],NH=Nt("camera",qKe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const WKe=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],wI=Nt("check",WKe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const GKe=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Dye=Nt("chevron-down",GKe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const KKe=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],YKe=Nt("chevron-left",KKe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ZKe=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],OH=Nt("chevron-right",ZKe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const XKe=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],QKe=Nt("chevron-up",XKe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const JKe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Pye=Nt("circle-check",JKe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const eYe=[["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"}]],tYe=Nt("circle-question-mark",eYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const nYe=[["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"}]],Lye=Nt("copy",nYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const rYe=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],iYe=Nt("credit-card",rYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const sYe=[["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"}]],DH=Nt("download",sYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const oYe=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],aYe=Nt("ellipsis-vertical",oYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const lYe=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],PH=Nt("external-link",lYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const cYe=[["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"}]],zye=Nt("file-text",cYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const uYe=[["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"}]],w3=Nt("file",uYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const dYe=[["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"}]],LH=Nt("folder",dYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const hYe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],US=Nt("globe",hYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const fYe=[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]],pYe=Nt("headphones",fYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const mYe=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],wJ=Nt("house",mYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const gYe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],jye=Nt("image",gYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const yYe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Bye=Nt("info",yYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const vYe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]],bYe=Nt("life-buoy",vYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const wYe=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],xYe=Nt("list",wYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const _Ye=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],xI=Nt("loader-circle",_Ye);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const SYe=[["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"}]],M7=Nt("lock",SYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const kYe=[["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"}]],CYe=Nt("log-out",kYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const EYe=[["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"}]],Fye=Nt("mail",EYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const TYe=[["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"}]],AYe=Nt("message-square",TYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const IYe=[["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"}]],zH=Nt("mic",IYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const RYe=[["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"}]],MYe=Nt("octagon-x",RYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const NYe=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Vye=Nt("paperclip",NYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const OYe=[["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"}]],$ye=Nt("pencil",OYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const DYe=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],qS=Nt("plus",DYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const PYe=[["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"}]],jH=Nt("radio",PYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const LYe=[["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"}]],zYe=Nt("send",LYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const jYe=[["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"}]],BH=Nt("settings",jYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const BYe=[["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"}]],Hye=Nt("shield",BYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const FYe=[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]],VYe=Nt("sticky-note",FYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const $Ye=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],x3=Nt("trash-2",$Ye);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const HYe=[["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"}]],Uye=Nt("triangle-alert",HYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const UYe=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],qYe=Nt("type",UYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const WYe=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],GYe=Nt("upload",WYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const KYe=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],QL=Nt("user-plus",KYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const YYe=[["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"}]],_I=Nt("users",YYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ZYe=[["path",{d:"M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196",key:"w8jjjt"}],["path",{d:"M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2",key:"1xawa7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],XYe=Nt("video-off",ZYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const QYe=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],JL=Nt("video",QYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const JYe=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],qye=Nt("volume-2",JYe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const eZe=[["path",{d:"M16 9a5 5 0 0 1 .95 2.293",key:"1fgyg8"}],["path",{d:"M19.364 5.636a9 9 0 0 1 1.889 9.96",key:"l3zxae"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"m7 7-.587.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298V11",key:"1gbwow"}],["path",{d:"M9.828 4.172A.686.686 0 0 1 11 4.657v.686",key:"s2je0y"}]],tZe=Nt("volume-off",eZe);/**
|
||
* @license lucide-react v0.575.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const nZe=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Zc=Nt("x",nZe),xJ=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,_J=ji,FH=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return _J(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=e,o=Object.keys(i).map(c=>{const u=n==null?void 0:n[c],d=s==null?void 0:s[c];if(u===null)return null;const h=xJ(u)||xJ(d);return i[c][h]}),a=n&&Object.entries(n).reduce((c,u)=>{let[d,h]=u;return h===void 0||(c[d]=h),c},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:h,...f}=u;return Object.entries(f).every(p=>{let[g,y]=p;return Array.isArray(y)?y.includes({...s,...a}[g]):{...s,...a}[g]===y})?[...c,d,h]:c},[]);return _J(t,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},rZe=FH("focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground",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 dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",destructive:"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",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-3 has-data-[icon=inline-start]:pl-3",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 Rt({className:t,variant:e="default",size:n="default",asChild:r=!1,...i}){const s=r?$V:"button";return m.jsx(s,{"data-slot":"button","data-variant":e,"data-size":n,className:He(rZe({variant:e,size:n,className:t})),...i})}const Ru=_f(t=>({payload:null,pendingNav:null,setPayload:e=>t({payload:e}),setPendingNav:e=>t({pendingNav:e?{...e,nonce:Date.now()}:null})}));function iZe(){if(typeof navigator>"u")return"web";const t=navigator.userAgent;return/Mac|iPhone|iPad|iPod/i.test(t)?"darwin":/Win/i.test(t)?"win32":/Linux|X11/i.test(t)?"linux":"web"}function sZe(t,e){const n=document.createElement("a");n.href=t,e&&(n.download=e),n.target="_blank",n.rel="noopener noreferrer",document.body.appendChild(n),n.click(),document.body.removeChild(n)}const SJ=typeof document<"u"?document.title:"llink";function oZe(t){typeof document>"u"||(document.title=t>0?`(${t}) ${SJ}`:SJ)}const dE="Not supported in the web app",aZe={kind:"web",window:{minimize:()=>{},maximize:()=>{},fullscreen:()=>{},close:()=>{},onMaximizeChange:()=>()=>{},platform:iZe()},huddle:{isSupported:!1,open:()=>{throw new Error(dE)},close:()=>{},getScreenSources:async()=>{throw new Error(dE)}},screenRecord:{isSupported:!1,start:()=>{throw new Error(dE)},stop:()=>{},cancel:()=>{},onStopRequested:()=>()=>{},getScreenSources:async()=>{throw new Error(dE)}},autoplay:{play:t=>{Ru.getState().setPayload(t)},dismiss:()=>{Ru.getState().setPayload(null)},navigate:t=>{Ru.getState().setPayload(null),Ru.getState().setPendingNav(t)},onPlay:t=>Ru.subscribe((e,n)=>{e.payload&&e.payload!==n.payload&&t(e.payload)}),onStop:t=>Ru.subscribe((e,n)=>{!e.payload&&n.payload&&t()}),onNavigate:t=>Ru.subscribe((e,n)=>{e.pendingNav&&e.pendingNav!==n.pendingNav&&t({networkId:e.pendingNav.networkId,streamId:e.pendingNav.streamId})})},link:{fetchMetadata:t=>Bn.getLinkMetadata(t).catch(()=>null),openExternal:async t=>{window.open(t,"_blank","noopener,noreferrer")}},attachment:{download:sZe},app:{setDockBadge:oZe,getVersion:async()=>"1.6.0"},deepLink:{getPending:()=>Promise.resolve(null),onNavigate:t=>()=>{}}},lZe="https://flowylabs.ai/llink/download",cr=aZe,cZe=cr.window.platform==="darwin",Yu=cZe?"⌘":"Ctrl";function n2(){const[t,e]=x.useState(!1);return x.useEffect(()=>cr.window.onMaximizeChange(e),[]),null}function x0({className:t,type:e,...n}){return m.jsx("input",{type:e,"data-slot":"input",className:He("dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 h-8 rounded-lg border bg-transparent px-2.5 py-1 text-base transition-colors file:h-6 file:text-sm file:font-medium focus-visible:ring-3 aria-invalid:ring-3 md:text-sm file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",t),...n})}function zl({className:t,...e}){return m.jsx(yOe,{"data-slot":"label",className:He("gap-2 text-sm leading-none font-medium group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50 flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed",t),...e})}function Wye({className:t,...e}){return m.jsx("h3",{className:He("scroll-m-20 text-2xl font-semibold tracking-tight",t),...e})}function Um({className:t,...e}){return m.jsx("small",{className:He("text-sm leading-none font-medium",t),...e})}function gr({className:t,...e}){return m.jsx("p",{className:He("text-muted-foreground text-sm",t),...e})}const uZe=25*1024*1024,ON=10,Gye="[email protected]",Kye="https://flowylabs.ai/llink/privacy",Yye="https://flowylabs.ai/llink/tos";function dZe({onCodeSent:t}){const[e,n]=x.useState(""),r=Dn(l=>l.isRequestingCode),i=Dn(l=>l.error),s=Dn(l=>l.requestCode),o=Dn(l=>l.clearError),a=async l=>{l.preventDefault();try{await s(e),t(e)}catch{}};return m.jsxs("form",{onSubmit:a,className:"flex flex-col gap-4",children:[m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx(Wye,{children:"Welcome"}),m.jsx(gr,{children:"Enter your email to sign in or create an account. We'll send a code to verify it."})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(zl,{htmlFor:"email",children:"Email"}),m.jsx(x0,{id:"email",type:"email",placeholder:"[email protected]",value:e,onChange:l=>{n(l.target.value),i&&o()},required:!0,autoFocus:!0})]}),i&&m.jsx("p",{className:"text-sm text-destructive",children:i}),m.jsx(Rt,{type:"submit",disabled:r||!e,children:r?"Sending...":"Continue"}),m.jsxs(gr,{className:"text-center text-xs",children:["By continuing, you agree to our"," ",m.jsx("button",{type:"button",onClick:()=>cr.link.openExternal(Yye),className:"underline underline-offset-2 hover:text-foreground",children:"Terms of Service"})," ","and"," ",m.jsx("button",{type:"button",onClick:()=>cr.link.openExternal(Kye),className:"underline underline-offset-2 hover:text-foreground",children:"Privacy Policy"}),"."]})]})}function hZe({email:t,onBack:e}){const[n,r]=x.useState(""),i=Dn(c=>c.isSigningIn),s=Dn(c=>c.error),o=Dn(c=>c.signIn),a=Dn(c=>c.clearError),l=async c=>{c.preventDefault();try{await o(t,n)}catch{}};return m.jsxs("form",{onSubmit:l,className:"flex flex-col gap-4",children:[m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx(Wye,{children:"Check your email"}),m.jsxs(gr,{children:["We sent a code to ",m.jsx("strong",{className:"text-foreground",children:t}),"."]})]}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[m.jsx(zl,{htmlFor:"code",children:"Code"}),m.jsx(x0,{id:"code",type:"text",inputMode:"numeric",placeholder:"Enter code",value:n,onChange:c=>{r(c.target.value),s&&a()},required:!0,autoFocus:!0})]}),s&&m.jsx("p",{className:"text-sm text-destructive",children:s}),m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx(Rt,{type:"submit",disabled:i||!n,children:i?"Signing in...":"Sign in"}),m.jsx(Rt,{type:"button",variant:"ghost",onClick:e,children:"Back"})]})]})}function fZe(){const[t,e]=x.useState("email"),[n,r]=x.useState("");return m.jsxs("div",{className:"flex h-screen flex-col",children:[m.jsx("div",{className:"drag-region flex items-center gap-3 border-b px-3 py-1",children:m.jsx(n2,{})}),m.jsx("div",{className:"flex flex-1 items-center justify-center p-4",children:m.jsx("div",{className:"w-full max-w-sm",children:t==="email"?m.jsx(dZe,{onCodeSent:i=>{r(i),e("code")}}):m.jsx(hZe,{email:n,onBack:()=>e("email")})})})]})}var Cy=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},pZe={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Np,DF,Ole,mZe=(Ole=class{constructor(){te(this,Np,pZe);te(this,DF,!1)}setTimeoutProvider(t){W(this,Np,t)}setTimeout(t,e){return O(this,Np).setTimeout(t,e)}clearTimeout(t){O(this,Np).clearTimeout(t)}setInterval(t,e){return O(this,Np).setInterval(t,e)}clearInterval(t){O(this,Np).clearInterval(t)}},Np=new WeakMap,DF=new WeakMap,Ole),Cg=new mZe;function gZe(t){setTimeout(t,0)}var q1=typeof window>"u"||"Deno"in globalThis;function Ys(){}function yZe(t,e){return typeof t=="function"?t(e):t}function ez(t){return typeof t=="number"&&t>=0&&t!==1/0}function Zye(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Sm(t,e){return typeof t=="function"?t(e):t}function kl(t,e){return typeof t=="function"?t(e):t}function kJ(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==VH(o,e.options))return!1}else if(!WS(e.queryKey,o))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||i&&i!==e.state.fetchStatus||s&&!s(e))}function CJ(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(W1(e.options.mutationKey)!==W1(s))return!1}else if(!WS(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function VH(t,e){return((e==null?void 0:e.queryKeyHashFn)||W1)(t)}function W1(t){return JSON.stringify(t,(e,n)=>tz(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function WS(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>WS(t[n],e[n])):!1}var vZe=Object.prototype.hasOwnProperty;function $H(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=EJ(t)&&EJ(e);if(!r&&!(tz(t)&&tz(e)))return e;const s=(r?t:Object.keys(t)).length,o=r?e:Object.keys(e),a=o.length,l=r?new Array(a):{};let c=0;for(let u=0;u<a;u++){const d=r?u:o[u],h=t[d],f=e[d];if(h===f){l[d]=h,(r?u<s:vZe.call(t,d))&&c++;continue}if(h===null||f===null||typeof h!="object"||typeof f!="object"){l[d]=f;continue}const p=$H(h,f,n+1);l[d]=p,p===h&&c++}return s===a&&c===s?t:l}function GS(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function EJ(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function tz(t){if(!TJ(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!TJ(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function TJ(t){return Object.prototype.toString.call(t)==="[object Object]"}function bZe(t){return new Promise(e=>{Cg.setTimeout(e,t)})}function nz(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?$H(t,e):e}function wZe(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function xZe(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var Ey=Symbol();function Xye(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Ey?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function HH(t,e){return typeof t=="function"?t(...e):!!t}function _Ze(t,e,n){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),t}var Pg,Op,Ib,Dle,SZe=(Dle=class extends Cy{constructor(){super();te(this,Pg);te(this,Op);te(this,Ib);W(this,Ib,e=>{if(!q1&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){O(this,Op)||this.setEventListener(O(this,Ib))}onUnsubscribe(){var e;this.hasListeners()||((e=O(this,Op))==null||e.call(this),W(this,Op,void 0))}setEventListener(e){var n;W(this,Ib,e),(n=O(this,Op))==null||n.call(this),W(this,Op,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){O(this,Pg)!==e&&(W(this,Pg,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof O(this,Pg)=="boolean"?O(this,Pg):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Pg=new WeakMap,Op=new WeakMap,Ib=new WeakMap,Dle),UH=new SZe;function rz(){let t,e;const n=new Promise((i,s)=>{t=i,e=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}var kZe=gZe;function CZe(){let t=[],e=0,n=a=>{a()},r=a=>{a()},i=kZe;const s=a=>{e?t.push(a):i(()=>{n(a)})},o=()=>{const a=t;t=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var di=CZe(),Rb,Dp,Mb,Ple,EZe=(Ple=class extends Cy{constructor(){super();te(this,Rb,!0);te(this,Dp);te(this,Mb);W(this,Mb,e=>{if(!q1&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){O(this,Dp)||this.setEventListener(O(this,Mb))}onUnsubscribe(){var e;this.hasListeners()||((e=O(this,Dp))==null||e.call(this),W(this,Dp,void 0))}setEventListener(e){var n;W(this,Mb,e),(n=O(this,Dp))==null||n.call(this),W(this,Dp,e(this.setOnline.bind(this)))}setOnline(e){O(this,Rb)!==e&&(W(this,Rb,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return O(this,Rb)}},Rb=new WeakMap,Dp=new WeakMap,Mb=new WeakMap,Ple),N7=new EZe;function TZe(t){return Math.min(1e3*2**t,3e4)}function Qye(t){return(t??"online")==="online"?N7.isOnline():!0}var iz=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function Jye(t){let e=!1,n=0,r;const i=rz(),s=()=>i.status!=="pending",o=g=>{var y;if(!s()){const v=new iz(g);h(v),(y=t.onCancel)==null||y.call(t,v)}},a=()=>{e=!0},l=()=>{e=!1},c=()=>UH.isFocused()&&(t.networkMode==="always"||N7.isOnline())&&t.canRun(),u=()=>Qye(t.networkMode)&&t.canRun(),d=g=>{s()||(r==null||r(),i.resolve(g))},h=g=>{s()||(r==null||r(),i.reject(g))},f=()=>new Promise(g=>{var y;r=v=>{(s()||c())&&g(v)},(y=t.onPause)==null||y.call(t)}).then(()=>{var g;r=void 0,s()||(g=t.onContinue)==null||g.call(t)}),p=()=>{if(s())return;let g;const y=n===0?t.initialPromise:void 0;try{g=y??t.fn()}catch(v){g=Promise.reject(v)}Promise.resolve(g).then(d).catch(v=>{var T;if(s())return;const b=t.retry??(q1?0:3),_=t.retryDelay??TZe,S=typeof _=="function"?_(n,v):_,k=b===!0||typeof b=="number"&&n<b||typeof b=="function"&&b(n,v);if(e||!k){h(v);return}n++,(T=t.onFail)==null||T.call(t,n,v),bZe(S).then(()=>c()?void 0:f()).then(()=>{e?h(v):p()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?p():f().then(p),i)}}var Lg,Lle,eve=(Lle=class{constructor(){te(this,Lg)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ez(this.gcTime)&&W(this,Lg,Cg.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(q1?1/0:5*60*1e3))}clearGcTimeout(){O(this,Lg)&&(Cg.clearTimeout(O(this,Lg)),W(this,Lg,void 0))}},Lg=new WeakMap,Lle),zg,Nb,vl,jg,is,Uk,Bg,_c,th,zle,AZe=(zle=class extends eve{constructor(e){super();te(this,_c);te(this,zg);te(this,Nb);te(this,vl);te(this,jg);te(this,is);te(this,Uk);te(this,Bg);W(this,Bg,!1),W(this,Uk,e.defaultOptions),this.setOptions(e.options),this.observers=[],W(this,jg,e.client),W(this,vl,O(this,jg).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,W(this,zg,IJ(this.options)),this.state=e.state??O(this,zg),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=O(this,is))==null?void 0:e.promise}setOptions(e){if(this.options={...O(this,Uk),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=IJ(this.options);n.data!==void 0&&(this.setState(AJ(n.data,n.dataUpdatedAt)),W(this,zg,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,vl).remove(this)}setData(e,n){const r=nz(this.state.data,e,this.options);return Ot(this,_c,th).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){Ot(this,_c,th).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=O(this,is))==null?void 0:r.promise;return(i=O(this,is))==null||i.cancel(e),n?n.then(Ys).catch(Ys):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(O(this,zg))}isActive(){return this.observers.some(e=>kl(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ey||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Sm(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Zye(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=O(this,is))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=O(this,is))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),O(this,vl).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(O(this,is)&&(O(this,Bg)?O(this,is).cancel({revert:!0}):O(this,is).cancelRetry()),this.scheduleGc()),O(this,vl).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ot(this,_c,th).call(this,{type:"invalidate"})}async fetch(e,n){var l,c,u,d,h,f,p,g,y,v,b,_;if(this.state.fetchStatus!=="idle"&&((l=O(this,is))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(O(this,is))return O(this,is).continueRetry(),O(this,is).promise}if(e&&this.setOptions(e),!this.options.queryFn){const S=this.observers.find(k=>k.options.queryFn);S&&this.setOptions(S.options)}const r=new AbortController,i=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(W(this,Bg,!0),r.signal)})},s=()=>{const S=Xye(this.options,n),T=(()=>{const E={client:O(this,jg),queryKey:this.queryKey,meta:this.meta};return i(E),E})();return W(this,Bg,!1),this.options.persister?this.options.persister(S,T,this):S(T)},a=(()=>{const S={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:O(this,jg),state:this.state,fetchFn:s};return i(S),S})();(c=this.options.behavior)==null||c.onFetch(a,this),W(this,Nb,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&Ot(this,_c,th).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta}),W(this,is,Jye({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:S=>{S instanceof iz&&S.revert&&this.setState({...O(this,Nb),fetchStatus:"idle"}),r.abort()},onFail:(S,k)=>{Ot(this,_c,th).call(this,{type:"failed",failureCount:S,error:k})},onPause:()=>{Ot(this,_c,th).call(this,{type:"pause"})},onContinue:()=>{Ot(this,_c,th).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const S=await O(this,is).start();if(S===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(S),(f=(h=O(this,vl).config).onSuccess)==null||f.call(h,S,this),(g=(p=O(this,vl).config).onSettled)==null||g.call(p,S,this.state.error,this),S}catch(S){if(S instanceof iz){if(S.silent)return O(this,is).promise;if(S.revert){if(this.state.data===void 0)throw S;return this.state.data}}throw Ot(this,_c,th).call(this,{type:"error",error:S}),(v=(y=O(this,vl).config).onError)==null||v.call(y,S,this),(_=(b=O(this,vl).config).onSettled)==null||_.call(b,this.state.data,S,this),S}finally{this.scheduleGc()}}},zg=new WeakMap,Nb=new WeakMap,vl=new WeakMap,jg=new WeakMap,is=new WeakMap,Uk=new WeakMap,Bg=new WeakMap,_c=new WeakSet,th=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...tve(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...AJ(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return W(this,Nb,e.manual?i:void 0),i;case"error":const s=e.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),di.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),O(this,vl).notify({query:this,type:"updated",action:e})})},zle);function tve(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Qye(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function AJ(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function IJ(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Zo,Mn,qk,bo,Fg,Ob,dh,Pp,Wk,Db,Pb,Vg,$g,Lp,Lb,Jn,E4,sz,oz,az,lz,cz,uz,dz,nve,jle,qH=(jle=class extends Cy{constructor(e,n){super();te(this,Jn);te(this,Zo);te(this,Mn);te(this,qk);te(this,bo);te(this,Fg);te(this,Ob);te(this,dh);te(this,Pp);te(this,Wk);te(this,Db);te(this,Pb);te(this,Vg);te(this,$g);te(this,Lp);te(this,Lb,new Set);this.options=n,W(this,Zo,e),W(this,Pp,null),W(this,dh,rz()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,Mn).addObserver(this),RJ(O(this,Mn),this.options)?Ot(this,Jn,E4).call(this):this.updateResult(),Ot(this,Jn,lz).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return hz(O(this,Mn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return hz(O(this,Mn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ot(this,Jn,cz).call(this),Ot(this,Jn,uz).call(this),O(this,Mn).removeObserver(this)}setOptions(e){const n=this.options,r=O(this,Mn);if(this.options=O(this,Zo).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof kl(this.options.enabled,O(this,Mn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ot(this,Jn,dz).call(this),O(this,Mn).setOptions(this.options),n._defaulted&&!GS(this.options,n)&&O(this,Zo).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,Mn),observer:this});const i=this.hasListeners();i&&MJ(O(this,Mn),r,this.options,n)&&Ot(this,Jn,E4).call(this),this.updateResult(),i&&(O(this,Mn)!==r||kl(this.options.enabled,O(this,Mn))!==kl(n.enabled,O(this,Mn))||Sm(this.options.staleTime,O(this,Mn))!==Sm(n.staleTime,O(this,Mn)))&&Ot(this,Jn,sz).call(this);const s=Ot(this,Jn,oz).call(this);i&&(O(this,Mn)!==r||kl(this.options.enabled,O(this,Mn))!==kl(n.enabled,O(this,Mn))||s!==O(this,Lp))&&Ot(this,Jn,az).call(this,s)}getOptimisticResult(e){const n=O(this,Zo).getQueryCache().build(O(this,Zo),e),r=this.createResult(n,e);return RZe(this,r)&&(W(this,bo,r),W(this,Ob,this.options),W(this,Fg,O(this,Mn).state)),r}getCurrentResult(){return O(this,bo)}trackResult(e,n){return new Proxy(e,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&O(this,dh).status==="pending"&&O(this,dh).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){O(this,Lb).add(e)}getCurrentQuery(){return O(this,Mn)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=O(this,Zo).defaultQueryOptions(e),r=O(this,Zo).getQueryCache().build(O(this,Zo),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return Ot(this,Jn,E4).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,bo)))}createResult(e,n){var R;const r=O(this,Mn),i=this.options,s=O(this,bo),o=O(this,Fg),a=O(this,Ob),c=e!==r?e.state:O(this,qk),{state:u}=e;let d={...u},h=!1,f;if(n._optimisticResults){const M=this.hasListeners(),D=!M&&RJ(e,n),P=M&&MJ(e,r,n,i);(D||P)&&(d={...d,...tve(u.data,e.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:p,errorUpdatedAt:g,status:y}=d;f=d.data;let v=!1;if(n.placeholderData!==void 0&&f===void 0&&y==="pending"){let M;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(M=s.data,v=!0):M=typeof n.placeholderData=="function"?n.placeholderData((R=O(this,Pb))==null?void 0:R.state.data,O(this,Pb)):n.placeholderData,M!==void 0&&(y="success",f=nz(s==null?void 0:s.data,M,n),h=!0)}if(n.select&&f!==void 0&&!v)if(s&&f===(o==null?void 0:o.data)&&n.select===O(this,Wk))f=O(this,Db);else try{W(this,Wk,n.select),f=n.select(f),f=nz(s==null?void 0:s.data,f,n),W(this,Db,f),W(this,Pp,null)}catch(M){W(this,Pp,M)}O(this,Pp)&&(p=O(this,Pp),f=O(this,Db),g=Date.now(),y="error");const b=d.fetchStatus==="fetching",_=y==="pending",S=y==="error",k=_&&b,T=f!==void 0,C={status:y,fetchStatus:d.fetchStatus,isPending:_,isSuccess:y==="success",isError:S,isInitialLoading:k,isLoading:k,data:f,dataUpdatedAt:d.dataUpdatedAt,error:p,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:b,isRefetching:b&&!_,isLoadingError:S&&!T,isPaused:d.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:S&&T,isStale:WH(e,n),refetch:this.refetch,promise:O(this,dh),isEnabled:kl(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const M=C.data!==void 0,D=C.status==="error"&&!M,P=re=>{D?re.reject(C.error):M&&re.resolve(C.data)},z=()=>{const re=W(this,dh,C.promise=rz());P(re)},Z=O(this,dh);switch(Z.status){case"pending":e.queryHash===r.queryHash&&P(Z);break;case"fulfilled":(D||C.data!==Z.value)&&z();break;case"rejected":(!D||C.error!==Z.reason)&&z();break}}return C}updateResult(){const e=O(this,bo),n=this.createResult(O(this,Mn),this.options);if(W(this,Fg,O(this,Mn).state),W(this,Ob,this.options),O(this,Fg).data!==void 0&&W(this,Pb,O(this,Mn)),GS(n,e))return;W(this,bo,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!O(this,Lb).size)return!0;const o=new Set(s??O(this,Lb));return this.options.throwOnError&&o.add("error"),Object.keys(O(this,bo)).some(a=>{const l=a;return O(this,bo)[l]!==e[l]&&o.has(l)})};Ot(this,Jn,nve).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ot(this,Jn,lz).call(this)}},Zo=new WeakMap,Mn=new WeakMap,qk=new WeakMap,bo=new WeakMap,Fg=new WeakMap,Ob=new WeakMap,dh=new WeakMap,Pp=new WeakMap,Wk=new WeakMap,Db=new WeakMap,Pb=new WeakMap,Vg=new WeakMap,$g=new WeakMap,Lp=new WeakMap,Lb=new WeakMap,Jn=new WeakSet,E4=function(e){Ot(this,Jn,dz).call(this);let n=O(this,Mn).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Ys)),n},sz=function(){Ot(this,Jn,cz).call(this);const e=Sm(this.options.staleTime,O(this,Mn));if(q1||O(this,bo).isStale||!ez(e))return;const r=Zye(O(this,bo).dataUpdatedAt,e)+1;W(this,Vg,Cg.setTimeout(()=>{O(this,bo).isStale||this.updateResult()},r))},oz=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,Mn)):this.options.refetchInterval)??!1},az=function(e){Ot(this,Jn,uz).call(this),W(this,Lp,e),!(q1||kl(this.options.enabled,O(this,Mn))===!1||!ez(O(this,Lp))||O(this,Lp)===0)&&W(this,$g,Cg.setInterval(()=>{(this.options.refetchIntervalInBackground||UH.isFocused())&&Ot(this,Jn,E4).call(this)},O(this,Lp)))},lz=function(){Ot(this,Jn,sz).call(this),Ot(this,Jn,az).call(this,Ot(this,Jn,oz).call(this))},cz=function(){O(this,Vg)&&(Cg.clearTimeout(O(this,Vg)),W(this,Vg,void 0))},uz=function(){O(this,$g)&&(Cg.clearInterval(O(this,$g)),W(this,$g,void 0))},dz=function(){const e=O(this,Zo).getQueryCache().build(O(this,Zo),this.options);if(e===O(this,Mn))return;const n=O(this,Mn);W(this,Mn,e),W(this,qk,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},nve=function(e){di.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(O(this,bo))}),O(this,Zo).getQueryCache().notify({query:O(this,Mn),type:"observerResultsUpdated"})})},jle);function IZe(t,e){return kl(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function RJ(t,e){return IZe(t,e)||t.state.data!==void 0&&hz(t,e,e.refetchOnMount)}function hz(t,e,n){if(kl(e.enabled,t)!==!1&&Sm(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&WH(t,e)}return!1}function MJ(t,e,n,r){return(t!==e||kl(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&WH(t,n)}function WH(t,e){return kl(e.enabled,t)!==!1&&t.isStaleByTime(Sm(e.staleTime,t))}function RZe(t,e){return!GS(t.getCurrentResult(),e)}function NJ(t){return{onFetch:(e,n)=>{var u,d,h,f,p;const r=e.options,i=(h=(d=(u=e.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:h.direction,s=((f=e.state.data)==null?void 0:f.pages)||[],o=((p=e.state.data)==null?void 0:p.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let g=!1;const y=_=>{_Ze(_,()=>e.signal,()=>g=!0)},v=Xye(e.options,e.fetchOptions),b=async(_,S,k)=>{if(g)return Promise.reject();if(S==null&&_.pages.length)return Promise.resolve(_);const E=(()=>{const D={client:e.client,queryKey:e.queryKey,pageParam:S,direction:k?"backward":"forward",meta:e.options.meta};return y(D),D})(),C=await v(E),{maxPages:R}=e.options,M=k?xZe:wZe;return{pages:M(_.pages,C,R),pageParams:M(_.pageParams,S,R)}};if(i&&s.length){const _=i==="backward",S=_?MZe:OJ,k={pages:s,pageParams:o},T=S(r,k);a=await b(k,T,_)}else{const _=t??s.length;do{const S=l===0?o[0]??r.initialPageParam:OJ(r,a);if(l>0&&S==null)break;a=await b(a,S),l++}while(l<_)}return a};e.options.persister?e.fetchFn=()=>{var g,y;return(y=(g=e.options).persister)==null?void 0:y.call(g,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=c}}}function OJ(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function MZe(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var Gk,Mu,qs,Hg,Nu,rp,Ble,NZe=(Ble=class extends eve{constructor(e){super();te(this,Nu);te(this,Gk);te(this,Mu);te(this,qs);te(this,Hg);W(this,Gk,e.client),this.mutationId=e.mutationId,W(this,qs,e.mutationCache),W(this,Mu,[]),this.state=e.state||rve(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){O(this,Mu).includes(e)||(O(this,Mu).push(e),this.clearGcTimeout(),O(this,qs).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){W(this,Mu,O(this,Mu).filter(n=>n!==e)),this.scheduleGc(),O(this,qs).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){O(this,Mu).length||(this.state.status==="pending"?this.scheduleGc():O(this,qs).remove(this))}continue(){var e;return((e=O(this,Hg))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,a,l,c,u,d,h,f,p,g,y,v,b,_,S,k,T,E;const n=()=>{Ot(this,Nu,rp).call(this,{type:"continue"})},r={client:O(this,Gk),meta:this.options.meta,mutationKey:this.options.mutationKey};W(this,Hg,Jye({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(C,R)=>{Ot(this,Nu,rp).call(this,{type:"failed",failureCount:C,error:R})},onPause:()=>{Ot(this,Nu,rp).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,qs).canRun(this)}));const i=this.state.status==="pending",s=!O(this,Hg).canStart();try{if(i)n();else{Ot(this,Nu,rp).call(this,{type:"pending",variables:e,isPaused:s}),O(this,qs).config.onMutate&&await O(this,qs).config.onMutate(e,this,r);const R=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,e,r));R!==this.state.context&&Ot(this,Nu,rp).call(this,{type:"pending",context:R,variables:e,isPaused:s})}const C=await O(this,Hg).start();return await((c=(l=O(this,qs).config).onSuccess)==null?void 0:c.call(l,C,e,this.state.context,this,r)),await((d=(u=this.options).onSuccess)==null?void 0:d.call(u,C,e,this.state.context,r)),await((f=(h=O(this,qs).config).onSettled)==null?void 0:f.call(h,C,null,this.state.variables,this.state.context,this,r)),await((g=(p=this.options).onSettled)==null?void 0:g.call(p,C,null,e,this.state.context,r)),Ot(this,Nu,rp).call(this,{type:"success",data:C}),C}catch(C){try{await((v=(y=O(this,qs).config).onError)==null?void 0:v.call(y,C,e,this.state.context,this,r))}catch(R){Promise.reject(R)}try{await((_=(b=this.options).onError)==null?void 0:_.call(b,C,e,this.state.context,r))}catch(R){Promise.reject(R)}try{await((k=(S=O(this,qs).config).onSettled)==null?void 0:k.call(S,void 0,C,this.state.variables,this.state.context,this,r))}catch(R){Promise.reject(R)}try{await((E=(T=this.options).onSettled)==null?void 0:E.call(T,void 0,C,e,this.state.context,r))}catch(R){Promise.reject(R)}throw Ot(this,Nu,rp).call(this,{type:"error",error:C}),C}finally{O(this,qs).runNext(this)}}},Gk=new WeakMap,Mu=new WeakMap,qs=new WeakMap,Hg=new WeakMap,Nu=new WeakSet,rp=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),di.batch(()=>{O(this,Mu).forEach(r=>{r.onMutationUpdate(e)}),O(this,qs).notify({mutation:this,type:"updated",action:e})})},Ble);function rve(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var hh,Sc,Kk,Fle,ive=(Fle=class extends Cy{constructor(e={}){super();te(this,hh);te(this,Sc);te(this,Kk);this.config=e,W(this,hh,new Set),W(this,Sc,new Map),W(this,Kk,0)}build(e,n,r){const i=new NZe({client:e,mutationCache:this,mutationId:++IC(this,Kk)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){O(this,hh).add(e);const n=hE(e);if(typeof n=="string"){const r=O(this,Sc).get(n);r?r.push(e):O(this,Sc).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(O(this,hh).delete(e)){const n=hE(e);if(typeof n=="string"){const r=O(this,Sc).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&O(this,Sc).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=hE(e);if(typeof n=="string"){const r=O(this,Sc).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const n=hE(e);if(typeof n=="string"){const i=(r=O(this,Sc).get(n))==null?void 0:r.find(s=>s!==e&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){di.batch(()=>{O(this,hh).forEach(e=>{this.notify({type:"removed",mutation:e})}),O(this,hh).clear(),O(this,Sc).clear()})}getAll(){return Array.from(O(this,hh))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>CJ(n,r))}findAll(e={}){return this.getAll().filter(n=>CJ(e,n))}notify(e){di.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return di.batch(()=>Promise.all(e.map(n=>n.continue().catch(Ys))))}},hh=new WeakMap,Sc=new WeakMap,Kk=new WeakMap,Fle);function hE(t){var e;return(e=t.options.scope)==null?void 0:e.id}var fh,zp,Xo,ph,Yh,r6,fz,Vle,OZe=(Vle=class extends Cy{constructor(n,r){super();te(this,Yh);te(this,fh);te(this,zp);te(this,Xo);te(this,ph);W(this,fh,n),this.setOptions(r),this.bindMethods(),Ot(this,Yh,r6).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var i;const r=this.options;this.options=O(this,fh).defaultMutationOptions(n),GS(this.options,r)||O(this,fh).getMutationCache().notify({type:"observerOptionsUpdated",mutation:O(this,Xo),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&W1(r.mutationKey)!==W1(this.options.mutationKey)?this.reset():((i=O(this,Xo))==null?void 0:i.state.status)==="pending"&&O(this,Xo).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=O(this,Xo))==null||n.removeObserver(this)}onMutationUpdate(n){Ot(this,Yh,r6).call(this),Ot(this,Yh,fz).call(this,n)}getCurrentResult(){return O(this,zp)}reset(){var n;(n=O(this,Xo))==null||n.removeObserver(this),W(this,Xo,void 0),Ot(this,Yh,r6).call(this),Ot(this,Yh,fz).call(this)}mutate(n,r){var i;return W(this,ph,r),(i=O(this,Xo))==null||i.removeObserver(this),W(this,Xo,O(this,fh).getMutationCache().build(O(this,fh),this.options)),O(this,Xo).addObserver(this),O(this,Xo).execute(n)}},fh=new WeakMap,zp=new WeakMap,Xo=new WeakMap,ph=new WeakMap,Yh=new WeakSet,r6=function(){var r;const n=((r=O(this,Xo))==null?void 0:r.state)??rve();W(this,zp,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},fz=function(n){di.batch(()=>{var r,i,s,o,a,l,c,u;if(O(this,ph)&&this.hasListeners()){const d=O(this,zp).variables,h=O(this,zp).context,f={client:O(this,fh),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(i=(r=O(this,ph)).onSuccess)==null||i.call(r,n.data,d,h,f)}catch(p){Promise.reject(p)}try{(o=(s=O(this,ph)).onSettled)==null||o.call(s,n.data,null,d,h,f)}catch(p){Promise.reject(p)}}else if((n==null?void 0:n.type)==="error"){try{(l=(a=O(this,ph)).onError)==null||l.call(a,n.error,d,h,f)}catch(p){Promise.reject(p)}try{(u=(c=O(this,ph)).onSettled)==null||u.call(c,void 0,n.error,d,h,f)}catch(p){Promise.reject(p)}}}this.listeners.forEach(d=>{d(O(this,zp))})})},Vle);function DJ(t,e){const n=new Set(e);return t.filter(r=>!n.has(r))}function DZe(t,e,n){const r=t.slice(0);return r[e]=n,r}var zb,Oa,jb,Bb,bl,jp,Yk,Zk,Xk,Qk,Bs,pz,mz,gz,yz,vz,$le,PZe=($le=class extends Cy{constructor(e,n,r){super();te(this,Bs);te(this,zb);te(this,Oa);te(this,jb);te(this,Bb);te(this,bl);te(this,jp);te(this,Yk);te(this,Zk);te(this,Xk);te(this,Qk,[]);W(this,zb,e),W(this,Bb,r),W(this,jb,[]),W(this,bl,[]),W(this,Oa,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&O(this,bl).forEach(e=>{e.subscribe(n=>{Ot(this,Bs,yz).call(this,e,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,O(this,bl).forEach(e=>{e.destroy()})}setQueries(e,n){W(this,jb,e),W(this,Bb,n),di.batch(()=>{const r=O(this,bl),i=Ot(this,Bs,gz).call(this,O(this,jb));i.forEach(d=>d.observer.setOptions(d.defaultedQueryOptions));const s=i.map(d=>d.observer),o=s.map(d=>d.getCurrentResult()),a=r.length!==s.length,l=s.some((d,h)=>d!==r[h]),c=a||l,u=c?!0:o.some((d,h)=>{const f=O(this,Oa)[h];return!f||!GS(d,f)});!c&&!u||(c&&(W(this,Qk,i),W(this,bl,s)),W(this,Oa,o),this.hasListeners()&&(c&&(DJ(r,s).forEach(d=>{d.destroy()}),DJ(s,r).forEach(d=>{d.subscribe(h=>{Ot(this,Bs,yz).call(this,d,h)})})),Ot(this,Bs,vz).call(this)))})}getCurrentResult(){return O(this,Oa)}getQueries(){return O(this,bl).map(e=>e.getCurrentQuery())}getObservers(){return O(this,bl)}getOptimisticResult(e,n){const r=Ot(this,Bs,gz).call(this,e),i=r.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions)),s=r.map(o=>o.defaultedQueryOptions.queryHash);return[i,o=>Ot(this,Bs,mz).call(this,o??i,n,s),()=>Ot(this,Bs,pz).call(this,i,r)]}},zb=new WeakMap,Oa=new WeakMap,jb=new WeakMap,Bb=new WeakMap,bl=new WeakMap,jp=new WeakMap,Yk=new WeakMap,Zk=new WeakMap,Xk=new WeakMap,Qk=new WeakMap,Bs=new WeakSet,pz=function(e,n){return n.map((r,i)=>{const s=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?s:r.observer.trackResult(s,o=>{n.forEach(a=>{a.observer.trackProp(o)})})})},mz=function(e,n,r){if(n){const i=O(this,Xk),s=r!==void 0&&i!==void 0&&(i.length!==r.length||r.some((o,a)=>o!==i[a]));return(!O(this,jp)||O(this,Oa)!==O(this,Zk)||s||n!==O(this,Yk))&&(W(this,Yk,n),W(this,Zk,O(this,Oa)),r!==void 0&&W(this,Xk,r),W(this,jp,$H(O(this,jp),n(e)))),O(this,jp)}return e},gz=function(e){const n=new Map;O(this,bl).forEach(i=>{const s=i.options.queryHash;if(!s)return;const o=n.get(s);o?o.push(i):n.set(s,[i])});const r=[];return e.forEach(i=>{var l;const s=O(this,zb).defaultQueryOptions(i),a=((l=n.get(s.queryHash))==null?void 0:l.shift())??new qH(O(this,zb),s);r.push({defaultedQueryOptions:s,observer:a})}),r},yz=function(e,n){const r=O(this,bl).indexOf(e);r!==-1&&(W(this,Oa,DZe(O(this,Oa),r,n)),Ot(this,Bs,vz).call(this))},vz=function(){var e;if(this.hasListeners()){const n=O(this,jp),r=Ot(this,Bs,pz).call(this,O(this,Oa),O(this,Qk)),i=Ot(this,Bs,mz).call(this,r,(e=O(this,Bb))==null?void 0:e.combine);n!==i&&di.batch(()=>{this.listeners.forEach(s=>{s(O(this,Oa))})})}},$le),Ou,Hle,sve=(Hle=class extends Cy{constructor(e={}){super();te(this,Ou);this.config=e,W(this,Ou,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??VH(i,n);let o=this.get(s);return o||(o=new AZe({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){O(this,Ou).has(e.queryHash)||(O(this,Ou).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=O(this,Ou).get(e.queryHash);n&&(e.destroy(),n===e&&O(this,Ou).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){di.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return O(this,Ou).get(e)}getAll(){return[...O(this,Ou).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>kJ(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>kJ(e,r)):n}notify(e){di.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){di.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){di.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ou=new WeakMap,Hle),ai,Bp,Fp,Fb,Vb,Vp,$b,Hb,Ule,LZe=(Ule=class{constructor(t={}){te(this,ai);te(this,Bp);te(this,Fp);te(this,Fb);te(this,Vb);te(this,Vp);te(this,$b);te(this,Hb);W(this,ai,t.queryCache||new sve),W(this,Bp,t.mutationCache||new ive),W(this,Fp,t.defaultOptions||{}),W(this,Fb,new Map),W(this,Vb,new Map),W(this,Vp,0)}mount(){IC(this,Vp)._++,O(this,Vp)===1&&(W(this,$b,UH.subscribe(async t=>{t&&(await this.resumePausedMutations(),O(this,ai).onFocus())})),W(this,Hb,N7.subscribe(async t=>{t&&(await this.resumePausedMutations(),O(this,ai).onOnline())})))}unmount(){var t,e;IC(this,Vp)._--,O(this,Vp)===0&&((t=O(this,$b))==null||t.call(this),W(this,$b,void 0),(e=O(this,Hb))==null||e.call(this),W(this,Hb,void 0))}isFetching(t){return O(this,ai).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return O(this,Bp).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=O(this,ai).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=O(this,ai).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(Sm(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return O(this,ai).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=O(this,ai).get(r.queryHash),s=i==null?void 0:i.state.data,o=yZe(e,s);if(o!==void 0)return O(this,ai).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return di.batch(()=>O(this,ai).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=O(this,ai).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=O(this,ai);di.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=O(this,ai);return di.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=di.batch(()=>O(this,ai).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Ys).catch(Ys)}invalidateQueries(t,e={}){return di.batch(()=>(O(this,ai).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=di.batch(()=>O(this,ai).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Ys)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Ys)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=O(this,ai).build(this,e);return n.isStaleByTime(Sm(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Ys).catch(Ys)}fetchInfiniteQuery(t){return t.behavior=NJ(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Ys).catch(Ys)}ensureInfiniteQueryData(t){return t.behavior=NJ(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return N7.isOnline()?O(this,Bp).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,ai)}getMutationCache(){return O(this,Bp)}getDefaultOptions(){return O(this,Fp)}setDefaultOptions(t){W(this,Fp,t)}setQueryDefaults(t,e){O(this,Fb).set(W1(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...O(this,Fb).values()],n={};return e.forEach(r=>{WS(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){O(this,Vb).set(W1(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...O(this,Vb).values()],n={};return e.forEach(r=>{WS(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...O(this,Fp).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=VH(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Ey&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...O(this,Fp).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){O(this,ai).clear(),O(this,Bp).clear()}},ai=new WeakMap,Bp=new WeakMap,Fp=new WeakMap,Fb=new WeakMap,Vb=new WeakMap,Vp=new WeakMap,$b=new WeakMap,Hb=new WeakMap,Ule),ove=x.createContext(void 0),cl=t=>{const e=x.useContext(ove);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},zZe=({client:t,children:e})=>(x.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),m.jsx(ove.Provider,{value:t,children:e})),ave=x.createContext(!1),lve=()=>x.useContext(ave);ave.Provider;function jZe(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var BZe=x.createContext(jZe()),GH=()=>x.useContext(BZe),cve=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?HH(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},uve=t=>{x.useEffect(()=>{t.clearReset()},[t])},dve=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||HH(n,[t.error,r])),hve=t=>{if(t.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},FZe=(t,e)=>t.isLoading&&t.isFetching&&!e,bz=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,wz=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function VZe({queries:t,...e},n){const r=cl(),i=lve(),s=GH(),o=x.useMemo(()=>t.map(g=>{const y=r.defaultQueryOptions(g);return y._optimisticResults=i?"isRestoring":"optimistic",y}),[t,r,i]);o.forEach(g=>{hve(g);const y=r.getQueryCache().get(g.queryHash);cve(g,s,y)}),uve(s);const[a]=x.useState(()=>new PZe(r,o,e)),[l,c,u]=a.getOptimisticResult(o,e.combine),d=!i&&e.subscribed!==!1;x.useSyncExternalStore(x.useCallback(g=>d?a.subscribe(di.batchCalls(g)):Ys,[a,d]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),x.useEffect(()=>{a.setQueries(o,e)},[o,e,a]);const f=l.some((g,y)=>bz(o[y],g))?l.flatMap((g,y)=>{const v=o[y];if(v&&bz(v,g)){const b=new qH(r,v);return wz(v,b,s)}return[]}):[];if(f.length>0)throw Promise.all(f);const p=l.find((g,y)=>{const v=o[y];return v&&dve({result:g,errorResetBoundary:s,throwOnError:v.throwOnError,query:r.getQueryCache().get(v.queryHash),suspense:v.suspense})});if(p!=null&&p.error)throw p.error;return c(u())}function $Ze(t,e,n){var h,f,p,g;const r=lve(),i=GH(),s=cl(),o=s.defaultQueryOptions(t);(f=(h=s.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||f.call(h,o);const a=s.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",hve(o),cve(o,i,a),uve(i);const l=!s.getQueryCache().get(o.queryHash),[c]=x.useState(()=>new e(s,o)),u=c.getOptimisticResult(o),d=!r&&t.subscribed!==!1;if(x.useSyncExternalStore(x.useCallback(y=>{const v=d?c.subscribe(di.batchCalls(y)):Ys;return c.updateResult(),v},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),x.useEffect(()=>{c.setOptions(o)},[o,c]),bz(o,u))throw wz(o,c,i);if(dve({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw u.error;if((g=(p=s.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||g.call(p,o,u),o.experimental_prefetchInRender&&!q1&&FZe(u,r)){const y=l?wz(o,c,i):a==null?void 0:a.promise;y==null||y.catch(Ys).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?u:c.trackResult(u)}function _0(t,e){return $Ze(t,qH)}function kf(t,e){const n=cl(),[r]=x.useState(()=>new OZe(n,t));x.useEffect(()=>{r.setOptions(t)},[r,t]);const i=x.useSyncExternalStore(x.useCallback(o=>r.subscribe(di.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=x.useCallback((o,a)=>{r.mutate(o,a).catch(Ys)},[r]);if(i.error&&HH(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}function _3({className:t,size:e="default",...n}){return m.jsx(gRe,{"data-slot":"avatar","data-size":e,className:He("size-8 rounded-full after:rounded-full data-[size=lg]:size-10 data-[size=sm]:size-6 data-[size=xs]:size-4 after:border-border group/avatar relative flex shrink-0 select-none after:absolute after:inset-0 after:border after:mix-blend-darken dark:after:mix-blend-lighten",t),...n})}function HZe({className:t,...e}){return m.jsx(yRe,{"data-slot":"avatar-image",className:He("rounded-full aspect-square size-full object-cover",t),...e})}function S3({className:t,...e}){return m.jsx(vRe,{"data-slot":"avatar-fallback",className:He("bg-muted text-muted-foreground rounded-full flex size-full items-center justify-center text-sm group-data-[size=sm]/avatar:text-xs group-data-[size=xs]/avatar:text-[8px]",t),...e})}function fve({className:t,...e}){return m.jsx("div",{"data-slot":"avatar-group",className:He("*:data-[slot=avatar]:ring-background group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2",t),...e})}function pve(t){const{data:e}=_0({queryKey:["avatar-url",t],queryFn:t?()=>Bn.getAvatarDownloadUrl(t):Ey,staleTime:36e5});return e}function Xc({avatarObjectId:t,initials:e,fallbackClassName:n,...r}){const i=pve(t);return m.jsxs(_3,{...r,children:[i&&m.jsx(HZe,{src:i,alt:e}),m.jsx(S3,{className:n,children:e})]})}function UZe(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const qZe=t=>{switch(t){case"success":return KZe;case"info":return ZZe;case"warning":return YZe;case"error":return XZe;default:return null}},WZe=Array(12).fill(0),GZe=({visible:t,className:e})=>Be.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},Be.createElement("div",{className:"sonner-spinner"},WZe.map((n,r)=>Be.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),KZe=Be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Be.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"})),YZe=Be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Be.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"})),ZZe=Be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Be.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"})),XZe=Be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Be.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"})),QZe=Be.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"},Be.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Be.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),JZe=()=>{const[t,e]=Be.useState(document.hidden);return Be.useEffect(()=>{const n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t};let xz=1;class eXe{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const n=this.subscribers.indexOf(e);this.subscribers.splice(n,1)}),this.publish=e=>{this.subscribers.forEach(n=>n(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var n;const{message:r,...i}=e,s=typeof(e==null?void 0:e.id)=="number"||((n=e.id)==null?void 0:n.length)>0?e.id:xz++,o=this.toasts.find(l=>l.id===s),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),o?this.toasts=this.toasts.map(l=>l.id===s?(this.publish({...l,...e,id:s,title:r}),{...l,...e,id:s,dismissible:a,title:r}):l):this.addToast({title:r,...i,dismissible:a,id:s}),s},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:e,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),e),this.message=(e,n)=>this.create({...n,message:e}),this.error=(e,n)=>this.create({...n,message:e,type:"error"}),this.success=(e,n)=>this.create({...n,type:"success",message:e}),this.info=(e,n)=>this.create({...n,type:"info",message:e}),this.warning=(e,n)=>this.create({...n,type:"warning",message:e}),this.loading=(e,n)=>this.create({...n,type:"loading",message:e}),this.promise=(e,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const i=Promise.resolve(e instanceof Function?e():e);let s=r!==void 0,o;const a=i.then(async c=>{if(o=["resolve",c],Be.isValidElement(c))s=!1,this.create({id:r,type:"default",message:c});else if(nXe(c)&&!c.ok){s=!1;const d=typeof n.error=="function"?await n.error(`HTTP error! status: ${c.status}`):n.error,h=typeof n.description=="function"?await n.description(`HTTP error! status: ${c.status}`):n.description,p=typeof d=="object"&&!Be.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:h,...p})}else if(c instanceof Error){s=!1;const d=typeof n.error=="function"?await n.error(c):n.error,h=typeof n.description=="function"?await n.description(c):n.description,p=typeof d=="object"&&!Be.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:h,...p})}else if(n.success!==void 0){s=!1;const d=typeof n.success=="function"?await n.success(c):n.success,h=typeof n.description=="function"?await n.description(c):n.description,p=typeof d=="object"&&!Be.isValidElement(d)?d:{message:d};this.create({id:r,type:"success",description:h,...p})}}).catch(async c=>{if(o=["reject",c],n.error!==void 0){s=!1;const u=typeof n.error=="function"?await n.error(c):n.error,d=typeof n.description=="function"?await n.description(c):n.description,f=typeof u=="object"&&!Be.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:d,...f})}}).finally(()=>{s&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),l=()=>new Promise((c,u)=>a.then(()=>o[0]==="reject"?u(o[1]):c(o[1])).catch(u));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(e,n)=>{const r=(n==null?void 0:n.id)||xz++;return this.create({jsx:e(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const ra=new eXe,tXe=(t,e)=>{const n=(e==null?void 0:e.id)||xz++;return ra.addToast({title:t,...e,id:n}),n},nXe=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",rXe=tXe,iXe=()=>ra.toasts,sXe=()=>ra.getActiveToasts(),Hn=Object.assign(rXe,{success:ra.success,info:ra.info,warning:ra.warning,error:ra.error,custom:ra.custom,message:ra.message,promise:ra.promise,dismiss:ra.dismiss,loading:ra.loading},{getHistory:iXe,getToasts:sXe});UZe("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function fE(t){return t.label!==void 0}const oXe=3,aXe="24px",lXe="16px",PJ=4e3,cXe=356,uXe=14,dXe=45,hXe=200;function pu(...t){return t.filter(Boolean).join(" ")}function fXe(t){const[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}const pXe=t=>{var e,n,r,i,s,o,a,l,c;const{invert:u,toast:d,unstyled:h,interacting:f,setHeights:p,visibleToasts:g,heights:y,index:v,toasts:b,expanded:_,removeToast:S,defaultRichColors:k,closeButton:T,style:E,cancelButtonStyle:C,actionButtonStyle:R,className:M="",descriptionClassName:D="",duration:P,position:z,gap:Z,expandByDefault:re,classNames:G,icons:ee,closeButtonAriaLabel:J="Close toast"}=t,[oe,B]=Be.useState(null),[$e,Ye]=Be.useState(null),[$,Re]=Be.useState(!1),[ke,Me]=Be.useState(!1),[_e,Ne]=Be.useState(!1),[Ue,at]=Be.useState(!1),[ct,H]=Be.useState(!1),[Y,se]=Be.useState(0),[me,de]=Be.useState(0),ie=Be.useRef(d.duration||P||PJ),Te=Be.useRef(null),he=Be.useRef(null),we=v===0,ye=v+1<=g,Ge=d.type,Pe=d.dismissible!==!1,tt=d.className||"",ft=d.descriptionClassName||"",ne=Be.useMemo(()=>y.findIndex(wt=>wt.toastId===d.id)||0,[y,d.id]),fe=Be.useMemo(()=>{var wt;return(wt=d.closeButton)!=null?wt:T},[d.closeButton,T]),Le=Be.useMemo(()=>d.duration||P||PJ,[d.duration,P]),Ze=Be.useRef(0),rt=Be.useRef(0),un=Be.useRef(0),Yt=Be.useRef(null),[_n,kr]=z.split("-"),In=Be.useMemo(()=>y.reduce((wt,pn,tr)=>tr>=ne?wt:wt+pn.height,0),[y,ne]),Vt=JZe(),zr=d.invert||u,Ee=Ge==="loading";rt.current=Be.useMemo(()=>ne*Z+In,[ne,In]),Be.useEffect(()=>{ie.current=Le},[Le]),Be.useEffect(()=>{Re(!0)},[]),Be.useEffect(()=>{const wt=he.current;if(wt){const pn=wt.getBoundingClientRect().height;return de(pn),p(tr=>[{toastId:d.id,height:pn,position:d.position},...tr]),()=>p(tr=>tr.filter(ni=>ni.toastId!==d.id))}},[p,d.id]),Be.useLayoutEffect(()=>{if(!$)return;const wt=he.current,pn=wt.style.height;wt.style.height="auto";const tr=wt.getBoundingClientRect().height;wt.style.height=pn,de(tr),p(ni=>ni.find(qt=>qt.toastId===d.id)?ni.map(qt=>qt.toastId===d.id?{...qt,height:tr}:qt):[{toastId:d.id,height:tr,position:d.position},...ni])},[$,d.title,d.description,p,d.id,d.jsx,d.action,d.cancel]);const St=Be.useCallback(()=>{Me(!0),se(rt.current),p(wt=>wt.filter(pn=>pn.toastId!==d.id)),setTimeout(()=>{S(d)},hXe)},[d,S,p,rt]);Be.useEffect(()=>{if(d.promise&&Ge==="loading"||d.duration===1/0||d.type==="loading")return;let wt;return _||f||Vt?(()=>{if(un.current<Ze.current){const ni=new Date().getTime()-Ze.current;ie.current=ie.current-ni}un.current=new Date().getTime()})():(()=>{ie.current!==1/0&&(Ze.current=new Date().getTime(),wt=setTimeout(()=>{d.onAutoClose==null||d.onAutoClose.call(d,d),St()},ie.current))})(),()=>clearTimeout(wt)},[_,f,d,Ge,Vt,St]),Be.useEffect(()=>{d.delete&&(St(),d.onDismiss==null||d.onDismiss.call(d,d))},[St,d.delete]);function Ke(){var wt;if(ee!=null&&ee.loading){var pn;return Be.createElement("div",{className:pu(G==null?void 0:G.loader,d==null||(pn=d.classNames)==null?void 0:pn.loader,"sonner-loader"),"data-visible":Ge==="loading"},ee.loading)}return Be.createElement(GZe,{className:pu(G==null?void 0:G.loader,d==null||(wt=d.classNames)==null?void 0:wt.loader),visible:Ge==="loading"})}const Sn=d.icon||(ee==null?void 0:ee[Ge])||qZe(Ge);var en,Vi;return Be.createElement("li",{tabIndex:0,ref:he,className:pu(M,tt,G==null?void 0:G.toast,d==null||(e=d.classNames)==null?void 0:e.toast,G==null?void 0:G.default,G==null?void 0:G[Ge],d==null||(n=d.classNames)==null?void 0:n[Ge]),"data-sonner-toast":"","data-rich-colors":(en=d.richColors)!=null?en:k,"data-styled":!(d.jsx||d.unstyled||h),"data-mounted":$,"data-promise":!!d.promise,"data-swiped":ct,"data-removed":ke,"data-visible":ye,"data-y-position":_n,"data-x-position":kr,"data-index":v,"data-front":we,"data-swiping":_e,"data-dismissible":Pe,"data-type":Ge,"data-invert":zr,"data-swipe-out":Ue,"data-swipe-direction":$e,"data-expanded":!!(_||re&&$),"data-testid":d.testId,style:{"--index":v,"--toasts-before":v,"--z-index":b.length-v,"--offset":`${ke?Y:rt.current}px`,"--initial-height":re?"auto":`${me}px`,...E,...d.style},onDragEnd:()=>{Ne(!1),B(null),Yt.current=null},onPointerDown:wt=>{wt.button!==2&&(Ee||!Pe||(Te.current=new Date,se(rt.current),wt.target.setPointerCapture(wt.pointerId),wt.target.tagName!=="BUTTON"&&(Ne(!0),Yt.current={x:wt.clientX,y:wt.clientY})))},onPointerUp:()=>{var wt,pn,tr;if(Ue||!Pe)return;Yt.current=null;const ni=Number(((wt=he.current)==null?void 0:wt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),_i=Number(((pn=he.current)==null?void 0:pn.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),qt=new Date().getTime()-((tr=Te.current)==null?void 0:tr.getTime()),jr=oe==="x"?ni:_i,Ho=Math.abs(jr)/qt;if(Math.abs(jr)>=dXe||Ho>.11){se(rt.current),d.onDismiss==null||d.onDismiss.call(d,d),Ye(oe==="x"?ni>0?"right":"left":_i>0?"down":"up"),St(),at(!0);return}else{var Si,fi;(Si=he.current)==null||Si.style.setProperty("--swipe-amount-x","0px"),(fi=he.current)==null||fi.style.setProperty("--swipe-amount-y","0px")}H(!1),Ne(!1),B(null)},onPointerMove:wt=>{var pn,tr,ni;if(!Yt.current||!Pe||((pn=window.getSelection())==null?void 0:pn.toString().length)>0)return;const qt=wt.clientY-Yt.current.y,jr=wt.clientX-Yt.current.x;var Ho;const Si=(Ho=t.swipeDirections)!=null?Ho:fXe(z);!oe&&(Math.abs(jr)>1||Math.abs(qt)>1)&&B(Math.abs(jr)>Math.abs(qt)?"x":"y");let fi={x:0,y:0};const ml=$i=>1/(1.5+Math.abs($i)/20);if(oe==="y"){if(Si.includes("top")||Si.includes("bottom"))if(Si.includes("top")&&qt<0||Si.includes("bottom")&&qt>0)fi.y=qt;else{const $i=qt*ml(qt);fi.y=Math.abs($i)<Math.abs(qt)?$i:qt}}else if(oe==="x"&&(Si.includes("left")||Si.includes("right")))if(Si.includes("left")&&jr<0||Si.includes("right")&&jr>0)fi.x=jr;else{const $i=jr*ml(jr);fi.x=Math.abs($i)<Math.abs(jr)?$i:jr}(Math.abs(fi.x)>0||Math.abs(fi.y)>0)&&H(!0),(tr=he.current)==null||tr.style.setProperty("--swipe-amount-x",`${fi.x}px`),(ni=he.current)==null||ni.style.setProperty("--swipe-amount-y",`${fi.y}px`)}},fe&&!d.jsx&&Ge!=="loading"?Be.createElement("button",{"aria-label":J,"data-disabled":Ee,"data-close-button":!0,onClick:Ee||!Pe?()=>{}:()=>{St(),d.onDismiss==null||d.onDismiss.call(d,d)},className:pu(G==null?void 0:G.closeButton,d==null||(r=d.classNames)==null?void 0:r.closeButton)},(Vi=ee==null?void 0:ee.close)!=null?Vi:QZe):null,(Ge||d.icon||d.promise)&&d.icon!==null&&((ee==null?void 0:ee[Ge])!==null||d.icon)?Be.createElement("div",{"data-icon":"",className:pu(G==null?void 0:G.icon,d==null||(i=d.classNames)==null?void 0:i.icon)},d.promise||d.type==="loading"&&!d.icon?d.icon||Ke():null,d.type!=="loading"?Sn:null):null,Be.createElement("div",{"data-content":"",className:pu(G==null?void 0:G.content,d==null||(s=d.classNames)==null?void 0:s.content)},Be.createElement("div",{"data-title":"",className:pu(G==null?void 0:G.title,d==null||(o=d.classNames)==null?void 0:o.title)},d.jsx?d.jsx:typeof d.title=="function"?d.title():d.title),d.description?Be.createElement("div",{"data-description":"",className:pu(D,ft,G==null?void 0:G.description,d==null||(a=d.classNames)==null?void 0:a.description)},typeof d.description=="function"?d.description():d.description):null),Be.isValidElement(d.cancel)?d.cancel:d.cancel&&fE(d.cancel)?Be.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||C,onClick:wt=>{fE(d.cancel)&&Pe&&(d.cancel.onClick==null||d.cancel.onClick.call(d.cancel,wt),St())},className:pu(G==null?void 0:G.cancelButton,d==null||(l=d.classNames)==null?void 0:l.cancelButton)},d.cancel.label):null,Be.isValidElement(d.action)?d.action:d.action&&fE(d.action)?Be.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||R,onClick:wt=>{fE(d.action)&&(d.action.onClick==null||d.action.onClick.call(d.action,wt),!wt.defaultPrevented&&St())},className:pu(G==null?void 0:G.actionButton,d==null||(c=d.classNames)==null?void 0:c.actionButton)},d.action.label):null)};function LJ(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function mXe(t,e){const n={};return[t,e].forEach((r,i)=>{const s=i===1,o=s?"--mobile-offset":"--offset",a=s?lXe:aXe;function l(c){["top","right","bottom","left"].forEach(u=>{n[`${o}-${u}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${o}-${c}`]=a:n[`${o}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):l(a)}),n}const gXe=Be.forwardRef(function(e,n){const{id:r,invert:i,position:s="bottom-right",hotkey:o=["altKey","KeyT"],expand:a,closeButton:l,className:c,offset:u,mobileOffset:d,theme:h="light",richColors:f,duration:p,style:g,visibleToasts:y=oXe,toastOptions:v,dir:b=LJ(),gap:_=uXe,icons:S,containerAriaLabel:k="Notifications"}=e,[T,E]=Be.useState([]),C=Be.useMemo(()=>r?T.filter($=>$.toasterId===r):T.filter($=>!$.toasterId),[T,r]),R=Be.useMemo(()=>Array.from(new Set([s].concat(C.filter($=>$.position).map($=>$.position)))),[C,s]),[M,D]=Be.useState([]),[P,z]=Be.useState(!1),[Z,re]=Be.useState(!1),[G,ee]=Be.useState(h!=="system"?h:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),J=Be.useRef(null),oe=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),B=Be.useRef(null),$e=Be.useRef(!1),Ye=Be.useCallback($=>{E(Re=>{var ke;return(ke=Re.find(Me=>Me.id===$.id))!=null&&ke.delete||ra.dismiss($.id),Re.filter(({id:Me})=>Me!==$.id)})},[]);return Be.useEffect(()=>ra.subscribe($=>{if($.dismiss){requestAnimationFrame(()=>{E(Re=>Re.map(ke=>ke.id===$.id?{...ke,delete:!0}:ke))});return}setTimeout(()=>{gce.flushSync(()=>{E(Re=>{const ke=Re.findIndex(Me=>Me.id===$.id);return ke!==-1?[...Re.slice(0,ke),{...Re[ke],...$},...Re.slice(ke+1)]:[$,...Re]})})})}),[T]),Be.useEffect(()=>{if(h!=="system"){ee(h);return}if(h==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?ee("dark"):ee("light")),typeof window>"u")return;const $=window.matchMedia("(prefers-color-scheme: dark)");try{$.addEventListener("change",({matches:Re})=>{ee(Re?"dark":"light")})}catch{$.addListener(({matches:ke})=>{try{ee(ke?"dark":"light")}catch(Me){console.error(Me)}})}},[h]),Be.useEffect(()=>{T.length<=1&&z(!1)},[T]),Be.useEffect(()=>{const $=Re=>{var ke;if(o.every(Ne=>Re[Ne]||Re.code===Ne)){var _e;z(!0),(_e=J.current)==null||_e.focus()}Re.code==="Escape"&&(document.activeElement===J.current||(ke=J.current)!=null&&ke.contains(document.activeElement))&&z(!1)};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[o]),Be.useEffect(()=>{if(J.current)return()=>{B.current&&(B.current.focus({preventScroll:!0}),B.current=null,$e.current=!1)}},[J.current]),Be.createElement("section",{ref:n,"aria-label":`${k} ${oe}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},R.map(($,Re)=>{var ke;const[Me,_e]=$.split("-");return C.length?Be.createElement("ol",{key:$,dir:b==="auto"?LJ():b,tabIndex:-1,ref:J,className:c,"data-sonner-toaster":!0,"data-sonner-theme":G,"data-y-position":Me,"data-x-position":_e,style:{"--front-toast-height":`${((ke=M[0])==null?void 0:ke.height)||0}px`,"--width":`${cXe}px`,"--gap":`${_}px`,...g,...mXe(u,d)},onBlur:Ne=>{$e.current&&!Ne.currentTarget.contains(Ne.relatedTarget)&&($e.current=!1,B.current&&(B.current.focus({preventScroll:!0}),B.current=null))},onFocus:Ne=>{Ne.target instanceof HTMLElement&&Ne.target.dataset.dismissible==="false"||$e.current||($e.current=!0,B.current=Ne.relatedTarget)},onMouseEnter:()=>z(!0),onMouseMove:()=>z(!0),onMouseLeave:()=>{Z||z(!1)},onDragEnd:()=>z(!1),onPointerDown:Ne=>{Ne.target instanceof HTMLElement&&Ne.target.dataset.dismissible==="false"||re(!0)},onPointerUp:()=>re(!1)},C.filter(Ne=>!Ne.position&&Re===0||Ne.position===$).map((Ne,Ue)=>{var at,ct;return Be.createElement(pXe,{key:Ne.id,icons:S,index:Ue,toast:Ne,defaultRichColors:f,duration:(at=v==null?void 0:v.duration)!=null?at:p,className:v==null?void 0:v.className,descriptionClassName:v==null?void 0:v.descriptionClassName,invert:i,visibleToasts:y,closeButton:(ct=v==null?void 0:v.closeButton)!=null?ct:l,interacting:Z,position:$,style:v==null?void 0:v.style,unstyled:v==null?void 0:v.unstyled,classNames:v==null?void 0:v.classNames,cancelButtonStyle:v==null?void 0:v.cancelButtonStyle,actionButtonStyle:v==null?void 0:v.actionButtonStyle,closeButtonAriaLabel:v==null?void 0:v.closeButtonAriaLabel,removeToast:Ye,toasts:C.filter(H=>H.position==Ne.position),heights:M.filter(H=>H.position==Ne.position),setHeights:D,expandByDefault:a,gap:_,expanded:P,swipeDirections:e.swipeDirections})})):null}))});function KH({...t}){return m.jsx(efe,{"data-slot":"dialog",...t})}function yXe({...t}){return m.jsx(tfe,{"data-slot":"dialog-portal",...t})}function vXe({className:t,...e}){return m.jsx(nfe,{"data-slot":"dialog-overlay",className:He("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50",t),...e})}function YH({className:t,children:e,showCloseButton:n=!0,...r}){return m.jsxs(yXe,{children:[m.jsx(vXe,{}),m.jsxs(rfe,{"data-slot":"dialog-content",className:He("bg-background data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 grid max-w-[calc(100%-2rem)] gap-4 rounded-xl p-4 text-sm ring-1 duration-100 sm:max-w-sm fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none",t),...r,children:[e,n&&m.jsx(YV,{"data-slot":"dialog-close",asChild:!0,children:m.jsxs(Rt,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm",children:[m.jsx(Zc,{}),m.jsx("span",{className:"sr-only",children:"Close"})]})})]})]})}function ZH({className:t,...e}){return m.jsx("div",{"data-slot":"dialog-header",className:He("gap-2 flex flex-col",t),...e})}function XH({className:t,showCloseButton:e=!1,children:n,...r}){return m.jsxs("div",{"data-slot":"dialog-footer",className:He("bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...r,children:[n,e&&m.jsx(YV,{asChild:!0,children:m.jsx(Rt,{variant:"outline",children:"Close"})})]})}function QH({className:t,...e}){return m.jsx(ife,{"data-slot":"dialog-title",className:He("text-base leading-none font-medium",t),...e})}function JH({className:t,...e}){return m.jsx(eRe,{"data-slot":"dialog-description",className:He("text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3",t),...e})}function mve({className:t,orientation:e="horizontal",...n}){return m.jsx(qDe,{"data-slot":"tabs","data-orientation":e,className:He("group/tabs flex gap-2 data-horizontal:flex-col",t),...n})}const bXe=FH("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 gve({className:t,variant:e="default",...n}){return m.jsx(WDe,{"data-slot":"tabs-list","data-variant":e,className:He(bXe({variant:e}),t),...n})}function O7({className:t,...e}){return m.jsx(GDe,{"data-slot":"tabs-trigger",className:He("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",t),...e})}function D7({className:t,...e}){return m.jsx(KDe,{"data-slot":"tabs-content",className:He("flex-1 text-sm outline-none",t),...e})}const zJ="llink:mic-device",jJ="llink:camera-device";function BJ(t){try{const e=localStorage.getItem(t);if(!e)return null;const n=JSON.parse(e);return typeof(n==null?void 0:n.deviceId)!="string"?null:{deviceId:n.deviceId,label:n.label??""}}catch{return null}}function FJ(t,e){try{e?localStorage.setItem(t,JSON.stringify(e)):localStorage.removeItem(t)}catch{}}const Eg=_f(t=>({mic:BJ(zJ),camera:BJ(jJ),setMic:e=>{FJ(zJ,e),t({mic:e})},setCamera:e=>{FJ(jJ,e),t({camera:e})}}));function yve({onFilesSelected:t,enabled:e}){const[n,r]=x.useState(!1),i=x.useRef(null),s=x.useRef(0),o=x.useRef(t);x.useEffect(()=>{o.current=t},[t]),x.useEffect(()=>{const h=document.createElement("input");return h.type="file",h.multiple=!0,h.style.display="none",h.addEventListener("change",()=>{var f;(f=h.files)!=null&&f.length&&(o.current(Array.from(h.files)),h.value="")}),document.body.appendChild(h),i.current=h,()=>{document.body.removeChild(h),i.current=null}},[]);const a=x.useCallback(()=>{var h;(h=i.current)==null||h.click()},[]);x.useEffect(()=>{if(!e)return;const h=f=>{const p=f.clipboardData;if(!p)return;const g=Array.from(p.files);g.length===0||p.types.includes("text/plain")||(f.preventDefault(),f.stopPropagation(),o.current(g))};return window.addEventListener("paste",h,!0),()=>window.removeEventListener("paste",h,!0)},[e]);const l=x.useCallback(h=>{e&&(h.preventDefault(),h.stopPropagation())},[e]),c=x.useCallback(h=>{e&&(h.preventDefault(),h.stopPropagation(),s.current++,s.current===1&&r(!0))},[e]),u=x.useCallback(h=>{e&&(h.preventDefault(),h.stopPropagation(),s.current--,s.current===0&&r(!1))},[e]),d=x.useCallback(h=>{if(!e)return;h.preventDefault(),h.stopPropagation(),s.current=0,r(!1);const f=Array.from(h.dataTransfer.files);f.length>0&&o.current(f)},[e]);return{openFilePicker:a,isDragging:n,dropZoneProps:{onDragOver:l,onDragEnter:c,onDragLeave:u,onDrop:d}}}async function vve(t,{size:e=512,mirror:n=!1}={}){if(!Number.isInteger(e)||e<=0)throw new Error("Avatar size must be a positive integer");const r=Math.min(t.width,t.height);if(r===0)throw new Error("Image source has zero dimensions");const i=(t.width-r)/2,s=(t.height-r)/2,o=new OffscreenCanvas(e,e),a=o.getContext("2d");if(!a)throw new Error("Failed to acquire 2D canvas context");return n&&(a.translate(e,0),a.scale(-1,1)),a.drawImage(t,i,s,r,r,0,0,e,e),o.convertToBlob({type:"image/jpeg",quality:.82})}const wXe=30*1024*1024;function xXe({open:t,onOpenChange:e}){var C;const n=Dn(R=>R.user),r=Dn(R=>R.refreshUser),i=pve(n==null?void 0:n.avatar_object_id),s=((C=n==null?void 0:n.email_prefix)==null?void 0:C.slice(0,2).toUpperCase())??"?",o=!!(n!=null&&n.avatar_object_id),[a,l]=x.useState("upload"),[c,u]=x.useState(null),[d,h]=x.useState(!1),f=x.useRef(c);x.useEffect(()=>{f.current=c},[c]),x.useEffect(()=>()=>{f.current&&URL.revokeObjectURL(f.current.url)},[]);const p=x.useCallback(R=>{u(M=>(M&&URL.revokeObjectURL(M.url),{blob:R,url:URL.createObjectURL(R)}))},[]),g=x.useCallback(()=>{u(R=>(R&&URL.revokeObjectURL(R.url),null)),l("upload"),h(!1),e(!1)},[e]),y=x.useCallback(R=>{R?e(!0):g()},[g,e]),v=x.useCallback(async R=>{const M=R[0];if(M){if(!M.type.startsWith("image/")){Hn.error("Please choose an image file.");return}if(M.size>wXe){Hn.error("That image is too large — choose one under 30MB.");return}try{const D=await createImageBitmap(M),P=await vve(D);D.close(),p(P)}catch(D){Hn.error("Could not process that image."),Zi(D,{scope:"avatar.processFile"})}}},[p]),{openFilePicker:b,isDragging:_,dropZoneProps:S}=yve({onFilesSelected:v,enabled:t&&a==="upload"}),k=async()=>{if(c){h(!0);try{await Bn.updateAvatar(c.blob),await r(),Hn.success("Avatar updated"),g()}catch(R){Hn.error(zm(R)),Zi(R,{scope:"avatar.save"}),h(!1)}}},T=async()=>{h(!0);try{await Bn.deleteAvatar(),await r(),Hn.success("Avatar removed"),g()}catch(R){Hn.error(zm(R)),Zi(R,{scope:"avatar.remove"}),h(!1)}},E=(c==null?void 0:c.url)??i;return m.jsx(KH,{open:t,onOpenChange:y,children:m.jsxs(YH,{children:[m.jsxs(ZH,{children:[m.jsx(QH,{children:"Profile picture"}),m.jsx(JH,{children:"Upload an image or take one with your camera."})]}),m.jsxs("div",{className:"flex flex-col items-center gap-4 py-1",children:[m.jsx("div",{className:"bg-muted flex size-24 items-center justify-center overflow-hidden rounded-full border",children:E?m.jsx("img",{src:E,alt:"",className:"size-full object-cover"}):m.jsx("span",{className:"text-muted-foreground text-2xl font-medium",children:s})}),m.jsxs(mve,{value:a,onValueChange:R=>l(R),className:"w-full",children:[m.jsxs(gve,{className:"w-full",children:[m.jsxs(O7,{value:"upload",children:[m.jsx(GYe,{}),"Upload"]}),m.jsxs(O7,{value:"camera",children:[m.jsx(NH,{}),"Take photo"]})]}),m.jsx(D7,{value:"upload",className:"pt-3",children:m.jsxs("div",{...S,className:He("flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed px-6 py-5 text-center transition-colors",_&&"border-primary bg-primary/5"),children:[m.jsx(gr,{className:"text-xs",children:"Drag an image here, or"}),m.jsx(Rt,{variant:"outline",size:"sm",onClick:b,children:"Choose image"})]})}),m.jsx(D7,{value:"camera",className:"pt-3",children:m.jsx(_Xe,{active:t&&a==="camera",onCapture:p})})]})]}),m.jsxs(XH,{children:[o&&m.jsxs(Rt,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive sm:mr-auto",onClick:T,disabled:d,children:[m.jsx(x3,{className:"mr-1 size-3.5"}),"Remove"]}),m.jsx(Rt,{variant:"outline",size:"sm",onClick:g,disabled:d,children:"Cancel"}),m.jsxs(Rt,{size:"sm",onClick:k,disabled:!c||d,children:[d&&m.jsx(xI,{className:"mr-1 size-3.5 animate-spin"}),"Save"]})]})]})})}function _Xe({active:t,onCapture:e}){const n=x.useRef(null),[r,i]=x.useState(null),[s,o]=x.useState(null),[a,l]=x.useState(!1),c=Eg(d=>{var h;return(h=d.camera)==null?void 0:h.deviceId});x.useEffect(()=>{if(!t)return;let d=!1,h=null;const f={aspectRatio:{ideal:1}};return c&&(f.deviceId={ideal:c}),navigator.mediaDevices.getUserMedia({video:f,audio:!1}).then(p=>{if(d){p.getTracks().forEach(g=>g.stop());return}h=p,i(p),o(null)}).catch(p=>{d||o(p instanceof Error?p.message:"Unable to access camera")}),()=>{d=!0,h==null||h.getTracks().forEach(p=>p.stop()),i(null)}},[t,c]),x.useEffect(()=>{n.current&&(n.current.srcObject=r)},[r]);const u=async()=>{const d=n.current;if(!d||d.readyState<2||!d.videoWidth){Hn.error("Camera is still starting — try again in a moment.");return}l(!0);try{const h=await createImageBitmap(d),f=await vve(h,{mirror:!0});h.close(),e(f)}catch(h){Hn.error("Could not capture photo."),Zi(h,{scope:"avatar.capture"})}finally{l(!1)}};return s?m.jsxs("div",{className:"flex flex-col items-center gap-1 rounded-lg border border-dashed px-6 py-5 text-center",children:[m.jsx(gr,{className:"text-xs",children:"Couldn't access your camera."}),m.jsx(gr,{className:"text-[11px]",children:s})]}):m.jsxs("div",{className:"flex flex-col items-center gap-3",children:[m.jsx("div",{className:"bg-muted size-36 overflow-hidden rounded-full border",children:m.jsx("video",{ref:n,muted:!0,autoPlay:!0,playsInline:!0,className:"size-full -scale-x-100 object-cover"})}),m.jsxs(Rt,{size:"sm",onClick:u,disabled:!r||a,children:[m.jsx(NH,{className:"mr-1 size-3.5"}),"Capture"]})]})}function Gi({className:t,orientation:e="horizontal",decorative:n=!0,...r}){return m.jsx(LDe,{"data-slot":"separator",decorative:n,orientation:e,className:He("bg-border shrink-0 data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",t),...r})}function _z({className:t,size:e="default",...n}){return m.jsx(VDe,{"data-slot":"switch","data-size":e,className:He("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",t),...n,children:m.jsx($De,{"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 dark:data-unchecked:bg-foreground"})})}function bd({className:t,children:e,...n}){return m.jsxs(YOe,{"data-slot":"scroll-area",className:He("relative",t),...n,children:[m.jsx(ZOe,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:e}),m.jsx(eU,{}),m.jsx(XOe,{})]})}function eU({className:t,orientation:e="vertical",...n}){return m.jsx(qpe,{"data-slot":"scroll-area-scrollbar","data-orientation":e,orientation:e,className:He("data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent flex touch-none p-px transition-colors select-none",t),...n,children:m.jsx(Ype,{"data-slot":"scroll-area-thumb",className:"rounded-full bg-border relative flex-1"})})}function bve({email:t,className:e}){const[n,r]=x.useState(!1);x.useEffect(()=>{if(!n)return;const s=setTimeout(()=>r(!1),1500);return()=>clearTimeout(s)},[n]);const i=async s=>{s.stopPropagation();try{await navigator.clipboard.writeText(t),r(!0),Hn.success("Email copied")}catch{Hn.error("Failed to copy email")}};return m.jsxs("button",{type:"button",onClick:i,"aria-label":`Copy ${t}`,className:He("hover:bg-accent inline-flex items-center gap-1.5 rounded-md px-2 py-1 font-mono text-sm transition-colors",e),children:[m.jsx("span",{children:t}),n?m.jsx(wI,{className:"text-muted-foreground size-3.5"}):m.jsx(Lye,{className:"text-muted-foreground size-3.5"})]})}class SXe{constructor(){Ui(this,"ctx",null);Ui(this,"masterGain",null);Ui(this,"limiter",null);Ui(this,"buffers",new Map);Ui(this,"loading",new Map);Ui(this,"lastPlayedAt",new Map);Ui(this,"options",{masterVolume:.02,enabled:!0})}setOptions(e){this.options={...this.options,...e},this.masterGain&&(this.masterGain.gain.value=this.options.masterVolume)}getContext(){if(this.ctx)return this.ctx;try{const e=window.AudioContext??window.webkitAudioContext;return e?(this.ctx=new e,this.masterGain=this.ctx.createGain(),this.masterGain.gain.value=this.options.masterVolume,this.limiter=this.ctx.createDynamicsCompressor(),this.limiter.threshold.value=-24,this.limiter.knee.value=0,this.limiter.ratio.value=20,this.limiter.attack.value=.001,this.limiter.release.value=.08,this.masterGain.connect(this.limiter),this.limiter.connect(this.ctx.destination),this.ctx):null}catch(e){return Zi(e,{scope:"soundEffects.createContext"}),null}}preload(e,n){if(this.buffers.has(e))return Promise.resolve(this.buffers.get(e)??null);const r=this.loading.get(e);if(r)return r;const i=this.getContext();if(!i)return Promise.resolve(null);const s=fetch(n).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status} loading ${n}`);return o.arrayBuffer()}).then(o=>i.decodeAudioData(o)).then(o=>(this.buffers.set(e,o),o)).catch(o=>(Zi(o,{scope:"soundEffects.preload",name:e}),null));return this.loading.set(e,s),s}play(e,n={}){if(!this.options.enabled)return;const r=this.buffers.get(e);if(!r)return;const i=this.ctx,s=this.masterGain;if(!i||!s)return;i.state==="suspended"&&i.resume().catch(h=>Zi(h,{scope:"soundEffects.resume"}));const o=n.throttleMs??15,a=i.currentTime*1e3,l=this.lastPlayedAt.get(e)??-1/0;if(a-l<o)return;this.lastPlayedAt.set(e,a);const c=i.createBufferSource();c.buffer=r;const u=n.pitchVariance??.04;if(u>0){const h=1+(Math.random()*2-1)*u;c.playbackRate.value=h}const d=i.createGain();d.gain.value=n.volume??1,c.connect(d).connect(s),c.start(0)}}const P7=new SXe,wve="llink:soundEffects-enabled",VJ=!0;function kXe(){try{const t=localStorage.getItem(wve);return t===null?VJ:t==="true"}catch{return VJ}}const $J=_f(t=>{const e=kXe();return P7.setOptions({enabled:e}),{enabled:e,setEnabled:n=>{t({enabled:n}),P7.setOptions({enabled:n});try{localStorage.setItem(wve,String(n))}catch{}}}});function G2({icon:t,label:e,detail:n,onClick:r,destructive:i}){return m.jsxs("button",{type:"button",onClick:r,className:`flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-accent ${i?"text-destructive":""}`,children:[m.jsx("span",{className:"text-muted-foreground flex size-5 items-center justify-center",children:t}),m.jsx("span",{className:"min-w-0 flex-1 text-sm font-medium",children:e}),n&&m.jsx(gr,{className:"text-xs",children:n}),r&&!i&&m.jsx(OH,{className:"text-muted-foreground size-4"})]})}function K2({title:t,children:e}){return m.jsxs("div",{children:[m.jsx("p",{className:"text-muted-foreground px-4 pb-1 pt-4 text-xs font-medium uppercase tracking-wider",children:t}),m.jsx("div",{children:e})]})}function CXe(){var f;const t=oo(),e=Dn(p=>p.user),n=Dn(p=>p.signOut),[r,i]=x.useState((e==null?void 0:e.email_notifications_enabled)??!0),s=$J(p=>p.enabled),o=$J(p=>p.setEnabled),[a,l]=x.useState(),[c,u]=x.useState(!1);x.useEffect(()=>{cr.app.getVersion().then(l)},[]);const d=async p=>{i(p),Dn.setState(g=>({user:g.user?{...g.user,email_notifications_enabled:p}:null}));try{await Bn.updateSettings({email_notifications_enabled:p})}catch(g){i(!p),Dn.setState(y=>({user:y.user?{...y.user,email_notifications_enabled:!p}:null})),Hn.error(zm(g)),Zi(g,{scope:"settings.emailNotifications"})}},h=((f=e==null?void 0:e.email_prefix)==null?void 0:f.slice(0,2).toUpperCase())??"?";return m.jsxs("div",{className:"flex h-screen flex-col",children:[m.jsxs("div",{className:"drag-region flex items-center gap-3 border-b px-3 py-1",children:[m.jsx(n2,{}),m.jsx(Rt,{variant:"ghost",size:"sm",className:"no-drag text-muted-foreground",onClick:()=>t(-1),children:m.jsx(MH,{className:"size-3.5"})}),m.jsx("span",{className:"text-sm font-medium",children:"Settings"}),m.jsx("div",{className:"flex-1"})]}),m.jsxs(bd,{className:"flex-1",children:[m.jsxs("div",{className:"flex items-center gap-3 px-4 py-5",children:[m.jsxs("button",{type:"button",onClick:()=>u(!0),className:"group relative rounded-full","aria-label":"Change profile picture",children:[m.jsx(Xc,{size:"lg",avatarObjectId:e==null?void 0:e.avatar_object_id,initials:h,fallbackClassName:"bg-primary/10 text-primary font-medium"}),m.jsx("span",{className:"absolute inset-0 flex items-center justify-center rounded-full bg-black/40 opacity-0 transition-opacity group-hover:opacity-100",children:m.jsx(NH,{className:"size-4 text-white"})})]}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:"truncate text-sm font-medium",children:e==null?void 0:e.email_prefix}),m.jsx(gr,{className:"text-xs",children:e==null?void 0:e.email})]})]}),m.jsx(xXe,{open:c,onOpenChange:u}),m.jsx(Gi,{}),m.jsxs(K2,{title:"Notifications",children:[m.jsxs("div",{className:"flex w-full items-center gap-3 px-4 py-3",children:[m.jsx("span",{className:"text-muted-foreground flex size-5 items-center justify-center",children:m.jsx(Fye,{className:"size-4"})}),m.jsx("span",{className:"min-w-0 flex-1 text-sm font-medium",children:"Email notifications"}),m.jsx(_z,{size:"sm",checked:r,onCheckedChange:d})]}),m.jsxs("div",{className:"flex w-full items-center gap-3 px-4 py-3",children:[m.jsx("span",{className:"text-muted-foreground flex size-5 items-center justify-center",children:m.jsx(qye,{className:"size-4"})}),m.jsx("span",{className:"min-w-0 flex-1 text-sm font-medium",children:"Sound effects"}),m.jsx(_z,{size:"sm",checked:s,onCheckedChange:o})]})]}),m.jsx(Gi,{className:"mt-4"}),m.jsx(K2,{title:"Media",children:m.jsx(G2,{icon:m.jsx(zH,{className:"size-4"}),label:"Audio & Video",onClick:()=>t("/settings/audio-video")})}),m.jsx(Gi,{className:"mt-4"}),m.jsx(K2,{title:"About",children:m.jsx(G2,{icon:m.jsx(Bye,{className:"size-4"}),label:"Version",detail:a})}),m.jsx(Gi,{className:"mt-4"}),m.jsxs(K2,{title:"Legal",children:[m.jsx(G2,{icon:m.jsx(Hye,{className:"size-4"}),label:"Privacy Policy",onClick:()=>cr.link.openExternal(Kye)}),m.jsx(G2,{icon:m.jsx(zye,{className:"size-4"}),label:"Terms of Service",onClick:()=>cr.link.openExternal(Yye)})]}),m.jsx(Gi,{className:"mt-4"}),m.jsx(K2,{title:"Contact us",children:m.jsxs("div",{className:"flex w-full items-center gap-3 px-4 py-3",children:[m.jsx("span",{className:"text-muted-foreground flex size-5 items-center justify-center",children:m.jsx(bYe,{className:"size-4"})}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:"text-sm font-medium",children:"Email support"}),m.jsx(gr,{className:"text-xs",children:"Questions, feedback, or bug reports"})]}),m.jsx(bve,{email:Gye})]})}),m.jsx(Gi,{className:"mt-4"}),m.jsx("div",{className:"py-4",children:m.jsx(G2,{icon:m.jsx(CYe,{className:"size-4"}),label:"Sign out",onClick:n,destructive:!0})})]})]})}function tU({...t}){return m.jsx(xDe,{"data-slot":"select",...t})}function nU({...t}){return m.jsx(SDe,{"data-slot":"select-value",...t})}function rU({className:t,size:e="default",children:n,...r}){return m.jsxs(_De,{"data-slot":"select-trigger","data-size":e,className:He("border-input data-placeholder:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-lg border bg-transparent py-2 pr-2 pl-2.5 text-sm transition-colors select-none focus-visible:ring-3 aria-invalid:ring-3 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-4 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...r,children:[n,m.jsx(kDe,{asChild:!0,children:m.jsx(Dye,{className:"text-muted-foreground size-4 pointer-events-none"})})]})}function iU({className:t,children:e,position:n="item-aligned",align:r="center",...i}){return m.jsx(CDe,{children:m.jsxs(EDe,{"data-slot":"select-content","data-align-trigger":n==="item-aligned",className:He("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-36 rounded-lg shadow-md ring-1 duration-100 relative z-50 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto data-[align-trigger=true]:animate-none",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",t),position:n,align:r,...i,children:[m.jsx(EXe,{}),m.jsx(TDe,{"data-position":n,className:He("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:e}),m.jsx(TXe,{})]})})}function ex({className:t,children:e,...n}){return m.jsxs(ADe,{"data-slot":"select-item",className:He("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...n,children:[m.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:m.jsx(RDe,{children:m.jsx(wI,{className:"pointer-events-none"})})}),m.jsx(IDe,{children:e})]})}function EXe({className:t,...e}){return m.jsx(MDe,{"data-slot":"select-scroll-up-button",className:He("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",t),...e,children:m.jsx(QKe,{})})}function TXe({className:t,...e}){return m.jsx(NDe,{"data-slot":"select-scroll-down-button",className:He("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",t),...e,children:m.jsx(Dye,{})})}const HJ=100,AXe=4500,IXe=-75,RXe=-25,MXe=40,NXe=220,UJ=.3;function SI({sourceNode:t,width:e=168,height:n=56,barWidth:r=4,gap:i=4,className:s}){const o=x.useRef(null);return x.useEffect(()=>{const a=o.current,l=a==null?void 0:a.getContext("2d");if(!a||!l)return;const c=a,u=l,{analyser:d,detach:h}=OXe(t,512);d.smoothingTimeConstant=.8,d.minDecibels=IXe,d.maxDecibels=RXe;const f=new Uint8Array(d.frequencyBinCount),p=r+i;let g=Math.floor((e+i)/p);g%2===0&&(g-=1);const y=(g-1)/2,v=t.context.sampleRate/d.fftSize,b=new Uint16Array(y+1);for(let M=0;M<=y;M++){const D=HJ*Math.pow(AXe/HJ,y===0?0:M/y);b[M]=Math.min(f.length-1,Math.round(D/v))}const _=new Float32Array(y+1),S=DXe(c,u,e,n);let k="",T=0,E=performance.now(),C=0;function R(){const M=performance.now(),D=M-E;E=M,d.getByteFrequencyData(f);for(let z=0;z<=y;z++){const Z=f[b[z]]/255,re=y===0?1:UJ+(1-UJ)*Math.cos(z/y*Math.PI/2),G=Math.pow(Z,1.4)*re,ee=G>_[z]?MXe:NXe,J=1-Math.exp(-D/ee);_[z]+=J*(G-_[z])}(S()||!k||M-T>200)&&(k=getComputedStyle(c).color,T=M),u.clearRect(0,0,e,n),u.fillStyle=k;const P=e/2-r/2;u.beginPath();for(let z=0;z<=y;z++){const Z=Math.max(r,_[z]*n),re=(n-Z)/2;u.roundRect(P+z*p,re,r,Z,r/2),z>0&&u.roundRect(P-z*p,re,r,Z,r/2)}u.fill(),C=requestAnimationFrame(R)}return C=requestAnimationFrame(R),()=>{cancelAnimationFrame(C),h()}},[t,e,n,r,i]),m.jsx("canvas",{ref:o,className:s,style:{width:e,height:n}})}function OXe(t,e){const n=t.context,r=n.createAnalyser();r.fftSize=e,t.connect(r);const i=n.createGain();return i.gain.value=0,r.connect(i),i.connect(n.destination),{analyser:r,detach(){try{t.disconnect(r),r.disconnect(i),i.disconnect(n.destination)}catch{}}}}function DXe(t,e,n,r){let i=0;return()=>{const s=window.devicePixelRatio||1;return s===i?!1:(i=s,t.width=Math.round(n*i),t.height=Math.round(r*i),e.setTransform(i,0,0,i,0,0),!0)}}function kI(t){const[e,n]=x.useState(null),r=x.useRef(new WeakMap);return x.useEffect(()=>{let i=null,s;if(t instanceof MediaStream){const o=new AudioContext;o.resume(),i={sourceNode:o.createMediaStreamSource(t),ctx:o},s=()=>o.close()}else if(t){const o=r.current.get(t);if(o)o.ctx.resume(),i=o;else{const a=new AudioContext;a.resume();const l=a.createMediaElementSource(t);l.connect(a.destination),r.current.set(t,{sourceNode:l,ctx:a}),i={sourceNode:l,ctx:a},s=()=>{a.close(),r.current.delete(t)}}}return n(i),s},[t]),e}function xve(){const[t,e]=x.useState([]),[n,r]=x.useState("unknown"),[i,s]=x.useState(null),o=x.useCallback(()=>navigator.mediaDevices.enumerateDevices().then(l=>{e(l),l.some(u=>(u.kind==="audioinput"||u.kind==="videoinput")&&u.label.length>0)&&r("granted")}).catch(l=>{s(l instanceof Error?l.message:"Failed to list devices")}),[]),a=x.useCallback(async()=>{try{(await navigator.mediaDevices.getUserMedia({audio:!0,video:!0})).getTracks().forEach(c=>c.stop()),r("granted"),s(null),await o()}catch(l){r("denied"),s(l instanceof Error?l.message:"Microphone/camera access denied")}},[o]);return x.useEffect(()=>{o();const l=()=>{o()};return navigator.mediaDevices.addEventListener("devicechange",l),()=>{navigator.mediaDevices.removeEventListener("devicechange",l)}},[o]),{audioInputs:t.filter(l=>l.kind==="audioinput"&&l.deviceId!==""),videoInputs:t.filter(l=>l.kind==="videoinput"&&l.deviceId!==""),permissionState:n,refresh:o,requestLabels:a,error:i}}function L7(t,e){if(!t)return;const n=e.find(r=>r.deviceId===t.deviceId);return n?n.deviceId:void 0}function qJ(t,e){return t?e.some(n=>n.deviceId===t.deviceId):!0}const DN="__system_default__";function PXe(t,e,n,r){const[i,s]=x.useState(null),[o,a]=x.useState(null),[l,c]=x.useState(t);return t!==l&&(c(t),t||(s(null),a(null))),x.useEffect(()=>{if(!t)return;let u=!1,d=null;const h=e?{deviceId:{exact:e}}:!0,f=r?n?{deviceId:{exact:n},aspectRatio:{ideal:16/9}}:{aspectRatio:{ideal:16/9}}:!1;return navigator.mediaDevices.getUserMedia({audio:h,video:f}).then(p=>{if(u){p.getTracks().forEach(g=>g.stop());return}d=p,s(p),a(null)}).catch(p=>{u||(s(null),a(p instanceof Error?p.message:"Unable to access devices"))}),()=>{u=!0,d==null||d.getTracks().forEach(p=>p.stop())}},[t,e,n,r]),{stream:i,error:o}}function LXe(t,e){return t.label?t.label:`${t.kind==="audioinput"?"Microphone":"Camera"} ${e+1}`}function WJ({children:t}){return m.jsx("label",{className:"text-muted-foreground text-[11px] font-medium uppercase tracking-wider",children:t})}function zXe({stream:t}){const e=kI(t);return e?m.jsx(SI,{sourceNode:e.sourceNode,width:80,height:12,barWidth:2,gap:3,className:"text-primary"}):m.jsx("div",{className:"bg-muted h-3 w-20 rounded-sm opacity-50"})}function jXe({stream:t}){const e=x.useRef(null),n=((t==null?void 0:t.getVideoTracks().length)??0)>0;return x.useEffect(()=>{e.current&&(e.current.srcObject=n?t:null)},[t,n]),m.jsx("div",{className:"bg-muted/40 relative aspect-video w-full overflow-hidden rounded-md border",children:n?m.jsx("video",{ref:e,muted:!0,autoPlay:!0,playsInline:!0,className:"h-full w-full -scale-x-100 object-cover"}):m.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-1.5",children:[m.jsx(XYe,{className:"text-muted-foreground size-4"}),m.jsx(gr,{className:"text-[11px]",children:"No preview"})]})})}function GJ({devices:t,saved:e,onChange:n,placeholder:r}){const i=(e==null?void 0:e.deviceId)??DN;return m.jsxs(tU,{value:i,onValueChange:s=>{if(s===DN){n(null);return}const o=t.find(a=>a.deviceId===s);o&&n({deviceId:o.deviceId,label:o.label})},children:[m.jsx(rU,{size:"sm",className:"w-full",children:m.jsx(nU,{placeholder:r})}),m.jsxs(iU,{children:[m.jsx(ex,{value:DN,children:"System default"}),t.map((s,o)=>m.jsx(ex,{value:s.deviceId,children:LXe(s,o)},s.deviceId))]})]})}function BXe(){const t=oo(),{audioInputs:e,videoInputs:n,permissionState:r,requestLabels:i,error:s}=xve(),o=Eg(b=>b.mic),a=Eg(b=>b.camera),l=Eg(b=>b.setMic),c=Eg(b=>b.setCamera),u=x.useMemo(()=>L7(o,e),[o,e]),d=x.useMemo(()=>L7(a,n),[a,n]),h=n.length>0,f=r==="granted",{stream:p,error:g}=PXe(f,u,d,h),y=f&&!qJ(o,e),v=f&&!qJ(a,n);return m.jsxs("div",{className:"flex h-screen flex-col",children:[m.jsxs("div",{className:"drag-region flex items-center gap-3 border-b px-3 py-1",children:[m.jsx(n2,{}),m.jsx(Rt,{variant:"ghost",size:"sm",className:"no-drag text-muted-foreground",onClick:()=>t(-1),children:m.jsx(MH,{className:"size-3.5"})}),m.jsx("span",{className:"text-sm font-medium",children:"Audio & Video"}),m.jsx("div",{className:"flex-1"})]}),m.jsx(bd,{className:"min-h-0 flex-1",children:m.jsxs("div",{className:"space-y-5 px-5 py-5",children:[!f&&m.jsxs("div",{className:"bg-muted/40 flex items-start justify-between gap-3 rounded-md border px-3 py-2.5",children:[m.jsxs("div",{className:"min-w-0",children:[m.jsx("p",{className:"text-sm font-medium",children:"Allow device access"}),m.jsx(gr,{className:"text-[11px] leading-snug",children:"Grant permission to see device names and a live preview."})]}),m.jsx(Rt,{size:"sm",onClick:()=>i(),children:"Allow"})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx(WJ,{children:"Microphone"}),m.jsx(zXe,{stream:f?p:null})]}),m.jsx(GJ,{devices:e,saved:o,onChange:l,placeholder:"System default"}),y&&m.jsx(gr,{className:"text-[11px]",children:"Saved mic unavailable — using system default."})]}),m.jsxs("div",{className:"space-y-2",children:[m.jsx(WJ,{children:"Camera"}),m.jsx(GJ,{devices:n,saved:a,onChange:c,placeholder:n.length===0?"No cameras found":"System default"}),m.jsx(jXe,{stream:f?p:null}),v&&m.jsx(gr,{className:"text-[11px]",children:"Saved camera unavailable — using system default."})]}),(g||s&&r==="denied")&&m.jsx(gr,{className:"text-destructive text-[11px]",children:g??s})]})}),m.jsx("div",{className:"flex items-center justify-end border-t px-5 py-3",children:m.jsx(Rt,{size:"sm",onClick:()=>t(-1),children:"Done"})})]})}const FXe=FH("h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive overflow-hidden group/badge",{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 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark: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 km({className:t,variant:e="default",asChild:n=!1,...r}){const i=n?$V:"span";return m.jsx(i,{"data-slot":"badge","data-variant":e,className:He(FXe({variant:e}),t),...r})}function k3(){return _0({queryKey:["networks"],queryFn:()=>Bn.listNetworks()})}function xa(t){const{data:e}=k3();return(e==null?void 0:e.find(n=>n.id===t))||null}function _ve(t){const e=xa(t),n=Dn(r=>{var i;return(i=r.user)==null?void 0:i.id});return!e||!n?!1:e.admin_human.id===n}function VXe(){return _0({queryKey:["my-invitations"],queryFn:()=>Bn.listMyInvitations(),refetchInterval:1e4})}function $Xe(t){return _0({queryKey:["network-invitations",t],queryFn:()=>Bn.listNetworkInvitations(t)})}function HXe(t){const e=cl();return kf({mutationFn:n=>Bn.addMembers(t,{email_addresses:n}),onSuccess:()=>{e.invalidateQueries({queryKey:["network-invitations",t]}),e.invalidateQueries({queryKey:["networks"]})}})}function UXe(){const t=cl();return kf({mutationFn:e=>Bn.acceptInvitation({network_id:e}),onSuccess:()=>{t.invalidateQueries({queryKey:["my-invitations"]}),t.invalidateQueries({queryKey:["networks"]})}})}function qXe(t){const e=cl();return kf({mutationFn:n=>Bn.revokeInvitation(t,{email:n}),onSuccess:()=>{e.invalidateQueries({queryKey:["network-invitations",t]})}})}function WXe(t){const e=cl();return kf({mutationFn:n=>Bn.removeMember(t,n),onSuccess:()=>{e.invalidateQueries({queryKey:["networks"]})}})}function sU({className:t,value:e,...n}){return m.jsx(kOe,{"data-slot":"progress",className:He("bg-muted h-1 rounded-full relative flex w-full items-center overflow-x-hidden",t),...n,children:m.jsx(COe,{"data-slot":"progress-indicator",className:"bg-primary size-full flex-1 transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})})}function GXe({network:t,onClick:e,onSettingsClick:n}){const r=t.name.slice(0,2).toUpperCase(),i=t.humans.length;return m.jsxs("button",{type:"button",onClick:e,className:"group flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-accent",children:[m.jsx(_3,{children:m.jsx(S3,{className:"bg-primary/10 text-primary font-medium",children:r})}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:"truncate text-sm font-medium",children:t.name}),m.jsxs("div",{className:"text-muted-foreground flex items-center gap-1",children:[m.jsx(_I,{className:"size-3"}),m.jsxs(Um,{className:"text-muted-foreground",children:[i," ",i===1?"member":"members"]})]})]}),m.jsx("span",{role:"button",tabIndex:0,className:"text-muted-foreground hover:text-foreground opacity-0 transition-opacity group-hover:opacity-100",onClick:s=>{s.stopPropagation(),n()},onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.stopPropagation(),n())},children:m.jsx(BH,{className:"size-4"})})]})}function KXe({invitation:t}){const e=UXe(),n=t.network_name.slice(0,2).toUpperCase(),r=()=>{e.mutate(t.network_id,{onSuccess:()=>{Hn.success(`Joined ${t.network_name}`)}})};return m.jsxs("div",{className:"flex w-full items-center gap-3 px-4 py-3",children:[m.jsx(_3,{children:m.jsx(S3,{className:"bg-primary/10 text-primary font-medium",children:n})}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:"truncate text-sm font-medium",children:t.network_name}),m.jsx(Um,{className:"text-muted-foreground",children:"You've been invited"})]}),m.jsxs(Rt,{size:"sm",onClick:r,disabled:e.isPending,children:[m.jsx(wI,{className:"mr-1 size-3.5"}),e.isPending?"Joining...":"Accept"]})]})}function KJ({open:t,onOpenChange:e}){const[n,r]=x.useState(""),i=oo(),s=cl(),o=kf({mutationFn:l=>Bn.createNetwork({name:l}),onSuccess:l=>{s.invalidateQueries({queryKey:["networks"]}),Hn.success(`Created ${l.name}`),e(!1),r(""),i(`/${l.id}/settings?section=members&add=1`)}}),a=l=>{l.preventDefault();const c=n.trim();c&&o.mutate(c)};return m.jsx(KH,{open:t,onOpenChange:e,children:m.jsxs(YH,{children:[m.jsxs(ZH,{children:[m.jsx(QH,{children:"Create a Network"}),m.jsx(JH,{children:"Caution: creating a network will create a new billing account. If your team already has a network, ask them for an invite."})]}),m.jsxs("form",{onSubmit:a,children:[m.jsx("div",{className:"py-4",children:m.jsx(x0,{placeholder:"Network name",value:n,onChange:l=>r(l.target.value),autoFocus:!0})}),m.jsxs(XH,{children:[m.jsx(Rt,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),m.jsx(Rt,{type:"submit",disabled:!n.trim()||o.isPending,children:o.isPending?"Creating...":"Create"})]})]})]})})}function YXe(){const t=oo(),[e,n]=x.useState(!1),{data:r,isPending:i,error:s,refetch:o}=k3(),{data:a}=VXe();if(i)return m.jsx(sU,{});if(s)return m.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-6 text-center",children:[m.jsx("p",{className:"text-sm font-medium",children:"Couldn't load your networks"}),m.jsx("p",{className:"text-muted-foreground text-xs",children:zm(s)}),m.jsx(Rt,{size:"sm",variant:"outline",onClick:()=>o(),children:"Try again"})]});const l=a&&a.length>0,c=r&&r.length>0;return!c&&!l?m.jsxs("div",{className:"mx-auto flex h-full max-w-sm flex-col items-center justify-center gap-4 px-4 text-center",children:[m.jsx("p",{className:"text-muted-foreground",children:"You don't have access to any networks yet. Create one or ask your admin for an invite."}),m.jsxs("div",{className:"flex flex-row gap-1",children:[m.jsx(Rt,{variant:"outline",onClick:()=>o(),children:"Refresh"}),m.jsxs(Rt,{onClick:()=>n(!0),children:[m.jsx(qS,{className:"mr-1 size-3.5"}),"Create Network"]})]}),m.jsx(KJ,{open:e,onOpenChange:n})]}):m.jsxs(m.Fragment,{children:[m.jsx(bd,{className:"h-full",children:m.jsxs("div",{className:"py-1",children:[l&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex items-center gap-2 px-4 pb-1 pt-4",children:[m.jsx("p",{className:"text-muted-foreground text-xs font-medium uppercase tracking-wider",children:"Pending Invitations"}),m.jsx(km,{variant:"secondary",className:"text-xs",children:a.length})]}),a.map((u,d)=>m.jsxs("div",{children:[m.jsx(KXe,{invitation:u}),d<a.length-1&&m.jsx(Gi,{className:"mx-4"})]},`${u.network_id}-${u.email}`)),m.jsx(Gi,{className:"mx-4 mt-2"})]}),c&&m.jsxs(m.Fragment,{children:[l&&m.jsx("p",{className:"text-muted-foreground px-4 pb-1 pt-4 text-xs font-medium uppercase tracking-wider",children:"Your Networks"}),r.map((u,d)=>m.jsxs("div",{children:[m.jsx(GXe,{network:u,onClick:()=>t(`/${u.id}`),onSettingsClick:()=>t(`/${u.id}/settings`)}),d<r.length-1&&m.jsx(Gi,{className:"mx-4"})]},u.id))]}),m.jsx(Gi,{className:"mx-4 mt-2"}),m.jsx("div",{className:"px-4 py-3",children:m.jsxs(Rt,{variant:"outline",size:"sm",onClick:()=>n(!0),children:[m.jsx(qS,{className:"mr-1 size-3.5"}),"New Network"]})})]})}),m.jsx(KJ,{open:e,onOpenChange:n})]})}function Ls(t,e=[]){return`/${[t,...e].join("/")}`}function ul(t){const e=t.split("/").filter(Boolean);return{networkId:e[0],segments:e.slice(1)}}function Xl(t){const{networkId:e,segments:n}=ul(t),r=`networks/${e}/children`;if(n.length===0)return r;const i=[r,n[0]];for(let s=1;s<n.length;s++)i.push("children",n[s]);return i.join("/")}function CI(t){const{segments:e}=ul(t);return e.length===0?Xl(t):`${Xl(t)}/children`}function ZXe(t,e){return e&&(t==="text"&&e.edited_at?{...e,edited_at:e.edited_at.toDate()}:t==="event"?{...e,start_at:e.start_at.toDate(),end_at:e.end_at?e.end_at.toDate():void 0}:e)}const Sve={toFirestore(t){const{id:e,created_at:n,updated_at:r,...i}=t,s="deleted_at"in t?t.deleted_at:void 0;return{...i,created_at:ir.fromDate(n),...r&&{updated_at:ir.fromDate(r)},...s&&{deleted_at:ir.fromDate(s)}}},fromFirestore(t,e){const n=t.data(e);if(typeof n.type!="string")throw new Error(`Invalid particle type: ${n.type}`);const r=n.type;switch(r){case"stream":return A_.parse({id:t.id,type:n.type,properties:n.properties,created_at:n.created_at.toDate(),created_by_human_id:n.created_by_human_id,updated_at:n.updated_at?n.updated_at.toDate():void 0,visible_to:n.visible_to,playback_markers:n.playback_markers?Object.fromEntries(Object.entries(n.playback_markers).map(([i,s])=>[i,s.toDate()])):void 0,last_child_created_at:n.last_child_created_at?n.last_child_created_at.toDate():void 0,huddle_active_participants:n.huddle_active_participants??void 0});case"folder":return A_.parse({id:t.id,type:n.type,properties:n.properties,created_at:n.created_at.toDate(),created_by_human_id:n.created_by_human_id,updated_at:n.updated_at?n.updated_at.toDate():void 0,visible_to:n.visible_to});case"media":case"file":case"text":case"task":case"event":case"paper":{const i=ZXe(r,n.properties);return A_.parse({id:t.id,type:n.type,properties:i,created_at:n.created_at.toDate(),created_by_human_id:n.created_by_human_id,updated_at:n.updated_at?n.updated_at.toDate():void 0,reactions:n.reactions??void 0,deleted_at:n.deleted_at?n.deleted_at.toDate():void 0,deleted_by_human_id:n.deleted_by_human_id??void 0})}default:throw new Error(`Unknown particle type: ${r}`)}}};function Cf(t){return hye(Mye,t).withConverter(Sve)}function EI(t){return yKe(Mye,t).withConverter(Sve)}function XXe(t,e,n){return RH(Cf(t),r=>{e(r.exists()?r.data():null)},n)}async function kve(t){const e=await PKe(Cf(t));return e.exists()?e.data():null}function QXe(t,{onData:e,onError:n,visibilityScopes:r=[],orderByField:i="created_at",orderDirection:s="desc",onAdded:o,onRemoved:a,whereFilter:l,limit:c}){let u=k4(EI(t),Sye(i,s));return r.length>0&&(u=k4(u,bI("visible_to","array-contains-any",r))),l&&(u=k4(u,l)),c!==void 0&&(u=k4(u,kye(c))),RH(u,d=>{const h=d.docs.map(f=>f.data());if(e(h),o||a)for(const f of d.docChanges())f.type==="added"&&o&&o(f.doc.data()),f.type==="removed"&&a&&a(f.doc.data(),h)},n)}function JXe(t,e,n){const r=k4(EI(t),Sye("created_at","desc"),kye(1));return RH(r,i=>{e(i.empty?null:i.docs[0].data())},n)}async function eQe(t,e,n,r,i){if(Bge(e)&&(!i||i.length===0))throw new Error(`visibleTo is required for container type ${e} and cannot be empty`);const s=A_.parse({id:"",type:e,properties:n,created_at:new Date,created_by_human_id:r,...i?{visible_to:i}:{}});return(await Eye(EI(t),s)).id}async function tQe(t,e,n,r){if(!r||r.length===0)throw new Error("visibleTo is required for streams and cannot be empty");const i=A_.parse({id:"",type:"stream",properties:e,created_at:new Date,created_by_human_id:n,visible_to:r});return(await Eye(EI(t),i)).id}async function Fu(t,e){const n=Cf(t),r={};for(const i in e)r[`properties.${i}`]=e[i];await ky(n,{...r,updated_at:df()})}async function nQe(t,e){const n=Cf(t);await ky(n,{"properties.content":e,"properties.edited_at":df(),updated_at:df()})}async function pE(t,e){const n=Cf(t),r=await kve(t);if(!r)throw new Error(`Particle not found at path: ${t}`);if(!Bge(r.type))throw new Error(`Only container particles can have visible_to field. Particle at ${t} is of type ${r.type}`);await ky(n,{visible_to:e,updated_at:df()})}async function Cve(t,e,n){const r=Cf(t);await ky(r,{[e]:n,updated_at:df()})}async function rQe(t,e){const n=Cf(t);await ky(n,{deleted_at:df(),deleted_by_human_id:e,updated_at:df()})}async function iQe(t,e,n){const r=Cf(t),i=`playback_markers.${e}`;await ky(r,{[i]:ir.fromDate(n),updated_at:df()})}const sQe=/[~*/[\]]/g;function Eve(t){return t.replace(sQe,"")}async function oQe(t,e,n,r){var a;const i=Eve(e);if(!i)return;const s=Cf(t),o=((a=r==null?void 0:r[i])==null?void 0:a.includes(n))??!1;await ky(s,new gI("reactions",i),o?RKe(n):IKe(n),"updated_at",df())}function aQe(t){const[e,n]=x.useState(null),[r,i]=x.useState(!0),[s,o]=x.useState(null);return x.useEffect(()=>{const a=Xl(t),l=XXe(a,c=>{n(c),i(!1)},c=>{o(c),i(!1)});return()=>{l(),i(!0),o(null),n(null)}},[t]),{particle:e,isLoading:r,error:s}}function KS(t,{orderByField:e="created_at",orderDirection:n="desc",visibilityScopes:r,onAdded:i,onRemoved:s,whereFilter:o,limit:a}={}){const[l,c]=x.useState([]),[u,d]=x.useState(!0),[h,f]=x.useState(null),p=x.useRef(i),g=x.useRef(s);return x.useEffect(()=>{p.current=i,g.current=s},[i,s]),x.useEffect(()=>{if(!t)return;const y=CI(t),v=QXe(y,{onData:b=>{c(b),d(!1)},onError:b=>{console.warn(b),f(b),d(!1)},visibilityScopes:r,orderByField:e,orderDirection:n,onAdded:b=>{var _;return(_=p.current)==null?void 0:_.call(p,b)},onRemoved:(b,_)=>{var S;return(S=g.current)==null?void 0:S.call(g,b,_)},whereFilter:o,limit:a});return()=>{v(),c([]),f(null),d(!0)}},[t,o,a,e,n,r]),t?{children:l,isLoading:u,error:h}:{children:[],isLoading:!1,error:null}}function lQe(t){const[e,n]=x.useState(null),[r,i]=x.useState(!0);return x.useEffect(()=>{const s=JXe(CI(t),o=>{n(o),i(!1)},()=>{i(!1)});return()=>{s(),i(!0),n(null)}},[t]),{latestChild:e,isLoading:r}}function cQe(t){return _0({queryKey:["particle",t],queryFn:async()=>{if(!t)return null;const e=Xl(t);return await kve(e)},enabled:!!t})}const uQe=24,dQe=24,hQe=bI("type","in",["stream","folder"]),fQe=bI("type","in",["media","file","text","task","event","paper"]);function YJ(t){return t.type==="stream"&&t.last_child_created_at?t.last_child_created_at.getTime():t.created_at.getTime()}function pQe(t){const{networkId:e}=ul(t),n=Dn(f=>{var p;return(p=f.user)==null?void 0:p.id}),r=x.useMemo(()=>{const f=[];return n&&f.push(`human:${n}`),f.push(`network:${e}`),f},[n,e]),[i,s]=x.useState(uQe),{children:o,isLoading:a}=KS(t,{orderByField:"created_at",orderDirection:"desc",visibilityScopes:r,whereFilter:hQe,limit:i}),{children:l,isLoading:c}=KS(t,{orderByField:"created_at",orderDirection:"desc",whereFilter:fQe,limit:i}),u=x.useMemo(()=>[...o,...l].sort((f,p)=>YJ(p)-YJ(f)),[o,l]),d=o.length>=i||l.length>=i,h=x.useCallback(()=>{s(f=>f+dQe)},[]);return{items:u,isLoading:a||c,canLoadMore:d,loadMore:h}}const ZJ="llink:recording-mode",G1=_f(t=>({recordingMode:localStorage.getItem(ZJ)==="audio"?"audio":"video",setRecordingMode:e=>{localStorage.setItem(ZJ,e),t({recordingMode:e})}}));function mQe({items:t,enabled:e,onOpen:n}){const[r,i]=x.useState(t.length>0?0:null),[s,o]=x.useState(t.length),a=G1(c=>c.recordingMode),l=G1(c=>c.setRecordingMode);return t.length!==s&&(o(t.length),t.length===0?i(null):r===null&&i(0)),x.useEffect(()=>{if(!e||t.length===0)return;const c=u=>{if(u.defaultPrevented)return;const d=u.target;if(d.tagName==="INPUT"||d.tagName==="TEXTAREA"||d.isContentEditable)return;const h=parseInt(u.key,10);if(h>=1&&h<=9){const p=h-1;p<t.length&&(u.preventDefault(),n(t[p].id));return}if(u.key==="Enter"){i(p=>(p!==null&&p<t.length&&(u.preventDefault(),n(t[p].id)),p));return}if(u.key==="v"||u.key==="V"){u.preventDefault(),l(a==="video"?"audio":"video");return}let f=null;u.key==="ArrowDown"?f=1:u.key==="ArrowUp"&&(f=-1),f!==null&&(u.preventDefault(),i(p=>{if(p===null)return 0;const g=p+f;return Math.max(0,Math.min(g,t.length-1))}))};return window.addEventListener("keydown",c,!0),()=>window.removeEventListener("keydown",c,!0)},[e,t,n,a,l]),{selectedIndex:r}}const TI=t=>["network-usage",t];function oU(t){return _0({queryKey:TI(t),queryFn:t?()=>Bn.getNetworkUsage(t):Ey,refetchOnMount:"always",refetchOnWindowFocus:!0,refetchInterval:1e4})}function Tve(){const t=cl();return x.useCallback(e=>t.invalidateQueries({queryKey:TI(e)}),[t])}function gQe(){const t=cl();return x.useCallback(e=>{t.setQueryData(TI(e),n=>n&&{...n,used:n.used+1})},[t])}function Ave(t){return!t||t.limit==null?!1:t.used>=t.limit}function Ive(){const t=cl(),e=gQe(),n=Tve();return kf({meta:{suppressToast:!0},mutationFn:async r=>{const{networkId:i}=ul(r.path);if(!DL.has(r.type)){const a=t.getQueryData(TI(i));if(Ave(a))throw new jge(i)}const s=CI(r.path),o=await eQe(s,r.type,r.properties,r.createdByHumanId,r.visibleTo);return DL.has(r.type)||(e(i),n(i)),o}})}function Rve(){return kf({mutationFn:async t=>{const e=t.parentPath??Ls(t.networkId,[]),n=CI(e);return await tQe(n,t.properties,t.createdByHumanId,t.visibleTo)}})}const XJ="Removed member",yQe="–";function Bo(t,e){const n=t?e==null?void 0:e.find(r=>r.id===t):void 0;return n?{exists:!0,displayName:n.email_prefix,email:n.email,initials:o7(n.email),avatarObjectId:n.avatar_object_id??null}:{exists:!1,displayName:XJ,email:XJ,initials:yQe,avatarObjectId:null}}const QJ=60,JJ=3600,eee=86400,tee=604800,nee=2592e3,ree=31536e3;function vQe(t){const e=Math.floor((Date.now()-new Date(t).getTime())/1e3);return e<5?"just now":e<QJ?`${e}s ago`:e<JJ?`${Math.floor(e/QJ)}m ago`:e<eee?`${Math.floor(e/JJ)}h ago`:e<tee?`${Math.floor(e/eee)}d ago`:e<nee?`${Math.floor(e/tee)}w ago`:e<ree?`${Math.floor(e/nee)}mo ago`:`${Math.floor(e/ree)}y ago`}const bQe=3e4;function C3({date:t}){const[,e]=x.useState(0);return x.useEffect(()=>{const n=setInterval(()=>e(r=>r+1),bQe);return()=>clearInterval(n)},[]),m.jsx(m.Fragment,{children:vQe(t.toISOString())})}const wQe="/assets/beep-8EWLqO4C.wav",Mve="llink:autoplay-muted";function xQe(){try{return localStorage.getItem(Mve)==="true"}catch{return!1}}function _Qe(t){try{localStorage.setItem(Mve,String(t))}catch{}}const Sz=_f((t,e)=>({muted:xQe(),toggleMuted:()=>{const n=!e().muted;t({muted:n}),_Qe(n)}}));function SQe(t,e,n,r){const i=Dn(a=>{var l;return(l=a.user)==null?void 0:l.id})??"",s=x.useRef(void 0),o=x.useEffectEvent(a=>{if(a.created_by_human_id===i||Sz.getState().muted)return;if(a.type==="text"){new Audio(wQe).play().catch(u=>Zi(u,{scope:"autoplay.beep"}));return}if(a.type!=="media")return;const{displayName:l,initials:c}=Bo(a.created_by_human_id,r==null?void 0:r.humans);Bn.getParticleDownloadUrl(a.properties.object_id).then(u=>{cr.autoplay.play({particleId:a.id,streamId:e.id,networkId:n,downloadUrl:u,mimeType:a.properties.mime_type,durationMs:a.properties.duration_ms,senderName:l,senderInitials:c})}).catch(u=>Zi(u,{scope:"autoplay.fetchUrl",particleId:a.id}))});x.useEffect(()=>{if(t){if(s.current===void 0){s.current=t.id;return}t.id!==s.current&&(s.current=t.id,o(t))}},[t])}function r2(t){return _0({queryKey:["download-url",t],queryFn:t?()=>Bn.getParticleDownloadUrl(t):Ey,staleTime:1e3*60*60})}function Nve(t){if(od(t))return x3;switch(t.type){case"stream":return jH;case"folder":return LH;case"text":return AYe;case"media":{const e=t.properties.mime_type;return e.startsWith("video/")?JL:e.startsWith("audio/")?zH:e.startsWith("image/")?jye:JL}case"file":return zye;case"task":return Pye;case"event":return Oye;case"paper":return VYe}}function Ove(t){var e;if(od(t))return"Deleted particle";switch(t.type){case"stream":case"folder":return t.properties.name;case"text":return t.properties.content;case"media":{const n=t.properties.mime_type;if(n.startsWith("image/"))return"Photo";if(n.startsWith("video/")||n.startsWith("audio/")){const r=(e=t.properties.transcript)==null?void 0:e.transcript;return r||(n.startsWith("video/")?"Video clip":"Voice note")}return"Media"}case"file":return t.properties.filename;case"task":return t.properties.title;case"event":return`${t.properties.title} · ${Pve(t.properties.start_at,t.properties.end_at)}`;case"paper":return t.properties.title}}function Dve(t){switch(t.type){case"stream":case"folder":return t.properties.name;case"task":return t.properties.title;case"event":return t.properties.title;case"paper":return t.properties.title;case"file":return t.properties.filename;case"text":return t.properties.content.slice(0,30);case"media":return t.type}}const iee=new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric"}),PN=new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"});function kQe(t,e){return t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}function Pve(t,e){const n=iee.format(t),r=PN.format(t);return e?kQe(t,e)?`${n} · ${r} – ${PN.format(e)}`:`${n} · ${r} – ${iee.format(e)} · ${PN.format(e)}`:`${n} · ${r}`}function CQe({objectId:t,isUnseen:e}){const{data:n}=r2(t);return m.jsx("div",{className:He("size-8 shrink-0 overflow-hidden rounded-md bg-muted",e&&"ring-2 ring-primary"),children:n&&m.jsx("video",{src:`${n}#t=0.5`,muted:!0,playsInline:!0,preload:"metadata",className:"h-full w-full object-cover"})})}const EQe=x.memo(function({particle:e,networkId:n,onOpen:r,isSelected:i,shortcutKey:s}){var S;const o=Ls(n,[e.id]),{latestChild:a}=lQe(o),l=Dn(k=>k.user),c=(l==null?void 0:l.id)??"",u=xa(n);SQe(a,e,n,u??void 0);const d=e.huddle_active_participants&&e.huddle_active_participants.length>0,h=((S=e.huddle_active_participants)==null?void 0:S.length)??0,f=e.visible_to.length===2&&e.visible_to.every(k=>k.startsWith("human:")),p=x.useMemo(()=>{var k,T;if(f){const E=e.visible_to.find(C=>C!==`human:${c}`);if(E){const C=E.replace("human:",""),R=(k=u==null?void 0:u.humans)==null?void 0:k.find(M=>M.id===C);if(R)return{initials:o7(R.email),avatarObjectId:R.avatar_object_id??null}}}if(a){const E=(T=u==null?void 0:u.humans)==null?void 0:T.find(C=>C.id===a.created_by_human_id);if(E)return{initials:o7(E.email),avatarObjectId:E.avatar_object_id??null}}return{initials:e.properties.name.slice(0,2).toUpperCase(),avatarObjectId:null}},[f,e.visible_to,e.properties.name,c,a,u]),g=x.useMemo(()=>{var E,C;if(!a)return!1;const k=a.created_at.getTime(),T=((C=(E=e.playback_markers)==null?void 0:E[c])==null?void 0:C.getTime())??0;return k>T},[a,e.playback_markers,c]),y=x.useMemo(()=>{if(!a)return null;const k=a.created_by_human_id===c;if(f)return k?"You: ":null;if(k)return"You: ";const{displayName:T}=Bo(a.created_by_human_id,u==null?void 0:u.humans);return`${T.charAt(0).toUpperCase()+T.slice(1)}: `},[a,c,f,u]),v=a?Ove(a):e.properties.name,b=a?Nve(a):jH,_=a&&!od(a)&&a.type==="media"&&a.properties.mime_type.startsWith("video/")?a.properties.object_id:null;return m.jsxs("div",{role:"button",tabIndex:0,onClick:()=>r(e.id),onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&r(e.id)},className:He("flex w-full items-center gap-3 px-4 py-3 text-left cursor-pointer transition-colors hover:bg-accent",i&&"bg-accent",d&&"bg-gradient-to-r from-red-500/10 to-transparent"),children:[s&&m.jsx("kbd",{className:"flex size-5 shrink-0 items-center justify-center rounded bg-white/10 font-mono text-xs text-muted-foreground",children:s}),_?m.jsx(CQe,{objectId:_,isUnseen:!!g}):m.jsx(Xc,{className:He(g&&"ring-2 ring-primary"),avatarObjectId:p.avatarObjectId,initials:p.initials,fallbackClassName:"bg-primary/10 text-primary font-medium"}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m.jsx("p",{className:He("truncate text-sm",g?"font-semibold text-foreground":"font-medium text-muted-foreground"),children:e.properties.name}),m.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[d&&m.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-red-500/15 px-1.5 py-0.5",children:[m.jsx(pYe,{className:"size-3 text-red-400"}),m.jsx("span",{className:"text-[10px] font-medium text-red-400",children:h})]}),a&&m.jsx(Um,{className:He("shrink-0",g?"text-primary":"text-muted-foreground"),children:m.jsx(C3,{date:a.created_at})})]})]}),m.jsxs("div",{className:"flex items-center gap-1",children:[x.createElement(b,{className:He("size-3.5 shrink-0",g?"text-foreground":"text-muted-foreground")}),m.jsxs(Um,{className:He("truncate",g?"text-foreground font-medium":"text-muted-foreground font-normal"),children:[y&&m.jsx("span",{className:"text-muted-foreground",children:y}),v]})]})]}),g&&m.jsx("span",{className:"size-2 shrink-0 rounded-full bg-primary"})]})}),TQe=x.memo(function({particle:e,networkId:n,onOpen:r,isSelected:i,shortcutKey:s}){const o=xa(n),a=Bo(e.created_by_human_id,o==null?void 0:o.humans);return m.jsxs("div",{role:"button",tabIndex:0,onClick:()=>r(e.id),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&r(e.id)},className:He("flex w-full items-center gap-3 px-4 py-3 text-left cursor-pointer transition-colors hover:bg-accent",i&&"bg-accent"),children:[s&&m.jsx("kbd",{className:"flex size-5 shrink-0 items-center justify-center rounded bg-white/10 font-mono text-xs text-muted-foreground",children:s}),m.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-md bg-amber-500/15",children:m.jsx(LH,{className:"size-4 text-amber-500"})}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:e.properties.name}),m.jsxs(Um,{className:"text-muted-foreground font-normal",children:["Folder · ",a.displayName]})]}),m.jsx(Um,{className:"shrink-0 text-muted-foreground",children:m.jsx(C3,{date:e.created_at})})]})}),AQe=x.memo(function({particle:e,networkId:n,onOpen:r,isSelected:i,shortcutKey:s,dense:o}){const a=xa(n),l=Bo(e.created_by_human_id,a==null?void 0:a.humans),c=Nve(e),u=od(e),d=e.type==="task"&&e.properties.done;return m.jsxs("div",{role:"button",tabIndex:0,onClick:()=>r(e.id),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&r(e.id)},className:He("flex w-full items-center gap-3 text-left cursor-pointer transition-colors hover:bg-accent",o?"px-3 py-2":"px-4 py-3",i&&"bg-accent"),children:[s&&!o&&m.jsx("kbd",{className:"flex size-5 shrink-0 items-center justify-center rounded bg-white/10 font-mono text-xs text-muted-foreground",children:s}),x.createElement(c,{className:He("shrink-0 text-muted-foreground",o?"size-3.5":"size-4",d&&"text-emerald-500")}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:He("truncate",o?"text-xs":"text-sm",u||d?"text-muted-foreground line-through":"text-foreground"),children:Ove(e)}),!o&&m.jsx(Um,{className:"text-muted-foreground font-normal",children:l.displayName})]}),m.jsx(Um,{className:He("shrink-0 text-muted-foreground",o&&"text-[10px]"),children:m.jsx(C3,{date:e.created_at})})]})});function Lve({items:t,networkId:e,isLoading:n,onOpen:r,selectedIndex:i,showShortcuts:s=!0,dense:o=!1,emptyMessage:a="Nothing here yet. Create something using the keyboard shortcuts below.",canLoadMore:l,onLoadMore:c}){const u=x.useRef([]);return x.useEffect(()=>{var d;i!=null&&i>=0&&((d=u.current[i])==null||d.scrollIntoView({block:"nearest"}))},[i]),n?m.jsx(sU,{}):t.length===0?m.jsxs("div",{className:"mx-auto flex h-full max-w-sm flex-col items-center justify-center gap-2 px-4 text-center",children:[m.jsx(jH,{className:"text-muted-foreground size-8"}),m.jsx("p",{className:"text-muted-foreground text-sm",children:a})]}):m.jsxs("div",{children:[t.map((d,h)=>{const f={networkId:e,onOpen:r,isSelected:h===i,shortcutKey:s&&h<9?h+1:void 0};return m.jsxs("div",{ref:p=>{u.current[h]=p},children:[d.type==="stream"?m.jsx(EQe,{particle:d,...f}):d.type==="folder"?m.jsx(TQe,{particle:d,...f}):m.jsx(AQe,{particle:d,dense:o,...f}),!o&&h<t.length-1&&m.jsx(Gi,{className:"px-4"})]},d.id)}),l&&c&&m.jsx("div",{className:"flex justify-center p-3",children:m.jsx(Rt,{variant:"ghost",size:"sm",onClick:c,children:"Load more"})})]})}const see="video/webm;codecs=vp9,opus",IQe="video/webm",oee="audio/webm;codecs=opus",RQe="audio/webm";function MQe(t){return t==="audio"?MediaRecorder.isTypeSupported(oee)?oee:RQe:MediaRecorder.isTypeSupported(see)?see:IQe}function NQe(t,e,n){const r=e?{deviceId:{exact:e}}:!0;if(t==="audio")return{audio:r};const i=n?{deviceId:{exact:n},aspectRatio:{ideal:4/3}}:{aspectRatio:{ideal:4/3}};return{audio:r,video:i}}async function OQe(t,e){try{return await navigator.mediaDevices.getUserMedia(t)}catch(n){if(e&&n instanceof Error&&(n.name==="OverconstrainedError"||n.name==="NotFoundError")){const r={audio:typeof t.audio=="object"?!0:t.audio,...t.video!==void 0&&{video:typeof t.video=="object"?{aspectRatio:{ideal:1.3333333333333333}}:t.video}};return navigator.mediaDevices.getUserMedia(r)}throw n}}function DQe({mode:t,micDeviceId:e,cameraDeviceId:n,onStreamReady:r,onStreamCleanup:i,onFinish:s,onError:o}){const a=x.useRef(null),l=x.useRef(null),c=x.useRef([]),u=x.useRef(0),d=x.useRef(i),h=x.useRef(s),f=x.useRef(o);x.useEffect(()=>{d.current=i,h.current=s,f.current=o});const p=x.useCallback(()=>{var b;(b=l.current)==null||b.getTracks().forEach(_=>_.stop()),l.current=null,a.current=null,c.current=[],d.current()},[]),g=x.useCallback(async()=>{try{const b=NQe(t,e,n),S=await OQe(b,!!(e||n));l.current=S,r(S),c.current=[],u.current=Date.now();const k=MQe(t),T=new MediaRecorder(S,{mimeType:k});a.current=T,T.ondataavailable=E=>{E.data.size>0&&c.current.push(E.data)},T.onstop=()=>{const E=Date.now()-u.current,C=new Blob(c.current,{type:k});p(),C.size>0&&h.current(C,E,k)},T.start()}catch(b){p(),f.current(b instanceof Error?b.message:"Failed to start recording")}},[t,e,n,r,p]),y=x.useCallback(()=>{var b;((b=a.current)==null?void 0:b.state)==="recording"&&a.current.stop()},[]),v=x.useCallback(()=>{a.current&&(a.current.ondataavailable=null,a.current.onstop=null,a.current.state==="recording"&&a.current.stop()),p()},[p]);return x.useEffect(()=>()=>p(),[p]),{startRecording:g,stopRecording:y,cancelRecording:v}}function AI(t){return Hn.message(`${t} is only available in the desktop app`,{action:{label:"Download",onClick:()=>window.open(lZe,"_blank","noopener,noreferrer")}}),!1}const aee="video/webm;codecs=vp9,opus",PQe="video/webm";function LQe(){return MediaRecorder.isTypeSupported(aee)?aee:PQe}async function zQe(t){const e={audio:t?{deviceId:{exact:t}}:!0};try{return await navigator.mediaDevices.getUserMedia(e)}catch(n){if(t&&n instanceof Error&&(n.name==="OverconstrainedError"||n.name==="NotFoundError"))return navigator.mediaDevices.getUserMedia({audio:!0});throw n}}function jQe({micDeviceId:t,onFinish:e,onError:n}){const r=x.useRef(null),i=x.useRef(null),s=x.useRef(null),o=x.useRef([]),a=x.useRef(0),l=x.useRef(null),c=x.useRef(e),u=x.useRef(n);x.useEffect(()=>{c.current=e,u.current=n});const d=x.useCallback(()=>{var g,y,v;(g=i.current)==null||g.getTracks().forEach(b=>b.stop()),(y=s.current)==null||y.getTracks().forEach(b=>b.stop()),i.current=null,s.current=null,r.current=null,o.current=[],(v=l.current)==null||v.call(l),l.current=null},[]),h=x.useCallback(async g=>{if(AI("Screen recording"))try{const y=await navigator.mediaDevices.getUserMedia({audio:!1,video:{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:g}}});i.current=y;const v=await zQe(t);s.current=v;const b=new MediaStream([...y.getVideoTracks(),...v.getAudioTracks()]);o.current=[],a.current=Date.now();const _=LQe(),S=new MediaRecorder(b,{mimeType:_});r.current=S,S.ondataavailable=k=>{k.data.size>0&&o.current.push(k.data)},S.onstop=()=>{const k=Date.now()-a.current,T=new Blob(o.current,{type:_});d(),cr.screenRecord.cancel(),T.size>0&&c.current(T,k,_)},S.start(1e3),cr.screenRecord.start(),l.current=cr.screenRecord.onStopRequested(()=>{var k;((k=r.current)==null?void 0:k.state)==="recording"&&r.current.stop()})}catch(y){d(),u.current(y instanceof Error?y.message:"Failed to start screen recording")}},[t,d]),f=x.useCallback(()=>{var g;((g=r.current)==null?void 0:g.state)==="recording"&&r.current.stop()},[]),p=x.useCallback(()=>{r.current&&(r.current.ondataavailable=null,r.current.onstop=null,r.current.state==="recording"&&r.current.stop()),d()},[d]);return x.useEffect(()=>()=>{d()},[d]),{startRecording:h,stopRecording:f,cancelRecording:p}}function zve(t){const[e,n]=x.useState(null);return x.useEffect(()=>{if(!t)return;const r=URL.createObjectURL(t);return n(r),()=>{URL.revokeObjectURL(r),n(null)}},[t]),t?e:null}function em({className:t,...e}){return m.jsx("div",{"data-slot":"skeleton",className:He("bg-muted rounded-md animate-pulse",t),...e})}const BQe=/https?:\/\/[^\s<>"')\]]+/g;function jve(t){return Array.from(new Set(Array.from(t.matchAll(BQe),e=>e[0])))}function Bve(t){try{return new URL(t).hostname.replace(/^www\./,"")}catch{return t}}function FQe({className:t,...e}){return m.jsx("kbd",{"data-slot":"kbd",className:He("pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",t),...e})}const VQe="rounded bg-white/10 px-1.5 py-0.5 font-mono text-xs font-normal text-current";function nn({keys:t,separator:e,prefix:n,children:r,onClick:i,title:s,className:o,...a}){const l=Array.isArray(t)?t:[t],c=m.jsxs(m.Fragment,{children:[n!=null&&m.jsxs(m.Fragment,{children:[n," "]}),l.map((u,d)=>m.jsxs(x.Fragment,{children:[d>0&&(e!=null?m.jsxs(m.Fragment,{children:[" ",e," "]}):" "),m.jsx(FQe,{className:VQe,children:u})]},`${u}-${d}`)),r!=null&&m.jsxs(m.Fragment,{children:[" ",r]})]});return i?m.jsx("button",{type:"button",onClick:i,onMouseDown:u=>u.preventDefault(),title:s,className:He("cursor-pointer rounded transition-colors hover:text-white/80",o),...a,children:c}):m.jsx("span",{className:o,...a,children:c})}const II=_f(t=>({activeIds:{},add:(e,n)=>t(r=>({activeIds:{...r.activeIds,[e]:n}})),remove:e=>t(n=>{if(!(e in n.activeIds))return n;const{[e]:r,...i}=n.activeIds;return{activeIds:i}})})),aU=t=>Object.keys(t.activeIds).length>0;function oc(t,e){const n=x.useId();x.useEffect(()=>{if(!t)return;const{add:r,remove:i}=II.getState();return r(n,e),()=>i(n)},[t,n,e])}function RI(t){return t.startsWith("image/")||t.startsWith("video/")?"lightbox":"external"}function $Qe(t){return t==null?null:t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(0)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Fve({items:t,openIndex:e,onOpenChange:n,onRemove:r}){const i=e!==null&&e>=0&&e<t.length?t[e]:null,s=i!==null,o=t.length>1,a=e!==null?e+1:null,l=(i==null?void 0:i.source.kind)==="remote"?i.source.objectId:void 0,{data:c,isLoading:u}=r2(l),d=(i==null?void 0:i.source.kind)==="local"?i.source.file:null,h=zve(d),f=(i==null?void 0:i.source.kind)==="remote"?c??null:h,p=(i==null?void 0:i.source.kind)==="remote"&&!!f,g=x.useCallback(k=>{if(e===null||t.length===0)return;const T=(e+k+t.length)%t.length;n(T)},[e,t.length,n]),y=x.useCallback(()=>{!i||!f||i.source.kind!=="remote"||cr.attachment.download(f,i.filename)},[i,f]),v=x.useCallback(()=>{if(!i||!r)return;const k=t.length<=1,T=e===t.length-1;r(i),k?n(null):T&&n(t.length-2)},[i,r,t.length,e,n]);oc(s,"attachment-lightbox"),x.useEffect(()=>{if(!s)return;const k=T=>{const E=T.target;if(E&&(E.tagName==="INPUT"||E.tagName==="TEXTAREA"||E.isContentEditable))return;const C=()=>{T.preventDefault(),T.stopImmediatePropagation()};T.key==="Escape"?(C(),n(null)):T.key==="ArrowLeft"&&o?(C(),g(-1)):T.key==="ArrowRight"&&o?(C(),g(1)):(T.key==="d"||T.key==="D")&&p?(C(),y()):(T.key==="Backspace"||T.key==="Delete")&&r&&(C(),v())};return window.addEventListener("keydown",k,!0),()=>window.removeEventListener("keydown",k,!0)},[s,n,r,o,p,g,y,v]);const b=i==null?void 0:i.mimeType.startsWith("image/"),_=i==null?void 0:i.mimeType.startsWith("video/"),S=$Qe(i==null?void 0:i.sizeBytes);return m.jsx(efe,{open:s,onOpenChange:k=>{k||n(null)},children:m.jsxs(tfe,{children:[m.jsx(nfe,{className:"data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 fixed inset-0 z-50 bg-black/90 backdrop-blur-sm duration-100"}),m.jsx(rfe,{"aria-describedby":void 0,className:"data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 fixed inset-0 z-50 flex items-center justify-center p-16 outline-none duration-100",children:i&&m.jsxs(m.Fragment,{children:[m.jsx(ife,{className:"sr-only",children:i.filename}),m.jsxs("div",{className:"absolute left-4 top-4 flex items-center gap-2 rounded-2xl border border-white/10 bg-white/5 px-3 py-1.5 backdrop-blur-xl",children:[m.jsx("span",{className:"max-w-[40vw] truncate text-sm text-white/80",children:i.filename}),S&&m.jsx("span",{className:"text-xs text-white/40",children:S}),o&&m.jsxs("span",{className:"border-l border-white/10 pl-2 text-xs text-white/40",children:[a," / ",t.length]})]}),m.jsxs("div",{className:"absolute right-4 top-4 flex items-center gap-1 no-drag",children:[p&&m.jsx(Rt,{variant:"ghost",size:"icon-sm",onClick:y,className:"text-white/70 hover:bg-white/10 hover:text-white",title:"Download",children:m.jsx(DH,{})}),r&&m.jsx(Rt,{variant:"ghost",size:"icon-sm",onClick:v,className:"text-white/70 hover:bg-white/10 hover:text-white",title:"Remove",children:m.jsx(x3,{})}),m.jsx(YV,{asChild:!0,children:m.jsx(Rt,{variant:"ghost",size:"icon-sm",className:"text-white/70 hover:bg-white/10 hover:text-white",title:"Close",children:m.jsx(Zc,{})})})]}),o&&m.jsxs(m.Fragment,{children:[m.jsx(Rt,{variant:"ghost",size:"icon",onClick:()=>g(-1),className:"absolute left-4 top-1/2 -translate-y-1/2 text-white/70 hover:bg-white/10 hover:text-white","aria-label":"Previous",children:m.jsx(YKe,{})}),m.jsx(Rt,{variant:"ghost",size:"icon",onClick:()=>g(1),className:"absolute right-4 top-1/2 -translate-y-1/2 text-white/70 hover:bg-white/10 hover:text-white","aria-label":"Next",children:m.jsx(OH,{})})]}),m.jsxs("div",{className:"flex max-h-full max-w-full items-center justify-center",children:[!f&&u&&m.jsx(xI,{className:"size-8 animate-spin text-white/50"}),f&&b&&m.jsx("img",{src:f,alt:i.filename,onError:()=>n(null),className:"max-h-[85vh] max-w-[85vw] rounded-lg object-contain shadow-2xl"},i.id),f&&_&&m.jsx("video",{src:f,controls:!0,autoPlay:!0,className:"max-h-[85vh] max-w-[85vw] rounded-lg shadow-2xl"},i.id),f&&!b&&!_&&m.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-2xl border border-white/10 bg-white/5 px-8 py-6 backdrop-blur-xl",children:[m.jsx(w3,{className:"size-12 text-white/50"}),m.jsx("span",{className:"text-sm text-white/80",children:i.filename})]})]}),m.jsxs("div",{className:"absolute bottom-4 left-1/2 flex -translate-x-1/2 items-center gap-4 text-xs text-white/50",children:[o&&m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx(nn,{keys:"←",onClick:()=>g(-1),title:"Previous (or press ←)","aria-label":"Previous attachment"}),m.jsx(nn,{keys:"→",onClick:()=>g(1),title:"Next (or press →)","aria-label":"Next attachment"}),"navigate"]}),p&&m.jsx(nn,{keys:"D",onClick:y,title:"Download (or press D)",children:"download"}),r&&m.jsx(nn,{keys:"⌫",onClick:v,title:"Remove (or press Backspace)",children:"remove"}),m.jsx(nn,{keys:"Esc",onClick:()=>n(null),title:"Close (or press Esc)",children:"close"})]})]})})]})})}function HQe(t){return{id:t.id,filename:t.file.name,mimeType:t.file.type||"application/octet-stream",sizeBytes:t.file.size,source:{kind:"local",file:t.file}}}function UQe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(0)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function qQe({attachment:t,onRemove:e,onPreview:n}){const r=t.file.type.startsWith("image/"),i=t.status==="uploading",s=t.status==="error",o=RI(t.file.type)==="lightbox";return m.jsxs("div",{role:o?"button":void 0,tabIndex:o?0:void 0,onClick:o&&n?n:void 0,className:He("group relative flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-white/10",o&&"cursor-pointer",s&&"ring-1 ring-red-400/50"),children:[r&&t.thumbnailUrl?m.jsx("img",{src:t.thumbnailUrl,alt:t.file.name,className:"h-full w-full object-cover"}):m.jsxs("div",{className:"flex flex-col items-center gap-0.5 px-1",children:[m.jsx(w3,{className:"size-5 text-white/60"}),m.jsx("span",{className:"max-w-full truncate text-[9px] text-white/50",children:t.file.name}),m.jsx("span",{className:"text-[9px] text-white/40",children:UQe(t.file.size)})]}),i&&m.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50",children:m.jsx(xI,{className:"size-4 animate-spin text-white/70"})}),m.jsx("button",{type:"button",onClick:a=>{a.stopPropagation(),e()},className:"absolute right-0.5 top-0.5 hidden rounded-full bg-black/70 p-0.5 text-white/70 hover:text-white group-hover:block",children:m.jsx(Zc,{className:"size-3"})})]})}function WQe({entry:t}){if(t.isLoading)return m.jsxs("div",{className:"flex h-16 w-28 shrink-0 flex-col gap-1.5 rounded-lg bg-white/10 p-2",children:[m.jsx(em,{className:"h-2 w-16 bg-white/10"}),m.jsx(em,{className:"h-3 w-24 bg-white/10"})]});const{metadata:e}=t,n=(e==null?void 0:e.domain)??Bve(t.url),r=(e==null?void 0:e.title)??t.url;return m.jsxs("button",{type:"button",onClick:()=>cr.link.openExternal((e==null?void 0:e.url)??t.url),className:"flex h-16 w-28 shrink-0 flex-col justify-center gap-1 overflow-hidden rounded-lg bg-white/10 px-2 py-1.5 text-left transition-colors hover:bg-white/15",children:[m.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-white/40",children:[e!=null&&e.favicon?m.jsx("img",{src:e.favicon,alt:"",className:"size-3 rounded-sm",onError:i=>{i.target.style.display="none"}}):m.jsx(US,{className:"size-3"}),m.jsx("span",{className:"truncate",children:n})]}),r&&m.jsx("p",{className:"line-clamp-2 text-[11px] font-medium leading-tight text-white/80",children:r})]})}function Vve({attachments:t,onRemove:e,onAddClick:n,linkPreviews:r}){const i=r&&r.length>0,s=x.useMemo(()=>t.filter(c=>RI(c.file.type)==="lightbox"),[t]),o=x.useMemo(()=>s.map(HQe),[s]),[a,l]=x.useState(null);return t.length===0&&!i?null:m.jsxs(m.Fragment,{children:[m.jsxs(bd,{className:"w-full",children:[m.jsxs("div",{className:"flex items-center gap-2 py-2",children:[t.map(c=>m.jsx(qQe,{attachment:c,onRemove:()=>e(c.id),onPreview:()=>{const u=s.indexOf(c);u>=0&&l(u)}},c.id)),r==null?void 0:r.map(c=>m.jsx(WQe,{entry:c},c.url)),m.jsx("button",{type:"button",onClick:c=>{c.stopPropagation(),n()},className:"flex h-16 w-16 shrink-0 items-center justify-center rounded-lg border border-dashed border-white/20 text-white/40 transition-colors hover:border-white/40 hover:text-white/60",children:m.jsx(qS,{className:"size-5"})})]}),m.jsx(eU,{orientation:"horizontal"})]}),o.length>0&&m.jsx(Fve,{items:o,openIndex:a,onOpenChange:l,onRemove:c=>e(c.id)})]})}const YS=_f(t=>({intent:null,request:e=>t({intent:{kind:e}}),clear:()=>t({intent:null})}));function GQe(){const[t,e]=x.useState(0);x.useEffect(()=>{const s=setInterval(()=>{e(o=>o+1)},1e3);return()=>clearInterval(s)},[]);const n=Math.floor(t/60),r=t%60,i=`${n}:${r.toString().padStart(2,"0")}`;return m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"h-2.5 w-2.5 animate-pulse rounded-full bg-red-500"}),m.jsx("span",{className:"font-mono text-sm text-white/80",children:i})]})}function KQe({blob:t,isVideo:e,mirror:n=!0,objectFit:r="cover"}){const i=zve(t),[s,o]=x.useState(null),a=kI(e?null:s);return i?e?m.jsx("video",{src:i,autoPlay:!0,loop:!0,playsInline:!0,className:`absolute inset-0 h-full w-full ${r==="contain"?"object-contain":"object-cover"}${n?" -scale-x-100":""}`}):m.jsxs("div",{className:"flex flex-col items-center gap-3",children:[m.jsx("audio",{ref:o,src:i,autoPlay:!0,loop:!0}),a?m.jsx(SI,{sourceNode:a.sourceNode,className:"text-white"}):m.jsx("span",{className:"text-sm text-white/60",children:"Playing back audio..."})]}):null}function lee({step:t,mediaStream:e,recordingMode:n,reviewBlob:r,error:i,onClose:s,attachments:o,onRemoveAttachment:a,onAddFiles:l,isDragging:c,dropZoneProps:u,mirror:d=!0,objectFit:h="cover"}){const f=x.useRef(null),p=kI(e??null);x.useEffect(()=>{f.current&&e&&n==="video"&&(f.current.srcObject=e)},[e,n]),x.useEffect(()=>{if(!i)return;const _=setTimeout(s,1500);return()=>clearTimeout(_)},[i,s]);const g=t==="reviewing",y=t==="recording",v=y&&!e,b=YS(_=>_.request);return m.jsxs("div",{className:He("absolute inset-0 z-50 flex flex-col items-center justify-center bg-black/90",g&&c&&"ring-2 ring-inset ring-white/30"),...g?u:{},children:[v&&m.jsx("div",{className:"z-10 flex flex-col items-center gap-2",children:m.jsx("span",{className:"animate-pulse text-sm text-white/60",children:n==="video"?"Starting camera...":"Starting mic..."})}),y&&n==="video"&&e&&m.jsx("video",{ref:f,muted:!0,autoPlay:!0,playsInline:!0,className:"absolute inset-0 h-full w-full -scale-x-100 object-cover"}),g&&r&&m.jsx(KQe,{blob:r,isVideo:n==="video",mirror:d,objectFit:h}),(y||g)&&!v&&m.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-[5] h-1/4 bg-gradient-to-t from-black/60 to-transparent"}),m.jsx("div",{className:"absolute top-8 z-10",children:y&&!v?m.jsx(GQe,{}):g?m.jsx("div",{className:"flex items-center gap-2",children:m.jsx("span",{className:"text-sm text-white/80",children:"Review recording"})}):null}),y&&p&&m.jsx("div",{className:"z-10 absolute bottom-15",children:m.jsx(SI,{sourceNode:p.sourceNode,className:"text-white"})}),y&&!v&&m.jsxs("div",{className:"absolute bottom-4 z-10 flex items-center gap-4 text-sm text-white/50",children:[m.jsx(nn,{keys:"`",prefix:"Release",onClick:()=>b("stop"),title:"Finish recording (or release `)",children:"to review"}),m.jsx(nn,{keys:["Esc","Q"],separator:"or",onClick:()=>b("cancel"),title:"Discard recording (or press Esc / Q)",children:"to cancel"})]}),g&&m.jsxs("div",{className:"absolute bottom-4 z-10 flex flex-col items-center gap-3",children:[o.length>0&&m.jsx("div",{className:"px-4",children:m.jsx(Vve,{attachments:o,onRemove:a,onAddClick:l})}),m.jsxs("div",{className:"flex items-center gap-4 text-sm text-white/50",children:[m.jsx(nn,{keys:"Enter",onClick:()=>b("send"),title:"Send (or press Enter)",children:"next"}),m.jsx(nn,{keys:["Esc","Q"],separator:"or",onClick:()=>b("cancel"),title:"Discard (or press Esc / Q)",children:"to cancel"}),m.jsx("span",{children:m.jsxs(Rt,{variant:"ghost",type:"button",onClick:_=>{_.stopPropagation(),l()},title:"Attach files",children:[m.jsx(Vye,{className:"size-4"}),"attach"]})})]})]}),i&&m.jsx("div",{className:"z-10 text-sm text-red-400",children:i})]})}function YQe({title:t="Select a screen",confirmLabel:e="Select",getSources:n,onSelect:r,onCancel:i}){const[s,o]=x.useState([]),[a,l]=x.useState(null),[c,u]=x.useState(!0);x.useEffect(()=>{n().then(f=>{o(f),u(!1),f.length===1&&l(f[0].id)})},[n]);const d=s.filter(f=>f.id.startsWith("screen:")),h=s.filter(f=>f.id.startsWith("window:"));return m.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/90",children:m.jsxs("div",{className:"mx-4 flex max-h-[80vh] w-full max-w-2xl flex-col rounded-lg bg-zinc-900 shadow-xl",children:[m.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-700 px-5 py-4",children:[m.jsx("h2",{className:"text-base font-medium text-zinc-100",children:t}),m.jsx("button",{onClick:i,className:"text-zinc-400 hover:text-zinc-200",children:"✕"})]}),m.jsx("div",{className:"flex-1 overflow-y-auto px-5 py-4",children:c?m.jsx("p",{className:"text-center text-sm text-zinc-400",children:"Loading sources..."}):m.jsxs(m.Fragment,{children:[d.length>0&&m.jsx(cee,{title:"Screens",sources:d,selectedId:a,onSelect:l}),h.length>0&&m.jsx(cee,{title:"Windows",sources:h,selectedId:a,onSelect:l})]})}),m.jsxs("div",{className:"flex justify-end gap-2 border-t border-zinc-700 px-5 py-3",children:[m.jsx("button",{onClick:i,className:"rounded-md px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-800",children:"Cancel"}),m.jsx("button",{disabled:!a,onClick:()=>a&&r(a),className:"rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-500 disabled:opacity-40 disabled:hover:bg-blue-600",children:e})]})]})})}function cee({title:t,sources:e,selectedId:n,onSelect:r}){return m.jsxs("div",{className:"mb-4",children:[m.jsx("h3",{className:"mb-2 text-xs font-medium uppercase tracking-wide text-zinc-400",children:t}),m.jsx("div",{className:"grid grid-cols-3 gap-3",children:e.map(i=>m.jsxs("button",{onClick:()=>r(i.id),className:`overflow-hidden rounded-lg border-2 text-left transition-colors ${n===i.id?"border-blue-500 bg-zinc-800":"border-transparent bg-zinc-800/50 hover:border-zinc-600"}`,children:[m.jsx("img",{src:i.thumbnailDataUrl,alt:i.name,className:"aspect-video w-full object-cover"}),m.jsx("p",{className:"truncate px-2 py-1.5 text-xs text-zinc-300",children:i.name})]},i.id))})]})}function $ve(t){return t<30?{size:"text-5xl",weight:"font-semibold"}:t<70?{size:"text-3xl",weight:"font-semibold"}:{size:"text-2xl",weight:"font-normal"}}function Hve(t){return/^#{1,6} |^\s*[-*+] |^\s*\d+\. |^```|`[^`]+`|\*\*|__|\*\S[^*]*\*|\b_\S[^_]*_\b|^>/m.test(t)}function Uve(t){const e=jve(t),n=VZe({queries:e.map(r=>({queryKey:["link-metadata",r],queryFn:()=>cr.link.fetchMetadata(r),staleTime:1/0,gcTime:30*60*1e3,retry:1}))});return e.map((r,i)=>({url:r,metadata:n[i].data,isLoading:n[i].isLoading}))}var qve=typeof global=="object"&&global&&global.Object===Object&&global,ZQe=typeof self=="object"&&self&&self.Object===Object&&self,Ty=qve||ZQe||Function("return this")(),z7=Ty.Symbol,Wve=Object.prototype,XQe=Wve.hasOwnProperty,QQe=Wve.toString,Y2=z7?z7.toStringTag:void 0;function JQe(t){var e=XQe.call(t,Y2),n=t[Y2];try{t[Y2]=void 0;var r=!0}catch{}var i=QQe.call(t);return r&&(e?t[Y2]=n:delete t[Y2]),i}var eJe=Object.prototype,tJe=eJe.toString;function nJe(t){return tJe.call(t)}var rJe="[object Null]",iJe="[object Undefined]",uee=z7?z7.toStringTag:void 0;function E3(t){return t==null?t===void 0?iJe:rJe:uee&&uee in Object(t)?JQe(t):nJe(t)}function i2(t){return t!=null&&typeof t=="object"}var sJe="[object Symbol]";function oJe(t){return typeof t=="symbol"||i2(t)&&E3(t)==sJe}var kz=Array.isArray,aJe=/\s/;function lJe(t){for(var e=t.length;e--&&aJe.test(t.charAt(e)););return e}var cJe=/^\s+/;function uJe(t){return t&&t.slice(0,lJe(t)+1).replace(cJe,"")}function sl(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var dee=NaN,dJe=/^[-+]0x[0-9a-f]+$/i,hJe=/^0b[01]+$/i,fJe=/^0o[0-7]+$/i,pJe=parseInt;function hee(t){if(typeof t=="number")return t;if(oJe(t))return dee;if(sl(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=sl(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=uJe(t);var n=hJe.test(t);return n||fJe.test(t)?pJe(t.slice(2),n?2:8):dJe.test(t)?dee:+t}function Gve(t){return t}var mJe="[object AsyncFunction]",gJe="[object Function]",yJe="[object GeneratorFunction]",vJe="[object Proxy]";function lU(t){if(!sl(t))return!1;var e=E3(t);return e==gJe||e==yJe||e==mJe||e==vJe}var LN=Ty["__core-js_shared__"],fee=function(){var t=/[^.]+$/.exec(LN&&LN.keys&&LN.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function bJe(t){return!!fee&&fee in t}var wJe=Function.prototype,xJe=wJe.toString;function _Je(t){if(t!=null){try{return xJe.call(t)}catch{}try{return t+""}catch{}}return""}var SJe=/[\\^$.*+?()[\]{}|]/g,kJe=/^\[object .+?Constructor\]$/,CJe=Function.prototype,EJe=Object.prototype,TJe=CJe.toString,AJe=EJe.hasOwnProperty,IJe=RegExp("^"+TJe.call(AJe).replace(SJe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function RJe(t){if(!sl(t)||bJe(t))return!1;var e=lU(t)?IJe:kJe;return e.test(_Je(t))}function MJe(t,e){return t==null?void 0:t[e]}function cU(t,e){var n=MJe(t,e);return RJe(n)?n:void 0}var pee=Object.create,NJe=function(){function t(){}return function(e){if(!sl(e))return{};if(pee)return pee(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function Kve(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function OJe(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}var DJe=800,PJe=16,LJe=Date.now;function zJe(t){var e=0,n=0;return function(){var r=LJe(),i=PJe-(r-n);if(n=r,i>0){if(++e>=DJe)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function jJe(t){return function(){return t}}var j7=function(){try{var t=cU(Object,"defineProperty");return t({},"",{}),t}catch{}}(),BJe=j7?function(t,e){return j7(t,"toString",{configurable:!0,enumerable:!1,value:jJe(e),writable:!0})}:Gve,FJe=zJe(BJe),VJe=9007199254740991,$Je=/^(?:0|[1-9]\d*)$/;function Yve(t,e){var n=typeof t;return e=e??VJe,!!e&&(n=="number"||n!="symbol"&&$Je.test(t))&&t>-1&&t%1==0&&t<e}function uU(t,e,n){e=="__proto__"&&j7?j7(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function MI(t,e){return t===e||t!==t&&e!==e}var HJe=Object.prototype,UJe=HJe.hasOwnProperty;function qJe(t,e,n){var r=t[e];(!(UJe.call(t,e)&&MI(r,n))||n===void 0&&!(e in t))&&uU(t,e,n)}function WJe(t,e,n,r){var i=!n;n||(n={});for(var s=-1,o=e.length;++s<o;){var a=e[s],l=void 0;l===void 0&&(l=t[a]),i?uU(n,a,l):qJe(n,a,l)}return n}var mee=Math.max;function GJe(t,e,n){return e=mee(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=mee(r.length-e,0),o=Array(s);++i<s;)o[i]=r[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=r[i];return a[e]=n(o),Kve(t,this,a)}}function Zve(t,e){return FJe(GJe(t,e,Gve),t+"")}var KJe=9007199254740991;function Xve(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=KJe}function dU(t){return t!=null&&Xve(t.length)&&!lU(t)}function YJe(t,e,n){if(!sl(n))return!1;var r=typeof e;return(r=="number"?dU(n)&&Yve(e,n.length):r=="string"&&e in n)?MI(n[e],t):!1}function ZJe(t){return Zve(function(e,n){var r=-1,i=n.length,s=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(s=t.length>3&&typeof s=="function"?(i--,s):void 0,o&&YJe(n[0],n[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++r<i;){var a=n[r];a&&t(e,a,r,s)}return e})}var XJe=Object.prototype;function Qve(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||XJe;return t===n}function QJe(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var JJe="[object Arguments]";function gee(t){return i2(t)&&E3(t)==JJe}var Jve=Object.prototype,eet=Jve.hasOwnProperty,tet=Jve.propertyIsEnumerable,Cz=gee(function(){return arguments}())?gee:function(t){return i2(t)&&eet.call(t,"callee")&&!tet.call(t,"callee")};function net(){return!1}var ebe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,yee=ebe&&typeof module=="object"&&module&&!module.nodeType&&module,ret=yee&&yee.exports===ebe,vee=ret?Ty.Buffer:void 0,iet=vee?vee.isBuffer:void 0,tbe=iet||net,set="[object Arguments]",oet="[object Array]",aet="[object Boolean]",cet="[object Date]",uet="[object Error]",det="[object Function]",het="[object Map]",fet="[object Number]",pet="[object Object]",met="[object RegExp]",get="[object Set]",yet="[object String]",vet="[object WeakMap]",bet="[object ArrayBuffer]",wet="[object DataView]",xet="[object Float32Array]",_et="[object Float64Array]",ket="[object Int8Array]",Cet="[object Int16Array]",Eet="[object Int32Array]",Tet="[object Uint8Array]",Aet="[object Uint8ClampedArray]",Iet="[object Uint16Array]",Ret="[object Uint32Array]",Nr={};Nr[xet]=Nr[_et]=Nr[ket]=Nr[Cet]=Nr[Eet]=Nr[Tet]=Nr[Aet]=Nr[Iet]=Nr[Ret]=!0;Nr[set]=Nr[oet]=Nr[bet]=Nr[aet]=Nr[wet]=Nr[cet]=Nr[uet]=Nr[det]=Nr[het]=Nr[fet]=Nr[pet]=Nr[met]=Nr[get]=Nr[yet]=Nr[vet]=!1;function Met(t){return i2(t)&&Xve(t.length)&&!!Nr[E3(t)]}function Net(t){return function(e){return t(e)}}var nbe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,O_=nbe&&typeof module=="object"&&module&&!module.nodeType&&module,Oet=O_&&O_.exports===nbe,zN=Oet&&qve.process,bee=function(){try{var t=O_&&O_.require&&O_.require("util").types;return t||zN&&zN.binding&&zN.binding("util")}catch{}}(),wee=bee&&bee.isTypedArray,rbe=wee?Net(wee):Met;function Det(t,e){var n=kz(t),r=!n&&Cz(t),i=!n&&!r&&tbe(t),s=!n&&!r&&!i&&rbe(t),o=n||r||i||s,a=o?QJe(t.length,String):[],l=a.length;for(var c in t)o&&(c=="length"||i&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Yve(c,l))||a.push(c);return a}function Pet(t,e){return function(n){return t(e(n))}}function Let(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}var zet=Object.prototype,jet=zet.hasOwnProperty;function Bet(t){if(!sl(t))return Let(t);var e=Qve(t),n=[];for(var r in t)r=="constructor"&&(e||!jet.call(t,r))||n.push(r);return n}function ibe(t){return dU(t)?Det(t):Bet(t)}var ZS=cU(Object,"create");function Fet(){this.__data__=ZS?ZS(null):{},this.size=0}function Vet(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var $et="__lodash_hash_undefined__",Het=Object.prototype,Uet=Het.hasOwnProperty;function qet(t){var e=this.__data__;if(ZS){var n=e[t];return n===$et?void 0:n}return Uet.call(e,t)?e[t]:void 0}var Wet=Object.prototype,Get=Wet.hasOwnProperty;function Ket(t){var e=this.__data__;return ZS?e[t]!==void 0:Get.call(e,t)}var Yet="__lodash_hash_undefined__";function Zet(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=ZS&&e===void 0?Yet:e,this}function K1(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}K1.prototype.clear=Fet;K1.prototype.delete=Vet;K1.prototype.get=qet;K1.prototype.has=Ket;K1.prototype.set=Zet;function Xet(){this.__data__=[],this.size=0}function NI(t,e){for(var n=t.length;n--;)if(MI(t[n][0],e))return n;return-1}var Qet=Array.prototype,Jet=Qet.splice;function ett(t){var e=this.__data__,n=NI(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():Jet.call(e,n,1),--this.size,!0}function ttt(t){var e=this.__data__,n=NI(e,t);return n<0?void 0:e[n][1]}function ntt(t){return NI(this.__data__,t)>-1}function rtt(t,e){var n=this.__data__,r=NI(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function Ef(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Ef.prototype.clear=Xet;Ef.prototype.delete=ett;Ef.prototype.get=ttt;Ef.prototype.has=ntt;Ef.prototype.set=rtt;var sbe=cU(Ty,"Map");function itt(){this.size=0,this.__data__={hash:new K1,map:new(sbe||Ef),string:new K1}}function stt(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function OI(t,e){var n=t.__data__;return stt(e)?n[typeof e=="string"?"string":"hash"]:n.map}function ott(t){var e=OI(this,t).delete(t);return this.size-=e?1:0,e}function att(t){return OI(this,t).get(t)}function ltt(t){return OI(this,t).has(t)}function ctt(t,e){var n=OI(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}function s2(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}s2.prototype.clear=itt;s2.prototype.delete=ott;s2.prototype.get=att;s2.prototype.has=ltt;s2.prototype.set=ctt;var obe=Pet(Object.getPrototypeOf,Object),utt="[object Object]",dtt=Function.prototype,htt=Object.prototype,abe=dtt.toString,ftt=htt.hasOwnProperty,ptt=abe.call(Object);function mtt(t){if(!i2(t)||E3(t)!=utt)return!1;var e=obe(t);if(e===null)return!0;var n=ftt.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&abe.call(n)==ptt}function gtt(){this.__data__=new Ef,this.size=0}function ytt(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function vtt(t){return this.__data__.get(t)}function btt(t){return this.__data__.has(t)}var wtt=200;function xtt(t,e){var n=this.__data__;if(n instanceof Ef){var r=n.__data__;if(!sbe||r.length<wtt-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new s2(r)}return n.set(t,e),this.size=n.size,this}function o2(t){var e=this.__data__=new Ef(t);this.size=e.size}o2.prototype.clear=gtt;o2.prototype.delete=ytt;o2.prototype.get=vtt;o2.prototype.has=btt;o2.prototype.set=xtt;var lbe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xee=lbe&&typeof module=="object"&&module&&!module.nodeType&&module,_tt=xee&&xee.exports===lbe,_ee=_tt?Ty.Buffer:void 0;_ee&&_ee.allocUnsafe;function Stt(t,e){return t.slice()}var See=Ty.Uint8Array;function ktt(t){var e=new t.constructor(t.byteLength);return new See(e).set(new See(t)),e}function Ctt(t,e){var n=ktt(t.buffer);return new t.constructor(n,t.byteOffset,t.length)}function Ett(t){return typeof t.constructor=="function"&&!Qve(t)?NJe(obe(t)):{}}function Ttt(t){return function(e,n,r){for(var i=-1,s=Object(e),o=r(e),a=o.length;a--;){var l=o[++i];if(n(s[l],l,s)===!1)break}return e}}var Att=Ttt(),jN=function(){return Ty.Date.now()},Itt="Expected a function",Rtt=Math.max,Mtt=Math.min;function DI(t,e,n){var r,i,s,o,a,l,c=0,u=!1,d=!1,h=!0;if(typeof t!="function")throw new TypeError(Itt);e=hee(e)||0,sl(n)&&(u=!!n.leading,d="maxWait"in n,s=d?Rtt(hee(n.maxWait)||0,e):s,h="trailing"in n?!!n.trailing:h);function f(T){var E=r,C=i;return r=i=void 0,c=T,o=t.apply(C,E),o}function p(T){return c=T,a=setTimeout(v,e),u?f(T):o}function g(T){var E=T-l,C=T-c,R=e-E;return d?Mtt(R,s-C):R}function y(T){var E=T-l,C=T-c;return l===void 0||E>=e||E<0||d&&C>=s}function v(){var T=jN();if(y(T))return b(T);a=setTimeout(v,g(T))}function b(T){return a=void 0,h&&r?f(T):(r=i=void 0,o)}function _(){a!==void 0&&clearTimeout(a),c=0,r=l=i=a=void 0}function S(){return a===void 0?o:b(jN())}function k(){var T=jN(),E=y(T);if(r=arguments,i=this,l=T,E){if(a===void 0)return p(l);if(d)return clearTimeout(a),a=setTimeout(v,e),f(l)}return a===void 0&&(a=setTimeout(v,e)),o}return k.cancel=_,k.flush=S,k}function Ez(t,e,n){(n!==void 0&&!MI(t[e],n)||n===void 0&&!(e in t))&&uU(t,e,n)}function Ntt(t){return i2(t)&&dU(t)}function Tz(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}function Ott(t){return WJe(t,ibe(t))}function Dtt(t,e,n,r,i,s,o){var a=Tz(t,n),l=Tz(e,n),c=o.get(l);if(c){Ez(t,n,c);return}var u=s?s(a,l,n+"",t,e,o):void 0,d=u===void 0;if(d){var h=kz(l),f=!h&&tbe(l),p=!h&&!f&&rbe(l);u=l,h||f||p?kz(a)?u=a:Ntt(a)?u=OJe(a):f?(d=!1,u=Stt(l)):p?(d=!1,u=Ctt(l)):u=[]:mtt(l)||Cz(l)?(u=a,Cz(a)?u=Ott(a):(!sl(a)||lU(a))&&(u=Ett(l))):d=!1}d&&(o.set(l,u),i(u,l,r,s,o),o.delete(l)),Ez(t,n,u)}function hU(t,e,n,r,i){t!==e&&Att(e,function(s,o){if(i||(i=new o2),sl(s))Dtt(t,e,o,n,hU,r,i);else{var a=r?r(Tz(t,o),s,o+"",t,e,i):void 0;a===void 0&&(a=s),Ez(t,o,a)}},ibe)}function cbe(t,e,n,r,i,s){return sl(t)&&sl(e)&&(s.set(e,t),hU(t,e,void 0,cbe,s),s.delete(e)),t}var Ptt=ZJe(function(t,e,n,r){hU(t,e,n,r)}),Ltt=Zve(function(t){return t.push(void 0,cbe),Kve(Ptt,void 0,t)}),ztt="Expected a function";function PI(t,e,n){var r=!0,i=!0;if(typeof t!="function")throw new TypeError(ztt);return sl(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),DI(t,e,{leading:r,maxWait:e,trailing:i})}const jtt="modulepreload",Btt=function(t){return"/"+t},kee={},ue=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(n.map(l=>{if(l=Btt(l),l in kee)return;kee[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const d=document.createElement("link");if(d.rel=c?"stylesheet":jtt,c||(d.as="script"),d.crossOrigin="",d.href=l,a&&d.setAttribute("nonce",a),document.head.appendChild(d),c)return new Promise((h,f)=>{d.addEventListener("load",h),d.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})},Ftt=1024;let Vtt=0,jl=class{constructor(e,n){this.from=e,this.to=n}};class hn{constructor(e={}){this.id=Vtt++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=ol.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}hn.closedBy=new hn({deserialize:t=>t.split(" ")});hn.openedBy=new hn({deserialize:t=>t.split(" ")});hn.group=new hn({deserialize:t=>t.split(" ")});hn.isolate=new hn({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});hn.contextHash=new hn({perNode:!0});hn.lookAhead=new hn({perNode:!0});hn.mounted=new hn({perNode:!0});class db{constructor(e,n,r,i=!1){this.tree=e,this.overlay=n,this.parser=r,this.bracketed=i}static get(e){return e&&e.props&&e.props[hn.mounted.id]}}const $tt=Object.create(null);let ol=class ube{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):$tt,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new ube(e.name||"",n,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(hn.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(hn.group),s=-1;s<(i?i.length:0);s++){let o=n[s<0?r.name:i[s]];if(o)return o}}}};ol.none=new ol("",Object.create(null),0,8);class fU{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let i=null;for(let s of e){let o=s(r);if(o){i||(i=Object.assign({},r.props));let a=o[1],l=o[0];l.combine&&l.id in i&&(a=l.combine(i[l.id],a)),i[l.id]=a}}n.push(i?new ol(r.name,i,r.id,r.flags):r)}return new fU(n)}}const mE=new WeakMap,Cee=new WeakMap;var pr;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(pr||(pr={}));class yr{constructor(e,n,r,i,s){if(this.type=e,this.children=n,this.positions=r,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,a]of s)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=db.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let i=r.toString();i&&(n&&(n+=","),n+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new B7(this.topNode,e)}cursorAt(e,n=0,r=0){let i=mE.get(this)||this.topNode,s=new B7(i);return s.moveTo(e,n),mE.set(this,s._tree),s}get topNode(){return new eo(this,0,0,null)}resolve(e,n=0){let r=XS(mE.get(this)||this.topNode,e,n,!1);return mE.set(this,r),r}resolveInner(e,n=0){let r=XS(Cee.get(this)||this.topNode,e,n,!0);return Cee.set(this,r),r}resolveStack(e,n=0){return qtt(this,e,n)}iterate(e){let{enter:n,leave:r,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&pr.IncludeAnonymous)>0;for(let l=this.cursor(o|pr.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=i&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:gU(ol.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new yr(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new yr(ol.none,n,r,i)))}static build(e){return Wtt(e)}}yr.empty=new yr(ol.none,[],[],0);class pU{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new pU(this.buffer,this.index)}}class qm{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return ol.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],i=this.set.types[n],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,r==e)return s;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,n,r,i,s){let{buffer:o}=this,a=-1;for(let l=e;l!=n&&!(dbe(s,i,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,n,r){let i=this.buffer,s=new Uint16Array(n-e),o=0;for(let a=e,l=0;a<n;){s[l++]=i[a++],s[l++]=i[a++]-r;let c=s[l++]=i[a++]-r;s[l++]=i[a++]-e,o=Math.max(o,c)}return new qm(s,o,this.set)}}function dbe(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function XS(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let o=!r&&t instanceof eo&&t.index<0?null:t.parent;if(!o)return t;t=o}let s=r?0:pr.IgnoreOverlays;if(r)for(let o=t,a=o.parent;a;o=a,a=o.parent)o instanceof eo&&o.index<0&&((i=a.enter(e,n,s))===null||i===void 0?void 0:i.from)!=o.from&&(t=a);for(;;){let o=t.enter(e,n,s);if(!o)return t;t=o}}class hbe{cursor(e=0){return new B7(this,e)}getChild(e,n=null,r=null){let i=Eee(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return Eee(this,e,n,r)}resolve(e,n=0){return XS(this,e,n,!1)}resolveInner(e,n=0){return XS(this,e,n,!0)}matchContext(e){return Az(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(r=n,n=i.prevSibling):n=i}return r}get node(){return this}get next(){return this.parent}}class eo extends hbe{constructor(e,n,r,i){super(),this._tree=e,this.from=n,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,i,s=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=n>0?a.length:-1;e!=c;e+=n){let u=a[e],d=l[e]+o.from,h;if(!(!(s&pr.EnterBracketed&&u instanceof yr&&(h=db.get(u))&&!h.overlay&&h.bracketed&&r>=d&&r<=d+u.length)&&!dbe(i,r,d,d+u.length))){if(u instanceof qm){if(s&pr.ExcludeBuffers)continue;let f=u.findChild(0,u.buffer.length,n,r-d,i);if(f>-1)return new Zu(new Htt(o,u,e,d),null,f)}else if(s&pr.IncludeAnonymous||!u.type.isAnonymous||mU(u)){let f;if(!(s&pr.IgnoreMounts)&&(f=db.get(u))&&!f.overlay)return new eo(f.tree,d,e,o);let p=new eo(u,d,e,o);return s&pr.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(n<0?u.children.length-1:0,n,r,i,s)}}}if(s&pr.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+n:e=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,n,r=0){let i;if(!(r&pr.IgnoreOverlays)&&(i=db.get(this._tree))&&i.overlay){let s=e-this.from,o=r&pr.EnterBracketed&&i.bracketed;for(let{from:a,to:l}of i.overlay)if((n>0||o?a<=s:a<s)&&(n<0||o?l>=s:l>s))return new eo(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Eee(t,e,n,r){let i=t.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let o=!1;!o;)if(o=i.type.is(n),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function Az(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class Htt{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class Zu extends hbe{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return s<0?null:new Zu(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,n,r=0){if(r&pr.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return s<0?null:new Zu(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Zu(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new Zu(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),n.push(0)}return new yr(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function fbe(t){if(!t.length)return null;let e=0,n=t[0];for(let s=1;s<t.length;s++){let o=t[s];(o.from>n.from||o.to<n.to)&&(n=o,e=s)}let r=n instanceof eo&&n.index<0?null:n.parent,i=t.slice();return r?i[e]=r:i.splice(e,1),new Utt(i,n)}class Utt{constructor(e,n){this.heads=e,this.node=n}get next(){return fbe(this.heads)}}function qtt(t,e,n){let r=t.resolveInner(e,n),i=null;for(let s=r instanceof eo?r:r.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[r])).push(o.resolve(e,n)),s=o}else{let o=db.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new eo(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(XS(a,e,n,!1))}}return i?fbe(i):r}class B7{get name(){return this.type.name}constructor(e,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~pr.EnterBracketed,e instanceof eo)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof eo?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&pr.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&pr.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&pr.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:n,parent:r}=i)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let s=n+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let a=r._tree.children[s];if(this.mode&pr.IncludeAnonymous||a instanceof qm||!a.type.isAnonymous||mU(a))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;n=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)n=new Zu(this.buffer,n,this.stack[i]);return this.bufferNode=new Zu(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&n&&n(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return Az(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return Az(this._tree,e,i);let o=r[n.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function mU(t){return t.children.some(e=>e instanceof qm||!e.type.isAnonymous||mU(e))}function Wtt(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=Ftt,reused:s=[],minRepeatType:o=r.types.length}=t,a=Array.isArray(n)?new pU(n,n.length):n,l=r.types,c=0,u=0;function d(k,T,E,C,R,M){let{id:D,start:P,end:z,size:Z}=a,re=u,G=c;if(Z<0)if(a.next(),Z==-1){let $e=s[D];E.push($e),C.push(P-k);return}else if(Z==-3){c=D;return}else if(Z==-4){u=D;return}else throw new RangeError(`Unrecognized record size: ${Z}`);let ee=l[D],J,oe,B=P-k;if(z-P<=i&&(oe=y(a.pos-T,R))){let $e=new Uint16Array(oe.size-oe.skip),Ye=a.pos-oe.size,$=$e.length;for(;a.pos>Ye;)$=v(oe.start,$e,$);J=new qm($e,z-oe.start,r),B=oe.start-k}else{let $e=a.pos-Z;a.next();let Ye=[],$=[],Re=D>=o?D:-1,ke=0,Me=z;for(;a.pos>$e;)Re>=0&&a.id==Re&&a.size>=0?(a.end<=Me-i&&(p(Ye,$,P,ke,a.end,Me,Re,re,G),ke=Ye.length,Me=a.end),a.next()):M>2500?h(P,$e,Ye,$):d(P,$e,Ye,$,Re,M+1);if(Re>=0&&ke>0&&ke<Ye.length&&p(Ye,$,P,ke,P,Me,Re,re,G),Ye.reverse(),$.reverse(),Re>-1&&ke>0){let _e=f(ee,G);J=gU(ee,Ye,$,0,Ye.length,0,z-P,_e,_e)}else J=g(ee,Ye,$,z-P,re-z,G)}E.push(J),C.push(B)}function h(k,T,E,C){let R=[],M=0,D=-1;for(;a.pos>T;){let{id:P,start:z,end:Z,size:re}=a;if(re>4)a.next();else{if(D>-1&&z<D)break;D<0&&(D=Z-i),R.push(P,z,Z),M++,a.next()}}if(M){let P=new Uint16Array(M*4),z=R[R.length-2];for(let Z=R.length-3,re=0;Z>=0;Z-=3)P[re++]=R[Z],P[re++]=R[Z+1]-z,P[re++]=R[Z+2]-z,P[re++]=re;E.push(new qm(P,R[2]-z,r)),C.push(z-k)}}function f(k,T){return(E,C,R)=>{let M=0,D=E.length-1,P,z;if(D>=0&&(P=E[D])instanceof yr){if(!D&&P.type==k&&P.length==R)return P;(z=P.prop(hn.lookAhead))&&(M=C[D]+P.length+z)}return g(k,E,C,R,M,T)}}function p(k,T,E,C,R,M,D,P,z){let Z=[],re=[];for(;k.length>C;)Z.push(k.pop()),re.push(T.pop()+E-R);k.push(g(r.types[D],Z,re,M-R,P-M,z)),T.push(R-E)}function g(k,T,E,C,R,M,D){if(M){let P=[hn.contextHash,M];D=D?[P].concat(D):[P]}if(R>25){let P=[hn.lookAhead,R];D=D?[P].concat(D):[P]}return new yr(k,T,E,C,D)}function y(k,T){let E=a.fork(),C=0,R=0,M=0,D=E.end-i,P={size:0,start:0,skip:0};e:for(let z=E.pos-k;E.pos>z;){let Z=E.size;if(E.id==T&&Z>=0){P.size=C,P.start=R,P.skip=M,M+=4,C+=4,E.next();continue}let re=E.pos-Z;if(Z<0||re<z||E.start<D)break;let G=E.id>=o?4:0,ee=E.start;for(E.next();E.pos>re;){if(E.size<0)if(E.size==-3||E.size==-4)G+=4;else break e;else E.id>=o&&(G+=4);E.next()}R=ee,C+=Z,M+=G}return(T<0||C==k)&&(P.size=C,P.start=R,P.skip=M),P.size>4?P:void 0}function v(k,T,E){let{id:C,start:R,end:M,size:D}=a;if(a.next(),D>=0&&C<o){let P=E;if(D>4){let z=a.pos-(D-4);for(;a.pos>z;)E=v(k,T,E)}T[--E]=P,T[--E]=M-k,T[--E]=R-k,T[--E]=C}else D==-3?c=C:D==-4&&(u=C);return E}let b=[],_=[];for(;a.pos>0;)d(t.start||0,t.bufferStart||0,b,_,-1,0);let S=(e=t.length)!==null&&e!==void 0?e:b.length?_[0]+b[0].length:0;return new yr(l[t.topID],b.reverse(),_.reverse(),S)}const Tee=new WeakMap;function i6(t,e){if(!t.isAnonymous||e instanceof qm||e.type!=t)return 1;let n=Tee.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof yr)){n=1;break}n+=i6(t,r)}Tee.set(e,n)}return n}function gU(t,e,n,r,i,s,o,a,l){let c=0;for(let p=r;p<i;p++)c+=i6(t,e[p]);let u=Math.ceil(c*1.5/8),d=[],h=[];function f(p,g,y,v,b){for(let _=y;_<v;){let S=_,k=g[_],T=i6(t,p[_]);for(_++;_<v;_++){let E=i6(t,p[_]);if(T+E>=u)break;T+=E}if(_==S+1){if(T>u){let E=p[S];f(E.children,E.positions,0,E.children.length,g[S]+b);continue}d.push(p[S])}else{let E=g[_-1]+p[_-1].length-k;d.push(gU(t,p,g,S,_,k,E,null,l))}h.push(k+b-s)}}return f(e,n,r,i,0),(a||l)(d,h,o)}class yRt{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof Zu?this.setBuffer(e.context.buffer,e.index,n):e instanceof eo&&this.map.set(e.tree,n)}get(e){return e instanceof Zu?this.getBuffer(e.context.buffer,e.index):e instanceof eo?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Vh{constructor(e,n,r,i,s=!1,o=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let i=[new Vh(0,e.length,e,0,!1,r)];for(let s of n)s.to>e.length&&i.push(s);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<n.length?n[a]:null,d=u?u.fromA:1e9;if(d-l>=r)for(;o&&o.from<d;){let h=o;if(l>=h.from||d<=h.to||c){let f=Math.max(h.from,l)-c,p=Math.min(h.to,d)-c;h=f>=p?null:new Vh(f,p,h.tree,h.offset+c,a>0,!!u)}if(h&&i.push(h),o.to>d)break;o=s<e.length?e[s++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return i}}let pbe=class{startParse(e,n,r){return typeof e=="string"&&(e=new Gtt(e)),r=r?r.length?r.map(i=>new jl(i.from,i.to)):[new jl(0,0)]:[new jl(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let s=i.advance();if(s)return s}}};class Gtt{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}function bRt(t){return(e,n,r,i)=>new Ytt(e,t,n,r,i)}class Aee{constructor(e,n,r,i,s,o){this.parser=e,this.parse=n,this.overlay=r,this.bracketed=i,this.target=s,this.from=o}}function Iee(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class Ktt{constructor(e,n,r,i,s,o,a,l){this.parser=e,this.predicate=n,this.mounts=r,this.index=i,this.start=s,this.bracketed=o,this.target=a,this.prev=l,this.depth=0,this.ranges=[]}}const Iz=new hn({perNode:!0});class Ytt{constructor(e,n,r,i,s){this.nest=n,this.input=r,this.fragments=i,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new yr(r.type,r.children,r.positions,r.length,r.propValues.concat([[Iz,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],n=e.parse.advance();if(n){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[hn.mounted.id]=new db(n,e.overlay,e.parser,e.bracketed),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].from<e&&(e=Math.min(e,this.inner[n].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].parse.stopAt(e)}startInner(){let e=new Qtt(this.fragments),n=null,r=null,i=new B7(new eo(this.baseTree,this.ranges[0].from,0,null),pr.IncludeAnonymous|pr.IgnoreMounts);e:for(let s,o;;){let a=!0,l;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)a=!1;else if(e.hasNode(i)){if(n){let c=n.mounts.find(u=>u.frag.from<=i.from&&u.frag.to>=i.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let d=u.from+c.pos,h=u.to+c.pos;d>=i.from&&h<=i.to&&!n.ranges.some(f=>f.from<h&&f.to>d)&&n.ranges.push({from:d,to:h})}}a=!1}else if(r&&(o=Ztt(r.ranges,i.from,i.to)))a=o!=2;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.from<i.to||!s.overlay)){i.tree||(Xtt(i),n&&n.depth++,r&&r.depth++);let c=e.findMounts(i.from,s.parser);if(typeof s.overlay=="function")n=new Ktt(s.parser,s.overlay,c,this.inner.length,i.from,!!s.bracketed,i.tree,n);else{let u=Nee(this.ranges,s.overlay||(i.from<i.to?[new jl(i.from,i.to)]:[]));u.length&&Iee(u),(u.length||!s.overlay)&&this.inner.push(new Aee(s.parser,u.length?s.parser.startParse(this.input,Oee(c,u),u):s.parser.startParse(""),s.overlay?s.overlay.map(d=>new jl(d.from-i.from,d.to-i.from)):null,!!s.bracketed,i.tree,u.length?u[0].from:i.from)),s.overlay?u.length&&(r={ranges:u,depth:0,prev:r}):a=!1}}else if(n&&(l=n.predicate(i))&&(l===!0&&(l=new jl(i.from,i.to)),l.from<l.to)){let c=n.ranges.length-1;c>=0&&n.ranges[c].to==l.from?n.ranges[c]={from:n.ranges[c].from,to:l.to}:n.ranges.push(l)}if(a&&i.firstChild())n&&n.depth++,r&&r.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(n&&!--n.depth){let c=Nee(this.ranges,n.ranges);c.length&&(Iee(c),this.inner.splice(n.index,0,new Aee(n.parser,n.parser.startParse(this.input,Oee(n.mounts,c),c),n.ranges.map(u=>new jl(u.from-n.start,u.to-n.start)),n.bracketed,n.target,c[0].from))),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function Ztt(t,e,n){for(let r of t){if(r.from>=n)break;if(r.to>e)return r.from<=e&&r.to>=n?2:1}return 0}function Ree(t,e,n,r,i,s){if(e<n){let o=t.buffer[e+1];r.push(t.slice(e,n,o)),i.push(o-s)}}function Xtt(t){let{node:e}=t,n=[],r=e.context.buffer;do n.push(t.index),t.parent();while(!t.tree);let i=t.tree,s=i.children.indexOf(r),o=i.children[s],a=o.buffer,l=[s];function c(u,d,h,f,p,g){let y=n[g],v=[],b=[];Ree(o,u,y,v,b,f);let _=a[y+1],S=a[y+2];l.push(v.length);let k=g?c(y+4,a[y+3],o.set.types[a[y]],_,S-_,g-1):e.toTree();return v.push(k),b.push(_-f),Ree(o,a[y+3],d,v,b,f),new yr(h,v,b,p)}i.children[s]=c(0,a.length,ol.none,0,o.length,n.length-1);for(let u of l){let d=t.tree.children[u],h=t.tree.positions[u];t.yield(new eo(d,h+t.from,u,t._tree))}}class Mee{constructor(e,n){this.offset=n,this.done=!1,this.cursor=e.cursor(pr.IncludeAnonymous|pr.IgnoreMounts)}moveTo(e){let{cursor:n}=this,r=e-this.offset;for(;!this.done&&n.from<r;)if(!(n.to>=e&&n.enter(r,1,pr.IgnoreOverlays|pr.ExcludeBuffers)))if(n.to<=e)n.next(!1)||(this.done=!0);else break}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let n=this.cursor.tree;;){if(n==e.tree)return!0;if(n.children.length&&n.positions[0]==0&&n.children[0]instanceof yr)n=n.children[0];else break}return!1}}class Qtt{constructor(e){var n;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=(n=r.tree.prop(Iz))!==null&&n!==void 0?n:r.to,this.inner=new Mee(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let n=this.curFrag=this.fragments[this.fragI];this.curTo=(e=n.tree.prop(Iz))!==null&&e!==void 0?e:n.to,this.inner=new Mee(n.tree,-n.offset)}}findMounts(e,n){var r;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(r=s.tree)===null||r===void 0?void 0:r.prop(hn.mounted);if(o&&o.parser==n)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=s.to)break;l.tree==this.curFrag.tree&&i.push({frag:l,pos:s.from-l.offset,mount:o})}}}return i}}function Nee(t,e){let n=null,r=e;for(let i=1,s=0;i<t.length;i++){let o=t[i-1].to,a=t[i].from;for(;s<r.length;s++){let l=r[s];if(l.from>=a)break;l.to<=o||(n||(r=n=e.slice()),l.from<o?(n[s]=new jl(l.from,o),l.to>a&&n.splice(s+1,0,new jl(a,l.to))):l.to>a?n[s--]=new jl(a,l.to):n.splice(s--,1))}}return r}function Jtt(t,e,n,r){let i=0,s=0,o=!1,a=!1,l=-1e9,c=[];for(;;){let u=i==t.length?1e9:o?t[i].to:t[i].from,d=s==e.length?1e9:a?e[s].to:e[s].from;if(o!=a){let h=Math.max(l,n),f=Math.min(u,d,r);h<f&&c.push(new jl(h,f))}if(l=Math.min(u,d),l==1e9)break;u==l&&(o?(o=!1,i++):o=!0),d==l&&(a?(a=!1,s++):a=!0)}return c}function Oee(t,e){let n=[];for(let{pos:r,mount:i,frag:s}of t){let o=r+(i.overlay?i.overlay[0].from:0),a=o+i.tree.length,l=Math.max(s.from,o),c=Math.min(s.to,a);if(i.overlay){let u=i.overlay.map(h=>new jl(h.from+r,h.to+r)),d=Jtt(e,u,l,c);for(let h=0,f=l;;h++){let p=h==d.length,g=p?c:d[h].from;if(g>f&&n.push(new Vh(f,g,i.tree,-o,s.from>=f||s.openStart,s.to<=g||s.openEnd)),p)break;f=d[h].to}}else n.push(new Vh(l,c,i.tree,-o,s.from>=o||s.openStart,s.to<=a||s.openEnd))}return n}let Rz=[],mbe=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?mbe:Rz).push(n=n+t[e])})();function ent(t){if(t<768)return!1;for(let e=0,n=Rz.length;;){let r=e+n>>1;if(t<Rz[r])n=r;else if(t>=mbe[r])e=r+1;else return!0;if(e==n)return!1}}function Dee(t){return t>=127462&&t<=127487}const Pee=8205;function tnt(t,e,n=!0,r=!0){return(n?gbe:nnt)(t,e,r)}function gbe(t,e,n){if(e==t.length)return e;e&&ybe(t.charCodeAt(e))&&vbe(t.charCodeAt(e-1))&&e--;let r=BN(t,e);for(e+=Lee(r);e<t.length;){let i=BN(t,e);if(r==Pee||i==Pee||n&&ent(i))e+=Lee(i),r=i;else if(Dee(i)){let s=0,o=e-2;for(;o>=0&&Dee(BN(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function nnt(t,e,n){for(;e>0;){let r=gbe(t,e-2,n);if(r<e)return r;e--}return 0}function BN(t,e){let n=t.charCodeAt(e);if(!vbe(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return ybe(r)?(n-55296<<10)+(r-56320)+65536:n}function ybe(t){return t>=56320&&t<57344}function vbe(t){return t>=55296&&t<56320}function Lee(t){return t<65536?1:2}let jn=class bbe{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=tx(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),s6.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=tx(this,e,n);let r=[];return this.decompose(e,n,r,0),s6.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new D_(this),s=new D_(e);for(let o=n,a=n;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(a+=i.value.length,i.done||a>=r)return!0}}iter(e=1){return new D_(this,e)}iterRange(e,n=this.length){return new wbe(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new xbe(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?bbe.empty:e.length<=32?new mi(e):s6.from(mi.split(e,[]))}};class mi extends jn{constructor(e,n=rnt(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((n?r:a)>=e)return new int(i,a,r,o);i=a+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new mi(zee(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),a=o6(s.text,o.text.slice(),0,s.length);if(a.length<=32)r.push(new mi(a,o.length+s.length));else{let l=a.length>>1;r.push(new mi(a.slice(0,l)),new mi(a.slice(l)))}}else r.push(s)}replace(e,n,r){if(!(r instanceof mi))return super.replace(e,n,r);[e,n]=tx(this,e,n);let i=o6(this.text,o6(r.text,zee(this.text,0,e)),n),s=this.length+r.length-(n-e);return i.length<=32?new mi(i,s):s6.from(mi.split(i,[]),s)}sliceString(e,n=this.length,r=`
|
||
`){[e,n]=tx(this,e,n);let i="";for(let s=0,o=0;s<=n&&o<this.text.length;o++){let a=this.text[o],l=s+a.length;s>e&&o&&(i+=r),e<l&&n>s&&(i+=a.slice(Math.max(0,e-s),n-s)),s=l+1}return i}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(n.push(new mi(r,i)),r=[],i=-1);return i>-1&&n.push(new mi(r,i)),n}}let s6=class hv extends jn{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.children[s],a=i+o.length,l=r+o.lines-1;if((n?l:a)>=e)return o.lineInner(e,n,r,i);i=a+1,r=l+1}}decompose(e,n,r,i){for(let s=0,o=0;o<=n&&s<this.children.length;s++){let a=this.children[s],l=o+a.length;if(e<=l&&n>=o){let c=i&((o<=e?1:0)|(l>=n?2:0));o>=e&&l<=n&&!c?r.push(a):a.decompose(e-o,n-o,r,c)}o=l+1}}replace(e,n,r){if([e,n]=tx(this,e,n),r.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let o=this.children[i],a=s+o.length;if(e>=s&&n<=a){let l=o.replace(e-s,n-s,r),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let u=this.children.slice();return u[i]=l,new hv(u,this.length-(n-e)+r.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=`
|
||
`){[e,n]=tx(this,e,n);let i="";for(let s=0,o=0;s<this.children.length&&o<=n;s++){let a=this.children[s],l=o+a.length;o>e&&s&&(i+=r),e<l&&n>o&&(i+=a.sliceString(e-o,n-o,r)),o=l+1}return i}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof hv))return 0;let r=0,[i,s,o,a]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=n,s+=n){if(i==o||s==a)return r;let l=this.children[i],c=e.children[s];if(l!=c)return r+l.scanIdentical(c,n);r+=l.length+1}}static from(e,n=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let f of e)r+=f.lines;if(r<32){let f=[];for(let p of e)p.flatten(f);return new mi(f,n)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,a=[],l=0,c=-1,u=[];function d(f){let p;if(f.lines>s&&f instanceof hv)for(let g of f.children)d(g);else f.lines>o&&(l>o||!l)?(h(),a.push(f)):f instanceof mi&&l&&(p=u[u.length-1])instanceof mi&&f.lines+p.lines<=32?(l+=f.lines,c+=f.length+1,u[u.length-1]=new mi(p.text.concat(f.text),p.length+1+f.length)):(l+f.lines>i&&h(),l+=f.lines,c+=f.length+1,u.push(f))}function h(){l!=0&&(a.push(u.length==1?u[0]:hv.from(u,c)),c=-1,l=u.length=0)}for(let f of e)d(f);return h(),a.length==1?a[0]:new hv(a,n)}};jn.empty=new mi([""],0);function rnt(t){let e=-1;for(let n of t)e+=n.length+1;return e}function o6(t,e,n=0,r=1e9){for(let i=0,s=0,o=!0;s<t.length&&i<=r;s++){let a=t[s],l=i+a.length;l>=n&&(l>r&&(a=a.slice(0,r-i)),i<n&&(a=a.slice(n-i)),o?(e[e.length-1]+=a,o=!1):e.push(a)),i=l+1}return e}function zee(t,e,n){return o6(t,[""],e,n)}class D_{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof mi?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,a=i instanceof mi?i.text.length:i.children.length;if(o==(n>0?a:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=`
|
||
`,this;e--}else if(i instanceof mi){let l=i.text[o+(n<0?-1:0)];if(this.offsets[r]+=n,l.length>Math.max(0,e))return this.value=e==0?l:n>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(n<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof mi?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class wbe{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new D_(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*n,this.value=i.length<=r?i:n<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class xbe{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:i}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(jn.prototype[Symbol.iterator]=function(){return this.iter()},D_.prototype[Symbol.iterator]=wbe.prototype[Symbol.iterator]=xbe.prototype[Symbol.iterator]=function(){return this});class int{constructor(e,n,r,i){this.from=e,this.to=n,this.number=r,this.text=i}get length(){return this.to-this.from}}function tx(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function fs(t,e,n=!0,r=!0){return tnt(t,e,n,r)}function snt(t){return t>=56320&&t<57344}function ont(t){return t>=55296&&t<56320}function oa(t,e){let n=t.charCodeAt(e);if(!ont(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return snt(r)?(n-55296<<10)+(r-56320)+65536:n}function yU(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Vu(t){return t<65536?1:2}const Mz=/\r\n?|\n/;var Is=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(Is||(Is={}));class dd{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];e+=r<0?this.sections[n]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,r=0,i=0;n<this.sections.length;){let s=this.sections[n++],o=this.sections[n++];o<0?(e(r,i,s),i+=s):i+=o,r+=s}}iterChangedRanges(e,n=!1){Nz(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];i<0?e.push(r,i):e.push(i,r)}return new dd(e)}composeDesc(e){return this.empty?e:e.empty?this:_be(this,e)}mapDesc(e,n=!1){return e.empty?this:Oz(this,e,n)}mapPos(e,n=-1,r=Is.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=i+a;if(l<0){if(c>e)return s+(e-i);s+=a}else{if(r!=Is.Simple&&c>=e&&(r==Is.TrackDel&&i<e&&c>e||r==Is.TrackBefore&&i<e||r==Is.TrackAfter&&c>e))return null;if(c>e||c==e&&n<0&&!a)return e==i||n<0?s:s+l;s+=l}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,n=e){for(let r=0,i=0;r<this.sections.length&&i<=n;){let s=this.sections[r++],o=this.sections[r++],a=i+s;if(o>=0&&i<=n&&a>=e)return i<e&&a>n?"cover":!0;i=a}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new dd(e)}static create(e){return new dd(e)}}let Qc=class ip extends dd{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Nz(this,(n,r,i,s,o)=>e=e.replace(i,i+(r-n),o),!1),e}mapDesc(e,n=!1){return Oz(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let i=0,s=0;i<n.length;i+=2){let o=n[i],a=n[i+1];if(a>=0){n[i]=a,n[i+1]=o;let l=i>>1;for(;r.length<l;)r.push(jn.empty);r.push(o?e.slice(s,s+o):jn.empty)}s+=o}return new ip(n,r)}compose(e){return this.empty?e:e.empty?this:_be(this,e,!0)}map(e,n=!1){return e.empty?this:Oz(this,e,n,!0)}iterChanges(e,n=!1){Nz(this,e,n)}get desc(){return dd.create(this.sections)}filter(e){let n=[],r=[],i=[],s=new QS(this);e:for(let o=0,a=0;;){let l=o==e.length?1e9:e[o++];for(;a<l||a==l&&s.len==0;){if(s.done)break e;let u=Math.min(s.len,l-a);Zs(i,u,-1);let d=s.ins==-1?-1:s.off==0?s.ins:0;Zs(n,u,d),d>0&&tm(r,n,s.text),s.forward(u),a+=u}let c=e[o++];for(;a<c;){if(s.done)break e;let u=Math.min(s.len,c-a);Zs(n,u,-1),Zs(i,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),a+=u}}return{changes:new ip(n,r),filtered:dd.create(i)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],i=this.sections[n+1];i<0?e.push(r):i==0?e.push([r]):e.push([r].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,r){let i=[],s=[],o=0,a=null;function l(u=!1){if(!u&&!i.length)return;o<n&&Zs(i,n-o,-1);let d=new ip(i,s);a=a?a.compose(d.map(a)):d,i=[],s=[],o=0}function c(u){if(Array.isArray(u))for(let d of u)c(d);else if(u instanceof ip){if(u.length!=n)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${n})`);l(),a=a?a.compose(u.map(a)):u}else{let{from:d,to:h=d,insert:f}=u;if(d>h||d<0||h>n)throw new RangeError(`Invalid change range ${d} to ${h} (in doc of length ${n})`);let p=f?typeof f=="string"?jn.of(f.split(r||Mz)):f:jn.empty,g=p.length;if(d==h&&g==0)return;d<o&&l(),d>o&&Zs(i,d-o,-1),Zs(i,h-d,g),tm(s,i,p),o=h}}return c(e),l(!a),a}static empty(e){return new ip(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let i=0;i<e.length;i++){let s=e[i];if(typeof s=="number")n.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)n.push(s[0],0);else{for(;r.length<i;)r.push(jn.empty);r[i]=jn.of(s.slice(1)),n.push(s[0],r[i].length)}}}return new ip(n,r)}static createSet(e,n){return new ip(e,n)}};function Zs(t,e,n,r=!1){if(e==0&&n<=0)return;let i=t.length-2;i>=0&&n<=0&&n==t[i+1]?t[i]+=e:i>=0&&e==0&&t[i]==0?t[i+1]+=n:r?(t[i]+=e,t[i+1]+=n):t.push(e,n)}function tm(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<r;)t.push(jn.empty);t.push(n)}}function Nz(t,e,n){let r=t.inserted;for(let i=0,s=0,o=0;o<t.sections.length;){let a=t.sections[o++],l=t.sections[o++];if(l<0)i+=a,s+=a;else{let c=i,u=s,d=jn.empty;for(;c+=a,u+=l,l&&r&&(d=d.append(r[o-2>>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)a=t.sections[o++],l=t.sections[o++];e(i,c,s,u,d),i=c,s=u}}}function Oz(t,e,n,r=!1){let i=[],s=r?[]:null,o=new QS(t),a=new QS(e);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);Zs(i,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!n))){let c=a.len;for(Zs(i,a.ins,-1);c;){let u=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=u&&(Zs(i,0,o.ins),s&&tm(s,i,o.text),l=o.i),o.forward(u),c-=u}a.next()}else if(o.ins>=0){let c=0,u=o.len;for(;u;)if(a.ins==-1){let d=Math.min(u,a.len);c+=d,u-=d,a.forward(d)}else if(a.ins==0&&a.len<u)u-=a.len,a.next();else break;Zs(i,c,l<o.i?o.ins:0),s&&l<o.i&&tm(s,i,o.text),l=o.i,o.forward(o.len-u)}else{if(o.done&&a.done)return s?Qc.createSet(i,s):dd.create(i);throw new Error("Mismatched change set lengths")}}}function _be(t,e,n=!1){let r=[],i=n?[]:null,s=new QS(t),o=new QS(e);for(let a=!1;;){if(s.done&&o.done)return i?Qc.createSet(r,i):dd.create(r);if(s.ins==0)Zs(r,s.len,0,a),s.next();else if(o.len==0&&!o.done)Zs(r,0,o.ins,a),i&&tm(i,r,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(s.len2,o.len),c=r.length;if(s.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;Zs(r,l,u,a),i&&u&&tm(i,r,o.text)}else o.ins==-1?(Zs(r,s.off?0:s.len,l,a),i&&tm(i,r,s.textBit(l))):(Zs(r,s.off?0:s.len,o.off?0:o.ins,a),i&&!o.off&&tm(i,r,o.text));a=(s.ins>l||o.ins>=0&&o.len>l)&&(a||r.length>c),s.forward2(l),o.forward(l)}}}}class QS{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length?jn.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?jn.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}let gE=class Dz{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new Dz(r,i,this.flags)}extend(e,n=e,r=0){if(e<=this.anchor&&n>=this.anchor)return be.range(e,n,void 0,void 0,r);let i=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return be.range(this.anchor,i,void 0,void 0,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return be.range(e.anchor,e.head)}static create(e,n,r){return new Dz(e,n,r)}};class be{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:be.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new be([this.main],0)}addRange(e,n=!0){return be.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=e,be.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new be(e.ranges.map(n=>gE.fromJSON(n)),e.main)}static single(e,n=e){return new be([be.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=r:s.from<r)return be.normalized(e.slice(),n);r=s.to}return new be(e,n)}static cursor(e,n=0,r,i){return gE.create(e,e,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(i??16777215)<<6)}static range(e,n,r,i,s){let o=(r??16777215)<<6|(i==null?7:Math.min(6,i));return!s&&e!=n&&(s=n<e?1:-1),n<e?gE.create(n,e,48|o):gE.create(e,n,(s?s<0?8:16:0)|o)}static normalized(e,n=0){let r=e[n];e.sort((i,s)=>i.from-s.from),n=e.indexOf(r);for(let i=1;i<e.length;i++){let s=e[i],o=e[i-1];if(s.empty?s.from<=o.to:s.from<o.to){let a=o.from,l=Math.max(s.to,o.to);i<=n&&n--,e.splice(--i,2,s.anchor>s.head?be.range(l,a):be.range(a,l))}}return new be(e,n)}}function Sbe(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let vU=0;class st{constructor(e,n,r,i,s){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=vU++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new st(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:bU),!!e.static,e.enables)}of(e){return new a6([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new a6(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new a6(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function bU(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class a6{constructor(e,n,r,i){this.dependencies=e,this.facet=n,this.type=r,this.value=i,this.id=vU++}dynamicSlot(e){var n;let r=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,a=this.type==2,l=!1,c=!1,u=[];for(let d of this.dependencies)d=="doc"?l=!0:d=="selection"?c=!0:((n=e[d.id])!==null&&n!==void 0?n:1)&1||u.push(e[d.id]);return{create(d){return d.values[o]=r(d),1},update(d,h){if(l&&h.docChanged||c&&(h.docChanged||h.selection)||Pz(d,u)){let f=r(d);if(a?!jee(f,d.values[o],i):!i(f,d.values[o]))return d.values[o]=f,1}return 0},reconfigure:(d,h)=>{let f,p=h.config.address[s];if(p!=null){let g=F7(h,p);if(this.dependencies.every(y=>y instanceof st?h.facet(y)===d.facet(y):y instanceof Vs?h.field(y,!1)==d.field(y,!1):!0)||(a?jee(f=r(d),g,i):i(f=r(d),g)))return d.values[o]=g,0}else f=r(d);return d.values[o]=f,1}}}}function jee(t,e,n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!n(t[r],e[r]))return!1;return!0}function Pz(t,e){let n=!1;for(let r of e)P_(t,r)&1&&(n=!0);return n}function ant(t,e,n){let r=n.map(l=>t[l.id]),i=n.map(l=>l.type),s=r.filter(l=>!(l&1)),o=t[e.id]>>1;function a(l){let c=[];for(let u=0;u<r.length;u++){let d=F7(l,r[u]);if(i[u]==2)for(let h of d)c.push(h);else c.push(d)}return e.combine(c)}return{create(l){for(let c of r)P_(l,c);return l.values[o]=a(l),1},update(l,c){if(!Pz(l,s))return 0;let u=a(l);return e.compare(u,l.values[o])?0:(l.values[o]=u,1)},reconfigure(l,c){let u=Pz(l,r),d=c.config.facets[e.id],h=c.facet(e);if(d&&!u&&bU(n,d))return l.values[o]=h,0;let f=a(l);return e.compare(f,h)?(l.values[o]=h,0):(l.values[o]=f,1)}}}const yE=st.define({static:!0});class Vs{constructor(e,n,r,i,s){this.id=e,this.createF=n,this.updateF=r,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let n=new Vs(vU++,e.create,e.update,e.compare||((r,i)=>r===i),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(yE).find(r=>r.field==this);return((n==null?void 0:n.create)||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,i)=>{let s=r.values[n],o=this.updateF(s,i);return this.compareF(s,o)?0:(r.values[n]=o,1)},reconfigure:(r,i)=>{let s=r.facet(yE),o=i.facet(yE),a;return(a=s.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(r.values[n]=a.create(r),1):i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,yE.of({field:this,create:e})]}get extension(){return this}}const vg={lowest:4,low:3,default:2,high:1,highest:0};function Z2(t){return e=>new kbe(e,t)}const S0={highest:Z2(vg.highest),high:Z2(vg.high),default:Z2(vg.default),low:Z2(vg.low),lowest:Z2(vg.lowest)};class kbe{constructor(e,n){this.inner=e,this.prec=n}}class nx{of(e){return new Lz(this,e)}reconfigure(e){return nx.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Lz{constructor(e,n){this.compartment=e,this.inner=n}}let Bee=class Cbe{constructor(e,n,r,i,s,o){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,r){let i=[],s=Object.create(null),o=new Map;for(let h of lnt(e,n,o))h instanceof Vs?i.push(h):(s[h.facet.id]||(s[h.facet.id]=[])).push(h);let a=Object.create(null),l=[],c=[];for(let h of i)a[h.id]=c.length<<1,c.push(f=>h.slot(f));let u=r==null?void 0:r.config.facets;for(let h in s){let f=s[h],p=f[0].facet,g=u&&u[h]||[];if(f.every(y=>y.type==0))if(a[p.id]=l.length<<1|1,bU(g,f))l.push(r.facet(p));else{let y=p.combine(f.map(v=>v.value));l.push(r&&p.compare(y,r.facet(p))?r.facet(p):y)}else{for(let y of f)y.type==0?(a[y.id]=l.length<<1|1,l.push(y.value)):(a[y.id]=c.length<<1,c.push(v=>y.dynamicSlot(v)));a[p.id]=c.length<<1,c.push(y=>ant(y,p,f))}}let d=c.map(h=>h(a));return new Cbe(e,o,d,a,l,s)}};function lnt(t,e,n){let r=[[],[],[],[],[]],i=new Map;function s(o,a){let l=i.get(o);if(l!=null){if(l<=a)return;let c=r[l].indexOf(o);c>-1&&r[l].splice(c,1),o instanceof Lz&&n.delete(o.compartment)}if(i.set(o,a),Array.isArray(o))for(let c of o)s(c,a);else if(o instanceof Lz){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;n.set(o.compartment,c),s(c,a)}else if(o instanceof kbe)s(o.inner,o.prec);else if(o instanceof Vs)r[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof a6)r[a].push(o),o.facet.extensions&&s(o.facet.extensions,vg.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(c,a)}}return s(t,vg.default),r.reduce((o,a)=>o.concat(a))}function P_(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let i=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|i}function F7(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const Ebe=st.define(),zz=st.define({combine:t=>t.some(e=>e),static:!0}),Tbe=st.define({combine:t=>t.length?t[0]:void 0,static:!0}),Abe=st.define(),Ibe=st.define(),Rbe=st.define(),Mbe=st.define({combine:t=>t.length?t[0]:!1});class Tf{constructor(e,n){this.type=e,this.value=n}static define(){return new cnt}}class cnt{of(e){return new Tf(this,e)}}class unt{constructor(e){this.map=e}of(e){return new Ut(this,e)}}class Ut{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new Ut(this.type,n)}is(e){return this.type==e}static define(e={}){return new unt(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(n);s&&r.push(s)}return r}}Ut.reconfigure=Ut.define();Ut.appendConfig=Ut.define();let Mo=class T4{constructor(e,n,r,i,s,o){this.startState=e,this.changes=n,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&Sbe(r,n.newLength),s.some(a=>a.type==T4.time)||(this.annotations=s.concat(T4.time.of(Date.now())))}static create(e,n,r,i,s,o){return new T4(e,n,r,i,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(T4.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}};Mo.time=Tf.define();Mo.userEvent=Tf.define();Mo.addToHistory=Tf.define();Mo.remote=Tf.define();function dnt(t,e){let n=[];for(let r=0,i=0;;){let s,o;if(r<t.length&&(i==e.length||e[i]>=t[r]))s=t[r++],o=t[r++];else if(i<e.length)s=e[i++],o=e[i++];else return n;!n.length||n[n.length-1]<s?n.push(s,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function Nbe(t,e,n){var r;let i,s,o;return n?(i=e.changes,s=Qc.empty(e.changes.length),o=t.changes.compose(e.changes)):(i=e.changes.map(t.changes),s=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(s):(r=t.selection)===null||r===void 0?void 0:r.map(i),effects:Ut.mapEffects(t.effects,i).concat(Ut.mapEffects(e.effects,s)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function jz(t,e,n){let r=e.selection,i=hb(e.annotations);return e.userEvent&&(i=i.concat(Mo.userEvent.of(e.userEvent))),{changes:e.changes instanceof Qc?e.changes:Qc.of(e.changes||[],n,t.facet(Tbe)),selection:r&&(r instanceof be?r:be.single(r.anchor,r.head)),effects:hb(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function Obe(t,e,n){let r=jz(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(n=!1);let o=!!e[s].sequential;r=Nbe(r,jz(t,e[s],o?r.changes.newLength:t.doc.length),o)}let i=Mo.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return fnt(n?hnt(i):i)}function hnt(t){let e=t.startState,n=!0;for(let i of e.facet(Abe)){let s=i(t);if(s===!1){n=!1;break}Array.isArray(s)&&(n=n===!0?s:dnt(n,s))}if(n!==!0){let i,s;if(n===!1)s=t.changes.invertedDesc,i=Qc.empty(e.doc.length);else{let o=t.changes.filter(n);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}t=Mo.create(e,i,t.selection&&t.selection.map(s),Ut.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let r=e.facet(Ibe);for(let i=r.length-1;i>=0;i--){let s=r[i](t);s instanceof Mo?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Mo?t=s[0]:t=Obe(e,hb(s),!1)}return t}function fnt(t){let e=t.startState,n=e.facet(Rbe),r=t;for(let i=n.length-1;i>=0;i--){let s=n[i](t);s&&Object.keys(s).length&&(r=Nbe(r,jz(e,s,t.changes.newLength),!0))}return r==t?t:Mo.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const pnt=[];function hb(t){return t==null?pnt:Array.isArray(t)?t:[t]}var Fr=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Fr||(Fr={}));const mnt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Bz;try{Bz=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function gnt(t){if(Bz)return Bz.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||mnt.test(n)))return!0}return!1}function ynt(t){return e=>{if(!/\S/.test(e))return Fr.Space;if(gnt(e))return Fr.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return Fr.Word;return Fr.Other}}let Vr=class vc{constructor(e,n,r,i,s,o){this.config=e,this.doc=n,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)P_(this,a<<1);this.computeSlot=null}field(e,n=!0){let r=this.config.address[e.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return P_(this,r),F7(this,r)}update(...e){return Obe(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:i}=n;for(let a of e.effects)a.is(nx.reconfigure)?(n&&(i=new Map,n.compartments.forEach((l,c)=>i.set(c,l)),n=null),i.set(a.value.compartment,a.value.extension)):a.is(Ut.reconfigure)?(n=null,r=a.value):a.is(Ut.appendConfig)&&(n=null,r=hb(r).concat(a.value));let s;n?s=e.startState.values.slice():(n=Bee.resolve(r,i,this),s=new vc(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=e.startState.facet(zz)?e.newSelection:e.newSelection.asSingle();new vc(n,e.newDoc,o,s,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:be.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),i=this.changes(r.changes),s=[r.range],o=hb(r.effects);for(let a=1;a<n.ranges.length;a++){let l=e(n.ranges[a]),c=this.changes(l.changes),u=c.map(i);for(let h=0;h<a;h++)s[h]=s[h].map(u);let d=i.mapDesc(c,!0);s.push(l.range.map(d)),i=i.compose(u),o=Ut.mapEffects(o,u).concat(Ut.mapEffects(hb(l.effects),d))}return{changes:i,selection:be.create(s,n.mainIndex),effects:o}}changes(e=[]){return e instanceof Qc?e:Qc.of(e,this.doc.length,this.facet(vc.lineSeparator))}toText(e){return jn.of(e.split(this.facet(vc.lineSeparator)||Mz))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(P_(this,n),F7(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let i=e[r];i instanceof Vs&&this.config.address[i.id]!=null&&(n[r]=i.spec.toJSON(this.field(e[r]),this))}return n}static fromJSON(e,n={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r){for(let s in r)if(Object.prototype.hasOwnProperty.call(e,s)){let o=r[s],a=e[s];i.push(o.init(l=>o.spec.fromJSON(a,l)))}}return vc.create({doc:e.doc,selection:be.fromJSON(e.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(e={}){let n=Bee.resolve(e.extensions||[],new Map),r=e.doc instanceof jn?e.doc:jn.of((e.doc||"").split(n.staticFacet(vc.lineSeparator)||Mz)),i=e.selection?e.selection instanceof be?e.selection:be.single(e.selection.anchor,e.selection.head):be.single(0);return Sbe(i,r.length),n.staticFacet(zz)||(i=i.asSingle()),new vc(n,r,i,n.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(vc.tabSize)}get lineBreak(){return this.facet(vc.lineSeparator)||`
|
||
`}get readOnly(){return this.facet(Mbe)}phrase(e,...n){for(let r of this.facet(vc.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>n.length?r:n[s-1]})),e}languageDataAt(e,n,r=-1){let i=[];for(let s of this.facet(Ebe))for(let o of s(this,n,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){let n=this.languageDataAt("wordChars",e);return ynt(n.length?n[0]:"")}wordAt(e){let{text:n,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=fs(n,o,!1);if(s(n.slice(l,o))!=Fr.Word)break;o=l}for(;a<i;){let l=fs(n,a);if(s(n.slice(a,l))!=Fr.Word)break;a=l}return o==a?null:be.range(o+r,a+r)}};Vr.allowMultipleSelections=zz;Vr.tabSize=st.define({combine:t=>t.length?t[0]:4});Vr.lineSeparator=Tbe;Vr.readOnly=Mbe;Vr.phrases=st.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(i=>t[i]==e[i])}});Vr.languageData=Ebe;Vr.changeFilter=Abe;Vr.transactionFilter=Ibe;Vr.transactionExtender=Rbe;nx.reconfigure=Ut.define();function Id(t,e,n={}){let r={};for(let i of t)for(let s of Object.keys(i)){let o=i[s],a=r[s];if(a===void 0)r[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(n,s))r[s]=n[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}class Wm{eq(e){return this==e}range(e,n=e){return JS.create(e,n,this)}}Wm.prototype.startSide=Wm.prototype.endSide=0;Wm.prototype.point=!1;Wm.prototype.mapMode=Is.TrackDel;function wU(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}class JS{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new JS(e,n,r)}}function Fz(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class xU{constructor(e,n,r,i){this.from=e,this.to=n,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,i=0){let s=r?this.to:this.from;for(let o=i,a=s.length;;){if(o==a)return o;let l=o+a>>1,c=s[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-n;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,n,r,i){for(let s=this.findIndex(n,-1e9,!0),o=this.findIndex(r,1e9,!1,s);s<o;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,n){let r=[],i=[],s=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],u=this.from[l]+e,d=this.to[l]+e,h,f;if(u==d){let p=n.mapPos(u,c.startSide,c.mapMode);if(p==null||(h=f=p,c.startSide!=c.endSide&&(f=n.mapPos(u,c.endSide),f<h)))continue}else if(h=n.mapPos(u,c.startSide),f=n.mapPos(d,c.endSide),h>f||h==f&&c.startSide>0&&c.endSide<=0)continue;(f-h||c.endSide-c.startSide)<0||(o<0&&(o=h),c.point&&(a=Math.max(a,f-h)),r.push(c),i.push(h-o),s.push(f-o))}return{mapped:r.length?new xU(i,s,r,a):null,pos:o}}}class bn{constructor(e,n,r,i){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=i}static create(e,n,r,i){return new bn(e,n,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(Fz)),this.isEmpty)return n.length?bn.of(n):this;let a=new Dbe(this,null,-1).goto(0),l=0,c=[],u=new hf;for(;a.value||l<n.length;)if(l<n.length&&(a.from-n[l].from||a.startSide-n[l].value.startSide)>=0){let d=n[l++];u.addInner(d.from,d.to,d.value)||c.push(d)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==n.length||this.chunkEnd(a.chunkIndex)<n[l].from)&&(!o||i>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&u.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||i>a.to||s<a.from||o(a.from,a.to,a.value))&&(u.addInner(a.from,a.to,a.value)||c.push(JS.create(a.from,a.to,a.value))),a.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?bn.empty:this.nextLayer.update({add:c,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let n=[],r=[],i=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=e.touchesRange(a,a+l.length);if(c===!1)i=Math.max(i,l.maxPoint),n.push(l),r.push(e.mapPos(a));else if(c===!0){let{mapped:u,pos:d}=l.map(a,e);u&&(i=Math.max(i,u.maxPoint),n.push(u),r.push(d))}}let s=this.nextLayer.map(e);return n.length==0?s:new bn(r,n,s||bn.empty,i)}between(e,n,r){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(n>=s&&e<=s+o.length&&o.between(s,e-s,n-s,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return ek.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return ek.from(e).goto(n)}static compare(e,n,r,i,s=-1){let o=e.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=s),a=n.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=s),l=Fee(o,a,r),c=new X2(o,l,s),u=new X2(a,l,s);r.iterGaps((d,h,f)=>Vee(c,d,u,h,f,i)),r.empty&&r.length==0&&Vee(c,0,u,0,0,i)}static eq(e,n,r=0,i){i==null&&(i=999999999);let s=e.filter(u=>!u.isEmpty&&n.indexOf(u)<0),o=n.filter(u=>!u.isEmpty&&e.indexOf(u)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let a=Fee(s,o),l=new X2(s,a,0).goto(r),c=new X2(o,a,0).goto(r);for(;;){if(l.to!=c.to||!Vz(l.active,c.active)||l.point&&(!c.point||!wU(l.point,c.point)))return!1;if(l.to>i)return!0;l.next(),c.next()}}static spans(e,n,r,i,s=-1){let o=new X2(e,null,s).goto(n),a=n,l=o.openStart;for(;;){let c=Math.min(o.to,r);if(o.point){let u=o.activeForPoint(o.to),d=o.pointFrom<n?u.length+1:o.point.startSide<0?u.length:Math.min(u.length,l);i.point(a,c,o.point,u,d,o.pointRank),l=Math.min(o.openEnd(c),u.length)}else c>a&&(i.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>r)return l+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(e,n=!1){let r=new hf;for(let i of e instanceof JS?[e]:n?vnt(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return bn.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=bn.empty;i=i.nextLayer)n=new bn(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}}bn.empty=new bn([],[],null,-1);function vnt(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let r=t[n];if(Fz(e,r)>0)return t.slice().sort(Fz);e=r}return t}bn.empty.nextLayer=bn.empty;class hf{finishChunk(e){this.chunks.push(new xU(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new hf)).add(e,n,r)}addInner(e,n,r){let i=e-this.lastTo||r.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(bn.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=bn.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function Fee(t,e,n){let r=new Map;for(let s of t)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&r.set(s.chunk[o],s.chunkPos[o]);let i=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let a=r.get(s.chunk[o]);a!=null&&(n?n.mapPos(a):a)==s.chunkPos[o]&&!(n!=null&&n.touchesRange(a,a+s.chunk[o].length))&&i.add(s.chunk[o])}return i}class Dbe{constructor(e,n,r,i=0){this.layer=e,this.skip=n,this.minPoint=r,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,n,!1),this}gotoInner(e,n,r){for(;this.chunkIndex<this.layer.chunk.length;){let i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],n,!0);(!r||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,n){(this.to-e||this.endSide-n)<0&&this.gotoInner(e,n,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],n=this.layer.chunk[this.chunkIndex],r=e+n.from[this.rangeIndex];if(this.from=r,this.to=e+n.to[this.rangeIndex],this.value=n.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class ek{constructor(e){this.heap=e}static from(e,n=null,r=-1){let i=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&i.push(new Dbe(o,n,r,s));return i.length==1?i[0]:new ek(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)FN(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)FN(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),FN(this.heap,0)}}}function FN(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let i=t[r];if(r+1<t.length&&i.compare(t[r+1])>=0&&(i=t[r+1],r++),n.compare(i)<0)break;t[r]=n,t[e]=i,e=r}}class X2{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=ek.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){vE(this.active,e),vE(this.activeTo,e),vE(this.activeRank,e),this.minActive=$ee(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:i,rank:s}=this.cursor;for(;n<this.activeRank.length&&(s-this.activeRank[n]||i-this.activeTo[n])>0;)n++;bE(this.active,n,r),bE(this.activeTo,n,i),bE(this.activeRank,n,s),e&&bE(e,n,this.cursor.from),this.minActive=$ee(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),r&&vE(r,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let i=r.length-1;i>=0&&r[i]<e;i--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let n=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function Vee(t,e,n,r,i,s){t.goto(e),n.goto(r);let o=r+i,a=r,l=r-e,c=!!s.boundChange;for(let u=!1;;){let d=t.to+l-n.to,h=d||t.endSide-n.endSide,f=h<0?t.to+l:n.to,p=Math.min(f,o);if(t.point||n.point?(t.point&&n.point&&wU(t.point,n.point)&&Vz(t.activeForPoint(t.to),n.activeForPoint(n.to))||s.comparePoint(a,p,t.point,n.point),u=!1):(u&&s.boundChange(a),p>a&&!Vz(t.active,n.active)&&s.compareRange(a,p,t.active,n.active),c&&p<o&&(d||t.openEnd(f)!=n.openEnd(f))&&(u=!0)),f>o)break;a=f,h<=0&&t.next(),h>=0&&n.next()}}function Vz(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n]&&!wU(t[n],e[n]))return!1;return!0}function vE(t,e){for(let n=e,r=t.length-1;n<r;n++)t[n]=t[n+1];t.pop()}function bE(t,e,n){for(let r=t.length-1;r>=e;r--)t[r+1]=t[r];t[e]=n}function $ee(t,e){let n=-1,r=1e9;for(let i=0;i<e.length;i++)(e[i]-r||t[i].endSide-t[n].endSide)<0&&(n=i,r=e[i]);return n}function a2(t,e,n=t.length){let r=0;for(let i=0;i<n&&i<t.length;)t.charCodeAt(i)==9?(r+=e-r%e,i++):(r++,i=fs(t,i));return r}function $z(t,e,n,r){for(let i=0,s=0;;){if(s>=e)return i;if(i==t.length)break;s+=t.charCodeAt(i)==9?n-s%n:1,i=fs(t,i)}return r===!0?-1:t.length}const Hz="ͼ",Hee=typeof Symbol>"u"?"__"+Hz:Symbol.for(Hz),Uz=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Uee=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Gm{constructor(e,n){this.rules=[];let{finish:r}=n||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,a,l,c){let u=[],d=/^@(\w+)\b/.exec(o[0]),h=d&&d[1]=="keyframes";if(d&&a==null)return l.push(o[0]+";");for(let f in a){let p=a[f];if(/&/.test(f))s(f.split(/,\s*/).map(g=>o.map(y=>g.replace(/&/,y))).reduce((g,y)=>g.concat(y)),p,l);else if(p&&typeof p=="object"){if(!d)throw new RangeError("The value of a property ("+f+") should be a primitive value.");s(i(f),p,u,h)}else p!=null&&u.push(f.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+p+";")}(u.length||h)&&l.push((r&&!d&&!c?o.map(r):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
||
`)}static newName(){let e=Uee[Hee]||1;return Uee[Hee]=e+1,Hz+e.toString(36)}static mount(e,n,r){let i=e[Uz],s=r&&r.nonce;i?s&&i.setNonce(s):i=new bnt(e,s),i.mount(Array.isArray(n)?n:[n],e)}}let qee=new Map;class bnt{constructor(e,n){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=qee.get(r);if(s)return e[Uz]=s;this.sheet=new i.CSSStyleSheet,qee.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[Uz]=this}mount(e,n){let r=this.sheet,i=0,s=0;for(let o=0;o<e.length;o++){let a=e[o],l=this.modules.indexOf(a);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,a),r)for(let c=0;c<a.rules.length;c++)r.insertRule(a.rules[c],i++)}else{for(;s<l;)i+=this.modules[s++].rules.length;i+=a.rules.length,s++}}if(r)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
|
||
`;this.styleTag.textContent=o;let a=n.head||n;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var ff={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:"'"},tk={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},wnt=typeof navigator<"u"&&/Mac/.test(navigator.platform),xnt=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ks=0;ks<10;ks++)ff[48+ks]=ff[96+ks]=String(ks);for(var ks=1;ks<=24;ks++)ff[ks+111]="F"+ks;for(var ks=65;ks<=90;ks++)ff[ks]=String.fromCharCode(ks+32),tk[ks]=String.fromCharCode(ks);for(var VN in ff)tk.hasOwnProperty(VN)||(tk[VN]=ff[VN]);function Pbe(t){var e=wnt&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||xnt&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?tk:ff)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function ar(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i=="string"?t.setAttribute(r,i):i!=null&&(t[r]=i)}e++}for(;e<arguments.length;e++)Lbe(t,arguments[e]);return t}function Lbe(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var n=0;n<e.length;n++)Lbe(t,e[n]);else throw new RangeError("Unsupported child node: "+e)}let xo=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},qz=typeof document<"u"?document:{documentElement:{style:{}}};const Wz=/Edge\/(\d+)/.exec(xo.userAgent),zbe=/MSIE \d/.test(xo.userAgent),Gz=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(xo.userAgent),LI=!!(zbe||Gz||Wz),Wee=!LI&&/gecko\/(\d+)/i.test(xo.userAgent),$N=!LI&&/Chrome\/(\d+)/.exec(xo.userAgent),Gee="webkitFontSmoothing"in qz.documentElement.style,Kz=!LI&&/Apple Computer/.test(xo.vendor),Kee=Kz&&(/Mobile\/\w+/.test(xo.userAgent)||xo.maxTouchPoints>2);var lt={mac:Kee||/Mac/.test(xo.platform),windows:/Win/.test(xo.platform),linux:/Linux|X11/.test(xo.platform),ie:LI,ie_version:zbe?qz.documentMode||6:Gz?+Gz[1]:Wz?+Wz[1]:0,gecko:Wee,gecko_version:Wee?+(/Firefox\/(\d+)/.exec(xo.userAgent)||[0,0])[1]:0,chrome:!!$N,chrome_version:$N?+$N[1]:0,ios:Kee,android:/Android\b/.test(xo.userAgent),webkit:Gee,webkit_version:Gee?+(/\bAppleWebKit\/(\d+)/.exec(xo.userAgent)||[0,0])[1]:0,safari:Kz,safari_version:Kz?+(/\bVersion\/(\d+(\.\d+)?)/.exec(xo.userAgent)||[0,0])[1]:0,tabSize:qz.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function _U(t,e){for(let n in t)n=="class"&&e.class?e.class+=" "+t.class:n=="style"&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}const V7=Object.create(null);function SU(t,e,n){if(t==e)return!0;t||(t=V7),e||(e=V7);let r=Object.keys(t),i=Object.keys(e);if(r.length-0!=i.length-0)return!1;for(let s of r)if(s!=n&&(i.indexOf(s)==-1||t[s]!==e[s]))return!1;return!0}function _nt(t,e){for(let n=t.attributes.length-1;n>=0;n--){let r=t.attributes[n].name;e[r]==null&&t.removeAttribute(r)}for(let n in e){let r=e[n];n=="style"?t.style.cssText=r:t.getAttribute(n)!=r&&t.setAttribute(n,r)}}function Yee(t,e,n){let r=!1;if(e)for(let i in e)n&&i in n||(r=!0,i=="style"?t.style.cssText="":t.removeAttribute(i));if(n)for(let i in n)e&&e[i]==n[i]||(r=!0,i=="style"?t.style.cssText=n[i]:t.setAttribute(i,n[i]));return r}function Snt(t){let e=Object.create(null);for(let n=0;n<t.attributes.length;n++){let r=t.attributes[n];e[r.name]=r.value}return e}let Rd=class{eq(e){return!1}updateDOM(e,n,r){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,n,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}};var Os=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Os||(Os={}));let It=class extends Wm{constructor(e,n,r,i){super(),this.startSide=e,this.endSide=n,this.widget=r,this.spec=i}get heightRelevant(){return!1}static mark(e){return new T3(e)}static widget(e){let n=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return n+=r&&!e.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new Y1(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,i;if(e.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:o}=jbe(e,n);r=(s?n?-3e8:-1:5e8)-1,i=(o?n?2e8:1:-6e8)+1}return new Y1(e,r,i,n,e.widget||null,!0)}static line(e){return new A3(e)}static set(e,n=!1){return bn.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};It.none=bn.empty;class T3 extends It{constructor(e){let{start:n,end:r}=jbe(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?_U(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||V7}eq(e){return this==e||e instanceof T3&&this.tagName==e.tagName&&SU(this.attrs,e.attrs)}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}T3.prototype.point=!1;class A3 extends It{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof A3&&this.spec.class==e.spec.class&&SU(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}A3.prototype.mapMode=Is.TrackBefore;A3.prototype.point=!0;class Y1 extends It{constructor(e,n,r,i,s,o){super(n,r,s,e),this.block=i,this.isReplace=o,this.mapMode=i?n<=0?Is.TrackBefore:Is.TrackAfter:Is.TrackDel}get type(){return this.startSide!=this.endSide?Os.WidgetRange:this.startSide<=0?Os.WidgetBefore:Os.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Y1&&knt(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}Y1.prototype.point=!0;function jbe(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function knt(t,e){return t==e||!!(t&&e&&t.compare(e))}function fb(t,e,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=t?n[i]=Math.max(n[i],e):n.push(t,e)}class nk extends Wm{constructor(e,n,r){super(),this.tagName=e,this.attributes=n,this.rank=r}eq(e){return e==this||e instanceof nk&&this.tagName==e.tagName&&SU(this.attributes,e.attributes)}static create(e){return new nk(e.tagName,e.attributes||V7,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,n=!1){return bn.of(e,n)}}nk.prototype.startSide=nk.prototype.endSide=-1;function rk(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Yz(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function L_(t,e){if(!e.anchorNode)return!1;try{return Yz(t,e.anchorNode)}catch{return!1}}function l6(t){return t.nodeType==3?ik(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function z_(t,e,n,r){return n?Zee(t,e,n,r,-1)||Zee(t,e,n,r,1):!1}function Km(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function $7(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function Zee(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:pf(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=Km(t)+(i<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=i<0?pf(t):0}else return!1}}function pf(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function H7(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function Cnt(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function Bbe(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function Ent(t,e,n,r,i,s,o,a){let l=t.ownerDocument,c=l.defaultView||window;for(let u=t,d=!1;u&&!d;)if(u.nodeType==1){let h,f=u==l.body,p=1,g=1;if(f)h=Cnt(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(d=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let b=u.getBoundingClientRect();({scaleX:p,scaleY:g}=Bbe(u,b)),h={left:b.left,right:b.left+u.clientWidth*p,top:b.top,bottom:b.top+u.clientHeight*g}}let y=0,v=0;if(i=="nearest")e.top<h.top+o?(v=e.top-(h.top+o),n>0&&e.bottom>h.bottom+v&&(v=e.bottom-h.bottom+o)):e.bottom>h.bottom-o&&(v=e.bottom-h.bottom+o,n<0&&e.top-v<h.top&&(v=e.top-(h.top+o)));else{let b=e.bottom-e.top,_=h.bottom-h.top;v=(i=="center"&&b<=_?e.top+b/2-_/2:i=="start"||i=="center"&&n<0?e.top-o:e.bottom-_+o)-h.top}if(r=="nearest"?e.left<h.left+s?(y=e.left-(h.left+s),n>0&&e.right>h.right+y&&(y=e.right-h.right+s)):e.right>h.right-s&&(y=e.right-h.right+s,n<0&&e.left<h.left+y&&(y=e.left-(h.left+s))):y=(r=="center"?e.left+(e.right-e.left)/2-(h.right-h.left)/2:r=="start"==a?e.left-s:e.right-(h.right-h.left)+s)-h.left,y||v)if(f)c.scrollBy(y,v);else{let b=0,_=0;if(v){let S=u.scrollTop;u.scrollTop+=v/g,_=(u.scrollTop-S)*g}if(y){let S=u.scrollLeft;u.scrollLeft+=y/p,b=(u.scrollLeft-S)*p}e={left:e.left-b,top:e.top-_,right:e.right-b,bottom:e.bottom-_},b&&Math.abs(b-y)<1&&(r="nearest"),_&&Math.abs(_-v)<1&&(i="nearest")}if(f)break;(e.top<h.top||e.bottom>h.bottom||e.left<h.left||e.right>h.right)&&(e={left:Math.max(e.left,h.left),right:Math.min(e.right,h.right),top:Math.max(e.top,h.top),bottom:Math.min(e.bottom,h.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function Fbe(t,e=!0){let n=t.ownerDocument,r=null,i=null;for(let s=t.parentNode;s&&!(s==n.body||(!e||r)&&i);)if(s.nodeType==1)!i&&s.scrollHeight>s.clientHeight&&(i=s),e&&!r&&s.scrollWidth>s.clientWidth&&(r=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:r,y:i}}class Tnt{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?pf(n):0),r,Math.min(e.focusOffset,r?pf(r):0))}set(e,n,r,i){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=i}}let ug=null;lt.safari&<.safari_version>=26&&(ug=!1);function Vbe(t){if(t.setActive)return t.setActive();if(ug)return t.focus(ug);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(ug==null?{get preventScroll(){return ug={preventScroll:!0},!0}}:void 0),!ug){ug=!1;for(let n=0;n<e.length;){let r=e[n++],i=e[n++],s=e[n++];r.scrollTop!=i&&(r.scrollTop=i),r.scrollLeft!=s&&(r.scrollLeft=s)}}}let Xee;function ik(t,e,n=e){let r=Xee||(Xee=document.createRange());return r.setEnd(t,n),r.setStart(t,e),r}function pb(t,e,n,r){let i={key:e,code:e,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let s=new KeyboardEvent("keydown",i);s.synthetic=!0,t.dispatchEvent(s);let o=new KeyboardEvent("keyup",i);return o.synthetic=!0,t.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function Ant(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function Int(t,e){let n=e.focusNode,r=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=r)return!1;for(r=Math.min(r,pf(n));;)if(r){if(n.nodeType!=1)return!1;let i=n.childNodes[r-1];i.contentEditable=="false"?r--:(n=i,r=pf(n))}else{if(n==t)return!0;r=Km(n),n=n.parentNode}}function $be(t){return t instanceof Window?t.pageYOffset>Math.max(0,t.document.documentElement.scrollHeight-t.innerHeight-4):t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function Hbe(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=pf(n)}else if(n.parentNode&&!$7(n))r=Km(n),n=n.parentNode;else return null}}function Ube(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r<n.nodeValue.length)return{node:n,offset:r};if(n.nodeType==1&&r<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!$7(n))r=Km(n)+1,n=n.parentNode;else return null}}class Dc{constructor(e,n,r=!0){this.node=e,this.offset=n,this.precise=r}static before(e,n){return new Dc(e.parentNode,Km(e),n)}static after(e,n){return new Dc(e.parentNode,Km(e)+1,n)}}var vr=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(vr||(vr={}));const Z1=vr.LTR,kU=vr.RTL;function qbe(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}const Rnt=qbe("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Mnt=qbe("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Zz=Object.create(null),mu=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);Zz[e]=n,Zz[n]=-e}function Wbe(t){return t<=247?Rnt[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?Mnt[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const Nnt=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Xu{get dir(){return this.level%2?kU:Z1}constructor(e,n,r){this.from=e,this.to=n,this.level=r}side(e,n){return this.dir==n==e?this.to:this.from}forward(e,n){return e==(this.dir==n)}static find(e,n,r,i){let s=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=n&&a.to>=n){if(a.level==r)return o;(s<0||(i!=0?i<0?a.from<n:a.to>n:e[s].level>a.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function Gbe(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++){let r=t[n],i=e[n];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!Gbe(r.inner,i.inner))return!1}return!0}const fr=[];function Ont(t,e,n,r,i){for(let s=0;s<=r.length;s++){let o=s?r[s-1].to:e,a=s<r.length?r[s].from:n,l=s?256:i;for(let c=o,u=l,d=l;c<a;c++){let h=Wbe(t.charCodeAt(c));h==512?h=u:h==8&&d==4&&(h=16),fr[c]=h==4?2:h,h&7&&(d=h),u=h}for(let c=o,u=l,d=l;c<a;c++){let h=fr[c];if(h==128)c<a-1&&u==fr[c+1]&&u&24?h=fr[c]=u:fr[c]=256;else if(h==64){let f=c+1;for(;f<a&&fr[f]==64;)f++;let p=c&&u==8||f<n&&fr[f]==8?d==1?1:8:256;for(let g=c;g<f;g++)fr[g]=p;c=f-1}else h==8&&d==1&&(fr[c]=1);u=h,h&7&&(d=h)}}}function Dnt(t,e,n,r,i){let s=i==1?2:1;for(let o=0,a=0,l=0;o<=r.length;o++){let c=o?r[o-1].to:e,u=o<r.length?r[o].from:n;for(let d=c,h,f,p;d<u;d++)if(f=Zz[h=t.charCodeAt(d)])if(f<0){for(let g=a-3;g>=0;g-=3)if(mu[g+1]==-f){let y=mu[g+2],v=y&2?i:y&4?y&1?s:i:0;v&&(fr[d]=fr[mu[g]]=v),a=g;break}}else{if(mu.length==189)break;mu[a++]=d,mu[a++]=h,mu[a++]=l}else if((p=fr[d])==2||p==1){let g=p==i;l=g?0:1;for(let y=a-3;y>=0;y-=3){let v=mu[y+2];if(v&2)break;if(g)mu[y+2]|=2;else{if(v&4)break;mu[y+2]|=4}}}}}function Pnt(t,e,n,r){for(let i=0,s=r;i<=n.length;i++){let o=i?n[i-1].to:t,a=i<n.length?n[i].from:e;for(let l=o;l<a;){let c=fr[l];if(c==256){let u=l+1;for(;;)if(u==a){if(i==n.length)break;u=n[i++].to,a=i<n.length?n[i].from:e}else if(fr[u]==256)u++;else break;let d=s==1,h=(u<e?fr[u]:r)==1,f=d==h?d?1:2:r;for(let p=u,g=i,y=g?n[g-1].to:t;p>l;)p==y&&(p=n[--g].from,y=g?n[g-1].to:t),fr[--p]=f;l=u}else s=c,l++}}}function Xz(t,e,n,r,i,s,o){let a=r%2?2:1;if(r%2==i%2)for(let l=e,c=0;l<n;){let u=!0,d=!1;if(c==s.length||l<s[c].from){let g=fr[l];g!=a&&(u=!1,d=g==16)}let h=!u&&a==1?[]:null,f=u?r:r+1,p=l;e:for(;;)if(c<s.length&&p==s[c].from){if(d)break e;let g=s[c];if(!u)for(let y=g.to,v=c+1;;){if(y==n)break e;if(v<s.length&&s[v].from==y)y=s[v++].to;else{if(fr[y]==a)break e;break}}if(c++,h)h.push(g);else{g.from>l&&o.push(new Xu(l,g.from,f));let y=g.direction==Z1!=!(f%2);Qz(t,y?r+1:r,i,g.inner,g.from,g.to,o),l=g.to}p=g.to}else{if(p==n||(u?fr[p]!=a:fr[p]==a))break;p++}h?Xz(t,l,p,r+1,i,h,o):l<p&&o.push(new Xu(l,p,f)),l=p}else for(let l=n,c=s.length;l>e;){let u=!0,d=!1;if(!c||l>s[c-1].to){let g=fr[l-1];g!=a&&(u=!1,d=g==16)}let h=!u&&a==1?[]:null,f=u?r:r+1,p=l;e:for(;;)if(c&&p==s[c-1].to){if(d)break e;let g=s[--c];if(!u)for(let y=g.from,v=c;;){if(y==e)break e;if(v&&s[v-1].to==y)y=s[--v].from;else{if(fr[y-1]==a)break e;break}}if(h)h.push(g);else{g.to<l&&o.push(new Xu(g.to,l,f));let y=g.direction==Z1!=!(f%2);Qz(t,y?r+1:r,i,g.inner,g.from,g.to,o),l=g.from}p=g.from}else{if(p==e||(u?fr[p-1]!=a:fr[p-1]==a))break;p--}h?Xz(t,p,l,r+1,i,h,o):p<l&&o.push(new Xu(p,l,f)),l=p}}function Qz(t,e,n,r,i,s,o){let a=e%2?2:1;Ont(t,i,s,r,a),Dnt(t,i,s,r,a),Pnt(i,s,r,a),Xz(t,i,s,e,n,r,o)}function Lnt(t,e,n){if(!t)return[new Xu(0,0,e==kU?1:0)];if(e==Z1&&!n.length&&!Nnt.test(t))return Kbe(t.length);if(n.length)for(;t.length>fr.length;)fr[fr.length]=256;let r=[],i=e==Z1?0:1;return Qz(t,i,i,n,0,t.length,r),r}function Kbe(t){return[new Xu(0,t,0)]}let Ybe="";function znt(t,e,n,r,i){var s;let o=r.head-t.from,a=Xu.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),l=e[a],c=l.side(i,n);if(o==c){let h=a+=i?1:-1;if(h<0||h>=e.length)return null;l=e[a=h],o=l.side(!i,n),c=l.side(i,n)}let u=fs(t.text,o,l.forward(i,n));(u<l.from||u>l.to)&&(u=c),Ybe=t.text.slice(Math.min(o,u),Math.max(o,u));let d=a==(i?e.length-1:0)?null:e[a+(i?1:-1)];return d&&u==c&&d.level+(i?0:1)<l.level?be.cursor(d.side(!i,n)+t.from,d.forward(i,n)?1:-1,d.level):be.cursor(u+t.from,l.forward(i,n)?-1:1,l.level)}function jnt(t,e,n){for(let r=e;r<n;r++){let i=Wbe(t.charCodeAt(r));if(i==1)return Z1;if(i==2||i==4)return kU}return Z1}const Zbe=st.define(),Xbe=st.define(),Qbe=st.define(),Jbe=st.define(),Jz=st.define(),ewe=st.define(),twe=st.define(),CU=st.define(),EU=st.define(),nwe=st.define({combine:t=>t.some(e=>e)}),rwe=st.define({combine:t=>t.some(e=>e)}),iwe=st.define();class mb{constructor(e,n,r,i,s,o=!1){this.range=e,this.y=n,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new mb(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new mb(be.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const wE=Ut.define({map:(t,e)=>t.map(e)}),swe=Ut.define();function ua(t,e,n){let r=t.facet(Jbe);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const Sh=st.define({combine:t=>t.length?t[0]:!0});let Bnt=0;const Hv=st.define({combine(t){return t.filter((e,n)=>{for(let r=0;r<n;r++)if(t[r].plugin==e.plugin)return!1;return!0})}});class wi{constructor(e,n,r,i,s){this.id=e,this.create=n,this.domEventHandlers=r,this.domEventObservers=i,this.baseExtensions=s(this),this.extension=this.baseExtensions.concat(Hv.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Hv.of({plugin:this,arg:e}))}static define(e,n){const{eventHandlers:r,eventObservers:i,provide:s,decorations:o}=n||{};return new wi(Bnt++,e,r,i,a=>{let l=[];return o&&l.push(zI.of(c=>{let u=c.plugin(a);return u?o(u):It.none})),s&&l.push(s(a)),l})}static fromClass(e,n){return wi.define((r,i)=>new e(r,i),n)}}class HN{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(ua(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(n){ua(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){ua(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const owe=st.define(),TU=st.define(),zI=st.define(),awe=st.define(),AU=st.define(),I3=st.define(),lwe=st.define();function Qee(t,e){let n=t.state.facet(lwe);if(!n.length)return n;let r=n.map(s=>s instanceof Function?s(t):s),i=[];return bn.spans(r,e.from,e.to,{point(){},span(s,o,a,l){let c=s-e.from,u=o-e.from,d=i;for(let h=a.length-1;h>=0;h--,l--){let f=a[h].spec.bidiIsolate,p;if(f==null&&(f=jnt(e.text,c,u)),l>0&&d.length&&(p=d[d.length-1]).to==c&&p.direction==f)p.to=u,d=p.inner;else{let g={from:c,to:u,direction:f,inner:[]};d.push(g),d=g.inner}}}}),i}const cwe=st.define();function IU(t){let e=0,n=0,r=0,i=0;for(let s of t.state.facet(cwe)){let o=s(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:n,top:r,bottom:i}}const A4=st.define();class Bl{constructor(e,n,r,i){this.fromA=e,this.toA=n,this.fromB=r,this.toB=i}join(e){return new Bl(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let i=e[n-1];if(!(i.fromA>r.toA)){if(i.toA<r.fromA)break;r=r.join(i),e.splice(n-1,1)}}return e.splice(n,0,r),e}static extendWithRanges(e,n){if(n.length==0)return e;let r=[];for(let i=0,s=0,o=0;;){let a=i<e.length?e[i].fromB:1e9,l=s<n.length?n[s]:1e9,c=Math.min(a,l);if(c==1e9)break;let u=c+o,d=c,h=u;for(;;)if(s<n.length&&n[s]<=d){let f=n[s+1];s+=2,d=Math.max(d,f);for(let p=i;p<e.length&&e[p].fromB<=d;p++)o=e[p].toA-e[p].toB;h=Math.max(h,f+o)}else if(i<e.length&&e[i].fromB<=d){let f=e[i++];d=Math.max(d,f.toB),h=Math.max(h,f.toA),o=f.toA-f.toB}else break;r.push(new Bl(u,h,c,d))}return r}}class U7{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=Qc.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,a,l)=>i.push(new Bl(s,o,a,l))),this.changedRanges=i}static create(e,n,r){return new U7(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const Fnt=[];class hi{constructor(e,n,r=0){this.dom=e,this.length=n,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return Fnt}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let n=this.domAttrs;n&&_nt(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,n=this.posAtStart){let r=n;for(let i of this.children){if(i==e)return r;r+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,n){return null}domPosFor(e,n){let r=Km(this.dom),i=this.length?e>0:n>0;return new Dc(this.parent.dom,r+(i?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof BI)return e;return null}static get(e){return e.cmTile}}class jI extends hi{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let n=this.dom,r=null,i,s=(e==null?void 0:e.node)==n?e:null,o=0;for(let a of this.children){if(a.sync(e),o+=a.length+a.breakAfter,i=r?r.nextSibling:n.firstChild,s&&i!=a.dom&&(s.written=!0),a.dom.parentNode==n)for(;i&&i!=a.dom;)i=Jee(i);else n.insertBefore(a.dom,i);r=a.dom}for(i=r?r.nextSibling:n.firstChild,s&&i&&(s.written=!0);i;)i=Jee(i);this.length=o}}function Jee(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class BI extends jI{constructor(e,n){super(n),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let n=hi.get(e);if(n&&this.owns(n))return n;e=e.parentNode}}blockTiles(e){for(let n=[],r=this,i=0,s=0;;)if(i==r.children.length){if(!n.length)return;r=r.parent,r.breakAfter&&s++,i=n.pop()}else{let o=r.children[i++];if(o instanceof $h)n.push(i),r=o,i=0;else{let a=s+o.length,l=e(o,s);if(l!==void 0)return l;s=a+o.breakAfter}}}resolveBlock(e,n){let r,i=-1,s,o=-1;if(this.blockTiles((a,l)=>{let c=l+a.length;if(e>=l&&e<=c){if(a.isWidget()&&n>=-1&&n<=1){if(a.flags&32)return!0;a.flags&16&&(r=void 0)}(l<e||e==c&&(n<-1?a.length:a.covers(1)))&&(!r||!a.isWidget()&&r.isWidget())&&(r=a,i=e-l),(c>e||e==l&&(n>1?a.length:a.covers(-1)))&&(!s||!a.isWidget()&&s.isWidget())&&(s=a,o=e-l)}}),!r&&!s)throw new Error("No tile at position "+e);return r&&n<0||!s?{tile:r,offset:i}:{tile:s,offset:o}}}class $h extends jI{constructor(e,n){super(e),this.wrapper=n}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,n){let r=new $h(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class rx extends jI{constructor(e,n){super(e),this.attrs=n}isLine(){return!0}static start(e,n,r){let i=new rx(n||document.createElement("div"),e);return(!n||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,n,r){let i=null,s=-1,o=null,a=-1;function l(u,d){for(let h=0,f=0;h<u.children.length&&f<=d;h++){let p=u.children[h],g=f+p.length;g>=d&&(p.isComposite()?l(p,d-f):(!o||o.isHidden&&(n>0||r&&$nt(o,p)))&&(g>d||p.flags&32)?(o=p,a=d-f):(f<d||p.flags&16&&!p.isHidden)&&(i=p,s=d-f)),f=g}}l(this,e);let c=(n<0?i:o)||i||o;return c?{tile:c,offset:c==i?s:a}:null}coordsIn(e,n){let r=this.resolveInline(e,n,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),n):Vnt(this)}domIn(e,n){let r=this.resolveInline(e,n);if(r){let{tile:i,offset:s}=r;if(this.dom.contains(i.dom))return i.isText()?new Dc(i.dom,Math.min(i.dom.nodeValue.length,s)):i.domPosFor(s,i.flags&16?1:i.flags&32?-1:n);let o=r.tile.parent,a=!1;for(let l of o.children){if(a)return new Dc(l.dom,0);l==r.tile&&(a=!0)}}return new Dc(this.dom,0)}}function Vnt(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=l6(e);return n[n.length-1]||null}function $nt(t,e){let n=t.coordsIn(0,1),r=e.coordsIn(0,1);return n&&r&&r.top<n.bottom}class ca extends jI{constructor(e,n){super(e),this.mark=n}get domAttrs(){return this.mark.attrs}static of(e,n){let r=new ca(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class Tg extends hi{constructor(e,n){super(e,n.length),this.text=n}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,n){let r=this.dom.nodeValue.length;e>r&&(e=r);let i=e,s=e,o=0;e==0&&n<0||e==r&&n>=0?lt.chrome||lt.gecko||(e?(i--,o=1):s<r&&(s++,o=-1)):n<0?i--:s<r&&s++;let a=ik(this.dom,i,s).getClientRects();if(!a.length)return null;let l=a[(o?o<0:n>=0)?0:a.length-1];return lt.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?H7(l,o<0):l||null}static of(e,n){let r=new Tg(n||document.createTextNode(e),e);return n||(r.flags|=2),r}}class X1 extends hi{constructor(e,n,r,i){super(e,n,i),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,n){return this.coordsInWidget(e,n,!1)}coordsInWidget(e,n,r){let i=this.widget.coordsAt(this.dom,e,n);if(i)return i;if(r)return H7(this.dom.getBoundingClientRect(),this.length?e==0:n<=0);{let s=this.dom.getClientRects(),o=null;if(!s.length)return null;let a=this.flags&16?!0:this.flags&32?!1:e>0;for(let l=a?s.length-1:0;o=s[l],!(e>0?l==0:l==s.length-1||o.top<o.bottom);l+=a?-1:1);return H7(o,!a)}}get overrideDOMText(){if(!this.length)return jn.empty;let{root:e}=this;if(!e)return jn.empty;let n=this.posAtStart;return e.view.state.doc.slice(n,n+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,n,r,i,s){return s||(s=e.toDOM(n),e.editable||(s.contentEditable="false")),new X1(s,r,e,i)}}class q7 extends hi{constructor(e){let n=document.createElement("img");n.className="cm-widgetBuffer",n.setAttribute("aria-hidden","true"),super(n,0,e)}get isHidden(){return!0}get overrideDOMText(){return jn.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class Hnt{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,n,r){let{tile:i,index:s,beforeBreak:o,parents:a}=this;for(;e||n>0;)if(i.isComposite())if(o){if(!e)break;r&&r.break(),e--,o=!1}else if(s==i.children.length){if(!e&&!a.length)break;r&&r.leave(i),o=!!i.breakAfter,{tile:i,index:s}=a.pop(),s++}else{let l=i.children[s],c=l.breakAfter;(n>0?l.length<=e:l.length<e)&&(!r||r.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!c,s++,e-=l.length):(a.push({tile:i,index:s}),i=l,s=0,r&&l.isComposite()&&r.enter(l))}else if(s==i.length)o=!!i.breakAfter,{tile:i,index:s}=a.pop(),s++;else if(e){let l=Math.min(e,i.length-s);r&&r.skip(i,s,s+l),e-=l,s+=l}else break;return this.tile=i,this.index=s,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class Unt{constructor(e,n,r,i){this.from=e,this.to=n,this.wrapper=r,this.rank=i}}class qnt{constructor(e,n,r){this.cache=e,this.root=n,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,n,r,i){var s;this.flushBuffer();let o=this.ensureMarks(n,r),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+e.length<512){this.cache.reused.set(a,2);let l=o.children[o.children.length-1]=new Tg(a.dom,a.text+e);l.parent=o}else o.append(i||Tg.of(e,(s=this.cache.find(Tg))===null||s===void 0?void 0:s.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,n){let r=this.curLine;r.dom!=n.line.dom&&(r.setDOM(this.cache.reused.has(n.line)?UN(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let i=r;for(let a=n.marks.length-1;a>=0;a--){let l=n.marks[a],c=i.lastChild;if(c instanceof ca&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM(UN(l.dom)),i=c;else{if(this.cache.reused.get(l)){let d=hi.get(l.dom);d&&d.setDOM(UN(l.dom))}let u=ca.of(l.mark,l.dom);i.append(u),i=u}this.cache.reused.set(l,2)}let s=hi.get(e.text);s&&this.cache.reused.set(s,2);let o=new Tg(e.text,e.text.nodeValue);o.flags|=8,this.pos=e.range.toB,i.append(o)}addInlineWidget(e,n,r){let i=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);i||this.flushBuffer();let s=this.ensureMarks(n,r);!i&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,n,r){this.flushBuffer(),this.ensureMarks(n,r).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let n=this.afterWidget||this.lastBlock;n.length+=e,this.pos+=e}addLineStart(e,n){var r;e||(e=uwe);let i=rx.start(e,n||((r=this.cache.find(rx))===null||r===void 0?void 0:r.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=i)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,n){var r;let i=this.curLine;for(let s=e.length-1;s>=0;s--){let o=e[s],a;if(n>0&&(a=i.lastChild)&&a instanceof ca&&a.mark.eq(o))i=a,n--;else{let l=ca.of(o,(r=this.cache.find(ca,c=>c.mark.eq(o)))===null||r===void 0?void 0:r.dom);i.append(l),i=l,n=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!ete(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(lt.ios&&ete(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(qN,0,32)||new X1(qN.toDOM(),0,qN,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let n=e.rank*102+e.value.rank,r=new Unt(e.from,e.to,e.value,n),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-r.rank||this.wrappers[i-1].to-r.to)<0;)i--;this.wrappers.splice(i,0,r)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let n=this.root;for(let r of this.wrappers){let i=n.lastChild;if(r.from<this.pos&&i instanceof $h&&i.wrapper.eq(r.wrapper))n=i;else{let s=$h.of(r.wrapper,(e=this.cache.find($h,o=>o.wrapper.eq(r.wrapper)))===null||e===void 0?void 0:e.dom);n.append(s),n=s}}return n}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let n=2|(e<0?16:32),r=this.cache.find(q7,void 0,1);return r&&(r.flags=n),r||new q7(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class Wnt{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:i,lineBreak:s,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=i;let a=this.textOff=Math.min(e,i.length);return s?null:i.slice(0,a)}let n=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const W7=[X1,rx,Tg,ca,q7,$h,BI];for(let t=0;t<W7.length;t++)W7[t].bucket=t;class Gnt{constructor(e){this.view=e,this.buckets=W7.map(()=>[]),this.index=W7.map(()=>0),this.reused=new Map}add(e){let n=e.constructor.bucket,r=this.buckets[n];r.length<6?r.push(e):r[this.index[n]=(this.index[n]+1)%6]=e}find(e,n,r=2){let i=e.bucket,s=this.buckets[i],o=this.index[i];for(let a=s.length-1;a>=0;a--){let l=(a+o)%s.length,c=s[l];if((!n||n(c))&&!this.reused.has(c))return s.splice(l,1),l<o&&this.index[i]--,this.reused.set(c,r),c}return null}findWidget(e,n,r){let i=this.buckets[0];if(i.length)for(let s=0,o=0;;s++){if(s==i.length){if(o)return null;o=1,s=0}let a=i[s];if(!this.reused.has(a)&&(o==0?a.widget.compare(e):a.widget.constructor==e.constructor&&e.updateDOM(a.dom,this.view,a.widget)))return i.splice(s,1),s<this.index[0]&&this.index[0]--,a.widget==e&&a.length==n&&(a.flags&497)==r?(this.reused.set(a,1),a):(this.reused.set(a,2),new X1(a.dom,n,e,a.flags&-498|r))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,n=2){if(!this.reused.has(e))return this.reused.set(e,n),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class Knt{constructor(e,n,r,i,s){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=s,this.openWidget=!1,this.openMarks=0,this.cache=new Gnt(e),this.text=new Wnt(e.state.doc),this.builder=new qnt(this.cache,new BI(e,e.contentDOM),bn.iter(r)),this.cache.reused.set(n,2),this.old=new Hnt(n),this.reuseWalker={skip:(o,a,l)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,n){let r=n&&this.getCompositionContext(n.text);for(let i=0,s=0,o=0;;){let a=o<e.length?e[o++]:null,l=a?a.fromA:this.old.root.length;if(l>i){let c=l-i;this.preserve(c,!o,!a),i=l,s+=c}if(!a)break;n&&a.fromA<=n.range.fromA&&a.toA>=n.range.toA?(this.forward(a.fromA,n.range.fromA,n.range.fromA<n.range.toA?1:-1),this.emit(s,n.range.fromB),this.cache.clear(),this.builder.addComposition(n,r),this.text.skip(n.range.toB-n.range.fromB),this.forward(n.range.fromA,a.toA),this.emit(n.range.toB,a.toB)):(this.forward(a.fromA,a.toA),this.emit(s,a.toB)),s=a.toB,i=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,n,r){let i=Xnt(this.old),s=this.openMarks;this.old.advance(e,r?1:-1,{skip:(o,a,l)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(l-a);else{let c=l>0||a<o.length?X1.of(o.widget,this.view,l-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);c.flags&256?(c.flags&=-2,this.builder.addBlockWidget(c)):(this.builder.ensureLine(null),this.builder.addInlineWidget(c,i,s),s=i.length)}else if(o.isText())this.builder.ensureLine(null),!a&&l==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,i,s,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,l),i,s)),s=i.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof q7)this.cache.add(o);else if(o instanceof ca)this.builder.ensureLine(null),this.builder.addMark(o,i,s),this.cache.reused.set(o,1),s=i.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof ca&&i.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?i.length&&(i.length=s=0):o instanceof ca&&(i.shift(),s=Math.min(s,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,n){let r=null,i=this.builder,s=0,o=bn.spans(this.decorations,e,n,{point:(a,l,c,u,d,h)=>{if(c instanceof Y1){if(this.disallowBlockEffectsFor[h]){if(c.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=u.length,d>u.length)i.continueWidget(l-a);else{let f=c.widget||(c.block?ix.block:ix.inline),p=Ynt(c),g=this.cache.findWidget(f,l-a,p)||X1.of(f,this.view,l-a,p);c.block?(c.startSide>0&&i.addLineStartIfNotCovered(r),i.addBlockWidget(g)):(i.ensureLine(r),i.addInlineWidget(g,u,d))}r=null}else r=Znt(r,c);l>a&&this.text.skip(l-a)},span:(a,l,c,u)=>{for(let d=a;d<l;){let h=this.text.next(Math.min(512,l-d));h==null?(i.addLineStartIfNotCovered(r),i.addBreak(),d++):(i.ensureLine(r),i.addText(h,c,d==a?u:c.length),d+=h.length),r=null}}});i.addLineStartIfNotCovered(r),this.openWidget=o>s,this.openMarks=o}forward(e,n,r=1){n-e<=10?this.old.advance(n-e,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-e-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(e){let n=[],r=null;for(let i=e.parentNode;;i=i.parentNode){let s=hi.get(i);if(i==this.view.contentDOM)break;s instanceof ca?n.push(s):s!=null&&s.isLine()?r=s:s instanceof $h||(i.nodeName=="DIV"&&!r&&i!=this.view.contentDOM?r=new rx(i,uwe):r||n.push(ca.of(new T3({tagName:i.nodeName.toLowerCase(),attributes:Snt(i)}),i)))}return{line:r,marks:n}}}function ete(t,e){let n=r=>{for(let i of r.children)if((e?i.isText():i.length)||n(i))return!0;return!1};return n(t)}function Ynt(t){let e=t.isReplace?(t.startSide<0?64:0)|(t.endSide>0?128:0):t.startSide>0?32:16;return t.block&&(e|=256),e}const uwe={class:"cm-line"};function Znt(t,e){let n=e.spec.attributes,r=e.spec.class;return!n&&!r||(t||(t={class:"cm-line"}),n&&_U(n,t),r&&(t.class+=" "+r)),t}function Xnt(t){let e=[];for(let n=t.parents.length;n>1;n--){let r=n==t.parents.length?t.tile:t.parents[n].tile;r instanceof ca&&e.push(r.mark)}return e}function UN(t){let e=hi.get(t);return e&&e.setDOM(t.cloneNode()),t}class ix extends Rd{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}ix.inline=new ix("span");ix.block=new ix("div");const qN=new class extends Rd{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class tte{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=It.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new BI(e,e.contentDOM),this.updateInner([new Bl(0,0,0,e.state.doc.length)],null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:u,toA:d})=>d<this.minWidthFrom||u>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?i=this.domChanged.newSel.head:!ort(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?Jnt(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:u,to:d}=this.hasComposition;r=new Bl(u,d,e.changes.mapPos(u,-1),e.changes.mapPos(d,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(lt.ie||lt.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=nrt(o,this.decorations,e.changes);l.length&&(r=Bl.extendWithRanges(r,l));let c=irt(a,this.blockWrappers,e.changes);return c.length&&(r=Bl.extendWithRanges(r,c)),s&&!r.some(u=>u.fromA<=s.range.fromA&&u.toA>=s.range.toA)&&(r=s.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(n||e.length){let o=this.tile,a=new Knt(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&hi.get(n.text)&&a.cache.reused.set(hi.get(n.text),2),this.tile=a.run(e,n),ej(o,a.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=lt.chrome||lt.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||r.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let s of this.tile.children)s.isWidget()&&s.widget instanceof WN&&i.push(s.dom);r.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(swe)&&(this.editContextFormatting=r.value)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,i=this.view.root.activeElement,s=i==r,o=!s&&!(this.view.state.facet(Sh)||r.tabIndex>-1)&&L_(r,this.view.observer.selectionRange)&&!(i&&r.contains(i));if(!(s||n||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c,u;if(l.empty?u=c=this.inlineDOMNearPos(l.anchor,l.assoc||1):(u=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),c=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),lt.gecko&&l.empty&&!this.hasComposition&&Qnt(c)){let h=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(h,c.node.childNodes[c.offset]||null)),c=u=new Dc(h,0),a=!0}let d=this.view.observer.selectionRange;(a||!d.focusNode||(!z_(c.node,c.offset,d.anchorNode,d.anchorOffset)||!z_(u.node,u.offset,d.focusNode,d.focusOffset))&&!this.suppressWidgetCursorChange(d,l))&&(this.view.observer.ignore(()=>{lt.android&<.chrome&&r.contains(d.focusNode)&&srt(d.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let h=rk(this.view.root);if(h)if(l.empty){if(lt.gecko){let f=ert(c.node,c.offset);if(f&&f!=3){let p=(f==1?Hbe:Ube)(c.node,c.offset);p&&(c=new Dc(p.node,p.offset))}}h.collapse(c.node,c.offset),l.bidiLevel!=null&&h.caretBidiLevel!==void 0&&(h.caretBidiLevel=l.bidiLevel)}else if(h.extend){h.collapse(c.node,c.offset);try{h.extend(u.node,u.offset)}catch{}}else{let f=document.createRange();l.anchor>l.head&&([c,u]=[u,c]),f.setEnd(u.node,u.offset),f.setStart(c.node,c.offset),h.removeAllRanges(),h.addRange(f)}o&&this.view.root.activeElement==r&&(r.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(c,u)),this.impreciseAnchor=c.precise?null:new Dc(d.anchorNode,d.anchorOffset),this.impreciseHead=u.precise?null:new Dc(d.focusNode,d.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&z_(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=rk(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let o=this.lineAt(n.head,n.assoc);if(!o)return;let a=o.posAtStart;if(n.head==a||n.head==a+o.length)return;let l=this.coordsAt(n.head,-1),c=this.coordsAt(n.head,1);if(!l||!c||l.bottom>c.top)return;let u=this.domAtPos(n.head+n.assoc,n.assoc);r.collapse(u.node,u.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let d=e.observer.selectionRange;e.docView.posFromDOM(d.anchorNode,d.anchorOffset)!=n.from&&r.collapse(i,s)}posFromDOM(e,n){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let i=r.posAtStart;if(r.isComposite()){let s;if(e==r.dom)s=r.dom.childNodes[n];else{let o=pf(e)==0?0:n==0?-1:1;for(;;){let a=e.parentNode;if(a==r.dom)break;o==0&&a.firstChild!=a.lastChild&&(e==a.firstChild?o=-1:o=1),e=a}o<0?s=e:s=e.nextSibling}if(s==r.dom.firstChild)return i;for(;s&&!hi.get(s);)s=s.nextSibling;if(!s)return i+r.length;for(let o=0,a=i;;o++){let l=r.children[o];if(l.dom==s)return a;a+=l.length+l.breakAfter}}else return r.isText()?e==r.dom?i+n:i+(n?r.length:0):i}domAtPos(e,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,n);return r.isWidget()?r.domPosFor(e,n):r.domIn(i,n)}inlineDOMNearPos(e,n){let r,i=-1,s=!1,o,a=-1,l=!1;return this.tile.blockTiles((c,u)=>{if(c.isWidget()){if(c.flags&32&&u>=e)return!0;c.flags&16&&(s=!0)}else{let d=u+c.length;if(u<=e&&(r=c,i=e-u,s=d<e),d>=e&&!o&&(o=c,a=e-u,l=u>e),u>e&&o)return!0}}),!r&&!o?this.domAtPos(e,n):(s&&o?r=null:l&&r&&(o=null),r&&n<0||!o?r.domIn(i,n):o.domIn(a,n))}coordsAt(e,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,n);return r.isWidget()?r.widget instanceof WN?null:r.coordsInWidget(i,n,!0):r.coordsIn(i,n)}lineAt(e,n){let{tile:r}=this.tile.resolveBlock(e,n);return r.isLine()?r:null}coordsForChar(e){let{tile:n,offset:r}=this.tile.resolveBlock(e,1);if(!n.isLine())return null;function i(s,o){if(s.isComposite())for(let a of s.children){if(a.length>=o){let l=i(a,o);if(l)return l}if(o-=a.length,o<0)break}else if(s.isText()&&o<s.length){let a=fs(s.text,o);if(a==o)return null;let l=ik(s.dom,o,a).getClientRects();for(let c=0;c<l.length;c++){let u=l[c];if(c==l.length-1||u.top<u.bottom&&u.left<u.right)return u}}return null}return i(n,r)}measureVisibleLineHeights(e){let n=[],{from:r,to:i}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==vr.LTR,c=0,u=(d,h,f)=>{for(let p=0;p<d.children.length&&!(h>i);p++){let g=d.children[p],y=h+g.length,v=g.dom.getBoundingClientRect(),{height:b}=v;if(f&&!p&&(c+=v.top-f.top),g instanceof $h)y>r&&u(g,h,v);else if(h>=r&&(c>0&&n.push(-c),n.push(b+c),c=0,o)){let _=g.dom.lastChild,S=_?l6(_):[];if(S.length){let k=S[S.length-1],T=l?k.right-v.left:v.right-k.left;T>a&&(a=T,this.minWidth=s,this.minWidthFrom=h,this.minWidthTo=y)}}f&&p==d.children.length-1&&(c+=f.bottom-v.bottom),h=y+g.breakAfter}};return u(this.tile,0,null),n}textDirectionAt(e){let{tile:n}=this.tile.resolveBlock(e,1);return getComputedStyle(n.dom).direction=="rtl"?vr.RTL:vr.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let c of o.children){if(!c.isText()||/[^ -~]/.test(c.text))return;let u=l6(c.dom);if(u.length!=1)return;a+=u[0].width,l=u[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:l}}});if(e)return e;let n=document.createElement("div"),r,i,s;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let o=l6(n.firstChild)[0];r=n.getBoundingClientRect().height,i=o&&o.width?o.width/27:7,s=o&&o.height?o.height:r,n.remove()}),{lineHeight:r,charWidth:i,textHeight:s}}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,i=0;;i++){let s=i==n.viewports.length?null:n.viewports[i],o=s?s.from-1:this.view.state.doc.length;if(o>r){let a=(n.lineBlockAt(o).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(It.replace({widget:new WN(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return It.set(e)}updateDeco(){let e=1,n=this.view.state.facet(zI).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(AU).map((s,o)=>{let a=typeof s=="function";return a&&(r=!0),a?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=r,n.push(bn.join(i))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(awe).map(s=>typeof s=="function"?s(this.view):s)}scrollIntoView(e){var n;if(e.isSnapshot){let u=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=u.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let u of this.view.state.facet(iwe))try{if(u(this.view,e.range,e))return!0}catch(d){ua(this.view.state,d,"scroll handler")}let{range:r}=e,i=this.coordsAt(r.head,(n=r.assoc)!==null&&n!==void 0?n:r.empty?0:r.head>r.anchor?-1:1),s;if(!i)return;!r.empty&&(s=this.coordsAt(r.anchor,r.anchor>r.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let o=IU(this.view),a={left:i.left-o.left,top:i.top-o.top,right:i.right+o.right,bottom:i.bottom+o.bottom},{offsetWidth:l,offsetHeight:c}=this.view.scrollDOM;if(Ent(this.view.scrollDOM,a,r.head<r.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,l),-l),Math.max(Math.min(e.yMargin,c),-c),this.view.textDirection==vr.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(i.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||i.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let u=this.view.docView.lineAt(r.head,1);u&&u.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let n=r=>r.isWidget()||r.children.some(n);return n(this.tile.resolveBlock(e,1).tile)}destroy(){ej(this.tile)}}function ej(t,e){let n=e==null?void 0:e.get(t);if(n!=1){n==null&&t.destroy();for(let r of t.children)ej(r,e)}}function Qnt(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function dwe(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=Hbe(n.focusNode,n.focusOffset),i=Ube(n.focusNode,n.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let a=hi.get(i.node);if(!a||a.isText()&&a.text!=i.node.nodeValue)s=i;else if(t.docView.lastCompositionAfterCursor){let l=hi.get(r.node);!l||l.isText()&&l.text!=r.node.nodeValue||(s=i)}}if(t.docView.lastCompositionAfterCursor=s!=r,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function Jnt(t,e,n){let r=dwe(t,n);if(!r)return null;let{node:i,from:s,to:o}=r,a=i.nodeValue;if(/[\n\r]/.test(a)||t.state.doc.sliceString(r.from,r.to)!=a)return null;let l=e.invertedDesc;return{range:new Bl(l.mapPos(s),l.mapPos(o),s,o),text:i}}function ert(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}let trt=class{constructor(){this.changes=[]}compareRange(e,n){fb(e,n,this.changes)}comparePoint(e,n){fb(e,n,this.changes)}boundChange(e){fb(e,e,this.changes)}};function nrt(t,e,n){let r=new trt;return bn.compare(t,e,n,r),r.changes}class rrt{constructor(){this.changes=[]}compareRange(e,n){fb(e,n,this.changes)}comparePoint(){}boundChange(e){fb(e,e,this.changes)}}function irt(t,e,n){let r=new rrt;return bn.compare(t,e,n,r),r.changes}function srt(t,e){for(let n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function ort(t,e){let n=!1;return e&&t.iterChangedRanges((r,i)=>{r<e.to&&i>e.from&&(n=!0)}),n}class WN extends Rd{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function art(t,e,n=1){let r=t.charCategorizer(e),i=t.doc.lineAt(e),s=e-i.from;if(i.length==0)return be.cursor(e);s==0?n=1:s==i.length&&(n=-1);let o=s,a=s;n<0?o=fs(i.text,s,!1):a=fs(i.text,s);let l=r(i.text.slice(o,a));for(;o>0;){let c=fs(i.text,o,!1);if(r(i.text.slice(c,o))!=l)break;o=c}for(;a<i.length;){let c=fs(i.text,a);if(r(i.text.slice(a,c))!=l)break;a=c}return be.range(o+i.from,a+i.from)}function lrt(t,e,n,r,i){let s=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let a=t.viewState.heightOracle.textHeight,l=Math.floor((i-n.top-(t.defaultLineHeight-a)*.5)/a);s+=l*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(n.from,n.to);return n.from+$z(o,s,t.state.tabSize)}function tj(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let i;for(let s of r.type){if(s.from>e)break;if(!(s.to<e)){if(s.from<e&&s.to>e)return s;(!i||s.type==Os.Text&&(i.type!=s.type||(n<0?s.from<e:s.to>e)))&&(i=s)}}return i||r}return r}function crt(t,e,n,r){let i=tj(t,e.head,e.assoc||-1),s=!r||i.type!=Os.Text||!(t.lineWrapping||i.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=t.dom.getBoundingClientRect(),a=t.textDirectionAt(i.from),l=t.posAtCoords({x:n==(a==vr.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(l!=null)return be.cursor(l,n?-1:1)}return be.cursor(n?i.to:i.from,n?-1:1)}function nte(t,e,n,r){let i=t.state.doc.lineAt(e.head),s=t.bidiSpans(i),o=t.textDirectionAt(i.from);for(let a=e,l=null;;){let c=znt(i,s,o,a,n),u=Ybe;if(!c){if(i.number==(n?t.state.doc.lines:1))return a;u=`
|
||
`,i=t.state.doc.line(i.number+(n?1:-1)),s=t.bidiSpans(i),c=t.visualLineSide(i,!n)}if(l){if(!l(u))return a}else{if(!r)return c;l=r(u)}a=c}}function urt(t,e,n){let r=t.state.charCategorizer(e),i=r(n);return s=>{let o=r(s);return i==Fr.Space&&(i=o),i==o}}function drt(t,e,n,r){let i=e.head,s=n?1:-1;if(i==(n?t.state.doc.length:0))return be.cursor(i,e.assoc);let o=e.goalColumn,a,l=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(i,e.assoc||((e.empty?n:e.head==e.from)?1:-1)),u=t.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let p=t.viewState.lineBlockAt(i);o==null&&(o=Math.min(l.right-l.left,t.defaultCharacterWidth*(i-p.from))),a=(s<0?p.top:p.bottom)+u}let d=l.left+o,h=t.viewState.heightOracle.textHeight>>1,f=r??h;for(let p=0;;p+=h){let g=a+(f+p)*s,y=nj(t,{x:d,y:g},!1,s);if(n?g>l.bottom:g<l.top)return be.cursor(y.pos,y.assoc);let v=t.coordsAtPos(y.pos,y.assoc),b=v?(v.top+v.bottom)/2:0;if(!v||(n?b>a:b<a))return be.cursor(y.pos,y.assoc,void 0,o)}}function j_(t,e,n){for(;;){let r=0;for(let i of t)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=r||n||(e-s<o-e?-1:1);e=l<0?s:o,r=l}});if(!r)return e}}function hwe(t,e){let n=null;for(let r=0;r<e.ranges.length;r++){let i=e.ranges[r],s=null;if(i.empty){let o=j_(t,i.from,0);o!=i.from&&(s=be.cursor(o,-1))}else{let o=j_(t,i.from,-1),a=j_(t,i.to,1);(o!=i.from||a!=i.to)&&(s=be.range(i.from==i.anchor?o:a,i.from==i.head?o:a))}s&&(n||(n=e.ranges.slice()),n[r]=s)}return n?be.create(n,e.mainIndex):e}function GN(t,e,n){let r=j_(t.state.facet(I3).map(i=>i(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:be.cursor(r,r<n.from?1:-1)}class $u{constructor(e,n){this.pos=e,this.assoc=n}}function nj(t,e,n,r){let i=t.contentDOM.getBoundingClientRect(),s=i.top+t.viewState.paddingTop,{x:o,y:a}=e,l=a-s,c;for(;;){if(l<0)return new $u(0,1);if(l>t.viewState.docHeight)return new $u(t.state.doc.length,-1);if(c=t.elementAtHeight(l),r==null)break;if(c.type==Os.Text){if(r<0?c.to<t.viewport.from:c.from>t.viewport.to)break;let h=t.docView.coordsAt(r<0?c.from:c.to,r>0?-1:1);if(h&&(r<0?h.top<=l+s:h.bottom>=l+s))break}let d=t.viewState.heightOracle.textHeight/2;l=r>0?c.bottom+d:c.top-d}if(t.viewport.from>=c.to||t.viewport.to<=c.from){if(n)return null;if(c.type==Os.Text){let d=lrt(t,i,c,o,a);return new $u(d,d==c.from?1:-1)}}if(c.type!=Os.Text)return l<(c.top+c.bottom)/2?new $u(c.from,1):new $u(c.to,-1);let u=t.docView.lineAt(c.from,2);return(!u||u.length!=c.length)&&(u=t.docView.lineAt(c.from,-2)),new hrt(t,o,a,t.textDirectionAt(c.from)).scanTile(u,c.from)}class hrt{constructor(e,n,r,i){this.view=e,this.x=n,this.y=r,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,n){let{line:r,spans:i}=this.bidiSpansAt(e);return i[Xu.find(i,e-r.from,-1,n)].level==this.baseDir}dirAt(e,n){let{line:r,spans:i}=this.bidiSpansAt(e);return i[Xu.find(i,e-r.from,-1,n)].dir}bidiIn(e,n){let{spans:r,line:i}=this.bidiSpansAt(e);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+i.from<n)}scan(e,n,r=!1){let i=0,s=e.length-1,o=new Set,a=this.bidiIn(e[0],e[s]),l,c,u=-1,d=1e9,h;e:for(;i<s;){let p=s-i,g=i+s>>1;t:if(o.has(g)){let v=i+Math.floor(Math.random()*p);for(let b=0;b<p;b++){if(!o.has(v)){g=v;break t}v++,v==s&&(v=i)}break e}o.add(g);let y=n(g);if(y)for(let v=0;v<y.length;v++){let b=y[v],_=0;if(!(b.width==0&&y.length>1)){if(b.bottom<this.y)(!l||l.bottom<b.bottom)&&(l=b),_=1;else if(b.top>this.y)(!c||c.top>b.top)&&(c=b),_=-1;else{let S=b.left>this.x?this.x-b.left:b.right<this.x?this.x-b.right:0,k=Math.abs(S);k<d&&(u=g,d=k,h=b),S&&(_=S<0==(this.baseDir==vr.LTR)?-1:1)}_==-1&&(!a||this.baseDirAt(e[g],1))?s=g:_==1&&(!a||this.baseDirAt(e[g+1],-1))&&(i=g+1)}}}if(!h){let p=l&&(!c||this.y-l.bottom<c.top-this.y)?l:c;return this.y=(p.top+p.bottom)/2,this.scan(e,n,!0)}if(d&&!r){let{top:p,bottom:g}=h;if(l&&l.bottom>(p+p+g)/3)return this.y=l.bottom-1,this.scan(e,n,!0);if(c&&c.top<(p+g+g)/3)return this.y=c.top+1,this.scan(e,n,!0)}let f=(a?this.dirAt(e[u],1):this.baseDir)==vr.LTR;return{i:u,after:this.x>(h.left+h.right)/2==f}}scanText(e,n){let r=[];for(let s=0;s<e.length;s=fs(e.text,s))r.push(n+s);r.push(n+e.length);let i=this.scan(r,s=>{let o=r[s]-n,a=r[s+1]-n;return ik(e.dom,o,a).getClientRects()});return i.after?new $u(r[i.i+1],-1):new $u(r[i.i],1)}scanTile(e,n){if(!e.length)return new $u(n,1);if(e.children.length==1){let a=e.children[0];if(a.isText())return this.scanText(a,n);if(a.isComposite())return this.scanTile(a,n)}let r=[n];for(let a=0,l=n;a<e.children.length;a++)r.push(l+=e.children[a].length);let i=this.scan(r,a=>{let l=e.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:ik(l.dom,0,l.length)).getClientRects()}),s=e.children[i.i],o=r[i.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):i.after?new $u(r[i.i+1],-1):new $u(o,1)}}const fv="";class frt{constructor(e,n){this.points=e,this.view=n,this.text="",this.lineSeparator=n.state.facet(Vr.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=fv}readRange(e,n){if(!e)return this;let r=e.parentNode;for(let i=e;;){this.findPointBefore(r,i);let s=this.text.length;this.readNode(i);let o=hi.get(i),a=i.nextSibling;if(a==n){o!=null&&o.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=hi.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:$7(i))||$7(a)&&(i.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>s)&&!mrt(a,n)&&this.lineBreak(),i=a}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=i.exec(n))&&(s=a.index,o=a[0].length),this.append(n.slice(r,s<0?n.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=o-1);r=s+o}}readNode(e){let n=hi.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(prt(e,r.node,r.offset)?n:0))}}function prt(t,e,n){for(;;){if(!e||n<pf(e))return!1;if(e==t)return!0;n=Km(e)+1,e=e.parentNode}}function mrt(t,e){let n;for(;!(t==e||!t);t=t.nextSibling){let r=hi.get(t);if(!(r!=null&&r.isWidget()))return!1;r&&(n||(n=[])).push(r)}if(n)for(let r of n){let i=r.overrideDOMText;if(i!=null&&i.length)return!1}return!0}class rte{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class grt{constructor(e,n,r,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView,a=e.state.selection;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=fwe(e.docView.tile,n,r,0))){let l=s||o?[]:vrt(e),c=new frt(l,e);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=brt(l,this.bounds.from)}else{let l=e.observer.selectionRange,c=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!Yz(e.contentDOM,l.focusNode)?a.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),u=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Yz(e.contentDOM,l.anchorNode)?a.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),d=e.viewport;if((lt.ios||lt.chrome)&&a.main.empty&&c!=u&&(d.from>0||d.to<e.state.doc.length)){let h=Math.min(c,u),f=Math.max(c,u),p=d.from-h,g=d.to-f;(p==0||p==1||h==0)&&(g==0||g==-1||f==e.state.doc.length)&&(c=0,u=e.state.doc.length)}if(e.inputState.composing>-1&&a.ranges.length>1)this.newSel=a.replaceRange(be.range(u,c));else if(e.lineWrapping&&u==c&&!(a.main.empty&&a.main.head==c)&&e.inputState.lastTouchTime>Date.now()-100){let h=e.coordsAtPos(c,-1),f=0;h&&(f=e.inputState.lastTouchY<=h.bottom?-1:1),this.newSel=be.create([be.cursor(c,f)])}else this.newSel=be.single(u,c)}}}function fwe(t,e,n,r){if(t.isComposite()){let i=-1,s=-1,o=-1,a=-1;for(let l=0,c=r,u=r;l<t.children.length;l++){let d=t.children[l],h=c+d.length;if(c<e&&h>n)return fwe(d,e,n,c);if(h>=e&&i==-1&&(i=l,s=c),c>n&&d.dom.parentNode==t.dom){o=l,a=u;break}u=h,c=h+d.breakAfter}return{from:s,to:a<0?r+t.length:a,startDOM:(i?t.children[i-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:o<t.children.length&&o>=0?t.children[o].dom:null}}else return t.isText()?{from:r,to:r+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function pwe(t,e){let n,{newSel:r}=e,{state:i}=t,s=i.selection.main,o=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:l}=e.bounds,c=s.from,u=null;(o===8||lt.android&&e.text.length<l-a)&&(c=s.to,u="end");let d=i.doc.sliceString(a,l,fv),h,f;!s.empty&&s.from>=a&&s.to<=l&&(e.typeOver||d!=e.text)&&d.slice(0,s.from-a)==e.text.slice(0,s.from-a)&&d.slice(s.to-a)==e.text.slice(h=e.text.length-(d.length-(s.to-a)))?n={from:s.from,to:s.to,insert:jn.of(e.text.slice(s.from-a,h).split(fv))}:(f=mwe(d,e.text,c-a,u))&&(lt.chrome&&o==13&&f.toB==f.from+2&&e.text.slice(f.from,f.toB)==fv+fv&&f.toB--,n={from:a+f.from,to:a+f.toA,insert:jn.of(e.text.slice(f.from,f.toB).split(fv))})}else r&&(!t.hasFocus&&i.facet(Sh)||G7(r,s))&&(r=null);if(!n&&!r)return!1;if((lt.mac||lt.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=be.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:jn.of([n.insert.toString().replace("."," ")])}):i.doc.lineAt(s.from).to<s.to&&t.docView.lineHasWidget(s.to)&&t.inputState.insertingTextAt>Date.now()-50?n={from:s.from,to:s.to,insert:i.toText(t.inputState.insertingText)}:lt.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==`
|
||
`&&t.lineWrapping&&(r&&(r=be.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:jn.of([" "])}),n)return RU(t,n,r,o);if(r&&!G7(r,s)){let a=!1,l="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(a=!0),l=t.inputState.lastSelectionOrigin,l=="select.pointer"&&(r=hwe(i.facet(I3).map(c=>c(t)),r))),t.dispatch({selection:r,scrollIntoView:a,userEvent:l}),!0}else return!1}function RU(t,e,n,r=-1){if(lt.ios&&t.inputState.flushIOSKey(e))return!0;let i=t.state.selection.main;if(lt.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&t.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&pb(t.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>i.head)&&pb(t.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&pb(t.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,a=()=>o||(o=yrt(t,e,n));return t.state.facet(ewe).some(l=>l(t,e.from,e.to,s,a))||t.dispatch(a()),!0}function yrt(t,e,n){let r,i=t.state,s=i.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let l=e.from<s.from?-1:1,c=l<0?s.from:s.to,u=j_(i.facet(I3).map(d=>d(t)),c,l);e.from==u&&(o=u)}if(o>-1)r={changes:e,selection:be.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let l=s.from<e.from?i.sliceDoc(s.from,e.from):"",c=s.to>e.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(t.state.toText(l+e.insert.sliceString(0,void 0,t.state.lineBreak)+c))}else{let l=i.changes(e),c=n&&n.main.to<=l.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let u=t.state.sliceDoc(e.from,e.to),d,h=n&&dwe(t,n.main.head);if(h){let p=e.insert.length-(e.to-e.from);d={from:h.from,to:h.to-p}}else d=t.state.doc.lineAt(s.head);let f=s.to-e.to;r=i.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:l,range:c||p.map(l)};let g=p.to-f,y=g-u.length;if(t.state.sliceDoc(y,g)!=u||g>=d.from&&y<=d.to)return{range:p};let v=i.changes({from:y,to:g,insert:e.insert}),b=p.to-s.to;return{changes:v,range:c?be.range(Math.max(0,c.anchor+b),Math.max(0,c.head+b)):p.map(v)}})}else r={changes:l,selection:c&&i.selection.replaceRange(c)}}let a="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,a+=".compose",t.inputState.compositionFirstChange&&(a+=".start",t.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:a,scrollIntoView:!0})}function mwe(t,e,n,r){let i=Math.min(t.length,e.length),s=0;for(;s<i&&t.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&t.length==e.length)return null;let o=t.length,a=e.length;for(;o>0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,s-Math.min(o,a));n-=o+l-s}if(o<s&&t.length<e.length){let l=n<=s&&n>=o?s-n:0;s-=l,a=s+(a-o),o=s}else if(a<s){let l=n<=s&&n>=a?s-n:0;s-=l,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function vrt(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}=t.observer.selectionRange;return n&&(e.push(new rte(n,r)),(i!=n||s!=r)&&e.push(new rte(i,s))),e}function brt(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?be.single(n+e,r+e):null}function G7(t,e){return e.head==t.main.head&&e.anchor==t.main.anchor}let wrt=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,lt.safari&&e.contentDOM.addEventListener("input",()=>null),lt.gecko&&Prt(e.contentDOM.ownerDocument)}handleEvent(e){!Art(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,n);for(let i of r.handlers){if(n.defaultPrevented)break;if(i(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=xrt(e),r=this.handlers,i=this.view.contentDOM;for(let s in n)if(s!="scroll"){let o=!n[s].handlers.length,a=r[s];a&&o!=!a.handlers.length&&(i.removeEventListener(s,this.handleEvent),a=null),a||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!n[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&ywe.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),lt.android&<.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return lt.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&!e.shiftKey&&((n=gwe.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||_rt.indexOf(e.key)>-1&&e.ctrlKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,pb(this.view.contentDOM,n.key,n.keyCode,n instanceof KeyboardEvent?n:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:lt.safari&&!lt.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function ite(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(i){ua(n.state,i)}}}function xrt(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let i=r.spec,s=i&&i.plugin.domEventHandlers,o=i&&i.plugin.domEventObservers;if(s)for(let a in s){let l=s[a];l&&n(a).handlers.push(ite(r.value,l))}if(o)for(let a in o){let l=o[a];l&&n(a).observers.push(ite(r.value,l))}}for(let r in Jc)n(r).handlers.push(Jc[r]);for(let r in va)n(r).observers.push(va[r]);return e}const gwe=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],_rt="dthko",ywe=[16,17,18,20,91,92,224,225],xE=6;function _E(t){return Math.max(0,t)*.7+8}function Srt(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class krt{constructor(e,n,r,i){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=Fbe(e.contentDOM),this.atoms=e.state.facet(I3).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Vr.allowMultipleSelections)&&Crt(e,n),this.dragging=Trt(e,n)&&wwe(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Srt(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,i=0,s=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=IU(this.view);e.clientX-l.left<=i+xE?n=-_E(i-e.clientX):e.clientX+l.right>=o-xE&&(n=_E(e.clientX-o)),e.clientY-l.top<=s+xE?r=-_E(s-e.clientY):e.clientY+l.bottom>=a-xE&&(r=_E(e.clientY-a)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=hwe(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Crt(t,e){let n=t.state.facet(Zbe);return n.length?n[0](e):lt.mac?e.metaKey:e.ctrlKey}function Ert(t,e){let n=t.state.facet(Xbe);return n.length?n[0](e):lt.mac?!e.altKey:!e.ctrlKey}function Trt(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=rk(t.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s<i.length;s++){let o=i[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function Art(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=hi.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const Jc=Object.create(null),va=Object.create(null),vwe=lt.ie&<.ie_version<15||lt.ios&<.webkit_version<604;function Irt(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),bwe(t,n.value)},50)}function FI(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function bwe(t,e){e=FI(t.state,CU,e);let{state:n}=t,r,i=1,s=n.toText(e),o=s.lines==n.selection.ranges.length;if(rj!=null&&n.selection.ranges.every(l=>l.empty)&&rj==s.toString()){let l=-1;r=n.changeByRange(c=>{let u=n.doc.lineAt(c.from);if(u.from==l)return{range:c};l=u.from;let d=n.toText((o?s.line(i++).text:e)+n.lineBreak);return{changes:{from:u.from,insert:d},range:be.cursor(c.from+d.length)}})}else o?r=n.changeByRange(l=>{let c=s.line(i++);return{changes:{from:l.from,to:l.to,insert:c.text},range:be.cursor(l.from+c.length)}}):r=n.replaceSelection(s);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}va.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};va.wheel=va.mousewheel=t=>{t.inputState.lastWheelEvent=Date.now()};Jc.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);va.touchstart=(t,e)=>{let n=t.inputState,r=e.targetTouches[0];n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin("select.pointer")};va.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Jc.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(Qbe))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=Mrt(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new krt(t,e,n,r)),r&&t.observer.ignore(()=>{Vbe(t.contentDOM);let s=t.root.activeElement;s&&!s.contains(t.contentDOM)&&s.blur()});let i=t.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function ste(t,e,n,r){if(r==1)return be.cursor(e,n);if(r==2)return art(t.state,e,n);{let i=t.docView.lineAt(e,n),s=t.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,a=i?i.posAtEnd:s.to;return a<t.state.doc.length&&a==s.to&&a++,be.range(o,a)}}const Rrt=lt.ie&<.ie_version<=11;let ote=null,ate=0,lte=0;function wwe(t){if(!Rrt)return t.detail;let e=ote,n=lte;return ote=t,lte=Date.now(),ate=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(ate+1)%3:1}function Mrt(t,e){let n=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=wwe(e),i=t.state.selection;return{update(s){s.docChanged&&(n.pos=s.changes.mapPos(n.pos),i=i.map(s.changes))},get(s,o,a){let l=t.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),c,u=ste(t,l.pos,l.assoc,r);if(n.pos!=l.pos&&!o){let d=ste(t,n.pos,n.assoc,r),h=Math.min(d.from,u.from),f=Math.max(d.to,u.to);u=h<u.from?be.range(h,f,u.assoc):be.range(f,h,u.assoc)}return o?i.replaceRange(i.main.extend(u.from,u.to,u.assoc)):a&&r==1&&i.ranges.length>1&&(c=Nrt(i,l.pos))?c:a?i.addRange(u):be.create([u])}}}function Nrt(t,e){for(let n=0;n<t.ranges.length;n++){let{from:r,to:i}=t.ranges[n];if(r<=e&&i>=e)return be.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}Jc.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let i=t.docView.tile.nearest(e.target);if(i&&i.isWidget()){let s=i.posAtStart,o=s+i.length;(s>=n.to||o<=n.from)&&(n=be.range(s,o))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",FI(t.state,EU,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Jc.dragend=t=>(t.inputState.draggedContent=null,!1);function cte(t,e,n,r){if(n=FI(t.state,CU,n),!n)return;let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=r&&s&&Ert(t,e)?{from:s.from,to:s.to}:null,a={from:i,insert:n},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Jc.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,s=()=>{++i==n.length&&cte(t,e,r.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o<n.length;o++){let a=new FileReader;a.onerror=s,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),s()},a.readAsText(n[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return cte(t,e,r,!0),!0}return!1};Jc.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=vwe?null:e.clipboardData;return n?(bwe(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(Irt(t),!1)};function Ort(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function Drt(t){let e=[],n=[],r=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),n.push(i));if(!e.length){let i=-1;for(let{from:s}of t.selection.ranges){let o=t.doc.lineAt(s);o.number>i&&(e.push(o.text),n.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),i=o.number}r=!0}return{text:FI(t,EU,e.join(t.lineBreak)),ranges:n,linewise:r}}let rj=null;Jc.copy=Jc.cut=(t,e)=>{if(!L_(t.contentDOM,t.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=Drt(t.state);if(!n&&!i)return!1;rj=i?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=vwe?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(Ort(t,n),!1)};const xwe=Tf.define();function _we(t,e){let n=[];for(let r of t.facet(twe)){let i=r(t,e);i&&n.push(i)}return n.length?t.update({effects:n,annotations:xwe.of(!0)}):null}function Swe(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=_we(t.state,e);n?t.dispatch(n):t.update([])}},10)}va.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),Swe(t)};va.blur=t=>{t.observer.clearSelectionRange(),Swe(t)};va.compositionstart=va.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};va.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,lt.chrome&<.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};va.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Jc.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let s=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let a=o[0],l=t.posAtDOM(a.startContainer,a.startOffset),c=t.posAtDOM(a.endContainer,a.endOffset);return RU(t,{from:l,to:c,insert:t.state.toText(s)},null),!0}}let i;if(lt.chrome&<.android&&(i=gwe.find(s=>s.inputType==e.inputType))&&(t.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return lt.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),lt.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>va.compositionend(t,e),20),!1};const ute=new Set;function Prt(t){ute.has(t)||(ute.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const dte=["pre-wrap","normal","pre-line","break-spaces"];let sx=!1;function hte(){sx=!1}class Lrt{constructor(e){this.lineWrapping=e,this.doc=jn.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return dte.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];i<0?r++:this.heightSamples[Math.floor(i*10)]||(n=!0,this.heightSamples[Math.floor(i*10)]=!0)}return n}refresh(e,n,r,i,s,o){let a=dte.indexOf(e)>-1,l=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=n,this.charWidth=r,this.textHeight=i,this.lineLength=s,l){this.heightSamples={};for(let c=0;c<o.length;c++){let u=o[c];u<0?c++:this.heightSamples[Math.floor(u*10)]=!0}}return l}}class zrt{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class Mc{constructor(e,n,r,i,s){this.from=e,this.length=n,this.top=r,this.height=i,this._content=s}get type(){return typeof this._content=="number"?Os.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Y1?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Mc(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var Er=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(Er||(Er={}));const c6=.001;class No{constructor(e,n,r=2){this.length=e,this.height=n,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>c6&&(sx=!0),this.height=e)}replace(e,n,r){return No.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,i){let s=this,o=r.doc;for(let a=i.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:u,toB:d}=i[a],h=s.lineAt(l,Er.ByPosNoHeight,r.setDoc(n),0,0),f=h.to>=c?h:s.lineAt(c,Er.ByPosNoHeight,r,0,0);for(d+=f.to-c,c=f.to;a>0&&h.from<=i[a-1].toA;)l=i[a-1].fromA,u=i[a-1].fromB,a--,l<h.from&&(h=s.lineAt(l,Er.ByPosNoHeight,r,0,0));u+=h.from-l,l=h.from;let p=MU.build(r.setDoc(o),e,u,d);s=K7(s,s.replace(l,c,p))}return s.updateHeight(r,0)}static empty(){return new La(0,0,0)}static of(e){if(e.length==1)return e[0];let n=0,r=e.length,i=0,s=0;for(;;)if(n==r)if(i>s*2){let a=e[n-1];a.break?e.splice(--n,1,a.left,null,a.right):e.splice(--n,1,a.left,a.right),r+=1+a.break,i-=a.size}else if(s>i*2){let a=e[r];a.break?e.splice(r,1,a.left,null,a.right):e.splice(r,1,a.left,a.right),r+=2+a.break,s-=a.size}else break;else if(i<s){let a=e[n++];a&&(i+=a.size)}else{let a=e[--r];a&&(s+=a.size)}let o=0;return e[n-1]==null?(o=1,n--):e[n]==null&&(o=1,r++),new Brt(No.of(e.slice(0,n)),o,No.of(e.slice(r)))}}function K7(t,e){return t==e?t:(t.constructor!=e.constructor&&(sx=!0),e)}No.prototype.size=1;const jrt=It.replace({});class kwe extends No{constructor(e,n,r){super(e,n),this.deco=r,this.spaceAbove=0}mainBlock(e,n){return new Mc(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,n,r,i){return this.spaceAbove&&e<r+this.spaceAbove?new Mc(i,0,r,this.spaceAbove,jrt):this.mainBlock(r,i)}lineAt(e,n,r,i,s){let o=this.mainBlock(i,s);return this.spaceAbove?this.blockAt(0,r,i,s).join(o):o}forEachLine(e,n,r,i,s,o){e<=s+this.length&&n>=s&&o(this.lineAt(0,Er.ByPos,r,i,s))}setMeasuredHeight(e){let n=e.heights[e.index++];n<0?(this.spaceAbove=-n,n=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class La extends kwe{constructor(e,n,r){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,n){return new Mc(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,n,r){let i=r[0];return r.length==1&&(i instanceof La||i instanceof _s&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof _s?i=new La(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):No.of(r)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more?this.setMeasuredHeight(i):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class _s extends No{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,i=e.doc.lineAt(n+this.length).number,s=i-r+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*s);o=l/s,this.length>s+1&&(a=(this.height-l)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:i,perLine:o,perChar:a}}blockAt(e,n,r,i){let{firstLine:s,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(n,i);if(n.lineWrapping){let c=i+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),u=n.doc.lineAt(c),d=a+u.length*l,h=Math.max(r,e-d/2);return new Mc(u.from,u.length,h,d,0)}else{let c=Math.max(0,Math.min(o-s,Math.floor((e-r)/a))),{from:u,length:d}=n.doc.line(s+c);return new Mc(u,d,r+a*c,a,0)}}lineAt(e,n,r,i,s){if(n==Er.ByHeight)return this.blockAt(e,r,i,s);if(n==Er.ByPosNoHeight){let{from:f,to:p}=r.doc.lineAt(e);return new Mc(f,p-f,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,s),c=r.doc.lineAt(e),u=a+c.length*l,d=c.number-o,h=i+a*d+l*(c.from-s-d);return new Mc(c.from,c.length,Math.max(i,Math.min(h,i+this.height-u)),u,0)}forEachLine(e,n,r,i,s,o){e=Math.max(e,s),n=Math.min(n,s+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(r,s);for(let u=e,d=i;u<=n;){let h=r.doc.lineAt(u);if(u==e){let p=h.number-a;d+=l*p+c*(e-s-p)}let f=l+c*h.length;o(new Mc(h.from,h.length,d,f,0)),d+=f,u=h.to+1}}replace(e,n,r){let i=this.length-n;if(i>0){let s=r[r.length-1];s instanceof _s?r[r.length-1]=new _s(s.length+i):r.push(null,new _s(i-1))}if(e>0){let s=r[0];s instanceof _s?r[0]=new _s(e+s.length):r.unshift(new _s(e-1),null)}return No.of(r)}decomposeLeft(e,n){n.push(new _s(e-1),null)}decomposeRight(e,n){n.push(null,new _s(this.length-e-1))}updateHeight(e,n=0,r=!1,i){let s=n+this.length;if(i&&i.from<=n+this.length&&i.more){let o=[],a=Math.max(n,i.from),l=-1;for(i.from>n&&o.push(new _s(i.from-n-1).updateHeight(e,n));a<=s&&i.more;){let u=e.doc.lineAt(a).length;o.length&&o.push(null);let d=i.heights[i.index++],h=0;d<0&&(h=-d,d=i.heights[i.index++]),l==-1?l=d:Math.abs(d-l)>=c6&&(l=-2);let f=new La(u,d,h);f.outdated=!1,o.push(f),a+=u+1}a<=s&&o.push(null,new _s(s-a).updateHeight(e,a));let c=No.of(o);return(l<0||Math.abs(c.height-this.height)>=c6||Math.abs(l-this.heightMetrics(e,n).perLine)>=c6)&&(sx=!0),K7(this,c)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Brt extends No{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,i){let s=r+this.left.height;return e<s?this.left.blockAt(e,n,r,i):this.right.blockAt(e,n,s,i+this.left.length+this.break)}lineAt(e,n,r,i,s){let o=i+this.left.height,a=s+this.left.length+this.break,l=n==Er.ByHeight?e<o:e<a,c=l?this.left.lineAt(e,n,r,i,s):this.right.lineAt(e,n,r,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let u=n==Er.ByPosNoHeight?Er.ByPosNoHeight:Er.ByPos;return l?c.join(this.right.lineAt(a,u,r,o,a)):this.left.lineAt(a,u,r,i,s).join(c)}forEachLine(e,n,r,i,s,o){let a=i+this.left.height,l=s+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,n,r,i,s,o),n>=l&&this.right.forEachLine(e,n,r,a,l,o);else{let c=this.lineAt(l,Er.ByPos,r,i,s);e<c.from&&this.left.forEachLine(e,c.from-1,r,i,s,o),c.to>=e&&c.from<=n&&o(c),n>c.to&&this.right.forEachLine(c.to+1,n,r,a,l,o)}}replace(e,n,r){let i=this.left.length+this.break;if(n<i)return this.balanced(this.left.replace(e,n,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,n-i,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let a of r)s.push(a);if(e>0&&fte(s,o-1),n<this.length){let a=s.length;this.decomposeRight(n,s),fte(s,a)}return No.of(s)}decomposeLeft(e,n){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(r++,e>=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,n);e<r&&this.left.decomposeRight(e,n),this.break&&e<i&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?No.of(this.break?[e,null,n]:[e,n]):(this.left=K7(this.left,e),this.right=K7(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,i){let{left:s,right:o}=this,a=n+s.length+this.break,l=null;return i&&i.from<=n+s.length&&i.more?l=s=s.updateHeight(e,n,r,i):s.updateHeight(e,n,r),i&&i.from<=a+o.length&&i.more?l=o=o.updateHeight(e,a,r,i):o.updateHeight(e,a,r),l?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function fte(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof _s&&(r=t[e+1])instanceof _s&&t.splice(e-1,3,new _s(n.length+1+r.length))}const Frt=5;class MU{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof La?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new La(r-this.pos,-1,0)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e<n||r.heightRelevant){let i=r.widget?r.widget.estimatedHeight:0,s=r.widget?r.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let o=n-e;r.block?this.addBlock(new kwe(o,i,r)):(o||s||i>=Frt)&&this.addLineDeco(i,s,o)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new La(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,n){let r=new _s(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof La)return e;let n=new La(0,-1,0);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof La)&&!this.isCovered?this.nodes.push(new La(0,-1,0)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let i of this.nodes)i instanceof La&&i.updateHeight(this.oracle,r),r+=i?i.length:1;return this.nodes}static build(e,n,r,i){let s=new MU(r,e);return bn.spans(n,r,i,s,0),s.finish(r)}}function Vrt(t,e,n){let r=new $rt;return bn.compare(t,e,n,r,0),r.changes}class $rt{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,r,i){(e<n||r&&r.heightRelevant||i&&i.heightRelevant)&&fb(e,n,this.changes,5)}}function Hrt(t,e){let n=t.getBoundingClientRect(),r=t.ownerDocument,i=r.defaultView||window,s=Math.max(0,n.left),o=Math.min(i.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(i.innerHeight,n.bottom);for(let c=t.parentNode;c&&c!=r.body;)if(c.nodeType==1){let u=c,d=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&d.overflow!="visible"){let h=u.getBoundingClientRect();s=Math.max(s,h.left),o=Math.min(o,h.right),a=Math.max(a,h.top),l=Math.min(c==t.parentNode?i.innerHeight:l,h.bottom)}c=d.position=="absolute"||d.position=="fixed"?u.offsetParent:u.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:s-n.left,right:Math.max(s,o)-n.left,top:a-(n.top+e),bottom:Math.max(a,l)-(n.top+e)}}function Urt(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}function qrt(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class KN{constructor(e,n,r,i){this.from=e,this.to=n,this.size=r,this.displaySize=i}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],s=n[r];if(i.from!=s.from||i.to!=s.to||i.size!=s.size)return!1}return!0}draw(e,n){return It.replace({widget:new Wrt(this.displaySize*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class Wrt extends Rd{constructor(e,n){super(),this.size=e,this.vertical=n}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class pte{constructor(e,n){this.view=e,this.state=n,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=mte,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=vr.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=n.facet(TU).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new Lrt(r),this.stateDeco=gte(n),this.heightMap=No.empty().applyChanges(this.stateDeco,jn.empty,this.heightOracle.setDoc(n.doc),[new Bl(0,0,0,n.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=It.set(this.lineGaps.map(i=>i.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let i=r?n.head:n.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new SE(s,o))}}return this.viewports=e.sort((r,i)=>r.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?mte:new NU(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(I4(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=gte(this.state);let i=e.changedRanges,s=Bl.extendWithRanges(i,Vrt(r,this.stateDeco,e?e.changes:Qc.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);hte(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||sx)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let l=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.head<l.from||n.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,n));let c=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(rwe)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,n=e.contentDOM,r=window.getComputedStyle(n),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?vr.RTL:vr.LTR;let o=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",a=n.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,u=0;if(a.width&&a.height){let{scaleX:k,scaleY:T}=Bbe(n,a);(k>.005&&Math.abs(this.scaleX-k)>.005||T>.005&&Math.abs(this.scaleY-T)>.005)&&(this.scaleX=k,this.scaleY=T,c|=16,o=l=!0)}let d=(parseInt(r.paddingTop)||0)*this.scaleY,h=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=d||this.paddingBottom!=h)&&(this.paddingTop=d,this.paddingBottom=h,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let f=Fbe(this.view.contentDOM,!1).y;f!=this.scrollParent&&(this.scrollParent=f,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=$be(this.scrollParent||e.win);let g=(this.printing?qrt:Hrt)(n,this.paddingTop),y=g.top-this.pixelViewport.top,v=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let b=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(b!=this.inView&&(this.inView=b,b&&(l=!0)),!this.inView&&!this.scrollTarget&&!Urt(e.dom))return 0;let _=a.width;if((this.contentDOMWidth!=_||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),l){let k=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(k)&&(o=!0),o||i.lineWrapping&&Math.abs(_-this.contentDOMWidth)>i.charWidth){let{lineHeight:T,charWidth:E,textHeight:C}=e.docView.measureTextSize();o=T>0&&i.refresh(s,T,E,C,Math.max(5,_/E),k),o&&(e.docView.minWidth=0,c|=16)}y>0&&v>0?u=Math.max(y,v):y<0&&v<0&&(u=Math.min(y,v)),hte();for(let T of this.viewports){let E=T.from==this.viewport.from?k:e.docView.measureVisibleLineHeights(T);this.heightMap=(o?No.empty().applyChanges(this.stateDeco,jn.empty,this.heightOracle,[new Bl(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new zrt(T.from,E))}sx&&(c|=2)}let S=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return S&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(u,this.scrollTarget),c|=this.updateForViewport()),(c&2||S)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new SE(i.lineAt(o-r*1e3,Er.ByHeight,s,0,0).from,i.lineAt(a+(1-r)*1e3,Er.ByHeight,s,0,0).to);if(n){let{head:c}=n.range;if(c<l.from||c>l.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),d=i.lineAt(c,Er.ByPos,s,0,0),h;n.y=="center"?h=(d.top+d.bottom)/2-u/2:n.y=="start"||n.y=="nearest"&&c<l.from?h=d.top:h=d.bottom-u,l=new SE(i.lineAt(h-1e3/2,Er.ByHeight,s,0,0).from,i.lineAt(h+u+1e3/2,Er.ByHeight,s,0,0).to)}}return l}mapViewport(e,n){let r=n.mapPos(e.from,-1),i=n.mapPos(e.to,1);return new SE(this.heightMap.lineAt(r,Er.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,Er.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},r=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,Er.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(n,Er.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||i<=o-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||s>=a+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s<a+2*1e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let r=[];for(let i of e)n.touchesRange(i.from,i.to)||r.push(new KN(n.mapPos(i.from),n.mapPos(i.to),i.size,i.displaySize));return r}ensureLineGaps(e,n){let r=this.heightOracle.lineWrapping,i=r?1e4:2e3,s=i>>1,o=i<<1;if(this.defaultTextDirection!=vr.LTR&&!r)return[];let a=[],l=(u,d,h,f)=>{if(d-u<s)return;let p=this.state.selection.main,g=[p.from];p.empty||g.push(p.to);for(let v of g)if(v>u&&v<d){l(u,v-10,h,f),l(v+10,d,h,f);return}let y=Krt(e,v=>v.from>=h.from&&v.to<=h.to&&Math.abs(v.from-u)<s&&Math.abs(v.to-d)<s&&!g.some(b=>v.from<b&&v.to>b));if(!y){if(d<h.to&&n&&r&&n.visibleRanges.some(_=>_.from<=d&&_.to>=d)){let _=n.moveToLineBoundary(be.cursor(d),!1,!0).head;_>u&&(d=_)}let v=this.gapSize(h,u,d,f),b=r||v<2e6?v:2e6;y=new KN(u,d,v,b)}a.push(y)},c=u=>{if(u.length<o||u.type!=Os.Text)return;let d=Grt(u.from,u.to,this.stateDeco);if(d.total<o)return;let h=this.scrollTarget?this.scrollTarget.range.head:null,f,p;if(r){let g=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,y,v;if(h!=null){let b=CE(d,h),_=((this.visibleBottom-this.visibleTop)/2+g)/u.height;y=b-_,v=b+_}else y=(this.visibleTop-u.top-g)/u.height,v=(this.visibleBottom-u.top+g)/u.height;f=kE(d,y),p=kE(d,v)}else{let g=d.total*this.heightOracle.charWidth,y=i*this.heightOracle.charWidth,v=0;if(g>2e6)for(let T of e)T.from>=u.from&&T.from<u.to&&T.size!=T.displaySize&&T.from*this.heightOracle.charWidth+v<this.pixelViewport.left&&(v=T.size-T.displaySize);let b=this.pixelViewport.left+v,_=this.pixelViewport.right+v,S,k;if(h!=null){let T=CE(d,h),E=((_-b)/2+y)/g;S=T-E,k=T+E}else S=(b-y)/g,k=(_+y)/g;f=kE(d,S),p=kE(d,k)}f>u.from&&l(u.from,f,u,d),p<u.to&&l(p,u.to,u,d)};for(let u of this.viewportLines)Array.isArray(u.type)?u.type.forEach(c):c(u);return a}gapSize(e,n,r,i){let s=CE(i,r)-CE(i,n);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){KN.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=It.set(e.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];bn.spans(n,this.viewport.from,this.viewport.to,{span(s,o){r.push({from:s,to:o})},point(){}},20);let i=0;if(r.length!=this.visibleRanges.length)i=12;else for(let s=0;s<r.length&&!(i&8);s++){let o=this.visibleRanges[s],a=r[s];(o.from!=a.from||o.to!=a.to)&&(i|=4,e&&e.mapPos(o.from,-1)==a.from&&e.mapPos(o.to,1)==a.to||(i|=8))}return this.visibleRanges=r,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||I4(this.heightMap.lineAt(e,Er.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||I4(this.heightMap.lineAt(this.scaler.fromDOM(e),Er.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return I4(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class SE{constructor(e,n){this.from=e,this.to=n}}function Grt(t,e,n){let r=[],i=t,s=0;return bn.spans(n,t,e,{span(){},point(o,a){o>i&&(r.push({from:i,to:o}),s+=o-i),i=a}},20),i<e&&(r.push({from:i,to:e}),s+=e-i),{total:s,ranges:r}}function kE({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let i=0;;i++){let{from:s,to:o}=e[i],a=o-s;if(r<=a)return s+r;r-=a}}function CE(t,e){let n=0;for(let{from:r,to:i}of t.ranges){if(e<=i){n+=e-r;break}n+=i-r}return n/t.total}function Krt(t,e){for(let n of t)if(e(n))return n}const mte={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};function gte(t){let e=t.facet(zI).filter(r=>typeof r!="function"),n=t.facet(AU).filter(r=>typeof r!="function");return n.length&&e.push(bn.join(n)),e}class NU{constructor(e,n,r){let i=0,s=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let c=n.lineAt(a,Er.ByPos,e,0,0).top,u=n.lineAt(l,Er.ByPos,e,0,0).bottom;return i+=u-c,{from:a,to:l,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(n.height-i);for(let a of this.viewports)a.domTop=o+(a.top-s)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),s=a.bottom}toDOM(e){for(let n=0,r=0,i=0;;n++){let s=n<this.viewports.length?this.viewports[n]:null;if(!s||e<s.top)return i+(e-r)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);r=s.bottom,i=s.domBottom}}fromDOM(e){for(let n=0,r=0,i=0;;n++){let s=n<this.viewports.length?this.viewports[n]:null;if(!s||e<s.domTop)return r+(e-i)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);r=s.bottom,i=s.domBottom}}eq(e){return e instanceof NU?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((n,r)=>n.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function I4(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Mc(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(i=>I4(i,e)):t._content)}const EE=st.define({combine:t=>t.join(" ")}),ij=st.define({combine:t=>t.indexOf(!0)>-1}),sj=Gm.newName(),Cwe=Gm.newName(),Ewe=Gm.newName(),Twe={"&light":"."+Cwe,"&dark":"."+Ewe};function oj(t,e,n){return new Gm(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return t;if(!n||!n[i])throw new RangeError(`Unsupported selector: ${i}`);return n[i]}):t+" "+r}})}const Yrt=oj("."+sj,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Twe),Zrt={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},YN=lt.ie&<.ie_version<=11;let Xrt=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Tnt,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(lt.ie&<.ie_version<=11||lt.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&<.android&&e.constructor.EDIT_CONTEXT!==!1&&!(lt.chrome&<.chrome_version<126)&&(this.editContext=new Jrt(e),e.state.facet(Sh)&&(e.contentDOM.editContext=this.editContext.editContext)),YN&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(Sh)?r.root.activeElement!=this.dom:!L_(this.dom,i))return;let s=i.anchorNode&&r.docView.tile.nearest(i.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(lt.ie&<.ie_version<=11||lt.android&<.chrome)&&!r.state.selection.main.empty&&i.focusNode&&z_(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=rk(e.root);if(!n)return!1;let r=lt.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Qrt(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let i=L_(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Int(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let r=this.dom;r;)if(r.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=n)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Zrt),YN&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),YN&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var r;if(!this.delayedAndroidKey){let i=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&pb(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),n==-1?{from:n,to:r}=o:(n=Math.min(o.from,n),r=Math.max(o.to,r)))}return{from:n,to:r,typeOver:i}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),i=this.selectionChanged&&L_(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new grt(this.view,e,n,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=pwe(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!G7(this.view.state.selection,n.newSel.main))&&this.view.update([]),i}readMutation(e){let n=this.view.docView.tile.nearest(e.target);if(!n||n.isWidget())return null;if(n.markDirty(e.type=="attributes"),e.type=="childList"){let r=yte(n,e.previousSibling||e.target.previousSibling,-1),i=yte(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:i?n.posBefore(i):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Sh)!=e.state.facet(Sh)&&(e.view.contentDOM.editContext=e.state.facet(Sh)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}};function yte(t,e,n){for(;e;){let r=hi.get(e);if(r&&r.parent==t)return r;let i=e.parentNode;e=i!=t.dom?i:n>0?e.nextSibling:e.previousSibling}return null}function vte(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor,1);return z_(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function Qrt(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return vte(t,i)}let n=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?vte(t,n):null}class Jrt{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let i=e.state.selection.main,{anchor:s,head:o}=i,a=this.toEditorPos(r.updateRangeStart),l=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:a,drifted:!1});let c=l-a>r.text.length;a==this.from&&s<this.from?a=s:l==this.to&&s>this.to&&(l=s);let u=mwe(e.state.sliceDoc(a,l),r.text,(c?i.from:i.to)-a,c?"end":null);if(!u){let h=be.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));G7(h,i)||e.dispatch({selection:h,userEvent:"select"});return}let d={from:u.from+a,to:u.toA+a,insert:jn.of(r.text.slice(u.from,u.toB).split(`
|
||
`))};if((lt.mac||lt.android)&&d.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(d={from:a,to:l,insert:jn.of([r.text.replace("."," ")])}),this.pendingContextChange=d,!e.state.readOnly){let h=this.to-this.from+(d.to-d.from+d.insert.length);RU(e,d,be.single(this.toEditorPos(r.selectionStart,h),this.toEditorPos(r.selectionEnd,h)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),d.from<d.to&&!d.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let l=e.coordsForChar(o);s=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||s||new DOMRect,i.push(s)}n.updateCharacterBounds(r.rangeStart,i)},this.handlers.textformatupdate=r=>{let i=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,a=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(s.rangeStart),c=this.toEditorPos(s.rangeEnd);if(l<c){let u=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;i.push(It.mark({attributes:{style:u}}).range(l,c))}}}e.dispatch({effects:swe.of(It.set(i))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let i=rk(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,o,a,l,c)=>{if(r)return;let u=c.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(c)){i=this.pendingContextChange=null,n+=u,this.to+=u;return}else i=null,this.revertPending(e.state);if(s+=n,o+=n,o<=this.from)this.from+=u,this.to+=u;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),c.toString()),this.to+=u}n+=u}),i&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),i=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}let ht=class u6{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(i=>i.forEach(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Ant(e.parent)||document,this.viewState=new pte(this,e.state||Vr.create(e)),e.scrollTo&&e.scrollTo.is(wE)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Hv).map(i=>new HN(i));for(let i of this.plugins)i.update(this);this.observer=new Xrt(this),this.inputState=new wrt(this),this.inputState.ensureHandlers(this.plugins),this.docView=new tte(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let n=e.length==1&&e[0]instanceof Mo?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,i,s=this.state;for(let h of e){if(h.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=h.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,a=0,l=null;e.some(h=>h.annotation(xwe))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=_we(s,o),l||(a=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(u=null)):this.observer.clear(),s.facet(Vr.phrases)!=this.state.facet(Vr.phrases))return this.setState(s);i=U7.create(this,s,e),i.flags|=a;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let h of e){if(d&&(d=d.map(h.changes)),h.scrollIntoView){let{main:f}=h.state.selection,{x:p,y:g}=this.state.facet(u6.cursorScrollMargin);d=new mb(f.empty?f:be.cursor(f.head,f.head>f.anchor?-1:1),"nearest","nearest",g,p)}for(let f of h.effects)f.is(wE)&&(d=f.value.clip(this.state))}this.viewState.update(i,d),this.bidiCache=Y7.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(A4)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(h=>h.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(EE)!=i.state.facet(EE)&&(this.viewState.mustMeasureContent=!0),(n||r||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let h of this.state.facet(Jz))try{h(i)}catch(f){ua(this.state,f,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!pwe(this,u)&&c.force&&pb(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new pte(this,e),this.plugins=e.facet(Hv).map(r=>new HN(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new tte(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(Hv),r=e.state.facet(Hv);if(n!=r){let i=[];for(let s of r){let o=n.indexOf(s);if(o<0)i.push(new HN(s));else{let a=this.plugins[o];a.mustUpdate=e,i.push(a)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){ua(this.state,r,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if($be(r||this.win))s=-1,o=this.viewState.heightMap.height;else{let f=this.viewState.scrollAnchorAt(i);s=f.from,o=f.top}this.updateState=1;let l=this.viewState.measure();if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(f=>{try{return f.read(this)}catch(p){return ua(this.state,p),bte}}),d=U7.create(this,this.state,[]),h=!1;d.flags|=l,n?n.flags|=l:n=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),h=this.docView.update(d),h&&this.docViewUpdate());for(let f=0;f<c.length;f++)if(u[f]!=bte)try{let p=c[f];p.write&&p.write(u[f],this)}catch(p){ua(this.state,p)}if(h&&this.docView.updateSelection(!0),!d.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let p=((s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o)/this.scaleY;if((p>1||p<-1)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){i=i+p,r?r.scrollTop+=p:this.win.scrollBy(0,p),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let a of this.state.facet(Jz))a(n)}get themeClasses(){return sj+" "+(this.state.facet(ij)?Ewe:Cwe)+" "+this.state.facet(EE)}updateAttrs(){let e=wte(this,owe,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Sh)?"true":"false",class:"cm-content",style:`${lt.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),wte(this,TU,n);let r=this.observer.ignore(()=>{let i=Yee(this.contentDOM,this.contentAttrs,n),s=Yee(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let i of r.effects)if(i.is(u6.announce)){n&&(this.announceDOM.textContent=""),n=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(A4);let e=this.state.facet(u6.cspNonce);Gm.mount(this.root,this.styleModules.concat(Yrt).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.plugin!=e)&&this.pluginMap.set(e,n=this.plugins.find(r=>r.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return GN(this,e,nte(this,e,n,r))}moveByGroup(e,n){return GN(this,e,nte(this,e,n,r=>urt(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=r[n?r.length-1:0];return be.cursor(s.side(n,i)+e.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(e,n,r=!0){return crt(this,e,n,r)}moveVertically(e,n,r){return GN(this,e,drt(this,e,n,r))}domAtPos(e,n=1){return this.docView.domAtPos(e,n)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){this.readMeasured();let r=nj(this,e,n);return r&&r.pos}posAndSideAtCoords(e,n=!0){return this.readMeasured(),nj(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[Xu.find(s,e-i.from,-1,n)];return H7(r,o.dir==vr.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(nwe)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>eit)return Kbe(e.length);let n=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==n&&(s.fresh||Gbe(s.isolates,r=Qee(this,e))))return s.order;r||(r=Qee(this,e));let i=Lnt(e.text,n,r);return this.bidiCache.push(new Y7(e.from,e.to,n,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||lt.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Vbe(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){var r,i,s,o;return wE.of(new mb(typeof e=="number"?be.cursor(e):e,(r=n.y)!==null&&r!==void 0?r:"nearest",(i=n.x)!==null&&i!==void 0?i:"nearest",(s=n.yMargin)!==null&&s!==void 0?s:5,(o=n.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return wE.of(new mb(be.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return wi.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return wi.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=Gm.newName(),i=[EE.of(r),A4.of(oj(`.${r}`,e))];return n&&n.dark&&i.push(ij.of(!0)),i}static baseTheme(e){return S0.lowest(A4.of(oj("."+sj,e,Twe)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),i=r&&hi.get(r)||hi.get(e);return((n=i==null?void 0:i.root)===null||n===void 0?void 0:n.view)||null}};ht.styleModule=A4;ht.inputHandler=ewe;ht.clipboardInputFilter=CU;ht.clipboardOutputFilter=EU;ht.scrollHandler=iwe;ht.focusChangeEffect=twe;ht.perLineTextDirection=nwe;ht.exceptionSink=Jbe;ht.updateListener=Jz;ht.editable=Sh;ht.mouseSelectionStyle=Qbe;ht.dragMovesSelection=Xbe;ht.clickAddsSelectionRange=Zbe;ht.decorations=zI;ht.blockWrappers=awe;ht.outerDecorations=AU;ht.atomicRanges=I3;ht.bidiIsolatedRanges=lwe;ht.cursorScrollMargin=st.define({combine:t=>{let e=5,n=5;for(let r of t)typeof r=="number"?e=n=r:{x:e,y:n}=r;return{x:e,y:n}}});ht.scrollMargins=cwe;ht.darkTheme=ij;ht.cspNonce=st.define({combine:t=>t.length?t[0]:""});ht.contentAttributes=TU;ht.editorAttributes=owe;ht.lineWrapping=ht.contentAttributes.of({class:"cm-lineWrapping"});ht.announce=Ut.define();const eit=4096,bte={};class Y7{constructor(e,n,r,i,s,o){this.from=e,this.to=n,this.dir=r,this.isolates=i,this.fresh=s,this.order=o}static update(e,n){if(n.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:vr.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==i&&!n.touchesRange(o.from,o.to)&&r.push(new Y7(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function wte(t,e,n){for(let r=t.state.facet(e),i=r.length-1;i>=0;i--){let s=r[i],o=typeof s=="function"?s(t):s;o&&_U(o,n)}return n}const tit=lt.mac?"mac":lt.windows?"win":lt.linux?"linux":"key";function nit(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,s,o,a;for(let l=0;l<n.length-1;++l){const c=n[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))i=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?a=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return i&&(r="Alt-"+r),s&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function TE(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}const rit=S0.default(ht.domEventHandlers({keydown(t,e){return Iwe(Awe(e.state),t,e,"editor")}})),l2=st.define({enables:rit}),xte=new WeakMap;function Awe(t){let e=t.facet(l2),n=xte.get(e);return n||xte.set(e,n=oit(e.reduce((r,i)=>r.concat(i),[]))),n}function iit(t,e,n){return Iwe(Awe(t.state),e,t,n)}let Tp=null;const sit=4e3;function oit(t,e=tit){let n=Object.create(null),r=Object.create(null),i=(o,a)=>{let l=r[o];if(l==null)r[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,a,l,c,u)=>{var d,h;let f=n[o]||(n[o]=Object.create(null)),p=a.split(/ (?!$)/).map(v=>nit(v,e));for(let v=1;v<p.length;v++){let b=p.slice(0,v).join(" ");i(b,!0),f[b]||(f[b]={preventDefault:!0,stopPropagation:!1,run:[_=>{let S=Tp={view:_,prefix:b,scope:o};return setTimeout(()=>{Tp==S&&(Tp=null)},sit),!0}]})}let g=p.join(" ");i(g,!1);let y=f[g]||(f[g]={preventDefault:!1,stopPropagation:!1,run:((h=(d=f._any)===null||d===void 0?void 0:d.run)===null||h===void 0?void 0:h.slice())||[]});l&&y.run.push(l),c&&(y.preventDefault=!0),u&&(y.stopPropagation=!0)};for(let o of t){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let u=n[c]||(n[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:d}=o;for(let h in u)u[h].run.push(f=>d(f,aj))}let l=o[e]||o.key;if(l)for(let c of a)s(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return n}let aj=null;function Iwe(t,e,n,r){aj=e;let i=Pbe(e),s=oa(i,0),o=Vu(s)==i.length&&i!=" ",a="",l=!1,c=!1,u=!1;Tp&&Tp.view==n&&Tp.scope==r&&(a=Tp.prefix+" ",ywe.indexOf(e.keyCode)<0&&(c=!0,Tp=null));let d=new Set,h=y=>{if(y){for(let v of y.run)if(!d.has(v)&&(d.add(v),v(n)))return y.stopPropagation&&(u=!0),!0;y.preventDefault&&(y.stopPropagation&&(u=!0),c=!0)}return!1},f=t[r],p,g;return f&&(h(f[a+TE(i,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(lt.windows&&e.ctrlKey&&e.altKey)&&!(lt.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=ff[e.keyCode])&&p!=i?(h(f[a+TE(p,e,!0)])||e.shiftKey&&(g=tk[e.keyCode])!=i&&g!=p&&h(f[a+TE(g,e,!1)]))&&(l=!0):o&&e.shiftKey&&h(f[a+TE(i,e,!0)])&&(l=!0),!l&&h(f._any)&&(l=!0)),c&&(l=!0),l&&u&&e.stopPropagation(),aj=null,l}class c1{constructor(e,n,r,i,s){this.className=e,this.left=n,this.top=r,this.width=i,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let i=e.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let s=Rwe(e);return[new c1(n,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return ait(e,n,r)}}function Rwe(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==vr.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function _te(t,e,n,r){let i=t.coordsAtPos(e,n*2);if(!i)return r;let s=t.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,a=t.posAtCoords({x:s.left+1,y:o}),l=t.posAtCoords({x:s.right-1,y:o});return a==null||l==null?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}function ait(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),i=Math.min(n.to,t.viewport.to),s=t.textDirection==vr.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Rwe(t),c=o.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),d=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),h=a.right-(u?parseInt(u.paddingRight):0),f=tj(t,r,1),p=tj(t,i,-1),g=f.type==Os.Text?f:null,y=p.type==Os.Text?p:null;if(g&&(t.lineWrapping||f.widgetLineBreaks)&&(g=_te(t,r,1,g)),y&&(t.lineWrapping||p.widgetLineBreaks)&&(y=_te(t,i,-1,y)),g&&y&&g.from==y.from&&g.to==y.to)return b(_(n.from,n.to,g));{let k=g?_(n.from,null,g):S(f,!1),T=y?_(null,n.to,y):S(p,!0),E=[];return(g||f).to<(y||p).from-(g&&y?1:0)||f.widgetLineBreaks>1&&k.bottom+t.defaultLineHeight/2<T.top?E.push(v(d,k.bottom,h,T.top)):k.bottom<T.top&&t.elementAtHeight((k.bottom+T.top)/2).type==Os.Text&&(k.bottom=T.top=(k.bottom+T.top)/2),b(k).concat(E).concat(b(T))}function v(k,T,E,C){return new c1(e,k-l.left,T-l.top,Math.max(0,E-k),C-T)}function b({top:k,bottom:T,horizontal:E}){let C=[];for(let R=0;R<E.length;R+=2)C.push(v(E[R],k,E[R+1],T));return C}function _(k,T,E){let C=1e9,R=-1e9,M=[];function D(Z,re,G,ee,J){let oe=t.coordsAtPos(Z,Z==E.to?-2:2),B=t.coordsAtPos(G,G==E.from?2:-2);!oe||!B||(C=Math.min(oe.top,B.top,C),R=Math.max(oe.bottom,B.bottom,R),J==vr.LTR?M.push(s&&re?d:oe.left,s&&ee?h:B.right):M.push(!s&&ee?d:B.left,!s&&re?h:oe.right))}let P=k??E.from,z=T??E.to;for(let Z of t.visibleRanges)if(Z.to>P&&Z.from<z)for(let re=Math.max(Z.from,P),G=Math.min(Z.to,z);;){let ee=t.state.doc.lineAt(re);for(let J of t.bidiSpans(ee)){let oe=J.from+ee.from,B=J.to+ee.from;if(oe>=G)break;B>re&&D(Math.max(oe,re),k==null&&oe<=P,Math.min(B,G),T==null&&B>=z,J.dir)}if(re=ee.to+1,re>=G)break}return M.length==0&&D(P,k==null,z,T==null,t.textDirection),{top:C,bottom:R,horizontal:M}}function S(k,T){let E=a.top+(T?k.top:k.bottom);return{top:E,bottom:E,horizontal:[]}}}function lit(t,e){return t.constructor==e.constructor&&t.eq(e)}class cit{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(d6)!=e.state.facet(d6)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(d6);for(;n<r.length&&r[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:n}=this.view;(e!=this.scaleX||n!=this.scaleY)&&(this.scaleX=e,this.scaleY=n,this.dom.style.transform=`scale(${1/e}, ${1/n})`)}draw(e){if(e.length!=this.drawn.length||e.some((n,r)=>!lit(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let i of e)i.update&&n&&i.constructor&&this.drawn[r].constructor&&i.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(i.draw(),n);for(;n;){let i=n.nextSibling;n.remove(),n=i}this.drawn=e,lt.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const d6=st.define();function Mwe(t){return[wi.define(e=>new cit(e,t)),d6.of(t)]}const ox=st.define({combine(t){return Id(t,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function Nwe(t={}){return[ox.of(t),uit,dit,hit,rwe.of(!0)]}function Owe(t){return t.startState.facet(ox)!=t.state.facet(ox)}const uit=Mwe({above:!0,markers(t){let{state:e}=t,n=e.facet(ox),r=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty||n.drawRangeCursor&&!(s&<.ios&&n.iosSelectionHandles)){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=i.empty?i:be.cursor(i.head,i.assoc);for(let l of c1.forRange(t,o,a))r.push(l)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=Owe(t);return n&&Ste(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){Ste(e.state,t)},class:"cm-cursorLayer"});function Ste(t,e){e.style.animationDuration=t.facet(ox).cursorBlinkRate+"ms"}const dit=Mwe({above:!1,markers(t){let e=[],{main:n,ranges:r}=t.state.selection;for(let i of r)if(!i.empty)for(let s of c1.forRange(t,"cm-selectionBackground",i))e.push(s);if(lt.ios&&!n.empty&&t.state.facet(ox).iosSelectionHandles){for(let i of c1.forRange(t,"cm-selectionHandle cm-selectionHandle-start",be.cursor(n.from,1)))e.push(i);for(let i of c1.forRange(t,"cm-selectionHandle cm-selectionHandle-end",be.cursor(n.to,1)))e.push(i)}return e},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||Owe(t)},class:"cm-selectionLayer"}),hit=S0.highest(ht.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),Dwe=Ut.define({map(t,e){return t==null?null:e.mapPos(t)}}),R4=Vs.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(Dwe)?r.value:n,t)}}),fit=wi.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(R4);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(R4)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(R4),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(R4)!=t&&this.view.dispatch({effects:Dwe.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function pit(){return[R4,fit]}function kte(t,e,n,r,i){e.lastIndex=0;for(let s=t.iterRange(n,r),o=n,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=e.exec(s.value);)i(o+a.index,a)}function mit(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:i,to:s}of n)i=Math.max(t.state.doc.lineAt(i).from,i-e),s=Math.min(t.state.doc.lineAt(s).to,s+e),r.length&&r[r.length-1].to>=i?r[r.length-1].to=s:r.push({from:i,to:s});return r}class git{constructor(e){const{regexp:n,decoration:r,decorate:i,boundary:s,maxLength:o=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,i)this.addMatch=(a,l,c,u)=>i(u,c,c+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,c,u)=>{let d=r(a,l,c);d&&u(c,c+a[0].length,d)};else if(r)this.addMatch=(a,l,c,u)=>u(c,c+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let n=new hf,r=n.add.bind(n);for(let{from:i,to:s}of mit(e,this.maxLength))kte(e.state.doc,this.regexp,i,s,(o,a)=>this.addMatch(a,e,o,r));return n.finish()}updateDeco(e,n){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,a,l)=>{l>=e.view.viewport.from&&a<=e.view.viewport.to&&(r=Math.min(a,r),i=Math.max(l,i))}),e.viewportMoved||i-r>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,n.map(e.changes),r,i):n}updateRange(e,n,r,i){for(let s of e.visibleRanges){let o=Math.max(s.from,r),a=Math.min(s.to,i);if(a>=o){let l=e.state.doc.lineAt(o),c=l.to<a?e.state.doc.lineAt(a):l,u=Math.max(s.from,l.from),d=Math.min(s.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){u=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){d=a;break}}let h=[],f,p=(g,y,v)=>h.push(v.range(g,y));if(l==c)for(this.regexp.lastIndex=u-l.from;(f=this.regexp.exec(l.text))&&f.index<d-l.from;)this.addMatch(f,e,f.index+l.from,p);else kte(e.state.doc,this.regexp,u,d,(g,y)=>this.addMatch(y,e,g,p));n=n.update({filterFrom:u,filterTo:d,filter:(g,y)=>g<u||y>d,add:h})}}return n}}const lj=/x/.unicode!=null?"gu":"g",yit=new RegExp(`[\0-\b
|
||
--\u2028\u2029\uFEFF-]`,lj),vit={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let ZN=null;function bit(){var t;if(ZN==null&&typeof document<"u"&&document.body){let e=document.body.style;ZN=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return ZN||!1}const h6=st.define({combine(t){let e=Id(t,{render:null,specialChars:yit,addSpecialChars:null});return(e.replaceTabs=!bit())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,lj)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,lj)),e}});function wit(t={}){return[h6.of(t),xit()]}let Cte=null;function xit(){return Cte||(Cte=wi.fromClass(class{constructor(t){this.view=t,this.decorations=It.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(h6)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new git({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:i}=n.state,s=oa(e[0],0);if(s==9){let o=i.lineAt(r),a=n.state.tabSize,l=a2(o.text,a,r-o.from);return It.replace({widget:new Cit((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=It.replace({widget:new kit(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(h6);t.startState.facet(h6)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const _it="•";function Sit(t){return t>=32?_it:t==10?"":String.fromCharCode(9216+t)}class kit extends Rd{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=Sit(this.code),r=e.state.phrase("Control character")+" "+(vit[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,n);if(i)return i;let s=document.createElement("span");return s.textContent=n,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class Cit extends Rd{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function Eit(){return Ait}const Tit=It.line({class:"cm-activeLine"}),Ait=wi.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let i=t.lineBlockAt(r.head);i.from>e&&(n.push(Tit.range(i.from)),e=i.from)}return It.set(n)}},{decorations:t=>t.decorations}),cj=2e3;function Iit(t,e,n){let r=Math.min(e.line,n.line),i=Math.max(e.line,n.line),s=[];if(e.off>cj||n.off>cj||e.col<0||n.col<0){let o=Math.min(e.off,n.off),a=Math.max(e.off,n.off);for(let l=r;l<=i;l++){let c=t.doc.line(l);c.length<=a&&s.push(be.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,n.col),a=Math.max(e.col,n.col);for(let l=r;l<=i;l++){let c=t.doc.line(l),u=$z(c.text,o,t.tabSize,!0);if(u<0)s.push(be.cursor(c.to));else{let d=$z(c.text,a,t.tabSize);s.push(be.range(c.from+u,c.from+d))}}}return s}function Rit(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function Ete(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),i=n-r.from,s=i>cj?-1:i==r.length?Rit(t,e.clientX):a2(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:s,off:i}}function Mit(t,e){let n=Ete(t,e),r=t.state.selection;return n?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(n.line).from),o=i.state.doc.lineAt(s);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},r=r.map(i.changes)}},get(i,s,o){let a=Ete(t,i);if(!a)return r;let l=Iit(t.state,n,a);return l.length?o?be.create(l.concat(r.ranges)):be.create(l):r}}:null}function Nit(t){let e=n=>n.altKey&&n.button==0;return ht.mouseSelectionStyle.of((n,r)=>e(r)?Mit(n,r):null)}const Oit={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},Dit={style:"cursor: crosshair"};function Pit(t={}){let[e,n]=Oit[t.key||"Alt"],r=wi.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||n(i))},keyup(i){(i.keyCode==e||!n(i))&&this.set(!1)},mousemove(i){this.set(n(i))}}});return[r,ht.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?Dit:null})]}const AE="-10000px";class Pwe{constructor(e,n,r,i){this.facet=n,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(n),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,n){var r;let i=e.state.facet(this.facet),s=i.filter(l=>l);if(i===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=n?[]:null;for(let l=0;l<s.length;l++){let c=s[l],u=-1;if(c){for(let d=0;d<this.tooltips.length;d++){let h=this.tooltips[d];h&&h.create==c.create&&(u=d)}if(u<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let d=o[l]=this.tooltipViews[u];a&&(a[l]=n[u]),d.update&&d.update(e)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return n&&(a.forEach((l,c)=>n[c]=l),n.length=a.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function Lit(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const XN=st.define({combine:t=>{var e,n,r;return{position:lt.ios?"absolute":((e=t.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(i=>i.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||Lit}}}),Tte=new WeakMap,OU=wi.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(XN);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Pwe(t,DU,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(XN);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",n.dom.appendChild(i)}return n.dom.style.position=this.position,n.dom.style.top=AE,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(lt.safari){let o=s.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(t=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=IU(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(XN).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:s}=t,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:u}=c,d=t.pos[a],h=t.size[a];if(!d||l.clip!==!1&&(d.bottom<=Math.max(n.top,r.top)||d.top>=Math.min(n.bottom,r.bottom)||d.right<Math.max(n.left,r.left)-.1||d.left>Math.min(n.right,r.right)+.1)){u.style.top=AE;continue}let f=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=f?7:0,g=h.right-h.left,y=(e=Tte.get(c))!==null&&e!==void 0?e:h.bottom-h.top,v=c.offset||jit,b=this.view.textDirection==vr.LTR,_=h.width>r.right-r.left?b?r.left:r.right-h.width:b?Math.max(r.left,Math.min(d.left-(f?14:0)+v.x,r.right-g)):Math.min(Math.max(r.left,d.left-g+(f?14:0)-v.x),r.right-g),S=this.above[a];!l.strictSide&&(S?d.top-y-p-v.y<r.top:d.bottom+y+p+v.y>r.bottom)&&S==r.bottom-d.bottom>d.top-r.top&&(S=this.above[a]=!S);let k=(S?d.top-r.top:r.bottom-d.bottom)-p;if(k<y&&c.resize!==!1){if(k<this.view.defaultLineHeight){u.style.top=AE;continue}Tte.set(c,y),u.style.height=(y=k)/s+"px"}else u.style.height&&(u.style.height="");let T=S?d.top-y-p-v.y:d.bottom+p+v.y,E=_+g;if(c.overlap!==!0)for(let C of o)C.left<E&&C.right>_&&C.top<T+y&&C.bottom>T&&(T=S?C.top-y-2-p:C.bottom+p+2);if(this.position=="absolute"?(u.style.top=(T-t.parent.top)/s+"px",Ate(u,(_-t.parent.left)/i)):(u.style.top=T/s+"px",Ate(u,_/i)),f){let C=d.left+(b?v.x:-v.x)-(_+14-7);f.style.left=C/i+"px"}c.overlap!==!0&&o.push({left:_,top:T,right:E,bottom:T+y}),u.classList.toggle("cm-tooltip-above",S),u.classList.toggle("cm-tooltip-below",!S),c.positioned&&c.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=AE}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Ate(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const zit=ht.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),jit={x:0,y:0},DU=st.define({enables:[OU,zit]}),Z7=st.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class VI{static create(e){return new VI(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Pwe(e,Z7,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let i=r[e];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const Bit=DU.compute([Z7],t=>{let e=t.facet(Z7);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:VI.create,above:e[0].above,arrow:e.some(n=>n.arrow)}}),Lwe=st.define();class Fit{constructor(e,n,r,i,s,o){this.view=e,this.source=n,this.field=r,this.locked=i,this.setHover=s,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:n}=this,r=e.docView.tile.nearest(n.target);if(!r)return;let i,s=1;if(r.isWidget())i=r.posAtStart;else{if(i=e.posAtCoords(n),i==null)return;let o=e.coordsAtPos(i);if(!o||n.y<o.top||n.y>o.bottom||n.x<o.left-e.defaultCharacterWidth||n.x>o.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(i)).find(c=>c.from<=i&&c.to>=i),l=a&&a.dir==vr.RTL?-1:1;s=n.x<o.left?-l:l}this.activateHover(e,i,s)}activateHover(e,n,r,i){let s=this.source(e,n,r),o=a=>{if(a&&!(Array.isArray(a)&&!a.length)){let l=Array.isArray(a)?a:[a];i&&this.locked.set(l,i),e.dispatch({effects:this.setHover.of(l)})}};if(s&&"then"in s){let a=this.pending={pos:n};s.then(l=>{this.pending==a&&(this.pending=null,o(l))},l=>ua(e.state,l,"hover tooltip"))}else o(s)}get tooltip(){let e=this.view.plugin(OU),n=e?e.manager.tooltips.findIndex(r=>r.create==VI.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:s}=this;if(i.length&&!this.locked.has(i)&&s&&!Vit(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,a=(r=(n=i[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!$it(this.view,o,a,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length&&!this.locked.has(n)){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n);let{active:i}=this;i.length&&!this.locked.has(i)&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const IE=4;function Vit(t,e){let{left:n,right:r,top:i,bottom:s}=t.getBoundingClientRect(),o;if(o=t.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();i=Math.min(a.top,i),s=Math.max(a.bottom,s)}return e.clientX>=n-IE&&e.clientX<=r+IE&&e.clientY>=i-IE&&e.clientY<=s+IE}function $it(t,e,n,r,i,s){let o=t.scrollDOM.getBoundingClientRect(),a=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,a)<i)return!1;let l=t.posAtCoords({x:r,y:i},!1);return l>=e&&l<=n}function Hit(t,e={}){let n=Ut.define(),r=new WeakMap,i=Vs.define({create(){return[]},update(o,a){let l=r.get(o);if(o.length&&(e.hideOnChange&&(a.docChanged||a.selection)?o=[]:l&&l(a)?o=[]:e.hideOn&&(o=o.filter(c=>!e.hideOn(a,c)))),a.docChanged&&o.length){let c=[];for(let u of o){let d=a.changes.mapPos(u.pos,-1,Is.TrackDel);if(d!=null){let h=Object.assign(Object.create(null),u);h.pos=d,h.end!=null&&(h.end=a.changes.mapPos(h.end)),c.push(h)}}o=c}for(let c of a.effects)c.is(n)&&(o=c.value,l=void 0),(c.is(qit)&&!c.value||c.value==i)&&(o=[]);return o.length&&l&&r.set(o,l),o},provide:o=>Z7.from(o)});const s=wi.define(o=>new Fit(o,t,i,r,n,e.hoverTime||300));return{active:i,extension:[i,s,Lwe.of(s),Bit]}}function Uit(t,e,n,r={}){var i;let s=t.state.facet(Lwe).map(o=>t.plugin(o)).filter(o=>!!o);if(r.tooltip&&r.tooltip.active){let o=s.find(a=>a.field==r.tooltip.active);o&&(s=[o])}for(let o of s)o.activateHover(t,e,n,(i=r.until)!==null&&i!==void 0?i:()=>!1)}function zwe(t,e){let n=t.plugin(OU);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const qit=Ut.define(),Ite=st.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function PU(t,e){let n=t.plugin(jwe),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const jwe=wi.fromClass(class{constructor(t){this.input=t.state.facet(sk),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(Ite);this.top=new RE(t,!0,e.topContainer),this.bottom=new RE(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(Ite);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new RE(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new RE(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(sk);if(n!=this.input){let r=n.filter(l=>l),i=[],s=[],o=[],a=[];for(let l of r){let c=this.specs.indexOf(l),u;c<0?(u=l(t.view),a.push(u)):(u=this.panels[c],u.update&&u.update(t)),i.push(u),(u.top?s:o).push(u)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>ht.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class RE{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=Rte(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=Rte(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Rte(t){let e=t.nextSibling;return t.remove(),e}const sk=st.define({enables:jwe});function Wit(t,e){let n,r=new Promise(o=>n=o),i=o=>Git(o,e,n);t.state.field(QN,!1)?t.dispatch({effects:Bwe.of(i)}):t.dispatch({effects:Ut.appendConfig.of(QN.init(()=>[i]))});let s=Fwe.of(i);return{close:s,result:r.then(o=>((t.win.queueMicrotask||(l=>t.win.setTimeout(l,10)))(()=>{t.state.field(QN).indexOf(i)>-1&&t.dispatch({effects:s})}),o))}}const QN=Vs.define({create(){return[]},update(t,e){for(let n of e.effects)n.is(Bwe)?t=[n.value].concat(t):n.is(Fwe)&&(t=t.filter(r=>r!=n.value));return t},provide:t=>sk.computeN([t],e=>e.field(t))}),Bwe=Ut.define(),Fwe=Ut.define();function Git(t,e,n){let r=e.content?e.content(t,()=>o(null)):null;if(!r){if(r=ar("form"),e.input){let a=ar("input",e.input);/^(text|password|number|email|tel|url)$/.test(a.type)&&a.classList.add("cm-textfield"),a.name||(a.name="input"),r.appendChild(ar("label",(e.label||"")+": ",a))}else r.appendChild(document.createTextNode(e.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(ar("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let i=r.nodeName=="FORM"?[r]:r.querySelectorAll("form");for(let a=0;a<i.length;a++){let l=i[a];l.addEventListener("keydown",c=>{c.keyCode==27?(c.preventDefault(),o(null)):c.keyCode==13&&(c.preventDefault(),o(l))}),l.addEventListener("submit",c=>{c.preventDefault(),o(l)})}let s=ar("div",r,ar("button",{onclick:()=>o(null),"aria-label":t.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(s.className=e.class),s.classList.add("cm-dialog");function o(a){s.contains(s.ownerDocument.activeElement)&&t.focus(),n(a)}return{dom:s,top:e.top,mount:()=>{if(e.focus){let a;typeof e.focus=="string"?a=r.querySelector(e.focus):a=r.querySelector("input")||r.querySelector("button"),a&&"select"in a?a.select():a&&"focus"in a&&a.focus()}}}}class mf extends Wm{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}mf.prototype.elementClass="";mf.prototype.toDOM=void 0;mf.prototype.mapMode=Is.TrackBefore;mf.prototype.startSide=mf.prototype.endSide=-1;mf.prototype.point=!0;const f6=st.define(),Kit=st.define(),Yit={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>bn.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},B_=st.define();function Zit(t){return[Vwe(),B_.of({...Yit,...t})]}const Mte=st.define({combine:t=>t.some(e=>e)});function Vwe(t){return[Xit]}const Xit=wi.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(B_).map(e=>new Ote(t,e)),this.fixed=!t.state.facet(Mte);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Mte)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=bn.iter(this.view.state.facet(f6),this.view.viewport.from),r=[],i=this.gutters.map(s=>new Qit(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let a of s.type)if(a.type==Os.Text&&o){uj(n,r,a.from);for(let l of i)l.line(this.view,a,r);o=!1}else if(a.widget)for(let l of i)l.widget(this.view,a)}else if(s.type==Os.Text){uj(n,r,s.from);for(let o of i)o.line(this.view,s,r)}else if(s.widget)for(let o of i)o.widget(this.view,s);for(let s of i)s.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(B_),n=t.state.facet(B_),r=t.docChanged||t.heightChanged||t.viewportChanged||!bn.eq(t.startState.facet(f6),t.state.facet(f6),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let i of this.gutters)i.update(t)&&(r=!0);else{r=!0;let i=[];for(let s of n){let o=e.indexOf(s);o<0?i.push(new Ote(this.view,s)):(this.gutters[o].update(t),i.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.dom);this.gutters=i}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>ht.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,i=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==vr.LTR?{left:r,right:i}:{right:r,left:i}})});function Nte(t){return Array.isArray(t)?t:[t]}function uj(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class Qit{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=bn.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:i}=this,s=(n.top-this.height)/e.scaleY,o=n.height/e.scaleY;if(this.i==i.elements.length){let a=new $we(e,o,s,r);i.elements.push(a),i.dom.appendChild(a.dom)}else i.elements[this.i].update(e,o,s,r);this.height=n.bottom,this.i++}line(e,n,r){let i=[];uj(this.cursor,i,n.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(e,n,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,n,i)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),i=r?[r]:null;for(let s of e.state.facet(Kit)){let o=s(e,n.widget,n);o&&(i||(i=[])).push(o)}i&&this.addElement(e,n,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class Ote{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,i=>{let s=i.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let l=s.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=i.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);n.domEventHandlers[r](e,a,i)&&i.preventDefault()});this.markers=Nte(n.markers(e)),n.initialSpacer&&(this.spacer=new $we(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=Nte(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let r=e.view.viewport;return!bn.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class $we{constructor(e,n,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,i)}update(e,n,r,i){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),Jit(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,n){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let a=o,l=s<n.length?n[s++]:null,c=!1;if(l){let u=l.elementClass;u&&(r+=" "+u);for(let d=o;d<this.markers.length;d++)if(this.markers[d].compare(l)){a=d,c=!0;break}}else a=this.markers.length;for(;o<a;){let u=this.markers[o++];if(u.toDOM){u.destroy(i);let d=i.nextSibling;i.remove(),i=d}}if(!l)break;l.toDOM&&(c?i=i.nextSibling:this.dom.insertBefore(l.toDOM(e),i)),c&&o++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function Jit(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].compare(e[n]))return!1;return!0}const est=st.define(),tst=st.define(),Uv=st.define({combine(t){return Id(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,n){let r=Object.assign({},e);for(let i in n){let s=r[i],o=n[i];r[i]=s?(a,l,c)=>s(a,l,c)||o(a,l,c):o}return r}})}});class JN extends mf{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function eO(t,e){return t.state.facet(Uv).formatNumber(e,t.state)}const nst=B_.compute([Uv],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(est)},lineMarker(e,n,r){return r.some(i=>i.toDOM)?null:new JN(eO(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let i of e.state.facet(tst)){let s=i(e,n,r);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(Uv)!=e.state.facet(Uv),initialSpacer(e){return new JN(eO(e,Dte(e.state.doc.lines)))},updateSpacer(e,n){let r=eO(n.view,Dte(n.view.state.doc.lines));return r==e.number?e:new JN(r)},domEventHandlers:t.facet(Uv).domEventHandlers,side:"before"}));function rst(t={}){return[Uv.of(t),Vwe(),nst]}function Dte(t){let e=9;for(;e<t;)e=e*10+9;return e}const ist=new class extends mf{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},sst=f6.compute(["selection"],t=>{let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.head).from;i>n&&(n=i,e.push(ist.range(i)))}return bn.of(e)});function ost(){return sst}let ast=0;class Il{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=ast++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof Il&&(n=e),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let i=new Il(r,[],null,[]);if(i.set.push(i),n)for(let s of n.set)i.set.push(s);return i}static defineModifier(e){let n=new X7(e);return r=>r.modified.indexOf(n)>-1?r:X7.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}}let lst=0;class X7{constructor(e){this.name=e,this.instances=[],this.id=lst++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&cst(n,a.modified));if(r)return r;let i=[],s=new Il(e.name,i,e,n);for(let a of n)a.instances.push(s);let o=ust(n);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push(X7.get(a,l));return s}}function cst(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function ust(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function dst(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let s=[],o=2,a=i;for(let d=0;;){if(a=="..."&&d>0&&d+3==i.length){o=1;break}let h=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!h)throw new RangeError("Invalid path: "+i);if(s.push(h[0]=="*"?"":h[0][0]=='"'?JSON.parse(h[0]):h[0]),d+=h[0].length,d==i.length)break;let f=i[d++];if(d==i.length&&f=="!"){o=0;break}if(f!="/")throw new RangeError("Invalid path: "+i);a=i.slice(d)}let l=s.length-1,c=s[l];if(!c)throw new RangeError("Invalid path: "+i);let u=new ok(r,o,l>0?s.slice(0,l):null);e[c]=u.sort(e[c])}}return Hwe.add(e)}const Hwe=new hn({combine(t,e){let n,r,i;for(;t||e;){if(!t||e&&t.depth>=e.depth?(i=e,e=e.next):(i=t,t=t.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let s=new ok(i.tags,i.mode,i.context);n?n.next=s:r=s,n=s}return r}});class ok{constructor(e,n,r,i){this.tags=e,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}ok.empty=new ok([],2,null);function Uwe(t,e){let n=Object.create(null);for(let s of t)if(!Array.isArray(s.tag))n[s.tag.id]=s.class;else for(let o of s.tag)n[o.id]=s.class;let{scope:r,all:i=null}=e||{};return{style:s=>{let o=i;for(let a of s)for(let l of a.set){let c=n[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function hst(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function fst(t,e,n,r=0,i=t.length){let s=new pst(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class pst{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,i,s){let{type:o,from:a,to:l}=e;if(a>=r||l<=n)return;o.isTop&&(s=this.highlighters.filter(f=>!f.scope||f.scope(o)));let c=i,u=mst(e)||ok.empty,d=hst(s,u.tags);if(d&&(c&&(c+=" "),c+=d,u.mode==1&&(i+=(i?" ":"")+d)),this.startSpan(Math.max(n,a),c),u.opaque)return;let h=e.tree&&e.tree.prop(hn.mounted);if(h&&h.overlay){let f=e.node.enter(h.overlay[0].from+a,1),p=this.highlighters.filter(y=>!y.scope||y.scope(h.tree.type)),g=e.firstChild();for(let y=0,v=a;;y++){let b=y<h.overlay.length?h.overlay[y]:null,_=b?b.from+a:l,S=Math.max(n,v),k=Math.min(r,_);if(S<k&&g)for(;e.from<k&&(this.highlightRange(e,S,k,i,s),this.startSpan(Math.min(k,e.to),c),!(e.to>=_||!e.nextSibling())););if(!b||_>r)break;v=b.to+a,v>n&&(this.highlightRange(f.cursor(),Math.max(n,b.from+a),Math.min(r,v),"",p),this.startSpan(Math.min(r,v),c))}g&&e.parent()}else if(e.firstChild()){h&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,s),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function mst(t){let e=t.type.prop(Hwe);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Je=Il.define,ME=Je(),fp=Je(),Pte=Je(fp),Lte=Je(fp),pp=Je(),NE=Je(pp),tO=Je(pp),_u=Je(),W0=Je(_u),gu=Je(),yu=Je(),dj=Je(),Q2=Je(dj),OE=Je(),ve={comment:ME,lineComment:Je(ME),blockComment:Je(ME),docComment:Je(ME),name:fp,variableName:Je(fp),typeName:Pte,tagName:Je(Pte),propertyName:Lte,attributeName:Je(Lte),className:Je(fp),labelName:Je(fp),namespace:Je(fp),macroName:Je(fp),literal:pp,string:NE,docString:Je(NE),character:Je(NE),attributeValue:Je(NE),number:tO,integer:Je(tO),float:Je(tO),bool:Je(pp),regexp:Je(pp),escape:Je(pp),color:Je(pp),url:Je(pp),keyword:gu,self:Je(gu),null:Je(gu),atom:Je(gu),unit:Je(gu),modifier:Je(gu),operatorKeyword:Je(gu),controlKeyword:Je(gu),definitionKeyword:Je(gu),moduleKeyword:Je(gu),operator:yu,derefOperator:Je(yu),arithmeticOperator:Je(yu),logicOperator:Je(yu),bitwiseOperator:Je(yu),compareOperator:Je(yu),updateOperator:Je(yu),definitionOperator:Je(yu),typeOperator:Je(yu),controlOperator:Je(yu),punctuation:dj,separator:Je(dj),bracket:Q2,angleBracket:Je(Q2),squareBracket:Je(Q2),paren:Je(Q2),brace:Je(Q2),content:_u,heading:W0,heading1:Je(W0),heading2:Je(W0),heading3:Je(W0),heading4:Je(W0),heading5:Je(W0),heading6:Je(W0),contentSeparator:Je(_u),list:Je(_u),quote:Je(_u),emphasis:Je(_u),strong:Je(_u),link:Je(_u),monospace:Je(_u),strikethrough:Je(_u),inserted:Je(),deleted:Je(),changed:Je(),invalid:Je(),meta:OE,documentMeta:Je(OE),annotation:Je(OE),processingInstruction:Je(OE),definition:Il.defineModifier("definition"),constant:Il.defineModifier("constant"),function:Il.defineModifier("function"),standard:Il.defineModifier("standard"),local:Il.defineModifier("local"),special:Il.defineModifier("special")};for(let t in ve){let e=ve[t];e instanceof Il&&(e.name=t)}Uwe([{tag:ve.link,class:"tok-link"},{tag:ve.heading,class:"tok-heading"},{tag:ve.emphasis,class:"tok-emphasis"},{tag:ve.strong,class:"tok-strong"},{tag:ve.keyword,class:"tok-keyword"},{tag:ve.atom,class:"tok-atom"},{tag:ve.bool,class:"tok-bool"},{tag:ve.url,class:"tok-url"},{tag:ve.labelName,class:"tok-labelName"},{tag:ve.inserted,class:"tok-inserted"},{tag:ve.deleted,class:"tok-deleted"},{tag:ve.literal,class:"tok-literal"},{tag:ve.string,class:"tok-string"},{tag:ve.number,class:"tok-number"},{tag:[ve.regexp,ve.escape,ve.special(ve.string)],class:"tok-string2"},{tag:ve.variableName,class:"tok-variableName"},{tag:ve.local(ve.variableName),class:"tok-variableName tok-local"},{tag:ve.definition(ve.variableName),class:"tok-variableName tok-definition"},{tag:ve.special(ve.variableName),class:"tok-variableName2"},{tag:ve.definition(ve.propertyName),class:"tok-propertyName tok-definition"},{tag:ve.typeName,class:"tok-typeName"},{tag:ve.namespace,class:"tok-namespace"},{tag:ve.className,class:"tok-className"},{tag:ve.macroName,class:"tok-macroName"},{tag:ve.propertyName,class:"tok-propertyName"},{tag:ve.operator,class:"tok-operator"},{tag:ve.comment,class:"tok-comment"},{tag:ve.meta,class:"tok-meta"},{tag:ve.invalid,class:"tok-invalid"},{tag:ve.punctuation,class:"tok-punctuation"}]);var nO;const Ag=new hn;function qwe(t){return st.define({combine:t?e=>e.concat(t):void 0})}const gst=new hn;class Fl{constructor(e,n,r=[],i=""){this.data=e,this.name=i,Vr.prototype.hasOwnProperty("tree")||Object.defineProperty(Vr.prototype,"tree",{get(){return zs(this)}}),this.parser=n,this.extension=[Ym.of(this),Vr.languageData.of((s,o,a)=>{let l=zte(s,o,a),c=l.type.prop(Ag);if(!c)return[];let u=s.facet(c),d=l.type.prop(gst);if(d){let h=l.resolve(o-l.from,a);for(let f of d)if(f.test(h,s)){let p=s.facet(f.facet);return f.type=="replace"?p:p.concat(u)}}return u})].concat(r)}isActiveAt(e,n,r=-1){return zte(e,n,r).type.prop(Ag)==this.data}findRegions(e){let n=e.facet(Ym);if((n==null?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(Ag)==this.data){r.push({from:o,to:o+s.length});return}let a=s.prop(hn.mounted);if(a){if(a.tree.prop(Ag)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+o,to:l.to+o});else r.push({from:o,to:o+s.length});return}else if(a.overlay){let l=r.length;if(i(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<s.children.length;l++){let c=s.children[l];c instanceof yr&&i(c,s.positions[l]+o)}};return i(zs(e),0),r}get allowsNesting(){return!0}}Fl.setState=Ut.define();function zte(t,e,n){let r=t.facet(Ym),i=zs(t).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,n,pr.ExcludeBuffers|pr.EnterBracketed))s.type.isTop&&(i=s);return i}class hj extends Fl{constructor(e,n,r){super(e,n,[],r),this.parser=n}static define(e){let n=qwe(e.languageData);return new hj(n,e.parser.configure({props:[Ag.add(r=>r.isTop?n:void 0)]}),e.name)}configure(e,n){return new hj(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function zs(t){let e=t.field(Fl.state,!1);return e?e.tree:yr.empty}class yst{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e<r||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let J2=null,fj=class pj{constructor(e,n,r=[],i,s,o,a,l){this.parser=e,this.state=n,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new pj(e,n,[],yr.empty,0,r,[],null)}startParse(){return this.parser.startParse(new yst(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=yr.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(Vh.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(Vh.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=J2;J2=this;try{return e()}finally{J2=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=jte(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,u,d,h)=>l.push({fromA:c,toA:u,fromB:d,toB:h})),r=Vh.applyChanges(r,l),i=yr.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),d=e.mapPos(c.to,-1);u<d&&a.push({from:u,to:d})}}}return new pj(this.parser,n,r,i,s,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:i,to:s}=this.skipped[r];i<e.to&&s>e.from&&(this.fragments=jte(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends pbe{createParse(n,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let l=J2;if(l){for(let c of i)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new yr(ol.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return J2}};function jte(t,e,n){return Vh.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class ax{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new ax(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=fj.create(e.facet(Ym).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new ax(r)}}Fl.state=Vs.define({create:ax.init,update(t,e){for(let n of e.effects)if(n.is(Fl.setState))return n.value;return e.startState.facet(Ym)!=e.state.facet(Ym)?ax.init(e.state):t.apply(e)}});let Wwe=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Wwe=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const rO=typeof navigator<"u"&&(!((nO=navigator.scheduling)===null||nO===void 0)&&nO.isInputPending)?()=>navigator.scheduling.isInputPending():null,vst=wi.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(Fl.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(Fl.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=Wwe(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:i}}=this.view,s=r.field(Fl.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!rO?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<i&&r.doc.length>i+1e3,l=s.context.work(()=>rO&&rO()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Fl.setState.of(new ax(s.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>ua(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Ym=st.define({combine(t){return t.length?t[0]:null},enables:t=>[Fl.state,vst,ht.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class bst{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}class le{constructor(e,n,r,i,s,o=void 0){this.name=e,this.alias=n,this.extensions=r,this.filename=i,this.loadFunc=s,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:n,support:r}=e;if(!n){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");n=()=>Promise.resolve(r)}return new le(e.name,(e.alias||[]).concat(e.name).map(i=>i.toLowerCase()),e.extensions||[],e.filename,n,r)}static matchFilename(e,n){for(let i of e)if(i.filename&&i.filename.test(n))return i;let r=/\.([^.]+)$/.exec(n);if(r){for(let i of e)if(i.extensions.indexOf(r[1])>-1)return i}return null}static matchLanguageName(e,n,r=!0){n=n.toLowerCase();for(let i of e)if(i.alias.some(s=>s==n))return i;if(r)for(let i of e)for(let s of i.alias){let o=n.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(n[o-1])&&!/\w/.test(n[o+s.length])))return i}return null}}const wst=st.define(),$I=st.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Q1(t){let e=t.facet($I);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function ak(t,e){let n="",r=t.tabSize,i=t.facet($I)[0];if(i==" "){for(;e>=r;)n+=" ",e-=r;i=" "}for(let s=0;s<e;s++)n+=i;return n}function LU(t,e){t instanceof Vr&&(t=new HI(t));for(let r of t.state.facet(wst)){let i=r(t,e);if(i!==void 0)return i}let n=zs(t.state);return n.length>=e?xst(t,n,e):null}class HI{constructor(e,n={}){this.state=e,this.options=n,this.unit=Q1(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==e?{text:"",from:e}:(n<0?i<e:i<=e)?{text:r.text.slice(i-r.from),from:i}:{text:r.text.slice(0,i-r.from),from:r.from}:r}textAfterPos(e,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(e,n);return r.slice(e-i,Math.min(r.length,e+100-i))}column(e,n=1){let{text:r,from:i}=this.lineAt(e,n),s=this.countColumn(r,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,n=e.length){return a2(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:i}=this.lineAt(e,n),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Gwe=new hn;function xst(t,e,n){let r=e.resolveStack(n),i=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let s=[];for(let o=i;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return Kwe(r,t,n)}function Kwe(t,e,n){for(let r=t;r;r=r.next){let i=Sst(r.node);if(i)return i(zU.create(e,n,r))}return 0}function _st(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function Sst(t){let e=t.type.prop(Gwe);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(hn.closedBy))){let i=t.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>Ywe(o,!0,1,void 0,s&&!_st(o)?i.from:void 0)}return t.parent==null?kst:null}function kst(){return 0}class zU extends HI{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new zU(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(Cst(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return Kwe(this.context.next,this.base,this.pos)}}function Cst(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function Est(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let i=t.options.simulateBreak,s=t.state.doc.lineAt(n.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let a=n.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let c=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+c}}a=l.to}}function ERt({closing:t,align:e=!0,units:n=1}){return r=>Ywe(r,e,n,t)}function Ywe(t,e,n,r,i){let s=t.textAfter,o=s.match(/^\s*/)[0].length,a=r&&s.slice(o,o+r.length)==r||i==t.pos+o,l=e?Est(t):null;return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*n)}const TRt=t=>t.baseIndent;function ARt({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const Tst=200;function Ast(){return Vr.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,i=n.lineAt(r);if(r>i.from+Tst)return t;let s=n.sliceString(i.from,r);if(!e.some(c=>c.test(s)))return t;let{state:o}=t,a=-1,l=[];for(let{head:c}of o.selection.ranges){let u=o.doc.lineAt(c);if(u.from==a)continue;a=u.from;let d=LU(o,u.from);if(d==null)continue;let h=/^\s*/.exec(u.text)[0],f=ak(o,d);h!=f&&l.push({from:u.from,to:u.from+h.length,insert:f})}return l.length?[t,{changes:l,sequential:!0}]:t})}const Ist=st.define(),Rst=new hn;function IRt(t){let e=t.firstChild,n=t.lastChild;return e&&e.to<n.from?{from:e.to,to:n.type.isError?t.to:n.from}:null}function Mst(t,e,n){let r=zs(t);if(r.length<n)return null;let i=r.resolveStack(n,1),s=null;for(let o=i;o;o=o.next){let a=o.node;if(a.to<=n||a.from>n)continue;if(s&&a.from<e)break;let l=a.type.prop(Rst);if(l&&(a.to<r.length-50||r.length==t.doc.length||!Nst(a))){let c=l(a,t);c&&c.from<=n&&c.from>=e&&c.to>n&&(s=c)}}return s}function Nst(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function Q7(t,e,n){for(let r of t.facet(Ist)){let i=r(t,e,n);if(i)return i}return Mst(t,e,n)}function Zwe(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const UI=Ut.define({map:Zwe}),R3=Ut.define({map:Zwe});function Xwe(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const J1=Vs.define({create(){return It.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=Bte(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(UI)&&!Ost(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(exe),i=r?It.replace({widget:new Fst(r(e.state,n.value))}):Fte;t=t.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(R3)&&(t=t.update({filter:(r,i)=>n.value.from!=r||n.value.to!=i,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=Bte(t,e.selection.main.head)),t},provide:t=>ht.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,i)=>{n.push(r,i)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n<t.length;){let r=t[n++],i=t[n++];if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(Fte.range(r,i))}return It.set(e,!0)}});function Bte(t,e,n=e){let r=!1;return t.between(e,n,(i,s)=>{i<n&&s>e&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(i,s)=>i>=n||s<=e}):t}function J7(t,e,n){var r;let i=null;return(r=t.field(J1,!1))===null||r===void 0||r.between(e,n,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function Ost(t,e,n){let r=!1;return t.between(e,e,(i,s)=>{i==e&&s==n&&(r=!0)}),r}function Qwe(t,e){return t.field(J1,!1)?e:e.concat(Ut.appendConfig.of(txe()))}const Dst=t=>{for(let e of Xwe(t)){let n=Q7(t.state,e.from,e.to);if(n)return t.dispatch({effects:Qwe(t.state,[UI.of(n),Jwe(t,n)])}),!0}return!1},Pst=t=>{if(!t.state.field(J1,!1))return!1;let e=[];for(let n of Xwe(t)){let r=J7(t.state,n.from,n.to);r&&e.push(R3.of(r),Jwe(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function Jwe(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,i=t.state.doc.lineAt(e.to).number;return ht.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${i}.`)}const Lst=t=>{let{state:e}=t,n=[];for(let r=0;r<e.doc.length;){let i=t.lineBlockAt(r),s=Q7(e,i.from,i.to);s&&n.push(UI.of(s)),r=(s?t.lineBlockAt(s.to):i).to+1}return n.length&&t.dispatch({effects:Qwe(t.state,n)}),!!n.length},zst=t=>{let e=t.state.field(J1,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,i)=>{n.push(R3.of({from:r,to:i}))}),t.dispatch({effects:n}),!0},jst=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Dst},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Pst},{key:"Ctrl-Alt-[",run:Lst},{key:"Ctrl-Alt-]",run:zst}],Bst={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},exe=st.define({combine(t){return Id(t,Bst)}});function txe(t){return[J1,Hst]}function nxe(t,e){let{state:n}=t,r=n.facet(exe),i=o=>{let a=t.lineBlockAt(t.posAtDOM(o.target)),l=J7(t.state,a.from,a.to);l&&t.dispatch({effects:R3.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,i,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const Fte=It.replace({widget:new class extends Rd{toDOM(t){return nxe(t,null)}}});class Fst extends Rd{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return nxe(e,this.value)}}const Vst={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class iO extends mf{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function $st(t={}){let e={...Vst,...t},n=new iO(e,!0),r=new iO(e,!1),i=wi.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Ym)!=o.state.facet(Ym)||o.startState.field(J1,!1)!=o.state.field(J1,!1)||zs(o.startState)!=zs(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new hf;for(let l of o.viewportLineBlocks){let c=J7(o.state,l.from,l.to)?r:Q7(o.state,l.from,l.to)?n:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:s}=e;return[i,Zit({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(i))===null||a===void 0?void 0:a.markers)||bn.empty},initialSpacer(){return new iO(e,!1)},domEventHandlers:{...s,click:(o,a,l)=>{if(s.click&&s.click(o,a,l))return!0;let c=J7(o.state,a.from,a.to);if(c)return o.dispatch({effects:R3.of(c)}),!0;let u=Q7(o.state,a.from,a.to);return u?(o.dispatch({effects:UI.of(u)}),!0):!1}}}),txe()]}const Hst=ht.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class M3{constructor(e,n){this.specs=e;let r;function i(a){let l=Gm.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const s=typeof n.all=="string"?n.all:n.all?i(n.all):void 0,o=n.scope;this.scope=o instanceof Fl?a=>a.prop(Ag)==o.data:o?a=>a==o:void 0,this.style=Uwe(e.map(a=>({tag:a.tag,class:a.class||i(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=r?new Gm(r):null,this.themeType=n.themeType}static define(e,n){return new M3(e,n||{})}}const mj=st.define(),rxe=st.define({combine(t){return t.length?[t[0]]:null}});function sO(t){let e=t.facet(mj);return e.length?e:t.facet(rxe)}function ixe(t,e){let n=[qst],r;return t instanceof M3&&(t.module&&n.push(ht.styleModule.of(t.module)),r=t.themeType),e!=null&&e.fallback?n.push(rxe.of(t)):r?n.push(mj.computeN([ht.darkTheme],i=>i.facet(ht.darkTheme)==(r=="dark")?[t]:[])):n.push(mj.of(t)),n}class Ust{constructor(e){this.markCache=Object.create(null),this.tree=zs(e.state),this.decorations=this.buildDeco(e,sO(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=zs(e.state),r=sO(e.state),i=r!=sO(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);n.length<s.to&&!i&&n.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(n!=this.tree||e.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,n){if(!n||!this.tree.length)return It.none;let r=new hf;for(let{from:i,to:s}of e.visibleRanges)fst(this.tree,n,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=It.mark({class:l})))},i,s);return r.finish()}}const qst=S0.high(wi.fromClass(Ust,{decorations:t=>t.decorations})),Wst=M3.define([{tag:ve.meta,color:"#404740"},{tag:ve.link,textDecoration:"underline"},{tag:ve.heading,textDecoration:"underline",fontWeight:"bold"},{tag:ve.emphasis,fontStyle:"italic"},{tag:ve.strong,fontWeight:"bold"},{tag:ve.strikethrough,textDecoration:"line-through"},{tag:ve.keyword,color:"#708"},{tag:[ve.atom,ve.bool,ve.url,ve.contentSeparator,ve.labelName],color:"#219"},{tag:[ve.literal,ve.inserted],color:"#164"},{tag:[ve.string,ve.deleted],color:"#a11"},{tag:[ve.regexp,ve.escape,ve.special(ve.string)],color:"#e40"},{tag:ve.definition(ve.variableName),color:"#00f"},{tag:ve.local(ve.variableName),color:"#30a"},{tag:[ve.typeName,ve.namespace],color:"#085"},{tag:ve.className,color:"#167"},{tag:[ve.special(ve.variableName),ve.macroName],color:"#256"},{tag:ve.definition(ve.propertyName),color:"#00c"},{tag:ve.comment,color:"#940"},{tag:ve.invalid,color:"#f00"}]),Gst=ht.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),sxe=1e4,oxe="()[]{}",axe=st.define({combine(t){return Id(t,{afterCursor:!0,brackets:oxe,maxScanDistance:sxe,renderMatch:Zst})}}),Kst=It.mark({class:"cm-matchingBracket"}),Yst=It.mark({class:"cm-nonmatchingBracket"});function Zst(t){let e=[],n=t.matched?Kst:Yst;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}function Vte(t){let e=[],n=t.facet(axe);for(let r of t.selection.ranges){if(!r.empty)continue;let i=Qu(t,r.head,-1,n)||r.head>0&&Qu(t,r.head-1,1,n)||n.afterCursor&&(Qu(t,r.head,1,n)||r.head<t.doc.length&&Qu(t,r.head+1,-1,n));i&&(e=e.concat(n.renderMatch(i,t)))}return It.set(e,!0)}const Xst=wi.fromClass(class{constructor(t){this.paused=!1,this.decorations=Vte(t.state)}update(t){(t.docChanged||t.selectionSet||this.paused)&&(t.view.composing?(this.decorations=this.decorations.map(t.changes),this.paused=!0):(this.decorations=Vte(t.state),this.paused=!1))}},{decorations:t=>t.decorations}),Qst=[Xst,Gst];function Jst(t={}){return[axe.of(t),Qst]}const eot=new hn;function gj(t,e,n){let r=t.prop(e<0?hn.openedBy:hn.closedBy);if(r)return r;if(t.name.length==1){let i=n.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[n[i+e]]}return null}function yj(t){let e=t.type.prop(eot);return e?e(t.node):t}function Qu(t,e,n,r={}){let i=r.maxScanDistance||sxe,s=r.brackets||oxe,o=zs(t),a=o.resolveInner(e,n);for(let l=a;l;l=l.parent){let c=gj(l.type,n,s);if(c&&l.from<l.to){let u=yj(l);if(u&&(n>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return tot(t,e,n,l,u,c,s)}}return not(t,e,n,o,a.type,i,s)}function tot(t,e,n,r,i,s,o){let a=r.parent,l={from:i.from,to:i.to},c=0,u=a==null?void 0:a.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(c==0&&s.indexOf(u.type.name)>-1&&u.from<u.to){let d=yj(u);return{start:l,end:d?{from:d.from,to:d.to}:void 0,matched:!0}}else if(gj(u.type,n,o))c++;else if(gj(u.type,-n,o)){if(c==0){let d=yj(u);return{start:l,end:d&&d.from<d.to?{from:d.from,to:d.to}:void 0,matched:!1}}c--}}while(n<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}function not(t,e,n,r,i,s,o){if(n<0?!e:e==t.doc.length)return null;let a=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?e-1:e,to:n>0?e+1:e},u=t.doc.iterRange(e,n>0?t.doc.length:0),d=0;for(let h=0;!u.next().done&&h<=s;){let f=u.value;n<0&&(h+=f.length);let p=e+h*n;for(let g=n>0?0:f.length-1,y=n>0?f.length:-1;g!=y;g+=n){let v=o.indexOf(f[g]);if(!(v<0||r.resolveInner(p+g,1).type!=i))if(v%2==0==n>0)d++;else{if(d==1)return{start:c,end:{from:p+g,to:p+g+1},matched:v>>1==l>>1};d--}}n>0&&(h+=f.length)}return u.done?{start:c,matched:!1}:null}function $te(t,e,n,r=0,i=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let s=i;for(let o=r;o<e;o++)t.charCodeAt(o)==9?s+=n-s%n:s++;return s}class lxe{constructor(e,n,r,i){this.string=e,this.tabSize=n,this.indentUnit=r,this.overrideIndent=i,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let n=this.string.charAt(this.pos),r;if(typeof e=="string"?r=n==e:r=n&&(e instanceof RegExp?e.test(n):e(n)),r)return++this.pos,n}eatWhile(e){let n=this.pos;for(;this.eat(e););return this.pos>n}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=$te(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return(e=this.overrideIndent)!==null&&e!==void 0?e:$te(this.string,null,this.tabSize)}match(e,n,r){if(typeof e=="string"){let i=o=>r?o.toLowerCase():o,s=this.string.substr(this.pos,e.length);return i(s)==i(e)?(n!==!1&&(this.pos+=e.length),!0):null}else{let i=this.string.slice(this.pos).match(e);return i&&i.index>0?null:(i&&n!==!1&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function rot(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||iot,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||FU,mergeTokens:t.mergeTokens!==!1}}function iot(t){if(typeof t!="object")return t;let e={};for(let n in t){let r=t[n];e[n]=r instanceof Array?r.slice():r}return e}const Hte=new WeakMap;class jU extends Fl{constructor(e){let n=qwe(e.languageData),r=rot(e),i,s=new class extends pbe{createParse(o,a,l){return new oot(i,o,a,l)}};super(n,s,[],e.name),this.topNode=cot(n,this),i=this,this.streamParser=r,this.stateAfter=new hn({perNode:!0}),this.tokenTable=e.tokenTable?new hxe(r.tokenTable):lot}static define(e){return new jU(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=Hte.get(e.state),n!=null&&n<e.pos-1e4&&(n=void 0));let i=BU(this,e.node.tree,e.node.from,e.node.from,n??e.pos),s,o;if(i?(o=i.state,s=i.pos+1):(o=this.streamParser.startState(e.unit),s=e.node.from),e.pos-s>1e4)return null;for(;s<e.pos;){let l=e.state.doc.lineAt(s),c=Math.min(e.pos,l.to);if(l.length){let u=r?r(l.from):-1,d=new lxe(l.text,e.state.tabSize,e.unit,u<0?void 0:u);for(;d.pos<c-l.from;)uxe(this.streamParser.token,d,o)}else this.streamParser.blankLine(o,e.unit);if(c==e.pos)break;s=l.to+1}let a=e.lineAt(e.pos);return r&&n==null&&Hte.set(e.state,a.from),this.streamParser.indent(o,/^\s*(.*)/.exec(a.text)[1],e)}get allowsNesting(){return!1}}function BU(t,e,n,r,i){let s=n>=r&&n+e.length<=i&&e.prop(t.stateAfter);if(s)return{state:t.streamParser.copyState(s),pos:n+e.length};for(let o=e.children.length-1;o>=0;o--){let a=e.children[o],l=n+e.positions[o],c=a instanceof yr&&l<i&&BU(t,a,l,r,i);if(c)return c}return null}function cxe(t,e,n,r,i){if(i&&n<=0&&r>=e.length)return e;!i&&n==0&&e.type==t.topNode&&(i=!0);for(let s=e.children.length-1;s>=0;s--){let o=e.positions[s],a=e.children[s],l;if(o<r&&a instanceof yr){if(!(l=cxe(t,a,n-o,r-o,i)))break;return i?new yr(e.type,e.children.slice(0,s).concat(l),e.positions.slice(0,s+1),o+l.length):l}}return null}function sot(t,e,n,r,i){for(let s of e){let o=s.from+(s.openStart?25:0),a=s.to-(s.openEnd?25:0),l=o<=n&&a>n&&BU(t,s.tree,0-s.offset,n,a),c;if(l&&l.pos<=r&&(c=cxe(t,s.tree,n+s.offset,l.pos+s.offset,!1)))return{state:l.state,tree:c}}return{state:t.streamParser.startState(i?Q1(i):4),tree:yr.empty}}class oot{constructor(e,n,r,i){this.lang=e,this.input=n,this.fragments=r,this.ranges=i,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=i[i.length-1].to;let s=fj.get(),o=i[0].from,{state:a,tree:l}=sot(e,r,o,this.to,s==null?void 0:s.state);this.state=a,this.parsedPos=this.chunkStart=o+l.length;for(let c=0;c<l.children.length;c++)this.chunks.push(l.children[c]),this.chunkPos.push(l.positions[c]);s&&this.parsedPos<s.viewport.from-1e5&&i.some(c=>c.from<=s.viewport.from&&c.to>=s.viewport.from)&&(this.state=this.lang.streamParser.startState(Q1(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let e=fj.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos<r;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=n?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let n=this.input.chunk(e);if(this.input.lineChunks)n==`
|
||
`&&(n="");else{let r=n.indexOf(`
|
||
`);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let i=this.rangeIndex;;){let s=this.ranges[i].to;if(s>=r||(n=n.slice(0,s-(r-n.length)),i++,i==this.ranges.length))break;let o=this.ranges[i].from,a=this.lineAfter(o);n+=a,r=o+a.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let i=this.ranges[this.rangeIndex].to,s=e+n;if(r>0?i>s:i>=s)break;let o=this.ranges[++this.rangeIndex].from;n+=o-i}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,n,r,i){let s=4;if(this.ranges.length>1){i=this.skipGapsTo(n,i,1),n+=i;let a=this.chunk.length;i=this.skipGapsTo(r,i,-1),r+=i,s+=this.chunk.length-a}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==n?this.chunk[o+2]=r:this.chunk.push(e,n,r,s),i}parseLine(e){let{line:n,end:r}=this.nextLine(),i=0,{streamParser:s}=this.lang,o=new lxe(n,e?e.state.tabSize:4,e?Q1(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=uxe(s.token,o,this.state);if(a&&(i=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,i)),o.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=yr.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:aot,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new yr(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new yr(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function uxe(t,e,n){e.start=e.pos;for(let r=0;r<10;r++){let i=t(e,n);if(e.pos>e.start)return i}throw new Error("Stream parser failed to advance stream.")}const FU=Object.create(null),lk=[ol.none],aot=new fU(lk),Ute=[],qte=Object.create(null),dxe=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])dxe[t]=fxe(FU,e);class hxe{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),dxe)}resolve(e){return e?this.table[e]||(this.table[e]=fxe(this.extra,e)):0}}const lot=new hxe(FU);function oO(t,e){Ute.indexOf(t)>-1||(Ute.push(t),console.warn(e))}function fxe(t,e){let n=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let u=t[c]||ve[c];u?typeof u=="function"?l.length?l=l.map(u):oO(c,`Modifier ${c} used at start of tag`):l.length?oO(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:oO(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+n.map(a=>a.id),s=qte[i];if(s)return s.id;let o=qte[i]=ol.define({id:lk.length,name:r,props:[dst({[r]:n})]});return lk.push(o),o.id}function cot(t,e){let n=ol.define({id:lk.length,name:"Document",props:[Ag.add(()=>t),Gwe.add(()=>r=>e.getIndent(r))],top:!0});return lk.push(n),n}vr.RTL,vr.LTR;function Ie(t){return new bst(jU.define(t))}function Yf(t){return ue(()=>import("./index-ChceY9yO.js"),__vite__mapDeps([0,1])).then(e=>e.sql({dialect:e[t]}))}const uot=[le.of({name:"C",extensions:["c","h","ino"],load(){return ue(()=>import("./index-BrgMj9EV.js"),__vite__mapDeps([2,1])).then(t=>t.cpp())}}),le.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return ue(()=>import("./index-BrgMj9EV.js"),__vite__mapDeps([2,1])).then(t=>t.cpp())}}),le.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return Yf("Cassandra")}}),le.of({name:"CSS",extensions:["css"],load(){return ue(()=>import("./index-cXSkcoY5.js"),__vite__mapDeps([3,1])).then(t=>t.css())}}),le.of({name:"Go",extensions:["go"],load(){return ue(()=>import("./index-BC17We5c.js"),__vite__mapDeps([4,1])).then(t=>t.go())}}),le.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return ue(()=>import("./index-1eVFoYiz.js"),__vite__mapDeps([5,1,3,6])).then(t=>t.html())}}),le.of({name:"Java",extensions:["java"],load(){return ue(()=>import("./index-DqhC_Kf2.js"),__vite__mapDeps([7,1])).then(t=>t.java())}}),le.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return ue(()=>import("./index-qccrkHdW.js"),__vite__mapDeps([6,1])).then(t=>t.javascript())}}),le.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return ue(()=>import("./index-CjdSldoM.js"),__vite__mapDeps([8,5,1,3,6])).then(t=>t.jinja())}}),le.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return ue(()=>import("./index-DUIOFOyZ.js"),__vite__mapDeps([9,1])).then(t=>t.json())}}),le.of({name:"JSX",extensions:["jsx"],load(){return ue(()=>import("./index-qccrkHdW.js"),__vite__mapDeps([6,1])).then(t=>t.javascript({jsx:!0}))}}),le.of({name:"LESS",extensions:["less"],load(){return ue(()=>import("./index-4LSWdctC.js"),__vite__mapDeps([10,3,1])).then(t=>t.less())}}),le.of({name:"Liquid",extensions:["liquid"],load(){return ue(()=>import("./index-VPHTxbPF.js"),__vite__mapDeps([11,5,1,3,6])).then(t=>t.liquid())}}),le.of({name:"MariaDB SQL",load(){return Yf("MariaSQL")}}),le.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return ue(()=>import("./index-CW1rGHDh.js"),__vite__mapDeps([12,5,1,3,6])).then(t=>t.markdown())}}),le.of({name:"MS SQL",load(){return Yf("MSSQL")}}),le.of({name:"MySQL",load(){return Yf("MySQL")}}),le.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return ue(()=>import("./index-kursAkdO.js"),__vite__mapDeps([13,1,5,3,6])).then(t=>t.php())}}),le.of({name:"PLSQL",extensions:["pls"],load(){return Yf("PLSQL")}}),le.of({name:"PostgreSQL",load(){return Yf("PostgreSQL")}}),le.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return ue(()=>import("./index-DxrtMfYz.js"),__vite__mapDeps([14,1])).then(t=>t.python())}}),le.of({name:"Rust",extensions:["rs"],load(){return ue(()=>import("./index-Jvlk4AK9.js"),__vite__mapDeps([15,1])).then(t=>t.rust())}}),le.of({name:"Sass",extensions:["sass"],load(){return ue(()=>import("./index-BRzSNedJ.js"),__vite__mapDeps([16,1,3])).then(t=>t.sass({indented:!0}))}}),le.of({name:"SCSS",extensions:["scss"],load(){return ue(()=>import("./index-BRzSNedJ.js"),__vite__mapDeps([16,1,3])).then(t=>t.sass())}}),le.of({name:"SQL",extensions:["sql"],load(){return Yf("StandardSQL")}}),le.of({name:"SQLite",load(){return Yf("SQLite")}}),le.of({name:"TSX",extensions:["tsx"],load(){return ue(()=>import("./index-qccrkHdW.js"),__vite__mapDeps([6,1])).then(t=>t.javascript({jsx:!0,typescript:!0}))}}),le.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return ue(()=>import("./index-qccrkHdW.js"),__vite__mapDeps([6,1])).then(t=>t.javascript({typescript:!0}))}}),le.of({name:"WebAssembly",extensions:["wat","wast"],load(){return ue(()=>import("./index-Q4rtX3NF.js"),__vite__mapDeps([17,1])).then(t=>t.wast())}}),le.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return ue(()=>import("./index-1rpfjieq.js"),__vite__mapDeps([18,1])).then(t=>t.xml())}}),le.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return ue(()=>import("./index-CX1yQM68.js"),__vite__mapDeps([19,1])).then(t=>t.yaml())}}),le.of({name:"APL",extensions:["dyalog","apl"],load(){return ue(()=>import("./apl-B4CMkyY2.js"),[]).then(t=>Ie(t.apl))}}),le.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return ue(()=>import("./asciiarmor-Df11BRmG.js"),[]).then(t=>Ie(t.asciiArmor))}}),le.of({name:"ASN.1",extensions:["asn","asn1"],load(){return ue(()=>import("./asn1-EdZsLKOL.js"),[]).then(t=>Ie(t.asn1({})))}}),le.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return ue(()=>import("./asterisk-B-8jnY81.js"),[]).then(t=>Ie(t.asterisk))}}),le.of({name:"Brainfuck",extensions:["b","bf"],load(){return ue(()=>import("./brainfuck-C4LP7Hcl.js"),[]).then(t=>Ie(t.brainfuck))}}),le.of({name:"Cobol",extensions:["cob","cpy"],load(){return ue(()=>import("./cobol-CWcv1MsR.js"),[]).then(t=>Ie(t.cobol))}}),le.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return ue(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Ie(t.csharp))}}),le.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return ue(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>Ie(t.clojure))}}),le.of({name:"ClojureScript",extensions:["cljs"],load(){return ue(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>Ie(t.clojure))}}),le.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return ue(()=>import("./css-BnMrqG3P.js"),[]).then(t=>Ie(t.gss))}}),le.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return ue(()=>import("./cmake-BQqOBYOt.js"),[]).then(t=>Ie(t.cmake))}}),le.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return ue(()=>import("./coffeescript-S37ZYGWr.js"),[]).then(t=>Ie(t.coffeeScript))}}),le.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return ue(()=>import("./commonlisp-DBKNyK5s.js"),[]).then(t=>Ie(t.commonLisp))}}),le.of({name:"Cypher",extensions:["cyp","cypher"],load(){return ue(()=>import("./cypher-C_CwsFkJ.js"),[]).then(t=>Ie(t.cypher))}}),le.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return ue(()=>import("./python-BuPzkPfP.js"),[]).then(t=>Ie(t.cython))}}),le.of({name:"Crystal",extensions:["cr"],load(){return ue(()=>import("./crystal-SjHAIU92.js"),[]).then(t=>Ie(t.crystal))}}),le.of({name:"D",extensions:["d"],load(){return ue(()=>import("./d-pRatUO7H.js"),[]).then(t=>Ie(t.d))}}),le.of({name:"Dart",extensions:["dart"],load(){return ue(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Ie(t.dart))}}),le.of({name:"diff",extensions:["diff","patch"],load(){return ue(()=>import("./diff-DbItnlRl.js"),[]).then(t=>Ie(t.diff))}}),le.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return ue(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([20,21])).then(t=>Ie(t.dockerFile))}}),le.of({name:"DTD",extensions:["dtd"],load(){return ue(()=>import("./dtd-DF_7sFjM.js"),[]).then(t=>Ie(t.dtd))}}),le.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return ue(()=>import("./dylan-DwRh75JA.js"),[]).then(t=>Ie(t.dylan))}}),le.of({name:"EBNF",load(){return ue(()=>import("./ebnf-CDyGwa7X.js"),[]).then(t=>Ie(t.ebnf))}}),le.of({name:"ECL",extensions:["ecl"],load(){return ue(()=>import("./ecl-Cabwm37j.js"),[]).then(t=>Ie(t.ecl))}}),le.of({name:"edn",extensions:["edn"],load(){return ue(()=>import("./clojure-BMjYHr_A.js"),[]).then(t=>Ie(t.clojure))}}),le.of({name:"Eiffel",extensions:["e"],load(){return ue(()=>import("./eiffel-CnydiIhH.js"),[]).then(t=>Ie(t.eiffel))}}),le.of({name:"Elm",extensions:["elm"],load(){return ue(()=>import("./elm-vLlmbW-K.js"),[]).then(t=>Ie(t.elm))}}),le.of({name:"Erlang",extensions:["erl"],load(){return ue(()=>import("./erlang-BNw1qcRV.js"),[]).then(t=>Ie(t.erlang))}}),le.of({name:"Esper",load(){return ue(()=>import("./sql-D0XecflT.js"),[]).then(t=>Ie(t.esper))}}),le.of({name:"Factor",extensions:["factor"],load(){return ue(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([22,21])).then(t=>Ie(t.factor))}}),le.of({name:"FCL",load(){return ue(()=>import("./fcl-Kvtd6kyn.js"),[]).then(t=>Ie(t.fcl))}}),le.of({name:"Forth",extensions:["forth","fth","4th"],load(){return ue(()=>import("./forth-Ffai-XNe.js"),[]).then(t=>Ie(t.forth))}}),le.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return ue(()=>import("./fortran-DYz_wnZ1.js"),[]).then(t=>Ie(t.fortran))}}),le.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return ue(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>Ie(t.fSharp))}}),le.of({name:"Gas",extensions:["s"],load(){return ue(()=>import("./gas-Bneqetm1.js"),[]).then(t=>Ie(t.gas))}}),le.of({name:"Gherkin",extensions:["feature"],load(){return ue(()=>import("./gherkin-heZmZLOM.js"),[]).then(t=>Ie(t.gherkin))}}),le.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return ue(()=>import("./groovy-D9Dt4D0W.js"),[]).then(t=>Ie(t.groovy))}}),le.of({name:"Haskell",extensions:["hs"],load(){return ue(()=>import("./haskell-BWDZoCOh.js"),[]).then(t=>Ie(t.haskell))}}),le.of({name:"Haxe",extensions:["hx"],load(){return ue(()=>import("./haxe-H-WmDvRZ.js"),[]).then(t=>Ie(t.haxe))}}),le.of({name:"HXML",extensions:["hxml"],load(){return ue(()=>import("./haxe-H-WmDvRZ.js"),[]).then(t=>Ie(t.hxml))}}),le.of({name:"HTTP",load(){return ue(()=>import("./http-DBlCnlav.js"),[]).then(t=>Ie(t.http))}}),le.of({name:"IDL",extensions:["pro"],load(){return ue(()=>import("./idl-BEugSyMb.js"),[]).then(t=>Ie(t.idl))}}),le.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return ue(()=>import("./javascript-qCveANmP.js"),[]).then(t=>Ie(t.jsonld))}}),le.of({name:"Julia",extensions:["jl"],load(){return ue(()=>import("./julia-DuME0IfC.js"),[]).then(t=>Ie(t.julia))}}),le.of({name:"Kotlin",extensions:["kt","kts"],load(){return ue(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Ie(t.kotlin))}}),le.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return ue(()=>import("./livescript-BwQOo05w.js"),[]).then(t=>Ie(t.liveScript))}}),le.of({name:"Lua",extensions:["lua"],load(){return ue(()=>import("./lua-VAEuO923.js"),[]).then(t=>Ie(t.lua))}}),le.of({name:"mIRC",extensions:["mrc"],load(){return ue(()=>import("./mirc-CjQqDB4T.js"),[]).then(t=>Ie(t.mirc))}}),le.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return ue(()=>import("./mathematica-DTrFuWx2.js"),[]).then(t=>Ie(t.mathematica))}}),le.of({name:"Modelica",extensions:["mo"],load(){return ue(()=>import("./modelica-Dc1JOy9r.js"),[]).then(t=>Ie(t.modelica))}}),le.of({name:"MUMPS",extensions:["mps"],load(){return ue(()=>import("./mumps-BT43cFF4.js"),[]).then(t=>Ie(t.mumps))}}),le.of({name:"Mbox",extensions:["mbox"],load(){return ue(()=>import("./mbox-CNhZ1qSd.js"),[]).then(t=>Ie(t.mbox))}}),le.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return ue(()=>import("./nginx-DdIZxoE0.js"),[]).then(t=>Ie(t.nginx))}}),le.of({name:"NSIS",extensions:["nsh","nsi"],load(){return ue(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([23,21])).then(t=>Ie(t.nsis))}}),le.of({name:"NTriples",extensions:["nt","nq"],load(){return ue(()=>import("./ntriples-BfvgReVJ.js"),[]).then(t=>Ie(t.ntriples))}}),le.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return ue(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Ie(t.objectiveC))}}),le.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return ue(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Ie(t.objectiveCpp))}}),le.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return ue(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>Ie(t.oCaml))}}),le.of({name:"Octave",extensions:["m"],load(){return ue(()=>import("./octave-Ck1zUtKM.js"),[]).then(t=>Ie(t.octave))}}),le.of({name:"Oz",extensions:["oz"],load(){return ue(()=>import("./oz-BzwKVEFT.js"),[]).then(t=>Ie(t.oz))}}),le.of({name:"Pascal",extensions:["p","pas"],load(){return ue(()=>import("./pascal--L3eBynH.js"),[]).then(t=>Ie(t.pascal))}}),le.of({name:"Perl",extensions:["pl","pm"],load(){return ue(()=>import("./perl-CdXCOZ3F.js"),[]).then(t=>Ie(t.perl))}}),le.of({name:"Pig",extensions:["pig"],load(){return ue(()=>import("./pig-CevX1Tat.js"),[]).then(t=>Ie(t.pig))}}),le.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return ue(()=>import("./powershell-CFHJl5sT.js"),[]).then(t=>Ie(t.powerShell))}}),le.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return ue(()=>import("./properties-C78fOPTZ.js"),[]).then(t=>Ie(t.properties))}}),le.of({name:"ProtoBuf",extensions:["proto"],load(){return ue(()=>import("./protobuf-ChK-085T.js"),[]).then(t=>Ie(t.protobuf))}}),le.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return ue(()=>import("./pug-DukmZTjD.js"),__vite__mapDeps([24,25])).then(t=>Ie(t.pug))}}),le.of({name:"Puppet",extensions:["pp"],load(){return ue(()=>import("./puppet-DMA9R1ak.js"),[]).then(t=>Ie(t.puppet))}}),le.of({name:"Q",extensions:["q"],load(){return ue(()=>import("./q-pXgVlZs6.js"),[]).then(t=>Ie(t.q))}}),le.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return ue(()=>import("./r-DUYO_cvP.js"),[]).then(t=>Ie(t.r))}}),le.of({name:"RPM Changes",load(){return ue(()=>import("./rpm-CTu-6PCP.js"),[]).then(t=>Ie(t.rpmChanges))}}),le.of({name:"RPM Spec",extensions:["spec"],load(){return ue(()=>import("./rpm-CTu-6PCP.js"),[]).then(t=>Ie(t.rpmSpec))}}),le.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return ue(()=>import("./ruby-B2Rjki9n.js"),[]).then(t=>Ie(t.ruby))}}),le.of({name:"SAS",extensions:["sas"],load(){return ue(()=>import("./sas-B4kiWyti.js"),[]).then(t=>Ie(t.sas))}}),le.of({name:"Scala",extensions:["scala"],load(){return ue(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Ie(t.scala))}}),le.of({name:"Scheme",extensions:["scm","ss"],load(){return ue(()=>import("./scheme-C41bIUwD.js"),[]).then(t=>Ie(t.scheme))}}),le.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return ue(()=>import("./shell-CjFT_Tl9.js"),[]).then(t=>Ie(t.shell))}}),le.of({name:"Sieve",extensions:["siv","sieve"],load(){return ue(()=>import("./sieve-C3Gn_uJK.js"),[]).then(t=>Ie(t.sieve))}}),le.of({name:"Smalltalk",extensions:["st"],load(){return ue(()=>import("./smalltalk-CnHTOXQT.js"),[]).then(t=>Ie(t.smalltalk))}}),le.of({name:"Solr",load(){return ue(()=>import("./solr-DehyRSwq.js"),[]).then(t=>Ie(t.solr))}}),le.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return ue(()=>import("./mllike-CXdrOF99.js"),[]).then(t=>Ie(t.sml))}}),le.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return ue(()=>import("./sparql-DkYu6x3z.js"),[]).then(t=>Ie(t.sparql))}}),le.of({name:"Spreadsheet",alias:["excel","formula"],load(){return ue(()=>import("./spreadsheet-BCZA_wO0.js"),[]).then(t=>Ie(t.spreadsheet))}}),le.of({name:"Squirrel",extensions:["nut"],load(){return ue(()=>import("./clike-B9uivgTg.js"),[]).then(t=>Ie(t.squirrel))}}),le.of({name:"Stylus",extensions:["styl"],load(){return ue(()=>import("./stylus-B533Al4x.js"),[]).then(t=>Ie(t.stylus))}}),le.of({name:"Swift",extensions:["swift"],load(){return ue(()=>import("./swift-BzpIVaGY.js"),[]).then(t=>Ie(t.swift))}}),le.of({name:"sTeX",load(){return ue(()=>import("./stex-C3f8Ysf7.js"),[]).then(t=>Ie(t.stex))}}),le.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return ue(()=>import("./stex-C3f8Ysf7.js"),[]).then(t=>Ie(t.stex))}}),le.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return ue(()=>import("./verilog-C6RDOZhf.js"),[]).then(t=>Ie(t.verilog))}}),le.of({name:"Tcl",extensions:["tcl"],load(){return ue(()=>import("./tcl-DVfN8rqt.js"),[]).then(t=>Ie(t.tcl))}}),le.of({name:"Textile",extensions:["textile"],load(){return ue(()=>import("./textile-CnDTJFAw.js"),[]).then(t=>Ie(t.textile))}}),le.of({name:"TiddlyWiki",load(){return ue(()=>import("./tiddlywiki-DO-Gjzrf.js"),[]).then(t=>Ie(t.tiddlyWiki))}}),le.of({name:"Tiki wiki",load(){return ue(()=>import("./tiki-DGYXhP31.js"),[]).then(t=>Ie(t.tiki))}}),le.of({name:"TOML",extensions:["toml"],load(){return ue(()=>import("./toml-Bm5Em-hy.js"),[]).then(t=>Ie(t.toml))}}),le.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return ue(()=>import("./troff-wAsdV37c.js"),[]).then(t=>Ie(t.troff))}}),le.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return ue(()=>import("./ttcn-CfJYG6tj.js"),[]).then(t=>Ie(t.ttcn))}}),le.of({name:"TTCN_CFG",extensions:["cfg"],load(){return ue(()=>import("./ttcn-cfg-B9xdYoR4.js"),[]).then(t=>Ie(t.ttcnCfg))}}),le.of({name:"Turtle",extensions:["ttl"],load(){return ue(()=>import("./turtle-B1tBg_DP.js"),[]).then(t=>Ie(t.turtle))}}),le.of({name:"Web IDL",extensions:["webidl"],load(){return ue(()=>import("./webidl-ZXfAyPTL.js"),[]).then(t=>Ie(t.webIDL))}}),le.of({name:"VB.NET",extensions:["vb"],load(){return ue(()=>import("./vb-CmGdzxic.js"),[]).then(t=>Ie(t.vb))}}),le.of({name:"VBScript",extensions:["vbs"],load(){return ue(()=>import("./vbscript-BuJXcnF6.js"),[]).then(t=>Ie(t.vbScript))}}),le.of({name:"Velocity",extensions:["vtl"],load(){return ue(()=>import("./velocity-D8B20fx6.js"),[]).then(t=>Ie(t.velocity))}}),le.of({name:"Verilog",extensions:["v"],load(){return ue(()=>import("./verilog-C6RDOZhf.js"),[]).then(t=>Ie(t.verilog))}}),le.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return ue(()=>import("./vhdl-lSbBsy5d.js"),[]).then(t=>Ie(t.vhdl))}}),le.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return ue(()=>import("./xquery-CQfU5ijd.js"),[]).then(t=>Ie(t.xQuery))}}),le.of({name:"Yacas",extensions:["ys"],load(){return ue(()=>import("./yacas-BJ4BC0dw.js"),[]).then(t=>Ie(t.yacas))}}),le.of({name:"Z80",extensions:["z80"],load(){return ue(()=>import("./z80-Hz9HOZM7.js"),[]).then(t=>Ie(t.z80))}}),le.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return ue(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>Ie(t.mscgen))}}),le.of({name:"Xù",extensions:["xu"],load(){return ue(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>Ie(t.xu))}}),le.of({name:"MsGenny",extensions:["msgenny"],load(){return ue(()=>import("./mscgen-BA5vi2Kp.js"),[]).then(t=>Ie(t.msgenny))}}),le.of({name:"Vue",extensions:["vue"],load(){return ue(()=>import("./index-BLzV9qSf.js"),__vite__mapDeps([26,5,1,3,6])).then(t=>t.vue())}}),le.of({name:"Angular Template",load(){return ue(()=>import("./index-wuYSPDJ9.js"),__vite__mapDeps([27,5,1,3,6])).then(t=>t.angular())}})],dot="#e5c07b",Wte="#e06c75",hot="#56b6c2",fot="#ffffff",p6="#abb2bf",vj="#7d8799",pot="#61afef",mot="#98c379",Gte="#d19a66",got="#c678dd",yot="#21252b",Kte="#2c313a",Yte="#282c34",aO="#353a42",vot="#3E4451",Zte="#528bff",bot=ht.theme({"&":{color:p6,backgroundColor:Yte},".cm-content":{caretColor:Zte},".cm-cursor, .cm-dropCursor":{borderLeftColor:Zte},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:vot},".cm-panels":{backgroundColor:yot,color:p6},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Yte,color:vj,border:"none"},".cm-activeLineGutter":{backgroundColor:Kte},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:aO},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:aO,borderBottomColor:aO},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Kte,color:p6}}},{dark:!0}),wot=M3.define([{tag:ve.keyword,color:got},{tag:[ve.name,ve.deleted,ve.character,ve.propertyName,ve.macroName],color:Wte},{tag:[ve.function(ve.variableName),ve.labelName],color:pot},{tag:[ve.color,ve.constant(ve.name),ve.standard(ve.name)],color:Gte},{tag:[ve.definition(ve.name),ve.separator],color:p6},{tag:[ve.typeName,ve.className,ve.number,ve.changed,ve.annotation,ve.modifier,ve.self,ve.namespace],color:dot},{tag:[ve.operator,ve.operatorKeyword,ve.url,ve.escape,ve.regexp,ve.link,ve.special(ve.string)],color:hot},{tag:[ve.meta,ve.comment],color:vj},{tag:ve.strong,fontWeight:"bold"},{tag:ve.emphasis,fontStyle:"italic"},{tag:ve.strikethrough,textDecoration:"line-through"},{tag:ve.link,color:vj,textDecoration:"underline"},{tag:ve.heading,fontWeight:"bold",color:Wte},{tag:[ve.atom,ve.bool,ve.special(ve.variableName)],color:Gte},{tag:[ve.processingInstruction,ve.string,ve.inserted],color:mot},{tag:ve.invalid,color:fot}]),xot=[bot,ixe(wot)];var Fo=function(t){return t.docTypeError="docTypeError",t.contextNotFound="contextNotFound",t.timerNotFound="timerNotFound",t.ctxCallOutOfScope="ctxCallOutOfScope",t.createNodeInParserFail="createNodeInParserFail",t.stackOverFlow="stackOverFlow",t.parserMatchError="parserMatchError",t.serializerMatchError="serializerMatchError",t.getAtomFromSchemaFail="getAtomFromSchemaFail",t.expectDomTypeError="expectDomTypeError",t.callCommandBeforeEditorView="callCommandBeforeEditorView",t.missingRootElement="missingRootElement",t.missingNodeInSchema="missingNodeInSchema",t.missingMarkInSchema="missingMarkInSchema",t.ctxNotBind="ctxNotBind",t.missingYjsDoc="missingYjsDoc",t.aiProviderError="aiProviderError",t.aiBuildContextError="aiBuildContextError",t}({}),Vo=class extends Error{constructor(t,e,n){super(e,n),this.name="MilkdownError",this.code=t,(n==null?void 0:n.cause)!==void 0&&(this.cause=n.cause)}},_ot=(t,e)=>typeof e=="function"?"[Function]":e,N3=t=>JSON.stringify(t,_ot);function Sot(t){return new Vo(Fo.docTypeError,`Doc type error, unsupported type: ${N3(t)}`)}function kot(t){return new Vo(Fo.contextNotFound,`Context "${t}" not found, do you forget to inject it?`)}function Cot(t){return new Vo(Fo.timerNotFound,`Timer "${t}" not found, do you forget to record it?`)}function qI(){return new Vo(Fo.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function Eot(t,e,n){const r=`Cannot create node for ${"name"in t?t.name:t}`,i=o=>{if(o==null)return"null";if(Array.isArray(o))return`[${o.map(i).join(", ")}]`;if(typeof o=="object")return"toJSON"in o&&typeof o.toJSON=="function"?JSON.stringify(o.toJSON()):"spec"in o?JSON.stringify(o.spec):JSON.stringify(o);if(typeof o=="string"||typeof o=="number"||typeof o=="boolean")return JSON.stringify(o);if(typeof o=="function")return`[Function: ${o.name||"anonymous"}]`;try{return String(o)}catch{return"[Unserializable]"}},s=[["[Description]",r],["[Attributes]",e],["[Content]",(n??[]).map(o=>o?typeof o=="object"&&"type"in o?`${o}`:i(o):"null")]].reduce((o,[a,l])=>{const c=`${a}: ${i(l)}.`;return o.concat(c)},[]);return new Vo(Fo.createNodeInParserFail,s.join(`
|
||
`))}function pxe(){return new Vo(Fo.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function Tot(t){return new Vo(Fo.parserMatchError,`Cannot match target parser for node: ${N3(t)}.`)}function Aot(t){return new Vo(Fo.serializerMatchError,`Cannot match target serializer for node: ${N3(t)}.`)}function Iot(t,e){return new Vo(Fo.getAtomFromSchemaFail,`Cannot get ${t}: ${e} from schema.`)}function su(t){return new Vo(Fo.expectDomTypeError,`Expect to be a dom, but get: ${N3(t)}.`)}function lO(){return new Vo(Fo.callCommandBeforeEditorView,"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized")}function mxe(t){return new Vo(Fo.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${t}" in schema.`)}function Rot(t){return new Vo(Fo.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${t}" in schema.`)}function gxe(t){try{return N3(t)}catch{return"[Unserializable]"}}function Mot(t){const e=t instanceof Error?t.message:gxe(t);return new Vo(Fo.aiProviderError,`AI provider error: ${e}`,{cause:t})}function Not(t){const e=t instanceof Error?t.message:gxe(t);return new Vo(Fo.aiBuildContextError,`AI buildContext failed: ${e}`,{cause:t})}var yxe=class{constructor(){this.sliceMap=new Map,this.get=t=>{const e=typeof t=="string"?[...this.sliceMap.values()].find(n=>n.type.name===t):this.sliceMap.get(t.id);if(!e)throw kot(typeof t=="string"?t:t.name);return e},this.remove=t=>{const e=typeof t=="string"?[...this.sliceMap.values()].find(n=>n.type.name===t):this.sliceMap.get(t.id);e&&this.sliceMap.delete(e.type.id)},this.has=t=>typeof t=="string"?[...this.sliceMap.values()].some(e=>e.type.name===t):this.sliceMap.has(t.id)}},kc,mh,Ub,qle,Oot=(qle=class{constructor(e,n,r){te(this,kc);te(this,mh);te(this,Ub);W(this,kc,[]),W(this,Ub,()=>{O(this,kc).forEach(i=>i(O(this,mh)))}),this.set=i=>{W(this,mh,i),O(this,Ub).call(this)},this.get=()=>O(this,mh),this.update=i=>{W(this,mh,i(O(this,mh))),O(this,Ub).call(this)},this.type=r,W(this,mh,n),e.set(r.id,this)}on(e){return O(this,kc).push(e),()=>{W(this,kc,O(this,kc).filter(n=>n!==e))}}once(e){const n=this.on(r=>{e(r),n()});return n}off(e){W(this,kc,O(this,kc).filter(n=>n!==e))}offAll(){W(this,kc,[])}},kc=new WeakMap,mh=new WeakMap,Ub=new WeakMap,qle),Dot=class{constructor(t,e){this.id=Symbol(`Context-${e}`),this.name=e,this._defaultValue=t,this._typeInfo=()=>{throw qI()}}create(t,e=this._defaultValue){return new Oot(t,e,this)}},fn=(t,e)=>new Dot(t,e),Jk,e5,t5,Ug,qb,$p,Wb,Gb,Kb,Wle,Pot=(Wle=class{constructor(t,e,n){te(this,Jk);te(this,e5);te(this,t5);te(this,Ug);te(this,qb);te(this,$p);te(this,Wb);te(this,Gb);te(this,Kb);W(this,Ug,new Set),W(this,qb,new Set),W(this,$p,new Map),W(this,Wb,new Map),this.read=()=>({metadata:O(this,Jk),injectedSlices:[...O(this,Ug)].map(r=>({name:typeof r=="string"?r:r.name,value:O(this,Gb).call(this,r)})),consumedSlices:[...O(this,qb)].map(r=>({name:typeof r=="string"?r:r.name,value:O(this,Gb).call(this,r)})),recordedTimers:[...O(this,$p)].map(([r,{duration:i}])=>({name:r.name,duration:i,status:O(this,Kb).call(this,r)})),waitTimers:[...O(this,Wb)].map(([r,{duration:i}])=>({name:r.name,duration:i,status:O(this,Kb).call(this,r)}))}),this.onRecord=r=>{O(this,$p).set(r,{start:Date.now(),duration:0})},this.onClear=r=>{O(this,$p).delete(r)},this.onDone=r=>{const i=O(this,$p).get(r);i&&(i.duration=Date.now()-i.start)},this.onWait=(r,i)=>{const s=Date.now();i.finally(()=>{O(this,Wb).set(r,{duration:Date.now()-s})}).catch(console.error)},this.onInject=r=>{O(this,Ug).add(r)},this.onRemove=r=>{O(this,Ug).delete(r)},this.onUse=r=>{O(this,qb).add(r)},W(this,Gb,r=>O(this,e5).get(r).get()),W(this,Kb,r=>O(this,t5).get(r).status),W(this,e5,t),W(this,t5,e),W(this,Jk,n)}},Jk=new WeakMap,e5=new WeakMap,t5=new WeakMap,Ug=new WeakMap,qb=new WeakMap,$p=new WeakMap,Wb=new WeakMap,Gb=new WeakMap,Kb=new WeakMap,Wle),gh,yh,n5,wl,Yb,Lot=(Yb=class{constructor(e,n,r){te(this,gh);te(this,yh);te(this,n5);te(this,wl);this.produce=i=>i&&Object.keys(i).length?new Yb(O(this,gh),O(this,yh),{...i}):this,this.inject=(i,s)=>{var a;const o=i.create(O(this,gh).sliceMap);return s!=null&&o.set(s),(a=O(this,wl))==null||a.onInject(i),this},this.remove=i=>{var s;return O(this,gh).remove(i),(s=O(this,wl))==null||s.onRemove(i),this},this.record=i=>{var s;return i.create(O(this,yh).store),(s=O(this,wl))==null||s.onRecord(i),this},this.clearTimer=i=>{var s;return O(this,yh).remove(i),(s=O(this,wl))==null||s.onClear(i),this},this.isInjected=i=>O(this,gh).has(i),this.isRecorded=i=>O(this,yh).has(i),this.use=i=>{var s;return(s=O(this,wl))==null||s.onUse(i),O(this,gh).get(i)},this.get=i=>this.use(i).get(),this.set=(i,s)=>this.use(i).set(s),this.update=(i,s)=>this.use(i).update(s),this.timer=i=>O(this,yh).get(i),this.done=i=>{var s;this.timer(i).done(),(s=O(this,wl))==null||s.onDone(i)},this.wait=i=>{var o;const s=this.timer(i).start();return(o=O(this,wl))==null||o.onWait(i,s),s},this.waitTimers=async i=>{await Promise.all(this.get(i).map(s=>this.wait(s)))},W(this,gh,e),W(this,yh,n),W(this,n5,r),r&&W(this,wl,new Pot(e,n,r))}get meta(){return O(this,n5)}get inspector(){return O(this,wl)}},gh=new WeakMap,yh=new WeakMap,n5=new WeakMap,wl=new WeakMap,Yb),zot=class{constructor(){this.store=new Map,this.get=t=>{const e=this.store.get(t.id);if(!e)throw Cot(t.name);return e},this.remove=t=>{this.store.delete(t.id)},this.has=t=>this.store.has(t.id)}},Zb,Hp,Xb,vh,Qb,r5,Gle,jot=(Gle=class{constructor(t,e){te(this,Zb);te(this,Hp);te(this,Xb);te(this,vh);te(this,Qb);te(this,r5);W(this,Zb,null),W(this,Hp,null),W(this,vh,"pending"),this.start=()=>(O(this,Zb)??W(this,Zb,new Promise((n,r)=>{W(this,Hp,i=>{i instanceof CustomEvent&&i.detail.id===O(this,Xb)&&(W(this,vh,"resolved"),O(this,Qb).call(this),i.stopImmediatePropagation(),n())}),O(this,r5).call(this,()=>{O(this,vh)==="pending"&&W(this,vh,"rejected"),O(this,Qb).call(this),r(new Error(`Timing ${this.type.name} timeout.`))}),W(this,vh,"pending"),addEventListener(this.type.name,O(this,Hp))})),O(this,Zb)),this.done=()=>{const n=new CustomEvent(this.type.name,{detail:{id:O(this,Xb)}});dispatchEvent(n)},W(this,Qb,()=>{O(this,Hp)&&removeEventListener(this.type.name,O(this,Hp))}),W(this,r5,n=>{setTimeout(()=>{n()},this.type.timeout)}),W(this,Xb,Symbol(e.name)),this.type=e,t.set(e.id,this)}get status(){return O(this,vh)}},Zb=new WeakMap,Hp=new WeakMap,Xb=new WeakMap,vh=new WeakMap,Qb=new WeakMap,r5=new WeakMap,Gle),Bot=class{constructor(t,e=3e3){this.create=n=>new jot(n,this),this.id=Symbol(`Timer-${t}`),this.name=t,this.timeout=e}},Md=(t,e=3e3)=>new Bot(t,e);const Fot={};function VU(t,e){const n=Fot,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return vxe(t,r,i)}function vxe(t,e,n){if(Vot(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return Xte(t.children,e,n)}return Array.isArray(t)?Xte(t,e,n):""}function Xte(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=vxe(t[i],e,n);return r.join("")}function Vot(t){return!!(t&&typeof t=="object")}const Qte=document.createElement("i");function $U(t){const e="&"+t+";";Qte.innerHTML=e;const n=Qte.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function Ja(t,e,n,r){const i=t.length;let s=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(e,0),t.splice(...o),s+=1e4,e+=1e4}function Rl(t,e){return t.length>0?(Ja(t,t.length,0,e),t):e}const Jte={}.hasOwnProperty;function bxe(t){const e={};let n=-1;for(;++n<t.length;)$ot(e,t[n]);return e}function $ot(t,e){let n;for(n in e){const i=(Jte.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let o;if(s)for(o in s){Jte.call(i,o)||(i[o]=[]);const a=s[o];Hot(i[o],Array.isArray(a)?a:a?[a]:[])}}}function Hot(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);Ja(t,0,0,r)}function wxe(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Bc(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Eo=k0(/[A-Za-z]/),da=k0(/[\dA-Za-z]/),Uot=k0(/[#-'*+\--9=?A-Z^-~]/);function e8(t){return t!==null&&(t<32||t===127)}const bj=k0(/\d/),qot=k0(/[\dA-Fa-f]/),Wot=k0(/[!-/:-@[-`{-~]/);function _t(t){return t!==null&&t<-2}function wr(t){return t!==null&&(t<0||t===32)}function wn(t){return t===-2||t===-1||t===32}const WI=k0(new RegExp("\\p{P}|\\p{S}","u")),ey=k0(/\s/);function k0(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function dn(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return wn(l)?(t.enter(n),a(l)):e(l)}function a(l){return wn(l)&&s++<i?(t.consume(l),a):(t.exit(n),e(l))}}const Got={tokenize:Kot};function Kot(t){const e=t.attempt(this.parser.constructs.contentInitial,r,i);let n;return e;function r(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),dn(t,e,"linePrefix")}function i(a){return t.enter("paragraph"),s(a)}function s(a){const l=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(a);return}return _t(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const Yot={tokenize:Zot},ene={tokenize:Xot};function Zot(t){const e=this,n=[];let r=0,i,s,o;return a;function a(_){if(r<n.length){const S=n[r];return e.containerState=S[1],t.attempt(S[0].continuation,l,c)(_)}return c(_)}function l(_){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&b();const S=e.events.length;let k=S,T;for(;k--;)if(e.events[k][0]==="exit"&&e.events[k][1].type==="chunkFlow"){T=e.events[k][1].end;break}v(r);let E=S;for(;E<e.events.length;)e.events[E][1].end={...T},E++;return Ja(e.events,k+1,0,e.events.slice(S)),e.events.length=E,c(_)}return a(_)}function c(_){if(r===n.length){if(!i)return h(_);if(i.currentConstruct&&i.currentConstruct.concrete)return p(_);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(ene,u,d)(_)}function u(_){return i&&b(),v(r),h(_)}function d(_){return e.parser.lazy[e.now().line]=r!==n.length,o=e.now().offset,p(_)}function h(_){return e.containerState={},t.attempt(ene,f,p)(_)}function f(_){return r++,n.push([e.currentConstruct,e.containerState]),h(_)}function p(_){if(_===null){i&&b(),v(0),t.consume(_);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),g(_)}function g(_){if(_===null){y(t.exit("chunkFlow"),!0),v(0),t.consume(_);return}return _t(_)?(t.consume(_),y(t.exit("chunkFlow")),r=0,e.interrupt=void 0,a):(t.consume(_),g)}function y(_,S){const k=e.sliceStream(_);if(S&&k.push(null),_.previous=s,s&&(s.next=_),s=_,i.defineSkip(_.start),i.write(k),e.parser.lazy[_.start.line]){let T=i.events.length;for(;T--;)if(i.events[T][1].start.offset<o&&(!i.events[T][1].end||i.events[T][1].end.offset>o))return;const E=e.events.length;let C=E,R,M;for(;C--;)if(e.events[C][0]==="exit"&&e.events[C][1].type==="chunkFlow"){if(R){M=e.events[C][1].end;break}R=!0}for(v(r),T=E;T<e.events.length;)e.events[T][1].end={...M},T++;Ja(e.events,C+1,0,e.events.slice(E)),e.events.length=T}}function v(_){let S=n.length;for(;S-- >_;){const k=n[S];e.containerState=k[1],k[0].exit.call(e,t)}n.length=_}function b(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function Xot(t,e,n){return dn(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function lx(t){if(t===null||wr(t)||ey(t))return 1;if(WI(t))return 2}function GI(t,e,n){const r=[];let i=-1;for(;++i<t.length;){const s=t[i].resolveAll;s&&!r.includes(s)&&(e=s(e,n),r.push(s))}return e}const wj={name:"attention",resolveAll:Qot,tokenize:Jot};function Qot(t,e){let n=-1,r,i,s,o,a,l,c,u;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;l=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const d={...t[r][1].end},h={...t[n][1].start};tne(d,-l),tne(h,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...t[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:h},s={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},t[r][1].end={...o.start},t[n][1].start={...a.end},c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=Rl(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=Rl(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),c=Rl(c,GI(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=Rl(c,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(u=2,c=Rl(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):u=0,Ja(t,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function Jot(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=lx(r);let s;return o;function o(l){return s=l,t.enter("attentionSequence"),a(l)}function a(l){if(l===s)return t.consume(l),a;const c=t.exit("attentionSequence"),u=lx(l),d=!u||u===2&&i||n.includes(l),h=!i||i===2&&u||n.includes(r);return c._open=!!(s===42?d:d&&(i||!h)),c._close=!!(s===42?h:h&&(u||!d)),e(l)}}function tne(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const eat={name:"autolink",tokenize:tat};function tat(t,e,n){let r=0;return i;function i(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(f){return Eo(f)?(t.consume(f),o):f===64?n(f):c(f)}function o(f){return f===43||f===45||f===46||da(f)?(r=1,a(f)):c(f)}function a(f){return f===58?(t.consume(f),r=0,l):(f===43||f===45||f===46||da(f))&&r++<32?(t.consume(f),a):(r=0,c(f))}function l(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||e8(f)?n(f):(t.consume(f),l)}function c(f){return f===64?(t.consume(f),u):Uot(f)?(t.consume(f),c):n(f)}function u(f){return da(f)?d(f):n(f)}function d(f){return f===46?(t.consume(f),r=0,u):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):h(f)}function h(f){if((f===45||da(f))&&r++<63){const p=f===45?h:d;return t.consume(f),p}return n(f)}}const O3={partial:!0,tokenize:nat};function nat(t,e,n){return r;function r(s){return wn(s)?dn(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||_t(s)?e(s):n(s)}}const xxe={continuation:{tokenize:iat},exit:sat,name:"blockQuote",tokenize:rat};function rat(t,e,n){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(t.enter("blockQuote",{_container:!0}),a.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),s}return n(o)}function s(o){return wn(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function iat(t,e,n){const r=this;return i;function i(o){return wn(o)?dn(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(xxe,e,n)(o)}}function sat(t){t.exit("blockQuote")}const _xe={name:"characterEscape",tokenize:oat};function oat(t,e,n){return r;function r(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),i}function i(s){return Wot(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const Sxe={name:"characterReference",tokenize:aat};function aat(t,e,n){const r=this;let i=0,s,o;return a;function a(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),l}function l(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),s=31,o=da,u(d))}function c(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=qot,u):(t.enter("characterReferenceValue"),s=7,o=bj,u(d))}function u(d){if(d===59&&i){const h=t.exit("characterReferenceValue");return o===da&&!$U(r.sliceSerialize(h))?n(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(d)&&i++<s?(t.consume(d),u):n(d)}}const nne={partial:!0,tokenize:cat},rne={concrete:!0,name:"codeFenced",tokenize:lat};function lat(t,e,n){const r=this,i={partial:!0,tokenize:k};let s=0,o=0,a;return l;function l(T){return c(T)}function c(T){const E=r.events[r.events.length-1];return s=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,a=T,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(T)}function u(T){return T===a?(o++,t.consume(T),u):o<3?n(T):(t.exit("codeFencedFenceSequence"),wn(T)?dn(t,d,"whitespace")(T):d(T))}function d(T){return T===null||_t(T)?(t.exit("codeFencedFence"),r.interrupt?e(T):t.check(nne,g,S)(T)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),h(T))}function h(T){return T===null||_t(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(T)):wn(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),dn(t,f,"whitespace")(T)):T===96&&T===a?n(T):(t.consume(T),h)}function f(T){return T===null||_t(T)?d(T):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),p(T))}function p(T){return T===null||_t(T)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(T)):T===96&&T===a?n(T):(t.consume(T),p)}function g(T){return t.attempt(i,S,y)(T)}function y(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),v}function v(T){return s>0&&wn(T)?dn(t,b,"linePrefix",s+1)(T):b(T)}function b(T){return T===null||_t(T)?t.check(nne,g,S)(T):(t.enter("codeFlowValue"),_(T))}function _(T){return T===null||_t(T)?(t.exit("codeFlowValue"),b(T)):(t.consume(T),_)}function S(T){return t.exit("codeFenced"),e(T)}function k(T,E,C){let R=0;return M;function M(re){return T.enter("lineEnding"),T.consume(re),T.exit("lineEnding"),D}function D(re){return T.enter("codeFencedFence"),wn(re)?dn(T,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(re):P(re)}function P(re){return re===a?(T.enter("codeFencedFenceSequence"),z(re)):C(re)}function z(re){return re===a?(R++,T.consume(re),z):R>=o?(T.exit("codeFencedFenceSequence"),wn(re)?dn(T,Z,"whitespace")(re):Z(re)):C(re)}function Z(re){return re===null||_t(re)?(T.exit("codeFencedFence"),E(re)):C(re)}}}function cat(t,e,n){const r=this;return i;function i(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const cO={name:"codeIndented",tokenize:dat},uat={partial:!0,tokenize:hat};function dat(t,e,n){const r=this;return i;function i(c){return t.enter("codeIndented"),dn(t,s,"linePrefix",5)(c)}function s(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):_t(c)?t.attempt(uat,o,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||_t(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function hat(t,e,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):_t(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):dn(t,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):_t(o)?i(o):n(o)}}const fat={name:"codeText",previous:mat,resolve:pat,tokenize:gat};function pat(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function mat(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function gat(t,e,n){let r=0,i,s;return o;function o(d){return t.enter("codeText"),t.enter("codeTextSequence"),a(d)}function a(d){return d===96?(t.consume(d),r++,a):(t.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),l):d===96?(s=t.enter("codeTextSequence"),i=0,u(d)):_t(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),l):(t.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||_t(d)?(t.exit("codeTextData"),l(d)):(t.consume(d),c)}function u(d){return d===96?(t.consume(d),i++,u):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(s.type="codeTextData",c(d))}}class yat{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&e4(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),e4(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),e4(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);e4(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);e4(this.left,n.reverse())}}}function e4(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function kxe(t){const e={};let n=-1,r,i,s,o,a,l,c;const u=new yat(t);for(;++n<u.length;){for(;n in e;)n=e[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,vat(u,n)),n=e[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=u.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},a=u.slice(i,n),a.unshift(r),u.splice(i,n-i+1,a))}}return Ja(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function vat(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let u,d,h=-1,f=n,p=0,g=0;const y=[g];for(;f;){for(;t.get(++i)[1]!==f;);s.push(i),f._tokenizer||(u=r.sliceStream(f),f.next||u.push(null),d&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=f,f=f.next}for(f=n;++h<a.length;)a[h][0]==="exit"&&a[h-1][0]==="enter"&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[h][1].end.line&&(g=h+1,y.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):y.pop(),h=y.length;h--;){const v=a.slice(y[h],y[h+1]),b=s.pop();l.push([b,b+v.length-1]),t.splice(b,2,v)}for(l.reverse(),h=-1;++h<l.length;)c[p+l[h][0]]=p+l[h][1],p+=l[h][1]-l[h][0]-1;return c}const bat={resolve:xat,tokenize:_at},wat={partial:!0,tokenize:Sat};function xat(t){return kxe(t),t}function _at(t,e){let n;return r;function r(a){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):_t(a)?t.check(wat,o,s)(a):(t.consume(a),i)}function s(a){return t.exit("chunkContent"),t.exit("content"),e(a)}function o(a){return t.consume(a),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function Sat(t,e,n){const r=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),dn(t,s,"linePrefix")}function s(o){if(o===null||_t(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):t.interrupt(r.parser.constructs.flow,n,e)(o)}}function Cxe(t,e,n,r,i,s,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(v){return v===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(v),t.exit(s),h):v===null||v===32||v===41||e8(v)?n(v):(t.enter(r),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),g(v))}function h(v){return v===62?(t.enter(s),t.consume(v),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),f(v))}function f(v){return v===62?(t.exit("chunkString"),t.exit(a),h(v)):v===null||v===60||_t(v)?n(v):(t.consume(v),v===92?p:f)}function p(v){return v===60||v===62||v===92?(t.consume(v),f):f(v)}function g(v){return!u&&(v===null||v===41||wr(v))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(r),e(v)):u<c&&v===40?(t.consume(v),u++,g):v===41?(t.consume(v),u--,g):v===null||v===32||v===40||e8(v)?n(v):(t.consume(v),v===92?y:g)}function y(v){return v===40||v===41||v===92?(t.consume(v),g):g(v)}}function Exe(t,e,n,r,i,s){const o=this;let a=0,l;return c;function c(f){return t.enter(r),t.enter(i),t.consume(f),t.exit(i),t.enter(s),u}function u(f){return a>999||f===null||f===91||f===93&&!l||f===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(f):f===93?(t.exit(s),t.enter(i),t.consume(f),t.exit(i),t.exit(r),e):_t(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||_t(f)||a++>999?(t.exit("chunkString"),u(f)):(t.consume(f),l||(l=!wn(f)),f===92?h:d)}function h(f){return f===91||f===92||f===93?(t.consume(f),a++,d):d(f)}}function Txe(t,e,n,r,i,s){let o;return a;function a(h){return h===34||h===39||h===40?(t.enter(r),t.enter(i),t.consume(h),t.exit(i),o=h===40?41:h,l):n(h)}function l(h){return h===o?(t.enter(i),t.consume(h),t.exit(i),t.exit(r),e):(t.enter(s),c(h))}function c(h){return h===o?(t.exit(s),l(o)):h===null?n(h):_t(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),dn(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===o||h===null||_t(h)?(t.exit("chunkString"),c(h)):(t.consume(h),h===92?d:u)}function d(h){return h===o||h===92?(t.consume(h),u):u(h)}}function F_(t,e){let n;return r;function r(i){return _t(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):wn(i)?dn(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const kat={name:"definition",tokenize:Eat},Cat={partial:!0,tokenize:Tat};function Eat(t,e,n){const r=this;let i;return s;function s(f){return t.enter("definition"),o(f)}function o(f){return Exe.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return i=Bc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(t.enter("definitionMarker"),t.consume(f),t.exit("definitionMarker"),l):n(f)}function l(f){return wr(f)?F_(t,c)(f):c(f)}function c(f){return Cxe(t,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function u(f){return t.attempt(Cat,d,d)(f)}function d(f){return wn(f)?dn(t,h,"whitespace")(f):h(f)}function h(f){return f===null||_t(f)?(t.exit("definition"),r.parser.defined.push(i),e(f)):n(f)}}function Tat(t,e,n){return r;function r(a){return wr(a)?F_(t,i)(a):n(a)}function i(a){return Txe(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return wn(a)?dn(t,o,"whitespace")(a):o(a)}function o(a){return a===null||_t(a)?e(a):n(a)}}const Aat={name:"hardBreakEscape",tokenize:Iat};function Iat(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return _t(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const Rat={name:"headingAtx",resolve:Mat,tokenize:Nat};function Mat(t,e){let n=t.length-2,r=3,i,s;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},s={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},Ja(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function Nat(t,e,n){let r=0;return i;function i(u){return t.enter("atxHeading"),s(u)}function s(u){return t.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(t.consume(u),o):u===null||wr(u)?(t.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||_t(u)?(t.exit("atxHeading"),e(u)):wn(u)?dn(t,a,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||wr(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),c)}}const Oat=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ine=["pre","script","style","textarea"],Dat={concrete:!0,name:"htmlFlow",resolveTo:zat,tokenize:jat},Pat={partial:!0,tokenize:Fat},Lat={partial:!0,tokenize:Bat};function zat(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function jat(t,e,n){const r=this;let i,s,o,a,l;return c;function c($){return u($)}function u($){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume($),d}function d($){return $===33?(t.consume($),h):$===47?(t.consume($),s=!0,g):$===63?(t.consume($),i=3,r.interrupt?e:B):Eo($)?(t.consume($),o=String.fromCharCode($),y):n($)}function h($){return $===45?(t.consume($),i=2,f):$===91?(t.consume($),i=5,a=0,p):Eo($)?(t.consume($),i=4,r.interrupt?e:B):n($)}function f($){return $===45?(t.consume($),r.interrupt?e:B):n($)}function p($){const Re="CDATA[";return $===Re.charCodeAt(a++)?(t.consume($),a===Re.length?r.interrupt?e:P:p):n($)}function g($){return Eo($)?(t.consume($),o=String.fromCharCode($),y):n($)}function y($){if($===null||$===47||$===62||wr($)){const Re=$===47,ke=o.toLowerCase();return!Re&&!s&&ine.includes(ke)?(i=1,r.interrupt?e($):P($)):Oat.includes(o.toLowerCase())?(i=6,Re?(t.consume($),v):r.interrupt?e($):P($)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n($):s?b($):_($))}return $===45||da($)?(t.consume($),o+=String.fromCharCode($),y):n($)}function v($){return $===62?(t.consume($),r.interrupt?e:P):n($)}function b($){return wn($)?(t.consume($),b):M($)}function _($){return $===47?(t.consume($),M):$===58||$===95||Eo($)?(t.consume($),S):wn($)?(t.consume($),_):M($)}function S($){return $===45||$===46||$===58||$===95||da($)?(t.consume($),S):k($)}function k($){return $===61?(t.consume($),T):wn($)?(t.consume($),k):_($)}function T($){return $===null||$===60||$===61||$===62||$===96?n($):$===34||$===39?(t.consume($),l=$,E):wn($)?(t.consume($),T):C($)}function E($){return $===l?(t.consume($),l=null,R):$===null||_t($)?n($):(t.consume($),E)}function C($){return $===null||$===34||$===39||$===47||$===60||$===61||$===62||$===96||wr($)?k($):(t.consume($),C)}function R($){return $===47||$===62||wn($)?_($):n($)}function M($){return $===62?(t.consume($),D):n($)}function D($){return $===null||_t($)?P($):wn($)?(t.consume($),D):n($)}function P($){return $===45&&i===2?(t.consume($),G):$===60&&i===1?(t.consume($),ee):$===62&&i===4?(t.consume($),$e):$===63&&i===3?(t.consume($),B):$===93&&i===5?(t.consume($),oe):_t($)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(Pat,Ye,z)($)):$===null||_t($)?(t.exit("htmlFlowData"),z($)):(t.consume($),P)}function z($){return t.check(Lat,Z,Ye)($)}function Z($){return t.enter("lineEnding"),t.consume($),t.exit("lineEnding"),re}function re($){return $===null||_t($)?z($):(t.enter("htmlFlowData"),P($))}function G($){return $===45?(t.consume($),B):P($)}function ee($){return $===47?(t.consume($),o="",J):P($)}function J($){if($===62){const Re=o.toLowerCase();return ine.includes(Re)?(t.consume($),$e):P($)}return Eo($)&&o.length<8?(t.consume($),o+=String.fromCharCode($),J):P($)}function oe($){return $===93?(t.consume($),B):P($)}function B($){return $===62?(t.consume($),$e):$===45&&i===2?(t.consume($),B):P($)}function $e($){return $===null||_t($)?(t.exit("htmlFlowData"),Ye($)):(t.consume($),$e)}function Ye($){return t.exit("htmlFlow"),e($)}}function Bat(t,e,n){const r=this;return i;function i(o){return _t(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function Fat(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(O3,e,n)}}const Vat={name:"htmlText",tokenize:$at};function $at(t,e,n){const r=this;let i,s,o;return a;function a(B){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(B),l}function l(B){return B===33?(t.consume(B),c):B===47?(t.consume(B),k):B===63?(t.consume(B),_):Eo(B)?(t.consume(B),C):n(B)}function c(B){return B===45?(t.consume(B),u):B===91?(t.consume(B),s=0,p):Eo(B)?(t.consume(B),b):n(B)}function u(B){return B===45?(t.consume(B),f):n(B)}function d(B){return B===null?n(B):B===45?(t.consume(B),h):_t(B)?(o=d,ee(B)):(t.consume(B),d)}function h(B){return B===45?(t.consume(B),f):d(B)}function f(B){return B===62?G(B):B===45?h(B):d(B)}function p(B){const $e="CDATA[";return B===$e.charCodeAt(s++)?(t.consume(B),s===$e.length?g:p):n(B)}function g(B){return B===null?n(B):B===93?(t.consume(B),y):_t(B)?(o=g,ee(B)):(t.consume(B),g)}function y(B){return B===93?(t.consume(B),v):g(B)}function v(B){return B===62?G(B):B===93?(t.consume(B),v):g(B)}function b(B){return B===null||B===62?G(B):_t(B)?(o=b,ee(B)):(t.consume(B),b)}function _(B){return B===null?n(B):B===63?(t.consume(B),S):_t(B)?(o=_,ee(B)):(t.consume(B),_)}function S(B){return B===62?G(B):_(B)}function k(B){return Eo(B)?(t.consume(B),T):n(B)}function T(B){return B===45||da(B)?(t.consume(B),T):E(B)}function E(B){return _t(B)?(o=E,ee(B)):wn(B)?(t.consume(B),E):G(B)}function C(B){return B===45||da(B)?(t.consume(B),C):B===47||B===62||wr(B)?R(B):n(B)}function R(B){return B===47?(t.consume(B),G):B===58||B===95||Eo(B)?(t.consume(B),M):_t(B)?(o=R,ee(B)):wn(B)?(t.consume(B),R):G(B)}function M(B){return B===45||B===46||B===58||B===95||da(B)?(t.consume(B),M):D(B)}function D(B){return B===61?(t.consume(B),P):_t(B)?(o=D,ee(B)):wn(B)?(t.consume(B),D):R(B)}function P(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(t.consume(B),i=B,z):_t(B)?(o=P,ee(B)):wn(B)?(t.consume(B),P):(t.consume(B),Z)}function z(B){return B===i?(t.consume(B),i=void 0,re):B===null?n(B):_t(B)?(o=z,ee(B)):(t.consume(B),z)}function Z(B){return B===null||B===34||B===39||B===60||B===61||B===96?n(B):B===47||B===62||wr(B)?R(B):(t.consume(B),Z)}function re(B){return B===47||B===62||wr(B)?R(B):n(B)}function G(B){return B===62?(t.consume(B),t.exit("htmlTextData"),t.exit("htmlText"),e):n(B)}function ee(B){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(B),t.exit("lineEnding"),J}function J(B){return wn(B)?dn(t,oe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):oe(B)}function oe(B){return t.enter("htmlTextData"),o(B)}}const HU={name:"labelEnd",resolveAll:Wat,resolveTo:Gat,tokenize:Kat},Hat={tokenize:Yat},Uat={tokenize:Zat},qat={tokenize:Xat};function Wat(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",e+=i}}return t.length!==n.length&&Ja(t,0,t.length,n),t}function Gat(t,e){let n=t.length,r=0,i,s,o,a;for(;n--;)if(i=t[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const l={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[s][1].start},end:{...t[o][1].end}},u={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[o-2][1].start}};return a=[["enter",l,e],["enter",c,e]],a=Rl(a,t.slice(s+1,s+r+3)),a=Rl(a,[["enter",u,e]]),a=Rl(a,GI(e.parser.constructs.insideSpan.null,t.slice(s+r+4,o-3),e)),a=Rl(a,[["exit",u,e],t[o-2],t[o-1],["exit",c,e]]),a=Rl(a,t.slice(o+1)),a=Rl(a,[["exit",l,e]]),Ja(t,s,t.length,a),t}function Kat(t,e,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return a;function a(h){return s?s._inactive?d(h):(o=r.parser.defined.includes(Bc(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(h),t.exit("labelMarker"),t.exit("labelEnd"),l):n(h)}function l(h){return h===40?t.attempt(Hat,u,o?u:d)(h):h===91?t.attempt(Uat,u,o?c:d)(h):o?u(h):d(h)}function c(h){return t.attempt(qat,u,d)(h)}function u(h){return e(h)}function d(h){return s._balanced=!0,n(h)}}function Yat(t,e,n){return r;function r(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),i}function i(d){return wr(d)?F_(t,s)(d):s(d)}function s(d){return d===41?u(d):Cxe(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return wr(d)?F_(t,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?Txe(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return wr(d)?F_(t,u)(d):u(d)}function u(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):n(d)}}function Zat(t,e,n){const r=this;return i;function i(a){return Exe.call(r,t,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(Bc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(a):n(a)}function o(a){return n(a)}}function Xat(t,e,n){return r;function r(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),i}function i(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):n(s)}}const Qat={name:"labelStartImage",resolveAll:HU.resolveAll,tokenize:Jat};function Jat(t,e,n){const r=this;return i;function i(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),s}function s(a){return a===91?(t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}const elt={name:"labelStartLink",resolveAll:HU.resolveAll,tokenize:tlt};function tlt(t,e,n){const r=this;return i;function i(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):e(o)}}const uO={name:"lineEnding",tokenize:nlt};function nlt(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),dn(t,e,"linePrefix")}}const m6={name:"thematicBreak",tokenize:rlt};function rlt(t,e,n){let r=0,i;return s;function s(c){return t.enter("thematicBreak"),o(c)}function o(c){return i=c,a(c)}function a(c){return c===i?(t.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||_t(c))?(t.exit("thematicBreak"),e(c)):n(c)}function l(c){return c===i?(t.consume(c),r++,l):(t.exit("thematicBreakSequence"),wn(c)?dn(t,a,"whitespace")(c):a(c))}}const Ko={continuation:{tokenize:alt},exit:clt,name:"list",tokenize:olt},ilt={partial:!0,tokenize:ult},slt={partial:!0,tokenize:llt};function olt(t,e,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(f){const p=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:bj(f)){if(r.containerState.type||(r.containerState.type=p,t.enter(p,{_container:!0})),p==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(m6,n,c)(f):c(f);if(!r.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(f)}return n(f)}function l(f){return bj(f)&&++o<10?(t.consume(f),l):(!r.interrupt||o<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),c(f)):n(f)}function c(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,t.check(O3,r.interrupt?n:u,t.attempt(ilt,h,d))}function u(f){return r.containerState.initialBlankLine=!0,s++,h(f)}function d(f){return wn(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),h):n(f)}function h(f){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}function alt(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(O3,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,dn(t,e,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!wn(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(slt,e,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,dn(t,t.attempt(Ko,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function llt(t,e,n){const r=this;return dn(t,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?e(s):n(s)}}function clt(t){t.exit(this.containerState.type)}function ult(t,e,n){const r=this;return dn(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!wn(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const sne={name:"setextUnderline",resolveTo:dlt,tokenize:hlt};function dlt(t,e){let n=t.length,r,i,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!s&&t[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",o,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=o,t.push(["exit",o,e]),t}function hlt(t,e,n){const r=this;let i;return s;function s(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(t.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),wn(c)?dn(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||_t(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const flt={tokenize:plt};function plt(t){const e=this,n=t.attempt(O3,r,t.attempt(this.parser.constructs.flowInitial,i,dn(t,t.attempt(this.parser.constructs.flow,i,t.attempt(bat,i)),"linePrefix")));return n;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const mlt={resolveAll:Ixe()},glt=Axe("string"),ylt=Axe("text");function Axe(t){return{resolveAll:Ixe(t==="text"?vlt:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,o,a);return o;function o(u){return c(u)?s(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),s(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=i[u];let h=-1;if(d)for(;++h<d.length;){const f=d[h];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function Ixe(t){return e;function e(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(n,r):n}}function vlt(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],i=e.sliceStream(r);let s=i.length,o=-1,a=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(a=0),a){const c={type:n===t.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}const blt={42:Ko,43:Ko,45:Ko,48:Ko,49:Ko,50:Ko,51:Ko,52:Ko,53:Ko,54:Ko,55:Ko,56:Ko,57:Ko,62:xxe},wlt={91:kat},xlt={[-2]:cO,[-1]:cO,32:cO},_lt={35:Rat,42:m6,45:[sne,m6],60:Dat,61:sne,95:m6,96:rne,126:rne},Slt={38:Sxe,92:_xe},klt={[-5]:uO,[-4]:uO,[-3]:uO,33:Qat,38:Sxe,42:wj,60:[eat,Vat],91:elt,92:[Aat,_xe],93:HU,95:wj,96:fat},Clt={null:[wj,mlt]},Elt={null:[42,95]},Tlt={null:[]},Alt=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Elt,contentInitial:wlt,disable:Tlt,document:blt,flow:_lt,flowInitial:xlt,insideSpan:Clt,string:Slt,text:klt},Symbol.toStringTag,{value:"Module"}));function Ilt(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let o=[],a=[];const l={attempt:E(k),check:E(T),consume:b,enter:_,exit:S,interrupt:E(T,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:p,parser:t,previous:null,sliceSerialize:h,sliceStream:f,write:d};let u=e.tokenize.call(c,l);return e.resolveAll&&s.push(e),c;function d(D){return o=Rl(o,D),y(),o[o.length-1]!==null?[]:(C(e,0),c.events=GI(s,c.events,c),c.events)}function h(D,P){return Mlt(f(D),P)}function f(D){return Rlt(o,D)}function p(){const{_bufferIndex:D,_index:P,line:z,column:Z,offset:re}=r;return{_bufferIndex:D,_index:P,line:z,column:Z,offset:re}}function g(D){i[D.line]=D.column,M()}function y(){let D;for(;r._index<o.length;){const P=o[r._index];if(typeof P=="string")for(D=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===D&&r._bufferIndex<P.length;)v(P.charCodeAt(r._bufferIndex));else v(P)}}function v(D){u=u(D)}function b(D){_t(D)?(r.line++,r.column=1,r.offset+=D===-3?2:1,M()):D!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=D}function _(D,P){const z=P||{};return z.type=D,z.start=p(),c.events.push(["enter",z,c]),a.push(z),z}function S(D){const P=a.pop();return P.end=p(),c.events.push(["exit",P,c]),P}function k(D,P){C(D,P.from)}function T(D,P){P.restore()}function E(D,P){return z;function z(Z,re,G){let ee,J,oe,B;return Array.isArray(Z)?Ye(Z):"tokenize"in Z?Ye([Z]):$e(Z);function $e(Me){return _e;function _e(Ne){const Ue=Ne!==null&&Me[Ne],at=Ne!==null&&Me.null,ct=[...Array.isArray(Ue)?Ue:Ue?[Ue]:[],...Array.isArray(at)?at:at?[at]:[]];return Ye(ct)(Ne)}}function Ye(Me){return ee=Me,J=0,Me.length===0?G:$(Me[J])}function $(Me){return _e;function _e(Ne){return B=R(),oe=Me,Me.partial||(c.currentConstruct=Me),Me.name&&c.parser.constructs.disable.null.includes(Me.name)?ke():Me.tokenize.call(P?Object.assign(Object.create(c),P):c,l,Re,ke)(Ne)}}function Re(Me){return D(oe,B),re}function ke(Me){return B.restore(),++J<ee.length?$(ee[J]):G}}}function C(D,P){D.resolveAll&&!s.includes(D)&&s.push(D),D.resolve&&Ja(c.events,P,c.events.length-P,D.resolve(c.events.slice(P),c)),D.resolveTo&&(c.events=D.resolveTo(c.events,c))}function R(){const D=p(),P=c.previous,z=c.currentConstruct,Z=c.events.length,re=Array.from(a);return{from:Z,restore:G};function G(){r=D,c.previous=P,c.currentConstruct=z,c.events.length=Z,a=re,M()}}function M(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Rlt(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let o;if(n===i)o=[t[n].slice(r,s)];else{if(o=t.slice(n,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function Mlt(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const s=t[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
|
||
`;break}case-3:{o=`\r
|
||
`;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function Nlt(t){const r={constructs:bxe([Alt,...(t||{}).extensions||[]]),content:i(Got),defined:[],document:i(Yot),flow:i(flt),lazy:{},string:i(glt),text:i(ylt)};return r;function i(s){return o;function o(a){return Ilt(r,s,a)}}}function Olt(t){for(;!kxe(t););return t}const one=/[\0\t\n\r]/g;function Dlt(){let t=1,e="",n=!0,r;return i;function i(s,o,a){const l=[];let c,u,d,h,f;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),d=0,e="",n&&(s.charCodeAt(0)===65279&&d++,n=void 0);d<s.length;){if(one.lastIndex=d,c=one.exec(s),h=c&&c.index!==void 0?c.index:s.length,f=s.charCodeAt(h),!c){e=s.slice(d);break}if(f===10&&d===h&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<h&&(l.push(s.slice(d,h)),t+=h-d),f){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:r=!0,t=1}d=h+1}return a&&(r&&l.push(-5),e&&l.push(e),l.push(null)),l}}const Plt=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Rxe(t){return t.replace(Plt,Llt)}function Llt(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return wxe(n.slice(s?2:1),s?16:10)}return $U(n)||t}function V_(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?ane(t.position):"start"in t||"end"in t?ane(t):"line"in t||"column"in t?xj(t):""}function xj(t){return lne(t&&t.line)+":"+lne(t&&t.column)}function ane(t){return xj(t&&t.start)+"-"+xj(t&&t.end)}function lne(t){return t&&typeof t=="number"?t:1}const Mxe={}.hasOwnProperty;function zlt(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),jlt(n)(Olt(Nlt(n).document().write(Dlt()(t,e,!0))))}function jlt(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(he),autolinkProtocol:R,autolinkEmail:R,atxHeading:s(me),blockQuote:s(at),characterEscape:R,characterReference:R,codeFenced:s(ct),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(ct,o),codeText:s(H,o),codeTextData:R,data:R,codeFlowValue:R,definition:s(Y),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(se),hardBreakEscape:s(de),hardBreakTrailing:s(de),htmlFlow:s(ie,o),htmlFlowData:R,htmlText:s(ie,o),htmlTextData:R,image:s(Te),label:o,link:s(he),listItem:s(ye),listItemValue:h,listOrdered:s(we,d),listUnordered:s(we),paragraph:s(Ge),reference:$,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(me),strong:s(Pe),thematicBreak:s(ft)},exit:{atxHeading:l(),atxHeadingSequence:k,autolink:l(),autolinkEmail:Ue,autolinkProtocol:Ne,blockQuote:l(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:ke,characterReferenceMarkerNumeric:ke,characterReferenceValue:Me,characterReference:_e,codeFenced:l(y),codeFencedFence:g,codeFencedFenceInfo:f,codeFencedFenceMeta:p,codeFlowValue:M,codeIndented:l(v),codeText:l(re),codeTextData:M,data:M,definition:l(),definitionDestinationString:S,definitionLabelString:b,definitionTitleString:_,emphasis:l(),hardBreakEscape:l(P),hardBreakTrailing:l(P),htmlFlow:l(z),htmlFlowData:M,htmlText:l(Z),htmlTextData:M,image:l(ee),label:oe,labelText:J,lineEnding:D,link:l(G),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:Re,resourceDestinationString:B,resourceTitleString:$e,resource:Ye,setextHeading:l(C),setextHeadingLineSequence:E,setextHeadingText:T,strong:l(),thematicBreak:l()}};Nxe(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(ne){let fe={type:"root",children:[]};const Le={stack:[fe],tokenStack:[],config:e,enter:a,exit:c,buffer:o,resume:u,data:n},Ze=[];let rt=-1;for(;++rt<ne.length;)if(ne[rt][1].type==="listOrdered"||ne[rt][1].type==="listUnordered")if(ne[rt][0]==="enter")Ze.push(rt);else{const un=Ze.pop();rt=i(ne,un,rt)}for(rt=-1;++rt<ne.length;){const un=e[ne[rt][0]];Mxe.call(un,ne[rt][1].type)&&un[ne[rt][1].type].call(Object.assign({sliceSerialize:ne[rt][2].sliceSerialize},Le),ne[rt][1])}if(Le.tokenStack.length>0){const un=Le.tokenStack[Le.tokenStack.length-1];(un[1]||cne).call(Le,void 0,un[0])}for(fe.position={start:Zf(ne.length>0?ne[0][1].start:{line:1,column:1,offset:0}),end:Zf(ne.length>0?ne[ne.length-2][1].end:{line:1,column:1,offset:0})},rt=-1;++rt<e.transforms.length;)fe=e.transforms[rt](fe)||fe;return fe}function i(ne,fe,Le){let Ze=fe-1,rt=-1,un=!1,Yt,_n,kr,In;for(;++Ze<=Le;){const Vt=ne[Ze];switch(Vt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Vt[0]==="enter"?rt++:rt--,In=void 0;break}case"lineEndingBlank":{Vt[0]==="enter"&&(Yt&&!In&&!rt&&!kr&&(kr=Ze),In=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:In=void 0}if(!rt&&Vt[0]==="enter"&&Vt[1].type==="listItemPrefix"||rt===-1&&Vt[0]==="exit"&&(Vt[1].type==="listUnordered"||Vt[1].type==="listOrdered")){if(Yt){let zr=Ze;for(_n=void 0;zr--;){const Ee=ne[zr];if(Ee[1].type==="lineEnding"||Ee[1].type==="lineEndingBlank"){if(Ee[0]==="exit")continue;_n&&(ne[_n][1].type="lineEndingBlank",un=!0),Ee[1].type="lineEnding",_n=zr}else if(!(Ee[1].type==="linePrefix"||Ee[1].type==="blockQuotePrefix"||Ee[1].type==="blockQuotePrefixWhitespace"||Ee[1].type==="blockQuoteMarker"||Ee[1].type==="listItemIndent"))break}kr&&(!_n||kr<_n)&&(Yt._spread=!0),Yt.end=Object.assign({},_n?ne[_n][1].start:Vt[1].end),ne.splice(_n||Ze,0,["exit",Yt,Vt[2]]),Ze++,Le++}if(Vt[1].type==="listItemPrefix"){const zr={type:"listItem",_spread:!1,start:Object.assign({},Vt[1].start),end:void 0};Yt=zr,ne.splice(Ze,0,["enter",zr,Vt[2]]),Ze++,Le++,kr=void 0,In=!0}}}return ne[fe][1]._spread=un,Le}function s(ne,fe){return Le;function Le(Ze){a.call(this,ne(Ze),Ze),fe&&fe.call(this,Ze)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(ne,fe,Le){this.stack[this.stack.length-1].children.push(ne),this.stack.push(ne),this.tokenStack.push([fe,Le||void 0]),ne.position={start:Zf(fe.start),end:void 0}}function l(ne){return fe;function fe(Le){ne&&ne.call(this,Le),c.call(this,Le)}}function c(ne,fe){const Le=this.stack.pop(),Ze=this.tokenStack.pop();if(Ze)Ze[0].type!==ne.type&&(fe?fe.call(this,ne,Ze[0]):(Ze[1]||cne).call(this,ne,Ze[0]));else throw new Error("Cannot close `"+ne.type+"` ("+V_({start:ne.start,end:ne.end})+"): it’s not open");Le.position.end=Zf(ne.end)}function u(){return VU(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function h(ne){if(this.data.expectingFirstListItemValue){const fe=this.stack[this.stack.length-2];fe.start=Number.parseInt(this.sliceSerialize(ne),10),this.data.expectingFirstListItemValue=void 0}}function f(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.lang=ne}function p(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.meta=ne}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.value=ne.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.value=ne.replace(/(\r?\n|\r)$/g,"")}function b(ne){const fe=this.resume(),Le=this.stack[this.stack.length-1];Le.label=fe,Le.identifier=Bc(this.sliceSerialize(ne)).toLowerCase()}function _(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.title=ne}function S(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.url=ne}function k(ne){const fe=this.stack[this.stack.length-1];if(!fe.depth){const Le=this.sliceSerialize(ne).length;fe.depth=Le}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function E(ne){const fe=this.stack[this.stack.length-1];fe.depth=this.sliceSerialize(ne).codePointAt(0)===61?1:2}function C(){this.data.setextHeadingSlurpLineEnding=void 0}function R(ne){const Le=this.stack[this.stack.length-1].children;let Ze=Le[Le.length-1];(!Ze||Ze.type!=="text")&&(Ze=tt(),Ze.position={start:Zf(ne.start),end:void 0},Le.push(Ze)),this.stack.push(Ze)}function M(ne){const fe=this.stack.pop();fe.value+=this.sliceSerialize(ne),fe.position.end=Zf(ne.end)}function D(ne){const fe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Le=fe.children[fe.children.length-1];Le.position.end=Zf(ne.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(fe.type)&&(R.call(this,ne),M.call(this,ne))}function P(){this.data.atHardBreak=!0}function z(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.value=ne}function Z(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.value=ne}function re(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.value=ne}function G(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=fe,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function ee(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=fe,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function J(ne){const fe=this.sliceSerialize(ne),Le=this.stack[this.stack.length-2];Le.label=Rxe(fe),Le.identifier=Bc(fe).toLowerCase()}function oe(){const ne=this.stack[this.stack.length-1],fe=this.resume(),Le=this.stack[this.stack.length-1];if(this.data.inReference=!0,Le.type==="link"){const Ze=ne.children;Le.children=Ze}else Le.alt=fe}function B(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.url=ne}function $e(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.title=ne}function Ye(){this.data.inReference=void 0}function $(){this.data.referenceType="collapsed"}function Re(ne){const fe=this.resume(),Le=this.stack[this.stack.length-1];Le.label=fe,Le.identifier=Bc(this.sliceSerialize(ne)).toLowerCase(),this.data.referenceType="full"}function ke(ne){this.data.characterReferenceType=ne.type}function Me(ne){const fe=this.sliceSerialize(ne),Le=this.data.characterReferenceType;let Ze;Le?(Ze=wxe(fe,Le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ze=$U(fe);const rt=this.stack[this.stack.length-1];rt.value+=Ze}function _e(ne){const fe=this.stack.pop();fe.position.end=Zf(ne.end)}function Ne(ne){M.call(this,ne);const fe=this.stack[this.stack.length-1];fe.url=this.sliceSerialize(ne)}function Ue(ne){M.call(this,ne);const fe=this.stack[this.stack.length-1];fe.url="mailto:"+this.sliceSerialize(ne)}function at(){return{type:"blockquote",children:[]}}function ct(){return{type:"code",lang:null,meta:null,value:""}}function H(){return{type:"inlineCode",value:""}}function Y(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function se(){return{type:"emphasis",children:[]}}function me(){return{type:"heading",depth:0,children:[]}}function de(){return{type:"break"}}function ie(){return{type:"html",value:""}}function Te(){return{type:"image",title:null,url:"",alt:null}}function he(){return{type:"link",title:null,url:"",children:[]}}function we(ne){return{type:"list",ordered:ne.type==="listOrdered",start:null,spread:ne._spread,children:[]}}function ye(ne){return{type:"listItem",spread:ne._spread,checked:null,children:[]}}function Ge(){return{type:"paragraph",children:[]}}function Pe(){return{type:"strong",children:[]}}function tt(){return{type:"text",value:""}}function ft(){return{type:"thematicBreak"}}}function Zf(t){return{line:t.line,column:t.column,offset:t.offset}}function Nxe(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?Nxe(t,r):Blt(t,r)}}function Blt(t,e){let n;for(n in e)if(Mxe.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function cne(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+V_({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+V_({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+V_({start:e.start,end:e.end})+") is still open")}function _j(t){const e=this;e.parser=n;function n(r){return zlt(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}const une={}.hasOwnProperty;function Flt(t,e){const n=e||{};function r(i,...s){let o=r.invalid;const a=r.handlers;if(i&&une.call(i,t)){const l=String(i[t]);o=une.call(a,l)?a[l]:r.unknown}if(o)return o.call(this,i,...s)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const Vlt={}.hasOwnProperty;function Oxe(t,e){let n=-1,r;if(e.extensions)for(;++n<e.extensions.length;)Oxe(t,e.extensions[n]);for(r in e)if(Vlt.call(e,r))switch(r){case"extensions":break;case"unsafe":{dne(t[r],e[r]);break}case"join":{dne(t[r],e[r]);break}case"handlers":{$lt(t[r],e[r]);break}default:t.options[r]=e[r]}return t}function dne(t,e){e&&t.push(...e)}function $lt(t,e){e&&Object.assign(t,e)}function Hlt(t,e,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const o=n.indentLines(n.containerFlow(t,s.current()),Ult);return i(),o}function Ult(t,e,n){return">"+(n?"":" ")+t}function Dxe(t,e){return hne(t,e.inConstruct,!0)&&!hne(t,e.notInConstruct,!1)}function hne(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++r<e.length;)if(t.includes(e[r]))return!0;return!1}function fne(t,e,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
||
`&&Dxe(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
||
`}function Pxe(t,e){const n=String(t);let r=n.indexOf(e),i=r,s=0,o=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>o&&(o=s):s=1,i=r+e.length,r=n.indexOf(e,i);return o}function Sj(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function qlt(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function Wlt(t,e,n,r){const i=qlt(n),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(Sj(t,n)){const d=n.enter("codeIndented"),h=n.indentLines(s,Glt);return d(),h}const a=n.createTracker(r),l=i.repeat(Math.max(Pxe(s,i)+1,3)),c=n.enter("codeFenced");let u=a.move(l);if(t.lang){const d=n.enter(`codeFencedLang${o}`);u+=a.move(n.safe(t.lang,{before:u,after:" ",encode:["`"],...a.current()})),d()}if(t.lang&&t.meta){const d=n.enter(`codeFencedMeta${o}`);u+=a.move(" "),u+=a.move(n.safe(t.meta,{before:u,after:`
|
||
`,encode:["`"],...a.current()})),d()}return u+=a.move(`
|
||
`),s&&(u+=a.move(s+`
|
||
`)),u+=a.move(l),c(),u}function Glt(t,e,n){return(n?"":" ")+t}function UU(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function Klt(t,e,n,r){const i=UU(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(t),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!t.url||/[\0- \u007F]/.test(t.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(t.url,{before:c,after:t.title?" ":`
|
||
`,...l.current()}))),a(),t.title&&(a=n.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(n.safe(t.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),o(),c}function Ylt(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function Zm(t){return"&#x"+t.toString(16).toUpperCase()+";"}function t8(t,e,n){const r=lx(t),i=lx(e);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Lxe.peek=Zlt;function Lxe(t,e,n,r){const i=Ylt(n),s=n.enter("emphasis"),o=n.createTracker(r),a=o.move(i);let l=o.move(n.containerPhrasing(t,{after:i,before:a,...o.current()}));const c=l.charCodeAt(0),u=t8(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(l=Zm(c)+l.slice(1));const d=l.charCodeAt(l.length-1),h=t8(r.after.charCodeAt(0),d,i);h.inside&&(l=l.slice(0,-1)+Zm(d));const f=o.move(i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},a+l+f}function Zlt(t,e,n){return n.options.emphasis||"*"}const KI=function(t){if(t==null)return ect;if(typeof t=="function")return YI(t);if(typeof t=="object")return Array.isArray(t)?Xlt(t):Qlt(t);if(typeof t=="string")return Jlt(t);throw new Error("Expected function, string, or object as test")};function Xlt(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=KI(t[n]);return YI(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function Qlt(t){const e=t;return YI(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function Jlt(t){return YI(e);function e(n){return n&&n.type===t}}function YI(t){return e;function e(n,r,i){return!!(tct(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function ect(){return!0}function tct(t){return t!==null&&typeof t=="object"&&"type"in t}const zxe=[],nct=!0,kj=!1,Cj="skip";function qU(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=KI(i),o=r?-1:1;a(t,void 0,[])();function a(l,c,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return h;function h(){let f=zxe,p,g,y;if((!e||s(l,c,u[u.length-1]||void 0))&&(f=rct(n(l,u)),f[0]===kj))return f;if("children"in l&&l.children){const v=l;if(v.children&&f[0]!==Cj)for(g=(r?v.children.length:-1)+o,y=u.concat(v);g>-1&&g<v.children.length;){const b=v.children[g];if(p=a(b,g,y)(),p[0]===kj)return p;g=typeof p[1]=="number"?p[1]:g+o}}return f}}}function rct(t){return Array.isArray(t)?t:typeof t=="number"?[nct,t]:t==null?zxe:[t]}function C0(t,e,n,r){let i,s,o;typeof e=="function"&&typeof n!="function"?(s=void 0,o=e,i=n):(s=e,o=n,i=r),qU(t,s,a,i);function a(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}function jxe(t,e){let n=!1;return C0(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,kj}),!!((!t.depth||t.depth<3)&&VU(t)&&(e.options.setext||n))}function ict(t,e,n,r){const i=Math.max(Math.min(6,t.depth||1),1),s=n.createTracker(r);if(jxe(t,n)){const u=n.enter("headingSetext"),d=n.enter("phrasing"),h=n.containerPhrasing(t,{...s.current(),before:`
|
||
`,after:`
|
||
`});return d(),u(),h+`
|
||
`+(i===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
|
||
`))+1))}const o="#".repeat(i),a=n.enter("headingAtx"),l=n.enter("phrasing");s.move(o+" ");let c=n.containerPhrasing(t,{before:"# ",after:`
|
||
`,...s.current()});return/^[\t ]/.test(c)&&(c=Zm(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),l(),a(),c}Bxe.peek=sct;function Bxe(t){return t.value||""}function sct(){return"<"}Fxe.peek=oct;function Fxe(t,e,n,r){const i=UU(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(t.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(t.url,{before:c,after:t.title?" ":")",...l.current()}))),a(),t.title&&(a=n.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(n.safe(t.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),c+=l.move(")"),o(),c}function oct(){return"!"}Vxe.peek=act;function Vxe(t,e,n,r){const i=t.referenceType,s=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const c=n.safe(t.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(t),{before:l,after:"]",...a.current()});return o(),n.stack=u,s(),i==="full"||!c||c!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function act(){return"!"}$xe.peek=lct;function $xe(t,e,n){let r=t.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const o=n.unsafe[s],a=n.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(r);){let c=l.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(l.index+1)}}return i+r+i}function lct(){return"`"}function Hxe(t,e){const n=VU(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}Uxe.peek=cct;function Uxe(t,e,n,r){const i=UU(n),s=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,l;if(Hxe(t,n)){const u=n.stack;n.stack=[],a=n.enter("autolink");let d=o.move("<");return d+=o.move(n.containerPhrasing(t,{before:d,after:">",...o.current()})),d+=o.move(">"),a(),n.stack=u,d}a=n.enter("link"),l=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(t,{before:c,after:"](",...o.current()})),c+=o.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(t.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(l=n.enter("destinationRaw"),c+=o.move(n.safe(t.url,{before:c,after:t.title?" ":")",...o.current()}))),l(),t.title&&(l=n.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(n.safe(t.title,{before:c,after:i,...o.current()})),c+=o.move(i),l()),c+=o.move(")"),a(),c}function cct(t,e,n){return Hxe(t,n)?"<":"["}qxe.peek=uct;function qxe(t,e,n,r){const i=t.referenceType,s=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const c=n.containerPhrasing(t,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(t),{before:l,after:"]",...a.current()});return o(),n.stack=u,s(),i==="full"||!c||c!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function uct(){return"["}function WU(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function dct(t){const e=WU(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function hct(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function Wxe(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function fct(t,e,n,r){const i=n.enter("list"),s=n.bulletCurrent;let o=t.ordered?hct(n):WU(n);const a=t.ordered?o==="."?")":".":dct(n);let l=e&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!t.ordered){const u=t.children?t.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),Wxe(n)===o&&u){let d=-1;for(;++d<t.children.length;){const h=t.children[d];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),n.bulletCurrent=o;const c=n.containerFlow(t,r);return n.bulletLastUsed=o,n.bulletCurrent=s,i(),c}function pct(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function mct(t,e,n,r){const i=pct(n);let s=n.bulletCurrent||WU(n);e&&e.type==="list"&&e.ordered&&(s=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(r);a.move(s+" ".repeat(o-s.length)),a.shift(o);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(t,a.current()),u);return l(),c;function u(d,h,f){return h?(f?"":" ".repeat(o))+d:(f?s:s+" ".repeat(o-s.length))+d}}function gct(t,e,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(t,r);return s(),i(),o}const yct=KI(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function vct(t,e,n,r){return(t.children.some(function(o){return yct(o)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function bct(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}Gxe.peek=wct;function Gxe(t,e,n,r){const i=bct(n),s=n.enter("strong"),o=n.createTracker(r),a=o.move(i+i);let l=o.move(n.containerPhrasing(t,{after:i,before:a,...o.current()}));const c=l.charCodeAt(0),u=t8(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(l=Zm(c)+l.slice(1));const d=l.charCodeAt(l.length-1),h=t8(r.after.charCodeAt(0),d,i);h.inside&&(l=l.slice(0,-1)+Zm(d));const f=o.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},a+l+f}function wct(t,e,n){return n.options.strong||"*"}function xct(t,e,n,r){return n.safe(t.value,r)}function _ct(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function Sct(t,e,n){const r=(Wxe(n)+(n.options.ruleSpaces?" ":"")).repeat(_ct(n));return n.options.ruleSpaces?r.slice(0,-1):r}const GU={blockquote:Hlt,break:fne,code:Wlt,definition:Klt,emphasis:Lxe,hardBreak:fne,heading:ict,html:Bxe,image:Fxe,imageReference:Vxe,inlineCode:$xe,link:Uxe,linkReference:qxe,list:fct,listItem:mct,paragraph:gct,root:vct,strong:Gxe,text:xct,thematicBreak:Sct},kct=[Cct];function Cct(t,e,n,r){if(e.type==="code"&&Sj(e,r)&&(t.type==="list"||t.type===e.type&&Sj(t,r)))return!1;if("spread"in n&&typeof n.spread=="boolean")return t.type==="paragraph"&&(t.type===e.type||e.type==="definition"||e.type==="heading"&&jxe(e,r))?void 0:n.spread?1:0}const G0=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],Ect=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:`
|
||
`,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:G0},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
|
||
]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:G0},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
|
||
*])`},{character:"*",inConstruct:"phrasing",notInConstruct:G0},{atBreak:!0,character:"+",after:`(?:[ \r
|
||
])`},{atBreak:!0,character:"-",after:`(?:[ \r
|
||
-])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r
|
||
]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:G0},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:G0},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:G0},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:G0},{atBreak:!0,character:"~"}];function Tct(t){return t.label||!t.identifier?t.label||"":Rxe(t.identifier)}function Act(t){if(!t._compiled){const e=(t.atBreak?"[\\r\\n][\\t ]*":"")+(t.before?"(?:"+t.before+")":"");t._compiled=new RegExp((e?"("+e+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(t.character)?"\\":"")+t.character+(t.after?"(?:"+t.after+")":""),"g")}return t._compiled}function Ict(t,e,n){const r=e.indexStack,i=t.children||[],s=[];let o=-1,a=n.before,l;r.push(-1);let c=e.createTracker(n);for(;++o<i.length;){const u=i[o];let d;if(r[r.length-1]=o,o+1<i.length){let p=e.handle.handlers[i[o+1].type];p&&p.peek&&(p=p.peek),d=p?p(i[o+1],t,e,{before:"",after:"",...c.current()}).charAt(0):""}else d=n.after;s.length>0&&(a==="\r"||a===`
|
||
`)&&u.type==="html"&&(s[s.length-1]=s[s.length-1].replace(/(\r?\n|\r)$/," "),a=" ",c=e.createTracker(n),c.move(s.join("")));let h=e.handle(u,t,e,{...c.current(),after:d,before:a});l&&l===h.slice(0,1)&&(h=Zm(l.charCodeAt(0))+h.slice(1));const f=e.attentionEncodeSurroundingInfo;e.attentionEncodeSurroundingInfo=void 0,l=void 0,f&&(s.length>0&&f.before&&a===s[s.length-1].slice(-1)&&(s[s.length-1]=s[s.length-1].slice(0,-1)+Zm(a.charCodeAt(0))),f.after&&(l=d)),c.move(h),s.push(h),a=h.slice(-1)}return r.pop(),s.join("")}function Rct(t,e,n){const r=e.indexStack,i=t.children||[],s=e.createTracker(n),o=[];let a=-1;for(r.push(-1);++a<i.length;){const l=i[a];r[r.length-1]=a,o.push(s.move(e.handle(l,t,e,{before:`
|
||
`,after:`
|
||
`,...s.current()}))),l.type!=="list"&&(e.bulletLastUsed=void 0),a<i.length-1&&o.push(s.move(Mct(l,i[a+1],t,e)))}return r.pop(),o.join("")}function Mct(t,e,n,r){let i=r.join.length;for(;i--;){const s=r.join[i](t,e,n,r);if(s===!0||s===1)break;if(typeof s=="number")return`
|
||
`.repeat(1+s);if(s===!1)return`
|
||
|
||
<!---->
|
||
|
||
`}return`
|
||
|
||
`}const Nct=/\r?\n|\r/g;function Oct(t,e){const n=[];let r=0,i=0,s;for(;s=Nct.exec(t);)o(t.slice(r,s.index)),n.push(s[0]),r=s.index+s[0].length,i++;return o(t.slice(r)),n.join("");function o(a){n.push(e(a,i,!a))}}function Dct(t,e,n){const r=(n.before||"")+(e||"")+(n.after||""),i=[],s=[],o={};let a=-1;for(;++a<t.unsafe.length;){const u=t.unsafe[a];if(!Dxe(t.stack,u))continue;const d=t.compilePattern(u);let h;for(;h=d.exec(r);){const f="before"in u||!!u.atBreak,p="after"in u,g=h.index+(f?h[1].length:0);i.includes(g)?(o[g].before&&!f&&(o[g].before=!1),o[g].after&&!p&&(o[g].after=!1)):(i.push(g),o[g]={before:f,after:p})}}i.sort(Pct);let l=n.before?n.before.length:0;const c=r.length-(n.after?n.after.length:0);for(a=-1;++a<i.length;){const u=i[a];u<l||u>=c||u+1<c&&i[a+1]===u+1&&o[u].after&&!o[u+1].before&&!o[u+1].after||i[a-1]===u-1&&o[u].before&&!o[u-1].before&&!o[u-1].after||(l!==u&&s.push(pne(r.slice(l,u),"\\")),l=u,/[!-/:-@[-`{-~]/.test(r.charAt(u))&&(!n.encode||!n.encode.includes(r.charAt(u)))?s.push("\\"):(s.push(Zm(r.charCodeAt(u))),l++))}return s.push(pne(r.slice(l,c),n.after)),s.join("")}function Pct(t,e){return t-e}function pne(t,e){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],s=t+e;let o=-1,a=0,l;for(;l=n.exec(s);)r.push(l.index);for(;++o<r.length;)a!==r[o]&&i.push(t.slice(a,r[o])),i.push("\\"),a=r[o];return i.push(t.slice(a)),i.join("")}function Lct(t){const e=t||{},n=e.now||{};let r=e.lineShift||0,i=n.line||1,s=n.column||1;return{move:l,current:o,shift:a};function o(){return{now:{line:i,column:s},lineShift:r}}function a(c){r+=c}function l(c){const u=c||"",d=u.split(/\r?\n|\r/g),h=d[d.length-1];return i+=d.length-1,s=d.length===1?s+h.length:1+h.length+r,u}}function zct(t,e){const n=e||{},r={associationId:Tct,containerPhrasing:Vct,containerFlow:$ct,createTracker:Lct,compilePattern:Act,enter:s,handlers:{...GU},handle:void 0,indentLines:Oct,indexStack:[],join:[...kct],options:{},safe:Hct,stack:[],unsafe:[...Ect]};Oxe(r,n),r.options.tightDefinitions&&r.join.push(Fct),r.handle=Flt("type",{invalid:jct,unknown:Bct,handlers:r.handlers});let i=r.handle(t,void 0,r,{before:`
|
||
`,after:`
|
||
`,now:{line:1,column:1},lineShift:0});return i&&i.charCodeAt(i.length-1)!==10&&i.charCodeAt(i.length-1)!==13&&(i+=`
|
||
`),i;function s(o){return r.stack.push(o),a;function a(){r.stack.pop()}}}function jct(t){throw new Error("Cannot handle value `"+t+"`, expected node")}function Bct(t){const e=t;throw new Error("Cannot handle unknown node `"+e.type+"`")}function Fct(t,e){if(t.type==="definition"&&t.type===e.type)return 0}function Vct(t,e){return Ict(t,this,e)}function $ct(t,e){return Rct(t,this,e)}function Hct(t,e){return Dct(this,t,e)}function Ej(t){const e=this;e.compiler=n;function n(r){return zct(r,{...e.data("settings"),...t,extensions:e.data("toMarkdownExtensions")||[]})}}function mne(t){if(t)throw t}var g6=Object.prototype.hasOwnProperty,Kxe=Object.prototype.toString,gne=Object.defineProperty,yne=Object.getOwnPropertyDescriptor,vne=function(e){return typeof Array.isArray=="function"?Array.isArray(e):Kxe.call(e)==="[object Array]"},bne=function(e){if(!e||Kxe.call(e)!=="[object Object]")return!1;var n=g6.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&g6.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;var i;for(i in e);return typeof i>"u"||g6.call(e,i)},wne=function(e,n){gne&&n.name==="__proto__"?gne(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},xne=function(e,n){if(n==="__proto__")if(g6.call(e,n)){if(yne)return yne(e,n).value}else return;return e[n]},Uct=function t(){var e,n,r,i,s,o,a=arguments[0],l=1,c=arguments.length,u=!1;for(typeof a=="boolean"&&(u=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l<c;++l)if(e=arguments[l],e!=null)for(n in e)r=xne(a,n),i=xne(e,n),a!==i&&(u&&i&&(bne(i)||(s=vne(i)))?(s?(s=!1,o=r&&vne(r)?r:[]):o=r&&bne(r)?r:{},wne(a,{name:n,newValue:t(u,o,i)})):typeof i<"u"&&wne(a,{name:n,newValue:i}));return a};const dO=PF(Uct);function Tj(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function qct(){const t=[],e={run:n,use:r};return e;function n(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(l,...c){const u=t[++s];let d=-1;if(l){o(l);return}for(;++d<i.length;)(c[d]===null||c[d]===void 0)&&(c[d]=i[d]);i=c,u?Wct(u,a)(...c):o(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function Wct(t,e){let n;return r;function r(...o){const a=t.length>o.length;let l;a&&o.push(i);try{l=t.apply(this,o)}catch(c){const u=c;if(a&&n)throw u;return i(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(o,...a){n||(n=!0,e(o,...a))}function s(o){i(null,o)}}class _a extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=V_(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}_a.prototype.file="";_a.prototype.name="";_a.prototype.reason="";_a.prototype.message="";_a.prototype.stack="";_a.prototype.column=void 0;_a.prototype.line=void 0;_a.prototype.ancestors=void 0;_a.prototype.cause=void 0;_a.prototype.fatal=void 0;_a.prototype.place=void 0;_a.prototype.ruleId=void 0;_a.prototype.source=void 0;const Eu={basename:Gct,dirname:Kct,extname:Yct,join:Zct,sep:"/"};function Gct(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');D3(t);let n=0,r=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let o=-1,a=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(t.codePointAt(i)===e.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return n===r?r=o:r<0&&(r=t.length),t.slice(n,r)}function Kct(t){if(D3(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function Yct(t){D3(t);let e=t.length,n=-1,r=0,i=-1,s=0,o;for(;e--;){const a=t.codePointAt(e);if(a===47){if(o){r=e+1;break}continue}n<0&&(o=!0,n=e+1),a===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function Zct(...t){let e=-1,n;for(;++e<t.length;)D3(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":Xct(n)}function Xct(t){D3(t);const e=t.codePointAt(0)===47;let n=Qct(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function Qct(t,e){let n="",r=0,i=-1,s=0,o=-1,a,l;for(;++o<=t.length;){if(o<t.length)a=t.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,o):n=t.slice(i+1,o),r=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return n}function D3(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Jct={cwd:eut};function eut(){return"/"}function Aj(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function tut(t){if(typeof t=="string")t=new URL(t);else if(!Aj(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return nut(t)}function nut(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const hO=["history","path","basename","stem","extname","dirname"];class rut{constructor(e){let n;e?Aj(e)?n={path:e}:typeof e=="string"||iut(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":Jct.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<hO.length;){const s=hO[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)hO.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Eu.basename(this.path):void 0}set basename(e){pO(e,"basename"),fO(e,"basename"),this.path=Eu.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Eu.dirname(this.path):void 0}set dirname(e){_ne(this.basename,"dirname"),this.path=Eu.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Eu.extname(this.path):void 0}set extname(e){if(fO(e,"extname"),_ne(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Eu.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Aj(e)&&(e=tut(e)),pO(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Eu.basename(this.path,this.extname):void 0}set stem(e){pO(e,"stem"),fO(e,"stem"),this.path=Eu.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const i=this.message(e,n,r);throw i.fatal=!0,i}info(e,n,r){const i=this.message(e,n,r);return i.fatal=void 0,i}message(e,n,r){const i=new _a(e,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function fO(t,e){if(t&&t.includes(Eu.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Eu.sep+"`")}function pO(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function _ne(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function iut(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const sut=function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},out={}.hasOwnProperty;class KU extends sut{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=qct()}copy(){const e=new KU;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(dO(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(yO("data",this.frozen),this.namespace[e]=n,this):out.call(this.namespace,e)&&this.namespace[e]||void 0:e?(yO("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(e,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=DE(e),r=this.parser||this.Parser;return mO("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),mO("process",this.parser||this.Parser),gO("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const a=DE(e),l=r.parse(a);r.run(l,a,function(u,d,h){if(u||!d||!h)return c(u);const f=d,p=r.stringify(f,h);lut(p)?h.value=p:h.result=p,c(u,h)});function c(u,d){u||!d?o(u):s?s(d):n(void 0,d)}}}processSync(e){let n=!1,r;return this.freeze(),mO("processSync",this.parser||this.Parser),gO("processSync",this.compiler||this.Compiler),this.process(e,i),kne("processSync","process",n),r;function i(s,o){n=!0,mne(s),r=o}}run(e,n,r){Sne(e),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(o,a){const l=DE(n);i.run(e,l,c);function c(u,d,h){const f=d||e;u?a(u):o?o(f):r(void 0,f,h)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),kne("runSync","run",r),i;function s(o,a){mne(o),i=a,r=!0}}stringify(e,n){this.freeze();const r=DE(n),i=this.compiler||this.Compiler;return gO("stringify",i),Sne(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(yO("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else if(typeof e=="object")Array.isArray(e)?a(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...d]=c;l(u,d)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(i.settings=dO(!0,i.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const d=c[u];s(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,h=-1;for(;++d<r.length;)if(r[d][0]===c){h=d;break}if(h===-1)r.push([c,...u]);else if(u.length>0){let[f,...p]=u;const g=r[h][1];Tj(g)&&Tj(f)&&(f=dO(!0,g,f)),r[h]=[c,f,...p]}}}}const Ij=new KU().freeze();function mO(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function gO(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function yO(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Sne(t){if(!Tj(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function kne(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function DE(t){return aut(t)?t:new rut(t)}function aut(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function lut(t){return typeof t=="string"||cut(t)}function cut(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}function ws(t){this.content=t}ws.prototype={constructor:ws,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new ws(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new ws(n)},addToStart:function(t,e){return new ws([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new ws(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new ws(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=ws.from(t),t.size?new ws(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=ws.from(t),t.size?new ws(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=ws.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};ws.from=function(t){if(t instanceof ws)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new ws(e)};function Yxe(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=Yxe(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function Zxe(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let c=Zxe(o.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}let De=class go{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,a=0;a<n;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new go(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),i+=a.nodeSize),o=l}return new go(r,i)}cutByIndex(e,n){return e==n?go.empty:e==0&&n==this.content.length?this:new go(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new go(i,s)}addToStart(e){return new go([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new go(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return Yxe(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Zxe(this,e,n,r)}findIndex(e){if(e==0)return PE(0,e);if(e==this.size)return PE(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?PE(n+1,s):PE(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return go.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return go.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return go.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new go(n||e,r)}static from(e){if(!e)return go.empty;if(e instanceof go)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new go([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};De.empty=new De([],0);const vO={index:0,offset:0};function PE(t,e){return vO.index=t,vO.offset=e,vO}function n8(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!n8(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!n8(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}class an{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&n8(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return an.none;if(e instanceof an)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}}an.none=[];class r8 extends Error{}class We{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Qxe(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new We(r,this.openStart,this.openEnd)}removeBetween(e,n){return new We(Xxe(this.content,e+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(e,n){if(!n)return We.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new We(De.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new We(e,r,i)}}We.empty=new We(De.empty,0,0);function Xxe(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(i==e||s.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(Xxe(s.content,e-i-1,n-i-1)))}function Qxe(t,e,n,r,i,s){let{index:o,offset:a}=t.findIndex(e),l=t.maybeChild(o);if(a==e||l.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=Qxe(l.content,e-a-1,n,o==0?r-1:0,o==t.childCount-1?i-1:0,l);return c&&t.replaceChild(o,l.copy(c))}function uut(t,e,n){if(n.openStart>t.depth)throw new r8("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new r8("Inconsistent open depths");return Jxe(t,e,n,0)}function Jxe(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=Jxe(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return d1(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=dut(n,t);return d1(s,t2e(t,o,a,e,r))}else return d1(s,i8(t,e,r))}function e2e(t,e){if(!e.type.compatibleContent(t.type))throw new r8("Cannot join "+e.type.name+" onto "+t.type.name)}function Rj(t,e,n){let r=t.node(n);return e2e(r,e.node(n)),r}function u1(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function $_(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(u1(t.nodeAfter,r),s++));for(let a=s;a<o;a++)u1(i.child(a),r);e&&e.depth==n&&e.textOffset&&u1(e.nodeBefore,r)}function d1(t,e){return t.type.checkContent(e),t.copy(e)}function t2e(t,e,n,r,i){let s=t.depth>i&&Rj(t,e,i+1),o=r.depth>i&&Rj(n,r,i+1),a=[];return $_(null,t,i,a),s&&o&&e.index(i)==n.index(i)?(e2e(s,o),u1(d1(s,t2e(t,e,n,r,i+1)),a)):(s&&u1(d1(s,i8(t,e,i+1)),a),$_(e,n,i,a),o&&u1(d1(o,i8(n,r,i+1)),a)),$_(r,null,i,a),new De(a)}function i8(t,e,n){let r=[];if($_(null,t,n,r),t.depth>n){let i=Rj(t,e,n+1);u1(d1(i,i8(t,e,n+1)),r)}return $_(e,null,n,r),new De(r)}function dut(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(De.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class ck{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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 new 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 new 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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return an.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new n2e(this,e,r);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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new ck(n,r,s)}static resolveCached(e,n){let r=Cne.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else Cne.set(e,r=new hut);let i=r.elts[r.i]=ck.resolve(e,n);return r.i=(r.i+1)%fut,i}}class hut{constructor(){this.elts=[],this.i=0}}const fut=12,Cne=new WeakMap;class n2e{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const put=Object.create(null);let Hh=class Mj{constructor(e,n,r,i=an.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||De.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,n,r,i=0){this.content.nodesBetween(e,n,r,i,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,n,r,i){return this.content.textBetween(e,n,r,i)}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,n,r){return this.type==e&&n8(this.attrs,n||e.defaultAttrs||put)&&an.sameSet(this.marks,r||an.none)}copy(e=null){return e==this.content?this:new Mj(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Mj(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return We.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new We(c,i.depth-o,s.depth-o)}replace(e,n,r){return uut(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return ck.resolveCached(this,e)}resolveNoCache(e){return ck.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),r2e(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=De.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.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=an.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!an.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=De.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};Hh.prototype.text=void 0;let mut=class Nj extends Hh{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):r2e(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Nj(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Nj(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function r2e(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class ty{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new gut(e,n);if(r.next==null)return ty.empty;let i=i2e(r);r.next&&r.err("Unexpected trailing text");let s=Sut(_ut(i));return kut(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}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:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return De.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let h=s(d,a.concat(u));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
|
||
`)}}ty.empty=new ty(!0);class gut{constructor(e,n){this.string=e,this.nodeTypes=n,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 new SyntaxError(e+" (in content expression '"+this.string+"')")}}function i2e(t){let e=[];do e.push(yut(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function yut(t){let e=[];do e.push(vut(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function vut(t){let e=xut(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=but(t,e);else break;return e}function Ene(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function but(t,e){let n=Ene(t),r=n;return t.eat(",")&&(t.next!="}"?r=Ene(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function wut(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function xut(t){if(t.eat("(")){let e=i2e(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=wut(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function _ut(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=n())}else if(o.type=="star"){let l=n();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=n();i(s(o.expr,l),u),l=u}if(o.max==-1)i(s(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=n();r(l,u),i(s(o.expr,l),u),l=u}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function s2e(t,e){return e-t}function Tne(t,e){let n=[];return r(e),n.sort(s2e);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&n.indexOf(l)==-1&&r(l)}}}function Sut(t){let e=Object.create(null);return n(Tne(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<i.length;u++)i[u][0]==a&&(c=i[u][1]);Tne(t,l).forEach(u=>{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new ty(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(s2e);s.next.push({type:i[o][0],next:e[a.join(",")]||n(a)})}return s}}function kut(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function o2e(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function a2e(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function l2e(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let s=t[i];s.validate&&s.validate(e[i])}}function c2e(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new Eut(t,r,e[r]);return n}let s8=class u2e{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=c2e(e,r.attrs),this.defaultAttrs=o2e(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ty.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:a2e(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Hh(this,this.computeAttrs(e),De.from(n),an.setFrom(r))}createChecked(e=null,n,r){return n=De.from(n),this.checkContent(n),new Hh(this,this.computeAttrs(e),n,an.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=De.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(De.empty,!0);return s?new Hh(this,e,n.append(s),an.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){l2e(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 n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:an.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new u2e(s,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Cut(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class Eut{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Cut(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class ZI{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=c2e(e,i.attrs),this.excluded=null;let s=o2e(this.attrs);this.instance=s?new an(this,s):null}create(e=null){return!e&&this.instance?this.instance:new an(this,a2e(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new ZI(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){l2e(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class d2e{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=ws.from(e.nodes),n.marks=ws.from(e.marks||{}),this.nodes=s8.compile(this.spec.nodes,this),this.marks=ZI.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=ty.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?Ane(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:Ane(this,o.split(" "))}this.nodeFromJSON=i=>Hh.fromJSON(this,i),this.markFromJSON=i=>an.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof s8){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new mut(r,r.defaultAttrs,e,an.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Ane(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let a in t.marks){let l=t.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function Tut(t){return t.tag!=null}function Aut(t){return t.style!=null}class ny{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(Tut(i))this.tags.push(i);else if(Aut(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new Rne(this,n,!1);return r.addAll(e,an.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Rne(this,n,!0);return r.addAll(e,an.none,n.from,n.to),We.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(Mut(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Mne(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Mne(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ny(e,ny.schemaRules(e)))}}const h2e={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},Iut={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},f2e={ol:!0,ul:!0},uk=1,Oj=2,H_=4;function Ine(t,e,n){return e!=null?(e?uk:0)|(e==="full"?Oj:0):t&&t.whitespace=="pre"?uk|Oj:n&~H_}class LE{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=an.none,this.match=s||(o&H_?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(De.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&uk)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=De.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(De.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!h2e.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Rne{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,o=Ine(null,n.preserveWhitespace,0)|(r?H_:0);i?s=new LE(i.type,i.attrs,an.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new LE(null,null,an.none,!0,null,o):s=new LE(e.schema.topNodeType,null,an.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&Oj?"full":this.localPreserveWS||(i.options&uk)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
|
||
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(o.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;f2e.hasOwnProperty(o)&&this.parser.normalizeLists&&Rut(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:Iut.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(h2e.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(s),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
||
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,i){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,n.attrs||null,r,n.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,s=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)n=this.enterInner(i[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=an.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):Nne(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=Ine(e,s,o.options);o.options&H_&&o.content.length==0&&(a|=H_);let l=an.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Nne(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new LE(e,n,l,i,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(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 n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=uk)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function Rut(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&f2e.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function Mut(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Mne(t){let e={};for(let n in t)e[n]=t[n];return e}function Nne(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(i.contentMatch))return!0}}class E0{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=zE(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,n);u&&(s.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){if(e.isText)return zE(n).createTextNode(e.text);let{dom:r,contentDOM:i}=y6(zE(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&y6(zE(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return typeof n=="string"?{dom:e.createTextNode(n)}:y6(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new E0(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=One(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return One(e.marks)}}function One(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function zE(t){return t.document||window.document}const Dne=new WeakMap;function Nut(t){let e=Dne.get(t);return e===void 0&&Dne.set(t,e=Out(t)),e}function Out(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function y6(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=Nut(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let h=d.indexOf(" ");h>0?l.setAttributeNS(d.slice(0,h),d.slice(h+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let h=e[d];if(h===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof h=="string")l.appendChild(t.createTextNode(h));else{let{dom:f,contentDOM:p}=y6(t,h,n,r);if(l.appendChild(f),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const p2e=65535,m2e=Math.pow(2,16);function Dut(t,e){return t+e*m2e}function Pne(t){return t&p2e}function Put(t){return(t-(t&p2e))/m2e}const g2e=1,y2e=2,v6=4,v2e=8;class Dj{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&v2e)>0}get deletedBefore(){return(this.delInfo&(g2e|v6))>0}get deletedAfter(){return(this.delInfo&(y2e|v6))>0}get deletedAcross(){return(this.delInfo&v6)>0}}class Fa{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Fa.empty)return Fa.empty}recover(e){let n=0,r=Pne(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+Put(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+s],u=this.ranges[a+o],d=l+c;if(e<=d){let h=c?e==l?-1:e==d?1:n:n,f=l+i+(h<0?0:u);if(r)return f;let p=e==(n<0?l:d)?null:Dut(a/3,e-l),g=e==l?y2e:e==d?g2e:v6;return(n<0?e!=l:e!=d)&&(g|=v2e),new Dj(f,g,p)}i+=u-c}return r?e+i:new Dj(e+i,0,null)}touches(e,n){let r=0,i=Pne(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+s],u=l+c;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[i+n],u=this.ranges[i+r];e(a,a+c,l,l+u),s+=u-c}}invert(){return new Fa(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Fa.empty:new Fa(e<0?[0,-e,0]:[0,0,e])}}Fa.empty=new Fa([]);class dk{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new dk(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new dk;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new Dj(e,i,null)}}const bO=Object.create(null);class lo{getMap(){return Fa.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=bO[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in bO)throw new RangeError("Duplicate use of step JSON ID "+e);return bO[e]=n,n.prototype.jsonID=e,n}}class Mi{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Mi(e,null)}static fail(e){return new Mi(null,e)}static fromReplace(e,n,r,i){try{return Mi.ok(e.replace(n,r,i))}catch(s){if(s instanceof r8)return Mi.fail(s.message);throw s}}}function YU(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(YU(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return De.fromArray(r)}class Mh extends lo{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new We(YU(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Mi.fromReplace(e,this.from,this.to,s)}invert(){return new Ju(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Mh(n.pos,r.pos,this.mark)}merge(e){return e instanceof Mh&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Mh(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Mh(n.from,n.to,e.markFromJSON(n.mark))}}lo.jsonID("addMark",Mh);class Ju extends lo{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new We(YU(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Mi.fromReplace(e,this.from,this.to,r)}invert(){return new Mh(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Ju(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ju&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ju(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ju(n.from,n.to,e.markFromJSON(n.mark))}}lo.jsonID("removeMark",Ju);class nm extends lo{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Mi.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Mi.fromReplace(e,this.pos,this.pos+1,new We(De.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new nm(this.pos,n.marks[i]);return new nm(this.pos,this.mark)}}return new ry(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new nm(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new nm(n.pos,e.markFromJSON(n.mark))}}lo.jsonID("addNodeMark",nm);class ry extends lo{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Mi.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Mi.fromReplace(e,this.pos,this.pos+1,new We(De.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new nm(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ry(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ry(n.pos,e.markFromJSON(n.mark))}}lo.jsonID("removeNodeMark",ry);class li extends lo{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Pj(e,this.from,this.to)?Mi.fail("Structure replace would overwrite content"):Mi.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Fa([this.from,this.to-this.from,this.slice.size])}invert(e){return new li(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&li.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new li(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof li)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?We.empty:new We(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new li(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?We.empty:new We(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new li(e.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(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new li(n.from,n.to,We.fromJSON(e,n.slice),!!n.structure)}}li.MAP_BIAS=1;lo.jsonID("replace",li);class to extends lo{constructor(e,n,r,i,s,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Pj(e,this.from,this.gapFrom)||Pj(e,this.gapTo,this.to)))return Mi.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Mi.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Mi.fromReplace(e,this.from,this.to,r):Mi.fail("Content does not fit in gap")}getMap(){return new Fa([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new to(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new to(n.pos,r.pos,i,s,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(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new to(n.from,n.to,n.gapFrom,n.gapTo,We.fromJSON(e,n.slice),n.insert,!!n.structure)}}lo.jsonID("replaceAround",to);function Pj(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Lut(t,e,n,r){let i=[],s=[],o,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let h=Math.max(c,e),f=Math.min(c+l.nodeSize,n),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(o&&o.to==h&&o.mark.eq(d[g])?o.to=f:i.push(o=new Ju(h,f,d[g])));a&&a.to==h?a.to=f:s.push(a=new Mh(h,f,r))}}),i.forEach(l=>t.step(l)),s.forEach(l=>t.step(l))}function zut(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof ZI){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],h;for(let f=0;f<i.length;f++){let p=i[f];p.step==s-1&&d.eq(i[f].style)&&(h=p)}h?(h.to=c,h.step=s):i.push({style:d,from:Math.max(a,e),to:c,step:s})}}}),i.forEach(o=>t.step(new Ju(o.from,o.to,o.style)))}function ZU(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new li(a,u,We.empty));else{r=d;for(let h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||t.step(new Ju(a,u,c.marks[h]));if(i&&c.isText&&n.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(c.text);)p||(p=new We(De.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new li(a+h.index,a+h.index+h[0].length,p))}}a=u}if(!r.validEnd){let l=r.fillBefore(De.empty,!0);t.replace(a,a,new We(l,0,0))}for(let l=o.length-1;l>=0;l--)t.step(o[l])}function jut(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function XI(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),a=t.$from.index(r)+i,l=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(a,l,n))return r;if(r==0||o.type.spec.isolating||!jut(o,a,l))break;a&&(i=1),l<o.childCount&&(s=1)}return null}function But(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,c=a,u=De.empty,d=0;for(let p=s,g=!1;p>n;p--)g||r.index(p)>0?(g=!0,u=De.from(r.node(p).copy(u)),d++):l--;let h=De.empty,f=0;for(let p=s,g=!1;p>n;p--)g||i.after(p+1)<i.end(p)?(g=!0,h=De.from(i.node(p).copy(h)),f++):c++;t.step(new to(l,c,o,a,new We(u.append(h),d,f),u.size-d,!0))}function XU(t,e,n=null,r=t){let i=Fut(t,e),s=i&&Vut(r,e);return s?i.map(Lne).concat({type:e,attrs:n}).concat(s.map(Lne)):null}function Lne(t){return{type:t,attrs:null}}function Fut(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function Vut(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:o}function $ut(t,e,n){let r=De.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=De.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new to(i,s,i,s,new We(r,0,0),n.length,!0))}function Hut(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&Uut(t.doc,t.mapping.slice(s).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!p?c=!1:!f&&p&&(c=!0)}c===!1&&w2e(t,o,a,s),ZU(t,t.mapping.slice(s).map(a,1),r,void 0,c===null);let u=t.mapping.slice(s),d=u.map(a,1),h=u.map(a+o.nodeSize,1);return t.step(new to(d,h,d+1,h-1,new We(De.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&b2e(t,o,a,s),!1}})}function b2e(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function w2e(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
|
||
`))}})}function Uut(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function qut(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new to(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new We(De.from(o),0,0),1,!0))}function U_(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<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 c=i.depth-1,u=n-2;c>s;c--,u--){let d=i.node(c),h=i.index(c);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(h,d.childCount),p=r&&r[u+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let g=r&&r[u]||d;if(!d.canReplace(h+1,d.childCount)||!g.type.validContent(f))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function Wut(t,e,n=1,r){let i=t.doc.resolve(e),s=De.empty,o=De.empty;for(let a=i.depth,l=i.depth-n,c=n-1;a>l;a--,c--){s=De.from(i.node(a).copy(s));let u=r&&r[c];o=De.from(u?u.type.create(u.attrs,o):i.node(a).copy(o))}t.step(new li(e,e,new We(s.append(o),n,n),!0))}function QI(t,e){let n=t.resolve(e),r=n.index();return Kut(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Gut(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function Kut(t,e){return!!(t&&e&&!t.isLeaf&&Gut(t,e))}function Yut(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let u=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);u&&!d?r=!1:!u&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);w2e(t,u.node(),u.before(),a)}o.inlineContent&&ZU(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new li(c,l.map(e+n,-1),We.empty,!0)),r===!0){let u=t.doc.resolve(c);b2e(t,u.node(),u.before(),t.steps.length)}return t}function Zut(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function Xut(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(l,l,i);else{let d=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function JI(t,e,n=e,r=We.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return x2e(i,s,r)?new li(e,n,r):new Qut(i,s,r).fit()}function x2e(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Qut{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=De.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=De.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new We(s,o,a);return e>-1?new to(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new li(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=wO(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(o?c.matchType(o.type)||(d=c.fillBefore(De.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:d};if(n==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=wO(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new We(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=wO(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new We(M4(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new We(M4(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let g=0;g<s.length;g++)this.openFrontierNode(s[g]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,u=[],{match:d,type:h}=this.frontier[n];if(i){for(let g=0;g<i.childCount;g++)u.push(i.child(g));d=d.matchFragment(i)}let f=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let g=a.child(c),y=d.matchType(g.type);if(!y)break;c++,(c>1||l==0||g.content.size)&&(d=y,u.push(_2e(g.mark(h.allowedMarks(g.marks)),c==1?l:0,c==a.childCount?f:-1)))}let p=c==a.childCount;p||(f=-1),this.placed=N4(this.placed,n,De.from(u)),this.frontier[n].match=d,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=a;g<f;g++){let v=y.lastChild;this.frontier.push({type:v.type,match:v.contentMatchAt(v.childCount)}),y=v.content}this.unplaced=p?e==0?We.empty:new We(M4(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new We(M4(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!xO(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=xO(e,n,i,r,s);if(o){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=xO(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=N4(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=N4(this.placed,this.depth,De.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(De.empty,!0);n.childCount&&(this.placed=N4(this.placed,this.frontier.length,n))}}function M4(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(M4(t.firstChild.content,e-1,n)))}function N4(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(N4(t.lastChild.content,e-1,n)))}function wO(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function _2e(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,_2e(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(De.empty,!0)))),t.copy(r)}function xO(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!Jut(n,s.content,o)?a:null}function Jut(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function edt(t){return t.spec.defining||t.spec.definingForContent}function tdt(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(x2e(i,s,r))return t.step(new li(e,n,r));let o=k2e(i,s);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let h=i.depth,f=i.pos-1;h>0;h--,f--){let p=i.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(h)>-1?a=h:i.before(h)==f&&o.splice(1,0,-h)}let l=o.indexOf(a),c=[],u=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(c.push(p),f==r.openStart)break;h=p.content}for(let h=u-1;h>=0;h--){let f=c[h],p=edt(f.type);if(p&&!f.sameMarkup(i.node(Math.abs(a)-1)))u=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+u+1)%(r.openStart+1),p=c[f];if(p)for(let g=0;g<o.length;g++){let y=o[(g+l)%o.length],v=!0;y<0&&(v=!1,y=-y);let b=i.node(y-1),_=i.index(y-1);if(b.canReplaceWith(_,_,p.type,p.marks))return t.replace(i.before(y),v?s.after(y):n,new We(S2e(r.content,0,r.openStart,f),f,r.openEnd))}}let d=t.steps.length;for(let h=o.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>d));h--){let f=o[h];f<0||(e=i.before(f),n=s.after(f))}}function S2e(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(S2e(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(De.empty,!0))}return t}function ndt(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=Zut(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new We(De.from(r),0,0))}function rdt(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(n),a=!1;for(let l=r.depth;l>o;l--)r.node(l).type.spec.isolating&&(a=!0);for(let l=i.depth;l>o;l--)i.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=r.depth;l>0&&e==r.start(l);l--)e=r.before(l);for(let l=i.depth;l>0&&n==i.start(l);l--)n=i.before(l);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let s=k2e(r,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function k2e(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class gb extends lo{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Mi.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Mi.fromReplace(e,this.pos,this.pos+1,new We(De.from(i),0,n.isLeaf?0:1))}getMap(){return Fa.empty}invert(e){return new gb(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new gb(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new gb(n.pos,n.attr,n.value)}}lo.jsonID("attr",gb);class hk extends lo{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Mi.ok(r)}getMap(){return Fa.empty}invert(e){return new hk(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new hk(n.attr,n.value)}}lo.jsonID("docAttr",hk);let cx=class extends Error{};cx=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};cx.prototype=Object.create(Error.prototype);cx.prototype.constructor=cx;cx.prototype.name="TransformError";class C2e{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new dk}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new cx(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,o,a,l)=>{e=Math.min(e,a),n=Math.max(n,l)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=We.empty){let i=JI(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new We(De.from(r),0,0))}delete(e,n){return this.replace(e,n,We.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return tdt(this,e,n,r),this}replaceRangeWith(e,n,r){return ndt(this,e,n,r),this}deleteRange(e,n){return rdt(this,e,n),this}lift(e,n){return But(this,e,n),this}join(e,n=1){return Yut(this,e,n),this}wrap(e,n){return $ut(this,e,n),this}setBlockType(e,n=e,r,i=null){return Hut(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return qut(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new gb(e,n,r)),this}setDocAttribute(e,n){return this.step(new hk(e,n)),this}addNodeMark(e,n){return this.step(new nm(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof an)n.isInSet(r.marks)&&this.step(new ry(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new ry(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,n=1,r){return Wut(this,e,n,r),this}addMark(e,n,r){return Lut(this,e,n,r),this}removeMark(e,n,r){return zut(this,e,n,r),this}clearIncompatible(e,n,r){return ZU(this,e,n,r),this}}const _O=Object.create(null);class jt{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new E2e(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=We.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],u=e.mapping.slice(s);e.replaceRange(u.map(l.pos),u.map(c.pos),a?We.empty:n),a==0&&Bne(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(r),c=l.map(o.pos),u=l.map(a.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),Bne(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new mt(e):pv(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?pv(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):pv(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new pa(e.node(0))}static atStart(e){return pv(e,e,0,0,1)||new pa(e)}static atEnd(e){return pv(e,e,e.content.size,e.childCount,-1)||new pa(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=_O[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in _O)throw new RangeError("Duplicate use of selection JSON ID "+e);return _O[e]=n,n.prototype.jsonID=e,n}getBookmark(){return mt.between(this.$anchor,this.$head).getBookmark()}}jt.prototype.visible=!0;class E2e{constructor(e,n){this.$from=e,this.$to=n}}let zne=!1;function jne(t){!zne&&!t.parent.inlineContent&&(zne=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class mt extends jt{constructor(e,n=e){jne(e),jne(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return jt.near(r);let i=e.resolve(n.map(this.anchor));return new mt(i.parent.inlineContent?i:r,r)}replace(e,n=We.empty){if(super.replace(e,n),n==We.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof mt&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new eR(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new mt(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=jt.findFrom(n,r,!0)||jt.findFrom(n,-r,!0);if(s)n=s.$head;else return jt.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(jt.findFrom(e,-r,!0)||jt.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new mt(e,n)}}jt.jsonID("text",mt);class eR{constructor(e,n){this.anchor=e,this.head=n}map(e){return new eR(e.map(this.anchor),e.map(this.head))}resolve(e){return mt.between(e.resolve(this.anchor),e.resolve(this.head))}}class Et extends jt{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?jt.near(s):new Et(s)}content(){return new We(De.from(this.node),0,0)}eq(e){return e instanceof Et&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new QU(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Et(e.resolve(n.anchor))}static create(e,n){return new Et(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Et.prototype.visible=!1;jt.jsonID("node",Et);class QU{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new eR(r,r):new QU(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Et.isSelectable(r)?new Et(n):jt.near(n)}}class pa extends jt{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=We.empty){if(n==We.empty){e.delete(0,e.doc.content.size);let r=jt.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new pa(e)}map(e){return new pa(e)}eq(e){return e instanceof pa}getBookmark(){return idt}}jt.jsonID("all",pa);const idt={map(){return this},resolve(t){return new pa(t)}};function pv(t,e,n,r,i,s=!1){if(e.inlineContent)return mt.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&Et.isSelectable(a))return Et.create(t,n-(i<0?a.nodeSize:0))}else{let l=pv(t,a,n+i,i<0?a.childCount:0,i,s);if(l)return l}n+=a.nodeSize*i}return null}function Bne(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof li||i instanceof to))return;let s=t.mapping.maps[r],o;s.forEach((a,l,c,u)=>{o==null&&(o=u)}),t.setSelection(jt.near(t.doc.resolve(o),n))}const Fne=1,jE=2,Vne=4;class sdt extends C2e{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 new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Fne)&~jE,this.storedMarks=null,this}get selectionSet(){return(this.updated&Fne)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=jE,this}ensureMarks(e){return an.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&jE)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~jE,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||an.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(jt.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,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|=Vne,this}get scrolledIntoView(){return(this.updated&Vne)>0}}function $ne(t,e){return!e||!t?t:t.bind(e)}class O4{constructor(e,n,r){this.name=e,this.init=$ne(n.init,r),this.apply=$ne(n.apply,r)}}const odt=[new O4("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new O4("selection",{init(t,e){return t.selection||jt.atStart(e.doc)},apply(t){return t.selection}}),new O4("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new O4("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class SO{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=odt.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new O4(r.key,r.spec.state,r))})}}class Ig{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,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,c=i?i[o].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Ig(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new sdt(this)}static create(e){let n=new SO(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Ig(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new SO(this.schema,e.plugins),r=n.fields,i=new Ig(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new SO(e.schema,e.plugins),s=new Ig(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Hh.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=jt.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){s[o.name]=c.fromJSON.call(l,e,n[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function T2e(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=T2e(i,e,{})),n[r]=i}return n}class Fn{constructor(e){this.spec=e,this.props={},e.props&&T2e(e.props,this,this.props),this.key=e.key?e.key.key:A2e("plugin")}getState(e){return e[this.key]}}const kO=Object.create(null);function A2e(t){return t in kO?t+"$"+ ++kO[t]:(kO[t]=0,t+"$")}class Vn{constructor(e="key"){this.key=A2e(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const JU=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function I2e(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const R2e=(t,e,n)=>{let r=I2e(t,n);if(!r)return!1;let i=eq(r);if(!i){let o=r.blockRange(),a=o&&XI(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(D2e(t,i,e,-1))return!0;if(r.parent.content.size==0&&(ux(s,"end")||Et.isSelectable(s)))for(let o=r.depth;;o--){let a=JI(t.doc,r.before(o),r.after(o),We.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(ux(s,"end")?jt.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):Et.create(l.doc,i.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},adt=(t,e,n)=>{let r=I2e(t,n);if(!r)return!1;let i=eq(r);return i?ldt(t,i,e):!1};function ldt(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=JI(t.doc,s,l,We.empty);if(!c||c.from!=s||c instanceof li&&c.slice.size>=l-s)return!1;if(n){let u=t.tr.step(c);u.setSelection(mt.create(u.doc,s)),n(u.scrollIntoView())}return!0}function ux(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const M2e=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=eq(r)}let o=s&&s.nodeBefore;return!o||!Et.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Et.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function eq(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function cdt(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const udt=(t,e,n)=>{let r=cdt(t,n);if(!r)return!1;let i=N2e(r);if(!i)return!1;let s=i.nodeAfter;if(D2e(t,i,e,1))return!0;if(r.parent.content.size==0&&(ux(s,"start")||Et.isSelectable(s))){let o=JI(t.doc,r.before(),r.after(),We.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(ux(s,"start")?jt.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):Et.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},ddt=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=N2e(r)}let o=s&&s.nodeAfter;return!o||!Et.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Et.create(t.doc,s.pos)).scrollIntoView()),!0)};function N2e(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const hdt=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
||
`).scrollIntoView()),!0)};function tq(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const O2e=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=tq(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(jt.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},fdt=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof pa||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=tq(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(o,s.createAndFill());a.setSelection(mt.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},pdt=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(U_(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&XI(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function mdt(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Et&&e.selection.node.isBlock)return!r.parentOffset||!U_(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,a,l=!1,c=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){l=r.end(f)==r.pos+(r.depth-f),c=r.start(f)==r.pos-(r.depth-f),a=tq(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),s.unshift(l&&a?{type:a}:null),o=f;break}else{if(f==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof mt||e.selection instanceof pa)&&u.deleteSelection();let d=u.mapping.map(r.pos),h=U_(u.doc,d,s.length,s);if(h||(s[0]=a?{type:a}:null,h=U_(u.doc,d,s.length,s)),!h)return!1;if(u.split(d,s.length,s),!l&&c&&r.node(o).type!=a){let f=u.mapping.map(r.before(o)),p=u.doc.resolve(f);a&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(o)),a)}return n&&n(u.scrollIntoView()),!0}}const gdt=mdt(),ydt=(t,e)=>(e&&e(t.tr.setSelection(new pa(t.doc))),!0);function vdt(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||QI(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function D2e(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&vdt(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(n){let f=e.pos+s.nodeSize,p=De.empty;for(let v=o.length-1;v>=0;v--)p=De.from(o[v].create(null,p));p=De.from(i.copy(p));let g=t.tr.step(new to(e.pos-1,f,e.pos,f,new We(p,1,0),o.length,!0)),y=g.doc.resolve(f+2*o.length);y.nodeAfter&&y.nodeAfter.type==i.type&&QI(g.doc,y.pos)&&g.join(y.pos),n(g.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&l?null:jt.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),h=d&&XI(d);if(h!=null&&h>=e.depth)return n&&n(t.tr.lift(d,h).scrollIntoView()),!0;if(c&&ux(s,"start",!0)&&ux(i,"end")){let f=i,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let g=s,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(f.canReplace(f.childCount,f.childCount,g.content)){if(n){let v=De.empty;for(let _=p.length-1;_>=0;_--)v=De.from(p[_].copy(v));let b=t.tr.step(new to(e.pos-p.length,e.pos+s.nodeSize,e.pos+y,e.pos+s.nodeSize-y,new We(v,p.length,0),0,!0));n(b.scrollIntoView())}return!0}}return!1}function P2e(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(mt.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const bdt=P2e(-1),wdt=P2e(1);function nq(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=o&&XU(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function fk(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[s];n.doc.nodesBetween(o,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let u=n.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[o];s.setBlockType(a,l,t,e)}r(s.scrollIntoView())}return!0}}function xdt(t,e,n,r){for(let i=0;i<e.length;i++){let{$from:s,$to:o}=e[i],a=s.depth==0?t.inlineContent&&t.type.allowsMarkType(n):!1;if(t.nodesBetween(s.pos,o.pos,(l,c)=>{if(a)return!1;a=l.inlineContent&&l.type.allowsMarkType(n)}),a)return!0}return!1}function tR(t,e=null,n){return function(r,i){let{empty:s,$cursor:o,ranges:a}=r.selection;if(s&&!o||!xdt(r.doc,a,t))return!1;if(i)if(o)t.isInSet(r.storedMarks||o.marks())?i(r.tr.removeStoredMark(t)):i(r.tr.addStoredMark(t.create(e)));else{let l,c=r.tr;l=!a.some(u=>r.doc.rangeHasMark(u.$from.pos,u.$to.pos,t));for(let u=0;u<a.length;u++){let{$from:d,$to:h}=a[u];if(!l)c.removeMark(d.pos,h.pos,t);else{let f=d.pos,p=h.pos,g=d.nodeAfter,y=h.nodeBefore,v=g&&g.isText?/^\s*/.exec(g.text)[0].length:0,b=y&&y.isText?/\s*$/.exec(y.text)[0].length:0;f+v<p&&(f+=v,p-=b),c.addMark(f,p,t.create(e))}}i(c.scrollIntoView())}return!0}}function c2(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}let CO=c2(JU,R2e,M2e),Hne=c2(JU,udt,ddt);const lh={Enter:c2(hdt,fdt,pdt,gdt),"Mod-Enter":O2e,Backspace:CO,"Mod-Backspace":CO,"Shift-Backspace":CO,Delete:Hne,"Mod-Delete":Hne,"Mod-a":ydt},L2e={"Ctrl-h":lh.Backspace,"Alt-Backspace":lh["Mod-Backspace"],"Ctrl-d":lh.Delete,"Ctrl-Alt-Backspace":lh["Mod-Delete"],"Alt-Delete":lh["Mod-Delete"],"Alt-d":lh["Mod-Delete"],"Ctrl-a":bdt,"Ctrl-e":wdt};for(let t in lh)L2e[t]=lh[t];const _dt=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,Sdt=_dt?L2e:lh;class Sa{constructor(e,n,r={}){this.match=e,this.match=e,this.handler=typeof n=="string"?kdt(n):n,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1,this.inCodeMark=r.inCodeMark!==!1}}function kdt(t){return function(e,n,r,i){let s=t;if(n[1]){let o=n[0].lastIndexOf(n[1]);s+=n[0].slice(o+n[1].length),r+=o;let a=r-i;a>0&&(s=n[0].slice(o-a,o)+s,r=i)}return e.tr.insertText(s,r,i)}}const Cdt=(t,e)=>{let n=t.plugins;for(let r=0;r<n.length;r++){let i=n[r],s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){let o=t.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l--)o.step(a.steps[l].invert(a.docs[l]));if(s.text){let l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,l))}else o.delete(s.from,s.to);e(o)}return!0}}return!1};new Sa(/--$/,"—",{inCodeMark:!1});new Sa(/\.\.\.$/,"…",{inCodeMark:!1});new Sa(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1});new Sa(/"$/,"”",{inCodeMark:!1});new Sa(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1});new Sa(/'$/,"’",{inCodeMark:!1});function rq(t,e,n=null,r){return new Sa(t,(i,s,o,a)=>{let l=n instanceof Function?n(s):n,c=i.tr.delete(o,a),u=c.doc.resolve(o),d=u.blockRange(),h=d&&XU(d,e,l);if(!h)return null;c.wrap(d,h);let f=c.doc.resolve(o-1).nodeBefore;return f&&f.type==e&&QI(c.doc,o-1)&&(!r||r(s,f))&&c.join(o-1),c})}function iq(t,e,n=null){return new Sa(t,(r,i,s,o)=>{let a=r.doc.resolve(s),l=n instanceof Function?n(i):n;return a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),e)?r.tr.delete(s,o).setBlockType(s,s,e,l):null})}const Xm=typeof navigator<"u"?navigator:null,Une=typeof document<"u"?document:null,T0=Xm&&Xm.userAgent||"",Lj=/Edge\/(\d+)/.exec(T0),z2e=/MSIE \d/.exec(T0),zj=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(T0),nR=!!(z2e||zj||Lj),Edt=z2e?document.documentMode:zj?+zj[1]:Lj?+Lj[1]:0,j2e=!nR&&/gecko\/(\d+)/i.test(T0),Tdt=j2e&&+(/Firefox\/(\d+)/.exec(T0)||[0,0])[1],jj=!nR&&/Chrome\/(\d+)/.exec(T0),B2e=!!jj,Adt=jj?+jj[1]:0,F2e=!nR&&!!Xm&&/Apple Computer/.test(Xm.vendor),V2e=F2e&&(/Mobile\/\w+/.test(T0)||!!Xm&&Xm.maxTouchPoints>2),Idt=V2e||(Xm?/Mac/.test(Xm.platform):!1),$2e=/Android \d/.test(T0),H2e=!!Une&&"webkitFontSmoothing"in Une.documentElement.style,Rdt=H2e?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;var BE=Object.freeze({__proto__:null,android:$2e,chrome:B2e,chrome_version:Adt,gecko:j2e,gecko_version:Tdt,ie:nR,ie_version:Edt,ios:V2e,mac:Idt,safari:F2e,webkit:H2e,webkit_version:Rdt});function EO(t,e,n,r,i,s){if(t.composing)return!1;const o=t.state,a=o.doc.resolve(e);if(a.parent.type.spec.code)return!1;const l=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,void 0,"")+r;for(let c of i){const u=c,d=u.match.exec(l),h=d&&d[0]&&u.handler(o,d,e-(d[0].length-r.length),n);if(h)return u.undoable!==!1&&h.setMeta(s,{transform:h,from:e,to:n,text:r}),t.dispatch(h),!0}return!1}const Mdt=new Vn("MILKDOWN_CUSTOM_INPUTRULES");function Ndt({rules:t}){const e=new Fn({key:Mdt,isInputRules:!0,state:{init(){return null},apply(n,r){const i=n.getMeta(this);return i||(n.selectionSet||n.docChanged?null:r)}},props:{handleTextInput(n,r,i,s){return EO(n,r,i,s,t,e)},handleDOMEvents:{compositionend:n=>(setTimeout(()=>{const{$cursor:r}=n.state.selection;r&&EO(n,r.pos,r.pos,"",t,e)}),!1),keydown:(n,r)=>!($2e&&B2e&&r.key==="Enter")||n.composing?!1:n.someProp("handleKeyDown",i=>i(n,r))?(r.preventDefault(),!0):!1},handleKeyDown(n,r){if(r.key!=="Enter")return!1;const{$cursor:i}=n.state.selection;return i?EO(n,i.pos,i.pos,`
|
||
`,t,e):!1}}});return e}function P3(t,e,n={}){return new Sa(t,(r,i,s,o)=>{var a,l,c,u;const{tr:d}=r,h=i.length;let f=i[h-1],p=i[0],g=[],y;const v={group:f,fullMatch:p,start:s,end:o},b=(a=n.updateCaptured)==null?void 0:a.call(n,v);if(Object.assign(v,b),{group:f,fullMatch:p,start:s,end:o}=v,p===null||(f==null?void 0:f.trim())==="")return null;if(f){const _=p.search(/\S/),S=s+p.indexOf(f),k=S+f.length;g=(l=d.storedMarks)!=null?l:[],k<o&&d.delete(k,o),S>s&&d.delete(s+_,S),y=s+_+f.length;const T=(c=n.getAttr)==null?void 0:c.call(n,i);d.addMark(s,y,e.create(T)),d.setStoredMarks(g),(u=n.beforeDispatch)==null||u.call(n,{match:i,start:s,end:o,tr:d})}return d})}function Odt(t,e,n={}){return new Sa(t,(r,i,s,o)=>{var a,l,c;const{tr:u}=r;let d=i[1],h=i[0];const f={group:d,fullMatch:h,start:s,end:o},p=(a=n.updateCaptured)==null?void 0:a.call(n,f);if(Object.assign(f,p),{group:d,fullMatch:h,start:s,end:o}=f,h===null||!d||d.trim()==="")return null;const g=(l=n.getAttr)==null?void 0:l.call(n,i),y=e.createAndFill(g);return y&&(u.replaceRangeWith(e.isBlock?u.doc.resolve(s).before():s,o,y),(c=n.beforeDispatch)==null||c.call(n,{match:[h,d],start:s,end:o,tr:u})),u})}var Ddt=Object.defineProperty,Pdt=Object.defineProperties,Ldt=Object.getOwnPropertyDescriptors,qne=Object.getOwnPropertySymbols,zdt=Object.prototype.hasOwnProperty,jdt=Object.prototype.propertyIsEnumerable,Wne=(t,e,n)=>e in t?Ddt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Bdt=(t,e)=>{for(var n in e||(e={}))zdt.call(e,n)&&Wne(t,n,e[n]);if(qne)for(var n of qne(e))jdt.call(e,n)&&Wne(t,n,e[n]);return t},Fdt=(t,e)=>Pdt(t,Ldt(e));function Gne(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function L3(t,e,n){const i=t.state.doc.content.size,s=Gne(e,0,i),o=Gne(n,0,i),a=t.coordsAtPos(s),l=t.coordsAtPos(o,-1),c=Math.min(a.top,l.top),u=Math.max(a.bottom,l.bottom),d=Math.min(a.left,l.left),h=Math.max(a.right,l.right),f=h-d,p=u-c,v={top:c,bottom:u,left:d,right:h,width:f,height:p,x:d,y:c};return Fdt(Bdt({},v),{toJSON:()=>v})}function U2e(t){return Object.assign(Object.create(t),t).setTime(Date.now())}function Vdt(t,e){return Array.isArray(t)&&t.includes(e.type)||e.type===t}function $dt(t){if(t.content.childCount===1){const e=t.content.firstChild;if((e==null?void 0:e.type.name)==="text"&&e.marks.length===0)return e;if((e==null?void 0:e.type.name)==="paragraph"&&e.childCount===1){const n=e.firstChild;if((n==null?void 0:n.type.name)==="text"&&n.marks.length===0)return n}}return!1}function hd(t){return e=>{for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r)){const i=e.before(n),s=e.after(n);return{from:i,to:s,node:r}}}}}function Hdt(t,e){return hd(n=>n.type===e)(t)}function Udt(t,e){const n=e.nodes[t];if(!n)throw Iot("node",t);return n}function q2e(t){return e=>{for(let n=e.depth;n>0;n--){const r=e.node(n);if(t(r))return{pos:e.before(n),start:e.start(n),depth:n,node:r}}}}function qdt(t){return e=>q2e(t)(e.$from)}function Wdt(t,e){if(!(t instanceof Et))return;const{node:n,$from:r}=t;if(Vdt(e,n))return{node:n,pos:r.pos,start:r.start(r.depth),depth:r.depth}}const W2e=(t,e)=>{const{selection:n,doc:r}=t;if(n instanceof Et)return{hasNode:n.node.type===e,pos:n.from,target:n.node};const{from:i,to:s}=n;let o=!1,a=-1,l=null;return r.nodesBetween(i,s,(c,u)=>l?!1:c.type===e?(o=!0,a=u,l=c,!1):!0),{hasNode:o,pos:a,target:l}},Gdt=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Kdt=typeof navigator<"u"&&/Win/.test(navigator.platform);function Ydt(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))Gdt?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function Zdt(t){let e=Object.create(null);for(let n in t)e[Ydt(n)]=t[n];return e}function TO(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function G2e(t){return new Fn({props:{handleKeyDown:sq(t)}})}function sq(t){let e=Zdt(t);return function(n,r){let i=Pbe(r),s,o=e[TO(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[TO(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Kdt&&r.ctrlKey&&r.altKey)&&(s=ff[r.keyCode])&&s!=i){let a=e[TO(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var K2e=class{},Y2e=class{constructor(){this.elements=[],this.size=()=>this.elements.length,this.top=()=>this.elements.at(-1),this.push=t=>{var e;(e=this.top())==null||e.push(t)},this.open=t=>{this.elements.push(t)},this.close=()=>{const t=this.elements.pop();if(!t)throw pxe();return t}}},Xdt=class Z2e extends K2e{constructor(e,n,r){super(),this.type=e,this.content=n,this.attrs=r}push(e,...n){this.content.push(e,...n)}pop(){return this.content.pop()}static create(e,n,r){return new Z2e(e,n,r)}},Cc,Jb,i5,s5,o5,ew,tw,C1,Qdt=(C1=class extends Y2e{constructor(n){super();te(this,Cc);te(this,Jb);te(this,i5);te(this,s5);te(this,o5);te(this,ew);te(this,tw);W(this,Cc,an.none),W(this,Jb,r=>r.isText),W(this,i5,(r,i)=>{if(O(this,Jb).call(this,r)&&O(this,Jb).call(this,i)&&an.sameSet(r.marks,i.marks))return this.schema.text(r.text+i.text,r.marks)}),W(this,s5,r=>{const i=Object.values({...this.schema.nodes,...this.schema.marks}).find(s=>s.spec.parseMarkdown.match(r));if(!i)throw Tot(r);return i}),W(this,o5,r=>{const i=O(this,s5).call(this,r);i.spec.parseMarkdown.runner(this,r,i)}),this.injectRoot=(r,i,s)=>(this.openNode(i,s),this.next(r.children),this),this.openNode=(r,i)=>(this.open(Xdt.create(r,[],i)),this),W(this,ew,()=>{W(this,Cc,an.none);const r=this.close();return O(this,tw).call(this,r.type,r.attrs,r.content)}),this.closeNode=()=>{try{O(this,ew).call(this)}catch(r){console.error(r)}return this},W(this,tw,(r,i,s)=>{const o=r.createAndFill(i,s,O(this,Cc));if(!o)throw Eot(r,i,s);return this.push(o),o}),this.addNode=(r,i,s)=>{try{O(this,tw).call(this,r,i,s)}catch(o){console.error(o)}return this},this.openMark=(r,i)=>{const s=r.create(i);return W(this,Cc,s.addToSet(O(this,Cc))),this},this.closeMark=r=>(W(this,Cc,r.removeFromSet(O(this,Cc))),this),this.addText=r=>{try{const i=this.top();if(!i)throw pxe();const s=i.pop(),o=this.schema.text(r,O(this,Cc));if(!s)return i.push(o),this;const a=O(this,i5).call(this,s,o);return a?(i.push(a),this):(i.push(s,o),this)}catch(i){return console.error(i),this}},this.build=()=>{let r;do r=O(this,ew).call(this);while(this.size());return r},this.next=(r=[])=>([r].flat().forEach(i=>O(this,o5).call(this,i)),this),this.toDoc=()=>this.build(),this.run=(r,i)=>{const s=r.runSync(r.parse(i),i);return this.next(s),this},this.schema=n}},Cc=new WeakMap,Jb=new WeakMap,i5=new WeakMap,s5=new WeakMap,o5=new WeakMap,ew=new WeakMap,tw=new WeakMap,C1.create=(n,r)=>{const i=new C1(n);return s=>(i.run(r,s),i.toDoc())},C1),E1,Kne=(E1=class extends K2e{constructor(e,n,r,i={}){super(),this.type=e,this.children=n,this.value=r,this.props=i,this.push=(s,...o)=>{this.children||(this.children=[]),this.children.push(s,...o)},this.pop=()=>{var s;return(s=this.children)==null?void 0:s.pop()}}},E1.create=(e,n,r,i={})=>new E1(e,n,r,i),E1),Jdt=t=>Object.prototype.hasOwnProperty.call(t,"size"),Du,nw,a5,l5,rw,c5,iw,u5,d5,qg,Up,h5,sw,T1,eht=(T1=class extends Y2e{constructor(n){super();te(this,Du);te(this,nw);te(this,a5);te(this,l5);te(this,rw);te(this,c5);te(this,iw);te(this,u5);te(this,d5);te(this,qg);te(this,Up);te(this,h5);te(this,sw);W(this,Du,an.none),W(this,nw,r=>{const i=Object.values({...this.schema.nodes,...this.schema.marks}).find(s=>s.spec.toMarkdown.match(r));if(!i)throw Aot(r.type);return i}),W(this,a5,r=>O(this,nw).call(this,r).spec.toMarkdown.runner(this,r)),W(this,l5,(r,i)=>O(this,nw).call(this,r).spec.toMarkdown.runner(this,r,i)),W(this,rw,r=>{const{marks:i}=r,s=o=>o.type.spec.priority??50;[...i].sort((o,a)=>s(o)-s(a)).every(o=>!O(this,l5).call(this,o,r))&&O(this,a5).call(this,r),i.forEach(o=>O(this,sw).call(this,o))}),W(this,c5,(r,i)=>{var c;if(r.type===i||((c=r.children)==null?void 0:c.length)!==1)return r;const s=u=>{var h;if(u.type===i)return u.value!=null?null:u;if(((h=u.children)==null?void 0:h.length)!==1)return null;const[d]=u.children;return d?s(d):null},o=s(r);if(!o)return r;const a=o.children?[...o.children]:void 0,l={...r,children:a};return l.children=a,o.children=[l],o}),W(this,iw,r=>{const{children:i}=r;return i&&(r.children=i.reduce((s,o,a)=>{if(a===0)return[o];const l=s.at(-1);if(l&&l.isMark&&o.isMark){o=O(this,c5).call(this,o,l.type);const{children:c,...u}=o,{children:d,...h}=l;if(o.type===l.type&&c&&d&&JSON.stringify(u)===JSON.stringify(h)){const f={...h,children:[...d,...c]};return s.slice(0,-1).concat(O(this,iw).call(this,f))}}return s.concat(o)},[])),r}),W(this,u5,r=>{const i={...r.props,type:r.type};return r.children&&(i.children=r.children),r.value&&(i.value=r.value),i}),this.openNode=(r,i,s)=>(this.open(Kne.create(r,void 0,i,s)),this),W(this,d5,(r,i)=>{let s="",o="";const a=r.children;let l=-1,c=-1;const u=h=>{h&&h.forEach((f,p)=>{f.type==="text"&&f.value&&(l<0&&(l=p),c=p)})};if(a){u(a);const h=a==null?void 0:a[c],f=a==null?void 0:a[l];if(h&&h.value.endsWith(" ")){const p=h.value,g=p.trimEnd();o=p.slice(g.length),h.value=g}if(f&&f.value.startsWith(" ")){const p=f.value,g=p.trimStart();s=p.slice(0,p.length-g.length),f.value=g}}s.length&&O(this,Up).call(this,"text",void 0,s);const d=i();return o.length&&O(this,Up).call(this,"text",void 0,o),d}),W(this,qg,(r=!1)=>{const i=this.close(),s=()=>O(this,Up).call(this,i.type,i.children,i.value,i.props);return r?O(this,d5).call(this,i,s):s()}),this.closeNode=()=>(O(this,qg).call(this),this),W(this,Up,(r,i,s,o)=>{const a=Kne.create(r,i,s,o),l=O(this,iw).call(this,O(this,u5).call(this,a));return this.push(l),l}),this.addNode=(r,i,s,o)=>(O(this,Up).call(this,r,i,s,o),this),W(this,h5,(r,i,s,o)=>r.isInSet(O(this,Du))?this:(W(this,Du,r.addToSet(O(this,Du))),this.openNode(i,s,{...o,isMark:!0}))),W(this,sw,r=>{r.isInSet(O(this,Du))&&(W(this,Du,r.type.removeFromSet(O(this,Du))),O(this,qg).call(this,!0))}),this.withMark=(r,i,s,o)=>(O(this,h5).call(this,r,i,s,o),this),this.closeMark=r=>(O(this,sw).call(this,r),this),this.build=()=>{let r=null;do r=O(this,qg).call(this);while(this.size());return r},this.next=r=>Jdt(r)?(r.forEach(i=>{O(this,rw).call(this,i)}),this):(O(this,rw).call(this,r),this),this.toString=r=>r.stringify(this.build()),this.run=r=>(this.next(r),this),this.schema=n}},Du=new WeakMap,nw=new WeakMap,a5=new WeakMap,l5=new WeakMap,rw=new WeakMap,c5=new WeakMap,iw=new WeakMap,u5=new WeakMap,d5=new WeakMap,qg=new WeakMap,Up=new WeakMap,h5=new WeakMap,sw=new WeakMap,T1.create=(n,r)=>{const i=new T1(n);return s=>(i.run(s),i.toString(r))},T1);const Cs=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},dx=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Bj=null;const ih=function(t,e,n){let r=Bj||(Bj=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},tht=function(){Bj=null},iy=function(t,e,n,r){return n&&(Yne(t,e,n,r,-1)||Yne(t,e,n,r,1))},nht=/^(img|br|input|textarea|hr)$/i;function Yne(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Pl(t))){let o=t.parentNode;if(!o||o.nodeType!=1||z3(t)||nht.test(t.nodeName)||t.contentEditable=="false")return!1;e=Cs(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Pl(t):0}else return!1}}function Pl(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function rht(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Pl(t)}else if(t.parentNode&&!z3(t))e=Cs(t),t=t.parentNode;else return null}}function iht(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!z3(t))e=Cs(t)+1,t=t.parentNode;else return null}}function sht(t,e,n){for(let r=e==0,i=e==Pl(t);r||i;){if(t==n)return!0;let s=Cs(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Pl(t)}}function z3(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const rR=function(t){return t.focusNode&&iy(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function bg(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function oht(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function aht(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Pl(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Pl(r.startContainer),r.startOffset)}}}const wd=typeof navigator<"u"?navigator:null,Zne=typeof document<"u"?document:null,A0=wd&&wd.userAgent||"",Fj=/Edge\/(\d+)/.exec(A0),X2e=/MSIE \d/.exec(A0),Vj=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(A0),ma=!!(X2e||Vj||Fj),Cm=X2e?document.documentMode:Vj?+Vj[1]:Fj?+Fj[1]:0,Gl=!ma&&/gecko\/(\d+)/i.test(A0);Gl&&+(/Firefox\/(\d+)/.exec(A0)||[0,0])[1];const $j=!ma&&/Chrome\/(\d+)/.exec(A0),Ms=!!$j,Q2e=$j?+$j[1]:0,so=!ma&&!!wd&&/Apple Computer/.test(wd.vendor),hx=so&&(/Mobile\/\w+/.test(A0)||!!wd&&wd.maxTouchPoints>2),Cl=hx||(wd?/Mac/.test(wd.platform):!1),J2e=wd?/Win/.test(wd.platform):!1,Nh=/Android \d/.test(A0),j3=!!Zne&&"webkitFontSmoothing"in Zne.documentElement.style,lht=j3?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function cht(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Wd(t,e){return typeof t=="number"?t:t[e]}function uht(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Xne(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=dx(o);continue}let a=o,l=a==s.body,c=l?cht(s):uht(a),u=0,d=0;if(e.top<c.top+Wd(r,"top")?d=-(c.top-e.top+Wd(i,"top")):e.bottom>c.bottom-Wd(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Wd(i,"top")-c.top:e.bottom-c.bottom+Wd(i,"bottom")),e.left<c.left+Wd(r,"left")?u=-(c.left-e.left+Wd(i,"left")):e.right>c.right-Wd(r,"right")&&(u=e.right-c.right+Wd(i,"right")),u||d)if(l)s.defaultView.scrollBy(u,d);else{let f=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let g=a.scrollLeft-f,y=a.scrollTop-p;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let h=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:dx(o)}}function dht(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(s,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:e4e(t.dom)}}function e4e(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=dx(r));return e}function hht({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;t4e(n,r==0?0:r-e)}function t4e(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Ky=null;function fht(t){if(t.setActive)return t.setActive();if(Ky)return t.focus(Ky);let e=e4e(t);t.focus(Ky==null?{get preventScroll(){return Ky={preventScroll:!0},!0}}:void 0),Ky||(Ky=!1,t4e(e,0))}function n4e(t,e){let n,r=2e8,i,s=0,o=e.top,a=e.top,l,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=ih(u).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=o&&p.bottom>=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let g=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(g<r){n=u,r=g,i=g&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&g&&(s=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=d+1)}}return!n&&l&&(n=l,i=c,r=0),n&&n.nodeType==3?pht(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:n4e(n,i)}function pht(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let o=sp(r,1);if(o.top!=o.bottom&&oq(e,o)){i={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function oq(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function mht(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function ght(t,e,n){let{node:r,offset:i}=n4e(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function yht(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let a=t.docView.nearestDesc(s,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>r.left||l.top>r.top?i=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function r4e(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let o=t.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(oq(e,c))return r4e(o,e,c)}}if((s=(s+1)%r)==i)break}return t}function vht(t,e){let n=t.dom.ownerDocument,r,i=0,s=aht(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=t.dom.getBoundingClientRect();if(!oq(e,c)||(o=r4e(t.dom,e,c),!o))return null}if(so)for(let c=o;r&&c;c=dx(c))c.draggable&&(r=void 0);if(o=mht(o,e),r){if(Gl&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let c;j3&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=yht(t,r,i,e))}a==null&&(a=ght(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Qne(t){return t.top<t.bottom||t.left<t.right}function sp(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Qne(r))return r}return Array.prototype.find.call(n,Qne)||t.getBoundingClientRect()}const bht=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function i4e(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=j3||Gl;if(r.nodeType==3)if(o&&(bht.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let l=sp(ih(r,i,i),n);if(Gl&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=sp(ih(r,i-1,i-1),-1);if(c.top==l.top){let u=sp(ih(r,i,i+1),-1);if(u.top!=l.top)return t4(u,u.left<c.left)}}return l}else{let l=i,c=i,u=n<0?1:-1;return n<0&&!i?(c++,u=-1):n>=0&&i==r.nodeValue.length?(l--,u=1):n<0?l--:c++,t4(sp(ih(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Pl(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return AO(l.getBoundingClientRect(),!1)}if(s==null&&i<Pl(r)){let l=r.childNodes[i];if(l.nodeType==1)return AO(l.getBoundingClientRect(),!0)}return AO(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Pl(r))){let l=r.childNodes[i-1],c=l.nodeType==3?ih(l,Pl(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return t4(sp(c,1),!1)}if(s==null&&i<Pl(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?ih(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return t4(sp(c,-1),!0)}return t4(sp(r.nodeType==3?ih(r):r,-n),n>=0)}function t4(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function AO(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function s4e(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function wht(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return s4e(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=i4e(t,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=ih(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const xht=/[\u0590-\u08ac]/;function _ht(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=t.domSelection();return a?!xht.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:o:s4e(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",n,"character");let f=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:g}=t.domSelectionRange(),y=p&&!f.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==g;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),y}):r.pos==r.start()||r.pos==r.end()}let Jne=null,ere=null,tre=!1;function Sht(t,e,n){return Jne==e&&ere==n?tre:(Jne=e,ere=n,tre=n=="up"||n=="down"?wht(t,e,n):_ht(t,e,n))}const Kl=0,nre=1,Rg=2,xd=3;class B3{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Kl,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].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 n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.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,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>Cs(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e||o instanceof a4e){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof o4e&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Cs(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?Cs(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(i==-1&&e<=c){let u=o+l.border;if(e>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=o;for(let d=a;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=Cs(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=Cs(d.dom);break}n+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let f=0,p=0;f<this.children.length;f++){let g=this.children[f],y=p+g.size;if(s>p&&o<y)return g.setSelection(e-p-g.border,n-p-g.border,r,i);p=y}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Gl||so)&&e==n){let{node:f,offset:p}=a;if(f.nodeType==3){if(d=!!(p&&f.nodeValue[p-1]==`
|
||
`),d&&p==f.nodeValue.length)for(let g=f,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(a=l={node:y.parentNode,offset:Cs(y)+1});break}let v=g.pmViewDesc;if(v&&v.node&&v.node.isBlock)break}}else{let g=f.childNodes[p-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Gl&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let f=u.focusNode.childNodes[u.focusOffset];f&&f.contentEditable=="false"&&(i=!0)}if(!(i||d&&so)&&iy(a.node,a.offset,u.anchorNode,u.anchorOffset)&&iy(l.node,l.offset,u.focusNode,u.focusOffset))return;let h=!1;if((c.extend||e==n)&&!(d&&Gl)){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(e>n){let p=a;a=l,l=p}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let a=r+s.border,l=o-s.border;if(e>=a&&n<=l){this.dirty=e==r||n==o?Rg:nre,e==a&&n==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=xd:s.markDirty(e-a,n-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Rg:xd}r=o}this.dirty=Rg}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Rg:nre;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class o4e extends B3{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Kl&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(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}}class kht extends B3{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class sy extends B3{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=E0.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new sy(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&xd||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=xd&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Kl){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Kl}}slice(e,n,r){let i=sy.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=Uj(s,n,o,r)),e>0&&(s=Uj(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Em extends B3{constructor(e,n,r,i,s,o,a,l,c){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,s,o){let a=s.nodeViews[n.type.name],l,c=a&&a(n,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=E0.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let h=u;return u=u4e(u,r,n),c?l=new Cht(e,n,r,i,u,d||null,h,c,s,o+1):n.isText?new iR(e,n,r,i,u,h,s):new Em(e,n,r,i,u,d||null,h,s,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 n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>De.empty)}return e}matchesNode(e,n,r){return this.dirty==Kl&&e.eq(this.node)&&o8(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new Tht(this,o&&o.node,e);Rht(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e,u):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?an.none:this.node.child(u).marks,r,e,u),l.placeWidget(c,e,i)},(c,u,d,h)=>{l.syncToMarks(c.marks,r,e,h);let f;l.findNodeMatch(c,u,d,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(f=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(c,u,d,f,e)||l.updateNextNode(c,u,d,e,h,i)||l.addNode(c,u,d,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Rg)&&(o&&this.protectLocalComposition(e,o),l4e(this.contentDOM,this.children,e),hx&&Mht(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof mt)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=Nht(this.node.content,o,r-n,i-n);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new kht(this,s,n,i);e.input.compositionNodes.push(o),this.children=Uj(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==xd||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Kl}updateOuterDeco(e){if(o8(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=c4e(this.dom,this.nodeDOM,Hj(this.outerDeco,this.node,n),Hj(e,this.node,n)),this.dom!=r&&(r.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 rre(t,e,n,r,i){u4e(r,e,t);let s=new Em(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class iR extends Em{constructor(e,n,r,i,s,o,a){super(e,n,r,i,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==xd||this.dirty!=Kl&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Kl||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Kl,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new iR(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=xd)}get domAtom(){return!1}isText(e){return this.node.text==e}}class a4e extends B3{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Kl&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Cht extends Em{constructor(e,n,r,i,s,o,a,l,c,u){super(e,n,r,i,s,o,a,c,u),this.spec=l}update(e,n,r,i){if(this.dirty==xd)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}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 l4e(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=ire(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(o instanceof sy){let l=r?r.previousSibling:t.lastChild;l4e(o.contentDOM,o.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=ire(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const q_=function(t){t&&(this.nodeName=t)};q_.prototype=Object.create(null);const Mg=[new q_];function Hj(t,e,n){if(t.length==0)return Mg;let r=n?Mg[0]:new q_,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new q_(o.nodeName));for(let a in o){let l=o[a];l!=null&&(n&&i.length==1&&i.push(r=new q_(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function c4e(t,e,n,r){if(n==Mg&&r==Mg)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],a=n[s];if(s){let l;a&&a.nodeName==o.nodeName&&i!=t&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=Mg[0]),i=l}Eht(i,a||Mg[0],o)}return i}function Eht(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function u4e(t,e,n){return c4e(t,t,Mg,Hj(e,n,t.nodeType!=1))}function o8(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function ire(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Tht{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Aht(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let s=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;s<a&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=Kl,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1,c=this.top.children.length;i<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[o])&&!this.isLocked(d.dom)){l=u;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let u=sy.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==xd&&o.dom==o.contentDOM&&(o.dirty=Rg),o.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Em){let c=this.preMatch.matched.get(l);if(c!=null&&c!=s)return!1;let u=l.dom,d,h=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=xd&&o8(n,l.outerDeco));if(!h&&l.update(e,n,r,i))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(l,e,n,r,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Rg,d.updateChildren(i,o+1),d.dirty=Kl),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!o8(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=Em.create(this.top,n,r,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,i,s){let o=Em.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new o4e(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof sy;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof iR)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((so||Ms)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new a4e(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Aht(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof sy)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function Iht(t,e){return t.type.side-e.type.side}function Rht(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,i,e.forChild(s,u),c),s+=u.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let u,d;for(;o<i.length&&i[o].to==s;){let y=i[o++];y.widget&&(u?(d||(d=[u])).push(y):u=y)}if(u)if(d){d.sort(Iht);for(let y=0;y<d.length;y++)n(d[y],c,!!l)}else n(u,c,!!l);let h,f;if(l)f=-1,h=l,l=null;else if(c<t.childCount)f=c,h=t.child(c++);else break;for(let y=0;y<a.length;y++)a[y].to<=s&&a.splice(y--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let p=s+h.nodeSize;if(h.isText){let y=p;o<i.length&&i[o].from<y&&(y=i[o].from);for(let v=0;v<a.length;v++)a[v].to<y&&(y=a[v].to);y<p&&(l=h.cut(y-s),h=h.cut(0,y-s),p=y,f=-1)}else for(;o<i.length&&i[o].to<p;)o++;let g=h.isInline&&!h.isLeaf?a.filter(y=>!y.inline):a.slice();r(h,g,e.forChild(s,h),f),s=p}}function Mht(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Nht(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<t.childCount;){let c=t.child(i++);if(s+=c.nodeSize,!c.isText)break;l+=c.text}if(s>=n){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function Uj(t,e,n,r,i){let s=[];for(let o=0,a=0;o<t.length;o++){let l=t[o],c=a,u=a+=l.size;c>=n||u<=e?s.push(l):(c<e&&s.push(l.slice(0,e-c,r)),i&&(s.push(i),i=void 0),u>n&&s.push(l.slice(n-c,l.size,r)))}return s}function aq(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(rR(n)){for(l=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&Et.isSelectable(d)&&i.parent&&!(d.isInline&&sht(n.focusNode,n.focusOffset,i.dom))){let h=i.posBefore;c=new Et(o==h?a:r.resolve(h))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,h=o;for(let f=0;f<n.rangeCount;f++){let p=n.getRangeAt(f);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),h=Math.max(h,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[l,o]=h==t.state.selection.anchor?[h,d]:[d,h],a=r.resolve(o)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=e=="pointer"||t.state.selection.head<a.pos&&!s?1:-1;c=lq(t,u,a,d)}return c}function d4e(t){return t.editable?t.hasFocus():f4e(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Uh(t,e=!1){let n=t.state.selection;if(h4e(t,n),!!d4e(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Ms){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&iy(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Dht(t);else{let{anchor:r,head:i}=n,s,o;sre&&!(n instanceof mt)&&(n.$from.parent.inlineContent||(s=ore(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=ore(t,n.to))),t.docView.setSelection(r,i,t,e),sre&&(s&&are(s),o&&are(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Oht(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const sre=so||Ms&&Q2e<63;function ore(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(so&&i&&i.contentEditable=="false")return IO(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return IO(i);if(s)return IO(s)}}function IO(t){return t.contentEditable="true",so&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function are(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Oht(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!d4e(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Dht(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Cs(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ma&&Cm<=11&&(n.disabled=!0,n.disabled=!1)}function h4e(t,e){if(e instanceof Et){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(lre(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else lre(t)}function lre(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function lq(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||mt.between(e,n,r)}function cre(t){return t.editable&&!t.hasFocus()?!1:f4e(t)}function f4e(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Pht(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return iy(e.node,e.offset,n.anchorNode,n.anchorOffset)}function qj(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&jt.findFrom(s,e)}function mp(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function ure(t,e,n){let r=t.state.selection;if(r instanceof mt)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return mp(t,new mt(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=qj(t.state,e);return i&&i instanceof Et?mp(t,i):!1}else if(!(Cl&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?Et.isSelectable(s)?mp(t,new Et(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):j3?mp(t,new mt(t.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Et&&r.node.isInline)return mp(t,new mt(e>0?r.$to:r.$from));{let i=qj(t.state,e);return i?mp(t,i):!1}}}function a8(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function W_(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Yy(t,e){return e<0?Lht(t):zht(t)}function Lht(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Gl&&n.nodeType==1&&r<a8(n)&&W_(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(W_(a,-1))i=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(p4e(n))break;{let a=n.previousSibling;for(;a&&W_(a,-1);)i=n.parentNode,s=Cs(a),a=a.previousSibling;if(a)n=a,r=a8(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Wj(t,n,r):i&&Wj(t,i,s)}function zht(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=a8(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(W_(a,1))s=n,o=++r;else break}else{if(p4e(n))break;{let a=n.nextSibling;for(;a&&W_(a,1);)s=a.parentNode,o=Cs(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=a8(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Wj(t,s,o)}function p4e(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function jht(t,e){for(;t&&e==t.childNodes.length&&!z3(t);)e=Cs(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Bht(t,e){for(;t&&!e&&!z3(t);)e=Cs(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Wj(t,e,n){if(e.nodeType!=3){let s,o;(o=jht(e,n))?(e=o,n=0):(s=Bht(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(rR(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&Uh(t)},50)}function dre(t,e){let n=t.state.doc.resolve(e);if(!(Ms||J2e)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function hre(t,e,n){let r=t.state.selection;if(r instanceof mt&&!r.empty||n.indexOf("s")>-1||Cl&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=qj(t.state,e);if(o&&o instanceof Et)return mp(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof pa?jt.near(o,e):jt.findFrom(o,e);return a?mp(t,a):!1}return!1}function fre(t,e){if(!(t.state.selection instanceof mt))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function pre(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Fht(t){if(!so||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;pre(t,r,"true"),setTimeout(()=>pre(t,r,"false"),20)}return!1}function Vht(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function $ht(t,e){let n=e.keyCode,r=Vht(e);if(n==8||Cl&&n==72&&r=="c")return fre(t,-1)||Yy(t,-1);if(n==46&&!e.shiftKey||Cl&&n==68&&r=="c")return fre(t,1)||Yy(t,1);if(n==13||n==27)return!0;if(n==37||Cl&&n==66&&r=="c"){let i=n==37?dre(t,t.state.selection.from)=="ltr"?-1:1:-1;return ure(t,i,r)||Yy(t,i)}else if(n==39||Cl&&n==70&&r=="c"){let i=n==39?dre(t,t.state.selection.from)=="ltr"?1:-1:1;return ure(t,i,r)||Yy(t,i)}else{if(n==38||Cl&&n==80&&r=="c")return hre(t,-1,r)||Yy(t,-1);if(n==40||Cl&&n==78&&r=="c")return Fht(t)||hre(t,1,r)||Yy(t,1);if(r==(Cl?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function cq(t,e){t.someProp("transformCopied",f=>{e=f(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let f=r.firstChild;n.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let o=t.someProp("clipboardSerializer")||E0.fromSchema(t.state.schema),a=w4e(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=b4e[c.nodeName.toLowerCase()]);){for(let f=u.length-1;f>=0;f--){let p=a.createElement(u[f]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",f=>f(e,t))||e.content.textBetween(0,e.content.size,`
|
||
|
||
`);return{dom:l,text:h,slice:e}}function m4e(t,e,n,r,i){let s=i.parent.type.spec.code,o,a;if(!n&&!e)return null;let l=!!e&&(r||s||!n);if(l){if(t.someProp("transformPastedText",h=>{e=h(e,s||r,t)}),s)return a=new We(De.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
||
`))),0,0),t.someProp("transformPasted",h=>{a=h(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",h=>h(e,i,r,t));if(d)a=d;else{let h=i.marks(),{schema:f}=t.state,p=E0.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=o.appendChild(document.createElement("p"));g&&y.appendChild(p.serializeNode(f.text(g,h)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=Wht(n),j3&&Ght(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||ny.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Hht.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=Kht(mre(a,+u[1],+u[2]),u[4]);else if(a=We.maxOpen(Uht(a.content,i),!0),a.openStart||a.openEnd){let d=0,h=0;for(let f=a.content.firstChild;d<a.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=mre(a,d,h)}return t.someProp("transformPasted",d=>{a=d(a,t,l)}),a}const Hht=/^(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 Uht(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&s.length&&y4e(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=v4e(o[o.length-1],s.length));let u=g4e(a,l);o.push(u),i=i.matchType(u.type),s=l}}),o)return De.from(o)}return t}function g4e(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,De.from(t));return t}function y4e(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=y4e(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(De.from(g4e(n,t,i+1))))}}function v4e(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,v4e(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(De.empty,!0);return t.copy(n.append(r))}function Gj(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(s=0),i<r-1&&(a=Gj(a,e,n,r,i+1,s)),i>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(De.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function mre(t,e,n){return e<t.openStart&&(t=new We(Gj(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new We(Gj(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const b4e={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let gre=null;function w4e(){return gre||(gre=document.implementation.createHTMLDocument("title"))}let RO=null;function qht(t){let e=window.trustedTypes;return e?(RO||(RO=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),RO.createHTML(t)):t}function Wht(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=w4e().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&b4e[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=qht(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function Ght(t){let e=t.querySelectorAll(Ms?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function Kht(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=De.from(l.create(r[a+1],i)),s++,o++}return new We(i,s,o)}const Do={},Po={},Yht={touchstart:!0,touchmove:!0};class Zht{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 Xht(t){for(let e in Do){let n=Do[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{Jht(t,r)&&!uq(t,r)&&(t.editable||!(r.type in Po))&&n(t,r)},Yht[e]?{passive:!0}:void 0)}so&&t.dom.addEventListener("input",()=>null),Kj(t)}function rm(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Qht(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Kj(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>uq(t,r))})}function uq(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function Jht(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function eft(t,e){!uq(t,e)&&Do[e.type]&&(t.editable||!(e.type in Po))&&Do[e.type](t,e)}Po.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!_4e(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Nh&&Ms&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),hx&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,bg(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||$ht(t,n)?n.preventDefault():rm(t,"key")};Po.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Po.keypress=(t,e)=>{let n=e;if(_4e(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Cl&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof mt)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function sR(t){return{left:t.clientX,top:t.clientY}}function tft(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function dq(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,a=>o>s.depth?a(t,n,s.nodeAfter,s.before(o),i,!0):a(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function yb(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function nft(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Et.isSelectable(r)?(yb(t,new Et(n)),!0):!1}function rft(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Et&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(Et.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(yb(t,Et.create(t.state.doc,i)),!0):!1}function ift(t,e,n,r,i){return dq(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?rft(t,n):nft(t,n))}function sft(t,e,n,r){return dq(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function oft(t,e,n,r){return dq(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||aft(t,n,r)}function aft(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(yb(t,mt.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)yb(t,mt.create(r,a+1,a+1+o.content.size));else if(Et.isSelectable(o))yb(t,Et.create(r,a));else continue;return!0}}function hq(t){return l8(t)}const x4e=Cl?"metaKey":"ctrlKey";Do.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=hq(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&tft(n,t.input.lastClick)&&!n[x4e]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(sR(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new lft(t,o,n,!!r)):(s=="doubleClick"?sft:oft)(t,o.pos,o.inside,n)?n.preventDefault():rm(t,"pointer"))};class lft{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[x4e],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let u=e.state.doc.resolve(n.pos);s=u.parent,o=u.depth?u.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof Et&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Gl&&!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)),rm(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(()=>Uh(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(sR(e))),this.updateAllowDefault(e),this.allowDefault||!n?rm(this.view,"pointer"):ift(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||so&&this.mightDrag&&!this.mightDrag.node.isAtom||Ms&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(yb(this.view,jt.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):rm(this.view,"pointer")}move(e){this.updateAllowDefault(e),rm(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)}}Do.touchstart=t=>{t.input.lastTouch=Date.now(),hq(t),rm(t,"pointer")};Do.touchmove=t=>{t.input.lastTouch=Date.now(),rm(t,"pointer")};Do.contextmenu=t=>hq(t);function _4e(t,e){return t.composing?!0:so&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const cft=Nh?5e3:-1;Po.compositionstart=Po.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof mt&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Ms&&J2e&&uft(t)))t.markCursor=t.state.storedMarks||n.marks(),l8(t,!0),t.markCursor=null;else if(l8(t,!e.selection.empty),Gl&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let a=t.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}S4e(t,cft)};function uft(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Po.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,S4e(t,20))};function S4e(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>l8(t),e))}function k4e(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=hft());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function dft(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=rht(e.focusNode,e.focusOffset),r=iht(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function hft(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function l8(t,e=!1){if(!(Nh&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),k4e(t),e||t.docView&&t.docView.dirty){let n=aq(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function fft(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const pk=ma&&Cm<15||hx&&lht<604;Do.copy=Po.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=pk?null:n.clipboardData,o=r.content(),{dom:a,text:l}=cq(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):fft(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function pft(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function mft(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.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=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?mk(t,r.value,null,i,e):mk(t,r.textContent,r.innerHTML,i,e)},50)}function mk(t,e,n,r,i){let s=m4e(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,s||We.empty)))return!0;if(!s)return!1;let o=pft(s),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function C4e(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Po.paste=(t,e)=>{let n=e;if(t.composing&&!Nh)return;let r=pk?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&mk(t,C4e(r),r.getData("text/html"),i,n)?n.preventDefault():mft(t,n)};class E4e{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const gft=Cl?"altKey":"ctrlKey";function T4e(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[gft]}Do.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(sR(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof Et?i.to-1:i.to))){if(r&&r.mightDrag)o=Et.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=Et.create(t.state.doc,d.posBefore))}}let a=(o||t.state.selection).content(),{dom:l,text:c,slice:u}=cq(t,a);(!n.dataTransfer.files.length||!Ms||Q2e>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(pk?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",pk||n.dataTransfer.setData("text/plain",c),t.dragging=new E4e(u,T4e(t,n),o)};Do.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Po.dragover=Po.dragenter=(t,e)=>e.preventDefault();Po.drop=(t,e)=>{try{yft(t,e,t.dragging)}finally{t.dragging=null}};function yft(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(sR(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",f=>{s=f(s,t,!1)}):s=m4e(t,C4e(e.dataTransfer),pk?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&T4e(t,e));if(t.someProp("handleDrop",f=>f(t,e,s||We.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?Xut(t.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let l=t.state.tr;if(o){let{node:f}=n;f?f.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,s.content.firstChild):l.replaceRange(c,c,s),l.doc.eq(d))return;let h=l.doc.resolve(c);if(u&&Et.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new Et(h));else{let f=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((p,g,y,v)=>f=v),l.setSelection(lq(t,h,l.doc.resolve(f)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}Do.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Uh(t)},20))};Do.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Do.beforeinput=(t,e)=>{if(Ms&&Nh&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,bg(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Po)Do[t]=Po[t];function gk(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class c8{constructor(e,n){this.toDOM=e,this.spec=n||h1,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new sr(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof c8&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&gk(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Tm{constructor(e,n){this.attrs=e,this.spec=n||h1}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new sr(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Tm&&gk(this.attrs,e.attrs)&&gk(this.spec,e.spec)}static is(e){return e.type instanceof Tm}destroy(){}}class fq{constructor(e,n){this.attrs=e,this.spec=n||h1}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new sr(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof fq&&gk(this.attrs,e.attrs)&&gk(this.spec,e.spec)}destroy(){}}class sr{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new sr(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new sr(e,e,new c8(n,r))}static inline(e,n,r,i){return new sr(e,n,new Tm(r,i))}static node(e,n,r,i){return new sr(e,n,new fq(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Tm}get widget(){return this.type instanceof c8}}const mv=[],h1={};class En{constructor(e,n){this.local=e.length?e:mv,this.children=n.length?n:mv}static create(e,n){return n.length?u8(n,e,0,h1):Gs}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,i+a,s)}}map(e,n,r){return this==Gs||e.maps.length==0?this:this.mapInner(e,n,0,0,r||h1)}mapInner(e,n,r,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(n,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?vft(this.children,o||[],e,n,r,i,s):o?new En(o.sort(f1),mv):Gs}add(e,n){return n.length?this==Gs?En.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((a,l)=>{let c=l+r,u;if(u=I4e(n,a,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,u,c+1):i.splice(s,0,l,l+a.nodeSize,u8(u,a,c+1,h1)),s+=3}});let o=A4e(s?R4e(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new En(o.length?this.local.concat(o).sort(f1):this.local,i||this.children)}remove(e){return e.length==0||this==Gs?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+n,l=r[s+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,a+1);c!=Gs?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new En(i,r):Gs}forChild(e,n){if(this==Gs)return this;if(n.isLeaf)return En.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof Tm){let c=Math.max(s,l.from)-s,u=Math.min(o,l.to)-s;c<u&&(i||(i=[])).push(l.copy(c,u))}}if(i){let a=new En(i.sort(f1),mv);return r?new Ap([a,r]):a}return r||Gs}eq(e){if(this==e)return!0;if(!(e instanceof En)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return pq(this.localsInner(e))}localsInner(e){if(this==Gs)return mv;if(e.inlineContent||!this.local.some(Tm.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Tm||n.push(this.local[r]);return n}forEachSet(e){e(this)}}En.empty=new En([],[]);En.removeOverlap=pq;const Gs=En.empty;class Ap{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,h1));return Ap.from(r)}forChild(e,n){if(n.isLeaf)return En.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=Gs&&(s instanceof Ap?r=r.concat(s.members):r.push(s))}return Ap.from(r)}eq(e){if(!(e instanceof Ap)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?pq(r?n:n.sort(f1)):mv}static from(e){switch(e.length){case 0:return Gs;case 1:return e[0];default:return new Ap(e.every(n=>n instanceof En)?e:e.reduce((n,r)=>n.concat(r instanceof En?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function vft(t,e,n,r,i,s,o){let a=t.slice();for(let c=0,u=s;c<n.maps.length;c++){let d=0;n.maps[c].forEach((h,f,p,g)=>{let y=g-p-(f-h);for(let v=0;v<a.length;v+=3){let b=a[v+1];if(b<0||h>b+u-d)continue;let _=a[v]+u-d;f>=_?a[v+1]=h<=_?-2:-1:h>=u&&y&&(a[v]+=y,a[v+1]+=y)}d+=y}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(t[c]+s),d=u-i;if(d<0||d>=r.content.size){l=!0;continue}let h=n.map(t[c+1]+s,-1),f=h-i,{index:p,offset:g}=r.content.findIndex(d),y=r.maybeChild(p);if(y&&g==d&&g+y.nodeSize==f){let v=a[c+2].mapInner(n,y,u+1,t[c]+s+1,o);v!=Gs?(a[c]=d,a[c+1]=f,a[c+2]=v):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=bft(a,t,e,n,i,s,o),u=u8(c,r,0,o);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,h=0;d<u.children.length;d+=3){let f=u.children[d];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,u.children[d],u.children[d+1],u.children[d+2])}}return new En(e.sort(f1),a)}function A4e(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new sr(i.from+e,i.to+e,i.type))}return n}function bft(t,e,n,r,i,s,o){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,i,c);d?n.push(d):o.onRemove&&o.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+s+1);return n}function I4e(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function R4e(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function u8(t,e,n,r){let i=[],s=!1;e.forEach((a,l)=>{let c=I4e(t,a,l+n);if(c){s=!0;let u=u8(c,a,n+l+1,r);u!=Gs&&i.push(l,l+a.nodeSize,u)}});let o=A4e(s?R4e(t):t,-n).sort(f1);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new En(o,i):Gs}function f1(t,e){return t.from-e.from||t.to-e.to}function pq(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),yre(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),yre(e,i,r.copy(s.from,r.to)));break}}}return e}function yre(t,e,n){for(;e<t.length&&f1(n,t[e])>0;)e++;t.splice(e,0,n)}function MO(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Gs&&e.push(r)}),t.cursorWrapper&&e.push(En.create(t.state.doc,[t.cursorWrapper.deco])),Ap.from(e)}const wft={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},xft=ma&&Cm<=11;class _ft{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}}class Sft{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new _ft,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);ma&&Cm<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():so&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),xft&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,wft)),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 n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(cre(this.view)){if(this.suppressingSelectionUpdates)return Uh(this.view);if(ma&&Cm<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&iy(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 n=new Set,r;for(let s=e.focusNode;s;s=dx(s))n.add(s);for(let s=e.anchorNode;s;s=dx(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))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 n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&cre(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(s=s<0?d.from:Math.min(d.from,s),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(l.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of l)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(Gl&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,h]=u;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of u){let f=h.parentNode;f&&f.nodeName=="LI"&&(!d||Eft(e,d)!=f)&&h.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&rR(r)&&(c=aq(e))&&c.eq(jt.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Uh(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),kft(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Tft(e,l)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Uh(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(ma&&Cm<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:h}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let o=i&&i.parentNode==e.target?Cs(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?Cs(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let vre=new WeakMap,bre=!1;function kft(t){if(!vre.has(t)&&(vre.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Gl,bre)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."),bre=!0}}function wre(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return iy(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function Cft(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return wre(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?wre(t,n):null}function Eft(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function Tft(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(s,a.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function Aft(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:o,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,u=l.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],rR(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Ms&&t.input.lastKeyCode===8)for(let y=s;y>i;y--){let v=r.childNodes[y-1],b=v.pmViewDesc;if(v.nodeName=="BR"&&!b){s=y;break}if(!b||b.size)break}let d=t.state.doc,h=t.someProp("domParser")||ny.fromSchema(t.state.schema),f=d.resolve(o),p=null,g=h.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:s,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Ift,context:f});if(c&&c[0].pos!=null){let y=c[0].pos,v=c[1]&&c[1].pos;v==null&&(v=y),p={anchor:y+o,head:v+o}}return{doc:g,sel:p,from:o,to:a}}function Ift(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(so&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||so&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Rft=/^(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 Mft(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let E=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,C=aq(t,E);if(C&&!t.state.selection.eq(C)){if(Ms&&Nh&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",M=>M(t,bg(13,"Enter"))))return;let R=t.state.tr.setSelection(C);E=="pointer"?R.setMeta("pointer",!0):E=="key"&&R.scrollIntoView(),s&&R.setMeta("composition",s),t.dispatch(R)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=Aft(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),h,f;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,f="end"):(h=t.state.selection.from,f="start"),t.input.lastKeyCode=null;let p=Dft(d.content,c.doc.content,c.from,h,f);if(p&&t.input.domChangeCount++,(hx&&t.input.lastIOSEnter>Date.now()-225||Nh)&&i.some(E=>E.nodeType==1&&!Rft.test(E.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",E=>E(t,bg(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof mt&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let E=xre(t,t.state.doc,c.sel);if(E&&!E.eq(t.state.selection)){let C=t.state.tr.setSelection(E);s&&C.setMeta("composition",s),t.dispatch(C)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof mt&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),ma&&Cm<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" "&&(p.start--,p.endA--,p.endB--);let g=c.doc.resolveNoCache(p.start-c.from),y=c.doc.resolveNoCache(p.endB-c.from),v=u.resolve(p.start),b=g.sameParent(y)&&g.parent.inlineContent&&v.end()>=p.endA;if((hx&&t.input.lastIOSEnter>Date.now()-225&&(!b||i.some(E=>E.nodeName=="DIV"||E.nodeName=="P"))||!b&&g.pos<c.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(c.doc.textBetween(g.pos,y.pos,"","")))&&t.someProp("handleKeyDown",E=>E(t,bg(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&Oft(u,p.start,p.endA,g,y)&&t.someProp("handleKeyDown",E=>E(t,bg(8,"Backspace")))){Nh&&Ms&&t.domObserver.suppressSelectionUpdates();return}Ms&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),Nh&&!b&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,y=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(E){return E(t,bg(13,"Enter"))})},20));let _=p.start,S=p.endA,k=E=>{let C=E||t.state.tr.replace(_,S,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let R=xre(t,C.doc,c.sel);R&&!(Ms&&t.composing&&R.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(R.head==_||R.head==C.mapping.map(S)-1)||ma&&R.empty&&R.head==_)&&C.setSelection(R)}return s&&C.setMeta("composition",s),C.scrollIntoView()},T;if(b)if(g.pos==y.pos){ma&&Cm<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Uh(t),20));let E=k(t.state.tr.delete(_,S)),C=u.resolve(p.start).marksAcross(u.resolve(p.endA));C&&E.ensureMarks(C),t.dispatch(E)}else if(p.endA==p.endB&&(T=Nft(g.parent.content.cut(g.parentOffset,y.parentOffset),v.parent.content.cut(v.parentOffset,p.endA-v.start())))){let E=k(t.state.tr);T.type=="add"?E.addMark(_,S,T.mark):E.removeMark(_,S,T.mark),t.dispatch(E)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let E=g.parent.textBetween(g.parentOffset,y.parentOffset),C=()=>k(t.state.tr.insertText(E,_,S));t.someProp("handleTextInput",R=>R(t,_,S,E,C))||t.dispatch(C())}else t.dispatch(k());else t.dispatch(k())}function xre(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:lq(t,e.resolve(n.anchor),e.resolve(n.head))}function Nft(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,a,l;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<n.length;u++)s=n[u].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=u=>u.mark(a.addToSet(u.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(De.from(c).eq(t))return{mark:a,type:o}}function Oft(t,e,n,r,i){if(n-e<=i.pos-r.pos||NO(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&n==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(NO(s,!0,!0));return!o.parent.isTextblock||o.pos>n||NO(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function NO(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function Dft(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o<s&&t.size<e.size){let l=r<=s&&r>=o?s-r:0;s-=l,s&&s<e.size&&_re(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-o),o=s}else if(a<s){let l=r<=s&&r>=a?s-r:0;s-=l,s&&s<t.size&&_re(t.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function _re(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class mq{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Zht,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Tre),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=Cre(this),kre(this),this.nodeViews=Ere(this),this.docView=rre(this.state.doc,Sre(this),MO(this),this.dom,this),this.domObserver=new Sft(this,(r,i,s,o)=>Mft(this,r,i,s,o)),this.domObserver.start(),Xht(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 n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Kj(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Tre),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(k4e(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let f=Ere(this);Lft(f,this.nodeViews)&&(this.nodeViews=f,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Kj(this),this.editable=Cre(this),kre(this);let l=MO(this),c=Sre(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(i.selection))&&(o=!0);let h=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&dht(this);if(o){this.domObserver.stop();let f=d&&(ma||Ms)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Pft(i.selection,e.selection);if(d){let p=Ms?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=dft(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=rre(e.doc,c,l,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Pht(this))?Uh(this,f):(h4e(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():h&&hht(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Et){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Xne(this,n.getBoundingClientRect(),e)}else Xne(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 n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new E4e(e.slice,e.move,i<0?void 0:Et.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=n?n(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(ma){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&&fht(this.dom),Uh(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return vht(this,e)}coordsAtPos(e,n=1){return i4e(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return Sht(this,n||this.state,e)}pasteHTML(e,n){return mk(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return mk(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return cq(this,e)}destroy(){this.docView&&(Qht(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],MO(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,tht())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return eft(this,e)}domSelectionRange(){let e=this.domSelection();return e?so&&this.root.nodeType===11&&oht(this.dom.ownerDocument)==this.dom&&Cft(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}mq.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Sre(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[sr.node(0,t.state.doc.content.size,e)]}function kre(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:sr.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Cre(t){return!t.someProp("editable",e=>e(t.state)===!1)}function Pft(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Ere(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Lft(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function Tre(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}function Af(t,e){return t.meta={package:"@milkdown/core",group:"System",...e},t}var M4e={text:(t,e,n,r)=>{const i=t.value;return/^[^*_\\]*\s+$/.test(i)?i:n.safe(i,{...r,encode:[]})},strong:(t,e,n,r)=>{const i=t.marker||n.options.strong||"*",s=n.enter("strong"),o=n.createTracker(r);let a=o.move(i+i);return a+=o.move(n.containerPhrasing(t,{before:a,after:i,...o.current()})),a+=o.move(i+i),s(),a},emphasis:(t,e,n,r)=>{const i=t.marker||n.options.emphasis||"*",s=n.enter("emphasis"),o=n.createTracker(r);let a=o.move(i);return a+=o.move(n.containerPhrasing(t,{before:a,after:i,...o.current()})),a+=o.move(i),s(),a}},cn=fn({},"editorView"),D4=fn({},"editorState"),OO=fn([],"initTimer"),d8=fn({},"editor"),yk=fn([],"inputRules"),Qm=fn([],"prosePlugins"),vk=fn([],"remarkPlugins"),bk=fn([],"nodeView"),wk=fn([],"markView"),p1=fn(Ij().use(_j).use(Ej),"remark"),G_=fn({handlers:M4e,encode:[]},"remarkStringifyOptions"),b6=Md("ConfigReady");function zft(t){const e=n=>(n.record(b6),async()=>(await t(n),n.done(b6),()=>{n.clearTimer(b6)}));return Af(e,{displayName:"Config"}),e}var m1=Md("InitReady");function jft(t){const e=n=>(n.inject(d8,t).inject(Qm,[]).inject(vk,[]).inject(yk,[]).inject(bk,[]).inject(wk,[]).inject(G_,{handlers:M4e,encode:[]}).inject(p1,Ij().use(_j).use(Ej)).inject(OO,[b6]).record(m1),async()=>{await n.waitTimers(OO);const r=n.get(G_);return n.set(p1,Ij().use(_j).use(Ej,r)),n.done(m1),()=>{n.remove(d8).remove(Qm).remove(vk).remove(yk).remove(bk).remove(wk).remove(G_).remove(p1).remove(OO).clearTimer(m1)}});return Af(e,{displayName:"Init"}),e}var Oo=Md("SchemaReady"),DO=fn([],"schemaTimer"),Fc=fn({},"schema"),K_=fn([],"nodes"),Y_=fn([],"marks");function Are(t){var e;return{...t,parseDOM:(e=t.parseDOM)==null?void 0:e.map(n=>({priority:t.priority,...n}))}}var N4e=t=>(t.inject(Fc,{}).inject(K_,[]).inject(Y_,[]).inject(DO,[m1]).record(Oo),async()=>{await t.waitTimers(DO);const e=t.get(p1),n=t.get(vk).reduce((i,s)=>i.use(s.plugin,s.options),e);t.set(p1,n);const r=new d2e({nodes:Object.fromEntries(t.get(K_).map(([i,s])=>[i,Are(s)])),marks:Object.fromEntries(t.get(Y_).map(([i,s])=>[i,Are(s)]))});return t.set(Fc,r),t.done(Oo),()=>{t.remove(Fc).remove(K_).remove(Y_).remove(DO).clearTimer(Oo)}});Af(N4e,{displayName:"Schema"});var Wg,xl,Kle,O4e=(Kle=class{constructor(){te(this,Wg);te(this,xl);W(this,Wg,new yxe),W(this,xl,null),this.setCtx=t=>{W(this,xl,t)},this.chain=()=>{if(O(this,xl)==null)throw lO();const t=O(this,xl),e=[],n=this.get.bind(this),r={run:()=>{const s=c2(...e),o=t.get(cn);return s(o.state,o.dispatch,o)},inline:s=>(e.push(s),r),pipe:i.bind(this)};function i(s,o){const a=n(s);return e.push(a(o)),r}return r}}get ctx(){return O(this,xl)}create(t,e){const n=t.create(O(this,Wg).sliceMap);return n.set(e),n}get(t){return O(this,Wg).get(t).get()}remove(t){return O(this,Wg).remove(t)}call(t,e){if(O(this,xl)==null)throw lO();const n=this.get(t)(e),r=O(this,xl).get(cn);return n(r.state,r.dispatch,r)}inline(t){if(O(this,xl)==null)throw lO();const e=O(this,xl).get(cn);return t(e.state,e.dispatch,e)}},Wg=new WeakMap,xl=new WeakMap,Kle);function Bft(t="cmdKey"){return fn(()=>()=>!1,t)}var je=fn(new O4e,"commands"),PO=fn([Oo],"commandsTimer"),Z_=Md("CommandsReady"),D4e=t=>{const e=new O4e;return e.setCtx(t),t.inject(je,e).inject(PO,[Oo]).record(Z_),async()=>(await t.waitTimers(PO),t.done(Z_),()=>{t.remove(je).remove(PO).clearTimer(Z_)})};Af(D4e,{displayName:"Commands"});function Fft(t){return t.Backspace=c2(Cdt,JU,adt,M2e),t}var Gg,Qo,Yle,P4e=(Yle=class{constructor(){te(this,Gg);te(this,Qo);W(this,Gg,null),W(this,Qo,[]),this.setCtx=t=>{W(this,Gg,t)},this.add=t=>(O(this,Qo).push(t),()=>{W(this,Qo,O(this,Qo).filter(e=>e!==t))}),this.addObjectKeymap=t=>{const e=[];return Object.entries(t).forEach(([n,r])=>{if(typeof r=="function"){const i={key:n,onRun:()=>r};O(this,Qo).push(i),e.push(()=>{W(this,Qo,O(this,Qo).filter(s=>s!==i))})}else O(this,Qo).push(r),e.push(()=>{W(this,Qo,O(this,Qo).filter(i=>i!==r))})}),()=>{e.forEach(n=>n())}},this.addBaseKeymap=()=>{const t=Fft(Sdt);return this.addObjectKeymap(t)},this.build=()=>{const t={};return O(this,Qo).forEach(e=>{t[e.key]=[...t[e.key]||[],e]}),Object.fromEntries(Object.entries(t).map(([e,n])=>{const r=n.sort((s,o)=>(o.priority??50)-(s.priority??50));return[e,(s,o,a)=>{const l=O(this,Gg);if(l==null)throw qI();return c2(...r.map(c=>c.onRun(l)))(s,o,a)}]}))}}get ctx(){return O(this,Gg)}},Gg=new WeakMap,Qo=new WeakMap,Yle),h8=fn(new P4e,"keymap"),LO=fn([Oo],"keymapTimer"),X_=Md("KeymapReady"),Vft=t=>{const e=new P4e;return e.setCtx(t),t.inject(h8,e).inject(LO,[Oo]).record(X_),async()=>(await t.waitTimers(LO),t.done(X_),()=>{t.remove(h8).remove(LO).clearTimer(X_)})},w6=Md("ParserReady"),L4e=()=>{throw qI()},fd=fn(L4e,"parser"),zO=fn([],"parserTimer"),z4e=t=>(t.inject(fd,L4e).inject(zO,[Oo]).record(w6),async()=>{await t.waitTimers(zO);const e=t.get(p1),n=t.get(Fc);return t.set(fd,Qdt.create(n,e)),t.done(w6),()=>{t.remove(fd).remove(zO).clearTimer(w6)}});Af(z4e,{displayName:"Parser"});var Q_=Md("SerializerReady"),jO=fn([],"serializerTimer"),j4e=()=>{throw qI()},g1=fn(j4e,"serializer"),B4e=t=>(t.inject(g1,j4e).inject(jO,[Oo]).record(Q_),async()=>{await t.waitTimers(jO);const e=t.get(p1),n=t.get(Fc);return t.set(g1,eht.create(n,e)),t.done(Q_),()=>{t.remove(g1).remove(jO).clearTimer(Q_)}});Af(B4e,{displayName:"Serializer"});var x6=fn("","defaultValue"),BO=fn(t=>t,"stateOptions"),FO=fn([],"editorStateTimer"),_6=Md("EditorStateReady");function $ft(t,e,n){if(typeof t=="string")return e(t);if(t.type==="html")return ny.fromSchema(n).parse(t.dom);if(t.type==="json")return Hh.fromJSON(n,t.value);throw Sot(t)}var Hft=new Vn("MILKDOWN_STATE_TRACKER"),F4e=t=>(t.inject(x6,"").inject(D4,{}).inject(BO,e=>e).inject(FO,[w6,Q_,Z_,X_]).record(_6),async()=>{await t.waitTimers(FO);const e=t.get(Fc),n=t.get(fd),r=t.get(yk),i=t.get(BO),s=t.get(Qm),o=$ft(t.get(x6),n,e),a=t.get(h8),l=a.addBaseKeymap(),c=[...s,new Fn({key:Hft,state:{init:()=>{},apply:(h,f,p,g)=>{t.set(D4,g)}}}),Ndt({rules:r}),G2e(a.build())];t.set(Qm,c);const u=i({schema:e,doc:o,plugins:c}),d=Ig.create(u);return t.set(D4,d),t.done(_6),()=>{l(),t.remove(x6).remove(D4).remove(BO).remove(FO).clearTimer(_6)}});Af(F4e,{displayName:"EditorState"});var xk=fn([],"pasteRule"),VO=fn([Oo],"pasteRuleTimer"),S6=Md("PasteRuleReady"),V4e=t=>(t.inject(xk,[]).inject(VO,[Oo]).record(S6),async()=>(await t.waitTimers(VO),t.done(S6),()=>{t.remove(xk).remove(VO).clearTimer(S6)}));Af(V4e,{displayName:"PasteRule"});var k6=Md("EditorViewReady"),$O=fn([],"editorViewTimer"),J_=fn({},"editorViewOptions"),C6=fn(null,"root"),Yj=fn(null,"rootDOM"),Zj=fn({},"rootAttrs");function Uft(t,e){const n=document.createElement("div");n.className="milkdown",t.appendChild(n),e.set(Yj,n);const r=e.get(Zj);return Object.entries(r).forEach(([i,s])=>n.setAttribute(i,s)),n}function qft(t){t.classList.add("editor"),t.setAttribute("role","textbox")}var Wft=new Vn("MILKDOWN_VIEW_CLEAR"),$4e=t=>(t.inject(C6,document.body).inject(cn,{}).inject(J_,{}).inject(Yj,null).inject(Zj,{}).inject($O,[_6,S6]).record(k6),async()=>{await t.wait(m1);const e=t.get(C6)||document.body,n=typeof e=="string"?document.querySelector(e):e;t.update(Qm,o=>[new Fn({key:Wft,view:a=>{const l=n?Uft(n,t):void 0;return(()=>{if(l&&n){const u=a.dom;n.replaceChild(l,u),l.appendChild(u)}})(),{destroy:()=>{l!=null&&l.parentNode&&(l==null||l.parentNode.replaceChild(a.dom,l)),l==null||l.remove()}}}}),...o]),await t.waitTimers($O);const r=t.get(D4),i=t.get(J_),s=new mq(n,{state:r,nodeViews:Object.fromEntries(t.get(bk)),markViews:Object.fromEntries(t.get(wk)),transformPasted:(o,a,l)=>(t.get(xk).sort((c,u)=>(u.priority??50)-(c.priority??50)).map(c=>c.run).forEach(c=>{o=c(o,a,l)}),o),...i});return qft(s.dom),t.set(cn,s),t.done(k6),()=>{s==null||s.destroy(),t.remove(C6).remove(cn).remove(J_).remove(Yj).remove(Zj).remove($O).clearTimer(k6)}});Af($4e,{displayName:"EditorView"});var Ws=function(t){return t.Idle="Idle",t.OnCreate="OnCreate",t.Created="Created",t.OnDestroy="OnDestroy",t.Destroyed="Destroyed",t}({}),Kg,Da,bh,ow,f5,p5,Jo,wh,Yg,m5,Zg,aw,g5,qp,lw,cw,Gft=(cw=class{constructor(){te(this,Kg);te(this,Da);te(this,bh);te(this,ow);te(this,f5);te(this,p5);te(this,Jo);te(this,wh);te(this,Yg);te(this,m5);te(this,Zg);te(this,aw);te(this,g5);te(this,qp);te(this,lw);W(this,Kg,!1),W(this,Da,Ws.Idle),W(this,bh,[]),W(this,ow,()=>{}),W(this,f5,new yxe),W(this,p5,new zot),W(this,Jo,new Map),W(this,wh,new Map),W(this,Yg,new Lot(O(this,f5),O(this,p5))),W(this,m5,()=>{const e=zft(async r=>{await Promise.all(O(this,bh).map(i=>Promise.resolve(i(r))))}),n=[N4e,z4e,B4e,D4e,Vft,V4e,F4e,$4e,jft(this),e];O(this,Zg).call(this,n,O(this,wh))}),W(this,Zg,(e,n)=>{e.forEach(r=>{const i=O(this,Yg).produce(O(this,Kg)?r.meta:void 0),s=r(i);n.set(r,{ctx:i,handler:s,cleanup:void 0})})}),W(this,aw,(e,n=!1)=>Promise.all([e].flat().map(async r=>{var s;const i=(s=O(this,Jo).get(r))==null?void 0:s.cleanup;return n?O(this,Jo).delete(r):O(this,Jo).set(r,{ctx:void 0,handler:void 0,cleanup:void 0}),typeof i=="function"?i():i}))),W(this,g5,async()=>{await Promise.all([...O(this,wh).entries()].map(async([e,{cleanup:n}])=>typeof n=="function"?n():n)),O(this,wh).clear()}),W(this,qp,e=>{W(this,Da,e),O(this,ow).call(this,e)}),W(this,lw,e=>[...e.entries()].map(async([n,r])=>{const{ctx:i,handler:s}=r;if(!s)return;const o=await s();e.set(n,{ctx:i,handler:s,cleanup:o})})),this.enableInspector=(e=!0)=>(W(this,Kg,e),this),this.onStatusChange=e=>(W(this,ow,e),this),this.config=e=>(O(this,bh).push(e),this),this.removeConfig=e=>(W(this,bh,O(this,bh).filter(n=>n!==e)),this),this.use=e=>{const n=[e].flat();return n.flat().forEach(r=>{O(this,Jo).set(r,{ctx:void 0,handler:void 0,cleanup:void 0})}),O(this,Da)===Ws.Created&&O(this,Zg).call(this,n,O(this,Jo)),this},this.remove=async e=>O(this,Da)===Ws.OnCreate?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise(n=>{setTimeout(()=>{n(this.remove(e))},50)})):(await O(this,aw).call(this,[e].flat(),!0),this),this.create=async()=>O(this,Da)===Ws.OnCreate?this:(O(this,Da)===Ws.Created&&await this.destroy(),O(this,qp).call(this,Ws.OnCreate),O(this,m5).call(this),O(this,Zg).call(this,[...O(this,Jo).keys()],O(this,Jo)),await Promise.all([O(this,lw).call(this,O(this,wh)),O(this,lw).call(this,O(this,Jo))].flat()),O(this,qp).call(this,Ws.Created),this),this.destroy=async(e=!1)=>O(this,Da)===Ws.Destroyed||O(this,Da)===Ws.OnDestroy?this:O(this,Da)===Ws.OnCreate?new Promise(n=>{setTimeout(()=>{n(this.destroy(e))},50)}):(e&&W(this,bh,[]),O(this,qp).call(this,Ws.OnDestroy),await O(this,aw).call(this,[...O(this,Jo).keys()],e),await O(this,g5).call(this),O(this,qp).call(this,Ws.Destroyed),this),this.action=e=>e(O(this,Yg)),this.inspect=()=>O(this,Kg)?[...O(this,wh).values(),...O(this,Jo).values()].map(({ctx:e})=>{var n;return(n=e==null?void 0:e.inspector)==null?void 0:n.read()}).filter(e=>!!e):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])}static make(){return new cw}get ctx(){return O(this,Yg)}get status(){return O(this,Da)}},Kg=new WeakMap,Da=new WeakMap,bh=new WeakMap,ow=new WeakMap,f5=new WeakMap,p5=new WeakMap,Jo=new WeakMap,wh=new WeakMap,Yg=new WeakMap,m5=new WeakMap,Zg=new WeakMap,aw=new WeakMap,g5=new WeakMap,qp=new WeakMap,lw=new WeakMap,cw);let Kft=t=>crypto.getRandomValues(new Uint8Array(t)),Yft=(t,e,n)=>{let r=256-256%t.length;if(r===256){let s=t.length-1;return(o=e)=>{if(!o)return"";let a="";for(;;){let l=n(o),c=o;for(;c--;)if(a+=t[l[c]&s],a.length>=o)return a}}}let i=Math.ceil(1.6*256*e/r);return(s=e)=>{if(!s)return"";let o="";for(;;){let a=n(i),l=i;for(;l--;)if(a[l]<r&&(o+=t[a[l]%t.length],o.length>=s))return o}}},gq=(t,e=21)=>Yft(t,e|0,Kft);gq("abcedfghicklmn",10);function bt(t,e){const n=Bft(t),r=i=>async()=>{r.key=n,await i.wait(Z_);const s=e(i);return i.get(je).create(n,s),r.run=o=>i.get(je).call(t,o),()=>{i.get(je).remove(n)}};return r}function co(t){const e=n=>async()=>{await n.wait(Oo);const r=t(n);return n.update(yk,i=>[...i,r]),e.inputRule=r,()=>{n.update(yk,i=>i.filter(s=>s!==r))}};return e}function Zft(t){const e=n=>async()=>{await n.wait(Oo);const r=t(n);return n.update(xk,i=>[...i,r]),e.pasteRule=r,()=>{n.update(xk,i=>i.filter(s=>s!==r))}};return e}function Xft(t,e){const n=r=>async()=>{const i=e(r);return r.update(Y_,s=>[...s.filter(o=>o[0]!==t),[t,i]]),n.id=t,n.schema=i,()=>{r.update(Y_,s=>s.filter(([o])=>o!==t))}};return n.type=r=>{const i=r.get(Fc).marks[t];if(!i)throw Rot(t);return i},n}function yq(t,e){const n=r=>async()=>{const i=e(r);return r.update(K_,s=>[...s.filter(o=>o[0]!==t),[t,i]]),n.id=t,n.schema=i,()=>{r.update(K_,s=>s.filter(([o])=>o!==t))}};return n.type=r=>{const i=r.get(Fc).nodes[t];if(!i)throw mxe(t);return i},n}function Sr(t){let e;const n=r=>async()=>(await r.wait(Oo),e=t(r),r.update(Qm,i=>[...i,e]),()=>{r.update(Qm,i=>i.filter(s=>s!==e))});return n.plugin=()=>e,n.key=()=>e.spec.key,n}function H4e(t){const e=n=>async()=>{await n.wait(X_);const r=n.get(h8),i=t(n),s=r.addObjectKeymap(i);return e.keymap=i,()=>{s()}};return e}function F3(t,e){const n=r=>async()=>{await r.wait(Oo);const i=e(r);return t.type(r)instanceof s8?r.update(bk,s=>[...s,[t.id,i]]):r.update(wk,s=>[...s,[t.id,i]]),n.view=i,n.type=t,()=>{t.type(r)instanceof s8?r.update(bk,s=>s.filter(o=>o[0]!==t.id)):r.update(wk,s=>s.filter(o=>o[0]!==t.id))}};return n}function xn(t,e){const n=fn(t,e),r=i=>(i.inject(n),()=>()=>{i.remove(n)});return r.key=n,r}function xi(t,e){const n=xn(e,t),r=yq(t,s=>s.get(n.key)(s)),i=[n,r];return i.id=r.id,i.node=r,i.type=s=>r.type(s),i.ctx=n,i.key=n.key,i.extendSchema=s=>xi(t,s(e)),i}function u2(t,e){const n=xn(e,t),r=Xft(t,s=>s.get(n.key)(s)),i=[n,r];return i.id=r.id,i.mark=r,i.type=s=>r.type(s),i.ctx=n,i.key=n.key,i.extendSchema=s=>u2(t,s(e)),i}function ka(t,e){const n=xn(Object.fromEntries(Object.entries(e).map(([s,{shortcuts:o,priority:a}])=>[s,{shortcuts:o,priority:a}])),`${t}Keymap`),r=H4e(s=>{const o=s.get(n.key),a=Object.entries(e).flatMap(([l,{command:c}])=>{const u=o[l],d=[u.shortcuts].flat(),h=u.priority;return d.map(f=>[f,{key:f,onRun:c,priority:h}])});return Object.fromEntries(a)}),i=[n,r];return i.ctx=n,i.shortcuts=r,i.key=n.key,i.keymap=r.keymap,i}var ou=(t,e=()=>({}))=>xn(e,`${t}Attr`),V3=(t,e=()=>({}))=>xn(e,`${t}Attr`);function Nd(t,e,n){const r=xn({},t),i=o=>async()=>{await o.wait(m1);const a={plugin:e(o),options:o.get(r.key)};return o.update(vk,l=>[...l,a]),()=>{o.update(vk,l=>l.filter(c=>c!==a))}},s=[r,i];return s.id=t,s.plugin=i,s.options=r,s}function Qft(t){return e=>{const n=e.get(cn);return e.get(Fc),e.get(g1)(n.state.doc)}}function Jft(t){let e=t.schema.cached.changeSetIDs||(t.schema.cached.changeSetIDs=Object.create(null)),n=e[t.name];return n==null&&(e[t.name]=n=Object.keys(t.schema.nodes).indexOf(t.name)+1),n}const U4e={encodeCharacter:t=>t,encodeNodeStart:t=>t.type.name,encodeNodeEnd:t=>-Jft(t.type),compareTokens:(t,e)=>t===e};function Xj(t,e,n,r,i){for(let s=0,o=0;s<t.childCount;s++){let a=t.child(s),l=o+a.nodeSize,c=Math.max(o,n),u=Math.min(l,r);if(c<u)if(a.isText)for(let d=c;d<u;d++)i.push(e.encodeCharacter(a.text.charCodeAt(d-o),a.marks));else a.isLeaf?i.push(e.encodeNodeStart(a)):(c==o&&i.push(e.encodeNodeStart(a)),Xj(a.content,e,Math.max(o+1,c)-o-1,Math.min(l-1,u)-o-1,i),u==l&&i.push(e.encodeNodeEnd(a)));o=l}return i}const ept=5e3;function tpt(t,e){return Math.min(15,Math.max(2,Math.floor(Math.max(t,e)/10)))}function q4e(t,e,n,r=U4e){let i=Xj(t,r,n.fromA,n.toA,[]),s=Xj(e,r,n.fromB,n.toB,[]),o=0,a=i.length,l=s.length,c=r.compareTokens;for(;o<i.length&&o<s.length&&c(i[o],s[o]);)o++;if(o==i.length&&o==s.length)return[];for(;a>o&&l>o&&c(i[a-1],s[l-1]);)a--,l--;if(a==o||l==o||a==l&&a==o+1)return[n.slice(o,a,o,l)];let u=a-o,d=l-o,h=Math.min(ept,u+d),f=h+1,p=[],g=[];for(let y=f*2,v=0;v<y;v++)g[v]=-1;for(let y=0;y<=h;y++){for(let v=-y;v<=y;v+=2){let b=g[v+1+h],_=g[v-1+h],S=b<_?_:b+1,k=S+v;for(;S<u&&k<d&&c(i[o+S],s[o+k]);)S++,k++;if(g[v+h]=S,S>=u&&k>=d){let T=[],E=tpt(a-o,l-o),C=-1,R=-1,M=-1,D=-1,P=(z,Z,re,G)=>{C>-1&&C<Z+E?(C=z,M=re):(C>-1&&T.push(n.slice(C,R,M,D)),C=z,R=Z,M=re,D=G)};for(let z=y-1;z>=0;z--){let Z=g[v+1+h],re=g[v-1+h];Z<re?(v--,S=re+o,k=S+v,P(S,S,k,k+1)):(v++,S=Z+o,k=S+v,P(S,S+1,k,k)),g=p[z>>1]}return C>-1&&T.push(n.slice(C,R,M,D)),T.reverse()}}y%2==0&&p.push(g.slice())}return[n.slice(o,a,o,l)]}let as=class P4{constructor(e,n){this.length=e,this.data=n}cut(e){return e==this.length?this:new P4(e,this.data)}static slice(e,n,r){if(n==r)return P4.none;if(n==0&&r==P4.len(e))return e;let i=[];for(let s=0,o=0;o<r;s++){let a=e[s],l=o+a.length,c=Math.min(r,l)-Math.max(n,o);c>0&&i.push(a.cut(c)),o=l}return i}static join(e,n,r){if(e.length==0)return n;if(n.length==0)return e;let i=r(e[e.length-1].data,n[0].data);if(i==null)return e.concat(n);let s=e.slice(0,e.length-1);s.push(new P4(e[e.length-1].length+n[0].length,i));for(let o=1;o<n.length;o++)s.push(n[o]);return s}static len(e){let n=0;for(let r=0;r<e.length;r++)n+=e[r].length;return n}};as.none=[];class Va{constructor(e,n,r,i,s,o){this.fromA=e,this.toA=n,this.fromB=r,this.toB=i,this.deleted=s,this.inserted=o}get lenA(){return this.toA-this.fromA}get lenB(){return this.toB-this.fromB}slice(e,n,r,i){return e==0&&r==0&&n==this.toA-this.fromA&&i==this.toB-this.fromB?this:new Va(this.fromA+e,this.fromA+n,this.fromB+r,this.fromB+i,as.slice(this.deleted,e,n),as.slice(this.inserted,r,i))}static merge(e,n,r){if(e.length==0)return n;if(n.length==0)return e;let i=[];for(let s=0,o=0,a=e[0],l=n[0];;){if(!a&&!l)return i;if(a&&(!l||a.toB<l.fromA)){let c=o?n[o-1].toB-n[o-1].toA:0;i.push(c==0?a:new Va(a.fromA,a.toA,a.fromB+c,a.toB+c,a.deleted,a.inserted)),a=s++==e.length?null:e[s]}else if(l&&(!a||l.toA<a.fromB)){let c=s?e[s-1].toB-e[s-1].toA:0;i.push(c==0?l:new Va(l.fromA-c,l.toA-c,l.fromB,l.toB,l.deleted,l.inserted)),l=o++==n.length?null:n[o]}else{let c=Math.min(a.fromB,l.fromA),u=Math.min(a.fromA,l.fromA-(s?e[s-1].toB-e[s-1].toA:0)),d=u,h=Math.min(l.fromB,a.fromB+(o?n[o-1].toB-n[o-1].toA:0)),f=h,p=as.none,g=as.none,y=!1,v=!1;for(;;){let b=a?c>=a.fromB?a.toB:a.fromB:2e8,_=l?c>=l.fromA?l.toA:l.fromA:2e8,S=Math.min(b,_),k=a&&c>=a.fromB,T=l&&c>=l.fromA;if(!k&&!T)break;k&&c==a.fromB&&!y&&(p=as.join(p,a.deleted,r),d+=a.lenA,y=!0),k&&!T&&(g=as.join(g,as.slice(a.inserted,c-a.fromB,S-a.fromB),r),f+=S-c),T&&c==l.fromA&&!v&&(g=as.join(g,l.inserted,r),f+=l.lenB,v=!0),T&&!k&&(p=as.join(p,as.slice(l.deleted,c-l.fromA,S-l.fromA),r),d+=S-c),k&&S==a.toB&&(a=s++==e.length?null:e[s],y=!1),T&&S==l.toA&&(l=o++==n.length?null:n[o],v=!1),c=S}(u<d||h<f)&&i.push(new Va(u,d,h,f,p,g))}}}static fromJSON(e){return new Va(e.fromA,e.toA,e.fromB,e.toB,e.deleted.map(n=>new as(n.length,n.data)),e.inserted.map(n=>new as(n.length,n.data)))}toJSON(){return this}}let npt;try{npt=new RegExp("[\\p{Alphabetic}_]","u")}catch{}class y1{constructor(e,n){this.config=e,this.changes=n}addSteps(e,n,r){let i=[];for(let l=0;l<n.length;l++){let c=Array.isArray(r)?r[l]:r,u=0;n[l].forEach((d,h,f,p)=>{i.push(new Va(d+u,h+u,f,p,d==h?as.none:[new as(h-d,c)],f==p?as.none:[new as(p-f,c)])),u=p-f-(h-d)})}if(i.length==0)return this;let s=Qj(i,this.config.combine),o=Va.merge(this.changes,s,this.config.combine),a=o;for(let l=0;l<a.length;l++){let c=a[l];if(c.fromA==c.toA||c.fromB==c.toB||!s.some(d=>d.toB>c.fromB&&d.fromB<c.toB))continue;let u=q4e(this.config.doc.content,e.content,c,this.config.encoder);u.length==1&&u[0].fromB==0&&u[0].toB==c.toB-c.fromB||(a==o&&(a=o.slice()),u.length==1?a[l]=u[0]:(a.splice(l,1,...u),l+=u.length-1))}return new y1(this.config,a)}get startDoc(){return this.config.doc}map(e){let n=r=>{let i=e(r);return i===r.data?r:new as(r.length,i)};return new y1(this.config,this.changes.map(r=>new Va(r.fromA,r.toA,r.fromB,r.toB,r.deleted.map(n),r.inserted.map(n))))}changedRange(e,n){if(e==this)return null;let r=n&&rpt(n),i=r?r.toB-r.fromB-(r.toA-r.fromA):0;function s(d){return!r||d<=r.fromA?d:d+i}let o=r?r.fromB:2e8,a=r?r.toB:-2e8;function l(d,h=d){o=Math.min(d,o),a=Math.max(h,a)}let c=this.changes,u=e.changes;for(let d=0,h=0;d<c.length&&h<u.length;){let f=c[d],p=u[h];f&&p&&ipt(f,p,s)?(d++,h++):p&&(!f||s(f.fromB)>=p.fromB)?(l(p.fromB,p.toB),h++):(l(s(f.fromB),s(f.toB)),d++)}return o<=a?{from:o,to:a}:null}static create(e,n=(s,o)=>s===o?s:null,r=U4e,i=[]){return new y1({combine:n,doc:e,encoder:r},i)}}y1.computeDiff=q4e;function Qj(t,e,n=0,r=t.length){if(r==n+1)return[t[n]];let i=n+r>>1;return Va.merge(Qj(t,e,n,i),Qj(t,e,i,r),e)}function Ire(t){let e=2e8,n=-2e8;for(let r=0;r<t.length;r++){let i=t[r];e!=2e8&&(e=i.map(e,-1),n=i.map(n,1)),i.forEach((s,o,a,l)=>{e=Math.min(e,a),n=Math.max(n,l)})}return e==2e8?null:{from:e,to:n}}function rpt(t){let e=Ire(t);if(!e)return null;let n=Ire(t.map(r=>r.invert()).reverse());return{fromA:n.from,toA:n.to,fromB:e.from,toB:e.to}}function ipt(t,e,n){return n(t.fromB)==e.fromB&&n(t.toB)==e.toB&&Rre(t.deleted,e.deleted)&&Rre(t.inserted,e.inserted)}function Rre(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n].length!=e[n].length||t[n].data!==e[n].data)return!1;return!0}function Od(t,e){return Object.assign(t,{meta:{package:"@milkdown/plugin-diff",...e}}),t}var Mre=500;function spt(t={}){const e=new WeakMap,n=new WeakMap;function r(i){let s=e.get(i);if(s!=null)return s;const o=i.attrs,a=o?Object.keys(o).filter(l=>o[l]!=null).sort():[];if(a.length===0)s=i.type.name;else{const l={};for(const c of a)l[c]=o[c];s=`${i.type.name}:${JSON.stringify(l)}`}return e.set(i,s),s}return{encodeCharacter:(i,s)=>{if(s.length===0)return i;let o=n.get(s);return o==null&&(o=s.map(r).join(","),n.set(s,o)),`${i}:${o}`},encodeNodeStart:i=>{const s=i.attrs;if(s&&Object.keys(s).length>0){const o=t[i.type.name]??[],a=Object.keys(s).filter(l=>{var u,d;if(o.includes(l))return!1;const c=(d=(u=i.type.spec.attrs)==null?void 0:u[l])==null?void 0:d.default;return s[l]!==c});if(a.length>0){const l={};for(const c of a.sort())l[c]=s[c];return`${i.type.name}:${JSON.stringify(l)}`}}return i.type.name},encodeNodeEnd:i=>{const s=i.type.schema,o=s.cached.changeSetIDs||(s.cached.changeSetIDs=Object.create(null));let a=o[i.type.name];return a==null&&(o[i.type.name]=a=Object.keys(s.nodes).indexOf(i.type.name)+1),-a},compareTokens:(i,s)=>i===s}}function W4e(t,e,n){const r=n.get(t);if(r!=null)return r;const i=[String(e.encodeNodeStart(t))];if(t.isText){const o=t.text;for(let a=0;a<o.length;a++)i.push(":"+String(e.encodeCharacter(o.charCodeAt(a),t.marks)))}else t.content.forEach(o=>{i.push("/"+W4e(o,e,n))});i.push("\\"+String(e.encodeNodeEnd(t)));const s=i.join("");return n.set(t,s),s}function Nre(t,e,n){const r=[];let i=0;return t.content.forEach(s=>{r.push({node:s,offset:i,size:s.nodeSize,signature:W4e(s,n.encoder,n.sigCache)}),i+=s.nodeSize}),{node:t,contentStart:e,content:r}}function opt(t,e){const n=t.length,r=e.length,i=Array.from({length:n+1},()=>Array.from({length:r+1},()=>0));for(let l=n-1;l>=0;l--)for(let c=r-1;c>=0;c--)t[l].signature===e[c].signature?i[l][c]=i[l+1][c+1]+1:i[l][c]=Math.max(i[l+1][c],i[l][c+1]);const s=[];let o=0,a=0;for(;o<n&&a<r;)t[o].signature===e[a].signature?(s.push([o,a]),o++,a++):i[o+1][a]>=i[o][a+1]?o++:a++;return s}function apt(t,e){if(t.type!==e.type)return!1;const n=t.type;return!(n.isTextblock||n.isAtom||n.spec.code===!0||!n.isBlock)}function G4e(t,e,n){return Va.fromJSON({fromA:t.fromA+e,toA:t.toA+e,fromB:t.fromB+n,toB:t.toB+n,deleted:t.deleted.map(r=>({length:r.length,data:r.data})),inserted:t.inserted.map(r=>({length:r.length,data:r.data}))})}function lpt(t,e,n){const r=t.parent.copy(De.from(t.node)),i=e.parent.copy(De.from(e.node)),s=new li(0,r.content.size,new We(i.content,0,0));return y1.create(r,void 0,n.encoder).addSteps(i,[s.getMap()],null).changes.map(o=>G4e(o,t.abs,e.abs))}function Ore(t,e){const n=t.content;if(e<n.length)return t.contentStart+n[e].offset;if(e>0){const r=n[e-1];return t.contentStart+r.offset+r.size}return t.contentStart+t.node.content.size}function cpt(t,e,n){return Va.fromJSON({fromA:e,toA:e+t.size,fromB:n,toB:n,deleted:[{length:t.size,data:null}],inserted:[]})}function upt(t,e,n){return Va.fromJSON({fromA:e,toA:e,fromB:n,toB:n+t.size,deleted:[],inserted:[{length:t.size,data:null}]})}function dpt(t,e,n,r,i){const s=new li(0,t.content.size,new We(e.content,0,0));return y1.create(t,void 0,i.encoder).addSteps(e,[s.getMap()],null).changes.map(o=>G4e(o,n,r))}function E6(t,e,n,r,i){if(t.childCount>Mre||e.childCount>Mre)return dpt(t,e,n,r,i);const s=Nre(t,n,i),o=Nre(e,r,i),a=opt(s.content,o.content),l=[];let c=0,u=0;for(const[d,h]of a)Dre(s,o,{oldStart:c,oldEnd:d,newStart:u,newEnd:h},i,l),c=d+1,u=h+1;return Dre(s,o,{oldStart:c,oldEnd:s.content.length,newStart:u,newEnd:o.content.length},i,l),l}function Dre(t,e,n,r,i){const s=t.content,o=e.content;let a=n.oldStart,l=n.newStart;for(;a<n.oldEnd||l<n.newEnd;){const c=a<n.oldEnd?s[a]:null,u=l<n.newEnd?o[l]:null,d=c&&u&&c.node.type===u.node.type;if(c&&u&&d){i.push(...hpt(t,e,c,u,r)),a++,l++;continue}if(c&&(!u||!d)){const h=t.contentStart+c.offset;i.push(cpt(c,h,Ore(e,l))),a++;continue}if(u){const h=e.contentStart+u.offset;i.push(upt(u,Ore(t,a),h)),l++}}}function hpt(t,e,n,r,i){const s=t.contentStart+n.offset,o=e.contentStart+r.offset;return apt(n.node,r.node)&&fpt(n.node,r.node,i.encoder)?E6(n.node,r.node,s+1,o+1,i):lpt({node:n.node,parent:t.node,abs:s},{node:r.node,parent:e.node,abs:o},i)}function fpt(t,e,n){return n.encodeNodeStart(t)===n.encodeNodeStart(e)}function ppt(t,e,n,r,i){const s=t.resolve(n),o=t.resolve(r),a=e.resolve(n),l=e.resolve(r),c=s.sharedDepth(r);if(a.sharedDepth(r)!==c)throw new RangeError(`computeDocDiff: range [${n}, ${r}) resolves to different sharedDepth in old and new docs`);for(let g=0;g<=c;g++){if(i.encodeNodeStart(s.node(g))!==i.encodeNodeStart(a.node(g)))throw new RangeError(`computeDocDiff: ancestor at depth ${g} differs in type or non-ignored attrs along the path to the shared ancestor`);if(s.start(g)!==a.start(g))throw new RangeError(`computeDocDiff: ancestor at depth ${g} starts at different absolute positions in old and new docs (content before the range differs in size)`)}const u=s.node(c);if(u.isTextblock)throw new RangeError(`computeDocDiff: range [${n}, ${r}) lands inside a textblock; widen the range to a block boundary`);if(s.depth!==c||o.depth!==c||a.depth!==c||l.depth!==c)throw new RangeError(`computeDocDiff: range [${n}, ${r}) endpoints must be aligned to child boundaries of the shared ancestor`);const d=a.node(c),h=s.start(c),f=n-h,p=r-h;return{oldCut:u.copy(u.content.cut(f,p)),newCut:d.copy(d.content.cut(f,p)),cutAbsStart:n}}function f8(t,e,n){const r=spt(n==null?void 0:n.ignoreAttrs),i={encoder:r,sigCache:new WeakMap},s=t.content.size,o=e.content.size,a=n==null?void 0:n.range;if(a==null)return E6(t,e,0,0,i);const l=Math.min(s,o),c=Math.max(0,Math.min(a.from??0,l)),u=Math.max(c,Math.min(a.to??l,l));if(c===u)return[];if(c===0&&u===l&&s===o)return E6(t,e,0,0,i);const d=ppt(t,e,c,u,r);return E6(d.oldCut,d.newCut,d.cutAbsStart,d.cutAbsStart,i)}var oR=xn({ignoreAttrs:{heading:["id"]}},"diffConfig");Od(oR,{displayName:"Ctx<diffConfig>",group:"Diff"});var Qr=new Vn("MILKDOWN_DIFF");function mpt(t,e,n){const r=f8(t,e.newDoc,n);return{...e,changes:r}}function gpt(t,e){return e.some(n=>t.fromB<n.toB&&t.toB>n.fromB)}function $3(t){return t.changes.filter(e=>!gpt(e,t.rejectedRanges))}var K4e=Sr(t=>{const e=t.get(oR.key);return new Fn({key:Qr,state:{init:()=>null,apply(n,r,i,s){const o=n.getMeta(Qr);if(!r){if((o==null?void 0:o.type)==="start"){const c=f8(s.doc,o.newDoc,{ignoreAttrs:e.ignoreAttrs});return{newDoc:o.newDoc,changes:c,rejectedRanges:[],active:!0}}return null}let a=r;if(n.docChanged&&a.active&&(a=mpt(s.doc,a,{ignoreAttrs:e.ignoreAttrs})),!o)return a;let l;switch(o.type){case"start":{const c=f8(s.doc,o.newDoc,{ignoreAttrs:e.ignoreAttrs});return{newDoc:o.newDoc,changes:c,rejectedRanges:[],active:!0}}case"accept":case"acceptRange":l=a;break;case"reject":l={...a,rejectedRanges:[...a.rejectedRanges,{fromB:o.fromB,toB:o.toB}]};break;case"rejectRange":l={...a,rejectedRanges:[...a.rejectedRanges,{fromB:o.range.fromB,toB:o.range.toB}]};break;case"acceptAll":case"clear":return null;default:return a}return l.active&&$3(l).length===0?null:l}},filterTransaction(n,r){var i;return!((i=Qr.getState(r))!=null&&i.active)||n.getMeta(Qr)?!0:!n.docChanged}})});Od(K4e,{displayName:"Prose<diff>",group:"Diff"});function ypt(t,e){const n=$3(e);for(let r=n.length-1;r>=0;r--){const i=n[r],s=e.newDoc.slice(i.fromB,i.toB);t=t.replace(i.fromA,i.toA,s)}return t}var Y4e=bt("StartDiffReview",t=>e=>(n,r)=>{if(e==null)return!1;const i=t.get(fd)(e);return i?(r&&r(n.tr.setMeta(Qr,{type:"start",newDoc:i})),!0):!1});Od(Y4e,{displayName:"Command<startDiffReview>",group:"Diff"});var vq=bt("StartDiffReviewFromDoc",()=>t=>(e,n)=>!t||t.type!==e.doc.type?!1:(n&&n(e.tr.setMeta(Qr,{type:"start",newDoc:t})),!0));Od(vq,{displayName:"Command<startDiffReviewFromDoc>",group:"Diff"});var Z4e=bt("AcceptDiffChunk",()=>t=>(e,n)=>{if(t==null)return!1;const r=Qr.getState(e);if(!r)return!1;const i=$3(r)[t];if(!i)return!1;if(n){const s=r.newDoc.slice(i.fromB,i.toB);let o=e.tr.replace(i.fromA,i.toA,s);o=o.setMeta(Qr,{type:"accept",changeIndex:t}),n(o)}return!0});Od(Z4e,{displayName:"Command<acceptDiffChunk>",group:"Diff"});var X4e=bt("RejectDiffChunk",()=>t=>(e,n)=>{if(t==null)return!1;const r=Qr.getState(e);if(!r)return!1;const i=$3(r)[t];return i?(n&&n(e.tr.setMeta(Qr,{type:"reject",fromB:i.fromB,toB:i.toB})),!0):!1});Od(X4e,{displayName:"Command<rejectDiffChunk>",group:"Diff"});var bq=bt("AcceptDiffRange",()=>t=>(e,n)=>{if(!t)return!1;const r=Qr.getState(e);if(!r)return!1;if(n){const i=r.newDoc.slice(t.fromB,t.toB);let s=e.tr.replace(t.fromA,t.toA,i);s=s.setMeta(Qr,{type:"acceptRange",range:t}),n(s)}return!0});Od(bq,{displayName:"Command<acceptDiffRange>",group:"Diff"});var wq=bt("RejectDiffRange",()=>t=>(e,n)=>!t||!Qr.getState(e)?!1:(n&&n(e.tr.setMeta(Qr,{type:"rejectRange",range:t})),!0));Od(wq,{displayName:"Command<rejectDiffRange>",group:"Diff"});var aR=bt("AcceptAllDiffs",()=>()=>(t,e)=>{const n=Qr.getState(t);return n?(e&&e((n.rejectedRanges.length===0?t.tr.replaceWith(0,t.doc.content.size,n.newDoc.content):ypt(t.tr,n)).setMeta(Qr,{type:"acceptAll"})),!0):!1});Od(aR,{displayName:"Command<acceptAllDiffs>",group:"Diff"});var p8=bt("ClearDiffReview",()=>()=>(t,e)=>Qr.getState(t)?(e&&e(t.tr.setMeta(Qr,{type:"clear"})),!0):!1);Od(p8,{displayName:"Command<clearDiffReview>",group:"Diff"});var vpt=[oR,K4e,Y4e,vq,Z4e,bq,X4e,wq,aR,p8],bpt=Object.defineProperty,Pre=Object.getOwnPropertySymbols,wpt=Object.prototype.hasOwnProperty,xpt=Object.prototype.propertyIsEnumerable,Lre=(t,e,n)=>e in t?bpt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_pt=(t,e)=>{for(var n in e||(e={}))wpt.call(e,n)&&Lre(t,n,e[n]);if(Pre)for(var n of Pre(e))xpt.call(e,n)&&Lre(t,n,e[n]);return t};function Q4e(t,e){return Object.assign(t,{meta:_pt({package:"@milkdown/components"},e)}),t}const Oh="milkdown-diff",Spt={acceptLabel:"Accept",rejectLabel:"Reject",customBlockTypes:[]},lR=xn(Spt,"diffComponentConfig");Q4e(lR,{displayName:"Ctx<diffComponentConfig>",group:"DiffComponent"});function kpt(t,e,n){if(e===n)return!1;const r=t.resolve(e),i=t.resolve(n),s=r.index(0),o=i.depth===0?Math.max(0,i.index(0)-1):i.index(0);return s!==o}function zre(t,e,n){if(e>=n)return!1;const r=t.resolve(e),i=t.resolve(n);if(r.sameParent(i)&&r.parent.isTextblock)return!1;let s=!1;return t.nodesBetween(e,n,(o,a)=>{if(s)return!1;if(!o.isBlock)return!0;const l=a+o.nodeSize;return a>=e&&l<=n?(s=!0,!1):!0}),s}function Cpt(t,e,n){if(n!==t.content.size)return!1;const r=t.resolve(e);if(r.depth!==0)return!1;for(let i=r.index(0);i<t.childCount;i++){const s=t.child(i);if(s.type.name!=="paragraph"||s.content.size>0)return!1}return!0}function Ept(t){let e=t.content.size;for(let n=t.childCount-1;n>=0;n--){const r=t.child(n);if(r.type.name!=="paragraph"||r.content.size>0)break;e-=r.nodeSize}return e}function Jj(t,e){const n=t.resolve(e);for(let r=n.depth;r>=1;r--)if(n.node(r).isTextblock)return n.before(r);return e}function J4e(t,e,n,r){let i=0;for(let s=0;s<t.childCount;s++){const o=t.child(s),a=i+o.nodeSize;if(i>=n)break;a>e&&i<n&&r(o,i,a),i=a}}function e_e(t,e,n,r){J4e(t,e,n,(i,s,o)=>{o===t.content.size&&i.type.name==="paragraph"&&i.content.size===0||r.push(sr.node(s,o,{class:`${Oh}-removed-block`}))})}function HO(t,e,n=!1){if(e<0||e>t.content.size)return null;const r=t.resolve(Math.min(e,t.content.size));if(r.depth>=1)return{from:r.before(1),to:r.after(1)};if(n){const i=r.nodeBefore;if(i)return{from:e-i.nodeSize,to:e};const s=r.nodeAfter;if(s)return{from:e,to:e+s.nodeSize}}else{const i=r.nodeAfter;if(i)return{from:e,to:e+i.nodeSize};const s=r.nodeBefore;if(s)return{from:e-s.nodeSize,to:e}}return null}function xq(t,e,n){if(e<0||e>t.content.size)return null;const r=t.resolve(Math.min(e,t.content.size));for(let i=r.depth;i>=0;i--){const s=r.node(i).type.name;if(n.has(s))return s}return null}function m8(t,e,n,r=!1){const i=xq(t,e,n);if(i)return i;const s=t.resolve(Math.min(Math.max(e,0),t.content.size)),o=r?s.nodeBefore:s.nodeAfter;return o&&n.has(o.type.name)?o.type.name:null}function Tpt(t,e,n){const r=[];let i=!0,s=-1,o=-1;return J4e(t,e,n,(a,l,c)=>{s===-1&&(s=l),o=c,r.push(a)}),(r.length===0||s!==e||o!==n)&&(i=!1),i?r:[]}function FE(t,e,n,r){return t<r&&e>n}function jre(t,e,n,r){return e===n?xq(t,e,r)!=null:m8(t,e,r)!=null||m8(t,n,r,!0)!=null}function Apt(t,e,n){const r=t.resolve(n.fromA);if(!r.parent.isTextblock||r.depth<1||!r.node(1).isTextblock)return null;const i=r.after(1),s=e.resolve(n.fromB);let o;if(s.depth>=1&&s.node(1).isTextblock?(o=s.after(1),o>n.toB&&(o=n.toB)):o=n.fromB,i>=n.toA&&o>=n.toB)return null;const a=[];return(i>n.fromA||o>n.fromB)&&a.push({fromA:n.fromA,toA:Math.min(i,n.toA),fromB:n.fromB,toB:o,isBlock:!1}),(n.toA>i||n.toB>o)&&a.push({fromA:i,toA:Math.max(i,n.toA),fromB:o,toB:n.toB,isBlock:!0}),a.length>1?a:null}function Ipt(t,e,n,r){return jre(e,t.fromA,t.toA,r)||jre(n,t.fromB,t.toB,r)}function Rpt(t,e,n,r){var i,s,o,a;const l=[],c=new Set;for(let u=0;u<t.length;u++){if(c.has(u))continue;const d=t[u];if(!Ipt(d,e,n,r)){l.push({fromA:d.fromA,toA:d.toA,fromB:d.fromB,toB:d.toB,isCustomBlock:!1});continue}const h=Bre(e,d.fromA,d.toA,r),f=Bre(n,d.fromB,d.toB,r),p={fromA:Math.min((i=h==null?void 0:h.from)!=null?i:d.fromA,d.fromA),toA:Math.max((s=h==null?void 0:h.to)!=null?s:d.toA,d.toA),fromB:Math.min((o=f==null?void 0:f.from)!=null?o:d.fromB,d.fromB),toB:Math.max((a=f==null?void 0:f.to)!=null?a:d.toB,d.toB),isCustomBlock:!0};c.add(u);for(let y=u+1;y<t.length;y++){if(c.has(y))continue;const v=t[y],b=h&&FE(v.fromA,v.toA,h.from,h.to),_=f&&FE(v.fromB,v.toB,f.from,f.to);!b&&!_||(c.add(y),p.fromA=Math.min(p.fromA,v.fromA),p.toA=Math.max(p.toA,v.toA),p.fromB=Math.min(p.fromB,v.fromB),p.toB=Math.max(p.toB,v.toB))}const g=[];for(let y=0;y<l.length;y++){const v=l[y];if(!v.isCustomBlock)continue;const b=FE(p.fromA,p.toA,v.fromA,v.toA),_=FE(p.fromB,p.toB,v.fromB,v.toB);!b&&!_||(p.fromA=Math.min(p.fromA,v.fromA),p.toA=Math.max(p.toA,v.toA),p.fromB=Math.min(p.fromB,v.fromB),p.toB=Math.max(p.toB,v.toB),g.push(y))}for(let y=g.length-1;y>=0;y--)l.splice(g[y],1);l.push(p)}return l}function Mpt(t,e){const n=Ept(e);if(n!==e.content.size)for(const r of t)r.fromA===r.toA&&r.fromB<r.toB&&r.fromA>=n&&(r.fromA=n,r.toA=n)}function Bre(t,e,n,r){return e===n?xq(t,e,r)==null?null:HO(t,e):m8(t,e,r)!=null?HO(t,e):m8(t,n,r,!0)!=null?HO(t,n,!0):null}const Fre=new Vn("MILKDOWN_DIFF_DECORATION"),t_e=Sr(t=>{const e=t.get(lR.key);return new Fn({key:Fre,state:{init:()=>En.empty,apply(n,r,i,s){const o=Qr.getState(s);return o!=null&&o.active?n.getMeta(Qr)||n.docChanged?Opt(t,s.doc,o,e):r.map(n.mapping,n.doc):En.empty}},props:{decorations(n){var r;return(r=Fre.getState(n))!=null?r:En.empty}}})});Q4e(t_e,{displayName:"Prose<diffDecoration>",group:"DiffComponent"});function Npt({doc:t,newDoc:e,segments:n,change:r,changeIndex:i,commands:s,acceptLabel:o,rejectLabel:a,decorations:l}){for(let f=0;f<n.length;f++){const p=n[f],g=p.fromA<p.toA,y=p.fromB<p.toB;if(g&&(p.isBlock?e_e(t,p.fromA,p.toA,l):l.push(sr.inline(p.fromA,p.toA,{class:`${Oh}-removed`}))),y){const v=p.isBlock?Jj(t,g?p.toA:p.fromA):g?p.toA:p.fromA,b=n_e(e,p,p.isBlock);l.push(sr.widget(v,b,{side:-1,key:`added-${i}-${f}`}))}}const c=n[n.length-1],u=c.isBlock?c.fromA<c.toA?c.toA:c.fromA:r.toA,d=Jj(t,u),h=r_e({commands:s,isBlockLevel:!0,change:r,acceptLabel:o,rejectLabel:a});l.push(sr.widget(d,h,{side:-1,key:`controls-${i}`}))}function Opt(t,e,n,r){const i=[],s=t.get(je),o=new Set(r.customBlockTypes),a=$3(n),l=Rpt(a,e,n.newDoc,o);Mpt(l,e);for(let c=0;c<l.length;c++){const u=l[c],d=u.fromA<u.toA,h=u.fromB<u.toB;if(d&&!h&&Cpt(e,u.fromA,u.toA))continue;const f=d&&kpt(e,u.fromA,u.toA),p=d&&zre(e,u.fromA,u.toA),g=h&&zre(n.newDoc,u.fromB,u.toB),y=d&&!f&&!p&&!u.isCustomBlock&&!g,v=(f||p||g)&&!y;if(v&&!u.isCustomBlock){const k=Apt(e,n.newDoc,u);if(k){Npt({doc:e,newDoc:n.newDoc,segments:k,change:u,changeIndex:c,commands:s,acceptLabel:r.acceptLabel,rejectLabel:r.rejectLabel,decorations:i});continue}}d&&(u.isCustomBlock||v?e_e(e,u.fromA,u.toA,i):i.push(sr.inline(u.fromA,u.toA,{class:`${Oh}-removed`})));const b=d?u.toA:u.fromA,_=v?Jj(e,b):b;if(h){const k=n_e(n.newDoc,u,v);i.push(sr.widget(_,k,{side:-1,key:`added-${c}`}))}const S=r_e({commands:s,isBlockLevel:v,change:u,acceptLabel:r.acceptLabel,rejectLabel:r.rejectLabel});i.push(sr.widget(_,S,{side:v?-1:1,key:`controls-${c}`}))}return En.create(e,i)}function n_e(t,e,n){var r;const i=document.createElement(n?"div":"span");i.className=`${Oh}-added`,i.contentEditable="false",n&&i.classList.add(`${Oh}-added-block`);const s=E0.fromSchema(t.type.schema);if(n){const l=Tpt(t,e.fromB,e.toB);if(l.length>0){const c=document.createDocumentFragment();for(const u of l)c.appendChild(s.serializeNode(u));return i.appendChild(c),i}}const o=t.slice(e.fromB,e.toB),a=s.serializeFragment(o.content);if(i.appendChild(a),!((r=i.textContent)!=null&&r.trim())&&!i.querySelector("img, video, audio, canvas, svg")){const l=t.textBetween(e.fromB,e.toB,`
|
||
`,`
|
||
`);l.trim()&&(i.textContent=l)}return i}function r_e({commands:t,isBlockLevel:e,change:n,acceptLabel:r,rejectLabel:i}){const s=document.createElement(e?"div":"span");s.className=`${Oh}-controls`,s.contentEditable="false",e&&s.classList.add(`${Oh}-controls-block`);const o=c=>u=>{u.preventDefault(),u.stopPropagation();const d={fromA:n.fromA,toA:n.toA,fromB:n.fromB,toB:n.toB},h=c==="accept"?bq.key:wq.key;t.call(h,d)},a=document.createElement("button");a.className=`${Oh}-accept`,a.textContent=r,a.addEventListener("click",o("accept"));const l=document.createElement("button");return l.className=`${Oh}-reject`,l.textContent=i,l.addEventListener("click",o("reject")),s.appendChild(a),s.appendChild(l),s}const Dpt=[lR,t_e];function d2(t,e){return Object.assign(t,{meta:{package:"@milkdown/plugin-streaming",...e}}),t}var Ay=xn({throttleMs:100,scrollFollow:!0,diffReviewOnEnd:!1,ignoreAttrs:{heading:["id"]}},"streamingConfig");d2(Ay,{displayName:"Ctx<streamingConfig>",group:"Streaming"});function Ppt(t,e,n){const r=t.get(fd)(n);if(!r)return{tr:e,newDoc:null};const i=t.get(Ay.key).ignoreAttrs,s=f8(e.doc,r,i?{ignoreAttrs:i}:void 0);for(let o=s.length-1;o>=0;o--){const a=s[o],l=r.slice(a.fromB,a.toB);e=e.replace(a.fromA,a.toA,l)}return{tr:e,newDoc:r}}function Lpt(t){if(t.parent.type.spec.code)return{type:"plain-text",preserveNewlines:!0};for(let e=t.depth;e>0;e--)if(t.node(e).type.name==="table")return{type:"plain-text",preserveNewlines:!1};return t.depth>=1?{type:"split-block"}:{type:"block"}}function i_e(t){if(t.childCount===0)return t;const e=t.lastChild;return e.type.name==="paragraph"&&e.content.size===0?t.cut(0,t.size-e.nodeSize):t}function zpt(t,e,n){const{insertPos:r,currentEndPos:i}=n,s=n.buffer.replace(/\r\n?/g,`
|
||
`);if(!s)return{tr:e,applied:!1,insertEndPos:i};const o=e.doc.content.size,a=Math.max(0,Math.min(r,o)),l=Math.max(a,Math.min(i,o)),c=e.doc.resolve(a),u=(t.get(Ay.key).insertStrategy??Lpt)(c),d={ctx:t,tr:e,buffer:s,from:a,to:l,resolved:c};switch(u.type){case"plain-text":return jpt(d,u.preserveNewlines??!1);case"split-block":return Fpt(d);case"block":return Vpt(d)}}function jpt({tr:t,buffer:e,from:n,to:r},i){const s=i?e:e.replace(/\n/g," "),o=t.doc.type.schema.text(s);return t=t.replaceWith(n,r,o),{tr:t,applied:!0,insertEndPos:n+s.length}}var Bpt=/[*_~`[\\<]/;function UO(t,e,n){var l,c,u,d,h;if(!n)return De.empty;if(!Bpt.test(n))return De.from(e.text(n));const r=(l=t.get(fd)(n))==null?void 0:l.firstChild;if((r==null?void 0:r.type.name)!=="paragraph"||r.content.size===0)return De.from(e.text(n));let i=!1;if(r.content.forEach(f=>{(!f.isText||f.marks.length>0)&&(i=!0)}),!i)return De.from(e.text(n));let s=r.content;const o=(c=/^\s+/.exec(n))==null?void 0:c[0];o&&(((u=s.firstChild)!=null&&u.isText?s.firstChild.text??"":"").startsWith(o)||(s=De.from(e.text(o)).append(s)));const a=(d=/\s+$/.exec(n))==null?void 0:d[0];return a&&(((h=s.lastChild)!=null&&h.isText?s.lastChild.text??"":"").endsWith(a)||(s=s.append(De.from(e.text(a))))),s}function Fpt({ctx:t,tr:e,buffer:n,from:r,to:i,resolved:s}){const o=e.doc.type.schema,a=n.indexOf(`
|
||
`);if(a<0){const k=UO(t,o,n);return e=e.replaceWith(r,i,k),{tr:e,applied:!0,insertEndPos:r+k.size}}const l=n.substring(0,a),c=n.substring(a+1),u=t.get(fd),d=c.trim()?u(c):null,h=d?i_e(d.content):De.empty;if(h.childCount===0){const k=UO(t,o,n.replace(/\n/g," "));return e=e.replaceWith(r,i,k),{tr:e,applied:!0,insertEndPos:r+k.size}}const f=s.depth;let p=UO(t,o,l);for(let k=f;k>0;k--)p=De.from(s.node(k).copy(p));const g=p.append(h),y=new We(g,f,0),v=e.doc.content.size,b=e.doc.resolve(Math.min(i,v));let _=i;f>0&&b.depth===f&&b.parentOffset===b.parent.content.size&&(_=b.after(f)),e=e.replace(r,_,y);const S=g.size-f;return{tr:e,applied:!0,insertEndPos:r+S}}function Vpt({ctx:t,tr:e,buffer:n,from:r,to:i}){const s=t.get(fd)(n);if(!s)return{tr:e,applied:!1,insertEndPos:i};const o=i_e(s.content);return o.size===0?{tr:e,applied:!1,insertEndPos:i}:(e=e.replace(r,i,new We(o,0,0)),{tr:e,applied:!0,insertEndPos:r+o.size})}function _q(t,e,n){if(n.insertPos!=null){const r=n.insertPos,i=zpt(t,e,{buffer:n.buffer,insertPos:r,currentEndPos:n.insertEndPos??r});return{tr:i.tr,newDoc:i.applied?i.tr.doc:null,insertEndPos:i.insertEndPos}}return Ppt(t,e,n.buffer)}var Ni=new Vn("MILKDOWN_STREAMING");function $pt(t,e){if(!t&&(e==null?void 0:e.type)!=="start")return null;if(!e)return t;switch(e.type){case"start":return{buffer:"",originalDoc:e.originalDoc,active:!0,lastApplyTime:e.lastApplyTime,insertPos:e.insertPos??null,insertEndPos:e.insertEndPos??e.insertPos??null};case"push":return t?{...t,buffer:t.buffer+e.token}:null;case"apply":return t?{...t,lastApplyTime:e.lastApplyTime,insertEndPos:e.insertEndPos??t.insertEndPos}:null;case"end":case"abort":return null;default:return t}}var s_e=Sr(t=>{const e=t.get(Ay.key);return new Fn({key:Ni,state:{init:()=>null,apply(n,r){return $pt(r,n.getMeta(Ni))}},filterTransaction(n,r){var i;return!((i=Ni.getState(r))!=null&&i.active)||n.getMeta(Ni)?!0:!n.docChanged},view(){return Hpt(t,e)}})});d2(s_e,{displayName:"Prose<streaming>",group:"Streaming"});function Hpt(t,e){let n=null,r=-1,i=null;function s(){if(!i)return;const a=Ni.getState(i.state);if(!(a!=null&&a.active)||a.buffer.length===r)return;r=a.buffer.length;const l=_q(t,i.state.tr,a);if(!l.newDoc)return;let c=l.tr;!c.docChanged&&l.insertEndPos==null||(c=c.setMeta(Ni,{type:"apply",lastApplyTime:Date.now(),insertEndPos:l.insertEndPos}),e.scrollFollow&&(c=c.scrollIntoView()),i.dispatch(c))}function o(){n!=null&&clearTimeout(n),n=setTimeout(s,e.throttleMs)}return{update(a){i=a;const l=Ni.getState(a.state);if(!(l!=null&&l.active)){n!=null&&(clearTimeout(n),n=null),r=-1;return}l.buffer.length!==r&&(Date.now()-l.lastApplyTime>=e.throttleMs?s():o())},destroy(){n!=null&&(clearTimeout(n),n=null),i=null}}}var Sq=bt("StartStreaming",()=>t=>(e,n)=>{var r;if((r=Ni.getState(e))!=null&&r.active)return!1;if(n){let i,s;if((t==null?void 0:t.insertAt)!=null)if(t.insertAt==="selection"){if(i=e.selection.from,s=e.selection.to,e.selection.empty){const o=e.doc.resolve(i);o.parent.isTextblock&&!o.parent.type.spec.code&&o.parent.content.size===0&&o.depth===1&&(i=o.before(o.depth),s=o.after(o.depth))}}else{const o=t.insertAt==="cursor"?e.selection.head:t.insertAt;if(!Number.isFinite(o))return!1;i=Math.max(0,Math.min(Math.round(o),e.doc.content.size));const a=e.doc.resolve(i);a.parent.isTextblock&&!a.parent.type.spec.code&&a.parent.content.size===0&&a.depth===1&&(i=a.before(a.depth),s=a.after(a.depth))}n(e.tr.setMeta(Ni,{type:"start",originalDoc:e.doc,insertPos:i,insertEndPos:s,lastApplyTime:Date.now()}))}return!0});d2(Sq,{displayName:"Command<startStreaming>",group:"Streaming"});var kq=bt("PushChunk",()=>t=>(e,n)=>{var r;return t==null||!((r=Ni.getState(e))!=null&&r.active)?!1:(n&&n(e.tr.setMeta(Ni,{type:"push",token:t})),!0)});d2(kq,{displayName:"Command<pushChunk>",group:"Streaming"});var Cq=bt("EndStreaming",t=>e=>(n,r)=>{const i=Ni.getState(n);if(!(i!=null&&i.active))return!1;if(r){const s=t.get(Ay.key),o=(e==null?void 0:e.diffReview)??s.diffReviewOnEnd,a=_q(t,n.tr,i);let l=a.tr;if(l=l.setMeta(Ni,{type:"end"}),o&&a.newDoc){const c=l.doc;l=l.replace(0,l.doc.content.size,new We(i.originalDoc.content,0,0)),r(l);try{t.get(je).call(vq.key,c)}catch(u){console.warn("[milkdown/streaming] diff review handoff skipped:",u)}return!0}r(l)}return!0});d2(Cq,{displayName:"Command<endStreaming>",group:"Streaming"});var h2=bt("AbortStreaming",t=>e=>(n,r)=>{const i=Ni.getState(n);if(!(i!=null&&i.active))return!1;if(r){const s=(e==null?void 0:e.keep)??!1;let o=n.tr;s?o=_q(t,o,i).tr:o=o.replace(0,n.doc.content.size,new We(i.originalDoc.content,0,0)),o=o.setMeta(Ni,{type:"abort"}),r(o)}return!0});d2(h2,{displayName:"Command<abortStreaming>",group:"Streaming"});var Upt=[Ay,s_e,Sq,kq,Cq,h2];/*! @license DOMPurify 3.4.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.7/LICENSE */function Vre(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function qpt(t){if(Array.isArray(t))return t}function Wpt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function Gpt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kpt(t,e){return qpt(t)||Wpt(t,e)||Ypt(t,e)||Gpt()}function Ypt(t,e){if(t){if(typeof t=="string")return Vre(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vre(t,e):void 0}}const o_e=Object.entries,$re=Object.setPrototypeOf,Zpt=Object.isFrozen,Xpt=Object.getPrototypeOf,Qpt=Object.getOwnPropertyDescriptor;let Lo=Object.freeze,Ql=Object.seal,gv=Object.create,a_e=typeof Reflect<"u"&&Reflect,eB=a_e.apply,tB=a_e.construct;Lo||(Lo=function(e){return e});Ql||(Ql=function(e){return e});eB||(eB=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return e.apply(n,i)});tB||(tB=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return new e(...r)});const Zy=Bi(Array.prototype.forEach),Jpt=Bi(Array.prototype.lastIndexOf),Hre=Bi(Array.prototype.pop),Xy=Bi(Array.prototype.push),emt=Bi(Array.prototype.splice),vo=Array.isArray,L4=Bi(String.prototype.toLowerCase),qO=Bi(String.prototype.toString),Ure=Bi(String.prototype.match),Qy=Bi(String.prototype.replace),qre=Bi(String.prototype.indexOf),tmt=Bi(String.prototype.trim),nmt=Bi(Number.prototype.toString),rmt=Bi(Boolean.prototype.toString),Wre=typeof BigInt>"u"?null:Bi(BigInt.prototype.toString),Gre=typeof Symbol>"u"?null:Bi(Symbol.prototype.toString),oi=Bi(Object.prototype.hasOwnProperty),n4=Bi(Object.prototype.toString),ys=Bi(RegExp.prototype.test),r4=imt(TypeError);function Bi(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return eB(t,e,r)}}function imt(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return tB(t,n)}}function tn(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:L4;if($re&&$re(t,null),!vo(e))return t;let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const s=n(i);s!==i&&(Zpt(e)||(e[r]=s),i=s)}t[i]=!0}return t}function smt(t){for(let e=0;e<t.length;e++)oi(t,e)||(t[e]=null);return t}function Hs(t){const e=gv(null);for(const r of o_e(t)){var n=Kpt(r,2);const i=n[0],s=n[1];oi(t,i)&&(vo(s)?e[i]=smt(s):s&&typeof s=="object"&&s.constructor===Object?e[i]=Hs(s):e[i]=s)}return e}function omt(t){switch(typeof t){case"string":return t;case"number":return nmt(t);case"boolean":return rmt(t);case"bigint":return Wre?Wre(t):"0";case"symbol":return Gre?Gre(t):"Symbol()";case"undefined":return n4(t);case"function":case"object":{if(t===null)return n4(t);const e=t,n=Su(e,"toString");if(typeof n=="function"){const r=n(e);return typeof r=="string"?r:n4(r)}return n4(t)}default:return n4(t)}}function Su(t,e){for(;t!==null;){const r=Qpt(t,e);if(r){if(r.get)return Bi(r.get);if(typeof r.value=="function")return Bi(r.value)}t=Xpt(t)}function n(){return null}return n}function amt(t){try{return ys(t,""),!0}catch{return!1}}const Kre=Lo(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),WO=Lo(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),GO=Lo(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),lmt=Lo(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),KO=Lo(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),cmt=Lo(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Yre=Lo(["#text"]),Zre=Lo(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),YO=Lo(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Xre=Lo(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),VE=Lo(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),umt=Ql(/{{[\w\W]*|^[\w\W]*}}/g),dmt=Ql(/<%[\w\W]*|^[\w\W]*%>/g),hmt=Ql(/\${[\w\W]*/g),fmt=Ql(/^data-[\-\w.\u00B7-\uFFFF]+$/),pmt=Ql(/^aria-[\-\w]+$/),Qre=Ql(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),mmt=Ql(/^(?:\w+script|data):/i),gmt=Ql(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ymt=Ql(/^html$/i),vmt=Ql(/^[a-z][.\w]*(-[.\w]+)+$/i),vu={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},bmt=function(){return typeof window>"u"?null:window},wmt=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));const s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Jre=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function l_e(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:bmt();const e=pt=>l_e(pt);if(e.version="3.4.7",e.removed=[],!t||!t.document||t.document.nodeType!==vu.document||!t.Element)return e.isSupported=!1,e;let n=t.document;const r=n,i=r.currentScript;t.DocumentFragment;const s=t.HTMLTemplateElement,o=t.Node,a=t.Element,l=t.NodeFilter,c=t.NamedNodeMap;c===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const u=t.DOMParser,d=t.trustedTypes,h=a.prototype,f=Su(h,"cloneNode"),p=Su(h,"remove"),g=Su(h,"nextSibling"),y=Su(h,"childNodes"),v=Su(h,"parentNode"),b=Su(h,"shadowRoot"),_=Su(h,"attributes"),S=o&&o.prototype?Su(o.prototype,"nodeType"):null,k=o&&o.prototype?Su(o.prototype,"nodeName"):null;if(typeof s=="function"){const pt=n.createElement("template");pt.content&&pt.content.ownerDocument&&(n=pt.content.ownerDocument)}let T,E="";const C=n,R=C.implementation,M=C.createNodeIterator,D=C.createDocumentFragment,P=C.getElementsByTagName,z=r.importNode;let Z=Jre();e.isSupported=typeof o_e=="function"&&typeof v=="function"&&R&&R.createHTMLDocument!==void 0;const re=umt,G=dmt,ee=hmt,J=fmt,oe=pmt,B=mmt,$e=gmt,Ye=vmt;let $=Qre,Re=null;const ke=tn({},[...Kre,...WO,...GO,...KO,...Yre]);let Me=null;const _e=tn({},[...Zre,...YO,...Xre,...VE]);let Ne=Object.seal(gv(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ue=null,at=null;const ct=Object.seal(gv(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let H=!0,Y=!0,se=!1,me=!0,de=!1,ie=!0,Te=!1,he=!1,we=!1,ye=!1,Ge=!1,Pe=!1,tt=!0,ft=!1;const ne="user-content-";let fe=!0,Le=!1,Ze={},rt=null;const un=tn({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Yt=null;const _n=tn({},["audio","video","img","source","image","track"]);let kr=null;const In=tn({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Vt="http://www.w3.org/1998/Math/MathML",zr="http://www.w3.org/2000/svg",Ee="http://www.w3.org/1999/xhtml";let St=Ee,Ke=!1,Sn=null;const en=tn({},[Vt,zr,Ee],qO);let Vi=tn({},["mi","mo","mn","ms","mtext"]),wt=tn({},["annotation-xml"]);const pn=tn({},["title","style","font","a","script"]);let tr=null;const ni=["application/xhtml+xml","text/html"],_i="text/html";let qt=null,jr=null;const Ho=n.createElement("form"),Si=function(U){return U instanceof RegExp||U instanceof Function},fi=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(jr&&jr===U)return;(!U||typeof U!="object")&&(U={}),U=Hs(U),tr=ni.indexOf(U.PARSER_MEDIA_TYPE)===-1?_i:U.PARSER_MEDIA_TYPE,qt=tr==="application/xhtml+xml"?qO:L4,Re=oi(U,"ALLOWED_TAGS")&&vo(U.ALLOWED_TAGS)?tn({},U.ALLOWED_TAGS,qt):ke,Me=oi(U,"ALLOWED_ATTR")&&vo(U.ALLOWED_ATTR)?tn({},U.ALLOWED_ATTR,qt):_e,Sn=oi(U,"ALLOWED_NAMESPACES")&&vo(U.ALLOWED_NAMESPACES)?tn({},U.ALLOWED_NAMESPACES,qO):en,kr=oi(U,"ADD_URI_SAFE_ATTR")&&vo(U.ADD_URI_SAFE_ATTR)?tn(Hs(In),U.ADD_URI_SAFE_ATTR,qt):In,Yt=oi(U,"ADD_DATA_URI_TAGS")&&vo(U.ADD_DATA_URI_TAGS)?tn(Hs(_n),U.ADD_DATA_URI_TAGS,qt):_n,rt=oi(U,"FORBID_CONTENTS")&&vo(U.FORBID_CONTENTS)?tn({},U.FORBID_CONTENTS,qt):un,Ue=oi(U,"FORBID_TAGS")&&vo(U.FORBID_TAGS)?tn({},U.FORBID_TAGS,qt):Hs({}),at=oi(U,"FORBID_ATTR")&&vo(U.FORBID_ATTR)?tn({},U.FORBID_ATTR,qt):Hs({}),Ze=oi(U,"USE_PROFILES")?U.USE_PROFILES&&typeof U.USE_PROFILES=="object"?Hs(U.USE_PROFILES):U.USE_PROFILES:!1,H=U.ALLOW_ARIA_ATTR!==!1,Y=U.ALLOW_DATA_ATTR!==!1,se=U.ALLOW_UNKNOWN_PROTOCOLS||!1,me=U.ALLOW_SELF_CLOSE_IN_ATTR!==!1,de=U.SAFE_FOR_TEMPLATES||!1,ie=U.SAFE_FOR_XML!==!1,Te=U.WHOLE_DOCUMENT||!1,ye=U.RETURN_DOM||!1,Ge=U.RETURN_DOM_FRAGMENT||!1,Pe=U.RETURN_TRUSTED_TYPE||!1,we=U.FORCE_BODY||!1,tt=U.SANITIZE_DOM!==!1,ft=U.SANITIZE_NAMED_PROPS||!1,fe=U.KEEP_CONTENT!==!1,Le=U.IN_PLACE||!1,$=amt(U.ALLOWED_URI_REGEXP)?U.ALLOWED_URI_REGEXP:Qre,St=typeof U.NAMESPACE=="string"?U.NAMESPACE:Ee,Vi=oi(U,"MATHML_TEXT_INTEGRATION_POINTS")&&U.MATHML_TEXT_INTEGRATION_POINTS&&typeof U.MATHML_TEXT_INTEGRATION_POINTS=="object"?Hs(U.MATHML_TEXT_INTEGRATION_POINTS):tn({},["mi","mo","mn","ms","mtext"]),wt=oi(U,"HTML_INTEGRATION_POINTS")&&U.HTML_INTEGRATION_POINTS&&typeof U.HTML_INTEGRATION_POINTS=="object"?Hs(U.HTML_INTEGRATION_POINTS):tn({},["annotation-xml"]);const ge=oi(U,"CUSTOM_ELEMENT_HANDLING")&&U.CUSTOM_ELEMENT_HANDLING&&typeof U.CUSTOM_ELEMENT_HANDLING=="object"?Hs(U.CUSTOM_ELEMENT_HANDLING):gv(null);if(Ne=gv(null),oi(ge,"tagNameCheck")&&Si(ge.tagNameCheck)&&(Ne.tagNameCheck=ge.tagNameCheck),oi(ge,"attributeNameCheck")&&Si(ge.attributeNameCheck)&&(Ne.attributeNameCheck=ge.attributeNameCheck),oi(ge,"allowCustomizedBuiltInElements")&&typeof ge.allowCustomizedBuiltInElements=="boolean"&&(Ne.allowCustomizedBuiltInElements=ge.allowCustomizedBuiltInElements),de&&(Y=!1),Ge&&(ye=!0),Ze&&(Re=tn({},Yre),Me=gv(null),Ze.html===!0&&(tn(Re,Kre),tn(Me,Zre)),Ze.svg===!0&&(tn(Re,WO),tn(Me,YO),tn(Me,VE)),Ze.svgFilters===!0&&(tn(Re,GO),tn(Me,YO),tn(Me,VE)),Ze.mathMl===!0&&(tn(Re,KO),tn(Me,Xre),tn(Me,VE))),ct.tagCheck=null,ct.attributeCheck=null,oi(U,"ADD_TAGS")&&(typeof U.ADD_TAGS=="function"?ct.tagCheck=U.ADD_TAGS:vo(U.ADD_TAGS)&&(Re===ke&&(Re=Hs(Re)),tn(Re,U.ADD_TAGS,qt))),oi(U,"ADD_ATTR")&&(typeof U.ADD_ATTR=="function"?ct.attributeCheck=U.ADD_ATTR:vo(U.ADD_ATTR)&&(Me===_e&&(Me=Hs(Me)),tn(Me,U.ADD_ATTR,qt))),oi(U,"ADD_URI_SAFE_ATTR")&&vo(U.ADD_URI_SAFE_ATTR)&&tn(kr,U.ADD_URI_SAFE_ATTR,qt),oi(U,"FORBID_CONTENTS")&&vo(U.FORBID_CONTENTS)&&(rt===un&&(rt=Hs(rt)),tn(rt,U.FORBID_CONTENTS,qt)),oi(U,"ADD_FORBID_CONTENTS")&&vo(U.ADD_FORBID_CONTENTS)&&(rt===un&&(rt=Hs(rt)),tn(rt,U.ADD_FORBID_CONTENTS,qt)),fe&&(Re["#text"]=!0),Te&&tn(Re,["html","head","body"]),Re.table&&(tn(Re,["tbody"]),delete Ue.tbody),U.TRUSTED_TYPES_POLICY){if(typeof U.TRUSTED_TYPES_POLICY.createHTML!="function")throw r4('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof U.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw r4('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=U.TRUSTED_TYPES_POLICY,E=T.createHTML("")}else T===void 0&&(T=wmt(d,i)),T!==null&&typeof E=="string"&&(E=T.createHTML(""));(Z.uponSanitizeElement.length>0||Z.uponSanitizeAttribute.length>0)&&Re===ke&&(Re=Hs(Re)),Z.uponSanitizeAttribute.length>0&&Me===_e&&(Me=Hs(Me)),Lo&&Lo(U),jr=U},ml=tn({},[...WO,...GO,...lmt]),$i=tn({},[...KO,...cmt]),z0=function(U){let ge=v(U);(!ge||!ge.tagName)&&(ge={namespaceURI:St,tagName:"template"});const Qe=L4(U.tagName),mn=L4(ge.tagName);return Sn[U.namespaceURI]?U.namespaceURI===zr?ge.namespaceURI===Ee?Qe==="svg":ge.namespaceURI===Vt?Qe==="svg"&&(mn==="annotation-xml"||Vi[mn]):!!ml[Qe]:U.namespaceURI===Vt?ge.namespaceURI===Ee?Qe==="math":ge.namespaceURI===zr?Qe==="math"&&wt[mn]:!!$i[Qe]:U.namespaceURI===Ee?ge.namespaceURI===zr&&!wt[mn]||ge.namespaceURI===Vt&&!Vi[mn]?!1:!$i[Qe]&&(pn[Qe]||!ml[Qe]):!!(tr==="application/xhtml+xml"&&Sn[U.namespaceURI]):!1},Gr=function(U){Xy(e.removed,{element:U});try{v(U).removeChild(U)}catch{p(U)}},Ca=function(U,ge){try{Xy(e.removed,{attribute:ge.getAttributeNode(U),from:ge})}catch{Xy(e.removed,{attribute:null,from:ge})}if(ge.removeAttribute(U),U==="is")if(ye||Ge)try{Gr(ge)}catch{}else try{ge.setAttribute(U,"")}catch{}},Lf=function(U){let ge=null,Qe=null;if(we)U="<remove></remove>"+U;else{const $n=Ure(U,/^[\r\n\t ]+/);Qe=$n&&$n[0]}tr==="application/xhtml+xml"&&St===Ee&&(U='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+U+"</body></html>");const mn=T?T.createHTML(U):U;if(St===Ee)try{ge=new u().parseFromString(mn,tr)}catch{}if(!ge||!ge.documentElement){ge=R.createDocument(St,"template",null);try{ge.documentElement.innerHTML=Ke?E:mn}catch{}}const Zt=ge.body||ge.documentElement;return U&&Qe&&Zt.insertBefore(n.createTextNode(Qe),Zt.childNodes[0]||null),St===Ee?P.call(ge,Te?"html":"body")[0]:Te?ge.documentElement:Zt},Bd=function(U){return M.call(U.ownerDocument||U,U,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Fd=function(U){U.normalize();const ge=M.call(U.ownerDocument||U,U,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let Qe=ge.nextNode();for(;Qe;){let mn=Qe.data;Zy([re,G,ee],Zt=>{mn=Qy(mn,Zt," ")}),Qe.data=mn,Qe=ge.nextNode()}},cu=function(U){const ge=k?k(U):null;return typeof ge!="string"||qt(ge)!=="form"?!1:typeof U.nodeName!="string"||typeof U.textContent!="string"||typeof U.removeChild!="function"||U.attributes!==_(U)||typeof U.removeAttribute!="function"||typeof U.setAttribute!="function"||typeof U.namespaceURI!="string"||typeof U.insertBefore!="function"||typeof U.hasChildNodes!="function"||U.nodeType!==S(U)||U.childNodes!==y(U)},uu=function(U){if(!S||typeof U!="object"||U===null)return!1;try{return S(U)===vu.documentFragment}catch{return!1}},du=function(U){if(!S||typeof U!="object"||U===null)return!1;try{return typeof S(U)=="number"}catch{return!1}};function Uo(pt,U,ge){Zy(pt,Qe=>{Qe.call(e,U,ge,jr)})}const hu=function(U){let ge=null;if(Uo(Z.beforeSanitizeElements,U,null),cu(U))return Gr(U),!0;const Qe=qt(U.nodeName);if(Uo(Z.uponSanitizeElement,U,{tagName:Qe,allowedTags:Re}),ie&&U.hasChildNodes()&&!du(U.firstElementChild)&&ys(/<[/\w!]/g,U.innerHTML)&&ys(/<[/\w!]/g,U.textContent)||ie&&U.namespaceURI===Ee&&Qe==="style"&&du(U.firstElementChild)||U.nodeType===vu.progressingInstruction||ie&&U.nodeType===vu.comment&&ys(/<[/\w]/g,U.data))return Gr(U),!0;if(Ue[Qe]||!(ct.tagCheck instanceof Function&&ct.tagCheck(Qe))&&!Re[Qe]){if(!Ue[Qe]&&dc(Qe)&&(Ne.tagNameCheck instanceof RegExp&&ys(Ne.tagNameCheck,Qe)||Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(Qe)))return!1;if(fe&&!rt[Qe]){const Zt=v(U),$n=y(U);if($n&&Zt){const ts=$n.length;for(let fo=ts-1;fo>=0;--fo){const Kr=f($n[fo],!0);Zt.insertBefore(Kr,g(U))}}}return Gr(U),!0}return(S?S(U):U.nodeType)===vu.element&&!z0(U)||(Qe==="noscript"||Qe==="noembed"||Qe==="noframes")&&ys(/<\/no(script|embed|frames)/i,U.innerHTML)?(Gr(U),!0):(de&&U.nodeType===vu.text&&(ge=U.textContent,Zy([re,G,ee],Zt=>{ge=Qy(ge,Zt," ")}),U.textContent!==ge&&(Xy(e.removed,{element:U.cloneNode()}),U.textContent=ge)),Uo(Z.afterSanitizeElements,U,null),!1)},zf=function(U,ge,Qe){if(at[ge]||tt&&(ge==="id"||ge==="name")&&(Qe in n||Qe in Ho))return!1;const mn=Me[ge]||ct.attributeCheck instanceof Function&&ct.attributeCheck(ge,U);if(!(Y&&!at[ge]&&ys(J,ge))){if(!(H&&ys(oe,ge))){if(!mn||at[ge]){if(!(dc(U)&&(Ne.tagNameCheck instanceof RegExp&&ys(Ne.tagNameCheck,U)||Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(U))&&(Ne.attributeNameCheck instanceof RegExp&&ys(Ne.attributeNameCheck,ge)||Ne.attributeNameCheck instanceof Function&&Ne.attributeNameCheck(ge,U))||ge==="is"&&Ne.allowCustomizedBuiltInElements&&(Ne.tagNameCheck instanceof RegExp&&ys(Ne.tagNameCheck,Qe)||Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(Qe))))return!1}else if(!kr[ge]){if(!ys($,Qy(Qe,$e,""))){if(!((ge==="src"||ge==="xlink:href"||ge==="href")&&U!=="script"&&qre(Qe,"data:")===0&&Yt[U])){if(!(se&&!ys(B,Qy(Qe,$e,"")))){if(Qe)return!1}}}}}}return!0},jf=tn({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),dc=function(U){return!jf[L4(U)]&&ys(Ye,U)},Ea=function(U){Uo(Z.beforeSanitizeAttributes,U,null);const ge=U.attributes;if(!ge||cu(U))return;const Qe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Me,forceKeepAttr:void 0};let mn=ge.length;for(;mn--;){const Zt=ge[mn],$n=Zt.name,ts=Zt.namespaceURI,fo=Zt.value,Kr=qt($n),gs=fo;let ur=$n==="value"?gs:tmt(gs);if(Qe.attrName=Kr,Qe.attrValue=ur,Qe.keepAttr=!0,Qe.forceKeepAttr=void 0,Uo(Z.uponSanitizeAttribute,U,Qe),ur=Qe.attrValue,ft&&(Kr==="id"||Kr==="name")&&qre(ur,ne)!==0&&(Ca($n,U),ur=ne+ur),ie&&ys(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ur)){Ca($n,U);continue}if(Kr==="attributename"&&Ure(ur,"href")){Ca($n,U);continue}if(Qe.forceKeepAttr)continue;if(!Qe.keepAttr){Ca($n,U);continue}if(!me&&ys(/\/>/i,ur)){Ca($n,U);continue}de&&Zy([re,G,ee],Ta=>{ur=Qy(ur,Ta," ")});const pc=qt(U.nodeName);if(!zf(pc,Kr,ur)){Ca($n,U);continue}if(T&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!ts)switch(d.getAttributeType(pc,Kr)){case"TrustedHTML":{ur=T.createHTML(ur);break}case"TrustedScriptURL":{ur=T.createScriptURL(ur);break}}if(ur!==gs)try{ts?U.setAttributeNS(ts,$n,ur):U.setAttribute($n,ur),cu(U)?Gr(U):Hre(e.removed)}catch{Ca($n,U)}}Uo(Z.afterSanitizeAttributes,U,null)},hc=function(U){let ge=null;const Qe=Bd(U);for(Uo(Z.beforeSanitizeShadowDOM,U,null);ge=Qe.nextNode();)if(Uo(Z.uponSanitizeShadowNode,ge,null),hu(ge),Ea(ge),uu(ge.content)&&hc(ge.content),(S?S(ge):ge.nodeType)===vu.element){const Zt=b?b(ge):ge.shadowRoot;uu(Zt)&&(fc(Zt),hc(Zt))}Uo(Z.afterSanitizeShadowDOM,U,null)},fc=function(U){const ge=S?S(U):U.nodeType;if(ge===vu.element){const Zt=b?b(U):U.shadowRoot;uu(Zt)&&(fc(Zt),hc(Zt))}const Qe=y?y(U):U.childNodes;if(!Qe)return;const mn=[];Zy(Qe,Zt=>{Xy(mn,Zt)});for(const Zt of mn)fc(Zt);if(ge===vu.element){const Zt=k?k(U):null;if(typeof Zt=="string"&&qt(Zt)==="template"){const $n=U.content;uu($n)&&fc($n)}}};return e.sanitize=function(pt){let U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ge=null,Qe=null,mn=null,Zt=null;if(Ke=!pt,Ke&&(pt="<!-->"),typeof pt!="string"&&!du(pt)&&(pt=omt(pt),typeof pt!="string"))throw r4("dirty is not a string, aborting");if(!e.isSupported)return pt;if(he||fi(U),e.removed=[],typeof pt=="string"&&(Le=!1),Le){const fo=k?k(pt):pt.nodeName;if(typeof fo=="string"){const Kr=qt(fo);if(!Re[Kr]||Ue[Kr])throw r4("root node is forbidden and cannot be sanitized in-place")}if(cu(pt))throw r4("root node is clobbered and cannot be sanitized in-place");fc(pt)}else if(du(pt))ge=Lf("<!---->"),Qe=ge.ownerDocument.importNode(pt,!0),Qe.nodeType===vu.element&&Qe.nodeName==="BODY"||Qe.nodeName==="HTML"?ge=Qe:ge.appendChild(Qe),fc(Qe);else{if(!ye&&!de&&!Te&&pt.indexOf("<")===-1)return T&&Pe?T.createHTML(pt):pt;if(ge=Lf(pt),!ge)return ye?null:Pe?E:""}ge&&we&&Gr(ge.firstChild);const $n=Bd(Le?pt:ge);for(;mn=$n.nextNode();)hu(mn),Ea(mn),uu(mn.content)&&hc(mn.content);if(Le)return de&&Fd(pt),pt;if(ye){if(de&&Fd(ge),Ge)for(Zt=D.call(ge.ownerDocument);ge.firstChild;)Zt.appendChild(ge.firstChild);else Zt=ge;return(Me.shadowroot||Me.shadowrootmode)&&(Zt=z.call(r,Zt,!0)),Zt}let ts=Te?ge.outerHTML:ge.innerHTML;return Te&&Re["!doctype"]&&ge.ownerDocument&&ge.ownerDocument.doctype&&ge.ownerDocument.doctype.name&&ys(ymt,ge.ownerDocument.doctype.name)&&(ts="<!DOCTYPE "+ge.ownerDocument.doctype.name+`>
|
||
`+ts),de&&Zy([re,G,ee],fo=>{ts=Qy(ts,fo," ")}),T&&Pe?T.createHTML(ts):ts},e.setConfig=function(){let pt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};fi(pt),he=!0},e.clearConfig=function(){jr=null,he=!1},e.isValidAttribute=function(pt,U,ge){jr||fi({});const Qe=qt(pt),mn=qt(U);return zf(Qe,mn,ge)},e.addHook=function(pt,U){typeof U=="function"&&Xy(Z[pt],U)},e.removeHook=function(pt,U){if(U!==void 0){const ge=Jpt(Z[pt],U);return ge===-1?void 0:emt(Z[pt],ge,1)[0]}return Hre(Z[pt])},e.removeHooks=function(pt){Z[pt]=[]},e.removeAllHooks=function(){Z=Jre()},e}var dl=l_e();const xmt=Math.min,_mt=Math.max,Smt={left:"right",right:"left",bottom:"top",top:"bottom"};function eie(t,e,n){return _mt(t,xmt(e,n))}function cR(t,e){return typeof t=="function"?t(e):t}function oy(t){return t.split("-")[0]}function uR(t){return t.split("-")[1]}function c_e(t){return t==="x"?"y":"x"}function u_e(t){return t==="y"?"height":"width"}function im(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function d_e(t){return c_e(im(t))}function kmt(t,e,n){n===void 0&&(n=!1);const r=uR(t),i=d_e(t),s=u_e(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=g8(o)),[o,g8(o)]}function Cmt(t){const e=g8(t);return[nB(t),e,nB(e)]}function nB(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const tie=["left","right"],nie=["right","left"],Emt=["top","bottom"],Tmt=["bottom","top"];function Amt(t,e,n){switch(t){case"top":case"bottom":return n?e?nie:tie:e?tie:nie;case"left":case"right":return e?Emt:Tmt;default:return[]}}function Imt(t,e,n,r){const i=uR(t);let s=Amt(oy(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(nB)))),s}function g8(t){const e=oy(t);return Smt[e]+t.slice(e.length)}function Rmt(t){return{top:0,right:0,bottom:0,left:0,...t}}function Mmt(t){return typeof t!="number"?Rmt(t):{top:t,right:t,bottom:t,left:t}}function y8(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function rie(t,e,n){let{reference:r,floating:i}=t;const s=im(e),o=d_e(e),a=u_e(o),l=oy(e),c=s==="y",u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let f;switch(l){case"top":f={x:u,y:r.y-i.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-i.width,y:d};break;default:f={x:r.x,y:r.y}}switch(uR(e)){case"start":f[o]-=h*(n&&c?-1:1);break;case"end":f[o]+=h*(n&&c?-1:1);break}return f}async function Nmt(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:f=0}=cR(e,t),p=Mmt(f),y=a[h?d==="floating"?"reference":"floating":d],v=y8(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),b=d==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),S=await(s.isElement==null?void 0:s.isElement(_))?await(s.getScale==null?void 0:s.getScale(_))||{x:1,y:1}:{x:1,y:1},k=y8(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:_,strategy:l}):b);return{top:(v.top-k.top+p.top)/S.y,bottom:(k.bottom-v.bottom+p.bottom)/S.y,left:(v.left-k.left+p.left)/S.x,right:(k.right-v.right+p.right)/S.x}}const Omt=50,Dmt=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:Nmt},l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:d}=rie(c,r,l),h=r,f=0;const p={};for(let g=0;g<s.length;g++){const y=s[g];if(!y)continue;const{name:v,fn:b}=y,{x:_,y:S,data:k,reset:T}=await b({x:u,y:d,initialPlacement:r,placement:h,strategy:i,middlewareData:p,rects:c,platform:a,elements:{reference:t,floating:e}});u=_??u,d=S??d,p[v]={...p[v],...k},T&&f<Omt&&(f++,typeof T=="object"&&(T.placement&&(h=T.placement),T.rects&&(c=T.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):T.rects),{x:u,y:d}=rie(c,h,l)),g=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:p}},Pmt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...y}=cR(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const v=oy(i),b=im(a),_=oy(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),k=h||(_||!g?[g8(a)]:Cmt(a)),T=p!=="none";!h&&T&&k.push(...Imt(a,g,p,S));const E=[a,...k],C=await l.detectOverflow(e,y),R=[];let M=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&R.push(C[v]),d){const Z=kmt(i,o,S);R.push(C[Z[0]],C[Z[1]])}if(M=[...M,{placement:i,overflows:R}],!R.every(Z=>Z<=0)){var D,P;const Z=(((D=s.flip)==null?void 0:D.index)||0)+1,re=E[Z];if(re&&(!(d==="alignment"?b!==im(re):!1)||M.every(J=>im(J.placement)===b?J.overflows[0]>0:!0)))return{data:{index:Z,overflows:M},reset:{placement:re}};let G=(P=M.filter(ee=>ee.overflows[0]<=0).sort((ee,J)=>ee.overflows[1]-J.overflows[1])[0])==null?void 0:P.placement;if(!G)switch(f){case"bestFit":{var z;const ee=(z=M.filter(J=>{if(T){const oe=im(J.placement);return oe===b||oe==="y"}return!0}).map(J=>[J.placement,J.overflows.filter(oe=>oe>0).reduce((oe,B)=>oe+B,0)]).sort((J,oe)=>J[1]-oe[1])[0])==null?void 0:z[0];ee&&(G=ee);break}case"initialPlacement":G=a;break}if(i!==G)return{reset:{placement:G}}}return{}}}},Lmt=new Set(["left","top"]);async function zmt(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=oy(n),a=uR(n),l=im(n)==="y",c=Lmt.has(o)?-1:1,u=s&&l?-1:1,d=cR(e,t);let{mainAxis:h,crossAxis:f,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof p=="number"&&(f=a==="end"?p*-1:p),l?{x:f*u,y:h*c}:{x:h*c,y:f*u}}const jmt=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=e,l=await zmt(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},Bmt=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i,platform:s}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:v=>{let{x:b,y:_}=v;return{x:b,y:_}}},...c}=cR(t,e),u={x:n,y:r},d=await s.detectOverflow(e,c),h=im(oy(i)),f=c_e(h);let p=u[f],g=u[h];if(o){const v=f==="y"?"top":"left",b=f==="y"?"bottom":"right",_=p+d[v],S=p-d[b];p=eie(_,p,S)}if(a){const v=h==="y"?"top":"left",b=h==="y"?"bottom":"right",_=g+d[v],S=g-d[b];g=eie(_,g,S)}const y=l.fn({...e,[f]:p,[h]:g});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[f]:o,[h]:a}}}}}},rB=Math.min,vb=Math.max,v8=Math.round,$E=Math.floor,pd=t=>({x:t,y:t});function dR(){return typeof window<"u"}function f2(t){return h_e(t)?(t.nodeName||"").toLowerCase():"#document"}function el(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Dd(t){var e;return(e=(h_e(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function h_e(t){return dR()?t instanceof Node||t instanceof el(t).Node:!1}function eu(t){return dR()?t instanceof Element||t instanceof el(t).Element:!1}function If(t){return dR()?t instanceof HTMLElement||t instanceof el(t).HTMLElement:!1}function iie(t){return!dR()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof el(t).ShadowRoot}function H3(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=tu(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&i!=="inline"&&i!=="contents"}function Fmt(t){return/^(table|td|th)$/.test(f2(t))}function hR(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const Vmt=/transform|translate|scale|rotate|perspective|filter/,$mt=/paint|layout|strict|content/,K0=t=>!!t&&t!=="none";let ZO;function Eq(t){const e=eu(t)?tu(t):t;return K0(e.transform)||K0(e.translate)||K0(e.scale)||K0(e.rotate)||K0(e.perspective)||!Tq()&&(K0(e.backdropFilter)||K0(e.filter))||Vmt.test(e.willChange||"")||$mt.test(e.contain||"")}function Hmt(t){let e=Jm(t);for(;If(e)&&!fx(e);){if(Eq(e))return e;if(hR(e))return null;e=Jm(e)}return null}function Tq(){return ZO==null&&(ZO=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ZO}function fx(t){return/^(html|body|#document)$/.test(f2(t))}function tu(t){return el(t).getComputedStyle(t)}function fR(t){return eu(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Jm(t){if(f2(t)==="html")return t;const e=t.assignedSlot||t.parentNode||iie(t)&&t.host||Dd(t);return iie(e)?e.host:e}function f_e(t){const e=Jm(t);return fx(e)?t.ownerDocument?t.ownerDocument.body:t.body:If(e)&&H3(e)?e:f_e(e)}function _k(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=f_e(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=el(i);if(s){const a=iB(o);return e.concat(o,o.visualViewport||[],H3(i)?i:[],a&&n?_k(a):[])}else return e.concat(i,_k(i,[],n))}function iB(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function p_e(t){const e=tu(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=If(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,a=v8(n)!==s||v8(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function Aq(t){return eu(t)?t:t.contextElement}function bb(t){const e=Aq(t);if(!If(e))return pd(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=p_e(e);let o=(s?v8(n.width):n.width)/r,a=(s?v8(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Umt=pd(0);function m_e(t){const e=el(t);return!Tq()||!e.visualViewport?Umt:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function qmt(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==el(t)?!1:e}function ay(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=Aq(t);let o=pd(1);e&&(r?eu(r)&&(o=bb(r)):o=bb(t));const a=qmt(s,n,r)?m_e(s):pd(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(s){const h=el(s),f=r&&eu(r)?el(r):r;let p=h,g=iB(p);for(;g&&r&&f!==p;){const y=bb(g),v=g.getBoundingClientRect(),b=tu(g),_=v.left+(g.clientLeft+parseFloat(b.paddingLeft))*y.x,S=v.top+(g.clientTop+parseFloat(b.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,d*=y.y,l+=_,c+=S,p=el(g),g=iB(p)}}return y8({width:u,height:d,x:l,y:c})}function pR(t,e){const n=fR(t).scrollLeft;return e?e.left+n:ay(Dd(t)).left+n}function g_e(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-pR(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function Wmt(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=Dd(r),a=e?hR(e.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=pd(1);const u=pd(0),d=If(r);if((d||!d&&!s)&&((f2(r)!=="body"||H3(o))&&(l=fR(r)),d)){const f=ay(r);c=bb(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}const h=o&&!d&&!s?g_e(o,l):pd(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function Gmt(t){return Array.from(t.getClientRects())}function Kmt(t){const e=Dd(t),n=fR(t),r=t.ownerDocument.body,i=vb(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=vb(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+pR(t);const a=-n.scrollTop;return tu(r).direction==="rtl"&&(o+=vb(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const sie=25;function Ymt(t,e){const n=el(t),r=Dd(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const u=Tq();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=pR(r);if(c<=0){const u=r.ownerDocument,d=u.body,h=getComputedStyle(d),f=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,p=Math.abs(r.clientWidth-d.clientWidth-f);p<=sie&&(s-=p)}else c<=sie&&(s+=c);return{width:s,height:o,x:a,y:l}}function Zmt(t,e){const n=ay(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=If(t)?bb(t):pd(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function oie(t,e,n){let r;if(e==="viewport")r=Ymt(t,n);else if(e==="document")r=Kmt(Dd(t));else if(eu(e))r=Zmt(e,n);else{const i=m_e(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return y8(r)}function y_e(t,e){const n=Jm(t);return n===e||!eu(n)||fx(n)?!1:tu(n).position==="fixed"||y_e(n,e)}function Xmt(t,e){const n=e.get(t);if(n)return n;let r=_k(t,[],!1).filter(a=>eu(a)&&f2(a)!=="body"),i=null;const s=tu(t).position==="fixed";let o=s?Jm(t):t;for(;eu(o)&&!fx(o);){const a=tu(o),l=Eq(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||H3(o)&&!l&&y_e(t,o))?r=r.filter(u=>u!==o):i=a,o=Jm(o)}return e.set(t,r),r}function Qmt(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?hR(e)?[]:Xmt(e,this._c):[].concat(n),r],a=oie(e,o[0],i);let l=a.top,c=a.right,u=a.bottom,d=a.left;for(let h=1;h<o.length;h++){const f=oie(e,o[h],i);l=vb(f.top,l),c=rB(f.right,c),u=rB(f.bottom,u),d=vb(f.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function Jmt(t){const{width:e,height:n}=p_e(t);return{width:e,height:n}}function e0t(t,e,n){const r=If(e),i=Dd(e),s=n==="fixed",o=ay(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=pd(0);function c(){l.x=pR(i)}if(r||!r&&!s)if((f2(e)!=="body"||H3(i))&&(a=fR(e)),r){const f=ay(e,!0,s,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else i&&c();s&&!r&&i&&c();const u=i&&!r&&!s?g_e(i,a):pd(0),d=o.left+a.scrollLeft-l.x-u.x,h=o.top+a.scrollTop-l.y-u.y;return{x:d,y:h,width:o.width,height:o.height}}function XO(t){return tu(t).position==="static"}function aie(t,e){if(!If(t)||tu(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Dd(t)===n&&(n=n.ownerDocument.body),n}function v_e(t,e){const n=el(t);if(hR(t))return n;if(!If(t)){let i=Jm(t);for(;i&&!fx(i);){if(eu(i)&&!XO(i))return i;i=Jm(i)}return n}let r=aie(t,e);for(;r&&Fmt(r)&&XO(r);)r=aie(r,e);return r&&fx(r)&&XO(r)&&!Eq(r)?n:r||Hmt(t)||n}const t0t=async function(t){const e=this.getOffsetParent||v_e,n=this.getDimensions,r=await n(t.floating);return{reference:e0t(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function n0t(t){return tu(t).direction==="rtl"}const r0t={convertOffsetParentRelativeRectToViewportRelativeRect:Wmt,getDocumentElement:Dd,getClippingRect:Qmt,getOffsetParent:v_e,getElementRects:t0t,getClientRects:Gmt,getDimensions:Jmt,getScale:bb,isElement:eu,isRTL:n0t};function b_e(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function i0t(t,e){let n=null,r;const i=Dd(t);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const c=t.getBoundingClientRect(),{left:u,top:d,width:h,height:f}=c;if(a||e(),!h||!f)return;const p=$E(d),g=$E(i.clientWidth-(u+h)),y=$E(i.clientHeight-(d+f)),v=$E(u),_={rootMargin:-p+"px "+-g+"px "+-y+"px "+-v+"px",threshold:vb(0,rB(1,l))||1};let S=!0;function k(T){const E=T[0].intersectionRatio;if(E!==l){if(!S)return o();E?o(!1,E):r=setTimeout(()=>{o(!1,1e-7)},1e3)}E===1&&!b_e(c,t.getBoundingClientRect())&&o(),S=!1}try{n=new IntersectionObserver(k,{..._,root:i.ownerDocument})}catch{n=new IntersectionObserver(k,_)}n.observe(t)}return o(!0),s}function lie(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Aq(t),u=i||s?[...c?_k(c):[],...e?_k(e):[]]:[];u.forEach(v=>{i&&v.addEventListener("scroll",n,{passive:!0}),s&&v.addEventListener("resize",n)});const d=c&&a?i0t(c,n):null;let h=-1,f=null;o&&(f=new ResizeObserver(v=>{let[b]=v;b&&b.target===c&&f&&e&&(f.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var _;(_=f)==null||_.observe(e)})),n()}),c&&!l&&f.observe(c),e&&f.observe(e));let p,g=l?ay(t):null;l&&y();function y(){const v=ay(t);g&&!b_e(g,v)&&n(),g=v,p=requestAnimationFrame(y)}return n(),()=>{var v;u.forEach(b=>{i&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),d==null||d(),(v=f)==null||v.disconnect(),f=null,l&&cancelAnimationFrame(p)}}const ly=jmt,s0t=Bmt,Iq=Pmt,_d=(t,e,n)=>{const r=new Map,i={platform:r0t,...n},s={...i.platform,_c:r};return Dmt(t,e,{...i,platform:s})};var y5,v5,b5,uw,dw,hw,Pu,w5,x5,fw,Wp,pw,_5,S5,Zle,U3=(Zle=class{constructor(t){te(this,y5);te(this,v5);te(this,b5);te(this,uw);te(this,dw);te(this,hw);te(this,Pu);te(this,w5);te(this,x5);te(this,fw);te(this,Wp);te(this,pw);te(this,_5);te(this,S5);W(this,hw,!1),this.onShow=()=>{},this.onHide=()=>{},W(this,Wp,e=>{_d(e,this.element,{placement:O(this,uw).placement??"top",middleware:[Iq(),ly(O(this,w5)),s0t(O(this,x5)),...O(this,b5)],...O(this,uw)}).then(({x:n,y:r})=>{Object.assign(this.element.style,{left:`${n}px`,top:`${r}px`})}).catch(console.error)}),W(this,pw,e=>O(this,dw)!==e.dom.parentElement),W(this,_5,(e,n)=>{var h;const{state:r,composing:i}=e,{selection:s,doc:o}=r,{ranges:a}=s,l=Math.min(...a.map(f=>f.$from.pos)),c=Math.max(...a.map(f=>f.$to.pos)),u=n&&n.doc.eq(o)&&n.selection.eq(s);if(O(this,hw)||((O(this,dw)??e.dom.parentElement??document.body).appendChild(this.element),W(this,hw,!0)),i||u)return;if((h=O(this,Pu))==null||h.call(this),W(this,Pu,void 0),!O(this,v5).call(this,e,n)){this.hide();return}const d={getBoundingClientRect:()=>L3(e,l,c),contextElement:e.dom};O(this,pw).call(this,e)?W(this,Pu,lie(d,this.element,()=>O(this,Wp).call(this,d))):O(this,Wp).call(this,d),this.show()}),this.update=(e,n)=>{O(this,fw).call(this,e,n)},W(this,S5,e=>{const{doc:n,selection:r}=e.state,{empty:i,from:s,to:o}=r,a=!n.textBetween(s,o).length&&e.state.selection instanceof mt,l=this.element.contains(document.activeElement),c=!e.hasFocus()&&!l,u=!e.editable;return!(c||i||a||u)}),this.destroy=()=>{var e;(e=O(this,Pu))==null||e.call(this),O(this,fw).cancel()},this.show=(e,n)=>{var r;if(this.element.dataset.show="true",e){(r=O(this,Pu))==null||r.call(this),W(this,Pu,void 0);const i={...e,contextElement:n==null?void 0:n.dom};n&&O(this,pw).call(this,n)?W(this,Pu,lie(i,this.element,()=>O(this,Wp).call(this,i))):O(this,Wp).call(this,i)}this.onShow()},this.hide=()=>{this.element.dataset.show!=="false"&&(this.element.dataset.show="false",this.onHide())},this.element=t.content,W(this,y5,t.debounce??200),W(this,v5,t.shouldShow??O(this,S5)),W(this,w5,t.offset),W(this,x5,t.shift),W(this,b5,t.middleware??[]),W(this,uw,t.floatingUIOptions??{}),W(this,dw,t.root),this.element.dataset.show="false",W(this,fw,PI(O(this,_5),O(this,y5)))}},y5=new WeakMap,v5=new WeakMap,b5=new WeakMap,uw=new WeakMap,dw=new WeakMap,hw=new WeakMap,Pu=new WeakMap,w5=new WeakMap,x5=new WeakMap,fw=new WeakMap,Wp=new WeakMap,pw=new WeakMap,_5=new WeakMap,S5=new WeakMap,Zle);function q3(t){const e=xn({},`${t}_TOOLTIP_SPEC`),n=Sr(i=>{const s=i.get(e.key);return new Fn({key:new Vn(`${t}_TOOLTIP`),...s})}),r=[e,n];return r.key=e.key,r.pluginKey=n.key,e.meta={package:"@milkdown/plugin-tooltip",displayName:`Ctx<tooltipSpec>|${t}`},n.meta={package:"@milkdown/plugin-tooltip",displayName:`Prose<tooltip>|${t}`},r}/**
|
||
* @vue/shared v3.5.35
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/function Rq(t){const e=Object.create(null);for(const n of t.split(","))e[n]=1;return n=>n in e}const Tr={},eS=[],Vc=()=>{},w_e=()=>!1,mR=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),gR=t=>t.startsWith("onUpdate:"),js=Object.assign,Mq=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},o0t=Object.prototype.hasOwnProperty,Zn=(t,e)=>o0t.call(t,e),Qt=Array.isArray,tS=t=>W3(t)==="[object Map]",a0t=t=>W3(t)==="[object Set]",cie=t=>W3(t)==="[object Date]",on=t=>typeof t=="function",Li=t=>typeof t=="string",e0=t=>typeof t=="symbol",Rr=t=>t!==null&&typeof t=="object",x_e=t=>(Rr(t)||on(t))&&on(t.then)&&on(t.catch),l0t=Object.prototype.toString,W3=t=>l0t.call(t),c0t=t=>W3(t).slice(8,-1),u0t=t=>W3(t)==="[object Object]",Nq=t=>Li(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,nS=Rq(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),yR=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},d0t=/-\w/g,$c=yR(t=>t.replace(d0t,e=>e.slice(1).toUpperCase())),h0t=/\B([A-Z])/g,Iy=yR(t=>t.replace(h0t,"-$1").toLowerCase()),__e=yR(t=>t.charAt(0).toUpperCase()+t.slice(1)),QO=yR(t=>t?`on${__e(t)}`:""),Hu=(t,e)=>!Object.is(t,e),JO=(t,...e)=>{for(let n=0;n<t.length;n++)t[n](...e)},b8=(t,e,n,r=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:r,value:n})},f0t=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let uie;const v1=()=>uie||(uie=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Oq(t){if(Qt(t)){const e={};for(let n=0;n<t.length;n++){const r=t[n],i=Li(r)?y0t(r):Oq(r);if(i)for(const s in i)e[s]=i[s]}return e}else if(Li(t)||Rr(t))return t}const p0t=/;(?![^(]*\))/g,m0t=/:([^]+)/,g0t=/\/\*[^]*?\*\//g;function y0t(t){const e={};return t.replace(g0t,"").split(p0t).forEach(n=>{if(n){const r=n.split(m0t);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function Dq(t){let e="";if(Li(t))e=t;else if(Qt(t))for(let n=0;n<t.length;n++){const r=Dq(t[n]);r&&(e+=r+" ")}else if(Rr(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}const v0t="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",b0t=Rq(v0t);function S_e(t){return!!t||t===""}function w0t(t,e){if(t.length!==e.length)return!1;let n=!0;for(let r=0;n&&r<t.length;r++)n=Pq(t[r],e[r]);return n}function Pq(t,e){if(t===e)return!0;let n=cie(t),r=cie(e);if(n||r)return n&&r?t.getTime()===e.getTime():!1;if(n=e0(t),r=e0(e),n||r)return t===e;if(n=Qt(t),r=Qt(e),n||r)return n&&r?w0t(t,e):!1;if(n=Rr(t),r=Rr(e),n||r){if(!n||!r)return!1;const i=Object.keys(t).length,s=Object.keys(e).length;if(i!==s)return!1;for(const o in t){const a=t.hasOwnProperty(o),l=e.hasOwnProperty(o);if(a&&!l||!a&&l||!Pq(t[o],e[o]))return!1}}return String(t)===String(e)}/**
|
||
* @vue/reactivity v3.5.35
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/let bs;class x0t{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&bs&&(bs.active?(this.parent=bs,this.index=(bs.scopes||(bs.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,n;if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].pause();for(e=0,n=this.effects.length;e<n;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,n;if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].resume();for(e=0,n=this.effects.length;e<n;e++)this.effects[e].resume()}}run(e){if(this._active){const n=bs;try{return bs=this,e()}finally{bs=n}}}on(){++this._on===1&&(this.prevScope=bs,bs=this)}off(){if(this._on>0&&--this._on===0){if(bs===this)bs=this.prevScope;else{let e=bs;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,r=this.scopes.length;n<r;n++)this.scopes[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const i=this.parent.scopes.pop();i&&i!==this&&(this.parent.scopes[this.index]=i,i.index=this.index)}this.parent=void 0}}}function _0t(){return bs}let Cr;const eD=new WeakSet;class k_e{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,bs&&(bs.active?bs.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,eD.has(this)&&(eD.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||E_e(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,die(this),T_e(this);const e=Cr,n=Hc;Cr=this,Hc=!0;try{return this.fn()}finally{A_e(this),Cr=e,Hc=n,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)jq(e);this.deps=this.depsTail=void 0,die(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?eD.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){sB(this)&&this.run()}get dirty(){return sB(this)}}let C_e=0,rS,iS;function E_e(t,e=!1){if(t.flags|=8,e){t.next=iS,iS=t;return}t.next=rS,rS=t}function Lq(){C_e++}function zq(){if(--C_e>0)return;if(iS){let e=iS;for(iS=void 0;e;){const n=e.next;e.next=void 0,e.flags&=-9,e=n}}let t;for(;rS;){let e=rS;for(rS=void 0;e;){const n=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){t||(t=r)}e=n}}if(t)throw t}function T_e(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function A_e(t){let e,n=t.depsTail,r=n;for(;r;){const i=r.prevDep;r.version===-1?(r===n&&(n=i),jq(r),S0t(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}t.deps=e,t.depsTail=n}function sB(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(I_e(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function I_e(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===Sk)||(t.globalVersion=Sk,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!sB(t))))return;t.flags|=2;const e=t.dep,n=Cr,r=Hc;Cr=t,Hc=!0;try{T_e(t);const i=t.fn(t._value);(e.version===0||Hu(i,t._value))&&(t.flags|=128,t._value=i,e.version++)}catch(i){throw e.version++,i}finally{Cr=n,Hc=r,A_e(t),t.flags&=-3}}function jq(t,e=!1){const{dep:n,prevSub:r,nextSub:i}=t;if(r&&(r.nextSub=i,t.prevSub=void 0),i&&(i.prevSub=r,t.nextSub=void 0),n.subs===t&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let s=n.computed.deps;s;s=s.nextDep)jq(s,!0)}!e&&!--n.sc&&n.map&&n.map.delete(n.key)}function S0t(t){const{prevDep:e,nextDep:n}=t;e&&(e.nextDep=n,t.prevDep=void 0),n&&(n.prevDep=e,t.nextDep=void 0)}let Hc=!0;const R_e=[];function gf(){R_e.push(Hc),Hc=!1}function yf(){const t=R_e.pop();Hc=t===void 0?!0:t}function die(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const n=Cr;Cr=void 0;try{e()}finally{Cr=n}}}let Sk=0;class k0t{constructor(e,n){this.sub=e,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Bq{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Cr||!Hc||Cr===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Cr)n=this.activeLink=new k0t(Cr,this),Cr.deps?(n.prevDep=Cr.depsTail,Cr.depsTail.nextDep=n,Cr.depsTail=n):Cr.deps=Cr.depsTail=n,M_e(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=Cr.depsTail,n.nextDep=void 0,Cr.depsTail.nextDep=n,Cr.depsTail=n,Cr.deps===n&&(Cr.deps=r)}return n}trigger(e){this.version++,Sk++,this.notify(e)}notify(e){Lq();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{zq()}}}function M_e(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let r=e.deps;r;r=r.nextDep)M_e(r)}const n=t.dep.subs;n!==t&&(t.prevSub=n,n&&(n.nextSub=t)),t.dep.subs=t}}const oB=new WeakMap,b1=Symbol(""),aB=Symbol(""),kk=Symbol("");function Qs(t,e,n){if(Hc&&Cr){let r=oB.get(t);r||oB.set(t,r=new Map);let i=r.get(n);i||(r.set(n,i=new Bq),i.map=r,i.key=n),i.track()}}function kh(t,e,n,r,i,s){const o=oB.get(t);if(!o){Sk++;return}const a=l=>{l&&l.trigger()};if(Lq(),e==="clear")o.forEach(a);else{const l=Qt(t),c=l&&Nq(n);if(l&&n==="length"){const u=Number(r);o.forEach((d,h)=>{(h==="length"||h===kk||!e0(h)&&h>=u)&&a(d)})}else switch((n!==void 0||o.has(void 0))&&a(o.get(n)),c&&a(o.get(kk)),e){case"add":l?c&&a(o.get("length")):(a(o.get(b1)),tS(t)&&a(o.get(aB)));break;case"delete":l||(a(o.get(b1)),tS(t)&&a(o.get(aB)));break;case"set":tS(t)&&a(o.get(b1));break}}zq()}function Jy(t){const e=Yn(t);return e===t?e:(Qs(e,"iterate",kk),Uc(t)?e:e.map(vf))}function Fq(t){return Qs(t=Yn(t),"iterate",kk),t}function Lu(t,e){return t0(t)?Ck(wb(t)?vf(e):e):vf(e)}const C0t={__proto__:null,[Symbol.iterator](){return tD(this,Symbol.iterator,t=>Lu(this,t))},concat(...t){return Jy(this).concat(...t.map(e=>Qt(e)?Jy(e):e))},entries(){return tD(this,"entries",t=>(t[1]=Lu(this,t[1]),t))},every(t,e){return Gd(this,"every",t,e,void 0,arguments)},filter(t,e){return Gd(this,"filter",t,e,n=>n.map(r=>Lu(this,r)),arguments)},find(t,e){return Gd(this,"find",t,e,n=>Lu(this,n),arguments)},findIndex(t,e){return Gd(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Gd(this,"findLast",t,e,n=>Lu(this,n),arguments)},findLastIndex(t,e){return Gd(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Gd(this,"forEach",t,e,void 0,arguments)},includes(...t){return nD(this,"includes",t)},indexOf(...t){return nD(this,"indexOf",t)},join(t){return Jy(this).join(t)},lastIndexOf(...t){return nD(this,"lastIndexOf",t)},map(t,e){return Gd(this,"map",t,e,void 0,arguments)},pop(){return i4(this,"pop")},push(...t){return i4(this,"push",t)},reduce(t,...e){return hie(this,"reduce",t,e)},reduceRight(t,...e){return hie(this,"reduceRight",t,e)},shift(){return i4(this,"shift")},some(t,e){return Gd(this,"some",t,e,void 0,arguments)},splice(...t){return i4(this,"splice",t)},toReversed(){return Jy(this).toReversed()},toSorted(t){return Jy(this).toSorted(t)},toSpliced(...t){return Jy(this).toSpliced(...t)},unshift(...t){return i4(this,"unshift",t)},values(){return tD(this,"values",t=>Lu(this,t))}};function tD(t,e,n){const r=Fq(t),i=r[e]();return r!==t&&!Uc(t)&&(i._next=i.next,i.next=()=>{const s=i._next();return s.done||(s.value=n(s.value)),s}),i}const E0t=Array.prototype;function Gd(t,e,n,r,i,s){const o=Fq(t),a=o!==t&&!Uc(t),l=o[e];if(l!==E0t[e]){const d=l.apply(t,s);return a?vf(d):d}let c=n;o!==t&&(a?c=function(d,h){return n.call(this,Lu(t,d),h,t)}:n.length>2&&(c=function(d,h){return n.call(this,d,h,t)}));const u=l.call(o,c,r);return a&&i?i(u):u}function hie(t,e,n,r){const i=Fq(t),s=i!==t&&!Uc(t);let o=n,a=!1;i!==t&&(s?(a=r.length===0,o=function(c,u,d){return a&&(a=!1,c=Lu(t,c)),n.call(this,c,Lu(t,u),d,t)}):n.length>3&&(o=function(c,u,d){return n.call(this,c,u,d,t)}));const l=i[e](o,...r);return a?Lu(t,l):l}function nD(t,e,n){const r=Yn(t);Qs(r,"iterate",kk);const i=r[e](...n);return(i===-1||i===!1)&&Uq(n[0])?(n[0]=Yn(n[0]),r[e](...n)):i}function i4(t,e,n=[]){gf(),Lq();const r=Yn(t)[e].apply(t,n);return zq(),yf(),r}const T0t=Rq("__proto__,__v_isRef,__isVue"),N_e=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(e0));function A0t(t){e0(t)||(t=String(t));const e=Yn(this);return Qs(e,"has",t),e.hasOwnProperty(t)}class O_e{constructor(e=!1,n=!1){this._isReadonly=e,this._isShallow=n}get(e,n,r){if(n==="__v_skip")return e.__v_skip;const i=this._isReadonly,s=this._isShallow;if(n==="__v_isReactive")return!i;if(n==="__v_isReadonly")return i;if(n==="__v_isShallow")return s;if(n==="__v_raw")return r===(i?s?j0t:z_e:s?L_e:P_e).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=Qt(e);if(!i){let l;if(o&&(l=C0t[n]))return l;if(n==="hasOwnProperty")return A0t}const a=Reflect.get(e,n,no(e)?e:r);if((e0(n)?N_e.has(n):T0t(n))||(i||Qs(e,"get",n),s))return a;if(no(a)){const l=o&&Nq(n)?a:a.value;return i&&Rr(l)?cB(l):l}return Rr(a)?i?cB(a):$q(a):a}}class D_e extends O_e{constructor(e=!1){super(!1,e)}set(e,n,r,i){let s=e[n];const o=Qt(e)&&Nq(n);if(!this._isShallow){const c=t0(s);if(!Uc(r)&&!t0(r)&&(s=Yn(s),r=Yn(r)),!o&&no(s)&&!no(r))return c||(s.value=r),!0}const a=o?Number(n)<e.length:Zn(e,n),l=Reflect.set(e,n,r,no(e)?e:i);return e===Yn(i)&&(a?Hu(r,s)&&kh(e,"set",n,r):kh(e,"add",n,r)),l}deleteProperty(e,n){const r=Zn(e,n);e[n];const i=Reflect.deleteProperty(e,n);return i&&r&&kh(e,"delete",n,void 0),i}has(e,n){const r=Reflect.has(e,n);return(!e0(n)||!N_e.has(n))&&Qs(e,"has",n),r}ownKeys(e){return Qs(e,"iterate",Qt(e)?"length":b1),Reflect.ownKeys(e)}}class I0t extends O_e{constructor(e=!1){super(!0,e)}set(e,n){return!0}deleteProperty(e,n){return!0}}const R0t=new D_e,M0t=new I0t,N0t=new D_e(!0);const lB=t=>t,HE=t=>Reflect.getPrototypeOf(t);function O0t(t,e,n){return function(...r){const i=this.__v_raw,s=Yn(i),o=tS(s),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,c=i[t](...r),u=n?lB:e?Ck:vf;return!e&&Qs(s,"iterate",l?aB:b1),js(Object.create(c),{next(){const{value:d,done:h}=c.next();return h?{value:d,done:h}:{value:a?[u(d[0]),u(d[1])]:u(d),done:h}}})}}function UE(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function D0t(t,e){const n={get(i){const s=this.__v_raw,o=Yn(s),a=Yn(i);t||(Hu(i,a)&&Qs(o,"get",i),Qs(o,"get",a));const{has:l}=HE(o),c=e?lB:t?Ck:vf;if(l.call(o,i))return c(s.get(i));if(l.call(o,a))return c(s.get(a));s!==o&&s.get(i)},get size(){const i=this.__v_raw;return!t&&Qs(Yn(i),"iterate",b1),i.size},has(i){const s=this.__v_raw,o=Yn(s),a=Yn(i);return t||(Hu(i,a)&&Qs(o,"has",i),Qs(o,"has",a)),i===a?s.has(i):s.has(i)||s.has(a)},forEach(i,s){const o=this,a=o.__v_raw,l=Yn(a),c=e?lB:t?Ck:vf;return!t&&Qs(l,"iterate",b1),a.forEach((u,d)=>i.call(s,c(u),c(d),o))}};return js(n,t?{add:UE("add"),set:UE("set"),delete:UE("delete"),clear:UE("clear")}:{add(i){const s=Yn(this),o=HE(s),a=Yn(i),l=!e&&!Uc(i)&&!t0(i)?a:i;return o.has.call(s,l)||Hu(i,l)&&o.has.call(s,i)||Hu(a,l)&&o.has.call(s,a)||(s.add(l),kh(s,"add",l,l)),this},set(i,s){!e&&!Uc(s)&&!t0(s)&&(s=Yn(s));const o=Yn(this),{has:a,get:l}=HE(o);let c=a.call(o,i);c||(i=Yn(i),c=a.call(o,i));const u=l.call(o,i);return o.set(i,s),c?Hu(s,u)&&kh(o,"set",i,s):kh(o,"add",i,s),this},delete(i){const s=Yn(this),{has:o,get:a}=HE(s);let l=o.call(s,i);l||(i=Yn(i),l=o.call(s,i)),a&&a.call(s,i);const c=s.delete(i);return l&&kh(s,"delete",i,void 0),c},clear(){const i=Yn(this),s=i.size!==0,o=i.clear();return s&&kh(i,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(i=>{n[i]=O0t(i,t,e)}),n}function Vq(t,e){const n=D0t(t,e);return(r,i,s)=>i==="__v_isReactive"?!t:i==="__v_isReadonly"?t:i==="__v_raw"?r:Reflect.get(Zn(n,i)&&i in r?n:r,i,s)}const P0t={get:Vq(!1,!1)},L0t={get:Vq(!1,!0)},z0t={get:Vq(!0,!1)};const P_e=new WeakMap,L_e=new WeakMap,z_e=new WeakMap,j0t=new WeakMap;function B0t(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function $q(t){return t0(t)?t:Hq(t,!1,R0t,P0t,P_e)}function F0t(t){return Hq(t,!1,N0t,L0t,L_e)}function cB(t){return Hq(t,!0,M0t,z0t,z_e)}function Hq(t,e,n,r,i){if(!Rr(t)||t.__v_raw&&!(e&&t.__v_isReactive)||t.__v_skip||!Object.isExtensible(t))return t;const s=i.get(t);if(s)return s;const o=B0t(c0t(t));if(o===0)return t;const a=new Proxy(t,o===2?r:n);return i.set(t,a),a}function wb(t){return t0(t)?wb(t.__v_raw):!!(t&&t.__v_isReactive)}function t0(t){return!!(t&&t.__v_isReadonly)}function Uc(t){return!!(t&&t.__v_isShallow)}function Uq(t){return t?!!t.__v_raw:!1}function Yn(t){const e=t&&t.__v_raw;return e?Yn(e):t}function V0t(t){return!Zn(t,"__v_skip")&&Object.isExtensible(t)&&b8(t,"__v_skip",!0),t}const vf=t=>Rr(t)?$q(t):t,Ck=t=>Rr(t)?cB(t):t;function no(t){return t?t.__v_isRef===!0:!1}function nt(t){return j_e(t,!1)}function w8(t){return j_e(t,!0)}function j_e(t,e){return no(t)?t:new $0t(t,e)}class $0t{constructor(e,n){this.dep=new Bq,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?e:Yn(e),this._value=n?e:vf(e),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(e){const n=this._rawValue,r=this.__v_isShallow||Uc(e)||t0(e);e=r?e:Yn(e),Hu(e,n)&&(this._rawValue=e,this._value=r?e:vf(e),this.dep.trigger())}}function H0t(t){return no(t)?t.value:t}const U0t={get:(t,e,n)=>e==="__v_raw"?t:H0t(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const i=t[e];return no(i)&&!no(n)?(i.value=n,!0):Reflect.set(t,e,n,r)}};function B_e(t){return wb(t)?t:new Proxy(t,U0t)}class q0t{constructor(e,n,r){this.fn=e,this.setter=n,this._value=void 0,this.dep=new Bq(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Sk-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Cr!==this)return E_e(this,!0),!0}get value(){const e=this.dep.track();return I_e(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function W0t(t,e,n=!1){let r,i;return on(t)?r=t:(r=t.get,i=t.set),new q0t(r,i,n)}const qE={},x8=new WeakMap;let dg;function G0t(t,e=!1,n=dg){if(n){let r=x8.get(n);r||x8.set(n,r=[]),r.push(t)}}function K0t(t,e,n=Tr){const{immediate:r,deep:i,once:s,scheduler:o,augmentJob:a,call:l}=n,c=S=>i?S:Uc(S)||i===!1||i===0?Ip(S,1):Ip(S);let u,d,h,f,p=!1,g=!1;if(no(t)?(d=()=>t.value,p=Uc(t)):wb(t)?(d=()=>c(t),p=!0):Qt(t)?(g=!0,p=t.some(S=>wb(S)||Uc(S)),d=()=>t.map(S=>{if(no(S))return S.value;if(wb(S))return c(S);if(on(S))return l?l(S,2):S()})):on(t)?e?d=l?()=>l(t,2):t:d=()=>{if(h){gf();try{h()}finally{yf()}}const S=dg;dg=u;try{return l?l(t,3,[f]):t(f)}finally{dg=S}}:d=Vc,e&&i){const S=d,k=i===!0?1/0:i;d=()=>Ip(S(),k)}const y=_0t(),v=()=>{u.stop(),y&&y.active&&Mq(y.effects,u)};if(s&&e){const S=e;e=(...k)=>{S(...k),v()}}let b=g?new Array(t.length).fill(qE):qE;const _=S=>{if(!(!(u.flags&1)||!u.dirty&&!S))if(e){const k=u.run();if(i||p||(g?k.some((T,E)=>Hu(T,b[E])):Hu(k,b))){h&&h();const T=dg;dg=u;try{const E=[k,b===qE?void 0:g&&b[0]===qE?[]:b,f];b=k,l?l(e,3,E):e(...E)}finally{dg=T}}}else u.run()};return a&&a(_),u=new k_e(d),u.scheduler=o?()=>o(_,!1):_,f=S=>G0t(S,!1,u),h=u.onStop=()=>{const S=x8.get(u);if(S){if(l)l(S,4);else for(const k of S)k();x8.delete(u)}},e?r?_(!0):b=u.run():o?o(_.bind(null,!0),!0):u.run(),v.pause=u.pause.bind(u),v.resume=u.resume.bind(u),v.stop=v,v}function Ip(t,e=1/0,n){if(e<=0||!Rr(t)||t.__v_skip||(n=n||new Map,(n.get(t)||0)>=e))return t;if(n.set(t,e),e--,no(t))Ip(t.value,e,n);else if(Qt(t))for(let r=0;r<t.length;r++)Ip(t[r],e,n);else if(a0t(t)||tS(t))t.forEach(r=>{Ip(r,e,n)});else if(u0t(t)){for(const r in t)Ip(t[r],e,n);for(const r of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,r)&&Ip(t[r],e,n)}return t}/**
|
||
* @vue/runtime-core v3.5.35
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/function G3(t,e,n,r){try{return r?t(...r):t()}catch(i){vR(i,e,n)}}function nu(t,e,n,r){if(on(t)){const i=G3(t,e,n,r);return i&&x_e(i)&&i.catch(s=>{vR(s,e,n)}),i}if(Qt(t)){const i=[];for(let s=0;s<t.length;s++)i.push(nu(t[s],e,n,r));return i}}function vR(t,e,n,r=!0){const i=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||Tr;if(e){let a=e.parent;const l=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const u=a.ec;if(u){for(let d=0;d<u.length;d++)if(u[d](t,l,c)===!1)return}a=a.parent}if(s){gf(),G3(s,null,10,[t,l,c]),yf();return}}Y0t(t,n,i,r,o)}function Y0t(t,e,n,r=!0,i=!1){if(i)throw t;console.error(t)}const ko=[];let Tu=-1;const xb=[];let gp=null,yv=0;const F_e=Promise.resolve();let _8=null;function uB(t){const e=_8||F_e;return t?e.then(this?t.bind(this):t):e}function Z0t(t){let e=Tu+1,n=ko.length;for(;e<n;){const r=e+n>>>1,i=ko[r],s=Ek(i);s<t||s===t&&i.flags&2?e=r+1:n=r}return e}function qq(t){if(!(t.flags&1)){const e=Ek(t),n=ko[ko.length-1];!n||!(t.flags&2)&&e>=Ek(n)?ko.push(t):ko.splice(Z0t(e),0,t),t.flags|=1,V_e()}}function V_e(){_8||(_8=F_e.then(H_e))}function X0t(t){Qt(t)?xb.push(...t):gp&&t.id===-1?gp.splice(yv+1,0,t):t.flags&1||(xb.push(t),t.flags|=1),V_e()}function fie(t,e,n=Tu+1){for(;n<ko.length;n++){const r=ko[n];if(r&&r.flags&2){if(t&&r.id!==t.uid)continue;ko.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function $_e(t){if(xb.length){const e=[...new Set(xb)].sort((n,r)=>Ek(n)-Ek(r));if(xb.length=0,gp){gp.push(...e);return}for(gp=e,yv=0;yv<gp.length;yv++){const n=gp[yv];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}gp=null,yv=0}}const Ek=t=>t.id==null?t.flags&2?-1:1/0:t.id;function H_e(t){try{for(Tu=0;Tu<ko.length;Tu++){const e=ko[Tu];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),G3(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Tu<ko.length;Tu++){const e=ko[Tu];e&&(e.flags&=-2)}Tu=-1,ko.length=0,$_e(),_8=null,(ko.length||xb.length)&&H_e()}}let Uu,z4=[],dB=!1;function bR(t,...e){Uu?Uu.emit(t,...e):dB||z4.push({event:t,args:e})}function U_e(t,e){var n,r;Uu=t,Uu?(Uu.enabled=!0,z4.forEach(({event:i,args:s})=>Uu.emit(i,...s)),z4=[]):typeof window<"u"&&window.HTMLElement&&!((r=(n=window.navigator)==null?void 0:n.userAgent)!=null&&r.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(s=>{U_e(s,e)}),setTimeout(()=>{Uu||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,dB=!0,z4=[])},3e3)):(dB=!0,z4=[])}function Q0t(t,e){bR("app:init",t,e,{Fragment:mr,Text:K3,Comment:cy,Static:A6})}function J0t(t){bR("app:unmount",t)}const egt=Wq("component:added"),q_e=Wq("component:updated"),tgt=Wq("component:removed"),ngt=t=>{Uu&&typeof Uu.cleanupBuffer=="function"&&!Uu.cleanupBuffer(t)&&tgt(t)};function Wq(t){return e=>{bR(t,e.appContext.app,e.uid,e.parent?e.parent.uid:void 0,e)}}function rgt(t,e,n){bR("component:emit",t.appContext.app,t,e,n)}let ed=null,W_e=null;function S8(t){const e=ed;return ed=t,W_e=t&&t.type.__scopeId||null,e}function igt(t,e=ed,n){if(!e||t._n)return t;const r=(...i)=>{r._d;const s=S8(e);let o;try{o=t(...i)}finally{S8(s),r._d}return __VUE_PROD_DEVTOOLS__&&q_e(e),o};return r._n=!0,r._c=!0,r._d=!0,r}function Y0(t,e,n,r){const i=t.dirs,s=e&&e.dirs;for(let o=0;o<i.length;o++){const a=i[o];s&&(a.oldValue=s[o].value);let l=a.dir[r];l&&(gf(),nu(l,n,8,[t.el,a,t,e]),yf())}}function sgt(t,e){if(To){let n=To.provides;const r=To.parent&&To.parent.provides;r===n&&(n=To.provides=Object.create(r)),n[t]=e}}function T6(t,e,n=!1){const r=i1t();if(r||_b){let i=_b?_b._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&t in i)return i[t];if(arguments.length>1)return n&&on(e)?e.call(r&&r.proxy):e}}const ogt=Symbol.for("v-scx"),agt=()=>T6(ogt);function p2(t,e){return Gq(t,null,e)}function qh(t,e,n){return Gq(t,e,n)}function Gq(t,e,n=Tr){const{immediate:r,deep:i,flush:s,once:o}=n,a=js({},n),l=e&&r||!e&&s!=="post";let c;if(Tk){if(s==="sync"){const f=agt();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!l){const f=()=>{};return f.stop=Vc,f.resume=Vc,f.pause=Vc,f}}const u=To;a.call=(f,p,g)=>nu(f,u,p,g);let d=!1;s==="post"?a.scheduler=f=>{Yo(f,u&&u.suspense)}:s!=="sync"&&(d=!0,a.scheduler=(f,p)=>{p?f():qq(f)}),a.augmentJob=f=>{e&&(f.flags|=4),d&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const h=K0t(t,e,a);return Tk&&(c?c.push(h):l&&h()),h}function lgt(t,e,n){const r=this.proxy,i=Li(t)?t.includes(".")?G_e(r,t):()=>r[t]:t.bind(r,r);let s;on(e)?s=e:(s=e.handler,n=e);const o=Y3(this),a=Gq(i,s.bind(r),n);return o(),a}function G_e(t,e){const n=e.split(".");return()=>{let r=t;for(let i=0;i<n.length&&r;i++)r=r[n[i]];return r}}const cgt=Symbol("_vte"),ugt=t=>t.__isTeleport,rD=Symbol("_leaveCb");function Kq(t,e){t.shapeFlag&6&&t.component?(t.transition=e,Kq(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function es(t,e){return on(t)?js({name:t.name},e,{setup:t}):t}function K_e(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function pie(t,e){let n;return!!((n=Object.getOwnPropertyDescriptor(t,e))&&!n.configurable)}const k8=new WeakMap;function sS(t,e,n,r,i=!1){if(Qt(t)){t.forEach((g,y)=>sS(g,e&&(Qt(e)?e[y]:e),n,r,i));return}if(oS(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&sS(t,e,n,r.component.subTree);return}const s=r.shapeFlag&4?Qq(r.component):r.el,o=i?null:s,{i:a,r:l}=t,c=e&&e.r,u=a.refs===Tr?a.refs={}:a.refs,d=a.setupState,h=Yn(d),f=d===Tr?w_e:g=>pie(u,g)?!1:Zn(h,g),p=(g,y)=>!(y&&pie(u,y));if(c!=null&&c!==l){if(mie(e),Li(c))u[c]=null,f(c)&&(d[c]=null);else if(no(c)){const g=e;p(c,g.k)&&(c.value=null),g.k&&(u[g.k]=null)}}if(on(l))G3(l,a,12,[o,u]);else{const g=Li(l),y=no(l);if(g||y){const v=()=>{if(t.f){const b=g?f(l)?d[l]:u[l]:p()||!t.k?l.value:u[t.k];if(i)Qt(b)&&Mq(b,s);else if(Qt(b))b.includes(s)||b.push(s);else if(g)u[l]=[s],f(l)&&(d[l]=u[l]);else{const _=[s];p(l,t.k)&&(l.value=_),t.k&&(u[t.k]=_)}}else g?(u[l]=o,f(l)&&(d[l]=o)):y&&(p(l,t.k)&&(l.value=o),t.k&&(u[t.k]=o))};if(o){const b=()=>{v(),k8.delete(t)};b.id=-1,k8.set(t,b),Yo(b,n)}else mie(t),v()}}}function mie(t){const e=k8.get(t);e&&(e.flags|=8,k8.delete(t))}v1().requestIdleCallback;v1().cancelIdleCallback;const oS=t=>!!t.type.__asyncLoader,Y_e=t=>t.type.__isKeepAlive;function dgt(t,e){Z_e(t,"a",e)}function hgt(t,e){Z_e(t,"da",e)}function Z_e(t,e,n=To){const r=t.__wdc||(t.__wdc=()=>{let i=n;for(;i;){if(i.isDeactivated)return;i=i.parent}return t()});if(wR(e,r,n),n){let i=n.parent;for(;i&&i.parent;)Y_e(i.parent.vnode)&&fgt(r,e,n,i),i=i.parent}}function fgt(t,e,n,r){const i=wR(e,t,r,!0);g2(()=>{Mq(r[e],i)},n)}function wR(t,e,n=To,r=!1){if(n){const i=n[t]||(n[t]=[]),s=e.__weh||(e.__weh=(...o)=>{gf();const a=Y3(n),l=nu(e,n,t,o);return a(),yf(),l});return r?i.unshift(s):i.push(s),s}}const Rf=t=>(e,n=To)=>{(!Tk||t==="sp")&&wR(t,(...r)=>e(...r),n)},pgt=Rf("bm"),m2=Rf("m"),mgt=Rf("bu"),ggt=Rf("u"),ygt=Rf("bum"),g2=Rf("um"),vgt=Rf("sp"),bgt=Rf("rtg"),wgt=Rf("rtc");function xgt(t,e=To){wR("ec",t,e)}const _gt=Symbol.for("v-ndc"),hB=t=>t?mSe(t)?Qq(t):hB(t.parent):null,aS=js(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>hB(t.parent),$root:t=>hB(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>__VUE_OPTIONS_API__?Q_e(t):t.type,$forceUpdate:t=>t.f||(t.f=()=>{qq(t.update)}),$nextTick:t=>t.n||(t.n=uB.bind(t.proxy)),$watch:t=>__VUE_OPTIONS_API__?lgt.bind(t):Vc}),iD=(t,e)=>t!==Tr&&!t.__isScriptSetup&&Zn(t,e),Sgt={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:n,setupState:r,data:i,props:s,accessCache:o,type:a,appContext:l}=t;if(e[0]!=="$"){const h=o[e];if(h!==void 0)switch(h){case 1:return r[e];case 2:return i[e];case 4:return n[e];case 3:return s[e]}else{if(iD(r,e))return o[e]=1,r[e];if(__VUE_OPTIONS_API__&&i!==Tr&&Zn(i,e))return o[e]=2,i[e];if(Zn(s,e))return o[e]=3,s[e];if(n!==Tr&&Zn(n,e))return o[e]=4,n[e];(!__VUE_OPTIONS_API__||fB)&&(o[e]=0)}}const c=aS[e];let u,d;if(c)return e==="$attrs"&&Qs(t.attrs,"get",""),c(t);if((u=a.__cssModules)&&(u=u[e]))return u;if(n!==Tr&&Zn(n,e))return o[e]=4,n[e];if(d=l.config.globalProperties,Zn(d,e))return d[e]},set({_:t},e,n){const{data:r,setupState:i,ctx:s}=t;return iD(i,e)?(i[e]=n,!0):__VUE_OPTIONS_API__&&r!==Tr&&Zn(r,e)?(r[e]=n,!0):Zn(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(s[e]=n,!0)},has({_:{data:t,setupState:e,accessCache:n,ctx:r,appContext:i,props:s,type:o}},a){let l;return!!(n[a]||__VUE_OPTIONS_API__&&t!==Tr&&a[0]!=="$"&&Zn(t,a)||iD(e,a)||Zn(s,a)||Zn(r,a)||Zn(aS,a)||Zn(i.config.globalProperties,a)||(l=o.__cssModules)&&l[a])},defineProperty(t,e,n){return n.get!=null?t._.accessCache[e]=0:Zn(n,"value")&&this.set(t,e,n.value,null),Reflect.defineProperty(t,e,n)}};function gie(t){return Qt(t)?t.reduce((e,n)=>(e[n]=null,e),{}):t}let fB=!0;function kgt(t){const e=Q_e(t),n=t.proxy,r=t.ctx;fB=!1,e.beforeCreate&&yie(e.beforeCreate,t,"bc");const{data:i,computed:s,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:d,mounted:h,beforeUpdate:f,updated:p,activated:g,deactivated:y,beforeDestroy:v,beforeUnmount:b,destroyed:_,unmounted:S,render:k,renderTracked:T,renderTriggered:E,errorCaptured:C,serverPrefetch:R,expose:M,inheritAttrs:D,components:P,directives:z,filters:Z}=e;if(c&&Cgt(c,r,null),o)for(const ee in o){const J=o[ee];on(J)&&(r[ee]=J.bind(n))}if(i){const ee=i.call(n,n);Rr(ee)&&(t.data=$q(ee))}if(fB=!0,s)for(const ee in s){const J=s[ee],oe=on(J)?J.bind(n,n):on(J.get)?J.get.bind(n,n):Vc,B=!on(J)&&on(J.set)?J.set.bind(n):Vc,$e=Ll({get:oe,set:B});Object.defineProperty(r,ee,{enumerable:!0,configurable:!0,get:()=>$e.value,set:Ye=>$e.value=Ye})}if(a)for(const ee in a)X_e(a[ee],r,n,ee);if(l){const ee=on(l)?l.call(n):l;Reflect.ownKeys(ee).forEach(J=>{sgt(J,ee[J])})}u&&yie(u,t,"c");function G(ee,J){Qt(J)?J.forEach(oe=>ee(oe.bind(n))):J&&ee(J.bind(n))}if(G(pgt,d),G(m2,h),G(mgt,f),G(ggt,p),G(dgt,g),G(hgt,y),G(xgt,C),G(wgt,T),G(bgt,E),G(ygt,b),G(g2,S),G(vgt,R),Qt(M))if(M.length){const ee=t.exposed||(t.exposed={});M.forEach(J=>{Object.defineProperty(ee,J,{get:()=>n[J],set:oe=>n[J]=oe,enumerable:!0})})}else t.exposed||(t.exposed={});k&&t.render===Vc&&(t.render=k),D!=null&&(t.inheritAttrs=D),P&&(t.components=P),z&&(t.directives=z),R&&K_e(t)}function Cgt(t,e,n=Vc){Qt(t)&&(t=pB(t));for(const r in t){const i=t[r];let s;Rr(i)?"default"in i?s=T6(i.from||r,i.default,!0):s=T6(i.from||r):s=T6(i),no(s)?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>s.value,set:o=>s.value=o}):e[r]=s}}function yie(t,e,n){nu(Qt(t)?t.map(r=>r.bind(e.proxy)):t.bind(e.proxy),e,n)}function X_e(t,e,n,r){let i=r.includes(".")?G_e(n,r):()=>n[r];if(Li(t)){const s=e[t];on(s)&&qh(i,s)}else if(on(t))qh(i,t.bind(n));else if(Rr(t))if(Qt(t))t.forEach(s=>X_e(s,e,n,r));else{const s=on(t.handler)?t.handler.bind(n):e[t.handler];on(s)&&qh(i,s,t)}}function Q_e(t){const e=t.type,{mixins:n,extends:r}=e,{mixins:i,optionsCache:s,config:{optionMergeStrategies:o}}=t.appContext,a=s.get(e);let l;return a?l=a:!i.length&&!n&&!r?l=e:(l={},i.length&&i.forEach(c=>C8(l,c,o,!0)),C8(l,e,o)),Rr(e)&&s.set(e,l),l}function C8(t,e,n,r=!1){const{mixins:i,extends:s}=e;s&&C8(t,s,n,!0),i&&i.forEach(o=>C8(t,o,n,!0));for(const o in e)if(!(r&&o==="expose")){const a=Egt[o]||n&&n[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const Egt={data:vie,props:bie,emits:bie,methods:j4,computed:j4,beforeCreate:yo,created:yo,beforeMount:yo,mounted:yo,beforeUpdate:yo,updated:yo,beforeDestroy:yo,beforeUnmount:yo,destroyed:yo,unmounted:yo,activated:yo,deactivated:yo,errorCaptured:yo,serverPrefetch:yo,components:j4,directives:j4,watch:Agt,provide:vie,inject:Tgt};function vie(t,e){return e?t?function(){return js(on(t)?t.call(this,this):t,on(e)?e.call(this,this):e)}:e:t}function Tgt(t,e){return j4(pB(t),pB(e))}function pB(t){if(Qt(t)){const e={};for(let n=0;n<t.length;n++)e[t[n]]=t[n];return e}return t}function yo(t,e){return t?[...new Set([].concat(t,e))]:e}function j4(t,e){return t?js(Object.create(null),t,e):e}function bie(t,e){return t?Qt(t)&&Qt(e)?[...new Set([...t,...e])]:js(Object.create(null),gie(t),gie(e??{})):e}function Agt(t,e){if(!t)return e;if(!e)return t;const n=js(Object.create(null),t);for(const r in e)n[r]=yo(t[r],e[r]);return n}function J_e(){return{app:null,config:{isNativeTag:w_e,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let Igt=0;function Rgt(t,e){return function(r,i=null){on(r)||(r=js({},r)),i!=null&&!Rr(i)&&(i=null);const s=J_e(),o=new WeakSet,a=[];let l=!1;const c=s.app={_uid:Igt++,_component:r,_props:i,_container:null,_context:s,_instance:null,version:Eie,get config(){return s.config},set config(u){},use(u,...d){return o.has(u)||(u&&on(u.install)?(o.add(u),u.install(c,...d)):on(u)&&(o.add(u),u(c,...d))),c},mixin(u){return __VUE_OPTIONS_API__&&(s.mixins.includes(u)||s.mixins.push(u)),c},component(u,d){return d?(s.components[u]=d,c):s.components[u]},directive(u,d){return d?(s.directives[u]=d,c):s.directives[u]},mount(u,d,h){if(!l){const f=c._ceVNode||Pc(r,i);return f.appContext=s,h===!0?h="svg":h===!1&&(h=void 0),t(f,u,h),l=!0,c._container=u,u.__vue_app__=c,__VUE_PROD_DEVTOOLS__&&(c._instance=f.component,Q0t(c,Eie)),Qq(f.component)}},onUnmount(u){a.push(u)},unmount(){l&&(nu(a,c._instance,16),t(null,c._container),__VUE_PROD_DEVTOOLS__&&(c._instance=null,J0t(c)),delete c._container.__vue_app__)},provide(u,d){return s.provides[u]=d,c},runWithContext(u){const d=_b;_b=c;try{return u()}finally{_b=d}}};return c}}let _b=null;const Mgt=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${$c(e)}Modifiers`]||t[`${Iy(e)}Modifiers`];function Ngt(t,e,...n){if(t.isUnmounted)return;const r=t.vnode.props||Tr;let i=n;const s=e.startsWith("update:"),o=s&&Mgt(r,e.slice(7));o&&(o.trim&&(i=n.map(u=>Li(u)?u.trim():u)),o.number&&(i=n.map(f0t))),__VUE_PROD_DEVTOOLS__&&rgt(t,e,i);let a,l=r[a=QO(e)]||r[a=QO($c(e))];!l&&s&&(l=r[a=QO(Iy(e))]),l&&nu(l,t,6,i);const c=r[a+"Once"];if(c){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,nu(c,t,6,i)}}const Ogt=new WeakMap;function eSe(t,e,n=!1){const r=__VUE_OPTIONS_API__&&n?Ogt:e.emitsCache,i=r.get(t);if(i!==void 0)return i;const s=t.emits;let o={},a=!1;if(__VUE_OPTIONS_API__&&!on(t)){const l=c=>{const u=eSe(c,e,!0);u&&(a=!0,js(o,u))};!n&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!s&&!a?(Rr(t)&&r.set(t,null),null):(Qt(s)?s.forEach(l=>o[l]=null):js(o,s),Rr(t)&&r.set(t,o),o)}function xR(t,e){return!t||!mR(e)?!1:(e=e.slice(2).replace(/Once$/,""),Zn(t,e[0].toLowerCase()+e.slice(1))||Zn(t,Iy(e))||Zn(t,e))}function wie(t){const{type:e,vnode:n,proxy:r,withProxy:i,propsOptions:[s],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:d,data:h,setupState:f,ctx:p,inheritAttrs:g}=t,y=S8(t);let v,b;try{if(n.shapeFlag&4){const S=i||r,k=S;v=zu(c.call(k,S,u,d,f,h,p)),b=a}else{const S=e;v=zu(S.length>1?S(d,{attrs:a,slots:o,emit:l}):S(d,null)),b=e.props?a:Dgt(a)}}catch(S){vR(S,t,1),v=Pc(cy)}let _=v;if(b&&g!==!1){const S=Object.keys(b),{shapeFlag:k}=_;S.length&&k&7&&(s&&S.some(gR)&&(b=Pgt(b,s)),_=px(_,b,!1,!0))}return n.dirs&&(_=px(_,null,!1,!0),_.dirs=_.dirs?_.dirs.concat(n.dirs):n.dirs),n.transition&&Kq(_,n.transition),v=_,S8(y),v}const Dgt=t=>{let e;for(const n in t)(n==="class"||n==="style"||mR(n))&&((e||(e={}))[n]=t[n]);return e},Pgt=(t,e)=>{const n={};for(const r in t)(!gR(r)||!(r.slice(9)in e))&&(n[r]=t[r]);return n};function Lgt(t,e,n){const{props:r,children:i,component:s}=t,{props:o,children:a,patchFlag:l}=e,c=s.emitsOptions;if(e.dirs||e.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?xie(r,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let d=0;d<u.length;d++){const h=u[d];if(tSe(o,r,h)&&!xR(c,h))return!0}}}else return(i||a)&&(!a||!a.$stable)?!0:r===o?!1:r?o?xie(r,o,c):!0:!!o;return!1}function xie(t,e,n){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!0;for(let i=0;i<r.length;i++){const s=r[i];if(tSe(e,t,s)&&!xR(n,s))return!0}return!1}function tSe(t,e,n){const r=t[n],i=e[n];return n==="style"&&Rr(r)&&Rr(i)?!Pq(r,i):r!==i}function zgt({vnode:t,parent:e,suspense:n},r){for(;e;){const i=e.subTree;if(i.suspense&&i.suspense.activeBranch===t&&(i.suspense.vnode.el=i.el=r,t=i),i===t)(t=e.vnode).el=r,e=e.parent;else break}n&&n.activeBranch===t&&(n.vnode.el=r)}const nSe={},rSe=()=>Object.create(nSe),iSe=t=>Object.getPrototypeOf(t)===nSe;function jgt(t,e,n,r=!1){const i={},s=rSe();t.propsDefaults=Object.create(null),sSe(t,e,i,s);for(const o in t.propsOptions[0])o in i||(i[o]=void 0);n?t.props=r?i:F0t(i):t.type.props?t.props=i:t.props=s,t.attrs=s}function Bgt(t,e,n,r){const{props:i,attrs:s,vnode:{patchFlag:o}}=t,a=Yn(i),[l]=t.propsOptions;let c=!1;if((r||o>0)&&!(o&16)){if(o&8){const u=t.vnode.dynamicProps;for(let d=0;d<u.length;d++){let h=u[d];if(xR(t.emitsOptions,h))continue;const f=e[h];if(l)if(Zn(s,h))f!==s[h]&&(s[h]=f,c=!0);else{const p=$c(h);i[p]=mB(l,a,p,f,t,!1)}else f!==s[h]&&(s[h]=f,c=!0)}}}else{sSe(t,e,i,s)&&(c=!0);let u;for(const d in a)(!e||!Zn(e,d)&&((u=Iy(d))===d||!Zn(e,u)))&&(l?n&&(n[d]!==void 0||n[u]!==void 0)&&(i[d]=mB(l,a,d,void 0,t,!0)):delete i[d]);if(s!==a)for(const d in s)(!e||!Zn(e,d))&&(delete s[d],c=!0)}c&&kh(t.attrs,"set","")}function sSe(t,e,n,r){const[i,s]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(nS(l))continue;const c=e[l];let u;i&&Zn(i,u=$c(l))?!s||!s.includes(u)?n[u]=c:(a||(a={}))[u]=c:xR(t.emitsOptions,l)||(!(l in r)||c!==r[l])&&(r[l]=c,o=!0)}if(s){const l=Yn(n),c=a||Tr;for(let u=0;u<s.length;u++){const d=s[u];n[d]=mB(i,l,d,c[d],t,!Zn(c,d))}}return o}function mB(t,e,n,r,i,s){const o=t[n];if(o!=null){const a=Zn(o,"default");if(a&&r===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&on(l)){const{propsDefaults:c}=i;if(n in c)r=c[n];else{const u=Y3(i);r=c[n]=l.call(null,e),u()}}else r=l;i.ce&&i.ce._setProp(n,r)}o[0]&&(s&&!a?r=!1:o[1]&&(r===""||r===Iy(n))&&(r=!0))}return r}const Fgt=new WeakMap;function oSe(t,e,n=!1){const r=__VUE_OPTIONS_API__&&n?Fgt:e.propsCache,i=r.get(t);if(i)return i;const s=t.props,o={},a=[];let l=!1;if(__VUE_OPTIONS_API__&&!on(t)){const u=d=>{l=!0;const[h,f]=oSe(d,e,!0);js(o,h),f&&a.push(...f)};!n&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!s&&!l)return Rr(t)&&r.set(t,eS),eS;if(Qt(s))for(let u=0;u<s.length;u++){const d=$c(s[u]);_ie(d)&&(o[d]=Tr)}else if(s)for(const u in s){const d=$c(u);if(_ie(d)){const h=s[u],f=o[d]=Qt(h)||on(h)?{type:h}:js({},h),p=f.type;let g=!1,y=!0;if(Qt(p))for(let v=0;v<p.length;++v){const b=p[v],_=on(b)&&b.name;if(_==="Boolean"){g=!0;break}else _==="String"&&(y=!1)}else g=on(p)&&p.name==="Boolean";f[0]=g,f[1]=y,(g||Zn(f,"default"))&&a.push(d)}}const c=[o,a];return Rr(t)&&r.set(t,c),c}function _ie(t){return t[0]!=="$"&&!nS(t)}const Yq=t=>t==="_"||t==="_ctx"||t==="$stable",Zq=t=>Qt(t)?t.map(zu):[zu(t)],Vgt=(t,e,n)=>{if(e._n)return e;const r=igt((...i)=>Zq(e(...i)),n);return r._c=!1,r},aSe=(t,e,n)=>{const r=t._ctx;for(const i in t){if(Yq(i))continue;const s=t[i];if(on(s))e[i]=Vgt(i,s,r);else if(s!=null){const o=Zq(s);e[i]=()=>o}}},lSe=(t,e)=>{const n=Zq(e);t.slots.default=()=>n},cSe=(t,e,n)=>{for(const r in e)(n||!Yq(r))&&(t[r]=e[r])},$gt=(t,e,n)=>{const r=t.slots=rSe();if(t.vnode.shapeFlag&32){const i=e._;i?(cSe(r,e,n),n&&b8(r,"_",i,!0)):aSe(e,r)}else e&&lSe(t,e)},Hgt=(t,e,n)=>{const{vnode:r,slots:i}=t;let s=!0,o=Tr;if(r.shapeFlag&32){const a=e._;a?n&&a===1?s=!1:cSe(i,e,n):(s=!e.$stable,aSe(e,i)),o=e}else e&&(lSe(t,e),o={default:1});if(s)for(const a in i)!Yq(a)&&o[a]==null&&delete i[a]};function Ugt(){typeof __VUE_OPTIONS_API__!="boolean"&&(v1().__VUE_OPTIONS_API__=!0),typeof __VUE_PROD_DEVTOOLS__!="boolean"&&(v1().__VUE_PROD_DEVTOOLS__=!1),typeof __VUE_PROD_HYDRATION_MISMATCH_DETAILS__!="boolean"&&(v1().__VUE_PROD_HYDRATION_MISMATCH_DETAILS__=!1)}const Yo=Ygt;function qgt(t){return Wgt(t)}function Wgt(t,e){Ugt();const n=v1();n.__VUE__=!0,__VUE_PROD_DEVTOOLS__&&U_e(n.__VUE_DEVTOOLS_GLOBAL_HOOK__,n);const{insert:r,remove:i,patchProp:s,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:d,nextSibling:h,setScopeId:f=Vc,insertStaticContent:p}=t,g=(H,Y,se,me=null,de=null,ie=null,Te=void 0,he=null,we=!!Y.dynamicChildren)=>{if(H===Y)return;H&&!s4(H,Y)&&(me=_e(H),Ye(H,de,ie,!0),H=null),Y.patchFlag===-2&&(we=!1,Y.dynamicChildren=null);const{type:ye,ref:Ge,shapeFlag:Pe}=Y;switch(ye){case K3:y(H,Y,se,me);break;case cy:v(H,Y,se,me);break;case A6:H==null&&b(Y,se,me,Te);break;case mr:P(H,Y,se,me,de,ie,Te,he,we);break;default:Pe&1?k(H,Y,se,me,de,ie,Te,he,we):Pe&6?z(H,Y,se,me,de,ie,Te,he,we):(Pe&64||Pe&128)&&ye.process(H,Y,se,me,de,ie,Te,he,we,at)}Ge!=null&&de?sS(Ge,H&&H.ref,ie,Y||H,!Y):Ge==null&&H&&H.ref!=null&&sS(H.ref,null,ie,H,!0)},y=(H,Y,se,me)=>{if(H==null)r(Y.el=a(Y.children),se,me);else{const de=Y.el=H.el;Y.children!==H.children&&c(de,Y.children)}},v=(H,Y,se,me)=>{H==null?r(Y.el=l(Y.children||""),se,me):Y.el=H.el},b=(H,Y,se,me)=>{[H.el,H.anchor]=p(H.children,Y,se,me,H.el,H.anchor)},_=({el:H,anchor:Y},se,me)=>{let de;for(;H&&H!==Y;)de=h(H),r(H,se,me),H=de;r(Y,se,me)},S=({el:H,anchor:Y})=>{let se;for(;H&&H!==Y;)se=h(H),i(H),H=se;i(Y)},k=(H,Y,se,me,de,ie,Te,he,we)=>{if(Y.type==="svg"?Te="svg":Y.type==="math"&&(Te="mathml"),H==null)T(Y,se,me,de,ie,Te,he,we);else{const ye=H.el&&H.el._isVueCE?H.el:null;try{ye&&ye._beginPatch(),R(H,Y,de,ie,Te,he,we)}finally{ye&&ye._endPatch()}}},T=(H,Y,se,me,de,ie,Te,he)=>{let we,ye;const{props:Ge,shapeFlag:Pe,transition:tt,dirs:ft}=H;if(we=H.el=o(H.type,ie,Ge&&Ge.is,Ge),Pe&8?u(we,H.children):Pe&16&&C(H.children,we,null,me,de,sD(H,ie),Te,he),ft&&Y0(H,null,me,"created"),E(we,H,H.scopeId,Te,me),Ge){for(const fe in Ge)fe!=="value"&&!nS(fe)&&s(we,fe,null,Ge[fe],ie,me);"value"in Ge&&s(we,"value",null,Ge.value,ie),(ye=Ge.onVnodeBeforeMount)&&bu(ye,me,H)}__VUE_PROD_DEVTOOLS__&&(b8(we,"__vnode",H,!0),b8(we,"__vueParentComponent",me,!0)),ft&&Y0(H,null,me,"beforeMount");const ne=Ggt(de,tt);ne&&tt.beforeEnter(we),r(we,Y,se),((ye=Ge&&Ge.onVnodeMounted)||ne||ft)&&Yo(()=>{try{ye&&bu(ye,me,H),ne&&tt.enter(we),ft&&Y0(H,null,me,"mounted")}finally{}},de)},E=(H,Y,se,me,de)=>{if(se&&f(H,se),me)for(let ie=0;ie<me.length;ie++)f(H,me[ie]);if(de){let ie=de.subTree;if(Y===ie||fSe(ie.type)&&(ie.ssContent===Y||ie.ssFallback===Y)){const Te=de.vnode;E(H,Te,Te.scopeId,Te.slotScopeIds,de.parent)}}},C=(H,Y,se,me,de,ie,Te,he,we=0)=>{for(let ye=we;ye<H.length;ye++){const Ge=H[ye]=he?ch(H[ye]):zu(H[ye]);g(null,Ge,Y,se,me,de,ie,Te,he)}},R=(H,Y,se,me,de,ie,Te)=>{const he=Y.el=H.el;__VUE_PROD_DEVTOOLS__&&(he.__vnode=Y);let{patchFlag:we,dynamicChildren:ye,dirs:Ge}=Y;we|=H.patchFlag&16;const Pe=H.props||Tr,tt=Y.props||Tr;let ft;if(se&&Z0(se,!1),(ft=tt.onVnodeBeforeUpdate)&&bu(ft,se,Y,H),Ge&&Y0(Y,H,se,"beforeUpdate"),se&&Z0(se,!0),(Pe.innerHTML&&tt.innerHTML==null||Pe.textContent&&tt.textContent==null)&&u(he,""),ye?M(H.dynamicChildren,ye,he,se,me,sD(Y,de),ie):Te||J(H,Y,he,null,se,me,sD(Y,de),ie,!1),we>0){if(we&16)D(he,Pe,tt,se,de);else if(we&2&&Pe.class!==tt.class&&s(he,"class",null,tt.class,de),we&4&&s(he,"style",Pe.style,tt.style,de),we&8){const ne=Y.dynamicProps;for(let fe=0;fe<ne.length;fe++){const Le=ne[fe],Ze=Pe[Le],rt=tt[Le];(rt!==Ze||Le==="value")&&s(he,Le,Ze,rt,de,se)}}we&1&&H.children!==Y.children&&u(he,Y.children)}else!Te&&ye==null&&D(he,Pe,tt,se,de);((ft=tt.onVnodeUpdated)||Ge)&&Yo(()=>{ft&&bu(ft,se,Y,H),Ge&&Y0(Y,H,se,"updated")},me)},M=(H,Y,se,me,de,ie,Te)=>{for(let he=0;he<Y.length;he++){const we=H[he],ye=Y[he],Ge=we.el&&(we.type===mr||!s4(we,ye)||we.shapeFlag&198)?d(we.el):se;g(we,ye,Ge,null,me,de,ie,Te,!0)}},D=(H,Y,se,me,de)=>{if(Y!==se){if(Y!==Tr)for(const ie in Y)!nS(ie)&&!(ie in se)&&s(H,ie,Y[ie],null,de,me);for(const ie in se){if(nS(ie))continue;const Te=se[ie],he=Y[ie];Te!==he&&ie!=="value"&&s(H,ie,he,Te,de,me)}"value"in se&&s(H,"value",Y.value,se.value,de)}},P=(H,Y,se,me,de,ie,Te,he,we)=>{const ye=Y.el=H?H.el:a(""),Ge=Y.anchor=H?H.anchor:a("");let{patchFlag:Pe,dynamicChildren:tt,slotScopeIds:ft}=Y;ft&&(he=he?he.concat(ft):ft),H==null?(r(ye,se,me),r(Ge,se,me),C(Y.children||[],se,Ge,de,ie,Te,he,we)):Pe>0&&Pe&64&&tt&&H.dynamicChildren&&H.dynamicChildren.length===tt.length?(M(H.dynamicChildren,tt,se,de,ie,Te,he),(Y.key!=null||de&&Y===de.subTree)&&uSe(H,Y,!0)):J(H,Y,se,Ge,de,ie,Te,he,we)},z=(H,Y,se,me,de,ie,Te,he,we)=>{Y.slotScopeIds=he,H==null?Y.shapeFlag&512?de.ctx.activate(Y,se,me,Te,we):Z(Y,se,me,de,ie,Te,we):re(H,Y,we)},Z=(H,Y,se,me,de,ie,Te)=>{const he=H.component=r1t(H,me,de);if(Y_e(H)&&(he.ctx.renderer=at),s1t(he,!1,Te),he.asyncDep){if(de&&de.registerDep(he,G,Te),!H.el){const we=he.subTree=Pc(cy);v(null,we,Y,se),H.placeholder=we.el}}else G(he,H,Y,se,de,ie,Te)},re=(H,Y,se)=>{const me=Y.component=H.component;if(Lgt(H,Y,se))if(me.asyncDep&&!me.asyncResolved){ee(me,Y,se);return}else me.next=Y,me.update();else Y.el=H.el,me.vnode=Y},G=(H,Y,se,me,de,ie,Te)=>{const he=()=>{if(H.isMounted){let{next:Pe,bu:tt,u:ft,parent:ne,vnode:fe}=H;{const Yt=dSe(H);if(Yt){Pe&&(Pe.el=fe.el,ee(H,Pe,Te)),Yt.asyncDep.then(()=>{Yo(()=>{H.isUnmounted||ye()},de)});return}}let Le=Pe,Ze;Z0(H,!1),Pe?(Pe.el=fe.el,ee(H,Pe,Te)):Pe=fe,tt&&JO(tt),(Ze=Pe.props&&Pe.props.onVnodeBeforeUpdate)&&bu(Ze,ne,Pe,fe),Z0(H,!0);const rt=wie(H),un=H.subTree;H.subTree=rt,g(un,rt,d(un.el),_e(un),H,de,ie),Pe.el=rt.el,Le===null&&zgt(H,rt.el),ft&&Yo(ft,de),(Ze=Pe.props&&Pe.props.onVnodeUpdated)&&Yo(()=>bu(Ze,ne,Pe,fe),de),__VUE_PROD_DEVTOOLS__&&q_e(H)}else{let Pe;const{el:tt,props:ft}=Y,{bm:ne,m:fe,parent:Le,root:Ze,type:rt}=H,un=oS(Y);Z0(H,!1),ne&&JO(ne),!un&&(Pe=ft&&ft.onVnodeBeforeMount)&&bu(Pe,Le,Y),Z0(H,!0);{Ze.ce&&Ze.ce._hasShadowRoot()&&Ze.ce._injectChildStyle(rt,H.parent?H.parent.type:void 0);const Yt=H.subTree=wie(H);g(null,Yt,se,me,H,de,ie),Y.el=Yt.el}if(fe&&Yo(fe,de),!un&&(Pe=ft&&ft.onVnodeMounted)){const Yt=Y;Yo(()=>bu(Pe,Le,Yt),de)}(Y.shapeFlag&256||Le&&oS(Le.vnode)&&Le.vnode.shapeFlag&256)&&H.a&&Yo(H.a,de),H.isMounted=!0,__VUE_PROD_DEVTOOLS__&&egt(H),Y=se=me=null}};H.scope.on();const we=H.effect=new k_e(he);H.scope.off();const ye=H.update=we.run.bind(we),Ge=H.job=we.runIfDirty.bind(we);Ge.i=H,Ge.id=H.uid,we.scheduler=()=>qq(Ge),Z0(H,!0),ye()},ee=(H,Y,se)=>{Y.component=H;const me=H.vnode.props;H.vnode=Y,H.next=null,Bgt(H,Y.props,me,se),Hgt(H,Y.children,se),gf(),fie(H),yf()},J=(H,Y,se,me,de,ie,Te,he,we=!1)=>{const ye=H&&H.children,Ge=H?H.shapeFlag:0,Pe=Y.children,{patchFlag:tt,shapeFlag:ft}=Y;if(tt>0){if(tt&128){B(ye,Pe,se,me,de,ie,Te,he,we);return}else if(tt&256){oe(ye,Pe,se,me,de,ie,Te,he,we);return}}ft&8?(Ge&16&&Me(ye,de,ie),Pe!==ye&&u(se,Pe)):Ge&16?ft&16?B(ye,Pe,se,me,de,ie,Te,he,we):Me(ye,de,ie,!0):(Ge&8&&u(se,""),ft&16&&C(Pe,se,me,de,ie,Te,he,we))},oe=(H,Y,se,me,de,ie,Te,he,we)=>{H=H||eS,Y=Y||eS;const ye=H.length,Ge=Y.length,Pe=Math.min(ye,Ge);let tt;for(tt=0;tt<Pe;tt++){const ft=Y[tt]=we?ch(Y[tt]):zu(Y[tt]);g(H[tt],ft,se,null,de,ie,Te,he,we)}ye>Ge?Me(H,de,ie,!0,!1,Pe):C(Y,se,me,de,ie,Te,he,we,Pe)},B=(H,Y,se,me,de,ie,Te,he,we)=>{let ye=0;const Ge=Y.length;let Pe=H.length-1,tt=Ge-1;for(;ye<=Pe&&ye<=tt;){const ft=H[ye],ne=Y[ye]=we?ch(Y[ye]):zu(Y[ye]);if(s4(ft,ne))g(ft,ne,se,null,de,ie,Te,he,we);else break;ye++}for(;ye<=Pe&&ye<=tt;){const ft=H[Pe],ne=Y[tt]=we?ch(Y[tt]):zu(Y[tt]);if(s4(ft,ne))g(ft,ne,se,null,de,ie,Te,he,we);else break;Pe--,tt--}if(ye>Pe){if(ye<=tt){const ft=tt+1,ne=ft<Ge?Y[ft].el:me;for(;ye<=tt;)g(null,Y[ye]=we?ch(Y[ye]):zu(Y[ye]),se,ne,de,ie,Te,he,we),ye++}}else if(ye>tt)for(;ye<=Pe;)Ye(H[ye],de,ie,!0),ye++;else{const ft=ye,ne=ye,fe=new Map;for(ye=ne;ye<=tt;ye++){const In=Y[ye]=we?ch(Y[ye]):zu(Y[ye]);In.key!=null&&fe.set(In.key,ye)}let Le,Ze=0;const rt=tt-ne+1;let un=!1,Yt=0;const _n=new Array(rt);for(ye=0;ye<rt;ye++)_n[ye]=0;for(ye=ft;ye<=Pe;ye++){const In=H[ye];if(Ze>=rt){Ye(In,de,ie,!0);continue}let Vt;if(In.key!=null)Vt=fe.get(In.key);else for(Le=ne;Le<=tt;Le++)if(_n[Le-ne]===0&&s4(In,Y[Le])){Vt=Le;break}Vt===void 0?Ye(In,de,ie,!0):(_n[Vt-ne]=ye+1,Vt>=Yt?Yt=Vt:un=!0,g(In,Y[Vt],se,null,de,ie,Te,he,we),Ze++)}const kr=un?Kgt(_n):eS;for(Le=kr.length-1,ye=rt-1;ye>=0;ye--){const In=ne+ye,Vt=Y[In],zr=Y[In+1],Ee=In+1<Ge?zr.el||hSe(zr):me;_n[ye]===0?g(null,Vt,se,Ee,de,ie,Te,he,we):un&&(Le<0||ye!==kr[Le]?$e(Vt,se,Ee,2):Le--)}}},$e=(H,Y,se,me,de=null)=>{const{el:ie,type:Te,transition:he,children:we,shapeFlag:ye}=H;if(ye&6){$e(H.component.subTree,Y,se,me);return}if(ye&128){H.suspense.move(Y,se,me);return}if(ye&64){Te.move(H,Y,se,at);return}if(Te===mr){r(ie,Y,se);for(let Pe=0;Pe<we.length;Pe++)$e(we[Pe],Y,se,me);r(H.anchor,Y,se);return}if(Te===A6){_(H,Y,se);return}if(me!==2&&ye&1&&he)if(me===0)he.persisted&&!ie[rD]?r(ie,Y,se):(he.beforeEnter(ie),r(ie,Y,se),Yo(()=>he.enter(ie),de));else{const{leave:Pe,delayLeave:tt,afterLeave:ft}=he,ne=()=>{H.ctx.isUnmounted?i(ie):r(ie,Y,se)},fe=()=>{const Le=ie._isLeaving||!!ie[rD];ie._isLeaving&&ie[rD](!0),he.persisted&&!Le?ne():Pe(ie,()=>{ne(),ft&&ft()})};tt?tt(ie,ne,fe):fe()}else r(ie,Y,se)},Ye=(H,Y,se,me=!1,de=!1)=>{const{type:ie,props:Te,ref:he,children:we,dynamicChildren:ye,shapeFlag:Ge,patchFlag:Pe,dirs:tt,cacheIndex:ft,memo:ne}=H;if(Pe===-2&&(de=!1),he!=null&&(gf(),sS(he,null,se,H,!0),yf()),ft!=null&&(Y.renderCache[ft]=void 0),Ge&256){Y.ctx.deactivate(H);return}const fe=Ge&1&&tt,Le=!oS(H);let Ze;if(Le&&(Ze=Te&&Te.onVnodeBeforeUnmount)&&bu(Ze,Y,H),Ge&6)ke(H.component,se,me);else{if(Ge&128){H.suspense.unmount(se,me);return}fe&&Y0(H,null,Y,"beforeUnmount"),Ge&64?H.type.remove(H,Y,se,at,me):ye&&!ye.hasOnce&&(ie!==mr||Pe>0&&Pe&64)?Me(ye,Y,se,!1,!0):(ie===mr&&Pe&384||!de&&Ge&16)&&Me(we,Y,se),me&&$(H)}const rt=ne!=null&&ft==null;(Le&&(Ze=Te&&Te.onVnodeUnmounted)||fe||rt)&&Yo(()=>{Ze&&bu(Ze,Y,H),fe&&Y0(H,null,Y,"unmounted"),rt&&(H.el=null)},se)},$=H=>{const{type:Y,el:se,anchor:me,transition:de}=H;if(Y===mr){Re(se,me);return}if(Y===A6){S(H);return}const ie=()=>{i(se),de&&!de.persisted&&de.afterLeave&&de.afterLeave()};if(H.shapeFlag&1&&de&&!de.persisted){const{leave:Te,delayLeave:he}=de,we=()=>Te(se,ie);he?he(H.el,ie,we):we()}else ie()},Re=(H,Y)=>{let se;for(;H!==Y;)se=h(H),i(H),H=se;i(Y)},ke=(H,Y,se)=>{const{bum:me,scope:de,job:ie,subTree:Te,um:he,m:we,a:ye}=H;Sie(we),Sie(ye),me&&JO(me),de.stop(),ie&&(ie.flags|=8,Ye(Te,H,Y,se)),he&&Yo(he,Y),Yo(()=>{H.isUnmounted=!0},Y),__VUE_PROD_DEVTOOLS__&&ngt(H)},Me=(H,Y,se,me=!1,de=!1,ie=0)=>{for(let Te=ie;Te<H.length;Te++)Ye(H[Te],Y,se,me,de)},_e=H=>{if(H.shapeFlag&6)return _e(H.component.subTree);if(H.shapeFlag&128)return H.suspense.next();const Y=h(H.anchor||H.el),se=Y&&Y[cgt];return se?h(se):Y};let Ne=!1;const Ue=(H,Y,se)=>{let me;H==null?Y._vnode&&(Ye(Y._vnode,null,null,!0),me=Y._vnode.component):g(Y._vnode||null,H,Y,null,null,null,se),Y._vnode=H,Ne||(Ne=!0,fie(me),$_e(),Ne=!1)},at={p:g,um:Ye,m:$e,r:$,mt:Z,mc:C,pc:J,pbc:M,n:_e,o:t};return{render:Ue,hydrate:void 0,createApp:Rgt(Ue)}}function sD({type:t,props:e},n){return n==="svg"&&t==="foreignObject"||n==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:n}function Z0({effect:t,job:e},n){n?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function Ggt(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function uSe(t,e,n=!1){const r=t.children,i=e.children;if(Qt(r)&&Qt(i))for(let s=0;s<r.length;s++){const o=r[s];let a=i[s];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=i[s]=ch(i[s]),a.el=o.el),!n&&a.patchFlag!==-2&&uSe(o,a)),a.type===K3&&(a.patchFlag===-1&&(a=i[s]=ch(a)),a.el=o.el),a.type===cy&&!a.el&&(a.el=o.el)}}function Kgt(t){const e=t.slice(),n=[0];let r,i,s,o,a;const l=t.length;for(r=0;r<l;r++){const c=t[r];if(c!==0){if(i=n[n.length-1],t[i]<c){e[r]=i,n.push(r);continue}for(s=0,o=n.length-1;s<o;)a=s+o>>1,t[n[a]]<c?s=a+1:o=a;c<t[n[s]]&&(s>0&&(e[r]=n[s-1]),n[s]=r)}}for(s=n.length,o=n[s-1];s-- >0;)n[s]=o,o=e[o];return n}function dSe(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:dSe(e)}function Sie(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}function hSe(t){if(t.placeholder)return t.placeholder;const e=t.component;return e?hSe(e.subTree):null}const fSe=t=>t.__isSuspense;function Ygt(t,e){e&&e.pendingBranch?Qt(t)?e.effects.push(...t):e.effects.push(t):X0t(t)}const mr=Symbol.for("v-fgt"),K3=Symbol.for("v-txt"),cy=Symbol.for("v-cmt"),A6=Symbol.for("v-stc");function E8(t){return t?t.__v_isVNode===!0:!1}function s4(t,e){return t.type===e.type&&t.key===e.key}const pSe=({key:t})=>t??null,I6=({ref:t,ref_key:e,ref_for:n})=>(typeof t=="number"&&(t=""+t),t!=null?Li(t)||no(t)||on(t)?{i:ed,r:t,k:e,f:!!n}:t:null);function Zgt(t,e=null,n=null,r=0,i=null,s=t===mr?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&pSe(e),ref:e&&I6(e),scopeId:W_e,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:s,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:ed};return a?(Xq(l,n),s&128&&t.normalize(l)):n&&(l.shapeFlag|=Li(n)?8:16),l}const Pc=Xgt;function Xgt(t,e=null,n=null,r=0,i=null,s=!1){if((!t||t===_gt)&&(t=cy),E8(t)){const a=px(t,e,!0);return n&&Xq(a,n),a.patchFlag=-2,a}if(c1t(t)&&(t=t.__vccOpts),e){e=Qgt(e);let{class:a,style:l}=e;a&&!Li(a)&&(e.class=Dq(a)),Rr(l)&&(Uq(l)&&!Qt(l)&&(l=js({},l)),e.style=Oq(l))}const o=Li(t)?1:fSe(t)?128:ugt(t)?64:Rr(t)?4:on(t)?2:0;return Zgt(t,e,n,r,i,o,s,!0)}function Qgt(t){return t?Uq(t)||iSe(t)?js({},t):t:null}function px(t,e,n=!1,r=!1){const{props:i,ref:s,patchFlag:o,children:a,transition:l}=t,c=e?e1t(i||{},e):i,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&pSe(c),ref:e&&e.ref?n&&s?Qt(s)?s.concat(I6(e)):[s,I6(e)]:I6(e):s,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==mr?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&px(t.ssContent),ssFallback:t.ssFallback&&px(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&r&&Kq(u,l.clone(u)),u}function Jgt(t=" ",e=0){return Pc(K3,null,t,e)}function zu(t){return t==null||typeof t=="boolean"?Pc(cy):Qt(t)?Pc(mr,null,t.slice()):E8(t)?ch(t):Pc(K3,null,String(t))}function ch(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:px(t)}function Xq(t,e){let n=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(Qt(e))n=16;else if(typeof e=="object")if(r&65){const i=e.default;i&&(i._c&&(i._d=!1),Xq(t,i()),i._c&&(i._d=!0));return}else{n=32;const i=e._;!i&&!iSe(e)?e._ctx=ed:i===3&&ed&&(ed.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else on(e)?(e={default:e,_ctx:ed},n=32):(e=String(e),r&64?(n=16,e=[Jgt(e)]):n=8);t.children=e,t.shapeFlag|=n}function e1t(...t){const e={};for(let n=0;n<t.length;n++){const r=t[n];for(const i in r)if(i==="class")e.class!==r.class&&(e.class=Dq([e.class,r.class]));else if(i==="style")e.style=Oq([e.style,r.style]);else if(mR(i)){const s=e[i],o=r[i];o&&s!==o&&!(Qt(s)&&s.includes(o))?e[i]=s?[].concat(s,o):o:o==null&&s==null&&!gR(i)&&(e[i]=o)}else i!==""&&(e[i]=r[i])}return e}function bu(t,e,n,r=null){nu(t,e,7,[n,r])}const t1t=J_e();let n1t=0;function r1t(t,e,n){const r=t.type,i=(e?e.appContext:t.appContext)||t1t,s={uid:n1t++,vnode:t,type:r,parent:e,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new x0t(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(i.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:oSe(r,i),emitsOptions:eSe(r,i),emit:null,emitted:null,propsDefaults:Tr,inheritAttrs:r.inheritAttrs,ctx:Tr,data:Tr,props:Tr,attrs:Tr,slots:Tr,refs:Tr,setupState:Tr,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return s.ctx={_:s},s.root=e?e.root:s,s.emit=Ngt.bind(null,s),t.ce&&t.ce(s),s}let To=null;const i1t=()=>To||ed;let T8,gB;{const t=v1(),e=(n,r)=>{let i;return(i=t[n])||(i=t[n]=[]),i.push(r),s=>{i.length>1?i.forEach(o=>o(s)):i[0](s)}};T8=e("__VUE_INSTANCE_SETTERS__",n=>To=n),gB=e("__VUE_SSR_SETTERS__",n=>Tk=n)}const Y3=t=>{const e=To;return T8(t),t.scope.on(),()=>{t.scope.off(),T8(e)}},kie=()=>{To&&To.scope.off(),T8(null)};function mSe(t){return t.vnode.shapeFlag&4}let Tk=!1;function s1t(t,e=!1,n=!1){e&&gB(e);const{props:r,children:i}=t.vnode,s=mSe(t);jgt(t,r,s,e),$gt(t,i,n||e);const o=s?o1t(t,e):void 0;return e&&gB(!1),o}function o1t(t,e){const n=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,Sgt);const{setup:r}=n;if(r){gf();const i=t.setupContext=r.length>1?l1t(t):null,s=Y3(t),o=G3(r,t,0,[t.props,i]),a=x_e(o);if(yf(),s(),(a||t.sp)&&!oS(t)&&K_e(t),a){if(o.then(kie,kie),e)return o.then(l=>{Cie(t,l)}).catch(l=>{vR(l,t,0)});t.asyncDep=o}else Cie(t,o)}else gSe(t)}function Cie(t,e,n){on(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:Rr(e)&&(__VUE_PROD_DEVTOOLS__&&(t.devtoolsRawSetupState=e),t.setupState=B_e(e)),gSe(t)}function gSe(t,e,n){const r=t.type;if(t.render||(t.render=r.render||Vc),__VUE_OPTIONS_API__){const i=Y3(t);gf();try{kgt(t)}finally{yf(),i()}}}const a1t={get(t,e){return Qs(t,"get",""),t[e]}};function l1t(t){const e=n=>{t.exposed=n||{}};return{attrs:new Proxy(t.attrs,a1t),slots:t.slots,emit:t.emit,expose:e}}function Qq(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(B_e(V0t(t.exposed)),{get(e,n){if(n in e)return e[n];if(n in aS)return aS[n](t)},has(e,n){return n in e||n in aS}})):t.proxy}function c1t(t){return on(t)&&"__vccOpts"in t}const Ll=(t,e)=>W0t(t,e,Tk);function X(t,e,n){try{const r=arguments.length;return r===2?Rr(e)&&!Qt(e)?E8(e)?Pc(t,null,[e]):Pc(t,e):Pc(t,null,e):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&E8(n)&&(n=[n]),Pc(t,e,n))}finally{}}const Eie="3.5.35";/**
|
||
* @vue/runtime-dom v3.5.35
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/let yB;const Tie=typeof window<"u"&&window.trustedTypes;if(Tie)try{yB=Tie.createPolicy("vue",{createHTML:t=>t})}catch{}const ySe=yB?t=>yB.createHTML(t):t=>t,u1t="http://www.w3.org/2000/svg",d1t="http://www.w3.org/1998/Math/MathML",sh=typeof document<"u"?document:null,Aie=sh&&sh.createElement("template"),h1t={insert:(t,e,n)=>{e.insertBefore(t,n||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,n,r)=>{const i=e==="svg"?sh.createElementNS(u1t,t):e==="mathml"?sh.createElementNS(d1t,t):n?sh.createElement(t,{is:n}):sh.createElement(t);return t==="select"&&r&&r.multiple!=null&&i.setAttribute("multiple",r.multiple),i},createText:t=>sh.createTextNode(t),createComment:t=>sh.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>sh.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,n,r,i,s){const o=n?n.previousSibling:e.lastChild;if(i&&(i===s||i.nextSibling))for(;e.insertBefore(i.cloneNode(!0),n),!(i===s||!(i=i.nextSibling)););else{Aie.innerHTML=ySe(r==="svg"?`<svg>${t}</svg>`:r==="mathml"?`<math>${t}</math>`:t);const a=Aie.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,n)}return[o?o.nextSibling:e.firstChild,n?n.previousSibling:e.lastChild]}},f1t=Symbol("_vtc");function p1t(t,e,n){const r=t[f1t];r&&(e=(e?[e,...r]:[...r]).join(" ")),e==null?t.removeAttribute("class"):n?t.setAttribute("class",e):t.className=e}const Iie=Symbol("_vod"),m1t=Symbol("_vsh"),g1t=Symbol(""),y1t=/(?:^|;)\s*display\s*:/;function v1t(t,e,n){const r=t.style,i=Li(n);let s=!1;if(n&&!i){if(e)if(Li(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();n[a]==null&&B4(r,a,"")}else for(const o in e)n[o]==null&&B4(r,o,"");for(const o in n){o==="display"&&(s=!0);const a=n[o];a!=null?w1t(t,o,!Li(e)&&e?e[o]:void 0,a)||B4(r,o,a):B4(r,o,"")}}else if(i){if(e!==n){const o=r[g1t];o&&(n+=";"+o),r.cssText=n,s=y1t.test(n)}}else e&&t.removeAttribute("style");Iie in t&&(t[Iie]=s?r.display:"",t[m1t]&&(r.display="none"))}const Rie=/\s*!important$/;function B4(t,e,n){if(Qt(n))n.forEach(r=>B4(t,e,r));else if(n==null&&(n=""),e.startsWith("--"))t.setProperty(e,n);else{const r=b1t(t,e);Rie.test(n)?t.setProperty(Iy(r),n.replace(Rie,""),"important"):t[r]=n}}const Mie=["Webkit","Moz","ms"],oD={};function b1t(t,e){const n=oD[e];if(n)return n;let r=$c(e);if(r!=="filter"&&r in t)return oD[e]=r;r=__e(r);for(let i=0;i<Mie.length;i++){const s=Mie[i]+r;if(s in t)return oD[e]=s}return e}function w1t(t,e,n,r){return t.tagName==="TEXTAREA"&&(e==="width"||e==="height")&&Li(r)&&n===r}const Nie="http://www.w3.org/1999/xlink";function Oie(t,e,n,r,i,s=b0t(e)){r&&e.startsWith("xlink:")?n==null?t.removeAttributeNS(Nie,e.slice(6,e.length)):t.setAttributeNS(Nie,e,n):n==null||s&&!S_e(n)?t.removeAttribute(e):t.setAttribute(e,s?"":e0(n)?String(n):n)}function Die(t,e,n,r,i){if(e==="innerHTML"||e==="textContent"){n!=null&&(t[e]=e==="innerHTML"?ySe(n):n);return}const s=t.tagName;if(e==="value"&&s!=="PROGRESS"&&!s.includes("-")){const a=s==="OPTION"?t.getAttribute("value")||"":t.value,l=n==null?t.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in t))&&(t.value=l),n==null&&t.removeAttribute(e),t._value=n;return}let o=!1;if(n===""||n==null){const a=typeof t[e];a==="boolean"?n=S_e(n):n==null&&a==="string"?(n="",o=!0):a==="number"&&(n=0,o=!0)}try{t[e]=n}catch{}o&&t.removeAttribute(i||e)}function x1t(t,e,n,r){t.addEventListener(e,n,r)}function _1t(t,e,n,r){t.removeEventListener(e,n,r)}const Pie=Symbol("_vei");function S1t(t,e,n,r,i=null){const s=t[Pie]||(t[Pie]={}),o=s[e];if(r&&o)o.value=r;else{const[a,l]=k1t(e);if(r){const c=s[e]=T1t(r,i);x1t(t,a,c,l)}else o&&(_1t(t,a,o,l),s[e]=void 0)}}const Lie=/(?:Once|Passive|Capture)$/;function k1t(t){let e;if(Lie.test(t)){e={};let r;for(;r=t.match(Lie);)t=t.slice(0,t.length-r[0].length),e[r[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):Iy(t.slice(2)),e]}let aD=0;const C1t=Promise.resolve(),E1t=()=>aD||(C1t.then(()=>aD=0),aD=Date.now());function T1t(t,e){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;const i=n.value;if(Qt(i)){const s=r.stopImmediatePropagation;r.stopImmediatePropagation=()=>{s.call(r),r._stopped=!0};const o=i.slice(),a=[r];for(let l=0;l<o.length&&!r._stopped;l++){const c=o[l];c&&nu(c,e,5,a)}}else nu(i,e,5,[r])};return n.value=t,n.attached=E1t(),n}const zie=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,A1t=(t,e,n,r,i,s)=>{const o=i==="svg";e==="class"?p1t(t,r,o):e==="style"?v1t(t,n,r):mR(e)?gR(e)||S1t(t,e,n,r,s):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):I1t(t,e,r,o))?(Die(t,e,r),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Oie(t,e,r,o,s,e!=="value")):t._isVueCE&&(R1t(t,e)||t._def.__asyncLoader&&(/[A-Z]/.test(e)||!Li(r)))?Die(t,$c(e),r,s,e):(e==="true-value"?t._trueValue=r:e==="false-value"&&(t._falseValue=r),Oie(t,e,r,o))};function I1t(t,e,n,r){if(r)return!!(e==="innerHTML"||e==="textContent"||e in t&&zie(e)&&on(n));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&t.tagName==="IFRAME"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const i=t.tagName;if(i==="IMG"||i==="VIDEO"||i==="CANVAS"||i==="SOURCE")return!1}return zie(e)&&Li(n)?!1:e in t}function R1t(t,e){const n=t._def.props;if(!n)return!1;const r=$c(e);return Array.isArray(n)?n.some(i=>$c(i)===r):Object.keys(n).some(i=>$c(i)===r)}const M1t=js({patchProp:A1t},h1t);let jie;function N1t(){return jie||(jie=qgt(M1t))}const hl=(...t)=>{const e=N1t().createApp(...t),{mount:n}=e;return e.mount=r=>{const i=D1t(r);if(!i)return;const s=e._component;!on(s)&&!s.render&&!s.template&&(s.template=i.innerHTML),i.nodeType===1&&(i.textContent="");const o=n(i,!1,O1t(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),o},e};function O1t(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function D1t(t){return Li(t)?document.querySelector(t):t}function P1t(...t){}P1t(X);function _o({icon:t,class:e,onClick:n}){return X("span",{class:ji("milkdown-icon",e),onPointerdown:n,innerHTML:t?dl.sanitize(t.trim()):void 0})}_o.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};function Z3(t,e){return Object.assign(t,{meta:{package:"@milkdown/plugin-block",...e}}),t}var L1t=t=>!hd(e=>e.type.name==="table")(t),_R=xn({filterNodes:L1t},"blockConfig");Z3(_R,{displayName:"Ctx<blockConfig>"});function z1t(t,e,n){var r;if(!t.dom.parentElement)return null;try{const i=(r=t.posAtCoords({left:e.x,top:e.y}))==null?void 0:r.inside;if(i==null||i<0)return null;let s=t.state.doc.resolve(i),o=t.state.doc.nodeAt(i),a=t.nodeDOM(i);const l=c=>{const u=s.depth>=1&&s.index(s.depth)===0;if(!(c||u))return;const d=s.before(s.depth);o=t.state.doc.nodeAt(d),a=t.nodeDOM(d),s=t.state.doc.resolve(d),n(s,o)||l(!0)};return l(!n(s,o)),!a||!o?null:{node:o,$pos:s,el:a}}catch{return null}}var Bie=BE.ie&&BE.ie_version<15||BE.ios&&BE.webkit_version<604,Fie=20,mw,k5,Xg,Ec,gw,Tc,Ic,vSe,hg,Qg,Jg,C5,yw,vw,bw,ww,E5,Gp,Xle,j1t=(Xle=class{constructor(){te(this,Ic);te(this,mw);te(this,k5);te(this,Xg);te(this,Ec);te(this,gw);te(this,Tc);te(this,Qg);te(this,Jg);te(this,C5);te(this,yw);te(this,vw);te(this,bw);te(this,ww);te(this,E5);te(this,Gp);W(this,k5,()=>{if(!O(this,Ec))return null;const t=O(this,Ec),e=O(this,Ic,hg);if(e&&Et.isSelectable(t.node)){const n=Et.create(e.state.doc,t.$pos.pos);return e.dispatch(e.state.tr.setSelection(n)),e.focus(),W(this,Xg,n),n}return null}),W(this,Xg,null),W(this,Ec,null),W(this,gw,void 0),W(this,Tc,!1),W(this,Jg,()=>{var t;(t=O(this,Qg))==null||t.call(this,{type:"hide"}),W(this,Ec,null)}),W(this,C5,t=>{var e;W(this,Ec,t),(e=O(this,Qg))==null||e.call(this,{type:"show",active:t})}),this.bind=(t,e)=>{W(this,mw,t),W(this,Qg,e)},this.addEvent=t=>{t.addEventListener("mousedown",O(this,yw)),t.addEventListener("mouseup",O(this,vw)),t.addEventListener("dragstart",O(this,bw)),t.addEventListener("dragend",O(this,ww))},this.removeEvent=t=>{t.removeEventListener("mousedown",O(this,yw)),t.removeEventListener("mouseup",O(this,vw)),t.removeEventListener("dragstart",O(this,bw)),t.removeEventListener("dragend",O(this,ww))},this.unBind=()=>{W(this,Qg,void 0)},W(this,yw,()=>{var t;W(this,gw,(t=O(this,Ec))==null?void 0:t.el.getBoundingClientRect()),O(this,k5).call(this)}),W(this,vw,()=>{if(!O(this,Tc)){requestAnimationFrame(()=>{var t;O(this,gw)&&((t=O(this,Ic,hg))==null||t.focus())});return}W(this,Tc,!1),W(this,Xg,null)}),W(this,bw,t=>{var r;W(this,Tc,!0);const e=O(this,Ic,hg);if(!e)return;e.dom.dataset.dragging="true";const n=O(this,Xg);if(t.dataTransfer&&n){const i=n.content();t.dataTransfer.effectAllowed="copyMove";const{dom:s,text:o}=e.serializeForClipboard(i);t.dataTransfer.clearData(),t.dataTransfer.setData(Bie?"Text":"text/html",s.innerHTML),Bie||t.dataTransfer.setData("text/plain",o);const a=(r=O(this,Ec))==null?void 0:r.el;a&&t.dataTransfer.setDragImage(a,0,0),e.dragging={slice:i,move:!0}}}),W(this,ww,()=>{O(this,Ic,hg)&&O(this,Gp).call(this,O(this,Ic,hg))}),this.keydownCallback=t=>(O(this,Jg).call(this),W(this,Tc,!1),t.dom.dataset.dragging="false",!1),W(this,E5,PI((t,e)=>{if(!t.editable)return;const n=t.dom.getBoundingClientRect(),r=n.left+n.width/2;if(!(t.root.elementFromPoint(r,e.clientY)instanceof Element)){O(this,Jg).call(this);return}const i=O(this,Ic,vSe);if(!i)return;const s=z1t(t,{x:r,y:e.clientY},i);if(!s){O(this,Jg).call(this);return}O(this,C5).call(this,s)},200)),this.mousemoveCallback=(t,e)=>(t.composing||!t.editable||O(this,E5).call(this,t,e),!1),this.dragoverCallback=(t,e)=>{var n;if(O(this,Tc)){const r=(n=O(this,Ic,hg))==null?void 0:n.dom.parentElement;if(!r)return!1;const i=r.scrollHeight>r.clientHeight,s=r.getBoundingClientRect();if(i){if(r.scrollTop>0&&Math.abs(e.y-s.y)<Fie)return r.scrollTop=r.scrollTop>10?r.scrollTop-10:0,!1;const o=Math.round(t.dom.getBoundingClientRect().height);if(Math.round(r.scrollTop+s.height)<o&&Math.abs(e.y-(s.height+s.y))<Fie)return r.scrollTop=r.scrollTop+10,!1}}return!1},this.dragenterCallback=t=>{t.dragging&&(W(this,Tc,!0),t.dom.dataset.dragging="true")},this.dragleaveCallback=(t,e)=>{const n=e.clientX,r=e.clientY;(n<0||r<0||n>window.innerWidth||r>window.innerHeight)&&(W(this,Ec,null),O(this,Gp).call(this,t))},this.dropCallback=t=>(O(this,Gp).call(this,t),!1),this.dragendCallback=t=>{O(this,Gp).call(this,t)},W(this,Gp,t=>{W(this,Tc,!1),t.dom.dataset.dragging="false"})}},mw=new WeakMap,k5=new WeakMap,Xg=new WeakMap,Ec=new WeakMap,gw=new WeakMap,Tc=new WeakMap,Ic=new WeakSet,vSe=function(){var t;try{return(t=O(this,mw))==null?void 0:t.get(_R.key).filterNodes}catch{return}},hg=function(){var t;return(t=O(this,mw))==null?void 0:t.get(cn)},Qg=new WeakMap,Jg=new WeakMap,C5=new WeakMap,yw=new WeakMap,vw=new WeakMap,bw=new WeakMap,ww=new WeakMap,E5=new WeakMap,Gp=new WeakMap,Xle),Jq=xn(()=>new j1t,"blockService"),SR=xn({},"blockServiceInstance");Z3(Jq,{displayName:"Ctx<blockService>"});Z3(SR,{displayName:"Ctx<blockServiceInstance>"});var kR=xn({},"blockSpec");Z3(kR,{displayName:"Ctx<blockSpec>"});var eW=Sr(t=>{const e=new Vn("MILKDOWN_BLOCK"),n=t.get(Jq.key)();t.set(SR.key,n);const r=t.get(kR.key);return new Fn({key:e,...r,props:{...r.props,handleDOMEvents:{drop:i=>n.dropCallback(i),pointermove:(i,s)=>n.mousemoveCallback(i,s),keydown:i=>n.keydownCallback(i),dragover:(i,s)=>n.dragoverCallback(i,s),dragleave:(i,s)=>n.dragleaveCallback(i,s),dragenter:i=>n.dragenterCallback(i),dragend:i=>n.dragendCallback(i)}}})});Z3(eW,{displayName:"Prose<block>"});var ea,xh,e1,t1,T5,xw,A5,I5,_w,Sw,kw,Q8,bSe,Qle,B1t=(Qle=class{constructor(t){te(this,Q8);te(this,ea);te(this,xh);te(this,e1);te(this,t1);te(this,T5);te(this,xw);te(this,A5);te(this,I5);te(this,_w);te(this,Sw);te(this,kw);W(this,t1,null),W(this,xw,!1),this.update=()=>{requestAnimationFrame(()=>{if(!O(this,xw))try{Ot(this,Q8,bSe).call(this),W(this,xw,!0)}catch{}})},this.destroy=()=>{var e,n;(e=O(this,e1))==null||e.unBind(),(n=O(this,e1))==null||n.removeEvent(O(this,ea)),O(this,ea).remove()},this.show=e=>{const n=e.el,r=O(this,xh).get(cn).dom,i={ctx:O(this,xh),active:e,editorDom:r,blockDom:O(this,ea)},s={contextElement:n,getBoundingClientRect:()=>O(this,Sw)?O(this,Sw).call(this,i):n.getBoundingClientRect()},o=[Iq()];if(O(this,_w)){const a=ly(O(this,_w).call(this,i));o.push(a)}_d(s,O(this,ea),{placement:O(this,kw)?O(this,kw).call(this,i):"left",middleware:[...o,...O(this,A5)],...O(this,I5)}).then(({x:a,y:l})=>{Object.assign(O(this,ea).style,{left:`${a}px`,top:`${l}px`}),O(this,ea).dataset.show="true"}).catch(console.error)},this.hide=()=>{O(this,ea).dataset.show="false"},W(this,xh,t.ctx),W(this,ea,t.content),W(this,_w,t.getOffset),W(this,Sw,t.getPosition),W(this,kw,t.getPlacement),W(this,A5,t.middleware??[]),W(this,I5,t.floatingUIOptions??{}),W(this,T5,t.root),this.hide()}get active(){return O(this,t1)}},ea=new WeakMap,xh=new WeakMap,e1=new WeakMap,t1=new WeakMap,T5=new WeakMap,xw=new WeakMap,A5=new WeakMap,I5=new WeakMap,_w=new WeakMap,Sw=new WeakMap,kw=new WeakMap,Q8=new WeakSet,bSe=function(){const t=O(this,xh).get(cn);(O(this,T5)??t.dom.parentElement??document.body).appendChild(O(this,ea));const e=O(this,xh).get(SR.key);e.bind(O(this,xh),n=>{n.type==="hide"?(this.hide(),W(this,t1,null)):n.type==="show"&&(this.show(n.active),W(this,t1,n.active))}),W(this,e1,e),O(this,e1).addEvent(O(this,ea)),O(this,ea).draggable=!0},Qle),CR=[kR,_R,Jq,SR,eW];CR.key=kR.key;CR.pluginKey=eW.key;function F1t(t,e){return function(n,r){let{$from:i,$to:s,node:o}=n.selection;if(o&&o.isBlock||i.depth<2||!i.sameParent(s))return!1;let a=i.node(-1);if(a.type!=t)return!1;if(i.parent.content.size==0&&i.node(-1).childCount==i.indexAfter(-1)){if(i.depth==3||i.node(-3).type!=t||i.index(-2)!=i.node(-2).childCount-1)return!1;if(r){let d=De.empty,h=i.index(-1)?1:i.index(-2)?2:3;for(let v=i.depth-h;v>=i.depth-3;v--)d=De.from(i.node(v).copy(d));let f=i.indexAfter(-1)<i.node(-2).childCount?1:i.indexAfter(-2)<i.node(-3).childCount?2:3;d=d.append(De.from(t.createAndFill()));let p=i.before(i.depth-(h-1)),g=n.tr.replace(p,i.after(-f),new We(d,4-h,0)),y=-1;g.doc.nodesBetween(p,g.doc.content.size,(v,b)=>{if(y>-1)return!1;v.isTextblock&&v.content.size==0&&(y=b+1)}),y>-1&&g.setSelection(jt.near(g.doc.resolve(y))),r(g.scrollIntoView())}return!0}let l=s.pos==i.end()?a.contentMatchAt(0).defaultType:null,c=n.tr.delete(i.pos,s.pos),u=l?[null,{type:l}]:void 0;return U_(c.doc,i.pos,2,u)?(r&&r(c.split(i.pos,2,u).scrollIntoView()),!0):!1}}function V1t(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?$1t(e,n,t,s):H1t(e,n,s):!0:!1}}function $1t(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new to(s-1,o,s,o,new We(De.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new n2e(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=XI(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return QI(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function H1t(t,e,n){let r=t.tr,i=n.parent;for(let f=n.end,p=n.endIndex-1,g=n.startIndex;p>g;p--)f-=i.child(p).nodeSize,r.delete(f-1,f+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?De.empty:De.from(i))))return!1;let d=s.pos,h=d+o.nodeSize;return r.step(new to(d-(a?1:0),h+(l?1:0),d+1,h-1,new We((a?De.empty:De.from(i.copy(De.empty))).append(l?De.empty:De.from(i.copy(De.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function U1t(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=De.from(c?t.create():null),d=new We(De.from(t.create(null,De.from(a.type.create(null,u)))),c?3:1,0),h=s.start,f=s.end;n(e.tr.step(new to(h-(c?3:1),f,h,f,d,1,!0)).scrollIntoView())}return!0}}function q1t(t){const e=new Map;if(!t||!t.type)throw new Error("mdast-util-definitions expected node");return C0(t,"definition",function(r){const i=Vie(r.identifier);i&&!e.get(i)&&e.set(i,r)}),n;function n(r){const i=Vie(r);return e.get(i)}}function Vie(t){return String(t||"").toUpperCase()}function W1t(){return function(t){const e=q1t(t);C0(t,function(n,r,i){if(n.type==="definition"&&i!==void 0&&typeof r=="number")return i.children.splice(r,1),[Cj,r];if(n.type==="imageReference"||n.type==="linkReference"){const s=e(n.identifier);if(s&&i&&typeof r=="number")return i.children[r]=n.type==="imageReference"?{type:"image",url:s.url,title:s.title,alt:n.alt}:{type:"link",url:s.url,title:s.title,children:n.children},[Cj,r]}})}}function wSe(t,e){var r;if(!(e.childCount>=1&&((r=e.lastChild)==null?void 0:r.type.name)==="hardbreak")){t.next(e.content);return}const n=[];e.content.forEach((i,s,o)=>{o!==e.childCount-1&&n.push(i)}),t.next(De.fromArray(n))}function xe(t,e){return Object.assign(t,{meta:{package:"@milkdown/preset-commonmark",...e}}),t}var tW=V3("emphasis");xe(tW,{displayName:"Attr<emphasis>",group:"Emphasis"});var I0=u2("emphasis",t=>({attrs:{marker:{default:t.get(G_).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>e==="italic"}],toDOM:e=>["em",t.get(tW.key)(e)],parseMarkdown:{match:e=>e.type==="emphasis",runner:(e,n,r)=>{e.openMark(r,{marker:n.marker}),e.next(n.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="emphasis",runner:(e,n)=>{e.withMark(n,"emphasis",void 0,{marker:n.attrs.marker})}}}));xe(I0.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"});xe(I0.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});var X3=bt("ToggleEmphasis",t=>()=>tR(I0.type(t)));xe(X3,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});var xSe=co(t=>P3(/(?:^|[^*])\*([^*]+)\*$/,I0.type(t),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:e,start:n})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:n+1}}));xe(xSe,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});var _Se=co(t=>P3(/\b_(?![_\s])(.*?[^_\s])_\b/,I0.type(t),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:e,start:n})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:n+1}}));xe(_Se,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});var nW=ka("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:t=>{const e=t.get(je);return()=>e.call(X3.key)}}});xe(nW.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"});xe(nW.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});var rW=V3("strong");xe(rW,{displayName:"Attr<strong>",group:"Strong"});var Ry=u2("strong",t=>({attrs:{marker:{default:t.get(G_).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:e=>e.style.fontWeight!="normal"&&null},{tag:"strong"},{style:"font-style",getAttrs:e=>e==="bold"},{style:"font-weight=400",clearMark:e=>e.type.name=="strong"},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM:e=>["strong",t.get(rW.key)(e)],parseMarkdown:{match:e=>e.type==="strong",runner:(e,n,r)=>{e.openMark(r,{marker:n.marker}),e.next(n.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="strong",runner:(e,n)=>{e.withMark(n,"strong",void 0,{marker:n.attrs.marker})}}}));xe(Ry.mark,{displayName:"MarkSchema<strong>",group:"Strong"});xe(Ry.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});var Q3=bt("ToggleStrong",t=>()=>tR(Ry.type(t)));xe(Q3,{displayName:"Command<toggleStrongCommand>",group:"Strong"});var SSe=co(t=>P3(new RegExp("(?<![\\w:/])(?:\\*\\*|__)([^*_]+?)(?:\\*\\*|__)(?![\\w/])$"),Ry.type(t),{getAttr:e=>({marker:e[0].startsWith("*")?"*":"_"})}));xe(SSe,{displayName:"InputRule<strong>",group:"Strong"});var iW=ka("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:t=>{const e=t.get(je);return()=>e.call(Q3.key)}}});xe(iW.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"});xe(iW.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});var sW=V3("inlineCode");xe(sW,{displayName:"Attr<inlineCode>",group:"InlineCode"});var Lc=u2("inlineCode",t=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:e=>["code",t.get(sW.key)(e)],parseMarkdown:{match:e=>e.type==="inlineCode",runner:(e,n,r)=>{e.openMark(r),e.addText(n.value),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="inlineCode",runner:(e,n,r)=>(e.withMark(n,"inlineCode",r.text||""),!0)}}));xe(Lc.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"});xe(Lc.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});var J3=bt("ToggleInlineCode",t=>()=>(e,n)=>{const{selection:r,tr:i}=e;if(r.empty)return!1;const{from:s,to:o}=r;return e.doc.rangeHasMark(s,o,Lc.type(t))?(n==null||n(i.removeMark(s,o,Lc.type(t))),!0):(Object.keys(e.schema.marks).filter(a=>a!==Lc.type.name).map(a=>e.schema.marks[a]).forEach(a=>{i.removeMark(s,o,a)}),n==null||n(i.addMark(s,o,Lc.type(t).create())),!0)});xe(J3,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});var kSe=co(t=>P3(/(?:`)([^`]+)(?:`)$/,Lc.type(t)));xe(kSe,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});var oW=ka("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:t=>{const e=t.get(je);return()=>e.call(J3.key)}}});xe(oW.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"});xe(oW.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});var aW=V3("link");xe(aW,{displayName:"Attr<link>",group:"Link"});var tl=u2("link",t=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw su(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:e=>["a",{...t.get(aW.key)(e),...e.attrs}],parseMarkdown:{match:e=>e.type==="link",runner:(e,n,r)=>{const i=n.url,s=n.title;e.openMark(r,{href:i,title:s}),e.next(n.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="link",runner:(e,n)=>{e.withMark(n,"link",void 0,{title:n.attrs.title,url:n.attrs.href})}}}));xe(tl.mark,{displayName:"MarkSchema<link>",group:"Link"});var CSe=bt("ToggleLink",t=>(e={})=>tR(tl.type(t),e));xe(CSe,{displayName:"Command<toggleLinkCommand>",group:"Link"});var ESe=bt("UpdateLink",t=>(e={})=>(n,r)=>{if(!r)return!1;let i,s=-1;const{selection:o}=n,{from:a,to:l}=o;if(n.doc.nodesBetween(a,a===l?l+1:l,(p,g)=>{if(tl.type(t).isInSet(p.marks))return i=p,s=g,!1}),!i)return!1;const c=i.marks.find(({type:p})=>p===tl.type(t));if(!c)return!1;const u=s,d=s+i.nodeSize,{tr:h}=n,f=tl.type(t).create({...c.attrs,...e});return f?(r(h.removeMark(u,d,c).addMark(u,d,f).setSelection(new mt(h.selection.$anchor)).scrollIntoView()),!0):!1});xe(ESe,{displayName:"Command<updateLinkCommand>",group:"Link"});var TSe=yq("doc",()=>({content:"block+",parseMarkdown:{match:({type:t})=>t==="root",runner:(t,e,n)=>{t.injectRoot(e,n)}},toMarkdown:{match:t=>t.type.name==="doc",runner:(t,e)=>{t.openNode("root"),t.next(e.content)}}}));xe(TSe,{displayName:"NodeSchema<doc>",group:"Doc"});function G1t(t){return qU(t,e=>{var n;return e.type==="html"&&["<br />","<br>","<br >","<br/>"].includes((n=e.value)==null?void 0:n.trim())},(e,n)=>{if(!n.length)return;const r=n[n.length-1];if(!r)return;const i=r.children.indexOf(e);i!==-1&&r.children.splice(i,1)},!0)}var ER=Nd("remark-preserve-empty-line",()=>()=>G1t);xe(ER.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"});xe(ER.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});var lW=ou("paragraph");xe(lW,{displayName:"Attr<paragraph>",group:"Paragraph"});var al=xi("paragraph",t=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:e=>["p",t.get(lW.key)(e),0],parseMarkdown:{match:e=>e.type==="paragraph",runner:(e,n,r)=>{e.openNode(r),n.children?e.next(n.children):e.addText(n.value||""),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="paragraph",runner:(e,n)=>{var i;const r=(i=t.get(cn).state)==null?void 0:i.doc.lastChild;e.openNode("paragraph"),(!n.content||n.content.size===0)&&n!==r&&K1t(t)?e.addNode("html",void 0,"<br />"):wSe(e,n),e.closeNode()}}}));function K1t(t){let e=!1;try{t.get(ER.id),e=!0}catch{e=!1}return e}xe(al.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"});xe(al.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});var cW=bt("TurnIntoText",t=>()=>fk(al.type(t)));xe(cW,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});var uW=ka("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:t=>{const e=t.get(je);return()=>e.call(cW.key)}}});xe(uW.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"});xe(uW.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});var Y1t=Array(6).fill(0).map((t,e)=>e+1);function Z1t(t){return t.textContent.toLowerCase().trim().replace(/\s+/g,"-")}var TR=xn(Z1t,"headingIdGenerator");xe(TR,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});var dW=ou("heading");xe(dW,{displayName:"Attr<heading>",group:"Heading"});var Co=xi("heading",t=>{const e=t.get(TR.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:Y1t.map(n=>({tag:`h${n}`,getAttrs:r=>{if(!(r instanceof HTMLElement))throw su(r);return{level:n,id:r.id}}})),toDOM:n=>[`h${n.attrs.level}`,{...t.get(dW.key)(n),id:n.attrs.id||e(n)},0],parseMarkdown:{match:({type:n})=>n==="heading",runner:(n,r,i)=>{const s=r.depth;n.openNode(i,{level:s}),n.next(r.children),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="heading",runner:(n,r)=>{n.openNode("heading",void 0,{depth:r.attrs.level}),wSe(n,r),n.closeNode()}}}});xe(Co.node,{displayName:"NodeSchema<heading>",group:"Heading"});xe(Co.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});var ASe=co(t=>iq(/^(?<hashes>#+)\s$/,Co.type(t),e=>{var s,o;const n=((o=(s=e.groups)==null?void 0:s.hashes)==null?void 0:o.length)||0,{$from:r}=t.get(cn).state.selection,i=r.node();if(i.type.name==="heading"){let a=Number(i.attrs.level)+Number(n);return a>6&&(a=6),{level:a}}return{level:n}}));xe(ASe,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});var yp=bt("WrapInHeading",t=>e=>(e??(e=1),e<1?fk(al.type(t)):fk(Co.type(t),{level:e})));xe(yp,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});var hW=bt("DowngradeHeading",t=>()=>(e,n,r)=>{const{$from:i}=e.selection,s=i.node();if(s.type!==Co.type(t)||!e.selection.empty||i.parentOffset!==0)return!1;const o=s.attrs.level-1;return o?(n==null||n(e.tr.setNodeMarkup(e.selection.$from.before(),void 0,{...s.attrs,level:o})),!0):fk(al.type(t))(e,n,r)});xe(hW,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});var fW=ka("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:t=>{const e=t.get(je);return()=>e.call(yp.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:t=>{const e=t.get(je);return()=>e.call(yp.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:t=>{const e=t.get(je);return()=>e.call(yp.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:t=>{const e=t.get(je);return()=>e.call(yp.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:t=>{const e=t.get(je);return()=>e.call(yp.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:t=>{const e=t.get(je);return()=>e.call(yp.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:t=>{const e=t.get(je);return()=>e.call(hW.key)}}});xe(fW.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"});xe(fW.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});var pW=ou("blockquote");xe(pW,{displayName:"Attr<blockquote>",group:"Blockquote"});var My=xi("blockquote",t=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:e=>["blockquote",t.get(pW.key)(e),0],parseMarkdown:{match:({type:e})=>e==="blockquote",runner:(e,n,r)=>{e.openNode(r).next(n.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="blockquote",runner:(e,n)=>{e.openNode("blockquote").next(n.content).closeNode()}}}));xe(My.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"});xe(My.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});var ISe=co(t=>rq(/^\s*>\s$/,My.type(t)));xe(ISe,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});var mW=bt("WrapInBlockquote",t=>()=>nq(My.type(t)));xe(mW,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});var gW=ka("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:t=>{const e=t.get(je);return()=>e.call(mW.key)}}});xe(gW.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"});xe(gW.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});var yW=ou("codeBlock",()=>({pre:{},code:{}}));xe(yW,{displayName:"Attr<codeBlock>",group:"CodeBlock"});var Jl=xi("code_block",t=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:"",validate:"string"}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{if(!(e instanceof HTMLElement))throw su(e);return{language:e.dataset.language}}}],toDOM:e=>{const n=t.get(yW.key)(e),r=e.attrs.language,i=r&&r.length>0?{"data-language":r}:void 0;return["pre",{...n.pre,...i},["code",n.code,0]]},parseMarkdown:{match:({type:e})=>e==="code",runner:(e,n,r)=>{const i=n.lang??"",s=n.value;e.openNode(r,{language:i}),s&&e.addText(s),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="code_block",runner:(e,n)=>{var r;e.addNode("code",void 0,((r=n.content.firstChild)==null?void 0:r.text)||"",{lang:n.attrs.language})}}}));xe(Jl.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"});xe(Jl.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});var RSe=co(t=>iq(/^```(?<language>[a-z]*)?[\s\n]$/,Jl.type(t),e=>{var n;return{language:((n=e.groups)==null?void 0:n.language)??""}}));xe(RSe,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});var vW=bt("CreateCodeBlock",t=>(e="")=>fk(Jl.type(t),{language:e}));xe(vW,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"});var X1t=bt("UpdateCodeBlockLanguage",()=>({pos:t,language:e}={pos:-1,language:""})=>(n,r)=>t>=0?(r==null||r(n.tr.setNodeAttribute(t,"language",e)),!0):!1);xe(X1t,{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});var bW=ka("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:t=>{const e=t.get(je);return()=>e.call(vW.key)}}});xe(bW.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"});xe(bW.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});var wW=ou("image");xe(wW,{displayName:"Attr<image>",group:"Image"});var Ny=xi("image",t=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:"",validate:"string"},alt:{default:"",validate:"string"},title:{default:"",validate:"string"}},parseDOM:[{tag:"img[src]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw su(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:e=>["img",{...t.get(wW.key)(e),...e.attrs}],parseMarkdown:{match:({type:e})=>e==="image",runner:(e,n,r)=>{const i=n.url,s=n.alt,o=n.title;e.addNode(r,{src:i,alt:s,title:o})}},toMarkdown:{match:e=>e.type.name==="image",runner:(e,n)=>{e.addNode("image",void 0,void 0,{title:n.attrs.title,url:n.attrs.src,alt:n.attrs.alt})}}}));xe(Ny.node,{displayName:"NodeSchema<image>",group:"Image"});xe(Ny.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});var MSe=bt("InsertImage",t=>(e={})=>(n,r)=>{if(!r)return!0;const{src:i="",alt:s="",title:o=""}=e,a=Ny.type(t).create({src:i,alt:s,title:o});return a&&r(n.tr.replaceSelectionWith(a).scrollIntoView()),!0});xe(MSe,{displayName:"Command<insertImageCommand>",group:"Image"});var NSe=bt("UpdateImage",t=>(e={})=>(n,r)=>{const i=Wdt(n.selection,Ny.type(t));if(!i)return!1;const{node:s,pos:o}=i,a={...s.attrs},{src:l,alt:c,title:u}=e;return l!==void 0&&(a.src=l),c!==void 0&&(a.alt=c),u!==void 0&&(a.title=u),r==null||r(n.tr.setNodeMarkup(o,void 0,a).scrollIntoView()),!0});xe(NSe,{displayName:"Command<updateImageCommand>",group:"Image"});var Q1t=co(t=>new Sa(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(e,n,r,i)=>{const[s,o,a="",l]=n;return s?e.tr.replaceWith(r,i,Ny.type(t).create({src:a,alt:o,title:l})):null}));xe(Q1t,{displayName:"InputRule<insertImageInputRule>",group:"Image"});var A8=ou("hardbreak",t=>({"data-type":"hardbreak","data-is-inline":t.attrs.isInline}));xe(A8,{displayName:"Attr<hardbreak>",group:"Hardbreak"});var w1=xi("hardbreak",t=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:e=>e.attrs.isInline?["span",t.get(A8.key)(e)," "]:["br",t.get(A8.key)(e)],parseMarkdown:{match:({type:e})=>e==="break",runner:(e,n,r)=>{var i;e.addNode(r,{isInline:!!((i=n.data)!=null&&i.isInline)})}},leafText:()=>`
|
||
`,toMarkdown:{match:e=>e.type.name==="hardbreak",runner:(e,n)=>{n.attrs.isInline?e.addNode("text",void 0,`
|
||
`):e.addNode("break")}}}));xe(w1.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"});xe(w1.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});var xW=bt("InsertHardbreak",t=>()=>(e,n)=>{var s;const{selection:r,tr:i}=e;if(!(r instanceof mt))return!1;if(r.empty){const o=r.$from.node();if(o.childCount>0&&((s=o.lastChild)==null?void 0:s.type.name)==="hardbreak")return n==null||n(i.replaceRangeWith(r.to-1,r.to,e.schema.node("paragraph")).setSelection(jt.near(i.doc.resolve(r.to))).scrollIntoView()),!0}return n==null||n(i.setMeta("hardbreak",!0).replaceSelectionWith(w1.type(t).create()).scrollIntoView()),!0});xe(xW,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});var _W=ka("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:t=>{const e=t.get(je);return()=>e.call(xW.key)}}});xe(_W.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"});xe(_W.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});var SW=ou("hr");xe(SW,{displayName:"Attr<hr>",group:"Hr"});var Oy=xi("hr",t=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:e=>["hr",t.get(SW.key)(e)],parseMarkdown:{match:({type:e})=>e==="thematicBreak",runner:(e,n,r)=>{e.addNode(r)}},toMarkdown:{match:e=>e.type.name==="hr",runner:e=>{e.addNode("thematicBreak")}}}));xe(Oy.node,{displayName:"NodeSchema<hr>",group:"Hr"});xe(Oy.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});var OSe=co(t=>new Sa(/^(?:---|___\s|\*\*\*\s)$/,(e,n,r,i)=>{const{tr:s}=e;return n[0]&&s.replaceWith(r-1,i,Oy.type(t).create()),s}));xe(OSe,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});var DSe=bt("InsertHr",t=>()=>(e,n)=>{if(!n)return!0;const r=al.node.type(t).create(),{tr:i,selection:s}=e,{from:o}=s,a=Oy.type(t).create();if(!a)return!0;const l=i.replaceSelectionWith(a).insert(o,r),c=jt.findFrom(l.doc.resolve(o),1,!0);return c&&n(l.setSelection(c).scrollIntoView()),!0});xe(DSe,{displayName:"Command<insertHrCommand>",group:"Hr"});var kW=ou("bulletList");xe(kW,{displayName:"Attr<bulletList>",group:"BulletList"});var R0=xi("bullet_list",t=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:e=>{if(!(e instanceof HTMLElement))throw su(e);return{spread:e.dataset.spread==="true"}}}],toDOM:e=>["ul",{...t.get(kW.key)(e),"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:n})=>e==="list"&&!n,runner:(e,n,r)=>{const i=n.spread!=null?`${n.spread}`:"false";e.openNode(r,{spread:i}).next(n.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="bullet_list",runner:(e,n)=>{e.openNode("list",void 0,{ordered:!1,spread:n.attrs.spread}).next(n.content).closeNode()}}}));xe(R0.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"});xe(R0.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});var PSe=co(t=>rq(/^\s*([-+*])\s$/,R0.type(t)));xe(PSe,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});var CW=bt("WrapInBulletList",t=>()=>nq(R0.type(t)));xe(CW,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});var EW=ka("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:t=>{const e=t.get(je);return()=>e.call(CW.key)}}});xe(EW.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"});xe(EW.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});var TW=ou("orderedList");xe(TW,{displayName:"Attr<orderedList>",group:"OrderedList"});var M0=xi("ordered_list",t=>({content:"listItem+",group:"block",attrs:{order:{default:1,validate:"number"},spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ol",getAttrs:e=>{if(!(e instanceof HTMLElement))throw su(e);return{spread:e.dataset.spread,order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:e=>["ol",{...t.get(TW.key)(e),...e.attrs.order===1?{}:{start:e.attrs.order},"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:n})=>e==="list"&&!!n,runner:(e,n,r)=>{const i=n.spread!=null?`${n.spread}`:"true";e.openNode(r,{spread:i,order:n.start??1}).next(n.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="ordered_list",runner:(e,n)=>{e.openNode("list",void 0,{ordered:!0,start:n.attrs.order??1,spread:n.attrs.spread==="true"}),e.next(n.content),e.closeNode()}}}));xe(M0.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"});xe(M0.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});var LSe=co(t=>rq(/^\s*(\d+)\.\s$/,M0.type(t),e=>({order:Number(e[1])}),(e,n)=>n.childCount+n.attrs.order===Number(e[1])));xe(LSe,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});var AW=bt("WrapInOrderedList",t=>()=>nq(M0.type(t)));xe(AW,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});var IW=ka("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:t=>{const e=t.get(je);return()=>e.call(AW.key)}}});xe(IW.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"});xe(IW.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});var RW=ou("listItem");xe(RW,{displayName:"Attr<listItem>",group:"ListItem"});var ac=xi("list_item",t=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"•",validate:"string"},listType:{default:"bullet",validate:"string"},spread:{default:!0,validate:"boolean"}},defining:!0,parseDOM:[{tag:"li",getAttrs:e=>{if(!(e instanceof HTMLElement))throw su(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:e.dataset.spread==="true"}}}],toDOM:e=>["li",{...t.get(RW.key)(e),"data-label":e.attrs.label,"data-list-type":e.attrs.listType,"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e})=>e==="listItem",runner:(e,n,r)=>{const i=n.label!=null?`${n.label}.`:"•",s=n.label!=null?"ordered":"bullet",o=n.spread!=null?`${n.spread}`:"true";e.openNode(r,{label:i,listType:s,spread:o}),e.next(n.children),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="list_item",runner:(e,n)=>{e.openNode("listItem",void 0,{spread:n.attrs.spread}),e.next(n.content),e.closeNode()}}}));xe(ac.node,{displayName:"NodeSchema<listItem>",group:"ListItem"});xe(ac.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});var MW=bt("SinkListItem",t=>()=>U1t(ac.type(t)));xe(MW,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});var NW=bt("LiftListItem",t=>()=>V1t(ac.type(t)));xe(NW,{displayName:"Command<liftListItemCommand>",group:"ListItem"});var OW=bt("SplitListItem",t=>()=>F1t(ac.type(t)));xe(OW,{displayName:"Command<splitListItemCommand>",group:"ListItem"});function J1t(t){return(e,n,r)=>{const{selection:i}=e;if(!(i instanceof mt))return!1;const{empty:s,$from:o}=i;return!s||o.parentOffset!==0||o.node(-1).type!==ac.type(t)?!1:R2e(e,n,r)}}var DW=bt("LiftFirstListItem",t=>()=>J1t(t));xe(DW,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});var PW=ka("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:t=>{const e=t.get(je);return()=>e.call(OW.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:t=>{const e=t.get(je);return()=>e.call(MW.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:t=>{const e=t.get(je);return()=>e.call(NW.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:t=>{const e=t.get(je);return()=>e.call(DW.key)}}});xe(PW.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"});xe(PW.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});var zSe=yq("text",()=>({group:"inline",parseMarkdown:{match:({type:t})=>t==="text",runner:(t,e)=>{t.addText(e.value)}},toMarkdown:{match:t=>t.type.name==="text",runner:(t,e)=>{t.addNode("text",void 0,e.text)}}}));xe(zSe,{displayName:"NodeSchema<text>",group:"Text"});var LW=ou("html");xe(LW,{displayName:"Attr<html>",group:"Html"});var zW=xi("html",t=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:e=>{const n=document.createElement("span"),r={...t.get(LW.key)(e),"data-value":e.attrs.value,"data-type":"html"};return n.textContent=e.attrs.value,["span",r,e.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:e=>({value:e.dataset.value??""})}],parseMarkdown:{match:({type:e})=>e==="html",runner:(e,n,r)=>{e.addNode(r,{value:n.value})}},toMarkdown:{match:e=>e.type.name==="html",runner:(e,n)=>{e.addNode("html",void 0,n.attrs.value)}}}));xe(zW.node,{displayName:"NodeSchema<html>",group:"Html"});xe(zW.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});var eyt=[TSe,lW,al,TR,dW,Co,A8,w1,pW,My,yW,Jl,SW,Oy,wW,Ny,kW,R0,TW,M0,RW,ac,tW,I0,rW,Ry,sW,Lc,aW,tl,LW,zW,zSe].flat(),tyt=[ISe,PSe,LSe,RSe,OSe,ASe].flat(),nyt=[xSe,_Se,kSe,SSe],wg=bt("IsMarkSelected",()=>t=>e=>{if(!t)return!1;const{doc:n,selection:r}=e;return n.rangeHasMark(r.from,r.to,t)}),jSe=bt("IsNoteSelected",()=>t=>e=>t?W2e(e,t).hasNode:!1),vs=bt("ClearTextInCurrentBlock",()=>()=>(t,e)=>{let n=t.tr;const{$from:r,$to:i}=n.selection,{pos:s}=r,{pos:o}=i,a=s-r.node().content.size;return a<0?!1:(n=n.deleteRange(a,o),e==null||e(n),!0)}),Sl=bt("SetBlockType",()=>t=>(e,n)=>{const{nodeType:r,attrs:i=null}=t??{};if(!r)return!1;const s=e.tr,{from:o,to:a}=s.selection;try{s.setBlockType(o,a,r,i)}catch{return!1}return n==null||n(s),!0}),Dh=bt("WrapInBlockType",()=>t=>(e,n)=>{const{nodeType:r,attrs:i=null}=t??{};if(!r)return!1;let s=e.tr;try{const{$from:o,$to:a}=s.selection,l=o.blockRange(a),c=l&&XU(l,r,i);if(!c)return!1;s=s.wrap(l,c)}catch{return!1}return n==null||n(s),!0}),Ph=bt("AddBlockType",()=>t=>(e,n)=>{const{nodeType:r,attrs:i=null}=t??{};if(!r)return!1;const s=e.tr;try{const o=r instanceof Hh?r:r.createAndFill(i);if(!o)return!1;s.replaceSelectionWith(o)}catch{return!1}return n==null||n(s),!0}),jW=bt("SelectTextNearPos",()=>t=>(e,n)=>{const{pos:r}=t??{};if(r==null)return!1;const i=(o,a,l)=>Math.min(Math.max(o,a),l),s=e.tr;try{const o=e.doc.resolve(i(r,0,e.doc.content.size));s.setSelection(mt.near(o))}catch{return!1}return n==null||n(s.scrollIntoView()),!0}),ryt=[cW,mW,yp,hW,vW,xW,DSe,MSe,NSe,AW,CW,MW,OW,NW,DW,X3,J3,Q3,CSe,ESe,wg,jSe,vs,Sl,Dh,Ph,jW],iyt=[gW,bW,_W,fW,PW,IW,EW,uW,nW,oW,iW].flat(),BW=Nd("remarkAddOrderInList",()=>()=>t=>{C0(t,"list",e=>{if(e.ordered){const n=e.start??1;e.children.forEach((r,i)=>{r.label=i+n})}})});xe(BW.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"});xe(BW.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});var FW=Nd("remarkLineBreak",()=>()=>t=>{const e=/[\t ]*(?:\r?\n|\r)/g;C0(t,"text",(n,r,i)=>{if(!n.value||typeof n.value!="string")return;const s=[];let o=0;e.lastIndex=0;let a=e.exec(n.value);for(;a;){const l=a.index;o!==l&&s.push({type:"text",value:n.value.slice(o,l)}),s.push({type:"break",data:{isInline:!0}}),o=l+a[0].length,a=e.exec(n.value)}if(s.length>0&&i&&typeof r=="number")return o<n.value.length&&s.push({type:"text",value:n.value.slice(o)}),i.children.splice(r,1,...s),r+s.length})});xe(FW.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"});xe(FW.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});var VW=Nd("remarkInlineLink",()=>W1t);xe(VW.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"});xe(VW.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});var syt=t=>!!t.children,oyt=t=>t.type==="html";function ayt(t,e){return n(t,0,null)[0];function n(r,i,s){if(syt(r)){const o=[];for(let a=0,l=r.children.length;a<l;a++){const c=r.children[a];if(c){const u=n(c,a,r);if(u)for(let d=0,h=u.length;d<h;d++){const f=u[d];f&&o.push(f)}}}r.children=o}return e(r,i,s)}}var lyt=["root","blockquote","listItem"],$W=Nd("remarkHTMLTransformer",()=>()=>t=>{ayt(t,(e,n,r)=>oyt(e)?(r&&lyt.includes(r.type)&&(e.children=[{...e}],delete e.value,e.type="paragraph"),[e]):[e])});xe($W.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"});xe($W.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});var HW=Nd("remarkMarker",()=>()=>(t,e)=>{const n=r=>e.value.charAt(r.position.start.offset);C0(t,r=>["strong","emphasis"].includes(r.type),r=>{r.marker=n(r)})});xe(HW.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"});xe(HW.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});var BSe=Sr(()=>{let t=!1;const e=new Fn({key:new Vn("MILKDOWN_INLINE_NODES_CURSOR"),state:{init(){return!1},apply(n){if(!n.selection.empty)return!1;const r=n.selection.$from,i=r.nodeBefore,s=r.nodeAfter;return!!(i&&s&&i.isInline&&!i.isText&&s.isInline&&!s.isText)}},props:{handleDOMEvents:{compositionend:(n,r)=>t?(t=!1,requestAnimationFrame(()=>{if(e.getState(n.state)){const i=n.state.selection.from;r.preventDefault(),n.dispatch(n.state.tr.insertText(r.data||"",i))}}),!0):!1,compositionstart:n=>(e.getState(n.state)&&(t=!0),!1),beforeinput:(n,r)=>{if(e.getState(n.state)&&r instanceof InputEvent&&r.data&&!t){const i=n.state.selection.from;return r.preventDefault(),n.dispatch(n.state.tr.insertText(r.data||"",i)),!0}return!1}},decorations(n){if(e.getState(n)){const r=n.selection.$from.pos,i=document.createElement("span"),s=sr.widget(r,i,{side:-1}),o=document.createElement("span"),a=sr.widget(r,o);return setTimeout(()=>{i.contentEditable="true",o.contentEditable="true"}),En.create(n.doc,[s,a])}return En.empty}}});return e});xe(BSe,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});var FSe=Sr(t=>new Fn({key:new Vn("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(e,n,r)=>{if(!e.length)return;const[i]=e;if(!i)return;const[s]=i.steps;if(i.getMeta("hardbreak")){if(!(s instanceof li))return;const{from:o}=s;return r.tr.setNodeMarkup(o,w1.type(t),void 0,[])}if(s instanceof Mh){let o=r.tr;const{from:a,to:l}=s;return r.doc.nodesBetween(a,l,(c,u)=>{c.type===w1.type(t)&&(o=o.setNodeMarkup(u,w1.type(t),void 0,[]))}),o}}}));xe(FSe,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});var UW=xn(["table","code_block"],"hardbreakFilterNodes");xe(UW,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});var VSe=Sr(t=>{const e=t.get(UW.key);return new Fn({key:new Vn("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(n,r)=>{const i=n.getMeta("hardbreak"),[s]=n.steps;if(i&&s){const{from:o}=s,a=r.doc.resolve(o);let l=a.depth,c=!0;for(;l>0;)e.includes(a.node(l).type.name)&&(c=!1),l--;return c}return!0}})});xe(VSe,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});var $Se=Sr(t=>{const e=new Vn("MILKDOWN_HEADING_ID"),n=r=>{if(r.composing)return;const i=t.get(TR.key),s=r.state.tr.setMeta("addToHistory",!1);let o=!1;const a={};r.state.doc.descendants((l,c)=>{if(l.type===Co.type(t)){if(l.textContent.trim().length===0)return;const u=l.attrs;let d=i(l);a[d]?(a[d]+=1,d+=`-#${a[d]}`):a[d]=1,u.id!==d&&(o=!0,s.setMeta(e,!0).setNodeMarkup(c,void 0,{...u,id:d}))}}),o&&r.dispatch(s)};return new Fn({key:e,view:r=>(n(r),{update:(i,s)=>{i.state.doc.eq(s.doc)||n(i)}})})});xe($Se,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});var HSe=Sr(t=>{const e=(n,r,i)=>{if(!i.selection||n.some(d=>d.getMeta("addToHistory")===!1||!d.isGeneric))return null;const s=M0.type(t),o=R0.type(t),a=ac.type(t),l=(d,h,f=1)=>{let p=!1;const g=`${h+f}.`;return d.label!==g&&(d.label=g,p=!0),p};let c=i.tr,u=!1;return i.doc.descendants((d,h,f,p)=>{if(d.type===o){const g=d.maybeChild(0);(g==null?void 0:g.type)===a&&g.attrs.listType==="ordered"&&(u=!0,c.setNodeMarkup(h,s,{spread:"true"}),d.descendants((y,v,b,_)=>{if(y.type===a){const S={...y.attrs};l(S,_)&&(c=c.setNodeMarkup(v,void 0,S))}return!1}))}else if(d.type===a&&(f==null?void 0:f.type)===s){const g={...d.attrs};let y=!1;g.listType!=="ordered"&&(g.listType="ordered",y=!0),f!=null&&f.maybeChild(0)&&(y=l(g,p,(f==null?void 0:f.attrs.order)??1)),y&&(c=c.setNodeMarkup(h,void 0,g),u=!0)}}),u?c.setMeta("addToHistory",!1):null};return new Fn({key:new Vn("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:e})});xe(HSe,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});var cyt=[FSe,UW,VSe,BSe,BW,VW,FW,$W,HW,ER,$Se,HSe].flat(),uyt=[eyt,tyt,nyt,ryt,iyt,cyt].flat();function dyt(t){const e=xn({},`${t}_SLASH_SPEC`),n=Sr(i=>{const s=i.get(e.key);return new Fn({key:new Vn(`${t}_SLASH`),...s})}),r=[e,n];return r.key=e.key,r.pluginKey=n.key,e.meta={package:"@milkdown/plugin-slash",displayName:`Ctx<slashSpec>|${t}`},n.meta={package:"@milkdown/plugin-slash",displayName:`Prose<slash>|${t}`},r}var Cw,R5,M5,N5,O5,n1,D5,Ew,P5,L5,z5,Jle,hyt=(Jle=class{constructor(t){te(this,Cw);te(this,R5);te(this,M5);te(this,N5);te(this,O5);te(this,n1);te(this,D5);te(this,Ew);te(this,P5);te(this,L5);te(this,z5);W(this,Cw,!1),this.onShow=()=>{},this.onHide=()=>{},W(this,L5,(e,n)=>{const{state:r,composing:i}=e,{selection:s,doc:o}=r,{ranges:a}=s,l=Math.min(...a.map(d=>d.$from.pos)),c=Math.max(...a.map(d=>d.$to.pos)),u=n&&n.doc.eq(o)&&n.selection.eq(s);if(O(this,Cw)||((O(this,N5)??e.dom.parentElement??document.body).appendChild(this.element),W(this,Cw,!0)),!(i||u)){if(!O(this,D5).call(this,e,n)){this.hide();return}_d({getBoundingClientRect:()=>L3(e,l,c)},this.element,{placement:"bottom-start",middleware:[Iq(),ly(O(this,P5)),...O(this,R5)],...O(this,M5)}).then(({x:d,y:h})=>{Object.assign(this.element.style,{left:`${d}px`,top:`${h}px`})}).catch(console.error),this.show()}}),W(this,z5,e=>{const n=this.getContent(e);if(!n)return!1;const r=n.at(-1);return r?Array.isArray(O(this,n1))?O(this,n1).includes(r):O(this,n1)===r:!1}),this.update=(e,n)=>{O(this,Ew).call(this,e,n)},this.getContent=(e,n=r=>r.type.name==="paragraph")=>{const{selection:r}=e.state,{empty:i,$from:s}=r,o=e.state.selection instanceof mt;if(typeof document>"u")return;const a=this.element.contains(document.activeElement),l=!e.hasFocus()&&!a,c=!e.editable,u=!qdt(n)(e.state.selection);if(!(l||c||!i||!o||u))return s.parent.textBetween(Math.max(0,s.parentOffset-500),s.parentOffset,void 0,"")},this.destroy=()=>{O(this,Ew).cancel()},this.show=()=>{this.element.dataset.show="true",this.onShow()},this.hide=()=>{this.element.dataset.show="false",this.onHide()},this.element=t.content,W(this,O5,t.debounce??200),W(this,D5,t.shouldShow??O(this,z5)),W(this,n1,t.trigger??"/"),W(this,P5,t.offset),W(this,R5,t.middleware??[]),W(this,M5,t.floatingUIOptions??{}),W(this,N5,t.root),W(this,Ew,DI(O(this,L5),O(this,O5)))}},Cw=new WeakMap,R5=new WeakMap,M5=new WeakMap,N5=new WeakMap,O5=new WeakMap,n1=new WeakMap,D5=new WeakMap,Ew=new WeakMap,P5=new WeakMap,L5=new WeakMap,z5=new WeakMap,Jle),fyt=Object.defineProperty,$ie=Object.getOwnPropertySymbols,pyt=Object.prototype.hasOwnProperty,myt=Object.prototype.propertyIsEnumerable,Hie=(t,e,n)=>e in t?fyt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,gyt=(t,e)=>{for(var n in e||(e={}))pyt.call(e,n)&&Hie(t,n,e[n]);if($ie)for(var n of $ie(e))myt.call(e,n)&&Hie(t,n,e[n]);return t};function eC(t,e){return Object.assign(t,{meta:gyt({package:"@milkdown/components"},e)}),t}const yyt={imageIcon:"🌌",captionIcon:"💬",uploadButton:"Upload file",confirmButton:"Confirm ⏎",uploadPlaceholderText:"or paste the image link ...",captionPlaceholderText:"Image caption",onUpload:t=>Promise.resolve(URL.createObjectURL(t))},tC=xn(yyt,"imageBlockConfigCtx");eC(tC,{displayName:"Config<image-block>",group:"ImageBlock"});function vyt(t){return C0(t,"paragraph",(e,n,r)=>{var i,s;if(((i=e.children)==null?void 0:i.length)!==1)return;const o=(s=e.children)==null?void 0:s[0];if(!o||o.type!=="image")return;const{url:a,alt:l,title:c}=o,u={type:"image-block",url:a,alt:l,title:c};r.children.splice(n,1,u)})}const qW=Nd("remark-image-block",()=>()=>vyt);eC(qW.plugin,{displayName:"Remark<remarkImageBlock>",group:"ImageBlock"});eC(qW.options,{displayName:"RemarkConfig<remarkImageBlock>",group:"ImageBlock"});var byt=Object.defineProperty,Uie=Object.getOwnPropertySymbols,wyt=Object.prototype.hasOwnProperty,xyt=Object.prototype.propertyIsEnumerable,qie=(t,e,n)=>e in t?byt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_yt=(t,e)=>{for(var n in e||(e={}))wyt.call(e,n)&&qie(t,n,e[n]);if(Uie)for(var n of Uie(e))xyt.call(e,n)&&qie(t,n,e[n]);return t};const vB="image-block",nC=xi("image-block",()=>({inline:!1,group:"block",selectable:!0,draggable:!0,isolating:!0,marks:"",atom:!0,priority:100,attrs:{src:{default:"",validate:"string"},caption:{default:"",validate:"string"},ratio:{default:1,validate:"number"}},parseDOM:[{tag:`img[data-type="${vB}"]`,getAttrs:t=>{var e;if(!(t instanceof HTMLElement))throw su(t);return{src:t.getAttribute("src")||"",caption:t.getAttribute("caption")||"",ratio:Number((e=t.getAttribute("ratio"))!=null?e:1)}}}],toDOM:t=>["img",_yt({"data-type":vB},t.attrs)],parseMarkdown:{match:({type:t})=>t==="image-block",runner:(t,e,n)=>{const r=e.url,i=e.title;let s=Number(e.alt||1);(Number.isNaN(s)||s===0)&&(s=1),t.addNode(n,{src:r,caption:i,ratio:s})}},toMarkdown:{match:t=>t.type.name==="image-block",runner:(t,e)=>{t.openNode("paragraph"),t.addNode("image",void 0,void 0,{title:e.attrs.caption,url:e.attrs.src,alt:`${Number.parseFloat(e.attrs.ratio).toFixed(2)}`}),t.closeNode()}}}));eC(nC.node,{displayName:"NodeSchema<image-block>",group:"ImageBlock"});function AR(...t){}AR(X);function lS({icon:t,class:e,onClick:n}){return X("span",{class:ji("milkdown-icon",e),onPointerdown:n,innerHTML:t?dl.sanitize(t.trim()):void 0})}lS.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};AR(X);const Syt=gq("abcdefg",8),kyt=es({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0},onImageLoadError:{type:Function,required:!1}},setup({readonly:t,src:e,setLink:n,onUpload:r,imageIcon:i,uploadButton:s,confirmButton:o,uploadPlaceholderText:a,className:l,onImageLoadError:c}){var u,d;const h=nt(!1),f=nt(),p=nt((u=e.value)!=null?u:""),g=nt(Syt()),y=nt(((d=e.value)==null?void 0:d.length)!==0),v=k=>{const E=k.target.value;y.value=E.length!==0,p.value=E},b=k=>{var T,E;k.key==="Enter"&&n((E=(T=f.value)==null?void 0:T.value)!=null?E:"")},_=()=>{var k,T;n((T=(k=f.value)==null?void 0:k.value)!=null?T:"")},S=k=>{var T;const E=(T=k.target.files)==null?void 0:T[0];E&&r(E).then(C=>{C&&(n(C),y.value=!0)}).catch(C=>{console.error("An error occurred while uploading image"),console.error(C)})};return()=>X("div",{class:ji("image-edit",l)},X(lS,{icon:i,class:"image-icon"}),X("div",{class:ji("link-importer",h.value&&"focus")},X("input",{ref:f,draggable:"true",onDragstart:k=>{k.preventDefault(),k.stopPropagation()},disabled:t.value,class:"link-input-area",value:p.value,onInput:v,onKeydown:b,onFocus:()=>h.value=!0,onBlur:()=>h.value=!1}),!y.value&&X("div",{class:"placeholder"},X("input",{disabled:t.value,class:"hidden",id:g.value,type:"file",accept:"image/*",onChange:S}),X("label",{class:"uploader",for:g.value},X(lS,{icon:s})),X("span",{class:"text",onClick:()=>{var k;return(k=f.value)==null?void 0:k.focus()}},a))),p.value&&X(Fragment,null,X("div",{class:"image-preview"},X("img",{src:p.value,alt:"",onError:k=>Promise.resolve(c==null?void 0:c(k)).catch(()=>{})})),X("div",{class:"confirm",onClick:()=>_()},X(lS,{icon:o}))))}});AR(X,mr);const Cyt=es({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup({src:t,caption:e,ratio:n,readonly:r,setAttr:i,config:s}){var o;const a=nt(),l=nt(),c=nt(!!((o=e.value)!=null&&o.length)),u=nt(0),d=()=>{var b;const _=a.value;if(!_)return;const S=_.closest(".milkdown-image-block");if(!S)return;let k=S.getBoundingClientRect().width;if(!k)return;s.maxWidth&&s.maxWidth<k&&(k=s.maxWidth);const T=_.naturalHeight,E=_.naturalWidth;let C=E<k?T:k*(T/E);s.maxHeight&&C>s.maxHeight&&(C=s.maxHeight);const R=(C*((b=n.value)!=null?b:1)).toFixed(2);_.dataset.origin=C.toFixed(2),_.dataset.height=R,_.style.height=`${R}px`,s.maxWidth&&(_.style.maxWidth=`${s.maxWidth}px`)},h=b=>{b.preventDefault(),b.stopPropagation(),!r.value&&(c.value=!c.value)},f=b=>{const S=b.target.value;u.value&&window.clearTimeout(u.value),u.value=window.setTimeout(()=>{i("caption",S)},1e3)},p=b=>{const S=b.target.value;u.value&&(window.clearTimeout(u.value),u.value=0),i("caption",S)},g=b=>{b.preventDefault();const _=a.value;if(!_)return;const S=_.getBoundingClientRect().top;let k=b.clientY-S;k<100&&(k=100),s.maxHeight&&k>s.maxHeight&&(k=s.maxHeight);const T=Number(k).toFixed(2);_.dataset.height=T,_.style.height=`${T}px`},y=()=>{window.removeEventListener("pointermove",g),window.removeEventListener("pointerup",y);const b=a.value;if(!b)return;const _=Number(b.dataset.origin),S=Number(b.dataset.height),k=Number.parseFloat(Number(S/_).toFixed(2));Number.isNaN(k)||i("ratio",k)},v=b=>{r.value||(b.preventDefault(),b.stopPropagation(),window.addEventListener("pointermove",g),window.addEventListener("pointerup",y))};return()=>X(mr,null,X("div",{class:"image-wrapper"},X("div",{class:"operation"},X("div",{class:"operation-item",onPointerdown:h},X(lS,{icon:s.captionIcon}))),X("img",{ref:a,"data-type":vB,onLoad:d,src:t.value,alt:e.value,onError:b=>{var _;return Promise.resolve((_=s.onImageLoadError)==null?void 0:_.call(s,b)).catch(()=>{})}}),X("div",{ref:l,class:"image-resize-handle",onPointerdown:v})),c.value&&X("input",{draggable:"true",onDragstart:b=>{b.preventDefault(),b.stopPropagation()},class:"caption-input",placeholder:s==null?void 0:s.captionPlaceholderText,onInput:f,onBlur:p,value:e.value}))}});var Eyt=Object.defineProperty,Wie=Object.getOwnPropertySymbols,Tyt=Object.prototype.hasOwnProperty,Ayt=Object.prototype.propertyIsEnumerable,Gie=(t,e,n)=>e in t?Eyt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Iyt=(t,e)=>{for(var n in e||(e={}))Tyt.call(e,n)&&Gie(t,n,e[n]);if(Wie)for(var n of Wie(e))Ayt.call(e,n)&&Gie(t,n,e[n]);return t};AR(X,mr);const Ryt=es({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(t){const{src:e}=t;return()=>{var n;return(n=e.value)!=null&&n.length?X(Cyt,Iyt({},t)):X(kyt,{src:t.src,selected:t.selected,readonly:t.readonly,setLink:r=>t.setAttr("src",r),imageIcon:t.config.imageIcon,uploadButton:t.config.uploadButton,confirmButton:t.config.confirmButton,uploadPlaceholderText:t.config.uploadPlaceholderText,onUpload:t.config.onUpload,onImageLoadError:t.config.onImageLoadError})}}}),USe=F3(nC.node,t=>(e,n,r)=>{const i=nt(e.attrs.src),s=nt(e.attrs.caption),o=nt(e.attrs.ratio),a=nt(!1),l=nt(!n.editable),c=(y,v)=>{if(!n.editable)return;const b=r();b!=null&&n.dispatch(n.state.tr.setNodeAttribute(b,y,y==="src"?dl.sanitize(v):v))},u=t.get(tC.key),d=hl(Ryt,{src:i,caption:s,ratio:o,selected:a,readonly:l,setAttr:c,config:u}),h=document.createElement("div");h.className="milkdown-image-block";const f=p2(()=>{a.value?h.classList.add("selected"):h.classList.remove("selected")}),p=u.proxyDomURL,g=y=>{if(!p)i.value=y.attrs.src;else{const v=p(y.attrs.src);typeof v=="string"?i.value=v:v.then(b=>{i.value=b}).catch(console.error)}o.value=y.attrs.ratio,s.value=y.attrs.caption,l.value=!n.editable};return g(e),d.mount(h),{dom:h,update:y=>y.type!==e.type?!1:(g(y),!0),stopEvent:y=>y.target instanceof HTMLInputElement,selectNode:()=>{a.value=!0},deselectNode:()=>{a.value=!1},destroy:()=>{f(),d.unmount(),h.remove()}}});eC(USe,{displayName:"NodeView<image-block>",group:"ImageBlock"});const Myt=[qW,nC,USe,tC].flat();let bB,wB;if(typeof WeakMap<"u"){let t=new WeakMap;bB=e=>t.get(e),wB=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;bB=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},wB=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Xn=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,o=i+1;for(let a=1;s<this.width&&this.map[e+a]==n;a++)s++;for(let a=1;o<this.height&&this.map[e+this.width*a]==n;a++)o++;return{left:r,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:s,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:o==this.height)?null:this.map[r+this.width*(n<0?s-1:o)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:o,right:a,top:l,bottom:c}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(i,l),right:Math.max(r,a),bottom:Math.max(s,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,o=this.map[s];n[o]||(n[o]=!0,!(i==t.left&&i&&this.map[s-1]==o||r==t.top&&r&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let o=e+t*this.width;const a=(t+1)*this.width;for(;o<a&&this.map[o]<i;)o++;return o==a?s-1:this.map[o]}i=s}}static get(t){return bB(t)||wB(t,Nyt(t))}};function Nyt(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=Oyt(t),n=t.childCount,r=[];let i=0,s=null;const o=[];for(let c=0,u=e*n;c<u;c++)r[c]=0;for(let c=0,u=0;c<n;c++){const d=t.child(c);u++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==d.childCount)break;const g=d.child(p),{colspan:y,rowspan:v,colwidth:b}=g.attrs;for(let _=0;_<v;_++){if(_+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:v-_});break}const S=i+_*e;for(let k=0;k<y;k++){r[S+k]==0?r[S+k]=u:(s||(s=[])).push({type:"collision",row:c,pos:u,n:y-k});const T=b&&b[k];if(T){const E=(S+k)%e*2,C=o[E];C==null||C!=T&&o[E+1]==1?(o[E]=T,o[E+1]=1):C==T&&o[E+1]++}}}i+=y,u+=g.nodeSize}const h=(c+1)*e;let f=0;for(;i<h;)r[i++]==0&&f++;f&&(s||(s=[])).push({type:"missing",row:c,n:f}),u++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const a=new Xn(e,n,r,s);let l=!1;for(let c=0;!l&&c<o.length;c+=2)o[c]!=null&&o[c+1]<n&&(l=!0);return l&&Dyt(a,o,t),a}function Oyt(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let o=0;o<r;o++){const a=t.child(o);for(let l=0;l<a.childCount;l++){const c=a.child(l);o+c.attrs.rowspan>r&&(s+=c.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const a=i.child(o);s+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function Dyt(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const o=n.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let a=null;const l=o.attrs;for(let c=0;c<l.colspan;c++){const u=e[(i+c)%t.width*2];u!=null&&(!l.colwidth||l.colwidth[c]!=u)&&((a||(a=Pyt(l)))[c]=u)}a&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:a})}}function Pyt(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Kie(t,e){if(typeof t=="string")return{};const n=t.getAttribute("data-colwidth"),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(",").map(o=>Number(o)):null,i=Number(t.getAttribute("colspan")||1),s={colspan:i,rowspan:Number(t.getAttribute("rowspan")||1),colwidth:r&&r.length==i?r:null};for(const o in e){const a=e[o].getFromDOM,l=a&&a(t);l!=null&&(s[o]=l)}return s}function Yie(t,e){const n={};t.attrs.colspan!=1&&(n.colspan=t.attrs.colspan),t.attrs.rowspan!=1&&(n.rowspan=t.attrs.rowspan),t.attrs.colwidth&&(n["data-colwidth"]=t.attrs.colwidth.join(","));for(const r in e){const i=e[r].setDOMAttr;i&&i(t.attrs[r],n)}return n}function Lyt(t){if(t!==null){if(!Array.isArray(t))throw new TypeError("colwidth must be null or an array");for(const e of t)if(typeof e!="number")throw new TypeError("colwidth must be null or an array of numbers")}}function zyt(t){const e=t.cellAttributes||{},n={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:Lyt}};for(const r in e)n[r]={default:e[r].default,validate:e[r].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:t.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:t.cellContent,attrs:n,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:r=>Kie(r,e)}],toDOM(r){return["td",Yie(r,e),0]}},table_header:{content:t.cellContent,attrs:n,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:r=>Kie(r,e)}],toDOM(r){return["th",Yie(r,e),0]}}}}function ec(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const Rp=new Vn("selectingCells");function mx(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function lc(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function IR(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=mx(e.$head)||jyt(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function jyt(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function xB(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Byt(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function WW(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function qSe(t,e,n){const r=t.node(-1),i=Xn.get(r),s=t.start(-1),o=i.nextCell(t.pos-s,e,n);return o==null?null:t.node(0).resolve(s+o)}function uy(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function Fyt(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function Vyt(t,e,n){const r=ec(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var xr=class nh extends jt{constructor(e,n=e){const r=e.node(-1),i=Xn.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,n.pos-s),a=e.node(0),l=i.cellsInRect(o).filter(u=>u!=n.pos-s);l.unshift(n.pos-s);const c=l.map(u=>{const d=r.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);const h=s+u+1;return new E2e(a.resolve(h),a.resolve(h+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(xB(r)&&xB(i)&&WW(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?nh.rowSelection(r,i):s&&this.isColSelection()?nh.colSelection(r,i):new nh(r,i)}return mt.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Xn.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let l=i.top;l<i.bottom;l++){const c=[];for(let u=l*n.width+i.left,d=i.left;d<i.right;d++,u++){const h=n.map[u];if(s[h])continue;s[h]=!0;const f=n.findCell(h);let p=e.nodeAt(h);if(!p)throw new RangeError(`No cell with offset ${h} found`);const g=i.left-f.left,y=f.right-i.right;if(g>0||y>0){let v=p.attrs;if(g>0&&(v=uy(v,0,g)),y>0&&(v=uy(v,v.colspan-y,y)),f.left<i.left){if(p=p.type.createAndFill(v),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(v)}`)}else p=p.type.create(v,p.content)}if(f.top<i.top||f.bottom>i.bottom){const v={...p.attrs,rowspan:Math.min(f.bottom,i.bottom)-Math.max(f.top,i.top)};f.top<i.top?p=p.type.createAndFill(v):p=p.type.create(v,p.content)}c.push(p)}o.push(e.child(l).copy(De.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?e:o;return new We(De.from(a),1,1)}replace(e,n=We.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:a,$to:l}=i[o],c=e.mapping.slice(r);e.replace(c.map(a.pos),c.map(l.pos),o?We.empty:n)}const s=jt.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new We(De.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Xn.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(n.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=Xn.get(r),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(n.pos-s),l=e.node(0);return o.top<=a.top?(o.top>0&&(e=l.resolve(s+i.map[o.left])),a.bottom<i.height&&(n=l.resolve(s+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(s+i.map[a.left])),o.bottom<i.height&&(e=l.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new nh(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Xn.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,a=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,a)==n.width}eq(e){return e instanceof nh&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=Xn.get(r),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(n.pos-s),l=e.node(0);return o.left<=a.left?(o.left>0&&(e=l.resolve(s+i.map[o.top*i.width])),a.right<i.width&&(n=l.resolve(s+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(s+i.map[a.top*i.width])),o.right<i.width&&(e=l.resolve(s+i.map[i.width*(o.top+1)-1]))),new nh(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new nh(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new nh(e.resolve(n),e.resolve(r))}getBookmark(){return new $yt(this.$anchorCell.pos,this.$headCell.pos)}};xr.prototype.visible=!1;jt.jsonID("cell",xr);var $yt=class WSe{constructor(e,n){this.anchor=e,this.head=n}map(e){return new WSe(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&WW(n,r)?new xr(n,r):jt.near(r,1)}};function Hyt(t){if(!(t.selection instanceof xr))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(sr.node(r,r+n.nodeSize,{class:"selectedCell"}))}),En.create(t.doc,e)}function Uyt({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function qyt({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function Wyt(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,o;if(r instanceof Et&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=xr.create(i,r.from);else if(o=="row"){const a=i.resolve(r.from+1);s=xr.rowSelection(a,a)}else if(!n){const a=Xn.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];s=xr.create(i,l+1,c)}}else r instanceof mt&&Uyt(r)?s=mt.create(i,r.from):r instanceof mt&&qyt(r)&&(s=mt.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const Gyt=new Vn("fix-tables");function GSe(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let o=0,a=0;o<s;o++){const l=e.child(o);for(let c=a,u=Math.min(i,o+3);c<u;c++)if(t.child(c)==l){a=c+1,n+=l.nodeSize;continue e}r(l,n),a<i&&t.child(a).sameMarkup(l)?GSe(t.child(a),l,n+1,r):l.nodesBetween(0,l.content.size,r,n+1),n+=l.nodeSize}}function Kyt(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=Yyt(t,i,s,n))};return e?e.doc!=t.doc&&GSe(e.doc,t.doc,0,r):t.doc.descendants(r),n}function Yyt(t,e,n,r){const i=Xn.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let l=0;l<i.height;l++)s.push(0);for(let l=0;l<i.problems.length;l++){const c=i.problems[l];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let h=0;h<d.rowspan;h++)s[c.row+h]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,uy(d,d.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=r.mapping.map(n);r.delete(u,u+e.nodeSize)}}let o,a;for(let l=0;l<s.length;l++)s[l]&&(o==null&&(o=l),a=l);for(let l=0,c=n+1;l<i.height;l++){const u=e.child(l),d=c+u.nodeSize,h=s[l];if(h>0){let f="cell";u.firstChild&&(f=u.firstChild.type.spec.tableRole);const p=[];for(let y=0;y<h;y++){const v=ec(t.schema)[f].createAndFill();v&&p.push(v)}const g=(l==0||o==l-1)&&a==l?c+1:d-1;r.insert(r.mapping.map(g),p)}c=d}return r.setMeta(Gyt,{fixTables:!0})}function KSe(t){const e=Xn.get(t),n=[],r=e.height,i=e.width;for(let s=0;s<r;s++){const o=[];for(let a=0;a<i;a++){const l=s*i+a,c=e.map[l];if(s>0){const u=l-i;if(c===e.map[u]){o.push(null);continue}}if(a>0){const u=l-1;if(c===e.map[u]){o.push(null);continue}}o.push(t.nodeAt(c))}n.push(o)}return n}function YSe(t,e){const n=[],r=Xn.get(t),i=r.height,s=r.width;for(let o=0;o<i;o++){const a=t.child(o),l=[];for(let u=0;u<s;u++){const d=e[o][u];if(!d)continue;const h=r.map[o*r.width+u],f=t.nodeAt(h);if(!f)continue;const p=f.type.createChecked(d.attrs,d.content,d.marks);l.push(p)}const c=a.type.createChecked(a.attrs,l,a.marks);n.push(c)}return t.type.createChecked(t.attrs,n,t.marks)}function ZSe(t,e,n,r){const i=e[0]>n[0]?-1:1,s=t.splice(e[0],e.length),o=s.length%2===0?1:0;let a;return a=i===-1?n[0]:n[n.length-1]-o,t.splice(a,0,...s),t}function y2(t){return Zyt(e=>e.type.spec.tableRole==="table",t)}function Zyt(t,e){for(let n=e.depth;n>=0;n-=1){const r=e.node(n);if(t(r))return{node:r,pos:n===0?0:e.before(n),start:e.start(n),depth:n}}return null}function vv(t,e){const n=y2(e.$from);if(!n)return;const r=Xn.get(n.node);if(!(t<0||t>r.width-1))return r.cellsInRect({left:t,right:t+1,top:0,bottom:r.height}).map(i=>{const s=n.node.nodeAt(i),o=i+n.start;return{pos:o,start:o+1,node:s,depth:n.depth+2}})}function bv(t,e){const n=y2(e.$from);if(!n)return;const r=Xn.get(n.node);if(!(t<0||t>r.height-1))return r.cellsInRect({left:0,right:r.width,top:t,bottom:t+1}).map(i=>{const s=n.node.nodeAt(i),o=i+n.start;return{pos:o,start:o+1,node:s,depth:n.depth+2}})}function Zie(t,e,n=e){let r=e,i=n;for(let u=e;u>=0;u--){const d=vv(u,t.selection);d&&d.forEach(h=>{const f=h.node.attrs.colspan+u-1;f>=r&&(r=u),f>i&&(i=f)})}for(let u=e;u<=i;u++){const d=vv(u,t.selection);d&&d.forEach(h=>{const f=h.node.attrs.colspan+u-1;h.node.attrs.colspan>1&&f>i&&(i=f)})}const s=[];for(let u=r;u<=i;u++){const d=vv(u,t.selection);d&&d.length>0&&s.push(u)}r=s[0],i=s[s.length-1];const o=vv(r,t.selection),a=bv(0,t.selection);if(!o||!a)return;const l=t.doc.resolve(o[o.length-1].pos);let c;for(let u=i;u>=r;u--){const d=vv(u,t.selection);if(d&&d.length>0){for(let h=a.length-1;h>=0;h--)if(a[h].pos===d[0].pos){c=d[0];break}if(c)break}}if(c)return{$anchor:l,$head:t.doc.resolve(c.pos),indexes:s}}function Xie(t,e,n=e){let r=e,i=n;for(let u=e;u>=0;u--){const d=bv(u,t.selection);d&&d.forEach(h=>{const f=h.node.attrs.rowspan+u-1;f>=r&&(r=u),f>i&&(i=f)})}for(let u=e;u<=i;u++){const d=bv(u,t.selection);d&&d.forEach(h=>{const f=h.node.attrs.rowspan+u-1;h.node.attrs.rowspan>1&&f>i&&(i=f)})}const s=[];for(let u=r;u<=i;u++){const d=bv(u,t.selection);d&&d.length>0&&s.push(u)}r=s[0],i=s[s.length-1];const o=bv(r,t.selection),a=vv(0,t.selection);if(!o||!a)return;const l=t.doc.resolve(o[o.length-1].pos);let c;for(let u=i;u>=r;u--){const d=bv(u,t.selection);if(d&&d.length>0){for(let h=a.length-1;h>=0;h--)if(a[h].pos===d[0].pos){c=d[0];break}if(c)break}}if(c)return{$anchor:l,$head:t.doc.resolve(c.pos),indexes:s}}function Qie(t){return t[0].map((e,n)=>t.map(r=>r[n]))}function Xyt(t){var e,n;const{tr:r,originIndex:i,targetIndex:s,select:o,pos:a}=t,l=y2(r.doc.resolve(a));if(!l)return!1;const c=(e=Zie(r,i))===null||e===void 0?void 0:e.indexes,u=(n=Zie(r,s))===null||n===void 0?void 0:n.indexes;if(!c||!u||c.includes(s))return!1;const d=Qyt(l.node,c,u);if(r.replaceWith(l.pos,l.pos+l.node.nodeSize,d),!o)return!0;const h=Xn.get(d),f=l.start,p=s,g=h.positionAt(h.height-1,p,d),y=r.doc.resolve(f+g),v=h.positionAt(0,p,d),b=r.doc.resolve(f+v);return r.setSelection(xr.colSelection(y,b)),!0}function Qyt(t,e,n,r){let i=Qie(KSe(t));return i=ZSe(i,e,n),i=Qie(i),YSe(t,i)}function Jyt(t){var e,n;const{tr:r,originIndex:i,targetIndex:s,select:o,pos:a}=t,l=y2(r.doc.resolve(a));if(!l)return!1;const c=(e=Xie(r,i))===null||e===void 0?void 0:e.indexes,u=(n=Xie(r,s))===null||n===void 0?void 0:n.indexes;if(!c||!u||c.includes(s))return!1;const d=evt(l.node,c,u);if(r.replaceWith(l.pos,l.pos+l.node.nodeSize,d),!o)return!0;const h=Xn.get(d),f=l.start,p=s,g=h.positionAt(p,h.width-1,d),y=r.doc.resolve(f+g),v=h.positionAt(p,0,d),b=r.doc.resolve(f+v);return r.setSelection(xr.rowSelection(y,b)),!0}function evt(t,e,n,r){let i=KSe(t);return i=ZSe(i,e,n),YSe(t,i)}function N0(t){const e=t.selection,n=IR(t),r=n.node(-1),i=n.start(-1),s=Xn.get(r);return{...e instanceof xr?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function XSe(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;Vyt(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const a=o*e.width+i;if(i>0&&i<e.width&&e.map[a-1]==e.map[a]){const l=e.map[a],c=r.nodeAt(l);t.setNodeMarkup(t.mapping.map(n+l),null,Fyt(c.attrs,i-e.colCount(l))),o+=c.attrs.rowspan-1}else{const l=s==null?ec(r.type.schema).cell:r.nodeAt(e.map[a+s]).type,c=e.positionAt(o,i,r);t.insert(t.mapping.map(n+c),l.createAndFill())}}return t}function tvt(t,e){if(!lc(t))return!1;if(e){const n=N0(t);e(XSe(t.tr,n,n.left))}return!0}function nvt(t,e){if(!lc(t))return!1;if(e){const n=N0(t);e(XSe(t.tr,n,n.right))}return!0}function rvt(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let o=0;o<e.height;){const a=o*e.width+i,l=e.map[a],c=n.nodeAt(l),u=c.attrs;if(i>0&&e.map[a-1]==l||i<e.width-1&&e.map[a+1]==l)t.setNodeMarkup(t.mapping.slice(s).map(r+l),null,uy(u,i-e.colCount(l)));else{const d=t.mapping.slice(s).map(r+l);t.delete(d,d+c.nodeSize)}o+=u.rowspan}}function ivt(t,e){if(!lc(t))return!1;if(e){const n=N0(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;rvt(r,n,i),i!=n.left;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=Xn.get(s)}e(r)}return!0}function svt(t,{map:e,table:n,tableStart:r},i){let s=0;for(let c=0;c<i;c++)s+=n.child(c).nodeSize;const o=s+n.child(i).nodeSize,a=t.mapping.maps.length;t.delete(s+r,o+r);const l=new Set;for(let c=0,u=i*e.width;c<e.width;c++,u++){const d=e.map[u];if(!l.has(d)){if(l.add(d),i>0&&d==e.map[u-e.width]){const h=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(i<e.height&&d==e.map[u+e.width]){const h=n.nodeAt(d),f=h.attrs,p=h.type.create({...f,rowspan:h.attrs.rowspan-1},h.content),g=e.positionAt(i+1,c,n);t.insert(t.mapping.slice(a).map(r+g),p),c+=f.colspan-1}}}}function ovt(t,e){if(!lc(t))return!1;if(e){const n=N0(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;svt(r,n,i),i!=n.top;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=Xn.get(n.table)}e(r)}return!0}function avt(t,e){return function(n,r){if(!lc(n))return!1;const i=IR(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof xr?n.selection.forEachCell((o,a)=>{o.attrs[t]!==e&&s.setNodeMarkup(a,null,{...o.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function lvt(t){return function(e,n){if(!lc(e))return!1;if(n){const r=ec(e.schema),i=N0(e),s=e.tr,o=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=o.map(l=>i.table.nodeAt(l));for(let l=0;l<o.length;l++)a[l].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[l],r.cell,a[l].attrs);if(s.steps.length===0)for(let l=0;l<o.length;l++)s.setNodeMarkup(i.tableStart+o[l],r.header_cell,a[l].attrs);n(s)}return!0}}function Jie(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function GW(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?lvt(t):function(n,r){if(!lc(n))return!1;if(r){const i=ec(n.schema),s=N0(n),o=n.tr,a=Jie("row",s,i),l=Jie("column",s,i),c=(t==="column"?a:t==="row"&&l)?1:0,u=t=="column"?{left:0,top:c,right:1,bottom:s.map.height}:t=="row"?{left:c,top:0,right:s.map.width,bottom:1}:s,d=t=="column"?l?i.cell:i.header_cell:t=="row"?a?i.cell:i.header_cell:i.cell;s.map.cellsInRect(u).forEach(h=>{const f=h+s.tableStart,p=o.doc.nodeAt(f);p&&o.setNodeMarkup(f,d,p.attrs)}),r(o)}return!0}}GW("row",{useDeprecatedLogic:!0});GW("column",{useDeprecatedLogic:!0});GW("cell",{useDeprecatedLogic:!0});function cvt(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const s=t.node(-1).child(r),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function QSe(t){return function(e,n){if(!lc(e))return!1;const r=cvt(IR(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(mt.between(i,Byt(i))).scrollIntoView())}return!0}}function uvt(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function WE(t,e){const n=t.selection;if(!(n instanceof xr))return!1;if(e){const r=t.tr,i=ec(t.schema).cell.createAndFill().content;n.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new We(i,0,0))}),r.docChanged&&e(r)}return!0}function dvt(t){return(e,n)=>{const{from:r,to:i,select:s=!0,pos:o=e.selection.from}=t,a=e.tr;return Jyt({tr:a,originIndex:r,targetIndex:i,select:s,pos:o})?(n==null||n(a),!0):!1}}function hvt(t){return(e,n)=>{const{from:r,to:i,select:s=!0,pos:o=e.selection.from}=t,a=e.tr;return Xyt({tr:a,originIndex:r,targetIndex:i,select:s,pos:o})?(n==null||n(a),!0):!1}}function fvt(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,o=i.type.schema,a=[];if(s=="row")for(let l=0;l<e.childCount;l++){let c=e.child(l).content;const u=l?0:Math.max(0,n-1),d=l<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=_B(ec(o).row,new We(c,u,d)).content),a.push(c)}else if(s=="cell"||s=="header_cell")a.push(n||r?_B(ec(o).row,new We(e,n,r)).content:e);else return null;return pvt(o,a)}function pvt(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let o=s.childCount-1;o>=0;o--){const{rowspan:a,colspan:l}=s.child(o).attrs;for(let c=i;c<i+a;c++)n[c]=(n[c]||0)+l}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(De.empty),n[i]<r){const s=ec(t).cell.createAndFill(),o=[];for(let a=n[i];a<r;a++)o.push(s);e[i]=e[i].append(De.from(o))}return{height:e.length,width:r,rows:e}}function _B(t,e){const n=t.createAndFill();return new C2e(n).replace(0,n.content.size,e).doc}function mvt({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],o=[];for(let a=0;a<n.length;a++){const l=n[a],c=[];for(let u=s[a]||0,d=0;u<r;d++){let h=l.child(d%l.childCount);u+h.attrs.colspan>r&&(h=h.type.createChecked(uy(h.attrs,h.attrs.colspan,u+h.attrs.colspan-r),h.content)),c.push(h),u+=h.attrs.colspan;for(let f=1;f<h.attrs.rowspan;f++)s[a+f]=(s[a+f]||0)+h.attrs.colspan}o.push(De.from(c))}n=o,t=r}if(e!=i){const s=[];for(let o=0,a=0;o<i;o++,a++){const l=[],c=n[a%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);o+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),l.push(d)}s.push(De.from(l))}n=s,e=i}return{width:t,height:e,rows:n}}function gvt(t,e,n,r,i,s,o){const a=t.doc.type.schema,l=ec(a);let c,u;if(i>e.width)for(let d=0,h=0;d<e.height;d++){const f=n.child(d);h+=f.nodeSize;const p=[];let g;f.lastChild==null||f.lastChild.type==l.cell?g=c||(c=l.cell.createAndFill()):g=u||(u=l.header_cell.createAndFill());for(let y=e.width;y<i;y++)p.push(g);t.insert(t.mapping.slice(o).map(h-1+r),p)}if(s>e.height){const d=[];for(let p=0,g=(e.height-1)*e.width;p<Math.max(e.width,i);p++){const y=p>=e.width?!1:n.nodeAt(e.map[g+p]).type==l.header_cell;d.push(y?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const h=l.row.create(null,De.from(d)),f=[];for(let p=e.height;p<s;p++)f.push(h);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(c||u)}function ese(t,e,n,r,i,s,o,a){if(o==0||o==e.height)return!1;let l=!1;for(let c=i;c<s;c++){const u=o*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){l=!0;const h=n.nodeAt(d),{top:f,left:p}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...h.attrs,rowspan:o-f}),t.insert(t.mapping.slice(a).map(e.positionAt(o,p,n)),h.type.createAndFill({...h.attrs,rowspan:f+h.attrs.rowspan-o})),c+=h.attrs.colspan-1}}return l}function tse(t,e,n,r,i,s,o,a){if(o==0||o==e.width)return!1;let l=!1;for(let c=i;c<s;c++){const u=c*e.width+o,d=e.map[u];if(e.map[u-1]==d){l=!0;const h=n.nodeAt(d),f=e.colCount(d),p=t.mapping.slice(a).map(d+r);t.setNodeMarkup(p,null,uy(h.attrs,o-f,h.attrs.colspan-(o-f))),t.insert(p+h.nodeSize,h.type.createAndFill(uy(h.attrs,0,o-f))),c+=h.attrs.rowspan-1}}return l}function nse(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let o=Xn.get(s);const{top:a,left:l}=r,c=l+i.width,u=a+i.height,d=t.tr;let h=0;function f(){if(s=n?d.doc.nodeAt(n-1):d.doc,!s)throw new Error("No table found");o=Xn.get(s),h=d.mapping.maps.length}gvt(d,o,s,n,c,u,h)&&f(),ese(d,o,s,n,l,c,a,h)&&f(),ese(d,o,s,n,l,c,u,h)&&f(),tse(d,o,s,n,a,u,l,h)&&f(),tse(d,o,s,n,a,u,c,h)&&f();for(let p=a;p<u;p++){const g=o.positionAt(p,l,s),y=o.positionAt(p,c,s);d.replace(d.mapping.slice(h).map(g+n),d.mapping.slice(h).map(y+n),new We(i.rows[p-a],0,0))}f(),d.setSelection(new xr(d.doc.resolve(n+o.positionAt(a,l,s)),d.doc.resolve(n+o.positionAt(u-1,c-1,s)))),e(d)}const yvt=sq({ArrowLeft:GE("horiz",-1),ArrowRight:GE("horiz",1),ArrowUp:GE("vert",-1),ArrowDown:GE("vert",1),"Shift-ArrowLeft":KE("horiz",-1),"Shift-ArrowRight":KE("horiz",1),"Shift-ArrowUp":KE("vert",-1),"Shift-ArrowDown":KE("vert",1),Backspace:WE,"Mod-Backspace":WE,Delete:WE,"Mod-Delete":WE});function R6(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function GE(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof xr)return R6(n,r,jt.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const o=JSe(i,t,e);if(o==null)return!1;if(t=="horiz")return R6(n,r,jt.near(n.doc.resolve(s.head+e),e));{const a=n.doc.resolve(o),l=qSe(a,t,e);let c;return l?c=jt.near(l,1):e<0?c=jt.near(n.doc.resolve(a.before(-1)),-1):c=jt.near(n.doc.resolve(a.after(-1)),1),R6(n,r,c)}}}function KE(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let o;if(s instanceof xr)o=s;else{const l=JSe(i,t,e);if(l==null)return!1;o=new xr(n.doc.resolve(l))}const a=qSe(o.$headCell,t,e);return a?R6(n,r,new xr(o.$anchorCell,a)):!1}}function vvt(t,e){const n=t.state.doc,r=mx(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new xr(r))),!0):!1}function bvt(t,e,n){if(!lc(t.state))return!1;let r=fvt(n);const i=t.state.selection;if(i instanceof xr){r||(r={width:1,height:1,rows:[De.from(_B(ec(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),a=Xn.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=mvt(r,a.right-a.left,a.bottom-a.top),nse(t.state,t.dispatch,o,a,r),!0}else if(r){const s=IR(t.state),o=s.start(-1);return nse(t.state,t.dispatch,o,Xn.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function wvt(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=rse(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof xr)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=mx(t.state.selection.$anchor))!=null&&((n=lD(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(l,c){let u=lD(t,c);const d=Rp.getState(t.state)==null;if(!u||!WW(l,u))if(d)u=l;else return;const h=new xr(l,u);if(d||!t.state.selection.eq(h)){const f=t.state.tr.setSelection(h);d&&f.setMeta(Rp,l.pos),t.dispatch(f)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",a),Rp.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Rp,-1))}function a(l){const c=l,u=Rp.getState(t.state);let d;if(u!=null)d=t.state.doc.resolve(u);else if(rse(t,c.target)!=r&&(d=lD(t,e),!d))return o();d&&s(d,c)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",a)}function JSe(t,e,n){if(!(t.state.selection instanceof mt))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=r.before(i),a=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(a)?o:null}}return null}function rse(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function lD(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&mx(t.state.doc.resolve(r))||mx(t.state.doc.resolve(i))}var xvt=class{constructor(t,e){this.node=t,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),SB(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,SB(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function SB(t,e,n,r,i,s){let o=0,a=!0,l=e.firstChild;const c=t.firstChild;if(c){for(let d=0,h=0;d<c.childCount;d++){const{colspan:f,colwidth:p}=c.child(d).attrs;for(let g=0;g<f;g++,h++){const y=i==h?s:p&&p[g],v=y?y+"px":"";if(o+=y||r,y||(a=!1),l)l.style.width!=v&&(l.style.width=v),l=l.nextSibling;else{const b=document.createElement("col");b.style.width=v,e.appendChild(b)}}}for(;l;){var u;const d=l.nextSibling;(u=l.parentNode)===null||u===void 0||u.removeChild(l),l=d}a?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}const $a=new Vn("tableColumnResizing");function _vt({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=xvt,lastColumnResizable:i=!0}={}){const s=new Fn({key:$a,state:{init(o,a){var l;const c=(l=s.spec)===null||l===void 0||(l=l.props)===null||l===void 0?void 0:l.nodeViews,u=ec(a.schema).table.name;return r&&c&&(c[u]=(d,h)=>new r(d,n,h)),new Svt(-1,!1)},apply(o,a){return a.apply(o)}},props:{attributes:o=>{const a=$a.getState(o);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,a)=>{kvt(o,a,t,i)},mouseleave:o=>{Cvt(o)},mousedown:(o,a)=>{Evt(o,a,e,n)}},decorations:o=>{const a=$a.getState(o);if(a&&a.activeHandle>-1)return Mvt(o,a.activeHandle)},nodeViews:{}}});return s}var Svt=class M6{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta($a);if(r&&r.setHandle!=null)return new M6(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new M6(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return xB(e.doc.resolve(i))||(i=-1),new M6(i,n.dragging)}return n}};function kvt(t,e,n,r){if(!t.editable)return;const i=$a.getState(t.state);if(i&&!i.dragging){const s=Avt(e.target);let o=-1;if(s){const{left:a,right:l}=s.getBoundingClientRect();e.clientX-a<=n?o=ise(t,e,"left",n):l-e.clientX<=n&&(o=ise(t,e,"right",n))}if(o!=i.activeHandle){if(!r&&o!==-1){const a=t.state.doc.resolve(o),l=a.node(-1),c=Xn.get(l),u=a.start(-1);if(c.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==c.width-1)return}eke(t,o)}}}function Cvt(t){if(!t.editable)return;const e=$a.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&eke(t,-1)}function Evt(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,o=$a.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const a=t.state.doc.nodeAt(o.activeHandle),l=Tvt(t,o.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta($a,{setDragging:{startX:e.clientX,startWidth:l}}));function c(d){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",u);const h=$a.getState(t.state);h!=null&&h.dragging&&(Ivt(t,h.activeHandle,sse(h.dragging,d,n)),t.dispatch(t.state.tr.setMeta($a,{setDragging:null})))}function u(d){if(!d.which)return c(d);const h=$a.getState(t.state);if(h&&h.dragging){const f=sse(h.dragging,d,n);ose(t,h.activeHandle,f,r)}}return ose(t,o.activeHandle,l,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",u),e.preventDefault(),!0}function Tvt(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let o=s.node.childNodes[s.offset].offsetWidth,a=n;if(r)for(let l=0;l<n;l++)r[l]&&(o-=r[l],a--);return o/a}function Avt(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function ise(t,e,n,r){const i=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:o}=s,a=mx(t.state.doc.resolve(o));if(!a)return-1;if(n=="right")return a.pos;const l=Xn.get(a.node(-1)),c=a.start(-1),u=l.map.indexOf(a.pos-c);return u%l.width==0?-1:c+l.map[u-1]}function sse(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function eke(t,e){t.dispatch(t.state.tr.setMeta($a,{setHandle:e}))}function Ivt(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=Xn.get(i),o=r.start(-1),a=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,l=t.state.tr;for(let c=0;c<s.height;c++){const u=c*s.width+a;if(c&&s.map[u]==s.map[u-s.width])continue;const d=s.map[u],h=i.nodeAt(d).attrs,f=h.colspan==1?0:a-s.colCount(d);if(h.colwidth&&h.colwidth[f]==n)continue;const p=h.colwidth?h.colwidth.slice():Rvt(h.colspan);p[f]=n,l.setNodeMarkup(o+d,null,{...h,colwidth:p})}l.docChanged&&t.dispatch(l)}function ose(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),a=Xn.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;let l=t.domAtPos(i.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&SB(s,l.firstChild,l,r,a,n)}function Rvt(t){return Array(t).fill(0)}function Mvt(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return En.empty;const s=Xn.get(i),o=r.start(-1),a=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=a+c*s.width;if((a==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){var l;const d=s.map[u],h=o+d+i.nodeAt(d).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",!((l=$a.getState(t))===null||l===void 0)&&l.dragging&&n.push(sr.node(o+d,o+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(sr.widget(h,f))}}return En.create(t.doc,n)}function Nvt({allowTableNodeSelection:t=!1}={}){return new Fn({key:Rp,state:{init(){return null},apply(e,n){const r=e.getMeta(Rp);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:Hyt,handleDOMEvents:{mousedown:wvt},createSelectionBetween(e){return Rp.getState(e.state)!=null?e.state.selection:null},handleTripleClick:vvt,handleKeyDown:yvt,handlePaste:bvt},appendTransaction(e,n,r){return Wyt(r,Kyt(r,n),t)}})}var I8=typeof navigator<"u"?navigator:null,KW=I8&&I8.userAgent||"",Ovt=/Edge\/(\d+)/.exec(KW),Dvt=/MSIE \d/.exec(KW),Pvt=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(KW),Lvt=!!(Dvt||Pvt||Ovt),zvt=!Lvt&&!!I8&&/Apple Computer/.test(I8.vendor),tke=new Vn("safari-ime-span"),kB=!1,jvt={key:tke,props:{decorations:Bvt,handleDOMEvents:{compositionstart:()=>{kB=!0},compositionend:()=>{kB=!1}}}};function Bvt(t){const{$from:e,$to:n,to:r}=t.selection;if(kB&&e.sameParent(n)){const i=sr.widget(r,Fvt,{ignoreSelection:!0,key:"safari-ime-span"});return En.create(t.doc,[i])}}function Fvt(t){const e=t.dom.ownerDocument.createElement("span");return e.className="ProseMirror-safari-ime-span",e}var Vvt=new Fn(zvt?jvt:{key:tke});function ase(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(e);for(;i!==-1;)r++,i=n.indexOf(e,i+e.length);return r}function $vt(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Hvt(t,e,n){const i=KI((n||{}).ignore||[]),s=Uvt(e);let o=-1;for(;++o<s.length;)qU(t,"text",a);function a(c,u){let d=-1,h;for(;++d<u.length;){const f=u[d],p=h?h.children:void 0;if(i(f,p?p.indexOf(f):void 0,h))return;h=f}if(h)return l(c,u)}function l(c,u){const d=u[u.length-1],h=s[o][0],f=s[o][1];let p=0;const y=d.children.indexOf(c);let v=!1,b=[];h.lastIndex=0;let _=h.exec(c.value);for(;_;){const S=_.index,k={index:_.index,input:_.input,stack:[...u,c]};let T=f(..._,k);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?h.lastIndex=S+1:(p!==S&&b.push({type:"text",value:c.value.slice(p,S)}),Array.isArray(T)?b.push(...T):T&&b.push(T),p=S+_[0].length,v=!0),!h.global)break;_=h.exec(c.value)}return v?(p<c.value.length&&b.push({type:"text",value:c.value.slice(p)}),d.children.splice(y,1,...b)):b=[c],y+b.length}}function Uvt(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!t[0]||Array.isArray(t[0])?t:[t];let r=-1;for(;++r<n.length;){const i=n[r];e.push([qvt(i[0]),Wvt(i[1])])}return e}function qvt(t){return typeof t=="string"?new RegExp($vt(t),"g"):t}function Wvt(t){return typeof t=="function"?t:function(){return t}}const cD="phrasing",uD=["autolink","link","image","label"];function Gvt(){return{transforms:[ebt],enter:{literalAutolink:Yvt,literalAutolinkEmail:dD,literalAutolinkHttp:dD,literalAutolinkWww:dD},exit:{literalAutolink:Jvt,literalAutolinkEmail:Qvt,literalAutolinkHttp:Zvt,literalAutolinkWww:Xvt}}}function Kvt(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:cD,notInConstruct:uD},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:cD,notInConstruct:uD},{character:":",before:"[ps]",after:"\\/",inConstruct:cD,notInConstruct:uD}]}}function Yvt(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function dD(t){this.config.enter.autolinkProtocol.call(this,t)}function Zvt(t){this.config.exit.autolinkProtocol.call(this,t)}function Xvt(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function Qvt(t){this.config.exit.autolinkEmail.call(this,t)}function Jvt(t){this.exit(t)}function ebt(t){Hvt(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,tbt],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),nbt]],{ignore:["link","linkReference"]})}function tbt(t,e,n,r,i){let s="";if(!nke(i)||(/^w/i.test(e)&&(n=e+n,e="",s="http://"),!rbt(n)))return!1;const o=ibt(n+r);if(!o[0])return!1;const a={type:"link",title:null,url:s+e+o[0],children:[{type:"text",value:e+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function nbt(t,e,n,r){return!nke(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function rbt(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function ibt(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const i=ase(t,"(");let s=ase(t,")");for(;r!==-1&&i>s;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[t,n]}function nke(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||ey(n)||WI(n))&&(!e||n!==47)}rke.peek=fbt;function sbt(){this.buffer()}function obt(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function abt(){this.buffer()}function lbt(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function cbt(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Bc(this.sliceSerialize(t)).toLowerCase(),n.label=e}function ubt(t){this.exit(t)}function dbt(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Bc(this.sliceSerialize(t)).toLowerCase(),n.label=e}function hbt(t){this.exit(t)}function fbt(){return"["}function rke(t,e,n,r){const i=n.createTracker(r);let s=i.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return s+=i.move(n.safe(n.associationId(t),{after:"]",before:s})),a(),o(),s+=i.move("]"),s}function pbt(){return{enter:{gfmFootnoteCallString:sbt,gfmFootnoteCall:obt,gfmFootnoteDefinitionLabelString:abt,gfmFootnoteDefinition:lbt},exit:{gfmFootnoteCallString:cbt,gfmFootnoteCall:ubt,gfmFootnoteDefinitionLabelString:dbt,gfmFootnoteDefinition:hbt}}}function mbt(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:rke},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,o){const a=s.createTracker(o);let l=a.move("[^");const c=s.enter("footnoteDefinition"),u=s.enter("label");return l+=a.move(s.safe(s.associationId(r),{before:l,after:"]"})),u(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((e?`
|
||
`:" ")+s.indentLines(s.containerFlow(r,a.current()),e?ike:gbt))),c(),l}}function gbt(t,e,n){return e===0?t:ike(t,e,n)}function ike(t,e,n){return(n?"":" ")+t}const ybt=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];ske.peek=_bt;function vbt(){return{canContainEols:["delete"],enter:{strikethrough:wbt},exit:{strikethrough:xbt}}}function bbt(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:ybt}],handlers:{delete:ske}}}function wbt(t){this.enter({type:"delete",children:[]},t)}function xbt(t){this.exit(t)}function ske(t,e,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let o=i.move("~~");return o+=n.containerPhrasing(t,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function _bt(){return"~"}function Sbt(t){return t.length}function kbt(t,e){const n=e||{},r=(n.align||[]).concat(),i=n.stringLength||Sbt,s=[],o=[],a=[],l=[];let c=0,u=-1;for(;++u<t.length;){const g=[],y=[];let v=-1;for(t[u].length>c&&(c=t[u].length);++v<t[u].length;){const b=Cbt(t[u][v]);if(n.alignDelimiters!==!1){const _=i(b);y[v]=_,(l[v]===void 0||_>l[v])&&(l[v]=_)}g.push(b)}o[u]=g,a[u]=y}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<c;)s[d]=lse(r[d]);else{const g=lse(r);for(;++d<c;)s[d]=g}d=-1;const h=[],f=[];for(;++d<c;){const g=s[d];let y="",v="";g===99?(y=":",v=":"):g===108?y=":":g===114&&(v=":");let b=n.alignDelimiters===!1?1:Math.max(1,l[d]-y.length-v.length);const _=y+"-".repeat(b)+v;n.alignDelimiters!==!1&&(b=y.length+b+v.length,b>l[d]&&(l[d]=b),f[d]=b),h[d]=_}o.splice(1,0,h),a.splice(1,0,f),u=-1;const p=[];for(;++u<o.length;){const g=o[u],y=a[u];d=-1;const v=[];for(;++d<c;){const b=g[d]||"";let _="",S="";if(n.alignDelimiters!==!1){const k=l[d]-(y[d]||0),T=s[d];T===114?_=" ".repeat(k):T===99?k%2?(_=" ".repeat(k/2+.5),S=" ".repeat(k/2-.5)):(_=" ".repeat(k/2),S=_):S=" ".repeat(k)}n.delimiterStart!==!1&&!d&&v.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&b==="")&&(n.delimiterStart!==!1||d)&&v.push(" "),n.alignDelimiters!==!1&&v.push(_),v.push(b),n.alignDelimiters!==!1&&v.push(S),n.padding!==!1&&v.push(" "),(n.delimiterEnd!==!1||d!==c-1)&&v.push("|")}p.push(n.delimiterEnd===!1?v.join("").replace(/ +$/,""):v.join(""))}return p.join(`
|
||
`)}function Cbt(t){return t==null?"":String(t)}function lse(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function Ebt(){return{enter:{table:Tbt,tableData:cse,tableHeader:cse,tableRow:Ibt},exit:{codeText:Rbt,table:Abt,tableData:hD,tableHeader:hD,tableRow:hD}}}function Tbt(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function Abt(t){this.exit(t),this.data.inTable=void 0}function Ibt(t){this.enter({type:"tableRow",children:[]},t)}function hD(t){this.exit(t)}function cse(t){this.enter({type:"tableCell",children:[]},t)}function Rbt(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,Mbt));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function Mbt(t,e){return e==="|"?e:t}function Nbt(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,i=e.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
||
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:o,tableCell:l,tableRow:a}};function o(f,p,g,y){return c(u(f,g,y),f.align)}function a(f,p,g,y){const v=d(f,g,y),b=c([v]);return b.slice(0,b.indexOf(`
|
||
`))}function l(f,p,g,y){const v=g.enter("tableCell"),b=g.enter("phrasing"),_=g.containerPhrasing(f,{...y,before:s,after:s});return b(),v(),_}function c(f,p){return kbt(f,{align:p,alignDelimiters:r,padding:n,stringLength:i})}function u(f,p,g){const y=f.children;let v=-1;const b=[],_=p.enter("table");for(;++v<y.length;)b[v]=d(y[v],p,g);return _(),b}function d(f,p,g){const y=f.children;let v=-1;const b=[],_=p.enter("tableRow");for(;++v<y.length;)b[v]=l(y[v],f,p,g);return _(),b}function h(f,p,g){let y=GU.inlineCode(f,p,g);return g.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function Obt(){return{exit:{taskListCheckValueChecked:use,taskListCheckValueUnchecked:use,paragraph:Pbt}}}function Dbt(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Lbt}}}function use(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function Pbt(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=e.children;let s=-1,o;for(;++s<i.length;){const a=i[s];if(a.type==="paragraph"){o=a;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function Lbt(t,e,n,r){const i=t.children[0],s=typeof t.checked=="boolean"&&i&&i.type==="paragraph",o="["+(t.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(o);let l=GU.listItem(t,e,n,{...r,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+o}}function zbt(){return[Gvt(),pbt(),vbt(),Ebt(),Obt()]}function jbt(t){return{extensions:[Kvt(),mbt(t),bbt(),Nbt(t),Dbt()]}}const Bbt={tokenize:qbt,partial:!0},oke={tokenize:Wbt,partial:!0},ake={tokenize:Gbt,partial:!0},lke={tokenize:Kbt,partial:!0},Fbt={tokenize:Ybt,partial:!0},cke={name:"wwwAutolink",tokenize:Hbt,previous:dke},uke={name:"protocolAutolink",tokenize:Ubt,previous:hke},Mf={name:"emailAutolink",tokenize:$bt,previous:fke},Pd={};function Vbt(){return{text:Pd}}let X0=48;for(;X0<123;)Pd[X0]=Mf,X0++,X0===58?X0=65:X0===91&&(X0=97);Pd[43]=Mf;Pd[45]=Mf;Pd[46]=Mf;Pd[95]=Mf;Pd[72]=[Mf,uke];Pd[104]=[Mf,uke];Pd[87]=[Mf,cke];Pd[119]=[Mf,cke];function $bt(t,e,n){const r=this;let i,s;return o;function o(d){return!CB(d)||!fke.call(r,r.previous)||YW(r.events)?n(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(d))}function a(d){return CB(d)?(t.consume(d),a):d===64?(t.consume(d),l):n(d)}function l(d){return d===46?t.check(Fbt,u,c)(d):d===45||d===95||da(d)?(s=!0,t.consume(d),l):u(d)}function c(d){return t.consume(d),i=!0,l}function u(d){return s&&i&&Eo(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):n(d)}}function Hbt(t,e,n){const r=this;return i;function i(o){return o!==87&&o!==119||!dke.call(r,r.previous)||YW(r.events)?n(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(Bbt,t.attempt(oke,t.attempt(ake,s),n),n)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function Ubt(t,e,n){const r=this;let i="",s=!1;return o;function o(d){return(d===72||d===104)&&hke.call(r,r.previous)&&!YW(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),a):n(d)}function a(d){if(Eo(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),a;if(d===58){const h=i.toLowerCase();if(h==="http"||h==="https")return t.consume(d),l}return n(d)}function l(d){return d===47?(t.consume(d),s?c:(s=!0,l)):n(d)}function c(d){return d===null||e8(d)||wr(d)||ey(d)||WI(d)?n(d):t.attempt(oke,t.attempt(ake,u),n)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function qbt(t,e,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,t.consume(o),i):o===46&&r===3?(t.consume(o),s):n(o)}function s(o){return o===null?n(o):e(o)}}function Wbt(t,e,n){let r,i,s;return o;function o(c){return c===46||c===95?t.check(lke,l,a)(c):c===null||wr(c)||ey(c)||c!==45&&WI(c)?l(c):(s=!0,t.consume(c),o)}function a(c){return c===95?r=!0:(i=r,r=void 0),t.consume(c),o}function l(c){return i||r||!s?n(c):e(c)}}function Gbt(t,e){let n=0,r=0;return i;function i(o){return o===40?(n++,t.consume(o),i):o===41&&r<n?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?t.check(lke,e,s)(o):o===null||wr(o)||ey(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&r++,t.consume(o),i}}function Kbt(t,e,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(t.consume(a),r):a===38?(t.consume(a),s):a===93?(t.consume(a),i):a===60||a===null||wr(a)||ey(a)?e(a):n(a)}function i(a){return a===null||a===40||a===91||wr(a)||ey(a)?e(a):r(a)}function s(a){return Eo(a)?o(a):n(a)}function o(a){return a===59?(t.consume(a),r):Eo(a)?(t.consume(a),o):n(a)}}function Ybt(t,e,n){return r;function r(s){return t.consume(s),i}function i(s){return da(s)?n(s):e(s)}}function dke(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||wr(t)}function hke(t){return!Eo(t)}function fke(t){return!(t===47||CB(t))}function CB(t){return t===43||t===45||t===46||t===95||da(t)}function YW(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Zbt={tokenize:iwt,partial:!0};function Xbt(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:twt,continuation:{tokenize:nwt},exit:rwt}},text:{91:{name:"gfmFootnoteCall",tokenize:ewt},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Qbt,resolveTo:Jbt}}}}function Qbt(t,e,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const c=Bc(r.sliceSerialize({start:o.end,end:r.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?n(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function Jbt(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",i,e],["exit",i,e],["enter",s,e],["enter",o,e],["exit",o,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...a),t}function ewt(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,o;return a;function a(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?n(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",c)}function c(d){if(s>999||d===93&&!o||d===null||d===91||wr(d))return n(d);if(d===93){t.exit("chunkString");const h=t.exit("gfmFootnoteCallString");return i.includes(Bc(r.sliceSerialize(h)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(d)}return wr(d)||(o=!0),s++,t.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(t.consume(d),s++,c):c(d)}}function twt(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,a;return l;function l(p){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(p),t.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(p){return p===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(p),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",u):n(p)}function u(p){if(o>999||p===93&&!a||p===null||p===91||wr(p))return n(p);if(p===93){t.exit("chunkString");const g=t.exit("gfmFootnoteDefinitionLabelString");return s=Bc(r.sliceSerialize(g)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(p),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),h}return wr(p)||(a=!0),o++,t.consume(p),p===92?d:u}function d(p){return p===91||p===92||p===93?(t.consume(p),o++,u):u(p)}function h(p){return p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),i.includes(s)||i.push(s),dn(t,f,"gfmFootnoteDefinitionWhitespace")):n(p)}function f(p){return e(p)}}function nwt(t,e,n){return t.check(O3,e,t.attempt(Zbt,e,n))}function rwt(t){t.exit("gfmFootnoteDefinition")}function iwt(t,e,n){const r=this;return dn(t,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?e(s):n(s)}}function swt(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let c=l;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[l][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[l][1].end)},d={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[l][1].start)},h=[["enter",u,a],["enter",o[c][1],a],["exit",o[c][1],a],["enter",d,a]],f=a.parser.constructs.insideSpan.null;f&&Ja(h,h.length,0,GI(f,o.slice(c+1,l),a)),Ja(h,h.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),Ja(o,c-1,l-c+3,h),l=c+h.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function s(o,a,l){const c=this.previous,u=this.events;let d=0;return h;function h(p){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(p):(o.enter("strikethroughSequenceTemporary"),f(p))}function f(p){const g=lx(c);if(p===126)return d>1?l(p):(o.consume(p),d++,f);if(d<2&&!n)return l(p);const y=o.exit("strikethroughSequenceTemporary"),v=lx(p);return y._open=!v||v===2&&!!g,y._close=!g||g===2&&!!v,a(p)}}}class owt{constructor(){this.map=[]}add(e,n,r){awt(this,e,n,r)}consume(e){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let i=r.pop();for(;i;){for(const s of i)e.push(s);i=r.pop()}this.map.length=0}}function awt(t,e,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=n,t.map[i][2].push(...r);return}i+=1}t.map.push([e,n,r])}}function lwt(t,e){let n=!1;const r=[];for(;e<t.length;){const i=t[e];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function cwt(){return{flow:{null:{name:"table",tokenize:uwt,resolveAll:dwt}}}}function uwt(t,e,n){const r=this;let i=0,s=0,o;return a;function a(M){let D=r.events.length-1;for(;D>-1;){const Z=r.events[D][1].type;if(Z==="lineEnding"||Z==="linePrefix")D--;else break}const P=D>-1?r.events[D][1].type:null,z=P==="tableHead"||P==="tableRow"?T:l;return z===T&&r.parser.lazy[r.now().line]?n(M):z(M)}function l(M){return t.enter("tableHead"),t.enter("tableRow"),c(M)}function c(M){return M===124||(o=!0,s+=1),u(M)}function u(M){return M===null?n(M):_t(M)?s>1?(s=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),f):n(M):wn(M)?dn(t,u,"whitespace")(M):(s+=1,o&&(o=!1,i+=1),M===124?(t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),o=!0,u):(t.enter("data"),d(M)))}function d(M){return M===null||M===124||wr(M)?(t.exit("data"),u(M)):(t.consume(M),M===92?h:d)}function h(M){return M===92||M===124?(t.consume(M),d):d(M)}function f(M){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(M):(t.enter("tableDelimiterRow"),o=!1,wn(M)?dn(t,p,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):p(M))}function p(M){return M===45||M===58?y(M):M===124?(o=!0,t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),g):k(M)}function g(M){return wn(M)?dn(t,y,"whitespace")(M):y(M)}function y(M){return M===58?(s+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(M),t.exit("tableDelimiterMarker"),v):M===45?(s+=1,v(M)):M===null||_t(M)?S(M):k(M)}function v(M){return M===45?(t.enter("tableDelimiterFiller"),b(M)):k(M)}function b(M){return M===45?(t.consume(M),b):M===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(M),t.exit("tableDelimiterMarker"),_):(t.exit("tableDelimiterFiller"),_(M))}function _(M){return wn(M)?dn(t,S,"whitespace")(M):S(M)}function S(M){return M===124?p(M):M===null||_t(M)?!o||i!==s?k(M):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(M)):k(M)}function k(M){return n(M)}function T(M){return t.enter("tableRow"),E(M)}function E(M){return M===124?(t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),E):M===null||_t(M)?(t.exit("tableRow"),e(M)):wn(M)?dn(t,E,"whitespace")(M):(t.enter("data"),C(M))}function C(M){return M===null||M===124||wr(M)?(t.exit("data"),E(M)):(t.consume(M),M===92?R:C)}function R(M){return M===92||M===124?(t.consume(M),C):C(M)}}function dwt(t,e){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,c,u,d;const h=new owt;for(;++n<t.length;){const f=t[n],p=f[1];f[0]==="enter"?p.type==="tableHead"?(a=!1,l!==0&&(dse(h,e,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},h.add(n,0,[["enter",c,e]])):p.type==="tableRow"||p.type==="tableDelimiterRow"?(r=!0,d=void 0,s=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,u={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},h.add(n,0,[["enter",u,e]])),i=p.type==="tableDelimiterRow"?2:u?3:1):i&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],d=YE(h,e,s,i,void 0,d),s=[0,0,0,0]),o[2]=n)):p.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(o[0]=o[1],d=YE(h,e,s,i,void 0,d)),s=o,o=[s[1],n,0,0])):p.type==="tableHead"?(a=!0,l=n):p.type==="tableRow"||p.type==="tableDelimiterRow"?(l=n,s[1]!==0?(o[0]=o[1],d=YE(h,e,s,i,n,d)):o[1]!==0&&(d=YE(h,e,o,i,n,d)),i=0):i&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&dse(h,e,l,c,u),h.consume(e.events),n=-1;++n<e.events.length;){const f=e.events[n];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=lwt(e.events,n))}return t}function YE(t,e,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(s.end=Object.assign({},wv(e.events,n[0])),t.add(n[0],0,[["exit",s,e]]));const l=wv(e.events,n[1]);if(s={type:o,start:Object.assign({},l),end:Object.assign({},l)},t.add(n[1],0,[["enter",s,e]]),n[2]!==0){const c=wv(e.events,n[2]),u=wv(e.events,n[3]),d={type:a,start:Object.assign({},c),end:Object.assign({},u)};if(t.add(n[2],0,[["enter",d,e]]),r!==2){const h=e.events[n[2]],f=e.events[n[3]];if(h[1].end=Object.assign({},f[1].end),h[1].type="chunkText",h[1].contentType="text",n[3]>n[2]+1){const p=n[2]+1,g=n[3]-n[2]-1;t.add(p,g,[])}}t.add(n[3]+1,0,[["exit",d,e]])}return i!==void 0&&(s.end=Object.assign({},wv(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function dse(t,e,n,r,i){const s=[],o=wv(e.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,e])),r.end=Object.assign({},o),s.push(["exit",r,e]),t.add(n+1,0,s)}function wv(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const hwt={name:"tasklistCheck",tokenize:pwt};function fwt(){return{text:{91:hwt}}}function pwt(t,e,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),s)}function s(l){return wr(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),a):n(l)}function a(l){return _t(l)?e(l):wn(l)?t.check({tokenize:mwt},e,n)(l):n(l)}}function mwt(t,e,n){return dn(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function gwt(t){return bxe([Vbt(),Xbt(),swt(t),cwt(),fwt()])}const ywt={};function vwt(t){const e=this,n=t||ywt,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(gwt(n)),s.push(zbt()),o.push(jbt(n))}function Lt(t,e){return Object.assign(t,{meta:{package:"@milkdown/preset-gfm",...e}}),t}var ZW=V3("strike_through");Lt(ZW,{displayName:"Attr<strikethrough>",group:"Strikethrough"});var Dy=u2("strike_through",t=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>e==="line-through"}],toDOM:e=>["del",t.get(ZW.key)(e)],parseMarkdown:{match:e=>e.type==="delete",runner:(e,n,r)=>{e.openMark(r),e.next(n.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="strike_through",runner:(e,n)=>{e.withMark(n,"delete")}}}));Lt(Dy.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"});Lt(Dy.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});var rC=bt("ToggleStrikeThrough",t=>()=>tR(Dy.type(t)));Lt(rC,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});var pke=co(t=>P3(new RegExp("(?<![\\w:/])(~{1,2})(.+?)\\1(?!\\w|\\/)"),Dy.type(t)));Lt(pke,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});var XW=ka("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:t=>{const e=t.get(je);return()=>e.call(rC.key)}}});Lt(XW.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"});Lt(XW.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});var iC=zyt({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:t=>t.style.textAlign||"left",setDOMAttr:(t,e)=>{e.style=`text-align: ${t||"left"}`}}}}),md=xi("table",()=>({...iC.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="table",runner:(t,e,n)=>{const r=e.align,i=e.children.map((s,o)=>({...s,align:r,isHeader:o===0}));t.openNode(n),t.next(i),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table",runner:(t,e)=>{var i;const n=(i=e.content.firstChild)==null?void 0:i.content;if(!n)return;const r=[];n.forEach(s=>{r.push(s.attrs.alignment)}),t.openNode("table",void 0,{align:r}),t.next(e.content),t.closeNode()}}}));Lt(md.node,{displayName:"NodeSchema<table>",group:"Table"});Lt(md.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});var sC=xi("table_header_row",()=>({...iC.table_row,disableDropCursor:!0,content:"(table_header)*",parseDOM:[{tag:"tr[data-is-header]"},{tag:"tr",getAttrs:t=>t instanceof HTMLElement&&t.querySelector("th")?{}:!1}],toDOM(){return["tr",{"data-is-header":!0},0]},parseMarkdown:{match:t=>!!(t.type==="tableRow"&&t.isHeader),runner:(t,e,n)=>{const r=e.align,i=e.children.map((s,o)=>({...s,align:r[o],isHeader:e.isHeader}));t.openNode(n),t.next(i),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table_header_row",runner:(t,e)=>{e.content.size!==0&&(t.openNode("tableRow",void 0,{isHeader:!0}),t.next(e.content),t.closeNode())}}}));Lt(sC.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"});Lt(sC.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});var v2=xi("table_row",()=>({...iC.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:t=>t.type==="tableRow",runner:(t,e,n)=>{const r=e.align,i=e.children.map((s,o)=>({...s,align:r[o]}));t.openNode(n),t.next(i),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table_row",runner:(t,e)=>{e.content.size!==0&&(t.openNode("tableRow"),t.next(e.content),t.closeNode())}}}));Lt(v2.node,{displayName:"NodeSchema<tableRow>",group:"Table"});Lt(v2.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});var oC=xi("table_cell",()=>({...iC.table_cell,disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="tableCell"&&!t.isHeader,runner:(t,e,n)=>{const r=e.align;t.openNode(n,{alignment:r}).openNode(t.schema.nodes.paragraph).next(e.children).closeNode().closeNode()}},toMarkdown:{match:t=>t.type.name==="table_cell",runner:(t,e)=>{t.openNode("tableCell").next(e.content).closeNode()}}}));Lt(oC.node,{displayName:"NodeSchema<tableCell>",group:"Table"});Lt(oC.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});var gx=xi("table_header",()=>({...iC.table_header,disableDropCursor:!0,parseMarkdown:{match:t=>t.type==="tableCell"&&!!t.isHeader,runner:(t,e,n)=>{const r=e.align;t.openNode(n,{alignment:r}),t.openNode(t.schema.nodes.paragraph),t.next(e.children),t.closeNode(),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="table_header",runner:(t,e)=>{t.openNode("tableCell"),t.next(e.content),t.closeNode()}}}));Lt(gx.node,{displayName:"NodeSchema<tableHeader>",group:"Table"});Lt(gx.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});function RR(t,e=3,n=3){const r=Array(n).fill(0).map(()=>oC.type(t).createAndFill()),i=Array(n).fill(0).map(()=>gx.type(t).createAndFill()),s=Array(e).fill(0).map((o,a)=>a===0?sC.type(t).create(null,i):v2.type(t).create(null,r));return md.type(t).create(null,s)}function mke(t){return(e,n)=>r=>{n=n??r.selection.from;const i=r.doc.resolve(n),s=q2e(l=>l.type.name==="table")(i),o=s?{node:s.node,from:s.start}:void 0,a=t==="row";if(o){const l=Xn.get(o.node);if(e>=0&&e<(a?l.height:l.width)){const c=l.positionAt(a?e:l.height-1,a?l.width-1:e,o.node),u=r.doc.resolve(o.from+c),d=a?xr.rowSelection:xr.colSelection,h=l.positionAt(a?e:0,a?0:e,o.node),f=r.doc.resolve(o.from+h);return U2e(r.setSelection(d(u,f)))}}return r}}var bwt=mke("row"),wwt=mke("col");function gke(t,e,{map:n,tableStart:r,table:i},s){const o=Array(s).fill(0).reduce((l,c,u)=>l+i.child(u).nodeSize,r),a=Array(n.width).fill(0).map((l,c)=>{const u=i.nodeAt(n.map[c]);return oC.type(t).createAndFill({alignment:u==null?void 0:u.attrs.alignment})});return e.insert(o,v2.type(t).create(null,a)),e}function xwt(t){const e=y2(t.$from);if(!e)return;const n=Xn.get(e.node);return n.cellsInRect({left:0,right:n.width,top:0,bottom:n.height}).map(r=>{const i=e.node.nodeAt(r),s=r+e.start;return{pos:s,start:s+1,node:i}})}function _wt(t){const e=xwt(t.selection);if(e&&e[0]){const n=t.doc.resolve(e[0].pos),r=e[e.length-1];if(r){const i=t.doc.resolve(r.pos);return U2e(t.setSelection(new xr(i,n)))}}return t}var QW=bt("GoToPrevTableCell",()=>()=>QSe(-1));Lt(QW,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});var JW=bt("GoToNextTableCell",()=>()=>QSe(1));Lt(JW,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});var eG=bt("ExitTable",t=>()=>(e,n)=>{if(!lc(e))return!1;const{$head:r}=e.selection,i=Hdt(r,md.type(t));if(!i)return!1;const{to:s}=i,o=e.tr.replaceWith(s,s,al.type(t).createAndFill());return o.setSelection(jt.near(o.doc.resolve(s),1)).scrollIntoView(),n==null||n(o),!0});Lt(eG,{displayName:"Command<breakTableCommand>",group:"Table"});var yke=bt("InsertTable",t=>({row:e,col:n}={})=>(r,i)=>{const{selection:s,tr:o}=r,{from:a}=s,l=RR(t,e,n),c=o.replaceSelectionWith(l),u=jt.findFrom(c.doc.resolve(a),1,!0);return u&&c.setSelection(u),i==null||i(c),!0});Lt(yke,{displayName:"Command<insertTableCommand>",group:"Table"});var tG=bt("MoveRow",()=>({from:t,to:e,pos:n}={})=>dvt({from:t??0,to:e??0,pos:n}));Lt(tG,{displayName:"Command<moveRowCommand>",group:"Table"});var nG=bt("MoveCol",()=>({from:t,to:e,pos:n}={})=>hvt({from:t??0,to:e??0,pos:n}));Lt(nG,{displayName:"Command<moveColCommand>",group:"Table"});var Ng=bt("SelectRow",()=>(t={index:0})=>(e,n)=>{const{tr:r}=e;return!!(n==null?void 0:n(bwt(t.index,t.pos)(r)))});Lt(Ng,{displayName:"Command<selectRowCommand>",group:"Table"});var Og=bt("SelectCol",()=>(t={index:0})=>(e,n)=>{const{tr:r}=e;return!!(n==null?void 0:n(wwt(t.index,t.pos)(r)))});Lt(Og,{displayName:"Command<selectColCommand>",group:"Table"});var vke=bt("SelectTable",()=>()=>(t,e)=>{const{tr:n}=t;return!!(e==null?void 0:e(_wt(n)))});Lt(vke,{displayName:"Command<selectTableCommand>",group:"Table"});var rG=bt("DeleteSelectedCells",()=>()=>(t,e)=>{const{selection:n}=t;if(!(n instanceof xr))return!1;const r=n.isRowSelection(),i=n.isColSelection();return r&&i?uvt(t,e):i?ivt(t,e):ovt(t,e)});Lt(rG,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});var iG=bt("AddColBefore",()=>()=>tvt);Lt(iG,{displayName:"Command<addColBeforeCommand>",group:"Table"});var sG=bt("AddColAfter",()=>()=>nvt);Lt(sG,{displayName:"Command<addColAfterCommand>",group:"Table"});var oG=bt("AddRowBefore",t=>()=>(e,n)=>{if(!lc(e))return!1;if(n){const r=N0(e);n(gke(t,e.tr,r,r.top))}return!0});Lt(oG,{displayName:"Command<addRowBeforeCommand>",group:"Table"});var aG=bt("AddRowAfter",t=>()=>(e,n)=>{if(!lc(e))return!1;if(n){const r=N0(e);n(gke(t,e.tr,r,r.bottom))}return!0});Lt(aG,{displayName:"Command<addRowAfterCommand>",group:"Table"});var lG=bt("SetAlign",()=>(t="left")=>avt("alignment",t));Lt(lG,{displayName:"Command<setAlignCommand>",group:"Table"});var bke=co(t=>new Sa(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(e,n,r,i)=>{var l,c;const s=e.doc.resolve(r);if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),md.type(t)))return null;const o=RR(t,Math.max(Number(((l=n.groups)==null?void 0:l.row)??0),2),Number((c=n.groups)==null?void 0:c.col)),a=e.tr.replaceRangeWith(r,i,o);return a.setSelection(mt.create(a.doc,r+3)).scrollIntoView()}));Lt(bke,{displayName:"InputRule<insertTableInputRule>",group:"Table"});var wke=Zft(t=>({run:(e,n,r)=>{if(r)return e;function i(c){var y;const u=c.childCount,d=((y=c.lastChild)==null?void 0:y.childCount)??0;if(u===0||d===0)return al.type(t).create();const h=c.firstChild;if(!(d>0&&h&&h.childCount===0))return c;if(u>=3){const v=c.child(1),b=[];for(let k=0;k<v.childCount;k++){const T=v.child(k);b.push(gx.type(t).create(T.attrs,T.content,T.marks))}const _=h.type.create(h.attrs,b),S=[];for(let k=2;k<u;k++)S.push(c.child(k));return c.type.create(c.attrs,[_,...S])}const f=Array(d).fill(0).map(()=>gx.type(t).createAndFill()),p=new We(De.from(f),0,0),g=h.replace(0,0,p);return c.replace(0,h.nodeSize,new We(De.from(g),0,0))}function s(c){const u=v2.type(t),d=[];let h=[],f=!1;function p(){if(h.length===0)return;const g=sC.type(t).createAndFill(),y=md.type(t).create(null,[g,...h]);d.push(i(y)),h=[]}return c.forEach(g=>{g.type===u?(f=!0,h.push(g)):(p(),d.push(g))}),p(),f?De.from(d):c}function o(c){let u=s(c),d=u!==c;const h=[];return u.forEach(f=>{if(f.type===md.type(t)){const p=i(f);p!==f&&(d=!0),h.push(p)}else if(f.childCount>0){const p=o(f.content);p!==f.content?(d=!0,h.push(f.copy(p))):h.push(f)}else h.push(f)}),d?De.from(h):c}function a(c){const u=[],d=[];c.forEach(h=>d.push(h));for(let h=0;h<d.length;h++){const f=d[h],p=d[h+1];f.type===al.type(t)&&f.content.size===0&&p&&p.type===md.type(t)||u.push(f)}return u.length<d.length?De.from(u):c}let l=o(e.content);return l=a(l),new We(De.from(l),e.openStart,e.openEnd)}}));Lt(wke,{displayName:"PasteRule<table>",group:"Table"});var cG=ka("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:t=>{const e=t.get(je);return()=>e.call(JW.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:t=>{const e=t.get(je);return()=>e.call(QW.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:t=>{const e=t.get(je);return()=>e.call(eG.key)}}});Lt(cG.ctx,{displayName:"KeymapCtx<table>",group:"Table"});Lt(cG.shortcuts,{displayName:"Keymap<table>",group:"Table"});var fD="footnote_definition",hse="footnoteDefinition",uG=xi("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${fD}"]`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw su(t);return{label:t.dataset.label}},contentElement:"dd"}],toDOM:t=>{const e=t.attrs.label;return["dl",{"data-label":e,"data-type":fD},["dt",e],["dd",0]]},parseMarkdown:{match:({type:t})=>t===hse,runner:(t,e,n)=>{t.openNode(n,{label:e.label}).next(e.children).closeNode()}},toMarkdown:{match:t=>t.type.name===fD,runner:(t,e)=>{t.openNode(hse,void 0,{label:e.attrs.label,identifier:e.attrs.label}).next(e.content).closeNode()}}}));Lt(uG.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"});Lt(uG.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});var pD="footnote_reference",dG=xi("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${pD}"]`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw su(t);return{label:t.dataset.label}}}],toDOM:t=>{const e=t.attrs.label;return["sup",{"data-label":e,"data-type":pD},e]},parseMarkdown:{match:({type:t})=>t==="footnoteReference",runner:(t,e,n)=>{t.addNode(n,{label:e.label})}},toMarkdown:{match:t=>t.type.name===pD,runner:(t,e)=>{t.addNode("footnoteReference",void 0,void 0,{label:e.attrs.label,identifier:e.attrs.label})}}}));Lt(dG.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"});Lt(dG.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});var hG=ac.extendSchema(t=>e=>{const n=t(e);return{...n,attrs:{...n.attrs,checked:{default:null,validate:"boolean|null"}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:r=>{if(!(r instanceof HTMLElement))throw su(r);return{label:r.dataset.label,listType:r.dataset.listType,spread:r.dataset.spread,checked:r.dataset.checked?r.dataset.checked==="true":null}}},...(n==null?void 0:n.parseDOM)||[]],toDOM:r=>n.toDOM&&r.attrs.checked==null?n.toDOM(r):["li",{"data-item-type":"task","data-label":r.attrs.label,"data-list-type":r.attrs.listType,"data-spread":r.attrs.spread,"data-checked":r.attrs.checked},0],parseMarkdown:{match:({type:r})=>r==="listItem",runner:(r,i,s)=>{if(i.checked==null){n.parseMarkdown.runner(r,i,s);return}const o=i.label!=null?`${i.label}.`:"•",a=i.checked!=null?!!i.checked:null,l=i.label!=null?"ordered":"bullet",c=i.spread!=null?`${i.spread}`:"true";r.openNode(s,{label:o,listType:l,spread:c,checked:a}),r.next(i.children),r.closeNode()}},toMarkdown:{match:r=>r.type.name==="list_item",runner:(r,i)=>{if(i.attrs.checked==null){n.toMarkdown.runner(r,i);return}const s=i.attrs.label,o=i.attrs.listType,a=i.attrs.spread==="true",l=i.attrs.checked;r.openNode("listItem",void 0,{label:s,listType:o,spread:a,checked:l}),r.next(i.content),r.closeNode()}}}});Lt(hG.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"});Lt(hG.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});var xke=co(()=>new Sa(/^\[(?<checked>\s|x)\]\s$/,(t,e,n,r)=>{var u;const i=t.doc.resolve(n);let s=0,o=i.node(s);for(;o&&o.type.name!=="list_item";)s--,o=i.node(s);if(!o||o.attrs.checked!=null)return null;const a=((u=e.groups)==null?void 0:u.checked)==="x",l=i.before(s),c=t.tr;return c.deleteRange(n,r).setNodeMarkup(l,void 0,{...o.attrs,checked:a}),c}));Lt(xke,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});var Swt=[XW,cG].flat(),kwt=[bke,xke],Cwt=[pke],Ewt=[wke],_ke=Sr(()=>Vvt);Lt(_ke,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"});var Twt=Sr(()=>_vt({}));Lt(Twt,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});var Ske=Sr(()=>Nvt({allowTableNodeSelection:!0}));Lt(Ske,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});var fG=Nd("remarkGFM",()=>vwt);Lt(fG.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});Lt(fG.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});var Awt=new Vn("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");function Iwt(t,e){let n=0;return e.forEach((r,i,s)=>{r===t&&(n=s)}),n}var kke=Sr(()=>new Fn({key:Awt,appendTransaction:(t,e,n)=>{let r;const i=(s,o)=>{if(r||(r=n.tr),s.type.name!=="table_cell")return;const a=n.doc.resolve(o),l=a.node(a.depth),c=a.node(a.depth-1).firstChild;if(!c)return;const u=Iwt(s,l),d=c.maybeChild(u);if(!d)return;const h=d.attrs.alignment;h!==s.attrs.alignment&&r.setNodeMarkup(o,void 0,{...s.attrs,alignment:h})};return e.doc!==n.doc&&n.doc.descendants(i),r}}));Lt(kke,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});var Rwt=[kke,_ke,fG,Ske].flat(),Mwt=[hG,md,sC,v2,gx,oC,uG,dG,ZW,Dy].flat(),Nwt=[JW,QW,eG,yke,tG,nG,Ng,Og,vke,rG,oG,aG,iG,sG,lG,rC],Owt=[Mwt,kwt,Ewt,Cwt,Swt,Nwt,Rwt].flat();const Dwt=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=mG(t.state,n.from);return r.line?Pwt(t):r.block?zwt(t):!1};function pG(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=t(e,n);return i?(r(n.update(i)),!0):!1}}const Pwt=pG(Fwt,0),Lwt=pG(Cke,0),zwt=pG((t,e)=>Cke(t,e,Bwt(e)),0);function mG(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const o4=50;function jwt(t,{open:e,close:n},r,i){let s=t.sliceDoc(r-o4,r),o=t.sliceDoc(i,i+o4),a=/\s*$/.exec(s)[0].length,l=/^\s*/.exec(o)[0].length,c=s.length-a;if(s.slice(c-e.length,c)==e&&o.slice(l,l+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let u,d;i-r<=2*o4?u=d=t.sliceDoc(r,i):(u=t.sliceDoc(r,r+o4),d=t.sliceDoc(i-o4,i));let h=/^\s*/.exec(u)[0].length,f=/\s*$/.exec(d)[0].length,p=d.length-f-n.length;return u.slice(h,h+e.length)==e&&d.slice(p,p+n.length)==n?{open:{pos:r+h+e.length,margin:/\s/.test(u.charAt(h+e.length))?1:0},close:{pos:i-f-n.length,margin:/\s/.test(d.charAt(p-1))?1:0}}:null}function Bwt(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),i=n.to<=r.to?r:t.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function Cke(t,e,n=e.selection.ranges){let r=n.map(s=>mG(e,s.from).block);if(!r.every(s=>s))return null;let i=n.map((s,o)=>jwt(e,r[o],s.from,s.to));if(t!=2&&!i.every(s=>s))return{changes:e.changes(n.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(t!=1&&i.some(s=>s)){let s=[];for(let o=0,a;o<i.length;o++)if(a=i[o]){let l=r[o],{open:c,close:u}=a;s.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:s}}return null}function Fwt(t,e,n=e.selection.ranges){let r=[],i=-1;e:for(let{from:s,to:o}of n){let a=r.length,l=1e9,c;for(let u=s;u<=o;){let d=e.doc.lineAt(u);if(c==null&&(c=mG(e,d.from).line,!c))continue e;if(d.from>i&&(s==o||o>d.from)){i=d.from;let h=/^\s*/.exec(d.text)[0].length,f=h==d.length,p=d.text.slice(h,h+c.length)==c?h:-1;h<d.text.length&&h<l&&(l=h),r.push({line:d,comment:p,token:c,indent:h,empty:f,single:!1})}u=d.to+1}if(l<1e9)for(let u=a;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=l);r.length==a+1&&(r[a].single=!0)}if(t!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:u,single:d}of r)(d||!u)&&s.push({from:a.from+c,insert:l+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,u=c+l.length;o.text[u-o.from]==" "&&u++,s.push({from:c,to:u})}return{changes:s}}return null}const EB=Tf.define(),Vwt=Tf.define(),$wt=st.define(),Eke=st.define({combine(t){return Id(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,i)=>e(r,i)||n(r,i)})}}),Tke=Vs.define({create(){return cS.empty},update(t,e){let n=e.state.facet(Eke),r=e.annotation(EB);if(r){let l=ha.fromTransaction(e,r.selection),c=r.side,u=c==0?t.undone:t.done;return l?u=R8(u,u.length,n.minDepth,l):u=Rke(u,e.startState.selection),new cS(c==0?r.rest:u,c==0?u:r.rest)}let i=e.annotation(Vwt);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(Mo.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let s=ha.fromTransaction(e),o=e.annotation(Mo.time),a=e.annotation(Mo.userEvent);return s?t=t.addChanges(s,o,a,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,n.newGroupDelay)),(i=="full"||i=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new cS(t.done.map(ha.fromJSON),t.undone.map(ha.fromJSON))}});function Hwt(t={}){return[Tke,Eke.of(t),ht.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?Ake:e.inputType=="historyRedo"?TB:null;return r?(e.preventDefault(),r(n)):!1}})]}function MR(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let i=n.field(Tke,!1);if(!i)return!1;let s=i.pop(t,n,e);return s?(r(s),!0):!1}}const Ake=MR(0,!1),TB=MR(1,!1),Uwt=MR(0,!0),qwt=MR(1,!0);class ha{constructor(e,n,r,i,s){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new ha(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new ha(e.changes&&Qc.fromJSON(e.changes),[],e.mapped&&dd.fromJSON(e.mapped),e.startSelection&&be.fromJSON(e.startSelection),e.selectionsAfter.map(be.fromJSON))}static fromTransaction(e,n){let r=Vl;for(let i of e.startState.facet($wt)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new ha(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,Vl)}static selection(e){return new ha(void 0,Vl,void 0,void 0,e)}}function R8(t,e,n,r){let i=e+1>n+20?e-n-1:0,s=t.slice(i,e);return s.push(r),s}function Wwt(t,e){let n=[],r=!1;return t.iterChangedRanges((i,s)=>n.push(i,s)),e.iterChangedRanges((i,s,o,a)=>{for(let l=0;l<n.length;){let c=n[l++],u=n[l++];a>=c&&o<=u&&(r=!0)}}),r}function Gwt(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function Ike(t,e){return t.length?e.length?t.concat(e):t:e}const Vl=[],Kwt=200;function Rke(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Kwt));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),R8(t,t.length-1,1e9,n.setSelAfter(r)))}else return[ha.selection([e])]}function Ywt(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function mD(t,e){if(!t.length)return t;let n=t.length,r=Vl;for(;n;){let i=Zwt(t[n-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=t.slice(0,n);return s[n-1]=i,s}else e=i.mapped,n--,r=i.selectionsAfter}return r.length?[ha.selection(r)]:Vl}function Zwt(t,e,n){let r=Ike(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):Vl,n);if(!t.changes)return ha.selection(r);let i=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new ha(i,Ut.mapEffects(t.effects,e),o,t.startSelection.map(s),r)}const Xwt=/^(input\.type|delete)($|\.)/;let cS=class F4{constructor(e,n,r=0,i=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new F4(this.done,this.undone):this}addChanges(e,n,r,i,s){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||Xwt.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,Wwt(a.changes,e.changes))||r=="input.type.compose")?o=R8(o,o.length-1,i.minDepth,new ha(e.changes.compose(a.changes),Ike(Ut.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,Vl)):o=R8(o,o.length,i.minDepth,e),new F4(o,Vl,n,r)}addSelection(e,n,r,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Vl;return s.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Gwt(s[s.length-1],e)?this:new F4(Rke(this.done,e),this.undone,n,r)}addMapping(e){return new F4(mD(this.done,e),mD(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,r){let i=e==0?this.done:this.undone;if(i.length==0)return null;let s=i[i.length-1],o=s.selectionsAfter[0]||(s.startSelection?s.startSelection.map(s.changes.invertedDesc,1):n.selection);if(r&&s.selectionsAfter.length)return n.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:EB.of({side:e,rest:Ywt(i),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let a=i.length==1?Vl:i.slice(0,i.length-1);return s.mapped&&(a=mD(a,s.mapped)),n.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:EB.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}};cS.empty=new cS(Vl,Vl);const Qwt=[{key:"Mod-z",run:Ake,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:TB,preventDefault:!0},{linux:"Ctrl-Shift-z",run:TB,preventDefault:!0},{key:"Mod-u",run:Uwt,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:qwt,preventDefault:!0}];function b2(t,e){return be.create(t.ranges.map(e),t.mainIndex)}function au(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function lu({state:t,dispatch:e},n){let r=b2(t.selection,n);return r.eq(t.selection,!0)?!1:(e(au(t,r)),!0)}function NR(t,e){return be.cursor(e?t.to:t.from)}function Mke(t,e){return lu(t,n=>n.empty?t.moveByChar(n,e):NR(n,e))}function uo(t){return t.textDirectionAt(t.state.selection.main.head)==vr.LTR}const Nke=t=>Mke(t,!uo(t)),Oke=t=>Mke(t,uo(t));function Dke(t,e){return lu(t,n=>n.empty?t.moveByGroup(n,e):NR(n,e))}const Jwt=t=>Dke(t,!uo(t)),ext=t=>Dke(t,uo(t));function txt(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function OR(t,e,n){let r=zs(t).resolveInner(e.head),i=n?hn.closedBy:hn.openedBy;for(let l=e.head;;){let c=n?r.childAfter(l):r.childBefore(l);if(!c)break;txt(t,c,i)?r=c:l=n?c.to:c.from}let s=r.type.prop(i),o,a;return s&&(o=n?Qu(t,r.from,1):Qu(t,r.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?r.to:r.from,be.cursor(a,n?-1:1)}const nxt=t=>lu(t,e=>OR(t.state,e,!uo(t))),rxt=t=>lu(t,e=>OR(t.state,e,uo(t)));function Pke(t,e){return lu(t,n=>{if(!n.empty)return NR(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const Lke=t=>Pke(t,!1),zke=t=>Pke(t,!0);function jke(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,i;if(e){for(let s of t.state.facet(ht.scrollMargins)){let o=s(t);o!=null&&o.top&&(n=Math.max(o==null?void 0:o.top,n)),o!=null&&o.bottom&&(r=Math.max(o==null?void 0:o.bottom,r))}i=t.scrollDOM.clientHeight-n-r}else i=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,i-5)}}function Bke(t,e){let n=jke(t),{state:r}=t,i=b2(r.selection,o=>o.empty?t.moveVertically(o,e,n.height):NR(o,e));if(i.eq(r.selection))return!1;let s;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,c=a.bottom-n.marginBottom;o&&o.top>l&&o.bottom<c&&(s=ht.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-l}))}return t.dispatch(au(r,i),{effects:s}),!0}const fse=t=>Bke(t,!1),AB=t=>Bke(t,!0);function O0(t,e,n){let r=t.lineBlockAt(e.head),i=t.moveToLineBoundary(e,n);if(i.head==e.head&&i.head!=(n?r.to:r.from)&&(i=t.moveToLineBoundary(e,n,!1)),!n&&i.head==r.from&&r.length){let s=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(i=be.cursor(r.from+s))}return i}const ixt=t=>lu(t,e=>O0(t,e,!0)),sxt=t=>lu(t,e=>O0(t,e,!1)),oxt=t=>lu(t,e=>O0(t,e,!uo(t))),axt=t=>lu(t,e=>O0(t,e,uo(t))),lxt=t=>lu(t,e=>be.cursor(t.lineBlockAt(e.head).from,1)),cxt=t=>lu(t,e=>be.cursor(t.lineBlockAt(e.head).to,-1));function uxt(t,e,n){let r=!1,i=b2(t.selection,s=>{let o=Qu(t,s.head,-1)||Qu(t,s.head,1)||s.head>0&&Qu(t,s.head-1,1)||s.head<t.doc.length&&Qu(t,s.head+1,-1);if(!o||!o.end)return s;r=!0;let a=o.start.from==s.head?o.end.to:o.end.from;return be.cursor(a)});return r?(e(au(t,i)),!0):!1}const dxt=({state:t,dispatch:e})=>uxt(t,e);function cc(t,e){let n=b2(t.state.selection,r=>{let i=e(r);return be.range(r.anchor,i.head,i.goalColumn,i.bidiLevel||void 0,i.assoc)});return n.eq(t.state.selection)?!1:(t.dispatch(au(t.state,n)),!0)}function Fke(t,e){return cc(t,n=>t.moveByChar(n,e))}const Vke=t=>Fke(t,!uo(t)),$ke=t=>Fke(t,uo(t));function Hke(t,e){return cc(t,n=>t.moveByGroup(n,e))}const hxt=t=>Hke(t,!uo(t)),fxt=t=>Hke(t,uo(t)),pxt=t=>cc(t,e=>OR(t.state,e,!uo(t))),mxt=t=>cc(t,e=>OR(t.state,e,uo(t)));function Uke(t,e){return cc(t,n=>t.moveVertically(n,e))}const qke=t=>Uke(t,!1),Wke=t=>Uke(t,!0);function Gke(t,e){return cc(t,n=>t.moveVertically(n,e,jke(t).height))}const pse=t=>Gke(t,!1),mse=t=>Gke(t,!0),gxt=t=>cc(t,e=>O0(t,e,!0)),yxt=t=>cc(t,e=>O0(t,e,!1)),vxt=t=>cc(t,e=>O0(t,e,!uo(t))),bxt=t=>cc(t,e=>O0(t,e,uo(t))),wxt=t=>cc(t,e=>be.cursor(t.lineBlockAt(e.head).from)),xxt=t=>cc(t,e=>be.cursor(t.lineBlockAt(e.head).to)),gse=({state:t,dispatch:e})=>(e(au(t,{anchor:0})),!0),yse=({state:t,dispatch:e})=>(e(au(t,{anchor:t.doc.length})),!0),vse=({state:t,dispatch:e})=>(e(au(t,{anchor:t.selection.main.anchor,head:0})),!0),bse=({state:t,dispatch:e})=>(e(au(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),_xt=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),Sxt=({state:t,dispatch:e})=>{let n=DR(t).map(({from:r,to:i})=>be.range(r,Math.min(i+1,t.doc.length)));return e(t.update({selection:be.create(n),userEvent:"select"})),!0},kxt=({state:t,dispatch:e})=>{let n=b2(t.selection,r=>{let i=zs(t),s=i.resolveStack(r.from,1);if(r.empty){let o=i.resolveStack(r.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:a}=o;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&o.next)return be.range(a.to,a.from)}return r});return n.eq(t.selection)?!1:(e(au(t,n)),!0)};function Kke(t,e){let{state:n}=t,r=n.selection,i=n.selection.ranges.slice();for(let s of n.selection.ranges){let o=n.doc.lineAt(s.head);if(e?o.to<t.state.doc.length:o.from>0)for(let a=s;;){let l=t.moveVertically(a,e);if(l.head<o.from||l.head>o.to){i.some(c=>c.head==l.head)||i.push(l);break}else{if(l.head==a.head)break;a=l}}}return i.length==r.ranges.length?!1:(t.dispatch(au(n,be.create(i,i.length-1))),!0)}const Cxt=t=>Kke(t,!1),Ext=t=>Kke(t,!0),Txt=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=be.create([n.main]):n.main.empty||(r=be.create([be.cursor(n.main.head)])),r?(e(au(t,r)),!0):!1};function aC(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,i=r.changeByRange(s=>{let{from:o,to:a}=s;if(o==a){let l=e(s);l<o?(n="delete.backward",l=ZE(t,l,!1)):l>o&&(n="delete.forward",l=ZE(t,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=ZE(t,o,!1),a=ZE(t,a,!0);return o==a?{range:s}:{changes:{from:o,to:a},range:be.cursor(o,o<s.head?-1:1)}});return i.changes.empty?!1:(t.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?ht.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function ZE(t,e,n){if(t instanceof ht)for(let r of t.state.facet(ht.atomicRanges).map(i=>i(t)))r.between(e,e,(i,s)=>{i<e&&s>e&&(e=n?s:i)});return e}const Yke=(t,e,n)=>aC(t,r=>{let i=r.from,{state:s}=t,o=s.doc.lineAt(i),a,l;if(n&&!e&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,i-o.from))){if(a[a.length-1]==" ")return i-1;let c=a2(a,s.tabSize),u=c%Q1(s)||Q1(s);for(let d=0;d<u&&a[a.length-1-d]==" ";d++)i--;l=i}else l=fs(o.text,i-o.from,e,e)+o.from,l==i&&o.number!=(e?s.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,i-o.from))&&(l=fs(o.text,l-o.from,!1,!1)+o.from);return l}),IB=t=>Yke(t,!1,!0),Zke=t=>Yke(t,!0,!1),Xke=(t,e)=>aC(t,n=>{let r=n.head,{state:i}=t,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let a=null;;){if(r==(e?s.to:s.from)){r==n.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let l=fs(s.text,r-s.from,e)+s.from,c=s.text.slice(Math.min(r,l)-s.from,Math.max(r,l)-s.from),u=o(c);if(a!=null&&u!=a)break;(c!=" "||r!=n.head)&&(a=u),r=l}return r}),Qke=t=>Xke(t,!1),Axt=t=>Xke(t,!0),Ixt=t=>aC(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),Rxt=t=>aC(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),Mxt=t=>aC(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),Nxt=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:jn.of(["",""])},range:be.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},Oxt=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let i=r.from,s=t.doc.lineAt(i),o=i==s.from?i-1:fs(s.text,i-s.from,!1)+s.from,a=i==s.to?i+1:fs(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:a,insert:t.doc.slice(i,a).append(t.doc.slice(o,i))},range:be.cursor(a)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function DR(t){let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.from),s=t.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=t.doc.lineAt(r.to-1)),n>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(r)}else e.push({from:i.from,to:s.to,ranges:[r]});n=s.number+1}return e}function Jke(t,e,n){if(t.readOnly)return!1;let r=[],i=[];for(let s of DR(t)){if(n?s.to==t.doc.length:s.from==0)continue;let o=t.doc.lineAt(n?s.to+1:s.from-1),a=o.length+1;if(n){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+t.lineBreak});for(let l of s.ranges)i.push(be.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:t.lineBreak+o.text});for(let l of s.ranges)i.push(be.range(l.anchor-a,l.head-a))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:be.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Dxt=({state:t,dispatch:e})=>Jke(t,e,!1),Pxt=({state:t,dispatch:e})=>Jke(t,e,!0);function e5e(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of DR(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});let i=t.changes(r);return e(t.update({changes:i,selection:t.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Lxt=({state:t,dispatch:e})=>e5e(t,e,!1),zxt=({state:t,dispatch:e})=>e5e(t,e,!0),jxt=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(DR(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),r=b2(e.selection,i=>{let s;if(t.lineWrapping){let o=t.lineBlockAt(i.head),a=t.coordsAtPos(i.head,i.assoc||1);a&&(s=o.bottom+t.documentTop-a.bottom+t.defaultLineHeight/2)}return t.moveVertically(i,!0,s)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Bxt(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=zs(t).resolveInner(e),r=n.childBefore(e),i=n.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(hn.closedBy))&&s.indexOf(i.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(i.from).from&&!/\S/.test(t.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const wse=t5e(!1),Fxt=t5e(!0);function t5e(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,a=e.doc.lineAt(s),l=!t&&s==o&&Bxt(e,s);t&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new HI(e,{simulateBreak:s,simulateDoubleBreak:!!l}),u=LU(c,s);for(u==null&&(u=a2(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:s,to:o}=l:s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s))&&(s=a.from);let d=["",ak(e,u)];return l&&d.push(ak(e,c.lineIndent(a.from,-1))),{changes:{from:s,to:o,insert:jn.of(d)},range:be.cursor(s+1+d[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function gG(t,e){let n=-1;return t.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let a=t.doc.lineAt(o);a.number>n&&(r.empty||r.to>a.from)&&(e(a,i,r),n=a.number),o=a.to+1}let s=t.changes(i);return{changes:i,range:be.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const Vxt=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new HI(t,{overrideIndentation:s=>{let o=n[s];return o??-1}}),i=gG(t,(s,o,a)=>{let l=LU(r,s.from);if(l==null)return;/\S/.test(s.text)||(l=0);let c=/^\s*/.exec(s.text)[0],u=ak(t,l);(c!=u||a.from<s.from+c.length)&&(n[s.from]=l,o.push({from:s.from,to:s.from+c.length,insert:u}))});return i.changes.empty||e(t.update(i,{userEvent:"indent"})),!0},n5e=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(gG(t,(n,r)=>{r.push({from:n.from,insert:t.facet($I)})}),{userEvent:"input.indent"})),!0),r5e=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(gG(t,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let s=a2(i,t.tabSize),o=0,a=ak(t,Math.max(0,s-Q1(t)));for(;o<i.length&&o<a.length&&i.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+i.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),$xt=t=>(t.setTabFocusMode(),!0),Hxt=[{key:"Ctrl-b",run:Nke,shift:Vke,preventDefault:!0},{key:"Ctrl-f",run:Oke,shift:$ke},{key:"Ctrl-p",run:Lke,shift:qke},{key:"Ctrl-n",run:zke,shift:Wke},{key:"Ctrl-a",run:lxt,shift:wxt},{key:"Ctrl-e",run:cxt,shift:xxt},{key:"Ctrl-d",run:Zke},{key:"Ctrl-h",run:IB},{key:"Ctrl-k",run:Ixt},{key:"Ctrl-Alt-h",run:Qke},{key:"Ctrl-o",run:Nxt},{key:"Ctrl-t",run:Oxt},{key:"Ctrl-v",run:AB}],Uxt=[{key:"ArrowLeft",run:Nke,shift:Vke,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Jwt,shift:hxt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:oxt,shift:vxt,preventDefault:!0},{key:"ArrowRight",run:Oke,shift:$ke,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:ext,shift:fxt,preventDefault:!0},{mac:"Cmd-ArrowRight",run:axt,shift:bxt,preventDefault:!0},{key:"ArrowUp",run:Lke,shift:qke,preventDefault:!0},{mac:"Cmd-ArrowUp",run:gse,shift:vse},{mac:"Ctrl-ArrowUp",run:fse,shift:pse},{key:"ArrowDown",run:zke,shift:Wke,preventDefault:!0},{mac:"Cmd-ArrowDown",run:yse,shift:bse},{mac:"Ctrl-ArrowDown",run:AB,shift:mse},{key:"PageUp",run:fse,shift:pse},{key:"PageDown",run:AB,shift:mse},{key:"Home",run:sxt,shift:yxt,preventDefault:!0},{key:"Mod-Home",run:gse,shift:vse},{key:"End",run:ixt,shift:gxt,preventDefault:!0},{key:"Mod-End",run:yse,shift:bse},{key:"Enter",run:wse,shift:wse},{key:"Mod-a",run:_xt},{key:"Backspace",run:IB,shift:IB,preventDefault:!0},{key:"Delete",run:Zke,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Qke,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Axt,preventDefault:!0},{mac:"Mod-Backspace",run:Rxt,preventDefault:!0},{mac:"Mod-Delete",run:Mxt,preventDefault:!0}].concat(Hxt.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),i5e=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:nxt,shift:pxt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:rxt,shift:mxt},{key:"Alt-ArrowUp",run:Dxt},{key:"Shift-Alt-ArrowUp",run:Lxt},{key:"Alt-ArrowDown",run:Pxt},{key:"Shift-Alt-ArrowDown",run:zxt},{key:"Mod-Alt-ArrowUp",run:Cxt},{key:"Mod-Alt-ArrowDown",run:Ext},{key:"Escape",run:Txt},{key:"Mod-Enter",run:Fxt},{key:"Alt-l",mac:"Ctrl-l",run:Sxt},{key:"Mod-i",run:kxt,preventDefault:!0},{key:"Mod-[",run:r5e},{key:"Mod-]",run:n5e},{key:"Mod-Alt-\\",run:Vxt},{key:"Shift-Mod-k",run:jxt},{key:"Shift-Mod-\\",run:dxt},{key:"Mod-/",run:Dwt},{key:"Alt-A",run:Lwt},{key:"Ctrl-m",mac:"Shift-Alt-m",run:$xt}].concat(Uxt),qxt={key:"Tab",run:n5e,shift:r5e};var M8=200,ms=function(){};ms.prototype.append=function(e){return e.length?(e=ms.from(e),!this.length&&e||e.length<M8&&this.leafAppend(e)||this.length<M8&&e.leafPrepend(this)||this.appendInner(e)):this};ms.prototype.prepend=function(e){return e.length?ms.from(e).append(this):this};ms.prototype.appendInner=function(e){return new Wxt(this,e)};ms.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?ms.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};ms.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ms.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};ms.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i};ms.from=function(e){return e instanceof ms?e:e&&e.length?new s5e(e):ms.empty};var s5e=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=M8)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=M8)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(ms);ms.empty=new s5e([]);var Wxt=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(ms);const Gxt=500;class Nc{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,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,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((d,h)=>{if(!d.step){i||(i=this.remapping(r,h+1),s=i.maps.length),s--,u.push(d);return}if(i){u.push(new Au(d.map));let f=d.step.map(i.slice(s)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new Au(p,void 0,void 0,c.length+u.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(s)):d.selection,l=new Nc(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),h=new Au(e.mapping.maps[u],d,n),f;(f=l&&l.merge(h))&&(h=f,u?s.pop():a=a.slice(0,a.length-1)),s.push(h),n&&(o++,n=void 0),i||(l=h)}let c=o-r.depth;return c>Yxt&&(a=Kxt(a,c),o-=c),new Nc(a.append(s),o)}remapping(e,n){let r=new dk;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Nc(this.items.append(e.map(n=>new Au(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=n;this.items.forEach(h=>{let f=s.getMirror(--l);if(f==null)return;o=Math.min(o,f);let p=s.maps[f];if(h.step){let g=e.steps[f].invert(e.docs[f]),y=h.selection&&h.selection.map(s.slice(l+1,f));y&&a++,r.push(new Au(p,g,y))}else r.push(new Au(p))},i);let c=[];for(let h=n;h<o;h++)c.push(new Au(s.maps[h]));let u=this.items.slice(0,i).append(c).append(r),d=new Nc(u,a);return d.emptyItemCount()>Gxt&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=o.selection&&o.selection.map(n.slice(r));u&&s++;let d=new Au(c.invert(),l,u),h,f=i.length-1;(h=i.length&&i[f].merge(d))?i[f]=h:i.push(d)}}else o.map&&r--},this.items.length,0),new Nc(ms.from(i.reverse()),s)}}Nc.empty=new Nc(ms.empty,0);function Kxt(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class Au{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Au(n.getMap().invert(),n,this.selection)}}}class vp{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const Yxt=20;function Zxt(t,e,n,r){let i=n.getMeta(x1),s;if(i)return i.historyState;n.getMeta(Jxt)&&(t=new vp(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(x1))return o.getMeta(x1).redo?new vp(t.done.addTransform(n,void 0,r,N6(e)),t.undone,xse(n.mapping.maps),t.prevTime,t.prevComposition):new vp(t.done,t.undone.addTransform(n,void 0,r,N6(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Xxt(n,t.prevRanges)),c=o?gD(t.prevRanges,n.mapping):xse(n.mapping.maps);return new vp(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,N6(e)),Nc.empty,c,n.time,a??t.prevComposition)}else return(s=n.getMeta("rebased"))?new vp(t.done.rebased(n,s),t.undone.rebased(n,s),gD(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new vp(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),gD(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Xxt(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function xse(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,o)=>e.push(s,o));return e}function gD(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function Qxt(t,e,n){let r=N6(e),i=x1.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),l=new vp(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(x1,{redo:n,historyState:l})}let yD=!1,_se=null;function N6(t){let e=t.plugins;if(_se!=e){yD=!1,_se=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){yD=!0;break}}return yD}const x1=new Vn("history"),Jxt=new Vn("closeHistory");function e2t(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Fn({key:x1,state:{init(){return new vp(Nc.empty,Nc.empty,null,0,-1)},apply(e,n,r){return Zxt(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?PR:r=="historyRedo"?yx:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function o5e(t,e){return(n,r)=>{let i=x1.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=Qxt(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const PR=o5e(!1,!0),yx=o5e(!0,!0);var t2t=Object.defineProperty,Sse=Object.getOwnPropertySymbols,n2t=Object.prototype.hasOwnProperty,r2t=Object.prototype.propertyIsEnumerable,kse=(t,e,n)=>e in t?t2t(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,i2t=(t,e)=>{for(var n in e||(e={}))n2t.call(e,n)&&kse(t,n,e[n]);if(Sse)for(var n of Sse(e))r2t.call(e,n)&&kse(t,n,e[n]);return t};function a5e(t,e){return Object.assign(t,{meta:i2t({package:"@milkdown/components"},e)}),t}const s2t={extensions:[],languages:[],expandIcon:"⬇",searchIcon:"🔍",clearSearchIcon:"⌫",searchPlaceholder:"Search language",noResultText:"No result",copyText:"Copy",copyIcon:"📋",onCopy:()=>{},renderLanguage:t=>t,renderPreview:()=>null,previewToggleButton:t=>t?"Edit":"Hide",previewLabel:"Preview",previewLoading:"Loading..."},lC=xn(s2t,"codeBlockConfigCtx");a5e(lC,{displayName:"Config<code-block>",group:"CodeBlock"});class o2t{constructor(e){this.languages=e,this.map={},e.forEach(n=>{n.alias.forEach(r=>{this.map[r]=n})})}getAll(){return this.languages.map(e=>({name:e.name,alias:e.alias}))}load(e){const r=this.map[e.toLowerCase()];return r?r.support?Promise.resolve(r.support):r.load():Promise.resolve(void 0)}}function cC(...t){}cC(X);function Sb({icon:t,class:e,onClick:n}){return X("span",{class:ji("milkdown-icon",e),onPointerdown:n,innerHTML:t?dl.sanitize(t.trim()):void 0})}Sb.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};var a2t=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())});cC(X,mr);function l2t(t){return a2t(this,null,function*(){try{return navigator.clipboard.writeText(t)}catch{const n=document.createElement("textarea"),r=document.activeElement;n.value=t,n.setAttribute("readonly",""),n.style.contain="strict",n.style.position="absolute",n.style.left="-9999px",n.style.fontSize="12pt";const i=document.getSelection(),s=i?i.rangeCount>0&&i.getRangeAt(0):null;document.body.appendChild(n),n.select(),n.selectionStart=0,n.selectionEnd=t.length,document.execCommand("copy"),document.body.removeChild(n),s&&(i.removeAllRanges(),i.addRange(s)),r&&r.focus()}})}const c2t=es({props:{copyText:{type:String,required:!0},copyIcon:{type:String,required:!0},onCopy:{type:Function,required:!0},text:{type:String,required:!0}},setup(t){const e=()=>{l2t(t.text).then(()=>t.onCopy(t.text)).catch(console.error)};return()=>X(mr,null,X("button",{type:"button",class:"copy-button",onClick:e},X(Sb,{icon:t.copyIcon}),t.copyText))}});cC(X,mr);const u2t=es({props:{language:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},config:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0}},setup({language:t,config:e,setLanguage:n,getAllLanguages:r,getReadOnly:i}){const s=nt(),o=nt(!1),a=nt(),l=nt(),c=nt("");qh([o,s,l],()=>{c.value="";const g=s.value,y=l.value;!g||!y||_d(g,y,{placement:"bottom-start"}).then(({x:v,y:b})=>{Object.assign(y.style,{left:`${v}px`,top:`${b}px`})}).catch(console.error)});const u=g=>{if(g.preventDefault(),g.stopPropagation(),i())return;const y=!o.value;o.value=y,y&&setTimeout(()=>{var v;return(v=a.value)==null?void 0:v.focus()},0)},d=g=>{const y=g.target;c.value=y.value},h=g=>{g.key==="Escape"&&(c.value="")},f=Ll(()=>{var g;if(!o.value)return[];const y=(g=r())!=null?g:[],v=y.find(_=>_.name.toLowerCase()===t.value.toLowerCase()),b=y.filter(_=>{const S=c.value.toLowerCase();return(_.name.toLowerCase().includes(S)||_.alias.some(k=>k.toLowerCase().includes(S)))&&_!==v});return b.length===0?[]:v?[v,...b]:b}),p=g=>{const y=g.target;if(s.value&&s.value.contains(y))return;const v=l.value,b=s.value;!b||!v||b.dataset.expanded==="true"&&(v.contains(y)||(o.value=!1))};return m2(()=>{window.addEventListener("click",p)}),g2(()=>{window.removeEventListener("click",p)}),()=>X(mr,null,X("button",{type:"button",ref:s,class:"language-button",onClick:u,"data-expanded":String(o.value)},t.value||"Text",X("div",{class:"expand-icon"},X(Sb,{icon:e.expandIcon}))),X("div",{ref:l,class:"language-picker"},o.value?X("div",{class:"list-wrapper"},X("div",{class:"search-box"},X("div",{class:"search-icon"},X(Sb,{icon:e.searchIcon})),X("input",{ref:a,class:"search-input",placeholder:e.searchPlaceholder,value:c.value,onInput:d,onKeydown:h}),X("div",{class:ji("clear-icon",c.value.length===0&&"hidden"),onMousedown:g=>{g.preventDefault(),c.value=""}},X(Sb,{icon:e.clearSearchIcon}))),X("ul",{class:"language-list",role:"listbox",onKeydown:g=>{if(g.key==="Enter"){const y=document.activeElement;y instanceof HTMLElement&&y.dataset.language&&n(y.dataset.language)}}},f.value.length?f.value.map(g=>X("li",{role:"listitem",tabindex:"0",class:"language-list-item","aria-selected":g.name.toLowerCase()===t.value.toLowerCase(),"data-language":g.name,onClick:()=>{n(g.name),o.value=!1}},e.renderLanguage(g.name,g.name.toLowerCase()===t.value.toLowerCase()))):X("li",{class:"language-list-item no-result"},e.noResultText))):null))}});cC(X,mr);const d2t="http://www.w3.org/2000/svg";function h2t(){const t=dl(),e={ADD_TAGS:["foreignObject"],ADD_ATTR:["xmlns"],HTML_INTEGRATION_POINTS:{foreignobject:!0}};return t.addHook("uponSanitizeElement",(n,r)=>{var i;if(r.tagName==="foreignobject"){const s=n.parentElement;(!s||s.namespaceURI!==d2t)&&((i=n.parentNode)==null||i.removeChild(n))}}),n=>t.sanitize(n,e)}let XE;function f2t(t){return XE??(XE=h2t()),XE(t)}const p2t=es({props:{text:{type:Object,required:!0},language:{type:Object,required:!0},config:{type:Object,required:!0},previewOnlyMode:{type:Object,required:!0},preview:{type:Object,required:!0}},setup(t){const{previewOnlyMode:e,config:n,preview:r}=t,i=nt();return p2(()=>{const s=i.value;if(!s)return;for(;s.firstChild;)s.removeChild(s.firstChild);const o=r.value;(typeof o=="string"||o instanceof Element)&&(s.innerHTML=f2t(o))}),()=>r.value?X("div",{class:"preview-panel"},!e.value&&X(mr,null,X("div",{class:"preview-divider"}),X("div",{class:"preview-label"},n.previewLabel)),X("div",{ref:i,class:"preview"})):null}});cC(X,mr);const m2t=es({props:{text:{type:Object,required:!0},selected:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},codemirror:{type:Object,required:!0},language:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0},config:{type:Object,required:!0}},setup(t){var e;const n=(e=t.config.previewOnlyByDefault)!=null?e:t.getReadOnly(),r=nt(n),i=nt(),s=nt(null);m2(()=>{for(var a;(a=i.value)!=null&&a.firstChild;)i.value.removeChild(i.value.firstChild);i.value&&i.value.appendChild(t.codemirror.dom)}),qh(()=>[t.text.value,t.language.value],()=>{const a=t.config.renderPreview(t.language.value,t.text.value,c=>s.value=c);a&&(s.value=a),a===void 0&&!s.value&&(s.value=dl.sanitize(t.config.previewLoading)),a===null&&(s.value=null)},{immediate:!0});const o=()=>{};return()=>{var a;return X(mr,null,X("div",{class:"tools"},X(u2t,{language:t.language,config:t.config,setLanguage:t.setLanguage,getAllLanguages:t.getAllLanguages,getReadOnly:t.getReadOnly}),X("div",{class:"tools-button-group"},X(c2t,{copyIcon:t.config.copyIcon,copyText:t.config.copyText,onCopy:(a=t.config.onCopy)!=null?a:o,text:t.text.value}),s.value?X("button",{class:"preview-toggle-button",onClick:()=>r.value=!r.value},X(Sb,{icon:t.config.previewToggleButton(r.value)})):null)),X("div",{ref:i,class:ji("codemirror-host",s.value&&r.value&&"hidden")}),X(p2t,{text:t.text,language:t.language,config:t.config,previewOnlyMode:r,preview:s}))}}}),RB=new WeakMap;let vD=null;function Cse(){return vD||(vD=new IntersectionObserver(t=>{for(const e of t){const n=RB.get(e.target);n==null||n(e.isIntersecting)}},{rootMargin:"200px"})),vD}const l5e=class c5e{constructor(e,n,r,i,s){this.node=e,this.view=n,this.getPos=r,this.loader=i,this.config=s,this.selected=nt(!1),this.language=nt(""),this.text=nt(""),this.initialized=!1,this.updating=!1,this.languageName="",this.teardownTimer=null,this.forwardUpdate=a=>{var l;if(this.updating||!this.cm.hasFocus)return;let c=((l=this.getPos())!=null?l:0)+1;const{main:u}=a.state.selection,d=c+u.from,h=c+u.to,f=this.view.state.selection;if(a.docChanged||f.from!==d||f.to!==h){const p=this.view.state.tr;a.changes.iterChanges((g,y,v,b,_)=>{_.length?p.replaceWith(c+g,c+y,this.view.state.schema.text(_.toString())):p.delete(c+g,c+y),c+=b-v-(y-g)}),p.setSelection(mt.create(p.doc,d,h)),this.view.dispatch(p)}},this.createApp=()=>hl(m2t,{text:this.text,selected:this.selected,codemirror:this.cm,language:this.language,getAllLanguages:this.getAllLanguages,getReadOnly:()=>!this.view.editable,setLanguage:this.setLanguage,config:this.config}),this.codeMirrorKeymap=()=>{const a=this.view;return[{key:"ArrowUp",run:()=>this.maybeEscape("line",-1)},{key:"ArrowLeft",run:()=>this.maybeEscape("char",-1)},{key:"ArrowDown",run:()=>this.maybeEscape("line",1)},{key:"ArrowRight",run:()=>this.maybeEscape("char",1)},{key:"Mod-Enter",run:()=>O2e(a.state,a.dispatch)?(a.focus(),!0):!1},{key:"Mod-z",run:()=>PR(a.state,a.dispatch)},{key:"Shift-Mod-z",run:()=>yx(a.state,a.dispatch)},{key:"Mod-y",run:()=>yx(a.state,a.dispatch)},{key:"Backspace",run:()=>{var l;const c=this.cm.state.selection.ranges;if(c.length>1)return!1;const u=c[0];if(u&&(!u.empty||u.anchor>0)||this.cm.state.doc.lines>=2)return!1;const d=this.view.state,h=(l=this.getPos())!=null?l:0,f=d.tr.replaceWith(h,h+this.node.nodeSize,d.schema.nodes.paragraph.createChecked({},this.node.content));return f.setSelection(mt.near(f.doc.resolve(h))),this.view.dispatch(f),this.view.focus(),!0}}]},this.maybeEscape=(a,l)=>{var c;const{state:u}=this.cm;let d=u.selection.main;if(!d.empty||(a==="line"&&(d=u.doc.lineAt(d.head)),l<0?d.from>0:d.to<u.doc.length))return!1;const h=((c=this.getPos())!=null?c:0)+(l<0?0:this.node.nodeSize),f=mt.near(this.view.state.doc.resolve(h),l),p=this.view.state.tr.setSelection(f).scrollIntoView();return this.view.dispatch(p),this.view.focus(),!0},this.setLanguage=a=>{var l;this.view.dispatch(this.view.state.tr.setNodeAttribute((l=this.getPos())!=null?l:0,"language",a))},this.getAllLanguages=()=>this.loader.getAll();var o;this.languageConf=new nx,this.readOnlyConf=new nx,this.text.value=this.node.textContent,this.language.value=(o=this.node.attrs.language)!=null?o:"",this.dom=document.createElement("div"),this.dom.className="milkdown-code-block",this.disposeSelectedWatcher=p2(()=>{this.selected.value?this.dom.classList.add("selected"):this.dom.classList.remove("selected")}),this.renderPlaceholder(),RB.set(this.dom,a=>{a?(this.cancelTeardown(),this.initializeCodeMirror()):this.initialized&&this.scheduleTeardown()}),Cse().observe(this.dom)}renderPlaceholder(){const e=document.createElement("pre");e.className="milkdown-code-block-placeholder";const n=document.createElement("code");n.textContent=this.node.textContent,e.appendChild(n),this.dom.appendChild(e)}initializeCodeMirror(){if(this.initialized)return;this.initialized=!0,this.cm=new ht({doc:this.node.textContent,root:this.view.root,extensions:[this.readOnlyConf.of(Vr.readOnly.of(!this.view.editable)),Nwe(),l2.of(this.codeMirrorKeymap()),this.languageConf.of([]),Vr.changeFilter.of(()=>this.view.editable),...this.config.extensions,ht.updateListener.of(this.forwardUpdate)]});const e=this.dom.querySelector(".milkdown-code-block-placeholder");e&&this.dom.removeChild(e),this.app=this.createApp(),this.app.mount(this.dom),this.updateLanguage()}teardownCodeMirror(){if(this.initialized&&!(this.cm.hasFocus||this.selected.value)){for(this.app.unmount(),this.cm.destroy(),this.initialized=!1,this.languageName="";this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);this.renderPlaceholder()}}scheduleTeardown(){this.cancelTeardown(),this.teardownTimer=setTimeout(()=>this.teardownCodeMirror(),c5e.TEARDOWN_DELAY)}cancelTeardown(){this.teardownTimer!=null&&(clearTimeout(this.teardownTimer),this.teardownTimer=null)}updateLanguage(){const e=this.node.attrs.language;if(e===this.languageName)return;this.language.value=e,this.loader.load(e??"").then(r=>{r&&(this.cm.dispatch({effects:this.languageConf.reconfigure(r)}),this.languageName=e)}).catch(console.error)}setSelection(e,n){this.initialized||this.initializeCodeMirror(),this.cm.dom.isConnected&&(this.cm.focus(),this.updating=!0,this.cm.dispatch({selection:{anchor:e,head:n}}),this.updating=!1)}update(e){var n;if(e.type!==this.node.type)return!1;if(this.updating)return!0;if(this.node=e,this.text.value=e.textContent,this.language.value=(n=e.attrs.language)!=null?n:"",!this.initialized){const i=this.dom.querySelector(".milkdown-code-block-placeholder code");return i&&(i.textContent=e.textContent),!0}this.updateLanguage(),this.view.editable===this.cm.state.readOnly&&this.cm.dispatch({effects:this.readOnlyConf.reconfigure(Vr.readOnly.of(!this.view.editable))});const r=y2t(this.cm.state.doc.toString(),e.textContent);return r&&(this.updating=!0,this.cm.dispatch({changes:{from:r.from,to:r.to,insert:r.text},scrollIntoView:!0}),this.updating=!1),!0}selectNode(){this.initialized||this.initializeCodeMirror(),this.selected.value=!0,this.cm.focus()}deselectNode(){this.selected.value=!1}stopEvent(){return!0}destroy(){this.cancelTeardown(),Cse().unobserve(this.dom),RB.delete(this.dom),this.initialized&&(this.app.unmount(),this.cm.destroy()),this.disposeSelectedWatcher()}};l5e.TEARDOWN_DELAY=5e3;let g2t=l5e;function y2t(t,e){if(t===e)return null;let n=0,r=t.length,i=e.length;for(;n<r&&t.charCodeAt(n)===e.charCodeAt(n);)++n;for(;r>n&&i>n&&t.charCodeAt(r-1)===e.charCodeAt(i-1);)r--,i--;return{from:n,to:r,text:e.slice(n,i)}}const u5e=F3(Jl.node,t=>{const e=t.get(lC.key),n=new o2t(e.languages);return(r,i,s)=>new g2t(r,i,s,n,e)});a5e(u5e,{displayName:"NodeView<code-block>",group:"CodeBlock"});const v2t=[u5e,lC],Ese=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class vx{constructor(e,n,r=0,i=e.length,s,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,i),this.bufferStart=r,this.normalize=s?a=>s(Ese(a)):Ese,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return oa(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=yU(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Vu(e);let i=this.normalize(n);if(i.length)for(let s=0,o=r,a=!0;;s++){let l=i.charCodeAt(s),c=this.match(l,o,a,this.bufferPos+this.bufferStart,s==i.length-1);if(c)return this.value=c,this;if(s==i.length-1)break;a&&s<n.length&&n.charCodeAt(s)==l?o++:a=!1}}}match(e,n,r,i,s){let o=null;for(let a=0;a<this.matches.length;){let l=this.matches[a],c=!1;this.query.charCodeAt(l.index)==e&&(l.index==this.query.length-1?o={from:l.from,to:i,precise:s&&l.precise}:(l.index++,c=!0)),c?a++:this.matches.splice(a,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?o={from:n,to:i,precise:r&&s}:this.matches.push({from:n,index:1,precise:r})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(vx.prototype[Symbol.iterator]=function(){return this});const d5e={from:-1,to:-1,match:/.*/.exec(""),precise:!0},yG="gm"+(/x/.unicode==null?"":"u");class h5e{constructor(e,n,r,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=d5e,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new f5e(e,n,r,i,s);this.re=new RegExp(n,yG+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=N8(e,i),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,i=r+n[0].length;if(this.matchPos=N8(this.text,i+(r==i?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<i||r>this.value.to)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,precise:!0,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const bD=new WeakMap;class kb{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,r){let i=bD.get(e);if(!i||i.from>=r||i.to<=n){let a=new kb(n,e.sliceString(n,r));return bD.set(e,a),a}if(i.from==n&&i.to==r)return i;let{text:s,from:o}=i;return o>n&&(s=e.sliceString(n,o)+s,o=n),i.to<r&&(s+=e.sliceString(i.to,r)),bD.set(e,new kb(o,s)),new kb(n,s.slice(n-o,r-o))}}class f5e{constructor(e,n,r,i,s){this.text=e,this.to=s,this.done=!1,this.value=d5e,this.matchPos=N8(e,i),this.re=new RegExp(n,yG+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.flat=kb.get(e,i,this.chunkEnd(i+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,i=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,precise:!0,match:n},this.matchPos=N8(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=kb.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(h5e.prototype[Symbol.iterator]=f5e.prototype[Symbol.iterator]=function(){return this});function b2t(t){try{return new RegExp(t,yG),!0}catch{return!1}}function N8(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e<n.to&&(r=n.text.charCodeAt(e-n.from))>=56320&&r<57344;)e++;return e}const w2t=t=>{let{state:e}=t,n=String(e.doc.lineAt(t.state.selection.main.head).number),{close:r,result:i}=Wit(t,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:e.phrase("go")});return i.then(s=>{let o=s&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.elements.line.value);if(!o){t.dispatch({effects:r});return}let a=e.doc.lineAt(e.selection.main.head),[,l,c,u,d]=o,h=u?+u.slice(1):0,f=c?+c:a.number;if(c&&d){let y=f/100;l&&(y=y*(l=="-"?-1:1)+a.number/e.doc.lines),f=Math.round(e.doc.lines*y)}else c&&l&&(f=f*(l=="-"?-1:1)+a.number);let p=e.doc.line(Math.max(1,Math.min(e.doc.lines,f))),g=be.cursor(p.from+Math.max(0,Math.min(h,p.length)));t.dispatch({effects:[r,ht.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},x2t={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},_2t=st.define({combine(t){return Id(t,x2t,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function S2t(t){return[A2t,T2t]}const k2t=It.mark({class:"cm-selectionMatch"}),C2t=It.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Tse(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Fr.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Fr.Word)}function E2t(t,e,n,r){return t(e.sliceDoc(n,n+1))==Fr.Word&&t(e.sliceDoc(r-1,r))==Fr.Word}const T2t=wi.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(_2t),{state:n}=t,r=n.selection;if(r.ranges.length>1)return It.none;let i=r.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return It.none;let l=n.wordAt(i.head);if(!l)return It.none;o=n.charCategorizer(i.head),s=n.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l<e.minSelectionLength||l>200)return It.none;if(e.wholeWords){if(s=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(Tse(o,n,i.from,i.to)&&E2t(o,n,i.from,i.to)))return It.none}else if(s=n.sliceDoc(i.from,i.to),!s)return It.none}let a=[];for(let l of t.visibleRanges){let c=new vx(n.doc,s,l.from,l.to);for(;!c.next().done;){let{from:u,to:d}=c.value;if((!o||Tse(o,n,u,d))&&(i.empty&&u<=i.from&&d>=i.to?a.push(C2t.range(u,d)):(u>=i.to||d<=i.from)&&a.push(k2t.range(u,d)),a.length>e.maxMatches))return It.none}}return It.set(a)}},{decorations:t=>t.decorations}),A2t=ht.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),I2t=({state:t,dispatch:e})=>{let{selection:n}=t,r=be.create(n.ranges.map(i=>t.wordAt(i.head)||be.cursor(i.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function R2t(t,e){let{main:n,ranges:r}=t.selection,i=t.wordAt(n.head),s=i&&i.from==n.from&&i.to==n.to;for(let o=!1,a=new vx(t.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new vx(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(l=>l.from==a.value.from))continue;if(s){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const M2t=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(s=>s.from===s.to))return I2t({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(s=>t.sliceDoc(s.from,s.to)!=r))return!1;let i=R2t(t,r);return i?(e(t.update({selection:t.selection.addRange(be.range(i.from,i.to),!1),effects:ht.scrollIntoView(i.to)})),!0):!1},w2=st.define({combine(t){return Id(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new q2t(e),scrollToMatch:e=>ht.scrollIntoView(e)})}});class p5e{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||b2t(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?`
|
||
`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new z2t(this):new D2t(this)}getCursor(e,n=0,r){let i=e.doc?e:Vr.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?_v(this,i,n,r):xv(this,i,n,r)}}class m5e{constructor(e){this.spec=e}}function N2t(t,e,n){return(r,i,s,o)=>{if(n&&!n(r,i,s,o))return!1;let a=r>=o&&i<=o+s.length?s.slice(r-o,i-o):e.doc.sliceString(r,i);return t(a,e,r,i)}}function xv(t,e,n,r){let i;return t.wholeWord&&(i=O2t(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(i=N2t(t.test,e,i)),new vx(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),i)}function O2t(t,e){return(n,r,i,s)=>((s>n||s+i.length<r)&&(s=Math.max(0,n-2),i=t.sliceString(s,Math.min(t.length,r+2))),(e(O8(i,n-s))!=Fr.Word||e(D8(i,n-s))!=Fr.Word)&&(e(D8(i,r-s))!=Fr.Word||e(O8(i,r-s))!=Fr.Word))}class D2t extends m5e{constructor(e){super(e)}nextMatch(e,n,r){let i=xv(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,n+this.spec.unquoted.length);i=xv(this.spec,e,0,s).nextOverlapping()}return i.done||i.value.from==n&&i.value.to==r?null:i.value}prevMatchInRange(e,n,r){for(let i=r;;){let s=Math.max(n,i-1e4-this.spec.unquoted.length),o=xv(this.spec,e,s,i),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==n)return null;i-=1e4}}prevMatch(e,n,r){let i=this.prevMatchInRange(e,0,n);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=n||i.to!=r)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let r=xv(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let s=xv(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function P2t(t,e,n){return(r,i,s)=>(!n||n(r,i,s))&&t(s[0],e,r,i)}function _v(t,e,n,r){let i;return t.wholeWord&&(i=L2t(e.charCategorizer(e.selection.main.head))),t.test&&(i=P2t(t.test,e,i)),new h5e(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:i},n,r)}function O8(t,e){return t.slice(fs(t,e,!1),e)}function D8(t,e){return t.slice(e,fs(t,e))}function L2t(t){return(e,n,r)=>!r[0].length||(t(O8(r.input,r.index))!=Fr.Word||t(D8(r.input,r.index))!=Fr.Word)&&(t(D8(r.input,r.index+r[0].length))!=Fr.Word||t(O8(r.input,r.index+r[0].length))!=Fr.Word)}class z2t extends m5e{nextMatch(e,n,r){let i=_v(this.spec,e,r,e.doc.length).next();return i.done&&(i=_v(this.spec,e,0,n).next()),i.done?null:i.value}prevMatchInRange(e,n,r){for(let i=1;;i++){let s=Math.max(n,r-i*1e4),o=_v(this.spec,e,s,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==n||a.from>s+10))return a;if(s==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let i=r.length;i>0;i--){let s=+r.slice(0,i);if(s>0&&s<e.match.length)return e.match[s]+r.slice(i)}return n})}matchAll(e,n){let r=_v(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let s=_v(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const Ak=Ut.define(),vG=Ut.define(),Am=Vs.define({create(t){return new wD(MB(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Ak)?t=new wD(n.value.create(),t.panel):n.is(vG)&&(t=new wD(t.query,n.value?bG:null));return t},provide:t=>sk.from(t,e=>e.panel)});class wD{constructor(e,n){this.query=e,this.panel=n}}const j2t=It.mark({class:"cm-searchMatch"}),B2t=It.mark({class:"cm-searchMatch cm-searchMatch-selected"}),F2t=wi.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(Am))}update(t){let e=t.state.field(Am);(e!=t.startState.field(Am)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return It.none;let{view:n}=this,r=new hf;for(let i=0,s=n.visibleRanges,o=s.length;i<o;i++){let{from:a,to:l}=s[i];for(;i<o-1&&l>s[i+1].from-2*250;)l=s[++i].to;t.highlight(n.state,a,l,(c,u)=>{let d=n.state.selection.ranges.some(h=>h.from==c&&h.to==u);r.add(c,u,d?B2t:j2t)})}return r.finish()}},{decorations:t=>t.decorations});function uC(t){return e=>{let n=e.state.field(Am,!1);return n&&n.query.spec.valid?t(e,n):v5e(e)}}const P8=uC((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let i=be.single(r.from,r.to),s=t.state.facet(w2);return t.dispatch({selection:i,effects:[wG(t,r),s.scrollToMatch(i.main,t)],userEvent:"select.search"}),y5e(t),!0}),L8=uC((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,i=e.prevMatch(n,r,r);if(!i)return!1;let s=be.single(i.from,i.to),o=t.state.facet(w2);return t.dispatch({selection:s,effects:[wG(t,i),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),y5e(t),!0}),V2t=uC((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:be.create(n.map(r=>be.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),$2t=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,s=[],o=0;for(let a=new vx(t.doc,t.sliceDoc(r,i));!a.next().done;){if(s.length>1e3)return!1;a.value.from==r&&(o=s.length),s.push(be.range(a.value.from,a.value.to))}return e(t.update({selection:be.create(s,o),userEvent:"select.search.matches"})),!0},Ase=uC((t,{query:e})=>{let{state:n}=t,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let s=e.nextMatch(n,r,r);if(!s)return!1;let o=s,a=[],l,c,u=[];o.precise?o.from==r&&o.to==i&&(c=n.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:c}),u.push(ht.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))):o=e.nextMatch(n,o.from,o.to);let d=t.state.changes(a);return o&&(l=be.single(o.from,o.to).map(d),u.push(wG(t,o)),u.push(n.facet(w2).scrollToMatch(l.main,t))),t.dispatch({changes:d,selection:l,effects:u,userEvent:"input.replace"}),!0}),H2t=uC((t,{query:e})=>{if(t.state.readOnly)return!1;let n=[];for(let i of e.matchAll(t.state,1e9)){let{from:s,to:o,precise:a}=i;a&&n.push({from:s,to:o,insert:e.getReplacement(i)})}if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:ht.announce.of(r),userEvent:"input.replace.all"}),!0});function bG(t){return t.state.facet(w2).createPanel(t)}function MB(t,e){var n,r,i,s,o;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=t.facet(w2);return new p5e({search:((n=e==null?void 0:e.literal)!==null&&n!==void 0?n:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e==null?void 0:e.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(i=e==null?void 0:e.literal)!==null&&i!==void 0?i:c.literal,regexp:(s=e==null?void 0:e.regexp)!==null&&s!==void 0?s:c.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function g5e(t){let e=PU(t,bG);return e&&e.dom.querySelector("[main-field]")}function y5e(t){let e=g5e(t);e&&e==t.root.activeElement&&e.select()}const v5e=t=>{let e=t.state.field(Am,!1);if(e&&e.panel){let n=g5e(t);if(n&&n!=t.root.activeElement){let r=MB(t.state,e.query.spec);r.valid&&t.dispatch({effects:Ak.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[vG.of(!0),e?Ak.of(MB(t.state,e.query.spec)):Ut.appendConfig.of(G2t)]});return!0},b5e=t=>{let e=t.state.field(Am,!1);if(!e||!e.panel)return!1;let n=PU(t,bG);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:vG.of(!1)}),!0},U2t=[{key:"Mod-f",run:v5e,scope:"editor search-panel"},{key:"F3",run:P8,shift:L8,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:P8,shift:L8,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:b5e,scope:"editor search-panel"},{key:"Mod-Shift-l",run:$2t},{key:"Mod-Alt-g",run:w2t},{key:"Mod-d",run:M2t,preventDefault:!0}];class q2t{constructor(e){this.view=e;let n=this.query=e.state.field(Am).query.spec;this.commit=this.commit.bind(this),this.searchField=ar("input",{value:n.search,placeholder:Ia(e,"Find"),"aria-label":Ia(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ar("input",{value:n.replace,placeholder:Ia(e,"Replace"),"aria-label":Ia(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ar("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=ar("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=ar("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(i,s,o){return ar("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=ar("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>P8(e),[Ia(e,"next")]),r("prev",()=>L8(e),[Ia(e,"previous")]),r("select",()=>V2t(e),[Ia(e,"all")]),ar("label",null,[this.caseField,Ia(e,"match case")]),ar("label",null,[this.reField,Ia(e,"regexp")]),ar("label",null,[this.wordField,Ia(e,"by word")]),...e.state.readOnly?[]:[ar("br"),this.replaceField,r("replace",()=>Ase(e),[Ia(e,"replace")]),r("replaceAll",()=>H2t(e),[Ia(e,"replace all")])],ar("button",{name:"close",onclick:()=>b5e(e),"aria-label":Ia(e,"close"),type:"button"},["×"])])}commit(){let e=new p5e({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Ak.of(e)}))}keydown(e){iit(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?L8:P8)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Ase(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(Ak)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(w2).top}}function Ia(t,e){return t.state.phrase(e)}const QE=30,JE=/[\s\.,:;?!]/;function wG(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),i=t.state.doc.lineAt(n).to,s=Math.max(r.from,e-QE),o=Math.min(i,n+QE),a=t.state.sliceDoc(s,o);if(s!=r.from){for(let l=0;l<QE;l++)if(!JE.test(a[l+1])&&JE.test(a[l])){a=a.slice(l);break}}if(o!=i){for(let l=a.length-1;l>a.length-QE;l--)if(!JE.test(a[l-1])&&JE.test(a[l])){a=a.slice(0,l);break}}return ht.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${r.number}.`)}const W2t=ht.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),G2t=[Am,S0.low(F2t),W2t];class w5e{constructor(e,n,r,i){this.state=e,this.pos=n,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=zs(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),i=n.text.slice(r-n.from,this.pos-n.from),s=i.search(x5e(e,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function Ise(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function K2t(t){let e=Object.create(null),n=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let s=1;s<i.length;s++)n[i[s]]=!0}let r=Ise(e)+Ise(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function Y2t(t){let e=t.map(i=>typeof i=="string"?{label:i}:i),[n,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:K2t(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:n}:null}}function MRt(t,e){return n=>{for(let r=zs(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}class Rse{constructor(e,n,r,i){this.completion=e,this.source=n,this.match=r,this.score=i}}function _1(t){return t.selection.main.from}function x5e(t,e){var n;let{source:r}=t,i=e&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?t:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const xG=Tf.define();function Z2t(t,e,n,r){let{main:i}=t.selection,s=n-i.from,o=r-i.from;return{...t.changeByRange(a=>{if(a!=i&&n!=r&&t.sliceDoc(a.from+s,a.from+o)!=t.sliceDoc(n,r))return{range:a};let l=t.toText(e);return{changes:{from:a.from+s,to:r==i.from?a.to:a.from+o,insert:l},range:be.cursor(a.from+s+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Mse=new WeakMap;function X2t(t){if(!Array.isArray(t))return t;let e=Mse.get(t);return e||Mse.set(t,e=Y2t(t)),e}const z8=Ut.define(),Ik=Ut.define();class Q2t{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let r=oa(e,n),i=Vu(r);this.chars.push(r);let s=e.slice(n,n+i),o=s.toUpperCase();this.folded.push(oa(o==s?s.toLowerCase():o,0)),n+=i}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:i,precise:s,byWord:o}=this;if(n.length==1){let b=oa(e,0),_=Vu(b),S=_==e.length?0:-100;if(b!=n[0])if(b==r[0])S+=-200;else return null;return this.ret(S,[0,_])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,c=0;if(a<0){for(let b=0,_=Math.min(e.length,200);b<_&&c<l;){let S=oa(e,b);(S==n[c]||S==r[c])&&(i[c++]=b),b+=Vu(S)}if(c<l)return null}let u=0,d=0,h=!1,f=0,p=-1,g=-1,y=/[a-z]/.test(e),v=!0;for(let b=0,_=Math.min(e.length,200),S=0;b<_&&d<l;){let k=oa(e,b);a<0&&(u<l&&k==n[u]&&(s[u++]=b),f<l&&(k==n[f]||k==r[f]?(f==0&&(p=b),g=b+1,f++):f=0));let T,E=k<255?k>=48&&k<=57||k>=97&&k<=122?2:k>=65&&k<=90?1:0:(T=yU(k))!=T.toLowerCase()?1:T!=T.toUpperCase()?2:0;(!b||E==1&&y||S==0&&E!=0)&&(n[d]==k||r[d]==k&&(h=!0)?o[d++]=b:o.length&&(v=!1)),S=E,b+=Vu(k)}return d==l&&o[0]==0&&v?this.result(-100+(h?-200:0),o,e):f==l&&p==0?this.ret(-200-e.length+(g==e.length?0:-100),[0,g]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):f==l?this.ret(-900-e.length,[p,g]):d==l?this.result(-100+(h?-200:0)+-700+(v?0:-1100),o,e):n.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,n,r){let i=[],s=0;for(let o of n){let a=o+(this.astral?Vu(oa(r,o)):1);s&&i[s-1]==o?i[s-1]=a:(i[s++]=o,i[s++]=a)}return this.ret(e-r.length,i)}}class J2t{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const hs=st.define({combine(t){return Id(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:e4t,filterStrict:!1,compareCompletions:(e,n)=>(e.sortText||e.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>Nse(e(r),n(r)),optionClass:(e,n)=>r=>Nse(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function Nse(t,e){return t?e?t+" "+e:t:e}function e4t(t,e,n,r,i,s){let o=t.textDirection==vr.RTL,a=o,l=!1,c="top",u,d,h=e.left-i.left,f=i.right-e.right,p=r.right-r.left,g=r.bottom-r.top;if(a&&h<Math.min(p,f)?a=!1:!a&&f<Math.min(p,h)&&(a=!0),p<=(a?h:f))u=Math.max(i.top,Math.min(n.top,i.bottom-g))-e.top,d=Math.min(400,a?h:f);else{l=!0,d=Math.min(400,(o?e.right:i.right-e.left)-30);let b=i.bottom-e.bottom;b>=g||b>e.top?u=n.bottom-e.top:(c="bottom",u=e.bottom-n.top)}let y=(e.bottom-e.top)/s.offsetHeight,v=(e.right-e.left)/s.offsetWidth;return{style:`${c}: ${u/y}px; max-width: ${d/v}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}const _G=Ut.define();function t4t(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,i,s){let o=document.createElement("span");o.className="cm-completionLabel";let a=n.displayLabel||n.label,l=0;for(let c=0;c<s.length;){let u=s[c++],d=s[c++];u>l&&o.appendChild(document.createTextNode(a.slice(l,u)));let h=o.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(a.slice(u,d))),h.className="cm-completionMatchedText",l=d}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),e.sort((n,r)=>n.position-r.position).map(n=>n.render)}function xD(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let i=Math.floor(e/n);return{from:i*n,to:(i+1)*n}}let r=Math.ceil((t-e)/n);return{from:t-r*n,to:t-(r-1)*n}}class n4t{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(n),{options:s,selected:o}=i.open,a=e.state.facet(hs);this.optionContent=t4t(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=xD(s.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(n).open;for(let u=l.target,d;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(d=/-(\d+)$/.exec(u.id))&&+d[1]<c.length){this.applyCompletion(e,c[+d[1]]),l.preventDefault();return}if(l.target==this.list){let u=this.list.classList.contains("cm-completionListIncompleteTop")&&l.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&l.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;u!=null&&(e.dispatch({effects:_G.of(u)}),l.preventDefault())}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(hs).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Ik.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=i){let{options:s,selected:o,disabled:a}=r.open;(!i.open||i.open.options!=s)&&(this.range=xD(s.length,o,e.state.facet(hs).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),a!=((n=i.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=xD(n.options.length,n.selected,this.view.state.facet(hs).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:i}=n.options[n.selected],{info:s}=i;if(!s)return;let o=typeof s=="string"?document.createTextNode(s):s(i);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,i)}).catch(a=>ua(this.view.state,a,"completion info")):(this.addInfoPane(o,i),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;r.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)r.nodeName!="LI"||!r.id?i--:i==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&i4t(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return i.top>Math.min(s.bottom,n.bottom)-10||i.bottom<Math.max(s.top,n.top)+10?null:this.view.state.facet(hs).positionInfo(this.view,n,i,r,s,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,n,r){const i=document.createElement("ul");i.id=n,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",o=>{o.target==i&&o.preventDefault()});let s=null;for(let o=r.from;o<r.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let h=typeof c=="string"?c:c.name;if(h!=s&&(o>r.from||r.from==0))if(s=h,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let f=i.appendChild(document.createElement("completion-section"));f.textContent=h}}const u=i.appendChild(document.createElement("li"));u.id=n+"-"+o,u.setAttribute("role","option");let d=this.optionClass(a);d&&(u.className=d);for(let h of this.optionContent){let f=h(a,this.view.state,this.view,l);f&&u.appendChild(f)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function r4t(t,e){return n=>new n4t(n,t,e)}function i4t(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=n.height/t.offsetHeight;r.top<n.top?t.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/i)}function Ose(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function s4t(t,e){let n=[],r=null,i=null,s=u=>{n.push(u);let{section:d}=u.completion;if(d){r||(r=[]);let h=typeof d=="string"?d:d.name;r.some(f=>f.name==h)||r.push(typeof d=="string"?{name:h}:d)}},o=e.facet(hs);for(let u of t)if(u.hasResult()){let d=u.result.getMatch;if(u.result.filter===!1)for(let h of u.result.options)s(new Rse(h,u.source,d?d(h):[],1e9-n.length));else{let h=e.sliceDoc(u.from,u.to),f,p=o.filterStrict?new J2t(h):new Q2t(h);for(let g of u.result.options)if(f=p.match(g.label)){let y=g.displayLabel?d?d(g,f.matched):[]:f.matched,v=f.score+(g.boost||0);if(s(new Rse(g,u.source,y,v)),typeof g.section=="object"&&g.section.rank==="dynamic"){let{name:b}=g.section;i||(i=Object.create(null)),i[b]=Math.max(v,i[b]||-1e9)}}}}if(r){let u=Object.create(null),d=0,h=(f,p)=>(f.rank==="dynamic"&&p.rank==="dynamic"?i[p.name]-i[f.name]:0)||(typeof f.rank=="number"?f.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(f.name<p.name?-1:1);for(let f of r.sort(h))d-=1e5,u[f.name]=d;for(let f of n){let{section:p}=f.completion;p&&(f.score+=u[typeof p=="string"?p:p.name])}}let a=[],l=null,c=o.compareCompletions;for(let u of n.sort((d,h)=>h.score-d.score||c(d.completion,h.completion))){let d=u.completion;!l||l.label!=d.label||l.detail!=d.detail||l.type!=null&&d.type!=null&&l.type!=d.type||l.apply!=d.apply||l.boost!=d.boost?a.push(u):Ose(u.completion)>Ose(l)&&(a[a.length-1]=u),l=u.completion}return a}class qv{constructor(e,n,r,i,s,o){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new qv(this.options,Dse(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,i,s,o){if(i&&!o&&e.some(c=>c.isPending))return i.setDisabled();let a=s4t(e,n);if(!a.length)return i&&e.some(c=>c.isPending)?i.setDisabled():null;let l=n.facet(hs).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let c=i.options[i.selected].completion;for(let u=0;u<a.length;u++)if(a[u].completion==c){l=u;break}}return new qv(a,Dse(r,l),{pos:e.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:d4t,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new qv(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new qv(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class j8{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new j8(c4t,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(hs),s=(r.override||n.languageDataAt("autocomplete",_1(n)).map(X2t)).map(l=>(this.active.find(u=>u.source==l)||new $l(l,this.active.some(u=>u.state!=0)?1:0)).update(e,r));s.length==this.active.length&&s.every((l,c)=>l==this.active[c])&&(s=this.active);let o=this.open,a=e.effects.some(l=>l.is(SG));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!o4t(s,this.active)||a?o=qv.build(s,n,this.id,o,r,a):o&&o.disabled&&!s.some(l=>l.isPending)&&(o=null),!o&&s.every(l=>!l.isPending)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new $l(l.source,0):l));for(let l of e.effects)l.is(_G)&&(o=o&&o.setSelected(l.value,this.id));return s==this.active&&o==this.open?this:new j8(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?a4t:l4t}}function o4t(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;r<e.length&&!e[r].hasResult();)r++;let i=n==t.length,s=r==e.length;if(i||s)return i==s;if(t[n++].result!=e[r++].result)return!1}}const a4t={"aria-autocomplete":"list"},l4t={};function Dse(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const c4t=[];function _5e(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(xG);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class $l{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=_5e(e,n),i=this;(r&8||r&16&&this.touches(e))&&(i=new $l(i.source,0)),r&4&&i.state==0&&(i=new $l(this.source,1)),i=i.updateFor(e,r);for(let s of e.effects)if(s.is(z8))i=new $l(i.source,1,s.value);else if(s.is(Ik))i=new $l(i.source,0);else if(s.is(SG))for(let o of s.value)o.source==i.source&&(i=o);return i}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(_1(e.state))}}class Cb extends $l{constructor(e,n,r,i,s,o){super(e,3,n),this.limit=r,this.result=i,this.from=s,this.to=o}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=_1(e.state);if(a>o||!i||n&2&&(_1(e.startState)==this.from||a<this.limit))return new $l(this.source,n&4?1:0);let l=e.changes.mapPos(this.limit);return u4t(i.validFor,e.state,s,o)?new Cb(this.source,this.explicit,l,i,s,o):i.update&&(i=i.update(i,s,o,new w5e(e.state,a,!1)))?new Cb(this.source,this.explicit,l,i,i.from,(r=i.to)!==null&&r!==void 0?r:_1(e.state)):new $l(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new Cb(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new $l(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function u4t(t,e,n,r){if(!t)return!1;let i=e.sliceDoc(n,r);return typeof t=="function"?t(i,n,r,e):x5e(t,!0).test(i)}const SG=Ut.define({map(t,e){return t.map(n=>n.map(e))}}),aa=Vs.define({create(){return j8.start()},update(t,e){return t.update(e)},provide:t=>[DU.from(t,e=>e.tooltip),ht.contentAttributes.from(t,e=>e.attrs)]});function kG(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(aa).active.find(i=>i.source==e.source);return r instanceof Cb?(typeof n=="string"?t.dispatch({...Z2t(t.state,n,r.from,r.to),annotations:xG.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const d4t=r4t(aa,kG);function eT(t,e="option"){return n=>{let r=n.state.field(aa,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(hs).interactionDelay)return!1;let i=1,s;e=="page"&&(s=zwe(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+i*(t?1:-1):t?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),n.dispatch({effects:_G.of(a)}),!0}}const h4t=t=>{let e=t.state.field(aa,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(hs).interactionDelay?!1:kG(t,e.open.options[e.open.selected])},_D=t=>t.state.field(aa,!1)?(t.dispatch({effects:z8.of(!0)}),!0):!1,f4t=t=>{let e=t.state.field(aa,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Ik.of(null)}),!0)};class p4t{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const m4t=50,g4t=1e3,y4t=wi.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(aa).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(aa),n=t.state.facet(hs);if(!t.selectionSet&&!t.docChanged&&t.startState.field(aa)==e)return;let r=t.transactions.some(s=>{let o=_5e(s,n);return o&8||(s.selection||s.docChanged)&&!(o&3)});for(let s=0;s<this.running.length;s++){let o=this.running[s];if(r||o.context.abortOnDocChange&&t.docChanged||o.updates.length+t.transactions.length>m4t&&Date.now()-o.time>g4t){for(let a of o.context.abortListeners)try{a()}catch(l){ua(this.view.state,l)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(s=>s.effects.some(o=>o.is(z8)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(o=>o.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of t.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(aa);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(hs).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=_1(e),r=new w5e(e,n,t.explicit,this.view),i=new p4t(t,r);this.running.push(i),Promise.resolve(t.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:Ik.of(null)}),ua(this.view.state,s)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(hs).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(hs),r=this.view.state.field(aa);for(let i=0;i<this.running.length;i++){let s=this.running[i];if(s.done===void 0)continue;if(this.running.splice(i--,1),s.done){let a=_1(s.updates.length?s.updates[0].startState:this.view.state),l=Math.min(a,s.done.from+(s.active.explicit?0:1)),c=new Cb(s.active.source,s.active.explicit,l,s.done,s.done.from,(t=s.done.to)!==null&&t!==void 0?t:a);for(let u of s.updates)c=c.update(u,n);if(c.hasResult()){e.push(c);continue}}let o=r.active.find(a=>a.source==s.active.source);if(o&&o.isPending)if(s.done==null){let a=new $l(s.active.source,0);for(let l of s.updates)a=a.update(l,n);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:SG.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(aa,!1);if(e&&e.tooltip&&this.view.state.facet(hs).closeOnBlur){let n=e.open&&zwe(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Ik.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:z8.of(!1)}),20),this.composing=0}}}),v4t=typeof navigator=="object"&&/Win/.test(navigator.platform),b4t=S0.highest(ht.domEventHandlers({keydown(t,e){let n=e.state.field(aa,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(v4t&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(o=>o.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(t.key)>-1&&kG(e,r),!1}})),S5e=ht.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class w4t{constructor(e,n,r,i){this.field=e,this.line=n,this.from=r,this.to=i}}class CG{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,Is.TrackDel),r=e.mapPos(this.to,1,Is.TrackDel);return n==null||r==null?null:new CG(this.field,n,r)}}class EG{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],i=[n],s=e.doc.lineAt(n),o=/^\s*/.exec(s.text)[0];for(let l of this.lines){if(r.length){let c=o,u=/^\t*/.exec(l)[0].length;for(let d=0;d<u;d++)c+=e.facet($I);i.push(n+c.length-u),l=c+l.slice(u)}r.push(l),n+=l.length+1}let a=this.fieldPositions.map(l=>new CG(l.field,i[l.line]+l.from,i[l.line]+l.to));return{text:r,ranges:a}}static parse(e){let n=[],r=[],i=[],s;for(let o of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let a=s[1]?+s[1]:null,l=s[2]||s[3]||"",c=-1,u=l.replace(/\\[{}]/g,d=>d[1]);for(let d=0;d<n.length;d++)(a!=null?n[d].seq==a:u&&n[d].name==u)&&(c=d);if(c<0){let d=0;for(;d<n.length&&(a==null||n[d].seq!=null&&n[d].seq<a);)d++;n.splice(d,0,{seq:a,name:u}),c=d;for(let h of i)h.field>=c&&h.field++}for(let d of i)if(d.line==r.length&&d.from>s.index){let h=s[2]?3+(s[1]||"").length:2;d.from-=h,d.to-=h}i.push(new w4t(c,r.length,s.index,s.index+u.length)),o=o.slice(0,s.index)+l+o.slice(s.index+s[0].length)}o=o.replace(/\\([{}])/g,(a,l,c)=>{for(let u of i)u.line==r.length&&u.from>c&&(u.from--,u.to--);return l}),r.push(o)}return new EG(r,i)}}let x4t=It.widget({widget:new class extends Rd{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),_4t=It.mark({class:"cm-snippetField"});class x2{constructor(e,n){this.ranges=e,this.active=n,this.deco=It.set(e.map(r=>(r.from==r.to?x4t:_4t).range(r.from,r.to)),!0)}map(e){let n=[];for(let r of this.ranges){let i=r.map(e);if(!i)return null;n.push(i)}return new x2(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const dC=Ut.define({map(t,e){return t&&t.map(e)}}),S4t=Ut.define(),Rk=Vs.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(dC))return n.value;if(n.is(S4t)&&t)return new x2(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>ht.decorations.from(t,e=>e?e.deco:It.none)});function TG(t,e){return be.create(t.filter(n=>n.field==e).map(n=>be.range(n.from,n.to)))}function k4t(t){let e=EG.parse(t);return(n,r,i,s)=>{let{text:o,ranges:a}=e.instantiate(n.state,i),{main:l}=n.state.selection,c={changes:{from:i,to:s==l.from?l.to:s,insert:jn.of(o)},scrollIntoView:!0,annotations:r?[xG.of(r),Mo.userEvent.of("input.complete")]:void 0};if(a.length&&(c.selection=TG(a,0)),a.some(u=>u.field>0)){let u=new x2(a,0),d=c.effects=[dC.of(u)];n.state.field(Rk,!1)===void 0&&d.push(Ut.appendConfig.of([Rk,I4t,R4t,S5e]))}n.dispatch(n.state.update(c))}}function k5e(t){return({state:e,dispatch:n})=>{let r=e.field(Rk,!1);if(!r||t<0&&r.active==0)return!1;let i=r.active+t,s=t>0&&!r.ranges.some(o=>o.field==i+t);return n(e.update({selection:TG(r.ranges,i),effects:dC.of(s?null:new x2(r.ranges,i)),scrollIntoView:!0})),!0}}const C4t=({state:t,dispatch:e})=>t.field(Rk,!1)?(e(t.update({effects:dC.of(null)})),!0):!1,E4t=k5e(1),T4t=k5e(-1),A4t=[{key:"Tab",run:E4t,shift:T4t},{key:"Escape",run:C4t}],Pse=st.define({combine(t){return t.length?t[0]:A4t}}),I4t=S0.highest(l2.compute([Pse],t=>t.facet(Pse)));function NRt(t,e){return{...e,apply:k4t(t)}}const R4t=ht.domEventHandlers({mousedown(t,e){let n=e.state.field(Rk,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let i=n.ranges.find(s=>s.from<=r&&s.to>=r);return!i||i.field==n.active?!1:(e.dispatch({selection:TG(n.ranges,i.field),effects:dC.of(n.ranges.some(s=>s.field>i.field)?new x2(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),Mk={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Dg=Ut.define({map(t,e){let n=e.mapPos(t,-1,Is.TrackAfter);return n??void 0}}),AG=new class extends Wm{};AG.startSide=1;AG.endSide=-1;const C5e=Vs.define({create(){return bn.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(Dg)&&(t=t.update({add:[AG.range(n.value,n.value+1)]}));return t}});function M4t(){return[O4t,C5e]}const SD="()[]{}<>«»»«[]{}";function E5e(t){for(let e=0;e<SD.length;e+=2)if(SD.charCodeAt(e)==t)return SD.charAt(e+1);return yU(t<128?t:t+1)}function T5e(t,e){return t.languageDataAt("closeBrackets",e)[0]||Mk}const N4t=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),O4t=ht.inputHandler.of((t,e,n,r)=>{if((N4t?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(r.length>2||r.length==2&&Vu(oa(r,0))==1||e!=i.from||n!=i.to)return!1;let s=L4t(t.state,r);return s?(t.dispatch(s),!0):!1}),D4t=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=T5e(t,t.selection.main.head).brackets||Mk.brackets,i=null,s=t.changeByRange(o=>{if(o.empty){let a=z4t(t.doc,o.head);for(let l of r)if(l==a&&LR(t.doc,o.head)==E5e(oa(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:be.cursor(o.head-l.length)}}return{range:i=o}});return i||e(t.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},P4t=[{key:"Backspace",run:D4t}];function L4t(t,e){let n=T5e(t,t.selection.main.head),r=n.brackets||Mk.brackets;for(let i of r){let s=E5e(oa(i,0));if(e==i)return s==i?F4t(t,i,r.indexOf(i+i+i)>-1,n):j4t(t,i,s,n.before||Mk.before);if(e==s&&A5e(t,t.selection.main.from))return B4t(t,i,s)}return null}function A5e(t,e){let n=!1;return t.field(C5e).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function LR(t,e){let n=t.sliceString(e,e+2);return n.slice(0,Vu(oa(n,0)))}function z4t(t,e){let n=t.sliceString(e-2,e);return Vu(oa(n,0))==n.length?n:n.slice(1)}function j4t(t,e,n,r){let i=null,s=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:Dg.of(o.to+e.length),range:be.range(o.anchor+e.length,o.head+e.length)};let a=LR(t.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+n,from:o.head},effects:Dg.of(o.head+e.length),range:be.cursor(o.head+e.length)}:{range:i=o}});return i?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function B4t(t,e,n){let r=null,i=t.changeByRange(s=>s.empty&&LR(t.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:be.cursor(s.head+n.length)}:r={range:s});return r?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function F4t(t,e,n,r){let i=r.stringPrefixes||Mk.stringPrefixes,s=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Dg.of(a.to+e.length),range:be.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=LR(t.doc,l),u;if(c==e){if(Lse(t,l))return{changes:{insert:e+e,from:l},effects:Dg.of(l+e.length),range:be.cursor(l+e.length)};if(A5e(t,l)){let h=n&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+h.length,insert:h},range:be.cursor(l+h.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(u=zse(t,l-2*e.length,i))>-1&&Lse(t,u))return{changes:{insert:e+e+e+e,from:l},effects:Dg.of(l+e.length),range:be.cursor(l+e.length)};if(t.charCategorizer(l)(c)!=Fr.Word&&zse(t,l,i)>-1&&!V4t(t,l,e,i))return{changes:{insert:e+e,from:l},effects:Dg.of(l+e.length),range:be.cursor(l+e.length)}}return{range:s=a}});return s?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Lse(t,e){let n=zs(t).resolveInner(e+1);return n.parent&&n.from==e}function V4t(t,e,n,r){let i=zs(t).resolveInner(e,-1),s=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=t.sliceDoc(i.from,Math.min(i.to,i.from+n.length+s)),l=a.indexOf(n);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let u=i.firstChild;for(;u&&u.from==i.from&&u.to-u.from>n.length+l;){if(t.sliceDoc(u.to-n.length,u.to)==n)return!1;u=u.firstChild}return!0}let c=i.to==e&&i.parent;if(!c)break;i=c}return!1}function zse(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Fr.Word)return e;for(let i of n){let s=e-i.length;if(t.sliceDoc(s,e)==i&&r(t.sliceDoc(s-1,s))!=Fr.Word)return s}return-1}function $4t(t={}){return[b4t,aa,hs.of(t),y4t,H4t,S5e]}const I5e=[{key:"Ctrl-Space",run:_D},{mac:"Alt-`",run:_D},{mac:"Alt-i",run:_D},{key:"Escape",run:f4t},{key:"ArrowDown",run:eT(!0)},{key:"ArrowUp",run:eT(!1)},{key:"PageDown",run:eT(!0,"page")},{key:"PageUp",run:eT(!1,"page")},{key:"Enter",run:h4t}],H4t=S0.highest(l2.computeN([hs],t=>t.facet(hs).defaultKeymap?[I5e]:[]));class jse{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class xg{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let i=r.facet(Nk).markerFilter;i&&(e=i(e,r));let s=e.slice().sort((f,p)=>f.from-p.from||f.to-p.to),o=new hf,a=[],l=0,c=r.doc.iter(),u=0,d=r.doc.length;for(let f=0;;){let p=f==s.length?null:s[f];if(!p&&!a.length)break;let g,y;if(a.length)g=l,y=a.reduce((_,S)=>Math.min(_,S.to),p&&p.from>g?p.from:1e8);else{if(g=p.from,g>d)break;y=p.to,a.push(p),f++}for(;f<s.length;){let _=s[f];if(_.from==g&&(_.to>_.from||_.to==g))a.push(_),f++,y=Math.min(_.to,y);else{y=Math.min(_.from,y);break}}y=Math.min(y,d);let v=!1;if(a.some(_=>_.from==g&&(_.to==y||y==d))&&(v=g==y,!v&&y-g<10)){let _=g-(u+c.value.length);_>0&&(c.next(_),u=g);for(let S=g;;){if(S>=y){v=!0;break}if(!c.lineBreak&&u+c.value.length>S)break;S=u+c.value.length,u+=c.value.length,c.next()}}let b=n_t(a);if(v)o.add(g,g,It.widget({widget:new Q4t(b),diagnostics:a.slice()}));else{let _=a.reduce((S,k)=>k.markClass?S+" "+k.markClass:S,"");o.add(g,y,It.mark({class:"cm-lintRange cm-lintRange-"+b+_,diagnostics:a.slice(),inclusiveEnd:a.some(S=>S.to>y)}))}if(l=y,l==d)break;for(let _=0;_<a.length;_++)a[_].to<=l&&a.splice(_--,1)}let h=o.finish();return new xg(h,n,n0(h))}}function n0(t,e=null,n=0){let r=null;return t.between(n,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new jse(i,s,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new jse(r.from,s,r.diagnostic)}}),r}function U4t(t,e){let n=e.pos,r=e.end||n,i=t.state.facet(Nk).hideOn(t,n,r);if(i!=null)return i;let s=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(R5e))||t.changes.touchesRange(s.from,Math.max(s.to,r)))}function q4t(t,e){return t.field(qa,!1)?e:e.concat(Ut.appendConfig.of(r_t))}const R5e=Ut.define(),IG=Ut.define(),M5e=Ut.define(),qa=Vs.define({create(){return new xg(It.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,i=t.panel;if(t.selected){let s=e.changes.mapPos(t.selected.from,1);r=n0(n,t.selected.diagnostic,s)||n0(n,null,s)}!n.size&&i&&e.state.facet(Nk).autoPanel&&(i=null),t=new xg(n,i,r)}for(let n of e.effects)if(n.is(R5e)){let r=e.state.facet(Nk).autoPanel?n.value.length?Ok.open:null:t.panel;t=xg.init(n.value,r,e.state)}else n.is(IG)?t=new xg(t.diagnostics,n.value?Ok.open:null,t.selected):n.is(M5e)&&(t=new xg(t.diagnostics,t.panel,n.value));return t},provide:t=>[sk.from(t,e=>e.panel),ht.decorations.from(t,e=>e.diagnostics)]}),W4t=It.mark({class:"cm-lintRange cm-lintRange-active"});function G4t(t,e,n){let{diagnostics:r}=t.state.field(qa),i,s=-1,o=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(l,c,{spec:u})=>{if(e>=l&&e<=c&&(l==c||(e>l||n>0)&&(e<c||n<0)))return i=u.diagnostics,s=l,o=c,!1});let a=t.state.facet(Nk).tooltipFilter;return i&&a&&(i=a(i,t.state)),i?{pos:s,end:o,above:t.state.doc.lineAt(s).to<o,create(){return{dom:K4t(t,i)}}}:null}function K4t(t,e){return ar("ul",{class:"cm-tooltip-lint"},e.map(n=>O5e(t,n,!1)))}const Y4t=t=>{let e=t.state.field(qa,!1);(!e||!e.panel)&&t.dispatch({effects:q4t(t.state,[IG.of(!0)])});let n=PU(t,Ok.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},Bse=t=>{let e=t.state.field(qa,!1);return!e||!e.panel?!1:(t.dispatch({effects:IG.of(!1)}),!0)},Z4t=t=>{let e=t.state.field(qa,!1);if(!e)return!1;let n=t.state.selection.main,r=n0(e.diagnostics,null,n.to+1);return!r&&(r=n0(e.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),Uit(t,r.from,1,{tooltip:D5e,until:i=>i.docChanged||i.newSelection.main.head<r.from||i.newSelection.main.head>r.to}),!0)},X4t=[{key:"Mod-Shift-m",run:Y4t,preventDefault:!0},{key:"F8",run:Z4t}],Nk=st.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...Id(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Fse,tooltipFilter:Fse,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,i,s)=>e(r,i,s)||n(r,i,s):e:n,autoPanel:(e,n)=>e||n})}}});function Fse(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function N5e(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;r<n.length;r++){let i=n[r];if(/[a-zA-Z]/.test(i)&&!e.some(s=>s.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function O5e(t,e,n){var r;let i=n?N5e(e.actions):[];return ar("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},ar("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((s,o)=>{let a=!1,l=f=>{if(f.preventDefault(),a)return;a=!0;let p=n0(t.state.field(qa).diagnostics,e);p&&s.apply(t,p.from,p.to)},{name:c}=s,u=i[o]?c.indexOf(i[o]):-1,d=u<0?c:[c.slice(0,u),ar("u",c.slice(u,u+1)),c.slice(u+1)],h=s.markClass?" "+s.markClass:"";return ar("button",{type:"button",class:"cm-diagnosticAction"+h,onclick:l,onmousedown:l,"aria-label":` Action: ${c}${u<0?"":` (access key "${i[o]})"`}.`},d)}),e.source&&ar("div",{class:"cm-diagnosticSource"},e.source))}class Q4t extends Rd{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return ar("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Vse{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=O5e(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Ok{constructor(e){this.view=e,this.items=[];let n=i=>{if(!(i.ctrlKey||i.altKey||i.metaKey)){if(i.keyCode==27)Bse(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=N5e(s.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==i.keyCode){let l=n0(this.view.state.field(qa).diagnostics,s);l&&s.actions[a].apply(e,l.from,l.to)}}else return;i.preventDefault()}},r=i=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(i.target)&&this.moveSelection(s)};this.list=ar("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=ar("div",{class:"cm-panel-lint"},this.list,ar("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Bse(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(qa).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(qa),r=0,i=!1,s=null,o=new Set;for(e.between(0,this.view.state.doc.length,(a,l,{spec:c})=>{for(let u of c.diagnostics){if(o.has(u))continue;o.add(u);let d=-1,h;for(let f=r;f<this.items.length;f++)if(this.items[f].diagnostic==u){d=f;break}d<0?(h=new Vse(this.view,u),this.items.splice(r,0,h),i=!0):(h=this.items[d],d>r&&(this.items.splice(r,d-r),i=!0)),n&&h.diagnostic==n.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),s=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),r++}});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new Vse(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let c=l.height/this.list.offsetHeight;a.top<l.top?this.list.scrollTop-=(l.top-a.top)/c:a.bottom>l.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(qa),r=n0(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:M5e.of(r)})}static open(e){return new Ok(e)}}function J4t(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function tT(t){return J4t(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const e_t=ht.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:tT("#f11")},".cm-lintRange-warning":{backgroundImage:tT("orange")},".cm-lintRange-info":{backgroundImage:tT("#999")},".cm-lintRange-hint":{backgroundImage:tT("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function t_t(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function n_t(t){let e="hint",n=1;for(let r of t){let i=t_t(r.severity);i>n&&(n=i,e=r.severity)}return e}const D5e=Hit(G4t,{hideOn:U4t}),r_t=[qa,ht.decorations.compute([qa],t=>{let{selected:e,panel:n}=t.field(qa);return!e||!n||e.from==e.to?It.none:It.set([W4t.range(e.from,e.to)])}),D5e,e_t],i_t=[rst(),ost(),wit(),Hwt(),$st(),Nwe(),pit(),Vr.allowMultipleSelections.of(!0),Ast(),ixe(Wst,{fallback:!0}),Jst(),M4t(),$4t(),Nit(),Pit(),Eit(),S2t(),l2.of([...P4t,...i5e,...U2t,...Qwt,...jst,...I5e,...X4t])];function s_t(t){return t.nodeType===1}function o_t(t){return s_t(t)&&t.namespaceURI==="http://www.w3.org/1999/xhtml"}function a_t(t){let e=[[-1,t.state.doc]],n=[];for(;e.length>0;){const[r,i]=e.pop();if(r>=0){let s=t.nodeDOM(r);if(s&&o_t(s)){let{top:o,bottom:a,left:l,right:c}=s.getBoundingClientRect();n.push([r,[l,o,c,o]],[r+i.nodeSize,[l,a,c,a]])}}if(i.isBlock&&!i.isTextblock){let s=r+1;for(let o of i.children)e.push([s,o]),s+=o.nodeSize}}return n}function l_t(t,e){let n=[],r,i;const s=()=>{const u=t.dom.getBoundingClientRect(),d=t.state.doc;return n&&r&&i&&u.width===i.width&&u.height===i.height&&u.x===i.x&&u.y===i.y&&r.eq(d)||(i=u,r=d,n=a_t(t)),n},o=(u,d)=>{if(!t.editable||t.isDestroyed)return;const h=(g,y)=>{const[v,b]=g,[_,S]=y;return Hse(u,b)-Hse(u,S)||v-_};let f=s();f.sort(h),f=f.slice(0,8);const p=f.find(g=>(e==null?void 0:e({view:t,pos:g[0],event:d}))!==!1);if(!(p&&u_t(t,p[0])))return p};let a,l;return(u,d)=>(a&&c_t(a,u)||(a=u,l=o(u,d)),l)}function c_t(t,e){return t[0]===e[0]&&t[1]===e[1]}function $se(t,e){return Math.abs(t[0]-e[0])+Math.abs(t[1]-e[1])}function Hse(t,e){return Math.min($se(t,[e[0],e[1]]),$se(t,[e[2],e[3]]))}function u_t(t,e){const n=t.dragging;if(!n)return;const{move:r}=n;if(!r)return;const i=t.state.selection;if(!(i instanceof Et))return;const{from:s,to:o}=i;return s<=e&&e<=o}function d_t(t){let e;return new Fn({key:new Vn("prosekit-drop-indicator"),view:n=>(e=l_t(n,t.onDrag),f_t(n,e,t)),props:{handleDrop(n,r,i,s){if(!e)return!1;const o=e([r.clientX,r.clientY],r);if(!o)return!1;r.preventDefault();let a=o[0],l=n.state.tr;if(s){let{node:f}=n.dragging||{};f?f.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,i.content.firstChild):l.replaceRange(c,c,i),l.doc.eq(d))return!0;let h=l.doc.resolve(c);if(u&&Et.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new Et(h));else{let f=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((p,g,y,v)=>f=v),l.setSelection(h_t(n,h,l.doc.resolve(f)))}return n.focus(),n.dispatch(l.setMeta("uiEvent","drop")),!0}}})}function h_t(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||mt.between(e,n,r)}function f_t(t,e,n){let r=t.dom,i,s,o,a=!1;const l=()=>{i&&clearTimeout(i),a=!1,i=setTimeout(()=>{var d;a||(d=n.onHide)==null||d.call(n)},30)},c=d=>{var g;a=!0;const{clientX:h,clientY:f}=d;if(s===h&&o===f)return;s=h,o=f;let p=e([h,f],d);if(p){const[y,[v,b,_,S]]=p,k={p1:{x:v,y:b},p2:{x:_,y:S}};(g=n.onShow)==null||g.call(n,{view:t,pos:y,line:k})}else{l();return}};return r.addEventListener("dragover",c),r.addEventListener("dragend",l),r.addEventListener("drop",l),r.addEventListener("dragleave",l),{destroy:()=>{r.removeEventListener("dragover",c),r.removeEventListener("dragend",l),r.removeEventListener("drop",l),r.removeEventListener("dragleave",l)}}}class ci extends jt{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return ci.valid(r)?new ci(r):jt.near(r)}content(){return We.empty}eq(e){return e instanceof ci&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ci(e.resolve(n.pos))}getBookmark(){return new RG(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!p_t(e)||!m_t(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&ci.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=n;let l=e.doc.resolve(i);if(ci.valid(l))return l}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!Et.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let a=e.doc.resolve(i);if(ci.valid(a))return a}return null}}}ci.prototype.visible=!1;ci.findFrom=ci.findGapCursorFrom;jt.jsonID("gapcursor",ci);class RG{constructor(e){this.pos=e}map(e){return new RG(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ci.valid(n)?new ci(n):jt.near(n)}}function P5e(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function p_t(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||P5e(i.type))return!0;if(i.inlineContent)return!1}}return!0}function m_t(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||P5e(i.type))return!0;if(i.inlineContent)return!1}}return!0}function g_t(){return new Fn({props:{decorations:w_t,createSelectionBetween(t,e,n){return e.pos==n.pos&&ci.valid(n)?new ci(n):null},handleClick:v_t,handleKeyDown:y_t,handleDOMEvents:{beforeinput:b_t}}})}const y_t=sq({ArrowLeft:nT("horiz",-1),ArrowRight:nT("horiz",1),ArrowUp:nT("vert",-1),ArrowDown:nT("vert",1)});function nT(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof mt){if(!s.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=ci.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new ci(c))),!0):!1}}function v_t(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ci.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Et.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ci(r))),!0)}function b_t(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ci))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=De.empty;for(let o=r.length-1;o>=0;o--)i=De.from(r[o].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new We(i,0,0));return s.setSelection(mt.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function w_t(t){if(!(t.selection instanceof ci))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",En.create(t.doc,[sr.widget(t.selection.head,e,{key:"gapcursor"})])}function hC(t,e){return Object.assign(t,{meta:{package:"@milkdown/plugin-cursor",...e}}),t}var Dk=xn(null,"dropIndicatorState");hC(Dk,{displayName:"Ctx<dropIndicatorState>"});var zR=xn({width:2,color:!1,class:"milkdown-drop-indicator"},"dropIndicatorConfig");hC(zR,{displayName:"Ctx<dropIndicatorConfig>"});var x_t=new Vn("MILKDOWN_DROP_INDICATOR_DOM"),L5e=Sr(t=>new Fn({key:x_t,view:e=>{var o;const n=t.get(zR.key),r=document.createElement("div");Object.assign(r.style,{position:"fixed",pointerEvents:"none",display:"none",backgroundColor:n.color,top:"0",left:"0"}),r.classList.add(n.class),r.classList.add("milkdown-drop-indicator"),(o=e.dom.parentNode)==null||o.appendChild(r);const i=t.use(Dk.key),s=a=>{__t(r,a,n)};return i.on(s),{destroy:()=>{i.off(s),r.remove()}}}}));hC(L5e,{displayName:"Prose<dropIndicatorDOM>"});function __t(t,e,n){if(!e){Object.assign(t.style,{display:"none"});return}const{line:r}=e,{width:i}=n,{p1:{x:s,y:o},p2:{x:a,y:l}}=r,c=o===l;let u,d,h=o,f=s;c?(u=a-s,d=i,h-=i/2):(u=i,d=l-o,f-=i/2),h=Math.round(h),f=Math.round(f),Object.assign(t.style,{display:"block",width:`${u}px`,height:`${d}px`,transform:`translate(${f}px, ${h}px)`})}var z5e=Sr(t=>d_t({onShow:r=>{t.set(Dk.key,r)},onHide:()=>{t.set(Dk.key,null)},onDrag:()=>!0}));hC(z5e,{displayName:"Prose<dropIndicator>"});var j5e=Sr(()=>g_t());hC(j5e,{displayName:"Prose<gapCursor>"});var S_t=[j5e,zR,Dk,L5e,z5e].flat();function k_t(t){var e;const n=(e=void 0)!=null?e:!1;let r=typeof document>"u"?null:document.createElement("div");return new Fn({key:C_t,view:i=>{n!==!0&&I_t(i.state.schema,n||[]);const s=i.dom.ownerDocument;r=r||document.createElement("div");const o=r,a=()=>{T_t(i,o)};let l;return window.ResizeObserver&&(l=new window.ResizeObserver(()=>a()),l.observe(i.dom)),s.addEventListener("selectionchange",a),{update:()=>{a()},destroy:()=>{s.removeEventListener("selectionchange",a),l&&l.unobserve(i.dom)}}},props:{handleKeyDown:(i,s)=>{var o;const{selection:a}=i.state;if(s.altKey||s.ctrlKey||s.metaKey||s.shiftKey||s.isComposing||!["ArrowLeft","ArrowRight"].includes(s.key)||!NB(a)||!a.empty)return!1;const l=a.$head,[c,u]=B5e(l),d=i.state.storedMarks||l.marks();if(c&&u&&!an.sameSet(c,u)){if(s.key==="ArrowLeft"&&!an.sameSet(c,d))return i.dispatch(i.state.tr.setStoredMarks(c)),!0;if(s.key==="ArrowRight"&&!an.sameSet(u,d))return i.dispatch(i.state.tr.setStoredMarks(u)),!0}return s.key==="ArrowLeft"&&l.textOffset===1?(i.dispatch(i.state.tr.setSelection(mt.create(i.state.doc,l.pos-1)).setStoredMarks(l.marks())),!0):s.key==="ArrowRight"&&l.textOffset+1===((o=l.parent.maybeChild(l.index()))==null?void 0:o.nodeSize)?(i.dispatch(i.state.tr.setSelection(mt.create(i.state.doc,l.pos+1)).setStoredMarks(l.marks())),!0):!1},decorations:i=>{if(!(!r||!NB(i.selection)||!i.selection.empty))return En.create(i.doc,[sr.widget(0,r,{key:"prosemirror-virtual-cursor"})])},attributes:{class:"virtual-cursor-enabled"}}})}var C_t=new Vn("prosemirror-virtual-cursor");function E_t(t,e){var n;const r=window.getSelection();if(!r||!r.rangeCount)return null;const i=(n=r==null?void 0:r.getRangeAt(0))==null?void 0:n.cloneRange();if(!i)return null;i.collapse(e);const s=i.getClientRects(),o=s!=null&&s.length?s[s.length-1]:null;return o!=null&&o.height?o:t.coordsAtPos(t.state.selection.head)}function B5e(t){const e=t.index(),n=t.parent.maybeChild(e);let r=t.textOffset?n:null;return!r&&e>0&&(r=t.parent.maybeChild(e-1)),[r==null?void 0:r.marks,n==null?void 0:n.marks]}function NB(t){return t&&typeof t=="object"&&"$cursor"in t}function T_t(t,e){if(!t||!t.dom||t.isDestroyed||!e)return;const{state:n,dom:r}=t,{selection:i}=n;if(!NB(i))return;const s=E_t(t,i.$head===i.$from);if(!s)return e;const o=r.getBoundingClientRect();let a="prosemirror-virtual-cursor";const l=n.selection.$head,[c,u]=B5e(l),d=n.storedMarks||l.marks();i.$cursor&&c&&u&&d&&!an.sameSet(c,u)&&(an.sameSet(c,d)?a+=" prosemirror-virtual-cursor-left":an.sameSet(u,d)&&(a+=" prosemirror-virtual-cursor-right")),e.className=a,A_t(e,"prosemirror-virtual-cursor-animation"),e.style.height=`${s.bottom-s.top}px`,e.style.left=`${s.left-o.left}px`,e.style.top=`${s.top-o.top}px`}function A_t(t,e){t.classList.remove(e),t.offsetWidth,t.classList.add(e)}function I_t(t,e){for(const[n,r]of Object.entries(t.marks))r.spec.inclusive===!1&&!e.includes(n)&&console.warn(`[prosemirror-virtual-cursor] Virtual cursor does not work well with marks that have inclusive set to false. Please consider removing the inclusive option from the "${n}" mark or adding it to the "skipWarning" option.`)}var R_t=Object.defineProperty,Use=Object.getOwnPropertySymbols,M_t=Object.prototype.hasOwnProperty,N_t=Object.prototype.propertyIsEnumerable,qse=(t,e,n)=>e in t?R_t(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,O_t=(t,e)=>{for(var n in e||(e={}))M_t.call(e,n)&&qse(t,n,e[n]);if(Use)for(var n of Use(e))N_t.call(e,n)&&qse(t,n,e[n]);return t};function F5e(t,e){return Object.assign(t,{meta:O_t({package:"@milkdown/components"},e)}),t}const D_t={imageIcon:"🌌",uploadButton:"Upload",confirmButton:"⏎",uploadPlaceholderText:"/Paste",onUpload:t=>Promise.resolve(URL.createObjectURL(t))},jR=xn(D_t,"inlineImageConfigCtx");F5e(jR,{displayName:"Config<image-inline>",group:"ImageInline"});function MG(...t){}MG(X);function O6({icon:t,class:e,onClick:n}){return X("span",{class:ji("milkdown-icon",e),onPointerdown:n,innerHTML:t?dl.sanitize(t.trim()):void 0})}O6.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};MG(X);const P_t=gq("abcdefg",8),L_t=es({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0},onImageLoadError:{type:Function,required:!1}},setup({readonly:t,src:e,setLink:n,onUpload:r,imageIcon:i,uploadButton:s,confirmButton:o,uploadPlaceholderText:a,className:l,onImageLoadError:c}){var u,d;const h=nt(!1),f=nt(),p=nt((u=e.value)!=null?u:""),g=nt(P_t()),y=nt(((d=e.value)==null?void 0:d.length)!==0),v=k=>{const E=k.target.value;y.value=E.length!==0,p.value=E},b=k=>{var T,E;k.key==="Enter"&&n((E=(T=f.value)==null?void 0:T.value)!=null?E:"")},_=()=>{var k,T;n((T=(k=f.value)==null?void 0:k.value)!=null?T:"")},S=k=>{var T;const E=(T=k.target.files)==null?void 0:T[0];E&&r(E).then(C=>{C&&(n(C),y.value=!0)}).catch(C=>{console.error("An error occurred while uploading image"),console.error(C)})};return()=>X("div",{class:ji("image-edit",l)},X(O6,{icon:i,class:"image-icon"}),X("div",{class:ji("link-importer",h.value&&"focus")},X("input",{ref:f,draggable:"true",onDragstart:k=>{k.preventDefault(),k.stopPropagation()},disabled:t.value,class:"link-input-area",value:p.value,onInput:v,onKeydown:b,onFocus:()=>h.value=!0,onBlur:()=>h.value=!1}),!y.value&&X("div",{class:"placeholder"},X("input",{disabled:t.value,class:"hidden",id:g.value,type:"file",accept:"image/*",onChange:S}),X("label",{class:"uploader",for:g.value},X(O6,{icon:s})),X("span",{class:"text",onClick:()=>{var k;return(k=f.value)==null?void 0:k.focus()}},a))),p.value&&X(Fragment,null,X("div",{class:"image-preview"},X("img",{src:p.value,alt:"",onError:k=>Promise.resolve(c==null?void 0:c(k)).catch(()=>{})})),X("div",{class:"confirm",onClick:()=>_()},X(O6,{icon:o}))))}});MG(X,mr);const z_t=es({props:{src:{type:Object,required:!0},alt:{type:Object,required:!0},title:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(t){const{src:e,alt:n,title:r}=t;return()=>{var i;return(i=e.value)!=null&&i.length?X("img",{class:"image-inline",src:e.value,alt:n.value,title:r.value}):X(L_t,{src:t.src,selected:t.selected,readonly:t.readonly,setLink:s=>t.setAttr("src",s),imageIcon:t.config.imageIcon,uploadButton:t.config.uploadButton,confirmButton:t.config.confirmButton,uploadPlaceholderText:t.config.uploadPlaceholderText,onUpload:t.config.onUpload,className:"empty-image-inline"})}}}),V5e=F3(Ny.node,t=>(e,n,r)=>{const i=nt(e.attrs.src),s=nt(e.attrs.alt),o=nt(e.attrs.title),a=nt(!1),l=nt(!n.editable),c=(y,v)=>{if(!n.editable)return;const b=r();b!=null&&n.dispatch(n.state.tr.setNodeAttribute(b,y,y==="src"?dl.sanitize(v):v))},u=t.get(jR.key),d=hl(z_t,{src:i,alt:s,title:o,selected:a,readonly:l,setAttr:c,config:u}),h=document.createElement("span");h.className="milkdown-image-inline";const f=p2(()=>{a.value?h.classList.add("selected"):h.classList.remove("selected")}),p=u.proxyDomURL,g=y=>{if(!p)i.value=y.attrs.src;else{const v=p(y.attrs.src);typeof v=="string"?i.value=v:v.then(b=>{i.value=b}).catch(console.error)}s.value=y.attrs.alt,o.value=y.attrs.title};return g(e),d.mount(h),{dom:h,update:y=>y.type!==e.type?!1:(g(y),!0),stopEvent:y=>y.target instanceof HTMLInputElement,selectNode:()=>{a.value=!0},deselectNode:()=>{a.value=!1},destroy:()=>{f(),d.unmount(),h.remove()}}});F5e(V5e,{displayName:"NodeView<image-inline>",group:"ImageInline"});const j_t=[jR,V5e];class Fe extends Error{constructor(e,n){var r="KaTeX parse error: "+e,i,s,o=n&&n.loc;if(o&&o.start<=o.end){var a=o.lexer.input;i=o.start,s=o.end,i===a.length?r+=" at end of input: ":r+=" at position "+(i+1)+": ";var l=a.slice(i,s).replace(/[^]/g,"$&̲"),c;i>15?c="…"+a.slice(i-15,i):c=a.slice(0,i);var u;s+15<a.length?u=a.slice(s,s+15)+"…":u=a.slice(s),r+=c+l+u}super(r),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,Fe.prototype),this.position=i,i!=null&&s!=null&&(this.length=s-i),this.rawMessage=e}}var B_t=/([A-Z])/g,F_t=t=>t.replace(B_t,"-$1").toLowerCase(),V_t={"&":"&",">":">","<":"<",'"':""","'":"'"},$_t=/[&><"']/g,ro=t=>String(t).replace($_t,e=>V_t[e]),D6=t=>t.type==="ordgroup"||t.type==="color"?t.body.length===1?D6(t.body[0]):t:t.type==="font"?D6(t.body):t,H_t=new Set(["mathord","textord","atom"]),Nf=t=>H_t.has(D6(t).type),U_t=t=>{var e=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(t);return e?e[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e[1])?null:e[1].toLowerCase():"_relative"},OB={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand <n>",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function q_t(t){if(typeof t!="string")return t.enum[0];switch(t){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{};default:throw new Error("Unexpected schema type; settings must declare an explicit default.")}}function W_t(t){if(t.default!==void 0)return t.default;var e=Array.isArray(t.type)?t.type[0]:t.type;return q_t(e)}function G_t(t,e,n,r){var i=n[e];t[e]=i!==void 0?r.processor?r.processor(i):i:W_t(r)}class NG{constructor(e){e===void 0&&(e={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var n of Object.keys(OB)){var r=OB[n];r&&G_t(this,n,e,r)}}reportNonstrict(e,n,r){var i=this.strict;if(typeof i=="function"&&(i=i(e,n,r)),!(!i||i==="ignore")){if(i===!0||i==="error")throw new Fe("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+e+"]"),r);i==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+n+" ["+e+"]"))}}useStrictBehavior(e,n,r){var i=this.strict;if(typeof i=="function")try{i=i(e,n,r)}catch{i="error"}return!i||i==="ignore"?!1:i===!0||i==="error"?!0:i==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+n+" ["+e+"]")),!1)}isTrusted(e){if("url"in e&&e.url&&!e.protocol){var n=U_t(e.url);if(n==null)return!1;e.protocol=n}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class Xf{constructor(e,n,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=n,this.cramped=r}sup(){return ju[K_t[this.id]]}sub(){return ju[Y_t[this.id]]}fracNum(){return ju[Z_t[this.id]]}fracDen(){return ju[X_t[this.id]]}cramp(){return ju[Q_t[this.id]]}text(){return ju[J_t[this.id]]}isTight(){return this.size>=2}}var OG=0,B8=1,Eb=2,Wh=3,Pk=4,Hl=5,bx=6,Io=7,ju=[new Xf(OG,0,!1),new Xf(B8,0,!0),new Xf(Eb,1,!1),new Xf(Wh,1,!0),new Xf(Pk,2,!1),new Xf(Hl,2,!0),new Xf(bx,3,!1),new Xf(Io,3,!0)],K_t=[Pk,Hl,Pk,Hl,bx,Io,bx,Io],Y_t=[Hl,Hl,Hl,Hl,Io,Io,Io,Io],Z_t=[Eb,Wh,Pk,Hl,bx,Io,bx,Io],X_t=[Wh,Wh,Hl,Hl,Io,Io,Io,Io],Q_t=[B8,B8,Wh,Wh,Hl,Hl,Io,Io],J_t=[OG,B8,Eb,Wh,Eb,Wh,Eb,Wh],Ht={DISPLAY:ju[OG],TEXT:ju[Eb],SCRIPT:ju[Pk],SCRIPTSCRIPT:ju[bx]},DB=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function eSt(t){for(var e=0;e<DB.length;e++)for(var n=DB[e],r=0;r<n.blocks.length;r++){var i=n.blocks[r];if(t>=i[0]&&t<=i[1])return n.name}return null}var P6=[];DB.forEach(t=>t.blocks.forEach(e=>P6.push(...e)));function $5e(t){for(var e=0;e<P6.length;e+=2)if(t>=P6[e]&&t<=P6[e+1])return!0;return!1}var Wi=t=>t+" "+t,ev=80,tSt=function(e,n){return"M95,"+(622+e+n)+`
|
||
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
||
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
||
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
|
||
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
|
||
c69,-144,104.5,-217.7,106.5,-221
|
||
l`+e/2.075+" -"+e+`
|
||
c5.3,-9.3,12,-14,20,-14
|
||
H400000v`+(40+e)+`H845.2724
|
||
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
|
||
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
|
||
M`+(834+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},nSt=function(e,n){return"M263,"+(601+e+n)+`c0.7,0,18,39.7,52,119
|
||
c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
|
||
c340,-704.7,510.7,-1060.3,512,-1067
|
||
l`+e/2.084+" -"+e+`
|
||
c4.7,-7.3,11,-11,19,-11
|
||
H40000v`+(40+e)+`H1012.3
|
||
s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232
|
||
c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
|
||
s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
|
||
c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
|
||
M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},rSt=function(e,n){return"M983 "+(10+e+n)+`
|
||
l`+e/3.13+" -"+e+`
|
||
c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+`
|
||
H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
|
||
s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744
|
||
c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
|
||
c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
|
||
c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
|
||
c53.7,-170.3,84.5,-266.8,92.5,-289.5z
|
||
M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},iSt=function(e,n){return"M424,"+(2398+e+n)+`
|
||
c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
|
||
c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
|
||
s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
|
||
s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081
|
||
l`+e/4.223+" -"+e+`c4,-6.7,10,-10,18,-10 H400000
|
||
v`+(40+e)+`H1014.6
|
||
s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
|
||
c-2,6,-10,9,-24,9
|
||
c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+" "+n+`
|
||
h400000v`+(40+e)+"h-400000z"},sSt=function(e,n){return"M473,"+(2713+e+n)+`
|
||
c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+" -"+e+`
|
||
c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7
|
||
s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
|
||
c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
|
||
c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
|
||
s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
|
||
606zM`+(1001+e)+" "+n+"h400000v"+(40+e)+"H1017.7z"},oSt=function(e){var n=e/2;return"M400000 "+e+" H0 L"+n+" 0 l65 45 L145 "+(e-80)+" H400000z"},aSt=function(e,n,r){var i=r-54-n-e;return"M702 "+(e+n)+"H400000"+(40+e)+`
|
||
H742v`+i+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
|
||
h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
|
||
c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
|
||
219 661 l218 661zM702 `+n+"H400000v"+(40+e)+"H742z"},lSt=function(e,n,r){n=1e3*n;var i="";switch(e){case"sqrtMain":i=tSt(n,ev);break;case"sqrtSize1":i=nSt(n,ev);break;case"sqrtSize2":i=rSt(n,ev);break;case"sqrtSize3":i=iSt(n,ev);break;case"sqrtSize4":i=sSt(n,ev);break;case"sqrtTall":i=aSt(n,ev,r)}return i},cSt=function(e,n){switch(e){case"⎜":return Wi("M291 0 H417 V"+n+" H291z");case"∣":return Wi("M145 0 H188 V"+n+" H145z");case"∥":return Wi("M145 0 H188 V"+n+" H145z")+Wi("M367 0 H410 V"+n+" H367z");case"⎟":return Wi("M457 0 H583 V"+n+" H457z");case"⎢":return Wi("M319 0 H403 V"+n+" H319z");case"⎥":return Wi("M263 0 H347 V"+n+" H263z");case"⎪":return Wi("M384 0 H504 V"+n+" H384z");case"⏐":return Wi("M312 0 H355 V"+n+" H312z");case"‖":return Wi("M257 0 H300 V"+n+" H257z")+Wi("M478 0 H521 V"+n+" H478z");default:return""}},Wse={doubleleftarrow:`M262 157
|
||
l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
|
||
0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
|
||
14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
|
||
c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5
|
||
157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87
|
||
-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7
|
||
-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z
|
||
m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l
|
||
-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5
|
||
14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88
|
||
-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68
|
||
-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18
|
||
-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782
|
||
c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3
|
||
-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120
|
||
135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8
|
||
-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247
|
||
c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208
|
||
490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3
|
||
1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202
|
||
l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117
|
||
-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7
|
||
5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13
|
||
35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688
|
||
0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7
|
||
-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80
|
||
H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0
|
||
435 0h399565z`,leftgroupunder:`M400000 262
|
||
H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219
|
||
435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3
|
||
-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5
|
||
-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7
|
||
-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5
|
||
20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3
|
||
-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7
|
||
-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z
|
||
m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333
|
||
5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5
|
||
1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667
|
||
-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12
|
||
10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7
|
||
-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0
|
||
v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
|
||
-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
|
||
-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
|
||
71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:Wi("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:Wi("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:Wi("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:Wi("M40 281 V448H0V74H40V241H400000v40z"),leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
|
||
-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
|
||
c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
|
||
68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:Wi("M0 50 h400000 v40H0z m0 194h40000v40H0z"),midbrace:`M200428 334
|
||
c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
|
||
-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
|
||
311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
|
||
12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214
|
||
c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14
|
||
53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3
|
||
11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0
|
||
-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6
|
||
-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z
|
||
m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8
|
||
60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8
|
||
-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z
|
||
m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2
|
||
c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6
|
||
-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z
|
||
m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0
|
||
85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8
|
||
-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z
|
||
m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1
|
||
c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128
|
||
-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20
|
||
11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7
|
||
39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85
|
||
-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
|
||
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
|
||
151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l
|
||
-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5
|
||
s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1
|
||
c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3
|
||
28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237
|
||
-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0
|
||
3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18
|
||
0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3
|
||
-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2
|
||
-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58
|
||
69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11
|
||
-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7
|
||
2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z
|
||
m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8
|
||
8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5
|
||
-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95
|
||
-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8
|
||
15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3
|
||
8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3
|
||
-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z
|
||
m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
|
||
15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
|
||
-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
|
||
66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:Wi("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:Wi("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:Wi("M399995 440 h-120 V150 H0 v-120 H399995z"),rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
|
||
1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
|
||
-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
|
||
-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40
|
||
115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69
|
||
-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3
|
||
-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19
|
||
-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101
|
||
10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167
|
||
c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3
|
||
41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42
|
||
18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333
|
||
-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70
|
||
101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7
|
||
-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0
|
||
114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0
|
||
4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128
|
||
-68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418
|
||
-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9
|
||
31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114
|
||
c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751
|
||
181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457
|
||
-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0
|
||
411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697
|
||
16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696
|
||
-338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345
|
||
-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409
|
||
177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9
|
||
14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409
|
||
-175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5
|
||
3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
|
||
10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
|
||
-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
|
||
-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
|
||
H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
|
||
c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22
|
||
c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10
|
||
-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10
|
||
-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10
|
||
-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,
|
||
-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
|
||
-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
|
||
-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
|
||
-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202
|
||
c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5
|
||
c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130
|
||
s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47
|
||
121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6
|
||
s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11
|
||
c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z
|
||
M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32
|
||
-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0
|
||
13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39
|
||
-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5
|
||
-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
|
||
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
|
||
151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
|
||
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17
|
||
c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21
|
||
c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40
|
||
c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z
|
||
M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0
|
||
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
|
||
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
|
||
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
|
||
M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
|
||
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,
|
||
1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,
|
||
-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z
|
||
M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0
|
||
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
|
||
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
|
||
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
|
||
M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},uSt=function(e,n){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v1759 v84 h347 v-84
|
||
H403z M403 1759 V0 H319 V1759 v`+n+" v1759 v84 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v1759 H0 v84 H347z
|
||
M347 1759 V0 H263 V1759 v`+n+" v1759 h84z";case"vert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15
|
||
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
|
||
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+" v585 h43z";case"doublevert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15
|
||
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
|
||
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+` v585 h43z
|
||
M367 15 v585 v`+n+` v585 c2.667,10,9.667,15,21,15
|
||
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
|
||
c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+n+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+n+` v1715 h263 v84 H319z
|
||
MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+n+` v1799 H0 v-84 H319z
|
||
MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v602 h84z
|
||
M403 1759 V0 H319 V1759 v`+n+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v602 h84z
|
||
M347 1759 V0 h-84 V1759 v`+n+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1
|
||
c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,
|
||
-36,557 l0,`+(n+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,
|
||
949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9
|
||
c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,
|
||
-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189
|
||
l0,-`+(n+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,
|
||
-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,
|
||
63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5
|
||
c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(n+9)+`
|
||
c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664
|
||
c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11
|
||
c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
|
||
c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
|
||
l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
|
||
-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};function dSt(t){return"toText"in t}let _2=class{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),n=0;n<this.children.length;n++)e.appendChild(this.children[n].toNode());return e}toMarkup(){for(var e="",n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e}toText(){return this.children.map(e=>{if(dSt(e))return e.toText();throw new Error("Expected MathDomNode with toText, got "+e.constructor.name)}).join("")}};var PB={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},hSt={ex:!0,em:!0,mu:!0},H5e=function(e){return typeof e!="string"&&(e=e.unit),e in PB||e in hSt||e==="ex"},Xr=function(e,n){var r;if(e.unit in PB)r=PB[e.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(e.unit==="mu")r=n.fontMetrics().cssEmPerMu;else{var i;if(n.style.isTight()?i=n.havingStyle(n.style.text()):i=n,e.unit==="ex")r=i.fontMetrics().xHeight;else if(e.unit==="em")r=i.fontMetrics().quad;else throw new Fe("Invalid unit: '"+e.unit+"'");i!==n&&(r*=i.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},qe=function(e){return+e.toFixed(4)+"em"},r0=function(e){return e.filter(n=>n).join(" ")},DG=function(e){var n="";for(var r of Object.keys(e)){var i=e[r];i!==void 0&&(n+=F_t(r)+":"+i+";")}return n},U5e=function(e,n,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},n){n.style.isTight()&&this.classes.push("mtight");var i=n.getColor();i&&(this.style.color=i)}},q5e=function(e){var n=document.createElement(e);n.className=r0(this.classes),Object.assign(n.style,this.style);for(var r of Object.keys(this.attributes))n.setAttribute(r,this.attributes[r]);for(var i=0;i<this.children.length;i++)n.appendChild(this.children[i].toNode());return n},fSt=/[\s"'>/=\x00-\x1f]/,W5e=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+ro(r0(this.classes))+'"');var r=DG(this.style);r&&(n+=' style="'+ro(r)+'"');for(var i of Object.keys(this.attributes)){if(fSt.test(i))throw new Fe("Invalid attribute name '"+i+"'");n+=" "+i+'="'+ro(this.attributes[i])+'"'}n+=">";for(var s=0;s<this.children.length;s++)n+=this.children[s].toMarkup();return n+="</"+e+">",n};class S2{constructor(e,n,r,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,U5e.call(this,e,r,i),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return q5e.call(this,"span")}toMarkup(){return W5e.call(this,"span")}}class BR{constructor(e,n,r,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,U5e.call(this,n,i),this.children=r||[],this.setAttribute("href",e)}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return q5e.call(this,"a")}toMarkup(){return W5e.call(this,"a")}}class pSt{constructor(e,n,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=e,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=r}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");return e.src=this.src,e.alt=this.alt,e.className="mord",Object.assign(e.style,this.style),e}toMarkup(){var e='<img src="'+ro(this.src)+'"'+(' alt="'+ro(this.alt)+'"'),n=DG(this.style);return n&&(e+=' style="'+ro(n)+'"'),e+="'/>",e}}var mSt={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class ll{constructor(e,n,r,i,s,o,a,l){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=n||0,this.depth=r||0,this.italic=i||0,this.skew=s||0,this.width=o||0,this.classes=a||[],this.style=l||{},this.maxFontSize=0;var c=eSt(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=mSt[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),n=null;return this.italic>0&&(n=document.createElement("span"),n.style.marginRight=qe(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=r0(this.classes)),Object.keys(this.style).length>0&&(n=n||document.createElement("span"),Object.assign(n.style,this.style)),n?(n.appendChild(e),n):e}toMarkup(){var e=!1,n="<span";this.classes.length&&(e=!0,n+=' class="',n+=ro(r0(this.classes)),n+='"');var r="";this.italic>0&&(r+="margin-right:"+qe(this.italic)+";"),r+=DG(this.style),r&&(e=!0,n+=' style="'+ro(r)+'"');var i=ro(this.text);return e?(n+=">",n+=i,n+="</span>",n):i}}class bf{constructor(e,n){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=n||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");for(var r of Object.keys(this.attributes))n.setAttribute(r,this.attributes[r]);for(var i=0;i<this.children.length;i++)n.appendChild(this.children[i].toNode());return n}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var n of Object.keys(this.attributes))e+=" "+n+'="'+ro(this.attributes[n])+'"';e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</svg>",e}}class i0{constructor(e,n){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=n}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"path");return this.alternate?n.setAttribute("d",this.alternate):n.setAttribute("d",Wse[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+ro(this.alternate)+'"/>':'<path d="'+ro(Wse[this.pathName])+'"/>'}}class LB{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"line");for(var r of Object.keys(this.attributes))n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var e="<line";for(var n of Object.keys(this.attributes))e+=" "+n+'="'+ro(this.attributes[n])+'"';return e+="/>",e}}function gSt(t){if(t instanceof ll)return t;throw new Error("Expected symbolNode but got "+String(t)+".")}function ySt(t){if(t instanceof S2)return t;throw new Error("Expected span<HtmlDomNode> but got "+String(t)+".")}var vSt=t=>t instanceof S2||t instanceof BR||t instanceof _2,td={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},rT={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},Gse={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function bSt(t,e){td[t]=e}function PG(t,e,n){if(!td[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),i=td[e][r];if(!i&&t[0]in Gse&&(r=Gse[t[0]].charCodeAt(0),i=td[e][r]),!i&&n==="text"&&$5e(r)&&(i=td[e][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var kD={};function wSt(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!kD[e]){var n=kD[e]={cssEmPerMu:rT.quad[e]/18};for(var r in rT)rT.hasOwnProperty(r)&&(n[r]=rT[r][e])}return kD[e]}var $r={math:{},text:{}};function A(t,e,n,r,i,s){$r[t][i]={font:e,group:n,replace:r},s&&r&&($r[t][r]=$r[t][i])}var N="math",Oe="text",j="main",q="ams",Wr="accent-token",ut="bin",$o="close",k2="inner",Mt="mathord",Fi="op-token",fl="open",fC="punct",K="rel",Of="spacing",Q="textord";A(N,j,K,"≡","\\equiv",!0);A(N,j,K,"≺","\\prec",!0);A(N,j,K,"≻","\\succ",!0);A(N,j,K,"∼","\\sim",!0);A(N,j,K,"⊥","\\perp");A(N,j,K,"⪯","\\preceq",!0);A(N,j,K,"⪰","\\succeq",!0);A(N,j,K,"≃","\\simeq",!0);A(N,j,K,"∣","\\mid",!0);A(N,j,K,"≪","\\ll",!0);A(N,j,K,"≫","\\gg",!0);A(N,j,K,"≍","\\asymp",!0);A(N,j,K,"∥","\\parallel");A(N,j,K,"⋈","\\bowtie",!0);A(N,j,K,"⌣","\\smile",!0);A(N,j,K,"⊑","\\sqsubseteq",!0);A(N,j,K,"⊒","\\sqsupseteq",!0);A(N,j,K,"≐","\\doteq",!0);A(N,j,K,"⌢","\\frown",!0);A(N,j,K,"∋","\\ni",!0);A(N,j,K,"∝","\\propto",!0);A(N,j,K,"⊢","\\vdash",!0);A(N,j,K,"⊣","\\dashv",!0);A(N,j,K,"∋","\\owns");A(N,j,fC,".","\\ldotp");A(N,j,fC,"⋅","\\cdotp");A(N,j,fC,"⋅","·");A(Oe,j,Q,"⋅","·");A(N,j,Q,"#","\\#");A(Oe,j,Q,"#","\\#");A(N,j,Q,"&","\\&");A(Oe,j,Q,"&","\\&");A(N,j,Q,"ℵ","\\aleph",!0);A(N,j,Q,"∀","\\forall",!0);A(N,j,Q,"ℏ","\\hbar",!0);A(N,j,Q,"∃","\\exists",!0);A(N,j,Q,"∇","\\nabla",!0);A(N,j,Q,"♭","\\flat",!0);A(N,j,Q,"ℓ","\\ell",!0);A(N,j,Q,"♮","\\natural",!0);A(N,j,Q,"♣","\\clubsuit",!0);A(N,j,Q,"℘","\\wp",!0);A(N,j,Q,"♯","\\sharp",!0);A(N,j,Q,"♢","\\diamondsuit",!0);A(N,j,Q,"ℜ","\\Re",!0);A(N,j,Q,"♡","\\heartsuit",!0);A(N,j,Q,"ℑ","\\Im",!0);A(N,j,Q,"♠","\\spadesuit",!0);A(N,j,Q,"§","\\S",!0);A(Oe,j,Q,"§","\\S");A(N,j,Q,"¶","\\P",!0);A(Oe,j,Q,"¶","\\P");A(N,j,Q,"†","\\dag");A(Oe,j,Q,"†","\\dag");A(Oe,j,Q,"†","\\textdagger");A(N,j,Q,"‡","\\ddag");A(Oe,j,Q,"‡","\\ddag");A(Oe,j,Q,"‡","\\textdaggerdbl");A(N,j,$o,"⎱","\\rmoustache",!0);A(N,j,fl,"⎰","\\lmoustache",!0);A(N,j,$o,"⟯","\\rgroup",!0);A(N,j,fl,"⟮","\\lgroup",!0);A(N,j,ut,"∓","\\mp",!0);A(N,j,ut,"⊖","\\ominus",!0);A(N,j,ut,"⊎","\\uplus",!0);A(N,j,ut,"⊓","\\sqcap",!0);A(N,j,ut,"∗","\\ast");A(N,j,ut,"⊔","\\sqcup",!0);A(N,j,ut,"◯","\\bigcirc",!0);A(N,j,ut,"∙","\\bullet",!0);A(N,j,ut,"‡","\\ddagger");A(N,j,ut,"≀","\\wr",!0);A(N,j,ut,"⨿","\\amalg");A(N,j,ut,"&","\\And");A(N,j,K,"⟵","\\longleftarrow",!0);A(N,j,K,"⇐","\\Leftarrow",!0);A(N,j,K,"⟸","\\Longleftarrow",!0);A(N,j,K,"⟶","\\longrightarrow",!0);A(N,j,K,"⇒","\\Rightarrow",!0);A(N,j,K,"⟹","\\Longrightarrow",!0);A(N,j,K,"↔","\\leftrightarrow",!0);A(N,j,K,"⟷","\\longleftrightarrow",!0);A(N,j,K,"⇔","\\Leftrightarrow",!0);A(N,j,K,"⟺","\\Longleftrightarrow",!0);A(N,j,K,"↦","\\mapsto",!0);A(N,j,K,"⟼","\\longmapsto",!0);A(N,j,K,"↗","\\nearrow",!0);A(N,j,K,"↩","\\hookleftarrow",!0);A(N,j,K,"↪","\\hookrightarrow",!0);A(N,j,K,"↘","\\searrow",!0);A(N,j,K,"↼","\\leftharpoonup",!0);A(N,j,K,"⇀","\\rightharpoonup",!0);A(N,j,K,"↙","\\swarrow",!0);A(N,j,K,"↽","\\leftharpoondown",!0);A(N,j,K,"⇁","\\rightharpoondown",!0);A(N,j,K,"↖","\\nwarrow",!0);A(N,j,K,"⇌","\\rightleftharpoons",!0);A(N,q,K,"≮","\\nless",!0);A(N,q,K,"","\\@nleqslant");A(N,q,K,"","\\@nleqq");A(N,q,K,"⪇","\\lneq",!0);A(N,q,K,"≨","\\lneqq",!0);A(N,q,K,"","\\@lvertneqq");A(N,q,K,"⋦","\\lnsim",!0);A(N,q,K,"⪉","\\lnapprox",!0);A(N,q,K,"⊀","\\nprec",!0);A(N,q,K,"⋠","\\npreceq",!0);A(N,q,K,"⋨","\\precnsim",!0);A(N,q,K,"⪹","\\precnapprox",!0);A(N,q,K,"≁","\\nsim",!0);A(N,q,K,"","\\@nshortmid");A(N,q,K,"∤","\\nmid",!0);A(N,q,K,"⊬","\\nvdash",!0);A(N,q,K,"⊭","\\nvDash",!0);A(N,q,K,"⋪","\\ntriangleleft");A(N,q,K,"⋬","\\ntrianglelefteq",!0);A(N,q,K,"⊊","\\subsetneq",!0);A(N,q,K,"","\\@varsubsetneq");A(N,q,K,"⫋","\\subsetneqq",!0);A(N,q,K,"","\\@varsubsetneqq");A(N,q,K,"≯","\\ngtr",!0);A(N,q,K,"","\\@ngeqslant");A(N,q,K,"","\\@ngeqq");A(N,q,K,"⪈","\\gneq",!0);A(N,q,K,"≩","\\gneqq",!0);A(N,q,K,"","\\@gvertneqq");A(N,q,K,"⋧","\\gnsim",!0);A(N,q,K,"⪊","\\gnapprox",!0);A(N,q,K,"⊁","\\nsucc",!0);A(N,q,K,"⋡","\\nsucceq",!0);A(N,q,K,"⋩","\\succnsim",!0);A(N,q,K,"⪺","\\succnapprox",!0);A(N,q,K,"≆","\\ncong",!0);A(N,q,K,"","\\@nshortparallel");A(N,q,K,"∦","\\nparallel",!0);A(N,q,K,"⊯","\\nVDash",!0);A(N,q,K,"⋫","\\ntriangleright");A(N,q,K,"⋭","\\ntrianglerighteq",!0);A(N,q,K,"","\\@nsupseteqq");A(N,q,K,"⊋","\\supsetneq",!0);A(N,q,K,"","\\@varsupsetneq");A(N,q,K,"⫌","\\supsetneqq",!0);A(N,q,K,"","\\@varsupsetneqq");A(N,q,K,"⊮","\\nVdash",!0);A(N,q,K,"⪵","\\precneqq",!0);A(N,q,K,"⪶","\\succneqq",!0);A(N,q,K,"","\\@nsubseteqq");A(N,q,ut,"⊴","\\unlhd");A(N,q,ut,"⊵","\\unrhd");A(N,q,K,"↚","\\nleftarrow",!0);A(N,q,K,"↛","\\nrightarrow",!0);A(N,q,K,"⇍","\\nLeftarrow",!0);A(N,q,K,"⇏","\\nRightarrow",!0);A(N,q,K,"↮","\\nleftrightarrow",!0);A(N,q,K,"⇎","\\nLeftrightarrow",!0);A(N,q,K,"△","\\vartriangle");A(N,q,Q,"ℏ","\\hslash");A(N,q,Q,"▽","\\triangledown");A(N,q,Q,"◊","\\lozenge");A(N,q,Q,"Ⓢ","\\circledS");A(N,q,Q,"®","\\circledR");A(Oe,q,Q,"®","\\circledR");A(N,q,Q,"∡","\\measuredangle",!0);A(N,q,Q,"∄","\\nexists");A(N,q,Q,"℧","\\mho");A(N,q,Q,"Ⅎ","\\Finv",!0);A(N,q,Q,"⅁","\\Game",!0);A(N,q,Q,"‵","\\backprime");A(N,q,Q,"▲","\\blacktriangle");A(N,q,Q,"▼","\\blacktriangledown");A(N,q,Q,"■","\\blacksquare");A(N,q,Q,"⧫","\\blacklozenge");A(N,q,Q,"★","\\bigstar");A(N,q,Q,"∢","\\sphericalangle",!0);A(N,q,Q,"∁","\\complement",!0);A(N,q,Q,"ð","\\eth",!0);A(Oe,j,Q,"ð","ð");A(N,q,Q,"╱","\\diagup");A(N,q,Q,"╲","\\diagdown");A(N,q,Q,"□","\\square");A(N,q,Q,"□","\\Box");A(N,q,Q,"◊","\\Diamond");A(N,q,Q,"¥","\\yen",!0);A(Oe,q,Q,"¥","\\yen",!0);A(N,q,Q,"✓","\\checkmark",!0);A(Oe,q,Q,"✓","\\checkmark");A(N,q,Q,"ℶ","\\beth",!0);A(N,q,Q,"ℸ","\\daleth",!0);A(N,q,Q,"ℷ","\\gimel",!0);A(N,q,Q,"ϝ","\\digamma",!0);A(N,q,Q,"ϰ","\\varkappa");A(N,q,fl,"┌","\\@ulcorner",!0);A(N,q,$o,"┐","\\@urcorner",!0);A(N,q,fl,"└","\\@llcorner",!0);A(N,q,$o,"┘","\\@lrcorner",!0);A(N,q,K,"≦","\\leqq",!0);A(N,q,K,"⩽","\\leqslant",!0);A(N,q,K,"⪕","\\eqslantless",!0);A(N,q,K,"≲","\\lesssim",!0);A(N,q,K,"⪅","\\lessapprox",!0);A(N,q,K,"≊","\\approxeq",!0);A(N,q,ut,"⋖","\\lessdot");A(N,q,K,"⋘","\\lll",!0);A(N,q,K,"≶","\\lessgtr",!0);A(N,q,K,"⋚","\\lesseqgtr",!0);A(N,q,K,"⪋","\\lesseqqgtr",!0);A(N,q,K,"≑","\\doteqdot");A(N,q,K,"≓","\\risingdotseq",!0);A(N,q,K,"≒","\\fallingdotseq",!0);A(N,q,K,"∽","\\backsim",!0);A(N,q,K,"⋍","\\backsimeq",!0);A(N,q,K,"⫅","\\subseteqq",!0);A(N,q,K,"⋐","\\Subset",!0);A(N,q,K,"⊏","\\sqsubset",!0);A(N,q,K,"≼","\\preccurlyeq",!0);A(N,q,K,"⋞","\\curlyeqprec",!0);A(N,q,K,"≾","\\precsim",!0);A(N,q,K,"⪷","\\precapprox",!0);A(N,q,K,"⊲","\\vartriangleleft");A(N,q,K,"⊴","\\trianglelefteq");A(N,q,K,"⊨","\\vDash",!0);A(N,q,K,"⊪","\\Vvdash",!0);A(N,q,K,"⌣","\\smallsmile");A(N,q,K,"⌢","\\smallfrown");A(N,q,K,"≏","\\bumpeq",!0);A(N,q,K,"≎","\\Bumpeq",!0);A(N,q,K,"≧","\\geqq",!0);A(N,q,K,"⩾","\\geqslant",!0);A(N,q,K,"⪖","\\eqslantgtr",!0);A(N,q,K,"≳","\\gtrsim",!0);A(N,q,K,"⪆","\\gtrapprox",!0);A(N,q,ut,"⋗","\\gtrdot");A(N,q,K,"⋙","\\ggg",!0);A(N,q,K,"≷","\\gtrless",!0);A(N,q,K,"⋛","\\gtreqless",!0);A(N,q,K,"⪌","\\gtreqqless",!0);A(N,q,K,"≖","\\eqcirc",!0);A(N,q,K,"≗","\\circeq",!0);A(N,q,K,"≜","\\triangleq",!0);A(N,q,K,"∼","\\thicksim");A(N,q,K,"≈","\\thickapprox");A(N,q,K,"⫆","\\supseteqq",!0);A(N,q,K,"⋑","\\Supset",!0);A(N,q,K,"⊐","\\sqsupset",!0);A(N,q,K,"≽","\\succcurlyeq",!0);A(N,q,K,"⋟","\\curlyeqsucc",!0);A(N,q,K,"≿","\\succsim",!0);A(N,q,K,"⪸","\\succapprox",!0);A(N,q,K,"⊳","\\vartriangleright");A(N,q,K,"⊵","\\trianglerighteq");A(N,q,K,"⊩","\\Vdash",!0);A(N,q,K,"∣","\\shortmid");A(N,q,K,"∥","\\shortparallel");A(N,q,K,"≬","\\between",!0);A(N,q,K,"⋔","\\pitchfork",!0);A(N,q,K,"∝","\\varpropto");A(N,q,K,"◀","\\blacktriangleleft");A(N,q,K,"∴","\\therefore",!0);A(N,q,K,"∍","\\backepsilon");A(N,q,K,"▶","\\blacktriangleright");A(N,q,K,"∵","\\because",!0);A(N,q,K,"⋘","\\llless");A(N,q,K,"⋙","\\gggtr");A(N,q,ut,"⊲","\\lhd");A(N,q,ut,"⊳","\\rhd");A(N,q,K,"≂","\\eqsim",!0);A(N,j,K,"⋈","\\Join");A(N,q,K,"≑","\\Doteq",!0);A(N,q,ut,"∔","\\dotplus",!0);A(N,q,ut,"∖","\\smallsetminus");A(N,q,ut,"⋒","\\Cap",!0);A(N,q,ut,"⋓","\\Cup",!0);A(N,q,ut,"⩞","\\doublebarwedge",!0);A(N,q,ut,"⊟","\\boxminus",!0);A(N,q,ut,"⊞","\\boxplus",!0);A(N,q,ut,"⋇","\\divideontimes",!0);A(N,q,ut,"⋉","\\ltimes",!0);A(N,q,ut,"⋊","\\rtimes",!0);A(N,q,ut,"⋋","\\leftthreetimes",!0);A(N,q,ut,"⋌","\\rightthreetimes",!0);A(N,q,ut,"⋏","\\curlywedge",!0);A(N,q,ut,"⋎","\\curlyvee",!0);A(N,q,ut,"⊝","\\circleddash",!0);A(N,q,ut,"⊛","\\circledast",!0);A(N,q,ut,"⋅","\\centerdot");A(N,q,ut,"⊺","\\intercal",!0);A(N,q,ut,"⋒","\\doublecap");A(N,q,ut,"⋓","\\doublecup");A(N,q,ut,"⊠","\\boxtimes",!0);A(N,q,K,"⇢","\\dashrightarrow",!0);A(N,q,K,"⇠","\\dashleftarrow",!0);A(N,q,K,"⇇","\\leftleftarrows",!0);A(N,q,K,"⇆","\\leftrightarrows",!0);A(N,q,K,"⇚","\\Lleftarrow",!0);A(N,q,K,"↞","\\twoheadleftarrow",!0);A(N,q,K,"↢","\\leftarrowtail",!0);A(N,q,K,"↫","\\looparrowleft",!0);A(N,q,K,"⇋","\\leftrightharpoons",!0);A(N,q,K,"↶","\\curvearrowleft",!0);A(N,q,K,"↺","\\circlearrowleft",!0);A(N,q,K,"↰","\\Lsh",!0);A(N,q,K,"⇈","\\upuparrows",!0);A(N,q,K,"↿","\\upharpoonleft",!0);A(N,q,K,"⇃","\\downharpoonleft",!0);A(N,j,K,"⊶","\\origof",!0);A(N,j,K,"⊷","\\imageof",!0);A(N,q,K,"⊸","\\multimap",!0);A(N,q,K,"↭","\\leftrightsquigarrow",!0);A(N,q,K,"⇉","\\rightrightarrows",!0);A(N,q,K,"⇄","\\rightleftarrows",!0);A(N,q,K,"↠","\\twoheadrightarrow",!0);A(N,q,K,"↣","\\rightarrowtail",!0);A(N,q,K,"↬","\\looparrowright",!0);A(N,q,K,"↷","\\curvearrowright",!0);A(N,q,K,"↻","\\circlearrowright",!0);A(N,q,K,"↱","\\Rsh",!0);A(N,q,K,"⇊","\\downdownarrows",!0);A(N,q,K,"↾","\\upharpoonright",!0);A(N,q,K,"⇂","\\downharpoonright",!0);A(N,q,K,"⇝","\\rightsquigarrow",!0);A(N,q,K,"⇝","\\leadsto");A(N,q,K,"⇛","\\Rrightarrow",!0);A(N,q,K,"↾","\\restriction");A(N,j,Q,"‘","`");A(N,j,Q,"$","\\$");A(Oe,j,Q,"$","\\$");A(Oe,j,Q,"$","\\textdollar");A(N,j,Q,"%","\\%");A(Oe,j,Q,"%","\\%");A(N,j,Q,"_","\\_");A(Oe,j,Q,"_","\\_");A(Oe,j,Q,"_","\\textunderscore");A(N,j,Q,"∠","\\angle",!0);A(N,j,Q,"∞","\\infty",!0);A(N,j,Q,"′","\\prime");A(N,j,Q,"△","\\triangle");A(N,j,Q,"Γ","\\Gamma",!0);A(N,j,Q,"Δ","\\Delta",!0);A(N,j,Q,"Θ","\\Theta",!0);A(N,j,Q,"Λ","\\Lambda",!0);A(N,j,Q,"Ξ","\\Xi",!0);A(N,j,Q,"Π","\\Pi",!0);A(N,j,Q,"Σ","\\Sigma",!0);A(N,j,Q,"Υ","\\Upsilon",!0);A(N,j,Q,"Φ","\\Phi",!0);A(N,j,Q,"Ψ","\\Psi",!0);A(N,j,Q,"Ω","\\Omega",!0);A(N,j,Q,"A","Α");A(N,j,Q,"B","Β");A(N,j,Q,"E","Ε");A(N,j,Q,"Z","Ζ");A(N,j,Q,"H","Η");A(N,j,Q,"I","Ι");A(N,j,Q,"K","Κ");A(N,j,Q,"M","Μ");A(N,j,Q,"N","Ν");A(N,j,Q,"O","Ο");A(N,j,Q,"P","Ρ");A(N,j,Q,"T","Τ");A(N,j,Q,"X","Χ");A(N,j,Q,"¬","\\neg",!0);A(N,j,Q,"¬","\\lnot");A(N,j,Q,"⊤","\\top");A(N,j,Q,"⊥","\\bot");A(N,j,Q,"∅","\\emptyset");A(N,q,Q,"∅","\\varnothing");A(N,j,Mt,"α","\\alpha",!0);A(N,j,Mt,"β","\\beta",!0);A(N,j,Mt,"γ","\\gamma",!0);A(N,j,Mt,"δ","\\delta",!0);A(N,j,Mt,"ϵ","\\epsilon",!0);A(N,j,Mt,"ζ","\\zeta",!0);A(N,j,Mt,"η","\\eta",!0);A(N,j,Mt,"θ","\\theta",!0);A(N,j,Mt,"ι","\\iota",!0);A(N,j,Mt,"κ","\\kappa",!0);A(N,j,Mt,"λ","\\lambda",!0);A(N,j,Mt,"μ","\\mu",!0);A(N,j,Mt,"ν","\\nu",!0);A(N,j,Mt,"ξ","\\xi",!0);A(N,j,Mt,"ο","\\omicron",!0);A(N,j,Mt,"π","\\pi",!0);A(N,j,Mt,"ρ","\\rho",!0);A(N,j,Mt,"σ","\\sigma",!0);A(N,j,Mt,"τ","\\tau",!0);A(N,j,Mt,"υ","\\upsilon",!0);A(N,j,Mt,"ϕ","\\phi",!0);A(N,j,Mt,"χ","\\chi",!0);A(N,j,Mt,"ψ","\\psi",!0);A(N,j,Mt,"ω","\\omega",!0);A(N,j,Mt,"ε","\\varepsilon",!0);A(N,j,Mt,"ϑ","\\vartheta",!0);A(N,j,Mt,"ϖ","\\varpi",!0);A(N,j,Mt,"ϱ","\\varrho",!0);A(N,j,Mt,"ς","\\varsigma",!0);A(N,j,Mt,"φ","\\varphi",!0);A(N,j,ut,"∗","*",!0);A(N,j,ut,"+","+");A(N,j,ut,"−","-",!0);A(N,j,ut,"⋅","\\cdot",!0);A(N,j,ut,"∘","\\circ",!0);A(N,j,ut,"÷","\\div",!0);A(N,j,ut,"±","\\pm",!0);A(N,j,ut,"×","\\times",!0);A(N,j,ut,"∩","\\cap",!0);A(N,j,ut,"∪","\\cup",!0);A(N,j,ut,"∖","\\setminus",!0);A(N,j,ut,"∧","\\land");A(N,j,ut,"∨","\\lor");A(N,j,ut,"∧","\\wedge",!0);A(N,j,ut,"∨","\\vee",!0);A(N,j,Q,"√","\\surd");A(N,j,fl,"⟨","\\langle",!0);A(N,j,fl,"∣","\\lvert");A(N,j,fl,"∥","\\lVert");A(N,j,$o,"?","?");A(N,j,$o,"!","!");A(N,j,$o,"⟩","\\rangle",!0);A(N,j,$o,"∣","\\rvert");A(N,j,$o,"∥","\\rVert");A(N,j,K,"=","=");A(N,j,K,":",":");A(N,j,K,"≈","\\approx",!0);A(N,j,K,"≅","\\cong",!0);A(N,j,K,"≥","\\ge");A(N,j,K,"≥","\\geq",!0);A(N,j,K,"←","\\gets");A(N,j,K,">","\\gt",!0);A(N,j,K,"∈","\\in",!0);A(N,j,K,"","\\@not");A(N,j,K,"⊂","\\subset",!0);A(N,j,K,"⊃","\\supset",!0);A(N,j,K,"⊆","\\subseteq",!0);A(N,j,K,"⊇","\\supseteq",!0);A(N,q,K,"⊈","\\nsubseteq",!0);A(N,q,K,"⊉","\\nsupseteq",!0);A(N,j,K,"⊨","\\models");A(N,j,K,"←","\\leftarrow",!0);A(N,j,K,"≤","\\le");A(N,j,K,"≤","\\leq",!0);A(N,j,K,"<","\\lt",!0);A(N,j,K,"→","\\rightarrow",!0);A(N,j,K,"→","\\to");A(N,q,K,"≱","\\ngeq",!0);A(N,q,K,"≰","\\nleq",!0);A(N,j,Of," ","\\ ");A(N,j,Of," ","\\space");A(N,j,Of," ","\\nobreakspace");A(Oe,j,Of," ","\\ ");A(Oe,j,Of," "," ");A(Oe,j,Of," ","\\space");A(Oe,j,Of," ","\\nobreakspace");A(N,j,Of,"","\\nobreak");A(N,j,Of,"","\\allowbreak");A(N,j,fC,",",",");A(N,j,fC,";",";");A(N,q,ut,"⊼","\\barwedge",!0);A(N,q,ut,"⊻","\\veebar",!0);A(N,j,ut,"⊙","\\odot",!0);A(N,j,ut,"⊕","\\oplus",!0);A(N,j,ut,"⊗","\\otimes",!0);A(N,j,Q,"∂","\\partial",!0);A(N,j,ut,"⊘","\\oslash",!0);A(N,q,ut,"⊚","\\circledcirc",!0);A(N,q,ut,"⊡","\\boxdot",!0);A(N,j,ut,"△","\\bigtriangleup");A(N,j,ut,"▽","\\bigtriangledown");A(N,j,ut,"†","\\dagger");A(N,j,ut,"⋄","\\diamond");A(N,j,ut,"⋆","\\star");A(N,j,ut,"◃","\\triangleleft");A(N,j,ut,"▹","\\triangleright");A(N,j,fl,"{","\\{");A(Oe,j,Q,"{","\\{");A(Oe,j,Q,"{","\\textbraceleft");A(N,j,$o,"}","\\}");A(Oe,j,Q,"}","\\}");A(Oe,j,Q,"}","\\textbraceright");A(N,j,fl,"{","\\lbrace");A(N,j,$o,"}","\\rbrace");A(N,j,fl,"[","\\lbrack",!0);A(Oe,j,Q,"[","\\lbrack",!0);A(N,j,$o,"]","\\rbrack",!0);A(Oe,j,Q,"]","\\rbrack",!0);A(N,j,fl,"(","\\lparen",!0);A(N,j,$o,")","\\rparen",!0);A(Oe,j,Q,"<","\\textless",!0);A(Oe,j,Q,">","\\textgreater",!0);A(N,j,fl,"⌊","\\lfloor",!0);A(N,j,$o,"⌋","\\rfloor",!0);A(N,j,fl,"⌈","\\lceil",!0);A(N,j,$o,"⌉","\\rceil",!0);A(N,j,Q,"\\","\\backslash");A(N,j,Q,"∣","|");A(N,j,Q,"∣","\\vert");A(Oe,j,Q,"|","\\textbar",!0);A(N,j,Q,"∥","\\|");A(N,j,Q,"∥","\\Vert");A(Oe,j,Q,"∥","\\textbardbl");A(Oe,j,Q,"~","\\textasciitilde");A(Oe,j,Q,"\\","\\textbackslash");A(Oe,j,Q,"^","\\textasciicircum");A(N,j,K,"↑","\\uparrow",!0);A(N,j,K,"⇑","\\Uparrow",!0);A(N,j,K,"↓","\\downarrow",!0);A(N,j,K,"⇓","\\Downarrow",!0);A(N,j,K,"↕","\\updownarrow",!0);A(N,j,K,"⇕","\\Updownarrow",!0);A(N,j,Fi,"∐","\\coprod");A(N,j,Fi,"⋁","\\bigvee");A(N,j,Fi,"⋀","\\bigwedge");A(N,j,Fi,"⨄","\\biguplus");A(N,j,Fi,"⋂","\\bigcap");A(N,j,Fi,"⋃","\\bigcup");A(N,j,Fi,"∫","\\int");A(N,j,Fi,"∫","\\intop");A(N,j,Fi,"∬","\\iint");A(N,j,Fi,"∭","\\iiint");A(N,j,Fi,"∏","\\prod");A(N,j,Fi,"∑","\\sum");A(N,j,Fi,"⨂","\\bigotimes");A(N,j,Fi,"⨁","\\bigoplus");A(N,j,Fi,"⨀","\\bigodot");A(N,j,Fi,"∮","\\oint");A(N,j,Fi,"∯","\\oiint");A(N,j,Fi,"∰","\\oiiint");A(N,j,Fi,"⨆","\\bigsqcup");A(N,j,Fi,"∫","\\smallint");A(Oe,j,k2,"…","\\textellipsis");A(N,j,k2,"…","\\mathellipsis");A(Oe,j,k2,"…","\\ldots",!0);A(N,j,k2,"…","\\ldots",!0);A(N,j,k2,"⋯","\\@cdots",!0);A(N,j,k2,"⋱","\\ddots",!0);A(N,j,Q,"⋮","\\varvdots");A(Oe,j,Q,"⋮","\\varvdots");A(N,j,Wr,"ˊ","\\acute");A(N,j,Wr,"ˋ","\\grave");A(N,j,Wr,"¨","\\ddot");A(N,j,Wr,"~","\\tilde");A(N,j,Wr,"ˉ","\\bar");A(N,j,Wr,"˘","\\breve");A(N,j,Wr,"ˇ","\\check");A(N,j,Wr,"^","\\hat");A(N,j,Wr,"⃗","\\vec");A(N,j,Wr,"˙","\\dot");A(N,j,Wr,"˚","\\mathring");A(N,j,Mt,"","\\@imath");A(N,j,Mt,"","\\@jmath");A(N,j,Q,"ı","ı");A(N,j,Q,"ȷ","ȷ");A(Oe,j,Q,"ı","\\i",!0);A(Oe,j,Q,"ȷ","\\j",!0);A(Oe,j,Q,"ß","\\ss",!0);A(Oe,j,Q,"æ","\\ae",!0);A(Oe,j,Q,"œ","\\oe",!0);A(Oe,j,Q,"ø","\\o",!0);A(Oe,j,Q,"Æ","\\AE",!0);A(Oe,j,Q,"Œ","\\OE",!0);A(Oe,j,Q,"Ø","\\O",!0);A(Oe,j,Wr,"ˊ","\\'");A(Oe,j,Wr,"ˋ","\\`");A(Oe,j,Wr,"ˆ","\\^");A(Oe,j,Wr,"˜","\\~");A(Oe,j,Wr,"ˉ","\\=");A(Oe,j,Wr,"˘","\\u");A(Oe,j,Wr,"˙","\\.");A(Oe,j,Wr,"¸","\\c");A(Oe,j,Wr,"˚","\\r");A(Oe,j,Wr,"ˇ","\\v");A(Oe,j,Wr,"¨",'\\"');A(Oe,j,Wr,"˝","\\H");A(Oe,j,Wr,"◯","\\textcircled");var G5e={"--":!0,"---":!0,"``":!0,"''":!0};A(Oe,j,Q,"–","--",!0);A(Oe,j,Q,"–","\\textendash");A(Oe,j,Q,"—","---",!0);A(Oe,j,Q,"—","\\textemdash");A(Oe,j,Q,"‘","`",!0);A(Oe,j,Q,"‘","\\textquoteleft");A(Oe,j,Q,"’","'",!0);A(Oe,j,Q,"’","\\textquoteright");A(Oe,j,Q,"“","``",!0);A(Oe,j,Q,"“","\\textquotedblleft");A(Oe,j,Q,"”","''",!0);A(Oe,j,Q,"”","\\textquotedblright");A(N,j,Q,"°","\\degree",!0);A(Oe,j,Q,"°","\\degree");A(Oe,j,Q,"°","\\textdegree",!0);A(N,j,Q,"£","\\pounds");A(N,j,Q,"£","\\mathsterling",!0);A(Oe,j,Q,"£","\\pounds");A(Oe,j,Q,"£","\\textsterling",!0);A(N,q,Q,"✠","\\maltese");A(Oe,q,Q,"✠","\\maltese");var Kse='0123456789/@."';for(var CD=0;CD<Kse.length;CD++){var Yse=Kse.charAt(CD);A(N,j,Q,Yse,Yse)}var Zse='0123456789!@*()-=+";:?/.,';for(var ED=0;ED<Zse.length;ED++){var Xse=Zse.charAt(ED);A(Oe,j,Q,Xse,Xse)}var F8="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var TD=0;TD<F8.length;TD++){var iT=F8.charAt(TD);A(N,j,Mt,iT,iT),A(Oe,j,Q,iT,iT)}A(N,q,Q,"C","ℂ");A(Oe,q,Q,"C","ℂ");A(N,q,Q,"H","ℍ");A(Oe,q,Q,"H","ℍ");A(N,q,Q,"N","ℕ");A(Oe,q,Q,"N","ℕ");A(N,q,Q,"P","ℙ");A(Oe,q,Q,"P","ℙ");A(N,q,Q,"Q","ℚ");A(Oe,q,Q,"Q","ℚ");A(N,q,Q,"R","ℝ");A(Oe,q,Q,"R","ℝ");A(N,q,Q,"Z","ℤ");A(Oe,q,Q,"Z","ℤ");A(N,j,Mt,"h","ℎ");A(Oe,j,Mt,"h","ℎ");var zt;for(var po=0;po<F8.length;po++){var ii=F8.charAt(po);zt=String.fromCharCode(55349,56320+po),A(N,j,Mt,ii,zt),A(Oe,j,Q,ii,zt),zt=String.fromCharCode(55349,56372+po),A(N,j,Mt,ii,zt),A(Oe,j,Q,ii,zt),zt=String.fromCharCode(55349,56424+po),A(N,j,Mt,ii,zt),A(Oe,j,Q,ii,zt),zt=String.fromCharCode(55349,56580+po),A(N,j,Mt,ii,zt),A(Oe,j,Q,ii,zt),zt=String.fromCharCode(55349,56684+po),A(N,j,Mt,ii,zt),A(Oe,j,Q,ii,zt),zt=String.fromCharCode(55349,56736+po),A(N,j,Mt,ii,zt),A(Oe,j,Q,ii,zt),zt=String.fromCharCode(55349,56788+po),A(N,j,Mt,ii,zt),A(Oe,j,Q,ii,zt),zt=String.fromCharCode(55349,56840+po),A(N,j,Mt,ii,zt),A(Oe,j,Q,ii,zt),zt=String.fromCharCode(55349,56944+po),A(N,j,Mt,ii,zt),A(Oe,j,Q,ii,zt),po<26&&(zt=String.fromCharCode(55349,56632+po),A(N,j,Mt,ii,zt),A(Oe,j,Q,ii,zt),zt=String.fromCharCode(55349,56476+po),A(N,j,Mt,ii,zt),A(Oe,j,Q,ii,zt))}zt="𝕜";A(N,j,Mt,"k",zt);A(Oe,j,Q,"k",zt);for(var Q0=0;Q0<10;Q0++){var Qf=Q0.toString();zt=String.fromCharCode(55349,57294+Q0),A(N,j,Mt,Qf,zt),A(Oe,j,Q,Qf,zt),zt=String.fromCharCode(55349,57314+Q0),A(N,j,Mt,Qf,zt),A(Oe,j,Q,Qf,zt),zt=String.fromCharCode(55349,57324+Q0),A(N,j,Mt,Qf,zt),A(Oe,j,Q,Qf,zt),zt=String.fromCharCode(55349,57334+Q0),A(N,j,Mt,Qf,zt),A(Oe,j,Q,Qf,zt)}var zB="ÐÞþ";for(var AD=0;AD<zB.length;AD++){var sT=zB.charAt(AD);A(N,j,Mt,sT,sT),A(Oe,j,Q,sT,sT)}var jB={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},Qse={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},Jse={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},xSt={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},_g={mathClass:"",textClass:"",font:""},eoe={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},toe={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},noe={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},BB={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},FB={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},roe={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},VB={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},ioe=[jB,jB,Qse,Qse,Jse,Jse,xSt,_g,_g,_g,eoe,eoe,toe,toe,noe,noe,BB,BB,FB,FB,roe,roe,_g,_g,VB,VB],_St=[jB,_g,BB,FB,VB],SSt=t=>{var e=t.charCodeAt(0),n=t.charCodeAt(1),r=(e-55296)*1024+(n-56320)+65536;if(119808<=r&&r<120484){var i=Math.floor((r-119808)/26);return ioe[i]}else if(120782<=r&&r<=120831){var s=Math.floor((r-120782)/10);return _St[s]}else{if(r===120485||r===120486)return ioe[0];if(120486<r&&r<120782)return _g;throw new Fe("Unsupported character: "+t)}},FR=function(e,n,r){if($r[r][e]){var i=$r[r][e].replace;i&&(e=i)}return{value:e,metrics:PG(e,n,r)}},So=function(e,n,r,i,s){var o=FR(e,n,r),a=o.metrics;e=o.value;var l;if(a){var c=a.italic;(r==="text"||i&&i.font==="mathit")&&(c=0),l=new ll(e,a.height,a.depth,c,a.skew,a.width,s)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+e+"' in style '"+n+"' and mode '"+r+"'")),l=new ll(e,0,0,0,0,0,s);if(i){l.maxFontSize=i.sizeMultiplier,i.style.isTight()&&l.classes.push("mtight");var u=i.getColor();u&&(l.style.color=u)}return l},LG=function(e,n,r,i){return i===void 0&&(i=[]),r.font==="boldsymbol"&&FR(e,"Main-Bold",n).metrics?So(e,"Main-Bold",n,r,i.concat(["mathbf"])):e==="\\"||$r[n][e].font==="main"?So(e,"Main-Regular",n,r,i):So(e,"AMS-Regular",n,r,i.concat(["amsrm"]))},kSt=function(e,n,r){return r!=="textord"&&FR(e,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},VR=function(e,n,r){var i=e.mode,s=e.text,o=["mord"],{font:a,fontFamily:l,fontWeight:c,fontShape:u}=n,d=i==="math"||i==="text"&&!!a,h=d?a:l,f="",p="";if(s.charCodeAt(0)===55349){var g=SSt(s);f=g.font,p=g[i+"Class"]}if(f)return So(s,f,i,n,o.concat(p));if(h){var y,v;if(h==="boldsymbol"){var b=kSt(s,i,r);y=b.fontName,v=[b.fontClass]}else d?(y=$B[a].fontName,v=[a]):(y=oT(l,c,u),v=[l,c,u]);if(FR(s,y,i).metrics)return So(s,y,i,n,o.concat(v));if(G5e.hasOwnProperty(s)&&y.slice(0,10)==="Typewriter"){for(var _=[],S=0;S<s.length;S++)_.push(So(s[S],y,i,n,o.concat(v)));return Df(_)}}if(r==="mathord")return So(s,"Math-Italic",i,n,o.concat(["mathnormal"]));if(r==="textord"){var k=$r[i][s]&&$r[i][s].font;if(k==="ams"){var T=oT("amsrm",c,u);return So(s,T,i,n,o.concat("amsrm",c,u))}else if(k==="main"||!k){var E=oT("textrm",c,u);return So(s,E,i,n,o.concat(c,u))}else{var C=oT(k,c,u);return So(s,C,i,n,o.concat(C,c,u))}}else throw new Error("unexpected type: "+r+" in makeOrd")},CSt=(t,e)=>{if(r0(t.classes)!==r0(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize||t.italic!==0&&t.hasClass("mathnormal"))return!1;if(t.classes.length===1){var n=t.classes[0];if(n==="mbin"||n==="mord")return!1}for(var r of Object.keys(t.style))if(t.style[r]!==e.style[r])return!1;for(var i of Object.keys(e.style))if(t.style[i]!==e.style[i])return!1;return!0},K5e=t=>{for(var e=0;e<t.length-1;e++){var n=t[e],r=t[e+1];n instanceof ll&&r instanceof ll&&CSt(n,r)&&(n.text+=r.text,n.height=Math.max(n.height,r.height),n.depth=Math.max(n.depth,r.depth),n.italic=r.italic,t.splice(e+1,1),e--)}return t},zG=function(e){for(var n=0,r=0,i=0,s=0;s<e.children.length;s++){var o=e.children[s];o.height>n&&(n=o.height),o.depth>r&&(r=o.depth),o.maxFontSize>i&&(i=o.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=i},ze=function(e,n,r,i){var s=new S2(e,n,r,i);return zG(s),s},s0=(t,e,n,r)=>new S2(t,e,n,r),wx=function(e,n,r){var i=ze([e],[],n);return i.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),i.style.borderBottomWidth=qe(i.height),i.maxFontSize=1,i},ESt=function(e,n,r,i){var s=new BR(e,n,r,i);return zG(s),s},Df=function(e){var n=new _2(e);return zG(n),n},xx=function(e,n){return e instanceof _2?ze([],[e],n):e},TSt=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],i=-n[0].shift-n[0].elem.depth,s=i,o=1;o<n.length;o++){var a=-n[o].shift-s-n[o].elem.depth,l=a-(n[o-1].elem.height+n[o-1].elem.depth);s=s+a,r.push({type:"kern",size:l}),r.push(n[o])}return{children:r,depth:i}}var c;if(e.positionType==="top"){for(var u=e.positionData,d=0;d<e.children.length;d++){var h=e.children[d];u-=h.type==="kern"?h.size:h.elem.height+h.elem.depth}c=u}else if(e.positionType==="bottom")c=-e.positionData;else{var f=e.children[0];if(f.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")c=-f.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")c=-f.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:c}},qn=function(e,n){for(var{children:r,depth:i}=TSt(e),s=0,o=0;o<r.length;o++){var a=r[o];if(a.type==="elem"){var l=a.elem;s=Math.max(s,l.maxFontSize,l.height)}}s+=2;var c=ze(["pstrut"],[]);c.style.height=qe(s);for(var u=[],d=i,h=i,f=i,p=0;p<r.length;p++){var g=r[p];if(g.type==="kern")f+=g.size;else{var y=g.elem,v=g.wrapperClasses||[],b=g.wrapperStyle||{},_=ze(v,[c,y],void 0,b);_.style.top=qe(-s-f-y.depth),g.marginLeft&&(_.style.marginLeft=g.marginLeft),g.marginRight&&(_.style.marginRight=g.marginRight),u.push(_),f+=y.height+y.depth}d=Math.min(d,f),h=Math.max(h,f)}var S=ze(["vlist"],u);S.style.height=qe(h);var k;if(d<0){var T=ze([],[]),E=ze(["vlist"],[T]);E.style.height=qe(-d);var C=ze(["vlist-s"],[new ll("")]);k=[ze(["vlist-r"],[S,C]),ze(["vlist-r"],[E])]}else k=[ze(["vlist-r"],[S])];var R=ze(["vlist-t"],k);return k.length===2&&R.classes.push("vlist-t2"),R.height=h,R.depth=-d,R},Y5e=(t,e)=>{var n=ze(["mspace"],[],e),r=Xr(t,e);return n.style.marginRight=qe(r),n},oT=(t,e,n)=>{var r,i;switch(t){case"amsrm":r="AMS";break;case"textrm":r="Main";break;case"textsf":r="SansSerif";break;case"texttt":r="Typewriter";break;default:r=t}return e==="textbf"&&n==="textit"?i="BoldItalic":e==="textbf"?i="Bold":n==="textit"?i="Italic":i="Regular",r+"-"+i},$B={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},Z5e={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},X5e=function(e,n){var[r,i,s]=Z5e[e],o=new i0(r),a=new bf([o],{width:qe(i),height:qe(s),style:"width:"+qe(i),viewBox:"0 0 "+1e3*i+" "+1e3*s,preserveAspectRatio:"xMinYMin"}),l=s0(["overlay"],[a],n);return l.height=s,l.style.height=qe(s),l.style.width=qe(i),l},Zr={number:3,unit:"mu"},J0={number:4,unit:"mu"},Kd={number:5,unit:"mu"},ASt={mord:{mop:Zr,mbin:J0,mrel:Kd,minner:Zr},mop:{mord:Zr,mop:Zr,mrel:Kd,minner:Zr},mbin:{mord:J0,mop:J0,mopen:J0,minner:J0},mrel:{mord:Kd,mop:Kd,mopen:Kd,minner:Kd},mopen:{},mclose:{mop:Zr,mbin:J0,mrel:Kd,minner:Zr},mpunct:{mord:Zr,mop:Zr,mrel:Kd,mopen:Zr,mclose:Zr,mpunct:Zr,minner:Zr},minner:{mord:Zr,mop:Zr,mbin:J0,mrel:Kd,mopen:Zr,mpunct:Zr,minner:Zr}},ISt={mord:{mop:Zr},mop:{mord:Zr,mop:Zr},mbin:{},mrel:{},mopen:{},mclose:{mop:Zr},mpunct:{},minner:{mop:Zr}},Q5e={},V8={},$8={};function ot(t){for(var{type:e,names:n,props:r,handler:i,htmlBuilder:s,mathmlBuilder:o}=t,a={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:i},l=0;l<n.length;++l)Q5e[n[l]]=a;e&&(s&&(V8[e]=s),o&&($8[e]=o))}function Py(t){var{type:e,htmlBuilder:n,mathmlBuilder:r}=t;ot({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var H8=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},Oi=function(e){return e.type==="ordgroup"?e.body:[e]},RSt=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),MSt=new Set(["rightmost","mrel","mclose","mpunct"]),NSt={display:Ht.DISPLAY,text:Ht.TEXT,script:Ht.SCRIPT,scriptscript:Ht.SCRIPTSCRIPT},OSt={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},Ji=function(e,n,r,i){i===void 0&&(i=[null,null]);for(var s=[],o=0;o<e.length;o++){var a=Gn(e[o],n);if(a instanceof _2){var l=a.children;s.push(...l)}else s.push(a)}if(K5e(s),!r)return s;var c=n;if(e.length===1){var u=e[0];u.type==="sizing"?c=n.havingSize(u.size):u.type==="styling"&&(c=n.havingStyle(NSt[u.style]))}var d=ze([i[0]||"leftmost"],[],n),h=ze([i[1]||"rightmost"],[],n),f=r==="root";return HB(s,(p,g)=>{var y=g.classes[0],v=p.classes[0];y==="mbin"&&MSt.has(v)?g.classes[0]="mord":v==="mbin"&&RSt.has(y)&&(p.classes[0]="mord")},{node:d},h,f),HB(s,(p,g)=>{var y,v,b=qB(g),_=qB(p),S=b&&_?p.hasClass("mtight")?(y=ISt[b])==null?void 0:y[_]:(v=ASt[b])==null?void 0:v[_]:null;if(S)return Y5e(S,c)},{node:d},h,f),s},HB=function(e,n,r,i,s){i&&e.push(i);for(var o=0;o<e.length;o++){var a=e[o],l=J5e(a);if(l){HB(l.children,n,r,null,s);continue}var c=!a.hasClass("mspace");if(c){var u=n(a,r.node);u&&(r.insertAfter?r.insertAfter(u):(e.unshift(u),o++))}c?r.node=a:s&&a.hasClass("newline")&&(r.node=ze(["leftmost"])),r.insertAfter=(d=>h=>{e.splice(d+1,0,h),o++})(o)}i&&e.pop()},J5e=function(e){return e instanceof _2||e instanceof BR||e instanceof S2&&e.hasClass("enclosing")?e:null},UB=function(e,n){var r=J5e(e);if(r){var i=r.children;if(i.length){if(n==="right")return UB(i[i.length-1],"right");if(n==="left")return UB(i[0],"left")}}return e},qB=function(e,n){if(!e)return null;n&&(e=UB(e,n));var r=e.classes[0];return OSt[r]||null},Lk=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return ze(n.concat(r))},Gn=function(e,n,r){if(!e)return ze();if(V8[e.type]){var i=V8[e.type](e,n);if(r&&n.size!==r.size){i=ze(n.sizingClasses(r),[i],n);var s=n.sizeMultiplier/r.sizeMultiplier;i.height*=s,i.depth*=s}return i}else throw new Fe("Got group of unknown type: '"+e.type+"'")};function aT(t,e){var n=ze(["base"],t,e),r=ze(["strut"]);return r.style.height=qe(n.height+n.depth),n.depth&&(r.style.verticalAlign=qe(-n.depth)),n.children.unshift(r),n}function WB(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=Ji(t,e,"root"),i;r.length===2&&r[1].hasClass("tag")&&(i=r.pop());for(var s=[],o=[],a=0;a<r.length;a++)if(o.push(r[a]),r[a].hasClass("mbin")||r[a].hasClass("mrel")||r[a].hasClass("allowbreak")){for(var l=!1;a<r.length-1&&r[a+1].hasClass("mspace")&&!r[a+1].hasClass("newline");)a++,o.push(r[a]),r[a].hasClass("nobreak")&&(l=!0);l||(s.push(aT(o,e)),o=[])}else r[a].hasClass("newline")&&(o.pop(),o.length>0&&(s.push(aT(o,e)),o=[]),s.push(r[a]));o.length>0&&s.push(aT(o,e));var c;n?(c=aT(Ji(n,e,!0),e),c.classes=["tag"],s.push(c)):i&&s.push(i);var u=ze(["katex-html"],s);if(u.setAttribute("aria-hidden","true"),c){var d=c.children[0];d.style.height=qe(u.height+u.depth),u.depth&&(d.style.verticalAlign=qe(-u.depth))}return u}function e3e(t){return new _2(t)}class Ve{constructor(e,n,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=n||[],this.classes=r||[]}setAttribute(e,n){this.attributes[e]=n}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&e.setAttribute(n,this.attributes[n]);this.classes.length>0&&(e.className=r0(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof Di&&this.children[r+1]instanceof Di){for(var i=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof Di;)i+=this.children[++r].toText();e.appendChild(new Di(i).toNode())}else e.appendChild(this.children[r].toNode());return e}toMarkup(){var e="<"+this.type;for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(e+=" "+n+'="',e+=ro(this.attributes[n]),e+='"');this.classes.length>0&&(e+=' class ="'+ro(r0(this.classes))+'"'),e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map(e=>e.toText()).join("")}}class Di{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return ro(this.toText())}toText(){return this.text}}class t3e{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character=" ":e>=-.05556&&e<=-.05555?this.character=" ":e>=-.1667&&e<=-.1666?this.character=" ":e>=-.2223&&e<=-.2222?this.character=" ":e>=-.2778&&e<=-.2777?this.character=" ":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",qe(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+qe(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var DSt=new Set(["\\imath","\\jmath"]),PSt=new Set(["mrow","mtable"]),tc=function(e,n,r){return $r[n][e]&&$r[n][e].replace&&e.charCodeAt(0)!==55349&&!(G5e.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=$r[n][e].replace),new Di(e)},jG=function(e){return e.length===1?e[0]:new Ve("mrow",e)},LSt={mathit:"italic",boldsymbol:t=>t.type==="textord"?"bold":"bold-italic",mathbf:"bold",mathbb:"double-struck",mathsfit:"sans-serif-italic",mathfrak:"fraktur",mathscr:"script",mathcal:"script",mathsf:"sans-serif",mathtt:"monospace"},BG=(t,e)=>{if(t.mode==="text"){if(e.fontFamily==="texttt")return"monospace";if(e.fontFamily==="textsf")return e.fontShape==="textit"&&e.fontWeight==="textbf"?"sans-serif-bold-italic":e.fontShape==="textit"?"sans-serif-italic":e.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(e.fontShape==="textit"&&e.fontWeight==="textbf")return"bold-italic";if(e.fontShape==="textit")return"italic";if(e.fontWeight==="textbf")return"bold"}var n=e.font;if(!n||n==="mathnormal")return null;var r=t.mode,i=LSt[n];if(i)return typeof i=="function"?i(t):i;var s=t.text;if(DSt.has(s))return null;if($r[r][s]){var o=$r[r][s].replace;o&&(s=o)}var a=$B[n].fontName;return PG(s,a,r)?$B[n].variant:null};function ID(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof Di&&e.text==="."}else if(t.type==="mo"&&t.children.length===1&&t.getAttribute("separator")==="true"&&t.getAttribute("lspace")==="0em"&&t.getAttribute("rspace")==="0em"){var n=t.children[0];return n instanceof Di&&n.text===","}else return!1}var pl=function(e,n,r){if(e.length===1){var i=_r(e[0],n);return r&&i instanceof Ve&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var s=[],o,a=0;a<e.length;a++){var l=_r(e[a],n);if(l instanceof Ve&&o instanceof Ve){if(l.type==="mtext"&&o.type==="mtext"&&l.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...l.children);continue}else if(l.type==="mn"&&o.type==="mn"){o.children.push(...l.children);continue}else if(ID(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&ID(o))l.children=[...o.children,...l.children],s.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||ID(o))){var c=l.children[0];c instanceof Ve&&c.type==="mn"&&(c.children=[...o.children,...c.children],s.pop())}else if(o.type==="mi"&&o.children.length===1){var u=o.children[0];if(u instanceof Di&&u.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var d=l.children[0];d instanceof Di&&d.text.length>0&&(d.text=d.text.slice(0,1)+"̸"+d.text.slice(1),s.pop())}}}s.push(l),o=l}return s},o0=function(e,n,r){return jG(pl(e,n,r))},_r=function(e,n){if(!e)return new Ve("mrow");if($8[e.type])return $8[e.type](e,n);throw new Fe("Got group of unknown type: '"+e.type+"'")};function soe(t,e,n,r,i){var s=pl(t,n),o;s.length===1&&s[0]instanceof Ve&&PSt.has(s[0].type)?o=s[0]:o=new Ve("mrow",s);var a=new Ve("annotation",[new Di(e)]);a.setAttribute("encoding","application/x-tex");var l=new Ve("semantics",[o,a]),c=new Ve("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var u=i?"katex":"katex-mathml";return ze([u],[c])}var zSt=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],ooe=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],aoe=function(e,n){return n.size<2?e:zSt[e-1][n.size-1]};class uh{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||uh.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=ooe[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};return Object.assign(n,e),new uh(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:aoe(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:ooe[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=aoe(uh.BASESIZE,e);return this.size===n&&this.textSize===uh.BASESIZE&&this.style===e?this:this.extend({style:e,size:n})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==uh.BASESIZE?["sizing","reset-size"+this.size,"size"+uh.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=wSt(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}uh.BASESIZE=6;var n3e=function(e){return new uh({style:e.displayMode?Ht.DISPLAY:Ht.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},r3e=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=ze(r,[e])}return e},jSt=function(e,n,r){var i=n3e(r),s;if(r.output==="mathml")return soe(e,n,i,r.displayMode,!0);if(r.output==="html"){var o=WB(e,i);s=ze(["katex"],[o])}else{var a=soe(e,n,i,r.displayMode,!1),l=WB(e,i);s=ze(["katex"],[a,l])}return r3e(s,r)},BSt=function(e,n,r){var i=n3e(r),s=WB(e,i),o=ze(["katex"],[s]);return r3e(o,r)},FSt={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",underbracket:"⎵",overbracket:"⎴",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},$R=function(e){var n=new Ve("mo",[new Di(FSt[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},VSt={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overbracket:[["leftbracketover","rightbracketover"],1.6,440],underbracket:[["leftbracketunder","rightbracketunder"],1.6,410],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},$St=new Set(["widehat","widecheck","widetilde","utilde"]),HR=function(e,n){function r(){var a=4e5,l=e.label.slice(1);if($St.has(l)&&"base"in e){var c=e.base.type==="ordgroup"?e.base.body.length:1,u,d,h;if(c>5)l==="widehat"||l==="widecheck"?(u=420,a=2364,h=.42,d=l+"4"):(u=312,a=2340,h=.34,d="tilde4");else{var f=[1,1,2,2,3,3][c];l==="widehat"||l==="widecheck"?(a=[0,1062,2364,2364,2364][f],u=[0,239,300,360,420][f],h=[0,.24,.3,.3,.36,.42][f],d=l+f):(a=[0,600,1033,2339,2340][f],u=[0,260,286,306,312][f],h=[0,.26,.286,.3,.306,.34][f],d="tilde"+f)}var p=new i0(d),g=new bf([p],{width:"100%",height:qe(h),viewBox:"0 0 "+a+" "+u,preserveAspectRatio:"none"});return{span:s0([],[g],n),minWidth:0,height:h}}else{var y=[],v=VSt[l];if(!v)throw new Error('No SVG data for "'+l+'".');var[b,_,S]=v,k=S/1e3,T=b.length,E,C;if(T===1){if(v.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+l+'".');E=["hide-tail"],C=[v[3]]}else if(T===2)E=["halfarrow-left","halfarrow-right"],C=["xMinYMin","xMaxYMin"];else if(T===3)E=["brace-left","brace-center","brace-right"],C=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
|
||
`+T+" children.");for(var R=0;R<T;R++){var M=new i0(b[R]),D=new bf([M],{width:"400em",height:qe(k),viewBox:"0 0 "+a+" "+S,preserveAspectRatio:C[R]+" slice"}),P=s0([E[R]],[D],n);if(T===1)return{span:P,minWidth:_,height:k};P.style.height=qe(k),y.push(P)}return{span:ze(["stretchy"],y,n),minWidth:_,height:k}}}var{span:i,minWidth:s,height:o}=r();return i.height=o,i.style.height=qe(o),s>0&&(i.style.minWidth=qe(s)),i},HSt=function(e,n,r,i,s){var o,a=e.height+e.depth+r+i;if(/fbox|color|angl/.test(n)){if(o=ze(["stretchy",n],[],s),n==="fbox"){var l=s.color&&s.getColor();l&&(o.style.borderColor=l)}}else{var c=[];/^[bx]cancel$/.test(n)&&c.push(new LB({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&c.push(new LB({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var u=new bf(c,{width:"100%",height:qe(a)});o=s0([],[u],s)}return o.height=a,o.style.height=qe(a),o},USt={bin:1,close:1,inner:1,open:1,punct:1,rel:1},qSt={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function WSt(t){return t in USt}function rn(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function UR(t){var e=qR(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function qR(t){return t&&(t.type==="atom"||qSt.hasOwnProperty(t.type))?t:null}var i3e=t=>{if(t instanceof ll)return t;if(vSt(t)&&t.children.length===1)return i3e(t.children[0])},FG=(t,e)=>{var n,r,i;t&&t.type==="supsub"?(r=rn(t.base,"accent"),n=r.base,t.base=n,i=ySt(Gn(t,e)),t.base=r):(r=rn(t,"accent"),n=r.base);var s=Gn(n,e.havingCrampedStyle()),o=r.isShifty&&Nf(n),a=0;if(o){var l,c;a=(l=(c=i3e(s))==null?void 0:c.skew)!=null?l:0}var u=r.label==="\\c",d=u?s.height+s.depth:Math.min(s.height,e.fontMetrics().xHeight),h;if(r.isStretchy)h=HR(r,e),h=qn({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"elem",elem:h,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+qe(2*a)+")",marginLeft:qe(2*a)}:void 0}]});else{var f,p;r.label==="\\vec"?(f=X5e("vec",e),p=Z5e.vec[1]):(f=VR({mode:r.mode,text:r.label},e,"textord"),f=gSt(f),f.italic=0,p=f.width,u&&(d+=f.depth)),h=ze(["accent-body"],[f]);var g=r.label==="\\textcircled";g&&(h.classes.push("accent-full"),d=s.height);var y=a;g||(y-=p/2),h.style.left=qe(y),r.label==="\\textcircled"&&(h.style.top=".2em"),h=qn({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:-d},{type:"elem",elem:h}]})}var v=ze(["mord","accent"],[h],e);return i?(i.children[0]=v,i.height=Math.max(v.height,i.height),i.classes[0]="mord",i):v},s3e=(t,e)=>{var n=t.isStretchy?$R(t.label):new Ve("mo",[tc(t.label,t.mode)]),r=new Ve("mover",[_r(t.base,e),n]);return r.setAttribute("accent","true"),r},GSt=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));ot({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(t,e)=>{var n=H8(e[0]),r=!GSt.test(t.funcName),i=!r||t.funcName==="\\widehat"||t.funcName==="\\widetilde"||t.funcName==="\\widecheck";return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:r,isShifty:i,base:n}},htmlBuilder:FG,mathmlBuilder:s3e});ot({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(t,e)=>{var n=e[0],r=t.parser.mode;return r==="math"&&(t.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+t.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:t.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:FG,mathmlBuilder:s3e});ot({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0];return{type:"accentUnder",mode:n.mode,label:r,base:i}},htmlBuilder:(t,e)=>{var n=Gn(t.base,e),r=HR(t,e),i=t.label==="\\utilde"?.12:0,s=qn({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:n}]});return ze(["mord","accentunder"],[s],e)},mathmlBuilder:(t,e)=>{var n=$R(t.label),r=new Ve("munder",[_r(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var lT=t=>{var e=new Ve("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};ot({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r,funcName:i}=t;return{type:"xArrow",mode:r.mode,label:i,body:e[0],below:n[0]}},htmlBuilder(t,e){var n=e.style,r=e.havingStyle(n.sup()),i=xx(Gn(t.body,r,e),e),s=t.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(s+"-arrow-pad");var o;t.below&&(r=e.havingStyle(n.sub()),o=xx(Gn(t.below,r,e),e),o.classes.push(s+"-arrow-pad"));var a=HR(t,e),l=-e.fontMetrics().axisHeight+.5*a.height,c=-e.fontMetrics().axisHeight-.5*a.height-.111;(i.depth>.25||t.label==="\\xleftequilibrium")&&(c-=i.depth);var u;if(o){var d=-e.fontMetrics().axisHeight+o.height+.5*a.height+.111;u=qn({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]},{type:"elem",elem:o,shift:d}]})}else u=qn({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]}]});return ze(["mrel","x-arrow"],[u],e)},mathmlBuilder(t,e){var n=$R(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var i=lT(_r(t.body,e));if(t.below){var s=lT(_r(t.below,e));r=new Ve("munderover",[n,s,i])}else r=new Ve("mover",[n,i])}else if(t.below){var o=lT(_r(t.below,e));r=new Ve("munder",[n,o])}else r=lT(),r=new Ve("mover",[n,r]);return r}});function o3e(t,e){var n=Ji(t.body,e,!0);return ze([t.mclass],n,e)}function a3e(t,e){var n,r=pl(t.body,e);return t.mclass==="minner"?n=new Ve("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new Ve("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new Ve("mo",r),t.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):t.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):t.mclass==="mopen"||t.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):t.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}ot({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(t,e){var{parser:n,funcName:r}=t,i=e[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:Oi(i),isCharacterBox:Nf(i)}},htmlBuilder:o3e,mathmlBuilder:a3e});var WR=t=>{var e=t.type==="ordgroup"&&t.body.length?t.body[0]:t;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};ot({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:WR(e[0]),body:Oi(e[1]),isCharacterBox:Nf(e[1])}}});ot({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:n,funcName:r}=t,i=e[1],s=e[0],o;r!=="\\stackrel"?o=WR(i):o="mrel";var a={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:Oi(i)},l={type:"supsub",mode:s.mode,base:a,sup:r==="\\underset"?null:s,sub:r==="\\underset"?s:null};return{type:"mclass",mode:n.mode,mclass:o,body:[l],isCharacterBox:Nf(l)}},htmlBuilder:o3e,mathmlBuilder:a3e});ot({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:WR(e[0]),body:Oi(e[0])}},htmlBuilder(t,e){var n=Ji(t.body,e,!0),r=ze([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=pl(t.body,e),r=new Ve("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var KSt={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},loe=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),coe=t=>t.type==="textord"&&t.text==="@",YSt=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function ZSt(t,e,n){var r=KSt[t];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var i=n.callFunction("\\\\cdleft",[e[0]],[]),s={type:"atom",text:r,mode:"math",family:"rel"},o=n.callFunction("\\Big",[s],[]),a=n.callFunction("\\\\cdright",[e[1]],[]),l={type:"ordgroup",mode:"math",body:[i,o,a]};return n.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var c={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[c],[])}default:return{type:"textord",text:" ",mode:"math"}}}function XSt(t){var e=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){e.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();var n=t.fetch().text;if(n==="&"||n==="\\\\")t.consume();else if(n==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new Fe("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],i=[r],s=0;s<e.length;s++){for(var o=e[s],a=loe(),l=0;l<o.length;l++)if(!coe(o[l]))a.body.push(o[l]);else{r.push(a),l+=1;var c=UR(o[l]).text,u=new Array(2);if(u[0]={type:"ordgroup",mode:"math",body:[]},u[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(c))if("<>AV".includes(c))for(var d=0;d<2;d++){for(var h=!0,f=l+1;f<o.length;f++){if(YSt(o[f],c)){h=!1,l=f;break}if(coe(o[f]))throw new Fe("Missing a "+c+" character to complete a CD arrow.",o[f]);u[d].body.push(o[f])}if(h)throw new Fe("Missing a "+c+" character to complete a CD arrow.",o[l])}else throw new Fe('Expected one of "<>AV=|." after @',o[l]);var p=ZSt(c,u,t),g={type:"styling",body:[p],mode:"math",style:"display",resetFont:!0};r.push(g),a=loe()}s%2===0?r.push(a):r.shift(),r=[],i.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var y=new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:y,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}ot({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:e[0]}},htmlBuilder(t,e){var n=e.havingStyle(e.style.sup()),r=xx(Gn(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=qe(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new Ve("mrow",[_r(t.label,e)]);return n=new Ve("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Ve("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});ot({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(t,e){var{parser:n}=t;return{type:"cdlabelparent",mode:n.mode,fragment:e[0]}},htmlBuilder(t,e){var n=xx(Gn(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new Ve("mrow",[_r(t.fragment,e)])}});ot({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=rn(e[0],"ordgroup"),i=r.body,s="",o=0;o<i.length;o++){var a=rn(i[o],"textord");s+=a.text}var l=parseInt(s),c;if(isNaN(l))throw new Fe("\\@char has non-numeric argument "+s);if(l<0||l>=1114111)throw new Fe("\\@char with invalid code point "+s);return l<=65535?c=String.fromCharCode(l):(l-=65536,c=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:n.mode,text:c}}});var l3e=(t,e)=>{var n=Ji(t.body,e.withColor(t.color),!1);return Df(n)},c3e=(t,e)=>{var n=pl(t.body,e.withColor(t.color)),r=new Ve("mstyle",n);return r.setAttribute("mathcolor",t.color),r};ot({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=rn(e[0],"color-token").color,i=e[1];return{type:"color",mode:n.mode,color:r,body:Oi(i)}},htmlBuilder:l3e,mathmlBuilder:c3e});ot({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,i=rn(e[0],"color-token").color;n.gullet.macros.set("\\current@color",i);var s=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:i,body:s}},htmlBuilder:l3e,mathmlBuilder:c3e});ot({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(t,e,n){var{parser:r}=t,i=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,s=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:s,size:i&&rn(i,"size").value}},htmlBuilder(t,e){var n=ze(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=qe(Xr(t.size,e)))),n},mathmlBuilder(t,e){var n=new Ve("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",qe(Xr(t.size,e)))),n}});var GB={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},u3e=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new Fe("Expected a control sequence",t);return e},QSt=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},d3e=(t,e,n,r)=>{var i=t.gullet.macros.get(n.text);i==null&&(n.noexpand=!0,i={tokens:[n],numArgs:0,unexpandable:!t.gullet.isExpandable(n.text)}),t.gullet.macros.set(e,i,r)};ot({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(t){var{parser:e,funcName:n}=t;e.consumeSpaces();var r=e.fetch();if(GB[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=GB[r.text]),rn(e.parseFunction(),"internal");throw new Fe("Invalid token after macro prefix",r)}});ot({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=e.gullet.popToken(),i=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new Fe("Expected a control sequence",r);for(var s=0,o,a=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){o=e.gullet.future(),a[s].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new Fe('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==s+1)throw new Fe('Argument number "'+r.text+'" out of order');s++,a.push([])}else{if(r.text==="EOF")throw new Fe("Expected a macro definition");a[s].push(r.text)}var{tokens:l}=e.gullet.consumeArg();return o&&l.unshift(o),(n==="\\edef"||n==="\\xdef")&&(l=e.gullet.expandTokens(l),l.reverse()),e.gullet.macros.set(i,{tokens:l,numArgs:s,delimiters:a},n===GB[n]),{type:"internal",mode:e.mode}}});ot({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=u3e(e.gullet.popToken());e.gullet.consumeSpaces();var i=QSt(e);return d3e(e,r,i,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});ot({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=u3e(e.gullet.popToken()),i=e.gullet.popToken(),s=e.gullet.popToken();return d3e(e,r,s,n==="\\\\globalfuture"),e.gullet.pushToken(s),e.gullet.pushToken(i),{type:"internal",mode:e.mode}}});var V4=function(e,n,r){var i=$r.math[e]&&$r.math[e].replace,s=PG(i||e,n,r);if(!s)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return s},VG=function(e,n,r,i){var s=r.havingBaseStyle(n),o=ze(i.concat(s.sizingClasses(r)),[e],r),a=s.sizeMultiplier/r.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=s.sizeMultiplier,o},h3e=function(e,n,r){var i=n.havingBaseStyle(r),s=(1-n.sizeMultiplier/i.sizeMultiplier)*n.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=qe(s),e.height-=s,e.depth+=s},JSt=function(e,n,r,i,s,o){var a=So(e,"Main-Regular",s,i),l=VG(a,n,i,o);return h3e(l,i,n),l},ekt=function(e,n,r,i){return So(e,"Size"+n+"-Regular",r,i)},f3e=function(e,n,r,i,s,o){var a=ekt(e,n,s,i),l=VG(ze(["delimsizing","size"+n],[a],i),Ht.TEXT,i,o);return r&&h3e(l,i,Ht.TEXT),l},RD=function(e,n,r){var i;n==="Size1-Regular"?i="delim-size1":i="delim-size4";var s=ze(["delimsizinginner",i],[ze([],[So(e,n,r)])]);return{type:"elem",elem:s}},MD=function(e,n,r){var i=td["Size4-Regular"][e.charCodeAt(0)]?td["Size4-Regular"][e.charCodeAt(0)][4]:td["Size1-Regular"][e.charCodeAt(0)][4],s=new i0("inner",cSt(e,Math.round(1e3*n))),o=new bf([s],{width:qe(i),height:qe(n),style:"width:"+qe(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),a=s0([],[o],r);return a.height=n,a.style.height=qe(n),a.style.width=qe(i),{type:"elem",elem:a}},KB=.008,cT={type:"kern",size:-1*KB},tkt=new Set(["|","\\lvert","\\rvert","\\vert"]),nkt=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),p3e=function(e,n,r,i,s,o){var a,l,c,u,d="",h=0;a=c=u=e,l=null;var f="Size1-Regular";e==="\\uparrow"?c=u="⏐":e==="\\Uparrow"?c=u="‖":e==="\\downarrow"?a=c="⏐":e==="\\Downarrow"?a=c="‖":e==="\\updownarrow"?(a="\\uparrow",c="⏐",u="\\downarrow"):e==="\\Updownarrow"?(a="\\Uparrow",c="‖",u="\\Downarrow"):tkt.has(e)?(c="∣",d="vert",h=333):nkt.has(e)?(c="∥",d="doublevert",h=556):e==="["||e==="\\lbrack"?(a="⎡",c="⎢",u="⎣",f="Size4-Regular",d="lbrack",h=667):e==="]"||e==="\\rbrack"?(a="⎤",c="⎥",u="⎦",f="Size4-Regular",d="rbrack",h=667):e==="\\lfloor"||e==="⌊"?(c=a="⎢",u="⎣",f="Size4-Regular",d="lfloor",h=667):e==="\\lceil"||e==="⌈"?(a="⎡",c=u="⎢",f="Size4-Regular",d="lceil",h=667):e==="\\rfloor"||e==="⌋"?(c=a="⎥",u="⎦",f="Size4-Regular",d="rfloor",h=667):e==="\\rceil"||e==="⌉"?(a="⎤",c=u="⎥",f="Size4-Regular",d="rceil",h=667):e==="("||e==="\\lparen"?(a="⎛",c="⎜",u="⎝",f="Size4-Regular",d="lparen",h=875):e===")"||e==="\\rparen"?(a="⎞",c="⎟",u="⎠",f="Size4-Regular",d="rparen",h=875):e==="\\{"||e==="\\lbrace"?(a="⎧",l="⎨",u="⎩",c="⎪",f="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(a="⎫",l="⎬",u="⎭",c="⎪",f="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(a="⎧",u="⎩",c="⎪",f="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(a="⎫",u="⎭",c="⎪",f="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(a="⎧",u="⎭",c="⎪",f="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(a="⎫",u="⎩",c="⎪",f="Size4-Regular");var p=V4(a,f,s),g=p.height+p.depth,y=V4(c,f,s),v=y.height+y.depth,b=V4(u,f,s),_=b.height+b.depth,S=0,k=1;if(l!==null){var T=V4(l,f,s);S=T.height+T.depth,k=2}var E=g+_+S,C=Math.max(0,Math.ceil((n-E)/(k*v))),R=E+C*k*v,M=i.fontMetrics().axisHeight;r&&(M*=i.sizeMultiplier);var D=R/2-M,P=[];if(d.length>0){var z=R-g-_,Z=Math.round(R*1e3),re=uSt(d,Math.round(z*1e3)),G=new i0(d,re),ee=qe(h/1e3),J=qe(Z/1e3),oe=new bf([G],{width:ee,height:J,viewBox:"0 0 "+h+" "+Z}),B=s0([],[oe],i);B.height=Z/1e3,B.style.width=ee,B.style.height=J,P.push({type:"elem",elem:B})}else{if(P.push(RD(u,f,s)),P.push(cT),l===null){var $e=R-g-_+2*KB;P.push(MD(c,$e,i))}else{var Ye=(R-g-_-S)/2+2*KB;P.push(MD(c,Ye,i)),P.push(cT),P.push(RD(l,f,s)),P.push(cT),P.push(MD(c,Ye,i))}P.push(cT),P.push(RD(a,f,s))}var $=i.havingBaseStyle(Ht.TEXT),Re=qn({positionType:"bottom",positionData:D,children:P});return VG(ze(["delimsizing","mult"],[Re],$),Ht.TEXT,i,o)},ND=80,OD=.08,DD=function(e,n,r,i,s){var o=lSt(e,i,r),a=new i0(e,o),l=new bf([a],{width:"400em",height:qe(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return s0(["hide-tail"],[l],s)},rkt=function(e,n){var r=n.havingBaseSizing(),i=b3e("\\surd",e*r.sizeMultiplier,v3e,r),s=r.sizeMultiplier,o=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),a,l,c,u,d;return i.type==="small"?(u=1e3+1e3*o+ND,e<1?s=1:e<1.4&&(s=.7),l=(1+o+OD)/s,c=(1+o)/s,a=DD("sqrtMain",l,u,o,n),a.style.minWidth="0.853em",d=.833/s):i.type==="large"?(u=(1e3+ND)*uS[i.size],c=(uS[i.size]+o)/s,l=(uS[i.size]+o+OD)/s,a=DD("sqrtSize"+i.size,l,u,o,n),a.style.minWidth="1.02em",d=1/s):(l=e+o+OD,c=e+o,u=Math.floor(1e3*e+o)+ND,a=DD("sqrtTall",l,u,o,n),a.style.minWidth="0.742em",d=1.056),a.height=c,a.style.height=qe(l),{span:a,advanceWidth:d,ruleWidth:(n.fontMetrics().sqrtRuleThickness+o)*s}},m3e=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),ikt=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),g3e=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),uS=[0,1.2,1.8,2.4,3],y3e=function(e,n,r,i,s){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),m3e.has(e)||g3e.has(e))return f3e(e,n,!1,r,i,s);if(ikt.has(e))return p3e(e,uS[n],!1,r,i,s);throw new Fe("Illegal delimiter: '"+e+"'")},skt=[{type:"small",style:Ht.SCRIPTSCRIPT},{type:"small",style:Ht.SCRIPT},{type:"small",style:Ht.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],okt=[{type:"small",style:Ht.SCRIPTSCRIPT},{type:"small",style:Ht.SCRIPT},{type:"small",style:Ht.TEXT},{type:"stack"}],v3e=[{type:"small",style:Ht.SCRIPTSCRIPT},{type:"small",style:Ht.SCRIPT},{type:"small",style:Ht.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],akt=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";var n=e.type;throw new Error("Add support for delim type '"+n+"' here.")},b3e=function(e,n,r,i){for(var s=Math.min(2,3-i.style.size),o=s;o<r.length;o++){var a=r[o];if(a.type==="stack")break;var l=V4(e,akt(a),"math"),c=l.height+l.depth;if(a.type==="small"){var u=i.havingBaseStyle(a.style);c*=u.sizeMultiplier}if(c>n)return a}return r[r.length-1]},YB=function(e,n,r,i,s,o){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var a;g3e.has(e)?a=skt:m3e.has(e)?a=v3e:a=okt;var l=b3e(e,n,a,i);return l.type==="small"?JSt(e,l.style,r,i,s,o):l.type==="large"?f3e(e,l.size,r,i,s,o):p3e(e,n,r,i,s,o)},PD=function(e,n,r,i,s,o){var a=i.fontMetrics().axisHeight*i.sizeMultiplier,l=901,c=5/i.fontMetrics().ptPerEm,u=Math.max(n-a,r+a),d=Math.max(u/500*l,2*u-c);return YB(e,d,!0,i,s,o)},uoe={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},lkt=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);function doe(t){return"isMiddle"in t}function GR(t,e){var n=qR(t);if(n&&lkt.has(n.text))return n;throw n?new Fe("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new Fe("Invalid delimiter type '"+t.type+"'",t)}ot({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,e)=>{var n=GR(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:uoe[t.funcName].size,mclass:uoe[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?ze([t.mclass]):y3e(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(tc(t.delim,t.mode));var n=new Ve("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=qe(uS[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function hoe(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}ot({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=t.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new Fe("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:GR(e[0],t).text,color:n}}});ot({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=GR(e[0],t),r=t.parser;++r.leftrightDepth;var i=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var s=rn(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:i,left:n.text,right:s.delim,rightColor:s.color}},htmlBuilder:(t,e)=>{hoe(t);for(var n=Ji(t.body,e,!0,["mopen","mclose"]),r=0,i=0,s=!1,o=0;o<n.length;o++){var a=n[o];doe(a)?s=!0:(r=Math.max(n[o].height,r),i=Math.max(n[o].depth,i))}r*=e.sizeMultiplier,i*=e.sizeMultiplier;var l;if(t.left==="."?l=Lk(e,["mopen"]):l=PD(t.left,r,i,e,t.mode,["mopen"]),n.unshift(l),s)for(var c=1;c<n.length;c++){var u=n[c];if(doe(u)){var d=u.isMiddle;n[c]=PD(d.delim,r,i,d.options,t.mode,[])}}var h;if(t.right===".")h=Lk(e,["mclose"]);else{var f=t.rightColor?e.withColor(t.rightColor):e;h=PD(t.right,r,i,f,t.mode,["mclose"])}return n.push(h),ze(["minner"],n,e)},mathmlBuilder:(t,e)=>{hoe(t);var n=pl(t.body,e);if(t.left!=="."){var r=new Ve("mo",[tc(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var i=new Ve("mo",[tc(t.right,t.mode)]);i.setAttribute("fence","true"),t.rightColor&&i.setAttribute("mathcolor",t.rightColor),n.push(i)}return jG(n)}});ot({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=GR(e[0],t);if(!t.parser.leftrightDepth)throw new Fe("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;return t.delim==="."?n=Lk(e,[]):(n=y3e(t.delim,1,e,t.mode,[]),n.isMiddle={delim:t.delim,options:e}),n},mathmlBuilder:(t,e)=>{var n=t.delim==="\\vert"||t.delim==="|"?tc("|","text"):tc(t.delim,t.mode),r=new Ve("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var KR=(t,e)=>{var n=xx(Gn(t.body,e),e),r=t.label.slice(1),i=e.sizeMultiplier,s,o,a=Nf(t.body);if(r==="sout")s=ze(["stretchy","sout"]),s.height=e.fontMetrics().defaultRuleThickness/i,o=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var l=Xr({number:.6,unit:"pt"},e),c=Xr({number:.35,unit:"ex"},e),u=e.havingBaseSizing();i=i/u.sizeMultiplier;var d=n.height+n.depth+l+c;n.style.paddingLeft=qe(d/2+l);var h=Math.floor(1e3*d*i),f=oSt(h),p=new bf([new i0("phase",f)],{width:"400em",height:qe(h/1e3),viewBox:"0 0 400000 "+h,preserveAspectRatio:"xMinYMin slice"});s=s0(["hide-tail"],[p],e),s.style.height=qe(d),o=n.depth+l+c}else{/cancel/.test(r)?a||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var g,y,v=0;/box/.test(r)?(v=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),g=e.fontMetrics().fboxsep+(r==="colorbox"?0:v),y=g):r==="angl"?(v=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),g=4*v,y=Math.max(0,.25-n.depth)):(g=a?.2:0,y=g),s=HSt(n,r,g,y,e),/fbox|boxed|fcolorbox/.test(r)?(s.style.borderStyle="solid",s.style.borderWidth=qe(v)):r==="angl"&&v!==.049&&(s.style.borderTopWidth=qe(v),s.style.borderRightWidth=qe(v)),o=n.depth+y,t.backgroundColor&&(s.style.backgroundColor=t.backgroundColor,t.borderColor&&(s.style.borderColor=t.borderColor))}var b;if(t.backgroundColor)b=qn({positionType:"individualShift",children:[{type:"elem",elem:s,shift:o},{type:"elem",elem:n,shift:0}]});else{var _=/cancel|phase/.test(r)?["svg-align"]:[];b=qn({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:s,shift:o,wrapperClasses:_}]})}return/cancel/.test(r)&&(b.height=n.height,b.depth=n.depth),/cancel/.test(r)&&!a?ze(["mord","cancel-lap"],[b],e):ze(["mord"],[b],e)},YR=(t,e)=>{var n,r=new Ve(t.label.includes("colorbox")?"mpadded":"menclose",[_r(t.body,e)]);switch(t.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),t.label==="\\fcolorbox"){var i=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+qe(i)+" solid "+t.borderColor)}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&r.setAttribute("mathbackground",t.backgroundColor),r};ot({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(t,e,n){var{parser:r,funcName:i}=t,s=rn(e[0],"color-token").color,o=e[1];return{type:"enclose",mode:r.mode,label:i,backgroundColor:s,body:o}},htmlBuilder:KR,mathmlBuilder:YR});ot({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(t,e,n){var{parser:r,funcName:i}=t,s=rn(e[0],"color-token").color,o=rn(e[1],"color-token").color,a=e[2];return{type:"enclose",mode:r.mode,label:i,backgroundColor:o,borderColor:s,body:a}},htmlBuilder:KR,mathmlBuilder:YR});ot({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\fbox",body:e[0]}}});ot({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t,i=e[0];return{type:"enclose",mode:n.mode,label:r,body:i}},htmlBuilder:KR,mathmlBuilder:YR});ot({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t;n.mode==="math"&&n.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var i=e[0];return{type:"enclose",mode:n.mode,label:r,body:i}},htmlBuilder:KR,mathmlBuilder:YR});ot({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\angl",body:e[0]}}});var w3e={};function Ld(t){for(var{type:e,names:n,props:r,handler:i,htmlBuilder:s,mathmlBuilder:o}=t,a={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},l=0;l<n.length;++l)w3e[n[l]]=a;s&&(V8[e]=s),o&&($8[e]=o)}var x3e={};function F(t,e){x3e[t]=e}class sa{constructor(e,n,r){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=n,this.end=r}static range(e,n){return n?!e||!e.loc||!n.loc||e.loc.lexer!==n.loc.lexer?null:new sa(e.loc.lexer,e.loc.start,n.loc.end):e&&e.loc}}class nl{constructor(e,n){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=n}range(e,n){return new nl(n,sa.range(this,e))}}function foe(t){var e=[];t.consumeSpaces();var n=t.fetch().text;for(n==="\\relax"&&(t.consume(),t.consumeSpaces(),n=t.fetch().text);n==="\\hline"||n==="\\hdashline";)t.consume(),e.push(n==="\\hdashline"),t.consumeSpaces(),n=t.fetch().text;return e}var ZR=t=>{var e=t.parser.settings;if(!e.displayMode)throw new Fe("{"+t.envName+"} can be used only in display mode.")},ckt=new Set(["gather","gather*"]);function $G(t){if(!t.includes("ed"))return!t.includes("*")}function D0(t,e,n){var{hskipBeforeAndAfter:r,addJot:i,cols:s,arraystretch:o,colSeparationType:a,autoTag:l,singleRow:c,emptySingleRow:u,maxNumCols:d,leqno:h}=e;if(t.gullet.beginGroup(),c||t.gullet.macros.set("\\cr","\\\\\\relax"),!o){var f=t.gullet.expandMacroAsText("\\arraystretch");if(f==null)o=1;else if(o=parseFloat(f),!o||o<0)throw new Fe("Invalid \\arraystretch: "+f)}t.gullet.beginGroup();var p=[],g=[p],y=[],v=[],b=l!=null?[]:void 0;function _(){l&&t.gullet.macros.set("\\@eqnsw","1",!0)}function S(){b&&(t.gullet.macros.get("\\df@tag")?(b.push(t.subparse([new nl("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):b.push(!!l&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(_(),v.push(foe(t));;){var k=t.parseExpression(!1,c?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup();var T={type:"ordgroup",mode:t.mode,body:k};n&&(T={type:"styling",mode:t.mode,style:n,resetFont:!0,body:[T]}),p.push(T);var E=t.fetch().text;if(E==="&"){if(d&&p.length===d){if(c||a)throw new Fe("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(E==="\\end"){S(),p.length===1&&T.type==="styling"&&T.body.length===1&&T.body[0].type==="ordgroup"&&T.body[0].body.length===0&&(g.length>1||!u)&&g.pop(),v.length<g.length+1&&v.push([]);break}else if(E==="\\\\"){t.consume();var C=void 0;t.gullet.future().text!==" "&&(C=t.parseSizeGroup(!0)),y.push(C?C.value:null),S(),v.push(foe(t)),p=[],g.push(p),_()}else throw new Fe("Expected & or \\\\ or \\cr or \\end",t.nextToken)}return t.gullet.endGroup(),t.gullet.endGroup(),{type:"array",mode:t.mode,addJot:i,arraystretch:o,body:g,cols:s,rowGaps:y,hskipBeforeAndAfter:r,hLinesBeforeRow:v,colSeparationType:a,tags:b,leqno:h}}function HG(t){return t.slice(0,1)==="d"?"display":"text"}var zd=function(e,n){var r,i,s=e.body.length,o=e.hLinesBeforeRow,a=0,l=new Array(s),c=[],u=Math.max(n.fontMetrics().arrayRuleWidth,n.minRuleThickness),d=1/n.fontMetrics().ptPerEm,h=5*d;if(e.colSeparationType&&e.colSeparationType==="small"){var f=n.havingStyle(Ht.SCRIPT).sizeMultiplier;h=.2778*(f/n.sizeMultiplier)}var p=e.colSeparationType==="CD"?Xr({number:3,unit:"ex"},n):12*d,g=3*d,y=e.arraystretch*p,v=.7*y,b=.3*y,_=0;function S(Le){for(var Ze=0;Ze<Le.length;++Ze)Ze>0&&(_+=.25),c.push({pos:_,isDashed:Le[Ze]})}for(S(o[0]),r=0;r<e.body.length;++r){var k=e.body[r],T=v,E=b;a<k.length&&(a=k.length);var C={cells:new Array(k.length),height:0,depth:0,pos:0};for(i=0;i<k.length;++i){var R=Gn(k[i],n);E<R.depth&&(E=R.depth),T<R.height&&(T=R.height),C.cells[i]=R}var M=e.rowGaps[r],D=0;M&&(D=Xr(M,n),D>0&&(D+=b,E<D&&(E=D),D=0)),e.addJot&&r<e.body.length-1&&(E+=g),C.height=T,C.depth=E,_+=T,C.pos=_,_+=E+D,l[r]=C,S(o[r+1])}var P=_/2+n.fontMetrics().axisHeight,z=e.cols||[],Z=[],re,G,ee=[];if(e.tags&&e.tags.some(Le=>Le))for(r=0;r<s;++r){var J=l[r],oe=J.pos-P,B=e.tags[r],$e=void 0;B===!0?$e=ze(["eqn-num"],[],n):B===!1?$e=ze([],[],n):$e=ze([],Ji(B,n,!0),n),$e.depth=J.depth,$e.height=J.height,ee.push({type:"elem",elem:$e,shift:oe})}for(i=0,G=0;i<a||G<z.length;++i,++G){for(var Ye,$=z[G],Re=!0;((ke=$)==null?void 0:ke.type)==="separator";){var ke;if(Re||(re=ze(["arraycolsep"],[]),re.style.width=qe(n.fontMetrics().doubleRuleSep),Z.push(re)),$.separator==="|"||$.separator===":"){var Me=$.separator==="|"?"solid":"dashed",_e=ze(["vertical-separator"],[],n);_e.style.height=qe(_),_e.style.borderRightWidth=qe(u),_e.style.borderRightStyle=Me,_e.style.margin="0 "+qe(-u/2);var Ne=_-P;Ne&&(_e.style.verticalAlign=qe(-Ne)),Z.push(_e)}else throw new Fe("Invalid separator type: "+$.separator);G++,$=z[G],Re=!1}if(!(i>=a)){var Ue=void 0;if(i>0||e.hskipBeforeAndAfter){var at,ct;Ue=(at=(ct=$)==null?void 0:ct.pregap)!=null?at:h,Ue!==0&&(re=ze(["arraycolsep"],[]),re.style.width=qe(Ue),Z.push(re))}var H=[];for(r=0;r<s;++r){var Y=l[r],se=Y.cells[i];if(se){var me=Y.pos-P;se.depth=Y.depth,se.height=Y.height,H.push({type:"elem",elem:se,shift:me})}}var de=qn({positionType:"individualShift",children:H}),ie=ze(["col-align-"+(((Ye=$)==null?void 0:Ye.align)||"c")],[de]);if(Z.push(ie),i<a-1||e.hskipBeforeAndAfter){var Te,he;Ue=(Te=(he=$)==null?void 0:he.postgap)!=null?Te:h,Ue!==0&&(re=ze(["arraycolsep"],[]),re.style.width=qe(Ue),Z.push(re))}}}var we=ze(["mtable"],Z);if(c.length>0){for(var ye=wx("hline",n,u),Ge=wx("hdashline",n,u),Pe=[{type:"elem",elem:we,shift:0}];c.length>0;){var tt=c.pop(),ft=tt.pos-P;tt.isDashed?Pe.push({type:"elem",elem:Ge,shift:ft}):Pe.push({type:"elem",elem:ye,shift:ft})}we=qn({positionType:"individualShift",children:Pe})}if(ee.length===0)return ze(["mord"],[we],n);var ne=qn({positionType:"individualShift",children:ee}),fe=ze(["tag"],[ne],n);return Df([we,fe])},ukt={c:"center ",l:"left ",r:"right "},jd=function(e,n){for(var r=[],i=new Ve("mtd",[],["mtr-glue"]),s=new Ve("mtd",[],["mml-eqn-num"]),o=0;o<e.body.length;o++){for(var a=e.body[o],l=[],c=0;c<a.length;c++)l.push(new Ve("mtd",[_r(a[c],n)]));e.tags&&e.tags[o]&&(l.unshift(i),l.push(i),e.leqno?l.unshift(s):l.push(s)),r.push(new Ve("mtr",l))}var u=new Ve("mtable",r),d=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);u.setAttribute("rowspacing",qe(d));var h="",f="";if(e.cols&&e.cols.length>0){var p=e.cols,g="",y=!1,v=0,b=p.length;p[0].type==="separator"&&(h+="top ",v=1),p[p.length-1].type==="separator"&&(h+="bottom ",b-=1);for(var _=v;_<b;_++){var S=p[_];S.type==="align"?(f+=ukt[S.align],y&&(g+="none "),y=!0):S.type==="separator"&&y&&(g+=S.separator==="|"?"solid ":"dashed ",y=!1)}u.setAttribute("columnalign",f.trim()),/[sd]/.test(g)&&u.setAttribute("columnlines",g.trim())}if(e.colSeparationType==="align"){for(var k=e.cols||[],T="",E=1;E<k.length;E++)T+=E%2?"0em ":"1em ";u.setAttribute("columnspacing",T.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?u.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?u.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?u.setAttribute("columnspacing","0.5em"):u.setAttribute("columnspacing","1em");var C="",R=e.hLinesBeforeRow;h+=R[0].length>0?"left ":"",h+=R[R.length-1].length>0?"right ":"";for(var M=1;M<R.length-1;M++)C+=R[M].length===0?"none ":R[M][0]?"dashed ":"solid ";return/[sd]/.test(C)&&u.setAttribute("rowlines",C.trim()),h!==""&&(u=new Ve("menclose",[u]),u.setAttribute("notation",h.trim())),e.arraystretch&&e.arraystretch<1&&(u=new Ve("mstyle",[u]),u.setAttribute("scriptlevel","1")),u},_3e=function(e,n){e.envName.includes("ed")||ZR(e);var r=[],i=e.envName.includes("at")?"alignat":"align",s=e.envName==="split",o=D0(e.parser,{cols:r,addJot:!0,autoTag:s?void 0:$G(e.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:s?2:void 0,leqno:e.parser.settings.leqno},"display"),a=0,l=0,c={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var u="",d=0;d<n[0].body.length;d++){var h=rn(n[0].body[d],"textord");u+=h.text}a=Number(u),l=a*2}var f=!l;o.body.forEach(function(v){for(var b=1;b<v.length;b+=2){var _=rn(v[b],"styling"),S=rn(_.body[0],"ordgroup");S.body.unshift(c)}if(f)l<v.length&&(l=v.length);else{var k=v.length/2;if(a<k)throw new Fe("Too many math in a row: "+("expected "+a+", but got "+k),v[0])}});for(var p=0;p<l;++p){var g="r",y=0;p%2===1?g="l":p>0&&f&&(y=1),r[p]={type:"align",align:g,pregap:y,postgap:0}}return o.colSeparationType=f?"align":"alignat",o};Ld({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=qR(e[0]),r=n?[e[0]]:rn(e[0],"ordgroup").body,i=r.map(function(o){var a=UR(o),l=a.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new Fe("Unknown column alignment: "+l,o)}),s={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return D0(t.parser,s,HG(t.envName))},htmlBuilder:zd,mathmlBuilder:jd});Ld({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(t.envName.charAt(t.envName.length-1)==="*"){var i=t.parser;if(i.consumeSpaces(),i.fetch().text==="["){if(i.consume(),i.consumeSpaces(),n=i.fetch().text,!"lcr".includes(n))throw new Fe("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),r.cols=[{type:"align",align:n}]}}var s=D0(t.parser,r,HG(t.envName)),o=Math.max(0,...s.body.map(a=>a.length));return s.cols=new Array(o).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[s],left:e[0],right:e[1],rightColor:void 0}:s},htmlBuilder:zd,mathmlBuilder:jd});Ld({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=D0(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:zd,mathmlBuilder:jd});Ld({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=qR(e[0]),r=n?[e[0]]:rn(e[0],"ordgroup").body,i=r.map(function(a){var l=UR(a),c=l.text;if("lc".includes(c))return{type:"align",align:c};throw new Fe("Unknown column alignment: "+c,a)});if(i.length>1)throw new Fe("{subarray} can contain only one column");var s={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5},o=D0(t.parser,s,"script");if(o.body.length>0&&o.body[0].length>1)throw new Fe("{subarray} can contain only one column");return o},htmlBuilder:zd,mathmlBuilder:jd});Ld({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(t){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=D0(t.parser,e,HG(t.envName));return{type:"leftright",mode:t.mode,body:[n],left:t.envName.includes("r")?".":"\\{",right:t.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:zd,mathmlBuilder:jd});Ld({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:_3e,htmlBuilder:zd,mathmlBuilder:jd});Ld({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){ckt.has(t.envName)&&ZR(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:$G(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return D0(t.parser,e,"display")},htmlBuilder:zd,mathmlBuilder:jd});Ld({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:_3e,htmlBuilder:zd,mathmlBuilder:jd});Ld({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){ZR(t);var e={autoTag:$G(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return D0(t.parser,e,"display")},htmlBuilder:zd,mathmlBuilder:jd});Ld({type:"array",names:["CD"],props:{numArgs:0},handler(t){return ZR(t),XSt(t.parser)},htmlBuilder:zd,mathmlBuilder:jd});F("\\nonumber","\\gdef\\@eqnsw{0}");F("\\notag","\\nonumber");ot({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new Fe(t.funcName+" valid only within array environment")}});var poe=w3e;ot({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(t,e){var{parser:n,funcName:r}=t,i=e[0];if(i.type!=="ordgroup")throw new Fe("Invalid environment name",i);for(var s="",o=0;o<i.body.length;++o)s+=rn(i.body[o],"textord").text;if(r==="\\begin"){if(!poe.hasOwnProperty(s))throw new Fe("No such environment: "+s,i);var a=poe[s],{args:l,optArgs:c}=n.parseArguments("\\begin{"+s+"}",a),u={mode:n.mode,envName:s,parser:n},d=a.handler(u,l,c);n.expect("\\end",!1);var h=n.nextToken,f=rn(n.parseFunction(),"environment");if(f.name!==s)throw new Fe("Mismatch: \\begin{"+s+"} matched by \\end{"+f.name+"}",h);return d}return{type:"environment",mode:n.mode,name:s,nameGroup:i}}});var S3e=(t,e)=>{var n=t.font,r=e.withFont(n);return Gn(t.body,r)},k3e=(t,e)=>{var n=t.font,r=e.withFont(n);return _r(t.body,r)},moe={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};ot({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=H8(e[0]),s=r;return s in moe&&(s=moe[s]),{type:"font",mode:n.mode,font:s.slice(1),body:i}},htmlBuilder:S3e,mathmlBuilder:k3e});ot({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"mclass",mode:n.mode,mclass:WR(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:Nf(r)}}});ot({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,breakOnTokenText:i}=t,{mode:s}=n,o=n.parseExpression(!0,i);return{type:"font",mode:s,font:"math"+r.slice(1),body:{type:"ordgroup",mode:n.mode,body:o}}},htmlBuilder:S3e,mathmlBuilder:k3e});var dkt=(t,e)=>{var n=e.style,r=n.fracNum(),i=n.fracDen(),s;s=e.havingStyle(r);var o=Gn(t.numer,s,e);if(t.continued){var a=8.5/e.fontMetrics().ptPerEm,l=3.5/e.fontMetrics().ptPerEm;o.height=o.height<a?a:o.height,o.depth=o.depth<l?l:o.depth}s=e.havingStyle(i);var c=Gn(t.denom,s,e),u,d,h;t.hasBarLine?(t.barSize?(d=Xr(t.barSize,e),u=wx("frac-line",e,d)):u=wx("frac-line",e),d=u.height,h=u.height):(u=null,d=0,h=e.fontMetrics().defaultRuleThickness);var f,p,g;n.size===Ht.DISPLAY.size?(f=e.fontMetrics().num1,d>0?p=3*h:p=7*h,g=e.fontMetrics().denom1):(d>0?(f=e.fontMetrics().num2,p=h):(f=e.fontMetrics().num3,p=3*h),g=e.fontMetrics().denom2);var y;if(u){var b=e.fontMetrics().axisHeight;f-o.depth-(b+.5*d)<p&&(f+=p-(f-o.depth-(b+.5*d))),b-.5*d-(c.height-g)<p&&(g+=p-(b-.5*d-(c.height-g)));var _=-(b-.5*d);y=qn({positionType:"individualShift",children:[{type:"elem",elem:c,shift:g},{type:"elem",elem:u,shift:_},{type:"elem",elem:o,shift:-f}]})}else{var v=f-o.depth-(c.height-g);v<p&&(f+=.5*(p-v),g+=.5*(p-v)),y=qn({positionType:"individualShift",children:[{type:"elem",elem:c,shift:g},{type:"elem",elem:o,shift:-f}]})}s=e.havingStyle(n),y.height*=s.sizeMultiplier/e.sizeMultiplier,y.depth*=s.sizeMultiplier/e.sizeMultiplier;var S;n.size===Ht.DISPLAY.size?S=e.fontMetrics().delim1:n.size===Ht.SCRIPTSCRIPT.size?S=e.havingStyle(Ht.SCRIPT).fontMetrics().delim2:S=e.fontMetrics().delim2;var k,T;return t.leftDelim==null?k=Lk(e,["mopen"]):k=YB(t.leftDelim,S,!0,e.havingStyle(n),t.mode,["mopen"]),t.continued?T=ze([]):t.rightDelim==null?T=Lk(e,["mclose"]):T=YB(t.rightDelim,S,!0,e.havingStyle(n),t.mode,["mclose"]),ze(["mord"].concat(s.sizingClasses(e)),[k,ze(["mfrac"],[y]),T],e)},hkt=(t,e)=>{var n=new Ve("mfrac",[_r(t.numer,e),_r(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=Xr(t.barSize,e);n.setAttribute("linethickness",qe(r))}if(t.leftDelim!=null||t.rightDelim!=null){var i=[];if(t.leftDelim!=null){var s=new Ve("mo",[new Di(t.leftDelim.replace("\\",""))]);s.setAttribute("fence","true"),i.push(s)}if(i.push(n),t.rightDelim!=null){var o=new Ve("mo",[new Di(t.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),i.push(o)}return jG(i)}return n},C3e=(t,e)=>{if(!e)return t;var n={type:"styling",mode:t.mode,style:e,body:[t]};return n};ot({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0],s=e[1],o,a=null,l=null;switch(r){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o=!1,a="(",l=")";break;case"\\\\bracefrac":o=!1,a="\\{",l="\\}";break;case"\\\\brackfrac":o=!1,a="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var c=r==="\\cfrac",u=null;return c||r.startsWith("\\d")?u="display":r.startsWith("\\t")&&(u="text"),C3e({type:"genfrac",mode:n.mode,numer:i,denom:s,continued:c,hasBarLine:o,leftDelim:a,rightDelim:l,barSize:null},u)},htmlBuilder:dkt,mathmlBuilder:hkt});ot({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(t){var{parser:e,funcName:n,token:r}=t,i;switch(n){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:i,token:r}}});var goe=["display","text","script","scriptscript"],yoe=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};ot({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(t,e){var{parser:n}=t,r=e[4],i=e[5],s=H8(e[0]),o=s.type==="atom"&&s.family==="open"?yoe(s.text):null,a=H8(e[1]),l=a.type==="atom"&&a.family==="close"?yoe(a.text):null,c=rn(e[2],"size"),u,d=null;c.isBlank?u=!0:(d=c.value,u=d.number>0);var h=null,f=e[3];if(f.type==="ordgroup"){if(f.body.length>0){var p=rn(f.body[0],"textord");h=goe[Number(p.text)]}}else f=rn(f,"textord"),h=goe[Number(f.text)];return C3e({type:"genfrac",mode:n.mode,numer:r,denom:i,continued:!1,hasBarLine:u,barSize:d,leftDelim:o,rightDelim:l},h)}});ot({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(t,e){var{parser:n,funcName:r,token:i}=t;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:rn(e[0],"size").value,token:i}}});ot({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0],s=rn(e[1],"infix").size;if(!s)throw new Error("\\\\abovefrac expected size, but got "+String(s));var o=e[2],a=s.number>0;return{type:"genfrac",mode:n.mode,numer:i,denom:o,continued:!1,hasBarLine:a,barSize:s,leftDelim:null,rightDelim:null}}});var E3e=(t,e)=>{var n=e.style,r,i;t.type==="supsub"?(r=t.sup?Gn(t.sup,e.havingStyle(n.sup()),e):Gn(t.sub,e.havingStyle(n.sub()),e),i=rn(t.base,"horizBrace")):i=rn(t,"horizBrace");var s=Gn(i.base,e.havingBaseStyle(Ht.DISPLAY)),o=HR(i,e),a;if(i.isOver?a=qn({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:o,wrapperClasses:["svg-align"]}]}):a=qn({positionType:"bottom",positionData:s.depth+.1+o.height,children:[{type:"elem",elem:o,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:s}]}),r){var l=ze(["minner",i.isOver?"mover":"munder"],[a],e);i.isOver?a=qn({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]}):a=qn({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]})}return ze(["minner",i.isOver?"mover":"munder"],[a],e)},fkt=(t,e)=>{var n=$R(t.label);return new Ve(t.isOver?"mover":"munder",[_r(t.base,e),n])};ot({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"horizBrace",mode:n.mode,label:r,isOver:r.includes("\\over"),base:e[0]}},htmlBuilder:E3e,mathmlBuilder:fkt});ot({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],i=rn(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:n.mode,href:i,body:Oi(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=Ji(t.body,e,!1);return ESt(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=o0(t.body,e);return n instanceof Ve||(n=new Ve("mrow",[n])),n.setAttribute("href",t.href),n}});ot({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=rn(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var i=[],s=0;s<r.length;s++){var o=r[s];o==="~"&&(o="\\textasciitilde"),i.push({type:"textord",mode:"text",text:o})}var a={type:"text",mode:n.mode,font:"\\texttt",body:i};return{type:"href",mode:n.mode,href:r,body:Oi(a)}}});ot({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(t,e){var{parser:n}=t;return{type:"hbox",mode:n.mode,body:Oi(e[0])}},htmlBuilder(t,e){var n=Ji(t.body,e.withFont(""),!1);return Df(n)},mathmlBuilder(t,e){return new Ve("mrow",pl(t.body,e.withFont("")))}});ot({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,token:i}=t,s=rn(e[0],"raw").string,o=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var a,l={};switch(r){case"\\htmlClass":l.class=s,a={command:"\\htmlClass",class:s};break;case"\\htmlId":l.id=s,a={command:"\\htmlId",id:s};break;case"\\htmlStyle":l.style=s,a={command:"\\htmlStyle",style:s};break;case"\\htmlData":{for(var c=s.split(","),u=0;u<c.length;u++){var d=c[u],h=d.indexOf("=");if(h<0)throw new Fe("\\htmlData key/value '"+d+"' missing equals sign");var f=d.slice(0,h),p=d.slice(h+1);l["data-"+f.trim()]=p}a={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return n.settings.isTrusted(a)?{type:"html",mode:n.mode,attributes:l,body:Oi(o)}:n.formatUnsupportedCmd(r)},htmlBuilder:(t,e)=>{var n=Ji(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var i=ze(r,n,e);for(var s in t.attributes)s!=="class"&&t.attributes.hasOwnProperty(s)&&i.setAttribute(s,t.attributes[s]);return i},mathmlBuilder:(t,e)=>o0(t.body,e)});ot({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInArgument:!0,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:Oi(e[0]),mathml:Oi(e[1])}},htmlBuilder:(t,e)=>{var n=Ji(t.html,e,!1);return Df(n)},mathmlBuilder:(t,e)=>o0(t.mathml,e)});var LD=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!n)throw new Fe("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!H5e(r))throw new Fe("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};ot({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(t,e,n)=>{var{parser:r}=t,i={number:0,unit:"em"},s={number:.9,unit:"em"},o={number:0,unit:"em"},a="";if(n[0])for(var l=rn(n[0],"raw").string,c=l.split(","),u=0;u<c.length;u++){var d=c[u].split("=");if(d.length===2){var h=d[1].trim();switch(d[0].trim()){case"alt":a=h;break;case"width":i=LD(h);break;case"height":s=LD(h);break;case"totalheight":o=LD(h);break;default:throw new Fe("Invalid key: '"+d[0]+"' in \\includegraphics.")}}}var f=rn(e[0],"url").url;return a===""&&(a=f,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:f})?{type:"includegraphics",mode:r.mode,alt:a,width:i,height:s,totalheight:o,src:f}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(t,e)=>{var n=Xr(t.height,e),r=0;t.totalheight.number>0&&(r=Xr(t.totalheight,e)-n);var i=0;t.width.number>0&&(i=Xr(t.width,e));var s={height:qe(n+r)};i>0&&(s.width=qe(i)),r>0&&(s.verticalAlign=qe(-r));var o=new pSt(t.src,t.alt,s);return o.height=n,o.depth=r,o},mathmlBuilder:(t,e)=>{var n=new Ve("mglyph",[]);n.setAttribute("alt",t.alt);var r=Xr(t.height,e),i=0;if(t.totalheight.number>0&&(i=Xr(t.totalheight,e)-r,n.setAttribute("valign",qe(-i))),n.setAttribute("height",qe(r+i)),t.width.number>0){var s=Xr(t.width,e);n.setAttribute("width",qe(s))}return n.setAttribute("src",t.src),n}});ot({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,i=rn(e[0],"size");if(n.settings.strict){var s=r[1]==="m",o=i.value.unit==="mu";s?(o||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+i.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):o&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:i.value}},htmlBuilder(t,e){return Y5e(t.dimension,e)},mathmlBuilder(t,e){var n=Xr(t.dimension,e);return new t3e(n)}});ot({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:i}},htmlBuilder:(t,e)=>{var n;t.alignment==="clap"?(n=ze([],[Gn(t.body,e)]),n=ze(["inner"],[n],e)):n=ze(["inner"],[Gn(t.body,e)]);var r=ze(["fix"],[]),i=ze([t.alignment],[n,r],e),s=ze(["strut"]);return s.style.height=qe(i.height+i.depth),i.depth&&(s.style.verticalAlign=qe(-i.depth)),i.children.unshift(s),i=ze(["thinbox"],[i],e),ze(["mord","vbox"],[i],e)},mathmlBuilder:(t,e)=>{var n=new Ve("mpadded",[_r(t.body,e)]);if(t.alignment!=="rlap"){var r=t.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}});ot({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){var{funcName:n,parser:r}=t,i=r.mode;r.switchMode("math");var s=n==="\\("?"\\)":"$",o=r.parseExpression(!1,s);return r.expect(s),r.switchMode(i),{type:"styling",mode:r.mode,style:"text",resetFont:!0,body:o}}});ot({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new Fe("Mismatched "+t.funcName)}});var voe=(t,e)=>{switch(e.style.size){case Ht.DISPLAY.size:return t.display;case Ht.TEXT.size:return t.text;case Ht.SCRIPT.size:return t.script;case Ht.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};ot({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:Oi(e[0]),text:Oi(e[1]),script:Oi(e[2]),scriptscript:Oi(e[3])}},htmlBuilder:(t,e)=>{var n=voe(t,e),r=Ji(n,e,!1);return Df(r)},mathmlBuilder:(t,e)=>{var n=voe(t,e);return o0(n,e)}});var T3e=(t,e,n,r,i,s,o)=>{t=ze([],[t]);var a=n&&Nf(n),l,c;if(e){var u=Gn(e,r.havingStyle(i.sup()),r);c={elem:u,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-u.depth)}}if(n){var d=Gn(n,r.havingStyle(i.sub()),r);l={elem:d,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-d.height)}}var h;if(c&&l){var f=r.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+t.depth+o;h=qn({positionType:"bottom",positionData:f,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:qe(-s)},{type:"kern",size:l.kern},{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:qe(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(l){var p=t.height-o;h=qn({positionType:"top",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:qe(-s)},{type:"kern",size:l.kern},{type:"elem",elem:t}]})}else if(c){var g=t.depth+o;h=qn({positionType:"bottom",positionData:g,children:[{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:qe(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else return t;var y=[h];if(l&&s!==0&&!a){var v=ze(["mspace"],[],r);v.style.marginRight=qe(s),y.unshift(v)}return ze(["mop","op-limits"],y,r)},A3e=new Set(["\\smallint"]),C2=(t,e)=>{var n,r,i=!1,s;t.type==="supsub"?(n=t.sup,r=t.sub,s=rn(t.base,"op"),i=!0):s=rn(t,"op");var o=e.style,a=!1;o.size===Ht.DISPLAY.size&&s.symbol&&!A3e.has(s.name)&&(a=!0);var l,c;if(s.symbol){var u=a?"Size2-Regular":"Size1-Regular",d="";if((s.name==="\\oiint"||s.name==="\\oiiint")&&(d=s.name.slice(1),s.name=d==="oiint"?"\\iint":"\\iiint"),l=So(s.name,u,"math",e,["mop","op-symbol",a?"large-op":"small-op"]),c=l.italic,d.length>0){var h=X5e(d+"Size"+(a?"2":"1"),e);l=qn({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:h,shift:a?.08:0}]}),s.name="\\"+d,l.classes.unshift("mop"),l.italic=c}}else if(s.body){var f=Ji(s.body,e,!0);f.length===1&&f[0]instanceof ll?(l=f[0],l.classes[0]="mop"):l=ze(["mop"],f,e)}else{for(var p=[],g=1;g<s.name.length;g++)p.push(LG(s.name[g],s.mode,e));l=ze(["mop"],p,e)}var y=0,v=0;if((l instanceof ll||s.name==="\\oiint"||s.name==="\\oiiint")&&!s.suppressBaseShift){var b;y=(l.height-l.depth)/2-e.fontMetrics().axisHeight,v=(b=l.italic)!=null?b:0}return i?T3e(l,n,r,e,o,v,y):(y&&(l.style.position="relative",l.style.top=qe(y)),l)},pC=(t,e)=>{var n;if(t.symbol)n=new Ve("mo",[tc(t.name,t.mode)]),A3e.has(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new Ve("mo",pl(t.body,e));else{n=new Ve("mi",[new Di(t.name.slice(1))]);var r=new Ve("mo",[tc("","text")]);t.parentIsSupSub?n=new Ve("mrow",[n,r]):n=e3e([n,r])}return n},pkt={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};ot({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=r;return i.length===1&&(i=pkt[i]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:C2,mathmlBuilder:pC});ot({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Oi(r)}},htmlBuilder:C2,mathmlBuilder:pC});var mkt={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};ot({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:C2,mathmlBuilder:pC});ot({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:C2,mathmlBuilder:pC});ot({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(t){var{parser:e,funcName:n}=t,r=n;return r.length===1&&(r=mkt[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:C2,mathmlBuilder:pC});var I3e=(t,e)=>{var n,r,i=!1,s;t.type==="supsub"?(n=t.sup,r=t.sub,s=rn(t.base,"operatorname"),i=!0):s=rn(t,"operatorname");var o;if(s.body.length>0){for(var a=s.body.map(d=>{var h="text"in d?d.text:void 0;return typeof h=="string"?{type:"textord",mode:d.mode,text:h}:d}),l=Ji(a,e.withFont("mathrm"),!0),c=0;c<l.length;c++){var u=l[c];u instanceof ll&&(u.text=u.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=ze(["mop"],l,e)}else o=ze(["mop"],[],e);return i?T3e(o,n,r,e,e.style,0,0):o},gkt=(t,e)=>{for(var n=pl(t.body,e.withFont("mathrm")),r=!0,i=0;i<n.length;i++){var s=n[i];if(!(s instanceof t3e))if(s instanceof Ve)switch(s.type){case"mi":case"mn":case"mspace":case"mtext":break;case"mo":{var o=s.children[0];s.children.length===1&&o instanceof Di?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){var a=n.map(u=>u.toText()).join("");n=[new Di(a)]}var l=new Ve("mi",n);l.setAttribute("mathvariant","normal");var c=new Ve("mo",[tc("","text")]);return t.parentIsSupSub?new Ve("mrow",[l,c]):e3e([l,c])};ot({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0];return{type:"operatorname",mode:n.mode,body:Oi(i),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:I3e,mathmlBuilder:gkt});F("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Py({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?Df(Ji(t.body,e,!1)):ze(["mord"],Ji(t.body,e,!0),e)},mathmlBuilder(t,e){return o0(t.body,e,!0)}});ot({type:"overline",names:["\\overline"],props:{numArgs:1},handler(t,e){var{parser:n}=t,r=e[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(t,e){var n=Gn(t.body,e.havingCrampedStyle()),r=wx("overline-line",e),i=e.fontMetrics().defaultRuleThickness,s=qn({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:r},{type:"kern",size:i}]});return ze(["mord","overline"],[s],e)},mathmlBuilder(t,e){var n=new Ve("mo",[new Di("‾")]);n.setAttribute("stretchy","true");var r=new Ve("mover",[_r(t.body,e),n]);return r.setAttribute("accent","true"),r}});ot({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"phantom",mode:n.mode,body:Oi(r)}},htmlBuilder:(t,e)=>{var n=Ji(t.body,e.withPhantom(),!1);return Df(n)},mathmlBuilder:(t,e)=>{var n=pl(t.body,e);return new Ve("mphantom",n)}});F("\\hphantom","\\smash{\\phantom{#1}}");ot({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=ze(["inner"],[Gn(t.body,e.withPhantom())]),r=ze(["fix"],[]);return ze(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=pl(Oi(t.body),e),r=new Ve("mphantom",n),i=new Ve("mpadded",[r]);return i.setAttribute("width","0px"),i}});ot({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=rn(e[0],"size").value,i=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:i}},htmlBuilder(t,e){var n=Gn(t.body,e),r=Xr(t.dy,e);return qn({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]})},mathmlBuilder(t,e){var n=new Ve("mpadded",[_r(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});ot({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});ot({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(t,e,n){var{parser:r}=t,i=n[0],s=rn(e[0],"size"),o=rn(e[1],"size");return{type:"rule",mode:r.mode,shift:i&&rn(i,"size").value,width:s.value,height:o.value}},htmlBuilder(t,e){var n=ze(["mord","rule"],[],e),r=Xr(t.width,e),i=Xr(t.height,e),s=t.shift?Xr(t.shift,e):0;return n.style.borderRightWidth=qe(r),n.style.borderTopWidth=qe(i),n.style.bottom=qe(s),n.width=r,n.height=i+s,n.depth=-s,n.maxFontSize=i*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=Xr(t.width,e),r=Xr(t.height,e),i=t.shift?Xr(t.shift,e):0,s=e.color&&e.getColor()||"black",o=new Ve("mspace");o.setAttribute("mathbackground",s),o.setAttribute("width",qe(n)),o.setAttribute("height",qe(r));var a=new Ve("mpadded",[o]);return i>=0?a.setAttribute("height",qe(i)):(a.setAttribute("height",qe(i)),a.setAttribute("depth",qe(-i))),a.setAttribute("voffset",qe(i)),a}});function R3e(t,e,n){for(var r=Ji(t,e,!1),i=e.sizeMultiplier/n.sizeMultiplier,s=0;s<r.length;s++){var o=r[s].classes.indexOf("sizing");o<0?Array.prototype.push.apply(r[s].classes,e.sizingClasses(n)):r[s].classes[o+1]==="reset-size"+e.size&&(r[s].classes[o+1]="reset-size"+n.size),r[s].height*=i,r[s].depth*=i}return Df(r)}var boe=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],ykt=(t,e)=>{var n=e.havingSize(t.size);return R3e(t.body,n,e)};ot({type:"sizing",names:boe,props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{breakOnTokenText:n,funcName:r,parser:i}=t,s=i.parseExpression(!1,n);return{type:"sizing",mode:i.mode,size:boe.indexOf(r)+1,body:s}},htmlBuilder:ykt,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=pl(t.body,n),i=new Ve("mstyle",r);return i.setAttribute("mathsize",qe(n.sizeMultiplier)),i}});ot({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,n)=>{var{parser:r}=t,i=!1,s=!1,o=n[0]&&rn(n[0],"ordgroup");if(o)for(var a,l=0;l<o.body.length;++l){var c=o.body[l];if(a=UR(c).text,a==="t")i=!0;else if(a==="b")s=!0;else{i=!1,s=!1;break}}else i=!0,s=!0;var u=e[0];return{type:"smash",mode:r.mode,body:u,smashHeight:i,smashDepth:s}},htmlBuilder:(t,e)=>{var n=ze([],[Gn(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return n;if(t.smashHeight&&(n.height=0),t.smashDepth&&(n.depth=0),t.smashHeight&&t.smashDepth)return ze(["mord","smash"],[n],e);if(n.children)for(var r=0;r<n.children.length;r++)t.smashHeight&&(n.children[r].height=0),t.smashDepth&&(n.children[r].depth=0);var i=qn({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return ze(["mord"],[i],e)},mathmlBuilder:(t,e)=>{var n=new Ve("mpadded",[_r(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});ot({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r}=t,i=n[0],s=e[0];return{type:"sqrt",mode:r.mode,body:s,index:i}},htmlBuilder(t,e){var n=Gn(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=xx(n,e);var r=e.fontMetrics(),i=r.defaultRuleThickness,s=i;e.style.id<Ht.TEXT.id&&(s=e.fontMetrics().xHeight);var o=i+s/4,a=n.height+n.depth+o+i,{span:l,ruleWidth:c,advanceWidth:u}=rkt(a,e),d=l.height-c;d>n.height+n.depth+o&&(o=(o+d-n.height-n.depth)/2);var h=l.height-n.height-o-c;n.style.paddingLeft=qe(u);var f=qn({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+h)},{type:"elem",elem:l},{type:"kern",size:c}]});if(t.index){var p=e.havingStyle(Ht.SCRIPTSCRIPT),g=Gn(t.index,p,e),y=.6*(f.height-f.depth),v=qn({positionType:"shift",positionData:-y,children:[{type:"elem",elem:g}]}),b=ze(["root"],[v]);return ze(["mord","sqrt"],[b,f],e)}else return ze(["mord","sqrt"],[f],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new Ve("mroot",[_r(n,e),_r(r,e)]):new Ve("msqrt",[_r(n,e)])}});var ZB={display:Ht.DISPLAY,text:Ht.TEXT,script:Ht.SCRIPT,scriptscript:Ht.SCRIPTSCRIPT};function vkt(t){return t in ZB}ot({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t,e){var{breakOnTokenText:n,funcName:r,parser:i}=t,s=i.parseExpression(!0,n),o=r.slice(1,r.length-5);if(!vkt(o))throw new Error("Unknown style: "+o);return{type:"styling",mode:i.mode,style:o,body:s}},htmlBuilder(t,e){var n=ZB[t.style],r=e.havingStyle(n);return t.resetFont&&(r=r.withFont("")),R3e(t.body,r,e)},mathmlBuilder(t,e){var n=ZB[t.style],r=e.havingStyle(n);t.resetFont&&(r=r.withFont(""));var i=pl(t.body,r),s=new Ve("mstyle",i),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},a=o[t.style];return s.setAttribute("scriptlevel",a[0]),s.setAttribute("displaystyle",a[1]),s}});var bkt=function(e,n){var r=e.base;if(r)if(r.type==="op"){var i=r.limits&&(n.style.size===Ht.DISPLAY.size||r.alwaysHandleSupSub);return i?C2:null}else if(r.type==="operatorname"){var s=r.alwaysHandleSupSub&&(n.style.size===Ht.DISPLAY.size||r.limits);return s?I3e:null}else{if(r.type==="accent")return Nf(r.base)?FG:null;if(r.type==="horizBrace"){var o=!e.sub;return o===r.isOver?E3e:null}else return null}else return null};Py({type:"supsub",htmlBuilder(t,e){var n=bkt(t,e);if(n)return n(t,e);var{base:r,sup:i,sub:s}=t,o=Gn(r,e),a,l,c=e.fontMetrics(),u=0,d=0,h=r&&Nf(r);if(i){var f=e.havingStyle(e.style.sup());a=Gn(i,f,e),h||(u=o.height-f.fontMetrics().supDrop*f.sizeMultiplier/e.sizeMultiplier)}if(s){var p=e.havingStyle(e.style.sub());l=Gn(s,p,e),h||(d=o.depth+p.fontMetrics().subDrop*p.sizeMultiplier/e.sizeMultiplier)}var g;e.style===Ht.DISPLAY?g=c.sup1:e.style.cramped?g=c.sup3:g=c.sup2;var y=e.sizeMultiplier,v=qe(.5/c.ptPerEm/y),b=null;if(l){var _=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");if(o instanceof ll||_){var S;b=qe(-((S=o.italic)!=null?S:0))}}var k;if(a&&l){u=Math.max(u,g,a.depth+.25*c.xHeight),d=Math.max(d,c.sub2);var T=c.defaultRuleThickness,E=4*T;if(u-a.depth-(l.height-d)<E){d=E-(u-a.depth)+l.height;var C=.8*c.xHeight-(u-a.depth);C>0&&(u+=C,d-=C)}var R=[{type:"elem",elem:l,shift:d,marginRight:v,marginLeft:b},{type:"elem",elem:a,shift:-u,marginRight:v}];k=qn({positionType:"individualShift",children:R})}else if(l){d=Math.max(d,c.sub1,l.height-.8*c.xHeight);var M=[{type:"elem",elem:l,marginLeft:b,marginRight:v}];k=qn({positionType:"shift",positionData:d,children:M})}else if(a)u=Math.max(u,g,a.depth+.25*c.xHeight),k=qn({positionType:"shift",positionData:-u,children:[{type:"elem",elem:a,marginRight:v}]});else throw new Error("supsub must have either sup or sub.");var D=qB(o,"right")||"mord";return ze([D],[o,ze(["msupsub"],[k])],e)},mathmlBuilder(t,e){var n=!1,r,i;t.base&&t.base.type==="horizBrace"&&(i=!!t.sup,i===t.base.isOver&&(n=!0,r=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var s=[_r(t.base,e)];t.sub&&s.push(_r(t.sub,e)),t.sup&&s.push(_r(t.sup,e));var o;if(n)o=r?"mover":"munder";else if(t.sub)if(t.sup){var c=t.base;c&&c.type==="op"&&c.limits&&e.style===Ht.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(e.style===Ht.DISPLAY||c.limits)?o="munderover":o="msubsup"}else{var l=t.base;l&&l.type==="op"&&l.limits&&(e.style===Ht.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===Ht.DISPLAY)?o="munder":o="msub"}else{var a=t.base;a&&a.type==="op"&&a.limits&&(e.style===Ht.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||e.style===Ht.DISPLAY)?o="mover":o="msup"}return new Ve(o,s)}});Py({type:"atom",htmlBuilder(t,e){return LG(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new Ve("mo",[tc(t.text,t.mode)]);if(t.family==="bin"){var r=BG(t,e);r==="bold-italic"&&n.setAttribute("mathvariant",r)}else t.family==="punct"?n.setAttribute("separator","true"):(t.family==="open"||t.family==="close")&&n.setAttribute("stretchy","false");return n}});var M3e={mi:"italic",mn:"normal",mtext:"normal"};Py({type:"mathord",htmlBuilder(t,e){return VR(t,e,"mathord")},mathmlBuilder(t,e){var n=new Ve("mi",[tc(t.text,t.mode,e)]),r=BG(t,e)||"italic";return r!==M3e[n.type]&&n.setAttribute("mathvariant",r),n}});Py({type:"textord",htmlBuilder(t,e){return VR(t,e,"textord")},mathmlBuilder(t,e){var n=tc(t.text,t.mode,e),r=BG(t,e)||"normal",i;return t.mode==="text"?i=new Ve("mtext",[n]):/[0-9]/.test(t.text)?i=new Ve("mn",[n]):t.text==="\\prime"?i=new Ve("mo",[n]):i=new Ve("mi",[n]),r!==M3e[i.type]&&i.setAttribute("mathvariant",r),i}});var zD={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},jD={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Py({type:"spacing",htmlBuilder(t,e){if(jD.hasOwnProperty(t.text)){var n=jD[t.text].className||"";if(t.mode==="text"){var r=VR(t,e,"textord");return r.classes.push(n),r}else return ze(["mspace",n],[LG(t.text,t.mode,e)],e)}else{if(zD.hasOwnProperty(t.text))return ze(["mspace",zD[t.text]],[],e);throw new Fe('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(jD.hasOwnProperty(t.text))n=new Ve("mtext",[new Di(" ")]);else{if(zD.hasOwnProperty(t.text))return new Ve("mspace");throw new Fe('Unknown type of space "'+t.text+'"')}return n}});var woe=()=>{var t=new Ve("mtd",[]);return t.setAttribute("width","50%"),t};Py({type:"tag",mathmlBuilder(t,e){var n=new Ve("mtable",[new Ve("mtr",[woe(),new Ve("mtd",[o0(t.body,e)]),woe(),new Ve("mtd",[o0(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var xoe={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},_oe={"\\textbf":"textbf","\\textmd":"textmd"},wkt={"\\textit":"textit","\\textup":"textup"},Soe=(t,e)=>{var n=t.font;if(n){if(xoe[n])return e.withTextFontFamily(xoe[n]);if(_oe[n])return e.withTextFontWeight(_oe[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(wkt[n])};ot({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,i=e[0];return{type:"text",mode:n.mode,body:Oi(i),font:r}},htmlBuilder(t,e){var n=Soe(t,e),r=Ji(t.body,n,!0);return ze(["mord","text"],r,n)},mathmlBuilder(t,e){var n=Soe(t,e);return o0(t.body,n)}});ot({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"underline",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=Gn(t.body,e),r=wx("underline-line",e),i=e.fontMetrics().defaultRuleThickness,s=qn({positionType:"top",positionData:n.height,children:[{type:"kern",size:i},{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:n}]});return ze(["mord","underline"],[s],e)},mathmlBuilder(t,e){var n=new Ve("mo",[new Di("‾")]);n.setAttribute("stretchy","true");var r=new Ve("munder",[_r(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});ot({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"vcenter",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=Gn(t.body,e),r=e.fontMetrics().axisHeight,i=.5*(n.height-r-(n.depth+r));return qn({positionType:"shift",positionData:i,children:[{type:"elem",elem:n}]})},mathmlBuilder(t,e){var n=new Ve("mpadded",[_r(t.body,e)],["vcenter"]);return new Ve("mrow",[n])}});ot({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new Fe("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=koe(t),r=[],i=e.havingStyle(e.style.text()),s=0;s<n.length;s++){var o=n[s];o==="~"&&(o="\\textasciitilde"),r.push(So(o,"Typewriter-Regular",t.mode,i,["mord","texttt"]))}return ze(["mord","text"].concat(i.sizingClasses(e)),K5e(r),i)},mathmlBuilder(t,e){var n=new Di(koe(t)),r=new Ve("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var koe=t=>t.body.replace(/ /g,t.star?"␣":" "),sm=Q5e,N3e=`[ \r
|
||
]`,xkt="\\\\[a-zA-Z@]+",_kt="\\\\[^\uD800-\uDFFF]",Skt="("+xkt+")"+N3e+"*",kkt=`\\\\(
|
||
|[ \r ]+
|
||
?)[ \r ]*`,XB="[̀-ͯ]",Ckt=new RegExp(XB+"+$"),Ekt="("+N3e+"+)|"+(kkt+"|")+"([!-\\[\\]-‧-豈-]"+(XB+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(XB+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+Skt)+("|"+_kt+")");class Coe{constructor(e,n){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=n,this.tokenRegex=new RegExp(Ekt,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,n){this.catcodes[e]=n}lex(){var e=this.input,n=this.tokenRegex.lastIndex;if(n===e.length)return new nl("EOF",new sa(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new Fe("Unexpected character: '"+e[n]+"'",new nl(e[n],new sa(this,n,n+1)));var i=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[i]===14){var s=e.indexOf(`
|
||
`,this.tokenRegex.lastIndex);return s===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=s+1,this.lex()}return new nl(i,new sa(this,n,this.tokenRegex.lastIndex))}}class Tkt{constructor(e,n){e===void 0&&(e={}),n===void 0&&(n={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=n,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new Fe("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var n in e)e.hasOwnProperty(n)&&(e[n]==null?delete this.current[n]:this.current[n]=e[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,n,r){if(r===void 0&&(r=!1),r){for(var i=0;i<this.undefStack.length;i++)delete this.undefStack[i][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=n)}else{var s=this.undefStack[this.undefStack.length-1];s&&!s.hasOwnProperty(e)&&(s[e]=this.current[e])}n==null?delete this.current[e]:this.current[e]=n}}var Akt=x3e;F("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});F("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});F("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});F("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});F("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var n=t.future();return e[0].length===1&&e[0][0].text===n.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});F("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");F("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var Eoe={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};F("\\char",function(t){var e=t.popToken(),n,r=0;if(e.text==="'")n=8,e=t.popToken();else if(e.text==='"')n=16,e=t.popToken();else if(e.text==="`")if(e=t.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new Fe("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=Eoe[e.text],r==null||r>=n)throw new Fe("Invalid base-"+n+" digit "+e.text);for(var i;(i=Eoe[t.future().text])!=null&&i<n;)r*=n,r+=i,t.popToken()}return"\\@char{"+r+"}"});var UG=(t,e,n,r)=>{var i=t.consumeArg().tokens;if(i.length!==1)throw new Fe("\\newcommand's first argument must be a macro name");var s=i[0].text,o=t.isDefined(s);if(o&&!e)throw new Fe("\\newcommand{"+s+"} attempting to redefine "+(s+"; use \\renewcommand"));if(!o&&!n)throw new Fe("\\renewcommand{"+s+"} when command "+s+" does not yet exist; use \\newcommand");var a=0;if(i=t.consumeArg().tokens,i.length===1&&i[0].text==="["){for(var l="",c=t.expandNextToken();c.text!=="]"&&c.text!=="EOF";)l+=c.text,c=t.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new Fe("Invalid number of arguments: "+l);a=parseInt(l),i=t.consumeArg().tokens}return o&&r||t.macros.set(s,{tokens:i,numArgs:a}),""};F("\\newcommand",t=>UG(t,!1,!0,!1));F("\\renewcommand",t=>UG(t,!0,!1,!1));F("\\providecommand",t=>UG(t,!0,!0,!0));F("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});F("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});F("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),sm[n],$r.math[n],$r.text[n]),""});F("\\bgroup","{");F("\\egroup","}");F("~","\\nobreakspace");F("\\lq","`");F("\\rq","'");F("\\aa","\\r a");F("\\AA","\\r A");F("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");F("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");F("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");F("ℬ","\\mathscr{B}");F("ℰ","\\mathscr{E}");F("ℱ","\\mathscr{F}");F("ℋ","\\mathscr{H}");F("ℐ","\\mathscr{I}");F("ℒ","\\mathscr{L}");F("ℳ","\\mathscr{M}");F("ℛ","\\mathscr{R}");F("ℭ","\\mathfrak{C}");F("ℌ","\\mathfrak{H}");F("ℨ","\\mathfrak{Z}");F("\\Bbbk","\\Bbb{k}");F("\\llap","\\mathllap{\\textrm{#1}}");F("\\rlap","\\mathrlap{\\textrm{#1}}");F("\\clap","\\mathclap{\\textrm{#1}}");F("\\mathstrut","\\vphantom{(}");F("\\underbar","\\underline{\\text{#1}}");F("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');F("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");F("\\ne","\\neq");F("≠","\\neq");F("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");F("∉","\\notin");F("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");F("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");F("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");F("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");F("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");F("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");F("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");F("⟂","\\perp");F("‼","\\mathclose{!\\mkern-0.8mu!}");F("∌","\\notni");F("⌜","\\ulcorner");F("⌝","\\urcorner");F("⌞","\\llcorner");F("⌟","\\lrcorner");F("©","\\copyright");F("®","\\textregistered");F("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');F("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');F("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');F("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');F("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");F("⋮","\\vdots");F("\\varGamma","\\mathit{\\Gamma}");F("\\varDelta","\\mathit{\\Delta}");F("\\varTheta","\\mathit{\\Theta}");F("\\varLambda","\\mathit{\\Lambda}");F("\\varXi","\\mathit{\\Xi}");F("\\varPi","\\mathit{\\Pi}");F("\\varSigma","\\mathit{\\Sigma}");F("\\varUpsilon","\\mathit{\\Upsilon}");F("\\varPhi","\\mathit{\\Phi}");F("\\varPsi","\\mathit{\\Psi}");F("\\varOmega","\\mathit{\\Omega}");F("\\substack","\\begin{subarray}{c}#1\\end{subarray}");F("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");F("\\boxed","\\fbox{$\\displaystyle{#1}$}");F("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");F("\\implies","\\DOTSB\\;\\Longrightarrow\\;");F("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");F("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");F("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var Toe={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},Ikt=new Set(["bin","rel"]);F("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in Toe?e=Toe[n]:(n.slice(0,4)==="\\not"||n in $r.math&&Ikt.has($r.math[n].group))&&(e="\\dotsb"),e});var qG={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};F("\\dotso",function(t){var e=t.future().text;return e in qG?"\\ldots\\,":"\\ldots"});F("\\dotsc",function(t){var e=t.future().text;return e in qG&&e!==","?"\\ldots\\,":"\\ldots"});F("\\cdots",function(t){var e=t.future().text;return e in qG?"\\@cdots\\,":"\\@cdots"});F("\\dotsb","\\cdots");F("\\dotsm","\\cdots");F("\\dotsi","\\!\\cdots");F("\\dotsx","\\ldots\\,");F("\\DOTSI","\\relax");F("\\DOTSB","\\relax");F("\\DOTSX","\\relax");F("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");F("\\,","\\tmspace+{3mu}{.1667em}");F("\\thinspace","\\,");F("\\>","\\mskip{4mu}");F("\\:","\\tmspace+{4mu}{.2222em}");F("\\medspace","\\:");F("\\;","\\tmspace+{5mu}{.2777em}");F("\\thickspace","\\;");F("\\!","\\tmspace-{3mu}{.1667em}");F("\\negthinspace","\\!");F("\\negmedspace","\\tmspace-{4mu}{.2222em}");F("\\negthickspace","\\tmspace-{5mu}{.277em}");F("\\enspace","\\kern.5em ");F("\\enskip","\\hskip.5em\\relax");F("\\quad","\\hskip1em\\relax");F("\\qquad","\\hskip2em\\relax");F("\\tag","\\@ifstar\\tag@literal\\tag@paren");F("\\tag@paren","\\tag@literal{({#1})}");F("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new Fe("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});F("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");F("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");F("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");F("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");F("\\newline","\\\\\\relax");F("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var O3e=qe(td["Main-Regular"][84][1]-.7*td["Main-Regular"][65][1]);F("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+O3e+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");F("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+O3e+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");F("\\hspace","\\@ifstar\\@hspacer\\@hspace");F("\\@hspace","\\hskip #1\\relax");F("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");F("\\ordinarycolon",":");F("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");F("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');F("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');F("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');F("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');F("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');F("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');F("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');F("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');F("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');F("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');F("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');F("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');F("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');F("∷","\\dblcolon");F("∹","\\eqcolon");F("≔","\\coloneqq");F("≕","\\eqqcolon");F("⩴","\\Coloneqq");F("\\ratio","\\vcentcolon");F("\\coloncolon","\\dblcolon");F("\\colonequals","\\coloneqq");F("\\coloncolonequals","\\Coloneqq");F("\\equalscolon","\\eqqcolon");F("\\equalscoloncolon","\\Eqqcolon");F("\\colonminus","\\coloneq");F("\\coloncolonminus","\\Coloneq");F("\\minuscolon","\\eqcolon");F("\\minuscoloncolon","\\Eqcolon");F("\\coloncolonapprox","\\Colonapprox");F("\\coloncolonsim","\\Colonsim");F("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");F("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");F("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");F("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");F("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");F("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");F("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");F("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");F("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");F("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");F("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");F("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");F("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");F("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");F("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");F("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");F("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");F("\\nleqq","\\html@mathml{\\@nleqq}{≰}");F("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");F("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");F("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");F("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");F("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");F("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");F("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");F("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");F("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");F("\\imath","\\html@mathml{\\@imath}{ı}");F("\\jmath","\\html@mathml{\\@jmath}{ȷ}");F("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");F("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");F("⟦","\\llbracket");F("⟧","\\rrbracket");F("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");F("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");F("⦃","\\lBrace");F("⦄","\\rBrace");F("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");F("⦵","\\minuso");F("\\darr","\\downarrow");F("\\dArr","\\Downarrow");F("\\Darr","\\Downarrow");F("\\lang","\\langle");F("\\rang","\\rangle");F("\\uarr","\\uparrow");F("\\uArr","\\Uparrow");F("\\Uarr","\\Uparrow");F("\\N","\\mathbb{N}");F("\\R","\\mathbb{R}");F("\\Z","\\mathbb{Z}");F("\\alef","\\aleph");F("\\alefsym","\\aleph");F("\\Alpha","\\mathrm{A}");F("\\Beta","\\mathrm{B}");F("\\bull","\\bullet");F("\\Chi","\\mathrm{X}");F("\\clubs","\\clubsuit");F("\\cnums","\\mathbb{C}");F("\\Complex","\\mathbb{C}");F("\\Dagger","\\ddagger");F("\\diamonds","\\diamondsuit");F("\\empty","\\emptyset");F("\\Epsilon","\\mathrm{E}");F("\\Eta","\\mathrm{H}");F("\\exist","\\exists");F("\\harr","\\leftrightarrow");F("\\hArr","\\Leftrightarrow");F("\\Harr","\\Leftrightarrow");F("\\hearts","\\heartsuit");F("\\image","\\Im");F("\\infin","\\infty");F("\\Iota","\\mathrm{I}");F("\\isin","\\in");F("\\Kappa","\\mathrm{K}");F("\\larr","\\leftarrow");F("\\lArr","\\Leftarrow");F("\\Larr","\\Leftarrow");F("\\lrarr","\\leftrightarrow");F("\\lrArr","\\Leftrightarrow");F("\\Lrarr","\\Leftrightarrow");F("\\Mu","\\mathrm{M}");F("\\natnums","\\mathbb{N}");F("\\Nu","\\mathrm{N}");F("\\Omicron","\\mathrm{O}");F("\\plusmn","\\pm");F("\\rarr","\\rightarrow");F("\\rArr","\\Rightarrow");F("\\Rarr","\\Rightarrow");F("\\real","\\Re");F("\\reals","\\mathbb{R}");F("\\Reals","\\mathbb{R}");F("\\Rho","\\mathrm{P}");F("\\sdot","\\cdot");F("\\sect","\\S");F("\\spades","\\spadesuit");F("\\sub","\\subset");F("\\sube","\\subseteq");F("\\supe","\\supseteq");F("\\Tau","\\mathrm{T}");F("\\thetasym","\\vartheta");F("\\weierp","\\wp");F("\\Zeta","\\mathrm{Z}");F("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");F("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");F("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");F("\\bra","\\mathinner{\\langle{#1}|}");F("\\ket","\\mathinner{|{#1}\\rangle}");F("\\braket","\\mathinner{\\langle{#1}\\rangle}");F("\\Bra","\\left\\langle#1\\right|");F("\\Ket","\\left|#1\\right\\rangle");var D3e=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,i=e.consumeArg().tokens,s=e.consumeArg().tokens,o=e.macros.get("|"),a=e.macros.get("\\|");e.macros.beginGroup();var l=d=>h=>{t&&(h.macros.set("|",o),i.length&&h.macros.set("\\|",a));var f=d;if(!d&&i.length){var p=h.future();p.text==="|"&&(h.popToken(),f=!0)}return{tokens:f?i:r,numArgs:0}};e.macros.set("|",l(!1)),i.length&&e.macros.set("\\|",l(!0));var c=e.consumeArg().tokens,u=e.expandTokens([...s,...c,...n]);return e.macros.endGroup(),{tokens:u.reverse(),numArgs:0}};F("\\bra@ket",D3e(!1));F("\\bra@set",D3e(!0));F("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");F("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");F("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");F("\\angln","{\\angl n}");F("\\blue","\\textcolor{##6495ed}{#1}");F("\\orange","\\textcolor{##ffa500}{#1}");F("\\pink","\\textcolor{##ff00af}{#1}");F("\\red","\\textcolor{##df0030}{#1}");F("\\green","\\textcolor{##28ae7b}{#1}");F("\\gray","\\textcolor{gray}{#1}");F("\\purple","\\textcolor{##9d38bd}{#1}");F("\\blueA","\\textcolor{##ccfaff}{#1}");F("\\blueB","\\textcolor{##80f6ff}{#1}");F("\\blueC","\\textcolor{##63d9ea}{#1}");F("\\blueD","\\textcolor{##11accd}{#1}");F("\\blueE","\\textcolor{##0c7f99}{#1}");F("\\tealA","\\textcolor{##94fff5}{#1}");F("\\tealB","\\textcolor{##26edd5}{#1}");F("\\tealC","\\textcolor{##01d1c1}{#1}");F("\\tealD","\\textcolor{##01a995}{#1}");F("\\tealE","\\textcolor{##208170}{#1}");F("\\greenA","\\textcolor{##b6ffb0}{#1}");F("\\greenB","\\textcolor{##8af281}{#1}");F("\\greenC","\\textcolor{##74cf70}{#1}");F("\\greenD","\\textcolor{##1fab54}{#1}");F("\\greenE","\\textcolor{##0d923f}{#1}");F("\\goldA","\\textcolor{##ffd0a9}{#1}");F("\\goldB","\\textcolor{##ffbb71}{#1}");F("\\goldC","\\textcolor{##ff9c39}{#1}");F("\\goldD","\\textcolor{##e07d10}{#1}");F("\\goldE","\\textcolor{##a75a05}{#1}");F("\\redA","\\textcolor{##fca9a9}{#1}");F("\\redB","\\textcolor{##ff8482}{#1}");F("\\redC","\\textcolor{##f9685d}{#1}");F("\\redD","\\textcolor{##e84d39}{#1}");F("\\redE","\\textcolor{##bc2612}{#1}");F("\\maroonA","\\textcolor{##ffbde0}{#1}");F("\\maroonB","\\textcolor{##ff92c6}{#1}");F("\\maroonC","\\textcolor{##ed5fa6}{#1}");F("\\maroonD","\\textcolor{##ca337c}{#1}");F("\\maroonE","\\textcolor{##9e034e}{#1}");F("\\purpleA","\\textcolor{##ddd7ff}{#1}");F("\\purpleB","\\textcolor{##c6b9fc}{#1}");F("\\purpleC","\\textcolor{##aa87ff}{#1}");F("\\purpleD","\\textcolor{##7854ab}{#1}");F("\\purpleE","\\textcolor{##543b78}{#1}");F("\\mintA","\\textcolor{##f5f9e8}{#1}");F("\\mintB","\\textcolor{##edf2df}{#1}");F("\\mintC","\\textcolor{##e0e5cc}{#1}");F("\\grayA","\\textcolor{##f6f7f7}{#1}");F("\\grayB","\\textcolor{##f0f1f2}{#1}");F("\\grayC","\\textcolor{##e3e5e6}{#1}");F("\\grayD","\\textcolor{##d6d8da}{#1}");F("\\grayE","\\textcolor{##babec2}{#1}");F("\\grayF","\\textcolor{##888d93}{#1}");F("\\grayG","\\textcolor{##626569}{#1}");F("\\grayH","\\textcolor{##3b3e40}{#1}");F("\\grayI","\\textcolor{##21242c}{#1}");F("\\kaBlue","\\textcolor{##314453}{#1}");F("\\kaGreen","\\textcolor{##71B307}{#1}");var P3e={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Rkt{constructor(e,n,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=n,this.expansionCount=0,this.feed(e),this.macros=new Tkt(Akt,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new Coe(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var n,r,i;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:i,end:r}=this.consumeArg(["]"])}else({tokens:i,start:n,end:r}=this.consumeArg());return this.pushToken(new nl("EOF",r.loc)),this.pushTokens(i),new nl("",sa.range(n,r))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var n=[],r=e&&e.length>0;r||this.consumeSpaces();var i=this.future(),s,o=0,a=0;do{if(s=this.popToken(),n.push(s),s.text==="{")++o;else if(s.text==="}"){if(--o,o===-1)throw new Fe("Extra }",s)}else if(s.text==="EOF")throw new Fe("Unexpected end of input in a macro argument, expected '"+(e&&r?e[a]:"}")+"'",s);if(e&&r)if((o===0||o===1&&e[a]==="{")&&s.text===e[a]){if(++a,a===e.length){n.splice(-a,a);break}}else a=0}while(o!==0||r);return i.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:i,end:s}}consumeArgs(e,n){if(n){if(n.length!==e+1)throw new Fe("The length of delimiters doesn't match the number of args!");for(var r=n[0],i=0;i<r.length;i++){var s=this.popToken();if(r[i]!==s.text)throw new Fe("Use of the macro doesn't match its definition",s)}}for(var o=[],a=0;a<e;a++)o.push(this.consumeArg(n&&n[a+1]).tokens);return o}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new Fe("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var n=this.popToken(),r=n.text,i=n.noexpand?null:this._getExpansion(r);if(i==null||e&&i.unexpandable){if(e&&i==null&&r[0]==="\\"&&!this.isDefined(r))throw new Fe("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var s=i.tokens,o=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){s=s.slice();for(var a=s.length-1;a>=0;--a){var l=s[a];if(l.text==="#"){if(a===0)throw new Fe("Incomplete placeholder at end of macro body",l);if(l=s[--a],l.text==="#")s.splice(a+1,1);else if(/^[1-9]$/.test(l.text))s.splice(a,2,...o[+l.text-1]);else throw new Fe("Not a valid argument number",l)}}}return this.pushTokens(s),s.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}}expandMacro(e){return this.macros.has(e)?this.expandTokens([new nl(e)]):void 0}expandTokens(e){var n=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),n.push(i)}return this.countExpansion(n.length),n}expandMacroAsText(e){var n=this.expandMacro(e);return n&&n.map(r=>r.text).join("")}_getExpansion(e){var n=this.macros.get(e);if(n==null)return n;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var i=typeof n=="function"?n(this):n;if(typeof i=="string"){var s=0;if(i.includes("#"))for(var o=i.replace(/##/g,"");o.includes("#"+(s+1));)++s;for(var a=new Coe(i,this.settings),l=[],c=a.lex();c.text!=="EOF";)l.push(c),c=a.lex();l.reverse();var u={tokens:l,numArgs:s};return u}return i}isDefined(e){return this.macros.has(e)||sm.hasOwnProperty(e)||$r.math.hasOwnProperty(e)||$r.text.hasOwnProperty(e)||P3e.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:sm.hasOwnProperty(e)&&!sm[e].primitive}}var Aoe=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,uT=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),BD={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},Ioe={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class XR{constructor(e,n){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new Rkt(e,n,this.mode),this.settings=n,this.leftrightDepth=0,this.nextToken=null}expect(e,n){if(n===void 0&&(n=!0),this.fetch().text!==e)throw new Fe("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var n=this.nextToken;this.consume(),this.gullet.pushToken(new nl("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,r}parseExpression(e,n){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(XR.endOfExpression.has(i.text)||n&&i.text===n||e&&sm[i.text]&&sm[i.text].infix)break;var s=this.parseAtom(n);if(s){if(s.type==="internal")continue}else break;r.push(s)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var n=-1,r,i=0;i<e.length;i++){var s=e[i];if(s.type==="infix"){if(n!==-1)throw new Fe("only one infix operator per group",s.token);n=i,r=s.replaceWith}}if(n!==-1&&r){var o,a,l=e.slice(0,n),c=e.slice(n+1);l.length===1&&l[0].type==="ordgroup"?o=l[0]:o={type:"ordgroup",mode:this.mode,body:l},c.length===1&&c[0].type==="ordgroup"?a=c[0]:a={type:"ordgroup",mode:this.mode,body:c};var u;return r==="\\\\abovefrac"?u=this.callFunction(r,[o,e[n],a],[]):u=this.callFunction(r,[o,a],[]),[u]}else return e}handleSupSubscript(e){var n=this.fetch(),r=n.text;this.consume(),this.consumeSpaces();var i;do{var s;i=this.parseGroup(e)}while(((s=i)==null?void 0:s.type)==="internal");if(!i)throw new Fe("Expected group after '"+r+"'",n);return i}formatUnsupportedCmd(e){for(var n=[],r=0;r<e.length;r++)n.push({type:"textord",mode:"text",text:e[r]});var i={type:"text",mode:this.mode,body:n},s={type:"color",mode:this.mode,color:this.settings.errorColor,body:[i]};return s}parseAtom(e){var n=this.parseGroup("atom",e);if((n==null?void 0:n.type)==="internal"||this.mode==="text")return n;for(var r,i;;){this.consumeSpaces();var s=this.fetch();if(s.text==="\\limits"||s.text==="\\nolimits"){if(n&&n.type==="op"){var o=s.text==="\\limits";n.limits=o,n.alwaysHandleSupSub=!0}else if(n&&n.type==="operatorname")n.alwaysHandleSupSub&&(n.limits=s.text==="\\limits");else throw new Fe("Limit controls must follow a math operator",s);this.consume()}else if(s.text==="^"){if(r)throw new Fe("Double superscript",s);r=this.handleSupSubscript("superscript")}else if(s.text==="_"){if(i)throw new Fe("Double subscript",s);i=this.handleSupSubscript("subscript")}else if(s.text==="'"){if(r)throw new Fe("Double superscript",s);var a={type:"textord",mode:this.mode,text:"\\prime"},l=[a];for(this.consume();this.fetch().text==="'";)l.push(a),this.consume();this.fetch().text==="^"&&l.push(this.handleSupSubscript("superscript")),r={type:"ordgroup",mode:this.mode,body:l}}else if(uT[s.text]){var c=Aoe.test(s.text),u=[];for(u.push(new nl(uT[s.text])),this.consume();;){var d=this.fetch().text;if(!uT[d]||Aoe.test(d)!==c)break;u.unshift(new nl(uT[d])),this.consume()}var h=this.subparse(u);c?i={type:"ordgroup",mode:"math",body:h}:r={type:"ordgroup",mode:"math",body:h}}else break}return r||i?{type:"supsub",mode:this.mode,base:n,sup:r,sub:i}:n}parseFunction(e,n){var r=this.fetch(),i=r.text,s=sm[i];if(!s)return null;if(this.consume(),n&&n!=="atom"&&!s.allowedInArgument)throw new Fe("Got function '"+i+"' with no arguments"+(n?" as "+n:""),r);if(this.mode==="text"&&!s.allowedInText)throw new Fe("Can't use function '"+i+"' in text mode",r);if(this.mode==="math"&&s.allowedInMath===!1)throw new Fe("Can't use function '"+i+"' in math mode",r);var{args:o,optArgs:a}=this.parseArguments(i,s);return this.callFunction(i,o,a,r,e)}callFunction(e,n,r,i,s){var o={funcName:e,parser:this,token:i,breakOnTokenText:s},a=sm[e];if(a&&a.handler)return a.handler(o,n,r);throw new Fe("No function handler for "+e)}parseArguments(e,n){var r=n.numArgs+n.numOptionalArgs;if(r===0)return{args:[],optArgs:[]};for(var i=[],s=[],o=0;o<r;o++){var a=n.argTypes&&n.argTypes[o],l=o<n.numOptionalArgs;("primitive"in n&&n.primitive&&a==null||n.type==="sqrt"&&o===1&&s[0]==null)&&(a="primitive");var c=this.parseGroupOfType("argument to '"+e+"'",a,l);if(l)s.push(c);else if(c!=null)i.push(c);else throw new Fe("Null argument, please report this as a bug")}return{args:i,optArgs:s}}parseGroupOfType(e,n,r){switch(n){case"color":return this.parseColorGroup(r);case"size":return this.parseSizeGroup(r);case"url":return this.parseUrlGroup(r);case"math":case"text":return this.parseArgumentGroup(r,n);case"hbox":{var i=this.parseArgumentGroup(r,"text");return i!=null?{type:"styling",mode:i.mode,body:[i],style:"text",resetFont:!0}:null}case"raw":{var s=this.parseStringGroup("raw",r);return s!=null?{type:"raw",mode:"text",string:s.text}:null}case"primitive":{if(r)throw new Fe("A primitive argument cannot be optional");var o=this.parseGroup(e);if(o==null)throw new Fe("Expected group as "+e,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new Fe("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(e,n){var r=this.gullet.scanArgument(n);if(r==null)return null;for(var i="",s;(s=this.fetch()).text!=="EOF";)i+=s.text,this.consume();return this.consume(),r.text=i,r}parseRegexGroup(e,n){for(var r=this.fetch(),i=r,s="",o;(o=this.fetch()).text!=="EOF"&&e.test(s+o.text);)i=o,s+=i.text,this.consume();if(s==="")throw new Fe("Invalid "+n+": '"+r.text+"'",r);return r.range(i,s)}parseColorGroup(e){var n=this.parseStringGroup("color",e);if(n==null)return null;var r=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(n.text);if(!r)throw new Fe("Invalid color: '"+n.text+"'",n);var i=r[0];return/^[0-9a-f]{6}$/i.test(i)&&(i="#"+i),{type:"color-token",mode:this.mode,color:i}}parseSizeGroup(e){var n,r=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?n=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):n=this.parseStringGroup("size",e),!n)return null;!e&&n.text.length===0&&(n.text="0pt",r=!0);var i=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(n.text);if(!i)throw new Fe("Invalid size: '"+n.text+"'",n);var s={number:+(i[1]+i[2]),unit:i[3]};if(!H5e(s))throw new Fe("Invalid unit: '"+s.unit+"'",n);return{type:"size",mode:this.mode,value:s,isBlank:r}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var n=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),n==null)return null;var r=n.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:r}}parseArgumentGroup(e,n){var r=this.gullet.scanArgument(e);if(r==null)return null;var i=this.mode;n&&this.switchMode(n),this.gullet.beginGroup();var s=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:r.loc,body:s};return n&&this.switchMode(i),o}parseGroup(e,n){var r=this.fetch(),i=r.text,s;if(i==="{"||i==="\\begingroup"){this.consume();var o=i==="{"?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,o),l=this.fetch();this.expect(o),this.gullet.endGroup(),s={type:"ordgroup",mode:this.mode,loc:sa.range(r,l),body:a,semisimple:i==="\\begingroup"||void 0}}else if(s=this.parseFunction(n,e)||this.parseSymbol(),s==null&&i[0]==="\\"&&!P3e.hasOwnProperty(i)){if(this.settings.throwOnError)throw new Fe("Undefined control sequence: "+i,r);s=this.formatUnsupportedCmd(i),this.consume()}return s}formLigatures(e){for(var n=e.length-1,r=0;r<n;++r){var i=e[r];if(i.type==="textord"){var s=i.text,o=e[r+1];if(!(!o||o.type!=="textord")){if(s==="-"&&o.text==="-"){var a=e[r+2];r+1<n&&a&&a.type==="textord"&&a.text==="-"?(e.splice(r,3,{type:"textord",mode:"text",loc:sa.range(i,a),text:"---"}),n-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:sa.range(i,o),text:"--"}),n-=1)}(s==="'"||s==="`")&&o.text===s&&(e.splice(r,2,{type:"textord",mode:"text",loc:sa.range(i,o),text:s+s}),n-=1)}}}}parseSymbol(){var e=this.fetch(),n=e.text;if(/^\\verb[^a-zA-Z]/.test(n)){this.consume();var r=n.slice(5),i=r.charAt(0)==="*";if(i&&(r=r.slice(1)),r.length<2||r.charAt(0)!==r.slice(-1))throw new Fe(`\\verb assertion failed --
|
||
please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:i}}Ioe.hasOwnProperty(n[0])&&!$r[this.mode][n[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+n[0]+'" used in math mode',e),n=Ioe[n[0]]+n.slice(1));var s=Ckt.exec(n);s&&(n=n.substring(0,s.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var o;if($r[this.mode][n]){this.settings.strict&&this.mode==="math"&&zB.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var a=$r[this.mode][n].group,l=sa.range(e),c;WSt(a)?c={type:"atom",mode:this.mode,family:a,loc:l,text:n}:c={type:a,mode:this.mode,loc:l,text:n},o=c}else if(n.charCodeAt(0)>=128)this.settings.strict&&($5e(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),e)),o={type:"textord",mode:"text",loc:sa.range(e),text:n};else return null;if(this.consume(),s)for(var u=0;u<s[0].length;u++){var d=s[0][u];if(!BD[d])throw new Fe("Unknown accent ' "+d+"'",e);var h=BD[d][this.mode]||BD[d].text;if(!h)throw new Fe("Accent "+d+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:sa.range(e),label:h,isStretchy:!1,isShifty:!0,base:o}}return o}}XR.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var WG=function(e,n){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new XR(e,n);delete r.gullet.macros.current["\\df@tag"];var i=r.parse();if(delete r.gullet.macros.current["\\current@color"],delete r.gullet.macros.current["\\color"],r.gullet.macros.get("\\df@tag")){if(!n.displayMode)throw new Fe("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:r.subparse([new nl("\\df@tag")])}]}return i},L3e=function(e,n,r){n.textContent="";var i=GG(e,r).toNode();n.appendChild(i)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),L3e=function(){throw new Fe("KaTeX doesn't work in quirks mode.")});var Mkt=function(e,n){var r=GG(e,n).toMarkup();return r},Nkt=function(e,n){var r=new NG(n);return WG(e,r)},z3e=function(e,n,r){if(r.throwOnError||!(e instanceof Fe))throw e;var i=ze(["katex-error"],[new ll(n)]);return i.setAttribute("title",e.toString()),i.setAttribute("style","color:"+r.errorColor),i},GG=function(e,n){var r=new NG(n);try{var i=WG(e,r);return jSt(i,e,r)}catch(s){return z3e(s,e,r)}},Okt=function(e,n){var r=new NG(n);try{var i=WG(e,r);return BSt(i,e,r)}catch(s){return z3e(s,e,r)}},Dkt="0.16.47",Pkt={Span:S2,Anchor:BR,SymbolNode:ll,SvgNode:bf,PathNode:i0,LineNode:LB},j3e={version:Dkt,render:L3e,renderToString:Mkt,ParseError:Fe,SETTINGS_SCHEMA:OB,__parse:Nkt,__renderToDomTree:GG,__renderToHTMLTree:Okt,__setFontMetrics:bSt,__defineSymbol:A,__defineFunction:ot,__defineMacro:F,__domTree:Pkt};function Lkt(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:s},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:a,mathText:o,mathTextData:a}};function t(l){const c={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[c]}},l)}function e(){this.buffer()}function n(){const l=this.resume(),c=this.stack[this.stack.length-1];c.type,c.meta=l}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(l){const c=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),u=this.stack[this.stack.length-1];u.type,this.exit(l),u.value=c;const d=u.data.hChildren[0];d.type,d.tagName,d.children.push({type:"text",value:c}),this.data.mathFlowInside=void 0}function s(l){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},l),this.buffer()}function o(l){const c=this.resume(),u=this.stack[this.stack.length-1];u.type,this.exit(l),u.value=c,u.data.hChildren.push({type:"text",value:c})}function a(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function zkt(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=i,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
|
||
`,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(s,o,a,l){const c=s.value||"",u=a.createTracker(l),d="$".repeat(Math.max(Pxe(c,"$")+1,2)),h=a.enter("mathFlow");let f=u.move(d);if(s.meta){const p=a.enter("mathFlowMeta");f+=u.move(a.safe(s.meta,{after:`
|
||
`,before:f,encode:["$"],...u.current()})),p()}return f+=u.move(`
|
||
`),c&&(f+=u.move(c+`
|
||
`)),f+=u.move(d),h(),f}function r(s,o,a){let l=s.value||"",c=1;for(e||c++;new RegExp("(^|[^$])"+"\\$".repeat(c)+"([^$]|$)").test(l);)c++;const u="$".repeat(c);/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^\$|\$$/.test(l))&&(l=" "+l+" ");let d=-1;for(;++d<a.unsafe.length;){const h=a.unsafe[d];if(!h.atBreak)continue;const f=a.compilePattern(h);let p;for(;p=f.exec(l);){let g=p.index;l.codePointAt(g)===10&&l.codePointAt(g-1)===13&&g--,l=l.slice(0,g)+" "+l.slice(p.index+1)}}return u+l+u}function i(){return"$"}}const jkt={tokenize:Bkt,concrete:!0,name:"mathFlow"},Roe={tokenize:Fkt,partial:!0};function Bkt(t,e,n){const r=this,i=r.events[r.events.length-1],s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0;let o=0;return a;function a(b){return t.enter("mathFlow"),t.enter("mathFlowFence"),t.enter("mathFlowFenceSequence"),l(b)}function l(b){return b===36?(t.consume(b),o++,l):o<2?n(b):(t.exit("mathFlowFenceSequence"),dn(t,c,"whitespace")(b))}function c(b){return b===null||_t(b)?d(b):(t.enter("mathFlowFenceMeta"),t.enter("chunkString",{contentType:"string"}),u(b))}function u(b){return b===null||_t(b)?(t.exit("chunkString"),t.exit("mathFlowFenceMeta"),d(b)):b===36?n(b):(t.consume(b),u)}function d(b){return t.exit("mathFlowFence"),r.interrupt?e(b):t.attempt(Roe,h,y)(b)}function h(b){return t.attempt({tokenize:v,partial:!0},y,f)(b)}function f(b){return(s?dn(t,p,"linePrefix",s+1):p)(b)}function p(b){return b===null?y(b):_t(b)?t.attempt(Roe,h,y)(b):(t.enter("mathFlowValue"),g(b))}function g(b){return b===null||_t(b)?(t.exit("mathFlowValue"),p(b)):(t.consume(b),g)}function y(b){return t.exit("mathFlow"),e(b)}function v(b,_,S){let k=0;return dn(b,T,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function T(R){return b.enter("mathFlowFence"),b.enter("mathFlowFenceSequence"),E(R)}function E(R){return R===36?(k++,b.consume(R),E):k<o?S(R):(b.exit("mathFlowFenceSequence"),dn(b,C,"whitespace")(R))}function C(R){return R===null||_t(R)?(b.exit("mathFlowFence"),_(R)):S(R)}}}function Fkt(t,e,n){const r=this;return i;function i(o){return o===null?e(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function Vkt(t){let n=(t||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:$kt,previous:Hkt,name:"mathText"};function r(i,s,o){let a=0,l,c;return u;function u(g){return i.enter("mathText"),i.enter("mathTextSequence"),d(g)}function d(g){return g===36?(i.consume(g),a++,d):a<2&&!n?o(g):(i.exit("mathTextSequence"),h(g))}function h(g){return g===null?o(g):g===36?(c=i.enter("mathTextSequence"),l=0,p(g)):g===32?(i.enter("space"),i.consume(g),i.exit("space"),h):_t(g)?(i.enter("lineEnding"),i.consume(g),i.exit("lineEnding"),h):(i.enter("mathTextData"),f(g))}function f(g){return g===null||g===32||g===36||_t(g)?(i.exit("mathTextData"),h(g)):(i.consume(g),f)}function p(g){return g===36?(i.consume(g),l++,p):l===a?(i.exit("mathTextSequence"),i.exit("mathText"),s(g)):(c.type="mathTextData",f(g))}}}function $kt(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="mathTextData"){t[e][1].type="mathTextPadding",t[n][1].type="mathTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="mathTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function Hkt(t){return t!==36||this.events[this.events.length-1][1].type==="characterEscape"}function Ukt(t){return{flow:{36:jkt},text:{36:Vkt(t)}}}const qkt={};function Wkt(t){const e=this,n=t||qkt,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Ukt(n)),s.push(Lkt()),o.push(zkt(n))}var Gkt=Object.defineProperty,Moe=Object.getOwnPropertySymbols,Kkt=Object.prototype.hasOwnProperty,Ykt=Object.prototype.propertyIsEnumerable,Noe=(t,e,n)=>e in t?Gkt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Zkt=(t,e)=>{for(var n in e||(e={}))Kkt.call(e,n)&&Noe(t,n,e[n]);if(Moe)for(var n of Moe(e))Ykt.call(e,n)&&Noe(t,n,e[n]);return t};function Ly(t,e){return Object.assign(t,{meta:Zkt({package:"@milkdown/components"},e)}),t}var Xkt=Object.defineProperty,Ooe=Object.getOwnPropertySymbols,Qkt=Object.prototype.hasOwnProperty,Jkt=Object.prototype.propertyIsEnumerable,Doe=(t,e,n)=>e in t?Xkt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,KG=(t,e)=>{for(var n in e||(e={}))Qkt.call(e,n)&&Doe(t,n,e[n]);if(Ooe)for(var n of Ooe(e))Jkt.call(e,n)&&Doe(t,n,e[n]);return t};const e5t={mode:"preview"},a0=xn(KG({},e5t),"linkTooltipStateCtx");Ly(a0,{displayName:"State<link-tooltip>",group:"LinkTooltip"});const t5t={addLink:()=>{},editLink:()=>{},removeLink:()=>{}},_x=xn(KG({},t5t),"linkTooltipAPICtx");Ly(a0,{displayName:"API<link-tooltip>",group:"LinkTooltip"});const n5t={linkIcon:"🔗",editButton:"✎",removeButton:"⌫",confirmButton:"Confirm ⏎",onCopyLink:()=>{},inputPlaceholder:"Paste link..."},Sx=xn(KG({},n5t),"linkTooltipConfigCtx");Ly(a0,{displayName:"Config<link-tooltip>",group:"LinkTooltip"});const YG=bt("ToggleLink",t=>()=>e=>{const{doc:n,selection:r}=e,i=tl.type(t);return n.rangeHasMark(r.from,r.to,i)?(t.get(_x.key).removeLink(r.from,r.to),!0):(t.get(_x.key).addLink(r.from,r.to),!0)}),mC=q3("LINK_PREVIEW");Ly(mC[0],{displayName:"PreviewTooltipSpec<link-tooltip>",group:"LinkTooltip"});Ly(mC[1],{displayName:"PreviewTooltipPlugin<link-tooltip>",group:"LinkTooltip"});const QR=q3("LINK_EDIT");Ly(QR[0],{displayName:"EditTooltipSpec<link-tooltip>",group:"LinkTooltip"});Ly(QR[1],{displayName:"EditTooltipPlugin<link-tooltip>",group:"LinkTooltip"});function ZG(...t){}ZG(X);function dS({icon:t,class:e,onClick:n}){return X("span",{class:ji("milkdown-icon",e),onPointerdown:n,innerHTML:t?dl.sanitize(t.trim()):void 0})}dS.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};ZG(X);const r5t=es({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onConfirm:{type:Function,required:!0},onCancel:{type:Function,required:!0}},setup({config:t,src:e,onConfirm:n,onCancel:r}){const i=nt(e);qh(e,a=>{i.value=a});const s=()=>{n(i.value)},o=a=>{a.stopPropagation(),a.key==="Enter"&&(a.preventDefault(),s()),a.key==="Escape"&&(a.preventDefault(),r())};return()=>X("div",{class:"link-edit"},X("input",{class:"input-area",placeholder:t.value.inputPlaceholder,onKeydown:o,onInput:a=>{i.value=a.target.value},value:i.value}),i.value?X(dS,{class:"button confirm",icon:t.value.confirmButton,onClick:s}):null)}});var i5t=Object.defineProperty,s5t=Object.defineProperties,o5t=Object.getOwnPropertyDescriptors,Poe=Object.getOwnPropertySymbols,a5t=Object.prototype.hasOwnProperty,l5t=Object.prototype.propertyIsEnumerable,B3e=t=>{throw TypeError(t)},Loe=(t,e,n)=>e in t?i5t(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,dT=(t,e)=>{for(var n in e||(e={}))a5t.call(e,n)&&Loe(t,n,e[n]);if(Poe)for(var n of Poe(e))l5t.call(e,n)&&Loe(t,n,e[n]);return t},zoe=(t,e)=>s5t(t,o5t(e)),F3e=(t,e,n)=>e.has(t)||B3e("Cannot "+n),Yr=(t,e,n)=>(F3e(t,e,"read from private field"),n?n.call(t):e.get(t)),Yd=(t,e,n)=>e.has(t)?B3e("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),eg=(t,e,n,r)=>(F3e(t,e,"write to private field"),e.set(t,n),n),$4,op,ap,L6,H4,z6,fg,QB,j6;const joe={from:-1,to:-1,mark:null};class c5t{constructor(e,n){this.ctx=e,Yd(this,$4),Yd(this,op),Yd(this,ap,dT({},joe)),Yd(this,L6),Yd(this,H4),Yd(this,z6,nt("")),Yd(this,fg,()=>{Yr(this,op).hide(),this.ctx.update(a0.key,s=>zoe(dT({},s),{mode:"preview"})),eg(this,ap,dT({},joe))}),Yd(this,QB,s=>{const o=this.ctx.get(cn),{from:a,to:l,mark:c}=Yr(this,ap),u=tl.type(this.ctx),d=dl.sanitize(s);if(c&&c.attrs.href===d){Yr(this,fg).call(this);return}const h=o.state.tr;c&&h.removeMark(a,l,c),h.addMark(a,l,u.create({href:d})),o.dispatch(h),Yr(this,fg).call(this)}),Yd(this,j6,(s,o,a)=>{const l=this.ctx.get(Sx.key);Yr(this,H4).value=l,Yr(this,z6).value=s,this.ctx.update(a0.key,u=>zoe(dT({},u),{mode:"edit"}));const c=this.ctx.get(cn);c.dispatch(c.state.tr.setSelection(mt.create(c.state.doc,o,a))),Yr(this,op).show({getBoundingClientRect:()=>L3(c,o,a)},c),requestAnimationFrame(()=>{var u;(u=Yr(this,$4).querySelector("input"))==null||u.focus()})}),this.update=s=>{const{state:o}=s,{selection:a}=o;if(!(a instanceof mt))return;const{from:l,to:c}=a;l===Yr(this,ap).from&&c===Yr(this,ap).to||Yr(this,fg).call(this)},this.destroy=()=>{Yr(this,L6).unmount(),Yr(this,op).destroy(),Yr(this,$4).remove()},this.addLink=(s,o)=>{eg(this,ap,{from:s,to:o,mark:null}),Yr(this,j6).call(this,"",s,o)},this.editLink=(s,o,a)=>{eg(this,ap,{from:o,to:a,mark:s}),Yr(this,j6).call(this,s.attrs.href,o,a)},this.removeLink=(s,o)=>{const a=this.ctx.get(cn),l=a.state.tr;l.removeMark(s,o,tl.type(this.ctx)),a.dispatch(l),Yr(this,fg).call(this)},eg(this,H4,nt(this.ctx.get(Sx.key)));const r=document.createElement("div");r.className="milkdown-link-edit";const i=hl(r5t,{config:Yr(this,H4),src:Yr(this,z6),onConfirm:Yr(this,QB),onCancel:Yr(this,fg)});i.mount(r),eg(this,L6,i),eg(this,$4,r),eg(this,op,new U3({content:r,debounce:0,shouldShow:()=>!1})),Yr(this,op).onHide=()=>{requestAnimationFrame(()=>{n.dom.focus({preventScroll:!0})})},Yr(this,op).update(n)}}$4=new WeakMap;op=new WeakMap;ap=new WeakMap;L6=new WeakMap;H4=new WeakMap;z6=new WeakMap;fg=new WeakMap;QB=new WeakMap;j6=new WeakMap;var u5t=Object.defineProperty,d5t=Object.defineProperties,h5t=Object.getOwnPropertyDescriptors,Boe=Object.getOwnPropertySymbols,f5t=Object.prototype.hasOwnProperty,p5t=Object.prototype.propertyIsEnumerable,Foe=(t,e,n)=>e in t?u5t(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,m5t=(t,e)=>{for(var n in e||(e={}))f5t.call(e,n)&&Foe(t,n,e[n]);if(Boe)for(var n of Boe(e))p5t.call(e,n)&&Foe(t,n,e[n]);return t},g5t=(t,e)=>d5t(t,h5t(e));function y5t(t){let e;t.update(_x.key,n=>g5t(m5t({},n),{addLink:(r,i)=>{e==null||e.addLink(r,i)},editLink:(r,i,s)=>{e==null||e.editLink(r,i,s)},removeLink:(r,i)=>{e==null||e.removeLink(r,i)}})),t.set(QR.key,{view:n=>(e=new c5t(t,n),e)})}function v5t(t,e,n,r,i){let s={start:-1,end:-1};return n.nodesBetween(r,i,(o,a)=>{if(s.start>-1)return!1;s.start===-1&&t.isInSet(o.marks)&&e===o&&(s={start:a,end:a+Math.max(o.textContent.length,1)})}),s}function b5t(t,e,n){const r=e.posAtCoords({left:n.clientX,top:n.clientY});if(!r)return;const{pos:i}=r,s=e.state.doc.nodeAt(i);if(!s)return;const o=s.marks.find(l=>l.type===tl.mark.type(t));if(!(!o||!mC.pluginKey()))return{show:!0,pos:i,node:s,mark:o}}ZG(X);const w5t=es({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onEdit:{type:Object,required:!0},onRemove:{type:Object,required:!0}},setup({config:t,src:e,onEdit:n,onRemove:r}){const i=a=>{a.preventDefault(),a.stopPropagation(),n.value()},s=a=>{a.preventDefault(),a.stopPropagation(),r.value()},o=a=>{a.preventDefault();const l=e.value;navigator.clipboard&&l&&navigator.clipboard.writeText(l).then(()=>{t.value.onCopyLink(l)}).catch(c=>console.error(c))};return()=>X("div",{class:"link-preview"},X(dS,{class:"button link-icon",icon:t.value.linkIcon,onClick:o}),X("a",{href:e.value,target:"_blank",class:"link-display"},e.value),X(dS,{class:"button link-edit-button",icon:t.value.editButton,onClick:i}),X(dS,{class:"button link-remove-button",icon:t.value.removeButton,onClick:s}))}});var V3e=t=>{throw TypeError(t)},$3e=(t,e,n)=>e.has(t)||V3e("Cannot "+n),Rn=(t,e,n)=>($3e(t,e,"read from private field"),n?n.call(t):e.get(t)),Go=(t,e,n)=>e.has(t)?V3e("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Jf=(t,e,n,r)=>($3e(t,e,"write to private field"),e.set(t,n),n),pg,bc,U4,q4,B6,F6,V6,W4,$6,G4,H6,U6,q6,K4;class x5t{constructor(e,n){this.ctx=e,Go(this,pg),Go(this,bc),Go(this,U4),Go(this,q4),Go(this,B6,nt("")),Go(this,F6,nt(()=>{})),Go(this,V6,nt(()=>{})),Go(this,W4),Go(this,$6),Go(this,G4,!1),Go(this,H6,({mode:r})=>{r==="edit"&&Rn(this,K4).call(this)}),Go(this,U6,()=>{Jf(this,G4,!0)}),Go(this,q6,()=>{Jf(this,G4,!1)}),Go(this,K4,()=>{Rn(this,bc).hide(),Rn(this,bc).element.removeEventListener("mouseenter",Rn(this,U6)),Rn(this,bc).element.removeEventListener("mouseleave",Rn(this,q6))}),this.show=(r,i,s,o)=>{Rn(this,q4).value=this.ctx.get(Sx.key),Rn(this,B6).value=r.attrs.href,Rn(this,F6).value=()=>{this.ctx.get(_x.key).editLink(r,i,s)},Rn(this,V6).value=()=>{this.ctx.get(_x.key).removeLink(i,s),Rn(this,K4).call(this)},Rn(this,bc).show({getBoundingClientRect:()=>o},Rn(this,$6)),Rn(this,bc).element.addEventListener("mouseenter",Rn(this,U6)),Rn(this,bc).element.addEventListener("mouseleave",Rn(this,q6))},this.hide=()=>{Rn(this,G4)||Rn(this,K4).call(this)},this.update=()=>{},this.destroy=()=>{Rn(this,W4).unmount(),Rn(this,U4).off(Rn(this,H6)),Rn(this,bc).destroy(),Rn(this,pg).remove()},Jf(this,$6,n),Jf(this,q4,nt(this.ctx.get(Sx.key))),Jf(this,W4,hl(w5t,{config:Rn(this,q4),src:Rn(this,B6),onEdit:Rn(this,F6),onRemove:Rn(this,V6)})),Jf(this,pg,document.createElement("div")),Rn(this,pg).className="milkdown-link-preview",Rn(this,W4).mount(Rn(this,pg)),Jf(this,bc,new U3({debounce:0,content:Rn(this,pg),shouldShow:()=>!1})),Rn(this,bc).update(n),Jf(this,U4,e.use(a0.key)),Rn(this,U4).on(Rn(this,H6))}}pg=new WeakMap;bc=new WeakMap;U4=new WeakMap;q4=new WeakMap;B6=new WeakMap;F6=new WeakMap;V6=new WeakMap;W4=new WeakMap;$6=new WeakMap;G4=new WeakMap;H6=new WeakMap;U6=new WeakMap;q6=new WeakMap;K4=new WeakMap;function _5t(t){let e;const r=DI((s,o)=>{if(!e||!s.hasFocus()||t.get(a0.key).mode==="edit")return;const l=b5t(t,s,o);if(l){const c=s.state.doc.resolve(l.pos),u=v5t(l.mark,l.node,s.state.doc,c.before(),c.after()),d=u.start,h=u.end;e.show(l.mark,d,h,L3(s,d,h));return}e.hide()},50),i=()=>{setTimeout(()=>{e==null||e.hide()},50)};t.set(mC.key,{props:{handleDOMEvents:{mousemove:r,mouseleave:i}},view:s=>(e=new x5t(t,s),e)})}function S5t(t){_5t(t),y5t(t)}const k5t=[a0,_x,Sx,mC,QR,YG].flat();var C5t=Object.defineProperty,Voe=Object.getOwnPropertySymbols,E5t=Object.prototype.hasOwnProperty,T5t=Object.prototype.propertyIsEnumerable,$oe=(t,e,n)=>e in t?C5t(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,A5t=(t,e)=>{for(var n in e||(e={}))E5t.call(e,n)&&$oe(t,n,e[n]);if(Voe)for(var n of Voe(e))T5t.call(e,n)&&$oe(t,n,e[n]);return t};function H3e(t,e){return Object.assign(t,{meta:A5t({package:"@milkdown/components"},e)}),t}const I5t={renderLabel:({label:t,listType:e,checked:n})=>n==null?e==="bullet"?"⦿":t:n?"☑":"□"},JR=xn(I5t,"listItemBlockConfigCtx");H3e(JR,{displayName:"Config<list-item-block>",group:"ListItemBlock"});function U3e(...t){}U3e(X);function q3e({icon:t,class:e,onClick:n}){return X("span",{class:ji("milkdown-icon",e),onPointerdown:n,innerHTML:t?dl.sanitize(t.trim()):void 0})}q3e.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};U3e(X);const R5t=es({props:{label:{type:Object,required:!0},checked:{type:Object,required:!0},listType:{type:Object,required:!0},config:{type:Object,required:!0},readonly:{type:Object,required:!0},selected:{type:Object,required:!0},setAttr:{type:Function,required:!0},onMount:{type:Function,required:!0}},setup({label:t,checked:e,listType:n,config:r,readonly:i,setAttr:s,onMount:o,selected:a}){const l=h=>{h!=null&&h instanceof Element&&o(h)},c=h=>{h.stopPropagation(),h.preventDefault(),e.value!=null&&s("checked",!e.value)},u=Ll(()=>r.renderLabel({label:t.value,listType:n.value,checked:e.value,readonly:i.value})),d=Ll(()=>e.value==null?n.value==="bullet"?"bullet":"ordered":e.value?"checked":"unchecked");return()=>X("li",{class:ji("list-item",a.value&&"ProseMirror-selectednode")},X("div",{class:"label-wrapper",onPointerdown:c,contenteditable:!1},X(q3e,{class:ji("label",i.value&&"readonly",d.value),icon:u.value})),X("div",{class:"children",ref:l}))}}),W3e=F3(ac.node,t=>(e,n,r)=>{const i=document.createElement("div");i.className="milkdown-list-item-block";const s=document.createElement("div");s.setAttribute("data-content-dom","true"),s.classList.add("content-dom");const o=nt(e.attrs.label),a=nt(e.attrs.checked),l=nt(e.attrs.listType),c=nt(!n.editable),u=t.get(JR.key),d=nt(!1),h=(_,S)=>{if(!n.editable)return;const k=r();k!=null&&(n.hasFocus()||n.focus(),n.dispatch(n.state.tr.setNodeAttribute(k,_,S)))},f=p2(()=>{d.value?i.classList.add("selected"):i.classList.remove("selected")});let p=0;const y=hl(R5t,{label:o,checked:a,listType:l,readonly:c,config:u,selected:d,setAttr:h,onMount:_=>{const{anchor:S,head:k}=n.state.selection;_.appendChild(s);const T=n.state.doc.resolve(S),E=n.state.doc.resolve(k);p=requestAnimationFrame(()=>{if(cancelAnimationFrame(p),!T.doc.eq(n.state.doc))return;const C=new mt(T,E);n.dispatch(n.state.tr.setSelection(C))})}});y.mount(i);const v=_=>{l.value=_.attrs.listType,o.value=_.attrs.label,a.value=_.attrs.checked,c.value=!n.editable};v(e);let b=e;return{dom:i,contentDOM:s,update:_=>_.type!==e.type?!1:(_.sameMarkup(b)&&_.content.eq(b.content)||(b=_,v(_)),!0),ignoreMutation:_=>!i||!s?!0:_.type==="selection"?!1:s===_.target&&_.type==="attributes"?!0:!s.contains(_.target),selectNode:()=>{d.value=!0},deselectNode:()=>{d.value=!1},destroy:()=>{f(),y.unmount(),i.remove(),s.remove()}}});H3e(W3e,{displayName:"NodeView<list-item-block>",group:"ListItemBlock"});const M5t=[JR,W3e];var N5t=Object.defineProperty,Hoe=Object.getOwnPropertySymbols,O5t=Object.prototype.hasOwnProperty,D5t=Object.prototype.propertyIsEnumerable,Uoe=(t,e,n)=>e in t?N5t(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,P5t=(t,e)=>{for(var n in e||(e={}))O5t.call(e,n)&&Uoe(t,n,e[n]);if(Hoe)for(var n of Hoe(e))D5t.call(e,n)&&Uoe(t,n,e[n]);return t};function G3e(t,e){return Object.assign(t,{meta:P5t({package:"@milkdown/components"},e)}),t}var L5t=Object.defineProperty,qoe=Object.getOwnPropertySymbols,z5t=Object.prototype.hasOwnProperty,j5t=Object.prototype.propertyIsEnumerable,Woe=(t,e,n)=>e in t?L5t(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,B5t=(t,e)=>{for(var n in e||(e={}))z5t.call(e,n)&&Woe(t,n,e[n]);if(qoe)for(var n of qoe(e))j5t.call(e,n)&&Woe(t,n,e[n]);return t};const F5t={renderButton:t=>{switch(t){case"add_row":return"+";case"add_col":return"+";case"delete_row":return"-";case"delete_col":return"-";case"align_col_left":return"left";case"align_col_center":return"center";case"align_col_right":return"right";case"col_drag_handle":return"=";case"row_drag_handle":return"="}}},eM=xn(B5t({},F5t),"tableBlockConfigCtx");G3e(eM,{displayName:"Config<table-block>",group:"TableBlock"});function K3e(...t){}K3e(X);function ku({icon:t,class:e,onClick:n}){return X("span",{class:ji("milkdown-icon",e),onPointerdown:n,innerHTML:t?dl.sanitize(t.trim()):void 0})}ku.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};function Y3e(t){const{dragPreviewRef:e,tableWrapperRef:n,contentWrapperRef:r,yLineHandleRef:i,xLineHandleRef:s,colHandleRef:o,rowHandleRef:a}=t,l=e.value;if(!l)return;const c=n.value;if(!c)return;const u=r.value;if(!u)return;const d=u.querySelector("tbody");if(!d)return;const h=l.querySelector("tbody");if(!h)return;const f=i.value;if(!f)return;const p=s.value;if(!p)return;const g=o.value;if(!g)return;const y=a.value;return y?{preview:l,wrapper:c,content:u,contentRoot:d,previewRoot:h,yHandle:f,xHandle:p,colHandle:g,rowHandle:y}:void 0}function Z3e(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function X3e(t,e,n,r,i){const{width:s,height:o}=r.querySelector("tbody").getBoundingClientRect();if(t==="y"){const l=r.querySelectorAll("tr")[i];if(!l)return;n.appendChild(l.cloneNode(!0));const c=l.getBoundingClientRect().height;Object.assign(e.style,{width:`${s}px`,height:`${c}px`}),e.dataset.show="true";return}if(t==="x"){const a=r.querySelectorAll("tr");let l;Array.from(a).forEach(c=>{const u=c.children[i];if(!u)return;l===void 0&&(l=u.getBoundingClientRect().width);const d=u.parentElement.cloneNode(!1),h=u.cloneNode(!0);d.appendChild(h),n.appendChild(d)}),Object.assign(e.style,{width:`${l}px`,height:`${o}px`}),e.dataset.show="true";return}}function V5t(t,e){return n=>{J3e(t,n,e,r=>{Q3e("y",n,r,t);const{preview:i,content:s,previewRoot:o}=r;Z3e(o);const{hoverIndex:a}=t,[l]=a.value;X3e("y",i,o,s,l)})}}function $5t(t,e){return n=>{J3e(t,n,e,r=>{Q3e("x",n,r,t);const{preview:i,content:s,previewRoot:o}=r,{hoverIndex:a}=t,[l,c]=a.value;Z3e(o),X3e("x",i,o,s,c)})}}function Q3e(t,e,n,r){const{xHandle:i,yHandle:s,colHandle:o,rowHandle:a,preview:l}=n;i.dataset.displayType=t==="y"?"indicator":"none",s.dataset.displayType=t==="x"?"indicator":"none",t==="y"?(o.dataset.show="false",Goe(a)):(a.dataset.show="false",Goe(o));const{hoverIndex:c,dragInfo:u}=r,[d,h]=c.value;u.value={startCoords:[e.clientX,e.clientY],startIndex:t==="y"?d:h,endIndex:t==="y"?d:h,type:t==="y"?"row":"col"},l.dataset.direction=t==="y"?"vertical":"horizontal"}function J3e(t,e,n,r){const i=n==null?void 0:n.get(cn);if(!(i!=null&&i.editable))return;e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.effectAllowed="move");const s=Y3e(t);s&&requestAnimationFrame(()=>{r(s)})}function Goe(t){var e;(e=t.querySelector(".button-group"))==null||e.setAttribute("data-show","false")}function JB(t,e){for(let n=0;n<t.childCount;n++)if(t.child(n)===e)return n;return-1}function H5t(t,e){var n,r,i;if(e)try{const s=e.posAtCoords({left:t.clientX,top:t.clientY});if(!s)return;const o=s==null?void 0:s.inside;if(o==null||o<0)return;const a=e.state.doc.resolve(o),l=e.state.doc.nodeAt(o);if(!l)return;const c=["table_cell","table_header"],u=["table_row","table_header_row"],d=c.includes(l.type.name)?l:(n=hd(y=>c.includes(y.type.name))(a))==null?void 0:n.node,h=(r=hd(y=>u.includes(y.type.name))(a))==null?void 0:r.node,f=(i=hd(y=>y.type.name==="table")(a))==null?void 0:i.node;if(!d||!h||!f)return;const p=JB(h,d);return[JB(f,h),p]}catch{return}}function tM(t,[e,n]){const r=t.value;if(!r)return;const i=r.querySelectorAll("tr"),s=i[e];if(!s)return;const o=i[0];if(!o)return;const a=o.children[n];if(!a)return;const l=s.children[n];if(l)return{row:s,col:l,headerCol:a}}function U5t(t,e,n){if(!n||!e)return;const{selection:r}=e.state;if(!(r instanceof xr))return;const{$from:i}=r,s=y2(i);if(!(!s||s.node!==n)){if(r.isColSelection()){const{$head:o}=r,a=o.index(o.depth-1);XG({refs:t,index:[0,a],before:l=>{var c;(c=l.querySelector(".button-group"))==null||c.setAttribute("data-show","true")}});return}if(r.isRowSelection()){const{$head:o}=r,a=hd(c=>c.type.name==="table_row"||c.type.name==="table_header_row")(o);if(!a)return;const l=JB(s.node,a.node);QG({refs:t,index:[l,0],before:c=>{var u;l>0&&((u=c.querySelector(".button-group"))==null||u.setAttribute("data-show","true"))}})}}}function XG({refs:t,index:e,before:n,after:r}){const{contentWrapperRef:i,colHandleRef:s,hoverIndex:o}=t,a=s.value;if(!a)return;o.value=e;const l=tM(i,e);if(!l)return;const{headerCol:c}=l;a.dataset.show="true",n&&n(a),_d(c,a,{placement:"top"}).then(({x:u,y:d})=>{Object.assign(a.style,{left:`${u}px`,top:`${d}px`}),r&&r(a)}).catch(console.error)}function QG({refs:t,index:e,before:n,after:r}){const{contentWrapperRef:i,rowHandleRef:s,hoverIndex:o}=t,a=s.value;if(!a)return;o.value=e;const l=tM(i,e);if(!l)return;const{row:c}=l;a.dataset.show="true",n&&n(a),_d(c,a,{placement:"left"}).then(({x:u,y:d})=>{Object.assign(a.style,{left:`${u}px`,top:`${d}px`}),r&&r(a)}).catch(console.error)}function eCe(t,e,n){const r=n==="x"?"left":"top",i=n==="x"?"right":"bottom",s=t.length-1,o=t.findIndex((l,c)=>{const u=l.getBoundingClientRect(),d=u[r],h=u[i];return d<=e&&e<=h||c===s&&e>h||c===0&&e<d}),a=t[o];return a?[a,o]:void 0}function q5t(t,e){const n=t.querySelector("tr");if(!n)return;const r=Array.from(n.children);return eCe(r,e,"x")}function W5t(t,e){const n=Array.from(t.querySelectorAll("tr"));return eCe(n,e,"y")}function G5t(t){return PI(e=>{const n=Y3e(t);if(!n)return;const{preview:r,content:i,contentRoot:s,xHandle:o,yHandle:a}=n,{dragInfo:l,hoverIndex:c}=t;if(r.dataset.show==="false")return;const u=tM(t.contentWrapperRef,c.value);if(!u||!s.querySelector("tr"))return;const h=l.value;if(!h||!s.offsetParent)return;const f=s.offsetParent.offsetTop,p=s.offsetParent.offsetLeft;if(h.type==="col"){const g=u.col.getBoundingClientRect().width,{left:y,width:v}=s.getBoundingClientRect(),b=p-y,_=e.clientX+b-g/2,[S]=h.startCoords,k=S<e.clientX?"right":"left";r.style.top=`${f}px`;const T=_<y+b-20?y+b-20:_>y+v+b-g+20?y+v+b-g+20:_;r.style.left=`${T}px`;const E=q5t(s,e.clientX);if(E){const[C,R]=E,M=a.getBoundingClientRect().width,D=i.getBoundingClientRect();h.endIndex=R,_d(C,a,{placement:k==="left"?"left":"right",middleware:[ly(k==="left"?-1*M:0)]}).then(({x:P})=>{a.dataset.show="true",Object.assign(a.style,{height:`${D.height}px`,left:`${P}px`,top:`${f}px`})}).catch(console.error)}}else if(h.type==="row"){const g=u.row.getBoundingClientRect().height,{top:y,height:v}=s.getBoundingClientRect(),b=f-y,_=e.clientY+b-g/2,[S,k]=h.startCoords,T=k<e.clientY?"down":"up",E=_<y+b-20?y+b-20:_>y+v+b-g+20?y+v+b-g+20:_;r.style.top=`${E}px`,r.style.left=`${p}px`;const C=W5t(s,e.clientY);if(C){const[R,M]=C,D=o.getBoundingClientRect().height,P=i.getBoundingClientRect();h.endIndex=M,_d(R,o,{placement:T==="up"?"top":"bottom",middleware:[ly(T==="up"?-1*D:0)]}).then(({y:z})=>{o.dataset.show="true",Object.assign(o.style,{width:`${P.width}px`,top:`${z}px`})}).catch(console.error)}}},20)}function K5t(t,e,n){const{dragPreviewRef:r,yLineHandleRef:i,xLineHandleRef:s,dragInfo:o}=t,a=V5t(t,e),l=$5t(t,e),c=()=>{const h=r.value;if(!h||h.dataset.show==="false")return;const f=h==null?void 0:h.querySelector("tbody");for(;f!=null&&f.firstChild;)f==null||f.removeChild(f.firstChild);h&&(h.dataset.show="false")},u=()=>{var h;const f=r.value;if(!f)return;const p=i.value;if(!p)return;const g=s.value;if(!g)return;const y=o.value;if(!y||!e||f.dataset.show==="false"||!t.colHandleRef.value||!t.rowHandleRef.value||(p.dataset.show="false",g.dataset.show="false",y.startIndex===y.endIndex))return;const _=e.get(je),S={from:y.startIndex,to:y.endIndex,pos:((h=n==null?void 0:n())!=null?h:0)+1};if(y.type==="col"){_.call(Og.key,{pos:S.pos,index:y.startIndex}),_.call(nG.key,S);const k=[0,y.endIndex];XG({refs:t,index:k})}else{_.call(Ng.key,{pos:S.pos,index:y.startIndex}),_.call(tG.key,S);const k=[y.endIndex,0];QG({refs:t,index:k})}requestAnimationFrame(()=>{e.get(cn).focus()})},d=G5t(t);return m2(()=>{window.addEventListener("dragover",d),window.addEventListener("dragend",c),window.addEventListener("drop",u)}),g2(()=>{window.removeEventListener("dragover",d),window.removeEventListener("dragend",c),window.removeEventListener("drop",u)}),{dragRow:a,dragCol:l}}function Y5t(t,e,n){const{xLineHandleRef:r,contentWrapperRef:i,colHandleRef:s,rowHandleRef:o,hoverIndex:a,lineHoverIndex:l}=t;return{onAddRow:()=>{var g,y,v;if(!e)return;const b=r.value;if(!b)return;const[_]=l.value;if(_<0||!e.get(cn).editable)return;const S=Array.from((y=(g=i.value)==null?void 0:g.querySelectorAll("tr"))!=null?y:[]),k=e.get(je),T=((v=n==null?void 0:n())!=null?v:0)+1;S.length===_?(k.call(Ng.key,{pos:T,index:_-1}),k.call(aG.key)):(k.call(Ng.key,{pos:T,index:_}),k.call(oG.key)),k.call(Ng.key,{pos:T,index:_}),b.dataset.show="false"},onAddCol:()=>{var g,y,v,b;if(!e||!r.value)return;const[S,k]=l.value;if(k<0||!e.get(cn).editable)return;const T=Array.from((v=(y=(g=i.value)==null?void 0:g.querySelector("tr"))==null?void 0:y.children)!=null?v:[]),E=e.get(je),C=((b=n==null?void 0:n())!=null?b:0)+1;T.length===k?(E.call(Og.key,{pos:C,index:k-1}),E.call(sG.key)):(E.call(Og.key,{pos:C,index:k}),E.call(iG.key)),E.call(Og.key,{pos:C,index:k})},selectCol:()=>{var g,y;if(!e)return;const[v,b]=a.value,_=e.get(je),S=((g=n==null?void 0:n())!=null?g:0)+1;_.call(Og.key,{pos:S,index:b});const k=(y=s.value)==null?void 0:y.querySelector(".button-group");k&&(k.dataset.show=k.dataset.show==="true"?"false":"true")},selectRow:()=>{var g,y;if(!e)return;const[v,b]=a.value,_=e.get(je),S=((g=n==null?void 0:n())!=null?g:0)+1;_.call(Ng.key,{pos:S,index:v});const k=(y=o.value)==null?void 0:y.querySelector(".button-group");k&&v>0&&(k.dataset.show=k.dataset.show==="true"?"false":"true")},deleteSelected:g=>{if(!e||!e.get(cn).editable)return;g.preventDefault(),g.stopPropagation(),e.get(je).call(rG.key),requestAnimationFrame(()=>{e.get(cn).focus()})},onAlign:g=>y=>{if(!e||!e.get(cn).editable)return;y.preventDefault(),y.stopPropagation(),e.get(je).call(lG.key,g),requestAnimationFrame(()=>{e.get(cn).focus()})}}}function Z5t(t,e){return PI(n=>{if(!(e!=null&&e.editable))return;const{contentWrapperRef:r,yLineHandleRef:i,xLineHandleRef:s,colHandleRef:o,rowHandleRef:a,hoverIndex:l,lineHoverIndex:c}=t,u=i.value;if(!u)return;const d=s.value;if(!d)return;const h=r.value;if(!h)return;const f=a.value;if(!f)return;const p=o.value;if(!p)return;const g=H5t(n,e);if(!g)return;const y=tM(r,g);if(!y)return;const[v,b]=g,_=y.col.getBoundingClientRect(),S=Math.abs(n.clientX-_.left)<8,k=Math.abs(_.right-n.clientX)<8,T=Math.abs(n.clientY-_.top)<8,E=Math.abs(_.bottom-n.clientY)<8,C=S||k||T||E,R=f.querySelector(".button-group"),M=p.querySelector(".button-group");if(R&&(R.dataset.show="false"),M&&(M.dataset.show="false"),C){const D=h.getBoundingClientRect();f.dataset.show="false",p.dataset.show="false",d.dataset.displayType="tool",u.dataset.displayType="tool";const P=u.getBoundingClientRect().width,z=d.getBoundingClientRect().height;S||k?(c.value[1]=S?b:b+1,_d(y.col,u,{placement:S?"left":"right",middleware:[ly(S?-1*P:0)]}).then(({x:Z})=>{u.dataset.show="true",Object.assign(u.style,{height:`${D.height}px`,left:`${Z}px`})}).catch(console.error)):u.dataset.show="false",g[0]!==0&&(T||E)?(c.value[0]=T?v:v+1,_d(y.row,d,{placement:T?"top":"bottom",middleware:[ly(T?-1*z:0)]}).then(({y:Z})=>{d.dataset.show="true",Object.assign(d.style,{width:`${D.width}px`,top:`${Z}px`})}).catch(console.error)):d.dataset.show="false";return}c.value=[-1,-1],u.dataset.show="false",d.dataset.show="false",f.dataset.show="true",p.dataset.show="true",QG({refs:t,index:g}),XG({refs:t,index:g}),l.value=g},20)}function X5t(t){return()=>{const{rowHandleRef:e,colHandleRef:n,yLineHandleRef:r,xLineHandleRef:i}=t;setTimeout(()=>{const s=e.value;if(!s)return;const o=n.value;if(!o)return;const a=r.value;if(!a)return;const l=i.value;l&&(s.dataset.show="false",o.dataset.show="false",a.dataset.show="false",l.dataset.show="false")},200)}}function Q5t(t,e){const n=Z5t(t,e),r=X5t(t);return{pointerMove:n,pointerLeave:r}}K3e(X);const J5t=es({props:{view:{type:Object,required:!0},ctx:{type:Object,required:!0},getPos:{type:Function,required:!0},config:{type:Object,required:!0},onMount:{type:Function,required:!0},node:{type:Object,required:!0}},setup({view:t,node:e,ctx:n,getPos:r,config:i,onMount:s}){const o=nt(),a=P=>{P!=null&&(P instanceof HTMLElement?(o.value=P,s(P)):o.value=void 0)},l=nt(),c=nt(),u=nt(),d=nt(),h=nt(),f=nt(),v={dragPreviewRef:f,tableWrapperRef:h,contentWrapperRef:o,yLineHandleRef:d,xLineHandleRef:u,colHandleRef:l,rowHandleRef:c,hoverIndex:nt([0,0]),lineHoverIndex:nt([-1,-1]),dragInfo:nt()},{pointerLeave:b,pointerMove:_}=Q5t(v,t),{dragRow:S,dragCol:k}=K5t(v,n,r),{onAddRow:T,onAddCol:E,selectCol:C,selectRow:R,deleteSelected:M,onAlign:D}=Y5t(v,n,r);return m2(()=>{requestAnimationFrame(()=>{t.editable&&U5t(v,t,e.value)})}),()=>X("div",{onDragstart:P=>P.preventDefault(),onDragover:P=>P.preventDefault(),onDragleave:P=>P.preventDefault(),onPointermove:_,onPointerleave:b},X("div",{"data-show":"false",contenteditable:"false",draggable:"true","data-role":"col-drag-handle",class:"handle cell-handle",onDragstart:k,onClick:C,onPointerdown:P=>P.stopPropagation(),onPointermove:P=>P.stopPropagation(),ref:l},X(ku,{icon:i.renderButton("col_drag_handle")}),X("div",{"data-show":"false",class:"button-group",onPointermove:P=>P.stopPropagation()},X("button",{type:"button",onPointerdown:D("left")},X(ku,{icon:i.renderButton("align_col_left")})),X("button",{type:"button",onPointerdown:D("center")},X(ku,{icon:i.renderButton("align_col_center")})),X("button",{type:"button",onPointerdown:D("right")},X(ku,{icon:i.renderButton("align_col_right")})),X("button",{type:"button",onPointerdown:M},X(ku,{icon:i.renderButton("delete_col")})))),X("div",{"data-show":"false",contenteditable:"false",draggable:"true","data-role":"row-drag-handle",class:"handle cell-handle",onDragstart:S,onClick:R,onPointerdown:P=>P.stopPropagation(),onPointermove:P=>P.stopPropagation(),ref:c},X(ku,{icon:i.renderButton("row_drag_handle")}),X("div",{"data-show":"false",class:"button-group",onPointermove:P=>P.stopPropagation()},X("button",{type:"button",onPointerdown:M},X(ku,{icon:i.renderButton("delete_row")})))),X("div",{class:"table-wrapper",ref:h},X("div",{"data-show":"false",class:"drag-preview","data-direction":"vertical",ref:f},X("table",null,X("tbody",null))),X("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"x-line-drag-handle",class:"handle line-handle",onPointermove:P=>P.stopPropagation(),ref:u},X("button",{type:"button",onClick:T,class:"add-button"},X(ku,{icon:i.renderButton("add_row")}))),X("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"y-line-drag-handle",class:"handle line-handle",onPointermove:P=>P.stopPropagation(),ref:d},X("button",{type:"button",onClick:E,class:"add-button"},X(ku,{icon:i.renderButton("add_col")}))),X("table",{ref:a,class:"children"})))}});var tCe=t=>{throw TypeError(t)},e3t=(t,e,n)=>e.has(t)||tCe("Cannot "+n),t3t=(t,e,n)=>e.has(t)?tCe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),n3t=(t,e,n)=>(e3t(t,e,"access private method"),n),eF,nCe;class r3t{constructor(e,n,r,i){this.ctx=e,this.node=n,this.view=r,this.getPos=i,t3t(this,eF);const s=document.createElement("div");s.className="milkdown-table-block";const o=document.createElement("tbody");this.contentDOM=o,o.setAttribute("data-content-dom","true"),o.classList.add("content-dom"),this.nodeRef=w8(n);const a=hl(J5t,{view:r,ctx:e,getPos:i,config:e.get(eM.key),onMount:l=>{l.appendChild(o)},node:this.nodeRef});a.mount(s),this.app=a,this.dom=s}update(e){return e.type!==this.node.type||e.sameMarkup(this.node)&&e.content.eq(this.node.content)?!1:(this.node=e,this.nodeRef.value=e,!0)}stopEvent(e){if(e.type==="drop"||e.type.startsWith("drag"))return!0;if(e.type==="mousedown"||e.type==="pointerdown"){if(e.target instanceof Element&&e.target.closest("button"))return!0;const n=e.target;if(n instanceof HTMLElement&&(n.closest("th")||n.closest("td"))){const r=e;return n3t(this,eF,nCe).call(this,r)}}return!1}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:e.type==="selection"?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}destroy(){this.app.unmount(),this.dom.remove(),this.contentDOM.remove()}}eF=new WeakSet;nCe=function(t){const e=this.view;if(!e.editable)return!1;const{state:n,dispatch:r}=e,i=e.posAtCoords({left:t.clientX,top:t.clientY});if(!i)return!1;const s=n.doc.resolve(i.inside),o=hd(c=>c.type.name==="table_cell"||c.type.name==="table_header")(s);if(!o)return!1;if(n.selection instanceof mt){const c=hd(u=>u.type.name==="table_cell"||u.type.name==="table_header")(n.selection.$from);if((c==null?void 0:c.node)===o.node)return!1}const{from:a}=o,l=Et.create(n.doc,a+1);return n.selection.eq(l)?!1:(n.selection instanceof xr?setTimeout(()=>{r(n.tr.setSelection(l).scrollIntoView())},20):requestAnimationFrame(()=>{r(n.tr.setSelection(l).scrollIntoView())}),!0)};const rCe=F3(md.node,t=>(e,n,r)=>new r3t(t,e,n,r));G3e(rCe,{displayName:"NodeView<table-block>",group:"TableBlock"});const i3t=[eM,rCe];function tF(t){if(!t)return!1;if(Array.isArray(t))return t.length>1?!1:tF(t[0]);const e=t.content;return e?tF(e):t.type==="text"}function s3t(t,e){return Object.assign(t,{meta:{package:"@milkdown/plugin-clipboard",...e}}),t}function Koe(t,e){const n=$dt(e);if(n)return t.dispatch(t.state.tr.replaceSelectionWith(n,!0)),!0;try{return t.dispatch(t.state.tr.replaceSelection(e)),!0}catch{return!1}}var iCe=Sr(t=>{const e=t.get(Fc);return t.update(J_,n=>({...n,editable:n.editable??(()=>!0),transformPastedHTML:(r,i)=>{const s=n.transformPastedHTML;return s&&(r=s(r,i)),r.includes("docs-internal-guid")&&(r=r.replace(/<b[^>]*id="docs-internal-guid[^"]*"[^>]*>([\s\S]*)<\/b>/,"$1"),r=r.replace(/<div[^>]*>(<table[\s\S]*?<\/table>)<\/div>/g,"$1")),r}})),new Fn({key:new Vn("MILKDOWN_CLIPBOARD"),props:{handlePaste:(n,r,i)=>{var f,p,g;const s=t.get(fd),o=(p=(f=n.props).editable)==null?void 0:p.call(f,n.state),{clipboardData:a}=r;if(!o||!a||n.state.selection.$from.node().type.spec.code)return!1;const l=a.getData("text/plain"),c=a.getData("vscode-editor-data");if(c){const y=(g=JSON.parse(c))==null?void 0:g.mode;if(l&&y){const{tr:v}=n.state,b=Udt("code_block",e);return v.replaceSelectionWith(b.create({language:y})).setSelection(mt.near(v.doc.resolve(Math.max(0,v.selection.from-2)))).insertText(l.replace(/\r\n?/g,`
|
||
`)),n.dispatch(v),!0}}const u=a.getData("text/html");if(u.length===0&&l.length===0)return!1;if(u.length>0&&i)return Koe(n,i);const d=ny.fromSchema(e);let h;if(u.length===0){const y=s(l);if(!y||typeof y=="string")return!1;h=E0.fromSchema(e).serializeFragment(y.content)}else{const y=document.createElement("template");y.innerHTML=u,h=y.content.cloneNode(!0),y.remove()}return Koe(n,d.parseSlice(h))},clipboardTextSerializer:n=>{const r=t.get(g1);if(tF(n.content.toJSON()))return n.content.textBetween(0,n.content.size,`
|
||
|
||
`);const i=e.topNodeType.createAndFill(void 0,n.content);return i?r(i):""}}})});s3t(iCe,{displayName:"Prose<clipboard>"});function E2(t,e){return Object.assign(t,{meta:{package:"@milkdown/plugin-history",...e}}),t}var JG=bt("Undo",()=>()=>PR);E2(JG,{displayName:"Command<undo>"});var eK=bt("Redo",()=>()=>yx);E2(eK,{displayName:"Command<redo>"});var tK=xn({},"historyProviderConfig");E2(tK,{displayName:"Ctx<historyProviderConfig>"});var sCe=Sr(t=>e2t(t.get(tK.key)));E2(sCe,{displayName:"Ctx<historyProviderPlugin>"});var nK=ka("historyKeymap",{Undo:{shortcuts:"Mod-z",command:t=>{const e=t.get(je);return()=>e.call(JG.key)}},Redo:{shortcuts:["Mod-y","Shift-Mod-z"],command:t=>{const e=t.get(je);return()=>e.call(eK.key)}}});E2(nK.ctx,{displayName:"KeymapCtx<history>"});E2(nK.shortcuts,{displayName:"Keymap<history>"});var o3t=[tK,sCe,nK,JG,eK].flat();function a3t(t,e){const{doc:n,selection:r}=t;if(!n||!r||!(r instanceof mt||r instanceof pa))return t;const{to:i}=r,s=e.type==="space"?Array(e.size).fill(" ").join(""):" ";return t.insertText(s,i)}var nM=xn({type:"space",size:2},"indentConfig");nM.meta={package:"@milkdown/plugin-indent",displayName:"Ctx<indentConfig>"};var oCe=H4e(t=>({Tab:(e,n)=>{const r=t.get(nM.key),{tr:i}=e,s=a3t(i,r);return s.docChanged?(n==null||n(s),!0):!1}}));oCe.meta={package:"@milkdown/plugin-indent",displayName:"Shortcut<indent>"};var l3t=[nM,oCe],aCe=class{constructor(){this.beforeMountedListeners=[],this.mountedListeners=[],this.updatedListeners=[],this.selectionUpdatedListeners=[],this.markdownUpdatedListeners=[],this.blurListeners=[],this.focusListeners=[],this.destroyListeners=[],this.beforeMount=t=>(this.beforeMountedListeners.push(t),this),this.mounted=t=>(this.mountedListeners.push(t),this),this.updated=t=>(this.updatedListeners.push(t),this)}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners,selectionUpdated:this.selectionUpdatedListeners}}markdownUpdated(t){return this.markdownUpdatedListeners.push(t),this}blur(t){return this.blurListeners.push(t),this}focus(t){return this.focusListeners.push(t),this}destroy(t){return this.destroyListeners.push(t),this}selectionUpdated(t){return this.selectionUpdatedListeners.push(t),this}},U8=fn(new aCe,"listener"),c3t=new Vn("MILKDOWN_LISTENER"),lCe=t=>(t.inject(U8,new aCe),async()=>{await t.wait(m1);const{listeners:e}=t.get(U8);e.beforeMount.forEach(c=>c(t)),await t.wait(Q_);const n=t.get(g1);let r=null,i=null,s=null,o=null;const a=DI(()=>{if(!o)return;const{doc:c}=o;if(e.updated.length>0&&r&&!r.eq(c)&&e.updated.forEach(u=>{u(t,c,r)}),e.markdownUpdated.length>0&&r&&!r.eq(c)){const u=n(c);e.markdownUpdated.forEach(d=>{d(t,u,i)}),i=u}r=c,o=null},200),l=new Fn({key:c3t,view:()=>({destroy:()=>{e.destroy.forEach(c=>c(t))}}),props:{handleDOMEvents:{focus:()=>(e.focus.forEach(c=>c(t)),!1),blur:()=>(e.blur.forEach(c=>c(t)),!1)}},state:{init:(c,u)=>{r=u.doc,i=n(u.doc)},apply:c=>{const u=c.selection;(!s&&u||s&&!u.eq(s))&&(e.selectionUpdated.forEach(d=>{d(t,u,s)}),s=u),!(!(c.docChanged||c.storedMarksSet)||c.getMeta("addToHistory")===!1)&&(o=c,a())}}});t.update(Qm,c=>c.concat(l)),await t.wait(k6),e.mounted.forEach(c=>c(t))});lCe.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};var rK=xn({shouldAppend:t=>!(!t||["heading","paragraph"].includes(t.type.name)),getNode:t=>t.schema.nodes.paragraph.create()},"trailingConfig");rK.meta={package:"@milkdown/plugin-trailing",displayName:"Ctx<trailingConfig>"};var cCe=Sr(t=>{const e=new Vn("MILKDOWN_TRAILING"),{shouldAppend:n,getNode:r}=t.get(rK.key),i=new Fn({key:e,state:{init:(s,o)=>{const a=o.tr.doc.lastChild;return n(a,o)},apply:(s,o,a,l)=>{if(!s.docChanged)return o;const c=s.doc.lastChild;return n(c,l)}},appendTransaction:(s,o,a)=>{const{doc:l,tr:c}=a,u=r==null?void 0:r(a),d=i.getState(a),h=l.content.size;if(!(!d||!u))return c.insert(h,u)}});return i});cCe.meta={package:"@milkdown/plugin-trailing",displayName:"Prose<trailing>"};var u3t=[rK,cCe];function d3t(t){return new Promise(e=>{const n=new FileReader;n.addEventListener("load",()=>{e({alt:t.name,src:n.result})},!1),n.readAsDataURL(t)})}var h3t=async(t,e)=>{const n=[];for(let i=0;i<t.length;i++){const s=t.item(i);s&&s.type.includes("image")&&n.push(s)}const{image:r}=e.nodes;if(!r)throw mxe("image");return(await Promise.all(n.map(i=>d3t(i)))).map(({alt:i,src:s})=>r.createAndFill({src:s,alt:i}))},Tb=xn({uploader:h3t,enableHtmlFileUploader:!1,uploadWidgetFactory:(t,e)=>{const n=document.createElement("span");return n.textContent="Upload in progress...",sr.widget(t,n,e)}},"uploadConfig");Tb.meta={package:"@milkdown/plugin-upload",displayName:"Ctx<uploadConfig>"};var uCe=Sr(t=>{const e=new Vn("MILKDOWN_UPLOAD"),n=(i,s)=>{var l;const o=e.getState(i);if(!o)return-1;const a=o.find(void 0,void 0,c=>c.id===s);return a.length?((l=a[0])==null?void 0:l.from)??-1:-1},r=(i,s,o)=>{var p;if(!o||o.length<=0)return!1;const a=Symbol("upload symbol"),l=t.get(Fc),{uploader:c,getInsertPos:u}=t.get(Tb.key),{tr:d}=i.state,h=s instanceof DragEvent?((p=i.posAtCoords({left:s.clientX,top:s.clientY}))==null?void 0:p.pos)??d.selection.from:d.selection.from,f=typeof u=="function"?u(s,t,h):h;return i.dispatch(d.setMeta(e,{add:{id:a,pos:f}})),c(o,l,t,f).then(g=>{const y=n(i.state,a);y<0||i.dispatch(i.state.tr.replaceWith(y,y,g).setMeta(e,{remove:{id:a}}))}).catch(g=>{console.error(g)}),!0};return new Fn({key:e,state:{init(){return En.empty},apply(i,s){const o=s.map(i.mapping,i.doc),a=i.getMeta(this);if(!a)return o;if(a.add){const{uploadWidgetFactory:l}=t.get(Tb.key),c=l(a.add.pos,{id:a.add.id});return o.add(i.doc,[c])}if(a.remove){const l=o.find(void 0,void 0,c=>c.id===a.remove.id);return o.remove(l)}return o}},props:{decorations(i){return this.getState(i)},handlePaste:(i,s)=>{var a,l;const{enableHtmlFileUploader:o}=t.get(Tb.key);return!(s instanceof ClipboardEvent)||!o&&((a=s.clipboardData)!=null&&a.getData("text/html"))?!1:r(i,s,(l=s.clipboardData)==null?void 0:l.files)},handleDrop:(i,s)=>{var o;return s instanceof DragEvent?r(i,s,(o=s.dataTransfer)==null?void 0:o.files):!1}}})});uCe.meta={package:"@milkdown/plugin-upload",displayName:"Prose<upload>"};var f3t=[Tb,uCe],yn=(t=>(t.CodeMirror="code-mirror",t.ListItem="list-item",t.LinkTooltip="link-tooltip",t.Cursor="cursor",t.ImageBlock="image-block",t.BlockEdit="block-edit",t.Toolbar="toolbar",t.Placeholder="placeholder",t.Table="table",t.Latex="latex",t.TopBar="top-bar",t.AI="ai",t))(yn||{});const p3t={cursor:!0,"list-item":!0,"link-tooltip":!0,"image-block":!0,"block-edit":!0,placeholder:!0,toolbar:!0,"code-mirror":!0,table:!0,latex:!0,"top-bar":!1,ai:!1},iK=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
fill="currentColor"
|
||
d="M19 9l1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25zm0 14l1.25-2.75L23 19l-2.75-1.25L19 15l-1.25 2.75L15 19l2.75 1.25zM9 20l3-6.5L18 10l-6-3.5L9 0L6 6.5L0 10l6 3.5z"
|
||
transform="translate(3 3) scale(0.75)"
|
||
/>
|
||
</svg>
|
||
`,m3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
d="M4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25ZM8.25 16.625C8.0375 16.625 7.85942 16.5531 7.71575 16.4093C7.57192 16.2654 7.5 16.0872 7.5 15.8748C7.5 15.6621 7.57192 15.484 7.71575 15.3405C7.85942 15.1968 8.0375 15.125 8.25 15.125H15.75C15.9625 15.125 16.1406 15.1969 16.2843 15.3408C16.4281 15.4846 16.5 15.6628 16.5 15.8753C16.5 16.0879 16.4281 16.266 16.2843 16.4095C16.1406 16.5532 15.9625 16.625 15.75 16.625H8.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM8.25 8.875C8.0375 8.875 7.85942 8.80308 7.71575 8.65925C7.57192 8.51542 7.5 8.33725 7.5 8.12475C7.5 7.91208 7.57192 7.734 7.71575 7.5905C7.85942 7.44683 8.0375 7.375 8.25 7.375H15.75C15.9625 7.375 16.1406 7.44692 16.2843 7.59075C16.4281 7.73458 16.5 7.91275 16.5 8.12525C16.5 8.33792 16.4281 8.516 16.2843 8.6595C16.1406 8.80317 15.9625 8.875 15.75 8.875H8.25ZM4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25Z"
|
||
/>
|
||
</svg>
|
||
`,g3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
d="M4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25ZM4.25 16.625C4.0375 16.625 3.85942 16.5531 3.71575 16.4093C3.57192 16.2654 3.5 16.0872 3.5 15.8748C3.5 15.6621 3.57192 15.484 3.71575 15.3405C3.85942 15.1968 4.0375 15.125 4.25 15.125H13.75C13.9625 15.125 14.1406 15.1969 14.2843 15.3408C14.4281 15.4846 14.5 15.6628 14.5 15.8753C14.5 16.0879 14.4281 16.266 14.2843 16.4095C14.1406 16.5532 13.9625 16.625 13.75 16.625H4.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM4.25 8.875C4.0375 8.875 3.85942 8.80308 3.71575 8.65925C3.57192 8.51542 3.5 8.33725 3.5 8.12475C3.5 7.91208 3.57192 7.734 3.71575 7.5905C3.85942 7.44683 4.0375 7.375 4.25 7.375H13.75C13.9625 7.375 14.1406 7.44692 14.2843 7.59075C14.4281 7.73458 14.5 7.91275 14.5 8.12525C14.5 8.33792 14.4281 8.516 14.2843 8.6595C14.1406 8.80317 13.9625 8.875 13.75 8.875H4.25ZM4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25Z"
|
||
/>
|
||
</svg>
|
||
`,y3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
d="M4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25ZM10.25 8.875C10.0375 8.875 9.85942 8.80308 9.71575 8.65925C9.57192 8.51542 9.5 8.33725 9.5 8.12475C9.5 7.91208 9.57192 7.734 9.71575 7.5905C9.85942 7.44683 10.0375 7.375 10.25 7.375H19.75C19.9625 7.375 20.1406 7.44692 20.2843 7.59075C20.4281 7.73458 20.5 7.91275 20.5 8.12525C20.5 8.33792 20.4281 8.516 20.2843 8.6595C20.1406 8.80317 19.9625 8.875 19.75 8.875H10.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM10.25 16.625C10.0375 16.625 9.85942 16.5531 9.71575 16.4093C9.57192 16.2654 9.5 16.0872 9.5 15.8748C9.5 15.6621 9.57192 15.484 9.71575 15.3405C9.85942 15.1968 10.0375 15.125 10.25 15.125H19.75C19.9625 15.125 20.1406 15.1969 20.2843 15.3408C20.4281 15.4846 20.5 15.6628 20.5 15.8753C20.5 16.0879 20.4281 16.266 20.2843 16.4095C20.1406 16.5532 19.9625 16.625 19.75 16.625H10.25ZM4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25Z"
|
||
/>
|
||
</svg>
|
||
`,dCe=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
d="M8.85758 18.625C8.4358 18.625 8.07715 18.4772 7.78163 18.1817C7.48613 17.8862 7.33838 17.5275 7.33838 17.1058V6.8942C7.33838 6.47242 7.48613 6.11377 7.78163 5.81825C8.07715 5.52275 8.4358 5.375 8.85758 5.375H12.1999C13.2191 5.375 14.1406 5.69231 14.9643 6.32693C15.788 6.96154 16.1999 7.81603 16.1999 8.89038C16.1999 9.63779 16.0194 10.2471 15.6585 10.7183C15.2976 11.1894 14.9088 11.5314 14.4922 11.7442C15.005 11.9211 15.4947 12.2708 15.9614 12.7933C16.428 13.3157 16.6614 14.0192 16.6614 14.9038C16.6614 16.182 16.1902 17.1217 15.2479 17.723C14.3056 18.3243 13.3563 18.625 12.3999 18.625H8.85758ZM9.4883 16.6327H12.3191C13.1063 16.6327 13.6627 16.4141 13.9884 15.9769C14.314 15.5397 14.4768 15.1205 14.4768 14.7192C14.4768 14.3179 14.314 13.8987 13.9884 13.4615C13.6627 13.0243 13.0909 12.8057 12.273 12.8057H9.4883V16.6327ZM9.4883 10.875H12.0826C12.6903 10.875 13.172 10.7013 13.5278 10.3539C13.8836 10.0064 14.0615 9.59037 14.0615 9.10575C14.0615 8.59035 13.8733 8.16918 13.497 7.84225C13.1207 7.51533 12.6595 7.35188 12.1133 7.35188H9.4883V10.875Z"
|
||
/>
|
||
</svg>
|
||
`,v3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_952_6527)">
|
||
<circle cx="12" cy="12" r="3" />
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_952_6527">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,hCe=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_977_8070)">
|
||
<path
|
||
d="M4 10.5C3.17 10.5 2.5 11.17 2.5 12C2.5 12.83 3.17 13.5 4 13.5C4.83 13.5 5.5 12.83 5.5 12C5.5 11.17 4.83 10.5 4 10.5ZM4 4.5C3.17 4.5 2.5 5.17 2.5 6C2.5 6.83 3.17 7.5 4 7.5C4.83 7.5 5.5 6.83 5.5 6C5.5 5.17 4.83 4.5 4 4.5ZM4 16.5C3.17 16.5 2.5 17.18 2.5 18C2.5 18.82 3.18 19.5 4 19.5C4.82 19.5 5.5 18.82 5.5 18C5.5 17.18 4.83 16.5 4 16.5ZM8 19H20C20.55 19 21 18.55 21 18C21 17.45 20.55 17 20 17H8C7.45 17 7 17.45 7 18C7 18.55 7.45 19 8 19ZM8 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11H8C7.45 11 7 11.45 7 12C7 12.55 7.45 13 8 13ZM7 6C7 6.55 7.45 7 8 7H20C20.55 7 21 6.55 21 6C21 5.45 20.55 5 20 5H8C7.45 5 7 5.45 7 6Z"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_977_8070">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,b3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="32"
|
||
height="32"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
fill="currentColor"
|
||
d="M9 22a1 1 0 0 1-1-1v-3H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6.1l-3.7 3.71c-.2.19-.45.29-.7.29zm1-6v3.08L13.08 16H20V4H4v12z"
|
||
/>
|
||
</svg>
|
||
`,w3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_1803_1151)">
|
||
<path
|
||
d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM10.71 16.29C10.32 16.68 9.69 16.68 9.3 16.29L5.71 12.7C5.32 12.31 5.32 11.68 5.71 11.29C6.1 10.9 6.73 10.9 7.12 11.29L10 14.17L16.88 7.29C17.27 6.9 17.9 6.9 18.29 7.29C18.68 7.68 18.68 8.31 18.29 8.7L10.71 16.29Z"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_1803_1151">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,x3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_1803_535)">
|
||
<path
|
||
d="M18 19H6C5.45 19 5 18.55 5 18V6C5 5.45 5.45 5 6 5H18C18.55 5 19 5.45 19 6V18C19 18.55 18.55 19 18 19ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3Z"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_1803_535">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,sK=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
fill="none"
|
||
viewBox="0 0 24 24"
|
||
stroke-width="1.5"
|
||
stroke="currentColor"
|
||
class="w-6 h-6"
|
||
>
|
||
<path
|
||
stroke-linecap="round"
|
||
stroke-linejoin="round"
|
||
d="M19.5 8.25l-7.5 7.5-7.5-7.5"
|
||
/>
|
||
</svg>
|
||
`,_3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
fill="none"
|
||
viewBox="0 0 24 24"
|
||
stroke-width="1.5"
|
||
stroke="currentColor"
|
||
>
|
||
<path
|
||
stroke-linecap="round"
|
||
stroke-linejoin="round"
|
||
d="M15.75 19.5L8.25 12l7.5-7.5"
|
||
/>
|
||
</svg>
|
||
`,S3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
fill="none"
|
||
viewBox="0 0 24 24"
|
||
stroke-width="1.5"
|
||
stroke="currentColor"
|
||
>
|
||
<path
|
||
stroke-linecap="round"
|
||
stroke-linejoin="round"
|
||
d="M8.25 4.5l7.5 7.5-7.5 7.5"
|
||
/>
|
||
</svg>
|
||
`,oK=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_1098_15553)">
|
||
<path
|
||
d="M18.3007 5.70973C17.9107 5.31973 17.2807 5.31973 16.8907 5.70973L12.0007 10.5897L7.1107 5.69973C6.7207 5.30973 6.0907 5.30973 5.7007 5.69973C5.3107 6.08973 5.3107 6.71973 5.7007 7.10973L10.5907 11.9997L5.7007 16.8897C5.3107 17.2797 5.3107 17.9097 5.7007 18.2997C6.0907 18.6897 6.7207 18.6897 7.1107 18.2997L12.0007 13.4097L16.8907 18.2997C17.2807 18.6897 17.9107 18.6897 18.3007 18.2997C18.6907 17.9097 18.6907 17.2797 18.3007 16.8897L13.4107 11.9997L18.3007 7.10973C18.6807 6.72973 18.6807 6.08973 18.3007 5.70973Z"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_1098_15553">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,aK=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_977_8081)">
|
||
<path
|
||
d="M9.4 16.6L4.8 12L9.4 7.4L8 6L2 12L8 18L9.4 16.6ZM14.6 16.6L19.2 12L14.6 7.4L16 6L22 12L16 18L14.6 16.6Z"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_977_8081">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,k3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
d="M3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm1 2v14h16V5H4zm8 10h6v2h-6v-2zm-3.333-3L5.838 9.172l1.415-1.415L11.495 12l-4.242 4.243-1.415-1.415L8.667 12z"
|
||
/>
|
||
</svg>
|
||
`,rM=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
fill="none"
|
||
>
|
||
<g clip-path="url(#clip0_1013_1606)">
|
||
<path
|
||
d="M9.00012 16.1998L5.50012 12.6998C5.11012 12.3098 4.49012 12.3098 4.10012 12.6998C3.71012 13.0898 3.71012 13.7098 4.10012 14.0998L8.29012 18.2898C8.68012 18.6798 9.31012 18.6798 9.70012 18.2898L20.3001 7.69982C20.6901 7.30982 20.6901 6.68982 20.3001 6.29982C19.9101 5.90982 19.2901 5.90982 18.9001 6.29982L9.00012 16.1998Z"
|
||
fill="#817567"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_1013_1606">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,fCe=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
height="24px"
|
||
viewBox="0 -960 960 960"
|
||
width="24px"
|
||
fill="none"
|
||
>
|
||
<path
|
||
d="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"
|
||
/>
|
||
</svg>
|
||
`,pCe=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_977_7900)">
|
||
<path
|
||
fill-rule="evenodd"
|
||
clip-rule="evenodd"
|
||
d="M19 13H5C4.45 13 4 12.55 4 12C4 11.45 4.45 11 5 11H19C19.55 11 20 11.45 20 12C20 12.55 19.55 13 19 13Z"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_977_7900">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,Yoe=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="16"
|
||
height="16"
|
||
viewBox="0 0 16 16"
|
||
>
|
||
<path
|
||
d="M3.5 9.83366C3.35833 9.83366 3.23961 9.78571 3.14383 9.68983C3.04794 9.59394 3 9.47516 3 9.33349C3 9.19171 3.04794 9.07299 3.14383 8.97733C3.23961 8.88155 3.35833 8.83366 3.5 8.83366H12.5C12.6417 8.83366 12.7604 8.8816 12.8562 8.97749C12.9521 9.07338 13 9.19216 13 9.33383C13 9.4756 12.9521 9.59433 12.8562 9.68999C12.7604 9.78577 12.6417 9.83366 12.5 9.83366H3.5ZM3.5 7.16699C3.35833 7.16699 3.23961 7.11905 3.14383 7.02316C3.04794 6.92727 3 6.80849 3 6.66683C3 6.52505 3.04794 6.40633 3.14383 6.31066C3.23961 6.21488 3.35833 6.16699 3.5 6.16699H12.5C12.6417 6.16699 12.7604 6.21494 12.8562 6.31083C12.9521 6.40671 13 6.52549 13 6.66716C13 6.80894 12.9521 6.92766 12.8562 7.02333C12.7604 7.1191 12.6417 7.16699 12.5 7.16699H3.5Z"
|
||
/>
|
||
</svg>
|
||
`,zk=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_1013_1585)">
|
||
<path
|
||
d="M14.06 9.02L14.98 9.94L5.92 19H5V18.08L14.06 9.02ZM17.66 3C17.41 3 17.15 3.1 16.96 3.29L15.13 5.12L18.88 8.87L20.71 7.04C21.1 6.65 21.1 6.02 20.71 5.63L18.37 3.29C18.17 3.09 17.92 3 17.66 3ZM14.06 6.19L3 17.25V21H6.75L17.81 9.94L14.06 6.19Z"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_1013_1585">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,mCe=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
fill="currentColor"
|
||
d="M9 16l-5-5l5-5l1.4 1.4L7.825 10H18V6h2v6H7.825l2.575 2.6z"
|
||
/>
|
||
</svg>
|
||
`,C3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
fill="currentColor"
|
||
d="M9.55 17.575L4.225 12.25l1.4-1.425L9.55 14.75l8.825-8.825l1.4 1.425z"
|
||
/>
|
||
</svg>
|
||
`,E3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_992_5553)">
|
||
<path
|
||
d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM12 17H14V7H10V9H12V17Z"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_992_5553">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,T3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_992_5559)">
|
||
<path
|
||
d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15H11V13H13C14.1 13 15 12.11 15 11V9C15 7.89 14.1 7 13 7H9V9H13V11H11C9.9 11 9 11.89 9 13V17H15V15Z"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_992_5559">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,A3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_992_5565)">
|
||
<path
|
||
d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15V13.5C15 12.67 14.33 12 13.5 12C14.33 12 15 11.33 15 10.5V9C15 7.89 14.1 7 13 7H9V9H13V11H11V13H13V15H9V17H13C14.1 17 15 16.11 15 15Z"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_992_5565">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,I3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_977_7757)">
|
||
<path
|
||
d="M19.04 3H5.04004C3.94004 3 3.04004 3.9 3.04004 5V19C3.04004 20.1 3.94004 21 5.04004 21H19.04C20.14 21 21.04 20.1 21.04 19V5C21.04 3.9 20.14 3 19.04 3ZM19.04 19H5.04004V5H19.04V19ZM13.04 17H15.04V7H13.04V11H11.04V7H9.04004V13H13.04V17Z"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_977_7757">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,R3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_977_7760)">
|
||
<path
|
||
d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15V13C15 11.89 14.1 11 13 11H11V9H15V7H9V13H13V15H9V17H13C14.1 17 15 16.11 15 15Z"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_977_7760">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,M3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_977_7763)">
|
||
<path
|
||
d="M11 17H13C14.1 17 15 16.11 15 15V13C15 11.89 14.1 11 13 11H11V9H15V7H11C9.9 7 9 7.89 9 9V15C9 16.11 9.9 17 11 17ZM11 13H13V15H11V13ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19Z"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_977_7763">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,q8=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_977_8075)">
|
||
<path
|
||
d="M19 5V19H5V5H19ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM14.14 11.86L11.14 15.73L9 13.14L6 17H18L14.14 11.86Z"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_977_8075">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,gCe=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
d="M6.29811 18.625C6.04505 18.625 5.83115 18.5375 5.65641 18.3626C5.48166 18.1877 5.39429 17.9736 5.39429 17.7203C5.39429 17.467 5.48166 17.2532 5.65641 17.0788C5.83115 16.9045 6.04505 16.8173 6.29811 16.8173H9.21159L12.452 7.18265H9.53851C9.28545 7.18265 9.07155 7.0952 8.89681 6.9203C8.72206 6.7454 8.63469 6.5313 8.63469 6.278C8.63469 6.02472 8.72206 5.81089 8.89681 5.63652C9.07155 5.46217 9.28545 5.375 9.53851 5.375H16.8847C17.1377 5.375 17.3516 5.46245 17.5264 5.63735C17.7011 5.81225 17.7885 6.02634 17.7885 6.27962C17.7885 6.53293 17.7011 6.74676 17.5264 6.92113C17.3516 7.09548 17.1377 7.18265 16.8847 7.18265H14.2789L11.0385 16.8173H13.6443C13.8973 16.8173 14.1112 16.9048 14.286 17.0797C14.4607 17.2546 14.5481 17.4687 14.5481 17.722C14.5481 17.9752 14.4607 18.1891 14.286 18.3634C14.1112 18.5378 13.8973 18.625 13.6443 18.625H6.29811Z"
|
||
/>
|
||
</svg>
|
||
`,yCe=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
d="M17.0385 19.5003V16.5388H14.0769V15.0388H17.0385V12.0773H18.5384V15.0388H21.5V16.5388H18.5384V19.5003H17.0385ZM10.8077 16.5388H7.03845C5.78282 16.5388 4.7125 16.0963 3.8275 15.2114C2.9425 14.3266 2.5 13.2564 2.5 12.0009C2.5 10.7454 2.9425 9.67504 3.8275 8.78979C4.7125 7.90454 5.78282 7.46191 7.03845 7.46191H10.8077V8.96186H7.03845C6.1987 8.96186 5.48235 9.25834 4.8894 9.85129C4.29645 10.4442 3.99998 11.1606 3.99998 12.0003C3.99998 12.8401 4.29645 13.5564 4.8894 14.1494C5.48235 14.7423 6.1987 15.0388 7.03845 15.0388H10.8077V16.5388ZM8.25 12.7503V11.2504H15.75V12.7503H8.25ZM21.5 12.0003H20C20 11.1606 19.7035 10.4442 19.1106 9.85129C18.5176 9.25834 17.8013 8.96186 16.9615 8.96186H13.1923V7.46191H16.9615C18.2171 7.46191 19.2875 7.90441 20.1725 8.78939C21.0575 9.67439 21.5 10.7447 21.5 12.0003Z"
|
||
/>
|
||
</svg>
|
||
`,N3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
fill="currentColor"
|
||
d="M3 18v-2h13v2zm0-5v-2h18v2zm0-5V6h18v2zm15 13v-3h-3v-2h3v-3h2v3h3v2h-3v3z"
|
||
/>
|
||
</svg>
|
||
`,O3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_971_7680)">
|
||
<path
|
||
d="M11 18C11 19.1 10.1 20 9 20C7.9 20 7 19.1 7 18C7 16.9 7.9 16 9 16C10.1 16 11 16.9 11 18ZM9 10C7.9 10 7 10.9 7 12C7 13.1 7.9 14 9 14C10.1 14 11 13.1 11 12C11 10.9 10.1 10 9 10ZM9 4C7.9 4 7 4.9 7 6C7 7.1 7.9 8 9 8C10.1 8 11 7.1 11 6C11 4.9 10.1 4 9 4ZM15 8C16.1 8 17 7.1 17 6C17 4.9 16.1 4 15 4C13.9 4 13 4.9 13 6C13 7.1 13.9 8 15 8ZM15 10C13.9 10 13 10.9 13 12C13 13.1 13.9 14 15 14C16.1 14 17 13.1 17 12C17 10.9 16.1 10 15 10ZM15 16C13.9 16 13 16.9 13 18C13 19.1 13.9 20 15 20C16.1 20 17 19.1 17 18C17 16.9 16.1 16 15 16Z"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_971_7680">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,vCe=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_977_8067)">
|
||
<path
|
||
d="M8 7H20C20.55 7 21 6.55 21 6C21 5.45 20.55 5 20 5H8C7.45 5 7 5.45 7 6C7 6.55 7.45 7 8 7ZM20 17H8C7.45 17 7 17.45 7 18C7 18.55 7.45 19 8 19H20C20.55 19 21 18.55 21 18C21 17.45 20.55 17 20 17ZM20 11H8C7.45 11 7 11.45 7 12C7 12.55 7.45 13 8 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11ZM4.5 16H2.5C2.22 16 2 16.22 2 16.5C2 16.78 2.22 17 2.5 17H4V17.5H3.5C3.22 17.5 3 17.72 3 18C3 18.28 3.22 18.5 3.5 18.5H4V19H2.5C2.22 19 2 19.22 2 19.5C2 19.78 2.22 20 2.5 20H4.5C4.78 20 5 19.78 5 19.5V16.5C5 16.22 4.78 16 4.5 16ZM2.5 5H3V7.5C3 7.78 3.22 8 3.5 8C3.78 8 4 7.78 4 7.5V4.5C4 4.22 3.78 4 3.5 4H2.5C2.22 4 2 4.22 2 4.5C2 4.78 2.22 5 2.5 5ZM4.5 10H2.5C2.22 10 2 10.22 2 10.5C2 10.78 2.22 11 2.5 11H3.8L2.12 12.96C2.04 13.05 2 13.17 2 13.28V13.5C2 13.78 2.22 14 2.5 14H4.5C4.78 14 5 13.78 5 13.5C5 13.22 4.78 13 4.5 13H3.2L4.88 11.04C4.96 10.95 5 10.83 5 10.72V10.5C5 10.22 4.78 10 4.5 10Z"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_977_8067">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,nF=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_971_7676)">
|
||
<path
|
||
d="M18 13H13V18C13 18.55 12.55 19 12 19C11.45 19 11 18.55 11 18V13H6C5.45 13 5 12.55 5 12C5 11.45 5.45 11 6 11H11V6C11 5.45 11.45 5 12 5C12.55 5 13 5.45 13 6V11H18C18.55 11 19 11.45 19 12C19 12.55 18.55 13 18 13Z"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_971_7676">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,bCe=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_977_7897)">
|
||
<path
|
||
d="M7.17 17C7.68 17 8.15 16.71 8.37 16.26L9.79 13.42C9.93 13.14 10 12.84 10 12.53V8C10 7.45 9.55 7 9 7H5C4.45 7 4 7.45 4 8V12C4 12.55 4.45 13 5 13H7L5.97 15.06C5.52 15.95 6.17 17 7.17 17ZM17.17 17C17.68 17 18.15 16.71 18.37 16.26L19.79 13.42C19.93 13.14 20 12.84 20 12.53V8C20 7.45 19.55 7 19 7H15C14.45 7 14 7.45 14 8V12C14 12.55 14.45 13 15 13H17L15.97 15.06C15.52 15.95 16.17 17 17.17 17Z"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_977_7897">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,rF=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
d="M7.30775 20.4997C6.81058 20.4997 6.385 20.3227 6.031 19.9687C5.677 19.6147 5.5 19.1892 5.5 18.692V5.99973H5.25C5.0375 5.99973 4.85942 5.92782 4.71575 5.78398C4.57192 5.64015 4.5 5.46198 4.5 5.24948C4.5 5.03682 4.57192 4.85873 4.71575 4.71523C4.85942 4.57157 5.0375 4.49973 5.25 4.49973H9C9 4.2549 9.08625 4.04624 9.25875 3.87374C9.43108 3.7014 9.63967 3.61523 9.8845 3.61523H14.1155C14.3603 3.61523 14.5689 3.7014 14.7413 3.87374C14.9138 4.04624 15 4.2549 15 4.49973H18.75C18.9625 4.49973 19.1406 4.57165 19.2843 4.71548C19.4281 4.85932 19.5 5.03748 19.5 5.24998C19.5 5.46265 19.4281 5.64073 19.2843 5.78423C19.1406 5.9279 18.9625 5.99973 18.75 5.99973H18.5V18.692C18.5 19.1892 18.323 19.6147 17.969 19.9687C17.615 20.3227 17.1894 20.4997 16.6923 20.4997H7.30775ZM17 5.99973H7V18.692C7 18.7818 7.02883 18.8556 7.0865 18.9132C7.14417 18.9709 7.21792 18.9997 7.30775 18.9997H16.6923C16.7821 18.9997 16.8558 18.9709 16.9135 18.9132C16.9712 18.8556 17 18.7818 17 18.692V5.99973ZM10.1543 16.9997C10.3668 16.9997 10.5448 16.9279 10.6885 16.7842C10.832 16.6404 10.9037 16.4622 10.9037 16.2497V8.74973C10.9037 8.53723 10.8318 8.35907 10.688 8.21523C10.5443 8.07157 10.3662 7.99973 10.1535 7.99973C9.941 7.99973 9.76292 8.07157 9.61925 8.21523C9.47575 8.35907 9.404 8.53723 9.404 8.74973V16.2497C9.404 16.4622 9.47583 16.6404 9.6195 16.7842C9.76333 16.9279 9.94158 16.9997 10.1543 16.9997ZM13.8465 16.9997C14.059 16.9997 14.2371 16.9279 14.3807 16.7842C14.5243 16.6404 14.596 16.4622 14.596 16.2497V8.74973C14.596 8.53723 14.5242 8.35907 14.3805 8.21523C14.2367 8.07157 14.0584 7.99973 13.8458 7.99973C13.6333 7.99973 13.4552 8.07157 13.3115 8.21523C13.168 8.35907 13.0962 8.53723 13.0962 8.74973V16.2497C13.0962 16.4622 13.1682 16.6404 13.312 16.7842C13.4557 16.9279 13.6338 16.9997 13.8465 16.9997Z"
|
||
/>
|
||
</svg>
|
||
`,D3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
fill="currentColor"
|
||
d="M12 20q-3.35 0-5.675-2.325T4 12q0-3.35 2.325-5.675T12 4q1.725 0 3.3.713T18 6.75V4h2v7h-7V9h4.2q-.8-1.4-2.187-2.2T12 6Q9.5 6 7.75 7.75T6 12q0 2.5 1.75 4.25T12 18q1.925 0 3.475-1.1T17.65 14h2.1q-.7 2.65-2.85 4.325T12 20"
|
||
/>
|
||
</svg>
|
||
`,wCe=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
fill="none"
|
||
viewBox="0 0 24 24"
|
||
stroke-width="1.5"
|
||
stroke="currentColor"
|
||
class="w-6 h-6"
|
||
>
|
||
<path
|
||
stroke-linecap="round"
|
||
stroke-linejoin="round"
|
||
d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"
|
||
/>
|
||
</svg>
|
||
`,P3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
fill="currentColor"
|
||
d="M11 20V7.825l-5.6 5.6L4 12l8-8l8 8l-1.4 1.425l-5.6-5.6V20z"
|
||
/>
|
||
</svg>
|
||
`,L3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
fill="currentColor"
|
||
d="M3 20v-6l8-2l-8-2V4l19 8z"
|
||
/>
|
||
</svg>
|
||
`,z3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
fill="currentColor"
|
||
d="M5 13v-2h14v2z"
|
||
/>
|
||
</svg>
|
||
`,xCe=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
d="M3.25 13.7404C3.0375 13.7404 2.85938 13.6684 2.71563 13.5246C2.57188 13.3808 2.5 13.2026 2.5 12.99C2.5 12.7774 2.57188 12.5993 2.71563 12.4558C2.85938 12.3122 3.0375 12.2404 3.25 12.2404H20.75C20.9625 12.2404 21.1406 12.3123 21.2843 12.4561C21.4281 12.5999 21.5 12.7781 21.5 12.9907C21.5 13.2033 21.4281 13.3814 21.2843 13.525C21.1406 13.6686 20.9625 13.7404 20.75 13.7404H3.25ZM10.9423 10.2596V6.62495H6.5673C6.2735 6.62495 6.02377 6.52201 5.8181 6.31613C5.61245 6.11026 5.50963 5.86027 5.50963 5.56615C5.50963 5.27205 5.61245 5.02083 5.8181 4.8125C6.02377 4.60417 6.2735 4.5 6.5673 4.5H17.4423C17.7361 4.5 17.9858 4.60294 18.1915 4.80883C18.3971 5.01471 18.5 5.2647 18.5 5.5588C18.5 5.85292 18.3971 6.10413 18.1915 6.31245C17.9858 6.52078 17.7361 6.62495 17.4423 6.62495H13.0673V10.2596H10.9423ZM10.9423 15.7211H13.0673V18.4423C13.0673 18.7361 12.9643 18.9858 12.7584 19.1915C12.5526 19.3971 12.3026 19.5 12.0085 19.5C11.7144 19.5 11.4631 19.3962 11.2548 19.1887C11.0465 18.9811 10.9423 18.7291 10.9423 18.4327V15.7211Z"
|
||
/>
|
||
</svg>
|
||
`,_Ce=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_977_8078)">
|
||
<path
|
||
d="M20 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H20C21.1 21 22 20.1 22 19V5C22 3.9 21.1 3 20 3ZM20 5V8H5V5H20ZM15 19H10V10H15V19ZM5 10H8V19H5V10ZM17 19V10H20V19H17Z"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_977_8078">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,j3t=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<g clip-path="url(#clip0_992_5547)">
|
||
<path
|
||
d="M5 5.5C5 6.33 5.67 7 6.5 7H10.5V17.5C10.5 18.33 11.17 19 12 19C12.83 19 13.5 18.33 13.5 17.5V7H17.5C18.33 7 19 6.33 19 5.5C19 4.67 18.33 4 17.5 4H6.5C5.67 4 5 4.67 5 5.5Z"
|
||
/>
|
||
</g>
|
||
<defs>
|
||
<clipPath id="clip0_992_5547">
|
||
<rect width="24" height="24" />
|
||
</clipPath>
|
||
</defs>
|
||
</svg>
|
||
`,SCe=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
d="M5.66936 16.3389L9.39244 12.6158C9.54115 12.4671 9.71679 12.3937 9.91936 12.3957C10.1219 12.3976 10.2975 12.4761 10.4463 12.6312C10.5847 12.7823 10.654 12.9585 10.654 13.1599C10.654 13.3613 10.5847 13.5363 10.4463 13.6851L6.32704 17.8197C6.14627 18.0004 5.93538 18.0908 5.69436 18.0908C5.45333 18.0908 5.24243 18.0004 5.06166 17.8197L3.01744 15.7754C2.87899 15.637 2.81136 15.4629 2.81456 15.2533C2.81776 15.0437 2.88859 14.8697 3.02706 14.7312C3.16551 14.5928 3.34008 14.5235 3.55076 14.5235C3.76144 14.5235 3.93494 14.5928 4.07126 14.7312L5.66936 16.3389ZM5.66936 8.72359L9.39244 5.00049C9.54115 4.85177 9.71679 4.77838 9.91936 4.78031C10.1219 4.78223 10.2975 4.86075 10.4463 5.01586C10.5847 5.16691 10.654 5.34314 10.654 5.54454C10.654 5.74592 10.5847 5.92097 10.4463 6.06969L6.32704 10.2043C6.14627 10.3851 5.93538 10.4755 5.69436 10.4755C5.45333 10.4755 5.24243 10.3851 5.06166 10.2043L3.01744 8.16009C2.87899 8.02162 2.81136 7.84759 2.81456 7.63799C2.81776 7.42837 2.88859 7.25433 3.02706 7.11586C3.16551 6.97741 3.34008 6.90819 3.55076 6.90819C3.76144 6.90819 3.93494 6.97741 4.07126 7.11586L5.66936 8.72359ZM13.7597 16.5581C13.5472 16.5581 13.3691 16.4862 13.2253 16.3424C13.0816 16.1986 13.0097 16.0204 13.0097 15.8078C13.0097 15.5952 13.0816 15.4171 13.2253 15.2735C13.3691 15.13 13.5472 15.0582 13.7597 15.0582H20.7597C20.9722 15.0582 21.1503 15.1301 21.2941 15.2739C21.4378 15.4177 21.5097 15.5959 21.5097 15.8085C21.5097 16.0211 21.4378 16.1992 21.2941 16.3427C21.1503 16.4863 20.9722 16.5581 20.7597 16.5581H13.7597ZM13.7597 8.94276C13.5472 8.94276 13.3691 8.87085 13.2253 8.72704C13.0816 8.58324 13.0097 8.40504 13.0097 8.19244C13.0097 7.97985 13.0816 7.80177 13.2253 7.65819C13.3691 7.5146 13.5472 7.44281 13.7597 7.44281H20.7597C20.9722 7.44281 21.1503 7.51471 21.2941 7.65851C21.4378 7.80233 21.5097 7.98053 21.5097 8.19311C21.5097 8.40571 21.4378 8.5838 21.2941 8.72739C21.1503 8.87097 20.9722 8.94276 20.7597 8.94276H13.7597Z"
|
||
/>
|
||
</svg>
|
||
`,Zoe=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="24"
|
||
height="24"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
fill="currentColor"
|
||
d="m12.9 16l-2.55-2.5l.05-.05q1.45-1.6 2.262-3.117T13.95 7H16V5h-6V3H8v2H2v2h9.1q-.5 1.2-1.225 2.387T8 11.7q-.6-.6-1.187-1.412T5.85 8.6H3.85q.5 1.4 1.3 2.7T6.95 13.7L2.85 17.75L4.25 19.15L8 15.4L10.55 17.95zM18.5 22h-2L21 10h2l4.5 12h-2l-1.05-3h-4.9zm1.6-5h3.6l-1.8-5.1z"
|
||
/>
|
||
</svg>
|
||
`,lK=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
width="32"
|
||
height="32"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
fill="currentColor"
|
||
d="M7 19v-.808L13.096 12L7 5.808V5h10v1.25H9.102L14.727 12l-5.625 5.77H17V19z"
|
||
/>
|
||
</svg>
|
||
`,kCe=`
|
||
<svg
|
||
xmlns="http://www.w3.org/2000/svg"
|
||
height="24px"
|
||
viewBox="0 -960 960 960"
|
||
width="24px"
|
||
>
|
||
<path
|
||
d="m644-428-58-58q9-47-27-88t-93-32l-58-58q17-8 34.5-12t37.5-4q75 0 127.5 52.5T660-500q0 20-4 37.5T644-428Zm128 126-58-56q38-29 67.5-63.5T832-500q-50-101-143.5-160.5T480-720q-29 0-57 4t-55 12l-62-62q41-17 84-25.5t90-8.5q151 0 269 83.5T920-500q-23 59-60.5 109.5T772-302Zm20 246L624-222q-35 11-70.5 16.5T480-200q-151 0-269-83.5T40-500q21-53 53-98.5t73-81.5L56-792l56-56 736 736-56 56ZM222-624q-29 26-53 57t-41 67q50 101 143.5 160.5T480-280q20 0 39-2.5t39-5.5l-36-38q-11 3-21 4.5t-21 1.5q-75 0-127.5-52.5T300-500q0-11 1.5-21t4.5-21l-84-82Zm319 93Zm-151 75Z"
|
||
/>
|
||
</svg>
|
||
`,B3t={[yn.CodeMirror]:{theme:xot,languages:uot,expandIcon:sK,searchIcon:wCe,clearSearchIcon:oK,searchPlaceholder:"Search language",noResultText:"No result",previewToggleIcon:t=>t?zk:kCe}},F3t=fn([],"FeaturesCtx"),V3t=fn({},"CrepeCtx");function $3t(t){return t.get("CrepeCtx")}function T2(t){return t.use("FeaturesCtx")}function uc(t){return e=>{T2(e).update(n=>n.includes(t)?n:[...n,t])}}function H3t(t,e){var n;const r=t.get(cn),i=t.get(g1),{state:s}=r,o=i(s.doc);let a="";if(!s.selection.empty){const{from:l,to:c}=s.selection,u=s.doc.slice(l,c),{schema:d}=s.doc.type;let h=d.topNodeType.createAndFill(null,u.content);if(!h){const f=(n=d.nodes.paragraph)==null?void 0:n.createAndFill(null,u.content);f&&(h=d.topNodeType.createAndFill(null,f))}a=h?i(h):s.doc.textBetween(l,c)}return{document:o,selection:a,instruction:e}}const kx=xn({provider:void 0,buildContext:void 0,diffReviewOnEnd:!0,onError:t=>{console.error(`[milkdown/ai] [${t.code}]`,t)},aiIcon:void 0},"aiProviderConfig"),Yi=xn({abortController:null,label:"",lastInstruction:"",lastLabel:void 0,lastFrom:-1,lastTo:-1,diffOwnedByAI:!1},"aiSession");function CCe(t,e){const n=t.get(kx.key);try{n.onError(e)}catch(r){console.error("[milkdown/ai] onError handler failed:",r)}}function W8(t){const e=t.get(Yi.key);t.set(Yi.key,{...e,abortController:null,label:""})}async function U3t(t,e,n,r){try{const i=e(n,r.signal),s=t.get(je);for await(const l of i){if(r.signal.aborted)break;s.call(kq.key,l)}if(r.signal.aborted)return;const o=t.get(kx.key);if(o.diffReviewOnEnd){const l=t.get(Yi.key);t.set(Yi.key,{...l,diffOwnedByAI:!0})}const a=s.call(Cq.key,{diffReview:o.diffReviewOnEnd});if(o.diffReviewOnEnd&&!a){const l=t.get(Yi.key);t.set(Yi.key,{...l,diffOwnedByAI:!1})}}catch(i){if(r.signal.aborted)return;const s=Mot(i);CCe(t,s),t.get(je).call(h2.key,{keep:!1})}finally{t.get(Yi.key).abortController===r&&W8(t)}}const cK=bt("RunAI",t=>e=>(n,r)=>{var i,s,o,a;if(!(e!=null&&e.instruction))return!1;const l=t.get(kx.key);if(!l.provider||t.get(Yi.key).abortController||(i=Ni.getState(n))!=null&&i.active||(s=Qr.getState(n))!=null&&s.active)return!1;if(!r)return!0;const u=new AbortController,{from:d,to:h}=n.selection;t.set(Yi.key,{abortController:u,label:(o=e.label)!=null?o:"",lastInstruction:e.instruction,lastLabel:e.label,lastFrom:d,lastTo:h,diffOwnedByAI:!1});const f=t.get(je),p=n.selection.empty?"cursor":"selection";if(!f.call(Sq.key,{insertAt:p}))return W8(t),!1;let g;try{g=((a=l.buildContext)!=null?a:H3t)(t,e.instruction)}catch(y){const v=Not(y);return CCe(t,v),f.call(h2.key,{keep:!1}),W8(t),!1}return U3t(t,l.provider,g,u),!0}),ECe=bt("AbortAI",t=>e=>(n,r)=>{var i;const s=t.get(Yi.key);return r?s.abortController?(s.abortController.abort(),W8(t),(i=Ni.getState(n))!=null&&i.active&&t.get(je).call(h2.key,e),!0):!1:!!s.abortController});var TCe=t=>{throw TypeError(t)},uK=(t,e,n)=>e.has(t)||TCe("Cannot "+n),ss=(t,e,n)=>(uK(t,e,"read from private field"),n?n.call(t):e.get(t)),gl=(t,e,n)=>e.has(t)?TCe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),wu=(t,e,n,r)=>(uK(t,e,"write to private field"),e.set(t,n),n),tv=(t,e,n)=>(uK(t,e,"access private method"),n),Y4,W6,Z4,jk,G6,K6,Mp,Sv,lp,ACe,Y6,ICe,iF,RCe,sF,oF;const Cx="milkdown-ai-diff-actions";function MCe(t,e){t.innerHTML=dl.sanitize(e.trim())}function q3t(t){const e=document.createElement("span");return e.className=`${Cx}-icon`,MCe(e,t),e}class W3t{constructor(e,n,r){this.ctx=e,gl(this,lp),gl(this,Y4),gl(this,W6),gl(this,Z4),gl(this,jk),gl(this,G6,!1),gl(this,K6,!1),gl(this,Mp,null),gl(this,Sv,!1),gl(this,iF,()=>{const o=this.ctx.get(Yi.key);if(!o.lastInstruction||!ss(this,Sv)||!tv(this,lp,RCe).call(this))return;const a=this.ctx.get(je);a.call(p8.key);const l=this.ctx.get(cn),{doc:c}=l.state,u=Math.min(Math.max(o.lastFrom,0),c.content.size),d=Math.min(Math.max(o.lastTo,0),c.content.size);l.dispatch(l.state.tr.setSelection(mt.create(l.state.doc,u,d))),a.call(cK.key,{instruction:o.lastInstruction,label:o.lastLabel})}),gl(this,sF,()=>{this.ctx.get(je).call(p8.key)}),gl(this,oF,()=>{this.ctx.get(je).call(aR.key)}),wu(this,jk,r),wu(this,W6,tv(this,lp,ACe).call(this,n));const i=document.createElement("div");i.className=Cx,i.dataset.show="false",wu(this,Z4,tv(this,lp,Y6).call(this,"retry",r.retryIcon,r.retryLabel,ss(this,iF))),i.appendChild(ss(this,Z4)),i.appendChild(tv(this,lp,Y6).call(this,"reject",r.rejectIcon,r.rejectAllLabel,ss(this,sF)));const s=tv(this,lp,Y6).call(this,"accept",r.acceptIcon,r.acceptAllLabel,ss(this,oF));s.appendChild(tv(this,lp,ICe).call(this)),i.appendChild(s),wu(this,Y4,i),ss(this,W6).appendChild(i),this.update(n)}update(e){var n;const r=!!((n=Qr.getState(e.state))!=null&&n.active);if(r!==ss(this,K6))if(wu(this,K6,r),r){const s=this.ctx.get(Yi.key);wu(this,Sv,s.diffOwnedByAI),wu(this,Mp,e.state.doc)}else{wu(this,Sv,!1),wu(this,Mp,null);const s=this.ctx.get(Yi.key);s.diffOwnedByAI&&this.ctx.set(Yi.key,{...s,diffOwnedByAI:!1})}const i=r&&ss(this,Sv);if(i!==ss(this,G6)&&(wu(this,G6,i),ss(this,Y4).dataset.show=i?"true":"false"),i){const s=this.ctx.get(Yi.key),o=!!ss(this,Mp)&&e.state.doc.eq(ss(this,Mp));ss(this,Z4).disabled=!s.lastInstruction||!o}}destroy(){ss(this,Y4).remove()}}Y4=new WeakMap;W6=new WeakMap;Z4=new WeakMap;jk=new WeakMap;G6=new WeakMap;K6=new WeakMap;Mp=new WeakMap;Sv=new WeakMap;lp=new WeakSet;ACe=function(t){var e;return(e=t.dom.closest(".milkdown"))!=null?e:document.body};Y6=function(t,e,n,r){const i=document.createElement("button");i.type="button",i.className=`${Cx}-btn ${Cx}-btn-${t}`,i.appendChild(q3t(e));const s=document.createElement("span");return s.textContent=n,i.appendChild(s),i.addEventListener("mousedown",o=>o.preventDefault()),i.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),r()}),i};ICe=function(){const t=document.createElement("span");t.className=`${Cx}-shortcut`;const e=document.createElement("span");e.textContent=ss(this,jk).modSymbol;const n=document.createElement("span");return n.className=`${Cx}-shortcut-icon`,MCe(n,ss(this,jk).enterKeyIcon),t.append(e,n),t};iF=new WeakMap;RCe=function(){return ss(this,Mp)?this.ctx.get(cn).state.doc.eq(ss(this,Mp)):!1};sF=new WeakMap;oF=new WeakMap;const G3t=new Vn("CREPE_AI_DIFF_ACTIONS_PANEL"),K3t="Retry",Y3t="Reject all",Z3t="Accept all";function X3t(){var t,e,n,r;if(typeof navigator>"u")return"⌘";const i=navigator,s=(r=(n=(e=(t=i.userAgentData)==null?void 0:t.platform)!=null?e:i.platform)!=null?n:i.userAgent)!=null?r:"";return/mac|iphone|ipad|ipod/i.test(s)?"⌘":"Ctrl"}const Q3t=X3t();function J3t(t){var e,n,r,i,s,o,a;const{config:l,enterKeyIcon:c}=t;return{retryLabel:(e=l==null?void 0:l.retryLabel)!=null?e:K3t,rejectAllLabel:(n=l==null?void 0:l.rejectAllLabel)!=null?n:Y3t,acceptAllLabel:(r=l==null?void 0:l.acceptAllLabel)!=null?r:Z3t,retryIcon:(i=l==null?void 0:l.retryIcon)!=null?i:D3t,rejectIcon:(s=l==null?void 0:l.rejectIcon)!=null?s:oK,acceptIcon:(o=l==null?void 0:l.acceptIcon)!=null?o:rM,enterKeyIcon:c??mCe,modSymbol:(a=l==null?void 0:l.modSymbol)!=null?a:Q3t}}function eCt(t={}){const e=J3t(t);return Sr(n=>new Fn({key:G3t,view(r){return new W3t(n,r,e)},props:{handleKeyDown(r,i){var s;return i.key!=="Enter"||!(i.metaKey||i.ctrlKey)||!((s=Qr.getState(r.state))!=null&&s.active)||!n.get(Yi.key).diffOwnedByAI?!1:(i.preventDefault(),n.get(je).call(aR.key),!0)}}}))}var NCe=t=>{throw TypeError(t)},OCe=(t,e,n)=>e.has(t)||NCe("Cannot "+n),Zd=(t,e,n)=>(OCe(t,e,"read from private field"),n?n.call(t):e.get(t)),Xoe=(t,e,n)=>e.has(t)?NCe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Qoe=(t,e,n,r)=>(OCe(t,e,"write to private field"),e.set(t,n),n),Cu,X4;function Joe(t){const e={addItem:(n,r)=>(t.items.set(n,r),e),removeItem:n=>(t.items.delete(n),e),getItem:n=>t.items.get(n),clear:()=>(t.items.clear(),e)};return e}class tCt{constructor(){Xoe(this,Cu,[]),this.addItem=(e,n)=>(Zd(this,X4).call(this,e),Zd(this,Cu).push({kind:"item",id:e,item:n}),this),this.addSubmenu=(e,n,r)=>{Zd(this,X4).call(this,e);const i={def:n,items:new Map};return r&&r(Joe(i)),Zd(this,Cu).push({kind:"submenu",id:e,node:i}),this},this.removeItem=e=>(Zd(this,X4).call(this,e),this),this.getItem=e=>{const n=Zd(this,Cu).find(r=>r.kind==="item"&&r.id===e);return(n==null?void 0:n.kind)==="item"?n.item:void 0},this.getSubmenu=e=>{const n=Zd(this,Cu).find(r=>r.kind==="submenu"&&r.id===e);return(n==null?void 0:n.kind)==="submenu"?Joe(n.node):void 0},this.clear=()=>(Qoe(this,Cu,[]),this),this.build=()=>{const e=[],n={};for(const r of Zd(this,Cu))r.kind==="item"?e.push({kind:"item",id:r.id,item:r.item}):(e.push({kind:"submenu",id:r.id,def:r.node.def}),n[r.id]={def:r.node.def,items:Array.from(r.node.items.entries()).map(([i,s])=>({id:i,item:s}))});return{main:e,submenus:n}},Xoe(this,X4,e=>{Qoe(this,Cu,Zd(this,Cu).filter(n=>n.id!==e))})}}Cu=new WeakMap;X4=new WeakMap;function nCt(t){t.addItem("improve",{icon:iK,label:"Improve writing",streamingLabel:"Improving writing",prompt:"Improve the writing while preserving the original meaning."}).addItem("grammar",{icon:C3t,label:"Fix grammar & spelling",streamingLabel:"Fixing grammar & spelling",prompt:"Fix any grammar and spelling errors without changing the meaning."}).addItem("shorter",{icon:z3t,label:"Make shorter",streamingLabel:"Making shorter",prompt:"Make this shorter while preserving the key information."}).addItem("longer",{icon:N3t,label:"Make longer",streamingLabel:"Expanding",prompt:"Expand this with more detail and examples."}),t.addSubmenu("tone",{icon:zk,label:"Change tone…",title:"Change tone",searchPlaceholder:"Search tones…"},e=>{const n=[["professional","Professional"],["casual","Casual"],["confident","Confident"],["friendly","Friendly"],["direct","Direct"],["formal","Formal"]];for(const[r,i]of n)e.addItem(r,{icon:zk,label:i,streamingLabel:"Adjusting tone",prompt:`Rewrite this in a ${i.toLowerCase()} tone.`})}),t.addSubmenu("translate",{icon:Zoe,label:"Translate…",title:"Translate",searchPlaceholder:"Search languages…"},e=>{const n=[["english","English","English"],["chinese","Chinese","Chinese (Simplified)"],["japanese","Japanese","Japanese"],["korean","Korean","Korean"],["spanish","Spanish","Spanish"],["french","French","French"],["german","German","German"]];for(const[r,i,s]of n)e.addItem(r,{icon:Zoe,label:i,streamingLabel:`Translating to ${i}`,prompt:`Translate this to ${s}.`})})}function P0(...t){}P0(X);function rCt(t,e){const n=e.trim();if(!n)return[t];const r=t.toLowerCase(),i=n.toLowerCase(),s=r.indexOf(i);return s===-1?[t]:[t.slice(0,s),X("mark",null,t.slice(s,s+n.length)),t.slice(s+n.length)]}const iCt=es({props:{placeholder:{type:Object,required:!0},resetSignal:{type:Object,required:!0},suggestions:{type:Object,required:!0},chrome:{type:Object,required:!0},onConfirm:{type:Function,required:!0},onCancel:{type:Function,required:!0}},setup({placeholder:t,resetSignal:e,suggestions:n,chrome:r,onConfirm:i,onCancel:s}){const o=nt(""),a=nt({kind:"main"}),l=nt(0),c=nt(null),u=nt(null),d=`ai-instruction-list-${Math.random().toString(36).slice(2,9)}`,h=D=>`${d}-opt-${D}`;qh(e,()=>{o.value="",a.value={kind:"main"},l.value=0});const f=Ll(()=>{if(a.value.kind==="submenu"){const D=n.submenus[a.value.id];return D?D.items.map(({id:P,item:z})=>({id:P,icon:z.icon,label:z.label,hasSubmenu:!1,prompt:{text:z.prompt,streamingLabel:z.streamingLabel}})):[]}return n.main.map(D=>D.kind==="item"?{id:D.id,icon:D.item.icon,label:D.item.label,hasSubmenu:!1,prompt:{text:D.item.prompt,streamingLabel:D.item.streamingLabel}}:{id:D.id,icon:D.def.icon,label:D.def.label,hasSubmenu:!0})}),p=Ll(()=>{var D,P;return a.value.kind!=="submenu"?null:(P=(D=n.submenus[a.value.id])==null?void 0:D.def)!=null?P:null}),g=Ll(()=>{const D=o.value.trim().toLowerCase();return D?f.value.filter(P=>P.label.toLowerCase().includes(D)):f.value}),y=Ll(()=>o.value.trim().length>0),v=Ll(()=>g.value.length+(y.value?1:0));qh([g,a,y],()=>{l.value=y.value?g.value.length:0});const b=()=>{uB(()=>{var D;return(D=c.value)==null?void 0:D.focus()})},_=D=>{a.value={kind:"submenu",id:D},o.value="",l.value=0,b()},S=()=>{a.value={kind:"main"},o.value="",l.value=0,b()},k=D=>{D.hasSubmenu?_(D.id):D.prompt&&(i(D.prompt.text,D.prompt.streamingLabel),o.value="")},T=()=>{const D=o.value.trim();D&&(i(D),o.value="")},E=()=>{const D=l.value,P=g.value;D<P.length?k(P[D]):y.value&&T()},C=()=>{uB(()=>{const D=u.value;if(!D)return;const P=D.querySelector(`[data-index="${l.value}"]`);P==null||P.scrollIntoView({block:"nearest"})})},R=D=>{if(D.stopPropagation(),D.key==="ArrowDown"){if(D.preventDefault(),v.value===0)return;l.value=(l.value+1)%v.value,C();return}if(D.key==="ArrowUp"){if(D.preventDefault(),v.value===0)return;l.value=(l.value-1+v.value)%v.value,C();return}if(D.key==="Enter"){D.preventDefault(),E();return}if(D.key==="Escape"){D.preventDefault(),a.value.kind==="submenu"?S():s();return}D.key==="Backspace"&&o.value===""&&a.value.kind==="submenu"&&(D.preventDefault(),S())},M=D=>{D.preventDefault()};return()=>{const D=g.value,P=y.value,z=p.value;return X("div",{class:"ai-instruction"},X("div",{class:"ai-instruction-input"},X("span",{class:"ai-instruction-input-prefix"},X(_o,{icon:r.aiIcon})),X("input",{ref:c,class:"ai-instruction-input-field",role:"combobox","aria-expanded":"true","aria-autocomplete":"list","aria-controls":d,"aria-activedescendant":v.value>0?h(l.value):void 0,placeholder:z?z.searchPlaceholder:t.value,value:o.value,onInput:Z=>{o.value=Z.target.value},onKeydown:R}),X("button",{type:"button",class:"ai-instruction-submit","aria-label":r.submitButtonLabel,disabled:!P,onMousedown:M,onClick:T},X(_o,{icon:r.sendIcon}))),X("div",{class:"ai-instruction-list",ref:u,id:d,role:"listbox","aria-label":r.listboxLabel},z&&X("button",{type:"button",class:"ai-instruction-back",onMousedown:M,onClick:S},X("span",{class:"ai-instruction-back-icon","aria-hidden":"true"},X(_o,{icon:r.chevronLeftIcon})),X("span",null,z.title)),D.length>0&&X("div",{class:"ai-instruction-section"},X("div",{class:"ai-instruction-section-header"},r.suggestionsHeaderLabel),D.map((Z,re)=>X("div",{key:Z.id,id:h(re),"data-index":re,role:"option","aria-selected":re===l.value,class:["ai-instruction-item",re===l.value?"active":""],onMousedown:M,onClick:()=>k(Z),onPointerenter:()=>{l.value=re}},X("span",{class:"ai-instruction-item-icon"},X(_o,{icon:Z.icon})),X("span",{class:"ai-instruction-item-label"},rCt(Z.label,o.value)),Z.hasSubmenu&&X("span",{class:"ai-instruction-item-arrow"},X(_o,{icon:r.chevronRightIcon}))))),P&&X("div",{class:"ai-instruction-section"},X("div",{class:"ai-instruction-section-header"},r.sendAsPromptHeaderLabel),X("div",{id:h(D.length),"data-index":D.length,role:"option","aria-selected":l.value===D.length,class:["ai-instruction-item","ai-instruction-item-prompt",l.value===D.length?"active":""],onMousedown:M,onClick:T,onPointerenter:()=>{l.value=D.length}},X("span",{class:"ai-instruction-item-icon"},X(_o,{icon:r.sendPromptIcon})),X("span",{class:"ai-instruction-item-label"},r.sendAsPromptLabel," ",X("span",{class:"ai-instruction-item-quote"},'"',o.value,'"')),X("span",{class:"ai-instruction-item-shortcut"},X(_o,{icon:r.enterKeyIcon}))))))}}});var DCe=t=>{throw TypeError(t)},PCe=(t,e,n)=>e.has(t)||DCe("Cannot "+n),pi=(t,e,n)=>(PCe(t,e,"read from private field"),n?n.call(t):e.get(t)),xu=(t,e,n)=>e.has(t)?DCe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),yl=(t,e,n,r)=>(PCe(t,e,"write to private field"),e.set(t,n),n),mg,wc,Z6,X6,Q4,Q6,J6,cp,aF,lF;class sCt{constructor(e,n,r){this.ctx=e,xu(this,mg),xu(this,wc),xu(this,Z6),xu(this,X6),xu(this,Q4),xu(this,Q6,-1),xu(this,J6,-1),xu(this,cp,!1),xu(this,aF,(o,a)=>{!o.trim()||!this.ctx.get(je).call(cK.key,{instruction:o,label:a})||(yl(this,cp,!1),pi(this,wc).hide())}),xu(this,lF,()=>{yl(this,cp,!1),pi(this,wc).hide()}),this.show=(o,a)=>{yl(this,Q6,o),yl(this,J6,a),pi(this,Q4).value++,yl(this,cp,!0);const l=this.ctx.get(cn);pi(this,wc).show({getBoundingClientRect:()=>L3(l,o,a)},l),requestAnimationFrame(()=>{var c;(c=pi(this,mg).querySelector("input"))==null||c.focus()})},this.update=(o,a)=>{const{selection:l}=o.state,c=l instanceof mt,u=l.from!==pi(this,Q6)||l.to!==pi(this,J6);if(!c||u){yl(this,cp,!1),pi(this,wc).hide();return}pi(this,wc).update(o,a)},this.destroy=()=>{pi(this,Z6).unmount(),pi(this,wc).destroy(),pi(this,mg).remove()},yl(this,X6,nt(r.placeholder)),yl(this,Q4,nt(0));const i=document.createElement("div");i.className="milkdown-ai-instruction";const s=hl(iCt,{placeholder:pi(this,X6),resetSignal:pi(this,Q4),suggestions:r.suggestions,chrome:r.chrome,onConfirm:pi(this,aF),onCancel:pi(this,lF)});s.mount(i),yl(this,Z6,s),yl(this,mg,i),yl(this,wc,new U3({content:i,debounce:0,offset:10,shouldShow:()=>pi(this,cp),floatingUIOptions:{placement:"bottom"}})),pi(this,wc).onHide=()=>{yl(this,cp,!1),requestAnimationFrame(()=>{try{const a=pi(this,mg).getRootNode().activeElement;if(!a||!pi(this,mg).contains(a))return;this.ctx.get(cn).dom.focus({preventScroll:!0})}catch{}})},pi(this,wc).update(n)}}mg=new WeakMap;wc=new WeakMap;Z6=new WeakMap;X6=new WeakMap;Q4=new WeakMap;Q6=new WeakMap;J6=new WeakMap;cp=new WeakMap;aF=new WeakMap;lF=new WeakMap;const oCt={show:()=>{}},dK=xn({...oCt},"aiInstructionTooltipAPI"),LCe=q3("CREPE_AI_INSTRUCTION"),aCt="SUGGESTIONS",lCt="SEND AS PROMPT",cCt="Ask AI:",uCt="Send prompt",dCt="AI suggestions",hCt="Tell AI what to do with the selection…";function fCt(t){var e,n,r,i,s,o,a,l,c,u,d;return{aiIcon:(e=t==null?void 0:t.aiIcon)!=null?e:iK,sendIcon:(n=t==null?void 0:t.sendIcon)!=null?n:P3t,sendPromptIcon:(r=t==null?void 0:t.sendPromptIcon)!=null?r:L3t,enterKeyIcon:(i=t==null?void 0:t.enterKeyIcon)!=null?i:mCe,chevronLeftIcon:(s=t==null?void 0:t.chevronLeftIcon)!=null?s:_3t,chevronRightIcon:(o=t==null?void 0:t.chevronRightIcon)!=null?o:S3t,suggestionsHeaderLabel:(a=t==null?void 0:t.suggestionsHeaderLabel)!=null?a:aCt,sendAsPromptHeaderLabel:(l=t==null?void 0:t.sendAsPromptHeaderLabel)!=null?l:lCt,sendAsPromptLabel:(c=t==null?void 0:t.sendAsPromptLabel)!=null?c:cCt,submitButtonLabel:(u=t==null?void 0:t.submitButtonLabel)!=null?u:uCt,listboxLabel:(d=t==null?void 0:t.listboxLabel)!=null?d:dCt}}function pCt(t){var e,n;const r=new tCt;return nCt(r),(e=t==null?void 0:t.buildAISuggestions)==null||e.call(t,r),{placeholder:(n=t==null?void 0:t.instructionPlaceholder)!=null?n:hCt,chrome:fCt(t),suggestions:r.build()}}function mCt(t){return e=>{const n=pCt(t);let r=null;e.update(dK.key,i=>({...i,show:(s,o)=>{r==null||r.show(s,o)}})),e.set(LCe.key,{view:i=>(r=new sCt(e,i,n),r)})}}var zCe=t=>{throw TypeError(t)},jCe=(t,e,n)=>e.has(t)||zCe("Cannot "+n),Xd=(t,e,n)=>(jCe(t,e,"read from private field"),n?n.call(t):e.get(t)),tg=(t,e,n)=>e.has(t)?zCe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),nv=(t,e,n,r)=>(jCe(t,e,"write to private field"),e.set(t,n),n),eA,tA,nA,cF,rA,kv,iA;const hT="milkdown-ai-streaming",gCt=800,yCt="Generating",vCt="Esc to cancel",eae=new Vn("CREPE_AI_STREAMING_INDICATOR");class bCt{constructor(e,n,r){tg(this,eA),tg(this,tA),tg(this,nA),tg(this,cF,performance.now()),tg(this,rA,""),tg(this,kv,0),tg(this,iA,()=>{const c=(performance.now()-Xd(this,cF))/gCt*360;Xd(this,eA).style.transform=`rotate(${c}deg)`,nv(this,kv,requestAnimationFrame(Xd(this,iA)))}),nv(this,nA,n);const i=document.createElement("span");i.className=`${hT}-indicator`,i.contentEditable="false",i.setAttribute("role","status"),i.setAttribute("aria-live","polite");const s=document.createElement("span");s.className=`${hT}-spinner`,s.setAttribute("aria-hidden","true"),i.appendChild(s);const o=document.createElement("span");o.className=`${hT}-label`,i.appendChild(o);const a=document.createElement("span");a.className=`${hT}-esc`,a.textContent=r,i.appendChild(a),this.dom=i,nv(this,eA,s),nv(this,tA,o),this.setLabel(e),Xd(this,iA).call(this)}setLabel(e){const r=`${e.get(Yi.key).label||Xd(this,nA)}…`;r!==Xd(this,rA)&&(nv(this,rA,r),Xd(this,tA).textContent=r)}destroy(){Xd(this,kv)&&cancelAnimationFrame(Xd(this,kv)),nv(this,kv,0)}}eA=new WeakMap;tA=new WeakMap;nA=new WeakMap;cF=new WeakMap;rA=new WeakMap;kv=new WeakMap;iA=new WeakMap;function wCt(t={}){var e,n;const{config:r}=t,i=(e=r==null?void 0:r.fallbackLabel)!=null?e:yCt,s=(n=r==null?void 0:r.cancelHint)!=null?n:vCt;return Sr(o=>{let a=null;function l(){return a?a.setLabel(o):a=new bCt(o,i,s),a}function c(){a&&(a.destroy(),a=null)}function u(d,h){const f=Math.min(h,d.content.size),p=sr.widget(f,l().dom,{side:1,key:"ai-streaming-indicator"});return En.create(d,[p])}return new Fn({key:eae,state:{init:()=>En.empty,apply(d,h,f,p){const g=Ni.getState(p);return!(g!=null&&g.active)||g.insertEndPos==null?(c(),En.empty):d.getMeta(Ni)||d.docChanged?u(p.doc,g.insertEndPos):h.map(d.mapping,d.doc)}},view(){return{destroy(){c()}}},props:{decorations(d){var h;return(h=eae.getState(d))!=null?h:En.empty},handleKeyDown(d,h){var f;if(h.key!=="Escape")return!1;const p=o.get(je);return o.get(Yi.key).abortController?(h.preventDefault(),p.call(ECe.key,{keep:!0}),!0):(f=Ni.getState(d.state))!=null&&f.active?(h.preventDefault(),p.call(h2.key,{keep:!0}),!0):!1}}})})}const xCt=["table","image-block","code_block"],tae={heading:["id"]},_Ct=(t,e)=>{var n,r;const i=(n=e==null?void 0:e.diff)!=null?n:{},s=(r=e==null?void 0:e.streaming)!=null?r:{};t.config(uc(yn.AI)).config(o=>{o.update(oR.key,c=>{var u;return{...c,ignoreAttrs:(u=i.ignoreAttrs)!=null?u:tae}});const{ignoreAttrs:a,...l}=i;o.update(lR.key,c=>{var u;return{...c,customBlockTypes:(u=l.customBlockTypes)!=null?u:xCt,...l}})}).use(vpt).use(Dpt).config(o=>{o.update(Ay.key,a=>{var l;return{...a,...s,ignoreAttrs:(l=s.ignoreAttrs)!=null?l:tae,...(e==null?void 0:e.diffReviewOnEnd)!==void 0?{diffReviewOnEnd:e.diffReviewOnEnd}:{}}})}).use(Upt).config(o=>{o.update(kx.key,a=>{var l;return{...a,...(e==null?void 0:e.provider)!==void 0?{provider:e.provider}:{},...(e==null?void 0:e.buildContext)!==void 0?{buildContext:e.buildContext}:{},diffReviewOnEnd:(l=e==null?void 0:e.diffReviewOnEnd)!=null?l:a.diffReviewOnEnd,...(e==null?void 0:e.onError)!==void 0?{onError:e.onError}:{},...(e==null?void 0:e.aiIcon)!==void 0?{aiIcon:e.aiIcon}:{}}})}).use(kx).use(Yi).use(cK).use(ECe).config(mCt(e)).use(dK).use(LCe).use(wCt({config:e==null?void 0:e.streamingIndicator})).use(eCt({config:e==null?void 0:e.diffActions,enterKeyIcon:e==null?void 0:e.enterKeyIcon}))};function BCe(t){return t.$from.parent.type.name==="code_block"}function FCe(t){var e;const n=(e=t.$from.node(t.$from.depth-1))==null?void 0:e.type;return(n==null?void 0:n.name)==="list_item"}var VCe=t=>{throw TypeError(t)},$Ce=(t,e,n)=>e.has(t)||VCe("Cannot "+n),a4=(t,e,n)=>($Ce(t,e,"read from private field"),n?n.call(t):e.get(t)),nae=(t,e,n)=>e.has(t)?VCe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),SCt=(t,e,n,r)=>($Ce(t,e,"write to private field"),e.set(t,n),n),Cv,sA;class hK{constructor(){nae(this,Cv,[]),this.clear=()=>(SCt(this,Cv,[]),this),nae(this,sA,e=>{const n={group:e,addItem:(r,i)=>{const s={...i,key:r};return e.items.push(s),n},clear:()=>(e.items=[],n)};return n}),this.addGroup=(e,n)=>{const i={key:e,label:n,items:[]};return a4(this,Cv).push(i),a4(this,sA).call(this,i)},this.getGroup=e=>{const n=a4(this,Cv).find(r=>r.key===e);if(!n)throw new Error(`Group with key ${e} not found`);return a4(this,sA).call(this,n)},this.build=()=>a4(this,Cv)}}Cv=new WeakMap;sA=new WeakMap;function kCt(t,e,n){var r,i,s,o,a,l,c,u,d,h,f,p,g,y,v,b,_,S,k,T,E,C,R,M,D,P,z,Z,re,G,ee,J,oe,B,$e,Ye,$,Re,ke,Me,_e,Ne,Ue,at,ct,H,Y,se,me,de,ie,Te,he,we,ye,Ge,Pe,tt,ft,ne,fe,Le,Ze,rt,un,Yt,_n,kr,In,Vt,zr,Ee,St,Ke,Sn,en,Vi,wt,pn,tr,ni,_i,qt,jr,Ho,Si,fi,ml,$i,z0,Gr,Ca,Lf,Bd,Fd,cu,uu,du,Uo,hu,zf,jf,dc,Ea,hc,fc,pt,U,ge,Qe,mn,Zt,$n,ts,fo,Kr,gs,ur,pc;const Ta=n&&T2(n).get(),dr=Ta==null?void 0:Ta.includes(yn.Latex),By=Ta==null?void 0:Ta.includes(yn.ImageBlock),j0=Ta==null?void 0:Ta.includes(yn.Table),mc=new hK;if((e==null?void 0:e.textGroup)!==null){const zn=mc.addGroup("text",(i=(r=e==null?void 0:e.textGroup)==null?void 0:r.label)!=null?i:"Text");((s=e==null?void 0:e.textGroup)==null?void 0:s.text)!==null&&zn.addItem("text",{label:(l=(a=(o=e==null?void 0:e.textGroup)==null?void 0:o.text)==null?void 0:a.label)!=null?l:"Text",icon:(d=(u=(c=e==null?void 0:e.textGroup)==null?void 0:c.text)==null?void 0:u.icon)!=null?d:j3t,onRun:Ct=>{const Tt=Ct.get(je),Ln=al.type(Ct);Tt.call(vs.key),Tt.call(Sl.key,{nodeType:Ln})}}),((h=e==null?void 0:e.textGroup)==null?void 0:h.h1)!==null&&zn.addItem("h1",{label:(g=(p=(f=e==null?void 0:e.textGroup)==null?void 0:f.h1)==null?void 0:p.label)!=null?g:"Heading 1",icon:(b=(v=(y=e==null?void 0:e.textGroup)==null?void 0:y.h1)==null?void 0:v.icon)!=null?b:E3t,onRun:Ct=>{const Tt=Ct.get(je),Ln=Co.type(Ct);Tt.call(vs.key),Tt.call(Sl.key,{nodeType:Ln,attrs:{level:1}})}}),((_=e==null?void 0:e.textGroup)==null?void 0:_.h2)!==null&&zn.addItem("h2",{label:(T=(k=(S=e==null?void 0:e.textGroup)==null?void 0:S.h2)==null?void 0:k.label)!=null?T:"Heading 2",icon:(R=(C=(E=e==null?void 0:e.textGroup)==null?void 0:E.h2)==null?void 0:C.icon)!=null?R:T3t,onRun:Ct=>{const Tt=Ct.get(je),Ln=Co.type(Ct);Tt.call(vs.key),Tt.call(Sl.key,{nodeType:Ln,attrs:{level:2}})}}),((M=e==null?void 0:e.textGroup)==null?void 0:M.h3)!==null&&zn.addItem("h3",{label:(z=(P=(D=e==null?void 0:e.textGroup)==null?void 0:D.h3)==null?void 0:P.label)!=null?z:"Heading 3",icon:(G=(re=(Z=e==null?void 0:e.textGroup)==null?void 0:Z.h3)==null?void 0:re.icon)!=null?G:A3t,onRun:Ct=>{const Tt=Ct.get(je),Ln=Co.type(Ct);Tt.call(vs.key),Tt.call(Sl.key,{nodeType:Ln,attrs:{level:3}})}}),((ee=e==null?void 0:e.textGroup)==null?void 0:ee.h4)!==null&&zn.addItem("h4",{label:(B=(oe=(J=e==null?void 0:e.textGroup)==null?void 0:J.h4)==null?void 0:oe.label)!=null?B:"Heading 4",icon:($=(Ye=($e=e==null?void 0:e.textGroup)==null?void 0:$e.h4)==null?void 0:Ye.icon)!=null?$:I3t,onRun:Ct=>{const Tt=Ct.get(je),Ln=Co.type(Ct);Tt.call(vs.key),Tt.call(Sl.key,{nodeType:Ln,attrs:{level:4}})}}),((Re=e==null?void 0:e.textGroup)==null?void 0:Re.h5)!==null&&zn.addItem("h5",{label:(_e=(Me=(ke=e==null?void 0:e.textGroup)==null?void 0:ke.h5)==null?void 0:Me.label)!=null?_e:"Heading 5",icon:(at=(Ue=(Ne=e==null?void 0:e.textGroup)==null?void 0:Ne.h5)==null?void 0:Ue.icon)!=null?at:R3t,onRun:Ct=>{const Tt=Ct.get(je),Ln=Co.type(Ct);Tt.call(vs.key),Tt.call(Sl.key,{nodeType:Ln,attrs:{level:5}})}}),((ct=e==null?void 0:e.textGroup)==null?void 0:ct.h6)!==null&&zn.addItem("h6",{label:(se=(Y=(H=e==null?void 0:e.textGroup)==null?void 0:H.h6)==null?void 0:Y.label)!=null?se:"Heading 6",icon:(ie=(de=(me=e==null?void 0:e.textGroup)==null?void 0:me.h6)==null?void 0:de.icon)!=null?ie:M3t,onRun:Ct=>{const Tt=Ct.get(je),Ln=Co.type(Ct);Tt.call(vs.key),Tt.call(Sl.key,{nodeType:Ln,attrs:{level:6}})}}),((Te=e==null?void 0:e.textGroup)==null?void 0:Te.quote)!==null&&zn.addItem("quote",{label:(ye=(we=(he=e==null?void 0:e.textGroup)==null?void 0:he.quote)==null?void 0:we.label)!=null?ye:"Quote",icon:(tt=(Pe=(Ge=e==null?void 0:e.textGroup)==null?void 0:Ge.quote)==null?void 0:Pe.icon)!=null?tt:bCe,onRun:Ct=>{const Tt=Ct.get(je),Ln=My.type(Ct);Tt.call(vs.key),Tt.call(Dh.key,{nodeType:Ln})}}),((ft=e==null?void 0:e.textGroup)==null?void 0:ft.divider)!==null&&zn.addItem("divider",{label:(Le=(fe=(ne=e==null?void 0:e.textGroup)==null?void 0:ne.divider)==null?void 0:fe.label)!=null?Le:"Divider",icon:(un=(rt=(Ze=e==null?void 0:e.textGroup)==null?void 0:Ze.divider)==null?void 0:rt.icon)!=null?un:pCe,onRun:Ct=>{const Tt=Ct.get(je),Ln=Oy.type(Ct);Tt.call(vs.key),Tt.call(Ph.key,{nodeType:Ln})}})}if((e==null?void 0:e.listGroup)!==null){const zn=mc.addGroup("list",(_n=(Yt=e==null?void 0:e.listGroup)==null?void 0:Yt.label)!=null?_n:"List");((kr=e==null?void 0:e.listGroup)==null?void 0:kr.bulletList)!==null&&zn.addItem("bullet-list",{label:(zr=(Vt=(In=e==null?void 0:e.listGroup)==null?void 0:In.bulletList)==null?void 0:Vt.label)!=null?zr:"Bullet List",icon:(Ke=(St=(Ee=e==null?void 0:e.listGroup)==null?void 0:Ee.bulletList)==null?void 0:St.icon)!=null?Ke:hCe,onRun:Ct=>{const Tt=Ct.get(je),Ln=R0.type(Ct);Tt.call(vs.key),Tt.call(Dh.key,{nodeType:Ln})}}),((Sn=e==null?void 0:e.listGroup)==null?void 0:Sn.orderedList)!==null&&zn.addItem("ordered-list",{label:(wt=(Vi=(en=e==null?void 0:e.listGroup)==null?void 0:en.orderedList)==null?void 0:Vi.label)!=null?wt:"Ordered List",icon:(ni=(tr=(pn=e==null?void 0:e.listGroup)==null?void 0:pn.orderedList)==null?void 0:tr.icon)!=null?ni:vCe,onRun:Ct=>{const Tt=Ct.get(je),Ln=M0.type(Ct);Tt.call(vs.key),Tt.call(Dh.key,{nodeType:Ln})}}),((_i=e==null?void 0:e.listGroup)==null?void 0:_i.taskList)!==null&&zn.addItem("task-list",{label:(Ho=(jr=(qt=e==null?void 0:e.listGroup)==null?void 0:qt.taskList)==null?void 0:jr.label)!=null?Ho:"Task List",icon:(ml=(fi=(Si=e==null?void 0:e.listGroup)==null?void 0:Si.taskList)==null?void 0:fi.icon)!=null?ml:SCe,onRun:Ct=>{const Tt=Ct.get(je),Ln=ac.type(Ct);Tt.call(vs.key),Tt.call(Dh.key,{nodeType:Ln,attrs:{checked:!1}})}})}if((e==null?void 0:e.advancedGroup)!==null){const zn=mc.addGroup("advanced",(z0=($i=e==null?void 0:e.advancedGroup)==null?void 0:$i.label)!=null?z0:"Advanced");((Gr=e==null?void 0:e.advancedGroup)==null?void 0:Gr.image)!==null&&By&&zn.addItem("image",{label:(Bd=(Lf=(Ca=e==null?void 0:e.advancedGroup)==null?void 0:Ca.image)==null?void 0:Lf.label)!=null?Bd:"Image",icon:(uu=(cu=(Fd=e==null?void 0:e.advancedGroup)==null?void 0:Fd.image)==null?void 0:cu.icon)!=null?uu:q8,onRun:Ct=>{const Tt=Ct.get(je),Ln=nC.type(Ct);Tt.call(vs.key),Tt.call(Ph.key,{nodeType:Ln})}}),((du=e==null?void 0:e.advancedGroup)==null?void 0:du.codeBlock)!==null&&zn.addItem("code",{label:(zf=(hu=(Uo=e==null?void 0:e.advancedGroup)==null?void 0:Uo.codeBlock)==null?void 0:hu.label)!=null?zf:"Code",icon:(Ea=(dc=(jf=e==null?void 0:e.advancedGroup)==null?void 0:jf.codeBlock)==null?void 0:dc.icon)!=null?Ea:aK,onRun:Ct=>{const Tt=Ct.get(je),Ln=Jl.type(Ct);Tt.call(vs.key),Tt.call(Sl.key,{nodeType:Ln})}}),((hc=e==null?void 0:e.advancedGroup)==null?void 0:hc.table)!==null&&j0&&zn.addItem("table",{label:(U=(pt=(fc=e==null?void 0:e.advancedGroup)==null?void 0:fc.table)==null?void 0:pt.label)!=null?U:"Table",icon:(mn=(Qe=(ge=e==null?void 0:e.advancedGroup)==null?void 0:ge.table)==null?void 0:Qe.icon)!=null?mn:_Ce,onRun:Ct=>{const Tt=Ct.get(je),Ln=Ct.get(cn);Tt.call(vs.key);const{from:F0}=Ln.state.selection;Tt.call(Ph.key,{nodeType:RR(Ct,3,3)}),Tt.call(jW.key,{pos:F0})}}),((Zt=e==null?void 0:e.advancedGroup)==null?void 0:Zt.math)!==null&&dr&&zn.addItem("math",{label:(fo=(ts=($n=e==null?void 0:e.advancedGroup)==null?void 0:$n.math)==null?void 0:ts.label)!=null?fo:"Math",icon:(ur=(gs=(Kr=e==null?void 0:e.advancedGroup)==null?void 0:Kr.math)==null?void 0:gs.icon)!=null?ur:lK,onRun:Ct=>{const Tt=Ct.get(je),Ln=Jl.type(Ct);Tt.call(vs.key),Tt.call(Ph.key,{nodeType:Ln,attrs:{language:"LaTeX"}})}})}(pc=e==null?void 0:e.buildMenu)==null||pc.call(e,mc);let B0=mc.build();t&&(B0=B0.map(zn=>{const Ct=zn.items.filter(Tt=>Tt.label.toLowerCase().includes(t.toLowerCase()));return{...zn,items:Ct}}).filter(zn=>zn.items.length>0));const N2=B0.flatMap(zn=>zn.items);return N2.forEach((zn,Ct)=>{Object.assign(zn,{index:Ct})}),B0.reduce((zn,Ct)=>{const Tt=zn+Ct.items.length;return Object.assign(Ct,{range:[zn,Tt]}),Tt},0),{groups:B0,size:N2.length}}P0(X);const CCt=es({props:{ctx:{type:Object,required:!0},show:{type:Object,required:!0},filter:{type:Object,required:!0},hide:{type:Function,required:!0},config:{type:Object,required:!1}},setup({ctx:t,show:e,filter:n,hide:r,config:i}){const s=nt(),o=Ll(()=>kCt(n.value,i,t)),a=nt(0),l=nt({x:-999,y:-999}),c=g=>{const{x:y,y:v}=g;l.value={x:y,y:v}};qh([o,e],()=>{const{size:g}=o.value;g===0&&e.value?r():a.value>=g&&(a.value=0)});const u=(g,y)=>{const v=a.value,b=typeof g=="function"?g(v):g;y==null||y(b),a.value=b},d=g=>{var y,v;const b=(y=s.value)==null?void 0:y.querySelector(`[data-index="${g}"]`),_=(v=s.value)==null?void 0:v.querySelector(".menu-groups");!b||!_||(_.scrollTop=b.offsetTop-_.offsetTop)},h=g=>{const y=o.value.groups.flatMap(v=>v.items).at(g);y!=null&&y.onRun&&t&&y.onRun(t),r()},f=g=>{const{size:y,groups:v}=o.value;if(g.key==="Escape"){g.preventDefault(),r==null||r();return}if(g.key==="ArrowDown")return g.preventDefault(),u(b=>b<y-1?b+1:b,d);if(g.key==="ArrowUp")return g.preventDefault(),u(b=>b<=0?b:b-1,d);if(g.key==="ArrowLeft")return g.preventDefault(),u(b=>{const _=v.find(k=>k.range[0]<=b&&k.range[1]>b);if(!_)return b;const S=v[v.indexOf(_)-1];return S?S.range[1]-1:b},d);if(g.key==="ArrowRight")return g.preventDefault(),u(b=>{const _=v.find(k=>k.range[0]<=b&&k.range[1]>b);if(!_)return b;const S=v[v.indexOf(_)+1];return S?S.range[0]:b},d);g.key==="Enter"&&(g.preventDefault(),h(a.value))},p=g=>y=>{const v=l.value;if(!v)return;const{x:b,y:_}=y;b===v.x&&_===v.y||u(g)};return p2(()=>{e.value?window.addEventListener("keydown",f,{capture:!0}):window.removeEventListener("keydown",f,{capture:!0})}),g2(()=>{window.removeEventListener("keydown",f,{capture:!0})}),()=>X("div",{ref:s,onPointerdown:g=>g.preventDefault()},X("nav",{class:"tab-group"},X("ul",null,o.value.groups.map(g=>X("li",{key:g.key,onPointerdown:()=>u(g.range[0],d),class:a.value>=g.range[0]&&a.value<g.range[1]?"selected":""},g.label)))),X("div",{class:"menu-groups",onPointermove:c},o.value.groups.map(g=>X("div",{key:g.key,class:"menu-group"},X("h6",null,g.label),X("ul",null,g.items.map(y=>X("li",{key:y.key,"data-index":y.index,class:a.value===y.index?"hover":"",onPointerenter:p(y.index),onPointerdown:()=>{var v,b;(b=(v=s.value)==null?void 0:v.querySelector(`[data-index="${y.index}"]`))==null||b.classList.add("active")},onPointerup:()=>{var v,b;(b=(v=s.value)==null?void 0:v.querySelector(`[data-index="${y.index}"]`))==null||b.classList.remove("active"),h(y.index)}},X(_o,{icon:y.icon}),X("span",null,y.label))))))))}});var HCe=t=>{throw TypeError(t)},UCe=(t,e,n)=>e.has(t)||HCe("Cannot "+n),yc=(t,e,n)=>(UCe(t,e,"read from private field"),n?n.call(t):e.get(t)),l4=(t,e,n)=>e.has(t)?HCe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),ng=(t,e,n,r)=>(UCe(t,e,"write to private field"),e.set(t,n),n),J4,oA,aA,rh,Ev;const qCe=dyt("CREPE_MENU"),fK=xn({show:()=>{},hide:()=>{}},"menuAPICtx");function ECt(t,e){t.set(qCe.key,{view:n=>new TCt(t,n,e)})}class TCt{constructor(e,n,r){l4(this,J4),l4(this,oA),l4(this,aA),l4(this,rh),l4(this,Ev,null),this.update=u=>{yc(this,rh).update(u)},this.show=u=>{ng(this,Ev,u),yc(this,aA).value="",yc(this,rh).show()},this.hide=()=>{ng(this,Ev,null),yc(this,rh).hide()},this.destroy=()=>{yc(this,rh).destroy(),yc(this,oA).unmount(),yc(this,J4).remove()};const i=document.createElement("div");i.classList.add("milkdown-slash-menu");const s=nt(!1),o=nt("");ng(this,aA,o);const a=this.hide,l=hl(CCt,{ctx:e,config:r,show:s,filter:o,hide:a});ng(this,oA,l),l.mount(i),ng(this,J4,i);const c=this;ng(this,rh,new hyt({content:yc(this,J4),debounce:20,shouldShow(u){if(BCe(u.state.selection)||FCe(u.state.selection))return!1;const d=this.getContent(u,f=>["paragraph","heading"].includes(f.type.name));if(d==null||!ACt(u.state.selection))return!1;const h=yc(c,Ev);if(o.value=d.startsWith("/")?d.slice(1):d,typeof h=="number"){const f=u.state.doc.nodeSize-2,p=Math.min(h,f);return u.state.doc.resolve(p).node()!==u.state.doc.resolve(u.state.selection.from).node()?(ng(c,Ev,null),!1):!0}return!!d.startsWith("/")},offset:10})),yc(this,rh).onShow=()=>{s.value=!0},yc(this,rh).onHide=()=>{s.value=!1},this.update(n),e.set(fK.key,{show:u=>this.show(u),hide:()=>this.hide()})}}J4=new WeakMap;oA=new WeakMap;aA=new WeakMap;rh=new WeakMap;Ev=new WeakMap;function ACt(t){if(!(t instanceof mt))return!1;const{$head:e}=t,n=e.parent;return e.parentOffset===n.content.size}P0(X,mr);const ICt=es({props:{onAdd:{type:Function,required:!0},addIcon:{type:String,required:!0},handleIcon:{type:String,required:!0}},setup(t){const e=nt();return()=>X(mr,null,X("div",{ref:e,class:"operation-item",onPointerdown:n=>{var r;n.preventDefault(),n.stopPropagation(),(r=e.value)==null||r.classList.add("active")},onPointerup:n=>{var r;n.preventDefault(),n.stopPropagation(),(r=e.value)==null||r.classList.remove("active"),t.onAdd()}},X(_o,{icon:t.addIcon})),X("div",{class:"operation-item"},X(_o,{icon:t.handleIcon})))}});var WCe=t=>{throw TypeError(t)},GCe=(t,e,n)=>e.has(t)||WCe("Cannot "+n),rg=(t,e,n)=>(GCe(t,e,"read from private field"),n?n.call(t):e.get(t)),fT=(t,e,n)=>e.has(t)?WCe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),pT=(t,e,n,r)=>(GCe(t,e,"write to private field"),e.set(t,n),n),lA,gg,cA,uA;class RCt{constructor(e,n){fT(this,lA),fT(this,gg),fT(this,cA),fT(this,uA),this.update=()=>{rg(this,gg).update()},this.destroy=()=>{rg(this,gg).destroy(),rg(this,lA).remove(),rg(this,cA).unmount()},this.onAdd=()=>{const c=rg(this,uA),u=c.get(cn);u.hasFocus()||u.focus();const{state:d,dispatch:h}=u,f=rg(this,gg).active;if(!f)return;const g=f.$pos.pos+f.node.nodeSize;let y=d.tr.insert(g,al.type(c).create());y=y.setSelection(mt.near(y.doc.resolve(g))),h(y.scrollIntoView()),rg(this,gg).hide(),c.get(fK.key).show(y.selection.from)};var r,i,s;pT(this,uA,e);const o=document.createElement("div");o.classList.add("milkdown-block-handle");const a=hl(ICt,{onAdd:this.onAdd,addIcon:(r=n==null?void 0:n.handleAddIcon)!=null?r:nF,handleIcon:(i=n==null?void 0:n.handleDragIcon)!=null?i:O3t});a.mount(o),pT(this,cA,a),pT(this,lA,o);const l=(s=n==null?void 0:n.blockHandle)!=null?s:{};pT(this,gg,new B1t({ctx:e,content:o,getOffset:()=>16,getPlacement:({active:c,blockDom:u})=>{if(c.node.type.name==="heading")return"left";let d=0;c.node.descendants(S=>{d+=S.childCount});const h=c.el,f=h.getBoundingClientRect(),p=u.getBoundingClientRect(),g=window.getComputedStyle(h),y=Number.parseInt(g.paddingTop,10)||0,v=Number.parseInt(g.paddingBottom,10)||0,b=f.height-y-v,_=p.height;return d>2||_<b?"left-start":"left"},...l})),this.update()}}lA=new WeakMap;gg=new WeakMap;cA=new WeakMap;uA=new WeakMap;function MCt(t,e){t.set(_R.key,{filterNodes:n=>!hd(i=>["table","blockquote","math_inline"].includes(i.type.name))(n)}),t.set(CR.key,{view:()=>new RCt(t,e)})}const NCt=(t,e)=>{t.config(uc(yn.BlockEdit)).config(n=>MCt(n,e)).config(n=>ECt(n,e)).use(fK).use(CR).use(qCe)},OCt=(t,e={})=>{t.config(uc(yn.CodeMirror)).config(n=>{const{languages:r=[],theme:i}=e,s=[l2.of(i5e.concat(qxt)),i_t];i&&s.push(i),e.extensions&&s.push(...e.extensions),n.update(lC.key,o=>{var a;return{extensions:s,languages:r,expandIcon:e.expandIcon||sK,searchIcon:e.searchIcon||wCe,clearSearchIcon:e.clearSearchIcon||oK,searchPlaceholder:e.searchPlaceholder||"Search language",copyText:e.copyText||"Copy",copyIcon:e.copyIcon||fCe,onCopy:e.onCopy||(()=>{}),noResultText:e.noResultText||"No result",renderLanguage:e.renderLanguage||o.renderLanguage,renderPreview:e.renderPreview||o.renderPreview,previewToggleButton:l=>{var c,u;const d=((c=e.previewToggleIcon)==null?void 0:c.call(e,l))||(l?zk:kCe),h=((u=e.previewToggleText)==null?void 0:u.call(e,l))||(l?"Edit":"Hide");return[d,h].map(f=>f.trim()).join(" ")},previewLabel:e.previewLabel||o.previewLabel,previewLoading:e.previewLoading||o.previewLoading,previewOnlyByDefault:(a=e.previewOnlyByDefault)!=null?a:o.previewOnlyByDefault}})}).use(v2t)},DCt=(t,e)=>{if(t.config(uc(yn.Cursor)).config(r=>{r.update(zR.key,()=>{var i,s;return{class:"crepe-drop-cursor",width:(i=e==null?void 0:e.width)!=null?i:4,color:(s=e==null?void 0:e.color)!=null?s:!1}})}).use(S_t),(e==null?void 0:e.virtual)===!1)return;const n=k_t();t.use(Sr(()=>n))},PCt=(t,e)=>{t.config(uc(yn.ImageBlock)).config(n=>{n.update(jR.key,r=>{var i,s,o,a,l,c;return{uploadButton:(i=e==null?void 0:e.inlineUploadButton)!=null?i:"Upload",imageIcon:(s=e==null?void 0:e.inlineImageIcon)!=null?s:q8,confirmButton:(o=e==null?void 0:e.inlineConfirmButton)!=null?o:rM,uploadPlaceholderText:(a=e==null?void 0:e.inlineUploadPlaceholderText)!=null?a:"or paste link",onUpload:(c=(l=e==null?void 0:e.inlineOnUpload)!=null?l:e==null?void 0:e.onUpload)!=null?c:r.onUpload,proxyDomURL:e==null?void 0:e.proxyDomURL}}),n.update(tC.key,r=>{var i,s,o,a,l,c,u,d,h;return{uploadButton:(i=e==null?void 0:e.blockUploadButton)!=null?i:"Upload file",imageIcon:(s=e==null?void 0:e.blockImageIcon)!=null?s:q8,captionIcon:(o=e==null?void 0:e.blockCaptionIcon)!=null?o:b3t,confirmButton:(a=e==null?void 0:e.blockConfirmButton)!=null?a:"Confirm",captionPlaceholderText:(l=e==null?void 0:e.blockCaptionPlaceholderText)!=null?l:"Write Image Caption",uploadPlaceholderText:(c=e==null?void 0:e.blockUploadPlaceholderText)!=null?c:"or paste link",onUpload:(d=(u=e==null?void 0:e.blockOnUpload)!=null?u:e==null?void 0:e.onUpload)!=null?d:r.onUpload,proxyDomURL:e==null?void 0:e.proxyDomURL,onImageLoadError:(h=e==null?void 0:e.onImageLoadError)!=null?h:r.onImageLoadError,maxWidth:e==null?void 0:e.maxWidth,maxHeight:e==null?void 0:e.maxHeight}})}).use(Myt).use(j_t)},LCt=Jl.extendSchema(t=>e=>{const n=t(e);return{...n,toMarkdown:{match:n.toMarkdown.match,runner:(r,i)=>{var s,o;if(((s=i.attrs.language)!=null?s:"").toLowerCase()==="latex")r.addNode("math",void 0,((o=i.content.firstChild)==null?void 0:o.text)||"");else return n.toMarkdown.runner(r,i)}}}}),e_="math_inline",Bk=xi(e_,()=>({group:"inline",inline:!0,draggable:!0,atom:!0,attrs:{value:{default:""}},parseDOM:[{tag:`span[data-type="${e_}"]`,getAttrs:t=>{var e;return{value:(e=t.dataset.value)!=null?e:""}}}],toDOM:t=>{const e=t.attrs.value,n=document.createElement("span");return n.dataset.type=e_,n.dataset.value=e,j3e.render(e,n,{throwOnError:!1}),n},parseMarkdown:{match:t=>t.type==="inlineMath",runner:(t,e,n)=>{t.addNode(n,{value:e.value})}},toMarkdown:{match:t=>t.type.name===e_,runner:(t,e)=>{t.addNode("inlineMath",void 0,e.attrs.value)}}})),KCe=bt("ToggleLatex",t=>()=>(e,n)=>{const{hasNode:r,pos:i,target:s}=W2e(e,Bk.type(t)),{selection:o,doc:a,tr:l}=e;if(!r){const f=a.textBetween(o.from,o.to);let p=l.replaceSelectionWith(Bk.type(t).create({value:f}));return n&&n(p.setSelection(Et.create(p.doc,o.from))),!0}const{from:c,to:u}=o;if(!s||i<0)return!1;let d=l.delete(i,i+1);const h=s.attrs.value;return d=d.insertText(h,i),n&&n(d.setSelection(mt.create(d.doc,c,u+h.length-1))),!0}),rae=q3("INLINE_LATEX");P0(X);const zCt=es({props:{config:{type:Object,required:!0},innerView:{type:Object,required:!0},updateValue:{type:Object,required:!0}},setup(t){const e=r=>{if(!(!r||!(r instanceof HTMLElement))){for(;r.firstChild;)r.removeChild(r.firstChild);t.innerView.value&&r.appendChild(t.innerView.value.dom)}},n=r=>{r.preventDefault(),t.updateValue.value()};return()=>X("div",{class:"container"},t.innerView&&X("div",{ref:e}),X("button",{type:"button",onPointerdown:n},X(_o,{icon:t.config.inlineEditConfirm})))}});var YCe=t=>{throw TypeError(t)},ZCe=(t,e,n)=>e.has(t)||YCe("Cannot "+n),rs=(t,e,n)=>(ZCe(t,e,"read from private field"),n?n.call(t):e.get(t)),ep=(t,e,n)=>e.has(t)?YCe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),mT=(t,e,n,r)=>(ZCe(t,e,"write to private field"),e.set(t,n),n),t_,Tv,dA,yg,n_,r_,uF,dF;class jCt{constructor(e,n,r){this.ctx=e,ep(this,t_),ep(this,Tv),ep(this,dA),ep(this,yg,w8(null)),ep(this,n_,w8(()=>{})),ep(this,r_),ep(this,uF,()=>{rs(this,yg).value&&(rs(this,yg).value.destroy(),rs(this,yg).value=null)}),ep(this,dF,s=>{const a=(()=>{if(!s.editable)return!1;const{selection:l,schema:c}=s.state;if(l.empty||!(l instanceof Et))return!1;const u=l.node;if(u.type.name!==e_)return!1;const d=l.from,h=c.nodes.paragraph.create(null,c.text(u.attrs.value)),f=new mq(rs(this,dA),{state:Ig.create({doc:h,schema:new d2e({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return["p",0]}},text:{group:"inline"}}}),plugins:[G2e({"Mod-z":PR,"Mod-Z":yx,"Mod-y":yx,Enter:()=>(rs(this,n_).value(),!0)})]})});return rs(this,yg).value=f,rs(this,n_).value=()=>{const{tr:p}=s.state;p.setNodeAttribute(d,"value",f.state.doc.textContent),s.dispatch(p),requestAnimationFrame(()=>{s.focus()})},!0})();return a||rs(this,uF).call(this),a}),this.update=(s,o)=>{rs(this,Tv).update(s,o)},this.destroy=()=>{rs(this,r_).unmount(),rs(this,Tv).destroy(),rs(this,t_).remove()};const i=document.createElement("div");i.className="milkdown-latex-inline-edit",mT(this,t_,i),mT(this,r_,hl(zCt,{config:r,innerView:rs(this,yg),updateValue:rs(this,n_)})),rs(this,r_).mount(i),mT(this,Tv,new U3({debounce:0,content:rs(this,t_),shouldShow:rs(this,dF),offset:10,floatingUIOptions:{placement:"bottom"}})),rs(this,Tv).update(n),mT(this,dA,document.createElement("div"))}}t_=new WeakMap;Tv=new WeakMap;dA=new WeakMap;yg=new WeakMap;n_=new WeakMap;r_=new WeakMap;uF=new WeakMap;dF=new WeakMap;const BCt=co(t=>Odt(/(?:\$)([^$]+)(?:\$)$/,Bk.type(t),{getAttr:e=>{var n;return{value:(n=e[1])!=null?n:""}}})),FCt=co(t=>iq(/^\$\$[\s\n]$/,Jl.type(t),()=>({language:"LaTeX"}))),VCt=Nd("remarkMath",()=>Wkt);function $Ct(t){return C0(t,"math",(e,n,r)=>{const{value:i}=e,s={type:"code",lang:"LaTeX",value:i};r.children.splice(n,1,s)})}const HCt=Nd("remarkMathBlock",()=>()=>$Ct),UCt=(t,e)=>{t.config(uc(yn.Latex)).config(n=>{if(!T2(n).get().includes(yn.CodeMirror))throw new Error("You need to enable CodeMirror to use LaTeX feature");n.update(lC.key,s=>({...s,renderPreview:(o,a,l)=>{if(o.toLowerCase()==="latex"&&a.length>0)return qCt(a,e==null?void 0:e.katexOptions);const c=s.renderPreview;return c(o,a,l)}})),n.set(rae.key,{view:s=>{var o;return new jCt(n,s,{inlineEditConfirm:(o=e==null?void 0:e.inlineEditConfirm)!=null?o:rM,...e})}})}).use(VCt).use(HCt).use(Bk).use(rae).use(BCt).use(FCt).use(LCt).use(KCe)};function qCt(t,e){return j3e.renderToString(t,{...e,throwOnError:!1,displayMode:!0})}const WCt=(t,e)=>{t.config(uc(yn.LinkTooltip)).config(S5t).config(n=>{n.update(Sx.key,r=>{var i,s,o,a,l,c;return{...r,linkIcon:(i=e==null?void 0:e.linkIcon)!=null?i:fCe,editButton:(s=e==null?void 0:e.editButton)!=null?s:zk,removeButton:(o=e==null?void 0:e.removeButton)!=null?o:rF,confirmButton:(a=e==null?void 0:e.confirmButton)!=null?a:rM,inputPlaceholder:(l=e==null?void 0:e.inputPlaceholder)!=null?l:"Paste link...",onCopyLink:(c=e==null?void 0:e.onCopyLink)!=null?c:()=>{}}})}).use(k5t)};function GCt(t,e){t.set(JR.key,{renderLabel:({label:n,listType:r,checked:i})=>{var s,o,a;return i==null?r==="bullet"?(s=e==null?void 0:e.bulletIcon)!=null?s:v3t:n:i?(o=e==null?void 0:e.checkBoxCheckedIcon)!=null?o:w3t:(a=e==null?void 0:e.checkBoxUncheckedIcon)!=null?a:x3t}})}const KCt=(t,e)=>{t.config(uc(yn.ListItem)).config(n=>GCt(n,e)).use(M5t)};function YCt(t){var e;return t.childCount<=1&&!((e=t.firstChild)!=null&&e.content.size)}function ZCt(t,e){const{selection:n}=t;if(!n.empty)return null;const r=n.$anchor,i=r.parent;if(i.content.size>0||hd(a=>a.type.name==="table")(r))return null;const o=r.before();return sr.node(o,o+i.nodeSize,{class:"crepe-placeholder","data-placeholder":e})}const hF=xn({text:"Please enter...",mode:"block"},"placeholderConfigCtx"),XCt=Sr(t=>new Fn({key:new Vn("CREPE_PLACEHOLDER"),props:{decorations:e=>{var n;if($3t(t).readonly)return null;const i=t.get(hF.key);if(i.mode==="doc"&&!YCt(e.doc)||BCe(e.selection)||FCe(e.selection))return null;const s=(n=i.text)!=null?n:"Please enter...",o=ZCt(e,s);return o?En.create(e.doc,[o]):null}}})),QCt=(t,e)=>{t.config(uc(yn.Placeholder)).config(n=>{e&&n.update(hF.key,r=>({...r,...e}))}).use(XCt).use(hF)},JCt=(t,e)=>{t.config(uc(yn.Table)).config(n=>{n.update(eM.key,r=>({...r,renderButton:i=>{var s,o,a,l,c,u,d,h,f;switch(i){case"add_row":return(s=e==null?void 0:e.addRowIcon)!=null?s:nF;case"add_col":return(o=e==null?void 0:e.addColIcon)!=null?o:nF;case"delete_row":return(a=e==null?void 0:e.deleteRowIcon)!=null?a:rF;case"delete_col":return(l=e==null?void 0:e.deleteColIcon)!=null?l:rF;case"align_col_left":return(c=e==null?void 0:e.alignLeftIcon)!=null?c:g3t;case"align_col_center":return(u=e==null?void 0:e.alignCenterIcon)!=null?u:m3t;case"align_col_right":return(d=e==null?void 0:e.alignRightIcon)!=null?d:y3t;case"col_drag_handle":return(h=e==null?void 0:e.colDragHandleIcon)!=null?h:Yoe;case"row_drag_handle":return(f=e==null?void 0:e.rowDragHandleIcon)!=null?f:Yoe}}}))}).use(i3t)};function eEt(t,e){var n,r,i,s,o,a,l,c,u;const d=new hK;d.addGroup("formatting","Formatting").addItem("bold",{icon:(n=t==null?void 0:t.boldIcon)!=null?n:dCe,active:g=>g.get(je).call(wg.key,Ry.type(g)),onRun:g=>{g.get(je).call(Q3.key)}}).addItem("italic",{icon:(r=t==null?void 0:t.italicIcon)!=null?r:gCe,active:g=>g.get(je).call(wg.key,I0.type(g)),onRun:g=>{g.get(je).call(X3.key)}}).addItem("strikethrough",{icon:(i=t==null?void 0:t.strikethroughIcon)!=null?i:xCe,active:g=>g.get(je).call(wg.key,Dy.type(g)),onRun:g=>{g.get(je).call(rC.key)}});const h=d.addGroup("function","Function");h.addItem("code",{icon:(s=t==null?void 0:t.codeIcon)!=null?s:aK,active:g=>g.get(je).call(wg.key,Lc.type(g)),onRun:g=>{g.get(je).call(J3.key)}});const f=e&&T2(e).get();if((f==null?void 0:f.includes(yn.Latex))&&h.addItem("latex",{icon:(o=t==null?void 0:t.latexIcon)!=null?o:lK,active:g=>g.get(je).call(jSe.key,Bk.type(g)),onRun:g=>{g.get(je).call(KCe.key)}}),h.addItem("link",{icon:(a=t==null?void 0:t.linkIcon)!=null?a:yCe,active:g=>g.get(je).call(wg.key,tl.type(g)),onRun:g=>{g.get(je).call(YG.key)}}),e&&(f!=null&&f.includes(yn.AI))){const g=e.get(kx.key);g.provider&&h.addItem("ai",{icon:(c=(l=t==null?void 0:t.aiIcon)!=null?l:g.aiIcon)!=null?c:iK,active:()=>!1,onRun:y=>{const v=y.get(dK.key),b=y.get(cn),{from:_,to:S}=b.state.selection;v.show(_,S)}})}return(u=t==null?void 0:t.buildToolbar)==null||u.call(t,d),d.build()}P0(X,mr);const tEt=es({props:{ctx:{type:Object,required:!0},hide:{type:Function,required:!0},show:{type:Object,required:!0},selection:{type:Object,required:!0},config:{type:Object,required:!1}},setup(t){const{ctx:e,config:n}=t,r=o=>a=>{a.preventDefault(),e&&(o==null||o(e))};function i(o){return P0(t.selection.value),e.get(d8).status!==Ws.Created?!1:o(e)}const s=Ll(()=>eEt(n,e));return()=>X(mr,null,s.value.map(o=>o.items.map(a=>X("button",{type:"button",class:ji("toolbar-item",e&&i(a.active)&&"active"),onPointerdown:r(a.onRun)},X(_o,{icon:a.icon})))).reduce((o,a,l)=>(l===0?o.push(...a):o.push(X("div",{class:"divider"}),...a),o),[]))}});var XCe=t=>{throw TypeError(t)},QCe=(t,e,n)=>e.has(t)||XCe("Cannot "+n),Ra=(t,e,n)=>(QCe(t,e,"read from private field"),n?n.call(t):e.get(t)),c4=(t,e,n)=>e.has(t)?XCe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),gT=(t,e,n,r)=>(QCe(t,e,"write to private field"),e.set(t,n),n),up,i_,hA,s_,o_;const iae=q3("CREPE_TOOLBAR");class nEt{constructor(e,n,r){c4(this,up),c4(this,i_),c4(this,hA),c4(this,s_),c4(this,o_,nt(!1)),this.update=(o,a)=>{Ra(this,up).update(o,a),Ra(this,s_).value=o.state.selection},this.destroy=()=>{Ra(this,up).destroy(),Ra(this,hA).unmount(),Ra(this,i_).remove()},this.hide=()=>{Ra(this,up).hide()};const i=document.createElement("div");i.className="milkdown-toolbar",gT(this,s_,w8(n.state.selection));const s=hl(tEt,{ctx:e,hide:this.hide,config:r,selection:Ra(this,s_),show:Ra(this,o_)});s.mount(i),gT(this,i_,i),gT(this,hA,s),gT(this,up,new U3({content:Ra(this,i_),debounce:20,offset:10,shouldShow(o){const{doc:a,selection:l}=o.state,{empty:c,from:u,to:d}=l,h=!a.textBetween(u,d).length&&l instanceof mt,f=!(l instanceof mt),p=o.dom.getRootNode().activeElement,g=i.contains(p),y=!o.hasFocus()&&!g,v=!o.editable;return!(y||f||c||h||v)}})),Ra(this,up).onShow=()=>{Ra(this,o_).value=!0},Ra(this,up).onHide=()=>{Ra(this,o_).value=!1},this.update(n)}}up=new WeakMap;i_=new WeakMap;hA=new WeakMap;s_=new WeakMap;o_=new WeakMap;const rEt=(t,e)=>{t.config(uc(yn.Toolbar)).config(n=>{n.set(iae.key,{view:r=>new nEt(n,r,e)})}).use(iae)},JCe=[{label:"Paragraph",level:null},{label:"Heading 1",level:1},{label:"Heading 2",level:2},{label:"Heading 3",level:3},{label:"Heading 4",level:4},{label:"Heading 5",level:5},{label:"Heading 6",level:6}];function iEt(t,e){var n,r;const i=e??JCe,s=t.get(cn),{$from:o}=s.state.selection,a=o.parent,l=(n=i.find(c=>c.level===null))!=null?n:i[0];if(a.type===Co.type(t)){const c=a.attrs.level;return(r=i.find(u=>u.level===c))!=null?r:l}return l}function sEt(t,e){const n=t.get(je);if(e==null){const r=al.type(t);n.call(Sl.key,{nodeType:r})}else{const r=Co.type(t);n.call(Sl.key,{nodeType:r,attrs:{level:e}})}}function ig(t,e){if(t.get(je).call(wg.key,e))return!0;const i=t.get(cn),{state:s}=i;if(s.storedMarks)return s.storedMarks.some(o=>o.type===e);if(s.selection instanceof mt){const{$cursor:o}=s.selection;if(o)return o.marks().some(a=>a.type===e)}return!1}function oEt(t,e){const n=t??JCe;return{icon:"",active:()=>!1,selector:{chevronIcon:e??sK,activeLabel:r=>iEt(r,n).label,options:n.map(r=>({label:r.label,onSelect:i=>sEt(i,r.level)}))}}}function aEt(t,e){var n,r,i,s,o,a,l,c,u,d,h,f,p,g,y;const v=e&&T2(e).get(),b=v==null?void 0:v.includes(yn.Latex),_=v==null?void 0:v.includes(yn.ImageBlock),S=v==null?void 0:v.includes(yn.Table),k=new hK;k.addGroup("heading","Heading").addItem("heading-selector",{...oEt(t==null?void 0:t.headingOptions,t==null?void 0:t.chevronDownIcon)}),k.addGroup("formatting","Formatting").addItem("bold",{icon:(n=t==null?void 0:t.boldIcon)!=null?n:dCe,active:C=>ig(C,Ry.type(C)),onRun:C=>{C.get(je).call(Q3.key)}}).addItem("italic",{icon:(r=t==null?void 0:t.italicIcon)!=null?r:gCe,active:C=>ig(C,I0.type(C)),onRun:C=>{C.get(je).call(X3.key)}}).addItem("strikethrough",{icon:(i=t==null?void 0:t.strikethroughIcon)!=null?i:xCe,active:C=>ig(C,Dy.type(C)),onRun:C=>{C.get(je).call(rC.key)}}).addItem("code",{icon:(s=t==null?void 0:t.codeIcon)!=null?s:aK,active:C=>ig(C,Lc.type(C)),onRun:C=>{const R=C.get(cn),{state:M}=R;if(M.selection.empty){const D=Lc.type(C);ig(C,D)?R.dispatch(M.tr.removeStoredMark(D)):R.dispatch(M.tr.addStoredMark(D.create()))}else C.get(je).call(J3.key)}}),k.addGroup("list","List").addItem("bullet-list",{icon:(o=t==null?void 0:t.bulletListIcon)!=null?o:hCe,active:()=>!1,onRun:C=>{const R=C.get(je),M=R0.type(C);R.call(Dh.key,{nodeType:M})}}).addItem("ordered-list",{icon:(a=t==null?void 0:t.orderedListIcon)!=null?a:vCe,active:()=>!1,onRun:C=>{const R=C.get(je),M=M0.type(C);R.call(Dh.key,{nodeType:M})}}).addItem("task-list",{icon:(l=t==null?void 0:t.taskListIcon)!=null?l:SCe,active:()=>!1,onRun:C=>{const R=C.get(je),M=ac.type(C);R.call(Dh.key,{nodeType:M,attrs:{checked:!1}})}});const T=k.addGroup("insert","Insert");T.addItem("link",{icon:(c=t==null?void 0:t.linkIcon)!=null?c:yCe,active:C=>ig(C,tl.type(C)),onRun:C=>{const R=C.get(cn),{state:M}=R,D=tl.type(C);if(M.selection.empty&&ig(C,D)){R.dispatch(M.tr.removeStoredMark(D));return}C.get(je).call(YG.key)}}),_&&T.addItem("image",{icon:(u=t==null?void 0:t.imageIcon)!=null?u:q8,active:()=>!1,onRun:C=>{const R=C.get(je),M=nC.type(C);R.call(Ph.key,{nodeType:M})}}),S&&T.addItem("table",{icon:(d=t==null?void 0:t.tableIcon)!=null?d:_Ce,active:()=>!1,onRun:C=>{const R=C.get(je),M=C.get(cn),{from:D}=M.state.selection;R.call(Ph.key,{nodeType:RR(C,3,3)}),R.call(jW.key,{pos:D})}});const E=k.addGroup("block","Block");return E.addItem("code-block",{icon:(h=t==null?void 0:t.codeBlockIcon)!=null?h:k3t,active:()=>!1,onRun:C=>{const R=C.get(je),M=Jl.type(C);R.call(Sl.key,{nodeType:M})}}),b&&E.addItem("math",{icon:(f=t==null?void 0:t.mathIcon)!=null?f:lK,active:()=>!1,onRun:C=>{const R=C.get(je),M=Jl.type(C);R.call(Ph.key,{nodeType:M,attrs:{language:"LaTeX"}})}}),k.addGroup("more","More").addItem("quote",{icon:(p=t==null?void 0:t.quoteIcon)!=null?p:bCe,active:()=>!1,onRun:C=>{const R=C.get(je),M=My.type(C);R.call(Dh.key,{nodeType:M})}}).addItem("hr",{icon:(g=t==null?void 0:t.hrIcon)!=null?g:pCe,active:()=>!1,onRun:C=>{const R=C.get(je),M=Oy.type(C);R.call(Ph.key,{nodeType:M})}}),(y=t==null?void 0:t.buildTopBar)==null||y.call(t,k),k.build()}P0(X,mr);const lEt=es({props:{ctx:{type:Object,required:!0},version:{type:Object,required:!0},config:{type:Object,required:!1}},setup(t){const{ctx:e,config:n}=t,r=nt(null),i=p=>g=>{g.preventDefault(),e&&p(e)};function s(){return e.get(d8).status===Ws.Created}function o(){P0(t.version.value)}function a(p){return o(),s()?p(e):!1}function l(p){var g,y;return o(),s()?p.activeLabel(e):(y=(g=p.options[0])==null?void 0:g.label)!=null?y:""}function c(p,g){g.preventDefault(),g.stopPropagation(),r.value=r.value===p?null:p}const u=p=>{p.target.closest(".top-bar-heading-selector")||(r.value=null)};m2(()=>{window.addEventListener("pointerdown",u)}),g2(()=>{window.removeEventListener("pointerdown",u)});const d=Ll(()=>aEt(n,e));function h(p,g){const y=r.value===p,v=l(g);return X("div",{key:p,class:"top-bar-heading-selector"},X("button",{type:"button",class:"top-bar-heading-button",onPointerdown:b=>c(p,b)},X("span",{class:"top-bar-heading-label"},v),g.chevronIcon&&X("span",{class:"top-bar-chevron"},X(_o,{icon:g.chevronIcon}))),y&&X("div",{class:"top-bar-heading-dropdown"},g.options.map((b,_)=>X("button",{key:`${p}-${_}`,type:"button",class:ji("top-bar-heading-option",v===b.label&&"active"),onPointerdown:S=>{S.preventDefault(),S.stopPropagation(),r.value=null,b.onSelect(e)}},b.label))))}function f(p){return X("button",{key:p.key,type:"button",class:ji("top-bar-item",a(p.active)&&"active"),onPointerdown:i(p.onRun)},X(_o,{icon:p.icon}))}return()=>{const p=s()?e.get(cn):null;return(p?!p.editable:!1)?null:X("div",{class:"top-bar-inner"},d.value.map(y=>y.items.map(v=>v.selector?h(v.key,v.selector):v.onRun?f(v):null)).reduce((y,v,b)=>{var _,S;if(b===0)y.push(...v);else{const k=(S=(_=d.value[b])==null?void 0:_.key)!=null?S:b;y.push(X("div",{key:`divider-${k}`,class:"top-bar-divider"}),...v)}return y},[]))}}});var eEe=t=>{throw TypeError(t)},tEe=(t,e,n)=>e.has(t)||eEe("Cannot "+n),u4=(t,e,n)=>(tEe(t,e,"read from private field"),n?n.call(t):e.get(t)),FD=(t,e,n)=>e.has(t)?eEe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),VD=(t,e,n,r)=>(tEe(t,e,"write to private field"),e.set(t,n),n),a_,fA,l_;const cEt=new Vn("CREPE_TOP_BAR");class uEt{constructor(e,n,r){FD(this,a_),FD(this,fA),FD(this,l_),this.update=(a,l)=>{u4(this,a_).style.display=a.editable?"":"none",u4(this,l_).value++},this.destroy=()=>{u4(this,fA).unmount(),u4(this,a_).remove()},VD(this,l_,nt(0));const i=document.createElement("div");i.className="milkdown-top-bar";const s=hl(lEt,{ctx:e,config:r,version:u4(this,l_)});s.mount(i),VD(this,a_,i),VD(this,fA,s);const o=n.dom.parentElement;o&&o.insertBefore(i,o.firstChild),this.update(n)}}a_=new WeakMap;fA=new WeakMap;l_=new WeakMap;const fF=xn({view:()=>({update:()=>{},destroy:()=>{}})},"topBarConfig"),dEt=Sr(t=>{const e=t.get(fF.key);return new Fn({key:cEt,view:e.view})}),hEt=(t,e)=>{t.config(uc(yn.TopBar)).config(n=>{n.set(fF.key,{view:r=>new uEt(n,r,e)})}).use(fF).use(dEt)};function fEt(t,e,n){switch(t){case yn.CodeMirror:return OCt(e,n);case yn.ListItem:return KCt(e,n);case yn.LinkTooltip:return WCt(e,n);case yn.ImageBlock:return PCt(e,n);case yn.Cursor:return DCt(e,n);case yn.BlockEdit:return NCt(e,n);case yn.Placeholder:return QCt(e,n);case yn.Toolbar:return rEt(e,n);case yn.Table:return JCt(e,n);case yn.Latex:return UCt(e,n);case yn.TopBar:return hEt(e,n);case yn.AI:return _Ct(e,n)}}var nEe=t=>{throw TypeError(t)},rEe=(t,e,n)=>e.has(t)||nEe("Cannot "+n),Ma=(t,e,n)=>(rEe(t,e,"read from private field"),n?n.call(t):e.get(t)),$D=(t,e,n)=>e.has(t)?nEe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),HD=(t,e,n,r)=>(rEe(t,e,"write to private field"),e.set(t,n),n),Na,pA,c_;class pEt{constructor({root:e,defaultValue:n=""}={}){$D(this,Na),$D(this,pA),$D(this,c_,!0),this.addFeature=(i,s)=>(i(Ma(this,Na),s),this),this.create=()=>Ma(this,Na).create(),this.destroy=()=>Ma(this,Na).destroy(),this.setReadonly=i=>(HD(this,c_,!i),Ma(this,Na).action(s=>{Ma(this,Na).status===Ws.Created&&s.get(cn).setProps({editable:()=>!i})}),this),this.getMarkdown=()=>Ma(this,Na).action(Qft()),this.on=i=>Ma(this,Na).status!==Ws.Created?(Ma(this,Na).config(s=>{const o=s.get(U8);i(o)}),this):(Ma(this,Na).action(s=>{const o=s.get(U8);i(o)}),this);var r;HD(this,pA,(r=typeof e=="string"?document.querySelector(e):e)!=null?r:document.body),HD(this,Na,Gft.make().config(i=>{i.inject(V3t,this),i.inject(F3t,[])}).config(i=>{i.set(C6,Ma(this,pA)),i.set(x6,n),i.set(J_,{editable:()=>Ma(this,c_)}),i.update(nM.key,s=>({...s,size:4})),i.update(Tb.key,s=>({...s,uploader:async(o,a,l)=>{const u=T2(l).get().includes(yn.ImageBlock),d=u?a.nodes["image-block"]:a.nodes.image;if(!d)return[];const h=u?l.get(tC.key).onUpload:void 0,f=[];for(let g=0;g<o.length;g++){const y=o.item(g);y&&y.type.includes("image")&&f.push(y)}return await Promise.all(f.map(async g=>{const y=h?await h(g):URL.createObjectURL(g);return d.createAndFill({src:y})}))}}))}).use(uyt).use(lCe).use(o3t).use(l3t).use(u3t).use(iCe).use(f3t).use(Owt))}get editor(){return Ma(this,Na)}get readonly(){return!Ma(this,c_)}}Na=new WeakMap;pA=new WeakMap;c_=new WeakMap;class Us extends pEt{constructor({features:e={},featureConfigs:n={},...r}={}){super(r);const i=Ltt(n,B3t);Object.entries({...p3t,...e}).filter(([,o])=>o).map(([o])=>o).forEach(o=>{const a=i[o];fEt(o,this.editor,a)})}}Us.Feature=yn;function iEe({value:t,onChange:e,placeholder:n,readOnly:r=!1,autoFocus:i=!0,className:s}){const o=x.useRef(null),a=x.useRef(e);return a.current=e,x.useEffect(()=>{const l=o.current;if(!l)return;let c=!1,u=null;const d=new Us({root:l,defaultValue:t,features:{[Us.Feature.CodeMirror]:!0,[Us.Feature.ListItem]:!0,[Us.Feature.Table]:!0,[Us.Feature.LinkTooltip]:!r,[Us.Feature.Cursor]:!r,[Us.Feature.BlockEdit]:!r,[Us.Feature.Toolbar]:!r,[Us.Feature.Placeholder]:!r,[Us.Feature.ImageBlock]:!0,[Us.Feature.Latex]:!1,[Us.Feature.TopBar]:!1,[Us.Feature.AI]:!1},featureConfigs:{[Us.Feature.Placeholder]:{text:n??""},[Us.Feature.ImageBlock]:{blockUploadPlaceholderText:"Paste an image link…",inlineUploadPlaceholderText:"paste an image link",maxHeight:420,onUpload:()=>Promise.reject(new Error("Image uploads disabled"))}}});return d.setReadonly(r),r||d.on(h=>{h.markdownUpdated((f,p)=>{var g;(g=a.current)==null||g.call(a,p)})}),d.create().then(()=>{if(c){d.destroy();return}u=d,i&&!r&&d.editor.action(h=>{const f=h.get(cn);f.dispatch(f.state.tr.setSelection(jt.atEnd(f.state.doc)).scrollIntoView()),f.focus()})}),()=>{c=!0,u==null||u.destroy()}},[r]),m.jsx("div",{ref:o,className:He("llink-crepe",!r&&"llink-crepe--fill scrollbar-card",s)})}const mEt=120;function sEe({textContent:t,onTextChange:e,onSubmit:n,onCancel:r,submitHint:i="next",attachmentProps:s}){const o=x.useRef(null),[a,l]=x.useState(!1),[c,u]=x.useState(t);x.useEffect(()=>{const k=setTimeout(()=>u(t),500);return()=>clearTimeout(k)},[t]);const d=Uve(c),f=((s==null?void 0:s.attachments.length)??0)>0||d.length>0;!a&&(t.length>=mEt||f||Hve(t))&&l(!0);const g=!a;x.useEffect(()=>{if(!g)return;const k=setTimeout(()=>{const T=o.current;T&&(T.focus(),T.selectionStart=T.selectionEnd=T.value.length)},0);return()=>clearTimeout(k)},[g]);const y=x.useCallback(k=>{k.key==="Escape"?(k.preventDefault(),k.stopPropagation(),r()):k.key==="Enter"&&(k.metaKey||k.ctrlKey)?(k.preventDefault(),k.stopPropagation(),t.trim()&&n()):k.key==="m"&&(k.metaKey||k.ctrlKey)&&(k.preventDefault(),k.stopPropagation(),l(!0))},[r,n,t]),v=s&&m.jsx(Vve,{attachments:s.attachments,onRemove:s.onRemoveAttachment,onAddClick:s.onAddFiles,linkPreviews:d}),b=m.jsxs("div",{className:"absolute bottom-4 flex items-center gap-4 text-sm text-white/50",children:[m.jsx(nn,{keys:"Esc",onClick:r,title:"Cancel (or press Esc)",children:"cancel"}),m.jsx(nn,{keys:`${Yu}+Enter`,onClick:()=>{t.trim()&&n()},title:`Submit (or press ${Yu}+Enter)`,children:i}),g&&m.jsx(nn,{keys:`${Yu}+M`,onClick:()=>l(!0),title:`Switch to markdown editor (or press ${Yu}+M)`,children:"markdown"}),s&&m.jsx("span",{children:m.jsxs(Rt,{variant:"ghost",type:"button",onClick:k=>{k.stopPropagation(),s.onAddFiles()},title:"Attach files",children:[m.jsx(Vye,{className:"size-4"}),"attach"]})})]}),_=s==null?void 0:s.dropZoneProps,S=(s==null?void 0:s.isDragging)??!1;if(g){const k=$ve(t.length);return m.jsxs("div",{className:He("absolute inset-0 z-50 flex items-center justify-center bg-black/90",S&&"ring-2 ring-inset ring-white/30"),..._,children:[m.jsx("div",{className:"flex w-full flex-col items-center justify-center gap-6 px-6",children:m.jsx("textarea",{ref:o,value:t,onChange:T=>e(T.target.value),onKeyDown:y,placeholder:"Type a message...",className:He("w-full resize-none border-none bg-transparent p-8 text-center text-white placeholder-white/40 outline-none",k.size,k.weight),rows:4})}),b]})}return m.jsxs("div",{className:He("absolute inset-0 z-50 flex items-center justify-center bg-black/90",S&&"ring-2 ring-inset ring-white/30"),..._,onKeyDownCapture:y,children:[m.jsxs("div",{className:"mx-8 flex h-[calc(100%-8rem)] w-full min-w-0 max-w-[calc(var(--message-content-width)_+_var(--message-editor-gutter)*2)] flex-col overflow-hidden rounded border border-white/10 bg-white/5 backdrop-blur-xl animate-in fade-in zoom-in-95 duration-200",children:[m.jsx("div",{className:"min-h-0 flex-1",children:m.jsx(iEe,{value:t,onChange:e,placeholder:"Hit / to see options"})}),f&&v&&m.jsx("div",{className:"shrink-0 border-t border-white/10 px-5 py-3",children:v})]}),b]})}function gEt({textContent:t,onTextChange:e,onAdvance:n,onCancel:r,attachments:i,onRemoveAttachment:s,onAddFiles:o,isDragging:a,dropZoneProps:l}){return m.jsx(sEe,{textContent:t,onTextChange:e,onSubmit:n,onCancel:r,submitHint:"next",attachmentProps:{attachments:i,onRemoveAttachment:s,onAddFiles:o,isDragging:a,dropZoneProps:l}})}function iM({className:t,...e}){return m.jsx("textarea",{"data-slot":"textarea",className:He("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",t),...e})}const UD="unassigned";function yEt({networkId:t,onCancel:e,onSubmit:n}){var h;const r=xa(t),[i,s]=x.useState(""),[o,a]=x.useState(""),[l,c]=x.useState(UD),u=x.useCallback(()=>{const f=i.trim();f&&n({title:f,...o.trim()&&{notes:o.trim()},...l!==UD&&{assigned_to:l},checklist:[],done:!1})},[i,o,l,n]),d=x.useCallback(f=>{f.key==="Escape"?(f.preventDefault(),e()):f.key==="Enter"&&(f.metaKey||f.ctrlKey)&&(f.preventDefault(),u())},[e,u]);return m.jsxs("div",{className:"absolute inset-0 z-50 flex flex-col bg-black/90 pt-16",onKeyDown:d,tabIndex:-1,children:[m.jsxs("div",{className:"mx-auto w-full max-w-sm space-y-4 px-6",children:[m.jsxs("div",{children:[m.jsx(zl,{className:"mb-1 text-xs text-white/50",children:"Task"}),m.jsx(x0,{type:"text",autoFocus:!0,value:i,onChange:f=>s(f.target.value),placeholder:"What needs to get done?",className:"border-white/10 bg-white/5 text-white placeholder-white/30 focus-visible:border-white/30 focus-visible:ring-0"})]}),m.jsxs("div",{children:[m.jsx(zl,{className:"mb-1 text-xs text-white/50",children:"Notes"}),m.jsx(iM,{value:o,onChange:f=>a(f.target.value),placeholder:"Optional details…",className:"min-h-20 border-white/10 bg-white/5 text-white placeholder:text-white/30 focus-visible:border-white/30 focus-visible:ring-0 dark:bg-white/5"})]}),m.jsxs("div",{children:[m.jsx(zl,{className:"mb-1 text-xs text-white/50",children:"Assign to"}),m.jsxs(tU,{value:l,onValueChange:c,children:[m.jsx(rU,{className:"w-full border-white/10 bg-white/5 text-white",children:m.jsx(nU,{placeholder:"Unassigned"})}),m.jsxs(iU,{children:[m.jsx(ex,{value:UD,children:"Unassigned"}),(h=r==null?void 0:r.humans)==null?void 0:h.map(f=>m.jsx(ex,{value:f.id,children:f.email_prefix},f.id))]})]})]})]}),m.jsxs("div",{className:"absolute bottom-8 left-0 right-0 flex items-center justify-center gap-4 text-sm text-white/50",children:[m.jsx(nn,{keys:"Esc",onClick:e,title:"Cancel (or press Esc)",children:"cancel"}),m.jsx(nn,{keys:`${Yu}+Enter`,onClick:u,title:`Create task (or press ${Yu}+Enter)`,children:"create"})]})]})}const sae=100;function pK({id:t,durationS:e,paused:n,onEnded:r,onProgress:i}){const s=x.useRef(0);x.useEffect(()=>{s.current=0},[t]),x.useEffect(()=>{if(n)return;const o=setInterval(()=>{s.current+=sae/1e3;const a=Math.min(s.current/e,1);i==null||i(a),a>=1&&(clearInterval(o),r())},sae);return()=>clearInterval(o)},[n,e,r,i,t])}const vEt=600;function Fk({remoteValue:t,commit:e,debounceMs:n=vEt}){const[r,i]=x.useState(t),[s,o]=x.useState(!1),[a,l]=x.useState(t);t!==a&&(l(t),s||i(t));const c=x.useRef(t),u=x.useRef(!1),d=x.useRef(void 0),h=x.useRef(e);x.useEffect(()=>{h.current=e},[e]);const f=x.useCallback(()=>{clearTimeout(d.current),d.current=void 0,u.current&&(u.current=!1,h.current(c.current))},[]);x.useEffect(()=>f,[f]);const p=x.useCallback(v=>{c.current=v,i(v),u.current=!0,clearTimeout(d.current),d.current=setTimeout(f,n)},[n,f]),g=x.useCallback(()=>{o(!0)},[]),y=x.useCallback(()=>{o(!1),f()},[f]);return{value:r,onChange:p,onFocus:g,onBlur:y}}const bEt=8;function yT(t){return String(t).padStart(2,"0")}function pF(t){return`${t.getFullYear()}-${yT(t.getMonth()+1)}-${yT(t.getDate())}T${yT(t.getHours())}:${yT(t.getMinutes())}`}const oae="rounded-md border border-white/15 bg-white/5 px-2 py-1 text-sm text-white/80 outline-none [color-scheme:dark] focus:border-white/40";function oEe({particle:t,containerPath:e,paused:n,onEnded:r,onProgress:i}){const{networkId:s,segments:o}=ul(e),a=Xl(Ls(s,[...o,t.id])),{title:l,notes:c,start_at:u,end_at:d}=t.properties,[h,f]=x.useState(!1);oc(h,`event-edit-${t.id}`),pK({id:t.id,durationS:bEt,paused:n,onEnded:r,onProgress:i});const p=Fk({remoteValue:l,commit:b=>Fu(a,{title:b})}),g=Fk({remoteValue:c??"",commit:b=>Fu(a,{notes:b})}),y=x.useCallback(b=>{b&&Fu(a,{start_at:new Date(b)})},[a]),v=x.useCallback(b=>{b?Fu(a,{end_at:new Date(b)}):Cve(a,"properties.end_at",xye())},[a]);return m.jsx("div",{className:"flex h-full w-full items-center justify-center bg-gradient-to-b from-black/40 via-black/20 to-black/40 px-8 pt-[var(--stream-safe-top,2rem)] pb-[var(--stream-safe-bottom,2rem)]",children:m.jsxs("div",{className:"flex max-h-full w-full max-w-[calc(var(--message-content-width)_+_var(--message-card-padding)*2)] flex-col gap-5 overflow-y-auto overscroll-contain rounded bg-white/10 p-[var(--message-card-padding)] backdrop-blur-md",onFocusCapture:()=>f(!0),onBlurCapture:b=>{b.currentTarget.contains(b.relatedTarget)||f(!1)},children:[m.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-violet-300/90",children:[m.jsx(Oye,{className:"size-4"}),Pve(u,d)]}),m.jsx("input",{value:p.value,onChange:b=>p.onChange(b.target.value),onFocus:p.onFocus,onBlur:p.onBlur,placeholder:"Event title",className:"w-full bg-transparent text-2xl font-semibold text-white outline-none placeholder:text-white/30"}),m.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-white/60",children:[m.jsxs("label",{className:"flex items-center gap-2",children:["Starts",m.jsx("input",{type:"datetime-local",value:pF(u),onChange:b=>y(b.target.value),className:oae})]}),m.jsxs("label",{className:"flex items-center gap-2",children:["Ends",m.jsx("input",{type:"datetime-local",value:d?pF(d):"",onChange:b=>v(b.target.value),className:He(oae,!d&&"text-white/40")})]})]}),m.jsx(iM,{value:g.value,onChange:b=>g.onChange(b.target.value),onFocus:g.onFocus,onBlur:g.onBlur,placeholder:"Add notes…",className:"min-h-16 resize-none border-none bg-transparent p-0 text-sm text-white/80 shadow-none placeholder:text-white/30 focus-visible:ring-0 dark:bg-transparent"})]})})}function wEt(){const t=new Date;return t.setMinutes(0,0,0),t.setHours(t.getHours()+1),t}const aae="w-full rounded-md border border-white/10 bg-white/5 px-3 py-1.5 text-sm text-white outline-none [color-scheme:dark] focus:border-white/30";function xEt({onCancel:t,onSubmit:e}){const[n,r]=x.useState(""),[i,s]=x.useState(()=>pF(wEt())),[o,a]=x.useState(""),[l,c]=x.useState(""),u=x.useCallback(()=>{const h=n.trim();!h||!i||e({title:h,start_at:new Date(i),...o&&{end_at:new Date(o)},...l.trim()&&{notes:l.trim()}})},[n,i,o,l,e]),d=x.useCallback(h=>{h.key==="Escape"?(h.preventDefault(),t()):h.key==="Enter"&&(h.metaKey||h.ctrlKey)&&(h.preventDefault(),u())},[t,u]);return m.jsxs("div",{className:"absolute inset-0 z-50 flex flex-col bg-black/90 pt-16",onKeyDown:d,tabIndex:-1,children:[m.jsxs("div",{className:"mx-auto w-full max-w-sm space-y-4 px-6",children:[m.jsxs("div",{children:[m.jsx(zl,{className:"mb-1 text-xs text-white/50",children:"Event"}),m.jsx(x0,{type:"text",autoFocus:!0,value:n,onChange:h=>r(h.target.value),placeholder:"What's happening?",className:"border-white/10 bg-white/5 text-white placeholder-white/30 focus-visible:border-white/30 focus-visible:ring-0"})]}),m.jsxs("div",{className:"flex gap-3",children:[m.jsxs("div",{className:"flex-1",children:[m.jsx(zl,{className:"mb-1 text-xs text-white/50",children:"Starts"}),m.jsx("input",{type:"datetime-local",value:i,onChange:h=>s(h.target.value),className:aae})]}),m.jsxs("div",{className:"flex-1",children:[m.jsx(zl,{className:"mb-1 text-xs text-white/50",children:"Ends"}),m.jsx("input",{type:"datetime-local",value:o,min:i,onChange:h=>a(h.target.value),className:aae})]})]}),m.jsxs("div",{children:[m.jsx(zl,{className:"mb-1 text-xs text-white/50",children:"Notes"}),m.jsx(iM,{value:l,onChange:h=>c(h.target.value),placeholder:"Optional details…",className:"min-h-20 border-white/10 bg-white/5 text-white placeholder:text-white/30 focus-visible:border-white/30 focus-visible:ring-0 dark:bg-white/5"})]})]}),m.jsxs("div",{className:"absolute bottom-8 left-0 right-0 flex items-center justify-center gap-4 text-sm text-white/50",children:[m.jsx(nn,{keys:"Esc",onClick:t,title:"Cancel (or press Esc)",children:"cancel"}),m.jsx(nn,{keys:`${Yu}+Enter`,onClick:u,title:`Create event (or press ${Yu}+Enter)`,children:"create"})]})]})}const lae=["amber","bold","calm","crisp","dark","eager","faint","gentle","hasty","icy","jade","keen","lush","misty","nimble","opal","pale","quiet","rapid","sharp","taut","vivid","warm","zesty","bright","clear","deep","fresh","grand","swift"],cae=["arrow","bloom","cedar","drift","ember","flint","grove","harbor","iris","jewel","knoll","lake","moss","nova","orbit","petal","quartz","ridge","spark","trail","vale","wave","yarn","zenith","brook","cliff","delta","frost","glow","reef"];function _Et(){const t=lae[Math.floor(Math.random()*lae.length)],e=cae[Math.floor(Math.random()*cae.length)];return`${t}-${e}`}function G8({className:t,...e}){return m.jsx(mfe,{"data-slot":"checkbox",className:He("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",t),...e,children:m.jsx(yfe,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:m.jsx(wI,{})})})}function aEe({kind:t="stream",networkId:e,onCancel:n,onSubmit:r}){const{data:i}=k3(),s=i==null?void 0:i.find(b=>b.id===e),[o,a]=x.useState(()=>_Et()),[l,c]=x.useState(!0),u=Dn(b=>{var _;return(_=b.user)==null?void 0:_.id}),[d,h]=x.useState(new Set),f=((s==null?void 0:s.humans)??[]).filter(b=>b.id!==u),p=x.useCallback(b=>{h(_=>{const S=new Set(_);return S.has(b)?S.delete(b):S.add(b),S})},[]),g=x.useCallback(()=>l&&e?[`network:${e}`]:Array.from(h0e([...d,u].filter(Boolean))).map(b=>`human:${b}`),[l,e,d,u]),y=x.useCallback(()=>{!o.trim()||!e||r(o.trim(),g())},[o,e,r,g]),v=x.useCallback(b=>{switch(b.key){case"Escape":b.preventDefault(),n();return;case"Enter":(b.metaKey||b.ctrlKey)&&(b.preventDefault(),y());return}},[n,y]);return m.jsxs("div",{className:"absolute inset-0 z-50 flex flex-col bg-black/90 pt-16",onKeyDown:v,tabIndex:-1,children:[m.jsxs("div",{className:"mx-auto w-full max-w-sm space-y-4 px-6",children:[m.jsxs("div",{children:[m.jsx(zl,{className:"mb-1 text-xs text-white/50",children:t==="folder"?"Folder name":"Stream name"}),m.jsx(x0,{type:"text",autoFocus:!0,value:o,onChange:b=>{a(b.target.value)},placeholder:"Give it a name...",className:"border-white/10 bg-white/5 text-white placeholder-white/30 focus-visible:border-white/30 focus-visible:ring-0"})]}),m.jsxs("div",{children:[m.jsx(zl,{className:"mb-1 text-xs text-white/50",children:"Visible to"}),m.jsxs("div",{className:"rounded-md border border-white/10",children:[m.jsxs("div",{role:"button",onClick:()=>c(b=>!b),className:He("flex w-full cursor-pointer items-center gap-2.5 px-3 py-2 text-left text-sm transition-colors","text-white/70 hover:bg-white/5"),children:[m.jsx(G8,{checked:l,onCheckedChange:b=>c(b===!0),tabIndex:-1,className:"pointer-events-none"}),m.jsx("span",{className:"font-medium",children:"Everyone in network"})]}),!l&&f.length>0&&m.jsx(bd,{className:"max-h-48",children:m.jsx("div",{className:"space-y-0.5 p-1",children:f.map(b=>{const _=d.has(b.id),S=b.email_prefix.slice(0,2).toUpperCase();return m.jsxs("div",{role:"button",onClick:()=>p(b.id),className:He("flex w-full cursor-pointer items-center gap-2.5 rounded px-3 py-1.5 text-left text-sm transition-colors","text-white/70 hover:bg-white/5"),children:[m.jsx(G8,{checked:_,tabIndex:-1,className:"pointer-events-none"}),m.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-white/10 text-[10px] font-medium",children:S}),m.jsx("span",{className:"flex-1 truncate",children:b.email_prefix})]},b.id)})})})]})]})]}),m.jsxs("div",{className:"absolute bottom-8 left-0 right-0 flex items-center justify-center gap-4 text-sm text-white/50",children:[m.jsx(nn,{keys:"Esc",onClick:n,title:"Cancel (or press Esc)",children:"cancel"}),m.jsx(nn,{keys:`${Yu}+Enter`,onClick:y,title:`Create ${t} (or press ${Yu}+Enter)`,children:"create"})]})]})}async function SEt(t,e=200){if(!t.type.startsWith("image/"))return;const n=await createImageBitmap(t),r=Math.min(1,e/Math.max(n.width,n.height)),i=Math.round(n.width*r),s=Math.round(n.height*r),o=new OffscreenCanvas(i,s),a=o.getContext("2d");if(!a)throw new Error("Failed to acquire 2D canvas context");a.drawImage(n,0,0,i,s),n.close();const l=await o.convertToBlob({type:"image/jpeg",quality:.7});return URL.createObjectURL(l)}const kEt=250;function mF({networkId:t,targetPath:e,onActiveChange:n,onStepChange:r,onParticleCreated:i}){const[s,o]=x.useState("idle"),[a,l]=x.useState(null),[c,u]=x.useState(""),[d,h]=x.useState(null),[f,p]=x.useState(null),[g,y]=x.useState(0),[v,b]=x.useState(null),[_,S]=x.useState([]),[k,T]=x.useState("media"),E=G1(Ee=>Ee.recordingMode),C=Eg(Ee=>Ee.mic),R=Eg(Ee=>Ee.camera),{audioInputs:M,videoInputs:D}=xve(),P=L7(C,M),z=L7(R,D),Z=Dn(Ee=>{var St;return(St=Ee.user)==null?void 0:St.id}),re=Ive(),G=Rve(),{data:ee}=oU(t),J=Tve(),oe=Ave(ee),B=x.useRef(s),$e=x.useRef(0),Ye=x.useRef(oe),$=x.useRef(k),Re=x.useRef(null);x.useEffect(()=>{Ye.current=oe,$.current=k},[oe,k]);const ke=x.useCallback(Ee=>{B.current=Ee,o(Ee)},[]);oc(s!=="idle","compose"),x.useEffect(()=>{n==null||n(s!=="idle"),r==null||r(s),s!=="idle"&&J(t)},[s,n,r,J,t]);const Me=x.useCallback(Ee=>{for(const St of Ee)St.thumbnailUrl&&URL.revokeObjectURL(St.thumbnailUrl)},[]),_e=x.useCallback(()=>{ke("idle"),l(null),h(null),p(null),y(0),b(null),T("media"),Re.current=null,S(Ee=>(Me(Ee),[]))},[ke,Me]),Ne=x.useCallback(async Ee=>{const St=ON-_.length;if(St<=0){Hn.error(`Maximum ${ON} attachments`);return}const Ke=Ee.slice(0,St);Ke.length<Ee.length&&Hn.error(`Maximum ${ON} attachments — ${Ee.length-Ke.length} skipped`);const Sn=[];for(const en of Ke){if(en.size>uZe){Hn.error(`${en.name} is too large (max 25 MB)`);continue}const Vi=await SEt(en);Sn.push({id:crypto.randomUUID(),file:en,thumbnailUrl:Vi,status:"pending"})}Sn.length>0&&S(en=>[...en,...Sn])},[_.length]),Ue=x.useCallback(Ee=>{S(St=>{const Ke=St.find(Sn=>Sn.id===Ee);return Ke!=null&&Ke.thumbnailUrl&&URL.revokeObjectURL(Ke.thumbnailUrl),St.filter(Sn=>Sn.id!==Ee)})},[]),{openFilePicker:at,isDragging:ct,dropZoneProps:H}=yve({onFilesSelected:Ne,enabled:s==="typing"||s==="reviewing"}),{startRecording:Y,stopRecording:se,cancelRecording:me}=DQe({mode:E,micDeviceId:P,cameraDeviceId:z,onStreamReady:Ee=>h(Ee),onStreamCleanup:()=>h(null),onFinish:(Ee,St,Ke)=>{ke("reviewing"),p(Ee),y(St),b(Ke)},onError:Ee=>l(Ee)}),{startRecording:de,stopRecording:ie,cancelRecording:Te}=jQe({micDeviceId:P,onFinish:(Ee,St,Ke)=>{ke("reviewing"),p(Ee),y(St),b(Ke)},onError:Ee=>{l(Ee),_e()}}),he=x.useCallback(async(Ee,St)=>{const Sn=`recording-${Date.now()}.webm`,{object_id:en,upload_url:Vi,upload_headers:wt}=await Bn.prepareUpload({network_id:t,name:Sn,content_type:St,content_length:Ee.size});return await fetch(Vi,{method:"PUT",headers:wt,body:Ee}),await Bn.confirmUpload(en),{object_id:en,size_bytes:Ee.size}},[t]),we=x.useCallback(async Ee=>{const{object_id:St,upload_url:Ke,upload_headers:Sn}=await Bn.prepareUpload({network_id:t,name:Ee.name,content_type:Ee.type||"application/octet-stream",content_length:Ee.size});return await fetch(Ke,{method:"PUT",headers:Sn,body:Ee}),await Bn.confirmUpload(St),{object_id:St,size_bytes:Ee.size}},[t]),ye=x.useCallback(async(Ee,St)=>{if(_.length===0||!Z)return;const{networkId:Ke,segments:Sn}=ul(Ee),en=Ls(Ke,[...Sn,St]),wt=(await Promise.allSettled(_.map(async pn=>{S(ni=>ni.map(_i=>_i.id===pn.id?{..._i,status:"uploading"}:_i));const{object_id:tr}=await we(pn.file);await re.mutateAsync({path:en,type:"file",properties:{object_id:tr,filename:pn.file.name,mime_type:pn.file.type||"application/octet-stream",size_bytes:pn.file.size},createdByHumanId:Z})}))).filter(pn=>pn.status==="rejected");wt.length>0&&Hn.error(`${wt.length} attachment${wt.length>1?"s":""} failed to upload`)},[_,Z,we,re]),Ge=x.useCallback(async Ee=>{if(!Z)return;let St;const Ke=Re.current;if(Ke)St=await re.mutateAsync({path:Ee,type:Ke.type,properties:Ke.properties,createdByHumanId:Z});else if(c.trim())St=await re.mutateAsync({path:Ee,type:"text",properties:{content:c},createdByHumanId:Z});else if(f&&v){const{object_id:Sn,size_bytes:en}=await he(f,v),Vi=v.startsWith("audio/");St=await re.mutateAsync({path:Ee,type:"media",properties:{object_id:Sn,mime_type:v,duration_ms:g,size_bytes:en,...!Vi&&{source:k==="screen"?"screen":"camera"}},createdByHumanId:Z})}St&&(await ye(Ee,St),i==null||i(St))},[Z,c,f,v,g,k,re,he,ye,i]),Pe=x.useCallback(Ee=>Ee instanceof jge?(Hn.error("Daily message limit reached. Upgrade to Pro to keep sending."),_e(),!0):!1,[_e]),tt=x.useCallback(async()=>{if(!(!e||!Z||B.current==="submitting")){ke("submitting");try{await Ge(e),_e(),u("")}catch(Ee){if(!Pe(Ee))throw Ee}}},[e,Z,ke,Ge,_e,Pe]),ft=x.useCallback(async(Ee,St)=>{if(!(!Z||B.current==="submitting")){ke("submitting");try{const Ke=await G.mutateAsync({networkId:t,properties:{name:Ee},createdByHumanId:Z,visibleTo:St}),Sn=Ls(t,[Ke]);await Ge(Sn),_e(),u("")}catch(Ke){if(!Pe(Ke))throw Ke}}},[t,Z,G,Ge,_e,Pe,ke]),ne=x.useCallback(()=>B.current!=="idle"?!1:Ye.current?(Hn.info("Daily message limit reached. Upgrade to Pro to keep sending."),!1):!0,[]),fe=x.useCallback(()=>{ne()&&($e.current=Date.now(),T("media"),ke("recording"),Y())},[ne,ke,Y]),Le=x.useCallback(()=>{ne()&&ke("typing")},[ne,ke]),Ze=x.useCallback(()=>{ne()&&ke("task")},[ne,ke]),rt=x.useCallback(()=>{ne()&&ke("event")},[ne,ke]),un=x.useCallback(Ee=>{Re.current=Ee,e?tt():ke("configuring")},[e,tt,ke]),Yt=x.useCallback(()=>{B.current==="recording"&&($.current==="screen"?ie():se())},[se,ie]),_n=x.useCallback(()=>{const Ee=B.current;Ee==="recording"||Ee==="reviewing"?($.current==="screen"?Te():me(),_e()):(Ee==="typing"||Ee==="configuring"||Ee==="picking")&&_e()},[_e,me,Te]),kr=x.useCallback(()=>{B.current==="reviewing"&&(e?tt():ke("configuring"))},[e,tt,ke]),In=YS(Ee=>Ee.clear);x.useEffect(()=>YS.subscribe((Ee,St)=>{const Ke=Ee.intent;if(!(!Ke||Ke===St.intent)){switch(Ke.kind){case"record":fe();break;case"text":Le();break;case"task":Ze();break;case"event":rt();break;case"stop":Yt();break;case"cancel":_n();break;case"send":kr();break}In()}}),[fe,Le,Ze,rt,Yt,_n,kr,In]),x.useEffect(()=>{const Ee=Ke=>{const Sn=B.current;if(Sn==="typing"||Sn==="task"||Sn==="event"||Sn==="configuring"||Sn==="picking"){Ke.key==="Escape"&&(Ke.preventDefault(),_e());return}const en=Ke.target;if(!(en.tagName==="INPUT"||en.tagName==="TEXTAREA"||en.isContentEditable))switch(Sn){case"idle":{if(Ke.key==="`"&&!Ke.repeat)Ke.preventDefault(),fe();else if(Ke.key==="s"||Ke.key==="S"){if(Ke.preventDefault(),!ne()||!AI("Screen recording"))break;T("screen"),ke("picking")}else Ke.key==="t"||Ke.key==="T"?(Ke.preventDefault(),Le()):Ke.key==="d"||Ke.key==="D"?(Ke.preventDefault(),Ze()):(Ke.key==="e"||Ke.key==="E")&&(Ke.preventDefault(),rt());break}case"recording":{Ke.key==="`"&&!Ke.repeat||(Ke.key==="s"||Ke.key==="S")&&$.current==="screen"?(Ke.preventDefault(),Yt()):(Ke.key==="q"||Ke.key==="Q"||Ke.key==="Escape")&&(Ke.preventDefault(),_n());break}case"reviewing":{Ke.key==="q"||Ke.key==="Q"||Ke.key==="Escape"?(Ke.preventDefault(),_n()):Ke.key==="Enter"&&(Ke.preventDefault(),kr());break}}},St=Ke=>{B.current==="recording"&&Ke.key==="`"&&$.current==="media"&&(Ke.preventDefault(),$e.current>0&&Date.now()-$e.current>=kEt&&(Yt(),$e.current=0))};return window.addEventListener("keydown",Ee),window.addEventListener("keyup",St),()=>{window.removeEventListener("keydown",Ee),window.removeEventListener("keyup",St)}},[_e,ke,ne,fe,Le,Ze,rt,Yt,_n,kr]);const Vt=x.useCallback(Ee=>{ke("recording"),de(Ee)},[ke,de]);if(s==="idle")return null;const zr=e?tt:()=>ke("configuring");return m.jsxs(m.Fragment,{children:[s==="picking"&&m.jsx(YQe,{title:"Record your screen",confirmLabel:"Record",getSources:cr.screenRecord.getScreenSources,onSelect:Vt,onCancel:_e}),(s==="recording"||s==="reviewing")&&k==="media"&&m.jsx(lee,{step:s,mediaStream:d,recordingMode:E,reviewBlob:f,error:a,onClose:_e,attachments:_,onRemoveAttachment:Ue,onAddFiles:at,isDragging:ct,dropZoneProps:H,mirror:!0,objectFit:"cover"}),s==="recording"&&k==="screen"&&m.jsxs("div",{className:"absolute inset-0 z-50 flex flex-col items-center justify-center bg-black/90",children:[m.jsx("div",{className:"absolute top-8 z-10",children:m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"h-2.5 w-2.5 animate-pulse rounded-full bg-red-500"}),m.jsx("span",{className:"text-sm text-white/80",children:"Recording screen…"})]})}),m.jsxs("div",{className:"absolute bottom-4 z-10 flex items-center gap-4 text-sm text-white/50",children:[m.jsx(nn,{keys:"S",onClick:Yt,title:"Stop screen recording (or press S)",children:"stop"}),m.jsx(nn,{keys:"Q",onClick:_n,title:"Cancel screen recording (or press Q)",children:"cancel"})]})]}),s==="reviewing"&&k==="screen"&&f&&m.jsx(lee,{step:"reviewing",mediaStream:null,recordingMode:"video",reviewBlob:f,error:a,onClose:_e,attachments:_,onRemoveAttachment:Ue,onAddFiles:at,isDragging:ct,dropZoneProps:H,mirror:!1,objectFit:"contain"}),s==="typing"&&m.jsx(gEt,{textContent:c,onTextChange:u,onAdvance:zr,onCancel:_e,attachments:_,onRemoveAttachment:Ue,onAddFiles:at,isDragging:ct,dropZoneProps:H}),s==="task"&&m.jsx(yEt,{networkId:t,onCancel:_e,onSubmit:Ee=>un({type:"task",properties:Ee})}),s==="event"&&m.jsx(xEt,{onCancel:_e,onSubmit:Ee=>un({type:"event",properties:Ee})}),!e&&s==="configuring"&&m.jsx(aEe,{networkId:t,onCancel:_e,onSubmit:ft}),s==="submitting"&&m.jsx("div",{className:"absolute inset-0 z-50 flex flex-col items-center justify-center bg-black/90",children:m.jsx("span",{className:"animate-pulse text-sm text-white/60",children:"Sending..."})})]})}const CEt=.7;function EEt({networkId:t}){const e=oo(),{data:n}=oU(t),r=_ve(t),i=xa(t);if(!n||n.limit==null)return null;const s=n.used/n.limit;return n.used>=n.limit?m.jsxs("div",{className:"pointer-events-auto flex max-w-md flex-col items-center gap-2 rounded-lg border border-border bg-background/95 px-4 py-3 text-center shadow-lg backdrop-blur",children:[m.jsx("div",{className:"text-sm font-medium",children:r?`You've reached today's ${n.limit}-message limit`:`This network reached today's ${n.limit}-message limit`}),m.jsxs("div",{className:"text-xs text-muted-foreground",children:["Resets ",uae(n.reset_at)," (",dae(n.reset_at),")"]}),r?m.jsx(Rt,{size:"sm",onClick:()=>e(`/${t}/settings?section=billing`),children:"Upgrade to Pro"}):m.jsxs("div",{className:"text-xs text-muted-foreground",children:["Ask"," ",m.jsx("span",{className:"font-medium text-foreground",children:(i==null?void 0:i.admin_human.email_prefix)??"your admin"})," ","to upgrade to Pro"]})]}):s<CEt?null:m.jsxs("div",{className:"pointer-events-auto flex items-center gap-3 rounded-full border border-border bg-background/90 px-3 py-1.5 text-xs text-muted-foreground shadow-sm backdrop-blur",title:`Resets ${uae(n.reset_at)} at ${dae(n.reset_at)}`,children:[m.jsxs("span",{className:"tabular-nums",children:[n.used,"/",n.limit," today"]}),m.jsx(sU,{value:s*100,className:"h-1 w-24"})]})}function uae(t){const e=new Date,n=t.getTime()-e.getTime(),r=Math.max(0,Math.round(n/(60*60*1e3)));return r<1?"soon":r===1?"in 1 hour":`in ${r} hours`}function dae(t){return t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function lEe(){const t=G1(n=>n.recordingMode),e=G1(n=>n.setRecordingMode);return m.jsx(nn,{keys:"V",onClick:()=>e(t==="video"?"audio":"video"),title:t==="video"?"Switch to audio-only (V)":"Switch to video (V)",children:t==="video"?m.jsxs(m.Fragment,{children:[m.jsx(JL,{className:"inline size-3"})," video"]}):m.jsxs(m.Fragment,{children:[m.jsx(zH,{className:"inline size-3"})," audio"]})})}function cEe({path:t,folderParticle:e}){const{networkId:n,segments:r}=ul(t),i=r.length===0,s=oo(),o=Dn(S=>{var k;return(k=S.user)==null?void 0:k.id}),[a,l]=x.useState(!1),[c,u]=x.useState(null),{items:d,isLoading:h,canLoadMore:f,loadMore:p}=pQe(t),g=Ive(),y=Rve(),v=x.useCallback(S=>{s(`/${n}/${[...r,S].join("/")}`)},[s,n,r]),{selectedIndex:b}=mQe({items:d,enabled:!a&&c===null,onOpen:v});x.useEffect(()=>{if(a||c!==null)return;const S=k=>{if(k.defaultPrevented)return;const T=k.target;T.tagName==="INPUT"||T.tagName==="TEXTAREA"||T.isContentEditable||(i&&(k.key==="f"||k.key==="F")?(k.preventDefault(),u("folder")):!i&&(k.key==="n"||k.key==="N")&&(k.preventDefault(),u("stream")))};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[i,a,c]);const _=x.useCallback(async(S,k)=>{if(!o||!c)return;const T=c;u(null);const E=T==="folder"?await g.mutateAsync({path:t,type:"folder",properties:{name:S},createdByHumanId:o,visibleTo:k}):await y.mutateAsync({networkId:n,parentPath:t,properties:{name:S},createdByHumanId:o,visibleTo:k});v(E)},[o,c,t,n,g,y,v]);return m.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[e&&m.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-4 py-3",children:[m.jsx("span",{className:"flex size-7 items-center justify-center rounded-md bg-amber-500/15",children:m.jsx(LH,{className:"size-4 text-amber-500"})}),m.jsx("h1",{className:"truncate text-sm font-semibold",children:e.properties.name})]}),m.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain pb-14 py-2",children:m.jsx(Lve,{items:d,networkId:n,isLoading:h,onOpen:v,selectedIndex:b,canLoadMore:f,onLoadMore:p,emptyMessage:i?"No streams here. Start a conversation using the keyboard shortcuts below.":"This folder is empty. Add something using the keyboard shortcuts below."})}),m.jsx(mF,{networkId:n,targetPath:i?void 0:t,onActiveChange:l}),!a&&m.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-16 z-20 flex justify-center px-3",children:m.jsx(EEt,{networkId:n})}),m.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-20 flex justify-center p-3",children:m.jsx("div",{className:"pointer-events-auto",children:m.jsx(TEt,{isRoot:i,onCreateFolder:()=>u("folder"),onCreateStream:()=>u("stream")})})}),c&&m.jsx(aEe,{kind:c,networkId:n,onCancel:()=>u(null),onSubmit:_})]})}function TEt({isRoot:t,onCreateFolder:e,onCreateStream:n}){const r=YS(i=>i.request);return m.jsxs("div",{className:"flex items-center gap-4 text-sm text-white/50",children:[m.jsx(nn,{keys:["↑↓","Enter"],children:"navigate"}),m.jsx(nn,{keys:"1–9",children:"jump"}),m.jsx(lEe,{}),m.jsx(nn,{keys:"Hold `",onClick:()=>r("record"),title:"Start recording (or hold `)",children:"to start"}),m.jsx(nn,{keys:"T",onClick:()=>r("text"),title:"Compose text (or press T)",children:"text"}),m.jsx(nn,{keys:"D",onClick:()=>r("task"),title:"Create a task (or press D)",children:"task"}),m.jsx(nn,{keys:"E",onClick:()=>r("event"),title:"Create an event (or press E)",children:"event"}),t?m.jsx(nn,{keys:"F",onClick:e,title:"Create a folder (or press F)",children:"folder"}):m.jsx(nn,{keys:"N",onClick:n,title:"Create a stream here (or press N)",children:"stream"})]})}function AEt(){const{networkId:t}=Q5();if(!t)throw new Error("NetworkRoot requires a :networkId route param");return m.jsx(cEe,{path:Ls(t,[])})}function IEt(t,e){return x.useMemo(()=>{if(!t)return{activeSentence:null,activeWordIndex:null};let n=null;for(const a of t.paragraphs){const l=a.sentences.find(c=>e>=c.start&&e<=c.end);if(l){n=l;break}}const r=t.words;let i=null,s=0,o=r.length-1;for(;s<=o;){const a=s+o>>>1;if(e<r[a].start)o=a-1;else if(e>r[a].end)s=a+1;else{i=a;break}}return{activeSentence:n,activeWordIndex:i}},[t,e])}const hae=9;function REt(t){const e=[];for(let n=0;n<t.length;n+=hae)e.push(t.slice(n,n+hae));return e}function fae({transcript:t,activeSentence:e,activeWordIndex:n,centered:r=!1}){const i=x.useMemo(()=>e?t.words.filter(p=>p.start>=e.start&&p.end<=e.end):[],[t.words,e]),s=x.useMemo(()=>REt(i),[i]),o=n!==null?t.words[n]:null,[a,l]=x.useState(null);o&&o!==a&&l(o);const c=o??a,u=x.useMemo(()=>o?s.find(p=>p.some(g=>g.start===o.start&&g.end===o.end))??null:null,[s,o]),[d,h]=x.useState(null);let f;return u?f=u:d&&s.includes(d)?f=d:f=s[0]??null,f!==d&&h(f),!e||!f||f.length===0?null:m.jsx("div",{className:r?"absolute inset-0 flex items-center justify-center px-6":"absolute bottom-15 left-0 right-0 flex justify-center px-6",children:m.jsx("p",{className:"rounded-lg px-5 py-3 text-2xl text-center max-w-lg",children:f.map((p,g)=>{const y=c!==null&&p.start<=c.end;return m.jsxs("span",{className:y?"text-white font-medium transition-colors duration-150":"text-white/40 transition-colors duration-150",children:[g>0?" ":"",p.word]},`${p.start}-${g}`)})})})}function uEe(t,e){const n=x.useMemo(()=>{const{networkId:o,segments:a}=ul(t);return Ls(o,[...a,e])},[t,e]),{children:r,isLoading:i}=KS(n);return{attachments:x.useMemo(()=>(r??[]).filter(o=>o.type==="file"),[r]),isLoading:i}}function dEe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(0)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function MEt(t){return{id:t.id,filename:t.properties.filename,mimeType:t.properties.mime_type,sizeBytes:t.properties.size_bytes,source:{kind:"remote",objectId:t.properties.object_id}}}function hEe(t,e,n,r){RI(t.properties.mime_type)==="lightbox"?r(e):n&&cr.link.openExternal(n)}function NEt({particle:t,onPreview:e}){const{data:n,isLoading:r}=r2(t.properties.object_id);if(r||!n)return m.jsx(em,{className:"h-20 w-20 shrink-0 rounded-lg bg-white/10"});const i=s=>{s.stopPropagation(),cr.attachment.download(n,t.properties.filename)};return m.jsxs("button",{type:"button",onClick:s=>{s.stopPropagation(),e()},className:"group relative block h-30 w-40 shrink-0 overflow-hidden rounded-lg bg-white/10",children:[m.jsx("img",{src:n,alt:t.properties.filename,className:"h-full w-full object-cover"}),m.jsx("span",{role:"button",tabIndex:0,onClick:i,className:"absolute bottom-1 right-1 rounded-full bg-black/60 p-1 text-white/70 opacity-0 transition-opacity hover:text-white group-hover:opacity-100",children:m.jsx(DH,{className:"size-3.5"})})]})}function OEt({particle:t,index:e,onPreview:n}){const{data:r}=r2(t.properties.object_id),i=o=>{o.stopPropagation(),hEe(t,e,r,n)},s=o=>{o.stopPropagation(),r&&cr.attachment.download(r,t.properties.filename)};return m.jsxs("div",{role:"button",onClick:i,className:"flex shrink-0 cursor-pointer flex-col gap-1.5 rounded-lg bg-white/10 px-3 py-2 transition-colors hover:bg-white/15",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(w3,{className:"size-4 shrink-0 text-white/60"}),m.jsx("span",{className:"max-w-[10rem] truncate text-xs font-medium text-white/90",children:t.properties.filename}),m.jsx("span",{className:"text-[10px] text-white/40",children:dEe(t.properties.size_bytes)})]}),m.jsxs("div",{className:"flex gap-2",children:[m.jsxs(Rt,{variant:"ghost",size:"xs",className:"text-white/70 hover:bg-white/10 hover:text-white",onClick:i,children:[m.jsx(PH,{"data-icon":"inline-start"}),"Open"]}),m.jsxs(Rt,{variant:"ghost",size:"xs",className:"text-white/70 hover:bg-white/10 hover:text-white",onClick:s,children:[m.jsx(DH,{"data-icon":"inline-start"}),"Download"]})]})]})}function DEt({particle:t,index:e,onPreview:n}){const r=t.properties.mime_type.startsWith("image/"),{data:i}=r2(t.properties.object_id);return m.jsxs("button",{type:"button",onClick:s=>{s.stopPropagation(),hEe(t,e,i,n)},className:"flex w-full items-center gap-2 rounded-md bg-white/10 px-2.5 py-1.5 text-left transition-colors hover:bg-white/15",children:[r?i?m.jsx("img",{src:i,alt:t.properties.filename,className:"size-5 shrink-0 rounded object-cover"}):m.jsx(jye,{className:"size-4 shrink-0 text-white/50"}):m.jsx(w3,{className:"size-4 shrink-0 text-white/50"}),m.jsx("span",{className:"min-w-0 truncate text-xs text-white/80",children:t.properties.filename}),m.jsx("span",{className:"shrink-0 text-[10px] text-white/40",children:dEe(t.properties.size_bytes)})]})}function fEe({attachments:t,variant:e="inline"}){const[n,r]=x.useState(null),i=x.useMemo(()=>t.filter(l=>RI(l.properties.mime_type)==="lightbox"),[t]),s=x.useMemo(()=>i.map(MEt),[i]),o=l=>{const c=t[l];if(!c)return;const u=i.indexOf(c);u>=0&&r(u)};if(t.length===0)return null;const a=s.length>0&&m.jsx(Fve,{items:s,openIndex:n,onOpenChange:r});return e==="compact"?m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"flex max-w-48 flex-col gap-1",children:t.map((l,c)=>m.jsx(DEt,{particle:l,index:c,onPreview:o},l.id))}),a]}):m.jsxs(m.Fragment,{children:[m.jsxs(bd,{className:"w-full",children:[m.jsx("div",{className:"flex items-center gap-2 py-1",children:t.map((l,c)=>l.properties.mime_type.startsWith("image/")?m.jsx(NEt,{particle:l,onPreview:()=>o(c)},l.id):m.jsx(OEt,{particle:l,index:c,onPreview:o},l.id))}),m.jsx(eU,{orientation:"horizontal"})]}),a]})}const pEe=x.forwardRef(function({particle:e,streamPath:n,paused:r,onEnded:i,onProgress:s},o){const[a]=x.useState(()=>({objectId:e.properties.transcoded_object_id??e.properties.object_id,mime:e.properties.transcoded_mime_type??e.properties.mime_type})),l=a.objectId,c=a.mime,{data:u,error:d}=r2(l),{attachments:h}=uEe(n,e.id),f=x.useRef(null),p=x.useRef(null),g=c==null?void 0:c.startsWith("audio/");x.useImperativeHandle(o,()=>({seek(M){const D=g?p.current:f.current;return!D||M<0&&D.currentTime<Math.abs(M)||M>0&&D.duration-D.currentTime<M?!1:(D.currentTime=Math.max(0,Math.min(D.duration,D.currentTime+M)),!0)},setPlaybackRate(M){const D=g?p.current:f.current;D&&(D.playbackRate=M)}}),[g]);const[y,v]=x.useState(0),b=e.properties.transcript,{activeSentence:_,activeWordIndex:S}=IEt(b,y),[k,T]=x.useState(null),E=kI(k);if(x.useEffect(()=>{const M=g?p.current:f.current;M&&(r?M.pause():M.ended||M.play().catch(()=>{console.warn("Playback failed",{particleId:e.id})}))},[r,g,e.id]),d)return m.jsx("div",{className:"text-muted-foreground flex items-center justify-center text-sm",children:"Failed to load media"});if(!u)return m.jsx(em,{className:"h-full w-full rounded-none"});const C=M=>{const{currentTime:D,duration:P}=M.currentTarget;v(D);const z=Number.isFinite(P)&&P>0?P:e.properties.duration_ms/1e3;z>0&&(s==null||s(D/z))},R=h.length>0&&m.jsx("div",{className:"absolute inset-x-0 top-12 z-10 px-4",children:m.jsx(fEe,{attachments:h,variant:"compact"})});return g?m.jsxs("div",{className:"relative flex h-full w-full items-center justify-center bg-black/90",children:[m.jsx("audio",{ref:M=>{p.current=M,T(M)},crossOrigin:"anonymous",src:u,autoPlay:!0,onEnded:i,onTimeUpdate:C}),E&&m.jsx("div",{className:"z-10 absolute bottom-20",children:m.jsx(SI,{sourceNode:E.sourceNode,className:"text-white"})}),b&&m.jsx(fae,{transcript:b,activeSentence:_,activeWordIndex:S,centered:!0}),R]}):m.jsxs("div",{className:"relative h-full w-full",children:[m.jsx("video",{ref:f,src:u,autoPlay:!0,playsInline:!0,onEnded:i,onTimeUpdate:C,className:"h-full w-full object-contain bg-black"}),b&&m.jsx(fae,{transcript:b,activeSentence:_,activeWordIndex:S}),R]})});function mEe({metadata:t,compact:e}){const n=i=>{i.stopPropagation(),cr.link.openExternal(t.url)},r=i=>{i.stopPropagation(),navigator.clipboard.writeText(t.url)};return m.jsxs("div",{className:"max-w-sm overflow-hidden rounded-2xl bg-white/10 backdrop-blur-md",onClick:i=>{i.stopPropagation(),n(i)},children:[t.image&&m.jsx("img",{src:t.image,alt:"",className:"h-32 w-full object-cover",onError:i=>{i.target.style.display="none"}}),m.jsxs("div",{className:"flex flex-col gap-1 p-3",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-white/50",children:[t.favicon?m.jsx("img",{src:t.favicon,alt:"",className:"size-4 rounded-sm",onError:i=>{i.target.replaceWith(document.createElement("span"))}}):m.jsx(US,{className:"size-4"}),m.jsx("span",{className:"truncate",children:t.domain})]}),t.title&&m.jsx("p",{className:"truncate text-sm font-semibold leading-snug text-white",children:t.title}),t.description&&m.jsx("p",{className:"line-clamp-2 text-xs leading-relaxed text-white/70",children:t.description}),!e&&m.jsxs("div",{className:"mt-1.5 flex gap-2",children:[m.jsxs(Rt,{variant:"ghost",size:"xs",className:"text-white/70 hover:bg-white/10 hover:text-white",onClick:n,children:[m.jsx(PH,{"data-icon":"inline-start"}),"Open"]}),m.jsxs(Rt,{variant:"ghost",size:"xs",className:"text-white/70 hover:bg-white/10 hover:text-white",onClick:r,children:[m.jsx(Lye,{"data-icon":"inline-start"}),"Copy"]})]})]})]})}function PEt({url:t}){return m.jsx(mEe,{metadata:{url:t,domain:Bve(t),title:t,description:null,image:null,favicon:null}})}function LEt(){return m.jsxs("div",{className:"max-w-sm overflow-hidden rounded-2xl bg-white/10 backdrop-blur-md",children:[m.jsx(em,{className:"h-32 w-full rounded-none bg-white/5"}),m.jsxs("div",{className:"flex flex-col gap-2 p-3",children:[m.jsx(em,{className:"h-3 w-24 bg-white/10"}),m.jsx(em,{className:"h-4 w-48 bg-white/10"}),m.jsx(em,{className:"h-3 w-full bg-white/10"})]})]})}function zEt({particle:t,streamPath:e,onClose:n}){oc(!0,"text-edit");const[r,i]=x.useState(t.properties.content),[s,o]=x.useState(!1),a=x.useCallback(async()=>{if(s)return;const l=r.trim();if(l){if(l===t.properties.content){n();return}o(!0);try{const{networkId:c,segments:u}=ul(e),d=Xl(Ls(c,[...u,t.id]));await nQe(d,l),n()}catch(c){Hn.error(c instanceof Error?c.message:"Failed to save"),o(!1)}}},[s,r,t.properties.content,t.id,e,n]);return nc.createPortal(m.jsx("div",{className:"fixed inset-0 z-[100]",onClick:l=>l.stopPropagation(),children:m.jsx(sEe,{textContent:r,onTextChange:i,onSubmit:a,onCancel:n,submitHint:"save"})}),document.body)}const jEt=1e3,BEt=3,FEt=15,VEt=2,$Et=2,HEt=120;function UEt(t,e,n){const r=t.length/jEt*60,i=e*VEt+n*$Et;return Math.min(Math.max(r+i,BEt),FEt)}function pae({entries:t}){return m.jsx("div",{className:"flex flex-wrap gap-3",children:t.map(e=>m.jsx("div",{className:"shrink-0",children:e.isLoading?m.jsx(LEt,{}):e.metadata?m.jsx(mEe,{metadata:e.metadata}):m.jsx(PEt,{url:e.url})},e.url))})}function gEe({particle:t,streamPath:e,paused:n,onEnded:r,onProgress:i}){const s=t.properties.content,o=Uve(s),{attachments:a}=uEe(e,t.id),l=jve(s),c=Dn(T=>{var E;return(E=T.user)==null?void 0:E.id}),u=!!c&&c===t.created_by_human_id,[d,h]=x.useState(!1),f=l.length>0,p=a.length>0,g=f||p,y=UEt(s,l.length,a.length);pK({id:t.id,durationS:y,paused:n,onEnded:r,onProgress:i});const v=s.trim(),b=f&&l.every(T=>v.includes(T))&&v.replace(/https?:\/\/[^\s<>"')\]]+/g,"").trim()==="",_=u&&!d&&m.jsxs("button",{type:"button",onMouseDown:T=>T.stopPropagation(),onClick:T=>{T.stopPropagation(),h(!0)},title:"Edit",className:"absolute bottom-[calc(var(--stream-safe-bottom,2rem)+0.5rem)] left-1/2 -translate-x-1/2 z-30 flex items-center gap-1.5 rounded-full bg-black/40 px-3 py-1.5 text-xs text-white/70 backdrop-blur-sm transition-colors hover:bg-black/60 hover:text-white",children:[m.jsx($ye,{className:"size-3.5"}),"Edit"]}),S=t.properties.edited_at&&m.jsxs("span",{className:"text-xs text-white/40",children:["edited ",m.jsx(C3,{date:t.properties.edited_at})]}),k=d&&m.jsx(zEt,{particle:t,streamPath:e,onClose:()=>h(!1)});if(b&&!p)return m.jsxs("div",{className:"group relative flex h-full w-full items-center justify-center bg-gradient-to-b from-black/40 via-black/20 to-black/40 px-8 pt-[var(--stream-safe-top,2rem)] pb-[var(--stream-safe-bottom,2rem)]",children:[m.jsx(pae,{entries:o}),S&&m.jsx("div",{className:"absolute bottom-6 left-1/2 -translate-x-1/2",children:S}),_,k]});if(s.length<HEt&&!g&&!Hve(s)){const T=$ve(s.length);return m.jsxs("div",{className:"group relative flex h-full w-full flex-col items-center justify-center gap-4 bg-gradient-to-b from-black/40 via-black/20 to-black/40 px-8 pt-[var(--stream-safe-top,2rem)] pb-[var(--stream-safe-bottom,2rem)]",children:[m.jsx("p",{className:He("max-w-2xl break-words text-center leading-relaxed text-white select-text cursor-text",T.size,T.weight),children:s}),S,_,k]})}return m.jsxs("div",{className:"group relative flex h-full w-full items-center justify-center bg-gradient-to-b from-black/40 via-black/20 to-black/40 px-8 pt-[var(--stream-safe-top,2rem)] pb-[var(--stream-safe-bottom,2rem)]",children:[m.jsxs("div",{className:"scrollbar-card flex max-h-full w-full max-w-[calc(var(--message-content-width)_+_var(--message-card-padding)*2)] flex-col gap-4 overflow-y-auto overscroll-contain rounded bg-white/10 p-[var(--message-card-padding)] backdrop-blur-md",children:[m.jsx(iEe,{value:s,readOnly:!0,className:"select-text pb-3"},s),f&&m.jsx(pae,{entries:o}),p&&m.jsx(fEe,{attachments:a}),S]}),_,k]})}const qEt=8,qD="unassigned";function WEt(t,e){const{networkId:n,segments:r}=ul(t);return Xl(Ls(n,[...r,e]))}function yEe({particle:t,containerPath:e,paused:n,onEnded:r,onProgress:i}){var D;const{networkId:s}=ul(e),o=xa(s),a=WEt(e,t.id),{title:l,notes:c,checklist:u=[],assigned_to:d,done:h}=t.properties,[f,p]=x.useState(!1);oc(f,`task-edit-${t.id}`),pK({id:t.id,durationS:qEt,paused:n,onEnded:r,onProgress:i});const g=Fk({remoteValue:l,commit:P=>Fu(a,{title:P})}),y=Fk({remoteValue:c??"",commit:P=>Fu(a,{notes:P})}),v=x.useRef(u);x.useEffect(()=>{v.current=u},[u]);const b=x.useCallback(P=>Fu(a,{checklist:P}),[a]),_=x.useCallback(P=>Fu(a,{done:P}),[a]),S=x.useCallback((P,z)=>{const Z=v.current.map((re,G)=>G===P?{...re,done:z}:re);b(Z)},[b]),k=x.useCallback((P,z)=>{const Z=v.current.map((re,G)=>G===P?{...re,text:z}:re);b(Z)},[b]),T=x.useCallback(P=>{b(v.current.filter((z,Z)=>Z!==P))},[b]),E=x.useCallback(P=>{b([...v.current,{text:P,done:!1}])},[b]),C=x.useCallback(P=>{P===qD?Cve(a,"properties.assigned_to",xye()):Fu(a,{assigned_to:P})},[a]),R=Bo(d,o==null?void 0:o.humans),M=u.filter(P=>P.done).length;return m.jsx("div",{className:"flex h-full w-full items-center justify-center bg-gradient-to-b from-black/40 via-black/20 to-black/40 px-8 pt-[var(--stream-safe-top,2rem)] pb-[var(--stream-safe-bottom,2rem)]",children:m.jsxs("div",{className:"scrollbar-card flex max-h-full w-full max-w-[calc(var(--message-content-width)_+_var(--message-card-padding)*2)] flex-col gap-5 overflow-y-auto overscroll-contain rounded bg-white/10 p-[var(--message-card-padding)] backdrop-blur-md",onFocusCapture:()=>p(!0),onBlurCapture:P=>{P.currentTarget.contains(P.relatedTarget)||p(!1)},children:[m.jsxs("div",{className:"flex items-start gap-3",children:[m.jsx(G8,{checked:h,onCheckedChange:P=>_(P===!0),className:"mt-1.5 size-5 rounded-full border-white/40 data-[state=checked]:border-emerald-500 data-[state=checked]:bg-emerald-500","aria-label":h?"Mark task as not done":"Mark task as done"}),m.jsx("input",{value:g.value,onChange:P=>g.onChange(P.target.value),onFocus:g.onFocus,onBlur:g.onBlur,placeholder:"Task title",className:He("w-full bg-transparent text-2xl font-semibold text-white outline-none placeholder:text-white/30",h&&"text-white/50 line-through")})]}),m.jsx(iM,{value:y.value,onChange:P=>y.onChange(P.target.value),onFocus:y.onFocus,onBlur:y.onBlur,placeholder:"Add notes…",className:"min-h-16 resize-none border-none bg-transparent p-0 text-sm text-white/80 shadow-none placeholder:text-white/30 focus-visible:ring-0 dark:bg-transparent"}),m.jsxs("div",{className:"flex flex-col gap-1.5",children:[u.length>0&&m.jsxs("span",{className:"text-xs text-white/40",children:[M," / ",u.length," done"]}),u.map((P,z)=>m.jsx(GEt,{item:P,onToggle:Z=>S(z,Z),onCommitText:Z=>k(z,Z),onRemove:()=>T(z)},z)),m.jsx(KEt,{onAdd:E})]}),m.jsx("div",{className:"flex items-center gap-2",children:m.jsxs(tU,{value:d??qD,onValueChange:C,children:[m.jsxs(rU,{size:"sm",className:"w-fit gap-2 border-white/15 bg-white/5 text-white/80",children:[d&&R.exists&&m.jsx(Xc,{size:"sm",initials:R.initials,avatarObjectId:R.avatarObjectId}),m.jsx(nU,{placeholder:"Unassigned"})]}),m.jsxs(iU,{children:[m.jsx(ex,{value:qD,children:"Unassigned"}),(D=o==null?void 0:o.humans)==null?void 0:D.map(P=>m.jsx(ex,{value:P.id,children:P.email_prefix},P.id))]})]})})]})})}function GEt({item:t,onToggle:e,onCommitText:n,onRemove:r}){const i=Fk({remoteValue:t.text,commit:n});return m.jsxs("div",{className:"group/item flex items-center gap-2.5",children:[m.jsx(G8,{checked:t.done,onCheckedChange:s=>e(s===!0),className:"border-white/30 data-[state=checked]:border-emerald-500 data-[state=checked]:bg-emerald-500","aria-label":t.done?"Mark subtask as not done":"Mark subtask as done"}),m.jsx("input",{value:i.value,onChange:s=>i.onChange(s.target.value),onFocus:i.onFocus,onBlur:i.onBlur,placeholder:"Subtask",className:He("w-full bg-transparent text-sm text-white/90 outline-none placeholder:text-white/30",t.done&&"text-white/40 line-through")}),m.jsx("button",{type:"button",onClick:r,className:"text-white/30 opacity-0 transition-opacity hover:text-white/70 group-hover/item:opacity-100","aria-label":"Remove subtask",children:m.jsx(Zc,{className:"size-3.5"})})]})}function KEt({onAdd:t}){const[e,n]=x.useState(""),r=()=>{const i=e.trim();i&&(t(i),n(""))};return m.jsxs("div",{className:"flex items-center gap-2.5",children:[m.jsx(qS,{className:"size-4 text-white/30"}),m.jsx("input",{value:e,onChange:i=>n(i.target.value),onKeyDown:i=>{i.key==="Enter"&&(i.preventDefault(),r())},onBlur:r,placeholder:"Add subtask…",className:"w-full bg-transparent text-sm text-white/70 outline-none placeholder:text-white/30"})]})}function vEe({className:t,size:e="default",...n}){return m.jsx("div",{"data-slot":"card","data-size":e,className:He("ring-foreground/10 bg-card text-card-foreground gap-4 overflow-hidden rounded-xl py-4 text-sm ring-1 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 group/card flex flex-col",t),...n})}function bEe({className:t,...e}){return m.jsx("div",{"data-slot":"card-header",className:He("gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3 group/card-header @container/card-header grid auto-rows-min items-start has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]",t),...e})}function wEe({className:t,...e}){return m.jsx("div",{"data-slot":"card-title",className:He("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",t),...e})}function xEe({className:t,...e}){return m.jsx("div",{"data-slot":"card-description",className:He("text-muted-foreground text-sm",t),...e})}function _Ee({className:t,...e}){return m.jsx("div",{"data-slot":"card-content",className:He("px-4 group-data-[size=sm]/card:px-3",t),...e})}function YEt({className:t,...e}){return m.jsx("div",{"data-slot":"card-footer",className:He("bg-muted/50 rounded-b-xl border-t p-4 group-data-[size=sm]/card:p-3 flex items-center",t),...e})}const ZEt={paper:{icon:HKe,label:"Paper"},file:{icon:w3,label:"File"}};function SEe({particle:t,networkId:e}){const n=xa(e),r=Bo(t.created_by_human_id,n==null?void 0:n.humans),i=ZEt[t.type]??{icon:tYe,label:t.type},s=i.icon,o=(()=>{switch(t.type){case"paper":return t.properties.title;case"file":return t.properties.filename;case"folder":return t.properties.name;default:return null}})();return m.jsx("div",{className:"flex h-full w-full items-center justify-center p-8",children:m.jsxs(vEe,{className:"w-full max-w-sm",children:[m.jsxs(bEe,{className:"flex flex-row items-center gap-3",children:[m.jsx(s,{className:"text-muted-foreground h-6 w-6 shrink-0"}),m.jsxs("div",{children:[m.jsx(wEe,{className:"text-base",children:i.label}),o&&m.jsx(xEe,{children:o})]})]}),m.jsx(_Ee,{children:m.jsxs("p",{className:"text-muted-foreground text-xs",children:["From ",r.displayName]})})]})})}const XEt=2e3;function kEe({particle:t,networkId:e,paused:n,onEnded:r}){const i=xa(e),s="deleted_by_human_id"in t?t.deleted_by_human_id:void 0,o=s?Bo(s,i==null?void 0:i.humans):null;return x.useEffect(()=>{if(n)return;const a=setTimeout(r,XEt);return()=>clearTimeout(a)},[n,r,t.id]),m.jsx("div",{className:"flex h-full w-full items-center justify-center bg-gradient-to-b from-black/40 via-black/20 to-black/40 px-8",children:m.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[m.jsx(x3,{className:"text-white/40 size-6"}),m.jsx("p",{className:"text-white/70 text-base font-medium",children:"This particle was deleted"}),o&&m.jsxs("p",{className:"text-white/40 text-xs",children:["by ",o.displayName]})]})})}const mae=3,rv=10;function gae({total:t,current:e,progress:n,onGoTo:r,presenceBySegment:i,onlineHumanIds:s,layer:o}){if(t===0)return null;const a=o!=="tracks",l=o!=="avatars",c=t>rv,u=e<0?0:e,d=c?Math.floor(u/rv)*rv:0,h=c?Math.min(rv,t-d):t,f=c&&d>0,p=c&&d+rv<t;return m.jsxs("div",{className:"flex w-full flex-col items-stretch leading-none",children:[m.jsxs("div",{className:"flex w-full items-end gap-px",children:[c&&m.jsx(yae,{visible:f,interactive:l,onClick:()=>r(d-1)}),m.jsx("div",{className:"flex flex-1 items-end gap-px",children:Array.from({length:h},(g,y)=>{const v=d+y,b=i==null?void 0:i.get(v);return m.jsxs("div",{className:"flex flex-1 flex-col items-stretch",children:[a&&b&&b.length>0&&m.jsx(QEt,{presence:b,onlineHumanIds:s}),l&&m.jsxs("button",{onClick:_=>{_.stopPropagation(),r(v)},className:"group relative block h-3 w-full",children:[m.jsx("div",{className:"absolute inset-x-0 bottom-0 h-[3px] bg-white/30 transition-all group-hover:h-1.5"}),m.jsx("div",{className:"absolute left-0 bottom-0 h-[3px] bg-white/90 transition-all group-hover:h-1.5",style:{width:v<e?"100%":v===e?`${n*100}%`:"0%",transition:v===e?"width 300ms linear":"none"}})]})]},v)})}),c&&m.jsx(yae,{visible:p,interactive:l,onClick:()=>r(d+rv)})]}),c&&l&&e>=0&&m.jsxs("div",{className:"pointer-events-none pt-1 text-center text-[10px] font-medium tabular-nums tracking-wide text-white/40",children:[e+1," / ",t]})]})}function yae({visible:t,interactive:e,onClick:n}){return t?e?m.jsx("button",{onClick:r=>{r.stopPropagation(),n()},className:"group relative block h-3 w-2 shrink-0","aria-label":"Jump to adjacent page",children:m.jsx("div",{className:"absolute inset-x-0 bottom-0 h-[3px] bg-white/15 transition-all group-hover:h-1.5 group-hover:bg-white/40"})}):m.jsx("div",{className:"h-3 w-2 shrink-0","aria-hidden":!0}):m.jsx("div",{className:"h-3 w-2 shrink-0","aria-hidden":!0})}function QEt({presence:t,onlineHumanIds:e}){const n=t.slice(0,mae),r=t.length-mae;return m.jsxs("div",{className:"flex items-center justify-center -space-x-1.5 pb-0.5",children:[n.map(i=>m.jsxs(tb,{children:[m.jsx(nb,{asChild:!0,children:m.jsx(Xc,{size:"xs",className:e!=null&&e.has(i.humanId)?"ring-2 ring-green-500":"ring-1 ring-black/50",avatarObjectId:i.avatarObjectId,initials:i.emailPrefix.slice(0,2).toUpperCase()})}),m.jsx(rb,{side:"top",className:"text-xs",children:i.email})]},i.humanId)),r>0&&m.jsxs("span",{className:"text-[10px] text-white/70 pl-1",children:["+",r]})]})}function JEt({visible:t,total:e,current:n,progress:r,onGoTo:i,presenceBySegment:s,onlineHumanIds:o,exitRemainingMs:a,onOpenKeybindings:l,onOpenHuddle:c,onExit:u}){return m.jsxs("div",{className:He("absolute inset-x-0 bottom-0 z-10 transition-all duration-300",t?"opacity-100 translate-y-0":"opacity-0 translate-y-2 pointer-events-none"),children:[m.jsx(gae,{total:e,current:n,progress:r,onGoTo:i,presenceBySegment:s,onlineHumanIds:o,layer:"avatars"}),m.jsxs("div",{className:"pb-3",children:[m.jsx(gae,{total:e,current:n,progress:r,onGoTo:i,layer:"tracks"}),m.jsxs("div",{className:"flex items-center justify-center px-3 pt-2 gap-2",children:[a!==null&&m.jsx("div",{className:"flex justify-center",children:m.jsxs("span",{className:"rounded-full bg-black/30 px-2 text-xs text-white/70 backdrop-blur-sm",children:["Closing in ",Math.ceil(a/1e3),"s"]})}),m.jsx(CEe,{showEscape:!0,onOpenKeybindings:l,onOpenHuddle:c,onExit:u})]})]})]})}function CEe({showEscape:t,onOpenKeybindings:e,onOpenHuddle:n,onExit:r}){const i=YS(s=>s.request);return m.jsxs("div",{className:"flex items-center gap-4 text-sm text-white/50",children:[t&&m.jsx(nn,{keys:"Esc",onClick:r,title:"Back to network (or press Esc)",children:"back"}),m.jsx(lEe,{}),m.jsx(nn,{keys:"Hold `",onClick:()=>i("record"),title:"Reply with a recording (or hold `)",children:"to reply"}),m.jsx(nn,{keys:"T",onClick:()=>i("text"),title:"Reply with text (or press T)",children:"text"}),m.jsx(nn,{keys:"D",onClick:()=>i("task"),title:"Add a task (or press D)",children:"task"}),m.jsx(nn,{keys:"E",onClick:()=>i("event"),title:"Add an event (or press E)",children:"event"}),m.jsx(nn,{keys:"H",onClick:n,title:"Start a huddle (or press H)",children:"huddle"}),m.jsx(nn,{keys:"?",onClick:e,title:"Show all shortcuts","aria-label":"Show keyboard shortcuts"})]})}function eTt({items:t,networkId:e,currentIndex:n,onSelect:r}){const i=x.useCallback(s=>{const o=t.findIndex(a=>a.id===s);o!==-1&&r(o)},[t,r]);return m.jsxs("aside",{className:"dark flex w-80 shrink-0 flex-col border-l border-white/10 bg-black/60 backdrop-blur-md",children:[m.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-white/10 px-3 py-2.5 text-xs text-white/50",children:[m.jsx(xYe,{className:"size-3.5"}),"All particles · ",t.length]}),m.jsx(bd,{className:"min-h-0 flex-1",children:m.jsx(Lve,{items:t,networkId:e,isLoading:!1,onOpen:i,selectedIndex:n,showShortcuts:!1,dense:!0,emptyMessage:"No particles in this stream yet."})})]})}function vae(t,e){var s;const n=e?(s=t.playback_markers)==null?void 0:s[e]:void 0,r=t.last_child_created_at;return!!n&&!!r&&r.getTime()<=n.getTime()?"list":"player"}function tTt(t,e){const[n,r]=x.useState(()=>vae(t,e)),[i,s]=x.useState(t.id);i!==t.id&&(s(t.id),r(vae(t,e)));const o=x.useCallback(()=>{r(a=>a==="player"?"list":"player")},[]);return{mode:n,toggle:o}}function nTt({open:t,onClose:e,groups:n,title:r="Keyboard Shortcuts"}){return oc(t,"keybindings"),x.useEffect(()=>{if(!t)return;const i=s=>{(s.key==="Escape"||s.key==="?")&&(s.preventDefault(),s.stopPropagation(),e())};return window.addEventListener("keydown",i,{capture:!0}),()=>window.removeEventListener("keydown",i,{capture:!0})},[t,e]),t?nc.createPortal(m.jsxs("div",{className:"fixed inset-0 z-[100]",children:[m.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:e}),m.jsxs("div",{className:"absolute left-1/2 top-1/2 w-full max-w-sm -translate-x-1/2 -translate-y-1/2 rounded-2xl border border-white/10 bg-white/5 p-6 shadow-2xl backdrop-blur-xl",children:[m.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[m.jsx("h2",{className:"text-sm font-semibold text-white/70",children:r}),m.jsx(nn,{keys:["Esc","?"],separator:"or",onClick:e,title:"Close (or press Esc / ?)",className:"text-xs text-white/30",children:"to close"})]}),m.jsx("div",{className:"flex flex-col gap-5",children:n.map(i=>m.jsxs("section",{children:[m.jsx("h3",{className:"mb-2 text-[10px] font-medium uppercase tracking-widest text-white/30",children:i.label}),m.jsx("ul",{className:"flex flex-col gap-1",children:i.bindings.map(s=>m.jsxs("li",{className:"flex items-center justify-between border-b border-white/5 pb-1 last:border-0 last:pb-0",children:[m.jsx("span",{className:"text-sm text-white/70",children:s.description}),m.jsx(nn,{keys:s.keys,className:"flex items-center gap-1 text-white/60"})]},s.description))})]},i.label))})]})]}),document.body):null}const rTt=new Set(b7);function iTt(t,e){return t.map(n=>Bo(n,e).displayName).join(", ")}function sTt(t,e,n){return t.map(r=>({id:r,label:Bo(r,e).displayName,isMine:r===n}))}function oTt({reactions:t,currentHumanId:e,humans:n,onToggle:r,onOpenTextReaction:i}){const[s,o]=x.useState(!1),a=b7.filter(u=>(t==null?void 0:t[u])&&t[u].length>0),l=Object.keys(t??{}).filter(u=>{var d;return!rTt.has(u)&&(((d=t==null?void 0:t[u])==null?void 0:d.length)??0)>0}),c=u=>{r(u),o(!1)};return m.jsxs("div",{className:"flex flex-col items-end gap-1.5",children:[a.map(u=>{const d=(t==null?void 0:t[u])??[],h=d.includes(e);return m.jsxs(tb,{children:[m.jsx(nb,{asChild:!0,children:m.jsxs("button",{onClick:f=>{f.stopPropagation(),c(u)},className:He("flex items-center gap-1 rounded-full px-2 py-0.5 text-xs backdrop-blur-sm transition-colors",h?"bg-white/20 ring-1 ring-white/40":"bg-black/40 hover:bg-black/50"),children:[m.jsx("span",{className:"text-sm",children:u}),m.jsx("span",{className:"text-white/80",children:d.length})]})}),m.jsx(rb,{side:"left",className:"text-xs",children:iTt(d,n)})]},u)}),l.map(u=>{const d=(t==null?void 0:t[u])??[],h=d.includes(e),f=Bo(d[0],n),p=sTt(d,n,e);return m.jsxs(tb,{children:[m.jsx(nb,{asChild:!0,children:m.jsxs("button",{onClick:g=>{g.stopPropagation(),c(u)},className:He("flex max-w-[200px] items-center gap-1.5 rounded-full py-0.5 pl-0.5 pr-2.5 text-xs backdrop-blur-sm transition-colors",h?"bg-white/20 ring-1 ring-white/40":"bg-black/40 hover:bg-black/50"),children:[m.jsx(Xc,{size:"xs",className:"shrink-0",avatarObjectId:f.avatarObjectId,initials:f.initials,fallbackClassName:"bg-white/15 text-[9px] font-medium text-white"}),m.jsx("span",{className:"truncate text-white/90",children:u}),d.length>1&&m.jsx("span",{className:"shrink-0 text-white/60",children:d.length})]})}),m.jsxs(rb,{side:"left",className:"max-w-[260px] space-y-1.5 text-xs",children:[m.jsxs("div",{className:"font-medium",children:["“",u,"”"]}),m.jsx("ul",{className:"flex flex-col gap-0.5 opacity-80",children:p.map(g=>m.jsxs("li",{className:He(g.isMine&&"font-medium opacity-100"),children:[g.label,g.isMine&&m.jsx("span",{className:"ml-1 opacity-60",children:"(you)"})]},g.id))}),m.jsx("div",{className:"border-t border-current/15 pt-1 text-[10px] opacity-60",children:h?"Click to remove":"Click to add yours"})]})]},u)}),s?m.jsxs("div",{className:"flex flex-col items-center gap-0.5 rounded-full bg-black/40 px-0.5 py-1.5 backdrop-blur-sm",children:[b7.map(u=>a.includes(u)?null:m.jsx("button",{onClick:d=>{d.stopPropagation(),c(u)},className:"rounded-full px-0.5 py-1 text-sm transition-colors hover:bg-white/15",children:u},u)),m.jsx("button",{onClick:u=>{u.stopPropagation(),o(!1)},className:"flex size-5 items-center justify-center rounded-full transition-colors hover:bg-white/15",children:m.jsx(Zc,{className:"size-3 text-white/60"})})]}):m.jsxs("div",{className:"flex flex-col items-center gap-1",children:[m.jsxs(tb,{children:[m.jsx(nb,{asChild:!0,children:m.jsx("button",{onClick:u=>{u.stopPropagation(),i()},className:"flex size-6 items-center justify-center rounded-full bg-black/40 backdrop-blur-sm transition-colors hover:bg-black/50",children:m.jsx(qYe,{className:"size-3 text-white/60"})})}),m.jsxs(rb,{side:"left",className:"text-xs",children:["Quick reply"," ",m.jsx("kbd",{className:"ml-1 rounded bg-white/10 px-1 font-mono text-[10px]",children:"R"})]})]}),m.jsx("button",{onClick:u=>{u.stopPropagation(),o(!0)},className:"flex size-6 items-center justify-center rounded-full bg-black/40 backdrop-blur-sm transition-colors hover:bg-black/50",children:m.jsx(qS,{className:"size-3 text-white/60"})})]})]})}const WD=40;function aTt({open:t,onSubmit:e,onClose:n}){const[r,i]=x.useState(""),[s,o]=x.useState(t),a=x.useRef(null);if(oc(t,"text-reaction"),t!==s&&(o(t),t&&i("")),x.useEffect(()=>{if(!t)return;const h=requestAnimationFrame(()=>{var f;return(f=a.current)==null?void 0:f.focus()});return()=>cancelAnimationFrame(h)},[t]),!t)return null;const l=r.trim(),c=l.length>0,u=WD-r.length,d=()=>{c&&(e(l),i(""),n())};return m.jsxs("div",{onClick:h=>h.stopPropagation(),className:"flex items-center gap-1 rounded-full bg-black/60 py-1 pl-3 pr-1 shadow-lg ring-1 ring-white/15 backdrop-blur-md",children:[m.jsx("input",{ref:a,value:r,onChange:h=>i(Eve(h.target.value).slice(0,WD)),onBlur:n,onKeyDown:h=>{h.key==="Enter"?(h.preventDefault(),d()):h.key==="Escape"&&(h.preventDefault(),n())},placeholder:"Quick reply…",maxLength:WD,className:"w-24 bg-transparent text-sm text-white outline-none placeholder:text-white/40"}),m.jsx("span",{className:He("min-w-[1.5ch] text-right text-[10px] tabular-nums",u<=8?"text-amber-300/80":"text-white/30"),children:u}),m.jsx("button",{onMouseDown:h=>h.preventDefault(),onClick:d,disabled:!c,className:He("ml-1 flex size-6 items-center justify-center rounded-full transition-colors",c?"bg-white/20 text-white hover:bg-white/30":"text-white/30"),"aria-label":"Send reaction",children:m.jsx(zYe,{className:"size-3"})})]})}function lTt({...t}){return m.jsx(dOe,{"data-slot":"dropdown-menu",...t})}function cTt({...t}){return m.jsx(hOe,{"data-slot":"dropdown-menu-trigger",...t})}function uTt({className:t,align:e="start",sideOffset:n=4,...r}){return m.jsx(fOe,{children:m.jsx(pOe,{"data-slot":"dropdown-menu-content",sideOffset:n,align:e,className:He("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto data-[state=closed]:overflow-hidden",t),...r})})}function GD({className:t,inset:e,variant:n="default",...r}){return m.jsx(mOe,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":n,className:He("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...r})}function dTt({networkId:t,streamParticle:e,onClose:n}){oc(!0,"rename-stream");const[r,i]=x.useState(e.properties.name),[s,o]=x.useState(!1),a=r.trim(),l=!s&&a.length>0&&a!==e.properties.name,c=x.useCallback(async()=>{if(l){o(!0);try{const u=Xl(Ls(t,[e.id]));await Fu(u,{name:a}),n()}finally{o(!1)}}},[l,t,n,e.id,a]);return x.useEffect(()=>{const u=d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),n())};return window.addEventListener("keydown",u,{capture:!0}),()=>window.removeEventListener("keydown",u,{capture:!0})},[n]),nc.createPortal(m.jsxs("div",{className:"fixed inset-0 z-[100]",children:[m.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:n}),m.jsxs("div",{className:"absolute left-1/2 top-1/2 w-full max-w-sm -translate-x-1/2 -translate-y-1/2 rounded-2xl border border-white/10 bg-white/5 p-6 shadow-2xl backdrop-blur-xl",children:[m.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[m.jsx("h2",{className:"text-sm font-semibold text-white/70",children:"Rename stream"}),m.jsx(nn,{keys:"Esc",onClick:n,title:"Close (or press Esc)",className:"text-xs text-white/30",children:"to close"})]}),m.jsx(x0,{type:"text",autoFocus:!0,value:r,onChange:u=>i(u.target.value),onFocus:u=>u.currentTarget.select(),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),c())},placeholder:"Stream name",className:"border-white/10 bg-white/5 text-white placeholder-white/30 focus-visible:border-white/30 focus-visible:ring-0"}),m.jsxs("div",{className:"mt-4 flex items-center justify-end gap-2",children:[m.jsx(Rt,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),m.jsx(Rt,{size:"sm",onClick:c,disabled:!l,children:"Save"})]})]})]}),document.body)}function EEe({title:t,description:e,confirmLabel:n,pendingLabel:r="Working…",isPending:i,onConfirm:s,onClose:o}){return x.useEffect(()=>{const a=l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),o())};return window.addEventListener("keydown",a,{capture:!0}),()=>window.removeEventListener("keydown",a,{capture:!0})},[o]),nc.createPortal(m.jsxs("div",{className:"fixed inset-0 z-[100]",children:[m.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:o}),m.jsxs("div",{className:"absolute left-1/2 top-1/2 w-full max-w-sm -translate-x-1/2 -translate-y-1/2 rounded-2xl border border-white/10 bg-white/5 p-6 shadow-2xl backdrop-blur-xl",children:[m.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[m.jsx("h2",{className:"text-sm font-semibold text-white/70",children:t}),m.jsx(nn,{keys:"Esc",onClick:o,title:"Close (or press Esc)",className:"text-xs text-white/30",children:"to close"})]}),m.jsx("div",{className:"text-sm text-white/60",children:e}),m.jsxs("div",{className:"mt-5 flex items-center justify-end gap-2",children:[m.jsx(Rt,{variant:"ghost",size:"sm",onClick:o,disabled:i,children:"Cancel"}),m.jsx(Rt,{variant:"destructive",size:"sm",onClick:s,disabled:i,children:i?r:n})]})]})]}),document.body)}function hTt({networkId:t,streamId:e,particle:n,userId:r,onClose:i}){oc(!0,"delete-particle");const[s,o]=x.useState(!1),a=x.useCallback(async()=>{if(!s){o(!0);try{const l=Xl(Ls(t,[e,n.id]));await rQe(l,r),Hn.success("Particle deleted"),i()}catch(l){const c=l instanceof Error?l.message:"Failed to delete particle";Hn.error(c),o(!1)}}},[s,t,i,n.id,e,r]);return m.jsx(EEe,{title:"Delete this particle?",description:m.jsx("p",{children:'This cannot be undone. Other viewers will see a "This particle was deleted" message in its place.'}),confirmLabel:"Delete",pendingLabel:"Deleting…",isPending:s,onConfirm:a,onClose:i})}const gF="human:",TEe="network:";function AEe(t,e){return t.includes(`${TEe}${e}`)?{mode:"network"}:{mode:"custom",humanIds:t.filter(r=>r.startsWith(gF)).map(r=>r.slice(gF.length))}}function fTt(t){return[`${TEe}${t}`]}function KD(t){return h0e(t).map(e=>`${gF}${e}`)}function pTt({networkId:t,streamParticle:e,isCreator:n,onClose:r}){oc(!0,"stream-members");const i=xa(t),s=(i==null?void 0:i.humans)??[],o=e.created_by_human_id,a=x.useMemo(()=>AEe(e.visible_to,t),[e.visible_to,t]),l=x.useMemo(()=>Xl(Ls(t,[e.id])),[t,e.id]),c=a.mode==="network"?s.map(y=>y.id):a.humanIds,u=new Set(c),d=s.filter(y=>!u.has(y.id)),h=x.useCallback(()=>{pE(l,fTt(t))},[l,t]),f=x.useCallback(()=>{pE(l,KD([o]))},[l,o]),p=x.useCallback(y=>{if(a.mode!=="custom"||y===o)return;const v=a.humanIds.filter(b=>b!==y);v.length!==0&&pE(l,KD(v))},[l,o,a]),g=x.useCallback(y=>{a.mode==="custom"&&pE(l,KD([...a.humanIds,y]))},[l,a]);return x.useEffect(()=>{const y=v=>{v.key==="Escape"&&(v.preventDefault(),v.stopPropagation(),r())};return window.addEventListener("keydown",y,{capture:!0}),()=>window.removeEventListener("keydown",y,{capture:!0})},[r]),nc.createPortal(m.jsxs("div",{className:"fixed inset-0 z-[100]",children:[m.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),m.jsxs("div",{className:"absolute left-1/2 top-1/2 flex max-h-[80vh] w-full max-w-sm -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-white/10 bg-white/5 p-6 shadow-2xl backdrop-blur-xl",children:[m.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[m.jsx("h2",{className:"text-sm font-semibold text-white/70",children:"Members"}),m.jsx(nn,{keys:"Esc",onClick:r,title:"Close (or press Esc)",className:"text-xs text-white/30",children:"to close"})]}),m.jsxs("section",{className:"mb-4",children:[m.jsx("h3",{className:"mb-2 text-[10px] font-medium uppercase tracking-widest text-white/30",children:"Visibility"}),n?m.jsxs("div",{className:"grid grid-cols-2 gap-1 rounded-lg bg-white/5 p-1",children:[m.jsx(bae,{active:a.mode==="network",icon:m.jsx(US,{className:"size-3.5"}),label:"Network-wide",onClick:h}),m.jsx(bae,{active:a.mode==="custom",icon:m.jsx(M7,{className:"size-3.5"}),label:"Specific people",onClick:f})]}):m.jsx("div",{className:"flex items-center gap-2 text-sm text-white/70",children:a.mode==="network"?m.jsxs(m.Fragment,{children:[m.jsx(US,{className:"size-3.5 text-white/40"}),m.jsxs("span",{children:["Everyone in ",(i==null?void 0:i.name)??"network"]})]}):m.jsxs(m.Fragment,{children:[m.jsx(M7,{className:"size-3.5 text-white/40"}),m.jsxs("span",{children:[c.length," specific people"]})]})})]}),m.jsxs("section",{className:"flex min-h-0 flex-1 flex-col",children:[m.jsxs("h3",{className:"mb-2 text-[10px] font-medium uppercase tracking-widest text-white/30",children:[a.mode==="network"?"Has access":"People"," ",m.jsx("span",{className:"ml-1 text-white/20",children:c.length})]}),m.jsx(bd,{className:"min-h-0 flex-1",children:m.jsx("ul",{className:"flex flex-col gap-0.5 pr-2",children:c.map(y=>{const v=Bo(y,s),b=y===o,_=n&&a.mode==="custom"&&!b;return m.jsxs("li",{className:"group flex items-center gap-2.5 rounded px-2 py-1.5 text-sm text-white/70",children:[m.jsx(Xc,{size:"sm",avatarObjectId:v.avatarObjectId,initials:v.initials,fallbackClassName:"text-[10px]"}),m.jsx("span",{className:He("flex-1 truncate",!v.exists&&"italic text-white/40"),children:v.displayName}),b&&m.jsx("span",{className:"text-[10px] uppercase tracking-wider text-white/30",children:"Creator"}),_&&m.jsx("button",{type:"button",onClick:()=>p(y),className:"rounded p-1 text-white/30 opacity-0 transition-opacity hover:bg-white/10 hover:text-white/70 group-hover:opacity-100","aria-label":`Remove ${v.displayName}`,children:m.jsx(Zc,{className:"size-3.5"})})]},y)})})})]}),n&&a.mode==="custom"&&d.length>0&&m.jsxs("section",{className:"mt-4 border-t border-white/5 pt-4",children:[m.jsxs("h3",{className:"mb-2 flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-widest text-white/30",children:[m.jsx(QL,{className:"size-3"}),"Add people"]}),m.jsx(bd,{className:"max-h-32",children:m.jsx("ul",{className:"flex flex-col gap-0.5 pr-2",children:d.map(y=>m.jsx("li",{children:m.jsxs("button",{type:"button",onClick:()=>g(y.id),className:He("flex w-full items-center gap-2.5 rounded px-2 py-1.5 text-left text-sm text-white/70 transition-colors hover:bg-white/5"),children:[m.jsx(Xc,{size:"sm",avatarObjectId:y.avatar_object_id,initials:o7(y.email),fallbackClassName:"text-[10px]"}),m.jsx("span",{className:"flex-1 truncate",children:y.email_prefix}),m.jsx(QL,{className:"size-3.5 text-white/30"})]})},y.id))})})]}),n&&a.mode==="custom"&&d.length===0&&m.jsxs("p",{className:"mt-4 text-center text-xs text-white/30",children:[m.jsx(_I,{className:"mr-1 inline size-3"}),"Everyone in the network is already a member"]})]})]}),document.body)}function bae({active:t,icon:e,label:n,onClick:r}){return m.jsxs("button",{type:"button",onClick:r,className:He("flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs transition-colors",t?"bg-white/10 text-white/90":"text-white/50 hover:text-white/80"),children:[e,n]})}function IEe({className:t,...e}){return m.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:He(t),...e})}function REe({className:t,...e}){return m.jsx("ol",{"data-slot":"breadcrumb-list",className:He("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground",t),...e})}function hS({className:t,...e}){return m.jsx("li",{"data-slot":"breadcrumb-item",className:He("inline-flex items-center gap-1",t),...e})}function wae({asChild:t,className:e,...n}){const r=t?$V:"a";return m.jsx(r,{"data-slot":"breadcrumb-link",className:He("transition-colors hover:text-foreground",e),...n})}function fS({className:t,...e}){return m.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:He("font-normal text-foreground",t),...e})}function yF({children:t,className:e,...n}){return m.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:He("[&>svg]:size-3.5",e),...n,children:t??m.jsx(OH,{})})}const xae=1e3,_ae=3e4,mTt=2e4;class gTt{constructor(e){Ui(this,"config");Ui(this,"ws",null);Ui(this,"state","disconnected");Ui(this,"stateListeners",new Set);Ui(this,"listeners",new Map);Ui(this,"activeSubscriptions",new Set);Ui(this,"reconnectDelay",xae);Ui(this,"reconnectTimer",null);Ui(this,"shouldReconnect",!1);Ui(this,"pingTimer",null);this.config=e}get connectionState(){return this.state}connect(){if(this.ws)return;const e=this.config.getToken();if(!e){console.warn("[pusher] no token available, cannot connect");return}this.shouldReconnect=!0,this.setState(this.state==="reconnecting"?"reconnecting":"connecting");const n=`${this.config.url}?token=${encodeURIComponent(e)}`;this.ws=new WebSocket(n),this.ws.onopen=()=>{this.setState("connected"),this.reconnectDelay=xae,this.startPing(),this.resubscribeAll()},this.ws.onclose=()=>{this.cleanup(),this.shouldReconnect&&this.scheduleReconnect()},this.ws.onerror=r=>{Zi(r,{scope:"pusher.ws"})},this.ws.onmessage=r=>{this.handleMessage(r.data)}}disconnect(){this.shouldReconnect=!1,this.clearReconnectTimer(),this.cleanup(),this.activeSubscriptions.clear(),this.setState("disconnected")}subscribe(e){this.activeSubscriptions.add(e),this.send({type:"subscribe",channel:e})}unsubscribe(e){this.activeSubscriptions.delete(e),this.send({type:"unsubscribe",channel:e})}sendMessage(e,n){this.send({type:"message",channel:e,payload:n})}on(e,n,r){let i=this.listeners.get(e);i||(i=new Map,this.listeners.set(e,i));let s=i.get(n);s||(s=new Set,i.set(n,s)),s.add(r)}off(e,n,r){const i=this.listeners.get(e);if(!i)return;const s=i.get(n);s&&(s.delete(r),s.size===0&&i.delete(n),i.size===0&&this.listeners.delete(e))}onStateChange(e){return this.stateListeners.add(e),()=>this.stateListeners.delete(e)}send(e){var n;((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify(e))}handleMessage(e){if(e==="pong")return;let n;try{n=JSON.parse(e)}catch(s){Zi(s,{scope:"pusher.parse",data:e});return}if(n.type==="error"){Zi(new Error(n.message??"pusher server error"),{scope:"pusher.server"});return}if(!n.channel)return;const r=this.listeners.get(n.channel);if(!r)return;const i=r.get(n.type);if(i)for(const s of i)try{s(n)}catch(o){tI(o,{scope:"pusher.listener",channel:n.channel})}}resubscribeAll(){for(const e of this.activeSubscriptions)this.send({type:"subscribe",channel:e})}scheduleReconnect(){this.setState("reconnecting");const e=Math.random()*.5+.75,n=Math.min(this.reconnectDelay*e,_ae);this.reconnectTimer=setTimeout(()=>{this.reconnectDelay=Math.min(this.reconnectDelay*2,_ae),this.connect()},n)}cleanup(){this.stopPing(),this.ws&&(this.ws.onopen=null,this.ws.onclose=null,this.ws.onerror=null,this.ws.onmessage=null,(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING)&&this.ws.close(),this.ws=null)}clearReconnectTimer(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}startPing(){this.stopPing(),this.pingTimer=setInterval(()=>{var e;((e=this.ws)==null?void 0:e.readyState)===WebSocket.OPEN&&this.ws.send("ping")},mTt)}stopPing(){this.pingTimer&&(clearInterval(this.pingTimer),this.pingTimer=null)}setState(e){if(this.state!==e){this.state=e;for(const n of this.stateListeners)n(e)}}}const MEe=x.createContext(null),yTt=x.createContext("disconnected");function vTt({children:t}){const e=Rh(s=>s.token),[n,r]=x.useState("disconnected"),i=x.useMemo(()=>e?new gTt({url:Z9.pusherUrl,getToken:()=>Rh.getState().token}):null,[e]);return x.useEffect(()=>{if(!i)return;const s=i.onStateChange(o=>{r(o)});return i.connect(),()=>{s(),i.disconnect(),r("disconnected")}},[i]),m.jsx(MEe.Provider,{value:i,children:m.jsx(yTt.Provider,{value:n,children:t})})}function bTt(){return x.useContext(MEe)}function wTt(t){const e=bTt(),[n,r]=x.useState([]),[i,s]=x.useState([]);x.useEffect(()=>{if(!e||!t)return;e.subscribe(t);const a=d=>{r(d.presence??[])},l=d=>{const h=d.humanId;h&&r(f=>f.includes(h)?f:[...f,h])},c=d=>{d.humanId&&r(h=>h.filter(f=>f!==d.humanId))},u=d=>{const h=d.humanId;h&&s(f=>[...f,{humanId:h,payload:d.payload}])};return e.on(t,"subscribed",a),e.on(t,"join",l),e.on(t,"leave",c),e.on(t,"message",u),()=>{e.off(t,"subscribed",a),e.off(t,"join",l),e.off(t,"leave",c),e.off(t,"message",u),e.unsubscribe(t),r([]),s([])}},[e,t]);const o=x.useCallback(a=>{e&&t&&(e==null||e.sendMessage(t,a))},[e,t]);return{presence:n,messages:i,sendMessage:o}}const xTt=1e4,_Tt=5e3,STt=2e3,NEe=x.createContext(null);function kTt({networkId:t,streamId:e,children:n}){const r=`stream:${t}:${e}`,{presence:i,messages:s,sendMessage:o}=wTt(r),a=Dn(v=>{var b;return(b=v.user)==null?void 0:b.id}),l=x.useMemo(()=>new Set(i),[i]),[c,u]=x.useState([]),d=x.useRef(new Map),h=x.useRef(0);x.useEffect(()=>{if(s.length<=h.current)return;const v=s.slice(h.current);h.current=s.length;let b=!1;const _=d.current;for(const S of v){const k=S.payload;k!=null&&k.type&&S.humanId!==a&&(k.type==="composing_start"&&k.mode?(_.set(S.humanId,{humanId:S.humanId,mode:k.mode,lastSeen:Date.now()}),b=!0):k.type==="composing_stop"&&_.delete(S.humanId)&&(b=!0))}b&&u(Array.from(_.values()))},[s,a]),x.useEffect(()=>{const v=d.current,b=new Set(i);let _=!1;for(const S of v.keys())b.has(S)||(v.delete(S),_=!0);_&&u(Array.from(v.values()))},[i]),x.useEffect(()=>{const v=setInterval(()=>{const b=d.current,_=Date.now();let S=!1;for(const[k,T]of b)_-T.lastSeen>xTt&&(b.delete(k),S=!0);S&&u(Array.from(b.values()))},STt);return()=>clearInterval(v)},[]);const f=x.useRef(void 0),p=x.useCallback(v=>{o({type:"composing_start",mode:v}),clearInterval(f.current),f.current=setInterval(()=>{o({type:"composing_start",mode:v})},_Tt)},[o]),g=x.useCallback(()=>{clearInterval(f.current),f.current=void 0,o({type:"composing_stop"})},[o]);x.useEffect(()=>()=>{clearInterval(f.current)},[]);const y=x.useMemo(()=>({onlineHumanIds:l,composingUsers:c,startComposing:p,stopComposing:g}),[l,c,p,g]);return m.jsx(NEe.Provider,{value:y,children:n})}function mK(){const t=x.useContext(NEe);if(!t)throw new Error("useStreamPresence must be used within a StreamPresenceProvider");return t}function OEe(){const{onlineHumanIds:t}=mK();return{onlineHumanIds:t}}function CTt(){const{composingUsers:t}=mK();return{composingUsers:t}}function ETt(){const{startComposing:t,stopComposing:e}=mK();return{startComposing:t,stopComposing:e}}function TTt({networkId:t,particle:e,streamParticle:n}){const r=oo(),i=xa(t),s=Dn(v=>{var b;return(b=v.user)==null?void 0:b.id}),o=!!s&&s===n.created_by_human_id,[a,l]=x.useState(!1),[c,u]=x.useState(!1),[d,h]=x.useState(!1),f=!!e&&!!s&&e.created_by_human_id===s&&e.type!=="stream"&&e.type!=="folder"&&!od(e),p=n.huddle_active_participants??[],g=p.length>0,y=()=>{AI("Huddle")&&Bn.getLivekitToken(t,n.id).then(({token:v,server_url:b})=>{cr.huddle.open({token:v,serverUrl:b})})};return m.jsxs("div",{className:"drag-region flex flex-row px-2 gap-1 items-center",children:[m.jsx(n2,{}),m.jsx(IEe,{className:"no-drag rounded-full bg-black/30 backdrop-blur-sm px-3 py-1 mx-auto",children:m.jsxs(REe,{children:[n&&m.jsx(m.Fragment,{children:m.jsx(hS,{className:"text-xs",children:m.jsx(fS,{children:Dve(n)})})}),e&&m.jsxs(m.Fragment,{children:[m.jsx(yF,{}),m.jsx(hS,{className:"text-xs",children:m.jsx(fS,{children:m.jsx(ITt,{particle:e,networkId:t})})})]})]})}),g&&m.jsxs("button",{onClick:y,className:"no-drag flex items-center gap-2 rounded-full bg-red-500/20 px-3 py-1 backdrop-blur-sm transition-colors hover:bg-red-500/30",children:[m.jsxs("span",{className:"relative flex size-2",children:[m.jsx("span",{className:"absolute inline-flex size-full animate-ping rounded-full bg-red-400 opacity-75"}),m.jsx("span",{className:"relative inline-flex size-2 rounded-full bg-red-500"})]}),m.jsx(fve,{children:p.map(v=>{const b=Bo(v,i==null?void 0:i.humans);return m.jsxs(tb,{children:[m.jsx(nb,{asChild:!0,children:m.jsx(Xc,{size:"sm",avatarObjectId:b.avatarObjectId,initials:b.initials,fallbackClassName:"bg-red-500/30 text-[8px] text-red-200"})}),m.jsx(rb,{children:b.email})]},v)})}),m.jsx("span",{className:"text-xs font-medium text-red-200",children:"Join"})]}),m.jsx(ATt,{networkId:t,streamParticle:n,onClick:()=>u(!0)}),m.jsxs(lTt,{children:[m.jsx(cTt,{asChild:!0,children:m.jsx(Rt,{variant:"ghost",size:"sm",className:"no-drag text-muted-foreground",children:m.jsx(aYe,{className:"size-3.5"})})}),m.jsxs(uTt,{align:"end",children:[o&&m.jsxs(GD,{onSelect:()=>l(!0),children:[m.jsx($ye,{className:"size-4"}),"Rename stream"]}),f&&m.jsxs(GD,{onSelect:()=>h(!0),variant:"destructive",children:[m.jsx(x3,{className:"size-4"}),"Delete particle"]}),m.jsxs(GD,{onSelect:()=>r("/settings"),children:[m.jsx(BH,{className:"size-4"}),"Settings"]})]})]}),a&&o&&m.jsx(dTt,{networkId:t,streamParticle:n,onClose:()=>l(!1)}),d&&f&&e&&s&&m.jsx(hTt,{networkId:t,streamId:n.id,particle:e,userId:s,onClose:()=>h(!1)}),c&&m.jsx(pTt,{networkId:t,streamParticle:n,isCreator:o,onClose:()=>u(!1)})]})}function ATt({networkId:t,streamParticle:e,onClick:n}){const r=xa(t),i=AEe(e.visible_to,t),s=Dn(f=>{var p;return(p=f.user)==null?void 0:p.id}),o=(r==null?void 0:r.humans)??[],a=i.mode==="network",l=a?o.map(f=>f.id):i.humanIds,c=a?[]:l.filter(f=>f!=s),u=c.length==0,d=c.slice(0,3).map(f=>o.find(p=>p.id===f)).filter(f=>!!f),h=c.length-d.length;return m.jsxs(tb,{children:[m.jsx(nb,{asChild:!0,children:m.jsx("button",{onClick:n,className:"no-drag flex items-center gap-1.5 rounded-full bg-white/5 px-2 py-1 text-xs text-white/70 backdrop-blur-sm transition-colors hover:bg-white/10",children:a?m.jsxs(m.Fragment,{children:[m.jsx(US,{className:"size-3 text-white/50"}),m.jsx("span",{children:"Everyone"})]}):u?m.jsxs(m.Fragment,{children:[m.jsx(M7,{className:"size-3 text-white/50"}),m.jsx("span",{children:"Private"})]}):m.jsxs(m.Fragment,{children:[m.jsx(fve,{children:d.map(f=>m.jsx(Xc,{size:"sm",avatarObjectId:f.avatar_object_id,initials:Bo(f.id,o).initials,fallbackClassName:"text-[8px]"},f.id))}),h>0&&m.jsxs("span",{className:"text-white/50",children:["+",h]})]})})}),m.jsx(rb,{children:a?`Everyone in ${(r==null?void 0:r.name)??"network"}`:`${l.length} ${l.length===1?"member":"members"}`})]})}function ITt({particle:t,networkId:e}){const n=xa(e),{onlineHumanIds:r}=OEe(),i=Bo(t.created_by_human_id,n==null?void 0:n.humans),s=t.created_by_human_id?r.has(t.created_by_human_id):!1;return m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx(Xc,{size:"sm",className:s?"ring-2 ring-green-500":"",avatarObjectId:i.avatarObjectId,initials:i.initials}),i.displayName," - ",m.jsx(C3,{date:t.created_at})]})}const RTt={currentParticleId:null,status:"idle",initialized:!1};function MTt(t,e){switch(e.type){case"INIT":return{currentParticleId:e.particleId,status:"playing",initialized:!0};case"SET_PARTICLE":return{...t,currentParticleId:e.particleId,status:"playing"};case"END":return{...t,status:"ended"};case"PARTICLE_ADDED":return t.status==="ended"?{...t,currentParticleId:e.particleId,status:"playing"}:t;case"PARTICLE_REMOVED":return e.removedParticleId!==t.currentParticleId?t:e.fallbackParticleId?{...t,currentParticleId:e.fallbackParticleId,status:"playing"}:{...t,currentParticleId:null,status:"idle"}}}const NTt=5e3;function OTt(t,e,{autoAdvanceOnNew:n=!0}={}){const r=Dn(S=>{var k;return(k=S.user)==null?void 0:k.id}),[i,s]=x.useReducer(MTt,RTt),o=x.useRef(n);x.useEffect(()=>{o.current=n},[n]);const a=x.useRef(null),l=x.useRef(0),c=x.useCallback(S=>{o.current&&s({type:"PARTICLE_ADDED",particleId:S.id})},[]),u=x.useCallback((S,k)=>{const T=Math.min(l.current,k.length-1),E=k[Math.max(0,T)];s({type:"PARTICLE_REMOVED",removedParticleId:S.id,fallbackParticleId:(E==null?void 0:E.id)??null})},[]),{children:d}=KS(e,{orderByField:"created_at",orderDirection:"asc",onAdded:c,onRemoved:u}),h=x.useMemo(()=>i.currentParticleId?d.findIndex(S=>S.id===i.currentParticleId):-1,[d,i.currentParticleId]),f=h!==-1?d[h]:null;x.useEffect(()=>{l.current=h},[h]);const p=x.useEffectEvent(()=>{i.initialized||d.length===0||(a.current=t.id,s({type:"INIT",particleId:d[0].id}))});x.useEffect(()=>{var E;if(a.current!==null&&a.current!==t.id&&(a.current=null),i.initialized&&a.current===t.id||d.length===0)return;const S=(E=t.playback_markers)==null?void 0:E[r??""];if(!S){a.current=t.id,s({type:"INIT",particleId:d[0].id});return}const k=d.find(C=>C.created_at.getTime()>S.getTime());if(k){a.current=t.id,s({type:"INIT",particleId:k.id});return}else a.current=t.id,s({type:"INIT",particleId:d[d.length-1].id});const T=setTimeout(p,NTt);return()=>clearTimeout(T)},[d,t.id,t.playback_markers,r,i.initialized]);const g=x.useRef(null);x.useEffect(()=>{var E;if(!r||!i.initialized||!f)return;const S=f.created_at,k=g.current??((E=t.playback_markers)==null?void 0:E[r]);if(k&&S.getTime()<=k.getTime())return;g.current=S;const T=Xl(e);iQe(T,r,S)},[f,t.playback_markers,i.initialized,r,e]);const y=x.useCallback(()=>{h!==-1&&(h<d.length-1?s({type:"SET_PARTICLE",particleId:d[h+1].id}):s({type:"END"}))},[d,h]),v=x.useCallback(()=>{h<=0||s({type:"SET_PARTICLE",particleId:d[h-1].id})},[d,h]),b=x.useCallback(S=>{S>=0&&S<d.length&&s({type:"SET_PARTICLE",particleId:d[S].id})},[d]),_=x.useCallback(S=>{s({type:"SET_PARTICLE",particleId:S})},[]);return{children:d,currentParticle:f,currentIndex:h,status:i.status,initialized:i.initialized,next:y,prev:v,goTo:b,goToParticle:_}}function DTt(t,e){const n=cl();x.useEffect(()=>{const i=[e-1,e+1].filter(s=>s>=0&&s<t.length).map(s=>t[s]).filter(s=>s.type==="media");for(const s of i){const o=s.properties.object_id;n.prefetchQuery({queryKey:["download-url",o],queryFn:()=>Bn.getParticleDownloadUrl(o),staleTime:1e3*60*60}).then(()=>{const a=n.getQueryData(["download-url",o]);a&&nc.preload(a,{as:"fetch",crossOrigin:"anonymous"})})}},[t,e,n])}function PTt(t,e,n,r){return x.useMemo(()=>{const i=new Map;if(!t||!n||e.length===0)return i;for(const[s,o]of Object.entries(t)){if(s===r)continue;const a=n.find(d=>d.id===s);if(!a)continue;let l=-1;for(let d=e.length-1;d>=0;d--)if(e[d].created_at.getTime()<=o.getTime()){l=d;break}if(l===-1)continue;const c=i.get(l),u={humanId:a.id,email:a.email,emailPrefix:a.email_prefix,avatarObjectId:a.avatar_object_id??null};c?c.push(u):i.set(l,[u])}for(const s of i.values())s.sort((o,a)=>o.humanId.localeCompare(a.humanId));return i},[t,e,n,r])}function LTt({users:t,networkHumans:e}){return t.length===0?null:m.jsx("div",{className:"z-100 absolute left-2 top-1/2 z-20 flex -translate-y-1/2 flex-col gap-1.5 animate-in fade-in duration-200",style:{writingMode:"vertical-rl"},children:t.map(n=>{const{displayName:r}=Bo(n.humanId,e),i=n.mode==="typing"?"typing":"recording";return m.jsxs("div",{className:"flex rotate-180 items-center gap-1.5 rounded-full bg-white/10 px-2 py-1 backdrop-blur-sm",children:[m.jsxs("span",{className:"flex gap-0.5",children:[m.jsx("span",{className:"size-1 rounded-full bg-white/70 animate-bounce [animation-delay:0ms]"}),m.jsx("span",{className:"size-1 rounded-full bg-white/70 animate-bounce [animation-delay:150ms]"}),m.jsx("span",{className:"size-1 rounded-full bg-white/70 animate-bounce [animation-delay:300ms]"})]}),m.jsxs("span",{className:"whitespace-nowrap text-[10px] text-white/50",children:[r," ",i]})]},n.humanId)})})}var zTt=function(t){x.useEffect(t,[])},jTt=function(t){zTt(function(){t()})};function K8(t){const e=t.target;return e?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1}const BTt=250;function FTt({mediaRef:t}){const[e,n]=x.useState(!1),[r,i]=x.useState(!1),s=x.useRef(0);return oc(e,"hold-space"),x.useEffect(()=>{const o=()=>aU(II.getState())&&!e,a=c=>{var u;if(!K8(c)){if(c.key===" "){c.preventDefault(),c.repeat||(e?(n(!1),s.current=0):(n(!0),s.current=Date.now()));return}o()||c.key==="Shift"&&!c.repeat&&((u=t.current)==null||u.setPlaybackRate(1.5),i(!0))}},l=c=>{var u;if(!K8(c)){if(c.key===" "){if(c.preventDefault(),Date.now()-s.current<BTt)return;n(!1),s.current=0;return}o()||c.key==="Shift"&&((u=t.current)==null||u.setPlaybackRate(1),i(!1))}};return window.addEventListener("keydown",a),window.addEventListener("keyup",l),()=>{window.removeEventListener("keydown",a),window.removeEventListener("keyup",l)}},[t,e]),{fastPlayback:r}}const Sae=5;function VTt({next:t,prev:e,currentIndex:n,childrenLength:r,mediaRef:i,onExit:s,onToggleViewMode:o}){x.useEffect(()=>{const a=l=>{var u,d;if(K8(l))return;const c=n>=0&&n<r-1;switch(l.key){case"ArrowRight":l.preventDefault(),(!l.shiftKey||!((u=i.current)!=null&&u.seek(Sae)))&&c&&t();break;case"ArrowDown":l.preventDefault(),c&&t();break;case"ArrowLeft":l.preventDefault(),(!l.shiftKey||!((d=i.current)!=null&&d.seek(-Sae)))&&e();break;case"ArrowUp":l.preventDefault(),e();break;case"Escape":l.preventDefault(),s();break;case"l":case"L":l.preventDefault(),o();break}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[t,e,n,r,i,s,o])}function $Tt({onToggleReaction:t,onOpenHuddle:e,onToggleRecordingMode:n,onToggleKeybindings:r,onOpenTextReaction:i}){x.useEffect(()=>{const s=o=>{if(!K8(o)&&!aU(II.getState()))switch(o.key){case"h":o.preventDefault(),e();break;case"v":o.preventDefault(),n();break;case"r":o.preventDefault(),i();break;case"?":o.preventDefault(),r();break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":o.preventDefault(),t(b7[parseInt(o.key)-1]);break}};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[t,e,n,r,i])}function kae(t){if(!od(t)&&(t.type==="media"||t.type==="text"||t.type==="task"||t.type==="event"))return t.reactions}const Cae=5e3,Eae=100;function HTt(t,e,n){const[r,i]=x.useState(t==="ended"?Cae:null),[s,o]=x.useState(t),a=x.useEffectEvent(()=>{n()});t!==s&&(o(t),i(t==="ended"?Cae:null));const l=r!==null&&r>0;return x.useEffect(()=>{if(!l||e)return;const c=setInterval(()=>{i(u=>{if(u===null)return null;const d=u-Eae;return d<=0?0:d})},Eae);return()=>clearInterval(c)},[l,e]),x.useEffect(()=>{r!==null&&r<=0&&a()},[r]),r}const UTt=[{label:"Navigation",bindings:[{keys:["←","→","↑","↓"],description:"Previous / next particle"},{keys:["Esc"],description:"Back to network"},{keys:["L"],description:"Toggle list view"}]},{label:"Playback",bindings:[{keys:["Space"],description:"Toggle pause"},{keys:["Hold","Space"],description:"Pause while held"},{keys:["Hold","Shift"],description:"1.5× speed"},{keys:["Shift","←","→"],description:"Seek ±5s"}]},{label:"Compose",bindings:[{keys:["Hold","`"],description:"Reply"},{keys:["S"],description:"Screen record"},{keys:["T"],description:"Text compose"},{keys:["D"],description:"New task"},{keys:["E"],description:"New event"},{keys:["V"],description:"Toggle video / audio"},{keys:["H"],description:"Join huddle"}]},{label:"Reactions",bindings:[{keys:["1-7"],description:"Toggle emoji reaction"},{keys:["R"],description:"Quick text reply"}]}];function qTt({path:t,streamParticle:e}){const{networkId:n}=ul(t);return m.jsx(kTt,{networkId:n,streamId:e.id,children:m.jsx(WTt,{path:t,streamParticle:e})})}function WTt({path:t,streamParticle:e}){const{networkId:n}=ul(t),r=oo();jTt(()=>{cr.autoplay.dismiss()});const i=Dn(ie=>{var Te;return(Te=ie.user)==null?void 0:Te.id}),{mode:s,toggle:o}=tTt(e,i);oc(s==="list","list-mode");const{children:a,currentParticle:l,currentIndex:c,status:u,next:d,prev:h,goTo:f,goToParticle:p}=OTt(e,t,{autoAdvanceOnNew:s==="player"});DTt(a,c);const g=Dn(ie=>ie.user),y=G1(ie=>ie.recordingMode),v=G1(ie=>ie.setRecordingMode),b=xa(n),_=PTt(e.playback_markers,a,b==null?void 0:b.humans,g==null?void 0:g.id),{onlineHumanIds:S}=OEe(),{composingUsers:k}=CTt(),{startComposing:T,stopComposing:E}=ETt(),C=x.useRef(null),R=x.useCallback(ie=>{if(!g||!l||od(l))return;const Te=l?Xl(Ls(n,[e.id,l.id])):null;if(!Te)return;const he=kae(l);oQe(Te,ie,g.id,he)},[g,l,n,e.id]),[M,D]=x.useState(!1),[P,z]=x.useState("idle"),Z=II(aU),[re,G]=x.useState(0),[ee,J]=x.useState(l==null?void 0:l.id),[oe,B]=x.useState(!1),[$e,Ye]=x.useState(!1),$=x.useCallback(ie=>{R(ie)},[R]),{fastPlayback:Re}=FTt({mediaRef:C}),ke=x.useCallback(()=>{r(`/${n}`)},[r,n]);VTt({next:d,prev:h,currentIndex:c,childrenLength:a.length,mediaRef:C,onExit:ke,onToggleViewMode:o});const Me=x.useCallback(()=>{AI("Huddle")&&(Bn.getLivekitToken(n,e.id).then(({token:ie,server_url:Te})=>{cr.huddle.open({token:ie,serverUrl:Te})}),r(`/${n}`))},[n,e.id,r]),_e=x.useCallback(()=>{v(y==="video"?"audio":"video")},[y,v]),Ne=x.useCallback(()=>{B(ie=>!ie)},[]);$Tt({onToggleReaction:R,onOpenHuddle:Me,onToggleRecordingMode:_e,onToggleKeybindings:Ne,onOpenTextReaction:()=>Ye(!0)}),x.useEffect(()=>{const Te={idle:null,submitting:null,recording:"recording",typing:"typing",task:"typing",event:"typing",reviewing:"typing",configuring:"typing",picking:"screen"}[P]??null;Te?T(Te):E()},[P,T,E]);const[Ue,at]=x.useState(!0),ct=x.useRef(void 0),H=x.useCallback(()=>{at(!0),clearTimeout(ct.current),ct.current=setTimeout(()=>at(!1),3e3)},[]);x.useEffect(()=>()=>clearTimeout(ct.current),[]);const Y=Ue||M||u==="ended",se=HTt(u,Z,ke);(l==null?void 0:l.id)!==ee&&(J(l==null?void 0:l.id),G(0));const me=x.useCallback(ie=>{c!==-1&&c===a.length-1&&p(ie)},[a,p,c]);if(a.length===0)return m.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4 bg-black text-white",children:[m.jsx("p",{className:"text-muted-foreground text-sm",children:"No particles in this stream yet"}),m.jsx(CEe,{showEscape:!0,onOpenKeybindings:()=>B(!0),onOpenHuddle:Me,onExit:ke}),m.jsx(mF,{networkId:n,targetPath:t,onActiveChange:D,onParticleCreated:me})]});function de(ie){if(od(ie))return m.jsx(kEe,{particle:ie,networkId:n,paused:Z,onEnded:d},ie.id);switch(ie.type){case"media":return m.jsx(pEe,{ref:C,particle:ie,streamPath:t,paused:Z,onEnded:d,onProgress:G},ie.id);case"text":return m.jsx(gEe,{particle:ie,streamPath:t,paused:Z,onEnded:d,onProgress:G},ie.id);case"task":return m.jsx(yEe,{particle:ie,containerPath:t,paused:Z,onEnded:d,onProgress:G},ie.id);case"event":return m.jsx(oEe,{particle:ie,containerPath:t,paused:Z,onEnded:d,onProgress:G},ie.id);default:return m.jsx(SEe,{particle:ie,networkId:n})}}return m.jsxs("div",{className:"relative flex h-screen flex-col overflow-hidden bg-black text-white [--stream-safe-top:4rem] [--stream-safe-bottom:5rem]",onMouseMove:H,onMouseLeave:()=>at(!1),children:[m.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-[5] h-32 bg-gradient-to-b from-black/60 to-transparent"}),m.jsx("div",{className:"z-10 absolute left-0 right-0 pt-2",children:m.jsx(TTt,{networkId:n,particle:l,streamParticle:e})}),m.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[m.jsx("div",{className:"relative flex-1 overflow-hidden",children:l&&m.jsxs("div",{className:"relative flex h-full w-full cursor-pointer items-center justify-center",children:[de(l),m.jsxs("div",{className:"pointer-events-none absolute right-4 top-14 z-20 flex flex-col items-end gap-1.5",children:[Re&&m.jsx("div",{className:"rounded-full bg-black/50 px-2.5 py-1 text-xs font-medium text-white backdrop-blur-sm",children:"1.5x"}),Z&&s==="player"&&m.jsx("div",{className:"rounded-full bg-black/40 px-2.5 py-1 text-xs font-medium text-white/70 backdrop-blur-sm",children:"Paused"})]})]})}),s==="list"&&m.jsx(eTt,{items:a,networkId:n,currentIndex:c,onSelect:f})]}),l&&!od(l)&&m.jsxs("div",{className:"absolute right-4 top-1/2 z-10 flex -translate-y-1/2 flex-col items-end gap-2",children:[m.jsx(oTt,{reactions:kae(l),currentHumanId:(g==null?void 0:g.id)??"",humans:b==null?void 0:b.humans,onToggle:R,onOpenTextReaction:()=>Ye(!0)}),m.jsx(aTt,{open:$e,onSubmit:$,onClose:()=>Ye(!1)})]}),m.jsx(LTt,{users:k,networkHumans:b==null?void 0:b.humans}),m.jsx(mF,{networkId:n,targetPath:t,onActiveChange:D,onStepChange:z,onParticleCreated:me}),m.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-[5] h-1/4 bg-gradient-to-t from-black/60 to-transparent"}),s==="player"&&m.jsx(JEt,{visible:Y,total:a.length,current:c,progress:re,onGoTo:f,presenceBySegment:_,onlineHumanIds:S,exitRemainingMs:se,onOpenKeybindings:()=>B(!0),onOpenHuddle:Me,onExit:ke}),m.jsx(nTt,{open:oe,onClose:()=>B(!1),groups:UTt,title:"Stream View"})]})}function GTt({path:t,folderParticle:e}){return m.jsx(cEe,{path:t,folderParticle:e})}function KTt(){const{networkId:t,"*":e}=Q5();if(!t)throw new Error("ParticleViewResolver requires a :networkId route param");const n=(e??"").split("/").filter(Boolean),r=Ls(t,n),{particle:i,isLoading:s,error:o}=aQe(r);if(s)return m.jsx("div",{className:"flex h-full items-center justify-center",children:m.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading..."})});if(o||!i)return m.jsx(ZTt,{});switch(i.type){case"stream":return m.jsx(qTt,{streamParticle:i,path:r});case"folder":return m.jsx(GTt,{folderParticle:i,path:r});default:return m.jsx(YTt,{particle:i,containerPath:Ls(t,n.slice(0,-1)),networkId:t})}}const d4=()=>{};function YTt({particle:t,containerPath:e,networkId:n}){const r=(()=>{if(od(t))return m.jsx(kEe,{particle:t,networkId:n,paused:!0,onEnded:d4});switch(t.type){case"media":return m.jsx(pEe,{particle:t,streamPath:e,paused:!1,onEnded:d4});case"text":return m.jsx(gEe,{particle:t,streamPath:e,paused:!0,onEnded:d4});case"task":return m.jsx(yEe,{particle:t,containerPath:e,paused:!0,onEnded:d4});case"event":return m.jsx(oEe,{particle:t,containerPath:e,paused:!0,onEnded:d4});default:return m.jsx(SEe,{particle:t,networkId:n})}})();return m.jsx("div",{className:"h-full bg-black text-white [--stream-safe-top:4rem] [--stream-safe-bottom:2rem]",children:r})}function ZTt(){const t=oo(),e=cl();return x.useEffect(()=>{e.invalidateQueries({queryKey:["networks"]})},[e]),m.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4 p-8 text-center",children:[m.jsx(M7,{className:"text-muted-foreground size-8"}),m.jsxs("div",{className:"flex max-w-sm flex-col gap-1",children:[m.jsx("p",{className:"text-sm font-medium",children:"This particle isn't available"}),m.jsx("p",{className:"text-muted-foreground text-xs",children:"It may have been deleted, or your access was removed."})]}),m.jsx(Rt,{size:"sm",onClick:()=>t("/",{replace:!0}),children:"Go home"})]})}const XTt=bI("type","==","stream");function QTt(t){const e=Dn(a=>a.user),n=e==null?void 0:e.id,r=x.useMemo(()=>{const a=[];return n&&a.push(`human:${n}`),t&&a.push(`network:${t}`),a},[n,t]),i=t?Ls(t,[]):void 0,{children:s}=KS(i,{orderByField:"last_child_created_at",orderDirection:"desc",visibilityScopes:r,whereFilter:XTt}),o=x.useMemo(()=>n?s.filter(a=>{var u,d,h;if(a.type!=="stream")return!1;const l=(u=a.last_child_created_at)==null?void 0:u.getTime();if(!l)return!1;const c=(h=(d=a.playback_markers)==null?void 0:d[n])==null?void 0:h.getTime();return c===void 0?!1:l>c}).length:0,[s,n]);x.useEffect(()=>{cr.app.setDockBadge(o)},[o])}const JTt=x.createContext(null),YD={didCatch:!1,error:null};class DEe extends x.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=YD}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){var r,i;const{error:n}=this.state;n!==null&&((i=(r=this.props).onReset)==null||i.call(r,{args:e,reason:"imperative-api"}),this.setState(YD))}componentDidCatch(e,n){var r,i;(i=(r=this.props).onError)==null||i.call(r,e,n)}componentDidUpdate(e,n){var s,o;const{didCatch:r}=this.state,{resetKeys:i}=this.props;r&&n.error!==null&&e6t(e.resetKeys,i)&&((o=(s=this.props).onReset)==null||o.call(s,{next:i,prev:e.resetKeys,reason:"keys"}),this.setState(YD))}render(){const{children:e,fallbackRender:n,FallbackComponent:r,fallback:i}=this.props,{didCatch:s,error:o}=this.state;let a=e;if(s){const l={error:o,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")a=n(l);else if(r)a=x.createElement(r,l);else if(i!==void 0)a=i;else throw o}return x.createElement(JTt.Provider,{value:{didCatch:s,error:o,resetErrorBoundary:this.resetErrorBoundary}},a)}}function e6t(t=[],e=[]){return t.length!==e.length||t.some((n,r)=>!Object.is(n,e[r]))}function PEe({error:t,onGoHome:e,onRetry:n}){return m.jsx("div",{className:"flex h-screen w-full items-center justify-center p-6",children:m.jsxs(vEe,{className:"w-full max-w-md",children:[m.jsxs(bEe,{children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Uye,{className:"text-destructive size-4"}),m.jsx(wEe,{children:"Something went wrong"})]}),m.jsx(xEe,{children:zm(t)})]}),t instanceof Error?m.jsx(_Ee,{children:m.jsxs("details",{className:"text-muted-foreground text-xs",children:[m.jsx("summary",{className:"cursor-pointer select-none",children:"Technical details"}),m.jsx("pre",{className:"mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-all",children:t.stack??t.message})]})}):null,m.jsxs(YEt,{className:"flex gap-2",children:[m.jsx(Rt,{size:"sm",onClick:e,children:"Go home"}),m.jsx(Rt,{size:"sm",variant:"outline",onClick:n,children:"Try again"})]})]})})}function t6t({error:t,resetErrorBoundary:e}){const n=()=>{window.location.hash="#/",e()};return m.jsx(PEe,{error:t,onGoHome:n,onRetry:e})}function n6t({error:t,resetErrorBoundary:e}){const n=oo(),r=()=>{n("/"),e()};return m.jsx(PEe,{error:t,onGoHome:r,onRetry:e})}function r6t({children:t}){return m.jsx(DEe,{FallbackComponent:t6t,onError:(e,n)=>tI(e,{boundary:"top",componentStack:n.componentStack}),children:t})}function LEe({children:t}){const e=xf(),{reset:n}=GH();return m.jsx(DEe,{FallbackComponent:n6t,onError:(r,i)=>tI(r,{boundary:"route",pathname:e.pathname,componentStack:i.componentStack}),onReset:()=>n(),resetKeys:[e.pathname],children:t})}function Tae({networkId:t}){const{data:e}=k3(),n=e==null?void 0:e.find(s=>s.id===t),r=(n==null?void 0:n.name)??t,i=r.slice(0,2).toUpperCase();return m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx(_3,{size:"sm",children:m.jsx(S3,{className:"bg-primary/10 text-primary text-[10px] font-medium",children:i})}),r]})}function i6t(){const t=Sz(r=>r.muted),e=Sz(r=>r.toggleMuted),n=x.useCallback(()=>{e(),t?Hn.success("Auto-play enabled"):Hn.info("Auto-play disabled")},[e,t]);return m.jsxs("div",{className:"no-drag flex items-center gap-1.5",children:[t?m.jsx(tZe,{className:"size-3.5 text-muted-foreground"}):m.jsx(qye,{className:"size-3.5"}),m.jsx(_z,{checked:!t,onCheckedChange:n,"aria-label":t?"Unmute autoplay":"Mute autoplay"})]})}function s6t(){const t=oo(),{networkId:e,"*":n}=Q5(),r=[e,...(n==null?void 0:n.split("/"))??[]].filter(Boolean),i=n&&e?Ls(e,n.split("/").filter(Boolean)):void 0,{data:s}=cQe(i);return m.jsxs("div",{className:"drag-region flex items-center gap-1 border-b bg-muted p-1",children:[m.jsx(n2,{}),m.jsx(IEe,{className:"no-drag px-2",children:m.jsxs(REe,{children:[m.jsx(hS,{className:"text-xs",children:r.length===0?m.jsx(fS,{className:"flex items-center gap-1",children:m.jsx(wJ,{className:"size-3.5"})}):m.jsx(wae,{className:"flex cursor-pointer items-center gap-1",onClick:()=>t("/"),children:m.jsx(wJ,{className:"size-3.5"})})}),e&&m.jsxs("span",{className:"contents",children:[m.jsx(yF,{}),m.jsx(hS,{className:"text-xs",children:r.length===1?m.jsx(fS,{children:m.jsx(Tae,{networkId:e})}):m.jsx(wae,{className:"cursor-pointer",onClick:()=>t(`/${e}`),children:m.jsx(Tae,{networkId:e})})})]}),s&&m.jsxs("span",{className:"contents",children:[m.jsx(yF,{}),m.jsx(hS,{className:"text-xs",children:m.jsx(fS,{children:Dve(s)})})]},i)]})}),m.jsx("div",{className:"flex-1"}),m.jsx(i6t,{}),e&&m.jsx(Rt,{variant:"ghost",size:"sm",className:"no-drag text-muted-foreground",onClick:()=>t(`/${e}/settings`),children:m.jsx(_I,{className:"size-3.5"})}),m.jsx(Rt,{variant:"ghost",size:"sm",className:"no-drag text-muted-foreground",onClick:()=>t("/settings"),children:m.jsx(BH,{className:"size-3.5"})})]})}function Aae({children:t}){const{networkId:e}=Q5();return QTt(e),m.jsxs("div",{className:"flex h-screen flex-col",children:[m.jsx(s6t,{}),m.jsx(LEe,{children:t})]})}function o6t({className:t,...e}){return m.jsx(POe,{"data-slot":"radio-group",className:He("grid w-full gap-2",t),...e})}function a6t({className:t,...e}){return m.jsx(LOe,{"data-slot":"radio-group-item",className:He("group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input 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 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",t),...e,children:m.jsx(zOe,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:m.jsx("span",{className:"absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground"})})})}function l6t(t){return _0({queryKey:["network-billing",t],queryFn:t?()=>Bn.getNetworkBilling(t):Ey,refetchOnWindowFocus:!0,refetchInterval:1e4})}function c6t(t){return kf({mutationFn:e=>Bn.createCheckoutSession(t,e)})}function u6t(t){return kf({mutationFn:()=>Bn.createPortalSession(t)})}function zEe(t){return t%100===0?`$${t/100}`:`$${(t/100).toFixed(2)}`}function d6t(t){return t.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}function h6t({status:t}){return t==="past_due"?m.jsx(km,{variant:"destructive",children:"Past due"}):t==="canceled"?m.jsx(km,{variant:"secondary",children:"Canceled"}):t==="trialing"?m.jsx(km,{variant:"secondary",children:"Trialing"}):null}function Ab({label:t,value:e}){return m.jsxs("div",{className:"flex w-full items-center gap-3 px-4 py-3",children:[m.jsx(gr,{className:"text-sm",children:t}),m.jsx("div",{className:"flex-1"}),m.jsx("div",{className:"text-sm",children:e})]})}function Iae({value:t,label:e,perSeatCents:n,billedNote:r,saveBadge:i,selected:s}){return m.jsxs(zl,{htmlFor:`cadence-${t}`,className:He("hover:bg-accent flex w-full cursor-pointer items-center gap-3 px-4 py-3 font-normal transition-colors",s&&"bg-accent/50"),children:[m.jsx(a6t,{id:`cadence-${t}`,value:t}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("p",{className:"text-sm font-medium",children:e}),i&&m.jsx(km,{children:i})]}),m.jsx(gr,{className:"text-xs",children:r})]}),m.jsxs("div",{className:"shrink-0 text-right",children:[m.jsx("p",{className:"text-sm font-medium",children:zEe(n)}),m.jsx(gr,{className:"text-xs",children:"per seat / mo"})]})]})}function f6t(t){const e=t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}),n=new Date;return`${t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()?"today":"tomorrow"} at ${e}`}function p6t({networkId:t}){const{data:e}=oU(t);if(!e)return null;const n=e.plan==="pro";return m.jsxs(m.Fragment,{children:[m.jsx(Ab,{label:"Plan",value:m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{children:n?"Llink Pro":"Llink Free"}),m.jsx(km,{variant:n?"default":"secondary",children:n?"Pro":"Free"})]})}),!n&&m.jsxs(m.Fragment,{children:[m.jsx(Gi,{className:"mx-4"}),m.jsx(Ab,{label:"Today's messages",value:e&&e.limit!=null?m.jsxs("div",{className:"flex flex-col items-end",children:[m.jsxs("span",{className:"tabular-nums",children:[e.used," / ",e.limit]}),m.jsxs(gr,{className:"text-xs",children:["Resets ",f6t(e.reset_at)]})]}):m.jsx(gr,{className:"text-sm",children:"—"})})]})]})}function m6t({networkId:t,billing:e}){const n=c6t(t),[r,i]=x.useState("annual"),s=()=>{n.mutate(r,{onSuccess:({url:l})=>cr.link.openExternal(l)})},o=Math.round(e.price_annual_cents/12),a=Math.round((1-o/e.price_monthly_cents)*100);return m.jsxs(m.Fragment,{children:[m.jsxs(o6t,{value:r,onValueChange:l=>i(l),className:"gap-0",children:[m.jsx(Iae,{value:"annual",label:"Annual",perSeatCents:o,billedNote:"Billed annually",saveBadge:a>0?`Save ${a}%`:void 0,selected:r==="annual"}),m.jsx(Gi,{className:"mx-4"}),m.jsx(Iae,{value:"monthly",label:"Monthly",perSeatCents:e.price_monthly_cents,billedNote:"Billed monthly · cancel anytime",selected:r==="monthly"})]}),m.jsx("div",{className:"px-4 py-3",children:m.jsx(Rt,{className:"w-full",onClick:s,disabled:n.isPending,children:n.isPending?"Opening Stripe...":"Upgrade to Pro"})})]})}function g6t({networkId:t,billing:e}){const n=u6t(t),r=()=>{n.mutate(void 0,{onSuccess:({url:a})=>cr.link.openExternal(a)})},i=e.cadence==="annual"?"Annual":"Monthly",s=e.cadence==="annual"?Math.round(e.price_annual_cents/12):e.price_monthly_cents,o=e.current_period_end?d6t(e.current_period_end):null;return m.jsxs(m.Fragment,{children:[e.cancel_at_period_end&&o&&m.jsxs("div",{className:"border-destructive/30 bg-destructive/10 text-destructive mx-4 my-2 rounded-md border px-3 py-2 text-sm",children:["Your subscription is set to downgrade to Free on ",o,"."]}),e.plan_status==="past_due"&&m.jsx("div",{className:"border-destructive/30 bg-destructive/10 text-destructive mx-4 my-2 rounded-md border px-3 py-2 text-sm",children:"Your last payment failed. Update your payment method to keep Pro active."}),m.jsx(Ab,{label:"Billing",value:m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{children:`${i} · ${zEe(s)} / seat / mo`}),m.jsx(h6t,{status:e.plan_status})]})}),m.jsx(Gi,{className:"mx-4"}),m.jsx(Ab,{label:"Seats",value:e.seats}),o&&m.jsxs(m.Fragment,{children:[m.jsx(Gi,{className:"mx-4"}),m.jsx(Ab,{label:e.cancel_at_period_end?"Ends":"Renews",value:o})]}),m.jsx("div",{className:"px-4 py-3",children:m.jsxs(Rt,{variant:"outline",className:"w-full",onClick:r,disabled:n.isPending,children:[m.jsx(PH,{className:"mr-2 size-3.5"}),n.isPending?"Opening Stripe...":"Manage subscription"]})})]})}function y6t({networkId:t}){const e=_ve(t);return m.jsxs(m.Fragment,{children:[m.jsx(p6t,{networkId:t}),e&&m.jsxs(m.Fragment,{children:[m.jsx(Gi,{className:"mx-4"}),m.jsx(v6t,{networkId:t}),m.jsx(Gi,{className:"mx-4"}),m.jsx(Ab,{label:m.jsxs("span",{className:"flex flex-col",children:[m.jsx("span",{children:"Billing support"}),m.jsx("span",{className:"text-muted-foreground text-xs",children:"Invoices, receipts, or plan changes"})]}),value:m.jsx(bve,{email:Gye})})]})]})}function v6t({networkId:t}){const{data:e,isLoading:n,error:r}=l6t(t);return n||!e?m.jsx("div",{className:"px-4 py-3",children:m.jsx(gr,{className:"text-sm",children:"Loading billing..."})}):r?m.jsx("div",{className:"px-4 py-3",children:m.jsxs(gr,{className:"text-sm",children:["Couldn't load billing: ",zm(r)]})}):e.plan==="pro"?m.jsx(g6t,{networkId:t,billing:e}):m.jsx(m6t,{networkId:t,billing:e})}const b6t=vt().email();function w6t({email:t,onRemove:e}){return m.jsxs("span",{className:"bg-secondary text-secondary-foreground inline-flex items-center gap-1 rounded-md py-0.5 pl-2 pr-1 text-xs",children:[t,m.jsx(Rt,{type:"button",variant:"ghost",size:"icon-sm",onClick:e,"aria-label":`Remove ${t}`,className:"text-muted-foreground hover:text-foreground size-5",children:m.jsx(Zc,{className:"size-3"})})]})}function x6t({networkId:t,open:e,onOpenChange:n}){const[r,i]=x.useState([]),[s,o]=x.useState(""),[a,l]=x.useState(null),c=HXe(t),u=()=>{i([]),o(""),l(null)},d=g=>{g||u(),n(g)},h=g=>{const y=g.trim().replace(/,$/,"").trim();if(!y)return r;if(!b6t.safeParse(y).success)return l(`"${y}" doesn't look like a valid email.`),null;if(r.includes(y))return o(""),r;const v=[...r,y];return i(v),o(""),l(null),v},f=g=>{g.key==="Enter"||g.key===","?(g.preventDefault(),h(s)):g.key==="Backspace"&&s===""&&r.length>0&&i(r.slice(0,-1))},p=g=>{g.preventDefault();const y=h(s);y!==null&&y.length!==0&&c.mutate(y,{onSuccess:()=>{Hn.success(y.length===1?`Invited ${y[0]}`:`Invited ${y.length} people`),d(!1)}})};return m.jsx(KH,{open:e,onOpenChange:d,children:m.jsxs(YH,{children:[m.jsxs(ZH,{children:[m.jsx(QH,{children:"Add members"}),m.jsx(JH,{children:"Enter email addresses to add people to this network."})]}),m.jsxs("form",{onSubmit:p,children:[m.jsxs("div",{className:"border-input focus-within:border-ring focus-within:ring-ring/50 flex flex-wrap items-center gap-1.5 rounded-md border px-2 py-1.5 transition-colors focus-within:ring-[3px]",children:[r.map(g=>m.jsx(w6t,{email:g,onRemove:()=>i(r.filter(y=>y!==g))},g)),m.jsx(x0,{type:"email",value:s,onChange:g=>{o(g.target.value),a&&l(null)},onKeyDown:f,onBlur:()=>h(s),placeholder:r.length===0?"[email protected]":"Add another…",className:"h-7 min-w-[8rem] flex-1 border-0 px-1 shadow-none focus-visible:ring-0",autoFocus:!0})]}),a?m.jsx("p",{className:"text-destructive mt-1.5 text-xs",children:a}):m.jsx(gr,{className:"mt-1.5 text-xs",children:"Press Enter or comma to add each email."}),m.jsxs(XH,{className:"mt-4",children:[m.jsx(Rt,{type:"button",variant:"outline",onClick:()=>d(!1),children:"Cancel"}),m.jsx(Rt,{type:"submit",disabled:c.isPending||r.length===0&&s.trim()==="",children:c.isPending?"Adding…":"Add members"})]})]})]})})}function _6t({human:t,isAdmin:e,onRemove:n}){const r=t.email_prefix.slice(0,2).toUpperCase();return m.jsxs("div",{className:"flex w-full items-center gap-3 px-4 py-3",children:[m.jsx(Xc,{avatarObjectId:t.avatar_object_id,initials:r,fallbackClassName:"bg-primary/10 text-primary font-medium"}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:"truncate text-sm font-medium",children:t.email_prefix}),m.jsx(gr,{className:"text-xs",children:t.email})]}),e&&m.jsxs(km,{variant:"secondary",className:"shrink-0",children:[m.jsx(Hye,{className:"mr-1 size-3"}),"Admin"]}),n&&m.jsx(Rt,{variant:"ghost",size:"icon-sm",onClick:n,className:"text-muted-foreground hover:text-destructive shrink-0","aria-label":`Remove ${t.email}`,children:m.jsx(Zc,{className:"size-3.5"})})]})}function S6t({email:t,networkId:e}){const n=qXe(e),r=()=>{n.mutate(t,{onSuccess:()=>{Hn.success(`Invitation to ${t} revoked`)}})};return m.jsxs("div",{className:"flex w-full items-center gap-3 px-4 py-3",children:[m.jsx("span",{className:"text-muted-foreground flex size-8 items-center justify-center",children:m.jsx(Fye,{className:"size-4"})}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:"truncate text-sm",children:t}),m.jsx(gr,{className:"text-xs",children:"Pending"})]}),m.jsx(Rt,{variant:"ghost",size:"icon-sm",onClick:r,disabled:n.isPending,className:"text-muted-foreground hover:text-destructive shrink-0",children:m.jsx(Zc,{className:"size-3.5"})})]})}function ZD({title:t,description:e,count:n,action:r}){return m.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[m.jsxs("div",{className:"min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("h2",{className:"text-base font-semibold tracking-tight",children:t}),n!=null&&m.jsx(km,{variant:"secondary",className:"tabular-nums",children:n})]}),e&&m.jsx(gr,{className:"mt-0.5 text-xs",children:e})]}),r]})}function vT({children:t}){return m.jsx("section",{className:"bg-card/40 overflow-hidden rounded-lg border",children:t})}function k6t(){const t=oo(),{networkId:e}=Q5();if(!e)throw new Error("NetworkSettingsPage requires a :networkId route param");const[n,r]=y9e(),{data:i}=k3(),s=i==null?void 0:i.find(k=>k.id===e),{data:o,error:a}=$Xe(e),l=Dn(k=>k.user),c=(l==null?void 0:l.id)===(s==null?void 0:s.admin_human.id),[u,d]=x.useState(null),[h,f]=x.useState(()=>n.get("add")==="1"),p=WXe(e),g=n.get("section")==="billing"?"billing":"members",y=k=>{const T=new URLSearchParams(n);k==="billing"?T.set("section",k):T.delete("section"),r(T,{replace:!0})};x.useEffect(()=>{n.get("add")==="1"&&r(k=>{const T=new URLSearchParams(k);return T.delete("add"),T},{replace:!0})},[r,n]);const v=(s==null?void 0:s.name)??"Network",b=(s==null?void 0:s.humans.length)??0,_=(o==null?void 0:o.length)??0,S=v.slice(0,2).toUpperCase();return m.jsxs("div",{className:"flex h-screen flex-col",children:[m.jsxs("div",{className:"drag-region flex items-center gap-3 border-b px-3 py-1",children:[m.jsx(n2,{}),m.jsx(Rt,{variant:"ghost",size:"sm",className:"no-drag text-muted-foreground",onClick:()=>t(`/${e}`),children:m.jsx(MH,{className:"size-3.5"})}),m.jsx("span",{className:"text-sm font-medium",children:"Settings"}),m.jsx("div",{className:"flex-1"})]}),m.jsxs(mve,{value:g,onValueChange:y,orientation:"vertical",className:"min-h-0 flex-1 gap-0",children:[m.jsxs("aside",{className:"flex w-52 shrink-0 flex-col gap-4 border-r p-3",children:[m.jsxs("div",{className:"flex items-center gap-3 px-1 pt-1",children:[m.jsx(_3,{children:m.jsx(S3,{className:"bg-primary/10 text-primary font-medium",children:S})}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:"truncate text-sm font-semibold",children:v}),m.jsxs(gr,{className:"text-xs",children:[b," ",b===1?"member":"members"]})]})]}),m.jsxs(gve,{variant:"line",className:"w-full gap-1",children:[m.jsxs(O7,{value:"members",children:[m.jsx(_I,{}),"Members"]}),m.jsxs(O7,{value:"billing",children:[m.jsx(iYe,{}),"Plan & Billing"]})]})]}),m.jsxs(bd,{className:"min-h-0 flex-1",children:[m.jsxs(D7,{value:"members",className:"p-4",children:[m.jsx(ZD,{title:"Members",description:"People with access to this network.",count:b,action:c?m.jsxs(Rt,{size:"sm",className:"shrink-0",onClick:()=>f(!0),children:[m.jsx(QL,{className:"mr-1 size-3.5"}),"Add members"]}):void 0}),m.jsx(vT,{children:s==null?void 0:s.humans.map((k,T)=>{const E=k.id===s.admin_human.id,C=c&&!E&&k.id!==(l==null?void 0:l.id);return m.jsxs("div",{children:[m.jsx(_6t,{human:k,isAdmin:E,onRemove:C?()=>d(k):void 0}),T<s.humans.length-1&&m.jsx(Gi,{className:"mx-4"})]},k.id)})}),c&&m.jsxs("div",{className:"mt-6",children:[m.jsx(ZD,{title:"Pending invitations",description:"Invites that haven't been accepted yet.",count:_>0?_:void 0}),a?m.jsx(vT,{children:m.jsx("p",{className:"text-muted-foreground px-4 py-3 text-xs",children:"Couldn't load pending invitations."})}):o&&o.length>0?m.jsx(vT,{children:o.map((k,T)=>m.jsxs("div",{children:[m.jsx(S6t,{email:k.email,networkId:e}),T<o.length-1&&m.jsx(Gi,{className:"mx-4"})]},k.email))}):m.jsx(gr,{className:"text-xs",children:"No pending invitations."})]})]}),m.jsxs(D7,{value:"billing",className:"p-4",children:[m.jsx(ZD,{title:"Plan & Billing",description:c?"Manage your plan, seats, and payment.":"Your network's current plan and usage."}),m.jsx(vT,{children:m.jsx(y6t,{networkId:e})})]})]})]}),c&&m.jsx(x6t,{networkId:e,open:h,onOpenChange:f}),u&&m.jsx(EEe,{title:`Remove ${u.email_prefix}?`,description:m.jsxs("ul",{className:"list-disc space-y-1 pl-4",children:[m.jsx("li",{children:"They'll lose access to this network's streams and files within seconds."}),m.jsx("li",{children:"Any content they posted stays in the network."}),m.jsx("li",{children:"If they're in a live huddle, they may remain until the call ends."})]}),confirmLabel:"Remove",pendingLabel:"Removing…",isPending:p.isPending,onConfirm:()=>{const k=u;p.mutate(k.id,{onSuccess:()=>{Hn.success(`Removed ${k.email}`),d(null)}})},onClose:()=>{p.isPending||d(null)}})]})}const C6t=({...t})=>m.jsx(gXe,{theme:"dark",className:"toaster group",icons:{success:m.jsx(Pye,{className:"size-4"}),info:m.jsx(Bye,{className:"size-4"}),warning:m.jsx(Uye,{className:"size-4"}),error:m.jsx(MYe,{className:"size-4"}),loading:m.jsx(xI,{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"}},...t});function E6t(t,e){if(e instanceof qw){if(e.status===408||e.status===429)return t<2;if(e.status>=400&&e.status<500)return!1}return t<2}function T6t(){return new LZe({defaultOptions:{queries:{retry:E6t,refetchOnWindowFocus:!1},mutations:{retry:0}},queryCache:new sve({onError:(t,e)=>{var n;Zi(t,{scope:"query",queryKey:e.queryKey}),(n=e.meta)!=null&&n.toastOnError&&Hn.error(zm(t))}}),mutationCache:new ive({onError:(t,e,n,r)=>{var i;tI(t,{scope:"mutation",mutationKey:r.options.mutationKey}),!((i=r.meta)!=null&&i.suppressToast)&&Hn.error(zm(t))}})})}const A6t="/assets/click-DQL6Qv2e.mp3",jEe={click:A6t},I6t={click:{volume:.7,pitchVariance:.04},"key-tap":{volume:.4,pitchVariance:.08,throttleMs:25},"key-action":{volume:.6,pitchVariance:.04},submit:{volume:.85,pitchVariance:.02},error:{volume:.7,pitchVariance:0},open:{volume:.6,pitchVariance:.03},close:{volume:.5,pitchVariance:.03}},R6t="click";let Rae=!1;function M6t(){if(!Rae){Rae=!0;for(const[t,e]of Object.entries(jEe))e&&P7.preload(t,e)}}function XD(t,e){const n=I6t[t],r=jEe[t]?t:R6t;P7.play(r,{...n,...e})}function N6t({children:t}){return x.useEffect(()=>{M6t()},[]),x.useEffect(()=>{const e=n=>{n.button===0&&n.target instanceof Element&&D6t(n.target)&&XD("click")};return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[]),x.useEffect(()=>{const e=n=>{n.repeat||P6t(n.key)||L6t(n.target)||(n.key==="Escape"||n.key==="Enter"||n.key==="Tab"?XD("key-action"):XD("key-tap"))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),t}const O6t=new Set(["button","link","menuitem","menuitemcheckbox","menuitemradio","tab","switch","checkbox","radio","option"]);function D6t(t){let n=t;for(let r=0;n&&r<6;r++,n=n.parentElement){const i=n.tagName;if(i==="BUTTON"||i==="A"||i==="SUMMARY")return!0;const s=n.getAttribute("role");if(s&&O6t.has(s)||window.getComputedStyle(n).cursor==="pointer")return!0}return!1}function P6t(t){return t==="Shift"||t==="Control"||t==="Meta"||t==="Alt"}function L6t(t){if(!(t instanceof HTMLElement))return!1;const e=t.tagName;if(e==="TEXTAREA")return!0;if(e==="INPUT"){const n=t.type;return n===""||n==="text"||n==="search"||n==="email"||n==="url"||n==="password"||n==="tel"||n==="number"}return!!t.isContentEditable}function z6t({payload:t,onDismiss:e,onNavigate:n,onEnded:r}){const i=x.useRef(null),s=t.mimeType.startsWith("video/"),o=()=>{var l;(l=i.current)==null||l.pause(),n()},a=l=>{var c;l.stopPropagation(),(c=i.current)==null||c.pause(),e()};return m.jsx("div",{className:"relative h-full w-full cursor-pointer overflow-hidden bg-black",onClick:o,children:s?m.jsxs(m.Fragment,{children:[m.jsx("video",{ref:i,src:t.downloadUrl,autoPlay:!0,playsInline:!0,onEnded:r,className:"block h-full w-full object-cover"},t.particleId),m.jsx("button",{className:"absolute top-1 right-1 z-10 rounded-full bg-black/50 p-0.5 text-white hover:bg-black/70",onClick:a,children:m.jsx(Zc,{className:"size-3.5"})}),m.jsxs("div",{className:"absolute inset-x-0 bottom-0 flex items-center gap-2 bg-gradient-to-t from-black/60 to-transparent px-3 py-2",children:[m.jsx("div",{className:"flex size-6 shrink-0 items-center justify-center rounded-full bg-white/20 text-[10px] font-medium text-white",children:t.senderInitials}),m.jsx("p",{className:"truncate text-xs text-white/80",children:t.senderName})]})]}):m.jsxs(m.Fragment,{children:[m.jsx("button",{className:"absolute top-1 right-1 z-10 rounded-full bg-black/50 p-0.5 text-white hover:bg-black/70",onClick:a,children:m.jsx(Zc,{className:"size-3.5"})}),m.jsxs("div",{className:"flex h-full w-full items-center gap-2 bg-card px-3 py-3",children:[m.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium text-primary",children:t.senderInitials}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:"truncate text-sm font-medium text-card-foreground",children:t.senderName}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"Playing audio..."})]})]}),m.jsx("audio",{ref:i,src:t.downloadUrl,autoPlay:!0,onEnded:r},t.particleId)]})})}function j6t(){const t=Ru(o=>o.payload),e=Ru(o=>o.setPayload),n=Ru(o=>o.setPendingNav),r=x.useCallback(()=>e(null),[e]),i=x.useCallback(()=>{t&&(e(null),n({networkId:t.networkId,streamId:t.streamId}))},[t,e,n]);if(!t)return null;const s=t.mimeType.startsWith("video/");return m.jsx("div",{className:"fixed bottom-4 right-4 z-50 w-80 overflow-hidden rounded-lg shadow-lg",style:{height:s?180:64},children:m.jsx(z6t,{payload:t,onDismiss:r,onNavigate:i,onEnded:r})})}const B6t=T6t(),F6t=()=>{const t=Dn(n=>n.status),e=Dn(n=>n.restoreSession);return x.useEffect(()=>{e()},[e]),t==="idle"||t==="restoring"?m.jsx("div",{className:"flex min-h-screen items-center justify-center",children:m.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading..."})}):t!=="authenticated"?m.jsx(fZe,{}):m.jsx(vTt,{children:m.jsx(H6t,{})})};function V6t(){const t=oo();return x.useEffect(()=>(cr.deepLink.getPending().then(e=>{e&&t(e)}).catch(e=>{Zi(e,{scope:"deepLink.getPending"})}),cr.deepLink.onNavigate(e=>t(e))),[t]),null}function $6t(){const t=oo();return x.useEffect(()=>cr.autoplay.onNavigate(e=>{t(`/${e.networkId}/${e.streamId}`)}),[t]),null}function H6t(){return m.jsxs(S9e,{children:[m.jsx($6t,{}),m.jsx(V6t,{}),m.jsx(j6t,{}),m.jsx(LEe,{children:m.jsxs(V8e,{children:[m.jsx(eh,{path:"settings",element:m.jsx(CXe,{})}),m.jsx(eh,{path:"settings/audio-video",element:m.jsx(BXe,{})}),m.jsxs(eh,{path:"/",children:[m.jsx(eh,{index:!0,element:m.jsx(Aae,{children:m.jsx(YXe,{})})}),m.jsxs(eh,{path:":networkId",children:[m.jsx(eh,{index:!0,element:m.jsx(Aae,{children:m.jsx(AEt,{})})}),m.jsx(eh,{path:"settings",element:m.jsx(k6t,{})}),m.jsx(eh,{path:"*",element:m.jsx(KTt,{})})]})]})]})})]})}const U6t=()=>m.jsx(r6t,{children:m.jsx(sLe,{children:m.jsx(zZe,{client:B6t,children:m.jsxs(N6t,{children:[m.jsx(F6t,{}),m.jsx(C6t,{})]})})})}),Wt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Pn=globalThis,S1="10.54.0";function sM(){return oM(Pn),Pn}function oM(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||S1,e[S1]=e[S1]||{}}function A2(t,e,n=Pn){const r=n.__SENTRY__=n.__SENTRY__||{},i=r[S1]=r[S1]||{};return i[t]||(i[t]=e())}const q6t=["debug","info","warn","error","log","assert","trace"],W6t="Sentry Logger ",Y8={};function I2(t){if(!("console"in Pn))return t();const e=Pn.console,n={},r=Object.keys(Y8);r.forEach(i=>{const s=Y8[i];n[i]=e[i],e[i]=s});try{return t()}finally{r.forEach(i=>{e[i]=n[i]})}}function G6t(){yK().enabled=!0}function K6t(){yK().enabled=!1}function BEe(){return yK().enabled}function Y6t(...t){gK("log",...t)}function Z6t(...t){gK("warn",...t)}function X6t(...t){gK("error",...t)}function gK(t,...e){Wt&&BEe()&&I2(()=>{Pn.console[t](`${W6t}[${t}]:`,...e)})}function yK(){return Wt?A2("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const Dt={enable:G6t,disable:K6t,isEnabled:BEe,log:Y6t,warn:Z6t,error:X6t},FEe=50,dy="?",Mae=/\(error: (.*)\)/,Nae=/captureMessage|captureException/;function VEe(...t){const e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,i=0)=>{const s=[],o=n.split(`
|
||
`);for(let a=r;a<o.length;a++){let l=o[a];l.length>1024&&(l=l.slice(0,1024));const c=Mae.test(l)?l.replace(Mae,"$1"):l;if(!c.includes("Error: ")){for(const u of e){const d=u(c);if(d){s.push(d);break}}if(s.length>=FEe+i)break}}return J6t(s.slice(i))}}function Q6t(t){return Array.isArray(t)?VEe(...t):t}function J6t(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(bT(e).function||"")&&e.pop(),e.reverse(),Nae.test(bT(e).function||"")&&(e.pop(),Nae.test(bT(e).function||"")&&e.pop()),e.slice(0,FEe).map(n=>({...n,filename:n.filename||bT(e).filename,function:n.function||dy}))}function bT(t){return t[t.length-1]||{}}const QD="<anonymous>";function l0(t){try{return!t||typeof t!="function"?QD:t.name||QD}catch{return QD}}function Oae(t){const e=t.exception;if(e){const n=[];try{return e.values.forEach(r=>{r.stacktrace.frames&&n.push(...r.stacktrace.frames)}),n}catch{return}}}function $Ee(t){return"__v_isVNode"in t&&t.__v_isVNode?"[VueVNode]":"[VueViewModel]"}const u_={},Dae={};function zy(t,e){return u_[t]=u_[t]||[],u_[t].push(e),()=>{const n=u_[t];if(n){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}}}function jy(t,e){if(!Dae[t]){Dae[t]=!0;try{e()}catch(n){Wt&&Dt.error(`Error while instrumenting ${t}`,n)}}}function qc(t,e){const n=t&&u_[t];if(n)for(const r of n)try{r(e)}catch(i){Wt&&Dt.error(`Error while triggering instrumentation handler.
|
||
Type: ${t}
|
||
Name: ${l0(r)}
|
||
Error:`,i)}}let JD=null;function eAt(t){const e="error";zy(e,t),jy(e,tAt)}function tAt(){JD=Pn.onerror,Pn.onerror=function(t,e,n,r,i){return qc("error",{column:r,error:i,line:n,msg:t,url:e}),JD?JD.apply(this,arguments):!1},Pn.onerror.__SENTRY_INSTRUMENTED__=!0}let eP=null;function nAt(t){const e="unhandledrejection";zy(e,t),jy(e,rAt)}function rAt(){eP=Pn.onunhandledrejection,Pn.onunhandledrejection=function(t){return qc("unhandledrejection",t),eP?eP.apply(this,arguments):!0},Pn.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const HEe=Object.prototype.toString;function aM(t){switch(HEe.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return c0(t,Error)}}function R2(t,e){return HEe.call(t)===`[object ${e}]`}function UEe(t){return R2(t,"ErrorEvent")}function Pae(t){return R2(t,"DOMError")}function iAt(t){return R2(t,"DOMException")}function Gh(t){return R2(t,"String")}function vK(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function lM(t){return t===null||vK(t)||typeof t!="object"&&typeof t!="function"}function Vk(t){return R2(t,"Object")}function cM(t){return typeof Event<"u"&&c0(t,Event)}function sAt(t){return typeof Element<"u"&&c0(t,Element)}function oAt(t){return R2(t,"RegExp")}function gC(t){return!!(t!=null&&t.then&&typeof t.then=="function")}function aAt(t){return Vk(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function c0(t,e){try{return t instanceof e}catch{return!1}}function qEe(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue||t.__v_isVNode))}function WEe(t){return typeof Request<"u"&&c0(t,Request)}const bK=Pn,lAt=80;function GEe(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,i=[];let s=0,o=0;const a=" > ",l=a.length;let c;const u=Array.isArray(e)?e:e.keyAttrs,d=!Array.isArray(e)&&e.maxStringLength||lAt;for(;n&&s++<r&&(c=cAt(n,u),!(c==="html"||s>1&&o+i.length*l+c.length>=d));)i.push(c),o+=c.length,n=n.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function cAt(t,e){const n=t,r=[];if(!(n!=null&&n.tagName))return"";if(bK.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const i=e!=null&&e.length?e.filter(s=>n.getAttribute(s)).map(s=>[s,n.getAttribute(s)]):null;if(i!=null&&i.length)i.forEach(s=>{r.push(`[${s[0]}="${s[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const s=n.className;if(s&&Gh(s)){const o=s.split(/\s+/);for(const a of o)r.push(`.${a}`)}}for(const s of["aria-label","type","name","title","alt"]){const o=n.getAttribute(s);o&&r.push(`[${s}="${o}"]`)}return r.join("")}function wK(){try{return bK.document.location.href}catch{return""}}function uAt(t,e=5){if(!bK.HTMLElement)return null;let n=t;for(let r=0;r<e;r++){if(!n)return null;if(n instanceof HTMLElement){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}n=n.parentNode}return null}function Wa(t,e,n){if(!(e in t))return;const r=t[e];if(typeof r!="function")return;const i=n(r);typeof i=="function"&&KEe(i,r);try{t[e]=i}catch{Wt&&Dt.log(`Failed to replace method "${e}" in object`,t)}}function u0(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{Wt&&Dt.log(`Failed to add non-enumerable property "${String(e)}" to object`,t)}}function KEe(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,u0(t,"__sentry_original__",e)}catch{}}function xK(t){return t.__sentry_original__}function YEe(t){if(aM(t))return{message:t.message,name:t.name,stack:t.stack,...zae(t)};if(cM(t)){const e={type:t.type,target:Lae(t.target),currentTarget:Lae(t.currentTarget),...zae(t)};return typeof CustomEvent<"u"&&c0(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Lae(t){try{return sAt(t)?GEe(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function zae(t){return typeof t=="object"&&t!==null?Object.fromEntries(Object.entries(t)):{}}function dAt(t){const e=Object.keys(YEe(t));return e.sort(),e[0]?e.join(", "):"[object has no keys]"}let iv;function uM(t){if(iv!==void 0)return iv?iv(t):t();const e=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=Pn;return e in n&&typeof n[e]=="function"?(iv=n[e],iv(t)):(iv=null,t())}function Z8(){return uM(()=>Math.random())}function dM(){return uM(()=>Date.now())}function vF(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function jae(t,e){if(!Array.isArray(t))return"";const n=[];for(let r=0;r<t.length;r++){const i=t[r];try{qEe(i)?n.push($Ee(i)):n.push(String(i))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function pS(t,e,n=!1){return Gh(t)?oAt(e)?e.test(t):Gh(e)?n?t===e:t.includes(e):typeof e=="function"?e(t):!1:!1}function yC(t,e=[],n=!1){for(const r of e)if(pS(t,r,n))return!0;return!1}function hAt(){const t=Pn;return t.crypto||t.msCrypto}let tP;function fAt(){return Z8()*16}function Yl(t=hAt()){try{if(t!=null&&t.randomUUID)return uM(()=>t.randomUUID()).replace(/-/g,"")}catch{}return tP||(tP="10000000100040008000"+1e11),tP.replace(/[018]/g,e=>(e^(fAt()&15)>>e/4).toString(16))}function ZEe(t){var e,n;return(n=(e=t.exception)==null?void 0:e.values)==null?void 0:n[0]}function Sg(t){const{message:e,event_id:n}=t;if(e)return e;const r=ZEe(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function bF(t,e,n){const r=t.exception=t.exception||{},i=r.values=r.values||[],s=i[0]=i[0]||{};s.value||(s.value=e||""),s.type||(s.type="Error")}function k1(t,e){const n=ZEe(t);if(!n)return;const r={type:"generic",handled:!0},i=n.mechanism;if(n.mechanism={...r,...i,...e},e&&"data"in e){const s={...i==null?void 0:i.data,...e.data};n.mechanism.data=s}}function Bae(t){if(pAt(t))return!0;try{u0(t,"__sentry_captured__",!0)}catch{}return!1}function pAt(t){try{return t.__sentry_captured__}catch{}}const XEe=1e3;function vC(){return dM()/XEe}function mAt(){const{performance:t}=Pn;if(!(t!=null&&t.now)||!t.timeOrigin)return vC;const e=t.timeOrigin;return()=>(e+uM(()=>t.now()))/XEe}let Fae;function Kh(){return(Fae??(Fae=mAt()))()}function gAt(t){const e=Kh(),n={sid:Yl(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>vAt(n)};return t&&Ex(n,t),n}function Ex(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Kh(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:Yl()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function yAt(t,e){let n={};t.status==="ok"&&(n={status:"exited"}),Ex(t,n)}function vAt(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function bC(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&Object.keys(e).length===0)return t;const r={...t};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=bC(r[i],e[i],n-1));return r}function Vae(){return Yl()}function QEe(){return Yl().substring(16)}const wF="_sentrySpan";function $ae(t,e){e?u0(t,wF,e):delete t[wF]}function Hae(t){return t[wF]}const bAt=100;class Sd{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Vae(),sampleRand:Z8()}}clone(){const e=new Sd;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._attributes={...this._attributes},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,e._conversationId=this._conversationId,$ae(e,Hae(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Ex(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this.setTags({[e]:n})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,n){return this.setAttributes({[e]:n})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const n=typeof e=="function"?e(this):e,r=n instanceof Sd?n.getScopeData():Vk(n)?e:void 0,{tags:i,attributes:s,extra:o,user:a,contexts:l,level:c,fingerprint:u=[],propagationContext:d,conversationId:h}=r||{};return this._tags={...this._tags,...i},this._attributes={...this._attributes,...s},this._extra={...this._extra,...o},this._contexts={...this._contexts,...l},a&&Object.keys(a).length&&(this._user=a),c&&(this._level=c),u.length&&(this._fingerprint=u),d&&(this._propagationContext=d),h&&(this._conversationId=h),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,$ae(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Vae(),sampleRand:Z8()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){var s;const r=typeof n=="number"?n:bAt;if(r<=0)return this;const i={timestamp:vC(),...e,message:e.message?vF(e.message,2048):e.message};return this._breadcrumbs.push(i),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),(s=this._client)==null||s.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Hae(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=bC(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=(n==null?void 0:n.event_id)||Yl();if(!this._client)return Wt&&Dt.warn("No client configured on scope - will not capture exception!"),r;const i=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureMessage(e,n,r){const i=(r==null?void 0:r.event_id)||Yl();if(!this._client)return Wt&&Dt.warn("No client configured on scope - will not capture message!"),i;const s=(r==null?void 0:r.syntheticException)??new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:s,...r,event_id:i},this),i}captureEvent(e,n){const r=e.event_id||(n==null?void 0:n.event_id)||Yl();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(Wt&&Dt.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function wAt(){return A2("defaultCurrentScope",()=>new Sd)}function xAt(){return A2("defaultIsolationScope",()=>new Sd)}const Uae=t=>t instanceof Promise&&!t[JEe],JEe=Symbol("chained PromiseLike"),_At=(t,e,n)=>{const r=t.then(i=>(e(i),i),i=>{throw n(i),i});return Uae(r)&&Uae(t)?r:SAt(t,r)},SAt=(t,e)=>{if(!e)return t;let n=!1;for(const r in t){if(r in e)continue;n=!0;const i=t[r];typeof i=="function"?Object.defineProperty(e,r,{value:(...s)=>i.apply(t,s),enumerable:!0,configurable:!0,writable:!0}):e[r]=i}return n&&Object.assign(e,{[JEe]:!0}),e};class kAt{constructor(e,n){let r;e?r=e:r=new Sd;let i;n?i=n:i=new Sd,this._stack=[{scope:r}],this._isolationScope=i}withScope(e){const n=this._pushScope();let r;try{r=e(n)}catch(i){throw this._popScope(),i}return gC(r)?_At(r,()=>this._popScope(),()=>this._popScope()):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function Tx(){const t=sM(),e=oM(t);return e.stack=e.stack||new kAt(wAt(),xAt())}function CAt(t){return Tx().withScope(t)}function EAt(t,e){const n=Tx();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function qae(t){return Tx().withScope(()=>t(Tx().getIsolationScope()))}function TAt(){return{withIsolationScope:qae,withScope:CAt,withSetScope:EAt,withSetIsolationScope:(t,e)=>qae(e),getCurrentScope:()=>Tx().getScope(),getIsolationScope:()=>Tx().getIsolationScope()}}function _K(t){const e=oM(t);return e.acs?e.acs:TAt()}function AAt(t){return typeof t=="object"&&t!=null&&!Array.isArray(t)&&Object.keys(t).includes("value")}function IAt(t,e){const{value:n,unit:r}=AAt(t)?t:{value:t,unit:void 0},i=RAt(n),s=r&&typeof r=="string"?{unit:r}:{};if(i)return{...i,...s};if(!e||e==="skip-undefined"&&n===void 0)return;let o="";try{o=JSON.stringify(n)??""}catch{}return{value:o,type:"string",...s}}function Wae(t,e=!1){const n={};for(const[r,i]of Object.entries(t??{})){const s=IAt(i,e);s&&(n[r]=s)}return n}function RAt(t){if(Array.isArray(t))return{value:t,type:"array"};const e=typeof t=="string"?"string":typeof t=="boolean"?"boolean":typeof t=="number"&&!Number.isNaN(t)?Number.isInteger(t)?"integer":"double":null;if(e)return{value:t,type:e}}function Pf(){const t=sM();return _K(t).getCurrentScope()}function L0(){const t=sM();return _K(t).getIsolationScope()}function MAt(){return A2("globalScope",()=>new Sd)}function NAt(...t){const e=sM(),n=_K(e);if(t.length===2){const[r,i]=t;return r?n.withSetScope(r,i):n.withScope(i)}return n.withScope(t[0])}function ho(){return Pf().getClient()}function OAt(t){const e=t.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:i}=e,s={trace_id:n,span_id:i||QEe()};return r&&(s.parent_span_id=r),s}const DAt="sentry.source",PAt="sentry.sample_rate",LAt="sentry.previous_trace_sample_rate",zAt="sentry.op",jAt="sentry.origin",eTe="sentry.profile_id",tTe="sentry.exclusive_time",BAt="gen_ai.conversation.id",FAt=0,VAt=1;function $At(t){if(t){if(typeof t=="object"&&"deref"in t&&typeof t.deref=="function")try{return t.deref()}catch{return}return t}}const HAt="_sentryScope",UAt="_sentryIsolationScope";function nTe(t){const e=t;return{scope:e[HAt],isolationScope:$At(e[UAt])}}const Gae="sentry-";function qAt(t){const e=WAt(t);if(!e)return;const n=Object.entries(e).reduce((r,[i,s])=>{if(i.startsWith(Gae)){const o=i.slice(Gae.length);r[o]=s}return r},{});if(Object.keys(n).length>0)return n}function WAt(t){if(!(!t||!Gh(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{const r=Kae(n);return Object.entries(r).forEach(([i,s])=>{e[i]=s}),e},{}):Kae(t)}function Kae(t){return t.split(",").map(e=>{const n=e.indexOf("=");if(n===-1)return[];const r=e.slice(0,n),i=e.slice(n+1);return[r,i].map(s=>{try{return decodeURIComponent(s.trim())}catch{return}})}).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}const GAt=/^o(\d+)\./,KAt=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function YAt(t){return t==="http"||t==="https"}function wC(t,e=!1){const{host:n,path:r,pass:i,port:s,projectId:o,protocol:a,publicKey:l}=t;return`${a}://${l}${e&&i?`:${i}`:""}@${n}${s?`:${s}`:""}/${r&&`${r}/`}${o}`}function ZAt(t){const e=KAt.exec(t);if(!e){I2(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}const[n,r,i="",s="",o="",a=""]=e.slice(1);let l="",c=a;const u=c.split("/");if(u.length>1&&(l=u.slice(0,-1).join("/"),c=u.pop()),c){const d=c.match(/^\d+/);d&&(c=d[0])}return rTe({host:s,pass:i,path:l,projectId:c,port:o,protocol:n,publicKey:r})}function rTe(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function XAt(t){if(!Wt)return!0;const{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(o=>t[o]?!1:(Dt.error(`Invalid Sentry Dsn: ${o} missing`),!0))?!1:n.match(/^\d+$/)?YAt(r)?e&&isNaN(parseInt(e,10))?(Dt.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(Dt.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(Dt.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function QAt(t){const e=t.match(GAt);return e==null?void 0:e[1]}function JAt(t){const e=t.getOptions(),{host:n}=t.getDsn()||{};let r;return e.orgId?r=String(e.orgId):n&&(r=QAt(n)),r}function e7t(t){const e=typeof t=="string"?ZAt(t):rTe(t);if(!(!e||!XAt(e)))return e}function t7t(t){if(typeof t=="boolean")return Number(t);const e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}const iTe=1;let Yae=!1;function n7t(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext(),i=r?e:hM(t).parent_span_id,s=nTe(t).scope,o=r?(s==null?void 0:s.getPropagationContext().propagationSpanId)||QEe():e;return{parent_span_id:i,span_id:o,trace_id:n}}function r7t(t){if(t&&t.length>0)return t.map(({context:{spanId:e,traceId:n,traceFlags:r,...i},attributes:s})=>({span_id:e,trace_id:n,sampled:r===iTe,attributes:s,...i}))}function Zae(t){return typeof t=="number"?Xae(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Xae(t.getTime()):Kh()}function Xae(t){return t>9999999999?t/1e3:t}function hM(t){if(a7t(t))return t.getSpanJSON();const{spanId:e,traceId:n}=t.spanContext();if(o7t(t)){const{attributes:r,startTime:i,name:s,endTime:o,status:a,links:l}=t;return{span_id:e,trace_id:n,data:r,description:s,parent_span_id:i7t(t),start_timestamp:Zae(i),timestamp:Zae(o)||void 0,status:c7t(a),op:r[zAt],origin:r[jAt],links:r7t(l)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function i7t(t){var e;return"parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?(e=t.parentSpanContext)==null?void 0:e.spanId:void 0}function s7t(t){var e;return{...t,attributes:Wae(t.attributes),links:(e=t.links)==null?void 0:e.map(n=>({...n,attributes:Wae(n.attributes)}))}}function o7t(t){const e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function a7t(t){return typeof t.getSpanJSON=="function"}function l7t(t){const{traceFlags:e}=t.spanContext();return e===iTe}function c7t(t){if(!(!t||t.code===FAt))return t.code===VAt?"ok":t.message||"internal_error"}const u7t="_sentryRootSpan",sTe=d7t;function d7t(t){return t[u7t]||t}function Qae(){Yae||(I2(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),Yae=!0)}function h7t(t){var n;if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=(n=ho())==null?void 0:n.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}function Jae(t){Dt.log(`Ignoring span ${t.op} - ${t.description} because it matches \`ignoreSpans\`.`)}function ele(t,e){if(!(e!=null&&e.length))return!1;for(const n of e){if(m7t(n)){if(t.description&&pS(t.description,n))return Wt&&Jae(t),!0;continue}const r=!!n.attributes&&Object.keys(n.attributes).length>0;if(!n.name&&!n.op&&!r)continue;const i=n.name?t.description&&pS(t.description,n.name):!0,s=n.op?t.op&&pS(t.op,n.op):!0,o=n.attributes?Object.entries(n.attributes).every(([a,l])=>{var c;return f7t((c=t.attributes)==null?void 0:c[a],l)}):!0;if(i&&s&&o)return Wt&&Jae(t),!0}return!1}function f7t(t,e){return typeof t=="string"&&(typeof e=="string"||e instanceof RegExp)?pS(t,e):Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every((n,r)=>n===e[r]):t===e}function p7t(t,e){const n=e.parent_span_id,r=e.span_id;if(n)for(const i of t)i.parent_span_id===r&&(i.parent_span_id=n)}function m7t(t){return typeof t=="string"||t instanceof RegExp}const SK="production",g7t="_frozenDsc";function oTe(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},i={environment:n.environment||SK,release:n.release,public_key:r,trace_id:t,org_id:JAt(e)};return e.emit("createDsc",i),i}function y7t(t,e){const n=e.getPropagationContext();return n.dsc||oTe(n.traceId,t)}function v7t(t){var p;const e=ho();if(!e)return{};const n=sTe(t),r=hM(n),i=r.data,s=n.spanContext().traceState,o=(s==null?void 0:s.get("sentry.sample_rate"))??i[PAt]??i[LAt];function a(g){return(typeof o=="number"||typeof o=="string")&&(g.sample_rate=`${o}`),g}const l=n[g7t];if(l)return a(l);const c=s==null?void 0:s.get("sentry.dsc"),u=c&&qAt(c);if(u)return a(u);const d=oTe(t.spanContext().traceId,e),h=i[DAt]??i["sentry.span.source"],f=r.description;return h!=="url"&&f&&(d.transaction=f),h7t()&&(d.sampled=String(l7t(n)),d.sample_rand=(s==null?void 0:s.get("sentry.sample_rand"))??((p=nTe(n).scope)==null?void 0:p.getPropagationContext().sampleRand.toString())),a(d),e.emit("createDsc",d,n),d}function b7t(t){return!!t&&typeof t=="function"&&"_streamed"in t&&!!t._streamed}const w7t=Symbol.for("sentry.skipNormalization"),x7t=Symbol.for("sentry.overrideNormalizationDepth");function _7t(t){return!!t[w7t]}function S7t(t){const e=t[x7t];return typeof e=="number"?e:void 0}function oh(t,e=100,n=1/0){try{return xF("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function aTe(t,e=3,n=100*1024){const r=oh(t,e);return T7t(r)>n?aTe(t,e-1,n):r}function xF(t,e,n=1/0,r=1/0,i=A7t()){const[s,o]=i;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const a=k7t(t,e);if(!a.startsWith("[object "))return a;if(_7t(e))return e;const l=S7t(e),c=l!==void 0?l:n;if(c===0)return a.replace("object ","");if(s(e))return"[Circular ~]";const u=e;if(u&&typeof u.toJSON=="function")try{const p=u.toJSON();return xF("",p,c-1,r,i)}catch{}const d=Array.isArray(e)?[]:{};let h=0;const f=YEe(e);for(const p in f){if(!Object.prototype.hasOwnProperty.call(f,p))continue;if(h>=r){d[p]="[MaxProperties ~]";break}const g=f[p];d[p]=xF(p,g,c-1,r,i),h++}return o(e),d}function k7t(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(qEe(e))return $Ee(e);if(aAt(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${l0(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const n=C7t(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function C7t(t){const e=Object.getPrototypeOf(t);return e!=null&&e.constructor?e.constructor.name:"null prototype"}function E7t(t){return~-encodeURI(t).split(/%..|./).length}function T7t(t){return E7t(JSON.stringify(t))}function A7t(){const t=new WeakSet;function e(r){return t.has(r)?!0:(t.add(r),!1)}function n(r){t.delete(r)}return[e,n]}function M2(t,e=[]){return[t,e]}function tle(t,e){const[n,r]=t;return[n,[...r,e]]}function _F(t,e){const n=t[1];for(const r of n){const i=r[0].type;if(e(r,i))return!0}return!1}function I7t(t,e){return _F(t,(n,r)=>e.includes(r))}function SF(t){const e=oM(Pn);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function R7t(t){const[e,n]=t;let r=JSON.stringify(e);function i(s){typeof r=="string"?r=typeof s=="string"?r+s:[SF(r),s]:r.push(typeof s=="string"?SF(s):s)}for(const s of n){const[o,a]=s;if(i(`
|
||
${JSON.stringify(o)}
|
||
`),typeof a=="string"||a instanceof Uint8Array)i(a);else{let l;try{l=JSON.stringify(a)}catch{l=JSON.stringify(oh(a))}i(l)}}return typeof r=="string"?r:M7t(r)}function M7t(t){const e=t.reduce((i,s)=>i+s.length,0),n=new Uint8Array(e);let r=0;for(const i of t)n.set(i,r),r+=i.length;return n}function N7t(t){const e=typeof t.data=="string"?SF(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}const lTe={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function O7t(t){return t in lTe}function nle(t){return O7t(t)?lTe[t]:t}function cTe(t){if(!(t!=null&&t.sdk))return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function D7t(t,e,n,r){var s;const i=(s=t.sdkProcessingMetadata)==null?void 0:s.dynamicSamplingContext;return{event_id:t.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:wC(r)},...i&&{trace:i}}}function P7t(t,e){var r,i,s,o;if(!e)return t;const n=t.sdk||{};return t.sdk={...n,name:n.name||e.name,version:n.version||e.version,integrations:[...((r=t.sdk)==null?void 0:r.integrations)||[],...e.integrations||[]],packages:[...((i=t.sdk)==null?void 0:i.packages)||[],...e.packages||[]],settings:(s=t.sdk)!=null&&s.settings||e.settings?{...(o=t.sdk)==null?void 0:o.settings,...e.settings}:void 0},t}function L7t(t,e,n,r){const i=cTe(n),s={sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&e&&{dsn:wC(e)}},o="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return M2(s,[o])}function z7t(t,e,n,r){const i=cTe(n),s=t.type&&t.type!=="replay_event"?t.type:"event";P7t(t,n==null?void 0:n.sdk);const o=D7t(t,i,r,e);return delete t.sdkProcessingMetadata,M2(o,[[{type:s},t]])}function j7t(t){return t.getOptions().traceLifecycle==="stream"}function B7t(t,e){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:s}=e;F7t(t,e),r&&H7t(t,r),U7t(t,n),V7t(t,i),$7t(t,s)}function rle(t,e){const{extra:n,tags:r,attributes:i,user:s,contexts:o,level:a,sdkProcessingMetadata:l,breadcrumbs:c,fingerprint:u,eventProcessors:d,attachments:h,propagationContext:f,transactionName:p,span:g}=e;h4(t,"extra",n),h4(t,"tags",r),h4(t,"attributes",i),h4(t,"user",s),h4(t,"contexts",o),t.sdkProcessingMetadata=bC(t.sdkProcessingMetadata,l,2),a&&(t.level=a),p&&(t.transactionName=p),g&&(t.span=g),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),u.length&&(t.fingerprint=[...t.fingerprint,...u]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),h.length&&(t.attachments=[...t.attachments,...h]),t.propagationContext={...t.propagationContext,...f}}function h4(t,e,n){t[e]=bC(t[e],n,1)}function uTe(t,e){const n=MAt().getScopeData();return t&&rle(n,t.getScopeData()),e&&rle(n,e.getScopeData()),n}function F7t(t,e){const{extra:n,tags:r,user:i,contexts:s,level:o,transactionName:a}=e;Object.keys(n).length&&(t.extra={...n,...t.extra}),Object.keys(r).length&&(t.tags={...r,...t.tags}),Object.keys(i).length&&(t.user={...i,...t.user}),Object.keys(s).length&&(t.contexts={...s,...t.contexts}),o&&(t.level=o),a&&t.type!=="transaction"&&(t.transaction=a)}function V7t(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function $7t(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function H7t(t,e){t.contexts={trace:n7t(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:v7t(e),...t.sdkProcessingMetadata};const n=sTe(e),r=hM(n).description;r&&!t.transaction&&t.type==="transaction"&&(t.transaction=r)}function U7t(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}function nP(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}function q7t(t,e=!0){if(t.startsWith("data:")){const n=t.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",i=t.includes(";base64,"),s=t.indexOf(",");let o="";if(e&&s!==-1){const a=t.slice(s+1);o=a.length>10?`${a.slice(0,10)}... [truncated]`:a}return`data:${r}${i?",base64":""}${o?`,${o}`:""}`}return t}function dTe(t,e){const n=t.attributes??(t.attributes={});Object.entries(e).forEach(([r,i])=>{i!=null&&!(r in n)&&(n[r]=i)})}const rP=0,ile=1,sle=2;function xC(t){return new $k(e=>{e(t)})}function kK(t){return new $k((e,n)=>{n(t)})}class $k{constructor(e){this._state=rP,this._handlers=[],this._runExecutor(e)}then(e,n){return new $k((r,i)=>{this._handlers.push([!1,s=>{if(!e)r(s);else try{r(e(s))}catch(o){i(o)}},s=>{if(!n)i(s);else try{r(n(s))}catch(o){i(o)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new $k((n,r)=>{let i,s;return this.then(o=>{s=!1,i=o,e&&e()},o=>{s=!0,i=o,e&&e()}).then(()=>{if(s){r(i);return}n(i)})})}_executeHandlers(){if(this._state===rP)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===ile&&n[1](this._value),this._state===sle&&n[2](this._value),n[0]=!0)})}_runExecutor(e){const n=(s,o)=>{if(this._state===rP){if(gC(o)){o.then(r,i);return}this._state=s,this._value=o,this._executeHandlers()}},r=s=>{n(ile,s)},i=s=>{n(sle,s)};try{e(r,i)}catch(s){i(s)}}}function W7t(t,e,n,r=0){try{const i=kF(e,n,t,r);return gC(i)?i:xC(i)}catch(i){return kK(i)}}function kF(t,e,n,r){const i=n[r];if(!t||!i)return t;const s=i({...t},e);return Wt&&s===null&&Dt.log(`Event processor "${i.id||"?"}" dropped event`),gC(s)?s.then(o=>kF(o,e,n,r+1)):kF(s,e,n,r+1)}let Qd,ole,ale,tp;function G7t(t){const e=Pn._sentryDebugIds,n=Pn._debugIds;if(!e&&!n)return{};const r=e?Object.keys(e):[],i=n?Object.keys(n):[];if(tp&&r.length===ole&&i.length===ale)return tp;ole=r.length,ale=i.length,tp={},Qd||(Qd={});const s=(o,a)=>{for(const l of o){const c=a[l],u=Qd==null?void 0:Qd[l];if(u&&tp&&c)tp[u[0]]=c,Qd&&(Qd[l]=[u[0],c]);else if(c){const d=t(l);for(let h=d.length-1;h>=0;h--){const f=d[h],p=f==null?void 0:f.filename;if(p&&tp&&Qd){tp[p]=c,Qd[l]=[p,c];break}}}}};return e&&s(r,e),n&&s(i,n),tp}function K7t(t,e,n,r,i,s){const{normalizeDepth:o=3,normalizeMaxBreadth:a=1e3}=t,l={...e,event_id:e.event_id||n.event_id||Yl(),timestamp:e.timestamp||vC()},c=n.integrations||t.integrations.map(v=>v.name);Y7t(l,t),Q7t(l,c),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&Z7t(l,t.stackParser);const u=e8t(r,n.captureContext);n.mechanism&&k1(l,n.mechanism);const d=i?i.getEventProcessors():[],h=uTe(s,u),f=[...n.attachments||[],...h.attachments];f.length&&(n.attachments=f),B7t(l,h);const p=[...d,...h.eventProcessors];return(n.data&&n.data.__sentry__===!0?xC(l):W7t(p,l,n)).then(v=>(v&&X7t(v),typeof o=="number"&&o>0?J7t(v,o,a):v))}function Y7t(t,e){var a,l;const{environment:n,release:r,dist:i,maxValueLength:s}=e;t.environment=t.environment||n||SK,!t.release&&r&&(t.release=r),!t.dist&&i&&(t.dist=i);const o=t.request;o!=null&&o.url&&s&&(o.url=vF(o.url,s)),s&&((l=(a=t.exception)==null?void 0:a.values)==null||l.forEach(c=>{c.value&&(c.value=vF(c.value,s))}))}function Z7t(t,e){var r,i;const n=G7t(e);(i=(r=t.exception)==null?void 0:r.values)==null||i.forEach(s=>{var o,a;(a=(o=s.stacktrace)==null?void 0:o.frames)==null||a.forEach(l=>{l.filename&&(l.debug_id=n[l.filename])})})}function X7t(t){var r,i;const e={};if((i=(r=t.exception)==null?void 0:r.values)==null||i.forEach(s=>{var o,a;(a=(o=s.stacktrace)==null?void 0:o.frames)==null||a.forEach(l=>{l.debug_id&&(l.abs_path?e[l.abs_path]=l.debug_id:l.filename&&(e[l.filename]=l.debug_id),delete l.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.entries(e).forEach(([s,o])=>{n.push({type:"sourcemap",code_file:s,debug_id:o})})}function Q7t(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function J7t(t,e,n){var i,s;if(!t)return null;const r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(o=>({...o,...o.data&&{data:oh(o.data,e,n)}}))},...t.user&&{user:oh(t.user,e,n)},...t.contexts&&{contexts:oh(t.contexts,e,n)},...t.extra&&{extra:oh(t.extra,e,n)}};return(i=t.contexts)!=null&&i.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=oh(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(o=>({...o,...o.data&&{data:oh(o.data,e,n)}}))),(s=t.contexts)!=null&&s.flags&&r.contexts&&(r.contexts.flags=oh(t.contexts.flags,3,n)),r}function e8t(t,e){if(!e)return t;const n=t?t.clone():new Sd;return n.update(e),n}function t8t(t){if(t)return n8t(t)?{captureContext:t}:i8t(t)?{captureContext:t}:t}function n8t(t){return t instanceof Sd||typeof t=="function"}const r8t=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function i8t(t){return Object.keys(t).some(e=>r8t.includes(e))}function hTe(t,e){return Pf().captureException(t,t8t(e))}function fTe(t,e){return Pf().captureEvent(t,e)}function s8t(t,e){L0().setContext(t,e)}function lle(t){const e=L0(),{user:n}=uTe(e,Pf()),{userAgent:r}=Pn.navigator||{},i=gAt({user:n,...r&&{userAgent:r},...t}),s=e.getSession();return(s==null?void 0:s.status)==="ok"&&Ex(s,{status:"exited"}),pTe(),e.setSession(i),i}function pTe(){const t=L0(),n=Pf().getSession()||t.getSession();n&&yAt(n),mTe(),t.setSession()}function mTe(){const t=L0(),e=ho(),n=t.getSession();n&&e&&e.captureSession(n)}function iP(t=!1){if(t){pTe();return}mTe()}const o8t="7";function a8t(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function l8t(t){return`${a8t(t)}${t.projectId}/envelope/`}function c8t(t,e){const n={sentry_version:o8t};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}function u8t(t,e,n){return e||`${l8t(t)}?${c8t(t,n)}`}const cle=[];function d8t(t){const e={};return t.forEach(n=>{const{name:r}=n,i=e[r];i&&!i.isDefaultInstance&&n.isDefaultInstance||(e[r]=n)}),Object.values(e)}function h8t(t){const e=t.defaultIntegrations||[],n=t.integrations;e.forEach(i=>{i.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...e,...n];else if(typeof n=="function"){const i=n(e);r=Array.isArray(i)?i:[i]}else r=e;return d8t(r)}function f8t(t,e){const n={};return e.forEach(r=>{r!=null&&r.beforeSetup&&r.beforeSetup(t)}),e.forEach(r=>{r&&gTe(t,r,n)}),n}function ule(t,e){for(const n of e)n!=null&&n.afterAllSetup&&n.afterAllSetup(t)}function gTe(t,e,n){if(n[e.name]){Wt&&Dt.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,!cle.includes(e.name)&&typeof e.setupOnce=="function"&&(e.setupOnce(),cle.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){const r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,s)=>r(i,s,t))}if(typeof e.processEvent=="function"){const r=e.processEvent.bind(e),i=Object.assign((s,o)=>r(s,o,t),{id:e.name});t.addEventProcessor(i)}["processSpan","processSegmentSpan"].forEach(r=>{const i=e[r];typeof i=="function"&&t.on(r,s=>i.call(e,s,t))}),Wt&&Dt.log(`Integration installed: ${e.name}`)}function p8t(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function m8t(){/*! __SENTRY_SDK_SOURCE__ */return"npm"}function g8t(){return!p8t()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function CK(){return typeof window<"u"&&(!g8t()||y8t())}function y8t(){const t=Pn.process;return(t==null?void 0:t.type)==="renderer"}function v8t(t,e){const n=e?"auto":"never";return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},{version:2,...CK()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:t}]}function b8t(t,e,n,r,i){const s={};return e!=null&&e.sdk&&(s.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(s.dsn=wC(r)),M2(s,[v8t(t,i)])}function CF(t,e){const n=e??w8t(t)??[];if(n.length===0)return;const r=t.getOptions(),i=b8t(n,r._metadata,r.tunnel,t.getDsn(),t.getDataCollectionOptions().userInfo);yTe().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(i)}function w8t(t){return yTe().get(t)}function yTe(){return A2("clientToLogBufferMap",()=>new WeakMap)}function x8t(t,e){const n=e?"auto":"never";return[{type:"trace_metric",item_count:t.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{version:2,...CK()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:t}]}function _8t(t,e,n,r,i){const s={};return e!=null&&e.sdk&&(s.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(s.dsn=wC(r)),M2(s,[x8t(t,i)])}function vTe(t,e){const n=e??S8t(t)??[];if(n.length===0)return;const r=t.getOptions(),i=_8t(n,r._metadata,r.tunnel,t.getDsn(),r.sendDefaultPii);bTe().set(t,[]),t.emit("flushMetrics"),t.sendEnvelope(i)}function S8t(t){return bTe().get(t)}function bTe(){return A2("clientToMetricBufferMap",()=>new WeakMap)}function k8t(t){const e={trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,name:t.description||"",start_timestamp:t.start_timestamp,end_timestamp:t.timestamp||t.start_timestamp,status:!t.status||t.status==="ok"||t.status==="cancelled"?"ok":"error",is_segment:!1,attributes:{...t.data},links:t.links};return s7t(e)}function C8t(t,e){var s,o,a;if(t.type!=="transaction"||!((s=t.spans)!=null&&s.length)||!((o=t.sdkProcessingMetadata)!=null&&o.hasGenAiSpans)||!e.getOptions().streamGenAiSpans||j7t(e))return;const n=[],r=[];for(const l of t.spans)(a=l.op)!=null&&a.startsWith("gen_ai.")?n.push(k8t(l)):r.push(l);if(n.length===0)return;t.spans=r;const i=e.getOptions().sendDefaultPii?"auto":"never";return[{type:"span",item_count:n.length,content_type:"application/vnd.sentry.items.span.v2+json"},{version:2,...CK()&&{ingest_settings:{infer_ip:i,infer_user_agent:i}},items:n}]}function wTe(t){return typeof t=="object"&&typeof t.unref=="function"&&t.unref(),t}const EK=Symbol.for("SentryBufferFullError");function TK(t=100){const e=new Set;function n(){return e.size<t}function r(o){e.delete(o)}function i(o){if(!n())return kK(EK);const a=o();return e.add(a),a.then(()=>r(a),()=>r(a)),a}function s(o){if(!e.size)return xC(!0);const a=Promise.allSettled(Array.from(e)).then(()=>!0);if(!o)return a;const l=[a,new Promise(c=>wTe(setTimeout(()=>c(!1),o)))];return Promise.race(l)}return{get $(){return Array.from(e)},add:i,drain:s}}const E8t=60*1e3;function T8t(t,e=dM()){const n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;const r=Date.parse(`${t}`);return isNaN(r)?E8t:r-e}function A8t(t,e){return t[e]||t.all||0}function I8t(t,e,n=dM()){return A8t(t,e)>n}function R8t(t,{statusCode:e,headers:n},r=dM()){const i={...t},s=n==null?void 0:n["x-sentry-rate-limits"],o=n==null?void 0:n["retry-after"];if(s)for(const a of s.trim().split(",")){const[l,c,,,u]=a.split(":",5),d=parseInt(l,10),h=(isNaN(d)?60:d)*1e3;if(!c)i.all=r+h;else for(const f of c.split(";"))f==="metric_bucket"?(!u||u.split(";").includes("custom"))&&(i[f]=r+h):i[f]=r+h}else o?i.all=r+T8t(o,r):e===429&&(i.all=r+60*1e3);return i}const xTe=64;function M8t(t,e,n=TK(t.bufferSize||xTe)){let r={};const i=o=>n.drain(o);function s(o){const a=[];if(_F(o,(d,h)=>{const f=nle(h);I8t(r,f)?t.recordDroppedEvent("ratelimit_backoff",f):a.push(d)}),a.length===0)return Promise.resolve({});const l=M2(o[0],a),c=d=>{if(I7t(l,["client_report"])){Wt&&Dt.warn(`Dropping client report. Will not send outcomes (reason: ${d}).`);return}_F(l,(h,f)=>{t.recordDroppedEvent(d,nle(f))})},u=()=>e({body:R7t(l)}).then(d=>d.statusCode===413?(Wt&&Dt.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),c("send_error"),d):(Wt&&d.statusCode!==void 0&&(d.statusCode<200||d.statusCode>=300)&&Dt.warn(`Sentry responded with status code ${d.statusCode} to sent event.`),r=R8t(r,d),d),d=>{throw c("network_error"),Wt&&Dt.error("Encountered error running transport request:",d),d});return n.add(u).then(d=>d,d=>{if(d===EK)return Wt&&Dt.error("Skipped sending event because buffer is full."),c("queue_overflow"),Promise.resolve({});throw d})}return{send:s,flush:i}}function N8t(t,e,n){const r=[{type:"client_report"},{timestamp:vC(),discarded_events:t}];return M2(e?{dsn:e}:{},[r])}function _Te(t){const e=[];t.message&&e.push(t.message);try{const n=t.exception.values[t.exception.values.length-1];n!=null&&n.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`))}catch{}return e}function O8t(t){var l;const{trace_id:e,parent_span_id:n,span_id:r,status:i,origin:s,data:o,op:a}=((l=t.contexts)==null?void 0:l.trace)??{};return{data:o??{},description:t.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:t.start_timestamp??0,status:i,timestamp:t.timestamp,trace_id:e??"",origin:s,profile_id:o==null?void 0:o[eTe],exclusive_time:o==null?void 0:o[tTe],measurements:t.measurements,is_segment:!0}}function D8t(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:{...t.data,...t.profile_id&&{[eTe]:t.profile_id},...t.exclusive_time&&{[tTe]:t.exclusive_time}}}},measurements:t.measurements}}const wT=["forwarded","-ip","remote-","via","-user"];function P8t(t){return t===!0?{userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:["incomingRequest","outgoingRequest","incomingResponse","outgoingResponse"],queryParams:!0,genAI:{inputs:!0,outputs:!0},stackFrameVariables:!0,frameContextLines:5}:{userInfo:!1,cookies:{deny:wT},httpHeaders:{request:{deny:wT},response:{deny:wT}},httpBodies:[],queryParams:{deny:wT},genAI:{inputs:!1,outputs:!1},stackFrameVariables:!0,frameContextLines:5}}const L8t={userInfo:!1,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:[],queryParams:!0,genAI:{inputs:!0,outputs:!0},stackFrameVariables:!0,frameContextLines:5};function z8t(t){var r,i,s,o;const e=t.dataCollection!=null?L8t:P8t(t.sendDefaultPii),n=t.dataCollection??{};return{userInfo:n.userInfo??e.userInfo,cookies:n.cookies??e.cookies,httpHeaders:{request:((r=n.httpHeaders)==null?void 0:r.request)??e.httpHeaders.request,response:((i=n.httpHeaders)==null?void 0:i.response)??e.httpHeaders.response},httpBodies:n.httpBodies??e.httpBodies,queryParams:n.queryParams??e.queryParams,genAI:{inputs:((s=n.genAI)==null?void 0:s.inputs)??e.genAI.inputs,outputs:((o=n.genAI)==null?void 0:o.outputs)??e.genAI.outputs},stackFrameVariables:n.stackFrameVariables??e.stackFrameVariables,frameContextLines:n.frameContextLines??e.frameContextLines}}const dle="Not capturing exception because it's already been captured.",hle="Discarded session because of missing or non-string release",STe=Symbol.for("SentryInternalError"),kTe=Symbol.for("SentryDoNotSendEventError"),j8t=5e3;function mA(t){return{message:t,[STe]:!0}}function sP(t){return{message:t,[kTe]:!0}}function fle(t){return!!t&&typeof t=="object"&&STe in t}function ple(t){return!!t&&typeof t=="object"&&kTe in t}function mle(t,e,n,r,i){let s=0,o,a=!1;t.on(n,()=>{s=0,clearTimeout(o),a=!1}),t.on(e,l=>{if(s+=r(l),s>=8e5)i(t);else if(!a){const c=t.getOptions()._flushInterval??j8t;c>0&&(a=!0,o=wTe(setTimeout(()=>{i(t)},c)))}}),t.on("flush",()=>{i(t)})}class B8t{constructor(e){var r,i,s;if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=TK(((r=e.transportOptions)==null?void 0:r.bufferSize)??xTe),this._dataCollection=z8t(e),e.dsn?this._dsn=e7t(e.dsn):Wt&&Dt.warn("No DSN provided, client will not send events."),this._dsn){const o=u8t(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:o})}this._options.enableLogs=this._options.enableLogs??((i=this._options._experiments)==null?void 0:i.enableLogs),this._options.enableLogs&&mle(this,"afterCaptureLog","flushLogs",H8t,CF),(this._options.enableMetrics??((s=this._options._experiments)==null?void 0:s.enableMetrics)??!0)&&mle(this,"afterCaptureMetric","flushMetrics",$8t,vTe)}captureException(e,n,r){const i=Yl();if(Bae(e))return Wt&&Dt.log(dle),i;const s={event_id:i,...n};return this._process(()=>this.eventFromException(e,s).then(o=>this._captureEvent(o,s,r)).then(o=>o),"error"),s.event_id}captureMessage(e,n,r,i){const s={event_id:Yl(),...r},o=vK(e)?e:String(e),a=lM(e),l=a?this.eventFromMessage(o,n,s):this.eventFromException(e,s);return this._process(()=>l.then(c=>this._captureEvent(c,s,i)),a?"unknown":"error"),s.event_id}captureEvent(e,n,r){const i=Yl();if(n!=null&&n.originalException&&Bae(n.originalException))return Wt&&Dt.log(dle),i;const s={event_id:i,...n},o=e.sdkProcessingMetadata||{},a=o.capturedSpanScope,l=o.capturedSpanIsolationScope,c=gle(e.type);return this._process(()=>this._captureEvent(e,s,a||r,l),c),s.event_id}captureSession(e){this.sendSession(e),Ex(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getDataCollectionOptions(){return this._dataCollection}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){const n=this._transport;if(this.emit("flush"),!n)return!0;const r=await this._isClientDoneProcessing(e),i=await n.flush(e);return r&&i}async close(e){CF(this);const n=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),n}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}getIntegrationNames(){return Object.keys(this._integrations)}addIntegration(e){const n=this._integrations[e.name];!n&&e.beforeSetup&&e.beforeSetup(this),gTe(this,e,this._integrations),n||ule(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);const r=C8t(e,this);let i=z7t(e,this._dsn,this._options._metadata,this._options.tunnel);for(const s of n.attachments||[])i=tle(i,N7t(s));r&&(i=tle(i,r)),this.sendEnvelope(i).then(s=>this.emit("afterSendEvent",e,s))}sendSession(e){const{release:n,environment:r=SK}=this._options;if("aggregates"in e){const s=e.attrs||{};if(!s.release&&!n){Wt&&Dt.warn(hle);return}s.release=s.release||n,s.environment=s.environment||r,e.attrs=s}else{if(!e.release&&!n){Wt&&Dt.warn(hle);return}e.release=e.release||n,e.environment=e.environment||r}this.emit("beforeSendSession",e);const i=L7t(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(i)}recordDroppedEvent(e,n,r=1){if(this._options.sendClientReports){const i=`${e}:${n}`;Wt&&Dt.log(`Recording outcome: "${i}"${r>1?` (${r} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+r}}on(e,n){const r=this._hooks[e]=this._hooks[e]||new Set,i=(...s)=>n(...s);return r.add(i),()=>{r.delete(i)}}emit(e,...n){const r=this._hooks[e];r&&r.forEach(i=>i(...n))}async sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(n){return Wt&&Dt.error("Error while sending envelope:",n),{}}return Wt&&Dt.error("Transport disabled"),{}}registerCleanup(e){}dispose(){}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=f8t(this,e),ule(this,e)}_updateSessionFromEvent(e,n){var l,c;let r=n.level==="fatal",i=!1;const s=(l=n.exception)==null?void 0:l.values;if(s){i=!0,r=!1;for(const u of s)if(((c=u.mechanism)==null?void 0:c.handled)===!1){r=!0;break}}const o=e.status==="ok";(o&&e.errors===0||o&&r)&&(Ex(e,{...r&&{status:"crashed"},errors:e.errors||Number(i||r)}),this.captureSession(e))}async _isClientDoneProcessing(e){let n=0;for(;!e||n<e;){if(await new Promise(r=>setTimeout(r,1)),!this._numProcessing)return!0;n++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r,i){const s=this.getOptions(),o=this.getIntegrationNames();return!n.integrations&&o.length&&(n.integrations=o),this.emit("preprocessEvent",e,n),e.type||i.setLastEventId(e.event_id||n.event_id),K7t(s,e,n,r,this,i).then(a=>{var c;if(a===null)return a;this.emit("postprocessEvent",a,n),a.contexts={trace:{...(c=a.contexts)==null?void 0:c.trace,...OAt(r)},...a.contexts};const l=y7t(this,r);return a.sdkProcessingMetadata={dynamicSamplingContext:l,...a.sdkProcessingMetadata},a})}_captureEvent(e,n={},r=Pf(),i=L0()){return Wt&&EF(e)&&Dt.log(`Captured error event \`${_Te(e)[0]||"<unknown>"}\``),this._processEvent(e,n,r,i).then(s=>s.event_id,s=>{Wt&&(ple(s)?Dt.log(s.message):fle(s)?Dt.warn(s.message):Dt.warn(s))})}_processEvent(e,n,r,i){const s=this.getOptions(),{sampleRate:o}=s,a=CTe(e),l=EF(e),u=`before send for type \`${e.type||"error"}\``,d=typeof o>"u"?void 0:t7t(o);if(l&&typeof d=="number"&&Z8()>d)return this.recordDroppedEvent("sample_rate","error"),kK(sP(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const h=gle(e.type);return this._prepareEvent(e,n,r,i).then(f=>{var y;if(f===null)throw this.recordDroppedEvent("event_processor",h),sP("An event processor returned `null`, will not send event.");if(((y=n.data)==null?void 0:y.__sentry__)===!0)return f;const g=V8t(this,s,f,n);return F8t(g,u)}).then(f=>{var y;if(f===null){if(this.recordDroppedEvent("before_send",h),a){const b=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",b)}throw sP(`${u} returned \`null\`, will not send event.`)}const p=r.getSession()||i.getSession();if(l&&p&&this._updateSessionFromEvent(p,f),a){const v=((y=f.sdkProcessingMetadata)==null?void 0:y.spanCountBeforeProcessing)||0,b=f.spans?f.spans.length:0,_=v-b;_>0&&this.recordDroppedEvent("before_send","span",_)}const g=f.transaction_info;if(a&&g&&f.transaction!==e.transaction){const v="custom";f.transaction_info={...g,source:v}}return this.sendEvent(f,n),f}).then(null,f=>{throw ple(f)||fle(f)?f:(this.captureException(f,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:f}),mA(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
||
Reason: ${f}`))})}_process(e,n){this._numProcessing++,this._promiseBuffer.add(e).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===EK&&this.recordDroppedEvent("queue_overflow",n),r))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{const[i,s]=n.split(":");return{reason:i,category:s,quantity:r}})}_flushOutcomes(){Wt&&Dt.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0){Wt&&Dt.log("No outcomes to send");return}if(!this._dsn){Wt&&Dt.log("No dsn provided, will not send outcomes");return}Wt&&Dt.log("Sending outcomes:",e);const n=N8t(e,this._options.tunnel&&wC(this._dsn));this.sendEnvelope(n)}}function gle(t){return t==="replay_event"?"replay":t||"error"}function F8t(t,e){const n=`${e} must return \`null\` or a valid event.`;if(gC(t))return t.then(r=>{if(!Vk(r)&&r!==null)throw mA(n);return r},r=>{throw mA(`${e} rejected with ${r}`)});if(!Vk(t)&&t!==null)throw mA(n);return t}function V8t(t,e,n,r){const{beforeSend:i,beforeSendTransaction:s,ignoreSpans:o}=e,a=!b7t(e.beforeSendSpan)&&e.beforeSendSpan;let l=n;if(EF(l)&&i)return i(l,r);if(CTe(l)){if(a||o){const c=O8t(l);if(o!=null&&o.length&&ele({description:c.description,op:c.op,attributes:c.data},o))return null;if(a){const u=a(c);u?l=bC(n,D8t(u)):Qae()}if(l.spans){const u=[],d=l.spans;for(const f of d){if(o!=null&&o.length&&ele({description:f.description,op:f.op,attributes:f.data},o)){p7t(d,f);continue}if(a){const p=a(f);p?u.push(p):(Qae(),u.push(f))}else u.push(f)}const h=l.spans.length-u.length;h&&t.recordDroppedEvent("before_send","span",h),l.spans=u}}if(s){if(l.spans){const c=l.spans.length;l.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:c}}return s(l,r)}}return l}function EF(t){return t.type===void 0}function CTe(t){return t.type==="transaction"}function $8t(t){let e=0;return t.name&&(e+=t.name.length*2),e+=8,e+ETe(t.attributes)}function H8t(t){let e=0;return t.message&&(e+=t.message.length*2),e+ETe(t.attributes)}function ETe(t){if(!t)return 0;let e=0;return Object.values(t).forEach(n=>{Array.isArray(n)?e+=n.length*yle(n[0]):lM(n)?e+=yle(n):e+=100}),e}function yle(t){return typeof t=="string"?t.length*2:typeof t=="number"?8:typeof t=="boolean"?4:0}function U8t(t,e){e.debug===!0&&(Wt?Dt.enable():I2(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Pf().update(e.initialScope);const r=new t(e);return q8t(r),r.init(),r}function q8t(t){Pf().setClient(t)}function W8t(t){var e;"aggregates"in t?((e=t.attrs)==null?void 0:e.ip_address)===void 0&&(t.attrs={...t.attrs,ip_address:"{{auto}}"}):t.ipAddress===void 0&&(t.ipAddress="{{auto}}")}function TTe(t,e,n=[e],r="npm"){const i=(t._metadata=t._metadata||{}).sdk=t._metadata.sdk||{};i.name||(i.name=`sentry.javascript.${e}`,i.packages=n.map(s=>({name:`${r}:@sentry/${s}`,version:S1})),i.version=S1)}const G8t=100;function d0(t,e){const n=ho(),r=L0();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:s=G8t}=n.getOptions();if(s<=0)return;const a={timestamp:vC(),...t},l=i?I2(()=>i(a,e)):a;l!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",l,e),r.addBreadcrumb(l,s))}let vle;const K8t="FunctionToString",ble=new WeakMap,Y8t=()=>({name:K8t,setupOnce(){vle=Function.prototype.toString;try{Function.prototype.toString=function(...t){const e=xK(this),n=ble.has(ho())&&e!==void 0?e:this;return vle.apply(n,t)}}catch{}},setup(t){ble.set(t,!0)}}),Z8t=Y8t,X8t=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/^Java exception was raised during method invocation$/],Q8t="EventFilters",J8t=(t={})=>{let e;return{name:Q8t,setup(n){const r=n.getOptions();e=wle(t,r)},processEvent(n,r,i){if(!e){const s=i.getOptions();e=wle(t,s)}return t9t(n,e)?null:n}}},e9t=(t={})=>({...J8t(t),name:"InboundFilters"});function wle(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:X8t],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function t9t(t,e){if(t.type){if(t.type==="transaction"&&r9t(t,e.ignoreTransactions))return Wt&&Dt.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
||
Event: ${Sg(t)}`),!0}else{if(n9t(t,e.ignoreErrors))return Wt&&Dt.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
||
Event: ${Sg(t)}`),!0;if(a9t(t))return Wt&&Dt.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
||
Event: ${Sg(t)}`),!0;if(i9t(t,e.denyUrls))return Wt&&Dt.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
||
Event: ${Sg(t)}.
|
||
Url: ${X8(t)}`),!0;if(!s9t(t,e.allowUrls))return Wt&&Dt.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
||
Event: ${Sg(t)}.
|
||
Url: ${X8(t)}`),!0}return!1}function n9t(t,e){return e!=null&&e.length?_Te(t).some(n=>yC(n,e)):!1}function r9t(t,e){if(!(e!=null&&e.length))return!1;const n=t.transaction;return n?yC(n,e):!1}function i9t(t,e){if(!(e!=null&&e.length))return!1;const n=X8(t);return n?yC(n,e):!1}function s9t(t,e){if(!(e!=null&&e.length))return!0;const n=X8(t);return n?yC(n,e):!0}function o9t(t=[]){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function X8(t){var e,n;try{const r=[...((e=t.exception)==null?void 0:e.values)??[]].reverse().find(s=>{var o,a,l;return((o=s.mechanism)==null?void 0:o.parent_id)===void 0&&((l=(a=s.stacktrace)==null?void 0:a.frames)==null?void 0:l.length)}),i=(n=r==null?void 0:r.stacktrace)==null?void 0:n.frames;return i?o9t(i):null}catch{return Wt&&Dt.error(`Cannot extract url for event ${Sg(t)}`),null}}function a9t(t){var e,n;return(n=(e=t.exception)==null?void 0:e.values)!=null&&n.length?!t.message&&!t.exception.values.some(r=>r.stacktrace||r.type&&r.type!=="Error"||r.value):!1}function l9t(t,e,n,r,i,s){var a;if(!((a=i.exception)!=null&&a.values)||!s||!c0(s.originalException,Error))return;const o=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;o&&(i.exception.values=TF(t,e,r,s.originalException,n,i.exception.values,o,0))}function TF(t,e,n,r,i,s,o,a){if(s.length>=n+1)return s;let l=[...s];if(c0(r[i],Error)){xle(o,a,r);const c=t(e,r[i]),u=l.length;_le(c,i,u,a),l=TF(t,e,n,r[i],i,[c,...l],c,u)}return ATe(r)&&r.errors.forEach((c,u)=>{if(c0(c,Error)){xle(o,a,r);const d=t(e,c),h=l.length;_le(d,`errors[${u}]`,h,a),l=TF(t,e,n,c,i,[d,...l],d,h)}}),l}function ATe(t){return Array.isArray(t.errors)}function xle(t,e,n){t.mechanism={handled:!0,type:"auto.core.linked_errors",...ATe(n)&&{is_exception_group:!0},...t.mechanism,exception_id:e}}function _le(t,e,n,r){t.mechanism={handled:!0,...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}function c9t(t){return aM(t)&&"__sentry_fetch_url_host__"in t&&typeof t.__sentry_fetch_url_host__=="string"}function Sle(t){return c9t(t)?`${t.message} (${t.__sentry_fetch_url_host__})`:t.message}const kle=new Set([]);function u9t(t){const e="console",n=zy(e,t);return jy(e,d9t),n}function d9t(){"console"in Pn&&q6t.forEach(function(t){t in Pn.console&&Wa(Pn.console,t,function(e){return Y8[t]=e,function(...n){const r=n[0],i=Y8[t],s=kle.size&&typeof r=="string"&&yC(r,kle);s||qc("console",{args:n,level:t}),(!s||Wt&&Dt.isEnabled())&&(i==null||i.apply(Pn.console,n))}})})}function h9t(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}const f9t="Dedupe",p9t=()=>{let t;return{name:f9t,processEvent(e){if(e.type)return e;try{if(g9t(e,t))return Wt&&Dt.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},m9t=p9t;function g9t(t,e){return e?!!(y9t(t,e)||v9t(t,e)):!1}function y9t(t,e){const n=t.message,r=e.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!RTe(t,e)||!ITe(t,e))}function v9t(t,e){const n=Cle(e),r=Cle(t);return!(!n||!r||n.type!==r.type||n.value!==r.value||!RTe(t,e)||!ITe(t,e))}function ITe(t,e){let n=Oae(t),r=Oae(e);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let i=0;i<r.length;i++){const s=r[i],o=n[i];if(s.filename!==o.filename||s.lineno!==o.lineno||s.colno!==o.colno||s.function!==o.function)return!1}return!0}function RTe(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join("")===r.join("")}catch{return!1}}function Cle(t){var e,n;return(n=(e=t.exception)==null?void 0:e.values)==null?void 0:n[0]}const b9t="ConversationId",w9t=()=>({name:b9t,setup(t){t.on("spanStart",e=>{const n=Pf().getScopeData(),r=L0().getScopeData(),i=n.conversationId||r.conversationId;if(i){const{op:s,data:o,description:a}=hM(e);if(!(s!=null&&s.startsWith("gen_ai."))&&!o["ai.operationId"]&&!(a!=null&&a.startsWith("ai.")))return;e.setAttribute(BAt,i)}})}}),x9t=w9t;function MTe(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}const Hk=Pn;function _9t(){return"history"in Hk&&!!Hk.history}function S9t(){if(!("fetch"in Hk))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}function AF(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function k9t(){var n;if(typeof EdgeRuntime=="string")return!0;if(!S9t())return!1;if(AF(Hk.fetch))return!0;let t=!1;const e=Hk.document;if(e&&typeof e.createElement=="function")try{const r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r),(n=r.contentWindow)!=null&&n.fetch&&(t=AF(r.contentWindow.fetch)),e.head.removeChild(r)}catch(r){Wt&&Dt.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}function C9t(t,e){const n="fetch",r=zy(n,t);return jy(n,()=>E9t(void 0,e)),r}function E9t(t,e=!1){e&&!k9t()||Wa(Pn,"fetch",function(n){return function(...r){const i=new Error,{method:s,url:o}=T9t(r),a={args:r,fetchData:{method:s,url:o},startTimestamp:Kh()*1e3,virtualError:i,headers:A9t(r)};return qc("fetch",{...a}),n.apply(Pn,r).then(async l=>(qc("fetch",{...a,endTimestamp:Kh()*1e3,response:l}),l),l=>{qc("fetch",{...a,endTimestamp:Kh()*1e3,error:l}),aM(l)&&l.stack===void 0&&(l.stack=i.stack,u0(l,"framesToPop",1));const c=ho(),u=(c==null?void 0:c.getOptions().enhanceFetchErrorMessages)??"always";if(u!==!1&&l instanceof TypeError&&(l.message==="Failed to fetch"||l.message==="Load failed"||l.message==="NetworkError when attempting to fetch resource."))try{const f=new URL(a.fetchData.url).host;u==="always"?l.message=`${l.message} (${f})`:u0(l,"__sentry_fetch_url_host__",f)}catch{}throw l})}})}function gA(t,e){return!!t&&typeof t=="object"&&!!t[e]}function Ele(t){return typeof t=="string"?t:t?gA(t,"url")?t.url:t.toString?t.toString():"":""}function T9t(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){const[n,r]=t;return{url:Ele(n),method:gA(r,"method")?String(r.method).toUpperCase():WEe(n)&&gA(n,"method")?String(n.method).toUpperCase():"GET"}}const e=t[0];return{url:Ele(e),method:gA(e,"method")?String(e.method).toUpperCase():"GET"}}function A9t(t){const[e,n]=t;try{if(typeof n=="object"&&n!==null&&"headers"in n&&n.headers)return new Headers(n.headers);if(WEe(e))return new Headers(e.headers)}catch{}}const Dr=Pn;let IF=0;function NTe(){return IF>0}function I9t(){IF++,setTimeout(()=>{IF--})}function Ax(t,e={}){function n(i){return typeof i=="function"}if(!n(t))return t;try{const i=t.__sentry_wrapped__;if(i)return typeof i=="function"?i:t;if(xK(t))return t}catch{return t}const r=function(...i){Pn._sentryWrappedDepth=(Pn._sentryWrappedDepth||0)+1;try{const s=i.map(o=>Ax(o,e));return t.apply(this,s)}catch(s){throw I9t(),NAt(o=>{o.addEventProcessor(a=>(e.mechanism&&(bF(a,void 0),k1(a,e.mechanism)),a.extra={...a.extra,arguments:i},a)),hTe(s)}),s}finally{Pn._sentryWrappedDepth=(Pn._sentryWrappedDepth||0)-1}};try{for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}catch{}KEe(r,t),u0(t,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return t.name}})}catch{}return r}function Tle(){const t=wK(),{referrer:e}=Dr.document||{},{userAgent:n}=Dr.navigator||{},r={...e&&{Referer:e},...n&&{"User-Agent":n}};return{url:t,headers:r}}function AK(t,e){const n=fM(t,e),r={type:D9t(e),value:P9t(e)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function R9t(t,e,n,r){const i=ho(),s=i==null?void 0:i.getOptions().normalizeDepth,o=F9t(e),a={__serialized__:aTe(e,s)};if(o)return{exception:{values:[AK(t,o)]},extra:a};const l={exception:{values:[{type:cM(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:j9t(e,{isUnhandledRejection:r})}]},extra:a};if(n){const c=fM(t,n);c.length&&(l.exception.values[0].stacktrace={frames:c})}return l}function oP(t,e){return{exception:{values:[AK(t,e)]}}}function fM(t,e){const n=e.stacktrace||e.stack||"",r=N9t(e),i=O9t(e);try{return t(n,r,i)}catch{}return[]}const M9t=/Minified React error #\d+;/i;function N9t(t){return t&&M9t.test(t.message)?1:0}function O9t(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function OTe(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function D9t(t){const e=t==null?void 0:t.name;return!e&&OTe(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function P9t(t){const e=t==null?void 0:t.message;return OTe(t)?Array.isArray(t.message)&&t.message.length==2?t.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?Sle(e.error):Sle(t):"No error message"}function L9t(t,e,n,r){const i=(n==null?void 0:n.syntheticException)||void 0,s=IK(t,e,i,r);return k1(s),s.level="error",n!=null&&n.event_id&&(s.event_id=n.event_id),xC(s)}function z9t(t,e,n="info",r,i){const s=(r==null?void 0:r.syntheticException)||void 0,o=RF(t,e,s,i);return o.level=n,r!=null&&r.event_id&&(o.event_id=r.event_id),xC(o)}function IK(t,e,n,r,i){var o,a;let s;if(UEe(e)&&e.error)return oP(t,e.error);if(Pae(e)||iAt(e)){const l=e;if("stack"in e){s=oP(t,e);const c=(a=(o=s.exception)==null?void 0:o.values)==null?void 0:a[0];if(r&&n&&c&&!c.stacktrace){const u=fM(t,n);u.length&&(c.stacktrace={frames:u},k1(s,{synthetic:!0}))}}else{const c=l.name||(Pae(l)?"DOMError":"DOMException"),u=l.message?`${c}: ${l.message}`:c;s=RF(t,u,n,r),bF(s,u)}return"code"in l&&(s.tags={...s.tags,"DOMException.code":`${l.code}`}),s}return aM(e)?oP(t,e):Vk(e)||cM(e)?(s=R9t(t,e,n,i),k1(s,{synthetic:!0}),s):(s=RF(t,e,n,r),bF(s,`${e}`),k1(s,{synthetic:!0}),s)}function RF(t,e,n,r){const i={};if(r&&n){const s=fM(t,n);s.length&&(i.exception={values:[{value:e,stacktrace:{frames:s}}]}),k1(i,{synthetic:!0})}if(vK(e)){const{__sentry_template_string__:s,__sentry_template_values__:o}=e;return i.logentry={message:s,params:o},i}return i.message=e,i}function j9t(t,{isUnhandledRejection:e}){const n=dAt(t),r=e?"promise rejection":"exception";return UEe(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:cM(t)?`Event \`${B9t(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function B9t(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function F9t(t){return Object.values(t).find(e=>e instanceof Error)}class V9t extends B8t{constructor(e){var u;const n=$9t(e),r=Dr.SENTRY_SDK_SOURCE||m8t();TTe(n,"browser",["browser"],r),(u=n._metadata)!=null&&u.sdk&&(n._metadata.sdk.settings={infer_ip:n.sendDefaultPii?"auto":"never",...n._metadata.sdk.settings}),super(n);const{sendDefaultPii:i,sendClientReports:s,enableLogs:o,_experiments:a,enableMetrics:l}=this._options,c=l??(a==null?void 0:a.enableMetrics)??!0;Dr.document&&(s||o||c)&&Dr.document.addEventListener("visibilitychange",()=>{Dr.document.visibilityState==="hidden"&&(s&&this._flushOutcomes(),o&&CF(this),c&&vTe(this))}),i&&this.on("beforeSendSession",W8t)}eventFromException(e,n){return L9t(this._options.stackParser,e,n,this._options.attachStacktrace)}eventFromMessage(e,n="info",r){return z9t(this._options.stackParser,e,n,r,this._options.attachStacktrace)}_prepareEvent(e,n,r,i){return e.platform=e.platform||"javascript",super._prepareEvent(e,n,r,i)}}function $9t(t){var e;return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:(e=Dr.SENTRY_RELEASE)==null?void 0:e.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...t}}const H9t=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ro=Pn,U9t=1e3;let Ale,MF,NF;function q9t(t){const e="dom";zy(e,t),jy(e,W9t)}function W9t(){if(!Ro.document)return;const t=qc.bind(null,"dom"),e=Ile(t,!0);Ro.document.addEventListener("click",e,!1),Ro.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(n=>{var s,o;const i=(s=Ro[n])==null?void 0:s.prototype;(o=i==null?void 0:i.hasOwnProperty)!=null&&o.call(i,"addEventListener")&&(Wa(i,"addEventListener",function(a){return function(l,c,u){if(l==="click"||l=="keypress")try{const d=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},h=d[l]=d[l]||{refCount:0};if(!h.handler){const f=Ile(t);h.handler=f,a.call(this,l,f,u)}h.refCount++}catch{}return a.call(this,l,c,u)}}),Wa(i,"removeEventListener",function(a){return function(l,c,u){if(l==="click"||l=="keypress")try{const d=this.__sentry_instrumentation_handlers__||{},h=d[l];h&&(h.refCount--,h.refCount<=0&&(a.call(this,l,h.handler,u),h.handler=void 0,delete d[l]),Object.keys(d).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return a.call(this,l,c,u)}}))})}function G9t(t){if(t.type!==MF)return!1;try{if(!t.target||t.target._sentryId!==NF)return!1}catch{}return!0}function K9t(t,e){return t!=="keypress"?!1:e!=null&&e.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function Ile(t,e=!1){return n=>{if(!n||n._sentryCaptured)return;const r=Y9t(n);if(K9t(n.type,r))return;u0(n,"_sentryCaptured",!0),r&&!r._sentryId&&u0(r,"_sentryId",Yl());const i=n.type==="keypress"?"input":n.type;G9t(n)||(t({event:n,name:i,global:e}),MF=n.type,NF=r?r._sentryId:void 0),clearTimeout(Ale),Ale=Ro.setTimeout(()=>{NF=void 0,MF=void 0},U9t)}}function Y9t(t){try{return t.target}catch{return null}}let xT;function DTe(t){const e="history";zy(e,t),jy(e,Z9t)}function Z9t(){if(Ro.addEventListener("popstate",()=>{const e=Ro.location.href,n=xT;if(xT=e,n===e)return;qc("history",{from:n,to:e})}),!_9t())return;function t(e){return function(...n){const r=n.length>2?n[2]:void 0;if(r){const i=xT,s=X9t(String(r));if(xT=s,i===s)return e.apply(this,n);qc("history",{from:i,to:s})}return e.apply(this,n)}}Wa(Ro.history,"pushState",t),Wa(Ro.history,"replaceState",t)}function X9t(t){try{return new URL(t,Ro.location.origin).toString()}catch{return t}}const yA={};function Q9t(t){const e=yA[t];if(e)return e;let n=Ro[t];if(AF(n))return yA[t]=n.bind(Ro);const r=Ro.document;if(r&&typeof r.createElement=="function")try{const i=r.createElement("iframe");i.hidden=!0,r.head.appendChild(i);const s=i.contentWindow;s!=null&&s[t]&&(n=s[t]),r.head.removeChild(i)}catch(i){H9t&&Dt.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return n&&(yA[t]=n.bind(Ro))}function J9t(t){yA[t]=void 0}const d_="__sentry_xhr_v3__";function eIt(t){const e="xhr";zy(e,t),jy(e,tIt)}function tIt(){if(!Ro.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,n,r){const i=new Error,s=Kh()*1e3,o=Gh(r[0])?r[0].toUpperCase():void 0,a=nIt(r[1]);if(!o||!a)return e.apply(n,r);n[d_]={method:o,url:a,request_headers:{}},o==="POST"&&a.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const l=()=>{const c=n[d_];if(c&&n.readyState===4){try{c.status_code=n.status}catch{}const u={endTimestamp:Kh()*1e3,startTimestamp:s,xhr:n,virtualError:i};qc("xhr",u)}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply(c,u,d){return l(),c.apply(u,d)}}):n.addEventListener("readystatechange",l),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(c,u,d){const[h,f]=d,p=u[d_];return p&&Gh(h)&&Gh(f)&&(p.request_headers[h.toLowerCase()]=f),c.apply(u,d)}}),e.apply(n,r)}}),t.send=new Proxy(t.send,{apply(e,n,r){const i=n[d_];if(!i)return e.apply(n,r);r[0]!==void 0&&(i.body=r[0]);const s={startTimestamp:Kh()*1e3,xhr:n};return qc("xhr",s),e.apply(n,r)}})}function nIt(t){if(Gh(t))return t;try{return t.toString()}catch{}}const rIt=40;function iIt(t,e=Q9t("fetch")){let n=0,r=0;async function i(s){const o=s.body.length;n+=o,r++;const a={body:s.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};try{const l=await e(t.url,a);return{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}}catch(l){throw J9t("fetch"),l}finally{n-=o,r--}}return M8t(t,i,TK(t.bufferSize||rIt))}const pM=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,sIt=30,oIt=50;function OF(t,e,n,r){const i={filename:t,function:e==="<anonymous>"?dy:e,in_app:!0};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}const aIt=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,lIt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,cIt=/\((\S*)(?::(\d+))(?::(\d+))\)/,uIt=/at (.+?) ?\(data:(.+?),/,dIt=t=>{var i;const e=t.match(uIt);if(e)return{filename:`<data:${e[2]}>`,function:e[1]};const n=aIt.exec(t);if(n){const[,s,o,a]=n;return OF(s,dy,+o,+a)}const r=lIt.exec(t);if(r){if(((i=r[2])==null?void 0:i.indexOf("eval"))===0){const l=cIt.exec(r[2]);l&&(r[2]=l[1],r[3]=l[2],r[4]=l[3])}const[o,a]=PTe(r[1]||dy,r[2]);return OF(a,o,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},hIt=[sIt,dIt],fIt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,pIt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,mIt=t=>{const e=fIt.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const s=pIt.exec(e[3]);s&&(e[1]=e[1]||"eval",e[3]=s[1],e[4]=s[2],e[5]="")}let r=e[3],i=e[1]||dy;return[i,r]=PTe(i,r),OF(r,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},gIt=[oIt,mIt],yIt=[hIt,gIt],vIt=VEe(...yIt),PTe=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:dy,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},_T=1024,bIt="Breadcrumbs",wIt=(t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:bIt,setup(n){e.console&&u9t(kIt(n)),e.dom&&q9t(SIt(n,e.dom)),e.xhr&&eIt(CIt(n)),e.fetch&&C9t(EIt(n)),e.history&&DTe(TIt(n)),e.sentry&&n.on("beforeSendEvent",_It(n))}}},xIt=wIt;function _It(t){return function(n){ho()===t&&d0({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:Sg(n)},{event:n})}}function SIt(t,e){return function(r){if(ho()!==t)return;let i,s,o=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>_T&&(pM&&Dt.warn(`\`dom.maxStringLength\` cannot exceed ${_T}, but a value of ${a} was configured. Sentry will use ${_T} instead.`),a=_T),typeof o=="string"&&(o=[o]);try{const c=r.event,u=AIt(c)?c.target:c;i=GEe(u,{keyAttrs:o,maxStringLength:a}),s=uAt(u)}catch{i="<unknown>"}if(i.length===0)return;const l={category:`ui.${r.name}`,message:i};s&&(l.data={"ui.component_name":s}),d0(l,{event:r.event,name:r.name,global:r.global})}}function kIt(t){return function(n){if(ho()!==t)return;const r={category:"console",data:{arguments:n.args,logger:"console"},level:h9t(n.level),message:jae(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)r.message=`Assertion failed: ${jae(n.args.slice(1)," ")||"console.assert"}`,r.data.arguments=n.args.slice(1);else return;d0(r,{input:n.args,level:n.level})}}function CIt(t){return function(n){if(ho()!==t)return;const{startTimestamp:r,endTimestamp:i}=n,s=n.xhr[d_];if(!r||!i||!s)return;const{method:o,url:a,status_code:l,body:c}=s,u={method:o,url:a,status_code:l},d={xhr:n.xhr,input:c,startTimestamp:r,endTimestamp:i},h={category:"xhr",data:u,type:"http",level:MTe(l)};t.emit("beforeOutgoingRequestBreadcrumb",h,d),d0(h,d)}}function EIt(t){return function(n){if(ho()!==t)return;const{startTimestamp:r,endTimestamp:i}=n;if(i&&!(n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST"))if(n.error){const s={data:n.error,input:n.args,startTimestamp:r,endTimestamp:i},o={category:"fetch",data:n.fetchData,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",o,s),d0(o,s)}else{const s=n.response,o={...n.fetchData,status_code:s==null?void 0:s.status},a={input:n.args,response:s,startTimestamp:r,endTimestamp:i},l={category:"fetch",data:o,type:"http",level:MTe(o.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",l,a),d0(l,a)}}}function TIt(t){return function(n){if(ho()!==t)return;let r=n.from,i=n.to;const s=nP(Dr.location.href);let o=r?nP(r):void 0;const a=nP(i);o!=null&&o.path||(o=s),s.protocol===a.protocol&&s.host===a.host&&(i=a.relative),s.protocol===o.protocol&&s.host===o.host&&(r=o.relative),d0({category:"navigation",data:{from:r,to:i}})}}function AIt(t){return!!t&&!!t.target}const IIt="EventTarget,Window,Node,ApplicationCache,AudioTrackList,BroadcastChannel,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(","),RIt="BrowserApiErrors",MIt=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...t};return{name:RIt,setupOnce(){e.setTimeout&&Wa(Dr,"setTimeout",Rle),e.setInterval&&Wa(Dr,"setInterval",Rle),e.requestAnimationFrame&&Wa(Dr,"requestAnimationFrame",OIt),e.XMLHttpRequest&&"XMLHttpRequest"in Dr&&Wa(XMLHttpRequest.prototype,"send",DIt);const n=e.eventTarget;n&&(Array.isArray(n)?n:IIt).forEach(i=>PIt(i,e))}}},NIt=MIt;function Rle(t){return function(...e){const n=e[0];return e[0]=Ax(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${l0(t)}`}}),t.apply(this,e)}}function OIt(t){return function(e){return t.apply(this,[Ax(e,{mechanism:{data:{handler:l0(t)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function DIt(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in n&&typeof n[i]=="function"&&Wa(n,i,function(s){const o={mechanism:{data:{handler:l0(s)},handled:!1,type:`auto.browser.browserapierrors.xhr.${i}`}},a=xK(s);return a&&(o.mechanism.data.handler=l0(a)),Ax(s,o)})}),t.apply(this,e)}}function PIt(t,e){var i,s;const r=(i=Dr[t])==null?void 0:i.prototype;(s=r==null?void 0:r.hasOwnProperty)!=null&&s.call(r,"addEventListener")&&(Wa(r,"addEventListener",function(o){return function(a,l,c){try{LIt(l)&&(l.handleEvent=Ax(l.handleEvent,{mechanism:{data:{handler:l0(l),target:t},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return e.unregisterOriginalCallbacks&&zIt(this,a,l),o.apply(this,[a,Ax(l,{mechanism:{data:{handler:l0(l),target:t},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),c])}}),Wa(r,"removeEventListener",function(o){return function(a,l,c){try{const u=l.__sentry_wrapped__;u&&o.call(this,a,u,c)}catch{}return o.call(this,a,l,c)}}))}function LIt(t){return typeof t.handleEvent=="function"}function zIt(t,e,n){t&&typeof t=="object"&&"removeEventListener"in t&&typeof t.removeEventListener=="function"&&t.removeEventListener(e,n)}const jIt=(t={})=>{const e=t.lifecycle??"route";return{name:"BrowserSession",setupOnce(){if(typeof Dr.document>"u"){pM&&Dt.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}lle({ignoreDuration:!0}),iP();const n=L0();let r=n.getUser();n.addScopeListener(i=>{const s=i.getUser();((r==null?void 0:r.id)!==(s==null?void 0:s.id)||(r==null?void 0:r.ip_address)!==(s==null?void 0:s.ip_address))&&(iP(),r=s)}),e==="route"&&DTe(({from:i,to:s})=>{i!==s&&(lle({ignoreDuration:!0}),iP())})}}},BIt="CultureContext",FIt=()=>({name:BIt,preprocessEvent(t){var n;const e=Mle();e&&(t.contexts={...t.contexts,culture:{...e,...(n=t.contexts)==null?void 0:n.culture}})},processSegmentSpan(t){const e=Mle();e&&dTe(t,{"culture.locale":e.locale,"culture.timezone":e.timezone,"culture.calendar":e.calendar})}}),VIt=FIt;function Mle(){try{const t=Dr.Intl;if(!t)return;const e=t.DateTimeFormat().resolvedOptions();return{locale:e.locale,timezone:e.timeZone,calendar:e.calendar}}catch{return}}const $It="GlobalHandlers",HIt=(t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:$It,setupOnce(){Error.stackTraceLimit=50},setup(n){e.onerror&&(qIt(n),Nle("onerror")),e.onunhandledrejection&&(WIt(n),Nle("onunhandledrejection"))}}},UIt=HIt;function qIt(t){eAt(e=>{const{stackParser:n,attachStacktrace:r}=LTe();if(ho()!==t||NTe())return;const{msg:i,url:s,line:o,column:a,error:l}=e,c=YIt(IK(n,l||i,void 0,r,!1),s,o,a);c.level="error",fTe(c,{originalException:l,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})})}function WIt(t){nAt(e=>{const{stackParser:n,attachStacktrace:r}=LTe();if(ho()!==t||NTe())return;const i=GIt(e),s=lM(i)?KIt(i):IK(n,i,void 0,r,!0);s.level="error",fTe(s,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})})}function GIt(t){if(lM(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}function KIt(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function YIt(t,e,n,r){const i=t.exception=t.exception||{},s=i.values=i.values||[],o=s[0]=s[0]||{},a=o.stacktrace=o.stacktrace||{},l=a.frames=a.frames||[];return l.length===0&&l.push({colno:r,lineno:n,filename:ZIt(e)??wK(),function:dy,in_app:!0}),t}function Nle(t){pM&&Dt.log(`Global Handler attached: ${t}`)}function LTe(){const t=ho();return(t==null?void 0:t.getOptions())||{stackParser:()=>[],attachStacktrace:!1}}function ZIt(t){if(!(!Gh(t)||t.length===0))return t.startsWith("data:")?`<${q7t(t,!1)}>`:t}const XIt=()=>({name:"HttpContext",preprocessEvent(t){var r;if(!Dr.navigator&&!Dr.location&&!Dr.document)return;const e=Tle(),n={...e.headers,...(r=t.request)==null?void 0:r.headers};t.request={...e,...t.request,headers:n}},processSegmentSpan(t){if(!Dr.navigator&&!Dr.location&&!Dr.document)return;const e=Tle();dTe(t,{"url.full":e.url||void 0,"http.request.header.user_agent":e.headers["User-Agent"],"http.request.header.referer":e.headers.Referer})}}),QIt="cause",JIt=5,eRt="LinkedErrors",tRt=(t={})=>{const e=t.limit||JIt,n=t.key||QIt;return{name:eRt,preprocessEvent(r,i,s){const o=s.getOptions();l9t(AK,o.stackParser,n,e,r,i)}}},nRt=tRt;function rRt(){return iRt()?(pM&&I2(()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")}),!0):!1}function iRt(){var i;if(typeof Dr.window>"u")return!1;const t=Dr;if(t.nw)return!1;const e=t.chrome||t.browser;if(!((i=e==null?void 0:e.runtime)!=null&&i.id))return!1;const n=wK();return!(Dr===Dr.top&&/^(?:chrome-extension|moz-extension|ms-browser-extension|safari-web-extension):\/\//.test(n))}function sRt(t){return[e9t(),Z8t(),x9t(),NIt(),xIt(),UIt(),nRt(),m9t(),XIt(),VIt(),jIt()]}function oRt(t={}){const e=!t.skipBrowserExtensionCheck&&rRt();let n=t.defaultIntegrations==null?sRt():t.defaultIntegrations;const r={...t,enabled:e?!1:t.enabled,stackParser:Q6t(t.stackParser||vIt),integrations:h8t({integrations:t.integrations,defaultIntegrations:n}),transport:t.transport||iIt};return U8t(V9t,r)}function aRt(t){const e={...t};return TTe(e,"react"),s8t("react",{version:x.version}),oRt(e)}function lRt(){aRt({dsn:Z9.sentryDsn,environment:GBe,tracesSampleRate:0}),LUe({capture:(t,e)=>hTe(t,{extra:e}),breadcrumb:(t,e)=>d0({category:"error",level:"error",message:t instanceof Error?t.message:String(t),data:e})})}lRt();const zTe=document.getElementById("root");if(!zTe)throw new Error("Root element #root not found");const cRt=U7e.createRoot(zTe);cRt.render(m.jsx(U6t,{}));export{Vr as A,Ag as B,w5e as C,le as D,ht as E,fj as F,eot as G,Ftt as H,pr as I,gst as J,hj as L,yRt as N,pbe as P,Il as T,bst as a,MRt as b,ARt as c,Y2t as d,zs as e,Rst as f,TRt as g,ERt as h,Gwe as i,IRt as j,NRt as k,be as l,ol as m,hn as n,fU as o,bRt as p,yr as q,a2 as r,dst as s,ve as t,S0 as u,l2 as v,Fl as w,$I as x,Ist as y,qwe as z};
|