@vertebr/admin 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/runtime/api/catalog.d.ts +28 -4
  5. package/dist/runtime/api/catalog.d.ts.map +1 -1
  6. package/dist/runtime/api/catalog.js +41 -2
  7. package/dist/runtime/api/catalog.js.map +1 -1
  8. package/dist/runtime/api/public.d.ts.map +1 -1
  9. package/dist/runtime/api/public.js +10 -3
  10. package/dist/runtime/api/public.js.map +1 -1
  11. package/dist/runtime/api/routes.d.ts.map +1 -1
  12. package/dist/runtime/api/routes.js +11 -0
  13. package/dist/runtime/api/routes.js.map +1 -1
  14. package/dist/runtime/api/sync.d.ts +19 -0
  15. package/dist/runtime/api/sync.d.ts.map +1 -0
  16. package/dist/runtime/api/sync.js +183 -0
  17. package/dist/runtime/api/sync.js.map +1 -0
  18. package/dist/runtime/createAdmin.d.ts.map +1 -1
  19. package/dist/runtime/createAdmin.js +49 -1
  20. package/dist/runtime/createAdmin.js.map +1 -1
  21. package/dist/runtime/services/state.d.ts +7 -0
  22. package/dist/runtime/services/state.d.ts.map +1 -1
  23. package/dist/runtime/types/addon.d.ts +31 -0
  24. package/dist/runtime/types/addon.d.ts.map +1 -0
  25. package/dist/runtime/types/addon.js +9 -0
  26. package/dist/runtime/types/addon.js.map +1 -0
  27. package/dist/runtime/types/admin.d.ts +21 -0
  28. package/dist/runtime/types/admin.d.ts.map +1 -1
  29. package/dist/runtime/types/config.d.ts +1 -1
  30. package/dist/runtime/types/config.d.ts.map +1 -1
  31. package/dist/runtime/types/index.d.ts +3 -1
  32. package/dist/runtime/types/index.d.ts.map +1 -1
  33. package/dist/runtime/types/sync.d.ts +99 -0
  34. package/dist/runtime/types/sync.d.ts.map +1 -0
  35. package/dist/runtime/types/sync.js +3 -0
  36. package/dist/runtime/types/sync.js.map +1 -0
  37. package/dist/runtime/utils/http.d.ts +2 -0
  38. package/dist/runtime/utils/http.d.ts.map +1 -1
  39. package/dist/runtime/utils/http.js +24 -0
  40. package/dist/runtime/utils/http.js.map +1 -1
  41. package/package.json +1 -1
  42. package/static/assets/index-DdklZQ9o.js +338 -0
  43. package/static/assets/index-IVoZ2rM_.css +1 -0
  44. package/static/index.html +2 -2
  45. package/static/assets/index-BBl1r9rh.css +0 -1
  46. package/static/assets/index-Bc5ZsYlu.js +0 -337
@@ -1,337 +0,0 @@
1
- var nT=t=>{throw TypeError(t)};var rT=(t,e,n)=>e.has(t)||nT("Cannot "+n);var qn=(t,e,n)=>(rT(t,e,"read from private field"),n?n.call(t):e.get(t)),iT=(t,e,n)=>e.has(t)?nT("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Qb=(t,e,n,r)=>(rT(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);function Pz(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 RM(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ev={exports:{}},ju={};var sT;function zz(){if(sT)return ju;sT=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,s){var o=null;if(s!==void 0&&(o=""+s),i.key!==void 0&&(o=""+i.key),"key"in i){s={};for(var l in i)l!=="key"&&(s[l]=i[l])}else s=i;return i=s.ref,{$$typeof:t,type:r,key:o,ref:i!==void 0?i:null,props:s}}return ju.Fragment=e,ju.jsx=n,ju.jsxs=n,ju}var oT;function $z(){return oT||(oT=1,ev.exports=zz()),ev.exports}var y=$z(),tv={exports:{}},Je={};var aT;function Bz(){if(aT)return Je;aT=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),g=Symbol.iterator;function b(V){return V===null||typeof V!="object"?null:(V=g&&V[g]||V["@@iterator"],typeof V=="function"?V:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,k={};function C(V,Y,he){this.props=V,this.context=Y,this.refs=k,this.updater=he||x}C.prototype.isReactComponent={},C.prototype.setState=function(V,Y){if(typeof V!="object"&&typeof V!="function"&&V!=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,V,Y,"setState")},C.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function _(){}_.prototype=C.prototype;function M(V,Y,he){this.props=V,this.context=Y,this.refs=k,this.updater=he||x}var R=M.prototype=new _;R.constructor=M,S(R,C.prototype),R.isPureReactComponent=!0;var A=Array.isArray;function O(){}var D={H:null,A:null,T:null,S:null},j=Object.prototype.hasOwnProperty;function z(V,Y,he){var ve=he.ref;return{$$typeof:t,type:V,key:Y,ref:ve!==void 0?ve:null,props:he}}function q(V,Y){return z(V.type,Y,V.props)}function Z(V){return typeof V=="object"&&V!==null&&V.$$typeof===t}function G(V){var Y={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(he){return Y[he]})}var ee=/\/+/g;function te(V,Y){return typeof V=="object"&&V!==null&&V.key!=null?G(""+V.key):Y.toString(36)}function fe(V){switch(V.status){case"fulfilled":return V.value;case"rejected":throw V.reason;default:switch(typeof V.status=="string"?V.then(O,O):(V.status="pending",V.then(function(Y){V.status==="pending"&&(V.status="fulfilled",V.value=Y)},function(Y){V.status==="pending"&&(V.status="rejected",V.reason=Y)})),V.status){case"fulfilled":return V.value;case"rejected":throw V.reason}}throw V}function B(V,Y,he,ve,Ae){var Re=typeof V;(Re==="undefined"||Re==="boolean")&&(V=null);var Le=!1;if(V===null)Le=!0;else switch(Re){case"bigint":case"string":case"number":Le=!0;break;case"object":switch(V.$$typeof){case t:case e:Le=!0;break;case h:return Le=V._init,B(Le(V._payload),Y,he,ve,Ae)}}if(Le)return Ae=Ae(V),Le=ve===""?"."+te(V,0):ve,A(Ae)?(he="",Le!=null&&(he=Le.replace(ee,"$&/")+"/"),B(Ae,Y,he,"",function(pe){return pe})):Ae!=null&&(Z(Ae)&&(Ae=q(Ae,he+(Ae.key==null||V&&V.key===Ae.key?"":(""+Ae.key).replace(ee,"$&/")+"/")+Le)),Y.push(Ae)),1;Le=0;var Te=ve===""?".":ve+":";if(A(V))for(var oe=0;oe<V.length;oe++)ve=V[oe],Re=Te+te(ve,oe),Le+=B(ve,Y,he,Re,Ae);else if(oe=b(V),typeof oe=="function")for(V=oe.call(V),oe=0;!(ve=V.next()).done;)ve=ve.value,Re=Te+te(ve,oe++),Le+=B(ve,Y,he,Re,Ae);else if(Re==="object"){if(typeof V.then=="function")return B(fe(V),Y,he,ve,Ae);throw Y=String(V),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(V).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return Le}function L(V,Y,he){if(V==null)return V;var ve=[],Ae=0;return B(V,ve,"","",function(Re){return Y.call(he,Re,Ae++)}),ve}function U(V){if(V._status===-1){var Y=V._result;Y=Y(),Y.then(function(he){(V._status===0||V._status===-1)&&(V._status=1,V._result=he)},function(he){(V._status===0||V._status===-1)&&(V._status=2,V._result=he)}),V._status===-1&&(V._status=0,V._result=Y)}if(V._status===1)return V._result.default;throw V._result}var ue=typeof reportError=="function"?reportError:function(V){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof V=="object"&&V!==null&&typeof V.message=="string"?String(V.message):String(V),error:V});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",V);return}console.error(V)},Se={map:L,forEach:function(V,Y,he){L(V,function(){Y.apply(this,arguments)},he)},count:function(V){var Y=0;return L(V,function(){Y++}),Y},toArray:function(V){return L(V,function(Y){return Y})||[]},only:function(V){if(!Z(V))throw Error("React.Children.only expected to receive a single React element child.");return V}};return Je.Activity=m,Je.Children=Se,Je.Component=C,Je.Fragment=n,Je.Profiler=i,Je.PureComponent=M,Je.StrictMode=r,Je.Suspense=u,Je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,Je.__COMPILER_RUNTIME={__proto__:null,c:function(V){return D.H.useMemoCache(V)}},Je.cache=function(V){return function(){return V.apply(null,arguments)}},Je.cacheSignal=function(){return null},Je.cloneElement=function(V,Y,he){if(V==null)throw Error("The argument must be a React element, but you passed "+V+".");var ve=S({},V.props),Ae=V.key;if(Y!=null)for(Re in Y.key!==void 0&&(Ae=""+Y.key),Y)!j.call(Y,Re)||Re==="key"||Re==="__self"||Re==="__source"||Re==="ref"&&Y.ref===void 0||(ve[Re]=Y[Re]);var Re=arguments.length-2;if(Re===1)ve.children=he;else if(1<Re){for(var Le=Array(Re),Te=0;Te<Re;Te++)Le[Te]=arguments[Te+2];ve.children=Le}return z(V.type,Ae,ve)},Je.createContext=function(V){return V={$$typeof:o,_currentValue:V,_currentValue2:V,_threadCount:0,Provider:null,Consumer:null},V.Provider=V,V.Consumer={$$typeof:s,_context:V},V},Je.createElement=function(V,Y,he){var ve,Ae={},Re=null;if(Y!=null)for(ve in Y.key!==void 0&&(Re=""+Y.key),Y)j.call(Y,ve)&&ve!=="key"&&ve!=="__self"&&ve!=="__source"&&(Ae[ve]=Y[ve]);var Le=arguments.length-2;if(Le===1)Ae.children=he;else if(1<Le){for(var Te=Array(Le),oe=0;oe<Le;oe++)Te[oe]=arguments[oe+2];Ae.children=Te}if(V&&V.defaultProps)for(ve in Le=V.defaultProps,Le)Ae[ve]===void 0&&(Ae[ve]=Le[ve]);return z(V,Re,Ae)},Je.createRef=function(){return{current:null}},Je.forwardRef=function(V){return{$$typeof:l,render:V}},Je.isValidElement=Z,Je.lazy=function(V){return{$$typeof:h,_payload:{_status:-1,_result:V},_init:U}},Je.memo=function(V,Y){return{$$typeof:f,type:V,compare:Y===void 0?null:Y}},Je.startTransition=function(V){var Y=D.T,he={};D.T=he;try{var ve=V(),Ae=D.S;Ae!==null&&Ae(he,ve),typeof ve=="object"&&ve!==null&&typeof ve.then=="function"&&ve.then(O,ue)}catch(Re){ue(Re)}finally{Y!==null&&he.types!==null&&(Y.types=he.types),D.T=Y}},Je.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},Je.use=function(V){return D.H.use(V)},Je.useActionState=function(V,Y,he){return D.H.useActionState(V,Y,he)},Je.useCallback=function(V,Y){return D.H.useCallback(V,Y)},Je.useContext=function(V){return D.H.useContext(V)},Je.useDebugValue=function(){},Je.useDeferredValue=function(V,Y){return D.H.useDeferredValue(V,Y)},Je.useEffect=function(V,Y){return D.H.useEffect(V,Y)},Je.useEffectEvent=function(V){return D.H.useEffectEvent(V)},Je.useId=function(){return D.H.useId()},Je.useImperativeHandle=function(V,Y,he){return D.H.useImperativeHandle(V,Y,he)},Je.useInsertionEffect=function(V,Y){return D.H.useInsertionEffect(V,Y)},Je.useLayoutEffect=function(V,Y){return D.H.useLayoutEffect(V,Y)},Je.useMemo=function(V,Y){return D.H.useMemo(V,Y)},Je.useOptimistic=function(V,Y){return D.H.useOptimistic(V,Y)},Je.useReducer=function(V,Y,he){return D.H.useReducer(V,Y,he)},Je.useRef=function(V){return D.H.useRef(V)},Je.useState=function(V){return D.H.useState(V)},Je.useSyncExternalStore=function(V,Y,he){return D.H.useSyncExternalStore(V,Y,he)},Je.useTransition=function(){return D.H.useTransition()},Je.version="19.2.8",Je}var lT;function Wd(){return lT||(lT=1,tv.exports=Bz()),tv.exports}var E=Wd();const Ge=RM(E),Kd=Pz({__proto__:null,default:Ge},[E]);var nv={exports:{}},Lu={},rv={exports:{}},iv={};var cT;function Vz(){return cT||(cT=1,(function(t){function e(B,L){var U=B.length;B.push(L);e:for(;0<U;){var ue=U-1>>>1,Se=B[ue];if(0<i(Se,L))B[ue]=L,B[U]=Se,U=ue;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var L=B[0],U=B.pop();if(U!==L){B[0]=U;e:for(var ue=0,Se=B.length,V=Se>>>1;ue<V;){var Y=2*(ue+1)-1,he=B[Y],ve=Y+1,Ae=B[ve];if(0>i(he,U))ve<Se&&0>i(Ae,he)?(B[ue]=Ae,B[ve]=U,ue=ve):(B[ue]=he,B[Y]=U,ue=Y);else if(ve<Se&&0>i(Ae,U))B[ue]=Ae,B[ve]=U,ue=ve;else break e}}return L}function i(B,L){var U=B.sortIndex-L.sortIndex;return U!==0?U:B.id-L.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,l=o.now();t.unstable_now=function(){return o.now()-l}}var u=[],f=[],h=1,m=null,g=3,b=!1,x=!1,S=!1,k=!1,C=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function R(B){for(var L=n(f);L!==null;){if(L.callback===null)r(f);else if(L.startTime<=B)r(f),L.sortIndex=L.expirationTime,e(u,L);else break;L=n(f)}}function A(B){if(S=!1,R(B),!x)if(n(u)!==null)x=!0,O||(O=!0,G());else{var L=n(f);L!==null&&fe(A,L.startTime-B)}}var O=!1,D=-1,j=5,z=-1;function q(){return k?!0:!(t.unstable_now()-z<j)}function Z(){if(k=!1,O){var B=t.unstable_now();z=B;var L=!0;try{e:{x=!1,S&&(S=!1,_(D),D=-1),b=!0;var U=g;try{t:{for(R(B),m=n(u);m!==null&&!(m.expirationTime>B&&q());){var ue=m.callback;if(typeof ue=="function"){m.callback=null,g=m.priorityLevel;var Se=ue(m.expirationTime<=B);if(B=t.unstable_now(),typeof Se=="function"){m.callback=Se,R(B),L=!0;break t}m===n(u)&&r(u),R(B)}else r(u);m=n(u)}if(m!==null)L=!0;else{var V=n(f);V!==null&&fe(A,V.startTime-B),L=!1}}break e}finally{m=null,g=U,b=!1}L=void 0}}finally{L?G():O=!1}}}var G;if(typeof M=="function")G=function(){M(Z)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,te=ee.port2;ee.port1.onmessage=Z,G=function(){te.postMessage(null)}}else G=function(){C(Z,0)};function fe(B,L){D=C(function(){B(t.unstable_now())},L)}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(B){B.callback=null},t.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<B?Math.floor(1e3/B):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_next=function(B){switch(g){case 1:case 2:case 3:var L=3;break;default:L=g}var U=g;g=L;try{return B()}finally{g=U}},t.unstable_requestPaint=function(){k=!0},t.unstable_runWithPriority=function(B,L){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var U=g;g=B;try{return L()}finally{g=U}},t.unstable_scheduleCallback=function(B,L,U){var ue=t.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?ue+U:ue):U=ue,B){case 1:var Se=-1;break;case 2:Se=250;break;case 5:Se=1073741823;break;case 4:Se=1e4;break;default:Se=5e3}return Se=U+Se,B={id:h++,callback:L,priorityLevel:B,startTime:U,expirationTime:Se,sortIndex:-1},U>ue?(B.sortIndex=U,e(f,B),n(u)===null&&B===n(f)&&(S?(_(D),D=-1):S=!0,fe(A,U-ue))):(B.sortIndex=Se,e(u,B),x||b||(x=!0,O||(O=!0,G()))),B},t.unstable_shouldYield=q,t.unstable_wrapCallback=function(B){var L=g;return function(){var U=g;g=L;try{return B.apply(this,arguments)}finally{g=U}}}})(iv)),iv}var uT;function Hz(){return uT||(uT=1,rv.exports=Vz()),rv.exports}var sv={exports:{}},Gn={};var dT;function Uz(){if(dT)return Gn;dT=1;var t=Wd();function e(u){var f="https://react.dev/errors/"+u;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)f+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+u+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(u,f,h){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:m==null?null:""+m,children:u,containerInfo:f,implementation:h}}var o=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(u,f){if(u==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Gn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Gn.createPortal=function(u,f){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(e(299));return s(u,f,null,h)},Gn.flushSync=function(u){var f=o.T,h=r.p;try{if(o.T=null,r.p=2,u)return u()}finally{o.T=f,r.p=h,r.d.f()}},Gn.preconnect=function(u,f){typeof u=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,r.d.C(u,f))},Gn.prefetchDNS=function(u){typeof u=="string"&&r.d.D(u)},Gn.preinit=function(u,f){if(typeof u=="string"&&f&&typeof f.as=="string"){var h=f.as,m=l(h,f.crossOrigin),g=typeof f.integrity=="string"?f.integrity:void 0,b=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;h==="style"?r.d.S(u,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:m,integrity:g,fetchPriority:b}):h==="script"&&r.d.X(u,{crossOrigin:m,integrity:g,fetchPriority:b,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Gn.preinitModule=function(u,f){if(typeof u=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var h=l(f.as,f.crossOrigin);r.d.M(u,{crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&r.d.M(u)},Gn.preload=function(u,f){if(typeof u=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var h=f.as,m=l(h,f.crossOrigin);r.d.L(u,h,{crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},Gn.preloadModule=function(u,f){if(typeof u=="string")if(f){var h=l(f.as,f.crossOrigin);r.d.m(u,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else r.d.m(u)},Gn.requestFormReset=function(u){r.d.r(u)},Gn.unstable_batchedUpdates=function(u,f){return u(f)},Gn.useFormState=function(u,f,h){return o.H.useFormState(u,f,h)},Gn.useFormStatus=function(){return o.H.useHostTransitionStatus()},Gn.version="19.2.8",Gn}var fT;function MM(){if(fT)return sv.exports;fT=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),sv.exports=Uz(),sv.exports}var hT;function Fz(){if(hT)return Lu;hT=1;var t=Hz(),e=Wd(),n=MM();function r(a){var c="https://react.dev/errors/"+a;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)c+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+a+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function s(a){var c=a,d=a;if(a.alternate)for(;c.return;)c=c.return;else{a=c;do c=a,(c.flags&4098)!==0&&(d=c.return),a=c.return;while(a)}return c.tag===3?d:null}function o(a){if(a.tag===13){var c=a.memoizedState;if(c===null&&(a=a.alternate,a!==null&&(c=a.memoizedState)),c!==null)return c.dehydrated}return null}function l(a){if(a.tag===31){var c=a.memoizedState;if(c===null&&(a=a.alternate,a!==null&&(c=a.memoizedState)),c!==null)return c.dehydrated}return null}function u(a){if(s(a)!==a)throw Error(r(188))}function f(a){var c=a.alternate;if(!c){if(c=s(a),c===null)throw Error(r(188));return c!==a?null:a}for(var d=a,p=c;;){var v=d.return;if(v===null)break;var w=v.alternate;if(w===null){if(p=v.return,p!==null){d=p;continue}break}if(v.child===w.child){for(w=v.child;w;){if(w===d)return u(v),a;if(w===p)return u(v),c;w=w.sibling}throw Error(r(188))}if(d.return!==p.return)d=v,p=w;else{for(var T=!1,N=v.child;N;){if(N===d){T=!0,d=v,p=w;break}if(N===p){T=!0,p=v,d=w;break}N=N.sibling}if(!T){for(N=w.child;N;){if(N===d){T=!0,d=w,p=v;break}if(N===p){T=!0,p=w,d=v;break}N=N.sibling}if(!T)throw Error(r(189))}}if(d.alternate!==p)throw Error(r(190))}if(d.tag!==3)throw Error(r(188));return d.stateNode.current===d?a:c}function h(a){var c=a.tag;if(c===5||c===26||c===27||c===6)return a;for(a=a.child;a!==null;){if(c=h(a),c!==null)return c;a=a.sibling}return null}var m=Object.assign,g=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),M=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),z=Symbol.for("react.activity"),q=Symbol.for("react.memo_cache_sentinel"),Z=Symbol.iterator;function G(a){return a===null||typeof a!="object"?null:(a=Z&&a[Z]||a["@@iterator"],typeof a=="function"?a:null)}var ee=Symbol.for("react.client.reference");function te(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===ee?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case S:return"Fragment";case C:return"Profiler";case k:return"StrictMode";case A:return"Suspense";case O:return"SuspenseList";case z:return"Activity"}if(typeof a=="object")switch(a.$$typeof){case x:return"Portal";case M:return a.displayName||"Context";case _:return(a._context.displayName||"Context")+".Consumer";case R:var c=a.render;return a=a.displayName,a||(a=c.displayName||c.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case D:return c=a.displayName||null,c!==null?c:te(a.type)||"Memo";case j:c=a._payload,a=a._init;try{return te(a(c))}catch{}}return null}var fe=Array.isArray,B=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U={pending:!1,data:null,method:null,action:null},ue=[],Se=-1;function V(a){return{current:a}}function Y(a){0>Se||(a.current=ue[Se],ue[Se]=null,Se--)}function he(a,c){Se++,ue[Se]=a.current,a.current=c}var ve=V(null),Ae=V(null),Re=V(null),Le=V(null);function Te(a,c){switch(he(Re,c),he(Ae,a),he(ve,null),c.nodeType){case 9:case 11:a=(a=c.documentElement)&&(a=a.namespaceURI)?EE(a):0;break;default:if(a=c.tagName,c=c.namespaceURI)c=EE(c),a=TE(c,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}Y(ve),he(ve,a)}function oe(){Y(ve),Y(Ae),Y(Re)}function pe(a){a.memoizedState!==null&&he(Le,a);var c=ve.current,d=TE(c,a.type);c!==d&&(he(Ae,a),he(ve,d))}function Ie(a){Ae.current===a&&(Y(ve),Y(Ae)),Le.current===a&&(Y(Le),Nu._currentValue=U)}var Ue,Ze;function ft(a){if(Ue===void 0)try{throw Error()}catch(d){var c=d.stack.trim().match(/\n( *(at )?)/);Ue=c&&c[1]||"",Ze=-1<d.stack.indexOf(`
2
- at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+Ue+a+Ze}var vt=!1;function Kt(a,c){if(!a||vt)return"";vt=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var p={DetermineComponentFrameRoot:function(){try{if(c){var ce=function(){throw Error()};if(Object.defineProperty(ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ce,[])}catch(ne){var Q=ne}Reflect.construct(a,[],ce)}else{try{ce.call()}catch(ne){Q=ne}a.call(ce.prototype)}}else{try{throw Error()}catch(ne){Q=ne}(ce=a())&&typeof ce.catch=="function"&&ce.catch(function(){})}}catch(ne){if(ne&&Q&&typeof ne.stack=="string")return[ne.stack,Q.stack]}return[null,null]}};p.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(p.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(p.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var w=p.DetermineComponentFrameRoot(),T=w[0],N=w[1];if(T&&N){var $=T.split(`
4
- `),J=N.split(`
5
- `);for(v=p=0;p<$.length&&!$[p].includes("DetermineComponentFrameRoot");)p++;for(;v<J.length&&!J[v].includes("DetermineComponentFrameRoot");)v++;if(p===$.length||v===J.length)for(p=$.length-1,v=J.length-1;1<=p&&0<=v&&$[p]!==J[v];)v--;for(;1<=p&&0<=v;p--,v--)if($[p]!==J[v]){if(p!==1||v!==1)do if(p--,v--,0>v||$[p]!==J[v]){var se=`
6
- `+$[p].replace(" at new "," at ");return a.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",a.displayName)),se}while(1<=p&&0<=v);break}}}finally{vt=!1,Error.prepareStackTrace=d}return(d=a?a.displayName||a.name:"")?ft(d):""}function vn(a,c){switch(a.tag){case 26:case 27:case 5:return ft(a.type);case 16:return ft("Lazy");case 13:return a.child!==c&&c!==null?ft("Suspense Fallback"):ft("Suspense");case 19:return ft("SuspenseList");case 0:case 15:return Kt(a.type,!1);case 11:return Kt(a.type.render,!1);case 1:return Kt(a.type,!0);case 31:return ft("Activity");default:return""}}function Zt(a){try{var c="",d=null;do c+=vn(a,d),d=a,a=a.return;while(a);return c}catch(p){return`
7
- Error generating stack: `+p.message+`
8
- `+p.stack}}var Nn=Object.prototype.hasOwnProperty,nn=t.unstable_scheduleCallback,br=t.unstable_cancelCallback,Pr=t.unstable_shouldYield,vr=t.unstable_requestPaint,qt=t.unstable_now,si=t.unstable_getCurrentPriorityLevel,xr=t.unstable_ImmediatePriority,zr=t.unstable_UserBlockingPriority,Fn=t.unstable_NormalPriority,ge=t.unstable_LowPriority,Ne=t.unstable_IdlePriority,I=t.log,P=t.unstable_setDisableYieldValue,H=null,ie=null;function ae(a){if(typeof I=="function"&&P(a),ie&&typeof ie.setStrictMode=="function")try{ie.setStrictMode(H,a)}catch{}}var ye=Math.clz32?Math.clz32:Be,ke=Math.log,_e=Math.LN2;function Be(a){return a>>>=0,a===0?32:31-(ke(a)/_e|0)|0}var it=256,_t=262144,xn=4194304;function me(a){var c=a&42;if(c!==0)return c;switch(a&-a){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 a&261888;case 262144:case 524288:case 1048576:case 2097152:return a&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return a&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return a}}function K(a,c,d){var p=a.pendingLanes;if(p===0)return 0;var v=0,w=a.suspendedLanes,T=a.pingedLanes;a=a.warmLanes;var N=p&134217727;return N!==0?(p=N&~w,p!==0?v=me(p):(T&=N,T!==0?v=me(T):d||(d=N&~a,d!==0&&(v=me(d))))):(N=p&~w,N!==0?v=me(N):T!==0?v=me(T):d||(d=p&~a,d!==0&&(v=me(d)))),v===0?0:c!==0&&c!==v&&(c&w)===0&&(w=v&-v,d=c&-c,w>=d||w===32&&(d&4194048)!==0)?c:v}function re(a,c){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&c)===0}function we(a,c){switch(a){case 1:case 2:case 4:case 8:case 64:return c+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 c+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 Fe(){var a=xn;return xn<<=1,(xn&62914560)===0&&(xn=4194304),a}function pt(a){for(var c=[],d=0;31>d;d++)c.push(a);return c}function ln(a,c){a.pendingLanes|=c,c!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function Ui(a,c,d,p,v,w){var T=a.pendingLanes;a.pendingLanes=d,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=d,a.entangledLanes&=d,a.errorRecoveryDisabledLanes&=d,a.shellSuspendCounter=0;var N=a.entanglements,$=a.expirationTimes,J=a.hiddenUpdates;for(d=T&~d;0<d;){var se=31-ye(d),ce=1<<se;N[se]=0,$[se]=-1;var Q=J[se];if(Q!==null)for(J[se]=null,se=0;se<Q.length;se++){var ne=Q[se];ne!==null&&(ne.lane&=-536870913)}d&=~ce}p!==0&&$r(a,p,0),w!==0&&v===0&&a.tag!==0&&(a.suspendedLanes|=w&~(T&~c))}function $r(a,c,d){a.pendingLanes|=c,a.suspendedLanes&=~c;var p=31-ye(c);a.entangledLanes|=c,a.entanglements[p]=a.entanglements[p]|1073741824|d&261930}function al(a,c){var d=a.entangledLanes|=c;for(a=a.entanglements;d;){var p=31-ye(d),v=1<<p;v&c|a[p]&c&&(a[p]|=c),d&=~v}}function qc(a,c){var d=c&-c;return d=(d&42)!==0?1:na(d),(d&(a.suspendedLanes|c))!==0?0:d}function na(a){switch(a){case 2:a=1;break;case 8:a=4;break;case 32:a=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:a=128;break;case 268435456:a=134217728;break;default:a=0}return a}function Ug(a){return a&=-a,2<a?8<a?(a&134217727)!==0?32:268435456:8:2}function uk(){var a=L.p;return a!==0?a:(a=window.event,a===void 0?32:ZE(a.type))}function dk(a,c){var d=L.p;try{return L.p=a,c()}finally{L.p=d}}var Bs=Math.random().toString(36).slice(2),On="__reactFiber$"+Bs,lr="__reactProps$"+Bs,ll="__reactContainer$"+Bs,Fg="__reactEvents$"+Bs,T2="__reactListeners$"+Bs,_2="__reactHandles$"+Bs,fk="__reactResources$"+Bs,Gc="__reactMarker$"+Bs;function qg(a){delete a[On],delete a[lr],delete a[Fg],delete a[T2],delete a[_2]}function cl(a){var c=a[On];if(c)return c;for(var d=a.parentNode;d;){if(c=d[ll]||d[On]){if(d=c.alternate,c.child!==null||d!==null&&d.child!==null)for(a=DE(a);a!==null;){if(d=a[On])return d;a=DE(a)}return c}a=d,d=a.parentNode}return null}function ul(a){if(a=a[On]||a[ll]){var c=a.tag;if(c===5||c===6||c===13||c===31||c===26||c===27||c===3)return a}return null}function Wc(a){var c=a.tag;if(c===5||c===26||c===27||c===6)return a.stateNode;throw Error(r(33))}function dl(a){var c=a[fk];return c||(c=a[fk]={hoistableStyles:new Map,hoistableScripts:new Map}),c}function Sn(a){a[Gc]=!0}var hk=new Set,pk={};function ra(a,c){fl(a,c),fl(a+"Capture",c)}function fl(a,c){for(pk[a]=c,a=0;a<c.length;a++)hk.add(c[a])}var A2=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]*$"),mk={},gk={};function R2(a){return Nn.call(gk,a)?!0:Nn.call(mk,a)?!1:A2.test(a)?gk[a]=!0:(mk[a]=!0,!1)}function mf(a,c,d){if(R2(c))if(d===null)a.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":a.removeAttribute(c);return;case"boolean":var p=c.toLowerCase().slice(0,5);if(p!=="data-"&&p!=="aria-"){a.removeAttribute(c);return}}a.setAttribute(c,""+d)}}function gf(a,c,d){if(d===null)a.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(c);return}a.setAttribute(c,""+d)}}function Fi(a,c,d,p){if(p===null)a.removeAttribute(d);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(d);return}a.setAttributeNS(c,d,""+p)}}function Br(a){switch(typeof a){case"bigint":case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function yk(a){var c=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function M2(a,c,d){var p=Object.getOwnPropertyDescriptor(a.constructor.prototype,c);if(!a.hasOwnProperty(c)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var v=p.get,w=p.set;return Object.defineProperty(a,c,{configurable:!0,get:function(){return v.call(this)},set:function(T){d=""+T,w.call(this,T)}}),Object.defineProperty(a,c,{enumerable:p.enumerable}),{getValue:function(){return d},setValue:function(T){d=""+T},stopTracking:function(){a._valueTracker=null,delete a[c]}}}}function Gg(a){if(!a._valueTracker){var c=yk(a)?"checked":"value";a._valueTracker=M2(a,c,""+a[c])}}function bk(a){if(!a)return!1;var c=a._valueTracker;if(!c)return!0;var d=c.getValue(),p="";return a&&(p=yk(a)?a.checked?"true":"false":a.value),a=p,a!==d?(c.setValue(a),!0):!1}function yf(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}var N2=/[\n"\\]/g;function Vr(a){return a.replace(N2,function(c){return"\\"+c.charCodeAt(0).toString(16)+" "})}function Wg(a,c,d,p,v,w,T,N){a.name="",T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?a.type=T:a.removeAttribute("type"),c!=null?T==="number"?(c===0&&a.value===""||a.value!=c)&&(a.value=""+Br(c)):a.value!==""+Br(c)&&(a.value=""+Br(c)):T!=="submit"&&T!=="reset"||a.removeAttribute("value"),c!=null?Kg(a,T,Br(c)):d!=null?Kg(a,T,Br(d)):p!=null&&a.removeAttribute("value"),v==null&&w!=null&&(a.defaultChecked=!!w),v!=null&&(a.checked=v&&typeof v!="function"&&typeof v!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?a.name=""+Br(N):a.removeAttribute("name")}function vk(a,c,d,p,v,w,T,N){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(a.type=w),c!=null||d!=null){if(!(w!=="submit"&&w!=="reset"||c!=null)){Gg(a);return}d=d!=null?""+Br(d):"",c=c!=null?""+Br(c):d,N||c===a.value||(a.value=c),a.defaultValue=c}p=p??v,p=typeof p!="function"&&typeof p!="symbol"&&!!p,a.checked=N?a.checked:!!p,a.defaultChecked=!!p,T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(a.name=T),Gg(a)}function Kg(a,c,d){c==="number"&&yf(a.ownerDocument)===a||a.defaultValue===""+d||(a.defaultValue=""+d)}function hl(a,c,d,p){if(a=a.options,c){c={};for(var v=0;v<d.length;v++)c["$"+d[v]]=!0;for(d=0;d<a.length;d++)v=c.hasOwnProperty("$"+a[d].value),a[d].selected!==v&&(a[d].selected=v),v&&p&&(a[d].defaultSelected=!0)}else{for(d=""+Br(d),c=null,v=0;v<a.length;v++){if(a[v].value===d){a[v].selected=!0,p&&(a[v].defaultSelected=!0);return}c!==null||a[v].disabled||(c=a[v])}c!==null&&(c.selected=!0)}}function xk(a,c,d){if(c!=null&&(c=""+Br(c),c!==a.value&&(a.value=c),d==null)){a.defaultValue!==c&&(a.defaultValue=c);return}a.defaultValue=d!=null?""+Br(d):""}function wk(a,c,d,p){if(c==null){if(p!=null){if(d!=null)throw Error(r(92));if(fe(p)){if(1<p.length)throw Error(r(93));p=p[0]}d=p}d==null&&(d=""),c=d}d=Br(c),a.defaultValue=d,p=a.textContent,p===d&&p!==""&&p!==null&&(a.value=p),Gg(a)}function pl(a,c){if(c){var d=a.firstChild;if(d&&d===a.lastChild&&d.nodeType===3){d.nodeValue=c;return}}a.textContent=c}var O2=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 Sk(a,c,d){var p=c.indexOf("--")===0;d==null||typeof d=="boolean"||d===""?p?a.setProperty(c,""):c==="float"?a.cssFloat="":a[c]="":p?a.setProperty(c,d):typeof d!="number"||d===0||O2.has(c)?c==="float"?a.cssFloat=d:a[c]=(""+d).trim():a[c]=d+"px"}function kk(a,c,d){if(c!=null&&typeof c!="object")throw Error(r(62));if(a=a.style,d!=null){for(var p in d)!d.hasOwnProperty(p)||c!=null&&c.hasOwnProperty(p)||(p.indexOf("--")===0?a.setProperty(p,""):p==="float"?a.cssFloat="":a[p]="");for(var v in c)p=c[v],c.hasOwnProperty(v)&&d[v]!==p&&Sk(a,v,p)}else for(var w in c)c.hasOwnProperty(w)&&Sk(a,w,c[w])}function Zg(a){if(a.indexOf("-")===-1)return!1;switch(a){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 D2=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"]]),I2=/^[\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 bf(a){return I2.test(""+a)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":a}function qi(){}var Yg=null;function Xg(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var ml=null,gl=null;function Ck(a){var c=ul(a);if(c&&(a=c.stateNode)){var d=a[lr]||null;e:switch(a=c.stateNode,c.type){case"input":if(Wg(a,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name),c=d.name,d.type==="radio"&&c!=null){for(d=a;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll('input[name="'+Vr(""+c)+'"][type="radio"]'),c=0;c<d.length;c++){var p=d[c];if(p!==a&&p.form===a.form){var v=p[lr]||null;if(!v)throw Error(r(90));Wg(p,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(c=0;c<d.length;c++)p=d[c],p.form===a.form&&bk(p)}break e;case"textarea":xk(a,d.value,d.defaultValue);break e;case"select":c=d.value,c!=null&&hl(a,!!d.multiple,c,!1)}}}var Jg=!1;function Ek(a,c,d){if(Jg)return a(c,d);Jg=!0;try{var p=a(c);return p}finally{if(Jg=!1,(ml!==null||gl!==null)&&(sh(),ml&&(c=ml,a=gl,gl=ml=null,Ck(c),a)))for(c=0;c<a.length;c++)Ck(a[c])}}function Kc(a,c){var d=a.stateNode;if(d===null)return null;var p=d[lr]||null;if(p===null)return null;d=p[c];e:switch(c){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(p=!p.disabled)||(a=a.type,p=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!p;break e;default:a=!1}if(a)return null;if(d&&typeof d!="function")throw Error(r(231,c,typeof d));return d}var Gi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qg=!1;if(Gi)try{var Zc={};Object.defineProperty(Zc,"passive",{get:function(){Qg=!0}}),window.addEventListener("test",Zc,Zc),window.removeEventListener("test",Zc,Zc)}catch{Qg=!1}var Vs=null,ey=null,vf=null;function Tk(){if(vf)return vf;var a,c=ey,d=c.length,p,v="value"in Vs?Vs.value:Vs.textContent,w=v.length;for(a=0;a<d&&c[a]===v[a];a++);var T=d-a;for(p=1;p<=T&&c[d-p]===v[w-p];p++);return vf=v.slice(a,1<p?1-p:void 0)}function xf(a){var c=a.keyCode;return"charCode"in a?(a=a.charCode,a===0&&c===13&&(a=13)):a=c,a===10&&(a=13),32<=a||a===13?a:0}function wf(){return!0}function _k(){return!1}function cr(a){function c(d,p,v,w,T){this._reactName=d,this._targetInst=v,this.type=p,this.nativeEvent=w,this.target=T,this.currentTarget=null;for(var N in a)a.hasOwnProperty(N)&&(d=a[N],this[N]=d?d(w):w[N]);return this.isDefaultPrevented=(w.defaultPrevented!=null?w.defaultPrevented:w.returnValue===!1)?wf:_k,this.isPropagationStopped=_k,this}return m(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=wf)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=wf)},persist:function(){},isPersistent:wf}),c}var ia={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Sf=cr(ia),Yc=m({},ia,{view:0,detail:0}),j2=cr(Yc),ty,ny,Xc,kf=m({},Yc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:iy,button:0,buttons:0,relatedTarget:function(a){return a.relatedTarget===void 0?a.fromElement===a.srcElement?a.toElement:a.fromElement:a.relatedTarget},movementX:function(a){return"movementX"in a?a.movementX:(a!==Xc&&(Xc&&a.type==="mousemove"?(ty=a.screenX-Xc.screenX,ny=a.screenY-Xc.screenY):ny=ty=0,Xc=a),ty)},movementY:function(a){return"movementY"in a?a.movementY:ny}}),Ak=cr(kf),L2=m({},kf,{dataTransfer:0}),P2=cr(L2),z2=m({},Yc,{relatedTarget:0}),ry=cr(z2),$2=m({},ia,{animationName:0,elapsedTime:0,pseudoElement:0}),B2=cr($2),V2=m({},ia,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),H2=cr(V2),U2=m({},ia,{data:0}),Rk=cr(U2),F2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},q2={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"},G2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function W2(a){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(a):(a=G2[a])?!!c[a]:!1}function iy(){return W2}var K2=m({},Yc,{key:function(a){if(a.key){var c=F2[a.key]||a.key;if(c!=="Unidentified")return c}return a.type==="keypress"?(a=xf(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?q2[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:iy,charCode:function(a){return a.type==="keypress"?xf(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?xf(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),Z2=cr(K2),Y2=m({},kf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Mk=cr(Y2),X2=m({},Yc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:iy}),J2=cr(X2),Q2=m({},ia,{propertyName:0,elapsedTime:0,pseudoElement:0}),eP=cr(Q2),tP=m({},kf,{deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),nP=cr(tP),rP=m({},ia,{newState:0,oldState:0}),iP=cr(rP),sP=[9,13,27,32],sy=Gi&&"CompositionEvent"in window,Jc=null;Gi&&"documentMode"in document&&(Jc=document.documentMode);var oP=Gi&&"TextEvent"in window&&!Jc,Nk=Gi&&(!sy||Jc&&8<Jc&&11>=Jc),Ok=" ",Dk=!1;function Ik(a,c){switch(a){case"keyup":return sP.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jk(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var yl=!1;function aP(a,c){switch(a){case"compositionend":return jk(c);case"keypress":return c.which!==32?null:(Dk=!0,Ok);case"textInput":return a=c.data,a===Ok&&Dk?null:a;default:return null}}function lP(a,c){if(yl)return a==="compositionend"||!sy&&Ik(a,c)?(a=Tk(),vf=ey=Vs=null,yl=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1<c.char.length)return c.char;if(c.which)return String.fromCharCode(c.which)}return null;case"compositionend":return Nk&&c.locale!=="ko"?null:c.data;default:return null}}var cP={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 Lk(a){var c=a&&a.nodeName&&a.nodeName.toLowerCase();return c==="input"?!!cP[a.type]:c==="textarea"}function Pk(a,c,d,p){ml?gl?gl.push(p):gl=[p]:ml=p,c=fh(c,"onChange"),0<c.length&&(d=new Sf("onChange","change",null,d,p),a.push({event:d,listeners:c}))}var Qc=null,eu=null;function uP(a){vE(a,0)}function Cf(a){var c=Wc(a);if(bk(c))return a}function zk(a,c){if(a==="change")return c}var $k=!1;if(Gi){var oy;if(Gi){var ay="oninput"in document;if(!ay){var Bk=document.createElement("div");Bk.setAttribute("oninput","return;"),ay=typeof Bk.oninput=="function"}oy=ay}else oy=!1;$k=oy&&(!document.documentMode||9<document.documentMode)}function Vk(){Qc&&(Qc.detachEvent("onpropertychange",Hk),eu=Qc=null)}function Hk(a){if(a.propertyName==="value"&&Cf(eu)){var c=[];Pk(c,eu,a,Xg(a)),Ek(uP,c)}}function dP(a,c,d){a==="focusin"?(Vk(),Qc=c,eu=d,Qc.attachEvent("onpropertychange",Hk)):a==="focusout"&&Vk()}function fP(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return Cf(eu)}function hP(a,c){if(a==="click")return Cf(c)}function pP(a,c){if(a==="input"||a==="change")return Cf(c)}function mP(a,c){return a===c&&(a!==0||1/a===1/c)||a!==a&&c!==c}var wr=typeof Object.is=="function"?Object.is:mP;function tu(a,c){if(wr(a,c))return!0;if(typeof a!="object"||a===null||typeof c!="object"||c===null)return!1;var d=Object.keys(a),p=Object.keys(c);if(d.length!==p.length)return!1;for(p=0;p<d.length;p++){var v=d[p];if(!Nn.call(c,v)||!wr(a[v],c[v]))return!1}return!0}function Uk(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function Fk(a,c){var d=Uk(a);a=0;for(var p;d;){if(d.nodeType===3){if(p=a+d.textContent.length,a<=c&&p>=c)return{node:d,offset:c-a};a=p}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=Uk(d)}}function qk(a,c){return a&&c?a===c?!0:a&&a.nodeType===3?!1:c&&c.nodeType===3?qk(a,c.parentNode):"contains"in a?a.contains(c):a.compareDocumentPosition?!!(a.compareDocumentPosition(c)&16):!1:!1}function Gk(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var c=yf(a.document);c instanceof a.HTMLIFrameElement;){try{var d=typeof c.contentWindow.location.href=="string"}catch{d=!1}if(d)a=c.contentWindow;else break;c=yf(a.document)}return c}function ly(a){var c=a&&a.nodeName&&a.nodeName.toLowerCase();return c&&(c==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||c==="textarea"||a.contentEditable==="true")}var gP=Gi&&"documentMode"in document&&11>=document.documentMode,bl=null,cy=null,nu=null,uy=!1;function Wk(a,c,d){var p=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;uy||bl==null||bl!==yf(p)||(p=bl,"selectionStart"in p&&ly(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),nu&&tu(nu,p)||(nu=p,p=fh(cy,"onSelect"),0<p.length&&(c=new Sf("onSelect","select",null,c,d),a.push({event:c,listeners:p}),c.target=bl)))}function sa(a,c){var d={};return d[a.toLowerCase()]=c.toLowerCase(),d["Webkit"+a]="webkit"+c,d["Moz"+a]="moz"+c,d}var vl={animationend:sa("Animation","AnimationEnd"),animationiteration:sa("Animation","AnimationIteration"),animationstart:sa("Animation","AnimationStart"),transitionrun:sa("Transition","TransitionRun"),transitionstart:sa("Transition","TransitionStart"),transitioncancel:sa("Transition","TransitionCancel"),transitionend:sa("Transition","TransitionEnd")},dy={},Kk={};Gi&&(Kk=document.createElement("div").style,"AnimationEvent"in window||(delete vl.animationend.animation,delete vl.animationiteration.animation,delete vl.animationstart.animation),"TransitionEvent"in window||delete vl.transitionend.transition);function oa(a){if(dy[a])return dy[a];if(!vl[a])return a;var c=vl[a],d;for(d in c)if(c.hasOwnProperty(d)&&d in Kk)return dy[a]=c[d];return a}var Zk=oa("animationend"),Yk=oa("animationiteration"),Xk=oa("animationstart"),yP=oa("transitionrun"),bP=oa("transitionstart"),vP=oa("transitioncancel"),Jk=oa("transitionend"),Qk=new Map,fy="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(" ");fy.push("scrollEnd");function oi(a,c){Qk.set(a,c),ra(c,[a])}var Ef=typeof reportError=="function"?reportError:function(a){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var c=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof a=="object"&&a!==null&&typeof a.message=="string"?String(a.message):String(a),error:a});if(!window.dispatchEvent(c))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",a);return}console.error(a)},Hr=[],xl=0,hy=0;function Tf(){for(var a=xl,c=hy=xl=0;c<a;){var d=Hr[c];Hr[c++]=null;var p=Hr[c];Hr[c++]=null;var v=Hr[c];Hr[c++]=null;var w=Hr[c];if(Hr[c++]=null,p!==null&&v!==null){var T=p.pending;T===null?v.next=v:(v.next=T.next,T.next=v),p.pending=v}w!==0&&eC(d,v,w)}}function _f(a,c,d,p){Hr[xl++]=a,Hr[xl++]=c,Hr[xl++]=d,Hr[xl++]=p,hy|=p,a.lanes|=p,a=a.alternate,a!==null&&(a.lanes|=p)}function py(a,c,d,p){return _f(a,c,d,p),Af(a)}function aa(a,c){return _f(a,null,null,c),Af(a)}function eC(a,c,d){a.lanes|=d;var p=a.alternate;p!==null&&(p.lanes|=d);for(var v=!1,w=a.return;w!==null;)w.childLanes|=d,p=w.alternate,p!==null&&(p.childLanes|=d),w.tag===22&&(a=w.stateNode,a===null||a._visibility&1||(v=!0)),a=w,w=w.return;return a.tag===3?(w=a.stateNode,v&&c!==null&&(v=31-ye(d),a=w.hiddenUpdates,p=a[v],p===null?a[v]=[c]:p.push(c),c.lane=d|536870912),w):null}function Af(a){if(50<Cu)throw Cu=0,kb=null,Error(r(185));for(var c=a.return;c!==null;)a=c,c=a.return;return a.tag===3?a.stateNode:null}var wl={};function xP(a,c,d,p){this.tag=a,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sr(a,c,d,p){return new xP(a,c,d,p)}function my(a){return a=a.prototype,!(!a||!a.isReactComponent)}function Wi(a,c){var d=a.alternate;return d===null?(d=Sr(a.tag,c,a.key,a.mode),d.elementType=a.elementType,d.type=a.type,d.stateNode=a.stateNode,d.alternate=a,a.alternate=d):(d.pendingProps=c,d.type=a.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=a.flags&65011712,d.childLanes=a.childLanes,d.lanes=a.lanes,d.child=a.child,d.memoizedProps=a.memoizedProps,d.memoizedState=a.memoizedState,d.updateQueue=a.updateQueue,c=a.dependencies,d.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},d.sibling=a.sibling,d.index=a.index,d.ref=a.ref,d.refCleanup=a.refCleanup,d}function tC(a,c){a.flags&=65011714;var d=a.alternate;return d===null?(a.childLanes=0,a.lanes=c,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=d.childLanes,a.lanes=d.lanes,a.child=d.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=d.memoizedProps,a.memoizedState=d.memoizedState,a.updateQueue=d.updateQueue,a.type=d.type,c=d.dependencies,a.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext}),a}function Rf(a,c,d,p,v,w){var T=0;if(p=a,typeof a=="function")my(a)&&(T=1);else if(typeof a=="string")T=Ez(a,d,ve.current)?26:a==="html"||a==="head"||a==="body"?27:5;else e:switch(a){case z:return a=Sr(31,d,c,v),a.elementType=z,a.lanes=w,a;case S:return la(d.children,v,w,c);case k:T=8,v|=24;break;case C:return a=Sr(12,d,c,v|2),a.elementType=C,a.lanes=w,a;case A:return a=Sr(13,d,c,v),a.elementType=A,a.lanes=w,a;case O:return a=Sr(19,d,c,v),a.elementType=O,a.lanes=w,a;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case M:T=10;break e;case _:T=9;break e;case R:T=11;break e;case D:T=14;break e;case j:T=16,p=null;break e}T=29,d=Error(r(130,a===null?"null":typeof a,"")),p=null}return c=Sr(T,d,c,v),c.elementType=a,c.type=p,c.lanes=w,c}function la(a,c,d,p){return a=Sr(7,a,p,c),a.lanes=d,a}function gy(a,c,d){return a=Sr(6,a,null,c),a.lanes=d,a}function nC(a){var c=Sr(18,null,null,0);return c.stateNode=a,c}function yy(a,c,d){return c=Sr(4,a.children!==null?a.children:[],a.key,c),c.lanes=d,c.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},c}var rC=new WeakMap;function Ur(a,c){if(typeof a=="object"&&a!==null){var d=rC.get(a);return d!==void 0?d:(c={value:a,source:c,stack:Zt(c)},rC.set(a,c),c)}return{value:a,source:c,stack:Zt(c)}}var Sl=[],kl=0,Mf=null,ru=0,Fr=[],qr=0,Hs=null,Ci=1,Ei="";function Ki(a,c){Sl[kl++]=ru,Sl[kl++]=Mf,Mf=a,ru=c}function iC(a,c,d){Fr[qr++]=Ci,Fr[qr++]=Ei,Fr[qr++]=Hs,Hs=a;var p=Ci;a=Ei;var v=32-ye(p)-1;p&=~(1<<v),d+=1;var w=32-ye(c)+v;if(30<w){var T=v-v%5;w=(p&(1<<T)-1).toString(32),p>>=T,v-=T,Ci=1<<32-ye(c)+v|d<<v|p,Ei=w+a}else Ci=1<<w|d<<v|p,Ei=a}function by(a){a.return!==null&&(Ki(a,1),iC(a,1,0))}function vy(a){for(;a===Mf;)Mf=Sl[--kl],Sl[kl]=null,ru=Sl[--kl],Sl[kl]=null;for(;a===Hs;)Hs=Fr[--qr],Fr[qr]=null,Ei=Fr[--qr],Fr[qr]=null,Ci=Fr[--qr],Fr[qr]=null}function sC(a,c){Fr[qr++]=Ci,Fr[qr++]=Ei,Fr[qr++]=Hs,Ci=c.id,Ei=c.overflow,Hs=a}var Dn=null,$t=null,ut=!1,Us=null,Gr=!1,xy=Error(r(519));function Fs(a){var c=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw iu(Ur(c,a)),xy}function oC(a){var c=a.stateNode,d=a.type,p=a.memoizedProps;switch(c[On]=a,c[lr]=p,d){case"dialog":at("cancel",c),at("close",c);break;case"iframe":case"object":case"embed":at("load",c);break;case"video":case"audio":for(d=0;d<Tu.length;d++)at(Tu[d],c);break;case"source":at("error",c);break;case"img":case"image":case"link":at("error",c),at("load",c);break;case"details":at("toggle",c);break;case"input":at("invalid",c),vk(c,p.value,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name,!0);break;case"select":at("invalid",c);break;case"textarea":at("invalid",c),wk(c,p.value,p.defaultValue,p.children)}d=p.children,typeof d!="string"&&typeof d!="number"&&typeof d!="bigint"||c.textContent===""+d||p.suppressHydrationWarning===!0||kE(c.textContent,d)?(p.popover!=null&&(at("beforetoggle",c),at("toggle",c)),p.onScroll!=null&&at("scroll",c),p.onScrollEnd!=null&&at("scrollend",c),p.onClick!=null&&(c.onclick=qi),c=!0):c=!1,c||Fs(a,!0)}function aC(a){for(Dn=a.return;Dn;)switch(Dn.tag){case 5:case 31:case 13:Gr=!1;return;case 27:case 3:Gr=!0;return;default:Dn=Dn.return}}function Cl(a){if(a!==Dn)return!1;if(!ut)return aC(a),ut=!0,!1;var c=a.tag,d;if((d=c!==3&&c!==27)&&((d=c===5)&&(d=a.type,d=!(d!=="form"&&d!=="button")||zb(a.type,a.memoizedProps)),d=!d),d&&$t&&Fs(a),aC(a),c===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));$t=OE(a)}else if(c===31){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));$t=OE(a)}else c===27?(c=$t,io(a.type)?(a=Ub,Ub=null,$t=a):$t=c):$t=Dn?Kr(a.stateNode.nextSibling):null;return!0}function ca(){$t=Dn=null,ut=!1}function wy(){var a=Us;return a!==null&&(hr===null?hr=a:hr.push.apply(hr,a),Us=null),a}function iu(a){Us===null?Us=[a]:Us.push(a)}var Sy=V(null),ua=null,Zi=null;function qs(a,c,d){he(Sy,c._currentValue),c._currentValue=d}function Yi(a){a._currentValue=Sy.current,Y(Sy)}function ky(a,c,d){for(;a!==null;){var p=a.alternate;if((a.childLanes&c)!==c?(a.childLanes|=c,p!==null&&(p.childLanes|=c)):p!==null&&(p.childLanes&c)!==c&&(p.childLanes|=c),a===d)break;a=a.return}}function Cy(a,c,d,p){var v=a.child;for(v!==null&&(v.return=a);v!==null;){var w=v.dependencies;if(w!==null){var T=v.child;w=w.firstContext;e:for(;w!==null;){var N=w;w=v;for(var $=0;$<c.length;$++)if(N.context===c[$]){w.lanes|=d,N=w.alternate,N!==null&&(N.lanes|=d),ky(w.return,d,a),p||(T=null);break e}w=N.next}}else if(v.tag===18){if(T=v.return,T===null)throw Error(r(341));T.lanes|=d,w=T.alternate,w!==null&&(w.lanes|=d),ky(T,d,a),T=null}else T=v.child;if(T!==null)T.return=v;else for(T=v;T!==null;){if(T===a){T=null;break}if(v=T.sibling,v!==null){v.return=T.return,T=v;break}T=T.return}v=T}}function El(a,c,d,p){a=null;for(var v=c,w=!1;v!==null;){if(!w){if((v.flags&524288)!==0)w=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var T=v.alternate;if(T===null)throw Error(r(387));if(T=T.memoizedProps,T!==null){var N=v.type;wr(v.pendingProps.value,T.value)||(a!==null?a.push(N):a=[N])}}else if(v===Le.current){if(T=v.alternate,T===null)throw Error(r(387));T.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(a!==null?a.push(Nu):a=[Nu])}v=v.return}a!==null&&Cy(c,a,d,p),c.flags|=262144}function Nf(a){for(a=a.firstContext;a!==null;){if(!wr(a.context._currentValue,a.memoizedValue))return!0;a=a.next}return!1}function da(a){ua=a,Zi=null,a=a.dependencies,a!==null&&(a.firstContext=null)}function In(a){return lC(ua,a)}function Of(a,c){return ua===null&&da(a),lC(a,c)}function lC(a,c){var d=c._currentValue;if(c={context:c,memoizedValue:d,next:null},Zi===null){if(a===null)throw Error(r(308));Zi=c,a.dependencies={lanes:0,firstContext:c},a.flags|=524288}else Zi=Zi.next=c;return d}var wP=typeof AbortController<"u"?AbortController:function(){var a=[],c=this.signal={aborted:!1,addEventListener:function(d,p){a.push(p)}};this.abort=function(){c.aborted=!0,a.forEach(function(d){return d()})}},SP=t.unstable_scheduleCallback,kP=t.unstable_NormalPriority,cn={$$typeof:M,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ey(){return{controller:new wP,data:new Map,refCount:0}}function su(a){a.refCount--,a.refCount===0&&SP(kP,function(){a.controller.abort()})}var ou=null,Ty=0,Tl=0,_l=null;function CP(a,c){if(ou===null){var d=ou=[];Ty=0,Tl=Rb(),_l={status:"pending",value:void 0,then:function(p){d.push(p)}}}return Ty++,c.then(cC,cC),c}function cC(){if(--Ty===0&&ou!==null){_l!==null&&(_l.status="fulfilled");var a=ou;ou=null,Tl=0,_l=null;for(var c=0;c<a.length;c++)(0,a[c])()}}function EP(a,c){var d=[],p={status:"pending",value:null,reason:null,then:function(v){d.push(v)}};return a.then(function(){p.status="fulfilled",p.value=c;for(var v=0;v<d.length;v++)(0,d[v])(c)},function(v){for(p.status="rejected",p.reason=v,v=0;v<d.length;v++)(0,d[v])(void 0)}),p}var uC=B.S;B.S=function(a,c){W1=qt(),typeof c=="object"&&c!==null&&typeof c.then=="function"&&CP(a,c),uC!==null&&uC(a,c)};var fa=V(null);function _y(){var a=fa.current;return a!==null?a:Dt.pooledCache}function Df(a,c){c===null?he(fa,fa.current):he(fa,c.pool)}function dC(){var a=_y();return a===null?null:{parent:cn._currentValue,pool:a}}var Al=Error(r(460)),Ay=Error(r(474)),If=Error(r(542)),jf={then:function(){}};function fC(a){return a=a.status,a==="fulfilled"||a==="rejected"}function hC(a,c,d){switch(d=a[d],d===void 0?a.push(c):d!==c&&(c.then(qi,qi),c=d),c.status){case"fulfilled":return c.value;case"rejected":throw a=c.reason,mC(a),a;default:if(typeof c.status=="string")c.then(qi,qi);else{if(a=Dt,a!==null&&100<a.shellSuspendCounter)throw Error(r(482));a=c,a.status="pending",a.then(function(p){if(c.status==="pending"){var v=c;v.status="fulfilled",v.value=p}},function(p){if(c.status==="pending"){var v=c;v.status="rejected",v.reason=p}})}switch(c.status){case"fulfilled":return c.value;case"rejected":throw a=c.reason,mC(a),a}throw pa=c,Al}}function ha(a){try{var c=a._init;return c(a._payload)}catch(d){throw d!==null&&typeof d=="object"&&typeof d.then=="function"?(pa=d,Al):d}}var pa=null;function pC(){if(pa===null)throw Error(r(459));var a=pa;return pa=null,a}function mC(a){if(a===Al||a===If)throw Error(r(483))}var Rl=null,au=0;function Lf(a){var c=au;return au+=1,Rl===null&&(Rl=[]),hC(Rl,a,c)}function lu(a,c){c=c.props.ref,a.ref=c!==void 0?c:null}function Pf(a,c){throw c.$$typeof===g?Error(r(525)):(a=Object.prototype.toString.call(c),Error(r(31,a==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":a)))}function gC(a){function c(W,F){if(a){var X=W.deletions;X===null?(W.deletions=[F],W.flags|=16):X.push(F)}}function d(W,F){if(!a)return null;for(;F!==null;)c(W,F),F=F.sibling;return null}function p(W){for(var F=new Map;W!==null;)W.key!==null?F.set(W.key,W):F.set(W.index,W),W=W.sibling;return F}function v(W,F){return W=Wi(W,F),W.index=0,W.sibling=null,W}function w(W,F,X){return W.index=X,a?(X=W.alternate,X!==null?(X=X.index,X<F?(W.flags|=67108866,F):X):(W.flags|=67108866,F)):(W.flags|=1048576,F)}function T(W){return a&&W.alternate===null&&(W.flags|=67108866),W}function N(W,F,X,le){return F===null||F.tag!==6?(F=gy(X,W.mode,le),F.return=W,F):(F=v(F,X),F.return=W,F)}function $(W,F,X,le){var Ve=X.type;return Ve===S?se(W,F,X.props.children,le,X.key):F!==null&&(F.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===j&&ha(Ve)===F.type)?(F=v(F,X.props),lu(F,X),F.return=W,F):(F=Rf(X.type,X.key,X.props,null,W.mode,le),lu(F,X),F.return=W,F)}function J(W,F,X,le){return F===null||F.tag!==4||F.stateNode.containerInfo!==X.containerInfo||F.stateNode.implementation!==X.implementation?(F=yy(X,W.mode,le),F.return=W,F):(F=v(F,X.children||[]),F.return=W,F)}function se(W,F,X,le,Ve){return F===null||F.tag!==7?(F=la(X,W.mode,le,Ve),F.return=W,F):(F=v(F,X),F.return=W,F)}function ce(W,F,X){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return F=gy(""+F,W.mode,X),F.return=W,F;if(typeof F=="object"&&F!==null){switch(F.$$typeof){case b:return X=Rf(F.type,F.key,F.props,null,W.mode,X),lu(X,F),X.return=W,X;case x:return F=yy(F,W.mode,X),F.return=W,F;case j:return F=ha(F),ce(W,F,X)}if(fe(F)||G(F))return F=la(F,W.mode,X,null),F.return=W,F;if(typeof F.then=="function")return ce(W,Lf(F),X);if(F.$$typeof===M)return ce(W,Of(W,F),X);Pf(W,F)}return null}function Q(W,F,X,le){var Ve=F!==null?F.key:null;if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return Ve!==null?null:N(W,F,""+X,le);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case b:return X.key===Ve?$(W,F,X,le):null;case x:return X.key===Ve?J(W,F,X,le):null;case j:return X=ha(X),Q(W,F,X,le)}if(fe(X)||G(X))return Ve!==null?null:se(W,F,X,le,null);if(typeof X.then=="function")return Q(W,F,Lf(X),le);if(X.$$typeof===M)return Q(W,F,Of(W,X),le);Pf(W,X)}return null}function ne(W,F,X,le,Ve){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return W=W.get(X)||null,N(F,W,""+le,Ve);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case b:return W=W.get(le.key===null?X:le.key)||null,$(F,W,le,Ve);case x:return W=W.get(le.key===null?X:le.key)||null,J(F,W,le,Ve);case j:return le=ha(le),ne(W,F,X,le,Ve)}if(fe(le)||G(le))return W=W.get(X)||null,se(F,W,le,Ve,null);if(typeof le.then=="function")return ne(W,F,X,Lf(le),Ve);if(le.$$typeof===M)return ne(W,F,X,Of(F,le),Ve);Pf(F,le)}return null}function Oe(W,F,X,le){for(var Ve=null,mt=null,Pe=F,nt=F=0,ct=null;Pe!==null&&nt<X.length;nt++){Pe.index>nt?(ct=Pe,Pe=null):ct=Pe.sibling;var gt=Q(W,Pe,X[nt],le);if(gt===null){Pe===null&&(Pe=ct);break}a&&Pe&&gt.alternate===null&&c(W,Pe),F=w(gt,F,nt),mt===null?Ve=gt:mt.sibling=gt,mt=gt,Pe=ct}if(nt===X.length)return d(W,Pe),ut&&Ki(W,nt),Ve;if(Pe===null){for(;nt<X.length;nt++)Pe=ce(W,X[nt],le),Pe!==null&&(F=w(Pe,F,nt),mt===null?Ve=Pe:mt.sibling=Pe,mt=Pe);return ut&&Ki(W,nt),Ve}for(Pe=p(Pe);nt<X.length;nt++)ct=ne(Pe,W,nt,X[nt],le),ct!==null&&(a&&ct.alternate!==null&&Pe.delete(ct.key===null?nt:ct.key),F=w(ct,F,nt),mt===null?Ve=ct:mt.sibling=ct,mt=ct);return a&&Pe.forEach(function(co){return c(W,co)}),ut&&Ki(W,nt),Ve}function qe(W,F,X,le){if(X==null)throw Error(r(151));for(var Ve=null,mt=null,Pe=F,nt=F=0,ct=null,gt=X.next();Pe!==null&&!gt.done;nt++,gt=X.next()){Pe.index>nt?(ct=Pe,Pe=null):ct=Pe.sibling;var co=Q(W,Pe,gt.value,le);if(co===null){Pe===null&&(Pe=ct);break}a&&Pe&&co.alternate===null&&c(W,Pe),F=w(co,F,nt),mt===null?Ve=co:mt.sibling=co,mt=co,Pe=ct}if(gt.done)return d(W,Pe),ut&&Ki(W,nt),Ve;if(Pe===null){for(;!gt.done;nt++,gt=X.next())gt=ce(W,gt.value,le),gt!==null&&(F=w(gt,F,nt),mt===null?Ve=gt:mt.sibling=gt,mt=gt);return ut&&Ki(W,nt),Ve}for(Pe=p(Pe);!gt.done;nt++,gt=X.next())gt=ne(Pe,W,nt,gt.value,le),gt!==null&&(a&&gt.alternate!==null&&Pe.delete(gt.key===null?nt:gt.key),F=w(gt,F,nt),mt===null?Ve=gt:mt.sibling=gt,mt=gt);return a&&Pe.forEach(function(Lz){return c(W,Lz)}),ut&&Ki(W,nt),Ve}function Mt(W,F,X,le){if(typeof X=="object"&&X!==null&&X.type===S&&X.key===null&&(X=X.props.children),typeof X=="object"&&X!==null){switch(X.$$typeof){case b:e:{for(var Ve=X.key;F!==null;){if(F.key===Ve){if(Ve=X.type,Ve===S){if(F.tag===7){d(W,F.sibling),le=v(F,X.props.children),le.return=W,W=le;break e}}else if(F.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===j&&ha(Ve)===F.type){d(W,F.sibling),le=v(F,X.props),lu(le,X),le.return=W,W=le;break e}d(W,F);break}else c(W,F);F=F.sibling}X.type===S?(le=la(X.props.children,W.mode,le,X.key),le.return=W,W=le):(le=Rf(X.type,X.key,X.props,null,W.mode,le),lu(le,X),le.return=W,W=le)}return T(W);case x:e:{for(Ve=X.key;F!==null;){if(F.key===Ve)if(F.tag===4&&F.stateNode.containerInfo===X.containerInfo&&F.stateNode.implementation===X.implementation){d(W,F.sibling),le=v(F,X.children||[]),le.return=W,W=le;break e}else{d(W,F);break}else c(W,F);F=F.sibling}le=yy(X,W.mode,le),le.return=W,W=le}return T(W);case j:return X=ha(X),Mt(W,F,X,le)}if(fe(X))return Oe(W,F,X,le);if(G(X)){if(Ve=G(X),typeof Ve!="function")throw Error(r(150));return X=Ve.call(X),qe(W,F,X,le)}if(typeof X.then=="function")return Mt(W,F,Lf(X),le);if(X.$$typeof===M)return Mt(W,F,Of(W,X),le);Pf(W,X)}return typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint"?(X=""+X,F!==null&&F.tag===6?(d(W,F.sibling),le=v(F,X),le.return=W,W=le):(d(W,F),le=gy(X,W.mode,le),le.return=W,W=le),T(W)):d(W,F)}return function(W,F,X,le){try{au=0;var Ve=Mt(W,F,X,le);return Rl=null,Ve}catch(Pe){if(Pe===Al||Pe===If)throw Pe;var mt=Sr(29,Pe,null,W.mode);return mt.lanes=le,mt.return=W,mt}}}var ma=gC(!0),yC=gC(!1),Gs=!1;function Ry(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function My(a,c){a=a.updateQueue,c.updateQueue===a&&(c.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,callbacks:null})}function Ws(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function Ks(a,c,d){var p=a.updateQueue;if(p===null)return null;if(p=p.shared,(xt&2)!==0){var v=p.pending;return v===null?c.next=c:(c.next=v.next,v.next=c),p.pending=c,c=Af(a),eC(a,null,d),c}return _f(a,p,c,d),Af(a)}function cu(a,c,d){if(c=c.updateQueue,c!==null&&(c=c.shared,(d&4194048)!==0)){var p=c.lanes;p&=a.pendingLanes,d|=p,c.lanes=d,al(a,d)}}function Ny(a,c){var d=a.updateQueue,p=a.alternate;if(p!==null&&(p=p.updateQueue,d===p)){var v=null,w=null;if(d=d.firstBaseUpdate,d!==null){do{var T={lane:d.lane,tag:d.tag,payload:d.payload,callback:null,next:null};w===null?v=w=T:w=w.next=T,d=d.next}while(d!==null);w===null?v=w=c:w=w.next=c}else v=w=c;d={baseState:p.baseState,firstBaseUpdate:v,lastBaseUpdate:w,shared:p.shared,callbacks:p.callbacks},a.updateQueue=d;return}a=d.lastBaseUpdate,a===null?d.firstBaseUpdate=c:a.next=c,d.lastBaseUpdate=c}var Oy=!1;function uu(){if(Oy){var a=_l;if(a!==null)throw a}}function du(a,c,d,p){Oy=!1;var v=a.updateQueue;Gs=!1;var w=v.firstBaseUpdate,T=v.lastBaseUpdate,N=v.shared.pending;if(N!==null){v.shared.pending=null;var $=N,J=$.next;$.next=null,T===null?w=J:T.next=J,T=$;var se=a.alternate;se!==null&&(se=se.updateQueue,N=se.lastBaseUpdate,N!==T&&(N===null?se.firstBaseUpdate=J:N.next=J,se.lastBaseUpdate=$))}if(w!==null){var ce=v.baseState;T=0,se=J=$=null,N=w;do{var Q=N.lane&-536870913,ne=Q!==N.lane;if(ne?(lt&Q)===Q:(p&Q)===Q){Q!==0&&Q===Tl&&(Oy=!0),se!==null&&(se=se.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Oe=a,qe=N;Q=c;var Mt=d;switch(qe.tag){case 1:if(Oe=qe.payload,typeof Oe=="function"){ce=Oe.call(Mt,ce,Q);break e}ce=Oe;break e;case 3:Oe.flags=Oe.flags&-65537|128;case 0:if(Oe=qe.payload,Q=typeof Oe=="function"?Oe.call(Mt,ce,Q):Oe,Q==null)break e;ce=m({},ce,Q);break e;case 2:Gs=!0}}Q=N.callback,Q!==null&&(a.flags|=64,ne&&(a.flags|=8192),ne=v.callbacks,ne===null?v.callbacks=[Q]:ne.push(Q))}else ne={lane:Q,tag:N.tag,payload:N.payload,callback:N.callback,next:null},se===null?(J=se=ne,$=ce):se=se.next=ne,T|=Q;if(N=N.next,N===null){if(N=v.shared.pending,N===null)break;ne=N,N=ne.next,ne.next=null,v.lastBaseUpdate=ne,v.shared.pending=null}}while(!0);se===null&&($=ce),v.baseState=$,v.firstBaseUpdate=J,v.lastBaseUpdate=se,w===null&&(v.shared.lanes=0),Qs|=T,a.lanes=T,a.memoizedState=ce}}function bC(a,c){if(typeof a!="function")throw Error(r(191,a));a.call(c)}function vC(a,c){var d=a.callbacks;if(d!==null)for(a.callbacks=null,a=0;a<d.length;a++)bC(d[a],c)}var Ml=V(null),zf=V(0);function xC(a,c){a=ss,he(zf,a),he(Ml,c),ss=a|c.baseLanes}function Dy(){he(zf,ss),he(Ml,Ml.current)}function Iy(){ss=zf.current,Y(Ml),Y(zf)}var kr=V(null),Wr=null;function Zs(a){var c=a.alternate;he(rn,rn.current&1),he(kr,a),Wr===null&&(c===null||Ml.current!==null||c.memoizedState!==null)&&(Wr=a)}function jy(a){he(rn,rn.current),he(kr,a),Wr===null&&(Wr=a)}function wC(a){a.tag===22?(he(rn,rn.current),he(kr,a),Wr===null&&(Wr=a)):Ys()}function Ys(){he(rn,rn.current),he(kr,kr.current)}function Cr(a){Y(kr),Wr===a&&(Wr=null),Y(rn)}var rn=V(0);function $f(a){for(var c=a;c!==null;){if(c.tag===13){var d=c.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||Vb(d)||Hb(d)))return c}else if(c.tag===19&&(c.memoizedProps.revealOrder==="forwards"||c.memoizedProps.revealOrder==="backwards"||c.memoizedProps.revealOrder==="unstable_legacy-backwards"||c.memoizedProps.revealOrder==="together")){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===a)break;for(;c.sibling===null;){if(c.return===null||c.return===a)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var Xi=0,tt=null,At=null,un=null,Bf=!1,Nl=!1,ga=!1,Vf=0,fu=0,Ol=null,TP=0;function Yt(){throw Error(r(321))}function Ly(a,c){if(c===null)return!1;for(var d=0;d<c.length&&d<a.length;d++)if(!wr(a[d],c[d]))return!1;return!0}function Py(a,c,d,p,v,w){return Xi=w,tt=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,B.H=a===null||a.memoizedState===null?i1:Jy,ga=!1,w=d(p,v),ga=!1,Nl&&(w=kC(c,d,p,v)),SC(a),w}function SC(a){B.H=mu;var c=At!==null&&At.next!==null;if(Xi=0,un=At=tt=null,Bf=!1,fu=0,Ol=null,c)throw Error(r(300));a===null||dn||(a=a.dependencies,a!==null&&Nf(a)&&(dn=!0))}function kC(a,c,d,p){tt=a;var v=0;do{if(Nl&&(Ol=null),fu=0,Nl=!1,25<=v)throw Error(r(301));if(v+=1,un=At=null,a.updateQueue!=null){var w=a.updateQueue;w.lastEffect=null,w.events=null,w.stores=null,w.memoCache!=null&&(w.memoCache.index=0)}B.H=s1,w=c(d,p)}while(Nl);return w}function _P(){var a=B.H,c=a.useState()[0];return c=typeof c.then=="function"?hu(c):c,a=a.useState()[0],(At!==null?At.memoizedState:null)!==a&&(tt.flags|=1024),c}function zy(){var a=Vf!==0;return Vf=0,a}function $y(a,c,d){c.updateQueue=a.updateQueue,c.flags&=-2053,a.lanes&=~d}function By(a){if(Bf){for(a=a.memoizedState;a!==null;){var c=a.queue;c!==null&&(c.pending=null),a=a.next}Bf=!1}Xi=0,un=At=tt=null,Nl=!1,fu=Vf=0,Ol=null}function Qn(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return un===null?tt.memoizedState=un=a:un=un.next=a,un}function sn(){if(At===null){var a=tt.alternate;a=a!==null?a.memoizedState:null}else a=At.next;var c=un===null?tt.memoizedState:un.next;if(c!==null)un=c,At=a;else{if(a===null)throw tt.alternate===null?Error(r(467)):Error(r(310));At=a,a={memoizedState:At.memoizedState,baseState:At.baseState,baseQueue:At.baseQueue,queue:At.queue,next:null},un===null?tt.memoizedState=un=a:un=un.next=a}return un}function Hf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function hu(a){var c=fu;return fu+=1,Ol===null&&(Ol=[]),a=hC(Ol,a,c),c=tt,(un===null?c.memoizedState:un.next)===null&&(c=c.alternate,B.H=c===null||c.memoizedState===null?i1:Jy),a}function Uf(a){if(a!==null&&typeof a=="object"){if(typeof a.then=="function")return hu(a);if(a.$$typeof===M)return In(a)}throw Error(r(438,String(a)))}function Vy(a){var c=null,d=tt.updateQueue;if(d!==null&&(c=d.memoCache),c==null){var p=tt.alternate;p!==null&&(p=p.updateQueue,p!==null&&(p=p.memoCache,p!=null&&(c={data:p.data.map(function(v){return v.slice()}),index:0})))}if(c==null&&(c={data:[],index:0}),d===null&&(d=Hf(),tt.updateQueue=d),d.memoCache=c,d=c.data[c.index],d===void 0)for(d=c.data[c.index]=Array(a),p=0;p<a;p++)d[p]=q;return c.index++,d}function Ji(a,c){return typeof c=="function"?c(a):c}function Ff(a){var c=sn();return Hy(c,At,a)}function Hy(a,c,d){var p=a.queue;if(p===null)throw Error(r(311));p.lastRenderedReducer=d;var v=a.baseQueue,w=p.pending;if(w!==null){if(v!==null){var T=v.next;v.next=w.next,w.next=T}c.baseQueue=v=w,p.pending=null}if(w=a.baseState,v===null)a.memoizedState=w;else{c=v.next;var N=T=null,$=null,J=c,se=!1;do{var ce=J.lane&-536870913;if(ce!==J.lane?(lt&ce)===ce:(Xi&ce)===ce){var Q=J.revertLane;if(Q===0)$!==null&&($=$.next={lane:0,revertLane:0,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null}),ce===Tl&&(se=!0);else if((Xi&Q)===Q){J=J.next,Q===Tl&&(se=!0);continue}else ce={lane:0,revertLane:J.revertLane,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},$===null?(N=$=ce,T=w):$=$.next=ce,tt.lanes|=Q,Qs|=Q;ce=J.action,ga&&d(w,ce),w=J.hasEagerState?J.eagerState:d(w,ce)}else Q={lane:ce,revertLane:J.revertLane,gesture:J.gesture,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},$===null?(N=$=Q,T=w):$=$.next=Q,tt.lanes|=ce,Qs|=ce;J=J.next}while(J!==null&&J!==c);if($===null?T=w:$.next=N,!wr(w,a.memoizedState)&&(dn=!0,se&&(d=_l,d!==null)))throw d;a.memoizedState=w,a.baseState=T,a.baseQueue=$,p.lastRenderedState=w}return v===null&&(p.lanes=0),[a.memoizedState,p.dispatch]}function Uy(a){var c=sn(),d=c.queue;if(d===null)throw Error(r(311));d.lastRenderedReducer=a;var p=d.dispatch,v=d.pending,w=c.memoizedState;if(v!==null){d.pending=null;var T=v=v.next;do w=a(w,T.action),T=T.next;while(T!==v);wr(w,c.memoizedState)||(dn=!0),c.memoizedState=w,c.baseQueue===null&&(c.baseState=w),d.lastRenderedState=w}return[w,p]}function CC(a,c,d){var p=tt,v=sn(),w=ut;if(w){if(d===void 0)throw Error(r(407));d=d()}else d=c();var T=!wr((At||v).memoizedState,d);if(T&&(v.memoizedState=d,dn=!0),v=v.queue,Gy(_C.bind(null,p,v,a),[a]),v.getSnapshot!==c||T||un!==null&&un.memoizedState.tag&1){if(p.flags|=2048,Dl(9,{destroy:void 0},TC.bind(null,p,v,d,c),null),Dt===null)throw Error(r(349));w||(Xi&127)!==0||EC(p,c,d)}return d}function EC(a,c,d){a.flags|=16384,a={getSnapshot:c,value:d},c=tt.updateQueue,c===null?(c=Hf(),tt.updateQueue=c,c.stores=[a]):(d=c.stores,d===null?c.stores=[a]:d.push(a))}function TC(a,c,d,p){c.value=d,c.getSnapshot=p,AC(c)&&RC(a)}function _C(a,c,d){return d(function(){AC(c)&&RC(a)})}function AC(a){var c=a.getSnapshot;a=a.value;try{var d=c();return!wr(a,d)}catch{return!0}}function RC(a){var c=aa(a,2);c!==null&&pr(c,a,2)}function Fy(a){var c=Qn();if(typeof a=="function"){var d=a;if(a=d(),ga){ae(!0);try{d()}finally{ae(!1)}}}return c.memoizedState=c.baseState=a,c.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ji,lastRenderedState:a},c}function MC(a,c,d,p){return a.baseState=d,Hy(a,At,typeof p=="function"?p:Ji)}function AP(a,c,d,p,v){if(Wf(a))throw Error(r(485));if(a=c.action,a!==null){var w={payload:v,action:a,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(T){w.listeners.push(T)}};B.T!==null?d(!0):w.isTransition=!1,p(w),d=c.pending,d===null?(w.next=c.pending=w,NC(c,w)):(w.next=d.next,c.pending=d.next=w)}}function NC(a,c){var d=c.action,p=c.payload,v=a.state;if(c.isTransition){var w=B.T,T={};B.T=T;try{var N=d(v,p),$=B.S;$!==null&&$(T,N),OC(a,c,N)}catch(J){qy(a,c,J)}finally{w!==null&&T.types!==null&&(w.types=T.types),B.T=w}}else try{w=d(v,p),OC(a,c,w)}catch(J){qy(a,c,J)}}function OC(a,c,d){d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(function(p){DC(a,c,p)},function(p){return qy(a,c,p)}):DC(a,c,d)}function DC(a,c,d){c.status="fulfilled",c.value=d,IC(c),a.state=d,c=a.pending,c!==null&&(d=c.next,d===c?a.pending=null:(d=d.next,c.next=d,NC(a,d)))}function qy(a,c,d){var p=a.pending;if(a.pending=null,p!==null){p=p.next;do c.status="rejected",c.reason=d,IC(c),c=c.next;while(c!==p)}a.action=null}function IC(a){a=a.listeners;for(var c=0;c<a.length;c++)(0,a[c])()}function jC(a,c){return c}function LC(a,c){if(ut){var d=Dt.formState;if(d!==null){e:{var p=tt;if(ut){if($t){t:{for(var v=$t,w=Gr;v.nodeType!==8;){if(!w){v=null;break t}if(v=Kr(v.nextSibling),v===null){v=null;break t}}w=v.data,v=w==="F!"||w==="F"?v:null}if(v){$t=Kr(v.nextSibling),p=v.data==="F!";break e}}Fs(p)}p=!1}p&&(c=d[0])}}return d=Qn(),d.memoizedState=d.baseState=c,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jC,lastRenderedState:c},d.queue=p,d=t1.bind(null,tt,p),p.dispatch=d,p=Fy(!1),w=Xy.bind(null,tt,!1,p.queue),p=Qn(),v={state:c,dispatch:null,action:a,pending:null},p.queue=v,d=AP.bind(null,tt,v,w,d),v.dispatch=d,p.memoizedState=a,[c,d,!1]}function PC(a){var c=sn();return zC(c,At,a)}function zC(a,c,d){if(c=Hy(a,c,jC)[0],a=Ff(Ji)[0],typeof c=="object"&&c!==null&&typeof c.then=="function")try{var p=hu(c)}catch(T){throw T===Al?If:T}else p=c;c=sn();var v=c.queue,w=v.dispatch;return d!==c.memoizedState&&(tt.flags|=2048,Dl(9,{destroy:void 0},RP.bind(null,v,d),null)),[p,w,a]}function RP(a,c){a.action=c}function $C(a){var c=sn(),d=At;if(d!==null)return zC(c,d,a);sn(),c=c.memoizedState,d=sn();var p=d.queue.dispatch;return d.memoizedState=a,[c,p,!1]}function Dl(a,c,d,p){return a={tag:a,create:d,deps:p,inst:c,next:null},c=tt.updateQueue,c===null&&(c=Hf(),tt.updateQueue=c),d=c.lastEffect,d===null?c.lastEffect=a.next=a:(p=d.next,d.next=a,a.next=p,c.lastEffect=a),a}function BC(){return sn().memoizedState}function qf(a,c,d,p){var v=Qn();tt.flags|=a,v.memoizedState=Dl(1|c,{destroy:void 0},d,p===void 0?null:p)}function Gf(a,c,d,p){var v=sn();p=p===void 0?null:p;var w=v.memoizedState.inst;At!==null&&p!==null&&Ly(p,At.memoizedState.deps)?v.memoizedState=Dl(c,w,d,p):(tt.flags|=a,v.memoizedState=Dl(1|c,w,d,p))}function VC(a,c){qf(8390656,8,a,c)}function Gy(a,c){Gf(2048,8,a,c)}function MP(a){tt.flags|=4;var c=tt.updateQueue;if(c===null)c=Hf(),tt.updateQueue=c,c.events=[a];else{var d=c.events;d===null?c.events=[a]:d.push(a)}}function HC(a){var c=sn().memoizedState;return MP({ref:c,nextImpl:a}),function(){if((xt&2)!==0)throw Error(r(440));return c.impl.apply(void 0,arguments)}}function UC(a,c){return Gf(4,2,a,c)}function FC(a,c){return Gf(4,4,a,c)}function qC(a,c){if(typeof c=="function"){a=a();var d=c(a);return function(){typeof d=="function"?d():c(null)}}if(c!=null)return a=a(),c.current=a,function(){c.current=null}}function GC(a,c,d){d=d!=null?d.concat([a]):null,Gf(4,4,qC.bind(null,c,a),d)}function Wy(){}function WC(a,c){var d=sn();c=c===void 0?null:c;var p=d.memoizedState;return c!==null&&Ly(c,p[1])?p[0]:(d.memoizedState=[a,c],a)}function KC(a,c){var d=sn();c=c===void 0?null:c;var p=d.memoizedState;if(c!==null&&Ly(c,p[1]))return p[0];if(p=a(),ga){ae(!0);try{a()}finally{ae(!1)}}return d.memoizedState=[p,c],p}function Ky(a,c,d){return d===void 0||(Xi&1073741824)!==0&&(lt&261930)===0?a.memoizedState=c:(a.memoizedState=d,a=Z1(),tt.lanes|=a,Qs|=a,d)}function ZC(a,c,d,p){return wr(d,c)?d:Ml.current!==null?(a=Ky(a,d,p),wr(a,c)||(dn=!0),a):(Xi&42)===0||(Xi&1073741824)!==0&&(lt&261930)===0?(dn=!0,a.memoizedState=d):(a=Z1(),tt.lanes|=a,Qs|=a,c)}function YC(a,c,d,p,v){var w=L.p;L.p=w!==0&&8>w?w:8;var T=B.T,N={};B.T=N,Xy(a,!1,c,d);try{var $=v(),J=B.S;if(J!==null&&J(N,$),$!==null&&typeof $=="object"&&typeof $.then=="function"){var se=EP($,p);pu(a,c,se,_r(a))}else pu(a,c,p,_r(a))}catch(ce){pu(a,c,{then:function(){},status:"rejected",reason:ce},_r())}finally{L.p=w,T!==null&&N.types!==null&&(T.types=N.types),B.T=T}}function NP(){}function Zy(a,c,d,p){if(a.tag!==5)throw Error(r(476));var v=XC(a).queue;YC(a,v,c,U,d===null?NP:function(){return JC(a),d(p)})}function XC(a){var c=a.memoizedState;if(c!==null)return c;c={memoizedState:U,baseState:U,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ji,lastRenderedState:U},next:null};var d={};return c.next={memoizedState:d,baseState:d,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ji,lastRenderedState:d},next:null},a.memoizedState=c,a=a.alternate,a!==null&&(a.memoizedState=c),c}function JC(a){var c=XC(a);c.next===null&&(c=a.alternate.memoizedState),pu(a,c.next.queue,{},_r())}function Yy(){return In(Nu)}function QC(){return sn().memoizedState}function e1(){return sn().memoizedState}function OP(a){for(var c=a.return;c!==null;){switch(c.tag){case 24:case 3:var d=_r();a=Ws(d);var p=Ks(c,a,d);p!==null&&(pr(p,c,d),cu(p,c,d)),c={cache:Ey()},a.payload=c;return}c=c.return}}function DP(a,c,d){var p=_r();d={lane:p,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Wf(a)?n1(c,d):(d=py(a,c,d,p),d!==null&&(pr(d,a,p),r1(d,c,p)))}function t1(a,c,d){var p=_r();pu(a,c,d,p)}function pu(a,c,d,p){var v={lane:p,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null};if(Wf(a))n1(c,v);else{var w=a.alternate;if(a.lanes===0&&(w===null||w.lanes===0)&&(w=c.lastRenderedReducer,w!==null))try{var T=c.lastRenderedState,N=w(T,d);if(v.hasEagerState=!0,v.eagerState=N,wr(N,T))return _f(a,c,v,0),Dt===null&&Tf(),!1}catch{}if(d=py(a,c,v,p),d!==null)return pr(d,a,p),r1(d,c,p),!0}return!1}function Xy(a,c,d,p){if(p={lane:2,revertLane:Rb(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},Wf(a)){if(c)throw Error(r(479))}else c=py(a,d,p,2),c!==null&&pr(c,a,2)}function Wf(a){var c=a.alternate;return a===tt||c!==null&&c===tt}function n1(a,c){Nl=Bf=!0;var d=a.pending;d===null?c.next=c:(c.next=d.next,d.next=c),a.pending=c}function r1(a,c,d){if((d&4194048)!==0){var p=c.lanes;p&=a.pendingLanes,d|=p,c.lanes=d,al(a,d)}}var mu={readContext:In,use:Uf,useCallback:Yt,useContext:Yt,useEffect:Yt,useImperativeHandle:Yt,useLayoutEffect:Yt,useInsertionEffect:Yt,useMemo:Yt,useReducer:Yt,useRef:Yt,useState:Yt,useDebugValue:Yt,useDeferredValue:Yt,useTransition:Yt,useSyncExternalStore:Yt,useId:Yt,useHostTransitionStatus:Yt,useFormState:Yt,useActionState:Yt,useOptimistic:Yt,useMemoCache:Yt,useCacheRefresh:Yt};mu.useEffectEvent=Yt;var i1={readContext:In,use:Uf,useCallback:function(a,c){return Qn().memoizedState=[a,c===void 0?null:c],a},useContext:In,useEffect:VC,useImperativeHandle:function(a,c,d){d=d!=null?d.concat([a]):null,qf(4194308,4,qC.bind(null,c,a),d)},useLayoutEffect:function(a,c){return qf(4194308,4,a,c)},useInsertionEffect:function(a,c){qf(4,2,a,c)},useMemo:function(a,c){var d=Qn();c=c===void 0?null:c;var p=a();if(ga){ae(!0);try{a()}finally{ae(!1)}}return d.memoizedState=[p,c],p},useReducer:function(a,c,d){var p=Qn();if(d!==void 0){var v=d(c);if(ga){ae(!0);try{d(c)}finally{ae(!1)}}}else v=c;return p.memoizedState=p.baseState=v,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:v},p.queue=a,a=a.dispatch=DP.bind(null,tt,a),[p.memoizedState,a]},useRef:function(a){var c=Qn();return a={current:a},c.memoizedState=a},useState:function(a){a=Fy(a);var c=a.queue,d=t1.bind(null,tt,c);return c.dispatch=d,[a.memoizedState,d]},useDebugValue:Wy,useDeferredValue:function(a,c){var d=Qn();return Ky(d,a,c)},useTransition:function(){var a=Fy(!1);return a=YC.bind(null,tt,a.queue,!0,!1),Qn().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,c,d){var p=tt,v=Qn();if(ut){if(d===void 0)throw Error(r(407));d=d()}else{if(d=c(),Dt===null)throw Error(r(349));(lt&127)!==0||EC(p,c,d)}v.memoizedState=d;var w={value:d,getSnapshot:c};return v.queue=w,VC(_C.bind(null,p,w,a),[a]),p.flags|=2048,Dl(9,{destroy:void 0},TC.bind(null,p,w,d,c),null),d},useId:function(){var a=Qn(),c=Dt.identifierPrefix;if(ut){var d=Ei,p=Ci;d=(p&~(1<<32-ye(p)-1)).toString(32)+d,c="_"+c+"R_"+d,d=Vf++,0<d&&(c+="H"+d.toString(32)),c+="_"}else d=TP++,c="_"+c+"r_"+d.toString(32)+"_";return a.memoizedState=c},useHostTransitionStatus:Yy,useFormState:LC,useActionState:LC,useOptimistic:function(a){var c=Qn();c.memoizedState=c.baseState=a;var d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return c.queue=d,c=Xy.bind(null,tt,!0,d),d.dispatch=c,[a,c]},useMemoCache:Vy,useCacheRefresh:function(){return Qn().memoizedState=OP.bind(null,tt)},useEffectEvent:function(a){var c=Qn(),d={impl:a};return c.memoizedState=d,function(){if((xt&2)!==0)throw Error(r(440));return d.impl.apply(void 0,arguments)}}},Jy={readContext:In,use:Uf,useCallback:WC,useContext:In,useEffect:Gy,useImperativeHandle:GC,useInsertionEffect:UC,useLayoutEffect:FC,useMemo:KC,useReducer:Ff,useRef:BC,useState:function(){return Ff(Ji)},useDebugValue:Wy,useDeferredValue:function(a,c){var d=sn();return ZC(d,At.memoizedState,a,c)},useTransition:function(){var a=Ff(Ji)[0],c=sn().memoizedState;return[typeof a=="boolean"?a:hu(a),c]},useSyncExternalStore:CC,useId:QC,useHostTransitionStatus:Yy,useFormState:PC,useActionState:PC,useOptimistic:function(a,c){var d=sn();return MC(d,At,a,c)},useMemoCache:Vy,useCacheRefresh:e1};Jy.useEffectEvent=HC;var s1={readContext:In,use:Uf,useCallback:WC,useContext:In,useEffect:Gy,useImperativeHandle:GC,useInsertionEffect:UC,useLayoutEffect:FC,useMemo:KC,useReducer:Uy,useRef:BC,useState:function(){return Uy(Ji)},useDebugValue:Wy,useDeferredValue:function(a,c){var d=sn();return At===null?Ky(d,a,c):ZC(d,At.memoizedState,a,c)},useTransition:function(){var a=Uy(Ji)[0],c=sn().memoizedState;return[typeof a=="boolean"?a:hu(a),c]},useSyncExternalStore:CC,useId:QC,useHostTransitionStatus:Yy,useFormState:$C,useActionState:$C,useOptimistic:function(a,c){var d=sn();return At!==null?MC(d,At,a,c):(d.baseState=a,[a,d.queue.dispatch])},useMemoCache:Vy,useCacheRefresh:e1};s1.useEffectEvent=HC;function Qy(a,c,d,p){c=a.memoizedState,d=d(p,c),d=d==null?c:m({},c,d),a.memoizedState=d,a.lanes===0&&(a.updateQueue.baseState=d)}var eb={enqueueSetState:function(a,c,d){a=a._reactInternals;var p=_r(),v=Ws(p);v.payload=c,d!=null&&(v.callback=d),c=Ks(a,v,p),c!==null&&(pr(c,a,p),cu(c,a,p))},enqueueReplaceState:function(a,c,d){a=a._reactInternals;var p=_r(),v=Ws(p);v.tag=1,v.payload=c,d!=null&&(v.callback=d),c=Ks(a,v,p),c!==null&&(pr(c,a,p),cu(c,a,p))},enqueueForceUpdate:function(a,c){a=a._reactInternals;var d=_r(),p=Ws(d);p.tag=2,c!=null&&(p.callback=c),c=Ks(a,p,d),c!==null&&(pr(c,a,d),cu(c,a,d))}};function o1(a,c,d,p,v,w,T){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(p,w,T):c.prototype&&c.prototype.isPureReactComponent?!tu(d,p)||!tu(v,w):!0}function a1(a,c,d,p){a=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(d,p),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(d,p),c.state!==a&&eb.enqueueReplaceState(c,c.state,null)}function ya(a,c){var d=c;if("ref"in c){d={};for(var p in c)p!=="ref"&&(d[p]=c[p])}if(a=a.defaultProps){d===c&&(d=m({},d));for(var v in a)d[v]===void 0&&(d[v]=a[v])}return d}function l1(a){Ef(a)}function c1(a){console.error(a)}function u1(a){Ef(a)}function Kf(a,c){try{var d=a.onUncaughtError;d(c.value,{componentStack:c.stack})}catch(p){setTimeout(function(){throw p})}}function d1(a,c,d){try{var p=a.onCaughtError;p(d.value,{componentStack:d.stack,errorBoundary:c.tag===1?c.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function tb(a,c,d){return d=Ws(d),d.tag=3,d.payload={element:null},d.callback=function(){Kf(a,c)},d}function f1(a){return a=Ws(a),a.tag=3,a}function h1(a,c,d,p){var v=d.type.getDerivedStateFromError;if(typeof v=="function"){var w=p.value;a.payload=function(){return v(w)},a.callback=function(){d1(c,d,p)}}var T=d.stateNode;T!==null&&typeof T.componentDidCatch=="function"&&(a.callback=function(){d1(c,d,p),typeof v!="function"&&(eo===null?eo=new Set([this]):eo.add(this));var N=p.stack;this.componentDidCatch(p.value,{componentStack:N!==null?N:""})})}function IP(a,c,d,p,v){if(d.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(c=d.alternate,c!==null&&El(c,d,v,!0),d=kr.current,d!==null){switch(d.tag){case 31:case 13:return Wr===null?oh():d.alternate===null&&Xt===0&&(Xt=3),d.flags&=-257,d.flags|=65536,d.lanes=v,p===jf?d.flags|=16384:(c=d.updateQueue,c===null?d.updateQueue=new Set([p]):c.add(p),Tb(a,p,v)),!1;case 22:return d.flags|=65536,p===jf?d.flags|=16384:(c=d.updateQueue,c===null?(c={transitions:null,markerInstances:null,retryQueue:new Set([p])},d.updateQueue=c):(d=c.retryQueue,d===null?c.retryQueue=new Set([p]):d.add(p)),Tb(a,p,v)),!1}throw Error(r(435,d.tag))}return Tb(a,p,v),oh(),!1}if(ut)return c=kr.current,c!==null?((c.flags&65536)===0&&(c.flags|=256),c.flags|=65536,c.lanes=v,p!==xy&&(a=Error(r(422),{cause:p}),iu(Ur(a,d)))):(p!==xy&&(c=Error(r(423),{cause:p}),iu(Ur(c,d))),a=a.current.alternate,a.flags|=65536,v&=-v,a.lanes|=v,p=Ur(p,d),v=tb(a.stateNode,p,v),Ny(a,v),Xt!==4&&(Xt=2)),!1;var w=Error(r(520),{cause:p});if(w=Ur(w,d),ku===null?ku=[w]:ku.push(w),Xt!==4&&(Xt=2),c===null)return!0;p=Ur(p,d),d=c;do{switch(d.tag){case 3:return d.flags|=65536,a=v&-v,d.lanes|=a,a=tb(d.stateNode,p,a),Ny(d,a),!1;case 1:if(c=d.type,w=d.stateNode,(d.flags&128)===0&&(typeof c.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(eo===null||!eo.has(w))))return d.flags|=65536,v&=-v,d.lanes|=v,v=f1(v),h1(v,a,d,p),Ny(d,v),!1}d=d.return}while(d!==null);return!1}var nb=Error(r(461)),dn=!1;function jn(a,c,d,p){c.child=a===null?yC(c,null,d,p):ma(c,a.child,d,p)}function p1(a,c,d,p,v){d=d.render;var w=c.ref;if("ref"in p){var T={};for(var N in p)N!=="ref"&&(T[N]=p[N])}else T=p;return da(c),p=Py(a,c,d,T,w,v),N=zy(),a!==null&&!dn?($y(a,c,v),Qi(a,c,v)):(ut&&N&&by(c),c.flags|=1,jn(a,c,p,v),c.child)}function m1(a,c,d,p,v){if(a===null){var w=d.type;return typeof w=="function"&&!my(w)&&w.defaultProps===void 0&&d.compare===null?(c.tag=15,c.type=w,g1(a,c,w,p,v)):(a=Rf(d.type,null,p,c,c.mode,v),a.ref=c.ref,a.return=c,c.child=a)}if(w=a.child,!ub(a,v)){var T=w.memoizedProps;if(d=d.compare,d=d!==null?d:tu,d(T,p)&&a.ref===c.ref)return Qi(a,c,v)}return c.flags|=1,a=Wi(w,p),a.ref=c.ref,a.return=c,c.child=a}function g1(a,c,d,p,v){if(a!==null){var w=a.memoizedProps;if(tu(w,p)&&a.ref===c.ref)if(dn=!1,c.pendingProps=p=w,ub(a,v))(a.flags&131072)!==0&&(dn=!0);else return c.lanes=a.lanes,Qi(a,c,v)}return rb(a,c,d,p,v)}function y1(a,c,d,p){var v=p.children,w=a!==null?a.memoizedState:null;if(a===null&&c.stateNode===null&&(c.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),p.mode==="hidden"){if((c.flags&128)!==0){if(w=w!==null?w.baseLanes|d:d,a!==null){for(p=c.child=a.child,v=0;p!==null;)v=v|p.lanes|p.childLanes,p=p.sibling;p=v&~w}else p=0,c.child=null;return b1(a,c,w,d,p)}if((d&536870912)!==0)c.memoizedState={baseLanes:0,cachePool:null},a!==null&&Df(c,w!==null?w.cachePool:null),w!==null?xC(c,w):Dy(),wC(c);else return p=c.lanes=536870912,b1(a,c,w!==null?w.baseLanes|d:d,d,p)}else w!==null?(Df(c,w.cachePool),xC(c,w),Ys(),c.memoizedState=null):(a!==null&&Df(c,null),Dy(),Ys());return jn(a,c,v,d),c.child}function gu(a,c){return a!==null&&a.tag===22||c.stateNode!==null||(c.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.sibling}function b1(a,c,d,p,v){var w=_y();return w=w===null?null:{parent:cn._currentValue,pool:w},c.memoizedState={baseLanes:d,cachePool:w},a!==null&&Df(c,null),Dy(),wC(c),a!==null&&El(a,c,p,!0),c.childLanes=v,null}function Zf(a,c){return c=Xf({mode:c.mode,children:c.children},a.mode),c.ref=a.ref,a.child=c,c.return=a,c}function v1(a,c,d){return ma(c,a.child,null,d),a=Zf(c,c.pendingProps),a.flags|=2,Cr(c),c.memoizedState=null,a}function jP(a,c,d){var p=c.pendingProps,v=(c.flags&128)!==0;if(c.flags&=-129,a===null){if(ut){if(p.mode==="hidden")return a=Zf(c,p),c.lanes=536870912,gu(null,a);if(jy(c),(a=$t)?(a=NE(a,Gr),a=a!==null&&a.data==="&"?a:null,a!==null&&(c.memoizedState={dehydrated:a,treeContext:Hs!==null?{id:Ci,overflow:Ei}:null,retryLane:536870912,hydrationErrors:null},d=nC(a),d.return=c,c.child=d,Dn=c,$t=null)):a=null,a===null)throw Fs(c);return c.lanes=536870912,null}return Zf(c,p)}var w=a.memoizedState;if(w!==null){var T=w.dehydrated;if(jy(c),v)if(c.flags&256)c.flags&=-257,c=v1(a,c,d);else if(c.memoizedState!==null)c.child=a.child,c.flags|=128,c=null;else throw Error(r(558));else if(dn||El(a,c,d,!1),v=(d&a.childLanes)!==0,dn||v){if(p=Dt,p!==null&&(T=qc(p,d),T!==0&&T!==w.retryLane))throw w.retryLane=T,aa(a,T),pr(p,a,T),nb;oh(),c=v1(a,c,d)}else a=w.treeContext,$t=Kr(T.nextSibling),Dn=c,ut=!0,Us=null,Gr=!1,a!==null&&sC(c,a),c=Zf(c,p),c.flags|=4096;return c}return a=Wi(a.child,{mode:p.mode,children:p.children}),a.ref=c.ref,c.child=a,a.return=c,a}function Yf(a,c){var d=c.ref;if(d===null)a!==null&&a.ref!==null&&(c.flags|=4194816);else{if(typeof d!="function"&&typeof d!="object")throw Error(r(284));(a===null||a.ref!==d)&&(c.flags|=4194816)}}function rb(a,c,d,p,v){return da(c),d=Py(a,c,d,p,void 0,v),p=zy(),a!==null&&!dn?($y(a,c,v),Qi(a,c,v)):(ut&&p&&by(c),c.flags|=1,jn(a,c,d,v),c.child)}function x1(a,c,d,p,v,w){return da(c),c.updateQueue=null,d=kC(c,p,d,v),SC(a),p=zy(),a!==null&&!dn?($y(a,c,w),Qi(a,c,w)):(ut&&p&&by(c),c.flags|=1,jn(a,c,d,w),c.child)}function w1(a,c,d,p,v){if(da(c),c.stateNode===null){var w=wl,T=d.contextType;typeof T=="object"&&T!==null&&(w=In(T)),w=new d(p,w),c.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,w.updater=eb,c.stateNode=w,w._reactInternals=c,w=c.stateNode,w.props=p,w.state=c.memoizedState,w.refs={},Ry(c),T=d.contextType,w.context=typeof T=="object"&&T!==null?In(T):wl,w.state=c.memoizedState,T=d.getDerivedStateFromProps,typeof T=="function"&&(Qy(c,d,T,p),w.state=c.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(T=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),T!==w.state&&eb.enqueueReplaceState(w,w.state,null),du(c,p,w,v),uu(),w.state=c.memoizedState),typeof w.componentDidMount=="function"&&(c.flags|=4194308),p=!0}else if(a===null){w=c.stateNode;var N=c.memoizedProps,$=ya(d,N);w.props=$;var J=w.context,se=d.contextType;T=wl,typeof se=="object"&&se!==null&&(T=In(se));var ce=d.getDerivedStateFromProps;se=typeof ce=="function"||typeof w.getSnapshotBeforeUpdate=="function",N=c.pendingProps!==N,se||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(N||J!==T)&&a1(c,w,p,T),Gs=!1;var Q=c.memoizedState;w.state=Q,du(c,p,w,v),uu(),J=c.memoizedState,N||Q!==J||Gs?(typeof ce=="function"&&(Qy(c,d,ce,p),J=c.memoizedState),($=Gs||o1(c,d,$,p,Q,J,T))?(se||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(c.flags|=4194308)):(typeof w.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=p,c.memoizedState=J),w.props=p,w.state=J,w.context=T,p=$):(typeof w.componentDidMount=="function"&&(c.flags|=4194308),p=!1)}else{w=c.stateNode,My(a,c),T=c.memoizedProps,se=ya(d,T),w.props=se,ce=c.pendingProps,Q=w.context,J=d.contextType,$=wl,typeof J=="object"&&J!==null&&($=In(J)),N=d.getDerivedStateFromProps,(J=typeof N=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(T!==ce||Q!==$)&&a1(c,w,p,$),Gs=!1,Q=c.memoizedState,w.state=Q,du(c,p,w,v),uu();var ne=c.memoizedState;T!==ce||Q!==ne||Gs||a!==null&&a.dependencies!==null&&Nf(a.dependencies)?(typeof N=="function"&&(Qy(c,d,N,p),ne=c.memoizedState),(se=Gs||o1(c,d,se,p,Q,ne,$)||a!==null&&a.dependencies!==null&&Nf(a.dependencies))?(J||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(p,ne,$),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(p,ne,$)),typeof w.componentDidUpdate=="function"&&(c.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof w.componentDidUpdate!="function"||T===a.memoizedProps&&Q===a.memoizedState||(c.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||T===a.memoizedProps&&Q===a.memoizedState||(c.flags|=1024),c.memoizedProps=p,c.memoizedState=ne),w.props=p,w.state=ne,w.context=$,p=se):(typeof w.componentDidUpdate!="function"||T===a.memoizedProps&&Q===a.memoizedState||(c.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||T===a.memoizedProps&&Q===a.memoizedState||(c.flags|=1024),p=!1)}return w=p,Yf(a,c),p=(c.flags&128)!==0,w||p?(w=c.stateNode,d=p&&typeof d.getDerivedStateFromError!="function"?null:w.render(),c.flags|=1,a!==null&&p?(c.child=ma(c,a.child,null,v),c.child=ma(c,null,d,v)):jn(a,c,d,v),c.memoizedState=w.state,a=c.child):a=Qi(a,c,v),a}function S1(a,c,d,p){return ca(),c.flags|=256,jn(a,c,d,p),c.child}var ib={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function sb(a){return{baseLanes:a,cachePool:dC()}}function ob(a,c,d){return a=a!==null?a.childLanes&~d:0,c&&(a|=Tr),a}function k1(a,c,d){var p=c.pendingProps,v=!1,w=(c.flags&128)!==0,T;if((T=w)||(T=a!==null&&a.memoizedState===null?!1:(rn.current&2)!==0),T&&(v=!0,c.flags&=-129),T=(c.flags&32)!==0,c.flags&=-33,a===null){if(ut){if(v?Zs(c):Ys(),(a=$t)?(a=NE(a,Gr),a=a!==null&&a.data!=="&"?a:null,a!==null&&(c.memoizedState={dehydrated:a,treeContext:Hs!==null?{id:Ci,overflow:Ei}:null,retryLane:536870912,hydrationErrors:null},d=nC(a),d.return=c,c.child=d,Dn=c,$t=null)):a=null,a===null)throw Fs(c);return Hb(a)?c.lanes=32:c.lanes=536870912,null}var N=p.children;return p=p.fallback,v?(Ys(),v=c.mode,N=Xf({mode:"hidden",children:N},v),p=la(p,v,d,null),N.return=c,p.return=c,N.sibling=p,c.child=N,p=c.child,p.memoizedState=sb(d),p.childLanes=ob(a,T,d),c.memoizedState=ib,gu(null,p)):(Zs(c),ab(c,N))}var $=a.memoizedState;if($!==null&&(N=$.dehydrated,N!==null)){if(w)c.flags&256?(Zs(c),c.flags&=-257,c=lb(a,c,d)):c.memoizedState!==null?(Ys(),c.child=a.child,c.flags|=128,c=null):(Ys(),N=p.fallback,v=c.mode,p=Xf({mode:"visible",children:p.children},v),N=la(N,v,d,null),N.flags|=2,p.return=c,N.return=c,p.sibling=N,c.child=p,ma(c,a.child,null,d),p=c.child,p.memoizedState=sb(d),p.childLanes=ob(a,T,d),c.memoizedState=ib,c=gu(null,p));else if(Zs(c),Hb(N)){if(T=N.nextSibling&&N.nextSibling.dataset,T)var J=T.dgst;T=J,p=Error(r(419)),p.stack="",p.digest=T,iu({value:p,source:null,stack:null}),c=lb(a,c,d)}else if(dn||El(a,c,d,!1),T=(d&a.childLanes)!==0,dn||T){if(T=Dt,T!==null&&(p=qc(T,d),p!==0&&p!==$.retryLane))throw $.retryLane=p,aa(a,p),pr(T,a,p),nb;Vb(N)||oh(),c=lb(a,c,d)}else Vb(N)?(c.flags|=192,c.child=a.child,c=null):(a=$.treeContext,$t=Kr(N.nextSibling),Dn=c,ut=!0,Us=null,Gr=!1,a!==null&&sC(c,a),c=ab(c,p.children),c.flags|=4096);return c}return v?(Ys(),N=p.fallback,v=c.mode,$=a.child,J=$.sibling,p=Wi($,{mode:"hidden",children:p.children}),p.subtreeFlags=$.subtreeFlags&65011712,J!==null?N=Wi(J,N):(N=la(N,v,d,null),N.flags|=2),N.return=c,p.return=c,p.sibling=N,c.child=p,gu(null,p),p=c.child,N=a.child.memoizedState,N===null?N=sb(d):(v=N.cachePool,v!==null?($=cn._currentValue,v=v.parent!==$?{parent:$,pool:$}:v):v=dC(),N={baseLanes:N.baseLanes|d,cachePool:v}),p.memoizedState=N,p.childLanes=ob(a,T,d),c.memoizedState=ib,gu(a.child,p)):(Zs(c),d=a.child,a=d.sibling,d=Wi(d,{mode:"visible",children:p.children}),d.return=c,d.sibling=null,a!==null&&(T=c.deletions,T===null?(c.deletions=[a],c.flags|=16):T.push(a)),c.child=d,c.memoizedState=null,d)}function ab(a,c){return c=Xf({mode:"visible",children:c},a.mode),c.return=a,a.child=c}function Xf(a,c){return a=Sr(22,a,null,c),a.lanes=0,a}function lb(a,c,d){return ma(c,a.child,null,d),a=ab(c,c.pendingProps.children),a.flags|=2,c.memoizedState=null,a}function C1(a,c,d){a.lanes|=c;var p=a.alternate;p!==null&&(p.lanes|=c),ky(a.return,c,d)}function cb(a,c,d,p,v,w){var T=a.memoizedState;T===null?a.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:p,tail:d,tailMode:v,treeForkCount:w}:(T.isBackwards=c,T.rendering=null,T.renderingStartTime=0,T.last=p,T.tail=d,T.tailMode=v,T.treeForkCount=w)}function E1(a,c,d){var p=c.pendingProps,v=p.revealOrder,w=p.tail;p=p.children;var T=rn.current,N=(T&2)!==0;if(N?(T=T&1|2,c.flags|=128):T&=1,he(rn,T),jn(a,c,p,d),p=ut?ru:0,!N&&a!==null&&(a.flags&128)!==0)e:for(a=c.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&C1(a,d,c);else if(a.tag===19)C1(a,d,c);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===c)break e;for(;a.sibling===null;){if(a.return===null||a.return===c)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}switch(v){case"forwards":for(d=c.child,v=null;d!==null;)a=d.alternate,a!==null&&$f(a)===null&&(v=d),d=d.sibling;d=v,d===null?(v=c.child,c.child=null):(v=d.sibling,d.sibling=null),cb(c,!1,v,d,w,p);break;case"backwards":case"unstable_legacy-backwards":for(d=null,v=c.child,c.child=null;v!==null;){if(a=v.alternate,a!==null&&$f(a)===null){c.child=v;break}a=v.sibling,v.sibling=d,d=v,v=a}cb(c,!0,d,null,w,p);break;case"together":cb(c,!1,null,null,void 0,p);break;default:c.memoizedState=null}return c.child}function Qi(a,c,d){if(a!==null&&(c.dependencies=a.dependencies),Qs|=c.lanes,(d&c.childLanes)===0)if(a!==null){if(El(a,c,d,!1),(d&c.childLanes)===0)return null}else return null;if(a!==null&&c.child!==a.child)throw Error(r(153));if(c.child!==null){for(a=c.child,d=Wi(a,a.pendingProps),c.child=d,d.return=c;a.sibling!==null;)a=a.sibling,d=d.sibling=Wi(a,a.pendingProps),d.return=c;d.sibling=null}return c.child}function ub(a,c){return(a.lanes&c)!==0?!0:(a=a.dependencies,!!(a!==null&&Nf(a)))}function LP(a,c,d){switch(c.tag){case 3:Te(c,c.stateNode.containerInfo),qs(c,cn,a.memoizedState.cache),ca();break;case 27:case 5:pe(c);break;case 4:Te(c,c.stateNode.containerInfo);break;case 10:qs(c,c.type,c.memoizedProps.value);break;case 31:if(c.memoizedState!==null)return c.flags|=128,jy(c),null;break;case 13:var p=c.memoizedState;if(p!==null)return p.dehydrated!==null?(Zs(c),c.flags|=128,null):(d&c.child.childLanes)!==0?k1(a,c,d):(Zs(c),a=Qi(a,c,d),a!==null?a.sibling:null);Zs(c);break;case 19:var v=(a.flags&128)!==0;if(p=(d&c.childLanes)!==0,p||(El(a,c,d,!1),p=(d&c.childLanes)!==0),v){if(p)return E1(a,c,d);c.flags|=128}if(v=c.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),he(rn,rn.current),p)break;return null;case 22:return c.lanes=0,y1(a,c,d,c.pendingProps);case 24:qs(c,cn,a.memoizedState.cache)}return Qi(a,c,d)}function T1(a,c,d){if(a!==null)if(a.memoizedProps!==c.pendingProps)dn=!0;else{if(!ub(a,d)&&(c.flags&128)===0)return dn=!1,LP(a,c,d);dn=(a.flags&131072)!==0}else dn=!1,ut&&(c.flags&1048576)!==0&&iC(c,ru,c.index);switch(c.lanes=0,c.tag){case 16:e:{var p=c.pendingProps;if(a=ha(c.elementType),c.type=a,typeof a=="function")my(a)?(p=ya(a,p),c.tag=1,c=w1(null,c,a,p,d)):(c.tag=0,c=rb(null,c,a,p,d));else{if(a!=null){var v=a.$$typeof;if(v===R){c.tag=11,c=p1(null,c,a,p,d);break e}else if(v===D){c.tag=14,c=m1(null,c,a,p,d);break e}}throw c=te(a)||a,Error(r(306,c,""))}}return c;case 0:return rb(a,c,c.type,c.pendingProps,d);case 1:return p=c.type,v=ya(p,c.pendingProps),w1(a,c,p,v,d);case 3:e:{if(Te(c,c.stateNode.containerInfo),a===null)throw Error(r(387));p=c.pendingProps;var w=c.memoizedState;v=w.element,My(a,c),du(c,p,null,d);var T=c.memoizedState;if(p=T.cache,qs(c,cn,p),p!==w.cache&&Cy(c,[cn],d,!0),uu(),p=T.element,w.isDehydrated)if(w={element:p,isDehydrated:!1,cache:T.cache},c.updateQueue.baseState=w,c.memoizedState=w,c.flags&256){c=S1(a,c,p,d);break e}else if(p!==v){v=Ur(Error(r(424)),c),iu(v),c=S1(a,c,p,d);break e}else for(a=c.stateNode.containerInfo,a.nodeType===9?a=a.body:a=a.nodeName==="HTML"?a.ownerDocument.body:a,$t=Kr(a.firstChild),Dn=c,ut=!0,Us=null,Gr=!0,d=yC(c,null,p,d),c.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(ca(),p===v){c=Qi(a,c,d);break e}jn(a,c,p,d)}c=c.child}return c;case 26:return Yf(a,c),a===null?(d=PE(c.type,null,c.pendingProps,null))?c.memoizedState=d:ut||(d=c.type,a=c.pendingProps,p=hh(Re.current).createElement(d),p[On]=c,p[lr]=a,Ln(p,d,a),Sn(p),c.stateNode=p):c.memoizedState=PE(c.type,a.memoizedProps,c.pendingProps,a.memoizedState),null;case 27:return pe(c),a===null&&ut&&(p=c.stateNode=IE(c.type,c.pendingProps,Re.current),Dn=c,Gr=!0,v=$t,io(c.type)?(Ub=v,$t=Kr(p.firstChild)):$t=v),jn(a,c,c.pendingProps.children,d),Yf(a,c),a===null&&(c.flags|=4194304),c.child;case 5:return a===null&&ut&&((v=p=$t)&&(p=fz(p,c.type,c.pendingProps,Gr),p!==null?(c.stateNode=p,Dn=c,$t=Kr(p.firstChild),Gr=!1,v=!0):v=!1),v||Fs(c)),pe(c),v=c.type,w=c.pendingProps,T=a!==null?a.memoizedProps:null,p=w.children,zb(v,w)?p=null:T!==null&&zb(v,T)&&(c.flags|=32),c.memoizedState!==null&&(v=Py(a,c,_P,null,null,d),Nu._currentValue=v),Yf(a,c),jn(a,c,p,d),c.child;case 6:return a===null&&ut&&((a=d=$t)&&(d=hz(d,c.pendingProps,Gr),d!==null?(c.stateNode=d,Dn=c,$t=null,a=!0):a=!1),a||Fs(c)),null;case 13:return k1(a,c,d);case 4:return Te(c,c.stateNode.containerInfo),p=c.pendingProps,a===null?c.child=ma(c,null,p,d):jn(a,c,p,d),c.child;case 11:return p1(a,c,c.type,c.pendingProps,d);case 7:return jn(a,c,c.pendingProps,d),c.child;case 8:return jn(a,c,c.pendingProps.children,d),c.child;case 12:return jn(a,c,c.pendingProps.children,d),c.child;case 10:return p=c.pendingProps,qs(c,c.type,p.value),jn(a,c,p.children,d),c.child;case 9:return v=c.type._context,p=c.pendingProps.children,da(c),v=In(v),p=p(v),c.flags|=1,jn(a,c,p,d),c.child;case 14:return m1(a,c,c.type,c.pendingProps,d);case 15:return g1(a,c,c.type,c.pendingProps,d);case 19:return E1(a,c,d);case 31:return jP(a,c,d);case 22:return y1(a,c,d,c.pendingProps);case 24:return da(c),p=In(cn),a===null?(v=_y(),v===null&&(v=Dt,w=Ey(),v.pooledCache=w,w.refCount++,w!==null&&(v.pooledCacheLanes|=d),v=w),c.memoizedState={parent:p,cache:v},Ry(c),qs(c,cn,v)):((a.lanes&d)!==0&&(My(a,c),du(c,null,null,d),uu()),v=a.memoizedState,w=c.memoizedState,v.parent!==p?(v={parent:p,cache:p},c.memoizedState=v,c.lanes===0&&(c.memoizedState=c.updateQueue.baseState=v),qs(c,cn,p)):(p=w.cache,qs(c,cn,p),p!==v.cache&&Cy(c,[cn],d,!0))),jn(a,c,c.pendingProps.children,d),c.child;case 29:throw c.pendingProps}throw Error(r(156,c.tag))}function es(a){a.flags|=4}function db(a,c,d,p,v){if((c=(a.mode&32)!==0)&&(c=!1),c){if(a.flags|=16777216,(v&335544128)===v)if(a.stateNode.complete)a.flags|=8192;else if(Q1())a.flags|=8192;else throw pa=jf,Ay}else a.flags&=-16777217}function _1(a,c){if(c.type!=="stylesheet"||(c.state.loading&4)!==0)a.flags&=-16777217;else if(a.flags|=16777216,!HE(c))if(Q1())a.flags|=8192;else throw pa=jf,Ay}function Jf(a,c){c!==null&&(a.flags|=4),a.flags&16384&&(c=a.tag!==22?Fe():536870912,a.lanes|=c,Pl|=c)}function yu(a,c){if(!ut)switch(a.tailMode){case"hidden":c=a.tail;for(var d=null;c!==null;)c.alternate!==null&&(d=c),c=c.sibling;d===null?a.tail=null:d.sibling=null;break;case"collapsed":d=a.tail;for(var p=null;d!==null;)d.alternate!==null&&(p=d),d=d.sibling;p===null?c||a.tail===null?a.tail=null:a.tail.sibling=null:p.sibling=null}}function Bt(a){var c=a.alternate!==null&&a.alternate.child===a.child,d=0,p=0;if(c)for(var v=a.child;v!==null;)d|=v.lanes|v.childLanes,p|=v.subtreeFlags&65011712,p|=v.flags&65011712,v.return=a,v=v.sibling;else for(v=a.child;v!==null;)d|=v.lanes|v.childLanes,p|=v.subtreeFlags,p|=v.flags,v.return=a,v=v.sibling;return a.subtreeFlags|=p,a.childLanes=d,c}function PP(a,c,d){var p=c.pendingProps;switch(vy(c),c.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Bt(c),null;case 1:return Bt(c),null;case 3:return d=c.stateNode,p=null,a!==null&&(p=a.memoizedState.cache),c.memoizedState.cache!==p&&(c.flags|=2048),Yi(cn),oe(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(a===null||a.child===null)&&(Cl(c)?es(c):a===null||a.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,wy())),Bt(c),null;case 26:var v=c.type,w=c.memoizedState;return a===null?(es(c),w!==null?(Bt(c),_1(c,w)):(Bt(c),db(c,v,null,p,d))):w?w!==a.memoizedState?(es(c),Bt(c),_1(c,w)):(Bt(c),c.flags&=-16777217):(a=a.memoizedProps,a!==p&&es(c),Bt(c),db(c,v,a,p,d)),null;case 27:if(Ie(c),d=Re.current,v=c.type,a!==null&&c.stateNode!=null)a.memoizedProps!==p&&es(c);else{if(!p){if(c.stateNode===null)throw Error(r(166));return Bt(c),null}a=ve.current,Cl(c)?oC(c):(a=IE(v,p,d),c.stateNode=a,es(c))}return Bt(c),null;case 5:if(Ie(c),v=c.type,a!==null&&c.stateNode!=null)a.memoizedProps!==p&&es(c);else{if(!p){if(c.stateNode===null)throw Error(r(166));return Bt(c),null}if(w=ve.current,Cl(c))oC(c);else{var T=hh(Re.current);switch(w){case 1:w=T.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:w=T.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":w=T.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":w=T.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":w=T.createElement("div"),w.innerHTML="<script><\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof p.is=="string"?T.createElement("select",{is:p.is}):T.createElement("select"),p.multiple?w.multiple=!0:p.size&&(w.size=p.size);break;default:w=typeof p.is=="string"?T.createElement(v,{is:p.is}):T.createElement(v)}}w[On]=c,w[lr]=p;e:for(T=c.child;T!==null;){if(T.tag===5||T.tag===6)w.appendChild(T.stateNode);else if(T.tag!==4&&T.tag!==27&&T.child!==null){T.child.return=T,T=T.child;continue}if(T===c)break e;for(;T.sibling===null;){if(T.return===null||T.return===c)break e;T=T.return}T.sibling.return=T.return,T=T.sibling}c.stateNode=w;e:switch(Ln(w,v,p),v){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}p&&es(c)}}return Bt(c),db(c,c.type,a===null?null:a.memoizedProps,c.pendingProps,d),null;case 6:if(a&&c.stateNode!=null)a.memoizedProps!==p&&es(c);else{if(typeof p!="string"&&c.stateNode===null)throw Error(r(166));if(a=Re.current,Cl(c)){if(a=c.stateNode,d=c.memoizedProps,p=null,v=Dn,v!==null)switch(v.tag){case 27:case 5:p=v.memoizedProps}a[On]=c,a=!!(a.nodeValue===d||p!==null&&p.suppressHydrationWarning===!0||kE(a.nodeValue,d)),a||Fs(c,!0)}else a=hh(a).createTextNode(p),a[On]=c,c.stateNode=a}return Bt(c),null;case 31:if(d=c.memoizedState,a===null||a.memoizedState!==null){if(p=Cl(c),d!==null){if(a===null){if(!p)throw Error(r(318));if(a=c.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(557));a[On]=c}else ca(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Bt(c),a=!1}else d=wy(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=d),a=!0;if(!a)return c.flags&256?(Cr(c),c):(Cr(c),null);if((c.flags&128)!==0)throw Error(r(558))}return Bt(c),null;case 13:if(p=c.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(v=Cl(c),p!==null&&p.dehydrated!==null){if(a===null){if(!v)throw Error(r(318));if(v=c.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(r(317));v[On]=c}else ca(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Bt(c),v=!1}else v=wy(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=v),v=!0;if(!v)return c.flags&256?(Cr(c),c):(Cr(c),null)}return Cr(c),(c.flags&128)!==0?(c.lanes=d,c):(d=p!==null,a=a!==null&&a.memoizedState!==null,d&&(p=c.child,v=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(v=p.alternate.memoizedState.cachePool.pool),w=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(w=p.memoizedState.cachePool.pool),w!==v&&(p.flags|=2048)),d!==a&&d&&(c.child.flags|=8192),Jf(c,c.updateQueue),Bt(c),null);case 4:return oe(),a===null&&Db(c.stateNode.containerInfo),Bt(c),null;case 10:return Yi(c.type),Bt(c),null;case 19:if(Y(rn),p=c.memoizedState,p===null)return Bt(c),null;if(v=(c.flags&128)!==0,w=p.rendering,w===null)if(v)yu(p,!1);else{if(Xt!==0||a!==null&&(a.flags&128)!==0)for(a=c.child;a!==null;){if(w=$f(a),w!==null){for(c.flags|=128,yu(p,!1),a=w.updateQueue,c.updateQueue=a,Jf(c,a),c.subtreeFlags=0,a=d,d=c.child;d!==null;)tC(d,a),d=d.sibling;return he(rn,rn.current&1|2),ut&&Ki(c,p.treeForkCount),c.child}a=a.sibling}p.tail!==null&&qt()>rh&&(c.flags|=128,v=!0,yu(p,!1),c.lanes=4194304)}else{if(!v)if(a=$f(w),a!==null){if(c.flags|=128,v=!0,a=a.updateQueue,c.updateQueue=a,Jf(c,a),yu(p,!0),p.tail===null&&p.tailMode==="hidden"&&!w.alternate&&!ut)return Bt(c),null}else 2*qt()-p.renderingStartTime>rh&&d!==536870912&&(c.flags|=128,v=!0,yu(p,!1),c.lanes=4194304);p.isBackwards?(w.sibling=c.child,c.child=w):(a=p.last,a!==null?a.sibling=w:c.child=w,p.last=w)}return p.tail!==null?(a=p.tail,p.rendering=a,p.tail=a.sibling,p.renderingStartTime=qt(),a.sibling=null,d=rn.current,he(rn,v?d&1|2:d&1),ut&&Ki(c,p.treeForkCount),a):(Bt(c),null);case 22:case 23:return Cr(c),Iy(),p=c.memoizedState!==null,a!==null?a.memoizedState!==null!==p&&(c.flags|=8192):p&&(c.flags|=8192),p?(d&536870912)!==0&&(c.flags&128)===0&&(Bt(c),c.subtreeFlags&6&&(c.flags|=8192)):Bt(c),d=c.updateQueue,d!==null&&Jf(c,d.retryQueue),d=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),p=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(p=c.memoizedState.cachePool.pool),p!==d&&(c.flags|=2048),a!==null&&Y(fa),null;case 24:return d=null,a!==null&&(d=a.memoizedState.cache),c.memoizedState.cache!==d&&(c.flags|=2048),Yi(cn),Bt(c),null;case 25:return null;case 30:return null}throw Error(r(156,c.tag))}function zP(a,c){switch(vy(c),c.tag){case 1:return a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 3:return Yi(cn),oe(),a=c.flags,(a&65536)!==0&&(a&128)===0?(c.flags=a&-65537|128,c):null;case 26:case 27:case 5:return Ie(c),null;case 31:if(c.memoizedState!==null){if(Cr(c),c.alternate===null)throw Error(r(340));ca()}return a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 13:if(Cr(c),a=c.memoizedState,a!==null&&a.dehydrated!==null){if(c.alternate===null)throw Error(r(340));ca()}return a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 19:return Y(rn),null;case 4:return oe(),null;case 10:return Yi(c.type),null;case 22:case 23:return Cr(c),Iy(),a!==null&&Y(fa),a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 24:return Yi(cn),null;case 25:return null;default:return null}}function A1(a,c){switch(vy(c),c.tag){case 3:Yi(cn),oe();break;case 26:case 27:case 5:Ie(c);break;case 4:oe();break;case 31:c.memoizedState!==null&&Cr(c);break;case 13:Cr(c);break;case 19:Y(rn);break;case 10:Yi(c.type);break;case 22:case 23:Cr(c),Iy(),a!==null&&Y(fa);break;case 24:Yi(cn)}}function bu(a,c){try{var d=c.updateQueue,p=d!==null?d.lastEffect:null;if(p!==null){var v=p.next;d=v;do{if((d.tag&a)===a){p=void 0;var w=d.create,T=d.inst;p=w(),T.destroy=p}d=d.next}while(d!==v)}}catch(N){Ct(c,c.return,N)}}function Xs(a,c,d){try{var p=c.updateQueue,v=p!==null?p.lastEffect:null;if(v!==null){var w=v.next;p=w;do{if((p.tag&a)===a){var T=p.inst,N=T.destroy;if(N!==void 0){T.destroy=void 0,v=c;var $=d,J=N;try{J()}catch(se){Ct(v,$,se)}}}p=p.next}while(p!==w)}}catch(se){Ct(c,c.return,se)}}function R1(a){var c=a.updateQueue;if(c!==null){var d=a.stateNode;try{vC(c,d)}catch(p){Ct(a,a.return,p)}}}function M1(a,c,d){d.props=ya(a.type,a.memoizedProps),d.state=a.memoizedState;try{d.componentWillUnmount()}catch(p){Ct(a,c,p)}}function vu(a,c){try{var d=a.ref;if(d!==null){switch(a.tag){case 26:case 27:case 5:var p=a.stateNode;break;case 30:p=a.stateNode;break;default:p=a.stateNode}typeof d=="function"?a.refCleanup=d(p):d.current=p}}catch(v){Ct(a,c,v)}}function Ti(a,c){var d=a.ref,p=a.refCleanup;if(d!==null)if(typeof p=="function")try{p()}catch(v){Ct(a,c,v)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof d=="function")try{d(null)}catch(v){Ct(a,c,v)}else d.current=null}function N1(a){var c=a.type,d=a.memoizedProps,p=a.stateNode;try{e:switch(c){case"button":case"input":case"select":case"textarea":d.autoFocus&&p.focus();break e;case"img":d.src?p.src=d.src:d.srcSet&&(p.srcset=d.srcSet)}}catch(v){Ct(a,a.return,v)}}function fb(a,c,d){try{var p=a.stateNode;oz(p,a.type,d,c),p[lr]=c}catch(v){Ct(a,a.return,v)}}function O1(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&io(a.type)||a.tag===4}function hb(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||O1(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.tag===27&&io(a.type)||a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function pb(a,c,d){var p=a.tag;if(p===5||p===6)a=a.stateNode,c?(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d).insertBefore(a,c):(c=d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,c.appendChild(a),d=d._reactRootContainer,d!=null||c.onclick!==null||(c.onclick=qi));else if(p!==4&&(p===27&&io(a.type)&&(d=a.stateNode,c=null),a=a.child,a!==null))for(pb(a,c,d),a=a.sibling;a!==null;)pb(a,c,d),a=a.sibling}function Qf(a,c,d){var p=a.tag;if(p===5||p===6)a=a.stateNode,c?d.insertBefore(a,c):d.appendChild(a);else if(p!==4&&(p===27&&io(a.type)&&(d=a.stateNode),a=a.child,a!==null))for(Qf(a,c,d),a=a.sibling;a!==null;)Qf(a,c,d),a=a.sibling}function D1(a){var c=a.stateNode,d=a.memoizedProps;try{for(var p=a.type,v=c.attributes;v.length;)c.removeAttributeNode(v[0]);Ln(c,p,d),c[On]=a,c[lr]=d}catch(w){Ct(a,a.return,w)}}var ts=!1,fn=!1,mb=!1,I1=typeof WeakSet=="function"?WeakSet:Set,kn=null;function $P(a,c){if(a=a.containerInfo,Lb=xh,a=Gk(a),ly(a)){if("selectionStart"in a)var d={start:a.selectionStart,end:a.selectionEnd};else e:{d=(d=a.ownerDocument)&&d.defaultView||window;var p=d.getSelection&&d.getSelection();if(p&&p.rangeCount!==0){d=p.anchorNode;var v=p.anchorOffset,w=p.focusNode;p=p.focusOffset;try{d.nodeType,w.nodeType}catch{d=null;break e}var T=0,N=-1,$=-1,J=0,se=0,ce=a,Q=null;t:for(;;){for(var ne;ce!==d||v!==0&&ce.nodeType!==3||(N=T+v),ce!==w||p!==0&&ce.nodeType!==3||($=T+p),ce.nodeType===3&&(T+=ce.nodeValue.length),(ne=ce.firstChild)!==null;)Q=ce,ce=ne;for(;;){if(ce===a)break t;if(Q===d&&++J===v&&(N=T),Q===w&&++se===p&&($=T),(ne=ce.nextSibling)!==null)break;ce=Q,Q=ce.parentNode}ce=ne}d=N===-1||$===-1?null:{start:N,end:$}}else d=null}d=d||{start:0,end:0}}else d=null;for(Pb={focusedElem:a,selectionRange:d},xh=!1,kn=c;kn!==null;)if(c=kn,a=c.child,(c.subtreeFlags&1028)!==0&&a!==null)a.return=c,kn=a;else for(;kn!==null;){switch(c=kn,w=c.alternate,a=c.flags,c.tag){case 0:if((a&4)!==0&&(a=c.updateQueue,a=a!==null?a.events:null,a!==null))for(d=0;d<a.length;d++)v=a[d],v.ref.impl=v.nextImpl;break;case 11:case 15:break;case 1:if((a&1024)!==0&&w!==null){a=void 0,d=c,v=w.memoizedProps,w=w.memoizedState,p=d.stateNode;try{var Oe=ya(d.type,v);a=p.getSnapshotBeforeUpdate(Oe,w),p.__reactInternalSnapshotBeforeUpdate=a}catch(qe){Ct(d,d.return,qe)}}break;case 3:if((a&1024)!==0){if(a=c.stateNode.containerInfo,d=a.nodeType,d===9)Bb(a);else if(d===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":Bb(a);break;default:a.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((a&1024)!==0)throw Error(r(163))}if(a=c.sibling,a!==null){a.return=c.return,kn=a;break}kn=c.return}}function j1(a,c,d){var p=d.flags;switch(d.tag){case 0:case 11:case 15:rs(a,d),p&4&&bu(5,d);break;case 1:if(rs(a,d),p&4)if(a=d.stateNode,c===null)try{a.componentDidMount()}catch(T){Ct(d,d.return,T)}else{var v=ya(d.type,c.memoizedProps);c=c.memoizedState;try{a.componentDidUpdate(v,c,a.__reactInternalSnapshotBeforeUpdate)}catch(T){Ct(d,d.return,T)}}p&64&&R1(d),p&512&&vu(d,d.return);break;case 3:if(rs(a,d),p&64&&(a=d.updateQueue,a!==null)){if(c=null,d.child!==null)switch(d.child.tag){case 27:case 5:c=d.child.stateNode;break;case 1:c=d.child.stateNode}try{vC(a,c)}catch(T){Ct(d,d.return,T)}}break;case 27:c===null&&p&4&&D1(d);case 26:case 5:rs(a,d),c===null&&p&4&&N1(d),p&512&&vu(d,d.return);break;case 12:rs(a,d);break;case 31:rs(a,d),p&4&&z1(a,d);break;case 13:rs(a,d),p&4&&$1(a,d),p&64&&(a=d.memoizedState,a!==null&&(a=a.dehydrated,a!==null&&(d=KP.bind(null,d),pz(a,d))));break;case 22:if(p=d.memoizedState!==null||ts,!p){c=c!==null&&c.memoizedState!==null||fn,v=ts;var w=fn;ts=p,(fn=c)&&!w?is(a,d,(d.subtreeFlags&8772)!==0):rs(a,d),ts=v,fn=w}break;case 30:break;default:rs(a,d)}}function L1(a){var c=a.alternate;c!==null&&(a.alternate=null,L1(c)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(c=a.stateNode,c!==null&&qg(c)),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}var Ut=null,ur=!1;function ns(a,c,d){for(d=d.child;d!==null;)P1(a,c,d),d=d.sibling}function P1(a,c,d){if(ie&&typeof ie.onCommitFiberUnmount=="function")try{ie.onCommitFiberUnmount(H,d)}catch{}switch(d.tag){case 26:fn||Ti(d,c),ns(a,c,d),d.memoizedState?d.memoizedState.count--:d.stateNode&&(d=d.stateNode,d.parentNode.removeChild(d));break;case 27:fn||Ti(d,c);var p=Ut,v=ur;io(d.type)&&(Ut=d.stateNode,ur=!1),ns(a,c,d),Au(d.stateNode),Ut=p,ur=v;break;case 5:fn||Ti(d,c);case 6:if(p=Ut,v=ur,Ut=null,ns(a,c,d),Ut=p,ur=v,Ut!==null)if(ur)try{(Ut.nodeType===9?Ut.body:Ut.nodeName==="HTML"?Ut.ownerDocument.body:Ut).removeChild(d.stateNode)}catch(w){Ct(d,c,w)}else try{Ut.removeChild(d.stateNode)}catch(w){Ct(d,c,w)}break;case 18:Ut!==null&&(ur?(a=Ut,RE(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,d.stateNode),ql(a)):RE(Ut,d.stateNode));break;case 4:p=Ut,v=ur,Ut=d.stateNode.containerInfo,ur=!0,ns(a,c,d),Ut=p,ur=v;break;case 0:case 11:case 14:case 15:Xs(2,d,c),fn||Xs(4,d,c),ns(a,c,d);break;case 1:fn||(Ti(d,c),p=d.stateNode,typeof p.componentWillUnmount=="function"&&M1(d,c,p)),ns(a,c,d);break;case 21:ns(a,c,d);break;case 22:fn=(p=fn)||d.memoizedState!==null,ns(a,c,d),fn=p;break;default:ns(a,c,d)}}function z1(a,c){if(c.memoizedState===null&&(a=c.alternate,a!==null&&(a=a.memoizedState,a!==null))){a=a.dehydrated;try{ql(a)}catch(d){Ct(c,c.return,d)}}}function $1(a,c){if(c.memoizedState===null&&(a=c.alternate,a!==null&&(a=a.memoizedState,a!==null&&(a=a.dehydrated,a!==null))))try{ql(a)}catch(d){Ct(c,c.return,d)}}function BP(a){switch(a.tag){case 31:case 13:case 19:var c=a.stateNode;return c===null&&(c=a.stateNode=new I1),c;case 22:return a=a.stateNode,c=a._retryCache,c===null&&(c=a._retryCache=new I1),c;default:throw Error(r(435,a.tag))}}function eh(a,c){var d=BP(a);c.forEach(function(p){if(!d.has(p)){d.add(p);var v=ZP.bind(null,a,p);p.then(v,v)}})}function dr(a,c){var d=c.deletions;if(d!==null)for(var p=0;p<d.length;p++){var v=d[p],w=a,T=c,N=T;e:for(;N!==null;){switch(N.tag){case 27:if(io(N.type)){Ut=N.stateNode,ur=!1;break e}break;case 5:Ut=N.stateNode,ur=!1;break e;case 3:case 4:Ut=N.stateNode.containerInfo,ur=!0;break e}N=N.return}if(Ut===null)throw Error(r(160));P1(w,T,v),Ut=null,ur=!1,w=v.alternate,w!==null&&(w.return=null),v.return=null}if(c.subtreeFlags&13886)for(c=c.child;c!==null;)B1(c,a),c=c.sibling}var ai=null;function B1(a,c){var d=a.alternate,p=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:dr(c,a),fr(a),p&4&&(Xs(3,a,a.return),bu(3,a),Xs(5,a,a.return));break;case 1:dr(c,a),fr(a),p&512&&(fn||d===null||Ti(d,d.return)),p&64&&ts&&(a=a.updateQueue,a!==null&&(p=a.callbacks,p!==null&&(d=a.shared.hiddenCallbacks,a.shared.hiddenCallbacks=d===null?p:d.concat(p))));break;case 26:var v=ai;if(dr(c,a),fr(a),p&512&&(fn||d===null||Ti(d,d.return)),p&4){var w=d!==null?d.memoizedState:null;if(p=a.memoizedState,d===null)if(p===null)if(a.stateNode===null){e:{p=a.type,d=a.memoizedProps,v=v.ownerDocument||v;t:switch(p){case"title":w=v.getElementsByTagName("title")[0],(!w||w[Gc]||w[On]||w.namespaceURI==="http://www.w3.org/2000/svg"||w.hasAttribute("itemprop"))&&(w=v.createElement(p),v.head.insertBefore(w,v.querySelector("head > title"))),Ln(w,p,d),w[On]=a,Sn(w),p=w;break e;case"link":var T=BE("link","href",v).get(p+(d.href||""));if(T){for(var N=0;N<T.length;N++)if(w=T[N],w.getAttribute("href")===(d.href==null||d.href===""?null:d.href)&&w.getAttribute("rel")===(d.rel==null?null:d.rel)&&w.getAttribute("title")===(d.title==null?null:d.title)&&w.getAttribute("crossorigin")===(d.crossOrigin==null?null:d.crossOrigin)){T.splice(N,1);break t}}w=v.createElement(p),Ln(w,p,d),v.head.appendChild(w);break;case"meta":if(T=BE("meta","content",v).get(p+(d.content||""))){for(N=0;N<T.length;N++)if(w=T[N],w.getAttribute("content")===(d.content==null?null:""+d.content)&&w.getAttribute("name")===(d.name==null?null:d.name)&&w.getAttribute("property")===(d.property==null?null:d.property)&&w.getAttribute("http-equiv")===(d.httpEquiv==null?null:d.httpEquiv)&&w.getAttribute("charset")===(d.charSet==null?null:d.charSet)){T.splice(N,1);break t}}w=v.createElement(p),Ln(w,p,d),v.head.appendChild(w);break;default:throw Error(r(468,p))}w[On]=a,Sn(w),p=w}a.stateNode=p}else VE(v,a.type,a.stateNode);else a.stateNode=$E(v,p,a.memoizedProps);else w!==p?(w===null?d.stateNode!==null&&(d=d.stateNode,d.parentNode.removeChild(d)):w.count--,p===null?VE(v,a.type,a.stateNode):$E(v,p,a.memoizedProps)):p===null&&a.stateNode!==null&&fb(a,a.memoizedProps,d.memoizedProps)}break;case 27:dr(c,a),fr(a),p&512&&(fn||d===null||Ti(d,d.return)),d!==null&&p&4&&fb(a,a.memoizedProps,d.memoizedProps);break;case 5:if(dr(c,a),fr(a),p&512&&(fn||d===null||Ti(d,d.return)),a.flags&32){v=a.stateNode;try{pl(v,"")}catch(Oe){Ct(a,a.return,Oe)}}p&4&&a.stateNode!=null&&(v=a.memoizedProps,fb(a,v,d!==null?d.memoizedProps:v)),p&1024&&(mb=!0);break;case 6:if(dr(c,a),fr(a),p&4){if(a.stateNode===null)throw Error(r(162));p=a.memoizedProps,d=a.stateNode;try{d.nodeValue=p}catch(Oe){Ct(a,a.return,Oe)}}break;case 3:if(gh=null,v=ai,ai=ph(c.containerInfo),dr(c,a),ai=v,fr(a),p&4&&d!==null&&d.memoizedState.isDehydrated)try{ql(c.containerInfo)}catch(Oe){Ct(a,a.return,Oe)}mb&&(mb=!1,V1(a));break;case 4:p=ai,ai=ph(a.stateNode.containerInfo),dr(c,a),fr(a),ai=p;break;case 12:dr(c,a),fr(a);break;case 31:dr(c,a),fr(a),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,eh(a,p)));break;case 13:dr(c,a),fr(a),a.child.flags&8192&&a.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(nh=qt()),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,eh(a,p)));break;case 22:v=a.memoizedState!==null;var $=d!==null&&d.memoizedState!==null,J=ts,se=fn;if(ts=J||v,fn=se||$,dr(c,a),fn=se,ts=J,fr(a),p&8192)e:for(c=a.stateNode,c._visibility=v?c._visibility&-2:c._visibility|1,v&&(d===null||$||ts||fn||ba(a)),d=null,c=a;;){if(c.tag===5||c.tag===26){if(d===null){$=d=c;try{if(w=$.stateNode,v)T=w.style,typeof T.setProperty=="function"?T.setProperty("display","none","important"):T.display="none";else{N=$.stateNode;var ce=$.memoizedProps.style,Q=ce!=null&&ce.hasOwnProperty("display")?ce.display:null;N.style.display=Q==null||typeof Q=="boolean"?"":(""+Q).trim()}}catch(Oe){Ct($,$.return,Oe)}}}else if(c.tag===6){if(d===null){$=c;try{$.stateNode.nodeValue=v?"":$.memoizedProps}catch(Oe){Ct($,$.return,Oe)}}}else if(c.tag===18){if(d===null){$=c;try{var ne=$.stateNode;v?ME(ne,!0):ME($.stateNode,!1)}catch(Oe){Ct($,$.return,Oe)}}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===a)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===a)break e;for(;c.sibling===null;){if(c.return===null||c.return===a)break e;d===c&&(d=null),c=c.return}d===c&&(d=null),c.sibling.return=c.return,c=c.sibling}p&4&&(p=a.updateQueue,p!==null&&(d=p.retryQueue,d!==null&&(p.retryQueue=null,eh(a,d))));break;case 19:dr(c,a),fr(a),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,eh(a,p)));break;case 30:break;case 21:break;default:dr(c,a),fr(a)}}function fr(a){var c=a.flags;if(c&2){try{for(var d,p=a.return;p!==null;){if(O1(p)){d=p;break}p=p.return}if(d==null)throw Error(r(160));switch(d.tag){case 27:var v=d.stateNode,w=hb(a);Qf(a,w,v);break;case 5:var T=d.stateNode;d.flags&32&&(pl(T,""),d.flags&=-33);var N=hb(a);Qf(a,N,T);break;case 3:case 4:var $=d.stateNode.containerInfo,J=hb(a);pb(a,J,$);break;default:throw Error(r(161))}}catch(se){Ct(a,a.return,se)}a.flags&=-3}c&4096&&(a.flags&=-4097)}function V1(a){if(a.subtreeFlags&1024)for(a=a.child;a!==null;){var c=a;V1(c),c.tag===5&&c.flags&1024&&c.stateNode.reset(),a=a.sibling}}function rs(a,c){if(c.subtreeFlags&8772)for(c=c.child;c!==null;)j1(a,c.alternate,c),c=c.sibling}function ba(a){for(a=a.child;a!==null;){var c=a;switch(c.tag){case 0:case 11:case 14:case 15:Xs(4,c,c.return),ba(c);break;case 1:Ti(c,c.return);var d=c.stateNode;typeof d.componentWillUnmount=="function"&&M1(c,c.return,d),ba(c);break;case 27:Au(c.stateNode);case 26:case 5:Ti(c,c.return),ba(c);break;case 22:c.memoizedState===null&&ba(c);break;case 30:ba(c);break;default:ba(c)}a=a.sibling}}function is(a,c,d){for(d=d&&(c.subtreeFlags&8772)!==0,c=c.child;c!==null;){var p=c.alternate,v=a,w=c,T=w.flags;switch(w.tag){case 0:case 11:case 15:is(v,w,d),bu(4,w);break;case 1:if(is(v,w,d),p=w,v=p.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(J){Ct(p,p.return,J)}if(p=w,v=p.updateQueue,v!==null){var N=p.stateNode;try{var $=v.shared.hiddenCallbacks;if($!==null)for(v.shared.hiddenCallbacks=null,v=0;v<$.length;v++)bC($[v],N)}catch(J){Ct(p,p.return,J)}}d&&T&64&&R1(w),vu(w,w.return);break;case 27:D1(w);case 26:case 5:is(v,w,d),d&&p===null&&T&4&&N1(w),vu(w,w.return);break;case 12:is(v,w,d);break;case 31:is(v,w,d),d&&T&4&&z1(v,w);break;case 13:is(v,w,d),d&&T&4&&$1(v,w);break;case 22:w.memoizedState===null&&is(v,w,d),vu(w,w.return);break;case 30:break;default:is(v,w,d)}c=c.sibling}}function gb(a,c){var d=null;a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),a=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(a=c.memoizedState.cachePool.pool),a!==d&&(a!=null&&a.refCount++,d!=null&&su(d))}function yb(a,c){a=null,c.alternate!==null&&(a=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==a&&(c.refCount++,a!=null&&su(a))}function li(a,c,d,p){if(c.subtreeFlags&10256)for(c=c.child;c!==null;)H1(a,c,d,p),c=c.sibling}function H1(a,c,d,p){var v=c.flags;switch(c.tag){case 0:case 11:case 15:li(a,c,d,p),v&2048&&bu(9,c);break;case 1:li(a,c,d,p);break;case 3:li(a,c,d,p),v&2048&&(a=null,c.alternate!==null&&(a=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==a&&(c.refCount++,a!=null&&su(a)));break;case 12:if(v&2048){li(a,c,d,p),a=c.stateNode;try{var w=c.memoizedProps,T=w.id,N=w.onPostCommit;typeof N=="function"&&N(T,c.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch($){Ct(c,c.return,$)}}else li(a,c,d,p);break;case 31:li(a,c,d,p);break;case 13:li(a,c,d,p);break;case 23:break;case 22:w=c.stateNode,T=c.alternate,c.memoizedState!==null?w._visibility&2?li(a,c,d,p):xu(a,c):w._visibility&2?li(a,c,d,p):(w._visibility|=2,Il(a,c,d,p,(c.subtreeFlags&10256)!==0||!1)),v&2048&&gb(T,c);break;case 24:li(a,c,d,p),v&2048&&yb(c.alternate,c);break;default:li(a,c,d,p)}}function Il(a,c,d,p,v){for(v=v&&((c.subtreeFlags&10256)!==0||!1),c=c.child;c!==null;){var w=a,T=c,N=d,$=p,J=T.flags;switch(T.tag){case 0:case 11:case 15:Il(w,T,N,$,v),bu(8,T);break;case 23:break;case 22:var se=T.stateNode;T.memoizedState!==null?se._visibility&2?Il(w,T,N,$,v):xu(w,T):(se._visibility|=2,Il(w,T,N,$,v)),v&&J&2048&&gb(T.alternate,T);break;case 24:Il(w,T,N,$,v),v&&J&2048&&yb(T.alternate,T);break;default:Il(w,T,N,$,v)}c=c.sibling}}function xu(a,c){if(c.subtreeFlags&10256)for(c=c.child;c!==null;){var d=a,p=c,v=p.flags;switch(p.tag){case 22:xu(d,p),v&2048&&gb(p.alternate,p);break;case 24:xu(d,p),v&2048&&yb(p.alternate,p);break;default:xu(d,p)}c=c.sibling}}var wu=8192;function jl(a,c,d){if(a.subtreeFlags&wu)for(a=a.child;a!==null;)U1(a,c,d),a=a.sibling}function U1(a,c,d){switch(a.tag){case 26:jl(a,c,d),a.flags&wu&&a.memoizedState!==null&&Tz(d,ai,a.memoizedState,a.memoizedProps);break;case 5:jl(a,c,d);break;case 3:case 4:var p=ai;ai=ph(a.stateNode.containerInfo),jl(a,c,d),ai=p;break;case 22:a.memoizedState===null&&(p=a.alternate,p!==null&&p.memoizedState!==null?(p=wu,wu=16777216,jl(a,c,d),wu=p):jl(a,c,d));break;default:jl(a,c,d)}}function F1(a){var c=a.alternate;if(c!==null&&(a=c.child,a!==null)){c.child=null;do c=a.sibling,a.sibling=null,a=c;while(a!==null)}}function Su(a){var c=a.deletions;if((a.flags&16)!==0){if(c!==null)for(var d=0;d<c.length;d++){var p=c[d];kn=p,G1(p,a)}F1(a)}if(a.subtreeFlags&10256)for(a=a.child;a!==null;)q1(a),a=a.sibling}function q1(a){switch(a.tag){case 0:case 11:case 15:Su(a),a.flags&2048&&Xs(9,a,a.return);break;case 3:Su(a);break;case 12:Su(a);break;case 22:var c=a.stateNode;a.memoizedState!==null&&c._visibility&2&&(a.return===null||a.return.tag!==13)?(c._visibility&=-3,th(a)):Su(a);break;default:Su(a)}}function th(a){var c=a.deletions;if((a.flags&16)!==0){if(c!==null)for(var d=0;d<c.length;d++){var p=c[d];kn=p,G1(p,a)}F1(a)}for(a=a.child;a!==null;){switch(c=a,c.tag){case 0:case 11:case 15:Xs(8,c,c.return),th(c);break;case 22:d=c.stateNode,d._visibility&2&&(d._visibility&=-3,th(c));break;default:th(c)}a=a.sibling}}function G1(a,c){for(;kn!==null;){var d=kn;switch(d.tag){case 0:case 11:case 15:Xs(8,d,c);break;case 23:case 22:if(d.memoizedState!==null&&d.memoizedState.cachePool!==null){var p=d.memoizedState.cachePool.pool;p!=null&&p.refCount++}break;case 24:su(d.memoizedState.cache)}if(p=d.child,p!==null)p.return=d,kn=p;else e:for(d=a;kn!==null;){p=kn;var v=p.sibling,w=p.return;if(L1(p),p===d){kn=null;break e}if(v!==null){v.return=w,kn=v;break e}kn=w}}}var VP={getCacheForType:function(a){var c=In(cn),d=c.data.get(a);return d===void 0&&(d=a(),c.data.set(a,d)),d},cacheSignal:function(){return In(cn).controller.signal}},HP=typeof WeakMap=="function"?WeakMap:Map,xt=0,Dt=null,ot=null,lt=0,kt=0,Er=null,Js=!1,Ll=!1,bb=!1,ss=0,Xt=0,Qs=0,va=0,vb=0,Tr=0,Pl=0,ku=null,hr=null,xb=!1,nh=0,W1=0,rh=1/0,ih=null,eo=null,wn=0,to=null,zl=null,as=0,wb=0,Sb=null,K1=null,Cu=0,kb=null;function _r(){return(xt&2)!==0&&lt!==0?lt&-lt:B.T!==null?Rb():uk()}function Z1(){if(Tr===0)if((lt&536870912)===0||ut){var a=_t;_t<<=1,(_t&3932160)===0&&(_t=262144),Tr=a}else Tr=536870912;return a=kr.current,a!==null&&(a.flags|=32),Tr}function pr(a,c,d){(a===Dt&&(kt===2||kt===9)||a.cancelPendingCommit!==null)&&($l(a,0),no(a,lt,Tr,!1)),ln(a,d),((xt&2)===0||a!==Dt)&&(a===Dt&&((xt&2)===0&&(va|=d),Xt===4&&no(a,lt,Tr,!1)),_i(a))}function Y1(a,c,d){if((xt&6)!==0)throw Error(r(327));var p=!d&&(c&127)===0&&(c&a.expiredLanes)===0||re(a,c),v=p?qP(a,c):Eb(a,c,!0),w=p;do{if(v===0){Ll&&!p&&no(a,c,0,!1);break}else{if(d=a.current.alternate,w&&!UP(d)){v=Eb(a,c,!1),w=!1;continue}if(v===2){if(w=c,a.errorRecoveryDisabledLanes&w)var T=0;else T=a.pendingLanes&-536870913,T=T!==0?T:T&536870912?536870912:0;if(T!==0){c=T;e:{var N=a;v=ku;var $=N.current.memoizedState.isDehydrated;if($&&($l(N,T).flags|=256),T=Eb(N,T,!1),T!==2){if(bb&&!$){N.errorRecoveryDisabledLanes|=w,va|=w,v=4;break e}w=hr,hr=v,w!==null&&(hr===null?hr=w:hr.push.apply(hr,w))}v=T}if(w=!1,v!==2)continue}}if(v===1){$l(a,0),no(a,c,0,!0);break}e:{switch(p=a,w=v,w){case 0:case 1:throw Error(r(345));case 4:if((c&4194048)!==c)break;case 6:no(p,c,Tr,!Js);break e;case 2:hr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((c&62914560)===c&&(v=nh+300-qt(),10<v)){if(no(p,c,Tr,!Js),K(p,0,!0)!==0)break e;as=c,p.timeoutHandle=_E(X1.bind(null,p,d,hr,ih,xb,c,Tr,va,Pl,Js,w,"Throttled",-0,0),v);break e}X1(p,d,hr,ih,xb,c,Tr,va,Pl,Js,w,null,-0,0)}}break}while(!0);_i(a)}function X1(a,c,d,p,v,w,T,N,$,J,se,ce,Q,ne){if(a.timeoutHandle=-1,ce=c.subtreeFlags,ce&8192||(ce&16785408)===16785408){ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:qi},U1(c,w,ce);var Oe=(w&62914560)===w?nh-qt():(w&4194048)===w?W1-qt():0;if(Oe=_z(ce,Oe),Oe!==null){as=w,a.cancelPendingCommit=Oe(sE.bind(null,a,c,w,d,p,v,T,N,$,se,ce,null,Q,ne)),no(a,w,T,!J);return}}sE(a,c,w,d,p,v,T,N,$)}function UP(a){for(var c=a;;){var d=c.tag;if((d===0||d===11||d===15)&&c.flags&16384&&(d=c.updateQueue,d!==null&&(d=d.stores,d!==null)))for(var p=0;p<d.length;p++){var v=d[p],w=v.getSnapshot;v=v.value;try{if(!wr(w(),v))return!1}catch{return!1}}if(d=c.child,c.subtreeFlags&16384&&d!==null)d.return=c,c=d;else{if(c===a)break;for(;c.sibling===null;){if(c.return===null||c.return===a)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function no(a,c,d,p){c&=~vb,c&=~va,a.suspendedLanes|=c,a.pingedLanes&=~c,p&&(a.warmLanes|=c),p=a.expirationTimes;for(var v=c;0<v;){var w=31-ye(v),T=1<<w;p[w]=-1,v&=~T}d!==0&&$r(a,d,c)}function sh(){return(xt&6)===0?(Eu(0),!1):!0}function Cb(){if(ot!==null){if(kt===0)var a=ot.return;else a=ot,Zi=ua=null,By(a),Rl=null,au=0,a=ot;for(;a!==null;)A1(a.alternate,a),a=a.return;ot=null}}function $l(a,c){var d=a.timeoutHandle;d!==-1&&(a.timeoutHandle=-1,cz(d)),d=a.cancelPendingCommit,d!==null&&(a.cancelPendingCommit=null,d()),as=0,Cb(),Dt=a,ot=d=Wi(a.current,null),lt=c,kt=0,Er=null,Js=!1,Ll=re(a,c),bb=!1,Pl=Tr=vb=va=Qs=Xt=0,hr=ku=null,xb=!1,(c&8)!==0&&(c|=c&32);var p=a.entangledLanes;if(p!==0)for(a=a.entanglements,p&=c;0<p;){var v=31-ye(p),w=1<<v;c|=a[v],p&=~w}return ss=c,Tf(),d}function J1(a,c){tt=null,B.H=mu,c===Al||c===If?(c=pC(),kt=3):c===Ay?(c=pC(),kt=4):kt=c===nb?8:c!==null&&typeof c=="object"&&typeof c.then=="function"?6:1,Er=c,ot===null&&(Xt=1,Kf(a,Ur(c,a.current)))}function Q1(){var a=kr.current;return a===null?!0:(lt&4194048)===lt?Wr===null:(lt&62914560)===lt||(lt&536870912)!==0?a===Wr:!1}function eE(){var a=B.H;return B.H=mu,a===null?mu:a}function tE(){var a=B.A;return B.A=VP,a}function oh(){Xt=4,Js||(lt&4194048)!==lt&&kr.current!==null||(Ll=!0),(Qs&134217727)===0&&(va&134217727)===0||Dt===null||no(Dt,lt,Tr,!1)}function Eb(a,c,d){var p=xt;xt|=2;var v=eE(),w=tE();(Dt!==a||lt!==c)&&(ih=null,$l(a,c)),c=!1;var T=Xt;e:do try{if(kt!==0&&ot!==null){var N=ot,$=Er;switch(kt){case 8:Cb(),T=6;break e;case 3:case 2:case 9:case 6:kr.current===null&&(c=!0);var J=kt;if(kt=0,Er=null,Bl(a,N,$,J),d&&Ll){T=0;break e}break;default:J=kt,kt=0,Er=null,Bl(a,N,$,J)}}FP(),T=Xt;break}catch(se){J1(a,se)}while(!0);return c&&a.shellSuspendCounter++,Zi=ua=null,xt=p,B.H=v,B.A=w,ot===null&&(Dt=null,lt=0,Tf()),T}function FP(){for(;ot!==null;)nE(ot)}function qP(a,c){var d=xt;xt|=2;var p=eE(),v=tE();Dt!==a||lt!==c?(ih=null,rh=qt()+500,$l(a,c)):Ll=re(a,c);e:do try{if(kt!==0&&ot!==null){c=ot;var w=Er;t:switch(kt){case 1:kt=0,Er=null,Bl(a,c,w,1);break;case 2:case 9:if(fC(w)){kt=0,Er=null,rE(c);break}c=function(){kt!==2&&kt!==9||Dt!==a||(kt=7),_i(a)},w.then(c,c);break e;case 3:kt=7;break e;case 4:kt=5;break e;case 7:fC(w)?(kt=0,Er=null,rE(c)):(kt=0,Er=null,Bl(a,c,w,7));break;case 5:var T=null;switch(ot.tag){case 26:T=ot.memoizedState;case 5:case 27:var N=ot;if(T?HE(T):N.stateNode.complete){kt=0,Er=null;var $=N.sibling;if($!==null)ot=$;else{var J=N.return;J!==null?(ot=J,ah(J)):ot=null}break t}}kt=0,Er=null,Bl(a,c,w,5);break;case 6:kt=0,Er=null,Bl(a,c,w,6);break;case 8:Cb(),Xt=6;break e;default:throw Error(r(462))}}GP();break}catch(se){J1(a,se)}while(!0);return Zi=ua=null,B.H=p,B.A=v,xt=d,ot!==null?0:(Dt=null,lt=0,Tf(),Xt)}function GP(){for(;ot!==null&&!Pr();)nE(ot)}function nE(a){var c=T1(a.alternate,a,ss);a.memoizedProps=a.pendingProps,c===null?ah(a):ot=c}function rE(a){var c=a,d=c.alternate;switch(c.tag){case 15:case 0:c=x1(d,c,c.pendingProps,c.type,void 0,lt);break;case 11:c=x1(d,c,c.pendingProps,c.type.render,c.ref,lt);break;case 5:By(c);default:A1(d,c),c=ot=tC(c,ss),c=T1(d,c,ss)}a.memoizedProps=a.pendingProps,c===null?ah(a):ot=c}function Bl(a,c,d,p){Zi=ua=null,By(c),Rl=null,au=0;var v=c.return;try{if(IP(a,v,c,d,lt)){Xt=1,Kf(a,Ur(d,a.current)),ot=null;return}}catch(w){if(v!==null)throw ot=v,w;Xt=1,Kf(a,Ur(d,a.current)),ot=null;return}c.flags&32768?(ut||p===1?a=!0:Ll||(lt&536870912)!==0?a=!1:(Js=a=!0,(p===2||p===9||p===3||p===6)&&(p=kr.current,p!==null&&p.tag===13&&(p.flags|=16384))),iE(c,a)):ah(c)}function ah(a){var c=a;do{if((c.flags&32768)!==0){iE(c,Js);return}a=c.return;var d=PP(c.alternate,c,ss);if(d!==null){ot=d;return}if(c=c.sibling,c!==null){ot=c;return}ot=c=a}while(c!==null);Xt===0&&(Xt=5)}function iE(a,c){do{var d=zP(a.alternate,a);if(d!==null){d.flags&=32767,ot=d;return}if(d=a.return,d!==null&&(d.flags|=32768,d.subtreeFlags=0,d.deletions=null),!c&&(a=a.sibling,a!==null)){ot=a;return}ot=a=d}while(a!==null);Xt=6,ot=null}function sE(a,c,d,p,v,w,T,N,$){a.cancelPendingCommit=null;do lh();while(wn!==0);if((xt&6)!==0)throw Error(r(327));if(c!==null){if(c===a.current)throw Error(r(177));if(w=c.lanes|c.childLanes,w|=hy,Ui(a,d,w,T,N,$),a===Dt&&(ot=Dt=null,lt=0),zl=c,to=a,as=d,wb=w,Sb=v,K1=p,(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?(a.callbackNode=null,a.callbackPriority=0,YP(Fn,function(){return uE(),null})):(a.callbackNode=null,a.callbackPriority=0),p=(c.flags&13878)!==0,(c.subtreeFlags&13878)!==0||p){p=B.T,B.T=null,v=L.p,L.p=2,T=xt,xt|=4;try{$P(a,c,d)}finally{xt=T,L.p=v,B.T=p}}wn=1,oE(),aE(),lE()}}function oE(){if(wn===1){wn=0;var a=to,c=zl,d=(c.flags&13878)!==0;if((c.subtreeFlags&13878)!==0||d){d=B.T,B.T=null;var p=L.p;L.p=2;var v=xt;xt|=4;try{B1(c,a);var w=Pb,T=Gk(a.containerInfo),N=w.focusedElem,$=w.selectionRange;if(T!==N&&N&&N.ownerDocument&&qk(N.ownerDocument.documentElement,N)){if($!==null&&ly(N)){var J=$.start,se=$.end;if(se===void 0&&(se=J),"selectionStart"in N)N.selectionStart=J,N.selectionEnd=Math.min(se,N.value.length);else{var ce=N.ownerDocument||document,Q=ce&&ce.defaultView||window;if(Q.getSelection){var ne=Q.getSelection(),Oe=N.textContent.length,qe=Math.min($.start,Oe),Mt=$.end===void 0?qe:Math.min($.end,Oe);!ne.extend&&qe>Mt&&(T=Mt,Mt=qe,qe=T);var W=Fk(N,qe),F=Fk(N,Mt);if(W&&F&&(ne.rangeCount!==1||ne.anchorNode!==W.node||ne.anchorOffset!==W.offset||ne.focusNode!==F.node||ne.focusOffset!==F.offset)){var X=ce.createRange();X.setStart(W.node,W.offset),ne.removeAllRanges(),qe>Mt?(ne.addRange(X),ne.extend(F.node,F.offset)):(X.setEnd(F.node,F.offset),ne.addRange(X))}}}}for(ce=[],ne=N;ne=ne.parentNode;)ne.nodeType===1&&ce.push({element:ne,left:ne.scrollLeft,top:ne.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<ce.length;N++){var le=ce[N];le.element.scrollLeft=le.left,le.element.scrollTop=le.top}}xh=!!Lb,Pb=Lb=null}finally{xt=v,L.p=p,B.T=d}}a.current=c,wn=2}}function aE(){if(wn===2){wn=0;var a=to,c=zl,d=(c.flags&8772)!==0;if((c.subtreeFlags&8772)!==0||d){d=B.T,B.T=null;var p=L.p;L.p=2;var v=xt;xt|=4;try{j1(a,c.alternate,c)}finally{xt=v,L.p=p,B.T=d}}wn=3}}function lE(){if(wn===4||wn===3){wn=0,vr();var a=to,c=zl,d=as,p=K1;(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?wn=5:(wn=0,zl=to=null,cE(a,a.pendingLanes));var v=a.pendingLanes;if(v===0&&(eo=null),Ug(d),c=c.stateNode,ie&&typeof ie.onCommitFiberRoot=="function")try{ie.onCommitFiberRoot(H,c,void 0,(c.current.flags&128)===128)}catch{}if(p!==null){c=B.T,v=L.p,L.p=2,B.T=null;try{for(var w=a.onRecoverableError,T=0;T<p.length;T++){var N=p[T];w(N.value,{componentStack:N.stack})}}finally{B.T=c,L.p=v}}(as&3)!==0&&lh(),_i(a),v=a.pendingLanes,(d&261930)!==0&&(v&42)!==0?a===kb?Cu++:(Cu=0,kb=a):Cu=0,Eu(0)}}function cE(a,c){(a.pooledCacheLanes&=c)===0&&(c=a.pooledCache,c!=null&&(a.pooledCache=null,su(c)))}function lh(){return oE(),aE(),lE(),uE()}function uE(){if(wn!==5)return!1;var a=to,c=wb;wb=0;var d=Ug(as),p=B.T,v=L.p;try{L.p=32>d?32:d,B.T=null,d=Sb,Sb=null;var w=to,T=as;if(wn=0,zl=to=null,as=0,(xt&6)!==0)throw Error(r(331));var N=xt;if(xt|=4,q1(w.current),H1(w,w.current,T,d),xt=N,Eu(0,!1),ie&&typeof ie.onPostCommitFiberRoot=="function")try{ie.onPostCommitFiberRoot(H,w)}catch{}return!0}finally{L.p=v,B.T=p,cE(a,c)}}function dE(a,c,d){c=Ur(d,c),c=tb(a.stateNode,c,2),a=Ks(a,c,2),a!==null&&(ln(a,2),_i(a))}function Ct(a,c,d){if(a.tag===3)dE(a,a,d);else for(;c!==null;){if(c.tag===3){dE(c,a,d);break}else if(c.tag===1){var p=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(eo===null||!eo.has(p))){a=Ur(d,a),d=f1(2),p=Ks(c,d,2),p!==null&&(h1(d,p,c,a),ln(p,2),_i(p));break}}c=c.return}}function Tb(a,c,d){var p=a.pingCache;if(p===null){p=a.pingCache=new HP;var v=new Set;p.set(c,v)}else v=p.get(c),v===void 0&&(v=new Set,p.set(c,v));v.has(d)||(bb=!0,v.add(d),a=WP.bind(null,a,c,d),c.then(a,a))}function WP(a,c,d){var p=a.pingCache;p!==null&&p.delete(c),a.pingedLanes|=a.suspendedLanes&d,a.warmLanes&=~d,Dt===a&&(lt&d)===d&&(Xt===4||Xt===3&&(lt&62914560)===lt&&300>qt()-nh?(xt&2)===0&&$l(a,0):vb|=d,Pl===lt&&(Pl=0)),_i(a)}function fE(a,c){c===0&&(c=Fe()),a=aa(a,c),a!==null&&(ln(a,c),_i(a))}function KP(a){var c=a.memoizedState,d=0;c!==null&&(d=c.retryLane),fE(a,d)}function ZP(a,c){var d=0;switch(a.tag){case 31:case 13:var p=a.stateNode,v=a.memoizedState;v!==null&&(d=v.retryLane);break;case 19:p=a.stateNode;break;case 22:p=a.stateNode._retryCache;break;default:throw Error(r(314))}p!==null&&p.delete(c),fE(a,d)}function YP(a,c){return nn(a,c)}var ch=null,Vl=null,_b=!1,uh=!1,Ab=!1,ro=0;function _i(a){a!==Vl&&a.next===null&&(Vl===null?ch=Vl=a:Vl=Vl.next=a),uh=!0,_b||(_b=!0,JP())}function Eu(a,c){if(!Ab&&uh){Ab=!0;do for(var d=!1,p=ch;p!==null;){if(a!==0){var v=p.pendingLanes;if(v===0)var w=0;else{var T=p.suspendedLanes,N=p.pingedLanes;w=(1<<31-ye(42|a)+1)-1,w&=v&~(T&~N),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(d=!0,gE(p,w))}else w=lt,w=K(p,p===Dt?w:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(w&3)===0||re(p,w)||(d=!0,gE(p,w));p=p.next}while(d);Ab=!1}}function XP(){hE()}function hE(){uh=_b=!1;var a=0;ro!==0&&lz()&&(a=ro);for(var c=qt(),d=null,p=ch;p!==null;){var v=p.next,w=pE(p,c);w===0?(p.next=null,d===null?ch=v:d.next=v,v===null&&(Vl=d)):(d=p,(a!==0||(w&3)!==0)&&(uh=!0)),p=v}wn!==0&&wn!==5||Eu(a),ro!==0&&(ro=0)}function pE(a,c){for(var d=a.suspendedLanes,p=a.pingedLanes,v=a.expirationTimes,w=a.pendingLanes&-62914561;0<w;){var T=31-ye(w),N=1<<T,$=v[T];$===-1?((N&d)===0||(N&p)!==0)&&(v[T]=we(N,c)):$<=c&&(a.expiredLanes|=N),w&=~N}if(c=Dt,d=lt,d=K(a,a===c?d:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),p=a.callbackNode,d===0||a===c&&(kt===2||kt===9)||a.cancelPendingCommit!==null)return p!==null&&p!==null&&br(p),a.callbackNode=null,a.callbackPriority=0;if((d&3)===0||re(a,d)){if(c=d&-d,c===a.callbackPriority)return c;switch(p!==null&&br(p),Ug(d)){case 2:case 8:d=zr;break;case 32:d=Fn;break;case 268435456:d=Ne;break;default:d=Fn}return p=mE.bind(null,a),d=nn(d,p),a.callbackPriority=c,a.callbackNode=d,c}return p!==null&&p!==null&&br(p),a.callbackPriority=2,a.callbackNode=null,2}function mE(a,c){if(wn!==0&&wn!==5)return a.callbackNode=null,a.callbackPriority=0,null;var d=a.callbackNode;if(lh()&&a.callbackNode!==d)return null;var p=lt;return p=K(a,a===Dt?p:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),p===0?null:(Y1(a,p,c),pE(a,qt()),a.callbackNode!=null&&a.callbackNode===d?mE.bind(null,a):null)}function gE(a,c){if(lh())return null;Y1(a,c,!0)}function JP(){uz(function(){(xt&6)!==0?nn(xr,XP):hE()})}function Rb(){if(ro===0){var a=Tl;a===0&&(a=it,it<<=1,(it&261888)===0&&(it=256)),ro=a}return ro}function yE(a){return a==null||typeof a=="symbol"||typeof a=="boolean"?null:typeof a=="function"?a:bf(""+a)}function bE(a,c){var d=c.ownerDocument.createElement("input");return d.name=c.name,d.value=c.value,a.id&&d.setAttribute("form",a.id),c.parentNode.insertBefore(d,c),a=new FormData(a),d.parentNode.removeChild(d),a}function QP(a,c,d,p,v){if(c==="submit"&&d&&d.stateNode===v){var w=yE((v[lr]||null).action),T=p.submitter;T&&(c=(c=T[lr]||null)?yE(c.formAction):T.getAttribute("formAction"),c!==null&&(w=c,T=null));var N=new Sf("action","action",null,p,v);a.push({event:N,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(ro!==0){var $=T?bE(v,T):new FormData(v);Zy(d,{pending:!0,data:$,method:v.method,action:w},null,$)}}else typeof w=="function"&&(N.preventDefault(),$=T?bE(v,T):new FormData(v),Zy(d,{pending:!0,data:$,method:v.method,action:w},w,$))},currentTarget:v}]})}}for(var Mb=0;Mb<fy.length;Mb++){var Nb=fy[Mb],ez=Nb.toLowerCase(),tz=Nb[0].toUpperCase()+Nb.slice(1);oi(ez,"on"+tz)}oi(Zk,"onAnimationEnd"),oi(Yk,"onAnimationIteration"),oi(Xk,"onAnimationStart"),oi("dblclick","onDoubleClick"),oi("focusin","onFocus"),oi("focusout","onBlur"),oi(yP,"onTransitionRun"),oi(bP,"onTransitionStart"),oi(vP,"onTransitionCancel"),oi(Jk,"onTransitionEnd"),fl("onMouseEnter",["mouseout","mouseover"]),fl("onMouseLeave",["mouseout","mouseover"]),fl("onPointerEnter",["pointerout","pointerover"]),fl("onPointerLeave",["pointerout","pointerover"]),ra("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ra("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ra("onBeforeInput",["compositionend","keypress","textInput","paste"]),ra("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ra("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ra("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Tu="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(" "),nz=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Tu));function vE(a,c){c=(c&4)!==0;for(var d=0;d<a.length;d++){var p=a[d],v=p.event;p=p.listeners;e:{var w=void 0;if(c)for(var T=p.length-1;0<=T;T--){var N=p[T],$=N.instance,J=N.currentTarget;if(N=N.listener,$!==w&&v.isPropagationStopped())break e;w=N,v.currentTarget=J;try{w(v)}catch(se){Ef(se)}v.currentTarget=null,w=$}else for(T=0;T<p.length;T++){if(N=p[T],$=N.instance,J=N.currentTarget,N=N.listener,$!==w&&v.isPropagationStopped())break e;w=N,v.currentTarget=J;try{w(v)}catch(se){Ef(se)}v.currentTarget=null,w=$}}}}function at(a,c){var d=c[Fg];d===void 0&&(d=c[Fg]=new Set);var p=a+"__bubble";d.has(p)||(xE(c,a,2,!1),d.add(p))}function Ob(a,c,d){var p=0;c&&(p|=4),xE(d,a,p,c)}var dh="_reactListening"+Math.random().toString(36).slice(2);function Db(a){if(!a[dh]){a[dh]=!0,hk.forEach(function(d){d!=="selectionchange"&&(nz.has(d)||Ob(d,!1,a),Ob(d,!0,a))});var c=a.nodeType===9?a:a.ownerDocument;c===null||c[dh]||(c[dh]=!0,Ob("selectionchange",!1,c))}}function xE(a,c,d,p){switch(ZE(c)){case 2:var v=Mz;break;case 8:v=Nz;break;default:v=Kb}d=v.bind(null,c,d,a),v=void 0,!Qg||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(v=!0),p?v!==void 0?a.addEventListener(c,d,{capture:!0,passive:v}):a.addEventListener(c,d,!0):v!==void 0?a.addEventListener(c,d,{passive:v}):a.addEventListener(c,d,!1)}function Ib(a,c,d,p,v){var w=p;if((c&1)===0&&(c&2)===0&&p!==null)e:for(;;){if(p===null)return;var T=p.tag;if(T===3||T===4){var N=p.stateNode.containerInfo;if(N===v)break;if(T===4)for(T=p.return;T!==null;){var $=T.tag;if(($===3||$===4)&&T.stateNode.containerInfo===v)return;T=T.return}for(;N!==null;){if(T=cl(N),T===null)return;if($=T.tag,$===5||$===6||$===26||$===27){p=w=T;continue e}N=N.parentNode}}p=p.return}Ek(function(){var J=w,se=Xg(d),ce=[];e:{var Q=Qk.get(a);if(Q!==void 0){var ne=Sf,Oe=a;switch(a){case"keypress":if(xf(d)===0)break e;case"keydown":case"keyup":ne=Z2;break;case"focusin":Oe="focus",ne=ry;break;case"focusout":Oe="blur",ne=ry;break;case"beforeblur":case"afterblur":ne=ry;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ne=Ak;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ne=P2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ne=J2;break;case Zk:case Yk:case Xk:ne=B2;break;case Jk:ne=eP;break;case"scroll":case"scrollend":ne=j2;break;case"wheel":ne=nP;break;case"copy":case"cut":case"paste":ne=H2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ne=Mk;break;case"toggle":case"beforetoggle":ne=iP}var qe=(c&4)!==0,Mt=!qe&&(a==="scroll"||a==="scrollend"),W=qe?Q!==null?Q+"Capture":null:Q;qe=[];for(var F=J,X;F!==null;){var le=F;if(X=le.stateNode,le=le.tag,le!==5&&le!==26&&le!==27||X===null||W===null||(le=Kc(F,W),le!=null&&qe.push(_u(F,le,X))),Mt)break;F=F.return}0<qe.length&&(Q=new ne(Q,Oe,null,d,se),ce.push({event:Q,listeners:qe}))}}if((c&7)===0){e:{if(Q=a==="mouseover"||a==="pointerover",ne=a==="mouseout"||a==="pointerout",Q&&d!==Yg&&(Oe=d.relatedTarget||d.fromElement)&&(cl(Oe)||Oe[ll]))break e;if((ne||Q)&&(Q=se.window===se?se:(Q=se.ownerDocument)?Q.defaultView||Q.parentWindow:window,ne?(Oe=d.relatedTarget||d.toElement,ne=J,Oe=Oe?cl(Oe):null,Oe!==null&&(Mt=s(Oe),qe=Oe.tag,Oe!==Mt||qe!==5&&qe!==27&&qe!==6)&&(Oe=null)):(ne=null,Oe=J),ne!==Oe)){if(qe=Ak,le="onMouseLeave",W="onMouseEnter",F="mouse",(a==="pointerout"||a==="pointerover")&&(qe=Mk,le="onPointerLeave",W="onPointerEnter",F="pointer"),Mt=ne==null?Q:Wc(ne),X=Oe==null?Q:Wc(Oe),Q=new qe(le,F+"leave",ne,d,se),Q.target=Mt,Q.relatedTarget=X,le=null,cl(se)===J&&(qe=new qe(W,F+"enter",Oe,d,se),qe.target=X,qe.relatedTarget=Mt,le=qe),Mt=le,ne&&Oe)t:{for(qe=rz,W=ne,F=Oe,X=0,le=W;le;le=qe(le))X++;le=0;for(var Ve=F;Ve;Ve=qe(Ve))le++;for(;0<X-le;)W=qe(W),X--;for(;0<le-X;)F=qe(F),le--;for(;X--;){if(W===F||F!==null&&W===F.alternate){qe=W;break t}W=qe(W),F=qe(F)}qe=null}else qe=null;ne!==null&&wE(ce,Q,ne,qe,!1),Oe!==null&&Mt!==null&&wE(ce,Mt,Oe,qe,!0)}}e:{if(Q=J?Wc(J):window,ne=Q.nodeName&&Q.nodeName.toLowerCase(),ne==="select"||ne==="input"&&Q.type==="file")var mt=zk;else if(Lk(Q))if($k)mt=pP;else{mt=fP;var Pe=dP}else ne=Q.nodeName,!ne||ne.toLowerCase()!=="input"||Q.type!=="checkbox"&&Q.type!=="radio"?J&&Zg(J.elementType)&&(mt=zk):mt=hP;if(mt&&(mt=mt(a,J))){Pk(ce,mt,d,se);break e}Pe&&Pe(a,Q,J),a==="focusout"&&J&&Q.type==="number"&&J.memoizedProps.value!=null&&Kg(Q,"number",Q.value)}switch(Pe=J?Wc(J):window,a){case"focusin":(Lk(Pe)||Pe.contentEditable==="true")&&(bl=Pe,cy=J,nu=null);break;case"focusout":nu=cy=bl=null;break;case"mousedown":uy=!0;break;case"contextmenu":case"mouseup":case"dragend":uy=!1,Wk(ce,d,se);break;case"selectionchange":if(gP)break;case"keydown":case"keyup":Wk(ce,d,se)}var nt;if(sy)e:{switch(a){case"compositionstart":var ct="onCompositionStart";break e;case"compositionend":ct="onCompositionEnd";break e;case"compositionupdate":ct="onCompositionUpdate";break e}ct=void 0}else yl?Ik(a,d)&&(ct="onCompositionEnd"):a==="keydown"&&d.keyCode===229&&(ct="onCompositionStart");ct&&(Nk&&d.locale!=="ko"&&(yl||ct!=="onCompositionStart"?ct==="onCompositionEnd"&&yl&&(nt=Tk()):(Vs=se,ey="value"in Vs?Vs.value:Vs.textContent,yl=!0)),Pe=fh(J,ct),0<Pe.length&&(ct=new Rk(ct,a,null,d,se),ce.push({event:ct,listeners:Pe}),nt?ct.data=nt:(nt=jk(d),nt!==null&&(ct.data=nt)))),(nt=oP?aP(a,d):lP(a,d))&&(ct=fh(J,"onBeforeInput"),0<ct.length&&(Pe=new Rk("onBeforeInput","beforeinput",null,d,se),ce.push({event:Pe,listeners:ct}),Pe.data=nt)),QP(ce,a,J,d,se)}vE(ce,c)})}function _u(a,c,d){return{instance:a,listener:c,currentTarget:d}}function fh(a,c){for(var d=c+"Capture",p=[];a!==null;){var v=a,w=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||w===null||(v=Kc(a,d),v!=null&&p.unshift(_u(a,v,w)),v=Kc(a,c),v!=null&&p.push(_u(a,v,w))),a.tag===3)return p;a=a.return}return[]}function rz(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5&&a.tag!==27);return a||null}function wE(a,c,d,p,v){for(var w=c._reactName,T=[];d!==null&&d!==p;){var N=d,$=N.alternate,J=N.stateNode;if(N=N.tag,$!==null&&$===p)break;N!==5&&N!==26&&N!==27||J===null||($=J,v?(J=Kc(d,w),J!=null&&T.unshift(_u(d,J,$))):v||(J=Kc(d,w),J!=null&&T.push(_u(d,J,$)))),d=d.return}T.length!==0&&a.push({event:c,listeners:T})}var iz=/\r\n?/g,sz=/\u0000|\uFFFD/g;function SE(a){return(typeof a=="string"?a:""+a).replace(iz,`
9
- `).replace(sz,"")}function kE(a,c){return c=SE(c),SE(a)===c}function Rt(a,c,d,p,v,w){switch(d){case"children":typeof p=="string"?c==="body"||c==="textarea"&&p===""||pl(a,p):(typeof p=="number"||typeof p=="bigint")&&c!=="body"&&pl(a,""+p);break;case"className":gf(a,"class",p);break;case"tabIndex":gf(a,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":gf(a,d,p);break;case"style":kk(a,p,w);break;case"data":if(c!=="object"){gf(a,"data",p);break}case"src":case"href":if(p===""&&(c!=="a"||d!=="href")){a.removeAttribute(d);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){a.removeAttribute(d);break}p=bf(""+p),a.setAttribute(d,p);break;case"action":case"formAction":if(typeof p=="function"){a.setAttribute(d,"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 w=="function"&&(d==="formAction"?(c!=="input"&&Rt(a,c,"name",v.name,v,null),Rt(a,c,"formEncType",v.formEncType,v,null),Rt(a,c,"formMethod",v.formMethod,v,null),Rt(a,c,"formTarget",v.formTarget,v,null)):(Rt(a,c,"encType",v.encType,v,null),Rt(a,c,"method",v.method,v,null),Rt(a,c,"target",v.target,v,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){a.removeAttribute(d);break}p=bf(""+p),a.setAttribute(d,p);break;case"onClick":p!=null&&(a.onclick=qi);break;case"onScroll":p!=null&&at("scroll",a);break;case"onScrollEnd":p!=null&&at("scrollend",a);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(d=p.__html,d!=null){if(v.children!=null)throw Error(r(60));a.innerHTML=d}}break;case"multiple":a.multiple=p&&typeof p!="function"&&typeof p!="symbol";break;case"muted":a.muted=p&&typeof p!="function"&&typeof p!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(p==null||typeof p=="function"||typeof p=="boolean"||typeof p=="symbol"){a.removeAttribute("xlink:href");break}d=bf(""+p),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":p!=null&&typeof p!="function"&&typeof p!="symbol"?a.setAttribute(d,""+p):a.removeAttribute(d);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":p&&typeof p!="function"&&typeof p!="symbol"?a.setAttribute(d,""):a.removeAttribute(d);break;case"capture":case"download":p===!0?a.setAttribute(d,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?a.setAttribute(d,p):a.removeAttribute(d);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?a.setAttribute(d,p):a.removeAttribute(d);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?a.removeAttribute(d):a.setAttribute(d,p);break;case"popover":at("beforetoggle",a),at("toggle",a),mf(a,"popover",p);break;case"xlinkActuate":Fi(a,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":Fi(a,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":Fi(a,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":Fi(a,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":Fi(a,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":Fi(a,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":Fi(a,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":Fi(a,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":Fi(a,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":mf(a,"is",p);break;case"innerText":case"textContent":break;default:(!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")&&(d=D2.get(d)||d,mf(a,d,p))}}function jb(a,c,d,p,v,w){switch(d){case"style":kk(a,p,w);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(d=p.__html,d!=null){if(v.children!=null)throw Error(r(60));a.innerHTML=d}}break;case"children":typeof p=="string"?pl(a,p):(typeof p=="number"||typeof p=="bigint")&&pl(a,""+p);break;case"onScroll":p!=null&&at("scroll",a);break;case"onScrollEnd":p!=null&&at("scrollend",a);break;case"onClick":p!=null&&(a.onclick=qi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!pk.hasOwnProperty(d))e:{if(d[0]==="o"&&d[1]==="n"&&(v=d.endsWith("Capture"),c=d.slice(2,v?d.length-7:void 0),w=a[lr]||null,w=w!=null?w[d]:null,typeof w=="function"&&a.removeEventListener(c,w,v),typeof p=="function")){typeof w!="function"&&w!==null&&(d in a?a[d]=null:a.hasAttribute(d)&&a.removeAttribute(d)),a.addEventListener(c,p,v);break e}d in a?a[d]=p:p===!0?a.setAttribute(d,""):mf(a,d,p)}}}function Ln(a,c,d){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":at("error",a),at("load",a);var p=!1,v=!1,w;for(w in d)if(d.hasOwnProperty(w)){var T=d[w];if(T!=null)switch(w){case"src":p=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,c));default:Rt(a,c,w,T,d,null)}}v&&Rt(a,c,"srcSet",d.srcSet,d,null),p&&Rt(a,c,"src",d.src,d,null);return;case"input":at("invalid",a);var N=w=T=v=null,$=null,J=null;for(p in d)if(d.hasOwnProperty(p)){var se=d[p];if(se!=null)switch(p){case"name":v=se;break;case"type":T=se;break;case"checked":$=se;break;case"defaultChecked":J=se;break;case"value":w=se;break;case"defaultValue":N=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,c));break;default:Rt(a,c,p,se,d,null)}}vk(a,w,N,$,J,T,v,!1);return;case"select":at("invalid",a),p=T=w=null;for(v in d)if(d.hasOwnProperty(v)&&(N=d[v],N!=null))switch(v){case"value":w=N;break;case"defaultValue":T=N;break;case"multiple":p=N;default:Rt(a,c,v,N,d,null)}c=w,d=T,a.multiple=!!p,c!=null?hl(a,!!p,c,!1):d!=null&&hl(a,!!p,d,!0);return;case"textarea":at("invalid",a),w=v=p=null;for(T in d)if(d.hasOwnProperty(T)&&(N=d[T],N!=null))switch(T){case"value":p=N;break;case"defaultValue":v=N;break;case"children":w=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(r(91));break;default:Rt(a,c,T,N,d,null)}wk(a,p,v,w);return;case"option":for($ in d)d.hasOwnProperty($)&&(p=d[$],p!=null)&&($==="selected"?a.selected=p&&typeof p!="function"&&typeof p!="symbol":Rt(a,c,$,p,d,null));return;case"dialog":at("beforetoggle",a),at("toggle",a),at("cancel",a),at("close",a);break;case"iframe":case"object":at("load",a);break;case"video":case"audio":for(p=0;p<Tu.length;p++)at(Tu[p],a);break;case"image":at("error",a),at("load",a);break;case"details":at("toggle",a);break;case"embed":case"source":case"link":at("error",a),at("load",a);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(J in d)if(d.hasOwnProperty(J)&&(p=d[J],p!=null))switch(J){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,c));default:Rt(a,c,J,p,d,null)}return;default:if(Zg(c)){for(se in d)d.hasOwnProperty(se)&&(p=d[se],p!==void 0&&jb(a,c,se,p,d,void 0));return}}for(N in d)d.hasOwnProperty(N)&&(p=d[N],p!=null&&Rt(a,c,N,p,d,null))}function oz(a,c,d,p){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,w=null,T=null,N=null,$=null,J=null,se=null;for(ne in d){var ce=d[ne];if(d.hasOwnProperty(ne)&&ce!=null)switch(ne){case"checked":break;case"value":break;case"defaultValue":$=ce;default:p.hasOwnProperty(ne)||Rt(a,c,ne,null,p,ce)}}for(var Q in p){var ne=p[Q];if(ce=d[Q],p.hasOwnProperty(Q)&&(ne!=null||ce!=null))switch(Q){case"type":w=ne;break;case"name":v=ne;break;case"checked":J=ne;break;case"defaultChecked":se=ne;break;case"value":T=ne;break;case"defaultValue":N=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(r(137,c));break;default:ne!==ce&&Rt(a,c,Q,ne,p,ce)}}Wg(a,T,N,$,J,se,w,v);return;case"select":ne=T=N=Q=null;for(w in d)if($=d[w],d.hasOwnProperty(w)&&$!=null)switch(w){case"value":break;case"multiple":ne=$;default:p.hasOwnProperty(w)||Rt(a,c,w,null,p,$)}for(v in p)if(w=p[v],$=d[v],p.hasOwnProperty(v)&&(w!=null||$!=null))switch(v){case"value":Q=w;break;case"defaultValue":N=w;break;case"multiple":T=w;default:w!==$&&Rt(a,c,v,w,p,$)}c=N,d=T,p=ne,Q!=null?hl(a,!!d,Q,!1):!!p!=!!d&&(c!=null?hl(a,!!d,c,!0):hl(a,!!d,d?[]:"",!1));return;case"textarea":ne=Q=null;for(N in d)if(v=d[N],d.hasOwnProperty(N)&&v!=null&&!p.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:Rt(a,c,N,null,p,v)}for(T in p)if(v=p[T],w=d[T],p.hasOwnProperty(T)&&(v!=null||w!=null))switch(T){case"value":Q=v;break;case"defaultValue":ne=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(r(91));break;default:v!==w&&Rt(a,c,T,v,p,w)}xk(a,Q,ne);return;case"option":for(var Oe in d)Q=d[Oe],d.hasOwnProperty(Oe)&&Q!=null&&!p.hasOwnProperty(Oe)&&(Oe==="selected"?a.selected=!1:Rt(a,c,Oe,null,p,Q));for($ in p)Q=p[$],ne=d[$],p.hasOwnProperty($)&&Q!==ne&&(Q!=null||ne!=null)&&($==="selected"?a.selected=Q&&typeof Q!="function"&&typeof Q!="symbol":Rt(a,c,$,Q,p,ne));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 qe in d)Q=d[qe],d.hasOwnProperty(qe)&&Q!=null&&!p.hasOwnProperty(qe)&&Rt(a,c,qe,null,p,Q);for(J in p)if(Q=p[J],ne=d[J],p.hasOwnProperty(J)&&Q!==ne&&(Q!=null||ne!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(r(137,c));break;default:Rt(a,c,J,Q,p,ne)}return;default:if(Zg(c)){for(var Mt in d)Q=d[Mt],d.hasOwnProperty(Mt)&&Q!==void 0&&!p.hasOwnProperty(Mt)&&jb(a,c,Mt,void 0,p,Q);for(se in p)Q=p[se],ne=d[se],!p.hasOwnProperty(se)||Q===ne||Q===void 0&&ne===void 0||jb(a,c,se,Q,p,ne);return}}for(var W in d)Q=d[W],d.hasOwnProperty(W)&&Q!=null&&!p.hasOwnProperty(W)&&Rt(a,c,W,null,p,Q);for(ce in p)Q=p[ce],ne=d[ce],!p.hasOwnProperty(ce)||Q===ne||Q==null&&ne==null||Rt(a,c,ce,Q,p,ne)}function CE(a){switch(a){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function az(){if(typeof performance.getEntriesByType=="function"){for(var a=0,c=0,d=performance.getEntriesByType("resource"),p=0;p<d.length;p++){var v=d[p],w=v.transferSize,T=v.initiatorType,N=v.duration;if(w&&N&&CE(T)){for(T=0,N=v.responseEnd,p+=1;p<d.length;p++){var $=d[p],J=$.startTime;if(J>N)break;var se=$.transferSize,ce=$.initiatorType;se&&CE(ce)&&($=$.responseEnd,T+=se*($<N?1:(N-J)/($-J)))}if(--p,c+=8*(w+T)/(v.duration/1e3),a++,10<a)break}}if(0<a)return c/a/1e6}return navigator.connection&&(a=navigator.connection.downlink,typeof a=="number")?a:5}var Lb=null,Pb=null;function hh(a){return a.nodeType===9?a:a.ownerDocument}function EE(a){switch(a){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function TE(a,c){if(a===0)switch(c){case"svg":return 1;case"math":return 2;default:return 0}return a===1&&c==="foreignObject"?0:a}function zb(a,c){return a==="textarea"||a==="noscript"||typeof c.children=="string"||typeof c.children=="number"||typeof c.children=="bigint"||typeof c.dangerouslySetInnerHTML=="object"&&c.dangerouslySetInnerHTML!==null&&c.dangerouslySetInnerHTML.__html!=null}var $b=null;function lz(){var a=window.event;return a&&a.type==="popstate"?a===$b?!1:($b=a,!0):($b=null,!1)}var _E=typeof setTimeout=="function"?setTimeout:void 0,cz=typeof clearTimeout=="function"?clearTimeout:void 0,AE=typeof Promise=="function"?Promise:void 0,uz=typeof queueMicrotask=="function"?queueMicrotask:typeof AE<"u"?function(a){return AE.resolve(null).then(a).catch(dz)}:_E;function dz(a){setTimeout(function(){throw a})}function io(a){return a==="head"}function RE(a,c){var d=c,p=0;do{var v=d.nextSibling;if(a.removeChild(d),v&&v.nodeType===8)if(d=v.data,d==="/$"||d==="/&"){if(p===0){a.removeChild(v),ql(c);return}p--}else if(d==="$"||d==="$?"||d==="$~"||d==="$!"||d==="&")p++;else if(d==="html")Au(a.ownerDocument.documentElement);else if(d==="head"){d=a.ownerDocument.head,Au(d);for(var w=d.firstChild;w;){var T=w.nextSibling,N=w.nodeName;w[Gc]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&w.rel.toLowerCase()==="stylesheet"||d.removeChild(w),w=T}}else d==="body"&&Au(a.ownerDocument.body);d=v}while(d);ql(c)}function ME(a,c){var d=a;a=0;do{var p=d.nextSibling;if(d.nodeType===1?c?(d._stashedDisplay=d.style.display,d.style.display="none"):(d.style.display=d._stashedDisplay||"",d.getAttribute("style")===""&&d.removeAttribute("style")):d.nodeType===3&&(c?(d._stashedText=d.nodeValue,d.nodeValue=""):d.nodeValue=d._stashedText||""),p&&p.nodeType===8)if(d=p.data,d==="/$"){if(a===0)break;a--}else d!=="$"&&d!=="$?"&&d!=="$~"&&d!=="$!"||a++;d=p}while(d)}function Bb(a){var c=a.firstChild;for(c&&c.nodeType===10&&(c=c.nextSibling);c;){var d=c;switch(c=c.nextSibling,d.nodeName){case"HTML":case"HEAD":case"BODY":Bb(d),qg(d);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(d.rel.toLowerCase()==="stylesheet")continue}a.removeChild(d)}}function fz(a,c,d,p){for(;a.nodeType===1;){var v=d;if(a.nodeName.toLowerCase()!==c.toLowerCase()){if(!p&&(a.nodeName!=="INPUT"||a.type!=="hidden"))break}else if(p){if(!a[Gc])switch(c){case"meta":if(!a.hasAttribute("itemprop"))break;return a;case"link":if(w=a.getAttribute("rel"),w==="stylesheet"&&a.hasAttribute("data-precedence"))break;if(w!==v.rel||a.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||a.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||a.getAttribute("title")!==(v.title==null?null:v.title))break;return a;case"style":if(a.hasAttribute("data-precedence"))break;return a;case"script":if(w=a.getAttribute("src"),(w!==(v.src==null?null:v.src)||a.getAttribute("type")!==(v.type==null?null:v.type)||a.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&w&&a.hasAttribute("async")&&!a.hasAttribute("itemprop"))break;return a;default:return a}}else if(c==="input"&&a.type==="hidden"){var w=v.name==null?null:""+v.name;if(v.type==="hidden"&&a.getAttribute("name")===w)return a}else return a;if(a=Kr(a.nextSibling),a===null)break}return null}function hz(a,c,d){if(c==="")return null;for(;a.nodeType!==3;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!d||(a=Kr(a.nextSibling),a===null))return null;return a}function NE(a,c){for(;a.nodeType!==8;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!c||(a=Kr(a.nextSibling),a===null))return null;return a}function Vb(a){return a.data==="$?"||a.data==="$~"}function Hb(a){return a.data==="$!"||a.data==="$?"&&a.ownerDocument.readyState!=="loading"}function pz(a,c){var d=a.ownerDocument;if(a.data==="$~")a._reactRetry=c;else if(a.data!=="$?"||d.readyState!=="loading")c();else{var p=function(){c(),d.removeEventListener("DOMContentLoaded",p)};d.addEventListener("DOMContentLoaded",p),a._reactRetry=p}}function Kr(a){for(;a!=null;a=a.nextSibling){var c=a.nodeType;if(c===1||c===3)break;if(c===8){if(c=a.data,c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"||c==="F!"||c==="F")break;if(c==="/$"||c==="/&")return null}}return a}var Ub=null;function OE(a){a=a.nextSibling;for(var c=0;a;){if(a.nodeType===8){var d=a.data;if(d==="/$"||d==="/&"){if(c===0)return Kr(a.nextSibling);c--}else d!=="$"&&d!=="$!"&&d!=="$?"&&d!=="$~"&&d!=="&"||c++}a=a.nextSibling}return null}function DE(a){a=a.previousSibling;for(var c=0;a;){if(a.nodeType===8){var d=a.data;if(d==="$"||d==="$!"||d==="$?"||d==="$~"||d==="&"){if(c===0)return a;c--}else d!=="/$"&&d!=="/&"||c++}a=a.previousSibling}return null}function IE(a,c,d){switch(c=hh(d),a){case"html":if(a=c.documentElement,!a)throw Error(r(452));return a;case"head":if(a=c.head,!a)throw Error(r(453));return a;case"body":if(a=c.body,!a)throw Error(r(454));return a;default:throw Error(r(451))}}function Au(a){for(var c=a.attributes;c.length;)a.removeAttributeNode(c[0]);qg(a)}var Zr=new Map,jE=new Set;function ph(a){return typeof a.getRootNode=="function"?a.getRootNode():a.nodeType===9?a:a.ownerDocument}var ls=L.d;L.d={f:mz,r:gz,D:yz,C:bz,L:vz,m:xz,X:Sz,S:wz,M:kz};function mz(){var a=ls.f(),c=sh();return a||c}function gz(a){var c=ul(a);c!==null&&c.tag===5&&c.type==="form"?JC(c):ls.r(a)}var Hl=typeof document>"u"?null:document;function LE(a,c,d){var p=Hl;if(p&&typeof c=="string"&&c){var v=Vr(c);v='link[rel="'+a+'"][href="'+v+'"]',typeof d=="string"&&(v+='[crossorigin="'+d+'"]'),jE.has(v)||(jE.add(v),a={rel:a,crossOrigin:d,href:c},p.querySelector(v)===null&&(c=p.createElement("link"),Ln(c,"link",a),Sn(c),p.head.appendChild(c)))}}function yz(a){ls.D(a),LE("dns-prefetch",a,null)}function bz(a,c){ls.C(a,c),LE("preconnect",a,c)}function vz(a,c,d){ls.L(a,c,d);var p=Hl;if(p&&a&&c){var v='link[rel="preload"][as="'+Vr(c)+'"]';c==="image"&&d&&d.imageSrcSet?(v+='[imagesrcset="'+Vr(d.imageSrcSet)+'"]',typeof d.imageSizes=="string"&&(v+='[imagesizes="'+Vr(d.imageSizes)+'"]')):v+='[href="'+Vr(a)+'"]';var w=v;switch(c){case"style":w=Ul(a);break;case"script":w=Fl(a)}Zr.has(w)||(a=m({rel:"preload",href:c==="image"&&d&&d.imageSrcSet?void 0:a,as:c},d),Zr.set(w,a),p.querySelector(v)!==null||c==="style"&&p.querySelector(Ru(w))||c==="script"&&p.querySelector(Mu(w))||(c=p.createElement("link"),Ln(c,"link",a),Sn(c),p.head.appendChild(c)))}}function xz(a,c){ls.m(a,c);var d=Hl;if(d&&a){var p=c&&typeof c.as=="string"?c.as:"script",v='link[rel="modulepreload"][as="'+Vr(p)+'"][href="'+Vr(a)+'"]',w=v;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=Fl(a)}if(!Zr.has(w)&&(a=m({rel:"modulepreload",href:a},c),Zr.set(w,a),d.querySelector(v)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(d.querySelector(Mu(w)))return}p=d.createElement("link"),Ln(p,"link",a),Sn(p),d.head.appendChild(p)}}}function wz(a,c,d){ls.S(a,c,d);var p=Hl;if(p&&a){var v=dl(p).hoistableStyles,w=Ul(a);c=c||"default";var T=v.get(w);if(!T){var N={loading:0,preload:null};if(T=p.querySelector(Ru(w)))N.loading=5;else{a=m({rel:"stylesheet",href:a,"data-precedence":c},d),(d=Zr.get(w))&&Fb(a,d);var $=T=p.createElement("link");Sn($),Ln($,"link",a),$._p=new Promise(function(J,se){$.onload=J,$.onerror=se}),$.addEventListener("load",function(){N.loading|=1}),$.addEventListener("error",function(){N.loading|=2}),N.loading|=4,mh(T,c,p)}T={type:"stylesheet",instance:T,count:1,state:N},v.set(w,T)}}}function Sz(a,c){ls.X(a,c);var d=Hl;if(d&&a){var p=dl(d).hoistableScripts,v=Fl(a),w=p.get(v);w||(w=d.querySelector(Mu(v)),w||(a=m({src:a,async:!0},c),(c=Zr.get(v))&&qb(a,c),w=d.createElement("script"),Sn(w),Ln(w,"link",a),d.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},p.set(v,w))}}function kz(a,c){ls.M(a,c);var d=Hl;if(d&&a){var p=dl(d).hoistableScripts,v=Fl(a),w=p.get(v);w||(w=d.querySelector(Mu(v)),w||(a=m({src:a,async:!0,type:"module"},c),(c=Zr.get(v))&&qb(a,c),w=d.createElement("script"),Sn(w),Ln(w,"link",a),d.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},p.set(v,w))}}function PE(a,c,d,p){var v=(v=Re.current)?ph(v):null;if(!v)throw Error(r(446));switch(a){case"meta":case"title":return null;case"style":return typeof d.precedence=="string"&&typeof d.href=="string"?(c=Ul(d.href),d=dl(v).hoistableStyles,p=d.get(c),p||(p={type:"style",instance:null,count:0,state:null},d.set(c,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(d.rel==="stylesheet"&&typeof d.href=="string"&&typeof d.precedence=="string"){a=Ul(d.href);var w=dl(v).hoistableStyles,T=w.get(a);if(T||(v=v.ownerDocument||v,T={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(a,T),(w=v.querySelector(Ru(a)))&&!w._p&&(T.instance=w,T.state.loading=5),Zr.has(a)||(d={rel:"preload",as:"style",href:d.href,crossOrigin:d.crossOrigin,integrity:d.integrity,media:d.media,hrefLang:d.hrefLang,referrerPolicy:d.referrerPolicy},Zr.set(a,d),w||Cz(v,a,d,T.state))),c&&p===null)throw Error(r(528,""));return T}if(c&&p!==null)throw Error(r(529,""));return null;case"script":return c=d.async,d=d.src,typeof d=="string"&&c&&typeof c!="function"&&typeof c!="symbol"?(c=Fl(d),d=dl(v).hoistableScripts,p=d.get(c),p||(p={type:"script",instance:null,count:0,state:null},d.set(c,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,a))}}function Ul(a){return'href="'+Vr(a)+'"'}function Ru(a){return'link[rel="stylesheet"]['+a+"]"}function zE(a){return m({},a,{"data-precedence":a.precedence,precedence:null})}function Cz(a,c,d,p){a.querySelector('link[rel="preload"][as="style"]['+c+"]")?p.loading=1:(c=a.createElement("link"),p.preload=c,c.addEventListener("load",function(){return p.loading|=1}),c.addEventListener("error",function(){return p.loading|=2}),Ln(c,"link",d),Sn(c),a.head.appendChild(c))}function Fl(a){return'[src="'+Vr(a)+'"]'}function Mu(a){return"script[async]"+a}function $E(a,c,d){if(c.count++,c.instance===null)switch(c.type){case"style":var p=a.querySelector('style[data-href~="'+Vr(d.href)+'"]');if(p)return c.instance=p,Sn(p),p;var v=m({},d,{"data-href":d.href,"data-precedence":d.precedence,href:null,precedence:null});return p=(a.ownerDocument||a).createElement("style"),Sn(p),Ln(p,"style",v),mh(p,d.precedence,a),c.instance=p;case"stylesheet":v=Ul(d.href);var w=a.querySelector(Ru(v));if(w)return c.state.loading|=4,c.instance=w,Sn(w),w;p=zE(d),(v=Zr.get(v))&&Fb(p,v),w=(a.ownerDocument||a).createElement("link"),Sn(w);var T=w;return T._p=new Promise(function(N,$){T.onload=N,T.onerror=$}),Ln(w,"link",p),c.state.loading|=4,mh(w,d.precedence,a),c.instance=w;case"script":return w=Fl(d.src),(v=a.querySelector(Mu(w)))?(c.instance=v,Sn(v),v):(p=d,(v=Zr.get(w))&&(p=m({},d),qb(p,v)),a=a.ownerDocument||a,v=a.createElement("script"),Sn(v),Ln(v,"link",p),a.head.appendChild(v),c.instance=v);case"void":return null;default:throw Error(r(443,c.type))}else c.type==="stylesheet"&&(c.state.loading&4)===0&&(p=c.instance,c.state.loading|=4,mh(p,d.precedence,a));return c.instance}function mh(a,c,d){for(var p=d.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=p.length?p[p.length-1]:null,w=v,T=0;T<p.length;T++){var N=p[T];if(N.dataset.precedence===c)w=N;else if(w!==v)break}w?w.parentNode.insertBefore(a,w.nextSibling):(c=d.nodeType===9?d.head:d,c.insertBefore(a,c.firstChild))}function Fb(a,c){a.crossOrigin==null&&(a.crossOrigin=c.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=c.referrerPolicy),a.title==null&&(a.title=c.title)}function qb(a,c){a.crossOrigin==null&&(a.crossOrigin=c.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=c.referrerPolicy),a.integrity==null&&(a.integrity=c.integrity)}var gh=null;function BE(a,c,d){if(gh===null){var p=new Map,v=gh=new Map;v.set(d,p)}else v=gh,p=v.get(d),p||(p=new Map,v.set(d,p));if(p.has(a))return p;for(p.set(a,null),d=d.getElementsByTagName(a),v=0;v<d.length;v++){var w=d[v];if(!(w[Gc]||w[On]||a==="link"&&w.getAttribute("rel")==="stylesheet")&&w.namespaceURI!=="http://www.w3.org/2000/svg"){var T=w.getAttribute(c)||"";T=a+T;var N=p.get(T);N?N.push(w):p.set(T,[w])}}return p}function VE(a,c,d){a=a.ownerDocument||a,a.head.insertBefore(d,c==="title"?a.querySelector("head > title"):null)}function Ez(a,c,d){if(d===1||c.itemProp!=null)return!1;switch(a){case"meta":case"title":return!0;case"style":if(typeof c.precedence!="string"||typeof c.href!="string"||c.href==="")break;return!0;case"link":if(typeof c.rel!="string"||typeof c.href!="string"||c.href===""||c.onLoad||c.onError)break;return c.rel==="stylesheet"?(a=c.disabled,typeof c.precedence=="string"&&a==null):!0;case"script":if(c.async&&typeof c.async!="function"&&typeof c.async!="symbol"&&!c.onLoad&&!c.onError&&c.src&&typeof c.src=="string")return!0}return!1}function HE(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function Tz(a,c,d,p){if(d.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(d.state.loading&4)===0){if(d.instance===null){var v=Ul(p.href),w=c.querySelector(Ru(v));if(w){c=w._p,c!==null&&typeof c=="object"&&typeof c.then=="function"&&(a.count++,a=yh.bind(a),c.then(a,a)),d.state.loading|=4,d.instance=w,Sn(w);return}w=c.ownerDocument||c,p=zE(p),(v=Zr.get(v))&&Fb(p,v),w=w.createElement("link"),Sn(w);var T=w;T._p=new Promise(function(N,$){T.onload=N,T.onerror=$}),Ln(w,"link",p),d.instance=w}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(d,c),(c=d.state.preload)&&(d.state.loading&3)===0&&(a.count++,d=yh.bind(a),c.addEventListener("load",d),c.addEventListener("error",d))}}var Gb=0;function _z(a,c){return a.stylesheets&&a.count===0&&vh(a,a.stylesheets),0<a.count||0<a.imgCount?function(d){var p=setTimeout(function(){if(a.stylesheets&&vh(a,a.stylesheets),a.unsuspend){var w=a.unsuspend;a.unsuspend=null,w()}},6e4+c);0<a.imgBytes&&Gb===0&&(Gb=62500*az());var v=setTimeout(function(){if(a.waitingForImages=!1,a.count===0&&(a.stylesheets&&vh(a,a.stylesheets),a.unsuspend)){var w=a.unsuspend;a.unsuspend=null,w()}},(a.imgBytes>Gb?50:800)+c);return a.unsuspend=d,function(){a.unsuspend=null,clearTimeout(p),clearTimeout(v)}}:null}function yh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)vh(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var bh=null;function vh(a,c){a.stylesheets=null,a.unsuspend!==null&&(a.count++,bh=new Map,c.forEach(Az,a),bh=null,yh.call(a))}function Az(a,c){if(!(c.state.loading&4)){var d=bh.get(a);if(d)var p=d.get(null);else{d=new Map,bh.set(a,d);for(var v=a.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w<v.length;w++){var T=v[w];(T.nodeName==="LINK"||T.getAttribute("media")!=="not all")&&(d.set(T.dataset.precedence,T),p=T)}p&&d.set(null,p)}v=c.instance,T=v.getAttribute("data-precedence"),w=d.get(T)||p,w===p&&d.set(null,v),d.set(T,v),this.count++,p=yh.bind(this),v.addEventListener("load",p),v.addEventListener("error",p),w?w.parentNode.insertBefore(v,w.nextSibling):(a=a.nodeType===9?a.head:a,a.insertBefore(v,a.firstChild)),c.state.loading|=4}}var Nu={$$typeof:M,Provider:null,Consumer:null,_currentValue:U,_currentValue2:U,_threadCount:0};function Rz(a,c,d,p,v,w,T,N,$){this.tag=1,this.containerInfo=a,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=pt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pt(0),this.hiddenUpdates=pt(null),this.identifierPrefix=p,this.onUncaughtError=v,this.onCaughtError=w,this.onRecoverableError=T,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=$,this.incompleteTransitions=new Map}function UE(a,c,d,p,v,w,T,N,$,J,se,ce){return a=new Rz(a,c,d,T,$,J,se,ce,N),c=1,w===!0&&(c|=24),w=Sr(3,null,null,c),a.current=w,w.stateNode=a,c=Ey(),c.refCount++,a.pooledCache=c,c.refCount++,w.memoizedState={element:p,isDehydrated:d,cache:c},Ry(w),a}function FE(a){return a?(a=wl,a):wl}function qE(a,c,d,p,v,w){v=FE(v),p.context===null?p.context=v:p.pendingContext=v,p=Ws(c),p.payload={element:d},w=w===void 0?null:w,w!==null&&(p.callback=w),d=Ks(a,p,c),d!==null&&(pr(d,a,c),cu(d,a,c))}function GE(a,c){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var d=a.retryLane;a.retryLane=d!==0&&d<c?d:c}}function Wb(a,c){GE(a,c),(a=a.alternate)&&GE(a,c)}function WE(a){if(a.tag===13||a.tag===31){var c=aa(a,67108864);c!==null&&pr(c,a,67108864),Wb(a,67108864)}}function KE(a){if(a.tag===13||a.tag===31){var c=_r();c=na(c);var d=aa(a,c);d!==null&&pr(d,a,c),Wb(a,c)}}var xh=!0;function Mz(a,c,d,p){var v=B.T;B.T=null;var w=L.p;try{L.p=2,Kb(a,c,d,p)}finally{L.p=w,B.T=v}}function Nz(a,c,d,p){var v=B.T;B.T=null;var w=L.p;try{L.p=8,Kb(a,c,d,p)}finally{L.p=w,B.T=v}}function Kb(a,c,d,p){if(xh){var v=Zb(p);if(v===null)Ib(a,c,p,wh,d),YE(a,p);else if(Dz(v,a,c,d,p))p.stopPropagation();else if(YE(a,p),c&4&&-1<Oz.indexOf(a)){for(;v!==null;){var w=ul(v);if(w!==null)switch(w.tag){case 3:if(w=w.stateNode,w.current.memoizedState.isDehydrated){var T=me(w.pendingLanes);if(T!==0){var N=w;for(N.pendingLanes|=2,N.entangledLanes|=2;T;){var $=1<<31-ye(T);N.entanglements[1]|=$,T&=~$}_i(w),(xt&6)===0&&(rh=qt()+500,Eu(0))}}break;case 31:case 13:N=aa(w,2),N!==null&&pr(N,w,2),sh(),Wb(w,2)}if(w=Zb(p),w===null&&Ib(a,c,p,wh,d),w===v)break;v=w}v!==null&&p.stopPropagation()}else Ib(a,c,p,null,d)}}function Zb(a){return a=Xg(a),Yb(a)}var wh=null;function Yb(a){if(wh=null,a=cl(a),a!==null){var c=s(a);if(c===null)a=null;else{var d=c.tag;if(d===13){if(a=o(c),a!==null)return a;a=null}else if(d===31){if(a=l(c),a!==null)return a;a=null}else if(d===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;a=null}else c!==a&&(a=null)}}return wh=a,null}function ZE(a){switch(a){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(si()){case xr:return 2;case zr:return 8;case Fn:case ge:return 32;case Ne:return 268435456;default:return 32}default:return 32}}var Xb=!1,so=null,oo=null,ao=null,Ou=new Map,Du=new Map,lo=[],Oz="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 YE(a,c){switch(a){case"focusin":case"focusout":so=null;break;case"dragenter":case"dragleave":oo=null;break;case"mouseover":case"mouseout":ao=null;break;case"pointerover":case"pointerout":Ou.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":Du.delete(c.pointerId)}}function Iu(a,c,d,p,v,w){return a===null||a.nativeEvent!==w?(a={blockedOn:c,domEventName:d,eventSystemFlags:p,nativeEvent:w,targetContainers:[v]},c!==null&&(c=ul(c),c!==null&&WE(c)),a):(a.eventSystemFlags|=p,c=a.targetContainers,v!==null&&c.indexOf(v)===-1&&c.push(v),a)}function Dz(a,c,d,p,v){switch(c){case"focusin":return so=Iu(so,a,c,d,p,v),!0;case"dragenter":return oo=Iu(oo,a,c,d,p,v),!0;case"mouseover":return ao=Iu(ao,a,c,d,p,v),!0;case"pointerover":var w=v.pointerId;return Ou.set(w,Iu(Ou.get(w)||null,a,c,d,p,v)),!0;case"gotpointercapture":return w=v.pointerId,Du.set(w,Iu(Du.get(w)||null,a,c,d,p,v)),!0}return!1}function XE(a){var c=cl(a.target);if(c!==null){var d=s(c);if(d!==null){if(c=d.tag,c===13){if(c=o(d),c!==null){a.blockedOn=c,dk(a.priority,function(){KE(d)});return}}else if(c===31){if(c=l(d),c!==null){a.blockedOn=c,dk(a.priority,function(){KE(d)});return}}else if(c===3&&d.stateNode.current.memoizedState.isDehydrated){a.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}a.blockedOn=null}function Sh(a){if(a.blockedOn!==null)return!1;for(var c=a.targetContainers;0<c.length;){var d=Zb(a.nativeEvent);if(d===null){d=a.nativeEvent;var p=new d.constructor(d.type,d);Yg=p,d.target.dispatchEvent(p),Yg=null}else return c=ul(d),c!==null&&WE(c),a.blockedOn=d,!1;c.shift()}return!0}function JE(a,c,d){Sh(a)&&d.delete(c)}function Iz(){Xb=!1,so!==null&&Sh(so)&&(so=null),oo!==null&&Sh(oo)&&(oo=null),ao!==null&&Sh(ao)&&(ao=null),Ou.forEach(JE),Du.forEach(JE)}function kh(a,c){a.blockedOn===c&&(a.blockedOn=null,Xb||(Xb=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Iz)))}var Ch=null;function QE(a){Ch!==a&&(Ch=a,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Ch===a&&(Ch=null);for(var c=0;c<a.length;c+=3){var d=a[c],p=a[c+1],v=a[c+2];if(typeof p!="function"){if(Yb(p||d)===null)continue;break}var w=ul(d);w!==null&&(a.splice(c,3),c-=3,Zy(w,{pending:!0,data:v,method:d.method,action:p},p,v))}}))}function ql(a){function c($){return kh($,a)}so!==null&&kh(so,a),oo!==null&&kh(oo,a),ao!==null&&kh(ao,a),Ou.forEach(c),Du.forEach(c);for(var d=0;d<lo.length;d++){var p=lo[d];p.blockedOn===a&&(p.blockedOn=null)}for(;0<lo.length&&(d=lo[0],d.blockedOn===null);)XE(d),d.blockedOn===null&&lo.shift();if(d=(a.ownerDocument||a).$$reactFormReplay,d!=null)for(p=0;p<d.length;p+=3){var v=d[p],w=d[p+1],T=v[lr]||null;if(typeof w=="function")T||QE(d);else if(T){var N=null;if(w&&w.hasAttribute("formAction")){if(v=w,T=w[lr]||null)N=T.formAction;else if(Yb(v)!==null)continue}else N=T.action;typeof N=="function"?d[p+1]=N:(d.splice(p,3),p-=3),QE(d)}}}function eT(){function a(w){w.canIntercept&&w.info==="react-transition"&&w.intercept({handler:function(){return new Promise(function(T){return v=T})},focusReset:"manual",scroll:"manual"})}function c(){v!==null&&(v(),v=null),p||setTimeout(d,20)}function d(){if(!p&&!navigation.transition){var w=navigation.currentEntry;w&&w.url!=null&&navigation.navigate(w.url,{state:w.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var p=!1,v=null;return navigation.addEventListener("navigate",a),navigation.addEventListener("navigatesuccess",c),navigation.addEventListener("navigateerror",c),setTimeout(d,100),function(){p=!0,navigation.removeEventListener("navigate",a),navigation.removeEventListener("navigatesuccess",c),navigation.removeEventListener("navigateerror",c),v!==null&&(v(),v=null)}}}function Jb(a){this._internalRoot=a}Eh.prototype.render=Jb.prototype.render=function(a){var c=this._internalRoot;if(c===null)throw Error(r(409));var d=c.current,p=_r();qE(d,p,a,c,null,null)},Eh.prototype.unmount=Jb.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var c=a.containerInfo;qE(a.current,2,null,a,null,null),sh(),c[ll]=null}};function Eh(a){this._internalRoot=a}Eh.prototype.unstable_scheduleHydration=function(a){if(a){var c=uk();a={blockedOn:null,target:a,priority:c};for(var d=0;d<lo.length&&c!==0&&c<lo[d].priority;d++);lo.splice(d,0,a),d===0&&XE(a)}};var tT=e.version;if(tT!=="19.2.8")throw Error(r(527,tT,"19.2.8"));L.findDOMNode=function(a){var c=a._reactInternals;if(c===void 0)throw typeof a.render=="function"?Error(r(188)):(a=Object.keys(a).join(","),Error(r(268,a)));return a=f(c),a=a!==null?h(a):null,a=a===null?null:a.stateNode,a};var jz={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Th=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Th.isDisabled&&Th.supportsFiber)try{H=Th.inject(jz),ie=Th}catch{}}return Lu.createRoot=function(a,c){if(!i(a))throw Error(r(299));var d=!1,p="",v=l1,w=c1,T=u1;return c!=null&&(c.unstable_strictMode===!0&&(d=!0),c.identifierPrefix!==void 0&&(p=c.identifierPrefix),c.onUncaughtError!==void 0&&(v=c.onUncaughtError),c.onCaughtError!==void 0&&(w=c.onCaughtError),c.onRecoverableError!==void 0&&(T=c.onRecoverableError)),c=UE(a,1,!1,null,null,d,p,null,v,w,T,eT),a[ll]=c.current,Db(a),new Jb(c)},Lu.hydrateRoot=function(a,c,d){if(!i(a))throw Error(r(299));var p=!1,v="",w=l1,T=c1,N=u1,$=null;return d!=null&&(d.unstable_strictMode===!0&&(p=!0),d.identifierPrefix!==void 0&&(v=d.identifierPrefix),d.onUncaughtError!==void 0&&(w=d.onUncaughtError),d.onCaughtError!==void 0&&(T=d.onCaughtError),d.onRecoverableError!==void 0&&(N=d.onRecoverableError),d.formState!==void 0&&($=d.formState)),c=UE(a,1,!0,c,d??null,p,v,$,w,T,N,eT),c.context=FE(null),d=c.current,p=_r(),p=na(p),v=Ws(p),v.callback=null,Ks(d,v,p),d=p,c.current.lanes=d,ln(c,d),_i(c),a[ll]=c.current,Db(a),new Eh(c)},Lu.version="19.2.8",Lu}var pT;function qz(){if(pT)return nv.exports;pT=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),nv.exports=Fz(),nv.exports}var Gz=qz();const Wz=()=>{};var mT={};const NM=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},Kz=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++],l=t[n++],u=((i&7)<<18|(s&63)<<12|(o&63)<<6|l&63)-65536;e[r++]=String.fromCharCode(55296+(u>>10)),e[r++]=String.fromCharCode(56320+(u&1023))}else{const s=t[n++],o=t[n++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},OM={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,l=o?t[i+1]:0,u=i+2<t.length,f=u?t[i+2]:0,h=s>>2,m=(s&3)<<4|l>>4;let g=(l&15)<<2|f>>6,b=f&63;u||(b=64,o||(g=64)),r.push(n[h],n[m],n[g],n[b])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(NM(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):Kz(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++)],l=i<t.length?n[t.charAt(i)]:0;++i;const f=i<t.length?n[t.charAt(i)]:64;++i;const m=i<t.length?n[t.charAt(i)]:64;if(++i,s==null||l==null||f==null||m==null)throw new Zz;const g=s<<2|l>>4;if(r.push(g),f!==64){const b=l<<4&240|f>>2;if(r.push(b),m!==64){const x=f<<6&192|m;r.push(x)}}}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 Zz extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Yz=function(t){const e=NM(t);return OM.encodeByteArray(e,!0)},DM=function(t){return Yz(t).replace(/\./g,"")},IM=function(t){try{return OM.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Xz(){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.")}const Jz=()=>Xz().__FIREBASE_DEFAULTS__,Qz=()=>{if(typeof process>"u"||typeof mT>"u")return;const t=mT.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},e$=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&IM(t[1]);return e&&JSON.parse(e)},iw=()=>{try{return Wz()||Jz()||Qz()||e$()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},t$=t=>iw()?.emulatorHosts?.[t],jM=()=>iw()?.config,LM=t=>iw()?.[`_${t}`];class PM{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))}}}function sr(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function n$(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(sr())}function r$(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function i$(){const t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function s$(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function o$(){const t=sr();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function a$(){try{return typeof indexedDB=="object"}catch{return!1}}function l$(){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=()=>{e(i.error?.message||"")}}catch(n){e(n)}})}const c$="FirebaseError";class Ko extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=c$,Object.setPrototypeOf(this,Ko.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Zd.prototype.create)}}class Zd{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?u$(s,r):"Error",l=`${this.serviceName}: ${o} (${i}).`;return new Ko(i,l,r)}}function u$(t,e){try{let n=0,r="";for(;n<t.length;){const i=t.indexOf("{$",n);if(i===-1){r+=t.substring(n);break}const s=t.indexOf("}",i+2);if(s===-1){r+=t.substring(n);break}const o=t.substring(i+2,s),l=e[o];r+=t.substring(n,i)+(l!=null?String(l):`<${o}?>`),n=s+1}return r}catch{return t}}function d$(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function gc(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(gT(s)&&gT(o)){if(!gc(s,o))return!1}else if(s!==o)return!1}for(const i of r)if(!n.includes(i))return!1;return!0}function gT(t){return t!==null&&typeof t=="object"}function Yd(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 Yu(t){const e={};return t.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[i,s]=r.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Xu(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}function f$(t,e){const n=new h$(t,e);return n.subscribe.bind(n)}class h${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.");p$(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:r},i.next===void 0&&(i.next=ov),i.error===void 0&&(i.error=ov),i.complete===void 0&&(i.complete=ov);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 p$(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 ov(){}function Ps(t){return t&&t._delegate?t._delegate:t}function sw(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function m$(t){return(await fetch(t,{credentials:"include"})).ok}class yc{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}}const wa="[DEFAULT]";class g${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 PM;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?.identifier),r=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(b$(e))try{this.getOrInitializeService({instanceIdentifier:wa})}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=wa){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=wa){return this.instances.has(e)}getOptions(e=wa){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 l=this.normalizeInstanceIdentifier(s);r===l&&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:y$(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=wa){return this.component?this.component.multipleInstances?e:wa:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function y$(t){return t===wa?void 0:t}function b$(t){return t.instantiationMode==="EAGER"}class v${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 g$(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}var It;(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"})(It||(It={}));const x$={debug:It.DEBUG,verbose:It.VERBOSE,info:It.INFO,warn:It.WARN,error:It.ERROR,silent:It.SILENT},w$=It.INFO,S$={[It.DEBUG]:"log",[It.VERBOSE]:"log",[It.INFO]:"info",[It.WARN]:"warn",[It.ERROR]:"error"},k$=(t,e,...n)=>{if(e<t.logLevel)return;const r=new Date().toISOString(),i=S$[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 zM{constructor(e){this.name=e,this._logLevel=w$,this._logHandler=k$,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in It))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?x$[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,It.DEBUG,...e),this._logHandler(this,It.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,It.VERBOSE,...e),this._logHandler(this,It.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,It.INFO,...e),this._logHandler(this,It.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,It.WARN,...e),this._logHandler(this,It.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,It.ERROR,...e),this._logHandler(this,It.ERROR,...e)}}const C$=(t,e)=>e.some(n=>t instanceof n);let yT,bT;function E$(){return yT||(yT=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function T$(){return bT||(bT=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const $M=new WeakMap,S0=new WeakMap,BM=new WeakMap,av=new WeakMap,ow=new WeakMap;function _$(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(Mo(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&$M.set(n,t)}).catch(()=>{}),ow.set(e,t),e}function A$(t){if(S0.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)});S0.set(t,e)}let k0={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return S0.get(t);if(e==="objectStoreNames")return t.objectStoreNames||BM.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Mo(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 R$(t){k0=t(k0)}function M$(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(lv(this),e,...n);return BM.set(r,e.sort?e.sort():[e]),Mo(r)}:T$().includes(t)?function(...e){return t.apply(lv(this),e),Mo($M.get(this))}:function(...e){return Mo(t.apply(lv(this),e))}}function N$(t){return typeof t=="function"?M$(t):(t instanceof IDBTransaction&&A$(t),C$(t,E$())?new Proxy(t,k0):t)}function Mo(t){if(t instanceof IDBRequest)return _$(t);if(av.has(t))return av.get(t);const e=N$(t);return e!==t&&(av.set(t,e),ow.set(e,t)),e}const lv=t=>ow.get(t);function O$(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),l=Mo(o);return r&&o.addEventListener("upgradeneeded",u=>{r(Mo(o.result),u.oldVersion,u.newVersion,Mo(o.transaction),u)}),n&&o.addEventListener("blocked",u=>n(u.oldVersion,u.newVersion,u)),l.then(u=>{s&&u.addEventListener("close",()=>s()),i&&u.addEventListener("versionchange",f=>i(f.oldVersion,f.newVersion,f))}).catch(()=>{}),l}const D$=["get","getKey","getAll","getAllKeys","count"],I$=["put","add","delete","clear"],cv=new Map;function vT(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(cv.get(e))return cv.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=I$.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||D$.includes(n)))return;const s=async function(o,...l){const u=this.transaction(o,i?"readwrite":"readonly");let f=u.store;return r&&(f=f.index(l.shift())),(await Promise.all([f[n](...l),i&&u.done]))[0]};return cv.set(e,s),s}R$(t=>({...t,get:(e,n,r)=>vT(e,n)||t.get(e,n,r),has:(e,n)=>!!vT(e,n)||t.has(e,n)}));class j${constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(L$(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function L$(t){return t.getComponent()?.type==="VERSION"}const C0="@firebase/app",xT="0.16.0";const Os=new zM("@firebase/app"),P$="@firebase/app-compat",z$="@firebase/analytics-compat",$$="@firebase/analytics",B$="@firebase/app-check-compat",V$="@firebase/app-check",H$="@firebase/auth",U$="@firebase/auth-compat",F$="@firebase/database",q$="@firebase/data-connect",G$="@firebase/database-compat",W$="@firebase/functions",K$="@firebase/functions-compat",Z$="@firebase/installations",Y$="@firebase/installations-compat",X$="@firebase/messaging",J$="@firebase/messaging-compat",Q$="@firebase/performance",eB="@firebase/performance-compat",tB="@firebase/remote-config",nB="@firebase/remote-config-compat",rB="@firebase/storage",iB="@firebase/storage-compat",sB="@firebase/firestore",oB="@firebase/ai",aB="@firebase/firestore-compat",lB="firebase",cB="12.17.0";const E0="[DEFAULT]",uB={[C0]:"fire-core",[P$]:"fire-core-compat",[$$]:"fire-analytics",[z$]:"fire-analytics-compat",[V$]:"fire-app-check",[B$]:"fire-app-check-compat",[H$]:"fire-auth",[U$]:"fire-auth-compat",[F$]:"fire-rtdb",[q$]:"fire-data-connect",[G$]:"fire-rtdb-compat",[W$]:"fire-fn",[K$]:"fire-fn-compat",[Z$]:"fire-iid",[Y$]:"fire-iid-compat",[X$]:"fire-fcm",[J$]:"fire-fcm-compat",[Q$]:"fire-perf",[eB]:"fire-perf-compat",[tB]:"fire-rc",[nB]:"fire-rc-compat",[rB]:"fire-gcs",[iB]:"fire-gcs-compat",[sB]:"fire-fst",[aB]:"fire-fst-compat",[oB]:"fire-vertex","fire-js":"fire-js",[lB]:"fire-js-all"};const Ed=new Map,dB=new Map,T0=new Map;function wT(t,e){try{t.container.addComponent(e)}catch(n){Os.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Td(t){const e=t.name;if(T0.has(e))return Os.debug(`There were multiple attempts to register component ${e}.`),!1;T0.set(e,t);for(const n of Ed.values())wT(n,t);for(const n of dB.values())wT(n,t);return!0}function VM(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function pi(t){return t==null?!1:t.settings!==void 0}const fB={"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 {$mismatchedParam}. Existing: '{$oldValue}'. New: '{$newValue}'.","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."},xs=new Zd("app","Firebase",fB);class hB{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 yc("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 xs.create("app-deleted",{appName:this._name})}}const Xd=cB;function HM(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r={name:E0,automaticDataCollectionEnabled:!0,...e},i=r.name;if(typeof i!="string"||!i)throw xs.create("bad-app-name",{appName:String(i)});if(n||(n=jM()),!n)throw xs.create("no-options");const s=Ed.get(i);if(s)if(gc(n,s.options)){if(gc(r,s.config))return s;throw xs.create("duplicate-app",{appName:i,mismatchedParam:"config",oldValue:JSON.stringify(s.config),newValue:JSON.stringify(r)})}else throw xs.create("duplicate-app",{appName:i,mismatchedParam:"options",oldValue:JSON.stringify(s.options),newValue:JSON.stringify(n)});const o=new v$(i);for(const u of T0.values())o.addComponent(u);const l=new hB(n,r,o);return Ed.set(i,l),l}function UM(t=E0){const e=Ed.get(t);if(!e&&t===E0&&jM())return HM();if(!e)throw xs.create("no-app",{appName:t});return e}function pB(){return Array.from(Ed.values())}function lc(t,e,n){let r=uB[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 "/")`),Os.warn(o.join(" "));return}Td(new yc(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}const mB="firebase-heartbeat-database",gB=1,_d="firebase-heartbeat-store";let uv=null;function FM(){return uv||(uv=O$(mB,gB,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(_d)}catch(n){console.warn(n)}}}}).catch(t=>{throw xs.create("idb-open",{originalErrorMessage:t.message})})),uv}async function yB(t){try{const n=(await FM()).transaction(_d),r=await n.objectStore(_d).get(qM(t));return await n.done,r}catch(e){if(e instanceof Ko)Os.warn(e.message);else{const n=xs.create("idb-get",{originalErrorMessage:e?.message});Os.warn(n.message)}}}async function ST(t,e){try{const r=(await FM()).transaction(_d,"readwrite");await r.objectStore(_d).put(e,qM(t)),await r.done}catch(n){if(n instanceof Ko)Os.warn(n.message);else{const r=xs.create("idb-set",{originalErrorMessage:n?.message});Os.warn(r.message)}}}function qM(t){return`${t.name}!${t.options.appId}`}const bB=1024,vB=30;class xB{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new SB(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){try{const n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=kT();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(i=>i.date===r))return;if(this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats.length>vB){const i=kB(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){Os.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";const e=kT(),{heartbeatsToSend:n,unsentEntries:r}=wB(this._heartbeatsCache.heartbeats),i=DM(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(e){return Os.warn(e),""}}}function kT(){return new Date().toISOString().substring(0,10)}function wB(t,e=bB){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),CT(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),CT(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class SB{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return a$()?l$().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await yB(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return ST(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 ST(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function CT(t){return DM(JSON.stringify({version:2,heartbeats:t})).length}function kB(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}function CB(t){Td(new yc("platform-logger",e=>new j$(e),"PRIVATE")),Td(new yc("heartbeat",e=>new xB(e),"PRIVATE")),lc(C0,xT,t),lc(C0,xT,"esm2020"),lc("fire-js","")}CB("");var EB="firebase",TB="12.17.1";lc(EB,TB,"app");function GM(){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 _B=GM,WM=new Zd("auth","Firebase",GM());const Rp=new zM("@firebase/auth");function KM(t,...e){Rp.logLevel<=It.WARN&&Rp.warn(`Auth (${Xd}): ${t}`,...e)}function up(t,...e){Rp.logLevel<=It.ERROR&&Rp.error(`Auth (${Xd}): ${t}`,...e)}function ri(t,...e){throw lw(t,...e)}function vi(t,...e){return lw(t,...e)}function aw(t,e,n){const r={..._B(),[e]:n};return new Zd("auth","Firebase",r).create(e,{appName:t.name})}function No(t){return aw(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function AB(t,e,n){const r=n;if(!(e instanceof r))throw r.name!==e.constructor.name&&ri(t,"argument-error"),aw(t,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function lw(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 WM.create(t,...e)}function We(t,e,...n){if(!t)throw lw(e,...n)}function ws(t){const e="INTERNAL ASSERTION FAILED: "+t;throw up(e),new Error(e)}function Ds(t,e){t||ws(e)}function _0(){return typeof self<"u"&&self.location?.href||""}function RB(){return ET()==="http:"||ET()==="https:"}function ET(){return typeof self<"u"&&self.location?.protocol||null}function MB(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(RB()||i$()||"connection"in navigator)?navigator.onLine:!0}function NB(){if(typeof navigator>"u")return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}class Jd{constructor(e,n){this.shortDelay=e,this.longDelay=n,Ds(n>e,"Short delay should be less than long delay!"),this.isMobile=n$()||s$()}get(){return MB()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function cw(t,e){Ds(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}class ZM{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;ws("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;ws("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;ws("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const OB={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"};const DB=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],IB=new Jd(3e4,6e4);function Qa(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function Zo(t,e,n,r,i={}){return YM(t,i,async()=>{let s={},o={};r&&(e==="GET"?o=r:s={body:JSON.stringify(r)});const l=Yd({...o,key:t.config.apiKey}).slice(1),u=await t._getAdditionalHeaders();u["Content-Type"]="application/json",t.languageCode&&(u["X-Firebase-Locale"]=t.languageCode);const f={method:e,headers:u,...s};return r$()||(f.referrerPolicy="strict-origin-when-cross-origin"),t.emulatorConfig&&sw(t.emulatorConfig.host)&&(f.credentials="include"),ZM.fetch()(await XM(t,t.config.apiHost,n,l),f)})}async function YM(t,e,n){t._canInitEmulator=!1;const r={...OB,...e};try{const i=new LB(t),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();const o=await s.json();if("needConfirmation"in o)throw _h(t,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{const l=s.ok?o.errorMessage:o.error.message,[u,f]=l.split(" : ");if(u==="FEDERATED_USER_ID_ALREADY_LINKED")throw _h(t,"credential-already-in-use",o);if(u==="EMAIL_EXISTS")throw _h(t,"email-already-in-use",o);if(u==="USER_DISABLED")throw _h(t,"user-disabled",o);const h=r[u]||u.toLowerCase().replace(/[_\s]+/g,"-");if(f)throw aw(t,h,f);ri(t,h)}}catch(i){if(i instanceof Ko)throw i;ri(t,"network-request-failed",{message:String(i)})}}async function Gm(t,e,n,r,i={}){const s=await Zo(t,e,n,r,i);return"mfaPendingCredential"in s&&ri(t,"multi-factor-auth-required",{_serverResponse:s}),s}async function XM(t,e,n,r){const i=`${e}${n}?${r}`,s=t,o=s.config.emulator?cw(t.config,i):`${t.config.apiScheme}://${i}`;return DB.includes(n)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(o).toString():o}function jB(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class LB{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(vi(this.auth,"network-request-failed")),IB.get())})}}function _h(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=vi(t,e,r);return i.customData._tokenResponse=n,i}function TT(t){return t!==void 0&&t.enterprise!==void 0}class PB{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(const n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return jB(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function zB(t,e){return Zo(t,"GET","/v2/recaptchaConfig",Qa(t,e))}async function $B(t,e){return Zo(t,"POST","/v1/accounts:delete",e)}async function Mp(t,e){return Zo(t,"POST","/v1/accounts:lookup",e)}function ad(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function BB(t,e=!1){const n=Ps(t),r=await n.getIdToken(e),i=uw(r);We(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");const s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:r,authTime:ad(dv(i.auth_time)),issuedAtTime:ad(dv(i.iat)),expirationTime:ad(dv(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function dv(t){return Number(t)*1e3}function uw(t){const[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return up("JWT malformed, contained fewer than 3 sections"),null;try{const i=IM(n);return i?JSON.parse(i):(up("Failed to decode base64 JWT payload"),null)}catch(i){return up("Caught error parsing JWT payload as JSON",i?.toString()),null}}function _T(t){const e=uw(t);return We(e,"internal-error"),We(typeof e.exp<"u","internal-error"),We(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function Ad(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof Ko&&VB(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function VB({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}class HB{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?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}class A0{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ad(this.lastLoginAt),this.creationTime=ad(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function Np(t){const e=t.auth,n=await t.getIdToken(),r=await Ad(t,Mp(e,{idToken:n}));We(r?.users.length,e,"internal-error");const i=r.users[0];t._notifyReloadListener(i);const s=i.providerUserInfo?.length?JM(i.providerUserInfo):[],o=FB(t.providerData,s),l=t.isAnonymous,u=!(t.email&&i.passwordHash)&&!o?.length,f=l?u:!1,h={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 A0(i.createdAt,i.lastLoginAt),isAnonymous:f};Object.assign(t,h)}async function UB(t){const e=Ps(t);await Np(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function FB(t,e){return[...t.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function JM(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}))}async function qB(t,e){const n=await YM(t,{},async()=>{const r=Yd({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=t.config,o=await XM(t,i,"/v1/token",`key=${s}`),l=await t._getAdditionalHeaders();l["Content-Type"]="application/x-www-form-urlencoded";const u={method:"POST",headers:l,body:r};return t.emulatorConfig&&sw(t.emulatorConfig.host)&&(u.credentials="include"),ZM.fetch()(o,u)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function GB(t,e){return Zo(t,"POST","/v2/accounts:revokeToken",Qa(t,e))}class cc{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){We(e.idToken,"internal-error"),We(typeof e.idToken<"u","internal-error"),We(typeof e.refreshToken<"u","internal-error");const n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):_T(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){We(e.length!==0,"internal-error");const n=_T(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(We(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 qB(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 cc;return r&&(We(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),i&&(We(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(We(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 cc,this.toJSON())}_performRefresh(){return ws("not implemented")}}function uo(t,e){We(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}class yi{constructor({uid:e,auth:n,stsTokenManager:r,...i}){this.providerId="firebase",this.proactiveRefresh=new HB(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 A0(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const n=await Ad(this,this.stsTokenManager.getToken(this.auth,e));return We(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return BB(this,e)}reload(){return UB(this)}_assign(e){this!==e&&(We(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 yi({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){We(!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 Np(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(pi(this.auth.app))return Promise.reject(No(this.auth));const e=await this.getIdToken();return await Ad(this,$B(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,l=n.tenantId??void 0,u=n._redirectEventId??void 0,f=n.createdAt??void 0,h=n.lastLoginAt??void 0,{uid:m,emailVerified:g,isAnonymous:b,providerData:x,stsTokenManager:S}=n;We(m&&S,e,"internal-error");const k=cc.fromJSON(this.name,S);We(typeof m=="string",e,"internal-error"),uo(r,e.name),uo(i,e.name),We(typeof g=="boolean",e,"internal-error"),We(typeof b=="boolean",e,"internal-error"),uo(s,e.name),uo(o,e.name),uo(l,e.name),uo(u,e.name),uo(f,e.name),uo(h,e.name);const C=new yi({uid:m,auth:e,email:i,emailVerified:g,displayName:r,isAnonymous:b,photoURL:o,phoneNumber:s,tenantId:l,stsTokenManager:k,createdAt:f,lastLoginAt:h});return x&&Array.isArray(x)&&(C.providerData=x.map(_=>({..._}))),u&&(C._redirectEventId=u),C}static async _fromIdTokenResponse(e,n,r=!1){const i=new cc;i.updateFromServerResponse(n);const s=new yi({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await Np(s),s}static async _fromGetAccountInfoResponse(e,n,r){const i=n.users[0];We(i.localId!==void 0,"internal-error");const s=i.providerUserInfo!==void 0?JM(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,l=new cc;l.updateFromIdToken(r);const u=new yi({uid:i.localId,auth:e,stsTokenManager:l,isAnonymous:o}),f={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 A0(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(u,f),u}}const AT=new Map;function Ss(t){Ds(t instanceof Function,"Expected a class definition");let e=AT.get(t);return e?(Ds(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,AT.set(t,e),e)}class QM{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){}}QM.type="NONE";const RT=QM;function dp(t,e,n){return`firebase:${t}:${e}:${n}`}class uc{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;const{config:i,name:s}=this.auth;this.fullUserKey=dp(this.userKey,i.apiKey,s),this.fullPersistenceKey=dp("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 Mp(this.auth,{idToken:e}).catch(()=>{});return n?yi._fromGetAccountInfoResponse(this.auth,n,e):null}return yi._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 uc(Ss(RT),e,r);const i=(await Promise.all(n.map(async f=>{if(await f._isAvailable())return f}))).filter(f=>f);let s=i[0]||Ss(RT);const o=dp(r,e.config.apiKey,e.name);let l=null;for(const f of n)try{const h=await f._get(o);if(h){let m;if(typeof h=="string"){const g=await Mp(e,{idToken:h}).catch(()=>{});if(!g)break;m=await yi._fromGetAccountInfoResponse(e,g,h)}else m=yi._fromJSON(e,h);f!==s&&(l=m),s=f;break}}catch{}const u=i.filter(f=>f._shouldAllowMigration);return!s._shouldAllowMigration||!u.length?new uc(s,e,r):(s=u[0],l&&await s._set(o,l.toJSON()),await Promise.all(n.map(async f=>{if(f!==s)try{await f._remove(o)}catch{}})),new uc(s,e,r))}}function MT(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(rN(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(eN(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(sN(e))return"Blackberry";if(oN(e))return"Webos";if(tN(e))return"Safari";if((e.includes("chrome/")||nN(e))&&!e.includes("edge/"))return"Chrome";if(iN(e))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=t.match(n);if(r?.length===2)return r[1]}return"Other"}function eN(t=sr()){return/firefox\//i.test(t)}function tN(t=sr()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function nN(t=sr()){return/crios\//i.test(t)}function rN(t=sr()){return/iemobile/i.test(t)}function iN(t=sr()){return/android/i.test(t)}function sN(t=sr()){return/blackberry/i.test(t)}function oN(t=sr()){return/webos/i.test(t)}function dw(t=sr()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function WB(t=sr()){return dw(t)&&!!window.navigator?.standalone}function KB(){return o$()&&document.documentMode===10}function aN(t=sr()){return dw(t)||iN(t)||oN(t)||sN(t)||/windows phone/i.test(t)||rN(t)}function lN(t,e=[]){let n;switch(t){case"Browser":n=MT(sr());break;case"Worker":n=`${MT(sr())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Xd}/${r}`}class ZB{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const r=s=>new Promise((o,l)=>{try{const u=e(s);o(u)}catch(u){l(u)}});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?.message})}}}async function YB(t,e={}){return Zo(t,"GET","/v2/passwordPolicy",Qa(t,e))}const XB=6;class JB{constructor(e){const n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??XB,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=e.allowedNonAlphanumericCharacters?.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))}}class QB{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 NT(this),this.idTokenSubscription=new NT(this),this.beforeStateQueue=new ZB(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=WM,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=Ss(n)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await uc.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=this.currentUser?.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 Mp(this,{idToken:e}),r=await yi._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){if(pi(this.app)){const s=this.app.settings.authIdToken;return s?new Promise(o=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(s).then(o,o))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const s=this.redirectUser?._redirectEventId,o=r?._redirectEventId,l=await this.tryRedirectSignIn(e);(!s||s===o)&&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(s){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(s))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return We(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 Np(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=NB()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(pi(this.app))return Promise.reject(No(this));const n=e?Ps(e):null;return n&&We(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&&We(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 pi(this.app)?Promise.reject(No(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return pi(this.app)?Promise.reject(No(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Ss(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 YB(this),n=new JB(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 Zd("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 GB(this,r)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.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&&Ss(e)||this._popupRedirectResolver;We(n,this,"argument-error"),this.redirectPersistenceManager=await uc.create(this,[Ss(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===e?this._currentUser:this.redirectUser?._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(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=this.currentUser?.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 l=this._isInitialized?Promise.resolve():this._initializationPromise;if(We(l,this,"internal-error"),l.then(()=>{o||s(this.currentUser)}),typeof n=="function"){const u=e.addObserver(n,r,i);return()=>{o=!0,u()}}else{const u=e.addObserver(n);return()=>{o=!0,u()}}}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 We(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=lN(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){if(pi(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&KM(`Error while retrieving App Check token: ${e.error}`),e?.token}}function el(t){return Ps(t)}class NT{constructor(e){this.auth=e,this.observer=null,this.addObserver=f$(n=>this.observer=n)}get next(){return We(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let Wm={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function e3(t){Wm=t}function cN(t){return Wm.loadJS(t)}function t3(){return Wm.recaptchaEnterpriseScript}function n3(){return Wm.gapiScript}function r3(t){return`__${t}${Math.floor(Math.random()*1e6)}`}class i3{constructor(){this.enterprise=new s3}ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}}class s3{ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}}const o3="recaptcha-enterprise",uN="NO_RECAPTCHA",OT="onFirebaseAuthREInstanceReady";class vo{constructor(e){this.type=o3,this.auth=el(e)}async verify(e="verify",n=!1){async function r(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,l)=>{zB(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(u=>{if(u.recaptchaKey===void 0)l(new Error("recaptcha Enterprise site key undefined"));else{const f=new PB(u);return s.tenantId==null?s._agentRecaptchaConfig=f:s._tenantRecaptchaConfigs[s.tenantId]=f,o(f.siteKey)}}).catch(u=>{l(u)})})}function i(s,o,l){const u=window.grecaptcha;TT(u)?u.enterprise.ready(()=>{u.enterprise.execute(s,{action:e}).then(f=>{o(f)}).catch(()=>{o(uN)})}):l(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new i3().execute("siteKey",{action:"verify"}):new Promise((s,o)=>{r(this.auth).then(async l=>{if(!n&&TT(window.grecaptcha)&&vo.scriptInjectionDeferred)await vo.scriptInjectionDeferred.promise,i(l,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let u=t3();u.length!==0&&(u+=l+`&onload=${OT}`),vo.scriptInjectionDeferred=new PM,window[OT]=()=>{vo.scriptInjectionDeferred?.resolve()},cN(u).then(()=>vo.scriptInjectionDeferred?.promise).then(()=>{i(l,s,o)}).catch(f=>{o(f)})}}).catch(l=>{o(l)})})}}vo.scriptInjectionDeferred=null;async function DT(t,e,n,r=!1,i=!1){const s=new vo(t);let o;if(i)o=uN;else try{o=await s.verify(n)}catch{o=await s.verify(n,!0)}const l={...e};if(n==="mfaSmsEnrollment"||n==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in l){const u=l.phoneEnrollmentInfo.phoneNumber,f=l.phoneEnrollmentInfo.recaptchaToken;Object.assign(l,{phoneEnrollmentInfo:{phoneNumber:u,recaptchaToken:f,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in l){const u=l.phoneSignInInfo.recaptchaToken;Object.assign(l,{phoneSignInInfo:{recaptchaToken:u,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return l}return r?Object.assign(l,{captchaResp:o}):Object.assign(l,{captchaResponse:o}),Object.assign(l,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(l,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),l}async function IT(t,e,n,r,i){if(t._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const s=await DT(t,e,n,n==="getOobCode");return r(t,s)}else return r(t,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const o=await DT(t,e,n,n==="getOobCode");return r(t,o)}else return Promise.reject(s)})}function a3(t,e){const n=VM(t,"auth");if(n.isInitialized()){const i=n.getImmediate(),s=n.getOptions();if(gc(s,e??{}))return i;ri(i,"already-initialized")}return n.initialize({options:e})}function l3(t,e){const n=e?.persistence||[],r=(Array.isArray(n)?n:[n]).map(Ss);e?.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e?.popupRedirectResolver)}function c3(t,e,n){const r=el(t);We(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const i=!1,s=dN(e),{host:o,port:l}=u3(e),u=l===null?"":`:${l}`,f={url:`${s}//${o}${u}/`},h=Object.freeze({host:o,port:l,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator){We(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),We(gc(f,r.config.emulator)&&gc(h,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=f,r.emulatorConfig=h,r.settings.appVerificationDisabledForTesting=!0,sw(o)?m$(`${s}//${o}${u}`):d3()}function dN(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function u3(t){const e=dN(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:jT(r.substr(s.length+1))}}else{const[s,o]=r.split(":");return{host:s,port:jT(o)}}}function jT(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}function d3(){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())}class fw{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return ws("not implemented")}_getIdTokenResponse(e){return ws("not implemented")}_linkToIdToken(e,n){return ws("not implemented")}_getReauthenticationResolver(e){return ws("not implemented")}}async function f3(t,e){return Zo(t,"POST","/v1/accounts:signUp",e)}async function h3(t,e){return Gm(t,"POST","/v1/accounts:signInWithPassword",Qa(t,e))}async function p3(t,e){return Gm(t,"POST","/v1/accounts:signInWithEmailLink",Qa(t,e))}async function m3(t,e){return Gm(t,"POST","/v1/accounts:signInWithEmailLink",Qa(t,e))}class Rd extends fw{constructor(e,n,r,i=null){super("password",r),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new Rd(e,n,"password")}static _fromEmailAndCode(e,n,r=null){return new Rd(e,n,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":const n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return IT(e,n,"signInWithPassword",h3);case"emailLink":return p3(e,{email:this._email,oobCode:this._password});default:ri(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":const r={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return IT(e,r,"signUpPassword",f3);case"emailLink":return m3(e,{idToken:n,email:this._email,oobCode:this._password});default:ri(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function dc(t,e){return Gm(t,"POST","/v1/accounts:signInWithIdp",Qa(t,e))}const g3="http://localhost";class za extends fw{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const n=new za(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):ri("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 za(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 dc(e,n)}_linkToIdToken(e,n){const r=this.buildRequest();return r.idToken=n,dc(e,r)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,dc(e,n)}buildRequest(){const e={requestUri:g3,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=Yd(n)}return e}}function y3(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function b3(t){const e=Yu(Xu(t)).link,n=e?Yu(Xu(e)).deep_link_id:null,r=Yu(Xu(t)).deep_link_id;return(r?Yu(Xu(r)).link:null)||r||n||e||t}class hw{constructor(e){const n=Yu(Xu(e)),r=n.apiKey??null,i=n.oobCode??null,s=y3(n.mode??null);We(r&&i&&s,"argument-error"),this.apiKey=r,this.operation=s,this.code=i,this.continueUrl=n.continueUrl??null,this.languageCode=n.lang??null,this.tenantId=n.tenantId??null}static parseLink(e){const n=b3(e);try{return new hw(n)}catch{return null}}}class Lc{constructor(){this.providerId=Lc.PROVIDER_ID}static credential(e,n){return Rd._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){const r=hw.parseLink(n);return We(r,"argument-error"),Rd._fromEmailAndCode(e,r.code,r.tenantId)}}Lc.PROVIDER_ID="password";Lc.EMAIL_PASSWORD_SIGN_IN_METHOD="password";Lc.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class pw{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}}class Qd extends pw{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class xo extends Qd{constructor(){super("facebook.com")}static credential(e){return za._fromParams({providerId:xo.PROVIDER_ID,signInMethod:xo.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return xo.credentialFromTaggedObject(e)}static credentialFromError(e){return xo.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return xo.credential(e.oauthAccessToken)}catch{return null}}}xo.FACEBOOK_SIGN_IN_METHOD="facebook.com";xo.PROVIDER_ID="facebook.com";class vs extends Qd{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return za._fromParams({providerId:vs.PROVIDER_ID,signInMethod:vs.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return vs.credentialFromTaggedObject(e)}static credentialFromError(e){return vs.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return vs.credential(n,r)}catch{return null}}}vs.GOOGLE_SIGN_IN_METHOD="google.com";vs.PROVIDER_ID="google.com";class wo extends Qd{constructor(){super("github.com")}static credential(e){return za._fromParams({providerId:wo.PROVIDER_ID,signInMethod:wo.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return wo.credentialFromTaggedObject(e)}static credentialFromError(e){return wo.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return wo.credential(e.oauthAccessToken)}catch{return null}}}wo.GITHUB_SIGN_IN_METHOD="github.com";wo.PROVIDER_ID="github.com";class So extends Qd{constructor(){super("twitter.com")}static credential(e,n){return za._fromParams({providerId:So.PROVIDER_ID,signInMethod:So.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return So.credentialFromTaggedObject(e)}static credentialFromError(e){return So.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return So.credential(n,r)}catch{return null}}}So.TWITTER_SIGN_IN_METHOD="twitter.com";So.PROVIDER_ID="twitter.com";class bc{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 yi._fromIdTokenResponse(e,r,i),o=LT(r);return new bc({user:s,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);const i=LT(r);return new bc({user:e,providerId:i,_tokenResponse:r,operationType:n})}}function LT(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}class Op extends Ko{constructor(e,n,r,i){super(n.code,n.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,Op.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 Op(e,n,r,i)}}function fN(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Op._fromErrorAndOperation(t,s,e,r):s})}async function v3(t,e,n=!1){const r=await Ad(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return bc._forOperation(t,"link",r)}async function x3(t,e,n=!1){const{auth:r}=t;if(pi(r.app))return Promise.reject(No(r));const i="reauthenticate";try{const s=await Ad(t,fN(r,i,e,t),n);We(s.idToken,r,"internal-error");const o=uw(s.idToken);We(o,r,"internal-error");const{sub:l}=o;return We(t.uid===l,r,"user-mismatch"),bc._forOperation(t,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&ri(r,"user-mismatch"),s}}async function hN(t,e,n=!1){if(pi(t.app))return Promise.reject(No(t));const r="signIn",i=await fN(t,r,e),s=await bc._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}async function w3(t,e){return hN(el(t),e)}async function S3(t){const e=el(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}function k3(t,e,n){return pi(t.app)?Promise.reject(No(t)):w3(Ps(t),Lc.credential(e,n)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&S3(t),r})}function C3(t,e,n,r){return Ps(t).onIdTokenChanged(e,n,r)}function E3(t,e,n){return Ps(t).beforeAuthStateChanged(e,n)}function T3(t,e,n,r){return Ps(t).onAuthStateChanged(e,n,r)}function PT(t){return Ps(t).signOut()}const Dp="__sak";class pN{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Dp,"1"),this.storage.removeItem(Dp),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()}}const _3=1e3,A3=10;class mN extends pN{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=aN(),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,l,u)=>{this.notifyListeners(o,u)});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);KB()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,A3):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)})},_3)}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]}}mN.type="LOCAL";const R3=mN;class gN extends pN{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}}gN.type="SESSION";const yN=gN;function M3(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}class Km{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 Km(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?.size)return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:i});const l=Array.from(o).map(async f=>f(n.origin,s)),u=await M3(l);n.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:u})}_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)}}Km.receivers=[];function mw(t="",e=10){let n="";for(let r=0;r<e;r++)n+=Math.floor(Math.random()*10);return t+n}class N3{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((l,u)=>{const f=mw("",20);i.port1.start();const h=setTimeout(()=>{u(new Error("unsupported_event"))},r);o={messageChannel:i,onMessage(m){const g=m;if(g.data.eventId===f)switch(g.data.status){case"ack":clearTimeout(h),s=setTimeout(()=>{u(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),l(g.data.response);break;default:clearTimeout(h),clearTimeout(s),u(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:f,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}function Li(){return window}function O3(t){Li().location.href=t}function bN(){return typeof Li().WorkerGlobalScope<"u"&&typeof Li().importScripts=="function"}async function D3(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function I3(){return navigator?.serviceWorker?.controller||null}function j3(){return bN()?self:null}const vN="firebaseLocalStorageDb",L3=1,Ip="firebaseLocalStorage",xN="fbase_key";class ef{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 Zm(t,e){return t.transaction([Ip],e?"readwrite":"readonly").objectStore(Ip)}function P3(){const t=indexedDB.deleteDatabase(vN);return new ef(t).toPromise()}function wN(){const t=indexedDB.open(vN,L3);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const r=t.result;try{r.createObjectStore(Ip,{keyPath:xN})}catch(i){n(i)}}),t.addEventListener("success",async()=>{const r=t.result;r.objectStoreNames.contains(Ip)?e(r):(r.close(),await P3(),e(await wN()))})})}async function zT(t,e,n){const r=Zm(t,!0).put({[xN]:e,value:n});return new ef(r).toPromise()}async function z3(t,e){const n=Zm(t,!1).get(e),r=await new ef(n).toPromise();return r===void 0?null:r.value}function $T(t,e){const n=Zm(t,!0).delete(e);return new ef(n).toPromise()}const $3=800,B3=3;class SN{registerLifecycleListeners(){typeof window<"u"&&typeof window.addEventListener=="function"&&(window.addEventListener("pagehide",this.onPageHide),window.addEventListener("pageshow",this.onPageShow)),typeof document<"u"&&typeof document.addEventListener=="function"&&document.addEventListener("visibilitychange",this.onVisibilityChange)}unregisterLifecycleListeners(){typeof window<"u"&&typeof window.removeEventListener=="function"&&(window.removeEventListener("pagehide",this.onPageHide),window.removeEventListener("pageshow",this.onPageShow)),typeof document<"u"&&typeof document.removeEventListener=="function"&&document.removeEventListener("visibilitychange",this.onVisibilityChange)}constructor(){this.type="LOCAL",this.dbPromise=null,this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.isHiding=!1,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this.onPageHide=()=>{this.isHiding=!0,this.stopPolling(),this.dbPromise&&(this.dbPromise.then(e=>e.close()).catch(()=>{}),this.dbPromise=null)},this.onPageShow=()=>{this.isHiding&&(this.isHiding=!1,Object.keys(this.listeners).length>0&&this.startPolling())},this.onVisibilityChange=()=>{typeof document<"u"&&(document.visibilityState==="hidden"?this.onPageHide():document.visibilityState==="visible"&&this.onPageShow())},this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){if(this.isHiding)throw new Error("Database is closing/hidden");return this.dbPromise?this.dbPromise:(this.dbPromise=wN(),this.dbPromise.catch(()=>{this.dbPromise=null}),this.dbPromise)}async _withRetries(e){let n=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(this.isHiding||n++>B3)throw r;this.dbPromise&&((await this.dbPromise).close(),this.dbPromise=null)}}async initializeServiceWorkerMessaging(){return bN()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Km._getInstance(j3()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await D3(),!this.activeServiceWorker)return;this.sender=new N3(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&e[0]?.fulfilled&&e[0]?.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||I3()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{return indexedDB?(await this._withRetries(async e=>{await zT(e,Dp,"1"),await $T(e,Dp)}),!0):!1}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=>zT(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){const n=await this._withRetries(r=>z3(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>$T(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){if(this.isHiding)return[];try{const e=await this._withRetries(i=>{const s=Zm(i,!1).getAll();return new ef(s).toPromise()});if(this.isHiding)return[];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}catch(e){return this.isHiding||KM(`Firebase Auth cross-tab polling failed with error: ${e}`),[]}}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(),$3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.startPolling(),this.registerLifecycleListeners()),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(),this.unregisterLifecycleListeners())}}SN.type="LOCAL";const V3=SN;new Jd(3e4,6e4);function kN(t,e){return e?Ss(e):(We(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}class gw extends fw{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return dc(e,this._buildIdpRequest())}_linkToIdToken(e,n){return dc(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return dc(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 H3(t){return hN(t.auth,new gw(t),t.bypassAuthState)}function U3(t){const{auth:e,user:n}=t;return We(n,e,"internal-error"),x3(n,new gw(t),t.bypassAuthState)}async function F3(t){const{auth:e,user:n}=t;return We(n,e,"internal-error"),v3(n,new gw(t),t.bypassAuthState)}class CN{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:l}=e;if(o){this.reject(o);return}const u={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(l)(u))}catch(f){this.reject(f)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return H3;case"linkViaPopup":case"linkViaRedirect":return F3;case"reauthViaPopup":case"reauthViaRedirect":return U3;default:ri(this.auth,"internal-error")}}resolve(e){Ds(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Ds(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()}}const q3=new Jd(2e3,1e4);async function G3(t,e,n){if(pi(t.app))return Promise.reject(vi(t,"operation-not-supported-in-this-environment"));const r=el(t);AB(t,e,pw);const i=kN(r,n);return new Ta(r,"signInViaPopup",e,i).executeNotNull()}class Ta extends CN{constructor(e,n,r,i,s){super(e,n,i,s),this.provider=r,this.authWindow=null,this.pollId=null,Ta.currentPopupAction&&Ta.currentPopupAction.cancel(),Ta.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return We(e,this.auth,"internal-error"),e}async onExecution(){Ds(this.filter.length===1,"Popup operations only handle one event");const e=mw();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(vi(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(vi(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Ta.currentPopupAction=null}pollUserCancellation(){const e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(vi(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,q3.get())};e()}}Ta.currentPopupAction=null;const W3="pendingRedirect",fp=new Map;class K3 extends CN{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=fp.get(this.auth._key());if(!e){try{const r=await Z3(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}fp.set(this.auth._key(),e)}return this.bypassAuthState||fp.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 Z3(t,e){const n=J3(e),r=X3(t);if(!await r._isAvailable())return!1;const i=await r._get(n)==="true";return await r._remove(n),i}function Y3(t,e){fp.set(t._key(),e)}function X3(t){return Ss(t._redirectPersistence)}function J3(t){return dp(W3,t.config.apiKey,t.name)}async function Q3(t,e,n=!1){if(pi(t.app))return Promise.reject(No(t));const r=el(t),i=kN(r,e),o=await new K3(r,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}const eV=600*1e3;class tV{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||!nV(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){if(e.error&&!EN(e)){const r=e.error.code?.split("auth/")[1]||"internal-error";n.onError(vi(this.auth,r))}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>=eV&&this.cachedEventUids.clear(),this.cachedEventUids.has(BT(e))}saveEventToCache(e){this.cachedEventUids.add(BT(e)),this.lastProcessedEventTime=Date.now()}}function BT(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function EN({type:t,error:e}){return t==="unknown"&&e?.code==="auth/no-auth-event"}function nV(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return EN(t);default:return!1}}async function rV(t,e={}){return Zo(t,"GET","/v1/projects",e)}const iV=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,sV=/^https?/;async function oV(t){if(t.config.emulator)return;const{authorizedDomains:e}=await rV(t);for(const n of e)try{if(aV(n))return}catch{}ri(t,"unauthorized-domain")}function aV(t){const e=_0(),{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(!sV.test(n))return!1;if(iV.test(t))return r===t;const i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}const lV=new Jd(3e4,6e4);function VT(){const t=Li().___jsl;if(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 cV(t){return new Promise((e,n)=>{function r(){VT(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{VT(),n(vi(t,"network-request-failed"))},timeout:lV.get()})}if(Li().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(Li().gapi?.load)r();else{const i=r3("iframefcb");return Li()[i]=()=>{gapi.load?r():n(vi(t,"network-request-failed"))},cN(`${n3()}?onload=${i}`).catch(s=>n(s))}}).catch(e=>{throw hp=null,e})}let hp=null;function uV(t){return hp=hp||cV(t),hp}const dV=new Jd(5e3,15e3),fV="__/auth/iframe",hV="emulator/auth/iframe",pV={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},mV=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function gV(t){const e=t.config;We(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?cw(e,hV):`https://${t.config.authDomain}/${fV}`,r={apiKey:e.apiKey,appName:t.name,v:Xd},i=mV.get(t.config.apiHost);i&&(r.eid=i);const s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${Yd(r).slice(1)}`}async function yV(t){const e=await uV(t),n=Li().gapi;return We(n,t,"internal-error"),e.open({where:document.body,url:gV(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:pV,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});const o=vi(t,"network-request-failed"),l=Li().setTimeout(()=>{s(o)},dV.get());function u(){Li().clearTimeout(l),i(r)}r.ping(u).then(u,()=>{s(o)})}))}const bV={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},vV=500,xV=600,wV="_blank",SV="http://localhost";class HT{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function kV(t,e,n,r=vV,i=xV){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let l="";const u={...bV,width:r.toString(),height:i.toString(),top:s,left:o},f=sr().toLowerCase();n&&(l=nN(f)?wV:n),eN(f)&&(e=e||SV,u.scrollbars="yes");const h=Object.entries(u).reduce((g,[b,x])=>`${g}${b}=${x},`,"");if(WB(f)&&l!=="_self")return CV(e||"",l),new HT(null);const m=window.open(e||"",l,h);We(m,t,"popup-blocked");try{m.focus()}catch{}return new HT(m)}function CV(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)}const EV="__/auth/handler",TV="emulator/auth/handler",_V=encodeURIComponent("fac");async function UT(t,e,n,r,i,s){We(t.config.authDomain,t,"auth-domain-config-required"),We(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Xd,eventId:i};if(e instanceof pw){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",d$(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[h,m]of Object.entries({}))o[h]=m}if(e instanceof Qd){const h=e.getScopes().filter(m=>m!=="");h.length>0&&(o.scopes=h.join(","))}t.tenantId&&(o.tid=t.tenantId);const l=o;for(const h of Object.keys(l))l[h]===void 0&&delete l[h];const u=await t._getAppCheckToken(),f=u?`#${_V}=${encodeURIComponent(u)}`:"";return`${AV(t)}?${Yd(l).slice(1)}${f}`}function AV({config:t}){return t.emulator?cw(t,TV):`https://${t.authDomain}/${EV}`}const fv="webStorageSupport";class RV{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=yN,this._completeRedirectFn=Q3,this._overrideRedirectResult=Y3}async _openPopup(e,n,r,i){Ds(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");const s=await UT(e,n,r,_0(),i);return kV(e,s,mw())}async _openRedirect(e,n,r,i){await this._originValidation(e);const s=await UT(e,n,r,_0(),i);return O3(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):(Ds(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 yV(e),r=new tV(e);return n.register("authEvent",i=>(We(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(fv,{type:fv},i=>{const s=i?.[0]?.[fv];s!==void 0&&n(!!s),ri(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=oV(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return aN()||tN()||dw()}}const MV=RV;var FT="@firebase/auth",qT="1.13.4";class NV{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.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?.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(){We(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}function OV(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 DV(t){Td(new yc("auth",(e,{options:n})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:l}=r.options;We(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const u={apiKey:o,authDomain:l,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:lN(t)},f=new QB(r,i,s,u);return l3(f,n),f},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),Td(new yc("auth-internal",e=>{const n=el(e.getProvider("auth").getImmediate());return(r=>new NV(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),lc(FT,qT,OV(t)),lc(FT,qT,"esm2020")}const IV=300,jV=LM("authIdTokenMaxAge")||IV;let GT=null;const LV=t=>async e=>{const n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>jV)return;const i=n?.token;GT!==i&&(GT=i,await fetch(t,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function PV(t=UM()){const e=VM(t,"auth");if(e.isInitialized())return e.getImmediate();const n=a3(t,{popupRedirectResolver:MV,persistence:[V3,R3,yN]}),r=LM("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const s=new URL(r,location.origin);if(location.origin===s.origin){const o=LV(s.toString());E3(n,o,()=>o(n.currentUser)),C3(n,l=>o(l))}}const i=t$("auth");return i&&c3(n,`http://${i}`),n}function zV(){return document.getElementsByTagName("head")?.[0]??document}e3({loadJS(t){return new Promise((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=i=>{const s=vi("internal-error");s.customData=i,n(s)},r.type="text/javascript",r.charset="UTF-8",zV().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="});DV("Browser");function $V(t=6e4){const e=new Map,n=new Map;function r(o,l,u){if(!u?.fresh){const h=e.get(o);if(h&&Date.now()-h.at<t)return Promise.resolve(h.value);const m=n.get(o);if(m)return m}const f=l().then(h=>(e.set(o,{value:h,at:Date.now()}),n.delete(o),h)).catch(h=>{throw n.delete(o),h});return n.set(o,f),f}function i(o,l){e.set(o,{value:l,at:Date.now()})}function s(o){if(!o){e.clear(),n.clear();return}for(const l of[...e.keys()])(l===o||l.startsWith(`${o}:`))&&e.delete(l);for(const l of[...n.keys()])(l===o||l.startsWith(`${o}:`))&&n.delete(l)}return{get:r,set:i,invalidate:s}}const BV="x-vertebr-env";async function Pu(t,e){const n=await t.arrayBuffer(),r=new Uint8Array(n);let i="";const s=32768;for(let l=0;l<r.length;l+=s)i+=String.fromCharCode(...r.subarray(l,l+s));return{name:e||typeof File<"u"&&t instanceof File&&t.name||"upload",type:t.type||"application/octet-stream",data:btoa(i)}}function R0(t,e){const n=typeof t=="string"?{apiBase:t,getEnvironment:(()=>"")}:t,r=n.apiBase.replace(/\/$/,""),i=$V(n.cacheTtlMs??6e4);async function s(o,l,u){const f=n.getEnvironment().trim(),m=(await n.getAccessToken?.())?.trim(),g=await fetch(`${r}${o}`,{...l,headers:{Accept:"application/json","Content-Type":"application/json",...f?{[BV]:f}:{},...u?.auth!==!1&&m?{Authorization:`Bearer ${m}`}:{},...l?.headers??{}}});if(!g.ok){const b=await g.text();let x=b||`Request failed (${g.status})`;try{const S=JSON.parse(b);typeof S.error=="string"&&S.error.trim()?x=S.error:S.error&&typeof S.error=="object"&&typeof S.error.message=="string"&&S.error.message.trim()?x=S.error.message:typeof S.message=="string"&&S.message.trim()&&(x=S.message)}catch{}throw new Error(x)}return await g.json()}return{getBootstrap:o=>i.get("bootstrap",()=>s("/bootstrap",void 0,{auth:!1}),o),getCatalog:o=>i.get("catalog",()=>s(""),o),getMetrics:o=>{const l=o?.range?.trim()||"14d";return i.get(`metrics:${l}`,()=>s(`/metrics?range=${encodeURIComponent(l)}`),o)},getPublicControls:o=>i.get("controls",async()=>(await s("/public/controls",void 0,{auth:!1})).configs??{},o),getPublicResource:(o,l)=>i.get(`public-resource:${o}`,()=>s(`/public/resources/${encodeURIComponent(o)}`,void 0,{auth:!1}),l),listResource:(o,l)=>i.get(`resource:${o}`,()=>s(`/resources/${encodeURIComponent(o)}`),l),createResource:async(o,l)=>{const u=await s(`/resources/${encodeURIComponent(o)}`,{method:"POST",body:JSON.stringify(l)});return i.invalidate(`resource:${o}`),i.invalidate(`public-resource:${o}`),u},updateResource:async(o,l,u)=>{const f=await s(`/resources/${encodeURIComponent(o)}/${encodeURIComponent(l)}`,{method:"PUT",body:JSON.stringify(u)});return i.invalidate(`resource:${o}`),i.invalidate(`public-resource:${o}`),f},deleteResource:async(o,l)=>{const u=await s(`/resources/${encodeURIComponent(o)}/${encodeURIComponent(l)}`,{method:"DELETE"});return i.invalidate(`resource:${o}`),i.invalidate(`public-resource:${o}`),u},runResourceAction:async(o,l,u,f)=>{const h=await s(`/resources/${encodeURIComponent(o)}/${encodeURIComponent(l)}/actions/${encodeURIComponent(u)}`,{method:"POST",body:JSON.stringify(f??{})});return i.invalidate(`resource:${o}`),i.invalidate(`public-resource:${o}`),h},runCollectionAction:async(o,l,u)=>{const f=await s(`/resources/${encodeURIComponent(o)}/collection-actions/${encodeURIComponent(l)}`,{method:"POST",body:JSON.stringify(u??{})});return i.invalidate(`resource:${o}`),i.invalidate(`public-resource:${o}`),f},previewResourceMail:async(o,l,u,f)=>s(`/resources/${encodeURIComponent(o)}/${encodeURIComponent(l)}/mail/${encodeURIComponent(u)}/preview`,{method:"POST",body:JSON.stringify(f??{})}),getEmails:o=>i.get("emails",()=>s("/emails"),o),previewEmails:async o=>s("/emails/preview",{method:"POST",body:JSON.stringify(o)}),sendEmails:async o=>{const l=await s("/emails/send",{method:"POST",body:JSON.stringify(o)});return i.invalidate("emails"),i.invalidate(`resource:${o.resourceId}`),l},scheduleEmails:async o=>{const l=await s("/emails/schedule",{method:"POST",body:JSON.stringify(o)});return i.invalidate("emails"),l},cancelEmailCampaign:async o=>{const l=await s(`/emails/campaigns/${encodeURIComponent(o)}`,{method:"DELETE"});return i.invalidate("emails"),l},saveEmailLibraryTemplate:async o=>{const l=await s("/emails/library",{method:"POST",body:JSON.stringify(o)});return i.invalidate("emails"),l},deleteEmailLibraryTemplate:async o=>{const l=await s(`/emails/library/${encodeURIComponent(o)}`,{method:"DELETE"});return i.invalidate("emails"),l},uploadResourceFile:async(o,l,u,f)=>{const h=await Pu(u,f);return s(`/resources/${encodeURIComponent(o)}/uploads/${encodeURIComponent(l)}`,{method:"POST",body:JSON.stringify(h)})},uploadResourceFiles:async(o,l,u)=>{const f={files:await Promise.all(u.map(h=>Pu(h)))};return s(`/resources/${encodeURIComponent(o)}/uploads/${encodeURIComponent(l)}/bulk`,{method:"POST",body:JSON.stringify(f)})},getGallery:o=>i.get("gallery",()=>s("/gallery"),o),uploadGalleryFile:async(o,l)=>{const u=await Pu(o,l),f=await s("/gallery/upload",{method:"POST",body:JSON.stringify(u)});return i.invalidate("gallery"),f},uploadGalleryFiles:async o=>{const l={files:await Promise.all(o.map(f=>Pu(f)))},u=await s("/gallery/upload/bulk",{method:"POST",body:JSON.stringify(l)});return i.invalidate("gallery"),u},deleteGalleryItem:async o=>{const l=await s(`/gallery/${encodeURIComponent(o)}`,{method:"DELETE"});return i.invalidate("gallery"),l},getFonts:o=>i.get("fonts",()=>s("/fonts"),o),getPublicFonts:async o=>{const l=o?.ids?.map(m=>m.trim()).filter(Boolean),u=l?.length?`?ids=${l.map(m=>encodeURIComponent(m)).join(",")}`:"",f=l?.length?`public:fonts:${[...l].sort().join(",")}`:"public:fonts";return(await i.get(f,()=>s(`/public/fonts${u}`),o)).items},uploadFontFile:async(o,l,u)=>{const f={...await Pu(o,u),...l?.family?{family:l.family}:{},...l?.label?{label:l.label}:{},...l?.weight!=null?{weight:l.weight}:{}},h=await s("/fonts/upload",{method:"POST",body:JSON.stringify(f)});return i.invalidate("fonts"),i.invalidate("public:fonts"),h},importGoogleFont:async o=>{const l=await s("/fonts/import-google",{method:"POST",body:JSON.stringify(o)});return i.invalidate("fonts"),i.invalidate("public:fonts"),l},deleteFontItem:async o=>{const l=await s(`/fonts/${encodeURIComponent(o)}`,{method:"DELETE"});return i.invalidate("fonts"),i.invalidate("public:fonts"),l},getConfig:(o,l)=>i.get(`config:${o}`,()=>s(`/configs/${encodeURIComponent(o)}`),l),setConfig:async(o,l)=>{const u=await s(`/configs/${encodeURIComponent(o)}`,{method:"PUT",body:JSON.stringify(l)}),f={id:u.id,label:u.label,schema:u.schema??{},environment:u.environment,value:u.value};return i.set(`config:${o}`,f),i.invalidate("controls"),i.invalidate("public:controls"),i.invalidate("public:fonts"),f},invalidateCache:o=>i.invalidate(o)}}function yw(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var tl=yw();function TN(t){tl=t}var ld={exec:()=>null};function St(t,e=""){let n=typeof t=="string"?t:t.source;const r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(tr.caret,"$1"),n=n.replace(i,o),r},getRegex:()=>new RegExp(n,e)};return r}var tr={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},VV=/^(?:[ \t]*(?:\n|$))+/,HV=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,UV=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,tf=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,FV=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,bw=/(?:[*+-]|\d{1,9}[.)])/,_N=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,AN=St(_N).replace(/bull/g,bw).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),qV=St(_N).replace(/bull/g,bw).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),vw=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,GV=/^[^\n]+/,xw=/(?!\s*\])(?:\\.|[^\[\]\\])+/,WV=St(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",xw).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),KV=St(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,bw).getRegex(),Ym="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ww=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ZV=St("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ww).replace("tag",Ym).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),RN=St(vw).replace("hr",tf).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ym).getRegex(),YV=St(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",RN).getRegex(),Sw={blockquote:YV,code:HV,def:WV,fences:UV,heading:FV,hr:tf,html:ZV,lheading:AN,list:KV,newline:VV,paragraph:RN,table:ld,text:GV},WT=St("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",tf).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ym).getRegex(),XV={...Sw,lheading:qV,table:WT,paragraph:St(vw).replace("hr",tf).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",WT).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ym).getRegex()},JV={...Sw,html:St(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ww).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ld,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:St(vw).replace("hr",tf).replace("heading",` *#{1,6} *[^
10
- ]`).replace("lheading",AN).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},QV=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,eH=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,MN=/^( {2,}|\\)\n(?!\s*$)/,tH=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Xm=/[\p{P}\p{S}]/u,kw=/[\s\p{P}\p{S}]/u,NN=/[^\s\p{P}\p{S}]/u,nH=St(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,kw).getRegex(),ON=/(?!~)[\p{P}\p{S}]/u,rH=/(?!~)[\s\p{P}\p{S}]/u,iH=/(?:[^\s\p{P}\p{S}]|~)/u,sH=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,DN=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,oH=St(DN,"u").replace(/punct/g,Xm).getRegex(),aH=St(DN,"u").replace(/punct/g,ON).getRegex(),IN="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",lH=St(IN,"gu").replace(/notPunctSpace/g,NN).replace(/punctSpace/g,kw).replace(/punct/g,Xm).getRegex(),cH=St(IN,"gu").replace(/notPunctSpace/g,iH).replace(/punctSpace/g,rH).replace(/punct/g,ON).getRegex(),uH=St("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,NN).replace(/punctSpace/g,kw).replace(/punct/g,Xm).getRegex(),dH=St(/\\(punct)/,"gu").replace(/punct/g,Xm).getRegex(),fH=St(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),hH=St(ww).replace("(?:-->|$)","-->").getRegex(),pH=St("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",hH).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),jp=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,mH=St(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",jp).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),jN=St(/^!?\[(label)\]\[(ref)\]/).replace("label",jp).replace("ref",xw).getRegex(),LN=St(/^!?\[(ref)\](?:\[\])?/).replace("ref",xw).getRegex(),gH=St("reflink|nolink(?!\\()","g").replace("reflink",jN).replace("nolink",LN).getRegex(),Cw={_backpedal:ld,anyPunctuation:dH,autolink:fH,blockSkip:sH,br:MN,code:eH,del:ld,emStrongLDelim:oH,emStrongRDelimAst:lH,emStrongRDelimUnd:uH,escape:QV,link:mH,nolink:LN,punctuation:nH,reflink:jN,reflinkSearch:gH,tag:pH,text:tH,url:ld},yH={...Cw,link:St(/^!?\[(label)\]\((.*?)\)/).replace("label",jp).getRegex(),reflink:St(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",jp).getRegex()},M0={...Cw,emStrongRDelimAst:cH,emStrongLDelim:aH,url:St(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},bH={...M0,br:St(MN).replace("{2,}","*").getRegex(),text:St(M0.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ah={normal:Sw,gfm:XV,pedantic:JV},zu={normal:Cw,gfm:M0,breaks:bH,pedantic:yH},vH={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},KT=t=>vH[t];function Ai(t,e){if(e){if(tr.escapeTest.test(t))return t.replace(tr.escapeReplace,KT)}else if(tr.escapeTestNoEncode.test(t))return t.replace(tr.escapeReplaceNoEncode,KT);return t}function ZT(t){try{t=encodeURI(t).replace(tr.percentDecode,"%")}catch{return null}return t}function YT(t,e){const n=t.replace(tr.findPipe,(s,o,l)=>{let u=!1,f=o;for(;--f>=0&&l[f]==="\\";)u=!u;return u?"|":" |"}),r=n.split(tr.splitPipe);let i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(tr.slashPipe,"|");return r}function $u(t,e,n){const r=t.length;if(r===0)return"";let i=0;for(;i<r&&t.charAt(r-i-1)===e;)i++;return t.slice(0,r-i)}function xH(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function XT(t,e,n,r,i){const s=e.href,o=e.title||null,l=t[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;const u={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:o,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,u}function wH(t,e,n){const r=t.match(n.other.indentCodeCompensation);if(r===null)return e;const i=r[1];return e.split(`
11
- `).map(s=>{const o=s.match(n.other.beginningSpace);if(o===null)return s;const[l]=o;return l.length>=i.length?s.slice(i.length):s}).join(`
12
- `)}var Lp=class{options;rules;lexer;constructor(t){this.options=t||tl}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:$u(n,`
13
- `)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const n=e[0],r=wH(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){const r=$u(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:$u(e[0],`
14
- `)}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let n=$u(e[0],`
15
- `).split(`
16
- `),r="",i="";const s=[];for(;n.length>0;){let o=!1;const l=[];let u;for(u=0;u<n.length;u++)if(this.rules.other.blockquoteStart.test(n[u]))l.push(n[u]),o=!0;else if(!o)l.push(n[u]);else break;n=n.slice(u);const f=l.join(`
17
- `),h=f.replace(this.rules.other.blockquoteSetextReplace,`
18
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
19
- ${f}`:f,i=i?`${i}
20
- ${h}`:h;const m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,s,!0),this.lexer.state.top=m,n.length===0)break;const g=s.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){const b=g,x=b.raw+`
21
- `+n.join(`
22
- `),S=this.blockquote(x);s[s.length-1]=S,r=r.substring(0,r.length-b.raw.length)+S.raw,i=i.substring(0,i.length-b.text.length)+S.text;break}else if(g?.type==="list"){const b=g,x=b.raw+`
23
- `+n.join(`
24
- `),S=this.list(x);s[s.length-1]=S,r=r.substring(0,r.length-g.raw.length)+S.raw,i=i.substring(0,i.length-b.raw.length)+S.raw,n=x.substring(s.at(-1).raw.length).split(`
25
- `);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim();const r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");const s=this.rules.other.listItemRegex(n);let o=!1;for(;t;){let u=!1,f="",h="";if(!(e=s.exec(t))||this.rules.block.hr.test(t))break;f=e[0],t=t.substring(f.length);let m=e[2].split(`
26
- `,1)[0].replace(this.rules.other.listReplaceTabs,C=>" ".repeat(3*C.length)),g=t.split(`
27
- `,1)[0],b=!m.trim(),x=0;if(this.options.pedantic?(x=2,h=m.trimStart()):b?x=e[1].length+1:(x=e[2].search(this.rules.other.nonSpaceChar),x=x>4?1:x,h=m.slice(x),x+=e[1].length),b&&this.rules.other.blankLine.test(g)&&(f+=g+`
28
- `,t=t.substring(g.length+1),u=!0),!u){const C=this.rules.other.nextBulletRegex(x),_=this.rules.other.hrRegex(x),M=this.rules.other.fencesBeginRegex(x),R=this.rules.other.headingBeginRegex(x),A=this.rules.other.htmlBeginRegex(x);for(;t;){const O=t.split(`
29
- `,1)[0];let D;if(g=O,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),D=g):D=g.replace(this.rules.other.tabCharGlobal," "),M.test(g)||R.test(g)||A.test(g)||C.test(g)||_.test(g))break;if(D.search(this.rules.other.nonSpaceChar)>=x||!g.trim())h+=`
30
- `+D.slice(x);else{if(b||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||M.test(m)||R.test(m)||_.test(m))break;h+=`
31
- `+g}!b&&!g.trim()&&(b=!0),f+=O+`
32
- `,t=t.substring(O.length+1),m=D.slice(x)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(o=!0));let S=null,k;this.options.gfm&&(S=this.rules.other.listIsTask.exec(h),S&&(k=S[0]!=="[ ] ",h=h.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:f,task:!!S,checked:k,loose:!1,text:h,tokens:[]}),i.raw+=f}const l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let u=0;u<i.items.length;u++)if(this.lexer.state.top=!1,i.items[u].tokens=this.lexer.blockTokens(i.items[u].text,[]),!i.loose){const f=i.items[u].tokens.filter(m=>m.type==="space"),h=f.length>0&&f.some(m=>this.rules.other.anyLine.test(m.raw));i.loose=h}if(i.loose)for(let u=0;u<i.items.length;u++)i.items[u].loose=!0;return i}}html(t){const e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){const e=this.rules.block.def.exec(t);if(e){const n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:r,title:i}}}table(t){const e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const n=YT(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
33
- `):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(const o of r)this.rules.other.tableAlignRight.test(o)?s.align.push("right"):this.rules.other.tableAlignCenter.test(o)?s.align.push("center"):this.rules.other.tableAlignLeft.test(o)?s.align.push("left"):s.align.push(null);for(let o=0;o<n.length;o++)s.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:s.align[o]});for(const o of i)s.rows.push(YT(o,s.header.length).map((l,u)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:s.align[u]})));return s}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const n=e[1].charAt(e[1].length-1)===`
34
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;const s=$u(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{const s=xH(e[2],"()");if(s===-2)return;if(s>-1){const l=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){const s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),XT(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){const r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[r.toLowerCase()];if(!i){const s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return XT(n,i,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const s=[...r[0]].length-1;let o,l,u=s,f=0;const h=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*t.length+s);(r=h.exec(e))!=null;){if(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!o)continue;if(l=[...o].length,r[3]||r[4]){u+=l;continue}else if((r[5]||r[6])&&s%3&&!((s+l)%3)){f+=l;continue}if(u-=l,u>0)continue;l=Math.min(l,l+u+f);const m=[...r[0]][0].length,g=t.slice(0,s+r.index+m+l);if(Math.min(s,l)%2){const x=g.slice(1,-1);return{type:"em",raw:g,text:x,tokens:this.lexer.inlineTokens(x)}}const b=g.slice(2,-2);return{type:"strong",raw:g,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," ");const r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){const e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let n,r;if(e[2]==="@")n=e[0],r="mailto:"+n;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);n=e[0],e[1]==="www."?r="http://"+e[0]:r=e[0]}return{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){const e=this.rules.inline.text.exec(t);if(e){const n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},ks=class N0{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||tl,this.options.tokenizer=this.options.tokenizer||new Lp,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={other:tr,block:Ah.normal,inline:zu.normal};this.options.pedantic?(n.block=Ah.pedantic,n.inline=zu.pedantic):this.options.gfm&&(n.block=Ah.gfm,this.options.breaks?n.inline=zu.breaks:n.inline=zu.gfm),this.tokenizer.rules=n}static get rules(){return{block:Ah,inline:zu}}static lex(e,n){return new N0(n).lex(e)}static lexInline(e,n){return new N0(n).inlineTokens(e)}lex(e){e=e.replace(tr.carriageReturn,`
35
- `),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){const r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],r=!1){for(this.options.pedantic&&(e=e.replace(tr.tabCharGlobal," ").replace(tr.spaceLine,""));e;){let i;if(this.options.extensions?.block?.some(o=>(i=o.call({lexer:this},e,n))?(e=e.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);const o=n.at(-1);i.raw.length===1&&o!==void 0?o.raw+=`
36
- `:n.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);const o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=`
37
- `+i.raw,o.text+=`
38
- `+i.text,this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);const o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=`
39
- `+i.raw,o.text+=`
40
- `+i.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title});continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),n.push(i);continue}let s=e;if(this.options.extensions?.startBlock){let o=1/0;const l=e.slice(1);let u;this.options.extensions.startBlock.forEach(f=>{u=f.call({lexer:this},l),typeof u=="number"&&u>=0&&(o=Math.min(o,u))}),o<1/0&&o>=0&&(s=e.substring(0,o+1))}if(this.state.top&&(i=this.tokenizer.paragraph(s))){const o=n.at(-1);r&&o?.type==="paragraph"?(o.raw+=`
41
- `+i.raw,o.text+=`
42
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i),r=s.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);const o=n.at(-1);o?.type==="text"?(o.raw+=`
43
- `+i.raw,o.text+=`
44
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(e){const o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){let r=e,i=null;if(this.tokens.links){const l=Object.keys(this.tokens.links);if(l.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)l.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let s=!1,o="";for(;e;){s||(o=""),s=!1;let l;if(this.options.extensions?.inline?.some(f=>(l=f.call({lexer:this},e,n))?(e=e.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);const f=n.at(-1);l.type==="text"&&f?.type==="text"?(f.raw+=l.raw,f.text+=l.text):n.push(l);continue}if(l=this.tokenizer.emStrong(e,r,o)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.del(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),n.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),n.push(l);continue}let u=e;if(this.options.extensions?.startInline){let f=1/0;const h=e.slice(1);let m;this.options.extensions.startInline.forEach(g=>{m=g.call({lexer:this},h),typeof m=="number"&&m>=0&&(f=Math.min(f,m))}),f<1/0&&f>=0&&(u=e.substring(0,f+1))}if(l=this.tokenizer.inlineText(u)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(o=l.raw.slice(-1)),s=!0;const f=n.at(-1);f?.type==="text"?(f.raw+=l.raw,f.text+=l.text):n.push(l);continue}if(e){const f="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(f);break}else throw new Error(f)}}return n}},Md=class{options;parser;constructor(t){this.options=t||tl}space(t){return""}code({text:t,lang:e,escaped:n}){const r=(e||"").match(tr.notSpaceStart)?.[0],i=t.replace(tr.endingNewline,"")+`
45
- `;return r?'<pre><code class="language-'+Ai(r)+'">'+(n?i:Ai(i,!0))+`</code></pre>
46
- `:"<pre><code>"+(n?i:Ai(i,!0))+`</code></pre>
47
- `}blockquote({tokens:t}){return`<blockquote>
48
- ${this.parser.parse(t)}</blockquote>
49
- `}html({text:t}){return t}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
50
- `}hr(t){return`<hr>
51
- `}list(t){const e=t.ordered,n=t.start;let r="";for(let o=0;o<t.items.length;o++){const l=t.items[o];r+=this.listitem(l)}const i=e?"ol":"ul",s=e&&n!==1?' start="'+n+'"':"";return"<"+i+s+`>
52
- `+r+"</"+i+`>
53
- `}listitem(t){let e="";if(t.task){const n=this.checkbox({checked:!!t.checked});t.loose?t.tokens[0]?.type==="paragraph"?(t.tokens[0].text=n+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=n+" "+Ai(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):e+=n+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`<li>${e}</li>
54
- `}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
55
- `}table(t){let e="",n="";for(let i=0;i<t.header.length;i++)n+=this.tablecell(t.header[i]);e+=this.tablerow({text:n});let r="";for(let i=0;i<t.rows.length;i++){const s=t.rows[i];n="";for(let o=0;o<s.length;o++)n+=this.tablecell(s[o]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
56
- <thead>
57
- `+e+`</thead>
58
- `+r+`</table>
59
- `}tablerow({text:t}){return`<tr>
60
- ${t}</tr>
61
- `}tablecell(t){const e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
62
- `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Ai(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){const r=this.parser.parseInline(n),i=ZT(t);if(i===null)return r;t=i;let s='<a href="'+t+'"';return e&&(s+=' title="'+Ai(e)+'"'),s+=">"+r+"</a>",s}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));const i=ZT(t);if(i===null)return Ai(n);t=i;let s=`<img src="${t}" alt="${n}"`;return e&&(s+=` title="${Ai(e)}"`),s+=">",s}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Ai(t.text)}},Ew=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},Cs=class O0{options;renderer;textRenderer;constructor(e){this.options=e||tl,this.options.renderer=this.options.renderer||new Md,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ew}static parse(e,n){return new O0(n).parse(e)}static parseInline(e,n){return new O0(n).parseInline(e)}parse(e,n=!0){let r="";for(let i=0;i<e.length;i++){const s=e[i];if(this.options.extensions?.renderers?.[s.type]){const l=s,u=this.options.extensions.renderers[l.type].call({parser:this},l);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(l.type)){r+=u||"";continue}}const o=s;switch(o.type){case"space":{r+=this.renderer.space(o);continue}case"hr":{r+=this.renderer.hr(o);continue}case"heading":{r+=this.renderer.heading(o);continue}case"code":{r+=this.renderer.code(o);continue}case"table":{r+=this.renderer.table(o);continue}case"blockquote":{r+=this.renderer.blockquote(o);continue}case"list":{r+=this.renderer.list(o);continue}case"html":{r+=this.renderer.html(o);continue}case"paragraph":{r+=this.renderer.paragraph(o);continue}case"text":{let l=o,u=this.renderer.text(l);for(;i+1<e.length&&e[i+1].type==="text";)l=e[++i],u+=`
63
- `+this.renderer.text(l);n?r+=this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):r+=u;continue}default:{const l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}parseInline(e,n=this.renderer){let r="";for(let i=0;i<e.length;i++){const s=e[i];if(this.options.extensions?.renderers?.[s.type]){const l=this.options.extensions.renderers[s.type].call({parser:this},s);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){r+=l||"";continue}}const o=s;switch(o.type){case"escape":{r+=n.text(o);break}case"html":{r+=n.html(o);break}case"link":{r+=n.link(o);break}case"image":{r+=n.image(o);break}case"strong":{r+=n.strong(o);break}case"em":{r+=n.em(o);break}case"codespan":{r+=n.codespan(o);break}case"br":{r+=n.br(o);break}case"del":{r+=n.del(o);break}case"text":{r+=n.text(o);break}default:{const l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}},pp=class{options;block;constructor(t){this.options=t||tl}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?ks.lex:ks.lexInline}provideParser(){return this.block?Cs.parse:Cs.parseInline}},PN=class{defaults=yw();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Cs;Renderer=Md;TextRenderer=Ew;Lexer=ks;Tokenizer=Lp;Hooks=pp;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(const r of t)switch(n=n.concat(e.call(this,r)),r.type){case"table":{const i=r;for(const s of i.header)n=n.concat(this.walkTokens(s.tokens,e));for(const s of i.rows)for(const o of s)n=n.concat(this.walkTokens(o.tokens,e));break}case"list":{const i=r;n=n.concat(this.walkTokens(i.items,e));break}default:{const i=r;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(s=>{const o=i[s].flat(1/0);n=n.concat(this.walkTokens(o,e))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,e)))}}return n}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{const r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const s=e.renderers[i.name];s?e.renderers[i.name]=function(...o){let l=i.renderer.apply(this,o);return l===!1&&(l=s.apply(this,o)),l}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),n.renderer){const i=this.defaults.renderer||new Md(this.defaults);for(const s in n.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;const o=s,l=n.renderer[o],u=i[o];i[o]=(...f)=>{let h=l.apply(i,f);return h===!1&&(h=u.apply(i,f)),h||""}}r.renderer=i}if(n.tokenizer){const i=this.defaults.tokenizer||new Lp(this.defaults);for(const s in n.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;const o=s,l=n.tokenizer[o],u=i[o];i[o]=(...f)=>{let h=l.apply(i,f);return h===!1&&(h=u.apply(i,f)),h}}r.tokenizer=i}if(n.hooks){const i=this.defaults.hooks||new pp;for(const s in n.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;const o=s,l=n.hooks[o],u=i[o];pp.passThroughHooks.has(s)?i[o]=f=>{if(this.defaults.async)return Promise.resolve(l.call(i,f)).then(m=>u.call(i,m));const h=l.call(i,f);return u.call(i,h)}:i[o]=(...f)=>{let h=l.apply(i,f);return h===!1&&(h=u.apply(i,f)),h}}r.hooks=i}if(n.walkTokens){const i=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(o){let l=[];return l.push(s.call(this,o)),i&&(l=l.concat(i.call(this,o))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return ks.lex(t,e??this.defaults)}parser(t,e){return Cs.parse(t,e??this.defaults)}parseMarkdown(t){return(n,r)=>{const i={...r},s={...this.defaults,...i},o=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&i.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));s.hooks&&(s.hooks.options=s,s.hooks.block=t);const l=s.hooks?s.hooks.provideLexer():t?ks.lex:ks.lexInline,u=s.hooks?s.hooks.provideParser():t?Cs.parse:Cs.parseInline;if(s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(n):n).then(f=>l(f,s)).then(f=>s.hooks?s.hooks.processAllTokens(f):f).then(f=>s.walkTokens?Promise.all(this.walkTokens(f,s.walkTokens)).then(()=>f):f).then(f=>u(f,s)).then(f=>s.hooks?s.hooks.postprocess(f):f).catch(o);try{s.hooks&&(n=s.hooks.preprocess(n));let f=l(n,s);s.hooks&&(f=s.hooks.processAllTokens(f)),s.walkTokens&&this.walkTokens(f,s.walkTokens);let h=u(f,s);return s.hooks&&(h=s.hooks.postprocess(h)),h}catch(f){return o(f)}}}onError(t,e){return n=>{if(n.message+=`
64
- Please report this to https://github.com/markedjs/marked.`,t){const r="<p>An error occurred:</p><pre>"+Ai(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},$a=new PN;function Nt(t,e){return $a.parse(t,e)}Nt.options=Nt.setOptions=function(t){return $a.setOptions(t),Nt.defaults=$a.defaults,TN(Nt.defaults),Nt};Nt.getDefaults=yw;Nt.defaults=tl;Nt.use=function(...t){return $a.use(...t),Nt.defaults=$a.defaults,TN(Nt.defaults),Nt};Nt.walkTokens=function(t,e){return $a.walkTokens(t,e)};Nt.parseInline=$a.parseInline;Nt.Parser=Cs;Nt.parser=Cs.parse;Nt.Renderer=Md;Nt.TextRenderer=Ew;Nt.Lexer=ks;Nt.lexer=ks.lex;Nt.Tokenizer=Lp;Nt.Hooks=pp;Nt.parse=Nt;Nt.options;Nt.setOptions;Nt.use;Nt.walkTokens;Nt.parseInline;Cs.parse;ks.lex;function Bu(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function JT(t){const e=t.trim();return e?e.startsWith("//")?`https:${e}`:/^(https?:|mailto:|\/|#)/i.test(e)?e:null:null}class SH extends Md{html(){return""}link({href:e,title:n,tokens:r}){const i=this.parser.parseInline(r),s=JT(e);if(!s)return i;const o=n?` title="${Bu(n)}"`:"";return`<a href="${Bu(s)}"${o} rel="noopener noreferrer">${i}</a>`}image({href:e,title:n,text:r}){const i=JT(e);if(!i)return"";const s=n?` title="${Bu(n)}"`:"";return`<img src="${Bu(i)}" alt="${Bu(r)}"${s} loading="lazy" />`}}new PN({gfm:!0,breaks:!1,renderer:new SH});const kH="vertebrPreview",CH="vertebrControl",zN="vertebr",EH="vertebr:preview-draft",TH="vertebr:preview-ready";function _H(t,e={}){const n=e.origin??(typeof window<"u"?window.location.origin:""),r=t.trim()||"/",i=new URL((r.startsWith("http"),r),n||"http://localhost");return i.searchParams.set(kH,"1"),e.controlId?.trim()&&i.searchParams.set(CH,e.controlId.trim()),n?i.toString():`${i.pathname}${i.search}${i.hash}`}function AH(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function RH(t){return AH(t)?t.source===zN&&t.type===TH:!1}function MH(t,e,n,r="*"){if(!t||!e)return;const i={source:zN,type:EH,controlId:e,value:n};t.postMessage(i,r)}function NH(t,e={}){if(typeof window>"u")return()=>{};const n=e.allowedOrigins?.filter(Boolean)??[],r=i=>{n.length>0&&!n.includes(i.origin)||RH(i.data)&&t(i.source)};return window.addEventListener("message",r),()=>window.removeEventListener("message",r)}const QT=[{family:"Manrope",category:"sans-serif",weights:[400,500,600,700]},{family:"Syne",category:"display",weights:[600,700,800]},{family:"Inter",category:"sans-serif",weights:[400,500,600,700]},{family:"Roboto",category:"sans-serif",weights:[400,500,700]},{family:"Open Sans",category:"sans-serif",weights:[400,600,700]},{family:"Lato",category:"sans-serif",weights:[400,700]},{family:"Montserrat",category:"sans-serif",weights:[400,600,700]},{family:"Poppins",category:"sans-serif",weights:[400,600,700]},{family:"Nunito",category:"sans-serif",weights:[400,600,700]},{family:"Work Sans",category:"sans-serif",weights:[400,600,700]},{family:"DM Sans",category:"sans-serif",weights:[400,500,700]},{family:"Plus Jakarta Sans",category:"sans-serif",weights:[400,600,700]},{family:"Outfit",category:"sans-serif",weights:[400,600,700]},{family:"Space Grotesk",category:"sans-serif",weights:[400,600,700]},{family:"Playfair Display",category:"serif",weights:[400,600,700]},{family:"Merriweather",category:"serif",weights:[400,700]},{family:"Libre Baskerville",category:"serif",weights:[400,700]},{family:"Cormorant Garamond",category:"serif",weights:[400,600,700]},{family:"Fraunces",category:"serif",weights:[400,600,700]},{family:"Bebas Neue",category:"display",weights:[400]},{family:"Oswald",category:"display",weights:[400,600,700]},{family:"Archivo Black",category:"display",weights:[400]},{family:"Anton",category:"display",weights:[400]},{family:"Barlow Condensed",category:"sans-serif",weights:[400,600,700]},{family:"JetBrains Mono",category:"monospace",weights:[400,600,700]},{family:"IBM Plex Mono",category:"monospace",weights:[400,600,700]},{family:"Source Serif 4",category:"serif",weights:[400,600,700]},{family:"Instrument Serif",category:"serif",weights:[400,600]},{family:"Sora",category:"sans-serif",weights:[400,600,700]},{family:"Rubik",category:"sans-serif",weights:[400,600,700]}];function OH(t){switch(t){case"woff2":return"woff2";case"woff":return"woff";default:return"truetype"}}function $N(t){return(t.files??[]).map(e=>`@font-face{font-family:"${t.family.replace(/"/g,'\\"')}";src:url("${e.url}") format("${OH(e.format)}");font-weight:${e.weight};font-style:${e.style};font-display:swap;}`).join("")}function DH(t){switch(t){case"woff2":return"woff2";case"woff":return"woff";default:return"ttf"}}function IH(t,e,n){const r=t.replace(/\/$/,""),i=n.style==="italic"?"-italic":"",s=DH(n.format);return`${r}/public/fonts/${encodeURIComponent(e)}/${n.weight}${i}.${s}`}function jH(t,e){return t.map(n=>({...n,files:(n.files??[]).map(r=>({...r,url:IH(e,n.id,r)}))}))}const LH="vertebr:theme";function PH(t){try{const e=localStorage.getItem(t);if(e==="light"||e==="dark")return e}catch{}return null}function zH(t,e){try{localStorage.setItem(t,e)}catch{}}function $H(t){document.documentElement.setAttribute("data-vb-theme",t)}function BH(t=LH){const[e,n]=E.useState(()=>PH(t)??"dark");E.useEffect(()=>{$H(e),zH(t,e)},[e,t]);const r=E.useCallback(s=>{n(s)},[]),i=E.useCallback(()=>{n(s=>s==="dark"?"light":"dark")},[]);return{theme:e,setTheme:r,toggleTheme:i}}const BN=[{id:"7d",label:"Last 7 days"},{id:"14d",label:"Last 14 days"},{id:"30d",label:"Last 30 days"},{id:"this_month",label:"This month"},{id:"last_month",label:"Last month"}],VH="14d",HH=new Set(BN.map(t=>t.id));function UH(t){return t&&HH.has(t)?t:VH}var nf=t=>t.type==="checkbox",Jm=t=>t.type==="file",Eo=t=>t instanceof Date,$n=t=>t==null;const Tw=t=>typeof t=="object";var Wt=t=>!$n(t)&&!Array.isArray(t)&&Tw(t)&&!Eo(t),D0=t=>Wt(t)&&t.target?nf(t.target)?t.target.checked:Jm(t.target)?t.target.files:t.target.value:t,VN=(t,e)=>e.split(".").some((n,r,i)=>!isNaN(Number(n))&&t.has(i.slice(0,r).join("."))),HN=t=>{const e=t.constructor&&t.constructor.prototype;return Wt(e)&&e.hasOwnProperty("isPrototypeOf")},Qm=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Gt(t){if(t instanceof Date)return new Date(t);const e=typeof FileList<"u"&&t instanceof FileList;if(Qm&&(t instanceof Blob||e))return t;const n=Array.isArray(t);if(!n&&!(Wt(t)&&HN(t)))return t;const r=n?[]:Object.create(Object.getPrototypeOf(t));for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=Gt(t[i]));return r}const po={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},mi={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ci={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},UN="root",_w=["__proto__","constructor","prototype"],FH=/^\w*$/;var rf=t=>FH.test(t),Ht=t=>t===void 0;const qH=/[.[\]'"]/;var eg=t=>t.split(qH).filter(Boolean),Ce=(t,e,n)=>{if(!e||!Wt(t))return n;const r=rf(e)?[e]:eg(e);if(r.some(s=>_w.includes(s)))return n;const i=r.reduce((s,o)=>$n(s)?void 0:s[o],t);return Ht(i)||i===t?Ht(t[e])?n:t[e]:i},Mr=t=>typeof t=="boolean",Zn=t=>typeof t=="function",wt=(t,e,n)=>{let r=-1;const i=rf(e)?[e]:eg(e),s=i.length,o=s-1;for(;++r<s;){const l=i[r];let u=n;if(r!==o){const f=t[l];u=Wt(f)||Array.isArray(f)?f:isNaN(+i[r+1])?{}:[]}if(_w.includes(l))return;t[l]=u,t=t[l]}};const FN=Ge.createContext(null);FN.displayName="HookFormControlContext";const Aw=()=>Ge.useContext(FN);var qN=(t,e,n,r=!0)=>{const i={};for(const s in t)Object.defineProperty(i,s,{get:()=>{const o=s;return e._proxyFormState[o]!==mi.all&&(e._proxyFormState[o]=!r||mi.all),n&&(n[o]=!0),t[o]}});return i};const Rw=Qm?Ge.useLayoutEffect:Ge.useEffect;function GH(t){const e=Aw(),{control:n=e,disabled:r,name:i,exact:s}=t||{},[o,l]=Ge.useState(()=>({...n._formState,defaultValues:n._defaultValues})),u=Ge.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Rw(()=>n._subscribe({name:i,formState:u.current,exact:s,callback:f=>{!r&&l({...n._formState,...f,defaultValues:n._defaultValues})}}),[i,r,s]),Ge.useEffect(()=>{u.current.isValid&&n._setValid(!0)},[n]),Ge.useMemo(()=>qN(o,n,u.current,!1),[o,n])}var Bn=t=>typeof t=="string",I0=(t,e,n,r,i)=>Bn(t)?(r&&e.watch.add(t),Ce(n,t,i)):Array.isArray(t)?t.map(s=>(r&&e.watch.add(s),Ce(n,s))):(r&&(e.watchAll=!0),n),j0=t=>$n(t)||!Tw(t);const e_=(t,e)=>e.length===0&&!Array.isArray(t)&&!HN(t);function Nr(t,e,n=new WeakMap){if(t===e)return!0;if(j0(t)||j0(e))return Object.is(t,e);if(Eo(t)&&Eo(e))return Object.is(t.getTime(),e.getTime());const r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;if(e_(t,r)||e_(e,i))return Object.is(t,e);if(!r.length&&Array.isArray(t)!==Array.isArray(e))return!1;const s=n.get(t);if(s&&s.has(e))return!0;if(s)s.add(e);else{const o=new WeakSet;o.add(e),n.set(t,o)}for(const o of r){const l=t[o];if(!(o in e))return!1;if(o!=="ref"){const u=e[o];if(Eo(l)&&Eo(u)||(Wt(l)||Array.isArray(l))&&(Wt(u)||Array.isArray(u))?!Nr(l,u,n):!Object.is(l,u))return!1}}return!0}function GN(t){const e=Aw(),{control:n=e,name:r,defaultValue:i,disabled:s,exact:o,compute:l}=t||{},u=Ge.useRef(i),f=Ge.useRef(l),h=Ge.useRef(void 0),m=Ge.useRef(n),g=Ge.useRef(r);f.current=l;const[b,x]=Ge.useState(()=>{const R=n._getWatch(r,u.current);return f.current?f.current(R):R}),S=Ge.useCallback(R=>{const A=I0(r,n._names,R||n._formValues,!1,u.current);return f.current?f.current(A):A},[n._formValues,n._names,r]),k=Ge.useCallback(R=>{if(!s){const A=I0(r,n._names,R||n._formValues,!1,u.current);if(f.current){const O=f.current(A);Nr(O,h.current)||(x(O),h.current=O)}else x(A)}},[n._formValues,n._names,s,r]);Rw(()=>((m.current!==n||!Nr(g.current,r))&&(m.current=n,g.current=r,k()),n._subscribe({name:r,formState:{values:!0},exact:o,callback:R=>{k(R.values)}})),[n,o,r,k]),Ge.useEffect(()=>n._removeUnmounted());const C=m.current!==n,_=g.current,M=Ge.useMemo(()=>{if(s)return null;const R=!C&&!Nr(_,r);return C||R?S():null},[s,C,r,_,S]);return M!==null?M:b}function WH(t){const e=Aw(),{name:n,disabled:r,control:i=e,shouldUnregister:s,defaultValue:o,exact:l=!0}=t,u=VN(i._names.array,n),f=Ge.useMemo(()=>Ce(i._formValues,n,Ce(i._defaultValues,n,o)),[i,n,o]),h=GN({control:i,name:n,defaultValue:f,exact:l}),m=GH({control:i,name:n,exact:l}),g=Ge.useRef(t),b=Ge.useRef(null),x=Ge.useRef(i.register(n,{...t.rules,value:h,...Mr(t.disabled)?{disabled:t.disabled}:{}}));g.current=t;const S=Ge.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Ce(m.errors,n)},isDirty:{enumerable:!0,get:()=>!!Ce(m.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Ce(m.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Ce(m.validatingFields,n)},error:{enumerable:!0,get:()=>Ce(m.errors,n)}}),[m,n]),k=Ge.useCallback(R=>{const A=D0(R);return Ce(i._fields,n)||(x.current=i.register(n,{...g.current.rules,value:A})),x.current.onChange({target:{value:D0(R),name:n},type:po.CHANGE})},[n,i]),C=Ge.useCallback(()=>x.current.onBlur({target:{value:Ce(i._formValues,n),name:n},type:po.BLUR}),[n,i._formValues]),_=Ge.useCallback(R=>{R&&(b.current={focus:()=>Zn(R.focus)&&R.focus(),select:()=>Zn(R.select)&&R.select(),setCustomValidity:O=>Zn(R.setCustomValidity)&&R.setCustomValidity(O),reportValidity:()=>Zn(R.reportValidity)&&R.reportValidity()});const A=Ce(i._fields,n);A&&A._f&&R&&(A._f.ref=b.current)},[i._fields,n]),M=Ge.useMemo(()=>({name:n,value:h,...Mr(r)||m.disabled?{disabled:m.disabled||r}:{},onChange:k,onBlur:C,ref:_}),[n,r,m.disabled,k,C,_,h]);return Ge.useEffect(()=>{const R=i._options.shouldUnregister||s;x.current=i.register(n,{...g.current.rules,...Mr(g.current.disabled)?{disabled:g.current.disabled}:{}});const A=(O,D)=>{const j=Ce(i._fields,O);j&&j._f&&(j._f.mount=D)};if(A(n,!0),R){const O=Gt(Ce(s?i._defaultValues:i._options.values||i._defaultValues,n,Ce(i._options.defaultValues,n,g.current.defaultValue)));wt(i._defaultValues,n,O),Ht(Ce(i._formValues,n))&&wt(i._formValues,n,O)}if(!u&&i.register(n),b.current){const O=Ce(i._fields,n);O&&O._f&&(O._f.ref=b.current)}return()=>{(u?R&&!i._state.action:R)?i.unregister(n):A(n,!1)}},[n,i,u,s]),Ge.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),Ge.useMemo(()=>({field:M,formState:m,fieldState:S}),[M,m,S])}const cs=t=>t.render(WH(t));var Rh=t=>({isOnSubmit:!t||t===mi.onSubmit,isOnBlur:t===mi.onBlur,isOnChange:t===mi.onChange,isOnAll:t===mi.all,isOnTouch:t===mi.onTouched}),hv=(t,e,n)=>{if(n)return!1;if(e.watchAll||e.watch.has(t))return!0;for(const r of e.watch)if(t.startsWith(r)&&t.charAt(r.length)===".")return!0;return!1};const cd=(t,e,n,r)=>{for(const i of n||Object.keys(t)){if(i==="_f")continue;const s=n?Ce(t,i):t[i];if(s){const{_f:o}=s;if(o){if(o.refs&&o.refs[0]&&e(o.refs[0],i)&&!r)return!0;if(o.ref&&e(o.ref,o.name)&&!r)return!0;if(cd(s,e))break}else if((Wt(s)||Array.isArray(s))&&cd(s,e))break}}};var t_=(t,e,n)=>{const r=Ce(t,n),i=Array.isArray(r)?r:[];return wt(i,UN,e[n]),wt(t,n,i),t},Pn=t=>Wt(t)&&!Object.keys(t).length,Pp=t=>{if(!Qm)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},Mw=t=>t.type==="radio",zp=t=>t instanceof RegExp,Nw=(t,e,n,r,i)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:i||!0}}:{};const n_={value:!1,isValid:!1},r_={value:!0,isValid:!0};var WN=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!Ht(t[0].attributes.value)?Ht(t[0].value)||t[0].value===""?r_:{value:t[0].value,isValid:!0}:r_:n_}return n_};const i_={isValid:!1,value:null};var KN=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,i_):i_;function s_(t,e,n="validate"){if(Bn(t)||Array.isArray(t)&&t.every(Bn)||Mr(t)&&!t)return{type:n,message:Bn(t)?t:"",ref:e}}var Gl=t=>Wt(t)&&!zp(t)?t:{value:t,message:""},o_=async(t,e,n,r,i,s)=>{const{ref:o,refs:l,required:u,maxLength:f,minLength:h,min:m,max:g,pattern:b,validate:x,name:S,valueAsNumber:k,mount:C}=t._f,_=Ce(n,S);if(!C||e.has(S))return{};const M=l?l[0]:o,R=G=>{if(i&&M.reportValidity){const ee=Mr(G)?"":G||"";l?l.forEach(te=>te.setCustomValidity(ee)):M.setCustomValidity(ee),M.reportValidity()}},A={},O=Mw(o),D=nf(o),j=O||D,z=(k||Jm(o))&&Ht(o.value)&&Ht(_)||Pp(o)&&o.value===""||_===""||Array.isArray(_)&&!_.length,q=Nw.bind(null,S,r,A),Z=(G,ee,te,fe=ci.maxLength,B=ci.minLength)=>{const L=G?ee:te;A[S]={type:G?fe:B,message:L,ref:o,...q(G?fe:B,L)}};if(s?!Array.isArray(_)||!_.length:u&&(!j&&(z||$n(_))||Mr(_)&&!_||D&&!WN(l).isValid||O&&!KN(l).isValid)){const{value:G,message:ee}=Bn(u)?{value:!!u,message:u}:Gl(u);if(G&&(A[S]={type:ci.required,message:ee,ref:M,...q(ci.required,ee)},!r))return R(ee),A}if(!z&&(!$n(m)||!$n(g))){let G,ee;const te=Gl(g),fe=Gl(m);if(!$n(_)&&!isNaN(_)){const B=o.valueAsNumber||_&&+_;$n(te.value)||(G=B>te.value),$n(fe.value)||(ee=B<fe.value)}else{const B=o.valueAsDate||new Date(_),L=Se=>new Date(new Date().toDateString()+" "+Se),U=o.type=="time",ue=o.type=="week";Bn(te.value)&&_&&(G=U?L(_)>L(te.value):ue?_>te.value:B>new Date(te.value)),Bn(fe.value)&&_&&(ee=U?L(_)<L(fe.value):ue?_<fe.value:B<new Date(fe.value))}if((G||ee)&&(Z(!!G,te.message,fe.message,ci.max,ci.min),!r))return R(A[S].message),A}if((f||h)&&!z&&(Bn(_)||s&&Array.isArray(_))){const G=Gl(f),ee=Gl(h),te=!$n(G.value)&&_.length>+G.value,fe=!$n(ee.value)&&_.length<+ee.value;if((te||fe)&&(Z(te,G.message,ee.message),!r))return R(A[S].message),A}if(b&&!z&&Bn(_)){const{value:G,message:ee}=Gl(b);if(zp(G)&&!_.match(G)&&(A[S]={type:ci.pattern,message:ee,ref:o,...q(ci.pattern,ee)},!r))return R(ee),A}if(x){if(Zn(x)){const G=await x(_,n),ee=s_(G,M);if(ee&&(A[S]={...ee,...q(ci.validate,ee.message)},!r))return R(ee.message),A}else if(Wt(x)){let G={};for(const ee in x){if(!Pn(G)&&!r)break;const te=s_(await x[ee](_,n),M,ee);te&&(G={...te,...q(ee,te.message)},R(te.message),r&&(A[S]=G))}if(!Pn(G)&&(A[S]={ref:M,...G},!r))return A}}return R(!0),A},mp=t=>Array.isArray(t)?t:[t],ZN=t=>Array.isArray(t)?t.filter(Boolean):[];function KH(t,e){const n=e.length-1;let r=0;for(;r<n;){if($n(t)){t=void 0;break}t=t[e[r]],r++}return t}function ZH(t){for(const e in t)if(t.hasOwnProperty(e)&&!Ht(t[e]))return!1;return!0}function on(t,e){if(Bn(e)&&Object.prototype.hasOwnProperty.call(t,e))return delete t[e],t;const n=Array.isArray(e)?e:rf(e)?[e]:eg(e);if(n.some(o=>_w.includes(String(o))))return t;const r=n.length===1?t:KH(t,n),i=n.length-1,s=n[i];return r&&delete r[s],i!==0&&(Wt(r)&&Pn(r)||Array.isArray(r)&&ZH(r))&&on(t,n.slice(0,-1)),t}const YN=t=>{const e={};for(const n of Object.keys(t))if(Tw(t[n])&&t[n]!==null&&!Eo(t[n])){const r=YN(t[n]);for(const i of Object.keys(r))e[`${n}.${i}`]=r[i]}else e[n]=t[n];return e},YH=Ge.createContext(null);YH.displayName="HookFormContext";var a_=()=>{let t=[];return{get observers(){return t},next:i=>{for(const s of t)s.next&&s.next(i)},subscribe:i=>(t.push(i),{unsubscribe:()=>{t=t.filter(s=>s!==i)}}),unsubscribe:()=>{t=[]}}};function XN(t,e){const n={};for(const r in t)if(t.hasOwnProperty(r)){const i=t[r],s=e[r];if(i&&Wt(i)&&s){const o=XN(i,s);Wt(o)&&(n[r]=o)}else t[r]&&(n[r]=s)}return n}var JN=t=>t.type==="select-multiple",XH=t=>Mw(t)||nf(t),pv=t=>Pp(t)&&t.isConnected;function l_(t){return Array.isArray(t)||Wt(t)}function QN(t,e,n="",r=[]){for(const i in t){const s=n?`${n}.${i}`:i,o=t[i];l_(o)&&l_(Ce(e,s))?QN(o,e,s,r):r.push(s)}return r}var JH=t=>{for(const e in t)if(Zn(t[e]))return!0;return!1};function eO(t){return Array.isArray(t)||Wt(t)&&!JH(t)}function tO(t){return!!(t&&"_f"in t)}function nO(t){return Array.isArray(t)?!t.some(e=>!Ht(e)):!Object.keys(t).length}function L0(t,e){Array.isArray(t)?t[e]=void 0:delete t[e]}function P0(t,e={},n){for(const r in t){const i=t[r],s=n&&n[r];eO(i)&&(!Array.isArray(i)||!tO(s))?(e[r]=Array.isArray(i)?[]:{},P0(i,e[r],s),nO(e[r])&&L0(e,r)):Ht(i)||(e[r]=!0)}return e}function Sa(t,e,n,r){n||(n=P0(e,{},r));for(const i in t){const s=t[i],o=r&&r[i];eO(s)&&(!Array.isArray(s)||!tO(o))?(Ht(e)||j0(n[i])?n[i]=P0(s,Array.isArray(s)?[]:{},o):Sa(s,$n(e)?{}:e[i],n[i],o),nO(n[i])&&L0(n,i)):Nr(s,e[i])?L0(n,i):n[i]=!0}return n}var rO=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>Ht(t)?t:e?t===""?NaN:t&&+t:n&&Bn(t)?new Date(t):r?r(t):t;function c_(t){const e=t.ref;return Jm(e)?e.files:Mw(e)?KN(t.refs).value:JN(e)?[...e.selectedOptions].map(({value:n})=>n):nf(e)?WN(t.refs).value:rO(e.value,t)}var QH=(t,e,n,r)=>{const i={};for(const s of t){const o=Ce(e,s);o&&wt(i,s,o._f)}return{criteriaMode:n,names:[...t],fields:i,shouldUseNativeValidation:r}},Vu=t=>Ht(t)?t:zp(t)?t.source:Wt(t)?zp(t.value)?t.value.source:t.value:t;const u_="AsyncFunction";var eU=t=>{if(!t||!t.validate)return!1;if(Zn(t.validate))return t.validate.constructor.name===u_;if(Wt(t.validate)){for(const e in t.validate)if(t.validate[e].constructor.name===u_)return!0}return!1},tU=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate);function d_(t,e,n){const r=Ce(t,n);if(r||rf(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const s=i.join("."),o=Ce(e,s),l=Ce(t,s);if(o&&!Array.isArray(o)&&n!==s)return{name:n};if(l&&l.type)return{name:s,error:l};if(l&&l.root&&l.root.type)return{name:`${s}.root`,error:l.root};i.pop()}return{name:n}}var nU=(t,e,n,r)=>{n(t);const i=Object.keys(t).filter(s=>s!=="name");return!i.length||r&&i.length>=Object.keys(e).length||i.find(s=>e[s]===(!r||mi.all))},rU=(t,e,n)=>!t||!e||t===e||mp(t).some(r=>r&&(n?r===e||r.startsWith(e+"."):r.startsWith(e)||e.startsWith(r))),iU=(t,e,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(e||t):(n?r.isOnBlur:i.isOnBlur)?!t:(n?r.isOnChange:i.isOnChange)?t:!0,sU=(t,e)=>!ZN(Ce(t,e)).length&&on(t,e);const oU={mode:mi.onSubmit,reValidateMode:mi.onChange,shouldFocusError:!0},mv="form",aU=(t,e)=>{for(const n in t)n in e||delete t[n];Object.assign(t,e)},iO={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function lU(t={}){let e={...oU,...t},n={...Gt(iO),isLoading:Zn(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1},r={},i=Wt(e.defaultValues)||Wt(e.values)?Gt(e.defaultValues||e.values)||{}:{},s=e.shouldUnregister?{}:Gt(i),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set};const u={},f={};let h=0,m=Rh(e.mode),g=Rh(e.reValidateMode);const b={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},x={...b};let S={...x};const k={array:a_(),state:a_()};let C=0;const _=e.criteriaMode===mi.all,M=(I,P)=>H=>{clearTimeout(f[I]),f[I]=setTimeout(P,H)},R=async I=>{if(!o.keepIsValid&&!e.disabled&&(x.isValid||S.isValid||I)){const P=++C;let H;e.resolver?(H=Pn((await te()).errors),P===C&&A()):H=await L({fields:r,onlyCheckValid:!0,eventType:po.VALID}),P===C&&H!==n.isValid&&k.state.next({isValid:H})}},A=(I,P)=>{!e.disabled&&(x.isValidating||x.validatingFields||S.isValidating||S.validatingFields)&&((I||Array.from(l.mount)).forEach(H=>{H&&(P?wt(n.validatingFields,H,P):on(n.validatingFields,H))}),k.state.next({validatingFields:n.validatingFields,isValidating:!Pn(n.validatingFields)}))},O=()=>{n.dirtyFields=Sa(i,s,void 0,r)},D=(I,P=[],H,ie,ae=!0,ye=!0)=>{if(ie&&H&&!e.disabled){if(o.action=!0,ye&&Array.isArray(Ce(r,I))){const ke=H(Ce(r,I),ie.argA,ie.argB);ae&&wt(r,I,ke)}if(ye&&Array.isArray(Ce(n.errors,I))){const ke=H(Ce(n.errors,I),ie.argA,ie.argB);ae&&wt(n.errors,I,ke),sU(n.errors,I)}if((x.touchedFields||S.touchedFields)&&ye&&Array.isArray(Ce(n.touchedFields,I))){const ke=H(Ce(n.touchedFields,I),ie.argA,ie.argB);ae&&wt(n.touchedFields,I,ke)}(x.dirtyFields||S.dirtyFields)&&O(),k.state.next({name:I,isDirty:ue(I,P),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else wt(s,I,P)},j=(I,P)=>{wt(n.errors,I,P),n.errors={...n.errors},k.state.next({errors:n.errors})},z=I=>{n.errors=I,k.state.next({errors:n.errors,isValid:!1})},q=I=>{const P=rf(I)?[I]:eg(I);let H=s,ie=i;for(let ae=0;ae<P.length-1;ae++){const ye=P[ae];if(H=$n(H)?H:H[ye],ie=$n(ie)?ie:ie[ye],H===null&&ie!==null)return!0}return!1},Z=(I,P,H,ie)=>{const ae=Ce(r,I);if(ae){if(q(I))return;const ye=Ht(Ce(s,I)),ke=Ce(s,I,Ht(H)?Ce(i,I):H);Ht(ke)||ie&&ie.defaultChecked||P?wt(s,I,P?ke:c_(ae._f)):Y(I,ke),o.mount&&!o.action&&(R(),ye&&n.isDirty&&(x.isDirty||S.isDirty)&&(ue()||(n.isDirty=!1,k.state.next({...n}))),t.shouldUnregister&&ye&&!Ht(Ce(s,I))&&hv(I,l)&&(o.watch=!0))}},G=(I,P,H,ie,ae)=>{let ye=!1,ke=!1;const _e={name:I};if(!e.disabled||ie===!0){if(!H||ie){const Be=Nr(Ce(i,I),P);(x.isDirty||S.isDirty)&&(ke=n.isDirty,n.isDirty=_e.isDirty=!Be||ue(),ye=ke!==_e.isDirty),ke=!!Ce(n.dirtyFields,I),Be!==n.isDirty?aU(n.dirtyFields,Sa(i,s,void 0,r)):Be?on(n.dirtyFields,I):wt(n.dirtyFields,I,!0),_e.dirtyFields=n.dirtyFields,ye=ye||(x.dirtyFields||S.dirtyFields)&&ke!==!Be}if(H){const Be=Ce(n.touchedFields,I);Be||(wt(n.touchedFields,I,H),_e.touchedFields=n.touchedFields,ye=ye||(x.touchedFields||S.touchedFields)&&Be!==H)}ye&&ae&&k.state.next(_e)}return ye?_e:{}},ee=(I,P,H,ie)=>{const ae=Ce(n.errors,I),ye=(x.isValid||S.isValid)&&Mr(P)&&n.isValid!==P;if(e.delayError&&H?(u[I]=M(I,()=>j(I,H)),u[I](e.delayError)):(clearTimeout(f[I]),delete u[I],H?wt(n.errors,I,H):on(n.errors,I),n.errors={...n.errors}),(H?!Nr(ae,H):ae)||!Pn(ie)||ye){const ke={...ie,...ye&&Mr(P)?{isValid:P}:{},errors:n.errors,name:I};n={...n,...ke},k.state.next(ke)}},te=async I=>(A(I,!0),await e.resolver(s,e.context,QH(I||l.mount,r,e.criteriaMode,e.shouldUseNativeValidation))),fe=async I=>{const{errors:P}=await te(I);if(A(I),I){for(const H of I){const ie=Ce(P,H);ie?l.array.has(H)&&Wt(ie)&&!Object.keys(ie).some(ae=>!Number.isNaN(Number(ae)))?t_(n.errors,{[H]:ie},H):wt(n.errors,H,ie):on(n.errors,H)}n.errors={...n.errors}}else n.errors=P;return P},B=async({name:I,eventType:P})=>{if(t.validate){const H=await t.validate({formValues:s,formState:n,name:I,eventType:P});if(Wt(H))for(const ie in H){const ae=H[ie];ae&&Ze(`${mv}.${ie}`,{message:Bn(ae.message)?ae.message:"",type:ae.type||ci.validate})}else Bn(H)||!H?Ze(mv,{message:H||"",type:ci.validate}):Ue(mv);return H}return!0},L=async({fields:I,onlyCheckValid:P,name:H,eventType:ie,context:ae={valid:!0,runRootValidation:!1}})=>{if(t.validate&&(ae.runRootValidation=!0,!await B({name:H,eventType:ie})&&(ae.valid=!1,P)))return ae.valid;for(const ye in I){const ke=I[ye];if(ke){const{_f:_e,...Be}=ke;if(_e){const it=l.array.has(_e.name),_t=ke._f&&eU(ke._f),xn=x.validatingFields||x.isValidating||S.validatingFields||S.isValidating;_t&&xn&&A([_e.name],!0);const me=await o_(ke,l.disabled,s,_,e.shouldUseNativeValidation&&!P,it);if(_t&&xn&&A([_e.name]),me[_e.name]&&(ae.valid=!1,P)||(!P&&(Ce(me,_e.name)?it?t_(n.errors,me,_e.name):wt(n.errors,_e.name,me[_e.name]):on(n.errors,_e.name)),t.shouldUseNativeValidation&&me[_e.name]))break}!Pn(Be)&&await L({context:ae,onlyCheckValid:P,fields:Be,name:ye,eventType:ie})}}return ae.valid},U=()=>{for(const I of l.unMount){const P=Ce(r,I);P&&(P._f.refs?P._f.refs.every(H=>!pv(H)):!pv(P._f.ref))&&vn(I)}l.unMount=new Set},ue=(I,P)=>(I&&P&&wt(s,I,P),!Nr(o.mount?s:i,i)),Se=(I,P,H)=>I0(I,l,{...o.mount?s:Ht(P)?i:Bn(I)?{[I]:P}:P},H,P),V=I=>ZN(Ce(o.mount?s:i,I,e.shouldUnregister?Ce(i,I,[]):[])),Y=(I,P,H={},ie=!1,ae=!1)=>{const ye=Ce(r,I);let ke=P;if(ye){const _e=ye._f;_e&&(!_e.disabled&&wt(s,I,rO(P,_e)),ke=Pp(_e.ref)&&$n(P)?"":P,JN(_e.ref)?[..._e.ref.options].forEach(Be=>Be.selected=ke.includes(Be.value)):_e.refs?nf(_e.ref)?_e.refs.forEach(Be=>{(!Be.defaultChecked||!Be.disabled)&&(Array.isArray(ke)?Be.checked=!!ke.find(it=>it===Be.value):Be.checked=ke===Be.value||!!ke)}):_e.refs.forEach(Be=>Be.checked=Be.value===ke):Jm(_e.ref)?_e.ref.value="":(_e.ref.value=ke,!_e.ref.type&&!ae&&k.state.next({name:I,values:ie?s:Gt(s)})))}(H.shouldDirty||H.shouldTouch)&&G(I,ke,H.shouldTouch,H.shouldDirty,!ae),H.shouldValidate&&oe(I,{delayError:H.delayError})},he=(I,P,H,ie=!1,ae=!1)=>{l.array.has(I)&&k.array.next({name:I,values:ie?s:Gt(s)});for(const ye in P){if(!P.hasOwnProperty(ye))return;const ke=P[ye],_e=I+"."+ye,Be=Ce(r,_e);(l.array.has(I)||Wt(ke)||Be&&!Be._f)&&!Eo(ke)?he(_e,ke,H,ie,ae):Y(_e,ke,H,ie,ae)}},ve=(I,P,H,ie,ae=!1)=>{const ye=Ce(r,I),ke=l.array.has(I),_e=ie?P:Gt(P),Be=Ce(s,I),it=Nr(Be,_e);if(it||wt(s,I,_e),ke)k.array.next({name:I,values:ie?s:Gt(s)}),(x.isDirty||x.dirtyFields||S.isDirty||S.dirtyFields)&&H.shouldDirty&&(O(),ae||k.state.next({name:I,dirtyFields:n.dirtyFields,isDirty:ue(I,_e)}));else{const _t=Array.isArray(_e)&&!_e.length||Pn(_e);!ye||ye._f||$n(_e)||_t?Y(I,_e,H,ie,ae):he(I,_e,H,ie,ae)}if(!it&&!ae){const _t=hv(I,l),xn=ie?s:Gt(s);k.state.next({..._t&&n,name:o.mount||_t?I:void 0,values:xn})}},Ae=(I,P,H={})=>ve(I,P,H,!1),Re=(I,P={})=>{const H=Zn(I)?I(s):I;if(!Nr(s,H)){s={...s,...H};const ie=YN(H);for(const ae of l.mount)ae in ie&&ve(ae,ie[ae],P,!0,!0);k.state.next({...n,name:void 0,type:void 0,...h?{values:s}:{}}),P.shouldValidate&&R()}},Le=async I=>{o.mount=!0;const P=I.target;let H=P.name,ie=!0;const ae=Ce(r,H),ye=ke=>{ie=Number.isNaN(ke)||Eo(ke)&&isNaN(ke.getTime())||Nr(ke,Ce(s,H,ke))};if(ae){let ke,_e;const Be=P.type?c_(ae._f):D0(I),it=I.type===po.BLUR||I.type===po.FOCUS_OUT,_t=!tU(ae._f)&&!t.validate&&!e.resolver&&!Ce(n.errors,H)&&!ae._f.deps,xn=_t||iU(it,Ce(n.touchedFields,H),n.isSubmitted,g,m),me=hv(H,l,it);if(wt(s,H,Be),it){if(!P||!P.readOnly){ae._f.onBlur&&ae._f.onBlur(I);const we=u[H];we&&we(0)}}else ae._f.onChange&&ae._f.onChange(I);const K=G(H,Be,it),re=!Pn(K)||me;if(!it&&k.state.next({name:H,type:I.type,...h?{values:Gt(s)}:{}}),xn)return(!_t||!n.isValid)&&(x.isValid||S.isValid)&&(e.mode==="onBlur"?it&&R():it||R()),re&&k.state.next({name:H,...me?{}:K});if(!e.resolver&&t.validate&&await B({name:H,eventType:I.type}),!it&&me&&k.state.next({...n}),e.resolver){const{errors:we}=await te([H]);if(A([H]),ye(Be),!ie){!Pn(K)&&k.state.next(K);return}const Fe=d_(n.errors,r,H),pt=d_(we,r,Fe.name||H);ke=pt.error,H=pt.name,_e=Pn(we)}else A([H],!0),ke=(await o_(ae,l.disabled,s,_,e.shouldUseNativeValidation))[H],A([H]),ye(Be),ie&&(ke?_e=!1:(x.isValid||S.isValid)&&(_e=await L({fields:r,onlyCheckValid:!0,name:H,eventType:I.type})));ie&&(ae._f.deps&&(!Array.isArray(ae._f.deps)||ae._f.deps.length>0)&&oe(ae._f.deps),ee(H,_e,ke,K))}},Te=(I,P)=>{if(Ce(n.errors,P)&&I.focus)return I.focus(),1},oe=async(I,P={})=>{let H,ie;const ae=mp(I);if(e.resolver){const ye=await fe(Ht(I)?I:ae);H=Pn(ye),ie=I?!ae.some(ke=>Ce(ye,ke)):H}else I?(ie=(await Promise.all(ae.map(async ye=>{const ke=Ce(r,ye);return await L({fields:ke&&ke._f?{[ye]:ke}:ke,eventType:po.TRIGGER})}))).every(Boolean),!(!ie&&!n.isValid)&&R()):ie=H=await L({fields:r,name:I,eventType:po.TRIGGER});if(P.delayError&&e.delayError&&Bn(I)){const ye=Ce(n.errors,I);ye?(on(n.errors,I),u[I]=M(I,()=>j(I,ye)),u[I](e.delayError)):(clearTimeout(f[I]),delete u[I])}return k.state.next({...!Bn(I)||(x.isValid||S.isValid)&&H!==n.isValid?{}:{name:I},...e.resolver||!I?{isValid:H}:{},errors:n.errors}),P.shouldFocus&&!ie&&cd(r,Te,I?ae:l.mount),ie},pe=(I,P)=>{let H={...o.mount?s:i};return P&&(H=XN(P.dirtyFields?n.dirtyFields:n.touchedFields,H)),Ht(I)?H:Bn(I)?Ce(H,I):I.map(ie=>Ce(H,ie))},Ie=(I,P)=>({invalid:!!Ce((P||n).errors,I),isDirty:!!Ce((P||n).dirtyFields,I),error:Ce((P||n).errors,I),isValidating:!!Ce(n.validatingFields,I),isTouched:!!Ce((P||n).touchedFields,I)}),Ue=I=>{const P=I?mp(I):void 0;P?.forEach(H=>on(n.errors,H)),P?P.forEach(H=>{k.state.next({name:H,errors:n.errors})}):(n.errors={},k.state.next({errors:n.errors}))},Ze=(I,P,H)=>{const ie=(Ce(r,I,{_f:{}})._f||{}).ref,ae=Ce(n.errors,I)||{},{ref:ye,message:ke,type:_e,...Be}=ae;wt(n.errors,I,{...Be,...P,ref:ie}),k.state.next({name:I,errors:n.errors,isValid:!1}),H&&H.shouldFocus&&ie&&ie.focus&&ie.focus()},ft=(I,P)=>{if(Zn(I)){h++;const{unsubscribe:H}=k.state.subscribe({next:ae=>"values"in ae&&I(ae.values||Se(void 0,P),ae)});let ie=!1;return{unsubscribe:()=>{ie||(ie=!0,h--,H())}}}return Se(I,P,!0)},vt=I=>{var P;const H=!!(!((P=I.formState)===null||P===void 0)&&P.values);H&&h++;const{unsubscribe:ie}=k.state.subscribe({next:ye=>{if(rU(I.name,ye.name,I.exact)&&nU(ye,I.formState||x,zr,I.reRenderRoot)){const ke={...s};I.callback({values:ke,...n,...ye,defaultValues:i})}}});if(!H)return ie;let ae=!1;return()=>{ae||(ae=!0,h--,ie())}},Kt=I=>(o.mount=!0,S={...S,...I.formState},vt({...I,formState:{...b,...I.formState}})),vn=(I,P={})=>{for(const H of I?mp(I):l.mount)l.mount.delete(H),l.array.delete(H),P.keepValue||(on(r,H),on(s,H)),!P.keepError&&on(n.errors,H),!P.keepDirty&&on(n.dirtyFields,H),!P.keepTouched&&on(n.touchedFields,H),!P.keepIsValidating&&on(n.validatingFields,H),!e.shouldUnregister&&!P.keepDefaultValue&&on(i,H);k.state.next({values:Gt(s)}),k.state.next({...n,...P.keepDirty?{isDirty:ue()}:{}}),!P.keepIsValid&&R()},Zt=({disabled:I,name:P})=>{if(Mr(I)&&o.mount||I||l.disabled.has(P)){const ae=l.disabled.has(P)!==!!I;I?l.disabled.add(P):l.disabled.delete(P),ae&&o.mount&&!o.action&&R()}},Nn=(I,P={})=>{let H=Ce(r,I);const ie=Mr(P.disabled)||Mr(e.disabled),ae=!l.registerName.has(I)&&H&&H._f&&!H._f.mount;return wt(r,I,{...H||{},_f:{...H&&H._f?H._f:{ref:{name:I}},name:I,mount:!0,...P}}),l.mount.add(I),H&&!ae?Zt({disabled:Mr(P.disabled)?P.disabled:e.disabled,name:I}):Z(I,!0,P.value),{...ie?{disabled:P.disabled||e.disabled}:{},...e.progressive?{required:!!P.required,min:Vu(P.min),max:Vu(P.max),minLength:Vu(P.minLength),maxLength:Vu(P.maxLength),pattern:Vu(P.pattern)}:{},name:I,onChange:Le,onBlur:Le,ref:ye=>{if(ye){l.registerName.add(I),Nn(I,P),l.registerName.delete(I),H=Ce(r,I);const ke=Ht(ye.value)&&ye.querySelectorAll&&ye.querySelectorAll("input,select,textarea")[0]||ye,_e=XH(ke),Be=H._f.refs||[];if(_e?Be.find(_t=>_t===ke):ke===H._f.ref)return;const it={...H._f};_e?(it.refs=[...Be.filter(pv),ke,...Array.isArray(Ce(i,I))?[{}]:[]],it.ref={type:ke.type,name:I}):(it.ref=ke,delete it.refs),wt(r,I,{_f:it}),Z(I,!1,void 0,ke)}else H=Ce(r,I,{}),H._f&&(H._f.mount=!1),(e.shouldUnregister||P.shouldUnregister)&&!(VN(l.array,I)&&o.action)&&l.unMount.add(I)}}},nn=()=>e.shouldFocusError&&!e.shouldUseNativeValidation&&cd(r,Te,l.mount),br=I=>{Mr(I)&&(k.state.next({disabled:I}),cd(r,(P,H)=>{const ie=Ce(r,H);ie&&(P.disabled=ie._f.disabled||I,Array.isArray(ie._f.refs)&&ie._f.refs.forEach(ae=>{ae.disabled=ie._f.disabled||I}))},0,!1))},Pr=(I,P)=>async H=>{let ie,ae;H&&(H.preventDefault&&H.preventDefault(),H.persist&&H.persist());let ye=Gt(s);if(k.state.next({isSubmitting:!0}),e.resolver){const{errors:ke,values:_e}=await te();A(),n.errors=ke,ye=Gt(_e)}else await L({fields:r,eventType:po.SUBMIT});if(l.disabled.size)for(const ke of l.disabled)on(ye,ke);if(on(n.errors,UN),Pn(n.errors)){k.state.next({errors:{}});try{ie=await I(ye,H)}catch(ke){ae=ke}}else P&&await P({...n.errors},H),nn(),setTimeout(nn);if(k.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Pn(n.errors)&&!ae,submitCount:n.submitCount+1,errors:n.errors}),ae)throw ae;return ie},vr=(I,P={})=>{Ce(r,I)&&(Ht(P.defaultValue)?Ae(I,Gt(Ce(i,I))):(Ae(I,P.defaultValue),wt(i,I,Gt(P.defaultValue))),P.keepTouched||on(n.touchedFields,I),P.keepDirty||(on(n.dirtyFields,I),n.isDirty=P.defaultValue?ue(I,Gt(Ce(i,I))):ue()),P.keepError||(on(n.errors,I),x.isValid&&R()),k.state.next({...n}))},qt=(I,P={})=>{const H=I?Gt(I):i,ie=Gt(H),ae=Pn(I),ye=ie,ke=r;if(P.keepDefaultValues||(i=H),!P.keepValues){if(P.keepDirtyValues){const _e=new Set([...l.mount,...QN(Sa(i,s,void 0,ke),n.dirtyFields)]);for(const Be of Array.from(_e)){const it=Ce(n.dirtyFields,Be),_t=Ce(s,Be),xn=Ce(ye,Be);it&&!Ht(_t)?wt(ye,Be,_t):!it&&!Ht(xn)&&Ae(Be,xn)}}else{if(Qm&&Ht(I))for(const _e of l.mount){const Be=Ce(r,_e);if(Be&&Be._f){const it=Array.isArray(Be._f.refs)?Be._f.refs[0]:Be._f.ref;if(Pp(it)){const _t=it.closest("form");if(_t){_t.reset();break}}}}if(P.keepFieldsRef)for(const _e of l.mount)Ae(_e,Ce(ye,_e));else r={}}if(e.shouldUnregister){if(s=P.keepDefaultValues?Gt(i):{},P.keepFieldsRef)for(const _e of l.mount)wt(s,_e,Ce(ye,_e))}else s=Gt(ye);k.array.next({values:{...ye}}),k.state.next({name:void 0,type:void 0,values:{...ye}})}l={mount:P.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!x.isValid||!!P.keepIsValid||!!P.keepDirtyValues||!e.shouldUnregister&&!Pn(ye),o.watch=!!e.shouldUnregister,o.keepIsValid=!!P.keepIsValid,o.action=!1,P.keepErrors||(n.errors={}),k.state.next({submitCount:P.keepSubmitCount?n.submitCount:0,isDirty:ae?!1:P.keepDirty?n.isDirty:P.keepValues?ue():!!(P.keepDefaultValues&&!Nr(I,i)),isSubmitted:P.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ae?{}:P.keepDirtyValues?P.keepDefaultValues&&s?Sa(i,s,void 0,ke):n.dirtyFields:P.keepDefaultValues&&I?Sa(i,I,void 0,ke):P.keepDirty?n.dirtyFields:{},touchedFields:P.keepTouched?n.touchedFields:{},errors:P.keepErrors?n.errors:{},isSubmitSuccessful:P.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},si=(I,P)=>qt(Zn(I)?I(s):I,{...e.resetOptions,...P}),xr=(I,P={})=>{const H=Ce(r,I),ie=H&&H._f;if(ie){const ae=ie.refs?ie.refs[0]:ie.ref;ae.focus&&setTimeout(()=>{ae.focus(),P.shouldSelect&&Zn(ae.select)&&ae.select()})}},zr=I=>{const{name:P,type:H,values:ie,...ae}=I;n={...n,...ae}},Ne={control:{register:Nn,unregister:vn,getFieldState:Ie,handleSubmit:Pr,setError:Ze,_subscribe:vt,_runSchema:te,_updateIsValidating:A,_focusError:nn,_getWatch:Se,_getDirty:ue,_setValid:R,_setFieldArray:D,_setDisabledField:Zt,_setErrors:z,_getFieldArray:V,_reset:qt,_resetDefaultValues:()=>Zn(e.defaultValues)&&e.defaultValues().then(I=>{si(I,e.resetOptions),k.state.next({isLoading:!1})}),_removeUnmounted:U,_disableForm:br,_subjects:k,_proxyFormState:x,get _fields(){return r},get _formValues(){return s},get _state(){return o},set _state(I){o=I},get _defaultValues(){return i},get _names(){return l},set _names(I){l=I},get _formState(){return n},get _options(){return e},set _options(I){e={...e,...I},m=Rh(e.mode),g=Rh(e.reValidateMode)}},subscribe:Kt,trigger:oe,register:Nn,handleSubmit:Pr,watch:ft,setValue:Ae,setValues:Re,getValues:pe,reset:si,resetField:vr,resetDefaultValues:(I,P={})=>{if(i=Gt(I),!P.keepDirty){const H=Sa(i,s,void 0,r);n.dirtyFields=H,n.isDirty=!Pn(H)}P.keepIsValid||R(),k.state.next({...n,defaultValues:i})},clearErrors:Ue,unregister:vn,setError:Ze,setFocus:xr,getFieldState:Ie};return{...Ne,formControl:Ne}}function cU(t={}){const e=Ge.useRef(void 0),n=Ge.useRef(void 0),r=Ge.useRef(t.formControl),[i,s]=Ge.useState(()=>({...Gt(iO),isLoading:Zn(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1,defaultValues:Zn(t.defaultValues)?void 0:t.defaultValues}));if(!e.current||t.formControl&&r.current!==t.formControl)if(r.current=t.formControl,t.formControl)e.current={...t.formControl,formState:i},t.defaultValues&&!Zn(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:l,...u}=lU(t);e.current={...u,formState:i}}const o=e.current.control;return o._options=t,Rw(()=>{const l=o._subscribe({formState:o._proxyFormState,callback:()=>s({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return s(u=>({...u,isReady:!0})),o._formState.isReady=!0,l},[o]),Ge.useEffect(()=>o._disableForm(t.disabled),[o,t.disabled]),Ge.useEffect(()=>{t.mode&&(o._options.mode=t.mode),t.reValidateMode&&(o._options.reValidateMode=t.reValidateMode)},[o,t.mode,t.reValidateMode]),Ge.useEffect(()=>{t.errors&&(o._setErrors(t.errors),o._focusError())},[o,t.errors]),Ge.useEffect(()=>{t.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,t.shouldUnregister]),Ge.useEffect(()=>{if(o._proxyFormState.isDirty){const l=o._getDirty();l!==i.isDirty&&o._subjects.state.next({isDirty:l})}},[o,i.isDirty]),Ge.useEffect(()=>{var l;t.values&&!Nr(t.values,n.current)?(o._reset(t.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((l=o._options.resetOptions)===null||l===void 0)&&l.keepIsValid||o._setValid(),n.current=t.values,s(u=>({...u}))):o._resetDefaultValues()},[o,t.values]),Ge.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),e.current.formState=Ge.useMemo(()=>qN(i,o),[o,i]),e.current}const f_=(t,e,n)=>{if(t&&"reportValidity"in t){const r=Ce(n,e);t.setCustomValidity(r&&r.message||""),t.reportValidity()}},z0=(t,e)=>{for(const n in e.fields){const r=e.fields[n];r&&r.ref&&"reportValidity"in r.ref?f_(r.ref,n,t):r&&r.refs&&r.refs.forEach(i=>f_(i,n,t))}},h_=(t,e)=>{e.shouldUseNativeValidation&&z0(t,e);const n={};for(const r in t){const i=Ce(e.fields,r),s=Object.assign(t[r]||{},{ref:i&&i.refs?i.refs[0]:i&&i.ref});if(uU(e.names||Object.keys(t),r)){const o=Object.assign({},Ce(n,r));wt(o,"root",s),wt(n,r,o)}else wt(n,r,s)}return n},uU=(t,e)=>{const n=p_(e).replace(/[.*+?^${}()|\\]/g,"\\$&");return t.some(r=>p_(r).match(`^${n}\\.\\d+`))};function p_(t){return t.replace(/[\[\]]/g,"")}function $0(){return $0=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},$0.apply(null,arguments)}function m_(t,e){try{var n=t()}catch(r){return e(r)}return n&&n.then?n.then(void 0,e):n}function dU(t,e){for(var n=Object.create(null);t.length;){var r=t[0],i=r.code,s=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var l,u,f=r.unionErrors.reduce(function(g,b){return b.errors.length<g.errors.length?b:g}).errors[0];n[o]={message:(l=f?.message)!=null?l:s,type:(u=f?.code)!=null?u:i}}else n[o]={message:s,type:i};if("unionErrors"in r&&r.unionErrors.forEach(function(g){return g.errors.forEach(function(b){return t.push(b)})}),e){var h=n[o].types,m=h&&h[r.code];n[o]=Nw(o,e,n,i,m?[].concat(m,r.message):r.message)}t.shift()}return n}function fU(t,e){for(var n=Object.create(null),r=function(){var i=t[0],s=i.code,o=i.message,l=i.path.join(".");if(!n[l])if(i.code==="invalid_union"&&i.errors.length>0){var u,f,h=i.errors.reduce(function(b,x){return x.length<b.length?x:b})[0];n[l]={message:(u=h?.message)!=null?u:o,type:(f=h?.code)!=null?f:s}}else n[l]={message:o,type:s};if(i.code==="invalid_union"&&i.errors.forEach(function(b){return b.forEach(function(x){return t.push($0({},x,{path:[].concat(i.path,x.path)}))})}),e){var m=n[l].types,g=m&&m[i.code];n[l]=Nw(l,e,n,s,g?[].concat(g,i.message):i.message)}t.shift()};t.length;)r();return n}function hU(t,e,n){if(n===void 0&&(n={}),(function(r){return"_zod"in r&&typeof r._zod=="object"})(t))return function(r,i,s){try{return Promise.resolve(m_(function(){function o(u){return s.shouldUseNativeValidation&&z0({},s),{errors:{},values:n.raw?Object.assign({},r):u}}var l=t;return n.mode==="sync"?o(l.parse(r,e)):Promise.resolve(l.parseAsync(r,e)).then(o)},function(o){if((function(l){var u;return!(l==null||(u=l._zod)==null||(u=u.traits)==null||!u.has("$ZodError"))})(o))return{values:{},errors:h_(fU(o.issues,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw o}))}catch(o){return Promise.reject(o)}};if((function(r){return"_def"in r&&typeof r._def=="object"})(t))return function(r,i,s){try{return Promise.resolve(m_(function(){return Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](r,e)).then(function(o){return s.shouldUseNativeValidation&&z0({},s),{errors:{},values:n.raw?Object.assign({},r):o}})},function(o){if((function(l){return Array.isArray(l?.issues)})(o))return{values:{},errors:h_(dU(o.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw o}))}catch(o){return Promise.reject(o)}};throw new Error("Invalid input: not a Zod schema")}const g_={visible:!1,isDirty:!1,saving:!1},sO=E.createContext(null);function pU({children:t}){const[e,n]=E.useState(g_),r=E.useCallback(o=>{n(l=>({...l,...o,visible:o.visible??!!(o.isDirty||o.saving)}))},[]),i=E.useCallback(()=>{n(g_)},[]),s=E.useMemo(()=>({state:e,register:r,clear:i}),[e,r,i]);return y.jsx(sO.Provider,{value:s,children:t})}function oO(){const t=E.useContext(sO);if(!t)throw new Error("useSaveBar must be used within SaveBarProvider");return t}const aO=E.createContext(null);function mU({children:t}){const[e,n]=E.useState([]),r=E.useCallback(o=>{n(l=>l.filter(u=>u.id!==o))},[]),i=E.useCallback((o,l="neutral")=>{const u=`${Date.now()}-${Math.random().toString(36).slice(2,7)}`;n(f=>[...f,{id:u,message:o,tone:l}]),window.setTimeout(()=>r(u),4e3)},[r]),s=E.useMemo(()=>({toasts:e,push:i,dismiss:r}),[e,i,r]);return y.jsx(aO.Provider,{value:s,children:t})}function lO(){const t=E.useContext(aO);if(!t)throw new Error("useToast must be used within ToastProvider");return t}var bt;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},t.getValidEnumValues=i=>{const s=t.objectKeys(i).filter(l=>typeof i[i[l]]!="number"),o={};for(const l of s)o[l]=i[l];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},t.find=(i,s)=>{for(const o of i)if(s(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(bt||(bt={}));var y_;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(y_||(y_={}));const je=bt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mo=t=>{switch(typeof t){case"undefined":return je.undefined;case"string":return je.string;case"number":return Number.isNaN(t)?je.nan:je.number;case"boolean":return je.boolean;case"function":return je.function;case"bigint":return je.bigint;case"symbol":return je.symbol;case"object":return Array.isArray(t)?je.array:t===null?je.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?je.promise:typeof Map<"u"&&t instanceof Map?je.map:typeof Set<"u"&&t instanceof Set?je.set:typeof Date<"u"&&t instanceof Date?je.date:je.object;default:return je.unknown}},xe=bt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Is extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(s){return s.message},r={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let l=r,u=0;for(;u<o.path.length;){const f=o.path[u];u===o.path.length-1?(l[f]=l[f]||{_errors:[]},l[f]._errors.push(n(o))):l[f]=l[f]||{_errors:[]},l=l[f],u++}}};return i(this),r}static assert(e){if(!(e instanceof Is))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,bt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const s=i.path[0];n[s]=n[s]||[],n[s].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Is.create=t=>new Is(t);const B0=(t,e)=>{let n;switch(t.code){case xe.invalid_type:t.received===je.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case xe.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,bt.jsonStringifyReplacer)}`;break;case xe.unrecognized_keys:n=`Unrecognized key(s) in object: ${bt.joinValues(t.keys,", ")}`;break;case xe.invalid_union:n="Invalid input";break;case xe.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${bt.joinValues(t.options)}`;break;case xe.invalid_enum_value:n=`Invalid enum value. Expected ${bt.joinValues(t.options)}, received '${t.received}'`;break;case xe.invalid_arguments:n="Invalid function arguments";break;case xe.invalid_return_type:n="Invalid function return type";break;case xe.invalid_date:n="Invalid date";break;case xe.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:bt.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case xe.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case xe.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case xe.custom:n="Invalid input";break;case xe.invalid_intersection_types:n="Intersection results could not be merged";break;case xe.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case xe.not_finite:n="Number must be finite";break;default:n=e.defaultError,bt.assertNever(t)}return{message:n}};let gU=B0;function yU(){return gU}const bU=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,s=[...n,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let l="";const u=r.filter(f=>!!f).slice().reverse();for(const f of u)l=f(o,{data:e,defaultError:l}).message;return{...i,path:s,message:l}};function Me(t,e){const n=yU(),r=bU({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===B0?void 0:B0].filter(i=>!!i)});t.common.issues.push(r)}class jr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const i of n){if(i.status==="aborted")return Qe;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const i of n){const s=await i.key,o=await i.value;r.push({key:s,value:o})}return jr.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const i of n){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return Qe;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:e.value,value:r}}}const Qe=Object.freeze({status:"aborted"}),Ju=t=>({status:"dirty",value:t}),ii=t=>({status:"valid",value:t}),b_=t=>t.status==="aborted",v_=t=>t.status==="dirty",vc=t=>t.status==="valid",$p=t=>typeof Promise<"u"&&t instanceof Promise;var ze;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(ze||(ze={}));class $o{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const x_=(t,e)=>{if(vc(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Is(t.common.issues);return this._error=n,this._error}}};function st(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,l)=>{const{message:u}=t;return o.code==="invalid_enum_value"?{message:u??l.defaultError}:typeof l.data>"u"?{message:u??r??l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:u??n??l.defaultError}},description:i}}class ht{get description(){return this._def.description}_getType(e){return mo(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:mo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new jr,ctx:{common:e.parent.common,data:e.data,parsedType:mo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if($p(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mo(e)},i=this._parseSync({data:e,path:r.path,parent:r});return x_(r,i)}"~validate"(e){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mo(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:n});return vc(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>vc(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mo(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await($p(i)?i:Promise.resolve(i));return x_(r,s)}refine(e,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const o=e(i),l=()=>s.addIssue({code:xe.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new Sc({schema:this,typeName:et.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Oo.create(this,this._def)}nullable(){return kc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Pi.create(this)}promise(){return Up.create(this,this._def)}or(e){return Vp.create([this,e],this._def)}and(e){return Hp.create(this,e,this._def)}transform(e){return new Sc({...st(this._def),schema:this,typeName:et.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new U0({...st(this._def),innerType:this,defaultValue:n,typeName:et.ZodDefault})}brand(){return new VU({typeName:et.ZodBranded,type:this,...st(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new F0({...st(this._def),innerType:this,catchValue:n,typeName:et.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Ow.create(this,e)}readonly(){return q0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const vU=/^c[^\s-]{8,}$/i,xU=/^[0-9a-z]+$/,wU=/^[0-9A-HJKMNP-TV-Z]{26}$/i,SU=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,kU=/^[a-z0-9_-]{21}$/i,CU=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,EU=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,TU=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_U="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let gv;const AU=/^(?:(?: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])$/,RU=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,MU=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,NU=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,OU=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,DU=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,cO="((\\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])))",IU=new RegExp(`^${cO}$`);function uO(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function jU(t){return new RegExp(`^${uO(t)}$`)}function LU(t){let e=`${cO}T${uO(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function PU(t,e){return!!((e==="v4"||!e)&&AU.test(t)||(e==="v6"||!e)&&MU.test(t))}function zU(t,e){if(!CU.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function $U(t,e){return!!((e==="v4"||!e)&&RU.test(t)||(e==="v6"||!e)&&NU.test(t))}class To extends ht{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==je.string){const s=this._getOrReturnCtx(e);return Me(s,{code:xe.invalid_type,expected:je.string,received:s.parsedType}),Qe}const r=new jr;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),Me(i,{code:xe.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),Me(i,{code:xe.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const o=e.data.length>s.value,l=e.data.length<s.value;(o||l)&&(i=this._getOrReturnCtx(e,i),o?Me(i,{code:xe.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):l&&Me(i,{code:xe.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")TU.test(e.data)||(i=this._getOrReturnCtx(e,i),Me(i,{validation:"email",code:xe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")gv||(gv=new RegExp(_U,"u")),gv.test(e.data)||(i=this._getOrReturnCtx(e,i),Me(i,{validation:"emoji",code:xe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")SU.test(e.data)||(i=this._getOrReturnCtx(e,i),Me(i,{validation:"uuid",code:xe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")kU.test(e.data)||(i=this._getOrReturnCtx(e,i),Me(i,{validation:"nanoid",code:xe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")vU.test(e.data)||(i=this._getOrReturnCtx(e,i),Me(i,{validation:"cuid",code:xe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")xU.test(e.data)||(i=this._getOrReturnCtx(e,i),Me(i,{validation:"cuid2",code:xe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")wU.test(e.data)||(i=this._getOrReturnCtx(e,i),Me(i,{validation:"ulid",code:xe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Me(i,{validation:"url",code:xe.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Me(i,{validation:"regex",code:xe.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),Me(i,{code:xe.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),Me(i,{code:xe.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),Me(i,{code:xe.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?LU(s).test(e.data)||(i=this._getOrReturnCtx(e,i),Me(i,{code:xe.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?IU.test(e.data)||(i=this._getOrReturnCtx(e,i),Me(i,{code:xe.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?jU(s).test(e.data)||(i=this._getOrReturnCtx(e,i),Me(i,{code:xe.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?EU.test(e.data)||(i=this._getOrReturnCtx(e,i),Me(i,{validation:"duration",code:xe.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?PU(e.data,s.version)||(i=this._getOrReturnCtx(e,i),Me(i,{validation:"ip",code:xe.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?zU(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),Me(i,{validation:"jwt",code:xe.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?$U(e.data,s.version)||(i=this._getOrReturnCtx(e,i),Me(i,{validation:"cidr",code:xe.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?OU.test(e.data)||(i=this._getOrReturnCtx(e,i),Me(i,{validation:"base64",code:xe.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?DU.test(e.data)||(i=this._getOrReturnCtx(e,i),Me(i,{validation:"base64url",code:xe.invalid_string,message:s.message}),r.dirty()):bt.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:xe.invalid_string,...ze.errToObj(r)})}_addCheck(e){return new To({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ze.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ze.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ze.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ze.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ze.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ze.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ze.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ze.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ze.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ze.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ze.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ze.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ze.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...ze.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...ze.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ze.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...ze.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...ze.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...ze.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...ze.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...ze.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...ze.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...ze.errToObj(n)})}nonempty(e){return this.min(1,ze.errToObj(e))}trim(){return new To({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new To({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new To({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}To.create=t=>new To({checks:[],typeName:et.ZodString,coerce:t?.coerce??!1,...st(t)});function BU(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(t.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return s%o/10**i}class xc extends ht{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==je.number){const s=this._getOrReturnCtx(e);return Me(s,{code:xe.invalid_type,expected:je.number,received:s.parsedType}),Qe}let r;const i=new jr;for(const s of this._def.checks)s.kind==="int"?bt.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Me(r,{code:xe.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),Me(r,{code:xe.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),Me(r,{code:xe.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?BU(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),Me(r,{code:xe.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Me(r,{code:xe.not_finite,message:s.message}),i.dirty()):bt.assertNever(s);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ze.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ze.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ze.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ze.toString(n))}setLimit(e,n,r,i){return new xc({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ze.toString(i)}]})}_addCheck(e){return new xc({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ze.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ze.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ze.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ze.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ze.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ze.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:ze.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ze.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ze.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&bt.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}xc.create=t=>new xc({checks:[],typeName:et.ZodNumber,coerce:t?.coerce||!1,...st(t)});class Nd extends ht{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==je.bigint)return this._getInvalidInput(e);let r;const i=new jr;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),Me(r,{code:xe.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),Me(r,{code:xe.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Me(r,{code:xe.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):bt.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return Me(n,{code:xe.invalid_type,expected:je.bigint,received:n.parsedType}),Qe}gte(e,n){return this.setLimit("min",e,!0,ze.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ze.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ze.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ze.toString(n))}setLimit(e,n,r,i){return new Nd({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ze.toString(i)}]})}_addCheck(e){return new Nd({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ze.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ze.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ze.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ze.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ze.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Nd.create=t=>new Nd({checks:[],typeName:et.ZodBigInt,coerce:t?.coerce??!1,...st(t)});class V0 extends ht{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==je.boolean){const r=this._getOrReturnCtx(e);return Me(r,{code:xe.invalid_type,expected:je.boolean,received:r.parsedType}),Qe}return ii(e.data)}}V0.create=t=>new V0({typeName:et.ZodBoolean,coerce:t?.coerce||!1,...st(t)});class Bp extends ht{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==je.date){const s=this._getOrReturnCtx(e);return Me(s,{code:xe.invalid_type,expected:je.date,received:s.parsedType}),Qe}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return Me(s,{code:xe.invalid_date}),Qe}const r=new jr;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),Me(i,{code:xe.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),Me(i,{code:xe.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):bt.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Bp({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:ze.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:ze.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Bp.create=t=>new Bp({checks:[],coerce:t?.coerce||!1,typeName:et.ZodDate,...st(t)});class w_ extends ht{_parse(e){if(this._getType(e)!==je.symbol){const r=this._getOrReturnCtx(e);return Me(r,{code:xe.invalid_type,expected:je.symbol,received:r.parsedType}),Qe}return ii(e.data)}}w_.create=t=>new w_({typeName:et.ZodSymbol,...st(t)});class S_ extends ht{_parse(e){if(this._getType(e)!==je.undefined){const r=this._getOrReturnCtx(e);return Me(r,{code:xe.invalid_type,expected:je.undefined,received:r.parsedType}),Qe}return ii(e.data)}}S_.create=t=>new S_({typeName:et.ZodUndefined,...st(t)});class k_ extends ht{_parse(e){if(this._getType(e)!==je.null){const r=this._getOrReturnCtx(e);return Me(r,{code:xe.invalid_type,expected:je.null,received:r.parsedType}),Qe}return ii(e.data)}}k_.create=t=>new k_({typeName:et.ZodNull,...st(t)});class C_ extends ht{constructor(){super(...arguments),this._any=!0}_parse(e){return ii(e.data)}}C_.create=t=>new C_({typeName:et.ZodAny,...st(t)});class E_ extends ht{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ii(e.data)}}E_.create=t=>new E_({typeName:et.ZodUnknown,...st(t)});class Bo extends ht{_parse(e){const n=this._getOrReturnCtx(e);return Me(n,{code:xe.invalid_type,expected:je.never,received:n.parsedType}),Qe}}Bo.create=t=>new Bo({typeName:et.ZodNever,...st(t)});class T_ extends ht{_parse(e){if(this._getType(e)!==je.undefined){const r=this._getOrReturnCtx(e);return Me(r,{code:xe.invalid_type,expected:je.void,received:r.parsedType}),Qe}return ii(e.data)}}T_.create=t=>new T_({typeName:et.ZodVoid,...st(t)});class Pi extends ht{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==je.array)return Me(n,{code:xe.invalid_type,expected:je.array,received:n.parsedType}),Qe;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,l=n.data.length<i.exactLength.value;(o||l)&&(Me(n,{code:o?xe.too_big:xe.too_small,minimum:l?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(Me(n,{code:xe.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(Me(n,{code:xe.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,l)=>i.type._parseAsync(new $o(n,o,n.path,l)))).then(o=>jr.mergeArray(r,o));const s=[...n.data].map((o,l)=>i.type._parseSync(new $o(n,o,n.path,l)));return jr.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new Pi({...this._def,minLength:{value:e,message:ze.toString(n)}})}max(e,n){return new Pi({...this._def,maxLength:{value:e,message:ze.toString(n)}})}length(e,n){return new Pi({...this._def,exactLength:{value:e,message:ze.toString(n)}})}nonempty(e){return this.min(1,e)}}Pi.create=(t,e)=>new Pi({type:t,minLength:null,maxLength:null,exactLength:null,typeName:et.ZodArray,...st(e)});function rc(t){if(t instanceof pn){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Oo.create(rc(r))}return new pn({...t._def,shape:()=>e})}else return t instanceof Pi?new Pi({...t._def,type:rc(t.element)}):t instanceof Oo?Oo.create(rc(t.unwrap())):t instanceof kc?kc.create(rc(t.unwrap())):t instanceof Ba?Ba.create(t.items.map(e=>rc(e))):t}class pn extends ht{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=bt.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==je.object){const f=this._getOrReturnCtx(e);return Me(f,{code:xe.invalid_type,expected:je.object,received:f.parsedType}),Qe}const{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof Bo&&this._def.unknownKeys==="strip"))for(const f in i.data)o.includes(f)||l.push(f);const u=[];for(const f of o){const h=s[f],m=i.data[f];u.push({key:{status:"valid",value:f},value:h._parse(new $o(i,m,i.path,f)),alwaysSet:f in i.data})}if(this._def.catchall instanceof Bo){const f=this._def.unknownKeys;if(f==="passthrough")for(const h of l)u.push({key:{status:"valid",value:h},value:{status:"valid",value:i.data[h]}});else if(f==="strict")l.length>0&&(Me(i,{code:xe.unrecognized_keys,keys:l}),r.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const h of l){const m=i.data[h];u.push({key:{status:"valid",value:h},value:f._parse(new $o(i,m,i.path,h)),alwaysSet:h in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const f=[];for(const h of u){const m=await h.key,g=await h.value;f.push({key:m,value:g,alwaysSet:h.alwaysSet})}return f}).then(f=>jr.mergeObjectSync(r,f)):jr.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(e){return ze.errToObj,new pn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{const i=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:ze.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new pn({...this._def,unknownKeys:"strip"})}passthrough(){return new pn({...this._def,unknownKeys:"passthrough"})}extend(e){return new pn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new pn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:et.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new pn({...this._def,catchall:e})}pick(e){const n={};for(const r of bt.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new pn({...this._def,shape:()=>n})}omit(e){const n={};for(const r of bt.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new pn({...this._def,shape:()=>n})}deepPartial(){return rc(this)}partial(e){const n={};for(const r of bt.objectKeys(this.shape)){const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new pn({...this._def,shape:()=>n})}required(e){const n={};for(const r of bt.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Oo;)s=s._def.innerType;n[r]=s}return new pn({...this._def,shape:()=>n})}keyof(){return dO(bt.objectKeys(this.shape))}}pn.create=(t,e)=>new pn({shape:()=>t,unknownKeys:"strip",catchall:Bo.create(),typeName:et.ZodObject,...st(e)});pn.strictCreate=(t,e)=>new pn({shape:()=>t,unknownKeys:"strict",catchall:Bo.create(),typeName:et.ZodObject,...st(e)});pn.lazycreate=(t,e)=>new pn({shape:t,unknownKeys:"strip",catchall:Bo.create(),typeName:et.ZodObject,...st(e)});class Vp extends ht{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function i(s){for(const l of s)if(l.result.status==="valid")return l.result;for(const l of s)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const o=s.map(l=>new Is(l.ctx.common.issues));return Me(n,{code:xe.invalid_union,unionErrors:o}),Qe}if(n.common.async)return Promise.all(r.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const u of r){const f={...n,common:{...n.common,issues:[]},parent:null},h=u._parseSync({data:n.data,path:n.path,parent:f});if(h.status==="valid")return h;h.status==="dirty"&&!s&&(s={result:h,ctx:f}),f.common.issues.length&&o.push(f.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const l=o.map(u=>new Is(u));return Me(n,{code:xe.invalid_union,unionErrors:l}),Qe}}get options(){return this._def.options}}Vp.create=(t,e)=>new Vp({options:t,typeName:et.ZodUnion,...st(e)});function H0(t,e){const n=mo(t),r=mo(e);if(t===e)return{valid:!0,data:t};if(n===je.object&&r===je.object){const i=bt.objectKeys(e),s=bt.objectKeys(t).filter(l=>i.indexOf(l)!==-1),o={...t,...e};for(const l of s){const u=H0(t[l],e[l]);if(!u.valid)return{valid:!1};o[l]=u.data}return{valid:!0,data:o}}else if(n===je.array&&r===je.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let s=0;s<t.length;s++){const o=t[s],l=e[s],u=H0(o,l);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return n===je.date&&r===je.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Hp extends ht{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=(s,o)=>{if(b_(s)||b_(o))return Qe;const l=H0(s.value,o.value);return l.valid?((v_(s)||v_(o))&&n.dirty(),{status:n.value,value:l.data}):(Me(r,{code:xe.invalid_intersection_types}),Qe)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Hp.create=(t,e,n)=>new Hp({left:t,right:e,typeName:et.ZodIntersection,...st(n)});class Ba extends ht{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==je.array)return Me(r,{code:xe.invalid_type,expected:je.array,received:r.parsedType}),Qe;if(r.data.length<this._def.items.length)return Me(r,{code:xe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Qe;!this._def.rest&&r.data.length>this._def.items.length&&(Me(r,{code:xe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((o,l)=>{const u=this._def.items[l]||this._def.rest;return u?u._parse(new $o(r,o,r.path,l)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>jr.mergeArray(n,o)):jr.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new Ba({...this._def,rest:e})}}Ba.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ba({items:t,typeName:et.ZodTuple,rest:null,...st(e)})};class __ extends ht{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==je.map)return Me(r,{code:xe.invalid_type,expected:je.map,received:r.parsedType}),Qe;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([l,u],f)=>({key:i._parse(new $o(r,l,r.path,[f,"key"])),value:s._parse(new $o(r,u,r.path,[f,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const u of o){const f=await u.key,h=await u.value;if(f.status==="aborted"||h.status==="aborted")return Qe;(f.status==="dirty"||h.status==="dirty")&&n.dirty(),l.set(f.value,h.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const u of o){const f=u.key,h=u.value;if(f.status==="aborted"||h.status==="aborted")return Qe;(f.status==="dirty"||h.status==="dirty")&&n.dirty(),l.set(f.value,h.value)}return{status:n.value,value:l}}}}__.create=(t,e,n)=>new __({valueType:e,keyType:t,typeName:et.ZodMap,...st(n)});class Od extends ht{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==je.set)return Me(r,{code:xe.invalid_type,expected:je.set,received:r.parsedType}),Qe;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(Me(r,{code:xe.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(Me(r,{code:xe.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function o(u){const f=new Set;for(const h of u){if(h.status==="aborted")return Qe;h.status==="dirty"&&n.dirty(),f.add(h.value)}return{status:n.value,value:f}}const l=[...r.data.values()].map((u,f)=>s._parse(new $o(r,u,r.path,f)));return r.common.async?Promise.all(l).then(u=>o(u)):o(l)}min(e,n){return new Od({...this._def,minSize:{value:e,message:ze.toString(n)}})}max(e,n){return new Od({...this._def,maxSize:{value:e,message:ze.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Od.create=(t,e)=>new Od({valueType:t,minSize:null,maxSize:null,typeName:et.ZodSet,...st(e)});class A_ extends ht{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}A_.create=(t,e)=>new A_({getter:t,typeName:et.ZodLazy,...st(e)});class R_ extends ht{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return Me(n,{received:n.data,code:xe.invalid_literal,expected:this._def.value}),Qe}return{status:"valid",value:e.data}}get value(){return this._def.value}}R_.create=(t,e)=>new R_({value:t,typeName:et.ZodLiteral,...st(e)});function dO(t,e){return new wc({values:t,typeName:et.ZodEnum,...st(e)})}class wc extends ht{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return Me(n,{expected:bt.joinValues(r),received:n.parsedType,code:xe.invalid_type}),Qe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return Me(n,{received:n.data,code:xe.invalid_enum_value,options:r}),Qe}return ii(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return wc.create(e,{...this._def,...n})}exclude(e,n=this._def){return wc.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}wc.create=dO;class M_ extends ht{_parse(e){const n=bt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==je.string&&r.parsedType!==je.number){const i=bt.objectValues(n);return Me(r,{expected:bt.joinValues(i),received:r.parsedType,code:xe.invalid_type}),Qe}if(this._cache||(this._cache=new Set(bt.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=bt.objectValues(n);return Me(r,{received:r.data,code:xe.invalid_enum_value,options:i}),Qe}return ii(e.data)}get enum(){return this._def.values}}M_.create=(t,e)=>new M_({values:t,typeName:et.ZodNativeEnum,...st(e)});class Up extends ht{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==je.promise&&n.common.async===!1)return Me(n,{code:xe.invalid_type,expected:je.promise,received:n.parsedType}),Qe;const r=n.parsedType===je.promise?n.data:Promise.resolve(n.data);return ii(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Up.create=(t,e)=>new Up({type:t,typeName:et.ZodPromise,...st(e)});class Sc extends ht{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===et.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:o=>{Me(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async l=>{if(n.value==="aborted")return Qe;const u=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return u.status==="aborted"?Qe:u.status==="dirty"||n.value==="dirty"?Ju(u.value):u});{if(n.value==="aborted")return Qe;const l=this._def.schema._parseSync({data:o,path:r.path,parent:r});return l.status==="aborted"?Qe:l.status==="dirty"||n.value==="dirty"?Ju(l.value):l}}if(i.type==="refinement"){const o=l=>{const u=i.refinement(l,s);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?Qe:(l.status==="dirty"&&n.dirty(),o(l.value),{status:n.value,value:l.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>l.status==="aborted"?Qe:(l.status==="dirty"&&n.dirty(),o(l.value).then(()=>({status:n.value,value:l.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!vc(o))return Qe;const l=i.transform(o.value,s);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:l}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>vc(o)?Promise.resolve(i.transform(o.value,s)).then(l=>({status:n.value,value:l})):Qe);bt.assertNever(i)}}Sc.create=(t,e,n)=>new Sc({schema:t,typeName:et.ZodEffects,effect:e,...st(n)});Sc.createWithPreprocess=(t,e,n)=>new Sc({schema:e,effect:{type:"preprocess",transform:t},typeName:et.ZodEffects,...st(n)});class Oo extends ht{_parse(e){return this._getType(e)===je.undefined?ii(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Oo.create=(t,e)=>new Oo({innerType:t,typeName:et.ZodOptional,...st(e)});class kc extends ht{_parse(e){return this._getType(e)===je.null?ii(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}kc.create=(t,e)=>new kc({innerType:t,typeName:et.ZodNullable,...st(e)});class U0 extends ht{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===je.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}U0.create=(t,e)=>new U0({innerType:t,typeName:et.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...st(e)});class F0 extends ht{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return $p(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Is(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Is(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}F0.create=(t,e)=>new F0({innerType:t,typeName:et.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...st(e)});class N_ extends ht{_parse(e){if(this._getType(e)!==je.nan){const r=this._getOrReturnCtx(e);return Me(r,{code:xe.invalid_type,expected:je.nan,received:r.parsedType}),Qe}return{status:"valid",value:e.data}}}N_.create=t=>new N_({typeName:et.ZodNaN,...st(t)});class VU extends ht{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Ow extends ht{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Qe:s.status==="dirty"?(n.dirty(),Ju(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Qe:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new Ow({in:e,out:n,typeName:et.ZodPipeline})}}class q0 extends ht{_parse(e){const n=this._def.innerType._parse(e),r=i=>(vc(i)&&(i.value=Object.freeze(i.value)),i);return $p(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}q0.create=(t,e)=>new q0({innerType:t,typeName:et.ZodReadonly,...st(e)});var et;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(et||(et={}));const O_=To.create,HU=xc.create,UU=V0.create;Bo.create;const FU=Pi.create,qU=pn.create;Vp.create;Hp.create;Ba.create;wc.create;Up.create;Oo.create;kc.create;function GU(t){const e={};for(const[n,r]of Object.entries(t)){let i;switch(r.type){case"number":i=HU(),r.min!=null&&(i=i.min(r.min)),r.max!=null&&(i=i.max(r.max));break;case"boolean":i=UU();break;case"file[]":case"enum[]":i=FU(O_());break;default:i=O_()}r.required||(i=i.optional()),e[n]=i}return qU(e)}function tg(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim()}function ud(t,e){const n=e?.optionLabels?.[t]?.trim();return n||tg(t)}function WU(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function KU(t,e,n){const r=e.label?.trim()||tg(t),i=r.replace(new RegExp(`^${WU(n)}\\s+`,"i"),"");if(/^inventory$/i.test(n)){const s=r.replace(/^stock\s+/i,"").trim();if(s&&s!==r)return s}return/^pricing$/i.test(n)&&/cents/i.test(r)?r.replace(/\s*\(cents\)/i,"").trim()||r:i||r}const ZU=/(description|body|content|summary|bio|copy|caption|details)/i;function fO(t,e){if(e?.type==="richtext")return!0;const n=`${t} ${e?.label??""}`;return ZU.test(n)}function D_(t){const e=typeof t=="string"?t.trim():"";return e?{characters:e.length,words:e.split(/\s+/).filter(Boolean).length}:{characters:0,words:0}}function Dd(t){return/^https?:\/\//i.test(t)||t.startsWith("//")}function Va(t,e){if(e?.type==="file[]")return!0;const n=`${t} ${e?.label??""}`;return/(image|img|photo|avatar|thumbnail|thumb|cover)/i.test(n)}function hO(t){if(typeof t=="string"&&Dd(t))return{url:t};if(t&&typeof t=="object"&&"url"in t){const e=t.url,n=t.name;if(typeof e=="string"&&Dd(e))return{url:e,name:typeof n=="string"?n:void 0}}return null}function YU(t,e){const n=[];for(const[r,i]of Object.entries(t)){if(!Va(r,i))continue;const s=i.label?.trim()||r,o=e?.[r],l=Array.isArray(o)?o:[o];l.forEach((u,f)=>{const h=hO(u);h&&n.push({id:`${r}:${f}`,url:h.url,name:h.name||(l.length>1?`${s} ${f+1}`:s),field:r})})}return n}function G0(t){const e=Array.isArray(t)?t:t==null||t===""?[]:[t],n=[];for(const r of e){const i=hO(r);i&&n.push(i.url)}return n}function XU(t){return t.length>0&&t.every(([,e])=>e.type==="boolean")}function JU(t,e){const n=`${t} ${e?.label??""}`;return/(stock|inventory|qty|quantity)/i.test(n)}function ng(t,e){if(/^show[A-Z]/.test(t))return!1;if(/^specs$/i.test(e?.group??""))return!0;const n=`${t} ${e?.label??""}`;return/(material|fit|care|fabric|composition|^details$)/i.test(n)}function pO(t,e){const n=`${t} ${e?.label??""}`;return/(detail|notes|bio|bullets|body|message|html)/i.test(n)}function QU(t,e,n){if(e.type==="boolean"||e.type==="enum[]"||e.type==="richtext"||fO(t,e)||pO(t,e)||n==="record"&&Va(t,e))return"full"}function Dw(t){return`show${t.charAt(0).toUpperCase()}${t.slice(1)}`}function eF(t){const e={...t};for(const[n,r]of Object.entries(t)){if(r.type==="boolean"||!ng(n,r))continue;const i=Dw(n);e[i]||(e[i]={type:"boolean",default:!0,label:`Show ${r.label??tg(n)}`})}return e}function tF(t,e){const n={...e};for(const[r,i]of Object.entries(t)){if(i.type==="boolean"||!ng(r,i))continue;const s=Dw(r);!(s in n)||n[s]==null?n[s]=!0:n[s]=n[s]!==!1}return n}function nF(t){return t.charAt(0).toLowerCase()+t.slice(1)}function rF(t,e){const n=Dw(t),r=[n];t==="priceCents"&&r.push("showPrice");for(const i of r)if(e[i]?.type==="boolean")return i;return ng(t,e[t])?n:null}const W0={Pricing:"showPrice",Inventory:"showStock",Content:"showDescription"};function iF(t){return Object.keys(W0).find(e=>W0[e]===t)}function sF(t,e){if(!/^show[A-Z]/.test(t)||e[t]?.type!=="boolean")return!1;if(iF(t))return!0;const n=nF(t.slice(4));return e[n]?!0:t==="showPrice"&&!!e.priceCents}function Iw(t,e){const n=W0[t];return n&&e[n]?.type==="boolean"?n:null}function oF(t,e,n){const r=rF(t,e);return!r||n&&Iw(n,e)===r?null:r}const I_=["Details","Content","Specs","Pricing","Inventory","Media","Display","Status"];function aF(t,e){if(e.group?.trim())return e.group.trim();const r=(e.label?.trim()||tg(t)).split(/\s+/).filter(Boolean);return r.length>=2?r[0]:"General"}function lF(t,e){if(e.group?.trim())return e.group.trim();const n=t.toLowerCase(),r=(e.label??"").toLowerCase(),i=`${n} ${r}`;return/(image|img|photo|avatar|thumbnail|thumb|cover|media_url)/i.test(i)?"Media":/(price|cost|cents|amount|msrp)/i.test(i)?"Pricing":/(stock|inventory|qty|quantity)/i.test(i)?"Inventory":/^display$/i.test(e.group??"")||/^show[A-Z]/.test(t)?"Display":e.type==="boolean"||/(^|_)(active|enabled|published|status|visible)(_|$)/i.test(n)||/^(active|enabled|published|status|visible)$/i.test(r)?"Status":e.type==="richtext"||/(description|body|content|summary|bio)/i.test(i)?"Content":ng(t,e)?"Specs":"Details"}function cF(t,e){if(e!=="record")return t;const n=r=>{const i=I_.indexOf(r);return i===-1?I_.length+1:i};return[...t].sort((r,i)=>n(r.id)-n(i.id))}function uF(t,e){const n=[],r=new Map,i=new Set;for(const o of Object.entries(t)){const[l,u]=o;if(sF(l,t))continue;const f=e==="record"?lF(l,u):aF(l,u);u.group?.trim()&&i.add(f),r.has(f)||(r.set(f,[]),n.push(f)),r.get(f).push(o)}if(e==="config")for(const[o,l]of[...r.entries()]){if(l.length>1||i.has(o)||o==="General")continue;r.has("General")||(r.set("General",[]),n.unshift("General")),r.get("General").push(...l),r.delete(o);const u=n.indexOf(o);u>=0&&n.splice(u,1)}const s=n.filter(o=>r.has(o)).map(o=>({id:o,label:o,fields:r.get(o)}));return cF(s,e)}function Fp(t){const e=Array.isArray(t)?t:[t];for(const n of e){if(typeof n=="string"&&Dd(n))return n;if(n&&typeof n=="object"&&"url"in n){const r=n.url;if(typeof r=="string"&&Dd(r))return r}}return null}function dF(t,e){for(const[n,r]of Object.entries(t))if(Va(n,r)&&Fp(e?.[n]))return n;for(const[n,r]of Object.entries(t))if(Va(n,r))return n;return null}function fF(t){return t.join(",")}function Pc({meta:t,disabled:e,multiple:n=!1,label:r,onUpload:i}){const s=E.useRef(null),[o,l]=E.useState(!1),[u,f]=E.useState(null),[h,m]=E.useState(!1),g=async b=>{if(!b||e||o)return;const x=Array.from(b);if(x.length){l(!0),f(null);try{await i(n?x:x.slice(0,1))}catch(S){f(S instanceof Error?S.message:"Upload failed")}finally{l(!1),s.current&&(s.current.value="")}}};return y.jsxs("div",{className:"vertebr-upload",children:[y.jsxs("div",{className:"vertebr-upload-drop","data-busy":o?"true":void 0,"data-drag":h?"true":void 0,onDragEnter:b=>{b.preventDefault(),m(!0)},onDragOver:b=>{b.preventDefault(),m(!0)},onDragLeave:b=>{b.preventDefault(),m(!1)},onDrop:b=>{b.preventDefault(),m(!1),g(b.dataTransfer.files)},children:[y.jsx("p",{className:"vertebr-upload-copy",children:o?"Uploading…":r??(n?"Drop images here or browse":"Drop an image here or browse")}),y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:e||o,onClick:()=>s.current?.click(),children:n?"Choose images":"Choose image"}),y.jsx("input",{ref:s,type:"file",accept:fF(t.accept),multiple:n,hidden:!0,onChange:b=>{g(b.target.files)}})]}),u?y.jsx("p",{className:"vertebr-upload-error",role:"alert",children:u}):null]})}var zc=MM();const hF=RM(zc);var pF=Object.defineProperty,jw=(t,e)=>pF(t,"name",{value:e,configurable:!0});function K0(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}jw(K0,"setRef");function mO(...t){return e=>{let n=!1;const r=t.map(i=>{const s=K0(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():K0(t[i],null)}}}}jw(mO,"composeRefs");function an(...t){return E.useCallback(mO(...t),t)}jw(an,"useComposedRefs");var mF=Object.defineProperty,Si=(t,e)=>mF(t,"name",{value:e,configurable:!0});function Ha(t){const e=E.forwardRef((n,r)=>{let{children:i,...s}=n,o=null,l=!1;const u=[];Z0(i)&&typeof Mh=="function"&&(i=Mh(i._payload)),E.Children.forEach(i,g=>{if(vO(g)){l=!0;const b=g;let x="child"in b.props?b.props.child:b.props.children;Z0(x)&&typeof Mh=="function"&&(x=Mh(x._payload)),o=yF(b,x),u.push(o?.props?.children)}else u.push(g)}),o?o=E.cloneElement(o,void 0,u):!l&&E.Children.count(i)===1&&E.isValidElement(i)&&(o=i);const f=o?bO(o):void 0,h=an(r,f);if(!o){if(i||i===0)throw new Error(l?xF(t):vF(t));return i}const m=yO(s,o.props??{});return o.type!==E.Fragment&&(m.ref=r?h:f),E.cloneElement(o,m)});return e.displayName=`${t}.Slot`,e}Si(Ha,"createSlot");var gO=Symbol.for("radix.slottable");function gF(t){const e=Si(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=gO,e}Si(gF,"createSlottable");var yF=Si((t,e)=>{if("child"in t.props){const n=t.props.child;return E.isValidElement(n)?E.cloneElement(n,void 0,t.props.children(n.props.children)):null}return E.isValidElement(e)?e:null},"getSlottableElementFromSlottable");function yO(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]=(...l)=>{const u=s(...l);return i(...l),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}Si(yO,"mergeProps");function bO(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}Si(bO,"getElementRef");function vO(t){return E.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===gO}Si(vO,"isSlottable");var bF=Symbol.for("react.lazy");function Z0(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===bF&&"_payload"in t&&xO(t._payload)}Si(Z0,"isLazyComponent");function xO(t){return typeof t=="object"&&t!==null&&"then"in t}Si(xO,"isPromiseLike");var vF=Si(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),xF=Si(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Mh=Kd[" use ".trim().toString()],wF=Object.defineProperty,SF=(t,e)=>wF(t,"name",{value:e,configurable:!0}),kF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Rn=kF.reduce((t,e)=>{const n=Ha(`Primitive.${e}`),r=E.forwardRef((i,s)=>{const{asChild:o,...l}=i,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),y.jsx(u,{...l,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function wO(t,e){t&&zc.flushSync(()=>t.dispatchEvent(e))}SF(wO,"dispatchDiscreteCustomEvent");var CF=Object.defineProperty,EF=(t,e)=>CF(t,"name",{value:e,configurable:!0}),TF=E.forwardRef(EF(function(e,n){return y.jsx(Rn.label,{...e,ref:n,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}})},"Label")),yv=TF,_F=Object.defineProperty,$c=(t,e)=>_F(t,"name",{value:e,configurable:!0}),SO=!!(typeof window<"u"&&window.document&&window.document.createElement);function mn(t,e,{checkForDefaultPrevented:n=!0}={}){return $c(function(i){if(t?.(i),n===!1||!i||!i.defaultPrevented)return e?.(i)},"handleEvent")}$c(mn,"composeEventHandlers");function AF(t){if(!SO)throw new Error("Cannot access window outside of the DOM");return t?.ownerDocument?.defaultView??window}$c(AF,"getOwnerWindow");function Y0(t){if(!SO)throw new Error("Cannot access document outside of the DOM");return t?.ownerDocument??document}$c(Y0,"getOwnerDocument");function kO(t,e=!1){const{activeElement:n}=Y0(t);if(!n?.nodeName)return null;if(CO(n)&&n.contentDocument)return kO(n.contentDocument.body,e);if(e){const r=n.getAttribute("aria-activedescendant");if(r){const i=Y0(n).getElementById(r);if(i)return i}}return n}$c(kO,"getActiveElement");function CO(t){return t.tagName==="IFRAME"}$c(CO,"isFrame");var RF=Object.defineProperty,Qr=(t,e)=>RF(t,"name",{value:e,configurable:!0});function MF(t,e){const n=E.createContext(e);n.displayName=t+"Context";const r=Qr(s=>{const{children:o,...l}=s,u=E.useMemo(()=>l,Object.values(l));return y.jsx(n.Provider,{value:u,children:o})},"Provider");r.displayName=t+"Provider";function i(s,o={}){const{optional:l=!1}=o,u=E.useContext(n);if(u)return u;if(e!==void 0)return e;if(!l)throw new Error(`\`${s}\` must be used within \`${t}\``)}return Qr(i,"useContext"),[r,i]}Qr(MF,"createContext");function Bc(t,e=[]){let n=[];function r(s,o){const l=E.createContext(o);l.displayName=s+"Context";const u=n.length;n=[...n,o];const f=Qr(m=>{const{scope:g,children:b,...x}=m,S=g?.[t]?.[u]||l,k=E.useMemo(()=>x,Object.values(x));return y.jsx(S.Provider,{value:k,children:b})},"Provider");f.displayName=s+"Provider";function h(m,g,b={}){const{optional:x=!1}=b,S=g?.[t]?.[u]||l,k=E.useContext(S);if(k)return k;if(o!==void 0)return o;if(!x)throw new Error(`\`${m}\` must be used within \`${s}\``)}return Qr(h,"useContext"),[f,h]}Qr(r,"createContext");const i=Qr(()=>{const s=n.map(o=>E.createContext(o));return Qr(function(l){const u=l?.[t]||s;return E.useMemo(()=>({[`__scope${t}`]:{...l,[t]:u}}),[l,u])},"useScope")},"createScope");return i.scopeName=t,[r,EO(i,...e)]}Qr(Bc,"createContextScope");function EO(...t){const e=t[0];if(t.length===1)return e;const n=Qr(()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return Qr(function(s){const o=r.reduce((l,{useScope:u,scopeName:f})=>{const m=u(s)[`__scope${f}`];return{...l,...m}},{});return E.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])},"useComposedScopes")},"createScope");return n.scopeName=e.scopeName,n}Qr(EO,"composeContextScopes");var ir=globalThis?.document?E.useLayoutEffect:()=>{},NF=Object.defineProperty,OF=(t,e)=>NF(t,"name",{value:e,configurable:!0}),j_=Kd[" useEffectEvent ".trim().toString()],L_=Kd[" useInsertionEffect ".trim().toString()];function TO(t){if(typeof j_=="function")return j_(t);const e=E.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof L_=="function"?L_(()=>{e.current=t}):ir(()=>{e.current=t}),E.useMemo(()=>((...n)=>e.current?.(...n)),[])}OF(TO,"useEffectEvent");var DF=Object.defineProperty,sf=(t,e)=>DF(t,"name",{value:e,configurable:!0}),IF=Kd[" useInsertionEffect ".trim().toString()]||ir;function qp({prop:t,defaultProp:e,onChange:n=sf(()=>{},"onChange"),caller:r}){const[i,s,o]=_O({defaultProp:e,onChange:n}),l=t!==void 0,u=l?t:i,f=E.useCallback(h=>{if(l){const m=AO(h)?h(t):h;m!==t&&o.current?.(m)}else s(h)},[l,t,s,o]);return[u,f]}sf(qp,"useControllableState");function _O({defaultProp:t,onChange:e}){const[n,r]=E.useState(t),i=E.useRef(n),s=E.useRef(e);return IF(()=>{s.current=e},[e]),E.useEffect(()=>{i.current!==n&&(s.current?.(n),i.current=n)},[n,i]),[n,r,s]}sf(_O,"useUncontrolledState");function AO(t){return typeof t=="function"}sf(AO,"isFunction");var P_=Symbol("RADIX:SYNC_STATE");function jF(t,e,n,r){const{prop:i,defaultProp:s,onChange:o,caller:l}=e,u=i!==void 0,f=TO(o),h=[{...n,state:s}];r&&h.push(r);const[m,g]=E.useReducer((k,C)=>{if(C.type===P_)return{...k,state:C.state};const _=t(k,C);return u&&!Object.is(_.state,k.state)&&f(_.state),_},...h),b=m.state,x=E.useRef(b);E.useEffect(()=>{x.current!==b&&(x.current=b,u||f(b))},[b,x,u]);const S=E.useMemo(()=>i!==void 0?{...m,state:i}:m,[m,i]);return E.useEffect(()=>{u&&!Object.is(i,m.state)&&g({type:P_,state:i})},[i,m.state,u]),[S,g]}sf(jF,"useControllableStateReducer");var LF=Object.defineProperty,PF=(t,e)=>LF(t,"name",{value:e,configurable:!0});function Lw(t){const[e,n]=E.useState(void 0);return ir(()=>{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,l;if("borderBoxSize"in s){const u=s.borderBoxSize,f=Array.isArray(u)?u[0]:u;o=f.inlineSize,l=f.blockSize}else o=t.offsetWidth,l=t.offsetHeight;n({width:o,height:l})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}PF(Lw,"useSize");var zF=Object.defineProperty,Vo=(t,e)=>zF(t,"name",{value:e,configurable:!0}),Pw="Switch",[$F,dne]=Bc(Pw),[BF,zw]=$F(Pw);function RO(t){const{__scopeSwitch:e,checked:n,children:r,defaultChecked:i,disabled:s,form:o,name:l,onCheckedChange:u,required:f,value:h="on",internal_do_not_use_render:m}=t,[g,b]=qp({prop:n,defaultProp:i??!1,onChange:u,caller:Pw}),[x,S]=E.useState(null),[k,C]=E.useState(null),_=E.useRef(!1),[M,R]=E.useReducer(D=>D+1,0),A=x?!!o||!!x.closest("form"):!0,O={checked:g,setChecked:b,disabled:s,control:x,setControl:S,name:l,form:o,value:h,hasConsumerStoppedPropagationRef:_,userInteractionCount:M,onUserInteraction:R,required:f,defaultChecked:i,isFormControl:A,bubbleInput:k,setBubbleInput:C};return y.jsx(BF,{scope:e,...O,children:MO(m)?m(O):r})}Vo(RO,"SwitchProvider");var VF="SwitchTrigger",HF=E.forwardRef(Vo(function({__scopeSwitch:e,onClick:n,...r},i){const{control:s,form:o,value:l,disabled:u,checked:f,required:h,setControl:m,setChecked:g,hasConsumerStoppedPropagationRef:b,onUserInteraction:x,isFormControl:S,bubbleInput:k}=zw(VF,e),C=an(i,m),_=E.useRef(f);return E.useEffect(()=>{const M=o?s?.ownerDocument.getElementById(o):s?.form;if(M instanceof HTMLFormElement){const R=Vo(()=>g(_.current),"reset");return M.addEventListener("reset",R),()=>M.removeEventListener("reset",R)}},[s,o,g]),y.jsx(Rn.button,{type:"button",role:"switch","aria-checked":f,"aria-required":h,"data-state":$w(f),"data-disabled":u?"":void 0,disabled:u,value:l,...r,ref:C,onClick:mn(n,M=>{x(),g(R=>!R),k&&S&&(b.current=M.isPropagationStopped(),b.current||M.stopPropagation())})})},"SwitchTrigger")),z_=E.forwardRef(Vo(function(e,n){const{__scopeSwitch:r,name:i,checked:s,defaultChecked:o,required:l,disabled:u,value:f,onCheckedChange:h,form:m,...g}=e;return y.jsx(RO,{__scopeSwitch:r,checked:s,defaultChecked:o,disabled:u,required:l,onCheckedChange:h,name:i,form:m,value:f,internal_do_not_use_render:({isFormControl:b})=>y.jsxs(y.Fragment,{children:[y.jsx(HF,{...g,ref:n,__scopeSwitch:r}),b&&y.jsx(qF,{__scopeSwitch:r})]})})},"Switch")),UF="SwitchThumb",$_=E.forwardRef(Vo(function(e,n){const{__scopeSwitch:r,...i}=e,s=zw(UF,r);return y.jsx(Rn.span,{"data-state":$w(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:n})},"SwitchThumb")),FF="SwitchBubbleInput",qF=E.forwardRef(Vo(function({__scopeSwitch:e,onClick:n,...r},i){const{control:s,hasConsumerStoppedPropagationRef:o,userInteractionCount:l,checked:u,defaultChecked:f,required:h,disabled:m,name:g,value:b,form:x,bubbleInput:S,setBubbleInput:k}=zw(FF,e),C=an(i,k),_=Lw(s),M=E.useRef(!1),R=E.useRef(u),A=E.useRef(l);E.useEffect(()=>{const D=S;if(!D)return;const j=window.HTMLInputElement.prototype,q=Object.getOwnPropertyDescriptor(j,"checked").set,Z=l!==A.current;A.current=l;const G=R.current!==u;R.current=u;const ee=!(Z&&o.current);if(G&&q){M.current=!Z;const te=new Event("click",{bubbles:ee});q.call(D,u),D.dispatchEvent(te),M.current=!1}},[S,u,o,l]);const O=E.useRef(u);return y.jsx(Rn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??O.current,required:h,disabled:m,name:g,value:b,form:x,...r,tabIndex:-1,ref:C,onClick:mn(n,D=>{M.current&&D.stopPropagation()}),style:{...r.style,..._,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function MO(t){return typeof t=="function"}Vo(MO,"isFunction");function $w(t){return t?"checked":"unchecked"}Vo($w,"getState");function NO({name:t,label:e,form:n}){const r=n.watch(t)!==!1;return E.useEffect(()=>{n.register(t)},[n,t]),y.jsx(OO,{visible:r,label:e,onChange:i=>n.setValue(t,i,{shouldDirty:!0,shouldTouch:!0})})}function OO({visible:t,label:e,dirty:n,disabled:r,onChange:i}){return y.jsx("button",{type:"button",className:"vertebr-visibility-btn","data-dirty":n?"true":void 0,"aria-pressed":t,"aria-label":t?`Hide ${e} on storefront`:`Show ${e} on storefront`,title:t?"Visible on storefront":"Hidden on storefront",disabled:r,onClick:s=>{s.stopPropagation(),i(!t)},children:t?y.jsx(GF,{}):y.jsx(WF,{})})}function GF(){return y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}),y.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function WF(){return y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}),y.jsx("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}),y.jsx("path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}),y.jsx("path",{d:"m2 2 20 20"})]})}const KF=/(cents|priceCents|amountCents)/i,B_=/(price|amount|cost|total|msrp)/i;function Bw(t,e){return KF.test(t)||/cents/i.test(e?.label??"")}function DO(t,e){return Bw(t,e)?!0:B_.test(t)||B_.test(e?.label??"")}function IO(t,e){return e?t/100:t}function ZF(t,e){return e?Math.round(t*100):t}function X0(t,e){const n=e?.asCents??!0,r=e?.currency??"USD",i=IO(t,n);try{return new Intl.NumberFormat(void 0,{style:"currency",currency:r,minimumFractionDigits:2,maximumFractionDigits:2}).format(i)}catch{return`$${i.toFixed(2)}`}}function bv(t,e=!0){return typeof t!="number"||!Number.isFinite(t)?"":IO(t,e).toFixed(2)}function YF(t,e=!0){const n=t.replace(/[^0-9.-]/g,"");if(!n||n==="-"||n==="."||n==="-.")return;const r=Number(n);if(Number.isFinite(r))return ZF(r,e)}function gp({family:t,bodyWeight:e=400,headingWeight:n=700,compact:r=!1}){const i=`"${t.replace(/"/g,"")}", ui-sans-serif, sans-serif`,s={fontFamily:i,fontWeight:n},o={fontFamily:i,fontWeight:e};return y.jsxs("div",{className:"vertebr-font-preview-sample","data-compact":r?"true":void 0,children:[y.jsx("span",{className:"vertebr-font-preview-eyebrow",style:s,children:"Eyebrow label"}),y.jsx("strong",{className:"vertebr-font-preview-heading",style:s,children:"The quick brown fox"}),y.jsx("p",{className:"vertebr-font-preview-body",style:o,children:"Jumps over the lazy dog. Maxer Mentality essentials for people who hold the standard."}),r?null:y.jsxs(y.Fragment,{children:[y.jsxs("p",{className:"vertebr-font-preview-alphabet",style:o,children:["ABCDEFGHIJKLMNOPQRSTUVWXYZ",y.jsx("br",{}),"abcdefghijklmnopqrstuvwxyz",y.jsx("br",{}),"0123456789"]}),y.jsxs("div",{className:"vertebr-font-preview-weights",style:o,children:[y.jsx("span",{style:{fontWeight:400},children:"Regular 400"}),y.jsx("span",{style:{fontWeight:600},children:"Semibold 600"}),y.jsx("span",{style:{fontWeight:700},children:"Bold 700"})]})]})]})}function jO({items:t,apiBase:e="/admin/api"}){const n=E.useId().replace(/:/g,""),r=E.useMemo(()=>jH(t,e),[t,e]);return E.useEffect(()=>{const i=r.map(l=>$N(l)).join("");if(!i)return;const s=i.match(/url\("([^"]+)"\)/)?.[1]??null;console.info("[mm:fonts] FontFaceInjector",{items:r.length,cssRules:(i.match(/@font-face/g)??[]).length,apiBase:e,sampleUrl:s,usesFirebase:i.includes("firebasestorage.googleapis.com")});const o=document.createElement("style");return o.id=`vertebr-font-faces-${n}`,o.textContent=i,document.head.appendChild(o),()=>{o.remove()}},[r,n]),null}function Hu(t,e){return t?e==="heading"?t.files.find(n=>n.weight>=600)?.weight??700:t.files.find(n=>n.weight>=400&&n.weight<600)?.weight??400:e==="heading"?700:400}function XF({id:t,value:e,label:n,description:r,readOnly:i,fonts:s,loading:o,onChange:l,onRefreshFonts:u,fontApiBase:f="/admin/api"}){const[h,m]=E.useState(!1),[g,b]=E.useState(""),x=E.useRef(""),S=typeof e=="string"?e.trim():"";E.useEffect(()=>{h&&u&&u()},[h,u]),E.useEffect(()=>{h&&(x.current=S,b(S))},[h,S]);const k=(A=!1)=>{A&&g!==x.current&&l(x.current),m(!1)},C=A=>{b(A),l(A)},_=E.useMemo(()=>s.find(A=>A.id===S)??null,[s,S]),M=E.useMemo(()=>g===""?null:s.find(A=>A.id===g)??null,[s,g]),R=E.useMemo(()=>{const A=[],O=new Set;for(const D of[_,M])!D||O.has(D.id)||(O.add(D.id),A.push(D));return A},[M,_]);return y.jsxs("div",{className:"vertebr-font-picker",children:[y.jsx(jO,{items:R,apiBase:f}),y.jsxs("div",{className:"vertebr-font-picker-current",children:[y.jsxs("div",{children:[y.jsx("strong",{children:_?.label??"Default system fonts"}),_?y.jsx("span",{children:_.family}):y.jsx("span",{children:"Manrope / Syne until a library font is chosen"})]}),i?y.jsx("span",{id:t,className:"vertebr-font-picker-ro-anchor"}):y.jsx("button",{id:t,type:"button",className:"vertebr-btn",onClick:()=>m(!0),children:"Choose font"})]}),_?y.jsx("div",{className:"vertebr-font-picker-preview",children:y.jsx(gp,{family:_.family,bodyWeight:Hu(_,"body"),headingWeight:Hu(_,"heading"),compact:!0})}):null,h?y.jsx("div",{className:"vertebr-font-picker-modal-backdrop",onClick:()=>k(!0),children:y.jsxs("div",{className:"vertebr-font-picker-modal",role:"dialog","aria-labelledby":`${t}-font-picker-title`,onClick:A=>A.stopPropagation(),children:[y.jsxs("div",{className:"vertebr-font-picker-modal-head",children:[y.jsxs("div",{children:[y.jsx("h3",{id:`${t}-font-picker-title`,children:n??"Choose a font"}),r?y.jsx("p",{children:r}):null]}),y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>k(!0),children:"Close"})]}),o?y.jsx("div",{className:"vertebr-empty",children:"Loading fonts…"}):s.length===0?y.jsx("div",{className:"vertebr-empty",children:"No fonts in the library yet. Open Font Library to upload or add Google Fonts."}):y.jsxs("div",{className:"vertebr-font-picker-modal-body",children:[y.jsx("div",{className:"vertebr-font-picker-grid-scroll",children:y.jsxs("div",{className:"vertebr-font-picker-grid",children:[y.jsxs("button",{type:"button",className:"vertebr-font-picker-option","data-active":g===""||void 0,onClick:()=>C(""),children:[y.jsx("strong",{children:"Default"}),y.jsx("span",{children:"Manrope / Syne"})]}),s.map(A=>y.jsxs("button",{type:"button",className:"vertebr-font-picker-option","data-active":A.id===g||void 0,style:{fontFamily:`"${A.family}", ui-sans-serif, sans-serif`,fontWeight:Hu(A,"heading")},onClick:()=>C(A.id),children:[y.jsx("strong",{children:A.label}),y.jsx("span",{children:A.family}),y.jsx("em",{children:"The quick brown fox"})]},A.id))]})}),y.jsxs("aside",{className:"vertebr-font-picker-detail",children:[y.jsx("p",{className:"vertebr-font-picker-detail-label",children:"Preview"}),g===""?y.jsx(gp,{family:"Manrope",bodyWeight:400,headingWeight:700}):M?y.jsx(gp,{family:M.family,bodyWeight:Hu(M,"body"),headingWeight:Hu(M,"heading")}):y.jsx("div",{className:"vertebr-empty",children:"Select a font to preview."})]})]}),y.jsxs("div",{className:"vertebr-font-picker-modal-actions",children:[y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>k(!0),children:"Cancel"}),y.jsx("button",{type:"button",className:"vertebr-btn",disabled:o,onClick:()=>k(!1),children:"Done"})]})]})}):null]})}var vv={exports:{}},xv={};var V_;function JF(){if(V_)return xv;V_=1;var t=Wd();function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue;function l(m,g){var b=g(),x=r({inst:{value:b,getSnapshot:g}}),S=x[0].inst,k=x[1];return s(function(){S.value=b,S.getSnapshot=g,u(S)&&k({inst:S})},[m,b,g]),i(function(){return u(S)&&k({inst:S}),m(function(){u(S)&&k({inst:S})})},[m]),o(b),b}function u(m){var g=m.getSnapshot;m=m.value;try{var b=g();return!n(m,b)}catch{return!0}}function f(m,g){return g()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:l;return xv.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:h,xv}var H_;function LO(){return H_||(H_=1,vv.exports=JF()),vv.exports}var PO=LO();function zn(t){this.content=t}zn.prototype={constructor:zn,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 zn(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 zn(n)},addToStart:function(t,e){return new zn([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new zn(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 zn(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=zn.from(t),t.size?new zn(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=zn.from(t),t.size?new zn(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=zn.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}};zn.from=function(t){if(t instanceof zn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new zn(e)};function zO(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){let o=i.text,l=s.text,u=0;for(;o[u]==l[u];u++)n++;return u&&u<o.length&&u<l.length&&VO(o.charCodeAt(u-1))&&BO(o.charCodeAt(u))&&n--,n}if(i.content.size||s.content.size){let o=zO(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function $O(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),l=e.child(--s),u=o.nodeSize;if(o==l){n-=u,r-=u;continue}if(!o.sameMarkup(l))return{a:n,b:r};if(o.isText&&o.text!=l.text){let f=o.text,h=l.text,m=f.length,g=h.length;for(;m>0&&g>0&&f[m-1]==h[g-1];)m--,g--,n--,r--;return m&&g&&m<f.length&&VO(f.charCodeAt(m-1))&&BO(f.charCodeAt(m))&&(n++,r++),{a:n,b:r}}if(o.content.size||l.content.size){let f=$O(o.content,l.content,n-1,r-1);if(f)return f}n-=u,r-=u}}function BO(t){return t>=56320&&t<57344}function VO(t){return t>=55296&&t<56320}class de{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,l=0;l<n;o++){let u=this.content[o],f=l+u.nodeSize;if(f>e&&r(u,i+l,s||null,o)!==!1&&u.content.size){let h=l+1;u.nodesBetween(Math.max(0,e-h),Math.min(u.content.size,n-h),r,i+h)}l=f}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(l,u)=>{let f=l.isText?l.text.slice(Math.max(e,u)-u,n-u):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&f||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=f},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 de(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 l=this.content[s],u=o+l.nodeSize;u>e&&((o<e||u>n)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,n-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,n-o-1))),r.push(l),i+=l.nodeSize),o=u}return new de(r,i)}cutByIndex(e,n){return e==n?de.empty:e==0&&n==this.content.length?this:new de(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 de(i,s)}addToStart(e){return new de([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new de(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 zO(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return $O(this,e,n,r)}findIndex(e){if(e==0)return Nh(0,e);if(e==this.size)return Nh(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?Nh(n+1,s):Nh(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 de.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return de.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return de.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 de(n||e,r)}static from(e){if(!e)return de.empty;if(e instanceof de)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new de([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 wv={index:0,offset:0};function Nh(t,e){return wv.index=t,wv.offset=e,wv}function Gp(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(!Gp(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Gp(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let jt=class J0{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&&Gp(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 J0.none;if(e instanceof J0)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};jt.none=[];class Id extends Error{}class Ee{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=UO(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new Ee(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Ee(HO(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 Ee.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 Ee(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 Ee(e,r,i)}}Ee.empty=new Ee(de.empty,0,0);function HO(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:l}=t.findIndex(n);if(i==e||s.isText){if(l!=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(HO(s.content,e-i-1,n-i-1)))}function UO(t,e,n,r,i,s){let{index:o,offset:l}=t.findIndex(e),u=t.maybeChild(o);if(l==e||u.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let f=UO(u.content,e-l-1,n,o==0?r-1:0,o==t.childCount-1?i-1:0,u);return f&&t.replaceChild(o,u.copy(f))}function QF(t,e,n){if(n.openStart>t.depth)throw new Id("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Id("Inconsistent open depths");return FO(t,e,n,0)}function FO(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=FO(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,l=o.content;return Ia(o,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=e4(n,t);return Ia(s,GO(t,o,l,e,r))}else return Ia(s,Wp(t,e,r))}function qO(t,e){if(!e.type.compatibleContent(t.type))throw new Id("Cannot join "+e.type.name+" onto "+t.type.name)}function Q0(t,e,n){let r=t.node(n);return qO(r,e.node(n)),r}function Da(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 dd(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&&(Da(t.nodeAfter,r),s++));for(let l=s;l<o;l++)Da(i.child(l),r);e&&e.depth==n&&e.textOffset&&Da(e.nodeBefore,r)}function Ia(t,e){if(!t.type.validContent(e))throw new Id("Invalid content for node "+t.type.name);return t.copy(e)}function GO(t,e,n,r,i){let s=t.depth>i&&Q0(t,e,i+1),o=r.depth>i&&Q0(n,r,i+1),l=[];return dd(null,t,i,l),s&&o&&e.index(i)==n.index(i)?(qO(s,o),Da(Ia(s,GO(t,e,n,r,i+1)),l)):(s&&Da(Ia(s,Wp(t,e,i+1)),l),dd(e,n,i,l),o&&Da(Ia(o,Wp(n,r,i+1)),l)),dd(r,null,i,l),new de(l)}function Wp(t,e,n){let r=[];if(dd(null,t,n,r),t.depth>n){let i=Q0(t,e,n+1);Da(Ia(i,Wp(t,e,n+1)),r)}return dd(e,null,n,r),new de(r)}function e4(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 jd{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 jt.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let l=r;r=i,i=l}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 Kp(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:l,offset:u}=o.content.findIndex(s),f=s-u;if(r.push(o,l,i+u),!f||(o=o.child(l),o.isText))break;s=f-1,i+=u+1}return new jd(n,r,s)}static resolveCached(e,n){let r=U_.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 U_.set(e,r=new t4);let i=r.elts[r.i]=jd.resolve(e,n);return r.i=(r.i+1)%n4,i}}class t4{constructor(){this.elts=[],this.i=0}}const n4=12,U_=new WeakMap;class Kp{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 r4=Object.create(null);let Do=class ex{constructor(e,n,r,i=jt.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&&Gp(this.attrs,n||e.defaultAttrs||r4)&&jt.sameSet(this.marks,r||jt.none)}copy(e=null){return e==this.content?this:new ex(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ex(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 Ee.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),l=i.start(o),f=i.node(o).content.cut(i.pos-l,s.pos-l);return new Ee(f,i.depth-o,s.depth-o)}replace(e,n,r){return QF(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 jd.resolveCached(this,e)}resolveNoCache(e){return jd.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()+")"),WO(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),l=o&&o.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let u=i;u<s;u++)if(!this.type.allowsMarks(r.child(u).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=jt.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(!jt.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}};Do.prototype.text=void 0;class Zp extends Do{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):WO(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 Zp(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Zp(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 WO(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Ua{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new i4(e,n);if(r.next==null)return Ua.empty;let i=KO(r);r.next&&r.err("Unexpected trailing text");let s=d4(u4(i));return f4(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,l){let u=o.matchFragment(e,r);if(u&&(!n||u.validEnd))return de.from(l.map(f=>f.createAndFill()));for(let f=0;f<o.next.length;f++){let{type:h,next:m}=o.next[f];if(!(h.isText||h.hasRequiredAttrs())&&i.indexOf(m)==-1){i.push(m);let g=s(m,l.concat(h));if(g)return g}}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 l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:u}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!i.type||u.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),n[l.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(`
65
- `)}}Ua.empty=new Ua(!0);class i4{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 KO(t){let e=[];do e.push(s4(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function s4(t){let e=[];do e.push(o4(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function o4(t){let e=c4(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=a4(t,e);else break;return e}function F_(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function a4(t,e){let n=F_(t),r=n;return t.eat(",")&&(t.next!="}"?r=F_(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function l4(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 c4(t){if(t.eat("(")){let e=KO(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=l4(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 u4(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,l,u){let f={term:u,to:l};return e[o].push(f),f}function i(o,l){o.forEach(u=>u.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((u,f)=>u.concat(s(f,l)),[]);if(o.type=="seq")for(let u=0;;u++){let f=s(o.exprs[u],l);if(u==o.exprs.length-1)return f;i(f,l=n())}else if(o.type=="star"){let u=n();return r(l,u),i(s(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return i(s(o.expr,l),u),i(s(o.expr,u),u),[r(u)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let u=l;for(let f=0;f<o.min;f++){let h=n();i(s(o.expr,u),h),u=h}if(o.max==-1)i(s(o.expr,u),u);else for(let f=o.min;f<o.max;f++){let h=n();r(u,h),i(s(o.expr,u),h),u=h}return[r(u)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function ZO(t,e){return e-t}function q_(t,e){let n=[];return r(e),n.sort(ZO);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:l,to:u}=s[o];!l&&n.indexOf(u)==-1&&r(u)}}}function d4(t){let e=Object.create(null);return n(q_(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:l,to:u})=>{if(!l)return;let f;for(let h=0;h<i.length;h++)i[h][0]==l&&(f=i[h][1]);q_(t,u).forEach(h=>{f||i.push([l,f=[]]),f.indexOf(h)==-1&&f.push(h)})})});let s=e[r.join(",")]=new Ua(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(ZO);s.next.push({type:i[o][0],next:e[l.join(",")]||n(l)})}return s}}function f4(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:u,next:f}=i.next[l];o.push(u.name),s&&!(u.isText||u.hasRequiredAttrs())&&(s=!1),r.indexOf(f)==-1&&r.push(f)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function YO(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 XO(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 JO(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let i in t)t[i].validate&&t[i].validate(e[i])}function QO(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new p4(t,r,e[r]);return n}let G_=class eD{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=QO(e,r.attrs),this.defaultAttrs=YO(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==Ua.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:XO(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Do(this,this.computeAttrs(e),de.from(n),jt.setFrom(r))}createChecked(e=null,n,r){return n=de.from(n),this.checkContent(n),new Do(this,this.computeAttrs(e),n,jt.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 Do(this,e,n.append(s),jt.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){JO(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:jt.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new eD(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 h4(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 p4{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?h4(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class rg{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=QO(e,i.attrs),this.excluded=null;let s=YO(this.attrs);this.instance=s?new jt(this,s):null}create(e=null){return!e&&this.instance?this.instance:new jt(this,XO(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new rg(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){JO(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class tD{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=zn.from(e.nodes),n.marks=zn.from(e.marks||{}),this.nodes=G_.compile(this.spec.nodes,this),this.marks=rg.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||"",l=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=Ua.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=l=="_"?null:l?W_(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:W_(this,o.split(" "))}this.nodeFromJSON=i=>Do.fromJSON(this,i),this.markFromJSON=i=>jt.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 G_){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 Zp(r,r.defaultAttrs,e,jt.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 W_(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 l in t.marks){let u=t.marks[l];(i=="_"||u.spec.group&&u.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=u)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function m4(t){return t.tag!=null}function g4(t){return t.style!=null}class _s{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(m4(i))this.tags.push(i);else if(g4(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 Z_(this,n,!1);return r.addAll(e,jt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Z_(this,n,!0);return r.addAll(e,jt.none,n.from,n.to),Ee.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(v4(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],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(o.getAttrs){let u=o.getAttrs(n);if(u===!1)continue;o.attrs=u||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 l=n[o];if((l.priority==null?50:l.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=Y_(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=Y_(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new _s(e,_s.schemaRules(e)))}}const nD={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},y4={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},rD={ol:!0,ul:!0},Ld=1,tx=2,fd=4;function K_(t,e,n){return e!=null?(e?Ld:0)|(e==="full"?tx:0):t&&t.whitespace=="pre"?Ld|tx:n&~fd}class Oh{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=jt.none,this.match=s||(o&fd?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&Ld)){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&&!nD.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Z_{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=K_(null,n.preserveWhitespace,0)|(r?fd:0);i?s=new Oh(i.type,i.attrs,jt.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new Oh(null,null,jt.none,!0,null,o):s=new Oh(e.schema.topNodeType,null,jt.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&tx?"full":this.localPreserveWS||(i.options&Ld)>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,`
66
- `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let u=0;u<l.length;u++)u&&this.insertNode(o.linebreakReplacement.create(),n,!0),l[u]&&this.insertNode(o.text(l[u]),n,!/\S/.test(l[u]));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 l=i.content[i.content.length-1],u=e.previousSibling;(!l||u&&u.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.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(),l;rD.hasOwnProperty(o)&&this.parser.normalizeLists&&b4(e);let u=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(u?u.ignore:y4.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!u||u.skip||u.closeParent){u&&u.closeParent?this.open=Math.max(0,this.open-1):u&&u.skip.nodeType&&(e=u.skip);let f,h=this.needsBlock;if(nD.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),f=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let m=u&&u.skip?n:this.readStyles(e,n);m&&this.addAll(e,m),f&&this.sync(s),this.needsBlock=h}else{let f=this.readStyles(e,n);f&&this.addElementByRule(e,u,f,u.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
67
- `),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 l=void 0;;){let u=this.parser.matchStyle(s,o,this,l);if(!u)break;if(u.ignore)return null;if(u.clearMark?n=n.filter(f=>!u.clearMark(f)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)l=u;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 u=this.enter(o,n.attrs||null,r,n.preserveWhitespace);u&&(s=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let l=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(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}s&&this.sync(l)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];o!=l;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,l=0;o>=0;o--){let u=this.nodes[o],f=u.findWrapping(e);if(f&&(!i||i.length>f.length+l)&&(i=f,s=u,!f.length))break;if(u.solid){if(r)break;l+=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=jt.none;for(let l of i.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):X_(l.type,e.type))&&(o=l.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 l=K_(e,s,o.options);o.options&fd&&o.content.length==0&&(l|=fd);let u=jt.none;return r=r.filter(f=>(o.type?o.type.allowsMarkType(f.type):X_(f.type,e))?(u=f.addToSet(u),!1):!0),this.nodes.push(new Oh(e,n,u,i,null,l)),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|=Ld)}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=(l,u)=>{for(;l>=0;l--){let f=n[l];if(f==""){if(l==n.length-1||l==0)continue;for(;u>=s;u--)if(o(l-1,u))return!0;return!1}else{let h=u>0||u==0&&i?this.nodes[u].type:r&&u>=s?r.node(u-s).type:null;if(!h||h.name!=f&&!h.isInGroup(f))return!1;u--}}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 b4(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&rD.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function v4(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Y_(t){let e={};for(let n in t)e[n]=t[n];return e}function X_(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=l=>{s.push(l);for(let u=0;u<l.edgeCount;u++){let{type:f,next:h}=l.edge(u);if(f==e||s.indexOf(h)<0&&o(h))return!0}};if(o(i.contentMatch))return!0}}class nl{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Dh(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,u=0;for(;l<s.length&&u<o.marks.length;){let f=o.marks[u];if(!this.marks[f.type.name]){u++;continue}if(!f.eq(s[l][0])||f.type.spec.spanning===!1)break;l++,u++}for(;l<s.length;)i=s.pop()[1];for(;u<o.marks.length;){let f=o.marks[u++],h=this.serializeMark(f,o.isInline,n);h&&(s.push([f,i]),i.appendChild(h.dom),i=h.contentDOM||h.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){if(e.isText)return Dh(n).createTextNode(e.text);let{dom:r,contentDOM:i}=yp(Dh(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&&yp(Dh(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return typeof n=="string"?{dom:e.createTextNode(n)}:yp(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new nl(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=J_(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return J_(e.marks)}}function J_(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Dh(t){return t.document||window.document}const Q_=new WeakMap;function x4(t){let e=Q_.get(t);return e===void 0&&Q_.set(t,e=w4(t)),e}function w4(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 yp(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=x4(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 l,u=n?t.createElementNS(n,i):t.createElement(i),f=e[1],h=1;if(f&&typeof f=="object"&&f.nodeType==null&&!Array.isArray(f)){h=2;for(let m in f)if(f[m]!=null){let g=m.indexOf(" ");g>0?u.setAttributeNS(m.slice(0,g),m.slice(g+1),f[m]):m=="style"&&u.style?u.style.cssText=f[m]:u.setAttribute(m,f[m])}}for(let m=h;m<e.length;m++){let g=e[m];if(g===0){if(m<e.length-1||m>h)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else if(typeof g=="string")u.appendChild(t.createTextNode(g));else{let{dom:b,contentDOM:x}=yp(t,g,n,r);if(u.appendChild(b),x){if(l)throw new RangeError("Multiple content holes");l=x}}}return{dom:u,contentDOM:l}}const iD=65535,sD=Math.pow(2,16);function S4(t,e){return t+e*sD}function eA(t){return t&iD}function k4(t){return(t-(t&iD))/sD}const oD=1,aD=2,bp=4,lD=8;class nx{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&lD)>0}get deletedBefore(){return(this.delInfo&(oD|bp))>0}get deletedAfter(){return(this.delInfo&(aD|bp))>0}get deletedAcross(){return(this.delInfo&bp)>0}}class Or{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Or.empty)return Or.empty}recover(e){let n=0,r=eA(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+k4(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 l=0;l<this.ranges.length;l+=3){let u=this.ranges[l]-(this.inverted?i:0);if(u>e)break;let f=this.ranges[l+s],h=this.ranges[l+o],m=u+f;if(e<=m){let g=f?e==u?-1:e==m?1:n:n,b=u+i+(g<0?0:h);if(r)return b;let x=e==(n<0?u:m)?null:S4(l/3,e-u),S=e==u?aD:e==m?oD:bp;return(n<0?e!=u:e!=m)&&(S|=lD),new nx(b,S,x)}i+=h-f}return r?e+i:new nx(e+i,0,null)}touches(e,n){let r=0,i=eA(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let u=this.ranges[l]-(this.inverted?r:0);if(u>e)break;let f=this.ranges[l+s],h=u+f;if(e<=h&&l==i*3)return!0;r+=this.ranges[l+o]-f}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],l=o-(this.inverted?s:0),u=o+(this.inverted?0:s),f=this.ranges[i+n],h=this.ranges[i+r];e(l,l+f,u,u+h),s+=h-f}}invert(){return new Or(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Or.empty:new Or(e<0?[0,-e,0]:[0,0,e])}}Or.empty=new Or([]);class Pd{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 Pd(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 Pd;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],l=o.mapResult(e,n);if(l.recover!=null){let u=this.getMirror(s);if(u!=null&&u>s&&u<this.to){s=u,e=this._maps[u].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new nx(e,i,null)}}const Sv=Object.create(null);class Jn{getMap(){return Or.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Sv[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 Sv)throw new RangeError("Duplicate use of step JSON ID "+e);return Sv[e]=n,n.prototype.jsonID=e,n}}class yn{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new yn(e,null)}static fail(e){return new yn(null,e)}static fromReplace(e,n,r,i){try{return yn.ok(e.replace(n,r,i))}catch(s){if(s instanceof Id)return yn.fail(s.message);throw s}}}function Vw(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(Vw(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return de.fromArray(r)}class _o extends Jn{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 Ee(Vw(n.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return yn.fromReplace(e,this.from,this.to,s)}invert(){return new bi(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 _o(n.pos,r.pos,this.mark)}merge(e){return e instanceof _o&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new _o(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 _o(n.from,n.to,e.markFromJSON(n.mark))}}Jn.jsonID("addMark",_o);class bi extends Jn{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 Ee(Vw(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return yn.fromReplace(e,this.from,this.to,r)}invert(){return new _o(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 bi(n.pos,r.pos,this.mark)}merge(e){return e instanceof bi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new bi(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 bi(n.from,n.to,e.markFromJSON(n.mark))}}Jn.jsonID("removeMark",bi);class Ao extends Jn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return yn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return yn.fromReplace(e,this.pos,this.pos+1,new Ee(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 Ao(this.pos,n.marks[i]);return new Ao(this.pos,this.mark)}}return new Fa(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ao(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 Ao(n.pos,e.markFromJSON(n.mark))}}Jn.jsonID("addNodeMark",Ao);class Fa extends Jn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return yn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return yn.fromReplace(e,this.pos,this.pos+1,new Ee(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 Ao(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Fa(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 Fa(n.pos,e.markFromJSON(n.mark))}}Jn.jsonID("removeNodeMark",Fa);class gn extends Jn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&rx(e,this.from,this.to)?yn.fail("Structure replace would overwrite content"):yn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Or([this.from,this.to-this.from,this.slice.size])}invert(e){return new gn(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&&gn.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new gn(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof gn)||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?Ee.empty:new Ee(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new gn(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?Ee.empty:new Ee(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new gn(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 gn(n.from,n.to,Ee.fromJSON(e,n.slice),!!n.structure)}}gn.MAP_BIAS=1;Jn.jsonID("replace",gn);class _n extends Jn{constructor(e,n,r,i,s,o,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(rx(e,this.from,this.gapFrom)||rx(e,this.gapTo,this.to)))return yn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return yn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?yn.fromReplace(e,this.from,this.to,r):yn.fail("Content does not fit in gap")}getMap(){return new Or([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 _n(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 _n(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 _n(n.from,n.to,n.gapFrom,n.gapTo,Ee.fromJSON(e,n.slice),n.insert,!!n.structure)}}Jn.jsonID("replaceAround",_n);function rx(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 C4(t,e,n,r){let i=[],s=[],o,l;t.doc.nodesBetween(e,n,(u,f,h)=>{if(!u.isInline)return;let m=u.marks;if(!r.isInSet(m)&&h.type.allowsMarkType(r.type)){let g=Math.max(f,e),b=Math.min(f+u.nodeSize,n),x=r.addToSet(m);for(let S=0;S<m.length;S++)m[S].isInSet(x)||(o&&o.to==g&&o.mark.eq(m[S])?o.to=b:i.push(o=new bi(g,b,m[S])));l&&l.to==g?l.to=b:s.push(l=new _o(g,b,r))}}),i.forEach(u=>t.step(u)),s.forEach(u=>t.step(u))}function E4(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,l)=>{if(!o.isInline)return;s++;let u=null;if(r instanceof rg){let f=o.marks,h;for(;h=r.isInSet(f);)(u||(u=[])).push(h),f=h.removeFromSet(f)}else r?r.isInSet(o.marks)&&(u=[r]):u=o.marks;if(u&&u.length){let f=Math.min(l+o.nodeSize,n);for(let h=0;h<u.length;h++){let m=u[h],g;for(let b=0;b<i.length;b++){let x=i[b];x.step==s-1&&m.eq(i[b].style)&&(g=x)}g?(g.to=f,g.step=s):i.push({style:m,from:Math.max(l,e),to:f,step:s})}}}),i.forEach(o=>t.step(new bi(o.from,o.to,o.style)))}function Hw(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],l=e+1;for(let u=0;u<s.childCount;u++){let f=s.child(u),h=l+f.nodeSize,m=r.matchType(f.type);if(!m)o.push(new gn(l,h,Ee.empty));else{r=m;for(let g=0;g<f.marks.length;g++)n.allowsMarkType(f.marks[g].type)||t.step(new bi(l,h,f.marks[g]));if(i&&f.isText&&n.whitespace!="pre"){let g,b=/\r?\n|\r/g,x;for(;g=b.exec(f.text);)x||(x=new Ee(de.from(n.schema.text(" ",n.allowedMarks(f.marks))),0,0)),o.push(new gn(l+g.index,l+g.index+g[0].length,x))}}l=h}if(!r.validEnd){let u=r.fillBefore(de.empty,!0);t.replace(l,l,new Ee(u,0,0))}for(let u=o.length-1;u>=0;u--)t.step(o[u])}function T4(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Vc(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),l=t.$from.index(r)+i,u=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(l,u,n))return r;if(r==0||o.type.spec.isolating||!T4(o,l,u))break;l&&(i=1),u<o.childCount&&(s=1)}return null}function _4(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),l=i.after(s+1),u=o,f=l,h=de.empty,m=0;for(let x=s,S=!1;x>n;x--)S||r.index(x)>0?(S=!0,h=de.from(r.node(x).copy(h)),m++):u--;let g=de.empty,b=0;for(let x=s,S=!1;x>n;x--)S||i.after(x+1)<i.end(x)?(S=!0,g=de.from(i.node(x).copy(g)),b++):f++;t.step(new _n(u,f,o,l,new Ee(h.append(g),m,b),h.size-m,!0))}function Uw(t,e,n=null,r=t){let i=A4(t,e),s=i&&R4(r,e);return s?i.map(tA).concat({type:e,attrs:n}).concat(s.map(tA)):null}function tA(t){return{type:t,attrs:null}}function A4(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 R4(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 u=(o.length?o[o.length-1]:e).contentMatch;for(let f=r;u&&f<i;f++)u=u.matchType(n.child(f).type);return!u||!u.validEnd?null:o}function M4(t,e,n){let r=de.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let l=n[o].type.contentMatch.matchFragment(r);if(!l||!l.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 _n(i,s,i,s,new Ee(r,0,0),n.length,!0))}function N4(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,l)=>{let u=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,u)&&O4(t.doc,t.mapping.slice(s).map(l),r)){let f=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",x=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!x?f=!1:!b&&x&&(f=!0)}f===!1&&uD(t,o,l,s),Hw(t,t.mapping.slice(s).map(l,1),r,void 0,f===null);let h=t.mapping.slice(s),m=h.map(l,1),g=h.map(l+o.nodeSize,1);return t.step(new _n(m,g,m+1,g-1,new Ee(de.from(r.create(u,null,o.marks)),0,0),1,!0)),f===!0&&cD(t,o,l,s),!1}})}function cD(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let u=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function uD(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(`
68
- `))}})}function O4(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function D4(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 _n(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new Ee(de.from(o),0,0),1,!0))}function As(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 f=i.depth-1,h=n-2;f>s;f--,h--){let m=i.node(f),g=i.index(f);if(m.type.spec.isolating)return!1;let b=m.content.cutByIndex(g,m.childCount),x=r&&r[h+1];x&&(b=b.replaceChild(0,x.type.create(x.attrs)));let S=r&&r[h]||m;if(!m.canReplace(g+1,m.childCount)||!S.type.validContent(b))return!1}let l=i.indexAfter(s),u=r&&r[0];return i.node(s).canReplaceWith(l,l,u?u.type:i.node(s+1).type)}function I4(t,e,n=1,r){let i=t.doc.resolve(e),s=de.empty,o=de.empty;for(let l=i.depth,u=i.depth-n,f=n-1;l>u;l--,f--){s=de.from(i.node(l).copy(s));let h=r&&r[f];o=de.from(h?h.type.create(h.attrs,o):i.node(l).copy(o))}t.step(new gn(e,e,new Ee(s.append(o),n,n),!0))}function Yo(t,e){let n=t.resolve(e),r=n.index();return dD(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function j4(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 dD(t,e){return!!(t&&e&&!t.isLeaf&&j4(t,e))}function ig(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,l=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),o=r.node(i+1)),s&&!s.isTextblock&&dD(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function L4(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 h=o.whitespace=="pre",m=!!o.contentMatch.matchType(i);h&&!m?r=!1:!h&&m&&(r=!0)}let l=t.steps.length;if(r===!1){let h=t.doc.resolve(e+n);uD(t,h.node(),h.before(),l)}o.inlineContent&&Hw(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let u=t.mapping.slice(l),f=u.map(e-n);if(t.step(new gn(f,u.map(e+n,-1),Ee.empty,!0)),r===!0){let h=t.doc.resolve(f);cD(t,h.node(),h.before(),t.steps.length)}return t}function P4(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 fD(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 l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,u=r.index(o)+(l>0?1:0),f=r.node(o),h=!1;if(s==1)h=f.canReplace(u,u,i);else{let m=f.contentMatchAt(u).findWrapping(i.firstChild.type);h=m&&f.canReplaceWith(u,u,m[0])}if(h)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function sg(t,e,n=e,r=Ee.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return hD(i,s,r)?new gn(e,n,r):new z4(i,s,r).fit()}function hD(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class z4{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 f=this.findFittable();f?this.placeNodes(f):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,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let u=new Ee(s,o,l);return e>-1?new _n(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new gn(r.pos,i.pos,u):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=kv(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:u,match:f}=this.frontier[l],h,m=null;if(n==1&&(o?f.matchType(o.type)||(m=f.fillBefore(de.from(o),!1)):s&&u.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:m};if(n==2&&o&&(h=f.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:h};if(s&&f.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=kv(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new Ee(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=kv(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new Ee(Qu(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new Ee(Qu(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 S=0;S<s.length;S++)this.openFrontierNode(s[S]);let o=this.unplaced,l=r?r.content:o.content,u=o.openStart-e,f=0,h=[],{match:m,type:g}=this.frontier[n];if(i){for(let S=0;S<i.childCount;S++)h.push(i.child(S));m=m.matchFragment(i)}let b=l.size+e-(o.content.size-o.openEnd);for(;f<l.childCount;){let S=l.child(f),k=m.matchType(S.type);if(!k)break;f++,(f>1||u==0||S.content.size)&&(m=k,h.push(pD(S.mark(g.allowedMarks(S.marks)),f==1?u:0,f==l.childCount?b:-1)))}let x=f==l.childCount;x||(b=-1),this.placed=ed(this.placed,n,de.from(h)),this.frontier[n].match=m,x&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let S=0,k=l;S<b;S++){let C=k.lastChild;this.frontier.push({type:C.type,match:C.contentMatchAt(C.childCount)}),k=C.content}this.unplaced=x?e==0?Ee.empty:new Ee(Qu(o.content,e-1,1),e-1,b<0?o.openEnd:e-1):new Ee(Qu(o.content,e,f),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Cv(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=Cv(e,n,i,r,s);if(o){for(let l=n-1;l>=0;l--){let{match:u,type:f}=this.frontier[l],h=Cv(e,l,f,u,!0);if(!h||h.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=ed(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=ed(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=ed(this.placed,this.frontier.length,n))}}function Qu(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Qu(t.firstChild.content,e-1,n)))}function ed(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(ed(t.lastChild.content,e-1,n)))}function kv(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function pD(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,pD(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 Cv(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 l=r.fillBefore(s.content,!0,o);return l&&!$4(n,s.content,o)?l:null}function $4(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function B4(t){return t.spec.defining||t.spec.definingForContent}function V4(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(hD(i,s,r))return t.step(new gn(e,n,r));let o=gD(i,s);o[o.length-1]==0&&o.pop();let l=-(i.depth+1);o.unshift(l);for(let g=i.depth,b=i.pos-1;g>0;g--,b--){let x=i.node(g).type.spec;if(x.defining||x.definingAsContext||x.isolating)break;o.indexOf(g)>-1?l=g:i.before(g)==b&&o.splice(1,0,-g)}let u=o.indexOf(l),f=[],h=r.openStart;for(let g=r.content,b=0;;b++){let x=g.firstChild;if(f.push(x),b==r.openStart)break;g=x.content}for(let g=h-1;g>=0;g--){let b=f[g],x=B4(b.type);if(x&&!b.sameMarkup(i.node(Math.abs(l)-1)))h=g;else if(x||!b.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let b=(g+h+1)%(r.openStart+1),x=f[b];if(x)for(let S=0;S<o.length;S++){let k=o[(S+u)%o.length],C=!0;k<0&&(C=!1,k=-k);let _=i.node(k-1),M=i.index(k-1);if(_.canReplaceWith(M,M,x.type,x.marks))return t.replace(i.before(k),C?s.after(k):n,new Ee(mD(r.content,0,r.openStart,b),b,r.openEnd))}}let m=t.steps.length;for(let g=o.length-1;g>=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let b=o[g];b<0||(e=i.before(b),n=s.after(b))}}function mD(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(mD(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 H4(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=P4(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new Ee(de.from(r),0,0))}function U4(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),l=!1;for(let u=r.depth;u>o;u--)r.node(u).type.spec.isolating&&(l=!0);for(let u=i.depth;u>o;u--)i.node(u).type.spec.isolating&&(l=!0);if(!l){for(let u=r.depth;u>0&&e==r.start(u);u--)e=r.before(u);for(let u=i.depth;u>0&&n==i.start(u);u--)n=i.before(u);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let s=gD(r,i);for(let o=0;o<s.length;o++){let l=s[o],u=o==s.length-1;if(u&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),i.end(l));if(l>0&&(u||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return t.delete(r.before(l),i.after(l))}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 gD(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 fc extends Jn{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 yn.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 yn.fromReplace(e,this.pos,this.pos+1,new Ee(de.from(i),0,n.isLeaf?0:1))}getMap(){return Or.empty}invert(e){return new fc(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 fc(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 fc(n.pos,n.attr,n.value)}}Jn.jsonID("attr",fc);class zd extends Jn{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 yn.ok(r)}getMap(){return Or.empty}invert(e){return new zd(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 zd(n.attr,n.value)}}Jn.jsonID("docAttr",zd);let Cc=class extends Error{};Cc=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Cc.prototype=Object.create(Error.prototype);Cc.prototype.constructor=Cc;Cc.prototype.name="TransformError";class Fw{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Pd}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Cc(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,l,u)=>{e=Math.min(e,l),n=Math.max(n,u)})}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=Ee.empty){let i=sg(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new Ee(de.from(r),0,0))}delete(e,n){return this.replace(e,n,Ee.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return V4(this,e,n,r),this}replaceRangeWith(e,n,r){return H4(this,e,n,r),this}deleteRange(e,n){return U4(this,e,n),this}lift(e,n){return _4(this,e,n),this}join(e,n=1){return L4(this,e,n),this}wrap(e,n){return M4(this,e,n),this}setBlockType(e,n=e,r,i=null){return N4(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return D4(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new fc(e,n,r)),this}setDocAttribute(e,n){return this.step(new zd(e,n)),this}addNodeMark(e,n){return this.step(new Ao(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 jt)n.isInSet(r.marks)&&this.step(new Fa(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new Fa(e,s)),i=s.removeFromSet(i);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,n=1,r){return I4(this,e,n,r),this}addMark(e,n,r){return C4(this,e,n,r),this}removeMark(e,n,r){return E4(this,e,n,r),this}clearIncompatible(e,n,r){return Hw(this,e,n,r),this}}const Ev=Object.create(null);class Ke{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new yD(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=Ee.empty){let r=n.content.lastChild,i=null;for(let l=0;l<n.openEnd;l++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:u,$to:f}=o[l],h=e.mapping.slice(s);e.replaceRange(h.map(u.pos),h.map(f.pos),l?Ee.empty:n),l==0&&iA(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:l}=i[s],u=e.mapping.slice(r),f=u.map(o.pos),h=u.map(l.pos);s?e.deleteRange(f,h):(e.replaceRangeWith(f,h,n),iA(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new $e(e):ic(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?ic(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):ic(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 Ir(e.node(0))}static atStart(e){return ic(e,e,0,0,1)||new Ir(e)}static atEnd(e){return ic(e,e,e.content.size,e.childCount,-1)||new Ir(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ev[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 Ev)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ev[e]=n,n.prototype.jsonID=e,n}getBookmark(){return $e.between(this.$anchor,this.$head).getBookmark()}}Ke.prototype.visible=!0;class yD{constructor(e,n){this.$from=e,this.$to=n}}let nA=!1;function rA(t){!nA&&!t.parent.inlineContent&&(nA=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class $e extends Ke{constructor(e,n=e){rA(e),rA(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 Ke.near(r);let i=e.resolve(n.map(this.anchor));return new $e(i.parent.inlineContent?i:r,r)}replace(e,n=Ee.empty){if(super.replace(e,n),n==Ee.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof $e&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new og(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 $e(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=Ke.findFrom(n,r,!0)||Ke.findFrom(n,-r,!0);if(s)n=s.$head;else return Ke.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Ke.findFrom(e,-r,!0)||Ke.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new $e(e,n)}}Ke.jsonID("text",$e);class og{constructor(e,n){this.anchor=e,this.head=n}map(e){return new og(e.map(this.anchor),e.map(this.head))}resolve(e){return $e.between(e.resolve(this.anchor),e.resolve(this.head))}}class He extends Ke{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?Ke.near(s):new He(s)}content(){return new Ee(de.from(this.node),0,0)}eq(e){return e instanceof He&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new qw(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new He(e.resolve(n.anchor))}static create(e,n){return new He(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}He.prototype.visible=!1;Ke.jsonID("node",He);class qw{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new og(r,r):new qw(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&He.isSelectable(r)?new He(n):Ke.near(n)}}class Ir extends Ke{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=Ee.empty){if(n==Ee.empty){e.delete(0,e.doc.content.size);let r=Ke.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ir(e)}map(e){return new Ir(e)}eq(e){return e instanceof Ir}getBookmark(){return F4}}Ke.jsonID("all",Ir);const F4={map(){return this},resolve(t){return new Ir(t)}};function ic(t,e,n,r,i,s=!1){if(e.inlineContent)return $e.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&He.isSelectable(l))return He.create(t,n-(i<0?l.nodeSize:0))}else{let u=ic(t,l,n+i,i<0?l.childCount:0,i,s);if(u)return u}n+=l.nodeSize*i}return null}function iA(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof gn||i instanceof _n))return;let s=t.mapping.maps[r],o;s.forEach((l,u,f,h)=>{o==null&&(o=h)}),t.setSelection(Ke.near(t.doc.resolve(o),n))}const sA=1,Ih=2,oA=4;class q4 extends Fw{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|sA)&~Ih,this.storedMarks=null,this}get selectionSet(){return(this.updated&sA)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ih,this}ensureMarks(e){return jt.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&Ih)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Ih,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)||jt.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(Ke.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|=oA,this}get scrolledIntoView(){return(this.updated&oA)>0}}function aA(t,e){return!e||!t?t:t.bind(e)}class td{constructor(e,n,r){this.name=e,this.init=aA(n.init,r),this.apply=aA(n.apply,r)}}const G4=[new td("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new td("selection",{init(t,e){return t.selection||Ke.atStart(e.doc)},apply(t){return t.selection}}),new td("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new td("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Tv{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=G4.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 td(r.key,r.spec.state,r))})}}class _a{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 l=this.config.plugins[o];if(l.spec.appendTransaction){let u=i?i[o].n:0,f=i?i[o].state:this,h=u<n.length&&l.spec.appendTransaction.call(l,u?n.slice(u):n,f,r);if(h&&r.filterTransaction(h,o)){if(h.setMeta("appendedTransaction",e),!i){i=[];for(let m=0;m<this.config.plugins.length;m++)i.push(m<o?{state:r,n:n.length}:{state:this,n:0})}n.push(h),r=r.applyInner(h),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 _a(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 q4(this)}static create(e){let n=new Tv(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new _a(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 Tv(this.schema,e.plugins),r=n.fields,i=new _a(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 Tv(e.schema,e.plugins),s=new _a(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Do.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=Ke.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 l in r){let u=r[l],f=u.spec.state;if(u.key==o.name&&f&&f.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){s[o.name]=f.fromJSON.call(u,e,n[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function bD(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=bD(i,e,{})),n[r]=i}return n}class zt{constructor(e){this.spec=e,this.props={},e.props&&bD(e.props,this,this.props),this.key=e.key?e.key.key:vD("plugin")}getState(e){return e[this.key]}}const _v=Object.create(null);function vD(t){return t in _v?t+"$"+ ++_v[t]:(_v[t]=0,t+"$")}class tn{constructor(e="key"){this.key=vD(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const xD=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function wD(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const SD=(t,e,n)=>{let r=wD(t,n);if(!r)return!1;let i=Gw(r);if(!i){let o=r.blockRange(),l=o&&Vc(o);return l==null?!1:(e&&e(t.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(ND(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Ec(s,"end")||He.isSelectable(s)))for(let o=r.depth;;o--){let l=sg(t.doc,r.before(o),r.after(o),Ee.empty);if(l&&l.slice.size<l.to-l.from){if(e){let u=t.tr.step(l);u.setSelection(Ec(s,"end")?Ke.findFrom(u.doc.resolve(u.mapping.map(i.pos,-1)),-1):He.create(u.doc,i.pos-s.nodeSize)),e(u.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},W4=(t,e,n)=>{let r=wD(t,n);if(!r)return!1;let i=Gw(r);return i?kD(t,i,e):!1},K4=(t,e,n)=>{let r=ED(t,n);if(!r)return!1;let i=Ww(r);return i?kD(t,i,e):!1};function kD(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 h=i.lastChild;if(!h)return!1;i=h}let o=e.nodeAfter,l=o,u=e.pos+1;for(;!l.isTextblock;u++){if(l.type.spec.isolating)return!1;let h=l.firstChild;if(!h)return!1;l=h}let f=sg(t.doc,s,u,Ee.empty);if(!f||f.from!=s||f instanceof gn&&f.slice.size>=u-s)return!1;if(n){let h=t.tr.step(f);h.setSelection($e.create(h.doc,s)),n(h.scrollIntoView())}return!0}function Ec(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 CD=(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=Gw(r)}let o=s&&s.nodeBefore;return!o||!He.isSelectable(o)?!1:(e&&e(t.tr.setSelection(He.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Gw(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 ED(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const TD=(t,e,n)=>{let r=ED(t,n);if(!r)return!1;let i=Ww(r);if(!i)return!1;let s=i.nodeAfter;if(ND(t,i,e,1))return!0;if(r.parent.content.size==0&&(Ec(s,"start")||He.isSelectable(s))){let o=sg(t.doc,r.before(),r.after(),Ee.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=t.tr.step(o);l.setSelection(Ec(s,"start")?Ke.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):He.create(l.doc,l.mapping.map(i.pos))),e(l.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},_D=(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=Ww(r)}let o=s&&s.nodeAfter;return!o||!He.isSelectable(o)?!1:(e&&e(t.tr.setSelection(He.create(t.doc,s.pos)).scrollIntoView()),!0)};function Ww(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 Z4=(t,e)=>{let n=t.selection,r=n instanceof He,i;if(r){if(n.node.isTextblock||!Yo(t.doc,n.from))return!1;i=n.from}else if(i=ig(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(He.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Y4=(t,e)=>{let n=t.selection,r;if(n instanceof He){if(n.node.isTextblock||!Yo(t.doc,n.to))return!1;r=n.to}else if(r=ig(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},X4=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&Vc(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},AD=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
69
- `).scrollIntoView()),!0)};function Kw(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 J4=(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=Kw(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=n.after(),u=t.tr.replaceWith(l,l,o.createAndFill());u.setSelection(Ke.near(u.doc.resolve(l),1)),e(u.scrollIntoView())}return!0},RD=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Ir||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Kw(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,l=t.tr.insert(o,s.createAndFill());l.setSelection($e.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},MD=(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(As(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Vc(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function Q4(t){return(e,n)=>{if(e.selection instanceof He&&e.selection.node.isBlock){let{$from:b}=e.selection;return!b.parentOffset||!As(e.doc,b.pos)?!1:(n&&n(e.tr.split(b.pos).scrollIntoView()),!0)}if(!e.selection.$from.depth)return!1;let r=e.tr;!e.selection.empty&&(e.selection instanceof $e||e.selection instanceof Ir)&&r.deleteSelection();let{$from:i}=r.selection,s=r.steps.length,o=[],l,u,f=!1,h=!1;for(let b=i.depth;;b--)if(i.node(b).isBlock){f=i.end(b)==i.pos+(i.depth-b),h=i.start(b)==i.pos-(i.depth-b),u=Kw(i.node(b-1).contentMatchAt(i.indexAfter(b-1))),o.unshift(f&&u?{type:u}:null),l=b;break}else{if(b==1)return!1;o.unshift(null)}let m=i.pos,g=As(r.doc,m,o.length,o);if(g||(o[0]=u?{type:u}:null,g=As(r.doc,m,o.length,o)),!g)return!1;if(r.split(m,o.length,o),!f&&h&&i.node(l).type!=u){let b=r.mapping.slice(s),x=b.map(i.before(l)),S=r.doc.resolve(x);u&&i.node(l-1).canReplaceWith(S.index(),S.index()+1,u)&&r.setNodeMarkup(b.map(i.before(l)),u)}return n&&n(r.scrollIntoView()),!0}}const e5=Q4(),t5=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(He.create(t.doc,i))),!0)};function n5(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||Yo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function ND(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,l,u=i.type.spec.isolating||s.type.spec.isolating;if(!u&&n5(t,e,n))return!0;let f=!u&&e.parent.canReplace(e.index(),e.index()+1);if(f&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(n){let b=e.pos+s.nodeSize,x=de.empty;for(let C=o.length-1;C>=0;C--)x=de.from(o[C].create(null,x));x=de.from(i.copy(x));let S=t.tr.step(new _n(e.pos-1,b,e.pos,b,new Ee(x,1,0),o.length,!0)),k=S.doc.resolve(b+2*o.length);k.nodeAfter&&k.nodeAfter.type==i.type&&Yo(S.doc,k.pos)&&S.join(k.pos),n(S.scrollIntoView())}return!0}let h=s.type.spec.isolating||r>0&&u?null:Ke.findFrom(e,1),m=h&&h.$from.blockRange(h.$to),g=m&&Vc(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(f&&Ec(s,"start",!0)&&Ec(i,"end")){let b=i,x=[];for(;x.push(b),!b.isTextblock;)b=b.lastChild;let S=s,k=1;for(;!S.isTextblock;S=S.firstChild)k++;if(b.canReplace(b.childCount,b.childCount,S.content)){if(n){let C=de.empty;for(let M=x.length-1;M>=0;M--)C=de.from(x[M].copy(C));let _=t.tr.step(new _n(e.pos-x.length,e.pos+s.nodeSize,e.pos+k,e.pos+s.nodeSize-k,new Ee(C,x.length,0),0,!0));n(_.scrollIntoView())}return!0}}return!1}function OD(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($e.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const r5=OD(-1),i5=OD(1);function s5(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),l=o&&Uw(o,t,e);return l?(r&&r(n.tr.wrap(o,l).scrollIntoView()),!0):!1}}function lA(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:l}}=n.selection.ranges[s];n.doc.nodesBetween(o,l,(u,f)=>{if(i)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)i=!0;else{let h=n.doc.resolve(f),m=h.index();i=h.parent.canReplaceWith(m,m+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:l},$to:{pos:u}}=n.selection.ranges[o];s.setBlockType(l,u,t,e)}r(s.scrollIntoView())}return!0}}function Zw(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}Zw(xD,SD,CD);Zw(xD,TD,_D);Zw(AD,RD,MD,e5);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function o5(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let l=r?n.tr:null;return a5(l,o,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function a5(t,e,n,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let u=o.resolve(e.start-2);s=new Kp(u,u,e.depth),e.endIndex<e.parent.childCount&&(e=new Kp(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=Uw(s,n,r,e);return l?(t&&l5(t,e,l,i,n),!0):!1}function l5(t,e,n,r,i){let s=de.empty;for(let h=n.length-1;h>=0;h--)s=de.from(n[h].type.create(n[h].attrs,s));t.step(new _n(e.start-(r?2:0),e.end,e.start,e.end,new Ee(s,0,0),n.length,!0));let o=0;for(let h=0;h<n.length;h++)n[h].type==i&&(o=h+1);let l=n.length-o,u=e.start+n.length-(r?2:0),f=e.parent;for(let h=e.startIndex,m=e.endIndex,g=!0;h<m;h++,g=!1)!g&&As(t.doc,u,l)&&(t.split(u,l),u+=2*l),u+=f.child(h).nodeSize;return t}function c5(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?u5(e,n,t,s):d5(e,n,s):!0:!1}}function u5(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new _n(s-1,o,s,o,new Ee(de.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Kp(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const l=Vc(r);if(l==null)return!1;i.lift(r,l);let u=i.doc.resolve(i.mapping.map(s,-1)-1);return Yo(i.doc,u.pos)&&u.nodeBefore.type==u.nodeAfter.type&&i.join(u.pos),e(i.scrollIntoView()),!0}function d5(t,e,n){let r=t.tr,i=n.parent;for(let b=n.end,x=n.endIndex-1,S=n.startIndex;x>S;x--)b-=i.child(x).nodeSize,r.delete(b-1,b+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 l=n.startIndex==0,u=n.endIndex==i.childCount,f=s.node(-1),h=s.index(-1);if(!f.canReplace(h+(l?0:1),h+1,o.content.append(u?de.empty:de.from(i))))return!1;let m=s.pos,g=m+o.nodeSize;return r.step(new _n(m-(l?1:0),g+(u?1:0),m+1,g-1,new Ee((l?de.empty:de.from(i.copy(de.empty))).append(u?de.empty:de.from(i.copy(de.empty))),l?0:1,u?0:1),l?0:1)),e(r.scrollIntoView()),!0}function f5(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,f=>f.childCount>0&&f.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,u=l.child(o-1);if(u.type!=t)return!1;if(n){let f=u.lastChild&&u.lastChild.type==l.type,h=de.from(f?t.create():null),m=new Ee(de.from(t.create(null,de.from(l.type.create(null,h)))),f?3:1,0),g=s.start,b=s.end;n(e.tr.step(new _n(g-(f?3:1),b,g,b,m,1,!0)).scrollIntoView())}return!0}}const Vn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Tc=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let ix=null;const gs=function(t,e,n){let r=ix||(ix=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},h5=function(){ix=null},qa=function(t,e,n,r){return n&&(cA(t,e,n,r,-1)||cA(t,e,n,r,1))},p5=/^(img|br|input|textarea|hr)$/i;function cA(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:ei(t))){let o=t.parentNode;if(!o||o.nodeType!=1||of(t)||p5.test(t.nodeName)||t.contentEditable=="false")return!1;e=Vn(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?ei(t):0}else return!1}}function ei(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function m5(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=ei(t)}else if(t.parentNode&&!of(t))e=Vn(t),t=t.parentNode;else return null}}function g5(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&&!of(t))e=Vn(t)+1,t=t.parentNode;else return null}}function y5(t,e,n){for(let r=e==0,i=e==ei(t);r||i;){if(t==n)return!0;let s=Vn(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==ei(t)}}function of(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 ag=function(t){return t.focusNode&&qa(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Ca(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function b5(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function v5(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(ei(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(ei(r.startContainer),r.startOffset)}}}const zi=typeof navigator<"u"?navigator:null,uA=typeof document<"u"?document:null,Xo=zi&&zi.userAgent||"",sx=/Edge\/(\d+)/.exec(Xo),DD=/MSIE \d/.exec(Xo),ox=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Xo),gr=!!(DD||ox||sx),Io=DD?document.documentMode:ox?+ox[1]:sx?+sx[1]:0,ti=!gr&&/gecko\/(\d+)/i.test(Xo);ti&&+(/Firefox\/(\d+)/.exec(Xo)||[0,0])[1];const ax=!gr&&/Chrome\/(\d+)/.exec(Xo),Un=!!ax,ID=ax?+ax[1]:0,Yn=!gr&&!!zi&&/Apple Computer/.test(zi.vendor),_c=Yn&&(/Mobile\/\w+/.test(Xo)||!!zi&&zi.maxTouchPoints>2),Jr=_c||(zi?/Mac/.test(zi.platform):!1),jD=zi?/Win/.test(zi.platform):!1,Es=/Android \d/.test(Xo),af=!!uA&&"webkitFontSmoothing"in uA.documentElement.style,x5=af?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function w5(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 us(t,e){return typeof t=="number"?t:t[e]}function S5(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 dA(t,e,n){if(!lx(e)&&e.left==0)return;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=Tc(o);continue}let l=o,u=l==s.body,f=u?w5(s):S5(l),h=0,m=0;if(e.top<f.top+us(r,"top")?m=-(f.top-e.top+us(i,"top")):e.bottom>f.bottom-us(r,"bottom")&&(m=e.bottom-e.top>f.bottom-f.top?e.top+us(i,"top")-f.top:e.bottom-f.bottom+us(i,"bottom")),e.left<f.left+us(r,"left")?h=-(f.left-e.left+us(i,"left")):e.right>f.right-us(r,"right")&&(h=e.right-f.right+us(i,"right")),h||m)if(u)s.defaultView.scrollBy(h,m);else{let b=l.scrollLeft,x=l.scrollTop;m&&(l.scrollTop+=m),h&&(l.scrollLeft+=h);let S=l.scrollLeft-b,k=l.scrollTop-x;e={left:e.left-S,top:e.top-k,right:e.right-S,bottom:e.bottom-k}}let g=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(g))break;o=g=="absolute"?o.offsetParent:Tc(o)}}function k5(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 l=t.root.elementFromPoint(s,o);if(!l||l==t.dom||!t.dom.contains(l))continue;let u=l.getBoundingClientRect();if(u.top>=n-20){r=l,i=u.top;break}}return{refDOM:r,refTop:i,stack:LD(t.dom)}}function LD(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Tc(r));return e}function C5({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;PD(n,r==0?0:r-e)}function PD(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 Wl=null;function E5(t){if(t.setActive)return t.setActive();if(Wl)return t.focus(Wl);let e=LD(t);t.focus(Wl==null?{get preventScroll(){return Wl={preventScroll:!0},!0}}:void 0),Wl||(Wl=!1,PD(e,0))}function zD(t,e){let n,r=2e8,i,s=0,o=e.top,l=e.top,u,f;for(let h=t.firstChild,m=0;h;h=h.nextSibling,m++){let g;if(h.nodeType==1)g=h.getClientRects();else if(h.nodeType==3)g=gs(h).getClientRects();else continue;for(let b=0;b<g.length;b++){let x=g[b];if(x.top<=o&&x.bottom>=l){o=Math.max(x.bottom,o),l=Math.min(x.top,l);let S=x.left>e.left?x.left-e.left:x.right<e.left?e.left-x.right:0;if(S<r){n=h,r=S,i=S&&n.nodeType==3?{left:x.right<e.left?x.right:x.left,top:e.top}:e,h.nodeType==1&&S&&(s=m+(e.left>=(x.left+x.right)/2?1:0));continue}}else x.top>e.top&&!u&&x.left<=e.left&&x.right>=e.left&&(u=h,f={left:Math.max(x.left,Math.min(x.right,e.left)),top:x.top});!n&&(e.left>=x.right&&e.top>=x.top||e.left>=x.left&&e.top>=x.bottom)&&(s=m+1)}}return!n&&u&&(n=u,i=f,r=0),n&&n.nodeType==3?T5(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:zD(n,i)}function T5(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=ho(r,1);if(o.top!=o.bottom&&Yw(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 Yw(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function _5(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function A5(t,e,n){let{node:r,offset:i}=zD(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 R5(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let l=t.docView.nearestDesc(s,!0),u;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((u=l.dom.getBoundingClientRect()).width||u.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!o&&u.left>r.left||u.top>r.top?i=l.posBefore:(!o&&u.right<r.left||u.bottom<r.top)&&(i=l.posAfter),o=!0),!l.contentDOM&&i<0&&!l.node.isText))return(l.node.isBlock?r.top<(u.top+u.bottom)/2:r.left<(u.left+u.right)/2)?l.posBefore:l.posAfter;s=l.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function $D(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 l=o.getClientRects();for(let u=0;u<l.length;u++){let f=l[u];if(Yw(e,f))return $D(o,e,f)}}if((s=(s+1)%r)==i)break}return t}function M5(t,e){let n=t.dom.ownerDocument,r,i=0,s=v5(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let f=t.dom.getBoundingClientRect();if(!Yw(e,f)||(o=$D(t.dom,e,f),!o))return null}if(Yn)for(let f=o;r&&f;f=Tc(f))f.draggable&&(r=void 0);if(o=_5(o,e),r){if(ti&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let h=r.childNodes[i],m;h.nodeName=="IMG"&&(m=h.getBoundingClientRect()).right<=e.left&&m.bottom>e.top&&i++}let f;af&&i&&r.nodeType==1&&(f=r.childNodes[i-1]).nodeType==1&&f.contentEditable=="false"&&f.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=R5(t,r,i,e))}l==null&&(l=A5(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:l,inside:u?u.posAtStart-u.border:-1}}function lx(t){return t.top<t.bottom||t.left<t.right}function ho(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(lx(r))return r}return Array.prototype.find.call(n,lx)||t.getBoundingClientRect()}const N5=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function BD(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=af||ti;if(r.nodeType==3)if(o&&(N5.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let u=ho(gs(r,i,i),n);if(ti&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let f=ho(gs(r,i-1,i-1),-1);if(f.top==u.top){let h=ho(gs(r,i,i+1),-1);if(h.top!=u.top)return Uu(h,h.left<f.left)}}return u}else{let u=i,f=i,h=n<0?1:-1;return n<0&&!i?(f++,h=-1):n>=0&&i==r.nodeValue.length?(u--,h=1):n<0?u--:f++,Uu(ho(gs(r,u,f),h),h<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==ei(r))){let u=r.childNodes[i-1];if(u.nodeType==1)return Av(u.getBoundingClientRect(),!1)}if(s==null&&i<ei(r)){let u=r.childNodes[i];if(u.nodeType==1)return Av(u.getBoundingClientRect(),!0)}return Av(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==ei(r))){let u=r.childNodes[i-1],f=u.nodeType==3?gs(u,ei(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(f)return Uu(ho(f,1),!1)}if(s==null&&i<ei(r)){let u=r.childNodes[i];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let f=u?u.nodeType==3?gs(u,0,o?0:1):u.nodeType==1?u:null:null;if(f)return Uu(ho(f,-1),!0)}return Uu(ho(r.nodeType==3?gs(r):r,-n),n>=0)}function Uu(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 Av(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 VD(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 O5(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return VD(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=BD(t,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let u;if(l.nodeType==1)u=l.getClientRects();else if(l.nodeType==3)u=gs(l,0,l.nodeValue.length).getClientRects();else continue;for(let f=0;f<u.length;f++){let h=u[f];if(h.bottom>h.top+1&&(n=="up"?o.top-h.top>(h.bottom-o.top)*2:h.bottom-o.bottom>(o.bottom-h.top)*2))return!1}}return!0})}const D5=/[\u0590-\u08ac]/;function I5(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,l=t.domSelection();return l?!D5.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?s:o:VD(t,e,()=>{let{focusNode:u,focusOffset:f,anchorNode:h,anchorOffset:m}=t.domSelectionRange(),g=l.caretBidiLevel;l.modify("move",n,"character");let b=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:x,focusOffset:S}=t.domSelectionRange(),k=x&&!b.contains(x.nodeType==1?x:x.parentNode)||u==x&&f==S;try{l.collapse(h,m),u&&(u!=h||f!=m)&&l.extend&&l.extend(u,f)}catch{}return g!=null&&(l.caretBidiLevel=g),k}):r.pos==r.start()||r.pos==r.end()}let fA=null,hA=null,pA=!1;function j5(t,e,n){return fA==e&&hA==n?pA:(fA=e,hA=n,pA=n=="up"||n=="down"?O5(t,e,n):I5(t,e,n))}const ni=0,mA=1,Aa=2,xi=3;class lf{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=ni,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(e){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>Vn(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 l=i.children[o];if(l.size){i=l;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],l=s+o.size;if(l>e||o instanceof UD){i=e-s;break}s=l}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 HD&&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?Vn(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?Vn(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,l=0;;l++){let u=this.children[l],f=o+u.size;if(i==-1&&e<=f){let h=o+u.border;if(e>=h&&n<=f-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,h);e=o;for(let m=l;m>0;m--){let g=this.children[m-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){i=Vn(g.dom)+1;break}e-=g.size}i==-1&&(i=0)}if(i>-1&&(f>n||l==this.children.length-1)){n=f;for(let h=l+1;h<this.children.length;h++){let m=this.children[h];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(-1)){s=Vn(m.dom);break}n+=m.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=f}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 b=0,x=0;b<this.children.length;b++){let S=this.children[b],k=x+S.size;if(s>x&&o<k)return S.setSelection(e-x-S.border,n-x-S.border,r,i);x=k}let l=this.domFromPos(e,e?-1:1),u=n==e?l:this.domFromPos(n,n?-1:1),f=r.root.getSelection(),h=r.domSelectionRange(),m=!1;if((ti||Yn)&&e==n){let{node:b,offset:x}=l;if(b.nodeType==3){if(m=!!(x&&b.nodeValue[x-1]==`
70
- `),m&&x==b.nodeValue.length)for(let S=b,k;S;S=S.parentNode){if(k=S.nextSibling){k.nodeName=="BR"&&(l=u={node:k.parentNode,offset:Vn(k)+1});break}let C=S.pmViewDesc;if(C&&C.node&&C.node.isBlock)break}}else{let S=b.childNodes[x-1];m=S&&(S.nodeName=="BR"||S.contentEditable=="false")}}if(ti&&h.focusNode&&h.focusNode!=u.node&&h.focusNode.nodeType==1){let b=h.focusNode.childNodes[h.focusOffset];b&&b.contentEditable=="false"&&(i=!0)}if(!(i||m&&Yn)&&qa(l.node,l.offset,h.anchorNode,h.anchorOffset)&&qa(u.node,u.offset,h.focusNode,h.focusOffset))return;let g=!1;if((f.extend||e==n)&&!(m&&ti)){f.collapse(l.node,l.offset);try{e!=n&&f.extend(u.node,u.offset),g=!0}catch{}}if(!g){if(e>n){let x=l;l=u,u=x}let b=document.createRange();b.setEnd(u.node,u.offset),b.setStart(l.node,l.offset),f.removeAllRanges(),f.addRange(b)}}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 l=r+s.border,u=o-s.border;if(e>=l&&n<=u){this.dirty=e==r||n==o?Aa:mA,e==l&&n==u&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=xi:s.markDirty(e-l,n-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Aa:xi}r=o}this.dirty=Aa}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Aa:mA;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class HD extends lf{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 l=document.createElement("span");l.appendChild(o),o=l}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==ni&&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 L5 extends lf{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 jo extends lf{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=nl.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new jo(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&xi||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=xi&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=ni){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=ni}}slice(e,n,r){let i=jo.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=ux(s,n,o,r)),e>0&&(s=ux(s,0,e,r));for(let l=0;l<s.length;l++)s[l].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 Lo extends lf{constructor(e,n,r,i,s,o,l){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,n,r,i,s,o){let l=s.nodeViews[n.type.name],u,f=l&&l(n,s,()=>{if(!u)return o;if(u.parent)return u.parent.posBeforeChild(u)},r,i),h=f&&f.dom,m=f&&f.contentDOM;if(n.isText){if(!h)h=document.createTextNode(n.text);else if(h.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else h||({dom:h,contentDOM:m}=nl.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&h.nodeName!="BR"&&(h.hasAttribute("contenteditable")||(h.contentEditable="false"),n.type.spec.draggable&&(h.draggable=!0));let g=h;return h=GD(h,r,n),f?u=new P5(e,n,r,i,h,m||null,g,f):n.isText?new lg(e,n,r,i,h,g):new Lo(e,n,r,i,h,m||null,g)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let n={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(n.preserveWhitespace="full"),!this.contentDOM)n.getContent=()=>this.node.content;else if(!this.contentLost)n.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let i=this.children[r];if(this.dom.contains(i.dom.parentNode)){n.contentElement=i.dom.parentNode;break}}if(!n.contentElement){let r=e&&e.find(i=>i.nodeType==1&&e.indexOf(i.parentNode)<0&&this.dom.contains(i));r?n.contentElement=r:n.getContent=()=>de.empty}}return n}matchesNode(e,n,r){return this.dirty==ni&&e.eq(this.node)&&Yp(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,l=s&&s.pos<0,u=new $5(this,o&&o.node,e);H5(this.node,this.innerDeco,(f,h,m)=>{f.spec.marks?u.syncToMarks(f.spec.marks,r,e,h):f.type.side>=0&&!m&&u.syncToMarks(h==this.node.childCount?jt.none:this.node.child(h).marks,r,e,h),u.placeWidget(f,e,i)},(f,h,m,g)=>{u.syncToMarks(f.marks,r,e,g);let b;u.findNodeMatch(f,h,m,g)||l&&e.state.selection.from>i&&e.state.selection.to<i+f.nodeSize&&(b=u.findIndexWithChild(s.node))>-1&&u.updateNodeAt(f,h,m,b,e)||u.updateNextNode(f,h,m,e,g,i)||u.addNode(f,h,m,e,i),i+=f.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==Aa)&&(o&&this.protectLocalComposition(e,o),FD(this.contentDOM,this.children,e),_c&&U5(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof $e)||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,l=F5(this.node.content,o,r-n,i-n);return l<0?null:{node:s,pos:l,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 L5(this,s,n,i);e.input.compositionNodes.push(o),this.children=ux(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==xi||!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=ni}updateOuterDeco(e){if(Yp(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=qD(this.dom,this.nodeDOM,cx(this.outerDeco,this.node,n),cx(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 gA(t,e,n,r,i){GD(r,e,t);let s=new Lo(void 0,t,e,n,r,r,r);return s.contentDOM&&s.updateChildren(i,0),s}class lg extends Lo{constructor(e,n,r,i,s,o){super(e,n,r,i,s,null,o)}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==xi||this.dirty!=ni&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=ni||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=ni,!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 lg(this.parent,i,this.outerDeco,this.innerDeco,s,s)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=xi)}get domAtom(){return!1}isText(e){return this.node.text==e}}class UD extends lf{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ni&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class P5 extends Lo{constructor(e,n,r,i,s,o,l,u){super(e,n,r,i,s,o,l),this.spec=u}update(e,n,r,i){if(this.dirty==xi)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 FD(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],l=o.dom;if(l.parentNode==t){for(;l!=r;)r=yA(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(l,r);if(o instanceof jo){let u=r?r.previousSibling:t.lastChild;FD(o.contentDOM,o.children,n),r=u?u.nextSibling:t.firstChild}}for(;r;)r=yA(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const hd=function(t){t&&(this.nodeName=t)};hd.prototype=Object.create(null);const Ra=[new hd];function cx(t,e,n){if(t.length==0)return Ra;let r=n?Ra[0]:new hd,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new hd(o.nodeName));for(let l in o){let u=o[l];u!=null&&(n&&i.length==1&&i.push(r=new hd(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+u:l=="style"?r.style=(r.style?r.style+";":"")+u:l!="nodeName"&&(r[l]=u))}}}return i}function qD(t,e,n,r){if(n==Ra&&r==Ra)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],l=n[s];if(s){let u;l&&l.nodeName==o.nodeName&&i!=t&&(u=i.parentNode)&&u.nodeName.toLowerCase()==o.nodeName||(u=document.createElement(o.nodeName),u.pmIsDeco=!0,u.appendChild(i),l=Ra[0]),i=u}z5(i,l||Ra[0],o)}return i}function z5(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 GD(t,e,n){return qD(t,t,Ra,cx(e,n,t.nodeType!=1))}function Yp(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 yA(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class $5{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=B5(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,l=Math.min(o,e.length);for(;s<l&&(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=ni,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let u=-1,f=this.top.children.length;i<this.preMatch.index&&(f=Math.min(this.index+3,f));for(let h=this.index;h<f;h++){let m=this.top.children[h];if(m.matchesMark(e[o])&&!this.isLocked(m.dom)){u=h;break}}if(u<0&&this.index<this.top.children.length){let h=this.top.children[this.index];h instanceof jo&&h.dirty!=xi&&h.mark.type==e[o].type&&h.spec.update&&!this.isLocked(h.dom)&&h.spec.update(e[o])&&(h.mark=e[o],u=this.index,this.changed=!0)}if(u>-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let h=jo.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,h),this.top=h,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 l=this.index,u=Math.min(this.top.children.length,l+5);l<u;l++){let f=this.top.children[l];if(f.matchesNode(e,n,r)&&!this.preMatch.matched.has(f)){s=l;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==xi&&o.dom==o.contentDOM&&(o.dirty=Aa),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 l=this.index;l<this.top.children.length;l++){let u=this.top.children[l];if(u instanceof Lo){let f=this.preMatch.matched.get(u);if(f!=null&&f!=s)return!1;let h=u.dom,m,g=this.isLocked(h)&&!(e.isText&&u.node&&u.node.isText&&u.nodeDOM.nodeValue==e.text&&u.dirty!=xi&&Yp(n,u.outerDeco));if(!g&&u.update(e,n,r,i))return this.destroyBetween(this.index,l),u.dom!=h&&(this.changed=!0),this.index++,!0;if(!g&&(m=this.recreateWrapper(u,e,n,r,i,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=m,m.contentDOM&&(m.dirty=Aa,m.updateChildren(i,o+1),m.dirty=ni),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)||!Yp(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=Lo.create(this.top,n,r,i,s,o);if(l.contentDOM){l.children=e.children,e.children=[];for(let u of l.children)u.parent=l}return e.destroy(),l}addNode(e,n,r,i,s){let o=Lo.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 HD(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 jo;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof lg)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Yn||Un)&&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 UD(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 B5(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let l;for(;;)if(r){let f=n.children[r-1];if(f instanceof jo)n=f,r=f.children.length;else{l=f,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=l.node;if(u){if(u!=t.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}function V5(t,e){return t.type.side-e.type.side}function H5(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let f=0;f<t.childCount;f++){let h=t.child(f);r(h,i,e.forChild(s,h),f),s+=h.nodeSize}return}let o=0,l=[],u=null;for(let f=0;;){let h,m;for(;o<i.length&&i[o].to==s;){let k=i[o++];k.widget&&(h?(m||(m=[h])).push(k):h=k)}if(h)if(m){m.sort(V5);for(let k=0;k<m.length;k++)n(m[k],f,!!u)}else n(h,f,!!u);let g,b;if(u)b=-1,g=u,u=null;else if(f<t.childCount)b=f,g=t.child(f++);else break;for(let k=0;k<l.length;k++)l[k].to<=s&&l.splice(k--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)l.push(i[o++]);let x=s+g.nodeSize;if(g.isText){let k=x;o<i.length&&i[o].from<k&&(k=i[o].from);for(let C=0;C<l.length;C++)l[C].to<k&&(k=l[C].to);k<x&&(u=g.cut(k-s),g=g.cut(0,k-s),x=k,b=-1)}else for(;o<i.length&&i[o].to<x;)o++;let S=g.isInline&&!g.isLeaf?l.filter(k=>!k.inline):l.slice();r(g,S,e.forChild(s,g),b),s=x}}function U5(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 F5(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),l=s;if(s+=o.nodeSize,!o.isText)continue;let u=o.text;for(;i<t.childCount;){let f=t.child(i++);if(s+=f.nodeSize,!f.isText)break;u+=f.text}if(s>=n){if(s>=r&&u.slice(r-e.length-l,r-l)==e)return r-e.length;let f=l<r?u.lastIndexOf(e,r-l-1):-1;if(f>=0&&f+e.length+l>=n)return l+f;if(n==r&&u.length>=r+e.length-l&&u.slice(r-l,r-l+e.length)==e)return r}}return-1}function ux(t,e,n,r,i){let s=[];for(let o=0,l=0;o<t.length;o++){let u=t[o],f=l,h=l+=u.size;f>=n||h<=e?s.push(u):(f<e&&s.push(u.slice(0,e-f,r)),i&&(s.push(i),i=void 0),h>n&&s.push(u.slice(n-f,u.size,r)))}return s}function Xw(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 l=r.resolve(o),u,f;if(ag(n)){for(u=o;i&&!i.node;)i=i.parent;let m=i.node;if(i&&m.isAtom&&He.isSelectable(m)&&i.parent&&!(m.isInline&&y5(n.focusNode,n.focusOffset,i.dom))){let g=i.posBefore;f=new He(o==g?l:r.resolve(g))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=o,g=o;for(let b=0;b<n.rangeCount;b++){let x=n.getRangeAt(b);m=Math.min(m,t.docView.posFromDOM(x.startContainer,x.startOffset,1)),g=Math.max(g,t.docView.posFromDOM(x.endContainer,x.endOffset,-1))}if(m<0)return null;[u,o]=g==t.state.selection.anchor?[g,m]:[m,g],l=r.resolve(o)}else u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null}let h=r.resolve(u);if(!f){let m=e=="pointer"||t.state.selection.head<l.pos&&!s?1:-1;f=Jw(t,h,l,m)}return f}function WD(t){return t.editable?t.hasFocus():ZD(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Rs(t,e=!1){let n=t.state.selection;if(KD(t,n),!WD(t))return;let r=t.input.mouseDown;if(!e&&Un&&r){let i=t.domSelectionRange(),s=t.domObserver.currentSelection;if(i.anchorNode&&s.anchorNode&&qa(i.anchorNode,i.anchorOffset,s.anchorNode,s.anchorOffset)&&r.delaySelUpdate()){t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)G5(t);else{let{anchor:i,head:s}=n,o,l;bA&&!(n instanceof $e)&&(n.$from.parent.inlineContent||(o=vA(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=vA(t,n.to))),t.docView.setSelection(i,s,t,e),bA&&(o&&xA(o),l&&xA(l)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&q5(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}const bA=Yn||Un&&ID<63;function vA(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(Yn&&i&&i.contentEditable=="false")return Rv(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Rv(i);if(s)return Rv(s)}}function Rv(t){return t.contentEditable="true",Yn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function xA(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function q5(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(()=>{(!WD(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function G5(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Vn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&gr&&Io<=11&&(n.disabled=!0,n.disabled=!1)}function KD(t,e){if(e instanceof He){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(wA(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else wA(t)}function wA(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Jw(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||$e.between(e,n,r)}function SA(t){return t.editable&&!t.hasFocus()?!1:ZD(t)}function ZD(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 W5(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return qa(e.node,e.offset,n.anchorNode,n.anchorOffset)}function dx(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&&Ke.findFrom(s,e)}function go(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function kA(t,e,n){let r=t.state.selection;if(r instanceof $e)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 go(t,new $e(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=dx(t.state,e);return i&&i instanceof He?go(t,i):!1}else if(!(Jr&&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 l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(l))&&!o.contentDOM?He.isSelectable(s)?go(t,new He(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):af?go(t,new $e(t.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof He&&r.node.isInline)return go(t,new $e(e>0?r.$to:r.$from));{let i=dx(t.state,e);return i?go(t,i):!1}}}function Xp(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function pd(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Kl(t,e){return e<0?K5(t):Z5(t)}function K5(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(ti&&n.nodeType==1&&r<Xp(n)&&pd(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(pd(l,-1))i=n,s=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(YD(n))break;{let l=n.previousSibling;for(;l&&pd(l,-1);)i=n.parentNode,s=Vn(l),l=l.previousSibling;if(l)n=l,r=Xp(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?fx(t,n,r):i&&fx(t,i,s)}function Z5(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Xp(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let l=n.childNodes[r];if(pd(l,1))s=n,o=++r;else break}else{if(YD(n))break;{let l=n.nextSibling;for(;l&&pd(l,1);)s=l.parentNode,o=Vn(l)+1,l=l.nextSibling;if(l)n=l,r=0,i=Xp(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&fx(t,s,o)}function YD(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Y5(t,e){for(;t&&e==t.childNodes.length&&!of(t);)e=Vn(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 X5(t,e){for(;t&&!e&&!of(t);)e=Vn(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 fx(t,e,n){if(e.nodeType!=3){let s,o;(o=Y5(e,n))?(e=o,n=0):(s=X5(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(ag(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&&Rs(t)},50)}function CA(t,e){let n=t.state.doc.resolve(e);if(!(Un||jD)&&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 EA(t,e,n){let r=t.state.selection;if(r instanceof $e&&!r.empty||n.indexOf("s")>-1||Jr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=dx(t.state,e);if(o&&o instanceof He)return go(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof Ir?Ke.near(o,e):Ke.findFrom(o,e);return l?go(t,l):!1}return!1}function TA(t,e){if(!(t.state.selection instanceof $e))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 _A(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function J5(t){if(!Yn||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;_A(t,r,"true"),setTimeout(()=>_A(t,r,"false"),20)}return!1}function Q5(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function e6(t,e){let n=e.keyCode,r=Q5(e);if(n==8||Jr&&n==72&&r=="c")return TA(t,-1)||Kl(t,-1);if(n==46&&!e.shiftKey||Jr&&n==68&&r=="c")return TA(t,1)||Kl(t,1);if(n==13||n==27)return!0;if(n==37||Jr&&n==66&&r=="c"){let i=n==37?CA(t,t.state.selection.from)=="ltr"?-1:1:-1;return kA(t,i,r)||Kl(t,i)}else if(n==39||Jr&&n==70&&r=="c"){let i=n==39?CA(t,t.state.selection.from)=="ltr"?1:-1:1;return kA(t,i,r)||Kl(t,i)}else{if(n==38||Jr&&n==80&&r=="c")return EA(t,-1,r)||Kl(t,-1);if(n==40||Jr&&n==78&&r=="c")return J5(t)||EA(t,1,r)||Kl(t,1);if(r==(Jr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Qw(t,e){t.someProp("transformCopied",b=>{e=b(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 b=r.firstChild;n.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),r=b.content}let o=t.someProp("clipboardSerializer")||nl.fromSchema(t.state.schema),l=nI(),u=l.createElement("div");u.appendChild(o.serializeFragment(r,{document:l}));let f=u.firstChild,h,m=0;for(;f&&f.nodeType==1&&(h=tI[f.nodeName.toLowerCase()]);){for(let b=h.length-1;b>=0;b--){let x=l.createElement(h[b]);for(;u.firstChild;)x.appendChild(u.firstChild);u.appendChild(x),m++}f=u.firstChild}f&&f.nodeType==1&&f.setAttribute("data-pm-slice",`${i} ${s}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",b=>b(e,t))||e.content.textBetween(0,e.content.size,`
71
-
72
- `);return{dom:u,text:g,slice:e}}function XD(t,e,n,r,i){let s=i.parent.type.spec.code,o,l;if(!n&&!e)return null;let u=!!e&&(r||s||!n);if(u){if(t.someProp("transformPastedText",g=>{e=g(e,s||r,t)}),s)return l=new Ee(de.from(t.state.schema.text(e.replace(/\r\n?/g,`
73
- `))),0,0),t.someProp("transformPasted",g=>{l=g(l,t,!0)}),l;let m=t.someProp("clipboardTextParser",g=>g(e,i,r,t));if(m)l=m;else{let g=i.marks(),{schema:b}=t.state,x=nl.fromSchema(b);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(S=>{let k=o.appendChild(document.createElement("p"));S&&k.appendChild(x.serializeNode(b.text(S,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=i6(n),af&&s6(o);let f=o&&o.querySelector("[data-pm-slice]"),h=f&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(f.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let m=+h[3];m>0;m--){let g=o.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;o=g}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||_s.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||h),context:i,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!t6.test(g.parentNode.nodeName)?{ignore:!0}:null}})),h)l=o6(AA(l,+h[1],+h[2]),h[4]);else if(l=Ee.maxOpen(n6(l.content,i),!0),l.openStart||l.openEnd){let m=0,g=0;for(let b=l.content.firstChild;m<l.openStart&&!b.type.spec.isolating;m++,b=b.firstChild);for(let b=l.content.lastChild;g<l.openEnd&&!b.type.spec.isolating;g++,b=b.lastChild);l=AA(l,m,g)}return t.someProp("transformPasted",m=>{l=m(l,t,u)}),l}const t6=/^(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 n6(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(l=>{if(!o)return;let u=i.findWrapping(l.type),f;if(!u)return o=null;if(f=o.length&&s.length&&QD(u,s,l,o[o.length-1],0))o[o.length-1]=f;else{o.length&&(o[o.length-1]=eI(o[o.length-1],s.length));let h=JD(l,u);o.push(h),i=i.matchType(h.type),s=u}}),o)return de.from(o)}return t}function JD(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,de.from(t));return t}function QD(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=QD(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(JD(n,t,i+1))))}}function eI(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,eI(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(de.empty,!0);return t.copy(n.append(r))}function hx(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,l=o.content;return t.childCount>1&&(s=0),i<r-1&&(l=hx(l,e,n,r,i+1,s)),i>=n&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(de.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function AA(t,e,n){return e<t.openStart&&(t=new Ee(hx(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new Ee(hx(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const tI={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function nI(){return document.implementation.createHTMLDocument("title")}let Mv=null;function r6(t){let e=window.trustedTypes;return e?(Mv||(Mv=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Mv.createHTML(t)):t}function i6(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=nI(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(t),s;if((s=i&&tI[i[1].toLowerCase()])&&(t=s.map(o=>"<"+o+">").join("")+t+s.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=r6(t),s)for(let o=0;o<s.length;o++)r=r.querySelector(s[o])||r;for(let o=0;o<n.styleSheets.length;o++){let l=n.styleSheets[o];for(let u=0;u<l.rules.length;u++){let f=l.rules[u];if(f instanceof CSSStyleRule){let h=r.querySelectorAll(f.selectorText);for(let m=0;m<h.length;m++)h[m].style.cssText+=f.style.cssText}}}return r}function s6(t){let e=t.querySelectorAll(Un?"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 o6(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 l=r.length-2;l>=0;l-=2){let u=n.nodes[r[l]];if(!u||u.hasRequiredAttrs())break;i=de.from(u.create(r[l+1],i)),s++,o++}return new Ee(i,s,o)}const or={},ar={},a6={touchstart:!0,touchmove:!0};class l6{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 c6(t){for(let e in or){let n=or[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{d6(t,r)&&!eS(t,r)&&(t.editable||!(r.type in ar))&&n(t,r)},a6[e]?{passive:!0}:void 0)}Yn&&t.dom.addEventListener("input",()=>null),px(t)}function Ts(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function u6(t){t.input.mouseDown&&t.input.mouseDown.done(),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 px(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>eS(t,r))})}function eS(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function d6(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 f6(t,e){!eS(t,e)&&or[e.type]&&(t.editable||!(e.type in ar))&&or[e.type](t,e)}ar.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!oI(t)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Es&&Un&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),_c&&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,Ca(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||e6(t,n)?n.preventDefault():Ts(t,"key")};ar.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};ar.keypress=(t,e)=>{let n=e;if(oI(t)||!n.charCode||n.ctrlKey&&!n.altKey||Jr&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof $e)||!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 cf(t){return{left:t.clientX,top:t.clientY}}function h6(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function tS(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,l=>o>s.depth?l(t,n,s.nodeAfter,s.before(o),i,!0):l(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function uf(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 p6(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&He.isSelectable(r)?(uf(t,new He(n)),!0):!1}function m6(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof He&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(He.isSelectable(l)){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?(uf(t,He.create(t.state.doc,i)),!0):!1}function g6(t,e,n,r,i){return tS(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?m6(t,n):p6(t,n))}function y6(t,e,n,r){return tS(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function b6(t,e,n,r){return tS(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||v6(t,n,r)}function v6(t,e,n){if(n.button!=0)return!1;let r=rI(t,e,!0),i=t.state.doc;return r?(uf(t,r),r instanceof $e&&i.eq(t.state.doc)&&(t.input.mouseDown=new w6(t,r)),!0):!1}function rI(t,e,n){let r=t.state.doc;if(e==-1)return r.inlineContent?$e.create(r,0,r.content.size):null;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)return $e.create(r,l+1,l+1+o.content.size);if(n&&He.isSelectable(o))return He.create(r,l)}return null}function nS(t){return Jp(t)}const iI=Jr?"metaKey":"ctrlKey";or.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=nS(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&h6(n,t.input.lastClick)&&!n[iI]&&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},t.input.mouseDown&&t.input.mouseDown.done();let o=t.posAtCoords(cf(n));o&&(s=="singleClick"?t.input.mouseDown=new x6(t,o,n,!!r):(s=="doubleClick"?y6:b6)(t,o.pos,o.inside,n)?n.preventDefault():Ts(t,"pointer"))};class sI{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class x6 extends sI{constructor(e,n,r,i){super(e),this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[iI],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let h=e.state.doc.resolve(n.pos);s=h.parent,o=h.depth?h.before():0}const l=i?null:r.target,u=l?e.docView.nearestDesc(l,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:f}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||f instanceof He&&f.from<=o&&f.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ti&&!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()),Ts(e,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||Rs(this.view)})}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(cf(e))),this.updateAllowDefault(e),this.allowDefault||!n?Ts(this.view,"pointer"):g6(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Yn&&this.mightDrag&&!this.mightDrag.node.isAtom||Un&&!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)?(uf(this.view,Ke.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Ts(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ts(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class w6 extends sI{constructor(e,n){super(e),this.startSelection=n,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),Ts(this.view,"pointer");let n=this.view.posAtCoords(cf(e)),r=n&&rI(this.view,n.inside,!1);if(!r)return;let{doc:i}=this.view.state,s=this.startSelection,[o,l]=r.from<s.from?[s.to,r.from]:[s.from,r.to];uf(this.view,$e.create(i,o,l))}}or.touchstart=t=>{t.input.lastTouch=Date.now(),nS(t),Ts(t,"pointer")};or.touchmove=t=>{t.input.lastTouch=Date.now(),Ts(t,"pointer")};or.contextmenu=t=>nS(t);function oI(t,e){return t.composing?!0:Yn&&Math.abs(Date.now()-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const S6=Es?5e3:-1;ar.compositionstart=ar.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof $e&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Un&&jD&&k6(t)))t.markCursor=t.state.storedMarks||n.marks(),Jp(t,!0),t.markCursor=null;else if(Jp(t,!e.selection.empty),ti&&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 l=t.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}aI(t,S6)};function k6(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"}ar.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now(),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++,aI(t,20))};function aI(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Jp(t),e))}function lI(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function C6(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=m5(e.focusNode,e.focusOffset),r=g5(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 Jp(t,e=!1){if(!(Es&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),lI(t),e||t.docView&&t.docView.dirty){let n=Xw(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 E6(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 $d=gr&&Io<15||_c&&x5<604;or.copy=ar.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=$d?null:n.clipboardData,o=r.content(),{dom:l,text:u}=Qw(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",u)):E6(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function T6(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function _6(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?Bd(t,r.value,null,i,e):Bd(t,r.textContent,r.innerHTML,i,e)},50)}function Bd(t,e,n,r,i){let s=XD(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,i,s||Ee.empty)))return!0;if(!s)return!1;let o=T6(s),l=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function cI(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," "):""}ar.paste=(t,e)=>{let n=e;if(t.composing&&!Es)return;let r=$d?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Bd(t,cI(r),r.getData("text/html"),i,n)?n.preventDefault():_6(t,n)};class uI{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const A6=Jr?"altKey":"ctrlKey";function dI(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[A6]}or.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(cf(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof He?i.to-1:i.to))){if(r&&r.mightDrag)o=He.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(o=He.create(t.state.doc,m.posBefore))}}let l=(o||t.state.selection).content(),{dom:u,text:f,slice:h}=Qw(t,l);(!n.dataTransfer.files.length||!Un||ID>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData($d?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",$d||n.dataTransfer.setData("text/plain",f),t.dragging=new uI(h,dI(t,n),o)};or.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};ar.dragover=ar.dragenter=(t,e)=>e.preventDefault();ar.drop=(t,e)=>{try{R6(t,e,t.dragging)}finally{t.dragging=null}};function R6(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(cf(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",b=>{s=b(s,t,!1)}):s=XD(t,cI(e.dataTransfer),$d?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&dI(t,e));if(t.someProp("handleDrop",b=>b(t,e,s||Ee.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let l=s?fD(t.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let u=t.state.tr;if(o){let{node:b}=n;b?b.replace(u):u.deleteSelection()}let f=u.mapping.map(l),h=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,m=u.doc;if(h?u.replaceRangeWith(f,f,s.content.firstChild):u.replaceRange(f,f,s),u.doc.eq(m))return;let g=u.doc.resolve(f);if(h&&He.isSelectable(s.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new He(g));else{let b=u.mapping.map(l);u.mapping.maps[u.mapping.maps.length-1].forEach((x,S,k,C)=>b=C),u.setSelection(Jw(t,g,u.doc.resolve(b)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}or.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())&&Rs(t)},20))};or.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)};or.beforeinput=(t,e)=>{if(Es&&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,Ca(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 ar)or[t]=ar[t];function Vd(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 Qp{constructor(e,n){this.toDOM=e,this.spec=n||ja,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 Tn(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Qp&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Vd(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Po{constructor(e,n){this.attrs=e,this.spec=n||ja}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 Tn(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Po&&Vd(this.attrs,e.attrs)&&Vd(this.spec,e.spec)}static is(e){return e.type instanceof Po}destroy(){}}class rS{constructor(e,n){this.attrs=e,this.spec=n||ja}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 Tn(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 rS&&Vd(this.attrs,e.attrs)&&Vd(this.spec,e.spec)}destroy(){}}class Tn{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Tn(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 Tn(e,e,new Qp(n,r))}static inline(e,n,r,i){return new Tn(e,n,new Po(r,i))}static node(e,n,r,i){return new Tn(e,n,new rS(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Po}get widget(){return this.type instanceof Qp}}const sc=[],ja={};class Et{constructor(e,n){this.local=e.length?e:sc,this.children=n.length?n:sc}static create(e,n){return n.length?em(n,e,0,ja):Kn}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 l=this.local[o];l.from<=n&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,n-l,r,i+l,s)}}map(e,n,r){return this==Kn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||ja)}mapInner(e,n,r,i,s){let o;for(let l=0;l<this.local.length;l++){let u=this.local[l].map(e,r,i);u&&u.type.valid(n,u)?(o||(o=[])).push(u):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?M6(this.children,o||[],e,n,r,i,s):o?new Et(o.sort(La),sc):Kn}add(e,n){return n.length?this==Kn?Et.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((l,u)=>{let f=u+r,h;if(h=hI(n,l,f)){for(i||(i=this.children.slice());s<i.length&&i[s]<u;)s+=3;i[s]==u?i[s+2]=i[s+2].addInner(l,h,f+1):i.splice(s,0,u,u+l.nodeSize,em(h,l,f+1,ja)),s+=3}});let o=fI(s?pI(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new Et(o.length?this.local.concat(o).sort(La):this.local,i||this.children)}remove(e){return e.length==0||this==Kn?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,l=r[s]+n,u=r[s+1]+n;for(let h=0,m;h<e.length;h++)(m=e[h])&&m.from>l&&m.to<u&&(e[h]=null,(o||(o=[])).push(m));if(!o)continue;r==this.children&&(r=this.children.slice());let f=r[s+2].removeInner(o,l+1);f!=Kn?r[s+2]=f:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let l=0;l<i.length;l++)i[l].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Et(i,r):Kn}forChild(e,n){if(this==Kn)return this;if(n.isLeaf)return Et.empty;let r,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,o=s+n.content.size;for(let l=0;l<this.local.length;l++){let u=this.local[l];if(u.from<o&&u.to>s&&u.type instanceof Po){let f=Math.max(s,u.from)-s,h=Math.min(o,u.to)-s;f<h&&(i||(i=[])).push(u.copy(f,h))}}if(i){let l=new Et(i.sort(La),sc);return r?new ko([l,r]):l}return r||Kn}eq(e){if(this==e)return!0;if(!(e instanceof Et)||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 iS(this.localsInner(e))}localsInner(e){if(this==Kn)return sc;if(e.inlineContent||!this.local.some(Po.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Po||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Et.empty=new Et([],[]);Et.removeOverlap=iS;const Kn=Et.empty;class ko{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,ja));return ko.from(r)}forChild(e,n){if(n.isLeaf)return Et.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=Kn&&(s instanceof ko?r=r.concat(s.members):r.push(s))}return ko.from(r)}eq(e){if(!(e instanceof ko)||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?iS(r?n:n.sort(La)):sc}static from(e){switch(e.length){case 0:return Kn;case 1:return e[0];default:return new ko(e.every(n=>n instanceof Et)?e:e.reduce((n,r)=>n.concat(r instanceof Et?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function M6(t,e,n,r,i,s,o){let l=t.slice();for(let f=0,h=s;f<n.maps.length;f++){let m=0;n.maps[f].forEach((g,b,x,S)=>{let k=S-x-(b-g);for(let C=0;C<l.length;C+=3){let _=l[C+1];if(_<0||g>_+h-m)continue;let M=l[C]+h-m;b>=M?l[C+1]=g<=M?-2:-1:g>=h&&k&&(l[C]+=k,l[C+1]+=k)}m+=k}),h=n.maps[f].map(h,-1)}let u=!1;for(let f=0;f<l.length;f+=3)if(l[f+1]<0){if(l[f+1]==-2){u=!0,l[f+1]=-1;continue}let h=n.map(t[f]+s),m=h-i;if(m<0||m>=r.content.size){u=!0;continue}let g=n.map(t[f+1]+s,-1),b=g-i,{index:x,offset:S}=r.content.findIndex(m),k=r.maybeChild(x);if(k&&S==m&&S+k.nodeSize==b){let C=l[f+2].mapInner(n,k,h+1,t[f]+s+1,o);C!=Kn?(l[f]=m,l[f+1]=b,l[f+2]=C):(l[f+1]=-2,u=!0)}else u=!0}if(u){let f=N6(l,t,e,n,i,s,o),h=em(f,r,0,o);e=h.local;for(let m=0;m<l.length;m+=3)l[m+1]<0&&(l.splice(m,3),m-=3);for(let m=0,g=0;m<h.children.length;m+=3){let b=h.children[m];for(;g<l.length&&l[g]<b;)g+=3;l.splice(g,0,h.children[m],h.children[m+1],h.children[m+2])}}return new Et(e.sort(La),l)}function fI(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 Tn(i.from+e,i.to+e,i.type))}return n}function N6(t,e,n,r,i,s,o){function l(u,f){for(let h=0;h<u.local.length;h++){let m=u.local[h].map(r,i,f);m?n.push(m):o.onRemove&&o.onRemove(u.local[h].spec)}for(let h=0;h<u.children.length;h+=3)l(u.children[h+2],u.children[h]+f+1)}for(let u=0;u<t.length;u+=3)t[u+1]==-1&&l(t[u+2],e[u]+s+1);return n}function hI(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 pI(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function em(t,e,n,r){let i=[],s=!1;e.forEach((l,u)=>{let f=hI(t,l,u+n);if(f){s=!0;let h=em(f,l,n+u+1,r);h!=Kn&&i.push(u,u+l.nodeSize,h)}});let o=fI(s?pI(t):t,-n).sort(La);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||i.length?new Et(o,i):Kn}function La(t,e){return t.from-e.from||t.to-e.to}function iS(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),RA(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),RA(e,i,r.copy(s.from,r.to)));break}}}return e}function RA(t,e,n){for(;e<t.length&&La(n,t[e])>0;)e++;t.splice(e,0,n)}function Nv(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Kn&&e.push(r)}),t.cursorWrapper&&e.push(Et.create(t.state.doc,[t.cursorWrapper.deco])),ko.from(e)}const O6={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},D6=gr&&Io<=11;class I6{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 j6{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new I6,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]);gr&&Io<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Yn&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),D6&&(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,O6)),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(SA(this.view)){if(this.suppressingSelectionUpdates)return Rs(this.view);if(gr&&Io<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&qa(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=Tc(s))n.add(s);for(let s=e.anchorNode;s;s=Tc(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)&&SA(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,u=[];if(e.editable)for(let h=0;h<n.length;h++){let m=this.registerMutation(n[h],u);m&&(s=s<0?m.from:Math.min(m.from,s),o=o<0?m.to:Math.max(m.to,o),m.typeOver&&(l=!0))}if(u.some(h=>h.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||Un&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&n.some(h=>h.type=="childList"&&h.removedNodes.length))){for(let h of u)if(h.nodeName=="BR"&&h.parentNode){let m=h.nextSibling;for(;m&&m.nodeType==1;){if(m.contentEditable=="false"){h.parentNode.removeChild(h);break}m=m.firstChild}}}else if(ti&&u.length){let h=u.filter(m=>m.nodeName=="BR");if(h.length==2){let[m,g]=h;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of h){let b=g.parentNode;b&&b.nodeName=="LI"&&(!m||z6(e,m)!=b)&&g.remove()}}}let f=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ag(r)&&(f=Xw(e))&&f.eq(Ke.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Rs(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),L6(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,$6(e,u)),this.handleDOMChange(s,o,l,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Rs(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 h=0;h<e.addedNodes.length;h++){let m=e.addedNodes[h];n.push(m),m.nodeType==3&&(this.lastChangedTextNode=m)}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(gr&&Io<=11&&e.addedNodes.length)for(let h=0;h<e.addedNodes.length;h++){let{previousSibling:m,nextSibling:g}=e.addedNodes[h];(!m||Array.prototype.indexOf.call(e.addedNodes,m)<0)&&(i=m),(!g||Array.prototype.indexOf.call(e.addedNodes,g)<0)&&(s=g)}let o=i&&i.parentNode==e.target?Vn(i)+1:0,l=r.localPosFromDOM(e.target,o,-1),u=s&&s.parentNode==e.target?Vn(s):e.target.childNodes.length,f=r.localPosFromDOM(e.target,u,1);return{from:l,to:f}}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 MA=new WeakMap,NA=!1;function L6(t){if(!MA.has(t)&&(MA.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=ti,NA)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."),NA=!0}}function OA(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return qa(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function P6(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return OA(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?OA(t,n):null}function z6(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 $6(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 l=o;for(;;){let u=l.firstChild;if(!u||u.nodeType!=1||u.contentEditable=="false"||/^(BR|IMG)$/.test(u.nodeName))break;l=u}l.insertBefore(s,l.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function B6(t,e,n,r){let{node:i,fromOffset:s,toOffset:o,from:l,to:u}=t.docView.parseRange(e,n),f=t.domSelectionRange(),h,m=f.anchorNode;if(m&&t.dom.contains(m.nodeType==1?m:m.parentNode)&&(h=[{node:m,offset:f.anchorOffset}],ag(f)||h.push({node:f.focusNode,offset:f.focusOffset})),Un&&t.input.lastKeyCode===8)for(let C=o;C>s;C--){let _=i.childNodes[C-1],M=_.pmViewDesc;if(_.nodeName=="BR"&&!M){o=C;break}if(!M||M.size)break}let g=t.state.doc,b=t.someProp("domParser")||_s.fromSchema(t.state.schema),x=g.resolve(l),S=null,k=b.parse(i,{topNode:x.parent,topMatch:x.parent.contentMatchAt(x.index()),topOpen:!0,from:s,to:o,preserveWhitespace:x.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:V6(r),context:x});if(h&&h[0].pos!=null){let C=h[0].pos,_=h[1]&&h[1].pos;_==null&&(_=C),S={anchor:C+l,head:_+l}}return{doc:k,sel:S,from:l,to:u}}const V6=t=>e=>{let n=e.pmViewDesc;if(n)return n.parseRule(t);if(e.nodeName=="BR"&&e.parentNode){if(Yn&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||Yn&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},H6=/^(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 U6(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let D=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,j=Xw(t,D);if(j&&!t.state.selection.eq(j)){if(Un&&Es&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",q=>q(t,Ca(13,"Enter"))))return;let z=t.state.tr.setSelection(j);D=="pointer"?z.setMeta("pointer",!0):D=="key"&&z.scrollIntoView(),s&&z.setMeta("composition",s),t.dispatch(z)}return}let o=t.state.doc.resolve(e),l=o.sharedDepth(n);e=o.before(l+1),n=t.state.doc.resolve(n).after(l+1);let u=t.state.selection,f=B6(t,e,n,i),h=t.state.doc,m=h.slice(f.from,f.to),g,b;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(g=t.state.selection.to,b="end"):(g=t.state.selection.from,b="start"),t.input.lastKeyCode=null;let x=G6(m.content,f.doc.content,f.from,g,b);if(x&&t.input.domChangeCount++,(_c&&t.input.lastIOSEnter>Date.now()-225||Es)&&i.some(D=>D.nodeType==1&&!H6.test(D.nodeName))&&(!x||x.endA>=x.endB)&&t.someProp("handleKeyDown",D=>D(t,Ca(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!x)if(r&&u instanceof $e&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(f.sel&&f.sel.anchor!=f.sel.head))x={start:u.from,endA:u.to,endB:u.to};else{if(f.sel){let D=DA(t,t.state.doc,f.sel);if(D&&!D.eq(t.state.selection)){let j=t.state.tr.setSelection(D);s&&j.setMeta("composition",s),t.dispatch(j)}}return}t.state.selection.from<t.state.selection.to&&x.start==x.endB&&t.state.selection instanceof $e&&(x.start>t.state.selection.from&&x.start<=t.state.selection.from+2&&t.state.selection.from>=f.from?x.start=t.state.selection.from:x.endA<t.state.selection.to&&x.endA>=t.state.selection.to-2&&t.state.selection.to<=f.to&&(x.endB+=t.state.selection.to-x.endA,x.endA=t.state.selection.to)),gr&&Io<=11&&x.endB==x.start+1&&x.endA==x.start&&x.start>f.from&&f.doc.textBetween(x.start-f.from-1,x.start-f.from+1)=="  "&&(x.start--,x.endA--,x.endB--);let S=f.doc.resolveNoCache(x.start-f.from),k=f.doc.resolveNoCache(x.endB-f.from),C=h.resolve(x.start),_=S.sameParent(k)&&S.parent.inlineContent&&C.end()>=x.endA;if((_c&&t.input.lastIOSEnter>Date.now()-225&&(!_||i.some(D=>D.nodeName=="DIV"||D.nodeName=="P"))||!_&&S.pos<f.doc.content.size&&(!S.sameParent(k)||!S.parent.inlineContent)&&S.pos<k.pos&&!/\S/.test(f.doc.textBetween(S.pos,k.pos,"","")))&&t.someProp("handleKeyDown",D=>D(t,Ca(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>x.start&&q6(h,x.start,x.endA,S,k)&&t.someProp("handleKeyDown",D=>D(t,Ca(8,"Backspace")))){Es&&Un&&t.domObserver.suppressSelectionUpdates();return}Un&&x.endB==x.start&&(t.input.lastChromeDelete=Date.now()),Es&&!_&&S.start()!=k.start()&&k.parentOffset==0&&S.depth==k.depth&&f.sel&&f.sel.anchor==f.sel.head&&f.sel.head==x.endA&&(x.endB-=2,k=f.doc.resolveNoCache(x.endB-f.from),setTimeout(()=>{t.someProp("handleKeyDown",function(D){return D(t,Ca(13,"Enter"))})},20));let M=x.start,R=x.endA,A=D=>{let j=D||t.state.tr.replace(M,R,f.doc.slice(x.start-f.from,x.endB-f.from));if(f.sel){let z=DA(t,j.doc,f.sel);z&&!(Un&&t.composing&&z.empty&&(x.start!=x.endB||t.input.lastChromeDelete<Date.now()-100)&&(z.head==M||z.head==j.mapping.map(R)-1)||gr&&z.empty&&z.head==M)&&j.setSelection(z)}return s&&j.setMeta("composition",s),j.scrollIntoView()},O;if(_)if(S.pos==k.pos){gr&&Io<=11&&S.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Rs(t),20));let D=A(t.state.tr.delete(M,R)),j=h.resolve(x.start).marksAcross(h.resolve(x.endA));j&&D.ensureMarks(j),t.dispatch(D)}else if(x.endA==x.endB&&(O=F6(S.parent.content.cut(S.parentOffset,k.parentOffset),C.parent.content.cut(C.parentOffset,x.endA-C.start())))){let D=A(t.state.tr);O.type=="add"?D.addMark(M,R,O.mark):D.removeMark(M,R,O.mark),t.dispatch(D)}else if(S.parent.child(S.index()).isText&&S.index()==k.index()-(k.textOffset?0:1)){let D=S.parent.textBetween(S.parentOffset,k.parentOffset),j=()=>A(t.state.tr.insertText(D,M,R));t.someProp("handleTextInput",z=>z(t,M,R,D,j))||t.dispatch(j())}else t.dispatch(A());else t.dispatch(A())}function DA(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Jw(t,e.resolve(n.anchor),e.resolve(n.head))}function F6(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,l,u;for(let h=0;h<r.length;h++)i=r[h].removeFromSet(i);for(let h=0;h<n.length;h++)s=n[h].removeFromSet(s);if(i.length==1&&s.length==0)l=i[0],o="add",u=h=>h.mark(l.addToSet(h.marks));else if(i.length==0&&s.length==1)l=s[0],o="remove",u=h=>h.mark(l.removeFromSet(h.marks));else return null;let f=[];for(let h=0;h<e.childCount;h++)f.push(u(e.child(h)));if(de.from(f).eq(t))return{mark:l,type:o}}function q6(t,e,n,r,i){if(n-e<=i.pos-r.pos||Ov(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let l=s.nodeAfter;return l!=null&&n==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(Ov(s,!0,!0));return!o.parent.isTextblock||o.pos>n||Ov(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Ov(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 G6(t,e,n,r,i){let s=t.findDiffStart(e,n),o=n+t.size,l=n+e.size;if(s==null)return null;let{a:u,b:f}=t.findDiffEnd(e,o,l);if(i=="end"){let h=Math.max(0,s-Math.min(u,f));r-=u+h-s}if(u<s&&o<l){let h=r<=s&&r>=u?s-r:0;s-=h,f=s+(f-u),u=s}else if(f<s){let h=r<=s&&r>=f?s-r:0;s-=h,u=s+(u-f),f=s}return{start:s,endA:u,endB:f}}class mI{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 l6,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(zA),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=LA(this),jA(this),this.nodeViews=PA(this),this.docView=gA(this.state.doc,IA(this),Nv(this),this.dom,this),this.domObserver=new j6(this,(r,i,s,o)=>U6(this,r,i,s,o)),this.domObserver.start(),c6(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&&px(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(zA),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&&(lI(this),o=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let b=PA(this);K6(b,this.nodeViews)&&(this.nodeViews=b,s=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&px(this),this.editable=LA(this),jA(this);let u=Nv(this),f=IA(this),h=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",m=s||!this.docView.matchesNode(e.doc,f,u);(m||!e.selection.eq(i.selection))&&(o=!0);let g=h=="preserve"&&o&&this.dom.style.overflowAnchor==null&&k5(this);if(o){this.domObserver.stop();let b=m&&(gr||Un)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&W6(i.selection,e.selection);if(m){let S=Un?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=C6(this)),(s||!this.docView.update(e.doc,f,u,this))&&(this.docView.updateOuterDeco(f),this.docView.destroy(),this.docView=gA(e.doc,f,u,this.dom,this)),S&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(b=!0)}let x=this.input.mouseDown;b||!(x&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&W5(this)&&x.delaySelUpdate())?Rs(this,b):(KD(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),h=="reset"?this.dom.scrollTop=0:h=="to selection"?this.scrollToSelection():g&&C5(g)}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 He){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&dA(this,n.getBoundingClientRect(),e)}else dA(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 uI(e.slice,e.move,i<0?void 0:He.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 l=this.directPlugins[o].props[e];if(l!=null&&(i=n?n(l):l))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let l=s[o].props[e];if(l!=null&&(i=n?n(l):l))return i}}hasFocus(){if(gr){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&&E5(this.dom),Rs(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 M5(this,e)}coordsAtPos(e,n=1){return BD(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 j5(this,n||this.state,e)}pasteHTML(e,n){return Bd(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Bd(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Qw(this,e)}destroy(){this.docView&&(u6(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Nv(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,h5())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return f6(this,e)}domSelectionRange(){let e=this.domSelection();return e?Yn&&this.root.nodeType===11&&b5(this.dom.ownerDocument)==this.dom&&P6(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}mI.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function IA(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"),[Tn.node(0,t.state.doc.content.size,e)]}function jA(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:Tn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function LA(t){return!t.someProp("editable",e=>e(t.state)===!1)}function W6(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 PA(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 K6(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 zA(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")}var Ho={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:"'"},tm={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Z6=typeof navigator<"u"&&/Mac/.test(navigator.platform),Y6=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Hn=0;Hn<10;Hn++)Ho[48+Hn]=Ho[96+Hn]=String(Hn);for(var Hn=1;Hn<=24;Hn++)Ho[Hn+111]="F"+Hn;for(var Hn=65;Hn<=90;Hn++)Ho[Hn]=String.fromCharCode(Hn+32),tm[Hn]=String.fromCharCode(Hn);for(var Dv in Ho)tm.hasOwnProperty(Dv)||(tm[Dv]=Ho[Dv]);function X6(t){var e=Z6&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Y6&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?tm:Ho)[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}const J6=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Q6=typeof navigator<"u"&&/Win/.test(navigator.platform);function eq(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let l=0;l<e.length-1;l++){let u=e[l];if(/^(cmd|meta|m)$/i.test(u))o=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))J6?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function tq(t){let e=Object.create(null);for(let n in t)e[eq(n)]=t[n];return e}function Iv(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 nq(t){return new zt({props:{handleKeyDown:sS(t)}})}function sS(t){let e=tq(t);return function(n,r){let i=X6(r),s,o=e[Iv(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[Iv(i,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Q6&&r.ctrlKey&&r.altKey)&&(s=Ho[r.keyCode])&&s!=i){let l=e[Iv(s,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var rq=Object.defineProperty,oS=(t,e)=>{for(var n in e)rq(t,n,{get:e[n],enumerable:!0})};function cg(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}var ug=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:i}=n,s=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([o,l])=>[o,(...f)=>{const h=l(...f)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),h}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,o=[],l=!!t,u=t||i.tr,f=()=>(!l&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(u),o.every(m=>m===!0)),h={...Object.fromEntries(Object.entries(n).map(([m,g])=>[m,(...x)=>{const S=this.buildProps(u,e),k=g(...x)(S);return o.push(k),h}])),run:f};return h}createCan(t){const{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([l,u])=>[l,(...f)=>u(...f)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,o={tr:t,editor:r,view:s,state:cg({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([l,u])=>[l,(...f)=>u(...f)(o)]))}};return o}},ui={};oS(ui,{blur:()=>iq,clearContent:()=>sq,clearNodes:()=>oq,command:()=>aq,createParagraphNear:()=>lq,cut:()=>cq,deleteCurrentNode:()=>uq,deleteNode:()=>dq,deleteRange:()=>fq,deleteSelection:()=>mq,enter:()=>gq,exitCode:()=>yq,extendMarkRange:()=>bq,first:()=>vq,focus:()=>wq,forEach:()=>Sq,insertContent:()=>kq,insertContentAt:()=>Eq,insertDefaultBlock:()=>Tq,joinBackward:()=>Rq,joinDown:()=>Aq,joinForward:()=>Mq,joinItemBackward:()=>Nq,joinItemForward:()=>Oq,joinTextblockBackward:()=>Dq,joinTextblockForward:()=>Iq,joinUp:()=>_q,keyboardShortcut:()=>Lq,lift:()=>Pq,liftEmptyBlock:()=>zq,liftListItem:()=>$q,newlineInCode:()=>Bq,resetAttributes:()=>Vq,scrollIntoView:()=>Hq,selectAll:()=>Uq,selectNodeBackward:()=>Fq,selectNodeForward:()=>qq,selectParentNode:()=>Gq,selectTextblockEnd:()=>Wq,selectTextblockStart:()=>Kq,setContent:()=>Zq,setMark:()=>p9,setMeta:()=>m9,setNode:()=>g9,setNodeSelection:()=>y9,setTextDirection:()=>b9,setTextSelection:()=>v9,sinkListItem:()=>x9,splitBlock:()=>w9,splitListItem:()=>S9,toggleList:()=>C9,toggleMark:()=>E9,toggleNode:()=>T9,toggleWrap:()=>_9,undoInputRule:()=>A9,unsetAllMarks:()=>R9,unsetMark:()=>M9,unsetTextDirection:()=>N9,updateAttributes:()=>O9,wrapIn:()=>D9,wrapInList:()=>I9});var iq=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),sq=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),oq=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(l,u)=>{if(l.type.isText)return;const{doc:f,mapping:h}=e,m=f.resolve(h.map(u)),g=f.resolve(h.map(u+l.nodeSize)),b=m.blockRange(g);if(!b)return;const x=Vc(b);if(l.type.isTextblock){const{defaultType:S}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(b.start,S)}(x||x===0)&&e.lift(b,x)})}),!0},aq=t=>e=>t(e),lq=()=>({state:t,dispatch:e})=>RD(t,e),cq=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new $e(r.doc.resolve(Math.max(o-1,0)))),!0},uq=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const l=i.before(s),u=i.after(s);t.delete(l,u).scrollIntoView()}return!0}return!1};function bn(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var dq=t=>({tr:e,state:n,dispatch:r})=>{const i=bn(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const u=s.before(o),f=s.after(o);e.delete(u,f).scrollIntoView()}return!0}return!1},fq=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},hq=t=>t.content?/^text(\*|\+)/.test(t.content):!1,$A=(t,e,n)=>{if(!t.parent.isInline||n==="left"&&t.pos>t.start()||n==="right"&&t.pos<t.end())return t.pos;const r=e.nodes[t.parent.type.name].spec;return hq(r)?n==="left"?t.start()-1:t.end()+1:t.pos},pq=(t,e,n)=>{const r=$A(t,n,"left"),i=$A(e,n,"right");return{from:r,to:i}},mq=()=>({state:t,dispatch:e})=>{if(t.selection.empty)return!1;if(e){const n=t.tr,{ranges:r}=t.selection,i=n.steps.length;r.forEach(s=>{const o=n.mapping.slice(i),l=n.doc.resolve(o.map(s.$from.pos)),u=n.doc.resolve(o.map(s.$to.pos)),{from:f,to:h}=pq(l,u,t.schema);n.deleteRange(f,h)}),n.selection.empty||n.setSelection($e.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),e(n)}return!0},gq=()=>({commands:t})=>t.keyboardShortcut("Enter"),yq=()=>({state:t,dispatch:e})=>J4(t,e);function aS(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function nm(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:aS(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function gI(t,e,n={}){return t.find(r=>r.type===e&&nm(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function BA(t,e,n={}){return!!gI(t,e,n)}function lS(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(f=>f.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(f=>f.type===e))return;if(!n){const f=r.node.marks.find(h=>h.type===e);f&&(n=f.attrs)}if(!gI([...r.node.marks],e,n))return;let s=r.index,o=t.start()+r.offset,l=s+1,u=o+r.node.nodeSize;for(;s>0&&BA([...t.parent.child(s-1).marks],e,n);)s-=1,o-=t.parent.child(s).nodeSize;for(;l<t.parent.childCount&&BA([...t.parent.child(l).marks],e,n);)u+=t.parent.child(l).nodeSize,l+=1;return{from:o,to:u}}function zs(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var bq=(t,e)=>({tr:n,state:r,dispatch:i})=>{const s=zs(t,r.schema),{doc:o,selection:l}=n,{$from:u,from:f,to:h}=l;if(i){const m=lS(u,s,e);if(m&&m.from<=f&&m.to>=h){const g=$e.create(o,m.from,m.to);n.setSelection(g)}}return!0},vq=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function yI(t){return t instanceof $e}function Ma(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function mx(t,e=null){if(!e)return null;const n=Ke.atStart(t),r=Ke.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?$e.create(t,Ma(0,i,s),Ma(t.content.size,i,s)):$e.create(t,Ma(e,i,s),Ma(e,i,s))}function VA(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function rm(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function xq(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var wq=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(rm()||VA())&&r.dom.focus(),xq()&&!rm()&&!VA()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(s&&t===null&&!yI(n.state.selection))return o(),!0;const l=mx(i.doc,t)||n.state.selection,u=n.state.selection.eq(l);return s&&(u||i.setSelection(l),u&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Sq=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),kq=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),bI=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&bI(r)}return t};function nd(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return bI(n)}function Ac(t,e,n){if(t instanceof Do||t instanceof de)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return de.fromArray(t.map(l=>e.nodeFromJSON(l)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),Ac("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,l="";const u=new tD({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:f=>(o=!0,l=typeof f=="string"?f:f.outerHTML,null)}]}})});if(n.slice?_s.fromSchema(u).parseSlice(nd(t),n.parseOptions):_s.fromSchema(u).parse(nd(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const s=_s.fromSchema(e);return n.slice?s.parseSlice(nd(t),n.parseOptions).content:s.parse(nd(t),n.parseOptions)}return Ac("",e,n)}function vI(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof gn||i instanceof _n))return;const s=t.mapping.maps[r];let o=0;s.forEach((l,u,f,h)=>{o===0&&(o=h)}),t.setSelection(Ke.near(t.doc.resolve(o),n))}var Cq=t=>!("type"in t),Eq=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const u=k=>{s.emit("contentError",{editor:s,error:k,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},f={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Ac(e,s.schema,{parseOptions:f,errorOnInvalidContent:!0})}catch(k){u(k)}try{l=Ac(e,s.schema,{parseOptions:f,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(k){return u(k),!1}let{from:h,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,b=!0;if((Cq(l)?l:[l]).forEach(k=>{k.check(),g=g?k.isText&&k.marks.length===0:!1,b=b?k.isBlock:!1}),h===m&&b){const{parent:k}=r.doc.resolve(h);k.isTextblock&&!k.type.spec.code&&!k.childCount&&(h-=1,m+=1)}let S;if(g){if(Array.isArray(e))S=e.map(k=>k.text||"").join("");else if(e instanceof de){let k="";e.forEach(C=>{C.text&&(k+=C.text)}),S=k}else typeof e=="object"&&e&&e.text?S=e.text:S=e;r.insertText(S,h,m)}else{S=l;const k=r.doc.resolve(h),C=k.node(),_=k.parentOffset===0,M=C.isText||C.isTextblock,R=C.content.size>0;_&&M&&R&&b&&(h=Math.max(0,h-1)),r.replaceWith(h,m,S)}n.updateSelection&&vI(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:h,text:S}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:h,text:S})}return!0};function xI(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var Tq=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{pos:i,attrs:s,content:o,updateSelection:l=!0}=t;let u;typeof i=="number"?u=e.doc.resolve(i):i?u=i:u=e.selection.$from;const f=xI(u.parent.contentMatchAt(u.index()));if(!f)return!1;const h=Object.keys(f.spec.attrs||{}),m=s?Object.fromEntries(Object.entries(s).filter(([b])=>h.includes(b))):{};let g;if(o){const b=Ac(o,r.schema);g=f.createAndFill(m,b)}else g=f.createAndFill(m);return g?(n&&(e.insert(u.pos,g),l&&vI(e,e.steps.length-1,-1)),!0):!1},_q=()=>({state:t,dispatch:e})=>Z4(t,e),Aq=()=>({state:t,dispatch:e})=>Y4(t,e),Rq=()=>({state:t,dispatch:e})=>SD(t,e),Mq=()=>({state:t,dispatch:e})=>TD(t,e),Nq=()=>({state:t,dispatch:e,tr:n})=>{try{const r=ig(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Oq=()=>({state:t,dispatch:e,tr:n})=>{try{const r=ig(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Dq=()=>({state:t,dispatch:e})=>W4(t,e),Iq=()=>({state:t,dispatch:e})=>K4(t,e);function wI(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function jq(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let l=0;l<e.length-1;l+=1){const u=e[l];if(/^(cmd|meta|m)$/i.test(u))o=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))rm()||wI()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${u}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}var Lq=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=jq(t).split(/-(?!$)/),o=s.find(f=>!["Alt","Ctrl","Meta","Shift"].includes(f)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",f=>f(n,l))});return u?.steps.forEach(f=>{const h=f.map(r.mapping);h&&i&&r.maybeStep(h)}),!0};function Uo(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?bn(e,t.schema):null,l=[];t.doc.nodesBetween(r,i,(m,g)=>{if(m.isText)return;const b=Math.max(r,g),x=Math.min(i,g+m.nodeSize);l.push({node:m,from:b,to:x})});const u=i-r,f=l.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>nm(m.node.attrs,n,{strict:!1}));return s?!!f.length:f.reduce((m,g)=>m+g.to-g.from,0)>=u}var Pq=(t,e={})=>({state:n,dispatch:r})=>{const i=bn(t,n.schema);return Uo(n,i,e)?X4(n,r):!1},zq=()=>({state:t,dispatch:e})=>MD(t,e),$q=t=>({state:e,dispatch:n})=>{const r=bn(t,e.schema);return c5(r)(e,n)},Bq=()=>({state:t,dispatch:e})=>AD(t,e);function dg(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function HA(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var Vq=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const l=dg(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(s=bn(t,r.schema)),l==="mark"&&(o=zs(t,r.schema));let u=!1;return n.selection.ranges.forEach(f=>{r.doc.nodesBetween(f.$from.pos,f.$to.pos,(h,m)=>{s&&s===h.type&&(u=!0,i&&n.setNodeMarkup(m,void 0,HA(h.attrs,e))),o&&h.marks.length&&h.marks.forEach(g=>{o===g.type&&(u=!0,i&&n.addMark(m,m+h.nodeSize,o.create(HA(g.attrs,e))))})})}),u},Hq=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Uq=()=>({tr:t,dispatch:e})=>{if(e){const n=new Ir(t.doc);t.setSelection(n)}return!0},Fq=()=>({state:t,dispatch:e})=>CD(t,e),qq=()=>({state:t,dispatch:e})=>_D(t,e),Gq=()=>({state:t,dispatch:e})=>t5(t,e),Wq=()=>({state:t,dispatch:e})=>i5(t,e),Kq=()=>({state:t,dispatch:e})=>r5(t,e);function gx(t,e,n={},r={}){return Ac(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var Zq=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:l})=>{const{doc:u}=s;if(r.preserveWhitespace!=="full"){const f=gx(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,u.content.size,f).setMeta("preventUpdate",!n),!0}return o&&s.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function SI(t,e){const n=zs(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,u=>{o.push(...u.marks)});const l=o.find(u=>u.type.name===n.name);return l?{...l.attrs}:{}}function kI(t,e){const n=new Fw(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function Yq(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function CI(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function fg(t){return e=>CI(e.$from,t)}function De(t,e,n){return t.config[e]===void 0&&t.parent?De(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?De(t.parent,e,n):null}):t.config[e]}function hg(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=De(e,"addExtensions",n);return r?[e,...hg(r())]:e}).flat(10)}function cS(t,e){const n=nl.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function EI(t){return typeof t=="function"}function yt(t,e=void 0,...n){return EI(t)?e?t.bind(e)(...n):t(...n):t}function Xq(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Rc(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function TI(t){const e=[],{nodeExtensions:n,markExtensions:r}=Rc(t),i=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(f=>f.name!=="text").map(f=>f.name),l=r.map(f=>f.name),u=[...o,...l];return t.forEach(f=>{const h={name:f.name,options:f.options,storage:f.storage,extensions:i},m=De(f,"addGlobalAttributes",h);if(!m)return;m().forEach(b=>{let x;Array.isArray(b.types)?x=b.types:b.types==="*"?x=u:b.types==="nodes"?x=o:b.types==="marks"?x=l:x=[],x.forEach(S=>{Object.entries(b.attributes).forEach(([k,C])=>{e.push({type:S,name:k,attribute:{...s,...C}})})})})}),i.forEach(f=>{const h={name:f.name,options:f.options,storage:f.storage},m=De(f,"addAttributes",h);if(!m)return;const g=m();Object.entries(g).forEach(([b,x])=>{const S={...s,...x};typeof S?.default=="function"&&(S.default=S.default()),S?.isRequired&&S?.default===void 0&&delete S.default,e.push({type:f.name,name:b,attribute:S})})}),e}function Jq(t){const e=[];let n="",r=!1,i=!1,s=0;const o=t.length;for(let l=0;l<o;l+=1){const u=t[l];if(u==="'"&&!i){r=!r,n+=u;continue}if(u==='"'&&!r){i=!i,n+=u;continue}if(!r&&!i){if(u==="("){s+=1,n+=u;continue}if(u===")"&&s>0){s-=1,n+=u;continue}if(u===";"&&s===0){e.push(n),n="";continue}}n+=u}return n&&e.push(n),e}function UA(t){const e=[],n=Jq(t||""),r=n.length;for(let i=0;i<r;i+=1){const s=n[i],o=s.indexOf(":");if(o===-1)continue;const l=s.slice(0,o).trim(),u=s.slice(o+1).trim();l&&u&&e.push([l,u])}return e}function Pt(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const l=s?String(s).split(" "):[],u=r[i]?r[i].split(" "):[],f=l.filter(h=>!u.includes(h));r[i]=[...u,...f].join(" ")}else if(i==="style"){const l=new Map([...UA(r[i]),...UA(s)]);r[i]=Array.from(l.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else r[i]=s}),r},{})}function Mc(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Pt(n,r),{})}function Qq(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function FA(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(n):Qq(n.getAttribute(o.name));return l==null?s:{...s,[o.name]:l}},{});return{...r,...i}}}}function qA(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Xq(n)?!1:n!=null))}function GA(t){var e,n;const r={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(r.default=t.attribute.default),((n=t?.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function _I(t,e){var n;const r=TI(t),{nodeExtensions:i,markExtensions:s}=Rc(t),o=(n=i.find(f=>De(f,"topNode")))==null?void 0:n.name,l=Object.fromEntries(i.map(f=>{const h=r.filter(C=>C.type===f.name),m={name:f.name,options:f.options,storage:f.storage,editor:e},g=t.reduce((C,_)=>{const M=De(_,"extendNodeSchema",m);return{...C,...M?M(f):{}}},{}),b=qA({...g,content:yt(De(f,"content",m)),marks:yt(De(f,"marks",m)),group:yt(De(f,"group",m)),inline:yt(De(f,"inline",m)),atom:yt(De(f,"atom",m)),selectable:yt(De(f,"selectable",m)),draggable:yt(De(f,"draggable",m)),code:yt(De(f,"code",m)),whitespace:yt(De(f,"whitespace",m)),linebreakReplacement:yt(De(f,"linebreakReplacement",m)),defining:yt(De(f,"defining",m)),isolating:yt(De(f,"isolating",m)),attrs:Object.fromEntries(h.map(GA))}),x=yt(De(f,"parseHTML",m));x&&(b.parseDOM=x.map(C=>FA(C,h)));const S=De(f,"renderHTML",m);S&&(b.toDOM=C=>S({node:C,HTMLAttributes:Mc(C,h)}));const k=De(f,"renderText",m);return k&&(b.toText=k),[f.name,b]})),u=Object.fromEntries(s.map(f=>{const h=r.filter(k=>k.type===f.name),m={name:f.name,options:f.options,storage:f.storage,editor:e},g=t.reduce((k,C)=>{const _=De(C,"extendMarkSchema",m);return{...k,..._?_(f):{}}},{}),b=qA({...g,inclusive:yt(De(f,"inclusive",m)),excludes:yt(De(f,"excludes",m)),group:yt(De(f,"group",m)),spanning:yt(De(f,"spanning",m)),code:yt(De(f,"code",m)),attrs:Object.fromEntries(h.map(GA))}),x=yt(De(f,"parseHTML",m));x&&(b.parseDOM=x.map(k=>FA(k,h)));const S=De(f,"renderHTML",m);return S&&(b.toDOM=k=>S({mark:k,HTMLAttributes:Mc(k,h)})),[f.name,b]}));return new tD({topNode:o,nodes:l,marks:u})}function e9(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function hc(t){return t.sort((n,r)=>{const i=De(n,"priority")||100,s=De(r,"priority")||100;return i>s?-1:i<s?1:0})}function uS(t){const e=hc(hg(t)),n=e9(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function AI(t,e){const n=uS(t);return _I(n,e)}function t9(t,e){const n=AI(e),r=nd(t);return _s.fromSchema(n).parse(r).toJSON()}function RI(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
74
-
75
- `,textSerializers:o={}}=n||{};let l="";return t.nodesBetween(r,i,(u,f,h,m)=>{var g;u.isBlock&&f>r&&(l+=s);const b=o?.[u.type.name];if(b)return h&&(l+=b({node:u,pos:f,parent:h,index:m,range:e})),!1;u.isText&&(l+=(g=u?.text)==null?void 0:g.slice(Math.max(r,f)-f,i-f))}),l}function n9(t,e){const n={from:0,to:t.content.size};return RI(t,n,e)}function MI(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function r9(t,e){const n=bn(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,l=>{s.push(l)});const o=s.reverse().find(l=>l.type.name===n.name);return o?{...o.attrs}:{}}function NI(t,e){const n=dg(typeof e=="string"?e:e.name,t.schema);return n==="node"?r9(t,e):n==="mark"?SI(t,e):{}}function i9(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function s9(t){const e=i9(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,o)=>o!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function dS(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((l,u)=>{o.push({from:l,to:u})});else{const{from:l,to:u}=n[s];if(l===void 0||u===void 0)return;o.push({from:l,to:u})}o.forEach(({from:l,to:u})=>{const f=e.slice(s).map(l,-1),h=e.slice(s).map(u),m=e.invert().map(f,-1),g=e.invert().map(h);r.push({oldRange:{from:m,to:g},newRange:{from:f,to:h}})})}),s9(r)}function fS(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),o=lS(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}var o9=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let s=r,o=null;for(;s>0&&o===null;){const l=i.node(s);l?.type.name===e?o=l:s-=1}return[o,s]};function Fu(t,e){return e.nodes[t]||e.marks[t]||null}function vp(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}var a9=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,l)=>{var u,f;const h=((f=(u=i.type.spec).toText)==null?void 0:f.call(u,{node:i,pos:s,parent:o,index:l}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?h:h.slice(0,Math.max(0,r-s))}),n};function yx(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?zs(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>s?s.name===m.type.name:!0).find(m=>nm(m.attrs,n,{strict:!1}));let o=0;const l=[];if(i.forEach(({$from:m,$to:g})=>{const b=m.pos,x=g.pos;t.doc.nodesBetween(b,x,(S,k)=>{if(s&&S.inlineContent&&!S.type.allowsMarkType(s))return!1;if(!S.isText&&!S.marks.length)return;const C=Math.max(b,k),_=Math.min(x,k+S.nodeSize),M=_-C;o+=M,l.push(...S.marks.map(R=>({mark:R,from:C,to:_})))})}),o===0)return!1;const u=l.filter(m=>s?s.name===m.mark.type.name:!0).filter(m=>nm(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),f=l.filter(m=>s?m.mark.type!==s&&m.mark.type.excludes(s):!0).reduce((m,g)=>m+g.to-g.from,0);return(u>0?u+f:u)>=o}function l9(t,e,n={}){if(!e)return Uo(t,null,n)||yx(t,null,n);const r=dg(e,t.schema);return r==="node"?Uo(t,e,n):r==="mark"?yx(t,e,n):!1}var c9=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const s=fg(l=>l.type.name===e)(t.selection);if(!s)return!1;const o=t.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},u9=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function WA(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function jv(t,e){const{nodeExtensions:n}=Rc(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=yt(De(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function df(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return!/\S/.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(s=>{i!==!1&&(df(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function OI(t){return t instanceof He}var DI=class II{constructor(e){this.position=e}static fromJSON(e){return new II(e.position)}toJSON(){return{position:this.position}}};function d9(t,e){const n=e.mapping.mapResult(t.position);return{position:new DI(n.pos),mapResult:n}}function f9(t){return new DI(t)}function h9(t,e,n){var r;const{selection:i}=e;let s=null;if(yI(i)&&(s=i.$cursor),s){const l=(r=t.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(f=>f.type.excludes(n)))}const{ranges:o}=i;return o.some(({$from:l,$to:u})=>{let f=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,u.pos,(h,m,g)=>{if(f)return!1;if(h.isInline){const b=!g||g.type.allowsMarkType(n),x=!!n.isInSet(h.marks)||!h.marks.some(S=>S.type.excludes(n));f=b&&x}return!f}),f})}var p9=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:l}=s,u=zs(t,r.schema);if(i)if(o){const f=SI(r,u);n.addStoredMark(u.create({...f,...e}))}else l.forEach(f=>{const h=f.$from.pos,m=f.$to.pos;r.doc.nodesBetween(h,m,(g,b)=>{const x=Math.max(b,h),S=Math.min(b+g.nodeSize,m);g.marks.find(C=>C.type===u)?g.marks.forEach(C=>{u===C.type&&n.addMark(x,S,u.create({...C.attrs,...e}))}):n.addMark(x,S,u.create(e))})});return h9(r,n,u)},m9=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),g9=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=bn(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:l})=>lA(s,{...o,...e})(n)?!0:l.clearNodes()).command(({state:l})=>lA(s,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},y9=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Ma(t,0,r.content.size),s=He.create(r,i);e.setSelection(s)}return!0},b9=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;let o,l;return typeof e=="number"?(o=e,l=e):e&&"from"in e&&"to"in e?(o=e.from,l=e.to):(o=s.from,l=s.to),i&&n.doc.nodesBetween(o,l,(u,f)=>{u.isText||n.setNodeMarkup(f,void 0,{...u.attrs,dir:t})}),!0},v9=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=$e.atStart(r).from,l=$e.atEnd(r).to,u=Ma(i,o,l),f=Ma(s,o,l),h=$e.create(r,u,f);e.setSelection(h)}return!0},x9=t=>({state:e,dispatch:n})=>{const r=bn(t,e.schema);return f5(r)(e,n)};function KA(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}var w9=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:l,$to:u}=s,f=i.extensionManager.attributes,h=vp(f,l.node().type.name,l.node().attrs);if(s instanceof He&&s.node.isBlock)return!l.parentOffset||!As(o,l.pos)?!1:(r&&(t&&KA(n,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,g=l.depth===0?void 0:xI(l.node(-1).contentMatchAt(l.indexAfter(-1)));let b=m&&g?[{type:g,attrs:h}]:void 0,x=As(e.doc,e.mapping.map(l.pos),1,b);if(!b&&!x&&As(e.doc,e.mapping.map(l.pos),1,g?[{type:g}]:void 0)&&(x=!0,b=g?[{type:g,attrs:h}]:void 0),r){if(x&&(s instanceof $e&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,b),g&&!m&&!l.parentOffset&&l.parent.type!==g)){const S=e.mapping.map(l.before()),k=e.doc.resolve(S);l.node(-1).canReplaceWith(k.index(),k.index()+1,g)&&e.setNodeMarkup(e.mapping.map(l.before()),g)}t&&KA(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return x},S9=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var o;const l=bn(t,r.schema),{$from:u,$to:f}=r.selection,h=r.selection.node;if(h&&h.isBlock||u.depth<2||!u.sameParent(f))return!1;const m=u.node(-1);if(m.type!==l)return!1;const g=s.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==l||u.index(-2)!==u.node(-2).childCount-1)return!1;if(i){let C=de.empty;const _=u.index(-1)?1:u.index(-2)?2:3;for(let j=u.depth-_;j>=u.depth-3;j-=1)C=de.from(u.node(j).copy(C));const M=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,R={...vp(g,u.node().type.name,u.node().attrs),...e},A=((o=l.contentMatch.defaultType)==null?void 0:o.createAndFill(R))||void 0;C=C.append(de.from(l.createAndFill(null,A)||void 0));const O=u.before(u.depth-(_-1));n.replace(O,u.after(-M),new Ee(C,4-_,0));let D=-1;n.doc.nodesBetween(O,n.doc.content.size,(j,z)=>{if(D>-1)return!1;j.isTextblock&&j.content.size===0&&(D=z+1)}),D>-1&&n.setSelection($e.near(n.doc.resolve(D))),n.scrollIntoView()}return!0}const b=f.pos===u.end()?m.contentMatchAt(0).defaultType:null,x={...vp(g,m.type.name,m.attrs),...e},S={...vp(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,f.pos);const k=b?[{type:l,attrs:x},{type:b,attrs:S}]:[{type:l,attrs:x}];if(!As(n.doc,u.pos,2))return!1;if(i){const{selection:C,storedMarks:_}=r,{splittableMarks:M}=s.extensionManager,R=_||C.$to.parentOffset&&C.$from.marks();if(n.split(u.pos,2,k).scrollIntoView(),!R||!i)return!0;const A=R.filter(O=>M.includes(O.type.name));n.ensureMarks(A)}return!0};function ZA(t){return!t||t==="1"?null:t}function jI(t,e){return ZA(t)===ZA(e)}var Lv=(t,e)=>{const n=fg(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return!(n.node.type===i?.type&&Yo(t.doc,n.pos))||!jI(n.node.attrs.type,i?.attrs.type)||t.join(n.pos),!0},Pv=(t,e)=>{const n=fg(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return!(n.node.type===i?.type&&Yo(t.doc,r))||!jI(n.node.attrs.type,i?.attrs.type)||t.join(r),!0};function k9(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),i=e.resolve(n.nodeSize-1);return $e.between(r,i)}var C9=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:l,chain:u,commands:f,can:h})=>{const{extensions:m,splittableMarks:g}=i.extensionManager,b=bn(t,o.schema),x=bn(e,o.schema),{selection:S,storedMarks:k}=o,{$from:C,$to:_}=S,M=C.blockRange(_),R=k||S.$to.parentOffset&&S.$from.marks();if(!M)return!1;const A=fg(ee=>jv(ee.type.name,m))(S),O=S.from===0&&S.to===o.doc.content.size,D=o.doc.content.content,j=D.length===1?D[0]:null,z=O&&j&&jv(j.type.name,m)?{node:j,pos:0}:null,q=A??z,Z=!!A&&M.depth>=1&&M.depth-A.depth<=1,G=!!z;if((Z||G)&&q){if(q.node.type===b)return O&&G?u().command(({tr:ee,dispatch:te})=>{const fe=k9(ee);return fe?(ee.setSelection(fe),te&&te(ee),!0):!1}).liftListItem(x).run():f.liftListItem(x);if(jv(q.node.type.name,m)&&b.validContent(q.node.content))return u().command(()=>(s.setNodeMarkup(q.pos,b),!0)).command(()=>Lv(s,b)).command(()=>Pv(s,b)).run()}return!n||!R||!l?u().command(()=>h().wrapInList(b,r)?!0:f.clearNodes()).wrapInList(b,r).command(()=>Lv(s,b)).command(()=>Pv(s,b)).run():u().command(()=>{const ee=h().wrapInList(b,r),te=R.filter(fe=>g.includes(fe.type.name));return s.ensureMarks(te),ee?!0:f.clearNodes()}).wrapInList(b,r).command(()=>Lv(s,b)).command(()=>Pv(s,b)).run()},E9=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=zs(t,r.schema);return yx(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},T9=(t,e,n={})=>({state:r,commands:i})=>{const s=bn(t,r.schema),o=bn(e,r.schema),l=Uo(r,s,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),l?i.setNode(o,u):i.setNode(s,{...u,...n})},_9=(t,e={})=>({state:n,commands:r})=>{const i=bn(t,n.schema);return Uo(n,i,e)?r.lift(i):r.wrapIn(i,e)},A9=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const o=t.tr,l=s.transform;for(let u=l.steps.length-1;u>=0;u-=1)o.step(l.steps[u].invert(l.docs[u]));if(s.text){const u=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,u))}else o.delete(s.from,s.to)}return!0}}return!1},R9=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{ignoreClearable:i=!1}=t,{selection:s}=e,{empty:o,ranges:l}=s;if(o)return!0;const{nonClearableMarks:u}=r.extensionManager;if(n){const f=Object.values(r.schema.marks).filter(h=>i||!u.includes(h.name));l.forEach(h=>{for(const m of f)e.removeMark(h.$from.pos,h.$to.pos,m)})}return!0},M9=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=n,u=zs(t,r.schema),{$from:f,empty:h,ranges:m}=l;if(!i)return!0;if(h&&o){let{from:g,to:b}=l;const x=(s=f.marks().find(k=>k.type===u))==null?void 0:s.attrs,S=lS(f,u,x);S&&(g=S.from,b=S.to),n.removeMark(g,b,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},N9=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let s,o;return typeof t=="number"?(s=t,o=t):t&&"from"in t&&"to"in t?(s=t.from,o=t.to):(s=i.from,o=i.to),r&&e.doc.nodesBetween(s,o,(l,u)=>{if(l.isText)return;const f={...l.attrs};delete f.dir,e.setNodeMarkup(u,void 0,f)}),!0},O9=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const l=dg(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(s=bn(t,r.schema)),l==="mark"&&(o=zs(t,r.schema));let u=!1;return n.selection.ranges.forEach(f=>{const h=f.$from.pos,m=f.$to.pos;let g,b,x,S;n.selection.empty?r.doc.nodesBetween(h,m,(k,C)=>{s&&s===k.type&&(u=!0,x=Math.max(C,h),S=Math.min(C+k.nodeSize,m),g=C,b=k)}):r.doc.nodesBetween(h,m,(k,C)=>{C<h&&s&&s===k.type&&(u=!0,x=Math.max(C,h),S=Math.min(C+k.nodeSize,m),g=C,b=k),C>=h&&C<=m&&(s&&s===k.type&&(u=!0,i&&n.setNodeMarkup(C,void 0,{...k.attrs,...e})),o&&k.marks.length&&k.marks.forEach(_=>{if(o===_.type&&(u=!0,i)){const M=Math.max(C,h),R=Math.min(C+k.nodeSize,m);n.addMark(M,R,o.create({..._.attrs,...e}))}}))}),b&&(g!==void 0&&i&&n.setNodeMarkup(g,void 0,{...b.attrs,...e}),o&&b.marks.length&&b.marks.forEach(k=>{o===k.type&&i&&n.addMark(x,S,o.create({...k.attrs,...e}))}))}),u},D9=(t,e={})=>({state:n,dispatch:r})=>{const i=bn(t,n.schema);return s5(i,e)(n,r)},I9=(t,e={})=>({state:n,dispatch:r})=>{const i=bn(t,n.schema);return o5(i,e)(n,r)},j9=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}};function Nc(t,e){if(t===e)return!0;if(!t||!e)return!1;const n=Object.keys(t),r=Object.keys(e);return n.length!==r.length?!1:n.every(i=>Object.prototype.hasOwnProperty.call(e,i)&&Object.is(t[i],e[i]))}function L9(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof He){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}function P9(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}function YA(t){return t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function z9(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $9(t){return typeof t=="number"}function B9(t){return Object.prototype.toString.call(t).slice(8,-1)}function jh(t){return B9(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}var V9={};oS(V9,{createAtomBlockMarkdownSpec:()=>H9,createBlockMarkdownSpec:()=>U9,createInlineMarkdownSpec:()=>G9,parseAttributes:()=>hS,parseIndentedBlocks:()=>bx,renderNestedMarkdownContent:()=>mS,serializeAttributes:()=>pS});function hS(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,f=>(n.push(f),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([\w-]+)/g);if(i){const f=i.map(h=>h.trim().slice(1));e.class=f.join(" ")}const s=r.match(/(?:^|\s)#([\w-]+)/);s&&(e.id=s[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,f,h])=>{var m;const g=parseInt(((m=h.match(/__QUOTED_(\d+)__/))==null?void 0:m[1])||"0",10),b=n[g];b&&(e[f]=b.slice(1,-1))});const u=r.replace(/(?:^|\s)\.([\w-]+)/g,"").replace(/(?:^|\s)#([\w-]+)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return u&&u.split(/\s+/).filter(Boolean).forEach(h=>{h.match(/^[a-zA-Z][\w-]*$/)&&(e[h]=!0)}),e}function pS(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function H9(t){const{nodeName:e,name:n,parseAttributes:r=hS,serializeAttributes:i=pS,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:l}=t,u=n||e,f=h=>{if(!l)return h;const m={};return l.forEach(g=>{g in h&&(m[g]=h[g])}),m};return{parseMarkdown:(h,m)=>{const g={...s,...h.attributes};return m.createNode(e,g,[])},markdownTokenizer:{name:e,level:"block",start(h){var m;const g=new RegExp(`^:::${u}(?:\\s|$)`,"m"),b=(m=h.match(g))==null?void 0:m.index;return b!==void 0?b:-1},tokenize(h,m,g){const b=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),x=h.match(b);if(!x)return;const S=x[1]||"",k=r(S);if(!o.find(_=>!(_ in k)))return{type:e,raw:x[0],attributes:k}}},renderMarkdown:h=>{const m=f(h.attrs||{}),g=i(m),b=g?` {${g}}`:"";return`:::${u}${b} :::`}}}function U9(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=hS,serializeAttributes:s=pS,defaultAttributes:o={},content:l="block",allowedAttributes:u}=t,f=n||e,h=m=>{if(!u)return m;const g={};return u.forEach(b=>{b in m&&(g[b]=m[b])}),g};return{parseMarkdown:(m,g)=>{let b;if(r){const S=r(m);b=typeof S=="string"?[{type:"text",text:S}]:S}else l==="block"?b=g.parseChildren(m.tokens||[]):b=g.parseInline(m.tokens||[]);const x={...o,...m.attributes};return g.createNode(e,x,b)},markdownTokenizer:{name:e,level:"block",start(m){var g;const b=new RegExp(`^:::${f}`,"m"),x=(g=m.match(b))==null?void 0:g.index;return x!==void 0?x:-1},tokenize(m,g,b){var x;const S=new RegExp(`^:::${f}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),k=m.match(S);if(!k)return;const[C,_=""]=k,M=i(_);let R=1;const A=C.length;let O="";const D=/^:::([\w-]*)(\s.*)?/gm,j=m.slice(A);for(D.lastIndex=0;;){const z=D.exec(j);if(z===null)break;const q=z.index,Z=z[1];if(!((x=z[2])!=null&&x.endsWith(":::"))){if(Z)R+=1;else if(R-=1,R===0){const G=j.slice(0,q);O=G.trim();const ee=m.slice(0,A+q+z[0].length);let te=[];if(O)if(l==="block")for(te=b.blockTokens(G),te.forEach(fe=>{fe.text&&(!fe.tokens||fe.tokens.length===0)&&(fe.tokens=b.inlineTokens(fe.text))});te.length>0;){const fe=te[te.length-1];if(fe.type==="paragraph"&&(!fe.text||fe.text.trim()===""))te.pop();else break}else te=b.inlineTokens(O);return{type:e,raw:ee,attributes:M,content:O,tokens:te}}}}}},renderMarkdown:(m,g)=>{const b=h(m.attrs||{}),x=s(b),S=x?` {${x}}`:"",k=g.renderChildren(m.content||[],`
76
-
77
- `);return`:::${f}${S}
78
-
79
- ${k}
80
-
81
- :::`}}}function F9(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,i,s,o]=r;e[i]=s||o,r=n.exec(t)}return e}function q9(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function G9(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=F9,serializeAttributes:s=q9,defaultAttributes:o={},selfClosing:l=!1,allowedAttributes:u}=t,f=n||e,h=g=>{if(!u)return g;const b={};return u.forEach(x=>{const S=typeof x=="string"?x:x.name,k=typeof x=="string"?void 0:x.skipIfDefault;if(S in g){const C=g[S];if(k!==void 0&&C===k)return;b[S]=C}}),b},m=f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(g,b)=>{const x={...o,...g.attributes};if(l)return b.createNode(e,x);const S=r?r(g):g.content||"";return S?b.createNode(e,x,[b.createTextNode(S)]):b.createNode(e,x,[])},markdownTokenizer:{name:e,level:"inline",start(g){const b=l?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),x=g.match(b),S=x?.index;return S!==void 0?S:-1},tokenize(g,b,x){const S=l?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),k=g.match(S);if(!k)return;let C="",_="";if(l){const[,R]=k;_=R}else{const[,R,A]=k;_=R,C=A||""}const M=i(_.trim());return{type:e,raw:k[0],content:C.trim(),attributes:M}}},renderMarkdown:g=>{let b="";r?b=r(g):g.content&&g.content.length>0&&(b=g.content.filter(C=>C.type==="text").map(C=>C.text).join(""));const x=h(g.attrs||{}),S=s(x),k=S?` ${S}`:"";return l?`[${f}${k}]`:`[${f}${k}]${b}[/${f}]`}}}function bx(t,e,n){var r,i,s,o;const l=t.split(`
82
- `),u=[];let f="",h=0;const m=e.baseIndentSize||2;for(;h<l.length;){const g=l[h],b=g.match(e.itemPattern);if(!b){if(u.length>0)break;if(g.trim()===""){h+=1,f=`${f}${g}
83
- `;continue}else return}const x=e.extractItemData(b),{indentLevel:S,mainContent:k}=x;f=`${f}${g}
84
- `;const C=[k];for(h+=1;h<l.length;){const A=l[h];if(A.trim()===""){const D=l.slice(h+1).findIndex(q=>q.trim()!=="");if(D===-1)break;if((((i=(r=l[h+1+D].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>S){C.push(A),f=`${f}${A}
85
- `,h+=1;continue}else break}if((((o=(s=A.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>S)C.push(A),f=`${f}${A}
86
- `,h+=1;else break}let _;const M=C.slice(1);if(M.length>0){const A=M.map(O=>O.slice(S+m)).join(`
87
- `);A.trim()&&(e.customNestedParser?_=e.customNestedParser(A):_=n.blockTokens(A))}const R=e.createToken(x,_);u.push(R)}if(u.length!==0)return{items:u,raw:f}}function mS(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[s,...o]=t.content,l=e.renderChildren([s]);let u=`${i}${l}`;return o&&o.length>0&&o.forEach((f,h)=>{var m,g;const b=(g=(m=e.renderChild)==null?void 0:m.call(e,f,h+1))!=null?g:e.renderChildren([f]);if(b!=null){const x=b.split(`
88
- `).map(S=>S?e.indent(S):e.indent("")).join(`
89
- `);u+=f.type==="paragraph"?`
90
-
91
- ${x}`:`
92
- ${x}`}}),u}function XA(t){return typeof t.type=="string"?t.type:t.type.name}function W9(t,e){if(t.length!==e.length)return!1;const n=Array.from({length:e.length},()=>!1);return t.every(r=>{const i=XA(r),s=e.findIndex((o,l)=>!n[l]&&i===XA(o)&&Nc(r.attrs,o.attrs));return s===-1?!1:(n[s]=!0,!0)})}function LI(t,e){const n={...t};return jh(t)&&jh(e)&&Object.keys(e).forEach(r=>{jh(e[r])&&jh(t[r])?n[r]=LI(t[r],e[r]):n[r]=e[r]}),n}function K9(t,e,n={}){const{state:r}=e,{doc:i,tr:s}=r,o=t;i.descendants((l,u)=>{const f=s.mapping.map(u),h=s.mapping.map(u)+l.nodeSize;let m=null;if(l.marks.forEach(b=>{if(b!==o)return!1;m=b}),!m)return;let g=!1;if(Object.keys(n).forEach(b=>{n[b]!==m.attrs[b]&&(g=!0)}),g){const b=t.type.create({...t.attrs,...n});s.removeMark(f,h,t.type),s.addMark(f,h,b)}}),s.docChanged&&e.view.dispatch(s)}var ff=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},Z9=(t,e)=>{if(aS(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Lh(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:l}=t,{view:u}=n;if(u.composing)return!1;const f=u.state.doc.resolve(r);if(f.parent.type.spec.code||(e=f.nodeBefore||f.nodeAfter)!=null&&e.marks.find(g=>g.type.spec.code))return!1;let h=!1;const m=a9(f)+s;return o.forEach(g=>{if(h)return;const b=Z9(m,g.find);if(!b)return;const x=b[0].length-s.length;if(x>0){const O=f.parentOffset-x;if(O<0||f.parent.textBetween(O,f.parentOffset)!==b[0].slice(0,x))return}const S=u.state.tr,k=cg({state:u.state,transaction:S}),C={from:r-(b[0].length-s.length),to:i},{commands:_,chain:M,can:R}=new ug({editor:n,state:k});g.handler({state:k,range:C,match:b,commands:_,chain:M,can:R})===null||!S.steps.length||(g.undoable&&S.setMeta(l,{transform:S,from:r,to:i,text:s}),u.dispatch(S),h=!0)}),h}function Y9(t){const{editor:e,rules:n}=t,r=new zt({state:{init(){return null},apply(i,s,o){const l=i.getMeta(r);if(l)return l;const u=i.getMeta("applyInputRules");return u&&setTimeout(()=>{let{text:h}=u;typeof h=="string"?h=h:h=cS(de.from(h),o.schema);const{from:m}=u,g=m+h.length;Lh({editor:e,from:m,to:g,text:h,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,l){return Lh({editor:e,from:s,to:o,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Lh({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Lh({editor:e,from:o.pos,to:o.pos,text:`
93
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var gS=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...yt(De(this,"addOptions",{name:this.name}))}}get storage(){return{...yt(De(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>LI(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},rl=class PI extends gS{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new PI(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(f=>f?.type.name===n.name))return!1;const u=o.find(f=>f?.type.name===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},zI=class{constructor(t){this.find=t.find,this.handler=t.handler}},X9=(t,e,n)=>{if(aS(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function J9(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:l}=t,{commands:u,chain:f,can:h}=new ug({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,i,(b,x)=>{var S,k,C,_,M;if((k=(S=b.type)==null?void 0:S.spec)!=null&&k.code||!(b.isText||b.isTextblock||b.isInline))return;const R=(M=(_=(C=b.content)==null?void 0:C.size)!=null?_:b.nodeSize)!=null?M:0,A=Math.max(r,x),O=Math.min(i,x+R);if(A>=O)return;const D=b.isText?b.text||"":b.textBetween(A-x,O-x,void 0,"");X9(D,s.find,o).forEach(z=>{if(z.index===void 0)return;const q=A+z.index+1,Z=q+z[0].length,G={from:n.tr.mapping.map(q),to:n.tr.mapping.map(Z)},ee=s.handler({state:n,range:G,match:z,commands:u,chain:f,can:h,pasteEvent:o,dropEvent:l});m.push(ee)})}),m.every(b=>b!==null)}var Ph=null,Q9=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function e8(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const u=({state:h,from:m,to:g,rule:b,pasteEvt:x})=>{const S=h.tr,k=cg({state:h,transaction:S});if(!(!J9({editor:e,state:k,from:Math.max(m-1,0),to:g.b-1,rule:b,pasteEvent:x,dropEvent:l})||!S.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,S}};return n.map(h=>new zt({view(m){const g=x=>{var S;r=(S=m.dom.parentElement)!=null&&S.contains(x.target)?m.dom.parentElement:null,r&&(Ph=e)},b=()=>{Ph&&(Ph=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(m,g)=>{if(s=r===m.dom.parentElement,l=g,!s){const b=Ph;b?.isEditable&&setTimeout(()=>{const x=b.state.selection;x&&b.commands.deleteRange({from:x.from,to:x.to})},10)}return!1},paste:(m,g)=>{var b;const x=(b=g.clipboardData)==null?void 0:b.getData("text/html");return o=g,i=!!x?.includes("data-pm-slice"),!1}}},appendTransaction:(m,g,b)=>{const x=m[0],S=x.getMeta("uiEvent")==="paste"&&!i,k=x.getMeta("uiEvent")==="drop"&&!s,C=x.getMeta("applyPasteRules"),_=!!C;if(!S&&!k&&!_)return;if(_){let{text:A}=C;typeof A=="string"?A=A:A=cS(de.from(A),b.schema);const{from:O}=C,D=O+A.length,j=Q9(A);return u({rule:h,state:b,from:O,to:{b:D},pasteEvt:j})}const M=g.doc.content.findDiffStart(b.doc.content),R=g.doc.content.findDiffEnd(b.doc.content);if(!(!$9(M)||!R||M===R.b))return u({rule:h,state:b,from:M,to:R,pasteEvt:o})}}))}var pg=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=uS(t),this.schema=_I(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Fu(e.name,this.schema)},r=De(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return hc([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Fu(r.name,this.schema)},s=[],o=De(r,"addKeyboardShortcuts",i);let l={};if(r.type==="mark"&&De(r,"exitable",i)&&(l.ArrowRight=()=>rl.handleExit({editor:t,mark:r})),o){const g=Object.fromEntries(Object.entries(o()).map(([b,x])=>[b,()=>x({editor:t})]));l={...l,...g}}const u=nq(l);s.push(u);const f=De(r,"addInputRules",i);if(WA(r,t.options.enableInputRules)&&f){const g=f();if(g&&g.length){const b=Y9({editor:t,rules:g}),x=Array.isArray(b)?b:[b];s.push(...x)}}const h=De(r,"addPasteRules",i);if(WA(r,t.options.enablePasteRules)&&h){const g=h();if(g&&g.length){const b=e8({editor:t,rules:g});s.push(...b)}}const m=De(r,"addProseMirrorPlugins",i);if(m){const g=m();s.push(...g)}return s})}get attributes(){return TI(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Rc(this.extensions);return Object.fromEntries(e.filter(n=>!!De(n,"addNodeView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:bn(n.name,this.schema)},s=De(n,"addNodeView",i);if(!s)return[];const o=s();if(!o)return[];const l=(u,f,h,m,g)=>{const b=Mc(u,r);return o({node:u,view:f,getPos:h,decorations:m,innerDecorations:g,editor:t,extension:n,HTMLAttributes:b})};return[n.name,l]}))}dispatchTransaction(t){const{editor:e}=this;return hc([...this.extensions].reverse()).reduceRight((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Fu(i.name,this.schema)},o=De(i,"dispatchTransaction",s);return o?l=>{o.call(s,{transaction:l,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return hc([...this.extensions]).reduce((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Fu(i.name,this.schema)},o=De(i,"transformPastedHTML",s);return o?(l,u)=>{const f=r(l,u);return o.call(s,f)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=Rc(this.extensions);return Object.fromEntries(e.filter(n=>!!De(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:zs(n.name,this.schema)},s=De(n,"addMarkView",i);if(!s)return[];const o=(l,u,f)=>{const h=Mc(l,r);return s()({mark:l,view:u,inline:f,editor:t,extension:n,HTMLAttributes:h,updateAttributes:m=>{K9(l,t,m)}})};return[n.name,o]}))}destroy(){this.extensions.forEach(t=>{let e=t;for(;e.parent;){const n=e.parent;n.child===e&&(n.child=null),e=n}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n,r;const i={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Fu(e.name,this.schema)};e.type==="mark"&&(((n=yt(De(e,"keepOnSplit",i)))==null||n)&&this.splittableMarks.push(e.name),(r=yt(De(e,"clearable",i)))==null||r||this.nonClearableMarks.push(e.name));const s=De(e,"onBeforeCreate",i),o=De(e,"onCreate",i),l=De(e,"onUpdate",i),u=De(e,"onSelectionUpdate",i),f=De(e,"onTransaction",i),h=De(e,"onFocus",i),m=De(e,"onBlur",i),g=De(e,"onDestroy",i);s&&this.editor.on("beforeCreate",s),o&&this.editor.on("create",o),l&&this.editor.on("update",l),u&&this.editor.on("selectionUpdate",u),f&&this.editor.on("transaction",f),h&&this.editor.on("focus",h),m&&this.editor.on("blur",m),g&&this.editor.on("destroy",g)})}};pg.resolve=uS;pg.sort=hc;pg.flatten=hg;var t8={};oS(t8,{ClipboardTextSerializer:()=>BI,Commands:()=>VI,Delete:()=>HI,Drop:()=>UI,Editable:()=>FI,FocusEvents:()=>GI,Keymap:()=>WI,Paste:()=>KI,Tabindex:()=>ZI,TextDirection:()=>YI,focusEventsPluginKey:()=>qI});var Ft=class $I extends gS{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new $I(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},BI=Ft.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new zt({key:new tn("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,s=MI(n),{blockSeparator:o}=this.options,l={...o!==void 0?{blockSeparator:o}:{},textSerializers:s};return[...i.ranges].sort((f,h)=>f.$from.pos-h.$from.pos).map(({$from:f,$to:h})=>RI(r,{from:f.pos,to:h.pos},l)).join(o??`
94
-
95
- `)}}})]}}),VI=Ft.create({name:"commands",addCommands(){return{...ui}}}),HI=Ft.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;const s=()=>{var o,l,u,f;if((f=(u=(l=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:l.filterTransaction)==null?void 0:u.call(l,t))!=null?f:t.getMeta("y-sync$"))return;const h=kI(t.before,[t,...e]);dS(h).forEach(b=>{h.mapping.mapResult(b.oldRange.from).deletedAfter&&h.mapping.mapResult(b.oldRange.to).deletedBefore&&h.before.nodesBetween(b.oldRange.from,b.oldRange.to,(x,S)=>{const k=S+x.nodeSize-2,C=b.oldRange.from<=S&&k<=b.oldRange.to;this.editor.emit("delete",{type:"node",node:x,from:S,to:k,newFrom:h.mapping.map(S),newTo:h.mapping.map(k),deletedRange:b.oldRange,newRange:b.newRange,partial:!C,editor:this.editor,transaction:t,combinedTransform:h})})});const g=h.mapping;h.steps.forEach((b,x)=>{var S,k;if(b instanceof bi){const C=g.slice(x).map(b.from,-1),_=g.slice(x).map(b.to),M=g.invert().map(C,-1),R=g.invert().map(_),A=C>0?(S=h.doc.nodeAt(C-1))==null?void 0:S.marks.some(D=>D.eq(b.mark)):!1,O=(k=h.doc.nodeAt(_))==null?void 0:k.marks.some(D=>D.eq(b.mark));this.editor.emit("delete",{type:"mark",mark:b.mark,from:b.from,to:b.to,deletedRange:{from:M,to:R},newRange:{from:C,to:_},partial:!!(O||A),editor:this.editor,transaction:t,combinedTransform:h})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),UI=Ft.create({name:"drop",addProseMirrorPlugins(){return[new zt({key:new tn("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),FI=Ft.create({name:"editable",addProseMirrorPlugins(){return[new zt({key:new tn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),qI=new tn("focusEvents"),GI=Ft.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new zt({key:qI,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),WI=Ft.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:u,doc:f}=l,{empty:h,$anchor:m}=u,{pos:g,parent:b}=m,x=m.parent.isTextblock&&g>0?l.doc.resolve(g-1):m,S=x.parent.type.spec.isolating,k=m.pos-m.parentOffset,C=S&&x.parent.childCount===1?k===m.pos:Ke.atStart(f).from===g;return!h||!b.type.isTextblock||b.textContent.length||!C||C&&m.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return rm()||wI()?s:i},addProseMirrorPlugins(){return[new zt({key:new tn("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(S=>S.getMeta("composition")))return;const r=t.some(S=>S.docChanged)&&!e.doc.eq(n.doc),i=t.some(S=>S.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:l}=e.selection,u=Ke.atStart(e.doc).from,f=Ke.atEnd(e.doc).to;if(s||!(o===u&&l===f)||!df(n.doc))return;const g=n.tr,b=cg({state:n,transaction:g}),{commands:x}=new ug({editor:this.editor,state:b});if(x.clearNodes(),!!g.steps.length)return g}})]}}),KI=Ft.create({name:"paste",addProseMirrorPlugins(){return[new zt({key:new tn("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),ZI=Ft.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new zt({key:new tn("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!=null?t:"0"}}}})]}}),YI=Ft.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Rc(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new zt({key:new tn("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),n8=class rd{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new rd(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new rd(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new rd(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,o=n.isInline,l=this.pos+r+(s?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const u=this.resolvedPos.doc.resolve(l);if(!i&&!o&&u.depth<=this.depth)return;const f=new rd(u,this.editor,i,i||o?n:null);i&&(f.actualDepth=this.depth+1),e.push(f)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let l=0;l<o.length;l+=1){const u=o[l];if(s[u]!==n[u])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(u=>n[u]===o.node.attrs[u])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},r8=`.ProseMirror {
96
- position: relative;
97
- }
98
-
99
- .ProseMirror {
100
- word-wrap: break-word;
101
- white-space: pre-wrap;
102
- white-space: break-spaces;
103
- -webkit-font-variant-ligatures: none;
104
- font-variant-ligatures: none;
105
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
106
- }
107
-
108
- .ProseMirror [contenteditable="false"] {
109
- white-space: normal;
110
- }
111
-
112
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
113
- white-space: pre-wrap;
114
- }
115
-
116
- .ProseMirror pre {
117
- white-space: pre-wrap;
118
- }
119
-
120
- img.ProseMirror-separator {
121
- display: inline !important;
122
- border: none !important;
123
- margin: 0 !important;
124
- width: 0 !important;
125
- height: 0 !important;
126
- }
127
-
128
- .ProseMirror-gapcursor {
129
- display: none;
130
- pointer-events: none;
131
- position: absolute;
132
- margin: 0;
133
- }
134
-
135
- .ProseMirror-gapcursor:after {
136
- content: "";
137
- display: block;
138
- position: absolute;
139
- top: -2px;
140
- width: 20px;
141
- border-top: 1px solid black;
142
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
143
- }
144
-
145
- @keyframes ProseMirror-cursor-blink {
146
- to {
147
- visibility: hidden;
148
- }
149
- }
150
-
151
- .ProseMirror-hideselection *::selection {
152
- background: transparent;
153
- }
154
-
155
- .ProseMirror-hideselection *::-moz-selection {
156
- background: transparent;
157
- }
158
-
159
- .ProseMirror-hideselection * {
160
- caret-color: transparent;
161
- }
162
-
163
- .ProseMirror-focused .ProseMirror-gapcursor {
164
- display: block;
165
- }`,i8=class extends j9{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:d9,createMappablePosition:f9},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:r,moved:i})=>this.options.onDrop(n,r,i)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),this.on("delete",this.options.onDelete);const e=this.createDoc();if(!this.editorState){const n=mx(e,this.options.autofocus);this.editorState=_a.create({doc:e,schema:this.schema,selection:n||void 0})}this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=P9(r8,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=EI(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;n=n.filter(o=>!o.key.startsWith(s))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e,n,r;const s=[...this.options.enableCoreExtensions?[FI,BI.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),VI,GI,WI,ZI.configure({value:(r=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:r.value}),UI,KI,HI,YI.configure({direction:this.options.textDirection})].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o?.type));this.extensionManager=new pg(s,this)}createCommandManager(){this.commandManager=new ug({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=gx(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;const n=gx(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=_a.create({doc:n,schema:this.schema,selection:mx(n,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),this.editorState.doc}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,s=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(s);this.editorView=new mI(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),this.prependClass(),this.injectCSS();const u=this.view.dom;u.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(f=>{var h;return(h=this.capturedTransaction)==null?void 0:h.step(f)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(f=>f.getMeta("focus")||f.getMeta("blur")),l=o?.getMeta("focus"),u=o?.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:o}),u&&this.emit("blur",{editor:this,event:u.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(f=>f.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return NI(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return l9(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return cS(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
166
-
167
- `,textSerializers:n={}}=t||{};return n9(this.state.doc,{blockSeparator:e,textSerializers:{...MI(this.schema),...n}})}get isEmpty(){return df(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText&&e.nodeAfter.isAtom?e.nodeAfter:null;return new n8(e,this,!1,n)}get $doc(){return this.$pos(0)}};function Ga(t){return new ff({find:t.find,handler:({state:e,range:n,match:r})=>{const i=yt(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],l=r[0];if(o){const u=l.search(/\S/),f=n.from+l.indexOf(o),h=f+o.length;if(fS(n.from,n.to,e.doc).filter(b=>b.mark.type.excluded.find(S=>S===t.type&&S!==b.mark.type)).filter(b=>b.to>f).length)return null;h<n.to&&s.delete(h,n.to),f>n.from&&s.delete(n.from+u,f);const g=n.from+u+o.length;s.addMark(n.from+u,g,t.type.create(i||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}function XI(t){return new ff({find:t.find,handler:({state:e,range:n,match:r})=>{const i=yt(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let l=n.to;const u=t.type.create(i);if(r[1]){const f=r[0].lastIndexOf(r[1]);let h=o+f;h>l?h=l:l=h+r[1].length;const m=r[0][r[0].length-1];s.insertText(m,o+r[0].length-1),s.replaceWith(h,l,u)}else if(r[0]){const f=t.type.isInline?o:o-1;s.insert(f,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l))}s.scrollIntoView()},undoable:t.undoable})}function vx(t){return new ff({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=yt(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)},undoable:t.undoable})}function Oc(t){return new ff({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=yt(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),u=o.doc.resolve(n.from).blockRange(),f=u&&Uw(u,t.type,s);if(!f)return null;if(o.wrap(u,f),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:b}=t.editor.extensionManager,x=g||m.$to.parentOffset&&m.$from.marks();if(x){const S=x.filter(k=>b.includes(k.type.name));o.ensureMarks(S)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(m,s).run()}const h=o.doc.resolve(n.from-1).nodeBefore;h&&h.type===t.type&&Yo(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,h))&&o.join(n.from-1)},undoable:t.undoable})}var s8=t=>"touches"in t,o8=class{constructor(t){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=l=>{if(!this.isResizing||!this.activeHandle)return;const u=l.clientX-this.startX,f=l.clientY-this.startY;this.handleResize(u,f)},this.handleTouchMove=l=>{if(!this.isResizing||!this.activeHandle)return;const u=l.touches[0];if(!u)return;const f=u.clientX-this.startX,h=u.clientY-this.startY;this.handleResize(f,h)},this.handleMouseUp=()=>{if(!this.isResizing)return;const l=this.element.offsetWidth,u=this.element.offsetHeight;this.onCommit(l,u),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,i,s,o;this.node=t.node,this.editor=t.editor,this.element=t.element,this.element.draggable=!1,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(r=t?.options)!=null&&r.directions&&(this.directions=t.options.directions),(i=t.options)!=null&&i.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(s=t.options)!=null&&s.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(o=t.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!=null?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),i=e.includes("left"),s=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),i&&(t.style.left="0"),s&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,s8(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,t,e),s=this.applyConstraints(r,i,n);this.element.style.width=`${s.width}px`,this.element.style.height=`${s.height}px`,this.onResize&&this.onResize(s.width,s.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,i=this.startHeight;const s=t.includes("right"),o=t.includes("left"),l=t.includes("bottom"),u=t.includes("top");return s?r=this.startWidth+e:o&&(r=this.startWidth-e),l?i=this.startHeight+n:u&&(i=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(s?e:-e)),(t==="top"||t==="bottom")&&(i=this.startHeight+(l?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,t):{width:r,height:i}}applyConstraints(t,e,n){var r,i,s,o;if(!n){let f=Math.max(this.minSize.width,t),h=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(f=Math.min(this.maxSize.width,f)),(i=this.maxSize)!=null&&i.height&&(h=Math.min(this.maxSize.height,h)),{width:f,height:h}}let l=t,u=e;return l<this.minSize.width&&(l=this.minSize.width,u=l/this.aspectRatio),u<this.minSize.height&&(u=this.minSize.height,l=u*this.aspectRatio),(s=this.maxSize)!=null&&s.width&&l>this.maxSize.width&&(l=this.maxSize.width,u=l/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&u>this.maxSize.height&&(u=this.maxSize.height,l=u*this.aspectRatio),{width:l,height:u}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",i=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:i?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}},Mn=class JI extends gS{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new JI(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Fo(t){return new zI({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=yt(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,l=r[r.length-1],u=r[0];let f=n.to;if(l){const h=u.search(/\S/),m=n.from+u.indexOf(l),g=m+l.length;if(fS(n.from,n.to,e.doc).filter(S=>S.mark.type.excluded.find(C=>C===t.type&&C!==S.mark.type)).filter(S=>S.to>m).length)return null;g<n.to&&o.delete(g,n.to),m>n.from&&o.delete(n.from+h,m),f=n.from+h+l.length,o.addMark(n.from+h,f,t.type.create(s||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:a8,getOwnPropertySymbols:l8}=Object,{hasOwnProperty:c8}=Object.prototype;function zv(t,e){return function(r,i,s){return t(r,i,s)&&e(r,i,s)}}function zh(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);const{cache:s}=i,o=s.get(n),l=s.get(r);if(o&&l)return o===r&&l===n;s.set(n,r),s.set(r,n);const u=t(n,r,i);return s.delete(n),s.delete(r),u}}function u8(t){return t?.[Symbol.toStringTag]}function JA(t){return a8(t).concat(l8(t))}const d8=Object.hasOwn||((t,e)=>c8.call(t,e));function il(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const f8="__v",h8="__o",p8="_owner",{getOwnPropertyDescriptor:QA,keys:eR}=Object;function m8(t,e){return t.byteLength===e.byteLength&&im(new Uint8Array(t),new Uint8Array(e))}function g8(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function y8(t,e){return t.byteLength===e.byteLength&&im(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function b8(t,e){return il(t.getTime(),e.getTime())}function v8(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function x8(t,e){return t===e}function tR(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.entries();let o,l,u=0;for(;(o=s.next())&&!o.done;){const f=e.entries();let h=!1,m=0;for(;(l=f.next())&&!l.done;){if(i[m]){m++;continue}const g=o.value,b=l.value;if(n.equals(g[0],b[0],u,m,t,e,n)&&n.equals(g[1],b[1],g[0],b[0],t,e,n)){h=i[m]=!0;break}m++}if(!h)return!1;u++}return!0}const w8=il;function S8(t,e,n){const r=eR(t);let i=r.length;if(eR(e).length!==i)return!1;for(;i-- >0;)if(!QI(t,e,n,r[i]))return!1;return!0}function qu(t,e,n){const r=JA(t);let i=r.length;if(JA(e).length!==i)return!1;let s,o,l;for(;i-- >0;)if(s=r[i],!QI(t,e,n,s)||(o=QA(t,s),l=QA(e,s),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function k8(t,e){return il(t.valueOf(),e.valueOf())}function C8(t,e){return t.source===e.source&&t.flags===e.flags}function nR(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.values();let o,l;for(;(o=s.next())&&!o.done;){const u=e.values();let f=!1,h=0;for(;(l=u.next())&&!l.done;){if(!i[h]&&n.equals(o.value,l.value,o.value,l.value,t,e,n)){f=i[h]=!0;break}h++}if(!f)return!1}return!0}function im(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function E8(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function QI(t,e,n,r){return(r===p8||r===h8||r===f8)&&(t.$$typeof||e.$$typeof)?!0:d8(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const T8="[object ArrayBuffer]",_8="[object Arguments]",A8="[object Boolean]",R8="[object DataView]",M8="[object Date]",N8="[object Error]",O8="[object Map]",D8="[object Number]",I8="[object Object]",j8="[object RegExp]",L8="[object Set]",P8="[object String]",z8={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},$8="[object URL]",B8=Object.prototype.toString;function V8({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:o,areNumbersEqual:l,areObjectsEqual:u,arePrimitiveWrappersEqual:f,areRegExpsEqual:h,areSetsEqual:m,areTypedArraysEqual:g,areUrlsEqual:b,unknownTagComparators:x}){return function(k,C,_){if(k===C)return!0;if(k==null||C==null)return!1;const M=typeof k;if(M!==typeof C)return!1;if(M!=="object")return M==="number"?l(k,C,_):M==="function"?s(k,C,_):!1;const R=k.constructor;if(R!==C.constructor)return!1;if(R===Object)return u(k,C,_);if(Array.isArray(k))return e(k,C,_);if(R===Date)return r(k,C,_);if(R===RegExp)return h(k,C,_);if(R===Map)return o(k,C,_);if(R===Set)return m(k,C,_);const A=B8.call(k);if(A===M8)return r(k,C,_);if(A===j8)return h(k,C,_);if(A===O8)return o(k,C,_);if(A===L8)return m(k,C,_);if(A===I8)return typeof k.then!="function"&&typeof C.then!="function"&&u(k,C,_);if(A===$8)return b(k,C,_);if(A===N8)return i(k,C,_);if(A===_8)return u(k,C,_);if(z8[A])return g(k,C,_);if(A===T8)return t(k,C,_);if(A===R8)return n(k,C,_);if(A===A8||A===D8||A===P8)return f(k,C,_);if(x){let O=x[A];if(!O){const D=u8(k);D&&(O=x[D])}if(O)return O(k,C,_)}return!1}}function H8({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:m8,areArraysEqual:n?qu:g8,areDataViewsEqual:y8,areDatesEqual:b8,areErrorsEqual:v8,areFunctionsEqual:x8,areMapsEqual:n?zv(tR,qu):tR,areNumbersEqual:w8,areObjectsEqual:n?qu:S8,arePrimitiveWrappersEqual:k8,areRegExpsEqual:C8,areSetsEqual:n?zv(nR,qu):nR,areTypedArraysEqual:n?zv(im,qu):im,areUrlsEqual:E8,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const i=zh(r.areArraysEqual),s=zh(r.areMapsEqual),o=zh(r.areObjectsEqual),l=zh(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:o,areSetsEqual:l})}return r}function U8(t){return function(e,n,r,i,s,o,l){return t(e,n,l)}}function F8({circular:t,comparator:e,createState:n,equals:r,strict:i}){if(n)return function(l,u){const{cache:f=t?new WeakMap:void 0,meta:h}=n();return e(l,u,{cache:f,equals:r,meta:h,strict:i})};if(t)return function(l,u){return e(l,u,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const s={cache:void 0,equals:r,meta:void 0,strict:i};return function(l,u){return e(l,u,s)}}const q8=Jo();Jo({strict:!0});Jo({circular:!0});Jo({circular:!0,strict:!0});Jo({createInternalComparator:()=>il});Jo({strict:!0,createInternalComparator:()=>il});Jo({circular:!0,createInternalComparator:()=>il});Jo({circular:!0,createInternalComparator:()=>il,strict:!0});function Jo(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:i=!1}=t,s=H8(t),o=V8(s),l=n?n(o):U8(o);return F8({circular:e,comparator:o,createState:r,equals:l,strict:i})}var $v={exports:{}},Bv={};var rR;function G8(){if(rR)return Bv;rR=1;var t=Wd(),e=LO();function n(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,l=t.useMemo,u=t.useDebugValue;return Bv.useSyncExternalStoreWithSelector=function(f,h,m,g,b){var x=s(null);if(x.current===null){var S={hasValue:!1,value:null};x.current=S}else S=x.current;x=l(function(){function C(O){if(!_){if(_=!0,M=O,O=g(O),b!==void 0&&S.hasValue){var D=S.value;if(b(D,O))return R=D}return R=O}if(D=R,r(M,O))return D;var j=g(O);return b!==void 0&&b(D,j)?(M=O,D):(M=O,R=j)}var _=!1,M,R,A=m===void 0?null:m;return[function(){return C(h())},A===null?void 0:function(){return C(A())}]},[h,m,g,b]);var k=i(f,x[0],x[1]);return o(function(){S.hasValue=!0,S.value=k},[k]),u(k),k},Bv}var iR;function W8(){return iR||(iR=1,$v.exports=G8()),$v.exports}var K8=W8(),Z8=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},Y8=({contentComponent:t})=>{const e=PO.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return y.jsx(y.Fragment,{children:Object.values(e)})};function X8(){const t=new Set;let e={},n=!1;const r=()=>{n||!t.size||(n=!0,queueMicrotask(()=>{n=!1,t.forEach(i=>i())}))};return{subscribe(i){return t.add(i),()=>{t.delete(i)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(i,s){e={...e,[i]:hF.createPortal(s.reactElement,s.element,i)},r()},removeRenderer(i){const s={...e};delete s[i],e=s,r()}}}var J8=class extends Ge.Component{constructor(t){super(t),this.editorContentRef=Ge.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=X8(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var t;const e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return y.jsxs(y.Fragment,{children:[y.jsx("div",{ref:Z8(e,this.editorContentRef),...n}),t?.contentComponent&&y.jsx(Y8,{contentComponent:t.contentComponent})]})}},Q8=E.forwardRef((t,e)=>{const n=Ge.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Ge.createElement(J8,{key:n,innerRef:e,...t})}),ej=Ge.memo(Q8),eG=typeof window<"u"?E.useLayoutEffect:E.useEffect,tG=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){let e;const n=i=>{i?.transaction!==void 0&&i.transaction===e||(e=i?.transaction,this.transactionNumber+=1,this.subscribers.forEach(s=>s()))},r=this.editor;return r.on("transaction",n),r.on("update",n),()=>{r.off("transaction",n),r.off("update",n)}}}};function tj(t){var e;const[n]=E.useState(()=>new tG(t.editor)),r=K8.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:q8);return eG(()=>n.watch(t.editor),[t.editor,n]),E.useDebugValue(r),r}var nG=!1,nj=typeof window>"u",rG=nj||!!(typeof window<"u"&&window.next),iG=class rj{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){const e=this.options.current.immediatelyRender;let n=e??!0;return nj?(n&&nG&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):rG&&e===void 0&&(n=!1),n?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)==null?void 0:s.call(i,...r)},onBlur:(...r)=>{var i,s;return(s=(i=this.options.current).onBlur)==null?void 0:s.call(i,...r)},onCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onCreate)==null?void 0:s.call(i,...r)},onDestroy:(...r)=>{var i,s;return(s=(i=this.options.current).onDestroy)==null?void 0:s.call(i,...r)},onFocus:(...r)=>{var i,s;return(s=(i=this.options.current).onFocus)==null?void 0:s.call(i,...r)},onSelectionUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)==null?void 0:s.call(i,...r)},onTransaction:(...r)=>{var i,s;return(s=(i=this.options.current).onTransaction)==null?void 0:s.call(i,...r)},onUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onUpdate)==null?void 0:s.call(i,...r)},onContentError:(...r)=>{var i,s;return(s=(i=this.options.current).onContentError)==null?void 0:s.call(i,...r)},onDrop:(...r)=>{var i,s;return(s=(i=this.options.current).onDrop)==null?void 0:s.call(i,...r)},onPaste:(...r)=>{var i,s;return(s=(i=this.options.current).onPaste)==null?void 0:s.call(i,...r)},onDelete:(...r)=>{var i,s;return(s=(i=this.options.current).onDelete)==null?void 0:s.call(i,...r)},onMount:(...r)=>{var i,s;return(s=(i=this.options.current).onMount)==null?void 0:s.call(i,...r)},onUnmount:(...r)=>{var i,s;return(s=(i=this.options.current).onUnmount)==null?void 0:s.call(i,...r)}};return new i8(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,s)=>{var o;return i===((o=n.extensions)==null?void 0:o[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?rj.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function sG(t={},e=[]){const n=E.useRef(t);n.current=t;const[r]=E.useState(()=>new iG(n)),i=PO.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return E.useDebugValue(i),E.useEffect(r.onRender(e)),tj({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&s===0?0:s+1}),i}var ij=E.createContext({editor:null});ij.Consumer;var oG=E.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),aG=()=>E.useContext(oG);Ge.forwardRef((t,e)=>{const{onDragStart:n}=aG(),r=t.as||"div";return y.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});Ge.createContext({markViewContentRef:()=>{}});var yS=E.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});yS.displayName="TiptapContext";var lG=()=>E.useContext(yS);function sj({children:t,...e}){const n="editor"in e?e.editor:e.instance;if(!n)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const r=E.useMemo(()=>({editor:n}),[n]),i=E.useMemo(()=>({editor:n}),[n]);return y.jsx(ij.Provider,{value:i,children:y.jsx(yS.Provider,{value:r,children:t})})}sj.displayName="Tiptap";function oj({...t}){const{editor:e}=lG();return y.jsx(ej,{editor:e,...t})}oj.displayName="Tiptap.Content";Object.assign(sj,{Content:oj});var sm=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},cG=(t,e)=>{var n;const{state:r,view:i}=t,{selection:s}=r;if(!s.empty)return!1;const{$from:o}=s;if(o.parentOffset!==0)return!1;const l=o.depth-1;if(l<0)return!1;const u=o.node(l),f=o.index(l);if(f===0)return!1;if(u.type===e)return t.commands.lift(e.name);const h=u.child(f-1);if(h.type!==e||!((n=h.lastChild)!=null&&n.isTextblock))return!1;const m=o.before(),b=m-1-1,{tr:x}=r;return x.delete(m,o.after()).insert(b,o.parent.content),x.setSelection($e.create(x.doc,b)),i.dispatch(x.scrollIntoView()),!0},uG=/^\s*>\s$/,dG=Mn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return sm("blockquote",{...Pt(this.options.HTMLAttributes,t),children:sm("slot",{})})},parseMarkdown:(t,e)=>{var n;const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach((i,s)=>{var o,l;const h=((l=(o=e.renderChild)==null?void 0:o.call(e,i,s))!=null?l:e.renderChildren([i])).split(`
168
- `).map(m=>m.trim()===""?n:`${n} ${m}`);r.push(h.join(`
169
- `))}),r.join(`
170
- ${n}
171
- `)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>cG(this.editor,this.type)}},addInputRules(){return[Oc({find:uG,type:this.type})]}}),fG=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,hG=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,pG=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,mG=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,gG=rl.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return sm("strong",{...Pt(this.options.HTMLAttributes,t),children:sm("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Ga({find:fG,type:this.type}),Ga({find:pG,type:this.type})]},addPasteRules(){return[Fo({find:hG,type:this.type}),Fo({find:mG,type:this.type})]}}),yG=t=>{const e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},bG=t=>{const e=/`([^`]+)`(?!`)/g,n=[];let r;for(;(r=e.exec(t))!==null;)r.index>0&&t[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},vG=rl.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Pt(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Ga({find:yG,type:this.type})]},addPasteRules(){return[Fo({find:bG,type:this.type})]}}),Vv=4,xG=/^```([a-z]+)?[\s\n]$/,wG=/^~~~([a-z]+)?[\s\n]$/,SG=Mn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Vv,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const s=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Pt(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const i=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${i}`,e.renderChildren(t.content),"```"].join(`
172
- `):r=`\`\`\`${i}
173
-
174
- \`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Vv,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const l=" ".repeat(n);return o?t.commands.insertContent(l):t.commands.command(({tr:u})=>{const{from:f,to:h}=i,b=r.doc.textBetween(f,h,`
175
- `,`
176
- `).split(`
177
- `).map(x=>l+x).join(`
178
- `);return u.replaceWith(f,h,r.schema.text(b)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Vv,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?t.commands.command(({tr:l})=>{var u;const{pos:f}=s,h=s.start(),m=s.end(),b=r.doc.textBetween(h,m,`
179
- `,`
180
- `).split(`
181
- `);let x=0,S=0;const k=f-h;for(let O=0;O<b.length;O+=1){if(S+b[O].length>=k){x=O;break}S+=b[O].length+1}const _=((u=b[x].match(/^ */))==null?void 0:u[0])||"",M=Math.min(_.length,n);if(M===0)return!0;let R=h;for(let O=0;O<x;O+=1)R+=b[O].length+1;return l.delete(R,R+M),f-R<=M&&l.setSelection($e.create(l.doc,R)),!0}):t.commands.command(({tr:l})=>{const{from:u,to:f}=i,g=r.doc.textBetween(u,f,`
182
- `,`
183
- `).split(`
184
- `).map(b=>{var x;const S=((x=b.match(/^ */))==null?void 0:x[0])||"",k=Math.min(S.length,n);return b.slice(k)}).join(`
185
- `);return l.replaceWith(u,f,r.schema.text(g)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
186
-
187
- `);return!s||!o?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:t})=>{if(!this.options.exitOnArrowUp)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||r.parentOffset!==0)return!1;const s=r.before();return s>0?!1:t.commands.insertDefaultBlock({pos:s})},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const l=i.after();return l===void 0?!1:r.nodeAt(l)?t.commands.command(({tr:f})=>(f.setSelection(Ke.near(r.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[vx({find:xG,type:this.type,getAttributes:t=>({language:t[1]})}),vx({find:wG,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new zt({key:new tn("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i?.mode;if(!n||!s)return!1;const{tr:o,schema:l}=t.state,u=l.text(n.replace(/\r\n?/g,`
188
- `));return o.replaceSelectionWith(this.type.create({language:s},u)),o.selection.$from.parent.type!==this.type&&o.setSelection($e.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),kG=Mn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
189
-
190
- `):""}),CG=Mn.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Pt(this.options.HTMLAttributes,t)]},renderText(){return`
191
- `},renderMarkdown:()=>`
192
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,u=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:f,dispatch:h})=>{if(h&&u&&o){const m=u.filter(g=>l.includes(g.type.name));f.ensureMarks(m)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),EG=Mn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Pt(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,i="#".repeat(r);return t.content?`${i} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>vx({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),TG=Mn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Pt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!L9(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,i=t();return OI(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:o,dispatch:l})=>{if(l){const{$to:u}=o.selection,f=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection($e.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(He.create(o.doc,u.pos)):o.setSelection($e.create(o.doc,u.pos));else{const h=s.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,m=h?.create();m&&(o.insert(f,m),o.setSelection($e.create(o.doc,f+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[XI({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),_G=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,AG=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,RG=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,MG=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,NG=rl.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Ga({find:_G,type:this.type}),Ga({find:RG,type:this.type})]},addPasteRules(){return[Fo({find:AG,type:this.type}),Fo({find:MG,type:this.type})]}});const OG="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",DG="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",xx="numeric",wx="ascii",Sx="alpha",md="asciinumeric",id="alphanumeric",kx="domain",aj="emoji",IG="scheme",jG="slashscheme",Hv="whitespace";function LG(t,e){return t in e||(e[t]=[]),e[t]}function Na(t,e,n){e[xx]&&(e[md]=!0,e[id]=!0),e[wx]&&(e[md]=!0,e[Sx]=!0),e[md]&&(e[id]=!0),e[Sx]&&(e[id]=!0),e[id]&&(e[kx]=!0),e[aj]&&(e[kx]=!0);for(const r in e){const i=LG(r,n);i.indexOf(t)<0&&i.push(t)}}function PG(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function mr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}mr.groups={};mr.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||mr.groups;let i;return e&&e.j?i=e:(i=new mr(e),n&&r&&Na(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(t[o]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||mr.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let o,l=i.go(t);if(l?(o=new mr,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new mr,s){if(r)if(o.t&&typeof o.t=="string"){const u=Object.assign(PG(o.t,r),n);Na(s,u,r)}else n&&Na(s,n,r);o.t=s}return i.j[t]=o,o}};const rt=(t,e,n,r,i)=>t.ta(e,n,r,i),Jt=(t,e,n,r,i)=>t.tr(e,n,r,i),sR=(t,e,n,r,i)=>t.ts(e,n,r,i),be=(t,e,n,r,i)=>t.tt(e,n,r,i),ps="WORD",Cx="UWORD",lj="ASCIINUMERICAL",cj="ALPHANUMERICAL",Hd="LOCALHOST",Ex="TLD",Tx="UTLD",xp="SCHEME",oc="SLASH_SCHEME",bS="NUM",_x="WS",vS="NL",gd="OPENBRACE",yd="CLOSEBRACE",om="OPENBRACKET",am="CLOSEBRACKET",lm="OPENPAREN",cm="CLOSEPAREN",um="OPENANGLEBRACKET",dm="CLOSEANGLEBRACKET",fm="FULLWIDTHLEFTPAREN",hm="FULLWIDTHRIGHTPAREN",pm="LEFTCORNERBRACKET",mm="RIGHTCORNERBRACKET",gm="LEFTWHITECORNERBRACKET",ym="RIGHTWHITECORNERBRACKET",bm="FULLWIDTHLESSTHAN",vm="FULLWIDTHGREATERTHAN",xm="AMPERSAND",wm="APOSTROPHE",Sm="ASTERISK",yo="AT",km="BACKSLASH",Cm="BACKTICK",Em="CARET",Oa="COLON",xS="COMMA",Tm="DOLLAR",Mi="DOT",_m="EQUALS",wS="EXCLAMATION",Xr="HYPHEN",bd="PERCENT",Am="PIPE",Rm="PLUS",Mm="POUND",vd="QUERY",SS="QUOTE",uj="FULLWIDTHMIDDLEDOT",kS="SEMI",Ni="SLASH",xd="TILDE",Nm="UNDERSCORE",dj="EMOJI",Om="SYM";var fj=Object.freeze({__proto__:null,ALPHANUMERICAL:cj,AMPERSAND:xm,APOSTROPHE:wm,ASCIINUMERICAL:lj,ASTERISK:Sm,AT:yo,BACKSLASH:km,BACKTICK:Cm,CARET:Em,CLOSEANGLEBRACKET:dm,CLOSEBRACE:yd,CLOSEBRACKET:am,CLOSEPAREN:cm,COLON:Oa,COMMA:xS,DOLLAR:Tm,DOT:Mi,EMOJI:dj,EQUALS:_m,EXCLAMATION:wS,FULLWIDTHGREATERTHAN:vm,FULLWIDTHLEFTPAREN:fm,FULLWIDTHLESSTHAN:bm,FULLWIDTHMIDDLEDOT:uj,FULLWIDTHRIGHTPAREN:hm,HYPHEN:Xr,LEFTCORNERBRACKET:pm,LEFTWHITECORNERBRACKET:gm,LOCALHOST:Hd,NL:vS,NUM:bS,OPENANGLEBRACKET:um,OPENBRACE:gd,OPENBRACKET:om,OPENPAREN:lm,PERCENT:bd,PIPE:Am,PLUS:Rm,POUND:Mm,QUERY:vd,QUOTE:SS,RIGHTCORNERBRACKET:mm,RIGHTWHITECORNERBRACKET:ym,SCHEME:xp,SEMI:kS,SLASH:Ni,SLASH_SCHEME:oc,SYM:Om,TILDE:xd,TLD:Ex,UNDERSCORE:Nm,UTLD:Tx,UWORD:Cx,WORD:ps,WS:_x});const ds=/[a-z]/,Gu=new RegExp("\\p{L}","u"),Uv=new RegExp("\\p{Emoji}","u"),fs=/\d/,Fv=/\s/,oR="\r",qv=`
193
- `,zG="️",$G="‍",Gv="";let $h=null,Bh=null;function BG(t=[]){const e={};mr.groups=e;const n=new mr;$h==null&&($h=aR(OG)),Bh==null&&(Bh=aR(DG)),be(n,"'",wm),be(n,"{",gd),be(n,"}",yd),be(n,"[",om),be(n,"]",am),be(n,"(",lm),be(n,")",cm),be(n,"<",um),be(n,">",dm),be(n,"(",fm),be(n,")",hm),be(n,"「",pm),be(n,"」",mm),be(n,"『",gm),be(n,"』",ym),be(n,"<",bm),be(n,">",vm),be(n,"&",xm),be(n,"*",Sm),be(n,"@",yo),be(n,"`",Cm),be(n,"^",Em),be(n,":",Oa),be(n,",",xS),be(n,"$",Tm),be(n,".",Mi),be(n,"=",_m),be(n,"!",wS),be(n,"-",Xr),be(n,"%",bd),be(n,"|",Am),be(n,"+",Rm),be(n,"#",Mm),be(n,"?",vd),be(n,'"',SS),be(n,"/",Ni),be(n,";",kS),be(n,"~",xd),be(n,"_",Nm),be(n,"\\",km),be(n,"・",uj);const r=Jt(n,fs,bS,{[xx]:!0});Jt(r,fs,r);const i=Jt(r,ds,lj,{[md]:!0}),s=Jt(r,Gu,cj,{[id]:!0}),o=Jt(n,ds,ps,{[wx]:!0});Jt(o,fs,i),Jt(o,ds,o),Jt(i,fs,i),Jt(i,ds,i);const l=Jt(n,Gu,Cx,{[Sx]:!0});Jt(l,ds),Jt(l,fs,s),Jt(l,Gu,l),Jt(s,fs,s),Jt(s,ds),Jt(s,Gu,s);const u=be(n,qv,vS,{[Hv]:!0}),f=be(n,oR,_x,{[Hv]:!0}),h=Jt(n,Fv,_x,{[Hv]:!0});be(n,Gv,h),be(f,qv,u),be(f,Gv,h),Jt(f,Fv,h),be(h,oR),be(h,qv),Jt(h,Fv,h),be(h,Gv,h);const m=Jt(n,Uv,dj,{[aj]:!0});be(m,"#"),Jt(m,Uv,m),be(m,zG,m);const g=be(m,$G);be(g,"#"),Jt(g,Uv,m);const b=[[ds,o],[fs,i]],x=[[ds,null],[Gu,l],[fs,s]];for(let S=0;S<$h.length;S++)fo(n,$h[S],Ex,ps,b);for(let S=0;S<Bh.length;S++)fo(n,Bh[S],Tx,Cx,x);Na(Ex,{tld:!0,ascii:!0},e),Na(Tx,{utld:!0,alpha:!0},e),fo(n,"file",xp,ps,b),fo(n,"mailto",xp,ps,b),fo(n,"http",oc,ps,b),fo(n,"https",oc,ps,b),fo(n,"ftp",oc,ps,b),fo(n,"ftps",oc,ps,b),Na(xp,{scheme:!0,ascii:!0},e),Na(oc,{slashscheme:!0,ascii:!0},e),t=t.sort((S,k)=>S[0]>k[0]?1:-1);for(let S=0;S<t.length;S++){const k=t[S][0],_=t[S][1]?{[IG]:!0}:{[jG]:!0};k.indexOf("-")>=0?_[kx]=!0:ds.test(k)?fs.test(k)?_[md]=!0:_[wx]=!0:_[xx]=!0,sR(n,k,k,_)}return sR(n,"localhost",Hd,{ascii:!0}),n.jd=new mr(Om),{start:n,tokens:Object.assign({groups:e},fj)}}function hj(t,e){const n=VG(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,i=[];let s=0,o=0;for(;o<r;){let l=t,u=null,f=0,h=null,m=-1,g=-1;for(;o<r&&(u=l.go(n[o]));)l=u,l.accepts()?(m=0,g=0,h=l):m>=0&&(m+=n[o].length,g++),f+=n[o].length,s+=n[o].length,o++;s-=m,o-=g,f-=m,i.push({t:h.t,v:e.slice(s-f,s),s:s-f,e:s})}return i}function VG(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),s,o=i<55296||i>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function fo(t,e,n,r,i){let s;const o=e.length;for(let l=0;l<o-1;l++){const u=e[l];t.j[u]?s=t.j[u]:(s=new mr(r),s.jr=i.slice(),t.j[u]=s),t=s}return s=new mr(n),s.jr=i.slice(),t.j[e[o-1]]=s,s}function aR(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let s=0;for(;i.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+s),10);o>0;o--)n.pop();r+=s}else n.push(t[r]),r++}return e}const Ud={defaultProtocol:"http",events:null,format:lR,formatHref:lR,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function CS(t,e=null){let n=Object.assign({},Ud);t&&(n=Object.assign(n,t instanceof CS?t.o:t));const r=n.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}CS.prototype={o:Ud,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:Ud[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function lR(t){return t}function pj(t,e){this.t="token",this.v=t,this.tk=e}pj.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Ud.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),s=this.toFormattedString(t),o={},l=t.get("className",n,e),u=t.get("target",n,e),f=t.get("rel",n,e),h=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return o.href=r,l&&(o.class=l),u&&(o.target=u),f&&(o.rel=f),h&&Object.assign(o,h),{tagName:i,attributes:o,content:s,eventListeners:m}}};function mg(t,e){class n extends pj{constructor(i,s){super(i,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const HG=mg("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),cR=mg("text"),UG=mg("nl"),Vh=mg("url",{isLink:!0,toHref(t=Ud.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Hd&&t[1].t===Oa}}),Yr=t=>new mr(t);function FG({groups:t}){const e=t.domain.concat([xm,Sm,yo,km,Cm,Em,Tm,_m,Xr,bS,bd,Am,Rm,Mm,Ni,Om,xd,Nm]),n=[wm,Oa,xS,Mi,wS,bd,vd,SS,kS,um,dm,gd,yd,am,om,lm,cm,fm,hm,pm,mm,gm,ym,bm,vm],r=[xm,wm,Sm,km,Cm,Em,Tm,_m,Xr,gd,yd,bd,Am,Rm,Mm,vd,Ni,Om,xd,Nm],i=Yr(),s=be(i,xd);rt(s,r,s),rt(s,t.domain,s);const o=Yr(),l=Yr(),u=Yr();rt(i,t.domain,o),rt(i,t.scheme,l),rt(i,t.slashscheme,u),rt(o,r,s),rt(o,t.domain,o);const f=be(o,yo);be(s,yo,f),be(l,yo,f),be(u,yo,f);const h=be(s,Mi);rt(h,r,s),rt(h,t.domain,s);const m=Yr();rt(f,t.domain,m),rt(m,t.domain,m);const g=be(m,Mi);rt(g,t.domain,m);const b=Yr(HG);rt(g,t.tld,b),rt(g,t.utld,b),be(f,Hd,b);const x=be(m,Xr);be(x,Xr,x),rt(x,t.domain,m),rt(b,t.domain,m),be(b,Mi,g),be(b,Xr,x);const S=be(o,Xr),k=be(o,Mi);be(S,Xr,S),rt(S,t.domain,o),rt(k,r,s),rt(k,t.domain,o);const C=Yr(Vh);rt(k,t.tld,C),rt(k,t.utld,C),rt(C,t.domain,o),rt(C,r,s),be(C,Mi,k),be(C,Xr,S),be(C,yo,f);const _=be(C,Oa),M=Yr(Vh);rt(_,t.numeric,M);const R=Yr(Vh),A=Yr();rt(R,e,R),rt(R,n,A),rt(A,e,R),rt(A,n,A),be(C,Ni,R),be(M,Ni,R);const O=be(l,Oa),D=be(u,Oa),j=be(D,Ni),z=be(j,Ni);rt(l,t.domain,o),be(l,Mi,k),be(l,Xr,S),rt(u,t.domain,o),be(u,Mi,k),be(u,Xr,S),rt(O,t.domain,R),be(O,Ni,R),be(O,vd,R),rt(z,t.domain,R),rt(z,e,R),be(z,Ni,R);const q=[[gd,yd],[om,am],[lm,cm],[um,dm],[fm,hm],[pm,mm],[gm,ym],[bm,vm]];for(let Z=0;Z<q.length;Z++){const[G,ee]=q[Z],te=be(R,G);be(A,G,te);const fe=Yr(Vh);rt(te,e,fe);const B=Yr();rt(te,n,B),be(te,ee,R),rt(fe,e,fe),rt(fe,n,B),rt(B,e,fe),rt(B,n,B),be(fe,ee,R),be(B,ee,R)}return be(i,Hd,C),be(i,vS,UG),{start:i,tokens:fj}}function qG(t,e,n){let r=n.length,i=0,s=[],o=[];for(;i<r;){let l=t,u=null,f=null,h=0,m=null,g=-1;for(;i<r&&!(u=l.go(n[i].t));)o.push(n[i++]);for(;i<r&&(f=u||l.go(n[i].t));)u=null,l=f,l.accepts()?(g=0,m=l):g>=0&&g++,i++,h++;if(g<0)i-=h,i<r&&(o.push(n[i]),i++);else{o.length>0&&(s.push(Wv(cR,e,o)),o=[]),i-=g,h-=g;const b=m.t,x=n.slice(i-h,i);s.push(Wv(b,e,x))}}return o.length>0&&s.push(Wv(cR,e,o)),s}function Wv(t,e,n){const r=n[0].s,i=n[n.length-1].e,s=e.slice(r,i);return new t(s,n)}const GG=typeof console<"u"&&console&&console.warn||(()=>{}),WG="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Vt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function KG(){return mr.groups={},Vt.scanner=null,Vt.parser=null,Vt.tokenQueue=[],Vt.pluginQueue=[],Vt.customSchemes=[],Vt.initialized=!1,Vt}function uR(t,e=!1){if(Vt.initialized&&GG(`linkifyjs: already initialized - will not register custom scheme "${t}" ${WG}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
194
- 1. Must only contain digits, lowercase ASCII letters or "-"
195
- 2. Cannot start or end with "-"
196
- 3. "-" cannot repeat`);Vt.customSchemes.push([t,e])}function ZG(){Vt.scanner=BG(Vt.customSchemes);for(let t=0;t<Vt.tokenQueue.length;t++)Vt.tokenQueue[t][1]({scanner:Vt.scanner});Vt.parser=FG(Vt.scanner.tokens);for(let t=0;t<Vt.pluginQueue.length;t++)Vt.pluginQueue[t][1]({scanner:Vt.scanner,parser:Vt.parser});return Vt.initialized=!0,Vt}function ES(t){return Vt.initialized||ZG(),qG(Vt.parser.start,t,hj(Vt.scanner.start,t))}ES.scan=hj;function mj(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new CS(n),i=ES(t),s=[];for(let o=0;o<i.length;o++){const l=i[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}var TS="[\0-   ᠎ -\u2029  ]",YG=new RegExp(TS),XG=new RegExp(`${TS}$`),JG=new RegExp(TS,"g");function QG(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function eW(t){return new zt({key:new tn("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(f=>f.docChanged)&&!n.doc.eq(r.doc),s=e.some(f=>f.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,l=kI(n.doc,[...e]);if(dS(l).forEach(({newRange:f})=>{const h=Yq(r.doc,f,b=>b.isTextblock);let m,g;if(h.length>1)m=h[0],g=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(h.length){const b=r.doc.textBetween(f.from,f.to," "," ");if(!XG.test(b))return;m=h[0],g=r.doc.textBetween(m.pos,f.to,void 0," ")}if(m&&g){const b=g.split(YG).filter(Boolean);if(b.length<=0)return!1;const x=b[b.length-1],S=m.pos+g.lastIndexOf(x);if(!x)return!1;const k=ES(x).map(C=>C.toObject(t.defaultProtocol));if(!QG(k))return!1;k.filter(C=>C.isLink).map(C=>({...C,from:S+C.start+1,to:S+C.end+1})).filter(C=>r.schema.marks.code?!r.doc.rangeHasMark(C.from,C.to,r.schema.marks.code):!0).filter(C=>t.validate(C.value)).filter(C=>t.shouldAutoLink(C.value)).forEach(C=>{fS(C.from,C.to,r.doc).some(_=>_.mark.type===t.type)||o.addMark(C.from,C.to,t.type.create({href:C.href}))})}}),!!o.steps.length)return o}})}function tW(t){return new zt({key:new tn("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const u=r.target;if(!u)return!1;const f=t.editor.view.dom;o=u.closest("a"),o&&!f.contains(o)&&(o=null)}if(!o)return!1;let l=!1;if(t.enableClickSelection&&(l=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const u=NI(e.state,t.type.name),f=(i=o.href)!=null?i:u.href,h=(s=o.target)!=null?s:u.target;f&&(window.open(f,h),l=!0)}return l}}})}var nW=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,rW=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function gj(t,e){let n=0;for(let r=e-1;r>=0&&t[r]==="\\";r-=1)n+=1;return n%2===1}function iW(t,e){let n=0,r=0;for(;r<e;){if(t[r]!=="`"){r+=1;continue}if(n===0&&gj(t,r)){r+=1;continue}let i=0;for(;r<e&&t[r]==="`";)i+=1,r+=1;n===0?n=i:i===n&&(n=0)}return n>0}function yj(t,e,n){var r,i;const[,s,o]=e;return(e.index?t[e.index-1]:void 0)==="!"||gj(t,(r=e.index)!=null?r:0)||iW(t,(i=e.index)!=null?i:0)?!1:!!s.trim()&&n(o)}function bj(t){var e,n;const[r,i,s,,o,l,u]=t,f=(e=o??l)!=null?e:u;return{index:(n=t.index)!=null?n:0,text:r,replaceWith:i,data:{href:s,title:f||null,markdown:!0}}}function sW(t,e){return t.index<e.index+e.text.length&&e.index<t.index+t.text.length}function vj(t){var e,n,r;return{href:(e=t.data)==null?void 0:e.href,title:(r=(n=t.data)==null?void 0:n.title)!=null?r:null}}function oW(t){const e=Ga({find:n=>{const r=nW.exec(n);return!r||!yj(n,r,t.isAllowedHref)?null:bj(r)},type:t.type,getAttributes:vj});return new ff({find:e.find,handler:n=>{const r=e.handler(n);return r!==null&&n.state.tr.steps.length&&n.state.tr.setMeta("preventAutolink",!0),r}})}function aW(t){const e=Fo({find:n=>{var r,i;const s=[];for(const l of n.matchAll(rW))yj(n,l,t.isAllowedHref)&&s.push(bj(l));const o=((i=(r=t.findPlainUrls)==null?void 0:r.call(t,n))!=null?i:[]).filter(l=>!s.some(u=>sW(u,l)));return[...s,...o]},type:t.type,getAttributes:vj});return new zI({find:e.find,handler:n=>{var r;const i=e.handler(n);return i!==null&&n.state.tr.steps.length&&((r=n.match.data)!=null&&r.markdown)&&n.state.tr.setMeta("preventAutolink",!0),i}})}function lW(t){return new zt({key:new tn("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:i}=t,{state:s}=e,{selection:o}=s,{empty:l}=o;if(l)return!1;let u="";r.content.forEach(h=>{u+=h.textContent});const f=mj(u,{defaultProtocol:t.defaultProtocol}).find(h=>h.isLink&&h.value===u);return!u||!f||i!==void 0&&!i(f.value)?!1:t.editor.commands.setMark(t.type,{href:f.href})}}})}function hs(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(JG,"").match(new RegExp(`^(?:(?:${n.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}var cW=rl.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){uR(t);return}uR(t.scheme,t.optionalSlashes)})},onDestroy(){KG()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!hs(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const i=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){var t,e,n;return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:(t=this.options.HTMLAttributes.target)!=null?t:null},rel:{default:(e=this.options.HTMLAttributes.rel)!=null?e:null},class:{default:(n=this.options.HTMLAttributes.class)!=null?n:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!hs(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!hs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Pt(this.options.HTMLAttributes,t),0]:["a",Pt(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,i,s;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",l=(s=(i=t.attrs)==null?void 0:i.title)!=null?s:"",u=e.renderChildren(t);return l?`[${u}](${o} "${l}")`:`[${u}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!hs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!hs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addInputRules(){return this.options.markdownLinks?[oW({type:this.type,isAllowedHref:t=>this.options.isAllowedUri(t,{defaultValidate:e=>!!hs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){const t=e=>{const n=[];if(e){const{protocols:r,defaultProtocol:i}=this.options;mj(e).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:l=>!!hs(l,r),protocols:r,defaultProtocol:i})).forEach(o=>{this.options.shouldAutoLink(o.value)&&n.push({text:o.value,data:{href:o.href},index:o.start})})}return n};return this.options.markdownLinks?[aW({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:n=>!!hs(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:t})]:[Fo({find:t,type:this.type,getAttributes:e=>{var n;return{href:(n=e.data)==null?void 0:n.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(eW({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!hs(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(tW({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(lW({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),uW=Object.defineProperty,dW=(t,e)=>{for(var n in e)uW(t,n,{get:e[n],enumerable:!0})},fW="listItem",dR="textStyle",fR=/^\s*([-+*])\s$/,xj=Mn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Pt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
197
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(fW,this.editor.getAttributes(dR)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Oc({find:fR,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Oc({find:fR,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(dR),editor:this.editor})),[t]}}),hW=(t,e,n)=>{const{selection:r}=t;if(!r.empty)return null;const{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let s=-1;for(let b=i.depth;b>0;b-=1)if(i.node(b).type.name===e){s=b;break}if(s<0)return null;const o=i.node(s),l=i.index(s);if(l+1>=o.childCount)return null;const u=o.child(l+1);if(!n.includes(u.type.name))return null;const f=t.schema.nodes[e];let h=!1;if(u.forEach(b=>{b.type===f&&b.childCount>1&&(h=!0)}),!h)return null;const m=t.doc.resolve(i.after()).nodeAfter;if(!m||!n.includes(m.type.name))return null;const g=[];return m.forEach(b=>{g.push(b)}),g.length===0?null:{listItemDepth:s,nestedList:m,nestedListPos:i.after(),insertPos:i.after(s),items:g}},pW=(t,e,n,r)=>{const i=hW(t,n,r);if(!i)return!1;const{selection:s}=t,{nestedList:o,nestedListPos:l,insertPos:u,items:f}=i,h=t.tr;h.delete(l,l+o.nodeSize);const m=h.mapping.map(u);return h.insert(m,de.from(f)),h.setSelection(s.map(h.doc,h.mapping)),e&&e(h),!0},mW=(t,e,n)=>pW(t.state,t.view.dispatch,e,n),wj=(t,e)=>Ft.create({name:`${t}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const n=()=>mW(this.editor,t,e);return{Delete:n,"Mod-Delete":n}}}),Sj=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],Hh="abcdefghijklmnopqrstuvwxyz",gW="[a-zA-Z]{1,2}",kj=String.raw`\d+|[ivxlcdmIVXLCDM]+|${gW}`;function gg(t){let e=t,n="";for(const[r,i]of Sj)for(;e>=r;)n+=i,e-=r;return n}function _S(t){return gg(t).toUpperCase()}function Cj(t){const e=t.toLowerCase();let n=0,r=0;for(;n<e.length;){let i=!1;for(const[s,o]of Sj)if(e.startsWith(o,n)){r+=s,n+=o.length,i=!0;break}if(!i)return 0}return r}function yW(t){if(!/^[ivxlcdmIVXLCDM]+$/.test(t))return!1;const e=Cj(t);return e<=0?!1:(t===t.toLowerCase()?gg(e):_S(e))===t}function bW(t){const e=t.toLowerCase();if(e.length===1)return e.charCodeAt(0)-97+1;if(e.length===2){const n=e.charCodeAt(0)-97,r=e.charCodeAt(1)-97;return(n+1)*26+r+1}return 0}function Dm(t){if(t<=26)return Hh[t-1];const e=Math.floor((t-1)/26)-1,n=(t-1)%26;return e<0?Hh[n]:Hh[e]+Hh[n]}function yg(t){if(!(!t||/^\d+$/.test(t))){if(yW(t))return t===t.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(t))return"a";if(/^[A-Z]{1,2}$/.test(t))return"A"}}function AS(t){if(/^\d+$/.test(t))return parseInt(t,10);const e=yg(t);if(e==="i"||e==="I")return Cj(t);if(e==="a"||e==="A"){const r=bW(t);return r>0?r:1}const n=parseInt(t,10);return Number.isNaN(n)?1:n}function vW(t,e){if(t==="numeric")return String(e);switch(t){case"a":return Dm(e);case"A":return Dm(e).toUpperCase();case"i":return gg(e);case"I":return _S(e);default:return String(e)}}function xW(t){var e;if(t.length===0)return!1;const n=(e=yg(t[0]))!=null?e:"numeric",r=AS(t[0]);if(r<1)return!1;for(let i=0;i<t.length;i++){const s=vW(n,r+i);if(t[i]!==s)return!1}return!0}function wW(t){return{type:yg(t),start:AS(t)}}function SW(t){const{type:e,start:n}=wW(t),r={};return e&&(r.type=e),n!==1&&(r.start=n),r}function kW(t,e,n=". "){const r=e+1;if(!t||t==="1")return`${r}${n}`;switch(t){case"a":return`${Dm(r)}${n}`;case"A":return`${Dm(r).toUpperCase()}${n}`;case"i":return`${gg(r)}${n}`;case"I":return`${_S(r)}${n}`;default:return`${r}${n}`}}function CW(t){var e,n;const r=(e=t.tokens)==null?void 0:e[0];return!!(t.text&&((n=t.tokens)==null?void 0:n.length)===1&&r?.type==="list"&&r.ordered&&r.raw===t.text)}function EW(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}var Ej=Mn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Pt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;let i=[];if(t.tokens&&t.tokens.length>0){if(CW(t))return{type:"listItem",content:[{type:"paragraph",content:EW(t.text||"",e)}]};if(t.tokens.some(o=>o.type==="paragraph"))i=r(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(i=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const u=t.tokens.slice(1),f=r(u);i.push(...f)}}else i=r(t.tokens)}}return i.length===0&&(i=[{type:"paragraph",content:[]}]),{type:"listItem",content:i}},renderMarkdown:(t,e,n)=>mS(t,e,r=>{var i,s,o,l;if(r.parentType==="bulletList")return"- ";if(r.parentType==="orderedList"){const u=((s=(i=r.meta)==null?void 0:i.parentAttrs)==null?void 0:s.start)||1,f=(l=(o=r.meta)==null?void 0:o.parentAttrs)==null?void 0:l.type,h=u-1+(r.index||0);return kW(f,h,". ")}return"- "},n),addExtensions(){return[wj(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),TW={};dW(TW,{findListItemPos:()=>bg,getNextListDepth:()=>RS,handleBackspace:()=>Ax,handleDelete:()=>Rx,hasListBefore:()=>Tj,hasListItemAfter:()=>_W,hasListItemBefore:()=>AW,listItemHasSubList:()=>RW,nextListIsDeeper:()=>_j,nextListIsHigher:()=>Aj});var bg=(t,e)=>{const{$from:n}=e.selection,r=bn(t,e.schema);let i=null,s=n.depth,o=n.pos,l=null;for(;s>0&&l===null;)i=n.node(s),i.type===r?l=s:(s-=1,o-=1);return l===null?null:{$pos:e.doc.resolve(o),depth:l}},RS=(t,e)=>{const n=bg(t,e);if(!n)return!1;const[,r]=o9(e,t,n.$pos.pos+4);return r},Tj=(t,e,n)=>{const{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),s=t.doc.resolve(i).node();return!(!s||!n.includes(s.type.name))},Ax=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Uo(t.state,e)&&Tj(t.state,e,n)){const{$anchor:r}=t.state.selection,i=t.state.doc.resolve(r.before()-1),s=[];i.node().descendants((u,f)=>{u.type.name===e&&s.push({node:u,pos:f})});const o=s.at(-1);if(!o)return!1;const l=t.state.doc.resolve(i.start()+o.pos+1);return t.chain().cut({from:r.start()-1,to:r.end()+1},l.end()).joinForward().run()}return!Uo(t.state,e)||!u9(t.state)?!1:t.chain().liftListItem(e).run()},_j=(t,e)=>{const n=RS(t,e),r=bg(t,e);return!r||!n?!1:n>r.depth},Aj=(t,e)=>{const n=RS(t,e),r=bg(t,e);return!r||!n?!1:n<r.depth},Rx=(t,e)=>{if(!Uo(t.state,e)||!c9(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:_j(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():Aj(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},_W=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((n=i.nodeAfter)==null?void 0:n.type.name)!==t)},AW=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((n=i.nodeBefore)==null?void 0:n.type.name)!==t)},RW=(t,e,n)=>{if(!n)return!1;const r=bn(t,e.schema);let i=!1;return n.descendants(s=>{s.type===r&&(i=!0)}),i},Rj=Ft.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Rx(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Rx(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Ax(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Ax(t,n,r)&&(e=!0)}),e}}}}),Mx=new RegExp(`^(\\s*)(${kj})([.)])\\s+(.*)$`),MW=/^\s/,sd={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function NW(t){return Mx.test(t.trimStart())}function OW(t){const e=t.trimStart();return sd.bulletItem.test(e)||NW(e)||sd.heading.test(e)||sd.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||sd.codeFence.test(e)}function DW(t){return Object.values(sd).some(e=>e.test(t))}function IW(t){const e=[],n=[];let r=!1;return t.forEach(i=>{if(r){n.push(i);return}if(i.trim()===""){r=!0,n.push(i);return}if(e.length>0&&OW(i)){r=!0,n.push(i);return}e.push(i)}),{paragraphLines:e,blockLines:n}}function jW(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n],s=i.match(Mx);if(!s)break;const[,o,l,u,f]=s,h=o.length,m=parseInt(l,10),g=isNaN(m)?yg(l):void 0,b=isNaN(m)?AS(l):m,x=[f];let S=n+1;const k=[i];let C=!1;for(;S<t.length;){const _=t[S];if(_.match(Mx))break;if(_.trim()==="")k.push(_),x.push(""),C=!0,S+=1;else if(_.match(MW)){const R=_.length-_.trimStart().length,A=h+l.length+1;k.push(_),x.push(_.slice(Math.min(R,A))),S+=1}else{if(C||DW(_))break;k.push(_),x.push(_),S+=1}}e.push({indent:h,number:b,type:g,content:x.join(`
198
- `).trim(),contentLines:x,raw:k.join(`
199
- `)}),r=S,n=S}return[e,r]}var LW=new RegExp(`^(${kj})([.)])\\s+(.+)$`);function PW(t){const e=t.split(`
200
- `).filter(s=>s.trim().length>0);if(e.length===0)return null;const n=[];for(const s of e){const o=s.trim().match(LW);if(!o)return null;n.push({marker:o[1],content:o[3]})}const r=n.map(s=>s.marker);return xW(r)?{type:"orderedList",attrs:SW(n[0].marker),content:n.map(s=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:s.content}]}]}))}:null}function Mj(t,e,n){const r=[];let i=0;for(;i<t.length;){const s=t[i];if(s.indent===e){const{paragraphLines:o,blockLines:l}=IW(s.contentLines),u=o.join(`
201
- `).trim(),f=[];u&&f.push({type:"paragraph",raw:u,tokens:n.inlineTokens(u)});const h=l.join(`
202
- `).trim();if(h){const b=n.blockTokens(h);f.push(...b)}let m=i+1;const g=[];for(;m<t.length&&t[m].indent>e;)g.push(t[m]),m+=1;if(g.length>0){const b=Math.min(...g.map(S=>S.indent)),x=Mj(g,b,n);f.push({type:"list",ordered:!0,start:g[0].number,typeMarker:g[0].type,items:x,raw:g.map(S=>S.raw).join(`
203
- `)})}r.push({type:"list_item",raw:s.raw,tokens:f}),i=m}else i+=1}return r}function zW(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=e.parseChildren([i]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var $W="listItem",hR="textStyle",pR=/^(\d+)\.\s$/;function mR(t){const e=t.match(/list-style-type\s*:\s*([^;]+)/i);if(!e)return null;switch(e[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}var Nj=Mn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>{const e=t.getAttribute("type");if(e)return e;const n=t.getAttribute("style");if(n){const i=mR(n);if(i)return i}const r=t.querySelector("li");if(r){const i=r.getAttribute("style");if(i){const s=mR(i);if(s)return s}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,type:n,...r}=t,i=Pt(this.options.HTMLAttributes,r);return e!==1&&(i.start=e),n&&n!=="1"&&(i.type=n),["ol",i,0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.typeMarker,i=t.items?zW(t.items,e):[],s={};return n!==1&&(s.start=n),r&&(s.type=r),Object.keys(s).length>0?{type:"orderedList",attrs:s,content:i}:{type:"orderedList",content:i}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
204
- `):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(t,e,n)=>{var r,i;const s=t.split(`
205
- `),[o,l]=jW(s);if(o.length===0)return;const u=Mj(o,o[0].indent,n);if(u.length===0)return;const f=((r=o[0])==null?void 0:r.number)||1,h=(i=o[0])==null?void 0:i.type;return{type:"list",ordered:!0,start:f,typeMarker:h,items:u,raw:s.slice(0,l).join(`
206
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes($W,this.editor.getAttributes(hR)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new zt({props:{handlePaste:(t,e)=>{var n,r;const i=(n=e.clipboardData)==null?void 0:n.getData("text/html");if(i?.trim())return!1;const s=(r=e.clipboardData)==null?void 0:r.getData("text/plain");if(!s)return!1;const o=PW(s);if(!o)return!1;try{const l=t.state.schema.nodeFromJSON(o),u=t.state.tr.replaceSelectionWith(l);return t.dispatch(u),!0}catch{return!1}}}})]},addInputRules(){const t=(n,r)=>(!r.attrs.type||r.attrs.type==="1")&&r.childCount+r.attrs.start===+n[1];let e=Oc({find:pR,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:t});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Oc({find:pR,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:n=>({start:+n[1],...this.editor.getAttributes(hR)}),joinPredicate:t,editor:this.editor})),[e]}}),BW=/^\s*(\[([( |x])?\])\s$/,VW=Mn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Pt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const i=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return mS(t,e,i)},addExtensions(){return this.options.nested?[wj(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),u=document.createElement("div"),f=m=>{var g,b;l.ariaLabel=((b=(g=this.options.a11y)==null?void 0:g.checkboxLabel)==null?void 0:b.call(g,m,l.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};f(t),s.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",m=>m.preventDefault()),l.addEventListener("change",m=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:g}=m.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:b})=>{const x=n();if(typeof x!="number")return!1;const S=b.doc.nodeAt(x);return b.setNodeMarkup(x,void 0,{...S?.attrs,checked:g}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,g)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,g])=>{i.setAttribute(m,g)}),i.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,s.append(l,o),i.append(s,u),Object.entries(e).forEach(([m,g])=>{i.setAttribute(m,g)});let h=new Set(Object.keys(e));return{dom:i,contentDOM:u,update:m=>{if(m.type!==this.type)return!1;i.dataset.checked=m.attrs.checked,l.checked=m.attrs.checked,f(m);const g=r.extensionManager.attributes,b=Mc(m,g),x=new Set(Object.keys(b)),S=this.options.HTMLAttributes;return h.forEach(k=>{x.has(k)||(k in S?i.setAttribute(k,S[k]):i.removeAttribute(k))}),Object.entries(b).forEach(([k,C])=>{C==null?k in S?i.setAttribute(k,S[k]):i.removeAttribute(k):i.setAttribute(k,C)}),h=x,!0}}}},addInputRules(){return[Oc({find:BW,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),HW=Mn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Pt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
207
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=s=>{const o=bx(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,u)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:u}),customNestedParser:r},n);if(o){const l={type:"taskList",raw:o.raw,items:o.items},u=s.slice(o.raw.length);return u.trim()?[l,...n.blockTokens(u)]:[l]}return n.blockTokens(s)},i=bx(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:n.inlineTokens(s.mainContent),nestedTokens:o}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ft.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(xj.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Ej.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Rj.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Nj.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(VW.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(HW.configure(this.options.taskList)),t}});var Uh="&nbsp;",Kv=" ",UW=Mn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Pt(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===Uh||n[0].text===Uh||n[0].raw===Kv||n[0].text===Kv)&&r.length===1&&r[0].type==="text"&&(r[0].text===Uh||r[0].text===Kv)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{var r,i;if(!t)return"";const s=Array.isArray(t.content)?t.content:[];if(s.length===0){const o=Array.isArray((r=n?.previousNode)==null?void 0:r.content)?n.previousNode.content:[];return((i=n?.previousNode)==null?void 0:i.type)==="paragraph"&&o.length===0?Uh:""}return e.renderChildren(s)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),FW=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,qW=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,GW=rl.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Pt(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ga({find:FW,type:this.type})]},addPasteRules(){return[Fo({find:qW,type:this.type})]}}),WW=Mn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),KW=rl.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Pt(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function ZW(t={}){return new zt({view(e){return new YW(e,t)}})}class YW{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){if(this.cursorPos!=null&&n.doc!=e.state.doc)if(this.lastDragEvent){let r=this.computeTarget(this.lastDragEvent);r==this.cursorPos?this.updateOverlay():this.setCursor(r)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,l=s.height/i.offsetHeight;if(n){let m=e.nodeBefore,g=e.nodeAfter;if(m||g){let b=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(b){let x=b.getBoundingClientRect(),S=m?x.bottom:x.top;m&&g&&(S=(S+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let k=this.width/2*l;r={left:x.left,right:x.right,top:S-k,bottom:S+k}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*o;r={left:m.left-g,right:m.left+g,top:m.top,bottom:m.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let f,h;if(!u||u==document.body&&getComputedStyle(u).position=="static")f=-pageXOffset,h=-pageYOffset;else{let m=u.getBoundingClientRect(),g=m.width/u.offsetWidth,b=m.height/u.offsetHeight;f=m.left-u.scrollLeft*g,h=m.top-u.scrollTop*b}this.element.style.left=(r.left-f)/o+"px",this.element.style.top=(r.top-h)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(!n||s)return null;let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=fD(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}return o}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let n=this.computeTarget(e);n!=null&&(this.setCursor(n),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Qt extends Ke{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Qt.valid(r)?new Qt(r):Ke.near(r)}content(){return Ee.empty}eq(e){return e instanceof Qt&&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 Qt(e.resolve(n.pos))}getBookmark(){return new MS(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!XW(e)||!JW(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&&Qt.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(n>0?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=n;let u=e.doc.resolve(i);if(Qt.valid(u))return u}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!He.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let l=e.doc.resolve(i);if(Qt.valid(l))return l}return null}}}Qt.prototype.visible=!1;Qt.findFrom=Qt.findGapCursorFrom;Ke.jsonID("gapcursor",Qt);class MS{constructor(e){this.pos=e}map(e){return new MS(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Qt.valid(n)?new Qt(n):Ke.near(n)}}function Oj(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function XW(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||Oj(i.type))return!0;if(i.inlineContent)return!1}}return!0}function JW(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||Oj(i.type))return!0;if(i.inlineContent)return!1}}return!0}function QW(){return new zt({props:{decorations:r7,createSelectionBetween(t,e,n){return e.pos==n.pos&&Qt.valid(n)?new Qt(n):null},handleClick:t7,handleKeyDown:e7,handleDOMEvents:{beforeinput:n7}}})}const e7=sS({ArrowLeft:Fh("horiz",-1),ArrowRight:Fh("horiz",1),ArrowUp:Fh("vert",-1),ArrowDown:Fh("vert",1)});function Fh(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,l=e>0?o.$to:o.$from,u=o.empty;if(o instanceof $e){if(!s.endOfTextblock(n)||l.depth==0)return!1;u=!1,l=r.doc.resolve(e>0?l.after():l.before())}let f=Qt.findGapCursorFrom(l,e,u);return f?(i&&i(r.tr.setSelection(new Qt(f))),!0):!1}}function t7(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Qt.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&He.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Qt(r))),!0)}function n7(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Qt))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 Ee(i,0,0));return s.setSelection($e.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function r7(t){if(!(t.selection instanceof Qt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Et.create(t.doc,[Tn.widget(t.selection.head,e,{key:"gapcursor"})])}var Im=200,An=function(){};An.prototype.append=function(e){return e.length?(e=An.from(e),!this.length&&e||e.length<Im&&this.leafAppend(e)||this.length<Im&&e.leafPrepend(this)||this.appendInner(e)):this};An.prototype.prepend=function(e){return e.length?An.from(e).append(this):this};An.prototype.appendInner=function(e){return new i7(this,e)};An.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?An.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};An.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};An.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)};An.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};An.from=function(e){return e instanceof An?e:e&&e.length?new Dj(e):An.empty};var Dj=(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,l){for(var u=s;u<o;u++)if(i(this.values[u],l+u)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,l){for(var u=s-1;u>=o;u--)if(i(this.values[u],l+u)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Im)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Im)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})(An);An.empty=new Dj([]);var i7=(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 l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(r,Math.min(i,l),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})(An);const s7=500;class gi{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,l,u,f=[],h=[];return this.items.forEach((m,g)=>{if(!m.step){i||(i=this.remapping(r,g+1),s=i.maps.length),s--,h.push(m);return}if(i){h.push(new Oi(m.map));let b=m.step.map(i.slice(s)),x;b&&o.maybeStep(b).doc&&(x=o.mapping.maps[o.mapping.maps.length-1],f.push(new Oi(x,void 0,void 0,f.length+h.length))),s--,x&&i.appendMap(x,s)}else o.maybeStep(m.step);if(m.selection)return l=i?m.selection.map(i.slice(s)):m.selection,u=new gi(this.items.slice(0,r).append(h.reverse().concat(f)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:o,selection:l}}addTransform(e,n,r,i){let s=[],o=this.eventCount,l=this.items,u=!i&&l.length?l.get(l.length-1):null;for(let h=0;h<e.steps.length;h++){let m=e.steps[h].invert(e.docs[h]),g=new Oi(e.mapping.maps[h],m,n),b;(b=u&&u.merge(g))&&(g=b,h?s.pop():l=l.slice(0,l.length-1)),s.push(g),n&&(o++,n=void 0),i||(u=g)}let f=o-r.depth;return f>a7&&(l=o7(l,f),o-=f),new gi(l.append(s),o)}remapping(e,n){let r=new Pd;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 gi(this.items.append(e.map(n=>new Oi(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,l=this.eventCount;this.items.forEach(g=>{g.selection&&l--},i);let u=n;this.items.forEach(g=>{let b=s.getMirror(--u);if(b==null)return;o=Math.min(o,b);let x=s.maps[b];if(g.step){let S=e.steps[b].invert(e.docs[b]),k=g.selection&&g.selection.map(s.slice(u+1,b));k&&l++,r.push(new Oi(x,S,k))}else r.push(new Oi(x))},i);let f=[];for(let g=n;g<o;g++)f.push(new Oi(s.maps[g]));let h=this.items.slice(0,i).append(f).append(r),m=new gi(h,l);return m.emptyItemCount()>s7&&(m=m.compress(this.items.length-r.length)),m}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,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let u=o.step.map(n.slice(r)),f=u&&u.getMap();if(r--,f&&n.appendMap(f,r),u){let h=o.selection&&o.selection.map(n.slice(r));h&&s++;let m=new Oi(f.invert(),u,h),g,b=i.length-1;(g=i.length&&i[b].merge(m))?i[b]=g:i.push(m)}}else o.map&&r--},this.items.length,0),new gi(An.from(i.reverse()),s)}}gi.empty=new gi(An.empty,0);function o7(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class Oi{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 Oi(n.getMap().invert(),n,this.selection)}}}class bo{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const a7=20;function l7(t,e,n,r){let i=n.getMeta(Pa),s;if(i)return i.historyState;n.getMeta(d7)&&(t=new bo(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Pa))return o.getMeta(Pa).redo?new bo(t.done.addTransform(n,void 0,r,wp(e)),t.undone,gR(n.mapping.maps),t.prevTime,t.prevComposition):new bo(t.done,t.undone.addTransform(n,void 0,r,wp(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),u=t.prevTime==0||!o&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!c7(n,t.prevRanges)),f=o?Zv(t.prevRanges,n.mapping):gR(n.mapping.maps);return new bo(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,wp(e)),gi.empty,f,n.time,l??t.prevComposition)}else return(s=n.getMeta("rebased"))?new bo(t.done.rebased(n,s),t.undone.rebased(n,s),Zv(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new bo(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Zv(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function c7(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 gR(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 Zv(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 u7(t,e,n){let r=wp(e),i=Pa.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),l=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),u=new bo(n?l:s.remaining,n?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(Pa,{redo:n,historyState:u})}let Yv=!1,yR=null;function wp(t){let e=t.plugins;if(yR!=e){Yv=!1,yR=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Yv=!0;break}}return Yv}const Pa=new tn("history"),d7=new tn("closeHistory");function f7(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new zt({key:Pa,state:{init(){return new bo(gi.empty,gi.empty,null,0,-1)},apply(e,n,r){return l7(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?jj:r=="historyRedo"?Lj:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function Ij(t,e){return(n,r)=>{let i=Pa.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=u7(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const jj=Ij(!1,!0),Lj=Ij(!0,!0);Ft.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new zt({key:new tn("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit,s=this.options.autoTrim;if(i==null||i===0||s===!1){t=!0;return}const o=this.storage.characters({node:r.doc});if(o>i){const l=o-i,u=0,f=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const h=r.tr.deleteRange(u,f);return t=!0,h}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:n.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,u=s-r,f=l-u,h=l;return e.deleteRange(f,h),!(this.storage.characters({node:e.doc})>r)}})]}});var h7=Ft.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[ZW(this.options)]}});Ft.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new zt({key:new tn("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!n||!r)return Et.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((u,f)=>{if(u.isText)return;if(!(i>=f&&i<=f+u.nodeSize-1))return!1;o+=1});let l=0;return t.descendants((u,f)=>{if(u.isText||!(i>=f&&i<=f+u.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&o-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";s.push(Tn.node(f,f+u.nodeSize,{class:this.options.className}))}),Et.create(t,s)}}})]}});var p7=Ft.create({name:"gapCursor",addProseMirrorPlugins(){return[QW()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=yt(De(t,"allowGapCursor",n)))!=null?e:null}}}),Pj="placeholder",bR=new tn("tiptap__placeholder");function zj(t){const{editor:e,placeholder:n,dataAttribute:r,pos:i,node:s,isEmptyDoc:o,hasAnchor:l,classes:{emptyNode:u,emptyEditor:f}}=t,h=[u];return o&&h.push(f),Tn.node(i,i+s.nodeSize,{class:h.join(" "),[r]:typeof n=="function"?n({editor:e,node:s,pos:i,hasAnchor:l}):n})}function $j(t,e){return typeof t=="function"?t(e):t}function Bj({editor:t,options:e,dataAttribute:n,doc:r,selection:i,from:s,to:o}){const{anchor:l}=i,u=[],f=t.isEmpty;return r.nodesBetween(s,o,(h,m)=>{const g=l>=m&&l<=m+h.nodeSize,b=!h.isLeaf&&df(h);return h.type.isTextblock&&(g||!e.showOnlyCurrent)&&b&&u.push(zj({editor:t,isEmptyDoc:f,dataAttribute:n,hasAnchor:g,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:$j(e.emptyNodeClass,{editor:t,node:h,pos:m,hasAnchor:g})},node:h,pos:m})),e.includeChildren}),u}function Vj({editor:t,options:e,dataAttribute:n,doc:r,selection:i}){if(!(t.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:o}=i,l=[],u=t.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const h=r.resolve(o),m=h.depth>0?h.node(1):h.nodeAfter,g=h.depth>0?h.before(1):o;if(m&&m.type.isTextblock&&df(m)){const b=o>=g&&o<=g+m.nodeSize;l.push(zj({editor:t,isEmptyDoc:u,dataAttribute:n,hasAnchor:b,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:$j(e.emptyNodeClass,{editor:t,node:m,pos:g,hasAnchor:b})},node:m,pos:g}))}}else l.push(...Bj({editor:t,options:e,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return Et.create(r,l)}function wd(t,e){var n;const r=t.resolve(e);if(r.depth===0){const o=(n=r.nodeAfter)!=null?n:r.nodeBefore;if(!o)return{from:e,to:e};const l=r.nodeAfter?e:e-o.nodeSize;return{from:l,to:l+o.nodeSize}}const i=r.before(1),s=r.node(1);return{from:i,to:i+s.nodeSize}}function Sd(t,e){return{from:Math.max(0,e.from-1),to:Math.min(t.content.size,e.to-1)}}function m7(t,e,n){const r=[];return t.forEach((i,s)=>{const o=s,l=o+i.nodeSize,u=o+1,f=l+1;u<n&&f>e&&r.push({from:o,to:l})}),r}function g7(t){if(t.length===0)return[];const e=[...t].sort((r,i)=>r.from-i.from),n=[{...e[0]}];for(let r=1;r<e.length;r+=1){const i=n[n.length-1],s=e[r];s.from<=i.to?i.to=Math.max(i.to,s.to):n.push({...s})}return n}function y7(t,e){const n=m7(t,e.from,e.to);return n.push(Sd(t,wd(t,e.from))),e.to>e.from?n.push(Sd(t,wd(t,Math.min(e.to,t.content.size+1)-1))):e.from<t.content.size+1&&n.push(Sd(t,wd(t,Math.min(e.from+1,t.content.size)))),n}function b7(t,e,n){const r=[];if(t.docChanged){const i=dS(t);for(const s of i)r.push(...y7(n.doc,s.newRange))}return t.selectionSet&&(r.push(Sd(n.doc,wd(n.doc,t.mapping.map(e.selection.anchor)))),r.push(Sd(n.doc,wd(n.doc,n.selection.anchor)))),g7(r)}function v7(t,e,n){const r=Math.max(0,Math.min(t,n.content.size)),i=Math.max(r,Math.min(e,n.content.size));return{from:r,to:i}}function x7({decorations:t,ranges:e,editor:n,options:r,dataAttribute:i,doc:s,selection:o}){let l=t;for(const u of e){const{from:f,to:h}=v7(u.from,u.to,s),m=l.find(f,h).filter(b=>b.from>=f&&b.to<=h);m.length&&(l=l.remove(m));const g=Bj({editor:n,options:r,dataAttribute:i,doc:s,selection:o,from:f,to:h});g.length&&(l=l.add(s,g))}return l}function w7({editor:t,options:e,dataAttribute:n}){return{init(r,i){const s=Vj({editor:t,options:e,dataAttribute:n,doc:i.doc,selection:i.selection});return s??Et.empty},apply(r,i,s,o){if(!r.docChanged&&!r.selectionSet)return i;const l=i.map(r.mapping,r.doc),u=b7(r,s,o);return x7({decorations:l,ranges:u,editor:t,options:e,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function S7(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function k7({editor:t,options:e}){const n=e.dataAttribute?`data-${S7(e.dataAttribute)}`:`data-${Pj}`,r=e.showOnlyCurrent&&!e.includeChildren;return new zt({key:bR,...r?{}:{state:w7({editor:t,options:e,dataAttribute:n})},props:{decorations:r?({doc:i,selection:s})=>Vj({editor:t,options:e,dataAttribute:n,doc:i,selection:s}):i=>{var s;return e.showOnlyWhenEditable&&!t.isEditable?Et.empty:(s=bR.getState(i))!=null?s:Et.empty}}})}var C7=Ft.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Pj,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[k7({editor:this.editor,options:this.options})]}});function Nx(t,e){return!t.selection.empty&&!OI(t.selection)&&e.isEditable}function E7(t,e){return Nx(t,e)&&!e.isFocused&&!e.view.dragging}function T7(){var t;(t=window.getSelection())==null||t.removeAllRanges()}function _7(t){t.focus()}Ft.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new zt({key:new tn("selection"),props:{decorations(n){return E7(n,t)?Et.create(n.doc,[Tn.inline(n.selection.from,n.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(n){return Nx(n.state,t)&&T7(),!1},focus(n){return Nx(n.state,t)&&requestAnimationFrame(()=>{!t.isDestroyed&&n.hasFocus()&&_7(n)}),!1}}}})]}});var A7="skipTrailingNode";function vR({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var R7=Ft.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new tn(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new zt({key:e,appendTransaction:(i,s,o)=>{const{doc:l,tr:u,schema:f}=o,h=e.getState(o),m=l.content.size,g=f.nodes[n];if(!i.some(b=>b.getMeta(A7))&&h)return u.insert(m,g.create())},state:{init:(i,s)=>{const o=s.tr.doc.lastChild;return!vR({node:o,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const o=i.doc.lastChild;return!vR({node:o,types:r})}}})]}}),M7=Ft.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>jj(t,e),redo:()=>({state:t,dispatch:e})=>Lj(t,e)}},addProseMirrorPlugins(){return[f7(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),N7=Ft.create({name:"starterKit",addExtensions(){var t,e,n,r;const i=[];return this.options.bold!==!1&&i.push(gG.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(dG.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(xj.configure(this.options.bulletList)),this.options.code!==!1&&i.push(vG.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(SG.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(kG.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(h7.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(p7.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(CG.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(EG.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(M7.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(TG.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(NG.configure(this.options.italic)),this.options.listItem!==!1&&i.push(Ej.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(Rj.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&i.push(cW.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(Nj.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(UW.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(GW.configure(this.options.strike)),this.options.text!==!1&&i.push(WW.configure(this.options.text)),this.options.underline!==!1&&i.push(KW.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&i.push(R7.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),O7=N7;function NS(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var sl=NS();function Hj(t){sl=t}var Ea={exec:()=>null};function dt(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(nr.caret,"$1"),n=n.replace(i,o),r},getRegex:()=>new RegExp(n,e)};return r}var D7=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),nr={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},I7=/^(?:[ \t]*(?:\n|$))+/,j7=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,L7=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hf=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,P7=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,OS=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Uj=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Fj=dt(Uj).replace(/bull/g,OS).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),z7=dt(Uj).replace(/bull/g,OS).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),DS=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,$7=/^[^\n]+/,IS=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,B7=dt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",IS).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),V7=dt(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,OS).getRegex(),vg="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",jS=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,H7=dt("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",jS).replace("tag",vg).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),qj=dt(DS).replace("hr",hf).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",vg).getRegex(),U7=dt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",qj).getRegex(),LS={blockquote:U7,code:j7,def:B7,fences:L7,heading:P7,hr:hf,html:H7,lheading:Fj,list:V7,newline:I7,paragraph:qj,table:Ea,text:$7},xR=dt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",hf).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",vg).getRegex(),F7={...LS,lheading:z7,table:xR,paragraph:dt(DS).replace("hr",hf).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",xR).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",vg).getRegex()},q7={...LS,html:dt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",jS).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ea,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:dt(DS).replace("hr",hf).replace("heading",` *#{1,6} *[^
208
- ]`).replace("lheading",Fj).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},G7=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,W7=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Gj=/^( {2,}|\\)\n(?!\s*$)/,K7=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Hc=/[\p{P}\p{S}]/u,xg=/[\s\p{P}\p{S}]/u,PS=/[^\s\p{P}\p{S}]/u,Z7=dt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,xg).getRegex(),Wj=/(?!~)[\p{P}\p{S}]/u,Y7=/(?!~)[\s\p{P}\p{S}]/u,X7=/(?:[^\s\p{P}\p{S}]|~)/u,J7=dt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",D7?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Kj=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Q7=dt(Kj,"u").replace(/punct/g,Hc).getRegex(),eK=dt(Kj,"u").replace(/punct/g,Wj).getRegex(),Zj="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",tK=dt(Zj,"gu").replace(/notPunctSpace/g,PS).replace(/punctSpace/g,xg).replace(/punct/g,Hc).getRegex(),nK=dt(Zj,"gu").replace(/notPunctSpace/g,X7).replace(/punctSpace/g,Y7).replace(/punct/g,Wj).getRegex(),rK=dt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,PS).replace(/punctSpace/g,xg).replace(/punct/g,Hc).getRegex(),iK=dt(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Hc).getRegex(),sK="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",oK=dt(sK,"gu").replace(/notPunctSpace/g,PS).replace(/punctSpace/g,xg).replace(/punct/g,Hc).getRegex(),aK=dt(/\\(punct)/,"gu").replace(/punct/g,Hc).getRegex(),lK=dt(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),cK=dt(jS).replace("(?:-->|$)","-->").getRegex(),uK=dt("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",cK).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),jm=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,dK=dt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",jm).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Yj=dt(/^!?\[(label)\]\[(ref)\]/).replace("label",jm).replace("ref",IS).getRegex(),Xj=dt(/^!?\[(ref)\](?:\[\])?/).replace("ref",IS).getRegex(),fK=dt("reflink|nolink(?!\\()","g").replace("reflink",Yj).replace("nolink",Xj).getRegex(),wR=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,zS={_backpedal:Ea,anyPunctuation:aK,autolink:lK,blockSkip:J7,br:Gj,code:W7,del:Ea,delLDelim:Ea,delRDelim:Ea,emStrongLDelim:Q7,emStrongRDelimAst:tK,emStrongRDelimUnd:rK,escape:G7,link:dK,nolink:Xj,punctuation:Z7,reflink:Yj,reflinkSearch:fK,tag:uK,text:K7,url:Ea},hK={...zS,link:dt(/^!?\[(label)\]\((.*?)\)/).replace("label",jm).getRegex(),reflink:dt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",jm).getRegex()},Ox={...zS,emStrongRDelimAst:nK,emStrongLDelim:eK,delLDelim:iK,delRDelim:oK,url:dt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",wR).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:dt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",wR).getRegex()},pK={...Ox,br:dt(Gj).replace("{2,}","*").getRegex(),text:dt(Ox.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},qh={normal:LS,gfm:F7,pedantic:q7},Wu={normal:zS,gfm:Ox,breaks:pK,pedantic:hK},mK={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},SR=t=>mK[t];function Ri(t,e){if(e){if(nr.escapeTest.test(t))return t.replace(nr.escapeReplace,SR)}else if(nr.escapeTestNoEncode.test(t))return t.replace(nr.escapeReplaceNoEncode,SR);return t}function kR(t){try{t=encodeURI(t).replace(nr.percentDecode,"%")}catch{return null}return t}function CR(t,e){let n=t.replace(nr.findPipe,(s,o,l)=>{let u=!1,f=o;for(;--f>=0&&l[f]==="\\";)u=!u;return u?"|":" |"}),r=n.split(nr.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(nr.slashPipe,"|");return r}function Ku(t,e,n){let r=t.length;if(r===0)return"";let i=0;for(;i<r&&t.charAt(r-i-1)===e;)i++;return t.slice(0,r-i)}function gK(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function yK(t,e=0){let n=e,r="";for(let i of t)if(i===" "){let s=4-n%4;r+=" ".repeat(s),n+=s}else r+=i,n++;return r}function ER(t,e,n,r,i){let s=e.href,o=e.title||null,l=t[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let u={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:o,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,u}function bK(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(`
209
- `).map(s=>{let o=s.match(n.other.beginningSpace);if(o===null)return s;let[l]=o;return l.length>=i.length?s.slice(i.length):s}).join(`
210
- `)}var Lm=class{options;rules;lexer;constructor(t){this.options=t||sl}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Ku(n,`
211
- `)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=bK(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let r=Ku(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:Ku(e[0],`
212
- `)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=Ku(e[0],`
213
- `).split(`
214
- `),r="",i="",s=[];for(;n.length>0;){let o=!1,l=[],u;for(u=0;u<n.length;u++)if(this.rules.other.blockquoteStart.test(n[u]))l.push(n[u]),o=!0;else if(!o)l.push(n[u]);else break;n=n.slice(u);let f=l.join(`
215
- `),h=f.replace(this.rules.other.blockquoteSetextReplace,`
216
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
217
- ${f}`:f,i=i?`${i}
218
- ${h}`:h;let m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,s,!0),this.lexer.state.top=m,n.length===0)break;let g=s.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){let b=g,x=b.raw+`
219
- `+n.join(`
220
- `),S=this.blockquote(x);s[s.length-1]=S,r=r.substring(0,r.length-b.raw.length)+S.raw,i=i.substring(0,i.length-b.text.length)+S.text;break}else if(g?.type==="list"){let b=g,x=b.raw+`
221
- `+n.join(`
222
- `),S=this.list(x);s[s.length-1]=S,r=r.substring(0,r.length-g.raw.length)+S.raw,i=i.substring(0,i.length-b.raw.length)+S.raw,n=x.substring(s.at(-1).raw.length).split(`
223
- `);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim(),r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let s=this.rules.other.listItemRegex(n),o=!1;for(;t;){let u=!1,f="",h="";if(!(e=s.exec(t))||this.rules.block.hr.test(t))break;f=e[0],t=t.substring(f.length);let m=yK(e[2].split(`
224
- `,1)[0],e[1].length),g=t.split(`
225
- `,1)[0],b=!m.trim(),x=0;if(this.options.pedantic?(x=2,h=m.trimStart()):b?x=e[1].length+1:(x=m.search(this.rules.other.nonSpaceChar),x=x>4?1:x,h=m.slice(x),x+=e[1].length),b&&this.rules.other.blankLine.test(g)&&(f+=g+`
226
- `,t=t.substring(g.length+1),u=!0),!u){let S=this.rules.other.nextBulletRegex(x),k=this.rules.other.hrRegex(x),C=this.rules.other.fencesBeginRegex(x),_=this.rules.other.headingBeginRegex(x),M=this.rules.other.htmlBeginRegex(x),R=this.rules.other.blockquoteBeginRegex(x);for(;t;){let A=t.split(`
227
- `,1)[0],O;if(g=A,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),O=g):O=g.replace(this.rules.other.tabCharGlobal," "),C.test(g)||_.test(g)||M.test(g)||R.test(g)||S.test(g)||k.test(g))break;if(O.search(this.rules.other.nonSpaceChar)>=x||!g.trim())h+=`
228
- `+O.slice(x);else{if(b||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||C.test(m)||_.test(m)||k.test(m))break;h+=`
229
- `+g}b=!g.trim(),f+=A+`
230
- `,t=t.substring(A.length+1),m=O.slice(x)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(o=!0)),i.items.push({type:"list_item",raw:f,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),i.raw+=f}let l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let u of i.items){if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),u.task){if(u.text=u.text.replace(this.rules.other.listReplaceTask,""),u.tokens[0]?.type==="text"||u.tokens[0]?.type==="paragraph"){u.tokens[0].raw=u.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),u.tokens[0].text=u.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}}let f=this.rules.other.listTaskCheckbox.exec(u.raw);if(f){let h={type:"checkbox",raw:f[0]+" ",checked:f[0]!=="[ ]"};u.checked=h.checked,i.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=h.raw+u.tokens[0].raw,u.tokens[0].text=h.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(h)):u.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):u.tokens.unshift(h)}}if(!i.loose){let f=u.tokens.filter(m=>m.type==="space"),h=f.length>0&&f.some(m=>this.rules.other.anyLine.test(m.raw));i.loose=h}}if(i.loose)for(let u of i.items){u.loose=!0;for(let f of u.tokens)f.type==="text"&&(f.type="paragraph")}return i}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:r,title:i}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=CR(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
231
- `):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let o of r)this.rules.other.tableAlignRight.test(o)?s.align.push("right"):this.rules.other.tableAlignCenter.test(o)?s.align.push("center"):this.rules.other.tableAlignLeft.test(o)?s.align.push("left"):s.align.push(null);for(let o=0;o<n.length;o++)s.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:s.align[o]});for(let o of i)s.rows.push(CR(o,s.header.length).map((l,u)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:s.align[u]})));return s}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let n=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===`
232
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let s=Ku(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=gK(e[2],"()");if(s===-2)return;if(s>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),ER(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[r.toLowerCase()];if(!i){let s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return ER(n,i,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,s,o,l=i,u=0,f=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,e=e.slice(-1*t.length+i);(r=f.exec(e))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(o=[...s].length,r[3]||r[4]){l+=o;continue}else if((r[5]||r[6])&&i%3&&!((i+o)%3)){u+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+u);let h=[...r[0]][0].length,m=t.slice(0,i+r.index+h+o);if(Math.min(i,o)%2){let b=m.slice(1,-1);return{type:"em",raw:m,text:b,tokens:this.lexer.inlineTokens(b)}}let g=m.slice(2,-2);return{type:"strong",raw:m,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,n=""){let r=this.rules.inline.delLDelim.exec(t);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,s,o,l=i,u=this.rules.inline.delRDelim;for(u.lastIndex=0,e=e.slice(-1*t.length+i);(r=u.exec(e))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(o=[...s].length,o!==i))continue;if(r[3]||r[4]){l+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l);let f=[...r[0]][0].length,h=t.slice(0,i+r.index+f+o),m=h.slice(i,-i);return{type:"del",raw:h,text:m,tokens:this.lexer.inlineTokens(m)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let n,r;if(e[2]==="@")n=e[0],r="mailto:"+n;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);n=e[0],e[1]==="www."?r="http://"+e[0]:r=e[0]}return{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},fi=class Dx{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||sl,this.options.tokenizer=this.options.tokenizer||new Lm,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:nr,block:qh.normal,inline:Wu.normal};this.options.pedantic?(n.block=qh.pedantic,n.inline=Wu.pedantic):this.options.gfm&&(n.block=qh.gfm,this.options.breaks?n.inline=Wu.breaks:n.inline=Wu.gfm),this.tokenizer.rules=n}static get rules(){return{block:qh,inline:Wu}}static lex(e,n){return new Dx(n).lex(e)}static lexInline(e,n){return new Dx(n).inlineTokens(e)}lex(e){e=e.replace(nr.carriageReturn,`
233
- `),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],r=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(nr.tabCharGlobal," ").replace(nr.spaceLine,""));e;){let i;if(this.options.extensions?.block?.some(o=>(i=o.call({lexer:this},e,n))?(e=e.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let o=n.at(-1);i.raw.length===1&&o!==void 0?o.raw+=`
234
- `:n.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
235
- `)?"":`
236
- `)+i.raw,o.text+=`
237
- `+i.text,this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
238
- `)?"":`
239
- `)+i.raw,o.text+=`
240
- `+i.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},n.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),n.push(i);continue}let s=e;if(this.options.extensions?.startBlock){let o=1/0,l=e.slice(1),u;this.options.extensions.startBlock.forEach(f=>{u=f.call({lexer:this},l),typeof u=="number"&&u>=0&&(o=Math.min(o,u))}),o<1/0&&o>=0&&(s=e.substring(0,o+1))}if(this.state.top&&(i=this.tokenizer.paragraph(s))){let o=n.at(-1);r&&o?.type==="paragraph"?(o.raw+=(o.raw.endsWith(`
241
- `)?"":`
242
- `)+i.raw,o.text+=`
243
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i),r=s.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let o=n.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(`
244
- `)?"":`
245
- `)+i.raw,o.text+=`
246
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){this.tokenizer.lexer=this;let r=e,i=null;if(this.tokens.links){let u=Object.keys(this.tokens.links);if(u.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!==null;)u.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!==null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!==null;)s=i[2]?i[2].length:0,r=r.slice(0,i.index+s)+"["+"a".repeat(i[0].length-s-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let o=!1,l="";for(;e;){o||(l=""),o=!1;let u;if(this.options.extensions?.inline?.some(h=>(u=h.call({lexer:this},e,n))?(e=e.substring(u.raw.length),n.push(u),!0):!1))continue;if(u=this.tokenizer.escape(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.tag(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.link(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(u.raw.length);let h=n.at(-1);u.type==="text"&&h?.type==="text"?(h.raw+=u.raw,h.text+=u.text):n.push(u);continue}if(u=this.tokenizer.emStrong(e,r,l)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.codespan(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.br(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.del(e,r,l)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.autolink(e)){e=e.substring(u.raw.length),n.push(u);continue}if(!this.state.inLink&&(u=this.tokenizer.url(e))){e=e.substring(u.raw.length),n.push(u);continue}let f=e;if(this.options.extensions?.startInline){let h=1/0,m=e.slice(1),g;this.options.extensions.startInline.forEach(b=>{g=b.call({lexer:this},m),typeof g=="number"&&g>=0&&(h=Math.min(h,g))}),h<1/0&&h>=0&&(f=e.substring(0,h+1))}if(u=this.tokenizer.inlineText(f)){e=e.substring(u.raw.length),u.raw.slice(-1)!=="_"&&(l=u.raw.slice(-1)),o=!0;let h=n.at(-1);h?.type==="text"?(h.raw+=u.raw,h.text+=u.text):n.push(u);continue}if(e){let h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return n}},Pm=class{options;parser;constructor(t){this.options=t||sl}space(t){return""}code({text:t,lang:e,escaped:n}){let r=(e||"").match(nr.notSpaceStart)?.[0],i=t.replace(nr.endingNewline,"")+`
247
- `;return r?'<pre><code class="language-'+Ri(r)+'">'+(n?i:Ri(i,!0))+`</code></pre>
248
- `:"<pre><code>"+(n?i:Ri(i,!0))+`</code></pre>
249
- `}blockquote({tokens:t}){return`<blockquote>
250
- ${this.parser.parse(t)}</blockquote>
251
- `}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
252
- `}hr(t){return`<hr>
253
- `}list(t){let e=t.ordered,n=t.start,r="";for(let o=0;o<t.items.length;o++){let l=t.items[o];r+=this.listitem(l)}let i=e?"ol":"ul",s=e&&n!==1?' start="'+n+'"':"";return"<"+i+s+`>
254
- `+r+"</"+i+`>
255
- `}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
256
- `}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
257
- `}table(t){let e="",n="";for(let i=0;i<t.header.length;i++)n+=this.tablecell(t.header[i]);e+=this.tablerow({text:n});let r="";for(let i=0;i<t.rows.length;i++){let s=t.rows[i];n="";for(let o=0;o<s.length;o++)n+=this.tablecell(s[o]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
258
- <thead>
259
- `+e+`</thead>
260
- `+r+`</table>
261
- `}tablerow({text:t}){return`<tr>
262
- ${t}</tr>
263
- `}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
264
- `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Ri(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let r=this.parser.parseInline(n),i=kR(t);if(i===null)return r;t=i;let s='<a href="'+t+'"';return e&&(s+=' title="'+Ri(e)+'"'),s+=">"+r+"</a>",s}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=kR(t);if(i===null)return Ri(n);t=i;let s=`<img src="${t}" alt="${Ri(n)}"`;return e&&(s+=` title="${Ri(e)}"`),s+=">",s}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Ri(t.text)}},$S=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},hi=class Ix{options;renderer;textRenderer;constructor(e){this.options=e||sl,this.options.renderer=this.options.renderer||new Pm,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new $S}static parse(e,n){return new Ix(n).parse(e)}static parseInline(e,n){return new Ix(n).parseInline(e)}parse(e){this.renderer.parser=this;let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let o=i,l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){n+=l||"";continue}}let s=i;switch(s.type){case"space":{n+=this.renderer.space(s);break}case"hr":{n+=this.renderer.hr(s);break}case"heading":{n+=this.renderer.heading(s);break}case"code":{n+=this.renderer.code(s);break}case"table":{n+=this.renderer.table(s);break}case"blockquote":{n+=this.renderer.blockquote(s);break}case"list":{n+=this.renderer.list(s);break}case"checkbox":{n+=this.renderer.checkbox(s);break}case"html":{n+=this.renderer.html(s);break}case"def":{n+=this.renderer.def(s);break}case"paragraph":{n+=this.renderer.paragraph(s);break}case"text":{n+=this.renderer.text(s);break}default:{let o='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(e,n=this.renderer){this.renderer.parser=this;let r="";for(let i=0;i<e.length;i++){let s=e[i];if(this.options.extensions?.renderers?.[s.type]){let l=this.options.extensions.renderers[s.type].call({parser:this},s);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){r+=l||"";continue}}let o=s;switch(o.type){case"escape":{r+=n.text(o);break}case"html":{r+=n.html(o);break}case"link":{r+=n.link(o);break}case"image":{r+=n.image(o);break}case"checkbox":{r+=n.checkbox(o);break}case"strong":{r+=n.strong(o);break}case"em":{r+=n.em(o);break}case"codespan":{r+=n.codespan(o);break}case"br":{r+=n.br(o);break}case"del":{r+=n.del(o);break}case"text":{r+=n.text(o);break}default:{let l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}},od=class{options;block;constructor(t){this.options=t||sl}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?fi.lex:fi.lexInline}provideParser(t=this.block){return t?hi.parse:hi.parseInline}},vK=class{defaults=NS();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=hi;Renderer=Pm;TextRenderer=$S;Lexer=fi;Tokenizer=Lm;Hooks=od;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(let r of t)switch(n=n.concat(e.call(this,r)),r.type){case"table":{let i=r;for(let s of i.header)n=n.concat(this.walkTokens(s.tokens,e));for(let s of i.rows)for(let o of s)n=n.concat(this.walkTokens(o.tokens,e));break}case"list":{let i=r;n=n.concat(this.walkTokens(i.items,e));break}default:{let i=r;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(s=>{let o=i[s].flat(1/0);n=n.concat(this.walkTokens(o,e))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=e.renderers[i.name];s?e.renderers[i.name]=function(...o){let l=i.renderer.apply(this,o);return l===!1&&(l=s.apply(this,o)),l}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),n.renderer){let i=this.defaults.renderer||new Pm(this.defaults);for(let s in n.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,l=n.renderer[o],u=i[o];i[o]=(...f)=>{let h=l.apply(i,f);return h===!1&&(h=u.apply(i,f)),h||""}}r.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new Lm(this.defaults);for(let s in n.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,l=n.tokenizer[o],u=i[o];i[o]=(...f)=>{let h=l.apply(i,f);return h===!1&&(h=u.apply(i,f)),h}}r.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new od;for(let s in n.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,l=n.hooks[o],u=i[o];od.passThroughHooks.has(s)?i[o]=f=>{if(this.defaults.async&&od.passThroughHooksRespectAsync.has(s))return(async()=>{let m=await l.call(i,f);return u.call(i,m)})();let h=l.call(i,f);return u.call(i,h)}:i[o]=(...f)=>{if(this.defaults.async)return(async()=>{let m=await l.apply(i,f);return m===!1&&(m=await u.apply(i,f)),m})();let h=l.apply(i,f);return h===!1&&(h=u.apply(i,f)),h}}r.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(o){let l=[];return l.push(s.call(this,o)),i&&(l=l.concat(i.call(this,o))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return fi.lex(t,e??this.defaults)}parser(t,e){return hi.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let r={...n},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=t),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,l=await(i.hooks?await i.hooks.provideLexer(t):t?fi.lex:fi.lexInline)(o,i),u=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(u,i.walkTokens));let f=await(i.hooks?await i.hooks.provideParser(t):t?hi.parse:hi.parseInline)(u,i);return i.hooks?await i.hooks.postprocess(f):f})().catch(s);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer(t):t?fi.lex:fi.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let l=(i.hooks?i.hooks.provideParser(t):t?hi.parse:hi.parseInline)(o,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(o){return s(o)}}}onError(t,e){return n=>{if(n.message+=`
265
- Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error occurred:</p><pre>"+Ri(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},Wa=new vK;function Tt(t,e){return Wa.parse(t,e)}Tt.options=Tt.setOptions=function(t){return Wa.setOptions(t),Tt.defaults=Wa.defaults,Hj(Tt.defaults),Tt};Tt.getDefaults=NS;Tt.defaults=sl;Tt.use=function(...t){return Wa.use(...t),Tt.defaults=Wa.defaults,Hj(Tt.defaults),Tt};Tt.walkTokens=function(t,e){return Wa.walkTokens(t,e)};Tt.parseInline=Wa.parseInline;Tt.Parser=hi;Tt.parser=hi.parse;Tt.Renderer=Pm;Tt.TextRenderer=$S;Tt.Lexer=fi;Tt.lexer=fi.lex;Tt.Tokenizer=Lm;Tt.Hooks=od;Tt.parse=Tt;Tt.options;Tt.setOptions;Tt.use;Tt.walkTokens;Tt.parseInline;hi.parse;fi.lex;var xK=/\n[^\S\n]*(?:\n[^\S\n]*)+$/;function wK(t){return t.flatMap((e,n)=>{var r;if(e.type==="space"||((r=t[n+1])==null?void 0:r.type)==="space")return[e];const i=(e.raw||"").match(xK);return i?[{...e,raw:(e.raw||"").slice(0,-i[0].length)},{type:"space",raw:i[0]}]:[e]})}function SK(t,e){const r=e.split(`
266
- `).flatMap(i=>[i,""]).map(i=>`${t}${i}`).join(`
267
- `);return r.slice(0,r.length-1)}function kK(t,e){const n=[];return Array.from(t.entries()).forEach(([r,i])=>{if(!e){n.push(r);return}(e.marks||[]).find(o=>o.type===r&&Nc(o.attrs,i.attrs))||n.push(r)}),n}function CK(t,e){const n=[];return Array.from(e.entries()).forEach(([r,i])=>{const s=t.get(r);(!s||!Nc(s.attrs,i.attrs))&&n.push({type:r,mark:i})}),n}function EK(t,e,n,r){const i=!n,s=n&&(!n.marks||n.marks.length===0),o=n&&n.marks&&!r(e,new Map(n.marks.map(u=>[u.type,u]))),l=[];return(i||s||o)&&(n&&n.marks?Array.from(t.entries()).reverse().forEach(([u,f])=>{n.marks.find(m=>m.type===u&&Nc(m.attrs,f.attrs))||l.push(u)}):(i||s)&&l.push(...Array.from(t.keys()).reverse())),l}function TK(t,e){let n="";return Array.from(t.keys()).reverse().forEach(r=>{const i=t.get(r),s=e(r,i);s&&(n=s+n)}),t.clear(),n}function _K(t,e,n){let r="";return Array.from(t.entries()).forEach(([i,s])=>{const o=n(i,s);o&&(r+=o),e.set(i,s)}),r}function Xv(t){const n=(t.raw||t.text||"").match(/^(\s*)[-+*]\s+\[([ xX])\]\s+/);return n?{isTask:!0,checked:n[2].toLowerCase()==="x",indentLevel:n[1].length}:{isTask:!1,indentLevel:0}}function Gh(t,e){return typeof t!="string"?"json":e}var AK=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","circle","clippath","defs","ellipse","foreignobject","g","image","line","lineargradient","mask","path","polygon","polyline","radialgradient","rect","stop","switch","symbol","textpath","tspan","use","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),RK=/<\/?([a-zA-Z][\w-]*)/g;function MK(t){const e=[];let n;for(;(n=RK.exec(t))!==null;)e.push(n[1].toLowerCase());return e}function NK(t){const e=t.toLowerCase();return e.includes("-")?!1:!AK.has(e)}function OK(t,e){return MK(t).some(r=>NK(r)?!e.has(r):!1)}var DK=class{constructor(t){this.activeParseLexer=null,this.extensionRanks=new Map,this.baseExtensions=[],this.extensions=[],this.codeTypes=new Set,this.schemaParseDomTagsCache=null,this.lastParseResult=null;var e,n,r,i,s;this.markedInstance=(e=t?.marked)!=null?e:Tt,this.indentStyle=(r=(n=t?.indentation)==null?void 0:n.style)!=null?r:"space",this.indentSize=(s=(i=t?.indentation)==null?void 0:i.size)!=null?s:2,this.baseExtensions=t?.extensions||[],t?.markedOptions&&typeof this.markedInstance.setOptions=="function"&&this.markedInstance.setOptions(t.markedOptions),this.registry=new Map,this.nodeTypeRegistry=new Map,t?.extensions&&(this.baseExtensions=t.extensions,hc(hg(t.extensions)).forEach(l=>this.registerExtension(l)))}get instance(){return this.markedInstance}get indentCharacter(){return this.indentStyle==="space"?" ":" "}get indentString(){return this.indentCharacter.repeat(this.indentSize)}hasMarked(){return!!this.markedInstance}registerExtension(t){var e,n;this.extensions.push(t);const r=yt(De(t,"code")),i=t.name;r&&this.codeTypes.add(i),this.extensionRanks.has(i)||this.extensionRanks.set(i,this.extensionRanks.size);const s=De(t,"markdownTokenName")||i,o=De(t,"parseMarkdown"),l=De(t,"renderMarkdown"),u=De(t,"markdownTokenizer"),f=(e=De(t,"markdownOptions"))!=null?e:null,h=(n=f?.indentsContent)!=null?n:!1,m=f?.htmlReopen,g={tokenName:s,nodeName:i,parseMarkdown:o,renderMarkdown:l,isIndenting:h,htmlReopen:m,tokenizer:u};if(s&&o){const b=this.registry.get(s)||[];b.push(g),this.registry.set(s,b)}if(l){const b=this.nodeTypeRegistry.get(i)||[];b.push(g),this.nodeTypeRegistry.set(i,b)}u&&this.hasMarked()&&this.registerTokenizer(u)}createLexer(){return new this.markedInstance.Lexer(this.markedInstance.defaults)}createTokenizerHelpers(t){return{inlineTokens:e=>t.inlineTokens(e),blockTokens:e=>t.blockTokens(e)}}tokenizeInline(t){var e;return((e=this.activeParseLexer)!=null?e:this.createLexer()).inlineTokens(t)}registerTokenizer(t){if(!this.hasMarked())return;const{name:e,start:n,level:r="inline",tokenize:i}=t,s=this.createTokenizerHelpers.bind(this),o=this.createLexer.bind(this);let l;n?l=typeof n=="function"?n:f=>f.indexOf(n):l=f=>{const h=i(f,[],this.createTokenizerHelpers(this.createLexer()));return h&&h.raw?f.indexOf(h.raw):-1};const u={name:e,level:r,start:l,tokenizer(f,h){const m=this.lexer?s(this.lexer):s(o()),g=i(f,h,m);if(g&&g.type)return{...g,type:g.type||e,raw:g.raw||"",tokens:g.tokens||[]}},childTokens:[]};this.markedInstance.use({extensions:[u]})}getHandlersForToken(t){try{return this.registry.get(t)||[]}catch{return[]}}getHandlerForToken(t){const e=this.getHandlersForToken(t);if(e.length>0)return e[0];const n=this.getHandlersForNodeType(t);return n.length>0?n[0]:void 0}getHandlersForNodeType(t){try{return this.nodeTypeRegistry.get(t)||[]}catch{return[]}}serialize(t){if(!t)return"";const e=this.renderNodes(t,t);return this.isEmptyOutput(e)?"":e}isEmptyOutput(t){return!t||t.trim()===""?!0:t.replace(/&nbsp;/g,"").replace(/\u00A0/g,"").trim()===""}parse(t){if(!this.hasMarked())throw new Error("No marked instance available for parsing");const e=this.activeParseLexer,n=this.createLexer();this.activeParseLexer=n;try{const r=n.lex(t);return{type:"doc",content:this.parseTokens(r,!0)}}finally{this.activeParseLexer=e}}parseTokens(t,e=!1){const n=e?wK(t):t,r=n.reduce((o,l,u)=>(l.type!=="space"&&o.push(u),o),[]);let i=-1,s=0;return n.flatMap((o,l)=>{for(var u;s<r.length&&r[s]<l;)i=r[s],s+=1;if(e&&o.type==="space"){const h=(u=r[s])!=null?u:-1;return this.createImplicitEmptyParagraphsFromSpace(o,i,h)}const f=this.parseToken(o,e);return f===null?[]:Array.isArray(f)?f:[f]})}createImplicitEmptyParagraphsFromSpace(t,e,n){const r=this.countParagraphSeparators(t.raw||"");if(r===0)return[];const s=Math.max(r-(e===-1||n===-1?0:1),0);return Array.from({length:s},()=>({type:"paragraph",content:[]}))}countParagraphSeparators(t){return(t.replace(/\r\n/g,`
268
- `).match(/\n\n/g)||[]).length}parseToken(t,e=!1){if(!t.type)return null;if(t.type==="list")return this.parseListToken(t);const n=this.getHandlersForToken(t.type),r=this.createParseHelpers();if(n.find(s=>{if(!s.parseMarkdown)return!1;const o=s.parseMarkdown(t,r),l=this.normalizeParseResult(o);return l&&(!Array.isArray(l)||l.length>0)?(this.lastParseResult=l,!0):!1})&&this.lastParseResult){const s=this.lastParseResult;return this.lastParseResult=null,s}return this.parseFallbackToken(t,e)}parseListToken(t){if(!t.items||t.items.length===0)return this.parseTokenWithHandlers(t);const e=t.items.some(l=>Xv(l).isTask),n=t.items.some(l=>!Xv(l).isTask);if(!e||!n||this.getHandlersForToken("taskList").length===0)return this.parseTokenWithHandlers(t);const r=[];let i=[],s=null;for(let l=0;l<t.items.length;l+=1){const u=t.items[l],{isTask:f,checked:h,indentLevel:m}=Xv(u);let g=u;if(f){const S=(u.raw||u.text||"").split(`
269
- `),k=S[0].match(/^\s*[-+*]\s+\[([ xX])\]\s+(.*)$/),C=k?k[2]:"";let _=[];if(S.length>1&&S.slice(1).join(`
270
- `).trim()){const R=S.slice(1),A=R.filter(O=>O.trim());if(A.length>0){const O=Math.min(...A.map(z=>z.length-z.trimStart().length)),j=R.map(z=>z.trim()?z.slice(O):"").join(`
271
- `).trim();j&&(_=this.markedInstance.lexer(`${j}
272
- `))}}g={type:"taskItem",raw:"",mainContent:C,indentLevel:m,checked:h??!1,text:C,tokens:this.tokenizeInline(C),nestedTokens:_}}const b=f?"taskList":"list";s!==b?(i.length>0&&r.push({type:s,items:i}),i=[g],s=b):i.push(g)}i.length>0&&r.push({type:s,items:i});const o=[];for(let l=0;l<r.length;l+=1){const u=r[l],f={...t,type:u.type,items:u.items},h=this.parseToken(f);h&&(Array.isArray(h)?o.push(...h):o.push(h))}return o.length>0?o:null}parseTokenWithHandlers(t){if(!t.type)return null;const e=this.getHandlersForToken(t.type),n=this.createParseHelpers();if(e.find(i=>{if(!i.parseMarkdown)return!1;const s=i.parseMarkdown(t,n),o=this.normalizeParseResult(s);return o&&(!Array.isArray(o)||o.length>0)?(this.lastParseResult=o,!0):!1})&&this.lastParseResult){const i=this.lastParseResult;return this.lastParseResult=null,i}return this.parseFallbackToken(t)}createParseHelpers(){return{parseInline:t=>this.parseInlineTokens(t),tokenizeInline:t=>this.tokenizeInline(t),parseChildren:t=>this.parseTokens(t),parseBlockChildren:t=>this.parseTokens(t,!0),createTextNode:(t,e)=>({type:"text",text:t,marks:e||void 0}),createNode:(t,e,n)=>{const r={type:t,attrs:e||void 0,content:n||void 0};return(!e||Object.keys(e).length===0)&&delete r.attrs,r},applyMark:(t,e,n)=>({mark:t,content:e,attrs:n&&Object.keys(n).length>0?n:void 0})}}escapeRegex(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}parseInlineTokens(t){var e,n,r,i;const s=[];for(let o=0;o<t.length;o+=1){const l=t[o];if(l.type==="text")s.push({type:"text",text:YA(l.text||"")});else if(l.type==="escape")s.push({type:"text",text:l.text||""});else if(l.type==="html"){const u=((n=(e=l.raw)!=null?e:l.text)!=null?n:"").toString(),f=/^<\/[\s]*[\w-]+/i.test(u),h=u.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!f&&h&&!/\/>$/.test(u)){const g=h[1],b=this.escapeRegex(g),x=new RegExp(`^<\\/\\s*${b}\\b`,"i");let S=-1;const k=[u];for(let C=o+1;C<t.length;C+=1){const _=t[C],M=((i=(r=_.raw)!=null?r:_.text)!=null?i:"").toString();if(k.push(M),_.type==="html"&&x.test(M)){S=C;break}}if(S!==-1){const C=k.join(""),_={type:"html",raw:C,text:C,block:!1},M=this.parseHTMLToken(_);if(M){const R=this.normalizeParseResult(M);Array.isArray(R)?s.push(...R):R&&s.push(R)}o=S;continue}}const m=this.parseHTMLToken(l);if(m){const g=this.normalizeParseResult(m);Array.isArray(g)?s.push(...g):g&&s.push(g)}}else if(l.type){const u=this.getHandlerForToken(l.type);if(u&&u.parseMarkdown){const f=this.createParseHelpers(),h=u.parseMarkdown(l,f);if(this.isMarkResult(h)){const m=this.applyMarkToContent(h.mark,h.content,h.attrs);s.push(...m)}else{const m=this.normalizeParseResult(h);Array.isArray(m)?s.push(...m):m&&s.push(m)}}else l.tokens&&s.push(...this.parseInlineTokens(l.tokens))}}for(let o=s.length-1;o>0;o-=1){const l=s[o],u=s[o-1];if(l.type==="text"&&u.type==="text"){const f=l.marks||[],h=u.marks||[];W9(f,h)&&(u.text=(u.text||"")+(l.text||""),s.splice(o,1))}}return s}applyMarkToContent(t,e,n){return e.map(r=>{if(r.type==="text"){const i=r.marks||[],s=n?{type:t,attrs:n}:{type:t};return{...r,marks:[...i,s]}}return{...r,content:r.content?this.applyMarkToContent(t,r.content,n):void 0}})}isMarkResult(t){return t&&typeof t=="object"&&"mark"in t}normalizeParseResult(t){return t?this.isMarkResult(t)?t.content:t:null}parseFallbackToken(t,e=!1){switch(t.type){case"paragraph":return{type:"paragraph",content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"heading":return{type:"heading",attrs:{level:t.depth||1},content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"text":return{type:"text",text:YA(t.text||"")};case"html":return this.parseHTMLToken(t);case"escape":return{type:"text",text:t.text||""};case"space":return null;default:return t.tokens?this.parseTokens(t.tokens,e):null}}parseHTMLToken(t){const e=t.text||t.raw||"";if(!e.trim())return null;if(this.isUnrecognizedHtml(e))return this.htmlAsLiteralText(e,!!t.block);if(typeof window>"u"||typeof window.DOMParser>"u")return this.htmlAsLiteralText(e,!!t.block);try{const n=t9(e,this.baseExtensions);return n.type==="doc"&&n.content?t.block?n.content:n.content.length===1&&n.content[0].type==="paragraph"&&n.content[0].content?n.content[0].content:n.content:n}catch(n){throw new Error(`Failed to parse HTML in markdown: ${n}`)}}isUnrecognizedHtml(t){return OK(t,this.getSchemaParseDomTags())}getSchemaParseDomTags(){if(this.schemaParseDomTagsCache)return this.schemaParseDomTagsCache;const t=new Set;try{const e=AI(this.baseExtensions),n=r=>{const i=r?.parseDOM;Array.isArray(i)&&i.forEach(s=>{if(typeof s?.tag=="string"){const o=s.tag.match(/^[a-zA-Z][\w-]*/);o&&t.add(o[0].toLowerCase())}})};Object.values(e.nodes).forEach(r=>n(r.spec)),Object.values(e.marks).forEach(r=>n(r.spec))}catch{}return this.schemaParseDomTagsCache=t,t}htmlAsLiteralText(t,e){const n=t.replace(/\s+$/,"");return n?e?{type:"paragraph",content:[{type:"text",text:n}]}:{type:"text",text:n}:null}encodeTextForMarkdown(t,e,n){return n?.type!=null&&this.codeTypes.has(n.type)||(e.marks||[]).some(i=>this.codeTypes.has(typeof i=="string"?i:i.type))?t:this.escapeMarkdownSyntax(z9(t))}escapeMarkdownSyntax(t){return t.replace(/([\\`*_[\]~])/g,"\\$1")}renderNodeToMarkdown(t,e,n=0,r=0,i={}){var s;if(t.type==="text")return this.encodeTextForMarkdown(t.text||"",t,e);if(!t.type)return"";const o=this.getHandlerForToken(t.type);if(!o)return"";const l=Array.isArray(e?.content)&&n>0?e.content[n-1]:void 0,u={renderChildren:(m,g)=>{const b=o.isIndenting?r+1:r;return!Array.isArray(m)&&m.content?this.renderNodes(m.content,t,g||"",n,b):this.renderNodes(m,t,g||"",n,b)},renderChild:(m,g)=>{const b=o.isIndenting?r+1:r;return this.renderNodeToMarkdown(m,t,g,b)},indent:m=>this.indentString+m,wrapInBlock:SK},f={index:n,level:r,parentType:e?.type,previousNode:l,meta:{parentAttrs:e?.attrs,...i}};return((s=o.renderMarkdown)==null?void 0:s.call(o,t,u,f))||""}renderNodes(t,e,n="",r=0,i=0){return Array.isArray(t)?this.renderNodesWithMarkBoundaries(t,e,n,i):t.type?this.renderNodeToMarkdown(t,e,r,i):""}renderNodesWithMarkBoundaries(t,e,n="",r=0){const i=[],s=new Map,o=new Set,l=new Map;return t.forEach((u,f)=>{const h=f<t.length-1?t[f+1]:null;if(u.type)if(u.type==="text"){let m=this.encodeTextForMarkdown(u.text||"",u,e);const g=new Map((u.marks||[]).map(A=>[A.type,A])),b=this.getMarksToOpenForSerialization(s,g,h),x=kK(g,h),S=x.filter(A=>s.has(A)),k=S.length>0&&b.length>0;let C="";if(x.length>0&&!k){const A=m.match(/(\s+)$/);A&&(C=A[1],m=m.slice(0,-C.length))}k||x.slice().reverse().forEach(A=>{if(!s.has(A))return;const O=g.get(A),D=this.getMarkClosing(A,O,l.get(A));D&&(m+=D),s.has(A)&&(s.delete(A),l.delete(A))});let _="";if(b.length>0){const A=m.match(/^(\s+)/);A&&(_=A[1],m=m.slice(_.length))}b.forEach(({type:A,mark:O})=>{const D=o.has(A)?"html":"markdown",j=this.getMarkOpening(A,O,D);j&&(m=j+m),l.set(A,D),o.delete(A)}),k||b.slice().reverse().forEach(({type:A,mark:O})=>{s.set(A,O)}),m=_+m;let M;if(k){const A=new Set((h?.marks||[]).map(j=>j.type));b.forEach(({type:j})=>{A.has(j)&&this.getHtmlReopenTags(j)&&o.add(j)});const O=Array.from(s.keys()),D=S.slice().sort((j,z)=>O.indexOf(z)-O.indexOf(j));M=[...b.map(j=>j.type),...D]}else M=EK(s,g,h,this.markSetsEqual.bind(this));let R="";if(M.length>0){const A=m.match(/(\s+)$/);A&&(R=A[1],m=m.slice(0,-R.length))}M.forEach(A=>{var O;const D=(O=s.get(A))!=null?O:g.get(A),j=this.getMarkClosing(A,D,l.get(A));j&&(m+=j),s.delete(A),l.delete(A)}),m+=R,m+=C,i.push(m)}else{const m=new Set((u.marks||[]).map(C=>C.type)),g=new Map,b=new Map;s.forEach((C,_)=>{var M;m.has(_)&&(g.set(_,C),b.set(_,(M=l.get(_))!=null?M:"markdown"))});const x=TK(s,(C,_)=>this.getMarkClosing(C,_,l.get(C)));l.clear();const S=this.renderNodeToMarkdown(u,e,f,r),k=u.type==="hardBreak"?"":_K(g,s,(C,_)=>{var M;const R=(M=b.get(C))!=null?M:"markdown";return l.set(C,R),this.getMarkOpening(C,_,R)});i.push(x+S+k)}}),i.join(n)}getMarkOpening(t,e,n="markdown"){var r;if(n==="html")return((r=this.getHtmlReopenTags(t))==null?void 0:r.open)||"";const i=this.getHandlersForNodeType(t),s=i.length>0?i[0]:void 0;if(!s||!s.renderMarkdown)return"";const o="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:o}]};try{const u=s.renderMarkdown(l,{renderChildren:()=>o,renderChild:()=>o,indent:h=>h,wrapInBlock:(h,m)=>h+m},{index:0,level:0,parentType:"text",meta:{}}),f=u.indexOf(o);return f>=0?u.substring(0,f):""}catch(u){throw new Error(`Failed to get mark opening for ${t}: ${u}`)}}getMarkClosing(t,e,n="markdown"){var r;if(n==="html")return((r=this.getHtmlReopenTags(t))==null?void 0:r.close)||"";const i=this.getHandlersForNodeType(t),s=i.length>0?i[0]:void 0;if(!s||!s.renderMarkdown)return"";const o="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:o}]};try{const u=s.renderMarkdown(l,{renderChildren:()=>o,renderChild:()=>o,indent:m=>m,wrapInBlock:(m,g)=>m+g},{index:0,level:0,parentType:"text",meta:{}}),f=u.indexOf(o),h=f+o.length;return f>=0?u.substring(h):""}catch(u){throw new Error(`Failed to get mark closing for ${t}: ${u}`)}}getHtmlReopenTags(t){const e=this.getHandlersForNodeType(t),n=e.length>0?e[0]:void 0;return n?.htmlReopen}markSetsEqual(t,e){return t.size!==e.size?!1:Array.from(t.entries()).every(([n,r])=>{const i=e.get(n);return i&&Nc(r.attrs,i.attrs)})}getMarksToOpenForSerialization(t,e,n){const r=CK(t,e);if(r.length<=1)return r;const i=n?.marks||[],s=(f,h)=>i.some(m=>m.type===f&&Nc(m.attrs,h)),o=(f,h)=>{var m,g;const b=(m=this.extensionRanks.get(f.type))!=null?m:Number.MAX_SAFE_INTEGER,x=(g=this.extensionRanks.get(h.type))!=null?g:Number.MAX_SAFE_INTEGER;return b!==x?x-b:f.type.localeCompare(h.type)},l=r.filter(f=>!s(f.type,f.mark.attrs)).sort(o),u=r.filter(f=>s(f.type,f.mark.attrs)).sort(o);return[...l,...u]}},TR=DK,IK=Ft.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(t,e)=>{if(!e?.contentType||Gh(t,e?.contentType)!=="markdown"||!this.editor.markdown)return ui.setContent(t,e);const r=this.editor.markdown.parse(t);return ui.setContent(r,e)},insertContent:(t,e)=>{if(!e?.contentType||Gh(t,e?.contentType)!=="markdown"||!this.editor.markdown)return ui.insertContent(t,e);const r=this.editor.markdown.parse(t);return ui.insertContent(r,e)},insertContentAt:(t,e,n)=>{if(!n?.contentType||Gh(e,n?.contentType)!=="markdown"||!this.editor.markdown)return ui.insertContentAt(t,e,n);const i=this.editor.markdown.parse(e);return ui.insertContentAt(t,i,n)}}},addStorage(){return{manager:new TR({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:[]})}},onBeforeCreate(){var t;if(this.editor.markdown){console.error("[tiptap][markdown]: There is already a `markdown` property on the editor instance. This might lead to unexpected behavior.");return}if(this.storage.manager=new TR({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:this.editor.extensionManager.baseExtensions}),this.editor.markdown=this.storage.manager,this.editor.getMarkdown=()=>this.storage.manager.serialize(this.editor.getJSON()),!this.editor.options.contentType||Gh(this.editor.options.content,this.editor.options.contentType)!=="markdown")return;if(!this.editor.markdown)throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the Markdown extension is not added to the editor. Please add the Markdown extension to use this feature.');if(this.editor.options.content===void 0||typeof this.editor.options.content!="string")throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the initial content is not a string. Please provide the initial content as a markdown string.');const n=this.editor.markdown.parse(this.editor.options.content);(t=n.content)!=null&&t.length&&(this.editor.options.content=n)}}),jK=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,LK=Mn.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Pt(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,i,s,o;const l=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",u=(i=(r=t.attrs)==null?void 0:r.alt)!=null?i:"",f=(o=(s=t.attrs)==null?void 0:s.title)!=null?o:"";return f?`![${u}](${l} "${f}")`:`![${u}](${l})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize,i=new Set(["src","width","height"]);return({node:s,getPos:o,HTMLAttributes:l,editor:u})=>{const f=document.createElement("img");f.draggable=!1;const h=Pt(this.options.HTMLAttributes,l);Object.entries(h).forEach(([k,C])=>{if(C!=null)switch(k){case"src":case"width":case"height":break;default:f.setAttribute(k,C);break}}),h.src!==null&&(f.src=h.src);let m={...l};const g=k=>{if(typeof k=="string"&&k!==""){f.getAttribute("src")!==k&&(f.src=k);return}f.hasAttribute("src")&&f.removeAttribute("src"),f.src!==""&&(f.src="")};g(l.src);const b=k=>{if(k.type!==s.type)return!1;const C=u.extensionManager.attributes.filter(M=>M.type===k.type.name),_=Mc(k,C);return Object.keys(m).forEach(M=>{!i.has(M)&&!(M in _)&&f.removeAttribute(M)}),Object.entries(_).forEach(([M,R])=>{i.has(M)||(R!=null?f.setAttribute(M,R):f.removeAttribute(M))}),g(_.src),m=_,!0},x=new o8({element:f,editor:u,node:s,getPos:o,onResize:(k,C)=>{f.style.width=`${k}px`,f.style.height=`${C}px`},onCommit:(k,C)=>{const _=o();_!==void 0&&this.editor.chain().setNodeSelection(_).updateAttributes(this.name,{width:k,height:C}).run()},onUpdate:b,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),S=x.dom;return S.style.visibility="hidden",S.style.pointerEvents="none",f.onload=()=>{S.style.visibility="",S.style.pointerEvents=""},x}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[XI({find:jK,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),PK=LK;let jx,Lx;if(typeof WeakMap<"u"){let t=new WeakMap;jx=e=>t.get(e),Lx=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;jx=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Lx=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var en=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 l=1;s<this.width&&this.map[e+l]==n;l++)s++;for(let l=1;o<this.height&&this.map[e+this.width*l]==n;l++)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:l,top:u,bottom:f}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(i,u),right:Math.max(r,l),bottom:Math.max(s,f)}}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 l=(t+1)*this.width;for(;o<l&&this.map[o]<i;)o++;return o==l?s-1:this.map[o]}i=s}}static get(t){return jx(t)||Lx(t,zK(t))}};function zK(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=$K(t),n=t.childCount,r=[];let i=0,s=null;const o=[];for(let f=0,h=e*n;f<h;f++)r[f]=0;for(let f=0,h=0;f<n;f++){const m=t.child(f);h++;for(let x=0;;x++){for(;i<r.length&&r[i]!=0;)i++;if(x==m.childCount)break;const S=m.child(x),{colspan:k,rowspan:C,colwidth:_}=S.attrs;for(let M=0;M<C;M++){if(M+f>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:h,n:C-M});break}const R=i+M*e;for(let A=0;A<k;A++){r[R+A]==0?r[R+A]=h:(s||(s=[])).push({type:"collision",row:f,pos:h,n:k-A});const O=_&&_[A];if(O){const D=(R+A)%e*2,j=o[D];j==null||j!=O&&o[D+1]==1?(o[D]=O,o[D+1]=1):j==O&&o[D+1]++}}}i+=k,h+=S.nodeSize}const g=(f+1)*e;let b=0;for(;i<g;)r[i++]==0&&b++;b&&(s||(s=[])).push({type:"missing",row:f,n:b}),h++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new en(e,n,r,s);let u=!1;for(let f=0;!u&&f<o.length;f+=2)o[f]!=null&&o[f+1]<n&&(u=!0);return u&&BK(l,o,t),l}function $K(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 l=t.child(o);for(let u=0;u<l.childCount;u++){const f=l.child(u);o+f.attrs.rowspan>r&&(s+=f.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const l=i.child(o);s+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function BK(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 l=null;const u=o.attrs;for(let f=0;f<u.colspan;f++){const h=e[(i+f)%t.width*2];h!=null&&(!u.colwidth||u.colwidth[f]!=h)&&((l||(l=VK(u)))[f]=h)}l&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function VK(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Xn(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 Co=new tn("selectingCells");function Ka(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 HK(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function ki(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 wg(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=Ka(e.$head)||UK(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function UK(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 Px(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function FK(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function BS(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Jj(t,e,n){const r=t.node(-1),i=en.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 Za(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 Qj(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 qK(t,e,n){const r=Xn(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 Lt=class ms extends Ke{constructor(e,n=e){const r=e.node(-1),i=en.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,n.pos-s),l=e.node(0),u=i.cellsInRect(o).filter(h=>h!=n.pos-s);u.unshift(n.pos-s);const f=u.map(h=>{const m=r.nodeAt(h);if(!m)throw new RangeError(`No cell with offset ${h} found`);const g=s+h+1;return new yD(l.resolve(g),l.resolve(g+m.content.size))});super(f[0].$from,f[0].$to,f),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(Px(r)&&Px(i)&&BS(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?ms.rowSelection(r,i):s&&this.isColSelection()?ms.colSelection(r,i):new ms(r,i)}return $e.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=en.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let u=i.top;u<i.bottom;u++){const f=[];for(let h=u*n.width+i.left,m=i.left;m<i.right;m++,h++){const g=n.map[h];if(s[g])continue;s[g]=!0;const b=n.findCell(g);let x=e.nodeAt(g);if(!x)throw new RangeError(`No cell with offset ${g} found`);const S=i.left-b.left,k=b.right-i.right;if(S>0||k>0){let C=x.attrs;if(S>0&&(C=Za(C,0,S)),k>0&&(C=Za(C,C.colspan-k,k)),b.left<i.left){if(x=x.type.createAndFill(C),!x)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(C)}`)}else x=x.type.create(C,x.content)}if(b.top<i.top||b.bottom>i.bottom){const C={...x.attrs,rowspan:Math.min(b.bottom,i.bottom)-Math.max(b.top,i.top)};b.top<i.top?x=x.type.createAndFill(C):x=x.type.create(C,x.content)}f.push(x)}o.push(e.child(u).copy(de.from(f)))}const l=this.isColSelection()&&this.isRowSelection()?e:o;return new Ee(de.from(l),1,1)}replace(e,n=Ee.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:l,$to:u}=i[o],f=e.mapping.slice(r);e.replace(f.map(l.pos),f.map(u.pos),o?Ee.empty:n)}const s=Ke.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new Ee(de.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=en.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=en.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(n.pos-s),u=e.node(0);return o.top<=l.top?(o.top>0&&(e=u.resolve(s+i.map[o.left])),l.bottom<i.height&&(n=u.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(n=u.resolve(s+i.map[l.left])),o.bottom<i.height&&(e=u.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new ms(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=en.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,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==n.width}eq(e){return e instanceof ms&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=en.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(n.pos-s),u=e.node(0);return o.left<=l.left?(o.left>0&&(e=u.resolve(s+i.map[o.top*i.width])),l.right<i.width&&(n=u.resolve(s+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(n=u.resolve(s+i.map[l.top*i.width])),o.right<i.width&&(e=u.resolve(s+i.map[i.width*(o.top+1)-1]))),new ms(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new ms(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new ms(e.resolve(n),e.resolve(r))}getBookmark(){return new GK(this.$anchorCell.pos,this.$headCell.pos)}};Lt.prototype.visible=!1;Ke.jsonID("cell",Lt);var GK=class eL{constructor(e,n){this.anchor=e,this.head=n}map(e){return new eL(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&&BS(n,r)?new Lt(n,r):Ke.near(r,1)}};function WK(t){if(!(t.selection instanceof Lt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(Tn.node(r,r+n.nodeSize,{class:"selectedCell"}))}),Et.create(t.doc,e)}function KK({$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 ZK({$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 YK(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,o;if(r instanceof He&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=Lt.create(i,r.from);else if(o=="row"){const l=i.resolve(r.from+1);s=Lt.rowSelection(l,l)}else if(!n){const l=en.get(r.node),u=r.from+1,f=u+l.map[l.width*l.height-1];s=Lt.create(i,u+1,f)}}else r instanceof $e&&KK(r)?s=$e.create(i,r.from):r instanceof $e&&ZK(r)&&(s=$e.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const XK=new tn("fix-tables");function tL(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let o=0,l=0;o<s;o++){const u=e.child(o);for(let f=l,h=Math.min(i,o+3);f<h;f++)if(t.child(f)==u){l=f+1,n+=u.nodeSize;continue e}r(u,n),l<i&&t.child(l).sameMarkup(u)?tL(t.child(l),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function nL(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=JK(t,i,s,n))};return e?e.doc!=t.doc&&tL(e.doc,t.doc,0,r):t.doc.descendants(r),n}function JK(t,e,n,r){const i=en.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let u=0;u<i.height;u++)s.push(0);for(let u=0;u<i.problems.length;u++){const f=i.problems[u];if(f.type=="collision"){const h=e.nodeAt(f.pos);if(!h)continue;const m=h.attrs;for(let g=0;g<m.rowspan;g++)s[f.row+g]+=f.n;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,Za(m,m.colspan-f.n,f.n))}else if(f.type=="missing")s[f.row]+=f.n;else if(f.type=="overlong_rowspan"){const h=e.nodeAt(f.pos);if(!h)continue;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,{...h.attrs,rowspan:h.attrs.rowspan-f.n})}else if(f.type=="colwidth mismatch"){const h=e.nodeAt(f.pos);if(!h)continue;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,{...h.attrs,colwidth:f.colwidth})}else if(f.type=="zero_sized"){const h=r.mapping.map(n);r.delete(h,h+e.nodeSize)}}let o,l;for(let u=0;u<s.length;u++)s[u]&&(o==null&&(o=u),l=u);for(let u=0,f=n+1;u<i.height;u++){const h=e.child(u),m=f+h.nodeSize,g=s[u];if(g>0){let b="cell";h.firstChild&&(b=h.firstChild.type.spec.tableRole);const x=[];for(let k=0;k<g;k++){const C=Xn(t.schema)[b].createAndFill();C&&x.push(C)}const S=(u==0||o==u-1)&&l==u?f+1:m-1;r.insert(r.mapping.map(S),x)}f=m}return r.setMeta(XK,{fixTables:!0})}function Hi(t){const e=t.selection,n=wg(t),r=n.node(-1),i=n.start(-1),s=en.get(r);return{...e instanceof Lt?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function rL(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;qK(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const l=o*e.width+i;if(i>0&&i<e.width&&e.map[l-1]==e.map[l]){const u=e.map[l],f=r.nodeAt(u);t.setNodeMarkup(t.mapping.map(n+u),null,Qj(f.attrs,i-e.colCount(u))),o+=f.attrs.rowspan-1}else{const u=s==null?Xn(r.type.schema).cell:r.nodeAt(e.map[l+s]).type,f=e.positionAt(o,i,r);t.insert(t.mapping.map(n+f),u.createAndFill())}}return t}function QK(t,e){if(!ki(t))return!1;if(e){const n=Hi(t);e(rL(t.tr,n,n.left))}return!0}function eZ(t,e){if(!ki(t))return!1;if(e){const n=Hi(t);e(rL(t.tr,n,n.right))}return!0}function tZ(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let o=0;o<e.height;){const l=o*e.width+i,u=e.map[l],f=n.nodeAt(u),h=f.attrs;if(i>0&&e.map[l-1]==u||i<e.width-1&&e.map[l+1]==u)t.setNodeMarkup(t.mapping.slice(s).map(r+u),null,Za(h,i-e.colCount(u)));else{const m=t.mapping.slice(s).map(r+u);t.delete(m,m+f.nodeSize)}o+=h.rowspan}}function nZ(t,e){if(!ki(t))return!1;if(e){const n=Hi(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;tZ(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=en.get(s)}e(r)}return!0}function rZ(t,e,n){var r;const i=Xn(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))===null||r===void 0?void 0:r.type)!=i)return!1;return!0}function iL(t,{map:e,tableStart:n,table:r},i){let s=n;for(let f=0;f<i;f++)s+=r.child(f).nodeSize;const o=[];let l=i>0?-1:0;rZ(e,r,i+l)&&(l=i==0||i==e.height?null:0);for(let f=0,h=e.width*i;f<e.width;f++,h++)if(i>0&&i<e.height&&e.map[h]==e.map[h-e.width]){const m=e.map[h],g=r.nodeAt(m).attrs;t.setNodeMarkup(n+m,null,{...g,rowspan:g.rowspan+1}),f+=g.colspan-1}else{var u;const m=l==null?Xn(r.type.schema).cell:(u=r.nodeAt(e.map[h+l*e.width]))===null||u===void 0?void 0:u.type,g=m?.createAndFill();g&&o.push(g)}return t.insert(s,Xn(r.type.schema).row.create(null,o)),t}function iZ(t,e){if(!ki(t))return!1;if(e){const n=Hi(t);e(iL(t.tr,n,n.top))}return!0}function sZ(t,e){if(!ki(t))return!1;if(e){const n=Hi(t);e(iL(t.tr,n,n.bottom))}return!0}function oZ(t,{map:e,table:n,tableStart:r},i){let s=0;for(let f=0;f<i;f++)s+=n.child(f).nodeSize;const o=s+n.child(i).nodeSize,l=t.mapping.maps.length;t.delete(s+r,o+r);const u=new Set;for(let f=0,h=i*e.width;f<e.width;f++,h++){const m=e.map[h];if(!u.has(m)){if(u.add(m),i>0&&m==e.map[h-e.width]){const g=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(l).map(m+r),null,{...g,rowspan:g.rowspan-1}),f+=g.colspan-1}else if(i<e.height&&m==e.map[h+e.width]){const g=n.nodeAt(m),b=g.attrs,x=g.type.create({...b,rowspan:g.attrs.rowspan-1},g.content),S=e.positionAt(i+1,f,n);t.insert(t.mapping.slice(l).map(r+S),x),f+=b.colspan-1}}}}function aZ(t,e){if(!ki(t))return!1;if(e){const n=Hi(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;oZ(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=en.get(n.table)}e(r)}return!0}function _R(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function lZ({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,o=(r.bottom-1)*t+r.left,l=i+(r.right-r.left-1);for(let u=r.top;u<r.bottom;u++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[l]==n[l+1])return!0;s+=t,l+=t}for(let u=r.left;u<r.right;u++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[o]==n[o+t])return!0;i++,o++}return!1}function AR(t,e){const n=t.selection;if(!(n instanceof Lt)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Hi(t),{map:i}=r;if(lZ(i,r))return!1;if(e){const s=t.tr,o={};let l=de.empty,u,f;for(let h=r.top;h<r.bottom;h++)for(let m=r.left;m<r.right;m++){const g=i.map[h*i.width+m],b=r.table.nodeAt(g);if(!(o[g]||!b))if(o[g]=!0,u==null)u=g,f=b;else{_R(b)||(l=l.append(b.content));const x=s.mapping.map(g+r.tableStart);s.delete(x,x+b.nodeSize)}}if(u==null||f==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{...Qj(f.attrs,f.attrs.colspan,r.right-r.left-f.attrs.colspan),rowspan:r.bottom-r.top}),l.size>0){const h=u+1+f.content.size,m=_R(f)?u+1:h;s.replaceWith(m+r.tableStart,h+r.tableStart,l)}s.setSelection(new Lt(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function RR(t,e){const n=Xn(t.schema);return cZ(({node:r})=>n[r.type.spec.tableRole])(t,e)}function cZ(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof Lt){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var o;if(i=HK(r.$from),!i)return!1;s=(o=Ka(r.$from))===null||o===void 0?void 0:o.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let l=i.attrs;const u=[],f=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const h=Hi(e),m=e.tr;for(let b=0;b<h.right-h.left;b++)u.push(f?{...l,colwidth:f&&f[b]?[f[b]]:null}:l);let g;for(let b=h.top;b<h.bottom;b++){let x=h.map.positionAt(b,h.left,h.table);b==h.top&&(x+=i.nodeSize);for(let S=h.left,k=0;S<h.right;S++,k++)S==h.left&&b==h.top||m.insert(g=m.mapping.map(x+h.tableStart,1),t({node:i,row:b,col:S}).createAndFill(u[k]))}m.setNodeMarkup(s,t({node:i,row:h.top,col:h.left}),u[0]),r instanceof Lt&&m.setSelection(new Lt(m.doc.resolve(r.$anchorCell.pos),g?m.doc.resolve(g):void 0)),n(m)}return!0}}function uZ(t,e){return function(n,r){if(!ki(n))return!1;const i=wg(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof Lt?n.selection.forEachCell((o,l)=>{o.attrs[t]!==e&&s.setNodeMarkup(l,null,{...o.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function dZ(t){return function(e,n){if(!ki(e))return!1;if(n){const r=Xn(e.schema),i=Hi(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),l=o.map(u=>i.table.nodeAt(u));for(let u=0;u<o.length;u++)l[u].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[u],r.cell,l[u].attrs);if(s.steps.length===0)for(let u=0;u<o.length;u++)s.setNodeMarkup(i.tableStart+o[u],r.header_cell,l[u].attrs);n(s)}return!0}}function MR(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 Fd(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?dZ(t):function(n,r){if(!ki(n))return!1;if(r){const i=Xn(n.schema),s=Hi(n),o=n.tr,l=MR("row",s,i),u=MR("column",s,i),f=(t==="column"?l:t==="row"&&u)?1:0,h=t=="column"?{left:0,top:f,right:1,bottom:s.map.height}:t=="row"?{left:f,top:0,right:s.map.width,bottom:1}:s,m=t=="column"?u?i.cell:i.header_cell:t=="row"?l?i.cell:i.header_cell:i.cell;s.map.cellsInRect(h).forEach(g=>{const b=g+s.tableStart,x=o.doc.nodeAt(b);x&&o.setNodeMarkup(b,m,x.attrs)}),r(o)}return!0}}Fd("row",{useDeprecatedLogic:!0});Fd("column",{useDeprecatedLogic:!0});const fZ=Fd("cell",{useDeprecatedLogic:!0});function hZ(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 NR(t){return function(e,n){if(!ki(e))return!1;const r=hZ(wg(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection($e.between(i,FK(i))).scrollIntoView())}return!0}}function pZ(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 Wh(t,e){const n=t.selection;if(!(n instanceof Lt))return!1;if(e){const r=t.tr,i=Xn(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 Ee(i,0,0))}),r.docChanged&&e(r)}return!0}function mZ(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,l=[];if(s=="row")for(let u=0;u<e.childCount;u++){let f=e.child(u).content;const h=u?0:Math.max(0,n-1),m=u<e.childCount-1?0:Math.max(0,r-1);(h||m)&&(f=zx(Xn(o).row,new Ee(f,h,m)).content),l.push(f)}else if(s=="cell"||s=="header_cell")l.push(n||r?zx(Xn(o).row,new Ee(e,n,r)).content:e);else return null;return gZ(o,l)}function gZ(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:l,colspan:u}=s.child(o).attrs;for(let f=i;f<i+l;f++)n[f]=(n[f]||0)+u}}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=Xn(t).cell.createAndFill(),o=[];for(let l=n[i];l<r;l++)o.push(s);e[i]=e[i].append(de.from(o))}return{height:e.length,width:r,rows:e}}function zx(t,e){const n=t.createAndFill();return new Fw(n).replace(0,n.content.size,e).doc}function yZ({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],o=[];for(let l=0;l<n.length;l++){const u=n[l],f=[];for(let h=s[l]||0,m=0;h<r;m++){let g=u.child(m%u.childCount);h+g.attrs.colspan>r&&(g=g.type.createChecked(Za(g.attrs,g.attrs.colspan,h+g.attrs.colspan-r),g.content)),f.push(g),h+=g.attrs.colspan;for(let b=1;b<g.attrs.rowspan;b++)s[l+b]=(s[l+b]||0)+g.attrs.colspan}o.push(de.from(f))}n=o,t=r}if(e!=i){const s=[];for(let o=0,l=0;o<i;o++,l++){const u=[],f=n[l%e];for(let h=0;h<f.childCount;h++){let m=f.child(h);o+m.attrs.rowspan>i&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,i-m.attrs.rowspan)},m.content)),u.push(m)}s.push(de.from(u))}n=s,e=i}return{width:t,height:e,rows:n}}function bZ(t,e,n,r,i,s,o){const l=t.doc.type.schema,u=Xn(l);let f,h;if(i>e.width)for(let m=0,g=0;m<e.height;m++){const b=n.child(m);g+=b.nodeSize;const x=[];let S;b.lastChild==null||b.lastChild.type==u.cell?S=f||(f=u.cell.createAndFill()):S=h||(h=u.header_cell.createAndFill());for(let k=e.width;k<i;k++)x.push(S);t.insert(t.mapping.slice(o).map(g-1+r),x)}if(s>e.height){const m=[];for(let x=0,S=(e.height-1)*e.width;x<Math.max(e.width,i);x++){const k=x>=e.width?!1:n.nodeAt(e.map[S+x]).type==u.header_cell;m.push(k?h||(h=u.header_cell.createAndFill()):f||(f=u.cell.createAndFill()))}const g=u.row.create(null,de.from(m)),b=[];for(let x=e.height;x<s;x++)b.push(g);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),b)}return!!(f||h)}function OR(t,e,n,r,i,s,o,l){if(o==0||o==e.height)return!1;let u=!1;for(let f=i;f<s;f++){const h=o*e.width+f,m=e.map[h];if(e.map[h-e.width]==m){u=!0;const g=n.nodeAt(m),{top:b,left:x}=e.findCell(m);t.setNodeMarkup(t.mapping.slice(l).map(m+r),null,{...g.attrs,rowspan:o-b}),t.insert(t.mapping.slice(l).map(e.positionAt(o,x,n)),g.type.createAndFill({...g.attrs,rowspan:b+g.attrs.rowspan-o})),f+=g.attrs.colspan-1}}return u}function DR(t,e,n,r,i,s,o,l){if(o==0||o==e.width)return!1;let u=!1;for(let f=i;f<s;f++){const h=f*e.width+o,m=e.map[h];if(e.map[h-1]==m){u=!0;const g=n.nodeAt(m),b=e.colCount(m),x=t.mapping.slice(l).map(m+r);t.setNodeMarkup(x,null,Za(g.attrs,o-b,g.attrs.colspan-(o-b))),t.insert(x+g.nodeSize,g.type.createAndFill(Za(g.attrs,0,o-b))),f+=g.attrs.rowspan-1}}return u}function IR(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=en.get(s);const{top:l,left:u}=r,f=u+i.width,h=l+i.height,m=t.tr;let g=0;function b(){if(s=n?m.doc.nodeAt(n-1):m.doc,!s)throw new Error("No table found");o=en.get(s),g=m.mapping.maps.length}bZ(m,o,s,n,f,h,g)&&b(),OR(m,o,s,n,u,f,l,g)&&b(),OR(m,o,s,n,u,f,h,g)&&b(),DR(m,o,s,n,l,h,u,g)&&b(),DR(m,o,s,n,l,h,f,g)&&b();for(let x=l;x<h;x++){const S=o.positionAt(x,u,s),k=o.positionAt(x,f,s);m.replace(m.mapping.slice(g).map(S+n),m.mapping.slice(g).map(k+n),new Ee(i.rows[x-l],0,0))}b(),m.setSelection(new Lt(m.doc.resolve(n+o.positionAt(l,u,s)),m.doc.resolve(n+o.positionAt(h-1,f-1,s)))),e(m)}const vZ=sS({ArrowLeft:Kh("horiz",-1),ArrowRight:Kh("horiz",1),ArrowUp:Kh("vert",-1),ArrowDown:Kh("vert",1),"Shift-ArrowLeft":Zh("horiz",-1),"Shift-ArrowRight":Zh("horiz",1),"Shift-ArrowUp":Zh("vert",-1),"Shift-ArrowDown":Zh("vert",1),Backspace:Wh,"Mod-Backspace":Wh,Delete:Wh,"Mod-Delete":Wh});function Sp(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Kh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof Lt)return Sp(n,r,Ke.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const o=sL(i,t,e);if(o==null)return!1;if(t=="horiz")return Sp(n,r,Ke.near(n.doc.resolve(s.head+e),e));{const l=n.doc.resolve(o),u=Jj(l,t,e);let f;return u?f=Ke.near(u,1):e<0?f=Ke.near(n.doc.resolve(l.before(-1)),-1):f=Ke.near(n.doc.resolve(l.after(-1)),1),Sp(n,r,f)}}}function Zh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let o;if(s instanceof Lt)o=s;else{const u=sL(i,t,e);if(u==null)return!1;o=new Lt(n.doc.resolve(u))}const l=Jj(o.$headCell,t,e);return l?Sp(n,r,new Lt(o.$anchorCell,l)):!1}}function xZ(t,e){const n=t.state.doc,r=Ka(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Lt(r))),!0):!1}function wZ(t,e,n){if(!ki(t.state))return!1;let r=mZ(n);const i=t.state.selection;if(i instanceof Lt){r||(r={width:1,height:1,rows:[de.from(zx(Xn(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),l=en.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=yZ(r,l.right-l.left,l.bottom-l.top),IR(t.state,t.dispatch,o,l,r),!0}else if(r){const s=wg(t.state),o=s.start(-1);return IR(t.state,t.dispatch,o,en.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function SZ(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=jR(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof Lt)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Ka(t.state.selection.$anchor))!=null&&((n=Jv(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(u,f){let h=Jv(t,f);const m=Co.getState(t.state)==null;if(!h||!BS(u,h))if(m)h=u;else return;const g=new Lt(u,h);if(m||!t.state.selection.eq(g)){const b=t.state.tr.setSelection(g);m&&b.setMeta(Co,u.pos),t.dispatch(b)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",l),Co.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Co,-1))}function l(u){const f=u,h=Co.getState(t.state);let m;if(h!=null)m=t.state.doc.resolve(h);else if(jR(t,f.target)!=r&&(m=Jv(t,e),!m))return o();m&&s(m,f)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",l)}function sL(t,e,n){if(!(t.state.selection instanceof $e))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),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?o:null}}return null}function jR(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Jv(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&&Ka(t.state.doc.resolve(r))||Ka(t.state.doc.resolve(i))}var kZ=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,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",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),$x(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,$x(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function $x(t,e,n,r,i,s){let o=0,l=!0,u=e.firstChild;const f=t.firstChild;if(f){for(let m=0,g=0;m<f.childCount;m++){const{colspan:b,colwidth:x}=f.child(m).attrs;for(let S=0;S<b;S++,g++){const k=i==g?s:x&&x[S],C=k?k+"px":"";if(o+=k||r,k||(l=!1),u)u.style.width!=C&&(u.style.width=C),u=u.nextSibling;else{const _=document.createElement("col");_.style.width=C,e.appendChild(_)}}}for(;u;){var h;const m=u.nextSibling;(h=u.parentNode)===null||h===void 0||h.removeChild(u),u=m}l?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}const Dr=new tn("tableColumnResizing");function CZ({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=kZ,lastColumnResizable:i=!0}={}){const s=new zt({key:Dr,state:{init(o,l){var u;const f=(u=s.spec)===null||u===void 0||(u=u.props)===null||u===void 0?void 0:u.nodeViews,h=Xn(l.schema).table.name;return r&&f&&(f[h]=(m,g)=>new r(m,n,g)),new EZ(-1,!1)},apply(o,l){return l.apply(o)}},props:{attributes:o=>{const l=Dr.getState(o);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,l)=>{TZ(o,l,t,i)},mouseleave:o=>{_Z(o)},mousedown:(o,l)=>{AZ(o,l,e,n)}},decorations:o=>{const l=Dr.getState(o);if(l&&l.activeHandle>-1)return DZ(o,l.activeHandle)},nodeViews:{}}});return s}var EZ=class kp{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Dr);if(r&&r.setHandle!=null)return new kp(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new kp(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Px(e.doc.resolve(i))||(i=-1),new kp(i,n.dragging)}return n}};function TZ(t,e,n,r){if(!t.editable)return;const i=Dr.getState(t.state);if(i&&!i.dragging){const s=MZ(e.target);let o=-1;if(s){const{left:l,right:u}=s.getBoundingClientRect();e.clientX-l<=n?o=LR(t,e,"left",n):u-e.clientX<=n&&(o=LR(t,e,"right",n))}if(o!=i.activeHandle){if(!r&&o!==-1){const l=t.state.doc.resolve(o),u=l.node(-1),f=en.get(u),h=l.start(-1);if(f.colCount(l.pos-h)+l.nodeAfter.attrs.colspan-1==f.width-1)return}oL(t,o)}}}function _Z(t){if(!t.editable)return;const e=Dr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&oL(t,-1)}function AZ(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=Dr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const l=t.state.doc.nodeAt(o.activeHandle),u=RZ(t,o.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(Dr,{setDragging:{startX:e.clientX,startWidth:u}}));function f(m){s.removeEventListener("mouseup",f),s.removeEventListener("mousemove",h);const g=Dr.getState(t.state);g?.dragging&&(NZ(t,g.activeHandle,PR(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(Dr,{setDragging:null})))}function h(m){if(!m.which)return f(m);const g=Dr.getState(t.state);if(g&&g.dragging){const b=PR(g.dragging,m,n);zR(t,g.activeHandle,b,r)}}return zR(t,o.activeHandle,u,r),s.addEventListener("mouseup",f),s.addEventListener("mousemove",h),e.preventDefault(),!0}function RZ(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,l=n;if(r)for(let u=0;u<n;u++)r[u]&&(o-=r[u],l--);return o/l}function MZ(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function LR(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,l=Ka(t.state.doc.resolve(o));if(!l)return-1;if(n=="right")return l.pos;const u=en.get(l.node(-1)),f=l.start(-1),h=u.map.indexOf(l.pos-f);return h%u.width==0?-1:f+u.map[h-1]}function PR(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function oL(t,e){t.dispatch(t.state.tr.setMeta(Dr,{setHandle:e}))}function NZ(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=en.get(i),o=r.start(-1),l=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,u=t.state.tr;for(let f=0;f<s.height;f++){const h=f*s.width+l;if(f&&s.map[h]==s.map[h-s.width])continue;const m=s.map[h],g=i.nodeAt(m).attrs,b=g.colspan==1?0:l-s.colCount(m);if(g.colwidth&&g.colwidth[b]==n)continue;const x=g.colwidth?g.colwidth.slice():OZ(g.colspan);x[b]=n,u.setNodeMarkup(o+m,null,{...g,colwidth:x})}u.docChanged&&t.dispatch(u)}function zR(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),l=en.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;let u=t.domAtPos(i.start(-1)).node;for(;u&&u.nodeName!="TABLE";)u=u.parentNode;u&&$x(s,u.firstChild,u,r,l,n)}function OZ(t){return Array(t).fill(0)}function DZ(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return Et.empty;const s=en.get(i),o=r.start(-1),l=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let f=0;f<s.height;f++){const h=l+f*s.width;if((l==s.width-1||s.map[h]!=s.map[h+1])&&(f==0||s.map[h]!=s.map[h-s.width])){var u;const m=s.map[h],g=o+m+i.nodeAt(m).nodeSize-1,b=document.createElement("div");b.className="column-resize-handle",!((u=Dr.getState(t))===null||u===void 0)&&u.dragging&&n.push(Tn.node(o+m,o+m+i.nodeAt(m).nodeSize,{class:"column-resize-dragging"})),n.push(Tn.widget(g,b))}}return Et.create(t.doc,n)}function IZ({allowTableNodeSelection:t=!1}={}){return new zt({key:Co,state:{init(){return null},apply(e,n){const r=e.getMeta(Co);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:WK,handleDOMEvents:{mousedown:SZ},createSelectionBetween(e){return Co.getState(e.state)!=null?e.state.selection:null},handleTripleClick:xZ,handleKeyDown:vZ,handlePaste:wZ},appendTransaction(e,n,r){return YK(r,nL(r,n),t)}})}function zm(t){return t==="left"||t==="right"||t==="center"?t:null}function jZ(t){const e=(t.style.textAlign||"").trim().toLowerCase(),n=(t.getAttribute("align")||"").trim().toLowerCase();return zm(e||n)}function LZ(t){return zm(t?.align)}function aL(){return{default:null,parseHTML:t=>jZ(t),renderHTML:t=>t.align?{style:`text-align: ${t.align}`}:{}}}function PZ(t){var e;const n=t.parentElement,r=t.closest("table");if(!n||!r)return null;const i=Array.from(n.children).indexOf(t),s=(e=r.querySelectorAll("colgroup > col")[i])==null?void 0:e.getAttribute("width");return s?[parseInt(s,10)]:null}function lL(t){const e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):PZ(t)}var zZ=/[ \t\r\n\f]+/g;function cL(t){var e;return t.children.length>0?!1:((e=t.textContent)!=null?e:"").replace(zZ,"")===""}function uL(t){const e=t.createAndFill();if(!e)throw new Error(`[tiptap error]: "${t.name}" has no default content to backfill.`);return e.content}var $Z=Mn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:lL},align:aL()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getAttrs:t=>cL(t)?{}:!1,getContent:(t,e)=>uL(e.nodes[this.name])},{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Pt(this.options.HTMLAttributes,t),0]}}),BZ=Mn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:lL},align:aL()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getAttrs:t=>cL(t)?{}:!1,getContent:(t,e)=>uL(e.nodes[this.name])},{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Pt(this.options.HTMLAttributes,t),0]}}),VZ=Mn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Pt(this.options.HTMLAttributes,t),0]}});function Bx(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function $R(t,e,n,r,i,s){var o;let l=0,u=!0,f=e.firstChild;const h=t.firstChild;if(h!==null)for(let g=0,b=0;g<h.childCount;g+=1){const{colspan:x,colwidth:S}=h.child(g).attrs;for(let k=0;k<x;k+=1,b+=1){const C=i===b?s:S&&S[k],_=C?`${C}px`:"";if(l+=C||r,C||(u=!1),f){if(f.style.width!==_){const[M,R]=Bx(r,C);f.style.setProperty(M,R)}f=f.nextSibling}else{const M=document.createElement("col"),[R,A]=Bx(r,C);M.style.setProperty(R,A),e.appendChild(M)}}}for(;f;){const g=f.nextSibling;(o=f.parentNode)==null||o.removeChild(f),f=g}const m=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);u&&!m?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}var HZ=class{constructor(t,e,n,r={}){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table"));for(const[i,s]of Object.entries(r))s!=null&&(i==="style"?this.table.style.cssText=String(s):this.table.setAttribute(i,String(s)));t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),$R(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,$R(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){const e=t.target,n=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(n&&!r&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function UZ(t,e,n,r){let i=0,s=!0;const o=[],l=t.firstChild;if(!l)return{};for(let m=0,g=0;m<l.childCount;m+=1){const{colspan:b,colwidth:x}=l.child(m).attrs;for(let S=0;S<b;S+=1,g+=1){const k=n===g?r:x&&x[S];i+=k||e,k||(s=!1);const[C,_]=Bx(e,k);o.push(["col",{style:`${C}: ${_}`}])}}const u=s?`${i}px`:"",f=s?"":`${i}px`;return{colgroup:["colgroup",{},...o],tableWidth:u,tableMinWidth:f}}function BR(t,e){return t.createAndFill()}function FZ(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function qZ(t,e,n,r,i){const s=FZ(t),o=[],l=[];for(let f=0;f<n;f+=1){const h=BR(s.cell);if(h&&l.push(h),r){const m=BR(s.header_cell);m&&o.push(m)}}const u=[];for(let f=0;f<e;f+=1)u.push(s.row.createChecked(null,r&&f===0?o:l));return s.table.createChecked(null,u)}function GZ(t){return t instanceof Lt}var Yh=({editor:t})=>{const{selection:e}=t.state;if(!GZ(e))return!1;let n=0;const r=CI(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},WZ="";function KZ(t){let e="",n=0;for(;n<t.length;){if(t[n]==="\\"&&n+1<t.length){e+=t[n]+t[n+1],n+=2;continue}if(t[n]!=="`"){e+=t[n++];continue}let r=0;for(;n+r<t.length&&t[n+r]==="`";)r+=1;let i=n+r,s=!1;for(;i<t.length;){if(t[i]!=="`"){i+=1;continue}let o=0;for(;i+o<t.length&&t[i+o]==="`";)o+=1;if(o===r){const l=t.slice(n+r,i);e+=t.slice(n,n+r)+l.replace(new RegExp("(?<!\\\\)\\|","g"),"\\|")+t.slice(i,i+r),n=i+r,s=!0;break}i+=o}s||(e+=t.slice(n,n+r),n+=r)}return e}function ZZ(t){return t.split(`
273
- `).map(e=>!e.includes("|")||!e.includes("`")?e:KZ(e)).join(`
274
- `)}function YZ(t){return(t||"").replace(/\s+/g," ").trim()}function XZ(t,e,n={}){var r;const i=(r=n.cellLineSeparator)!=null?r:WZ;if(!t||!t.content||t.content.length===0)return"";const s=[];t.content.forEach(S=>{const k=[];S.content&&S.content.forEach(C=>{let _="";C.content&&Array.isArray(C.content)&&C.content.length>1?_=C.content.map(D=>e.renderChildren(D)).join(i):_=C.content?e.renderChildren(C.content):"";const M=YZ(_.split(i).join(`
275
- `).replace(/[ \t]*\r?\n[ \t]*/g,"<br>")),R=C.type==="tableHeader",A=LZ(C.attrs);k.push({text:M,isHeader:R,align:A})}),s.push(k)});const o=s.reduce((S,k)=>Math.max(S,k.length),0);if(o===0)return"";const l=Array.from({length:o}).fill(0);s.forEach(S=>{var k;for(let C=0;C<o;C+=1){const M=(((k=S[C])==null?void 0:k.text)||"").length;M>l[C]&&(l[C]=M),l[C]<3&&(l[C]=3)}});const u=(S,k)=>S+" ".repeat(Math.max(0,k-S.length)),f=s[0],h=f.some(S=>S.isHeader),m=Array.from({length:o}).fill(null);s.forEach(S=>{var k;for(let C=0;C<o;C+=1)!m[C]&&((k=S[C])!=null&&k.align)&&(m[C]=S[C].align)});let g=`
276
- `;const b=Array.from({length:o}).map((S,k)=>h&&f[k]&&f[k].text||"");return g+=`| ${b.map((S,k)=>u(S,l[k])).join(" | ")} |
277
- `,g+=`| ${l.map((S,k)=>{const C=Math.max(3,S),_=m[k];return _==="left"?`:${"-".repeat(C)}`:_==="right"?`${"-".repeat(C)}:`:_==="center"?`:${"-".repeat(C)}:`:"-".repeat(C)}).join(" | ")} |
278
- `,(h?s.slice(1):s).forEach(S=>{g+=`| ${Array.from({length:o}).fill(0).map((k,C)=>u(S[C]&&S[C].text||"",l[C])).join(" | ")} |
279
- `}),g}var JZ=XZ,QZ=Mn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:HZ,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:i}=UZ(t,this.options.cellMinWidth),s=e.style;function o(){return s||(r?`width: ${r}`:`min-width: ${i}`)}const l=["table",Pt(this.options.HTMLAttributes,e,{style:o()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},l]:l},parseMarkdown:(t,e)=>{const n=[],r=Array.isArray(t.align)?t.align:[];if(t.header){const i=[];t.header.forEach((s,o)=>{var l;const u=zm((l=r[o])!=null?l:s.align),f=u?{align:u}:{};i.push(e.createNode("tableHeader",f,[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),n.push(e.createNode("tableRow",{},i))}return t.rows&&t.rows.forEach(i=>{const s=[];i.forEach((o,l)=>{var u;const f=zm((u=r[l])!=null?u:o.align),h=f?{align:f}:{};s.push(e.createNode("tableCell",h,[{type:"paragraph",content:e.parseInline(o.tokens)}]))}),n.push(e.createNode("tableRow",{},s))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>JZ(t,e),markdownTokenizer:{name:"table",level:"block",start:t=>{const e=t.split(`
280
- `);if(e.length<2)return-1;const n=e[1];return!/^[ \t|:]*-[ \t|:-]*$/.test(n)||!n.includes("|")?-1:e[0].includes("|")?0:-1},tokenize(t,e,n){const r=t.indexOf(`
281
-
282
- `),i=r>=0?t.slice(0,r):t,s=i.split(`
283
- `);if(s.length<2)return;const o=s[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(o)||!o.includes("|"))return;const l=ZZ(i);if(l===i)return;const f=n.blockTokens(l)[0];if(f?.type!=="table"||!f.raw)return;const h=f.raw.split(`
284
- `).length,m=t.split(`
285
- `).slice(0,h).join(`
286
- `);return{...f,raw:m}}},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const o=qZ(s.schema,t,e,n);if(i){const l=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection($e.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>QK(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>eZ(t,e),deleteColumn:()=>({state:t,dispatch:e})=>nZ(t,e),addRowBefore:()=>({state:t,dispatch:e})=>iZ(t,e),addRowAfter:()=>({state:t,dispatch:e})=>sZ(t,e),deleteRow:()=>({state:t,dispatch:e})=>aZ(t,e),deleteTable:()=>({state:t,dispatch:e})=>pZ(t,e),mergeCells:()=>({state:t,dispatch:e})=>AR(t,e),splitCell:()=>({state:t,dispatch:e})=>RR(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Fd("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Fd("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>fZ(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>AR(t,e)?!0:RR(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>uZ(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>NR(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>NR(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&nL(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Lt.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Yh,"Mod-Backspace":Yh,Delete:Yh,"Mod-Delete":Yh}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[CZ({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],IZ({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){const t=this.options.resizable&&this.editor.isEditable,e=this.options.View;return t||!e?null:({node:n,view:r,HTMLAttributes:i})=>{const s=Pt(this.options.HTMLAttributes,i);return new e(n,this.options.cellMinWidth,r,s)}},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:yt(De(t,"tableRole",e))}}}),eY=Ft.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(QZ.configure(this.options.table)),this.options.tableCell!==!1&&t.push($Z.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(BZ.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(VZ.configure(this.options.tableRow)),t}});function tY({recordImages:t=[],galleryUpload:e,onListGallery:n,onUploadGallery:r,onClose:i,onInsert:s}){const o=!!n,[l,u]=E.useState(t.length?"record":"gallery"),[f,h]=E.useState([]),[m,g]=E.useState(!1),[b,x]=E.useState(null),[S,k]=E.useState({}),[C,_]=E.useState("");E.useEffect(()=>{const q=G=>{G.key==="Escape"&&i()};window.addEventListener("keydown",q);const Z=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",q),document.body.style.overflow=Z}},[i]),E.useEffect(()=>{if(!o)return;let q=!1;return g(!0),x(null),n().then(Z=>{q||h(Z)}).catch(Z=>{q||x(Z instanceof Error?Z.message:"Could not load gallery")}).finally(()=>{q||g(!1)}),()=>{q=!0}},[o,n]);const M=E.useMemo(()=>t.map(q=>({id:`record:${q.id}`,url:q.url,name:q.name,source:"record"})),[t]),R=E.useMemo(()=>f.map(q=>({id:`gallery:${q.id}`,url:q.url,name:q.name??q.id,source:"gallery"})),[f]),A=l==="record"?M:R,O=Object.values(S),D=!!(e&&r),j=q=>{k(Z=>{const G={...Z};return G[q.id]?delete G[q.id]:G[q.id]=q,G})},z=()=>{const q=C.trim();if(!q)return;const Z={id:`url:${q}`,url:q,name:"Image",source:"url"};k(G=>({...G,[Z.id]:Z})),_("")};return y.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:i,children:y.jsxs("div",{className:"vertebr-modal",role:"dialog","aria-modal":"true","aria-label":"Insert images",onClick:q=>q.stopPropagation(),children:[y.jsxs("header",{className:"vertebr-modal-head",children:[y.jsxs("div",{className:"vertebr-modal-heading",children:[y.jsx("p",{className:"vertebr-modal-eyebrow",children:"Media"}),y.jsx("h2",{children:"Insert images"})]}),y.jsx("button",{type:"button",className:"vertebr-btn",onClick:i,children:"Close"})]}),y.jsxs("div",{className:"vertebr-modal-body vertebr-picker-body",children:[t.length>0&&o?y.jsxs("div",{className:"vertebr-picker-tabs",role:"tablist",children:[y.jsxs("button",{type:"button",role:"tab","aria-selected":l==="record","data-active":l==="record"||void 0,onClick:()=>u("record"),children:["Product photos",y.jsx("span",{children:M.length})]}),y.jsxs("button",{type:"button",role:"tab","aria-selected":l==="gallery","data-active":l==="gallery"||void 0,onClick:()=>u("gallery"),children:["Gallery",y.jsx("span",{children:m?"…":R.length})]})]}):null,l==="gallery"&&D?y.jsx(Pc,{meta:{field:"gallery",accept:e.accept,maxBytes:e.maxBytes},multiple:!0,label:"Drop images to add them to the gallery",onUpload:async q=>{const Z=await r(q);h(G=>[...Z,...G]),k(G=>{const ee={...G};for(const te of Z){const fe={id:`gallery:${te.id}`,url:te.url,name:te.name??te.id,source:"gallery"};ee[fe.id]=fe}return ee})}}):null,y.jsxs("label",{className:"vertebr-field",children:[y.jsx("span",{children:"Or paste an image URL"}),y.jsxs("div",{className:"vertebr-picker-url",children:[y.jsx("input",{type:"url",value:C,placeholder:"https://",onChange:q=>_(q.target.value),onKeyDown:q=>{q.key==="Enter"&&(q.preventDefault(),z())}}),y.jsx("button",{type:"button",className:"vertebr-btn",disabled:!C.trim(),onClick:z,children:"Add"})]})]}),b?y.jsx("p",{className:"vertebr-status","data-tone":"danger",children:b}):null,m&&l==="gallery"?y.jsx("div",{className:"vertebr-empty",children:"Loading gallery…"}):A.length===0?y.jsx("div",{className:"vertebr-empty",children:l==="record"?"No product photos on this record yet.":o?"No images in the gallery yet.":"No gallery is configured. Paste a URL or add product photos."}):y.jsx("div",{className:"vertebr-picker-grid",children:A.map(q=>{const Z=!!S[q.id];return y.jsxs("button",{type:"button",className:"vertebr-picker-tile","data-selected":Z||void 0,onClick:()=>j(q),children:[y.jsx("span",{className:"vertebr-picker-thumb",children:y.jsx("img",{src:q.url,alt:""})}),y.jsx("span",{className:"vertebr-picker-name",children:q.name})]},q.id)})})]}),y.jsxs("footer",{className:"vertebr-picker-foot",children:[y.jsxs("span",{className:"vertebr-picker-count",children:[O.length," selected"]}),y.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",disabled:O.length===0,onClick:()=>s(O),children:["Insert ",O.length||"",O.length===1?" image":" images"]})]})]})})}function VR(t,e){t&&(typeof t=="function"?t(e):t.current=e)}function er({active:t,disabled:e,title:n,onClick:r,children:i}){return y.jsx("button",{type:"button",className:"vertebr-md-btn","data-active":t||void 0,disabled:e,title:n,onMouseDown:s=>s.preventDefault(),onClick:r,children:i})}function nY({id:t,name:e,value:n,readOnly:r,placeholder:i="Write a description…",recordImages:s,galleryUpload:o,onListGallery:l,onUploadGallery:u,onBlur:f,onChange:h,inputRef:m}){const g=typeof n=="string"?n:"",b=E.useRef(h),x=E.useRef(f),S=E.useRef(g),[k,C]=E.useState(!1);b.current=h,x.current=f;const _=sG({immediatelyRender:!1,shouldRerenderOnTransaction:!1,content:g,contentType:"markdown",editable:!r,extensions:[O7.configure({heading:{levels:[2,3]},underline:!1,link:{openOnClick:!1,defaultProtocol:"https"}}),PK.configure({inline:!1,allowBase64:!1}),eY.configure({table:{resizable:!1}}),C7.configure({placeholder:i}),IK.configure({markedOptions:{gfm:!0}})],editorProps:{attributes:{id:t,class:"vertebr-md-content"}},onUpdate:({editor:j})=>{const z=j.getMarkdown();S.current=z,b.current(z)},onBlur:()=>{x.current?.()}});E.useEffect(()=>{if(_)return VR(m,_.view.dom),()=>VR(m,null)},[_,m]),E.useEffect(()=>{_&&_.setEditable(!r)},[_,r]),E.useEffect(()=>{if(_&&g!==S.current){if(g===_.getMarkdown()){S.current=g;return}_.commands.setContent(g,{contentType:"markdown",emitUpdate:!1}),S.current=g}},[_,g]);const M=tj({editor:_,selector:({editor:j})=>({bold:j?.isActive("bold")??!1,italic:j?.isActive("italic")??!1,strike:j?.isActive("strike")??!1,code:j?.isActive("code")??!1,codeBlock:j?.isActive("codeBlock")??!1,heading:j?.isActive("heading")??!1,quote:j?.isActive("blockquote")??!1,bullet:j?.isActive("bulletList")??!1,ordered:j?.isActive("orderedList")??!1,table:j?.isActive("table")??!1,link:j?.isActive("link")??!1,stats:D_(j?.getText()??g)})}),R=M?.stats??D_(g),A=r||!_,O=()=>{if(!_||r)return;const j=_.getAttributes("link").href,z=window.prompt("Link URL",typeof j=="string"&&j?j:"https://");if(z!==null){if(!z.trim()){_.chain().focus().extendMarkRange("link").unsetLink().run();return}_.chain().focus().extendMarkRange("link").setLink({href:z.trim()}).run()}},D=j=>{!_||j.length===0||(_.chain().focus().insertContent(j.map(z=>({type:"image",attrs:{src:z.url,alt:z.name}}))).run(),C(!1))};return y.jsxs("div",{className:"vertebr-field-prose",onKeyDown:j=>{(j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="k"&&(j.preventDefault(),O())},children:[e?y.jsx("input",{type:"hidden",name:e,value:g,readOnly:!0}):null,y.jsxs("div",{className:"vertebr-md-toolbar",role:"toolbar","aria-label":"Format",children:[y.jsx(er,{active:M?.bold,disabled:A,title:"Bold",onClick:()=>_?.chain().focus().toggleBold().run(),children:y.jsx("span",{className:"vertebr-md-glyph",children:"B"})}),y.jsx(er,{active:M?.italic,disabled:A,title:"Italic",onClick:()=>_?.chain().focus().toggleItalic().run(),children:y.jsx("span",{className:"vertebr-md-glyph vertebr-md-italic",children:"I"})}),y.jsx(er,{active:M?.strike,disabled:A,title:"Strikethrough",onClick:()=>_?.chain().focus().toggleStrike().run(),children:y.jsx("span",{className:"vertebr-md-glyph vertebr-md-strike",children:"S"})}),y.jsx(er,{active:M?.code,disabled:A,title:"Inline code",onClick:()=>_?.chain().focus().toggleCode().run(),children:"</>"}),y.jsx(er,{active:M?.codeBlock,disabled:A,title:"Code block",onClick:()=>_?.chain().focus().toggleCodeBlock().run(),children:"{ }"}),y.jsx("span",{className:"vertebr-md-sep","aria-hidden":"true"}),y.jsx(er,{active:M?.heading,disabled:A,title:"Heading",onClick:()=>_?.chain().focus().toggleHeading({level:2}).run(),children:"H"}),y.jsx(er,{active:M?.quote,disabled:A,title:"Quote",onClick:()=>_?.chain().focus().toggleBlockquote().run(),children:"“"}),y.jsx(er,{active:M?.bullet,disabled:A,title:"Bulleted list",onClick:()=>_?.chain().focus().toggleBulletList().run(),children:"•"}),y.jsx(er,{active:M?.ordered,disabled:A,title:"Numbered list",onClick:()=>_?.chain().focus().toggleOrderedList().run(),children:"1."}),y.jsx("span",{className:"vertebr-md-sep","aria-hidden":"true"}),y.jsx(er,{active:M?.table,disabled:A,title:"Table",onClick:()=>_?.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),children:"Table"}),M?.table?y.jsxs(y.Fragment,{children:[y.jsx(er,{disabled:A,title:"Add column",onClick:()=>_?.chain().focus().addColumnAfter().run(),children:"+Col"}),y.jsx(er,{disabled:A,title:"Add row",onClick:()=>_?.chain().focus().addRowAfter().run(),children:"+Row"}),y.jsx(er,{disabled:A,title:"Delete table",onClick:()=>_?.chain().focus().deleteTable().run(),children:"Del"})]}):null,y.jsx(er,{active:M?.link,disabled:A,title:"Link",onClick:O,children:"Link"}),y.jsx(er,{disabled:A,title:"Insert images",onClick:()=>C(!0),children:"Image"})]}),y.jsx(ej,{editor:_}),y.jsxs("p",{className:"vertebr-field-prose-meta",children:["Markdown",y.jsx("span",{"aria-hidden":"true",children:" · "}),R.words," ",R.words===1?"word":"words",y.jsx("span",{"aria-hidden":"true",children:" · "}),R.characters," ",R.characters===1?"character":"characters"]}),k?y.jsx(tY,{recordImages:s,galleryUpload:o,onListGallery:l,onUploadGallery:u,onClose:()=>C(!1),onInsert:D}):null]})}var rY=Object.defineProperty,iY=(t,e)=>rY(t,"name",{value:e,configurable:!0});function Vx(t,[e,n]){return Math.min(n,Math.max(e,t))}iY(Vx,"clamp");var sY=Object.defineProperty,En=(t,e)=>sY(t,"name",{value:e,configurable:!0});function dL(t){const e=t+"CollectionProvider",[n,r]=Bc(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=En(S=>{const{scope:k,children:C}=S,_=E.useRef(null),M=E.useRef(new Map).current;return y.jsx(i,{scope:k,itemMap:M,collectionRef:_,children:C})},"CollectionProvider");o.displayName=e;const l=t+"CollectionSlot",u=Ha(l),f=E.forwardRef((S,k)=>{const{scope:C,children:_}=S,M=s(l,C),R=an(k,M.collectionRef);return y.jsx(u,{ref:R,children:_})});f.displayName=l;const h=t+"CollectionItemSlot",m="data-radix-collection-item",g=Ha(h),b=E.forwardRef((S,k)=>{const{scope:C,children:_,...M}=S,R=E.useRef(null),A=an(k,R),O=s(h,C);return E.useEffect(()=>(O.itemMap.set(R,{ref:R,...M}),()=>{O.itemMap.delete(R)})),y.jsx(g,{[m]:"",ref:A,children:_})});b.displayName=h;function x(S){const k=s(t+"CollectionConsumer",S);return E.useCallback(()=>{const _=k.collectionRef.current;if(!_)return[];const M=Array.from(_.querySelectorAll(`[${m}]`));return Array.from(k.itemMap.values()).sort((O,D)=>M.indexOf(O.ref.current)-M.indexOf(D.ref.current))},[k.collectionRef,k.itemMap])}return En(x,"useCollection"),[{Provider:o,Slot:f,ItemSlot:b},x,r]}En(dL,"createCollection");var HR=new WeakMap,hn,Rr,Qv=(Rr=class extends Map{constructor(n){super(n);iT(this,hn);Qb(this,hn,[...super.keys()]),HR.set(this,!0)}set(n,r){return HR.get(this)&&(this.has(n)?qn(this,hn)[qn(this,hn).indexOf(n)]=n:qn(this,hn).push(n)),super.set(n,r),this}insert(n,r,i){const s=this.has(r),o=qn(this,hn).length,l=VS(n);let u=l>=0?l:o+l;const f=u<0||u>=o?-1:u;if(f===this.size||s&&f===this.size-1||f===-1)return this.set(r,i),this;const h=this.size+(s?0:1);l<0&&u++;const m=[...qn(this,hn)];let g,b=!1;for(let x=u;x<h;x++)if(u===x){let S=m[x];m[x]===r&&(S=m[x+1]),s&&this.delete(r),g=this.get(S),this.set(r,i)}else{!b&&m[x-1]===r&&(b=!0);const S=m[b?x:x-1],k=g;g=this.get(S),this.delete(S),this.set(S,k)}return this}with(n,r,i){const s=new Rr(this);return s.insert(n,r,i),s}before(n){const r=qn(this,hn).indexOf(n)-1;if(!(r<0))return this.entryAt(r)}setBefore(n,r,i){const s=qn(this,hn).indexOf(n);return s===-1?this:this.insert(s,r,i)}after(n){let r=qn(this,hn).indexOf(n);if(r=r===-1||r===this.size-1?-1:r+1,r!==-1)return this.entryAt(r)}setAfter(n,r,i){const s=qn(this,hn).indexOf(n);return s===-1?this:this.insert(s+1,r,i)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return Qb(this,hn,[]),super.clear()}delete(n){const r=super.delete(n);return r&&qn(this,hn).splice(qn(this,hn).indexOf(n),1),r}deleteAt(n){const r=this.keyAt(n);return r!==void 0?this.delete(r):!1}at(n){const r=Cp(qn(this,hn),n);if(r!==void 0)return this.get(r)}entryAt(n){const r=Cp(qn(this,hn),n);if(r!==void 0)return[r,this.get(r)]}indexOf(n){return qn(this,hn).indexOf(n)}keyAt(n){return Cp(qn(this,hn),n)}from(n,r){const i=this.indexOf(n);if(i===-1)return;let s=i+r;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.at(s)}keyFrom(n,r){const i=this.indexOf(n);if(i===-1)return;let s=i+r;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(n,r){let i=0;for(const s of this){if(Reflect.apply(n,r,[s,i,this]))return s;i++}}findIndex(n,r){let i=0;for(const s of this){if(Reflect.apply(n,r,[s,i,this]))return i;i++}return-1}filter(n,r){const i=[];let s=0;for(const o of this)Reflect.apply(n,r,[o,s,this])&&i.push(o),s++;return new Rr(i)}map(n,r){const i=[];let s=0;for(const o of this)i.push([o[0],Reflect.apply(n,r,[o,s,this])]),s++;return new Rr(i)}reduce(...n){const[r,i]=n;let s=0,o=i??this.at(0);for(const l of this)s===0&&n.length===1?o=l:o=Reflect.apply(r,this,[o,l,s,this]),s++;return o}reduceRight(...n){const[r,i]=n;let s=i??this.at(-1);for(let o=this.size-1;o>=0;o--){const l=this.at(o);o===this.size-1&&n.length===1?s=l:s=Reflect.apply(r,this,[s,l,o,this])}return s}toSorted(n){const r=[...this.entries()].sort(n);return new Rr(r)}toReversed(){const n=new Rr;for(let r=this.size-1;r>=0;r--){const i=this.keyAt(r),s=this.get(i);n.set(i,s)}return n}toSpliced(...n){const r=[...this.entries()];return r.splice(...n),new Rr(r)}slice(n,r){const i=new Rr;let s=this.size-1;if(n===void 0)return i;n<0&&(n=n+this.size),r!==void 0&&r>0&&(s=r-1);for(let o=n;o<=s;o++){const l=this.keyAt(o),u=this.get(l);i.set(l,u)}return i}every(n,r){let i=0;for(const s of this){if(!Reflect.apply(n,r,[s,i,this]))return!1;i++}return!0}some(n,r){let i=0;for(const s of this){if(Reflect.apply(n,r,[s,i,this]))return!0;i++}return!1}},hn=new WeakMap,En(Rr,"OrderedDict"),Rr);function Cp(t,e){if("at"in Array.prototype)return Array.prototype.at.call(t,e);const n=fL(t,e);return n===-1?void 0:t[n]}En(Cp,"at");function fL(t,e){const n=t.length,r=VS(e),i=r>=0?r:n+r;return i<0||i>=n?-1:i}En(fL,"toSafeIndex");function VS(t){return t!==t||t===0?0:Math.trunc(t)}En(VS,"toSafeInteger");function oY(t){const e=t+"CollectionProvider",[n,r]=Bc(e),[i,s]=n(e,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Qv,setItemMap:En(()=>{},"setItemMap")}),o=En(({state:M,...R})=>M?y.jsx(u,{...R,state:M}):y.jsx(l,{...R}),"CollectionProvider");o.displayName=e;const l=En(M=>{const R=k();return y.jsx(u,{...M,state:R})},"CollectionInit");l.displayName=e+"Init";const u=En(M=>{const{scope:R,children:A,state:O}=M,D=E.useRef(null),[j,z]=E.useState(null),q=an(D,z),[Z,G]=O;return E.useEffect(()=>{if(!j)return;const ee=mL(()=>{});return ee.observe(j,{childList:!0,subtree:!0}),()=>{ee.disconnect()}},[j]),y.jsx(i,{scope:R,itemMap:Z,setItemMap:G,collectionRef:q,collectionRefObject:D,collectionElement:j,children:A})},"CollectionProviderImpl");u.displayName=e+"Impl";const f=t+"CollectionSlot",h=Ha(f),m=E.forwardRef((M,R)=>{const{scope:A,children:O}=M,D=s(f,A),j=an(R,D.collectionRef);return y.jsx(h,{ref:j,children:O})});m.displayName=f;const g=t+"CollectionItemSlot",b="data-radix-collection-item",x=Ha(g),S=E.forwardRef((M,R)=>{const{scope:A,children:O,...D}=M,j=E.useRef(null),[z,q]=E.useState(null),Z=an(R,j,q),G=s(g,A),{setItemMap:ee}=G,te=E.useRef(D);hL(te.current,D)||(te.current=D);const fe=te.current;return E.useEffect(()=>{const B=fe;return ee(L=>z?L.has(z)?L.set(z,{...B,element:z}).toSorted(Hx):(L.set(z,{...B,element:z}),L.toSorted(Hx)):L),()=>{ee(L=>!z||!L.has(z)?L:(L.delete(z),new Qv(L)))}},[z,fe,ee]),y.jsx(x,{[b]:"",ref:Z,children:O})});S.displayName=g;function k(){return E.useState(new Qv)}En(k,"useInitCollection");function C(M){const{itemMap:R}=s(t+"CollectionConsumer",M);return R}return En(C,"useCollection"),[{Provider:o,Slot:m,ItemSlot:S},{createCollectionScope:r,useCollection:C,useInitCollection:k}]}En(oY,"createCollection");function hL(t,e){if(t===e)return!0;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(e,i)||t[i]!==e[i])return!1;return!0}En(hL,"shallowEqual");function pL(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}En(pL,"isElementPreceding");function Hx(t,e){return!t[1].element||!e[1].element?0:pL(t[1].element,e[1].element)?-1:1}En(Hx,"sortByDocumentPosition");function mL(t){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){t();return}})}En(mL,"getChildListObserver");var aY=Object.defineProperty,lY=(t,e)=>aY(t,"name",{value:e,configurable:!0}),cY=E.createContext(void 0);function gL(t){const e=E.useContext(cY);return t||e||"ltr"}lY(gL,"useDirection");var uY=Object.defineProperty,dY=(t,e)=>uY(t,"name",{value:e,configurable:!0});function $i(t){const e=E.useRef(t);return E.useEffect(()=>{e.current=t}),E.useMemo(()=>((...n)=>e.current?.(...n)),[])}dY($i,"useCallbackRef");var fY=Object.defineProperty,Cn=(t,e)=>fY(t,"name",{value:e,configurable:!0}),Ux="dismissableLayer.update",hY="dismissableLayer.pointerDownOutside",pY="dismissableLayer.focusOutside",UR,yL=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),mY=E.forwardRef(Cn(function(e,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:l,onInteractOutside:u,onDismiss:f,...h}=e,m=E.useContext(yL),[g,b]=E.useState(null),x=g?.ownerDocument??globalThis?.document,[,S]=E.useState({}),k=an(n,b),C=Array.from(m.layers),[_]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),M=_?C.indexOf(_):-1,R=g?C.indexOf(g):-1,A=m.layersWithOutsidePointerEventsDisabled.size>0,O=R>=M,D=E.useRef(!1),j=bL(G=>{o?.(G),u?.(G),G.defaultPrevented||f?.()},{ownerDocument:x,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:D,dismissableSurfaces:m.dismissableSurfaces,shouldHandlePointerDownOutside:E.useCallback(G=>{if(!(G instanceof Node))return!1;const ee=[...m.branches].some(te=>te.contains(G));return O&&!ee},[m.branches,O])}),z=vL(G=>{if(i&&D.current)return;const ee=G.target;[...m.branches].some(fe=>fe.contains(ee))||(l?.(G),u?.(G),G.defaultPrevented||f?.())},x),q=g?R===C.length-1:!1,Z=$i(G=>{G.key==="Escape"&&(s?.(G),!G.defaultPrevented&&f&&(G.preventDefault(),f()))});return E.useEffect(()=>{if(q)return x.addEventListener("keydown",Z,{capture:!0}),()=>x.removeEventListener("keydown",Z,{capture:!0})},[x,q,Z]),E.useEffect(()=>{if(g)return r&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(UR=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(g)),m.layers.add(g),Fx(),()=>{r&&(m.layersWithOutsidePointerEventsDisabled.delete(g),m.layersWithOutsidePointerEventsDisabled.size===0&&(x.body.style.pointerEvents=UR))}},[g,x,r,m]),E.useEffect(()=>()=>{g&&(m.layers.delete(g),m.layersWithOutsidePointerEventsDisabled.delete(g),Fx())},[g,m]),E.useEffect(()=>{const G=Cn(()=>S({}),"handleUpdate");return document.addEventListener(Ux,G),()=>document.removeEventListener(Ux,G)},[]),y.jsx(Rn.div,{...h,ref:k,style:{pointerEvents:A?O?"auto":"none":void 0,...e.style},onFocusCapture:mn(e.onFocusCapture,z.onFocusCapture),onBlurCapture:mn(e.onBlurCapture,z.onBlurCapture),onPointerDownCapture:mn(e.onPointerDownCapture,j.onPointerDownCapture)})},"DismissableLayer"));function gY(){const t=E.useContext(yL),[e,n]=E.useState(null);return E.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}Cn(gY,"useDismissableLayerSurface");var yY=Cn(()=>!0,"IS_TRUE");function bL(t,e){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s,shouldHandlePointerDownOutside:o=yY}=e,l=$i(t),u=E.useRef(!1),f=E.useRef(!1),h=E.useRef(new Map),m=E.useRef(()=>{});return E.useEffect(()=>{function g(){f.current=!1,i.current=!1,h.current.clear()}Cn(g,"resetOutsideInteraction");function b(){return Array.from(h.current.values()).some(Boolean)}Cn(b,"isOutsideInteractionIntercepted");function x(M){if(!f.current)return;const R=M.target;R instanceof Node&&[...s].some(O=>O.contains(R))||h.current.set(M.type,!0),M.type==="click"&&window.setTimeout(()=>{f.current&&m.current()},0)}Cn(x,"handleInteractionCapture");function S(M){f.current&&h.current.set(M.type,!1)}Cn(S,"handleInteractionBubble");const k=Cn(M=>{if(M.target&&!u.current){let R=function(){n.removeEventListener("click",m.current);const O=b();g(),O||HS(hY,l,A,{discrete:!0})};if(Cn(R,"handleAndDispatchPointerDownOutsideEvent"),!o(M.target)){n.removeEventListener("click",m.current),g(),u.current=!1;return}const A={originalEvent:M};f.current=!0,i.current=r&&M.button===0,h.current.clear(),!r||M.button!==0?R():(n.removeEventListener("click",m.current),m.current=R,n.addEventListener("click",m.current,{once:!0}))}else n.removeEventListener("click",m.current),g();u.current=!1},"handlePointerDown"),C=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const M of C)n.addEventListener(M,x,!0),n.addEventListener(M,S);const _=window.setTimeout(()=>{n.addEventListener("pointerdown",k)},0);return()=>{window.clearTimeout(_),n.removeEventListener("pointerdown",k),n.removeEventListener("click",m.current);for(const M of C)n.removeEventListener(M,x,!0),n.removeEventListener(M,S)}},[n,l,r,i,s,o]),{onPointerDownCapture:Cn(()=>u.current=!0,"onPointerDownCapture")}}Cn(bL,"usePointerDownOutside");function vL(t,e=globalThis?.document){const n=$i(t),r=E.useRef(!1);return E.useEffect(()=>{const i=Cn(s=>{s.target&&!r.current&&HS(pY,n,{originalEvent:s},{discrete:!1})},"handleFocus");return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:Cn(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Cn(()=>r.current=!1,"onBlurCapture")}}Cn(vL,"useFocusOutside");function Fx(){const t=new CustomEvent(Ux);document.dispatchEvent(t)}Cn(Fx,"dispatchUpdate");function HS(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?wO(i,s):i.dispatchEvent(s)}Cn(HS,"handleAndDispatchCustomEvent");var bY=Object.defineProperty,US=(t,e)=>bY(t,"name",{value:e,configurable:!0}),Xh=0,Zl=null;function vY(t){return FS(),t.children}US(vY,"FocusGuards");function FS(){E.useEffect(()=>{Zl||(Zl={start:qx(),end:qx()});const{start:t,end:e}=Zl;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),Xh++,()=>{Xh===1&&(Zl?.start.remove(),Zl?.end.remove(),Zl=null),Xh=Math.max(0,Xh-1)}},[])}US(FS,"useFocusGuards");function qx(){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}US(qx,"createFocusGuard");var xY=Object.defineProperty,rr=(t,e)=>xY(t,"name",{value:e,configurable:!0}),e0="focusScope.autoFocusOnMount",t0="focusScope.autoFocusOnUnmount",FR={bubbles:!1,cancelable:!0},wY=E.forwardRef(rr(function(e,n){const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...l}=e,[u,f]=E.useState(null),h=$i(s),m=$i(o),g=E.useRef(null),b=an(n,f),x=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(i){let k=function(R){if(x.paused||!u)return;const A=R.target;u.contains(A)?g.current=A:ys(g.current,{select:!0})},C=function(R){if(x.paused||!u)return;const A=R.relatedTarget;A!==null&&(u.contains(A)||ys(g.current,{select:!0}))},_=function(R){if(document.activeElement===document.body)for(const O of R)O.removedNodes.length>0&&ys(u)};rr(k,"handleFocusIn"),rr(C,"handleFocusOut"),rr(_,"handleMutations"),document.addEventListener("focusin",k),document.addEventListener("focusout",C);const M=new MutationObserver(_);return u&&M.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",k),document.removeEventListener("focusout",C),M.disconnect()}}},[i,u,x.paused]),E.useEffect(()=>{if(u){qR.add(x);const k=document.activeElement;if(!u.contains(k)){const _=new CustomEvent(e0,FR);u.addEventListener(e0,h),u.dispatchEvent(_),_.defaultPrevented||(xL(EL(qS(u)),{select:!0}),document.activeElement===k&&ys(u))}return()=>{u.removeEventListener(e0,h),setTimeout(()=>{const _=new CustomEvent(t0,FR);u.addEventListener(t0,m),u.dispatchEvent(_),_.defaultPrevented||ys(k??document.body,{select:!0}),u.removeEventListener(t0,m),qR.remove(x)},0)}}},[u,h,m,x]);const S=E.useCallback(k=>{if(!r&&!i||x.paused)return;const C=k.key==="Tab"&&!k.altKey&&!k.ctrlKey&&!k.metaKey,_=document.activeElement;if(C&&_){const M=k.currentTarget,[R,A]=wL(M);R&&A?!k.shiftKey&&_===A?(k.preventDefault(),r&&ys(R,{select:!0})):k.shiftKey&&_===R&&(k.preventDefault(),r&&ys(A,{select:!0})):_===M&&k.preventDefault()}},[r,i,x.paused]);return y.jsx(Rn.div,{tabIndex:-1,...l,ref:b,onKeyDown:S})},"FocusScope"));function xL(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(ys(r,{select:e}),document.activeElement!==n)return}rr(xL,"focusFirst");function wL(t){const e=qS(t),n=Gx(e,t),r=Gx(e.reverse(),t);return[n,r]}rr(wL,"getTabbableEdges");function qS(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:rr(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},"acceptNode")});for(;n.nextNode();)e.push(n.currentNode);return e}rr(qS,"getTabbableCandidates");function Gx(t,e){const n=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(const r of t)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):SL(r,{upTo:e})))return r}rr(Gx,"findVisible");function SL(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}rr(SL,"isHidden");function kL(t){return t instanceof HTMLInputElement&&"select"in t}rr(kL,"isSelectableInput");function ys(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&kL(t)&&e&&t.select()}}rr(ys,"focus");var qR=CL();function CL(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=Wx(t,e),t.unshift(e)},remove(e){t=Wx(t,e),t[0]?.resume()}}}rr(CL,"createFocusScopesStack");function Wx(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}rr(Wx,"arrayRemove");function EL(t){return t.filter(e=>e.tagName!=="A")}rr(EL,"removeLinks");var SY=Object.defineProperty,kY=(t,e)=>SY(t,"name",{value:e,configurable:!0}),CY=Kd[" useId ".trim().toString()]||(()=>{}),EY=0;function GS(t){const[e,n]=E.useState(CY());return ir(()=>{t||n(r=>r??String(EY++))},[t]),t||(e?`radix-${e}`:"")}kY(GS,"useId");const TY=["top","right","bottom","left"],qo=Math.min,Ms=Math.max,$m=Math.round,Jh=Math.floor,Ns=t=>({x:t,y:t}),_Y={left:"right",right:"left",bottom:"top",top:"bottom"};function TL(t,e,n){return Ms(t,qo(e,n))}function js(t,e){return typeof t=="function"?t(e):t}function Go(t){return t.split("-")[0]}function Uc(t){return t.split("-")[1]}function WS(t){return t==="x"?"y":"x"}function KS(t){return t==="y"?"height":"width"}function ji(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function ZS(t){return WS(ji(t))}function AY(t,e,n){n===void 0&&(n=!1);const r=Uc(t),i=ZS(t),s=KS(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Bm(o)),[o,Bm(o)]}function RY(t){const e=Bm(t);return[Kx(t),e,Kx(e)]}function Kx(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const GR=["left","right"],WR=["right","left"],MY=["top","bottom"],NY=["bottom","top"];function OY(t,e,n){switch(t){case"top":case"bottom":return n?e?WR:GR:e?GR:WR;case"left":case"right":return e?MY:NY;default:return[]}}function DY(t,e,n,r){const i=Uc(t);let s=OY(Go(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Kx)))),s}function Bm(t){const e=Go(t);return _Y[e]+t.slice(e.length)}function IY(t){var e,n,r,i;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(r=t.bottom)!=null?r:0,left:(i=t.left)!=null?i:0}}function _L(t){return typeof t!="number"?IY(t):{top:t,right:t,bottom:t,left:t}}function Vm(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 KR(t,e,n){let{reference:r,floating:i}=t;const s=ji(e),o=ZS(e),l=KS(o),u=Go(e),f=s==="y",h=r.x+r.width/2-i.width/2,m=r.y+r.height/2-i.height/2,g=r[l]/2-i[l]/2;let b;switch(u){case"top":b={x:h,y:r.y-i.height};break;case"bottom":b={x:h,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:m};break;case"left":b={x:r.x-i.width,y:m};break;default:b={x:r.x,y:r.y}}const x=Uc(e);return x&&(b[o]+=g*(x==="end"?1:-1)*(n&&f?-1:1)),b}async function jY(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:u}=t,{boundary:f="clippingAncestors",rootBoundary:h="viewport",elementContext:m="floating",altBoundary:g=!1,padding:b=0}=js(e,t),x=_L(b),k=l[g?m==="floating"?"reference":"floating":m],C=Vm(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(k)))==null||n?k:k.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:f,rootBoundary:h,strategy:u})),_=m==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,M=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),R=await(s.isElement==null?void 0:s.isElement(M))&&await(s.getScale==null?void 0:s.getScale(M))||{x:1,y:1},A=Vm(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:_,offsetParent:M,strategy:u}):_);return{top:(C.top-A.top+x.top)/R.y,bottom:(A.bottom-C.bottom+x.bottom)/R.y,left:(C.left-A.left+x.left)/R.x,right:(A.right-C.right+x.right)/R.x}}const LY=50,PY=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:jY},u=await(o.isRTL==null?void 0:o.isRTL(e));let f=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:h,y:m}=KR(f,r,u),g=r,b=0;const x={};for(let S=0;S<s.length;S++){const k=s[S];if(!k)continue;const{name:C,fn:_}=k,{x:M,y:R,data:A,reset:O}=await _({x:h,y:m,initialPlacement:r,placement:g,strategy:i,middlewareData:x,rects:f,platform:l,elements:{reference:t,floating:e}});h=M??h,m=R??m,x[C]={...x[C],...A},O&&b<LY&&(b++,typeof O=="object"&&(O.placement&&(g=O.placement),O.rects&&(f=O.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):O.rects),{x:h,y:m}=KR(f,g,u)),S=-1)}return{x:h,y:m,placement:g,strategy:i,middlewareData:x}},zY=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:o,elements:l,middlewareData:u}=e,{element:f,padding:h=0}=js(t,e)||{};if(f==null)return{};const m=_L(h),g={x:n,y:r},b=ZS(i),x=KS(b),S=await o.getDimensions(f),k=b==="y",C=k?"top":"left",_=k?"bottom":"right",M=k?"clientHeight":"clientWidth",R=s.reference[x]+s.reference[b]-g[b]-s.floating[x],A=g[b]-s.reference[b],O=await(o.getOffsetParent==null?void 0:o.getOffsetParent(f));let D=O?O[M]:0;(!D||!await(o.isElement==null?void 0:o.isElement(O)))&&(D=l.floating[M]||s.floating[x]);const j=R/2-A/2,z=D/2-S[x]/2-1,q=qo(m[C],z),Z=qo(m[_],z),G=D-S[x]-Z,ee=D/2-S[x]/2+j,te=TL(q,ee,G),fe=!u.arrow&&Uc(i)!=null&&ee!==te&&s.reference[x]/2-(ee<q?q:Z)-S[x]/2<0,B=fe?ee<q?ee-q:ee-G:0;return{[b]:g[b]+B,data:{[b]:te,centerOffset:ee-te-B,...fe&&{alignmentOffset:B}},reset:fe}}}),$Y=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:l,platform:u,elements:f}=e,{mainAxis:h=!0,crossAxis:m=!0,fallbackPlacements:g,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:S=!0,...k}=js(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=Go(i),_=ji(l),M=Go(l)===l,R=await(u.isRTL==null?void 0:u.isRTL(f.floating)),A=g||(M||!S?[Bm(l)]:RY(l)),O=x!=="none";!g&&O&&A.push(...DY(l,S,x,R));const D=[l,...A],j=await u.detectOverflow(e,k),z=[];let q=((r=s.flip)==null?void 0:r.overflows)||[];if(h&&z.push(j[C]),m){const te=AY(i,o,R);z.push(j[te[0]],j[te[1]])}if(q=[...q,{placement:i,overflows:z}],!z.every(te=>te<=0)){var Z,G;const te=(((Z=s.flip)==null?void 0:Z.index)||0)+1,fe=D[te];if(fe&&(!(m==="alignment"?_!==ji(fe):!1)||q.every(U=>ji(U.placement)===_?U.overflows[0]>0:!0)))return{data:{index:te,overflows:q},reset:{placement:fe}};let B=(G=q.filter(L=>L.overflows[0]<=0).sort((L,U)=>L.overflows[1]-U.overflows[1])[0])==null?void 0:G.placement;if(!B)switch(b){case"bestFit":{var ee;const L=(ee=q.filter(U=>{if(O){const ue=ji(U.placement);return ue===_||ue==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(ue=>ue>0).reduce((ue,Se)=>ue+Se,0)]).sort((U,ue)=>U[1]-ue[1])[0])==null?void 0:ee[0];L&&(B=L);break}case"initialPlacement":B=l;break}if(i!==B)return{reset:{placement:B}}}return{}}}};function ZR(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function YR(t){return TY.some(e=>t[e]>=0)}const BY=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...s}=js(t,e);switch(i){case"referenceHidden":{const o=await r.detectOverflow(e,{...s,elementContext:"reference"}),l=ZR(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:YR(l)}}}case"escaped":{const o=await r.detectOverflow(e,{...s,altBoundary:!0}),l=ZR(o,n.floating);return{data:{escapedOffsets:l,escaped:YR(l)}}}default:return{}}}}},AL=new Set(["left","top"]);async function VY(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Go(n),l=Uc(n),u=ji(n)==="y",f=AL.has(o)?-1:1,h=s&&u?-1:1,m=js(e,t);let{mainAxis:g,crossAxis:b,alignmentAxis:x}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return l&&typeof x=="number"&&(b=l==="end"?x*-1:x),u?{x:b*h,y:g*f}:{x:g*f,y:b*h}}const HY=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:l}=e,u=await VY(e,t);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:s+u.y,data:{...u,placement:o}}}}},UY=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:l=!1,limiter:u={fn:_=>{let{x:M,y:R}=_;return{x:M,y:R}}},...f}=js(t,e),h={x:n,y:r},m=await s.detectOverflow(e,f),g=ji(i),b=WS(g);let x=h[b],S=h[g];const k=(_,M)=>TL(M+m[_==="y"?"top":"left"],M,M-m[_==="y"?"bottom":"right"]);o&&(x=k(b,x)),l&&(S=k(g,S));const C=u.fn({...e,[b]:x,[g]:S});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[b]:o,[g]:l}}}}}},FY=function(t){return t===void 0&&(t={}),{options:t,fn(e){var n,r;const{x:i,y:s,placement:o,rects:l,middlewareData:u}=e,{offset:f=0,mainAxis:h=!0,crossAxis:m=!0}=js(t,e),g={x:i,y:s},b=ji(o),x=WS(b);let S=g[x],k=g[b];const C=js(f,e),_=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:(n=C.mainAxis)!=null?n:0,crossAxis:(r=C.crossAxis)!=null?r:0};if(h){const A=x==="y"?"height":"width",O=l.reference[x]-l.floating[A]+_.mainAxis,D=l.reference[x]+l.reference[A]-_.mainAxis;S<O?S=O:S>D&&(S=D)}if(m){var M,R;const A=x==="y"?"width":"height",O=AL.has(Go(o)),D=l.reference[b]-l.floating[A]+(O&&((M=u.offset)==null?void 0:M[b])||0)+(O?0:_.crossAxis),j=l.reference[b]+l.reference[A]+(O?0:((R=u.offset)==null?void 0:R[b])||0)-(O?_.crossAxis:0);k<D?k=D:k>j&&(k=j)}return{[x]:S,[b]:k}}}},qY=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:r,platform:i,elements:s}=e,{apply:o=()=>{},...l}=js(t,e),u=await i.detectOverflow(e,l),f=Go(n),h=Uc(n),m=ji(n)==="y",{width:g,height:b}=r.floating;let x,S;f==="top"||f==="bottom"?(x=f,S=h===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(S=f,x=h==="end"?"top":"bottom");const k=b-u.top-u.bottom,C=g-u.left-u.right,_=qo(b-u[x],k),M=qo(g-u[S],C),R=e.middlewareData.shift,A=!R;let O=_,D=M;R!=null&&R.enabled.x&&(D=C),R!=null&&R.enabled.y&&(O=k),A&&!h&&(m?D=g-2*Ms(u.left,u.right):O=b-2*Ms(u.top,u.bottom)),await o({...e,availableWidth:D,availableHeight:O});const j=await i.getDimensions(s.floating);return g!==j.width||b!==j.height?{reset:{rects:!0}}:{}}}};function Sg(){return typeof window<"u"}function Fc(t){return RL(t)?(t.nodeName||"").toLowerCase():"#document"}function yr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function $s(t){var e;return(e=(RL(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function RL(t){return Sg()?t instanceof Node||t instanceof yr(t).Node:!1}function Bi(t){return Sg()?t instanceof Element||t instanceof yr(t).Element:!1}function Qo(t){return Sg()?t instanceof HTMLElement||t instanceof yr(t).HTMLElement:!1}function XR(t){return!Sg()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof yr(t).ShadowRoot}function kg(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=Vi(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&i!=="inline"&&i!=="contents"}function GY(t){return/^(table|td|th)$/.test(Fc(t))}function Cg(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const WY=/transform|translate|scale|rotate|perspective|filter/,KY=/paint|layout|strict|content/,xa=t=>!!t&&t!=="none";let n0;function YS(t){const e=Bi(t)?Vi(t):t;return xa(e.transform)||xa(e.translate)||xa(e.scale)||xa(e.rotate)||xa(e.perspective)||!XS()&&(xa(e.backdropFilter)||xa(e.filter))||WY.test(e.willChange||"")||KY.test(e.contain||"")}function ZY(t){let e=Ya(t);for(;Qo(e)&&!qd(e);){if(YS(e))return e;if(Cg(e))return null;e=Ya(e)}return null}function XS(){return n0==null&&(n0=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),n0}function qd(t){return/^(html|body|#document)$/.test(Fc(t))}function Vi(t){return yr(t).getComputedStyle(t)}function Eg(t){return Bi(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ya(t){if(Fc(t)==="html")return t;const e=t.assignedSlot||t.parentNode||XR(t)&&t.host||$s(t);return XR(e)?e.host:e}function ML(t){const e=Ya(t);return qd(e)?(t.ownerDocument||t).body:Qo(e)&&kg(e)?e:ML(e)}function Gd(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=ML(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=yr(i);if(s){const l=Zx(o);return e.concat(o,o.visualViewport||[],kg(i)?i:[],l&&n?Gd(l):[])}else return e.concat(i,Gd(i,[],n))}function Zx(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function NL(t){const e=Vi(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Qo(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,l=$m(n)!==s||$m(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function JS(t){return Bi(t)?t:t.contextElement}function pc(t){const e=JS(t);if(!Qo(e))return Ns(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=NL(e);let o=(s?$m(n.width):n.width)/r,l=(s?$m(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const YY=Ns(0);function OL(t){const e=yr(t);return!XS()||!e.visualViewport?YY:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function XY(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===yr(t)}function Xa(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=JS(t);let o=Ns(1);e&&(r?Bi(r)&&(o=pc(r)):o=pc(t));const l=XY(s,n,r)?OL(s):Ns(0);let u=(i.left+l.x)/o.x,f=(i.top+l.y)/o.y,h=i.width/o.x,m=i.height/o.y;if(s&&r){const g=yr(s),b=Bi(r)?yr(r):r;let x=g,S=Zx(x);for(;S&&b!==x;){const k=pc(S),C=S.getBoundingClientRect(),_=Vi(S),M=C.left+(S.clientLeft+parseFloat(_.paddingLeft))*k.x,R=C.top+(S.clientTop+parseFloat(_.paddingTop))*k.y;u*=k.x,f*=k.y,h*=k.x,m*=k.y,u+=M,f+=R,x=yr(S),S=Zx(x)}}return Vm({width:h,height:m,x:u,y:f})}function Tg(t,e){const n=Eg(t).scrollLeft;return e?e.left+n:Xa($s(t)).left+n}function DL(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Tg(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function JY(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=$s(r),l=e?Cg(e.floating):!1;if(r===o||l&&s)return n;let u={scrollLeft:0,scrollTop:0},f=Ns(1);const h=Ns(0),m=Qo(r);if((m||!s)&&((Fc(r)!=="body"||kg(o))&&(u=Eg(r)),m)){const b=Xa(r);f=pc(r),h.x=b.x+r.clientLeft,h.y=b.y+r.clientTop}const g=o&&!m&&!s?DL(o,u):Ns(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-u.scrollLeft*f.x+h.x+g.x,y:n.y*f.y-u.scrollTop*f.y+h.y+g.y}}function QY(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function eX(t){const e=Eg(t),n=t.ownerDocument.body,r=Ms(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=Ms(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-e.scrollLeft+Tg(t);const o=-e.scrollTop;return Vi(n).direction==="rtl"&&(s+=Ms(t.clientWidth,n.clientWidth)-r),{width:r,height:i,x:s,y:o}}const tX=25;function nX(t,e,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",i=yr(t),s=$s(t),o=i.visualViewport;let l=s.clientWidth,u=s.clientHeight,f=0,h=0;if(o){const g=!XS()||e==="fixed";r?g||(f=-o.offsetLeft,h=-o.offsetTop):(l=o.width,u=o.height,g&&(f=o.offsetLeft,h=o.offsetTop))}if(Tg(s)<=0){const g=s.ownerDocument,b=g.body,x=getComputedStyle(b),S=g.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,k=Math.abs(s.clientWidth-b.clientWidth-S),C=getComputedStyle(s).scrollbarGutter==="stable both-edges"?k/2:k;C<=tX&&(l-=C)}return{width:l,height:u,x:f,y:h}}function rX(t,e){const n=Xa(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=pc(t),o=t.clientWidth*s.x,l=t.clientHeight*s.y,u=i*s.x,f=r*s.y;return{width:o,height:l,x:u,y:f}}function JR(t,e,n){let r;if(e==="viewport"||e==="layoutViewport")r=nX(t,n,e);else if(e==="document")r=eX($s(t));else if(Bi(e))r=rX(e,n);else{const i=OL(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Vm(r)}function iX(t,e){const n=e.get(t);if(n)return n;let r=Gd(t,[],!1).filter(l=>Bi(l)&&Fc(l)!=="body"),i=null;const s=Vi(t).position==="fixed";let o=s?Ya(t):t;for(;Bi(o)&&!qd(o);){const l=Vi(o),u=YS(o),f=i?i.position:s?"fixed":"";!u&&(f==="fixed"||f==="absolute"&&l.position==="static")?r=r.filter(m=>m!==o):i=l,o=Ya(o)}return e.set(t,r),r}function sX(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?Cg(e)?[]:iX(e,this._c):[].concat(n),r],l=JR(e,o[0],i);let u=l.top,f=l.right,h=l.bottom,m=l.left;for(let g=1;g<o.length;g++){const b=JR(e,o[g],i);u=Ms(b.top,u),f=qo(b.right,f),h=qo(b.bottom,h),m=Ms(b.left,m)}return{width:f-m,height:h-u,x:m,y:u}}function oX(t){const{width:e,height:n}=NL(t);return{width:e,height:n}}function aX(t,e,n){const r=Qo(e),i=$s(e),s=n==="fixed",o=Xa(t,!0,s,e);let l={scrollLeft:0,scrollTop:0};const u=Ns(0);if((r||!s)&&((Fc(e)!=="body"||kg(i))&&(l=Eg(e)),r)){const g=Xa(e,!0,s,e);u.x=g.x+e.clientLeft,u.y=g.y+e.clientTop}!r&&i&&(u.x=Tg(i));const f=i&&!r&&!s?DL(i,l):Ns(0),h=o.left+l.scrollLeft-u.x-f.x,m=o.top+l.scrollTop-u.y-f.y;return{x:h,y:m,width:o.width,height:o.height}}function r0(t){return Vi(t).position==="static"}function QR(t,e){if(!Qo(t)||Vi(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return $s(t)===n&&(n=n.ownerDocument.body),n}function IL(t,e){const n=yr(t);if(Cg(t))return n;if(!Qo(t)){let i=Ya(t);for(;i&&!qd(i);){if(Bi(i)&&!r0(i))return i;i=Ya(i)}return n}let r=QR(t,e);for(;r&&GY(r)&&r0(r);)r=QR(r,e);return r&&qd(r)&&r0(r)&&!YS(r)?n:r||ZY(t)||n}const lX=async function(t){const e=this.getOffsetParent||IL,n=this.getDimensions,r=await n(t.floating);return{reference:aX(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function cX(t){return Vi(t).direction==="rtl"}const uX={convertOffsetParentRelativeRectToViewportRelativeRect:JY,getDocumentElement:$s,getClippingRect:sX,getOffsetParent:IL,getElementRects:lX,getClientRects:QY,getDimensions:oX,getScale:pc,isElement:Bi,isRTL:cX};function jL(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function dX(t,e,n){let r=null,i;const s=$s(t);function o(){var h;clearTimeout(i),(h=r)==null||h.disconnect(),r=null}function l(h,m){h===void 0&&(h=!1),m===void 0&&(m=1),o();const g=t.getBoundingClientRect(),{left:b,top:x,width:S,height:k}=g;if(h||e(),!S||!k)return;const C=Jh(x),_=Jh(s.clientWidth-(b+S)),M=Jh(s.clientHeight-(x+k)),R=Jh(b),O={rootMargin:-C+"px "+-_+"px "+-M+"px "+-R+"px",threshold:Ms(0,qo(1,m))||1};let D=!0;function j(z){const q=z[0].intersectionRatio;if(!jL(g,t.getBoundingClientRect()))return l();if(q!==m){if(!D)return l();q?l(!1,q):i=setTimeout(()=>{l(!1,1e-7)},1e3)}D=!1}try{r=new IntersectionObserver(j,{...O,root:s.ownerDocument})}catch{r=new IntersectionObserver(j,O)}r.observe(t)}const u=yr(t),f=()=>l(n);return u.addEventListener("resize",f),l(!0),()=>{u.removeEventListener("resize",f),o()}}function fX(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=JS(t),h=i||s?[...f?Gd(f):[],...e?Gd(e):[]]:[];h.forEach(C=>{i&&C.addEventListener("scroll",n),s&&C.addEventListener("resize",n)});const m=f&&l?dX(f,n,s):null;let g=-1,b=null;o&&(b=new ResizeObserver(C=>{let[_]=C;_&&_.target===f&&b&&e&&(b.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var M;(M=b)==null||M.observe(e)})),n()}),f&&!u&&b.observe(f),e&&b.observe(e));let x,S=u?Xa(t):null;u&&k();function k(){const C=Xa(t);S&&!jL(S,C)&&n(),S=C,x=requestAnimationFrame(k)}return n(),()=>{var C;h.forEach(_=>{i&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),m?.(),(C=b)==null||C.disconnect(),b=null,u&&cancelAnimationFrame(x)}}const hX=HY,pX=UY,mX=$Y,gX=qY,yX=BY,eM=zY,bX=FY,vX=(t,e,n)=>{const r=new Map,i=n??{},s={...uX,...i.platform,_c:r};return PY(t,e,{...i,platform:s})};var xX=typeof document<"u",wX=function(){},Ep=xX?E.useLayoutEffect:wX;function Hm(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(!Hm(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)&&!Hm(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function LL(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function tM(t,e){const n=LL(t);return Math.round(e*n)/n}function i0(t){const e=E.useRef(t);return Ep(()=>{e.current=t}),e}function SX(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:l=!0,whileElementsMounted:u,open:f}=t,[h,m]=E.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,b]=E.useState(r);Hm(g,r)||b(r);const[x,S]=E.useState(null),[k,C]=E.useState(null),_=E.useCallback(U=>{U!==O.current&&(O.current=U,S(U))},[]),M=E.useCallback(U=>{U!==D.current&&(D.current=U,C(U))},[]),R=s||x,A=o||k,O=E.useRef(null),D=E.useRef(null),j=E.useRef(h),z=u!=null,q=i0(u),Z=i0(i),G=i0(f),ee=E.useCallback(()=>{if(!O.current||!D.current)return;const U={placement:e,strategy:n,middleware:g};Z.current&&(U.platform=Z.current),vX(O.current,D.current,U).then(ue=>{const Se={...ue,isPositioned:G.current!==!1};te.current&&!Hm(j.current,Se)&&(j.current=Se,zc.flushSync(()=>{m(Se)}))})},[g,e,n,Z,G]);Ep(()=>{f===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,m(U=>({...U,isPositioned:!1})))},[f]);const te=E.useRef(!1);Ep(()=>(te.current=!0,()=>{te.current=!1}),[]),Ep(()=>{if(R&&(O.current=R),A&&(D.current=A),R&&A){if(q.current)return q.current(R,A,ee);ee()}},[R,A,ee,q,z]);const fe=E.useMemo(()=>({reference:O,floating:D,setReference:_,setFloating:M}),[_,M]),B=E.useMemo(()=>({reference:R,floating:A}),[R,A]),L=E.useMemo(()=>{const U={position:n,left:0,top:0};if(!B.floating)return U;const ue=tM(B.floating,h.x),Se=tM(B.floating,h.y);return l?{...U,transform:"translate("+ue+"px, "+Se+"px)",...LL(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ue,top:Se}},[n,l,B.floating,h.x,h.y]);return E.useMemo(()=>({...h,update:ee,refs:fe,elements:B,floatingStyles:L}),[h,ee,fe,B,L])}const kX=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?eM({element:r.current,padding:i}).fn(n):{}:r?eM({element:r,padding:i}).fn(n):{}}}},CX=(t,e)=>{const n=hX(t);return{name:n.name,fn:n.fn,options:[t,e]}},EX=(t,e)=>{const n=pX(t);return{name:n.name,fn:n.fn,options:[t,e]}},TX=(t,e)=>({fn:bX(t).fn,options:[t,e]}),_X=(t,e)=>{const n=mX(t);return{name:n.name,fn:n.fn,options:[t,e]}},AX=(t,e)=>{const n=gX(t);return{name:n.name,fn:n.fn,options:[t,e]}},RX=(t,e)=>{const n=yX(t);return{name:n.name,fn:n.fn,options:[t,e]}},MX=(t,e)=>{const n=kX(t);return{name:n.name,fn:n.fn,options:[t,e]}};var NX=Object.defineProperty,zo=(t,e)=>NX(t,"name",{value:e,configurable:!0}),PL="Popper",[zL,$L]=Bc(PL),[OX,BL]=zL(PL),DX=zo(t=>{const{__scopePopper:e,children:n}=t,[r,i]=E.useState(null),[s,o]=E.useState(void 0);return y.jsx(OX,{scope:e,anchor:r,onAnchorChange:i,placementState:s,setPlacementState:o,children:n})},"Popper"),IX="PopperAnchor",jX=E.forwardRef(zo(function(e,n){const{__scopePopper:r,virtualRef:i,...s}=e,o=BL(IX,r),l=E.useRef(null),u=o.onAnchorChange,f=E.useCallback(S=>{l.current=S,S&&u(S)},[u]),h=an(n,f),m=E.useRef(null);E.useEffect(()=>{if(!i)return;const S=m.current;m.current=i.current,S!==m.current&&u(m.current)});const g=o.placementState&&_g(o.placementState),b=g?.[0],x=g?.[1];return i?null:y.jsx(Rn.div,{"data-radix-popper-side":b,"data-radix-popper-align":x,...s,ref:h})},"PopperAnchor")),VL="PopperContent",[LX,hne]=zL(VL),PX=E.forwardRef(zo(function(e,n){const{__scopePopper:r,side:i="bottom",sideOffset:s=0,align:o="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:f=!0,collisionBoundary:h=[],collisionPadding:m=0,sticky:g="partial",hideWhenDetached:b=!1,updatePositionStrategy:x="optimized",onPlaced:S,...k}=e,C=BL(VL,r),[_,M]=E.useState(null),R=an(n,M),[A,O]=E.useState(null),D=Lw(A),j=D?.width??0,z=D?.height??0,q=i+(o!=="center"?"-"+o:""),Z=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},G=Array.isArray(h)?h:[h],ee=G.length>0,te={padding:Z,boundary:G.filter(HL),altBoundary:ee},{refs:fe,floatingStyles:B,placement:L,isPositioned:U,middlewareData:ue}=SX({strategy:"fixed",placement:q,whileElementsMounted:zo((...oe)=>fX(...oe,{animationFrame:x==="always"}),"whileElementsMounted"),elements:{reference:C.anchor},middleware:[CX({mainAxis:s+z,alignmentAxis:l}),f&&EX({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?TX():void 0,...te}),f&&_X({...te}),AX({...te,apply:zo(({elements:oe,rects:pe,availableWidth:Ie,availableHeight:Ue})=>{const{width:Ze,height:ft}=pe.reference,vt=oe.floating.style;vt.setProperty("--radix-popper-available-width",`${Ie}px`),vt.setProperty("--radix-popper-available-height",`${Ue}px`),vt.setProperty("--radix-popper-anchor-width",`${Ze}px`),vt.setProperty("--radix-popper-anchor-height",`${ft}px`)},"apply")}),A&&MX({element:A,padding:u}),zX({arrowWidth:j,arrowHeight:z}),b&&RX({strategy:"referenceHidden",...te,boundary:ee?te.boundary:void 0})]}),Se=C.setPlacementState;ir(()=>(Se(L),()=>{Se(void 0)}),[L,Se]);const[V,Y]=_g(L),he=$i(S);ir(()=>{U&&he?.()},[U,he]);const ve=ue.arrow?.x,Ae=ue.arrow?.y,Re=ue.arrow?.centerOffset!==0,[Le,Te]=E.useState();return ir(()=>{_&&Te(window.getComputedStyle(_).zIndex)},[_]),y.jsx("div",{ref:fe.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:U?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Le,"--radix-popper-transform-origin":[ue.transformOrigin?.x,ue.transformOrigin?.y].join(" "),...ue.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:y.jsx(LX,{scope:r,placedSide:V,placedAlign:Y,onArrowChange:O,arrowX:ve,arrowY:Ae,shouldHideArrow:Re,children:y.jsx(Rn.div,{"data-side":V,"data-align":Y,...k,ref:R,style:{...k.style,animation:U?k.style?.animation:"none"}})})})},"PopperContent"));function HL(t){return t!==null}zo(HL,"isNotNull");var zX=zo(t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:r,middlewareData:i}=e,o=i.arrow?.centerOffset!==0,l=o?0:t.arrowWidth,u=o?0:t.arrowHeight,[f,h]=_g(n),m={start:"0%",center:"50%",end:"100%"}[h],g=(i.arrow?.x??0)+l/2,b=(i.arrow?.y??0)+u/2;let x="",S="";return f==="bottom"?(x=o?m:`${g}px`,S=`${-u}px`):f==="top"?(x=o?m:`${g}px`,S=`${r.floating.height+u}px`):f==="right"?(x=`${-u}px`,S=o?m:`${b}px`):f==="left"&&(x=`${r.floating.width+u}px`,S=o?m:`${b}px`),{data:{x,y:S}}}}),"transformOrigin");function _g(t){const[e,n="center"]=t.split("-");return[e,n]}zo(_g,"getSideAndAlignFromPlacement");var $X=DX,BX=jX,VX=PX,HX=Object.defineProperty,UX=(t,e)=>HX(t,"name",{value:e,configurable:!0}),FX=E.forwardRef(UX(function(e,n){const{container:r,...i}=e,[s,o]=E.useState(!1);ir(()=>o(!0),[]);const l=r||s&&globalThis?.document?.body;return l?zc.createPortal(y.jsx(Rn.div,{...i,ref:n}),l):null},"Portal")),qX=Object.defineProperty,Ls=(t,e)=>qX(t,"name",{value:e,configurable:!0});function UL(t,e){return E.useReducer((n,r)=>e[n][r]??n,t)}Ls(UL,"useStateMachine");var GX=Ls(t=>{const{present:e,children:n}=t,r=FL(e),i=typeof n=="function"?n({present:r.isPresent}):E.Children.only(n),s=qL(r.ref,GL(i));return typeof n=="function"||r.isPresent?E.cloneElement(i,{ref:s}):null},"Presence");function FL(t){const[e,n]=E.useState(),r=E.useRef(null),i=E.useRef(t),s=E.useRef("none"),o=E.useRef(void 0),l=t?"mounted":"unmounted",[u,f]=UL(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{u==="mounted"?(s.current=o.current??ac(r.current),o.current=void 0):s.current="none"},[u]),ir(()=>{const h=r.current,m=i.current;if(m!==t){const b=s.current,x=ac(h);t?(o.current=x,f("MOUNT")):x==="none"||h?.display==="none"?f("UNMOUNT"):f(m&&b!==x?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,f]),ir(()=>{if(e){let h;const m=e.ownerDocument.defaultView??window,g=Ls(x=>{const k=ac(r.current).includes(CSS.escape(x.animationName));if(x.target===e&&k&&(f("ANIMATION_END"),!i.current)){const C=e.style.animationFillMode;e.style.animationFillMode="forwards",h=m.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=C)})}},"handleAnimationEnd"),b=Ls(x=>{x.target===e&&(s.current=ac(r.current))},"handleAnimationStart");return e.addEventListener("animationstart",b),e.addEventListener("animationcancel",g),e.addEventListener("animationend",g),()=>{m.clearTimeout(h),e.removeEventListener("animationstart",b),e.removeEventListener("animationcancel",g),e.removeEventListener("animationend",g)}}else f("ANIMATION_END")},[e,f]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:E.useCallback(h=>{if(h){const m=getComputedStyle(h);r.current=m,o.current=ac(m)}else r.current=null;n(h)},[])}}Ls(FL,"usePresence");function Yx(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}Ls(Yx,"setRef");function qL(...t){const e=E.useRef(t);return e.current=t,E.useCallback(n=>{const r=e.current;let i=!1;const s=r.map(o=>{const l=Yx(o,n);return!i&&typeof l=="function"&&(i=!0),l});if(i)return()=>{for(let o=0;o<s.length;o++){const l=s[o];typeof l=="function"?l():Yx(r[o],null)}}},[])}Ls(qL,"useStableComposedRefs");function ac(t){return t?.animationName||"none"}Ls(ac,"getAnimationName");function GL(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}Ls(GL,"getElementRef");var WX=Object.defineProperty,KX=(t,e)=>WX(t,"name",{value:e,configurable:!0});function WL(t){const e=E.useRef({value:t,previous:t});return E.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}KX(WL,"usePrevious");var ZX=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"}),YX=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Yl=new WeakMap,Qh=new WeakMap,ep={},s0=0,KL=function(t){return t&&(t.host||KL(t.parentNode))},XX=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=KL(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})},JX=function(t,e,n,r){var i=XX(e,Array.isArray(t)?t:[t]);ep[n]||(ep[n]=new WeakMap);var s=ep[n],o=[],l=new Set,u=new Set(i),f=function(m){!m||l.has(m)||(l.add(m),f(m.parentNode))};i.forEach(f);var h=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(g){if(l.has(g))h(g);else try{var b=g.getAttribute(r),x=b!==null&&b!=="false",S=(Yl.get(g)||0)+1,k=(s.get(g)||0)+1;Yl.set(g,S),s.set(g,k),o.push(g),S===1&&x&&Qh.set(g,!0),k===1&&g.setAttribute(n,"true"),x||g.setAttribute(r,"true")}catch(C){console.error("aria-hidden: cannot operate on ",g,C)}})};return h(e),l.clear(),s0++,function(){o.forEach(function(m){var g=Yl.get(m)-1,b=s.get(m)-1;Yl.set(m,g),s.set(m,b),g||(Qh.has(m)||m.removeAttribute(r),Qh.delete(m)),b||m.removeAttribute(n)}),s0--,s0||(Yl=new WeakMap,Yl=new WeakMap,Qh=new WeakMap,ep={})}},QX=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=YX(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),JX(r,i,n,"aria-hidden")):function(){return null}},Ii=function(){return Ii=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},Ii.apply(this,arguments)};function ZL(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 eJ(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 Tp="right-scroll-bar-position",_p="width-before-scroll-bar",tJ="with-scroll-bars-hidden",nJ="--removed-body-scroll-bar-size";function o0(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function rJ(t,e){var n=E.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 iJ=typeof window<"u"?E.useLayoutEffect:E.useEffect,nM=new WeakMap;function sJ(t,e){var n=rJ(null,function(r){return t.forEach(function(i){return o0(i,r)})});return iJ(function(){var r=nM.get(n);if(r){var i=new Set(r),s=new Set(t),o=n.current;i.forEach(function(l){s.has(l)||o0(l,null)}),s.forEach(function(l){i.has(l)||o0(l,o)})}nM.set(n,t)},[t]),n}function oJ(t){return t}function aJ(t,e){e===void 0&&(e=oJ);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(l){return l!==o})}},assignSyncMedium:function(s){for(r=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(l){return s(l)},filter:function(){return n}}},assignMedium:function(s){r=!0;var o=[];if(n.length){var l=n;n=[],l.forEach(s),o=n}var u=function(){var h=o;o=[],h.forEach(s)},f=function(){return Promise.resolve().then(u)};f(),n={push:function(h){o.push(h),f()},filter:function(h){return o=o.filter(h),n}}}};return i}function lJ(t){t===void 0&&(t={});var e=aJ(null);return e.options=Ii({async:!0,ssr:!1},t),e}var YL=function(t){var e=t.sideCar,n=ZL(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 E.createElement(r,Ii({},n))};YL.isSideCarExport=!0;function cJ(t,e){return t.useMedium(e),YL}var XL=lJ(),a0=function(){},Ag=E.forwardRef(function(t,e){var n=E.useRef(null),r=E.useState({onScrollCapture:a0,onWheelCapture:a0,onTouchMoveCapture:a0}),i=r[0],s=r[1],o=t.forwardProps,l=t.children,u=t.className,f=t.removeScrollBar,h=t.enabled,m=t.shards,g=t.sideCar,b=t.noRelative,x=t.noIsolation,S=t.inert,k=t.allowPinchZoom,C=t.as,_=C===void 0?"div":C,M=t.gapMode,R=ZL(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=g,O=sJ([n,e]),D=Ii(Ii({},R),i);return E.createElement(E.Fragment,null,h&&E.createElement(A,{sideCar:XL,removeScrollBar:f,shards:m,noRelative:b,noIsolation:x,inert:S,setCallbacks:s,allowPinchZoom:!!k,lockRef:n,gapMode:M}),o?E.cloneElement(E.Children.only(l),Ii(Ii({},D),{ref:O})):E.createElement(_,Ii({},D,{className:u,ref:O}),l))});Ag.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ag.classNames={fullWidth:_p,zeroRight:Tp};var uJ=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function dJ(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=uJ();return e&&t.setAttribute("nonce",e),t}function fJ(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function hJ(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var pJ=function(){var t=0,e=null;return{add:function(n){t==0&&(e=dJ())&&(fJ(e,n),hJ(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},mJ=function(){var t=pJ();return function(e,n){E.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},JL=function(){var t=mJ(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},gJ={left:0,top:0,right:0,gap:0},l0=function(t){return parseInt(t||"",10)||0},yJ=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[l0(n),l0(r),l0(i)]},bJ=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return gJ;var e=yJ(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])}},vJ=JL(),mc="data-scroll-locked",xJ=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,l=t.gap;return n===void 0&&(n="margin"),`
287
- .`.concat(tJ,` {
288
- overflow: hidden `).concat(r,`;
289
- padding-right: `).concat(l,"px ").concat(r,`;
290
- }
291
- body[`).concat(mc,`] {
292
- overflow: hidden `).concat(r,`;
293
- overscroll-behavior: contain;
294
- `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
295
- padding-left: `.concat(i,`px;
296
- padding-top: `).concat(s,`px;
297
- padding-right: `).concat(o,`px;
298
- margin-left:0;
299
- margin-top:0;
300
- margin-right: `).concat(l,"px ").concat(r,`;
301
- `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
302
- }
303
-
304
- .`).concat(Tp,` {
305
- right: `).concat(l,"px ").concat(r,`;
306
- }
307
-
308
- .`).concat(_p,` {
309
- margin-right: `).concat(l,"px ").concat(r,`;
310
- }
311
-
312
- .`).concat(Tp," .").concat(Tp,` {
313
- right: 0 `).concat(r,`;
314
- }
315
-
316
- .`).concat(_p," .").concat(_p,` {
317
- margin-right: 0 `).concat(r,`;
318
- }
319
-
320
- body[`).concat(mc,`] {
321
- `).concat(nJ,": ").concat(l,`px;
322
- }
323
- `)},rM=function(){var t=parseInt(document.body.getAttribute(mc)||"0",10);return isFinite(t)?t:0},wJ=function(){E.useEffect(function(){return document.body.setAttribute(mc,(rM()+1).toString()),function(){var t=rM()-1;t<=0?document.body.removeAttribute(mc):document.body.setAttribute(mc,t.toString())}},[])},SJ=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;wJ();var s=E.useMemo(function(){return bJ(i)},[i]);return E.createElement(vJ,{styles:xJ(s,!e,i,n?"":"!important")})},Xx=!1;if(typeof window<"u")try{var tp=Object.defineProperty({},"passive",{get:function(){return Xx=!0,!0}});window.addEventListener("test",tp,tp),window.removeEventListener("test",tp,tp)}catch{Xx=!1}var Xl=Xx?{passive:!1}:!1,kJ=function(t){return t.tagName==="TEXTAREA"},QL=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!kJ(t)&&n[e]==="visible")},CJ=function(t){return QL(t,"overflowY")},EJ=function(t){return QL(t,"overflowX")},iM=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=e2(t,r);if(i){var s=t2(t,r),o=s[1],l=s[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},TJ=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},_J=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},e2=function(t,e){return t==="v"?CJ(e):EJ(e)},t2=function(t,e){return t==="v"?TJ(e):_J(e)},AJ=function(t,e){return t==="h"&&e==="rtl"?-1:1},RJ=function(t,e,n,r,i){var s=AJ(t,window.getComputedStyle(e).direction),o=s*r,l=n.target,u=e.contains(l),f=!1,h=o>0,m=0,g=0;do{if(!l)break;var b=t2(t,l),x=b[0],S=b[1],k=b[2],C=S-k-s*x;(x||C)&&e2(t,l)&&(m+=C,g+=x);var _=l.parentNode;l=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!u&&l!==document.body||u&&(e.contains(l)||e===l));return(h&&Math.abs(m)<1||!h&&Math.abs(g)<1)&&(f=!0),f},np=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},sM=function(t){return[t.deltaX,t.deltaY]},oM=function(t){return t&&"current"in t?t.current:t},MJ=function(t,e){return t[0]===e[0]&&t[1]===e[1]},NJ=function(t){return`
324
- .block-interactivity-`.concat(t,` {pointer-events: none;}
325
- .allow-interactivity-`).concat(t,` {pointer-events: all;}
326
- `)},OJ=0,Jl=[];function DJ(t){var e=E.useRef([]),n=E.useRef([0,0]),r=E.useRef(),i=E.useState(OJ++)[0],s=E.useState(JL)[0],o=E.useRef(t);E.useEffect(function(){o.current=t},[t]),E.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var S=eJ([t.lockRef.current],(t.shards||[]).map(oM),!0).filter(Boolean);return S.forEach(function(k){return k.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var l=E.useCallback(function(S,k){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!o.current.allowPinchZoom;var C=np(S),_=n.current,M="deltaX"in S?S.deltaX:_[0]-C[0],R="deltaY"in S?S.deltaY:_[1]-C[1],A,O=S.target,D=Math.abs(M)>Math.abs(R)?"h":"v";if("touches"in S&&D==="h"&&O.type==="range")return!1;var j=window.getSelection(),z=j&&j.anchorNode,q=z?z===O||z.contains(O):!1;if(q)return!1;var Z=iM(D,O);if(!Z)return!0;if(Z?A=D:(A=D==="v"?"h":"v",Z=iM(D,O)),!Z)return!1;if(!r.current&&"changedTouches"in S&&(M||R)&&(r.current=A),!A)return!0;var G=r.current||A;return RJ(G,k,S,G==="h"?M:R)},[]),u=E.useCallback(function(S){var k=S;if(!(!Jl.length||Jl[Jl.length-1]!==s)){var C="deltaY"in k?sM(k):np(k),_=e.current.filter(function(A){return A.name===k.type&&(A.target===k.target||k.target===A.shadowParent)&&MJ(A.delta,C)})[0];if(_&&_.should){k.cancelable&&k.preventDefault();return}if(!_){var M=(o.current.shards||[]).map(oM).filter(Boolean).filter(function(A){return A.contains(k.target)}),R=M.length>0?l(k,M[0]):!o.current.noIsolation;R&&k.cancelable&&k.preventDefault()}}},[]),f=E.useCallback(function(S,k,C,_){var M={name:S,delta:k,target:C,should:_,shadowParent:IJ(C)};e.current.push(M),setTimeout(function(){e.current=e.current.filter(function(R){return R!==M})},1)},[]),h=E.useCallback(function(S){n.current=np(S),r.current=void 0},[]),m=E.useCallback(function(S){f(S.type,sM(S),S.target,l(S,t.lockRef.current))},[]),g=E.useCallback(function(S){f(S.type,np(S),S.target,l(S,t.lockRef.current))},[]);E.useEffect(function(){return Jl.push(s),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Xl),document.addEventListener("touchmove",u,Xl),document.addEventListener("touchstart",h,Xl),function(){Jl=Jl.filter(function(S){return S!==s}),document.removeEventListener("wheel",u,Xl),document.removeEventListener("touchmove",u,Xl),document.removeEventListener("touchstart",h,Xl)}},[]);var b=t.removeScrollBar,x=t.inert;return E.createElement(E.Fragment,null,x?E.createElement(s,{styles:NJ(i)}):null,b?E.createElement(SJ,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function IJ(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const jJ=cJ(XL,DJ);var n2=E.forwardRef(function(t,e){return E.createElement(Ag,Ii({},t,{ref:e,sideCar:jJ}))});n2.classNames=Ag.classNames;var LJ=Object.defineProperty,Ot=(t,e)=>LJ(t,"name",{value:e,configurable:!0}),PJ=[" ","Enter","ArrowUp","ArrowDown"],zJ=[" ","Enter"],Dc="Select",[Rg,QS,$J]=dL(Dc),[ol,pne]=Bc(Dc,[$J,$L]),ek=$L(),[BJ,ea]=ol(Dc),[VJ,HJ]=ol(Dc);function r2(t){const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:s,value:o,defaultValue:l,onValueChange:u,dir:f,name:h,autoComplete:m,disabled:g,required:b,form:x,internal_do_not_use_render:S}=t,k=ek(e),[C,_]=E.useState(null),[M,R]=E.useState(null),[A,O]=E.useState(!1),D=gL(f),[j,z]=qp({prop:r,defaultProp:i??!1,onChange:s,caller:Dc}),[q,Z]=qp({prop:o,defaultProp:l,onChange:u,caller:Dc}),G=E.useRef(null),ee=E.useRef(q);E.useEffect(()=>{const Y=x?C?.ownerDocument.getElementById(x):C?.form;if(Y instanceof HTMLFormElement){const he=Ot(()=>Z(ee.current),"reset");return Y.addEventListener("reset",he),()=>Y.removeEventListener("reset",he)}},[x,C,Z]);const te=C?!!x||!!C.closest("form"):!0,[fe,B]=E.useState(new Set),L=GS(),U=Array.from(fe).map(Y=>Y.props.value).join(";"),ue=E.useCallback(Y=>{B(he=>new Set(he).add(Y))},[]),Se=E.useCallback(Y=>{B(he=>{const ve=new Set(he);return ve.delete(Y),ve})},[]),V={required:b,trigger:C,onTriggerChange:_,valueNode:M,onValueNodeChange:R,valueNodeHasChildren:A,onValueNodeHasChildrenChange:O,contentId:L,value:q,onValueChange:Z,open:j,onOpenChange:z,dir:D,triggerPointerDownPosRef:G,disabled:g,name:h,autoComplete:m,form:x,nativeOptions:fe,nativeSelectKey:U,isFormControl:te};return y.jsx($X,{...k,children:y.jsx(BJ,{scope:e,...V,children:y.jsx(Rg.Provider,{scope:e,children:y.jsx(VJ,{scope:e,onNativeOptionAdd:ue,onNativeOptionRemove:Se,children:o2(S)?S(V):n})})})})}Ot(r2,"SelectProvider");var Mg=Ot(t=>{const{__scopeSelect:e,children:n,...r}=t;return y.jsx(r2,{__scopeSelect:e,...r,internal_do_not_use_render:({isFormControl:i})=>y.jsxs(y.Fragment,{children:[n,i?y.jsx(iQ,{__scopeSelect:e}):null]})})},"Select"),UJ="SelectTrigger",Ng=E.forwardRef(Ot(function(e,n){const{__scopeSelect:r,disabled:i=!1,...s}=e,o=ek(r),l=ea(UJ,r),u=l.disabled||i,f=an(n,l.onTriggerChange),h=QS(r),m=E.useRef("touch"),[g,b,x]=tk(k=>{const C=h().filter(R=>!R.disabled),_=C.find(R=>R.value===l.value),M=nk(C,k,_);M!==void 0&&l.onValueChange(M.value)}),S=Ot(k=>{u||(l.onOpenChange(!0),x()),k&&(l.triggerPointerDownPosRef.current={x:Math.round(k.pageX),y:Math.round(k.pageY)})},"handleOpen");return y.jsx(BX,{asChild:!0,...o,children:y.jsx(Rn.button,{type:"button",role:"combobox","aria-controls":l.open?l.contentId:void 0,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":pf(l.value)?"":void 0,...s,ref:f,onClick:mn(s.onClick,k=>{k.currentTarget.focus(),m.current!=="mouse"&&S(k)}),onPointerDown:mn(s.onPointerDown,k=>{m.current=k.pointerType;const C=k.target;C.hasPointerCapture(k.pointerId)&&C.releasePointerCapture(k.pointerId),k.button===0&&k.ctrlKey===!1&&k.pointerType==="mouse"&&(S(k),k.preventDefault())}),onKeyDown:mn(s.onKeyDown,k=>{const C=g.current!=="";!(k.ctrlKey||k.altKey||k.metaKey)&&k.key.length===1&&b(k.key),!(C&&k.key===" ")&&PJ.includes(k.key)&&(S(),k.preventDefault())})})})},"SelectTrigger")),FJ="SelectValue",Og=E.forwardRef(Ot(function(e,n){const{__scopeSelect:r,className:i,style:s,children:o,placeholder:l="",...u}=e,f=ea(FJ,r),{onValueNodeHasChildrenChange:h}=f,m=o!==void 0,g=an(n,f.onValueNodeChange);ir(()=>{h(m)},[h,m]);const b=pf(f.value);return y.jsx(Rn.span,{...u,asChild:b?!1:u.asChild,ref:g,style:{pointerEvents:"none"},children:y.jsx(E.Fragment,{children:b?l:o},b?"placeholder":"value")})},"SelectValue")),Dg=E.forwardRef(Ot(function(e,n){const{__scopeSelect:r,children:i,...s}=e;return y.jsx(Rn.span,{"aria-hidden":!0,...s,ref:n,children:i||"▼"})},"SelectIcon")),qJ="SelectPortal",[GJ,WJ]=ol(qJ,{forceMount:void 0}),Ig=Ot(t=>{const{__scopeSelect:e,forceMount:n,...r}=t;return y.jsx(GJ,{scope:t.__scopeSelect,forceMount:n,children:y.jsx(FX,{asChild:!0,...r})})},"SelectPortal"),Ja="SelectContent",jg=E.forwardRef(Ot(function(e,n){const r=WJ(Ja,e.__scopeSelect),{forceMount:i=r.forceMount,...s}=e,o=ea(Ja,e.__scopeSelect),[l,u]=E.useState();return ir(()=>{u(new DocumentFragment)},[]),y.jsx(GX,{present:i||o.open,children:({present:f})=>f?y.jsx(YJ,{...s,ref:n}):y.jsx(KJ,{...s,fragment:l})})},"SelectContent")),KJ=E.forwardRef(Ot(function(e,n){const{__scopeSelect:r,children:i,fragment:s}=e;return s?zc.createPortal(y.jsx(i2,{scope:r,children:y.jsx(Rg.Slot,{scope:r,children:y.jsx("div",{ref:n,children:i})})}),s):null},"SelectContentFragment")),di=10,[i2,Lg]=ol(Ja),ZJ=Ha("SelectContent.RemoveScroll"),YJ=E.forwardRef(Ot(function(e,n){const{__scopeSelect:r}=e,{position:i="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:l,side:u,sideOffset:f,align:h,alignOffset:m,arrowPadding:g,collisionBoundary:b,collisionPadding:x,sticky:S,hideWhenDetached:k,avoidCollisions:C,..._}=e,M=ea(Ja,r),[R,A]=E.useState(null),[O,D]=E.useState(null),j=an(n,A),[z,q]=E.useState(null),[Z,G]=E.useState(null),ee=QS(r),[te,fe]=E.useState(!1),B=E.useRef(!1);E.useEffect(()=>{if(R)return QX(R)},[R]),FS();const L=E.useCallback(Te=>{const[oe,...pe]=ee().map(Ze=>Ze.ref.current),[Ie]=pe.slice(-1),Ue=document.activeElement;for(const Ze of Te)if(Ze===Ue||(Ze?.scrollIntoView({block:"nearest"}),Ze===oe&&O&&(O.scrollTop=0),Ze===Ie&&O&&(O.scrollTop=O.scrollHeight),Ze?.focus(),document.activeElement!==Ue))return},[ee,O]),U=E.useCallback(()=>L([z,R]),[L,z,R]);E.useEffect(()=>{te&&U()},[te,U]);const{onOpenChange:ue,triggerPointerDownPosRef:Se}=M;E.useEffect(()=>{if(R){let Te={x:0,y:0};const oe=Ot(Ie=>{Te={x:Math.abs(Math.round(Ie.pageX)-(Se.current?.x??0)),y:Math.abs(Math.round(Ie.pageY)-(Se.current?.y??0))}},"handlePointerMove"),pe=Ot(Ie=>{Te.x<=10&&Te.y<=10?Ie.preventDefault():Ie.composedPath().includes(R)||ue(!1),document.removeEventListener("pointermove",oe),Se.current=null},"handlePointerUp");return Se.current!==null&&(document.addEventListener("pointermove",oe),document.addEventListener("pointerup",pe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",oe),document.removeEventListener("pointerup",pe,{capture:!0})}}},[R,ue,Se]),E.useEffect(()=>{const Te=Ot(()=>ue(!1),"close");return window.addEventListener("blur",Te),window.addEventListener("resize",Te),()=>{window.removeEventListener("blur",Te),window.removeEventListener("resize",Te)}},[ue]);const[V,Y]=tk(Te=>{const oe=ee().filter(Ue=>!Ue.disabled),pe=oe.find(Ue=>Ue.ref.current===document.activeElement),Ie=nk(oe,Te,pe);Ie&&setTimeout(()=>Ie.ref.current?.focus())}),he=E.useCallback((Te,oe,pe)=>{const Ie=!B.current&&!pe;(M.value!==void 0&&M.value===oe||Ie)&&(q(Te),Ie&&(B.current=!0))},[M.value]),ve=E.useCallback(()=>R?.focus(),[R]),Ae=E.useCallback((Te,oe,pe)=>{const Ie=!B.current&&!pe;(M.value!==void 0&&M.value===oe||Ie)&&G(Te)},[M.value]),Re=i==="popper"?aM:XJ,Le=Re===aM?{side:u,sideOffset:f,align:h,alignOffset:m,arrowPadding:g,collisionBoundary:b,collisionPadding:x,sticky:S,hideWhenDetached:k,avoidCollisions:C}:{};return y.jsx(i2,{scope:r,content:R,viewport:O,onViewportChange:D,itemRefCallback:he,selectedItem:z,onItemLeave:ve,itemTextRefCallback:Ae,focusSelectedItem:U,selectedItemText:Z,position:i,isPositioned:te,searchRef:V,children:y.jsx(n2,{as:ZJ,allowPinchZoom:!0,children:y.jsx(wY,{asChild:!0,trapped:M.open,onMountAutoFocus:Te=>{Te.preventDefault()},onUnmountAutoFocus:mn(s,Te=>{M.trigger?.focus({preventScroll:!0}),Te.preventDefault()}),children:y.jsx(mY,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:Te=>Te.preventDefault(),onDismiss:()=>M.onOpenChange(!1),children:y.jsx(Re,{role:"listbox",id:M.contentId,"data-state":M.open?"open":"closed",dir:M.dir,onContextMenu:Te=>Te.preventDefault(),..._,...Le,onPlaced:()=>fe(!0),ref:j,style:{display:"flex",flexDirection:"column",outline:"none",..._.style},onKeyDown:mn(_.onKeyDown,Te=>{const oe=Te.ctrlKey||Te.altKey||Te.metaKey;if(Te.key==="Tab"&&Te.preventDefault(),!oe&&Te.key.length===1&&Y(Te.key),["ArrowUp","ArrowDown","Home","End"].includes(Te.key)){let Ie=ee().filter(Ue=>!Ue.disabled).map(Ue=>Ue.ref.current);if(["ArrowUp","End"].includes(Te.key)&&(Ie=Ie.slice().reverse()),["ArrowUp","ArrowDown"].includes(Te.key)){const Ue=Te.target,Ze=Ie.indexOf(Ue);Ie=Ie.slice(Ze+1)}setTimeout(()=>L(Ie)),Te.preventDefault()}})})})})})})},"SelectContentImpl")),XJ=E.forwardRef(Ot(function(e,n){const{__scopeSelect:r,onPlaced:i,...s}=e,o=ea(Ja,r),l=Lg(Ja,r),[u,f]=E.useState(null),[h,m]=E.useState(null),g=an(n,m),b=QS(r),x=E.useRef(!1),S=E.useRef(!0),{viewport:k,selectedItem:C,selectedItemText:_,focusSelectedItem:M}=l,R=E.useCallback(()=>{if(o.trigger&&o.valueNode&&u&&h&&k&&C&&_){const j=o.trigger.getBoundingClientRect(),z=h.getBoundingClientRect(),q=o.valueNode.getBoundingClientRect(),Z=_.getBoundingClientRect();if(o.dir!=="rtl"){const Ue=Z.left-z.left,Ze=q.left-Ue,ft=j.left-Ze,vt=j.width+ft,Kt=Math.max(vt,z.width),vn=window.innerWidth-di,Zt=Vx(Ze,[di,Math.max(di,vn-Kt)]);u.style.minWidth=vt+"px",u.style.left=Zt+"px"}else{const Ue=z.right-Z.right,Ze=window.innerWidth-q.right-Ue,ft=window.innerWidth-j.right-Ze,vt=j.width+ft,Kt=Math.max(vt,z.width),vn=window.innerWidth-di,Zt=Vx(Ze,[di,Math.max(di,vn-Kt)]);u.style.minWidth=vt+"px",u.style.right=Zt+"px"}const G=b(),ee=window.innerHeight-di*2,te=k.scrollHeight,fe=window.getComputedStyle(h),B=parseInt(fe.borderTopWidth,10),L=parseInt(fe.paddingTop,10),U=parseInt(fe.borderBottomWidth,10),ue=parseInt(fe.paddingBottom,10),Se=B+L+te+ue+U,V=Math.min(C.offsetHeight*5,Se),Y=window.getComputedStyle(k),he=parseInt(Y.paddingTop,10),ve=parseInt(Y.paddingBottom,10),Ae=j.top+j.height/2-di,Re=ee-Ae,Le=C.offsetHeight/2,Te=C.offsetTop+Le,oe=B+L+Te,pe=Se-oe;if(oe<=Ae){const Ue=G.length>0&&C===G[G.length-1].ref.current;u.style.bottom="0px";const Ze=h.clientHeight-k.offsetTop-k.offsetHeight,ft=Math.max(Re,Le+(Ue?ve:0)+Ze+U),vt=oe+ft;u.style.height=vt+"px"}else{const Ue=G.length>0&&C===G[0].ref.current;u.style.top="0px";const ft=Math.max(Ae,B+k.offsetTop+(Ue?he:0)+Le)+pe;u.style.height=ft+"px",k.scrollTop=oe-Ae+k.offsetTop}u.style.margin=`${di}px 0`,u.style.minHeight=V+"px",u.style.maxHeight=ee+"px",i?.(),requestAnimationFrame(()=>x.current=!0)}},[b,o.trigger,o.valueNode,u,h,k,C,_,o.dir,i]);ir(()=>R(),[R]);const[A,O]=E.useState();ir(()=>{h&&O(window.getComputedStyle(h).zIndex)},[h]);const D=E.useCallback(j=>{j&&S.current===!0&&(R(),M?.(),S.current=!1)},[R,M]);return y.jsx(JJ,{scope:r,contentWrapper:u,shouldExpandOnScrollRef:x,onScrollButtonChange:D,children:y.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:A},children:y.jsx(Rn.div,{...s,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})},"SelectItemAlignedPosition")),aM=E.forwardRef(Ot(function(e,n){const{__scopeSelect:r,align:i="start",collisionPadding:s=di,...o}=e,l=ek(r);return y.jsx(VX,{...l,...o,ref:n,align:i,collisionPadding:s,style:{boxSizing:"border-box",...o.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)"}})},"SelectPopperPosition")),[JJ,QJ]=ol(Ja,{}),lM="SelectViewport",Pg=E.forwardRef(Ot(function(e,n){const{__scopeSelect:r,nonce:i,...s}=e,o=Lg(lM,r),l=QJ(lM,r),u=an(n,o.onViewportChange),f=E.useRef(0);return y.jsxs(y.Fragment,{children:[y.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:i}),y.jsx(Rg.Slot,{scope:r,children:y.jsx(Rn.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:mn(s.onScroll,h=>{const m=h.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:b}=l;if(b?.current&&g){const x=Math.abs(f.current-m.scrollTop);if(x>0){const S=window.innerHeight-di*2,k=parseFloat(g.style.minHeight),C=parseFloat(g.style.height),_=Math.max(k,C);if(_<S){const M=_+x,R=Math.min(S,M),A=M-R;g.style.height=R+"px",g.style.bottom==="0px"&&(m.scrollTop=A>0?A:0,g.style.justifyContent="flex-end")}}}f.current=m.scrollTop})})})]})},"SelectViewport")),eQ="SelectGroup",[mne,gne]=ol(eQ),Jx="SelectItem",[tQ,s2]=ol(Jx),zg=E.forwardRef(Ot(function(e,n){const{__scopeSelect:r,value:i,disabled:s=!1,textValue:o,...l}=e,u=ea(Jx,r),f=Lg(Jx,r),h=u.value===i,[m,g]=E.useState(o??""),[b,x]=E.useState(!1),S=$i(R=>f.itemRefCallback?.(R,i,s)),k=an(n,S),C=GS(),_=E.useRef("touch"),M=Ot(()=>{s||(u.onValueChange(i),u.onOpenChange(!1))},"handleSelect");return y.jsx(tQ,{scope:r,value:i,disabled:s,textId:C,isSelected:h,onItemTextChange:E.useCallback(R=>{g(A=>A||(R?.textContent??"").trim())},[]),children:y.jsx(Rg.ItemSlot,{scope:r,value:i,disabled:s,textValue:m,children:y.jsx(Rn.div,{role:"option","aria-labelledby":C,"data-highlighted":b?"":void 0,"aria-selected":h&&b,"data-state":h?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...l,ref:k,onFocus:mn(l.onFocus,()=>x(!0)),onBlur:mn(l.onBlur,()=>x(!1)),onClick:mn(l.onClick,()=>{_.current!=="mouse"&&M()}),onPointerUp:mn(l.onPointerUp,()=>{_.current==="mouse"&&M()}),onPointerDown:mn(l.onPointerDown,R=>{_.current=R.pointerType}),onPointerMove:mn(l.onPointerMove,R=>{_.current=R.pointerType,s?f.onItemLeave?.():_.current==="mouse"&&R.currentTarget.focus({preventScroll:!0})}),onPointerLeave:mn(l.onPointerLeave,R=>{R.currentTarget===document.activeElement&&f.onItemLeave?.()}),onKeyDown:mn(l.onKeyDown,R=>{s||R.target!==R.currentTarget||f.searchRef?.current!==""&&R.key===" "||(zJ.includes(R.key)&&M(),R.key===" "&&R.preventDefault())})})})})},"SelectItem")),rp="SelectItemText",$g=E.forwardRef(Ot(function(e,n){const{__scopeSelect:r,className:i,style:s,...o}=e,l=ea(rp,r),u=Lg(rp,r),f=s2(rp,r),h=HJ(rp,r),[m,g]=E.useState(null),b=$i(M=>u.itemTextRefCallback?.(M,f.value,f.disabled)),x=an(n,g,f.onItemTextChange,b),S=m?.textContent,k=E.useMemo(()=>y.jsx("option",{value:f.value,disabled:f.disabled,children:S},f.value),[f.disabled,f.value,S]),{onNativeOptionAdd:C,onNativeOptionRemove:_}=h;return ir(()=>(C(k),()=>_(k)),[C,_,k]),y.jsxs(y.Fragment,{children:[y.jsx(Rn.span,{id:f.textId,...o,ref:x}),f.isSelected&&l.valueNode&&!l.valueNodeHasChildren&&!pf(l.value)?zc.createPortal(o.children,l.valueNode):null]})},"SelectItemText")),nQ="SelectItemIndicator",Bg=E.forwardRef(Ot(function(e,n){const{__scopeSelect:r,...i}=e;return s2(nQ,r).isSelected?y.jsx(Rn.span,{"aria-hidden":!0,...i,ref:n}):null},"SelectItemIndicator")),rQ="SelectBubbleInput",iQ=E.forwardRef(Ot(function({__scopeSelect:e,...n},r){const i=ea(rQ,e),{value:s,onValueChange:o,required:l,disabled:u,name:f,autoComplete:h,form:m}=i,{nativeOptions:g,nativeSelectKey:b}=i,x=E.useRef(null),S=an(r,x),k=s??"",C=WL(k),_=Array.from(g).some(M=>(M.props.value??"")==="");return E.useEffect(()=>{const M=x.current;if(!M)return;const R=window.HTMLSelectElement.prototype,O=Object.getOwnPropertyDescriptor(R,"value").set;if(C!==k&&O){const D=new Event("change",{bubbles:!0});O.call(M,k),M.dispatchEvent(D)}},[C,k]),y.jsxs(Rn.select,{"aria-hidden":!0,required:l,tabIndex:-1,name:f,autoComplete:h,disabled:u,form:m,onChange:M=>o(M.target.value),...n,style:{...ZX,...n.style},ref:S,defaultValue:k,children:[pf(s)&&!_?y.jsx("option",{value:""}):null,Array.from(g)]},b)},"SelectBubbleInput"));function o2(t){return typeof t=="function"}Ot(o2,"isFunction");function pf(t){return t===""||t===void 0}Ot(pf,"shouldShowPlaceholder");function tk(t){const e=$i(t),n=E.useRef(""),r=E.useRef(0),i=E.useCallback(o=>{const l=n.current+o;e(l),Ot((function u(f){n.current=f,window.clearTimeout(r.current),f!==""&&(r.current=window.setTimeout(()=>u(""),1e3))}),"updateSearch")(l)},[e]),s=E.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return E.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}Ot(tk,"useTypeaheadSearch");function nk(t,e,n){const i=e.length>1&&Array.from(e).every(f=>f===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let o=a2(t,Math.max(s,0));i.length===1&&(o=o.filter(f=>f!==n));const u=o.find(f=>f.textValue.toLowerCase().startsWith(i.toLowerCase()));return u!==n?u:void 0}Ot(nk,"findNextItem");function a2(t,e){return t.map((n,r)=>t[(e+r)%t.length])}Ot(a2,"wrapArray");function rk({id:t,value:e,field:n,readOnly:r,onChange:i}){const s=n.options?.filter(Boolean)??[],o=typeof e=="string"&&s.includes(e)?e:s[0]??"";return s.length===0?y.jsx("input",{id:t,type:"text",readOnly:r,value:o,disabled:!0}):y.jsxs(Mg,{value:o,onValueChange:i,disabled:r,children:[y.jsxs(Ng,{id:t,className:"vertebr-select-trigger",children:[y.jsx("span",{className:"vertebr-select-value",children:y.jsx(Og,{children:ud(o,n)})}),y.jsx(Dg,{className:"vertebr-select-icon",children:y.jsx(sQ,{})})]}),y.jsx(Ig,{children:y.jsx(jg,{className:"vertebr-select-content",position:"popper",sideOffset:6,children:y.jsx(Pg,{className:"vertebr-select-viewport",children:s.map(l=>y.jsxs(zg,{value:l,className:"vertebr-select-item",children:[y.jsx($g,{children:ud(l,n)}),y.jsx(Bg,{className:"vertebr-select-check",children:y.jsx(oQ,{})})]},l))})})})]})}function sQ(){return y.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:y.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function oQ(){return y.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:y.jsx("path",{d:"M2.5 6.2 5 8.7 9.5 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function aQ(t){return Array.isArray(t)?t.map(e=>String(e).trim()).filter(Boolean):[]}function lQ(t,e){const n=new Set(t),r=e.filter(s=>n.has(s)),i=t.filter(s=>!r.includes(s));return[...r.map(s=>({id:s,on:!0})),...i.map(s=>({id:s,on:!1}))]}function cQ({id:t,value:e,field:n,readOnly:r,onChange:i}){const s=n.options?.filter(Boolean)??[],o=aQ(e),l=lQ(s,o),u=f=>{i(f.filter(h=>h.on).map(h=>h.id))};return y.jsx("ul",{id:t,className:"vertebr-enum-list",children:l.map((f,h)=>y.jsxs("li",{className:"vertebr-enum-list-row","data-on":f.on,children:[y.jsxs("label",{className:"vertebr-enum-list-label",children:[y.jsx("input",{type:"checkbox",checked:f.on,disabled:r,onChange:m=>{const g=l.map(b=>b.id===f.id?{...b,on:m.target.checked}:b);u(g)}}),y.jsx("span",{children:ud(f.id,n)})]}),y.jsxs("div",{className:"vertebr-enum-list-move",children:[y.jsx("button",{type:"button","aria-label":`Move ${ud(f.id,n)} up`,disabled:r||h===0,onClick:()=>{if(h===0)return;const m=[...l],g=m[h];m[h]=m[h-1],m[h-1]=g,u(m)},children:"↑"}),y.jsx("button",{type:"button","aria-label":`Move ${ud(f.id,n)} down`,disabled:r||h===l.length-1,onClick:()=>{if(h>=l.length-1)return;const m=[...l],g=m[h];m[h]=m[h+1],m[h+1]=g,u(m)},children:"↓"})]})]},f.id))})}function uQ({id:t,name:e,value:n,asCents:r=!0,readOnly:i,onBlur:s,onChange:o,inputRef:l}){const[u,f]=E.useState(()=>bv(n,r));E.useEffect(()=>{f(bv(n,r))},[n,r]);const h=typeof n=="number"&&Number.isFinite(n)?X0(n,{asCents:r}):null;return y.jsxs("div",{className:"vertebr-field-money",children:[y.jsx("span",{className:"vertebr-field-money-prefix","aria-hidden":"true",children:"$"}),y.jsx("input",{id:t,name:e,ref:l,type:"text",inputMode:"decimal",autoComplete:"off",readOnly:i,value:u,placeholder:"0.00","aria-label":h?`Price ${h}`:"Price",onChange:m=>{const g=m.target.value;f(g),o(YF(g,r))},onBlur:()=>{f(bv(n,r)),s?.()}})]})}function Um({fieldKey:t,field:e,groupLabel:n,variant:r,schema:i,watched:s,form:o,uploads:l,onUpload:u,galleryUpload:f,onListGallery:h,onUploadGallery:m,fonts:g,fontsLoading:b,onListFonts:x,onRefreshFonts:S,hideImagePreview:k,hideUpload:C,visibilityGroup:_,settingsRow:M}){const R=KU(t,e,n),A=oF(t,i,_??n),O=!A||s?.[A]!==!1,D=!k&&e.type!=="file[]"&&Va(t,e)&&!!Fp(s?.[t]);return e.type==="boolean"?M?y.jsx(cs,{control:o.control,name:t,render:({field:j})=>y.jsxs("li",{className:"vertebr-settings-list-row","data-on":j.value?"true":"false",children:[y.jsxs("div",{className:"vertebr-settings-list-copy",children:[y.jsx(yv,{htmlFor:t,children:R}),e.description?y.jsx("p",{className:"vertebr-settings-list-desc",children:e.description}):null]}),y.jsx(z_,{className:"vertebr-switch",id:t,checked:!!j.value,onCheckedChange:j.onChange,children:y.jsx($_,{className:"vertebr-switch-thumb"})})]})}):y.jsxs("div",{className:"vertebr-switch-row",children:[y.jsxs("div",{className:"vertebr-switch-row-copy",children:[y.jsx(yv,{htmlFor:t,children:R}),e.description?y.jsx("p",{className:"vertebr-switch-row-desc",children:e.description}):null]}),y.jsx(cs,{control:o.control,name:t,render:({field:j})=>y.jsx(z_,{className:"vertebr-switch",id:t,checked:!!j.value,onCheckedChange:j.onChange,children:y.jsx($_,{className:"vertebr-switch-thumb"})})})]}):y.jsxs("div",{className:"vertebr-field","data-span":QU(t,e,r),"data-kind":Va(t,e)?"image":void 0,"data-storefront":A?O?"on":"off":void 0,children:[y.jsxs("div",{className:"vertebr-field-head",children:[y.jsx(yv,{htmlFor:t,children:R}),A?y.jsx(NO,{name:A,label:R,form:o}):null]}),D?y.jsxs("div",{className:"vertebr-field-media",children:[y.jsx("img",{src:Fp(s[t])??"",alt:""}),y.jsx("input",{id:t,type:"text",readOnly:e.readOnly,...o.register(t)})]}):e.type==="richtext"||fO(t,e)?y.jsx(cs,{control:o.control,name:t,render:({field:j})=>y.jsx(nY,{id:t,name:j.name,inputRef:j.ref,value:typeof j.value=="string"?j.value:"",readOnly:e.readOnly,recordImages:YU(i,s),galleryUpload:f,onListGallery:h,onUploadGallery:m,onBlur:j.onBlur,onChange:j.onChange})}):e.type==="file[]"?y.jsx(cs,{control:o.control,name:t,render:({field:j})=>{const z=G0(j.value);return y.jsx("div",{className:"vertebr-field-files",children:z.length>0?y.jsx("ul",{className:"vertebr-field-files-list",children:z.map(q=>y.jsxs("li",{children:[y.jsx("img",{src:q,alt:""}),y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>j.onChange(z.filter(Z=>Z!==q)),children:"Remove"})]},q))}):y.jsx("p",{className:"vertebr-field-files-empty",children:"No photos yet"})})}}):e.type==="number"&&DO(t,e)?y.jsx(cs,{control:o.control,name:t,render:({field:j})=>y.jsx(uQ,{id:t,name:j.name,inputRef:j.ref,value:j.value,asCents:Bw(t,e)||/^pricing$/i.test(n),readOnly:e.readOnly,onBlur:j.onBlur,onChange:j.onChange})}):e.type==="number"?y.jsx(cs,{control:o.control,name:t,render:({field:j})=>y.jsx("input",{id:t,type:"number",readOnly:e.readOnly,value:typeof j.value=="number"&&Number.isFinite(j.value)?j.value:"",onBlur:j.onBlur,onChange:z=>{const q=z.target.value;j.onChange(q===""?void 0:Number(q))},name:j.name,ref:j.ref})}):e.type==="enum"?y.jsx(cs,{control:o.control,name:t,render:({field:j})=>y.jsx(rk,{id:t,value:j.value,field:e,readOnly:e.readOnly,onChange:j.onChange})}):e.type==="enum[]"?y.jsx(cs,{control:o.control,name:t,render:({field:j})=>y.jsx(cQ,{id:t,value:j.value,field:e,readOnly:e.readOnly,onChange:j.onChange})}):e.type==="font"?y.jsx(cs,{control:o.control,name:t,render:({field:j})=>y.jsx(XF,{id:t,value:j.value,label:e.label,description:e.description,readOnly:e.readOnly,fonts:g??[],loading:b,onChange:j.onChange,onRefreshFonts:S})}):pO(t,e)?y.jsx("textarea",{id:t,rows:5,readOnly:e.readOnly,...o.register(t)}):y.jsx("input",{id:t,type:"text",readOnly:e.readOnly,...o.register(t)}),!C&&l?.[t]&&u&&!e.readOnly?y.jsx(Pc,{meta:l[t],multiple:e.type==="file[]",onUpload:async j=>{const q=(await u(t,j)).map(Z=>Z.url).filter(Boolean);if(q.length){if(e.type==="file[]"){o.setValue(t,[...G0(o.getValues(t)),...q],{shouldDirty:!0,shouldTouch:!0});return}o.setValue(t,q[0],{shouldDirty:!0,shouldTouch:!0})}}}):null]})}function l2({form:t,isDirty:e,status:n,tone:r,onDiscard:i,submitLabel:s="Save changes"}){return y.jsxs("div",{className:"vertebr-actions",children:[y.jsx("button",{className:"vertebr-btn vertebr-btn-primary",type:"submit",disabled:t.formState.isSubmitting||!e,children:t.formState.isSubmitting?"Saving…":s}),e?y.jsx("button",{className:"vertebr-btn",type:"button",onClick:i,children:"Discard"}):null,e?y.jsx("span",{className:"vertebr-dirty",children:"Unsaved"}):n?y.jsx("span",{className:"vertebr-status","data-tone":r,children:n}):null,y.jsx("span",{className:"vertebr-actions-spacer"}),y.jsx("span",{className:"vertebr-kbd",children:"⌘S"})]})}function dQ({schema:t,groups:e,watched:n,form:r,uploads:i,onUpload:s,galleryUpload:o,onListGallery:l,onUploadGallery:u,onSubmit:f,isDirty:h,status:m,tone:g,onDiscard:b,submitLabel:x,hideActions:S}){const k=dF(t,n),C=k?Fp(n?.[k])??"":"",_=e.filter(A=>/^(Media|Display|Status)$/i.test(A.id)),M=e.filter(A=>!/^(Media|Display|Status)$/i.test(A.id)),R={variant:"record",schema:t,watched:n,form:r,uploads:i,onUpload:s,galleryUpload:o,onListGallery:l,onUploadGallery:u};return y.jsxs("form",{className:"vertebr-form","data-variant":"record",onSubmit:f,children:[y.jsx("div",{className:"vertebr-form-scroll",children:y.jsxs("div",{className:"vertebr-record-layout",children:[y.jsxs("aside",{className:"vertebr-record-aside",children:[y.jsx("div",{className:"vertebr-record-preview",children:C&&Dd(C)?y.jsx("img",{src:C,alt:""}):y.jsx("div",{className:"vertebr-record-preview-empty",children:"No image"})}),k&&i?.[k]&&s?y.jsx(Pc,{meta:i[k],label:"Drop a new image or browse",onUpload:async A=>{const[O]=await s(k,A);O?.url&&r.setValue(k,O.url,{shouldDirty:!0,shouldTouch:!0})}}):null,_.map(A=>y.jsxs("div",{className:"vertebr-record-block","data-layout":/^inventory$/i.test(A.id)?"chips":void 0,children:[y.jsx(cM,{groupId:A.id,label:A.label,schema:t,form:r}),y.jsx("div",{className:"vertebr-form-fields","data-layout":JU(A.fields[0]?.[0]??"",A.fields[0]?.[1])?"chips":void 0,children:A.fields.map(([O,D])=>y.jsx(Um,{fieldKey:O,field:D,groupLabel:A.label,visibilityGroup:A.id,hideImagePreview:!0,hideUpload:O===k,...R},O))})]},A.id))]}),y.jsx("div",{className:"vertebr-record-main",children:M.map(A=>{const O=/^inventory$/i.test(A.id),D=/^specs$/i.test(A.id),j=Iw(A.id,t),z=!j||n?.[j]!==!1;return y.jsxs("div",{className:"vertebr-record-block","data-layout":O?"chips":D?"specs":void 0,"data-storefront":j?z?"on":"off":void 0,children:[y.jsx(cM,{groupId:A.id,label:A.label,schema:t,form:r}),y.jsx("div",{className:"vertebr-form-fields","data-layout":O?"chips":D?"specs":void 0,children:A.fields.map(([q,Z])=>y.jsx(Um,{fieldKey:q,field:Z,groupLabel:A.label,visibilityGroup:A.id,...R},q))})]},A.id)})})]})}),S?null:y.jsx(l2,{form:r,isDirty:h,status:m,tone:g,onDiscard:b,submitLabel:x})]})}function cM({groupId:t,label:e,schema:n,form:r}){const i=Iw(t,n);return y.jsxs("div",{className:"vertebr-record-block-label",children:[y.jsx("span",{children:e}),i?y.jsx(NO,{name:i,label:e,form:r}):null]})}function fQ({schema:t,groups:e,watched:n,form:r,uploads:i,onUpload:s,galleryUpload:o,onListGallery:l,onUploadGallery:u,fonts:f,fontsLoading:h,onListFonts:m,onRefreshFonts:g,onSubmit:b,isDirty:x,status:S,tone:k,onDiscard:C,submitLabel:_,hideActions:M}){const R=e.length===1;return y.jsxs("form",{className:"vertebr-form","data-variant":"config",onSubmit:b,children:[y.jsx("div",{className:"vertebr-form-scroll",children:e.map(A=>{const O=XU(A.fields),D=!R||A.id!=="General"&&A.fields.length>0;return y.jsxs("div",{className:"vertebr-form-section","data-plain":R&&!D?"true":void 0,children:[D?y.jsxs("div",{className:"vertebr-form-section-head",children:[y.jsx("h3",{children:A.label}),y.jsx("span",{className:"vertebr-form-section-count",children:A.fields.length})]}):null,y.jsx("div",{className:"vertebr-form-fields","data-layout":O?"settings":void 0,children:O?y.jsx("ul",{className:"vertebr-settings-list",children:A.fields.map(([j,z])=>y.jsx(Um,{fieldKey:j,field:z,groupLabel:A.label,variant:"config",schema:t,watched:n,form:r,uploads:i,onUpload:s,galleryUpload:o,onListGallery:l,onUploadGallery:u,fonts:f,fontsLoading:h,onListFonts:m,onRefreshFonts:g,settingsRow:!0},j))}):A.fields.map(([j,z])=>y.jsx(Um,{fieldKey:j,field:z,groupLabel:A.label,variant:"config",schema:t,watched:n,form:r,uploads:i,onUpload:s,galleryUpload:o,onListGallery:l,onUploadGallery:u,fonts:f,fontsLoading:h,onListFonts:m,onRefreshFonts:g},j))})]},A.id)})}),M?null:y.jsx(l2,{form:r,isDirty:x,status:S,tone:k,onDiscard:C,submitLabel:_})]})}function Vg({schema:t,value:e,onSave:n,submitLabel:r,variant:i="config",uploads:s,onUpload:o,galleryUpload:l,onListGallery:u,onUploadGallery:f,fonts:h,fontsLoading:m,onListFonts:g,onRefreshFonts:b,onChange:x,hideActions:S}){const{register:k,clear:C}=oO(),{push:_}=lO(),M=E.useMemo(()=>i==="record"?eF(t):t,[t,i]),R=E.useMemo(()=>i==="record"?tF(M,e):e,[M,e,i]),A=E.useMemo(()=>GU(M),[M]),O=E.useMemo(()=>uF(M,i),[M,i]),[D,j]=E.useState(null),[z,q]=E.useState(),Z=cU({resolver:hU(A),defaultValues:R}),G=GN({control:Z.control});E.useEffect(()=>{x?.(G??{})},[G,x]),E.useEffect(()=>{Z.reset(R)},[R,Z]);const ee=()=>{Z.reset(R),j(null),q(void 0)},te=Z.handleSubmit(async L=>{j("Saving…"),q(void 0),k({saving:!0,isDirty:!0,visible:!0});try{await n(L),j("Saved"),q("ok"),Z.reset(L),_("Changes saved","ok")}catch(U){const ue=U instanceof Error?U.message:"Save failed";j(ue),q("danger"),_(ue,"danger")}finally{k({saving:!1})}}),fe=Z.formState.isDirty;E.useEffect(()=>{if(S){C();return}return k({visible:fe,isDirty:fe,saving:D==="Saving…",message:D??void 0,tone:z,onSave:()=>{te()},onDiscard:ee}),()=>C()},[S,fe,D,z,te,ee,k,C]),E.useEffect(()=>{const L=U=>{(U.metaKey||U.ctrlKey)&&U.key.toLowerCase()==="s"&&(U.preventDefault(),te())};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[te]);const B={schema:M,groups:O,watched:G,form:Z,uploads:s,onUpload:o,galleryUpload:l,onListGallery:u,onUploadGallery:f,fonts:h,fontsLoading:m,onListFonts:g,onRefreshFonts:b,onSubmit:te,isDirty:fe,status:D,tone:z,onDiscard:ee,submitLabel:r,hideActions:!0};return i==="record"?y.jsx(dQ,{...B}):y.jsx(fQ,{...B})}function uM(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\bcents\b/i,"").trim()}function c0(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>typeof n=="string"?[e,{type:n,label:uM(e),required:!0}]:[e,{...n,label:n.label??uM(e),required:n.required??!0}]))}function ik(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>n.type==="boolean"?[e,!1]:n.type==="number"?[e,0]:n.type==="enum"&&n.options?.length?[e,n.default??n.options[0]??""]:[e,n.default??""]))}function dM({title:t,count:e=0,eyebrow:n,schema:r,submitLabel:i,onClose:s,onSubmit:o}){return E.useEffect(()=>{const l=f=>{f.key==="Escape"&&s()};window.addEventListener("keydown",l);const u=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",l),document.body.style.overflow=u}},[s]),y.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:s,children:y.jsxs("div",{className:"vertebr-modal vertebr-modal-form",role:"dialog","aria-modal":"true","aria-label":t,onClick:l=>l.stopPropagation(),children:[y.jsxs("header",{className:"vertebr-modal-head",children:[y.jsxs("div",{className:"vertebr-modal-heading",children:[y.jsx("p",{className:"vertebr-modal-eyebrow",children:n??(e===1?"1 person":`${e} people`)}),y.jsx("h2",{children:t})]}),y.jsx("div",{className:"vertebr-modal-actions",children:y.jsx("button",{type:"button",className:"vertebr-btn",onClick:s,"aria-label":"Close",children:"Close"})})]}),y.jsx("div",{className:"vertebr-modal-body",children:y.jsx(Vg,{variant:"config",schema:r,value:ik(r),submitLabel:i,onSave:async l=>{await o(l),s()}})})]})})}function Ql(t){return t.trim()}function Fm({options:t,value:e,loading:n,disabled:r,placeholder:i="Select…",emptyLabel:s="Nothing available",searchPlaceholder:o="Search…",onChange:l}){const u=E.useId(),f=E.useRef(null),[h,m]=E.useState(!1),[g,b]=E.useState(""),x=E.useMemo(()=>new Set(e.map(Ql)),[e]),S=E.useMemo(()=>{const R=g.trim().toLowerCase();return R?t.filter(A=>`${A.label} ${A.secondary??""} ${A.id}`.toLowerCase().includes(R)):t},[t,g]);E.useEffect(()=>{if(!h)return;const R=O=>{f.current?.contains(O.target)||m(!1)},A=O=>{O.key==="Escape"&&m(!1)};return window.addEventListener("mousedown",R),window.addEventListener("keydown",A),()=>{window.removeEventListener("mousedown",R),window.removeEventListener("keydown",A)}},[h]);const k=R=>{const A=Ql(R),O=new Set(x);O.has(A)?O.delete(A):O.add(A),l(t.map(D=>Ql(D.id)).filter(D=>O.has(D)))},C=()=>{const R=new Set(x);for(const A of S)R.add(Ql(A.id));l(t.map(A=>Ql(A.id)).filter(A=>R.has(A)))},_=()=>l([]),M=e.length===0?n?"Loading…":t.length===0?s:i:e.length===1?t.find(R=>R.id===e[0])?.label??e[0]:`${e.length} selected`;return y.jsxs("div",{className:"vertebr-email-select",ref:f,"data-open":h?"true":void 0,children:[y.jsxs("button",{type:"button",className:"vertebr-select-trigger vertebr-email-select-trigger","aria-haspopup":"listbox","aria-expanded":h,"aria-controls":u,disabled:r||n||t.length===0,onClick:()=>m(R=>!R),children:[y.jsx("span",{className:"vertebr-select-value",children:M}),y.jsx("span",{className:"vertebr-select-icon","aria-hidden":"true",children:y.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",children:y.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),h?y.jsxs("div",{className:"vertebr-email-select-panel",id:u,role:"listbox",children:[t.length>6?y.jsxs("div",{className:"vertebr-email-select-toolbar",children:[y.jsx("input",{type:"search",value:g,placeholder:o,"aria-label":"Search",onChange:R=>b(R.target.value)}),y.jsxs("div",{className:"vertebr-email-select-actions",children:[y.jsx("button",{type:"button",onClick:C,children:"All"}),y.jsx("button",{type:"button",onClick:_,disabled:e.length===0,children:"Clear"})]})]}):y.jsx("div",{className:"vertebr-email-select-toolbar vertebr-email-select-toolbar-compact",children:y.jsxs("div",{className:"vertebr-email-select-actions",children:[y.jsx("button",{type:"button",onClick:C,children:"All"}),y.jsx("button",{type:"button",onClick:_,disabled:e.length===0,children:"Clear"})]})}),y.jsx("ul",{className:"vertebr-email-select-list",children:S.length===0?y.jsx("li",{className:"vertebr-email-select-empty",children:"No matches"}):S.map(R=>{const A=x.has(Ql(R.id));return y.jsx("li",{children:y.jsxs("label",{"data-on":A?"true":void 0,"data-media":R.imageUrl?"true":void 0,children:[y.jsx("input",{type:"checkbox",checked:A,onChange:()=>k(R.id)}),R.imageUrl?y.jsx("img",{className:"vertebr-email-select-thumb",src:R.imageUrl,alt:"",loading:"lazy"}):null,y.jsxs("span",{className:"vertebr-email-select-copy",children:[y.jsx("span",{className:"vertebr-email-select-primary",children:R.label}),R.secondary?y.jsx("span",{className:"vertebr-email-select-secondary",children:R.secondary}):null]})]})},R.id)})})]}):null]})}function hQ({options:t,value:e,loading:n,disabled:r,onChange:i}){const s=t.map(o=>({id:o.email.trim().toLowerCase(),label:o.email,secondary:o.label}));return y.jsx(Fm,{options:s,value:e,loading:n,disabled:r,placeholder:"Select emails…",emptyLabel:"No emails on this list",searchPlaceholder:"Search emails…",onChange:i})}function fM(t){const e=Date.parse(t);return Number.isFinite(e)?new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(e):t}function pQ(t){return t.replace(/^library:/i,"").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim()}function mQ(t){return t==="row"?"Row":t==="campaign"?"Schedule":"Board"}function c2(t){const e=t.reference?.trim();if(e&&e.toUpperCase()!=="MM-PENDING")return e;const i=(t.subject??"").match(/(?:—|-|–)\s*((?:MM|ORD|ORDER)[-_][A-Z0-9-]+|[A-Z]{2,}[-_][A-Z0-9-]{3,})\s*$/i)?.[1]?.trim();return!i||i.toUpperCase()==="MM-PENDING"?"":i}function gQ(t){const e=c2(t),n=t.subject?.trim()??"";if(!n)return t.templateLabel??"Email";let r=n;return e&&(r=r.replace(new RegExp(`\\s*[—\\-–]\\s*${e}\\s*$`,"i"),"").trim()),r.replace(/\s*[—\-–]\s*MM-PENDING\s*$/i,"").trim()||n}function yQ(t){if(t.recipients?.[0]){const e=Math.max(0,t.recipientCount-1);return e>0?`${t.recipients[0]} +${e}`:t.recipients[0]}return t.recipientCount>1?`${t.recipientCount} recipients`:""}function bQ(t){return t.failed&&t.failed>0?`${t.sent} / ${t.failed} failed`:`${t.sent} / ${t.recipientCount}`}function hM(t){return t==="sent"?{label:"Sent",tone:"ok"}:t==="partial"?{label:"Partial"}:t==="failed"?{label:"Failed"}:{label:"Scheduled",tone:"neutral"}}function ec(){return y.jsx("span",{className:"vertebr-cell-empty",children:"—"})}function vQ({campaigns:t,history:e,canSchedule:n,canHistory:r,busy:i,onCancel:s}){const[o,l]=E.useState("all"),u=E.useMemo(()=>t.filter(b=>b.status==="scheduled").slice().sort((b,x)=>Date.parse(b.sendAt)-Date.parse(x.sendAt)),[t]),f=E.useMemo(()=>{const b=u.map(S=>({kind:"scheduled",id:S.id,campaign:S})),x=e.map(S=>({kind:"history",id:S.id,entry:S}));return o==="scheduled"?b:o==="history"?x:[...b,...x]},[o,u,e]),h=!!s&&o!=="history",m=async b=>{s&&window.confirm(`Cancel scheduled email to ${b.resourceLabel??b.resourceId}?`)&&await s(b.id)},g=o==="scheduled"?n?"No drops scheduled yet.":"Host has not enabled scheduling.":o==="history"?r?"No sends recorded yet.":"Host has not enabled send history.":!n&&!r?"Host has not enabled activity.":"No activity yet.";return y.jsxs("div",{className:"vertebr-emails-activity",children:[y.jsxs("div",{className:"vertebr-table-toolbar",children:[y.jsx("div",{className:"vertebr-table-toolbar-start",children:y.jsxs("div",{className:"vertebr-emails-segment",role:"group","aria-label":"Activity",children:[y.jsx("button",{type:"button","data-active":o==="all"?"true":void 0,onClick:()=>l("all"),children:"All"}),y.jsx("button",{type:"button","data-active":o==="scheduled"?"true":void 0,onClick:()=>l("scheduled"),children:"Scheduled"}),y.jsx("button",{type:"button","data-active":o==="history"?"true":void 0,onClick:()=>l("history"),children:"History"})]})}),y.jsx("span",{className:"vertebr-count",children:f.length})]}),f.length===0?y.jsx("div",{className:"vertebr-empty",children:g}):y.jsx("div",{className:"vertebr-table-wrap",children:y.jsxs("table",{className:"vertebr-table",children:[y.jsx("thead",{children:y.jsxs("tr",{children:[y.jsx("th",{children:"When"}),y.jsx("th",{children:"Status"}),y.jsx("th",{children:"Subject"}),y.jsx("th",{children:"Confirmation"}),y.jsx("th",{children:"To"}),y.jsx("th",{children:"Audience"}),y.jsx("th",{children:"Template"}),y.jsx("th",{children:"Via"}),y.jsx("th",{children:"Delivery"}),h?y.jsx("th",{className:"vertebr-col-actions",children:"Actions"}):null]})}),y.jsx("tbody",{children:f.map(b=>{if(b.kind==="scheduled"){const _=b.campaign,M=hM("scheduled");return y.jsxs("tr",{children:[y.jsx("td",{children:y.jsx("span",{className:"vertebr-cell-datetime",children:fM(_.sendAt)})}),y.jsx("td",{children:y.jsx("span",{className:"vertebr-badge","data-tone":M.tone,children:M.label})}),y.jsx("td",{children:_.subject?.trim()||y.jsx(ec,{})}),y.jsx("td",{children:y.jsx(ec,{})}),y.jsx("td",{children:_.recipientCount??y.jsx(ec,{})}),y.jsx("td",{children:_.resourceLabel??_.resourceId}),y.jsx("td",{children:_.templateLabel??_.templateId}),y.jsx("td",{children:"Schedule"}),y.jsx("td",{children:y.jsx(ec,{})}),h?y.jsx("td",{className:"vertebr-col-actions",children:y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:i,onClick:()=>{m(_)},children:"Cancel"})}):null]},`scheduled:${b.id}`)}const x=b.entry,S=hM(x.status),k=c2(x),C=yQ(x);return y.jsxs("tr",{children:[y.jsx("td",{children:y.jsx("span",{className:"vertebr-cell-datetime",children:fM(x.at)})}),y.jsx("td",{children:y.jsx("span",{className:"vertebr-badge","data-tone":S.tone,children:S.label})}),y.jsx("td",{children:gQ(x)}),y.jsx("td",{children:k||y.jsx(ec,{})}),y.jsx("td",{children:C||y.jsx(ec,{})}),y.jsx("td",{children:x.resourceLabel??x.resourceId}),y.jsx("td",{children:x.templateLabel??pQ(x.templateId)}),y.jsx("td",{children:mQ(x.source)}),y.jsx("td",{children:bQ(x)}),h?y.jsx("td",{className:"vertebr-col-actions"}):null]},`history:${b.id}`)})})]})})]})}function xQ({value:t,options:e,onChange:n,ariaLabel:r,size:i="md"}){const[s,o]=E.useState(!1),l=E.useRef(null),u=E.useId(),f=e.find(h=>h.id===t)??e[0];return E.useEffect(()=>{if(!s)return;const h=g=>{l.current?.contains(g.target)||o(!1)},m=g=>{g.key==="Escape"&&o(!1)};return document.addEventListener("mousedown",h),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",m)}},[s]),y.jsxs("div",{className:"vertebr-emails-nav","data-size":i,"data-open":s||void 0,ref:l,children:[y.jsxs("button",{type:"button",className:"vertebr-emails-nav-trigger","aria-label":r,"aria-haspopup":"listbox","aria-expanded":s,"aria-controls":u,onClick:()=>o(h=>!h),children:[y.jsxs("span",{className:"vertebr-emails-nav-current",children:[y.jsx("span",{className:"vertebr-emails-nav-label",children:f?.label}),f?.count!=null?y.jsx("span",{className:"vertebr-emails-nav-count",children:f.count}):null]}),y.jsx("span",{className:"vertebr-emails-nav-chevron","aria-hidden":"true",children:"▾"})]}),s?y.jsx("ul",{id:u,className:"vertebr-emails-nav-menu",role:"listbox","aria-label":r,children:e.map(h=>{const m=h.id===t;return y.jsx("li",{role:"presentation",children:y.jsxs("button",{type:"button",role:"option","aria-selected":m,"data-active":m||void 0,className:"vertebr-emails-nav-option",onClick:()=>{n(h.id),o(!1)},children:[y.jsxs("span",{className:"vertebr-emails-nav-option-main",children:[y.jsx("span",{className:"vertebr-emails-nav-label",children:h.label}),h.count!=null?y.jsx("span",{className:"vertebr-emails-nav-count",children:h.count}):null]}),h.hint?y.jsx("span",{className:"vertebr-emails-nav-hint",children:h.hint}):null]})},h.id)})}):null]})}const wQ=new Set(["custom","promo","custom_discount"]);function SQ(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim()}function kQ(t){const e=new Set,n=[];for(const r of t){const i=r.input?.preset;if(!(!i||typeof i=="string")&&!(i.type!=="enum"||!i.options?.length))for(const s of i.options)!s||wQ.has(s)||s.startsWith("library:")||e.has(s)||(e.add(s),n.push({id:s,label:i.optionLabels?.[s]?.trim()||SQ(s)}))}return n}function u0(t){return{id:t?.id??`lib_${crypto.randomUUID().replace(/-/g,"").slice(0,12)}`,label:t?.label??"",subject:t?.subject??"",body:t?.body??"",productIds:t?.productIds??[],discountId:t?.discountId,discountCode:t?.discountCode??"",discountOffer:t?.discountOffer??"",discountExpires:t?.discountExpires??"",fromPreset:t?.fromPreset,kind:t?.kind,eyebrow:t?.eyebrow??"",headline:t?.headline??"",confirmationLabel:t?.confirmationLabel??"",shippingNote:t?.shippingNote??"",footer:t?.footer??"",signOff:t?.signOff??"",createdAt:t?.createdAt}}function CQ(t){return/order_?confirm|receipt|invoice/i.test(t)?"order":/discount|offer|sale|flash/i.test(t)?"discount":/promo|drop|restock/i.test(t)?"promo":"account"}function EQ(t){return Array.isArray(t)?t.join(", "):t}function TQ(t,e){return{preset:e?`library:${t.id}`:t.kind==="discount"?"custom_discount":t.kind==="promo"?"promo":"custom",kind:t.kind,subject:t.subject,body:t.body,productIds:t.productIds,discountId:t.discountId,discountCode:t.discountCode,discountOffer:t.discountOffer,discountExpires:t.discountExpires,eyebrow:t.eyebrow,headline:t.headline,confirmationLabel:t.confirmationLabel,shippingNote:t.shippingNote,footer:t.footer,signOff:t.signOff}}function _Q(t){return t.kind==="order"?!0:!t.subject.trim()||!t.body.trim()?!1:t.kind==="discount"?!!(t.discountCode.trim()&&t.discountOffer.trim()):!0}function AQ({templates:t,library:e,products:n,discounts:r=[],canLibrary:i,busy:s,previewResourceId:o,previewTemplateId:l,onPreview:u,onSaveLibrary:f,onDeleteLibrary:h}){const m=E.useMemo(()=>kQ(t),[t]),[g,b]=E.useState(null),[x,S]=E.useState(!1),[k,C]=E.useState(null),[_,M]=E.useState("all"),[R,A]=E.useState(null),[O,D]=E.useState(!1),j=!!(g&&e.some(L=>L.id===g.id)),z=E.useMemo(()=>n.map(L=>({id:L.id,label:L.label,secondary:L.priceLabel,imageUrl:L.imageUrl})),[n]),q=E.useCallback(async()=>{if(!g||!u||!o||!l){A(null);return}if(!_Q(g)){A(null);return}D(!0);try{const L=await u({resourceId:o,templateId:l,input:TQ(g,j)});A(L)}catch{A(null)}finally{D(!1)}},[g,u,o,l,j]);E.useEffect(()=>{const L=window.setTimeout(()=>{q()},280);return()=>window.clearTimeout(L)},[q]);const Z=L=>{C(null),b(u0({label:`${L.label} copy`,fromPreset:L.id,kind:CQ(L.id)}))},G=L=>{C(null),b(u0({id:L.id,label:L.label,subject:L.subject,body:L.body,productIds:L.productIds??[],discountId:L.discountId,discountCode:L.discountCode??"",discountOffer:L.discountOffer??"",discountExpires:L.discountExpires??"",fromPreset:L.fromPreset,kind:L.kind,eyebrow:L.eyebrow??"",headline:L.headline??"",confirmationLabel:L.confirmationLabel??"",shippingNote:L.shippingNote??"",footer:L.footer??"",signOff:L.signOff??"",createdAt:L.createdAt}))},ee=()=>{C(null),b(u0({kind:"promo"}))},te=async()=>{if(!g||!f)return;const L=g.label.trim(),U=g.subject.trim(),ue=g.body.trim();if(!L||!U||!ue){C("Label, subject, and body are required.");return}if(g.kind==="discount"&&(!g.discountCode.trim()||!g.discountOffer.trim())){C("Discount templates need a code and offer label.");return}S(!0),C(null);try{const Se=new Date().toISOString();await f({id:g.id,label:L,subject:U,body:ue,productIds:g.productIds.length?g.productIds:void 0,discountId:g.kind==="discount"&&g.discountId||void 0,discountCode:g.kind==="discount"&&g.discountCode.trim()||void 0,discountOffer:g.kind==="discount"&&g.discountOffer.trim()||void 0,discountExpires:g.kind==="discount"&&g.discountExpires.trim()||void 0,fromPreset:g.fromPreset,kind:g.kind,eyebrow:g.kind==="order"&&g.eyebrow.trim()||void 0,headline:g.kind==="order"&&g.headline.trim()||void 0,confirmationLabel:g.kind==="order"&&g.confirmationLabel.trim()||void 0,shippingNote:g.kind==="order"&&g.shippingNote.trim()||void 0,footer:g.kind==="order"&&g.footer.trim()||void 0,signOff:g.kind==="order"&&g.signOff.trim()||void 0,createdAt:g.createdAt??Se,updatedAt:Se}),b(null)}catch(Se){C(Se instanceof Error?Se.message:"Save failed")}finally{S(!1)}},fe=async L=>{if(h&&window.confirm(`Delete template “${L.label}”?`)){S(!0),C(null);try{await h(L.id),g?.id===L.id&&b(null)}catch(U){C(U instanceof Error?U.message:"Delete failed")}finally{S(!1)}}},B=s||x||!i||!f;return y.jsx("div",{className:"vertebr-emails-library","data-editing":g?"true":void 0,children:g?y.jsxs("div",{className:"vertebr-emails-library-editor",children:[y.jsxs("header",{children:[y.jsx("h3",{children:j?"Edit template":"Save as custom"}),y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:x,onClick:()=>{b(null),A(null)},children:"Close"})]}),y.jsxs("div",{className:"vertebr-emails-layout",children:[y.jsxs("div",{className:"vertebr-emails-compose",children:[y.jsxs("div",{className:"vertebr-emails-fields",children:[y.jsxs("label",{className:"vertebr-mail-field",children:[y.jsx("span",{children:"Label"}),y.jsx("input",{type:"text",value:g.label,disabled:x,onChange:L=>b(U=>U&&{...U,label:L.target.value})})]}),y.jsx("div",{className:"vertebr-emails-segment",role:"group","aria-label":"Kind",children:[["account","Account"],["promo","Promo"],["discount","Discount"],["order","Order"]].map(([L,U])=>y.jsx("button",{type:"button","data-active":g.kind===L?"true":void 0,disabled:x||g.kind==="order",onClick:()=>b(ue=>ue&&{...ue,kind:L}),children:U},L))}),y.jsxs("label",{className:"vertebr-mail-field",children:[y.jsx("span",{children:"Subject"}),y.jsx("input",{type:"text",value:g.subject,disabled:x,onChange:L=>b(U=>U&&{...U,subject:L.target.value})})]}),y.jsxs("label",{className:"vertebr-mail-field",children:[y.jsx("span",{children:g.kind==="order"?"Intro":"Body"}),y.jsx("textarea",{rows:g.kind==="order"?4:7,value:g.body,disabled:x,onChange:L=>b(U=>U&&{...U,body:L.target.value})})]}),g.kind==="order"?y.jsxs(y.Fragment,{children:[y.jsxs("label",{className:"vertebr-mail-field",children:[y.jsx("span",{children:"Eyebrow"}),y.jsx("input",{type:"text",value:g.eyebrow,disabled:x,onChange:L=>b(U=>U&&{...U,eyebrow:L.target.value})})]}),y.jsxs("label",{className:"vertebr-mail-field",children:[y.jsx("span",{children:"Headline"}),y.jsx("input",{type:"text",value:g.headline,disabled:x,onChange:L=>b(U=>U&&{...U,headline:L.target.value})})]}),y.jsxs("label",{className:"vertebr-mail-field",children:[y.jsx("span",{children:"Confirmation label"}),y.jsx("input",{type:"text",value:g.confirmationLabel,disabled:x,onChange:L=>b(U=>U&&{...U,confirmationLabel:L.target.value})})]}),y.jsxs("label",{className:"vertebr-mail-field",children:[y.jsx("span",{children:"Shipping note"}),y.jsx("textarea",{rows:2,value:g.shippingNote,disabled:x,onChange:L=>b(U=>U&&{...U,shippingNote:L.target.value})})]}),y.jsxs("label",{className:"vertebr-mail-field",children:[y.jsx("span",{children:"Footer"}),y.jsx("textarea",{rows:2,value:g.footer,disabled:x,onChange:L=>b(U=>U&&{...U,footer:L.target.value})})]}),y.jsxs("label",{className:"vertebr-mail-field",children:[y.jsx("span",{children:"Sign-off"}),y.jsx("input",{type:"text",value:g.signOff,disabled:x,onChange:L=>b(U=>U&&{...U,signOff:L.target.value})})]}),y.jsxs("p",{className:"vertebr-mail-compose-hint",children:["Tokens: ","{{confirmationNumber}}",", ","{{email}}",","," ","{{total}}"]})]}):null,g.kind==="discount"?y.jsxs(y.Fragment,{children:[r.length>0?y.jsxs("label",{className:"vertebr-mail-field",children:[y.jsx("span",{children:"Discount"}),y.jsxs("select",{value:g.discountId??"",disabled:x,onChange:L=>{const U=L.target.value,ue=r.find(Se=>Se.id===U);b(Se=>Se&&{...Se,discountId:U||void 0,discountCode:ue?.code??Se.discountCode,discountOffer:ue?.offerLabel??ue?.label??Se.discountOffer,discountExpires:ue?.expiresLabel??Se.discountExpires})},children:[y.jsx("option",{value:"",children:"Manual code…"}),r.map(L=>y.jsxs("option",{value:L.id,children:[L.label,L.code?` (${L.code})`:""]},L.id))]})]}):null,y.jsxs("label",{className:"vertebr-mail-field",children:[y.jsx("span",{children:"Discount code"}),y.jsx("input",{type:"text",value:g.discountCode,disabled:x,placeholder:"WELCOME20",onChange:L=>b(U=>U&&{...U,discountCode:L.target.value})})]}),y.jsxs("label",{className:"vertebr-mail-field",children:[y.jsx("span",{children:"Offer label"}),y.jsx("input",{type:"text",value:g.discountOffer,disabled:x,placeholder:"20% off",onChange:L=>b(U=>U&&{...U,discountOffer:L.target.value})})]}),y.jsxs("label",{className:"vertebr-mail-field",children:[y.jsx("span",{children:"Expires (optional)"}),y.jsx("input",{type:"text",value:g.discountExpires,disabled:x,placeholder:"Expires Mar 1",onChange:L=>b(U=>U&&{...U,discountExpires:L.target.value})})]})]}):null,z.length>0?y.jsxs("label",{className:"vertebr-mail-field",children:[y.jsx("span",{children:"Products"}),y.jsx(Fm,{options:z,value:g.productIds,disabled:x,placeholder:"Add products with photos…",emptyLabel:"No products",onChange:L=>b(U=>U&&{...U,productIds:L})})]}):null,g.fromPreset?y.jsxs("p",{className:"vertebr-emails-library-meta",children:["From system preset ",y.jsx("code",{children:g.fromPreset})]}):null,k?y.jsx("p",{className:"vertebr-mail-compose-error",children:k}):null]}),y.jsx("div",{className:"vertebr-mail-compose-foot",children:y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",disabled:x||!f,onClick:()=>{te()},children:x?"Saving…":"Save template"})})]}),y.jsx("div",{className:"vertebr-emails-side",children:y.jsxs("div",{className:"vertebr-mail-preview",children:[y.jsxs("div",{className:"vertebr-mail-preview-meta",children:[y.jsxs("p",{children:[y.jsx("span",{children:"To"}),y.jsx("strong",{children:R?EQ(R.to):O?"Updating…":"Sample recipient"})]}),y.jsxs("p",{children:[y.jsx("span",{children:"Subject"}),y.jsx("strong",{children:R?.subject??(O?"Updating…":g.subject||"—")})]})]}),y.jsx("div",{className:"vertebr-mail-preview-stage",children:y.jsx("div",{className:"vertebr-mail-preview-frame",children:R?.html?y.jsx("iframe",{title:"Email preview",sandbox:"",srcDoc:R.html}):R?.text?y.jsx("pre",{children:R.text}):y.jsx("div",{className:"vertebr-mail-preview-empty",children:O?"Rendering host template…":!o||!l?"No sample audience to preview against.":g.kind==="discount"&&(!g.discountCode.trim()||!g.discountOffer.trim())?"Add a discount code and offer to preview.":"Write a subject and body to preview."})})})]})})]})]}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"vertebr-emails-subnav",children:[y.jsx(xQ,{size:"sm",ariaLabel:"Templates subsection",value:_,onChange:M,options:[{id:"all",label:"All templates",count:m.length+e.length,hint:"Presets and saved"},{id:"system",label:"System presets",count:m.length,hint:"Built-in starting points"},{id:"saved",label:"Saved templates",count:e.length,hint:"Owner-edited copies"}]}),i&&f&&_!=="system"?y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:B,onClick:ee,children:"New"}):null]}),y.jsxs("div",{className:"vertebr-emails-library-cols","data-section":_,children:[_!=="saved"?y.jsxs("section",{className:"vertebr-emails-library-section",children:[y.jsxs("header",{children:[y.jsx("h3",{children:"System presets"}),y.jsx("span",{className:"vertebr-count",children:m.length})]}),m.length===0?y.jsx("p",{className:"vertebr-emails-campaigns-empty",children:"No system presets exposed on template inputs."}):y.jsx("ul",{children:m.map(L=>y.jsxs("li",{children:[y.jsxs("div",{children:[y.jsx("strong",{children:L.label}),y.jsx("span",{children:L.id})]}),i&&f?y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:B,onClick:()=>Z(L),children:"Duplicate"}):null]},L.id))})]}):null,_!=="system"?y.jsxs("section",{className:"vertebr-emails-library-section",children:[y.jsxs("header",{children:[y.jsx("h3",{children:"Saved templates"}),y.jsx("span",{className:"vertebr-count",children:e.length})]}),i?e.length===0?y.jsx("p",{className:"vertebr-emails-campaigns-empty",children:"No saved templates yet. Duplicate a system preset or create one."}):y.jsx("ul",{children:e.map(L=>y.jsxs("li",{children:[y.jsxs("div",{children:[y.jsx("strong",{children:L.label}),y.jsxs("span",{children:[L.fromPreset?`from ${L.fromPreset}`:"custom",L.kind==="discount"?" · discount":"",L.kind==="order"?" · order":"",L.discountCode?` · ${L.discountCode}`:"",L.productIds?.length?` · ${L.productIds.length} products`:""]}),L.subject?y.jsx("span",{className:"vertebr-emails-campaign-subject",children:L.subject}):null]}),y.jsxs("div",{className:"vertebr-emails-library-actions",children:[y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:B,onClick:()=>G(L),children:"Edit"}),h&&L.kind!=="order"?y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:B,onClick:()=>{fe(L)},children:"Delete"}):null]})]},L.id))}):y.jsx("p",{className:"vertebr-emails-campaigns-empty",children:"Host has not enabled the template library."})]}):null]})]})})}const RQ=new Set(["custom","promo","custom_discount"]),MQ=new Set(["discount","welcome_offer","flash_sale","custom_discount"]),NQ=new Set(["discountId","discountCode","discountOffer","discountExpires"]);function Ic(t){return typeof t=="string"?t:String(t??"")}function sk(t){return t.startsWith("library:")}function OQ(t){return RQ.has(t)||sk(t)}function ok(t,e){if(MQ.has(t))return!0;if(!sk(t))return!1;const n=t.slice(8);return e.some(r=>r.id===n&&r.kind==="discount")}function DQ(t,e){const n=`${t} ${e.label??""}`;return e.type==="richtext"||/(body|message|html|notes)/i.test(n)}function u2(t,e){if(!t.preset)return!0;const n=Ic(e.preset);return!n||OQ(n)}function d2(t,e,n,r=[]){if(t==="subject"||t==="body")return u2(e,n);if(NQ.has(t)){const i=Ic(n.preset);return!(!ok(i,r)||t==="discountId"&&!e.discountId?.options?.length)}return!0}function pM(t,e,n=[]){return Object.entries(t).every(([r,i])=>{if(!d2(r,t,e,n))return!0;const s=(r==="subject"||r==="body")&&u2(t,e),o=(r==="discountCode"||r==="discountOffer")&&ok(Ic(e.preset),n);return i.required===!1&&!s&&!o?!0:i.type==="enum[]"?i.required===!1?!0:Array.isArray(e[r])&&e[r].length>0:i.type!=="string"&&i.type!=="richtext"&&i.type!=="enum"?!0:!!Ic(e[r]).trim()})}function IQ(t){return t?Object.fromEntries(Object.entries(t).map(([e,n])=>typeof n=="string"?[e,{type:n,label:e,required:!0}]:[e,n])):{}}function jQ(t,e,n,r){const i={...t};if(i.preset?.type==="enum"&&e.length>0){const s=e.map(u=>`library:${u.id}`),o=Object.fromEntries(e.map(u=>[`library:${u.id}`,u.label])),l=[...i.preset.options??[]];for(const u of s)l.includes(u)||l.push(u);i.preset={...i.preset,options:l,optionLabels:{...i.preset.optionLabels??{},...o}}}if(i.productIds&&n&&n.length>0){const s=n.map(l=>l.id),o=Object.fromEntries(n.map(l=>[l.id,l.label]));i.productIds={...i.productIds,type:"enum[]",options:s,optionLabels:{...i.productIds.optionLabels??{},...o},default:Array.isArray(i.productIds.default)?i.productIds.default:[]}}if(i.discountId&&r&&r.length>0){const s=r.map(l=>l.id),o=Object.fromEntries(r.map(l=>[l.id,l.offerLabel?`${l.label}${l.code?` (${l.code})`:""}`:l.label]));i.discountId={...i.discountId,type:"enum",options:s,optionLabels:{...i.discountId.optionLabels??{},...o},required:!1}}return i}function LQ(t){const e=ik(t);for(const[n,r]of Object.entries(t))r.type==="enum[]"&&!Array.isArray(e[n])&&(e[n]=Array.isArray(r.default)?r.default:[]);return e}function PQ(t,e,n,r){if(!sk(e))return t;const i=e.slice(8),s=n.find(o=>o.id===i);return s?{...t,preset:e,subject:s.subject,body:s.body,...r.productIds?{productIds:s.productIds??[]}:{},...r.discountId?{discountId:s.discountId??""}:{},...r.discountCode?{discountCode:s.discountCode??""}:{},...r.discountOffer?{discountOffer:s.discountOffer??""}:{},...r.discountExpires?{discountExpires:s.discountExpires??""}:{}}:t}function zQ(t){return Array.isArray(t)?t.join(", "):t}function $Q(t){const e=Date.parse(t);return Number.isFinite(e)?new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(e):t}function BQ(){const t=new Date(Date.now()+36e5);t.setMinutes(0,0,0);const e=n=>String(n).padStart(2,"0");return`${t.getFullYear()}-${e(t.getMonth()+1)}-${e(t.getDate())}T${e(t.getHours())}:${e(t.getMinutes())}`}function VQ(t){return Array.isArray(t)?t.map(e=>String(e).trim()).filter(Boolean):[]}function HQ({data:t,loading:e,tab:n,onRefresh:r,onLoadRecipients:i,onPreview:s,onSend:o,onSchedule:l,onCancel:u,onSaveLibrary:f,onDeleteLibrary:h}){const m=t.audiences,g=t.library??[],b=t.products??[],x=t.discounts??[],S=t.history??[],[k]=E.useState("compose"),C=n??k,_=E.useMemo(()=>m.map(ge=>({id:ge.id,label:ge.label})),[m]),[M,R]=E.useState(()=>m[0]?[m[0].id]:[]),A=E.useMemo(()=>m.filter(ge=>M.includes(ge.id)),[m,M]),O=E.useMemo(()=>A.length===0?[]:t.templates.filter(ge=>A.every(Ne=>Ne.templates.includes(ge.id))),[t.templates,A]),[D,j]=E.useState(O[0]?.id??""),z=O.find(ge=>ge.id===D)??O[0],q=E.useMemo(()=>jQ(IQ(z?.input),g,b,x),[x,g,b,z]),Z=E.useMemo(()=>LQ(q),[q]),[G,ee]=E.useState(Z),[te,fe]=E.useState("all"),[B,L]=E.useState([]),[U,ue]=E.useState([]),[Se,V]=E.useState(!1),[Y,he]=E.useState("now"),[ve,Ae]=E.useState(BQ),[Re,Le]=E.useState(null),[Te,oe]=E.useState(!1),[pe,Ie]=E.useState(!1),[Ue,Ze]=E.useState(null),[ft,vt]=E.useState(null);E.useEffect(()=>{R(ge=>{const Ne=ge.filter(I=>m.some(P=>P.id===I));return Ne.length>0?Ne:m[0]?[m[0].id]:[]})},[m]),E.useEffect(()=>{if(!z){j("");return}O.some(ge=>ge.id===D)||j(z.id)},[z,D,O]),E.useEffect(()=>{ee(Z)},[Z]),E.useEffect(()=>{L([])},[M]);const Kt=A.map(ge=>ge.id).join("|");E.useEffect(()=>{if(A.length===0){ue([]);return}let ge=!1;return V(!0),Promise.all(A.map(async Ne=>(await i(Ne.id)).map(P=>({...P,resourceId:Ne.id,label:P.label?`${P.label} · ${Ne.label}`:Ne.label})))).then(Ne=>{if(ge)return;const I=new Set,P=[];for(const H of Ne)for(const ie of H){const ae=ie.email.trim().toLowerCase();!ae||I.has(ae)||(I.add(ae),P.push({...ie,email:ae}))}P.sort((H,ie)=>H.email.localeCompare(ie.email)),ue(P)}).catch(Ne=>{ge||(ue([]),Ze(Ne instanceof Error?Ne.message:"Failed to load emails"))}).finally(()=>{ge||V(!1)}),()=>{ge=!0}},[Kt,i,A]);const vn=A[0],Zt=A.length>0&&!!z&&(!Object.keys(q).length||pM(q,G,g))&&(te==="all"||B.length>0)&&(Y==="now"||!!ve)&&!pe,Nn=E.useMemo(()=>{if(te!=="emails"||B.length===0)return;const ge=U.find(Ne=>Ne.email.trim().toLowerCase()===B[0]?.toLowerCase());return ge?.id??ge?.email??B[0]},[U,te,B]),nn=E.useMemo(()=>{if(te==="emails"&&B[0]){const ge=U.find(Ne=>Ne.email.trim().toLowerCase()===B[0]?.toLowerCase());if(ge?.resourceId)return ge.resourceId}return vn?.id},[vn?.id,U,te,B]),br=E.useCallback(async()=>{if(C==="compose"){if(!nn||!z){Le(null);return}if(Object.keys(q).length&&!pM(q,G,g)){Le(null);return}oe(!0),Ze(null);try{const ge=await s({resourceId:nn,templateId:z.id,rowId:Nn,input:Object.keys(q).length?G:void 0});Le(ge)}catch(ge){Le(null),Ze(ge instanceof Error?ge.message:"Preview failed")}finally{oe(!1)}}},[G,s,nn,Nn,q,C,z]);E.useEffect(()=>{const ge=window.setTimeout(()=>{br()},280);return()=>window.clearTimeout(ge)},[br]);const Pr=ge=>{const Ne=U.find(I=>I.email.trim().toLowerCase()===ge.toLowerCase());return Ne?.resourceId?[Ne.resourceId]:A.map(I=>I.id)},vr=async()=>{if(!(!Zt||!z||A.length===0)){Ie(!0),Ze(null),vt(null);try{const ge=Object.keys(q).length?G:void 0;if(Y==="later"){if(!l)throw new Error("Scheduling is not available.");const Ne=new Date(ve).toISOString();if(te==="all")for(const I of A)await l({resourceId:I.id,templateId:z.id,input:ge,audience:{mode:"all"},sendAt:Ne});else{const I=new Map;for(const P of B)for(const H of Pr(P)){const ie=I.get(H)??[];ie.push(P),I.set(H,ie)}for(const[P,H]of I)await l({resourceId:P,templateId:z.id,input:ge,audience:{mode:"emails",emails:H},sendAt:Ne})}vt(`Scheduled for ${$Q(Ne)}.`)}else{let Ne=0,I=0;if(te==="all")for(const P of A){const H=await o({resourceId:P.id,templateId:z.id,input:ge,audience:{mode:"all"}});Ne+=H.sent,I+=H.failed}else{const P=new Map;for(const H of B)for(const ie of Pr(H)){const ae=P.get(ie)??[];ae.push(H),P.set(ie,ae)}for(const[H,ie]of P){const ae=await o({resourceId:H,templateId:z.id,input:ge,audience:{mode:"emails",emails:ie}});Ne+=ae.sent,I+=ae.failed}}vt(I>0?`Sent ${Ne}. ${I} failed.`:`Sent ${Ne}.`)}await r()}catch(ge){Ze(ge instanceof Error?ge.message:"Request failed")}finally{Ie(!1)}}},qt=async ge=>{if(u){Ie(!0),Ze(null);try{await u(ge),await r()}catch(Ne){Ze(Ne instanceof Error?Ne.message:"Cancel failed")}finally{Ie(!1)}}},si=async ge=>{f&&(await f(ge),await r())},xr=async ge=>{h&&(await h(ge),await r())},zr=Object.entries(q).filter(([ge])=>d2(ge,q,G,g)),Fn=(ge,Ne)=>{ee(I=>{let P={...I,[ge]:Ne};if(ge==="preset"&&typeof Ne=="string"){P=PQ(P,Ne,g,q);const H=Ne==="drop_live"||Ne==="restock"||Ne==="promo"||ok(Ne,g)||g.some(ae=>`library:${ae.id}`===Ne&&(ae.kind==="promo"||(ae.productIds?.length??0)>0)),ie=Array.isArray(P.productIds)?P.productIds:[];H&&ie.length===0&&b[0]&&q.productIds&&(P={...P,productIds:[b[0].id]})}if(ge==="discountId"&&typeof Ne=="string"){const H=x.find(ie=>ie.id===Ne);H&&(P={...P,discountCode:H.code??P.discountCode??"",discountOffer:H.offerLabel??H.label??P.discountOffer??"",discountExpires:H.expiresLabel??P.discountExpires??""})}return P})};return m.length===0?y.jsxs("div",{className:"vertebr-emails",children:[y.jsx("div",{className:"vertebr-panel-head",children:y.jsx("h2",{children:t.label})}),y.jsxs("div",{className:"vertebr-empty",children:["No mail-enabled resources yet. Opt a resource in with"," ",y.jsx("code",{children:'mail: ["sendEmail"]'}),"."]})]}):y.jsxs("div",{className:"vertebr-emails",children:[y.jsxs("div",{className:"vertebr-panel-head",children:[y.jsx("h2",{children:t.label}),y.jsx("div",{className:"vertebr-panel-head-actions",children:y.jsx("button",{type:"button",className:"vertebr-btn",onClick:()=>{r()},disabled:e||pe,children:e?"Refreshing…":"Refresh"})})]}),C==="compose"?y.jsxs("div",{className:"vertebr-emails-layout",children:[y.jsxs("form",{className:"vertebr-emails-compose",onSubmit:ge=>{ge.preventDefault(),vr()},children:[y.jsxs("div",{className:"vertebr-emails-fields",children:[y.jsxs("label",{className:"vertebr-mail-field",children:[y.jsx("span",{children:"Audience"}),y.jsx(Fm,{options:_,value:M,disabled:pe,placeholder:"Select audiences…",emptyLabel:"No audiences",onChange:ge=>{if(ge.length===0&&m[0]){R([m[0].id]);return}R(ge)}})]}),y.jsxs("div",{className:"vertebr-emails-segment",role:"group","aria-label":"Scope",children:[y.jsx("button",{type:"button","data-active":te==="all"?"true":void 0,onClick:()=>fe("all"),children:"Entire list"}),y.jsx("button",{type:"button","data-active":te==="emails"?"true":void 0,onClick:()=>fe("emails"),children:"Specific emails"})]}),te==="emails"?y.jsxs("label",{className:"vertebr-mail-field",children:[y.jsx("span",{children:"Emails"}),y.jsx(hQ,{options:U,value:B,loading:Se,disabled:pe,onChange:L})]}):null,y.jsxs("label",{className:"vertebr-mail-field",children:[y.jsx("span",{children:"Template"}),y.jsx("select",{value:z?.id??"",onChange:ge=>j(ge.target.value),children:O.map(ge=>y.jsx("option",{value:ge.id,children:ge.label},ge.id))})]}),zr.map(([ge,Ne])=>{const I=DQ(ge,Ne);return y.jsxs("label",{className:"vertebr-mail-field",children:[y.jsx("span",{children:Ne.label??ge}),Ne.type==="enum"?y.jsx(rk,{id:`emails-${ge}`,value:G[ge],field:Ne,onChange:P=>Fn(ge,P)}):Ne.type==="enum[]"?y.jsx(Fm,{options:(Ne.options??[]).map(P=>{const H=ge==="productIds"?b.find(ie=>ie.id===P):void 0;return{id:P,label:Ne.optionLabels?.[P]??P,secondary:H?.priceLabel,imageUrl:H?.imageUrl}}),value:VQ(G[ge]),disabled:pe,placeholder:ge==="productIds"?"Add products with photos…":`Select ${Ne.label??ge}…`,emptyLabel:"Nothing available",onChange:P=>Fn(ge,P)}):I?y.jsx("textarea",{rows:6,value:Ic(G[ge]),onChange:P=>Fn(ge,P.target.value)}):y.jsx("input",{type:"text",value:Ic(G[ge]),onChange:P=>Fn(ge,P.target.value)})]},ge)}),y.jsxs("div",{className:"vertebr-emails-segment",role:"group","aria-label":"When",children:[y.jsx("button",{type:"button","data-active":Y==="now"?"true":void 0,onClick:()=>he("now"),children:"Send now"}),y.jsx("button",{type:"button","data-active":Y==="later"?"true":void 0,disabled:!t.canSchedule||!l,onClick:()=>he("later"),children:"Schedule"})]}),Y==="later"?y.jsxs("label",{className:"vertebr-mail-field",children:[y.jsx("span",{children:"Send at"}),y.jsx("input",{type:"datetime-local",value:ve,onChange:ge=>Ae(ge.target.value)})]}):null,Ue?y.jsx("p",{className:"vertebr-mail-compose-error",children:Ue}):null,ft?y.jsx("p",{className:"vertebr-emails-notice",children:ft}):null]}),y.jsx("div",{className:"vertebr-mail-compose-foot",children:y.jsx("button",{type:"submit",className:"vertebr-btn vertebr-btn-primary",disabled:!Zt,children:pe?Y==="later"?"Scheduling…":"Sending…":Y==="later"?"Schedule email":te==="all"?"Send to list":"Send"})})]}),y.jsx("div",{className:"vertebr-emails-side",children:y.jsxs("div",{className:"vertebr-mail-preview",children:[y.jsxs("div",{className:"vertebr-mail-preview-meta",children:[y.jsxs("p",{children:[y.jsx("span",{children:"To"}),y.jsx("strong",{children:Re?zQ(Re.to):te==="all"?A.length===0?"—":A.length===1?`Everyone on ${A[0]?.label}`:`Everyone on ${A.length} lists`:B.length>0?B.length===1?B[0]:`${B.length} selected`:"—"})]}),y.jsxs("p",{children:[y.jsx("span",{children:"Subject"}),y.jsx("strong",{children:Re?.subject??(Te?"Updating…":"—")})]})]}),y.jsx("div",{className:"vertebr-mail-preview-stage",children:y.jsx("div",{className:"vertebr-mail-preview-frame",children:Re?.html?y.jsx("iframe",{title:"Email preview",sandbox:"",srcDoc:Re.html}):Re?.text?y.jsx("pre",{children:Re.text}):y.jsx("div",{className:"vertebr-mail-preview-empty",children:Te?"Rendering host template…":"Pick an audience and template to preview."})})})]})})]}):null,C==="templates"?y.jsx(AQ,{templates:t.templates,library:g,products:b,discounts:x,canLibrary:t.canLibrary,busy:pe,previewResourceId:t.audiences[0]?.id,previewTemplateId:t.templates.find(ge=>ge.id==="sendEmail")?.id??t.templates[0]?.id,onPreview:s,onSaveLibrary:f?si:void 0,onDeleteLibrary:h?xr:void 0}):null,C==="activity"?y.jsx(vQ,{campaigns:t.campaigns,history:S,canSchedule:t.canSchedule,canHistory:t.canHistory,busy:pe,onCancel:u?qt:void 0}):null]})}function UQ(t){return`https://fonts.googleapis.com/css2?family=${encodeURIComponent(t)}:wght@400;600;700&display=swap`}function f2({open:t,title:e,subtitle:n,family:r,files:i,googleFamily:s,bodyWeight:o,headingWeight:l,onClose:u,onConfirm:f,confirmLabel:h="Use this font"}){const m=E.useId().replace(/:/g,""),g=E.useMemo(()=>i?.length?$N({family:r,files:i}):"",[i,r,e]);if(E.useEffect(()=>{if(!t)return;let S=null;return s&&!i?.length&&(S=document.createElement("link"),S.rel="stylesheet",S.href=UQ(s),document.head.appendChild(S)),()=>{S?.remove()}},[t,s,i?.length]),E.useEffect(()=>{if(!t)return;const S=k=>{k.key==="Escape"&&u()};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[t,u]),!t)return null;const b=o??i?.find(S=>S.weight>=400&&S.weight<600)?.weight??i?.[0]?.weight??400,x=l??i?.find(S=>S.weight>=600)?.weight??i?.[i.length-1]?.weight??700;return y.jsxs("div",{className:"vertebr-font-preview-modal-backdrop",onClick:u,children:[g?y.jsx("style",{id:m,dangerouslySetInnerHTML:{__html:g}}):null,y.jsxs("div",{className:"vertebr-font-preview-modal",role:"dialog","aria-modal":"true","aria-labelledby":`${m}-title`,onClick:S=>S.stopPropagation(),children:[y.jsxs("div",{className:"vertebr-font-preview-modal-head",children:[y.jsxs("div",{children:[y.jsx("h3",{id:`${m}-title`,children:e}),n?y.jsx("p",{children:n}):null]}),y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:u,children:"Close"})]}),y.jsx("div",{className:"vertebr-font-preview-modal-body",children:y.jsx(gp,{family:r,bodyWeight:b,headingWeight:x})}),f?y.jsxs("div",{className:"vertebr-font-preview-modal-actions",children:[y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:u,children:"Cancel"}),y.jsx("button",{type:"button",className:"vertebr-btn",onClick:f,children:h})]}):null]})]})}function FQ({disabled:t,existingFamilies:e,onImport:n}){const[r,i]=E.useState(""),[s,o]=E.useState(null),[l,u]=E.useState(null),[f,h]=E.useState(null),m=E.useMemo(()=>{const b=r.trim().toLowerCase();return b?QT.filter(x=>x.family.toLowerCase().includes(b)||x.category.includes(b)):QT},[r]),g=async b=>{if(!(t||s)){o(b.family),u(null);try{await n({family:b.family,weights:b.weights}),h(null)}catch(x){u(x instanceof Error?x.message:"Import failed")}finally{o(null)}}};return y.jsxs("section",{className:"vertebr-google-fonts",children:[y.jsxs("div",{className:"vertebr-google-fonts-head",children:[y.jsxs("div",{children:[y.jsx("h3",{children:"Google Fonts"}),y.jsx("p",{children:"Browse and add open-source fonts to your library."})]}),y.jsx("input",{type:"search",className:"vertebr-google-fonts-search",placeholder:"Search fonts…",value:r,onChange:b=>i(b.target.value)})]}),l?y.jsx("div",{className:"vertebr-error-inline",children:l}):null,y.jsx("div",{className:"vertebr-google-fonts-grid-scroll",children:y.jsx("div",{className:"vertebr-google-fonts-grid",children:m.map(b=>{const x=e.includes(b.family.toLowerCase());return y.jsxs("article",{className:"vertebr-google-fonts-card",children:[y.jsxs("button",{type:"button",className:"vertebr-google-fonts-preview-btn",onClick:()=>h(b),title:`Preview ${b.family}`,children:[y.jsxs("div",{className:"vertebr-google-fonts-card-copy",children:[y.jsx("strong",{children:b.family}),y.jsx("span",{children:b.category.replace("-"," ")}),y.jsx("span",{children:b.weights.join(", ")})]}),y.jsx("span",{className:"vertebr-font-library-preview-hint",children:"Click to preview"})]}),y.jsx("button",{type:"button",className:"vertebr-btn",disabled:t||x||s===b.family,onClick:()=>{g(b)},children:x?"In library":s===b.family?"Adding…":"Add to library"})]},b.family)})})}),y.jsx(f2,{open:f!=null,title:f?.family??"Font preview",subtitle:f?`${f.category.replace("-"," ")} · weights ${f.weights.join(", ")}`:void 0,family:f?.family??"",googleFamily:f?.family,onClose:()=>h(null),onConfirm:f&&!e.includes(f.family.toLowerCase())?()=>{g(f)}:void 0,confirmLabel:f&&e.includes(f.family.toLowerCase())?"Already in library":"Add to library"})]})}function qQ(t){const e=t.files.find(n=>n.weight>=600)??t.files[0];return{fontFamily:`"${t.family}", ui-sans-serif, sans-serif`,fontWeight:e?.weight??400}}function GQ({label:t="Font Library",data:e,loading:n,onRefresh:r,onUpload:i,onImportGoogle:s,onDelete:o}){const[l,u]=E.useState(null),f={field:"fonts",accept:e.accept,maxBytes:e.maxBytes};return y.jsxs("div",{className:"vertebr-font-library",children:[y.jsx(jO,{items:e.items}),y.jsxs("div",{className:"vertebr-panel-head",children:[y.jsx("h2",{children:t}),y.jsxs("div",{className:"vertebr-font-library-head-actions",children:[y.jsx("span",{className:"vertebr-count",children:e.items.length}),r?y.jsx("button",{type:"button",className:"vertebr-btn",onClick:r,disabled:n,children:n?"Refreshing…":"Refresh"}):null]})]}),y.jsxs("div",{className:"vertebr-font-library-body",children:[e.canImportGoogle&&s?y.jsx(FQ,{disabled:n,onImport:s,existingFamilies:e.items.map(h=>h.family.toLowerCase())}):null,y.jsx(Pc,{meta:f,multiple:!0,label:"Drop .woff2 / .woff / .ttf files here or browse to upload",onUpload:async h=>{for(const m of h){const g=m.name.replace(/\.[^.]+$/,""),b=/(?:^|[\s_-])(100|200|300|400|500|600|700|800|900)(?:[\s_-]|$)/i.exec(g),x=g.replace(/(?:^|[\s_-])(100|200|300|400|500|600|700|800|900)(?:[\s_-]|$)/gi," ").replace(/[\s_-]+/g," ").trim();await i([m],{family:x||void 0,weight:b?Number(b[1]):400})}}}),y.jsx("p",{className:"vertebr-font-library-note",children:"Upload only fonts you have the right to use. Click a font card to preview before using it in Brand typography."}),e.items.length===0?y.jsx("div",{className:"vertebr-empty",children:"No fonts in the library yet."}):y.jsx("div",{className:"vertebr-font-library-grid",children:e.items.map(h=>y.jsxs("article",{className:"vertebr-font-library-card",children:[y.jsxs("button",{type:"button",className:"vertebr-font-library-preview-btn",onClick:()=>u(h),title:`Preview ${h.label}`,children:[y.jsxs("div",{className:"vertebr-font-library-preview",style:qQ(h),children:[y.jsx("span",{className:"vertebr-font-library-ag",children:"Ag"}),y.jsx("p",{children:"The quick brown fox jumps over the lazy dog."})]}),y.jsx("span",{className:"vertebr-font-library-preview-hint",children:"Click to preview"})]}),y.jsxs("div",{className:"vertebr-font-library-meta",children:[y.jsx("strong",{title:h.label,children:h.label}),y.jsxs("span",{children:[h.source==="google"?"Google Fonts":"Upload"," ·"," ",h.files.length," file",h.files.length===1?"":"s"]}),y.jsx("code",{children:h.id})]}),e.canDelete&&o?y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-danger-quiet",onClick:()=>{window.confirm(`Delete "${h.label}" from the font library?`)&&o(h.id)},children:"Delete"}):null]},h.id))})]}),y.jsx(f2,{open:l!=null,title:l?.label??"Font preview",subtitle:l?`${l.source==="google"?"Google Fonts":"Upload"} · ${l.family}`:void 0,family:l?.family??"",files:l?.files,onClose:()=>u(null)})]})}function WQ({label:t="Gallery",items:e,accept:n,maxBytes:r,canDelete:i,loading:s,onRefresh:o,onUpload:l,onDelete:u}){const f={field:"gallery",accept:n,maxBytes:r};return y.jsxs("div",{className:"vertebr-gallery",children:[y.jsxs("div",{className:"vertebr-panel-head",children:[y.jsx("h2",{children:t}),y.jsxs("div",{className:"vertebr-gallery-head-actions",children:[y.jsx("span",{className:"vertebr-count",children:e.length}),o?y.jsx("button",{type:"button",className:"vertebr-btn",onClick:o,disabled:s,children:s?"Refreshing…":"Refresh"}):null]})]}),y.jsxs("div",{className:"vertebr-gallery-body",children:[y.jsx(Pc,{meta:f,multiple:!0,label:"Drop images here or browse to add to the gallery",onUpload:l}),e.length===0?y.jsx("div",{className:"vertebr-empty",children:"No images in the gallery yet."}):y.jsx("div",{className:"vertebr-gallery-grid",children:e.map(h=>y.jsxs("article",{className:"vertebr-gallery-card",children:[y.jsx("a",{className:"vertebr-gallery-thumb",href:h.url,target:"_blank",rel:"noreferrer",title:h.name??h.url,children:y.jsx("img",{src:h.url,alt:h.name??"",loading:"lazy"})}),y.jsxs("div",{className:"vertebr-gallery-meta",children:[y.jsx("strong",{title:h.name??h.id,children:h.name??h.id}),y.jsx("a",{href:h.url,target:"_blank",rel:"noreferrer",children:h.url.replace(/^https?:\/\//i,"")})]}),i&&u?y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-danger-quiet",onClick:()=>{window.confirm("Delete this image from the gallery?")&&u(h.id)},children:"Delete"}):null]},h.id))})]})]})}const d0=3;function KQ(t){const e=Math.max(0,...t),n=Math.min(0,...t),r=e-n||1;return{min:n,max:e,span:r}}function ZQ(t,e){if(!(t>0))return e==="usd"?100:4;if(e!=="usd"){const o=Math.ceil(t);return o<=4?4:o<=6?6:o<=8?8:o<=10?10:Math.ceil(o/5)*5}const n=t*1.08,r=10**Math.floor(Math.log10(n)),i=n/r;return(i<=1?1:i<=2?2:i<=2.5?2.5:i<=5?5:10)*r}function YQ(t,e){if(e==="usd")return[0,t/2,t];const n=t<=4||t<=10?2:t/4,r=[];for(let i=0;i<t-1e-9;i+=n)r.push(i);return r.push(t),r}function kd(t){return t[0]?t.map((n,r)=>`${r===0?"M":"L"} ${n.x} ${n.y}`).join(" "):""}function XQ({series:t,tone:e="neutral"}){if(t.length<2)return null;const n=72,r=28,{min:i,span:s}=KQ(t),o=t.map((f,h)=>({x:h/(t.length-1)*n,y:r-(f-i)/s*(r-2)-1})),l=o[o.length-1],u=l?`${kd(o)} L ${l.x} ${r} L 0 ${r} Z`:"";return y.jsxs("svg",{className:"vertebr-sparkline","data-tone":e,viewBox:`0 0 ${n} ${r}`,width:n,height:r,"aria-hidden":"true",children:[u?y.jsx("path",{d:u,fill:"currentColor",opacity:"0.16"}):null,y.jsx("path",{d:kd(o),fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round",strokeLinecap:"round"})]})}function JQ(t,e){return e==="usd"?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:Number.isInteger(t)||Math.abs(t)>=100?0:2}).format(t):new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(t)}function QQ(){return y.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:y.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function eee(){return y.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:y.jsx("path",{d:"M2.5 6.2 4.8 8.5 9.5 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function tee({charts:t,value:e,onChange:n}){return y.jsxs(Mg,{value:e,onValueChange:n,children:[y.jsxs(Ng,{className:"vertebr-select-trigger vertebr-chart-series","aria-label":"Chart series",children:[y.jsx("span",{className:"vertebr-select-value",children:y.jsx(Og,{})}),y.jsx(Dg,{className:"vertebr-select-icon",children:y.jsx(QQ,{})})]}),y.jsx(Ig,{children:y.jsx(jg,{className:"vertebr-select-content",position:"popper",sideOffset:6,children:y.jsx(Pg,{className:"vertebr-select-viewport",children:t.map(r=>y.jsxs(zg,{value:r.id,className:"vertebr-select-item",children:[y.jsx($g,{children:r.label}),y.jsx(Bg,{className:"vertebr-select-check",children:y.jsx(eee,{})})]},r.id))})})})]})}function nee({charts:t,chartId:e,onChartIdChange:n,compareLabel:r="Previous period"}){const i=t.find(oe=>oe.id===e)??t[0],s=i?.unit,o=E.useMemo(()=>t.filter(oe=>oe.id!==i?.id&&(oe.unit??"count")===(s??"count")),[t,i?.id,s]),l=o.length>0,[u,f]=E.useState("period"),[h,m]=E.useState([]),[g,b]=E.useState(null);if(E.useEffect(()=>{b(null)},[i?.id,u,h.join("|")]),E.useEffect(()=>{!l&&u==="metrics"&&f("period")},[l,u]),E.useEffect(()=>{m(oe=>oe.filter(pe=>o.some(Ie=>Ie.id===pe)))},[o]),!i)return y.jsx("article",{className:"vertebr-chart",children:y.jsx("p",{className:"vertebr-chart-empty",children:"No activity in this window."})});const x=u==="metrics"&&l,S=o.filter(oe=>h.includes(oe.id)).slice(0,d0-1),k=x?[i,...S]:[i],C=i.points.map(oe=>oe.label),_=960,M=220,R={top:12,right:16,bottom:28,left:52},A=_-R.left-R.right,O=M-R.top-R.bottom,D=k.flatMap(oe=>oe.points.map(pe=>pe.value)),j=x?[]:(i.comparePoints??[]).map(oe=>oe.value),z=!x&&j.length>0,q=ZQ(Math.max(0,...D,...j),i.unit),Z=(oe,pe)=>R.left+(pe<=1?A/2:oe/(pe-1)*A),G=k.map(oe=>oe.points.map((pe,Ie)=>{const Ue=Z(Ie,C.length||oe.points.length),Ze=R.top+O-Math.max(0,pe.value)/q*O;return{x:Ue,y:Ze,value:pe.value,label:pe.label}})),ee=G[0]??[],te=j.map((oe,pe)=>{const Ie=Z(pe,C.length||j.length),Ue=R.top+O-Math.max(0,oe)/q*O;return{x:Ie,y:Ue,value:oe,label:i.comparePoints?.[pe]?.label??""}}),fe=YQ(q,i.unit),B=Math.max(1,Math.ceil(ee.length/7)),L=i.points.reduce((oe,pe)=>oe+pe.value,0),U=ee.length===0||k.every(oe=>oe.points.every(pe=>pe.value===0)),ue=g??(ee.length>0?ee.length-1:null),Se=`vb-chart-fill-${i.id}`,V=oe=>JQ(oe,i.unit),Y=z&&ue!=null?te[ue]:void 0,he=kd(ee),ve=ee[0],Ae=ee[ee.length-1],Re=R.top+O,Le=!x&&ve&&Ae?`${he} L ${Ae.x} ${Re} L ${ve.x} ${Re} Z`:"",Te=oe=>{m(pe=>pe.includes(oe)?pe.filter(Ie=>Ie!==oe):pe.length>=d0-1?pe:[...pe,oe])};return y.jsxs("article",{className:"vertebr-chart","data-empty":U?"true":void 0,"data-mode":x?"metrics":"period",children:[y.jsxs("div",{className:"vertebr-chart-head",children:[y.jsxs("div",{className:"vertebr-chart-head-start",children:[t.length>1?y.jsx(tee,{charts:t,value:i.id,onChange:n}):y.jsx("p",{className:"vertebr-chart-kicker",children:i.label}),l?y.jsxs("div",{className:"vertebr-chart-mode",role:"group","aria-label":"Chart mode",children:[y.jsx("button",{type:"button",className:"vertebr-chart-mode-btn","data-active":u==="period"?"true":void 0,onClick:()=>f("period"),children:"vs previous"}),y.jsx("button",{type:"button",className:"vertebr-chart-mode-btn","data-active":u==="metrics"?"true":void 0,onClick:()=>{f("metrics"),m(oe=>oe.length>0?oe:o.slice(0,1).map(pe=>pe.id))},children:"Compare metrics"})]}):null,x?y.jsx("div",{className:"vertebr-chart-metric-toggles",children:o.map(oe=>{const pe=h.includes(oe.id),Ie=!pe&&S.length>=d0-1;return y.jsx("button",{type:"button",className:"vertebr-chart-metric-toggle","data-on":pe?"true":void 0,disabled:Ie,onClick:()=>Te(oe.id),children:oe.label},oe.id)})}):z?y.jsxs("p",{className:"vertebr-chart-legend",children:[y.jsxs("span",{children:[y.jsx("i",{"data-series":"current"}),"Current"]}),y.jsxs("span",{children:[y.jsx("i",{"data-series":"previous"}),r]})]}):null,x?y.jsx("p",{className:"vertebr-chart-legend",children:k.map((oe,pe)=>y.jsxs("span",{children:[y.jsx("i",{"data-series":`m${pe}`}),oe.label]},oe.id))}):null]}),y.jsx("p",{className:"vertebr-chart-total",children:x?"—":V(L)})]}),ee.length===0?y.jsx("p",{className:"vertebr-chart-empty",children:"No activity in this window."}):y.jsxs("div",{className:"vertebr-chart-plot",children:[y.jsxs("svg",{className:"vertebr-chart-svg",viewBox:`0 0 ${_} ${M}`,role:"img","aria-label":x?k.map(oe=>oe.label).join(" vs "):i.label,onMouseLeave:()=>b(null),onMouseMove:oe=>{const pe=oe.currentTarget.getBoundingClientRect(),Ie=(oe.clientX-pe.left)/pe.width*_;let Ue=0,Ze=1/0;ee.forEach((ft,vt)=>{const Kt=Math.abs(ft.x-Ie);Kt<Ze&&(Ze=Kt,Ue=vt)}),b(Ue)},children:[y.jsx("defs",{children:y.jsxs("linearGradient",{id:Se,x1:"0",y1:"0",x2:"0",y2:"1",children:[y.jsx("stop",{offset:"0%",stopColor:"var(--vb-accent)",stopOpacity:"0.32"}),y.jsx("stop",{offset:"100%",stopColor:"var(--vb-accent)",stopOpacity:"0"})]})}),fe.map((oe,pe)=>{const Ie=R.top+O-oe/q*O;return y.jsxs("g",{children:[y.jsx("line",{className:oe===0?"vertebr-chart-baseline":"vertebr-chart-grid",x1:R.left,x2:_-R.right,y1:Ie,y2:Ie}),y.jsx("text",{className:"vertebr-chart-axis",x:R.left-8,y:Ie+3,textAnchor:"end",children:V(oe)})]},`${oe}-${pe}`)}),Le?y.jsx("path",{className:"vertebr-chart-area",d:Le,fill:`url(#${Se})`}):null,z?y.jsx("path",{className:"vertebr-chart-line-compare",d:kd(te),fill:"none"}):null,G.map((oe,pe)=>y.jsx("path",{className:pe===0&&!x?"vertebr-chart-line":"vertebr-chart-line-metric","data-series":x||pe>0?`m${pe}`:void 0,d:kd(oe),fill:"none"},k[pe]?.id??pe)),ue!=null?y.jsx("line",{className:"vertebr-chart-crosshair",x1:ee[ue]?.x,x2:ee[ue]?.x,y1:R.top,y2:R.top+O}):null,ee.map((oe,pe)=>pe%B===0||pe===ee.length-1?y.jsx("text",{className:"vertebr-chart-axis",x:oe.x,y:M-8,textAnchor:pe===0?"start":pe===ee.length-1?"end":"middle",children:oe.label},`label-${oe.label}-${pe}`):null),G.map((oe,pe)=>oe.map((Ie,Ue)=>ue===Ue?y.jsx("circle",{className:pe===0&&!x?"vertebr-chart-dot":"vertebr-chart-dot-metric","data-series":x||pe>0?`m${pe}`:void 0,"data-active":"true",cx:Ie.x,cy:Ie.y,r:pe===0?4.2:3.4},`dot-${k[pe]?.id}-${Ue}`):null)),Y?y.jsx("circle",{className:"vertebr-chart-dot-compare",cx:Y.x,cy:Y.y,r:3.4}):null]}),ue!=null&&ee[ue]?y.jsxs("div",{className:"vertebr-chart-tooltip",style:{left:`${Math.min(88,Math.max(12,ee[ue].x/_*100))}%`},children:[y.jsx("span",{children:ee[ue].label}),x?k.map((oe,pe)=>y.jsxs("strong",{className:"vertebr-chart-tooltip-row","data-series":`m${pe}`,children:[oe.label," ",V(oe.points[ue]?.value??0)]},oe.id)):y.jsxs(y.Fragment,{children:[y.jsx("strong",{children:V(ee[ue].value)}),Y?y.jsxs("span",{className:"vertebr-chart-tooltip-compare",children:["Prev ",V(Y.value),Y.label?` · ${Y.label}`:""]}):null]})]}):null]})]})}function ree(t){const e=Math.abs(t),n=e>=10?e.toFixed(0):e.toFixed(1);return t>0?`+${n}%`:t<0?`−${n}%`:"0%"}function iee(t){return t>0?"up":t<0?"down":"flat"}function mM({value:t}){return t==null?y.jsx("span",{className:"vertebr-metrics-table-empty",children:"—"}):y.jsx("span",{className:"vertebr-metric-delta","data-dir":iee(t),children:ree(t)})}function see(){return y.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:y.jsx("path",{d:"M2.5 6.2 4.8 8.5 9.5 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function oee(){return y.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:y.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function aee({value:t,onChange:e,disabled:n}){return y.jsxs(Mg,{value:t,onValueChange:r=>e(r),disabled:n,children:[y.jsxs(Ng,{className:"vertebr-select-trigger vertebr-metrics-range","aria-label":"Metrics range",children:[y.jsx("span",{className:"vertebr-select-value",children:y.jsx(Og,{})}),y.jsx(Dg,{className:"vertebr-select-icon",children:y.jsx(oee,{})})]}),y.jsx(Ig,{children:y.jsx(jg,{className:"vertebr-select-content",position:"popper",sideOffset:6,children:y.jsx(Pg,{className:"vertebr-select-viewport",children:BN.map(r=>y.jsxs(zg,{value:r.id,className:"vertebr-select-item",children:[y.jsx($g,{children:r.label}),y.jsx(Bg,{className:"vertebr-select-check",children:y.jsx(see,{})})]},r.id))})})})]})}function lee({label:t="Overview",windowLabel:e,compareLabel:n,metrics:r,charts:i=[],range:s,onRangeChange:o,onRefresh:l,loading:u}){const f=r.filter(M=>M.featured).slice(0,4),h=f.length>0?f:r.slice(0,4),m=new Set(h.map(M=>M.id)),g=r.filter(M=>!m.has(M.id)),[b,x]=E.useState(!0),S=E.useMemo(()=>new Set(i.map(M=>M.id)),[i]),[k,C]=E.useState(()=>i[0]?.id??""),_=S.has(k)?k:i[0]?.id??"";return y.jsxs("div",{className:"vertebr-metrics",children:[y.jsxs("div",{className:"vertebr-panel-head",children:[y.jsxs("div",{children:[y.jsx("h2",{children:t}),e?y.jsx("p",{className:"vertebr-metrics-window",children:e}):null]}),o||l?y.jsxs("div",{className:"vertebr-panel-head-actions",children:[o&&s?y.jsx(aee,{value:s,onChange:o,disabled:u}):null,l?y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:l,disabled:u,children:u?"Refreshing…":"Refresh"}):null]}):null]}),r.length===0&&i.length===0?y.jsx("div",{className:"vertebr-empty",children:"No metrics registered yet."}):y.jsxs("div",{className:"vertebr-metrics-body",children:[h.length>0?y.jsx("section",{className:"vertebr-metrics-block",children:y.jsx("div",{className:"vertebr-metrics-kpis",children:h.map(M=>{const R=S.has(M.id);return y.jsxs("article",{className:"vertebr-kpi","data-tone":M.tone??"neutral","data-selectable":R?"true":void 0,"data-active":R&&M.id===_?"true":void 0,role:R?"button":void 0,tabIndex:R?0:void 0,onClick:R?()=>C(M.id):void 0,onKeyDown:R?A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),C(M.id))}:void 0,children:[y.jsxs("div",{className:"vertebr-kpi-top",children:[y.jsx("p",{className:"vertebr-metric-label",children:M.label}),M.series&&M.series.length>1?y.jsx(XQ,{series:M.series,tone:M.tone}):null]}),y.jsx("p",{className:"vertebr-kpi-value",children:M.value}),y.jsxs("div",{className:"vertebr-kpi-foot",children:[M.delta!=null?y.jsx(mM,{value:M.delta}):null,M.hint?y.jsx("span",{className:"vertebr-metric-hint",children:M.hint}):null]})]},M.id)})})}):null,i.length>0&&_?y.jsx("section",{className:"vertebr-metrics-block",children:y.jsx(nee,{charts:i,chartId:_,onChartIdChange:C,compareLabel:n})}):null,g.length>0?y.jsx("section",{className:"vertebr-metrics-block",children:y.jsxs("div",{className:"vertebr-metrics-table-wrap","data-collapsed":b?void 0:"true",children:[y.jsxs("button",{type:"button",className:"vertebr-metrics-table-head","aria-expanded":b,onClick:()=>x(M=>!M),children:[y.jsx("p",{className:"vertebr-chart-kicker",children:"Breakdown"}),y.jsx("span",{className:"vertebr-metrics-chevron","aria-hidden":"true"})]}),b?y.jsxs("table",{className:"vertebr-table vertebr-metrics-table",children:[y.jsx("thead",{children:y.jsxs("tr",{children:[y.jsx("th",{children:"Metric"}),y.jsx("th",{children:"Value"}),y.jsx("th",{children:"Change"}),y.jsx("th",{children:"Notes"})]})}),y.jsx("tbody",{children:g.map(M=>y.jsxs("tr",{"data-tone":M.tone??"neutral",children:[y.jsxs("td",{children:[y.jsx("span",{className:"vertebr-metrics-table-label",children:M.label}),M.section?y.jsx("span",{className:"vertebr-metrics-table-section",children:M.section}):null]}),y.jsx("td",{className:"vertebr-metrics-table-value",children:M.value}),y.jsx("td",{children:y.jsx(mM,{value:M.delta})}),y.jsx("td",{className:"vertebr-metrics-table-notes",children:M.hint??"—"})]},M.id))})]}):null]})}):null]})]})}function Ro(t,e){return typeof t=="function"?t(e):t}function Lr(t,e){return n=>{e.setState(r=>({...r,[t]:Ro(n,r[t])}))}}function Hg(t){return t instanceof Function}function cee(t){return Array.isArray(t)&&t.every(e=>typeof e=="number")}function uee(t,e){const n=[],r=i=>{i.forEach(s=>{n.push(s);const o=e(s);o!=null&&o.length&&r(o)})};return r(t),n}function Ye(t,e,n){let r=[],i;return s=>{let o;n.key&&n.debug&&(o=Date.now());const l=t(s);if(!(l.length!==r.length||l.some((h,m)=>r[m]!==h)))return i;r=l;let f;if(n.key&&n.debug&&(f=Date.now()),i=e(...l),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){const h=Math.round((Date.now()-o)*100)/100,m=Math.round((Date.now()-f)*100)/100,g=m/16,b=(x,S)=>{for(x=String(x);x.length<S;)x=" "+x;return x};console.info(`%c⏱ ${b(m,5)} /${b(h,5)} ms`,`
327
- font-size: .6rem;
328
- font-weight: bold;
329
- color: hsl(${Math.max(0,Math.min(120-120*g,120))}deg 100% 31%);`,n?.key)}return i}}function Xe(t,e,n,r){return{debug:()=>{var i;return(i=t?.debugAll)!=null?i:t[e]},key:!1,onChange:r}}function dee(t,e,n,r){const i=()=>{var o;return(o=s.getValue())!=null?o:t.options.renderFallbackValue},s={id:`${e.id}_${n.id}`,row:e,column:n,getValue:()=>e.getValue(r),renderValue:i,getContext:Ye(()=>[t,n,e,s],(o,l,u,f)=>({table:o,column:l,row:u,cell:f,getValue:f.getValue,renderValue:f.renderValue}),Xe(t.options,"debugCells"))};return t._features.forEach(o=>{o.createCell==null||o.createCell(s,n,e,t)},{}),s}function fee(t,e,n,r){var i,s;const l={...t._getDefaultColumnDef(),...e},u=l.accessorKey;let f=(i=(s=l.id)!=null?s:u?typeof String.prototype.replaceAll=="function"?u.replaceAll(".","_"):u.replace(/\./g,"_"):void 0)!=null?i:typeof l.header=="string"?l.header:void 0,h;if(l.accessorFn?h=l.accessorFn:u&&(u.includes(".")?h=g=>{let b=g;for(const S of u.split(".")){var x;b=(x=b)==null?void 0:x[S]}return b}:h=g=>g[l.accessorKey]),!f)throw new Error;let m={id:`${String(f)}`,accessorFn:h,parent:r,depth:n,columnDef:l,columns:[],getFlatColumns:Ye(()=>[!0],()=>{var g;return[m,...(g=m.columns)==null?void 0:g.flatMap(b=>b.getFlatColumns())]},Xe(t.options,"debugColumns")),getLeafColumns:Ye(()=>[t._getOrderColumnsFn()],g=>{var b;if((b=m.columns)!=null&&b.length){let x=m.columns.flatMap(S=>S.getLeafColumns());return g(x)}return[m]},Xe(t.options,"debugColumns"))};for(const g of t._features)g.createColumn==null||g.createColumn(m,t);return m}const Wn="debugHeaders";function gM(t,e,n){var r;let s={id:(r=n.id)!=null?r:e.id,column:e,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const o=[],l=u=>{u.subHeaders&&u.subHeaders.length&&u.subHeaders.map(l),o.push(u)};return l(s),o},getContext:()=>({table:t,header:s,column:e})};return t._features.forEach(o=>{o.createHeader==null||o.createHeader(s,t)}),s}const hee={createTable:t=>{t.getHeaderGroups=Ye(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,r,i)=>{var s,o;const l=(s=r?.map(m=>n.find(g=>g.id===m)).filter(Boolean))!=null?s:[],u=(o=i?.map(m=>n.find(g=>g.id===m)).filter(Boolean))!=null?o:[],f=n.filter(m=>!(r!=null&&r.includes(m.id))&&!(i!=null&&i.includes(m.id)));return ip(e,[...l,...f,...u],t)},Xe(t.options,Wn)),t.getCenterHeaderGroups=Ye(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,r,i)=>(n=n.filter(s=>!(r!=null&&r.includes(s.id))&&!(i!=null&&i.includes(s.id))),ip(e,n,t,"center")),Xe(t.options,Wn)),t.getLeftHeaderGroups=Ye(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left],(e,n,r)=>{var i;const s=(i=r?.map(o=>n.find(l=>l.id===o)).filter(Boolean))!=null?i:[];return ip(e,s,t,"left")},Xe(t.options,Wn)),t.getRightHeaderGroups=Ye(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.right],(e,n,r)=>{var i;const s=(i=r?.map(o=>n.find(l=>l.id===o)).filter(Boolean))!=null?i:[];return ip(e,s,t,"right")},Xe(t.options,Wn)),t.getFooterGroups=Ye(()=>[t.getHeaderGroups()],e=>[...e].reverse(),Xe(t.options,Wn)),t.getLeftFooterGroups=Ye(()=>[t.getLeftHeaderGroups()],e=>[...e].reverse(),Xe(t.options,Wn)),t.getCenterFooterGroups=Ye(()=>[t.getCenterHeaderGroups()],e=>[...e].reverse(),Xe(t.options,Wn)),t.getRightFooterGroups=Ye(()=>[t.getRightHeaderGroups()],e=>[...e].reverse(),Xe(t.options,Wn)),t.getFlatHeaders=Ye(()=>[t.getHeaderGroups()],e=>e.map(n=>n.headers).flat(),Xe(t.options,Wn)),t.getLeftFlatHeaders=Ye(()=>[t.getLeftHeaderGroups()],e=>e.map(n=>n.headers).flat(),Xe(t.options,Wn)),t.getCenterFlatHeaders=Ye(()=>[t.getCenterHeaderGroups()],e=>e.map(n=>n.headers).flat(),Xe(t.options,Wn)),t.getRightFlatHeaders=Ye(()=>[t.getRightHeaderGroups()],e=>e.map(n=>n.headers).flat(),Xe(t.options,Wn)),t.getCenterLeafHeaders=Ye(()=>[t.getCenterFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Xe(t.options,Wn)),t.getLeftLeafHeaders=Ye(()=>[t.getLeftFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Xe(t.options,Wn)),t.getRightLeafHeaders=Ye(()=>[t.getRightFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),Xe(t.options,Wn)),t.getLeafHeaders=Ye(()=>[t.getLeftHeaderGroups(),t.getCenterHeaderGroups(),t.getRightHeaderGroups()],(e,n,r)=>{var i,s,o,l,u,f;return[...(i=(s=e[0])==null?void 0:s.headers)!=null?i:[],...(o=(l=n[0])==null?void 0:l.headers)!=null?o:[],...(u=(f=r[0])==null?void 0:f.headers)!=null?u:[]].map(h=>h.getLeafHeaders()).flat()},Xe(t.options,Wn))}};function ip(t,e,n,r){var i,s;let o=0;const l=function(g,b){b===void 0&&(b=1),o=Math.max(o,b),g.filter(x=>x.getIsVisible()).forEach(x=>{var S;(S=x.columns)!=null&&S.length&&l(x.columns,b+1)},0)};l(t);let u=[];const f=(g,b)=>{const x={depth:b,id:[r,`${b}`].filter(Boolean).join("_"),headers:[]},S=[];g.forEach(k=>{const C=[...S].reverse()[0],_=k.column.depth===x.depth;let M,R=!1;if(_&&k.column.parent?M=k.column.parent:(M=k.column,R=!0),C&&C?.column===M)C.subHeaders.push(k);else{const A=gM(n,M,{id:[r,b,M.id,k?.id].filter(Boolean).join("_"),isPlaceholder:R,placeholderId:R?`${S.filter(O=>O.column===M).length}`:void 0,depth:b,index:S.length});A.subHeaders.push(k),S.push(A)}x.headers.push(k),k.headerGroup=x}),u.push(x),b>0&&f(S,b-1)},h=e.map((g,b)=>gM(n,g,{depth:o,index:b}));f(h,o-1),u.reverse();const m=g=>g.filter(x=>x.column.getIsVisible()).map(x=>{let S=0,k=0,C=[0];x.subHeaders&&x.subHeaders.length?(C=[],m(x.subHeaders).forEach(M=>{let{colSpan:R,rowSpan:A}=M;S+=R,C.push(A)})):S=1;const _=Math.min(...C);return k=k+_,x.colSpan=S,x.rowSpan=k,{colSpan:S,rowSpan:k}});return m((i=(s=u[0])==null?void 0:s.headers)!=null?i:[]),u}const pee=(t,e,n,r,i,s,o)=>{let l={id:e,index:r,original:n,depth:i,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:u=>{if(l._valuesCache.hasOwnProperty(u))return l._valuesCache[u];const f=t.getColumn(u);if(f!=null&&f.accessorFn)return l._valuesCache[u]=f.accessorFn(l.original,r),l._valuesCache[u]},getUniqueValues:u=>{if(l._uniqueValuesCache.hasOwnProperty(u))return l._uniqueValuesCache[u];const f=t.getColumn(u);if(f!=null&&f.accessorFn)return f.columnDef.getUniqueValues?(l._uniqueValuesCache[u]=f.columnDef.getUniqueValues(l.original,r),l._uniqueValuesCache[u]):(l._uniqueValuesCache[u]=[l.getValue(u)],l._uniqueValuesCache[u])},renderValue:u=>{var f;return(f=l.getValue(u))!=null?f:t.options.renderFallbackValue},subRows:[],getLeafRows:()=>uee(l.subRows,u=>u.subRows),getParentRow:()=>l.parentId?t.getRow(l.parentId,!0):void 0,getParentRows:()=>{let u=[],f=l;for(;;){const h=f.getParentRow();if(!h)break;u.push(h),f=h}return u.reverse()},getAllCells:Ye(()=>[t.getAllLeafColumns()],u=>u.map(f=>dee(t,l,f,f.id)),Xe(t.options,"debugRows")),_getAllCellsByColumnId:Ye(()=>[l.getAllCells()],u=>u.reduce((f,h)=>(f[h.column.id]=h,f),{}),Xe(t.options,"debugRows"))};for(let u=0;u<t._features.length;u++){const f=t._features[u];f==null||f.createRow==null||f.createRow(l,t)}return l},mee={createColumn:(t,e)=>{t._getFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,t.id),t.getFacetedRowModel=()=>t._getFacetedRowModel?t._getFacetedRowModel():e.getPreFilteredRowModel(),t._getFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,t.id),t.getFacetedUniqueValues=()=>t._getFacetedUniqueValues?t._getFacetedUniqueValues():new Map,t._getFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,t.id),t.getFacetedMinMaxValues=()=>{if(t._getFacetedMinMaxValues)return t._getFacetedMinMaxValues()}}},h2=(t,e,n)=>{var r,i;const s=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((i=t.getValue(e))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(s))};h2.autoRemove=t=>wi(t);const p2=(t,e,n)=>{var r;return!!(!((r=t.getValue(e))==null||(r=r.toString())==null)&&r.includes(n))};p2.autoRemove=t=>wi(t);const m2=(t,e,n)=>{var r;return((r=t.getValue(e))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};m2.autoRemove=t=>wi(t);const g2=(t,e,n)=>{var r;return(r=t.getValue(e))==null?void 0:r.includes(n)};g2.autoRemove=t=>wi(t);const y2=(t,e,n)=>!n.some(r=>{var i;return!((i=t.getValue(e))!=null&&i.includes(r))});y2.autoRemove=t=>wi(t)||!(t!=null&&t.length);const b2=(t,e,n)=>n.some(r=>{var i;return(i=t.getValue(e))==null?void 0:i.includes(r)});b2.autoRemove=t=>wi(t)||!(t!=null&&t.length);const v2=(t,e,n)=>t.getValue(e)===n;v2.autoRemove=t=>wi(t);const x2=(t,e,n)=>t.getValue(e)==n;x2.autoRemove=t=>wi(t);const ak=(t,e,n)=>{let[r,i]=n;const s=t.getValue(e);return s>=r&&s<=i};ak.resolveFilterValue=t=>{let[e,n]=t,r=typeof e!="number"?parseFloat(e):e,i=typeof n!="number"?parseFloat(n):n,s=e===null||Number.isNaN(r)?-1/0:r,o=n===null||Number.isNaN(i)?1/0:i;if(s>o){const l=s;s=o,o=l}return[s,o]};ak.autoRemove=t=>wi(t)||wi(t[0])&&wi(t[1]);const bs={includesString:h2,includesStringSensitive:p2,equalsString:m2,arrIncludes:g2,arrIncludesAll:y2,arrIncludesSome:b2,equals:v2,weakEquals:x2,inNumberRange:ak};function wi(t){return t==null||t===""}const gee={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:t=>({columnFilters:[],...t}),getDefaultOptions:t=>({onColumnFiltersChange:Lr("columnFilters",t),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(t,e)=>{t.getAutoFilterFn=()=>{const n=e.getCoreRowModel().flatRows[0],r=n?.getValue(t.id);return typeof r=="string"?bs.includesString:typeof r=="number"?bs.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?bs.equals:Array.isArray(r)?bs.arrIncludes:bs.weakEquals},t.getFilterFn=()=>{var n,r;return Hg(t.columnDef.filterFn)?t.columnDef.filterFn:t.columnDef.filterFn==="auto"?t.getAutoFilterFn():(n=(r=e.options.filterFns)==null?void 0:r[t.columnDef.filterFn])!=null?n:bs[t.columnDef.filterFn]},t.getCanFilter=()=>{var n,r,i;return((n=t.columnDef.enableColumnFilter)!=null?n:!0)&&((r=e.options.enableColumnFilters)!=null?r:!0)&&((i=e.options.enableFilters)!=null?i:!0)&&!!t.accessorFn},t.getIsFiltered=()=>t.getFilterIndex()>-1,t.getFilterValue=()=>{var n;return(n=e.getState().columnFilters)==null||(n=n.find(r=>r.id===t.id))==null?void 0:n.value},t.getFilterIndex=()=>{var n,r;return(n=(r=e.getState().columnFilters)==null?void 0:r.findIndex(i=>i.id===t.id))!=null?n:-1},t.setFilterValue=n=>{e.setColumnFilters(r=>{const i=t.getFilterFn(),s=r?.find(h=>h.id===t.id),o=Ro(n,s?s.value:void 0);if(yM(i,o,t)){var l;return(l=r?.filter(h=>h.id!==t.id))!=null?l:[]}const u={id:t.id,value:o};if(s){var f;return(f=r?.map(h=>h.id===t.id?u:h))!=null?f:[]}return r!=null&&r.length?[...r,u]:[u]})}},createRow:(t,e)=>{t.columnFilters={},t.columnFiltersMeta={}},createTable:t=>{t.setColumnFilters=e=>{const n=t.getAllLeafColumns(),r=i=>{var s;return(s=Ro(e,i))==null?void 0:s.filter(o=>{const l=n.find(u=>u.id===o.id);if(l){const u=l.getFilterFn();if(yM(u,o.value,l))return!1}return!0})};t.options.onColumnFiltersChange==null||t.options.onColumnFiltersChange(r)},t.resetColumnFilters=e=>{var n,r;t.setColumnFilters(e?[]:(n=(r=t.initialState)==null?void 0:r.columnFilters)!=null?n:[])},t.getPreFilteredRowModel=()=>t.getCoreRowModel(),t.getFilteredRowModel=()=>(!t._getFilteredRowModel&&t.options.getFilteredRowModel&&(t._getFilteredRowModel=t.options.getFilteredRowModel(t)),t.options.manualFiltering||!t._getFilteredRowModel?t.getPreFilteredRowModel():t._getFilteredRowModel())}};function yM(t,e,n){return(t&&t.autoRemove?t.autoRemove(e,n):!1)||typeof e>"u"||typeof e=="string"&&!e}const yee=(t,e,n)=>n.reduce((r,i)=>{const s=i.getValue(t);return r+(typeof s=="number"?s:0)},0),bee=(t,e,n)=>{let r;return n.forEach(i=>{const s=i.getValue(t);s!=null&&(r>s||r===void 0&&s>=s)&&(r=s)}),r},vee=(t,e,n)=>{let r;return n.forEach(i=>{const s=i.getValue(t);s!=null&&(r<s||r===void 0&&s>=s)&&(r=s)}),r},xee=(t,e,n)=>{let r,i;return n.forEach(s=>{const o=s.getValue(t);o!=null&&(r===void 0?o>=o&&(r=i=o):(r>o&&(r=o),i<o&&(i=o)))}),[r,i]},wee=(t,e)=>{let n=0,r=0;if(e.forEach(i=>{let s=i.getValue(t);s!=null&&(s=+s)>=s&&(++n,r+=s)}),n)return r/n},See=(t,e)=>{if(!e.length)return;const n=e.map(s=>s.getValue(t));if(!cee(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),i=n.sort((s,o)=>s-o);return n.length%2!==0?i[r]:(i[r-1]+i[r])/2},kee=(t,e)=>Array.from(new Set(e.map(n=>n.getValue(t))).values()),Cee=(t,e)=>new Set(e.map(n=>n.getValue(t))).size,Eee=(t,e)=>e.length,f0={sum:yee,min:bee,max:vee,extent:xee,mean:wee,median:See,unique:kee,uniqueCount:Cee,count:Eee},Tee={getDefaultColumnDef:()=>({aggregatedCell:t=>{var e,n;return(e=(n=t.getValue())==null||n.toString==null?void 0:n.toString())!=null?e:null},aggregationFn:"auto"}),getInitialState:t=>({grouping:[],...t}),getDefaultOptions:t=>({onGroupingChange:Lr("grouping",t),groupedColumnMode:"reorder"}),createColumn:(t,e)=>{t.toggleGrouping=()=>{e.setGrouping(n=>n!=null&&n.includes(t.id)?n.filter(r=>r!==t.id):[...n??[],t.id])},t.getCanGroup=()=>{var n,r;return((n=t.columnDef.enableGrouping)!=null?n:!0)&&((r=e.options.enableGrouping)!=null?r:!0)&&(!!t.accessorFn||!!t.columnDef.getGroupingValue)},t.getIsGrouped=()=>{var n;return(n=e.getState().grouping)==null?void 0:n.includes(t.id)},t.getGroupedIndex=()=>{var n;return(n=e.getState().grouping)==null?void 0:n.indexOf(t.id)},t.getToggleGroupingHandler=()=>{const n=t.getCanGroup();return()=>{n&&t.toggleGrouping()}},t.getAutoAggregationFn=()=>{const n=e.getCoreRowModel().flatRows[0],r=n?.getValue(t.id);if(typeof r=="number")return f0.sum;if(Object.prototype.toString.call(r)==="[object Date]")return f0.extent},t.getAggregationFn=()=>{var n,r;if(!t)throw new Error;return Hg(t.columnDef.aggregationFn)?t.columnDef.aggregationFn:t.columnDef.aggregationFn==="auto"?t.getAutoAggregationFn():(n=(r=e.options.aggregationFns)==null?void 0:r[t.columnDef.aggregationFn])!=null?n:f0[t.columnDef.aggregationFn]}},createTable:t=>{t.setGrouping=e=>t.options.onGroupingChange==null?void 0:t.options.onGroupingChange(e),t.resetGrouping=e=>{var n,r;t.setGrouping(e?[]:(n=(r=t.initialState)==null?void 0:r.grouping)!=null?n:[])},t.getPreGroupedRowModel=()=>t.getFilteredRowModel(),t.getGroupedRowModel=()=>(!t._getGroupedRowModel&&t.options.getGroupedRowModel&&(t._getGroupedRowModel=t.options.getGroupedRowModel(t)),t.options.manualGrouping||!t._getGroupedRowModel?t.getPreGroupedRowModel():t._getGroupedRowModel())},createRow:(t,e)=>{t.getIsGrouped=()=>!!t.groupingColumnId,t.getGroupingValue=n=>{if(t._groupingValuesCache.hasOwnProperty(n))return t._groupingValuesCache[n];const r=e.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(t._groupingValuesCache[n]=r.columnDef.getGroupingValue(t.original),t._groupingValuesCache[n]):t.getValue(n)},t._groupingValuesCache={}},createCell:(t,e,n,r)=>{t.getIsGrouped=()=>e.getIsGrouped()&&e.id===n.groupingColumnId,t.getIsPlaceholder=()=>!t.getIsGrouped()&&e.getIsGrouped(),t.getIsAggregated=()=>{var i;return!t.getIsGrouped()&&!t.getIsPlaceholder()&&!!((i=n.subRows)!=null&&i.length)}}};function _ee(t,e,n){if(!(e!=null&&e.length)||!n)return t;const r=t.filter(s=>!e.includes(s.id));return n==="remove"?r:[...e.map(s=>t.find(o=>o.id===s)).filter(Boolean),...r]}const Aee={getInitialState:t=>({columnOrder:[],...t}),getDefaultOptions:t=>({onColumnOrderChange:Lr("columnOrder",t)}),createColumn:(t,e)=>{t.getIndex=Ye(n=>[Cd(e,n)],n=>n.findIndex(r=>r.id===t.id),Xe(e.options,"debugColumns")),t.getIsFirstColumn=n=>{var r;return((r=Cd(e,n)[0])==null?void 0:r.id)===t.id},t.getIsLastColumn=n=>{var r;const i=Cd(e,n);return((r=i[i.length-1])==null?void 0:r.id)===t.id}},createTable:t=>{t.setColumnOrder=e=>t.options.onColumnOrderChange==null?void 0:t.options.onColumnOrderChange(e),t.resetColumnOrder=e=>{var n;t.setColumnOrder(e?[]:(n=t.initialState.columnOrder)!=null?n:[])},t._getOrderColumnsFn=Ye(()=>[t.getState().columnOrder,t.getState().grouping,t.options.groupedColumnMode],(e,n,r)=>i=>{let s=[];if(!(e!=null&&e.length))s=i;else{const o=[...e],l=[...i];for(;l.length&&o.length;){const u=o.shift(),f=l.findIndex(h=>h.id===u);f>-1&&s.push(l.splice(f,1)[0])}s=[...s,...l]}return _ee(s,n,r)},Xe(t.options,"debugTable"))}},h0=()=>({left:[],right:[]}),Ree={getInitialState:t=>({columnPinning:h0(),...t}),getDefaultOptions:t=>({onColumnPinningChange:Lr("columnPinning",t)}),createColumn:(t,e)=>{t.pin=n=>{const r=t.getLeafColumns().map(i=>i.id).filter(Boolean);e.setColumnPinning(i=>{var s,o;if(n==="right"){var l,u;return{left:((l=i?.left)!=null?l:[]).filter(m=>!(r!=null&&r.includes(m))),right:[...((u=i?.right)!=null?u:[]).filter(m=>!(r!=null&&r.includes(m))),...r]}}if(n==="left"){var f,h;return{left:[...((f=i?.left)!=null?f:[]).filter(m=>!(r!=null&&r.includes(m))),...r],right:((h=i?.right)!=null?h:[]).filter(m=>!(r!=null&&r.includes(m)))}}return{left:((s=i?.left)!=null?s:[]).filter(m=>!(r!=null&&r.includes(m))),right:((o=i?.right)!=null?o:[]).filter(m=>!(r!=null&&r.includes(m)))}})},t.getCanPin=()=>t.getLeafColumns().some(r=>{var i,s,o;return((i=r.columnDef.enablePinning)!=null?i:!0)&&((s=(o=e.options.enableColumnPinning)!=null?o:e.options.enablePinning)!=null?s:!0)}),t.getIsPinned=()=>{const n=t.getLeafColumns().map(l=>l.id),{left:r,right:i}=e.getState().columnPinning,s=n.some(l=>r?.includes(l)),o=n.some(l=>i?.includes(l));return s?"left":o?"right":!1},t.getPinnedIndex=()=>{var n,r;const i=t.getIsPinned();return i?(n=(r=e.getState().columnPinning)==null||(r=r[i])==null?void 0:r.indexOf(t.id))!=null?n:-1:0}},createRow:(t,e)=>{t.getCenterVisibleCells=Ye(()=>[t._getAllVisibleCells(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,r,i)=>{const s=[...r??[],...i??[]];return n.filter(o=>!s.includes(o.column.id))},Xe(e.options,"debugRows")),t.getLeftVisibleCells=Ye(()=>[t._getAllVisibleCells(),e.getState().columnPinning.left],(n,r)=>(r??[]).map(s=>n.find(o=>o.column.id===s)).filter(Boolean).map(s=>({...s,position:"left"})),Xe(e.options,"debugRows")),t.getRightVisibleCells=Ye(()=>[t._getAllVisibleCells(),e.getState().columnPinning.right],(n,r)=>(r??[]).map(s=>n.find(o=>o.column.id===s)).filter(Boolean).map(s=>({...s,position:"right"})),Xe(e.options,"debugRows"))},createTable:t=>{t.setColumnPinning=e=>t.options.onColumnPinningChange==null?void 0:t.options.onColumnPinningChange(e),t.resetColumnPinning=e=>{var n,r;return t.setColumnPinning(e?h0():(n=(r=t.initialState)==null?void 0:r.columnPinning)!=null?n:h0())},t.getIsSomeColumnsPinned=e=>{var n;const r=t.getState().columnPinning;if(!e){var i,s;return!!((i=r.left)!=null&&i.length||(s=r.right)!=null&&s.length)}return!!((n=r[e])!=null&&n.length)},t.getLeftLeafColumns=Ye(()=>[t.getAllLeafColumns(),t.getState().columnPinning.left],(e,n)=>(n??[]).map(r=>e.find(i=>i.id===r)).filter(Boolean),Xe(t.options,"debugColumns")),t.getRightLeafColumns=Ye(()=>[t.getAllLeafColumns(),t.getState().columnPinning.right],(e,n)=>(n??[]).map(r=>e.find(i=>i.id===r)).filter(Boolean),Xe(t.options,"debugColumns")),t.getCenterLeafColumns=Ye(()=>[t.getAllLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,r)=>{const i=[...n??[],...r??[]];return e.filter(s=>!i.includes(s.id))},Xe(t.options,"debugColumns"))}};function Mee(t){return t||(typeof document<"u"?document:null)}const sp={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},p0=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Nee={getDefaultColumnDef:()=>sp,getInitialState:t=>({columnSizing:{},columnSizingInfo:p0(),...t}),getDefaultOptions:t=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Lr("columnSizing",t),onColumnSizingInfoChange:Lr("columnSizingInfo",t)}),createColumn:(t,e)=>{t.getSize=()=>{var n,r,i;const s=e.getState().columnSizing[t.id];return Math.min(Math.max((n=t.columnDef.minSize)!=null?n:sp.minSize,(r=s??t.columnDef.size)!=null?r:sp.size),(i=t.columnDef.maxSize)!=null?i:sp.maxSize)},t.getStart=Ye(n=>[n,Cd(e,n),e.getState().columnSizing],(n,r)=>r.slice(0,t.getIndex(n)).reduce((i,s)=>i+s.getSize(),0),Xe(e.options,"debugColumns")),t.getAfter=Ye(n=>[n,Cd(e,n),e.getState().columnSizing],(n,r)=>r.slice(t.getIndex(n)+1).reduce((i,s)=>i+s.getSize(),0),Xe(e.options,"debugColumns")),t.resetSize=()=>{e.setColumnSizing(n=>{let{[t.id]:r,...i}=n;return i})},t.getCanResize=()=>{var n,r;return((n=t.columnDef.enableResizing)!=null?n:!0)&&((r=e.options.enableColumnResizing)!=null?r:!0)},t.getIsResizing=()=>e.getState().columnSizingInfo.isResizingColumn===t.id},createHeader:(t,e)=>{t.getSize=()=>{let n=0;const r=i=>{if(i.subHeaders.length)i.subHeaders.forEach(r);else{var s;n+=(s=i.column.getSize())!=null?s:0}};return r(t),n},t.getStart=()=>{if(t.index>0){const n=t.headerGroup.headers[t.index-1];return n.getStart()+n.getSize()}return 0},t.getResizeHandler=n=>{const r=e.getColumn(t.column.id),i=r?.getCanResize();return s=>{if(!r||!i||(s.persist==null||s.persist(),m0(s)&&s.touches&&s.touches.length>1))return;const o=t.getSize(),l=t?t.getLeafHeaders().map(C=>[C.column.id,C.column.getSize()]):[[r.id,r.getSize()]],u=m0(s)?Math.round(s.touches[0].clientX):s.clientX,f={},h=(C,_)=>{typeof _=="number"&&(e.setColumnSizingInfo(M=>{var R,A;const O=e.options.columnResizeDirection==="rtl"?-1:1,D=(_-((R=M?.startOffset)!=null?R:0))*O,j=Math.max(D/((A=M?.startSize)!=null?A:0),-.999999);return M.columnSizingStart.forEach(z=>{let[q,Z]=z;f[q]=Math.round(Math.max(Z+Z*j,0)*100)/100}),{...M,deltaOffset:D,deltaPercentage:j}}),(e.options.columnResizeMode==="onChange"||C==="end")&&e.setColumnSizing(M=>({...M,...f})))},m=C=>h("move",C),g=C=>{h("end",C),e.setColumnSizingInfo(_=>({..._,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},b=Mee(n),x={moveHandler:C=>m(C.clientX),upHandler:C=>{b?.removeEventListener("mousemove",x.moveHandler),b?.removeEventListener("mouseup",x.upHandler),g(C.clientX)}},S={moveHandler:C=>(C.cancelable&&(C.preventDefault(),C.stopPropagation()),m(C.touches[0].clientX),!1),upHandler:C=>{var _;b?.removeEventListener("touchmove",S.moveHandler),b?.removeEventListener("touchend",S.upHandler),C.cancelable&&(C.preventDefault(),C.stopPropagation()),g((_=C.touches[0])==null?void 0:_.clientX)}},k=Oee()?{passive:!1}:!1;m0(s)?(b?.addEventListener("touchmove",S.moveHandler,k),b?.addEventListener("touchend",S.upHandler,k)):(b?.addEventListener("mousemove",x.moveHandler,k),b?.addEventListener("mouseup",x.upHandler,k)),e.setColumnSizingInfo(C=>({...C,startOffset:u,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:r.id}))}}},createTable:t=>{t.setColumnSizing=e=>t.options.onColumnSizingChange==null?void 0:t.options.onColumnSizingChange(e),t.setColumnSizingInfo=e=>t.options.onColumnSizingInfoChange==null?void 0:t.options.onColumnSizingInfoChange(e),t.resetColumnSizing=e=>{var n;t.setColumnSizing(e?{}:(n=t.initialState.columnSizing)!=null?n:{})},t.resetHeaderSizeInfo=e=>{var n;t.setColumnSizingInfo(e?p0():(n=t.initialState.columnSizingInfo)!=null?n:p0())},t.getTotalSize=()=>{var e,n;return(e=(n=t.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?e:0},t.getLeftTotalSize=()=>{var e,n;return(e=(n=t.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?e:0},t.getCenterTotalSize=()=>{var e,n;return(e=(n=t.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?e:0},t.getRightTotalSize=()=>{var e,n;return(e=(n=t.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?e:0}}};let op=null;function Oee(){if(typeof op=="boolean")return op;let t=!1;try{const e={get passive(){return t=!0,!1}},n=()=>{};window.addEventListener("test",n,e),window.removeEventListener("test",n)}catch{t=!1}return op=t,op}function m0(t){return t.type==="touchstart"}const Dee={getInitialState:t=>({columnVisibility:{},...t}),getDefaultOptions:t=>({onColumnVisibilityChange:Lr("columnVisibility",t)}),createColumn:(t,e)=>{t.toggleVisibility=n=>{t.getCanHide()&&e.setColumnVisibility(r=>({...r,[t.id]:n??!t.getIsVisible()}))},t.getIsVisible=()=>{var n,r;const i=t.columns;return(n=i.length?i.some(s=>s.getIsVisible()):(r=e.getState().columnVisibility)==null?void 0:r[t.id])!=null?n:!0},t.getCanHide=()=>{var n,r;return((n=t.columnDef.enableHiding)!=null?n:!0)&&((r=e.options.enableHiding)!=null?r:!0)},t.getToggleVisibilityHandler=()=>n=>{t.toggleVisibility==null||t.toggleVisibility(n.target.checked)}},createRow:(t,e)=>{t._getAllVisibleCells=Ye(()=>[t.getAllCells(),e.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),Xe(e.options,"debugRows")),t.getVisibleCells=Ye(()=>[t.getLeftVisibleCells(),t.getCenterVisibleCells(),t.getRightVisibleCells()],(n,r,i)=>[...n,...r,...i],Xe(e.options,"debugRows"))},createTable:t=>{const e=(n,r)=>Ye(()=>[r(),r().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(s=>s.getIsVisible==null?void 0:s.getIsVisible()),Xe(t.options,"debugColumns"));t.getVisibleFlatColumns=e("getVisibleFlatColumns",()=>t.getAllFlatColumns()),t.getVisibleLeafColumns=e("getVisibleLeafColumns",()=>t.getAllLeafColumns()),t.getLeftVisibleLeafColumns=e("getLeftVisibleLeafColumns",()=>t.getLeftLeafColumns()),t.getRightVisibleLeafColumns=e("getRightVisibleLeafColumns",()=>t.getRightLeafColumns()),t.getCenterVisibleLeafColumns=e("getCenterVisibleLeafColumns",()=>t.getCenterLeafColumns()),t.setColumnVisibility=n=>t.options.onColumnVisibilityChange==null?void 0:t.options.onColumnVisibilityChange(n),t.resetColumnVisibility=n=>{var r;t.setColumnVisibility(n?{}:(r=t.initialState.columnVisibility)!=null?r:{})},t.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!t.getIsAllColumnsVisible(),t.setColumnVisibility(t.getAllLeafColumns().reduce((i,s)=>({...i,[s.id]:n||!(s.getCanHide!=null&&s.getCanHide())}),{}))},t.getIsAllColumnsVisible=()=>!t.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),t.getIsSomeColumnsVisible=()=>t.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),t.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;t.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function Cd(t,e){return e?e==="center"?t.getCenterVisibleLeafColumns():e==="left"?t.getLeftVisibleLeafColumns():t.getRightVisibleLeafColumns():t.getVisibleLeafColumns()}const Iee={createTable:t=>{t._getGlobalFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,"__global__"),t.getGlobalFacetedRowModel=()=>t.options.manualFiltering||!t._getGlobalFacetedRowModel?t.getPreFilteredRowModel():t._getGlobalFacetedRowModel(),t._getGlobalFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,"__global__"),t.getGlobalFacetedUniqueValues=()=>t._getGlobalFacetedUniqueValues?t._getGlobalFacetedUniqueValues():new Map,t._getGlobalFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,"__global__"),t.getGlobalFacetedMinMaxValues=()=>{if(t._getGlobalFacetedMinMaxValues)return t._getGlobalFacetedMinMaxValues()}}},jee={getInitialState:t=>({globalFilter:void 0,...t}),getDefaultOptions:t=>({onGlobalFilterChange:Lr("globalFilter",t),globalFilterFn:"auto",getColumnCanGlobalFilter:e=>{var n;const r=(n=t.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[e.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(t,e)=>{t.getCanGlobalFilter=()=>{var n,r,i,s;return((n=t.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=e.options.enableGlobalFilter)!=null?r:!0)&&((i=e.options.enableFilters)!=null?i:!0)&&((s=e.options.getColumnCanGlobalFilter==null?void 0:e.options.getColumnCanGlobalFilter(t))!=null?s:!0)&&!!t.accessorFn}},createTable:t=>{t.getGlobalAutoFilterFn=()=>bs.includesString,t.getGlobalFilterFn=()=>{var e,n;const{globalFilterFn:r}=t.options;return Hg(r)?r:r==="auto"?t.getGlobalAutoFilterFn():(e=(n=t.options.filterFns)==null?void 0:n[r])!=null?e:bs[r]},t.setGlobalFilter=e=>{t.options.onGlobalFilterChange==null||t.options.onGlobalFilterChange(e)},t.resetGlobalFilter=e=>{t.setGlobalFilter(e?void 0:t.initialState.globalFilter)}}},Lee={getInitialState:t=>({expanded:{},...t}),getDefaultOptions:t=>({onExpandedChange:Lr("expanded",t),paginateExpandedRows:!0}),createTable:t=>{let e=!1,n=!1;t._autoResetExpanded=()=>{var r,i;if(!e){t._queue(()=>{e=!0});return}if((r=(i=t.options.autoResetAll)!=null?i:t.options.autoResetExpanded)!=null?r:!t.options.manualExpanding){if(n)return;n=!0,t._queue(()=>{t.resetExpanded(),n=!1})}},t.setExpanded=r=>t.options.onExpandedChange==null?void 0:t.options.onExpandedChange(r),t.toggleAllRowsExpanded=r=>{r??!t.getIsAllRowsExpanded()?t.setExpanded(!0):t.setExpanded({})},t.resetExpanded=r=>{var i,s;t.setExpanded(r?{}:(i=(s=t.initialState)==null?void 0:s.expanded)!=null?i:{})},t.getCanSomeRowsExpand=()=>t.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),t.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),t.toggleAllRowsExpanded()},t.getIsSomeRowsExpanded=()=>{const r=t.getState().expanded;return r===!0||Object.values(r).some(Boolean)},t.getIsAllRowsExpanded=()=>{const r=t.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||t.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},t.getExpandedDepth=()=>{let r=0;return(t.getState().expanded===!0?Object.keys(t.getRowModel().rowsById):Object.keys(t.getState().expanded)).forEach(s=>{const o=s.split(".");r=Math.max(r,o.length)}),r},t.getPreExpandedRowModel=()=>t.getSortedRowModel(),t.getExpandedRowModel=()=>(!t._getExpandedRowModel&&t.options.getExpandedRowModel&&(t._getExpandedRowModel=t.options.getExpandedRowModel(t)),t.options.manualExpanding||!t._getExpandedRowModel?t.getPreExpandedRowModel():t._getExpandedRowModel())},createRow:(t,e)=>{t.toggleExpanded=n=>{e.setExpanded(r=>{var i;const s=r===!0?!0:!!(r!=null&&r[t.id]);let o={};if(r===!0?Object.keys(e.getRowModel().rowsById).forEach(l=>{o[l]=!0}):o=r,n=(i=n)!=null?i:!s,!s&&n)return{...o,[t.id]:!0};if(s&&!n){const{[t.id]:l,...u}=o;return u}return r})},t.getIsExpanded=()=>{var n;const r=e.getState().expanded;return!!((n=e.options.getIsRowExpanded==null?void 0:e.options.getIsRowExpanded(t))!=null?n:r===!0||r?.[t.id])},t.getCanExpand=()=>{var n,r,i;return(n=e.options.getRowCanExpand==null?void 0:e.options.getRowCanExpand(t))!=null?n:((r=e.options.enableExpanding)!=null?r:!0)&&!!((i=t.subRows)!=null&&i.length)},t.getIsAllParentsExpanded=()=>{let n=!0,r=t;for(;n&&r.parentId;)r=e.getRow(r.parentId,!0),n=r.getIsExpanded();return n},t.getToggleExpandedHandler=()=>{const n=t.getCanExpand();return()=>{n&&t.toggleExpanded()}}}},Qx=0,ew=10,g0=()=>({pageIndex:Qx,pageSize:ew}),Pee={getInitialState:t=>({...t,pagination:{...g0(),...t?.pagination}}),getDefaultOptions:t=>({onPaginationChange:Lr("pagination",t)}),createTable:t=>{let e=!1,n=!1;t._autoResetPageIndex=()=>{var r,i;if(!e){t._queue(()=>{e=!0});return}if((r=(i=t.options.autoResetAll)!=null?i:t.options.autoResetPageIndex)!=null?r:!t.options.manualPagination){if(n)return;n=!0,t._queue(()=>{t.resetPageIndex(),n=!1})}},t.setPagination=r=>{const i=s=>Ro(r,s);return t.options.onPaginationChange==null?void 0:t.options.onPaginationChange(i)},t.resetPagination=r=>{var i;t.setPagination(r?g0():(i=t.initialState.pagination)!=null?i:g0())},t.setPageIndex=r=>{t.setPagination(i=>{let s=Ro(r,i.pageIndex);const o=typeof t.options.pageCount>"u"||t.options.pageCount===-1?Number.MAX_SAFE_INTEGER:t.options.pageCount-1;return s=Math.max(0,Math.min(s,o)),{...i,pageIndex:s}})},t.resetPageIndex=r=>{var i,s;t.setPageIndex(r?Qx:(i=(s=t.initialState)==null||(s=s.pagination)==null?void 0:s.pageIndex)!=null?i:Qx)},t.resetPageSize=r=>{var i,s;t.setPageSize(r?ew:(i=(s=t.initialState)==null||(s=s.pagination)==null?void 0:s.pageSize)!=null?i:ew)},t.setPageSize=r=>{t.setPagination(i=>{const s=Math.max(1,Ro(r,i.pageSize)),o=i.pageSize*i.pageIndex,l=Math.floor(o/s);return{...i,pageIndex:l,pageSize:s}})},t.setPageCount=r=>t.setPagination(i=>{var s;let o=Ro(r,(s=t.options.pageCount)!=null?s:-1);return typeof o=="number"&&(o=Math.max(-1,o)),{...i,pageCount:o}}),t.getPageOptions=Ye(()=>[t.getPageCount()],r=>{let i=[];return r&&r>0&&(i=[...new Array(r)].fill(null).map((s,o)=>o)),i},Xe(t.options,"debugTable")),t.getCanPreviousPage=()=>t.getState().pagination.pageIndex>0,t.getCanNextPage=()=>{const{pageIndex:r}=t.getState().pagination,i=t.getPageCount();return i===-1?!0:i===0?!1:r<i-1},t.previousPage=()=>t.setPageIndex(r=>r-1),t.nextPage=()=>t.setPageIndex(r=>r+1),t.firstPage=()=>t.setPageIndex(0),t.lastPage=()=>t.setPageIndex(t.getPageCount()-1),t.getPrePaginationRowModel=()=>t.getExpandedRowModel(),t.getPaginationRowModel=()=>(!t._getPaginationRowModel&&t.options.getPaginationRowModel&&(t._getPaginationRowModel=t.options.getPaginationRowModel(t)),t.options.manualPagination||!t._getPaginationRowModel?t.getPrePaginationRowModel():t._getPaginationRowModel()),t.getPageCount=()=>{var r;return(r=t.options.pageCount)!=null?r:Math.ceil(t.getRowCount()/t.getState().pagination.pageSize)},t.getRowCount=()=>{var r;return(r=t.options.rowCount)!=null?r:t.getPrePaginationRowModel().rows.length}}},y0=()=>({top:[],bottom:[]}),zee={getInitialState:t=>({rowPinning:y0(),...t}),getDefaultOptions:t=>({onRowPinningChange:Lr("rowPinning",t)}),createRow:(t,e)=>{t.pin=(n,r,i)=>{const s=r?t.getLeafRows().map(u=>{let{id:f}=u;return f}):[],o=i?t.getParentRows().map(u=>{let{id:f}=u;return f}):[],l=new Set([...o,t.id,...s]);e.setRowPinning(u=>{var f,h;if(n==="bottom"){var m,g;return{top:((m=u?.top)!=null?m:[]).filter(S=>!(l!=null&&l.has(S))),bottom:[...((g=u?.bottom)!=null?g:[]).filter(S=>!(l!=null&&l.has(S))),...Array.from(l)]}}if(n==="top"){var b,x;return{top:[...((b=u?.top)!=null?b:[]).filter(S=>!(l!=null&&l.has(S))),...Array.from(l)],bottom:((x=u?.bottom)!=null?x:[]).filter(S=>!(l!=null&&l.has(S)))}}return{top:((f=u?.top)!=null?f:[]).filter(S=>!(l!=null&&l.has(S))),bottom:((h=u?.bottom)!=null?h:[]).filter(S=>!(l!=null&&l.has(S)))}})},t.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:i}=e.options;return typeof r=="function"?r(t):(n=r??i)!=null?n:!0},t.getIsPinned=()=>{const n=[t.id],{top:r,bottom:i}=e.getState().rowPinning,s=n.some(l=>r?.includes(l)),o=n.some(l=>i?.includes(l));return s?"top":o?"bottom":!1},t.getPinnedIndex=()=>{var n,r;const i=t.getIsPinned();if(!i)return-1;const s=(n=i==="top"?e.getTopRows():e.getBottomRows())==null?void 0:n.map(o=>{let{id:l}=o;return l});return(r=s?.indexOf(t.id))!=null?r:-1}},createTable:t=>{t.setRowPinning=e=>t.options.onRowPinningChange==null?void 0:t.options.onRowPinningChange(e),t.resetRowPinning=e=>{var n,r;return t.setRowPinning(e?y0():(n=(r=t.initialState)==null?void 0:r.rowPinning)!=null?n:y0())},t.getIsSomeRowsPinned=e=>{var n;const r=t.getState().rowPinning;if(!e){var i,s;return!!((i=r.top)!=null&&i.length||(s=r.bottom)!=null&&s.length)}return!!((n=r[e])!=null&&n.length)},t._getPinnedRows=(e,n,r)=>{var i;return((i=t.options.keepPinnedRows)==null||i?(n??[]).map(o=>{const l=t.getRow(o,!0);return l.getIsAllParentsExpanded()?l:null}):(n??[]).map(o=>e.find(l=>l.id===o))).filter(Boolean).map(o=>({...o,position:r}))},t.getTopRows=Ye(()=>[t.getRowModel().rows,t.getState().rowPinning.top],(e,n)=>t._getPinnedRows(e,n,"top"),Xe(t.options,"debugRows")),t.getBottomRows=Ye(()=>[t.getRowModel().rows,t.getState().rowPinning.bottom],(e,n)=>t._getPinnedRows(e,n,"bottom"),Xe(t.options,"debugRows")),t.getCenterRows=Ye(()=>[t.getRowModel().rows,t.getState().rowPinning.top,t.getState().rowPinning.bottom],(e,n,r)=>{const i=new Set([...n??[],...r??[]]);return e.filter(s=>!i.has(s.id))},Xe(t.options,"debugRows"))}},$ee={getInitialState:t=>({rowSelection:{},...t}),getDefaultOptions:t=>({onRowSelectionChange:Lr("rowSelection",t),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:t=>{t.setRowSelection=e=>t.options.onRowSelectionChange==null?void 0:t.options.onRowSelectionChange(e),t.resetRowSelection=e=>{var n;return t.setRowSelection(e?{}:(n=t.initialState.rowSelection)!=null?n:{})},t.toggleAllRowsSelected=e=>{t.setRowSelection(n=>{e=typeof e<"u"?e:!t.getIsAllRowsSelected();const r={...n},i=t.getPreGroupedRowModel().flatRows;return e?i.forEach(s=>{s.getCanSelect()&&(r[s.id]=!0)}):i.forEach(s=>{delete r[s.id]}),r})},t.toggleAllPageRowsSelected=e=>t.setRowSelection(n=>{const r=typeof e<"u"?e:!t.getIsAllPageRowsSelected(),i={...n};return t.getRowModel().rows.forEach(s=>{tw(i,s.id,r,!0,t)}),i}),t.getPreSelectedRowModel=()=>t.getCoreRowModel(),t.getSelectedRowModel=Ye(()=>[t.getState().rowSelection,t.getCoreRowModel()],(e,n)=>Object.keys(e).length?b0(t,n):{rows:[],flatRows:[],rowsById:{}},Xe(t.options,"debugTable")),t.getFilteredSelectedRowModel=Ye(()=>[t.getState().rowSelection,t.getFilteredRowModel()],(e,n)=>Object.keys(e).length?b0(t,n):{rows:[],flatRows:[],rowsById:{}},Xe(t.options,"debugTable")),t.getGroupedSelectedRowModel=Ye(()=>[t.getState().rowSelection,t.getSortedRowModel()],(e,n)=>Object.keys(e).length?b0(t,n):{rows:[],flatRows:[],rowsById:{}},Xe(t.options,"debugTable")),t.getIsAllRowsSelected=()=>{const e=t.getFilteredRowModel().flatRows,{rowSelection:n}=t.getState();let r=!!(e.length&&Object.keys(n).length);return r&&e.some(i=>i.getCanSelect()&&!n[i.id])&&(r=!1),r},t.getIsAllPageRowsSelected=()=>{const e=t.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:n}=t.getState();let r=!!e.length;return r&&e.some(i=>!n[i.id])&&(r=!1),r},t.getIsSomeRowsSelected=()=>{var e;const n=Object.keys((e=t.getState().rowSelection)!=null?e:{}).length;return n>0&&n<t.getFilteredRowModel().flatRows.length},t.getIsSomePageRowsSelected=()=>{const e=t.getPaginationRowModel().flatRows;return t.getIsAllPageRowsSelected()?!1:e.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},t.getToggleAllRowsSelectedHandler=()=>e=>{t.toggleAllRowsSelected(e.target.checked)},t.getToggleAllPageRowsSelectedHandler=()=>e=>{t.toggleAllPageRowsSelected(e.target.checked)}},createRow:(t,e)=>{t.toggleSelected=(n,r)=>{const i=t.getIsSelected();e.setRowSelection(s=>{var o;if(n=typeof n<"u"?n:!i,t.getCanSelect()&&i===n)return s;const l={...s};return tw(l,t.id,n,(o=r?.selectChildren)!=null?o:!0,e),l})},t.getIsSelected=()=>{const{rowSelection:n}=e.getState();return lk(t,n)},t.getIsSomeSelected=()=>{const{rowSelection:n}=e.getState();return nw(t,n)==="some"},t.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=e.getState();return nw(t,n)==="all"},t.getCanSelect=()=>{var n;return typeof e.options.enableRowSelection=="function"?e.options.enableRowSelection(t):(n=e.options.enableRowSelection)!=null?n:!0},t.getCanSelectSubRows=()=>{var n;return typeof e.options.enableSubRowSelection=="function"?e.options.enableSubRowSelection(t):(n=e.options.enableSubRowSelection)!=null?n:!0},t.getCanMultiSelect=()=>{var n;return typeof e.options.enableMultiRowSelection=="function"?e.options.enableMultiRowSelection(t):(n=e.options.enableMultiRowSelection)!=null?n:!0},t.getToggleSelectedHandler=()=>{const n=t.getCanSelect();return r=>{var i;n&&t.toggleSelected((i=r.target)==null?void 0:i.checked)}}}},tw=(t,e,n,r,i)=>{var s;const o=i.getRow(e,!0);n?(o.getCanMultiSelect()||Object.keys(t).forEach(l=>delete t[l]),o.getCanSelect()&&(t[e]=!0)):delete t[e],r&&(s=o.subRows)!=null&&s.length&&o.getCanSelectSubRows()&&o.subRows.forEach(l=>tw(t,l.id,n,r,i))};function b0(t,e){const n=t.getState().rowSelection,r=[],i={},s=function(o,l){return o.map(u=>{var f;const h=lk(u,n);if(h&&(r.push(u),i[u.id]=u),(f=u.subRows)!=null&&f.length&&(u={...u,subRows:s(u.subRows)}),h)return u}).filter(Boolean)};return{rows:s(e.rows),flatRows:r,rowsById:i}}function lk(t,e){var n;return(n=e[t.id])!=null?n:!1}function nw(t,e,n){var r;if(!((r=t.subRows)!=null&&r.length))return!1;let i=!0,s=!1;return t.subRows.forEach(o=>{if(!(s&&!i)&&(o.getCanSelect()&&(lk(o,e)?s=!0:i=!1),o.subRows&&o.subRows.length)){const l=nw(o,e);l==="all"?s=!0:(l==="some"&&(s=!0),i=!1)}}),i?"all":s?"some":!1}const rw=/([0-9]+)/gm,Bee=(t,e,n)=>w2(Wo(t.getValue(n)).toLowerCase(),Wo(e.getValue(n)).toLowerCase()),Vee=(t,e,n)=>w2(Wo(t.getValue(n)),Wo(e.getValue(n))),Hee=(t,e,n)=>ck(Wo(t.getValue(n)).toLowerCase(),Wo(e.getValue(n)).toLowerCase()),Uee=(t,e,n)=>ck(Wo(t.getValue(n)),Wo(e.getValue(n))),Fee=(t,e,n)=>{const r=t.getValue(n),i=e.getValue(n);return r>i?1:r<i?-1:0},qee=(t,e,n)=>ck(t.getValue(n),e.getValue(n));function ck(t,e){return t===e?0:t>e?1:-1}function Wo(t){return typeof t=="number"?isNaN(t)||t===1/0||t===-1/0?"":String(t):typeof t=="string"?t:""}function w2(t,e){const n=t.split(rw).filter(Boolean),r=e.split(rw).filter(Boolean);for(;n.length&&r.length;){const i=n.shift(),s=r.shift(),o=parseInt(i,10),l=parseInt(s,10),u=[o,l].sort();if(isNaN(u[0])){if(i>s)return 1;if(s>i)return-1;continue}if(isNaN(u[1]))return isNaN(o)?-1:1;if(o>l)return 1;if(l>o)return-1}return n.length-r.length}const Zu={alphanumeric:Bee,alphanumericCaseSensitive:Vee,text:Hee,textCaseSensitive:Uee,datetime:Fee,basic:qee},Gee={getInitialState:t=>({sorting:[],...t}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:t=>({onSortingChange:Lr("sorting",t),isMultiSortEvent:e=>e.shiftKey}),createColumn:(t,e)=>{t.getAutoSortingFn=()=>{const n=e.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const i of n){const s=i?.getValue(t.id);if(Object.prototype.toString.call(s)==="[object Date]")return Zu.datetime;if(typeof s=="string"&&(r=!0,s.split(rw).length>1))return Zu.alphanumeric}return r?Zu.text:Zu.basic},t.getAutoSortDir=()=>{const n=e.getFilteredRowModel().flatRows[0];return typeof n?.getValue(t.id)=="string"?"asc":"desc"},t.getSortingFn=()=>{var n,r;if(!t)throw new Error;return Hg(t.columnDef.sortingFn)?t.columnDef.sortingFn:t.columnDef.sortingFn==="auto"?t.getAutoSortingFn():(n=(r=e.options.sortingFns)==null?void 0:r[t.columnDef.sortingFn])!=null?n:Zu[t.columnDef.sortingFn]},t.toggleSorting=(n,r)=>{const i=t.getNextSortingOrder(),s=typeof n<"u"&&n!==null;e.setSorting(o=>{const l=o?.find(b=>b.id===t.id),u=o?.findIndex(b=>b.id===t.id);let f=[],h,m=s?n:i==="desc";if(o!=null&&o.length&&t.getCanMultiSort()&&r?l?h="toggle":h="add":o!=null&&o.length&&u!==o.length-1?h="replace":l?h="toggle":h="replace",h==="toggle"&&(s||i||(h="remove")),h==="add"){var g;f=[...o,{id:t.id,desc:m}],f.splice(0,f.length-((g=e.options.maxMultiSortColCount)!=null?g:Number.MAX_SAFE_INTEGER))}else h==="toggle"?f=o.map(b=>b.id===t.id?{...b,desc:m}:b):h==="remove"?f=o.filter(b=>b.id!==t.id):f=[{id:t.id,desc:m}];return f})},t.getFirstSortDir=()=>{var n,r;return((n=(r=t.columnDef.sortDescFirst)!=null?r:e.options.sortDescFirst)!=null?n:t.getAutoSortDir()==="desc")?"desc":"asc"},t.getNextSortingOrder=n=>{var r,i;const s=t.getFirstSortDir(),o=t.getIsSorted();return o?o!==s&&((r=e.options.enableSortingRemoval)==null||r)&&(!(n&&(i=e.options.enableMultiRemove)!=null)||i)?!1:o==="desc"?"asc":"desc":s},t.getCanSort=()=>{var n,r;return((n=t.columnDef.enableSorting)!=null?n:!0)&&((r=e.options.enableSorting)!=null?r:!0)&&!!t.accessorFn},t.getCanMultiSort=()=>{var n,r;return(n=(r=t.columnDef.enableMultiSort)!=null?r:e.options.enableMultiSort)!=null?n:!!t.accessorFn},t.getIsSorted=()=>{var n;const r=(n=e.getState().sorting)==null?void 0:n.find(i=>i.id===t.id);return r?r.desc?"desc":"asc":!1},t.getSortIndex=()=>{var n,r;return(n=(r=e.getState().sorting)==null?void 0:r.findIndex(i=>i.id===t.id))!=null?n:-1},t.clearSorting=()=>{e.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==t.id):[])},t.getToggleSortingHandler=()=>{const n=t.getCanSort();return r=>{n&&(r.persist==null||r.persist(),t.toggleSorting==null||t.toggleSorting(void 0,t.getCanMultiSort()?e.options.isMultiSortEvent==null?void 0:e.options.isMultiSortEvent(r):!1))}}},createTable:t=>{t.setSorting=e=>t.options.onSortingChange==null?void 0:t.options.onSortingChange(e),t.resetSorting=e=>{var n,r;t.setSorting(e?[]:(n=(r=t.initialState)==null?void 0:r.sorting)!=null?n:[])},t.getPreSortedRowModel=()=>t.getGroupedRowModel(),t.getSortedRowModel=()=>(!t._getSortedRowModel&&t.options.getSortedRowModel&&(t._getSortedRowModel=t.options.getSortedRowModel(t)),t.options.manualSorting||!t._getSortedRowModel?t.getPreSortedRowModel():t._getSortedRowModel())}},Wee=[hee,Dee,Aee,Ree,mee,gee,Iee,jee,Gee,Tee,Lee,Pee,zee,$ee,Nee];function Kee(t){var e,n;const r=[...Wee,...(e=t._features)!=null?e:[]];let i={_features:r};const s=i._features.reduce((g,b)=>Object.assign(g,b.getDefaultOptions==null?void 0:b.getDefaultOptions(i)),{}),o=g=>i.options.mergeOptions?i.options.mergeOptions(s,g):{...s,...g};let u={...{},...(n=t.initialState)!=null?n:{}};i._features.forEach(g=>{var b;u=(b=g.getInitialState==null?void 0:g.getInitialState(u))!=null?b:u});const f=[];let h=!1;const m={_features:r,options:{...s,...t},initialState:u,_queue:g=>{f.push(g),h||(h=!0,Promise.resolve().then(()=>{for(;f.length;)f.shift()();h=!1}).catch(b=>setTimeout(()=>{throw b})))},reset:()=>{i.setState(i.initialState)},setOptions:g=>{const b=Ro(g,i.options);i.options=o(b)},getState:()=>i.options.state,setState:g=>{i.options.onStateChange==null||i.options.onStateChange(g)},_getRowId:(g,b,x)=>{var S;return(S=i.options.getRowId==null?void 0:i.options.getRowId(g,b,x))!=null?S:`${x?[x.id,b].join("."):b}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(g,b)=>{let x=(b?i.getPrePaginationRowModel():i.getRowModel()).rowsById[g];if(!x&&(x=i.getCoreRowModel().rowsById[g],!x))throw new Error;return x},_getDefaultColumnDef:Ye(()=>[i.options.defaultColumn],g=>{var b;return g=(b=g)!=null?b:{},{header:x=>{const S=x.header.column.columnDef;return S.accessorKey?S.accessorKey:S.accessorFn?S.id:null},cell:x=>{var S,k;return(S=(k=x.renderValue())==null||k.toString==null?void 0:k.toString())!=null?S:null},...i._features.reduce((x,S)=>Object.assign(x,S.getDefaultColumnDef==null?void 0:S.getDefaultColumnDef()),{}),...g}},Xe(t,"debugColumns")),_getColumnDefs:()=>i.options.columns,getAllColumns:Ye(()=>[i._getColumnDefs()],g=>{const b=function(x,S,k){return k===void 0&&(k=0),x.map(C=>{const _=fee(i,C,k,S),M=C;return _.columns=M.columns?b(M.columns,_,k+1):[],_})};return b(g)},Xe(t,"debugColumns")),getAllFlatColumns:Ye(()=>[i.getAllColumns()],g=>g.flatMap(b=>b.getFlatColumns()),Xe(t,"debugColumns")),_getAllFlatColumnsById:Ye(()=>[i.getAllFlatColumns()],g=>g.reduce((b,x)=>(b[x.id]=x,b),{}),Xe(t,"debugColumns")),getAllLeafColumns:Ye(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(g,b)=>{let x=g.flatMap(S=>S.getLeafColumns());return b(x)},Xe(t,"debugColumns")),getColumn:g=>i._getAllFlatColumnsById()[g]};Object.assign(i,m);for(let g=0;g<i._features.length;g++){const b=i._features[g];b==null||b.createTable==null||b.createTable(i)}return i}function Zee(){return t=>Ye(()=>[t.options.data],e=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(i,s,o){s===void 0&&(s=0);const l=[];for(let f=0;f<i.length;f++){const h=pee(t,t._getRowId(i[f],f,o),i[f],f,s,void 0,o?.id);if(n.flatRows.push(h),n.rowsById[h.id]=h,l.push(h),t.options.getSubRows){var u;h.originalSubRows=t.options.getSubRows(i[f],f),(u=h.originalSubRows)!=null&&u.length&&(h.subRows=r(h.originalSubRows,s+1,h))}}return l};return n.rows=r(e),n},Xe(t.options,"debugTable","getRowModel",()=>t._autoResetPageIndex()))}function bM(t,e){return t?Yee(t)?E.createElement(t,e):t:null}function Yee(t){return Xee(t)||typeof t=="function"||Jee(t)}function Xee(t){return typeof t=="function"&&(()=>{const e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}function Jee(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}function Qee(t){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...t},[n]=E.useState(()=>({current:Kee(e)})),[r,i]=E.useState(()=>n.current.initialState);return n.current.setOptions(s=>({...s,...t,state:{...r,...t.state},onStateChange:o=>{i(o),t.onStateChange==null||t.onStateChange(o)}})),n.current}function ete({uploads:t,canCreate:e,fieldLabels:n,onClose:r,onUpload:i,onCreateFromUploads:s}){const o=E.useMemo(()=>Object.keys(t),[t]),[l,u]=E.useState(o[0]??""),[f,h]=E.useState(!!e),[m,g]=E.useState([]),[b,x]=E.useState(null),S=t[l];return E.useEffect(()=>{!o.includes(l)&&o[0]&&u(o[0])},[l,o]),E.useEffect(()=>{const k=_=>{_.key==="Escape"&&r()};window.addEventListener("keydown",k);const C=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",k),document.body.style.overflow=C}},[r]),S?y.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:r,children:y.jsxs("div",{className:"vertebr-modal vertebr-modal-sm",role:"dialog","aria-modal":"true","aria-label":"Bulk image upload",onClick:k=>k.stopPropagation(),children:[y.jsxs("header",{className:"vertebr-modal-head",children:[y.jsxs("div",{className:"vertebr-modal-heading",children:[y.jsx("p",{className:"vertebr-modal-eyebrow",children:"Media"}),y.jsx("h2",{children:"Bulk image upload"})]}),y.jsx("button",{type:"button",className:"vertebr-btn",onClick:r,children:"Close"})]}),y.jsxs("div",{className:"vertebr-modal-body",children:[o.length>1?y.jsxs("label",{className:"vertebr-field",children:[y.jsx("span",{children:"Target field"}),y.jsx("select",{className:"vertebr-native-select",value:l,onChange:k=>{u(k.target.value),g([]),x(null)},children:o.map(k=>y.jsx("option",{value:k,children:n[k]??k},k))})]}):null,e&&s?y.jsxs("label",{className:"vertebr-upload-check",children:[y.jsx("input",{type:"checkbox",checked:f,onChange:k=>h(k.target.checked)}),y.jsx("span",{children:"Create a record for each uploaded image"})]}):null,y.jsx(Pc,{meta:S,multiple:!0,onUpload:async k=>{x(`Uploading ${k.length} image${k.length===1?"":"s"}…`);const C=await i(l,k);g(C),f&&s?(x("Creating records…"),await s(l,C),x(`Uploaded ${C.length} and created records.`)):x(`Uploaded ${C.length} image${C.length===1?"":"s"}.`)}}),b?y.jsx("p",{className:"vertebr-upload-status",children:b}):null,m.length>0?y.jsx("ul",{className:"vertebr-upload-results",children:m.map(k=>y.jsxs("li",{children:[y.jsx("img",{src:k.url,alt:""}),y.jsxs("div",{children:[y.jsx("strong",{children:k.name??"Image"}),y.jsx("a",{href:k.url,target:"_blank",rel:"noreferrer",children:k.url})]})]},k.url))}):null]})]})}):null}function tte({columns:t,visibility:e,onChange:n}){const[r,i]=E.useState(!1),s=E.useRef(null),o=E.useId(),l=t.filter(f=>e[f.id]===!1).length;E.useEffect(()=>{if(!r)return;const f=m=>{s.current?.contains(m.target)||i(!1)},h=m=>{m.key==="Escape"&&i(!1)};return window.addEventListener("mousedown",f),window.addEventListener("keydown",h),()=>{window.removeEventListener("mousedown",f),window.removeEventListener("keydown",h)}},[r]);const u=t.length-l;return y.jsxs("div",{className:"vertebr-col-menu",ref:s,children:[y.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet","aria-expanded":r,"aria-controls":o,onClick:()=>i(f=>!f),children:["Columns",l>0?y.jsx("span",{className:"vertebr-col-menu-count",children:u}):null]}),r?y.jsxs("div",{className:"vertebr-col-menu-panel",id:o,role:"menu",children:[y.jsxs("div",{className:"vertebr-col-menu-head",children:[y.jsx("span",{children:"Visible fields"}),y.jsx("button",{type:"button",className:"vertebr-link-btn",onClick:()=>{const f={};for(const h of t)f[h.id]=!0;n(f)},children:"Show all"})]}),y.jsx("ul",{className:"vertebr-col-menu-list",children:t.map(f=>{const h=e[f.id]!==!1;return y.jsx("li",{children:y.jsxs("label",{className:"vertebr-col-menu-item",children:[y.jsx("input",{type:"checkbox",checked:h,disabled:h&&u<=1,onChange:()=>{const m={...e,[f.id]:!h};n(m)}}),y.jsx("span",{children:f.label})]})},f.id)})})]}):null]})}const nte=/(url|href|link|src)/i,rte=/\.(png|jpe?g|gif|webp|svg|avif)(\?|#|$)/i;function S2(t){return/^https?:\/\//i.test(t)||t.startsWith("//")}function ite(t){return S2(t)?rte.test(t)?!0:/(image|img|media|cdn|photo)/i.test(t):!1}function vM(t){if(t instanceof Date&&!Number.isNaN(t.getTime()))return t.toLocaleString();if(t&&typeof t=="object"&&"toDate"in t&&typeof t.toDate=="function")try{return t.toDate().toLocaleString()}catch{return null}if(typeof t=="string"||typeof t=="number"){const e=new Date(t);if(!Number.isNaN(e.getTime()))return e.toLocaleString()}return null}function Ap({fieldKey:t,field:e,value:n,variant:r="table"}){const i=r==="detail";if(n==null||n==="")return y.jsx("span",{className:"vertebr-cell-empty",children:"—"});const s=e?.type;if(s==="boolean"||typeof n=="boolean"){const u=!!n;return y.jsx("span",{className:"vertebr-badge","data-tone":u?"ok":"neutral",children:ste(t,e,u)})}if(s==="datetime"){const u=vM(n);if(u)return y.jsx("span",{className:"vertebr-cell-datetime",children:u})}if((s==="number"||typeof n=="number")&&typeof n=="number"&&Number.isFinite(n))return Bw(t,e)?y.jsx("span",{className:"vertebr-cell-money",children:X0(n,{asCents:!0})}):DO(t,e)?y.jsx("span",{className:"vertebr-cell-money",children:X0(n,{asCents:!1})}):y.jsx("span",{className:"vertebr-cell-number",children:new Intl.NumberFormat().format(n)});const o=G0(n);if(o.length>0&&(s==="file[]"||Va(t,e)||o.every(ite)))return y.jsx(ote,{urls:o,detail:i});if(Array.isArray(n)){if(n.length===0)return y.jsx("span",{className:"vertebr-cell-empty",children:"—"});if(n.every(u=>typeof u=="string"))return y.jsx("div",{className:"vertebr-chip-row",children:n.map(u=>y.jsx("span",{className:"vertebr-chip",title:u,children:u},u))})}if(typeof n=="string")return nte.test(t)||S2(n)?y.jsx("a",{className:"vertebr-cell-link",href:n.startsWith("//")?`https:${n}`:n,target:"_blank",rel:"noreferrer",title:n,onClick:u=>u.stopPropagation(),children:i?n:n.replace(/^https?:\/\//i,"")}):!i&&(s==="richtext"||n.length>80)?y.jsx("span",{className:"vertebr-cell-clamp",title:n,children:n}):i&&(s==="richtext"||n.length>80)?y.jsx("p",{className:"vertebr-cell-prose",children:n}):y.jsx("span",{className:"vertebr-cell-text",children:n});const l=vM(n);return l?y.jsx("span",{className:"vertebr-cell-datetime",children:l}):typeof n=="object"?y.jsx("code",{className:"vertebr-cell-json",title:JSON.stringify(n),children:JSON.stringify(n)}):y.jsx("span",{className:"vertebr-cell-text",children:String(n)})}function ste(t,e,n){const r=`${t} ${e?.label??""}`;return/^show[A-Z]/.test(t)||/\bshow\b/i.test(e?.label??"")?n?"Shown":"Hidden":/\bactive\b/i.test(r)||/\bvisible\b/i.test(r)?n?"Visible":"Hidden":n?"On":"Off"}function ote({urls:t,detail:e}){if(e)return y.jsx("div",{className:"vertebr-cell-thumbs vertebr-cell-thumbs-detail",children:t.map((i,s)=>y.jsxs("a",{className:"vertebr-cell-media vertebr-cell-media-detail",href:i,target:"_blank",rel:"noreferrer",title:i,onClick:o=>o.stopPropagation(),children:[y.jsx("img",{src:i,alt:"",loading:"lazy"}),y.jsx("span",{className:"vertebr-cell-link",children:i})]},`${i}:${s}`))});const n=t.slice(0,3),r=t.length-n.length;return y.jsxs("div",{className:"vertebr-cell-thumbs",title:t[0],children:[n.map((i,s)=>y.jsx("img",{src:i,alt:"",loading:"lazy"},`${i}:${s}`)),r>0?y.jsxs("span",{className:"vertebr-cell-thumbs-more",children:["+",r]}):null]})}function ate({title:t,schema:e,value:n,uploads:r,onUpload:i,galleryUpload:s,onListGallery:o,onUploadGallery:l,onClose:u,onCreate:f}){return E.useEffect(()=>{const h=g=>{g.key==="Escape"&&u()};window.addEventListener("keydown",h);const m=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",h),document.body.style.overflow=m}},[u]),y.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:u,children:y.jsxs("div",{className:"vertebr-modal vertebr-modal-form",role:"dialog","aria-modal":"true","aria-label":t,onClick:h=>h.stopPropagation(),children:[y.jsxs("header",{className:"vertebr-modal-head",children:[y.jsxs("div",{className:"vertebr-modal-heading",children:[y.jsx("p",{className:"vertebr-modal-eyebrow",children:"New record"}),y.jsx("h2",{children:t})]}),y.jsx("div",{className:"vertebr-modal-actions",children:y.jsx("button",{type:"button",className:"vertebr-btn",onClick:u,"aria-label":"Close",children:"Close"})})]}),y.jsx("div",{className:"vertebr-modal-body",children:y.jsx(Vg,{variant:"record",schema:e,value:n,uploads:r,onUpload:i,galleryUpload:s,onListGallery:o,onUploadGallery:l,submitLabel:t,onSave:async h=>{await f(h),u()}})})]})})}const lte=new Set(["custom","promo","custom_discount"]),cte=new Set(["discount","welcome_offer","flash_sale","custom_discount"]),ute=new Set(["discountId","discountCode","discountOffer","discountExpires"]);function dte(t){return Array.isArray(t)?t.join(", "):t}function jc(t){return typeof t=="string"?t:String(t??"")}function fte(t,e){const n=`${t} ${e.label??""}`;return e.type==="richtext"||/(body|message|html|notes)/i.test(n)}function qm(t,e){if(!t.preset)return!0;const n=jc(e.preset);return!n||lte.has(n)}function k2(t){return cte.has(t)}function C2(t,e,n){if(t==="subject"||t==="body")return qm(e,n);if(ute.has(t)){const r=jc(n.preset);return!(!k2(r)||t==="discountId"&&!e.discountId?.options?.length)}return!0}function xM(t,e){return Object.entries(t).every(([n,r])=>{if(!C2(n,t,e))return!0;const i=(n==="subject"||n==="body")&&qm(t,e),s=(n==="discountCode"||n==="discountOffer")&&k2(jc(e.preset));return r.required===!1&&!i&&!s||r.type!=="string"&&r.type!=="richtext"&&r.type!=="enum"?!0:!!jc(e[n]).trim()})}function wM(t){if(!(t instanceof Error))return"Request failed";const e=t.message.trim();if(!e.startsWith("{"))return e;try{const n=JSON.parse(e);if(typeof n.error=="string"&&n.error.trim())return n.error;if(n.error&&typeof n.error=="object"&&typeof n.error.message=="string"&&n.error.message.trim())return n.error.message;if(typeof n.message=="string"&&n.message.trim())return n.message}catch{}return e}function hte({title:t,count:e,schema:n,submitLabel:r,onClose:i,onPreview:s,onSubmit:o}){const l=E.useMemo(()=>ik(n),[n]),u=E.useMemo(()=>Object.entries(n),[n]),f=u.length>0,[h,m]=E.useState(l),[g,b]=E.useState(null),[x,S]=E.useState(null),[k,C]=E.useState(!1),[_,M]=E.useState(!1),R=!_&&(!f||xM(n,h)),A=u.filter(([j])=>C2(j,n,h)),O=E.useCallback(async j=>{if(f&&!xM(n,j)){b(null),S(null);return}C(!0),S(null);try{const z=await s(j);b(z)}catch(z){b(null),S(wM(z))}finally{C(!1)}},[f,s,n]);E.useEffect(()=>{const j=q=>{q.key==="Escape"&&i()};window.addEventListener("keydown",j);const z=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",j),document.body.style.overflow=z}},[i]),E.useEffect(()=>{if(!f){O({});return}const j=window.setTimeout(()=>{O(h)},280);return()=>window.clearTimeout(j)},[h,f,O]);const D=async()=>{if(R){M(!0);try{await o(f?h:{}),i()}catch(j){S(wM(j))}finally{M(!1)}}};return y.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:i,children:y.jsxs("div",{className:"vertebr-modal vertebr-modal-form vertebr-mail-modal",role:"dialog","aria-modal":"true","aria-label":t,onClick:j=>j.stopPropagation(),children:[y.jsxs("header",{className:"vertebr-modal-head",children:[y.jsxs("div",{className:"vertebr-modal-heading",children:[y.jsx("p",{className:"vertebr-modal-eyebrow",children:e===1?"1 person":`${e} people`}),y.jsx("h2",{children:t})]}),y.jsx("div",{className:"vertebr-modal-actions",children:y.jsx("button",{type:"button",className:"vertebr-btn",onClick:i,"aria-label":"Close",children:"Close"})})]}),y.jsxs("div",{className:"vertebr-mail-layout",children:[y.jsxs("form",{className:"vertebr-mail-compose",onSubmit:j=>{j.preventDefault(),D()},children:[f?y.jsxs("div",{className:"vertebr-mail-fields",children:[A.map(([j,z])=>{const q=fte(j,z);return y.jsxs("label",{className:"vertebr-mail-field",children:[y.jsx("span",{children:z.label??j}),z.type==="enum"?y.jsx(rk,{id:`mail-${j}`,value:h[j],field:z,onChange:Z=>m(G=>({...G,[j]:Z}))}):q?y.jsx("textarea",{rows:7,value:jc(h[j]),placeholder:"Plain text — the host template styles it.",onChange:Z=>m(G=>({...G,[j]:Z.target.value}))}):y.jsx("input",{type:"text",value:jc(h[j]),onChange:Z=>m(G=>({...G,[j]:Z.target.value}))})]},j)}),n.preset&&!qm(n,h)?y.jsx("p",{className:"vertebr-mail-compose-hint",children:"Preview updates from the selected preset. Switch to Custom to write your own copy."}):null]}):y.jsx("p",{className:"vertebr-mail-compose-note",children:"Host template — Vertebr only delivers it."}),x?y.jsx("p",{className:"vertebr-mail-compose-error",children:x}):null,y.jsx("div",{className:"vertebr-mail-compose-foot",children:y.jsx("button",{type:"submit",className:"vertebr-btn vertebr-btn-primary",disabled:!R,children:_?"Sending…":r})})]}),y.jsxs("div",{className:"vertebr-mail-preview",children:[y.jsxs("div",{className:"vertebr-mail-preview-meta",children:[y.jsxs("p",{children:[y.jsx("span",{children:"To"}),y.jsx("strong",{children:g?dte(g.to):e===1?"—":`${e} recipients`})]}),y.jsxs("p",{children:[y.jsx("span",{children:"Subject"}),y.jsx("strong",{children:g?.subject??(k?"Updating…":"—")})]})]}),y.jsx("div",{className:"vertebr-mail-preview-stage",children:y.jsx("div",{className:"vertebr-mail-preview-frame",children:g?.html?y.jsx("iframe",{title:"Email preview",sandbox:"",srcDoc:g.html}):g?.text?y.jsx("pre",{children:g.text}):y.jsx("div",{className:"vertebr-mail-preview-empty",children:x??(k?"Rendering host template…":f?n.preset&&qm(n,h)?"Write a subject and body to preview.":n.preset?"Pick a preset to preview.":"Write a subject and body to preview.":"Loading preview…")})})})]})]})]})})}function pte(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\bcents\b/i,"").trim()}function mte(t,e){for(const[n,r]of Object.entries(e)){if(typeof r!="string"||!/^https?:\/\//i.test(r))continue;const i=t[n];if(/(image|img|photo|avatar|thumbnail|thumb|cover)/i.test(n)||/(image|img|photo)/i.test(i?.label??"")||/(image|img|media|cdn|photo)/i.test(r))return r}return null}function gte({schema:t,row:e,title:n,canEdit:r,onClose:i,onEdit:s}){const o=Object.keys(t),l=o.length>0?o.map(f=>[f,e[f]]):Object.entries(e),u=mte(t,e);return E.useEffect(()=>{const f=m=>{m.key==="Escape"&&i()};window.addEventListener("keydown",f);const h=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",f),document.body.style.overflow=h}},[i]),y.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:i,children:y.jsxs("div",{className:"vertebr-modal",role:"dialog","aria-modal":"true","aria-label":n,onClick:f=>f.stopPropagation(),children:[y.jsxs("header",{className:"vertebr-modal-head",children:[y.jsxs("div",{className:"vertebr-modal-heading",children:[y.jsx("p",{className:"vertebr-modal-eyebrow",children:"Record"}),y.jsx("h2",{children:n})]}),y.jsxs("div",{className:"vertebr-modal-actions",children:[r&&s?y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",onClick:s,children:"Edit"}):null,y.jsx("button",{type:"button",className:"vertebr-btn",onClick:i,"aria-label":"Close",children:"Close"})]})]}),y.jsxs("div",{className:"vertebr-modal-body",children:[u?y.jsx("div",{className:"vertebr-modal-hero",children:y.jsx("img",{src:u,alt:""})}):null,y.jsx("dl",{className:"vertebr-modal-fields",children:l.map(([f,h])=>y.jsxs("div",{className:"vertebr-modal-field",children:[y.jsx("dt",{children:t[f]?.label??pte(f)}),y.jsx("dd",{children:y.jsx(Ap,{fieldKey:f,field:t[f],value:h,variant:"detail"})})]},f))})]})]})})}function SM(t){return!!(t?.input&&Object.keys(t.input).length>0)}function kM(t){return!!t?.mail}function yte(t,e){const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}function Ar(t,e){for(const n of e){const r=t[n];if(typeof r=="string"&&r.trim())return r;if(typeof r=="number")return String(r)}return null}function ap(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\bcents\b/i,"").trim()}function CM(t,e){for(const n of["name","title","label",...e]){const r=t[n];if(typeof r=="string"&&r.trim())return r}return"Record"}function bte(t,e){if(!(!t||typeof localStorage>"u"))try{localStorage.setItem(`vertebr:columns:v2:${t}`,JSON.stringify(e))}catch{}}function vte(t,e,n){return!!(/^show[A-Z]/.test(t)||e?.type==="richtext"||t==="updatedAt"||t==="createdAt"||(t==="imageSrc"||t==="imageAlt")&&"images"in n||t==="slug"&&"name"in n||e?.type==="string"&&/^(details|description)$/i.test(t))}function EM(t,e){return e?.type!=="boolean"||e.readOnly?!1:/^(active|visible|published)$/i.test(t)?!0:/\b(active|visible|published)\b/i.test(e.label??"")}function lp(t,e){return t[e]!==!1}function xte(t){const e={};for(const[n,r]of Object.entries(t))vte(n,r,t)&&(e[n]=!1);return e}function TM(t,e){const n=xte(e);if(!t||typeof localStorage>"u")return n;try{const r=localStorage.getItem(`vertebr:columns:v2:${t}`);if(!r)return n;const i=JSON.parse(r);return!i||typeof i!="object"?n:{...n,...i}}catch{return n}}function wte(t){const e=t?.trim();return e?`Add ${(/ies$/i.test(e)?e.replace(/ies$/i,"y"):/s$/i.test(e)?e.slice(0,-1):e).toLowerCase()}`:"Add record"}function Ste(t){return t.replace(/\.[^.]+$/,"").replace(/[_-]+/g," ").replace(/\s+/g," ").trim()}function kte({schema:t,items:e,permissions:n,actions:r={},label:i,uploads:s,rowIdKeys:o=["id","slug","uid","email"],storageKey:l,onUpdate:u,onCreate:f,onDelete:h,onAction:m,onActionDone:g,onPreviewMail:b,collectionActions:x={},onCollectionAction:S,onUpload:k,galleryUpload:C,onListGallery:_,onUploadGallery:M,initialEditRowId:R,onEditRowIdChange:A}){const[O,D]=E.useState(null),[j,z]=E.useState(!1),[q,Z]=E.useState(null),[G,ee]=E.useState(!1),[te,fe]=E.useState(null),[B,L]=E.useState(new Set),[U,ue]=E.useState(null),[Se,V]=E.useState(null),Y=E.useRef(null),[he,ve]=E.useState({overflow:!1,canLeft:!1,canRight:!1}),[Ae,Re]=E.useState(()=>TM(l,t)),[Le,Te]=E.useState({}),[oe,pe]=E.useState(!1),Ie=!!(n?.update&&u),Ue=!!(n?.create&&f),Ze=!!(n?.delete&&h),ft=wte(i),vt=!!(s&&k&&Object.keys(s).length),Kt=Object.entries(r),vn=Object.entries(x),Zt=Object.keys(t),Nn=E.useMemo(()=>Zt.filter(K=>EM(K,t[K])),[Zt,t]),nn=!!(m&&Kt.length>0),br=E.useCallback(K=>{D(K),A?.(Ar(K,o))},[A,o]),Pr=E.useCallback(()=>{D(null),A?.(null)},[A]);E.useEffect(()=>{if(!R)return;const K=e.find(re=>Ar(re,o)===R);K&&D(K)},[R,e,o]),E.useEffect(()=>{Te({})},[e]),E.useEffect(()=>{const K=new Set(e.map(re=>Ar(re,o)).filter(re=>!!re));L(re=>{const we=new Set([...re].filter(Fe=>K.has(Fe)));return we.size===re.size?re:we})},[e,o]);const vr=E.useMemo(()=>{let K=0;for(const[re,we]of Object.entries(Le)){const Fe=e.find(pt=>Ar(pt,o)===re);if(!Fe){K+=Object.keys(we).length;continue}for(const[pt,ln]of Object.entries(we))lp(Fe,pt)!==ln&&(K+=1)}return K},[Le,e,o]),qt=E.useCallback((K,re,we)=>{Te(Fe=>{const pt=e.find(al=>Ar(al,o)===K),ln=pt?lp(pt,re):null,Ui={...Fe[K]??{}};ln===we?delete Ui[re]:Ui[re]=we;const $r={...Fe};return Object.keys(Ui).length===0?delete $r[K]:$r[K]=Ui,$r})},[e,o]),si=E.useCallback(async()=>{if(!u||vr===0)return;pe(!0);const K=[];try{for(const[re,we]of Object.entries(Le)){const Fe=e.find(pt=>Ar(pt,o)===re);if(Fe)try{await u(re,{...Fe,...we})}catch(pt){K.push(`${re}: ${pt instanceof Error?pt.message:"Failed"}`)}}Te({}),K.length>0&&window.alert(`Saved with ${K.length} error(s).
330
-
331
- ${K.slice(0,8).join(`
332
- `)}`)}finally{pe(!1)}},[u,vr,Le,e,o]),xr=E.useCallback(async(K,re,we)=>{if(!m||re.length===0)return;fe(K);const Fe=[];try{for(const pt of re)try{await m(pt,K,we)}catch(ln){Fe.push(`${pt}: ${ln instanceof Error?ln.message:"Failed"}`)}await g?.(),L(new Set),Fe.length>0&&window.alert(`Finished with ${Fe.length} error(s).
333
-
334
- ${Fe.slice(0,8).join(`
335
- `)}`)}finally{fe(null)}},[m,g]),zr=E.useCallback((K,re)=>{const we=r[K];if(!we||re.length===0||!m)return;if(kM(we)||SM(we)){ue({actionId:K,rowIds:re});return}const Fe=re.length===1?"this person":`${re.length} people`;window.confirm(`${we.label} for ${Fe}?`)&&xr(K,re)},[r,m,xr]),Fn=E.useCallback(async(K,re)=>{if(S){fe(K);try{const we=await S(K,re);await g?.(),we&&typeof we=="object"&&"message"in we&&typeof we.message=="string"?window.alert(we.message):we&&typeof we=="object"&&"result"in we&&we.result&&typeof we.result=="object"&&"message"in we.result&&typeof we.result.message=="string"&&window.alert(we.result.message)}catch(we){window.alert(we instanceof Error?we.message:"Action failed")}finally{fe(null)}}},[S,g]),ge=E.useCallback(K=>{const re=x[K];if(!re||!S)return;if(SM(re)){V(K);return}const we=re.confirm?`${re.label}?
336
-
337
- ${re.confirm}`:`${re.label}?`;window.confirm(we)&&Fn(K)},[x,S,Fn]);E.useEffect(()=>{Re(TM(l,t))},[l]),E.useEffect(()=>{bte(l,Ae)},[l,Ae]);const Ne=E.useCallback(()=>{const K=Y.current;if(!K){ve({overflow:!1,canLeft:!1,canRight:!1});return}const re=K.scrollWidth>K.clientWidth+2;ve({overflow:re,canLeft:re&&K.scrollLeft>2,canRight:re&&K.scrollLeft+K.clientWidth<K.scrollWidth-2})},[]);E.useEffect(()=>{const K=Y.current;if(!K)return;Ne();const re=()=>Ne();K.addEventListener("scroll",re,{passive:!0});const we=new ResizeObserver(Ne);we.observe(K);const Fe=K.querySelector("table");return Fe&&we.observe(Fe),()=>{K.removeEventListener("scroll",re),we.disconnect()}},[Ne,e.length,Ae]);const I=K=>{const re=Y.current;if(!re)return;const we=Math.max(220,Math.round(re.clientWidth*.55));re.scrollBy({left:K==="left"?-we:we,behavior:"smooth"})},P=E.useMemo(()=>Zt.map(K=>({id:K,label:t[K]?.label??ap(K)})),[Zt,t]),H=E.useMemo(()=>{const K=[];if(nn){const re=e.map(Fe=>Ar(Fe,o)).filter(Fe=>!!Fe),we=re.length>0&&re.every(Fe=>B.has(Fe));K.push({id:"_select",enableHiding:!1,header:()=>y.jsx("input",{type:"checkbox",className:"vertebr-row-check",checked:we,"aria-label":"Select all",onChange:()=>{L(Fe=>re.every(pt=>Fe.has(pt))?new Set:new Set(re))}}),cell:({row:Fe})=>{const pt=Ar(Fe.original,o);return pt?y.jsx("input",{type:"checkbox",className:"vertebr-row-check",checked:B.has(pt),"aria-label":"Select row",onClick:ln=>ln.stopPropagation(),onChange:()=>L(ln=>yte(ln,pt))}):null},size:44})}return K.push(...Zt.length===0?[{id:"raw",header:"Item",cell:({row:re})=>y.jsx(Ap,{fieldKey:"raw",value:re.original})}]:Zt.map(re=>{const we=t[re],Fe=/(image|img|photo|avatar|thumbnail|thumb|cover)/i.test(re)||/(image|img|photo)/i.test(we?.label??""),pt=Ie&&EM(re,we);return{id:re,accessorKey:re,header:we?.label??ap(re),meta:{fieldKey:re,field:we},cell:({row:ln,getValue:Ui})=>{if(pt){const $r=Ar(ln.original,o);if(!$r)return y.jsx(Ap,{fieldKey:re,field:we,value:Ui()});const al=Le[$r]?.[re]??lp(ln.original,re),qc=Le[$r]?.[re]!==void 0&&Le[$r]?.[re]!==lp(ln.original,re);return y.jsx("div",{className:"vertebr-visibility-check","data-dirty":qc?"true":void 0,onClick:na=>na.stopPropagation(),children:y.jsx(OO,{visible:al,dirty:qc,label:we?.label??ap(re),disabled:oe,onChange:na=>qt($r,re,na)})})}return y.jsx(Ap,{fieldKey:re,field:we,value:Ui()})},size:pt?88:Fe?220:void 0}})),K.push({id:"_actions",header:()=>y.jsx("span",{className:"vertebr-sr-only",children:"Actions"}),enableHiding:!1,cell:({row:re})=>{const we=Ar(re.original,o);return y.jsxs("div",{className:"vertebr-row-actions",onClick:Fe=>Fe.stopPropagation(),onKeyDown:Fe=>Fe.stopPropagation(),children:[y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>Z(re.original),children:"View"}),Ie?y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>br(re.original),children:"Edit"}):null,we?Kt.map(([Fe,pt])=>y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:te!=null,onClick:()=>zr(Fe,[we]),children:pt.label},Fe)):null,Ze&&we?y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-danger-quiet",onClick:()=>{window.confirm("Delete this row? This cannot be undone.")&&h?.(we)},children:"Delete"}):null]})}}),K},[t,Zt,e,B,nn,Ie,Ze,Kt,te,zr,h,o,Le,qt]),ie=Qee({data:e,columns:H,state:{columnVisibility:Ae},onColumnVisibilityChange:Re,getCoreRowModel:Zee()}),ae=O?Ar(O,o):null,ye=Object.fromEntries(Object.entries(t).filter(([,K])=>!K.readOnly||K.required).map(([K,re])=>[K,re.readOnly?{...re,readOnly:!1}:re])),ke=Object.fromEntries(Object.entries(ye).map(([K,re])=>[K,re.default??(re.type==="boolean"?!1:re.type==="number"?void 0:re.type==="file[]"?[]:"")]));if(O&&ae&&u){const K=Object.fromEntries(Object.entries(t).filter(([,we])=>!we.readOnly)),re=CM(O,o);return y.jsxs("div",{className:"vertebr-resource-edit",children:[y.jsxs("div",{className:"vertebr-resource-edit-head",children:[y.jsxs("div",{className:"vertebr-resource-edit-heading",children:[y.jsx("p",{className:"vertebr-resource-edit-eyebrow",children:"Editing record"}),y.jsx("h2",{children:re}),y.jsx("p",{className:"vertebr-resource-edit-id",children:ae})]}),y.jsx("button",{type:"button",className:"vertebr-btn",onClick:()=>Pr(),children:"Back"})]}),y.jsx(Vg,{variant:"record",schema:K,value:O,uploads:s,onUpload:k,galleryUpload:C,onListGallery:_,onUploadGallery:M,onSave:async we=>{await u(ae,we),Pr()}})]})}const _e=y.jsxs("div",{className:"vertebr-table-toolbar",children:[y.jsxs("div",{className:"vertebr-table-toolbar-start",children:[P.length>0?y.jsx(tte,{columns:P,visibility:Ae,onChange:Re}):null,vt?y.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-icon",onClick:()=>ee(!0),children:[y.jsx(_te,{}),"Bulk upload"]}):null,Nn.length>0&&vr>0?y.jsxs(y.Fragment,{children:[y.jsxs("span",{className:"vertebr-count",children:[vr," visibility change",vr===1?"":"s"]}),y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",disabled:oe,onClick:()=>{si()},children:oe?"Saving…":"Save visibility"}),y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:oe,onClick:()=>Te({}),children:"Discard"})]}):null,vn.map(([K,re])=>y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:te!=null,onClick:()=>ge(K),children:re.label},K)),nn&&B.size>0?y.jsxs(y.Fragment,{children:[y.jsxs("span",{className:"vertebr-count",children:[B.size," selected"]}),Kt.map(([K,re])=>y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:te!=null,onClick:()=>zr(K,[...B]),children:re.label},K)),y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>L(new Set),children:"Clear"})]}):null]}),he.overflow?y.jsxs("div",{className:"vertebr-table-scroll-controls",role:"group","aria-label":"Scroll columns",children:[y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-icon vertebr-table-scroll-btn",disabled:!he.canLeft,onClick:()=>I("left"),"aria-label":"Scroll columns left",children:y.jsx(Ete,{})}),y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-icon vertebr-table-scroll-btn",disabled:!he.canRight,onClick:()=>I("right"),"aria-label":"Scroll columns right",children:y.jsx(Tte,{})})]}):null]}),Be=G&&s&&k?y.jsx(ete,{uploads:s,canCreate:Ue,fieldLabels:Object.fromEntries(Object.keys(s).map(K=>[K,t[K]?.label??ap(K)])),onClose:()=>ee(!1),onUpload:k,onCreateFromUploads:Ue&&f?async(K,re)=>{for(const we of re){const Fe=Ste(we.name??"Image");await f({[K]:we.url,name:Fe,title:Fe})}}:void 0}):null,it=j&&f?y.jsx(ate,{title:ft,schema:ye,value:ke,uploads:s,onUpload:k,galleryUpload:C,onListGallery:_,onUploadGallery:M,onClose:()=>z(!1),onCreate:f}):null,_t=U?kM(r[U.actionId])&&b?y.jsx(hte,{title:r[U.actionId]?.label??"Send email",count:U.rowIds.length,schema:c0(r[U.actionId]?.input??{}),submitLabel:te?"Sending…":U.rowIds.length===1?"Send":`Send to ${U.rowIds.length}`,onClose:()=>ue(null),onPreview:K=>b(U.rowIds[0],U.actionId,K),onSubmit:K=>xr(U.actionId,U.rowIds,K)}):r[U.actionId]?.input?y.jsx(dM,{title:r[U.actionId]?.label??"Run action",count:U.rowIds.length,schema:c0(r[U.actionId].input),submitLabel:te?"Sending…":U.rowIds.length===1?r[U.actionId]?.label??"Send":`Send to ${U.rowIds.length}`,onClose:()=>ue(null),onSubmit:K=>xr(U.actionId,U.rowIds,K)}):null:null,xn=Se&&x[Se]?.input?y.jsx(dM,{title:x[Se]?.label??"Run action",eyebrow:"This resource",schema:c0(x[Se].input),submitLabel:te?"Working…":"Run",onClose:()=>V(null),onSubmit:K=>Fn(Se,K)}):null,me=y.jsxs("div",{className:"vertebr-panel-head",children:[y.jsx("h2",{children:"Records"}),y.jsxs("div",{className:"vertebr-panel-head-actions",children:[Ue?y.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-icon",onClick:()=>z(!0),children:[y.jsx(Cte,{}),ft]}):null,y.jsx("span",{className:"vertebr-count",children:e.length})]})]});return e.length===0?y.jsxs("div",{className:"vertebr-resource-body",children:[me,vt||P.length>0||vn.length>0?_e:null,y.jsx("div",{className:"vertebr-empty",children:"No rows yet."}),Be,it,_t,xn]}):y.jsxs("div",{className:"vertebr-resource-body",children:[me,_e,y.jsx("div",{className:"vertebr-table-wrap",ref:Y,"data-overflow":he.overflow?"true":void 0,"data-overflow-left":he.canLeft?"true":void 0,"data-overflow-right":he.canRight?"true":void 0,children:y.jsxs("table",{className:"vertebr-table",children:[y.jsx("thead",{children:ie.getHeaderGroups().map(K=>y.jsx("tr",{children:K.headers.map(re=>y.jsx("th",{className:re.column.id==="_actions"?"vertebr-col-actions":re.column.id==="_select"?"vertebr-col-select":void 0,children:re.isPlaceholder?null:bM(re.column.columnDef.header,re.getContext())},re.id))},K.id))}),y.jsx("tbody",{children:ie.getRowModel().rows.map(K=>y.jsx("tr",{className:"vertebr-table-row-clickable","data-selected":nn&&Ar(K.original,o)&&B.has(Ar(K.original,o))?"true":void 0,tabIndex:0,onClick:()=>Z(K.original),onKeyDown:re=>{(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),Z(K.original))},children:K.getVisibleCells().map(re=>y.jsx("td",{className:re.column.id==="_actions"?"vertebr-col-actions":re.column.id==="_select"?"vertebr-col-select":void 0,children:bM(re.column.columnDef.cell,re.getContext())},re.id))},K.id))})]})}),q?y.jsx(gte,{schema:t,row:q,title:CM(q,o),canEdit:Ie,onClose:()=>Z(null),onEdit:()=>{br(q),Z(null)}}):null,_t,xn,Be,it]})}function Cte(){return y.jsxs("svg",{className:"vertebr-btn-glyph",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("path",{d:"M12 5v14"}),y.jsx("path",{d:"M5 12h14"})]})}function Ete(){return y.jsx("svg",{className:"vertebr-btn-glyph",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:y.jsx("path",{d:"m15 18-6-6 6-6"})})}function Tte(){return y.jsx("svg",{className:"vertebr-btn-glyph",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:y.jsx("path",{d:"m9 18 6-6-6-6"})})}function _te(){return y.jsxs("svg",{className:"vertebr-btn-glyph",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("path",{d:"M16 5h6"}),y.jsx("path",{d:"M19 2v6"}),y.jsx("rect",{x:"3",y:"7",width:"14",height:"14",rx:"2"}),y.jsx("circle",{cx:"8.5",cy:"12.5",r:"1.5"}),y.jsx("path",{d:"m17 21-4.5-4.5L7 21"})]})}const Ate=[{id:"desktop",label:"Desktop"},{id:"mobile",label:"Mobile"}],tc=390,nc=844;function Rte({previewPath:t,controlId:e,draft:n}){const r=E.useRef(null),i=E.useRef(null),s=E.useRef(n),[o,l]=E.useState(!1),[u,f]=E.useState(!1),[h,m]=E.useState("desktop"),[g,b]=E.useState(1);s.current=n;const x=h==="mobile",S=E.useMemo(()=>_H(t,{controlId:e}),[t,e]),k=E.useCallback(()=>{const _=r.current?.contentWindow,M=s.current;!_||!M||MH(_,e,M)},[e]),C=E.useCallback(()=>{const _=r.current?.contentWindow;if(_)try{_.dispatchEvent(new Event("resize"))}catch{}},[]);return E.useEffect(()=>{l(!1),f(!1)},[S]),E.useEffect(()=>NH(_=>{const M=r.current?.contentWindow;!M||_!==M||(l(!0),k())}),[k,S]),E.useEffect(()=>{o&&k()},[n,o,k]),E.useEffect(()=>{if(!x){b(1);return}const _=i.current;if(!_||typeof ResizeObserver>"u")return;const M=()=>{const A=getComputedStyle(_),O=(Number.parseFloat(A.paddingLeft)||0)+(Number.parseFloat(A.paddingRight)||0),D=(Number.parseFloat(A.paddingTop)||0)+(Number.parseFloat(A.paddingBottom)||0),j=Math.max(0,_.clientWidth-O),z=Math.max(0,_.clientHeight-D),q=Math.min(1,j/tc,z/nc);b(Number.isFinite(q)&&q>0?q:1)};M();const R=new ResizeObserver(M);return R.observe(_),()=>R.disconnect()},[x]),E.useEffect(()=>{if(!o)return;const _=window.setTimeout(C,50);return()=>window.clearTimeout(_)},[h,g,o,C]),y.jsxs("div",{className:"vertebr-page-preview",children:[y.jsxs("div",{className:"vertebr-page-preview-meta",children:[y.jsxs("p",{children:[y.jsx("span",{children:"Preview"}),y.jsx("strong",{children:t})]}),y.jsxs("p",{children:[y.jsx("span",{children:"Status"}),y.jsx("strong",{children:u?"Unavailable":o?"Live":"Loading…"})]}),x?y.jsxs("p",{children:[y.jsx("span",{children:"Viewport"}),y.jsxs("strong",{children:[tc,"×",nc]})]}):null,y.jsx("div",{className:"vertebr-page-preview-viewports",role:"group","aria-label":"Preview viewport",children:Ate.map(_=>y.jsx("button",{type:"button","data-active":h===_.id?"true":void 0,onClick:()=>m(_.id),children:_.label},_.id))})]}),y.jsx("div",{ref:i,className:"vertebr-page-preview-stage","data-viewport":h,children:y.jsx("div",{className:"vertebr-page-preview-shell",style:x?{width:tc*g,height:nc*g}:void 0,children:y.jsx("div",{className:"vertebr-page-preview-frame",style:x?{width:tc,height:nc,transform:`scale(${g})`,transformOrigin:"top left"}:void 0,children:u?y.jsxs("div",{className:"vertebr-page-preview-empty",children:["Could not load host preview at ",t,"."]}):y.jsx("iframe",{ref:r,title:`Preview ${e}`,src:S,width:x?tc:void 0,height:x?nc:void 0,style:x?{width:tc,height:nc}:void 0,onLoad:()=>{l(!0),k(),C()},onError:()=>f(!0)})})})})]})}function Mte({client:t,configData:e,isPageSelection:n,previewPath:r,onConfigSaved:i,galleryPicker:s,fontLibraryPicker:o}){const[l,u]=E.useState(e.value),f=!!r,h=E.useCallback(g=>{u(g)},[]),m=y.jsx(Vg,{schema:e.schema,value:e.value,onChange:f?h:void 0,onSave:async g=>{const b=await t.setConfig(e.id,g);i(b)},...s,...o});return y.jsxs("div",{className:"vertebr-config-editor",children:[f?y.jsxs("div",{className:"vertebr-panel-head",children:[y.jsx("h2",{children:n?"Page content":e.label}),y.jsxs("span",{className:"vertebr-count",children:[Object.keys(e.schema).length," fields"]})]}):n?y.jsxs("div",{className:"vertebr-panel-head",children:[y.jsx("h2",{children:"Page content"}),y.jsxs("span",{className:"vertebr-count",children:[Object.keys(e.schema).length," fields"]})]}):null,f&&r?y.jsxs("div",{className:"vertebr-page-editor",children:[y.jsx("div",{className:"vertebr-page-editor-form",children:m}),y.jsx(Rte,{previewPath:r,controlId:e.id,draft:l??e.value})]}):m]})}function Nte({client:t,catalog:e,selection:n,onSelectionChange:r,authRequired:i,loading:s,isPageSelection:o,metricsData:l,metricsLoading:u,metricsRange:f,onMetricsRangeChange:h,onRefreshMetrics:m,galleryData:g,galleryLoading:b,onRefreshGallery:x,fontLibraryData:S,fontLibraryLoading:k,onRefreshFonts:C,emailsData:_,emailsLoading:M,onRefreshEmails:R,resourceData:A,onRefreshResource:O,configData:D,onConfigSaved:j,galleryPicker:z,fontLibraryPicker:q}){return e?y.jsx("div",{className:"vertebr-content",children:y.jsxs("section",{className:"vertebr-panel",children:[n?.kind==="overview"?y.jsx(lee,{label:l?.label??e.metrics?.label,windowLabel:l?.windowLabel,compareLabel:l?.compareLabel,metrics:l?.metrics??[],charts:l?.charts??[],range:f,onRangeChange:h,loading:u,onRefresh:()=>{m()}}):null,n?.kind==="gallery"&&g?y.jsx(WQ,{label:g.label,items:g.items,accept:g.accept,maxBytes:g.maxBytes,canDelete:g.canDelete,loading:b,onRefresh:()=>{x()},onUpload:async Z=>{Z.length===1&&Z[0]?await t.uploadGalleryFile(Z[0]):await t.uploadGalleryFiles(Z),await x()},onDelete:g.canDelete?async Z=>{await t.deleteGalleryItem(Z),await x()}:void 0}):null,n?.kind==="fontLibrary"&&S?y.jsx(GQ,{label:S.label,data:S,loading:k,onRefresh:()=>{C()},onUpload:async(Z,G)=>{for(const ee of Z)await t.uploadFontFile(ee,G);await C()},onImportGoogle:S.canImportGoogle?async Z=>{await t.importGoogleFont(Z),await C()}:void 0,onDelete:S.canDelete?async Z=>{await t.deleteFontItem(Z),await C()}:void 0}):null,n?.kind==="emails"&&_?y.jsx(HQ,{data:_,loading:M,tab:n.tab??"compose",onRefresh:()=>{R()},onLoadRecipients:async Z=>{const G=await t.listResource(Z,{fresh:!0}),ee=new Set,te=[];for(const fe of G.items){const B=String(fe.email??"").trim().toLowerCase();if(!B.includes("@")||ee.has(B))continue;ee.add(B);const L=String(fe.id??fe.uid??fe.slug??B),U=String(fe.displayName??fe.name??"").trim();te.push({email:B,id:L,...U?{label:U}:{}})}return te.sort((fe,B)=>fe.email.localeCompare(B.email)),te},onPreview:Z=>t.previewEmails(Z),onSend:async Z=>{const G=await t.sendEmails(Z);return{sent:G.sent,failed:G.failed}},onSchedule:_.canSchedule?async Z=>{await t.scheduleEmails(Z)}:void 0,onCancel:_.canSchedule?async Z=>{await t.cancelEmailCampaign(Z)}:void 0,onSaveLibrary:_.canLibrary?async Z=>{await t.saveEmailLibraryTemplate(Z)}:void 0,onDeleteLibrary:_.canLibrary?async Z=>{await t.deleteEmailLibraryTemplate(Z)}:void 0}):null,n?.kind==="resource"&&A?y.jsx(kte,{schema:A.schema,items:A.items,label:A.label,initialEditRowId:n.rowId&&n.id===A.id?n.rowId:void 0,onEditRowIdChange:Z=>{r?.({kind:"resource",id:A.id,rowId:Z??void 0})},permissions:A.permissions,actions:A.actions,collectionActions:A.collectionActions,uploads:A.uploads,storageKey:A.id,onUpdate:A.permissions.update?async(Z,G)=>{await t.updateResource(A.id,Z,G),await O()}:void 0,onCreate:A.permissions.create?async Z=>{await t.createResource(A.id,Z),await O()}:void 0,onDelete:A.permissions.delete?async Z=>{await t.deleteResource(A.id,Z),await O()}:void 0,onAction:async(Z,G,ee)=>{await t.runResourceAction(A.id,Z,G,ee)},onActionDone:O,onPreviewMail:async(Z,G,ee)=>t.previewResourceMail(A.id,Z,G,ee),onCollectionAction:async(Z,G)=>t.runCollectionAction(A.id,Z,G),onUpload:A.uploads?async(Z,G)=>{if(G.length===1&&G[0]){const te=await t.uploadResourceFile(A.id,Z,G[0]);return[{url:te.url,name:te.name}]}return(await t.uploadResourceFiles(A.id,Z,G)).files}:void 0,...z}):null,n?.kind==="config"&&D?y.jsx(Mte,{client:t,configData:D,isPageSelection:o,previewPath:e.configs.find(Z=>Z.id===D.id)?.previewPath,onConfigSaved:j,galleryPicker:z,fontLibraryPicker:q},D.id):null]})}):y.jsx("div",{className:"vertebr-content",children:y.jsx("section",{className:"vertebr-panel",children:y.jsx("div",{className:"vertebr-empty",children:i?"Authenticated access required for this environment.":s?"Loading…":"Unable to load catalog."})})})}function Ote({catalogLoaded:t,authRequired:e,selection:n,isPageSelection:r,hasPagePreview:i}){return!t&&e?"Provide an access token to load this environment.":n?.kind==="overview"?"Commerce, growth, and catalog for the selected environment.":n?.kind==="gallery"?"Browse and upload shared media assets.":n?.kind==="fontLibrary"?"Upload custom fonts or add Google Fonts to your library.":n?.kind==="emails"?"Send or schedule branded email to a list or specific people.":n?.kind==="resource"?n.rowId?"Edit this record — changes apply to the selected environment.":"Manage records scoped to the selected environment.":n?.kind==="config"?i?r?"Edit content — live storefront preview updates as you type.":"Edit settings — live storefront preview updates as you change typography and colors.":r?"Edit content for this page.":"Environment settings — changes apply to this environment only.":"Select a panel."}function Dte({activeLabel:t,activeEnv:e,catalogLoaded:n,authRequired:r,selection:i,isPageSelection:s,hasPagePreview:o,error:l,breadcrumbs:u}){return y.jsxs("header",{className:"vertebr-header",children:[y.jsxs("div",{children:[u.length>1?y.jsx("ol",{className:"vertebr-breadcrumbs",children:u.map((f,h)=>y.jsx("li",{children:h===u.length-1?y.jsx("strong",{children:f.label}):f.label},`${f.label}-${h}`))}):null,y.jsxs("div",{className:"vertebr-heading-row",children:[y.jsx("h1",{children:t}),e?y.jsx("span",{className:"vertebr-env-badge","data-tone":e.tone??"neutral",children:e.label}):null]}),y.jsx("p",{children:Ote({catalogLoaded:n,authRequired:r,selection:i,isPageSelection:s,hasPagePreview:o})})]}),l?y.jsx("span",{className:"vertebr-status","data-tone":"danger",children:l}):null]})}function Ite(){const{state:t}=oO();return t.visible?y.jsxs("div",{className:"vertebr-savebar","data-tone":t.tone,children:[y.jsx("div",{className:"vertebr-savebar-message",children:t.saving?"Saving…":t.message??(t.isDirty?"Unsaved changes":"Saved")}),y.jsxs("div",{className:"vertebr-savebar-actions",children:[t.onDiscard&&t.isDirty?y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:t.saving,onClick:t.onDiscard,children:"Discard"}):null,t.onSave?y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",disabled:t.saving||!t.isDirty,onClick:()=>{t.onSave?.()},children:"Save"}):null]})]}):null}function ta(t){return{width:18,height:18,viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...t}}function jte(t){return y.jsx("svg",{...ta(t),children:y.jsx("path",{d:"M3 8.5 10 2.5l7 6v8.5a1 1 0 0 1-1 1h-4.5v-5H8.5v5H4a1 1 0 0 1-1-1V8.5z"})})}function Lte(t){return y.jsxs("svg",{...ta(t),children:[y.jsx("path",{d:"M3 6.5 10 2.5l7 4v9H3v-9z"}),y.jsx("path",{d:"M7 11.5h6M7 14h4"})]})}function Pte(t){return y.jsxs("svg",{...ta(t),children:[y.jsx("rect",{x:"2.5",y:"4.5",width:"15",height:"11",rx:"1.5"}),y.jsx("path",{d:"m3.5 13 3.5-3.5 2.5 2.5L12.5 9l4 4.5"}),y.jsx("circle",{cx:"7",cy:"7.5",r:"1",fill:"currentColor",stroke:"none"})]})}function zte(t){return y.jsxs("svg",{...ta(t),children:[y.jsx("path",{d:"M5 16.5V5.5h10M7.5 16.5V9h5v7.5"}),y.jsx("path",{d:"M7 5.5h6"})]})}function $te(t){return y.jsxs("svg",{...ta(t),children:[y.jsx("rect",{x:"2.5",y:"4.5",width:"15",height:"11",rx:"1.5"}),y.jsx("path",{d:"m3.5 6.5 6.5 4.5 3.5 2.5 6.5-2.5 6.5 4.5"})]})}function Bte(t){return y.jsxs("svg",{...ta(t),children:[y.jsx("path",{d:"M6 3.5h5.5L16 8v8.5a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-12a1 1 0 0 1 1-1z"}),y.jsx("path",{d:"M11.5 3.5V8H16"})]})}function Vte(t){return y.jsxs("svg",{...ta(t),children:[y.jsx("circle",{cx:"10",cy:"10",r:"2.25"}),y.jsx("path",{d:"M10 2.5v2M10 15.5v2M3.5 10h2M14.5 10h2M5.4 5.4l1.4 1.4M13.2 13.2l1.4 1.4M5.4 14.6l1.4-1.4M13.2 6.8l1.4-1.4"})]})}function Hte(t){return y.jsxs("svg",{...ta(t),children:[y.jsx("circle",{cx:"9",cy:"9",r:"4.75"}),y.jsx("path",{d:"M13 13l3.5 3.5"})]})}function ka(t){return t==="overview"?jte:t.startsWith("resource:")?Lte:t==="gallery"?Pte:t==="fonts"?zte:t==="emails"?$te:t.startsWith("config:")?Bte:Vte}function Ute({item:t,collapsed:e}){const n=!!t.children?.length,r=t.children?.some(u=>u.active)??!1,i=t.active||r,[s,o]=E.useState(i),l=t.icon??ka(t.key);return E.useEffect(()=>{i&&o(!0)},[i]),n?y.jsxs("div",{className:"vertebr-nav-item","data-has-children":"true","data-open":s||void 0,children:[y.jsxs("div",{className:"vertebr-nav-parent",children:[y.jsxs("button",{type:"button",className:"vertebr-nav-parent-label","data-active":i&&!r,"data-section":i||void 0,title:e?t.label:void 0,onClick:()=>{o(!0),t.onSelect()},children:[y.jsx(l,{className:"vertebr-nav-icon"}),y.jsx("span",{className:"vertebr-nav-label-text",children:t.label})]}),e?null:y.jsx("button",{type:"button",className:"vertebr-nav-parent-toggle","aria-label":s?`Collapse ${t.label}`:`Expand ${t.label}`,"aria-expanded":s,onClick:()=>o(u=>!u),children:y.jsx("span",{"aria-hidden":"true",children:s?"▾":"▸"})})]}),s&&!e?y.jsx("div",{className:"vertebr-nav-sub",role:"group",children:t.children.map(u=>y.jsx("button",{type:"button",className:"vertebr-nav-subitem","data-active":u.active,onClick:()=>{o(!0),u.onSelect()},children:u.label},u.key))}):null]}):y.jsxs("button",{type:"button","data-active":t.active,title:e?t.label:void 0,onClick:t.onSelect,children:[y.jsx(l,{className:"vertebr-nav-icon"}),y.jsx("span",{className:"vertebr-nav-label-text",children:t.label})]})}function Fte({navGroups:t,collapsed:e}){return y.jsx("aside",{className:"vertebr-sidebar","data-collapsed":e||void 0,children:y.jsx("div",{className:"vertebr-sidebar-top",children:y.jsx("nav",{className:"vertebr-nav",children:t.map(n=>y.jsxs("div",{className:"vertebr-nav-group",children:[e?null:y.jsx("div",{className:"vertebr-nav-label",children:n.label}),n.items.map(r=>y.jsx(Ute,{item:r,collapsed:e},r.key))]},n.label))})})})}function qte(){const{toasts:t,dismiss:e}=lO();return t.length?y.jsx("div",{className:"vertebr-toast-stack","aria-live":"polite",children:t.map(n=>y.jsxs("div",{className:"vertebr-toast","data-tone":n.tone,role:"status",children:[y.jsx("span",{children:n.message}),y.jsx("button",{type:"button",className:"vertebr-toast-dismiss","aria-label":"Dismiss",onClick:()=>e(n.id),children:"×"})]},n.id))}):null}function Gte({environments:t,value:e,onChange:n}){const r=t.find(i=>i.id===e);return y.jsxs(Mg,{value:e,onValueChange:n,children:[y.jsxs(Ng,{className:"vertebr-select-trigger","aria-label":"Environment","data-tone":r?.tone??"neutral",children:[y.jsxs("span",{className:"vertebr-select-value",children:[y.jsx("span",{className:"vertebr-select-dot","data-tone":r?.tone??"neutral"}),y.jsx(Og,{placeholder:"Select environment"})]}),y.jsx(Dg,{className:"vertebr-select-icon",children:y.jsx(Wte,{})})]}),y.jsx(Ig,{children:y.jsx(jg,{className:"vertebr-select-content",position:"popper",sideOffset:6,children:y.jsx(Pg,{className:"vertebr-select-viewport",children:t.map(i=>y.jsxs(zg,{value:i.id,className:"vertebr-select-item","data-tone":i.tone??"neutral",children:[y.jsxs("span",{className:"vertebr-select-value",children:[y.jsx("span",{className:"vertebr-select-dot","data-tone":i.tone??"neutral"}),y.jsx($g,{children:i.label})]}),i.auth?.required?y.jsx("span",{className:"vertebr-env-lock",children:"auth"}):null,y.jsx(Bg,{className:"vertebr-select-check",children:y.jsx(Kte,{})})]},i.id))})})})]})}function Wte(){return y.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:y.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function Kte(){return y.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:y.jsx("path",{d:"M2.5 6.2 4.8 8.5 9.5 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function Zte({theme:t,onChange:e}){return y.jsxs("div",{className:"vertebr-theme",children:[y.jsx("div",{className:"vertebr-nav-label",children:"Appearance"}),y.jsxs("div",{className:"vertebr-theme-toggle",role:"group","aria-label":"Color theme",children:[y.jsxs("button",{type:"button",className:"vertebr-theme-option","data-active":t==="light","aria-pressed":t==="light",onClick:()=>e("light"),children:[y.jsx(Yte,{}),"Light"]}),y.jsxs("button",{type:"button",className:"vertebr-theme-option","data-active":t==="dark","aria-pressed":t==="dark",onClick:()=>e("dark"),children:[y.jsx(Xte,{}),"Dark"]})]})]})}function Yte(){return y.jsxs("svg",{className:"vertebr-theme-icon",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("circle",{cx:"12",cy:"12",r:"4"}),y.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]})}function Xte(){return y.jsx("svg",{className:"vertebr-theme-icon",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:y.jsx("path",{d:"M21 14.5A8.5 8.5 0 0 1 9.5 3 7 7 0 1 0 21 14.5z"})})}function Jte({brand:t,envList:e,environment:n,onEnvironmentChange:r,activeEnv:i,authUserLabel:s,onSignOut:o,getAccessToken:l,authRequired:u,token:f,tokenDraft:h,onTokenDraftChange:m,onSaveToken:g,onClearToken:b,theme:x,onThemeChange:S,sidebarCollapsed:k,onToggleSidebar:C}){return y.jsxs("header",{className:"vertebr-topbar",children:[y.jsxs("div",{className:"vertebr-topbar-start",children:[y.jsx("button",{type:"button",className:"vertebr-topbar-toggle","aria-label":k?"Expand sidebar":"Collapse sidebar",onClick:C,children:"☰"}),y.jsx("strong",{className:"vertebr-topbar-brand",children:t}),e.length>0?y.jsxs("div",{className:"vertebr-topbar-env",children:[y.jsx(Gte,{environments:e,value:n,onChange:r}),i?y.jsx("span",{className:"vertebr-env-badge","data-tone":i.tone??"neutral",children:i.label}):null]}):null]}),y.jsxs("div",{className:"vertebr-topbar-search","aria-hidden":"true",children:[y.jsx(Hte,{}),y.jsx("span",{children:"Search admin"}),y.jsx("kbd",{children:"⌘K"})]}),y.jsxs("div",{className:"vertebr-topbar-end",children:[!l&&(u||f)?y.jsxs("div",{className:"vertebr-topbar-token",children:[y.jsx("input",{className:"vertebr-auth-input",type:"password",placeholder:"Access token",value:h,onChange:_=>m(_.target.value),autoComplete:"off"}),y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:g,children:"Use"}),f?y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:b,children:"Clear"}):null]}):null,l&&s?y.jsx("span",{className:"vertebr-topbar-user",children:s}):null,o?y.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>{o()},children:"Sign out"}):null,y.jsx(Zte,{theme:x,onChange:S})]})]})}function Qte(t,e){const n=[{label:"Home",href:"/overview"}];if(!t||!e)return n;switch(t.kind){case"overview":return[...n,{label:e.metrics?.label??"Overview"}];case"gallery":return[...n,{label:e.gallery?.label??"Gallery"}];case"fontLibrary":return[...n,{label:e.fontLibrary?.label??"Fonts"}];case"emails":return[...n,{label:e.emails?.label??"Email"},{label:t.tab==="templates"?"Templates":t.tab==="activity"?"Activity":"Compose"}];case"resource":{const r=e.resources.find(s=>s.id===t.id),i=[...n,{label:r?.group??"Products",href:void 0},{label:r?.label??t.id}];return t.rowId&&i.push({label:t.rowId}),i}case"config":{const r=e.configs.find(s=>s.id===t.id),i=r?.group??(r?.section==="page"?"Pages":"Settings");return[...n,{label:i},{label:r?.label??t.id}]}default:return n}}const ene=new Set(["compose","templates","activity"]);function tne(t){const e=(t||"/admin/api").replace(/\/$/,"")||"/admin/api";return e.endsWith("/api")?e.slice(0,-4)||"/":e}function E2(t){return!t||t==="/"?"":t.replace(/\/$/,"")}function nne(t,e){if(!t)return"/overview";switch(t.kind){case"overview":return"/overview";case"gallery":return"/gallery";case"fontLibrary":return"/fonts";case"emails":return`/emails/${t.tab??"compose"}`;case"resource":return t.rowId?`/resources/${encodeURIComponent(t.id)}/${encodeURIComponent(t.rowId)}`:`/resources/${encodeURIComponent(t.id)}`;case"config":return`/${e.configs.find(i=>i.id===t.id)?.section==="page"?"pages":"config"}/${encodeURIComponent(t.id)}`;default:return"/overview"}}function rne(t,e,n){const r=E2(t),i=nne(e,n);return`${r}${i}`||"/"}function ine(t){return t&&ene.has(t)?t:"compose"}function v0(t,e,n){const r=E2(e);let i=t||"/";if(r){if(i===r||i===`${r}/`)return null;(i.startsWith(`${r}/`)||i.startsWith(r))&&(i=i.slice(r.length))}const s=i.replace(/^\//,"").split("/").filter(Boolean);if(s.length===0)return null;const[o,...l]=s;if(o==="overview")return{kind:"overview"};if(o==="gallery")return{kind:"gallery"};if(o==="fonts")return{kind:"fontLibrary"};if(o==="emails")return{kind:"emails",tab:ine(l[0])};if(o==="resources"&&l[0]){const u=decodeURIComponent(l[0]);return n&&!n.resources.some(f=>f.id===u)?null:l[1]?{kind:"resource",id:u,rowId:decodeURIComponent(l[1])}:{kind:"resource",id:u}}if((o==="pages"||o==="config")&&l[0]){const u=decodeURIComponent(l[0]);if(n){const f=n.configs.find(h=>h.id===u);if(!f||o==="pages"&&f.section!=="page"||o==="config"&&f.section==="page")return null}return{kind:"config",id:u}}return null}function Di(t){if(t.metrics)return{kind:"overview"};const e=t.resources[0];if(e)return{kind:"resource",id:e.id};if(t.gallery)return{kind:"gallery"};if(t.fontLibrary)return{kind:"fontLibrary"};if(t.emails)return{kind:"emails",tab:"compose"};const n=t.configs[0];return n?{kind:"config",id:n.id}:{kind:"overview"}}function _M(t,e){return t?t.kind==="overview"?e.metrics?t:Di(e):t.kind==="gallery"?e.gallery?t:Di(e):t.kind==="fontLibrary"?e.fontLibrary?t:Di(e):t.kind==="emails"?e.emails?t:Di(e):t.kind==="resource"?e.resources.some(n=>n.id===t.id)?t:Di(e):t.kind==="config"&&e.configs.some(n=>n.id===t.id)?t:Di(e):Di(e)}function sne(t,e){return t===e?!0:!t||!e?t===e:t.kind!==e.kind?!1:t.kind==="overview"||t.kind==="gallery"||t.kind==="fontLibrary"?!0:t.kind==="emails"&&e.kind==="emails"?(t.tab??"compose")===(e.tab??"compose"):t.kind==="resource"&&e.kind==="resource"?t.id===e.id&&(t.rowId??"")===(e.rowId??""):t.kind==="config"&&e.kind==="config"?t.id===e.id:!1}function one(t){const e=[],n=new Map;for(const r of t){const i=r.group.trim()||"Resources";n.has(i)||(n.set(i,[]),e.push(i)),n.get(i).push(r)}return e.map(r=>({label:r,items:n.get(r)}))}function x0(t){try{return localStorage.getItem(t)}catch{return null}}function cp(t,e){try{localStorage.setItem(t,e)}catch{}}function AM(t){try{localStorage.removeItem(t)}catch{}}function ane({apiBase:t="/admin/api",basePath:e,title:n="Control plane",envStorageKey:r="vertebr:env",tokenStorageKey:i="vertebr:token",themeStorageKey:s="vertebr:theme",metricsRangeStorageKey:o="vertebr:metrics-range",getAccessToken:l,authUserLabel:u,onSignOut:f}){const h=e??tne(t),{theme:m,setTheme:g}=BH(s),[b,x]=E.useState(()=>x0(r)??""),[S,k]=E.useState(()=>x0(i)??""),[C,_]=E.useState(S),M=E.useCallback(()=>b,[b]),R=E.useMemo(()=>R0({apiBase:t,getEnvironment:M,getAccessToken:l??(()=>S||null)}),[t,M,l,S]),[A,O]=E.useState(null),[D,j]=E.useState(null),[z,q]=E.useState(()=>typeof window>"u"?{kind:"overview"}:v0(window.location.pathname,h,null)??{kind:"overview"}),[Z,G]=E.useState(null),[ee,te]=E.useState(null),[fe,B]=E.useState(null),[L,U]=E.useState(!1),[ue,Se]=E.useState(()=>UH(x0(o))),[V,Y]=E.useState(null),[he,ve]=E.useState(!1),[Ae,Re]=E.useState(null),[Le,Te]=E.useState(!1),[oe,pe]=E.useState(null),[Ie,Ue]=E.useState(!1),[Ze,ft]=E.useState(null),[vt,Kt]=E.useState(!0),[vn,Zt]=E.useState(!1),Nn=E.useRef(!0),nn=E.useCallback((me,K,re=!1)=>{if(typeof window>"u"||!me)return;const we=rne(h,me,K);if(window.location.pathname===we)return;const Fe=re?"replaceState":"pushState";window.history[Fe](null,"",we)},[h]);E.useEffect(()=>{let me=!1;return(async()=>{try{const K=await R.getBootstrap();if(me)return;O(K);const re=K.environments.map(Fe=>Fe.id),we=b&&re.includes(b)&&b||K.defaultEnvironment;we!==b&&(x(we),cp(r,we))}catch(K){me||ft(K instanceof Error?K.message:"Failed to load bootstrap")}})(),()=>{me=!0}},[R,b,r]),E.useEffect(()=>{if(!A||!b)return;let me=!1;return(async()=>{try{Kt(!0),ft(null);const K=await R.getCatalog();if(me)return;j(K);const re=v0(window.location.pathname,h,K),we=_M(re??Di(K),K);Nn.current=!0,q(we),nn(we,K,!0)}catch(K){me||(j(null),ft(K instanceof Error?K.message:"Failed to load catalog"))}finally{me||Kt(!1)}})(),()=>{me=!0}},[R,A,b,h,nn]),E.useEffect(()=>{if(!(!D||!z)){if(Nn.current){Nn.current=!1;return}nn(z,D,!1)}},[z,D,nn]),E.useEffect(()=>{const me=()=>{if(!D)return;const K=v0(window.location.pathname,h,D),re=_M(K??Di(D),D);Nn.current=!0,q(we=>sne(we,re)?we:re)};return window.addEventListener("popstate",me),()=>window.removeEventListener("popstate",me)},[D,h]),E.useEffect(()=>{if(!z||!D)return;let me=!1;return(async()=>{try{if(ft(null),z.kind==="overview"){U(!0);const K=await R.getMetrics({range:ue});me||(B(K),G(null),te(null),Y(null),Re(null),pe(null))}else if(z.kind==="gallery"){ve(!0);const K=await R.getGallery();me||(Y(K),G(null),te(null),B(null),Re(null),pe(null))}else if(z.kind==="fontLibrary"){Te(!0);const K=await R.getFonts();me||(Re(K),G(null),te(null),B(null),Y(null),pe(null))}else if(z.kind==="emails"){Ue(!0);const K=await R.getEmails();me||(pe(K),G(null),te(null),B(null),Y(null),Re(null))}else if(z.kind==="resource"){const K=await R.listResource(z.id);me||(G(K),te(null),B(null),Y(null),Re(null),pe(null))}else{const K=await R.getConfig(z.id);if(!me&&(te(K),G(null),B(null),Y(null),pe(null),D.fontLibrary)){Te(!0);try{const re=await R.getFonts();me||Re(re)}finally{me||Te(!1)}}}}catch(K){me||ft(K instanceof Error?K.message:"Failed to load panel")}finally{me||(U(!1),ve(!1),Te(!1),Ue(!1))}})(),()=>{me=!0}},[R,z,D,b,ue]);const br=E.useCallback(async()=>{if(z?.kind!=="resource")return;const me=await R.listResource(z.id);G(me)},[R,z]),Pr=E.useCallback(async()=>{U(!0);try{const me=await R.getMetrics({range:ue,fresh:!0});B(me)}finally{U(!1)}},[R,ue]),vr=E.useCallback(me=>{Se(me),cp(o,me)},[o]),qt=E.useCallback(async()=>{ve(!0);try{const me=await R.getGallery({fresh:!0});Y(me)}finally{ve(!1)}},[R]),si=E.useCallback(async()=>{Te(!0);try{const me=await R.getFonts({fresh:!0});Re(me)}finally{Te(!1)}},[R]),xr=E.useCallback(async()=>(await R.getFonts()).items,[R]),zr=E.useCallback(async()=>{Ue(!0);try{const me=await R.getEmails({fresh:!0});pe(me)}finally{Ue(!1)}},[R]),Fn=E.useCallback(async()=>(await R.getGallery()).items,[R]),ge=E.useCallback(async me=>{if(me.length===1&&me[0]){const{item:re}=await R.uploadGalleryFile(me[0]);return[re]}const{items:K}=await R.uploadGalleryFiles(me);return K},[R]),Ne=D?.gallery?{galleryUpload:{accept:D.gallery.accept,maxBytes:D.gallery.maxBytes},onListGallery:Fn,onUploadGallery:ge}:{},I=D?.fontLibrary?{fonts:Ae?.items??[],fontsLoading:Le,onListFonts:xr,onRefreshFonts:si}:{},P=D?.environments??A?.environments??[],H=P.find(me=>me.id===b),ie=!!H?.auth?.required,ae=z?.kind==="config"?D?.configs.find(me=>me.id===z.id):void 0,ye=ae?.section==="page",ke=!!ae?.previewPath,_e=me=>{if(me===b)return;const K=P.find(re=>re.id===me);K?.tone==="danger"&&!window.confirm(`Switch to ${K.label}? Writes will affect this environment.`)||(cp(r,me),x(me),G(null),te(null),Y(null),Re(null))},Be=()=>{const me=C.trim();k(me),me?cp(i,me):AM(i)},it=()=>{k(""),_(""),AM(i)},_t=E.useMemo(()=>{if(!D)return[];const me=[];D.metrics&&me.push({key:"overview",group:D.metrics.group??"Analytics",label:D.metrics.label,icon:ka("overview"),active:z?.kind==="overview",onSelect:()=>q({kind:"overview"})});for(const K of D.resources)me.push({key:`resource:${K.id}`,group:K.group??"Resources",label:K.label,icon:ka(`resource:${K.id}`),active:z?.kind==="resource"&&z.id===K.id,onSelect:()=>q({kind:"resource",id:K.id})});if(D.gallery&&me.push({key:"gallery",group:D.gallery.group??"Resources",label:D.gallery.label,icon:ka("gallery"),active:z?.kind==="gallery",onSelect:()=>q({kind:"gallery"})}),D.fontLibrary&&me.push({key:"fonts",group:D.fontLibrary.group??"Resources",label:D.fontLibrary.label,icon:ka("fonts"),active:z?.kind==="fontLibrary",onSelect:()=>q({kind:"fontLibrary"})}),D.emails){const K=z?.kind==="emails"?z.tab??"compose":null;me.push({key:"emails",group:D.emails.group??"Growth",label:D.emails.label,icon:ka("emails"),active:z?.kind==="emails",onSelect:()=>q({kind:"emails",tab:"compose"}),children:[{key:"emails:compose",label:"Compose",active:K==="compose",onSelect:()=>q({kind:"emails",tab:"compose"})},{key:"emails:templates",label:"Templates",active:K==="templates",onSelect:()=>q({kind:"emails",tab:"templates"})},{key:"emails:activity",label:"Activity",active:K==="activity",onSelect:()=>q({kind:"emails",tab:"activity"})}]})}for(const K of D.configs){const re=K.section==="page"?"Pages":"Config";me.push({key:`config:${K.id}`,group:K.group??re,label:K.label,icon:ka(`config:${K.id}`),active:z?.kind==="config"&&z.id===K.id,onSelect:()=>q({kind:"config",id:K.id})})}return one(me)},[D,z]);if(!A&&vt)return y.jsx("div",{className:"vertebr-loading",children:"Loading Vertebr…"});if(Ze&&!A)return y.jsx("div",{className:"vertebr-error",children:Ze});const xn=z?.kind==="overview"?D?.metrics?.label??"Overview":z?.kind==="gallery"?D?.gallery?.label??"Gallery":z?.kind==="fontLibrary"?D?.fontLibrary?.label??"Font Library":z?.kind==="emails"?D?.emails?.label??"Emails":z?.kind==="resource"?D?.resources.find(me=>me.id===z.id)?.label:z?.kind==="config"?D?.configs.find(me=>me.id===z.id)?.label:null;return y.jsx(pU,{children:y.jsx(mU,{children:y.jsxs("div",{className:"vertebr-root","data-env":b,"data-sidebar-collapsed":vn||void 0,children:[y.jsx(Jte,{brand:A?.brand??D?.brand??"Vertebr",envList:P,environment:b,onEnvironmentChange:_e,activeEnv:H,authUserLabel:u,onSignOut:f,getAccessToken:l,authRequired:ie,token:S,tokenDraft:C,onTokenDraftChange:_,onSaveToken:Be,onClearToken:it,theme:m,onThemeChange:g,sidebarCollapsed:vn,onToggleSidebar:()=>Zt(me=>!me)}),y.jsx(Fte,{navGroups:_t,collapsed:vn}),y.jsxs("main",{className:"vertebr-main",children:[y.jsx(Dte,{activeLabel:xn??(D?"Dashboard":"Sign in"),activeEnv:H,catalogLoaded:!!D,authRequired:ie,selection:z,isPageSelection:ye,hasPagePreview:ke,error:Ze,breadcrumbs:Qte(z,D)}),y.jsx(Nte,{client:R,catalog:D,selection:z,onSelectionChange:q,authRequired:ie,loading:vt,isPageSelection:ye,metricsData:fe,metricsLoading:L,metricsRange:ue,onMetricsRangeChange:vr,onRefreshMetrics:Pr,galleryData:V,galleryLoading:he,onRefreshGallery:qt,fontLibraryData:Ae,fontLibraryLoading:Le,onRefreshFonts:si,emailsData:oe,emailsLoading:Ie,onRefreshEmails:zr,resourceData:Z,onRefreshResource:br,configData:ee,onConfigSaved:te,galleryPicker:Ne,fontLibraryPicker:I}),y.jsx(Ite,{})]}),y.jsx(qte,{})]})})})}E.createContext(null);E.createContext(null);const w0="/admin/api";function lne(t){const e=t.environments.map(r=>r.auth?.client).find(r=>r?.provider==="firebase");if(!e)return null;const n=pB().length?UM():HM(e.config);return PV(n)}function cne(){const[t,e]=E.useState(null),[n,r]=E.useState(null),[i,s]=E.useState(null),[o,l]=E.useState(!1),[u,f]=E.useState("idle"),[h,m]=E.useState(""),[g,b]=E.useState(""),[x,S]=E.useState(null),[k,C]=E.useState(!1),_=E.useMemo(()=>R0({apiBase:w0,getEnvironment:()=>""}),[]);E.useEffect(()=>{let O=!1;return _.getBootstrap().then(D=>{if(O)return;e(D);const j=lne(D);r(j),j||l(!0)}).catch(D=>{O||(S(D instanceof Error?D.message:"Could not load auth"),l(!0))}),()=>{O=!0}},[_]),E.useEffect(()=>{if(n)return T3(n,O=>{s(O),f(O?"checking":"idle"),l(!0)})},[n]),E.useEffect(()=>{if(!t||!i)return;let O=!1;return(async()=>{f("checking");const D=localStorage.getItem("vertebr:env"),j=[...D?[D]:[],...t.environments.map(z=>z.id)].filter((z,q,Z)=>Z.indexOf(z)===q);for(const z of j)try{await R0({apiBase:w0,getEnvironment:()=>z,getAccessToken:()=>i.getIdToken()}).getCatalog(),O||(localStorage.setItem("vertebr:env",z),f("allowed"));return}catch{}O||f("denied")})(),()=>{O=!0}},[t,i]);const M=t?.environments.map(O=>O.auth?.client).find(O=>O?.provider==="firebase")?.methods??["email"],R=async O=>{if(O.preventDefault(),!!n){C(!0),S(null);try{await k3(n,h.trim(),g)}catch(D){S(D instanceof Error?D.message:"Sign-in failed")}finally{C(!1)}}},A=async()=>{if(n){C(!0),S(null);try{await G3(n,new vs)}catch(O){S(O instanceof Error?O.message:"Sign-in failed")}finally{C(!1)}}};return o?!n||!t?y.jsx("div",{className:"vertebr-error",children:x??"No browser auth provider is configured."}):i?u==="checking"||u==="idle"?y.jsx("div",{className:"vertebr-loading",children:"Checking admin access…"}):u==="denied"?y.jsx("main",{className:"vertebr-login",children:y.jsxs("section",{className:"vertebr-login-card",children:[y.jsxs("div",{className:"vertebr-brand",children:[y.jsx("strong",{children:t.brand}),y.jsx("span",{children:"Access denied"})]}),y.jsxs("div",{children:[y.jsx("h1",{children:"Administrator access required"}),y.jsxs("p",{children:["Signed in as ",i.email??i.uid,", but this account is not approved for any Vertebr environment."]})]}),y.jsx("button",{className:"vertebr-btn",type:"button",onClick:()=>{PT(n)},children:"Sign out"})]})}):y.jsx(ane,{apiBase:w0,title:"Owner control plane",getAccessToken:()=>i.getIdToken(),authUserLabel:i.email??i.uid,onSignOut:()=>PT(n)}):y.jsx("main",{className:"vertebr-login",children:y.jsxs("section",{className:"vertebr-login-card",children:[y.jsxs("div",{className:"vertebr-brand",children:[y.jsx("strong",{children:t.brand}),y.jsx("span",{children:"Admin access"})]}),y.jsxs("div",{children:[y.jsx("h1",{children:"Sign in"}),y.jsx("p",{children:"Use an approved administrator account. Storefront accounts do not receive dashboard access."})]}),M.includes("email")?y.jsxs("form",{className:"vertebr-login-form",onSubmit:R,children:[y.jsxs("label",{className:"vertebr-field",children:[y.jsx("span",{children:"Email"}),y.jsx("input",{type:"email",autoComplete:"username",required:!0,value:h,onChange:O=>m(O.target.value)})]}),y.jsxs("label",{className:"vertebr-field",children:[y.jsx("span",{children:"Password"}),y.jsx("input",{type:"password",autoComplete:"current-password",required:!0,value:g,onChange:O=>b(O.target.value)})]}),y.jsx("button",{className:"vertebr-btn vertebr-btn-primary",type:"submit",disabled:k,children:k?"Signing in…":"Sign in"})]}):null,M.includes("google")?y.jsx("button",{className:"vertebr-btn",type:"button",disabled:k,onClick:()=>{A()},children:"Continue with Google"}):null,x?y.jsx("p",{className:"vertebr-status","data-tone":"danger",children:x}):null]})}):y.jsx("div",{className:"vertebr-loading",children:"Checking admin session…"})}Gz.createRoot(document.getElementById("root")).render(y.jsx(E.StrictMode,{children:y.jsx(cne,{})}));