@vertebr/admin 0.18.0 → 0.19.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 (50) hide show
  1. package/dist/database/connector.d.ts.map +1 -1
  2. package/dist/database/connector.js +2 -1
  3. package/dist/database/connector.js.map +1 -1
  4. package/dist/database/types.d.ts +2 -0
  5. package/dist/database/types.d.ts.map +1 -1
  6. package/dist/index.d.ts +5 -4
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +6 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/runtime/api/catalog.d.ts +1 -0
  11. package/dist/runtime/api/catalog.d.ts.map +1 -1
  12. package/dist/runtime/api/catalog.js +3 -1
  13. package/dist/runtime/api/catalog.js.map +1 -1
  14. package/dist/runtime/connectors/payments/connector.d.ts.map +1 -1
  15. package/dist/runtime/connectors/payments/connector.js +186 -14
  16. package/dist/runtime/connectors/payments/connector.js.map +1 -1
  17. package/dist/runtime/connectors/payments/index.d.ts +1 -1
  18. package/dist/runtime/connectors/payments/index.d.ts.map +1 -1
  19. package/dist/runtime/connectors/payments/index.js.map +1 -1
  20. package/dist/runtime/connectors/payments/stripe.d.ts +40 -7
  21. package/dist/runtime/connectors/payments/stripe.d.ts.map +1 -1
  22. package/dist/runtime/connectors/payments/stripe.js +97 -2
  23. package/dist/runtime/connectors/payments/stripe.js.map +1 -1
  24. package/dist/runtime/connectors/payments/types.d.ts +26 -0
  25. package/dist/runtime/connectors/payments/types.d.ts.map +1 -1
  26. package/dist/runtime/connectors/payments/types.js.map +1 -1
  27. package/dist/runtime/services/audit.d.ts +2 -0
  28. package/dist/runtime/services/audit.d.ts.map +1 -1
  29. package/dist/runtime/services/audit.js +10 -1
  30. package/dist/runtime/services/audit.js.map +1 -1
  31. package/dist/runtime/types/audit.d.ts +33 -1
  32. package/dist/runtime/types/audit.d.ts.map +1 -1
  33. package/dist/runtime/types/audit.js +41 -0
  34. package/dist/runtime/types/audit.js.map +1 -1
  35. package/dist/runtime/types/auth.d.ts +2 -0
  36. package/dist/runtime/types/auth.d.ts.map +1 -1
  37. package/dist/runtime/types/events.d.ts +1 -0
  38. package/dist/runtime/types/events.d.ts.map +1 -1
  39. package/dist/runtime/types/index.d.ts +2 -1
  40. package/dist/runtime/types/index.d.ts.map +1 -1
  41. package/dist/runtime/types/index.js +4 -1
  42. package/dist/runtime/types/index.js.map +1 -1
  43. package/dist/schema.d.ts +28 -0
  44. package/dist/schema.d.ts.map +1 -1
  45. package/package.json +1 -1
  46. package/static/assets/index-CVOIcLQ2.js +340 -0
  47. package/static/assets/index-Dr5u3ikv.css +1 -0
  48. package/static/index.html +2 -2
  49. package/static/assets/index-6EkB-KyS.js +0 -340
  50. package/static/assets/index-BOeFzdnv.css +0 -1
@@ -0,0 +1,340 @@
1
+ var qN=t=>{throw TypeError(t)};var GN=(t,e,n)=>e.has(t)||qN("Cannot "+n);var cr=(t,e,n)=>(GN(t,e,"read from private field"),n?n.call(t):e.get(t)),YN=(t,e,n)=>e.has(t)?qN("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),g0=(t,e,n,r)=>(GN(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);function J3(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in t)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}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 s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function KO(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var y0={exports:{}},vd={};var KN;function Q3(){if(KN)return vd;KN=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,s,i){var o=null;if(i!==void 0&&(o=""+i),s.key!==void 0&&(o=""+s.key),"key"in s){i={};for(var l in s)l!=="key"&&(i[l]=s[l])}else i=s;return s=i.ref,{$$typeof:t,type:r,key:o,ref:s!==void 0?s:null,props:i}}return vd.Fragment=e,vd.jsx=n,vd.jsxs=n,vd}var ZN;function eF(){return ZN||(ZN=1,y0.exports=Q3()),y0.exports}var p=eF(),b0={exports:{}},it={};var XN;function tF(){if(XN)return it;XN=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),y=Symbol.iterator;function b(L){return L===null||typeof L!="object"?null:(L=y&&L[y]||L["@@iterator"],typeof L=="function"?L:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,k={};function E(L,q,ie){this.props=L,this.context=q,this.refs=k,this.updater=ie||v}E.prototype.isReactComponent={},E.prototype.setState=function(L,q){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,q,"setState")},E.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function M(){}M.prototype=E.prototype;function _(L,q,ie){this.props=L,this.context=q,this.refs=k,this.updater=ie||v}var N=_.prototype=new M;N.constructor=_,x(N,E.prototype),N.isPureReactComponent=!0;var T=Array.isArray;function A(){}var j={H:null,A:null,T:null,S:null},P=Object.prototype.hasOwnProperty;function O(L,q,ie){var de=ie.ref;return{$$typeof:t,type:L,key:q,ref:de!==void 0?de:null,props:ie}}function G(L,q){return O(L.type,q,L.props)}function B(L){return typeof L=="object"&&L!==null&&L.$$typeof===t}function W(L){var q={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(ie){return q[ie]})}var K=/\/+/g;function Q(L,q){return typeof L=="object"&&L!==null&&L.key!=null?W(""+L.key):q.toString(36)}function ee(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(A,A):(L.status="pending",L.then(function(q){L.status==="pending"&&(L.status="fulfilled",L.value=q)},function(q){L.status==="pending"&&(L.status="rejected",L.reason=q)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function F(L,q,ie,de,Te){var De=typeof L;(De==="undefined"||De==="boolean")&&(L=null);var je=!1;if(L===null)je=!0;else switch(De){case"bigint":case"string":case"number":je=!0;break;case"object":switch(L.$$typeof){case t:case e:je=!0;break;case h:return je=L._init,F(je(L._payload),q,ie,de,Te)}}if(je)return Te=Te(L),je=de===""?"."+Q(L,0):de,T(Te)?(ie="",je!=null&&(ie=je.replace(K,"$&/")+"/"),F(Te,q,ie,"",function(ye){return ye})):Te!=null&&(B(Te)&&(Te=G(Te,ie+(Te.key==null||L&&L.key===Te.key?"":(""+Te.key).replace(K,"$&/")+"/")+je)),q.push(Te)),1;je=0;var Ne=de===""?".":de+":";if(T(L))for(var oe=0;oe<L.length;oe++)de=L[oe],De=Ne+Q(de,oe),je+=F(de,q,ie,De,Te);else if(oe=b(L),typeof oe=="function")for(L=oe.call(L),oe=0;!(de=L.next()).done;)de=de.value,De=Ne+Q(de,oe++),je+=F(de,q,ie,De,Te);else if(De==="object"){if(typeof L.then=="function")return F(ee(L),q,ie,de,Te);throw q=String(L),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return je}function I(L,q,ie){if(L==null)return L;var de=[],Te=0;return F(L,de,"","",function(De){return q.call(ie,De,Te++)}),de}function z(L){if(L._status===-1){var q=L._result;q=q(),q.then(function(ie){(L._status===0||L._status===-1)&&(L._status=1,L._result=ie)},function(ie){(L._status===0||L._status===-1)&&(L._status=2,L._result=ie)}),L._status===-1&&(L._status=0,L._result=q)}if(L._status===1)return L._result.default;throw L._result}var J=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},X={map:I,forEach:function(L,q,ie){I(L,function(){q.apply(this,arguments)},ie)},count:function(L){var q=0;return I(L,function(){q++}),q},toArray:function(L){return I(L,function(q){return q})||[]},only:function(L){if(!B(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return it.Activity=m,it.Children=X,it.Component=E,it.Fragment=n,it.Profiler=s,it.PureComponent=_,it.StrictMode=r,it.Suspense=u,it.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,it.__COMPILER_RUNTIME={__proto__:null,c:function(L){return j.H.useMemoCache(L)}},it.cache=function(L){return function(){return L.apply(null,arguments)}},it.cacheSignal=function(){return null},it.cloneElement=function(L,q,ie){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var de=x({},L.props),Te=L.key;if(q!=null)for(De in q.key!==void 0&&(Te=""+q.key),q)!P.call(q,De)||De==="key"||De==="__self"||De==="__source"||De==="ref"&&q.ref===void 0||(de[De]=q[De]);var De=arguments.length-2;if(De===1)de.children=ie;else if(1<De){for(var je=Array(De),Ne=0;Ne<De;Ne++)je[Ne]=arguments[Ne+2];de.children=je}return O(L.type,Te,de)},it.createContext=function(L){return L={$$typeof:o,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:i,_context:L},L},it.createElement=function(L,q,ie){var de,Te={},De=null;if(q!=null)for(de in q.key!==void 0&&(De=""+q.key),q)P.call(q,de)&&de!=="key"&&de!=="__self"&&de!=="__source"&&(Te[de]=q[de]);var je=arguments.length-2;if(je===1)Te.children=ie;else if(1<je){for(var Ne=Array(je),oe=0;oe<je;oe++)Ne[oe]=arguments[oe+2];Te.children=Ne}if(L&&L.defaultProps)for(de in je=L.defaultProps,je)Te[de]===void 0&&(Te[de]=je[de]);return O(L,De,Te)},it.createRef=function(){return{current:null}},it.forwardRef=function(L){return{$$typeof:l,render:L}},it.isValidElement=B,it.lazy=function(L){return{$$typeof:h,_payload:{_status:-1,_result:L},_init:z}},it.memo=function(L,q){return{$$typeof:d,type:L,compare:q===void 0?null:q}},it.startTransition=function(L){var q=j.T,ie={};j.T=ie;try{var de=L(),Te=j.S;Te!==null&&Te(ie,de),typeof de=="object"&&de!==null&&typeof de.then=="function"&&de.then(A,J)}catch(De){J(De)}finally{q!==null&&ie.types!==null&&(q.types=ie.types),j.T=q}},it.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},it.use=function(L){return j.H.use(L)},it.useActionState=function(L,q,ie){return j.H.useActionState(L,q,ie)},it.useCallback=function(L,q){return j.H.useCallback(L,q)},it.useContext=function(L){return j.H.useContext(L)},it.useDebugValue=function(){},it.useDeferredValue=function(L,q){return j.H.useDeferredValue(L,q)},it.useEffect=function(L,q){return j.H.useEffect(L,q)},it.useEffectEvent=function(L){return j.H.useEffectEvent(L)},it.useId=function(){return j.H.useId()},it.useImperativeHandle=function(L,q,ie){return j.H.useImperativeHandle(L,q,ie)},it.useInsertionEffect=function(L,q){return j.H.useInsertionEffect(L,q)},it.useLayoutEffect=function(L,q){return j.H.useLayoutEffect(L,q)},it.useMemo=function(L,q){return j.H.useMemo(L,q)},it.useOptimistic=function(L,q){return j.H.useOptimistic(L,q)},it.useReducer=function(L,q,ie){return j.H.useReducer(L,q,ie)},it.useRef=function(L){return j.H.useRef(L)},it.useState=function(L){return j.H.useState(L)},it.useSyncExternalStore=function(L,q,ie){return j.H.useSyncExternalStore(L,q,ie)},it.useTransition=function(){return j.H.useTransition()},it.version="19.2.8",it}var JN;function Hf(){return JN||(JN=1,b0.exports=tF()),b0.exports}var C=Hf();const fe=KO(C),Uf=J3({__proto__:null,default:fe},[C]);var v0={exports:{}},wd={},w0={exports:{}},x0={};var QN;function nF(){return QN||(QN=1,(function(t){function e(F,I){var z=F.length;F.push(I);e:for(;0<z;){var J=z-1>>>1,X=F[J];if(0<s(X,I))F[J]=I,F[z]=X,z=J;else break e}}function n(F){return F.length===0?null:F[0]}function r(F){if(F.length===0)return null;var I=F[0],z=F.pop();if(z!==I){F[0]=z;e:for(var J=0,X=F.length,L=X>>>1;J<L;){var q=2*(J+1)-1,ie=F[q],de=q+1,Te=F[de];if(0>s(ie,z))de<X&&0>s(Te,ie)?(F[J]=Te,F[de]=z,J=de):(F[J]=ie,F[q]=z,J=q);else if(de<X&&0>s(Te,z))F[J]=Te,F[de]=z,J=de;else break e}}return I}function s(F,I){var z=F.sortIndex-I.sortIndex;return z!==0?z:F.id-I.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var u=[],d=[],h=1,m=null,y=3,b=!1,v=!1,x=!1,k=!1,E=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function N(F){for(var I=n(d);I!==null;){if(I.callback===null)r(d);else if(I.startTime<=F)r(d),I.sortIndex=I.expirationTime,e(u,I);else break;I=n(d)}}function T(F){if(x=!1,N(F),!v)if(n(u)!==null)v=!0,A||(A=!0,W());else{var I=n(d);I!==null&&ee(T,I.startTime-F)}}var A=!1,j=-1,P=5,O=-1;function G(){return k?!0:!(t.unstable_now()-O<P)}function B(){if(k=!1,A){var F=t.unstable_now();O=F;var I=!0;try{e:{v=!1,x&&(x=!1,M(j),j=-1),b=!0;var z=y;try{t:{for(N(F),m=n(u);m!==null&&!(m.expirationTime>F&&G());){var J=m.callback;if(typeof J=="function"){m.callback=null,y=m.priorityLevel;var X=J(m.expirationTime<=F);if(F=t.unstable_now(),typeof X=="function"){m.callback=X,N(F),I=!0;break t}m===n(u)&&r(u),N(F)}else r(u);m=n(u)}if(m!==null)I=!0;else{var L=n(d);L!==null&&ee(T,L.startTime-F),I=!1}}break e}finally{m=null,y=z,b=!1}I=void 0}}finally{I?W():A=!1}}}var W;if(typeof _=="function")W=function(){_(B)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,Q=K.port2;K.port1.onmessage=B,W=function(){Q.postMessage(null)}}else W=function(){E(B,0)};function ee(F,I){j=E(function(){F(t.unstable_now())},I)}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(F){F.callback=null},t.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<F?Math.floor(1e3/F):5},t.unstable_getCurrentPriorityLevel=function(){return y},t.unstable_next=function(F){switch(y){case 1:case 2:case 3:var I=3;break;default:I=y}var z=y;y=I;try{return F()}finally{y=z}},t.unstable_requestPaint=function(){k=!0},t.unstable_runWithPriority=function(F,I){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var z=y;y=F;try{return I()}finally{y=z}},t.unstable_scheduleCallback=function(F,I,z){var J=t.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?J+z:J):z=J,F){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=z+X,F={id:h++,callback:I,priorityLevel:F,startTime:z,expirationTime:X,sortIndex:-1},z>J?(F.sortIndex=z,e(d,F),n(u)===null&&F===n(d)&&(x?(M(j),j=-1):x=!0,ee(T,z-J))):(F.sortIndex=X,e(u,F),v||b||(v=!0,A||(A=!0,W()))),F},t.unstable_shouldYield=G,t.unstable_wrapCallback=function(F){var I=y;return function(){var z=y;y=I;try{return F.apply(this,arguments)}finally{y=z}}}})(x0)),x0}var eM;function rF(){return eM||(eM=1,w0.exports=nF()),w0.exports}var S0={exports:{}},ur={};var tM;function sF(){if(tM)return ur;tM=1;var t=Hf();function e(u){var d="https://react.dev/errors/"+u;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)d+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+u+"; visit "+d+" 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},s=Symbol.for("react.portal");function i(u,d,h){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:m==null?null:""+m,children:u,containerInfo:d,implementation:h}}var o=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(u,d){if(u==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return ur.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,ur.createPortal=function(u,d){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(e(299));return i(u,d,null,h)},ur.flushSync=function(u){var d=o.T,h=r.p;try{if(o.T=null,r.p=2,u)return u()}finally{o.T=d,r.p=h,r.d.f()}},ur.preconnect=function(u,d){typeof u=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,r.d.C(u,d))},ur.prefetchDNS=function(u){typeof u=="string"&&r.d.D(u)},ur.preinit=function(u,d){if(typeof u=="string"&&d&&typeof d.as=="string"){var h=d.as,m=l(h,d.crossOrigin),y=typeof d.integrity=="string"?d.integrity:void 0,b=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;h==="style"?r.d.S(u,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:m,integrity:y,fetchPriority:b}):h==="script"&&r.d.X(u,{crossOrigin:m,integrity:y,fetchPriority:b,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},ur.preinitModule=function(u,d){if(typeof u=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var h=l(d.as,d.crossOrigin);r.d.M(u,{crossOrigin:h,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&r.d.M(u)},ur.preload=function(u,d){if(typeof u=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var h=d.as,m=l(h,d.crossOrigin);r.d.L(u,h,{crossOrigin:m,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},ur.preloadModule=function(u,d){if(typeof u=="string")if(d){var h=l(d.as,d.crossOrigin);r.d.m(u,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:h,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else r.d.m(u)},ur.requestFormReset=function(u){r.d.r(u)},ur.unstable_batchedUpdates=function(u,d){return u(d)},ur.useFormState=function(u,d,h){return o.H.useFormState(u,d,h)},ur.useFormStatus=function(){return o.H.useHostTransitionStatus()},ur.version="19.2.8",ur}var nM;function ZO(){if(nM)return S0.exports;nM=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(),S0.exports=sF(),S0.exports}var rM;function iF(){if(rM)return wd;rM=1;var t=rF(),e=Hf(),n=ZO();function r(a){var c="https://react.dev/errors/"+a;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)c+="&args[]="+encodeURIComponent(arguments[f])}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 s(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function i(a){var c=a,f=a;if(a.alternate)for(;c.return;)c=c.return;else{a=c;do c=a,(c.flags&4098)!==0&&(f=c.return),a=c.return;while(a)}return c.tag===3?f: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(i(a)!==a)throw Error(r(188))}function d(a){var c=a.alternate;if(!c){if(c=i(a),c===null)throw Error(r(188));return c!==a?null:a}for(var f=a,g=c;;){var w=f.return;if(w===null)break;var S=w.alternate;if(S===null){if(g=w.return,g!==null){f=g;continue}break}if(w.child===S.child){for(S=w.child;S;){if(S===f)return u(w),a;if(S===g)return u(w),c;S=S.sibling}throw Error(r(188))}if(f.return!==g.return)f=w,g=S;else{for(var R=!1,D=w.child;D;){if(D===f){R=!0,f=w,g=S;break}if(D===g){R=!0,g=w,f=S;break}D=D.sibling}if(!R){for(D=S.child;D;){if(D===f){R=!0,f=S,g=w;break}if(D===g){R=!0,g=S,f=w;break}D=D.sibling}if(!R)throw Error(r(189))}}if(f.alternate!==g)throw Error(r(190))}if(f.tag!==3)throw Error(r(188));return f.stateNode.current===f?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,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),_=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),G=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function W(a){return a===null||typeof a!="object"?null:(a=B&&a[B]||a["@@iterator"],typeof a=="function"?a:null)}var K=Symbol.for("react.client.reference");function Q(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===K?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case x:return"Fragment";case E:return"Profiler";case k:return"StrictMode";case T:return"Suspense";case A:return"SuspenseList";case O:return"Activity"}if(typeof a=="object")switch(a.$$typeof){case v:return"Portal";case _:return a.displayName||"Context";case M:return(a._context.displayName||"Context")+".Consumer";case N:var c=a.render;return a=a.displayName,a||(a=c.displayName||c.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case j:return c=a.displayName||null,c!==null?c:Q(a.type)||"Memo";case P:c=a._payload,a=a._init;try{return Q(a(c))}catch{}}return null}var ee=Array.isArray,F=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z={pending:!1,data:null,method:null,action:null},J=[],X=-1;function L(a){return{current:a}}function q(a){0>X||(a.current=J[X],J[X]=null,X--)}function ie(a,c){X++,J[X]=a.current,a.current=c}var de=L(null),Te=L(null),De=L(null),je=L(null);function Ne(a,c){switch(ie(De,c),ie(Te,a),ie(de,null),c.nodeType){case 9:case 11:a=(a=c.documentElement)&&(a=a.namespaceURI)?mN(a):0;break;default:if(a=c.tagName,c=c.namespaceURI)c=mN(c),a=gN(c,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}q(de),ie(de,a)}function oe(){q(de),q(Te),q(De)}function ye(a){a.memoizedState!==null&&ie(je,a);var c=de.current,f=gN(c,a.type);c!==f&&(ie(Te,a),ie(de,f))}function Pe(a){Te.current===a&&(q(de),q(Te)),je.current===a&&(q(je),md._currentValue=z)}var Ye,Ke;function ut(a){if(Ye===void 0)try{throw Error()}catch(f){var c=f.stack.trim().match(/\n( *(at )?)/);Ye=c&&c[1]||"",Ke=-1<f.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<f.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+Ye+a+Ke}var Xe=!1;function Vt(a,c){if(!a||Xe)return"";Xe=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var g={DetermineComponentFrameRoot:function(){try{if(c){var me=function(){throw Error()};if(Object.defineProperty(me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(me,[])}catch(se){var re=se}Reflect.construct(a,[],me)}else{try{me.call()}catch(se){re=se}a.call(me.prototype)}}else{try{throw Error()}catch(se){re=se}(me=a())&&typeof me.catch=="function"&&me.catch(function(){})}}catch(se){if(se&&re&&typeof se.stack=="string")return[se.stack,re.stack]}return[null,null]}};g.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var w=Object.getOwnPropertyDescriptor(g.DetermineComponentFrameRoot,"name");w&&w.configurable&&Object.defineProperty(g.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var S=g.DetermineComponentFrameRoot(),R=S[0],D=S[1];if(R&&D){var H=R.split(`
4
+ `),ne=D.split(`
5
+ `);for(w=g=0;g<H.length&&!H[g].includes("DetermineComponentFrameRoot");)g++;for(;w<ne.length&&!ne[w].includes("DetermineComponentFrameRoot");)w++;if(g===H.length||w===ne.length)for(g=H.length-1,w=ne.length-1;1<=g&&0<=w&&H[g]!==ne[w];)w--;for(;1<=g&&0<=w;g--,w--)if(H[g]!==ne[w]){if(g!==1||w!==1)do if(g--,w--,0>w||H[g]!==ne[w]){var le=`
6
+ `+H[g].replace(" at new "," at ");return a.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",a.displayName)),le}while(1<=g&&0<=w);break}}}finally{Xe=!1,Error.prepareStackTrace=f}return(f=a?a.displayName||a.name:"")?ut(f):""}function un(a,c){switch(a.tag){case 26:case 27:case 5:return ut(a.type);case 16:return ut("Lazy");case 13:return a.child!==c&&c!==null?ut("Suspense Fallback"):ut("Suspense");case 19:return ut("SuspenseList");case 0:case 15:return Vt(a.type,!1);case 11:return Vt(a.type.render,!1);case 1:return Vt(a.type,!0);case 31:return ut("Activity");default:return""}}function qt(a){try{var c="",f=null;do c+=un(a,f),f=a,a=a.return;while(a);return c}catch(g){return`
7
+ Error generating stack: `+g.message+`
8
+ `+g.stack}}var kn=Object.prototype.hasOwnProperty,dn=t.unstable_scheduleCallback,In=t.unstable_cancelCallback,Ln=t.unstable_shouldYield,Yn=t.unstable_requestPaint,ht=t.unstable_now,Bn=t.unstable_getCurrentPriorityLevel,lr=t.unstable_ImmediatePriority,vr=t.unstable_UserBlockingPriority,Pn=t.unstable_NormalPriority,xe=t.unstable_LowPriority,$e=t.unstable_IdlePriority,$=t.log,V=t.unstable_setDisableYieldValue,U=null,ae=null;function ce(a){if(typeof $=="function"&&V(a),ae&&typeof ae.setStrictMode=="function")try{ae.setStrictMode(U,a)}catch{}}var be=Math.clz32?Math.clz32:ve,Ce=Math.log,Ae=Math.LN2;function ve(a){return a>>>=0,a===0?32:31-(Ce(a)/Ae|0)|0}var Ie=256,Re=262144,Qe=4194304;function gt(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 Ze(a,c,f){var g=a.pendingLanes;if(g===0)return 0;var w=0,S=a.suspendedLanes,R=a.pingedLanes;a=a.warmLanes;var D=g&134217727;return D!==0?(g=D&~S,g!==0?w=gt(g):(R&=D,R!==0?w=gt(R):f||(f=D&~a,f!==0&&(w=gt(f))))):(D=g&~S,D!==0?w=gt(D):R!==0?w=gt(R):f||(f=g&~a,f!==0&&(w=gt(f)))),w===0?0:c!==0&&c!==w&&(c&S)===0&&(S=w&-w,f=c&-c,S>=f||S===32&&(f&4194048)!==0)?c:w}function _r(a,c){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&c)===0}function Vr(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 wr(){var a=Qe;return Qe<<=1,(Qe&62914560)===0&&(Qe=4194304),a}function Kn(a){for(var c=[],f=0;31>f;f++)c.push(a);return c}function Zn(a,c){a.pendingLanes|=c,c!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function ph(a,c,f,g,w,S){var R=a.pendingLanes;a.pendingLanes=f,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=f,a.entangledLanes&=f,a.errorRecoveryDisabledLanes&=f,a.shellSuspendCounter=0;var D=a.entanglements,H=a.expirationTimes,ne=a.hiddenUpdates;for(f=R&~f;0<f;){var le=31-be(f),me=1<<le;D[le]=0,H[le]=-1;var re=ne[le];if(re!==null)for(ne[le]=null,le=0;le<re.length;le++){var se=re[le];se!==null&&(se.lane&=-536870913)}f&=~me}g!==0&&So(a,g,0),S!==0&&w===0&&a.tag!==0&&(a.suspendedLanes|=S&~(R&~c))}function So(a,c,f){a.pendingLanes|=c,a.suspendedLanes&=~c;var g=31-be(c);a.entangledLanes|=c,a.entanglements[g]=a.entanglements[g]|1073741824|f&261930}function Va(a,c){var f=a.entangledLanes|=c;for(a=a.entanglements;f;){var g=31-be(f),w=1<<g;w&c|a[g]&c&&(a[g]|=c),f&=~w}}function Rs(a,c){var f=c&-c;return f=(f&42)!==0?1:Ha(f),(f&(a.suspendedLanes|c))!==0?0:f}function Ha(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 Ua(a){return a&=-a,2<a?8<a?(a&134217727)!==0?32:268435456:8:2}function Wa(){var a=I.p;return a!==0?a:(a=window.event,a===void 0?32:zN(a.type))}function ko(a,c){var f=I.p;try{return I.p=a,c()}finally{I.p=f}}var Hr=Math.random().toString(36).slice(2),bn="__reactFiber$"+Hr,Cn="__reactProps$"+Hr,us="__reactContainer$"+Hr,we="__reactEvents$"+Hr,Se="__reactListeners$"+Hr,sn="__reactHandles$"+Hr,vn="__reactResources$"+Hr,Ar="__reactMarker$"+Hr;function pe(a){delete a[bn],delete a[Cn],delete a[we],delete a[Se],delete a[sn]}function ue(a){var c=a[bn];if(c)return c;for(var f=a.parentNode;f;){if(c=f[us]||f[bn]){if(f=c.alternate,c.child!==null||f!==null&&f.child!==null)for(a=kN(a);a!==null;){if(f=a[bn])return f;a=kN(a)}return c}a=f,f=a.parentNode}return null}function _e(a){if(a=a[bn]||a[us]){var c=a.tag;if(c===5||c===6||c===13||c===31||c===26||c===27||c===3)return a}return null}function Je(a){var c=a.tag;if(c===5||c===26||c===27||c===6)return a.stateNode;throw Error(r(33))}function kt(a){var c=a[vn];return c||(c=a[vn]={hoistableStyles:new Map,hoistableScripts:new Map}),c}function yt(a){a[Ar]=!0}var Ur=new Set,Rr={};function Os(a,c){ki(a,c),ki(a+"Capture",c)}function ki(a,c){for(Rr[a]=c,a=0;a<c.length;a++)Ur.add(c[a])}var Ru=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]*$"),i1={},o1={};function Uz(a){return kn.call(o1,a)?!0:kn.call(i1,a)?!1:Ru.test(a)?o1[a]=!0:(i1[a]=!0,!1)}function mh(a,c,f){if(Uz(c))if(f===null)a.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":a.removeAttribute(c);return;case"boolean":var g=c.toLowerCase().slice(0,5);if(g!=="data-"&&g!=="aria-"){a.removeAttribute(c);return}}a.setAttribute(c,""+f)}}function gh(a,c,f){if(f===null)a.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(c);return}a.setAttribute(c,""+f)}}function Ci(a,c,f,g){if(g===null)a.removeAttribute(f);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(f);return}a.setAttributeNS(c,f,""+g)}}function ds(a){switch(typeof a){case"bigint":case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function a1(a){var c=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function Wz(a,c,f){var g=Object.getOwnPropertyDescriptor(a.constructor.prototype,c);if(!a.hasOwnProperty(c)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var w=g.get,S=g.set;return Object.defineProperty(a,c,{configurable:!0,get:function(){return w.call(this)},set:function(R){f=""+R,S.call(this,R)}}),Object.defineProperty(a,c,{enumerable:g.enumerable}),{getValue:function(){return f},setValue:function(R){f=""+R},stopTracking:function(){a._valueTracker=null,delete a[c]}}}}function cb(a){if(!a._valueTracker){var c=a1(a)?"checked":"value";a._valueTracker=Wz(a,c,""+a[c])}}function l1(a){if(!a)return!1;var c=a._valueTracker;if(!c)return!0;var f=c.getValue(),g="";return a&&(g=a1(a)?a.checked?"true":"false":a.value),a=g,a!==f?(c.setValue(a),!0):!1}function yh(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 qz=/[\n"\\]/g;function fs(a){return a.replace(qz,function(c){return"\\"+c.charCodeAt(0).toString(16)+" "})}function ub(a,c,f,g,w,S,R,D){a.name="",R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?a.type=R:a.removeAttribute("type"),c!=null?R==="number"?(c===0&&a.value===""||a.value!=c)&&(a.value=""+ds(c)):a.value!==""+ds(c)&&(a.value=""+ds(c)):R!=="submit"&&R!=="reset"||a.removeAttribute("value"),c!=null?db(a,R,ds(c)):f!=null?db(a,R,ds(f)):g!=null&&a.removeAttribute("value"),w==null&&S!=null&&(a.defaultChecked=!!S),w!=null&&(a.checked=w&&typeof w!="function"&&typeof w!="symbol"),D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?a.name=""+ds(D):a.removeAttribute("name")}function c1(a,c,f,g,w,S,R,D){if(S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(a.type=S),c!=null||f!=null){if(!(S!=="submit"&&S!=="reset"||c!=null)){cb(a);return}f=f!=null?""+ds(f):"",c=c!=null?""+ds(c):f,D||c===a.value||(a.value=c),a.defaultValue=c}g=g??w,g=typeof g!="function"&&typeof g!="symbol"&&!!g,a.checked=D?a.checked:!!g,a.defaultChecked=!!g,R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"&&(a.name=R),cb(a)}function db(a,c,f){c==="number"&&yh(a.ownerDocument)===a||a.defaultValue===""+f||(a.defaultValue=""+f)}function Kl(a,c,f,g){if(a=a.options,c){c={};for(var w=0;w<f.length;w++)c["$"+f[w]]=!0;for(f=0;f<a.length;f++)w=c.hasOwnProperty("$"+a[f].value),a[f].selected!==w&&(a[f].selected=w),w&&g&&(a[f].defaultSelected=!0)}else{for(f=""+ds(f),c=null,w=0;w<a.length;w++){if(a[w].value===f){a[w].selected=!0,g&&(a[w].defaultSelected=!0);return}c!==null||a[w].disabled||(c=a[w])}c!==null&&(c.selected=!0)}}function u1(a,c,f){if(c!=null&&(c=""+ds(c),c!==a.value&&(a.value=c),f==null)){a.defaultValue!==c&&(a.defaultValue=c);return}a.defaultValue=f!=null?""+ds(f):""}function d1(a,c,f,g){if(c==null){if(g!=null){if(f!=null)throw Error(r(92));if(ee(g)){if(1<g.length)throw Error(r(93));g=g[0]}f=g}f==null&&(f=""),c=f}f=ds(c),a.defaultValue=f,g=a.textContent,g===f&&g!==""&&g!==null&&(a.value=g),cb(a)}function Zl(a,c){if(c){var f=a.firstChild;if(f&&f===a.lastChild&&f.nodeType===3){f.nodeValue=c;return}}a.textContent=c}var Gz=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 f1(a,c,f){var g=c.indexOf("--")===0;f==null||typeof f=="boolean"||f===""?g?a.setProperty(c,""):c==="float"?a.cssFloat="":a[c]="":g?a.setProperty(c,f):typeof f!="number"||f===0||Gz.has(c)?c==="float"?a.cssFloat=f:a[c]=(""+f).trim():a[c]=f+"px"}function h1(a,c,f){if(c!=null&&typeof c!="object")throw Error(r(62));if(a=a.style,f!=null){for(var g in f)!f.hasOwnProperty(g)||c!=null&&c.hasOwnProperty(g)||(g.indexOf("--")===0?a.setProperty(g,""):g==="float"?a.cssFloat="":a[g]="");for(var w in c)g=c[w],c.hasOwnProperty(w)&&f[w]!==g&&f1(a,w,g)}else for(var S in c)c.hasOwnProperty(S)&&f1(a,S,c[S])}function fb(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 Yz=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"]]),Kz=/^[\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 bh(a){return Kz.test(""+a)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":a}function Ei(){}var hb=null;function pb(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var Xl=null,Jl=null;function p1(a){var c=_e(a);if(c&&(a=c.stateNode)){var f=a[Cn]||null;e:switch(a=c.stateNode,c.type){case"input":if(ub(a,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name),c=f.name,f.type==="radio"&&c!=null){for(f=a;f.parentNode;)f=f.parentNode;for(f=f.querySelectorAll('input[name="'+fs(""+c)+'"][type="radio"]'),c=0;c<f.length;c++){var g=f[c];if(g!==a&&g.form===a.form){var w=g[Cn]||null;if(!w)throw Error(r(90));ub(g,w.value,w.defaultValue,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name)}}for(c=0;c<f.length;c++)g=f[c],g.form===a.form&&l1(g)}break e;case"textarea":u1(a,f.value,f.defaultValue);break e;case"select":c=f.value,c!=null&&Kl(a,!!f.multiple,c,!1)}}}var mb=!1;function m1(a,c,f){if(mb)return a(c,f);mb=!0;try{var g=a(c);return g}finally{if(mb=!1,(Xl!==null||Jl!==null)&&(ip(),Xl&&(c=Xl,a=Jl,Jl=Xl=null,p1(c),a)))for(c=0;c<a.length;c++)p1(a[c])}}function Ou(a,c){var f=a.stateNode;if(f===null)return null;var g=f[Cn]||null;if(g===null)return null;f=g[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":(g=!g.disabled)||(a=a.type,g=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!g;break e;default:a=!1}if(a)return null;if(f&&typeof f!="function")throw Error(r(231,c,typeof f));return f}var Ti=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gb=!1;if(Ti)try{var ju={};Object.defineProperty(ju,"passive",{get:function(){gb=!0}}),window.addEventListener("test",ju,ju),window.removeEventListener("test",ju,ju)}catch{gb=!1}var Co=null,yb=null,vh=null;function g1(){if(vh)return vh;var a,c=yb,f=c.length,g,w="value"in Co?Co.value:Co.textContent,S=w.length;for(a=0;a<f&&c[a]===w[a];a++);var R=f-a;for(g=1;g<=R&&c[f-g]===w[S-g];g++);return vh=w.slice(a,1<g?1-g:void 0)}function wh(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 xh(){return!0}function y1(){return!1}function Or(a){function c(f,g,w,S,R){this._reactName=f,this._targetInst=w,this.type=g,this.nativeEvent=S,this.target=R,this.currentTarget=null;for(var D in a)a.hasOwnProperty(D)&&(f=a[D],this[D]=f?f(S):S[D]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?xh:y1,this.isPropagationStopped=y1,this}return m(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var f=this.nativeEvent;f&&(f.preventDefault?f.preventDefault():typeof f.returnValue!="unknown"&&(f.returnValue=!1),this.isDefaultPrevented=xh)},stopPropagation:function(){var f=this.nativeEvent;f&&(f.stopPropagation?f.stopPropagation():typeof f.cancelBubble!="unknown"&&(f.cancelBubble=!0),this.isPropagationStopped=xh)},persist:function(){},isPersistent:xh}),c}var qa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Sh=Or(qa),Du=m({},qa,{view:0,detail:0}),Zz=Or(Du),bb,vb,Iu,kh=m({},Du,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xb,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!==Iu&&(Iu&&a.type==="mousemove"?(bb=a.screenX-Iu.screenX,vb=a.screenY-Iu.screenY):vb=bb=0,Iu=a),bb)},movementY:function(a){return"movementY"in a?a.movementY:vb}}),b1=Or(kh),Xz=m({},kh,{dataTransfer:0}),Jz=Or(Xz),Qz=m({},Du,{relatedTarget:0}),wb=Or(Qz),eB=m({},qa,{animationName:0,elapsedTime:0,pseudoElement:0}),tB=Or(eB),nB=m({},qa,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),rB=Or(nB),sB=m({},qa,{data:0}),v1=Or(sB),iB={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},oB={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"},aB={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function lB(a){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(a):(a=aB[a])?!!c[a]:!1}function xb(){return lB}var cB=m({},Du,{key:function(a){if(a.key){var c=iB[a.key]||a.key;if(c!=="Unidentified")return c}return a.type==="keypress"?(a=wh(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?oB[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xb,charCode:function(a){return a.type==="keypress"?wh(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?wh(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),uB=Or(cB),dB=m({},kh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),w1=Or(dB),fB=m({},Du,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xb}),hB=Or(fB),pB=m({},qa,{propertyName:0,elapsedTime:0,pseudoElement:0}),mB=Or(pB),gB=m({},kh,{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}),yB=Or(gB),bB=m({},qa,{newState:0,oldState:0}),vB=Or(bB),wB=[9,13,27,32],Sb=Ti&&"CompositionEvent"in window,Lu=null;Ti&&"documentMode"in document&&(Lu=document.documentMode);var xB=Ti&&"TextEvent"in window&&!Lu,x1=Ti&&(!Sb||Lu&&8<Lu&&11>=Lu),S1=" ",k1=!1;function C1(a,c){switch(a){case"keyup":return wB.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function E1(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Ql=!1;function SB(a,c){switch(a){case"compositionend":return E1(c);case"keypress":return c.which!==32?null:(k1=!0,S1);case"textInput":return a=c.data,a===S1&&k1?null:a;default:return null}}function kB(a,c){if(Ql)return a==="compositionend"||!Sb&&C1(a,c)?(a=g1(),vh=yb=Co=null,Ql=!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 x1&&c.locale!=="ko"?null:c.data;default:return null}}var CB={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 T1(a){var c=a&&a.nodeName&&a.nodeName.toLowerCase();return c==="input"?!!CB[a.type]:c==="textarea"}function N1(a,c,f,g){Xl?Jl?Jl.push(g):Jl=[g]:Xl=g,c=fp(c,"onChange"),0<c.length&&(f=new Sh("onChange","change",null,f,g),a.push({event:f,listeners:c}))}var Pu=null,$u=null;function EB(a){cN(a,0)}function Ch(a){var c=Je(a);if(l1(c))return a}function M1(a,c){if(a==="change")return c}var _1=!1;if(Ti){var kb;if(Ti){var Cb="oninput"in document;if(!Cb){var A1=document.createElement("div");A1.setAttribute("oninput","return;"),Cb=typeof A1.oninput=="function"}kb=Cb}else kb=!1;_1=kb&&(!document.documentMode||9<document.documentMode)}function R1(){Pu&&(Pu.detachEvent("onpropertychange",O1),$u=Pu=null)}function O1(a){if(a.propertyName==="value"&&Ch($u)){var c=[];N1(c,$u,a,pb(a)),m1(EB,c)}}function TB(a,c,f){a==="focusin"?(R1(),Pu=c,$u=f,Pu.attachEvent("onpropertychange",O1)):a==="focusout"&&R1()}function NB(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return Ch($u)}function MB(a,c){if(a==="click")return Ch(c)}function _B(a,c){if(a==="input"||a==="change")return Ch(c)}function AB(a,c){return a===c&&(a!==0||1/a===1/c)||a!==a&&c!==c}var Wr=typeof Object.is=="function"?Object.is:AB;function zu(a,c){if(Wr(a,c))return!0;if(typeof a!="object"||a===null||typeof c!="object"||c===null)return!1;var f=Object.keys(a),g=Object.keys(c);if(f.length!==g.length)return!1;for(g=0;g<f.length;g++){var w=f[g];if(!kn.call(c,w)||!Wr(a[w],c[w]))return!1}return!0}function j1(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function D1(a,c){var f=j1(a);a=0;for(var g;f;){if(f.nodeType===3){if(g=a+f.textContent.length,a<=c&&g>=c)return{node:f,offset:c-a};a=g}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=j1(f)}}function I1(a,c){return a&&c?a===c?!0:a&&a.nodeType===3?!1:c&&c.nodeType===3?I1(a,c.parentNode):"contains"in a?a.contains(c):a.compareDocumentPosition?!!(a.compareDocumentPosition(c)&16):!1:!1}function L1(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var c=yh(a.document);c instanceof a.HTMLIFrameElement;){try{var f=typeof c.contentWindow.location.href=="string"}catch{f=!1}if(f)a=c.contentWindow;else break;c=yh(a.document)}return c}function Eb(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 RB=Ti&&"documentMode"in document&&11>=document.documentMode,ec=null,Tb=null,Bu=null,Nb=!1;function P1(a,c,f){var g=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;Nb||ec==null||ec!==yh(g)||(g=ec,"selectionStart"in g&&Eb(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Bu&&zu(Bu,g)||(Bu=g,g=fp(Tb,"onSelect"),0<g.length&&(c=new Sh("onSelect","select",null,c,f),a.push({event:c,listeners:g}),c.target=ec)))}function Ga(a,c){var f={};return f[a.toLowerCase()]=c.toLowerCase(),f["Webkit"+a]="webkit"+c,f["Moz"+a]="moz"+c,f}var tc={animationend:Ga("Animation","AnimationEnd"),animationiteration:Ga("Animation","AnimationIteration"),animationstart:Ga("Animation","AnimationStart"),transitionrun:Ga("Transition","TransitionRun"),transitionstart:Ga("Transition","TransitionStart"),transitioncancel:Ga("Transition","TransitionCancel"),transitionend:Ga("Transition","TransitionEnd")},Mb={},$1={};Ti&&($1=document.createElement("div").style,"AnimationEvent"in window||(delete tc.animationend.animation,delete tc.animationiteration.animation,delete tc.animationstart.animation),"TransitionEvent"in window||delete tc.transitionend.transition);function Ya(a){if(Mb[a])return Mb[a];if(!tc[a])return a;var c=tc[a],f;for(f in c)if(c.hasOwnProperty(f)&&f in $1)return Mb[a]=c[f];return a}var z1=Ya("animationend"),B1=Ya("animationiteration"),F1=Ya("animationstart"),OB=Ya("transitionrun"),jB=Ya("transitionstart"),DB=Ya("transitioncancel"),V1=Ya("transitionend"),H1=new Map,_b="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(" ");_b.push("scrollEnd");function js(a,c){H1.set(a,c),Os(c,[a])}var Eh=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)},hs=[],nc=0,Ab=0;function Th(){for(var a=nc,c=Ab=nc=0;c<a;){var f=hs[c];hs[c++]=null;var g=hs[c];hs[c++]=null;var w=hs[c];hs[c++]=null;var S=hs[c];if(hs[c++]=null,g!==null&&w!==null){var R=g.pending;R===null?w.next=w:(w.next=R.next,R.next=w),g.pending=w}S!==0&&U1(f,w,S)}}function Nh(a,c,f,g){hs[nc++]=a,hs[nc++]=c,hs[nc++]=f,hs[nc++]=g,Ab|=g,a.lanes|=g,a=a.alternate,a!==null&&(a.lanes|=g)}function Rb(a,c,f,g){return Nh(a,c,f,g),Mh(a)}function Ka(a,c){return Nh(a,null,null,c),Mh(a)}function U1(a,c,f){a.lanes|=f;var g=a.alternate;g!==null&&(g.lanes|=f);for(var w=!1,S=a.return;S!==null;)S.childLanes|=f,g=S.alternate,g!==null&&(g.childLanes|=f),S.tag===22&&(a=S.stateNode,a===null||a._visibility&1||(w=!0)),a=S,S=S.return;return a.tag===3?(S=a.stateNode,w&&c!==null&&(w=31-be(f),a=S.hiddenUpdates,g=a[w],g===null?a[w]=[c]:g.push(c),c.lane=f|536870912),S):null}function Mh(a){if(50<ld)throw ld=0,Bv=null,Error(r(185));for(var c=a.return;c!==null;)a=c,c=a.return;return a.tag===3?a.stateNode:null}var rc={};function IB(a,c,f,g){this.tag=a,this.key=f,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=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function qr(a,c,f,g){return new IB(a,c,f,g)}function Ob(a){return a=a.prototype,!(!a||!a.isReactComponent)}function Ni(a,c){var f=a.alternate;return f===null?(f=qr(a.tag,c,a.key,a.mode),f.elementType=a.elementType,f.type=a.type,f.stateNode=a.stateNode,f.alternate=a,a.alternate=f):(f.pendingProps=c,f.type=a.type,f.flags=0,f.subtreeFlags=0,f.deletions=null),f.flags=a.flags&65011712,f.childLanes=a.childLanes,f.lanes=a.lanes,f.child=a.child,f.memoizedProps=a.memoizedProps,f.memoizedState=a.memoizedState,f.updateQueue=a.updateQueue,c=a.dependencies,f.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},f.sibling=a.sibling,f.index=a.index,f.ref=a.ref,f.refCleanup=a.refCleanup,f}function W1(a,c){a.flags&=65011714;var f=a.alternate;return f===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=f.childLanes,a.lanes=f.lanes,a.child=f.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=f.memoizedProps,a.memoizedState=f.memoizedState,a.updateQueue=f.updateQueue,a.type=f.type,c=f.dependencies,a.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext}),a}function _h(a,c,f,g,w,S){var R=0;if(g=a,typeof a=="function")Ob(a)&&(R=1);else if(typeof a=="string")R=B3(a,f,de.current)?26:a==="html"||a==="head"||a==="body"?27:5;else e:switch(a){case O:return a=qr(31,f,c,w),a.elementType=O,a.lanes=S,a;case x:return Za(f.children,w,S,c);case k:R=8,w|=24;break;case E:return a=qr(12,f,c,w|2),a.elementType=E,a.lanes=S,a;case T:return a=qr(13,f,c,w),a.elementType=T,a.lanes=S,a;case A:return a=qr(19,f,c,w),a.elementType=A,a.lanes=S,a;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case _:R=10;break e;case M:R=9;break e;case N:R=11;break e;case j:R=14;break e;case P:R=16,g=null;break e}R=29,f=Error(r(130,a===null?"null":typeof a,"")),g=null}return c=qr(R,f,c,w),c.elementType=a,c.type=g,c.lanes=S,c}function Za(a,c,f,g){return a=qr(7,a,g,c),a.lanes=f,a}function jb(a,c,f){return a=qr(6,a,null,c),a.lanes=f,a}function q1(a){var c=qr(18,null,null,0);return c.stateNode=a,c}function Db(a,c,f){return c=qr(4,a.children!==null?a.children:[],a.key,c),c.lanes=f,c.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},c}var G1=new WeakMap;function ps(a,c){if(typeof a=="object"&&a!==null){var f=G1.get(a);return f!==void 0?f:(c={value:a,source:c,stack:qt(c)},G1.set(a,c),c)}return{value:a,source:c,stack:qt(c)}}var sc=[],ic=0,Ah=null,Fu=0,ms=[],gs=0,Eo=null,ti=1,ni="";function Mi(a,c){sc[ic++]=Fu,sc[ic++]=Ah,Ah=a,Fu=c}function Y1(a,c,f){ms[gs++]=ti,ms[gs++]=ni,ms[gs++]=Eo,Eo=a;var g=ti;a=ni;var w=32-be(g)-1;g&=~(1<<w),f+=1;var S=32-be(c)+w;if(30<S){var R=w-w%5;S=(g&(1<<R)-1).toString(32),g>>=R,w-=R,ti=1<<32-be(c)+w|f<<w|g,ni=S+a}else ti=1<<S|f<<w|g,ni=a}function Ib(a){a.return!==null&&(Mi(a,1),Y1(a,1,0))}function Lb(a){for(;a===Ah;)Ah=sc[--ic],sc[ic]=null,Fu=sc[--ic],sc[ic]=null;for(;a===Eo;)Eo=ms[--gs],ms[gs]=null,ni=ms[--gs],ms[gs]=null,ti=ms[--gs],ms[gs]=null}function K1(a,c){ms[gs++]=ti,ms[gs++]=ni,ms[gs++]=Eo,ti=c.id,ni=c.overflow,Eo=a}var Xn=null,Zt=null,wt=!1,To=null,ys=!1,Pb=Error(r(519));function No(a){var c=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Vu(ps(c,a)),Pb}function Z1(a){var c=a.stateNode,f=a.type,g=a.memoizedProps;switch(c[bn]=a,c[Cn]=g,f){case"dialog":mt("cancel",c),mt("close",c);break;case"iframe":case"object":case"embed":mt("load",c);break;case"video":case"audio":for(f=0;f<ud.length;f++)mt(ud[f],c);break;case"source":mt("error",c);break;case"img":case"image":case"link":mt("error",c),mt("load",c);break;case"details":mt("toggle",c);break;case"input":mt("invalid",c),c1(c,g.value,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name,!0);break;case"select":mt("invalid",c);break;case"textarea":mt("invalid",c),d1(c,g.value,g.defaultValue,g.children)}f=g.children,typeof f!="string"&&typeof f!="number"&&typeof f!="bigint"||c.textContent===""+f||g.suppressHydrationWarning===!0||hN(c.textContent,f)?(g.popover!=null&&(mt("beforetoggle",c),mt("toggle",c)),g.onScroll!=null&&mt("scroll",c),g.onScrollEnd!=null&&mt("scrollend",c),g.onClick!=null&&(c.onclick=Ei),c=!0):c=!1,c||No(a,!0)}function X1(a){for(Xn=a.return;Xn;)switch(Xn.tag){case 5:case 31:case 13:ys=!1;return;case 27:case 3:ys=!0;return;default:Xn=Xn.return}}function oc(a){if(a!==Xn)return!1;if(!wt)return X1(a),wt=!0,!1;var c=a.tag,f;if((f=c!==3&&c!==27)&&((f=c===5)&&(f=a.type,f=!(f!=="form"&&f!=="button")||t0(a.type,a.memoizedProps)),f=!f),f&&Zt&&No(a),X1(a),c===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));Zt=SN(a)}else if(c===31){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));Zt=SN(a)}else c===27?(c=Zt,Fo(a.type)?(a=o0,o0=null,Zt=a):Zt=c):Zt=Xn?vs(a.stateNode.nextSibling):null;return!0}function Xa(){Zt=Xn=null,wt=!1}function $b(){var a=To;return a!==null&&(Lr===null?Lr=a:Lr.push.apply(Lr,a),To=null),a}function Vu(a){To===null?To=[a]:To.push(a)}var zb=L(null),Ja=null,_i=null;function Mo(a,c,f){ie(zb,c._currentValue),c._currentValue=f}function Ai(a){a._currentValue=zb.current,q(zb)}function Bb(a,c,f){for(;a!==null;){var g=a.alternate;if((a.childLanes&c)!==c?(a.childLanes|=c,g!==null&&(g.childLanes|=c)):g!==null&&(g.childLanes&c)!==c&&(g.childLanes|=c),a===f)break;a=a.return}}function Fb(a,c,f,g){var w=a.child;for(w!==null&&(w.return=a);w!==null;){var S=w.dependencies;if(S!==null){var R=w.child;S=S.firstContext;e:for(;S!==null;){var D=S;S=w;for(var H=0;H<c.length;H++)if(D.context===c[H]){S.lanes|=f,D=S.alternate,D!==null&&(D.lanes|=f),Bb(S.return,f,a),g||(R=null);break e}S=D.next}}else if(w.tag===18){if(R=w.return,R===null)throw Error(r(341));R.lanes|=f,S=R.alternate,S!==null&&(S.lanes|=f),Bb(R,f,a),R=null}else R=w.child;if(R!==null)R.return=w;else for(R=w;R!==null;){if(R===a){R=null;break}if(w=R.sibling,w!==null){w.return=R.return,R=w;break}R=R.return}w=R}}function ac(a,c,f,g){a=null;for(var w=c,S=!1;w!==null;){if(!S){if((w.flags&524288)!==0)S=!0;else if((w.flags&262144)!==0)break}if(w.tag===10){var R=w.alternate;if(R===null)throw Error(r(387));if(R=R.memoizedProps,R!==null){var D=w.type;Wr(w.pendingProps.value,R.value)||(a!==null?a.push(D):a=[D])}}else if(w===je.current){if(R=w.alternate,R===null)throw Error(r(387));R.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(a!==null?a.push(md):a=[md])}w=w.return}a!==null&&Fb(c,a,f,g),c.flags|=262144}function Rh(a){for(a=a.firstContext;a!==null;){if(!Wr(a.context._currentValue,a.memoizedValue))return!0;a=a.next}return!1}function Qa(a){Ja=a,_i=null,a=a.dependencies,a!==null&&(a.firstContext=null)}function Jn(a){return J1(Ja,a)}function Oh(a,c){return Ja===null&&Qa(a),J1(a,c)}function J1(a,c){var f=c._currentValue;if(c={context:c,memoizedValue:f,next:null},_i===null){if(a===null)throw Error(r(308));_i=c,a.dependencies={lanes:0,firstContext:c},a.flags|=524288}else _i=_i.next=c;return f}var LB=typeof AbortController<"u"?AbortController:function(){var a=[],c=this.signal={aborted:!1,addEventListener:function(f,g){a.push(g)}};this.abort=function(){c.aborted=!0,a.forEach(function(f){return f()})}},PB=t.unstable_scheduleCallback,$B=t.unstable_NormalPriority,En={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Vb(){return{controller:new LB,data:new Map,refCount:0}}function Hu(a){a.refCount--,a.refCount===0&&PB($B,function(){a.controller.abort()})}var Uu=null,Hb=0,lc=0,cc=null;function zB(a,c){if(Uu===null){var f=Uu=[];Hb=0,lc=qv(),cc={status:"pending",value:void 0,then:function(g){f.push(g)}}}return Hb++,c.then(Q1,Q1),c}function Q1(){if(--Hb===0&&Uu!==null){cc!==null&&(cc.status="fulfilled");var a=Uu;Uu=null,lc=0,cc=null;for(var c=0;c<a.length;c++)(0,a[c])()}}function BB(a,c){var f=[],g={status:"pending",value:null,reason:null,then:function(w){f.push(w)}};return a.then(function(){g.status="fulfilled",g.value=c;for(var w=0;w<f.length;w++)(0,f[w])(c)},function(w){for(g.status="rejected",g.reason=w,w=0;w<f.length;w++)(0,f[w])(void 0)}),g}var eE=F.S;F.S=function(a,c){PT=ht(),typeof c=="object"&&c!==null&&typeof c.then=="function"&&zB(a,c),eE!==null&&eE(a,c)};var el=L(null);function Ub(){var a=el.current;return a!==null?a:Ht.pooledCache}function jh(a,c){c===null?ie(el,el.current):ie(el,c.pool)}function tE(){var a=Ub();return a===null?null:{parent:En._currentValue,pool:a}}var uc=Error(r(460)),Wb=Error(r(474)),Dh=Error(r(542)),Ih={then:function(){}};function nE(a){return a=a.status,a==="fulfilled"||a==="rejected"}function rE(a,c,f){switch(f=a[f],f===void 0?a.push(c):f!==c&&(c.then(Ei,Ei),c=f),c.status){case"fulfilled":return c.value;case"rejected":throw a=c.reason,iE(a),a;default:if(typeof c.status=="string")c.then(Ei,Ei);else{if(a=Ht,a!==null&&100<a.shellSuspendCounter)throw Error(r(482));a=c,a.status="pending",a.then(function(g){if(c.status==="pending"){var w=c;w.status="fulfilled",w.value=g}},function(g){if(c.status==="pending"){var w=c;w.status="rejected",w.reason=g}})}switch(c.status){case"fulfilled":return c.value;case"rejected":throw a=c.reason,iE(a),a}throw nl=c,uc}}function tl(a){try{var c=a._init;return c(a._payload)}catch(f){throw f!==null&&typeof f=="object"&&typeof f.then=="function"?(nl=f,uc):f}}var nl=null;function sE(){if(nl===null)throw Error(r(459));var a=nl;return nl=null,a}function iE(a){if(a===uc||a===Dh)throw Error(r(483))}var dc=null,Wu=0;function Lh(a){var c=Wu;return Wu+=1,dc===null&&(dc=[]),rE(dc,a,c)}function qu(a,c){c=c.props.ref,a.ref=c!==void 0?c:null}function Ph(a,c){throw c.$$typeof===y?Error(r(525)):(a=Object.prototype.toString.call(c),Error(r(31,a==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":a)))}function oE(a){function c(Z,Y){if(a){var te=Z.deletions;te===null?(Z.deletions=[Y],Z.flags|=16):te.push(Y)}}function f(Z,Y){if(!a)return null;for(;Y!==null;)c(Z,Y),Y=Y.sibling;return null}function g(Z){for(var Y=new Map;Z!==null;)Z.key!==null?Y.set(Z.key,Z):Y.set(Z.index,Z),Z=Z.sibling;return Y}function w(Z,Y){return Z=Ni(Z,Y),Z.index=0,Z.sibling=null,Z}function S(Z,Y,te){return Z.index=te,a?(te=Z.alternate,te!==null?(te=te.index,te<Y?(Z.flags|=67108866,Y):te):(Z.flags|=67108866,Y)):(Z.flags|=1048576,Y)}function R(Z){return a&&Z.alternate===null&&(Z.flags|=67108866),Z}function D(Z,Y,te,he){return Y===null||Y.tag!==6?(Y=jb(te,Z.mode,he),Y.return=Z,Y):(Y=w(Y,te),Y.return=Z,Y)}function H(Z,Y,te,he){var qe=te.type;return qe===x?le(Z,Y,te.props.children,he,te.key):Y!==null&&(Y.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===P&&tl(qe)===Y.type)?(Y=w(Y,te.props),qu(Y,te),Y.return=Z,Y):(Y=_h(te.type,te.key,te.props,null,Z.mode,he),qu(Y,te),Y.return=Z,Y)}function ne(Z,Y,te,he){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==te.containerInfo||Y.stateNode.implementation!==te.implementation?(Y=Db(te,Z.mode,he),Y.return=Z,Y):(Y=w(Y,te.children||[]),Y.return=Z,Y)}function le(Z,Y,te,he,qe){return Y===null||Y.tag!==7?(Y=Za(te,Z.mode,he,qe),Y.return=Z,Y):(Y=w(Y,te),Y.return=Z,Y)}function me(Z,Y,te){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Y=jb(""+Y,Z.mode,te),Y.return=Z,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case b:return te=_h(Y.type,Y.key,Y.props,null,Z.mode,te),qu(te,Y),te.return=Z,te;case v:return Y=Db(Y,Z.mode,te),Y.return=Z,Y;case P:return Y=tl(Y),me(Z,Y,te)}if(ee(Y)||W(Y))return Y=Za(Y,Z.mode,te,null),Y.return=Z,Y;if(typeof Y.then=="function")return me(Z,Lh(Y),te);if(Y.$$typeof===_)return me(Z,Oh(Z,Y),te);Ph(Z,Y)}return null}function re(Z,Y,te,he){var qe=Y!==null?Y.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return qe!==null?null:D(Z,Y,""+te,he);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case b:return te.key===qe?H(Z,Y,te,he):null;case v:return te.key===qe?ne(Z,Y,te,he):null;case P:return te=tl(te),re(Z,Y,te,he)}if(ee(te)||W(te))return qe!==null?null:le(Z,Y,te,he,null);if(typeof te.then=="function")return re(Z,Y,Lh(te),he);if(te.$$typeof===_)return re(Z,Y,Oh(Z,te),he);Ph(Z,te)}return null}function se(Z,Y,te,he,qe){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return Z=Z.get(te)||null,D(Y,Z,""+he,qe);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case b:return Z=Z.get(he.key===null?te:he.key)||null,H(Y,Z,he,qe);case v:return Z=Z.get(he.key===null?te:he.key)||null,ne(Y,Z,he,qe);case P:return he=tl(he),se(Z,Y,te,he,qe)}if(ee(he)||W(he))return Z=Z.get(te)||null,le(Y,Z,he,qe,null);if(typeof he.then=="function")return se(Z,Y,te,Lh(he),qe);if(he.$$typeof===_)return se(Z,Y,te,Oh(Y,he),qe);Ph(Y,he)}return null}function ze(Z,Y,te,he){for(var qe=null,Ct=null,Ve=Y,ct=Y=0,vt=null;Ve!==null&&ct<te.length;ct++){Ve.index>ct?(vt=Ve,Ve=null):vt=Ve.sibling;var Et=re(Z,Ve,te[ct],he);if(Et===null){Ve===null&&(Ve=vt);break}a&&Ve&&Et.alternate===null&&c(Z,Ve),Y=S(Et,Y,ct),Ct===null?qe=Et:Ct.sibling=Et,Ct=Et,Ve=vt}if(ct===te.length)return f(Z,Ve),wt&&Mi(Z,ct),qe;if(Ve===null){for(;ct<te.length;ct++)Ve=me(Z,te[ct],he),Ve!==null&&(Y=S(Ve,Y,ct),Ct===null?qe=Ve:Ct.sibling=Ve,Ct=Ve);return wt&&Mi(Z,ct),qe}for(Ve=g(Ve);ct<te.length;ct++)vt=se(Ve,Z,ct,te[ct],he),vt!==null&&(a&&vt.alternate!==null&&Ve.delete(vt.key===null?ct:vt.key),Y=S(vt,Y,ct),Ct===null?qe=vt:Ct.sibling=vt,Ct=vt);return a&&Ve.forEach(function(qo){return c(Z,qo)}),wt&&Mi(Z,ct),qe}function et(Z,Y,te,he){if(te==null)throw Error(r(151));for(var qe=null,Ct=null,Ve=Y,ct=Y=0,vt=null,Et=te.next();Ve!==null&&!Et.done;ct++,Et=te.next()){Ve.index>ct?(vt=Ve,Ve=null):vt=Ve.sibling;var qo=re(Z,Ve,Et.value,he);if(qo===null){Ve===null&&(Ve=vt);break}a&&Ve&&qo.alternate===null&&c(Z,Ve),Y=S(qo,Y,ct),Ct===null?qe=qo:Ct.sibling=qo,Ct=qo,Ve=vt}if(Et.done)return f(Z,Ve),wt&&Mi(Z,ct),qe;if(Ve===null){for(;!Et.done;ct++,Et=te.next())Et=me(Z,Et.value,he),Et!==null&&(Y=S(Et,Y,ct),Ct===null?qe=Et:Ct.sibling=Et,Ct=Et);return wt&&Mi(Z,ct),qe}for(Ve=g(Ve);!Et.done;ct++,Et=te.next())Et=se(Ve,Z,ct,Et.value,he),Et!==null&&(a&&Et.alternate!==null&&Ve.delete(Et.key===null?ct:Et.key),Y=S(Et,Y,ct),Ct===null?qe=Et:Ct.sibling=Et,Ct=Et);return a&&Ve.forEach(function(X3){return c(Z,X3)}),wt&&Mi(Z,ct),qe}function $t(Z,Y,te,he){if(typeof te=="object"&&te!==null&&te.type===x&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case b:e:{for(var qe=te.key;Y!==null;){if(Y.key===qe){if(qe=te.type,qe===x){if(Y.tag===7){f(Z,Y.sibling),he=w(Y,te.props.children),he.return=Z,Z=he;break e}}else if(Y.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===P&&tl(qe)===Y.type){f(Z,Y.sibling),he=w(Y,te.props),qu(he,te),he.return=Z,Z=he;break e}f(Z,Y);break}else c(Z,Y);Y=Y.sibling}te.type===x?(he=Za(te.props.children,Z.mode,he,te.key),he.return=Z,Z=he):(he=_h(te.type,te.key,te.props,null,Z.mode,he),qu(he,te),he.return=Z,Z=he)}return R(Z);case v:e:{for(qe=te.key;Y!==null;){if(Y.key===qe)if(Y.tag===4&&Y.stateNode.containerInfo===te.containerInfo&&Y.stateNode.implementation===te.implementation){f(Z,Y.sibling),he=w(Y,te.children||[]),he.return=Z,Z=he;break e}else{f(Z,Y);break}else c(Z,Y);Y=Y.sibling}he=Db(te,Z.mode,he),he.return=Z,Z=he}return R(Z);case P:return te=tl(te),$t(Z,Y,te,he)}if(ee(te))return ze(Z,Y,te,he);if(W(te)){if(qe=W(te),typeof qe!="function")throw Error(r(150));return te=qe.call(te),et(Z,Y,te,he)}if(typeof te.then=="function")return $t(Z,Y,Lh(te),he);if(te.$$typeof===_)return $t(Z,Y,Oh(Z,te),he);Ph(Z,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,Y!==null&&Y.tag===6?(f(Z,Y.sibling),he=w(Y,te),he.return=Z,Z=he):(f(Z,Y),he=jb(te,Z.mode,he),he.return=Z,Z=he),R(Z)):f(Z,Y)}return function(Z,Y,te,he){try{Wu=0;var qe=$t(Z,Y,te,he);return dc=null,qe}catch(Ve){if(Ve===uc||Ve===Dh)throw Ve;var Ct=qr(29,Ve,null,Z.mode);return Ct.lanes=he,Ct.return=Z,Ct}}}var rl=oE(!0),aE=oE(!1),_o=!1;function qb(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Gb(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 Ao(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function Ro(a,c,f){var g=a.updateQueue;if(g===null)return null;if(g=g.shared,(Mt&2)!==0){var w=g.pending;return w===null?c.next=c:(c.next=w.next,w.next=c),g.pending=c,c=Mh(a),U1(a,null,f),c}return Nh(a,g,c,f),Mh(a)}function Gu(a,c,f){if(c=c.updateQueue,c!==null&&(c=c.shared,(f&4194048)!==0)){var g=c.lanes;g&=a.pendingLanes,f|=g,c.lanes=f,Va(a,f)}}function Yb(a,c){var f=a.updateQueue,g=a.alternate;if(g!==null&&(g=g.updateQueue,f===g)){var w=null,S=null;if(f=f.firstBaseUpdate,f!==null){do{var R={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};S===null?w=S=R:S=S.next=R,f=f.next}while(f!==null);S===null?w=S=c:S=S.next=c}else w=S=c;f={baseState:g.baseState,firstBaseUpdate:w,lastBaseUpdate:S,shared:g.shared,callbacks:g.callbacks},a.updateQueue=f;return}a=f.lastBaseUpdate,a===null?f.firstBaseUpdate=c:a.next=c,f.lastBaseUpdate=c}var Kb=!1;function Yu(){if(Kb){var a=cc;if(a!==null)throw a}}function Ku(a,c,f,g){Kb=!1;var w=a.updateQueue;_o=!1;var S=w.firstBaseUpdate,R=w.lastBaseUpdate,D=w.shared.pending;if(D!==null){w.shared.pending=null;var H=D,ne=H.next;H.next=null,R===null?S=ne:R.next=ne,R=H;var le=a.alternate;le!==null&&(le=le.updateQueue,D=le.lastBaseUpdate,D!==R&&(D===null?le.firstBaseUpdate=ne:D.next=ne,le.lastBaseUpdate=H))}if(S!==null){var me=w.baseState;R=0,le=ne=H=null,D=S;do{var re=D.lane&-536870913,se=re!==D.lane;if(se?(bt&re)===re:(g&re)===re){re!==0&&re===lc&&(Kb=!0),le!==null&&(le=le.next={lane:0,tag:D.tag,payload:D.payload,callback:null,next:null});e:{var ze=a,et=D;re=c;var $t=f;switch(et.tag){case 1:if(ze=et.payload,typeof ze=="function"){me=ze.call($t,me,re);break e}me=ze;break e;case 3:ze.flags=ze.flags&-65537|128;case 0:if(ze=et.payload,re=typeof ze=="function"?ze.call($t,me,re):ze,re==null)break e;me=m({},me,re);break e;case 2:_o=!0}}re=D.callback,re!==null&&(a.flags|=64,se&&(a.flags|=8192),se=w.callbacks,se===null?w.callbacks=[re]:se.push(re))}else se={lane:re,tag:D.tag,payload:D.payload,callback:D.callback,next:null},le===null?(ne=le=se,H=me):le=le.next=se,R|=re;if(D=D.next,D===null){if(D=w.shared.pending,D===null)break;se=D,D=se.next,se.next=null,w.lastBaseUpdate=se,w.shared.pending=null}}while(!0);le===null&&(H=me),w.baseState=H,w.firstBaseUpdate=ne,w.lastBaseUpdate=le,S===null&&(w.shared.lanes=0),Lo|=R,a.lanes=R,a.memoizedState=me}}function lE(a,c){if(typeof a!="function")throw Error(r(191,a));a.call(c)}function cE(a,c){var f=a.callbacks;if(f!==null)for(a.callbacks=null,a=0;a<f.length;a++)lE(f[a],c)}var fc=L(null),$h=L(0);function uE(a,c){a=zi,ie($h,a),ie(fc,c),zi=a|c.baseLanes}function Zb(){ie($h,zi),ie(fc,fc.current)}function Xb(){zi=$h.current,q(fc),q($h)}var Gr=L(null),bs=null;function Oo(a){var c=a.alternate;ie(wn,wn.current&1),ie(Gr,a),bs===null&&(c===null||fc.current!==null||c.memoizedState!==null)&&(bs=a)}function Jb(a){ie(wn,wn.current),ie(Gr,a),bs===null&&(bs=a)}function dE(a){a.tag===22?(ie(wn,wn.current),ie(Gr,a),bs===null&&(bs=a)):jo()}function jo(){ie(wn,wn.current),ie(Gr,Gr.current)}function Yr(a){q(Gr),bs===a&&(bs=null),q(wn)}var wn=L(0);function zh(a){for(var c=a;c!==null;){if(c.tag===13){var f=c.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||s0(f)||i0(f)))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 Ri=0,lt=null,Lt=null,Tn=null,Bh=!1,hc=!1,sl=!1,Fh=0,Zu=0,pc=null,FB=0;function fn(){throw Error(r(321))}function Qb(a,c){if(c===null)return!1;for(var f=0;f<c.length&&f<a.length;f++)if(!Wr(a[f],c[f]))return!1;return!0}function ev(a,c,f,g,w,S){return Ri=S,lt=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,F.H=a===null||a.memoizedState===null?YE:mv,sl=!1,S=f(g,w),sl=!1,hc&&(S=hE(c,f,g,w)),fE(a),S}function fE(a){F.H=Qu;var c=Lt!==null&&Lt.next!==null;if(Ri=0,Tn=Lt=lt=null,Bh=!1,Zu=0,pc=null,c)throw Error(r(300));a===null||Nn||(a=a.dependencies,a!==null&&Rh(a)&&(Nn=!0))}function hE(a,c,f,g){lt=a;var w=0;do{if(hc&&(pc=null),Zu=0,hc=!1,25<=w)throw Error(r(301));if(w+=1,Tn=Lt=null,a.updateQueue!=null){var S=a.updateQueue;S.lastEffect=null,S.events=null,S.stores=null,S.memoCache!=null&&(S.memoCache.index=0)}F.H=KE,S=c(f,g)}while(hc);return S}function VB(){var a=F.H,c=a.useState()[0];return c=typeof c.then=="function"?Xu(c):c,a=a.useState()[0],(Lt!==null?Lt.memoizedState:null)!==a&&(lt.flags|=1024),c}function tv(){var a=Fh!==0;return Fh=0,a}function nv(a,c,f){c.updateQueue=a.updateQueue,c.flags&=-2053,a.lanes&=~f}function rv(a){if(Bh){for(a=a.memoizedState;a!==null;){var c=a.queue;c!==null&&(c.pending=null),a=a.next}Bh=!1}Ri=0,Tn=Lt=lt=null,hc=!1,Zu=Fh=0,pc=null}function xr(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Tn===null?lt.memoizedState=Tn=a:Tn=Tn.next=a,Tn}function xn(){if(Lt===null){var a=lt.alternate;a=a!==null?a.memoizedState:null}else a=Lt.next;var c=Tn===null?lt.memoizedState:Tn.next;if(c!==null)Tn=c,Lt=a;else{if(a===null)throw lt.alternate===null?Error(r(467)):Error(r(310));Lt=a,a={memoizedState:Lt.memoizedState,baseState:Lt.baseState,baseQueue:Lt.baseQueue,queue:Lt.queue,next:null},Tn===null?lt.memoizedState=Tn=a:Tn=Tn.next=a}return Tn}function Vh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Xu(a){var c=Zu;return Zu+=1,pc===null&&(pc=[]),a=rE(pc,a,c),c=lt,(Tn===null?c.memoizedState:Tn.next)===null&&(c=c.alternate,F.H=c===null||c.memoizedState===null?YE:mv),a}function Hh(a){if(a!==null&&typeof a=="object"){if(typeof a.then=="function")return Xu(a);if(a.$$typeof===_)return Jn(a)}throw Error(r(438,String(a)))}function sv(a){var c=null,f=lt.updateQueue;if(f!==null&&(c=f.memoCache),c==null){var g=lt.alternate;g!==null&&(g=g.updateQueue,g!==null&&(g=g.memoCache,g!=null&&(c={data:g.data.map(function(w){return w.slice()}),index:0})))}if(c==null&&(c={data:[],index:0}),f===null&&(f=Vh(),lt.updateQueue=f),f.memoCache=c,f=c.data[c.index],f===void 0)for(f=c.data[c.index]=Array(a),g=0;g<a;g++)f[g]=G;return c.index++,f}function Oi(a,c){return typeof c=="function"?c(a):c}function Uh(a){var c=xn();return iv(c,Lt,a)}function iv(a,c,f){var g=a.queue;if(g===null)throw Error(r(311));g.lastRenderedReducer=f;var w=a.baseQueue,S=g.pending;if(S!==null){if(w!==null){var R=w.next;w.next=S.next,S.next=R}c.baseQueue=w=S,g.pending=null}if(S=a.baseState,w===null)a.memoizedState=S;else{c=w.next;var D=R=null,H=null,ne=c,le=!1;do{var me=ne.lane&-536870913;if(me!==ne.lane?(bt&me)===me:(Ri&me)===me){var re=ne.revertLane;if(re===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),me===lc&&(le=!0);else if((Ri&re)===re){ne=ne.next,re===lc&&(le=!0);continue}else me={lane:0,revertLane:ne.revertLane,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},H===null?(D=H=me,R=S):H=H.next=me,lt.lanes|=re,Lo|=re;me=ne.action,sl&&f(S,me),S=ne.hasEagerState?ne.eagerState:f(S,me)}else re={lane:me,revertLane:ne.revertLane,gesture:ne.gesture,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},H===null?(D=H=re,R=S):H=H.next=re,lt.lanes|=me,Lo|=me;ne=ne.next}while(ne!==null&&ne!==c);if(H===null?R=S:H.next=D,!Wr(S,a.memoizedState)&&(Nn=!0,le&&(f=cc,f!==null)))throw f;a.memoizedState=S,a.baseState=R,a.baseQueue=H,g.lastRenderedState=S}return w===null&&(g.lanes=0),[a.memoizedState,g.dispatch]}function ov(a){var c=xn(),f=c.queue;if(f===null)throw Error(r(311));f.lastRenderedReducer=a;var g=f.dispatch,w=f.pending,S=c.memoizedState;if(w!==null){f.pending=null;var R=w=w.next;do S=a(S,R.action),R=R.next;while(R!==w);Wr(S,c.memoizedState)||(Nn=!0),c.memoizedState=S,c.baseQueue===null&&(c.baseState=S),f.lastRenderedState=S}return[S,g]}function pE(a,c,f){var g=lt,w=xn(),S=wt;if(S){if(f===void 0)throw Error(r(407));f=f()}else f=c();var R=!Wr((Lt||w).memoizedState,f);if(R&&(w.memoizedState=f,Nn=!0),w=w.queue,cv(yE.bind(null,g,w,a),[a]),w.getSnapshot!==c||R||Tn!==null&&Tn.memoizedState.tag&1){if(g.flags|=2048,mc(9,{destroy:void 0},gE.bind(null,g,w,f,c),null),Ht===null)throw Error(r(349));S||(Ri&127)!==0||mE(g,c,f)}return f}function mE(a,c,f){a.flags|=16384,a={getSnapshot:c,value:f},c=lt.updateQueue,c===null?(c=Vh(),lt.updateQueue=c,c.stores=[a]):(f=c.stores,f===null?c.stores=[a]:f.push(a))}function gE(a,c,f,g){c.value=f,c.getSnapshot=g,bE(c)&&vE(a)}function yE(a,c,f){return f(function(){bE(c)&&vE(a)})}function bE(a){var c=a.getSnapshot;a=a.value;try{var f=c();return!Wr(a,f)}catch{return!0}}function vE(a){var c=Ka(a,2);c!==null&&Pr(c,a,2)}function av(a){var c=xr();if(typeof a=="function"){var f=a;if(a=f(),sl){ce(!0);try{f()}finally{ce(!1)}}}return c.memoizedState=c.baseState=a,c.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oi,lastRenderedState:a},c}function wE(a,c,f,g){return a.baseState=f,iv(a,Lt,typeof g=="function"?g:Oi)}function HB(a,c,f,g,w){if(Gh(a))throw Error(r(485));if(a=c.action,a!==null){var S={payload:w,action:a,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(R){S.listeners.push(R)}};F.T!==null?f(!0):S.isTransition=!1,g(S),f=c.pending,f===null?(S.next=c.pending=S,xE(c,S)):(S.next=f.next,c.pending=f.next=S)}}function xE(a,c){var f=c.action,g=c.payload,w=a.state;if(c.isTransition){var S=F.T,R={};F.T=R;try{var D=f(w,g),H=F.S;H!==null&&H(R,D),SE(a,c,D)}catch(ne){lv(a,c,ne)}finally{S!==null&&R.types!==null&&(S.types=R.types),F.T=S}}else try{S=f(w,g),SE(a,c,S)}catch(ne){lv(a,c,ne)}}function SE(a,c,f){f!==null&&typeof f=="object"&&typeof f.then=="function"?f.then(function(g){kE(a,c,g)},function(g){return lv(a,c,g)}):kE(a,c,f)}function kE(a,c,f){c.status="fulfilled",c.value=f,CE(c),a.state=f,c=a.pending,c!==null&&(f=c.next,f===c?a.pending=null:(f=f.next,c.next=f,xE(a,f)))}function lv(a,c,f){var g=a.pending;if(a.pending=null,g!==null){g=g.next;do c.status="rejected",c.reason=f,CE(c),c=c.next;while(c!==g)}a.action=null}function CE(a){a=a.listeners;for(var c=0;c<a.length;c++)(0,a[c])()}function EE(a,c){return c}function TE(a,c){if(wt){var f=Ht.formState;if(f!==null){e:{var g=lt;if(wt){if(Zt){t:{for(var w=Zt,S=ys;w.nodeType!==8;){if(!S){w=null;break t}if(w=vs(w.nextSibling),w===null){w=null;break t}}S=w.data,w=S==="F!"||S==="F"?w:null}if(w){Zt=vs(w.nextSibling),g=w.data==="F!";break e}}No(g)}g=!1}g&&(c=f[0])}}return f=xr(),f.memoizedState=f.baseState=c,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:EE,lastRenderedState:c},f.queue=g,f=WE.bind(null,lt,g),g.dispatch=f,g=av(!1),S=pv.bind(null,lt,!1,g.queue),g=xr(),w={state:c,dispatch:null,action:a,pending:null},g.queue=w,f=HB.bind(null,lt,w,S,f),w.dispatch=f,g.memoizedState=a,[c,f,!1]}function NE(a){var c=xn();return ME(c,Lt,a)}function ME(a,c,f){if(c=iv(a,c,EE)[0],a=Uh(Oi)[0],typeof c=="object"&&c!==null&&typeof c.then=="function")try{var g=Xu(c)}catch(R){throw R===uc?Dh:R}else g=c;c=xn();var w=c.queue,S=w.dispatch;return f!==c.memoizedState&&(lt.flags|=2048,mc(9,{destroy:void 0},UB.bind(null,w,f),null)),[g,S,a]}function UB(a,c){a.action=c}function _E(a){var c=xn(),f=Lt;if(f!==null)return ME(c,f,a);xn(),c=c.memoizedState,f=xn();var g=f.queue.dispatch;return f.memoizedState=a,[c,g,!1]}function mc(a,c,f,g){return a={tag:a,create:f,deps:g,inst:c,next:null},c=lt.updateQueue,c===null&&(c=Vh(),lt.updateQueue=c),f=c.lastEffect,f===null?c.lastEffect=a.next=a:(g=f.next,f.next=a,a.next=g,c.lastEffect=a),a}function AE(){return xn().memoizedState}function Wh(a,c,f,g){var w=xr();lt.flags|=a,w.memoizedState=mc(1|c,{destroy:void 0},f,g===void 0?null:g)}function qh(a,c,f,g){var w=xn();g=g===void 0?null:g;var S=w.memoizedState.inst;Lt!==null&&g!==null&&Qb(g,Lt.memoizedState.deps)?w.memoizedState=mc(c,S,f,g):(lt.flags|=a,w.memoizedState=mc(1|c,S,f,g))}function RE(a,c){Wh(8390656,8,a,c)}function cv(a,c){qh(2048,8,a,c)}function WB(a){lt.flags|=4;var c=lt.updateQueue;if(c===null)c=Vh(),lt.updateQueue=c,c.events=[a];else{var f=c.events;f===null?c.events=[a]:f.push(a)}}function OE(a){var c=xn().memoizedState;return WB({ref:c,nextImpl:a}),function(){if((Mt&2)!==0)throw Error(r(440));return c.impl.apply(void 0,arguments)}}function jE(a,c){return qh(4,2,a,c)}function DE(a,c){return qh(4,4,a,c)}function IE(a,c){if(typeof c=="function"){a=a();var f=c(a);return function(){typeof f=="function"?f():c(null)}}if(c!=null)return a=a(),c.current=a,function(){c.current=null}}function LE(a,c,f){f=f!=null?f.concat([a]):null,qh(4,4,IE.bind(null,c,a),f)}function uv(){}function PE(a,c){var f=xn();c=c===void 0?null:c;var g=f.memoizedState;return c!==null&&Qb(c,g[1])?g[0]:(f.memoizedState=[a,c],a)}function $E(a,c){var f=xn();c=c===void 0?null:c;var g=f.memoizedState;if(c!==null&&Qb(c,g[1]))return g[0];if(g=a(),sl){ce(!0);try{a()}finally{ce(!1)}}return f.memoizedState=[g,c],g}function dv(a,c,f){return f===void 0||(Ri&1073741824)!==0&&(bt&261930)===0?a.memoizedState=c:(a.memoizedState=f,a=zT(),lt.lanes|=a,Lo|=a,f)}function zE(a,c,f,g){return Wr(f,c)?f:fc.current!==null?(a=dv(a,f,g),Wr(a,c)||(Nn=!0),a):(Ri&42)===0||(Ri&1073741824)!==0&&(bt&261930)===0?(Nn=!0,a.memoizedState=f):(a=zT(),lt.lanes|=a,Lo|=a,c)}function BE(a,c,f,g,w){var S=I.p;I.p=S!==0&&8>S?S:8;var R=F.T,D={};F.T=D,pv(a,!1,c,f);try{var H=w(),ne=F.S;if(ne!==null&&ne(D,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var le=BB(H,g);Ju(a,c,le,Xr(a))}else Ju(a,c,g,Xr(a))}catch(me){Ju(a,c,{then:function(){},status:"rejected",reason:me},Xr())}finally{I.p=S,R!==null&&D.types!==null&&(R.types=D.types),F.T=R}}function qB(){}function fv(a,c,f,g){if(a.tag!==5)throw Error(r(476));var w=FE(a).queue;BE(a,w,c,z,f===null?qB:function(){return VE(a),f(g)})}function FE(a){var c=a.memoizedState;if(c!==null)return c;c={memoizedState:z,baseState:z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oi,lastRenderedState:z},next:null};var f={};return c.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oi,lastRenderedState:f},next:null},a.memoizedState=c,a=a.alternate,a!==null&&(a.memoizedState=c),c}function VE(a){var c=FE(a);c.next===null&&(c=a.alternate.memoizedState),Ju(a,c.next.queue,{},Xr())}function hv(){return Jn(md)}function HE(){return xn().memoizedState}function UE(){return xn().memoizedState}function GB(a){for(var c=a.return;c!==null;){switch(c.tag){case 24:case 3:var f=Xr();a=Ao(f);var g=Ro(c,a,f);g!==null&&(Pr(g,c,f),Gu(g,c,f)),c={cache:Vb()},a.payload=c;return}c=c.return}}function YB(a,c,f){var g=Xr();f={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Gh(a)?qE(c,f):(f=Rb(a,c,f,g),f!==null&&(Pr(f,a,g),GE(f,c,g)))}function WE(a,c,f){var g=Xr();Ju(a,c,f,g)}function Ju(a,c,f,g){var w={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(Gh(a))qE(c,w);else{var S=a.alternate;if(a.lanes===0&&(S===null||S.lanes===0)&&(S=c.lastRenderedReducer,S!==null))try{var R=c.lastRenderedState,D=S(R,f);if(w.hasEagerState=!0,w.eagerState=D,Wr(D,R))return Nh(a,c,w,0),Ht===null&&Th(),!1}catch{}if(f=Rb(a,c,w,g),f!==null)return Pr(f,a,g),GE(f,c,g),!0}return!1}function pv(a,c,f,g){if(g={lane:2,revertLane:qv(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},Gh(a)){if(c)throw Error(r(479))}else c=Rb(a,f,g,2),c!==null&&Pr(c,a,2)}function Gh(a){var c=a.alternate;return a===lt||c!==null&&c===lt}function qE(a,c){hc=Bh=!0;var f=a.pending;f===null?c.next=c:(c.next=f.next,f.next=c),a.pending=c}function GE(a,c,f){if((f&4194048)!==0){var g=c.lanes;g&=a.pendingLanes,f|=g,c.lanes=f,Va(a,f)}}var Qu={readContext:Jn,use:Hh,useCallback:fn,useContext:fn,useEffect:fn,useImperativeHandle:fn,useLayoutEffect:fn,useInsertionEffect:fn,useMemo:fn,useReducer:fn,useRef:fn,useState:fn,useDebugValue:fn,useDeferredValue:fn,useTransition:fn,useSyncExternalStore:fn,useId:fn,useHostTransitionStatus:fn,useFormState:fn,useActionState:fn,useOptimistic:fn,useMemoCache:fn,useCacheRefresh:fn};Qu.useEffectEvent=fn;var YE={readContext:Jn,use:Hh,useCallback:function(a,c){return xr().memoizedState=[a,c===void 0?null:c],a},useContext:Jn,useEffect:RE,useImperativeHandle:function(a,c,f){f=f!=null?f.concat([a]):null,Wh(4194308,4,IE.bind(null,c,a),f)},useLayoutEffect:function(a,c){return Wh(4194308,4,a,c)},useInsertionEffect:function(a,c){Wh(4,2,a,c)},useMemo:function(a,c){var f=xr();c=c===void 0?null:c;var g=a();if(sl){ce(!0);try{a()}finally{ce(!1)}}return f.memoizedState=[g,c],g},useReducer:function(a,c,f){var g=xr();if(f!==void 0){var w=f(c);if(sl){ce(!0);try{f(c)}finally{ce(!1)}}}else w=c;return g.memoizedState=g.baseState=w,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:w},g.queue=a,a=a.dispatch=YB.bind(null,lt,a),[g.memoizedState,a]},useRef:function(a){var c=xr();return a={current:a},c.memoizedState=a},useState:function(a){a=av(a);var c=a.queue,f=WE.bind(null,lt,c);return c.dispatch=f,[a.memoizedState,f]},useDebugValue:uv,useDeferredValue:function(a,c){var f=xr();return dv(f,a,c)},useTransition:function(){var a=av(!1);return a=BE.bind(null,lt,a.queue,!0,!1),xr().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,c,f){var g=lt,w=xr();if(wt){if(f===void 0)throw Error(r(407));f=f()}else{if(f=c(),Ht===null)throw Error(r(349));(bt&127)!==0||mE(g,c,f)}w.memoizedState=f;var S={value:f,getSnapshot:c};return w.queue=S,RE(yE.bind(null,g,S,a),[a]),g.flags|=2048,mc(9,{destroy:void 0},gE.bind(null,g,S,f,c),null),f},useId:function(){var a=xr(),c=Ht.identifierPrefix;if(wt){var f=ni,g=ti;f=(g&~(1<<32-be(g)-1)).toString(32)+f,c="_"+c+"R_"+f,f=Fh++,0<f&&(c+="H"+f.toString(32)),c+="_"}else f=FB++,c="_"+c+"r_"+f.toString(32)+"_";return a.memoizedState=c},useHostTransitionStatus:hv,useFormState:TE,useActionState:TE,useOptimistic:function(a){var c=xr();c.memoizedState=c.baseState=a;var f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return c.queue=f,c=pv.bind(null,lt,!0,f),f.dispatch=c,[a,c]},useMemoCache:sv,useCacheRefresh:function(){return xr().memoizedState=GB.bind(null,lt)},useEffectEvent:function(a){var c=xr(),f={impl:a};return c.memoizedState=f,function(){if((Mt&2)!==0)throw Error(r(440));return f.impl.apply(void 0,arguments)}}},mv={readContext:Jn,use:Hh,useCallback:PE,useContext:Jn,useEffect:cv,useImperativeHandle:LE,useInsertionEffect:jE,useLayoutEffect:DE,useMemo:$E,useReducer:Uh,useRef:AE,useState:function(){return Uh(Oi)},useDebugValue:uv,useDeferredValue:function(a,c){var f=xn();return zE(f,Lt.memoizedState,a,c)},useTransition:function(){var a=Uh(Oi)[0],c=xn().memoizedState;return[typeof a=="boolean"?a:Xu(a),c]},useSyncExternalStore:pE,useId:HE,useHostTransitionStatus:hv,useFormState:NE,useActionState:NE,useOptimistic:function(a,c){var f=xn();return wE(f,Lt,a,c)},useMemoCache:sv,useCacheRefresh:UE};mv.useEffectEvent=OE;var KE={readContext:Jn,use:Hh,useCallback:PE,useContext:Jn,useEffect:cv,useImperativeHandle:LE,useInsertionEffect:jE,useLayoutEffect:DE,useMemo:$E,useReducer:ov,useRef:AE,useState:function(){return ov(Oi)},useDebugValue:uv,useDeferredValue:function(a,c){var f=xn();return Lt===null?dv(f,a,c):zE(f,Lt.memoizedState,a,c)},useTransition:function(){var a=ov(Oi)[0],c=xn().memoizedState;return[typeof a=="boolean"?a:Xu(a),c]},useSyncExternalStore:pE,useId:HE,useHostTransitionStatus:hv,useFormState:_E,useActionState:_E,useOptimistic:function(a,c){var f=xn();return Lt!==null?wE(f,Lt,a,c):(f.baseState=a,[a,f.queue.dispatch])},useMemoCache:sv,useCacheRefresh:UE};KE.useEffectEvent=OE;function gv(a,c,f,g){c=a.memoizedState,f=f(g,c),f=f==null?c:m({},c,f),a.memoizedState=f,a.lanes===0&&(a.updateQueue.baseState=f)}var yv={enqueueSetState:function(a,c,f){a=a._reactInternals;var g=Xr(),w=Ao(g);w.payload=c,f!=null&&(w.callback=f),c=Ro(a,w,g),c!==null&&(Pr(c,a,g),Gu(c,a,g))},enqueueReplaceState:function(a,c,f){a=a._reactInternals;var g=Xr(),w=Ao(g);w.tag=1,w.payload=c,f!=null&&(w.callback=f),c=Ro(a,w,g),c!==null&&(Pr(c,a,g),Gu(c,a,g))},enqueueForceUpdate:function(a,c){a=a._reactInternals;var f=Xr(),g=Ao(f);g.tag=2,c!=null&&(g.callback=c),c=Ro(a,g,f),c!==null&&(Pr(c,a,f),Gu(c,a,f))}};function ZE(a,c,f,g,w,S,R){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(g,S,R):c.prototype&&c.prototype.isPureReactComponent?!zu(f,g)||!zu(w,S):!0}function XE(a,c,f,g){a=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(f,g),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(f,g),c.state!==a&&yv.enqueueReplaceState(c,c.state,null)}function il(a,c){var f=c;if("ref"in c){f={};for(var g in c)g!=="ref"&&(f[g]=c[g])}if(a=a.defaultProps){f===c&&(f=m({},f));for(var w in a)f[w]===void 0&&(f[w]=a[w])}return f}function JE(a){Eh(a)}function QE(a){console.error(a)}function eT(a){Eh(a)}function Yh(a,c){try{var f=a.onUncaughtError;f(c.value,{componentStack:c.stack})}catch(g){setTimeout(function(){throw g})}}function tT(a,c,f){try{var g=a.onCaughtError;g(f.value,{componentStack:f.stack,errorBoundary:c.tag===1?c.stateNode:null})}catch(w){setTimeout(function(){throw w})}}function bv(a,c,f){return f=Ao(f),f.tag=3,f.payload={element:null},f.callback=function(){Yh(a,c)},f}function nT(a){return a=Ao(a),a.tag=3,a}function rT(a,c,f,g){var w=f.type.getDerivedStateFromError;if(typeof w=="function"){var S=g.value;a.payload=function(){return w(S)},a.callback=function(){tT(c,f,g)}}var R=f.stateNode;R!==null&&typeof R.componentDidCatch=="function"&&(a.callback=function(){tT(c,f,g),typeof w!="function"&&(Po===null?Po=new Set([this]):Po.add(this));var D=g.stack;this.componentDidCatch(g.value,{componentStack:D!==null?D:""})})}function KB(a,c,f,g,w){if(f.flags|=32768,g!==null&&typeof g=="object"&&typeof g.then=="function"){if(c=f.alternate,c!==null&&ac(c,f,w,!0),f=Gr.current,f!==null){switch(f.tag){case 31:case 13:return bs===null?op():f.alternate===null&&hn===0&&(hn=3),f.flags&=-257,f.flags|=65536,f.lanes=w,g===Ih?f.flags|=16384:(c=f.updateQueue,c===null?f.updateQueue=new Set([g]):c.add(g),Hv(a,g,w)),!1;case 22:return f.flags|=65536,g===Ih?f.flags|=16384:(c=f.updateQueue,c===null?(c={transitions:null,markerInstances:null,retryQueue:new Set([g])},f.updateQueue=c):(f=c.retryQueue,f===null?c.retryQueue=new Set([g]):f.add(g)),Hv(a,g,w)),!1}throw Error(r(435,f.tag))}return Hv(a,g,w),op(),!1}if(wt)return c=Gr.current,c!==null?((c.flags&65536)===0&&(c.flags|=256),c.flags|=65536,c.lanes=w,g!==Pb&&(a=Error(r(422),{cause:g}),Vu(ps(a,f)))):(g!==Pb&&(c=Error(r(423),{cause:g}),Vu(ps(c,f))),a=a.current.alternate,a.flags|=65536,w&=-w,a.lanes|=w,g=ps(g,f),w=bv(a.stateNode,g,w),Yb(a,w),hn!==4&&(hn=2)),!1;var S=Error(r(520),{cause:g});if(S=ps(S,f),ad===null?ad=[S]:ad.push(S),hn!==4&&(hn=2),c===null)return!0;g=ps(g,f),f=c;do{switch(f.tag){case 3:return f.flags|=65536,a=w&-w,f.lanes|=a,a=bv(f.stateNode,g,a),Yb(f,a),!1;case 1:if(c=f.type,S=f.stateNode,(f.flags&128)===0&&(typeof c.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(Po===null||!Po.has(S))))return f.flags|=65536,w&=-w,f.lanes|=w,w=nT(w),rT(w,a,f,g),Yb(f,w),!1}f=f.return}while(f!==null);return!1}var vv=Error(r(461)),Nn=!1;function Qn(a,c,f,g){c.child=a===null?aE(c,null,f,g):rl(c,a.child,f,g)}function sT(a,c,f,g,w){f=f.render;var S=c.ref;if("ref"in g){var R={};for(var D in g)D!=="ref"&&(R[D]=g[D])}else R=g;return Qa(c),g=ev(a,c,f,R,S,w),D=tv(),a!==null&&!Nn?(nv(a,c,w),ji(a,c,w)):(wt&&D&&Ib(c),c.flags|=1,Qn(a,c,g,w),c.child)}function iT(a,c,f,g,w){if(a===null){var S=f.type;return typeof S=="function"&&!Ob(S)&&S.defaultProps===void 0&&f.compare===null?(c.tag=15,c.type=S,oT(a,c,S,g,w)):(a=_h(f.type,null,g,c,c.mode,w),a.ref=c.ref,a.return=c,c.child=a)}if(S=a.child,!Nv(a,w)){var R=S.memoizedProps;if(f=f.compare,f=f!==null?f:zu,f(R,g)&&a.ref===c.ref)return ji(a,c,w)}return c.flags|=1,a=Ni(S,g),a.ref=c.ref,a.return=c,c.child=a}function oT(a,c,f,g,w){if(a!==null){var S=a.memoizedProps;if(zu(S,g)&&a.ref===c.ref)if(Nn=!1,c.pendingProps=g=S,Nv(a,w))(a.flags&131072)!==0&&(Nn=!0);else return c.lanes=a.lanes,ji(a,c,w)}return wv(a,c,f,g,w)}function aT(a,c,f,g){var w=g.children,S=a!==null?a.memoizedState:null;if(a===null&&c.stateNode===null&&(c.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),g.mode==="hidden"){if((c.flags&128)!==0){if(S=S!==null?S.baseLanes|f:f,a!==null){for(g=c.child=a.child,w=0;g!==null;)w=w|g.lanes|g.childLanes,g=g.sibling;g=w&~S}else g=0,c.child=null;return lT(a,c,S,f,g)}if((f&536870912)!==0)c.memoizedState={baseLanes:0,cachePool:null},a!==null&&jh(c,S!==null?S.cachePool:null),S!==null?uE(c,S):Zb(),dE(c);else return g=c.lanes=536870912,lT(a,c,S!==null?S.baseLanes|f:f,f,g)}else S!==null?(jh(c,S.cachePool),uE(c,S),jo(),c.memoizedState=null):(a!==null&&jh(c,null),Zb(),jo());return Qn(a,c,w,f),c.child}function ed(a,c){return a!==null&&a.tag===22||c.stateNode!==null||(c.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.sibling}function lT(a,c,f,g,w){var S=Ub();return S=S===null?null:{parent:En._currentValue,pool:S},c.memoizedState={baseLanes:f,cachePool:S},a!==null&&jh(c,null),Zb(),dE(c),a!==null&&ac(a,c,g,!0),c.childLanes=w,null}function Kh(a,c){return c=Xh({mode:c.mode,children:c.children},a.mode),c.ref=a.ref,a.child=c,c.return=a,c}function cT(a,c,f){return rl(c,a.child,null,f),a=Kh(c,c.pendingProps),a.flags|=2,Yr(c),c.memoizedState=null,a}function ZB(a,c,f){var g=c.pendingProps,w=(c.flags&128)!==0;if(c.flags&=-129,a===null){if(wt){if(g.mode==="hidden")return a=Kh(c,g),c.lanes=536870912,ed(null,a);if(Jb(c),(a=Zt)?(a=xN(a,ys),a=a!==null&&a.data==="&"?a:null,a!==null&&(c.memoizedState={dehydrated:a,treeContext:Eo!==null?{id:ti,overflow:ni}:null,retryLane:536870912,hydrationErrors:null},f=q1(a),f.return=c,c.child=f,Xn=c,Zt=null)):a=null,a===null)throw No(c);return c.lanes=536870912,null}return Kh(c,g)}var S=a.memoizedState;if(S!==null){var R=S.dehydrated;if(Jb(c),w)if(c.flags&256)c.flags&=-257,c=cT(a,c,f);else if(c.memoizedState!==null)c.child=a.child,c.flags|=128,c=null;else throw Error(r(558));else if(Nn||ac(a,c,f,!1),w=(f&a.childLanes)!==0,Nn||w){if(g=Ht,g!==null&&(R=Rs(g,f),R!==0&&R!==S.retryLane))throw S.retryLane=R,Ka(a,R),Pr(g,a,R),vv;op(),c=cT(a,c,f)}else a=S.treeContext,Zt=vs(R.nextSibling),Xn=c,wt=!0,To=null,ys=!1,a!==null&&K1(c,a),c=Kh(c,g),c.flags|=4096;return c}return a=Ni(a.child,{mode:g.mode,children:g.children}),a.ref=c.ref,c.child=a,a.return=c,a}function Zh(a,c){var f=c.ref;if(f===null)a!==null&&a.ref!==null&&(c.flags|=4194816);else{if(typeof f!="function"&&typeof f!="object")throw Error(r(284));(a===null||a.ref!==f)&&(c.flags|=4194816)}}function wv(a,c,f,g,w){return Qa(c),f=ev(a,c,f,g,void 0,w),g=tv(),a!==null&&!Nn?(nv(a,c,w),ji(a,c,w)):(wt&&g&&Ib(c),c.flags|=1,Qn(a,c,f,w),c.child)}function uT(a,c,f,g,w,S){return Qa(c),c.updateQueue=null,f=hE(c,g,f,w),fE(a),g=tv(),a!==null&&!Nn?(nv(a,c,S),ji(a,c,S)):(wt&&g&&Ib(c),c.flags|=1,Qn(a,c,f,S),c.child)}function dT(a,c,f,g,w){if(Qa(c),c.stateNode===null){var S=rc,R=f.contextType;typeof R=="object"&&R!==null&&(S=Jn(R)),S=new f(g,S),c.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=yv,c.stateNode=S,S._reactInternals=c,S=c.stateNode,S.props=g,S.state=c.memoizedState,S.refs={},qb(c),R=f.contextType,S.context=typeof R=="object"&&R!==null?Jn(R):rc,S.state=c.memoizedState,R=f.getDerivedStateFromProps,typeof R=="function"&&(gv(c,f,R,g),S.state=c.memoizedState),typeof f.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(R=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),R!==S.state&&yv.enqueueReplaceState(S,S.state,null),Ku(c,g,S,w),Yu(),S.state=c.memoizedState),typeof S.componentDidMount=="function"&&(c.flags|=4194308),g=!0}else if(a===null){S=c.stateNode;var D=c.memoizedProps,H=il(f,D);S.props=H;var ne=S.context,le=f.contextType;R=rc,typeof le=="object"&&le!==null&&(R=Jn(le));var me=f.getDerivedStateFromProps;le=typeof me=="function"||typeof S.getSnapshotBeforeUpdate=="function",D=c.pendingProps!==D,le||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(D||ne!==R)&&XE(c,S,g,R),_o=!1;var re=c.memoizedState;S.state=re,Ku(c,g,S,w),Yu(),ne=c.memoizedState,D||re!==ne||_o?(typeof me=="function"&&(gv(c,f,me,g),ne=c.memoizedState),(H=_o||ZE(c,f,H,g,re,ne,R))?(le||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(c.flags|=4194308)):(typeof S.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=g,c.memoizedState=ne),S.props=g,S.state=ne,S.context=R,g=H):(typeof S.componentDidMount=="function"&&(c.flags|=4194308),g=!1)}else{S=c.stateNode,Gb(a,c),R=c.memoizedProps,le=il(f,R),S.props=le,me=c.pendingProps,re=S.context,ne=f.contextType,H=rc,typeof ne=="object"&&ne!==null&&(H=Jn(ne)),D=f.getDerivedStateFromProps,(ne=typeof D=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(R!==me||re!==H)&&XE(c,S,g,H),_o=!1,re=c.memoizedState,S.state=re,Ku(c,g,S,w),Yu();var se=c.memoizedState;R!==me||re!==se||_o||a!==null&&a.dependencies!==null&&Rh(a.dependencies)?(typeof D=="function"&&(gv(c,f,D,g),se=c.memoizedState),(le=_o||ZE(c,f,le,g,re,se,H)||a!==null&&a.dependencies!==null&&Rh(a.dependencies))?(ne||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(g,se,H),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(g,se,H)),typeof S.componentDidUpdate=="function"&&(c.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof S.componentDidUpdate!="function"||R===a.memoizedProps&&re===a.memoizedState||(c.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||R===a.memoizedProps&&re===a.memoizedState||(c.flags|=1024),c.memoizedProps=g,c.memoizedState=se),S.props=g,S.state=se,S.context=H,g=le):(typeof S.componentDidUpdate!="function"||R===a.memoizedProps&&re===a.memoizedState||(c.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||R===a.memoizedProps&&re===a.memoizedState||(c.flags|=1024),g=!1)}return S=g,Zh(a,c),g=(c.flags&128)!==0,S||g?(S=c.stateNode,f=g&&typeof f.getDerivedStateFromError!="function"?null:S.render(),c.flags|=1,a!==null&&g?(c.child=rl(c,a.child,null,w),c.child=rl(c,null,f,w)):Qn(a,c,f,w),c.memoizedState=S.state,a=c.child):a=ji(a,c,w),a}function fT(a,c,f,g){return Xa(),c.flags|=256,Qn(a,c,f,g),c.child}var xv={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Sv(a){return{baseLanes:a,cachePool:tE()}}function kv(a,c,f){return a=a!==null?a.childLanes&~f:0,c&&(a|=Zr),a}function hT(a,c,f){var g=c.pendingProps,w=!1,S=(c.flags&128)!==0,R;if((R=S)||(R=a!==null&&a.memoizedState===null?!1:(wn.current&2)!==0),R&&(w=!0,c.flags&=-129),R=(c.flags&32)!==0,c.flags&=-33,a===null){if(wt){if(w?Oo(c):jo(),(a=Zt)?(a=xN(a,ys),a=a!==null&&a.data!=="&"?a:null,a!==null&&(c.memoizedState={dehydrated:a,treeContext:Eo!==null?{id:ti,overflow:ni}:null,retryLane:536870912,hydrationErrors:null},f=q1(a),f.return=c,c.child=f,Xn=c,Zt=null)):a=null,a===null)throw No(c);return i0(a)?c.lanes=32:c.lanes=536870912,null}var D=g.children;return g=g.fallback,w?(jo(),w=c.mode,D=Xh({mode:"hidden",children:D},w),g=Za(g,w,f,null),D.return=c,g.return=c,D.sibling=g,c.child=D,g=c.child,g.memoizedState=Sv(f),g.childLanes=kv(a,R,f),c.memoizedState=xv,ed(null,g)):(Oo(c),Cv(c,D))}var H=a.memoizedState;if(H!==null&&(D=H.dehydrated,D!==null)){if(S)c.flags&256?(Oo(c),c.flags&=-257,c=Ev(a,c,f)):c.memoizedState!==null?(jo(),c.child=a.child,c.flags|=128,c=null):(jo(),D=g.fallback,w=c.mode,g=Xh({mode:"visible",children:g.children},w),D=Za(D,w,f,null),D.flags|=2,g.return=c,D.return=c,g.sibling=D,c.child=g,rl(c,a.child,null,f),g=c.child,g.memoizedState=Sv(f),g.childLanes=kv(a,R,f),c.memoizedState=xv,c=ed(null,g));else if(Oo(c),i0(D)){if(R=D.nextSibling&&D.nextSibling.dataset,R)var ne=R.dgst;R=ne,g=Error(r(419)),g.stack="",g.digest=R,Vu({value:g,source:null,stack:null}),c=Ev(a,c,f)}else if(Nn||ac(a,c,f,!1),R=(f&a.childLanes)!==0,Nn||R){if(R=Ht,R!==null&&(g=Rs(R,f),g!==0&&g!==H.retryLane))throw H.retryLane=g,Ka(a,g),Pr(R,a,g),vv;s0(D)||op(),c=Ev(a,c,f)}else s0(D)?(c.flags|=192,c.child=a.child,c=null):(a=H.treeContext,Zt=vs(D.nextSibling),Xn=c,wt=!0,To=null,ys=!1,a!==null&&K1(c,a),c=Cv(c,g.children),c.flags|=4096);return c}return w?(jo(),D=g.fallback,w=c.mode,H=a.child,ne=H.sibling,g=Ni(H,{mode:"hidden",children:g.children}),g.subtreeFlags=H.subtreeFlags&65011712,ne!==null?D=Ni(ne,D):(D=Za(D,w,f,null),D.flags|=2),D.return=c,g.return=c,g.sibling=D,c.child=g,ed(null,g),g=c.child,D=a.child.memoizedState,D===null?D=Sv(f):(w=D.cachePool,w!==null?(H=En._currentValue,w=w.parent!==H?{parent:H,pool:H}:w):w=tE(),D={baseLanes:D.baseLanes|f,cachePool:w}),g.memoizedState=D,g.childLanes=kv(a,R,f),c.memoizedState=xv,ed(a.child,g)):(Oo(c),f=a.child,a=f.sibling,f=Ni(f,{mode:"visible",children:g.children}),f.return=c,f.sibling=null,a!==null&&(R=c.deletions,R===null?(c.deletions=[a],c.flags|=16):R.push(a)),c.child=f,c.memoizedState=null,f)}function Cv(a,c){return c=Xh({mode:"visible",children:c},a.mode),c.return=a,a.child=c}function Xh(a,c){return a=qr(22,a,null,c),a.lanes=0,a}function Ev(a,c,f){return rl(c,a.child,null,f),a=Cv(c,c.pendingProps.children),a.flags|=2,c.memoizedState=null,a}function pT(a,c,f){a.lanes|=c;var g=a.alternate;g!==null&&(g.lanes|=c),Bb(a.return,c,f)}function Tv(a,c,f,g,w,S){var R=a.memoizedState;R===null?a.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:g,tail:f,tailMode:w,treeForkCount:S}:(R.isBackwards=c,R.rendering=null,R.renderingStartTime=0,R.last=g,R.tail=f,R.tailMode=w,R.treeForkCount=S)}function mT(a,c,f){var g=c.pendingProps,w=g.revealOrder,S=g.tail;g=g.children;var R=wn.current,D=(R&2)!==0;if(D?(R=R&1|2,c.flags|=128):R&=1,ie(wn,R),Qn(a,c,g,f),g=wt?Fu:0,!D&&a!==null&&(a.flags&128)!==0)e:for(a=c.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&pT(a,f,c);else if(a.tag===19)pT(a,f,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(w){case"forwards":for(f=c.child,w=null;f!==null;)a=f.alternate,a!==null&&zh(a)===null&&(w=f),f=f.sibling;f=w,f===null?(w=c.child,c.child=null):(w=f.sibling,f.sibling=null),Tv(c,!1,w,f,S,g);break;case"backwards":case"unstable_legacy-backwards":for(f=null,w=c.child,c.child=null;w!==null;){if(a=w.alternate,a!==null&&zh(a)===null){c.child=w;break}a=w.sibling,w.sibling=f,f=w,w=a}Tv(c,!0,f,null,S,g);break;case"together":Tv(c,!1,null,null,void 0,g);break;default:c.memoizedState=null}return c.child}function ji(a,c,f){if(a!==null&&(c.dependencies=a.dependencies),Lo|=c.lanes,(f&c.childLanes)===0)if(a!==null){if(ac(a,c,f,!1),(f&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,f=Ni(a,a.pendingProps),c.child=f,f.return=c;a.sibling!==null;)a=a.sibling,f=f.sibling=Ni(a,a.pendingProps),f.return=c;f.sibling=null}return c.child}function Nv(a,c){return(a.lanes&c)!==0?!0:(a=a.dependencies,!!(a!==null&&Rh(a)))}function XB(a,c,f){switch(c.tag){case 3:Ne(c,c.stateNode.containerInfo),Mo(c,En,a.memoizedState.cache),Xa();break;case 27:case 5:ye(c);break;case 4:Ne(c,c.stateNode.containerInfo);break;case 10:Mo(c,c.type,c.memoizedProps.value);break;case 31:if(c.memoizedState!==null)return c.flags|=128,Jb(c),null;break;case 13:var g=c.memoizedState;if(g!==null)return g.dehydrated!==null?(Oo(c),c.flags|=128,null):(f&c.child.childLanes)!==0?hT(a,c,f):(Oo(c),a=ji(a,c,f),a!==null?a.sibling:null);Oo(c);break;case 19:var w=(a.flags&128)!==0;if(g=(f&c.childLanes)!==0,g||(ac(a,c,f,!1),g=(f&c.childLanes)!==0),w){if(g)return mT(a,c,f);c.flags|=128}if(w=c.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),ie(wn,wn.current),g)break;return null;case 22:return c.lanes=0,aT(a,c,f,c.pendingProps);case 24:Mo(c,En,a.memoizedState.cache)}return ji(a,c,f)}function gT(a,c,f){if(a!==null)if(a.memoizedProps!==c.pendingProps)Nn=!0;else{if(!Nv(a,f)&&(c.flags&128)===0)return Nn=!1,XB(a,c,f);Nn=(a.flags&131072)!==0}else Nn=!1,wt&&(c.flags&1048576)!==0&&Y1(c,Fu,c.index);switch(c.lanes=0,c.tag){case 16:e:{var g=c.pendingProps;if(a=tl(c.elementType),c.type=a,typeof a=="function")Ob(a)?(g=il(a,g),c.tag=1,c=dT(null,c,a,g,f)):(c.tag=0,c=wv(null,c,a,g,f));else{if(a!=null){var w=a.$$typeof;if(w===N){c.tag=11,c=sT(null,c,a,g,f);break e}else if(w===j){c.tag=14,c=iT(null,c,a,g,f);break e}}throw c=Q(a)||a,Error(r(306,c,""))}}return c;case 0:return wv(a,c,c.type,c.pendingProps,f);case 1:return g=c.type,w=il(g,c.pendingProps),dT(a,c,g,w,f);case 3:e:{if(Ne(c,c.stateNode.containerInfo),a===null)throw Error(r(387));g=c.pendingProps;var S=c.memoizedState;w=S.element,Gb(a,c),Ku(c,g,null,f);var R=c.memoizedState;if(g=R.cache,Mo(c,En,g),g!==S.cache&&Fb(c,[En],f,!0),Yu(),g=R.element,S.isDehydrated)if(S={element:g,isDehydrated:!1,cache:R.cache},c.updateQueue.baseState=S,c.memoizedState=S,c.flags&256){c=fT(a,c,g,f);break e}else if(g!==w){w=ps(Error(r(424)),c),Vu(w),c=fT(a,c,g,f);break e}else for(a=c.stateNode.containerInfo,a.nodeType===9?a=a.body:a=a.nodeName==="HTML"?a.ownerDocument.body:a,Zt=vs(a.firstChild),Xn=c,wt=!0,To=null,ys=!0,f=aE(c,null,g,f),c.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling;else{if(Xa(),g===w){c=ji(a,c,f);break e}Qn(a,c,g,f)}c=c.child}return c;case 26:return Zh(a,c),a===null?(f=NN(c.type,null,c.pendingProps,null))?c.memoizedState=f:wt||(f=c.type,a=c.pendingProps,g=hp(De.current).createElement(f),g[bn]=c,g[Cn]=a,er(g,f,a),yt(g),c.stateNode=g):c.memoizedState=NN(c.type,a.memoizedProps,c.pendingProps,a.memoizedState),null;case 27:return ye(c),a===null&&wt&&(g=c.stateNode=CN(c.type,c.pendingProps,De.current),Xn=c,ys=!0,w=Zt,Fo(c.type)?(o0=w,Zt=vs(g.firstChild)):Zt=w),Qn(a,c,c.pendingProps.children,f),Zh(a,c),a===null&&(c.flags|=4194304),c.child;case 5:return a===null&&wt&&((w=g=Zt)&&(g=N3(g,c.type,c.pendingProps,ys),g!==null?(c.stateNode=g,Xn=c,Zt=vs(g.firstChild),ys=!1,w=!0):w=!1),w||No(c)),ye(c),w=c.type,S=c.pendingProps,R=a!==null?a.memoizedProps:null,g=S.children,t0(w,S)?g=null:R!==null&&t0(w,R)&&(c.flags|=32),c.memoizedState!==null&&(w=ev(a,c,VB,null,null,f),md._currentValue=w),Zh(a,c),Qn(a,c,g,f),c.child;case 6:return a===null&&wt&&((a=f=Zt)&&(f=M3(f,c.pendingProps,ys),f!==null?(c.stateNode=f,Xn=c,Zt=null,a=!0):a=!1),a||No(c)),null;case 13:return hT(a,c,f);case 4:return Ne(c,c.stateNode.containerInfo),g=c.pendingProps,a===null?c.child=rl(c,null,g,f):Qn(a,c,g,f),c.child;case 11:return sT(a,c,c.type,c.pendingProps,f);case 7:return Qn(a,c,c.pendingProps,f),c.child;case 8:return Qn(a,c,c.pendingProps.children,f),c.child;case 12:return Qn(a,c,c.pendingProps.children,f),c.child;case 10:return g=c.pendingProps,Mo(c,c.type,g.value),Qn(a,c,g.children,f),c.child;case 9:return w=c.type._context,g=c.pendingProps.children,Qa(c),w=Jn(w),g=g(w),c.flags|=1,Qn(a,c,g,f),c.child;case 14:return iT(a,c,c.type,c.pendingProps,f);case 15:return oT(a,c,c.type,c.pendingProps,f);case 19:return mT(a,c,f);case 31:return ZB(a,c,f);case 22:return aT(a,c,f,c.pendingProps);case 24:return Qa(c),g=Jn(En),a===null?(w=Ub(),w===null&&(w=Ht,S=Vb(),w.pooledCache=S,S.refCount++,S!==null&&(w.pooledCacheLanes|=f),w=S),c.memoizedState={parent:g,cache:w},qb(c),Mo(c,En,w)):((a.lanes&f)!==0&&(Gb(a,c),Ku(c,null,null,f),Yu()),w=a.memoizedState,S=c.memoizedState,w.parent!==g?(w={parent:g,cache:g},c.memoizedState=w,c.lanes===0&&(c.memoizedState=c.updateQueue.baseState=w),Mo(c,En,g)):(g=S.cache,Mo(c,En,g),g!==w.cache&&Fb(c,[En],f,!0))),Qn(a,c,c.pendingProps.children,f),c.child;case 29:throw c.pendingProps}throw Error(r(156,c.tag))}function Di(a){a.flags|=4}function Mv(a,c,f,g,w){if((c=(a.mode&32)!==0)&&(c=!1),c){if(a.flags|=16777216,(w&335544128)===w)if(a.stateNode.complete)a.flags|=8192;else if(HT())a.flags|=8192;else throw nl=Ih,Wb}else a.flags&=-16777217}function yT(a,c){if(c.type!=="stylesheet"||(c.state.loading&4)!==0)a.flags&=-16777217;else if(a.flags|=16777216,!ON(c))if(HT())a.flags|=8192;else throw nl=Ih,Wb}function Jh(a,c){c!==null&&(a.flags|=4),a.flags&16384&&(c=a.tag!==22?wr():536870912,a.lanes|=c,vc|=c)}function td(a,c){if(!wt)switch(a.tailMode){case"hidden":c=a.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?a.tail=null:f.sibling=null;break;case"collapsed":f=a.tail;for(var g=null;f!==null;)f.alternate!==null&&(g=f),f=f.sibling;g===null?c||a.tail===null?a.tail=null:a.tail.sibling=null:g.sibling=null}}function Xt(a){var c=a.alternate!==null&&a.alternate.child===a.child,f=0,g=0;if(c)for(var w=a.child;w!==null;)f|=w.lanes|w.childLanes,g|=w.subtreeFlags&65011712,g|=w.flags&65011712,w.return=a,w=w.sibling;else for(w=a.child;w!==null;)f|=w.lanes|w.childLanes,g|=w.subtreeFlags,g|=w.flags,w.return=a,w=w.sibling;return a.subtreeFlags|=g,a.childLanes=f,c}function JB(a,c,f){var g=c.pendingProps;switch(Lb(c),c.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xt(c),null;case 1:return Xt(c),null;case 3:return f=c.stateNode,g=null,a!==null&&(g=a.memoizedState.cache),c.memoizedState.cache!==g&&(c.flags|=2048),Ai(En),oe(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(a===null||a.child===null)&&(oc(c)?Di(c):a===null||a.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,$b())),Xt(c),null;case 26:var w=c.type,S=c.memoizedState;return a===null?(Di(c),S!==null?(Xt(c),yT(c,S)):(Xt(c),Mv(c,w,null,g,f))):S?S!==a.memoizedState?(Di(c),Xt(c),yT(c,S)):(Xt(c),c.flags&=-16777217):(a=a.memoizedProps,a!==g&&Di(c),Xt(c),Mv(c,w,a,g,f)),null;case 27:if(Pe(c),f=De.current,w=c.type,a!==null&&c.stateNode!=null)a.memoizedProps!==g&&Di(c);else{if(!g){if(c.stateNode===null)throw Error(r(166));return Xt(c),null}a=de.current,oc(c)?Z1(c):(a=CN(w,g,f),c.stateNode=a,Di(c))}return Xt(c),null;case 5:if(Pe(c),w=c.type,a!==null&&c.stateNode!=null)a.memoizedProps!==g&&Di(c);else{if(!g){if(c.stateNode===null)throw Error(r(166));return Xt(c),null}if(S=de.current,oc(c))Z1(c);else{var R=hp(De.current);switch(S){case 1:S=R.createElementNS("http://www.w3.org/2000/svg",w);break;case 2:S=R.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;default:switch(w){case"svg":S=R.createElementNS("http://www.w3.org/2000/svg",w);break;case"math":S=R.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;case"script":S=R.createElement("div"),S.innerHTML="<script><\/script>",S=S.removeChild(S.firstChild);break;case"select":S=typeof g.is=="string"?R.createElement("select",{is:g.is}):R.createElement("select"),g.multiple?S.multiple=!0:g.size&&(S.size=g.size);break;default:S=typeof g.is=="string"?R.createElement(w,{is:g.is}):R.createElement(w)}}S[bn]=c,S[Cn]=g;e:for(R=c.child;R!==null;){if(R.tag===5||R.tag===6)S.appendChild(R.stateNode);else if(R.tag!==4&&R.tag!==27&&R.child!==null){R.child.return=R,R=R.child;continue}if(R===c)break e;for(;R.sibling===null;){if(R.return===null||R.return===c)break e;R=R.return}R.sibling.return=R.return,R=R.sibling}c.stateNode=S;e:switch(er(S,w,g),w){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&Di(c)}}return Xt(c),Mv(c,c.type,a===null?null:a.memoizedProps,c.pendingProps,f),null;case 6:if(a&&c.stateNode!=null)a.memoizedProps!==g&&Di(c);else{if(typeof g!="string"&&c.stateNode===null)throw Error(r(166));if(a=De.current,oc(c)){if(a=c.stateNode,f=c.memoizedProps,g=null,w=Xn,w!==null)switch(w.tag){case 27:case 5:g=w.memoizedProps}a[bn]=c,a=!!(a.nodeValue===f||g!==null&&g.suppressHydrationWarning===!0||hN(a.nodeValue,f)),a||No(c,!0)}else a=hp(a).createTextNode(g),a[bn]=c,c.stateNode=a}return Xt(c),null;case 31:if(f=c.memoizedState,a===null||a.memoizedState!==null){if(g=oc(c),f!==null){if(a===null){if(!g)throw Error(r(318));if(a=c.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(557));a[bn]=c}else Xa(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Xt(c),a=!1}else f=$b(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=f),a=!0;if(!a)return c.flags&256?(Yr(c),c):(Yr(c),null);if((c.flags&128)!==0)throw Error(r(558))}return Xt(c),null;case 13:if(g=c.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(w=oc(c),g!==null&&g.dehydrated!==null){if(a===null){if(!w)throw Error(r(318));if(w=c.memoizedState,w=w!==null?w.dehydrated:null,!w)throw Error(r(317));w[bn]=c}else Xa(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Xt(c),w=!1}else w=$b(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=w),w=!0;if(!w)return c.flags&256?(Yr(c),c):(Yr(c),null)}return Yr(c),(c.flags&128)!==0?(c.lanes=f,c):(f=g!==null,a=a!==null&&a.memoizedState!==null,f&&(g=c.child,w=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(w=g.alternate.memoizedState.cachePool.pool),S=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(S=g.memoizedState.cachePool.pool),S!==w&&(g.flags|=2048)),f!==a&&f&&(c.child.flags|=8192),Jh(c,c.updateQueue),Xt(c),null);case 4:return oe(),a===null&&Zv(c.stateNode.containerInfo),Xt(c),null;case 10:return Ai(c.type),Xt(c),null;case 19:if(q(wn),g=c.memoizedState,g===null)return Xt(c),null;if(w=(c.flags&128)!==0,S=g.rendering,S===null)if(w)td(g,!1);else{if(hn!==0||a!==null&&(a.flags&128)!==0)for(a=c.child;a!==null;){if(S=zh(a),S!==null){for(c.flags|=128,td(g,!1),a=S.updateQueue,c.updateQueue=a,Jh(c,a),c.subtreeFlags=0,a=f,f=c.child;f!==null;)W1(f,a),f=f.sibling;return ie(wn,wn.current&1|2),wt&&Mi(c,g.treeForkCount),c.child}a=a.sibling}g.tail!==null&&ht()>rp&&(c.flags|=128,w=!0,td(g,!1),c.lanes=4194304)}else{if(!w)if(a=zh(S),a!==null){if(c.flags|=128,w=!0,a=a.updateQueue,c.updateQueue=a,Jh(c,a),td(g,!0),g.tail===null&&g.tailMode==="hidden"&&!S.alternate&&!wt)return Xt(c),null}else 2*ht()-g.renderingStartTime>rp&&f!==536870912&&(c.flags|=128,w=!0,td(g,!1),c.lanes=4194304);g.isBackwards?(S.sibling=c.child,c.child=S):(a=g.last,a!==null?a.sibling=S:c.child=S,g.last=S)}return g.tail!==null?(a=g.tail,g.rendering=a,g.tail=a.sibling,g.renderingStartTime=ht(),a.sibling=null,f=wn.current,ie(wn,w?f&1|2:f&1),wt&&Mi(c,g.treeForkCount),a):(Xt(c),null);case 22:case 23:return Yr(c),Xb(),g=c.memoizedState!==null,a!==null?a.memoizedState!==null!==g&&(c.flags|=8192):g&&(c.flags|=8192),g?(f&536870912)!==0&&(c.flags&128)===0&&(Xt(c),c.subtreeFlags&6&&(c.flags|=8192)):Xt(c),f=c.updateQueue,f!==null&&Jh(c,f.retryQueue),f=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),g=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(g=c.memoizedState.cachePool.pool),g!==f&&(c.flags|=2048),a!==null&&q(el),null;case 24:return f=null,a!==null&&(f=a.memoizedState.cache),c.memoizedState.cache!==f&&(c.flags|=2048),Ai(En),Xt(c),null;case 25:return null;case 30:return null}throw Error(r(156,c.tag))}function QB(a,c){switch(Lb(c),c.tag){case 1:return a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 3:return Ai(En),oe(),a=c.flags,(a&65536)!==0&&(a&128)===0?(c.flags=a&-65537|128,c):null;case 26:case 27:case 5:return Pe(c),null;case 31:if(c.memoizedState!==null){if(Yr(c),c.alternate===null)throw Error(r(340));Xa()}return a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 13:if(Yr(c),a=c.memoizedState,a!==null&&a.dehydrated!==null){if(c.alternate===null)throw Error(r(340));Xa()}return a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 19:return q(wn),null;case 4:return oe(),null;case 10:return Ai(c.type),null;case 22:case 23:return Yr(c),Xb(),a!==null&&q(el),a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 24:return Ai(En),null;case 25:return null;default:return null}}function bT(a,c){switch(Lb(c),c.tag){case 3:Ai(En),oe();break;case 26:case 27:case 5:Pe(c);break;case 4:oe();break;case 31:c.memoizedState!==null&&Yr(c);break;case 13:Yr(c);break;case 19:q(wn);break;case 10:Ai(c.type);break;case 22:case 23:Yr(c),Xb(),a!==null&&q(el);break;case 24:Ai(En)}}function nd(a,c){try{var f=c.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var w=g.next;f=w;do{if((f.tag&a)===a){g=void 0;var S=f.create,R=f.inst;g=S(),R.destroy=g}f=f.next}while(f!==w)}}catch(D){Ot(c,c.return,D)}}function Do(a,c,f){try{var g=c.updateQueue,w=g!==null?g.lastEffect:null;if(w!==null){var S=w.next;g=S;do{if((g.tag&a)===a){var R=g.inst,D=R.destroy;if(D!==void 0){R.destroy=void 0,w=c;var H=f,ne=D;try{ne()}catch(le){Ot(w,H,le)}}}g=g.next}while(g!==S)}}catch(le){Ot(c,c.return,le)}}function vT(a){var c=a.updateQueue;if(c!==null){var f=a.stateNode;try{cE(c,f)}catch(g){Ot(a,a.return,g)}}}function wT(a,c,f){f.props=il(a.type,a.memoizedProps),f.state=a.memoizedState;try{f.componentWillUnmount()}catch(g){Ot(a,c,g)}}function rd(a,c){try{var f=a.ref;if(f!==null){switch(a.tag){case 26:case 27:case 5:var g=a.stateNode;break;case 30:g=a.stateNode;break;default:g=a.stateNode}typeof f=="function"?a.refCleanup=f(g):f.current=g}}catch(w){Ot(a,c,w)}}function ri(a,c){var f=a.ref,g=a.refCleanup;if(f!==null)if(typeof g=="function")try{g()}catch(w){Ot(a,c,w)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(w){Ot(a,c,w)}else f.current=null}function xT(a){var c=a.type,f=a.memoizedProps,g=a.stateNode;try{e:switch(c){case"button":case"input":case"select":case"textarea":f.autoFocus&&g.focus();break e;case"img":f.src?g.src=f.src:f.srcSet&&(g.srcset=f.srcSet)}}catch(w){Ot(a,a.return,w)}}function _v(a,c,f){try{var g=a.stateNode;x3(g,a.type,f,c),g[Cn]=c}catch(w){Ot(a,a.return,w)}}function ST(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&Fo(a.type)||a.tag===4}function Av(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||ST(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&&Fo(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 Rv(a,c,f){var g=a.tag;if(g===5||g===6)a=a.stateNode,c?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(a,c):(c=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,c.appendChild(a),f=f._reactRootContainer,f!=null||c.onclick!==null||(c.onclick=Ei));else if(g!==4&&(g===27&&Fo(a.type)&&(f=a.stateNode,c=null),a=a.child,a!==null))for(Rv(a,c,f),a=a.sibling;a!==null;)Rv(a,c,f),a=a.sibling}function Qh(a,c,f){var g=a.tag;if(g===5||g===6)a=a.stateNode,c?f.insertBefore(a,c):f.appendChild(a);else if(g!==4&&(g===27&&Fo(a.type)&&(f=a.stateNode),a=a.child,a!==null))for(Qh(a,c,f),a=a.sibling;a!==null;)Qh(a,c,f),a=a.sibling}function kT(a){var c=a.stateNode,f=a.memoizedProps;try{for(var g=a.type,w=c.attributes;w.length;)c.removeAttributeNode(w[0]);er(c,g,f),c[bn]=a,c[Cn]=f}catch(S){Ot(a,a.return,S)}}var Ii=!1,Mn=!1,Ov=!1,CT=typeof WeakSet=="function"?WeakSet:Set,Fn=null;function e3(a,c){if(a=a.containerInfo,Qv=wp,a=L1(a),Eb(a)){if("selectionStart"in a)var f={start:a.selectionStart,end:a.selectionEnd};else e:{f=(f=a.ownerDocument)&&f.defaultView||window;var g=f.getSelection&&f.getSelection();if(g&&g.rangeCount!==0){f=g.anchorNode;var w=g.anchorOffset,S=g.focusNode;g=g.focusOffset;try{f.nodeType,S.nodeType}catch{f=null;break e}var R=0,D=-1,H=-1,ne=0,le=0,me=a,re=null;t:for(;;){for(var se;me!==f||w!==0&&me.nodeType!==3||(D=R+w),me!==S||g!==0&&me.nodeType!==3||(H=R+g),me.nodeType===3&&(R+=me.nodeValue.length),(se=me.firstChild)!==null;)re=me,me=se;for(;;){if(me===a)break t;if(re===f&&++ne===w&&(D=R),re===S&&++le===g&&(H=R),(se=me.nextSibling)!==null)break;me=re,re=me.parentNode}me=se}f=D===-1||H===-1?null:{start:D,end:H}}else f=null}f=f||{start:0,end:0}}else f=null;for(e0={focusedElem:a,selectionRange:f},wp=!1,Fn=c;Fn!==null;)if(c=Fn,a=c.child,(c.subtreeFlags&1028)!==0&&a!==null)a.return=c,Fn=a;else for(;Fn!==null;){switch(c=Fn,S=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(f=0;f<a.length;f++)w=a[f],w.ref.impl=w.nextImpl;break;case 11:case 15:break;case 1:if((a&1024)!==0&&S!==null){a=void 0,f=c,w=S.memoizedProps,S=S.memoizedState,g=f.stateNode;try{var ze=il(f.type,w);a=g.getSnapshotBeforeUpdate(ze,S),g.__reactInternalSnapshotBeforeUpdate=a}catch(et){Ot(f,f.return,et)}}break;case 3:if((a&1024)!==0){if(a=c.stateNode.containerInfo,f=a.nodeType,f===9)r0(a);else if(f===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":r0(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,Fn=a;break}Fn=c.return}}function ET(a,c,f){var g=f.flags;switch(f.tag){case 0:case 11:case 15:Pi(a,f),g&4&&nd(5,f);break;case 1:if(Pi(a,f),g&4)if(a=f.stateNode,c===null)try{a.componentDidMount()}catch(R){Ot(f,f.return,R)}else{var w=il(f.type,c.memoizedProps);c=c.memoizedState;try{a.componentDidUpdate(w,c,a.__reactInternalSnapshotBeforeUpdate)}catch(R){Ot(f,f.return,R)}}g&64&&vT(f),g&512&&rd(f,f.return);break;case 3:if(Pi(a,f),g&64&&(a=f.updateQueue,a!==null)){if(c=null,f.child!==null)switch(f.child.tag){case 27:case 5:c=f.child.stateNode;break;case 1:c=f.child.stateNode}try{cE(a,c)}catch(R){Ot(f,f.return,R)}}break;case 27:c===null&&g&4&&kT(f);case 26:case 5:Pi(a,f),c===null&&g&4&&xT(f),g&512&&rd(f,f.return);break;case 12:Pi(a,f);break;case 31:Pi(a,f),g&4&&MT(a,f);break;case 13:Pi(a,f),g&4&&_T(a,f),g&64&&(a=f.memoizedState,a!==null&&(a=a.dehydrated,a!==null&&(f=c3.bind(null,f),_3(a,f))));break;case 22:if(g=f.memoizedState!==null||Ii,!g){c=c!==null&&c.memoizedState!==null||Mn,w=Ii;var S=Mn;Ii=g,(Mn=c)&&!S?$i(a,f,(f.subtreeFlags&8772)!==0):Pi(a,f),Ii=w,Mn=S}break;case 30:break;default:Pi(a,f)}}function TT(a){var c=a.alternate;c!==null&&(a.alternate=null,TT(c)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(c=a.stateNode,c!==null&&pe(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 en=null,jr=!1;function Li(a,c,f){for(f=f.child;f!==null;)NT(a,c,f),f=f.sibling}function NT(a,c,f){if(ae&&typeof ae.onCommitFiberUnmount=="function")try{ae.onCommitFiberUnmount(U,f)}catch{}switch(f.tag){case 26:Mn||ri(f,c),Li(a,c,f),f.memoizedState?f.memoizedState.count--:f.stateNode&&(f=f.stateNode,f.parentNode.removeChild(f));break;case 27:Mn||ri(f,c);var g=en,w=jr;Fo(f.type)&&(en=f.stateNode,jr=!1),Li(a,c,f),fd(f.stateNode),en=g,jr=w;break;case 5:Mn||ri(f,c);case 6:if(g=en,w=jr,en=null,Li(a,c,f),en=g,jr=w,en!==null)if(jr)try{(en.nodeType===9?en.body:en.nodeName==="HTML"?en.ownerDocument.body:en).removeChild(f.stateNode)}catch(S){Ot(f,c,S)}else try{en.removeChild(f.stateNode)}catch(S){Ot(f,c,S)}break;case 18:en!==null&&(jr?(a=en,vN(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,f.stateNode),Nc(a)):vN(en,f.stateNode));break;case 4:g=en,w=jr,en=f.stateNode.containerInfo,jr=!0,Li(a,c,f),en=g,jr=w;break;case 0:case 11:case 14:case 15:Do(2,f,c),Mn||Do(4,f,c),Li(a,c,f);break;case 1:Mn||(ri(f,c),g=f.stateNode,typeof g.componentWillUnmount=="function"&&wT(f,c,g)),Li(a,c,f);break;case 21:Li(a,c,f);break;case 22:Mn=(g=Mn)||f.memoizedState!==null,Li(a,c,f),Mn=g;break;default:Li(a,c,f)}}function MT(a,c){if(c.memoizedState===null&&(a=c.alternate,a!==null&&(a=a.memoizedState,a!==null))){a=a.dehydrated;try{Nc(a)}catch(f){Ot(c,c.return,f)}}}function _T(a,c){if(c.memoizedState===null&&(a=c.alternate,a!==null&&(a=a.memoizedState,a!==null&&(a=a.dehydrated,a!==null))))try{Nc(a)}catch(f){Ot(c,c.return,f)}}function t3(a){switch(a.tag){case 31:case 13:case 19:var c=a.stateNode;return c===null&&(c=a.stateNode=new CT),c;case 22:return a=a.stateNode,c=a._retryCache,c===null&&(c=a._retryCache=new CT),c;default:throw Error(r(435,a.tag))}}function ep(a,c){var f=t3(a);c.forEach(function(g){if(!f.has(g)){f.add(g);var w=u3.bind(null,a,g);g.then(w,w)}})}function Dr(a,c){var f=c.deletions;if(f!==null)for(var g=0;g<f.length;g++){var w=f[g],S=a,R=c,D=R;e:for(;D!==null;){switch(D.tag){case 27:if(Fo(D.type)){en=D.stateNode,jr=!1;break e}break;case 5:en=D.stateNode,jr=!1;break e;case 3:case 4:en=D.stateNode.containerInfo,jr=!0;break e}D=D.return}if(en===null)throw Error(r(160));NT(S,R,w),en=null,jr=!1,S=w.alternate,S!==null&&(S.return=null),w.return=null}if(c.subtreeFlags&13886)for(c=c.child;c!==null;)AT(c,a),c=c.sibling}var Ds=null;function AT(a,c){var f=a.alternate,g=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:Dr(c,a),Ir(a),g&4&&(Do(3,a,a.return),nd(3,a),Do(5,a,a.return));break;case 1:Dr(c,a),Ir(a),g&512&&(Mn||f===null||ri(f,f.return)),g&64&&Ii&&(a=a.updateQueue,a!==null&&(g=a.callbacks,g!==null&&(f=a.shared.hiddenCallbacks,a.shared.hiddenCallbacks=f===null?g:f.concat(g))));break;case 26:var w=Ds;if(Dr(c,a),Ir(a),g&512&&(Mn||f===null||ri(f,f.return)),g&4){var S=f!==null?f.memoizedState:null;if(g=a.memoizedState,f===null)if(g===null)if(a.stateNode===null){e:{g=a.type,f=a.memoizedProps,w=w.ownerDocument||w;t:switch(g){case"title":S=w.getElementsByTagName("title")[0],(!S||S[Ar]||S[bn]||S.namespaceURI==="http://www.w3.org/2000/svg"||S.hasAttribute("itemprop"))&&(S=w.createElement(g),w.head.insertBefore(S,w.querySelector("head > title"))),er(S,g,f),S[bn]=a,yt(S),g=S;break e;case"link":var R=AN("link","href",w).get(g+(f.href||""));if(R){for(var D=0;D<R.length;D++)if(S=R[D],S.getAttribute("href")===(f.href==null||f.href===""?null:f.href)&&S.getAttribute("rel")===(f.rel==null?null:f.rel)&&S.getAttribute("title")===(f.title==null?null:f.title)&&S.getAttribute("crossorigin")===(f.crossOrigin==null?null:f.crossOrigin)){R.splice(D,1);break t}}S=w.createElement(g),er(S,g,f),w.head.appendChild(S);break;case"meta":if(R=AN("meta","content",w).get(g+(f.content||""))){for(D=0;D<R.length;D++)if(S=R[D],S.getAttribute("content")===(f.content==null?null:""+f.content)&&S.getAttribute("name")===(f.name==null?null:f.name)&&S.getAttribute("property")===(f.property==null?null:f.property)&&S.getAttribute("http-equiv")===(f.httpEquiv==null?null:f.httpEquiv)&&S.getAttribute("charset")===(f.charSet==null?null:f.charSet)){R.splice(D,1);break t}}S=w.createElement(g),er(S,g,f),w.head.appendChild(S);break;default:throw Error(r(468,g))}S[bn]=a,yt(S),g=S}a.stateNode=g}else RN(w,a.type,a.stateNode);else a.stateNode=_N(w,g,a.memoizedProps);else S!==g?(S===null?f.stateNode!==null&&(f=f.stateNode,f.parentNode.removeChild(f)):S.count--,g===null?RN(w,a.type,a.stateNode):_N(w,g,a.memoizedProps)):g===null&&a.stateNode!==null&&_v(a,a.memoizedProps,f.memoizedProps)}break;case 27:Dr(c,a),Ir(a),g&512&&(Mn||f===null||ri(f,f.return)),f!==null&&g&4&&_v(a,a.memoizedProps,f.memoizedProps);break;case 5:if(Dr(c,a),Ir(a),g&512&&(Mn||f===null||ri(f,f.return)),a.flags&32){w=a.stateNode;try{Zl(w,"")}catch(ze){Ot(a,a.return,ze)}}g&4&&a.stateNode!=null&&(w=a.memoizedProps,_v(a,w,f!==null?f.memoizedProps:w)),g&1024&&(Ov=!0);break;case 6:if(Dr(c,a),Ir(a),g&4){if(a.stateNode===null)throw Error(r(162));g=a.memoizedProps,f=a.stateNode;try{f.nodeValue=g}catch(ze){Ot(a,a.return,ze)}}break;case 3:if(gp=null,w=Ds,Ds=pp(c.containerInfo),Dr(c,a),Ds=w,Ir(a),g&4&&f!==null&&f.memoizedState.isDehydrated)try{Nc(c.containerInfo)}catch(ze){Ot(a,a.return,ze)}Ov&&(Ov=!1,RT(a));break;case 4:g=Ds,Ds=pp(a.stateNode.containerInfo),Dr(c,a),Ir(a),Ds=g;break;case 12:Dr(c,a),Ir(a);break;case 31:Dr(c,a),Ir(a),g&4&&(g=a.updateQueue,g!==null&&(a.updateQueue=null,ep(a,g)));break;case 13:Dr(c,a),Ir(a),a.child.flags&8192&&a.memoizedState!==null!=(f!==null&&f.memoizedState!==null)&&(np=ht()),g&4&&(g=a.updateQueue,g!==null&&(a.updateQueue=null,ep(a,g)));break;case 22:w=a.memoizedState!==null;var H=f!==null&&f.memoizedState!==null,ne=Ii,le=Mn;if(Ii=ne||w,Mn=le||H,Dr(c,a),Mn=le,Ii=ne,Ir(a),g&8192)e:for(c=a.stateNode,c._visibility=w?c._visibility&-2:c._visibility|1,w&&(f===null||H||Ii||Mn||ol(a)),f=null,c=a;;){if(c.tag===5||c.tag===26){if(f===null){H=f=c;try{if(S=H.stateNode,w)R=S.style,typeof R.setProperty=="function"?R.setProperty("display","none","important"):R.display="none";else{D=H.stateNode;var me=H.memoizedProps.style,re=me!=null&&me.hasOwnProperty("display")?me.display:null;D.style.display=re==null||typeof re=="boolean"?"":(""+re).trim()}}catch(ze){Ot(H,H.return,ze)}}}else if(c.tag===6){if(f===null){H=c;try{H.stateNode.nodeValue=w?"":H.memoizedProps}catch(ze){Ot(H,H.return,ze)}}}else if(c.tag===18){if(f===null){H=c;try{var se=H.stateNode;w?wN(se,!0):wN(H.stateNode,!1)}catch(ze){Ot(H,H.return,ze)}}}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;f===c&&(f=null),c=c.return}f===c&&(f=null),c.sibling.return=c.return,c=c.sibling}g&4&&(g=a.updateQueue,g!==null&&(f=g.retryQueue,f!==null&&(g.retryQueue=null,ep(a,f))));break;case 19:Dr(c,a),Ir(a),g&4&&(g=a.updateQueue,g!==null&&(a.updateQueue=null,ep(a,g)));break;case 30:break;case 21:break;default:Dr(c,a),Ir(a)}}function Ir(a){var c=a.flags;if(c&2){try{for(var f,g=a.return;g!==null;){if(ST(g)){f=g;break}g=g.return}if(f==null)throw Error(r(160));switch(f.tag){case 27:var w=f.stateNode,S=Av(a);Qh(a,S,w);break;case 5:var R=f.stateNode;f.flags&32&&(Zl(R,""),f.flags&=-33);var D=Av(a);Qh(a,D,R);break;case 3:case 4:var H=f.stateNode.containerInfo,ne=Av(a);Rv(a,ne,H);break;default:throw Error(r(161))}}catch(le){Ot(a,a.return,le)}a.flags&=-3}c&4096&&(a.flags&=-4097)}function RT(a){if(a.subtreeFlags&1024)for(a=a.child;a!==null;){var c=a;RT(c),c.tag===5&&c.flags&1024&&c.stateNode.reset(),a=a.sibling}}function Pi(a,c){if(c.subtreeFlags&8772)for(c=c.child;c!==null;)ET(a,c.alternate,c),c=c.sibling}function ol(a){for(a=a.child;a!==null;){var c=a;switch(c.tag){case 0:case 11:case 14:case 15:Do(4,c,c.return),ol(c);break;case 1:ri(c,c.return);var f=c.stateNode;typeof f.componentWillUnmount=="function"&&wT(c,c.return,f),ol(c);break;case 27:fd(c.stateNode);case 26:case 5:ri(c,c.return),ol(c);break;case 22:c.memoizedState===null&&ol(c);break;case 30:ol(c);break;default:ol(c)}a=a.sibling}}function $i(a,c,f){for(f=f&&(c.subtreeFlags&8772)!==0,c=c.child;c!==null;){var g=c.alternate,w=a,S=c,R=S.flags;switch(S.tag){case 0:case 11:case 15:$i(w,S,f),nd(4,S);break;case 1:if($i(w,S,f),g=S,w=g.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(ne){Ot(g,g.return,ne)}if(g=S,w=g.updateQueue,w!==null){var D=g.stateNode;try{var H=w.shared.hiddenCallbacks;if(H!==null)for(w.shared.hiddenCallbacks=null,w=0;w<H.length;w++)lE(H[w],D)}catch(ne){Ot(g,g.return,ne)}}f&&R&64&&vT(S),rd(S,S.return);break;case 27:kT(S);case 26:case 5:$i(w,S,f),f&&g===null&&R&4&&xT(S),rd(S,S.return);break;case 12:$i(w,S,f);break;case 31:$i(w,S,f),f&&R&4&&MT(w,S);break;case 13:$i(w,S,f),f&&R&4&&_T(w,S);break;case 22:S.memoizedState===null&&$i(w,S,f),rd(S,S.return);break;case 30:break;default:$i(w,S,f)}c=c.sibling}}function jv(a,c){var f=null;a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),a=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(a=c.memoizedState.cachePool.pool),a!==f&&(a!=null&&a.refCount++,f!=null&&Hu(f))}function Dv(a,c){a=null,c.alternate!==null&&(a=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==a&&(c.refCount++,a!=null&&Hu(a))}function Is(a,c,f,g){if(c.subtreeFlags&10256)for(c=c.child;c!==null;)OT(a,c,f,g),c=c.sibling}function OT(a,c,f,g){var w=c.flags;switch(c.tag){case 0:case 11:case 15:Is(a,c,f,g),w&2048&&nd(9,c);break;case 1:Is(a,c,f,g);break;case 3:Is(a,c,f,g),w&2048&&(a=null,c.alternate!==null&&(a=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==a&&(c.refCount++,a!=null&&Hu(a)));break;case 12:if(w&2048){Is(a,c,f,g),a=c.stateNode;try{var S=c.memoizedProps,R=S.id,D=S.onPostCommit;typeof D=="function"&&D(R,c.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch(H){Ot(c,c.return,H)}}else Is(a,c,f,g);break;case 31:Is(a,c,f,g);break;case 13:Is(a,c,f,g);break;case 23:break;case 22:S=c.stateNode,R=c.alternate,c.memoizedState!==null?S._visibility&2?Is(a,c,f,g):sd(a,c):S._visibility&2?Is(a,c,f,g):(S._visibility|=2,gc(a,c,f,g,(c.subtreeFlags&10256)!==0||!1)),w&2048&&jv(R,c);break;case 24:Is(a,c,f,g),w&2048&&Dv(c.alternate,c);break;default:Is(a,c,f,g)}}function gc(a,c,f,g,w){for(w=w&&((c.subtreeFlags&10256)!==0||!1),c=c.child;c!==null;){var S=a,R=c,D=f,H=g,ne=R.flags;switch(R.tag){case 0:case 11:case 15:gc(S,R,D,H,w),nd(8,R);break;case 23:break;case 22:var le=R.stateNode;R.memoizedState!==null?le._visibility&2?gc(S,R,D,H,w):sd(S,R):(le._visibility|=2,gc(S,R,D,H,w)),w&&ne&2048&&jv(R.alternate,R);break;case 24:gc(S,R,D,H,w),w&&ne&2048&&Dv(R.alternate,R);break;default:gc(S,R,D,H,w)}c=c.sibling}}function sd(a,c){if(c.subtreeFlags&10256)for(c=c.child;c!==null;){var f=a,g=c,w=g.flags;switch(g.tag){case 22:sd(f,g),w&2048&&jv(g.alternate,g);break;case 24:sd(f,g),w&2048&&Dv(g.alternate,g);break;default:sd(f,g)}c=c.sibling}}var id=8192;function yc(a,c,f){if(a.subtreeFlags&id)for(a=a.child;a!==null;)jT(a,c,f),a=a.sibling}function jT(a,c,f){switch(a.tag){case 26:yc(a,c,f),a.flags&id&&a.memoizedState!==null&&F3(f,Ds,a.memoizedState,a.memoizedProps);break;case 5:yc(a,c,f);break;case 3:case 4:var g=Ds;Ds=pp(a.stateNode.containerInfo),yc(a,c,f),Ds=g;break;case 22:a.memoizedState===null&&(g=a.alternate,g!==null&&g.memoizedState!==null?(g=id,id=16777216,yc(a,c,f),id=g):yc(a,c,f));break;default:yc(a,c,f)}}function DT(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 od(a){var c=a.deletions;if((a.flags&16)!==0){if(c!==null)for(var f=0;f<c.length;f++){var g=c[f];Fn=g,LT(g,a)}DT(a)}if(a.subtreeFlags&10256)for(a=a.child;a!==null;)IT(a),a=a.sibling}function IT(a){switch(a.tag){case 0:case 11:case 15:od(a),a.flags&2048&&Do(9,a,a.return);break;case 3:od(a);break;case 12:od(a);break;case 22:var c=a.stateNode;a.memoizedState!==null&&c._visibility&2&&(a.return===null||a.return.tag!==13)?(c._visibility&=-3,tp(a)):od(a);break;default:od(a)}}function tp(a){var c=a.deletions;if((a.flags&16)!==0){if(c!==null)for(var f=0;f<c.length;f++){var g=c[f];Fn=g,LT(g,a)}DT(a)}for(a=a.child;a!==null;){switch(c=a,c.tag){case 0:case 11:case 15:Do(8,c,c.return),tp(c);break;case 22:f=c.stateNode,f._visibility&2&&(f._visibility&=-3,tp(c));break;default:tp(c)}a=a.sibling}}function LT(a,c){for(;Fn!==null;){var f=Fn;switch(f.tag){case 0:case 11:case 15:Do(8,f,c);break;case 23:case 22:if(f.memoizedState!==null&&f.memoizedState.cachePool!==null){var g=f.memoizedState.cachePool.pool;g!=null&&g.refCount++}break;case 24:Hu(f.memoizedState.cache)}if(g=f.child,g!==null)g.return=f,Fn=g;else e:for(f=a;Fn!==null;){g=Fn;var w=g.sibling,S=g.return;if(TT(g),g===f){Fn=null;break e}if(w!==null){w.return=S,Fn=w;break e}Fn=S}}}var n3={getCacheForType:function(a){var c=Jn(En),f=c.data.get(a);return f===void 0&&(f=a(),c.data.set(a,f)),f},cacheSignal:function(){return Jn(En).controller.signal}},r3=typeof WeakMap=="function"?WeakMap:Map,Mt=0,Ht=null,pt=null,bt=0,Rt=0,Kr=null,Io=!1,bc=!1,Iv=!1,zi=0,hn=0,Lo=0,al=0,Lv=0,Zr=0,vc=0,ad=null,Lr=null,Pv=!1,np=0,PT=0,rp=1/0,sp=null,Po=null,$n=0,$o=null,wc=null,Bi=0,$v=0,zv=null,$T=null,ld=0,Bv=null;function Xr(){return(Mt&2)!==0&&bt!==0?bt&-bt:F.T!==null?qv():Wa()}function zT(){if(Zr===0)if((bt&536870912)===0||wt){var a=Re;Re<<=1,(Re&3932160)===0&&(Re=262144),Zr=a}else Zr=536870912;return a=Gr.current,a!==null&&(a.flags|=32),Zr}function Pr(a,c,f){(a===Ht&&(Rt===2||Rt===9)||a.cancelPendingCommit!==null)&&(xc(a,0),zo(a,bt,Zr,!1)),Zn(a,f),((Mt&2)===0||a!==Ht)&&(a===Ht&&((Mt&2)===0&&(al|=f),hn===4&&zo(a,bt,Zr,!1)),si(a))}function BT(a,c,f){if((Mt&6)!==0)throw Error(r(327));var g=!f&&(c&127)===0&&(c&a.expiredLanes)===0||_r(a,c),w=g?o3(a,c):Vv(a,c,!0),S=g;do{if(w===0){bc&&!g&&zo(a,c,0,!1);break}else{if(f=a.current.alternate,S&&!s3(f)){w=Vv(a,c,!1),S=!1;continue}if(w===2){if(S=c,a.errorRecoveryDisabledLanes&S)var R=0;else R=a.pendingLanes&-536870913,R=R!==0?R:R&536870912?536870912:0;if(R!==0){c=R;e:{var D=a;w=ad;var H=D.current.memoizedState.isDehydrated;if(H&&(xc(D,R).flags|=256),R=Vv(D,R,!1),R!==2){if(Iv&&!H){D.errorRecoveryDisabledLanes|=S,al|=S,w=4;break e}S=Lr,Lr=w,S!==null&&(Lr===null?Lr=S:Lr.push.apply(Lr,S))}w=R}if(S=!1,w!==2)continue}}if(w===1){xc(a,0),zo(a,c,0,!0);break}e:{switch(g=a,S=w,S){case 0:case 1:throw Error(r(345));case 4:if((c&4194048)!==c)break;case 6:zo(g,c,Zr,!Io);break e;case 2:Lr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((c&62914560)===c&&(w=np+300-ht(),10<w)){if(zo(g,c,Zr,!Io),Ze(g,0,!0)!==0)break e;Bi=c,g.timeoutHandle=yN(FT.bind(null,g,f,Lr,sp,Pv,c,Zr,al,vc,Io,S,"Throttled",-0,0),w);break e}FT(g,f,Lr,sp,Pv,c,Zr,al,vc,Io,S,null,-0,0)}}break}while(!0);si(a)}function FT(a,c,f,g,w,S,R,D,H,ne,le,me,re,se){if(a.timeoutHandle=-1,me=c.subtreeFlags,me&8192||(me&16785408)===16785408){me={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ei},jT(c,S,me);var ze=(S&62914560)===S?np-ht():(S&4194048)===S?PT-ht():0;if(ze=V3(me,ze),ze!==null){Bi=S,a.cancelPendingCommit=ze(KT.bind(null,a,c,S,f,g,w,R,D,H,le,me,null,re,se)),zo(a,S,R,!ne);return}}KT(a,c,S,f,g,w,R,D,H)}function s3(a){for(var c=a;;){var f=c.tag;if((f===0||f===11||f===15)&&c.flags&16384&&(f=c.updateQueue,f!==null&&(f=f.stores,f!==null)))for(var g=0;g<f.length;g++){var w=f[g],S=w.getSnapshot;w=w.value;try{if(!Wr(S(),w))return!1}catch{return!1}}if(f=c.child,c.subtreeFlags&16384&&f!==null)f.return=c,c=f;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 zo(a,c,f,g){c&=~Lv,c&=~al,a.suspendedLanes|=c,a.pingedLanes&=~c,g&&(a.warmLanes|=c),g=a.expirationTimes;for(var w=c;0<w;){var S=31-be(w),R=1<<S;g[S]=-1,w&=~R}f!==0&&So(a,f,c)}function ip(){return(Mt&6)===0?(cd(0),!1):!0}function Fv(){if(pt!==null){if(Rt===0)var a=pt.return;else a=pt,_i=Ja=null,rv(a),dc=null,Wu=0,a=pt;for(;a!==null;)bT(a.alternate,a),a=a.return;pt=null}}function xc(a,c){var f=a.timeoutHandle;f!==-1&&(a.timeoutHandle=-1,C3(f)),f=a.cancelPendingCommit,f!==null&&(a.cancelPendingCommit=null,f()),Bi=0,Fv(),Ht=a,pt=f=Ni(a.current,null),bt=c,Rt=0,Kr=null,Io=!1,bc=_r(a,c),Iv=!1,vc=Zr=Lv=al=Lo=hn=0,Lr=ad=null,Pv=!1,(c&8)!==0&&(c|=c&32);var g=a.entangledLanes;if(g!==0)for(a=a.entanglements,g&=c;0<g;){var w=31-be(g),S=1<<w;c|=a[w],g&=~S}return zi=c,Th(),f}function VT(a,c){lt=null,F.H=Qu,c===uc||c===Dh?(c=sE(),Rt=3):c===Wb?(c=sE(),Rt=4):Rt=c===vv?8:c!==null&&typeof c=="object"&&typeof c.then=="function"?6:1,Kr=c,pt===null&&(hn=1,Yh(a,ps(c,a.current)))}function HT(){var a=Gr.current;return a===null?!0:(bt&4194048)===bt?bs===null:(bt&62914560)===bt||(bt&536870912)!==0?a===bs:!1}function UT(){var a=F.H;return F.H=Qu,a===null?Qu:a}function WT(){var a=F.A;return F.A=n3,a}function op(){hn=4,Io||(bt&4194048)!==bt&&Gr.current!==null||(bc=!0),(Lo&134217727)===0&&(al&134217727)===0||Ht===null||zo(Ht,bt,Zr,!1)}function Vv(a,c,f){var g=Mt;Mt|=2;var w=UT(),S=WT();(Ht!==a||bt!==c)&&(sp=null,xc(a,c)),c=!1;var R=hn;e:do try{if(Rt!==0&&pt!==null){var D=pt,H=Kr;switch(Rt){case 8:Fv(),R=6;break e;case 3:case 2:case 9:case 6:Gr.current===null&&(c=!0);var ne=Rt;if(Rt=0,Kr=null,Sc(a,D,H,ne),f&&bc){R=0;break e}break;default:ne=Rt,Rt=0,Kr=null,Sc(a,D,H,ne)}}i3(),R=hn;break}catch(le){VT(a,le)}while(!0);return c&&a.shellSuspendCounter++,_i=Ja=null,Mt=g,F.H=w,F.A=S,pt===null&&(Ht=null,bt=0,Th()),R}function i3(){for(;pt!==null;)qT(pt)}function o3(a,c){var f=Mt;Mt|=2;var g=UT(),w=WT();Ht!==a||bt!==c?(sp=null,rp=ht()+500,xc(a,c)):bc=_r(a,c);e:do try{if(Rt!==0&&pt!==null){c=pt;var S=Kr;t:switch(Rt){case 1:Rt=0,Kr=null,Sc(a,c,S,1);break;case 2:case 9:if(nE(S)){Rt=0,Kr=null,GT(c);break}c=function(){Rt!==2&&Rt!==9||Ht!==a||(Rt=7),si(a)},S.then(c,c);break e;case 3:Rt=7;break e;case 4:Rt=5;break e;case 7:nE(S)?(Rt=0,Kr=null,GT(c)):(Rt=0,Kr=null,Sc(a,c,S,7));break;case 5:var R=null;switch(pt.tag){case 26:R=pt.memoizedState;case 5:case 27:var D=pt;if(R?ON(R):D.stateNode.complete){Rt=0,Kr=null;var H=D.sibling;if(H!==null)pt=H;else{var ne=D.return;ne!==null?(pt=ne,ap(ne)):pt=null}break t}}Rt=0,Kr=null,Sc(a,c,S,5);break;case 6:Rt=0,Kr=null,Sc(a,c,S,6);break;case 8:Fv(),hn=6;break e;default:throw Error(r(462))}}a3();break}catch(le){VT(a,le)}while(!0);return _i=Ja=null,F.H=g,F.A=w,Mt=f,pt!==null?0:(Ht=null,bt=0,Th(),hn)}function a3(){for(;pt!==null&&!Ln();)qT(pt)}function qT(a){var c=gT(a.alternate,a,zi);a.memoizedProps=a.pendingProps,c===null?ap(a):pt=c}function GT(a){var c=a,f=c.alternate;switch(c.tag){case 15:case 0:c=uT(f,c,c.pendingProps,c.type,void 0,bt);break;case 11:c=uT(f,c,c.pendingProps,c.type.render,c.ref,bt);break;case 5:rv(c);default:bT(f,c),c=pt=W1(c,zi),c=gT(f,c,zi)}a.memoizedProps=a.pendingProps,c===null?ap(a):pt=c}function Sc(a,c,f,g){_i=Ja=null,rv(c),dc=null,Wu=0;var w=c.return;try{if(KB(a,w,c,f,bt)){hn=1,Yh(a,ps(f,a.current)),pt=null;return}}catch(S){if(w!==null)throw pt=w,S;hn=1,Yh(a,ps(f,a.current)),pt=null;return}c.flags&32768?(wt||g===1?a=!0:bc||(bt&536870912)!==0?a=!1:(Io=a=!0,(g===2||g===9||g===3||g===6)&&(g=Gr.current,g!==null&&g.tag===13&&(g.flags|=16384))),YT(c,a)):ap(c)}function ap(a){var c=a;do{if((c.flags&32768)!==0){YT(c,Io);return}a=c.return;var f=JB(c.alternate,c,zi);if(f!==null){pt=f;return}if(c=c.sibling,c!==null){pt=c;return}pt=c=a}while(c!==null);hn===0&&(hn=5)}function YT(a,c){do{var f=QB(a.alternate,a);if(f!==null){f.flags&=32767,pt=f;return}if(f=a.return,f!==null&&(f.flags|=32768,f.subtreeFlags=0,f.deletions=null),!c&&(a=a.sibling,a!==null)){pt=a;return}pt=a=f}while(a!==null);hn=6,pt=null}function KT(a,c,f,g,w,S,R,D,H){a.cancelPendingCommit=null;do lp();while($n!==0);if((Mt&6)!==0)throw Error(r(327));if(c!==null){if(c===a.current)throw Error(r(177));if(S=c.lanes|c.childLanes,S|=Ab,ph(a,f,S,R,D,H),a===Ht&&(pt=Ht=null,bt=0),wc=c,$o=a,Bi=f,$v=S,zv=w,$T=g,(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?(a.callbackNode=null,a.callbackPriority=0,d3(Pn,function(){return eN(),null})):(a.callbackNode=null,a.callbackPriority=0),g=(c.flags&13878)!==0,(c.subtreeFlags&13878)!==0||g){g=F.T,F.T=null,w=I.p,I.p=2,R=Mt,Mt|=4;try{e3(a,c,f)}finally{Mt=R,I.p=w,F.T=g}}$n=1,ZT(),XT(),JT()}}function ZT(){if($n===1){$n=0;var a=$o,c=wc,f=(c.flags&13878)!==0;if((c.subtreeFlags&13878)!==0||f){f=F.T,F.T=null;var g=I.p;I.p=2;var w=Mt;Mt|=4;try{AT(c,a);var S=e0,R=L1(a.containerInfo),D=S.focusedElem,H=S.selectionRange;if(R!==D&&D&&D.ownerDocument&&I1(D.ownerDocument.documentElement,D)){if(H!==null&&Eb(D)){var ne=H.start,le=H.end;if(le===void 0&&(le=ne),"selectionStart"in D)D.selectionStart=ne,D.selectionEnd=Math.min(le,D.value.length);else{var me=D.ownerDocument||document,re=me&&me.defaultView||window;if(re.getSelection){var se=re.getSelection(),ze=D.textContent.length,et=Math.min(H.start,ze),$t=H.end===void 0?et:Math.min(H.end,ze);!se.extend&&et>$t&&(R=$t,$t=et,et=R);var Z=D1(D,et),Y=D1(D,$t);if(Z&&Y&&(se.rangeCount!==1||se.anchorNode!==Z.node||se.anchorOffset!==Z.offset||se.focusNode!==Y.node||se.focusOffset!==Y.offset)){var te=me.createRange();te.setStart(Z.node,Z.offset),se.removeAllRanges(),et>$t?(se.addRange(te),se.extend(Y.node,Y.offset)):(te.setEnd(Y.node,Y.offset),se.addRange(te))}}}}for(me=[],se=D;se=se.parentNode;)se.nodeType===1&&me.push({element:se,left:se.scrollLeft,top:se.scrollTop});for(typeof D.focus=="function"&&D.focus(),D=0;D<me.length;D++){var he=me[D];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}wp=!!Qv,e0=Qv=null}finally{Mt=w,I.p=g,F.T=f}}a.current=c,$n=2}}function XT(){if($n===2){$n=0;var a=$o,c=wc,f=(c.flags&8772)!==0;if((c.subtreeFlags&8772)!==0||f){f=F.T,F.T=null;var g=I.p;I.p=2;var w=Mt;Mt|=4;try{ET(a,c.alternate,c)}finally{Mt=w,I.p=g,F.T=f}}$n=3}}function JT(){if($n===4||$n===3){$n=0,Yn();var a=$o,c=wc,f=Bi,g=$T;(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?$n=5:($n=0,wc=$o=null,QT(a,a.pendingLanes));var w=a.pendingLanes;if(w===0&&(Po=null),Ua(f),c=c.stateNode,ae&&typeof ae.onCommitFiberRoot=="function")try{ae.onCommitFiberRoot(U,c,void 0,(c.current.flags&128)===128)}catch{}if(g!==null){c=F.T,w=I.p,I.p=2,F.T=null;try{for(var S=a.onRecoverableError,R=0;R<g.length;R++){var D=g[R];S(D.value,{componentStack:D.stack})}}finally{F.T=c,I.p=w}}(Bi&3)!==0&&lp(),si(a),w=a.pendingLanes,(f&261930)!==0&&(w&42)!==0?a===Bv?ld++:(ld=0,Bv=a):ld=0,cd(0)}}function QT(a,c){(a.pooledCacheLanes&=c)===0&&(c=a.pooledCache,c!=null&&(a.pooledCache=null,Hu(c)))}function lp(){return ZT(),XT(),JT(),eN()}function eN(){if($n!==5)return!1;var a=$o,c=$v;$v=0;var f=Ua(Bi),g=F.T,w=I.p;try{I.p=32>f?32:f,F.T=null,f=zv,zv=null;var S=$o,R=Bi;if($n=0,wc=$o=null,Bi=0,(Mt&6)!==0)throw Error(r(331));var D=Mt;if(Mt|=4,IT(S.current),OT(S,S.current,R,f),Mt=D,cd(0,!1),ae&&typeof ae.onPostCommitFiberRoot=="function")try{ae.onPostCommitFiberRoot(U,S)}catch{}return!0}finally{I.p=w,F.T=g,QT(a,c)}}function tN(a,c,f){c=ps(f,c),c=bv(a.stateNode,c,2),a=Ro(a,c,2),a!==null&&(Zn(a,2),si(a))}function Ot(a,c,f){if(a.tag===3)tN(a,a,f);else for(;c!==null;){if(c.tag===3){tN(c,a,f);break}else if(c.tag===1){var g=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Po===null||!Po.has(g))){a=ps(f,a),f=nT(2),g=Ro(c,f,2),g!==null&&(rT(f,g,c,a),Zn(g,2),si(g));break}}c=c.return}}function Hv(a,c,f){var g=a.pingCache;if(g===null){g=a.pingCache=new r3;var w=new Set;g.set(c,w)}else w=g.get(c),w===void 0&&(w=new Set,g.set(c,w));w.has(f)||(Iv=!0,w.add(f),a=l3.bind(null,a,c,f),c.then(a,a))}function l3(a,c,f){var g=a.pingCache;g!==null&&g.delete(c),a.pingedLanes|=a.suspendedLanes&f,a.warmLanes&=~f,Ht===a&&(bt&f)===f&&(hn===4||hn===3&&(bt&62914560)===bt&&300>ht()-np?(Mt&2)===0&&xc(a,0):Lv|=f,vc===bt&&(vc=0)),si(a)}function nN(a,c){c===0&&(c=wr()),a=Ka(a,c),a!==null&&(Zn(a,c),si(a))}function c3(a){var c=a.memoizedState,f=0;c!==null&&(f=c.retryLane),nN(a,f)}function u3(a,c){var f=0;switch(a.tag){case 31:case 13:var g=a.stateNode,w=a.memoizedState;w!==null&&(f=w.retryLane);break;case 19:g=a.stateNode;break;case 22:g=a.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(c),nN(a,f)}function d3(a,c){return dn(a,c)}var cp=null,kc=null,Uv=!1,up=!1,Wv=!1,Bo=0;function si(a){a!==kc&&a.next===null&&(kc===null?cp=kc=a:kc=kc.next=a),up=!0,Uv||(Uv=!0,h3())}function cd(a,c){if(!Wv&&up){Wv=!0;do for(var f=!1,g=cp;g!==null;){if(a!==0){var w=g.pendingLanes;if(w===0)var S=0;else{var R=g.suspendedLanes,D=g.pingedLanes;S=(1<<31-be(42|a)+1)-1,S&=w&~(R&~D),S=S&201326741?S&201326741|1:S?S|2:0}S!==0&&(f=!0,oN(g,S))}else S=bt,S=Ze(g,g===Ht?S:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(S&3)===0||_r(g,S)||(f=!0,oN(g,S));g=g.next}while(f);Wv=!1}}function f3(){rN()}function rN(){up=Uv=!1;var a=0;Bo!==0&&k3()&&(a=Bo);for(var c=ht(),f=null,g=cp;g!==null;){var w=g.next,S=sN(g,c);S===0?(g.next=null,f===null?cp=w:f.next=w,w===null&&(kc=f)):(f=g,(a!==0||(S&3)!==0)&&(up=!0)),g=w}$n!==0&&$n!==5||cd(a),Bo!==0&&(Bo=0)}function sN(a,c){for(var f=a.suspendedLanes,g=a.pingedLanes,w=a.expirationTimes,S=a.pendingLanes&-62914561;0<S;){var R=31-be(S),D=1<<R,H=w[R];H===-1?((D&f)===0||(D&g)!==0)&&(w[R]=Vr(D,c)):H<=c&&(a.expiredLanes|=D),S&=~D}if(c=Ht,f=bt,f=Ze(a,a===c?f:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),g=a.callbackNode,f===0||a===c&&(Rt===2||Rt===9)||a.cancelPendingCommit!==null)return g!==null&&g!==null&&In(g),a.callbackNode=null,a.callbackPriority=0;if((f&3)===0||_r(a,f)){if(c=f&-f,c===a.callbackPriority)return c;switch(g!==null&&In(g),Ua(f)){case 2:case 8:f=vr;break;case 32:f=Pn;break;case 268435456:f=$e;break;default:f=Pn}return g=iN.bind(null,a),f=dn(f,g),a.callbackPriority=c,a.callbackNode=f,c}return g!==null&&g!==null&&In(g),a.callbackPriority=2,a.callbackNode=null,2}function iN(a,c){if($n!==0&&$n!==5)return a.callbackNode=null,a.callbackPriority=0,null;var f=a.callbackNode;if(lp()&&a.callbackNode!==f)return null;var g=bt;return g=Ze(a,a===Ht?g:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),g===0?null:(BT(a,g,c),sN(a,ht()),a.callbackNode!=null&&a.callbackNode===f?iN.bind(null,a):null)}function oN(a,c){if(lp())return null;BT(a,c,!0)}function h3(){E3(function(){(Mt&6)!==0?dn(lr,f3):rN()})}function qv(){if(Bo===0){var a=lc;a===0&&(a=Ie,Ie<<=1,(Ie&261888)===0&&(Ie=256)),Bo=a}return Bo}function aN(a){return a==null||typeof a=="symbol"||typeof a=="boolean"?null:typeof a=="function"?a:bh(""+a)}function lN(a,c){var f=c.ownerDocument.createElement("input");return f.name=c.name,f.value=c.value,a.id&&f.setAttribute("form",a.id),c.parentNode.insertBefore(f,c),a=new FormData(a),f.parentNode.removeChild(f),a}function p3(a,c,f,g,w){if(c==="submit"&&f&&f.stateNode===w){var S=aN((w[Cn]||null).action),R=g.submitter;R&&(c=(c=R[Cn]||null)?aN(c.formAction):R.getAttribute("formAction"),c!==null&&(S=c,R=null));var D=new Sh("action","action",null,g,w);a.push({event:D,listeners:[{instance:null,listener:function(){if(g.defaultPrevented){if(Bo!==0){var H=R?lN(w,R):new FormData(w);fv(f,{pending:!0,data:H,method:w.method,action:S},null,H)}}else typeof S=="function"&&(D.preventDefault(),H=R?lN(w,R):new FormData(w),fv(f,{pending:!0,data:H,method:w.method,action:S},S,H))},currentTarget:w}]})}}for(var Gv=0;Gv<_b.length;Gv++){var Yv=_b[Gv],m3=Yv.toLowerCase(),g3=Yv[0].toUpperCase()+Yv.slice(1);js(m3,"on"+g3)}js(z1,"onAnimationEnd"),js(B1,"onAnimationIteration"),js(F1,"onAnimationStart"),js("dblclick","onDoubleClick"),js("focusin","onFocus"),js("focusout","onBlur"),js(OB,"onTransitionRun"),js(jB,"onTransitionStart"),js(DB,"onTransitionCancel"),js(V1,"onTransitionEnd"),ki("onMouseEnter",["mouseout","mouseover"]),ki("onMouseLeave",["mouseout","mouseover"]),ki("onPointerEnter",["pointerout","pointerover"]),ki("onPointerLeave",["pointerout","pointerover"]),Os("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Os("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Os("onBeforeInput",["compositionend","keypress","textInput","paste"]),Os("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Os("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Os("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ud="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(" "),y3=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ud));function cN(a,c){c=(c&4)!==0;for(var f=0;f<a.length;f++){var g=a[f],w=g.event;g=g.listeners;e:{var S=void 0;if(c)for(var R=g.length-1;0<=R;R--){var D=g[R],H=D.instance,ne=D.currentTarget;if(D=D.listener,H!==S&&w.isPropagationStopped())break e;S=D,w.currentTarget=ne;try{S(w)}catch(le){Eh(le)}w.currentTarget=null,S=H}else for(R=0;R<g.length;R++){if(D=g[R],H=D.instance,ne=D.currentTarget,D=D.listener,H!==S&&w.isPropagationStopped())break e;S=D,w.currentTarget=ne;try{S(w)}catch(le){Eh(le)}w.currentTarget=null,S=H}}}}function mt(a,c){var f=c[we];f===void 0&&(f=c[we]=new Set);var g=a+"__bubble";f.has(g)||(uN(c,a,2,!1),f.add(g))}function Kv(a,c,f){var g=0;c&&(g|=4),uN(f,a,g,c)}var dp="_reactListening"+Math.random().toString(36).slice(2);function Zv(a){if(!a[dp]){a[dp]=!0,Ur.forEach(function(f){f!=="selectionchange"&&(y3.has(f)||Kv(f,!1,a),Kv(f,!0,a))});var c=a.nodeType===9?a:a.ownerDocument;c===null||c[dp]||(c[dp]=!0,Kv("selectionchange",!1,c))}}function uN(a,c,f,g){switch(zN(c)){case 2:var w=W3;break;case 8:w=q3;break;default:w=d0}f=w.bind(null,c,f,a),w=void 0,!gb||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(w=!0),g?w!==void 0?a.addEventListener(c,f,{capture:!0,passive:w}):a.addEventListener(c,f,!0):w!==void 0?a.addEventListener(c,f,{passive:w}):a.addEventListener(c,f,!1)}function Xv(a,c,f,g,w){var S=g;if((c&1)===0&&(c&2)===0&&g!==null)e:for(;;){if(g===null)return;var R=g.tag;if(R===3||R===4){var D=g.stateNode.containerInfo;if(D===w)break;if(R===4)for(R=g.return;R!==null;){var H=R.tag;if((H===3||H===4)&&R.stateNode.containerInfo===w)return;R=R.return}for(;D!==null;){if(R=ue(D),R===null)return;if(H=R.tag,H===5||H===6||H===26||H===27){g=S=R;continue e}D=D.parentNode}}g=g.return}m1(function(){var ne=S,le=pb(f),me=[];e:{var re=H1.get(a);if(re!==void 0){var se=Sh,ze=a;switch(a){case"keypress":if(wh(f)===0)break e;case"keydown":case"keyup":se=uB;break;case"focusin":ze="focus",se=wb;break;case"focusout":ze="blur",se=wb;break;case"beforeblur":case"afterblur":se=wb;break;case"click":if(f.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":se=b1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=Jz;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=hB;break;case z1:case B1:case F1:se=tB;break;case V1:se=mB;break;case"scroll":case"scrollend":se=Zz;break;case"wheel":se=yB;break;case"copy":case"cut":case"paste":se=rB;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=w1;break;case"toggle":case"beforetoggle":se=vB}var et=(c&4)!==0,$t=!et&&(a==="scroll"||a==="scrollend"),Z=et?re!==null?re+"Capture":null:re;et=[];for(var Y=ne,te;Y!==null;){var he=Y;if(te=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||te===null||Z===null||(he=Ou(Y,Z),he!=null&&et.push(dd(Y,he,te))),$t)break;Y=Y.return}0<et.length&&(re=new se(re,ze,null,f,le),me.push({event:re,listeners:et}))}}if((c&7)===0){e:{if(re=a==="mouseover"||a==="pointerover",se=a==="mouseout"||a==="pointerout",re&&f!==hb&&(ze=f.relatedTarget||f.fromElement)&&(ue(ze)||ze[us]))break e;if((se||re)&&(re=le.window===le?le:(re=le.ownerDocument)?re.defaultView||re.parentWindow:window,se?(ze=f.relatedTarget||f.toElement,se=ne,ze=ze?ue(ze):null,ze!==null&&($t=i(ze),et=ze.tag,ze!==$t||et!==5&&et!==27&&et!==6)&&(ze=null)):(se=null,ze=ne),se!==ze)){if(et=b1,he="onMouseLeave",Z="onMouseEnter",Y="mouse",(a==="pointerout"||a==="pointerover")&&(et=w1,he="onPointerLeave",Z="onPointerEnter",Y="pointer"),$t=se==null?re:Je(se),te=ze==null?re:Je(ze),re=new et(he,Y+"leave",se,f,le),re.target=$t,re.relatedTarget=te,he=null,ue(le)===ne&&(et=new et(Z,Y+"enter",ze,f,le),et.target=te,et.relatedTarget=$t,he=et),$t=he,se&&ze)t:{for(et=b3,Z=se,Y=ze,te=0,he=Z;he;he=et(he))te++;he=0;for(var qe=Y;qe;qe=et(qe))he++;for(;0<te-he;)Z=et(Z),te--;for(;0<he-te;)Y=et(Y),he--;for(;te--;){if(Z===Y||Y!==null&&Z===Y.alternate){et=Z;break t}Z=et(Z),Y=et(Y)}et=null}else et=null;se!==null&&dN(me,re,se,et,!1),ze!==null&&$t!==null&&dN(me,$t,ze,et,!0)}}e:{if(re=ne?Je(ne):window,se=re.nodeName&&re.nodeName.toLowerCase(),se==="select"||se==="input"&&re.type==="file")var Ct=M1;else if(T1(re))if(_1)Ct=_B;else{Ct=NB;var Ve=TB}else se=re.nodeName,!se||se.toLowerCase()!=="input"||re.type!=="checkbox"&&re.type!=="radio"?ne&&fb(ne.elementType)&&(Ct=M1):Ct=MB;if(Ct&&(Ct=Ct(a,ne))){N1(me,Ct,f,le);break e}Ve&&Ve(a,re,ne),a==="focusout"&&ne&&re.type==="number"&&ne.memoizedProps.value!=null&&db(re,"number",re.value)}switch(Ve=ne?Je(ne):window,a){case"focusin":(T1(Ve)||Ve.contentEditable==="true")&&(ec=Ve,Tb=ne,Bu=null);break;case"focusout":Bu=Tb=ec=null;break;case"mousedown":Nb=!0;break;case"contextmenu":case"mouseup":case"dragend":Nb=!1,P1(me,f,le);break;case"selectionchange":if(RB)break;case"keydown":case"keyup":P1(me,f,le)}var ct;if(Sb)e:{switch(a){case"compositionstart":var vt="onCompositionStart";break e;case"compositionend":vt="onCompositionEnd";break e;case"compositionupdate":vt="onCompositionUpdate";break e}vt=void 0}else Ql?C1(a,f)&&(vt="onCompositionEnd"):a==="keydown"&&f.keyCode===229&&(vt="onCompositionStart");vt&&(x1&&f.locale!=="ko"&&(Ql||vt!=="onCompositionStart"?vt==="onCompositionEnd"&&Ql&&(ct=g1()):(Co=le,yb="value"in Co?Co.value:Co.textContent,Ql=!0)),Ve=fp(ne,vt),0<Ve.length&&(vt=new v1(vt,a,null,f,le),me.push({event:vt,listeners:Ve}),ct?vt.data=ct:(ct=E1(f),ct!==null&&(vt.data=ct)))),(ct=xB?SB(a,f):kB(a,f))&&(vt=fp(ne,"onBeforeInput"),0<vt.length&&(Ve=new v1("onBeforeInput","beforeinput",null,f,le),me.push({event:Ve,listeners:vt}),Ve.data=ct)),p3(me,a,ne,f,le)}cN(me,c)})}function dd(a,c,f){return{instance:a,listener:c,currentTarget:f}}function fp(a,c){for(var f=c+"Capture",g=[];a!==null;){var w=a,S=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||S===null||(w=Ou(a,f),w!=null&&g.unshift(dd(a,w,S)),w=Ou(a,c),w!=null&&g.push(dd(a,w,S))),a.tag===3)return g;a=a.return}return[]}function b3(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5&&a.tag!==27);return a||null}function dN(a,c,f,g,w){for(var S=c._reactName,R=[];f!==null&&f!==g;){var D=f,H=D.alternate,ne=D.stateNode;if(D=D.tag,H!==null&&H===g)break;D!==5&&D!==26&&D!==27||ne===null||(H=ne,w?(ne=Ou(f,S),ne!=null&&R.unshift(dd(f,ne,H))):w||(ne=Ou(f,S),ne!=null&&R.push(dd(f,ne,H)))),f=f.return}R.length!==0&&a.push({event:c,listeners:R})}var v3=/\r\n?/g,w3=/\u0000|\uFFFD/g;function fN(a){return(typeof a=="string"?a:""+a).replace(v3,`
9
+ `).replace(w3,"")}function hN(a,c){return c=fN(c),fN(a)===c}function Pt(a,c,f,g,w,S){switch(f){case"children":typeof g=="string"?c==="body"||c==="textarea"&&g===""||Zl(a,g):(typeof g=="number"||typeof g=="bigint")&&c!=="body"&&Zl(a,""+g);break;case"className":gh(a,"class",g);break;case"tabIndex":gh(a,"tabindex",g);break;case"dir":case"role":case"viewBox":case"width":case"height":gh(a,f,g);break;case"style":h1(a,g,S);break;case"data":if(c!=="object"){gh(a,"data",g);break}case"src":case"href":if(g===""&&(c!=="a"||f!=="href")){a.removeAttribute(f);break}if(g==null||typeof g=="function"||typeof g=="symbol"||typeof g=="boolean"){a.removeAttribute(f);break}g=bh(""+g),a.setAttribute(f,g);break;case"action":case"formAction":if(typeof g=="function"){a.setAttribute(f,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof S=="function"&&(f==="formAction"?(c!=="input"&&Pt(a,c,"name",w.name,w,null),Pt(a,c,"formEncType",w.formEncType,w,null),Pt(a,c,"formMethod",w.formMethod,w,null),Pt(a,c,"formTarget",w.formTarget,w,null)):(Pt(a,c,"encType",w.encType,w,null),Pt(a,c,"method",w.method,w,null),Pt(a,c,"target",w.target,w,null)));if(g==null||typeof g=="symbol"||typeof g=="boolean"){a.removeAttribute(f);break}g=bh(""+g),a.setAttribute(f,g);break;case"onClick":g!=null&&(a.onclick=Ei);break;case"onScroll":g!=null&&mt("scroll",a);break;case"onScrollEnd":g!=null&&mt("scrollend",a);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(r(61));if(f=g.__html,f!=null){if(w.children!=null)throw Error(r(60));a.innerHTML=f}}break;case"multiple":a.multiple=g&&typeof g!="function"&&typeof g!="symbol";break;case"muted":a.muted=g&&typeof g!="function"&&typeof g!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(g==null||typeof g=="function"||typeof g=="boolean"||typeof g=="symbol"){a.removeAttribute("xlink:href");break}f=bh(""+g),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":g!=null&&typeof g!="function"&&typeof g!="symbol"?a.setAttribute(f,""+g):a.removeAttribute(f);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":g&&typeof g!="function"&&typeof g!="symbol"?a.setAttribute(f,""):a.removeAttribute(f);break;case"capture":case"download":g===!0?a.setAttribute(f,""):g!==!1&&g!=null&&typeof g!="function"&&typeof g!="symbol"?a.setAttribute(f,g):a.removeAttribute(f);break;case"cols":case"rows":case"size":case"span":g!=null&&typeof g!="function"&&typeof g!="symbol"&&!isNaN(g)&&1<=g?a.setAttribute(f,g):a.removeAttribute(f);break;case"rowSpan":case"start":g==null||typeof g=="function"||typeof g=="symbol"||isNaN(g)?a.removeAttribute(f):a.setAttribute(f,g);break;case"popover":mt("beforetoggle",a),mt("toggle",a),mh(a,"popover",g);break;case"xlinkActuate":Ci(a,"http://www.w3.org/1999/xlink","xlink:actuate",g);break;case"xlinkArcrole":Ci(a,"http://www.w3.org/1999/xlink","xlink:arcrole",g);break;case"xlinkRole":Ci(a,"http://www.w3.org/1999/xlink","xlink:role",g);break;case"xlinkShow":Ci(a,"http://www.w3.org/1999/xlink","xlink:show",g);break;case"xlinkTitle":Ci(a,"http://www.w3.org/1999/xlink","xlink:title",g);break;case"xlinkType":Ci(a,"http://www.w3.org/1999/xlink","xlink:type",g);break;case"xmlBase":Ci(a,"http://www.w3.org/XML/1998/namespace","xml:base",g);break;case"xmlLang":Ci(a,"http://www.w3.org/XML/1998/namespace","xml:lang",g);break;case"xmlSpace":Ci(a,"http://www.w3.org/XML/1998/namespace","xml:space",g);break;case"is":mh(a,"is",g);break;case"innerText":case"textContent":break;default:(!(2<f.length)||f[0]!=="o"&&f[0]!=="O"||f[1]!=="n"&&f[1]!=="N")&&(f=Yz.get(f)||f,mh(a,f,g))}}function Jv(a,c,f,g,w,S){switch(f){case"style":h1(a,g,S);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(r(61));if(f=g.__html,f!=null){if(w.children!=null)throw Error(r(60));a.innerHTML=f}}break;case"children":typeof g=="string"?Zl(a,g):(typeof g=="number"||typeof g=="bigint")&&Zl(a,""+g);break;case"onScroll":g!=null&&mt("scroll",a);break;case"onScrollEnd":g!=null&&mt("scrollend",a);break;case"onClick":g!=null&&(a.onclick=Ei);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Rr.hasOwnProperty(f))e:{if(f[0]==="o"&&f[1]==="n"&&(w=f.endsWith("Capture"),c=f.slice(2,w?f.length-7:void 0),S=a[Cn]||null,S=S!=null?S[f]:null,typeof S=="function"&&a.removeEventListener(c,S,w),typeof g=="function")){typeof S!="function"&&S!==null&&(f in a?a[f]=null:a.hasAttribute(f)&&a.removeAttribute(f)),a.addEventListener(c,g,w);break e}f in a?a[f]=g:g===!0?a.setAttribute(f,""):mh(a,f,g)}}}function er(a,c,f){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":mt("error",a),mt("load",a);var g=!1,w=!1,S;for(S in f)if(f.hasOwnProperty(S)){var R=f[S];if(R!=null)switch(S){case"src":g=!0;break;case"srcSet":w=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,c));default:Pt(a,c,S,R,f,null)}}w&&Pt(a,c,"srcSet",f.srcSet,f,null),g&&Pt(a,c,"src",f.src,f,null);return;case"input":mt("invalid",a);var D=S=R=w=null,H=null,ne=null;for(g in f)if(f.hasOwnProperty(g)){var le=f[g];if(le!=null)switch(g){case"name":w=le;break;case"type":R=le;break;case"checked":H=le;break;case"defaultChecked":ne=le;break;case"value":S=le;break;case"defaultValue":D=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(r(137,c));break;default:Pt(a,c,g,le,f,null)}}c1(a,S,D,H,ne,R,w,!1);return;case"select":mt("invalid",a),g=R=S=null;for(w in f)if(f.hasOwnProperty(w)&&(D=f[w],D!=null))switch(w){case"value":S=D;break;case"defaultValue":R=D;break;case"multiple":g=D;default:Pt(a,c,w,D,f,null)}c=S,f=R,a.multiple=!!g,c!=null?Kl(a,!!g,c,!1):f!=null&&Kl(a,!!g,f,!0);return;case"textarea":mt("invalid",a),S=w=g=null;for(R in f)if(f.hasOwnProperty(R)&&(D=f[R],D!=null))switch(R){case"value":g=D;break;case"defaultValue":w=D;break;case"children":S=D;break;case"dangerouslySetInnerHTML":if(D!=null)throw Error(r(91));break;default:Pt(a,c,R,D,f,null)}d1(a,g,w,S);return;case"option":for(H in f)f.hasOwnProperty(H)&&(g=f[H],g!=null)&&(H==="selected"?a.selected=g&&typeof g!="function"&&typeof g!="symbol":Pt(a,c,H,g,f,null));return;case"dialog":mt("beforetoggle",a),mt("toggle",a),mt("cancel",a),mt("close",a);break;case"iframe":case"object":mt("load",a);break;case"video":case"audio":for(g=0;g<ud.length;g++)mt(ud[g],a);break;case"image":mt("error",a),mt("load",a);break;case"details":mt("toggle",a);break;case"embed":case"source":case"link":mt("error",a),mt("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(ne in f)if(f.hasOwnProperty(ne)&&(g=f[ne],g!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,c));default:Pt(a,c,ne,g,f,null)}return;default:if(fb(c)){for(le in f)f.hasOwnProperty(le)&&(g=f[le],g!==void 0&&Jv(a,c,le,g,f,void 0));return}}for(D in f)f.hasOwnProperty(D)&&(g=f[D],g!=null&&Pt(a,c,D,g,f,null))}function x3(a,c,f,g){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var w=null,S=null,R=null,D=null,H=null,ne=null,le=null;for(se in f){var me=f[se];if(f.hasOwnProperty(se)&&me!=null)switch(se){case"checked":break;case"value":break;case"defaultValue":H=me;default:g.hasOwnProperty(se)||Pt(a,c,se,null,g,me)}}for(var re in g){var se=g[re];if(me=f[re],g.hasOwnProperty(re)&&(se!=null||me!=null))switch(re){case"type":S=se;break;case"name":w=se;break;case"checked":ne=se;break;case"defaultChecked":le=se;break;case"value":R=se;break;case"defaultValue":D=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,c));break;default:se!==me&&Pt(a,c,re,se,g,me)}}ub(a,R,D,H,ne,le,S,w);return;case"select":se=R=D=re=null;for(S in f)if(H=f[S],f.hasOwnProperty(S)&&H!=null)switch(S){case"value":break;case"multiple":se=H;default:g.hasOwnProperty(S)||Pt(a,c,S,null,g,H)}for(w in g)if(S=g[w],H=f[w],g.hasOwnProperty(w)&&(S!=null||H!=null))switch(w){case"value":re=S;break;case"defaultValue":D=S;break;case"multiple":R=S;default:S!==H&&Pt(a,c,w,S,g,H)}c=D,f=R,g=se,re!=null?Kl(a,!!f,re,!1):!!g!=!!f&&(c!=null?Kl(a,!!f,c,!0):Kl(a,!!f,f?[]:"",!1));return;case"textarea":se=re=null;for(D in f)if(w=f[D],f.hasOwnProperty(D)&&w!=null&&!g.hasOwnProperty(D))switch(D){case"value":break;case"children":break;default:Pt(a,c,D,null,g,w)}for(R in g)if(w=g[R],S=f[R],g.hasOwnProperty(R)&&(w!=null||S!=null))switch(R){case"value":re=w;break;case"defaultValue":se=w;break;case"children":break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(r(91));break;default:w!==S&&Pt(a,c,R,w,g,S)}u1(a,re,se);return;case"option":for(var ze in f)re=f[ze],f.hasOwnProperty(ze)&&re!=null&&!g.hasOwnProperty(ze)&&(ze==="selected"?a.selected=!1:Pt(a,c,ze,null,g,re));for(H in g)re=g[H],se=f[H],g.hasOwnProperty(H)&&re!==se&&(re!=null||se!=null)&&(H==="selected"?a.selected=re&&typeof re!="function"&&typeof re!="symbol":Pt(a,c,H,re,g,se));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 et in f)re=f[et],f.hasOwnProperty(et)&&re!=null&&!g.hasOwnProperty(et)&&Pt(a,c,et,null,g,re);for(ne in g)if(re=g[ne],se=f[ne],g.hasOwnProperty(ne)&&re!==se&&(re!=null||se!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(r(137,c));break;default:Pt(a,c,ne,re,g,se)}return;default:if(fb(c)){for(var $t in f)re=f[$t],f.hasOwnProperty($t)&&re!==void 0&&!g.hasOwnProperty($t)&&Jv(a,c,$t,void 0,g,re);for(le in g)re=g[le],se=f[le],!g.hasOwnProperty(le)||re===se||re===void 0&&se===void 0||Jv(a,c,le,re,g,se);return}}for(var Z in f)re=f[Z],f.hasOwnProperty(Z)&&re!=null&&!g.hasOwnProperty(Z)&&Pt(a,c,Z,null,g,re);for(me in g)re=g[me],se=f[me],!g.hasOwnProperty(me)||re===se||re==null&&se==null||Pt(a,c,me,re,g,se)}function pN(a){switch(a){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function S3(){if(typeof performance.getEntriesByType=="function"){for(var a=0,c=0,f=performance.getEntriesByType("resource"),g=0;g<f.length;g++){var w=f[g],S=w.transferSize,R=w.initiatorType,D=w.duration;if(S&&D&&pN(R)){for(R=0,D=w.responseEnd,g+=1;g<f.length;g++){var H=f[g],ne=H.startTime;if(ne>D)break;var le=H.transferSize,me=H.initiatorType;le&&pN(me)&&(H=H.responseEnd,R+=le*(H<D?1:(D-ne)/(H-ne)))}if(--g,c+=8*(S+R)/(w.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 Qv=null,e0=null;function hp(a){return a.nodeType===9?a:a.ownerDocument}function mN(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 gN(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 t0(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 n0=null;function k3(){var a=window.event;return a&&a.type==="popstate"?a===n0?!1:(n0=a,!0):(n0=null,!1)}var yN=typeof setTimeout=="function"?setTimeout:void 0,C3=typeof clearTimeout=="function"?clearTimeout:void 0,bN=typeof Promise=="function"?Promise:void 0,E3=typeof queueMicrotask=="function"?queueMicrotask:typeof bN<"u"?function(a){return bN.resolve(null).then(a).catch(T3)}:yN;function T3(a){setTimeout(function(){throw a})}function Fo(a){return a==="head"}function vN(a,c){var f=c,g=0;do{var w=f.nextSibling;if(a.removeChild(f),w&&w.nodeType===8)if(f=w.data,f==="/$"||f==="/&"){if(g===0){a.removeChild(w),Nc(c);return}g--}else if(f==="$"||f==="$?"||f==="$~"||f==="$!"||f==="&")g++;else if(f==="html")fd(a.ownerDocument.documentElement);else if(f==="head"){f=a.ownerDocument.head,fd(f);for(var S=f.firstChild;S;){var R=S.nextSibling,D=S.nodeName;S[Ar]||D==="SCRIPT"||D==="STYLE"||D==="LINK"&&S.rel.toLowerCase()==="stylesheet"||f.removeChild(S),S=R}}else f==="body"&&fd(a.ownerDocument.body);f=w}while(f);Nc(c)}function wN(a,c){var f=a;a=0;do{var g=f.nextSibling;if(f.nodeType===1?c?(f._stashedDisplay=f.style.display,f.style.display="none"):(f.style.display=f._stashedDisplay||"",f.getAttribute("style")===""&&f.removeAttribute("style")):f.nodeType===3&&(c?(f._stashedText=f.nodeValue,f.nodeValue=""):f.nodeValue=f._stashedText||""),g&&g.nodeType===8)if(f=g.data,f==="/$"){if(a===0)break;a--}else f!=="$"&&f!=="$?"&&f!=="$~"&&f!=="$!"||a++;f=g}while(f)}function r0(a){var c=a.firstChild;for(c&&c.nodeType===10&&(c=c.nextSibling);c;){var f=c;switch(c=c.nextSibling,f.nodeName){case"HTML":case"HEAD":case"BODY":r0(f),pe(f);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(f.rel.toLowerCase()==="stylesheet")continue}a.removeChild(f)}}function N3(a,c,f,g){for(;a.nodeType===1;){var w=f;if(a.nodeName.toLowerCase()!==c.toLowerCase()){if(!g&&(a.nodeName!=="INPUT"||a.type!=="hidden"))break}else if(g){if(!a[Ar])switch(c){case"meta":if(!a.hasAttribute("itemprop"))break;return a;case"link":if(S=a.getAttribute("rel"),S==="stylesheet"&&a.hasAttribute("data-precedence"))break;if(S!==w.rel||a.getAttribute("href")!==(w.href==null||w.href===""?null:w.href)||a.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin)||a.getAttribute("title")!==(w.title==null?null:w.title))break;return a;case"style":if(a.hasAttribute("data-precedence"))break;return a;case"script":if(S=a.getAttribute("src"),(S!==(w.src==null?null:w.src)||a.getAttribute("type")!==(w.type==null?null:w.type)||a.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin))&&S&&a.hasAttribute("async")&&!a.hasAttribute("itemprop"))break;return a;default:return a}}else if(c==="input"&&a.type==="hidden"){var S=w.name==null?null:""+w.name;if(w.type==="hidden"&&a.getAttribute("name")===S)return a}else return a;if(a=vs(a.nextSibling),a===null)break}return null}function M3(a,c,f){if(c==="")return null;for(;a.nodeType!==3;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!f||(a=vs(a.nextSibling),a===null))return null;return a}function xN(a,c){for(;a.nodeType!==8;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!c||(a=vs(a.nextSibling),a===null))return null;return a}function s0(a){return a.data==="$?"||a.data==="$~"}function i0(a){return a.data==="$!"||a.data==="$?"&&a.ownerDocument.readyState!=="loading"}function _3(a,c){var f=a.ownerDocument;if(a.data==="$~")a._reactRetry=c;else if(a.data!=="$?"||f.readyState!=="loading")c();else{var g=function(){c(),f.removeEventListener("DOMContentLoaded",g)};f.addEventListener("DOMContentLoaded",g),a._reactRetry=g}}function vs(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 o0=null;function SN(a){a=a.nextSibling;for(var c=0;a;){if(a.nodeType===8){var f=a.data;if(f==="/$"||f==="/&"){if(c===0)return vs(a.nextSibling);c--}else f!=="$"&&f!=="$!"&&f!=="$?"&&f!=="$~"&&f!=="&"||c++}a=a.nextSibling}return null}function kN(a){a=a.previousSibling;for(var c=0;a;){if(a.nodeType===8){var f=a.data;if(f==="$"||f==="$!"||f==="$?"||f==="$~"||f==="&"){if(c===0)return a;c--}else f!=="/$"&&f!=="/&"||c++}a=a.previousSibling}return null}function CN(a,c,f){switch(c=hp(f),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 fd(a){for(var c=a.attributes;c.length;)a.removeAttributeNode(c[0]);pe(a)}var ws=new Map,EN=new Set;function pp(a){return typeof a.getRootNode=="function"?a.getRootNode():a.nodeType===9?a:a.ownerDocument}var Fi=I.d;I.d={f:A3,r:R3,D:O3,C:j3,L:D3,m:I3,X:P3,S:L3,M:$3};function A3(){var a=Fi.f(),c=ip();return a||c}function R3(a){var c=_e(a);c!==null&&c.tag===5&&c.type==="form"?VE(c):Fi.r(a)}var Cc=typeof document>"u"?null:document;function TN(a,c,f){var g=Cc;if(g&&typeof c=="string"&&c){var w=fs(c);w='link[rel="'+a+'"][href="'+w+'"]',typeof f=="string"&&(w+='[crossorigin="'+f+'"]'),EN.has(w)||(EN.add(w),a={rel:a,crossOrigin:f,href:c},g.querySelector(w)===null&&(c=g.createElement("link"),er(c,"link",a),yt(c),g.head.appendChild(c)))}}function O3(a){Fi.D(a),TN("dns-prefetch",a,null)}function j3(a,c){Fi.C(a,c),TN("preconnect",a,c)}function D3(a,c,f){Fi.L(a,c,f);var g=Cc;if(g&&a&&c){var w='link[rel="preload"][as="'+fs(c)+'"]';c==="image"&&f&&f.imageSrcSet?(w+='[imagesrcset="'+fs(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(w+='[imagesizes="'+fs(f.imageSizes)+'"]')):w+='[href="'+fs(a)+'"]';var S=w;switch(c){case"style":S=Ec(a);break;case"script":S=Tc(a)}ws.has(S)||(a=m({rel:"preload",href:c==="image"&&f&&f.imageSrcSet?void 0:a,as:c},f),ws.set(S,a),g.querySelector(w)!==null||c==="style"&&g.querySelector(hd(S))||c==="script"&&g.querySelector(pd(S))||(c=g.createElement("link"),er(c,"link",a),yt(c),g.head.appendChild(c)))}}function I3(a,c){Fi.m(a,c);var f=Cc;if(f&&a){var g=c&&typeof c.as=="string"?c.as:"script",w='link[rel="modulepreload"][as="'+fs(g)+'"][href="'+fs(a)+'"]',S=w;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":S=Tc(a)}if(!ws.has(S)&&(a=m({rel:"modulepreload",href:a},c),ws.set(S,a),f.querySelector(w)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(pd(S)))return}g=f.createElement("link"),er(g,"link",a),yt(g),f.head.appendChild(g)}}}function L3(a,c,f){Fi.S(a,c,f);var g=Cc;if(g&&a){var w=kt(g).hoistableStyles,S=Ec(a);c=c||"default";var R=w.get(S);if(!R){var D={loading:0,preload:null};if(R=g.querySelector(hd(S)))D.loading=5;else{a=m({rel:"stylesheet",href:a,"data-precedence":c},f),(f=ws.get(S))&&a0(a,f);var H=R=g.createElement("link");yt(H),er(H,"link",a),H._p=new Promise(function(ne,le){H.onload=ne,H.onerror=le}),H.addEventListener("load",function(){D.loading|=1}),H.addEventListener("error",function(){D.loading|=2}),D.loading|=4,mp(R,c,g)}R={type:"stylesheet",instance:R,count:1,state:D},w.set(S,R)}}}function P3(a,c){Fi.X(a,c);var f=Cc;if(f&&a){var g=kt(f).hoistableScripts,w=Tc(a),S=g.get(w);S||(S=f.querySelector(pd(w)),S||(a=m({src:a,async:!0},c),(c=ws.get(w))&&l0(a,c),S=f.createElement("script"),yt(S),er(S,"link",a),f.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},g.set(w,S))}}function $3(a,c){Fi.M(a,c);var f=Cc;if(f&&a){var g=kt(f).hoistableScripts,w=Tc(a),S=g.get(w);S||(S=f.querySelector(pd(w)),S||(a=m({src:a,async:!0,type:"module"},c),(c=ws.get(w))&&l0(a,c),S=f.createElement("script"),yt(S),er(S,"link",a),f.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},g.set(w,S))}}function NN(a,c,f,g){var w=(w=De.current)?pp(w):null;if(!w)throw Error(r(446));switch(a){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(c=Ec(f.href),f=kt(w).hoistableStyles,g=f.get(c),g||(g={type:"style",instance:null,count:0,state:null},f.set(c,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){a=Ec(f.href);var S=kt(w).hoistableStyles,R=S.get(a);if(R||(w=w.ownerDocument||w,R={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},S.set(a,R),(S=w.querySelector(hd(a)))&&!S._p&&(R.instance=S,R.state.loading=5),ws.has(a)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},ws.set(a,f),S||z3(w,a,f,R.state))),c&&g===null)throw Error(r(528,""));return R}if(c&&g!==null)throw Error(r(529,""));return null;case"script":return c=f.async,f=f.src,typeof f=="string"&&c&&typeof c!="function"&&typeof c!="symbol"?(c=Tc(f),f=kt(w).hoistableScripts,g=f.get(c),g||(g={type:"script",instance:null,count:0,state:null},f.set(c,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,a))}}function Ec(a){return'href="'+fs(a)+'"'}function hd(a){return'link[rel="stylesheet"]['+a+"]"}function MN(a){return m({},a,{"data-precedence":a.precedence,precedence:null})}function z3(a,c,f,g){a.querySelector('link[rel="preload"][as="style"]['+c+"]")?g.loading=1:(c=a.createElement("link"),g.preload=c,c.addEventListener("load",function(){return g.loading|=1}),c.addEventListener("error",function(){return g.loading|=2}),er(c,"link",f),yt(c),a.head.appendChild(c))}function Tc(a){return'[src="'+fs(a)+'"]'}function pd(a){return"script[async]"+a}function _N(a,c,f){if(c.count++,c.instance===null)switch(c.type){case"style":var g=a.querySelector('style[data-href~="'+fs(f.href)+'"]');if(g)return c.instance=g,yt(g),g;var w=m({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return g=(a.ownerDocument||a).createElement("style"),yt(g),er(g,"style",w),mp(g,f.precedence,a),c.instance=g;case"stylesheet":w=Ec(f.href);var S=a.querySelector(hd(w));if(S)return c.state.loading|=4,c.instance=S,yt(S),S;g=MN(f),(w=ws.get(w))&&a0(g,w),S=(a.ownerDocument||a).createElement("link"),yt(S);var R=S;return R._p=new Promise(function(D,H){R.onload=D,R.onerror=H}),er(S,"link",g),c.state.loading|=4,mp(S,f.precedence,a),c.instance=S;case"script":return S=Tc(f.src),(w=a.querySelector(pd(S)))?(c.instance=w,yt(w),w):(g=f,(w=ws.get(S))&&(g=m({},f),l0(g,w)),a=a.ownerDocument||a,w=a.createElement("script"),yt(w),er(w,"link",g),a.head.appendChild(w),c.instance=w);case"void":return null;default:throw Error(r(443,c.type))}else c.type==="stylesheet"&&(c.state.loading&4)===0&&(g=c.instance,c.state.loading|=4,mp(g,f.precedence,a));return c.instance}function mp(a,c,f){for(var g=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),w=g.length?g[g.length-1]:null,S=w,R=0;R<g.length;R++){var D=g[R];if(D.dataset.precedence===c)S=D;else if(S!==w)break}S?S.parentNode.insertBefore(a,S.nextSibling):(c=f.nodeType===9?f.head:f,c.insertBefore(a,c.firstChild))}function a0(a,c){a.crossOrigin==null&&(a.crossOrigin=c.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=c.referrerPolicy),a.title==null&&(a.title=c.title)}function l0(a,c){a.crossOrigin==null&&(a.crossOrigin=c.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=c.referrerPolicy),a.integrity==null&&(a.integrity=c.integrity)}var gp=null;function AN(a,c,f){if(gp===null){var g=new Map,w=gp=new Map;w.set(f,g)}else w=gp,g=w.get(f),g||(g=new Map,w.set(f,g));if(g.has(a))return g;for(g.set(a,null),f=f.getElementsByTagName(a),w=0;w<f.length;w++){var S=f[w];if(!(S[Ar]||S[bn]||a==="link"&&S.getAttribute("rel")==="stylesheet")&&S.namespaceURI!=="http://www.w3.org/2000/svg"){var R=S.getAttribute(c)||"";R=a+R;var D=g.get(R);D?D.push(S):g.set(R,[S])}}return g}function RN(a,c,f){a=a.ownerDocument||a,a.head.insertBefore(f,c==="title"?a.querySelector("head > title"):null)}function B3(a,c,f){if(f===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 ON(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function F3(a,c,f,g){if(f.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var w=Ec(g.href),S=c.querySelector(hd(w));if(S){c=S._p,c!==null&&typeof c=="object"&&typeof c.then=="function"&&(a.count++,a=yp.bind(a),c.then(a,a)),f.state.loading|=4,f.instance=S,yt(S);return}S=c.ownerDocument||c,g=MN(g),(w=ws.get(w))&&a0(g,w),S=S.createElement("link"),yt(S);var R=S;R._p=new Promise(function(D,H){R.onload=D,R.onerror=H}),er(S,"link",g),f.instance=S}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(f,c),(c=f.state.preload)&&(f.state.loading&3)===0&&(a.count++,f=yp.bind(a),c.addEventListener("load",f),c.addEventListener("error",f))}}var c0=0;function V3(a,c){return a.stylesheets&&a.count===0&&vp(a,a.stylesheets),0<a.count||0<a.imgCount?function(f){var g=setTimeout(function(){if(a.stylesheets&&vp(a,a.stylesheets),a.unsuspend){var S=a.unsuspend;a.unsuspend=null,S()}},6e4+c);0<a.imgBytes&&c0===0&&(c0=62500*S3());var w=setTimeout(function(){if(a.waitingForImages=!1,a.count===0&&(a.stylesheets&&vp(a,a.stylesheets),a.unsuspend)){var S=a.unsuspend;a.unsuspend=null,S()}},(a.imgBytes>c0?50:800)+c);return a.unsuspend=f,function(){a.unsuspend=null,clearTimeout(g),clearTimeout(w)}}:null}function yp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)vp(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var bp=null;function vp(a,c){a.stylesheets=null,a.unsuspend!==null&&(a.count++,bp=new Map,c.forEach(H3,a),bp=null,yp.call(a))}function H3(a,c){if(!(c.state.loading&4)){var f=bp.get(a);if(f)var g=f.get(null);else{f=new Map,bp.set(a,f);for(var w=a.querySelectorAll("link[data-precedence],style[data-precedence]"),S=0;S<w.length;S++){var R=w[S];(R.nodeName==="LINK"||R.getAttribute("media")!=="not all")&&(f.set(R.dataset.precedence,R),g=R)}g&&f.set(null,g)}w=c.instance,R=w.getAttribute("data-precedence"),S=f.get(R)||g,S===g&&f.set(null,w),f.set(R,w),this.count++,g=yp.bind(this),w.addEventListener("load",g),w.addEventListener("error",g),S?S.parentNode.insertBefore(w,S.nextSibling):(a=a.nodeType===9?a.head:a,a.insertBefore(w,a.firstChild)),c.state.loading|=4}}var md={$$typeof:_,Provider:null,Consumer:null,_currentValue:z,_currentValue2:z,_threadCount:0};function U3(a,c,f,g,w,S,R,D,H){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=Kn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Kn(0),this.hiddenUpdates=Kn(null),this.identifierPrefix=g,this.onUncaughtError=w,this.onCaughtError=S,this.onRecoverableError=R,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function jN(a,c,f,g,w,S,R,D,H,ne,le,me){return a=new U3(a,c,f,R,H,ne,le,me,D),c=1,S===!0&&(c|=24),S=qr(3,null,null,c),a.current=S,S.stateNode=a,c=Vb(),c.refCount++,a.pooledCache=c,c.refCount++,S.memoizedState={element:g,isDehydrated:f,cache:c},qb(S),a}function DN(a){return a?(a=rc,a):rc}function IN(a,c,f,g,w,S){w=DN(w),g.context===null?g.context=w:g.pendingContext=w,g=Ao(c),g.payload={element:f},S=S===void 0?null:S,S!==null&&(g.callback=S),f=Ro(a,g,c),f!==null&&(Pr(f,a,c),Gu(f,a,c))}function LN(a,c){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var f=a.retryLane;a.retryLane=f!==0&&f<c?f:c}}function u0(a,c){LN(a,c),(a=a.alternate)&&LN(a,c)}function PN(a){if(a.tag===13||a.tag===31){var c=Ka(a,67108864);c!==null&&Pr(c,a,67108864),u0(a,67108864)}}function $N(a){if(a.tag===13||a.tag===31){var c=Xr();c=Ha(c);var f=Ka(a,c);f!==null&&Pr(f,a,c),u0(a,c)}}var wp=!0;function W3(a,c,f,g){var w=F.T;F.T=null;var S=I.p;try{I.p=2,d0(a,c,f,g)}finally{I.p=S,F.T=w}}function q3(a,c,f,g){var w=F.T;F.T=null;var S=I.p;try{I.p=8,d0(a,c,f,g)}finally{I.p=S,F.T=w}}function d0(a,c,f,g){if(wp){var w=f0(g);if(w===null)Xv(a,c,g,xp,f),BN(a,g);else if(Y3(w,a,c,f,g))g.stopPropagation();else if(BN(a,g),c&4&&-1<G3.indexOf(a)){for(;w!==null;){var S=_e(w);if(S!==null)switch(S.tag){case 3:if(S=S.stateNode,S.current.memoizedState.isDehydrated){var R=gt(S.pendingLanes);if(R!==0){var D=S;for(D.pendingLanes|=2,D.entangledLanes|=2;R;){var H=1<<31-be(R);D.entanglements[1]|=H,R&=~H}si(S),(Mt&6)===0&&(rp=ht()+500,cd(0))}}break;case 31:case 13:D=Ka(S,2),D!==null&&Pr(D,S,2),ip(),u0(S,2)}if(S=f0(g),S===null&&Xv(a,c,g,xp,f),S===w)break;w=S}w!==null&&g.stopPropagation()}else Xv(a,c,g,null,f)}}function f0(a){return a=pb(a),h0(a)}var xp=null;function h0(a){if(xp=null,a=ue(a),a!==null){var c=i(a);if(c===null)a=null;else{var f=c.tag;if(f===13){if(a=o(c),a!==null)return a;a=null}else if(f===31){if(a=l(c),a!==null)return a;a=null}else if(f===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;a=null}else c!==a&&(a=null)}}return xp=a,null}function zN(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(Bn()){case lr:return 2;case vr:return 8;case Pn:case xe:return 32;case $e:return 268435456;default:return 32}default:return 32}}var p0=!1,Vo=null,Ho=null,Uo=null,gd=new Map,yd=new Map,Wo=[],G3="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 BN(a,c){switch(a){case"focusin":case"focusout":Vo=null;break;case"dragenter":case"dragleave":Ho=null;break;case"mouseover":case"mouseout":Uo=null;break;case"pointerover":case"pointerout":gd.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":yd.delete(c.pointerId)}}function bd(a,c,f,g,w,S){return a===null||a.nativeEvent!==S?(a={blockedOn:c,domEventName:f,eventSystemFlags:g,nativeEvent:S,targetContainers:[w]},c!==null&&(c=_e(c),c!==null&&PN(c)),a):(a.eventSystemFlags|=g,c=a.targetContainers,w!==null&&c.indexOf(w)===-1&&c.push(w),a)}function Y3(a,c,f,g,w){switch(c){case"focusin":return Vo=bd(Vo,a,c,f,g,w),!0;case"dragenter":return Ho=bd(Ho,a,c,f,g,w),!0;case"mouseover":return Uo=bd(Uo,a,c,f,g,w),!0;case"pointerover":var S=w.pointerId;return gd.set(S,bd(gd.get(S)||null,a,c,f,g,w)),!0;case"gotpointercapture":return S=w.pointerId,yd.set(S,bd(yd.get(S)||null,a,c,f,g,w)),!0}return!1}function FN(a){var c=ue(a.target);if(c!==null){var f=i(c);if(f!==null){if(c=f.tag,c===13){if(c=o(f),c!==null){a.blockedOn=c,ko(a.priority,function(){$N(f)});return}}else if(c===31){if(c=l(f),c!==null){a.blockedOn=c,ko(a.priority,function(){$N(f)});return}}else if(c===3&&f.stateNode.current.memoizedState.isDehydrated){a.blockedOn=f.tag===3?f.stateNode.containerInfo:null;return}}}a.blockedOn=null}function Sp(a){if(a.blockedOn!==null)return!1;for(var c=a.targetContainers;0<c.length;){var f=f0(a.nativeEvent);if(f===null){f=a.nativeEvent;var g=new f.constructor(f.type,f);hb=g,f.target.dispatchEvent(g),hb=null}else return c=_e(f),c!==null&&PN(c),a.blockedOn=f,!1;c.shift()}return!0}function VN(a,c,f){Sp(a)&&f.delete(c)}function K3(){p0=!1,Vo!==null&&Sp(Vo)&&(Vo=null),Ho!==null&&Sp(Ho)&&(Ho=null),Uo!==null&&Sp(Uo)&&(Uo=null),gd.forEach(VN),yd.forEach(VN)}function kp(a,c){a.blockedOn===c&&(a.blockedOn=null,p0||(p0=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,K3)))}var Cp=null;function HN(a){Cp!==a&&(Cp=a,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Cp===a&&(Cp=null);for(var c=0;c<a.length;c+=3){var f=a[c],g=a[c+1],w=a[c+2];if(typeof g!="function"){if(h0(g||f)===null)continue;break}var S=_e(f);S!==null&&(a.splice(c,3),c-=3,fv(S,{pending:!0,data:w,method:f.method,action:g},g,w))}}))}function Nc(a){function c(H){return kp(H,a)}Vo!==null&&kp(Vo,a),Ho!==null&&kp(Ho,a),Uo!==null&&kp(Uo,a),gd.forEach(c),yd.forEach(c);for(var f=0;f<Wo.length;f++){var g=Wo[f];g.blockedOn===a&&(g.blockedOn=null)}for(;0<Wo.length&&(f=Wo[0],f.blockedOn===null);)FN(f),f.blockedOn===null&&Wo.shift();if(f=(a.ownerDocument||a).$$reactFormReplay,f!=null)for(g=0;g<f.length;g+=3){var w=f[g],S=f[g+1],R=w[Cn]||null;if(typeof S=="function")R||HN(f);else if(R){var D=null;if(S&&S.hasAttribute("formAction")){if(w=S,R=S[Cn]||null)D=R.formAction;else if(h0(w)!==null)continue}else D=R.action;typeof D=="function"?f[g+1]=D:(f.splice(g,3),g-=3),HN(f)}}}function UN(){function a(S){S.canIntercept&&S.info==="react-transition"&&S.intercept({handler:function(){return new Promise(function(R){return w=R})},focusReset:"manual",scroll:"manual"})}function c(){w!==null&&(w(),w=null),g||setTimeout(f,20)}function f(){if(!g&&!navigation.transition){var S=navigation.currentEntry;S&&S.url!=null&&navigation.navigate(S.url,{state:S.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var g=!1,w=null;return navigation.addEventListener("navigate",a),navigation.addEventListener("navigatesuccess",c),navigation.addEventListener("navigateerror",c),setTimeout(f,100),function(){g=!0,navigation.removeEventListener("navigate",a),navigation.removeEventListener("navigatesuccess",c),navigation.removeEventListener("navigateerror",c),w!==null&&(w(),w=null)}}}function m0(a){this._internalRoot=a}Ep.prototype.render=m0.prototype.render=function(a){var c=this._internalRoot;if(c===null)throw Error(r(409));var f=c.current,g=Xr();IN(f,g,a,c,null,null)},Ep.prototype.unmount=m0.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var c=a.containerInfo;IN(a.current,2,null,a,null,null),ip(),c[us]=null}};function Ep(a){this._internalRoot=a}Ep.prototype.unstable_scheduleHydration=function(a){if(a){var c=Wa();a={blockedOn:null,target:a,priority:c};for(var f=0;f<Wo.length&&c!==0&&c<Wo[f].priority;f++);Wo.splice(f,0,a),f===0&&FN(a)}};var WN=e.version;if(WN!=="19.2.8")throw Error(r(527,WN,"19.2.8"));I.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=d(c),a=a!==null?h(a):null,a=a===null?null:a.stateNode,a};var Z3={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Tp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Tp.isDisabled&&Tp.supportsFiber)try{U=Tp.inject(Z3),ae=Tp}catch{}}return wd.createRoot=function(a,c){if(!s(a))throw Error(r(299));var f=!1,g="",w=JE,S=QE,R=eT;return c!=null&&(c.unstable_strictMode===!0&&(f=!0),c.identifierPrefix!==void 0&&(g=c.identifierPrefix),c.onUncaughtError!==void 0&&(w=c.onUncaughtError),c.onCaughtError!==void 0&&(S=c.onCaughtError),c.onRecoverableError!==void 0&&(R=c.onRecoverableError)),c=jN(a,1,!1,null,null,f,g,null,w,S,R,UN),a[us]=c.current,Zv(a),new m0(c)},wd.hydrateRoot=function(a,c,f){if(!s(a))throw Error(r(299));var g=!1,w="",S=JE,R=QE,D=eT,H=null;return f!=null&&(f.unstable_strictMode===!0&&(g=!0),f.identifierPrefix!==void 0&&(w=f.identifierPrefix),f.onUncaughtError!==void 0&&(S=f.onUncaughtError),f.onCaughtError!==void 0&&(R=f.onCaughtError),f.onRecoverableError!==void 0&&(D=f.onRecoverableError),f.formState!==void 0&&(H=f.formState)),c=jN(a,1,!0,c,f??null,g,w,H,S,R,D,UN),c.context=DN(null),f=c.current,g=Xr(),g=Ha(g),w=Ao(g),w.callback=null,Ro(f,w,g),f=g,c.current.lanes=f,Zn(c,f),si(c),a[us]=c.current,Zv(a),new Ep(c)},wd.version="19.2.8",wd}var sM;function oF(){if(sM)return v0.exports;sM=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(),v0.exports=iF(),v0.exports}var aF=oF();const lF=()=>{};var iM={};const XO=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let s=t.charCodeAt(r);s<128?e[n++]=s:s<2048?(e[n++]=s>>6|192,e[n++]=s&63|128):(s&64512)===55296&&r+1<t.length&&(t.charCodeAt(r+1)&64512)===56320?(s=65536+((s&1023)<<10)+(t.charCodeAt(++r)&1023),e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=s&63|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=s&63|128)}return e},cF=function(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n++];if(s<128)e[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=t[n++];e[r++]=String.fromCharCode((s&31)<<6|i&63)}else if(s>239&&s<365){const i=t[n++],o=t[n++],l=t[n++],u=((s&7)<<18|(i&63)<<12|(o&63)<<6|l&63)-65536;e[r++]=String.fromCharCode(55296+(u>>10)),e[r++]=String.fromCharCode(56320+(u&1023))}else{const i=t[n++],o=t[n++];e[r++]=String.fromCharCode((s&15)<<12|(i&63)<<6|o&63)}}return e.join("")},JO={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 s=0;s<t.length;s+=3){const i=t[s],o=s+1<t.length,l=o?t[s+1]:0,u=s+2<t.length,d=u?t[s+2]:0,h=i>>2,m=(i&3)<<4|l>>4;let y=(l&15)<<2|d>>6,b=d&63;u||(b=64,o||(y=64)),r.push(n[h],n[m],n[y],n[b])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(XO(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):cF(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s<t.length;){const i=n[t.charAt(s++)],l=s<t.length?n[t.charAt(s)]:0;++s;const d=s<t.length?n[t.charAt(s)]:64;++s;const m=s<t.length?n[t.charAt(s)]:64;if(++s,i==null||l==null||d==null||m==null)throw new uF;const y=i<<2|l>>4;if(r.push(y),d!==64){const b=l<<4&240|d>>2;if(r.push(b),m!==64){const v=d<<6&192|m;r.push(v)}}}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 uF extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const dF=function(t){const e=XO(t);return JO.encodeByteArray(e,!0)},QO=function(t){return dF(t).replace(/\./g,"")},ej=function(t){try{return JO.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function fF(){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 hF=()=>fF().__FIREBASE_DEFAULTS__,pF=()=>{if(typeof process>"u"||typeof iM>"u")return;const t=iM.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},mF=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&ej(t[1]);return e&&JSON.parse(e)},DS=()=>{try{return lF()||hF()||pF()||mF()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},gF=t=>DS()?.emulatorHosts?.[t],tj=()=>DS()?.config,nj=t=>DS()?.[`_${t}`];class rj{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 Tr(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function yF(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Tr())}function bF(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function vF(){const t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function wF(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function xF(){const t=Tr();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function SF(){try{return typeof indexedDB=="object"}catch{return!1}}function kF(){return new Promise((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{e(s.error?.message||"")}}catch(n){e(n)}})}const CF="FirebaseError";class ja extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=CF,Object.setPrototypeOf(this,ja.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Wf.prototype.create)}}class Wf{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){const r=n[0]||{},s=`${this.service}/${e}`,i=this.errors[e],o=i?EF(i,r):"Error",l=`${this.serviceName}: ${o} (${s}).`;return new ja(s,l,r)}}function EF(t,e){try{let n=0,r="";for(;n<t.length;){const s=t.indexOf("{$",n);if(s===-1){r+=t.substring(n);break}const i=t.indexOf("}",s+2);if(i===-1){r+=t.substring(n);break}const o=t.substring(s+2,i),l=e[o];r+=t.substring(n,s)+(l!=null?String(l):`<${o}?>`),n=i+1}return r}catch{return t}}function TF(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function eu(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const s of n){if(!r.includes(s))return!1;const i=t[s],o=e[s];if(oM(i)&&oM(o)){if(!eu(i,o))return!1}else if(i!==o)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function oM(t){return t!==null&&typeof t=="object"}function qf(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(s=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(s))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function Id(t){const e={};return t.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[s,i]=r.split("=");e[decodeURIComponent(s)]=decodeURIComponent(i)}}),e}function Ld(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}function NF(t,e){const n=new MF(t,e);return n.subscribe.bind(n)}class MF{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 s;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");_F(e,["next","error","complete"])?s=e:s={next:e,error:n,complete:r},s.next===void 0&&(s.next=k0),s.error===void 0&&(s.error=k0),s.complete===void 0&&(s.complete=k0);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),i}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 _F(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 k0(){}function vo(t){return t&&t._delegate?t._delegate:t}function IS(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function AF(t){return(await fetch(t,{credentials:"include"})).ok}class tu{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 cl="[DEFAULT]";class RF{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 rj;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:n});s&&r.resolve(s)}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(s){if(r)return null;throw s}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(jF(e))try{this.getOrInitializeService({instanceIdentifier:cl})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(n);try{const i=this.getOrInitializeService({instanceIdentifier:s});r.resolve(i)}catch{}}}}clearInstance(e=cl){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=cl){return this.instances.has(e)}getOptions(e=cl){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 s=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[i,o]of this.instancesDeferred.entries()){const l=this.normalizeInstanceIdentifier(i);r===l&&o.resolve(s)}return s}onInit(e,n){const r=this.normalizeInstanceIdentifier(n),s=this.onInitCallbacks.get(r)??new Set;s.add(e),this.onInitCallbacks.set(r,s);const i=this.instances.get(r);return i&&e(i,r),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){const r=this.onInitCallbacks.get(n);if(r)for(const s of r)try{s(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:OF(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=cl){return this.component?this.component.multipleInstances?e:cl:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function OF(t){return t===cl?void 0:t}function jF(t){return t.instantiationMode==="EAGER"}class DF{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 RF(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}var Ut;(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"})(Ut||(Ut={}));const IF={debug:Ut.DEBUG,verbose:Ut.VERBOSE,info:Ut.INFO,warn:Ut.WARN,error:Ut.ERROR,silent:Ut.SILENT},LF=Ut.INFO,PF={[Ut.DEBUG]:"log",[Ut.VERBOSE]:"log",[Ut.INFO]:"info",[Ut.WARN]:"warn",[Ut.ERROR]:"error"},$F=(t,e,...n)=>{if(e<t.logLevel)return;const r=new Date().toISOString(),s=PF[e];if(s)console[s](`[${r}] ${t.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class sj{constructor(e){this.name=e,this._logLevel=LF,this._logHandler=$F,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in Ut))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?IF[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,Ut.DEBUG,...e),this._logHandler(this,Ut.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,Ut.VERBOSE,...e),this._logHandler(this,Ut.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,Ut.INFO,...e),this._logHandler(this,Ut.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,Ut.WARN,...e),this._logHandler(this,Ut.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,Ut.ERROR,...e),this._logHandler(this,Ut.ERROR,...e)}}const zF=(t,e)=>e.some(n=>t instanceof n);let aM,lM;function BF(){return aM||(aM=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function FF(){return lM||(lM=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const ij=new WeakMap,qw=new WeakMap,oj=new WeakMap,C0=new WeakMap,LS=new WeakMap;function VF(t){const e=new Promise((n,r)=>{const s=()=>{t.removeEventListener("success",i),t.removeEventListener("error",o)},i=()=>{n(ha(t.result)),s()},o=()=>{r(t.error),s()};t.addEventListener("success",i),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&ij.set(n,t)}).catch(()=>{}),LS.set(e,t),e}function HF(t){if(qw.has(t))return;const e=new Promise((n,r)=>{const s=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",o),t.removeEventListener("abort",o)},i=()=>{n(),s()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",i),t.addEventListener("error",o),t.addEventListener("abort",o)});qw.set(t,e)}let Gw={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return qw.get(t);if(e==="objectStoreNames")return t.objectStoreNames||oj.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return ha(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 UF(t){Gw=t(Gw)}function WF(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(E0(this),e,...n);return oj.set(r,e.sort?e.sort():[e]),ha(r)}:FF().includes(t)?function(...e){return t.apply(E0(this),e),ha(ij.get(this))}:function(...e){return ha(t.apply(E0(this),e))}}function qF(t){return typeof t=="function"?WF(t):(t instanceof IDBTransaction&&HF(t),zF(t,BF())?new Proxy(t,Gw):t)}function ha(t){if(t instanceof IDBRequest)return VF(t);if(C0.has(t))return C0.get(t);const e=qF(t);return e!==t&&(C0.set(t,e),LS.set(e,t)),e}const E0=t=>LS.get(t);function GF(t,e,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(t,e),l=ha(o);return r&&o.addEventListener("upgradeneeded",u=>{r(ha(o.result),u.oldVersion,u.newVersion,ha(o.transaction),u)}),n&&o.addEventListener("blocked",u=>n(u.oldVersion,u.newVersion,u)),l.then(u=>{i&&u.addEventListener("close",()=>i()),s&&u.addEventListener("versionchange",d=>s(d.oldVersion,d.newVersion,d))}).catch(()=>{}),l}const YF=["get","getKey","getAll","getAllKeys","count"],KF=["put","add","delete","clear"],T0=new Map;function cM(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(T0.get(e))return T0.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,s=KF.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||YF.includes(n)))return;const i=async function(o,...l){const u=this.transaction(o,s?"readwrite":"readonly");let d=u.store;return r&&(d=d.index(l.shift())),(await Promise.all([d[n](...l),s&&u.done]))[0]};return T0.set(e,i),i}UF(t=>({...t,get:(e,n,r)=>cM(e,n)||t.get(e,n,r),has:(e,n)=>!!cM(e,n)||t.has(e,n)}));class ZF{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(XF(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function XF(t){return t.getComponent()?.type==="VERSION"}const Yw="@firebase/app",uM="0.16.2";const po=new sj("@firebase/app"),JF="@firebase/app-compat",QF="@firebase/analytics-compat",eV="@firebase/analytics",tV="@firebase/app-check-compat",nV="@firebase/app-check",rV="@firebase/auth",sV="@firebase/auth-compat",iV="@firebase/database",oV="@firebase/data-connect",aV="@firebase/database-compat",lV="@firebase/functions",cV="@firebase/functions-compat",uV="@firebase/installations",dV="@firebase/installations-compat",fV="@firebase/messaging",hV="@firebase/messaging-compat",pV="@firebase/performance",mV="@firebase/performance-compat",gV="@firebase/remote-config",yV="@firebase/remote-config-compat",bV="@firebase/storage",vV="@firebase/storage-compat",wV="@firebase/firestore",xV="@firebase/ai",SV="@firebase/firestore-compat",kV="firebase",CV="12.19.0";const Kw="[DEFAULT]",EV={[Yw]:"fire-core",[JF]:"fire-core-compat",[eV]:"fire-analytics",[QF]:"fire-analytics-compat",[nV]:"fire-app-check",[tV]:"fire-app-check-compat",[rV]:"fire-auth",[sV]:"fire-auth-compat",[iV]:"fire-rtdb",[oV]:"fire-data-connect",[aV]:"fire-rtdb-compat",[lV]:"fire-fn",[cV]:"fire-fn-compat",[uV]:"fire-iid",[dV]:"fire-iid-compat",[fV]:"fire-fcm",[hV]:"fire-fcm-compat",[pV]:"fire-perf",[mV]:"fire-perf-compat",[gV]:"fire-rc",[yV]:"fire-rc-compat",[bV]:"fire-gcs",[vV]:"fire-gcs-compat",[wV]:"fire-fst",[SV]:"fire-fst-compat",[xV]:"fire-vertex","fire-js":"fire-js",[kV]:"fire-js-all"};const hf=new Map,TV=new Map,Zw=new Map;function dM(t,e){try{t.container.addComponent(e)}catch(n){po.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function pf(t){const e=t.name;if(Zw.has(e))return po.debug(`There were multiple attempts to register component ${e}.`),!1;Zw.set(e,t);for(const n of hf.values())dM(n,t);for(const n of TV.values())dM(n,t);return!0}function aj(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function Us(t){return t==null?!1:t.settings!==void 0}const NV={"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."},Qi=new Wf("app","Firebase",NV);class MV{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 tu("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 Qi.create("app-deleted",{appName:this._name})}}const Gf=CV;function lj(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r={name:Kw,automaticDataCollectionEnabled:!0,...e},s=r.name;if(typeof s!="string"||!s)throw Qi.create("bad-app-name",{appName:String(s)});if(n||(n=tj()),!n)throw Qi.create("no-options");const i=hf.get(s);if(i)if(eu(n,i.options)){if(eu(r,i.config))return i;throw Qi.create("duplicate-app",{appName:s,mismatchedParam:"config",oldValue:JSON.stringify(i.config),newValue:JSON.stringify(r)})}else throw Qi.create("duplicate-app",{appName:s,mismatchedParam:"options",oldValue:JSON.stringify(i.options),newValue:JSON.stringify(n)});const o=new DF(s);for(const u of Zw.values())o.addComponent(u);const l=new MV(n,r,o);return hf.set(s,l),l}function cj(t=Kw){const e=hf.get(t);if(!e&&t===Kw&&tj())return lj();if(!e)throw Qi.create("no-app",{appName:t});return e}function _V(){return Array.from(hf.values())}function Gc(t,e,n){let r=EV[t]??t;n&&(r+=`-${n}`);const s=r.match(/\s|\//),i=e.match(/\s|\//);if(s||i){const o=[`Unable to register library "${r}" with version "${e}":`];s&&o.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&i&&o.push("and"),i&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),po.warn(o.join(" "));return}pf(new tu(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}const AV="firebase-heartbeat-database",RV=1,mf="firebase-heartbeat-store";let N0=null;function uj(){return N0||(N0=GF(AV,RV,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(mf)}catch(n){console.warn(n)}}}}).catch(t=>{throw Qi.create("idb-open",{originalErrorMessage:t.message})})),N0}async function OV(t){try{const n=(await uj()).transaction(mf),r=await n.objectStore(mf).get(dj(t));return await n.done,r}catch(e){if(e instanceof ja)po.warn(e.message);else{const n=Qi.create("idb-get",{originalErrorMessage:e?.message});po.warn(n.message)}}}async function fM(t,e){try{const r=(await uj()).transaction(mf,"readwrite");await r.objectStore(mf).put(e,dj(t)),await r.done}catch(n){if(n instanceof ja)po.warn(n.message);else{const r=Qi.create("idb-set",{originalErrorMessage:n?.message});po.warn(r.message)}}}function dj(t){return`${t.name}!${t.options.appId}`}const jV=1024,DV=30;class IV{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new PV(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=hM();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(s=>s.date===r))return;if(this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats.length>DV){const s=$V(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(s,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){po.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";const e=hM(),{heartbeatsToSend:n,unsentEntries:r}=LV(this._heartbeatsCache.heartbeats),s=QO(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)),s}catch(e){return po.warn(e),""}}}function hM(){return new Date().toISOString().substring(0,10)}function LV(t,e=jV){const n=[];let r=t.slice();for(const s of t){const i=n.find(o=>o.agent===s.agent);if(i){if(i.dates.push(s.date),pM(n)>e){i.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),pM(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class PV{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return SF()?kF().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await OV(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return fM(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 fM(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function pM(t){return QO(JSON.stringify({version:2,heartbeats:t})).length}function $V(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 zV(t){pf(new tu("platform-logger",e=>new ZF(e),"PRIVATE")),pf(new tu("heartbeat",e=>new IV(e),"PRIVATE")),Gc(Yw,uM,t),Gc(Yw,uM,"esm2020"),Gc("fire-js","")}zV("");var BV="firebase",FV="12.19.0";Gc(BV,FV,"app");function fj(){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 VV=fj,hj=new Wf("auth","Firebase",fj());const zm=new sj("@firebase/auth");function gm(t,...e){zm.logLevel<=Ut.WARN&&zm.warn(`Auth (${Gf}): ${t}`,...e)}function ym(t,...e){zm.logLevel<=Ut.ERROR&&zm.error(`Auth (${Gf}): ${t}`,...e)}function _s(t,...e){throw PS(t,...e)}function Zs(t,...e){return PS(t,...e)}function ry(t,e,n){const r={...VV(),[e]:n};return new Wf("auth","Firebase",r).create(e,{appName:t.name})}function pa(t){return ry(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function HV(t,e,n){const r=n;if(!(e instanceof r))throw r.name!==e.constructor.name&&_s(t,"argument-error"),ry(t,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function PS(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 hj.create(t,...e)}function tt(t,e,...n){if(!t)throw PS(e,...n)}function eo(t){const e="INTERNAL ASSERTION FAILED: "+t;throw ym(e),new Error(e)}function mo(t,e){t||eo(e)}function Xw(){return typeof self<"u"&&self.location?.href||""}function UV(){return mM()==="http:"||mM()==="https:"}function mM(){return typeof self<"u"&&self.location?.protocol||null}function WV(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(UV()||vF()||"connection"in navigator)?navigator.onLine:!0}function qV(){if(typeof navigator>"u")return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}class Yf{constructor(e,n){this.shortDelay=e,this.longDelay=n,mo(n>e,"Short delay should be less than long delay!"),this.isMobile=yF()||wF()}get(){return WV()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function $S(t,e){mo(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}class pj{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;eo("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;eo("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;eo("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const GV={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 YV=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],KV=new Yf(3e4,6e4);function Bl(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function Da(t,e,n,r,s={}){return mj(t,s,async()=>{let i={},o={};r&&(e==="GET"?o=r:i={body:JSON.stringify(r)});const l=qf({...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 d={method:e,headers:u,...i};return bF()||(d.referrerPolicy="strict-origin-when-cross-origin"),t.emulatorConfig&&IS(t.emulatorConfig.host)&&(d.credentials="include"),pj.fetch()(await gj(t,t.config.apiHost,n,l),d)})}async function mj(t,e,n){t._canInitEmulator=!1;const r={...GV,...e};try{const s=new XV(t),i=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const o=await i.json();if("needConfirmation"in o)throw Np(t,"account-exists-with-different-credential",o);if(i.ok&&!("errorMessage"in o))return o;{const l=i.ok?o.errorMessage:o.error.message,[u,d]=l.split(" : ");if(u==="FEDERATED_USER_ID_ALREADY_LINKED")throw Np(t,"credential-already-in-use",o);if(u==="EMAIL_EXISTS")throw Np(t,"email-already-in-use",o);if(u==="USER_DISABLED")throw Np(t,"user-disabled",o);const h=r[u]||u.toLowerCase().replace(/[_\s]+/g,"-");if(d)throw ry(t,h,d);_s(t,h)}}catch(s){if(s instanceof ja)throw s;_s(t,"network-request-failed",{message:String(s)})}}async function sy(t,e,n,r,s={}){const i=await Da(t,e,n,r,s);return"mfaPendingCredential"in i&&_s(t,"multi-factor-auth-required",{_serverResponse:i}),i}async function gj(t,e,n,r){const s=`${e}${n}?${r}`,i=t,o=i.config.emulator?$S(t.config,s):`${t.config.apiScheme}://${s}`;return YV.includes(n)&&(await i._persistenceManagerAvailable,i._getPersistenceType()==="COOKIE")?i._getPersistence()._getFinalTarget(o).toString():o}function ZV(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class XV{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(Zs(this.auth,"network-request-failed")),KV.get())})}}function Np(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=Zs(t,e,r);return s.customData._tokenResponse=n,s}function gM(t){return t!==void 0&&t.enterprise!==void 0}class JV{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 ZV(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 QV(t,e){return Da(t,"GET","/v2/recaptchaConfig",Bl(t,e))}async function eH(t,e){return Da(t,"POST","/v1/accounts:delete",e)}async function Bm(t,e){return Da(t,"POST","/v1/accounts:lookup",e)}function Kd(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function tH(t,e=!1){const n=vo(t),r=await n.getIdToken(e),s=zS(r);tt(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const i=typeof s.firebase=="object"?s.firebase:void 0,o=i?.sign_in_provider;return{claims:s,token:r,authTime:Kd(M0(s.auth_time)),issuedAtTime:Kd(M0(s.iat)),expirationTime:Kd(M0(s.exp)),signInProvider:o||null,signInSecondFactor:i?.sign_in_second_factor||null}}function M0(t){return Number(t)*1e3}function zS(t){const[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return ym("JWT malformed, contained fewer than 3 sections"),null;try{const s=ej(n);return s?JSON.parse(s):(ym("Failed to decode base64 JWT payload"),null)}catch(s){return ym("Caught error parsing JWT payload as JSON",s?.toString()),null}}function yM(t){const e=zS(t);return tt(e,"internal-error"),tt(typeof e.exp<"u","internal-error"),tt(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function gf(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof ja&&nH(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function nH({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}class rH{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 Jw{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Kd(this.lastLoginAt),this.creationTime=Kd(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function Fm(t){const e=t.auth,n=await t.getIdToken(),r=await gf(t,Bm(e,{idToken:n}));tt(r?.users.length,e,"internal-error");const s=r.users[0];t._notifyReloadListener(s);const i=s.providerUserInfo?.length?yj(s.providerUserInfo):[],o=iH(t.providerData,i),l=t.isAnonymous,u=!(t.email&&s.passwordHash)&&!o?.length,d=l?u:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:o,metadata:new Jw(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(t,h)}async function sH(t){const e=vo(t);await Fm(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function iH(t,e){return[...t.filter(r=>!e.some(s=>s.providerId===r.providerId)),...e]}function yj(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 oH(t,e){const n=await mj(t,{},async()=>{const r=qf({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:i}=t.config,o=await gj(t,s,"/v1/token",`key=${i}`),l=await t._getAdditionalHeaders();l["Content-Type"]="application/x-www-form-urlencoded";const u={method:"POST",headers:l,body:r};return t.emulatorConfig&&IS(t.emulatorConfig.host)&&(u.credentials="include"),pj.fetch()(o,u)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function aH(t,e){return Da(t,"POST","/v2/accounts:revokeToken",Bl(t,e))}class Yc{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){tt(e.idToken,"internal-error"),tt(typeof e.idToken<"u","internal-error"),tt(typeof e.refreshToken<"u","internal-error");const n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):yM(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){tt(e.length!==0,"internal-error");const n=yM(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(tt(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:s,expiresIn:i}=await oH(e,n);this.updateTokensAndExpiration(r,s,Number(i))}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:s,expirationTime:i}=n,o=new Yc;return r&&(tt(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),s&&(tt(typeof s=="string","internal-error",{appName:e}),o.accessToken=s),i&&(tt(typeof i=="number","internal-error",{appName:e}),o.expirationTime=i),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 Yc,this.toJSON())}_performRefresh(){return eo("not implemented")}}function Go(t,e){tt(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}class Gs{constructor({uid:e,auth:n,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new rH(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new Jw(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const n=await gf(this,this.stsTokenManager.getToken(this.auth,e));return tt(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return tH(this,e)}reload(){return sH(this)}_assign(e){this!==e&&(tt(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 Gs({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){tt(!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 Fm(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Us(this.auth.app))return Promise.reject(pa(this.auth));const e=await this.getIdToken();return await gf(this,eH(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,s=n.email??void 0,i=n.phoneNumber??void 0,o=n.photoURL??void 0,l=n.tenantId??void 0,u=n._redirectEventId??void 0,d=n.createdAt??void 0,h=n.lastLoginAt??void 0,{uid:m,emailVerified:y,isAnonymous:b,providerData:v,stsTokenManager:x}=n;tt(m&&x,e,"internal-error");const k=Yc.fromJSON(this.name,x);tt(typeof m=="string",e,"internal-error"),Go(r,e.name),Go(s,e.name),tt(typeof y=="boolean",e,"internal-error"),tt(typeof b=="boolean",e,"internal-error"),Go(i,e.name),Go(o,e.name),Go(l,e.name),Go(u,e.name),Go(d,e.name),Go(h,e.name);const E=new Gs({uid:m,auth:e,email:s,emailVerified:y,displayName:r,isAnonymous:b,photoURL:o,phoneNumber:i,tenantId:l,stsTokenManager:k,createdAt:d,lastLoginAt:h});return v&&Array.isArray(v)&&(E.providerData=v.map(M=>({...M}))),u&&(E._redirectEventId=u),E}static async _fromIdTokenResponse(e,n,r=!1){const s=new Yc;s.updateFromServerResponse(n);const i=new Gs({uid:n.localId,auth:e,stsTokenManager:s,isAnonymous:r});return await Fm(i),i}static async _fromGetAccountInfoResponse(e,n,r){const s=n.users[0];tt(s.localId!==void 0,"internal-error");const i=s.providerUserInfo!==void 0?yj(s.providerUserInfo):[],o=!(s.email&&s.passwordHash)&&!i?.length,l=new Yc;l.updateFromIdToken(r);const u=new Gs({uid:s.localId,auth:e,stsTokenManager:l,isAnonymous:o}),d={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new Jw(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!i?.length};return Object.assign(u,d),u}}const bM=new Map;function to(t){mo(t instanceof Function,"Expected a class definition");let e=bM.get(t);return e?(mo(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,bM.set(t,e),e)}class bj{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){}}bj.type="NONE";const vM=bj;function bm(t,e,n){return`firebase:${t}:${e}:${n}`}class xl{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;const{config:s,name:i}=this.auth;this.fullUserKey=bm(this.userKey,s.apiKey,i),this.fullPersistenceKey=bm("persistence",s.apiKey,i),this.boundEventHandler=n._onStorageEvent.bind(n);try{this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}catch{}}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 Bm(this.auth,{idToken:e}).catch(()=>{});return n?Gs._fromGetAccountInfoResponse(this.auth,n,e):null}return Gs._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(){try{this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}catch{}}static async create(e,n,r="authUser"){if(!n.length)return new xl(to(vM),e,r);const s=(await Promise.all(n.map(async d=>{try{if(await d._isAvailable())return d}catch{return}}))).filter(d=>d);let i=s[0]||to(vM);const o=bm(r,e.config.apiKey,e.name);let l=null;for(const d of n)try{const h=await d._get(o);if(h){let m;if(typeof h=="string"){const y=await Bm(e,{idToken:h}).catch(()=>{});if(!y)break;m=await Gs._fromGetAccountInfoResponse(e,y,h)}else m=Gs._fromJSON(e,h);d!==i&&(l=m),i=d;break}}catch{}const u=s.filter(d=>d._shouldAllowMigration);return!i._shouldAllowMigration||!u.length?new xl(i,e,r):(i=u[0],l&&await i._set(o,l.toJSON()),await Promise.all(n.map(async d=>{if(d!==i)try{await d._remove(o)}catch{}})),new xl(i,e,r))}}function wM(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Sj(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(vj(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Cj(e))return"Blackberry";if(Ej(e))return"Webos";if(wj(e))return"Safari";if((e.includes("chrome/")||xj(e))&&!e.includes("edge/"))return"Chrome";if(kj(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 vj(t=Tr()){return/firefox\//i.test(t)}function wj(t=Tr()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function xj(t=Tr()){return/crios\//i.test(t)}function Sj(t=Tr()){return/iemobile/i.test(t)}function kj(t=Tr()){return/android/i.test(t)}function Cj(t=Tr()){return/blackberry/i.test(t)}function Ej(t=Tr()){return/webos/i.test(t)}function BS(t=Tr()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function lH(t=Tr()){return BS(t)&&!!window.navigator?.standalone}function cH(){return xF()&&document.documentMode===10}function Tj(t=Tr()){return BS(t)||kj(t)||Ej(t)||Cj(t)||/windows phone/i.test(t)||Sj(t)}function Nj(t,e=[]){let n;switch(t){case"Browser":n=wM(Tr());break;case"Worker":n=`${wM(Tr())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Gf}/${r}`}class uH{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const r=i=>new Promise((o,l)=>{try{const u=e(i);o(u)}catch(u){l(u)}});r.onAbort=n,this.queue.push(r);const s=this.queue.length-1;return()=>{this.queue[s]=()=>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 s of n)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r?.message})}}}async function dH(t,e={}){return Da(t,"GET","/v2/passwordPolicy",Bl(t,e))}const fH=6;class hH{constructor(e){const n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??fH,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,s=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),s&&(n.meetsMaxPasswordLength=e.length<=s)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let s=0;s<e.length;s++)r=e.charAt(s),this.updatePasswordCharacterOptionsStatuses(n,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,s,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}class pH{constructor(e,n,r,s){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new xM(this),this.idTokenSubscription=new xM(this),this.beforeStateQueue=new uH(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=hj,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=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(i=>this._resolvePersistenceManagerAvailable=i)}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=to(n)),this._initializationPromise=this.queue(async()=>{if(!this._deleted){try{this.persistenceManager=await xl.create(this,e)}catch(r){gm(`Failed to initialize persistence: ${r}`),this.persistenceManager=await xl.create(this,[])}finally{this._resolvePersistenceManagerAvailable?.()}if(!this._deleted){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}try{await this.initializeCurrentUser(n)}catch(r){gm(`Failed to initialize current user: ${r}`),await this.directlySetCurrentUser(null).catch(()=>{})}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 Bm(this,{idToken:e}),r=await Gs._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(Us(this.app)){const i=this.app.settings.authIdToken;return i?new Promise(o=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(i).then(o,o))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const i=this.redirectUser?._redirectEventId,o=r?._redirectEventId,l=await this.tryRedirectSignIn(e);(!i||i===o)&&l?.user&&(r=l.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(i){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(i))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return tt(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 Fm(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=qV()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Us(this.app))return Promise.reject(pa(this));const n=e?vo(e):null;return n&&tt(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&&tt(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 Us(this.app)?Promise.reject(pa(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Us(this.app)?Promise.reject(pa(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(to(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 dH(this),n=new hH(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 Wf("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 aH(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&&to(e)||this._popupRedirectResolver;tt(n,this,"argument-error"),this.redirectPersistenceManager=await xl.create(this,[to(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,s){if(this._deleted)return()=>{};const i=typeof n=="function"?n:n.next.bind(n);let o=!1;const l=this._isInitialized?Promise.resolve():this._initializationPromise;if(tt(l,this,"internal-error"),l.then(()=>{o||i(this.currentUser)}).catch(u=>{if(!o)if(typeof n!="function"&&n.error)n.error(u);else if(r)r(u);else throw u}),typeof n=="function"){const u=e.addObserver(n,r,s);return()=>{o=!0,u()}}else{const u=e.addObserver(n);return()=>{o=!0,u()}}}async directlySetCurrentUser(e){if(this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,this.persistenceManager)try{e?await this.persistenceManager.setCurrentUser(e):await this.persistenceManager.removeCurrentUser()}catch(n){const r=n?.message||String(n),s=ry(this,"internal-error",`An internal AuthError has occurred: ${r}`);throw s.customData={originalError:n},s}}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return tt(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Nj(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(Us(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&gm(`Error while retrieving App Check token: ${e.error}`),e?.token}}function Fl(t){return vo(t)}class xM{constructor(e){this.auth=e,this.observer=null,this.addObserver=NF(n=>this.observer=n)}get next(){return tt(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let iy={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function mH(t){iy=t}function Mj(t){return iy.loadJS(t)}function gH(){return iy.recaptchaEnterpriseScript}function yH(){return iy.gapiScript}function bH(t){return`__${t}${Math.floor(Math.random()*1e6)}`}class vH{constructor(){this.enterprise=new wH}ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}}class wH{ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}}const xH="recaptcha-enterprise",_j="NO_RECAPTCHA",SM="onFirebaseAuthREInstanceReady";class na{constructor(e){this.type=xH,this.auth=Fl(e)}async verify(e="verify",n=!1){async function r(i){if(!n){if(i.tenantId==null&&i._agentRecaptchaConfig!=null)return i._agentRecaptchaConfig.siteKey;if(i.tenantId!=null&&i._tenantRecaptchaConfigs[i.tenantId]!==void 0)return i._tenantRecaptchaConfigs[i.tenantId].siteKey}return new Promise(async(o,l)=>{QV(i,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(u=>{if(u.recaptchaKey===void 0)l(new Error("recaptcha Enterprise site key undefined"));else{const d=new JV(u);return i.tenantId==null?i._agentRecaptchaConfig=d:i._tenantRecaptchaConfigs[i.tenantId]=d,o(d.siteKey)}}).catch(u=>{l(u)})})}function s(i,o,l){const u=window.grecaptcha;gM(u)?u.enterprise.ready(()=>{u.enterprise.execute(i,{action:e}).then(d=>{o(d)}).catch(()=>{o(_j)})}):l(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new vH().execute("siteKey",{action:"verify"}):new Promise((i,o)=>{r(this.auth).then(async l=>{if(!n&&gM(window.grecaptcha)&&na.scriptInjectionDeferred)await na.scriptInjectionDeferred.promise,s(l,i,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let u=gH();u.length!==0&&(u+=l+`&onload=${SM}`),na.scriptInjectionDeferred=new rj,window[SM]=()=>{na.scriptInjectionDeferred?.resolve()},Mj(u).then(()=>na.scriptInjectionDeferred?.promise).then(()=>{s(l,i,o)}).catch(d=>{o(d)})}}).catch(l=>{o(l)})})}}na.scriptInjectionDeferred=null;async function kM(t,e,n,r=!1,s=!1){const i=new na(t);let o;if(s)o=_j;else try{o=await i.verify(n)}catch{o=await i.verify(n,!0)}const l={...e};if(n==="mfaSmsEnrollment"||n==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in l){const u=l.phoneEnrollmentInfo.phoneNumber,d=l.phoneEnrollmentInfo.recaptchaToken;Object.assign(l,{phoneEnrollmentInfo:{phoneNumber:u,recaptchaToken:d,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 CM(t,e,n,r,s){if(t._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const i=await kM(t,e,n,n==="getOobCode");return r(t,i)}else return r(t,e).catch(async i=>{if(i.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 kM(t,e,n,n==="getOobCode");return r(t,o)}else return Promise.reject(i)})}function SH(t,e){const n=aj(t,"auth");if(n.isInitialized()){const s=n.getImmediate(),i=n.getOptions();if(eu(i,e??{}))return s;_s(s,"already-initialized")}return n.initialize({options:e})}function kH(t,e){const n=e?.persistence||[],r=(Array.isArray(n)?n:[n]).map(to);e?.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e?.popupRedirectResolver)}function CH(t,e,n){const r=Fl(t);tt(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!1,i=Aj(e),{host:o,port:l}=EH(e),u=l===null?"":`:${l}`,d={url:`${i}//${o}${u}/`},h=Object.freeze({host:o,port:l,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){tt(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),tt(eu(d,r.config.emulator)&&eu(h,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=d,r.emulatorConfig=h,r.settings.appVerificationDisabledForTesting=!0,IS(o)?AF(`${i}//${o}${u}`):TH()}function Aj(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function EH(t){const e=Aj(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const i=s[1];return{host:i,port:EM(r.substr(i.length+1))}}else{const[i,o]=r.split(":");return{host:i,port:EM(o)}}}function EM(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}function TH(){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 FS{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return eo("not implemented")}_getIdTokenResponse(e){return eo("not implemented")}_linkToIdToken(e,n){return eo("not implemented")}_getReauthenticationResolver(e){return eo("not implemented")}}async function NH(t,e){return Da(t,"POST","/v1/accounts:signUp",e)}async function MH(t,e){return sy(t,"POST","/v1/accounts:signInWithPassword",Bl(t,e))}async function _H(t,e){return sy(t,"POST","/v1/accounts:signInWithEmailLink",Bl(t,e))}async function AH(t,e){return sy(t,"POST","/v1/accounts:signInWithEmailLink",Bl(t,e))}class yf extends FS{constructor(e,n,r,s=null){super("password",r),this._email=e,this._password=n,this._tenantId=s}static _fromEmailAndPassword(e,n){return new yf(e,n,"password")}static _fromEmailAndCode(e,n,r=null){return new yf(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 CM(e,n,"signInWithPassword",MH);case"emailLink":return _H(e,{email:this._email,oobCode:this._password});default:_s(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 CM(e,r,"signUpPassword",NH);case"emailLink":return AH(e,{idToken:n,email:this._email,oobCode:this._password});default:_s(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function Kc(t,e){return sy(t,"POST","/v1/accounts:signInWithIdp",Bl(t,e))}const RH="http://localhost";class Nl extends FS{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const n=new Nl(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):_s("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:s,...i}=n;if(!r||!s)return null;const o=new Nl(r,s);return o.idToken=i.idToken||void 0,o.accessToken=i.accessToken||void 0,o.secret=i.secret,o.nonce=i.nonce,o.pendingToken=i.pendingToken||null,o}_getIdTokenResponse(e){const n=this.buildRequest();return Kc(e,n)}_linkToIdToken(e,n){const r=this.buildRequest();return r.idToken=n,Kc(e,r)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,Kc(e,n)}buildRequest(){const e={requestUri:RH,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=qf(n)}return e}}function OH(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 jH(t){const e=Id(Ld(t)).link,n=e?Id(Ld(e)).deep_link_id:null,r=Id(Ld(t)).deep_link_id;return(r?Id(Ld(r)).link:null)||r||n||e||t}class VS{constructor(e){const n=Id(Ld(e)),r=n.apiKey??null,s=n.oobCode??null,i=OH(n.mode??null);tt(r&&s&&i,"argument-error"),this.apiKey=r,this.operation=i,this.code=s,this.continueUrl=n.continueUrl??null,this.languageCode=n.lang??null,this.tenantId=n.tenantId??null}static parseLink(e){const n=jH(e);try{return new VS(n)}catch{return null}}}class Su{constructor(){this.providerId=Su.PROVIDER_ID}static credential(e,n){return yf._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){const r=VS.parseLink(n);return tt(r,"argument-error"),yf._fromEmailAndCode(e,r.code,r.tenantId)}}Su.PROVIDER_ID="password";Su.EMAIL_PASSWORD_SIGN_IN_METHOD="password";Su.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class HS{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 Kf extends HS{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class ra extends Kf{constructor(){super("facebook.com")}static credential(e){return Nl._fromParams({providerId:ra.PROVIDER_ID,signInMethod:ra.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return ra.credentialFromTaggedObject(e)}static credentialFromError(e){return ra.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return ra.credential(e.oauthAccessToken)}catch{return null}}}ra.FACEBOOK_SIGN_IN_METHOD="facebook.com";ra.PROVIDER_ID="facebook.com";class Xi extends Kf{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return Nl._fromParams({providerId:Xi.PROVIDER_ID,signInMethod:Xi.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return Xi.credentialFromTaggedObject(e)}static credentialFromError(e){return Xi.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return Xi.credential(n,r)}catch{return null}}}Xi.GOOGLE_SIGN_IN_METHOD="google.com";Xi.PROVIDER_ID="google.com";class sa extends Kf{constructor(){super("github.com")}static credential(e){return Nl._fromParams({providerId:sa.PROVIDER_ID,signInMethod:sa.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return sa.credentialFromTaggedObject(e)}static credentialFromError(e){return sa.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return sa.credential(e.oauthAccessToken)}catch{return null}}}sa.GITHUB_SIGN_IN_METHOD="github.com";sa.PROVIDER_ID="github.com";class ia extends Kf{constructor(){super("twitter.com")}static credential(e,n){return Nl._fromParams({providerId:ia.PROVIDER_ID,signInMethod:ia.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return ia.credentialFromTaggedObject(e)}static credentialFromError(e){return ia.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return ia.credential(n,r)}catch{return null}}}ia.TWITTER_SIGN_IN_METHOD="twitter.com";ia.PROVIDER_ID="twitter.com";class nu{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,s=!1){const i=await Gs._fromIdTokenResponse(e,r,s),o=TM(r);return new nu({user:i,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);const s=TM(r);return new nu({user:e,providerId:s,_tokenResponse:r,operationType:n})}}function TM(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}class Vm extends ja{constructor(e,n,r,s){super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,Vm.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,s){return new Vm(e,n,r,s)}}function Rj(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?Vm._fromErrorAndOperation(t,i,e,r):i})}async function DH(t,e,n=!1){const r=await gf(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return nu._forOperation(t,"link",r)}async function IH(t,e,n=!1){const{auth:r}=t;if(Us(r.app))return Promise.reject(pa(r));const s="reauthenticate";try{const i=await gf(t,Rj(r,s,e,t),n);tt(i.idToken,r,"internal-error");const o=zS(i.idToken);tt(o,r,"internal-error");const{sub:l}=o;return tt(t.uid===l,r,"user-mismatch"),nu._forOperation(t,s,i)}catch(i){throw i?.code==="auth/user-not-found"&&_s(r,"user-mismatch"),i}}async function Oj(t,e,n=!1){if(Us(t.app))return Promise.reject(pa(t));const r="signIn",s=await Rj(t,r,e),i=await nu._fromIdTokenResponse(t,r,s);return n||await t._updateCurrentUser(i.user),i}async function LH(t,e){return Oj(Fl(t),e)}async function PH(t){const e=Fl(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}function $H(t,e,n){return Us(t.app)?Promise.reject(pa(t)):LH(vo(t),Su.credential(e,n)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&PH(t),r})}function zH(t,e,n,r){return vo(t).onIdTokenChanged(e,n,r)}function BH(t,e,n){return vo(t).beforeAuthStateChanged(e,n)}function FH(t,e,n,r){return vo(t).onAuthStateChanged(e,n,r)}function NM(t){return vo(t).signOut()}const Hm="__sak";class jj{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Hm,"1"),this.storage.removeItem(Hm),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 VH=1e3,HH=10;class Dj extends jj{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Tj(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),s=this.localCache[n];r!==s&&e(n,s,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 s=()=>{const o=this.storage.getItem(r);!n&&this.localCache[r]===o||this.notifyListeners(r,o)},i=this.storage.getItem(r);cH()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,HH):s()}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(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)})},VH)}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]}}Dj.type="LOCAL";const UH=Dj;class Ij extends jj{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}}Ij.type="SESSION";const Lj=Ij;function WH(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}class oy{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const n=this.receivers.find(s=>s.isListeningto(e));if(n)return n;const r=new oy(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const n=e,{eventId:r,eventType:s,data:i}=n.data,o=this.handlersMap[s];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const l=Array.from(o).map(async d=>d(n.origin,i)),u=await WH(l);n.ports[0].postMessage({status:"done",eventId:r,eventType:s,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)}}oy.receivers=[];function US(t="",e=10){let n="";for(let r=0;r<e;r++)n+=Math.floor(Math.random()*10);return t+n}class qH{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 s=typeof MessageChannel<"u"?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let i,o;return new Promise((l,u)=>{const d=US("",20);s.port1.start();const h=setTimeout(()=>{u(new Error("unsupported_event"))},r);o={messageChannel:s,onMessage(m){const y=m;if(y.data.eventId===d)switch(y.data.status){case"ack":clearTimeout(h),i=setTimeout(()=>{u(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),l(y.data.response);break;default:clearTimeout(h),clearTimeout(i),u(new Error("invalid_response"));break}}},this.handlers.add(o),s.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:d,data:n},[s.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}function mi(){return window}function GH(t){mi().location.href=t}function Pj(){return typeof mi().WorkerGlobalScope<"u"&&typeof mi().importScripts=="function"}async function YH(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function KH(){return navigator?.serviceWorker?.controller||null}function ZH(){return Pj()?self:null}const $j="firebaseLocalStorageDb",XH=1,Um="firebaseLocalStorage",zj="fbase_key";class Zf{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 ay(t,e){return t.transaction([Um],e?"readwrite":"readonly").objectStore(Um)}function JH(){const t=indexedDB.deleteDatabase($j);return new Zf(t).toPromise()}function Bj(){const t=indexedDB.open($j,XH);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const r=t.result;try{r.createObjectStore(Um,{keyPath:zj})}catch(s){n(s)}}),t.addEventListener("success",async()=>{const r=t.result;r.objectStoreNames.contains(Um)?e(r):(r.close(),await JH(),e(await Bj()))})})}async function MM(t,e,n){const r=ay(t,!0).put({[zj]:e,value:n});return new Zf(r).toPromise()}async function QH(t,e){const n=ay(t,!1).get(e),r=await new Zf(n).toPromise();return r===void 0?null:r.value}function _M(t,e){const n=ay(t,!0).delete(e);return new Zf(n).toPromise()}const eU=800,tU=3;class Fj{registerLifecycleListeners(){typeof window<"u"&&typeof window.addEventListener=="function"&&(window.addEventListener("pagehide",this.onPageHide),window.addEventListener("pageshow",this.onPageShow))}unregisterLifecycleListeners(){typeof window<"u"&&typeof window.removeEventListener=="function"&&(window.removeEventListener("pagehide",this.onPageHide),window.removeEventListener("pageshow",this.onPageShow))}constructor(){this.type="LOCAL",this.dbPromise=null,this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.isClosing=!1,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this.onPageHide=()=>{this.isClosing=!0,this.stopPolling(),this.dbPromise&&(this.dbPromise.then(e=>e.close()).catch(()=>{}),this.dbPromise=null)},this.onPageShow=()=>{this.isClosing&&(this.isClosing=!1,Object.keys(this.listeners).length>0&&this.startPolling())},this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.dbPromise?this.dbPromise:(this.dbPromise=Bj(),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(n++>tU)throw r;if(this.dbPromise){const s=this.dbPromise;this.dbPromise=null;try{(await s).close()}catch{}}}}async initializeServiceWorkerMessaging(){return Pj()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=oy._getInstance(ZH()),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 YH(),!this.activeServiceWorker)return;this.sender=new qH(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||KH()!==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 MM(e,Hm,"1"),await _M(e,Hm)}),!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=>MM(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){const n=await this._withRetries(r=>QH(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>_M(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){if(this.isClosing)return[];try{const e=await this._withRetries(s=>{const i=ay(s,!1).getAll();return new Zf(i).toPromise()});if(this.isClosing)return[];if(!e)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(e.length!==0)for(const{fbase_key:s,value:i}of e)r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(i)&&(this.notifyListeners(s,i),n.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!r.has(s)&&(this.notifyListeners(s,null),n.push(s));return n}catch(e){return this.isClosing||gm(`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 s of Array.from(r))s(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),eU)}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())}}Fj.type="LOCAL";const nU=Fj;new Yf(3e4,6e4);function Vj(t,e){return e?to(e):(tt(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}class WS extends FS{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Kc(e,this._buildIdpRequest())}_linkToIdToken(e,n){return Kc(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return Kc(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 rU(t){return Oj(t.auth,new WS(t),t.bypassAuthState)}function sU(t){const{auth:e,user:n}=t;return tt(n,e,"internal-error"),IH(n,new WS(t),t.bypassAuthState)}async function iU(t){const{auth:e,user:n}=t;return tt(n,e,"internal-error"),DH(n,new WS(t),t.bypassAuthState)}class Hj{constructor(e,n,r,s,i=!1){this.auth=e,this.resolver=r,this.user=s,this.bypassAuthState=i,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:s,tenantId:i,error:o,type:l}=e;if(o){this.reject(o);return}const u={auth:this.auth,requestUri:n,sessionId:r,tenantId:i||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(l)(u))}catch(d){this.reject(d)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return rU;case"linkViaPopup":case"linkViaRedirect":return iU;case"reauthViaPopup":case"reauthViaRedirect":return sU;default:_s(this.auth,"internal-error")}}resolve(e){mo(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){mo(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 oU=new Yf(2e3,1e4);async function aU(t,e,n){if(Us(t.app))return Promise.reject(Zs(t,"operation-not-supported-in-this-environment"));const r=Fl(t);HV(t,e,HS);const s=Vj(r,n);return new pl(r,"signInViaPopup",e,s).executeNotNull()}class pl extends Hj{constructor(e,n,r,s,i){super(e,n,s,i),this.provider=r,this.authWindow=null,this.pollId=null,pl.currentPopupAction&&pl.currentPopupAction.cancel(),pl.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return tt(e,this.auth,"internal-error"),e}async onExecution(){mo(this.filter.length===1,"Popup operations only handle one event");const e=US();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(Zs(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(Zs(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,pl.currentPopupAction=null}pollUserCancellation(){const e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Zs(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,oU.get())};e()}}pl.currentPopupAction=null;const lU="pendingRedirect",vm=new Map;class cU extends Hj{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=vm.get(this.auth._key());if(!e){try{const r=await uU(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}vm.set(this.auth._key(),e)}return this.bypassAuthState||vm.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 uU(t,e){const n=hU(e),r=fU(t);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function dU(t,e){vm.set(t._key(),e)}function fU(t){return to(t._redirectPersistence)}function hU(t){return bm(lU,t.config.apiKey,t.name)}async function pU(t,e,n=!1){if(Us(t.app))return Promise.reject(pa(t));const r=Fl(t),s=Vj(r,e),o=await new cU(r,s,n).execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}const mU=600*1e3;class gU{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||!yU(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){if(e.error&&!Uj(e)){const r=e.error.code?.split("auth/")[1]||"internal-error";n.onError(Zs(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>=mU&&this.cachedEventUids.clear(),this.cachedEventUids.has(AM(e))}saveEventToCache(e){this.cachedEventUids.add(AM(e)),this.lastProcessedEventTime=Date.now()}}function AM(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function Uj({type:t,error:e}){return t==="unknown"&&e?.code==="auth/no-auth-event"}function yU(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Uj(t);default:return!1}}async function bU(t,e={}){return Da(t,"GET","/v1/projects",e)}const vU=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wU=/^https?/;async function xU(t){if(t.config.emulator)return;const{authorizedDomains:e}=await bU(t);for(const n of e)try{if(SU(n))return}catch{}_s(t,"unauthorized-domain")}function SU(t){const e=Xw(),{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(!wU.test(n))return!1;if(vU.test(t))return r===t;const s=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}const kU=new Yf(3e4,6e4);function RM(){const t=mi().___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 CU(t){return new Promise((e,n)=>{function r(){RM(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{RM(),n(Zs(t,"network-request-failed"))},timeout:kU.get()})}if(mi().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(mi().gapi?.load)r();else{const s=bH("iframefcb");return mi()[s]=()=>{gapi.load?r():n(Zs(t,"network-request-failed"))},Mj(`${yH()}?onload=${s}`).catch(i=>n(i))}}).catch(e=>{throw wm=null,e})}let wm=null;function EU(t){return wm=wm||CU(t),wm}const TU=new Yf(5e3,15e3),NU="__/auth/iframe",MU="emulator/auth/iframe",_U={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},AU=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function RU(t){const e=t.config;tt(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?$S(e,MU):`https://${t.config.authDomain}/${NU}`,r={apiKey:e.apiKey,appName:t.name,v:Gf},s=AU.get(t.config.apiHost);s&&(r.eid=s);const i=t._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${qf(r).slice(1)}`}async function OU(t){const e=await EU(t),n=mi().gapi;return tt(n,t,"internal-error"),e.open({where:document.body,url:RU(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:_U,dontclear:!0},r=>new Promise(async(s,i)=>{await r.restyle({setHideOnLeave:!1});const o=Zs(t,"network-request-failed"),l=mi().setTimeout(()=>{i(o)},TU.get());function u(){mi().clearTimeout(l),s(r)}r.ping(u).then(u,()=>{i(o)})}))}const jU={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},DU=500,IU=600,LU="_blank",PU="http://localhost";class OM{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function $U(t,e,n,r=DU,s=IU){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let l="";const u={...jU,width:r.toString(),height:s.toString(),top:i,left:o},d=Tr().toLowerCase();n&&(l=xj(d)?LU:n),vj(d)&&(e=e||PU,u.scrollbars="yes");const h=Object.entries(u).reduce((y,[b,v])=>`${y}${b}=${v},`,"");if(lH(d)&&l!=="_self")return zU(e||"",l),new OM(null);const m=window.open(e||"",l,h);tt(m,t,"popup-blocked");try{m.focus()}catch{}return new OM(m)}function zU(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 BU="__/auth/handler",FU="emulator/auth/handler",VU=encodeURIComponent("fac");async function jM(t,e,n,r,s,i){tt(t.config.authDomain,t,"auth-domain-config-required"),tt(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Gf,eventId:s};if(e instanceof HS){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",TF(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[h,m]of Object.entries({}))o[h]=m}if(e instanceof Kf){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(),d=u?`#${VU}=${encodeURIComponent(u)}`:"";return`${HU(t)}?${qf(l).slice(1)}${d}`}function HU({config:t}){return t.emulator?$S(t,FU):`https://${t.authDomain}/${BU}`}const _0="webStorageSupport";class UU{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Lj,this._completeRedirectFn=pU,this._overrideRedirectResult=dU}async _openPopup(e,n,r,s){mo(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");const i=await jM(e,n,r,Xw(),s);return $U(e,i,US())}async _openRedirect(e,n,r,s){await this._originValidation(e);const i=await jM(e,n,r,Xw(),s);return GH(i),new Promise(()=>{})}_initialize(e){const n=e._key();if(this.eventManagers[n]){const{manager:s,promise:i}=this.eventManagers[n];return s?Promise.resolve(s):(mo(i,"If manager is not set, promise should be"),i)}const r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){const n=await OU(e),r=new gU(e);return n.register("authEvent",s=>(tt(s?.authEvent,e,"invalid-auth-event"),{status:r.onEvent(s.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(_0,{type:_0},s=>{const i=s?.[0]?.[_0];i!==void 0&&n(!!i),_s(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=xU(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Tj()||wj()||BS()}}const WU=UU;var DM="@firebase/auth",IM="1.13.6";class qU{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(){tt(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}function GU(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 YU(t){pf(new tu("auth",(e,{options:n})=>{const r=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:o,authDomain:l}=r.options;tt(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:Nj(t)},d=new pH(r,s,i,u);return kH(d,n),d},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),pf(new tu("auth-internal",e=>{const n=Fl(e.getProvider("auth").getImmediate());return(r=>new qU(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),Gc(DM,IM,GU(t)),Gc(DM,IM,"esm2020")}const KU=300,ZU=nj("authIdTokenMaxAge")||KU;let LM=null;const XU=t=>async e=>{const n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>ZU)return;const s=n?.token;LM!==s&&(LM=s,await fetch(t,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function JU(t=cj()){const e=aj(t,"auth");if(e.isInitialized())return e.getImmediate();const n=SH(t,{popupRedirectResolver:WU,persistence:[nU,UH,Lj]}),r=nj("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const i=new URL(r,location.origin);if(location.origin===i.origin){const o=XU(i.toString());BH(n,o,()=>o(n.currentUser)),zH(n,l=>o(l))}}const s=gF("auth");return s&&CH(n,`http://${s}`),n}function QU(){return document.getElementsByTagName("head")?.[0]??document}mH({loadJS(t){return new Promise((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=s=>{const i=Zs("internal-error");i.customData=s,n(i)},r.type="text/javascript",r.charset="UTF-8",QU().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="});YU("Browser");function e4(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 d=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,d),d}function s(o,l){e.set(o,{value:l,at:Date.now()})}function i(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:s,invalidate:i}}const t4=1600,n4=.85,r4=4e5;function s4(t){const e=(t.type||"").toLowerCase();return!(!e.startsWith("image/")||e==="image/svg+xml"||e==="image/gif")}function i4(t,e){const n=t.trim()||"upload",r=n.replace(/\.[^.]+$/,"")||"upload";return e==="image/webp"?`${r}.webp`:e==="image/jpeg"?`${r}.jpg`:e==="image/png"?`${r}.png`:n}async function o4(t){if(typeof createImageBitmap!="function")throw new Error("createImageBitmap is not available");try{return await createImageBitmap(t,{imageOrientation:"from-image"})}catch{return await createImageBitmap(t)}}async function a4(t,e){const n=async i=>{if(typeof t.convertToBlob=="function")try{const o=await t.convertToBlob({type:i,quality:e});return o?.size?o:null}catch{return null}return await new Promise(o=>{t.toBlob(l=>o(l?.size?l:null),i,e)})},r=await n("image/webp");if(r)return{blob:r,mime:"image/webp"};const s=await n("image/jpeg");if(s)return{blob:s,mime:"image/jpeg"};throw new Error("Could not encode optimized image")}function l4(t,e){const{width:n,height:r}=t,s=Math.max(n,r),i=s>e?e/s:1,o=Math.max(1,Math.round(n*i)),l=Math.max(1,Math.round(r*i));if(typeof OffscreenCanvas<"u"){const h=new OffscreenCanvas(o,l),m=h.getContext("2d");if(!m)throw new Error("Could not create canvas context");return m.drawImage(t,0,0,o,l),{canvas:h,width:o,height:l}}const u=document.createElement("canvas");u.width=o,u.height=l;const d=u.getContext("2d");if(!d)throw new Error("Could not create canvas context");return d.drawImage(t,0,0,o,l),{canvas:u,width:o,height:l}}async function c4(t,e){if(!s4(t))return t;const n=t4,r=n4,s=r4;let i;try{i=await o4(t)}catch{return t}try{const o=i.width<=n&&i.height<=n;if(o&&t.size<=s)return t;const{canvas:l}=l4(i,n),{blob:u,mime:d}=await a4(l,r);if(u.size>=t.size&&o)return t;const h=typeof File<"u"&&t instanceof File&&t.name?t.name:"upload",m=i4(h,d);return typeof File<"u"?new File([u],m,{type:d,lastModified:Date.now()}):u}catch{return t}finally{i.close()}}const u4="x-vertebr-env";async function Wj(t,e){const n=await t.arrayBuffer(),r=new Uint8Array(n);let s="";const i=32768;for(let l=0;l<r.length;l+=i)s+=String.fromCharCode(...r.subarray(l,l+i));return{name:e||typeof File<"u"&&t instanceof File&&t.name||"upload",type:t.type||"application/octet-stream",data:btoa(s)}}async function Mp(t,e){const n=await c4(t),r=e||typeof File<"u"&&n instanceof File&&n.name||typeof File<"u"&&t instanceof File&&t.name||void 0;return Wj(n,r)}function qj(t,e){if(e&&(e.q&&t.set("q",e.q),e.sort&&t.set("sort",e.sort),(e.order==="asc"||e.order==="desc")&&t.set("order",e.order),e.limit!=null&&Number.isFinite(e.limit)&&t.set("limit",String(e.limit)),e.offset!=null&&Number.isFinite(e.offset)&&t.set("offset",String(e.offset)),e.cursor&&t.set("cursor",e.cursor),e.filters))for(const[n,r]of Object.entries(e.filters))r!=null&&r!==""&&t.set(`filter.${n}`,r)}function d4(t,e){const n=new URLSearchParams;qj(n,e);const r=n.toString();return r?`resource:${t}?${r}`:`resource:${t}`}function Qw(t,e){const n=typeof t=="string"?{apiBase:t,getEnvironment:(()=>"")}:t,r=n.apiBase.replace(/\/$/,""),s=e4(n.cacheTtlMs??6e4);async function i(o,l,u){const d=n.getEnvironment().trim(),m=(await n.getAccessToken?.())?.trim(),y=await fetch(`${r}${o}`,{...l,headers:{Accept:"application/json","Content-Type":"application/json",...d?{[u4]:d}:{},...u?.auth!==!1&&m?{Authorization:`Bearer ${m}`}:{},...l?.headers??{}}});if(!y.ok){const b=await y.text();let v=b||`Request failed (${y.status})`;try{const x=JSON.parse(b);typeof x.error=="string"&&x.error.trim()?v=x.error:x.error&&typeof x.error=="object"&&typeof x.error.message=="string"&&x.error.message.trim()?v=x.error.message:typeof x.message=="string"&&x.message.trim()&&(v=x.message)}catch{}throw new Error(v)}return await y.json()}return{getBootstrap:o=>s.get("bootstrap",()=>i("/bootstrap",void 0,{auth:!1}),o),getCatalog:o=>s.get("catalog",()=>i(""),o),getMetrics:o=>{const l=o?.range?.trim()||"14d";return s.get(`metrics:${l}`,()=>i(`/metrics?range=${encodeURIComponent(l)}`),o)},getPublicControls:o=>s.get("controls",async()=>(await i("/public/controls",void 0,{auth:!1})).configs??{},o),getPublicResource:(o,l)=>s.get(`public-resource:${o}`,()=>i(`/public/resources/${encodeURIComponent(o)}`,void 0,{auth:!1}),l),listResource:(o,l)=>{const u=new URLSearchParams;qj(u,l);const d=u.toString(),h=`/resources/${encodeURIComponent(o)}${d?`?${d}`:""}`;return s.get(d4(o,l),()=>i(h),l)},createResource:async(o,l)=>{const u=await i(`/resources/${encodeURIComponent(o)}`,{method:"POST",body:JSON.stringify(l)});return s.invalidate(`resource:${o}`),s.invalidate(`public-resource:${o}`),u},updateResource:async(o,l,u)=>{const d=await i(`/resources/${encodeURIComponent(o)}/${encodeURIComponent(l)}`,{method:"PUT",body:JSON.stringify(u)});return s.invalidate(`resource:${o}`),s.invalidate(`public-resource:${o}`),d},deleteResource:async(o,l)=>{const u=await i(`/resources/${encodeURIComponent(o)}/${encodeURIComponent(l)}`,{method:"DELETE"});return s.invalidate(`resource:${o}`),s.invalidate(`public-resource:${o}`),u},runResourceAction:async(o,l,u,d)=>{const h=await i(`/resources/${encodeURIComponent(o)}/${encodeURIComponent(l)}/actions/${encodeURIComponent(u)}`,{method:"POST",body:JSON.stringify(d??{})});return s.invalidate(`resource:${o}`),s.invalidate(`public-resource:${o}`),h},runCollectionAction:async(o,l,u)=>{const d=await i(`/resources/${encodeURIComponent(o)}/collection-actions/${encodeURIComponent(l)}`,{method:"POST",body:JSON.stringify(u??{})});return s.invalidate(`resource:${o}`),s.invalidate(`public-resource:${o}`),d},runBulkAction:async(o,l,u)=>{const d=await i(`/resources/${encodeURIComponent(o)}/bulk-actions/${encodeURIComponent(l)}`,{method:"POST",body:JSON.stringify(u)});return s.invalidate(`resource:${o}`),s.invalidate(`public-resource:${o}`),d},previewResourceMail:async(o,l,u,d)=>i(`/resources/${encodeURIComponent(o)}/${encodeURIComponent(l)}/mail/${encodeURIComponent(u)}/preview`,{method:"POST",body:JSON.stringify(d??{})}),getEmails:o=>s.get("emails",()=>i("/emails"),o),previewEmails:async o=>i("/emails/preview",{method:"POST",body:JSON.stringify(o)}),sendEmails:async o=>{const l=await i("/emails/send",{method:"POST",body:JSON.stringify(o)});return s.invalidate("emails"),s.invalidate(`resource:${o.resourceId}`),l},scheduleEmails:async o=>{const l=await i("/emails/schedule",{method:"POST",body:JSON.stringify(o)});return s.invalidate("emails"),l},cancelEmailCampaign:async o=>{const l=await i(`/emails/campaigns/${encodeURIComponent(o)}`,{method:"DELETE"});return s.invalidate("emails"),l},saveEmailLibraryTemplate:async o=>{const l=await i("/emails/library",{method:"POST",body:JSON.stringify(o)});return s.invalidate("emails"),l},deleteEmailLibraryTemplate:async o=>{const l=await i(`/emails/library/${encodeURIComponent(o)}`,{method:"DELETE"});return s.invalidate("emails"),l},uploadResourceFile:async(o,l,u,d)=>{const h=await Mp(u,d);return i(`/resources/${encodeURIComponent(o)}/uploads/${encodeURIComponent(l)}`,{method:"POST",body:JSON.stringify(h)})},uploadResourceFiles:async(o,l,u)=>{const d={files:await Promise.all(u.map(h=>Mp(h)))};return i(`/resources/${encodeURIComponent(o)}/uploads/${encodeURIComponent(l)}/bulk`,{method:"POST",body:JSON.stringify(d)})},getGallery:o=>s.get("gallery",()=>i("/gallery"),o),uploadGalleryFile:async(o,l)=>{const u=await Mp(o,l),d=await i("/gallery/upload",{method:"POST",body:JSON.stringify(u)});return s.invalidate("gallery"),d},uploadGalleryFiles:async o=>{const l={files:await Promise.all(o.map(d=>Mp(d)))},u=await i("/gallery/upload/bulk",{method:"POST",body:JSON.stringify(l)});return s.invalidate("gallery"),u},deleteGalleryItem:async o=>{const l=await i(`/gallery/${encodeURIComponent(o)}`,{method:"DELETE"});return s.invalidate("gallery"),l},getFonts:o=>s.get("fonts",()=>i("/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(",")}`:"",d=l?.length?`public:fonts:${[...l].sort().join(",")}`:"public:fonts";return(await s.get(d,()=>i(`/public/fonts${u}`),o)).items},uploadFontFile:async(o,l,u)=>{const d={...await Wj(o,u),...l?.family?{family:l.family}:{},...l?.label?{label:l.label}:{},...l?.weight!=null?{weight:l.weight}:{}},h=await i("/fonts/upload",{method:"POST",body:JSON.stringify(d)});return s.invalidate("fonts"),s.invalidate("public:fonts"),h},importGoogleFont:async o=>{const l=await i("/fonts/import-google",{method:"POST",body:JSON.stringify(o)});return s.invalidate("fonts"),s.invalidate("public:fonts"),l},deleteFontItem:async o=>{const l=await i(`/fonts/${encodeURIComponent(o)}`,{method:"DELETE"});return s.invalidate("fonts"),s.invalidate("public:fonts"),l},getConfig:(o,l)=>s.get(`config:${o}`,()=>i(`/configs/${encodeURIComponent(o)}`),l),setConfig:async(o,l)=>{const u=await i(`/configs/${encodeURIComponent(o)}`,{method:"PUT",body:JSON.stringify(l)}),d={id:u.id,label:u.label,schema:u.schema??{},environment:u.environment,value:u.value,...u.etag?{etag:u.etag}:{},...u.draftRevisionId?{draftRevisionId:u.draftRevisionId}:{},...u.revisionsEnabled!=null?{revisionsEnabled:u.revisionsEnabled}:{}};return s.set(`config:${o}`,d),s.invalidate("controls"),s.invalidate("public:controls"),s.invalidate("public:fonts"),s.invalidate(`revisions:${o}`),d},listAudit:o=>{const l=new URLSearchParams;o?.limit!=null&&Number.isFinite(o.limit)&&l.set("limit",String(o.limit)),o?.cursor&&l.set("cursor",o.cursor),o?.targetType&&l.set("targetType",o.targetType),o?.targetId&&l.set("targetId",o.targetId);const u=l.toString();return s.get(`audit${u?`?${u}`:""}`,()=>i(`/audit${u?`?${u}`:""}`),o)},listRevisions:(o,l)=>s.get(`revisions:${o}`,()=>i(`/configs/${encodeURIComponent(o)}/revisions`),l),getRevision:(o,l,u)=>s.get(`revision:${o}:${l}`,()=>i(`/configs/${encodeURIComponent(o)}/revisions/${encodeURIComponent(l)}`),u),saveRevision:async(o,l)=>{const u=await i(`/configs/${encodeURIComponent(o)}/revisions`,{method:"POST",body:JSON.stringify(l)});return s.invalidate(`revisions:${o}`),s.invalidate(`config:${o}`),u},publishRevision:async(o,l)=>{const u=await i(`/configs/${encodeURIComponent(o)}/revisions/${encodeURIComponent(l)}/publish`,{method:"POST",body:JSON.stringify({})});return s.invalidate(`revisions:${o}`),s.invalidate(`config:${o}`),s.invalidate("controls"),u},restoreRevision:async(o,l)=>{const u=await i(`/configs/${encodeURIComponent(o)}/revisions/${encodeURIComponent(l)}/restore`,{method:"POST",body:JSON.stringify({})});return s.invalidate(`revisions:${o}`),s.invalidate(`config:${o}`),u},getHealth:o=>s.get("health",()=>i("/health"),o),listJobs:o=>s.get("jobs",()=>i("/jobs"),o),getJob:(o,l)=>s.get(`job:${o}`,()=>i(`/jobs/${encodeURIComponent(o)}`),l),getSyncPlan:o=>{const l=new URLSearchParams;l.set("from",o.from);for(const u of o.to)l.append("to",u);return o.targets?.length&&l.set("targets",o.targets.join(",")),i(`/environments/sync/plan?${l.toString()}`)},runSync:async o=>{const l=await i("/environments/sync/run",{method:"POST",body:JSON.stringify(o)});return s.invalidate(),l},invalidateCache:o=>s.invalidate(o)}}function qS(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Vl=qS();function Gj(t){Vl=t}var Zd={exec:()=>null};function At(t,e=""){let n=typeof t=="string"?t:t.source;const r={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(Sr.caret,"$1"),n=n.replace(s,o),r},getRegex:()=>new RegExp(n,e)};return r}var Sr={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")},f4=/^(?:[ \t]*(?:\n|$))+/,h4=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,p4=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Xf=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,m4=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,GS=/(?:[*+-]|\d{1,9}[.)])/,Yj=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Kj=At(Yj).replace(/bull/g,GS).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(),g4=At(Yj).replace(/bull/g,GS).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(),YS=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,y4=/^[^\n]+/,KS=/(?!\s*\])(?:\\.|[^\[\]\\])+/,b4=At(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",KS).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),v4=At(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,GS).getRegex(),ly="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",ZS=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,w4=At("^ {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",ZS).replace("tag",ly).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Zj=At(YS).replace("hr",Xf).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",ly).getRegex(),x4=At(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Zj).getRegex(),XS={blockquote:x4,code:h4,def:b4,fences:p4,heading:m4,hr:Xf,html:w4,lheading:Kj,list:v4,newline:f4,paragraph:Zj,table:Zd,text:y4},PM=At("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Xf).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",ly).getRegex(),S4={...XS,lheading:g4,table:PM,paragraph:At(YS).replace("hr",Xf).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",PM).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",ly).getRegex()},k4={...XS,html:At(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ZS).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:Zd,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:At(YS).replace("hr",Xf).replace("heading",` *#{1,6} *[^
10
+ ]`).replace("lheading",Kj).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},C4=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,E4=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Xj=/^( {2,}|\\)\n(?!\s*$)/,T4=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,cy=/[\p{P}\p{S}]/u,JS=/[\s\p{P}\p{S}]/u,Jj=/[^\s\p{P}\p{S}]/u,N4=At(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,JS).getRegex(),Qj=/(?!~)[\p{P}\p{S}]/u,M4=/(?!~)[\s\p{P}\p{S}]/u,_4=/(?:[^\s\p{P}\p{S}]|~)/u,A4=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,eD=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,R4=At(eD,"u").replace(/punct/g,cy).getRegex(),O4=At(eD,"u").replace(/punct/g,Qj).getRegex(),tD="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",j4=At(tD,"gu").replace(/notPunctSpace/g,Jj).replace(/punctSpace/g,JS).replace(/punct/g,cy).getRegex(),D4=At(tD,"gu").replace(/notPunctSpace/g,_4).replace(/punctSpace/g,M4).replace(/punct/g,Qj).getRegex(),I4=At("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Jj).replace(/punctSpace/g,JS).replace(/punct/g,cy).getRegex(),L4=At(/\\(punct)/,"gu").replace(/punct/g,cy).getRegex(),P4=At(/^<(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(),$4=At(ZS).replace("(?:-->|$)","-->").getRegex(),z4=At("^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",$4).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Wm=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,B4=At(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Wm).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),nD=At(/^!?\[(label)\]\[(ref)\]/).replace("label",Wm).replace("ref",KS).getRegex(),rD=At(/^!?\[(ref)\](?:\[\])?/).replace("ref",KS).getRegex(),F4=At("reflink|nolink(?!\\()","g").replace("reflink",nD).replace("nolink",rD).getRegex(),QS={_backpedal:Zd,anyPunctuation:L4,autolink:P4,blockSkip:A4,br:Xj,code:E4,del:Zd,emStrongLDelim:R4,emStrongRDelimAst:j4,emStrongRDelimUnd:I4,escape:C4,link:B4,nolink:rD,punctuation:N4,reflink:nD,reflinkSearch:F4,tag:z4,text:T4,url:Zd},V4={...QS,link:At(/^!?\[(label)\]\((.*?)\)/).replace("label",Wm).getRegex(),reflink:At(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Wm).getRegex()},ex={...QS,emStrongRDelimAst:D4,emStrongLDelim:O4,url:At(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},H4={...ex,br:At(Xj).replace("{2,}","*").getRegex(),text:At(ex.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},_p={normal:XS,gfm:S4,pedantic:k4},xd={normal:QS,gfm:ex,breaks:H4,pedantic:V4},U4={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},$M=t=>U4[t];function oi(t,e){if(e){if(Sr.escapeTest.test(t))return t.replace(Sr.escapeReplace,$M)}else if(Sr.escapeTestNoEncode.test(t))return t.replace(Sr.escapeReplaceNoEncode,$M);return t}function zM(t){try{t=encodeURI(t).replace(Sr.percentDecode,"%")}catch{return null}return t}function BM(t,e){const n=t.replace(Sr.findPipe,(i,o,l)=>{let u=!1,d=o;for(;--d>=0&&l[d]==="\\";)u=!u;return u?"|":" |"}),r=n.split(Sr.splitPipe);let s=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(;s<r.length;s++)r[s]=r[s].trim().replace(Sr.slashPipe,"|");return r}function Sd(t,e,n){const r=t.length;if(r===0)return"";let s=0;for(;s<r&&t.charAt(r-s-1)===e;)s++;return t.slice(0,r-s)}function W4(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 FM(t,e,n,r,s){const i=e.href,o=e.title||null,l=t[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;const u={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:o,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,u}function q4(t,e,n){const r=t.match(n.other.indentCodeCompensation);if(r===null)return e;const s=r[1];return e.split(`
11
+ `).map(i=>{const o=i.match(n.other.beginningSpace);if(o===null)return i;const[l]=o;return l.length>=s.length?i.slice(s.length):i}).join(`
12
+ `)}var qm=class{options;rules;lexer;constructor(t){this.options=t||Vl}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:Sd(n,`
13
+ `)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const n=e[0],r=q4(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=Sd(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:Sd(e[0],`
14
+ `)}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let n=Sd(e[0],`
15
+ `).split(`
16
+ `),r="",s="";const i=[];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 d=l.join(`
17
+ `),h=d.replace(this.rules.other.blockquoteSetextReplace,`
18
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
19
+ ${d}`:d,s=s?`${s}
20
+ ${h}`:h;const m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,i,!0),this.lexer.state.top=m,n.length===0)break;const y=i.at(-1);if(y?.type==="code")break;if(y?.type==="blockquote"){const b=y,v=b.raw+`
21
+ `+n.join(`
22
+ `),x=this.blockquote(v);i[i.length-1]=x,r=r.substring(0,r.length-b.raw.length)+x.raw,s=s.substring(0,s.length-b.text.length)+x.text;break}else if(y?.type==="list"){const b=y,v=b.raw+`
23
+ `+n.join(`
24
+ `),x=this.list(v);i[i.length-1]=x,r=r.substring(0,r.length-y.raw.length)+x.raw,s=s.substring(0,s.length-b.raw.length)+x.raw,n=v.substring(i.at(-1).raw.length).split(`
25
+ `);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim();const r=n.length>1,s={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 i=this.rules.other.listItemRegex(n);let o=!1;for(;t;){let u=!1,d="",h="";if(!(e=i.exec(t))||this.rules.block.hr.test(t))break;d=e[0],t=t.substring(d.length);let m=e[2].split(`
26
+ `,1)[0].replace(this.rules.other.listReplaceTabs,E=>" ".repeat(3*E.length)),y=t.split(`
27
+ `,1)[0],b=!m.trim(),v=0;if(this.options.pedantic?(v=2,h=m.trimStart()):b?v=e[1].length+1:(v=e[2].search(this.rules.other.nonSpaceChar),v=v>4?1:v,h=m.slice(v),v+=e[1].length),b&&this.rules.other.blankLine.test(y)&&(d+=y+`
28
+ `,t=t.substring(y.length+1),u=!0),!u){const E=this.rules.other.nextBulletRegex(v),M=this.rules.other.hrRegex(v),_=this.rules.other.fencesBeginRegex(v),N=this.rules.other.headingBeginRegex(v),T=this.rules.other.htmlBeginRegex(v);for(;t;){const A=t.split(`
29
+ `,1)[0];let j;if(y=A,this.options.pedantic?(y=y.replace(this.rules.other.listReplaceNesting," "),j=y):j=y.replace(this.rules.other.tabCharGlobal," "),_.test(y)||N.test(y)||T.test(y)||E.test(y)||M.test(y))break;if(j.search(this.rules.other.nonSpaceChar)>=v||!y.trim())h+=`
30
+ `+j.slice(v);else{if(b||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_.test(m)||N.test(m)||M.test(m))break;h+=`
31
+ `+y}!b&&!y.trim()&&(b=!0),d+=A+`
32
+ `,t=t.substring(A.length+1),m=j.slice(v)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(o=!0));let x=null,k;this.options.gfm&&(x=this.rules.other.listIsTask.exec(h),x&&(k=x[0]!=="[ ] ",h=h.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:d,task:!!x,checked:k,loose:!1,text:h,tokens:[]}),s.raw+=d}const l=s.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let u=0;u<s.items.length;u++)if(this.lexer.state.top=!1,s.items[u].tokens=this.lexer.blockTokens(s.items[u].text,[]),!s.loose){const d=s.items[u].tokens.filter(m=>m.type==="space"),h=d.length>0&&d.some(m=>this.rules.other.anyLine.test(m.raw));s.loose=h}if(s.loose)for(let u=0;u<s.items.length;u++)s.items[u].loose=!0;return s}}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"):"",s=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:s}}}table(t){const e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const n=BM(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
33
+ `):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(const o of r)this.rules.other.tableAlignRight.test(o)?i.align.push("right"):this.rules.other.tableAlignCenter.test(o)?i.align.push("center"):this.rules.other.tableAlignLeft.test(o)?i.align.push("left"):i.align.push(null);for(let o=0;o<n.length;o++)i.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:i.align[o]});for(const o of s)i.rows.push(BM(o,i.header.length).map((l,u)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[u]})));return i}}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 i=Sd(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{const i=W4(e[2],"()");if(i===-2)return;if(i>-1){const l=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let r=e[2],s="";if(this.options.pedantic){const i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=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)),FM(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.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," "),s=e[r.toLowerCase()];if(!s){const i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return FM(n,s,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 i=[...r[0]].length-1;let o,l,u=i,d=0;const h=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*t.length+i);(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])&&i%3&&!((i+l)%3)){d+=l;continue}if(u-=l,u>0)continue;l=Math.min(l,l+u+d);const m=[...r[0]][0].length,y=t.slice(0,i+r.index+m+l);if(Math.min(i,l)%2){const v=y.slice(1,-1);return{type:"em",raw:y,text:v,tokens:this.lexer.inlineTokens(v)}}const b=y.slice(2,-2);return{type:"strong",raw:y,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),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&s&&(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 s;do s=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(s!==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}}}},no=class tx{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Vl,this.options.tokenizer=this.options.tokenizer||new qm,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:Sr,block:_p.normal,inline:xd.normal};this.options.pedantic?(n.block=_p.pedantic,n.inline=xd.pedantic):this.options.gfm&&(n.block=_p.gfm,this.options.breaks?n.inline=xd.breaks:n.inline=xd.gfm),this.tokenizer.rules=n}static get rules(){return{block:_p,inline:xd}}static lex(e,n){return new tx(n).lex(e)}static lexInline(e,n){return new tx(n).inlineTokens(e)}lex(e){e=e.replace(Sr.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(Sr.tabCharGlobal," ").replace(Sr.spaceLine,""));e;){let s;if(this.options.extensions?.block?.some(o=>(s=o.call({lexer:this},e,n))?(e=e.substring(s.raw.length),n.push(s),!0):!1))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);const o=n.at(-1);s.raw.length===1&&o!==void 0?o.raw+=`
36
+ `:n.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);const o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=`
37
+ `+s.raw,o.text+=`
38
+ `+s.text,this.inlineQueue.at(-1).src=o.text):n.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);const o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=`
39
+ `+s.raw,o.text+=`
40
+ `+s.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title});continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),n.push(s);continue}let i=e;if(this.options.extensions?.startBlock){let o=1/0;const l=e.slice(1);let u;this.options.extensions.startBlock.forEach(d=>{u=d.call({lexer:this},l),typeof u=="number"&&u>=0&&(o=Math.min(o,u))}),o<1/0&&o>=0&&(i=e.substring(0,o+1))}if(this.state.top&&(s=this.tokenizer.paragraph(i))){const o=n.at(-1);r&&o?.type==="paragraph"?(o.raw+=`
41
+ `+s.raw,o.text+=`
42
+ `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(s),r=i.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);const o=n.at(-1);o?.type==="text"?(o.raw+=`
43
+ `+s.raw,o.text+=`
44
+ `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(s);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,s=null;if(this.tokens.links){const l=Object.keys(this.tokens.links);if(l.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)l.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,o="";for(;e;){i||(o=""),i=!1;let l;if(this.options.extensions?.inline?.some(d=>(l=d.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 d=n.at(-1);l.type==="text"&&d?.type==="text"?(d.raw+=l.raw,d.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 d=1/0;const h=e.slice(1);let m;this.options.extensions.startInline.forEach(y=>{m=y.call({lexer:this},h),typeof m=="number"&&m>=0&&(d=Math.min(d,m))}),d<1/0&&d>=0&&(u=e.substring(0,d+1))}if(l=this.tokenizer.inlineText(u)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(o=l.raw.slice(-1)),i=!0;const d=n.at(-1);d?.type==="text"?(d.raw+=l.raw,d.text+=l.text):n.push(l);continue}if(e){const d="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return n}},bf=class{options;parser;constructor(t){this.options=t||Vl}space(t){return""}code({text:t,lang:e,escaped:n}){const r=(e||"").match(Sr.notSpaceStart)?.[0],s=t.replace(Sr.endingNewline,"")+`
45
+ `;return r?'<pre><code class="language-'+oi(r)+'">'+(n?s:oi(s,!0))+`</code></pre>
46
+ `:"<pre><code>"+(n?s:oi(s,!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 s=e?"ol":"ul",i=e&&n!==1?' start="'+n+'"':"";return"<"+s+i+`>
52
+ `+r+"</"+s+`>
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+" "+oi(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 s=0;s<t.header.length;s++)n+=this.tablecell(t.header[s]);e+=this.tablerow({text:n});let r="";for(let s=0;s<t.rows.length;s++){const i=t.rows[s];n="";for(let o=0;o<i.length;o++)n+=this.tablecell(i[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>${oi(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),s=zM(t);if(s===null)return r;t=s;let i='<a href="'+t+'"';return e&&(i+=' title="'+oi(e)+'"'),i+=">"+r+"</a>",i}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));const s=zM(t);if(s===null)return oi(n);t=s;let i=`<img src="${t}" alt="${n}"`;return e&&(i+=` title="${oi(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:oi(t.text)}},ek=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""}},ro=class nx{options;renderer;textRenderer;constructor(e){this.options=e||Vl,this.options.renderer=this.options.renderer||new bf,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ek}static parse(e,n){return new nx(n).parse(e)}static parseInline(e,n){return new nx(n).parseInline(e)}parse(e,n=!0){let r="";for(let s=0;s<e.length;s++){const i=e[s];if(this.options.extensions?.renderers?.[i.type]){const l=i,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=i;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(;s+1<e.length&&e[s+1].type==="text";)l=e[++s],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 s=0;s<e.length;s++){const i=e[s];if(this.options.extensions?.renderers?.[i.type]){const l=this.options.extensions.renderers[i.type].call({parser:this},i);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){r+=l||"";continue}}const o=i;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}},xm=class{options;block;constructor(t){this.options=t||Vl}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?no.lex:no.lexInline}provideParser(){return this.block?ro.parse:ro.parseInline}},sD=class{defaults=qS();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ro;Renderer=bf;TextRenderer=ek;Lexer=no;Tokenizer=qm;Hooks=xm;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 s=r;for(const i of s.header)n=n.concat(this.walkTokens(i.tokens,e));for(const i of s.rows)for(const o of i)n=n.concat(this.walkTokens(o.tokens,e));break}case"list":{const s=r;n=n.concat(this.walkTokens(s.items,e));break}default:{const s=r;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(i=>{const o=s[i].flat(1/0);n=n.concat(this.walkTokens(o,e))}):s.tokens&&(n=n.concat(this.walkTokens(s.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(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const i=e.renderers[s.name];i?e.renderers[s.name]=function(...o){let l=s.renderer.apply(this,o);return l===!1&&(l=i.apply(this,o)),l}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const i=e[s.level];i?i.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),r.extensions=e),n.renderer){const s=this.defaults.renderer||new bf(this.defaults);for(const i in n.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;const o=i,l=n.renderer[o],u=s[o];s[o]=(...d)=>{let h=l.apply(s,d);return h===!1&&(h=u.apply(s,d)),h||""}}r.renderer=s}if(n.tokenizer){const s=this.defaults.tokenizer||new qm(this.defaults);for(const i in n.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const o=i,l=n.tokenizer[o],u=s[o];s[o]=(...d)=>{let h=l.apply(s,d);return h===!1&&(h=u.apply(s,d)),h}}r.tokenizer=s}if(n.hooks){const s=this.defaults.hooks||new xm;for(const i in n.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;const o=i,l=n.hooks[o],u=s[o];xm.passThroughHooks.has(i)?s[o]=d=>{if(this.defaults.async)return Promise.resolve(l.call(s,d)).then(m=>u.call(s,m));const h=l.call(s,d);return u.call(s,h)}:s[o]=(...d)=>{let h=l.apply(s,d);return h===!1&&(h=u.apply(s,d)),h}}r.hooks=s}if(n.walkTokens){const s=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(o){let l=[];return l.push(i.call(this,o)),s&&(l=l.concat(s.call(this,o))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return no.lex(t,e??this.defaults)}parser(t,e){return ro.parse(t,e??this.defaults)}parseMarkdown(t){return(n,r)=>{const s={...r},i={...this.defaults,...s},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.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"));i.hooks&&(i.hooks.options=i,i.hooks.block=t);const l=i.hooks?i.hooks.provideLexer():t?no.lex:no.lexInline,u=i.hooks?i.hooks.provideParser():t?ro.parse:ro.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(n):n).then(d=>l(d,i)).then(d=>i.hooks?i.hooks.processAllTokens(d):d).then(d=>i.walkTokens?Promise.all(this.walkTokens(d,i.walkTokens)).then(()=>d):d).then(d=>u(d,i)).then(d=>i.hooks?i.hooks.postprocess(d):d).catch(o);try{i.hooks&&(n=i.hooks.preprocess(n));let d=l(n,i);i.hooks&&(d=i.hooks.processAllTokens(d)),i.walkTokens&&this.walkTokens(d,i.walkTokens);let h=u(d,i);return i.hooks&&(h=i.hooks.postprocess(h)),h}catch(d){return o(d)}}}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>"+oi(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},Ml=new sD;function zt(t,e){return Ml.parse(t,e)}zt.options=zt.setOptions=function(t){return Ml.setOptions(t),zt.defaults=Ml.defaults,Gj(zt.defaults),zt};zt.getDefaults=qS;zt.defaults=Vl;zt.use=function(...t){return Ml.use(...t),zt.defaults=Ml.defaults,Gj(zt.defaults),zt};zt.walkTokens=function(t,e){return Ml.walkTokens(t,e)};zt.parseInline=Ml.parseInline;zt.Parser=ro;zt.parser=ro.parse;zt.Renderer=bf;zt.TextRenderer=ek;zt.Lexer=no;zt.lexer=no.lex;zt.Tokenizer=qm;zt.Hooks=xm;zt.parse=zt;zt.options;zt.setOptions;zt.use;zt.walkTokens;zt.parseInline;ro.parse;no.lex;function kd(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function VM(t){const e=t.trim();return e?e.startsWith("//")?`https:${e}`:/^(https?:|mailto:|\/|#)/i.test(e)?e:null:null}class G4 extends bf{html(){return""}link({href:e,title:n,tokens:r}){const s=this.parser.parseInline(r),i=VM(e);if(!i)return s;const o=n?` title="${kd(n)}"`:"";return`<a href="${kd(i)}"${o} rel="noopener noreferrer">${s}</a>`}image({href:e,title:n,text:r}){const s=VM(e);if(!s)return"";const i=n?` title="${kd(n)}"`:"";return`<img src="${kd(s)}" alt="${kd(r)}"${i} loading="lazy" />`}}new sD({gfm:!0,breaks:!1,renderer:new G4});const Y4="vertebrPreview",K4="vertebrControl",tk="vertebr",Z4="vertebr:preview-draft",X4="vertebr:preview-ready",J4="vertebr:preview-navigate";function nk(t,e={}){const n=e.origin??(typeof window<"u"?window.location.origin:""),r=t.trim()||"/",s=new URL((r.startsWith("http"),r),n||"http://localhost");return s.searchParams.set(Y4,"1"),e.controlId?.trim()&&s.searchParams.set(K4,e.controlId.trim()),n?s.toString():`${s.pathname}${s.search}${s.hash}`}function Q4(t,e){let n=!1;const r=t.replace(/\{([a-zA-Z0-9_]+)\}/g,(s,i)=>{const o=e[i],l=typeof o=="string"||typeof o=="number"?String(o).trim():"";return l?l.replace(/^\/+|\/+$/g,""):(n=!0,"")});return n?null:r.trim()||null}function e5(t,e,n){if(e?.length&&n)for(const s of e){if(s.when&&!Object.entries(s.when).every(([l,u])=>String(n[l]??"")===u))continue;const i=Q4(s.path,n);if(i)return i.startsWith("/")?i:`/${i}`}const r=t?.trim();return r?r.startsWith("/")?r:`/${r}`:void 0}function iD(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function t5(t){return iD(t)?t.source===tk&&t.type===X4:!1}function n5(t){return iD(t)?t.source===tk&&t.type===J4&&typeof t.path=="string"&&t.path.trim().length>0:!1}function vf(t,e,n,r="*"){if(!t||!e)return;const s={source:tk,type:Z4,controlId:e,value:n};t.postMessage(s,r)}function rk(t,e={}){if(typeof window>"u")return()=>{};const n=e.allowedOrigins?.filter(Boolean)??[],r=s=>{n.length>0&&!n.includes(s.origin)||t5(s.data)&&t(s.source)};return window.addEventListener("message",r),()=>window.removeEventListener("message",r)}function r5(t,e={}){if(typeof window>"u")return()=>{};const n=e.allowedOrigins?.filter(Boolean)??[],r=s=>{if(n.length>0){if(!n.includes(s.origin))return}else if(s.origin!==window.location.origin)return;n5(s.data)&&t(s.data.path.trim(),s.source)};return window.addEventListener("message",r),()=>window.removeEventListener("message",r)}const HM=[{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 s5(t){switch(t){case"woff2":return"woff2";case"woff":return"woff";default:return"truetype"}}function oD(t){return(t.files??[]).map(e=>`@font-face{font-family:"${t.family.replace(/"/g,'\\"')}";src:url("${e.url}") format("${s5(e.format)}");font-weight:${e.weight};font-style:${e.style};font-display:swap;}`).join("")}function i5(t){switch(t){case"woff2":return"woff2";case"woff":return"woff";default:return"ttf"}}function o5(t,e,n){const r=t.replace(/\/$/,""),s=n.style==="italic"?"-italic":"",i=i5(n.format);return`${r}/public/fonts/${encodeURIComponent(e)}/${n.weight}${s}.${i}`}function a5(t,e){return t.map(n=>({...n,files:(n.files??[]).map(r=>({...r,url:o5(e,n.id,r)}))}))}const l5="vertebr:theme";function c5(t){try{const e=localStorage.getItem(t);if(e==="light"||e==="dark")return e}catch{}return null}function u5(t,e){try{localStorage.setItem(t,e)}catch{}}function d5(t){document.documentElement.setAttribute("data-vb-theme",t)}function f5(t=l5){const[e,n]=C.useState(()=>c5(t)??"dark");C.useEffect(()=>{d5(e),u5(t,e)},[e,t]);const r=C.useCallback(i=>{n(i)},[]),s=C.useCallback(()=>{n(i=>i==="dark"?"light":"dark")},[]);return{theme:e,setTheme:r,toggleTheme:s}}function wf(t,e){const n=t?.capabilities;return!n?.length||n.includes("*")?!0:n.includes(e)}const aD=[{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"}],h5="14d",p5=new Set(aD.map(t=>t.id));function m5(t){return t&&p5.has(t)?t:h5}function nn(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 g5(t){return p.jsx("svg",{...nn(t),children:p.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 y5(t){return p.jsxs("svg",{...nn(t),children:[p.jsx("path",{d:"M3 6.5 10 2.5l7 4v9H3v-9z"}),p.jsx("path",{d:"M7 11.5h6M7 14h4"})]})}function b5(t){return p.jsxs("svg",{...nn(t),children:[p.jsx("path",{d:"M3.5 7h13v9.5H3.5z"}),p.jsx("path",{d:"M3.5 10.5h13"}),p.jsx("path",{d:"M7 7V5.5h6V7"}),p.jsx("path",{d:"M7 13h2M11 13h2"})]})}function v5(t){return p.jsxs("svg",{...nn(t),children:[p.jsx("circle",{cx:"7.5",cy:"7",r:"2.25"}),p.jsx("path",{d:"M3.5 15.5c.4-2.4 2-3.75 4-3.75s3.6 1.35 4 3.75"}),p.jsx("circle",{cx:"13.5",cy:"7.25",r:"1.75"}),p.jsx("path",{d:"M12.2 11.9c1.35.2 2.55 1.1 2.9 3.1"})]})}function w5(t){return p.jsxs("svg",{...nn(t),children:[p.jsx("rect",{x:"2.5",y:"5",width:"15",height:"10.5",rx:"1.5"}),p.jsx("path",{d:"M2.5 8.5h15"}),p.jsx("path",{d:"M5.5 12.5h4"})]})}function x5(t){return p.jsxs("svg",{...nn(t),children:[p.jsx("path",{d:"M3.5 10.5V4.5H9.5l7 7-5 5-8-6z"}),p.jsx("circle",{cx:"7",cy:"7",r:"1",fill:"currentColor",stroke:"none"})]})}function S5(t){return p.jsx("svg",{...nn(t),children:p.jsx("path",{d:"M11 2.5 5.5 11h4L9 17.5 14.5 9h-4L11 2.5z"})})}function k5(t){return p.jsxs("svg",{...nn(t),children:[p.jsx("rect",{x:"2.5",y:"4.5",width:"15",height:"11",rx:"1.5"}),p.jsx("path",{d:"m3.5 13 3.5-3.5 2.5 2.5L12.5 9l4 4.5"}),p.jsx("circle",{cx:"7",cy:"7.5",r:"1",fill:"currentColor",stroke:"none"})]})}function C5(t){return p.jsxs("svg",{...nn(t),children:[p.jsx("path",{d:"M5 16.5V5.5h10M7.5 16.5V9h5v7.5"}),p.jsx("path",{d:"M7 5.5h6"})]})}function E5(t){return p.jsxs("svg",{...nn(t),children:[p.jsx("rect",{x:"2.5",y:"4.5",width:"15",height:"11",rx:"1.5"}),p.jsx("path",{d:"m3.5 6.5 6.5 4.5 6.5-4.5"})]})}function T5(t){return p.jsxs("svg",{...nn(t),children:[p.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"}),p.jsx("path",{d:"M11.5 3.5V8H16"})]})}function N5(t){return p.jsxs("svg",{...nn(t),children:[p.jsx("path",{d:"M10 3a7 7 0 1 0 0 14h1.2a1.8 1.8 0 0 0 0-3.6H10a2 2 0 0 1 0-4h3.5"}),p.jsx("circle",{cx:"7.2",cy:"8",r:"0.9",fill:"currentColor",stroke:"none"}),p.jsx("circle",{cx:"8.4",cy:"11.2",r:"0.9",fill:"currentColor",stroke:"none"}),p.jsx("circle",{cx:"12.2",cy:"7.2",r:"0.9",fill:"currentColor",stroke:"none"})]})}function M5(t){return p.jsxs("svg",{...nn(t),children:[p.jsx("path",{d:"M2.5 13.5V6.5h9v7"}),p.jsx("path",{d:"M11.5 9.5h4l2 2.5v1.5h-6"}),p.jsx("circle",{cx:"6",cy:"14.5",r:"1.5"}),p.jsx("circle",{cx:"14.5",cy:"14.5",r:"1.5"})]})}function _5(t){return p.jsxs("svg",{...nn(t),children:[p.jsx("circle",{cx:"10",cy:"10",r:"6.5"}),p.jsx("path",{d:"M10 6.5V10l3 2"})]})}function A5(t){return p.jsx("svg",{...nn(t),children:p.jsx("path",{d:"m10 3.5 1.8 3.7 4.1.6-3 2.9.7 4.1L10 13.2 6.4 14.8l.7-4.1-3-2.9 4.1-.6L10 3.5z"})})}function R5(t){return p.jsxs("svg",{...nn(t),children:[p.jsx("path",{d:"M4.5 11.5v-3l10-3.5v10L4.5 11.5z"}),p.jsx("path",{d:"M4.5 8.5v5.5a2 2 0 0 0 2 0V11"}),p.jsx("path",{d:"M15.5 7.5v5"})]})}function O5(t){return p.jsxs("svg",{...nn(t),children:[p.jsx("rect",{x:"3",y:"3.5",width:"14",height:"13",rx:"1.5"}),p.jsx("path",{d:"M3 8h14M9 8v8.5"})]})}function j5(t){return p.jsxs("svg",{...nn(t),children:[p.jsx("path",{d:"M7 5.5h9.5M7 10h9.5M7 14.5h9.5"}),p.jsx("path",{d:"M4 5.5h.01M4 10h.01M4 14.5h.01"})]})}function D5(t){return p.jsxs("svg",{...nn(t),children:[p.jsx("circle",{cx:"10",cy:"10",r:"2.25"}),p.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 I5(t){return p.jsx("svg",{...nn(t),children:p.jsx("path",{d:"M4 16.5V12M8 16.5V8M12 16.5V10M16 16.5V5"})})}function lD(t){return p.jsxs("svg",{...nn(t),children:[p.jsx("circle",{cx:"9",cy:"9",r:"4.75"}),p.jsx("path",{d:"M13 13l3.5 3.5"})]})}function sk(t){return p.jsxs("svg",{...nn(t),children:[p.jsx("path",{d:"M14.5 7.2A6 6 0 0 0 5.2 8.5"}),p.jsx("path",{d:"M5 5.5v3.2h3.2"}),p.jsx("path",{d:"M5.5 12.8A6 6 0 0 0 14.8 11.5"}),p.jsx("path",{d:"M15 14.5v-3.2h-3.2"})]})}function L5(t){return p.jsxs("svg",{...nn(t),children:[p.jsx("path",{d:"M4 6.5h12"}),p.jsx("path",{d:"M4 10h12"}),p.jsx("path",{d:"M4 13.5h12"})]})}function P5(t){return p.jsxs("svg",{...nn(t),children:[p.jsx("path",{d:"M8 3.5h4v4H8z"}),p.jsx("path",{d:"M3.5 8h4v4h-4z"}),p.jsx("path",{d:"M12.5 8h4v4h-4z"}),p.jsx("path",{d:"M8 12.5h4v4H8z"})]})}const cD={home:g5,products:y5,inventory:b5,users:v5,card:w5,tag:x5,bolt:S5,gallery:k5,fonts:C5,mail:E5,pages:T5,palette:N5,truck:M5,clock:_5,star:A5,megaphone:R5,layout:O5,list:j5,chart:I5,sync:sk,addon:P5,settings:D5};function rx(t){return(t??"").trim().toLowerCase().replace(/[_-]+/g," ")}function $5(t){return`${rx(t.id)} ${rx(t.label)}`.trim()}function z5(t){return t?/\binventory\b|\bstock\b|\bsku\b/.test(t)?"inventory":/\bwaitlist\b|\bsignups?\b|\bcustomers?\b|\bsubscribers?\b/.test(t)?"users":/\bwebhooks?\b|\bhooks?\b/.test(t)?"bolt":/\bdiscounts?\b|\bcoupons?\b|\bpromos?\b|\boffers?\b/.test(t)?"tag":/\bsessions?\b|\bpayments?\b|\bcheckout\b/.test(t)||/\bstripe\b/.test(t)?"card":/\btheme\b|\bbrand(?:ing)?\b|\bappearance\b|\bcolors?\b/.test(t)?"palette":/\bshipping\b|\bfulfill\b|\bdelivery\b|\btruck\b/.test(t)?"truck":/\brefunds?\b|\breturns?\b/.test(t)?"sync":/\bterms\b|\bpolic(?:y|ies)\b|\blegal\b|\bprivacy\b/.test(t)?"pages":/\bproduct page\b|\blayout\b|\bblocks?\b/.test(t)?"layout":/\bpre[- ]?order\b|\bcountdown\b|\bschedule\b|\brelease\b/.test(t)?"clock":/\breviews?\b|\bratings?\b|\btestimonials?\b/.test(t)?"star":/\bannouncements?\b|\bbanners?\b|\bmegaphone\b|\balerts?\b/.test(t)?"megaphone":/\blookbook\b|\bpress\b|\blogos?\b|\bsize guide\b|\bguide\b/.test(t)?"list":/\bback in stock\b|\bfree shipping\b|\bthreshold\b/.test(t)?"tag":/\bemails?\b|\bmail\b|\bcampaigns?\b/.test(t)?"mail":/\bfonts?\b|\btypography\b/.test(t)?"fonts":/\bgallery\b|\bfiles?\b|\bmedia\b|\bimages?\b/.test(t)?"gallery":/\baudit\b|\bmetrics?\b|\banalytics\b/.test(t)?"chart":/\bsync\b|\benvironments?\b/.test(t)?"sync":/\bgeneral\b|\bsettings?\b/.test(t)?"settings":/\bproducts?\b|\bcatalog\b/.test(t)?"products":/\bhome\b|\boverview\b/.test(t)?"home":/\bnav(?:igation)?\b|\bmenu\b/.test(t)?"list":/\babout\b|\bcoming soon\b|\bpages?\b/.test(t)?"pages":null:null}function B5(t){const e=rx(t);return e?e.includes("payment")?"card":e.includes("marketing")||e.includes("growth")||e.includes("customer")?"users":e.includes("product")||e.includes("catalog")?"products":e.includes("online store")||e.includes("pages")||e.includes("storefront")?"pages":e.includes("setting")||e.includes("general")?"settings":e.includes("content")||e.includes("media")?"gallery":e.includes("analytic")||e.includes("home")?"chart":e.includes("add-on")||e.includes("addon")?"addon":null:null}function F5(t){return t==="product"?"products":t==="engagement"?"megaphone":t==="sales"?"tag":null}function V5(t,e){return t==="overview"?"home":t==="audit"?"chart":t==="gallery"?"gallery":t==="fonts"?"fonts":t==="emails"?"mail":t==="sync"?"sync":t==="addons:overview"||t.startsWith("addon:")?"addon":t.startsWith("resource:")?"products":t.startsWith("config:")&&e==="page"?"pages":"settings"}function H5(t){if(t.icon&&t.icon in cD)return t.icon;const e=$5(t),n=z5(e);if(n)return n;if(t.key.startsWith("addon:")||t.section==="addon"){const s=F5(t.category);if(s)return s}const r=B5(t.group);return r||V5(t.key,t.section)}function $s(t){return cD[H5(t)]}function U5(t){const e=[];t.metrics&&e.push({id:"overview",label:t.metrics.label,group:t.metrics.group??"Home",hint:"Overview and metrics",selection:{kind:"overview"}}),t.audit&&e.push({id:"audit",label:t.audit.label,group:t.audit.group??"Analytics",hint:"Audit log",selection:{kind:"audit"}});for(const n of t.resources)e.push({id:`resource:${n.id}`,label:n.label,group:n.group??"Resources",hint:"Resource table",selection:{kind:"resource",id:n.id}});t.gallery&&e.push({id:"gallery",label:t.gallery.label,group:t.gallery.group??"Resources",hint:"Media library",selection:{kind:"gallery"}}),t.fontLibrary&&e.push({id:"fonts",label:t.fontLibrary.label,group:t.fontLibrary.group??"Resources",hint:"Font library",selection:{kind:"fontLibrary"}}),t.emails&&(e.push({id:"emails:compose",label:"Compose email",group:t.emails.group??"Growth",hint:t.emails.label,selection:{kind:"emails",tab:"compose"}}),e.push({id:"emails:templates",label:"Email templates",group:t.emails.group??"Growth",hint:t.emails.label,selection:{kind:"emails",tab:"templates"}}),e.push({id:"emails:activity",label:"Email activity",group:t.emails.group??"Growth",hint:t.emails.label,selection:{kind:"emails",tab:"activity"}})),t.addons?.length&&e.push({id:"addons:overview",label:"Browse add-ons",group:"Add-ons",hint:"Preview and configure storefront features",selection:{kind:"addons"}});for(const n of t.addons??[])e.push({id:`addon:${n.id}`,label:n.label,group:n.group??"Add-ons",hint:n.description??"Storefront add-on",selection:{kind:"addon",id:n.id}});for(const n of t.configs){const r=n.section==="page"?"Pages":"Config";e.push({id:`config:${n.id}`,label:n.label,group:n.group??r,hint:n.section==="page"?"Page content":"Settings",selection:{kind:"config",id:n.id}})}return t.sync?.enabled&&e.push({id:"sync",label:"Sync environments",group:"Settings",hint:"Copy content between environments",selection:{kind:"sync"}}),e}function W5(t,e){const n=e.trim().toLowerCase();return n?t.filter(r=>[r.label,r.group,r.hint??"",r.id].join(" ").toLowerCase().includes(n)):t}function q5({catalog:t,onClose:e,onSelect:n}){const r=C.useRef(null),[s,i]=C.useState(""),[o,l]=C.useState(0),u=C.useMemo(()=>U5(t),[t]),d=C.useMemo(()=>W5(u,s),[u,s]);C.useEffect(()=>{r.current?.focus()},[]),C.useEffect(()=>{l(0)},[s]),C.useEffect(()=>{const b=v=>{if(v.key==="Escape"){v.preventDefault(),e();return}if(d.length!==0){if(v.key==="ArrowDown")v.preventDefault(),l(x=>(x+1)%d.length);else if(v.key==="ArrowUp")v.preventDefault(),l(x=>(x-1+d.length)%d.length);else if(v.key==="Enter"){v.preventDefault();const x=d[o];x&&(n(x.selection),e())}}};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[o,e,n,d]);const h=b=>{n(b.selection),e()},m=C.useMemo(()=>{const b=new Map;for(const v of d){const x=b.get(v.group)??[];x.push(v),b.set(v.group,x)}return b},[d]);let y=-1;return p.jsx("div",{className:"vertebr-command-backdrop",role:"presentation",onMouseDown:b=>{b.target===b.currentTarget&&e()},children:p.jsxs("div",{className:"vertebr-command",role:"dialog","aria-modal":"true","aria-label":"Search admin",children:[p.jsxs("div",{className:"vertebr-command-input-wrap",children:[p.jsx(lD,{}),p.jsx("input",{ref:r,className:"vertebr-command-input",type:"search",placeholder:"Search pages, resources, settings…",value:s,onChange:b=>i(b.target.value),autoComplete:"off",spellCheck:!1}),p.jsx("kbd",{children:"esc"})]}),p.jsx("div",{className:"vertebr-command-results",role:"listbox",children:d.length===0?p.jsx("div",{className:"vertebr-command-empty",children:"No matches found."}):[...m.entries()].map(([b,v])=>p.jsxs("div",{className:"vertebr-command-group",children:[p.jsx("div",{className:"vertebr-command-group-label",children:b}),v.map(x=>{y+=1;const k=y;return p.jsxs("button",{type:"button",className:"vertebr-command-item",role:"option","aria-selected":k===o,"data-active":k===o||void 0,onMouseEnter:()=>l(k),onClick:()=>h(x),children:[p.jsx("span",{className:"vertebr-command-item-label",children:x.label}),x.hint?p.jsx("span",{className:"vertebr-command-item-hint",children:x.hint}):null]},x.id)})]},b))})]})})}var Jf=t=>t.type==="checkbox",uy=t=>t.type==="file",la=t=>t instanceof Date,rr=t=>t==null;const ik=t=>typeof t=="object";var ln=t=>!rr(t)&&!Array.isArray(t)&&ik(t)&&!la(t),sx=t=>ln(t)&&t.target?Jf(t.target)?t.target.checked:uy(t.target)?t.target.files:t.target.value:t,uD=(t,e)=>e.split(".").some((n,r,s)=>!isNaN(Number(n))&&t.has(s.slice(0,r).join("."))),dD=t=>{const e=t.constructor&&t.constructor.prototype;return ln(e)&&e.hasOwnProperty("isPrototypeOf")},dy=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function on(t){if(t instanceof Date)return new Date(t);const e=typeof FileList<"u"&&t instanceof FileList;if(dy&&(t instanceof Blob||e))return t;const n=Array.isArray(t);if(!n&&!(ln(t)&&dD(t)))return t;const r=n?[]:Object.create(Object.getPrototypeOf(t));for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=on(t[s]));return r}const Xo={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Ws={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},zs={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},fD="root",ok=["__proto__","constructor","prototype"],G5=/^\w*$/;var Qf=t=>G5.test(t),Qt=t=>t===void 0;const Y5=/[.[\]'"]/;var fy=t=>t.split(Y5).filter(Boolean),Me=(t,e,n)=>{if(!e||!ln(t))return n;const r=Qf(e)?[e]:fy(e);if(r.some(i=>ok.includes(i)))return n;const s=r.reduce((i,o)=>rr(i)?void 0:i[o],t);return Qt(s)||s===t?Qt(t[e])?n:t[e]:s},ts=t=>typeof t=="boolean",mr=t=>typeof t=="function",_t=(t,e,n)=>{let r=-1;const s=Qf(e)?[e]:fy(e),i=s.length,o=i-1;for(;++r<i;){const l=s[r];let u=n;if(r!==o){const d=t[l];u=ln(d)||Array.isArray(d)?d:isNaN(+s[r+1])?{}:[]}if(ok.includes(l))return;t[l]=u,t=t[l]}};const hD=fe.createContext(null);hD.displayName="HookFormControlContext";const ak=()=>fe.useContext(hD);var pD=(t,e,n,r=!0)=>{const s={};for(const i in t)Object.defineProperty(s,i,{get:()=>{const o=i;return e._proxyFormState[o]!==Ws.all&&(e._proxyFormState[o]=!r||Ws.all),n&&(n[o]=!0),t[o]}});return s};const lk=dy?fe.useLayoutEffect:fe.useEffect;function K5(t){const e=ak(),{control:n=e,disabled:r,name:s,exact:i}=t||{},[o,l]=fe.useState(()=>({...n._formState,defaultValues:n._defaultValues})),u=fe.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return lk(()=>n._subscribe({name:s,formState:u.current,exact:i,callback:d=>{!r&&l({...n._formState,...d,defaultValues:n._defaultValues})}}),[s,r,i]),fe.useEffect(()=>{u.current.isValid&&n._setValid(!0)},[n]),fe.useMemo(()=>pD(o,n,u.current,!1),[o,n])}var sr=t=>typeof t=="string",ix=(t,e,n,r,s)=>sr(t)?(r&&e.watch.add(t),Me(n,t,s)):Array.isArray(t)?t.map(i=>(r&&e.watch.add(i),Me(n,i))):(r&&(e.watchAll=!0),n),ox=t=>rr(t)||!ik(t);const UM=(t,e)=>e.length===0&&!Array.isArray(t)&&!dD(t);function ns(t,e,n=new WeakMap){if(t===e)return!0;if(ox(t)||ox(e))return Object.is(t,e);if(la(t)&&la(e))return Object.is(t.getTime(),e.getTime());const r=Object.keys(t),s=Object.keys(e);if(r.length!==s.length)return!1;if(UM(t,r)||UM(e,s))return Object.is(t,e);if(!r.length&&Array.isArray(t)!==Array.isArray(e))return!1;const i=n.get(t);if(i&&i.has(e))return!0;if(i)i.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(la(l)&&la(u)||(ln(l)||Array.isArray(l))&&(ln(u)||Array.isArray(u))?!ns(l,u,n):!Object.is(l,u))return!1}}return!0}function mD(t){const e=ak(),{control:n=e,name:r,defaultValue:s,disabled:i,exact:o,compute:l}=t||{},u=fe.useRef(s),d=fe.useRef(l),h=fe.useRef(void 0),m=fe.useRef(n),y=fe.useRef(r);d.current=l;const[b,v]=fe.useState(()=>{const N=n._getWatch(r,u.current);return d.current?d.current(N):N}),x=fe.useCallback(N=>{const T=ix(r,n._names,N||n._formValues,!1,u.current);return d.current?d.current(T):T},[n._formValues,n._names,r]),k=fe.useCallback(N=>{if(!i){const T=ix(r,n._names,N||n._formValues,!1,u.current);if(d.current){const A=d.current(T);ns(A,h.current)||(v(A),h.current=A)}else v(T)}},[n._formValues,n._names,i,r]);lk(()=>((m.current!==n||!ns(y.current,r))&&(m.current=n,y.current=r,k()),n._subscribe({name:r,formState:{values:!0},exact:o,callback:N=>{k(N.values)}})),[n,o,r,k]),fe.useEffect(()=>n._removeUnmounted());const E=m.current!==n,M=y.current,_=fe.useMemo(()=>{if(i)return null;const N=!E&&!ns(M,r);return E||N?x():null},[i,E,r,M,x]);return _!==null?_:b}function Z5(t){const e=ak(),{name:n,disabled:r,control:s=e,shouldUnregister:i,defaultValue:o,exact:l=!0}=t,u=uD(s._names.array,n),d=fe.useMemo(()=>Me(s._formValues,n,Me(s._defaultValues,n,o)),[s,n,o]),h=mD({control:s,name:n,defaultValue:d,exact:l}),m=K5({control:s,name:n,exact:l}),y=fe.useRef(t),b=fe.useRef(null),v=fe.useRef(s.register(n,{...t.rules,value:h,...ts(t.disabled)?{disabled:t.disabled}:{}}));y.current=t;const x=fe.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Me(m.errors,n)},isDirty:{enumerable:!0,get:()=>!!Me(m.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Me(m.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Me(m.validatingFields,n)},error:{enumerable:!0,get:()=>Me(m.errors,n)}}),[m,n]),k=fe.useCallback(N=>{const T=sx(N);return Me(s._fields,n)||(v.current=s.register(n,{...y.current.rules,value:T})),v.current.onChange({target:{value:sx(N),name:n},type:Xo.CHANGE})},[n,s]),E=fe.useCallback(()=>v.current.onBlur({target:{value:Me(s._formValues,n),name:n},type:Xo.BLUR}),[n,s._formValues]),M=fe.useCallback(N=>{N&&(b.current={focus:()=>mr(N.focus)&&N.focus(),select:()=>mr(N.select)&&N.select(),setCustomValidity:A=>mr(N.setCustomValidity)&&N.setCustomValidity(A),reportValidity:()=>mr(N.reportValidity)&&N.reportValidity()});const T=Me(s._fields,n);T&&T._f&&N&&(T._f.ref=b.current)},[s._fields,n]),_=fe.useMemo(()=>({name:n,value:h,...ts(r)||m.disabled?{disabled:m.disabled||r}:{},onChange:k,onBlur:E,ref:M}),[n,r,m.disabled,k,E,M,h]);return fe.useEffect(()=>{const N=s._options.shouldUnregister||i;v.current=s.register(n,{...y.current.rules,...ts(y.current.disabled)?{disabled:y.current.disabled}:{}});const T=(A,j)=>{const P=Me(s._fields,A);P&&P._f&&(P._f.mount=j)};if(T(n,!0),N){const A=on(Me(i?s._defaultValues:s._options.values||s._defaultValues,n,Me(s._options.defaultValues,n,y.current.defaultValue)));_t(s._defaultValues,n,A),Qt(Me(s._formValues,n))&&_t(s._formValues,n,A)}if(!u&&s.register(n),b.current){const A=Me(s._fields,n);A&&A._f&&(A._f.ref=b.current)}return()=>{(u?N&&!s._state.action:N)?s.unregister(n):T(n,!1)}},[n,s,u,i]),fe.useEffect(()=>{s._setDisabledField({disabled:r,name:n})},[r,n,s]),fe.useMemo(()=>({field:_,formState:m,fieldState:x}),[_,m,x])}const Ls=t=>t.render(Z5(t));var Ap=t=>({isOnSubmit:!t||t===Ws.onSubmit,isOnBlur:t===Ws.onBlur,isOnChange:t===Ws.onChange,isOnAll:t===Ws.all,isOnTouch:t===Ws.onTouched}),A0=(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 Xd=(t,e,n,r)=>{for(const s of n||Object.keys(t)){if(s==="_f")continue;const i=n?Me(t,s):t[s];if(i){const{_f:o}=i;if(o){if(o.refs&&o.refs[0]&&e(o.refs[0],s)&&!r)return!0;if(o.ref&&e(o.ref,o.name)&&!r)return!0;if(Xd(i,e))break}else if((ln(i)||Array.isArray(i))&&Xd(i,e))break}}};var WM=(t,e,n)=>{const r=Me(t,n),s=Array.isArray(r)?r:[];return _t(s,fD,e[n]),_t(t,n,s),t},tr=t=>ln(t)&&!Object.keys(t).length,Gm=t=>{if(!dy)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},ck=t=>t.type==="radio",Ym=t=>t instanceof RegExp,uk=(t,e,n,r,s)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:s||!0}}:{};const qM={value:!1,isValid:!1},GM={value:!0,isValid:!0};var gD=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&&!Qt(t[0].attributes.value)?Qt(t[0].value)||t[0].value===""?GM:{value:t[0].value,isValid:!0}:GM:qM}return qM};const YM={isValid:!1,value:null};var yD=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,YM):YM;function KM(t,e,n="validate"){if(sr(t)||Array.isArray(t)&&t.every(sr)||ts(t)&&!t)return{type:n,message:sr(t)?t:"",ref:e}}var Mc=t=>ln(t)&&!Ym(t)?t:{value:t,message:""},ZM=async(t,e,n,r,s,i)=>{const{ref:o,refs:l,required:u,maxLength:d,minLength:h,min:m,max:y,pattern:b,validate:v,name:x,valueAsNumber:k,mount:E}=t._f,M=Me(n,x);if(!E||e.has(x))return{};const _=l?l[0]:o,N=W=>{if(s&&_.reportValidity){const K=ts(W)?"":W||"";l?l.forEach(Q=>Q.setCustomValidity(K)):_.setCustomValidity(K),_.reportValidity()}},T={},A=ck(o),j=Jf(o),P=A||j,O=(k||uy(o))&&Qt(o.value)&&Qt(M)||Gm(o)&&o.value===""||M===""||Array.isArray(M)&&!M.length,G=uk.bind(null,x,r,T),B=(W,K,Q,ee=zs.maxLength,F=zs.minLength)=>{const I=W?K:Q;T[x]={type:W?ee:F,message:I,ref:o,...G(W?ee:F,I)}};if(i?!Array.isArray(M)||!M.length:u&&(!P&&(O||rr(M))||ts(M)&&!M||j&&!gD(l).isValid||A&&!yD(l).isValid)){const{value:W,message:K}=sr(u)?{value:!!u,message:u}:Mc(u);if(W&&(T[x]={type:zs.required,message:K,ref:_,...G(zs.required,K)},!r))return N(K),T}if(!O&&(!rr(m)||!rr(y))){let W,K;const Q=Mc(y),ee=Mc(m);if(!rr(M)&&!isNaN(M)){const F=o.valueAsNumber||M&&+M;rr(Q.value)||(W=F>Q.value),rr(ee.value)||(K=F<ee.value)}else{const F=o.valueAsDate||new Date(M),I=X=>new Date(new Date().toDateString()+" "+X),z=o.type=="time",J=o.type=="week";sr(Q.value)&&M&&(W=z?I(M)>I(Q.value):J?M>Q.value:F>new Date(Q.value)),sr(ee.value)&&M&&(K=z?I(M)<I(ee.value):J?M<ee.value:F<new Date(ee.value))}if((W||K)&&(B(!!W,Q.message,ee.message,zs.max,zs.min),!r))return N(T[x].message),T}if((d||h)&&!O&&(sr(M)||i&&Array.isArray(M))){const W=Mc(d),K=Mc(h),Q=!rr(W.value)&&M.length>+W.value,ee=!rr(K.value)&&M.length<+K.value;if((Q||ee)&&(B(Q,W.message,K.message),!r))return N(T[x].message),T}if(b&&!O&&sr(M)){const{value:W,message:K}=Mc(b);if(Ym(W)&&!M.match(W)&&(T[x]={type:zs.pattern,message:K,ref:o,...G(zs.pattern,K)},!r))return N(K),T}if(v){if(mr(v)){const W=await v(M,n),K=KM(W,_);if(K&&(T[x]={...K,...G(zs.validate,K.message)},!r))return N(K.message),T}else if(ln(v)){let W={};for(const K in v){if(!tr(W)&&!r)break;const Q=KM(await v[K](M,n),_,K);Q&&(W={...Q,...G(K,Q.message)},N(Q.message),r&&(T[x]=W))}if(!tr(W)&&(T[x]={ref:_,...W},!r))return T}}return N(!0),T},Sm=t=>Array.isArray(t)?t:[t],bD=t=>Array.isArray(t)?t.filter(Boolean):[];function X5(t,e){const n=e.length-1;let r=0;for(;r<n;){if(rr(t)){t=void 0;break}t=t[e[r]],r++}return t}function J5(t){for(const e in t)if(t.hasOwnProperty(e)&&!Qt(t[e]))return!1;return!0}function Sn(t,e){if(sr(e)&&Object.prototype.hasOwnProperty.call(t,e))return delete t[e],t;const n=Array.isArray(e)?e:Qf(e)?[e]:fy(e);if(n.some(o=>ok.includes(String(o))))return t;const r=n.length===1?t:X5(t,n),s=n.length-1,i=n[s];return r&&delete r[i],s!==0&&(ln(r)&&tr(r)||Array.isArray(r)&&J5(r))&&Sn(t,n.slice(0,-1)),t}const vD=t=>{const e={};for(const n of Object.keys(t))if(ik(t[n])&&t[n]!==null&&!la(t[n])){const r=vD(t[n]);for(const s of Object.keys(r))e[`${n}.${s}`]=r[s]}else e[n]=t[n];return e},Q5=fe.createContext(null);Q5.displayName="HookFormContext";var XM=()=>{let t=[];return{get observers(){return t},next:s=>{for(const i of t)i.next&&i.next(s)},subscribe:s=>(t.push(s),{unsubscribe:()=>{t=t.filter(i=>i!==s)}}),unsubscribe:()=>{t=[]}}};function wD(t,e){const n={};for(const r in t)if(t.hasOwnProperty(r)){const s=t[r],i=e[r];if(s&&ln(s)&&i){const o=wD(s,i);ln(o)&&(n[r]=o)}else t[r]&&(n[r]=i)}return n}var xD=t=>t.type==="select-multiple",e6=t=>ck(t)||Jf(t),R0=t=>Gm(t)&&t.isConnected;function JM(t){return Array.isArray(t)||ln(t)}function SD(t,e,n="",r=[]){for(const s in t){const i=n?`${n}.${s}`:s,o=t[s];JM(o)&&JM(Me(e,i))?SD(o,e,i,r):r.push(i)}return r}var t6=t=>{for(const e in t)if(mr(t[e]))return!0;return!1};function kD(t){return Array.isArray(t)||ln(t)&&!t6(t)}function CD(t){return!!(t&&"_f"in t)}function ED(t){return Array.isArray(t)?!t.some(e=>!Qt(e)):!Object.keys(t).length}function ax(t,e){Array.isArray(t)?t[e]=void 0:delete t[e]}function lx(t,e={},n){for(const r in t){const s=t[r],i=n&&n[r];kD(s)&&(!Array.isArray(s)||!CD(i))?(e[r]=Array.isArray(s)?[]:{},lx(s,e[r],i),ED(e[r])&&ax(e,r)):Qt(s)||(e[r]=!0)}return e}function ul(t,e,n,r){n||(n=lx(e,{},r));for(const s in t){const i=t[s],o=r&&r[s];kD(i)&&(!Array.isArray(i)||!CD(o))?(Qt(e)||ox(n[s])?n[s]=lx(i,Array.isArray(i)?[]:{},o):ul(i,rr(e)?{}:e[s],n[s],o),ED(n[s])&&ax(n,s)):ns(i,e[s])?ax(n,s):n[s]=!0}return n}var TD=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>Qt(t)?t:e?t===""?NaN:t&&+t:n&&sr(t)?new Date(t):r?r(t):t;function QM(t){const e=t.ref;return uy(e)?e.files:ck(e)?yD(t.refs).value:xD(e)?[...e.selectedOptions].map(({value:n})=>n):Jf(e)?gD(t.refs).value:TD(e.value,t)}var n6=(t,e,n,r)=>{const s={};for(const i of t){const o=Me(e,i);o&&_t(s,i,o._f)}return{criteriaMode:n,names:[...t],fields:s,shouldUseNativeValidation:r}},Cd=t=>Qt(t)?t:Ym(t)?t.source:ln(t)?Ym(t.value)?t.value.source:t.value:t;const e_="AsyncFunction";var r6=t=>{if(!t||!t.validate)return!1;if(mr(t.validate))return t.validate.constructor.name===e_;if(ln(t.validate)){for(const e in t.validate)if(t.validate[e].constructor.name===e_)return!0}return!1},s6=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate);function t_(t,e,n){const r=Me(t,n);if(r||Qf(n))return{error:r,name:n};const s=n.split(".");for(;s.length;){const i=s.join("."),o=Me(e,i),l=Me(t,i);if(o&&!Array.isArray(o)&&n!==i)return{name:n};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};s.pop()}return{name:n}}var i6=(t,e,n,r)=>{n(t);const s=Object.keys(t).filter(i=>i!=="name");return!s.length||r&&s.length>=Object.keys(e).length||s.find(i=>e[i]===(!r||Ws.all))},o6=(t,e,n)=>!t||!e||t===e||Sm(t).some(r=>r&&(n?r===e||r.startsWith(e+"."):r.startsWith(e)||e.startsWith(r))),a6=(t,e,n,r,s)=>s.isOnAll?!1:!n&&s.isOnTouch?!(e||t):(n?r.isOnBlur:s.isOnBlur)?!t:(n?r.isOnChange:s.isOnChange)?t:!0,l6=(t,e)=>!bD(Me(t,e)).length&&Sn(t,e);const c6={mode:Ws.onSubmit,reValidateMode:Ws.onChange,shouldFocusError:!0},O0="form",u6=(t,e)=>{for(const n in t)n in e||delete t[n];Object.assign(t,e)},ND={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function d6(t={}){let e={...c6,...t},n={...on(ND),isLoading:mr(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1},r={},s=ln(e.defaultValues)||ln(e.values)?on(e.defaultValues||e.values)||{}:{},i=e.shouldUnregister?{}:on(s),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={},d={};let h=0,m=Ap(e.mode),y=Ap(e.reValidateMode);const b={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},v={...b};let x={...v};const k={array:XM(),state:XM()};let E=0;const M=e.criteriaMode===Ws.all,_=($,V)=>U=>{clearTimeout(d[$]),d[$]=setTimeout(V,U)},N=async $=>{if(!o.keepIsValid&&!e.disabled&&(v.isValid||x.isValid||$)){const V=++E;let U;e.resolver?(U=tr((await Q()).errors),V===E&&T()):U=await I({fields:r,onlyCheckValid:!0,eventType:Xo.VALID}),V===E&&U!==n.isValid&&k.state.next({isValid:U})}},T=($,V)=>{!e.disabled&&(v.isValidating||v.validatingFields||x.isValidating||x.validatingFields)&&(($||Array.from(l.mount)).forEach(U=>{U&&(V?_t(n.validatingFields,U,V):Sn(n.validatingFields,U))}),k.state.next({validatingFields:n.validatingFields,isValidating:!tr(n.validatingFields)}))},A=()=>{n.dirtyFields=ul(s,i,void 0,r)},j=($,V=[],U,ae,ce=!0,be=!0)=>{if(ae&&U&&!e.disabled){if(o.action=!0,be&&Array.isArray(Me(r,$))){const Ce=U(Me(r,$),ae.argA,ae.argB);ce&&_t(r,$,Ce)}if(be&&Array.isArray(Me(n.errors,$))){const Ce=U(Me(n.errors,$),ae.argA,ae.argB);ce&&_t(n.errors,$,Ce),l6(n.errors,$)}if((v.touchedFields||x.touchedFields)&&be&&Array.isArray(Me(n.touchedFields,$))){const Ce=U(Me(n.touchedFields,$),ae.argA,ae.argB);ce&&_t(n.touchedFields,$,Ce)}(v.dirtyFields||x.dirtyFields)&&A(),k.state.next({name:$,isDirty:J($,V),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else _t(i,$,V)},P=($,V)=>{_t(n.errors,$,V),n.errors={...n.errors},k.state.next({errors:n.errors})},O=$=>{n.errors=$,k.state.next({errors:n.errors,isValid:!1})},G=$=>{const V=Qf($)?[$]:fy($);let U=i,ae=s;for(let ce=0;ce<V.length-1;ce++){const be=V[ce];if(U=rr(U)?U:U[be],ae=rr(ae)?ae:ae[be],U===null&&ae!==null)return!0}return!1},B=($,V,U,ae)=>{const ce=Me(r,$);if(ce){if(G($))return;const be=Qt(Me(i,$)),Ce=Me(i,$,Qt(U)?Me(s,$):U);Qt(Ce)||ae&&ae.defaultChecked||V?_t(i,$,V?Ce:QM(ce._f)):q($,Ce),o.mount&&!o.action&&(N(),be&&n.isDirty&&(v.isDirty||x.isDirty)&&(J()||(n.isDirty=!1,k.state.next({...n}))),t.shouldUnregister&&be&&!Qt(Me(i,$))&&A0($,l)&&(o.watch=!0))}},W=($,V,U,ae,ce)=>{let be=!1,Ce=!1;const Ae={name:$};if(!e.disabled||ae===!0){if(!U||ae){const ve=ns(Me(s,$),V);(v.isDirty||x.isDirty)&&(Ce=n.isDirty,n.isDirty=Ae.isDirty=!ve||J(),be=Ce!==Ae.isDirty),Ce=!!Me(n.dirtyFields,$),ve!==n.isDirty?u6(n.dirtyFields,ul(s,i,void 0,r)):ve?Sn(n.dirtyFields,$):_t(n.dirtyFields,$,!0),Ae.dirtyFields=n.dirtyFields,be=be||(v.dirtyFields||x.dirtyFields)&&Ce!==!ve}if(U){const ve=Me(n.touchedFields,$);ve||(_t(n.touchedFields,$,U),Ae.touchedFields=n.touchedFields,be=be||(v.touchedFields||x.touchedFields)&&ve!==U)}be&&ce&&k.state.next(Ae)}return be?Ae:{}},K=($,V,U,ae)=>{const ce=Me(n.errors,$),be=(v.isValid||x.isValid)&&ts(V)&&n.isValid!==V;if(e.delayError&&U?(u[$]=_($,()=>P($,U)),u[$](e.delayError)):(clearTimeout(d[$]),delete u[$],U?_t(n.errors,$,U):Sn(n.errors,$),n.errors={...n.errors}),(U?!ns(ce,U):ce)||!tr(ae)||be){const Ce={...ae,...be&&ts(V)?{isValid:V}:{},errors:n.errors,name:$};n={...n,...Ce},k.state.next(Ce)}},Q=async $=>(T($,!0),await e.resolver(i,e.context,n6($||l.mount,r,e.criteriaMode,e.shouldUseNativeValidation))),ee=async $=>{const{errors:V}=await Q($);if(T($),$){for(const U of $){const ae=Me(V,U);ae?l.array.has(U)&&ln(ae)&&!Object.keys(ae).some(ce=>!Number.isNaN(Number(ce)))?WM(n.errors,{[U]:ae},U):_t(n.errors,U,ae):Sn(n.errors,U)}n.errors={...n.errors}}else n.errors=V;return V},F=async({name:$,eventType:V})=>{if(t.validate){const U=await t.validate({formValues:i,formState:n,name:$,eventType:V});if(ln(U))for(const ae in U){const ce=U[ae];ce&&Ke(`${O0}.${ae}`,{message:sr(ce.message)?ce.message:"",type:ce.type||zs.validate})}else sr(U)||!U?Ke(O0,{message:U||"",type:zs.validate}):Ye(O0);return U}return!0},I=async({fields:$,onlyCheckValid:V,name:U,eventType:ae,context:ce={valid:!0,runRootValidation:!1}})=>{if(t.validate&&(ce.runRootValidation=!0,!await F({name:U,eventType:ae})&&(ce.valid=!1,V)))return ce.valid;for(const be in $){const Ce=$[be];if(Ce){const{_f:Ae,...ve}=Ce;if(Ae){const Ie=l.array.has(Ae.name),Re=Ce._f&&r6(Ce._f),Qe=v.validatingFields||v.isValidating||x.validatingFields||x.isValidating;Re&&Qe&&T([Ae.name],!0);const gt=await ZM(Ce,l.disabled,i,M,e.shouldUseNativeValidation&&!V,Ie);if(Re&&Qe&&T([Ae.name]),gt[Ae.name]&&(ce.valid=!1,V)||(!V&&(Me(gt,Ae.name)?Ie?WM(n.errors,gt,Ae.name):_t(n.errors,Ae.name,gt[Ae.name]):Sn(n.errors,Ae.name)),t.shouldUseNativeValidation&&gt[Ae.name]))break}!tr(ve)&&await I({context:ce,onlyCheckValid:V,fields:ve,name:be,eventType:ae})}}return ce.valid},z=()=>{for(const $ of l.unMount){const V=Me(r,$);V&&(V._f.refs?V._f.refs.every(U=>!R0(U)):!R0(V._f.ref))&&un($)}l.unMount=new Set},J=($,V)=>($&&V&&_t(i,$,V),!ns(o.mount?i:s,s)),X=($,V,U)=>ix($,l,{...o.mount?i:Qt(V)?s:sr($)?{[$]:V}:V},U,V),L=$=>bD(Me(o.mount?i:s,$,e.shouldUnregister?Me(s,$,[]):[])),q=($,V,U={},ae=!1,ce=!1)=>{const be=Me(r,$);let Ce=V;if(be){const Ae=be._f;Ae&&(!Ae.disabled&&_t(i,$,TD(V,Ae)),Ce=Gm(Ae.ref)&&rr(V)?"":V,xD(Ae.ref)?[...Ae.ref.options].forEach(ve=>ve.selected=Ce.includes(ve.value)):Ae.refs?Jf(Ae.ref)?Ae.refs.forEach(ve=>{(!ve.defaultChecked||!ve.disabled)&&(Array.isArray(Ce)?ve.checked=!!Ce.find(Ie=>Ie===ve.value):ve.checked=Ce===ve.value||!!Ce)}):Ae.refs.forEach(ve=>ve.checked=ve.value===Ce):uy(Ae.ref)?Ae.ref.value="":(Ae.ref.value=Ce,!Ae.ref.type&&!ce&&k.state.next({name:$,values:ae?i:on(i)})))}(U.shouldDirty||U.shouldTouch)&&W($,Ce,U.shouldTouch,U.shouldDirty,!ce),U.shouldValidate&&oe($,{delayError:U.delayError})},ie=($,V,U,ae=!1,ce=!1)=>{l.array.has($)&&k.array.next({name:$,values:ae?i:on(i)});for(const be in V){if(!V.hasOwnProperty(be))return;const Ce=V[be],Ae=$+"."+be,ve=Me(r,Ae);(l.array.has($)||ln(Ce)||ve&&!ve._f)&&!la(Ce)?ie(Ae,Ce,U,ae,ce):q(Ae,Ce,U,ae,ce)}},de=($,V,U,ae,ce=!1)=>{const be=Me(r,$),Ce=l.array.has($),Ae=ae?V:on(V),ve=Me(i,$),Ie=ns(ve,Ae);if(Ie||_t(i,$,Ae),Ce)k.array.next({name:$,values:ae?i:on(i)}),(v.isDirty||v.dirtyFields||x.isDirty||x.dirtyFields)&&U.shouldDirty&&(A(),ce||k.state.next({name:$,dirtyFields:n.dirtyFields,isDirty:J($,Ae)}));else{const Re=Array.isArray(Ae)&&!Ae.length||tr(Ae);!be||be._f||rr(Ae)||Re?q($,Ae,U,ae,ce):ie($,Ae,U,ae,ce)}if(!Ie&&!ce){const Re=A0($,l),Qe=ae?i:on(i);k.state.next({...Re&&n,name:o.mount||Re?$:void 0,values:Qe})}},Te=($,V,U={})=>de($,V,U,!1),De=($,V={})=>{const U=mr($)?$(i):$;if(!ns(i,U)){i={...i,...U};const ae=vD(U);for(const ce of l.mount)ce in ae&&de(ce,ae[ce],V,!0,!0);k.state.next({...n,name:void 0,type:void 0,...h?{values:i}:{}}),V.shouldValidate&&N()}},je=async $=>{o.mount=!0;const V=$.target;let U=V.name,ae=!0;const ce=Me(r,U),be=Ce=>{ae=Number.isNaN(Ce)||la(Ce)&&isNaN(Ce.getTime())||ns(Ce,Me(i,U,Ce))};if(ce){let Ce,Ae;const ve=V.type?QM(ce._f):sx($),Ie=$.type===Xo.BLUR||$.type===Xo.FOCUS_OUT,Re=!s6(ce._f)&&!t.validate&&!e.resolver&&!Me(n.errors,U)&&!ce._f.deps,Qe=Re||a6(Ie,Me(n.touchedFields,U),n.isSubmitted,y,m),gt=A0(U,l,Ie);if(_t(i,U,ve),Ie){if(!V||!V.readOnly){ce._f.onBlur&&ce._f.onBlur($);const Vr=u[U];Vr&&Vr(0)}}else ce._f.onChange&&ce._f.onChange($);const Ze=W(U,ve,Ie),_r=!tr(Ze)||gt;if(!Ie&&k.state.next({name:U,type:$.type,...h?{values:on(i)}:{}}),Qe)return(!Re||!n.isValid)&&(v.isValid||x.isValid)&&(e.mode==="onBlur"?Ie&&N():Ie||N()),_r&&k.state.next({name:U,...gt?{}:Ze});if(!e.resolver&&t.validate&&await F({name:U,eventType:$.type}),!Ie&&gt&&k.state.next({...n}),e.resolver){const{errors:Vr}=await Q([U]);if(T([U]),be(ve),!ae){!tr(Ze)&&k.state.next(Ze);return}const wr=t_(n.errors,r,U),Kn=t_(Vr,r,wr.name||U);Ce=Kn.error,U=Kn.name,Ae=tr(Vr)}else T([U],!0),Ce=(await ZM(ce,l.disabled,i,M,e.shouldUseNativeValidation))[U],T([U]),be(ve),ae&&(Ce?Ae=!1:(v.isValid||x.isValid)&&(Ae=await I({fields:r,onlyCheckValid:!0,name:U,eventType:$.type})));ae&&(ce._f.deps&&(!Array.isArray(ce._f.deps)||ce._f.deps.length>0)&&oe(ce._f.deps),K(U,Ae,Ce,Ze))}},Ne=($,V)=>{if(Me(n.errors,V)&&$.focus)return $.focus(),1},oe=async($,V={})=>{let U,ae;const ce=Sm($);if(e.resolver){const be=await ee(Qt($)?$:ce);U=tr(be),ae=$?!ce.some(Ce=>Me(be,Ce)):U}else $?(ae=(await Promise.all(ce.map(async be=>{const Ce=Me(r,be);return await I({fields:Ce&&Ce._f?{[be]:Ce}:Ce,eventType:Xo.TRIGGER})}))).every(Boolean),!(!ae&&!n.isValid)&&N()):ae=U=await I({fields:r,name:$,eventType:Xo.TRIGGER});if(V.delayError&&e.delayError&&sr($)){const be=Me(n.errors,$);be?(Sn(n.errors,$),u[$]=_($,()=>P($,be)),u[$](e.delayError)):(clearTimeout(d[$]),delete u[$])}return k.state.next({...!sr($)||(v.isValid||x.isValid)&&U!==n.isValid?{}:{name:$},...e.resolver||!$?{isValid:U}:{},errors:n.errors}),V.shouldFocus&&!ae&&Xd(r,Ne,$?ce:l.mount),ae},ye=($,V)=>{let U={...o.mount?i:s};return V&&(U=wD(V.dirtyFields?n.dirtyFields:n.touchedFields,U)),Qt($)?U:sr($)?Me(U,$):$.map(ae=>Me(U,ae))},Pe=($,V)=>({invalid:!!Me((V||n).errors,$),isDirty:!!Me((V||n).dirtyFields,$),error:Me((V||n).errors,$),isValidating:!!Me(n.validatingFields,$),isTouched:!!Me((V||n).touchedFields,$)}),Ye=$=>{const V=$?Sm($):void 0;V?.forEach(U=>Sn(n.errors,U)),V?V.forEach(U=>{k.state.next({name:U,errors:n.errors})}):(n.errors={},k.state.next({errors:n.errors}))},Ke=($,V,U)=>{const ae=(Me(r,$,{_f:{}})._f||{}).ref,ce=Me(n.errors,$)||{},{ref:be,message:Ce,type:Ae,...ve}=ce;_t(n.errors,$,{...ve,...V,ref:ae}),k.state.next({name:$,errors:n.errors,isValid:!1}),U&&U.shouldFocus&&ae&&ae.focus&&ae.focus()},ut=($,V)=>{if(mr($)){h++;const{unsubscribe:U}=k.state.subscribe({next:ce=>"values"in ce&&$(ce.values||X(void 0,V),ce)});let ae=!1;return{unsubscribe:()=>{ae||(ae=!0,h--,U())}}}return X($,V,!0)},Xe=$=>{var V;const U=!!(!((V=$.formState)===null||V===void 0)&&V.values);U&&h++;const{unsubscribe:ae}=k.state.subscribe({next:be=>{if(o6($.name,be.name,$.exact)&&i6(be,$.formState||v,vr,$.reRenderRoot)){const Ce={...i};$.callback({values:Ce,...n,...be,defaultValues:s})}}});if(!U)return ae;let ce=!1;return()=>{ce||(ce=!0,h--,ae())}},Vt=$=>(o.mount=!0,x={...x,...$.formState},Xe({...$,formState:{...b,...$.formState}})),un=($,V={})=>{for(const U of $?Sm($):l.mount)l.mount.delete(U),l.array.delete(U),V.keepValue||(Sn(r,U),Sn(i,U)),!V.keepError&&Sn(n.errors,U),!V.keepDirty&&Sn(n.dirtyFields,U),!V.keepTouched&&Sn(n.touchedFields,U),!V.keepIsValidating&&Sn(n.validatingFields,U),!e.shouldUnregister&&!V.keepDefaultValue&&Sn(s,U);k.state.next({values:on(i)}),k.state.next({...n,...V.keepDirty?{isDirty:J()}:{}}),!V.keepIsValid&&N()},qt=({disabled:$,name:V})=>{if(ts($)&&o.mount||$||l.disabled.has(V)){const ce=l.disabled.has(V)!==!!$;$?l.disabled.add(V):l.disabled.delete(V),ce&&o.mount&&!o.action&&N()}},kn=($,V={})=>{let U=Me(r,$);const ae=ts(V.disabled)||ts(e.disabled),ce=!l.registerName.has($)&&U&&U._f&&!U._f.mount;return _t(r,$,{...U||{},_f:{...U&&U._f?U._f:{ref:{name:$}},name:$,mount:!0,...V}}),l.mount.add($),U&&!ce?qt({disabled:ts(V.disabled)?V.disabled:e.disabled,name:$}):B($,!0,V.value),{...ae?{disabled:V.disabled||e.disabled}:{},...e.progressive?{required:!!V.required,min:Cd(V.min),max:Cd(V.max),minLength:Cd(V.minLength),maxLength:Cd(V.maxLength),pattern:Cd(V.pattern)}:{},name:$,onChange:je,onBlur:je,ref:be=>{if(be){l.registerName.add($),kn($,V),l.registerName.delete($),U=Me(r,$);const Ce=Qt(be.value)&&be.querySelectorAll&&be.querySelectorAll("input,select,textarea")[0]||be,Ae=e6(Ce),ve=U._f.refs||[];if(Ae?ve.find(Re=>Re===Ce):Ce===U._f.ref)return;const Ie={...U._f};Ae?(Ie.refs=[...ve.filter(R0),Ce,...Array.isArray(Me(s,$))?[{}]:[]],Ie.ref={type:Ce.type,name:$}):(Ie.ref=Ce,delete Ie.refs),_t(r,$,{_f:Ie}),B($,!1,void 0,Ce)}else U=Me(r,$,{}),U._f&&(U._f.mount=!1),(e.shouldUnregister||V.shouldUnregister)&&!(uD(l.array,$)&&o.action)&&l.unMount.add($)}}},dn=()=>e.shouldFocusError&&!e.shouldUseNativeValidation&&Xd(r,Ne,l.mount),In=$=>{ts($)&&(k.state.next({disabled:$}),Xd(r,(V,U)=>{const ae=Me(r,U);ae&&(V.disabled=ae._f.disabled||$,Array.isArray(ae._f.refs)&&ae._f.refs.forEach(ce=>{ce.disabled=ae._f.disabled||$}))},0,!1))},Ln=($,V)=>async U=>{let ae,ce;U&&(U.preventDefault&&U.preventDefault(),U.persist&&U.persist());let be=on(i);if(k.state.next({isSubmitting:!0}),e.resolver){const{errors:Ce,values:Ae}=await Q();T(),n.errors=Ce,be=on(Ae)}else await I({fields:r,eventType:Xo.SUBMIT});if(l.disabled.size)for(const Ce of l.disabled)Sn(be,Ce);if(Sn(n.errors,fD),tr(n.errors)){k.state.next({errors:{}});try{ae=await $(be,U)}catch(Ce){ce=Ce}}else V&&await V({...n.errors},U),dn(),setTimeout(dn);if(k.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:tr(n.errors)&&!ce,submitCount:n.submitCount+1,errors:n.errors}),ce)throw ce;return ae},Yn=($,V={})=>{Me(r,$)&&(Qt(V.defaultValue)?Te($,on(Me(s,$))):(Te($,V.defaultValue),_t(s,$,on(V.defaultValue))),V.keepTouched||Sn(n.touchedFields,$),V.keepDirty||(Sn(n.dirtyFields,$),n.isDirty=V.defaultValue?J($,on(Me(s,$))):J()),V.keepError||(Sn(n.errors,$),v.isValid&&N()),k.state.next({...n}))},ht=($,V={})=>{const U=$?on($):s,ae=on(U),ce=tr($),be=ae,Ce=r;if(V.keepDefaultValues||(s=U),!V.keepValues){if(V.keepDirtyValues){const Ae=new Set([...l.mount,...SD(ul(s,i,void 0,Ce),n.dirtyFields)]);for(const ve of Array.from(Ae)){const Ie=Me(n.dirtyFields,ve),Re=Me(i,ve),Qe=Me(be,ve);Ie&&!Qt(Re)?_t(be,ve,Re):!Ie&&!Qt(Qe)&&Te(ve,Qe)}}else{if(dy&&Qt($))for(const Ae of l.mount){const ve=Me(r,Ae);if(ve&&ve._f){const Ie=Array.isArray(ve._f.refs)?ve._f.refs[0]:ve._f.ref;if(Gm(Ie)){const Re=Ie.closest("form");if(Re){Re.reset();break}}}}if(V.keepFieldsRef)for(const Ae of l.mount)Te(Ae,Me(be,Ae));else r={}}if(e.shouldUnregister){if(i=V.keepDefaultValues?on(s):{},V.keepFieldsRef)for(const Ae of l.mount)_t(i,Ae,Me(be,Ae))}else i=on(be);k.array.next({values:{...be}}),k.state.next({name:void 0,type:void 0,values:{...be}})}l={mount:V.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=!v.isValid||!!V.keepIsValid||!!V.keepDirtyValues||!e.shouldUnregister&&!tr(be),o.watch=!!e.shouldUnregister,o.keepIsValid=!!V.keepIsValid,o.action=!1,V.keepErrors||(n.errors={}),k.state.next({submitCount:V.keepSubmitCount?n.submitCount:0,isDirty:ce?!1:V.keepDirty?n.isDirty:V.keepValues?J():!!(V.keepDefaultValues&&!ns($,s)),isSubmitted:V.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ce?{}:V.keepDirtyValues?V.keepDefaultValues&&i?ul(s,i,void 0,Ce):n.dirtyFields:V.keepDefaultValues&&$?ul(s,$,void 0,Ce):V.keepDirty?n.dirtyFields:{},touchedFields:V.keepTouched?n.touchedFields:{},errors:V.keepErrors?n.errors:{},isSubmitSuccessful:V.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},Bn=($,V)=>ht(mr($)?$(i):$,{...e.resetOptions,...V}),lr=($,V={})=>{const U=Me(r,$),ae=U&&U._f;if(ae){const ce=ae.refs?ae.refs[0]:ae.ref;ce.focus&&setTimeout(()=>{ce.focus(),V.shouldSelect&&mr(ce.select)&&ce.select()})}},vr=$=>{const{name:V,type:U,values:ae,...ce}=$;n={...n,...ce}},$e={control:{register:kn,unregister:un,getFieldState:Pe,handleSubmit:Ln,setError:Ke,_subscribe:Xe,_runSchema:Q,_updateIsValidating:T,_focusError:dn,_getWatch:X,_getDirty:J,_setValid:N,_setFieldArray:j,_setDisabledField:qt,_setErrors:O,_getFieldArray:L,_reset:ht,_resetDefaultValues:()=>mr(e.defaultValues)&&e.defaultValues().then($=>{Bn($,e.resetOptions),k.state.next({isLoading:!1})}),_removeUnmounted:z,_disableForm:In,_subjects:k,_proxyFormState:v,get _fields(){return r},get _formValues(){return i},get _state(){return o},set _state($){o=$},get _defaultValues(){return s},get _names(){return l},set _names($){l=$},get _formState(){return n},get _options(){return e},set _options($){e={...e,...$},m=Ap(e.mode),y=Ap(e.reValidateMode)}},subscribe:Vt,trigger:oe,register:kn,handleSubmit:Ln,watch:ut,setValue:Te,setValues:De,getValues:ye,reset:Bn,resetField:Yn,resetDefaultValues:($,V={})=>{if(s=on($),!V.keepDirty){const U=ul(s,i,void 0,r);n.dirtyFields=U,n.isDirty=!tr(U)}V.keepIsValid||N(),k.state.next({...n,defaultValues:s})},clearErrors:Ye,unregister:un,setError:Ke,setFocus:lr,getFieldState:Pe};return{...$e,formControl:$e}}function f6(t={}){const e=fe.useRef(void 0),n=fe.useRef(void 0),r=fe.useRef(t.formControl),[s,i]=fe.useState(()=>({...on(ND),isLoading:mr(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1,defaultValues:mr(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:s},t.defaultValues&&!mr(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:l,...u}=d6(t);e.current={...u,formState:s}}const o=e.current.control;return o._options=t,lk(()=>{const l=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return i(u=>({...u,isReady:!0})),o._formState.isReady=!0,l},[o]),fe.useEffect(()=>o._disableForm(t.disabled),[o,t.disabled]),fe.useEffect(()=>{t.mode&&(o._options.mode=t.mode),t.reValidateMode&&(o._options.reValidateMode=t.reValidateMode)},[o,t.mode,t.reValidateMode]),fe.useEffect(()=>{t.errors&&(o._setErrors(t.errors),o._focusError())},[o,t.errors]),fe.useEffect(()=>{t.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,t.shouldUnregister]),fe.useEffect(()=>{if(o._proxyFormState.isDirty){const l=o._getDirty();l!==s.isDirty&&o._subjects.state.next({isDirty:l})}},[o,s.isDirty]),fe.useEffect(()=>{var l;t.values&&!ns(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,i(u=>({...u}))):o._resetDefaultValues()},[o,t.values]),fe.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=fe.useMemo(()=>pD(s,o),[o,s]),e.current}const n_=(t,e,n)=>{if(t&&"reportValidity"in t){const r=Me(n,e);t.setCustomValidity(r&&r.message||""),t.reportValidity()}},cx=(t,e)=>{for(const n in e.fields){const r=e.fields[n];r&&r.ref&&"reportValidity"in r.ref?n_(r.ref,n,t):r&&r.refs&&r.refs.forEach(s=>n_(s,n,t))}},r_=(t,e)=>{e.shouldUseNativeValidation&&cx(t,e);const n={};for(const r in t){const s=Me(e.fields,r),i=Object.assign(t[r]||{},{ref:s&&s.refs?s.refs[0]:s&&s.ref});if(h6(e.names||Object.keys(t),r)){const o=Object.assign({},Me(n,r));_t(o,"root",i),_t(n,r,o)}else _t(n,r,i)}return n},h6=(t,e)=>{const n=s_(e).replace(/[.*+?^${}()|\\]/g,"\\$&");return t.some(r=>s_(r).match(`^${n}\\.\\d+`))};function s_(t){return t.replace(/[\[\]]/g,"")}function ux(){return ux=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},ux.apply(null,arguments)}function i_(t,e){try{var n=t()}catch(r){return e(r)}return n&&n.then?n.then(void 0,e):n}function p6(t,e){for(var n=Object.create(null);t.length;){var r=t[0],s=r.code,i=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var l,u,d=r.unionErrors.reduce(function(y,b){return b.errors.length<y.errors.length?b:y}).errors[0];n[o]={message:(l=d?.message)!=null?l:i,type:(u=d?.code)!=null?u:s}}else n[o]={message:i,type:s};if("unionErrors"in r&&r.unionErrors.forEach(function(y){return y.errors.forEach(function(b){return t.push(b)})}),e){var h=n[o].types,m=h&&h[r.code];n[o]=uk(o,e,n,s,m?[].concat(m,r.message):r.message)}t.shift()}return n}function m6(t,e){for(var n=Object.create(null),r=function(){var s=t[0],i=s.code,o=s.message,l=s.path.join(".");if(!n[l])if(s.code==="invalid_union"&&s.errors.length>0){var u,d,h=s.errors.reduce(function(b,v){return v.length<b.length?v:b})[0];n[l]={message:(u=h?.message)!=null?u:o,type:(d=h?.code)!=null?d:i}}else n[l]={message:o,type:i};if(s.code==="invalid_union"&&s.errors.forEach(function(b){return b.forEach(function(v){return t.push(ux({},v,{path:[].concat(s.path,v.path)}))})}),e){var m=n[l].types,y=m&&m[s.code];n[l]=uk(l,e,n,i,y?[].concat(y,s.message):s.message)}t.shift()};t.length;)r();return n}function g6(t,e,n){if(n===void 0&&(n={}),(function(r){return"_zod"in r&&typeof r._zod=="object"})(t))return function(r,s,i){try{return Promise.resolve(i_(function(){function o(u){return i.shouldUseNativeValidation&&cx({},i),{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:r_(m6(o.issues,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw o}))}catch(o){return Promise.reject(o)}};if((function(r){return"_def"in r&&typeof r._def=="object"})(t))return function(r,s,i){try{return Promise.resolve(i_(function(){return Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](r,e)).then(function(o){return i.shouldUseNativeValidation&&cx({},i),{errors:{},values:n.raw?Object.assign({},r):o}})},function(o){if((function(l){return Array.isArray(l?.issues)})(o))return{values:{},errors:r_(p6(o.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw o}))}catch(o){return Promise.reject(o)}};throw new Error("Invalid input: not a Zod schema")}const o_={visible:!1,isDirty:!1,saving:!1},MD=C.createContext(null);function y6({children:t}){const[e,n]=C.useState(o_),r=C.useCallback(o=>{n(l=>({...l,...o,visible:o.visible??!!(o.isDirty||o.saving)}))},[]),s=C.useCallback(()=>{n(o_)},[]),i=C.useMemo(()=>({state:e,register:r,clear:s}),[e,r,s]);return p.jsx(MD.Provider,{value:i,children:t})}function _D(){const t=C.useContext(MD);if(!t)throw new Error("useSaveBar must be used within SaveBarProvider");return t}const AD=C.createContext(null);function b6({children:t}){const[e,n]=C.useState([]),r=C.useCallback(o=>{n(l=>l.filter(u=>u.id!==o))},[]),s=C.useCallback((o,l="neutral")=>{const u=`${Date.now()}-${Math.random().toString(36).slice(2,7)}`;n(d=>[...d,{id:u,message:o,tone:l}]),window.setTimeout(()=>r(u),4e3)},[r]),i=C.useMemo(()=>({toasts:e,push:s,dismiss:r}),[e,s,r]);return p.jsx(AD.Provider,{value:i,children:t})}function hy(){const t=C.useContext(AD);if(!t)throw new Error("useToast must be used within ToastProvider");return t}var Nt;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(l=>typeof s[s[l]]!="number"),o={};for(const l of i)o[l]=s[l];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(const o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Nt||(Nt={}));var a_;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(a_||(a_={}));const Fe=Nt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Jo=t=>{switch(typeof t){case"undefined":return Fe.undefined;case"string":return Fe.string;case"number":return Number.isNaN(t)?Fe.nan:Fe.number;case"boolean":return Fe.boolean;case"function":return Fe.function;case"bigint":return Fe.bigint;case"symbol":return Fe.symbol;case"object":return Array.isArray(t)?Fe.array:t===null?Fe.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Fe.promise:typeof Map<"u"&&t instanceof Map?Fe.map:typeof Set<"u"&&t instanceof Set?Fe.set:typeof Date<"u"&&t instanceof Date?Fe.date:Fe.object;default:return Fe.unknown}},Ee=Nt.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 go 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(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(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 d=o.path[u];u===o.path.length-1?(l[d]=l[d]||{_errors:[]},l[d]._errors.push(n(o))):l[d]=l[d]||{_errors:[]},l=l[d],u++}}};return s(this),r}static assert(e){if(!(e instanceof go))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Nt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}go.create=t=>new go(t);const dx=(t,e)=>{let n;switch(t.code){case Ee.invalid_type:t.received===Fe.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case Ee.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Nt.jsonStringifyReplacer)}`;break;case Ee.unrecognized_keys:n=`Unrecognized key(s) in object: ${Nt.joinValues(t.keys,", ")}`;break;case Ee.invalid_union:n="Invalid input";break;case Ee.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Nt.joinValues(t.options)}`;break;case Ee.invalid_enum_value:n=`Invalid enum value. Expected ${Nt.joinValues(t.options)}, received '${t.received}'`;break;case Ee.invalid_arguments:n="Invalid function arguments";break;case Ee.invalid_return_type:n="Invalid function return type";break;case Ee.invalid_date:n="Invalid date";break;case Ee.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}"`:Nt.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case Ee.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 Ee.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 Ee.custom:n="Invalid input";break;case Ee.invalid_intersection_types:n="Intersection results could not be merged";break;case Ee.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case Ee.not_finite:n="Number must be finite";break;default:n=e.defaultError,Nt.assertNever(t)}return{message:n}};let v6=dx;function w6(){return v6}const x6=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let l="";const u=r.filter(d=>!!d).slice().reverse();for(const d of u)l=d(o,{data:e,defaultError:l}).message;return{...s,path:i,message:l}};function Le(t,e){const n=w6(),r=x6({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===dx?void 0:dx].filter(s=>!!s)});t.common.issues.push(r)}class as{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 s of n){if(s.status==="aborted")return ot;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return as.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return ot;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}}const ot=Object.freeze({status:"aborted"}),Pd=t=>({status:"dirty",value:t}),As=t=>({status:"valid",value:t}),l_=t=>t.status==="aborted",c_=t=>t.status==="dirty",ru=t=>t.status==="valid",Km=t=>typeof Promise<"u"&&t instanceof Promise;var He;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(He||(He={}));class ka{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}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 u_=(t,e)=>{if(ru(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 go(t.common.issues);return this._error=n,this._error}}};function ft(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=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:s}:{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:s}}class St{get description(){return this._def.description}_getType(e){return Jo(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Jo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new as,ctx:{common:e.parent.common,data:e.data,parsedType:Jo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Km(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:Jo(e)},s=this._parseSync({data:e,path:r.path,parent:r});return u_(r,s)}"~validate"(e){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Jo(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:n});return ru(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=>ru(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:Jo(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Km(s)?s:Promise.resolve(s));return u_(r,i)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=e(s),l=()=>i.addIssue({code:Ee.custom,...r(s)});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,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new ou({schema:this,typeName:at.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 ma.create(this,this._def)}nullable(){return au.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return gi.create(this)}promise(){return Qm.create(this,this._def)}or(e){return Xm.create([this,e],this._def)}and(e){return Jm.create(this,e,this._def)}transform(e){return new ou({...ft(this._def),schema:this,typeName:at.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new px({...ft(this._def),innerType:this,defaultValue:n,typeName:at.ZodDefault})}brand(){return new U6({typeName:at.ZodBranded,type:this,...ft(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new mx({...ft(this._def),innerType:this,catchValue:n,typeName:at.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return dk.create(this,e)}readonly(){return gx.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const S6=/^c[^\s-]{8,}$/i,k6=/^[0-9a-z]+$/,C6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,E6=/^[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,T6=/^[a-z0-9_-]{21}$/i,N6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,M6=/^[-+]?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)?)??$/,_6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,A6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let j0;const R6=/^(?:(?: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])$/,O6=/^(?:(?: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])$/,j6=/^(([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]))$/,D6=/^(([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])$/,I6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,L6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,RD="((\\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])))",P6=new RegExp(`^${RD}$`);function OD(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 $6(t){return new RegExp(`^${OD(t)}$`)}function z6(t){let e=`${RD}T${OD(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 B6(t,e){return!!((e==="v4"||!e)&&R6.test(t)||(e==="v6"||!e)&&j6.test(t))}function F6(t,e){if(!N6.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,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function V6(t,e){return!!((e==="v4"||!e)&&O6.test(t)||(e==="v6"||!e)&&D6.test(t))}class ca extends St{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Fe.string){const i=this._getOrReturnCtx(e);return Le(i,{code:Ee.invalid_type,expected:Fe.string,received:i.parsedType}),ot}const r=new as;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),Le(s,{code:Ee.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),Le(s,{code:Ee.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,l=e.data.length<i.value;(o||l)&&(s=this._getOrReturnCtx(e,s),o?Le(s,{code:Ee.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):l&&Le(s,{code:Ee.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")_6.test(e.data)||(s=this._getOrReturnCtx(e,s),Le(s,{validation:"email",code:Ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")j0||(j0=new RegExp(A6,"u")),j0.test(e.data)||(s=this._getOrReturnCtx(e,s),Le(s,{validation:"emoji",code:Ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")E6.test(e.data)||(s=this._getOrReturnCtx(e,s),Le(s,{validation:"uuid",code:Ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")T6.test(e.data)||(s=this._getOrReturnCtx(e,s),Le(s,{validation:"nanoid",code:Ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")S6.test(e.data)||(s=this._getOrReturnCtx(e,s),Le(s,{validation:"cuid",code:Ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")k6.test(e.data)||(s=this._getOrReturnCtx(e,s),Le(s,{validation:"cuid2",code:Ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")C6.test(e.data)||(s=this._getOrReturnCtx(e,s),Le(s,{validation:"ulid",code:Ee.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),Le(s,{validation:"url",code:Ee.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),Le(s,{validation:"regex",code:Ee.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),Le(s,{code:Ee.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),Le(s,{code:Ee.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),Le(s,{code:Ee.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?z6(i).test(e.data)||(s=this._getOrReturnCtx(e,s),Le(s,{code:Ee.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?P6.test(e.data)||(s=this._getOrReturnCtx(e,s),Le(s,{code:Ee.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?$6(i).test(e.data)||(s=this._getOrReturnCtx(e,s),Le(s,{code:Ee.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?M6.test(e.data)||(s=this._getOrReturnCtx(e,s),Le(s,{validation:"duration",code:Ee.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?B6(e.data,i.version)||(s=this._getOrReturnCtx(e,s),Le(s,{validation:"ip",code:Ee.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?F6(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),Le(s,{validation:"jwt",code:Ee.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?V6(e.data,i.version)||(s=this._getOrReturnCtx(e,s),Le(s,{validation:"cidr",code:Ee.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?I6.test(e.data)||(s=this._getOrReturnCtx(e,s),Le(s,{validation:"base64",code:Ee.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?L6.test(e.data)||(s=this._getOrReturnCtx(e,s),Le(s,{validation:"base64url",code:Ee.invalid_string,message:i.message}),r.dirty()):Nt.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:Ee.invalid_string,...He.errToObj(r)})}_addCheck(e){return new ca({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...He.errToObj(e)})}url(e){return this._addCheck({kind:"url",...He.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...He.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...He.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...He.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...He.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...He.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...He.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...He.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...He.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...He.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...He.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...He.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,...He.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,...He.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...He.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...He.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...He.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...He.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...He.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...He.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...He.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...He.errToObj(n)})}nonempty(e){return this.min(1,He.errToObj(e))}trim(){return new ca({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ca({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ca({...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}}ca.create=t=>new ca({checks:[],typeName:at.ZodString,coerce:t?.coerce??!1,...ft(t)});function H6(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}class su extends St{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)!==Fe.number){const i=this._getOrReturnCtx(e);return Le(i,{code:Ee.invalid_type,expected:Fe.number,received:i.parsedType}),ot}let r;const s=new as;for(const i of this._def.checks)i.kind==="int"?Nt.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Le(r,{code:Ee.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),Le(r,{code:Ee.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),Le(r,{code:Ee.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?H6(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),Le(r,{code:Ee.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Le(r,{code:Ee.not_finite,message:i.message}),s.dirty()):Nt.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,He.toString(n))}gt(e,n){return this.setLimit("min",e,!1,He.toString(n))}lte(e,n){return this.setLimit("max",e,!0,He.toString(n))}lt(e,n){return this.setLimit("max",e,!1,He.toString(n))}setLimit(e,n,r,s){return new su({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:He.toString(s)}]})}_addCheck(e){return new su({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:He.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:He.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:He.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:He.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:He.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:He.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:He.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:He.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:He.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"&&Nt.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)}}su.create=t=>new su({checks:[],typeName:at.ZodNumber,coerce:t?.coerce||!1,...ft(t)});class xf extends St{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)!==Fe.bigint)return this._getInvalidInput(e);let r;const s=new as;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),Le(r,{code:Ee.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),Le(r,{code:Ee.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Le(r,{code:Ee.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Nt.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return Le(n,{code:Ee.invalid_type,expected:Fe.bigint,received:n.parsedType}),ot}gte(e,n){return this.setLimit("min",e,!0,He.toString(n))}gt(e,n){return this.setLimit("min",e,!1,He.toString(n))}lte(e,n){return this.setLimit("max",e,!0,He.toString(n))}lt(e,n){return this.setLimit("max",e,!1,He.toString(n))}setLimit(e,n,r,s){return new xf({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:He.toString(s)}]})}_addCheck(e){return new xf({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:He.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:He.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:He.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:He.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:He.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}}xf.create=t=>new xf({checks:[],typeName:at.ZodBigInt,coerce:t?.coerce??!1,...ft(t)});class fx extends St{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Fe.boolean){const r=this._getOrReturnCtx(e);return Le(r,{code:Ee.invalid_type,expected:Fe.boolean,received:r.parsedType}),ot}return As(e.data)}}fx.create=t=>new fx({typeName:at.ZodBoolean,coerce:t?.coerce||!1,...ft(t)});class Zm extends St{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Fe.date){const i=this._getOrReturnCtx(e);return Le(i,{code:Ee.invalid_type,expected:Fe.date,received:i.parsedType}),ot}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return Le(i,{code:Ee.invalid_date}),ot}const r=new as;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),Le(s,{code:Ee.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),Le(s,{code:Ee.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Nt.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Zm({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:He.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:He.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}}Zm.create=t=>new Zm({checks:[],coerce:t?.coerce||!1,typeName:at.ZodDate,...ft(t)});class d_ extends St{_parse(e){if(this._getType(e)!==Fe.symbol){const r=this._getOrReturnCtx(e);return Le(r,{code:Ee.invalid_type,expected:Fe.symbol,received:r.parsedType}),ot}return As(e.data)}}d_.create=t=>new d_({typeName:at.ZodSymbol,...ft(t)});class f_ extends St{_parse(e){if(this._getType(e)!==Fe.undefined){const r=this._getOrReturnCtx(e);return Le(r,{code:Ee.invalid_type,expected:Fe.undefined,received:r.parsedType}),ot}return As(e.data)}}f_.create=t=>new f_({typeName:at.ZodUndefined,...ft(t)});class h_ extends St{_parse(e){if(this._getType(e)!==Fe.null){const r=this._getOrReturnCtx(e);return Le(r,{code:Ee.invalid_type,expected:Fe.null,received:r.parsedType}),ot}return As(e.data)}}h_.create=t=>new h_({typeName:at.ZodNull,...ft(t)});class p_ extends St{constructor(){super(...arguments),this._any=!0}_parse(e){return As(e.data)}}p_.create=t=>new p_({typeName:at.ZodAny,...ft(t)});class m_ extends St{constructor(){super(...arguments),this._unknown=!0}_parse(e){return As(e.data)}}m_.create=t=>new m_({typeName:at.ZodUnknown,...ft(t)});class Ca extends St{_parse(e){const n=this._getOrReturnCtx(e);return Le(n,{code:Ee.invalid_type,expected:Fe.never,received:n.parsedType}),ot}}Ca.create=t=>new Ca({typeName:at.ZodNever,...ft(t)});class g_ extends St{_parse(e){if(this._getType(e)!==Fe.undefined){const r=this._getOrReturnCtx(e);return Le(r,{code:Ee.invalid_type,expected:Fe.void,received:r.parsedType}),ot}return As(e.data)}}g_.create=t=>new g_({typeName:at.ZodVoid,...ft(t)});class gi extends St{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==Fe.array)return Le(n,{code:Ee.invalid_type,expected:Fe.array,received:n.parsedType}),ot;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,l=n.data.length<s.exactLength.value;(o||l)&&(Le(n,{code:o?Ee.too_big:Ee.too_small,minimum:l?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(Le(n,{code:Ee.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(Le(n,{code:Ee.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,l)=>s.type._parseAsync(new ka(n,o,n.path,l)))).then(o=>as.mergeArray(r,o));const i=[...n.data].map((o,l)=>s.type._parseSync(new ka(n,o,n.path,l)));return as.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new gi({...this._def,minLength:{value:e,message:He.toString(n)}})}max(e,n){return new gi({...this._def,maxLength:{value:e,message:He.toString(n)}})}length(e,n){return new gi({...this._def,exactLength:{value:e,message:He.toString(n)}})}nonempty(e){return this.min(1,e)}}gi.create=(t,e)=>new gi({type:t,minLength:null,maxLength:null,exactLength:null,typeName:at.ZodArray,...ft(e)});function Fc(t){if(t instanceof An){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=ma.create(Fc(r))}return new An({...t._def,shape:()=>e})}else return t instanceof gi?new gi({...t._def,type:Fc(t.element)}):t instanceof ma?ma.create(Fc(t.unwrap())):t instanceof au?au.create(Fc(t.unwrap())):t instanceof _l?_l.create(t.items.map(e=>Fc(e))):t}class An extends St{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=Nt.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Fe.object){const d=this._getOrReturnCtx(e);return Le(d,{code:Ee.invalid_type,expected:Fe.object,received:d.parsedType}),ot}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof Ca&&this._def.unknownKeys==="strip"))for(const d in s.data)o.includes(d)||l.push(d);const u=[];for(const d of o){const h=i[d],m=s.data[d];u.push({key:{status:"valid",value:d},value:h._parse(new ka(s,m,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof Ca){const d=this._def.unknownKeys;if(d==="passthrough")for(const h of l)u.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(d==="strict")l.length>0&&(Le(s,{code:Ee.unrecognized_keys,keys:l}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const h of l){const m=s.data[h];u.push({key:{status:"valid",value:h},value:d._parse(new ka(s,m,s.path,h)),alwaysSet:h in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const h of u){const m=await h.key,y=await h.value;d.push({key:m,value:y,alwaysSet:h.alwaysSet})}return d}).then(d=>as.mergeObjectSync(r,d)):as.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(e){return He.errToObj,new An({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{const s=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:He.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new An({...this._def,unknownKeys:"strip"})}passthrough(){return new An({...this._def,unknownKeys:"passthrough"})}extend(e){return new An({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new An({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:at.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new An({...this._def,catchall:e})}pick(e){const n={};for(const r of Nt.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new An({...this._def,shape:()=>n})}omit(e){const n={};for(const r of Nt.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new An({...this._def,shape:()=>n})}deepPartial(){return Fc(this)}partial(e){const n={};for(const r of Nt.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new An({...this._def,shape:()=>n})}required(e){const n={};for(const r of Nt.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof ma;)i=i._def.innerType;n[r]=i}return new An({...this._def,shape:()=>n})}keyof(){return jD(Nt.objectKeys(this.shape))}}An.create=(t,e)=>new An({shape:()=>t,unknownKeys:"strip",catchall:Ca.create(),typeName:at.ZodObject,...ft(e)});An.strictCreate=(t,e)=>new An({shape:()=>t,unknownKeys:"strict",catchall:Ca.create(),typeName:at.ZodObject,...ft(e)});An.lazycreate=(t,e)=>new An({shape:t,unknownKeys:"strip",catchall:Ca.create(),typeName:at.ZodObject,...ft(e)});class Xm extends St{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(const l of i)if(l.result.status==="valid")return l.result;for(const l of i)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const o=i.map(l=>new go(l.ctx.common.issues));return Le(n,{code:Ee.invalid_union,unionErrors:o}),ot}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const u of r){const d={...n,common:{...n.common,issues:[]},parent:null},h=u._parseSync({data:n.data,path:n.path,parent:d});if(h.status==="valid")return h;h.status==="dirty"&&!i&&(i={result:h,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const l=o.map(u=>new go(u));return Le(n,{code:Ee.invalid_union,unionErrors:l}),ot}}get options(){return this._def.options}}Xm.create=(t,e)=>new Xm({options:t,typeName:at.ZodUnion,...ft(e)});function hx(t,e){const n=Jo(t),r=Jo(e);if(t===e)return{valid:!0,data:t};if(n===Fe.object&&r===Fe.object){const s=Nt.objectKeys(e),i=Nt.objectKeys(t).filter(l=>s.indexOf(l)!==-1),o={...t,...e};for(const l of i){const u=hx(t[l],e[l]);if(!u.valid)return{valid:!1};o[l]=u.data}return{valid:!0,data:o}}else if(n===Fe.array&&r===Fe.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const o=t[i],l=e[i],u=hx(o,l);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return n===Fe.date&&r===Fe.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Jm extends St{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(l_(i)||l_(o))return ot;const l=hx(i.value,o.value);return l.valid?((c_(i)||c_(o))&&n.dirty(),{status:n.value,value:l.data}):(Le(r,{code:Ee.invalid_intersection_types}),ot)};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(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Jm.create=(t,e,n)=>new Jm({left:t,right:e,typeName:at.ZodIntersection,...ft(n)});class _l extends St{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Fe.array)return Le(r,{code:Ee.invalid_type,expected:Fe.array,received:r.parsedType}),ot;if(r.data.length<this._def.items.length)return Le(r,{code:Ee.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ot;!this._def.rest&&r.data.length>this._def.items.length&&(Le(r,{code:Ee.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,l)=>{const u=this._def.items[l]||this._def.rest;return u?u._parse(new ka(r,o,r.path,l)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>as.mergeArray(n,o)):as.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new _l({...this._def,rest:e})}}_l.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new _l({items:t,typeName:at.ZodTuple,rest:null,...ft(e)})};class y_ extends St{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!==Fe.map)return Le(r,{code:Ee.invalid_type,expected:Fe.map,received:r.parsedType}),ot;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([l,u],d)=>({key:s._parse(new ka(r,l,r.path,[d,"key"])),value:i._parse(new ka(r,u,r.path,[d,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const u of o){const d=await u.key,h=await u.value;if(d.status==="aborted"||h.status==="aborted")return ot;(d.status==="dirty"||h.status==="dirty")&&n.dirty(),l.set(d.value,h.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const u of o){const d=u.key,h=u.value;if(d.status==="aborted"||h.status==="aborted")return ot;(d.status==="dirty"||h.status==="dirty")&&n.dirty(),l.set(d.value,h.value)}return{status:n.value,value:l}}}}y_.create=(t,e,n)=>new y_({valueType:e,keyType:t,typeName:at.ZodMap,...ft(n)});class Sf extends St{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Fe.set)return Le(r,{code:Ee.invalid_type,expected:Fe.set,received:r.parsedType}),ot;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(Le(r,{code:Ee.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(Le(r,{code:Ee.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(u){const d=new Set;for(const h of u){if(h.status==="aborted")return ot;h.status==="dirty"&&n.dirty(),d.add(h.value)}return{status:n.value,value:d}}const l=[...r.data.values()].map((u,d)=>i._parse(new ka(r,u,r.path,d)));return r.common.async?Promise.all(l).then(u=>o(u)):o(l)}min(e,n){return new Sf({...this._def,minSize:{value:e,message:He.toString(n)}})}max(e,n){return new Sf({...this._def,maxSize:{value:e,message:He.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Sf.create=(t,e)=>new Sf({valueType:t,minSize:null,maxSize:null,typeName:at.ZodSet,...ft(e)});class b_ extends St{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})}}b_.create=(t,e)=>new b_({getter:t,typeName:at.ZodLazy,...ft(e)});class v_ extends St{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return Le(n,{received:n.data,code:Ee.invalid_literal,expected:this._def.value}),ot}return{status:"valid",value:e.data}}get value(){return this._def.value}}v_.create=(t,e)=>new v_({value:t,typeName:at.ZodLiteral,...ft(e)});function jD(t,e){return new iu({values:t,typeName:at.ZodEnum,...ft(e)})}class iu extends St{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return Le(n,{expected:Nt.joinValues(r),received:n.parsedType,code:Ee.invalid_type}),ot}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 Le(n,{received:n.data,code:Ee.invalid_enum_value,options:r}),ot}return As(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 iu.create(e,{...this._def,...n})}exclude(e,n=this._def){return iu.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}iu.create=jD;class w_ extends St{_parse(e){const n=Nt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Fe.string&&r.parsedType!==Fe.number){const s=Nt.objectValues(n);return Le(r,{expected:Nt.joinValues(s),received:r.parsedType,code:Ee.invalid_type}),ot}if(this._cache||(this._cache=new Set(Nt.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=Nt.objectValues(n);return Le(r,{received:r.data,code:Ee.invalid_enum_value,options:s}),ot}return As(e.data)}get enum(){return this._def.values}}w_.create=(t,e)=>new w_({values:t,typeName:at.ZodNativeEnum,...ft(e)});class Qm extends St{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Fe.promise&&n.common.async===!1)return Le(n,{code:Ee.invalid_type,expected:Fe.promise,received:n.parsedType}),ot;const r=n.parsedType===Fe.promise?n.data:Promise.resolve(n.data);return As(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Qm.create=(t,e)=>new Qm({type:t,typeName:at.ZodPromise,...ft(e)});class ou extends St{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===at.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{Le(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async l=>{if(n.value==="aborted")return ot;const u=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return u.status==="aborted"?ot:u.status==="dirty"||n.value==="dirty"?Pd(u.value):u});{if(n.value==="aborted")return ot;const l=this._def.schema._parseSync({data:o,path:r.path,parent:r});return l.status==="aborted"?ot:l.status==="dirty"||n.value==="dirty"?Pd(l.value):l}}if(s.type==="refinement"){const o=l=>{const u=s.refinement(l,i);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"?ot:(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"?ot:(l.status==="dirty"&&n.dirty(),o(l.value).then(()=>({status:n.value,value:l.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ru(o))return ot;const l=s.transform(o.value,i);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=>ru(o)?Promise.resolve(s.transform(o.value,i)).then(l=>({status:n.value,value:l})):ot);Nt.assertNever(s)}}ou.create=(t,e,n)=>new ou({schema:t,typeName:at.ZodEffects,effect:e,...ft(n)});ou.createWithPreprocess=(t,e,n)=>new ou({schema:e,effect:{type:"preprocess",transform:t},typeName:at.ZodEffects,...ft(n)});class ma extends St{_parse(e){return this._getType(e)===Fe.undefined?As(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ma.create=(t,e)=>new ma({innerType:t,typeName:at.ZodOptional,...ft(e)});class au extends St{_parse(e){return this._getType(e)===Fe.null?As(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}au.create=(t,e)=>new au({innerType:t,typeName:at.ZodNullable,...ft(e)});class px extends St{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===Fe.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}px.create=(t,e)=>new px({innerType:t,typeName:at.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ft(e)});class mx extends St{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Km(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new go(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new go(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}mx.create=(t,e)=>new mx({innerType:t,typeName:at.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ft(e)});class x_ extends St{_parse(e){if(this._getType(e)!==Fe.nan){const r=this._getOrReturnCtx(e);return Le(r,{code:Ee.invalid_type,expected:Fe.nan,received:r.parsedType}),ot}return{status:"valid",value:e.data}}}x_.create=t=>new x_({typeName:at.ZodNaN,...ft(t)});class U6 extends St{_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 dk extends St{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ot:i.status==="dirty"?(n.dirty(),Pd(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ot:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new dk({in:e,out:n,typeName:at.ZodPipeline})}}class gx extends St{_parse(e){const n=this._def.innerType._parse(e),r=s=>(ru(s)&&(s.value=Object.freeze(s.value)),s);return Km(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}gx.create=(t,e)=>new gx({innerType:t,typeName:at.ZodReadonly,...ft(e)});var at;(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"})(at||(at={}));const S_=ca.create,W6=su.create,q6=fx.create;Ca.create;const G6=gi.create,Y6=An.create;Xm.create;Jm.create;_l.create;iu.create;Qm.create;ma.create;au.create;function K6(t){const e={};for(const[n,r]of Object.entries(t)){let s;switch(r.type){case"number":s=W6(),r.min!=null&&(s=s.min(r.min)),r.max!=null&&(s=s.max(r.max));break;case"boolean":s=q6();break;case"file[]":case"enum[]":s=G6(S_());break;default:s=S_()}r.required||(s=s.optional()),e[n]=s}return Y6(e)}function py(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim()}function km(t,e){const n=e?.optionLabels?.[t]?.trim();return n||py(t)}function Z6(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function k_(t,e,n){const r=e.label?.trim()||py(t),s=r.replace(new RegExp(`^${Z6(n)}\\s+`,"i"),"");if(/^inventory$/i.test(n)){const i=r.replace(/^stock\s+/i,"").trim();if(i&&i!==r)return i}return/^pricing$/i.test(n)&&/cents/i.test(r)?r.replace(/\s*\(cents\)/i,"").trim()||r:s||r}const X6=/(description|body|content|summary|bio|copy|caption|details)/i;function kf(t,e){if(e?.type==="richtext")return!0;const n=`${t} ${e?.label??""}`;return X6.test(n)}function yx(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 Cf(t){return/^https?:\/\//i.test(t)||t.startsWith("//")}function ga(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 DD(t){if(typeof t=="string"&&Cf(t))return{url:t};if(t&&typeof t=="object"&&"url"in t){const e=t.url,n=t.name;if(typeof e=="string"&&Cf(e))return{url:e,name:typeof n=="string"?n:void 0}}return null}function Cm(t,e){const n=[];for(const[r,s]of Object.entries(t)){if(!ga(r,s))continue;const i=s.label?.trim()||r,o=e?.[r],l=Array.isArray(o)?o:[o];l.forEach((u,d)=>{const h=DD(u);h&&n.push({id:`${r}:${d}`,url:h.url,name:h.name||(l.length>1?`${i} ${d+1}`:i),field:r})})}return n}function Em(t){const e=Array.isArray(t)?t:t==null||t===""?[]:[t],n=[];for(const r of e){const s=DD(r);s&&n.push(s.url)}return n}function J6(t){return t.length>0&&t.every(([,e])=>e.type==="boolean")}function Q6(t,e){const n=`${t} ${e?.label??""}`;return/(stock|inventory|qty|quantity)/i.test(n)}function my(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 ID(t,e){const n=`${t} ${e?.label??""}`;return/(detail|notes|bio|bullets|body|message|html)/i.test(n)}function eW(t,e,n){if(e.type==="boolean"||e.type==="enum[]"||e.type==="richtext"||kf(t,e)||ID(t,e)||n==="record"&&ga(t,e))return"full"}function fk(t){return`show${t.charAt(0).toUpperCase()}${t.slice(1)}`}function tW(t){const e={...t};for(const[n,r]of Object.entries(t)){if(r.type==="boolean"||!my(n,r))continue;const s=fk(n);e[s]||(e[s]={type:"boolean",default:!0,label:`Show ${r.label??py(n)}`})}return e}function nW(t,e){const n={...e};for(const[r,s]of Object.entries(t)){if(s.type==="boolean"||!my(r,s))continue;const i=fk(r);!(i in n)||n[i]==null?n[i]=!0:n[i]=n[i]!==!1}return n}function rW(t){return t.charAt(0).toLowerCase()+t.slice(1)}function sW(t,e){const n=fk(t),r=[n];t==="priceCents"&&r.push("showPrice");for(const s of r)if(e[s]?.type==="boolean")return s;return my(t,e[t])?n:null}const bx={Pricing:"showPrice",Inventory:"showStock",Content:"showDescription"};function iW(t){return Object.keys(bx).find(e=>bx[e]===t)}function oW(t,e){if(!/^show[A-Z]/.test(t)||e[t]?.type!=="boolean")return!1;if(iW(t))return!0;const n=rW(t.slice(4));return e[n]?!0:t==="showPrice"&&!!e.priceCents}function hk(t,e){const n=bx[t];return n&&e[n]?.type==="boolean"?n:null}function aW(t,e,n){const r=sW(t,e);return!r||n&&hk(n,e)===r?null:r}const C_=["Details","Content","Specs","Pricing","Inventory","Media","Display","Status"];function lW(t,e){if(e.group?.trim())return e.group.trim();const r=(e.label?.trim()||py(t)).split(/\s+/).filter(Boolean);return r.length>=2?r[0]:"General"}function cW(t,e){if(e.group?.trim())return e.group.trim();const n=t.toLowerCase(),r=(e.label??"").toLowerCase(),s=`${n} ${r}`;return/(image|img|photo|avatar|thumbnail|thumb|cover|media_url)/i.test(s)?"Media":/(price|cost|cents|amount|msrp)/i.test(s)?"Pricing":/(stock|inventory|qty|quantity)/i.test(s)?"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(s)?"Content":my(t,e)?"Specs":"Details"}function uW(t,e){if(e!=="record")return t;const n=r=>{const s=C_.indexOf(r);return s===-1?C_.length+1:s};return[...t].sort((r,s)=>n(r.id)-n(s.id))}function dW(t,e){const n=[],r=new Map,s=new Set;for(const o of Object.entries(t)){const[l,u]=o;if(oW(l,t))continue;const d=e==="record"?cW(l,u):lW(l,u);u.group?.trim()&&s.add(d),r.has(d)||(r.set(d,[]),n.push(d)),r.get(d).push(o)}if(e==="config")for(const[o,l]of[...r.entries()]){if(l.length>1||s.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 i=n.filter(o=>r.has(o)).map(o=>({id:o,label:o,fields:r.get(o)}));return uW(i,e)}function eg(t){const e=Array.isArray(t)?t:[t];for(const n of e){if(typeof n=="string"&&Cf(n))return n;if(n&&typeof n=="object"&&"url"in n){const r=n.url;if(typeof r=="string"&&Cf(r))return r}}return null}function fW(t,e){for(const[n,r]of Object.entries(t))if(ga(n,r)&&eg(e?.[n]))return n;for(const[n,r]of Object.entries(t))if(ga(n,r))return n;return null}function hW(t){return t.join(",")}function ku({meta:t,disabled:e,multiple:n=!1,label:r,showOptimizeHint:s=!0,onUpload:i}){const o=C.useRef(null),[l,u]=C.useState(!1),[d,h]=C.useState(null),[m,y]=C.useState(!1),b=async v=>{if(!v||e||l)return;const x=Array.from(v);if(x.length){u(!0),h(null);try{await i(n?x:x.slice(0,1))}catch(k){h(k instanceof Error?k.message:"Upload failed")}finally{u(!1),o.current&&(o.current.value="")}}};return p.jsxs("div",{className:"vertebr-upload",children:[p.jsxs("div",{className:"vertebr-upload-drop","data-busy":l?"true":void 0,"data-drag":m?"true":void 0,onDragEnter:v=>{v.preventDefault(),y(!0)},onDragOver:v=>{v.preventDefault(),y(!0)},onDragLeave:v=>{v.preventDefault(),y(!1)},onDrop:v=>{v.preventDefault(),y(!1),b(v.dataTransfer.files)},children:[p.jsx("p",{className:"vertebr-upload-copy",children:l?s?"Optimizing…":"Uploading…":r??(n?"Drop images here or browse":"Drop an image here or browse")}),p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:e||l,onClick:()=>o.current?.click(),children:n?"Choose images":"Choose image"}),p.jsx("input",{ref:o,type:"file",accept:hW(t.accept),multiple:n,hidden:!0,onChange:v=>{b(v.target.files)}})]}),s?p.jsx("p",{className:"vertebr-upload-hint",children:"Images are optimized for the storefront"}):null,d?p.jsx("p",{className:"vertebr-upload-error",role:"alert",children:d}):null]})}var Ia=ZO();const pW=KO(Ia);function tg(t){if(t.contentType&&/pdf/i.test(t.contentType))return!0;const e=t.name??"";if(/\.pdf$/i.test(e))return!0;const n=t.url??"";return/\.pdf(?:$|\?)/i.test(n)}function mW(t,e){if(e?.type==="file[]"||e?.type&&e.type!=="string")return!1;const n=`${t} ${e?.label??""}`;return/\bpdf\b|pdfUrl|pdf_url|documentUrl|document_url/i.test(n)?!0:/(policy|legal|terms|privacy|refund|shipping)/i.test(n)&&/(pdf|url|file|attach|document)/i.test(n)}function LD(t,e="document.pdf"){try{const r=new URL(t).pathname.split("/").pop()||e;return decodeURIComponent(r)}catch{return e}}function E_(t,e){return e==="any"?t:e==="document"?t.filter(tg):t.filter(n=>!tg(n))}function pk({recordImages:t=[],galleryUpload:e,onListGallery:n,onUploadGallery:r,onClose:s,onInsert:i,title:o="Choose images",confirmLabel:l="Use",defaultTab:u,assetKind:d="image"}){const h=!!n,m=d==="document",[y,b]=C.useState(()=>u||(!m&&t.length?"record":"gallery")),[v,x]=C.useState([]),[k,E]=C.useState(!1),[M,_]=C.useState(null),[N,T]=C.useState({}),[A,j]=C.useState("");C.useEffect(()=>{const z=X=>{X.key==="Escape"&&s()};window.addEventListener("keydown",z);const J=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",z),document.body.style.overflow=J}},[s]),C.useEffect(()=>{if(!h)return;let z=!1;return E(!0),_(null),n().then(J=>{z||x(E_(J,d))}).catch(J=>{z||_(J instanceof Error?J.message:"Could not load gallery")}).finally(()=>{z||E(!1)}),()=>{z=!0}},[h,n,d]);const P=C.useMemo(()=>m?[]:t.map(z=>({id:`record:${z.id}`,url:z.url,name:z.name,source:"record"})),[t,m]),O=C.useMemo(()=>v.map(z=>({id:`gallery:${z.id}`,url:z.url,name:z.name??z.id,source:"gallery"})),[v]),G=y==="record"?P:O,B=Object.values(N),W=!!(e&&r),K=m?"document":"image",Q=m?"documents":"images",ee=z=>{T(J=>{const X={...J};return X[z.id]?delete X[z.id]:X[z.id]=z,X})},F=()=>{const z=A.trim();if(!z)return;const J={id:`url:${z}`,url:z,name:m?"Document":"Image",source:"url"};T(X=>({...X,[J.id]:J})),j("")},I=m&&e?{...e,accept:e.accept.some(z=>/pdf/i.test(z))?e.accept:[...e.accept,"application/pdf"]}:e;return Ia.createPortal(p.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:s,children:p.jsxs("div",{className:"vertebr-modal",role:"dialog","aria-modal":"true","aria-label":o,onClick:z=>z.stopPropagation(),children:[p.jsxs("header",{className:"vertebr-modal-head",children:[p.jsxs("div",{className:"vertebr-modal-heading",children:[p.jsx("p",{className:"vertebr-modal-eyebrow",children:m?"Documents":"Media"}),p.jsx("h2",{children:o})]}),p.jsx("button",{type:"button",className:"vertebr-btn",onClick:s,children:"Close"})]}),p.jsxs("div",{className:"vertebr-modal-body vertebr-picker-body",children:[!m&&t.length>0&&h?p.jsxs("div",{className:"vertebr-picker-tabs",role:"tablist",children:[p.jsxs("button",{type:"button",role:"tab","aria-selected":y==="record","data-active":y==="record"||void 0,onClick:()=>b("record"),children:["Product photos",p.jsx("span",{children:P.length})]}),p.jsxs("button",{type:"button",role:"tab","aria-selected":y==="gallery","data-active":y==="gallery"||void 0,onClick:()=>b("gallery"),children:["Files",p.jsx("span",{children:k?"…":O.length})]})]}):null,y==="gallery"&&W&&I?p.jsx(ku,{meta:{field:"gallery",accept:I.accept,maxBytes:I.maxBytes},multiple:!0,showOptimizeHint:!m,label:m?"Drop PDFs to add them to Files":"Drop images to add them to Files",onUpload:async z=>{const J=await r(z),X=E_(J,d);x(L=>[...X,...L]),T(L=>{const q={...L};for(const ie of X){const de={id:`gallery:${ie.id}`,url:ie.url,name:ie.name??ie.id,source:"gallery"};q[de.id]=de}return q})}}):null,p.jsxs("label",{className:"vertebr-field",children:[p.jsxs("span",{children:["Or paste a ",m?"PDF":"image"," URL"]}),p.jsxs("div",{className:"vertebr-picker-url",children:[p.jsx("input",{type:"url",value:A,placeholder:"https://",onChange:z=>j(z.target.value),onKeyDown:z=>{z.key==="Enter"&&(z.preventDefault(),F())}}),p.jsx("button",{type:"button",className:"vertebr-btn",disabled:!A.trim(),onClick:F,children:"Add"})]})]}),M?p.jsx("p",{className:"vertebr-status","data-tone":"danger",children:M}):null,k&&y==="gallery"?p.jsx("div",{className:"vertebr-empty",children:"Loading Files…"}):G.length===0?p.jsx("div",{className:"vertebr-empty",children:y==="record"?"No product photos on this record yet.":h?m?"No PDFs in Files yet.":"No images in Files yet.":"No Files library is configured. Paste a URL instead."}):p.jsx("div",{className:"vertebr-picker-grid",children:G.map(z=>{const J=!!N[z.id],X=m||tg(z);return p.jsxs("button",{type:"button",className:"vertebr-picker-tile","data-selected":J||void 0,onClick:()=>ee(z),children:[p.jsx("span",{className:X?"vertebr-picker-thumb vertebr-gallery-thumb-file":"vertebr-picker-thumb",children:X?p.jsx("span",{className:"vertebr-gallery-file-badge",children:"PDF"}):p.jsx("img",{src:z.url,alt:""})}),p.jsx("span",{className:"vertebr-picker-name",children:z.name})]},z.id)})})]}),p.jsxs("footer",{className:"vertebr-picker-foot",children:[p.jsxs("span",{className:"vertebr-picker-count",children:[B.length," selected"]}),p.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",disabled:B.length===0,onClick:()=>i(B),children:[l," ",B.length||"",B.length===1?` ${K}`:` ${Q}`]})]})]})}),document.body)}var gW=Object.defineProperty,mk=(t,e)=>gW(t,"name",{value:e,configurable:!0});function vx(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}mk(vx,"setRef");function PD(...t){return e=>{let n=!1;const r=t.map(s=>{const i=vx(s,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():vx(t[s],null)}}}}mk(PD,"composeRefs");function cn(...t){return C.useCallback(PD(...t),t)}mk(cn,"useComposedRefs");var yW=Object.defineProperty,Qs=(t,e)=>yW(t,"name",{value:e,configurable:!0});function Ea(t){const e=C.forwardRef((n,r)=>{let{children:s,...i}=n,o=null,l=!1;const u=[];wx(s)&&typeof Rp=="function"&&(s=Rp(s._payload)),C.Children.forEach(s,y=>{if(FD(y)){l=!0;const b=y;let v="child"in b.props?b.props.child:b.props.children;wx(v)&&typeof Rp=="function"&&(v=Rp(v._payload)),o=vW(b,v),u.push(o?.props?.children)}else u.push(y)}),o?o=C.cloneElement(o,void 0,u):!l&&C.Children.count(s)===1&&C.isValidElement(s)&&(o=s);const d=o?BD(o):void 0,h=cn(r,d);if(!o){if(s||s===0)throw new Error(l?SW(t):xW(t));return s}const m=zD(i,o.props??{});return o.type!==C.Fragment&&(m.ref=r?h:d),C.cloneElement(o,m)});return e.displayName=`${t}.Slot`,e}Qs(Ea,"createSlot");var $D=Symbol.for("radix.slottable");function bW(t){const e=Qs(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=$D,e}Qs(bW,"createSlottable");var vW=Qs((t,e)=>{if("child"in t.props){const n=t.props.child;return C.isValidElement(n)?C.cloneElement(n,void 0,t.props.children(n.props.children)):null}return C.isValidElement(e)?e:null},"getSlottableElementFromSlottable");function zD(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const u=i(...l);return s(...l),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}Qs(zD,"mergeProps");function BD(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)}Qs(BD,"getElementRef");function FD(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===$D}Qs(FD,"isSlottable");var wW=Symbol.for("react.lazy");function wx(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===wW&&"_payload"in t&&VD(t._payload)}Qs(wx,"isLazyComponent");function VD(t){return typeof t=="object"&&t!==null&&"then"in t}Qs(VD,"isPromiseLike");var xW=Qs(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),SW=Qs(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Rp=Uf[" use ".trim().toString()],kW=Object.defineProperty,CW=(t,e)=>kW(t,"name",{value:e,configurable:!0}),EW=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],zn=EW.reduce((t,e)=>{const n=Ea(`Primitive.${e}`),r=C.forwardRef((s,i)=>{const{asChild:o,...l}=s,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(u,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function HD(t,e){t&&Ia.flushSync(()=>t.dispatchEvent(e))}CW(HD,"dispatchDiscreteCustomEvent");var TW=Object.defineProperty,NW=(t,e)=>TW(t,"name",{value:e,configurable:!0}),MW=C.forwardRef(NW(function(e,n){return p.jsx(zn.label,{...e,ref:n,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}})},"Label")),D0=MW,_W=Object.defineProperty,Cu=(t,e)=>_W(t,"name",{value:e,configurable:!0}),UD=!!(typeof window<"u"&&window.document&&window.document.createElement);function tn(t,e,{checkForDefaultPrevented:n=!0}={}){return Cu(function(s){if(t?.(s),n===!1||!s||!s.defaultPrevented)return e?.(s)},"handleEvent")}Cu(tn,"composeEventHandlers");function AW(t){if(!UD)throw new Error("Cannot access window outside of the DOM");return t?.ownerDocument?.defaultView??window}Cu(AW,"getOwnerWindow");function xx(t){if(!UD)throw new Error("Cannot access document outside of the DOM");return t?.ownerDocument??document}Cu(xx,"getOwnerDocument");function WD(t,e=!1){const{activeElement:n}=xx(t);if(!n?.nodeName)return null;if(qD(n)&&n.contentDocument)return WD(n.contentDocument.body,e);if(e){const r=n.getAttribute("aria-activedescendant");if(r){const s=xx(n).getElementById(r);if(s)return s}}return n}Cu(WD,"getActiveElement");function qD(t){return t.tagName==="IFRAME"}Cu(qD,"isFrame");var RW=Object.defineProperty,Es=(t,e)=>RW(t,"name",{value:e,configurable:!0});function OW(t,e){const n=C.createContext(e);n.displayName=t+"Context";const r=Es(i=>{const{children:o,...l}=i,u=C.useMemo(()=>l,Object.values(l));return p.jsx(n.Provider,{value:u,children:o})},"Provider");r.displayName=t+"Provider";function s(i,o={}){const{optional:l=!1}=o,u=C.useContext(n);if(u)return u;if(e!==void 0)return e;if(!l)throw new Error(`\`${i}\` must be used within \`${t}\``)}return Es(s,"useContext"),[r,s]}Es(OW,"createContext");function Hl(t,e=[]){let n=[];function r(i,o){const l=C.createContext(o);l.displayName=i+"Context";const u=n.length;n=[...n,o];const d=Es(m=>{const{scope:y,children:b,...v}=m,x=y?.[t]?.[u]||l,k=C.useMemo(()=>v,Object.values(v));return p.jsx(x.Provider,{value:k,children:b})},"Provider");d.displayName=i+"Provider";function h(m,y,b={}){const{optional:v=!1}=b,x=y?.[t]?.[u]||l,k=C.useContext(x);if(k)return k;if(o!==void 0)return o;if(!v)throw new Error(`\`${m}\` must be used within \`${i}\``)}return Es(h,"useContext"),[d,h]}Es(r,"createContext");const s=Es(()=>{const i=n.map(o=>C.createContext(o));return Es(function(l){const u=l?.[t]||i;return C.useMemo(()=>({[`__scope${t}`]:{...l,[t]:u}}),[l,u])},"useScope")},"createScope");return s.scopeName=t,[r,GD(s,...e)]}Es(Hl,"createContextScope");function GD(...t){const e=t[0];if(t.length===1)return e;const n=Es(()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return Es(function(i){const o=r.reduce((l,{useScope:u,scopeName:d})=>{const m=u(i)[`__scope${d}`];return{...l,...m}},{});return C.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])},"useComposedScopes")},"createScope");return n.scopeName=e.scopeName,n}Es(GD,"composeContextScopes");var Er=globalThis?.document?C.useLayoutEffect:()=>{},jW=Object.defineProperty,DW=(t,e)=>jW(t,"name",{value:e,configurable:!0}),T_=Uf[" useEffectEvent ".trim().toString()],N_=Uf[" useInsertionEffect ".trim().toString()];function YD(t){if(typeof T_=="function")return T_(t);const e=C.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof N_=="function"?N_(()=>{e.current=t}):Er(()=>{e.current=t}),C.useMemo(()=>((...n)=>e.current?.(...n)),[])}DW(YD,"useEffectEvent");var IW=Object.defineProperty,eh=(t,e)=>IW(t,"name",{value:e,configurable:!0}),LW=Uf[" useInsertionEffect ".trim().toString()]||Er;function Ef({prop:t,defaultProp:e,onChange:n=eh(()=>{},"onChange"),caller:r}){const[s,i,o]=KD({defaultProp:e,onChange:n}),l=t!==void 0,u=l?t:s,d=C.useCallback(h=>{if(l){const m=ZD(h)?h(t):h;m!==t&&o.current?.(m)}else i(h)},[l,t,i,o]);return[u,d]}eh(Ef,"useControllableState");function KD({defaultProp:t,onChange:e}){const[n,r]=C.useState(t),s=C.useRef(n),i=C.useRef(e);return LW(()=>{i.current=e},[e]),C.useEffect(()=>{s.current!==n&&(i.current?.(n),s.current=n)},[n,s]),[n,r,i]}eh(KD,"useUncontrolledState");function ZD(t){return typeof t=="function"}eh(ZD,"isFunction");var M_=Symbol("RADIX:SYNC_STATE");function PW(t,e,n,r){const{prop:s,defaultProp:i,onChange:o,caller:l}=e,u=s!==void 0,d=YD(o),h=[{...n,state:i}];r&&h.push(r);const[m,y]=C.useReducer((k,E)=>{if(E.type===M_)return{...k,state:E.state};const M=t(k,E);return u&&!Object.is(M.state,k.state)&&d(M.state),M},...h),b=m.state,v=C.useRef(b);C.useEffect(()=>{v.current!==b&&(v.current=b,u||d(b))},[b,v,u]);const x=C.useMemo(()=>s!==void 0?{...m,state:s}:m,[m,s]);return C.useEffect(()=>{u&&!Object.is(s,m.state)&&y({type:M_,state:s})},[s,m.state,u]),[x,y]}eh(PW,"useControllableStateReducer");var $W=Object.defineProperty,zW=(t,e)=>$W(t,"name",{value:e,configurable:!0});function gk(t){const[e,n]=C.useState(void 0);return Er(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,l;if("borderBoxSize"in i){const u=i.borderBoxSize,d=Array.isArray(u)?u[0]:u;o=d.inlineSize,l=d.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}zW(gk,"useSize");var BW=Object.defineProperty,Ta=(t,e)=>BW(t,"name",{value:e,configurable:!0}),yk="Switch",[FW,aue]=Hl(yk),[VW,bk]=FW(yk);function XD(t){const{__scopeSwitch:e,checked:n,children:r,defaultChecked:s,disabled:i,form:o,name:l,onCheckedChange:u,required:d,value:h="on",internal_do_not_use_render:m}=t,[y,b]=Ef({prop:n,defaultProp:s??!1,onChange:u,caller:yk}),[v,x]=C.useState(null),[k,E]=C.useState(null),M=C.useRef(!1),[_,N]=C.useReducer(j=>j+1,0),T=v?!!o||!!v.closest("form"):!0,A={checked:y,setChecked:b,disabled:i,control:v,setControl:x,name:l,form:o,value:h,hasConsumerStoppedPropagationRef:M,userInteractionCount:_,onUserInteraction:N,required:d,defaultChecked:s,isFormControl:T,bubbleInput:k,setBubbleInput:E};return p.jsx(VW,{scope:e,...A,children:JD(m)?m(A):r})}Ta(XD,"SwitchProvider");var HW="SwitchTrigger",UW=C.forwardRef(Ta(function({__scopeSwitch:e,onClick:n,...r},s){const{control:i,form:o,value:l,disabled:u,checked:d,required:h,setControl:m,setChecked:y,hasConsumerStoppedPropagationRef:b,onUserInteraction:v,isFormControl:x,bubbleInput:k}=bk(HW,e),E=cn(s,m),M=C.useRef(d);return C.useEffect(()=>{const _=o?i?.ownerDocument.getElementById(o):i?.form;if(_ instanceof HTMLFormElement){const N=Ta(()=>y(M.current),"reset");return _.addEventListener("reset",N),()=>_.removeEventListener("reset",N)}},[i,o,y]),p.jsx(zn.button,{type:"button",role:"switch","aria-checked":d,"aria-required":h,"data-state":vk(d),"data-disabled":u?"":void 0,disabled:u,value:l,...r,ref:E,onClick:tn(n,_=>{v(),y(N=>!N),k&&x&&(b.current=_.isPropagationStopped(),b.current||_.stopPropagation())})})},"SwitchTrigger")),__=C.forwardRef(Ta(function(e,n){const{__scopeSwitch:r,name:s,checked:i,defaultChecked:o,required:l,disabled:u,value:d,onCheckedChange:h,form:m,...y}=e;return p.jsx(XD,{__scopeSwitch:r,checked:i,defaultChecked:o,disabled:u,required:l,onCheckedChange:h,name:s,form:m,value:d,internal_do_not_use_render:({isFormControl:b})=>p.jsxs(p.Fragment,{children:[p.jsx(UW,{...y,ref:n,__scopeSwitch:r}),b&&p.jsx(GW,{__scopeSwitch:r})]})})},"Switch")),WW="SwitchThumb",A_=C.forwardRef(Ta(function(e,n){const{__scopeSwitch:r,...s}=e,i=bk(WW,r);return p.jsx(zn.span,{"data-state":vk(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:n})},"SwitchThumb")),qW="SwitchBubbleInput",GW=C.forwardRef(Ta(function({__scopeSwitch:e,onClick:n,...r},s){const{control:i,hasConsumerStoppedPropagationRef:o,userInteractionCount:l,checked:u,defaultChecked:d,required:h,disabled:m,name:y,value:b,form:v,bubbleInput:x,setBubbleInput:k}=bk(qW,e),E=cn(s,k),M=gk(i),_=C.useRef(!1),N=C.useRef(u),T=C.useRef(l);C.useEffect(()=>{const j=x;if(!j)return;const P=window.HTMLInputElement.prototype,G=Object.getOwnPropertyDescriptor(P,"checked").set,B=l!==T.current;T.current=l;const W=N.current!==u;N.current=u;const K=!(B&&o.current);if(W&&G){_.current=!B;const Q=new Event("click",{bubbles:K});G.call(j,u),j.dispatchEvent(Q),_.current=!1}},[x,u,o,l]);const A=C.useRef(u);return p.jsx(zn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:d??A.current,required:h,disabled:m,name:y,value:b,form:v,...r,tabIndex:-1,ref:E,onClick:tn(n,j=>{_.current&&j.stopPropagation()}),style:{...r.style,...M,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function JD(t){return typeof t=="function"}Ta(JD,"isFunction");function vk(t){return t?"checked":"unchecked"}Ta(vk,"getState");function QD({name:t,label:e,form:n}){const r=n.watch(t)!==!1;return C.useEffect(()=>{n.register(t)},[n,t]),p.jsx(eI,{visible:r,label:e,onChange:s=>n.setValue(t,s,{shouldDirty:!0,shouldTouch:!0})})}function eI({visible:t,label:e,dirty:n,disabled:r,onChange:s}){return p.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:i=>{i.stopPropagation(),s(!t)},children:t?p.jsx(YW,{}):p.jsx(KW,{})})}function YW(){return p.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:[p.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"}),p.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function KW(){return p.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:[p.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"}),p.jsx("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}),p.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"}),p.jsx("path",{d:"m2 2 20 20"})]})}const ZW=/(cents|priceCents|amountCents)/i,R_=/(price|amount|cost|total|msrp)/i;function wk(t,e){return ZW.test(t)||/cents/i.test(e?.label??"")}function tI(t,e){return wk(t,e)?!0:R_.test(t)||R_.test(e?.label??"")}function nI(t,e){return e?t/100:t}function XW(t,e){return e?Math.round(t*100):t}function Sx(t,e){const n=e?.asCents??!0,r=e?.currency??"USD",s=nI(t,n);try{return new Intl.NumberFormat(void 0,{style:"currency",currency:r,minimumFractionDigits:2,maximumFractionDigits:2}).format(s)}catch{return`$${s.toFixed(2)}`}}function I0(t,e=!0){return typeof t!="number"||!Number.isFinite(t)?"":nI(t,e).toFixed(2)}function JW(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 XW(r,e)}function Tm({family:t,bodyWeight:e=400,headingWeight:n=700,compact:r=!1}){const s=`"${t.replace(/"/g,"")}", ui-sans-serif, sans-serif`,i={fontFamily:s,fontWeight:n},o={fontFamily:s,fontWeight:e};return p.jsxs("div",{className:"vertebr-font-preview-sample","data-compact":r?"true":void 0,children:[p.jsx("span",{className:"vertebr-font-preview-eyebrow",style:i,children:"Eyebrow label"}),p.jsx("strong",{className:"vertebr-font-preview-heading",style:i,children:"The quick brown fox"}),p.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:p.jsxs(p.Fragment,{children:[p.jsxs("p",{className:"vertebr-font-preview-alphabet",style:o,children:["ABCDEFGHIJKLMNOPQRSTUVWXYZ",p.jsx("br",{}),"abcdefghijklmnopqrstuvwxyz",p.jsx("br",{}),"0123456789"]}),p.jsxs("div",{className:"vertebr-font-preview-weights",style:o,children:[p.jsx("span",{style:{fontWeight:400},children:"Regular 400"}),p.jsx("span",{style:{fontWeight:600},children:"Semibold 600"}),p.jsx("span",{style:{fontWeight:700},children:"Bold 700"})]})]})]})}function rI({items:t,apiBase:e="/admin/api"}){const n=C.useId().replace(/:/g,""),r=C.useMemo(()=>a5(t,e),[t,e]);return C.useEffect(()=>{const s=r.map(l=>oD(l)).join("");if(!s)return;const i=s.match(/url\("([^"]+)"\)/)?.[1]??null;console.info("[mm:fonts] FontFaceInjector",{items:r.length,cssRules:(s.match(/@font-face/g)??[]).length,apiBase:e,sampleUrl:i,usesFirebase:s.includes("firebasestorage.googleapis.com")});const o=document.createElement("style");return o.id=`vertebr-font-faces-${n}`,o.textContent=s,document.head.appendChild(o),()=>{o.remove()}},[r,n]),null}function Ed(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 QW({id:t,value:e,label:n,description:r,readOnly:s,fonts:i,loading:o,onChange:l,onRefreshFonts:u,fontApiBase:d="/admin/api"}){const[h,m]=C.useState(!1),[y,b]=C.useState(""),v=C.useRef(""),x=typeof e=="string"?e.trim():"";C.useEffect(()=>{h&&u&&u()},[h,u]),C.useEffect(()=>{h&&(v.current=x,b(x))},[h,x]);const k=(T=!1)=>{T&&y!==v.current&&l(v.current),m(!1)},E=T=>{b(T),l(T)},M=C.useMemo(()=>i.find(T=>T.id===x)??null,[i,x]),_=C.useMemo(()=>y===""?null:i.find(T=>T.id===y)??null,[i,y]),N=C.useMemo(()=>{const T=[],A=new Set;for(const j of[M,_])!j||A.has(j.id)||(A.add(j.id),T.push(j));return T},[_,M]);return p.jsxs("div",{className:"vertebr-font-picker",children:[p.jsx(rI,{items:N,apiBase:d}),p.jsxs("div",{className:"vertebr-font-picker-current",children:[p.jsxs("div",{children:[p.jsx("strong",{children:M?.label??"Default system fonts"}),M?p.jsx("span",{children:M.family}):p.jsx("span",{children:"Manrope / Syne until a library font is chosen"})]}),s?p.jsx("span",{id:t,className:"vertebr-font-picker-ro-anchor"}):p.jsx("button",{id:t,type:"button",className:"vertebr-btn",onClick:()=>m(!0),children:"Choose font"})]}),M?p.jsx("div",{className:"vertebr-font-picker-preview",children:p.jsx(Tm,{family:M.family,bodyWeight:Ed(M,"body"),headingWeight:Ed(M,"heading"),compact:!0})}):null,h?p.jsx("div",{className:"vertebr-font-picker-modal-backdrop",onClick:()=>k(!0),children:p.jsxs("div",{className:"vertebr-font-picker-modal",role:"dialog","aria-labelledby":`${t}-font-picker-title`,onClick:T=>T.stopPropagation(),children:[p.jsxs("div",{className:"vertebr-font-picker-modal-head",children:[p.jsxs("div",{children:[p.jsx("h3",{id:`${t}-font-picker-title`,children:n??"Choose a font"}),r?p.jsx("p",{children:r}):null]}),p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>k(!0),children:"Close"})]}),o?p.jsx("div",{className:"vertebr-empty",children:"Loading fonts…"}):i.length===0?p.jsx("div",{className:"vertebr-empty",children:"No fonts in the library yet. Open Font Library to upload or add Google Fonts."}):p.jsxs("div",{className:"vertebr-font-picker-modal-body",children:[p.jsx("div",{className:"vertebr-font-picker-grid-scroll",children:p.jsxs("div",{className:"vertebr-font-picker-grid",children:[p.jsxs("button",{type:"button",className:"vertebr-font-picker-option","data-active":y===""||void 0,onClick:()=>E(""),children:[p.jsx("strong",{children:"Default"}),p.jsx("span",{children:"Manrope / Syne"})]}),i.map(T=>p.jsxs("button",{type:"button",className:"vertebr-font-picker-option","data-active":T.id===y||void 0,style:{fontFamily:`"${T.family}", ui-sans-serif, sans-serif`,fontWeight:Ed(T,"heading")},onClick:()=>E(T.id),children:[p.jsx("strong",{children:T.label}),p.jsx("span",{children:T.family}),p.jsx("em",{children:"The quick brown fox"})]},T.id))]})}),p.jsxs("aside",{className:"vertebr-font-picker-detail",children:[p.jsx("p",{className:"vertebr-font-picker-detail-label",children:"Preview"}),y===""?p.jsx(Tm,{family:"Manrope",bodyWeight:400,headingWeight:700}):_?p.jsx(Tm,{family:_.family,bodyWeight:Ed(_,"body"),headingWeight:Ed(_,"heading")}):p.jsx("div",{className:"vertebr-empty",children:"Select a font to preview."})]})]}),p.jsxs("div",{className:"vertebr-font-picker-modal-actions",children:[p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>k(!0),children:"Cancel"}),p.jsx("button",{type:"button",className:"vertebr-btn",disabled:o,onClick:()=>k(!1),children:"Done"})]})]})}):null]})}var L0={exports:{}},P0={};var O_;function eq(){if(O_)return P0;O_=1;var t=Hf();function e(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,s=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function l(m,y){var b=y(),v=r({inst:{value:b,getSnapshot:y}}),x=v[0].inst,k=v[1];return i(function(){x.value=b,x.getSnapshot=y,u(x)&&k({inst:x})},[m,b,y]),s(function(){return u(x)&&k({inst:x}),m(function(){u(x)&&k({inst:x})})},[m]),o(b),b}function u(m){var y=m.getSnapshot;m=m.value;try{var b=y();return!n(m,b)}catch{return!0}}function d(m,y){return y()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:l;return P0.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:h,P0}var j_;function sI(){return j_||(j_=1,L0.exports=eq()),L0.exports}var iI=sI();function nr(t){this.content=t}nr.prototype={constructor:nr,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,s=r.find(t),i=r.content.slice();return s==-1?i.push(n||t,e):(i[s+1]=e,n&&(i[s]=n)),new nr(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new nr(n)},addToStart:function(t,e){return new nr([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new nr(n)},addBefore:function(t,e,n){var r=this.remove(e),s=r.content.slice(),i=r.find(t);return s.splice(i==-1?s.length:i,0,e,n),new nr(s)},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=nr.from(t),t.size?new nr(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=nr.from(t),t.size?new nr(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=nr.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}};nr.from=function(t){if(t instanceof nr)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new nr(e)};function oI(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),i=e.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){let o=s.text,l=i.text,u=0;for(;o[u]==l[u];u++)n++;return u&&u<o.length&&u<l.length&&cI(o.charCodeAt(u-1))&&lI(o.charCodeAt(u))&&n--,n}if(s.content.size||i.content.size){let o=oI(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function aI(t,e,n,r){for(let s=t.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=t.child(--s),l=e.child(--i),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 d=o.text,h=l.text,m=d.length,y=h.length;for(;m>0&&y>0&&d[m-1]==h[y-1];)m--,y--,n--,r--;return m&&y&&m<d.length&&cI(d.charCodeAt(m-1))&&lI(d.charCodeAt(m))&&(n++,r++),{a:n,b:r}}if(o.content.size||l.content.size){let d=aI(o.content,l.content,n-1,r-1);if(d)return d}n-=u,r-=u}}function lI(t){return t>=56320&&t<57344}function cI(t){return t>=55296&&t<56320}class ge{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,s=0,i){for(let o=0,l=0;l<n;o++){let u=this.content[o],d=l+u.nodeSize;if(d>e&&r(u,s+l,i||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,s+h)}l=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let i="",o=!0;return this.nodesBetween(e,n,(l,u)=>{let d=l.isText?l.text.slice(Math.max(e,u)-u,n-u):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&d||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=d},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new ge(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let i=0,o=0;o<n;i++){let l=this.content[i],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),s+=l.nodeSize),o=u}return new ge(r,s)}cutByIndex(e,n){return e==n?ge.empty:e==0&&n==this.content.length?this:new ge(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new ge(s,i)}addToStart(e){return new ge([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ge(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 s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return oI(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return aI(this,e,n,r)}findIndex(e){if(e==0)return Op(0,e);if(e==this.size)return Op(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 s=this.child(n),i=r+s.nodeSize;if(i>=e)return i==e?Op(n+1,i):Op(n,r);r=i}}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 ge.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return ge.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ge.empty;let n,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(n||(n=e.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new ge(n||e,r)}static from(e){if(!e)return ge.empty;if(e instanceof ge)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ge([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}ge.empty=new ge([],0);const $0={index:0,offset:0};function Op(t,e){return $0.index=t,$0.offset=e,$0}function ng(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(!ng(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!ng(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Wt=class kx{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(i)}}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&&ng(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 s=r.create(n.attrs);return r.checkAttrs(s.attrs),s}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 kx.none;if(e instanceof kx)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};Wt.none=[];class Tf extends Error{}class Oe{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=dI(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new Oe(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Oe(uI(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 Oe.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Oe(ge.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new Oe(e,r,s)}}Oe.empty=new Oe(ge.empty,0,0);function uI(t,e,n){let{index:r,offset:s}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:l}=t.findIndex(n);if(s==e||i.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,i.copy(uI(i.content,e-s-1,n-s-1)))}function dI(t,e,n,r,s,i){let{index:o,offset:l}=t.findIndex(e),u=t.maybeChild(o);if(l==e||u.isText)return i&&r<=0&&s<=0&&!i.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let d=dI(u.content,e-l-1,n,o==0?r-1:0,o==t.childCount-1?s-1:0,u);return d&&t.replaceChild(o,u.copy(d))}function tq(t,e,n){if(n.openStart>t.depth)throw new Tf("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Tf("Inconsistent open depths");return fI(t,e,n,0)}function fI(t,e,n,r){let s=t.index(r),i=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let o=fI(t,e,n,r+1);return i.copy(i.content.replaceChild(s,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 kl(o,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=nq(n,t);return kl(i,pI(t,o,l,e,r))}else return kl(i,rg(t,e,r))}function hI(t,e){if(!e.type.compatibleContent(t.type))throw new Tf("Cannot join "+e.type.name+" onto "+t.type.name)}function Cx(t,e,n){let r=t.node(n);return hI(r,e.node(n)),r}function Sl(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 Jd(t,e,n,r){let s=(e||t).node(n),i=0,o=e?e.index(n):s.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Sl(t.nodeAfter,r),i++));for(let l=i;l<o;l++)Sl(s.child(l),r);e&&e.depth==n&&e.textOffset&&Sl(e.nodeBefore,r)}function kl(t,e){if(!t.type.validContent(e))throw new Tf("Invalid content for node "+t.type.name);return t.copy(e)}function pI(t,e,n,r,s){let i=t.depth>s&&Cx(t,e,s+1),o=r.depth>s&&Cx(n,r,s+1),l=[];return Jd(null,t,s,l),i&&o&&e.index(s)==n.index(s)?(hI(i,o),Sl(kl(i,pI(t,e,n,r,s+1)),l)):(i&&Sl(kl(i,rg(t,e,s+1)),l),Jd(e,n,s,l),o&&Sl(kl(o,rg(n,r,s+1)),l)),Jd(r,null,s,l),new ge(l)}function rg(t,e,n){let r=[];if(Jd(null,t,n,r),t.depth>n){let s=Cx(t,e,n+1);Sl(kl(s,rg(t,e,n+1)),r)}return Jd(e,null,n,r),new ge(r)}function nq(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)s=e.node(i).copy(ge.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class Nf{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],s=e.child(n);return r?e.child(n).cut(r):s}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],s=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Wt.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),s=e.maybeChild(n);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].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 sg(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=[],s=0,i=n;for(let o=e;;){let{index:l,offset:u}=o.content.findIndex(i),d=i-u;if(r.push(o,l,s+u),!d||(o=o.child(l),o.isText))break;i=d-1,s+=u+1}return new Nf(n,r,i)}static resolveCached(e,n){let r=D_.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==n)return o}else D_.set(e,r=new rq);let s=r.elts[r.i]=Nf.resolve(e,n);return r.i=(r.i+1)%sq,s}}class rq{constructor(){this.elts=[],this.i=0}}const sq=12,D_=new WeakMap;class sg{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 iq=Object.create(null);let ya=class Ex{constructor(e,n,r,s=Wt.none){this.type=e,this.attrs=n,this.marks=s,this.content=r||ge.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,s=0){this.content.nodesBetween(e,n,r,s,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,s){return this.content.textBetween(e,n,r,s)}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&&ng(this.attrs,n||e.defaultAttrs||iq)&&Wt.sameSet(this.marks,r||Wt.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 Oe.empty;let s=this.resolve(e),i=this.resolve(n),o=r?0:s.sharedDepth(n),l=s.start(o),d=s.node(o).content.cut(s.pos-l,i.pos-l);return new Oe(d,s.depth-o,i.depth-o)}replace(e,n,r){return tq(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(s==e||n.isText)return n;e-=s+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 s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(e){return Nf.resolveCached(this,e)}resolveNoCache(e){return Nf.resolve(this,e)}rangeHasMark(e,n,r){let s=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}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()+")"),mI(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=ge.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let u=s;u<i;u++)if(!this.type.allowsMarks(r.child(u).marks))return!1;return!0}canReplaceWith(e,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.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=Wt.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(!Wt.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 s=ge.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,s,r);return i.type.checkAttrs(i.attrs),i}};ya.prototype.text=void 0;class ig extends ya{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):mI(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 ig(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ig(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 mI(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Al{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new oq(e,n);if(r.next==null)return Al.empty;let s=gI(r);r.next&&r.err("Unexpected trailing text");let i=hq(fq(s));return pq(i,r),i}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 s=this;for(let i=n;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}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 s=[this];function i(o,l){let u=o.matchFragment(e,r);if(u&&(!n||u.validEnd))return ge.from(l.map(d=>d.createAndFill()));for(let d=0;d<o.next.length;d++){let{type:h,next:m}=o.next[d];if(!(h.isText||h.hasRequiredAttrs())&&s.indexOf(m)==-1){s.push(m);let y=i(m,l.concat(h));if(y)return y}}return null}return i(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 s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:u}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!s.type||u.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),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 s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
65
+ `)}}Al.empty=new Al(!0);class oq{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 gI(t){let e=[];do e.push(aq(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function aq(t){let e=[];do e.push(lq(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function lq(t){let e=dq(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=cq(t,e);else break;return e}function I_(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function cq(t,e){let n=I_(t),r=n;return t.eat(",")&&(t.next!="}"?r=I_(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function uq(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let i in n){let o=n[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function dq(t){if(t.eat("(")){let e=gI(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=uq(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 fq(t){let e=[[]];return s(i(t,0),n()),e;function n(){return e.push([])-1}function r(o,l,u){let d={term:u,to:l};return e[o].push(d),d}function s(o,l){o.forEach(u=>u.to=l)}function i(o,l){if(o.type=="choice")return o.exprs.reduce((u,d)=>u.concat(i(d,l)),[]);if(o.type=="seq")for(let u=0;;u++){let d=i(o.exprs[u],l);if(u==o.exprs.length-1)return d;s(d,l=n())}else if(o.type=="star"){let u=n();return r(l,u),s(i(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return s(i(o.expr,l),u),s(i(o.expr,u),u),[r(u)]}else{if(o.type=="opt")return[r(l)].concat(i(o.expr,l));if(o.type=="range"){let u=l;for(let d=0;d<o.min;d++){let h=n();s(i(o.expr,u),h),u=h}if(o.max==-1)s(i(o.expr,u),u);else for(let d=o.min;d<o.max;d++){let h=n();r(u,h),s(i(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 yI(t,e){return e-t}function L_(t,e){let n=[];return r(e),n.sort(yI);function r(s){let i=t[s];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(s);for(let o=0;o<i.length;o++){let{term:l,to:u}=i[o];!l&&n.indexOf(u)==-1&&r(u)}}}function hq(t){let e=Object.create(null);return n(L_(t,0));function n(r){let s=[];r.forEach(o=>{t[o].forEach(({term:l,to:u})=>{if(!l)return;let d;for(let h=0;h<s.length;h++)s[h][0]==l&&(d=s[h][1]);L_(t,u).forEach(h=>{d||s.push([l,d=[]]),d.indexOf(h)==-1&&d.push(h)})})});let i=e[r.join(",")]=new Al(r.indexOf(t.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(yI);i.next.push({type:s[o][0],next:e[l.join(",")]||n(l)})}return i}}function pq(t,e){for(let n=0,r=[t];n<r.length;n++){let s=r[n],i=!s.validEnd,o=[];for(let l=0;l<s.next.length;l++){let{type:u,next:d}=s.next[l];o.push(u.name),i&&!(u.isText||u.hasRequiredAttrs())&&(i=!1),r.indexOf(d)==-1&&r.push(d)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function bI(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 vI(t,e){let n=Object.create(null);for(let r in t){let s=e&&e[r];if(s===void 0){let i=t[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=s}return n}function wI(t,e,n,r){for(let s in e)if(!(s in t))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${r}`);for(let s in t)t[s].validate&&t[s].validate(e[s])}function xI(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new gq(t,r,e[r]);return n}let P_=class SI{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=xI(e,r.attrs),this.defaultAttrs=bI(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==Al.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:vI(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ya(this,this.computeAttrs(e),ge.from(n),Wt.setFrom(r))}createChecked(e=null,n,r){return n=ge.from(n),this.checkContent(n),new ya(this,this.computeAttrs(e),n,Wt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=ge.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),i=s&&s.fillBefore(ge.empty,!0);return i?new ya(this,e,n.append(i),Wt.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){wI(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:Wt.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,o)=>r[i]=new SI(i,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function mq(t,e,n){let r=n.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class gq{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?mq(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class gy{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=xI(e,s.attrs),this.excluded=null;let i=bI(this.attrs);this.instance=i?new Wt(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Wt(this,vI(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new gy(i,s++,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){wI(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class kI{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=nr.from(e.nodes),n.marks=nr.from(e.marks||{}),this.nodes=P_.compile(this.spec.nodes,this),this.marks=gy.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=Al.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?$_(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:$_(this,o.split(" "))}this.nodeFromJSON=s=>ya.fromJSON(this,s),this.markFromJSON=s=>Wt.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof P_){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,s)}text(e,n){let r=this.nodes.text;return new ig(r,r.defaultAttrs,e,Wt.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 $_(t,e){let n=[];for(let r=0;r<e.length;r++){let s=e[r],i=t.marks[s],o=i;if(i)n.push(i);else for(let l in t.marks){let u=t.marks[l];(s=="_"||u.spec.group&&u.spec.group.split(" ").indexOf(s)>-1)&&n.push(o=u)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function yq(t){return t.tag!=null}function bq(t){return t.style!=null}class lo{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(yq(s))this.tags.push(s);else if(bq(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new B_(this,n,!1);return r.addAll(e,Wt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new B_(this,n,!0);return r.addAll(e,Wt.none,n.from,n.to),Oe.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(xq(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,n,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],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(s){let i=s.priority==null?50:s.priority,o=0;for(;o<n.length;o++){let l=n[o];if((l.priority==null?50:l.priority)<i)break}n.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=F_(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=F_(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new lo(e,lo.schemaRules(e)))}}const CI={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},vq={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},EI={ol:!0,ul:!0},Mf=1,Tx=2,Qd=4;function z_(t,e,n){return e!=null?(e?Mf:0)|(e==="full"?Tx:0):t&&t.whitespace=="pre"?Mf|Tx:n&~Qd}class jp{constructor(e,n,r,s,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=Wt.none,this.match=i||(o&Qd?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ge.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Mf)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let n=ge.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ge.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&&!CI.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class B_{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,i,o=z_(null,n.preserveWhitespace,0)|(r?Qd:0);s?i=new jp(s.type,s.attrs,Wt.none,!0,n.topMatch||s.type.contentMatch,o):r?i=new jp(null,null,Wt.none,!0,null,o):i=new jp(e.schema.topNodeType,null,Wt.none,!0,null,o),this.nodes=[i],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,s=this.top,i=s.options&Tx?"full":this.localPreserveWS||(s.options&Mf)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="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=s.content[s.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 s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;EI.hasOwnProperty(o)&&this.parser.normalizeLists&&wq(e);let u=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(u?u.ignore:vq.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 d,h=this.needsBlock;if(CI.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),d=!0,i.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),d&&this.sync(i),this.needsBlock=h}else{let d=this.readStyles(e,n);d&&this.addElementByRule(e,u,d,u.consuming===!1?l:void 0)}this.localPreserveWS=s}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 s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let u=this.parser.matchStyle(i,o,this,l);if(!u)break;if(u.ignore)return null;if(u.clearMark?n=n.filter(d=>!u.clearMark(d)):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,s){let i,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&&(i=!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(s)this.addElement(e,r,s);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)}i&&this.sync(l)&&this.open--}addAll(e,n,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let u=this.nodes[o],d=u.findWrapping(e);if(d&&(!s||s.length>d.length+l)&&(s=d,i=u,!d.length))break;if(u.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)n=this.enterInner(s[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let s=this.findPlace(e,n,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=Wt.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):V_(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,n,r,s){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,s)),i}enterInner(e,n,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=z_(e,i,o.options);o.options&Qd&&o.content.length==0&&(l|=Qd);let u=Wt.none;return r=r.filter(d=>(o.type?o.type.allowsMarkType(d.type):V_(d.type,e))?(u=d.addToSet(u),!1):!0),this.nodes.push(new jp(e,n,u,s,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|=Mf)}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 s=r.length-1;s>=0;s--)e+=r[s].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 s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].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,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,u)=>{for(;l>=0;l--){let d=n[l];if(d==""){if(l==n.length-1||l==0)continue;for(;u>=i;u--)if(o(l-1,u))return!0;return!1}else{let h=u>0||u==0&&s?this.nodes[u].type:r&&u>=i?r.node(u-i).type:null;if(!h||h.name!=d&&!h.isInGroup(d))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 wq(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&EI.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function xq(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function F_(t){let e={};for(let n in t)e[n]=t[n];return e}function V_(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let i=[],o=l=>{i.push(l);for(let u=0;u<l.edgeCount;u++){let{type:d,next:h}=l.edge(u);if(d==e||i.indexOf(h)<0&&o(h))return!0}};if(o(s.contentMatch))return!0}}class Ul{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Dp(n).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,u=0;for(;l<i.length&&u<o.marks.length;){let d=o.marks[u];if(!this.marks[d.type.name]){u++;continue}if(!d.eq(i[l][0])||d.type.spec.spanning===!1)break;l++,u++}for(;l<i.length;)s=i.pop()[1];for(;u<o.marks.length;){let d=o.marks[u++],h=this.serializeMark(d,o.isInline,n);h&&(i.push([d,s]),s.appendChild(h.dom),s=h.contentDOM||h.dom)}}s.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){if(e.isText)return Dp(n).createTextNode(e.text);let{dom:r,contentDOM:s}=Nm(Dp(n),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,s)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&Nm(Dp(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return typeof n=="string"?{dom:e.createTextNode(n)}:Nm(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ul(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=H_(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return H_(e.marks)}}function H_(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Dp(t){return t.document||window.document}const U_=new WeakMap;function Sq(t){let e=U_.get(t);return e===void 0&&U_.set(t,e=kq(t)),e}function kq(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 s=0;s<r.length;s++)n(r[s]);else for(let s in r)n(r[s])}return n(t),e}function Nm(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Sq(r))&&i.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=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let l,u=n?t.createElementNS(n,s):t.createElement(s),d=e[1],h=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){h=2;for(let m in d)if(d[m]!=null){let y=m.indexOf(" ");y>0?u.setAttributeNS(m.slice(0,y),m.slice(y+1),d[m]):m=="style"&&u.style?u.style.cssText=d[m]:u.setAttribute(m,d[m])}}for(let m=h;m<e.length;m++){let y=e[m];if(y===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 y=="string")u.appendChild(t.createTextNode(y));else{let{dom:b,contentDOM:v}=Nm(t,y,n,r);if(u.appendChild(b),v){if(l)throw new RangeError("Multiple content holes");l=v}}}return{dom:u,contentDOM:l}}const TI=65535,NI=Math.pow(2,16);function Cq(t,e){return t+e*NI}function W_(t){return t&TI}function Eq(t){return(t-(t&TI))/NI}const MI=1,_I=2,Mm=4,AI=8;class Nx{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&AI)>0}get deletedBefore(){return(this.delInfo&(MI|Mm))>0}get deletedAfter(){return(this.delInfo&(_I|Mm))>0}get deletedAcross(){return(this.delInfo&Mm)>0}}class rs{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&rs.empty)return rs.empty}recover(e){let n=0,r=W_(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+Eq(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 s=0,i=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?s:0);if(u>e)break;let d=this.ranges[l+i],h=this.ranges[l+o],m=u+d;if(e<=m){let y=d?e==u?-1:e==m?1:n:n,b=u+s+(y<0?0:h);if(r)return b;let v=e==(n<0?u:m)?null:Cq(l/3,e-u),x=e==u?_I:e==m?MI:Mm;return(n<0?e!=u:e!=m)&&(x|=AI),new Nx(b,x,v)}s+=h-d}return r?e+s:new Nx(e+s,0,null)}touches(e,n){let r=0,s=W_(n),i=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 d=this.ranges[l+i],h=u+d;if(e<=h&&l==s*3)return!0;r+=this.ranges[l+o]-d}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),u=o+(this.inverted?0:i),d=this.ranges[s+n],h=this.ranges[s+r];e(l,l+d,u,u+h),i+=h-d}}invert(){return new rs(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?rs.empty:new rs(e<0?[0,-e,0]:[0,0,e])}}rs.empty=new rs([]);class _f{constructor(e,n,r=0,s=e?e.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new _f(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 s=e.getMirror(n);this.appendMap(e._maps[n],s!=null&&s<n?r+s: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 s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new _f;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 s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,n);if(l.recover!=null){let u=this.getMirror(i);if(u!=null&&u>i&&u<this.to){i=u,e=this._maps[u].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new Nx(e,s,null)}}const z0=Object.create(null);class br{getMap(){return rs.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=z0[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 z0)throw new RangeError("Duplicate use of step JSON ID "+e);return z0[e]=n,n.prototype.jsonID=e,n}}class On{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new On(e,null)}static fail(e){return new On(null,e)}static fromReplace(e,n,r,s){try{return On.ok(e.replace(n,r,s))}catch(i){if(i instanceof Tf)return On.fail(i.message);throw i}}}function xk(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let i=t.child(s);i.content.size&&(i=i.copy(xk(i.content,e,i))),i.isInline&&(i=e(i,n,s)),r.push(i)}return ge.fromArray(r)}class ua extends br{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),s=r.node(r.sharedDepth(this.to)),i=new Oe(xk(n.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return On.fromReplace(e,this.from,this.to,i)}invert(){return new Ys(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 ua(n.pos,r.pos,this.mark)}merge(e){return e instanceof ua&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ua(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 ua(n.from,n.to,e.markFromJSON(n.mark))}}br.jsonID("addMark",ua);class Ys extends br{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 Oe(xk(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return On.fromReplace(e,this.from,this.to,r)}invert(){return new ua(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 Ys(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ys&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ys(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 Ys(n.from,n.to,e.markFromJSON(n.mark))}}br.jsonID("removeMark",Ys);class da extends br{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return On.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return On.fromReplace(e,this.pos,this.pos+1,new Oe(ge.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 s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new da(this.pos,n.marks[s]);return new da(this.pos,this.mark)}}return new Rl(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new da(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 da(n.pos,e.markFromJSON(n.mark))}}br.jsonID("addNodeMark",da);class Rl extends br{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return On.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return On.fromReplace(e,this.pos,this.pos+1,new Oe(ge.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new da(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Rl(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 Rl(n.pos,e.markFromJSON(n.mark))}}br.jsonID("removeNodeMark",Rl);class Rn extends br{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&Mx(e,this.from,this.to)?On.fail("Structure replace would overwrite content"):On.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new rs([this.from,this.to-this.from,this.slice.size])}invert(e){return new Rn(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&&Rn.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Rn(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Rn)||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?Oe.empty:new Oe(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Rn(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?Oe.empty:new Oe(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Rn(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 Rn(n.from,n.to,Oe.fromJSON(e,n.slice),!!n.structure)}}Rn.MAP_BIAS=1;br.jsonID("replace",Rn);class Wn extends br{constructor(e,n,r,s,i,o,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Mx(e,this.from,this.gapFrom)||Mx(e,this.gapTo,this.to)))return On.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return On.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?On.fromReplace(e,this.from,this.to,r):On.fail("Content does not fit in gap")}getMap(){return new rs([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 Wn(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),s=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||i>r.pos?null:new Wn(n.pos,r.pos,s,i,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 Wn(n.from,n.to,n.gapFrom,n.gapTo,Oe.fromJSON(e,n.slice),n.insert,!!n.structure)}}br.jsonID("replaceAround",Wn);function Mx(t,e,n){let r=t.resolve(e),s=n-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function Tq(t,e,n,r){let s=[],i=[],o,l;t.doc.nodesBetween(e,n,(u,d,h)=>{if(!u.isInline)return;let m=u.marks;if(!r.isInSet(m)&&h.type.allowsMarkType(r.type)){let y=Math.max(d,e),b=Math.min(d+u.nodeSize,n),v=r.addToSet(m);for(let x=0;x<m.length;x++)m[x].isInSet(v)||(o&&o.to==y&&o.mark.eq(m[x])?o.to=b:s.push(o=new Ys(y,b,m[x])));l&&l.to==y?l.to=b:i.push(l=new ua(y,b,r))}}),s.forEach(u=>t.step(u)),i.forEach(u=>t.step(u))}function Nq(t,e,n,r){let s=[],i=0;t.doc.nodesBetween(e,n,(o,l)=>{if(!o.isInline)return;i++;let u=null;if(r instanceof gy){let d=o.marks,h;for(;h=r.isInSet(d);)(u||(u=[])).push(h),d=h.removeFromSet(d)}else r?r.isInSet(o.marks)&&(u=[r]):u=o.marks;if(u&&u.length){let d=Math.min(l+o.nodeSize,n);for(let h=0;h<u.length;h++){let m=u[h],y;for(let b=0;b<s.length;b++){let v=s[b];v.step==i-1&&m.eq(s[b].style)&&(y=v)}y?(y.to=d,y.step=i):s.push({style:m,from:Math.max(l,e),to:d,step:i})}}}),s.forEach(o=>t.step(new Ys(o.from,o.to,o.style)))}function Sk(t,e,n,r=n.contentMatch,s=!0){let i=t.doc.nodeAt(e),o=[],l=e+1;for(let u=0;u<i.childCount;u++){let d=i.child(u),h=l+d.nodeSize,m=r.matchType(d.type);if(!m)o.push(new Rn(l,h,Oe.empty));else{r=m;for(let y=0;y<d.marks.length;y++)n.allowsMarkType(d.marks[y].type)||t.step(new Ys(l,h,d.marks[y]));if(s&&d.isText&&n.whitespace!="pre"){let y,b=/\r?\n|\r/g,v;for(;y=b.exec(d.text);)v||(v=new Oe(ge.from(n.schema.text(" ",n.allowedMarks(d.marks))),0,0)),o.push(new Rn(l+y.index,l+y.index+y[0].length,v))}}l=h}if(!r.validEnd){let u=r.fillBefore(ge.empty,!0);t.replace(l,l,new Oe(u,0,0))}for(let u=o.length-1;u>=0;u--)t.step(o[u])}function Mq(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Eu(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,s=0,i=0;;--r){let o=t.$from.node(r),l=t.$from.index(r)+s,u=t.$to.indexAfter(r)-i;if(r<t.depth&&o.canReplace(l,u,n))return r;if(r==0||o.type.spec.isolating||!Mq(o,l,u))break;l&&(s=1),u<o.childCount&&(i=1)}return null}function _q(t,e,n){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),l=s.after(i+1),u=o,d=l,h=ge.empty,m=0;for(let v=i,x=!1;v>n;v--)x||r.index(v)>0?(x=!0,h=ge.from(r.node(v).copy(h)),m++):u--;let y=ge.empty,b=0;for(let v=i,x=!1;v>n;v--)x||s.after(v+1)<s.end(v)?(x=!0,y=ge.from(s.node(v).copy(y)),b++):d++;t.step(new Wn(u,d,o,l,new Oe(h.append(y),m,b),h.size-m,!0))}function kk(t,e,n=null,r=t){let s=Aq(t,e),i=s&&Rq(r,e);return i?s.map(q_).concat({type:e,attrs:n}).concat(i.map(q_)):null}function q_(t){return{type:t,attrs:null}}function Aq(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return n.canReplaceWith(r,s,o)?i:null}function Rq(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let u=(o.length?o[o.length-1]:e).contentMatch;for(let d=r;u&&d<s;d++)u=u.matchType(n.child(d).type);return!u||!u.validEnd?null:o}function Oq(t,e,n){let r=ge.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=ge.from(n[o].type.create(n[o].attrs,r))}let s=e.start,i=e.end;t.step(new Wn(s,i,s,i,new Oe(r,0,0),n.length,!0))}function jq(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,l)=>{let u=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,u)&&Dq(t.doc,t.mapping.slice(i).map(l),r)){let d=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",v=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!v?d=!1:!b&&v&&(d=!0)}d===!1&&OI(t,o,l,i),Sk(t,t.mapping.slice(i).map(l,1),r,void 0,d===null);let h=t.mapping.slice(i),m=h.map(l,1),y=h.map(l+o.nodeSize,1);return t.step(new Wn(m,y,m+1,y-1,new Oe(ge.from(r.create(u,null,o.marks)),0,0),1,!0)),d===!0&&RI(t,o,l,i),!1}})}function RI(t,e,n,r){e.forEach((s,i)=>{if(s.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(s.text);){let u=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function OI(t,e,n,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(`
68
+ `))}})}function Dq(t,e,n){let r=t.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function Iq(t,e,n,r,s){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,s||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Wn(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new Oe(ge.from(o),0,0),1,!0))}function co(t,e,n=1,r){let s=t.resolve(e),i=s.depth-n,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let d=s.depth-1,h=n-2;d>i;d--,h--){let m=s.node(d),y=s.index(d);if(m.type.spec.isolating)return!1;let b=m.content.cutByIndex(y,m.childCount),v=r&&r[h+1];v&&(b=b.replaceChild(0,v.type.create(v.attrs)));let x=r&&r[h]||m;if(!m.canReplace(y+1,m.childCount)||!x.type.validContent(b))return!1}let l=s.indexAfter(i),u=r&&r[0];return s.node(i).canReplaceWith(l,l,u?u.type:s.node(i+1).type)}function Lq(t,e,n=1,r){let s=t.doc.resolve(e),i=ge.empty,o=ge.empty;for(let l=s.depth,u=s.depth-n,d=n-1;l>u;l--,d--){i=ge.from(s.node(l).copy(i));let h=r&&r[d];o=ge.from(h?h.type.create(h.attrs,o):s.node(l).copy(o))}t.step(new Rn(e,e,new Oe(i.append(o),n,n),!0))}function La(t,e){let n=t.resolve(e),r=n.index();return jI(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Pq(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let s=0;s<e.childCount;s++){let i=e.child(s),o=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function jI(t,e){return!!(t&&e&&!t.isLeaf&&Pq(t,e))}function yy(t,e,n=-1){let r=t.resolve(e);for(let s=r.depth;;s--){let i,o,l=r.index(s);if(s==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(s+1),l++,o=r.node(s).maybeChild(l)):(i=r.node(s).maybeChild(l-1),o=r.node(s+1)),i&&!i.isTextblock&&jI(i,o)&&r.node(s).canReplace(l,l+1))return e;if(s==0)break;e=n<0?r.before(s):r.after(s)}}function $q(t,e,n){let r=null,{linebreakReplacement:s}=t.doc.type.schema,i=t.doc.resolve(e-n),o=i.node().type;if(s&&o.inlineContent){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(s);h&&!m?r=!1:!h&&m&&(r=!0)}let l=t.steps.length;if(r===!1){let h=t.doc.resolve(e+n);OI(t,h.node(),h.before(),l)}o.inlineContent&&Sk(t,e+n-1,o,i.node().contentMatchAt(i.index()),r==null);let u=t.mapping.slice(l),d=u.map(e-n);if(t.step(new Rn(d,u.map(e+n,-1),Oe.empty,!0)),r===!0){let h=t.doc.resolve(d);RI(t,h.node(),h.before(),t.steps.length)}return t}function zq(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 s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,n))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,n))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function DI(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let s=n.content;for(let i=0;i<n.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)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),d=r.node(o),h=!1;if(i==1)h=d.canReplace(u,u,s);else{let m=d.contentMatchAt(u).findWrapping(s.firstChild.type);h=m&&d.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 by(t,e,n=e,r=Oe.empty){if(e==n&&!r.size)return null;let s=t.resolve(e),i=t.resolve(n);return II(s,i,r)?new Rn(e,n,r):new Bq(s,i,r).fit()}function II(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Bq{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ge.empty;for(let s=0;s<=e.depth;s++){let i=e.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=ge.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let i=this.placed,o=r.depth,l=s.depth;for(;o&&l&&i.childCount==1;)i=i.firstChild.content,o--,l--;let u=new Oe(i,o,l);return e>-1?new Wn(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new Rn(r.pos,s.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=B0(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let l=this.depth;l>=0;l--){let{type:u,match:d}=this.frontier[l],h,m=null;if(n==1&&(o?d.matchType(o.type)||(m=d.fillBefore(ge.from(o),!1)):i&&u.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:m};if(n==2&&o&&(h=d.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:h};if(i&&d.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=B0(e,n);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new Oe(e,n+1,Math.max(r,s.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=B0(e,n);if(s.childCount<=1&&n>0){let i=e.size-n<=n+s.size;this.unplaced=new Oe($d(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new Oe($d(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:s,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let x=0;x<i.length;x++)this.openFrontierNode(i[x]);let o=this.unplaced,l=r?r.content:o.content,u=o.openStart-e,d=0,h=[],{match:m,type:y}=this.frontier[n];if(s){for(let x=0;x<s.childCount;x++)h.push(s.child(x));m=m.matchFragment(s)}let b=l.size+e-(o.content.size-o.openEnd);for(;d<l.childCount;){let x=l.child(d),k=m.matchType(x.type);if(!k)break;d++,(d>1||u==0||x.content.size)&&(m=k,h.push(LI(x.mark(y.allowedMarks(x.marks)),d==1?u:0,d==l.childCount?b:-1)))}let v=d==l.childCount;v||(b=-1),this.placed=zd(this.placed,n,ge.from(h)),this.frontier[n].match=m,v&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let x=0,k=l;x<b;x++){let E=k.lastChild;this.frontier.push({type:E.type,match:E.contentMatchAt(E.childCount)}),k=E.content}this.unplaced=v?e==0?Oe.empty:new Oe($d(o.content,e-1,1),e-1,b<0?o.openEnd:e-1):new Oe($d(o.content,e,d),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!F0(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,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=F0(e,n,s,r,i);if(o){for(let l=n-1;l>=0;l--){let{match:u,type:d}=this.frontier[l],h=F0(e,l,d,u,!0);if(!h||h.childCount)continue e}return{depth:n,fit:o,move:i?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=zd(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let s=e.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,i)}return e}openFrontierNode(e,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=zd(this.placed,this.depth,ge.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ge.empty,!0);n.childCount&&(this.placed=zd(this.placed,this.frontier.length,n))}}function $d(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy($d(t.firstChild.content,e-1,n)))}function zd(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(zd(t.lastChild.content,e-1,n)))}function B0(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function LI(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,LI(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(ge.empty,!0)))),t.copy(r)}function F0(t,e,n,r,s){let i=t.node(e),o=s?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,o);return l&&!Fq(n,i.content,o)?l:null}function Fq(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Vq(t){return t.spec.defining||t.spec.definingForContent}function Hq(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let s=t.doc.resolve(e),i=t.doc.resolve(n);if(II(s,i,r))return t.step(new Rn(e,n,r));let o=$I(s,i);o[o.length-1]==0&&o.pop();let l=-(s.depth+1);o.unshift(l);for(let y=s.depth,b=s.pos-1;y>0;y--,b--){let v=s.node(y).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;o.indexOf(y)>-1?l=y:s.before(y)==b&&o.splice(1,0,-y)}let u=o.indexOf(l),d=[],h=r.openStart;for(let y=r.content,b=0;;b++){let v=y.firstChild;if(d.push(v),b==r.openStart)break;y=v.content}for(let y=h-1;y>=0;y--){let b=d[y],v=Vq(b.type);if(v&&!b.sameMarkup(s.node(Math.abs(l)-1)))h=y;else if(v||!b.type.isTextblock)break}for(let y=r.openStart;y>=0;y--){let b=(y+h+1)%(r.openStart+1),v=d[b];if(v)for(let x=0;x<o.length;x++){let k=o[(x+u)%o.length],E=!0;k<0&&(E=!1,k=-k);let M=s.node(k-1),_=s.index(k-1);if(M.canReplaceWith(_,_,v.type,v.marks))return t.replace(s.before(k),E?i.after(k):n,new Oe(PI(r.content,0,r.openStart,b),b,r.openEnd))}}let m=t.steps.length;for(let y=o.length-1;y>=0&&(t.replace(e,n,r),!(t.steps.length>m));y--){let b=o[y];b<0||(e=s.before(b),n=i.after(b))}}function PI(t,e,n,r,s){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(PI(i.content,e+1,n,r,i)))}if(e>r){let i=s.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(ge.empty,!0))}return t}function Uq(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=zq(t.doc,e,r.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new Oe(ge.from(r),0,0))}function Wq(t,e,n){let r=t.doc.resolve(e),s=t.doc.resolve(n);if(r.parent.isTextblock&&s.parent.isTextblock&&r.start()!=s.start()&&r.parentOffset==0&&s.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=s.depth;u>o;u--)s.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=s.depth;u>0&&n==s.start(u);u--)n=s.before(u);r=t.doc.resolve(e),s=t.doc.resolve(n)}}let i=$I(r,s);for(let o=0;o<i.length;o++){let l=i[o],u=o==i.length-1;if(u&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),s.end(l));if(l>0&&(u||r.node(l-1).canReplace(r.index(l-1),s.indexAfter(l-1))))return t.delete(r.before(l),s.after(l))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function $I(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let s=r;s>=0;s--){let i=t.start(s);if(i<t.pos-(t.depth-s)||e.end(s)>e.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&n.push(s)}return n}class Zc extends br{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 On.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return On.fromReplace(e,this.pos,this.pos+1,new Oe(ge.from(s),0,n.isLeaf?0:1))}getMap(){return rs.empty}invert(e){return new Zc(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 Zc(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 Zc(n.pos,n.attr,n.value)}}br.jsonID("attr",Zc);class Af extends br{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return On.ok(r)}getMap(){return rs.empty}invert(e){return new Af(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 Af(n.attr,n.value)}}br.jsonID("docAttr",Af);let lu=class extends Error{};lu=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};lu.prototype=Object.create(Error.prototype);lu.prototype.constructor=lu;lu.prototype.name="TransformError";class Ck{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new _f}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new lu(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 s=this.mapping.maps[r];r&&(e=s.map(e,1),n=s.map(n,-1)),s.forEach((i,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=Oe.empty){let s=by(this.doc,e,n,r);return s&&this.step(s),this}replaceWith(e,n,r){return this.replace(e,n,new Oe(ge.from(r),0,0))}delete(e,n){return this.replace(e,n,Oe.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Hq(this,e,n,r),this}replaceRangeWith(e,n,r){return Uq(this,e,n,r),this}deleteRange(e,n){return Wq(this,e,n),this}lift(e,n){return _q(this,e,n),this}join(e,n=1){return $q(this,e,n),this}wrap(e,n){return Oq(this,e,n),this}setBlockType(e,n=e,r,s=null){return jq(this,e,n,r,s),this}setNodeMarkup(e,n,r=null,s){return Iq(this,e,n,r,s),this}setNodeAttribute(e,n,r){return this.step(new Zc(e,n,r)),this}setDocAttribute(e,n){return this.step(new Af(e,n)),this}addNodeMark(e,n){return this.step(new da(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 Wt)n.isInSet(r.marks)&&this.step(new Rl(e,n));else{let s=r.marks,i,o=[];for(;i=n.isInSet(s);)o.push(new Rl(e,i)),s=i.removeFromSet(s);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,n=1,r){return Lq(this,e,n,r),this}addMark(e,n,r){return Tq(this,e,n,r),this}removeMark(e,n,r){return Nq(this,e,n,r),this}clearIncompatible(e,n,r){return Sk(this,e,n,r),this}}const V0=Object.create(null);class nt{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new zI(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=Oe.empty){let r=n.content.lastChild,s=null;for(let l=0;l<n.openEnd;l++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:u,$to:d}=o[l],h=e.mapping.slice(i);e.replaceRange(h.map(u.pos),h.map(d.pos),l?Oe.empty:n),l==0&&K_(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:l}=s[i],u=e.mapping.slice(r),d=u.map(o.pos),h=u.map(l.pos);i?e.deleteRange(d,h):(e.replaceRangeWith(d,h,n),K_(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let s=e.parent.inlineContent?new Ue(e):Vc(e.node(0),e.parent,e.pos,e.index(),n,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=n<0?Vc(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Vc(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new is(e.node(0))}static atStart(e){return Vc(e,e,0,0,1)||new is(e)}static atEnd(e){return Vc(e,e,e.content.size,e.childCount,-1)||new is(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=V0[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 V0)throw new RangeError("Duplicate use of selection JSON ID "+e);return V0[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Ue.between(this.$anchor,this.$head).getBookmark()}}nt.prototype.visible=!0;class zI{constructor(e,n){this.$from=e,this.$to=n}}let G_=!1;function Y_(t){!G_&&!t.parent.inlineContent&&(G_=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Ue extends nt{constructor(e,n=e){Y_(e),Y_(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 nt.near(r);let s=e.resolve(n.map(this.anchor));return new Ue(s.parent.inlineContent?s:r,r)}replace(e,n=Oe.empty){if(super.replace(e,n),n==Oe.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Ue&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new vy(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 Ue(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=nt.findFrom(n,r,!0)||nt.findFrom(n,-r,!0);if(i)n=i.$head;else return nt.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(nt.findFrom(e,-r,!0)||nt.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=s<0&&(e=n))),new Ue(e,n)}}nt.jsonID("text",Ue);class vy{constructor(e,n){this.anchor=e,this.head=n}map(e){return new vy(e.map(this.anchor),e.map(this.head))}resolve(e){return Ue.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ge extends nt{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:s}=n.mapResult(this.anchor),i=e.resolve(s);return r?nt.near(i):new Ge(i)}content(){return new Oe(ge.from(this.node),0,0)}eq(e){return e instanceof Ge&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ek(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ge(e.resolve(n.anchor))}static create(e,n){return new Ge(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ge.prototype.visible=!1;nt.jsonID("node",Ge);class Ek{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new vy(r,r):new Ek(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Ge.isSelectable(r)?new Ge(n):nt.near(n)}}class is extends nt{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=Oe.empty){if(n==Oe.empty){e.delete(0,e.doc.content.size);let r=nt.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new is(e)}map(e){return new is(e)}eq(e){return e instanceof is}getBookmark(){return qq}}nt.jsonID("all",is);const qq={map(){return this},resolve(t){return new is(t)}};function Vc(t,e,n,r,s,i=!1){if(e.inlineContent)return Ue.create(t,n);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let l=e.child(o);if(l.isAtom){if(!i&&Ge.isSelectable(l))return Ge.create(t,n-(s<0?l.nodeSize:0))}else{let u=Vc(t,l,n+s,s<0?l.childCount:0,s,i);if(u)return u}n+=l.nodeSize*s}return null}function K_(t,e,n){let r=t.steps.length-1;if(r<e)return;let s=t.steps[r];if(!(s instanceof Rn||s instanceof Wn))return;let i=t.mapping.maps[r],o;i.forEach((l,u,d,h)=>{o==null&&(o=h)}),t.setSelection(nt.near(t.doc.resolve(o),n))}const Z_=1,Ip=2,X_=4;class Gq extends Ck{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|Z_)&~Ip,this.storedMarks=null,this}get selectionSet(){return(this.updated&Z_)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ip,this}ensureMarks(e){return Wt.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&Ip)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Ip,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)||Wt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(nt.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|=X_,this}get scrolledIntoView(){return(this.updated&X_)>0}}function J_(t,e){return!e||!t?t:t.bind(e)}class Bd{constructor(e,n,r){this.name=e,this.init=J_(n.init,r),this.apply=J_(n.apply,r)}}const Yq=[new Bd("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Bd("selection",{init(t,e){return t.selection||nt.atStart(e.doc)},apply(t){return t.selection}}),new Bd("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Bd("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class H0{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Yq.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 Bd(r.key,r.spec.state,r))})}}class ml{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 s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),s=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let u=s?s[o].n:0,d=s?s[o].state:this,h=u<n.length&&l.spec.appendTransaction.call(l,u?n.slice(u):n,d,r);if(h&&r.filterTransaction(h,o)){if(h.setMeta("appendedTransaction",e),!s){s=[];for(let m=0;m<this.config.plugins.length;m++)s.push(m<o?{state:r,n:n.length}:{state:this,n:0})}n.push(h),r=r.applyInner(h),i=!0}s&&(s[o]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new ml(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new Gq(this)}static create(e){let n=new H0(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new ml(n);for(let s=0;s<n.fields.length;s++)r[n.fields[s].name]=n.fields[s].init(e,r);return r}reconfigure(e){let n=new H0(this.schema,e.plugins),r=n.fields,s=new ml(n);for(let i=0;i<r.length;i++){let o=r[i].name;s[o]=this.hasOwnProperty(o)?this[o]:r[i].init(e,s)}return s}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 s=e[r],i=s.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(s,this[s.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 s=new H0(e.schema,e.plugins),i=new ml(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=ya.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=nt.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let u=r[l],d=u.spec.state;if(u.key==o.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[o.name]=d.fromJSON.call(u,e,n[l],i);return}}i[o.name]=o.init(e,i)}}),i}}function BI(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=BI(s,e,{})),n[r]=s}return n}class Kt{constructor(e){this.spec=e,this.props={},e.props&&BI(e.props,this,this.props),this.key=e.key?e.key.key:FI("plugin")}getState(e){return e[this.key]}}const U0=Object.create(null);function FI(t){return t in U0?t+"$"+ ++U0[t]:(U0[t]=0,t+"$")}class yn{constructor(e="key"){this.key=FI(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const VI=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function HI(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const UI=(t,e,n)=>{let r=HI(t,n);if(!r)return!1;let s=Tk(r);if(!s){let o=r.blockRange(),l=o&&Eu(o);return l==null?!1:(e&&e(t.tr.lift(o,l).scrollIntoView()),!0)}let i=s.nodeBefore;if(QI(t,s,e,-1))return!0;if(r.parent.content.size==0&&(cu(i,"end")||Ge.isSelectable(i)))for(let o=r.depth;;o--){let l=by(t.doc,r.before(o),r.after(o),Oe.empty);if(l&&l.slice.size<l.to-l.from){if(e){let u=t.tr.step(l);u.setSelection(cu(i,"end")?nt.findFrom(u.doc.resolve(u.mapping.map(s.pos,-1)),-1):Ge.create(u.doc,s.pos-i.nodeSize)),e(u.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},Kq=(t,e,n)=>{let r=HI(t,n);if(!r)return!1;let s=Tk(r);return s?WI(t,s,e):!1},Zq=(t,e,n)=>{let r=GI(t,n);if(!r)return!1;let s=Nk(r);return s?WI(t,s,e):!1};function WI(t,e,n){let r=e.nodeBefore,s=r,i=e.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let h=s.lastChild;if(!h)return!1;s=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 d=by(t.doc,i,u,Oe.empty);if(!d||d.from!=i||d instanceof Rn&&d.slice.size>=u-i)return!1;if(n){let h=t.tr.step(d);h.setSelection(Ue.create(h.doc,i)),n(h.scrollIntoView())}return!0}function cu(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 qI=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=Tk(r)}let o=i&&i.nodeBefore;return!o||!Ge.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Ge.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function Tk(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 GI(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const YI=(t,e,n)=>{let r=GI(t,n);if(!r)return!1;let s=Nk(r);if(!s)return!1;let i=s.nodeAfter;if(QI(t,s,e,1))return!0;if(r.parent.content.size==0&&(cu(i,"start")||Ge.isSelectable(i))){let o=by(t.doc,r.before(),r.after(),Oe.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=t.tr.step(o);l.setSelection(cu(i,"start")?nt.findFrom(l.doc.resolve(l.mapping.map(s.pos)),1):Ge.create(l.doc,l.mapping.map(s.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},KI=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=Nk(r)}let o=i&&i.nodeAfter;return!o||!Ge.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Ge.create(t.doc,i.pos)).scrollIntoView()),!0)};function Nk(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 Xq=(t,e)=>{let n=t.selection,r=n instanceof Ge,s;if(r){if(n.node.isTextblock||!La(t.doc,n.from))return!1;s=n.from}else if(s=yy(t.doc,n.from,-1),s==null)return!1;if(e){let i=t.tr.join(s);r&&i.setSelection(Ge.create(i.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},Jq=(t,e)=>{let n=t.selection,r;if(n instanceof Ge){if(n.node.isTextblock||!La(t.doc,n.to))return!1;r=n.to}else if(r=yy(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Qq=(t,e)=>{let{$from:n,$to:r}=t.selection,s=n.blockRange(r),i=s&&Eu(s);return i==null?!1:(e&&e(t.tr.lift(s,i).scrollIntoView()),!0)},ZI=(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 Mk(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 e9=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),i=n.indexAfter(-1),o=Mk(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let l=n.after(),u=t.tr.replaceWith(l,l,o.createAndFill());u.setSelection(nt.near(u.doc.resolve(l),1)),e(u.scrollIntoView())}return!0},XI=(t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof is||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=Mk(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,l=t.tr.insert(o,i.createAndFill());l.setSelection(Ue.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},JI=(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 i=n.before();if(co(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),s=r&&Eu(r);return s==null?!1:(e&&e(t.tr.lift(r,s).scrollIntoView()),!0)};function t9(t){return(e,n)=>{if(e.selection instanceof Ge&&e.selection.node.isBlock){let{$from:b}=e.selection;return!b.parentOffset||!co(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 Ue||e.selection instanceof is)&&r.deleteSelection();let{$from:s}=r.selection,i=r.steps.length,o=[],l,u,d=!1,h=!1;for(let b=s.depth;;b--)if(s.node(b).isBlock){d=s.end(b)==s.pos+(s.depth-b),h=s.start(b)==s.pos-(s.depth-b),u=Mk(s.node(b-1).contentMatchAt(s.indexAfter(b-1))),o.unshift(d&&u?{type:u}:null),l=b;break}else{if(b==1)return!1;o.unshift(null)}let m=s.pos,y=co(r.doc,m,o.length,o);if(y||(o[0]=u?{type:u}:null,y=co(r.doc,m,o.length,o)),!y)return!1;if(r.split(m,o.length,o),!d&&h&&s.node(l).type!=u){let b=r.mapping.slice(i),v=b.map(s.before(l)),x=r.doc.resolve(v);u&&s.node(l-1).canReplaceWith(x.index(),x.index()+1,u)&&r.setNodeMarkup(b.map(s.before(l)),u)}return n&&n(r.scrollIntoView()),!0}}const n9=t9(),r9=(t,e)=>{let{$from:n,to:r}=t.selection,s,i=n.sharedDepth(r);return i==0?!1:(s=n.before(i),e&&e(t.tr.setSelection(Ge.create(t.doc,s))),!0)};function s9(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,i=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(s.isTextblock||La(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function QI(t,e,n,r){let s=e.nodeBefore,i=e.nodeAfter,o,l,u=s.type.spec.isolating||i.type.spec.isolating;if(!u&&s9(t,e,n))return!0;let d=!u&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(o=(l=s.contentMatchAt(s.childCount)).findWrapping(i.type))&&l.matchType(o[0]||i.type).validEnd){if(n){let b=e.pos+i.nodeSize,v=ge.empty;for(let E=o.length-1;E>=0;E--)v=ge.from(o[E].create(null,v));v=ge.from(s.copy(v));let x=t.tr.step(new Wn(e.pos-1,b,e.pos,b,new Oe(v,1,0),o.length,!0)),k=x.doc.resolve(b+2*o.length);k.nodeAfter&&k.nodeAfter.type==s.type&&La(x.doc,k.pos)&&x.join(k.pos),n(x.scrollIntoView())}return!0}let h=i.type.spec.isolating||r>0&&u?null:nt.findFrom(e,1),m=h&&h.$from.blockRange(h.$to),y=m&&Eu(m);if(y!=null&&y>=e.depth)return n&&n(t.tr.lift(m,y).scrollIntoView()),!0;if(d&&cu(i,"start",!0)&&cu(s,"end")){let b=s,v=[];for(;v.push(b),!b.isTextblock;)b=b.lastChild;let x=i,k=1;for(;!x.isTextblock;x=x.firstChild)k++;if(b.canReplace(b.childCount,b.childCount,x.content)){if(n){let E=ge.empty;for(let _=v.length-1;_>=0;_--)E=ge.from(v[_].copy(E));let M=t.tr.step(new Wn(e.pos-v.length,e.pos+i.nodeSize,e.pos+k,e.pos+i.nodeSize-k,new Oe(E,v.length,0),0,!0));n(M.scrollIntoView())}return!0}}return!1}function eL(t){return function(e,n){let r=e.selection,s=t<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(n&&n(e.tr.setSelection(Ue.create(e.doc,t<0?s.start(i):s.end(i)))),!0):!1}}const i9=eL(-1),o9=eL(1);function a9(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i),l=o&&kk(o,t,e);return l?(r&&r(n.tr.wrap(o,l).scrollIntoView()),!0):!1}}function Q_(t,e=null){return function(n,r){let s=!1;for(let i=0;i<n.selection.ranges.length&&!s;i++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(o,l,(u,d)=>{if(s)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)s=!0;else{let h=n.doc.resolve(d),m=h.index();s=h.parent.canReplaceWith(m,m+1,t)}})}if(!s)return!1;if(r){let i=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:u}}=n.selection.ranges[o];i.setBlockType(l,u,t,e)}r(i.scrollIntoView())}return!0}}function _k(...t){return function(e,n,r){for(let s=0;s<t.length;s++)if(t[s](e,n,r))return!0;return!1}}_k(VI,UI,qI);_k(VI,YI,KI);_k(ZI,XI,JI,n9);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function l9(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i);if(!o)return!1;let l=r?n.tr:null;return c9(l,o,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function c9(t,e,n,r=null){let s=!1,i=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);i=new sg(u,u,e.depth),e.endIndex<e.parent.childCount&&(e=new sg(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let l=kk(i,n,r,e);return l?(t&&u9(t,e,l,s,n),!0):!1}function u9(t,e,n,r,s){let i=ge.empty;for(let h=n.length-1;h>=0;h--)i=ge.from(n[h].type.create(n[h].attrs,i));t.step(new Wn(e.start-(r?2:0),e.end,e.start,e.end,new Oe(i,0,0),n.length,!0));let o=0;for(let h=0;h<n.length;h++)n[h].type==s&&(o=h+1);let l=n.length-o,u=e.start+n.length-(r?2:0),d=e.parent;for(let h=e.startIndex,m=e.endIndex,y=!0;h<m;h++,y=!1)!y&&co(t.doc,u,l)&&(t.split(u,l),u+=2*l),u+=d.child(h).nodeSize;return t}function d9(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,o=>o.childCount>0&&o.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?f9(e,n,t,i):h9(e,n,i):!0:!1}}function f9(t,e,n,r){let s=t.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new Wn(i-1,o,i,o,new Oe(ge.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new sg(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const l=Eu(r);if(l==null)return!1;s.lift(r,l);let u=s.doc.resolve(s.mapping.map(i,-1)-1);return La(s.doc,u.pos)&&u.nodeBefore.type==u.nodeAfter.type&&s.join(u.pos),e(s.scrollIntoView()),!0}function h9(t,e,n){let r=t.tr,s=n.parent;for(let b=n.end,v=n.endIndex-1,x=n.startIndex;v>x;v--)b-=s.child(v).nodeSize,r.delete(b-1,b+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,u=n.endIndex==s.childCount,d=i.node(-1),h=i.index(-1);if(!d.canReplace(h+(l?0:1),h+1,o.content.append(u?ge.empty:ge.from(s))))return!1;let m=i.pos,y=m+o.nodeSize;return r.step(new Wn(m-(l?1:0),y+(u?1:0),m+1,y-1,new Oe((l?ge.empty:ge.from(s.copy(ge.empty))).append(u?ge.empty:ge.from(s.copy(ge.empty))),l?0:1,u?0:1),l?0:1)),e(r.scrollIntoView()),!0}function p9(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,d=>d.childCount>0&&d.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let l=i.parent,u=l.child(o-1);if(u.type!=t)return!1;if(n){let d=u.lastChild&&u.lastChild.type==l.type,h=ge.from(d?t.create():null),m=new Oe(ge.from(t.create(null,ge.from(l.type.create(null,h)))),d?3:1,0),y=i.start,b=i.end;n(e.tr.step(new Wn(y-(d?3:1),b,y,b,m,1,!0)).scrollIntoView())}return!0}}const ir=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},uu=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let _x=null;const Yi=function(t,e,n){let r=_x||(_x=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},m9=function(){_x=null},Ol=function(t,e,n,r){return n&&(eA(t,e,n,r,-1)||eA(t,e,n,r,1))},g9=/^(img|br|input|textarea|hr)$/i;function eA(t,e,n,r,s){for(var i;;){if(t==n&&e==r)return!0;if(e==(s<0?0:Ts(t))){let o=t.parentNode;if(!o||o.nodeType!=1||th(t)||g9.test(t.nodeName)||t.contentEditable=="false")return!1;e=ir(t)+(s<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else t=o,e=s<0?Ts(t):0}else return!1}}function Ts(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function y9(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=Ts(t)}else if(t.parentNode&&!th(t))e=ir(t),t=t.parentNode;else return null}}function b9(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&&!th(t))e=ir(t)+1,t=t.parentNode;else return null}}function v9(t,e,n){for(let r=e==0,s=e==Ts(t);r||s;){if(t==n)return!0;let i=ir(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,s=s&&i==Ts(t)}}function th(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 wy=function(t){return t.focusNode&&Ol(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function fl(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function w9(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function x9(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Ts(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Ts(r.startContainer),r.startOffset)}}}const yi=typeof navigator<"u"?navigator:null,tA=typeof document<"u"?document:null,Pa=yi&&yi.userAgent||"",Ax=/Edge\/(\d+)/.exec(Pa),tL=/MSIE \d/.exec(Pa),Rx=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Pa),Br=!!(tL||Rx||Ax),ba=tL?document.documentMode:Rx?+Rx[1]:Ax?+Ax[1]:0,Ns=!Br&&/gecko\/(\d+)/i.test(Pa);Ns&&+(/Firefox\/(\d+)/.exec(Pa)||[0,0])[1];const Ox=!Br&&/Chrome\/(\d+)/.exec(Pa),ar=!!Ox,nL=Ox?+Ox[1]:0,gr=!Br&&!!yi&&/Apple Computer/.test(yi.vendor),du=gr&&(/Mobile\/\w+/.test(Pa)||!!yi&&yi.maxTouchPoints>2),Cs=du||(yi?/Mac/.test(yi.platform):!1),rL=yi?/Win/.test(yi.platform):!1,so=/Android \d/.test(Pa),nh=!!tA&&"webkitFontSmoothing"in tA.documentElement.style,S9=nh?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function k9(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 Vi(t,e){return typeof t=="number"?t:t[e]}function C9(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 nA(t,e,n){if(!jx(e)&&e.left==0)return;let r=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=uu(o);continue}let l=o,u=l==i.body,d=u?k9(i):C9(l),h=0,m=0;if(e.top<d.top+Vi(r,"top")?m=-(d.top-e.top+Vi(s,"top")):e.bottom>d.bottom-Vi(r,"bottom")&&(m=e.bottom-e.top>d.bottom-d.top?e.top+Vi(s,"top")-d.top:e.bottom-d.bottom+Vi(s,"bottom")),e.left<d.left+Vi(r,"left")?h=-(d.left-e.left+Vi(s,"left")):e.right>d.right-Vi(r,"right")&&(h=e.right-d.right+Vi(s,"right")),h||m)if(u)i.defaultView.scrollBy(h,m);else{let b=l.scrollLeft,v=l.scrollTop;m&&(l.scrollTop+=m),h&&(l.scrollLeft+=h);let x=l.scrollLeft-b,k=l.scrollTop-v;e={left:e.left-x,top:e.top-k,right:e.right-x,bottom:e.bottom-k}}let y=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(y))break;o=y=="absolute"?o.offsetParent:uu(o)}}function E9(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=t.root.elementFromPoint(i,o);if(!l||l==t.dom||!t.dom.contains(l))continue;let u=l.getBoundingClientRect();if(u.top>=n-20){r=l,s=u.top;break}}return{refDOM:r,refTop:s,stack:sL(t.dom)}}function sL(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=uu(r));return e}function T9({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;iL(n,r==0?0:r-e)}function iL(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:s,left:i}=t[n];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let _c=null;function N9(t){if(t.setActive)return t.setActive();if(_c)return t.focus(_c);let e=sL(t);t.focus(_c==null?{get preventScroll(){return _c={preventScroll:!0},!0}}:void 0),_c||(_c=!1,iL(e,0))}function oL(t,e){let n,r=2e8,s,i=0,o=e.top,l=e.top,u,d;for(let h=t.firstChild,m=0;h;h=h.nextSibling,m++){let y;if(h.nodeType==1)y=h.getClientRects();else if(h.nodeType==3)y=Yi(h).getClientRects();else continue;for(let b=0;b<y.length;b++){let v=y[b];if(v.top<=o&&v.bottom>=l){o=Math.max(v.bottom,o),l=Math.min(v.top,l);let x=v.left>e.left?v.left-e.left:v.right<e.left?e.left-v.right:0;if(x<r){n=h,r=x,s=x&&n.nodeType==3?{left:v.right<e.left?v.right:v.left,top:e.top}:e,h.nodeType==1&&x&&(i=m+(e.left>=(v.left+v.right)/2?1:0));continue}}else v.top>e.top&&!u&&v.left<=e.left&&v.right>=e.left&&(u=h,d={left:Math.max(v.left,Math.min(v.right,e.left)),top:v.top});!n&&(e.left>=v.right&&e.top>=v.top||e.left>=v.left&&e.top>=v.bottom)&&(i=m+1)}}return!n&&u&&(n=u,s=d,r=0),n&&n.nodeType==3?M9(n,s):!n||r&&n.nodeType==1?{node:t,offset:i}:oL(n,s)}function M9(t,e){let n=t.nodeValue.length,r=document.createRange(),s;for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let o=Zo(r,1);if(o.top!=o.bottom&&Ak(e,o)){s={node:t,offset:i+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),s||{node:t,offset:0}}function Ak(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function _9(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function A9(t,e,n){let{node:r,offset:s}=oL(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,s,i)}function R9(t,e,n,r){let s=-1;for(let i=e,o=!1;i!=t.dom;){let l=t.docView.nearestDesc(i,!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?s=l.posBefore:(!o&&u.right<r.left||u.bottom<r.top)&&(s=l.posAfter),o=!0),!l.contentDOM&&s<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;i=l.dom.parentNode}return s>-1?s:t.docView.posFromDOM(e,n,-1)}function aL(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=s;;){let o=t.childNodes[i];if(o.nodeType==1){let l=o.getClientRects();for(let u=0;u<l.length;u++){let d=l[u];if(Ak(e,d))return aL(o,e,d)}}if((i=(i+1)%r)==s)break}return t}function O9(t,e){let n=t.dom.ownerDocument,r,s=0,i=x9(n,e.left,e.top);i&&({node:r,offset:s}=i);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 d=t.dom.getBoundingClientRect();if(!Ak(e,d)||(o=aL(t.dom,e,d),!o))return null}if(gr)for(let d=o;r&&d;d=uu(d))d.draggable&&(r=void 0);if(o=_9(o,e),r){if(Ns&&r.nodeType==1&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let h=r.childNodes[s],m;h.nodeName=="IMG"&&(m=h.getBoundingClientRect()).right<=e.left&&m.bottom>e.top&&s++}let d;nh&&s&&r.nodeType==1&&(d=r.childNodes[s-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&s--,r==t.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(l=R9(t,r,s,e))}l==null&&(l=A9(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:l,inside:u?u.posAtStart-u.border:-1}}function jx(t){return t.top<t.bottom||t.left<t.right}function Zo(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(jx(r))return r}return Array.prototype.find.call(n,jx)||t.getBoundingClientRect()}const j9=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function lL(t,e,n){let{node:r,offset:s,atom:i}=t.docView.domFromPos(e,n<0?-1:1),o=nh||Ns;if(r.nodeType==3)if(o&&(j9.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let u=Zo(Yi(r,s,s),n);if(Ns&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let d=Zo(Yi(r,s-1,s-1),-1);if(d.top==u.top){let h=Zo(Yi(r,s,s+1),-1);if(h.top!=u.top)return Td(h,h.left<d.left)}}return u}else{let u=s,d=s,h=n<0?1:-1;return n<0&&!s?(d++,h=-1):n>=0&&s==r.nodeValue.length?(u--,h=1):n<0?u--:d++,Td(Zo(Yi(r,u,d),h),h<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(n<0||s==Ts(r))){let u=r.childNodes[s-1];if(u.nodeType==1)return W0(u.getBoundingClientRect(),!1)}if(i==null&&s<Ts(r)){let u=r.childNodes[s];if(u.nodeType==1)return W0(u.getBoundingClientRect(),!0)}return W0(r.getBoundingClientRect(),n>=0)}if(i==null&&s&&(n<0||s==Ts(r))){let u=r.childNodes[s-1],d=u.nodeType==3?Yi(u,Ts(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(d)return Td(Zo(d,1),!1)}if(i==null&&s<Ts(r)){let u=r.childNodes[s];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let d=u?u.nodeType==3?Yi(u,0,o?0:1):u.nodeType==1?u:null:null;if(d)return Td(Zo(d,-1),!0)}return Td(Zo(r.nodeType==3?Yi(r):r,-n),n>=0)}function Td(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 W0(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 cL(t,e,n){let r=t.state,s=t.root.activeElement;r!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),s!=t.dom&&s&&s.focus()}}function D9(t,e,n){let r=e.selection,s=n=="up"?r.$from:r.$to;return cL(t,e,()=>{let{node:i}=t.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let o=lL(t,s.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let u;if(l.nodeType==1)u=l.getClientRects();else if(l.nodeType==3)u=Yi(l,0,l.nodeValue.length).getClientRects();else continue;for(let d=0;d<u.length;d++){let h=u[d];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 I9=/[\u0590-\u08ac]/;function L9(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,l=t.domSelection();return l?!I9.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:o:cL(t,e,()=>{let{focusNode:u,focusOffset:d,anchorNode:h,anchorOffset:m}=t.domSelectionRange(),y=l.caretBidiLevel;l.modify("move",n,"character");let b=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:v,focusOffset:x}=t.domSelectionRange(),k=v&&!b.contains(v.nodeType==1?v:v.parentNode)||u==v&&d==x;try{l.collapse(h,m),u&&(u!=h||d!=m)&&l.extend&&l.extend(u,d)}catch{}return y!=null&&(l.caretBidiLevel=y),k}):r.pos==r.start()||r.pos==r.end()}let rA=null,sA=null,iA=!1;function P9(t,e,n){return rA==e&&sA==n?iA:(rA=e,sA=n,iA=n=="up"||n=="down"?D9(t,e,n):L9(t,e,n))}const Ms=0,oA=1,gl=2,Xs=3;class rh{constructor(e,n,r,s){this.parent=e,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=Ms,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 s=this.children[n];if(s==e)return r;r+=s.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 i,o;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}else{let i,o;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(o):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=n>ir(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return i}}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 s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],i=r+s.size;if(r==e&&i!=r){for(;!s.border&&s.children.length;)for(let o=0;o<s.children.length;o++){let l=s.children[o];if(l.size){s=l;break}}return s}if(e<i)return s.descAt(e-r-s.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let o=this.children[r],l=i+o.size;if(l>e||o instanceof dL){s=e-i;break}i=l}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof uL&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?ir(i.dom)+1:0}}else{let i,o=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,o=!1);return i&&o&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?ir(i.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 s=-1,i=-1;for(let o=r,l=0;;l++){let u=this.children[l],d=o+u.size;if(s==-1&&e<=d){let h=o+u.border;if(e>=h&&n<=d-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 y=this.children[m-1];if(y.size&&y.dom.parentNode==this.contentDOM&&!y.emptyChildAt(1)){s=ir(y.dom)+1;break}e-=y.size}s==-1&&(s=0)}if(s>-1&&(d>n||l==this.children.length-1)){n=d;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)){i=ir(m.dom);break}n+=m.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=d}return{node:this.contentDOM,from:e,to:n,fromOffset:s,toOffset:i}}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,s=!1){let i=Math.min(e,n),o=Math.max(e,n);for(let b=0,v=0;b<this.children.length;b++){let x=this.children[b],k=v+x.size;if(i>v&&o<k)return x.setSelection(e-v-x.border,n-v-x.border,r,s);v=k}let l=this.domFromPos(e,e?-1:1),u=n==e?l:this.domFromPos(n,n?-1:1),d=r.root.getSelection(),h=r.domSelectionRange(),m=!1;if((Ns||gr)&&e==n){let{node:b,offset:v}=l;if(b.nodeType==3){if(m=!!(v&&b.nodeValue[v-1]==`
70
+ `),m&&v==b.nodeValue.length)for(let x=b,k;x;x=x.parentNode){if(k=x.nextSibling){k.nodeName=="BR"&&(l=u={node:k.parentNode,offset:ir(k)+1});break}let E=x.pmViewDesc;if(E&&E.node&&E.node.isBlock)break}}else{let x=b.childNodes[v-1];m=x&&(x.nodeName=="BR"||x.contentEditable=="false")}}if(Ns&&h.focusNode&&h.focusNode!=u.node&&h.focusNode.nodeType==1){let b=h.focusNode.childNodes[h.focusOffset];b&&b.contentEditable=="false"&&(s=!0)}if(!(s||m&&gr)&&Ol(l.node,l.offset,h.anchorNode,h.anchorOffset)&&Ol(u.node,u.offset,h.focusNode,h.focusOffset))return;let y=!1;if((d.extend||e==n)&&!(m&&Ns)){d.collapse(l.node,l.offset);try{e!=n&&d.extend(u.node,u.offset),y=!0}catch{}}if(!y){if(e>n){let v=l;l=u,u=v}let b=document.createRange();b.setEnd(u.node,u.offset),b.setStart(l.node,l.offset),d.removeAllRanges(),d.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,s=0;s<this.children.length;s++){let i=this.children[s],o=r+i.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let l=r+i.border,u=o-i.border;if(e>=l&&n<=u){this.dirty=e==r||n==o?gl:oA,e==l&&n==u&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Xs:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?gl:Xs}r=o}this.dirty=gl}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?gl:oA;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class uL extends rh{constructor(e,n,r,s){let i,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!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,i=this}matchesWidget(e){return this.dirty==Ms&&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 $9 extends rh{constructor(e,n,r,s){super(e,[],n,null),this.textDOM=r,this.text=s}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 va extends rh{constructor(e,n,r,s,i){super(e,[],r,s),this.mark=n,this.spec=i}static create(e,n,r,s){let i=s.nodeViews[n.type.name],o=i&&i(n,s,r);return(!o||!o.dom)&&(o=Ul.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new va(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Xs||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Xs&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Ms){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Ms}}slice(e,n,r){let s=va.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;n<o&&(i=Ix(i,n,o,r)),e>0&&(i=Ix(i,0,e,r));for(let l=0;l<i.length;l++)i[l].parent=s;return s.children=i,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class wa extends rh{constructor(e,n,r,s,i,o,l){super(e,[],i,o),this.node=n,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=l}static create(e,n,r,s,i,o){let l=i.nodeViews[n.type.name],u,d=l&&l(n,i,()=>{if(!u)return o;if(u.parent)return u.parent.posBeforeChild(u)},r,s),h=d&&d.dom,m=d&&d.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}=Ul.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 y=h;return h=pL(h,r,n),d?u=new z9(e,n,r,s,h,m||null,y,d):n.isText?new xy(e,n,r,s,h,y):new wa(e,n,r,s,h,m||null,y)}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 s=this.children[r];if(this.dom.contains(s.dom.parentNode)){n.contentElement=s.dom.parentNode;break}}if(!n.contentElement){let r=e&&e.find(s=>s.nodeType==1&&e.indexOf(s.parentNode)<0&&this.dom.contains(s));r?n.contentElement=r:n.getContent=()=>ge.empty}}return n}matchesNode(e,n,r){return this.dirty==Ms&&e.eq(this.node)&&og(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,s=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,l=i&&i.pos<0,u=new F9(this,o&&o.node,e);U9(this.node,this.innerDeco,(d,h,m)=>{d.spec.marks?u.syncToMarks(d.spec.marks,r,e,h):d.type.side>=0&&!m&&u.syncToMarks(h==this.node.childCount?Wt.none:this.node.child(h).marks,r,e,h),u.placeWidget(d,e,s)},(d,h,m,y)=>{u.syncToMarks(d.marks,r,e,y);let b;u.findNodeMatch(d,h,m,y)||l&&e.state.selection.from>s&&e.state.selection.to<s+d.nodeSize&&(b=u.findIndexWithChild(i.node))>-1&&u.updateNodeAt(d,h,m,b,e)||u.updateNextNode(d,h,m,e,y,s)||u.addNode(d,h,m,e,s),s+=d.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==gl)&&(o&&this.protectLocalComposition(e,o),fL(this.contentDOM,this.children,e),du&&W9(this.dom))}localCompositionInfo(e,n){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof Ue)||r<n||s>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,l=q9(this.node.content,o,r-n,s-n);return l<0?null:{node:i,pos:l,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new $9(this,i,n,s);e.input.compositionNodes.push(o),this.children=Ix(this.children,r,r+s.length,e,o)}update(e,n,r,s){return this.dirty==Xs||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,s),!0)}updateInner(e,n,r,s){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Ms}updateOuterDeco(e){if(og(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=hL(this.dom,this.nodeDOM,Dx(this.outerDeco,this.node,n),Dx(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 aA(t,e,n,r,s){pL(r,e,t);let i=new wa(void 0,t,e,n,r,r,r);return i.contentDOM&&i.updateChildren(s,0),i}class xy extends wa{constructor(e,n,r,s,i,o){super(e,n,r,s,i,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,s){return this.dirty==Xs||this.dirty!=Ms&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Ms||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=Ms,!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 s=this.node.cut(e,n),i=document.createTextNode(s.text);return new xy(this.parent,s,this.outerDeco,this.innerDeco,i,i)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Xs)}get domAtom(){return!1}isText(e){return this.node.text==e}}class dL extends rh{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ms&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class z9 extends wa{constructor(e,n,r,s,i,o,l,u){super(e,n,r,s,i,o,l),this.spec=u}update(e,n,r,s){if(this.dirty==Xs)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,s),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,s){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,s)}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 fL(t,e,n){let r=t.firstChild,s=!1;for(let i=0;i<e.length;i++){let o=e[i],l=o.dom;if(l.parentNode==t){for(;l!=r;)r=lA(r),s=!0;r=r.nextSibling}else s=!0,t.insertBefore(l,r);if(o instanceof va){let u=r?r.previousSibling:t.lastChild;fL(o.contentDOM,o.children,n),r=u?u.nextSibling:t.firstChild}}for(;r;)r=lA(r),s=!0;s&&n.trackWrites==t&&(n.trackWrites=null)}const ef=function(t){t&&(this.nodeName=t)};ef.prototype=Object.create(null);const yl=[new ef];function Dx(t,e,n){if(t.length==0)return yl;let r=n?yl[0]:new ef,s=[r];for(let i=0;i<t.length;i++){let o=t[i].type.attrs;if(o){o.nodeName&&s.push(r=new ef(o.nodeName));for(let l in o){let u=o[l];u!=null&&(n&&s.length==1&&s.push(r=new ef(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 s}function hL(t,e,n,r){if(n==yl&&r==yl)return e;let s=e;for(let i=0;i<r.length;i++){let o=r[i],l=n[i];if(i){let u;l&&l.nodeName==o.nodeName&&s!=t&&(u=s.parentNode)&&u.nodeName.toLowerCase()==o.nodeName||(u=document.createElement(o.nodeName),u.pmIsDeco=!0,u.appendChild(s),l=yl[0]),s=u}B9(s,l||yl[0],o)}return s}function B9(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):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&t.classList.add(s[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)t.style.removeProperty(s[1])}n.style&&(t.style.cssText+=n.style)}}function pL(t,e,n){return hL(t,t,yl,Dx(e,n,t.nodeType!=1))}function og(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 lA(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class F9{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=V9(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,s){let i=0,o=this.stack.length>>1,l=Math.min(o,e.length);for(;i<l&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=Ms,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,d=this.top.children.length;s<this.preMatch.index&&(d=Math.min(this.index+3,d));for(let h=this.index;h<d;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 va&&h.dirty!=Xs&&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=va.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,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=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 d=this.top.children[l];if(d.matchesNode(e,n,r)&&!this.preMatch.matched.has(d)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,s,i){let o=this.top.children[s];return o.dirty==Xs&&o.dom==o.contentDOM&&(o.dirty=gl),o.update(e,n,r,i)?(this.destroyBetween(this.index,s),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 s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=n}}updateNextNode(e,n,r,s,i,o){for(let l=this.index;l<this.top.children.length;l++){let u=this.top.children[l];if(u instanceof wa){let d=this.preMatch.matched.get(u);if(d!=null&&d!=i)return!1;let h=u.dom,m,y=this.isLocked(h)&&!(e.isText&&u.node&&u.node.isText&&u.nodeDOM.nodeValue==e.text&&u.dirty!=Xs&&og(n,u.outerDeco));if(!y&&u.update(e,n,r,s))return this.destroyBetween(this.index,l),u.dom!=h&&(this.changed=!0),this.index++,!0;if(!y&&(m=this.recreateWrapper(u,e,n,r,s,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=m,m.contentDOM&&(m.dirty=gl,m.updateChildren(s,o+1),m.dirty=Ms),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,s,i,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!og(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let l=wa.create(this.top,n,r,s,i,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,s,i){let o=wa.create(this.top,e,n,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new uL(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof va;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof xy)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((gr||ar)&&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 s=new dL(this.top,[],r,null);n!=this.top?n.children.push(s):n.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function V9(t,e){let n=e,r=n.children.length,s=t.childCount,i=new Map,o=[];e:for(;s>0;){let l;for(;;)if(r){let d=n.children[r-1];if(d instanceof va)n=d,r=d.children.length;else{l=d,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(s-1))break;--s,i.set(l,s),o.push(l)}}return{index:s,matched:i,matches:o.reverse()}}function H9(t,e){return t.type.side-e.type.side}function U9(t,e,n,r){let s=e.locals(t),i=0;if(s.length==0){for(let d=0;d<t.childCount;d++){let h=t.child(d);r(h,s,e.forChild(i,h),d),i+=h.nodeSize}return}let o=0,l=[],u=null;for(let d=0;;){let h,m;for(;o<s.length&&s[o].to==i;){let k=s[o++];k.widget&&(h?(m||(m=[h])).push(k):h=k)}if(h)if(m){m.sort(H9);for(let k=0;k<m.length;k++)n(m[k],d,!!u)}else n(h,d,!!u);let y,b;if(u)b=-1,y=u,u=null;else if(d<t.childCount)b=d,y=t.child(d++);else break;for(let k=0;k<l.length;k++)l[k].to<=i&&l.splice(k--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)l.push(s[o++]);let v=i+y.nodeSize;if(y.isText){let k=v;o<s.length&&s[o].from<k&&(k=s[o].from);for(let E=0;E<l.length;E++)l[E].to<k&&(k=l[E].to);k<v&&(u=y.cut(k-i),y=y.cut(0,k-i),v=k,b=-1)}else for(;o<s.length&&s[o].to<v;)o++;let x=y.isInline&&!y.isLeaf?l.filter(k=>!k.inline):l.slice();r(y,x,e.forChild(i,y),b),i=v}}function W9(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 q9(t,e,n,r){for(let s=0,i=0;s<t.childCount&&i<=r;){let o=t.child(s++),l=i;if(i+=o.nodeSize,!o.isText)continue;let u=o.text;for(;s<t.childCount;){let d=t.child(s++);if(i+=d.nodeSize,!d.isText)break;u+=d.text}if(i>=n){if(i>=r&&u.slice(r-e.length-l,r-l)==e)return r-e.length;let d=l<r?u.lastIndexOf(e,r-l-1):-1;if(d>=0&&d+e.length+l>=n)return l+d;if(n==r&&u.length>=r+e.length-l&&u.slice(r-l,r-l+e.length)==e)return r}}return-1}function Ix(t,e,n,r,s){let i=[];for(let o=0,l=0;o<t.length;o++){let u=t[o],d=l,h=l+=u.size;d>=n||h<=e?i.push(u):(d<e&&i.push(u.slice(0,e-d,r)),s&&(i.push(s),s=void 0),h>n&&i.push(u.slice(n-d,u.size,r)))}return i}function Rk(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),i=s&&s.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let l=r.resolve(o),u,d;if(wy(n)){for(u=o;s&&!s.node;)s=s.parent;let m=s.node;if(s&&m.isAtom&&Ge.isSelectable(m)&&s.parent&&!(m.isInline&&v9(n.focusNode,n.focusOffset,s.dom))){let y=s.posBefore;d=new Ge(o==y?l:r.resolve(y))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=o,y=o;for(let b=0;b<n.rangeCount;b++){let v=n.getRangeAt(b);m=Math.min(m,t.docView.posFromDOM(v.startContainer,v.startOffset,1)),y=Math.max(y,t.docView.posFromDOM(v.endContainer,v.endOffset,-1))}if(m<0)return null;[u,o]=y==t.state.selection.anchor?[y,m]:[m,y],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(!d){let m=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;d=Ok(t,h,l,m)}return d}function mL(t){return t.editable?t.hasFocus():yL(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function uo(t,e=!1){let n=t.state.selection;if(gL(t,n),!mL(t))return;let r=t.input.mouseDown;if(!e&&ar&&r){let s=t.domSelectionRange(),i=t.domObserver.currentSelection;if(s.anchorNode&&i.anchorNode&&Ol(s.anchorNode,s.anchorOffset,i.anchorNode,i.anchorOffset)&&r.delaySelUpdate()){t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Y9(t);else{let{anchor:s,head:i}=n,o,l;cA&&!(n instanceof Ue)&&(n.$from.parent.inlineContent||(o=uA(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=uA(t,n.to))),t.docView.setSelection(s,i,t,e),cA&&(o&&dA(o),l&&dA(l)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&G9(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}const cA=gr||ar&&nL<63;function uA(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),s=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(gr&&s&&s.contentEditable=="false")return q0(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return q0(s);if(i)return q0(i)}}function q0(t){return t.contentEditable="true",gr&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function dA(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function G9(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!mL(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Y9(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,ir(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Br&&ba<=11&&(n.disabled=!0,n.disabled=!1)}function gL(t,e){if(e instanceof Ge){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(fA(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else fA(t)}function fA(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Ok(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||Ue.between(e,n,r)}function hA(t){return t.editable&&!t.hasFocus()?!1:yL(t)}function yL(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 K9(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Ol(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Lx(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),i=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return i&&nt.findFrom(i,e)}function Qo(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function pA(t,e,n){let r=t.state.selection;if(r instanceof Ue)if(n.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return Qo(t,new Ue(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=Lx(t.state,e);return s&&s instanceof Ge?Qo(t,s):!1}else if(!(Cs&&n.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let l=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=t.docView.descAt(l))&&!o.contentDOM?Ge.isSelectable(i)?Qo(t,new Ge(e<0?t.state.doc.resolve(s.pos-i.nodeSize):s)):nh?Qo(t,new Ue(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Ge&&r.node.isInline)return Qo(t,new Ue(e>0?r.$to:r.$from));{let s=Lx(t.state,e);return s?Qo(t,s):!1}}}function ag(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function tf(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ac(t,e){return e<0?Z9(t):X9(t)}function Z9(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,i,o=!1;for(Ns&&n.nodeType==1&&r<ag(n)&&tf(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(tf(l,-1))s=n,i=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(bL(n))break;{let l=n.previousSibling;for(;l&&tf(l,-1);)s=n.parentNode,i=ir(l),l=l.previousSibling;if(l)n=l,r=ag(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Px(t,n,r):s&&Px(t,s,i)}function X9(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=ag(n),i,o;for(;;)if(r<s){if(n.nodeType!=1)break;let l=n.childNodes[r];if(tf(l,1))i=n,o=++r;else break}else{if(bL(n))break;{let l=n.nextSibling;for(;l&&tf(l,1);)i=l.parentNode,o=ir(l)+1,l=l.nextSibling;if(l)n=l,r=0,s=ag(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}i&&Px(t,i,o)}function bL(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function J9(t,e){for(;t&&e==t.childNodes.length&&!th(t);)e=ir(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 Q9(t,e){for(;t&&!e&&!th(t);)e=ir(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 Px(t,e,n){if(e.nodeType!=3){let i,o;(o=J9(e,n))?(e=o,n=0):(i=Q9(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(wy(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:s}=t;setTimeout(()=>{t.state==s&&uo(t)},50)}function mA(t,e){let n=t.state.doc.resolve(e);if(!(ar||rL)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function gA(t,e,n){let r=t.state.selection;if(r instanceof Ue&&!r.empty||n.indexOf("s")>-1||Cs&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Lx(t.state,e);if(o&&o instanceof Ge)return Qo(t,o)}if(!s.parent.inlineContent){let o=e<0?s:i,l=r instanceof is?nt.near(o,e):nt.findFrom(o,e);return l?Qo(t,l):!1}return!1}function yA(t,e){if(!(t.state.selection instanceof Ue))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function bA(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function e8(t){if(!gr||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;bA(t,r,"true"),setTimeout(()=>bA(t,r,"false"),20)}return!1}function t8(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function n8(t,e){let n=e.keyCode,r=t8(e);if(n==8||Cs&&n==72&&r=="c")return yA(t,-1)||Ac(t,-1);if(n==46&&!e.shiftKey||Cs&&n==68&&r=="c")return yA(t,1)||Ac(t,1);if(n==13||n==27)return!0;if(n==37||Cs&&n==66&&r=="c"){let s=n==37?mA(t,t.state.selection.from)=="ltr"?-1:1:-1;return pA(t,s,r)||Ac(t,s)}else if(n==39||Cs&&n==70&&r=="c"){let s=n==39?mA(t,t.state.selection.from)=="ltr"?1:-1:1;return pA(t,s,r)||Ac(t,s)}else{if(n==38||Cs&&n==80&&r=="c")return gA(t,-1,r)||Ac(t,-1);if(n==40||Cs&&n==78&&r=="c")return e8(t)||gA(t,1,r)||Ac(t,1);if(r==(Cs?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function jk(t,e){t.someProp("transformCopied",b=>{e=b(e,t)});let n=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;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")||Ul.fromSchema(t.state.schema),l=CL(),u=l.createElement("div");u.appendChild(o.serializeFragment(r,{document:l}));let d=u.firstChild,h,m=0;for(;d&&d.nodeType==1&&(h=kL[d.nodeName.toLowerCase()]);){for(let b=h.length-1;b>=0;b--){let v=l.createElement(h[b]);for(;u.firstChild;)v.appendChild(u.firstChild);u.appendChild(v),m++}d=u.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${s} ${i}${m?` -${m}`:""} ${JSON.stringify(n)}`);let y=t.someProp("clipboardTextSerializer",b=>b(e,t))||e.content.textBetween(0,e.content.size,`
71
+
72
+ `);return{dom:u,text:y,slice:e}}function vL(t,e,n,r,s){let i=s.parent.type.spec.code,o,l;if(!n&&!e)return null;let u=!!e&&(r||i||!n);if(u){if(t.someProp("transformPastedText",y=>{e=y(e,i||r,t)}),i)return l=new Oe(ge.from(t.state.schema.text(e.replace(/\r\n?/g,`
73
+ `))),0,0),t.someProp("transformPasted",y=>{l=y(l,t,!0)}),l;let m=t.someProp("clipboardTextParser",y=>y(e,s,r,t));if(m)l=m;else{let y=s.marks(),{schema:b}=t.state,v=Ul.fromSchema(b);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(x=>{let k=o.appendChild(document.createElement("p"));x&&k.appendChild(v.serializeNode(b.text(x,y)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=o8(n),nh&&a8(o);let d=o&&o.querySelector("[data-pm-slice]"),h=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let m=+h[3];m>0;m--){let y=o.firstChild;for(;y&&y.nodeType!=1;)y=y.nextSibling;if(!y)break;o=y}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||lo.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||h),context:s,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!r8.test(y.parentNode.nodeName)?{ignore:!0}:null}})),h)l=l8(vA(l,+h[1],+h[2]),h[4]);else if(l=Oe.maxOpen(s8(l.content,s),!0),l.openStart||l.openEnd){let m=0,y=0;for(let b=l.content.firstChild;m<l.openStart&&!b.type.spec.isolating;m++,b=b.firstChild);for(let b=l.content.lastChild;y<l.openEnd&&!b.type.spec.isolating;y++,b=b.lastChild);l=vA(l,m,y)}return t.someProp("transformPasted",m=>{l=m(l,t,u)}),l}const r8=/^(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 s8(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(l=>{if(!o)return;let u=s.findWrapping(l.type),d;if(!u)return o=null;if(d=o.length&&i.length&&xL(u,i,l,o[o.length-1],0))o[o.length-1]=d;else{o.length&&(o[o.length-1]=SL(o[o.length-1],i.length));let h=wL(l,u);o.push(h),s=s.matchType(h.type),i=u}}),o)return ge.from(o)}return t}function wL(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,ge.from(t));return t}function xL(t,e,n,r,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let i=xL(t,e,n,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==t.length-1?n.type:t[s+1]))return r.copy(r.content.append(ge.from(wL(n,t,s+1))))}}function SL(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,SL(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(ge.empty,!0);return t.copy(n.append(r))}function $x(t,e,n,r,s,i){let o=e<0?t.firstChild:t.lastChild,l=o.content;return t.childCount>1&&(i=0),s<r-1&&(l=$x(l,e,n,r,s+1,i)),s>=n&&(l=e<0?o.contentMatchAt(0).fillBefore(l,i<=s).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(ge.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function vA(t,e,n){return e<t.openStart&&(t=new Oe($x(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new Oe($x(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const kL={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 CL(){return document.implementation.createHTMLDocument("title")}let G0=null;function i8(t){let e=window.trustedTypes;return e?(G0||(G0=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),G0.createHTML(t)):t}function o8(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=CL(),r=n.body,s=/<([a-z][^>\s]+)/i.exec(t),i;if((i=s&&kL[s[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=i8(t),i)for(let o=0;o<i.length;o++)r=r.querySelector(i[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 d=l.rules[u];if(d instanceof CSSStyleRule){let h=r.querySelectorAll(d.selectorText);for(let m=0;m<h.length;m++)h[m].style.cssText+=d.style.cssText}}}return r}function a8(t){let e=t.querySelectorAll(ar?"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 l8(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:s,openStart:i,openEnd:o}=t;for(let l=r.length-2;l>=0;l-=2){let u=n.nodes[r[l]];if(!u||u.hasRequiredAttrs())break;s=ge.from(u.create(r[l+1],s)),i++,o++}return new Oe(s,i,o)}const Nr={},Mr={},c8={touchstart:!0,touchmove:!0};class u8{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 d8(t){for(let e in Nr){let n=Nr[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{h8(t,r)&&!Dk(t,r)&&(t.editable||!(r.type in Mr))&&n(t,r)},c8[e]?{passive:!0}:void 0)}gr&&t.dom.addEventListener("input",()=>null),zx(t)}function io(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function f8(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 zx(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Dk(t,r))})}function Dk(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function h8(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 p8(t,e){!Dk(t,e)&&Nr[e.type]&&(t.editable||!(e.type in Mr))&&Nr[e.type](t,e)}Mr.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!ML(t)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(so&&ar&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),du&&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",s=>s(t,fl(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||n8(t,n)?n.preventDefault():io(t,"key")};Mr.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Mr.keypress=(t,e)=>{let n=e;if(ML(t)||!n.charCode||n.ctrlKey&&!n.altKey||Cs&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Ue)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,i))&&t.dispatch(i()),n.preventDefault()}};function sh(t){return{left:t.clientX,top:t.clientY}}function m8(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Ik(t,e,n,r,s){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,l=>o>i.depth?l(t,n,i.nodeAfter,i.before(o),s,!0):l(t,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function ih(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 g8(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Ge.isSelectable(r)?(ih(t,new Ge(n)),!0):!1}function y8(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof Ge&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let l=o>i.depth?i.nodeAfter:i.node(o);if(Ge.isSelectable(l)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(ih(t,Ge.create(t.state.doc,s)),!0):!1}function b8(t,e,n,r,s){return Ik(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(s?y8(t,n):g8(t,n))}function v8(t,e,n,r){return Ik(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function w8(t,e,n,r){return Ik(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||x8(t,n,r)}function x8(t,e,n){if(n.button!=0)return!1;let r=EL(t,e,!0),s=t.state.doc;return r?(ih(t,r),r instanceof Ue&&s.eq(t.state.doc)&&(t.input.mouseDown=new k8(t,r)),!0):!1}function EL(t,e,n){let r=t.state.doc;if(e==-1)return r.inlineContent?Ue.create(r,0,r.content.size):null;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),l=s.before(i);if(o.inlineContent)return Ue.create(r,l+1,l+1+o.content.size);if(n&&Ge.isSelectable(o))return Ge.create(r,l)}return null}function Lk(t){return lg(t)}const TL=Cs?"metaKey":"ctrlKey";Nr.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Lk(t),s=Date.now(),i="singleClick";s-t.input.lastClick.time<500&&m8(n,t.input.lastClick)&&!n[TL]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:i,button:n.button},t.input.mouseDown&&t.input.mouseDown.done();let o=t.posAtCoords(sh(n));o&&(i=="singleClick"?t.input.mouseDown=new S8(t,o,n,!!r):(i=="doubleClick"?v8:w8)(t,o.pos,o.inside,n)?n.preventDefault():io(t,"pointer"))};class NL{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 S8 extends NL{constructor(e,n,r,s){super(e),this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[TL],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let h=e.state.doc.resolve(n.pos);i=h.parent,o=h.depth?h.before():0}const l=s?null:r.target,u=l?e.docView.nearestDesc(l,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:d}=e.state;r.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||d instanceof Ge&&d.from<=o&&d.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ns&&!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()),io(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||uo(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(sh(e))),this.updateAllowDefault(e),this.allowDefault||!n?io(this.view,"pointer"):b8(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||gr&&this.mightDrag&&!this.mightDrag.node.isAtom||ar&&!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)?(ih(this.view,nt.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):io(this.view,"pointer")}move(e){this.updateAllowDefault(e),io(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 k8 extends NL{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(),io(this.view,"pointer");let n=this.view.posAtCoords(sh(e)),r=n&&EL(this.view,n.inside,!1);if(!r)return;let{doc:s}=this.view.state,i=this.startSelection,[o,l]=r.from<i.from?[i.to,r.from]:[i.from,r.to];ih(this.view,Ue.create(s,o,l))}}Nr.touchstart=t=>{t.input.lastTouch=Date.now(),Lk(t),io(t,"pointer")};Nr.touchmove=t=>{t.input.lastTouch=Date.now(),io(t,"pointer")};Nr.contextmenu=t=>Lk(t);function ML(t,e){return t.composing?!0:gr&&Math.abs(Date.now()-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const C8=so?5e3:-1;Mr.compositionstart=Mr.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Ue&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ar&&rL&&E8(t)))t.markCursor=t.state.storedMarks||n.marks(),lg(t,!0),t.markCursor=null;else if(lg(t,!e.selection.empty),Ns&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let l=t.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}t.input.composing=!0}_L(t,C8)};function E8(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"}Mr.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++,_L(t,20))};function _L(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>lg(t),e))}function AL(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function T8(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=y9(e.focusNode,e.focusOffset),r=b9(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!s||!s.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 lg(t,e=!1){if(!(so&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),AL(t),e||t.docView&&t.docView.dirty){let n=Rk(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 N8(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(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Rf=Br&&ba<15||du&&S9<604;Nr.copy=Mr.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let i=Rf?null:n.clipboardData,o=r.content(),{dom:l,text:u}=jk(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",u)):N8(t,l),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function M8(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function _8(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 s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Of(t,r.value,null,s,e):Of(t,r.textContent,r.innerHTML,s,e)},50)}function Of(t,e,n,r,s){let i=vL(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,s,i||Oe.empty)))return!0;if(!i)return!1;let o=M8(i),l=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function RL(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," "):""}Mr.paste=(t,e)=>{let n=e;if(t.composing&&!so)return;let r=Rf?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Of(t,RL(r),r.getData("text/html"),s,n)?n.preventDefault():_8(t,n)};class OL{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const A8=Cs?"altKey":"ctrlKey";function jL(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[A8]}Nr.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,i=s.empty?null:t.posAtCoords(sh(n)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof Ge?s.to-1:s.to))){if(r&&r.mightDrag)o=Ge.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=Ge.create(t.state.doc,m.posBefore))}}let l=(o||t.state.selection).content(),{dom:u,text:d,slice:h}=jk(t,l);(!n.dataTransfer.files.length||!ar||nL>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Rf?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",Rf||n.dataTransfer.setData("text/plain",d),t.dragging=new OL(h,jL(t,n),o)};Nr.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Mr.dragover=Mr.dragenter=(t,e)=>e.preventDefault();Mr.drop=(t,e)=>{try{R8(t,e,t.dragging)}finally{t.dragging=null}};function R8(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(sh(e));if(!r)return;let s=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",b=>{i=b(i,t,!1)}):i=vL(t,RL(e.dataTransfer),Rf?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(n&&jL(t,e));if(t.someProp("handleDrop",b=>b(t,e,i||Oe.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?DI(t.state.doc,s.pos,i):s.pos;l==null&&(l=s.pos);let u=t.state.tr;if(o){let{node:b}=n;b?b.replace(u):u.deleteSelection()}let d=u.mapping.map(l),h=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,m=u.doc;if(h?u.replaceRangeWith(d,d,i.content.firstChild):u.replaceRange(d,d,i),u.doc.eq(m))return;let y=u.doc.resolve(d);if(h&&Ge.isSelectable(i.content.firstChild)&&y.nodeAfter&&y.nodeAfter.sameMarkup(i.content.firstChild))u.setSelection(new Ge(y));else{let b=u.mapping.map(l);u.mapping.maps[u.mapping.maps.length-1].forEach((v,x,k,E)=>b=E),u.setSelection(Ok(t,y,u.doc.resolve(b)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}Nr.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())&&uo(t)},20))};Nr.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)};Nr.beforeinput=(t,e)=>{if(so&&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",i=>i(t,fl(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in Mr)Nr[t]=Mr[t];function jf(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 cg{constructor(e,n){this.toDOM=e,this.spec=n||Cl,this.side=this.spec.side||0}map(e,n,r,s){let{pos:i,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new Un(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof cg&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&jf(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class xa{constructor(e,n){this.attrs=e,this.spec=n||Cl}map(e,n,r,s){let i=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new Un(i,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof xa&&jf(this.attrs,e.attrs)&&jf(this.spec,e.spec)}static is(e){return e.type instanceof xa}destroy(){}}class Pk{constructor(e,n){this.attrs=e,this.spec=n||Cl}map(e,n,r,s){let i=e.mapResult(n.from+s,1);if(i.deleted)return null;let o=e.mapResult(n.to+s,-1);return o.deleted||o.pos<=i.pos?null:new Un(i.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:s}=e.content.findIndex(n.from),i;return s==n.from&&!(i=e.child(r)).isText&&s+i.nodeSize==n.to}eq(e){return this==e||e instanceof Pk&&jf(this.attrs,e.attrs)&&jf(this.spec,e.spec)}destroy(){}}class Un{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Un(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 Un(e,e,new cg(n,r))}static inline(e,n,r,s){return new Un(e,n,new xa(r,s))}static node(e,n,r,s){return new Un(e,n,new Pk(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof xa}get widget(){return this.type instanceof cg}}const Hc=[],Cl={};class Dt{constructor(e,n){this.local=e.length?e:Hc,this.children=n.length?n:Hc}static create(e,n){return n.length?ug(n,e,0,Cl):hr}find(e,n,r){let s=[];return this.findInner(e??0,n??1e9,s,0,r),s}findInner(e,n,r,s,i){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+s,l.to+s))}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,s+l,i)}}map(e,n,r){return this==hr||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Cl)}mapInner(e,n,r,s,i){let o;for(let l=0;l<this.local.length;l++){let u=this.local[l].map(e,r,s);u&&u.type.valid(n,u)?(o||(o=[])).push(u):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?O8(this.children,o||[],e,n,r,s,i):o?new Dt(o.sort(El),Hc):hr}add(e,n){return n.length?this==hr?Dt.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let s,i=0;e.forEach((l,u)=>{let d=u+r,h;if(h=IL(n,l,d)){for(s||(s=this.children.slice());i<s.length&&s[i]<u;)i+=3;s[i]==u?s[i+2]=s[i+2].addInner(l,h,d+1):s.splice(i,0,u,u+l.nodeSize,ug(h,l,d+1,Cl)),i+=3}});let o=DL(i?LL(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new Dt(o.length?this.local.concat(o).sort(El):this.local,s||this.children)}remove(e){return e.length==0||this==hr?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,l=r[i]+n,u=r[i+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 d=r[i+2].removeInner(o,l+1);d!=hr?r[i+2]=d:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let l=0;l<s.length;l++)s[l].eq(o,n)&&(s==this.local&&(s=this.local.slice()),s.splice(l--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new Dt(s,r):hr}forChild(e,n){if(this==hr)return this;if(n.isLeaf)return Dt.empty;let r,s;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 i=e+1,o=i+n.content.size;for(let l=0;l<this.local.length;l++){let u=this.local[l];if(u.from<o&&u.to>i&&u.type instanceof xa){let d=Math.max(i,u.from)-i,h=Math.min(o,u.to)-i;d<h&&(s||(s=[])).push(u.copy(d,h))}}if(s){let l=new Dt(s.sort(El),Hc);return r?new oa([l,r]):l}return r||hr}eq(e){if(this==e)return!0;if(!(e instanceof Dt)||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 $k(this.localsInner(e))}localsInner(e){if(this==hr)return Hc;if(e.inlineContent||!this.local.some(xa.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof xa||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Dt.empty=new Dt([],[]);Dt.removeOverlap=$k;const hr=Dt.empty;class oa{constructor(e){this.members=e}map(e,n){const r=this.members.map(s=>s.map(e,n,Cl));return oa.from(r)}forChild(e,n){if(n.isLeaf)return Dt.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,n);i!=hr&&(i instanceof oa?r=r.concat(i.members):r.push(i))}return oa.from(r)}eq(e){if(!(e instanceof oa)||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 s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let o=0;o<i.length;o++)n.push(i[o])}}return n?$k(r?n:n.sort(El)):Hc}static from(e){switch(e.length){case 0:return hr;case 1:return e[0];default:return new oa(e.every(n=>n instanceof Dt)?e:e.reduce((n,r)=>n.concat(r instanceof Dt?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function O8(t,e,n,r,s,i,o){let l=t.slice();for(let d=0,h=i;d<n.maps.length;d++){let m=0;n.maps[d].forEach((y,b,v,x)=>{let k=x-v-(b-y);for(let E=0;E<l.length;E+=3){let M=l[E+1];if(M<0||y>M+h-m)continue;let _=l[E]+h-m;b>=_?l[E+1]=y<=_?-2:-1:y>=h&&k&&(l[E]+=k,l[E+1]+=k)}m+=k}),h=n.maps[d].map(h,-1)}let u=!1;for(let d=0;d<l.length;d+=3)if(l[d+1]<0){if(l[d+1]==-2){u=!0,l[d+1]=-1;continue}let h=n.map(t[d]+i),m=h-s;if(m<0||m>=r.content.size){u=!0;continue}let y=n.map(t[d+1]+i,-1),b=y-s,{index:v,offset:x}=r.content.findIndex(m),k=r.maybeChild(v);if(k&&x==m&&x+k.nodeSize==b){let E=l[d+2].mapInner(n,k,h+1,t[d]+i+1,o);E!=hr?(l[d]=m,l[d+1]=b,l[d+2]=E):(l[d+1]=-2,u=!0)}else u=!0}if(u){let d=j8(l,t,e,n,s,i,o),h=ug(d,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,y=0;m<h.children.length;m+=3){let b=h.children[m];for(;y<l.length&&l[y]<b;)y+=3;l.splice(y,0,h.children[m],h.children[m+1],h.children[m+2])}}return new Dt(e.sort(El),l)}function DL(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let s=t[r];n.push(new Un(s.from+e,s.to+e,s.type))}return n}function j8(t,e,n,r,s,i,o){function l(u,d){for(let h=0;h<u.local.length;h++){let m=u.local[h].map(r,s,d);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]+d+1)}for(let u=0;u<t.length;u+=3)t[u+1]==-1&&l(t[u+2],e[u]+i+1);return n}function IL(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,s=null;for(let i=0,o;i<t.length;i++)(o=t[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),t[i]=null);return s}function LL(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function ug(t,e,n,r){let s=[],i=!1;e.forEach((l,u)=>{let d=IL(t,l,u+n);if(d){i=!0;let h=ug(d,l,n+u+1,r);h!=hr&&s.push(u,u+l.nodeSize,h)}});let o=DL(i?LL(t):t,-n).sort(El);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||s.length?new Dt(o,s):hr}function El(t,e){return t.from-e.from||t.to-e.to}function $k(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let s=n+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[s]=i.copy(i.from,r.to),wA(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),wA(e,s,r.copy(i.from,r.to)));break}}}return e}function wA(t,e,n){for(;e<t.length&&El(n,t[e])>0;)e++;t.splice(e,0,n)}function Y0(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=hr&&e.push(r)}),t.cursorWrapper&&e.push(Dt.create(t.state.doc,[t.cursorWrapper.deco])),oa.from(e)}const D8={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},I8=Br&&ba<=11;let L8=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}};class P8{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new L8,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);Br&&ba<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():gr&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),I8&&(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,D8)),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(hA(this.view)){if(this.suppressingSelectionUpdates)return uo(this.view);if(Br&&ba<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ol(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 i=e.focusNode;i;i=uu(i))n.add(i);for(let i=e.anchorNode;i;i=uu(i))if(n.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.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(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&hA(e)&&!this.ignoreSelectionChange(r),i=-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&&(i=i<0?m.from:Math.min(m.from,i),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||ar&&(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(Ns&&u.length){let h=u.filter(m=>m.nodeName=="BR");if(h.length==2){let[m,y]=h;m.parentNode&&m.parentNode.parentNode==y.parentNode?y.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let y of h){let b=y.parentNode;b&&b.nodeName=="LI"&&(!m||B8(e,m)!=b)&&y.remove()}}}let d=null;i<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&wy(r)&&(d=Rk(e))&&d.eq(nt.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,uo(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),$8(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,F8(e,u)),this.handleDOMChange(i,o,l,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||uo(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 s=e.previousSibling,i=e.nextSibling;if(Br&&ba<=11&&e.addedNodes.length)for(let h=0;h<e.addedNodes.length;h++){let{previousSibling:m,nextSibling:y}=e.addedNodes[h];(!m||Array.prototype.indexOf.call(e.addedNodes,m)<0)&&(s=m),(!y||Array.prototype.indexOf.call(e.addedNodes,y)<0)&&(i=y)}let o=s&&s.parentNode==e.target?ir(s)+1:0,l=r.localPosFromDOM(e.target,o,-1),u=i&&i.parentNode==e.target?ir(i):e.target.childNodes.length,d=r.localPosFromDOM(e.target,u,1);return{from:l,to:d}}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 xA=new WeakMap,SA=!1;function $8(t){if(!xA.has(t)&&(xA.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Ns,SA)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."),SA=!0}}function kA(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return Ol(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function z8(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return kA(t,s)}let n;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?kA(t,n):null}function B8(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 F8(t,e){var n;let{focusNode:r,focusOffset:s}=t.domSelectionRange();for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=i.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(i,l.firstChild),r==i&&t.domSelection().collapse(i,s)}else i.parentNode.removeChild(i)}}function V8(t,e,n,r){let{node:s,fromOffset:i,toOffset:o,from:l,to:u}=t.docView.parseRange(e,n),d=t.domSelectionRange(),h,m=d.anchorNode;if(m&&t.dom.contains(m.nodeType==1?m:m.parentNode)&&(h=[{node:m,offset:d.anchorOffset}],wy(d)||h.push({node:d.focusNode,offset:d.focusOffset})),ar&&t.input.lastKeyCode===8)for(let E=o;E>i;E--){let M=s.childNodes[E-1],_=M.pmViewDesc;if(M.nodeName=="BR"&&!_){o=E;break}if(!_||_.size)break}let y=t.state.doc,b=t.someProp("domParser")||lo.fromSchema(t.state.schema),v=y.resolve(l),x=null,k=b.parse(s,{topNode:v.parent,topMatch:v.parent.contentMatchAt(v.index()),topOpen:!0,from:i,to:o,preserveWhitespace:v.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:H8(r),context:v});if(h&&h[0].pos!=null){let E=h[0].pos,M=h[1]&&h[1].pos;M==null&&(M=E),x={anchor:E+l,head:M+l}}return{doc:k,sel:x,from:l,to:u}}const H8=t=>e=>{let n=e.pmViewDesc;if(n)return n.parseRule(t);if(e.nodeName=="BR"&&e.parentNode){if(gr&&/^(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||gr&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},U8=/^(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 W8(t,e,n,r,s){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let j=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,P=Rk(t,j);if(P&&!t.state.selection.eq(P)){if(ar&&so&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",G=>G(t,fl(13,"Enter"))))return;let O=t.state.tr.setSelection(P);j=="pointer"?O.setMeta("pointer",!0):j=="key"&&O.scrollIntoView(),i&&O.setMeta("composition",i),t.dispatch(O)}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,d=V8(t,e,n,s),h=t.state.doc,m=h.slice(d.from,d.to),y,b;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(y=t.state.selection.to,b="end"):(y=t.state.selection.from,b="start"),t.input.lastKeyCode=null;let v=Y8(m.content,d.doc.content,d.from,y,b);if(v&&t.input.domChangeCount++,(du&&t.input.lastIOSEnter>Date.now()-225||so)&&s.some(j=>j.nodeType==1&&!U8.test(j.nodeName))&&(!v||v.endA>=v.endB)&&t.someProp("handleKeyDown",j=>j(t,fl(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!v)if(r&&u instanceof Ue&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))v={start:u.from,endA:u.to,endB:u.to};else{if(d.sel){let j=CA(t,t.state.doc,d.sel);if(j&&!j.eq(t.state.selection)){let P=t.state.tr.setSelection(j);i&&P.setMeta("composition",i),t.dispatch(P)}}return}t.state.selection.from<t.state.selection.to&&v.start==v.endB&&t.state.selection instanceof Ue&&(v.start>t.state.selection.from&&v.start<=t.state.selection.from+2&&t.state.selection.from>=d.from?v.start=t.state.selection.from:v.endA<t.state.selection.to&&v.endA>=t.state.selection.to-2&&t.state.selection.to<=d.to&&(v.endB+=t.state.selection.to-v.endA,v.endA=t.state.selection.to)),Br&&ba<=11&&v.endB==v.start+1&&v.endA==v.start&&v.start>d.from&&d.doc.textBetween(v.start-d.from-1,v.start-d.from+1)=="  "&&(v.start--,v.endA--,v.endB--);let x=d.doc.resolveNoCache(v.start-d.from),k=d.doc.resolveNoCache(v.endB-d.from),E=h.resolve(v.start),M=x.sameParent(k)&&x.parent.inlineContent&&E.end()>=v.endA;if((du&&t.input.lastIOSEnter>Date.now()-225&&(!M||s.some(j=>j.nodeName=="DIV"||j.nodeName=="P"))||!M&&x.pos<d.doc.content.size&&(!x.sameParent(k)||!x.parent.inlineContent)&&x.pos<k.pos&&!/\S/.test(d.doc.textBetween(x.pos,k.pos,"","")))&&t.someProp("handleKeyDown",j=>j(t,fl(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>v.start&&G8(h,v.start,v.endA,x,k)&&t.someProp("handleKeyDown",j=>j(t,fl(8,"Backspace")))){so&&ar&&t.domObserver.suppressSelectionUpdates();return}ar&&v.endB==v.start&&(t.input.lastChromeDelete=Date.now()),so&&!M&&x.start()!=k.start()&&k.parentOffset==0&&x.depth==k.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==v.endA&&(v.endB-=2,k=d.doc.resolveNoCache(v.endB-d.from),setTimeout(()=>{t.someProp("handleKeyDown",function(j){return j(t,fl(13,"Enter"))})},20));let _=v.start,N=v.endA,T=j=>{let P=j||t.state.tr.replace(_,N,d.doc.slice(v.start-d.from,v.endB-d.from));if(d.sel){let O=CA(t,P.doc,d.sel);O&&!(ar&&t.composing&&O.empty&&(v.start!=v.endB||t.input.lastChromeDelete<Date.now()-100)&&(O.head==_||O.head==P.mapping.map(N)-1)||Br&&O.empty&&O.head==_)&&P.setSelection(O)}return i&&P.setMeta("composition",i),P.scrollIntoView()},A;if(M)if(x.pos==k.pos){Br&&ba<=11&&x.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>uo(t),20));let j=T(t.state.tr.delete(_,N)),P=h.resolve(v.start).marksAcross(h.resolve(v.endA));P&&j.ensureMarks(P),t.dispatch(j)}else if(v.endA==v.endB&&(A=q8(x.parent.content.cut(x.parentOffset,k.parentOffset),E.parent.content.cut(E.parentOffset,v.endA-E.start())))){let j=T(t.state.tr);A.type=="add"?j.addMark(_,N,A.mark):j.removeMark(_,N,A.mark),t.dispatch(j)}else if(x.parent.child(x.index()).isText&&x.index()==k.index()-(k.textOffset?0:1)){let j=x.parent.textBetween(x.parentOffset,k.parentOffset),P=()=>T(t.state.tr.insertText(j,_,N));t.someProp("handleTextInput",O=>O(t,_,N,j,P))||t.dispatch(P())}else t.dispatch(T());else t.dispatch(T())}function CA(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Ok(t,e.resolve(n.anchor),e.resolve(n.head))}function q8(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,s=n,i=r,o,l,u;for(let h=0;h<r.length;h++)s=r[h].removeFromSet(s);for(let h=0;h<n.length;h++)i=n[h].removeFromSet(i);if(s.length==1&&i.length==0)l=s[0],o="add",u=h=>h.mark(l.addToSet(h.marks));else if(s.length==0&&i.length==1)l=i[0],o="remove",u=h=>h.mark(l.removeFromSet(h.marks));else return null;let d=[];for(let h=0;h<e.childCount;h++)d.push(u(e.child(h)));if(ge.from(d).eq(t))return{mark:l,type:o}}function G8(t,e,n,r,s){if(n-e<=s.pos-r.pos||K0(r,!0,!1)<s.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let l=i.nodeAfter;return l!=null&&n==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=t.resolve(K0(i,!0,!0));return!o.parent.isTextblock||o.pos>n||K0(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function K0(t,e,n){let r=t.depth,s=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,s++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function Y8(t,e,n,r,s){let i=t.findDiffStart(e,n),o=n+t.size,l=n+e.size;if(i==null)return null;let{a:u,b:d}=t.findDiffEnd(e,o,l);if(s=="end"){let h=Math.max(0,i-Math.min(u,d));r-=u+h-i}if(u<i&&o<l){let h=r<=i&&r>=u?i-r:0;i-=h,d=i+(d-u),u=i}else if(d<i){let h=r<=i&&r>=d?i-r:0;i-=h,u=i+(u-d),d=i}return{start:i,endA:u,endB:d}}class PL{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 u8,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(_A),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=NA(this),TA(this),this.nodeViews=MA(this),this.docView=aA(this.state.doc,EA(this),Y0(this),this.dom,this),this.domObserver=new P8(this,(r,s,i,o)=>W8(this,r,s,i,o)),this.domObserver.start(),d8(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&&zx(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(_A),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 s=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(AL(this),o=!0),this.state=e;let l=s.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let b=MA(this);Z8(b,this.nodeViews)&&(this.nodeViews=b,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&zx(this),this.editable=NA(this),TA(this);let u=Y0(this),d=EA(this),h=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",m=i||!this.docView.matchesNode(e.doc,d,u);(m||!e.selection.eq(s.selection))&&(o=!0);let y=h=="preserve"&&o&&this.dom.style.overflowAnchor==null&&E9(this);if(o){this.domObserver.stop();let b=m&&(Br||ar)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&K8(s.selection,e.selection);if(m){let x=ar?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=T8(this)),(i||!this.docView.update(e.doc,d,u,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=aA(e.doc,d,u,this.dom,this)),x&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(b=!0)}let v=this.input.mouseDown;b||!(v&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&K9(this)&&v.delaySelUpdate())?uo(this,b):(gL(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),h=="reset"?this.dom.scrollTop=0:h=="to selection"?this.scrollToSelection():y&&T9(y)}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 Ge){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&nA(this,n.getBoundingClientRect(),e)}else nA(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,s=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&i<this.state.doc.content.size&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new OL(e.slice,e.move,s<0?void 0:Ge.create(this.state.doc,s))}someProp(e,n){let r=this._props&&this._props[e],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(s=n?n(l):l))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let l=i[o].props[e];if(l!=null&&(s=n?n(l):l))return s}}hasFocus(){if(Br){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&&N9(this.dom),uo(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 O9(this,e)}coordsAtPos(e,n=1){return lL(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 s=this.docView.posFromDOM(e,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return P9(this,n||this.state,e)}pasteHTML(e,n){return Of(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Of(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return jk(this,e)}destroy(){this.docView&&(f8(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Y0(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,m9())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return p8(this,e)}domSelectionRange(){let e=this.domSelection();return e?gr&&this.root.nodeType===11&&w9(this.dom.ownerDocument)==this.dom&&z8(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}PL.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function EA(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"),[Un.node(0,t.state.doc.content.size,e)]}function TA(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:Un.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function NA(t){return!t.someProp("editable",e=>e(t.state)===!1)}function K8(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 MA(t){let e=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Z8(t,e){let n=0,r=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)r++;return n!=r}function _A(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 Na={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:"'"},dg={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},X8=typeof navigator<"u"&&/Mac/.test(navigator.platform),J8=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var or=0;or<10;or++)Na[48+or]=Na[96+or]=String(or);for(var or=1;or<=24;or++)Na[or+111]="F"+or;for(var or=65;or<=90;or++)Na[or]=String.fromCharCode(or+32),dg[or]=String.fromCharCode(or);for(var Z0 in Na)dg.hasOwnProperty(Z0)||(dg[Z0]=Na[Z0]);function Q8(t){var e=X8&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||J8&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?dg:Na)[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 eG=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),tG=typeof navigator<"u"&&/Win/.test(navigator.platform);function nG(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,i,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))s=!0;else if(/^s(hift)?$/i.test(u))i=!0;else if(/^mod$/i.test(u))eG?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),o&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function rG(t){let e=Object.create(null);for(let n in t)e[nG(n)]=t[n];return e}function X0(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 sG(t){return new Kt({props:{handleKeyDown:zk(t)}})}function zk(t){let e=rG(t);return function(n,r){let s=Q8(r),i,o=e[X0(s,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=e[X0(s,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(tG&&r.ctrlKey&&r.altKey)&&(i=Na[r.keyCode])&&i!=s){let l=e[X0(i,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var iG=Object.defineProperty,Bk=(t,e)=>{for(var n in e)iG(t,n,{get:e[n],enumerable:!0})};function Sy(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:s}=n,{storedMarks:i}=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 i},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,i=n.storedMarks,n}}}var ky=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:s}=n,i=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([o,l])=>[o,(...d)=>{const h=l(...d)(i);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),h}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o=[],l=!!t,u=t||s.tr,d=()=>(!l&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(u),o.every(m=>m===!0)),h={...Object.fromEntries(Object.entries(n).map(([m,y])=>[m,(...v)=>{const x=this.buildProps(u,e),k=y(...v)(x);return o.push(k),h}])),run:d};return h}createCan(t){const{rawCommands:e,state:n}=this,r=!1,s=t||n.tr,i=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(e).map(([l,u])=>[l,(...d)=>u(...d)({...i,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o={tr:t,editor:r,view:i,state:Sy({state:s,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,(...d)=>u(...d)(o)]))}};return o}},Bs={};Bk(Bs,{blur:()=>oG,clearContent:()=>aG,clearNodes:()=>lG,command:()=>cG,createParagraphNear:()=>uG,cut:()=>dG,deleteCurrentNode:()=>fG,deleteNode:()=>hG,deleteRange:()=>pG,deleteSelection:()=>yG,enter:()=>bG,exitCode:()=>vG,extendMarkRange:()=>wG,first:()=>xG,focus:()=>kG,forEach:()=>CG,insertContent:()=>EG,insertContentAt:()=>NG,insertDefaultBlock:()=>MG,joinBackward:()=>RG,joinDown:()=>AG,joinForward:()=>OG,joinItemBackward:()=>jG,joinItemForward:()=>DG,joinTextblockBackward:()=>IG,joinTextblockForward:()=>LG,joinUp:()=>_G,keyboardShortcut:()=>$G,lift:()=>zG,liftEmptyBlock:()=>BG,liftListItem:()=>FG,newlineInCode:()=>VG,resetAttributes:()=>HG,scrollIntoView:()=>UG,selectAll:()=>WG,selectNodeBackward:()=>qG,selectNodeForward:()=>GG,selectParentNode:()=>YG,selectTextblockEnd:()=>KG,selectTextblockStart:()=>ZG,setContent:()=>XG,setMark:()=>g7,setMeta:()=>y7,setNode:()=>b7,setNodeSelection:()=>v7,setTextDirection:()=>w7,setTextSelection:()=>x7,sinkListItem:()=>S7,splitBlock:()=>k7,splitListItem:()=>C7,toggleList:()=>T7,toggleMark:()=>N7,toggleNode:()=>M7,toggleWrap:()=>_7,undoInputRule:()=>A7,unsetAllMarks:()=>R7,unsetMark:()=>O7,unsetTextDirection:()=>j7,updateAttributes:()=>D7,wrapIn:()=>I7,wrapInList:()=>L7});var oG=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),aG=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),lG=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:s}=r;return n&&s.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(l,u)=>{if(l.type.isText)return;const{doc:d,mapping:h}=e,m=d.resolve(h.map(u)),y=d.resolve(h.map(u+l.nodeSize)),b=m.blockRange(y);if(!b)return;const v=Eu(b);if(l.type.isTextblock){const{defaultType:x}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(b.start,x)}(v||v===0)&&e.lift(b,v)})}),!0},cG=t=>e=>t(e),uG=()=>({state:t,dispatch:e})=>XI(t,e),dG=(t,e)=>({editor:n,tr:r})=>{const{state:s}=n,i=s.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new Ue(r.doc.resolve(Math.max(o-1,0)))),!0},fG=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const s=t.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(e){const l=s.before(i),u=s.after(i);t.delete(l,u).scrollIntoView()}return!0}return!1};function jn(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 hG=t=>({tr:e,state:n,dispatch:r})=>{const s=jn(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const u=i.before(o),d=i.after(o);e.delete(u,d).scrollIntoView()}return!0}return!1},pG=t=>({tr:e,dispatch:n})=>{const{from:r,to:s}=t;return n&&e.delete(r,s),!0},mG=t=>t.content?/^text(\*|\+)/.test(t.content):!1,AA=(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 mG(r)?n==="left"?t.start()-1:t.end()+1:t.pos},gG=(t,e,n)=>{const r=AA(t,n,"left"),s=AA(e,n,"right");return{from:r,to:s}},yG=()=>({state:t,dispatch:e})=>{if(t.selection.empty)return!1;if(e){const n=t.tr,{ranges:r}=t.selection,s=n.steps.length;r.forEach(i=>{const o=n.mapping.slice(s),l=n.doc.resolve(o.map(i.$from.pos)),u=n.doc.resolve(o.map(i.$to.pos)),{from:d,to:h}=gG(l,u,t.schema);n.deleteRange(d,h)}),n.selection.empty||n.setSelection(Ue.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),e(n)}return!0},bG=()=>({commands:t})=>t.keyboardShortcut("Enter"),vG=()=>({state:t,dispatch:e})=>e9(t,e);function Fk(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function fg(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>n.strict?e[s]===t[s]:Fk(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function $L(t,e,n={}){return t.find(r=>r.type===e&&fg(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function RA(t,e,n={}){return!!$L(t,e,n)}function Vk(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(d=>d.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(d=>d.type===e))return;if(!n){const d=r.node.marks.find(h=>h.type===e);d&&(n=d.attrs)}if(!$L([...r.node.marks],e,n))return;let i=r.index,o=t.start()+r.offset,l=i+1,u=o+r.node.nodeSize;for(;i>0&&RA([...t.parent.child(i-1).marks],e,n);)i-=1,o-=t.parent.child(i).nodeSize;for(;l<t.parent.childCount&&RA([...t.parent.child(l).marks],e,n);)u+=t.parent.child(l).nodeSize,l+=1;return{from:o,to:u}}function wo(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 wG=(t,e)=>({tr:n,state:r,dispatch:s})=>{const i=wo(t,r.schema),{doc:o,selection:l}=n,{$from:u,from:d,to:h}=l;if(s){const m=Vk(u,i,e);if(m&&m.from<=d&&m.to>=h){const y=Ue.create(o,m.from,m.to);n.setSelection(y)}}return!0},xG=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 zL(t){return t instanceof Ue}function bl(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Bx(t,e=null){if(!e)return null;const n=nt.atStart(t),r=nt.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const s=n.from,i=r.to;return e==="all"?Ue.create(t,bl(0,s,i),bl(t.content.size,s,i)):Ue.create(t,bl(e,s,i),bl(e,s,i))}function OA(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function hg(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function SG(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var kG=(t=null,e={})=>({editor:n,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(hg()||OA())&&r.dom.focus(),SG()&&!hg()&&!OA()&&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(i&&t===null&&!zL(n.state.selection))return o(),!0;const l=Bx(s.doc,t)||n.state.selection,u=n.state.selection.eq(l);return i&&(u||s.setSelection(l),u&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},CG=(t,e)=>n=>t.every((r,s)=>e(r,{...n,index:s})),EG=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),BL=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&&BL(r)}return t};function Fd(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 BL(n)}function fu(t,e,n){if(t instanceof ya||t instanceof ge)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,s=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return ge.fromArray(t.map(l=>e.nodeFromJSON(l)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),fu("",e,n)}if(s){if(n.errorOnInvalidContent){let o=!1,l="";const u=new kI({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:d=>(o=!0,l=typeof d=="string"?d:d.outerHTML,null)}]}})});if(n.slice?lo.fromSchema(u).parseSlice(Fd(t),n.parseOptions):lo.fromSchema(u).parse(Fd(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=lo.fromSchema(e);return n.slice?i.parseSlice(Fd(t),n.parseOptions).content:i.parse(Fd(t),n.parseOptions)}return fu("",e,n)}function FL(t,e,n){const r=t.steps.length-1;if(r<e)return;const s=t.steps[r];if(!(s instanceof Rn||s instanceof Wn))return;const i=t.mapping.maps[r];let o=0;i.forEach((l,u,d,h)=>{o===0&&(o=h)}),t.setSelection(nt.near(t.doc.resolve(o),n))}var TG=t=>!("type"in t),NG=(t,e,n)=>({tr:r,dispatch:s,editor:i})=>{var o;if(s){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const u=k=>{i.emit("contentError",{editor:i,error:k,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{fu(e,i.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(k){u(k)}try{l=fu(e,i.schema,{parseOptions:d,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.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},y=!0,b=!0;if((TG(l)?l:[l]).forEach(k=>{k.check(),y=y?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 x;if(y){if(Array.isArray(e))x=e.map(k=>k.text||"").join("");else if(e instanceof ge){let k="";e.forEach(E=>{E.text&&(k+=E.text)}),x=k}else typeof e=="object"&&e&&e.text?x=e.text:x=e;r.insertText(x,h,m)}else{x=l;const k=r.doc.resolve(h),E=k.node(),M=k.parentOffset===0,_=E.isText||E.isTextblock,N=E.content.size>0;M&&_&&N&&b&&(h=Math.max(0,h-1)),r.replaceWith(h,m,x)}n.updateSelection&&FL(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:h,text:x}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:h,text:x})}return!0};function VL(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 MG=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{pos:s,attrs:i,content:o,updateSelection:l=!0}=t;let u;typeof s=="number"?u=e.doc.resolve(s):s?u=s:u=e.selection.$from;const d=VL(u.parent.contentMatchAt(u.index()));if(!d)return!1;const h=Object.keys(d.spec.attrs||{}),m=i?Object.fromEntries(Object.entries(i).filter(([b])=>h.includes(b))):{};let y;if(o){const b=fu(o,r.schema);y=d.createAndFill(m,b)}else y=d.createAndFill(m);return y?(n&&(e.insert(u.pos,y),l&&FL(e,e.steps.length-1,-1)),!0):!1},_G=()=>({state:t,dispatch:e})=>Xq(t,e),AG=()=>({state:t,dispatch:e})=>Jq(t,e),RG=()=>({state:t,dispatch:e})=>UI(t,e),OG=()=>({state:t,dispatch:e})=>YI(t,e),jG=()=>({state:t,dispatch:e,tr:n})=>{try{const r=yy(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},DG=()=>({state:t,dispatch:e,tr:n})=>{try{const r=yy(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},IG=()=>({state:t,dispatch:e})=>Kq(t,e),LG=()=>({state:t,dispatch:e})=>Zq(t,e);function HL(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function PG(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,s,i,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))s=!0;else if(/^s(hift)?$/i.test(u))i=!0;else if(/^mod$/i.test(u))hg()||HL()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${u}`)}return r&&(n=`Alt-${n}`),s&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var $G=t=>({editor:e,view:n,tr:r,dispatch:s})=>{const i=PG(t).split(/-(?!$)/),o=i.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",d=>d(n,l))});return u?.steps.forEach(d=>{const h=d.map(r.mapping);h&&s&&r.maybeStep(h)}),!0};function Ma(t,e,n={}){const{from:r,to:s,empty:i}=t.selection,o=e?jn(e,t.schema):null,l=[];t.doc.nodesBetween(r,s,(m,y)=>{if(m.isText)return;const b=Math.max(r,y),v=Math.min(s,y+m.nodeSize);l.push({node:m,from:b,to:v})});const u=s-r,d=l.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>fg(m.node.attrs,n,{strict:!1}));return i?!!d.length:d.reduce((m,y)=>m+y.to-y.from,0)>=u}var zG=(t,e={})=>({state:n,dispatch:r})=>{const s=jn(t,n.schema);return Ma(n,s,e)?Qq(n,r):!1},BG=()=>({state:t,dispatch:e})=>JI(t,e),FG=t=>({state:e,dispatch:n})=>{const r=jn(t,e.schema);return d9(r)(e,n)},VG=()=>({state:t,dispatch:e})=>ZI(t,e);function Cy(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function jA(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,s)=>(n.includes(s)||(r[s]=t[s]),r),{})}var HG=(t,e)=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const l=Cy(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(i=jn(t,r.schema)),l==="mark"&&(o=wo(t,r.schema));let u=!1;return n.selection.ranges.forEach(d=>{r.doc.nodesBetween(d.$from.pos,d.$to.pos,(h,m)=>{i&&i===h.type&&(u=!0,s&&n.setNodeMarkup(m,void 0,jA(h.attrs,e))),o&&h.marks.length&&h.marks.forEach(y=>{o===y.type&&(u=!0,s&&n.addMark(m,m+h.nodeSize,o.create(jA(y.attrs,e))))})})}),u},UG=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),WG=()=>({tr:t,dispatch:e})=>{if(e){const n=new is(t.doc);t.setSelection(n)}return!0},qG=()=>({state:t,dispatch:e})=>qI(t,e),GG=()=>({state:t,dispatch:e})=>KI(t,e),YG=()=>({state:t,dispatch:e})=>r9(t,e),KG=()=>({state:t,dispatch:e})=>o9(t,e),ZG=()=>({state:t,dispatch:e})=>i9(t,e);function Fx(t,e,n={},r={}){return fu(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var XG=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:l})=>{const{doc:u}=i;if(r.preserveWhitespace!=="full"){const d=Fx(t,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return o&&i.replaceWith(0,u.content.size,d).setMeta("preventUpdate",!n),!0}return o&&i.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function UL(t,e){const n=wo(e,t.schema),{from:r,to:s,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,s,u=>{o.push(...u.marks)});const l=o.find(u=>u.type.name===n.name);return l?{...l.attrs}:{}}function WL(t,e){const n=new Ck(t);return e.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function JG(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(s,i)=>{n(s)&&r.push({node:s,pos:i})}),r}function qL(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 Ey(t){return e=>qL(e.$from,t)}function Be(t,e,n){return t.config[e]===void 0&&t.parent?Be(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Be(t.parent,e,n):null}):t.config[e]}function Ty(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=Be(e,"addExtensions",n);return r?[e,...Ty(r())]:e}).flat(10)}function Hk(t,e){const n=Ul.fromSchema(e).serializeFragment(t),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function GL(t){return typeof t=="function"}function Tt(t,e=void 0,...n){return GL(t)?e?t.bind(e)(...n):t(...n):t}function QG(t={}){return Object.keys(t).length===0&&t.constructor===Object}function hu(t){const e=t.filter(s=>s.type==="extension"),n=t.filter(s=>s.type==="node"),r=t.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function YL(t){const e=[],{nodeExtensions:n,markExtensions:r}=hu(t),s=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(d=>d.name!=="text").map(d=>d.name),l=r.map(d=>d.name),u=[...o,...l];return t.forEach(d=>{const h={name:d.name,options:d.options,storage:d.storage,extensions:s},m=Be(d,"addGlobalAttributes",h);if(!m)return;m().forEach(b=>{let v;Array.isArray(b.types)?v=b.types:b.types==="*"?v=u:b.types==="nodes"?v=o:b.types==="marks"?v=l:v=[],v.forEach(x=>{Object.entries(b.attributes).forEach(([k,E])=>{e.push({type:x,name:k,attribute:{...i,...E}})})})})}),s.forEach(d=>{const h={name:d.name,options:d.options,storage:d.storage},m=Be(d,"addAttributes",h);if(!m)return;const y=m();Object.entries(y).forEach(([b,v])=>{const x={...i,...v};typeof x?.default=="function"&&(x.default=x.default()),x?.isRequired&&x?.default===void 0&&delete x.default,e.push({type:d.name,name:b,attribute:x})})}),e}function e7(t){const e=[];let n="",r=!1,s=!1,i=0;const o=t.length;for(let l=0;l<o;l+=1){const u=t[l];if(u==="'"&&!s){r=!r,n+=u;continue}if(u==='"'&&!r){s=!s,n+=u;continue}if(!r&&!s){if(u==="("){i+=1,n+=u;continue}if(u===")"&&i>0){i-=1,n+=u;continue}if(u===";"&&i===0){e.push(n),n="";continue}}n+=u}return n&&e.push(n),e}function DA(t){const e=[],n=e7(t||""),r=n.length;for(let s=0;s<r;s+=1){const i=n[s],o=i.indexOf(":");if(o===-1)continue;const l=i.slice(0,o).trim(),u=i.slice(o+1).trim();l&&u&&e.push([l,u])}return e}function Yt(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([s,i])=>{if(!r[s]){r[s]=i;return}if(s==="class"){const l=i?String(i).split(" "):[],u=r[s]?r[s].split(" "):[],d=l.filter(h=>!u.includes(h));r[s]=[...u,...d].join(" ")}else if(s==="style"){const l=new Map([...DA(r[s]),...DA(i)]);r[s]=Array.from(l.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[s]=i}),r},{})}function pu(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)=>Yt(n,r),{})}function t7(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function IA(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 s=e.reduce((i,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(n):t7(n.getAttribute(o.name));return l==null?i:{...i,[o.name]:l}},{});return{...r,...s}}}}function LA(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&QG(n)?!1:n!=null))}function PA(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 KL(t,e){var n;const r=YL(t),{nodeExtensions:s,markExtensions:i}=hu(t),o=(n=s.find(d=>Be(d,"topNode")))==null?void 0:n.name,l=Object.fromEntries(s.map(d=>{const h=r.filter(E=>E.type===d.name),m={name:d.name,options:d.options,storage:d.storage,editor:e},y=t.reduce((E,M)=>{const _=Be(M,"extendNodeSchema",m);return{...E,..._?_(d):{}}},{}),b=LA({...y,content:Tt(Be(d,"content",m)),marks:Tt(Be(d,"marks",m)),group:Tt(Be(d,"group",m)),inline:Tt(Be(d,"inline",m)),atom:Tt(Be(d,"atom",m)),selectable:Tt(Be(d,"selectable",m)),draggable:Tt(Be(d,"draggable",m)),code:Tt(Be(d,"code",m)),whitespace:Tt(Be(d,"whitespace",m)),linebreakReplacement:Tt(Be(d,"linebreakReplacement",m)),defining:Tt(Be(d,"defining",m)),isolating:Tt(Be(d,"isolating",m)),attrs:Object.fromEntries(h.map(PA))}),v=Tt(Be(d,"parseHTML",m));v&&(b.parseDOM=v.map(E=>IA(E,h)));const x=Be(d,"renderHTML",m);x&&(b.toDOM=E=>x({node:E,HTMLAttributes:pu(E,h)}));const k=Be(d,"renderText",m);return k&&(b.toText=k),[d.name,b]})),u=Object.fromEntries(i.map(d=>{const h=r.filter(k=>k.type===d.name),m={name:d.name,options:d.options,storage:d.storage,editor:e},y=t.reduce((k,E)=>{const M=Be(E,"extendMarkSchema",m);return{...k,...M?M(d):{}}},{}),b=LA({...y,inclusive:Tt(Be(d,"inclusive",m)),excludes:Tt(Be(d,"excludes",m)),group:Tt(Be(d,"group",m)),spanning:Tt(Be(d,"spanning",m)),code:Tt(Be(d,"code",m)),attrs:Object.fromEntries(h.map(PA))}),v=Tt(Be(d,"parseHTML",m));v&&(b.parseDOM=v.map(k=>IA(k,h)));const x=Be(d,"renderHTML",m);return x&&(b.toDOM=k=>x({mark:k,HTMLAttributes:pu(k,h)})),[d.name,b]}));return new kI({topNode:o,nodes:l,marks:u})}function n7(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Xc(t){return t.sort((n,r)=>{const s=Be(n,"priority")||100,i=Be(r,"priority")||100;return s>i?-1:s<i?1:0})}function Uk(t){const e=Xc(Ty(t)),n=n7(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 ZL(t,e){const n=Uk(t);return KL(n,e)}function r7(t,e){const n=ZL(e),r=Fd(t);return lo.fromSchema(n).parse(r).toJSON()}function XL(t,e,n){const{from:r,to:s}=e,{blockSeparator:i=`
74
+
75
+ `,textSerializers:o={}}=n||{};let l="";return t.nodesBetween(r,s,(u,d,h,m)=>{var y;u.isBlock&&d>r&&(l+=i);const b=o?.[u.type.name];if(b)return h&&(l+=b({node:u,pos:d,parent:h,index:m,range:e})),!1;u.isText&&(l+=(y=u?.text)==null?void 0:y.slice(Math.max(r,d)-d,s-d))}),l}function s7(t,e){const n={from:0,to:t.content.size};return XL(t,n,e)}function JL(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function i7(t,e){const n=jn(e,t.schema),{from:r,to:s}=t.selection,i=[];t.doc.nodesBetween(r,s,l=>{i.push(l)});const o=i.reverse().find(l=>l.type.name===n.name);return o?{...o.attrs}:{}}function QL(t,e){const n=Cy(typeof e=="string"?e:e.name,t.schema);return n==="node"?i7(t,e):n==="mark"?UL(t,e):{}}function o7(t,e=JSON.stringify){const n={};return t.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function a7(t){const e=o7(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function Wk(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((l,u)=>{o.push({from:l,to:u})});else{const{from:l,to:u}=n[i];if(l===void 0||u===void 0)return;o.push({from:l,to:u})}o.forEach(({from:l,to:u})=>{const d=e.slice(i).map(l,-1),h=e.slice(i).map(u),m=e.invert().map(d,-1),y=e.invert().map(h);r.push({oldRange:{from:m,to:y},newRange:{from:d,to:h}})})}),a7(r)}function qk(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(s=>{const i=n.resolve(t),o=Vk(i,s.type);o&&r.push({mark:s,...o})}):n.nodesBetween(t,e,(s,i)=>{!s||s?.nodeSize===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}var l7=(t,e,n,r=20)=>{const s=t.doc.resolve(n);let i=r,o=null;for(;i>0&&o===null;){const l=s.node(i);l?.type.name===e?o=l:i-=1}return[o,i]};function Nd(t,e){return e.nodes[t]||e.marks[t]||null}function _m(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=t.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}var c7=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(s,i,o,l)=>{var u,d;const h=((d=(u=s.type.spec).toText)==null?void 0:d.call(u,{node:s,pos:i,parent:o,index:l}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?h:h.slice(0,Math.max(0,r-i))}),n};function Vx(t,e,n={}){const{empty:r,ranges:s}=t.selection,i=e?wo(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>i?i.name===m.type.name:!0).find(m=>fg(m.attrs,n,{strict:!1}));let o=0;const l=[];if(s.forEach(({$from:m,$to:y})=>{const b=m.pos,v=y.pos;t.doc.nodesBetween(b,v,(x,k)=>{if(i&&x.inlineContent&&!x.type.allowsMarkType(i))return!1;if(!x.isText&&!x.marks.length)return;const E=Math.max(b,k),M=Math.min(v,k+x.nodeSize),_=M-E;o+=_,l.push(...x.marks.map(N=>({mark:N,from:E,to:M})))})}),o===0)return!1;const u=l.filter(m=>i?i.name===m.mark.type.name:!0).filter(m=>fg(m.mark.attrs,n,{strict:!1})).reduce((m,y)=>m+y.to-y.from,0),d=l.filter(m=>i?m.mark.type!==i&&m.mark.type.excludes(i):!0).reduce((m,y)=>m+y.to-y.from,0);return(u>0?u+d:u)>=o}function u7(t,e,n={}){if(!e)return Ma(t,null,n)||Vx(t,null,n);const r=Cy(e,t.schema);return r==="node"?Ma(t,e,n):r==="mark"?Vx(t,e,n):!1}var d7=(t,e)=>{const{$from:n,$to:r,$anchor:s}=t.selection;if(e){const i=Ey(l=>l.type.name===e)(t.selection);if(!i)return!1;const o=t.doc.resolve(i.pos+1);return s.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},f7=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function $A(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function J0(t,e){const{nodeExtensions:n}=hu(e),r=n.find(o=>o.name===t);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},i=Tt(Be(r,"group",s));return typeof i!="string"?!1:i.split(" ").includes("list")}function oh(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 s=!0;return t.content.forEach(i=>{s!==!1&&(oh(i,{ignoreWhitespace:n,checkChildren:e})||(s=!1))}),s}return!1}function eP(t){return t instanceof Ge}var tP=class nP{constructor(e){this.position=e}static fromJSON(e){return new nP(e.position)}toJSON(){return{position:this.position}}};function h7(t,e){const n=e.mapping.mapResult(t.position);return{position:new tP(n.pos),mapResult:n}}function p7(t){return new tP(t)}function m7(t,e,n){var r;const{selection:s}=e;let i=null;if(zL(s)&&(i=s.$cursor),i){const l=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(d=>d.type.excludes(n)))}const{ranges:o}=s;return o.some(({$from:l,$to:u})=>{let d=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,u.pos,(h,m,y)=>{if(d)return!1;if(h.isInline){const b=!y||y.type.allowsMarkType(n),v=!!n.isInSet(h.marks)||!h.marks.some(x=>x.type.excludes(n));d=b&&v}return!d}),d})}var g7=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=n,{empty:o,ranges:l}=i,u=wo(t,r.schema);if(s)if(o){const d=UL(r,u);n.addStoredMark(u.create({...d,...e}))}else l.forEach(d=>{const h=d.$from.pos,m=d.$to.pos;r.doc.nodesBetween(h,m,(y,b)=>{const v=Math.max(b,h),x=Math.min(b+y.nodeSize,m);y.marks.find(E=>E.type===u)?y.marks.forEach(E=>{u===E.type&&n.addMark(v,x,u.create({...E.attrs,...e}))}):n.addMark(v,x,u.create(e))})});return m7(r,n,u)},y7=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),b7=(t,e={})=>({state:n,dispatch:r,chain:s})=>{const i=jn(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:l})=>Q_(i,{...o,...e})(n)?!0:l.clearNodes()).command(({state:l})=>Q_(i,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},v7=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,s=bl(t,0,r.content.size),i=Ge.create(r,s);e.setSelection(i)}return!0},w7=(t,e)=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=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=i.from,l=i.to),s&&n.doc.nodesBetween(o,l,(u,d)=>{u.isText||n.setNodeMarkup(d,void 0,{...u.attrs,dir:t})}),!0},x7=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:s,to:i}=typeof t=="number"?{from:t,to:t}:t,o=Ue.atStart(r).from,l=Ue.atEnd(r).to,u=bl(s,o,l),d=bl(i,o,l),h=Ue.create(r,u,d);e.setSelection(h)}return!0},S7=t=>({state:e,dispatch:n})=>{const r=jn(t,e.schema);return p9(r)(e,n)};function zA(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(s=>e?.includes(s.type.name));t.tr.ensureMarks(r)}}var k7=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:s})=>{const{selection:i,doc:o}=e,{$from:l,$to:u}=i,d=s.extensionManager.attributes,h=_m(d,l.node().type.name,l.node().attrs);if(i instanceof Ge&&i.node.isBlock)return!l.parentOffset||!co(o,l.pos)?!1:(r&&(t&&zA(n,s.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,y=l.depth===0?void 0:VL(l.node(-1).contentMatchAt(l.indexAfter(-1)));let b=m&&y?[{type:y,attrs:h}]:void 0,v=co(e.doc,e.mapping.map(l.pos),1,b);if(!b&&!v&&co(e.doc,e.mapping.map(l.pos),1,y?[{type:y}]:void 0)&&(v=!0,b=y?[{type:y,attrs:h}]:void 0),r){if(v&&(i instanceof Ue&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,b),y&&!m&&!l.parentOffset&&l.parent.type!==y)){const x=e.mapping.map(l.before()),k=e.doc.resolve(x);l.node(-1).canReplaceWith(k.index(),k.index()+1,y)&&e.setNodeMarkup(e.mapping.map(l.before()),y)}t&&zA(n,s.extensionManager.splittableMarks),e.scrollIntoView()}return v},C7=(t,e={})=>({tr:n,state:r,dispatch:s,editor:i})=>{var o;const l=jn(t,r.schema),{$from:u,$to:d}=r.selection,h=r.selection.node;if(h&&h.isBlock||u.depth<2||!u.sameParent(d))return!1;const m=u.node(-1);if(m.type!==l)return!1;const y=i.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(s){let E=ge.empty;const M=u.index(-1)?1:u.index(-2)?2:3;for(let P=u.depth-M;P>=u.depth-3;P-=1)E=ge.from(u.node(P).copy(E));const _=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,N={..._m(y,u.node().type.name,u.node().attrs),...e},T=((o=l.contentMatch.defaultType)==null?void 0:o.createAndFill(N))||void 0;E=E.append(ge.from(l.createAndFill(null,T)||void 0));const A=u.before(u.depth-(M-1));n.replace(A,u.after(-_),new Oe(E,4-M,0));let j=-1;n.doc.nodesBetween(A,n.doc.content.size,(P,O)=>{if(j>-1)return!1;P.isTextblock&&P.content.size===0&&(j=O+1)}),j>-1&&n.setSelection(Ue.near(n.doc.resolve(j))),n.scrollIntoView()}return!0}const b=d.pos===u.end()?m.contentMatchAt(0).defaultType:null,v={..._m(y,m.type.name,m.attrs),...e},x={..._m(y,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,d.pos);const k=b?[{type:l,attrs:v},{type:b,attrs:x}]:[{type:l,attrs:v}];if(!co(n.doc,u.pos,2))return!1;if(s){const{selection:E,storedMarks:M}=r,{splittableMarks:_}=i.extensionManager,N=M||E.$to.parentOffset&&E.$from.marks();if(n.split(u.pos,2,k).scrollIntoView(),!N||!s)return!0;const T=N.filter(A=>_.includes(A.type.name));n.ensureMarks(T)}return!0};function BA(t){return!t||t==="1"?null:t}function rP(t,e){return BA(t)===BA(e)}var Q0=(t,e)=>{const n=Ey(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 s=t.doc.nodeAt(r);return!(n.node.type===s?.type&&La(t.doc,n.pos))||!rP(n.node.attrs.type,s?.attrs.type)||t.join(n.pos),!0},ew=(t,e)=>{const n=Ey(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 s=t.doc.nodeAt(r);return!(n.node.type===s?.type&&La(t.doc,r))||!rP(n.node.attrs.type,s?.attrs.type)||t.join(r),!0};function E7(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),s=e.resolve(n.nodeSize-1);return Ue.between(r,s)}var T7=(t,e,n,r={})=>({editor:s,tr:i,state:o,dispatch:l,chain:u,commands:d,can:h})=>{const{extensions:m,splittableMarks:y}=s.extensionManager,b=jn(t,o.schema),v=jn(e,o.schema),{selection:x,storedMarks:k}=o,{$from:E,$to:M}=x,_=E.blockRange(M),N=k||x.$to.parentOffset&&x.$from.marks();if(!_)return!1;const T=Ey(K=>J0(K.type.name,m))(x),A=x.from===0&&x.to===o.doc.content.size,j=o.doc.content.content,P=j.length===1?j[0]:null,O=A&&P&&J0(P.type.name,m)?{node:P,pos:0}:null,G=T??O,B=!!T&&_.depth>=1&&_.depth-T.depth<=1,W=!!O;if((B||W)&&G){if(G.node.type===b)return A&&W?u().command(({tr:K,dispatch:Q})=>{const ee=E7(K);return ee?(K.setSelection(ee),Q&&Q(K),!0):!1}).liftListItem(v).run():d.liftListItem(v);if(J0(G.node.type.name,m)&&b.validContent(G.node.content))return u().command(()=>(i.setNodeMarkup(G.pos,b),!0)).command(()=>Q0(i,b)).command(()=>ew(i,b)).run()}return!n||!N||!l?u().command(()=>h().wrapInList(b,r)?!0:d.clearNodes()).wrapInList(b,r).command(()=>Q0(i,b)).command(()=>ew(i,b)).run():u().command(()=>{const K=h().wrapInList(b,r),Q=N.filter(ee=>y.includes(ee.type.name));return i.ensureMarks(Q),K?!0:d.clearNodes()}).wrapInList(b,r).command(()=>Q0(i,b)).command(()=>ew(i,b)).run()},N7=(t,e={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=n,o=wo(t,r.schema);return Vx(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},M7=(t,e,n={})=>({state:r,commands:s})=>{const i=jn(t,r.schema),o=jn(e,r.schema),l=Ma(r,i,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),l?s.setNode(o,u):s.setNode(i,{...u,...n})},_7=(t,e={})=>({state:n,commands:r})=>{const s=jn(t,n.schema);return Ma(n,s,e)?r.lift(s):r.wrapIn(s,e)},A7=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const s=n[r];let i;if(s.spec.isInputRules&&(i=s.getState(t))){if(e){const o=t.tr,l=i.transform;for(let u=l.steps.length-1;u>=0;u-=1)o.step(l.steps[u].invert(l.docs[u]));if(i.text){const u=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,u))}else o.delete(i.from,i.to)}return!0}}return!1},R7=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{ignoreClearable:s=!1}=t,{selection:i}=e,{empty:o,ranges:l}=i;if(o)return!0;const{nonClearableMarks:u}=r.extensionManager;if(n){const d=Object.values(r.schema.marks).filter(h=>s||!u.includes(h.name));l.forEach(h=>{for(const m of d)e.removeMark(h.$from.pos,h.$to.pos,m)})}return!0},O7=(t,e={})=>({tr:n,state:r,dispatch:s})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=n,u=wo(t,r.schema),{$from:d,empty:h,ranges:m}=l;if(!s)return!0;if(h&&o){let{from:y,to:b}=l;const v=(i=d.marks().find(k=>k.type===u))==null?void 0:i.attrs,x=Vk(d,u,v);x&&(y=x.from,b=x.to),n.removeMark(y,b,u)}else m.forEach(y=>{n.removeMark(y.$from.pos,y.$to.pos,u)});return n.removeStoredMark(u),!0},j7=t=>({tr:e,state:n,dispatch:r})=>{const{selection:s}=n;let i,o;return typeof t=="number"?(i=t,o=t):t&&"from"in t&&"to"in t?(i=t.from,o=t.to):(i=s.from,o=s.to),r&&e.doc.nodesBetween(i,o,(l,u)=>{if(l.isText)return;const d={...l.attrs};delete d.dir,e.setNodeMarkup(u,void 0,d)}),!0},D7=(t,e={})=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const l=Cy(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(i=jn(t,r.schema)),l==="mark"&&(o=wo(t,r.schema));let u=!1;return n.selection.ranges.forEach(d=>{const h=d.$from.pos,m=d.$to.pos;let y,b,v,x;n.selection.empty?r.doc.nodesBetween(h,m,(k,E)=>{i&&i===k.type&&(u=!0,v=Math.max(E,h),x=Math.min(E+k.nodeSize,m),y=E,b=k)}):r.doc.nodesBetween(h,m,(k,E)=>{E<h&&i&&i===k.type&&(u=!0,v=Math.max(E,h),x=Math.min(E+k.nodeSize,m),y=E,b=k),E>=h&&E<=m&&(i&&i===k.type&&(u=!0,s&&n.setNodeMarkup(E,void 0,{...k.attrs,...e})),o&&k.marks.length&&k.marks.forEach(M=>{if(o===M.type&&(u=!0,s)){const _=Math.max(E,h),N=Math.min(E+k.nodeSize,m);n.addMark(_,N,o.create({...M.attrs,...e}))}}))}),b&&(y!==void 0&&s&&n.setNodeMarkup(y,void 0,{...b.attrs,...e}),o&&b.marks.length&&b.marks.forEach(k=>{o===k.type&&s&&n.addMark(v,x,o.create({...k.attrs,...e}))}))}),u},I7=(t,e={})=>({state:n,dispatch:r})=>{const s=jn(t,n.schema);return a9(s,e)(n,r)},L7=(t,e={})=>({state:n,dispatch:r})=>{const s=jn(t,n.schema);return l9(s,e)(n,r)},P7=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 mu(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(s=>Object.prototype.hasOwnProperty.call(e,s)&&Object.is(t[s],e[s]))}function $7(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Ge){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let s=r.depth;for(;s>=0;){const i=r.index(s);if(r.node(s).contentMatchAt(i).matchType(e))return!0;s-=1}return!1}function z7(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(s),s}function FA(t){return t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function B7(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function F7(t){return typeof t=="number"}function V7(t){return Object.prototype.toString.call(t).slice(8,-1)}function Lp(t){return V7(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}var H7={};Bk(H7,{createAtomBlockMarkdownSpec:()=>U7,createBlockMarkdownSpec:()=>W7,createInlineMarkdownSpec:()=>Y7,parseAttributes:()=>Gk,parseIndentedBlocks:()=>Hx,renderNestedMarkdownContent:()=>Kk,serializeAttributes:()=>Yk});function Gk(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,d=>(n.push(d),`__QUOTED_${n.length-1}__`)),s=r.match(/(?:^|\s)\.([\w-]+)/g);if(s){const d=s.map(h=>h.trim().slice(1));e.class=d.join(" ")}const i=r.match(/(?:^|\s)#([\w-]+)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,d,h])=>{var m;const y=parseInt(((m=h.match(/__QUOTED_(\d+)__/))==null?void 0:m[1])||"0",10),b=n[y];b&&(e[d]=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 Yk(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 U7(t){const{nodeName:e,name:n,parseAttributes:r=Gk,serializeAttributes:s=Yk,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:l}=t,u=n||e,d=h=>{if(!l)return h;const m={};return l.forEach(y=>{y in h&&(m[y]=h[y])}),m};return{parseMarkdown:(h,m)=>{const y={...i,...h.attributes};return m.createNode(e,y,[])},markdownTokenizer:{name:e,level:"block",start(h){var m;const y=new RegExp(`^:::${u}(?:\\s|$)`,"m"),b=(m=h.match(y))==null?void 0:m.index;return b!==void 0?b:-1},tokenize(h,m,y){const b=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),v=h.match(b);if(!v)return;const x=v[1]||"",k=r(x);if(!o.find(M=>!(M in k)))return{type:e,raw:v[0],attributes:k}}},renderMarkdown:h=>{const m=d(h.attrs||{}),y=s(m),b=y?` {${y}}`:"";return`:::${u}${b} :::`}}}function W7(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=Gk,serializeAttributes:i=Yk,defaultAttributes:o={},content:l="block",allowedAttributes:u}=t,d=n||e,h=m=>{if(!u)return m;const y={};return u.forEach(b=>{b in m&&(y[b]=m[b])}),y};return{parseMarkdown:(m,y)=>{let b;if(r){const x=r(m);b=typeof x=="string"?[{type:"text",text:x}]:x}else l==="block"?b=y.parseChildren(m.tokens||[]):b=y.parseInline(m.tokens||[]);const v={...o,...m.attributes};return y.createNode(e,v,b)},markdownTokenizer:{name:e,level:"block",start(m){var y;const b=new RegExp(`^:::${d}`,"m"),v=(y=m.match(b))==null?void 0:y.index;return v!==void 0?v:-1},tokenize(m,y,b){var v;const x=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),k=m.match(x);if(!k)return;const[E,M=""]=k,_=s(M);let N=1;const T=E.length;let A="";const j=/^:::([\w-]*)(\s.*)?/gm,P=m.slice(T);for(j.lastIndex=0;;){const O=j.exec(P);if(O===null)break;const G=O.index,B=O[1];if(!((v=O[2])!=null&&v.endsWith(":::"))){if(B)N+=1;else if(N-=1,N===0){const W=P.slice(0,G);A=W.trim();const K=m.slice(0,T+G+O[0].length);let Q=[];if(A)if(l==="block")for(Q=b.blockTokens(W),Q.forEach(ee=>{ee.text&&(!ee.tokens||ee.tokens.length===0)&&(ee.tokens=b.inlineTokens(ee.text))});Q.length>0;){const ee=Q[Q.length-1];if(ee.type==="paragraph"&&(!ee.text||ee.text.trim()===""))Q.pop();else break}else Q=b.inlineTokens(A);return{type:e,raw:K,attributes:_,content:A,tokens:Q}}}}}},renderMarkdown:(m,y)=>{const b=h(m.attrs||{}),v=i(b),x=v?` {${v}}`:"",k=y.renderChildren(m.content||[],`
76
+
77
+ `);return`:::${d}${x}
78
+
79
+ ${k}
80
+
81
+ :::`}}}function q7(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,i,o]=r;e[s]=i||o,r=n.exec(t)}return e}function G7(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function Y7(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=q7,serializeAttributes:i=G7,defaultAttributes:o={},selfClosing:l=!1,allowedAttributes:u}=t,d=n||e,h=y=>{if(!u)return y;const b={};return u.forEach(v=>{const x=typeof v=="string"?v:v.name,k=typeof v=="string"?void 0:v.skipIfDefault;if(x in y){const E=y[x];if(k!==void 0&&E===k)return;b[x]=E}}),b},m=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(y,b)=>{const v={...o,...y.attributes};if(l)return b.createNode(e,v);const x=r?r(y):y.content||"";return x?b.createNode(e,v,[b.createTextNode(x)]):b.createNode(e,v,[])},markdownTokenizer:{name:e,level:"inline",start(y){const b=l?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),v=y.match(b),x=v?.index;return x!==void 0?x:-1},tokenize(y,b,v){const x=l?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),k=y.match(x);if(!k)return;let E="",M="";if(l){const[,N]=k;M=N}else{const[,N,T]=k;M=N,E=T||""}const _=s(M.trim());return{type:e,raw:k[0],content:E.trim(),attributes:_}}},renderMarkdown:y=>{let b="";r?b=r(y):y.content&&y.content.length>0&&(b=y.content.filter(E=>E.type==="text").map(E=>E.text).join(""));const v=h(y.attrs||{}),x=i(v),k=x?` ${x}`:"";return l?`[${d}${k}]`:`[${d}${k}]${b}[/${d}]`}}}function Hx(t,e,n){var r,s,i,o;const l=t.split(`
82
+ `),u=[];let d="",h=0;const m=e.baseIndentSize||2;for(;h<l.length;){const y=l[h],b=y.match(e.itemPattern);if(!b){if(u.length>0)break;if(y.trim()===""){h+=1,d=`${d}${y}
83
+ `;continue}else return}const v=e.extractItemData(b),{indentLevel:x,mainContent:k}=v;d=`${d}${y}
84
+ `;const E=[k];for(h+=1;h<l.length;){const T=l[h];if(T.trim()===""){const j=l.slice(h+1).findIndex(G=>G.trim()!=="");if(j===-1)break;if((((s=(r=l[h+1+j].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>x){E.push(T),d=`${d}${T}
85
+ `,h+=1;continue}else break}if((((o=(i=T.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>x)E.push(T),d=`${d}${T}
86
+ `,h+=1;else break}let M;const _=E.slice(1);if(_.length>0){const T=_.map(A=>A.slice(x+m)).join(`
87
+ `);T.trim()&&(e.customNestedParser?M=e.customNestedParser(T):M=n.blockTokens(T))}const N=e.createToken(v,M);u.push(N)}if(u.length!==0)return{items:u,raw:d}}function Kk(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const s=typeof n=="function"?n(r):n,[i,...o]=t.content,l=e.renderChildren([i]);let u=`${s}${l}`;return o&&o.length>0&&o.forEach((d,h)=>{var m,y;const b=(y=(m=e.renderChild)==null?void 0:m.call(e,d,h+1))!=null?y:e.renderChildren([d]);if(b!=null){const v=b.split(`
88
+ `).map(x=>x?e.indent(x):e.indent("")).join(`
89
+ `);u+=d.type==="paragraph"?`
90
+
91
+ ${v}`:`
92
+ ${v}`}}),u}function VA(t){return typeof t.type=="string"?t.type:t.type.name}function K7(t,e){if(t.length!==e.length)return!1;const n=Array.from({length:e.length},()=>!1);return t.every(r=>{const s=VA(r),i=e.findIndex((o,l)=>!n[l]&&s===VA(o)&&mu(r.attrs,o.attrs));return i===-1?!1:(n[i]=!0,!0)})}function sP(t,e){const n={...t};return Lp(t)&&Lp(e)&&Object.keys(e).forEach(r=>{Lp(e[r])&&Lp(t[r])?n[r]=sP(t[r],e[r]):n[r]=e[r]}),n}function Z7(t,e,n={}){const{state:r}=e,{doc:s,tr:i}=r,o=t;s.descendants((l,u)=>{const d=i.mapping.map(u),h=i.mapping.map(u)+l.nodeSize;let m=null;if(l.marks.forEach(b=>{if(b!==o)return!1;m=b}),!m)return;let y=!1;if(Object.keys(n).forEach(b=>{n[b]!==m.attrs[b]&&(y=!0)}),y){const b=t.type.create({...t.attrs,...n});i.removeMark(d,h,t.type),i.addMark(d,h,b)}}),i.docChanged&&e.view.dispatch(i)}var ah=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},X7=(t,e)=>{if(Fk(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 Pp(t){var e;const{editor:n,from:r,to:s,text:i,rules:o,plugin:l}=t,{view:u}=n;if(u.composing)return!1;const d=u.state.doc.resolve(r);if(d.parent.type.spec.code||(e=d.nodeBefore||d.nodeAfter)!=null&&e.marks.find(y=>y.type.spec.code))return!1;let h=!1;const m=c7(d)+i;return o.forEach(y=>{if(h)return;const b=X7(m,y.find);if(!b)return;const v=b[0].length-i.length;if(v>0){const A=d.parentOffset-v;if(A<0||d.parent.textBetween(A,d.parentOffset)!==b[0].slice(0,v))return}const x=u.state.tr,k=Sy({state:u.state,transaction:x}),E={from:r-(b[0].length-i.length),to:s},{commands:M,chain:_,can:N}=new ky({editor:n,state:k});y.handler({state:k,range:E,match:b,commands:M,chain:_,can:N})===null||!x.steps.length||(y.undoable&&x.setMeta(l,{transform:x,from:r,to:s,text:i}),u.dispatch(x),h=!0)}),h}function J7(t){const{editor:e,rules:n}=t,r=new Kt({state:{init(){return null},apply(s,i,o){const l=s.getMeta(r);if(l)return l;const u=s.getMeta("applyInputRules");return u&&setTimeout(()=>{let{text:h}=u;typeof h=="string"?h=h:h=Hk(ge.from(h),o.schema);const{from:m}=u,y=m+h.length;Pp({editor:e,from:m,to:y,text:h,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,l){return Pp({editor:e,from:i,to:o,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&Pp({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?Pp({editor:e,from:o.pos,to:o.pos,text:`
93
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var Zk=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{...Tt(Be(this,"addOptions",{name:this.name}))}}get storage(){return{...Tt(Be(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>sP(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}},Wl=class iP extends Zk{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new iP(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(d=>d?.type.name===n.name))return!1;const u=o.find(d=>d?.type.name===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",s.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)}},oP=class{constructor(t){this.find=t.find,this.handler=t.handler}},Q7=(t,e,n)=>{if(Fk(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=t,i.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(s.replaceWith)),i}):[]};function eY(t){const{editor:e,state:n,from:r,to:s,rule:i,pasteEvent:o,dropEvent:l}=t,{commands:u,chain:d,can:h}=new ky({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,s,(b,v)=>{var x,k,E,M,_;if((k=(x=b.type)==null?void 0:x.spec)!=null&&k.code||!(b.isText||b.isTextblock||b.isInline))return;const N=(_=(M=(E=b.content)==null?void 0:E.size)!=null?M:b.nodeSize)!=null?_:0,T=Math.max(r,v),A=Math.min(s,v+N);if(T>=A)return;const j=b.isText?b.text||"":b.textBetween(T-v,A-v,void 0,"");Q7(j,i.find,o).forEach(O=>{if(O.index===void 0)return;const G=T+O.index+1,B=G+O[0].length,W={from:n.tr.mapping.map(G),to:n.tr.mapping.map(B)},K=i.handler({state:n,range:W,match:O,commands:u,chain:d,can:h,pasteEvent:o,dropEvent:l});m.push(K)})}),m.every(b=>b!==null)}var $p=null,tY=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function nY(t){const{editor:e,rules:n}=t;let r=null,s=!1,i=!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:y,rule:b,pasteEvt:v})=>{const x=h.tr,k=Sy({state:h,transaction:x});if(!(!eY({editor:e,state:k,from:Math.max(m-1,0),to:y.b-1,rule:b,pasteEvent:v,dropEvent:l})||!x.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,x}};return n.map(h=>new Kt({view(m){const y=v=>{var x;r=(x=m.dom.parentElement)!=null&&x.contains(v.target)?m.dom.parentElement:null,r&&($p=e)},b=()=>{$p&&($p=null)};return window.addEventListener("dragstart",y),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",y),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(m,y)=>{if(i=r===m.dom.parentElement,l=y,!i){const b=$p;b?.isEditable&&setTimeout(()=>{const v=b.state.selection;v&&b.commands.deleteRange({from:v.from,to:v.to})},10)}return!1},paste:(m,y)=>{var b;const v=(b=y.clipboardData)==null?void 0:b.getData("text/html");return o=y,s=!!v?.includes("data-pm-slice"),!1}}},appendTransaction:(m,y,b)=>{const v=m[0],x=v.getMeta("uiEvent")==="paste"&&!s,k=v.getMeta("uiEvent")==="drop"&&!i,E=v.getMeta("applyPasteRules"),M=!!E;if(!x&&!k&&!M)return;if(M){let{text:T}=E;typeof T=="string"?T=T:T=Hk(ge.from(T),b.schema);const{from:A}=E,j=A+T.length,P=tY(T);return u({rule:h,state:b,from:A,to:{b:j},pasteEvt:P})}const _=y.doc.content.findDiffStart(b.doc.content),N=y.doc.content.findDiffEnd(b.doc.content);if(!(!F7(_)||!N||_===N.b))return u({rule:h,state:b,from:_,to:N,pasteEvt:o})}}))}var Ny=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=Uk(t),this.schema=KL(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:Nd(e.name,this.schema)},r=Be(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Xc([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Nd(r.name,this.schema)},i=[],o=Be(r,"addKeyboardShortcuts",s);let l={};if(r.type==="mark"&&Be(r,"exitable",s)&&(l.ArrowRight=()=>Wl.handleExit({editor:t,mark:r})),o){const y=Object.fromEntries(Object.entries(o()).map(([b,v])=>[b,()=>v({editor:t})]));l={...l,...y}}const u=sG(l);i.push(u);const d=Be(r,"addInputRules",s);if($A(r,t.options.enableInputRules)&&d){const y=d();if(y&&y.length){const b=J7({editor:t,rules:y}),v=Array.isArray(b)?b:[b];i.push(...v)}}const h=Be(r,"addPasteRules",s);if($A(r,t.options.enablePasteRules)&&h){const y=h();if(y&&y.length){const b=nY({editor:t,rules:y});i.push(...b)}}const m=Be(r,"addProseMirrorPlugins",s);if(m){const y=m();i.push(...y)}return i})}get attributes(){return YL(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=hu(this.extensions);return Object.fromEntries(e.filter(n=>!!Be(n,"addNodeView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:jn(n.name,this.schema)},i=Be(n,"addNodeView",s);if(!i)return[];const o=i();if(!o)return[];const l=(u,d,h,m,y)=>{const b=pu(u,r);return o({node:u,view:d,getPos:h,decorations:m,innerDecorations:y,editor:t,extension:n,HTMLAttributes:b})};return[n.name,l]}))}dispatchTransaction(t){const{editor:e}=this;return Xc([...this.extensions].reverse()).reduceRight((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:Nd(s.name,this.schema)},o=Be(s,"dispatchTransaction",i);return o?l=>{o.call(i,{transaction:l,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return Xc([...this.extensions]).reduce((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:Nd(s.name,this.schema)},o=Be(s,"transformPastedHTML",i);return o?(l,u)=>{const d=r(l,u);return o.call(i,d)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=hu(this.extensions);return Object.fromEntries(e.filter(n=>!!Be(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:wo(n.name,this.schema)},i=Be(n,"addMarkView",s);if(!i)return[];const o=(l,u,d)=>{const h=pu(l,r);return i()({mark:l,view:u,inline:d,editor:t,extension:n,HTMLAttributes:h,updateAttributes:m=>{Z7(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 s={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Nd(e.name,this.schema)};e.type==="mark"&&(((n=Tt(Be(e,"keepOnSplit",s)))==null||n)&&this.splittableMarks.push(e.name),(r=Tt(Be(e,"clearable",s)))==null||r||this.nonClearableMarks.push(e.name));const i=Be(e,"onBeforeCreate",s),o=Be(e,"onCreate",s),l=Be(e,"onUpdate",s),u=Be(e,"onSelectionUpdate",s),d=Be(e,"onTransaction",s),h=Be(e,"onFocus",s),m=Be(e,"onBlur",s),y=Be(e,"onDestroy",s);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),l&&this.editor.on("update",l),u&&this.editor.on("selectionUpdate",u),d&&this.editor.on("transaction",d),h&&this.editor.on("focus",h),m&&this.editor.on("blur",m),y&&this.editor.on("destroy",y)})}};Ny.resolve=Uk;Ny.sort=Xc;Ny.flatten=Ty;var rY={};Bk(rY,{ClipboardTextSerializer:()=>lP,Commands:()=>cP,Delete:()=>uP,Drop:()=>dP,Editable:()=>fP,FocusEvents:()=>pP,Keymap:()=>mP,Paste:()=>gP,Tabindex:()=>yP,TextDirection:()=>bP,focusEventsPluginKey:()=>hP});var rn=class aP extends Zk{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new aP(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},lP=rn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Kt({key:new yn("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:s}=e,i=JL(n),{blockSeparator:o}=this.options,l={...o!==void 0?{blockSeparator:o}:{},textSerializers:i};return[...s.ranges].sort((d,h)=>d.$from.pos-h.$from.pos).map(({$from:d,$to:h})=>XL(r,{from:d.pos,to:h.pos},l)).join(o??`
94
+
95
+ `)}}})]}}),cP=rn.create({name:"commands",addCommands(){return{...Bs}}}),uP=rn.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,s;const i=()=>{var o,l,u,d;if((d=(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?d:t.getMeta("y-sync$"))return;const h=WL(t.before,[t,...e]);Wk(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,(v,x)=>{const k=x+v.nodeSize-2,E=b.oldRange.from<=x&&k<=b.oldRange.to;this.editor.emit("delete",{type:"node",node:v,from:x,to:k,newFrom:h.mapping.map(x),newTo:h.mapping.map(k),deletedRange:b.oldRange,newRange:b.newRange,partial:!E,editor:this.editor,transaction:t,combinedTransform:h})})});const y=h.mapping;h.steps.forEach((b,v)=>{var x,k;if(b instanceof Ys){const E=y.slice(v).map(b.from,-1),M=y.slice(v).map(b.to),_=y.invert().map(E,-1),N=y.invert().map(M),T=E>0?(x=h.doc.nodeAt(E-1))==null?void 0:x.marks.some(j=>j.eq(b.mark)):!1,A=(k=h.doc.nodeAt(M))==null?void 0:k.marks.some(j=>j.eq(b.mark));this.editor.emit("delete",{type:"mark",mark:b.mark,from:b.from,to:b.to,deletedRange:{from:_,to:N},newRange:{from:E,to:M},partial:!!(A||T),editor:this.editor,transaction:t,combinedTransform:h})}})};(s=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||s?setTimeout(i,0):i()}}),dP=rn.create({name:"drop",addProseMirrorPlugins(){return[new Kt({key:new yn("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),fP=rn.create({name:"editable",addProseMirrorPlugins(){return[new Kt({key:new yn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),hP=new yn("focusEvents"),pP=rn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Kt({key:hP,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}}}})]}}),mP=rn.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:u,doc:d}=l,{empty:h,$anchor:m}=u,{pos:y,parent:b}=m,v=m.parent.isTextblock&&y>0?l.doc.resolve(y-1):m,x=v.parent.type.spec.isolating,k=m.pos-m.parentOffset,E=x&&v.parent.childCount===1?k===m.pos:nt.atStart(d).from===y;return!h||!b.type.isTextblock||b.textContent.length||!E||E&&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()},s={...r},i={...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 hg()||HL()?i:s},addProseMirrorPlugins(){return[new Kt({key:new yn("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(x=>x.getMeta("composition")))return;const r=t.some(x=>x.docChanged)&&!e.doc.eq(n.doc),s=t.some(x=>x.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:o,to:l}=e.selection,u=nt.atStart(e.doc).from,d=nt.atEnd(e.doc).to;if(i||!(o===u&&l===d)||!oh(n.doc))return;const y=n.tr,b=Sy({state:n,transaction:y}),{commands:v}=new ky({editor:this.editor,state:b});if(v.clearNodes(),!!y.steps.length)return y}})]}}),gP=rn.create({name:"paste",addProseMirrorPlugins(){return[new Kt({key:new yn("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),yP=rn.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Kt({key:new yn("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!=null?t:"0"}}}})]}}),bP=rn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=hu(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 Kt({key:new yn("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),sY=class Vd{constructor(e,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=s}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 Vd(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 Vd(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 Vd(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=n.isInline,l=this.pos+r+(i?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const u=this.resolvedPos.doc.resolve(l);if(!s&&!o&&u.depth<=this.depth)return;const d=new Vd(u,this.editor,s,s||o?n:null);s&&(d.actualDepth=this.depth+1),e.push(d)}),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,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(n).length>0){const i=s.node.attrs,o=Object.keys(n);for(let l=0;l<o.length;l+=1){const u=o[l];if(i[u]!==n[u])break}}else r=s;s=s.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const i=Object.keys(n);return this.children.forEach(o=>{r&&s.length>0||(o.node.type.name===e&&i.every(u=>n[u]===o.node.attrs[u])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,n,r))))}),s}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},iY=`.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
+ }`,oY=class extends P7{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:h7,createMappablePosition:p7},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:s})=>this.options.onDrop(n,r,s)),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=Bx(e,this.options.autofocus);this.editorState=ml.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=z7(iY,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=GL(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(s=>{const i=typeof s=="string"?`${s}$`:s.key;n=n.filter(o=>!o.key.startsWith(i))}),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 i=[...this.options.enableCoreExtensions?[fP,lP.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),cP,pP,mP,yP.configure({value:(r=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:r.value}),dP,gP,uP,bP.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 Ny(i,this)}createCommandManager(){this.commandManager=new ky({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Fx(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=Fx(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=ml.create({doc:n,schema:this.schema,selection:Bx(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),s=n?this.extensionManager.dispatchTransaction(r):r,i=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(i);this.editorView=new PL(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:s,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(d=>{var h;return(h=this.capturedTransaction)==null?void 0:h.step(d)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),s=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!s)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(d=>d.getMeta("focus")||d.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(d=>d.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return QL(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return u7(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Hk(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
166
+
167
+ `,textSerializers:n={}}=t||{};return s7(this.state.doc,{blockSeparator:e,textSerializers:{...JL(this.schema),...n}})}get isEmpty(){return oh(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 sY(e,this,!1,n)}get $doc(){return this.$pos(0)}};function jl(t){return new ah({find:t.find,handler:({state:e,range:n,match:r})=>{const s=Tt(t.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=e,o=r[r.length-1],l=r[0];if(o){const u=l.search(/\S/),d=n.from+l.indexOf(o),h=d+o.length;if(qk(n.from,n.to,e.doc).filter(b=>b.mark.type.excluded.find(x=>x===t.type&&x!==b.mark.type)).filter(b=>b.to>d).length)return null;h<n.to&&i.delete(h,n.to),d>n.from&&i.delete(n.from+u,d);const y=n.from+u+o.length;i.addMark(n.from+u,y,t.type.create(s||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function vP(t){return new ah({find:t.find,handler:({state:e,range:n,match:r})=>{const s=Tt(t.getAttributes,void 0,r)||{},{tr:i}=e,o=n.from;let l=n.to;const u=t.type.create(s);if(r[1]){const d=r[0].lastIndexOf(r[1]);let h=o+d;h>l?h=l:l=h+r[1].length;const m=r[0][r[0].length-1];i.insertText(m,o+r[0].length-1),i.replaceWith(h,l,u)}else if(r[0]){const d=t.type.isInline?o:o-1;i.insert(d,t.type.create(s)).delete(i.mapping.map(o),i.mapping.map(l))}i.scrollIntoView()},undoable:t.undoable})}function Ux(t){return new ah({find:t.find,handler:({state:e,range:n,match:r})=>{const s=e.doc.resolve(n.from),i=Tt(t.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function gu(t){return new ah({find:t.find,handler:({state:e,range:n,match:r,chain:s})=>{const i=Tt(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),u=o.doc.resolve(n.from).blockRange(),d=u&&kk(u,t.type,i);if(!d)return null;if(o.wrap(u,d),t.keepMarks&&t.editor){const{selection:m,storedMarks:y}=e,{splittableMarks:b}=t.editor.extensionManager,v=y||m.$to.parentOffset&&m.$from.marks();if(v){const x=v.filter(k=>b.includes(k.type.name));o.ensureMarks(x)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(m,i).run()}const h=o.doc.resolve(n.from-1).nodeBefore;h&&h.type===t.type&&La(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,h))&&o.join(n.from-1)},undoable:t.undoable})}var aY=t=>"touches"in t,lY=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,d=l.clientY-this.startY;this.handleResize(u,d)},this.handleTouchMove=l=>{if(!this.isResizing||!this.activeHandle)return;const u=l.touches[0];if(!u)return;const d=u.clientX-this.startX,h=u.clientY-this.startY;this.handleResize(d,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,s,i,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),(s=t.options)!=null&&s.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(i=t.options)!=null&&i.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"),s=e.includes("left"),i=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),s&&(t.style.left="0"),i&&(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,aY(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:s}=this.calculateNewDimensions(this.activeHandle,t,e),i=this.applyConstraints(r,s,n);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,s=this.startHeight;const i=t.includes("right"),o=t.includes("left"),l=t.includes("bottom"),u=t.includes("top");return i?r=this.startWidth+e:o&&(r=this.startWidth-e),l?s=this.startHeight+n:u&&(s=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(i?e:-e)),(t==="top"||t==="bottom")&&(s=this.startHeight+(l?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,s,t):{width:r,height:s}}applyConstraints(t,e,n){var r,s,i,o;if(!n){let d=Math.max(this.minSize.width,t),h=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(d=Math.min(this.maxSize.width,d)),(s=this.maxSize)!=null&&s.height&&(h=Math.min(this.maxSize.height,h)),{width:d,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),(i=this.maxSize)!=null&&i.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",s=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:s?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}},Gn=class wP extends Zk{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new wP(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function _a(t){return new oP({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const i=Tt(t.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=e,l=r[r.length-1],u=r[0];let d=n.to;if(l){const h=u.search(/\S/),m=n.from+u.indexOf(l),y=m+l.length;if(qk(n.from,n.to,e.doc).filter(x=>x.mark.type.excluded.find(E=>E===t.type&&E!==x.mark.type)).filter(x=>x.to>m).length)return null;y<n.to&&o.delete(y,n.to),m>n.from&&o.delete(n.from+h,m),d=n.from+h+l.length,o.addMark(n.from+h,d,t.type.create(i||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:cY,getOwnPropertySymbols:uY}=Object,{hasOwnProperty:dY}=Object.prototype;function tw(t,e){return function(r,s,i){return t(r,s,i)&&e(r,s,i)}}function zp(t){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,s);const{cache:i}=s,o=i.get(n),l=i.get(r);if(o&&l)return o===r&&l===n;i.set(n,r),i.set(r,n);const u=t(n,r,s);return i.delete(n),i.delete(r),u}}function fY(t){return t?.[Symbol.toStringTag]}function HA(t){return cY(t).concat(uY(t))}const hY=Object.hasOwn||((t,e)=>dY.call(t,e));function ql(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const pY="__v",mY="__o",gY="_owner",{getOwnPropertyDescriptor:UA,keys:WA}=Object;function yY(t,e){return t.byteLength===e.byteLength&&pg(new Uint8Array(t),new Uint8Array(e))}function bY(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 vY(t,e){return t.byteLength===e.byteLength&&pg(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function wY(t,e){return ql(t.getTime(),e.getTime())}function xY(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function SY(t,e){return t===e}function qA(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=t.entries();let o,l,u=0;for(;(o=i.next())&&!o.done;){const d=e.entries();let h=!1,m=0;for(;(l=d.next())&&!l.done;){if(s[m]){m++;continue}const y=o.value,b=l.value;if(n.equals(y[0],b[0],u,m,t,e,n)&&n.equals(y[1],b[1],y[0],b[0],t,e,n)){h=s[m]=!0;break}m++}if(!h)return!1;u++}return!0}const kY=ql;function CY(t,e,n){const r=WA(t);let s=r.length;if(WA(e).length!==s)return!1;for(;s-- >0;)if(!xP(t,e,n,r[s]))return!1;return!0}function Md(t,e,n){const r=HA(t);let s=r.length;if(HA(e).length!==s)return!1;let i,o,l;for(;s-- >0;)if(i=r[s],!xP(t,e,n,i)||(o=UA(t,i),l=UA(e,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function EY(t,e){return ql(t.valueOf(),e.valueOf())}function TY(t,e){return t.source===e.source&&t.flags===e.flags}function GA(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=t.values();let o,l;for(;(o=i.next())&&!o.done;){const u=e.values();let d=!1,h=0;for(;(l=u.next())&&!l.done;){if(!s[h]&&n.equals(o.value,l.value,o.value,l.value,t,e,n)){d=s[h]=!0;break}h++}if(!d)return!1}return!0}function pg(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 NY(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 xP(t,e,n,r){return(r===gY||r===mY||r===pY)&&(t.$$typeof||e.$$typeof)?!0:hY(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const MY="[object ArrayBuffer]",_Y="[object Arguments]",AY="[object Boolean]",RY="[object DataView]",OY="[object Date]",jY="[object Error]",DY="[object Map]",IY="[object Number]",LY="[object Object]",PY="[object RegExp]",$Y="[object Set]",zY="[object String]",BY={"[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},FY="[object URL]",VY=Object.prototype.toString;function HY({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:l,areObjectsEqual:u,arePrimitiveWrappersEqual:d,areRegExpsEqual:h,areSetsEqual:m,areTypedArraysEqual:y,areUrlsEqual:b,unknownTagComparators:v}){return function(k,E,M){if(k===E)return!0;if(k==null||E==null)return!1;const _=typeof k;if(_!==typeof E)return!1;if(_!=="object")return _==="number"?l(k,E,M):_==="function"?i(k,E,M):!1;const N=k.constructor;if(N!==E.constructor)return!1;if(N===Object)return u(k,E,M);if(Array.isArray(k))return e(k,E,M);if(N===Date)return r(k,E,M);if(N===RegExp)return h(k,E,M);if(N===Map)return o(k,E,M);if(N===Set)return m(k,E,M);const T=VY.call(k);if(T===OY)return r(k,E,M);if(T===PY)return h(k,E,M);if(T===DY)return o(k,E,M);if(T===$Y)return m(k,E,M);if(T===LY)return typeof k.then!="function"&&typeof E.then!="function"&&u(k,E,M);if(T===FY)return b(k,E,M);if(T===jY)return s(k,E,M);if(T===_Y)return u(k,E,M);if(BY[T])return y(k,E,M);if(T===MY)return t(k,E,M);if(T===RY)return n(k,E,M);if(T===AY||T===IY||T===zY)return d(k,E,M);if(v){let A=v[T];if(!A){const j=fY(k);j&&(A=v[j])}if(A)return A(k,E,M)}return!1}}function UY({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:yY,areArraysEqual:n?Md:bY,areDataViewsEqual:vY,areDatesEqual:wY,areErrorsEqual:xY,areFunctionsEqual:SY,areMapsEqual:n?tw(qA,Md):qA,areNumbersEqual:kY,areObjectsEqual:n?Md:CY,arePrimitiveWrappersEqual:EY,areRegExpsEqual:TY,areSetsEqual:n?tw(GA,Md):GA,areTypedArraysEqual:n?tw(pg,Md):pg,areUrlsEqual:NY,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const s=zp(r.areArraysEqual),i=zp(r.areMapsEqual),o=zp(r.areObjectsEqual),l=zp(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:l})}return r}function WY(t){return function(e,n,r,s,i,o,l){return t(e,n,l)}}function qY({circular:t,comparator:e,createState:n,equals:r,strict:s}){if(n)return function(l,u){const{cache:d=t?new WeakMap:void 0,meta:h}=n();return e(l,u,{cache:d,equals:r,meta:h,strict:s})};if(t)return function(l,u){return e(l,u,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const i={cache:void 0,equals:r,meta:void 0,strict:s};return function(l,u){return e(l,u,i)}}const GY=$a();$a({strict:!0});$a({circular:!0});$a({circular:!0,strict:!0});$a({createInternalComparator:()=>ql});$a({strict:!0,createInternalComparator:()=>ql});$a({circular:!0,createInternalComparator:()=>ql});$a({circular:!0,createInternalComparator:()=>ql,strict:!0});function $a(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:s=!1}=t,i=UY(t),o=HY(i),l=n?n(o):WY(o);return qY({circular:e,comparator:o,createState:r,equals:l,strict:s})}var nw={exports:{}},rw={};var YA;function YY(){if(YA)return rw;YA=1;var t=Hf(),e=sI();function n(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var r=typeof Object.is=="function"?Object.is:n,s=e.useSyncExternalStore,i=t.useRef,o=t.useEffect,l=t.useMemo,u=t.useDebugValue;return rw.useSyncExternalStoreWithSelector=function(d,h,m,y,b){var v=i(null);if(v.current===null){var x={hasValue:!1,value:null};v.current=x}else x=v.current;v=l(function(){function E(A){if(!M){if(M=!0,_=A,A=y(A),b!==void 0&&x.hasValue){var j=x.value;if(b(j,A))return N=j}return N=A}if(j=N,r(_,A))return j;var P=y(A);return b!==void 0&&b(j,P)?(_=A,j):(_=A,N=P)}var M=!1,_,N,T=m===void 0?null:m;return[function(){return E(h())},T===null?void 0:function(){return E(T())}]},[h,m,y,b]);var k=s(d,v[0],v[1]);return o(function(){x.hasValue=!0,x.value=k},[k]),u(k),k},rw}var KA;function KY(){return KA||(KA=1,nw.exports=YY()),nw.exports}var ZY=KY(),XY=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},JY=({contentComponent:t})=>{const e=iI.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return p.jsx(p.Fragment,{children:Object.values(e)})};function QY(){const t=new Set;let e={},n=!1;const r=()=>{n||!t.size||(n=!0,queueMicrotask(()=>{n=!1,t.forEach(s=>s())}))};return{subscribe(s){return t.add(s),()=>{t.delete(s)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(s,i){e={...e,[s]:pW.createPortal(i.reactElement,i.element,s)},r()},removeRenderer(s){const i={...e};delete i[s],e=i,r()}}}var eK=class extends fe.Component{constructor(t){super(t),this.editorContentRef=fe.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=QY(),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 p.jsxs(p.Fragment,{children:[p.jsx("div",{ref:XY(e,this.editorContentRef),...n}),t?.contentComponent&&p.jsx(JY,{contentComponent:t.contentComponent})]})}},tK=C.forwardRef((t,e)=>{const n=fe.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return fe.createElement(eK,{key:n,innerRef:e,...t})}),SP=fe.memo(tK),nK=typeof window<"u"?C.useLayoutEffect:C.useEffect,rK=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=s=>{s?.transaction!==void 0&&s.transaction===e||(e=s?.transaction,this.transactionNumber+=1,this.subscribers.forEach(i=>i()))},r=this.editor;return r.on("transaction",n),r.on("update",n),()=>{r.off("transaction",n),r.off("update",n)}}}};function kP(t){var e;const[n]=C.useState(()=>new rK(t.editor)),r=ZY.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:GY);return nK(()=>n.watch(t.editor),[t.editor,n]),C.useDebugValue(r),r}var sK=!1,CP=typeof window>"u",iK=CP||!!(typeof window<"u"&&window.next),oK=class EP{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 CP?(n&&sK&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):iK&&e===void 0&&(n=!1),n?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onBeforeCreate)==null?void 0:i.call(s,...r)},onBlur:(...r)=>{var s,i;return(i=(s=this.options.current).onBlur)==null?void 0:i.call(s,...r)},onCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onCreate)==null?void 0:i.call(s,...r)},onDestroy:(...r)=>{var s,i;return(i=(s=this.options.current).onDestroy)==null?void 0:i.call(s,...r)},onFocus:(...r)=>{var s,i;return(i=(s=this.options.current).onFocus)==null?void 0:i.call(s,...r)},onSelectionUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onSelectionUpdate)==null?void 0:i.call(s,...r)},onTransaction:(...r)=>{var s,i;return(i=(s=this.options.current).onTransaction)==null?void 0:i.call(s,...r)},onUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onUpdate)==null?void 0:i.call(s,...r)},onContentError:(...r)=>{var s,i;return(i=(s=this.options.current).onContentError)==null?void 0:i.call(s,...r)},onDrop:(...r)=>{var s,i;return(i=(s=this.options.current).onDrop)==null?void 0:i.call(s,...r)},onPaste:(...r)=>{var s,i;return(i=(s=this.options.current).onPaste)==null?void 0:i.call(s,...r)},onDelete:(...r)=>{var s,i;return(i=(s=this.options.current).onDelete)==null?void 0:i.call(s,...r)},onMount:(...r)=>{var s,i;return(i=(s=this.options.current).onMount)==null?void 0:i.call(s,...r)},onUnmount:(...r)=>{var s,i;return(i=(s=this.options.current).onUnmount)==null?void 0:i.call(s,...r)}};return new oY(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((s,i)=>{var o;return s===((o=n.extensions)==null?void 0:o[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?EP.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,s)=>r===e[s]))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 aK(t={},e=[]){const n=C.useRef(t);n.current=t;const[r]=C.useState(()=>new oK(n)),s=iI.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return C.useDebugValue(s),C.useEffect(r.onRender(e)),kP({editor:s,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),s}var TP=C.createContext({editor:null});TP.Consumer;var lK=C.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),cK=()=>C.useContext(lK);fe.forwardRef((t,e)=>{const{onDragStart:n}=cK(),r=t.as||"div";return p.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});fe.createContext({markViewContentRef:()=>{}});var Xk=C.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Xk.displayName="TiptapContext";var uK=()=>C.useContext(Xk);function NP({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=C.useMemo(()=>({editor:n}),[n]),s=C.useMemo(()=>({editor:n}),[n]);return p.jsx(TP.Provider,{value:s,children:p.jsx(Xk.Provider,{value:r,children:t})})}NP.displayName="Tiptap";function MP({...t}){const{editor:e}=uK();return p.jsx(SP,{editor:e,...t})}MP.displayName="Tiptap.Content";Object.assign(NP,{Content:MP});var mg=(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]},dK=(t,e)=>{var n;const{state:r,view:s}=t,{selection:i}=r;if(!i.empty)return!1;const{$from:o}=i;if(o.parentOffset!==0)return!1;const l=o.depth-1;if(l<0)return!1;const u=o.node(l),d=o.index(l);if(d===0)return!1;if(u.type===e)return t.commands.lift(e.name);const h=u.child(d-1);if(h.type!==e||!((n=h.lastChild)!=null&&n.isTextblock))return!1;const m=o.before(),b=m-1-1,{tr:v}=r;return v.delete(m,o.after()).insert(b,o.parent.content),v.setSelection(Ue.create(v.doc,b)),s.dispatch(v.scrollIntoView()),!0},fK=/^\s*>\s$/,hK=Gn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return mg("blockquote",{...Yt(this.options.HTMLAttributes,t),children:mg("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((s,i)=>{var o,l;const h=((l=(o=e.renderChild)==null?void 0:o.call(e,s,i))!=null?l:e.renderChildren([s])).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:()=>dK(this.editor,this.type)}},addInputRules(){return[gu({find:fK,type:this.type})]}}),pK=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,mK=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,gK=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,yK=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,bK=Wl.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 mg("strong",{...Yt(this.options.HTMLAttributes,t),children:mg("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[jl({find:pK,type:this.type}),jl({find:gK,type:this.type})]},addPasteRules(){return[_a({find:mK,type:this.type}),_a({find:yK,type:this.type})]}}),vK=t=>{const e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},wK=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},xK=Wl.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Yt(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[jl({find:vK,type:this.type})]},addPasteRules(){return[_a({find:wK,type:this.type})]}}),sw=4,SK=/^```([a-z]+)?[\s\n]$/,kK=/^~~~([a-z]+)?[\s\n]$/,CK=Gn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:sw,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 i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Yt(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 s=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${s}`,e.renderChildren(t.content),"```"].join(`
172
+ `):r=`\`\`\`${s}
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:sw,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;if(i.parent.type!==this.type)return!1;const l=" ".repeat(n);return o?t.commands.insertContent(l):t.commands.command(({tr:u})=>{const{from:d,to:h}=s,b=r.doc.textBetween(d,h,`
175
+ `,`
176
+ `).split(`
177
+ `).map(v=>l+v).join(`
178
+ `);return u.replaceWith(d,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:sw,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;return i.parent.type!==this.type?!1:o?t.commands.command(({tr:l})=>{var u;const{pos:d}=i,h=i.start(),m=i.end(),b=r.doc.textBetween(h,m,`
179
+ `,`
180
+ `).split(`
181
+ `);let v=0,x=0;const k=d-h;for(let A=0;A<b.length;A+=1){if(x+b[A].length>=k){v=A;break}x+=b[A].length+1}const M=((u=b[v].match(/^ */))==null?void 0:u[0])||"",_=Math.min(M.length,n);if(_===0)return!0;let N=h;for(let A=0;A<v;A+=1)N+=b[A].length+1;return l.delete(N,N+_),d-N<=_&&l.setSelection(Ue.create(l.doc,N)),!0}):t.commands.command(({tr:l})=>{const{from:u,to:d}=s,y=r.doc.textBetween(u,d,`
182
+ `,`
183
+ `).split(`
184
+ `).map(b=>{var v;const x=((v=b.match(/^ */))==null?void 0:v[0])||"",k=Math.min(x.length,n);return b.slice(k)}).join(`
185
+ `);return l.replaceWith(u,d,r.schema.text(y)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
186
+
187
+ `);return!i||!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:s}=n;if(!s||r.parent.type!==this.type||r.parentOffset!==0)return!1;const i=r.before();return i>0?!1:t.commands.insertDefaultBlock({pos:i})},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:s,empty:i}=n;if(!i||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const l=s.after();return l===void 0?!1:r.nodeAt(l)?t.commands.command(({tr:d})=>(d.setSelection(nt.near(r.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[Ux({find:SK,type:this.type,getAttributes:t=>({language:t[1]})}),Ux({find:kK,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Kt({key:new yn("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"),s=r?JSON.parse(r):void 0,i=s?.mode;if(!n||!i)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:i},u)),o.selection.$from.parent.type!==this.type&&o.setSelection(Ue.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),EK=Gn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
189
+
190
+ `):""}),TK=Gn.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",Yt(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:s,storedMarks:i}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,u=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:h})=>{if(h&&u&&o){const m=u.filter(y=>l.includes(y.type.name));d.ensureMarks(m)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),NK=Gn.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]}`,Yt(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,s="#".repeat(r);return t.content?`${s} ${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=>Ux({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),MK=Gn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Yt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!$7(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,s=t();return eP(n)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:i,tr:o,dispatch:l})=>{if(l){const{$to:u}=o.selection,d=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(Ue.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(Ge.create(o.doc,u.pos)):o.setSelection(Ue.create(o.doc,u.pos));else{const h=i.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,m=h?.create();m&&(o.insert(d,m),o.setSelection(Ue.create(o.doc,d+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[vP({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),_K=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,AK=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,RK=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,OK=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,jK=Wl.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",Yt(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[jl({find:_K,type:this.type}),jl({find:RK,type:this.type})]},addPasteRules(){return[_a({find:AK,type:this.type}),_a({find:OK,type:this.type})]}});const DK="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",IK="ελ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",Wx="numeric",qx="ascii",Gx="alpha",nf="asciinumeric",Hd="alphanumeric",Yx="domain",_P="emoji",LK="scheme",PK="slashscheme",iw="whitespace";function $K(t,e){return t in e||(e[t]=[]),e[t]}function vl(t,e,n){e[Wx]&&(e[nf]=!0,e[Hd]=!0),e[qx]&&(e[nf]=!0,e[Gx]=!0),e[nf]&&(e[Hd]=!0),e[Gx]&&(e[Hd]=!0),e[Hd]&&(e[Yx]=!0),e[_P]&&(e[Yx]=!0);for(const r in e){const s=$K(r,n);s.indexOf(t)<0&&s.push(t)}}function zK(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function zr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}zr.groups={};zr.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 s=e.jr[r][0],i=e.jr[r][1];if(i&&s.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let s=0;s<t.length;s++)this.tt(t[s],e,n,r)},tr(t,e,n,r){r=r||zr.groups;let s;return e&&e.j?s=e:(s=new zr(e),n&&r&&vl(e,n,r)),this.jr.push([t,s]),s},ts(t,e,n,r){let s=this;const i=t.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(t[o]);return s.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||zr.groups;const s=this;if(e&&e.j)return s.j[t]=e,e;const i=e;let o,l=s.go(t);if(l?(o=new zr,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new zr,i){if(r)if(o.t&&typeof o.t=="string"){const u=Object.assign(zK(o.t,r),n);vl(i,u,r)}else n&&vl(i,n,r);o.t=i}return s.j[t]=o,o}};const dt=(t,e,n,r,s)=>t.ta(e,n,r,s),pn=(t,e,n,r,s)=>t.tr(e,n,r,s),ZA=(t,e,n,r,s)=>t.ts(e,n,r,s),ke=(t,e,n,r,s)=>t.tt(e,n,r,s),qi="WORD",Kx="UWORD",AP="ASCIINUMERICAL",RP="ALPHANUMERICAL",Df="LOCALHOST",Zx="TLD",Xx="UTLD",Am="SCHEME",Uc="SLASH_SCHEME",Jk="NUM",Jx="WS",Qk="NL",rf="OPENBRACE",sf="CLOSEBRACE",gg="OPENBRACKET",yg="CLOSEBRACKET",bg="OPENPAREN",vg="CLOSEPAREN",wg="OPENANGLEBRACKET",xg="CLOSEANGLEBRACKET",Sg="FULLWIDTHLEFTPAREN",kg="FULLWIDTHRIGHTPAREN",Cg="LEFTCORNERBRACKET",Eg="RIGHTCORNERBRACKET",Tg="LEFTWHITECORNERBRACKET",Ng="RIGHTWHITECORNERBRACKET",Mg="FULLWIDTHLESSTHAN",_g="FULLWIDTHGREATERTHAN",Ag="AMPERSAND",Rg="APOSTROPHE",Og="ASTERISK",ea="AT",jg="BACKSLASH",Dg="BACKTICK",Ig="CARET",wl="COLON",eC="COMMA",Lg="DOLLAR",li="DOT",Pg="EQUALS",tC="EXCLAMATION",Ss="HYPHEN",of="PERCENT",$g="PIPE",zg="PLUS",Bg="POUND",af="QUERY",nC="QUOTE",OP="FULLWIDTHMIDDLEDOT",rC="SEMI",ci="SLASH",lf="TILDE",Fg="UNDERSCORE",jP="EMOJI",Vg="SYM";var DP=Object.freeze({__proto__:null,ALPHANUMERICAL:RP,AMPERSAND:Ag,APOSTROPHE:Rg,ASCIINUMERICAL:AP,ASTERISK:Og,AT:ea,BACKSLASH:jg,BACKTICK:Dg,CARET:Ig,CLOSEANGLEBRACKET:xg,CLOSEBRACE:sf,CLOSEBRACKET:yg,CLOSEPAREN:vg,COLON:wl,COMMA:eC,DOLLAR:Lg,DOT:li,EMOJI:jP,EQUALS:Pg,EXCLAMATION:tC,FULLWIDTHGREATERTHAN:_g,FULLWIDTHLEFTPAREN:Sg,FULLWIDTHLESSTHAN:Mg,FULLWIDTHMIDDLEDOT:OP,FULLWIDTHRIGHTPAREN:kg,HYPHEN:Ss,LEFTCORNERBRACKET:Cg,LEFTWHITECORNERBRACKET:Tg,LOCALHOST:Df,NL:Qk,NUM:Jk,OPENANGLEBRACKET:wg,OPENBRACE:rf,OPENBRACKET:gg,OPENPAREN:bg,PERCENT:of,PIPE:$g,PLUS:zg,POUND:Bg,QUERY:af,QUOTE:nC,RIGHTCORNERBRACKET:Eg,RIGHTWHITECORNERBRACKET:Ng,SCHEME:Am,SEMI:rC,SLASH:ci,SLASH_SCHEME:Uc,SYM:Vg,TILDE:lf,TLD:Zx,UNDERSCORE:Fg,UTLD:Xx,UWORD:Kx,WORD:qi,WS:Jx});const Hi=/[a-z]/,_d=new RegExp("\\p{L}","u"),ow=new RegExp("\\p{Emoji}","u"),Ui=/\d/,aw=/\s/,XA="\r",lw=`
193
+ `,BK="️",FK="‍",cw="";let Bp=null,Fp=null;function VK(t=[]){const e={};zr.groups=e;const n=new zr;Bp==null&&(Bp=JA(DK)),Fp==null&&(Fp=JA(IK)),ke(n,"'",Rg),ke(n,"{",rf),ke(n,"}",sf),ke(n,"[",gg),ke(n,"]",yg),ke(n,"(",bg),ke(n,")",vg),ke(n,"<",wg),ke(n,">",xg),ke(n,"(",Sg),ke(n,")",kg),ke(n,"「",Cg),ke(n,"」",Eg),ke(n,"『",Tg),ke(n,"』",Ng),ke(n,"<",Mg),ke(n,">",_g),ke(n,"&",Ag),ke(n,"*",Og),ke(n,"@",ea),ke(n,"`",Dg),ke(n,"^",Ig),ke(n,":",wl),ke(n,",",eC),ke(n,"$",Lg),ke(n,".",li),ke(n,"=",Pg),ke(n,"!",tC),ke(n,"-",Ss),ke(n,"%",of),ke(n,"|",$g),ke(n,"+",zg),ke(n,"#",Bg),ke(n,"?",af),ke(n,'"',nC),ke(n,"/",ci),ke(n,";",rC),ke(n,"~",lf),ke(n,"_",Fg),ke(n,"\\",jg),ke(n,"・",OP);const r=pn(n,Ui,Jk,{[Wx]:!0});pn(r,Ui,r);const s=pn(r,Hi,AP,{[nf]:!0}),i=pn(r,_d,RP,{[Hd]:!0}),o=pn(n,Hi,qi,{[qx]:!0});pn(o,Ui,s),pn(o,Hi,o),pn(s,Ui,s),pn(s,Hi,s);const l=pn(n,_d,Kx,{[Gx]:!0});pn(l,Hi),pn(l,Ui,i),pn(l,_d,l),pn(i,Ui,i),pn(i,Hi),pn(i,_d,i);const u=ke(n,lw,Qk,{[iw]:!0}),d=ke(n,XA,Jx,{[iw]:!0}),h=pn(n,aw,Jx,{[iw]:!0});ke(n,cw,h),ke(d,lw,u),ke(d,cw,h),pn(d,aw,h),ke(h,XA),ke(h,lw),pn(h,aw,h),ke(h,cw,h);const m=pn(n,ow,jP,{[_P]:!0});ke(m,"#"),pn(m,ow,m),ke(m,BK,m);const y=ke(m,FK);ke(y,"#"),pn(y,ow,m);const b=[[Hi,o],[Ui,s]],v=[[Hi,null],[_d,l],[Ui,i]];for(let x=0;x<Bp.length;x++)Yo(n,Bp[x],Zx,qi,b);for(let x=0;x<Fp.length;x++)Yo(n,Fp[x],Xx,Kx,v);vl(Zx,{tld:!0,ascii:!0},e),vl(Xx,{utld:!0,alpha:!0},e),Yo(n,"file",Am,qi,b),Yo(n,"mailto",Am,qi,b),Yo(n,"http",Uc,qi,b),Yo(n,"https",Uc,qi,b),Yo(n,"ftp",Uc,qi,b),Yo(n,"ftps",Uc,qi,b),vl(Am,{scheme:!0,ascii:!0},e),vl(Uc,{slashscheme:!0,ascii:!0},e),t=t.sort((x,k)=>x[0]>k[0]?1:-1);for(let x=0;x<t.length;x++){const k=t[x][0],M=t[x][1]?{[LK]:!0}:{[PK]:!0};k.indexOf("-")>=0?M[Yx]=!0:Hi.test(k)?Ui.test(k)?M[nf]=!0:M[qx]=!0:M[Wx]=!0,ZA(n,k,k,M)}return ZA(n,"localhost",Df,{ascii:!0}),n.jd=new zr(Vg),{start:n,tokens:Object.assign({groups:e},DP)}}function IP(t,e){const n=HK(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,s=[];let i=0,o=0;for(;o<r;){let l=t,u=null,d=0,h=null,m=-1,y=-1;for(;o<r&&(u=l.go(n[o]));)l=u,l.accepts()?(m=0,y=0,h=l):m>=0&&(m+=n[o].length,y++),d+=n[o].length,i+=n[o].length,o++;i-=m,o-=y,d-=m,s.push({t:h.t,v:e.slice(i-d,i),s:i-d,e:i})}return s}function HK(t){const e=[],n=t.length;let r=0;for(;r<n;){let s=t.charCodeAt(r),i,o=s<55296||s>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Yo(t,e,n,r,s){let i;const o=e.length;for(let l=0;l<o-1;l++){const u=e[l];t.j[u]?i=t.j[u]:(i=new zr(r),i.jr=s.slice(),t.j[u]=i),t=i}return i=new zr(n),i.jr=s.slice(),t.j[e[o-1]]=i,i}function JA(t){const e=[],n=[];let r=0,s="0123456789";for(;r<t.length;){let i=0;for(;s.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(t[r]),r++}return e}const If={defaultProtocol:"http",events:null,format:QA,formatHref:QA,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function sC(t,e=null){let n=Object.assign({},If);t&&(n=Object.assign(n,t instanceof sC?t.o:t));const r=n.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=s}sC.prototype={o:If,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let s=this.o[t];return s&&(typeof s=="object"?(s=n.t in s?s[n.t]:If[t],typeof s=="function"&&r&&(s=s(e,n))):typeof s=="function"&&r&&(s=s(e,n.t,n)),s)},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 QA(t){return t}function LP(t,e){this.t="token",this.v=t,this.tk=e}LP.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=If.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),s=t.get("tagName",n,e),i=this.toFormattedString(t),o={},l=t.get("className",n,e),u=t.get("target",n,e),d=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),d&&(o.rel=d),h&&Object.assign(o,h),{tagName:s,attributes:o,content:i,eventListeners:m}}};function My(t,e){class n extends LP{constructor(s,i){super(s,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const UK=My("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),eR=My("text"),WK=My("nl"),Vp=My("url",{isLink:!0,toHref(t=If.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Df&&t[1].t===wl}}),xs=t=>new zr(t);function qK({groups:t}){const e=t.domain.concat([Ag,Og,ea,jg,Dg,Ig,Lg,Pg,Ss,Jk,of,$g,zg,Bg,ci,Vg,lf,Fg]),n=[Rg,wl,eC,li,tC,of,af,nC,rC,wg,xg,rf,sf,yg,gg,bg,vg,Sg,kg,Cg,Eg,Tg,Ng,Mg,_g],r=[Ag,Rg,Og,jg,Dg,Ig,Lg,Pg,Ss,rf,sf,of,$g,zg,Bg,af,ci,Vg,lf,Fg],s=xs(),i=ke(s,lf);dt(i,r,i),dt(i,t.domain,i);const o=xs(),l=xs(),u=xs();dt(s,t.domain,o),dt(s,t.scheme,l),dt(s,t.slashscheme,u),dt(o,r,i),dt(o,t.domain,o);const d=ke(o,ea);ke(i,ea,d),ke(l,ea,d),ke(u,ea,d);const h=ke(i,li);dt(h,r,i),dt(h,t.domain,i);const m=xs();dt(d,t.domain,m),dt(m,t.domain,m);const y=ke(m,li);dt(y,t.domain,m);const b=xs(UK);dt(y,t.tld,b),dt(y,t.utld,b),ke(d,Df,b);const v=ke(m,Ss);ke(v,Ss,v),dt(v,t.domain,m),dt(b,t.domain,m),ke(b,li,y),ke(b,Ss,v);const x=ke(o,Ss),k=ke(o,li);ke(x,Ss,x),dt(x,t.domain,o),dt(k,r,i),dt(k,t.domain,o);const E=xs(Vp);dt(k,t.tld,E),dt(k,t.utld,E),dt(E,t.domain,o),dt(E,r,i),ke(E,li,k),ke(E,Ss,x),ke(E,ea,d);const M=ke(E,wl),_=xs(Vp);dt(M,t.numeric,_);const N=xs(Vp),T=xs();dt(N,e,N),dt(N,n,T),dt(T,e,N),dt(T,n,T),ke(E,ci,N),ke(_,ci,N);const A=ke(l,wl),j=ke(u,wl),P=ke(j,ci),O=ke(P,ci);dt(l,t.domain,o),ke(l,li,k),ke(l,Ss,x),dt(u,t.domain,o),ke(u,li,k),ke(u,Ss,x),dt(A,t.domain,N),ke(A,ci,N),ke(A,af,N),dt(O,t.domain,N),dt(O,e,N),ke(O,ci,N);const G=[[rf,sf],[gg,yg],[bg,vg],[wg,xg],[Sg,kg],[Cg,Eg],[Tg,Ng],[Mg,_g]];for(let B=0;B<G.length;B++){const[W,K]=G[B],Q=ke(N,W);ke(T,W,Q);const ee=xs(Vp);dt(Q,e,ee);const F=xs();dt(Q,n,F),ke(Q,K,N),dt(ee,e,ee),dt(ee,n,F),dt(F,e,ee),dt(F,n,F),ke(ee,K,N),ke(F,K,N)}return ke(s,Df,E),ke(s,Qk,WK),{start:s,tokens:DP}}function GK(t,e,n){let r=n.length,s=0,i=[],o=[];for(;s<r;){let l=t,u=null,d=null,h=0,m=null,y=-1;for(;s<r&&!(u=l.go(n[s].t));)o.push(n[s++]);for(;s<r&&(d=u||l.go(n[s].t));)u=null,l=d,l.accepts()?(y=0,m=l):y>=0&&y++,s++,h++;if(y<0)s-=h,s<r&&(o.push(n[s]),s++);else{o.length>0&&(i.push(uw(eR,e,o)),o=[]),s-=y,h-=y;const b=m.t,v=n.slice(s-h,s);i.push(uw(b,e,v))}}return o.length>0&&i.push(uw(eR,e,o)),i}function uw(t,e,n){const r=n[0].s,s=n[n.length-1].e,i=e.slice(r,s);return new t(i,n)}const YK=typeof console<"u"&&console&&console.warn||(()=>{}),KK="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Jt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function ZK(){return zr.groups={},Jt.scanner=null,Jt.parser=null,Jt.tokenQueue=[],Jt.pluginQueue=[],Jt.customSchemes=[],Jt.initialized=!1,Jt}function tR(t,e=!1){if(Jt.initialized&&YK(`linkifyjs: already initialized - will not register custom scheme "${t}" ${KK}`),!/^[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`);Jt.customSchemes.push([t,e])}function XK(){Jt.scanner=VK(Jt.customSchemes);for(let t=0;t<Jt.tokenQueue.length;t++)Jt.tokenQueue[t][1]({scanner:Jt.scanner});Jt.parser=qK(Jt.scanner.tokens);for(let t=0;t<Jt.pluginQueue.length;t++)Jt.pluginQueue[t][1]({scanner:Jt.scanner,parser:Jt.parser});return Jt.initialized=!0,Jt}function iC(t){return Jt.initialized||XK(),GK(Jt.parser.start,t,IP(Jt.scanner.start,t))}iC.scan=IP;function PP(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 sC(n),s=iC(t),i=[];for(let o=0;o<s.length;o++){const l=s[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&i.push(l.toFormattedObject(r))}return i}var oC="[\0-   ᠎ -\u2029  ]",JK=new RegExp(oC),QK=new RegExp(`${oC}$`),eZ=new RegExp(oC,"g");function tZ(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function nZ(t){return new Kt({key:new yn("autolink"),appendTransaction:(e,n,r)=>{const s=e.some(d=>d.docChanged)&&!n.doc.eq(r.doc),i=e.some(d=>d.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,l=WL(n.doc,[...e]);if(Wk(l).forEach(({newRange:d})=>{const h=JG(r.doc,d,b=>b.isTextblock);let m,y;if(h.length>1)m=h[0],y=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(h.length){const b=r.doc.textBetween(d.from,d.to," "," ");if(!QK.test(b))return;m=h[0],y=r.doc.textBetween(m.pos,d.to,void 0," ")}if(m&&y){const b=y.split(JK).filter(Boolean);if(b.length<=0)return!1;const v=b[b.length-1],x=m.pos+y.lastIndexOf(v);if(!v)return!1;const k=iC(v).map(E=>E.toObject(t.defaultProtocol));if(!tZ(k))return!1;k.filter(E=>E.isLink).map(E=>({...E,from:x+E.start+1,to:x+E.end+1})).filter(E=>r.schema.marks.code?!r.doc.rangeHasMark(E.from,E.to,r.schema.marks.code):!0).filter(E=>t.validate(E.value)).filter(E=>t.shouldAutoLink(E.value)).forEach(E=>{qk(E.from,E.to,r.doc).some(M=>M.mark.type===t.type)||o.addMark(E.from,E.to,t.type.create({href:E.href}))})}}),!!o.steps.length)return o}})}function rZ(t){return new Kt({key:new yn("handleClickLink"),props:{handleClick:(e,n,r)=>{var s,i;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 d=t.editor.view.dom;o=u.closest("a"),o&&!d.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=QL(e.state,t.type.name),d=(s=o.href)!=null?s:u.href,h=(i=o.target)!=null?i:u.target;d&&(window.open(d,h),l=!0)}return l}}})}var sZ=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,iZ=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function $P(t,e){let n=0;for(let r=e-1;r>=0&&t[r]==="\\";r-=1)n+=1;return n%2===1}function oZ(t,e){let n=0,r=0;for(;r<e;){if(t[r]!=="`"){r+=1;continue}if(n===0&&$P(t,r)){r+=1;continue}let s=0;for(;r<e&&t[r]==="`";)s+=1,r+=1;n===0?n=s:s===n&&(n=0)}return n>0}function zP(t,e,n){var r,s;const[,i,o]=e;return(e.index?t[e.index-1]:void 0)==="!"||$P(t,(r=e.index)!=null?r:0)||oZ(t,(s=e.index)!=null?s:0)?!1:!!i.trim()&&n(o)}function BP(t){var e,n;const[r,s,i,,o,l,u]=t,d=(e=o??l)!=null?e:u;return{index:(n=t.index)!=null?n:0,text:r,replaceWith:s,data:{href:i,title:d||null,markdown:!0}}}function aZ(t,e){return t.index<e.index+e.text.length&&e.index<t.index+t.text.length}function FP(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 lZ(t){const e=jl({find:n=>{const r=sZ.exec(n);return!r||!zP(n,r,t.isAllowedHref)?null:BP(r)},type:t.type,getAttributes:FP});return new ah({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 cZ(t){const e=_a({find:n=>{var r,s;const i=[];for(const l of n.matchAll(iZ))zP(n,l,t.isAllowedHref)&&i.push(BP(l));const o=((s=(r=t.findPlainUrls)==null?void 0:r.call(t,n))!=null?s:[]).filter(l=>!i.some(u=>aZ(u,l)));return[...i,...o]},type:t.type,getAttributes:FP});return new oP({find:e.find,handler:n=>{var r;const s=e.handler(n);return s!==null&&n.state.tr.steps.length&&((r=n.match.data)!=null&&r.markdown)&&n.state.tr.setMeta("preventAutolink",!0),s}})}function uZ(t){return new Kt({key:new yn("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:s}=t,{state:i}=e,{selection:o}=i,{empty:l}=o;if(l)return!1;let u="";r.content.forEach(h=>{u+=h.textContent});const d=PP(u,{defaultProtocol:t.defaultProtocol}).find(h=>h.isLink&&h.value===u);return!u||!d||s!==void 0&&!s(d.value)?!1:t.editor.commands.setMark(t.type,{href:d.href})}}})}function Wi(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!t||t.replace(eZ,"").match(new RegExp(`^(?:(?:${n.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}var dZ=Wl.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"){tR(t);return}tR(t.scheme,t.optionalSlashes)})},onDestroy(){ZK()},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)=>!!Wi(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 s=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||!/\./.test(s))}}},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=>!!Wi(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=>!!Wi(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Yt(this.options.HTMLAttributes,t),0]:["a",Yt(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,s,i;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",l=(i=(s=t.attrs)==null?void 0:s.title)!=null?i:"",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=>!!Wi(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=>!!Wi(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?[lZ({type:this.type,isAllowedHref:t=>this.options.isAllowedUri(t,{defaultValidate:e=>!!Wi(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){const t=e=>{const n=[];if(e){const{protocols:r,defaultProtocol:s}=this.options;PP(e).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:l=>!!Wi(l,r),protocols:r,defaultProtocol:s})).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?[cZ({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:n=>!!Wi(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:t})]:[_a({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(nZ({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!Wi(s,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(rZ({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(uZ({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),fZ=Object.defineProperty,hZ=(t,e)=>{for(var n in e)fZ(t,n,{get:e[n],enumerable:!0})},pZ="listItem",nR="textStyle",rR=/^\s*([-+*])\s$/,VP=Gn.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",Yt(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(pZ,this.editor.getAttributes(nR)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=gu({find:rR,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=gu({find:rR,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(nR),editor:this.editor})),[t]}}),mZ=(t,e,n)=>{const{selection:r}=t;if(!r.empty)return null;const{$from:s}=r;if(!s.parent.isTextblock||s.parentOffset!==s.parent.content.size)return null;let i=-1;for(let b=s.depth;b>0;b-=1)if(s.node(b).type.name===e){i=b;break}if(i<0)return null;const o=s.node(i),l=s.index(i);if(l+1>=o.childCount)return null;const u=o.child(l+1);if(!n.includes(u.type.name))return null;const d=t.schema.nodes[e];let h=!1;if(u.forEach(b=>{b.type===d&&b.childCount>1&&(h=!0)}),!h)return null;const m=t.doc.resolve(s.after()).nodeAfter;if(!m||!n.includes(m.type.name))return null;const y=[];return m.forEach(b=>{y.push(b)}),y.length===0?null:{listItemDepth:i,nestedList:m,nestedListPos:s.after(),insertPos:s.after(i),items:y}},gZ=(t,e,n,r)=>{const s=mZ(t,n,r);if(!s)return!1;const{selection:i}=t,{nestedList:o,nestedListPos:l,insertPos:u,items:d}=s,h=t.tr;h.delete(l,l+o.nodeSize);const m=h.mapping.map(u);return h.insert(m,ge.from(d)),h.setSelection(i.map(h.doc,h.mapping)),e&&e(h),!0},yZ=(t,e,n)=>gZ(t.state,t.view.dispatch,e,n),HP=(t,e)=>rn.create({name:`${t}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const n=()=>yZ(this.editor,t,e);return{Delete:n,"Mod-Delete":n}}}),UP=[[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"]],Hp="abcdefghijklmnopqrstuvwxyz",bZ="[a-zA-Z]{1,2}",WP=String.raw`\d+|[ivxlcdmIVXLCDM]+|${bZ}`;function _y(t){let e=t,n="";for(const[r,s]of UP)for(;e>=r;)n+=s,e-=r;return n}function aC(t){return _y(t).toUpperCase()}function qP(t){const e=t.toLowerCase();let n=0,r=0;for(;n<e.length;){let s=!1;for(const[i,o]of UP)if(e.startsWith(o,n)){r+=i,n+=o.length,s=!0;break}if(!s)return 0}return r}function vZ(t){if(!/^[ivxlcdmIVXLCDM]+$/.test(t))return!1;const e=qP(t);return e<=0?!1:(t===t.toLowerCase()?_y(e):aC(e))===t}function wZ(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 Hg(t){if(t<=26)return Hp[t-1];const e=Math.floor((t-1)/26)-1,n=(t-1)%26;return e<0?Hp[n]:Hp[e]+Hp[n]}function Ay(t){if(!(!t||/^\d+$/.test(t))){if(vZ(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 lC(t){if(/^\d+$/.test(t))return parseInt(t,10);const e=Ay(t);if(e==="i"||e==="I")return qP(t);if(e==="a"||e==="A"){const r=wZ(t);return r>0?r:1}const n=parseInt(t,10);return Number.isNaN(n)?1:n}function xZ(t,e){if(t==="numeric")return String(e);switch(t){case"a":return Hg(e);case"A":return Hg(e).toUpperCase();case"i":return _y(e);case"I":return aC(e);default:return String(e)}}function SZ(t){var e;if(t.length===0)return!1;const n=(e=Ay(t[0]))!=null?e:"numeric",r=lC(t[0]);if(r<1)return!1;for(let s=0;s<t.length;s++){const i=xZ(n,r+s);if(t[s]!==i)return!1}return!0}function kZ(t){return{type:Ay(t),start:lC(t)}}function CZ(t){const{type:e,start:n}=kZ(t),r={};return e&&(r.type=e),n!==1&&(r.start=n),r}function EZ(t,e,n=". "){const r=e+1;if(!t||t==="1")return`${r}${n}`;switch(t){case"a":return`${Hg(r)}${n}`;case"A":return`${Hg(r).toUpperCase()}${n}`;case"i":return`${_y(r)}${n}`;case"I":return`${aC(r)}${n}`;default:return`${r}${n}`}}function TZ(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 NZ(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}var GP=Gn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Yt(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 s=[];if(t.tokens&&t.tokens.length>0){if(TZ(t))return{type:"listItem",content:[{type:"paragraph",content:NZ(t.text||"",e)}]};if(t.tokens.some(o=>o.type==="paragraph"))s=r(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(s=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const u=t.tokens.slice(1),d=r(u);s.push(...d)}}else s=r(t.tokens)}}return s.length===0&&(s=[{type:"paragraph",content:[]}]),{type:"listItem",content:s}},renderMarkdown:(t,e,n)=>Kk(t,e,r=>{var s,i,o,l;if(r.parentType==="bulletList")return"- ";if(r.parentType==="orderedList"){const u=((i=(s=r.meta)==null?void 0:s.parentAttrs)==null?void 0:i.start)||1,d=(l=(o=r.meta)==null?void 0:o.parentAttrs)==null?void 0:l.type,h=u-1+(r.index||0);return EZ(d,h,". ")}return"- "},n),addExtensions(){return[HP(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)}}}),MZ={};hZ(MZ,{findListItemPos:()=>Ry,getNextListDepth:()=>cC,handleBackspace:()=>Qx,handleDelete:()=>eS,hasListBefore:()=>YP,hasListItemAfter:()=>_Z,hasListItemBefore:()=>AZ,listItemHasSubList:()=>RZ,nextListIsDeeper:()=>KP,nextListIsHigher:()=>ZP});var Ry=(t,e)=>{const{$from:n}=e.selection,r=jn(t,e.schema);let s=null,i=n.depth,o=n.pos,l=null;for(;i>0&&l===null;)s=n.node(i),s.type===r?l=i:(i-=1,o-=1);return l===null?null:{$pos:e.doc.resolve(o),depth:l}},cC=(t,e)=>{const n=Ry(t,e);if(!n)return!1;const[,r]=l7(e,t,n.$pos.pos+4);return r},YP=(t,e,n)=>{const{$anchor:r}=t.selection,s=Math.max(0,r.pos-2),i=t.doc.resolve(s).node();return!(!i||!n.includes(i.type.name))},Qx=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Ma(t.state,e)&&YP(t.state,e,n)){const{$anchor:r}=t.state.selection,s=t.state.doc.resolve(r.before()-1),i=[];s.node().descendants((u,d)=>{u.type.name===e&&i.push({node:u,pos:d})});const o=i.at(-1);if(!o)return!1;const l=t.state.doc.resolve(s.start()+o.pos+1);return t.chain().cut({from:r.start()-1,to:r.end()+1},l.end()).joinForward().run()}return!Ma(t.state,e)||!f7(t.state)?!1:t.chain().liftListItem(e).run()},KP=(t,e)=>{const n=cC(t,e),r=Ry(t,e);return!r||!n?!1:n>r.depth},ZP=(t,e)=>{const n=cC(t,e),r=Ry(t,e);return!r||!n?!1:n<r.depth},eS=(t,e)=>{if(!Ma(t.state,e)||!d7(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:s}=n;return!n.empty&&r.sameParent(s)?!1:KP(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():ZP(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},_Z=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((n=s.nodeAfter)==null?void 0:n.type.name)!==t)},AZ=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-2);return!(s.index()===0||((n=s.nodeBefore)==null?void 0:n.type.name)!==t)},RZ=(t,e,n)=>{if(!n)return!1;const r=jn(t,e.schema);let s=!1;return n.descendants(i=>{i.type===r&&(s=!0)}),s},XP=rn.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&&eS(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&&eS(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&&Qx(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&&Qx(t,n,r)&&(e=!0)}),e}}}}),tS=new RegExp(`^(\\s*)(${WP})([.)])\\s+(.*)$`),OZ=/^\s/,Ud={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function jZ(t){return tS.test(t.trimStart())}function DZ(t){const e=t.trimStart();return Ud.bulletItem.test(e)||jZ(e)||Ud.heading.test(e)||Ud.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||Ud.codeFence.test(e)}function IZ(t){return Object.values(Ud).some(e=>e.test(t))}function LZ(t){const e=[],n=[];let r=!1;return t.forEach(s=>{if(r){n.push(s);return}if(s.trim()===""){r=!0,n.push(s);return}if(e.length>0&&DZ(s)){r=!0,n.push(s);return}e.push(s)}),{paragraphLines:e,blockLines:n}}function PZ(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n],i=s.match(tS);if(!i)break;const[,o,l,u,d]=i,h=o.length,m=parseInt(l,10),y=isNaN(m)?Ay(l):void 0,b=isNaN(m)?lC(l):m,v=[d];let x=n+1;const k=[s];let E=!1;for(;x<t.length;){const M=t[x];if(M.match(tS))break;if(M.trim()==="")k.push(M),v.push(""),E=!0,x+=1;else if(M.match(OZ)){const N=M.length-M.trimStart().length,T=h+l.length+1;k.push(M),v.push(M.slice(Math.min(N,T))),x+=1}else{if(E||IZ(M))break;k.push(M),v.push(M),x+=1}}e.push({indent:h,number:b,type:y,content:v.join(`
198
+ `).trim(),contentLines:v,raw:k.join(`
199
+ `)}),r=x,n=x}return[e,r]}var $Z=new RegExp(`^(${WP})([.)])\\s+(.+)$`);function zZ(t){const e=t.split(`
200
+ `).filter(i=>i.trim().length>0);if(e.length===0)return null;const n=[];for(const i of e){const o=i.trim().match($Z);if(!o)return null;n.push({marker:o[1],content:o[3]})}const r=n.map(i=>i.marker);return SZ(r)?{type:"orderedList",attrs:CZ(n[0].marker),content:n.map(i=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:i.content}]}]}))}:null}function JP(t,e,n){const r=[];let s=0;for(;s<t.length;){const i=t[s];if(i.indent===e){const{paragraphLines:o,blockLines:l}=LZ(i.contentLines),u=o.join(`
201
+ `).trim(),d=[];u&&d.push({type:"paragraph",raw:u,tokens:n.inlineTokens(u)});const h=l.join(`
202
+ `).trim();if(h){const b=n.blockTokens(h);d.push(...b)}let m=s+1;const y=[];for(;m<t.length&&t[m].indent>e;)y.push(t[m]),m+=1;if(y.length>0){const b=Math.min(...y.map(x=>x.indent)),v=JP(y,b,n);d.push({type:"list",ordered:!0,start:y[0].number,typeMarker:y[0].type,items:v,raw:y.map(x=>x.raw).join(`
203
+ `)})}r.push({type:"list_item",raw:i.raw,tokens:d}),s=m}else s+=1}return r}function BZ(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(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const i=e.parseChildren([s]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([s]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var FZ="listItem",sR="textStyle",iR=/^(\d+)\.\s$/;function oR(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 QP=Gn.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 s=oR(n);if(s)return s}const r=t.querySelector("li");if(r){const s=r.getAttribute("style");if(s){const i=oR(s);if(i)return i}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,type:n,...r}=t,s=Yt(this.options.HTMLAttributes,r);return e!==1&&(s.start=e),n&&n!=="1"&&(s.type=n),["ol",s,0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.typeMarker,s=t.items?BZ(t.items,e):[],i={};return n!==1&&(i.start=n),r&&(i.type=r),Object.keys(i).length>0?{type:"orderedList",attrs:i,content:s}:{type:"orderedList",content:s}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
204
+ `):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(t,e,n)=>{var r,s;const i=t.split(`
205
+ `),[o,l]=PZ(i);if(o.length===0)return;const u=JP(o,o[0].indent,n);if(u.length===0)return;const d=((r=o[0])==null?void 0:r.number)||1,h=(s=o[0])==null?void 0:s.type;return{type:"list",ordered:!0,start:d,typeMarker:h,items:u,raw:i.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(FZ,this.editor.getAttributes(sR)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new Kt({props:{handlePaste:(t,e)=>{var n,r;const s=(n=e.clipboardData)==null?void 0:n.getData("text/html");if(s?.trim())return!1;const i=(r=e.clipboardData)==null?void 0:r.getData("text/plain");if(!i)return!1;const o=zZ(i);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=gu({find:iR,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:t});return(this.options.keepMarks||this.options.keepAttributes)&&(e=gu({find:iR,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:n=>({start:+n[1],...this.editor.getAttributes(sR)}),joinPredicate:t,editor:this.editor})),[e]}}),VZ=/^\s*(\[([( |x])?\])\s$/,HZ=Gn.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",Yt(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 s=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return Kk(t,e,s)},addExtensions(){return this.options.nested?[HP(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 s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),u=document.createElement("div"),d=m=>{var y,b;l.ariaLabel=((b=(y=this.options.a11y)==null?void 0:y.checkboxLabel)==null?void 0:b.call(y,m,l.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};d(t),i.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:y}=m.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:b})=>{const v=n();if(typeof v!="number")return!1;const x=b.doc.nodeAt(v);return b.setNodeMarkup(v,void 0,{...x?.attrs,checked:y}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,y)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,y])=>{s.setAttribute(m,y)}),s.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,i.append(l,o),s.append(i,u),Object.entries(e).forEach(([m,y])=>{s.setAttribute(m,y)});let h=new Set(Object.keys(e));return{dom:s,contentDOM:u,update:m=>{if(m.type!==this.type)return!1;s.dataset.checked=m.attrs.checked,l.checked=m.attrs.checked,d(m);const y=r.extensionManager.attributes,b=pu(m,y),v=new Set(Object.keys(b)),x=this.options.HTMLAttributes;return h.forEach(k=>{v.has(k)||(k in x?s.setAttribute(k,x[k]):s.removeAttribute(k))}),Object.entries(b).forEach(([k,E])=>{E==null?k in x?s.setAttribute(k,x[k]):s.removeAttribute(k):s.setAttribute(k,E)}),h=v,!0}}}},addInputRules(){return[gu({find:VZ,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),UZ=Gn.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",Yt(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=i=>{const o=Hx(i,{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=i.slice(o.raw.length);return u.trim()?[l,...n.blockTokens(u)]:[l]}return n.blockTokens(i)},s=Hx(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.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()}}});rn.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(VP.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(GP.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(XP.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(QP.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(HZ.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(UZ.configure(this.options.taskList)),t}});var Up="&nbsp;",dw=" ",WZ=Gn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Yt(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===Up||n[0].text===Up||n[0].raw===dw||n[0].text===dw)&&r.length===1&&r[0].type==="text"&&(r[0].text===Up||r[0].text===dw)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{var r,s;if(!t)return"";const i=Array.isArray(t.content)?t.content:[];if(i.length===0){const o=Array.isArray((r=n?.previousNode)==null?void 0:r.content)?n.previousNode.content:[];return((s=n?.previousNode)==null?void 0:s.type)==="paragraph"&&o.length===0?Up:""}return e.renderChildren(i)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),qZ=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,GZ=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,YZ=Wl.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",Yt(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[jl({find:qZ,type:this.type})]},addPasteRules(){return[_a({find:GZ,type:this.type})]}}),KZ=Gn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),ZZ=Wl.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",Yt(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 s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!s)return;const i=s[2].trim();return{type:"underline",raw:s[0],text:i,tokens:n.inlineTokens(i)}}},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 XZ(t={}){return new Kt({view(e){return new JZ(e,t)}})}class JZ{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(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}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,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,l=i.height/s.offsetHeight;if(n){let m=e.nodeBefore,y=e.nodeAfter;if(m||y){let b=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(b){let v=b.getBoundingClientRect(),x=m?v.bottom:v.top;m&&y&&(x=(x+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let k=this.width/2*l;r={left:v.left,right:v.right,top:x-k,bottom:x+k}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),y=this.width/2*o;r={left:m.left-y,right:m.left+y,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 d,h;if(!u||u==document.body&&getComputedStyle(u).position=="static")d=-pageXOffset,h=-pageYOffset;else{let m=u.getBoundingClientRect(),y=m.width/u.offsetWidth,b=m.height/u.offsetHeight;d=m.left-u.scrollLeft*y,h=m.top-u.scrollTop*b}this.element.style.left=(r.left-d)/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),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,n,e):s;if(!n||i)return null;let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=DI(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 mn extends nt{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return mn.valid(r)?new mn(r):nt.near(r)}content(){return Oe.empty}eq(e){return e instanceof mn&&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 mn(e.resolve(n.pos))}getBookmark(){return new uC(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!QZ(e)||!eX(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&mn.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let l=e.node(o);if(n>0?e.indexAfter(o)<l.childCount:e.index(o)>0){i=l.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let u=e.doc.resolve(s);if(mn.valid(u))return u}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!Ge.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let l=e.doc.resolve(s);if(mn.valid(l))return l}return null}}}mn.prototype.visible=!1;mn.findFrom=mn.findGapCursorFrom;nt.jsonID("gapcursor",mn);class uC{constructor(e){this.pos=e}map(e){return new uC(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return mn.valid(n)?new mn(n):nt.near(n)}}function e2(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function QZ(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 s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||e2(s.type))return!0;if(s.inlineContent)return!1}}return!0}function eX(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 s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||e2(s.type))return!0;if(s.inlineContent)return!1}}return!0}function tX(){return new Kt({props:{decorations:iX,createSelectionBetween(t,e,n){return e.pos==n.pos&&mn.valid(n)?new mn(n):null},handleClick:rX,handleKeyDown:nX,handleDOMEvents:{beforeinput:sX}}})}const nX=zk({ArrowLeft:Wp("horiz",-1),ArrowRight:Wp("horiz",1),ArrowUp:Wp("vert",-1),ArrowDown:Wp("vert",1)});function Wp(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,l=e>0?o.$to:o.$from,u=o.empty;if(o instanceof Ue){if(!i.endOfTextblock(n)||l.depth==0)return!1;u=!1,l=r.doc.resolve(e>0?l.after():l.before())}let d=mn.findGapCursorFrom(l,e,u);return d?(s&&s(r.tr.setSelection(new mn(d))),!0):!1}}function rX(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!mn.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&Ge.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new mn(r))),!0)}function sX(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof mn))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 s=ge.empty;for(let o=r.length-1;o>=0;o--)s=ge.from(r[o].createAndFill(null,s));let i=t.state.tr.replace(n.pos,n.pos,new Oe(s,0,0));return i.setSelection(Ue.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function iX(t){if(!(t.selection instanceof mn))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Dt.create(t.doc,[Un.widget(t.selection.head,e,{key:"gapcursor"})])}var Ug=200,qn=function(){};qn.prototype.append=function(e){return e.length?(e=qn.from(e),!this.length&&e||e.length<Ug&&this.leafAppend(e)||this.length<Ug&&e.leafPrepend(this)||this.appendInner(e)):this};qn.prototype.prepend=function(e){return e.length?qn.from(e).append(this):this};qn.prototype.appendInner=function(e){return new oX(this,e)};qn.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?qn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};qn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};qn.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)};qn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},n,r),s};qn.from=function(e){return e instanceof qn?e:e&&e.length?new t2(e):qn.empty};var t2=(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(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,l){for(var u=i;u<o;u++)if(s(this.values[u],l+u)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,l){for(var u=i-1;u>=o;u--)if(s(this.values[u],l+u)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Ug)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Ug)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(qn);qn.empty=new t2([]);var oX=(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,s,i,o){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(i,l),o)===!1||i>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,i)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(i,l)-l,o+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(s,l),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,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})(qn);const aX=500;class qs{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 s,i;n&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,l,u,d=[],h=[];return this.items.forEach((m,y)=>{if(!m.step){s||(s=this.remapping(r,y+1),i=s.maps.length),i--,h.push(m);return}if(s){h.push(new ui(m.map));let b=m.step.map(s.slice(i)),v;b&&o.maybeStep(b).doc&&(v=o.mapping.maps[o.mapping.maps.length-1],d.push(new ui(v,void 0,void 0,d.length+h.length))),i--,v&&s.appendMap(v,i)}else o.maybeStep(m.step);if(m.selection)return l=s?m.selection.map(s.slice(i)):m.selection,u=new qs(this.items.slice(0,r).append(h.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:o,selection:l}}addTransform(e,n,r,s){let i=[],o=this.eventCount,l=this.items,u=!s&&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]),y=new ui(e.mapping.maps[h],m,n),b;(b=u&&u.merge(y))&&(y=b,h?i.pop():l=l.slice(0,l.length-1)),i.push(y),n&&(o++,n=void 0),s||(u=y)}let d=o-r.depth;return d>cX&&(l=lX(l,d),o-=d),new qs(l.append(i),o)}remapping(e,n){let r=new _f;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new qs(this.items.append(e.map(n=>new ui(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(y=>{y.selection&&l--},s);let u=n;this.items.forEach(y=>{let b=i.getMirror(--u);if(b==null)return;o=Math.min(o,b);let v=i.maps[b];if(y.step){let x=e.steps[b].invert(e.docs[b]),k=y.selection&&y.selection.map(i.slice(u+1,b));k&&l++,r.push(new ui(v,x,k))}else r.push(new ui(v))},s);let d=[];for(let y=n;y<o;y++)d.push(new ui(i.maps[y]));let h=this.items.slice(0,s).append(d).append(r),m=new qs(h,l);return m.emptyItemCount()>aX&&(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,s=[],i=0;return this.items.forEach((o,l)=>{if(l>=e)s.push(o),o.selection&&i++;else if(o.step){let u=o.step.map(n.slice(r)),d=u&&u.getMap();if(r--,d&&n.appendMap(d,r),u){let h=o.selection&&o.selection.map(n.slice(r));h&&i++;let m=new ui(d.invert(),u,h),y,b=s.length-1;(y=s.length&&s[b].merge(m))?s[b]=y:s.push(m)}}else o.map&&r--},this.items.length,0),new qs(qn.from(s.reverse()),i)}}qs.empty=new qs(qn.empty,0);function lX(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}class ui{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new ui(n.getMap().invert(),n,this.selection)}}}class ta{constructor(e,n,r,s,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const cX=20;function uX(t,e,n,r){let s=n.getMeta(Tl),i;if(s)return s.historyState;n.getMeta(hX)&&(t=new ta(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Tl))return o.getMeta(Tl).redo?new ta(t.done.addTransform(n,void 0,r,Rm(e)),t.undone,aR(n.mapping.maps),t.prevTime,t.prevComposition):new ta(t.done,t.undone.addTransform(n,void 0,r,Rm(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||!dX(n,t.prevRanges)),d=o?fw(t.prevRanges,n.mapping):aR(n.mapping.maps);return new ta(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,Rm(e)),qs.empty,d,n.time,l??t.prevComposition)}else return(i=n.getMeta("rebased"))?new ta(t.done.rebased(n,i),t.undone.rebased(n,i),fw(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new ta(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),fw(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function dX(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(n=!0)}),n}function aR(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,i,o)=>e.push(i,o));return e}function fw(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let s=e.map(t[r],1),i=e.map(t[r+1],-1);s<=i&&n.push(s,i)}return n}function fX(t,e,n){let r=Rm(e),s=Tl.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),l=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),u=new ta(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(o).setMeta(Tl,{redo:n,historyState:u})}let hw=!1,lR=null;function Rm(t){let e=t.plugins;if(lR!=e){hw=!1,lR=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){hw=!0;break}}return hw}const Tl=new yn("history"),hX=new yn("closeHistory");function pX(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Kt({key:Tl,state:{init(){return new ta(qs.empty,qs.empty,null,0,-1)},apply(e,n,r){return uX(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,s=r=="historyUndo"?r2:r=="historyRedo"?s2:null;return!s||!e.editable?!1:(n.preventDefault(),s(e.state,e.dispatch))}}}})}function n2(t,e){return(n,r)=>{let s=Tl.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let i=fX(s,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const r2=n2(!1,!0),s2=n2(!0,!0);rn.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 Kt({key:new yn("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const s=this.options.limit,i=this.options.autoTrim;if(s==null||s===0||i===!1){t=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const l=o-s,u=0,d=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const h=r.tr.deleteRange(u,d);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 s=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,u=i-r,d=l-u,h=l;return e.deleteRange(d,h),!(this.storage.characters({node:e.doc})>r)}})]}});var mX=rn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[XZ(this.options)]}});rn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Kt({key:new yn("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!n||!r)return Dt.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((u,d)=>{if(u.isText)return;if(!(s>=d&&s<=d+u.nodeSize-1))return!1;o+=1});let l=0;return t.descendants((u,d)=>{if(u.isText||!(s>=d&&s<=d+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";i.push(Un.node(d,d+u.nodeSize,{class:this.options.className}))}),Dt.create(t,i)}}})]}});var gX=rn.create({name:"gapCursor",addProseMirrorPlugins(){return[tX()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Tt(Be(t,"allowGapCursor",n)))!=null?e:null}}}),i2="placeholder",cR=new yn("tiptap__placeholder");function o2(t){const{editor:e,placeholder:n,dataAttribute:r,pos:s,node:i,isEmptyDoc:o,hasAnchor:l,classes:{emptyNode:u,emptyEditor:d}}=t,h=[u];return o&&h.push(d),Un.node(s,s+i.nodeSize,{class:h.join(" "),[r]:typeof n=="function"?n({editor:e,node:i,pos:s,hasAnchor:l}):n})}function a2(t,e){return typeof t=="function"?t(e):t}function l2({editor:t,options:e,dataAttribute:n,doc:r,selection:s,from:i,to:o}){const{anchor:l}=s,u=[],d=t.isEmpty;return r.nodesBetween(i,o,(h,m)=>{const y=l>=m&&l<=m+h.nodeSize,b=!h.isLeaf&&oh(h);return h.type.isTextblock&&(y||!e.showOnlyCurrent)&&b&&u.push(o2({editor:t,isEmptyDoc:d,dataAttribute:n,hasAnchor:y,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:a2(e.emptyNodeClass,{editor:t,node:h,pos:m,hasAnchor:y})},node:h,pos:m})),e.includeChildren}),u}function c2({editor:t,options:e,dataAttribute:n,doc:r,selection:s}){if(!(t.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:o}=s,l=[],u=t.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const h=r.resolve(o),m=h.depth>0?h.node(1):h.nodeAfter,y=h.depth>0?h.before(1):o;if(m&&m.type.isTextblock&&oh(m)){const b=o>=y&&o<=y+m.nodeSize;l.push(o2({editor:t,isEmptyDoc:u,dataAttribute:n,hasAnchor:b,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:a2(e.emptyNodeClass,{editor:t,node:m,pos:y,hasAnchor:b})},node:m,pos:y}))}}else l.push(...l2({editor:t,options:e,dataAttribute:n,doc:r,selection:s,from:0,to:r.content.size}));return Dt.create(r,l)}function cf(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 s=r.before(1),i=r.node(1);return{from:s,to:s+i.nodeSize}}function uf(t,e){return{from:Math.max(0,e.from-1),to:Math.min(t.content.size,e.to-1)}}function yX(t,e,n){const r=[];return t.forEach((s,i)=>{const o=i,l=o+s.nodeSize,u=o+1,d=l+1;u<n&&d>e&&r.push({from:o,to:l})}),r}function bX(t){if(t.length===0)return[];const e=[...t].sort((r,s)=>r.from-s.from),n=[{...e[0]}];for(let r=1;r<e.length;r+=1){const s=n[n.length-1],i=e[r];i.from<=s.to?s.to=Math.max(s.to,i.to):n.push({...i})}return n}function vX(t,e){const n=yX(t,e.from,e.to);return n.push(uf(t,cf(t,e.from))),e.to>e.from?n.push(uf(t,cf(t,Math.min(e.to,t.content.size+1)-1))):e.from<t.content.size+1&&n.push(uf(t,cf(t,Math.min(e.from+1,t.content.size)))),n}function wX(t,e,n){const r=[];if(t.docChanged){const s=Wk(t);for(const i of s)r.push(...vX(n.doc,i.newRange))}return t.selectionSet&&(r.push(uf(n.doc,cf(n.doc,t.mapping.map(e.selection.anchor)))),r.push(uf(n.doc,cf(n.doc,n.selection.anchor)))),bX(r)}function xX(t,e,n){const r=Math.max(0,Math.min(t,n.content.size)),s=Math.max(r,Math.min(e,n.content.size));return{from:r,to:s}}function SX({decorations:t,ranges:e,editor:n,options:r,dataAttribute:s,doc:i,selection:o}){let l=t;for(const u of e){const{from:d,to:h}=xX(u.from,u.to,i),m=l.find(d,h).filter(b=>b.from>=d&&b.to<=h);m.length&&(l=l.remove(m));const y=l2({editor:n,options:r,dataAttribute:s,doc:i,selection:o,from:d,to:h});y.length&&(l=l.add(i,y))}return l}function kX({editor:t,options:e,dataAttribute:n}){return{init(r,s){const i=c2({editor:t,options:e,dataAttribute:n,doc:s.doc,selection:s.selection});return i??Dt.empty},apply(r,s,i,o){if(!r.docChanged&&!r.selectionSet)return s;const l=s.map(r.mapping,r.doc),u=wX(r,i,o);return SX({decorations:l,ranges:u,editor:t,options:e,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function CX(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function EX({editor:t,options:e}){const n=e.dataAttribute?`data-${CX(e.dataAttribute)}`:`data-${i2}`,r=e.showOnlyCurrent&&!e.includeChildren;return new Kt({key:cR,...r?{}:{state:kX({editor:t,options:e,dataAttribute:n})},props:{decorations:r?({doc:s,selection:i})=>c2({editor:t,options:e,dataAttribute:n,doc:s,selection:i}):s=>{var i;return e.showOnlyWhenEditable&&!t.isEditable?Dt.empty:(i=cR.getState(s))!=null?i:Dt.empty}}})}var TX=rn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:i2,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[EX({editor:this.editor,options:this.options})]}});function nS(t,e){return!t.selection.empty&&!eP(t.selection)&&e.isEditable}function NX(t,e){return nS(t,e)&&!e.isFocused&&!e.view.dragging}function MX(){var t;(t=window.getSelection())==null||t.removeAllRanges()}function _X(t){t.focus()}rn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Kt({key:new yn("selection"),props:{decorations(n){return NX(n,t)?Dt.create(n.doc,[Un.inline(n.selection.from,n.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(n){return nS(n.state,t)&&MX(),!1},focus(n){return nS(n.state,t)&&requestAnimationFrame(()=>{!t.isDestroyed&&n.hasFocus()&&_X(n)}),!1}}}})]}});var AX="skipTrailingNode";function uR({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var RX=rn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new yn(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(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new Kt({key:e,appendTransaction:(s,i,o)=>{const{doc:l,tr:u,schema:d}=o,h=e.getState(o),m=l.content.size,y=d.nodes[n];if(!s.some(b=>b.getMeta(AX))&&h)return u.insert(m,y.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!uR({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!uR({node:o,types:r})}}})]}}),OX=rn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>r2(t,e),redo:()=>({state:t,dispatch:e})=>s2(t,e)}},addProseMirrorPlugins(){return[pX(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()}}}),jX=rn.create({name:"starterKit",addExtensions(){var t,e,n,r;const s=[];return this.options.bold!==!1&&s.push(bK.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(hK.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(VP.configure(this.options.bulletList)),this.options.code!==!1&&s.push(xK.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(CK.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(EK.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(mX.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(gX.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(TK.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(NK.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(OX.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(MK.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(jK.configure(this.options.italic)),this.options.listItem!==!1&&s.push(GP.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(XP.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&s.push(dZ.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(QP.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(WZ.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(YZ.configure(this.options.strike)),this.options.text!==!1&&s.push(KZ.configure(this.options.text)),this.options.underline!==!1&&s.push(ZZ.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&s.push(RX.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),DX=jX;function dC(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Gl=dC();function u2(t){Gl=t}var hl={exec:()=>null};function xt(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(kr.caret,"$1"),n=n.replace(s,o),r},getRegex:()=>new RegExp(n,e)};return r}var IX=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),kr={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)}}>`)},LX=/^(?:[ \t]*(?:\n|$))+/,PX=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,$X=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,lh=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,zX=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,fC=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,d2=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,f2=xt(d2).replace(/bull/g,fC).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(),BX=xt(d2).replace(/bull/g,fC).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(),hC=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,FX=/^[^\n]+/,pC=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,VX=xt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",pC).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),HX=xt(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,fC).getRegex(),Oy="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",mC=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,UX=xt("^ {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",mC).replace("tag",Oy).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),h2=xt(hC).replace("hr",lh).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",Oy).getRegex(),WX=xt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",h2).getRegex(),gC={blockquote:WX,code:PX,def:VX,fences:$X,heading:zX,hr:lh,html:UX,lheading:f2,list:HX,newline:LX,paragraph:h2,table:hl,text:FX},dR=xt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",lh).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",Oy).getRegex(),qX={...gC,lheading:BX,table:dR,paragraph:xt(hC).replace("hr",lh).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",dR).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",Oy).getRegex()},GX={...gC,html:xt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",mC).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:hl,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:xt(hC).replace("hr",lh).replace("heading",` *#{1,6} *[^
208
+ ]`).replace("lheading",f2).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},YX=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,KX=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,p2=/^( {2,}|\\)\n(?!\s*$)/,ZX=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Tu=/[\p{P}\p{S}]/u,jy=/[\s\p{P}\p{S}]/u,yC=/[^\s\p{P}\p{S}]/u,XX=xt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,jy).getRegex(),m2=/(?!~)[\p{P}\p{S}]/u,JX=/(?!~)[\s\p{P}\p{S}]/u,QX=/(?:[^\s\p{P}\p{S}]|~)/u,eJ=xt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",IX?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),g2=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,tJ=xt(g2,"u").replace(/punct/g,Tu).getRegex(),nJ=xt(g2,"u").replace(/punct/g,m2).getRegex(),y2="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",rJ=xt(y2,"gu").replace(/notPunctSpace/g,yC).replace(/punctSpace/g,jy).replace(/punct/g,Tu).getRegex(),sJ=xt(y2,"gu").replace(/notPunctSpace/g,QX).replace(/punctSpace/g,JX).replace(/punct/g,m2).getRegex(),iJ=xt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,yC).replace(/punctSpace/g,jy).replace(/punct/g,Tu).getRegex(),oJ=xt(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Tu).getRegex(),aJ="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",lJ=xt(aJ,"gu").replace(/notPunctSpace/g,yC).replace(/punctSpace/g,jy).replace(/punct/g,Tu).getRegex(),cJ=xt(/\\(punct)/,"gu").replace(/punct/g,Tu).getRegex(),uJ=xt(/^<(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(),dJ=xt(mC).replace("(?:-->|$)","-->").getRegex(),fJ=xt("^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",dJ).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Wg=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,hJ=xt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Wg).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),b2=xt(/^!?\[(label)\]\[(ref)\]/).replace("label",Wg).replace("ref",pC).getRegex(),v2=xt(/^!?\[(ref)\](?:\[\])?/).replace("ref",pC).getRegex(),pJ=xt("reflink|nolink(?!\\()","g").replace("reflink",b2).replace("nolink",v2).getRegex(),fR=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,bC={_backpedal:hl,anyPunctuation:cJ,autolink:uJ,blockSkip:eJ,br:p2,code:KX,del:hl,delLDelim:hl,delRDelim:hl,emStrongLDelim:tJ,emStrongRDelimAst:rJ,emStrongRDelimUnd:iJ,escape:YX,link:hJ,nolink:v2,punctuation:XX,reflink:b2,reflinkSearch:pJ,tag:fJ,text:ZX,url:hl},mJ={...bC,link:xt(/^!?\[(label)\]\((.*?)\)/).replace("label",Wg).getRegex(),reflink:xt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Wg).getRegex()},rS={...bC,emStrongRDelimAst:sJ,emStrongLDelim:nJ,delLDelim:oJ,delRDelim:lJ,url:xt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",fR).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:xt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",fR).getRegex()},gJ={...rS,br:xt(p2).replace("{2,}","*").getRegex(),text:xt(rS.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},qp={normal:gC,gfm:qX,pedantic:GX},Ad={normal:bC,gfm:rS,breaks:gJ,pedantic:mJ},yJ={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},hR=t=>yJ[t];function ai(t,e){if(e){if(kr.escapeTest.test(t))return t.replace(kr.escapeReplace,hR)}else if(kr.escapeTestNoEncode.test(t))return t.replace(kr.escapeReplaceNoEncode,hR);return t}function pR(t){try{t=encodeURI(t).replace(kr.percentDecode,"%")}catch{return null}return t}function mR(t,e){let n=t.replace(kr.findPipe,(i,o,l)=>{let u=!1,d=o;for(;--d>=0&&l[d]==="\\";)u=!u;return u?"|":" |"}),r=n.split(kr.splitPipe),s=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(;s<r.length;s++)r[s]=r[s].trim().replace(kr.slashPipe,"|");return r}function Rd(t,e,n){let r=t.length;if(r===0)return"";let s=0;for(;s<r&&t.charAt(r-s-1)===e;)s++;return t.slice(0,r-s)}function bJ(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 vJ(t,e=0){let n=e,r="";for(let s of t)if(s===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=s,n++;return r}function gR(t,e,n,r,s){let i=e.href,o=e.title||null,l=t[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let u={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:o,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,u}function wJ(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
209
+ `).map(i=>{let o=i.match(n.other.beginningSpace);if(o===null)return i;let[l]=o;return l.length>=s.length?i.slice(s.length):i}).join(`
210
+ `)}var qg=class{options;rules;lexer;constructor(t){this.options=t||Gl}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:Rd(n,`
211
+ `)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=wJ(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=Rd(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:Rd(e[0],`
212
+ `)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=Rd(e[0],`
213
+ `).split(`
214
+ `),r="",s="",i=[];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 d=l.join(`
215
+ `),h=d.replace(this.rules.other.blockquoteSetextReplace,`
216
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
217
+ ${d}`:d,s=s?`${s}
218
+ ${h}`:h;let m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,i,!0),this.lexer.state.top=m,n.length===0)break;let y=i.at(-1);if(y?.type==="code")break;if(y?.type==="blockquote"){let b=y,v=b.raw+`
219
+ `+n.join(`
220
+ `),x=this.blockquote(v);i[i.length-1]=x,r=r.substring(0,r.length-b.raw.length)+x.raw,s=s.substring(0,s.length-b.text.length)+x.text;break}else if(y?.type==="list"){let b=y,v=b.raw+`
221
+ `+n.join(`
222
+ `),x=this.list(v);i[i.length-1]=x,r=r.substring(0,r.length-y.raw.length)+x.raw,s=s.substring(0,s.length-b.raw.length)+x.raw,n=v.substring(i.at(-1).raw.length).split(`
223
+ `);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim(),r=n.length>1,s={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 i=this.rules.other.listItemRegex(n),o=!1;for(;t;){let u=!1,d="",h="";if(!(e=i.exec(t))||this.rules.block.hr.test(t))break;d=e[0],t=t.substring(d.length);let m=vJ(e[2].split(`
224
+ `,1)[0],e[1].length),y=t.split(`
225
+ `,1)[0],b=!m.trim(),v=0;if(this.options.pedantic?(v=2,h=m.trimStart()):b?v=e[1].length+1:(v=m.search(this.rules.other.nonSpaceChar),v=v>4?1:v,h=m.slice(v),v+=e[1].length),b&&this.rules.other.blankLine.test(y)&&(d+=y+`
226
+ `,t=t.substring(y.length+1),u=!0),!u){let x=this.rules.other.nextBulletRegex(v),k=this.rules.other.hrRegex(v),E=this.rules.other.fencesBeginRegex(v),M=this.rules.other.headingBeginRegex(v),_=this.rules.other.htmlBeginRegex(v),N=this.rules.other.blockquoteBeginRegex(v);for(;t;){let T=t.split(`
227
+ `,1)[0],A;if(y=T,this.options.pedantic?(y=y.replace(this.rules.other.listReplaceNesting," "),A=y):A=y.replace(this.rules.other.tabCharGlobal," "),E.test(y)||M.test(y)||_.test(y)||N.test(y)||x.test(y)||k.test(y))break;if(A.search(this.rules.other.nonSpaceChar)>=v||!y.trim())h+=`
228
+ `+A.slice(v);else{if(b||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||E.test(m)||M.test(m)||k.test(m))break;h+=`
229
+ `+y}b=!y.trim(),d+=T+`
230
+ `,t=t.substring(T.length+1),m=A.slice(v)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(o=!0)),s.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),s.raw+=d}let l=s.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let u of s.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 d=this.rules.other.listTaskCheckbox.exec(u.raw);if(d){let h={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};u.checked=h.checked,s.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(!s.loose){let d=u.tokens.filter(m=>m.type==="space"),h=d.length>0&&d.some(m=>this.rules.other.anyLine.test(m.raw));s.loose=h}}if(s.loose)for(let u of s.items){u.loose=!0;for(let d of u.tokens)d.type==="text"&&(d.type="paragraph")}return s}}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"):"",s=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:s}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=mR(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
231
+ `):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let o of r)this.rules.other.tableAlignRight.test(o)?i.align.push("right"):this.rules.other.tableAlignCenter.test(o)?i.align.push("center"):this.rules.other.tableAlignLeft.test(o)?i.align.push("left"):i.align.push(null);for(let o=0;o<n.length;o++)i.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:!0,align:i.align[o]});for(let o of s)i.rows.push(mR(o,i.header.length).map((l,u)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[u]})));return i}}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 i=Rd(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=bJ(e[2],"()");if(i===-2)return;if(i>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],s="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=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)),gR(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.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," "),s=e[r.toLowerCase()];if(!s){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return gR(n,s,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 s=[...r[0]].length-1,i,o,l=s,u=0,d=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,e=e.slice(-1*t.length+s);(r=d.exec(e))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(o=[...i].length,r[3]||r[4]){l+=o;continue}else if((r[5]||r[6])&&s%3&&!((s+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,s+r.index+h+o);if(Math.min(s,o)%2){let b=m.slice(1,-1);return{type:"em",raw:m,text:b,tokens:this.lexer.inlineTokens(b)}}let y=m.slice(2,-2);return{type:"strong",raw:m,text:y,tokens:this.lexer.inlineTokens(y)}}}}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),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&s&&(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 s=[...r[0]].length-1,i,o,l=s,u=this.rules.inline.delRDelim;for(u.lastIndex=0,e=e.slice(-1*t.length+s);(r=u.exec(e))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(o=[...i].length,o!==s))continue;if(r[3]||r[4]){l+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l);let d=[...r[0]][0].length,h=t.slice(0,s+r.index+d+o),m=h.slice(s,-s);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 s;do s=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(s!==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}}}},Vs=class sS{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Gl,this.options.tokenizer=this.options.tokenizer||new qg,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:kr,block:qp.normal,inline:Ad.normal};this.options.pedantic?(n.block=qp.pedantic,n.inline=Ad.pedantic):this.options.gfm&&(n.block=qp.gfm,this.options.breaks?n.inline=Ad.breaks:n.inline=Ad.gfm),this.tokenizer.rules=n}static get rules(){return{block:qp,inline:Ad}}static lex(e,n){return new sS(n).lex(e)}static lexInline(e,n){return new sS(n).inlineTokens(e)}lex(e){e=e.replace(kr.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(kr.tabCharGlobal," ").replace(kr.spaceLine,""));e;){let s;if(this.options.extensions?.block?.some(o=>(s=o.call({lexer:this},e,n))?(e=e.substring(s.raw.length),n.push(s),!0):!1))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);let o=n.at(-1);s.raw.length===1&&o!==void 0?o.raw+=`
234
+ `:n.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
235
+ `)?"":`
236
+ `)+s.raw,o.text+=`
237
+ `+s.text,this.inlineQueue.at(-1).src=o.text):n.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
238
+ `)?"":`
239
+ `)+s.raw,o.text+=`
240
+ `+s.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title},n.push(s));continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),n.push(s);continue}let i=e;if(this.options.extensions?.startBlock){let o=1/0,l=e.slice(1),u;this.options.extensions.startBlock.forEach(d=>{u=d.call({lexer:this},l),typeof u=="number"&&u>=0&&(o=Math.min(o,u))}),o<1/0&&o>=0&&(i=e.substring(0,o+1))}if(this.state.top&&(s=this.tokenizer.paragraph(i))){let o=n.at(-1);r&&o?.type==="paragraph"?(o.raw+=(o.raw.endsWith(`
241
+ `)?"":`
242
+ `)+s.raw,o.text+=`
243
+ `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(s),r=i.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);let o=n.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(`
244
+ `)?"":`
245
+ `)+s.raw,o.text+=`
246
+ `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(s);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,s=null;if(this.tokens.links){let u=Object.keys(this.tokens.links);if(u.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!==null;)u.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!==null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!==null;)i=s[2]?s[2].length:0,r=r.slice(0,s.index+i)+"["+"a".repeat(s[0].length-i-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 d=e;if(this.options.extensions?.startInline){let h=1/0,m=e.slice(1),y;this.options.extensions.startInline.forEach(b=>{y=b.call({lexer:this},m),typeof y=="number"&&y>=0&&(h=Math.min(h,y))}),h<1/0&&h>=0&&(d=e.substring(0,h+1))}if(u=this.tokenizer.inlineText(d)){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}},Gg=class{options;parser;constructor(t){this.options=t||Gl}space(t){return""}code({text:t,lang:e,escaped:n}){let r=(e||"").match(kr.notSpaceStart)?.[0],s=t.replace(kr.endingNewline,"")+`
247
+ `;return r?'<pre><code class="language-'+ai(r)+'">'+(n?s:ai(s,!0))+`</code></pre>
248
+ `:"<pre><code>"+(n?s:ai(s,!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 s=e?"ol":"ul",i=e&&n!==1?' start="'+n+'"':"";return"<"+s+i+`>
254
+ `+r+"</"+s+`>
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 s=0;s<t.header.length;s++)n+=this.tablecell(t.header[s]);e+=this.tablerow({text:n});let r="";for(let s=0;s<t.rows.length;s++){let i=t.rows[s];n="";for(let o=0;o<i.length;o++)n+=this.tablecell(i[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>${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}){let r=this.parser.parseInline(n),s=pR(t);if(s===null)return r;t=s;let i='<a href="'+t+'"';return e&&(i+=' title="'+ai(e)+'"'),i+=">"+r+"</a>",i}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let s=pR(t);if(s===null)return ai(n);t=s;let i=`<img src="${t}" alt="${ai(n)}"`;return e&&(i+=` title="${ai(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:ai(t.text)}},vC=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}},Hs=class iS{options;renderer;textRenderer;constructor(e){this.options=e||Gl,this.options.renderer=this.options.renderer||new Gg,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new vC}static parse(e,n){return new iS(n).parse(e)}static parseInline(e,n){return new iS(n).parseInline(e)}parse(e){this.renderer.parser=this;let n="";for(let r=0;r<e.length;r++){let s=e[r];if(this.options.extensions?.renderers?.[s.type]){let o=s,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 i=s;switch(i.type){case"space":{n+=this.renderer.space(i);break}case"hr":{n+=this.renderer.hr(i);break}case"heading":{n+=this.renderer.heading(i);break}case"code":{n+=this.renderer.code(i);break}case"table":{n+=this.renderer.table(i);break}case"blockquote":{n+=this.renderer.blockquote(i);break}case"list":{n+=this.renderer.list(i);break}case"checkbox":{n+=this.renderer.checkbox(i);break}case"html":{n+=this.renderer.html(i);break}case"def":{n+=this.renderer.def(i);break}case"paragraph":{n+=this.renderer.paragraph(i);break}case"text":{n+=this.renderer.text(i);break}default:{let o='Token with "'+i.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 s=0;s<e.length;s++){let i=e[s];if(this.options.extensions?.renderers?.[i.type]){let l=this.options.extensions.renderers[i.type].call({parser:this},i);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){r+=l||"";continue}}let o=i;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}},Wd=class{options;block;constructor(t){this.options=t||Gl}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?Vs.lex:Vs.lexInline}provideParser(t=this.block){return t?Hs.parse:Hs.parseInline}},xJ=class{defaults=dC();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Hs;Renderer=Gg;TextRenderer=vC;Lexer=Vs;Tokenizer=qg;Hooks=Wd;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 s=r;for(let i of s.header)n=n.concat(this.walkTokens(i.tokens,e));for(let i of s.rows)for(let o of i)n=n.concat(this.walkTokens(o.tokens,e));break}case"list":{let s=r;n=n.concat(this.walkTokens(s.items,e));break}default:{let s=r;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(i=>{let o=s[i].flat(1/0);n=n.concat(this.walkTokens(o,e))}):s.tokens&&(n=n.concat(this.walkTokens(s.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(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let i=e.renderers[s.name];i?e.renderers[s.name]=function(...o){let l=s.renderer.apply(this,o);return l===!1&&(l=i.apply(this,o)),l}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[s.level];i?i.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),r.extensions=e),n.renderer){let s=this.defaults.renderer||new Gg(this.defaults);for(let i in n.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let o=i,l=n.renderer[o],u=s[o];s[o]=(...d)=>{let h=l.apply(s,d);return h===!1&&(h=u.apply(s,d)),h||""}}r.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new qg(this.defaults);for(let i in n.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let o=i,l=n.tokenizer[o],u=s[o];s[o]=(...d)=>{let h=l.apply(s,d);return h===!1&&(h=u.apply(s,d)),h}}r.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new Wd;for(let i in n.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let o=i,l=n.hooks[o],u=s[o];Wd.passThroughHooks.has(i)?s[o]=d=>{if(this.defaults.async&&Wd.passThroughHooksRespectAsync.has(i))return(async()=>{let m=await l.call(s,d);return u.call(s,m)})();let h=l.call(s,d);return u.call(s,h)}:s[o]=(...d)=>{if(this.defaults.async)return(async()=>{let m=await l.apply(s,d);return m===!1&&(m=await u.apply(s,d)),m})();let h=l.apply(s,d);return h===!1&&(h=u.apply(s,d)),h}}r.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(o){let l=[];return l.push(i.call(this,o)),s&&(l=l.concat(s.call(this,o))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Vs.lex(t,e??this.defaults)}parser(t,e){return Hs.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let r={...n},s={...this.defaults,...r},i=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.async===!1)return i(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 i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=t),s.async)return(async()=>{let o=s.hooks?await s.hooks.preprocess(e):e,l=await(s.hooks?await s.hooks.provideLexer(t):t?Vs.lex:Vs.lexInline)(o,s),u=s.hooks?await s.hooks.processAllTokens(l):l;s.walkTokens&&await Promise.all(this.walkTokens(u,s.walkTokens));let d=await(s.hooks?await s.hooks.provideParser(t):t?Hs.parse:Hs.parseInline)(u,s);return s.hooks?await s.hooks.postprocess(d):d})().catch(i);try{s.hooks&&(e=s.hooks.preprocess(e));let o=(s.hooks?s.hooks.provideLexer(t):t?Vs.lex:Vs.lexInline)(e,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let l=(s.hooks?s.hooks.provideParser(t):t?Hs.parse:Hs.parseInline)(o,s);return s.hooks&&(l=s.hooks.postprocess(l)),l}catch(o){return i(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>"+ai(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},Dl=new xJ;function It(t,e){return Dl.parse(t,e)}It.options=It.setOptions=function(t){return Dl.setOptions(t),It.defaults=Dl.defaults,u2(It.defaults),It};It.getDefaults=dC;It.defaults=Gl;It.use=function(...t){return Dl.use(...t),It.defaults=Dl.defaults,u2(It.defaults),It};It.walkTokens=function(t,e){return Dl.walkTokens(t,e)};It.parseInline=Dl.parseInline;It.Parser=Hs;It.parser=Hs.parse;It.Renderer=Gg;It.TextRenderer=vC;It.Lexer=Vs;It.lexer=Vs.lex;It.Tokenizer=qg;It.Hooks=Wd;It.parse=It;It.options;It.setOptions;It.use;It.walkTokens;It.parseInline;Hs.parse;Vs.lex;var SJ=/\n[^\S\n]*(?:\n[^\S\n]*)+$/;function kJ(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 s=(e.raw||"").match(SJ);return s?[{...e,raw:(e.raw||"").slice(0,-s[0].length)},{type:"space",raw:s[0]}]:[e]})}function CJ(t,e){const r=e.split(`
266
+ `).flatMap(s=>[s,""]).map(s=>`${t}${s}`).join(`
267
+ `);return r.slice(0,r.length-1)}function EJ(t,e){const n=[];return Array.from(t.entries()).forEach(([r,s])=>{if(!e){n.push(r);return}(e.marks||[]).find(o=>o.type===r&&mu(o.attrs,s.attrs))||n.push(r)}),n}function TJ(t,e){const n=[];return Array.from(e.entries()).forEach(([r,s])=>{const i=t.get(r);(!i||!mu(i.attrs,s.attrs))&&n.push({type:r,mark:s})}),n}function NJ(t,e,n,r){const s=!n,i=n&&(!n.marks||n.marks.length===0),o=n&&n.marks&&!r(e,new Map(n.marks.map(u=>[u.type,u]))),l=[];return(s||i||o)&&(n&&n.marks?Array.from(t.entries()).reverse().forEach(([u,d])=>{n.marks.find(m=>m.type===u&&mu(m.attrs,d.attrs))||l.push(u)}):(s||i)&&l.push(...Array.from(t.keys()).reverse())),l}function MJ(t,e){let n="";return Array.from(t.keys()).reverse().forEach(r=>{const s=t.get(r),i=e(r,s);i&&(n=i+n)}),t.clear(),n}function _J(t,e,n){let r="";return Array.from(t.entries()).forEach(([s,i])=>{const o=n(s,i);o&&(r+=o),e.set(s,i)}),r}function pw(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 Gp(t,e){return typeof t!="string"?"json":e}var AJ=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"]),RJ=/<\/?([a-zA-Z][\w-]*)/g;function OJ(t){const e=[];let n;for(;(n=RJ.exec(t))!==null;)e.push(n[1].toLowerCase());return e}function jJ(t){const e=t.toLowerCase();return e.includes("-")?!1:!AJ.has(e)}function DJ(t,e){return OJ(t).some(r=>jJ(r)?!e.has(r):!1)}var IJ=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,s,i;this.markedInstance=(e=t?.marked)!=null?e:It,this.indentStyle=(r=(n=t?.indentation)==null?void 0:n.style)!=null?r:"space",this.indentSize=(i=(s=t?.indentation)==null?void 0:s.size)!=null?i: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,Xc(Ty(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=Tt(Be(t,"code")),s=t.name;r&&this.codeTypes.add(s),this.extensionRanks.has(s)||this.extensionRanks.set(s,this.extensionRanks.size);const i=Be(t,"markdownTokenName")||s,o=Be(t,"parseMarkdown"),l=Be(t,"renderMarkdown"),u=Be(t,"markdownTokenizer"),d=(e=Be(t,"markdownOptions"))!=null?e:null,h=(n=d?.indentsContent)!=null?n:!1,m=d?.htmlReopen,y={tokenName:i,nodeName:s,parseMarkdown:o,renderMarkdown:l,isIndenting:h,htmlReopen:m,tokenizer:u};if(i&&o){const b=this.registry.get(i)||[];b.push(y),this.registry.set(i,b)}if(l){const b=this.nodeTypeRegistry.get(s)||[];b.push(y),this.nodeTypeRegistry.set(s,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:s}=t,i=this.createTokenizerHelpers.bind(this),o=this.createLexer.bind(this);let l;n?l=typeof n=="function"?n:d=>d.indexOf(n):l=d=>{const h=s(d,[],this.createTokenizerHelpers(this.createLexer()));return h&&h.raw?d.indexOf(h.raw):-1};const u={name:e,level:r,start:l,tokenizer(d,h){const m=this.lexer?i(this.lexer):i(o()),y=s(d,h,m);if(y&&y.type)return{...y,type:y.type||e,raw:y.raw||"",tokens:y.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?kJ(t):t,r=n.reduce((o,l,u)=>(l.type!=="space"&&o.push(u),o),[]);let s=-1,i=0;return n.flatMap((o,l)=>{for(var u;i<r.length&&r[i]<l;)s=r[i],i+=1;if(e&&o.type==="space"){const h=(u=r[i])!=null?u:-1;return this.createImplicitEmptyParagraphsFromSpace(o,s,h)}const d=this.parseToken(o,e);return d===null?[]:Array.isArray(d)?d:[d]})}createImplicitEmptyParagraphsFromSpace(t,e,n){const r=this.countParagraphSeparators(t.raw||"");if(r===0)return[];const i=Math.max(r-(e===-1||n===-1?0:1),0);return Array.from({length:i},()=>({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(i=>{if(!i.parseMarkdown)return!1;const o=i.parseMarkdown(t,r),l=this.normalizeParseResult(o);return l&&(!Array.isArray(l)||l.length>0)?(this.lastParseResult=l,!0):!1})&&this.lastParseResult){const i=this.lastParseResult;return this.lastParseResult=null,i}return this.parseFallbackToken(t,e)}parseListToken(t){if(!t.items||t.items.length===0)return this.parseTokenWithHandlers(t);const e=t.items.some(l=>pw(l).isTask),n=t.items.some(l=>!pw(l).isTask);if(!e||!n||this.getHandlersForToken("taskList").length===0)return this.parseTokenWithHandlers(t);const r=[];let s=[],i=null;for(let l=0;l<t.items.length;l+=1){const u=t.items[l],{isTask:d,checked:h,indentLevel:m}=pw(u);let y=u;if(d){const x=(u.raw||u.text||"").split(`
269
+ `),k=x[0].match(/^\s*[-+*]\s+\[([ xX])\]\s+(.*)$/),E=k?k[2]:"";let M=[];if(x.length>1&&x.slice(1).join(`
270
+ `).trim()){const N=x.slice(1),T=N.filter(A=>A.trim());if(T.length>0){const A=Math.min(...T.map(O=>O.length-O.trimStart().length)),P=N.map(O=>O.trim()?O.slice(A):"").join(`
271
+ `).trim();P&&(M=this.markedInstance.lexer(`${P}
272
+ `))}}y={type:"taskItem",raw:"",mainContent:E,indentLevel:m,checked:h??!1,text:E,tokens:this.tokenizeInline(E),nestedTokens:M}}const b=d?"taskList":"list";i!==b?(s.length>0&&r.push({type:i,items:s}),s=[y],i=b):s.push(y)}s.length>0&&r.push({type:i,items:s});const o=[];for(let l=0;l<r.length;l+=1){const u=r[l],d={...t,type:u.type,items:u.items},h=this.parseToken(d);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(s=>{if(!s.parseMarkdown)return!1;const i=s.parseMarkdown(t,n),o=this.normalizeParseResult(i);return o&&(!Array.isArray(o)||o.length>0)?(this.lastParseResult=o,!0):!1})&&this.lastParseResult){const s=this.lastParseResult;return this.lastParseResult=null,s}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,s;const i=[];for(let o=0;o<t.length;o+=1){const l=t[o];if(l.type==="text")i.push({type:"text",text:FA(l.text||"")});else if(l.type==="escape")i.push({type:"text",text:l.text||""});else if(l.type==="html"){const u=((n=(e=l.raw)!=null?e:l.text)!=null?n:"").toString(),d=/^<\/[\s]*[\w-]+/i.test(u),h=u.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!d&&h&&!/\/>$/.test(u)){const y=h[1],b=this.escapeRegex(y),v=new RegExp(`^<\\/\\s*${b}\\b`,"i");let x=-1;const k=[u];for(let E=o+1;E<t.length;E+=1){const M=t[E],_=((s=(r=M.raw)!=null?r:M.text)!=null?s:"").toString();if(k.push(_),M.type==="html"&&v.test(_)){x=E;break}}if(x!==-1){const E=k.join(""),M={type:"html",raw:E,text:E,block:!1},_=this.parseHTMLToken(M);if(_){const N=this.normalizeParseResult(_);Array.isArray(N)?i.push(...N):N&&i.push(N)}o=x;continue}}const m=this.parseHTMLToken(l);if(m){const y=this.normalizeParseResult(m);Array.isArray(y)?i.push(...y):y&&i.push(y)}}else if(l.type){const u=this.getHandlerForToken(l.type);if(u&&u.parseMarkdown){const d=this.createParseHelpers(),h=u.parseMarkdown(l,d);if(this.isMarkResult(h)){const m=this.applyMarkToContent(h.mark,h.content,h.attrs);i.push(...m)}else{const m=this.normalizeParseResult(h);Array.isArray(m)?i.push(...m):m&&i.push(m)}}else l.tokens&&i.push(...this.parseInlineTokens(l.tokens))}}for(let o=i.length-1;o>0;o-=1){const l=i[o],u=i[o-1];if(l.type==="text"&&u.type==="text"){const d=l.marks||[],h=u.marks||[];K7(d,h)&&(u.text=(u.text||"")+(l.text||""),i.splice(o,1))}}return i}applyMarkToContent(t,e,n){return e.map(r=>{if(r.type==="text"){const s=r.marks||[],i=n?{type:t,attrs:n}:{type:t};return{...r,marks:[...s,i]}}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:FA(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=r7(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 DJ(t,this.getSchemaParseDomTags())}getSchemaParseDomTags(){if(this.schemaParseDomTagsCache)return this.schemaParseDomTagsCache;const t=new Set;try{const e=ZL(this.baseExtensions),n=r=>{const s=r?.parseDOM;Array.isArray(s)&&s.forEach(i=>{if(typeof i?.tag=="string"){const o=i.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(s=>this.codeTypes.has(typeof s=="string"?s:s.type))?t:this.escapeMarkdownSyntax(B7(t))}escapeMarkdownSyntax(t){return t.replace(/([\\`*_[\]~])/g,"\\$1")}renderNodeToMarkdown(t,e,n=0,r=0,s={}){var i;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,y)=>{const b=o.isIndenting?r+1:r;return!Array.isArray(m)&&m.content?this.renderNodes(m.content,t,y||"",n,b):this.renderNodes(m,t,y||"",n,b)},renderChild:(m,y)=>{const b=o.isIndenting?r+1:r;return this.renderNodeToMarkdown(m,t,y,b)},indent:m=>this.indentString+m,wrapInBlock:CJ},d={index:n,level:r,parentType:e?.type,previousNode:l,meta:{parentAttrs:e?.attrs,...s}};return((i=o.renderMarkdown)==null?void 0:i.call(o,t,u,d))||""}renderNodes(t,e,n="",r=0,s=0){return Array.isArray(t)?this.renderNodesWithMarkBoundaries(t,e,n,s):t.type?this.renderNodeToMarkdown(t,e,r,s):""}renderNodesWithMarkBoundaries(t,e,n="",r=0){const s=[],i=new Map,o=new Set,l=new Map;return t.forEach((u,d)=>{const h=d<t.length-1?t[d+1]:null;if(u.type)if(u.type==="text"){let m=this.encodeTextForMarkdown(u.text||"",u,e);const y=new Map((u.marks||[]).map(T=>[T.type,T])),b=this.getMarksToOpenForSerialization(i,y,h),v=EJ(y,h),x=v.filter(T=>i.has(T)),k=x.length>0&&b.length>0;let E="";if(v.length>0&&!k){const T=m.match(/(\s+)$/);T&&(E=T[1],m=m.slice(0,-E.length))}k||v.slice().reverse().forEach(T=>{if(!i.has(T))return;const A=y.get(T),j=this.getMarkClosing(T,A,l.get(T));j&&(m+=j),i.has(T)&&(i.delete(T),l.delete(T))});let M="";if(b.length>0){const T=m.match(/^(\s+)/);T&&(M=T[1],m=m.slice(M.length))}b.forEach(({type:T,mark:A})=>{const j=o.has(T)?"html":"markdown",P=this.getMarkOpening(T,A,j);P&&(m=P+m),l.set(T,j),o.delete(T)}),k||b.slice().reverse().forEach(({type:T,mark:A})=>{i.set(T,A)}),m=M+m;let _;if(k){const T=new Set((h?.marks||[]).map(P=>P.type));b.forEach(({type:P})=>{T.has(P)&&this.getHtmlReopenTags(P)&&o.add(P)});const A=Array.from(i.keys()),j=x.slice().sort((P,O)=>A.indexOf(O)-A.indexOf(P));_=[...b.map(P=>P.type),...j]}else _=NJ(i,y,h,this.markSetsEqual.bind(this));let N="";if(_.length>0){const T=m.match(/(\s+)$/);T&&(N=T[1],m=m.slice(0,-N.length))}_.forEach(T=>{var A;const j=(A=i.get(T))!=null?A:y.get(T),P=this.getMarkClosing(T,j,l.get(T));P&&(m+=P),i.delete(T),l.delete(T)}),m+=N,m+=E,s.push(m)}else{const m=new Set((u.marks||[]).map(E=>E.type)),y=new Map,b=new Map;i.forEach((E,M)=>{var _;m.has(M)&&(y.set(M,E),b.set(M,(_=l.get(M))!=null?_:"markdown"))});const v=MJ(i,(E,M)=>this.getMarkClosing(E,M,l.get(E)));l.clear();const x=this.renderNodeToMarkdown(u,e,d,r),k=u.type==="hardBreak"?"":_J(y,i,(E,M)=>{var _;const N=(_=b.get(E))!=null?_:"markdown";return l.set(E,N),this.getMarkOpening(E,M,N)});s.push(v+x+k)}}),s.join(n)}getMarkOpening(t,e,n="markdown"){var r;if(n==="html")return((r=this.getHtmlReopenTags(t))==null?void 0:r.open)||"";const s=this.getHandlersForNodeType(t),i=s.length>0?s[0]:void 0;if(!i||!i.renderMarkdown)return"";const o="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:o}]};try{const u=i.renderMarkdown(l,{renderChildren:()=>o,renderChild:()=>o,indent:h=>h,wrapInBlock:(h,m)=>h+m},{index:0,level:0,parentType:"text",meta:{}}),d=u.indexOf(o);return d>=0?u.substring(0,d):""}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 s=this.getHandlersForNodeType(t),i=s.length>0?s[0]:void 0;if(!i||!i.renderMarkdown)return"";const o="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:o}]};try{const u=i.renderMarkdown(l,{renderChildren:()=>o,renderChild:()=>o,indent:m=>m,wrapInBlock:(m,y)=>m+y},{index:0,level:0,parentType:"text",meta:{}}),d=u.indexOf(o),h=d+o.length;return d>=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 s=e.get(n);return s&&mu(r.attrs,s.attrs)})}getMarksToOpenForSerialization(t,e,n){const r=TJ(t,e);if(r.length<=1)return r;const s=n?.marks||[],i=(d,h)=>s.some(m=>m.type===d&&mu(m.attrs,h)),o=(d,h)=>{var m,y;const b=(m=this.extensionRanks.get(d.type))!=null?m:Number.MAX_SAFE_INTEGER,v=(y=this.extensionRanks.get(h.type))!=null?y:Number.MAX_SAFE_INTEGER;return b!==v?v-b:d.type.localeCompare(h.type)},l=r.filter(d=>!i(d.type,d.mark.attrs)).sort(o),u=r.filter(d=>i(d.type,d.mark.attrs)).sort(o);return[...l,...u]}},yR=IJ,LJ=rn.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(t,e)=>{if(!e?.contentType||Gp(t,e?.contentType)!=="markdown"||!this.editor.markdown)return Bs.setContent(t,e);const r=this.editor.markdown.parse(t);return Bs.setContent(r,e)},insertContent:(t,e)=>{if(!e?.contentType||Gp(t,e?.contentType)!=="markdown"||!this.editor.markdown)return Bs.insertContent(t,e);const r=this.editor.markdown.parse(t);return Bs.insertContent(r,e)},insertContentAt:(t,e,n)=>{if(!n?.contentType||Gp(e,n?.contentType)!=="markdown"||!this.editor.markdown)return Bs.insertContentAt(t,e,n);const s=this.editor.markdown.parse(e);return Bs.insertContentAt(t,s,n)}}},addStorage(){return{manager:new yR({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 yR({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||Gp(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)}}),PJ=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,$J=Gn.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",Yt(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,s,i,o;const l=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",u=(s=(r=t.attrs)==null?void 0:r.alt)!=null?s:"",d=(o=(i=t.attrs)==null?void 0:i.title)!=null?o:"";return d?`![${u}](${l} "${d}")`:`![${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,s=new Set(["src","width","height"]);return({node:i,getPos:o,HTMLAttributes:l,editor:u})=>{const d=document.createElement("img");d.draggable=!1;const h=Yt(this.options.HTMLAttributes,l);Object.entries(h).forEach(([k,E])=>{if(E!=null)switch(k){case"src":case"width":case"height":break;default:d.setAttribute(k,E);break}}),h.src!==null&&(d.src=h.src);let m={...l};const y=k=>{if(typeof k=="string"&&k!==""){d.getAttribute("src")!==k&&(d.src=k);return}d.hasAttribute("src")&&d.removeAttribute("src"),d.src!==""&&(d.src="")};y(l.src);const b=k=>{if(k.type!==i.type)return!1;const E=u.extensionManager.attributes.filter(_=>_.type===k.type.name),M=pu(k,E);return Object.keys(m).forEach(_=>{!s.has(_)&&!(_ in M)&&d.removeAttribute(_)}),Object.entries(M).forEach(([_,N])=>{s.has(_)||(N!=null?d.setAttribute(_,N):d.removeAttribute(_))}),y(M.src),m=M,!0},v=new lY({element:d,editor:u,node:i,getPos:o,onResize:(k,E)=>{d.style.width=`${k}px`,d.style.height=`${E}px`},onCommit:(k,E)=>{const M=o();M!==void 0&&this.editor.chain().setNodeSelection(M).updateAttributes(this.name,{width:k,height:E}).run()},onUpdate:b,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),x=v.dom;return x.style.visibility="hidden",x.style.pointerEvents="none",d.onload=()=>{x.style.visibility="",x.style.pointerEvents=""},v}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[vP({find:PJ,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),zJ=$J;let oS,aS;if(typeof WeakMap<"u"){let t=new WeakMap;oS=e=>t.get(e),aS=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;oS=r=>{for(let s=0;s<t.length;s+=2)if(t[s]==r)return t[s+1]},aS=(r,s)=>(n==10&&(n=0),t[n++]=r,t[n++]=s)}var gn=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,s=e/this.width|0;let i=r+1,o=s+1;for(let l=1;i<this.width&&this.map[e+l]==n;l++)i++;for(let l=1;o<this.height&&this.map[e+this.width*l]==n;l++)o++;return{left:r,top:s,right:i,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:s,top:i,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?r==0:s==this.width)?null:this.map[i*this.width+(n<0?r-1:s)]:(n<0?i==0:o==this.height)?null:this.map[r+this.width*(n<0?i-1:o)]}rectBetween(t,e){const{left:n,right:r,top:s,bottom:i}=this.findCell(t),{left:o,right:l,top:u,bottom:d}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(s,u),right:Math.max(r,l),bottom:Math.max(i,d)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let s=t.left;s<t.right;s++){const i=r*this.width+s,o=this.map[i];n[o]||(n[o]=!0,!(s==t.left&&s&&this.map[i-1]==o||r==t.top&&r&&this.map[i-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,s=0;;r++){const i=s+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]<s;)o++;return o==l?i-1:this.map[o]}s=i}}static get(t){return oS(t)||aS(t,BJ(t))}};function BJ(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=FJ(t),n=t.childCount,r=[];let s=0,i=null;const o=[];for(let d=0,h=e*n;d<h;d++)r[d]=0;for(let d=0,h=0;d<n;d++){const m=t.child(d);h++;for(let v=0;;v++){for(;s<r.length&&r[s]!=0;)s++;if(v==m.childCount)break;const x=m.child(v),{colspan:k,rowspan:E,colwidth:M}=x.attrs;for(let _=0;_<E;_++){if(_+d>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:h,n:E-_});break}const N=s+_*e;for(let T=0;T<k;T++){r[N+T]==0?r[N+T]=h:(i||(i=[])).push({type:"collision",row:d,pos:h,n:k-T});const A=M&&M[T];if(A){const j=(N+T)%e*2,P=o[j];P==null||P!=A&&o[j+1]==1?(o[j]=A,o[j+1]=1):P==A&&o[j+1]++}}}s+=k,h+=x.nodeSize}const y=(d+1)*e;let b=0;for(;s<y;)r[s++]==0&&b++;b&&(i||(i=[])).push({type:"missing",row:d,n:b}),h++}(e===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new gn(e,n,r,i);let u=!1;for(let d=0;!u&&d<o.length;d+=2)o[d]!=null&&o[d+1]<n&&(u=!0);return u&&VJ(l,o,t),l}function FJ(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const s=t.child(r);let i=0;if(n)for(let o=0;o<r;o++){const l=t.child(o);for(let u=0;u<l.childCount;u++){const d=l.child(u);o+d.attrs.rowspan>r&&(i+=d.attrs.colspan)}}for(let o=0;o<s.childCount;o++){const l=s.child(o);i+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function VJ(t,e,n){t.problems||(t.problems=[]);const r={};for(let s=0;s<t.map.length;s++){const i=t.map[s];if(r[i])continue;r[i]=!0;const o=n.nodeAt(i);if(!o)throw new RangeError(`No cell with offset ${i} found`);let l=null;const u=o.attrs;for(let d=0;d<u.colspan;d++){const h=e[(s+d)%t.width*2];h!=null&&(!u.colwidth||u.colwidth[d]!=h)&&((l||(l=HJ(u)))[d]=h)}l&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function HJ(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function yr(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],s=r.spec.tableRole;s&&(e[s]=r)}}return e}const aa=new yn("selectingCells");function Il(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 UJ(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 ei(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 Dy(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=Il(e.$head)||WJ(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function WJ(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 lS(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function qJ(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function wC(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function w2(t,e,n){const r=t.node(-1),s=gn.get(r),i=t.start(-1),o=s.nextCell(t.pos-i,e,n);return o==null?null:t.node(0).resolve(i+o)}function Ll(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(s=>s>0)||(r.colwidth=null)),r}function x2(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let s=0;s<n;s++)r.colwidth.splice(e,0,0)}return r}function GJ(t,e,n){const r=yr(e.type.schema).header_cell;for(let s=0;s<t.height;s++)if(e.nodeAt(t.map[n+s*t.width]).type!=r)return!1;return!0}var Gt=class Gi extends nt{constructor(e,n=e){const r=e.node(-1),s=gn.get(r),i=e.start(-1),o=s.rectBetween(e.pos-i,n.pos-i),l=e.node(0),u=s.cellsInRect(o).filter(h=>h!=n.pos-i);u.unshift(n.pos-i);const d=u.map(h=>{const m=r.nodeAt(h);if(!m)throw new RangeError(`No cell with offset ${h} found`);const y=i+h+1;return new zI(l.resolve(y),l.resolve(y+m.content.size))});super(d[0].$from,d[0].$to,d),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),s=e.resolve(n.map(this.$headCell.pos));if(lS(r)&&lS(s)&&wC(r,s)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?Gi.rowSelection(r,s):i&&this.isColSelection()?Gi.colSelection(r,s):new Gi(r,s)}return Ue.between(r,s)}content(){const e=this.$anchorCell.node(-1),n=gn.get(e),r=this.$anchorCell.start(-1),s=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let u=s.top;u<s.bottom;u++){const d=[];for(let h=u*n.width+s.left,m=s.left;m<s.right;m++,h++){const y=n.map[h];if(i[y])continue;i[y]=!0;const b=n.findCell(y);let v=e.nodeAt(y);if(!v)throw new RangeError(`No cell with offset ${y} found`);const x=s.left-b.left,k=b.right-s.right;if(x>0||k>0){let E=v.attrs;if(x>0&&(E=Ll(E,0,x)),k>0&&(E=Ll(E,E.colspan-k,k)),b.left<s.left){if(v=v.type.createAndFill(E),!v)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(E)}`)}else v=v.type.create(E,v.content)}if(b.top<s.top||b.bottom>s.bottom){const E={...v.attrs,rowspan:Math.min(b.bottom,s.bottom)-Math.max(b.top,s.top)};b.top<s.top?v=v.type.createAndFill(E):v=v.type.create(E,v.content)}d.push(v)}o.push(e.child(u).copy(ge.from(d)))}const l=this.isColSelection()&&this.isRowSelection()?e:o;return new Oe(ge.from(l),1,1)}replace(e,n=Oe.empty){const r=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){const{$from:l,$to:u}=s[o],d=e.mapping.slice(r);e.replace(d.map(l.pos),d.map(u.pos),o?Oe.empty:n)}const i=nt.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,n){this.replace(e,new Oe(ge.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=gn.get(n),s=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s));for(let o=0;o<i.length;o++)e(n.nodeAt(i[o]),s+i[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,s=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,s)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),s=gn.get(r),i=e.start(-1),o=s.findCell(e.pos-i),l=s.findCell(n.pos-i),u=e.node(0);return o.top<=l.top?(o.top>0&&(e=u.resolve(i+s.map[o.left])),l.bottom<s.height&&(n=u.resolve(i+s.map[s.width*(s.height-1)+l.right-1]))):(l.top>0&&(n=u.resolve(i+s.map[l.left])),o.bottom<s.height&&(e=u.resolve(i+s.map[s.width*(s.height-1)+o.right-1]))),new Gi(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=gn.get(e),r=this.$anchorCell.start(-1),s=n.colCount(this.$anchorCell.pos-r),i=n.colCount(this.$headCell.pos-r);if(Math.min(s,i)>0)return!1;const o=s+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==n.width}eq(e){return e instanceof Gi&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),s=gn.get(r),i=e.start(-1),o=s.findCell(e.pos-i),l=s.findCell(n.pos-i),u=e.node(0);return o.left<=l.left?(o.left>0&&(e=u.resolve(i+s.map[o.top*s.width])),l.right<s.width&&(n=u.resolve(i+s.map[s.width*(l.top+1)-1]))):(l.left>0&&(n=u.resolve(i+s.map[l.top*s.width])),o.right<s.width&&(e=u.resolve(i+s.map[s.width*(o.top+1)-1]))),new Gi(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Gi(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Gi(e.resolve(n),e.resolve(r))}getBookmark(){return new YJ(this.$anchorCell.pos,this.$headCell.pos)}};Gt.prototype.visible=!1;nt.jsonID("cell",Gt);var YJ=class S2{constructor(e,n){this.anchor=e,this.head=n}map(e){return new S2(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&&wC(n,r)?new Gt(n,r):nt.near(r,1)}};function KJ(t){if(!(t.selection instanceof Gt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(Un.node(r,r+n.nodeSize,{class:"selectedCell"}))}),Dt.create(t.doc,e)}function ZJ({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,s=t.depth;for(;s>=0&&!(t.after(s+1)<t.end(s));s--,n++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return n==r&&/row|table/.test(t.node(s).type.spec.tableRole)}function XJ({$from:t,$to:e}){let n,r;for(let s=t.depth;s>0;s--){const i=t.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let s=e.depth;s>0;s--){const i=e.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&e.parentOffset===0}function JJ(t,e,n){const r=(e||t).selection,s=(e||t).doc;let i,o;if(r instanceof Ge&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=Gt.create(s,r.from);else if(o=="row"){const l=s.resolve(r.from+1);i=Gt.rowSelection(l,l)}else if(!n){const l=gn.get(r.node),u=r.from+1,d=u+l.map[l.width*l.height-1];i=Gt.create(s,u+1,d)}}else r instanceof Ue&&ZJ(r)?i=Ue.create(s,r.from):r instanceof Ue&&XJ(r)&&(i=Ue.create(s,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}const QJ=new yn("fix-tables");function k2(t,e,n,r){const s=t.childCount,i=e.childCount;e:for(let o=0,l=0;o<i;o++){const u=e.child(o);for(let d=l,h=Math.min(s,o+3);d<h;d++)if(t.child(d)==u){l=d+1,n+=u.nodeSize;continue e}r(u,n),l<s&&t.child(l).sameMarkup(u)?k2(t.child(l),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function C2(t,e){let n;const r=(s,i)=>{s.type.spec.tableRole=="table"&&(n=eQ(t,s,i,n))};return e?e.doc!=t.doc&&k2(e.doc,t.doc,0,r):t.doc.descendants(r),n}function eQ(t,e,n,r){const s=gn.get(e);if(!s.problems)return r;r||(r=t.tr);const i=[];for(let u=0;u<s.height;u++)i.push(0);for(let u=0;u<s.problems.length;u++){const d=s.problems[u];if(d.type=="collision"){const h=e.nodeAt(d.pos);if(!h)continue;const m=h.attrs;for(let y=0;y<m.rowspan;y++)i[d.row+y]+=d.n;r.setNodeMarkup(r.mapping.map(n+1+d.pos),null,Ll(m,m.colspan-d.n,d.n))}else if(d.type=="missing")i[d.row]+=d.n;else if(d.type=="overlong_rowspan"){const h=e.nodeAt(d.pos);if(!h)continue;r.setNodeMarkup(r.mapping.map(n+1+d.pos),null,{...h.attrs,rowspan:h.attrs.rowspan-d.n})}else if(d.type=="colwidth mismatch"){const h=e.nodeAt(d.pos);if(!h)continue;r.setNodeMarkup(r.mapping.map(n+1+d.pos),null,{...h.attrs,colwidth:d.colwidth})}else if(d.type=="zero_sized"){const h=r.mapping.map(n);r.delete(h,h+e.nodeSize)}}let o,l;for(let u=0;u<i.length;u++)i[u]&&(o==null&&(o=u),l=u);for(let u=0,d=n+1;u<s.height;u++){const h=e.child(u),m=d+h.nodeSize,y=i[u];if(y>0){let b="cell";h.firstChild&&(b=h.firstChild.type.spec.tableRole);const v=[];for(let k=0;k<y;k++){const E=yr(t.schema)[b].createAndFill();E&&v.push(E)}const x=(u==0||o==u-1)&&l==u?d+1:m-1;r.insert(r.mapping.map(x),v)}d=m}return r.setMeta(QJ,{fixTables:!0})}function xi(t){const e=t.selection,n=Dy(t),r=n.node(-1),s=n.start(-1),i=gn.get(r);return{...e instanceof Gt?i.rectBetween(e.$anchorCell.pos-s,e.$headCell.pos-s):i.findCell(n.pos-s),tableStart:s,map:i,table:r}}function E2(t,{map:e,tableStart:n,table:r},s){let i=s>0?-1:0;GJ(e,r,s+i)&&(i=s==0||s==e.width?null:0);for(let o=0;o<e.height;o++){const l=o*e.width+s;if(s>0&&s<e.width&&e.map[l-1]==e.map[l]){const u=e.map[l],d=r.nodeAt(u);t.setNodeMarkup(t.mapping.map(n+u),null,x2(d.attrs,s-e.colCount(u))),o+=d.attrs.rowspan-1}else{const u=i==null?yr(r.type.schema).cell:r.nodeAt(e.map[l+i]).type,d=e.positionAt(o,s,r);t.insert(t.mapping.map(n+d),u.createAndFill())}}return t}function tQ(t,e){if(!ei(t))return!1;if(e){const n=xi(t);e(E2(t.tr,n,n.left))}return!0}function nQ(t,e){if(!ei(t))return!1;if(e){const n=xi(t);e(E2(t.tr,n,n.right))}return!0}function rQ(t,{map:e,table:n,tableStart:r},s){const i=t.mapping.maps.length;for(let o=0;o<e.height;){const l=o*e.width+s,u=e.map[l],d=n.nodeAt(u),h=d.attrs;if(s>0&&e.map[l-1]==u||s<e.width-1&&e.map[l+1]==u)t.setNodeMarkup(t.mapping.slice(i).map(r+u),null,Ll(h,s-e.colCount(u)));else{const m=t.mapping.slice(i).map(r+u);t.delete(m,m+d.nodeSize)}o+=h.rowspan}}function sQ(t,e){if(!ei(t))return!1;if(e){const n=xi(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let s=n.right-1;rQ(r,n,s),s!=n.left;s--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=gn.get(i)}e(r)}return!0}function iQ(t,e,n){var r;const s=yr(e.type.schema).header_cell;for(let i=0;i<t.width;i++)if(((r=e.nodeAt(t.map[i+n*t.width]))===null||r===void 0?void 0:r.type)!=s)return!1;return!0}function T2(t,{map:e,tableStart:n,table:r},s){let i=n;for(let d=0;d<s;d++)i+=r.child(d).nodeSize;const o=[];let l=s>0?-1:0;iQ(e,r,s+l)&&(l=s==0||s==e.height?null:0);for(let d=0,h=e.width*s;d<e.width;d++,h++)if(s>0&&s<e.height&&e.map[h]==e.map[h-e.width]){const m=e.map[h],y=r.nodeAt(m).attrs;t.setNodeMarkup(n+m,null,{...y,rowspan:y.rowspan+1}),d+=y.colspan-1}else{var u;const m=l==null?yr(r.type.schema).cell:(u=r.nodeAt(e.map[h+l*e.width]))===null||u===void 0?void 0:u.type,y=m?.createAndFill();y&&o.push(y)}return t.insert(i,yr(r.type.schema).row.create(null,o)),t}function oQ(t,e){if(!ei(t))return!1;if(e){const n=xi(t);e(T2(t.tr,n,n.top))}return!0}function aQ(t,e){if(!ei(t))return!1;if(e){const n=xi(t);e(T2(t.tr,n,n.bottom))}return!0}function lQ(t,{map:e,table:n,tableStart:r},s){let i=0;for(let d=0;d<s;d++)i+=n.child(d).nodeSize;const o=i+n.child(s).nodeSize,l=t.mapping.maps.length;t.delete(i+r,o+r);const u=new Set;for(let d=0,h=s*e.width;d<e.width;d++,h++){const m=e.map[h];if(!u.has(m)){if(u.add(m),s>0&&m==e.map[h-e.width]){const y=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(l).map(m+r),null,{...y,rowspan:y.rowspan-1}),d+=y.colspan-1}else if(s<e.height&&m==e.map[h+e.width]){const y=n.nodeAt(m),b=y.attrs,v=y.type.create({...b,rowspan:y.attrs.rowspan-1},y.content),x=e.positionAt(s+1,d,n);t.insert(t.mapping.slice(l).map(r+x),v),d+=b.colspan-1}}}}function cQ(t,e){if(!ei(t))return!1;if(e){const n=xi(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let s=n.bottom-1;lQ(r,n,s),s!=n.top;s--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=gn.get(n.table)}e(r)}return!0}function bR(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function uQ({width:t,height:e,map:n},r){let s=r.top*t+r.left,i=s,o=(r.bottom-1)*t+r.left,l=s+(r.right-r.left-1);for(let u=r.top;u<r.bottom;u++){if(r.left>0&&n[i]==n[i-1]||r.right<t&&n[l]==n[l+1])return!0;i+=t,l+=t}for(let u=r.left;u<r.right;u++){if(r.top>0&&n[s]==n[s-t]||r.bottom<e&&n[o]==n[o+t])return!0;s++,o++}return!1}function vR(t,e){const n=t.selection;if(!(n instanceof Gt)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=xi(t),{map:s}=r;if(uQ(s,r))return!1;if(e){const i=t.tr,o={};let l=ge.empty,u,d;for(let h=r.top;h<r.bottom;h++)for(let m=r.left;m<r.right;m++){const y=s.map[h*s.width+m],b=r.table.nodeAt(y);if(!(o[y]||!b))if(o[y]=!0,u==null)u=y,d=b;else{bR(b)||(l=l.append(b.content));const v=i.mapping.map(y+r.tableStart);i.delete(v,v+b.nodeSize)}}if(u==null||d==null)return!0;if(i.setNodeMarkup(u+r.tableStart,null,{...x2(d.attrs,d.attrs.colspan,r.right-r.left-d.attrs.colspan),rowspan:r.bottom-r.top}),l.size>0){const h=u+1+d.content.size,m=bR(d)?u+1:h;i.replaceWith(m+r.tableStart,h+r.tableStart,l)}i.setSelection(new Gt(i.doc.resolve(u+r.tableStart))),e(i)}return!0}function wR(t,e){const n=yr(t.schema);return dQ(({node:r})=>n[r.type.spec.tableRole])(t,e)}function dQ(t){return(e,n)=>{const r=e.selection;let s,i;if(r instanceof Gt){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;s=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var o;if(s=UJ(r.$from),!s)return!1;i=(o=Il(r.$from))===null||o===void 0?void 0:o.pos}if(s==null||i==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(n){let l=s.attrs;const u=[],d=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const h=xi(e),m=e.tr;for(let b=0;b<h.right-h.left;b++)u.push(d?{...l,colwidth:d&&d[b]?[d[b]]:null}:l);let y;for(let b=h.top;b<h.bottom;b++){let v=h.map.positionAt(b,h.left,h.table);b==h.top&&(v+=s.nodeSize);for(let x=h.left,k=0;x<h.right;x++,k++)x==h.left&&b==h.top||m.insert(y=m.mapping.map(v+h.tableStart,1),t({node:s,row:b,col:x}).createAndFill(u[k]))}m.setNodeMarkup(i,t({node:s,row:h.top,col:h.left}),u[0]),r instanceof Gt&&m.setSelection(new Gt(m.doc.resolve(r.$anchorCell.pos),y?m.doc.resolve(y):void 0)),n(m)}return!0}}function fQ(t,e){return function(n,r){if(!ei(n))return!1;const s=Dy(n);if(s.nodeAfter.attrs[t]===e)return!1;if(r){const i=n.tr;n.selection instanceof Gt?n.selection.forEachCell((o,l)=>{o.attrs[t]!==e&&i.setNodeMarkup(l,null,{...o.attrs,[t]:e})}):i.setNodeMarkup(s.pos,null,{...s.nodeAfter.attrs,[t]:e}),r(i)}return!0}}function hQ(t){return function(e,n){if(!ei(e))return!1;if(n){const r=yr(e.schema),s=xi(e),i=e.tr,o=s.map.cellsInRect(t=="column"?{left:s.left,top:0,right:s.right,bottom:s.map.height}:t=="row"?{left:0,top:s.top,right:s.map.width,bottom:s.bottom}:s),l=o.map(u=>s.table.nodeAt(u));for(let u=0;u<o.length;u++)l[u].type==r.header_cell&&i.setNodeMarkup(s.tableStart+o[u],r.cell,l[u].attrs);if(i.steps.length===0)for(let u=0;u<o.length;u++)i.setNodeMarkup(s.tableStart+o[u],r.header_cell,l[u].attrs);n(i)}return!0}}function xR(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 s=0;s<r.length;s++){const i=e.table.nodeAt(r[s]);if(i&&i.type!==n.header_cell)return!1}return!0}function Lf(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?hQ(t):function(n,r){if(!ei(n))return!1;if(r){const s=yr(n.schema),i=xi(n),o=n.tr,l=xR("row",i,s),u=xR("column",i,s),d=(t==="column"?l:t==="row"&&u)?1:0,h=t=="column"?{left:0,top:d,right:1,bottom:i.map.height}:t=="row"?{left:d,top:0,right:i.map.width,bottom:1}:i,m=t=="column"?u?s.cell:s.header_cell:t=="row"?l?s.cell:s.header_cell:s.cell;i.map.cellsInRect(h).forEach(y=>{const b=y+i.tableStart,v=o.doc.nodeAt(b);v&&o.setNodeMarkup(b,m,v.attrs)}),r(o)}return!0}}Lf("row",{useDeprecatedLogic:!0});Lf("column",{useDeprecatedLogic:!0});const pQ=Lf("cell",{useDeprecatedLogic:!0});function mQ(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,s=t.before();r>=0;r--){const i=t.node(-1).child(r),o=i.lastChild;if(o)return s-1-o.nodeSize;s-=i.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),s=t.after();r<n.childCount;r++){const i=n.child(r);if(i.childCount)return s+1;s+=i.nodeSize}}return null}function SR(t){return function(e,n){if(!ei(e))return!1;const r=mQ(Dy(e),t);if(r==null)return!1;if(n){const s=e.doc.resolve(r);n(e.tr.setSelection(Ue.between(s,qJ(s))).scrollIntoView())}return!0}}function gQ(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 Yp(t,e){const n=t.selection;if(!(n instanceof Gt))return!1;if(e){const r=t.tr,s=yr(t.schema).cell.createAndFill().content;n.forEachCell((i,o)=>{i.content.eq(s)||r.replace(r.mapping.map(o+1),r.mapping.map(o+i.nodeSize-1),new Oe(s,0,0))}),r.docChanged&&e(r)}return!0}function yQ(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 s=e.child(0),i=s.type.spec.tableRole,o=s.type.schema,l=[];if(i=="row")for(let u=0;u<e.childCount;u++){let d=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)&&(d=cS(yr(o).row,new Oe(d,h,m)).content),l.push(d)}else if(i=="cell"||i=="header_cell")l.push(n||r?cS(yr(o).row,new Oe(e,n,r)).content:e);else return null;return bQ(o,l)}function bQ(t,e){const n=[];for(let s=0;s<e.length;s++){const i=e[s];for(let o=i.childCount-1;o>=0;o--){const{rowspan:l,colspan:u}=i.child(o).attrs;for(let d=s;d<s+l;d++)n[d]=(n[d]||0)+u}}let r=0;for(let s=0;s<n.length;s++)r=Math.max(r,n[s]);for(let s=0;s<n.length;s++)if(s>=e.length&&e.push(ge.empty),n[s]<r){const i=yr(t).cell.createAndFill(),o=[];for(let l=n[s];l<r;l++)o.push(i);e[s]=e[s].append(ge.from(o))}return{height:e.length,width:r,rows:e}}function cS(t,e){const n=t.createAndFill();return new Ck(n).replace(0,n.content.size,e).doc}function vQ({width:t,height:e,rows:n},r,s){if(t!=r){const i=[],o=[];for(let l=0;l<n.length;l++){const u=n[l],d=[];for(let h=i[l]||0,m=0;h<r;m++){let y=u.child(m%u.childCount);h+y.attrs.colspan>r&&(y=y.type.createChecked(Ll(y.attrs,y.attrs.colspan,h+y.attrs.colspan-r),y.content)),d.push(y),h+=y.attrs.colspan;for(let b=1;b<y.attrs.rowspan;b++)i[l+b]=(i[l+b]||0)+y.attrs.colspan}o.push(ge.from(d))}n=o,t=r}if(e!=s){const i=[];for(let o=0,l=0;o<s;o++,l++){const u=[],d=n[l%e];for(let h=0;h<d.childCount;h++){let m=d.child(h);o+m.attrs.rowspan>s&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,s-m.attrs.rowspan)},m.content)),u.push(m)}i.push(ge.from(u))}n=i,e=s}return{width:t,height:e,rows:n}}function wQ(t,e,n,r,s,i,o){const l=t.doc.type.schema,u=yr(l);let d,h;if(s>e.width)for(let m=0,y=0;m<e.height;m++){const b=n.child(m);y+=b.nodeSize;const v=[];let x;b.lastChild==null||b.lastChild.type==u.cell?x=d||(d=u.cell.createAndFill()):x=h||(h=u.header_cell.createAndFill());for(let k=e.width;k<s;k++)v.push(x);t.insert(t.mapping.slice(o).map(y-1+r),v)}if(i>e.height){const m=[];for(let v=0,x=(e.height-1)*e.width;v<Math.max(e.width,s);v++){const k=v>=e.width?!1:n.nodeAt(e.map[x+v]).type==u.header_cell;m.push(k?h||(h=u.header_cell.createAndFill()):d||(d=u.cell.createAndFill()))}const y=u.row.create(null,ge.from(m)),b=[];for(let v=e.height;v<i;v++)b.push(y);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),b)}return!!(d||h)}function kR(t,e,n,r,s,i,o,l){if(o==0||o==e.height)return!1;let u=!1;for(let d=s;d<i;d++){const h=o*e.width+d,m=e.map[h];if(e.map[h-e.width]==m){u=!0;const y=n.nodeAt(m),{top:b,left:v}=e.findCell(m);t.setNodeMarkup(t.mapping.slice(l).map(m+r),null,{...y.attrs,rowspan:o-b}),t.insert(t.mapping.slice(l).map(e.positionAt(o,v,n)),y.type.createAndFill({...y.attrs,rowspan:b+y.attrs.rowspan-o})),d+=y.attrs.colspan-1}}return u}function CR(t,e,n,r,s,i,o,l){if(o==0||o==e.width)return!1;let u=!1;for(let d=s;d<i;d++){const h=d*e.width+o,m=e.map[h];if(e.map[h-1]==m){u=!0;const y=n.nodeAt(m),b=e.colCount(m),v=t.mapping.slice(l).map(m+r);t.setNodeMarkup(v,null,Ll(y.attrs,o-b,y.attrs.colspan-(o-b))),t.insert(v+y.nodeSize,y.type.createAndFill(Ll(y.attrs,0,o-b))),d+=y.attrs.rowspan-1}}return u}function ER(t,e,n,r,s){let i=n?t.doc.nodeAt(n-1):t.doc;if(!i)throw new Error("No table found");let o=gn.get(i);const{top:l,left:u}=r,d=u+s.width,h=l+s.height,m=t.tr;let y=0;function b(){if(i=n?m.doc.nodeAt(n-1):m.doc,!i)throw new Error("No table found");o=gn.get(i),y=m.mapping.maps.length}wQ(m,o,i,n,d,h,y)&&b(),kR(m,o,i,n,u,d,l,y)&&b(),kR(m,o,i,n,u,d,h,y)&&b(),CR(m,o,i,n,l,h,u,y)&&b(),CR(m,o,i,n,l,h,d,y)&&b();for(let v=l;v<h;v++){const x=o.positionAt(v,u,i),k=o.positionAt(v,d,i);m.replace(m.mapping.slice(y).map(x+n),m.mapping.slice(y).map(k+n),new Oe(s.rows[v-l],0,0))}b(),m.setSelection(new Gt(m.doc.resolve(n+o.positionAt(l,u,i)),m.doc.resolve(n+o.positionAt(h-1,d-1,i)))),e(m)}const xQ=zk({ArrowLeft:Kp("horiz",-1),ArrowRight:Kp("horiz",1),ArrowUp:Kp("vert",-1),ArrowDown:Kp("vert",1),"Shift-ArrowLeft":Zp("horiz",-1),"Shift-ArrowRight":Zp("horiz",1),"Shift-ArrowUp":Zp("vert",-1),"Shift-ArrowDown":Zp("vert",1),Backspace:Yp,"Mod-Backspace":Yp,Delete:Yp,"Mod-Delete":Yp});function Om(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Kp(t,e){return(n,r,s)=>{if(!s)return!1;const i=n.selection;if(i instanceof Gt)return Om(n,r,nt.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const o=N2(s,t,e);if(o==null)return!1;if(t=="horiz")return Om(n,r,nt.near(n.doc.resolve(i.head+e),e));{const l=n.doc.resolve(o),u=w2(l,t,e);let d;return u?d=nt.near(u,1):e<0?d=nt.near(n.doc.resolve(l.before(-1)),-1):d=nt.near(n.doc.resolve(l.after(-1)),1),Om(n,r,d)}}}function Zp(t,e){return(n,r,s)=>{if(!s)return!1;const i=n.selection;let o;if(i instanceof Gt)o=i;else{const u=N2(s,t,e);if(u==null)return!1;o=new Gt(n.doc.resolve(u))}const l=w2(o.$headCell,t,e);return l?Om(n,r,new Gt(o.$anchorCell,l)):!1}}function SQ(t,e){const n=t.state.doc,r=Il(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Gt(r))),!0):!1}function kQ(t,e,n){if(!ei(t.state))return!1;let r=yQ(n);const s=t.state.selection;if(s instanceof Gt){r||(r={width:1,height:1,rows:[ge.from(cS(yr(t.state.schema).cell,n))]});const i=s.$anchorCell.node(-1),o=s.$anchorCell.start(-1),l=gn.get(i).rectBetween(s.$anchorCell.pos-o,s.$headCell.pos-o);return r=vQ(r,l.right-l.left,l.bottom-l.top),ER(t.state,t.dispatch,o,l,r),!0}else if(r){const i=Dy(t.state),o=i.start(-1);return ER(t.state,t.dispatch,o,gn.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function CQ(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=TR(t,e.target);let s;if(e.shiftKey&&t.state.selection instanceof Gt)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(s=Il(t.state.selection.$anchor))!=null&&((n=mw(t,e))===null||n===void 0?void 0:n.pos)!=s.pos)i(s,e),e.preventDefault();else if(!r)return;function i(u,d){let h=mw(t,d);const m=aa.getState(t.state)==null;if(!h||!wC(u,h))if(m)h=u;else return;const y=new Gt(u,h);if(m||!t.state.selection.eq(y)){const b=t.state.tr.setSelection(y);m&&b.setMeta(aa,u.pos),t.dispatch(b)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",l),aa.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(aa,-1))}function l(u){const d=u,h=aa.getState(t.state);let m;if(h!=null)m=t.state.doc.resolve(h);else if(TR(t,d.target)!=r&&(m=mw(t,e),!m))return o();m&&i(m,d)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",l)}function N2(t,e,n){if(!(t.state.selection instanceof Ue))return null;const{$head:r}=t.state.selection;for(let s=r.depth-1;s>=0;s--){const i=r.node(s);if((n<0?r.index(s):r.indexAfter(s))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const o=r.before(s),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?o:null}}return null}function TR(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function mw(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:s}=n;return r>=0&&Il(t.state.doc.resolve(r))||Il(t.state.doc.resolve(s))}var EQ=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")),uS(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,uS(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function uS(t,e,n,r,s,i){let o=0,l=!0,u=e.firstChild;const d=t.firstChild;if(d){for(let m=0,y=0;m<d.childCount;m++){const{colspan:b,colwidth:v}=d.child(m).attrs;for(let x=0;x<b;x++,y++){const k=s==y?i:v&&v[x],E=k?k+"px":"";if(o+=k||r,k||(l=!1),u)u.style.width!=E&&(u.style.width=E),u=u.nextSibling;else{const M=document.createElement("col");M.style.width=E,e.appendChild(M)}}}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 ss=new yn("tableColumnResizing");function TQ({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=EQ,lastColumnResizable:s=!0}={}){const i=new Kt({key:ss,state:{init(o,l){var u;const d=(u=i.spec)===null||u===void 0||(u=u.props)===null||u===void 0?void 0:u.nodeViews,h=yr(l.schema).table.name;return r&&d&&(d[h]=(m,y)=>new r(m,n,y)),new NQ(-1,!1)},apply(o,l){return l.apply(o)}},props:{attributes:o=>{const l=ss.getState(o);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,l)=>{MQ(o,l,t,s)},mouseleave:o=>{_Q(o)},mousedown:(o,l)=>{AQ(o,l,e,n)}},decorations:o=>{const l=ss.getState(o);if(l&&l.activeHandle>-1)return IQ(o,l.activeHandle)},nodeViews:{}}});return i}var NQ=class jm{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(ss);if(r&&r.setHandle!=null)return new jm(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new jm(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let s=e.mapping.map(n.activeHandle,-1);return lS(e.doc.resolve(s))||(s=-1),new jm(s,n.dragging)}return n}};function MQ(t,e,n,r){if(!t.editable)return;const s=ss.getState(t.state);if(s&&!s.dragging){const i=OQ(e.target);let o=-1;if(i){const{left:l,right:u}=i.getBoundingClientRect();e.clientX-l<=n?o=NR(t,e,"left",n):u-e.clientX<=n&&(o=NR(t,e,"right",n))}if(o!=s.activeHandle){if(!r&&o!==-1){const l=t.state.doc.resolve(o),u=l.node(-1),d=gn.get(u),h=l.start(-1);if(d.colCount(l.pos-h)+l.nodeAfter.attrs.colspan-1==d.width-1)return}M2(t,o)}}}function _Q(t){if(!t.editable)return;const e=ss.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&M2(t,-1)}function AQ(t,e,n,r){var s;if(!t.editable)return!1;const i=(s=t.dom.ownerDocument.defaultView)!==null&&s!==void 0?s:window,o=ss.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const l=t.state.doc.nodeAt(o.activeHandle),u=RQ(t,o.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(ss,{setDragging:{startX:e.clientX,startWidth:u}}));function d(m){i.removeEventListener("mouseup",d),i.removeEventListener("mousemove",h);const y=ss.getState(t.state);y?.dragging&&(jQ(t,y.activeHandle,MR(y.dragging,m,n)),t.dispatch(t.state.tr.setMeta(ss,{setDragging:null})))}function h(m){if(!m.which)return d(m);const y=ss.getState(t.state);if(y&&y.dragging){const b=MR(y.dragging,m,n);_R(t,y.activeHandle,b,r)}}return _R(t,o.activeHandle,u,r),i.addEventListener("mouseup",d),i.addEventListener("mousemove",h),e.preventDefault(),!0}function RQ(t,e,{colspan:n,colwidth:r}){const s=r&&r[r.length-1];if(s)return s;const i=t.domAtPos(e);let o=i.node.childNodes[i.offset].offsetWidth,l=n;if(r)for(let u=0;u<n;u++)r[u]&&(o-=r[u],l--);return o/l}function OQ(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function NR(t,e,n,r){const s=n=="right"?-r:r,i=t.posAtCoords({left:e.clientX+s,top:e.clientY});if(!i)return-1;const{pos:o}=i,l=Il(t.state.doc.resolve(o));if(!l)return-1;if(n=="right")return l.pos;const u=gn.get(l.node(-1)),d=l.start(-1),h=u.map.indexOf(l.pos-d);return h%u.width==0?-1:d+u.map[h-1]}function MR(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function M2(t,e){t.dispatch(t.state.tr.setMeta(ss,{setHandle:e}))}function jQ(t,e,n){const r=t.state.doc.resolve(e),s=r.node(-1),i=gn.get(s),o=r.start(-1),l=i.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,u=t.state.tr;for(let d=0;d<i.height;d++){const h=d*i.width+l;if(d&&i.map[h]==i.map[h-i.width])continue;const m=i.map[h],y=s.nodeAt(m).attrs,b=y.colspan==1?0:l-i.colCount(m);if(y.colwidth&&y.colwidth[b]==n)continue;const v=y.colwidth?y.colwidth.slice():DQ(y.colspan);v[b]=n,u.setNodeMarkup(o+m,null,{...y,colwidth:v})}u.docChanged&&t.dispatch(u)}function _R(t,e,n,r){const s=t.state.doc.resolve(e),i=s.node(-1),o=s.start(-1),l=gn.get(i).colCount(s.pos-o)+s.nodeAfter.attrs.colspan-1;let u=t.domAtPos(s.start(-1)).node;for(;u&&u.nodeName!="TABLE";)u=u.parentNode;u&&uS(i,u.firstChild,u,r,l,n)}function DQ(t){return Array(t).fill(0)}function IQ(t,e){const n=[],r=t.doc.resolve(e),s=r.node(-1);if(!s)return Dt.empty;const i=gn.get(s),o=r.start(-1),l=i.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let d=0;d<i.height;d++){const h=l+d*i.width;if((l==i.width-1||i.map[h]!=i.map[h+1])&&(d==0||i.map[h]!=i.map[h-i.width])){var u;const m=i.map[h],y=o+m+s.nodeAt(m).nodeSize-1,b=document.createElement("div");b.className="column-resize-handle",!((u=ss.getState(t))===null||u===void 0)&&u.dragging&&n.push(Un.node(o+m,o+m+s.nodeAt(m).nodeSize,{class:"column-resize-dragging"})),n.push(Un.widget(y,b))}}return Dt.create(t.doc,n)}function LQ({allowTableNodeSelection:t=!1}={}){return new Kt({key:aa,state:{init(){return null},apply(e,n){const r=e.getMeta(aa);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:s,pos:i}=e.mapping.mapResult(n);return s?null:i}},props:{decorations:KJ,handleDOMEvents:{mousedown:CQ},createSelectionBetween(e){return aa.getState(e.state)!=null?e.state.selection:null},handleTripleClick:SQ,handleKeyDown:xQ,handlePaste:kQ},appendTransaction(e,n,r){return JJ(r,C2(r,n),t)}})}function Yg(t){return t==="left"||t==="right"||t==="center"?t:null}function PQ(t){const e=(t.style.textAlign||"").trim().toLowerCase(),n=(t.getAttribute("align")||"").trim().toLowerCase();return Yg(e||n)}function $Q(t){return Yg(t?.align)}function _2(){return{default:null,parseHTML:t=>PQ(t),renderHTML:t=>t.align?{style:`text-align: ${t.align}`}:{}}}function zQ(t){var e;const n=t.parentElement,r=t.closest("table");if(!n||!r)return null;const s=Array.from(n.children).indexOf(t),i=(e=r.querySelectorAll("colgroup > col")[s])==null?void 0:e.getAttribute("width");return i?[parseInt(i,10)]:null}function A2(t){const e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):zQ(t)}var BQ=/[ \t\r\n\f]+/g;function R2(t){var e;return t.children.length>0?!1:((e=t.textContent)!=null?e:"").replace(BQ,"")===""}function O2(t){const e=t.createAndFill();if(!e)throw new Error(`[tiptap error]: "${t.name}" has no default content to backfill.`);return e.content}var FQ=Gn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:A2},align:_2()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getAttrs:t=>R2(t)?{}:!1,getContent:(t,e)=>O2(e.nodes[this.name])},{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Yt(this.options.HTMLAttributes,t),0]}}),VQ=Gn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:A2},align:_2()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getAttrs:t=>R2(t)?{}:!1,getContent:(t,e)=>O2(e.nodes[this.name])},{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Yt(this.options.HTMLAttributes,t),0]}}),HQ=Gn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Yt(this.options.HTMLAttributes,t),0]}});function dS(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function AR(t,e,n,r,s,i){var o;let l=0,u=!0,d=e.firstChild;const h=t.firstChild;if(h!==null)for(let y=0,b=0;y<h.childCount;y+=1){const{colspan:v,colwidth:x}=h.child(y).attrs;for(let k=0;k<v;k+=1,b+=1){const E=s===b?i:x&&x[k],M=E?`${E}px`:"";if(l+=E||r,E||(u=!1),d){if(d.style.width!==M){const[_,N]=dS(r,E);d.style.setProperty(_,N)}d=d.nextSibling}else{const _=document.createElement("col"),[N,T]=dS(r,E);_.style.setProperty(N,T),e.appendChild(_)}}}for(;d;){const y=d.nextSibling;(o=d.parentNode)==null||o.removeChild(d),d=y}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 UQ=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[s,i]of Object.entries(r))i!=null&&(s==="style"?this.table.style.cssText=String(i):this.table.setAttribute(s,String(i)));t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),AR(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,AR(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 WQ(t,e,n,r){let s=0,i=!0;const o=[],l=t.firstChild;if(!l)return{};for(let m=0,y=0;m<l.childCount;m+=1){const{colspan:b,colwidth:v}=l.child(m).attrs;for(let x=0;x<b;x+=1,y+=1){const k=n===y?r:v&&v[x];s+=k||e,k||(i=!1);const[E,M]=dS(e,k);o.push(["col",{style:`${E}: ${M}`}])}}const u=i?`${s}px`:"",d=i?"":`${s}px`;return{colgroup:["colgroup",{},...o],tableWidth:u,tableMinWidth:d}}function RR(t,e){return t.createAndFill()}function qQ(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 GQ(t,e,n,r,s){const i=qQ(t),o=[],l=[];for(let d=0;d<n;d+=1){const h=RR(i.cell);if(h&&l.push(h),r){const m=RR(i.header_cell);m&&o.push(m)}}const u=[];for(let d=0;d<e;d+=1)u.push(i.row.createChecked(null,r&&d===0?o:l));return i.table.createChecked(null,u)}function YQ(t){return t instanceof Gt}var Xp=({editor:t})=>{const{selection:e}=t.state;if(!YQ(e))return!1;let n=0;const r=qL(e.ranges[0].$from,i=>i.type.name==="table");return r?.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},KQ="";function ZQ(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 s=n+r,i=!1;for(;s<t.length;){if(t[s]!=="`"){s+=1;continue}let o=0;for(;s+o<t.length&&t[s+o]==="`";)o+=1;if(o===r){const l=t.slice(n+r,s);e+=t.slice(n,n+r)+l.replace(new RegExp("(?<!\\\\)\\|","g"),"\\|")+t.slice(s,s+r),n=s+r,i=!0;break}s+=o}i||(e+=t.slice(n,n+r),n+=r)}return e}function XQ(t){return t.split(`
273
+ `).map(e=>!e.includes("|")||!e.includes("`")?e:ZQ(e)).join(`
274
+ `)}function JQ(t){return(t||"").replace(/\s+/g," ").trim()}function QQ(t,e,n={}){var r;const s=(r=n.cellLineSeparator)!=null?r:KQ;if(!t||!t.content||t.content.length===0)return"";const i=[];t.content.forEach(x=>{const k=[];x.content&&x.content.forEach(E=>{let M="";E.content&&Array.isArray(E.content)&&E.content.length>1?M=E.content.map(j=>e.renderChildren(j)).join(s):M=E.content?e.renderChildren(E.content):"";const _=JQ(M.split(s).join(`
275
+ `).replace(/[ \t]*\r?\n[ \t]*/g,"<br>")),N=E.type==="tableHeader",T=$Q(E.attrs);k.push({text:_,isHeader:N,align:T})}),i.push(k)});const o=i.reduce((x,k)=>Math.max(x,k.length),0);if(o===0)return"";const l=Array.from({length:o}).fill(0);i.forEach(x=>{var k;for(let E=0;E<o;E+=1){const _=(((k=x[E])==null?void 0:k.text)||"").length;_>l[E]&&(l[E]=_),l[E]<3&&(l[E]=3)}});const u=(x,k)=>x+" ".repeat(Math.max(0,k-x.length)),d=i[0],h=d.some(x=>x.isHeader),m=Array.from({length:o}).fill(null);i.forEach(x=>{var k;for(let E=0;E<o;E+=1)!m[E]&&((k=x[E])!=null&&k.align)&&(m[E]=x[E].align)});let y=`
276
+ `;const b=Array.from({length:o}).map((x,k)=>h&&d[k]&&d[k].text||"");return y+=`| ${b.map((x,k)=>u(x,l[k])).join(" | ")} |
277
+ `,y+=`| ${l.map((x,k)=>{const E=Math.max(3,x),M=m[k];return M==="left"?`:${"-".repeat(E)}`:M==="right"?`${"-".repeat(E)}:`:M==="center"?`:${"-".repeat(E)}:`:"-".repeat(E)}).join(" | ")} |
278
+ `,(h?i.slice(1):i).forEach(x=>{y+=`| ${Array.from({length:o}).fill(0).map((k,E)=>u(x[E]&&x[E].text||"",l[E])).join(" | ")} |
279
+ `}),y}var eee=QQ,tee=Gn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:UQ,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:s}=WQ(t,this.options.cellMinWidth),i=e.style;function o(){return i||(r?`width: ${r}`:`min-width: ${s}`)}const l=["table",Yt(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 s=[];t.header.forEach((i,o)=>{var l;const u=Yg((l=r[o])!=null?l:i.align),d=u?{align:u}:{};s.push(e.createNode("tableHeader",d,[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},s))}return t.rows&&t.rows.forEach(s=>{const i=[];s.forEach((o,l)=>{var u;const d=Yg((u=r[l])!=null?u:o.align),h=d?{align:d}:{};i.push(e.createNode("tableCell",h,[{type:"paragraph",content:e.parseInline(o.tokens)}]))}),n.push(e.createNode("tableRow",{},i))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>eee(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
+ `),s=r>=0?t.slice(0,r):t,i=s.split(`
283
+ `);if(i.length<2)return;const o=i[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(o)||!o.includes("|"))return;const l=XQ(s);if(l===s)return;const d=n.blockTokens(l)[0];if(d?.type!=="table"||!d.raw)return;const h=d.raw.split(`
284
+ `).length,m=t.split(`
285
+ `).slice(0,h).join(`
286
+ `);return{...d,raw:m}}},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:s,editor:i})=>{const o=GQ(i.schema,t,e,n);if(s){const l=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(Ue.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>tQ(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>nQ(t,e),deleteColumn:()=>({state:t,dispatch:e})=>sQ(t,e),addRowBefore:()=>({state:t,dispatch:e})=>oQ(t,e),addRowAfter:()=>({state:t,dispatch:e})=>aQ(t,e),deleteRow:()=>({state:t,dispatch:e})=>cQ(t,e),deleteTable:()=>({state:t,dispatch:e})=>gQ(t,e),mergeCells:()=>({state:t,dispatch:e})=>vR(t,e),splitCell:()=>({state:t,dispatch:e})=>wR(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Lf("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Lf("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>pQ(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>vR(t,e)?!0:wR(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>fQ(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>SR(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>SR(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&C2(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Gt.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:Xp,"Mod-Backspace":Xp,Delete:Xp,"Mod-Delete":Xp}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[TQ({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],LQ({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:s})=>{const i=Yt(this.options.HTMLAttributes,s);return new e(n,this.options.cellMinWidth,r,i)}},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Tt(Be(t,"tableRole",e))}}}),nee=rn.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(tee.configure(this.options.table)),this.options.tableCell!==!1&&t.push(FQ.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(VQ.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(HQ.configure(this.options.tableRow)),t}});function OR(t,e){t&&(typeof t=="function"?t(e):t.current=e)}function dr({active:t,disabled:e,title:n,onClick:r,children:s}){return p.jsx("button",{type:"button",className:"vertebr-md-btn","data-active":t||void 0,disabled:e,title:n,onMouseDown:i=>i.preventDefault(),onClick:r,children:s})}function j2({id:t,name:e,value:n,readOnly:r,placeholder:s="Write a description…",recordImages:i,galleryUpload:o,onListGallery:l,onUploadGallery:u,onBlur:d,onChange:h,inputRef:m,onOpenDocumentView:y}){const b=typeof n=="string"?n:"",v=C.useRef(h),x=C.useRef(d),k=C.useRef(b),[E,M]=C.useState(!1);v.current=h,x.current=d;const _=aK({immediatelyRender:!1,shouldRerenderOnTransaction:!1,content:b,contentType:"markdown",editable:!r,extensions:[DX.configure({heading:{levels:[2,3]},underline:!1,link:{openOnClick:!1,defaultProtocol:"https"}}),zJ.configure({inline:!1,allowBase64:!1}),nee.configure({table:{resizable:!1}}),TX.configure({placeholder:s}),LJ.configure({markedOptions:{gfm:!0}})],editorProps:{attributes:{id:t,class:"vertebr-md-content"}},onUpdate:({editor:O})=>{const G=O.getMarkdown();k.current=G,v.current(G)},onBlur:()=>{x.current?.()}});C.useEffect(()=>{if(_)return OR(m,_.view.dom),()=>OR(m,null)},[_,m]),C.useEffect(()=>{_&&_.setEditable(!r)},[_,r]),C.useEffect(()=>{if(_&&b!==k.current){if(b===_.getMarkdown()){k.current=b;return}_.commands.setContent(b,{contentType:"markdown",emitUpdate:!1}),k.current=b}},[_,b]);const N=kP({editor:_,selector:({editor:O})=>({bold:O?.isActive("bold")??!1,italic:O?.isActive("italic")??!1,strike:O?.isActive("strike")??!1,code:O?.isActive("code")??!1,codeBlock:O?.isActive("codeBlock")??!1,heading:O?.isActive("heading")??!1,quote:O?.isActive("blockquote")??!1,bullet:O?.isActive("bulletList")??!1,ordered:O?.isActive("orderedList")??!1,table:O?.isActive("table")??!1,link:O?.isActive("link")??!1,stats:yx(O?.getText()??b)})}),T=N?.stats??yx(b),A=r||!_,j=()=>{if(!_||r)return;const O=_.getAttributes("link").href,G=window.prompt("Link URL",typeof O=="string"&&O?O:"https://");if(G!==null){if(!G.trim()){_.chain().focus().extendMarkRange("link").unsetLink().run();return}_.chain().focus().extendMarkRange("link").setLink({href:G.trim()}).run()}},P=O=>{!_||O.length===0||(_.chain().focus().insertContent(O.map(G=>({type:"image",attrs:{src:G.url,alt:G.name}}))).run(),M(!1))};return p.jsxs("div",{className:"vertebr-field-prose",onKeyDown:O=>{(O.metaKey||O.ctrlKey)&&O.key.toLowerCase()==="k"&&(O.preventDefault(),j())},children:[e?p.jsx("input",{type:"hidden",name:e,value:b,readOnly:!0}):null,p.jsxs("div",{className:"vertebr-md-toolbar",role:"toolbar","aria-label":"Format",children:[p.jsx(dr,{active:N?.bold,disabled:A,title:"Bold",onClick:()=>_?.chain().focus().toggleBold().run(),children:p.jsx("span",{className:"vertebr-md-glyph",children:"B"})}),p.jsx(dr,{active:N?.italic,disabled:A,title:"Italic",onClick:()=>_?.chain().focus().toggleItalic().run(),children:p.jsx("span",{className:"vertebr-md-glyph vertebr-md-italic",children:"I"})}),p.jsx(dr,{active:N?.strike,disabled:A,title:"Strikethrough",onClick:()=>_?.chain().focus().toggleStrike().run(),children:p.jsx("span",{className:"vertebr-md-glyph vertebr-md-strike",children:"S"})}),p.jsx(dr,{active:N?.code,disabled:A,title:"Inline code",onClick:()=>_?.chain().focus().toggleCode().run(),children:"</>"}),p.jsx(dr,{active:N?.codeBlock,disabled:A,title:"Code block",onClick:()=>_?.chain().focus().toggleCodeBlock().run(),children:"{ }"}),p.jsx("span",{className:"vertebr-md-sep","aria-hidden":"true"}),p.jsx(dr,{active:N?.heading,disabled:A,title:"Heading",onClick:()=>_?.chain().focus().toggleHeading({level:2}).run(),children:"H"}),p.jsx(dr,{active:N?.quote,disabled:A,title:"Quote",onClick:()=>_?.chain().focus().toggleBlockquote().run(),children:"“"}),p.jsx(dr,{active:N?.bullet,disabled:A,title:"Bulleted list",onClick:()=>_?.chain().focus().toggleBulletList().run(),children:"•"}),p.jsx(dr,{active:N?.ordered,disabled:A,title:"Numbered list",onClick:()=>_?.chain().focus().toggleOrderedList().run(),children:"1."}),p.jsx("span",{className:"vertebr-md-sep","aria-hidden":"true"}),p.jsx(dr,{active:N?.table,disabled:A,title:"Table",onClick:()=>_?.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),children:"Table"}),N?.table?p.jsxs(p.Fragment,{children:[p.jsx(dr,{disabled:A,title:"Add column",onClick:()=>_?.chain().focus().addColumnAfter().run(),children:"+Col"}),p.jsx(dr,{disabled:A,title:"Add row",onClick:()=>_?.chain().focus().addRowAfter().run(),children:"+Row"}),p.jsx(dr,{disabled:A,title:"Delete table",onClick:()=>_?.chain().focus().deleteTable().run(),children:"Del"})]}):null,p.jsx(dr,{active:N?.link,disabled:A,title:"Link",onClick:j,children:"Link"}),p.jsx(dr,{disabled:A,title:"Insert images",onClick:()=>M(!0),children:"Image"}),y?p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"vertebr-md-sep","aria-hidden":"true"}),p.jsx(dr,{disabled:!1,title:"Open document view",onClick:y,children:"Doc"})]}):null]}),p.jsx(SP,{editor:_}),p.jsxs("p",{className:"vertebr-field-prose-meta",children:["Markdown",p.jsx("span",{"aria-hidden":"true",children:" · "}),T.words," ",T.words===1?"word":"words",p.jsx("span",{"aria-hidden":"true",children:" · "}),T.characters," ",T.characters===1?"character":"characters",y?p.jsxs(p.Fragment,{children:[p.jsx("span",{"aria-hidden":"true",children:" · "}),p.jsx("button",{type:"button",className:"vertebr-md-doc-link",onClick:y,children:"Open in document view"})]}):null]}),E?p.jsx(pk,{recordImages:i,galleryUpload:o,onListGallery:l,onUploadGallery:u,onClose:()=>M(!1),onInsert:P}):null]})}function ree({id:t,label:e,value:n,readOnly:r,description:s,markdownBody:i,canPickFiles:o,canUpload:l,onChangeUrl:u,onOpenPicker:d,onUploadFiles:h,onEditMarkdown:m}){const y=C.useRef(null),[b,v]=C.useState(!1),[x,k]=C.useState(()=>!!n.trim()),E=n.trim(),M=!!E,_=!!(m&&i!==void 0),N=async T=>{if(!(!T?.length||!h||r)){v(!0);try{await h([...T]),k(!0)}finally{v(!1),y.current&&(y.current.value="")}}};return p.jsxs("div",{className:"vertebr-doc-attach",children:[p.jsxs("div",{className:"vertebr-doc-attach-card","data-has-file":M||void 0,children:[p.jsxs("div",{className:"vertebr-doc-attach-main",children:[p.jsx("div",{className:"vertebr-doc-attach-icon","aria-hidden":"true",children:"PDF"}),p.jsxs("div",{className:"vertebr-doc-attach-copy",children:[p.jsx("p",{className:"vertebr-doc-attach-title",children:M?LD(E):"No PDF attached"}),p.jsx("p",{className:"vertebr-doc-attach-hint",children:M?"Optional download for shoppers. Markdown remains the live policy.":s?.trim()||"Optional PDF download. Markdown remains the live policy."})]})]}),p.jsxs("div",{className:"vertebr-doc-attach-actions",children:[_?p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",onClick:m,children:"Edit document"}):null,o&&!r?p.jsx("button",{type:"button",className:"vertebr-btn",onClick:d,disabled:b,children:"Choose PDF"}):null,l&&!r?p.jsxs(p.Fragment,{children:[p.jsx("button",{type:"button",className:"vertebr-btn",disabled:b,onClick:()=>y.current?.click(),children:b?"Uploading…":"Upload"}),p.jsx("input",{ref:y,type:"file",accept:"application/pdf,.pdf",hidden:!0,onChange:T=>{N(T.target.files)}})]}):null,M?p.jsx("a",{className:"vertebr-btn",href:E,target:"_blank",rel:"noreferrer",children:"Open"}):null,M&&!r?p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>{u(""),k(!1)},children:"Remove"}):null]})]}),r?M?p.jsxs("label",{className:"vertebr-doc-attach-url",htmlFor:t,children:[p.jsxs("span",{children:[e," URL"]}),p.jsx("input",{id:t,type:"url",readOnly:!0,value:n})]}):null:x?p.jsxs("label",{className:"vertebr-doc-attach-url",htmlFor:t,children:[p.jsxs("span",{children:[e," URL"]}),p.jsx("input",{id:t,type:"url",placeholder:"https://…/policy.pdf",value:n,onChange:T=>u(T.target.value)})]}):p.jsx("button",{type:"button",className:"vertebr-doc-attach-url-toggle",onClick:()=>k(!0),children:"Paste PDF URL"})]})}function see({title:t="Policy document",value:e,readOnly:n,recordImages:r,galleryUpload:s,onListGallery:i,onUploadGallery:o,onChange:l,onClose:u}){const[d,h]=C.useState(e),m=yx(d);C.useEffect(()=>{h(e)},[e]),C.useEffect(()=>{const b=x=>{x.key==="Escape"&&u()};window.addEventListener("keydown",b);const v=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",b),document.body.style.overflow=v}},[u]);const y=()=>{l(d),u()};return Ia.createPortal(p.jsx("div",{className:"vertebr-modal-backdrop vertebr-doc-modal-backdrop",role:"presentation",onClick:u,children:p.jsxs("div",{className:"vertebr-modal vertebr-doc-modal",role:"dialog","aria-modal":"true","aria-label":t,onClick:b=>b.stopPropagation(),children:[p.jsxs("header",{className:"vertebr-modal-head",children:[p.jsxs("div",{className:"vertebr-modal-heading",children:[p.jsx("p",{className:"vertebr-modal-eyebrow",children:"Document"}),p.jsx("h2",{children:t})]}),p.jsxs("div",{className:"vertebr-doc-modal-actions",children:[p.jsxs("span",{className:"vertebr-doc-modal-stats",children:[m.words," words · ",m.characters," characters"]}),n?null:p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",onClick:y,children:"Done"}),p.jsx("button",{type:"button",className:"vertebr-btn",onClick:u,children:"Close"})]})]}),p.jsx("div",{className:"vertebr-modal-body vertebr-doc-modal-body",children:p.jsx("div",{className:"vertebr-doc-page",children:p.jsx(j2,{id:"vertebr-doc-modal-editor",value:d,readOnly:n,placeholder:"Write the policy…",recordImages:r,galleryUpload:s,onListGallery:i,onUploadGallery:o,onChange:h})})})]})}),document.body)}var iee=Object.defineProperty,oee=(t,e)=>iee(t,"name",{value:e,configurable:!0});function bi(t){const e=C.useRef(t);return C.useEffect(()=>{e.current=t}),C.useMemo(()=>((...n)=>e.current?.(...n)),[])}oee(bi,"useCallbackRef");var aee=Object.defineProperty,Vn=(t,e)=>aee(t,"name",{value:e,configurable:!0}),fS="dismissableLayer.update",lee="dismissableLayer.pointerDownOutside",cee="dismissableLayer.focusOutside",jR,D2=C.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),I2=C.forwardRef(Vn(function(e,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:s=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:l,onInteractOutside:u,onDismiss:d,...h}=e,m=C.useContext(D2),[y,b]=C.useState(null),v=y?.ownerDocument??globalThis?.document,[,x]=C.useState({}),k=cn(n,b),E=Array.from(m.layers),[M]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),_=M?E.indexOf(M):-1,N=y?E.indexOf(y):-1,T=m.layersWithOutsidePointerEventsDisabled.size>0,A=N>=_,j=C.useRef(!1),P=L2(W=>{o?.(W),u?.(W),W.defaultPrevented||d?.()},{ownerDocument:v,deferPointerDownOutside:s,isDeferredPointerDownOutsideRef:j,dismissableSurfaces:m.dismissableSurfaces,shouldHandlePointerDownOutside:C.useCallback(W=>{if(!(W instanceof Node))return!1;const K=[...m.branches].some(Q=>Q.contains(W));return A&&!K},[m.branches,A])}),O=P2(W=>{if(s&&j.current)return;const K=W.target;[...m.branches].some(ee=>ee.contains(K))||(l?.(W),u?.(W),W.defaultPrevented||d?.())},v),G=y?N===E.length-1:!1,B=bi(W=>{W.key==="Escape"&&(i?.(W),!W.defaultPrevented&&d&&(W.preventDefault(),d()))});return C.useEffect(()=>{if(G)return v.addEventListener("keydown",B,{capture:!0}),()=>v.removeEventListener("keydown",B,{capture:!0})},[v,G,B]),C.useEffect(()=>{if(y)return r&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(jR=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(y)),m.layers.add(y),hS(),()=>{r&&(m.layersWithOutsidePointerEventsDisabled.delete(y),m.layersWithOutsidePointerEventsDisabled.size===0&&(v.body.style.pointerEvents=jR))}},[y,v,r,m]),C.useEffect(()=>()=>{y&&(m.layers.delete(y),m.layersWithOutsidePointerEventsDisabled.delete(y),hS())},[y,m]),C.useEffect(()=>{const W=Vn(()=>x({}),"handleUpdate");return document.addEventListener(fS,W),()=>document.removeEventListener(fS,W)},[]),p.jsx(zn.div,{...h,ref:k,style:{pointerEvents:T?A?"auto":"none":void 0,...e.style},onFocusCapture:tn(e.onFocusCapture,O.onFocusCapture),onBlurCapture:tn(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:tn(e.onPointerDownCapture,P.onPointerDownCapture)})},"DismissableLayer"));function uee(){const t=C.useContext(D2),[e,n]=C.useState(null);return C.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}Vn(uee,"useDismissableLayerSurface");var dee=Vn(()=>!0,"IS_TRUE");function L2(t,e){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:i,shouldHandlePointerDownOutside:o=dee}=e,l=bi(t),u=C.useRef(!1),d=C.useRef(!1),h=C.useRef(new Map),m=C.useRef(()=>{});return C.useEffect(()=>{function y(){d.current=!1,s.current=!1,h.current.clear()}Vn(y,"resetOutsideInteraction");function b(){return Array.from(h.current.values()).some(Boolean)}Vn(b,"isOutsideInteractionIntercepted");function v(_){if(!d.current)return;const N=_.target;N instanceof Node&&[...i].some(A=>A.contains(N))||h.current.set(_.type,!0),_.type==="click"&&window.setTimeout(()=>{d.current&&m.current()},0)}Vn(v,"handleInteractionCapture");function x(_){d.current&&h.current.set(_.type,!1)}Vn(x,"handleInteractionBubble");const k=Vn(_=>{if(_.target&&!u.current){let N=function(){n.removeEventListener("click",m.current);const A=b();y(),A||xC(lee,l,T,{discrete:!0})};if(Vn(N,"handleAndDispatchPointerDownOutsideEvent"),!o(_.target)){n.removeEventListener("click",m.current),y(),u.current=!1;return}const T={originalEvent:_};d.current=!0,s.current=r&&_.button===0,h.current.clear(),!r||_.button!==0?N():(n.removeEventListener("click",m.current),m.current=N,n.addEventListener("click",m.current,{once:!0}))}else n.removeEventListener("click",m.current),y();u.current=!1},"handlePointerDown"),E=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const _ of E)n.addEventListener(_,v,!0),n.addEventListener(_,x);const M=window.setTimeout(()=>{n.addEventListener("pointerdown",k)},0);return()=>{window.clearTimeout(M),n.removeEventListener("pointerdown",k),n.removeEventListener("click",m.current);for(const _ of E)n.removeEventListener(_,v,!0),n.removeEventListener(_,x)}},[n,l,r,s,i,o]),{onPointerDownCapture:Vn(()=>u.current=!0,"onPointerDownCapture")}}Vn(L2,"usePointerDownOutside");function P2(t,e=globalThis?.document){const n=bi(t),r=C.useRef(!1);return C.useEffect(()=>{const s=Vn(i=>{i.target&&!r.current&&xC(cee,n,{originalEvent:i},{discrete:!1})},"handleFocus");return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,n]),{onFocusCapture:Vn(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Vn(()=>r.current=!1,"onBlurCapture")}}Vn(P2,"useFocusOutside");function hS(){const t=new CustomEvent(fS);document.dispatchEvent(t)}Vn(hS,"dispatchUpdate");function xC(t,e,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?HD(s,i):s.dispatchEvent(i)}Vn(xC,"handleAndDispatchCustomEvent");var fee=Object.defineProperty,SC=(t,e)=>fee(t,"name",{value:e,configurable:!0}),Jp=0,Rc=null;function hee(t){return Iy(),t.children}SC(hee,"FocusGuards");function Iy(){C.useEffect(()=>{Rc||(Rc={start:pS(),end:pS()});const{start:t,end:e}=Rc;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),Jp++,()=>{Jp===1&&(Rc?.start.remove(),Rc?.end.remove(),Rc=null),Jp=Math.max(0,Jp-1)}},[])}SC(Iy,"useFocusGuards");function pS(){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}SC(pS,"createFocusGuard");var pee=Object.defineProperty,Cr=(t,e)=>pee(t,"name",{value:e,configurable:!0}),gw="focusScope.autoFocusOnMount",yw="focusScope.autoFocusOnUnmount",DR={bubbles:!1,cancelable:!0},$2=C.forwardRef(Cr(function(e,n){const{loop:r=!1,trapped:s=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...l}=e,[u,d]=C.useState(null),h=bi(i),m=bi(o),y=C.useRef(null),b=cn(n,d),v=C.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;C.useEffect(()=>{if(s){let k=function(N){if(v.paused||!u)return;const T=N.target;u.contains(T)?y.current=T:Ki(y.current,{select:!0})},E=function(N){if(v.paused||!u)return;const T=N.relatedTarget;T!==null&&(u.contains(T)||Ki(y.current,{select:!0}))},M=function(N){if(document.activeElement===document.body)for(const A of N)A.removedNodes.length>0&&Ki(u)};Cr(k,"handleFocusIn"),Cr(E,"handleFocusOut"),Cr(M,"handleMutations"),document.addEventListener("focusin",k),document.addEventListener("focusout",E);const _=new MutationObserver(M);return u&&_.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",k),document.removeEventListener("focusout",E),_.disconnect()}}},[s,u,v.paused]),C.useEffect(()=>{if(u){IR.add(v);const k=document.activeElement;if(!u.contains(k)){const M=new CustomEvent(gw,DR);u.addEventListener(gw,h),u.dispatchEvent(M),M.defaultPrevented||(z2(U2(kC(u)),{select:!0}),document.activeElement===k&&Ki(u))}return()=>{u.removeEventListener(gw,h),setTimeout(()=>{const M=new CustomEvent(yw,DR);u.addEventListener(yw,m),u.dispatchEvent(M),M.defaultPrevented||Ki(k??document.body,{select:!0}),u.removeEventListener(yw,m),IR.remove(v)},0)}}},[u,h,m,v]);const x=C.useCallback(k=>{if(!r&&!s||v.paused)return;const E=k.key==="Tab"&&!k.altKey&&!k.ctrlKey&&!k.metaKey,M=document.activeElement;if(E&&M){const _=k.currentTarget,[N,T]=B2(_);N&&T?!k.shiftKey&&M===T?(k.preventDefault(),r&&Ki(N,{select:!0})):k.shiftKey&&M===N&&(k.preventDefault(),r&&Ki(T,{select:!0})):M===_&&k.preventDefault()}},[r,s,v.paused]);return p.jsx(zn.div,{tabIndex:-1,...l,ref:b,onKeyDown:x})},"FocusScope"));function z2(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Ki(r,{select:e}),document.activeElement!==n)return}Cr(z2,"focusFirst");function B2(t){const e=kC(t),n=mS(e,t),r=mS(e.reverse(),t);return[n,r]}Cr(B2,"getTabbableEdges");function kC(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:Cr(r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)e.push(n.currentNode);return e}Cr(kC,"getTabbableCandidates");function mS(t,e){const n=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(const r of t)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):F2(r,{upTo:e})))return r}Cr(mS,"findVisible");function F2(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}Cr(F2,"isHidden");function V2(t){return t instanceof HTMLInputElement&&"select"in t}Cr(V2,"isSelectableInput");function Ki(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&V2(t)&&e&&t.select()}}Cr(Ki,"focus");var IR=H2();function H2(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=gS(t,e),t.unshift(e)},remove(e){t=gS(t,e),t[0]?.resume()}}}Cr(H2,"createFocusScopesStack");function gS(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}Cr(gS,"arrayRemove");function U2(t){return t.filter(e=>e.tagName!=="A")}Cr(U2,"removeLinks");var mee=Object.defineProperty,gee=(t,e)=>mee(t,"name",{value:e,configurable:!0}),yee=Uf[" useId ".trim().toString()]||(()=>{}),bee=0;function Ly(t){const[e,n]=C.useState(yee());return Er(()=>{t||n(r=>r??String(bee++))},[t]),t||(e?`radix-${e}`:"")}gee(Ly,"useId");const vee=["top","right","bottom","left"],Aa=Math.min,fo=Math.max,Kg=Math.round,Qp=Math.floor,ho=t=>({x:t,y:t}),wee={left:"right",right:"left",bottom:"top",top:"bottom"};function W2(t,e,n){return fo(t,Aa(e,n))}function yo(t,e){return typeof t=="function"?t(e):t}function Ra(t){return t.split("-")[0]}function Nu(t){return t.split("-")[1]}function CC(t){return t==="x"?"y":"x"}function EC(t){return t==="y"?"height":"width"}function hi(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function TC(t){return CC(hi(t))}function xee(t,e,n){n===void 0&&(n=!1);const r=Nu(t),s=TC(t),i=EC(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=Zg(o)),[o,Zg(o)]}function See(t){const e=Zg(t);return[yS(t),e,yS(e)]}function yS(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const LR=["left","right"],PR=["right","left"],kee=["top","bottom"],Cee=["bottom","top"];function Eee(t,e,n){switch(t){case"top":case"bottom":return n?e?PR:LR:e?LR:PR;case"left":case"right":return e?kee:Cee;default:return[]}}function Tee(t,e,n,r){const s=Nu(t);let i=Eee(Ra(t),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),e&&(i=i.concat(i.map(yS)))),i}function Zg(t){const e=Ra(t);return wee[e]+t.slice(e.length)}function Nee(t){var e,n,r,s;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(r=t.bottom)!=null?r:0,left:(s=t.left)!=null?s:0}}function q2(t){return typeof t!="number"?Nee(t):{top:t,right:t,bottom:t,left:t}}function Xg(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function $R(t,e,n){let{reference:r,floating:s}=t;const i=hi(e),o=TC(e),l=EC(o),u=Ra(e),d=i==="y",h=r.x+r.width/2-s.width/2,m=r.y+r.height/2-s.height/2,y=r[l]/2-s[l]/2;let b;switch(u){case"top":b={x:h,y:r.y-s.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-s.width,y:m};break;default:b={x:r.x,y:r.y}}const v=Nu(e);return v&&(b[o]+=y*(v==="end"?1:-1)*(n&&d?-1:1)),b}async function Mee(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:i,rects:o,elements:l,strategy:u}=t,{boundary:d="clippingAncestors",rootBoundary:h="viewport",elementContext:m="floating",altBoundary:y=!1,padding:b=0}=yo(e,t),v=q2(b),k=l[y?m==="floating"?"reference":"floating":m],E=Xg(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(k)))==null||n?k:k.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:d,rootBoundary:h,strategy:u})),M=m==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),N=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},T=Xg(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:M,offsetParent:_,strategy:u}):M);return{top:(E.top-T.top+v.top)/N.y,bottom:(T.bottom-E.bottom+v.bottom)/N.y,left:(E.left-T.left+v.left)/N.x,right:(T.right-E.right+v.right)/N.x}}const _ee=50,Aee=async(t,e,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:Mee},u=await(o.isRTL==null?void 0:o.isRTL(e));let d=await o.getElementRects({reference:t,floating:e,strategy:s}),{x:h,y:m}=$R(d,r,u),y=r,b=0;const v={};for(let x=0;x<i.length;x++){const k=i[x];if(!k)continue;const{name:E,fn:M}=k,{x:_,y:N,data:T,reset:A}=await M({x:h,y:m,initialPlacement:r,placement:y,strategy:s,middlewareData:v,rects:d,platform:l,elements:{reference:t,floating:e}});h=_??h,m=N??m,v[E]={...v[E],...T},A&&b<_ee&&(b++,typeof A=="object"&&(A.placement&&(y=A.placement),A.rects&&(d=A.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:s}):A.rects),{x:h,y:m}=$R(d,y,u)),x=-1)}return{x:h,y:m,placement:y,strategy:s,middlewareData:v}},Ree=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:s,rects:i,platform:o,elements:l,middlewareData:u}=e,{element:d,padding:h=0}=yo(t,e)||{};if(d==null)return{};const m=q2(h),y={x:n,y:r},b=TC(s),v=EC(b),x=await o.getDimensions(d),k=b==="y",E=k?"top":"left",M=k?"bottom":"right",_=k?"clientHeight":"clientWidth",N=i.reference[v]+i.reference[b]-y[b]-i.floating[v],T=y[b]-i.reference[b],A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let j=A?A[_]:0;(!j||!await(o.isElement==null?void 0:o.isElement(A)))&&(j=l.floating[_]||i.floating[v]);const P=N/2-T/2,O=j/2-x[v]/2-1,G=Aa(m[E],O),B=Aa(m[M],O),W=j-x[v]-B,K=j/2-x[v]/2+P,Q=W2(G,K,W),ee=!u.arrow&&Nu(s)!=null&&K!==Q&&i.reference[v]/2-(K<G?G:B)-x[v]/2<0,F=ee?K<G?K-G:K-W:0;return{[b]:y[b]+F,data:{[b]:Q,centerOffset:K-Q-F,...ee&&{alignmentOffset:F}},reset:ee}}}),Oee=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:l,platform:u,elements:d}=e,{mainAxis:h=!0,crossAxis:m=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:x=!0,...k}=yo(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const E=Ra(s),M=hi(l),_=Ra(l)===l,N=await(u.isRTL==null?void 0:u.isRTL(d.floating)),T=y||(_||!x?[Zg(l)]:See(l)),A=v!=="none";!y&&A&&T.push(...Tee(l,x,v,N));const j=[l,...T],P=await u.detectOverflow(e,k),O=[];let G=((r=i.flip)==null?void 0:r.overflows)||[];if(h&&O.push(P[E]),m){const Q=xee(s,o,N);O.push(P[Q[0]],P[Q[1]])}if(G=[...G,{placement:s,overflows:O}],!O.every(Q=>Q<=0)){var B,W;const Q=(((B=i.flip)==null?void 0:B.index)||0)+1,ee=j[Q];if(ee&&(!(m==="alignment"?M!==hi(ee):!1)||G.every(z=>hi(z.placement)===M?z.overflows[0]>0:!0)))return{data:{index:Q,overflows:G},reset:{placement:ee}};let F=(W=G.filter(I=>I.overflows[0]<=0).sort((I,z)=>I.overflows[1]-z.overflows[1])[0])==null?void 0:W.placement;if(!F)switch(b){case"bestFit":{var K;const I=(K=G.filter(z=>{if(A){const J=hi(z.placement);return J===M||J==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(J=>J>0).reduce((J,X)=>J+X,0)]).sort((z,J)=>z[1]-J[1])[0])==null?void 0:K[0];I&&(F=I);break}case"initialPlacement":F=l;break}if(s!==F)return{reset:{placement:F}}}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 BR(t){return vee.some(e=>t[e]>=0)}const jee=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:s="referenceHidden",...i}=yo(t,e);switch(s){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),l=zR(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:BR(l)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),l=zR(o,n.floating);return{data:{escapedOffsets:l,escaped:BR(l)}}}default:return{}}}}},G2=new Set(["left","top"]);async function Dee(t,e){const{placement:n,platform:r,elements:s}=t,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=Ra(n),l=Nu(n),u=hi(n)==="y",d=G2.has(o)?-1:1,h=i&&u?-1:1,m=yo(e,t);let{mainAxis:y,crossAxis:b,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return l&&typeof v=="number"&&(b=l==="end"?v*-1:v),u?{x:b*h,y:y*d}:{x:y*d,y:b*h}}const Iee=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:s,y:i,placement:o,middlewareData:l}=e,u=await Dee(e,t);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+u.x,y:i+u.y,data:{...u,placement:o}}}}},Lee=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s,platform:i}=e,{mainAxis:o=!0,crossAxis:l=!1,limiter:u={fn:M=>{let{x:_,y:N}=M;return{x:_,y:N}}},...d}=yo(t,e),h={x:n,y:r},m=await i.detectOverflow(e,d),y=hi(s),b=CC(y);let v=h[b],x=h[y];const k=(M,_)=>W2(_+m[M==="y"?"top":"left"],_,_-m[M==="y"?"bottom":"right"]);o&&(v=k(b,v)),l&&(x=k(y,x));const E=u.fn({...e,[b]:v,[y]:x});return{...E,data:{x:E.x-n,y:E.y-r,enabled:{[b]:o,[y]:l}}}}}},Pee=function(t){return t===void 0&&(t={}),{options:t,fn(e){var n,r;const{x:s,y:i,placement:o,rects:l,middlewareData:u}=e,{offset:d=0,mainAxis:h=!0,crossAxis:m=!0}=yo(t,e),y={x:s,y:i},b=hi(o),v=CC(b);let x=y[v],k=y[b];const E=yo(d,e),M=typeof E=="number"?{mainAxis:E,crossAxis:0}:{mainAxis:(n=E.mainAxis)!=null?n:0,crossAxis:(r=E.crossAxis)!=null?r:0};if(h){const T=v==="y"?"height":"width",A=l.reference[v]-l.floating[T]+M.mainAxis,j=l.reference[v]+l.reference[T]-M.mainAxis;x<A?x=A:x>j&&(x=j)}if(m){var _,N;const T=v==="y"?"width":"height",A=G2.has(Ra(o)),j=l.reference[b]-l.floating[T]+(A&&((_=u.offset)==null?void 0:_[b])||0)+(A?0:M.crossAxis),P=l.reference[b]+l.reference[T]+(A?0:((N=u.offset)==null?void 0:N[b])||0)-(A?M.crossAxis:0);k<j?k=j:k>P&&(k=P)}return{[v]:x,[b]:k}}}},$ee=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:r,platform:s,elements:i}=e,{apply:o=()=>{},...l}=yo(t,e),u=await s.detectOverflow(e,l),d=Ra(n),h=Nu(n),m=hi(n)==="y",{width:y,height:b}=r.floating;let v,x;d==="top"||d==="bottom"?(v=d,x=h===(await(s.isRTL==null?void 0:s.isRTL(i.floating))?"start":"end")?"left":"right"):(x=d,v=h==="end"?"top":"bottom");const k=b-u.top-u.bottom,E=y-u.left-u.right,M=Aa(b-u[v],k),_=Aa(y-u[x],E),N=e.middlewareData.shift,T=!N;let A=M,j=_;N!=null&&N.enabled.x&&(j=E),N!=null&&N.enabled.y&&(A=k),T&&!h&&(m?j=y-2*fo(u.left,u.right):A=b-2*fo(u.top,u.bottom)),await o({...e,availableWidth:j,availableHeight:A});const P=await s.getDimensions(i.floating);return y!==P.width||b!==P.height?{reset:{rects:!0}}:{}}}};function Py(){return typeof window<"u"}function Mu(t){return Y2(t)?(t.nodeName||"").toLowerCase():"#document"}function Fr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function xo(t){var e;return(e=(Y2(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Y2(t){return Py()?t instanceof Node||t instanceof Fr(t).Node:!1}function vi(t){return Py()?t instanceof Element||t instanceof Fr(t).Element:!1}function za(t){return Py()?t instanceof HTMLElement||t instanceof Fr(t).HTMLElement:!1}function FR(t){return!Py()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Fr(t).ShadowRoot}function $y(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=wi(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&s!=="inline"&&s!=="contents"}function zee(t){return/^(table|td|th)$/.test(Mu(t))}function zy(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const Bee=/transform|translate|scale|rotate|perspective|filter/,Fee=/paint|layout|strict|content/,ll=t=>!!t&&t!=="none";let bw;function NC(t){const e=vi(t)?wi(t):t;return ll(e.transform)||ll(e.translate)||ll(e.scale)||ll(e.rotate)||ll(e.perspective)||!MC()&&(ll(e.backdropFilter)||ll(e.filter))||Bee.test(e.willChange||"")||Fee.test(e.contain||"")}function Vee(t){let e=Pl(t);for(;za(e)&&!Pf(e);){if(NC(e))return e;if(zy(e))return null;e=Pl(e)}return null}function MC(){return bw==null&&(bw=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),bw}function Pf(t){return/^(html|body|#document)$/.test(Mu(t))}function wi(t){return Fr(t).getComputedStyle(t)}function By(t){return vi(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Pl(t){if(Mu(t)==="html")return t;const e=t.assignedSlot||t.parentNode||FR(t)&&t.host||xo(t);return FR(e)?e.host:e}function K2(t){const e=Pl(t);return Pf(e)?(t.ownerDocument||t).body:za(e)&&$y(e)?e:K2(e)}function $f(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=K2(t),i=s===((r=t.ownerDocument)==null?void 0:r.body),o=Fr(s);if(i){const l=bS(o);return e.concat(o,o.visualViewport||[],$y(s)?s:[],l&&n?$f(l):[])}else return e.concat(s,$f(s,[],n))}function bS(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Z2(t){const e=wi(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=za(t),i=s?t.offsetWidth:n,o=s?t.offsetHeight:r,l=Kg(n)!==i||Kg(r)!==o;return l&&(n=i,r=o),{width:n,height:r,$:l}}function _C(t){return vi(t)?t:t.contextElement}function Jc(t){const e=_C(t);if(!za(e))return ho(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:i}=Z2(e);let o=(i?Kg(n.width):n.width)/r,l=(i?Kg(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const Hee=ho(0);function X2(t){const e=Fr(t);return!MC()||!e.visualViewport?Hee:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Uee(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===Fr(t)}function $l(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=_C(t);let o=ho(1);e&&(r?vi(r)&&(o=Jc(r)):o=Jc(t));const l=Uee(i,n,r)?X2(i):ho(0);let u=(s.left+l.x)/o.x,d=(s.top+l.y)/o.y,h=s.width/o.x,m=s.height/o.y;if(i&&r){const y=Fr(i),b=vi(r)?Fr(r):r;let v=y,x=bS(v);for(;x&&b!==v;){const k=Jc(x),E=x.getBoundingClientRect(),M=wi(x),_=E.left+(x.clientLeft+parseFloat(M.paddingLeft))*k.x,N=E.top+(x.clientTop+parseFloat(M.paddingTop))*k.y;u*=k.x,d*=k.y,h*=k.x,m*=k.y,u+=_,d+=N,v=Fr(x),x=bS(v)}}return Xg({width:h,height:m,x:u,y:d})}function Fy(t,e){const n=By(t).scrollLeft;return e?e.left+n:$l(xo(t)).left+n}function J2(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Fy(t,n),s=n.top+e.scrollTop;return{x:r,y:s}}function Wee(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const i=s==="fixed",o=xo(r),l=e?zy(e.floating):!1;if(r===o||l&&i)return n;let u={scrollLeft:0,scrollTop:0},d=ho(1);const h=ho(0),m=za(r);if((m||!i)&&((Mu(r)!=="body"||$y(o))&&(u=By(r)),m)){const b=$l(r);d=Jc(r),h.x=b.x+r.clientLeft,h.y=b.y+r.clientTop}const y=o&&!m&&!i?J2(o,u):ho(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-u.scrollLeft*d.x+h.x+y.x,y:n.y*d.y-u.scrollTop*d.y+h.y+y.y}}function qee(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function Gee(t){const e=By(t),n=t.ownerDocument.body,r=fo(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=fo(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-e.scrollLeft+Fy(t);const o=-e.scrollTop;return wi(n).direction==="rtl"&&(i+=fo(t.clientWidth,n.clientWidth)-r),{width:r,height:s,x:i,y:o}}const Yee=25;function Kee(t,e,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",s=Fr(t),i=xo(t),o=s.visualViewport;let l=i.clientWidth,u=i.clientHeight,d=0,h=0;if(o){const y=!MC()||e==="fixed";r?y||(d=-o.offsetLeft,h=-o.offsetTop):(l=o.width,u=o.height,y&&(d=o.offsetLeft,h=o.offsetTop))}if(Fy(i)<=0){const y=i.ownerDocument,b=y.body,v=getComputedStyle(b),x=y.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,k=Math.abs(i.clientWidth-b.clientWidth-x),E=getComputedStyle(i).scrollbarGutter==="stable both-edges"?k/2:k;E<=Yee&&(l-=E)}return{width:l,height:u,x:d,y:h}}function Zee(t,e){const n=$l(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,i=Jc(t),o=t.clientWidth*i.x,l=t.clientHeight*i.y,u=s*i.x,d=r*i.y;return{width:o,height:l,x:u,y:d}}function VR(t,e,n){let r;if(e==="viewport"||e==="layoutViewport")r=Kee(t,n,e);else if(e==="document")r=Gee(xo(t));else if(vi(e))r=Zee(e,n);else{const s=X2(t);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Xg(r)}function Xee(t,e){const n=e.get(t);if(n)return n;let r=$f(t,[],!1).filter(l=>vi(l)&&Mu(l)!=="body"),s=null;const i=wi(t).position==="fixed";let o=i?Pl(t):t;for(;vi(o)&&!Pf(o);){const l=wi(o),u=NC(o),d=s?s.position:i?"fixed":"";!u&&(d==="fixed"||d==="absolute"&&l.position==="static")?r=r.filter(m=>m!==o):s=l,o=Pl(o)}return e.set(t,r),r}function Jee(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const o=[...n==="clippingAncestors"?zy(e)?[]:Xee(e,this._c):[].concat(n),r],l=VR(e,o[0],s);let u=l.top,d=l.right,h=l.bottom,m=l.left;for(let y=1;y<o.length;y++){const b=VR(e,o[y],s);u=fo(b.top,u),d=Aa(b.right,d),h=Aa(b.bottom,h),m=fo(b.left,m)}return{width:d-m,height:h-u,x:m,y:u}}function Qee(t){const{width:e,height:n}=Z2(t);return{width:e,height:n}}function ete(t,e,n){const r=za(e),s=xo(e),i=n==="fixed",o=$l(t,!0,i,e);let l={scrollLeft:0,scrollTop:0};const u=ho(0);if((r||!i)&&((Mu(e)!=="body"||$y(s))&&(l=By(e)),r)){const y=$l(e,!0,i,e);u.x=y.x+e.clientLeft,u.y=y.y+e.clientTop}!r&&s&&(u.x=Fy(s));const d=s&&!r&&!i?J2(s,l):ho(0),h=o.left+l.scrollLeft-u.x-d.x,m=o.top+l.scrollTop-u.y-d.y;return{x:h,y:m,width:o.width,height:o.height}}function vw(t){return wi(t).position==="static"}function HR(t,e){if(!za(t)||wi(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return xo(t)===n&&(n=n.ownerDocument.body),n}function Q2(t,e){const n=Fr(t);if(zy(t))return n;if(!za(t)){let s=Pl(t);for(;s&&!Pf(s);){if(vi(s)&&!vw(s))return s;s=Pl(s)}return n}let r=HR(t,e);for(;r&&zee(r)&&vw(r);)r=HR(r,e);return r&&Pf(r)&&vw(r)&&!NC(r)?n:r||Vee(t)||n}const tte=async function(t){const e=this.getOffsetParent||Q2,n=this.getDimensions,r=await n(t.floating);return{reference:ete(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function nte(t){return wi(t).direction==="rtl"}const rte={convertOffsetParentRelativeRectToViewportRelativeRect:Wee,getDocumentElement:xo,getClippingRect:Jee,getOffsetParent:Q2,getElementRects:tte,getClientRects:qee,getDimensions:Qee,getScale:Jc,isElement:vi,isRTL:nte};function e$(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function ste(t,e,n){let r=null,s;const i=xo(t);function o(){var h;clearTimeout(s),(h=r)==null||h.disconnect(),r=null}function l(h,m){h===void 0&&(h=!1),m===void 0&&(m=1),o();const y=t.getBoundingClientRect(),{left:b,top:v,width:x,height:k}=y;if(h||e(),!x||!k)return;const E=Qp(v),M=Qp(i.clientWidth-(b+x)),_=Qp(i.clientHeight-(v+k)),N=Qp(b),A={rootMargin:-E+"px "+-M+"px "+-_+"px "+-N+"px",threshold:fo(0,Aa(1,m))||1};let j=!0;function P(O){const G=O[0].intersectionRatio;if(!e$(y,t.getBoundingClientRect()))return l();if(G!==m){if(!j)return l();G?l(!1,G):s=setTimeout(()=>{l(!1,1e-7)},1e3)}j=!1}try{r=new IntersectionObserver(P,{...A,root:i.ownerDocument})}catch{r=new IntersectionObserver(P,A)}r.observe(t)}const u=Fr(t),d=()=>l(n);return u.addEventListener("resize",d),l(!0),()=>{u.removeEventListener("resize",d),o()}}function ite(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,d=_C(t),h=s||i?[...d?$f(d):[],...e?$f(e):[]]:[];h.forEach(E=>{s&&E.addEventListener("scroll",n),i&&E.addEventListener("resize",n)});const m=d&&l?ste(d,n,i):null;let y=-1,b=null;o&&(b=new ResizeObserver(E=>{let[M]=E;M&&M.target===d&&b&&e&&(b.unobserve(e),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var _;(_=b)==null||_.observe(e)})),n()}),d&&!u&&b.observe(d),e&&b.observe(e));let v,x=u?$l(t):null;u&&k();function k(){const E=$l(t);x&&!e$(x,E)&&n(),x=E,v=requestAnimationFrame(k)}return n(),()=>{var E;h.forEach(M=>{s&&M.removeEventListener("scroll",n),i&&M.removeEventListener("resize",n)}),m?.(),(E=b)==null||E.disconnect(),b=null,u&&cancelAnimationFrame(v)}}const ote=Iee,ate=Lee,lte=Oee,cte=$ee,ute=jee,UR=Ree,dte=Pee,fte=(t,e,n)=>{const r=new Map,s=n??{},i={...rte,...s.platform,_c:r};return Aee(t,e,{...s,platform:i})};var hte=typeof document<"u",pte=function(){},Dm=hte?C.useLayoutEffect:pte;function Jg(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,s;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(!Jg(t[r],e[r]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&t.$$typeof)&&!Jg(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function t$(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function WR(t,e){const n=t$(t);return Math.round(e*n)/n}function ww(t){const e=C.useRef(t);return Dm(()=>{e.current=t}),e}function mte(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:u,open:d}=t,[h,m]=C.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[y,b]=C.useState(r);Jg(y,r)||b(r);const[v,x]=C.useState(null),[k,E]=C.useState(null),M=C.useCallback(z=>{z!==A.current&&(A.current=z,x(z))},[]),_=C.useCallback(z=>{z!==j.current&&(j.current=z,E(z))},[]),N=i||v,T=o||k,A=C.useRef(null),j=C.useRef(null),P=C.useRef(h),O=u!=null,G=ww(u),B=ww(s),W=ww(d),K=C.useCallback(()=>{if(!A.current||!j.current)return;const z={placement:e,strategy:n,middleware:y};B.current&&(z.platform=B.current),fte(A.current,j.current,z).then(J=>{const X={...J,isPositioned:W.current!==!1};Q.current&&!Jg(P.current,X)&&(P.current=X,Ia.flushSync(()=>{m(X)}))})},[y,e,n,B,W]);Dm(()=>{d===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,m(z=>({...z,isPositioned:!1})))},[d]);const Q=C.useRef(!1);Dm(()=>(Q.current=!0,()=>{Q.current=!1}),[]),Dm(()=>{if(N&&(A.current=N),T&&(j.current=T),N&&T){if(G.current)return G.current(N,T,K);K()}},[N,T,K,G,O]);const ee=C.useMemo(()=>({reference:A,floating:j,setReference:M,setFloating:_}),[M,_]),F=C.useMemo(()=>({reference:N,floating:T}),[N,T]),I=C.useMemo(()=>{const z={position:n,left:0,top:0};if(!F.floating)return z;const J=WR(F.floating,h.x),X=WR(F.floating,h.y);return l?{...z,transform:"translate("+J+"px, "+X+"px)",...t$(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:J,top:X}},[n,l,F.floating,h.x,h.y]);return C.useMemo(()=>({...h,update:K,refs:ee,elements:F,floatingStyles:I}),[h,K,ee,F,I])}const gte=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:s}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?UR({element:r.current,padding:s}).fn(n):{}:r?UR({element:r,padding:s}).fn(n):{}}}},yte=(t,e)=>{const n=ote(t);return{name:n.name,fn:n.fn,options:[t,e]}},bte=(t,e)=>{const n=ate(t);return{name:n.name,fn:n.fn,options:[t,e]}},vte=(t,e)=>({fn:dte(t).fn,options:[t,e]}),wte=(t,e)=>{const n=lte(t);return{name:n.name,fn:n.fn,options:[t,e]}},xte=(t,e)=>{const n=cte(t);return{name:n.name,fn:n.fn,options:[t,e]}},Ste=(t,e)=>{const n=ute(t);return{name:n.name,fn:n.fn,options:[t,e]}},kte=(t,e)=>{const n=gte(t);return{name:n.name,fn:n.fn,options:[t,e]}};var Cte=Object.defineProperty,Sa=(t,e)=>Cte(t,"name",{value:e,configurable:!0}),n$="Popper",[r$,Vy]=Hl(n$),[Ete,s$]=r$(n$),Tte=Sa(t=>{const{__scopePopper:e,children:n}=t,[r,s]=C.useState(null),[i,o]=C.useState(void 0);return p.jsx(Ete,{scope:e,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:o,children:n})},"Popper"),Nte="PopperAnchor",Mte=C.forwardRef(Sa(function(e,n){const{__scopePopper:r,virtualRef:s,...i}=e,o=s$(Nte,r),l=C.useRef(null),u=o.onAnchorChange,d=C.useCallback(x=>{l.current=x,x&&u(x)},[u]),h=cn(n,d),m=C.useRef(null);C.useEffect(()=>{if(!s)return;const x=m.current;m.current=s.current,x!==m.current&&u(m.current)});const y=o.placementState&&Hy(o.placementState),b=y?.[0],v=y?.[1];return s?null:p.jsx(zn.div,{"data-radix-popper-side":b,"data-radix-popper-align":v,...i,ref:h})},"PopperAnchor")),i$="PopperContent",[_te,uue]=r$(i$),Ate=C.forwardRef(Sa(function(e,n){const{__scopePopper:r,side:s="bottom",sideOffset:i=0,align:o="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:h=[],collisionPadding:m=0,sticky:y="partial",hideWhenDetached:b=!1,updatePositionStrategy:v="optimized",onPlaced:x,...k}=e,E=s$(i$,r),[M,_]=C.useState(null),N=cn(n,_),[T,A]=C.useState(null),j=gk(T),P=j?.width??0,O=j?.height??0,G=s+(o!=="center"?"-"+o:""),B=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},W=Array.isArray(h)?h:[h],K=W.length>0,Q={padding:B,boundary:W.filter(o$),altBoundary:K},{refs:ee,floatingStyles:F,placement:I,isPositioned:z,middlewareData:J}=mte({strategy:"fixed",placement:G,whileElementsMounted:Sa((...oe)=>ite(...oe,{animationFrame:v==="always"}),"whileElementsMounted"),elements:{reference:E.anchor},middleware:[yte({mainAxis:i+O,alignmentAxis:l}),d&&bte({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?vte():void 0,...Q}),d&&wte({...Q}),xte({...Q,apply:Sa(({elements:oe,rects:ye,availableWidth:Pe,availableHeight:Ye})=>{const{width:Ke,height:ut}=ye.reference,Xe=oe.floating.style;Xe.setProperty("--radix-popper-available-width",`${Pe}px`),Xe.setProperty("--radix-popper-available-height",`${Ye}px`),Xe.setProperty("--radix-popper-anchor-width",`${Ke}px`),Xe.setProperty("--radix-popper-anchor-height",`${ut}px`)},"apply")}),T&&kte({element:T,padding:u}),Rte({arrowWidth:P,arrowHeight:O}),b&&Ste({strategy:"referenceHidden",...Q,boundary:K?Q.boundary:void 0})]}),X=E.setPlacementState;Er(()=>(X(I),()=>{X(void 0)}),[I,X]);const[L,q]=Hy(I),ie=bi(x);Er(()=>{z&&ie?.()},[z,ie]);const de=J.arrow?.x,Te=J.arrow?.y,De=J.arrow?.centerOffset!==0,[je,Ne]=C.useState();return Er(()=>{M&&Ne(window.getComputedStyle(M).zIndex)},[M]),p.jsx("div",{ref:ee.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:z?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:je,"--radix-popper-transform-origin":[J.transformOrigin?.x,J.transformOrigin?.y].join(" "),...J.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(_te,{scope:r,placedSide:L,placedAlign:q,onArrowChange:A,arrowX:de,arrowY:Te,shouldHideArrow:De,children:p.jsx(zn.div,{"data-side":L,"data-align":q,...k,ref:N,style:{...k.style,animation:z?k.style?.animation:"none"}})})})},"PopperContent"));function o$(t){return t!==null}Sa(o$,"isNotNull");var Rte=Sa(t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:r,middlewareData:s}=e,o=s.arrow?.centerOffset!==0,l=o?0:t.arrowWidth,u=o?0:t.arrowHeight,[d,h]=Hy(n),m={start:"0%",center:"50%",end:"100%"}[h],y=(s.arrow?.x??0)+l/2,b=(s.arrow?.y??0)+u/2;let v="",x="";return d==="bottom"?(v=o?m:`${y}px`,x=`${-u}px`):d==="top"?(v=o?m:`${y}px`,x=`${r.floating.height+u}px`):d==="right"?(v=`${-u}px`,x=o?m:`${b}px`):d==="left"&&(v=`${r.floating.width+u}px`,x=o?m:`${b}px`),{data:{x:v,y:x}}}}),"transformOrigin");function Hy(t){const[e,n="center"]=t.split("-");return[e,n]}Sa(Hy,"getSideAndAlignFromPlacement");var a$=Tte,l$=Mte,c$=Ate,Ote=Object.defineProperty,jte=(t,e)=>Ote(t,"name",{value:e,configurable:!0}),u$=C.forwardRef(jte(function(e,n){const{container:r,...s}=e,[i,o]=C.useState(!1);Er(()=>o(!0),[]);const l=r||i&&globalThis?.document?.body;return l?Ia.createPortal(p.jsx(zn.div,{...s,ref:n}),l):null},"Portal")),Dte=Object.defineProperty,bo=(t,e)=>Dte(t,"name",{value:e,configurable:!0});function d$(t,e){return C.useReducer((n,r)=>e[n][r]??n,t)}bo(d$,"useStateMachine");var AC=bo(t=>{const{present:e,children:n}=t,r=f$(e),s=typeof n=="function"?n({present:r.isPresent}):C.Children.only(n),i=h$(r.ref,p$(s));return typeof n=="function"||r.isPresent?C.cloneElement(s,{ref:i}):null},"Presence");function f$(t){const[e,n]=C.useState(),r=C.useRef(null),s=C.useRef(t),i=C.useRef("none"),o=C.useRef(void 0),l=t?"mounted":"unmounted",[u,d]=d$(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return C.useEffect(()=>{u==="mounted"?(i.current=o.current??Wc(r.current),o.current=void 0):i.current="none"},[u]),Er(()=>{const h=r.current,m=s.current;if(m!==t){const b=i.current,v=Wc(h);t?(o.current=v,d("MOUNT")):v==="none"||h?.display==="none"?d("UNMOUNT"):d(m&&b!==v?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,d]),Er(()=>{if(e){let h;const m=e.ownerDocument.defaultView??window,y=bo(v=>{const k=Wc(r.current).includes(CSS.escape(v.animationName));if(v.target===e&&k&&(d("ANIMATION_END"),!s.current)){const E=e.style.animationFillMode;e.style.animationFillMode="forwards",h=m.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=E)})}},"handleAnimationEnd"),b=bo(v=>{v.target===e&&(i.current=Wc(r.current))},"handleAnimationStart");return e.addEventListener("animationstart",b),e.addEventListener("animationcancel",y),e.addEventListener("animationend",y),()=>{m.clearTimeout(h),e.removeEventListener("animationstart",b),e.removeEventListener("animationcancel",y),e.removeEventListener("animationend",y)}}else d("ANIMATION_END")},[e,d]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:C.useCallback(h=>{if(h){const m=getComputedStyle(h);r.current=m,o.current=Wc(m)}else r.current=null;n(h)},[])}}bo(f$,"usePresence");function vS(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}bo(vS,"setRef");function h$(...t){const e=C.useRef(t);return e.current=t,C.useCallback(n=>{const r=e.current;let s=!1;const i=r.map(o=>{const l=vS(o,n);return!s&&typeof l=="function"&&(s=!0),l});if(s)return()=>{for(let o=0;o<i.length;o++){const l=i[o];typeof l=="function"?l():vS(r[o],null)}}},[])}bo(h$,"useStableComposedRefs");function Wc(t){return t?.animationName||"none"}bo(Wc,"getAnimationName");function p$(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)}bo(p$,"getElementRef");var Ite=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Oc=new WeakMap,em=new WeakMap,tm={},xw=0,m$=function(t){return t&&(t.host||m$(t.parentNode))},Lte=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=m$(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})},Pte=function(t,e,n,r){var s=Lte(e,Array.isArray(t)?t:[t]);tm[n]||(tm[n]=new WeakMap);var i=tm[n],o=[],l=new Set,u=new Set(s),d=function(m){!m||l.has(m)||(l.add(m),d(m.parentNode))};s.forEach(d);var h=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(y){if(l.has(y))h(y);else try{var b=y.getAttribute(r),v=b!==null&&b!=="false",x=(Oc.get(y)||0)+1,k=(i.get(y)||0)+1;Oc.set(y,x),i.set(y,k),o.push(y),x===1&&v&&em.set(y,!0),k===1&&y.setAttribute(n,"true"),v||y.setAttribute(r,"true")}catch(E){console.error("aria-hidden: cannot operate on ",y,E)}})};return h(e),l.clear(),xw++,function(){o.forEach(function(m){var y=Oc.get(m)-1,b=i.get(m)-1;Oc.set(m,y),i.set(m,b),y||(em.has(m)||m.removeAttribute(r),em.delete(m)),b||m.removeAttribute(n)}),xw--,xw||(Oc=new WeakMap,Oc=new WeakMap,em=new WeakMap,tm={})}},g$=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),s=Ite(t);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Pte(r,s,n,"aria-hidden")):function(){return null}},fi=function(){return fi=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},fi.apply(this,arguments)};function y$(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 s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}function $te(t,e,n){if(n||arguments.length===2)for(var r=0,s=e.length,i;r<s;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}var Im="right-scroll-bar-position",Lm="width-before-scroll-bar",zte="with-scroll-bars-hidden",Bte="--removed-body-scroll-bar-size";function Sw(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function Fte(t,e){var n=C.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=e,n.facade}var Vte=typeof window<"u"?C.useLayoutEffect:C.useEffect,qR=new WeakMap;function Hte(t,e){var n=Fte(null,function(r){return t.forEach(function(s){return Sw(s,r)})});return Vte(function(){var r=qR.get(n);if(r){var s=new Set(r),i=new Set(t),o=n.current;s.forEach(function(l){i.has(l)||Sw(l,null)}),i.forEach(function(l){s.has(l)||Sw(l,o)})}qR.set(n,t)},[t]),n}function Ute(t){return t}function Wte(t,e){e===void 0&&(e=Ute);var n=[],r=!1,s={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(i){var o=e(i,r);return n.push(o),function(){n=n.filter(function(l){return l!==o})}},assignSyncMedium:function(i){for(r=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var o=[];if(n.length){var l=n;n=[],l.forEach(i),o=n}var u=function(){var h=o;o=[],h.forEach(i)},d=function(){return Promise.resolve().then(u)};d(),n={push:function(h){o.push(h),d()},filter:function(h){return o=o.filter(h),n}}}};return s}function qte(t){t===void 0&&(t={});var e=Wte(null);return e.options=fi({async:!0,ssr:!1},t),e}var b$=function(t){var e=t.sideCar,n=y$(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 C.createElement(r,fi({},n))};b$.isSideCarExport=!0;function Gte(t,e){return t.useMedium(e),b$}var v$=qte(),kw=function(){},Uy=C.forwardRef(function(t,e){var n=C.useRef(null),r=C.useState({onScrollCapture:kw,onWheelCapture:kw,onTouchMoveCapture:kw}),s=r[0],i=r[1],o=t.forwardProps,l=t.children,u=t.className,d=t.removeScrollBar,h=t.enabled,m=t.shards,y=t.sideCar,b=t.noRelative,v=t.noIsolation,x=t.inert,k=t.allowPinchZoom,E=t.as,M=E===void 0?"div":E,_=t.gapMode,N=y$(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=y,A=Hte([n,e]),j=fi(fi({},N),s);return C.createElement(C.Fragment,null,h&&C.createElement(T,{sideCar:v$,removeScrollBar:d,shards:m,noRelative:b,noIsolation:v,inert:x,setCallbacks:i,allowPinchZoom:!!k,lockRef:n,gapMode:_}),o?C.cloneElement(C.Children.only(l),fi(fi({},j),{ref:A})):C.createElement(M,fi({},j,{className:u,ref:A}),l))});Uy.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Uy.classNames={fullWidth:Lm,zeroRight:Im};var Yte=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Kte(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=Yte();return e&&t.setAttribute("nonce",e),t}function Zte(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function Xte(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var Jte=function(){var t=0,e=null;return{add:function(n){t==0&&(e=Kte())&&(Zte(e,n),Xte(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},Qte=function(){var t=Jte();return function(e,n){C.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},w$=function(){var t=Qte(),e=function(n){var r=n.styles,s=n.dynamic;return t(r,s),null};return e},ene={left:0,top:0,right:0,gap:0},Cw=function(t){return parseInt(t||"",10)||0},tne=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],s=e[t==="padding"?"paddingRight":"marginRight"];return[Cw(n),Cw(r),Cw(s)]},nne=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return ene;var e=tne(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])}},rne=w$(),Qc="data-scroll-locked",sne=function(t,e,n,r){var s=t.left,i=t.top,o=t.right,l=t.gap;return n===void 0&&(n="margin"),`
287
+ .`.concat(zte,` {
288
+ overflow: hidden `).concat(r,`;
289
+ padding-right: `).concat(l,"px ").concat(r,`;
290
+ }
291
+ body[`).concat(Qc,`] {
292
+ overflow: hidden `).concat(r,`;
293
+ overscroll-behavior: contain;
294
+ `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
295
+ padding-left: `.concat(s,`px;
296
+ padding-top: `).concat(i,`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(Im,` {
305
+ right: `).concat(l,"px ").concat(r,`;
306
+ }
307
+
308
+ .`).concat(Lm,` {
309
+ margin-right: `).concat(l,"px ").concat(r,`;
310
+ }
311
+
312
+ .`).concat(Im," .").concat(Im,` {
313
+ right: 0 `).concat(r,`;
314
+ }
315
+
316
+ .`).concat(Lm," .").concat(Lm,` {
317
+ margin-right: 0 `).concat(r,`;
318
+ }
319
+
320
+ body[`).concat(Qc,`] {
321
+ `).concat(Bte,": ").concat(l,`px;
322
+ }
323
+ `)},GR=function(){var t=parseInt(document.body.getAttribute(Qc)||"0",10);return isFinite(t)?t:0},ine=function(){C.useEffect(function(){return document.body.setAttribute(Qc,(GR()+1).toString()),function(){var t=GR()-1;t<=0?document.body.removeAttribute(Qc):document.body.setAttribute(Qc,t.toString())}},[])},one=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,s=r===void 0?"margin":r;ine();var i=C.useMemo(function(){return nne(s)},[s]);return C.createElement(rne,{styles:sne(i,!e,s,n?"":"!important")})},wS=!1;if(typeof window<"u")try{var nm=Object.defineProperty({},"passive",{get:function(){return wS=!0,!0}});window.addEventListener("test",nm,nm),window.removeEventListener("test",nm,nm)}catch{wS=!1}var jc=wS?{passive:!1}:!1,ane=function(t){return t.tagName==="TEXTAREA"},x$=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!ane(t)&&n[e]==="visible")},lne=function(t){return x$(t,"overflowY")},cne=function(t){return x$(t,"overflowX")},YR=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=S$(t,r);if(s){var i=k$(t,r),o=i[1],l=i[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},une=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},dne=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},S$=function(t,e){return t==="v"?lne(e):cne(e)},k$=function(t,e){return t==="v"?une(e):dne(e)},fne=function(t,e){return t==="h"&&e==="rtl"?-1:1},hne=function(t,e,n,r,s){var i=fne(t,window.getComputedStyle(e).direction),o=i*r,l=n.target,u=e.contains(l),d=!1,h=o>0,m=0,y=0;do{if(!l)break;var b=k$(t,l),v=b[0],x=b[1],k=b[2],E=x-k-i*v;(v||E)&&S$(t,l)&&(m+=E,y+=v);var M=l.parentNode;l=M&&M.nodeType===Node.DOCUMENT_FRAGMENT_NODE?M.host:M}while(!u&&l!==document.body||u&&(e.contains(l)||e===l));return(h&&Math.abs(m)<1||!h&&Math.abs(y)<1)&&(d=!0),d},rm=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},KR=function(t){return[t.deltaX,t.deltaY]},ZR=function(t){return t&&"current"in t?t.current:t},pne=function(t,e){return t[0]===e[0]&&t[1]===e[1]},mne=function(t){return`
324
+ .block-interactivity-`.concat(t,` {pointer-events: none;}
325
+ .allow-interactivity-`).concat(t,` {pointer-events: all;}
326
+ `)},gne=0,Dc=[];function yne(t){var e=C.useRef([]),n=C.useRef([0,0]),r=C.useRef(),s=C.useState(gne++)[0],i=C.useState(w$)[0],o=C.useRef(t);C.useEffect(function(){o.current=t},[t]),C.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var x=$te([t.lockRef.current],(t.shards||[]).map(ZR),!0).filter(Boolean);return x.forEach(function(k){return k.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),x.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var l=C.useCallback(function(x,k){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!o.current.allowPinchZoom;var E=rm(x),M=n.current,_="deltaX"in x?x.deltaX:M[0]-E[0],N="deltaY"in x?x.deltaY:M[1]-E[1],T,A=x.target,j=Math.abs(_)>Math.abs(N)?"h":"v";if("touches"in x&&j==="h"&&A.type==="range")return!1;var P=window.getSelection(),O=P&&P.anchorNode,G=O?O===A||O.contains(A):!1;if(G)return!1;var B=YR(j,A);if(!B)return!0;if(B?T=j:(T=j==="v"?"h":"v",B=YR(j,A)),!B)return!1;if(!r.current&&"changedTouches"in x&&(_||N)&&(r.current=T),!T)return!0;var W=r.current||T;return hne(W,k,x,W==="h"?_:N)},[]),u=C.useCallback(function(x){var k=x;if(!(!Dc.length||Dc[Dc.length-1]!==i)){var E="deltaY"in k?KR(k):rm(k),M=e.current.filter(function(T){return T.name===k.type&&(T.target===k.target||k.target===T.shadowParent)&&pne(T.delta,E)})[0];if(M&&M.should){k.cancelable&&k.preventDefault();return}if(!M){var _=(o.current.shards||[]).map(ZR).filter(Boolean).filter(function(T){return T.contains(k.target)}),N=_.length>0?l(k,_[0]):!o.current.noIsolation;N&&k.cancelable&&k.preventDefault()}}},[]),d=C.useCallback(function(x,k,E,M){var _={name:x,delta:k,target:E,should:M,shadowParent:bne(E)};e.current.push(_),setTimeout(function(){e.current=e.current.filter(function(N){return N!==_})},1)},[]),h=C.useCallback(function(x){n.current=rm(x),r.current=void 0},[]),m=C.useCallback(function(x){d(x.type,KR(x),x.target,l(x,t.lockRef.current))},[]),y=C.useCallback(function(x){d(x.type,rm(x),x.target,l(x,t.lockRef.current))},[]);C.useEffect(function(){return Dc.push(i),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:y}),document.addEventListener("wheel",u,jc),document.addEventListener("touchmove",u,jc),document.addEventListener("touchstart",h,jc),function(){Dc=Dc.filter(function(x){return x!==i}),document.removeEventListener("wheel",u,jc),document.removeEventListener("touchmove",u,jc),document.removeEventListener("touchstart",h,jc)}},[]);var b=t.removeScrollBar,v=t.inert;return C.createElement(C.Fragment,null,v?C.createElement(i,{styles:mne(s)}):null,b?C.createElement(one,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function bne(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const vne=Gte(v$,yne);var RC=C.forwardRef(function(t,e){return C.createElement(Uy,fi({},t,{ref:e,sideCar:vne}))});RC.classNames=Uy.classNames;var wne=Object.defineProperty,Ba=(t,e)=>wne(t,"name",{value:e,configurable:!0}),OC="Popover",[C$,due]=Hl(OC,[Vy]),jC=Vy(),[xne,_u]=C$(OC),Sne=Ba(t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=t,l=jC(e),u=C.useRef(null),[d,h]=C.useState(!1),[m,y]=Ef({prop:r,defaultProp:s??!1,onChange:i,caller:OC});return p.jsx(a$,{...l,children:p.jsx(xne,{scope:e,contentId:Ly(),triggerRef:u,open:m,onOpenChange:y,onOpenToggle:C.useCallback(()=>y(b=>!b),[y]),hasCustomAnchor:d,onCustomAnchorAdd:C.useCallback(()=>h(!0),[]),onCustomAnchorRemove:C.useCallback(()=>h(!1),[]),modal:o,children:n})})},"Popover"),kne="PopoverTrigger",Cne=C.forwardRef(Ba(function(e,n){const{__scopePopover:r,...s}=e,i=_u(kne,r),o=jC(r),l=cn(n,i.triggerRef),u=p.jsx(zn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":DC(i.open),...s,ref:l,onClick:tn(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?u:p.jsx(l$,{asChild:!0,...o,children:u})},"PopoverTrigger")),E$="PopoverPortal",[Ene,Tne]=C$(E$,{forceMount:void 0}),Nne=Ba(t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=_u(E$,e);return p.jsx(Ene,{scope:e,forceMount:n,children:p.jsx(AC,{present:n||i.open,children:p.jsx(u$,{asChild:!0,container:s,children:r})})})},"PopoverPortal"),zf="PopoverContent",Mne=C.forwardRef(Ba(function(e,n){const r=Tne(zf,e.__scopePopover),{forceMount:s=r.forceMount,...i}=e,o=_u(zf,e.__scopePopover);return p.jsx(AC,{present:s||o.open,children:o.modal?p.jsx(Ane,{...i,ref:n}):p.jsx(Rne,{...i,ref:n})})},"PopoverContent")),_ne=Ea("PopoverContent.RemoveScroll"),Ane=C.forwardRef(Ba(function(e,n){const r=_u(zf,e.__scopePopover),s=C.useRef(null),i=cn(n,s),o=C.useRef(!1);return C.useEffect(()=>{const l=s.current;if(l)return g$(l)},[]),p.jsx(RC,{as:_ne,allowPinchZoom:!0,children:p.jsx(T$,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:tn(e.onCloseAutoFocus,l=>{l.preventDefault(),o.current||r.triggerRef.current?.focus()}),onPointerDownOutside:tn(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,h=u.button===2||d;o.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:tn(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})},"PopoverContentModal")),Rne=C.forwardRef(Ba(function(e,n){const r=_u(zf,e.__scopePopover),s=C.useRef(!1),i=C.useRef(!1);return p.jsx(T$,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(s.current||r.triggerRef.current?.focus(),o.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=o.target;r.triggerRef.current?.contains(l)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})},"PopoverContentNonModal")),T$=C.forwardRef(Ba(function(e,n){const{__scopePopover:r,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:m,...y}=e,b=_u(zf,r),v=jC(r);return Iy(),p.jsx($2,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:o,children:p.jsx(I2,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:m,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onDismiss:()=>b.onOpenChange(!1),deferPointerDownOutside:!0,children:p.jsx(c$,{"data-state":DC(b.open),role:"dialog",id:b.contentId,...v,...y,ref:n,style:{...y.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})},"PopoverContentImpl"));function DC(t){return t?"open":"closed"}Ba(DC,"getState");var One=Sne,jne=Cne,Dne=Nne,Ine=Mne;function Lne(t,e,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:n}).format(e).split(/\s/g).slice(2).join(" ")}const Pne={},qd={};function Ji(t,e){try{const r=(Pne[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in qd?qd[r]:XR(r,r.split(":"))}catch{if(t in qd)return qd[t];const n=t?.match($ne);return n?XR(t,n.slice(1)):NaN}}const $ne=/([+-]\d\d):?(\d\d)?/;function XR(t,e){const n=+(e[0]||0),r=+(e[1]||0),s=+(e[2]||0)/60;return qd[t]=n*60+r>0?n*60+r+s:n*60-r-s}class pi extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Ji(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),N$(this,e)):this.setTime(Date.now())}static tz(e,...n){return n.length?new pi(...n,e):new pi(Date.now(),e)}withTimeZone(e){return new pi(+this,e)}getTimezoneOffset(){const e=-Ji(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),Qg(this),+this}[Symbol.for("constructDateFrom")](e){return new pi(+new Date(e),this.timeZone)}}const JR=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!JR.test(t))return;const e=t.replace(JR,"$1UTC");pi.prototype[e]&&(t.startsWith("get")?pi.prototype[t]=function(){return this.internal[e]()}:(pi.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),zne(this),+this},pi.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),Qg(this),+this}))});function Qg(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-Ji(t.timeZone,t)*60))}function zne(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),N$(t)}function N$(t,e){const n=Array.isArray(e)?Bne(e):+t.internal,r=Ji(t.timeZone,t),s=r>0?Math.floor(r):Math.ceil(r),i=new Date(+t);i.setUTCHours(i.getUTCHours()-1);const o=-new Date(+t).getTimezoneOffset(),l=-new Date(+i).getTimezoneOffset(),u=o-l;let d=o;if(u&&o!==s){const O=Date.prototype.getHours.apply(t),G=Array.isArray(e)?e[3]||0:t.internal.getUTCHours();if(O!==G){const B=new Date(+t),W=o-s;W&&B.setUTCMinutes(B.getUTCMinutes()+W);const K=Ji(t.timeZone,B);(K>0?Math.floor(K):Math.ceil(K))===s&&(d=l)}}const h=d-s;h&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+h);const m=new Date(+t);m.setUTCSeconds(0);const y=o>0?m.getSeconds():(m.getSeconds()-60)%60,b=Math.round(-(Ji(t.timeZone,t)*60))%60;(b||y)&&Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+b+y);const v=Ji(t.timeZone,t),x=v>0?Math.floor(v):Math.ceil(v),E=-new Date(+t).getTimezoneOffset()-x,M=x!==s,_=E-h,N=x-s,T=n-x*60*1e3,A=N>0&&QR(t)-n===N*60*1e3&&QR(t,T)!==n;if(M&&_&&!A){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+_);const O=Ji(t.timeZone,t),G=O>0?Math.floor(O):Math.ceil(O),B=x-G;B&&_<0&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+B)}Qg(t);const P=(e?n:n+b*1e3)-+t.internal;P&&Math.abs(P)<1800*1e3&&(Date.prototype.setTime.call(t,+t+P),Qg(t))}function Bne(t){return Date.UTC(t[0],t.length>1?t[1]:0,t.length>2?t[2]:1,...t.slice(3))}function QR(t,e){const n=new Date(e??+t);return n.setUTCSeconds(n.getUTCSeconds()-Math.round(-Ji(t.timeZone,n)*60)),+n}class pr extends pi{static tz(e,...n){return n.length?new pr(...n,e):new pr(Date.now(),e)}toISOString(){const[e,n,r]=this.tzComponents(),s=`${e}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,n,r,s]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${r} ${n} ${s}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[n,r,s]=this.tzComponents();return`${e} GMT${n}${r}${s} (${Lne(this.timeZone,this)})`}toLocaleString(e,n){return Date.prototype.toLocaleString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(e,n){return Date.prototype.toLocaleDateString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(e,n){return Date.prototype.toLocaleTimeString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),n=e>0?"-":"+",r=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),s=String(Math.abs(e)%60).padStart(2,"0");return[n,r,s]}withTimeZone(e){return new pr(+this,e)}[Symbol.for("constructDateFrom")](e){return new pr(+new Date(e),this.timeZone)}}const M$=6048e5,Fne=864e5,eO=Symbol.for("constructDateFrom");function Dn(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&eO in t?t[eO](e):t instanceof Date?new t.constructor(e):new Date(e)}function Ft(t,e){return Dn(e||t,t)}function _$(t,e,n){const r=Ft(t,n?.in);return isNaN(e)?Dn(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function A$(t,e,n){const r=Ft(t,n?.in);if(isNaN(e))return Dn(t,NaN);if(!e)return r;const s=r.getDate(),i=Dn(t,r.getTime());i.setMonth(r.getMonth()+e+1,0);const o=i.getDate();return s>=o?i:(r.setFullYear(i.getFullYear(),i.getMonth(),s),r)}let Vne={};function ch(){return Vne}function yu(t,e){const n=ch(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Ft(t,e?.in),i=s.getDay(),o=(i<r?7:0)+i-r;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function Bf(t,e){return yu(t,{...e,weekStartsOn:1})}function R$(t,e){const n=Ft(t,e?.in),r=n.getFullYear(),s=Dn(n,0);s.setFullYear(r+1,0,4),s.setHours(0,0,0,0);const i=Bf(s),o=Dn(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);const l=Bf(o);return n.getTime()>=i.getTime()?r+1:n.getTime()>=l.getTime()?r:r-1}function tO(t){const e=Ft(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Au(t,...e){const n=Dn.bind(null,e.find(r=>typeof r=="object"));return e.map(n)}function Ff(t,e){const n=Ft(t,e?.in);return n.setHours(0,0,0,0),n}function IC(t,e,n){const[r,s]=Au(n?.in,t,e),i=Ff(r),o=Ff(s),l=+i-tO(i),u=+o-tO(o);return Math.round((l-u)/Fne)}function Hne(t,e){const n=R$(t,e),r=Dn(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Bf(r)}function Une(t,e,n){return _$(t,e*7,n)}function Wne(t,e,n){return A$(t,e*12,n)}function qne(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=Dn.bind(null,s));const i=Ft(s,r);(!n||n<i||isNaN(+i))&&(n=i)}),Dn(r,n||NaN)}function Gne(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=Dn.bind(null,s));const i=Ft(s,r);(!n||n>i||isNaN(+i))&&(n=i)}),Dn(r,n||NaN)}function Yne(t,e,n){const[r,s]=Au(n?.in,t,e);return+Ff(r)==+Ff(s)}function O$(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Kne(t){return!(!O$(t)&&typeof t!="number"||isNaN(+Ft(t)))}function j$(t,e,n){const[r,s]=Au(n?.in,t,e),i=r.getFullYear()-s.getFullYear(),o=r.getMonth()-s.getMonth();return i*12+o}function Zne(t,e){const n=Ft(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function D$(t,e){const[n,r]=Au(t,e.start,e.end);return{start:n,end:r}}function Xne(t,e){const{start:n,end:r}=D$(e?.in,t);let s=+n>+r;const i=s?+n:+r,o=s?r:n;o.setHours(0,0,0,0),o.setDate(1);let l=1;const u=[];for(;+o<=i;)u.push(Dn(n,o)),o.setMonth(o.getMonth()+l);return s?u.reverse():u}function Jne(t,e){const n=Ft(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Qne(t,e){const n=Ft(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function I$(t,e){const n=Ft(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function ere(t,e){const{start:n,end:r}=D$(e?.in,t);let s=+n>+r;const i=s?+n:+r,o=s?r:n;o.setHours(0,0,0,0),o.setMonth(0,1);let l=1;const u=[];for(;+o<=i;)u.push(Dn(n,o)),o.setFullYear(o.getFullYear()+l);return s?u.reverse():u}function L$(t,e){const n=ch(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Ft(t,e?.in),i=s.getDay(),o=(i<r?-7:0)+6-(i-r);return s.setDate(s.getDate()+o),s.setHours(23,59,59,999),s}function tre(t,e){return L$(t,{...e,weekStartsOn:1})}const nre={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},rre=(t,e,n)=>{let r;const s=nre[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Ew(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const sre={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ire={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},ore={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},are={date:Ew({formats:sre,defaultWidth:"full"}),time:Ew({formats:ire,defaultWidth:"full"}),dateTime:Ew({formats:ore,defaultWidth:"full"})},lre={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},cre=(t,e,n,r)=>lre[t];function Od(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const o=t.defaultFormattingWidth||t.defaultWidth,l=n?.width?String(n.width):o;s=t.formattingValues[l]||t.formattingValues[o]}else{const o=t.defaultWidth,l=n?.width?String(n.width):t.defaultWidth;s=t.values[l]||t.values[o]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const ure={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},dre={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},fre={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},hre={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},pre={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},mre={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},gre=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},yre={ordinalNumber:gre,era:Od({values:ure,defaultWidth:"wide"}),quarter:Od({values:dre,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Od({values:fre,defaultWidth:"wide"}),day:Od({values:hre,defaultWidth:"wide"}),dayPeriod:Od({values:pre,defaultWidth:"wide",formattingValues:mre,defaultFormattingWidth:"wide"})};function jd(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const o=i[0],l=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],u=Array.isArray(l)?vre(l,m=>m.test(o)):bre(l,m=>m.test(o));let d;d=t.valueCallback?t.valueCallback(u):u,d=n.valueCallback?n.valueCallback(d):d;const h=e.slice(o.length);return{value:d,rest:h}}}function bre(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function vre(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function wre(t){return(e,n={})=>{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let o=t.valueCallback?t.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const l=e.slice(s.length);return{value:o,rest:l}}}const xre=/^(\d+)(th|st|nd|rd)?/i,Sre=/\d+/i,kre={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Cre={any:[/^b/i,/^(a|c)/i]},Ere={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Tre={any:[/1/i,/2/i,/3/i,/4/i]},Nre={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Mre={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},_re={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Are={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Rre={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Ore={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},jre={ordinalNumber:wre({matchPattern:xre,parsePattern:Sre,valueCallback:t=>parseInt(t,10)}),era:jd({matchPatterns:kre,defaultMatchWidth:"wide",parsePatterns:Cre,defaultParseWidth:"any"}),quarter:jd({matchPatterns:Ere,defaultMatchWidth:"wide",parsePatterns:Tre,defaultParseWidth:"any",valueCallback:t=>t+1}),month:jd({matchPatterns:Nre,defaultMatchWidth:"wide",parsePatterns:Mre,defaultParseWidth:"any"}),day:jd({matchPatterns:_re,defaultMatchWidth:"wide",parsePatterns:Are,defaultParseWidth:"any"}),dayPeriod:jd({matchPatterns:Rre,defaultMatchWidth:"any",parsePatterns:Ore,defaultParseWidth:"any"})},qc={code:"en-US",formatDistance:rre,formatLong:are,formatRelative:cre,localize:yre,match:jre,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Dre(t,e){const n=Ft(t,e?.in);return IC(n,I$(n))+1}function LC(t,e){const n=Ft(t,e?.in),r=+Bf(n)-+Hne(n);return Math.round(r/M$)+1}function P$(t,e){const n=Ft(t,e?.in),r=n.getFullYear(),s=ch(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,o=Dn(e?.in||t,0);o.setFullYear(r+1,0,i),o.setHours(0,0,0,0);const l=yu(o,e),u=Dn(e?.in||t,0);u.setFullYear(r,0,i),u.setHours(0,0,0,0);const d=yu(u,e);return+n>=+l?r+1:+n>=+d?r:r-1}function Ire(t,e){const n=ch(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=P$(t,e),i=Dn(e?.in||t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),yu(i,e)}function PC(t,e){const n=Ft(t,e?.in),r=+yu(n,e)-+Ire(n,e);return Math.round(r/M$)+1}function jt(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const Ko={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return jt(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):jt(n+1,2)},d(t,e){return jt(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(t,e){return jt(t.getHours()%12||12,e.length)},H(t,e){return jt(t.getHours(),e.length)},m(t,e){return jt(t.getMinutes(),e.length)},s(t,e){return jt(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return jt(s,e.length)}},Ic={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},nO={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return Ko.y(t,e)},Y:function(t,e,n,r){const s=P$(t,r),i=s>0?s:1-s;if(e==="YY"){const o=i%100;return jt(o,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):jt(i,e.length)},R:function(t,e){const n=R$(t);return jt(n,e.length)},u:function(t,e){const n=t.getFullYear();return jt(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return jt(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return jt(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return Ko.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return jt(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const s=PC(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):jt(s,e.length)},I:function(t,e,n){const r=LC(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):jt(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Ko.d(t,e)},D:function(t,e,n){const r=Dre(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):jt(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return jt(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return jt(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),s=r===0?7:r;switch(e){case"i":return String(s);case"ii":return jt(s,e.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let s;switch(r===12?s=Ic.noon:r===0?s=Ic.midnight:s=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let s;switch(r>=17?s=Ic.evening:r>=12?s=Ic.afternoon:r>=4?s=Ic.morning:s=Ic.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Ko.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Ko.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):jt(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):jt(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Ko.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Ko.s(t,e)},S:function(t,e){return Ko.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return sO(r);case"XXXX":case"XX":return dl(r);default:return dl(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return sO(r);case"xxxx":case"xx":return dl(r);default:return dl(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+rO(r,":");default:return"GMT"+dl(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+rO(r,":");default:return"GMT"+dl(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return jt(r,e.length)},T:function(t,e,n){return jt(+t,e.length)}};function rO(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+e+jt(i,2)}function sO(t,e){return t%60===0?(t>0?"-":"+")+jt(Math.abs(t)/60,2):dl(t,e)}function dl(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=jt(Math.trunc(r/60),2),i=jt(r%60,2);return n+s+e+i}const iO=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},$$=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},Lre=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return iO(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",iO(r,e)).replace("{{time}}",$$(s,e))},Pre={p:$$,P:Lre},$re=/^D+$/,zre=/^Y+$/,Bre=["D","DD","YY","YYYY"];function Fre(t){return $re.test(t)}function Vre(t){return zre.test(t)}function Hre(t,e,n){const r=Ure(t,e,n);if(console.warn(r),Bre.includes(t))throw new RangeError(r)}function Ure(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Wre=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,qre=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Gre=/^'([^]*?)'?$/,Yre=/''/g,Kre=/[a-zA-Z]/;function Gd(t,e,n){const r=ch(),s=n?.locale??r.locale??qc,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,l=Ft(t,n?.in);if(!Kne(l))throw new RangeError("Invalid time value");let u=e.match(qre).map(h=>{const m=h[0];if(m==="p"||m==="P"){const y=Pre[m];return y(h,s.formatLong)}return h}).join("").match(Wre).map(h=>{if(h==="''")return{isToken:!1,value:"'"};const m=h[0];if(m==="'")return{isToken:!1,value:Zre(h)};if(nO[m])return{isToken:!0,value:h};if(m.match(Kre))throw new RangeError("Format string contains an unescaped latin alphabet character `"+m+"`");return{isToken:!1,value:h}});s.localize.preprocessor&&(u=s.localize.preprocessor(l,u));const d={firstWeekContainsDate:i,weekStartsOn:o,locale:s};return u.map(h=>{if(!h.isToken)return h.value;const m=h.value;(!n?.useAdditionalWeekYearTokens&&Vre(m)||!n?.useAdditionalDayOfYearTokens&&Fre(m))&&Hre(m,e,String(t));const y=nO[m[0]];return y(l,m,s.localize,d)}).join("")}function Zre(t){const e=t.match(Gre);return e?e[1].replace(Yre,"'"):t}function Xre(t,e){const n=Ft(t,e?.in),r=n.getFullYear(),s=n.getMonth(),i=Dn(n,0);return i.setFullYear(r,s+1,0),i.setHours(0,0,0,0),i.getDate()}function Jre(t,e){return Ft(t,e?.in).getMonth()}function Qre(t,e){return Ft(t,e?.in).getFullYear()}function ese(t,e){return+Ft(t)>+Ft(e)}function tse(t,e){return+Ft(t)<+Ft(e)}function nse(t,e,n){const[r,s]=Au(n?.in,t,e);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function rse(t,e,n){const[r,s]=Au(n?.in,t,e);return r.getFullYear()===s.getFullYear()}function sse(t,e,n){const r=Ft(t,n?.in),s=r.getFullYear(),i=r.getDate(),o=Dn(t,0);o.setFullYear(s,e,15),o.setHours(0,0,0,0);const l=Xre(o);return r.setMonth(e,Math.min(i,l)),r}function ise(t,e,n){const r=Ft(t,n?.in);return isNaN(+r)?Dn(t,NaN):(r.setFullYear(e),r)}const oO=5,ose=4;function ase(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,s=e.addDays(t,-r+1),i=e.addDays(s,oO*7-1);return e.getMonth(t)===e.getMonth(i)?oO:ose}function z$(t,e){const n=e.startOfMonth(t),r=n.getDay();return r===1?n:r===0?e.addDays(n,-6):e.addDays(n,-1*(r-1))}function lse(t,e){const n=z$(t,e),r=ase(t,e);return e.addDays(n,r*7-1)}const B$={...qc,labels:{labelDayButton:(t,e,n,r)=>{let s;r&&typeof r.format=="function"?s=r.format.bind(r):s=(o,l)=>Gd(o,l,{locale:qc,...n});let i=s(t,"PPPP");return e.today&&(i=`Today, ${i}`),e.selected&&(i=`${i}, selected`),i},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:t=>`Week ${t}`,labelYearDropdown:"Choose the Year",labelGrid:(t,e,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(s,i)=>Gd(s,i,{locale:qc,...e}),r(t,"LLLL yyyy")},labelGridcell:(t,e,n,r)=>{let s;r&&typeof r.format=="function"?s=r.format.bind(r):s=(o,l)=>Gd(o,l,{locale:qc,...n});let i=s(t,"PPPP");return e?.today&&(i=`Today, ${i}`),i},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(t,e,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(s,i)=>Gd(s,i,{locale:qc,...e}),r(t,"cccc")}}};class ls{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?pr.tz(this.options.timeZone):new this.Date,this.newDate=(r,s,i)=>this.overrides?.newDate?this.overrides.newDate(r,s,i):this.options.timeZone?new pr(r,s,i,this.options.timeZone):new Date(r,s,i),this.addDays=(r,s)=>this.overrides?.addDays?this.overrides.addDays(r,s):_$(r,s),this.addMonths=(r,s)=>this.overrides?.addMonths?this.overrides.addMonths(r,s):A$(r,s),this.addWeeks=(r,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,s):Une(r,s),this.addYears=(r,s)=>this.overrides?.addYears?this.overrides.addYears(r,s):Wne(r,s),this.differenceInCalendarDays=(r,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):IC(r,s),this.differenceInCalendarMonths=(r,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):j$(r,s),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Xne(r),this.eachYearOfInterval=r=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):ere(r),i=new Set(s.map(l=>this.getYear(l)));if(i.size===s.length)return s;const o=[];return i.forEach(l=>{o.push(new Date(l,0,1))}),o},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):lse(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):tre(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):Zne(r),this.endOfWeek=(r,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,s):L$(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):Qne(r),this.format=(r,s,i)=>{const o=this.overrides?.format?this.overrides.format(r,s,this.options):Gd(r,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(o):o},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):LC(r),this.getMonth=(r,s)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):Jre(r,this.options),this.getYear=(r,s)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):Qre(r,this.options),this.getWeek=(r,s)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):PC(r,this.options),this.isAfter=(r,s)=>this.overrides?.isAfter?this.overrides.isAfter(r,s):ese(r,s),this.isBefore=(r,s)=>this.overrides?.isBefore?this.overrides.isBefore(r,s):tse(r,s),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):O$(r),this.isSameDay=(r,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,s):Yne(r,s),this.isSameMonth=(r,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,s):nse(r,s),this.isSameYear=(r,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,s):rse(r,s),this.max=r=>this.overrides?.max?this.overrides.max(r):qne(r),this.min=r=>this.overrides?.min?this.overrides.min(r):Gne(r),this.setMonth=(r,s)=>this.overrides?.setMonth?this.overrides.setMonth(r,s):sse(r,s),this.setYear=(r,s)=>this.overrides?.setYear?this.overrides.setYear(r,s):ise(r,s),this.startOfBroadcastWeek=(r,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):z$(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):Ff(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Bf(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):Jne(r),this.startOfWeek=(r,s)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):yu(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):I$(r),this.options={locale:B$,...e},this.overrides=n}getDigitMap(){const{numerals:e="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:e}),r={};for(let s=0;s<10;s++)r[s.toString()]=n.format(s);return r}replaceDigits(e){const n=this.getDigitMap();return e.replace(/\d/g,r=>n[r]||r)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&ls.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:s}=this.options,i=n?.code;if(i&&ls.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:s}).format(e)}catch{}const o=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,o)}}ls.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Si=new ls;class F${constructor(e,n,r=Si){this.date=e,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(e,n)),this.dateLib=r,this.isoDate=r.format(e,"yyyy-MM-dd"),this.displayMonthId=r.format(n,"yyyy-MM"),this.dateMonthId=r.format(e,"yyyy-MM")}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class cse{constructor(e,n){this.date=e,this.weeks=n}}class use{constructor(e,n){this.days=n,this.weekNumber=e}}function dse(t){return fe.createElement("button",{...t})}function fse(t){return fe.createElement("span",{...t})}function hse(t){const{size:e=24,orientation:n="left",className:r}=t;return fe.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&fe.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&fe.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&fe.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&fe.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function pse(t){const{day:e,modifiers:n,...r}=t;return fe.createElement("td",{...r})}function mse(t){const{day:e,modifiers:n,...r}=t,s=fe.useRef(null);return fe.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),fe.createElement("button",{ref:s,...r})}var We;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})(We||(We={}));var an;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(an||(an={}));var Ks;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(Ks||(Ks={}));var Qr;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(Qr||(Qr={}));function gse(t){const{options:e,className:n,components:r,classNames:s,...i}=t,o=[s[We.Dropdown],n].join(" "),l=e?.find(({value:u})=>u===i.value);return fe.createElement("span",{"data-disabled":i.disabled,className:s[We.DropdownRoot]},fe.createElement(r.Select,{className:o,...i},e?.map(({value:u,label:d,disabled:h})=>fe.createElement(r.Option,{key:u,value:u,disabled:h},d))),fe.createElement("span",{className:s[We.CaptionLabel],"aria-hidden":!0},l?.label,fe.createElement(r.Chevron,{orientation:"down",size:18,className:s[We.Chevron]})))}function yse(t){return fe.createElement("div",{...t})}function bse(t){return fe.createElement("div",{...t})}function vse(t){const{calendarMonth:e,displayIndex:n,...r}=t;return fe.createElement("div",{...r},t.children)}function wse(t){const{calendarMonth:e,displayIndex:n,...r}=t;return fe.createElement("div",{...r})}function xse(t){return fe.createElement("table",{...t})}function Sse(t){return fe.createElement("div",{...t})}const V$=C.createContext(void 0);function uh(){const t=C.useContext(V$);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function kse(t){const{components:e}=uh();return fe.createElement(e.Dropdown,{...t})}function Cse(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:s,...i}=t,{components:o,classNames:l,labels:{labelPrevious:u,labelNext:d}}=uh(),h=C.useCallback(y=>{s&&n?.(y)},[s,n]),m=C.useCallback(y=>{r&&e?.(y)},[r,e]);return fe.createElement("nav",{...i},fe.createElement(o.PreviousMonthButton,{type:"button",className:l[We.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":u(r),onClick:m},fe.createElement(o.Chevron,{disabled:r?void 0:!0,className:l[We.Chevron],orientation:"left"})),fe.createElement(o.NextMonthButton,{type:"button",className:l[We.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":d(s),onClick:h},fe.createElement(o.Chevron,{disabled:s?void 0:!0,orientation:"right",className:l[We.Chevron]})))}function Ese(t){const{components:e}=uh();return fe.createElement(e.Button,{...t})}function Tse(t){return fe.createElement("option",{...t})}function Nse(t){const{components:e}=uh();return fe.createElement(e.Button,{...t})}function Mse(t){const{rootRef:e,...n}=t;return fe.createElement("div",{...n,ref:e})}function _se(t){return fe.createElement("select",{...t})}function Ase(t){const{week:e,...n}=t;return fe.createElement("tr",{...n})}function Rse(t){return fe.createElement("th",{...t})}function Ose(t){return fe.createElement("thead",{"aria-hidden":!0},fe.createElement("tr",{...t}))}function jse(t){const{week:e,...n}=t;return fe.createElement("th",{...n})}function Dse(t){return fe.createElement("th",{...t})}function Ise(t){return fe.createElement("tbody",{...t})}function Lse(t){const{components:e}=uh();return fe.createElement(e.Dropdown,{...t})}const Pse=Object.freeze(Object.defineProperty({__proto__:null,Button:dse,CaptionLabel:fse,Chevron:hse,Day:pse,DayButton:mse,Dropdown:gse,DropdownNav:yse,Footer:bse,Month:vse,MonthCaption:wse,MonthGrid:xse,Months:Sse,MonthsDropdown:kse,Nav:Cse,NextMonthButton:Ese,Option:Tse,PreviousMonthButton:Nse,Root:Mse,Select:_se,Week:Ase,WeekNumber:jse,WeekNumberHeader:Dse,Weekday:Rse,Weekdays:Ose,Weeks:Ise,YearsDropdown:Lse},Symbol.toStringTag,{value:"Module"}));function oo(t,e,n=!1,r=Si){let{from:s,to:i}=t;const{differenceInCalendarDays:o,isSameDay:l}=r;return s&&i?(o(i,s)<0&&([s,i]=[i,s]),o(e,s)>=(n?1:0)&&o(i,e)>=(n?1:0)):!n&&i?l(i,e):!n&&s?l(s,e):!1}function $C(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function Wy(t){return!!(t&&typeof t=="object"&&"from"in t)}function zC(t){return!!(t&&typeof t=="object"&&"after"in t)}function BC(t){return!!(t&&typeof t=="object"&&"before"in t)}function H$(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function U$(t,e){return Array.isArray(t)&&t.every(e.isDate)}function ao(t,e,n=Si){const r=Array.isArray(e)?e:[e],{isSameDay:s,differenceInCalendarDays:i,isAfter:o}=n;return r.some(l=>{if(typeof l=="boolean")return l;if(n.isDate(l))return s(t,l);if(U$(l,n))return l.some(u=>s(t,u));if(Wy(l))return oo(l,t,!1,n);if(H$(l))return Array.isArray(l.dayOfWeek)?l.dayOfWeek.includes(t.getDay()):l.dayOfWeek===t.getDay();if($C(l)){const u=i(l.before,t),d=i(l.after,t),h=u>0,m=d<0;return o(l.before,l.after)?m&&h:h||m}return zC(l)?i(t,l.after)>0:BC(l)?i(l.before,t)>0:typeof l=="function"?l(t):!1})}function $se(t,e,n,r,s){const{disabled:i,hidden:o,modifiers:l,showOutsideDays:u,broadcastCalendar:d,today:h=s.today()}=e,{isSameDay:m,isSameMonth:y,startOfMonth:b,isBefore:v,endOfMonth:x,isAfter:k}=s,E=n&&b(n),M=r&&x(r),_={[an.focused]:[],[an.outside]:[],[an.disabled]:[],[an.hidden]:[],[an.today]:[]},N={};for(const T of t){const{date:A,displayMonth:j}=T,P=!!(j&&!y(A,j)),O=!!(E&&v(A,E)),G=!!(M&&k(A,M)),B=!!(i&&ao(A,i,s)),W=!!(o&&ao(A,o,s))||O||G||!d&&!u&&P||d&&u===!1&&P,K=m(A,h);P&&_.outside.push(T),B&&_.disabled.push(T),W&&_.hidden.push(T),K&&_.today.push(T),l&&Object.keys(l).forEach(Q=>{const ee=l?.[Q];ee&&ao(A,ee,s)&&(N[Q]?N[Q].push(T):N[Q]=[T])})}return T=>{const A={[an.focused]:!1,[an.disabled]:!1,[an.hidden]:!1,[an.outside]:!1,[an.today]:!1},j={};for(const P in _){const O=_[P];A[P]=O.some(G=>G===T)}for(const P in N)j[P]=N[P].some(O=>O===T);return{...A,...j}}}function zse(t,e,n={}){return Object.entries(t).filter(([,s])=>s===!0).reduce((s,[i])=>(n[i]?s.push(n[i]):e[an[i]]?s.push(e[an[i]]):e[Ks[i]]&&s.push(e[Ks[i]]),s),[e[We.Day]])}function Bse(t){return{...Pse,...t}}function Fse(t){const e={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([n,r])=>{n.startsWith("data-")&&(e[n]=r)}),e}function Vse(){const t={};for(const e in We)t[We[e]]=`rdp-${We[e]}`;for(const e in an)t[an[e]]=`rdp-${an[e]}`;for(const e in Ks)t[Ks[e]]=`rdp-${Ks[e]}`;for(const e in Qr)t[Qr[e]]=`rdp-${Qr[e]}`;return t}function W$(t,e,n){return(n??new ls(e)).formatMonthYear(t)}const Hse=W$;function Use(t,e,n){return(n??new ls(e)).format(t,"d")}function Wse(t,e=Si){return e.format(t,"LLLL")}function qse(t,e,n){return(n??new ls(e)).format(t,"cccccc")}function Gse(t,e=Si){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function Yse(){return""}function q$(t,e=Si){return e.format(t,"yyyy")}const Kse=q$,Zse=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:W$,formatDay:Use,formatMonthCaption:Hse,formatMonthDropdown:Wse,formatWeekNumber:Gse,formatWeekNumberHeader:Yse,formatWeekdayName:qse,formatYearCaption:Kse,formatYearDropdown:q$},Symbol.toStringTag,{value:"Module"}));function Xse(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...Zse,...t}}function FC(t,e,n,r){let s=(r??new ls(n)).format(t,"PPPP");return e.today&&(s=`Today, ${s}`),e.selected&&(s=`${s}, selected`),s}const Jse=FC;function VC(t,e,n){return(n??new ls(e)).formatMonthYear(t)}const Qse=VC;function G$(t,e,n,r){let s=(r??new ls(n)).format(t,"PPPP");return e?.today&&(s=`Today, ${s}`),s}function Y$(t){return"Choose the Month"}function K$(){return""}const eie="Go to the Next Month";function Z$(t,e){return eie}function X$(t){return"Go to the Previous Month"}function J$(t,e,n){return(n??new ls(e)).format(t,"cccc")}function Q$(t,e){return`Week ${t}`}function ez(t){return"Week Number"}function tz(t){return"Choose the Year"}const tie=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:Qse,labelDay:Jse,labelDayButton:FC,labelGrid:VC,labelGridcell:G$,labelMonthDropdown:Y$,labelNav:K$,labelNext:Z$,labelPrevious:X$,labelWeekNumber:Q$,labelWeekNumberHeader:ez,labelWeekday:J$,labelYearDropdown:tz},Symbol.toStringTag,{value:"Module"})),Ps=(t,e,n)=>e||(n?typeof n=="function"?n:(...r)=>n:t);function nie(t,e){const n=e.locale?.labels??{};return{...tie,...t??{},labelDayButton:Ps(FC,t?.labelDayButton,n.labelDayButton),labelMonthDropdown:Ps(Y$,t?.labelMonthDropdown,n.labelMonthDropdown),labelNext:Ps(Z$,t?.labelNext,n.labelNext),labelPrevious:Ps(X$,t?.labelPrevious,n.labelPrevious),labelWeekNumber:Ps(Q$,t?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:Ps(tz,t?.labelYearDropdown,n.labelYearDropdown),labelGrid:Ps(VC,t?.labelGrid,n.labelGrid),labelGridcell:Ps(G$,t?.labelGridcell,n.labelGridcell),labelNav:Ps(K$,t?.labelNav,n.labelNav),labelWeekNumberHeader:Ps(ez,t?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:Ps(J$,t?.labelWeekday,n.labelWeekday)}}function rie(t,e,n,r,s){const{startOfMonth:i,startOfYear:o,endOfYear:l,eachMonthOfInterval:u,getMonth:d}=s;return u({start:o(t),end:l(t)}).map(y=>{const b=r.formatMonthDropdown(y,s),v=d(y),x=e&&y<i(e)||n&&y>i(n)||!1;return{value:v,label:b,disabled:x}})}function sie(t,e={},n={}){let r={...e?.[We.Day]};return Object.entries(t).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n?.[s]}}),r}function iie(t,e,n,r){const s=r??t.today(),i=n?t.startOfBroadcastWeek(s,t):e?t.startOfISOWeek(s):t.startOfWeek(s),o=[];for(let l=0;l<7;l++){const u=t.addDays(i,l);o.push(u)}return o}function oie(t,e,n,r,s=!1){if(!t||!e)return;const{startOfYear:i,endOfYear:o,eachYearOfInterval:l,getYear:u}=r,d=i(t),h=o(e),m=l({start:d,end:h});return s&&m.reverse(),m.map(y=>{const b=n.formatYearDropdown(y,r);return{value:u(y),label:b,disabled:!1}})}function aie(t,e={}){const{weekStartsOn:n,locale:r}=e,s=n??r?.options?.weekStartsOn??0,i=l=>{const u=typeof l=="number"||typeof l=="string"?new Date(l):l;return new pr(u.getFullYear(),u.getMonth(),u.getDate(),12,0,0,t)},o=l=>{const u=i(l);return new Date(u.getFullYear(),u.getMonth(),u.getDate(),0,0,0,0)};return{today:()=>i(pr.tz(t)),newDate:(l,u,d)=>new pr(l,u,d,12,0,0,t),startOfDay:l=>i(l),startOfWeek:(l,u)=>{const d=i(l),h=u?.weekStartsOn??s,m=(d.getDay()-h+7)%7;return d.setDate(d.getDate()-m),d},startOfISOWeek:l=>{const u=i(l),d=(u.getDay()-1+7)%7;return u.setDate(u.getDate()-d),u},startOfMonth:l=>{const u=i(l);return u.setDate(1),u},startOfYear:l=>{const u=i(l);return u.setMonth(0,1),u},endOfWeek:(l,u)=>{const d=i(l),y=(((u?.weekStartsOn??s)+6)%7-d.getDay()+7)%7;return d.setDate(d.getDate()+y),d},endOfISOWeek:l=>{const u=i(l),d=(7-u.getDay())%7;return u.setDate(u.getDate()+d),u},endOfMonth:l=>{const u=i(l);return u.setMonth(u.getMonth()+1,0),u},endOfYear:l=>{const u=i(l);return u.setMonth(11,31),u},eachMonthOfInterval:l=>{const u=i(l.start),d=i(l.end),h=[],m=new pr(u.getFullYear(),u.getMonth(),1,12,0,0,t),y=d.getFullYear()*12+d.getMonth();for(;m.getFullYear()*12+m.getMonth()<=y;)h.push(new pr(m,t)),m.setMonth(m.getMonth()+1,1);return h},addDays:(l,u)=>{const d=i(l);return d.setDate(d.getDate()+u),d},addWeeks:(l,u)=>{const d=i(l);return d.setDate(d.getDate()+u*7),d},addMonths:(l,u)=>{const d=i(l);return d.setMonth(d.getMonth()+u),d},addYears:(l,u)=>{const d=i(l);return d.setFullYear(d.getFullYear()+u),d},eachYearOfInterval:l=>{const u=i(l.start),d=i(l.end),h=[],m=new pr(u.getFullYear(),0,1,12,0,0,t);for(;m.getFullYear()<=d.getFullYear();)h.push(new pr(m,t)),m.setFullYear(m.getFullYear()+1,0,1);return h},getWeek:(l,u)=>{const d=o(l);return PC(d,{weekStartsOn:u?.weekStartsOn??s,firstWeekContainsDate:u?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1})},getISOWeek:l=>{const u=o(l);return LC(u)},differenceInCalendarDays:(l,u)=>{const d=o(l),h=o(u);return IC(d,h)},differenceInCalendarMonths:(l,u)=>{const d=o(l),h=o(u);return j$(d,h)}}}const dh=t=>t instanceof HTMLElement?t:null,Tw=t=>[...t.querySelectorAll("[data-animated-month]")??[]],lie=t=>dh(t.querySelector("[data-animated-month]")),Nw=t=>dh(t.querySelector("[data-animated-caption]")),Mw=t=>dh(t.querySelector("[data-animated-weeks]")),cie=t=>dh(t.querySelector("[data-animated-nav]")),uie=t=>dh(t.querySelector("[data-animated-weekdays]"));function die(t,e,{classNames:n,months:r,focused:s,dateLib:i}){const o=C.useRef(null),l=C.useRef(r),u=C.useRef(!1);C.useLayoutEffect(()=>{const d=l.current;if(l.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||d.length===0||r.length!==d.length)return;const h=i.isSameMonth(r[0].date,d[0].date),m=i.isAfter(r[0].date,d[0].date),y=m?n[Qr.caption_after_enter]:n[Qr.caption_before_enter],b=m?n[Qr.weeks_after_enter]:n[Qr.weeks_before_enter],v=o.current,x=t.current.cloneNode(!0);if(x instanceof HTMLElement?(Tw(x).forEach(_=>{if(!(_ instanceof HTMLElement))return;const N=lie(_);N&&_.contains(N)&&_.removeChild(N);const T=Nw(_);T&&T.classList.remove(y);const A=Mw(_);A&&A.classList.remove(b)}),o.current=x):o.current=null,u.current||h||s)return;const k=v instanceof HTMLElement?Tw(v):[],E=Tw(t.current);if(E?.every(M=>M instanceof HTMLElement)&&k&&k.every(M=>M instanceof HTMLElement)){u.current=!0,t.current.style.isolation="isolate";const M=cie(t.current);M&&(M.style.zIndex="1"),E.forEach((_,N)=>{const T=k[N];if(!T)return;_.style.position="relative",_.style.overflow="hidden";const A=Nw(_);A&&A.classList.add(y);const j=Mw(_);j&&j.classList.add(b);const P=()=>{u.current=!1,t.current&&(t.current.style.isolation=""),M&&(M.style.zIndex=""),A&&A.classList.remove(y),j&&j.classList.remove(b),_.style.position="",_.style.overflow="",_.contains(T)&&_.removeChild(T)};T.style.pointerEvents="none",T.style.position="absolute",T.style.overflow="hidden",T.setAttribute("aria-hidden","true");const O=uie(T);O&&(O.style.opacity="0");const G=Nw(T);G&&(G.classList.add(m?n[Qr.caption_before_exit]:n[Qr.caption_after_exit]),G.addEventListener("animationend",P));const B=Mw(T);B&&B.classList.add(m?n[Qr.weeks_before_exit]:n[Qr.weeks_after_exit]),_.insertBefore(T,_.firstChild)})}})}function fie(t,e,n,r){const s=t[0],i=t[t.length-1],{ISOWeek:o,fixedWeeks:l,broadcastCalendar:u}=n??{},{addDays:d,differenceInCalendarDays:h,differenceInCalendarMonths:m,endOfBroadcastWeek:y,endOfISOWeek:b,endOfMonth:v,endOfWeek:x,isAfter:k,startOfBroadcastWeek:E,startOfISOWeek:M,startOfWeek:_}=r,N=u?E(s,r):o?M(s):_(s),T=u?y(i):o?b(v(i)):x(v(i)),A=e&&(u?y(e):o?b(e):x(e)),j=A&&k(T,A)?A:T,P=h(j,N),O=m(i,s)+1,G=[];for(let K=0;K<=P;K++){const Q=d(N,K);G.push(Q)}const W=(u?35:42)*O;if(l&&G.length<W){const K=W-G.length;for(let Q=0;Q<K;Q++){const ee=d(G[G.length-1],1);G.push(ee)}}return G}function hie(t){const e=[];return t.reduce((n,r)=>{const s=r.weeks.reduce((i,o)=>i.concat(o.days.slice()),e.slice());return n.concat(s.slice())},e.slice())}function pie(t,e,n,r){const{numberOfMonths:s=1}=n,i=[];for(let o=0;o<s;o++){const l=r.addMonths(t,o);if(e&&l>e)break;i.push(l)}return i}function aO(t,e,n,r){const{month:s,defaultMonth:i,today:o=r.today(),numberOfMonths:l=1}=t;let u=s||i||o;const{differenceInCalendarMonths:d,addMonths:h,startOfMonth:m}=r;if(n&&d(n,u)<l-1){const y=-1*(l-1);u=h(n,y)}return e&&d(u,e)<0&&(u=e),m(u)}function mie(t,e,n,r){const{addDays:s,endOfBroadcastWeek:i,endOfISOWeek:o,endOfMonth:l,endOfWeek:u,getISOWeek:d,getWeek:h,startOfBroadcastWeek:m,startOfISOWeek:y,startOfWeek:b}=r,v=t.reduce((x,k)=>{const E=n.broadcastCalendar?m(k,r):n.ISOWeek?y(k):b(k),M=n.broadcastCalendar?i(k):n.ISOWeek?o(l(k)):u(l(k)),_=e.filter(j=>j>=E&&j<=M),N=n.broadcastCalendar?35:42;if(n.fixedWeeks&&_.length<N){const j=e.filter(P=>{const O=N-_.length;return P>M&&P<=s(M,O)});_.push(...j)}const T=_.reduce((j,P)=>{const O=n.ISOWeek?d(P):h(P),G=j.find(W=>W.weekNumber===O),B=new F$(P,k,r);return G?G.days.push(B):j.push(new use(O,[B])),j},[]),A=new cse(k,T);return x.push(A),x},[]);return n.reverseMonths?v.reverse():v}function gie(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:s,startOfDay:i,startOfMonth:o,endOfMonth:l,addYears:u,endOfYear:d,newDate:h,today:m}=e,{fromYear:y,toYear:b,fromMonth:v,toMonth:x}=t;!n&&v&&(n=v),!n&&y&&(n=e.newDate(y,0,1)),!r&&x&&(r=x),!r&&b&&(r=h(b,11,31));const k=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=o(n):y?n=h(y,0,1):!n&&k&&(n=s(u(t.today??m(),-100))),r?r=l(r):b?r=h(b,11,31):!r&&k&&(r=d(t.today??m())),[n&&i(n),r&&i(r)]}function yie(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=n,{startOfMonth:o,addMonths:l,differenceInCalendarMonths:u}=r,d=s?i:1,h=o(t);if(!e)return l(h,d);if(!(u(e,t)<i))return l(h,d)}function bie(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i}=n,{startOfMonth:o,addMonths:l,differenceInCalendarMonths:u}=r,d=s?i??1:1,h=o(t);if(!e)return l(h,-d);if(!(u(h,e)<=0))return l(h,-d)}function vie(t){const e=[];return t.reduce((n,r)=>n.concat(r.weeks.slice()),e.slice())}function qy(t,e){const[n,r]=C.useState(t);return[e===void 0?n:e,r]}function wie(t,e){const[n,r]=gie(t,e),{startOfMonth:s,endOfMonth:i}=e,o=aO(t,n,r,e),[l,u]=qy(o,t.month?o:void 0);C.useEffect(()=>{const N=aO(t,n,r,e);u(N)},[t.timeZone]);const{months:d,weeks:h,days:m,previousMonth:y,nextMonth:b}=C.useMemo(()=>{const N=pie(l,r,{numberOfMonths:t.numberOfMonths},e),T=fie(N,t.endMonth?i(t.endMonth):void 0,{ISOWeek:t.ISOWeek,fixedWeeks:t.fixedWeeks,broadcastCalendar:t.broadcastCalendar},e),A=mie(N,T,{broadcastCalendar:t.broadcastCalendar,fixedWeeks:t.fixedWeeks,ISOWeek:t.ISOWeek,reverseMonths:t.reverseMonths},e),j=vie(A),P=hie(A),O=bie(l,n,t,e),G=yie(l,r,t,e);return{months:A,weeks:j,days:P,previousMonth:O,nextMonth:G}},[e,l.getTime(),r?.getTime(),n?.getTime(),t.disableNavigation,t.broadcastCalendar,t.endMonth?.getTime(),t.fixedWeeks,t.ISOWeek,t.numberOfMonths,t.pagedNavigation,t.reverseMonths]),{disableNavigation:v,onMonthChange:x}=t,k=N=>h.some(T=>T.days.some(A=>A.isEqualTo(N))),E=N=>{if(v)return;let T=s(N);n&&T<s(n)&&(T=s(n)),r&&T>s(r)&&(T=s(r)),u(T),x?.(T)};return{months:d,weeks:h,days:m,navStart:n,navEnd:r,previousMonth:y,nextMonth:b,goToMonth:E,goToDay:N=>{k(N)||E(N.date)}}}var di;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(di||(di={}));function lO(t){return!t[an.disabled]&&!t[an.hidden]&&!t[an.outside]}function xie(t,e,n,r){let s,i=-1;for(const o of t){const l=e(o);lO(l)&&(l[an.focused]&&i<di.FocusedModifier?(s=o,i=di.FocusedModifier):r?.isEqualTo(o)&&i<di.LastFocused?(s=o,i=di.LastFocused):n(o.date)&&i<di.Selected?(s=o,i=di.Selected):l[an.today]&&i<di.Today&&(s=o,i=di.Today))}return s||(s=t.find(o=>lO(e(o)))),s}function Sie(t,e,n,r,s,i,o){const{ISOWeek:l,broadcastCalendar:u}=i,{addDays:d,addMonths:h,addWeeks:m,addYears:y,endOfBroadcastWeek:b,endOfISOWeek:v,endOfWeek:x,max:k,min:E,startOfBroadcastWeek:M,startOfISOWeek:_,startOfWeek:N}=o;let A={day:d,week:m,month:h,year:y,startOfWeek:j=>u?M(j,o):l?_(j):N(j),endOfWeek:j=>u?b(j):l?v(j):x(j)}[t](n,e==="after"?1:-1);return e==="before"&&r?A=k([r,A]):e==="after"&&s&&(A=E([s,A])),A}function nz(t,e,n,r,s,i,o,l=0){if(l>365)return;const u=Sie(t,e,n.date,r,s,i,o),d=!!(i.disabled&&ao(u,i.disabled,o)),h=!!(i.hidden&&ao(u,i.hidden,o)),m=u,y=new F$(u,m,o);return!d&&!h?y:nz(t,e,y,r,s,i,o,l+1)}function kie(t,e,n,r,s){const{autoFocus:i}=t,[o,l]=C.useState(),u=xie(e.days,n,r||(()=>!1),o),[d,h]=C.useState(i?u:void 0);return{isFocusTarget:x=>!!u?.isEqualTo(x),setFocused:h,focused:d,blur:()=>{l(d),h(void 0)},moveFocus:(x,k)=>{if(!d)return;const E=nz(x,k,d,e.navStart,e.navEnd,t,s);E&&(t.disableNavigation&&!e.days.some(_=>_.isEqualTo(E))||(e.goToDay(E),h(E)))}}}function Cie(t,e){const{selected:n,required:r,onSelect:s}=t,[i,o]=qy(n,s?n:void 0),l=s?n:i,{isSameDay:u}=e,d=b=>l?.some(v=>u(v,b))??!1,{min:h,max:m}=t;return{selected:l,select:(b,v,x)=>{let k=[...l??[]];if(d(b)){if(l?.length===h||r&&l?.length===1)return;k=l?.filter(E=>!u(E,b))}else l?.length===m?k=[b]:k=[...k,b];return s||o(k),s?.(k,b,v,x),k},isSelected:d}}function Eie(t,e,n=0,r=0,s=!1,i=Si){const{from:o,to:l}=e||{},{isSameDay:u,isAfter:d,isBefore:h}=i;let m;if(!o&&!l)m={from:t,to:n>0?void 0:t};else if(o&&!l)u(o,t)?n===0?m={from:o,to:t}:s?m={from:o,to:void 0}:m=void 0:h(t,o)?m={from:t,to:o}:m={from:o,to:t};else if(o&&l)if(u(o,t)&&u(l,t))s?m={from:o,to:l}:m=void 0;else if(u(o,t))m={from:o,to:n>0?void 0:t};else if(u(l,t))m={from:t,to:n>0?void 0:t};else if(h(t,o))m={from:t,to:l};else if(d(t,o))m={from:o,to:t};else if(d(t,l))m={from:o,to:t};else throw new Error("Invalid range");if(m?.from&&m?.to){const y=i.differenceInCalendarDays(m.to,m.from);r>0&&y>r?m={from:t,to:void 0}:n>1&&y<n&&(m={from:t,to:void 0})}return m}function Tie(t,e,n=Si){const r=Array.isArray(e)?e:[e];let s=t.from;const i=n.differenceInCalendarDays(t.to,t.from),o=Math.min(i,6);for(let l=0;l<=o;l++){if(r.includes(s.getDay()))return!0;s=n.addDays(s,1)}return!1}function cO(t,e,n=Si){return oo(t,e.from,!1,n)||oo(t,e.to,!1,n)||oo(e,t.from,!1,n)||oo(e,t.to,!1,n)}function Nie(t,e,n=Si){const r=Array.isArray(e)?e:[e];if(r.filter(l=>typeof l!="function").some(l=>typeof l=="boolean"?l:n.isDate(l)?oo(t,l,!1,n):U$(l,n)?l.some(u=>oo(t,u,!1,n)):Wy(l)?l.from&&l.to?cO(t,{from:l.from,to:l.to},n):!1:H$(l)?Tie(t,l.dayOfWeek,n):$C(l)?n.isAfter(l.before,l.after)?cO(t,{from:n.addDays(l.after,1),to:n.addDays(l.before,-1)},n):ao(t.from,l,n)||ao(t.to,l,n):zC(l)||BC(l)?ao(t.from,l,n)||ao(t.to,l,n):!1))return!0;const o=r.filter(l=>typeof l=="function");if(o.length){let l=t.from;const u=n.differenceInCalendarDays(t.to,t.from);for(let d=0;d<=u;d++){if(o.some(h=>h(l)))return!0;l=n.addDays(l,1)}}return!1}function Mie(t,e){const{disabled:n,excludeDisabled:r,resetOnSelect:s,selected:i,required:o,onSelect:l}=t,[u,d]=qy(i,l?i:void 0),h=l?i:u;return{selected:h,select:(b,v,x)=>{const{min:k,max:E}=t;let M;if(b){const _=h?.from,N=h?.to,T=!!_&&!!N,A=!!_&&!!N&&e.isSameDay(_,N)&&e.isSameDay(b,_);s&&(T||!h?.from)?!o&&A?M=void 0:M={from:b,to:void 0}:M=Eie(b,h,k,E,o,e)}return r&&n&&M?.from&&M.to&&Nie({from:M.from,to:M.to},n,e)&&(M.from=b,M.to=void 0),l||d(M),l?.(M,b,v,x),M},isSelected:b=>h&&oo(h,b,!1,e)}}function _ie(t,e){const{selected:n,required:r,onSelect:s}=t,[i,o]=qy(n,s?n:void 0),l=s?n:i,{isSameDay:u}=e;return{selected:l,select:(m,y,b)=>{let v=m;return!r&&l&&l&&u(m,l)&&(v=void 0),s||o(v),s?.(v,m,y,b),v},isSelected:m=>l?u(l,m):!1}}function Aie(t,e){const n=_ie(t,e),r=Cie(t,e),s=Mie(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function ks(t,e){return t instanceof pr&&t.timeZone===e?t:new pr(t,e)}function Lc(t,e,n){return ks(t,e)}function uO(t,e,n){return typeof t=="boolean"||typeof t=="function"?t:t instanceof Date?Lc(t,e):Array.isArray(t)?t.map(r=>r instanceof Date?Lc(r,e):r):Wy(t)?{...t,from:t.from?ks(t.from,e):t.from,to:t.to?ks(t.to,e):t.to}:$C(t)?{before:Lc(t.before,e),after:Lc(t.after,e)}:zC(t)?{after:Lc(t.after,e)}:BC(t)?{before:Lc(t.before,e)}:t}function _w(t,e,n){return t&&(Array.isArray(t)?t.map(r=>uO(r,e)):uO(t,e))}function Rie(t){let e=t;const n=e.timeZone;if(n&&(e={...t,timeZone:n},e.today&&(e.today=ks(e.today,n)),e.month&&(e.month=ks(e.month,n)),e.defaultMonth&&(e.defaultMonth=ks(e.defaultMonth,n)),e.startMonth&&(e.startMonth=ks(e.startMonth,n)),e.endMonth&&(e.endMonth=ks(e.endMonth,n)),e.mode==="single"&&e.selected?e.selected=ks(e.selected,n):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(ve=>ks(ve,n)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?ks(e.selected.from,n):e.selected.from,to:e.selected.to?ks(e.selected.to,n):e.selected.to}),e.disabled!==void 0&&(e.disabled=_w(e.disabled,n)),e.hidden!==void 0&&(e.hidden=_w(e.hidden,n)),e.modifiers)){const ve={};Object.keys(e.modifiers).forEach(Ie=>{ve[Ie]=_w(e.modifiers?.[Ie],n)}),e.modifiers=ve}const{components:r,formatters:s,labels:i,dateLib:o,locale:l,classNames:u}=C.useMemo(()=>{const ve={...B$,...e.locale},Ie=e.broadcastCalendar?1:e.weekStartsOn,Re=e.noonSafe&&e.timeZone?aie(e.timeZone,{weekStartsOn:Ie,locale:ve}):void 0,Qe=e.dateLib&&Re?{...Re,...e.dateLib}:e.dateLib??Re,gt=new ls({locale:ve,weekStartsOn:Ie,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},Qe);return{dateLib:gt,components:Bse(e.components),formatters:Xse(e.formatters),labels:nie(e.labels,gt.options),locale:ve,classNames:{...Vse(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.noonSafe,e.components,e.formatters,e.labels,e.classNames]);e.today||(e={...e,today:o.today()});const{captionLayout:d,mode:h,navLayout:m,numberOfMonths:y=1,onDayBlur:b,onDayClick:v,onDayFocus:x,onDayKeyDown:k,onDayMouseEnter:E,onDayMouseLeave:M,onNextClick:_,onPrevClick:N,showWeekNumber:T,styles:A}=e,{formatCaption:j,formatDay:P,formatMonthDropdown:O,formatWeekNumber:G,formatWeekNumberHeader:B,formatWeekdayName:W,formatYearDropdown:K}=s,Q=wie(e,o),{days:ee,months:F,navStart:I,navEnd:z,previousMonth:J,nextMonth:X,goToMonth:L}=Q,q=$se(ee,e,I,z,o),{isSelected:ie,select:de,selected:Te}=Aie(e,o)??{},{blur:De,focused:je,isFocusTarget:Ne,moveFocus:oe,setFocused:ye}=kie(e,Q,q,ie??(()=>!1),o),{labelDayButton:Pe,labelGridcell:Ye,labelGrid:Ke,labelMonthDropdown:ut,labelNav:Xe,labelPrevious:Vt,labelNext:un,labelWeekday:qt,labelWeekNumber:kn,labelWeekNumberHeader:dn,labelYearDropdown:In}=i,Ln=C.useMemo(()=>iie(o,e.ISOWeek,e.broadcastCalendar,e.today),[o,e.ISOWeek,e.broadcastCalendar,e.today]),Yn=h!==void 0||v!==void 0,ht=C.useCallback(()=>{J&&(L(J),N?.(J))},[J,L,N]),Bn=C.useCallback(()=>{X&&(L(X),_?.(X))},[L,X,_]),lr=C.useCallback((ve,Ie)=>Re=>{Re.preventDefault(),Re.stopPropagation(),ye(ve),!Ie.disabled&&(de?.(ve.date,Ie,Re),v?.(ve.date,Ie,Re))},[de,v,ye]),vr=C.useCallback((ve,Ie)=>Re=>{ye(ve),x?.(ve.date,Ie,Re)},[x,ye]),Pn=C.useCallback((ve,Ie)=>Re=>{De(),b?.(ve.date,Ie,Re)},[De,b]),xe=C.useCallback((ve,Ie)=>Re=>{const Qe={ArrowLeft:[Re.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[Re.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[Re.shiftKey?"year":"week","after"],ArrowUp:[Re.shiftKey?"year":"week","before"],PageUp:[Re.shiftKey?"year":"month","before"],PageDown:[Re.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Qe[Re.key]){Re.preventDefault(),Re.stopPropagation();const[gt,Ze]=Qe[Re.key];oe(gt,Ze)}k?.(ve.date,Ie,Re)},[oe,k,e.dir]),$e=C.useCallback((ve,Ie)=>Re=>{E?.(ve.date,Ie,Re)},[E]),$=C.useCallback((ve,Ie)=>Re=>{M?.(ve.date,Ie,Re)},[M]),V=C.useCallback(ve=>Ie=>{const Re=Number(Ie.target.value),Qe=o.setMonth(o.startOfMonth(ve),Re);L(Qe)},[o,L]),U=C.useCallback(ve=>Ie=>{const Re=Number(Ie.target.value),Qe=o.setYear(o.startOfMonth(ve),Re);L(Qe)},[o,L]),{className:ae,style:ce}=C.useMemo(()=>({className:[u[We.Root],e.className].filter(Boolean).join(" "),style:{...A?.[We.Root],...e.style}}),[u,e.className,e.style,A]),be=Fse(e),Ce=C.useRef(null);die(Ce,!!e.animate,{classNames:u,months:F,focused:je,dateLib:o});const Ae={dayPickerProps:e,selected:Te,select:de,isSelected:ie,months:F,nextMonth:X,previousMonth:J,goToMonth:L,getModifiers:q,components:r,classNames:u,styles:A,labels:i,formatters:s};return fe.createElement(V$.Provider,{value:Ae},fe.createElement(r.Root,{rootRef:e.animate?Ce:void 0,className:ae,style:ce,dir:e.dir,id:e.id,lang:e.lang??l.code,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...be},fe.createElement(r.Months,{className:u[We.Months],style:A?.[We.Months]},!e.hideNavigation&&!m&&fe.createElement(r.Nav,{"data-animated-nav":e.animate?"true":void 0,className:u[We.Nav],style:A?.[We.Nav],"aria-label":Xe(),onPreviousClick:ht,onNextClick:Bn,previousMonth:J,nextMonth:X}),F.map((ve,Ie)=>fe.createElement(r.Month,{"data-animated-month":e.animate?"true":void 0,className:u[We.Month],style:A?.[We.Month],key:Ie,displayIndex:Ie,calendarMonth:ve},m==="around"&&!e.hideNavigation&&Ie===0&&fe.createElement(r.PreviousMonthButton,{type:"button",className:u[We.PreviousMonthButton],tabIndex:J?void 0:-1,"aria-disabled":J?void 0:!0,"aria-label":Vt(J),onClick:ht,"data-animated-button":e.animate?"true":void 0},fe.createElement(r.Chevron,{disabled:J?void 0:!0,className:u[We.Chevron],orientation:e.dir==="rtl"?"right":"left"})),fe.createElement(r.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:u[We.MonthCaption],style:A?.[We.MonthCaption],calendarMonth:ve,displayIndex:Ie},d?.startsWith("dropdown")?fe.createElement(r.DropdownNav,{className:u[We.Dropdowns],style:A?.[We.Dropdowns]},(()=>{const Re=d==="dropdown"||d==="dropdown-months"?fe.createElement(r.MonthsDropdown,{key:"month",className:u[We.MonthsDropdown],"aria-label":ut(),classNames:u,components:r,disabled:!!e.disableNavigation,onChange:V(ve.date),options:rie(ve.date,I,z,s,o),style:A?.[We.Dropdown],value:o.getMonth(ve.date)}):fe.createElement("span",{key:"month"},O(ve.date,o)),Qe=d==="dropdown"||d==="dropdown-years"?fe.createElement(r.YearsDropdown,{key:"year",className:u[We.YearsDropdown],"aria-label":In(o.options),classNames:u,components:r,disabled:!!e.disableNavigation,onChange:U(ve.date),options:oie(I,z,s,o,!!e.reverseYears),style:A?.[We.Dropdown],value:o.getYear(ve.date)}):fe.createElement("span",{key:"year"},K(ve.date,o));return o.getMonthYearOrder()==="year-first"?[Qe,Re]:[Re,Qe]})(),fe.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},j(ve.date,o.options,o))):fe.createElement(r.CaptionLabel,{className:u[We.CaptionLabel],role:"status","aria-live":"polite"},j(ve.date,o.options,o))),m==="around"&&!e.hideNavigation&&Ie===y-1&&fe.createElement(r.NextMonthButton,{type:"button",className:u[We.NextMonthButton],tabIndex:X?void 0:-1,"aria-disabled":X?void 0:!0,"aria-label":un(X),onClick:Bn,"data-animated-button":e.animate?"true":void 0},fe.createElement(r.Chevron,{disabled:X?void 0:!0,className:u[We.Chevron],orientation:e.dir==="rtl"?"left":"right"})),Ie===y-1&&m==="after"&&!e.hideNavigation&&fe.createElement(r.Nav,{"data-animated-nav":e.animate?"true":void 0,className:u[We.Nav],style:A?.[We.Nav],"aria-label":Xe(),onPreviousClick:ht,onNextClick:Bn,previousMonth:J,nextMonth:X}),fe.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":h==="multiple"||h==="range","aria-label":Ke(ve.date,o.options,o)||void 0,className:u[We.MonthGrid],style:A?.[We.MonthGrid]},!e.hideWeekdays&&fe.createElement(r.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:u[We.Weekdays],style:A?.[We.Weekdays]},T&&fe.createElement(r.WeekNumberHeader,{"aria-label":dn(o.options),className:u[We.WeekNumberHeader],style:A?.[We.WeekNumberHeader],scope:"col"},B()),Ln.map(Re=>fe.createElement(r.Weekday,{"aria-label":qt(Re,o.options,o),className:u[We.Weekday],key:String(Re),style:A?.[We.Weekday],scope:"col"},W(Re,o.options,o)))),fe.createElement(r.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:u[We.Weeks],style:A?.[We.Weeks]},ve.weeks.map(Re=>fe.createElement(r.Week,{className:u[We.Week],key:Re.weekNumber,style:A?.[We.Week],week:Re},T&&fe.createElement(r.WeekNumber,{week:Re,style:A?.[We.WeekNumber],"aria-label":kn(Re.weekNumber,{locale:l}),className:u[We.WeekNumber],scope:"row",role:"rowheader"},G(Re.weekNumber,o)),Re.days.map(Qe=>{const{date:gt}=Qe,Ze=q(Qe);if(Ze[an.focused]=!Ze.hidden&&!!je?.isEqualTo(Qe),Ze[Ks.selected]=ie?.(gt)||Ze.selected,Wy(Te)){const{from:Kn,to:Zn}=Te;Ze[Ks.range_start]=!!(Kn&&Zn&&o.isSameDay(gt,Kn)),Ze[Ks.range_end]=!!(Kn&&Zn&&o.isSameDay(gt,Zn)),Ze[Ks.range_middle]=oo(Te,gt,!0,o)}const _r=sie(Ze,A,e.modifiersStyles),Vr=zse(Ze,u,e.modifiersClassNames),wr=!Yn&&!Ze.hidden?Ye(gt,Ze,o.options,o):void 0;return fe.createElement(r.Day,{key:`${Qe.isoDate}_${Qe.displayMonthId}`,day:Qe,modifiers:Ze,className:Vr.join(" "),style:_r,role:"gridcell","aria-selected":Ze.selected||void 0,"aria-label":wr,"data-day":Qe.isoDate,"data-month":Qe.outside?Qe.dateMonthId:void 0,"data-selected":Ze.selected||void 0,"data-disabled":Ze.disabled||void 0,"data-hidden":Ze.hidden||void 0,"data-outside":Qe.outside||void 0,"data-focused":Ze.focused||void 0,"data-today":Ze.today||void 0},!Ze.hidden&&Yn?fe.createElement(r.DayButton,{className:u[We.DayButton],style:A?.[We.DayButton],type:"button",day:Qe,modifiers:Ze,disabled:!Ze.focused&&Ze.disabled||void 0,"aria-disabled":Ze.focused&&Ze.disabled||void 0,tabIndex:Ne(Qe)?0:-1,"aria-label":Pe(gt,Ze,o.options,o),onClick:lr(Qe,Ze),onBlur:Pn(Qe,Ze),onFocus:vr(Qe,Ze),onKeyDown:xe(Qe,Ze),onMouseEnter:$e(Qe,Ze),onMouseLeave:$(Qe,Ze)},P(gt,o.options,o)):!Ze.hidden&&P(Qe.date,o.options,o))})))))))),e.footer&&fe.createElement(r.Footer,{className:u[We.Footer],style:A?.[We.Footer],role:"status","aria-live":"polite"},e.footer)))}function Vf(t){return String(t).padStart(2,"0")}function dO(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}const Aw=[{id:"America/New_York",label:"Eastern (ET)"},{id:"America/Chicago",label:"Central (CT)"},{id:"America/Denver",label:"Mountain (MT)"},{id:"America/Los_Angeles",label:"Pacific (PT)"},{id:"America/Phoenix",label:"Arizona (MST)"},{id:"America/Anchorage",label:"Alaska (AKT)"},{id:"Pacific/Honolulu",label:"Hawaii (HST)"},{id:"UTC",label:"UTC"},{id:"Europe/London",label:"London (GMT/BST)"},{id:"Europe/Paris",label:"Central Europe (CET)"},{id:"Asia/Tokyo",label:"Tokyo (JST)"},{id:"Australia/Sydney",label:"Sydney (AEST)"}];function Oie(t){return new Set(Aw.map(n=>n.id)).has(t)?Aw:[{id:t,label:t.replace(/_/g," ")},...Aw]}function rz(t,e){const n=Object.fromEntries(new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(t).filter(r=>r.type!=="literal").map(r=>[r.type,r.value]));return{date:`${n.year}-${n.month}-${n.day}`,time:`${n.hour}:${n.minute}`}}function xS(t,e){if(!t.date)return"";const n=t.time||"00:00",r=t.date.split("-").map(Number),s=n.split(":").map(Number),i=r[0],o=r[1],l=r[2],u=s[0],d=s[1];if(i===void 0||o===void 0||l===void 0||u===void 0||d===void 0||![i,o,l,u,d].every(Number.isFinite))return"";const h=Date.UTC(i,o-1,l,u,d,0);let m=h;for(let y=0;y<2;y+=1){const b=rz(new Date(m),e),v=b.date.split("-").map(Number),x=b.time.split(":").map(Number),k=v[0],E=v[1],M=v[2],_=x[0],N=x[1];if(k===void 0||E===void 0||M===void 0||_===void 0||N===void 0)break;const T=Date.UTC(k,E-1,M,_,N,0);m-=T-h}return new Date(m).toISOString()}function fO(t,e){if(typeof t!="string")return{date:"",time:""};const n=t.trim();if(!n)return{date:"",time:""};const r=Date.parse(n);if(Number.isFinite(r))return rz(new Date(r),e);const s=n.match(/^(\d{4}-\d{2}-\d{2})(?:[T\s](\d{2}:\d{2})(?::\d{2})?)?/);return s?{date:s[1]??"",time:s[2]??"00:00"}:{date:"",time:""}}function jie(t,e){const n=(t-1)%12+1;return e==="AM"?n===12?0:n:n===12?12:n+12}function sz(t){const[e,n]=(t||"12:00").split(":");let r=Number(e);const s=Vf(Number.isFinite(Number(n))?Number(n):0);Number.isFinite(r)||(r=12);const i=r>=12?"PM":"AM",o=r%12===0?12:r%12;return{hour12:String(o),minute:s,meridiem:i}}function hO(t){const e=Number(t.hour12),n=Number.isFinite(e)?e:12;return`${Vf(jie(n,t.meridiem))}:${t.minute||"00"}`}function iz(t){if(!t)return;const[e,n,r]=t.split("-").map(Number);if(!(!e||!n||!r))return new Date(e,n-1,r)}function pO(t){return`${t.getFullYear()}-${Vf(t.getMonth()+1)}-${Vf(t.getDate())}`}function Die(t){const e=iz(t);return e?new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric"}).format(e):"mm/dd/yyyy"}function Iie(t){if(!t)return"--:-- --";const e=sz(t);return`${e.hour12}:${e.minute} ${e.meridiem}`}function oz(t,e=new Date){return new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"short"}).formatToParts(e).find(r=>r.type==="timeZoneName")?.value??t}function Lie(t,e){if(!t.date)return null;const n=xS(t,e);if(!n)return null;const r=new Date(n);return`${new Intl.DateTimeFormat(void 0,{timeZone:e,weekday:"short",month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}).format(r)} ${oz(e,r)}`}const Pie=Array.from({length:12},(t,e)=>String(e+1)),$ie=Array.from({length:60},(t,e)=>Vf(e));function zie(){return p.jsxs("svg",{className:"vertebr-datetime-icon",width:"16",height:"16",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[p.jsx("rect",{x:"3",y:"4.5",width:"14",height:"12",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),p.jsx("path",{d:"M3 8.5h14M7 3v3M13 3v3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function Bie(){return p.jsxs("svg",{className:"vertebr-datetime-icon",width:"16",height:"16",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[p.jsx("circle",{cx:"10",cy:"10",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),p.jsx("path",{d:"M10 6.5V10l2.5 1.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Fie({direction:t}){return p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":"true",children:p.jsx("path",{d:t==="left"?"M8.5 3.5 5 7l3.5 3.5":"M5.5 3.5 9 7l-3.5 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Vie({id:t,name:e,value:n,readOnly:r,onBlur:s,onChange:i,inputRef:o}){const l=C.useId(),[u,d]=C.useState(!1),[h,m]=C.useState(dO),[y,b]=C.useState(()=>fO(n,dO())),v=C.useMemo(()=>Lie(y,h),[y,h]),x=C.useMemo(()=>iz(y.date),[y.date]),k=C.useMemo(()=>sz(y.time||"12:00"),[y.time]),E=C.useMemo(()=>Oie(h),[h]);C.useEffect(()=>{b(fO(n,h))},[n]);const M=(T,A=h)=>{b(T),i(xS(T,A))},_=T=>{const A=hO(T);if(!y.date){M({date:pO(new Date),time:A});return}M({date:y.date,time:A})},N=T=>{m(T),y.date&&i(xS(y,T))};return p.jsxs("div",{className:"vertebr-datetime","data-empty":y.date?"false":"true",children:[p.jsxs(One,{open:r?!1:u,onOpenChange:T=>{r||(d(T),T||s?.())},children:[p.jsxs("div",{className:"vertebr-datetime-shell",children:[p.jsx(jne,{asChild:!0,children:p.jsxs("button",{id:t,ref:o,type:"button",name:e,className:"vertebr-datetime-cell",disabled:r,"aria-labelledby":`${l}-date ${l}-time`,children:[p.jsxs("span",{className:"vertebr-datetime-cell-inner",children:[p.jsx(zie,{}),p.jsxs("span",{className:"vertebr-datetime-cell-copy",children:[p.jsx("span",{className:"vertebr-datetime-cell-label",id:`${l}-date`,children:"Date"}),p.jsx("span",{className:"vertebr-datetime-value","data-empty":y.date?"false":"true",children:Die(y.date)})]})]}),p.jsx("span",{className:"vertebr-datetime-divider","aria-hidden":"true"}),p.jsxs("span",{className:"vertebr-datetime-cell-inner",children:[p.jsx(Bie,{}),p.jsxs("span",{className:"vertebr-datetime-cell-copy",children:[p.jsx("span",{className:"vertebr-datetime-cell-label",id:`${l}-time`,children:"Time"}),p.jsx("span",{className:"vertebr-datetime-value","data-empty":y.time?"false":"true",children:y.time?`${Iie(y.time)} ${oz(h)}`:"--:-- --"})]})]})]})}),y.date&&!r?p.jsx("button",{type:"button",className:"vertebr-datetime-clear","aria-label":"Clear date and time",onClick:()=>{M({date:"",time:""}),d(!1)},children:"Clear"}):null]}),p.jsx(Dne,{children:p.jsxs(Ine,{className:"vertebr-datetime-popover",align:"start",sideOffset:8,collisionPadding:12,onOpenAutoFocus:T=>T.preventDefault(),children:[p.jsx(Rie,{mode:"single",navLayout:"around",selected:x,defaultMonth:x??new Date,onSelect:T=>{T&&M({date:pO(T),time:y.time||hO({hour12:"12",minute:"00",meridiem:"PM"})})},className:"vertebr-day-picker",classNames:{root:"vertebr-day-picker",months:"vertebr-day-picker-months",month:"vertebr-day-picker-month",month_caption:"vertebr-day-picker-caption",month_grid:"vertebr-day-picker-grid",caption_label:"vertebr-day-picker-caption-label",nav:"vertebr-day-picker-nav",button_previous:"vertebr-day-picker-nav-btn",button_next:"vertebr-day-picker-nav-btn",weekdays:"vertebr-day-picker-weekdays",weekday:"vertebr-day-picker-weekday",week:"vertebr-day-picker-week",day:"vertebr-day-picker-day",day_button:"vertebr-day-picker-day-btn",selected:"vertebr-day-picker-selected",today:"vertebr-day-picker-today",outside:"vertebr-day-picker-outside",disabled:"vertebr-day-picker-disabled",hidden:"vertebr-day-picker-hidden"},components:{Chevron:({orientation:T})=>p.jsx(Fie,{direction:T==="left"?"left":"right"})}}),p.jsxs("div",{className:"vertebr-datetime-time-row",children:[p.jsxs("label",{className:"vertebr-datetime-time-field",children:[p.jsx("span",{children:"Hour"}),p.jsx("select",{className:"vertebr-datetime-time-select",value:k.hour12,onChange:T=>_({...k,hour12:T.target.value}),children:Pie.map(T=>p.jsx("option",{value:T,children:T},T))})]}),p.jsx("span",{className:"vertebr-datetime-time-sep","aria-hidden":"true",children:":"}),p.jsxs("label",{className:"vertebr-datetime-time-field",children:[p.jsx("span",{children:"Minute"}),p.jsx("select",{className:"vertebr-datetime-time-select",value:k.minute,onChange:T=>_({...k,minute:T.target.value}),children:$ie.map(T=>p.jsx("option",{value:T,children:T},T))})]}),p.jsxs("label",{className:"vertebr-datetime-time-field vertebr-datetime-time-field-meridiem",children:[p.jsx("span",{children:"AM/PM"}),p.jsxs("select",{className:"vertebr-datetime-time-select",value:k.meridiem,onChange:T=>_({...k,meridiem:T.target.value}),children:[p.jsx("option",{value:"AM",children:"AM"}),p.jsx("option",{value:"PM",children:"PM"})]})]})]}),p.jsxs("label",{className:"vertebr-datetime-time-field vertebr-datetime-timezone",children:[p.jsx("span",{children:"Timezone"}),p.jsx("select",{className:"vertebr-datetime-time-select",value:h,onChange:T=>N(T.target.value),children:E.map(T=>p.jsx("option",{value:T.id,children:T.label},T.id))})]})]})})]}),v?p.jsx("p",{className:"vertebr-datetime-summary",children:v}):p.jsx("p",{className:"vertebr-datetime-summary vertebr-datetime-summary-empty",children:"Pick a launch date and time"})]})}var Hie=Object.defineProperty,Uie=(t,e)=>Hie(t,"name",{value:e,configurable:!0});function SS(t,[e,n]){return Math.min(n,Math.max(e,t))}Uie(SS,"clamp");var Wie=Object.defineProperty,Hn=(t,e)=>Wie(t,"name",{value:e,configurable:!0});function az(t){const e=t+"CollectionProvider",[n,r]=Hl(e),[s,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=Hn(x=>{const{scope:k,children:E}=x,M=C.useRef(null),_=C.useRef(new Map).current;return p.jsx(s,{scope:k,itemMap:_,collectionRef:M,children:E})},"CollectionProvider");o.displayName=e;const l=t+"CollectionSlot",u=Ea(l),d=C.forwardRef((x,k)=>{const{scope:E,children:M}=x,_=i(l,E),N=cn(k,_.collectionRef);return p.jsx(u,{ref:N,children:M})});d.displayName=l;const h=t+"CollectionItemSlot",m="data-radix-collection-item",y=Ea(h),b=C.forwardRef((x,k)=>{const{scope:E,children:M,..._}=x,N=C.useRef(null),T=cn(k,N),A=i(h,E);return C.useEffect(()=>(A.itemMap.set(N,{ref:N,..._}),()=>{A.itemMap.delete(N)})),p.jsx(y,{[m]:"",ref:T,children:M})});b.displayName=h;function v(x){const k=i(t+"CollectionConsumer",x);return C.useCallback(()=>{const M=k.collectionRef.current;if(!M)return[];const _=Array.from(M.querySelectorAll(`[${m}]`));return Array.from(k.itemMap.values()).sort((A,j)=>_.indexOf(A.ref.current)-_.indexOf(j.ref.current))},[k.collectionRef,k.itemMap])}return Hn(v,"useCollection"),[{Provider:o,Slot:d,ItemSlot:b},v,r]}Hn(az,"createCollection");var mO=new WeakMap,_n,es,Rw=(es=class extends Map{constructor(n){super(n);YN(this,_n);g0(this,_n,[...super.keys()]),mO.set(this,!0)}set(n,r){return mO.get(this)&&(this.has(n)?cr(this,_n)[cr(this,_n).indexOf(n)]=n:cr(this,_n).push(n)),super.set(n,r),this}insert(n,r,s){const i=this.has(r),o=cr(this,_n).length,l=HC(n);let u=l>=0?l:o+l;const d=u<0||u>=o?-1:u;if(d===this.size||i&&d===this.size-1||d===-1)return this.set(r,s),this;const h=this.size+(i?0:1);l<0&&u++;const m=[...cr(this,_n)];let y,b=!1;for(let v=u;v<h;v++)if(u===v){let x=m[v];m[v]===r&&(x=m[v+1]),i&&this.delete(r),y=this.get(x),this.set(r,s)}else{!b&&m[v-1]===r&&(b=!0);const x=m[b?v:v-1],k=y;y=this.get(x),this.delete(x),this.set(x,k)}return this}with(n,r,s){const i=new es(this);return i.insert(n,r,s),i}before(n){const r=cr(this,_n).indexOf(n)-1;if(!(r<0))return this.entryAt(r)}setBefore(n,r,s){const i=cr(this,_n).indexOf(n);return i===-1?this:this.insert(i,r,s)}after(n){let r=cr(this,_n).indexOf(n);if(r=r===-1||r===this.size-1?-1:r+1,r!==-1)return this.entryAt(r)}setAfter(n,r,s){const i=cr(this,_n).indexOf(n);return i===-1?this:this.insert(i+1,r,s)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return g0(this,_n,[]),super.clear()}delete(n){const r=super.delete(n);return r&&cr(this,_n).splice(cr(this,_n).indexOf(n),1),r}deleteAt(n){const r=this.keyAt(n);return r!==void 0?this.delete(r):!1}at(n){const r=Pm(cr(this,_n),n);if(r!==void 0)return this.get(r)}entryAt(n){const r=Pm(cr(this,_n),n);if(r!==void 0)return[r,this.get(r)]}indexOf(n){return cr(this,_n).indexOf(n)}keyAt(n){return Pm(cr(this,_n),n)}from(n,r){const s=this.indexOf(n);if(s===-1)return;let i=s+r;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.at(i)}keyFrom(n,r){const s=this.indexOf(n);if(s===-1)return;let i=s+r;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.keyAt(i)}find(n,r){let s=0;for(const i of this){if(Reflect.apply(n,r,[i,s,this]))return i;s++}}findIndex(n,r){let s=0;for(const i of this){if(Reflect.apply(n,r,[i,s,this]))return s;s++}return-1}filter(n,r){const s=[];let i=0;for(const o of this)Reflect.apply(n,r,[o,i,this])&&s.push(o),i++;return new es(s)}map(n,r){const s=[];let i=0;for(const o of this)s.push([o[0],Reflect.apply(n,r,[o,i,this])]),i++;return new es(s)}reduce(...n){const[r,s]=n;let i=0,o=s??this.at(0);for(const l of this)i===0&&n.length===1?o=l:o=Reflect.apply(r,this,[o,l,i,this]),i++;return o}reduceRight(...n){const[r,s]=n;let i=s??this.at(-1);for(let o=this.size-1;o>=0;o--){const l=this.at(o);o===this.size-1&&n.length===1?i=l:i=Reflect.apply(r,this,[i,l,o,this])}return i}toSorted(n){const r=[...this.entries()].sort(n);return new es(r)}toReversed(){const n=new es;for(let r=this.size-1;r>=0;r--){const s=this.keyAt(r),i=this.get(s);n.set(s,i)}return n}toSpliced(...n){const r=[...this.entries()];return r.splice(...n),new es(r)}slice(n,r){const s=new es;let i=this.size-1;if(n===void 0)return s;n<0&&(n=n+this.size),r!==void 0&&r>0&&(i=r-1);for(let o=n;o<=i;o++){const l=this.keyAt(o),u=this.get(l);s.set(l,u)}return s}every(n,r){let s=0;for(const i of this){if(!Reflect.apply(n,r,[i,s,this]))return!1;s++}return!0}some(n,r){let s=0;for(const i of this){if(Reflect.apply(n,r,[i,s,this]))return!0;s++}return!1}},_n=new WeakMap,Hn(es,"OrderedDict"),es);function Pm(t,e){if("at"in Array.prototype)return Array.prototype.at.call(t,e);const n=lz(t,e);return n===-1?void 0:t[n]}Hn(Pm,"at");function lz(t,e){const n=t.length,r=HC(e),s=r>=0?r:n+r;return s<0||s>=n?-1:s}Hn(lz,"toSafeIndex");function HC(t){return t!==t||t===0?0:Math.trunc(t)}Hn(HC,"toSafeInteger");function qie(t){const e=t+"CollectionProvider",[n,r]=Hl(e),[s,i]=n(e,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Rw,setItemMap:Hn(()=>{},"setItemMap")}),o=Hn(({state:_,...N})=>_?p.jsx(u,{...N,state:_}):p.jsx(l,{...N}),"CollectionProvider");o.displayName=e;const l=Hn(_=>{const N=k();return p.jsx(u,{..._,state:N})},"CollectionInit");l.displayName=e+"Init";const u=Hn(_=>{const{scope:N,children:T,state:A}=_,j=C.useRef(null),[P,O]=C.useState(null),G=cn(j,O),[B,W]=A;return C.useEffect(()=>{if(!P)return;const K=dz(()=>{});return K.observe(P,{childList:!0,subtree:!0}),()=>{K.disconnect()}},[P]),p.jsx(s,{scope:N,itemMap:B,setItemMap:W,collectionRef:G,collectionRefObject:j,collectionElement:P,children:T})},"CollectionProviderImpl");u.displayName=e+"Impl";const d=t+"CollectionSlot",h=Ea(d),m=C.forwardRef((_,N)=>{const{scope:T,children:A}=_,j=i(d,T),P=cn(N,j.collectionRef);return p.jsx(h,{ref:P,children:A})});m.displayName=d;const y=t+"CollectionItemSlot",b="data-radix-collection-item",v=Ea(y),x=C.forwardRef((_,N)=>{const{scope:T,children:A,...j}=_,P=C.useRef(null),[O,G]=C.useState(null),B=cn(N,P,G),W=i(y,T),{setItemMap:K}=W,Q=C.useRef(j);cz(Q.current,j)||(Q.current=j);const ee=Q.current;return C.useEffect(()=>{const F=ee;return K(I=>O?I.has(O)?I.set(O,{...F,element:O}).toSorted(kS):(I.set(O,{...F,element:O}),I.toSorted(kS)):I),()=>{K(I=>!O||!I.has(O)?I:(I.delete(O),new Rw(I)))}},[O,ee,K]),p.jsx(v,{[b]:"",ref:B,children:A})});x.displayName=y;function k(){return C.useState(new Rw)}Hn(k,"useInitCollection");function E(_){const{itemMap:N}=i(t+"CollectionConsumer",_);return N}return Hn(E,"useCollection"),[{Provider:o,Slot:m,ItemSlot:x},{createCollectionScope:r,useCollection:E,useInitCollection:k}]}Hn(qie,"createCollection");function cz(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 s of n)if(!Object.prototype.hasOwnProperty.call(e,s)||t[s]!==e[s])return!1;return!0}Hn(cz,"shallowEqual");function uz(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}Hn(uz,"isElementPreceding");function kS(t,e){return!t[1].element||!e[1].element?0:uz(t[1].element,e[1].element)?-1:1}Hn(kS,"sortByDocumentPosition");function dz(t){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){t();return}})}Hn(dz,"getChildListObserver");var Gie=Object.defineProperty,Yie=(t,e)=>Gie(t,"name",{value:e,configurable:!0}),Kie=C.createContext(void 0);function fz(t){const e=C.useContext(Kie);return t||e||"ltr"}Yie(fz,"useDirection");var Zie=Object.defineProperty,Xie=(t,e)=>Zie(t,"name",{value:e,configurable:!0});function hz(t){const e=C.useRef({value:t,previous:t});return C.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}Xie(hz,"usePrevious");var Jie=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"}),Qie=Object.defineProperty,Bt=(t,e)=>Qie(t,"name",{value:e,configurable:!0}),eoe=[" ","Enter","ArrowUp","ArrowDown"],toe=[" ","Enter"],bu="Select",[Gy,UC,noe]=az(bu),[Yl,fue]=Hl(bu,[noe,Vy]),WC=Vy(),[roe,Fa]=Yl(bu),[soe,ioe]=Yl(bu);function pz(t){const{__scopeSelect:e,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:l,onValueChange:u,dir:d,name:h,autoComplete:m,disabled:y,required:b,form:v,internal_do_not_use_render:x}=t,k=WC(e),[E,M]=C.useState(null),[_,N]=C.useState(null),[T,A]=C.useState(!1),j=fz(d),[P,O]=Ef({prop:r,defaultProp:s??!1,onChange:i,caller:bu}),[G,B]=Ef({prop:o,defaultProp:l,onChange:u,caller:bu}),W=C.useRef(null),K=C.useRef(G);C.useEffect(()=>{const q=v?E?.ownerDocument.getElementById(v):E?.form;if(q instanceof HTMLFormElement){const ie=Bt(()=>B(K.current),"reset");return q.addEventListener("reset",ie),()=>q.removeEventListener("reset",ie)}},[v,E,B]);const Q=E?!!v||!!E.closest("form"):!0,[ee,F]=C.useState(new Set),I=Ly(),z=Array.from(ee).map(q=>q.props.value).join(";"),J=C.useCallback(q=>{F(ie=>new Set(ie).add(q))},[]),X=C.useCallback(q=>{F(ie=>{const de=new Set(ie);return de.delete(q),de})},[]),L={required:b,trigger:E,onTriggerChange:M,valueNode:_,onValueNodeChange:N,valueNodeHasChildren:T,onValueNodeHasChildrenChange:A,contentId:I,value:G,onValueChange:B,open:P,onOpenChange:O,dir:j,triggerPointerDownPosRef:W,disabled:y,name:h,autoComplete:m,form:v,nativeOptions:ee,nativeSelectKey:z,isFormControl:Q};return p.jsx(a$,{...k,children:p.jsx(roe,{scope:e,...L,children:p.jsx(Gy.Provider,{scope:e,children:p.jsx(soe,{scope:e,onNativeOptionAdd:J,onNativeOptionRemove:X,children:yz(x)?x(L):n})})})})}Bt(pz,"SelectProvider");var Yy=Bt(t=>{const{__scopeSelect:e,children:n,...r}=t;return p.jsx(pz,{__scopeSelect:e,...r,internal_do_not_use_render:({isFormControl:s})=>p.jsxs(p.Fragment,{children:[n,s?p.jsx(xoe,{__scopeSelect:e}):null]})})},"Select"),ooe="SelectTrigger",Ky=C.forwardRef(Bt(function(e,n){const{__scopeSelect:r,disabled:s=!1,...i}=e,o=WC(r),l=Fa(ooe,r),u=l.disabled||s,d=cn(n,l.onTriggerChange),h=UC(r),m=C.useRef("touch"),[y,b,v]=qC(k=>{const E=h().filter(N=>!N.disabled),M=E.find(N=>N.value===l.value),_=GC(E,k,M);_!==void 0&&l.onValueChange(_.value)}),x=Bt(k=>{u||(l.onOpenChange(!0),v()),k&&(l.triggerPointerDownPosRef.current={x:Math.round(k.pageX),y:Math.round(k.pageY)})},"handleOpen");return p.jsx(l$,{asChild:!0,...o,children:p.jsx(zn.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":fh(l.value)?"":void 0,...i,ref:d,onClick:tn(i.onClick,k=>{k.currentTarget.focus(),m.current!=="mouse"&&x(k)}),onPointerDown:tn(i.onPointerDown,k=>{m.current=k.pointerType;const E=k.target;E.hasPointerCapture(k.pointerId)&&E.releasePointerCapture(k.pointerId),k.button===0&&k.ctrlKey===!1&&k.pointerType==="mouse"&&(x(k),k.preventDefault())}),onKeyDown:tn(i.onKeyDown,k=>{const E=y.current!=="";!(k.ctrlKey||k.altKey||k.metaKey)&&k.key.length===1&&b(k.key),!(E&&k.key===" ")&&eoe.includes(k.key)&&(x(),k.preventDefault())})})})},"SelectTrigger")),aoe="SelectValue",Zy=C.forwardRef(Bt(function(e,n){const{__scopeSelect:r,className:s,style:i,children:o,placeholder:l="",...u}=e,d=Fa(aoe,r),{onValueNodeHasChildrenChange:h}=d,m=o!==void 0,y=cn(n,d.onValueNodeChange);Er(()=>{h(m)},[h,m]);const b=fh(d.value);return p.jsx(zn.span,{...u,asChild:b?!1:u.asChild,ref:y,style:{pointerEvents:"none"},children:p.jsx(C.Fragment,{children:b?l:o},b?"placeholder":"value")})},"SelectValue")),Xy=C.forwardRef(Bt(function(e,n){const{__scopeSelect:r,children:s,...i}=e;return p.jsx(zn.span,{"aria-hidden":!0,...i,ref:n,children:s||"▼"})},"SelectIcon")),loe="SelectPortal",[coe,uoe]=Yl(loe,{forceMount:void 0}),Jy=Bt(t=>{const{__scopeSelect:e,forceMount:n,...r}=t;return p.jsx(coe,{scope:t.__scopeSelect,forceMount:n,children:p.jsx(u$,{asChild:!0,...r})})},"SelectPortal"),zl="SelectContent",Qy=C.forwardRef(Bt(function(e,n){const r=uoe(zl,e.__scopeSelect),{forceMount:s=r.forceMount,...i}=e,o=Fa(zl,e.__scopeSelect),[l,u]=C.useState();return Er(()=>{u(new DocumentFragment)},[]),p.jsx(AC,{present:s||o.open,children:({present:d})=>d?p.jsx(hoe,{...i,ref:n}):p.jsx(doe,{...i,fragment:l})})},"SelectContent")),doe=C.forwardRef(Bt(function(e,n){const{__scopeSelect:r,children:s,fragment:i}=e;return i?Ia.createPortal(p.jsx(mz,{scope:r,children:p.jsx(Gy.Slot,{scope:r,children:p.jsx("div",{ref:n,children:s})})}),i):null},"SelectContentFragment")),Fs=10,[mz,eb]=Yl(zl),foe=Ea("SelectContent.RemoveScroll"),hoe=C.forwardRef(Bt(function(e,n){const{__scopeSelect:r}=e,{position:s="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:l,side:u,sideOffset:d,align:h,alignOffset:m,arrowPadding:y,collisionBoundary:b,collisionPadding:v,sticky:x,hideWhenDetached:k,avoidCollisions:E,...M}=e,_=Fa(zl,r),[N,T]=C.useState(null),[A,j]=C.useState(null),P=cn(n,T),[O,G]=C.useState(null),[B,W]=C.useState(null),K=UC(r),[Q,ee]=C.useState(!1),F=C.useRef(!1);C.useEffect(()=>{if(N)return g$(N)},[N]),Iy();const I=C.useCallback(Ne=>{const[oe,...ye]=K().map(Ke=>Ke.ref.current),[Pe]=ye.slice(-1),Ye=document.activeElement;for(const Ke of Ne)if(Ke===Ye||(Ke?.scrollIntoView({block:"nearest"}),Ke===oe&&A&&(A.scrollTop=0),Ke===Pe&&A&&(A.scrollTop=A.scrollHeight),Ke?.focus(),document.activeElement!==Ye))return},[K,A]),z=C.useCallback(()=>I([O,N]),[I,O,N]);C.useEffect(()=>{Q&&z()},[Q,z]);const{onOpenChange:J,triggerPointerDownPosRef:X}=_;C.useEffect(()=>{if(N){let Ne={x:0,y:0};const oe=Bt(Pe=>{Ne={x:Math.abs(Math.round(Pe.pageX)-(X.current?.x??0)),y:Math.abs(Math.round(Pe.pageY)-(X.current?.y??0))}},"handlePointerMove"),ye=Bt(Pe=>{Ne.x<=10&&Ne.y<=10?Pe.preventDefault():Pe.composedPath().includes(N)||J(!1),document.removeEventListener("pointermove",oe),X.current=null},"handlePointerUp");return X.current!==null&&(document.addEventListener("pointermove",oe),document.addEventListener("pointerup",ye,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",oe),document.removeEventListener("pointerup",ye,{capture:!0})}}},[N,J,X]),C.useEffect(()=>{const Ne=Bt(()=>J(!1),"close");return window.addEventListener("blur",Ne),window.addEventListener("resize",Ne),()=>{window.removeEventListener("blur",Ne),window.removeEventListener("resize",Ne)}},[J]);const[L,q]=qC(Ne=>{const oe=K().filter(Ye=>!Ye.disabled),ye=oe.find(Ye=>Ye.ref.current===document.activeElement),Pe=GC(oe,Ne,ye);Pe&&setTimeout(()=>Pe.ref.current?.focus())}),ie=C.useCallback((Ne,oe,ye)=>{const Pe=!F.current&&!ye;(_.value!==void 0&&_.value===oe||Pe)&&(G(Ne),Pe&&(F.current=!0))},[_.value]),de=C.useCallback(()=>N?.focus(),[N]),Te=C.useCallback((Ne,oe,ye)=>{const Pe=!F.current&&!ye;(_.value!==void 0&&_.value===oe||Pe)&&W(Ne)},[_.value]),De=s==="popper"?gO:poe,je=De===gO?{side:u,sideOffset:d,align:h,alignOffset:m,arrowPadding:y,collisionBoundary:b,collisionPadding:v,sticky:x,hideWhenDetached:k,avoidCollisions:E}:{};return p.jsx(mz,{scope:r,content:N,viewport:A,onViewportChange:j,itemRefCallback:ie,selectedItem:O,onItemLeave:de,itemTextRefCallback:Te,focusSelectedItem:z,selectedItemText:B,position:s,isPositioned:Q,searchRef:L,children:p.jsx(RC,{as:foe,allowPinchZoom:!0,children:p.jsx($2,{asChild:!0,trapped:_.open,onMountAutoFocus:Ne=>{Ne.preventDefault()},onUnmountAutoFocus:tn(i,Ne=>{_.trigger?.focus({preventScroll:!0}),Ne.preventDefault()}),children:p.jsx(I2,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:Ne=>Ne.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:p.jsx(De,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:Ne=>Ne.preventDefault(),...M,...je,onPlaced:()=>ee(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...M.style},onKeyDown:tn(M.onKeyDown,Ne=>{const oe=Ne.ctrlKey||Ne.altKey||Ne.metaKey;if(Ne.key==="Tab"&&Ne.preventDefault(),!oe&&Ne.key.length===1&&q(Ne.key),["ArrowUp","ArrowDown","Home","End"].includes(Ne.key)){let Pe=K().filter(Ye=>!Ye.disabled).map(Ye=>Ye.ref.current);if(["ArrowUp","End"].includes(Ne.key)&&(Pe=Pe.slice().reverse()),["ArrowUp","ArrowDown"].includes(Ne.key)){const Ye=Ne.target,Ke=Pe.indexOf(Ye);Pe=Pe.slice(Ke+1)}setTimeout(()=>I(Pe)),Ne.preventDefault()}})})})})})})},"SelectContentImpl")),poe=C.forwardRef(Bt(function(e,n){const{__scopeSelect:r,onPlaced:s,...i}=e,o=Fa(zl,r),l=eb(zl,r),[u,d]=C.useState(null),[h,m]=C.useState(null),y=cn(n,m),b=UC(r),v=C.useRef(!1),x=C.useRef(!0),{viewport:k,selectedItem:E,selectedItemText:M,focusSelectedItem:_}=l,N=C.useCallback(()=>{if(o.trigger&&o.valueNode&&u&&h&&k&&E&&M){const P=o.trigger.getBoundingClientRect(),O=h.getBoundingClientRect(),G=o.valueNode.getBoundingClientRect(),B=M.getBoundingClientRect();if(o.dir!=="rtl"){const Ye=B.left-O.left,Ke=G.left-Ye,ut=P.left-Ke,Xe=P.width+ut,Vt=Math.max(Xe,O.width),un=window.innerWidth-Fs,qt=SS(Ke,[Fs,Math.max(Fs,un-Vt)]);u.style.minWidth=Xe+"px",u.style.left=qt+"px"}else{const Ye=O.right-B.right,Ke=window.innerWidth-G.right-Ye,ut=window.innerWidth-P.right-Ke,Xe=P.width+ut,Vt=Math.max(Xe,O.width),un=window.innerWidth-Fs,qt=SS(Ke,[Fs,Math.max(Fs,un-Vt)]);u.style.minWidth=Xe+"px",u.style.right=qt+"px"}const W=b(),K=window.innerHeight-Fs*2,Q=k.scrollHeight,ee=window.getComputedStyle(h),F=parseInt(ee.borderTopWidth,10),I=parseInt(ee.paddingTop,10),z=parseInt(ee.borderBottomWidth,10),J=parseInt(ee.paddingBottom,10),X=F+I+Q+J+z,L=Math.min(E.offsetHeight*5,X),q=window.getComputedStyle(k),ie=parseInt(q.paddingTop,10),de=parseInt(q.paddingBottom,10),Te=P.top+P.height/2-Fs,De=K-Te,je=E.offsetHeight/2,Ne=E.offsetTop+je,oe=F+I+Ne,ye=X-oe;if(oe<=Te){const Ye=W.length>0&&E===W[W.length-1].ref.current;u.style.bottom="0px";const Ke=h.clientHeight-k.offsetTop-k.offsetHeight,ut=Math.max(De,je+(Ye?de:0)+Ke+z),Xe=oe+ut;u.style.height=Xe+"px"}else{const Ye=W.length>0&&E===W[0].ref.current;u.style.top="0px";const ut=Math.max(Te,F+k.offsetTop+(Ye?ie:0)+je)+ye;u.style.height=ut+"px",k.scrollTop=oe-Te+k.offsetTop}u.style.margin=`${Fs}px 0`,u.style.minHeight=L+"px",u.style.maxHeight=K+"px",s?.(),requestAnimationFrame(()=>v.current=!0)}},[b,o.trigger,o.valueNode,u,h,k,E,M,o.dir,s]);Er(()=>N(),[N]);const[T,A]=C.useState();Er(()=>{h&&A(window.getComputedStyle(h).zIndex)},[h]);const j=C.useCallback(P=>{P&&x.current===!0&&(N(),_?.(),x.current=!1)},[N,_]);return p.jsx(moe,{scope:r,contentWrapper:u,shouldExpandOnScrollRef:v,onScrollButtonChange:j,children:p.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:p.jsx(zn.div,{...i,ref:y,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})},"SelectItemAlignedPosition")),gO=C.forwardRef(Bt(function(e,n){const{__scopeSelect:r,align:s="start",collisionPadding:i=Fs,...o}=e,l=WC(r);return p.jsx(c$,{...l,...o,ref:n,align:s,collisionPadding:i,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")),[moe,goe]=Yl(zl,{}),yO="SelectViewport",tb=C.forwardRef(Bt(function(e,n){const{__scopeSelect:r,nonce:s,...i}=e,o=eb(yO,r),l=goe(yO,r),u=cn(n,o.onViewportChange),d=C.useRef(0);return p.jsxs(p.Fragment,{children:[p.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:s}),p.jsx(Gy.Slot,{scope:r,children:p.jsx(zn.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:tn(i.onScroll,h=>{const m=h.currentTarget,{contentWrapper:y,shouldExpandOnScrollRef:b}=l;if(b?.current&&y){const v=Math.abs(d.current-m.scrollTop);if(v>0){const x=window.innerHeight-Fs*2,k=parseFloat(y.style.minHeight),E=parseFloat(y.style.height),M=Math.max(k,E);if(M<x){const _=M+v,N=Math.min(x,_),T=_-N;y.style.height=N+"px",y.style.bottom==="0px"&&(m.scrollTop=T>0?T:0,y.style.justifyContent="flex-end")}}}d.current=m.scrollTop})})})]})},"SelectViewport")),yoe="SelectGroup",[hue,pue]=Yl(yoe),CS="SelectItem",[boe,gz]=Yl(CS),nb=C.forwardRef(Bt(function(e,n){const{__scopeSelect:r,value:s,disabled:i=!1,textValue:o,...l}=e,u=Fa(CS,r),d=eb(CS,r),h=u.value===s,[m,y]=C.useState(o??""),[b,v]=C.useState(!1),x=bi(N=>d.itemRefCallback?.(N,s,i)),k=cn(n,x),E=Ly(),M=C.useRef("touch"),_=Bt(()=>{i||(u.onValueChange(s),u.onOpenChange(!1))},"handleSelect");return p.jsx(boe,{scope:r,value:s,disabled:i,textId:E,isSelected:h,onItemTextChange:C.useCallback(N=>{y(T=>T||(N?.textContent??"").trim())},[]),children:p.jsx(Gy.ItemSlot,{scope:r,value:s,disabled:i,textValue:m,children:p.jsx(zn.div,{role:"option","aria-labelledby":E,"data-highlighted":b?"":void 0,"aria-selected":h&&b,"data-state":h?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...l,ref:k,onFocus:tn(l.onFocus,()=>v(!0)),onBlur:tn(l.onBlur,()=>v(!1)),onClick:tn(l.onClick,()=>{M.current!=="mouse"&&_()}),onPointerUp:tn(l.onPointerUp,()=>{M.current==="mouse"&&_()}),onPointerDown:tn(l.onPointerDown,N=>{M.current=N.pointerType}),onPointerMove:tn(l.onPointerMove,N=>{M.current=N.pointerType,i?d.onItemLeave?.():M.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:tn(l.onPointerLeave,N=>{N.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:tn(l.onKeyDown,N=>{i||N.target!==N.currentTarget||d.searchRef?.current!==""&&N.key===" "||(toe.includes(N.key)&&_(),N.key===" "&&N.preventDefault())})})})})},"SelectItem")),sm="SelectItemText",rb=C.forwardRef(Bt(function(e,n){const{__scopeSelect:r,className:s,style:i,...o}=e,l=Fa(sm,r),u=eb(sm,r),d=gz(sm,r),h=ioe(sm,r),[m,y]=C.useState(null),b=bi(_=>u.itemTextRefCallback?.(_,d.value,d.disabled)),v=cn(n,y,d.onItemTextChange,b),x=m?.textContent,k=C.useMemo(()=>p.jsx("option",{value:d.value,disabled:d.disabled,children:x},d.value),[d.disabled,d.value,x]),{onNativeOptionAdd:E,onNativeOptionRemove:M}=h;return Er(()=>(E(k),()=>M(k)),[E,M,k]),p.jsxs(p.Fragment,{children:[p.jsx(zn.span,{id:d.textId,...o,ref:v}),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren&&!fh(l.value)?Ia.createPortal(o.children,l.valueNode):null]})},"SelectItemText")),voe="SelectItemIndicator",sb=C.forwardRef(Bt(function(e,n){const{__scopeSelect:r,...s}=e;return gz(voe,r).isSelected?p.jsx(zn.span,{"aria-hidden":!0,...s,ref:n}):null},"SelectItemIndicator")),woe="SelectBubbleInput",xoe=C.forwardRef(Bt(function({__scopeSelect:e,...n},r){const s=Fa(woe,e),{value:i,onValueChange:o,required:l,disabled:u,name:d,autoComplete:h,form:m}=s,{nativeOptions:y,nativeSelectKey:b}=s,v=C.useRef(null),x=cn(r,v),k=i??"",E=hz(k),M=Array.from(y).some(_=>(_.props.value??"")==="");return C.useEffect(()=>{const _=v.current;if(!_)return;const N=window.HTMLSelectElement.prototype,A=Object.getOwnPropertyDescriptor(N,"value").set;if(E!==k&&A){const j=new Event("change",{bubbles:!0});A.call(_,k),_.dispatchEvent(j)}},[E,k]),p.jsxs(zn.select,{"aria-hidden":!0,required:l,tabIndex:-1,name:d,autoComplete:h,disabled:u,form:m,onChange:_=>o(_.target.value),...n,style:{...Jie,...n.style},ref:x,defaultValue:k,children:[fh(i)&&!M?p.jsx("option",{value:""}):null,Array.from(y)]},b)},"SelectBubbleInput"));function yz(t){return typeof t=="function"}Bt(yz,"isFunction");function fh(t){return t===""||t===void 0}Bt(fh,"shouldShowPlaceholder");function qC(t){const e=bi(t),n=C.useRef(""),r=C.useRef(0),s=C.useCallback(o=>{const l=n.current+o;e(l),Bt((function u(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>u(""),1e3))}),"updateSearch")(l)},[e]),i=C.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return C.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}Bt(qC,"useTypeaheadSearch");function GC(t,e,n){const s=e.length>1&&Array.from(e).every(d=>d===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let o=bz(t,Math.max(i,0));s.length===1&&(o=o.filter(d=>d!==n));const u=o.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return u!==n?u:void 0}Bt(GC,"findNextItem");function bz(t,e){return t.map((n,r)=>t[(e+r)%t.length])}Bt(bz,"wrapArray");function YC({id:t,value:e,field:n,readOnly:r,onChange:s}){const i=n.options?.filter(Boolean)??[],o=typeof e=="string"?e:"",l=o&&!i.includes(o)?[o,...i]:i,u=n.required!==!0,d=o&&l.includes(o)?o:u?"":l[0]??"";return l.length===0?p.jsx("input",{id:t,type:"text",readOnly:r,value:d,disabled:!0}):p.jsxs("div",{className:"vertebr-enum",children:[p.jsxs(Yy,{value:d||void 0,onValueChange:s,disabled:r,children:[p.jsxs(Ky,{id:t,className:"vertebr-select-trigger",children:[p.jsx("span",{className:"vertebr-select-value",children:p.jsx(Zy,{placeholder:"None"})}),p.jsx(Xy,{className:"vertebr-select-icon",children:p.jsx(Soe,{})})]}),p.jsx(Jy,{children:p.jsx(Qy,{className:"vertebr-select-content",position:"popper",sideOffset:6,children:p.jsx(tb,{className:"vertebr-select-viewport",children:l.map(h=>p.jsxs(nb,{value:h,className:"vertebr-select-item",children:[p.jsx(rb,{children:km(h,n)}),p.jsx(sb,{className:"vertebr-select-check",children:p.jsx(koe,{})})]},h))})})})]}),u&&d&&!r?p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-enum-clear",onClick:()=>s(""),children:"Clear"}):null]})}function Soe(){return p.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:p.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function koe(){return p.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:p.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 Coe(t){return Array.isArray(t)?t.map(e=>String(e).trim()).filter(Boolean):typeof t=="string"?t.split(",").map(e=>e.trim()).filter(Boolean):[]}function Eoe(t,e){const n=new Set(t),r=e.filter(i=>n.has(i)),s=t.filter(i=>!r.includes(i));return[...r.map(i=>({id:i,on:!0})),...s.map(i=>({id:i,on:!1}))]}function Toe({id:t,value:e,field:n,readOnly:r,onChange:s}){const i=n.options?.filter(Boolean)??[],o=Coe(e),l=Eoe(i,o);if(i.length===0)return p.jsx("p",{className:"vertebr-field-files-empty",id:t,children:"No products available in this environment."});const u=d=>{s(d.filter(h=>h.on).map(h=>h.id))};return p.jsx("ul",{id:t,className:"vertebr-enum-list",children:l.map((d,h)=>p.jsxs("li",{className:"vertebr-enum-list-row","data-on":d.on,children:[p.jsxs("label",{className:"vertebr-enum-list-label",children:[p.jsx("input",{type:"checkbox",checked:d.on,disabled:r,onChange:m=>{const y=l.map(b=>b.id===d.id?{...b,on:m.target.checked}:b);u(y)}}),p.jsx("span",{children:km(d.id,n)})]}),p.jsxs("div",{className:"vertebr-enum-list-move",children:[p.jsx("button",{type:"button","aria-label":`Move ${km(d.id,n)} up`,disabled:r||h===0,onClick:()=>{if(h===0)return;const m=[...l],y=m[h];m[h]=m[h-1],m[h-1]=y,u(m)},children:"↑"}),p.jsx("button",{type:"button","aria-label":`Move ${km(d.id,n)} down`,disabled:r||h===l.length-1,onClick:()=>{if(h>=l.length-1)return;const m=[...l],y=m[h];m[h]=m[h+1],m[h+1]=y,u(m)},children:"↓"})]})]},d.id))})}function Noe({id:t,name:e,value:n,asCents:r=!0,readOnly:s,onBlur:i,onChange:o,inputRef:l}){const[u,d]=C.useState(()=>I0(n,r));C.useEffect(()=>{d(I0(n,r))},[n,r]);const h=typeof n=="number"&&Number.isFinite(n)?Sx(n,{asCents:r}):null;return p.jsxs("div",{className:"vertebr-field-money",children:[p.jsx("span",{className:"vertebr-field-money-prefix","aria-hidden":"true",children:"$"}),p.jsx("input",{id:t,name:e,ref:l,type:"text",inputMode:"decimal",autoComplete:"off",readOnly:s,value:u,placeholder:"0.00","aria-label":h?`Price ${h}`:"Price",onChange:m=>{const y=m.target.value;d(y),o(JW(y,r))},onBlur:()=>{d(I0(n,r)),i?.()}})]})}function Moe(t,e){const n=t[e]??t.id??t.slug??t.uid;return typeof n=="string"&&n.trim()?n:typeof n=="number"?String(n):null}function _oe(t,e,n){const r=t[e]??t.name??t.title??t.label??n;return typeof r=="string"&&r.trim()?r.trim():n}function Aoe({id:t,value:e,field:n,client:r,readOnly:s,onChange:i}){const o=C.useId(),l=t??o,u=n.reference?.resource??"",d=n.reference?.valueField??"id",h=n.reference?.labelField??"name",m=typeof e=="string"?e:"",[y,b]=C.useState(""),[v,x]=C.useState(!1),[k,E]=C.useState([]),[M,_]=C.useState(!1),[N,T]=C.useState(m),A=C.useRef(null);return C.useEffect(()=>{T(m)},[m]),C.useEffect(()=>{if(!v||!u||s)return;let j=!1;const P=window.setTimeout(()=>{(async()=>{_(!0);try{const O=await r.listResource(u,{q:y.trim()||void 0,limit:20,fresh:!0});if(j)return;const G=[];for(const B of O.items){const W=Moe(B,d);W&&G.push({value:W,label:_oe(B,h,W)})}E(G)}catch{j||E([])}finally{j||_(!1)}})()},180);return()=>{j=!0,window.clearTimeout(P)}},[v,y,u,r,d,h,s]),C.useEffect(()=>{const j=P=>{A.current?.contains(P.target)||x(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[]),u?p.jsxs("div",{className:"vertebr-reference",ref:A,"data-open":v||void 0,children:[p.jsx("input",{id:l,type:"text",className:"vertebr-reference-input",readOnly:s,value:v?y:N||m,placeholder:"Search…",autoComplete:"off",onFocus:()=>{s||(b(""),x(!0))},onChange:j=>{b(j.target.value),x(!0)}}),m&&!s?p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-reference-clear",onClick:()=>{i(""),T(""),b("")},children:"Clear"}):null,v&&!s?p.jsx("ul",{className:"vertebr-reference-menu",role:"listbox",children:M?p.jsx("li",{className:"vertebr-reference-empty",children:"Searching…"}):k.length===0?p.jsx("li",{className:"vertebr-reference-empty",children:"No matches"}):k.map(j=>p.jsx("li",{children:p.jsxs("button",{type:"button",role:"option","aria-selected":j.value===m,className:"vertebr-reference-option",onClick:()=>{i(j.value),T(j.label),x(!1)},children:[p.jsx("span",{children:j.label}),p.jsx("code",{children:j.value})]})},j.value))}):null]}):p.jsx("input",{id:l,type:"text",readOnly:s,value:m,onChange:j=>i(j.target.value),placeholder:"Missing reference.resource"})}function Roe(t,e){const n=["body","content","policyBody","text"];for(const r of n){const s=t[r];if(!(!s||r===e)&&(s.type==="richtext"||kf(r,s)))return r}for(const[r,s]of Object.entries(t))if(r!==e&&(s.type==="richtext"||kf(r,s)))return r;return null}function ey({fieldKey:t,field:e,groupLabel:n,variant:r,schema:s,watched:i,form:o,uploads:l,onUpload:u,galleryUpload:d,onListGallery:h,onUploadGallery:m,fonts:y,fontsLoading:b,onListFonts:v,onRefreshFonts:x,hideImagePreview:k,hideUpload:E,visibilityGroup:M,settingsRow:_,client:N}){const[T,A]=C.useState(!1),[j,P]=C.useState(!1),O=k_(t,e,n),G=mW(t,e),B=G?Roe(s,t):null,W=B?s[B]:void 0,K=B&&typeof i?.[B]=="string"?i[B]:B?"":void 0,Q=aW(t,s,M??n),ee=!Q||i?.[Q]!==!1,F=!k&&e.type!=="file[]"&&ga(t,e)&&!!eg(i?.[t]),I=!e.readOnly&&!!h&&(e.type==="file[]"||ga(t,e)||G),z=!E&&!!(l?.[t]&&u)&&!e.readOnly,J=!!m,X=L=>{const q=L.map(ie=>ie.url).filter(Boolean);q.length&&(e.type==="file[]"?o.setValue(t,[...Em(o.getValues(t)),...q],{shouldDirty:!0,shouldTouch:!0}):o.setValue(t,q[0],{shouldDirty:!0,shouldTouch:!0}),A(!1))};return e.type==="boolean"?_?p.jsx(Ls,{control:o.control,name:t,render:({field:L})=>p.jsxs("li",{className:"vertebr-settings-list-row","data-on":L.value?"true":"false",children:[p.jsxs("div",{className:"vertebr-settings-list-copy",children:[p.jsx(D0,{htmlFor:t,children:O}),e.description?p.jsx("p",{className:"vertebr-settings-list-desc",children:e.description}):null]}),p.jsx(__,{className:"vertebr-switch",id:t,checked:!!L.value,onCheckedChange:L.onChange,children:p.jsx(A_,{className:"vertebr-switch-thumb"})})]})}):p.jsxs("div",{className:"vertebr-switch-row",children:[p.jsxs("div",{className:"vertebr-switch-row-copy",children:[p.jsx(D0,{htmlFor:t,children:O}),e.description?p.jsx("p",{className:"vertebr-switch-row-desc",children:e.description}):null]}),p.jsx(Ls,{control:o.control,name:t,render:({field:L})=>p.jsx(__,{className:"vertebr-switch",id:t,checked:!!L.value,onCheckedChange:L.onChange,children:p.jsx(A_,{className:"vertebr-switch-thumb"})})})]}):p.jsxs("div",{className:"vertebr-field","data-span":eW(t,e,r),"data-kind":ga(t,e)?"image":G?"document":void 0,"data-storefront":Q?ee?"on":"off":void 0,children:[p.jsxs("div",{className:"vertebr-field-head",children:[p.jsx(D0,{htmlFor:t,children:O}),Q?p.jsx(QD,{name:Q,label:O,form:o}):null]}),F?p.jsxs("div",{className:"vertebr-field-media",children:[p.jsx("img",{src:eg(i[t])??"",alt:""}),p.jsx("input",{id:t,type:"text",readOnly:e.readOnly,...o.register(t)})]}):G?p.jsx(ree,{id:t,label:O,value:typeof i?.[t]=="string"?i[t]:"",readOnly:e.readOnly,description:e.description,markdownBody:K,canPickFiles:I,canUpload:z||J,onChangeUrl:L=>o.setValue(t,L,{shouldDirty:!0,shouldTouch:!0}),onOpenPicker:()=>A(!0),onUploadFiles:async L=>{if(z){const Te=(await u(t,L))[0]?.url;Te&&o.setValue(t,Te,{shouldDirty:!0,shouldTouch:!0});return}if(!m)return;const ie=(await m(L))[0]?.url;ie&&o.setValue(t,ie,{shouldDirty:!0,shouldTouch:!0})},onEditMarkdown:B?()=>P(!0):void 0}):e.type==="richtext"||kf(t,e)?p.jsx(Ls,{control:o.control,name:t,render:({field:L})=>p.jsx(j2,{id:t,name:L.name,inputRef:L.ref,value:typeof L.value=="string"?L.value:"",readOnly:e.readOnly,recordImages:Cm(s,i),galleryUpload:d,onListGallery:h,onUploadGallery:m,onBlur:L.onBlur,onChange:L.onChange,onOpenDocumentView:()=>P(!0)})}):e.type==="file[]"?p.jsx(Ls,{control:o.control,name:t,render:({field:L})=>{const q=Em(L.value);return p.jsx("div",{className:"vertebr-field-files",children:q.length>0?p.jsx("ul",{className:"vertebr-field-files-list",children:q.map(ie=>p.jsxs("li",{children:[p.jsx("img",{src:ie,alt:""}),p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>L.onChange(q.filter(de=>de!==ie)),children:"Remove"})]},ie))}):p.jsx("p",{className:"vertebr-field-files-empty",children:"No photos yet"})})}}):e.type==="number"&&tI(t,e)?p.jsx(Ls,{control:o.control,name:t,render:({field:L})=>p.jsx(Noe,{id:t,name:L.name,inputRef:L.ref,value:L.value,asCents:wk(t,e)||/^pricing$/i.test(n),readOnly:e.readOnly,onBlur:L.onBlur,onChange:L.onChange})}):e.type==="number"?p.jsx(Ls,{control:o.control,name:t,render:({field:L})=>p.jsx("input",{id:t,type:"number",readOnly:e.readOnly,value:typeof L.value=="number"&&Number.isFinite(L.value)?L.value:"",onBlur:L.onBlur,onChange:q=>{const ie=q.target.value;L.onChange(ie===""?void 0:Number(ie))},name:L.name,ref:L.ref})}):e.type==="datetime"?p.jsx(Ls,{control:o.control,name:t,render:({field:L})=>p.jsx(Vie,{id:t,name:L.name,inputRef:L.ref,value:L.value,readOnly:e.readOnly,onBlur:L.onBlur,onChange:L.onChange})}):e.type==="enum"?p.jsx(Ls,{control:o.control,name:t,render:({field:L})=>p.jsx(YC,{id:t,value:L.value,field:e,readOnly:e.readOnly,onChange:L.onChange})}):e.type==="enum[]"?p.jsx(Ls,{control:o.control,name:t,render:({field:L})=>p.jsx(Toe,{id:t,value:L.value,field:e,readOnly:e.readOnly,onChange:L.onChange})}):e.type==="font"?p.jsx(Ls,{control:o.control,name:t,render:({field:L})=>p.jsx(QW,{id:t,value:L.value,label:e.label,description:e.description,readOnly:e.readOnly,fonts:y??[],loading:b,onChange:L.onChange,onRefreshFonts:x})}):e.type==="reference"&&N?p.jsx(Ls,{control:o.control,name:t,render:({field:L})=>p.jsx(Aoe,{id:t,value:L.value,field:e,client:N,readOnly:e.readOnly,onChange:L.onChange})}):ID(t,e)?p.jsx("textarea",{id:t,rows:5,readOnly:e.readOnly,...o.register(t)}):p.jsx("input",{id:t,type:"text",readOnly:e.readOnly,...o.register(t)}),!E&&!G&&(z||I)?p.jsxs("div",{className:"vertebr-field-media-actions",children:[I?p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>A(!0),children:"Choose from Files"}):null,z?p.jsx(ku,{meta:l[t],multiple:e.type==="file[]",showOptimizeHint:!0,onUpload:async L=>{const ie=(await u(t,L)).map(de=>de.url).filter(Boolean);if(ie.length){if(e.type==="file[]"){o.setValue(t,[...Em(o.getValues(t)),...ie],{shouldDirty:!0,shouldTouch:!0});return}o.setValue(t,ie[0],{shouldDirty:!0,shouldTouch:!0})}}}):null]}):null,T&&I?p.jsx(pk,{title:G?"Choose PDF":e.type==="file[]"?"Add product photos":"Choose image",confirmLabel:"Use",defaultTab:"gallery",assetKind:G?"document":"image",recordImages:G?[]:Cm(s,i),galleryUpload:d,onListGallery:h,onUploadGallery:m,onClose:()=>A(!1),onInsert:X}):null,j&&(B||e.type==="richtext"||kf(t,e))?p.jsx(see,{title:B&&W?k_(B,W,n):O,value:B?typeof o.getValues(B)=="string"?o.getValues(B):"":typeof o.getValues(t)=="string"?o.getValues(t):"",readOnly:B?!!W?.readOnly:e.readOnly,recordImages:Cm(s,i),galleryUpload:d,onListGallery:h,onUploadGallery:m,onChange:L=>{const q=B??t;o.setValue(q,L,{shouldDirty:!0,shouldTouch:!0})},onClose:()=>P(!1)}):null]})}function vz({form:t,isDirty:e,status:n,tone:r,onDiscard:s,submitLabel:i="Save changes"}){return p.jsxs("div",{className:"vertebr-actions",children:[p.jsx("button",{className:"vertebr-btn vertebr-btn-primary",type:"submit",disabled:t.formState.isSubmitting||!e,children:t.formState.isSubmitting?"Saving…":i}),e?p.jsx("button",{className:"vertebr-btn",type:"button",onClick:s,children:"Discard"}):null,e?p.jsx("span",{className:"vertebr-dirty",children:"Unsaved"}):n?p.jsx("span",{className:"vertebr-status","data-tone":r,children:n}):null,p.jsx("span",{className:"vertebr-actions-spacer"}),p.jsx("span",{className:"vertebr-kbd",children:"⌘S"})]})}function Ooe({schema:t,groups:e,watched:n,form:r,uploads:s,onUpload:i,galleryUpload:o,onListGallery:l,onUploadGallery:u,client:d,onSubmit:h,isDirty:m,status:y,tone:b,onDiscard:v,submitLabel:x,hideActions:k}){const[E,M]=C.useState(!1),_=fW(t,n),N=_?eg(n?.[_])??"":"",T=e.filter(B=>/^(Media|Display|Status)$/i.test(B.id)),A=e.filter(B=>!/^(Media|Display|Status)$/i.test(B.id)),j=!!(_&&l),P=!!(_&&s?.[_]&&i),O=B=>{if(!_)return;const W=B[0]?.url;W&&(r.setValue(_,W,{shouldDirty:!0,shouldTouch:!0}),M(!1))},G={variant:"record",schema:t,watched:n,form:r,uploads:s,onUpload:i,galleryUpload:o,onListGallery:l,onUploadGallery:u,client:d};return p.jsxs("form",{className:"vertebr-form","data-variant":"record",onSubmit:h,children:[p.jsx("div",{className:"vertebr-form-scroll",children:p.jsxs("div",{className:"vertebr-record-layout",children:[p.jsxs("aside",{className:"vertebr-record-aside",children:[p.jsx("div",{className:"vertebr-record-preview",children:N&&Cf(N)?p.jsx("img",{src:N,alt:""}):p.jsx("div",{className:"vertebr-record-preview-empty",children:"No image"})}),j||P?p.jsxs("div",{className:"vertebr-field-media-actions",children:[j?p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>M(!0),children:"Choose from Files"}):null,P?p.jsx(ku,{meta:s[_],label:"Or upload a new image",onUpload:async B=>{const[W]=await i(_,B);W?.url&&r.setValue(_,W.url,{shouldDirty:!0,shouldTouch:!0})}}):null]}):null,E&&j?p.jsx(pk,{title:"Choose product image",confirmLabel:"Use",defaultTab:"gallery",recordImages:Cm(t,n),galleryUpload:o,onListGallery:l,onUploadGallery:u,onClose:()=>M(!1),onInsert:O}):null,T.map(B=>p.jsxs("div",{className:"vertebr-record-block","data-layout":/^inventory$/i.test(B.id)?"chips":void 0,children:[p.jsx(bO,{groupId:B.id,label:B.label,schema:t,form:r}),p.jsx("div",{className:"vertebr-form-fields","data-layout":Q6(B.fields[0]?.[0]??"",B.fields[0]?.[1])?"chips":void 0,children:B.fields.map(([W,K])=>p.jsx(ey,{fieldKey:W,field:K,groupLabel:B.label,visibilityGroup:B.id,hideImagePreview:!0,hideUpload:W===_,...G},W))})]},B.id))]}),p.jsx("div",{className:"vertebr-record-main",children:A.map(B=>{const W=/^inventory$/i.test(B.id),K=/^specs$/i.test(B.id),Q=hk(B.id,t),ee=!Q||n?.[Q]!==!1;return p.jsxs("div",{className:"vertebr-record-block","data-layout":W?"chips":K?"specs":void 0,"data-storefront":Q?ee?"on":"off":void 0,children:[p.jsx(bO,{groupId:B.id,label:B.label,schema:t,form:r}),p.jsx("div",{className:"vertebr-form-fields","data-layout":W?"chips":K?"specs":void 0,children:B.fields.map(([F,I])=>p.jsx(ey,{fieldKey:F,field:I,groupLabel:B.label,visibilityGroup:B.id,...G},F))})]},B.id)})})]})}),k?null:p.jsx(vz,{form:r,isDirty:m,status:y,tone:b,onDiscard:v,submitLabel:x})]})}function bO({groupId:t,label:e,schema:n,form:r}){const s=hk(t,n);return p.jsxs("div",{className:"vertebr-record-block-label",children:[p.jsx("span",{children:e}),s?p.jsx(QD,{name:s,label:e,form:r}):null]})}function joe({schema:t,groups:e,watched:n,form:r,uploads:s,onUpload:i,galleryUpload:o,onListGallery:l,onUploadGallery:u,fonts:d,fontsLoading:h,onListFonts:m,onRefreshFonts:y,client:b,onSubmit:v,isDirty:x,status:k,tone:E,onDiscard:M,submitLabel:_,hideActions:N}){const T=e.length===1;return p.jsxs("form",{className:"vertebr-form","data-variant":"config",onSubmit:v,children:[p.jsx("div",{className:"vertebr-form-scroll",children:e.map(A=>{const j=J6(A.fields),P=!T||A.id!=="General"&&A.fields.length>0;return p.jsxs("div",{className:"vertebr-form-section","data-plain":T&&!P?"true":void 0,children:[P?p.jsxs("div",{className:"vertebr-form-section-head",children:[p.jsx("h3",{children:A.label}),p.jsx("span",{className:"vertebr-form-section-count",children:A.fields.length})]}):null,p.jsx("div",{className:"vertebr-form-fields","data-layout":j?"settings":void 0,children:j?p.jsx("ul",{className:"vertebr-settings-list",children:A.fields.map(([O,G])=>p.jsx(ey,{fieldKey:O,field:G,groupLabel:A.label,variant:"config",schema:t,watched:n,form:r,uploads:s,onUpload:i,galleryUpload:o,onListGallery:l,onUploadGallery:u,fonts:d,fontsLoading:h,onListFonts:m,onRefreshFonts:y,client:b,settingsRow:!0},O))}):A.fields.map(([O,G])=>p.jsx(ey,{fieldKey:O,field:G,groupLabel:A.label,variant:"config",schema:t,watched:n,form:r,uploads:s,onUpload:i,galleryUpload:o,onListGallery:l,onUploadGallery:u,fonts:d,fontsLoading:h,onListFonts:m,onRefreshFonts:y,client:b},O))})]},A.id)})}),N?null:p.jsx(vz,{form:r,isDirty:x,status:k,tone:E,onDiscard:M,submitLabel:_})]})}function hh({schema:t,value:e,onSave:n,submitLabel:r,variant:s="config",uploads:i,onUpload:o,galleryUpload:l,onListGallery:u,onUploadGallery:d,fonts:h,fontsLoading:m,onListFonts:y,onRefreshFonts:b,onChange:v,hideActions:x,client:k,canWrite:E=!0,revisionsEnabled:M=!1,onPublish:_,canPublish:N=!1}){const{register:T,clear:A}=_D(),{push:j}=hy(),P=C.useMemo(()=>s==="record"?tW(t):t,[t,s]),O=C.useMemo(()=>s==="record"?nW(P,e):e,[P,e,s]),G=C.useMemo(()=>K6(P),[P]),B=C.useMemo(()=>dW(P,s),[P,s]),[W,K]=C.useState(null),[Q,ee]=C.useState(),[F,I]=C.useState(!1),z=f6({resolver:g6(G),defaultValues:O}),J=mD({control:z.control});C.useEffect(()=>{if(!v)return;const je=z.watch(Ne=>{const oe={...Ne??{}};for(const[ye,Pe]of Object.entries(P))Pe.type!=="string"&&Pe.type!=="richtext"&&Pe.type!=="enum"||Pe.required||oe[ye]==null&&(oe[ye]="");v(oe)});return v(z.getValues()??{}),()=>je.unsubscribe()},[z,v,P]),C.useEffect(()=>{z.reset(O)},[O,z]);const X=()=>{z.reset(O),K(null),ee(void 0)},L=r??(M?"Save draft":"Save"),q=z.handleSubmit(async je=>{if(E){K(M?"Saving draft…":"Saving…"),ee(void 0),T({saving:!0,isDirty:!0,visible:!0});try{await n(je),K(M?"Draft saved — not live until you publish":"Saved"),ee("ok"),z.reset(je),j(M?"Draft saved. Publish to update the live storefront.":"Changes saved","ok")}catch(Ne){const oe=Ne instanceof Error?Ne.message:"Save failed";K(oe),ee("danger"),j(oe,"danger")}finally{T({saving:!1})}}}),ie=async()=>{if(!(!_||!N)){I(!0),K("Publishing…"),ee(void 0),T({publishing:!0,visible:!0});try{await _(),K("Published"),ee("ok"),j("Published to live storefront","ok")}catch(je){const Ne=je instanceof Error?je.message:"Publish failed";K(Ne),ee("danger"),j(Ne,"danger")}finally{I(!1),T({publishing:!1})}}},de=z.formState.isDirty,Te=!!(M&&N&&_);C.useEffect(()=>{if(x){A();return}return T({visible:de||!!W||Te,isDirty:de,saving:W==="Saving…"||W==="Saving draft…",publishing:F,message:!E&&de?"Missing config.write capability":W??void 0,tone:!E&&de?"danger":Q,saveLabel:L,onSave:E?()=>{q()}:void 0,onDiscard:X,publishLabel:"Publish",onPublish:Te?()=>{ie()}:void 0}),()=>A()},[x,de,W,Q,q,X,T,A,E,L,Te,F]),C.useEffect(()=>{const je=Ne=>{(Ne.metaKey||Ne.ctrlKey)&&Ne.key.toLowerCase()==="s"&&(Ne.preventDefault(),E&&q())};return window.addEventListener("keydown",je),()=>window.removeEventListener("keydown",je)},[q,E]);const De={schema:P,groups:B,watched:J,form:z,uploads:i,onUpload:o,galleryUpload:l,onListGallery:u,onUploadGallery:d,fonts:h,fontsLoading:m,onListFonts:y,onRefreshFonts:b,client:k,onSubmit:q,isDirty:de,status:W,tone:Q,onDiscard:X,submitLabel:L,hideActions:!0};return s==="record"?p.jsx(Ooe,{...De}):p.jsx(joe,{...De})}function Doe(t){const e=new Date(t);return Number.isNaN(e.getTime())?t:e.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Ioe(t){return t?t.includes("@")||t.length<=12?t:`${t.slice(0,6)}…${t.slice(-4)}`:null}function Loe({client:t,configId:e,onPublished:n}){const{push:r}=hy(),[s,i]=C.useState(!1),[o,l]=C.useState([]),[u,d]=C.useState(null),[h,m]=C.useState(!1),[y,b]=C.useState(null),v=C.useCallback(async()=>{m(!0);try{const E=await t.listRevisions(e,{fresh:!0});l(E.items),d(E.items.length)}finally{m(!1)}},[t,e]);C.useEffect(()=>{let E=!1;return(async()=>{try{const M=await t.listRevisions(e,{fresh:!0});E||d(M.items.length)}catch{}})(),()=>{E=!0}},[t,e]),C.useEffect(()=>{if(!s)return;let E=!1;return(async()=>{try{m(!0);const M=await t.listRevisions(e,{fresh:!0});E||(l(M.items),d(M.items.length))}catch(M){E||r(M instanceof Error?M.message:"Failed to load revisions","danger")}finally{E||m(!1)}})(),()=>{E=!0}},[s,t,e,r]),C.useEffect(()=>{if(!s)return;const E=_=>{_.key==="Escape"&&i(!1)};window.addEventListener("keydown",E);const M=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",E),document.body.style.overflow=M}},[s]);const x=async E=>{b(E);try{await t.publishRevision(e,E),r("Revision published","ok"),await v(),await n?.()}catch(M){r(M instanceof Error?M.message:"Publish failed","danger")}finally{b(null)}},k=async E=>{b(E);try{await t.restoreRevision(e,E),r("Now editing this revision","ok"),await v(),await n?.()}catch(M){r(M instanceof Error?M.message:"Could not switch revision","danger")}finally{b(null)}};return p.jsxs(p.Fragment,{children:[p.jsxs("button",{type:"button",className:"vertebr-revisions-trigger","aria-haspopup":"dialog","aria-expanded":s,onClick:()=>i(!0),children:["History",u!=null?p.jsx("span",{className:"vertebr-revisions-trigger-count",children:u}):null]}),s?p.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:()=>i(!1),children:p.jsxs("div",{className:"vertebr-modal vertebr-modal-sm vertebr-revisions-modal",role:"dialog","aria-modal":"true","aria-label":"Revision history",onClick:E=>E.stopPropagation(),children:[p.jsxs("header",{className:"vertebr-modal-head",children:[p.jsxs("div",{className:"vertebr-modal-heading",children:[p.jsx("p",{className:"vertebr-modal-eyebrow",children:"Change safety"}),p.jsx("h2",{children:"Revisions"})]}),p.jsxs("div",{className:"vertebr-modal-actions",children:[p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:h||y!=null,onClick:()=>{v()},children:h?"…":"Refresh"}),p.jsx("button",{type:"button",className:"vertebr-btn",onClick:()=>i(!1),children:"Close"})]})]}),p.jsx("div",{className:"vertebr-modal-body",children:o.length===0&&!h?p.jsx("p",{className:"vertebr-revisions-empty",children:"No revisions yet. Save to create a draft."}):p.jsx("ul",{className:"vertebr-revisions-list",children:o.map(E=>{const M=Ioe(E.createdBy),_=!!E.active;return p.jsxs("li",{className:"vertebr-revisions-item","data-active":_?"true":void 0,children:[p.jsxs("div",{className:"vertebr-revisions-meta",children:[p.jsx("strong",{children:E.label?.trim()||E.id}),p.jsx("span",{"data-status":E.status,children:E.status}),_?p.jsx("span",{"data-status":"current",children:"Current"}):null,p.jsxs("span",{className:"vertebr-revisions-when",children:[Doe(E.createdAt),M?` · ${M}`:""]})]}),p.jsxs("div",{className:"vertebr-revisions-actions",children:[E.status!=="published"?p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:y!=null,onClick:()=>{x(E.id)},children:y===E.id?"…":"Publish"}):null,_?null:p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:y!=null,onClick:()=>{k(E.id)},children:"Use"})]})]},E.id)})})})]})}):null]})}function vO(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\bcents\b/i,"").trim()}function im(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>typeof n=="string"?[e,{type:n,label:vO(e),required:!0}]:[e,{...n,label:n.label??vO(e),required:n.required??!0}]))}function KC(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 Ow({title:t,count:e=0,eyebrow:n,schema:r,submitLabel:s,onClose:i,onSubmit:o}){return C.useEffect(()=>{const l=d=>{d.key==="Escape"&&i()};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}},[i]),p.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:i,children:p.jsxs("div",{className:"vertebr-modal vertebr-modal-form",role:"dialog","aria-modal":"true","aria-label":t,onClick:l=>l.stopPropagation(),children:[p.jsxs("header",{className:"vertebr-modal-head",children:[p.jsxs("div",{className:"vertebr-modal-heading",children:[p.jsx("p",{className:"vertebr-modal-eyebrow",children:n??(e===1?"1 person":`${e} people`)}),p.jsx("h2",{children:t})]}),p.jsx("div",{className:"vertebr-modal-actions",children:p.jsx("button",{type:"button",className:"vertebr-btn",onClick:i,"aria-label":"Close",children:"Close"})})]}),p.jsx("div",{className:"vertebr-modal-body",children:p.jsx(hh,{variant:"config",schema:r,value:KC(r),submitLabel:s,onSave:async l=>{await o(l),i()}})})]})})}function Pc(t){return t.trim()}function ty({options:t,value:e,loading:n,disabled:r,placeholder:s="Select…",emptyLabel:i="Nothing available",searchPlaceholder:o="Search…",onChange:l}){const u=C.useId(),d=C.useRef(null),[h,m]=C.useState(!1),[y,b]=C.useState(""),v=C.useMemo(()=>new Set(e.map(Pc)),[e]),x=C.useMemo(()=>{const N=y.trim().toLowerCase();return N?t.filter(T=>`${T.label} ${T.secondary??""} ${T.id}`.toLowerCase().includes(N)):t},[t,y]);C.useEffect(()=>{if(!h)return;const N=A=>{d.current?.contains(A.target)||m(!1)},T=A=>{A.key==="Escape"&&m(!1)};return window.addEventListener("mousedown",N),window.addEventListener("keydown",T),()=>{window.removeEventListener("mousedown",N),window.removeEventListener("keydown",T)}},[h]);const k=N=>{const T=Pc(N),A=new Set(v);A.has(T)?A.delete(T):A.add(T),l(t.map(j=>Pc(j.id)).filter(j=>A.has(j)))},E=()=>{const N=new Set(v);for(const T of x)N.add(Pc(T.id));l(t.map(T=>Pc(T.id)).filter(T=>N.has(T)))},M=()=>l([]),_=e.length===0?n?"Loading…":t.length===0?i:s:e.length===1?t.find(N=>N.id===e[0])?.label??e[0]:`${e.length} selected`;return p.jsxs("div",{className:"vertebr-email-select",ref:d,"data-open":h?"true":void 0,children:[p.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(N=>!N),children:[p.jsx("span",{className:"vertebr-select-value",children:_}),p.jsx("span",{className:"vertebr-select-icon","aria-hidden":"true",children:p.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",children:p.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),h?p.jsxs("div",{className:"vertebr-email-select-panel",id:u,role:"listbox",children:[t.length>6?p.jsxs("div",{className:"vertebr-email-select-toolbar",children:[p.jsx("input",{type:"search",value:y,placeholder:o,"aria-label":"Search",onChange:N=>b(N.target.value)}),p.jsxs("div",{className:"vertebr-email-select-actions",children:[p.jsx("button",{type:"button",onClick:E,children:"All"}),p.jsx("button",{type:"button",onClick:M,disabled:e.length===0,children:"Clear"})]})]}):p.jsx("div",{className:"vertebr-email-select-toolbar vertebr-email-select-toolbar-compact",children:p.jsxs("div",{className:"vertebr-email-select-actions",children:[p.jsx("button",{type:"button",onClick:E,children:"All"}),p.jsx("button",{type:"button",onClick:M,disabled:e.length===0,children:"Clear"})]})}),p.jsx("ul",{className:"vertebr-email-select-list",children:x.length===0?p.jsx("li",{className:"vertebr-email-select-empty",children:"No matches"}):x.map(N=>{const T=v.has(Pc(N.id));return p.jsx("li",{children:p.jsxs("label",{"data-on":T?"true":void 0,"data-media":N.imageUrl?"true":void 0,children:[p.jsx("input",{type:"checkbox",checked:T,onChange:()=>k(N.id)}),N.imageUrl?p.jsx("img",{className:"vertebr-email-select-thumb",src:N.imageUrl,alt:"",loading:"lazy"}):null,p.jsxs("span",{className:"vertebr-email-select-copy",children:[p.jsx("span",{className:"vertebr-email-select-primary",children:N.label}),N.secondary?p.jsx("span",{className:"vertebr-email-select-secondary",children:N.secondary}):null]})]})},N.id)})})]}):null]})}function Poe({options:t,value:e,loading:n,disabled:r,onChange:s}){const i=t.map(o=>({id:o.email.trim().toLowerCase(),label:o.email,secondary:o.label}));return p.jsx(ty,{options:i,value:e,loading:n,disabled:r,placeholder:"Select emails…",emptyLabel:"No emails on this list",searchPlaceholder:"Search emails…",onChange:s})}function ZC({label:t,active:e,order:n,onSort:r}){return p.jsxs("button",{type:"button",className:"vertebr-th-sort","data-active":e?"true":void 0,"data-order":e?n:void 0,"aria-label":e?`Sorted by ${t}, ${n==="desc"?"descending":"ascending"}. Click to reverse.`:`Sort by ${t}`,onClick:s=>{s.stopPropagation(),r()},children:[p.jsx("span",{children:t}),p.jsx("span",{className:"vertebr-th-sort-icon","aria-hidden":"true",children:e?n==="desc"?"↓":"↑":"↕"})]})}function wz({columns:t,rows:e=6,className:n}){if(t.length===0)return null;const r=n?`vertebr-table-wrap vertebr-table-skeleton ${n}`:"vertebr-table-wrap vertebr-table-skeleton";return p.jsxs("div",{className:r,"aria-busy":"true","aria-live":"polite",children:[p.jsxs("table",{className:"vertebr-table",children:[p.jsx("thead",{children:p.jsx("tr",{children:t.map((s,i)=>p.jsx("th",{"aria-label":s.label,children:p.jsx("span",{className:"vertebr-table-skeleton-cell vertebr-table-skeleton-header","data-width":zoe(i)})},s.id))})}),p.jsx("tbody",{children:Array.from({length:e},(s,i)=>p.jsx("tr",{children:t.map((o,l)=>p.jsx("td",{children:p.jsx("span",{className:"vertebr-table-skeleton-cell","data-width":$oe(i,l)})},o.id))},i))})]}),p.jsx("span",{className:"vertebr-sr-only",children:"Loading table…"})]})}function $oe(t,e){const n=(t+e)%3;return n===0?"sm":n===1?"md":"lg"}function zoe(t){const e=t%3;return e===0?"sm":e===1?"md":"lg"}function ib(t){const e=C.useRef(null),[n,r]=C.useState({overflow:!1,canLeft:!1,canRight:!1}),s=C.useCallback(()=>{const o=e.current;if(!o){r({overflow:!1,canLeft:!1,canRight:!1});return}const l=o.scrollWidth>o.clientWidth+2;r({overflow:l,canLeft:l&&o.scrollLeft>2,canRight:l&&o.scrollLeft+o.clientWidth<o.scrollWidth-2})},[]);C.useEffect(()=>{const o=e.current;if(!o)return;s();const l=()=>s();o.addEventListener("scroll",l,{passive:!0});const u=new ResizeObserver(s);u.observe(o);const d=o.querySelector("table");return d&&u.observe(d),()=>{o.removeEventListener("scroll",l),u.disconnect()}},[s,t]);const i=C.useCallback(o=>{const l=e.current;if(!l)return;const u=Math.max(220,Math.round(l.clientWidth*.55));l.scrollBy({left:o==="left"?-u:u,behavior:"smooth"})},[]);return{wrapRef:e,...n,scrollBy:i,update:s}}function ob({children:t,className:e,overflow:n,transitionKey:r}){const[s,i]=C.useState(!1),o=C.useRef(r),l=C.useRef(!0);C.useEffect(()=>{if(l.current){l.current=!1,o.current=r;return}if(o.current===r)return;o.current=r,i(!0);const d=window.setTimeout(()=>i(!1),220);return()=>window.clearTimeout(d)},[r]);const u=e?`vertebr-table-wrap ${e}`:"vertebr-table-wrap";return p.jsx("div",{ref:n.wrapRef,className:u,"data-overflow":n.overflow?"true":void 0,"data-overflow-left":n.canLeft?"true":void 0,"data-overflow-right":n.canRight?"true":void 0,"data-transition":s?"true":void 0,children:t})}function ab({canLeft:t,canRight:e,onScroll:n}){return p.jsxs("div",{className:"vertebr-table-scroll-controls",role:"group","aria-label":"Scroll columns",children:[p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-icon vertebr-table-scroll-btn",disabled:!t,onClick:()=>n("left"),"aria-label":"Scroll columns left",children:p.jsx(Boe,{})}),p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-icon vertebr-table-scroll-btn",disabled:!e,onClick:()=>n("right"),"aria-label":"Scroll columns right",children:p.jsx(Foe,{})})]})}function Boe(){return p.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:p.jsx("path",{d:"m15 18-6-6 6-6"})})}function Foe(){return p.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:p.jsx("path",{d:"m9 18 6-6-6-6"})})}function XC({value:t,onChange:e,placeholder:n="Search…","aria-label":r="Search table"}){return p.jsx("input",{className:"vertebr-table-search",type:"search",placeholder:n,value:t,onChange:s=>e(s.target.value),"aria-label":r})}function vu(t,e){const n=e.trim().toLowerCase();return n?t==null?!1:typeof t=="string"||typeof t=="number"||typeof t=="boolean"?String(t).toLowerCase().includes(n):Array.isArray(t)?t.some(r=>vu(r,n)):typeof t=="object"?Object.values(t).some(r=>vu(r,n)):String(t).toLowerCase().includes(n):!0}function wO(t){return t==null||t===""?null:typeof t=="boolean"?t?"true":"false":typeof t=="number"?String(t):typeof t=="string"?t:Array.isArray(t)?null:String(t)}function xz(t,e){return e?.[t]?e[t]:t==="true"?"Yes":t==="false"?"No":t}function Sz(t){return t==null||t===!1?null:t===!0?{}:t}function Voe(t,e,n){const r=Sz(n.filter);if(!r)return null;const s={...n.optionLabels??{},...r.optionLabels??{}};let i=r.options?.length?r.options:n.options?.length?n.options:n.type==="boolean"?["true","false"]:[];return i=[...new Set(i.map(String).filter(Boolean))],i.length===0?null:{id:t,label:e,multiselect:r.multiselect!==!1,options:i.map(o=>({value:o,label:xz(o,s)}))}}function Hoe(t,e,n){const r=Sz(n);if(!r)return null;const s=[...new Set((r.options??[]).map(String).filter(Boolean))];return s.length===0?null:{id:t,label:e,multiselect:r.multiselect!==!1,options:s.map(i=>({value:i,label:xz(i,r.optionLabels)}))}}function kz(t,e,n){for(const[r,s]of Object.entries(e)){if(!s?.length)continue;const i=n[r];if(!i)continue;const o=i(t),l=new Set;if(Array.isArray(o))for(const u of o){const d=wO(u);d&&l.add(d)}else{const u=wO(o);u&&l.add(u)}if(![...s].some(u=>l.has(u)))return!1}return!0}function Uoe(t,e,n,r){if(!r){const l=t[e]??[];if(l.length===1&&l[0]===n){const u={...t};return delete u[e],u}return{...t,[e]:[n]}}const s=t[e]??[],i=s.includes(n)?s.filter(l=>l!==n):[...s,n],o={...t};return i.length===0?delete o[e]:o[e]=i,o}function Woe(){return{}}function qoe(t){return Object.values(t).some(e=>e.length>0)}function Goe({columns:t,visibility:e,onChange:n}){const[r,s]=C.useState(!1),i=C.useRef(null),o=C.useId(),l=t.filter(h=>e[h.id]===!1).length,u=t.length-l,d=l>0;return C.useEffect(()=>{if(!r)return;const h=y=>{i.current?.contains(y.target)||s(!1)},m=y=>{y.key==="Escape"&&s(!1)};return window.addEventListener("mousedown",h),window.addEventListener("keydown",m),()=>{window.removeEventListener("mousedown",h),window.removeEventListener("keydown",m)}},[r]),p.jsxs("div",{className:"vertebr-table-filter-control",ref:i,"data-open":r?"true":void 0,"data-active":d?"true":void 0,children:[p.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-table-filter-trigger","aria-expanded":r,"aria-controls":o,"aria-label":d?`Columns, ${u} of ${t.length} visible`:"Columns",onClick:()=>s(h=>!h),children:["Columns",d?p.jsx("span",{className:"vertebr-table-filter-count",children:u}):null]}),r?p.jsxs("div",{className:"vertebr-table-filter-menu",id:o,role:"listbox","aria-multiselectable":!0,children:[p.jsxs("div",{className:"vertebr-table-filter-menu-head",children:[p.jsx("span",{children:"Columns"}),d?p.jsx("button",{type:"button",className:"vertebr-link-btn",onClick:()=>{const h={};for(const m of t)h[m.id]=!0;n(h)},children:"Show all"}):null]}),p.jsx("ul",{className:"vertebr-table-filter-list",children:t.map(h=>{const m=e[h.id]!==!1;return p.jsx("li",{children:p.jsxs("label",{className:"vertebr-table-filter-item",children:[p.jsx("input",{type:"checkbox",checked:m,disabled:m&&u<=1,onChange:()=>{n({...e,[h.id]:!m})}}),p.jsx("span",{children:h.label})]})},h.id)})})]}):null]})}function Cz({columns:t,selected:e,onChange:n,columnVisibility:r}){const s=t.length>0,i=!!r?.columns.length;if(!s&&!i)return null;const o=qoe(e);return p.jsxs("div",{className:"vertebr-table-filters",role:"group","aria-label":"Filters",children:[t.map(l=>p.jsx(Yoe,{column:l,values:e[l.id]??[],onToggle:u=>n(Uoe(e,l.id,u,l.multiselect))},l.id)),r?p.jsx(Goe,{columns:r.columns,visibility:r.visibility,onChange:r.onChange}):null,o?p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-table-filter-clear",onClick:()=>n(Woe()),children:"Clear filters"}):null]})}function Yoe({column:t,values:e,onToggle:n}){const r=C.useId(),s=C.useRef(null),[i,o]=C.useState(!1),l=new Set(e),u=e.length,d=u>0;return C.useEffect(()=>{if(!i)return;const h=y=>{s.current?.contains(y.target)||o(!1)},m=y=>{y.key==="Escape"&&o(!1)};return window.addEventListener("mousedown",h),window.addEventListener("keydown",m),()=>{window.removeEventListener("mousedown",h),window.removeEventListener("keydown",m)}},[i]),p.jsxs("div",{className:"vertebr-table-filter-control",ref:s,"data-open":i?"true":void 0,"data-active":d?"true":void 0,"data-multiselect":t.multiselect?"true":"false",children:[p.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-table-filter-trigger","aria-expanded":i,"aria-controls":r,"aria-label":d?`${t.label}, ${u} selected`:t.label,onClick:()=>o(h=>!h),children:[t.label,d?p.jsx("span",{className:"vertebr-table-filter-count",children:u}):null]}),i?p.jsxs("div",{className:"vertebr-table-filter-menu",id:r,role:"listbox","aria-multiselectable":t.multiselect,children:[p.jsxs("div",{className:"vertebr-table-filter-menu-head",children:[p.jsx("span",{children:t.label}),d?p.jsx("button",{type:"button",className:"vertebr-link-btn",onClick:()=>{for(const h of e)n(h)},children:"Clear"}):null]}),p.jsx("ul",{className:"vertebr-table-filter-list",children:t.options.map(h=>{const m=l.has(h.value);return p.jsx("li",{children:p.jsxs("label",{className:"vertebr-table-filter-item",children:[p.jsx("input",{type:t.multiselect?"checkbox":"radio",name:`filter-${t.id}`,checked:m,onChange:()=>{n(h.value),t.multiselect||o(!1)}}),p.jsx("span",{children:h.label})]})},h.value)})})]}):null]})}function xO(t,e){if(t==null||t==="")return null;if(e==="number"){const n=typeof t=="number"?t:Number(t);return Number.isFinite(n)?n:null}if(e==="datetime"){const n=typeof t=="number"?t:Date.parse(typeof t=="string"?t:String(t));return Number.isFinite(n)?n:null}return e==="boolean"?t===!0||t==="true"||t===1:Array.isArray(t)?t.map(n=>String(n??"")).join(", "):typeof t=="object"?JSON.stringify(t):String(t)}function JC(t,e,n,r){const s=r==="desc"?-1:1,i=xO(t,n),o=xO(e,n);return i==null&&o==null?0:i==null?1:o==null?-1:typeof i=="number"&&typeof o=="number"?(i-o)*s:typeof i=="boolean"&&typeof o=="boolean"?(Number(i)-Number(o))*s:String(i).localeCompare(String(o),void 0,{numeric:!0,sensitivity:"base"})*s}function Koe(t,e,n){if(!e?.field)return t;const r=n?.[e.field]?.type,s=e.field,i=e.order;return[...t].sort((o,l)=>JC(o[s],l[s],r,i))}function QC(t,e,n="asc"){return t?.field===e?{field:e,order:t.order==="asc"?"desc":"asc"}:{field:e,order:n}}function SO(t){const e=Date.parse(t);return Number.isFinite(e)?new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(e):t}function Zoe(t){return t.replace(/^library:/i,"").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim()}function kO(t){return t==="row"?"Row":t==="campaign"?"Schedule":"Board"}function ES(t){const e=t.reference?.trim();if(e&&e.toUpperCase()!=="MM-PENDING")return e;const s=(t.subject??"").match(/(?:—|-|–)\s*((?:MM|ORD|ORDER)[-_][A-Z0-9-]+|[A-Z]{2,}[-_][A-Z0-9-]{3,})\s*$/i)?.[1]?.trim();return!s||s.toUpperCase()==="MM-PENDING"?"":s}function TS(t){const e=ES(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 NS(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 CO(t){return t.failed&&t.failed>0?`${t.sent} / ${t.failed} failed`:`${t.sent} / ${t.recipientCount}`}function EO(t){return t==="sent"?{label:"Sent",tone:"ok"}:t==="partial"?{label:"Partial"}:t==="failed"?{label:"Failed"}:{label:"Scheduled",tone:"neutral"}}function ii(){return p.jsx("span",{className:"vertebr-cell-empty",children:"—"})}function TO(t,e){if(t.kind==="scheduled"){const r=t.campaign;switch(e){case"when":return r.sendAt;case"status":return r.status;case"subject":return r.subject??"";case"to":return String(r.recipientCount??"");case"audience":return r.resourceLabel??r.resourceId;case"template":return r.templateLabel??r.templateId}}const n=t.entry;switch(e){case"when":return n.at;case"status":return n.status;case"subject":return TS(n);case"to":return NS(n);case"audience":return n.resourceLabel??n.resourceId;case"template":return n.templateLabel??n.templateId}}function Xoe({campaigns:t,history:e,canSchedule:n,canHistory:r,busy:s,onCancel:i}){const[o,l]=C.useState("all"),[u,d]=C.useState(""),[h,m]=C.useState({field:"when",order:"desc"}),y=C.useMemo(()=>t.filter(N=>N.status==="scheduled").slice().sort((N,T)=>Date.parse(N.sendAt)-Date.parse(T.sendAt)),[t]),b=C.useMemo(()=>{const N=y.map(A=>({kind:"scheduled",id:A.id,campaign:A})),T=e.map(A=>({kind:"history",id:A.id,entry:A}));return o==="scheduled"?N:o==="history"?T:[...N,...T]},[o,y,e]),v=C.useMemo(()=>{let N=b;if(u.trim()&&(N=b.filter(j=>{if(j.kind==="scheduled"){const O=j.campaign;return vu({subject:O.subject,to:O.resourceLabel??O.resourceId,status:O.status,template:O.templateId},u)}const P=j.entry;return vu({subject:TS(P),confirmation:ES(P),to:NS(P),audience:P.resourceLabel??P.resourceId,template:P.templateLabel??P.templateId,status:P.status,via:kO(P.source),delivery:CO(P)},u)})),!h)return N;const T=h.field,A=T==="when"?"datetime":"string";return N.slice().sort((j,P)=>JC(TO(j,T),TO(P,T),A,h.order))},[b,u,h]),x=ib(v.length),k=!!i&&o!=="history",E=async N=>{i&&window.confirm(`Cancel scheduled email to ${N.resourceLabel??N.resourceId}?`)&&await i(N.id)},M=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.",_=(N,T)=>p.jsx("th",{children:p.jsx(ZC,{label:N,active:h?.field===T,order:h?.field===T?h.order:void 0,onSort:()=>m(QC(h,T,T==="when"?"desc":"asc"))})});return p.jsxs("div",{className:"vertebr-emails-activity",children:[p.jsxs("div",{className:"vertebr-table-toolbar",children:[p.jsx("div",{className:"vertebr-table-toolbar-start",children:p.jsxs("div",{className:"vertebr-emails-segment",role:"group","aria-label":"Activity",children:[p.jsx("button",{type:"button","data-active":o==="all"?"true":void 0,onClick:()=>l("all"),children:"All"}),p.jsx("button",{type:"button","data-active":o==="scheduled"?"true":void 0,onClick:()=>l("scheduled"),children:"Scheduled"}),p.jsx("button",{type:"button","data-active":o==="history"?"true":void 0,onClick:()=>l("history"),children:"History"})]})}),p.jsx(XC,{value:u,onChange:d,"aria-label":"Search activity"}),p.jsx(ab,{canLeft:x.canLeft,canRight:x.canRight,onScroll:x.scrollBy}),p.jsx("span",{className:"vertebr-count",children:u.trim()?`${v.length} of ${b.length}`:b.length})]}),b.length===0?p.jsx("div",{className:"vertebr-empty",children:M}):v.length===0?p.jsx("div",{className:"vertebr-empty",children:"No matching activity."}):p.jsx(ob,{overflow:x,children:p.jsxs("table",{className:"vertebr-table",children:[p.jsx("thead",{children:p.jsxs("tr",{children:[_("When","when"),_("Status","status"),_("Subject","subject"),p.jsx("th",{children:"Confirmation"}),_("To","to"),_("Audience","audience"),_("Template","template"),p.jsx("th",{children:"Via"}),p.jsx("th",{children:"Delivery"}),k?p.jsx("th",{className:"vertebr-col-actions",children:"Actions"}):null]})}),p.jsx("tbody",{children:v.map(N=>{if(N.kind==="scheduled"){const O=N.campaign,G=EO("scheduled");return p.jsxs("tr",{children:[p.jsx("td",{children:p.jsx("span",{className:"vertebr-cell-datetime",children:SO(O.sendAt)})}),p.jsx("td",{children:p.jsx("span",{className:"vertebr-badge","data-tone":G.tone,children:G.label})}),p.jsx("td",{children:O.subject?.trim()||p.jsx(ii,{})}),p.jsx("td",{children:p.jsx(ii,{})}),p.jsx("td",{children:O.recipientCount??p.jsx(ii,{})}),p.jsx("td",{children:O.resourceLabel??O.resourceId}),p.jsx("td",{children:O.templateLabel??O.templateId}),p.jsx("td",{children:"Schedule"}),p.jsx("td",{children:p.jsx(ii,{})}),k?p.jsx("td",{className:"vertebr-col-actions",children:p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:s,onClick:()=>{E(O)},children:"Cancel"})}):null]},`scheduled:${N.id}`)}const T=N.entry,A=EO(T.status),j=ES(T),P=NS(T);return p.jsxs("tr",{children:[p.jsx("td",{children:p.jsx("span",{className:"vertebr-cell-datetime",children:SO(T.at)})}),p.jsx("td",{children:p.jsx("span",{className:"vertebr-badge","data-tone":A.tone,children:A.label})}),p.jsx("td",{children:TS(T)||p.jsx(ii,{})}),p.jsx("td",{children:j||p.jsx(ii,{})}),p.jsx("td",{children:P||p.jsx(ii,{})}),p.jsx("td",{children:(T.resourceLabel??T.resourceId)||p.jsx(ii,{})}),p.jsx("td",{children:(T.templateLabel??Zoe(T.templateId))||p.jsx(ii,{})}),p.jsx("td",{children:kO(T.source)}),p.jsx("td",{children:CO(T)}),k?p.jsx("td",{className:"vertebr-col-actions",children:p.jsx(ii,{})}):null]},`history:${N.id}`)})})]})})]})}function Joe({value:t,options:e,onChange:n,ariaLabel:r,size:s="md"}){const[i,o]=C.useState(!1),l=C.useRef(null),u=C.useId(),d=e.find(h=>h.id===t)??e[0];return C.useEffect(()=>{if(!i)return;const h=y=>{l.current?.contains(y.target)||o(!1)},m=y=>{y.key==="Escape"&&o(!1)};return document.addEventListener("mousedown",h),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",m)}},[i]),p.jsxs("div",{className:"vertebr-emails-nav","data-size":s,"data-open":i||void 0,ref:l,children:[p.jsxs("button",{type:"button",className:"vertebr-emails-nav-trigger","aria-label":r,"aria-haspopup":"listbox","aria-expanded":i,"aria-controls":u,onClick:()=>o(h=>!h),children:[p.jsxs("span",{className:"vertebr-emails-nav-current",children:[p.jsx("span",{className:"vertebr-emails-nav-label",children:d?.label}),d?.count!=null?p.jsx("span",{className:"vertebr-emails-nav-count",children:d.count}):null]}),p.jsx("span",{className:"vertebr-emails-nav-chevron","aria-hidden":"true",children:"▾"})]}),i?p.jsx("ul",{id:u,className:"vertebr-emails-nav-menu",role:"listbox","aria-label":r,children:e.map(h=>{const m=h.id===t;return p.jsx("li",{role:"presentation",children:p.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:[p.jsxs("span",{className:"vertebr-emails-nav-option-main",children:[p.jsx("span",{className:"vertebr-emails-nav-label",children:h.label}),h.count!=null?p.jsx("span",{className:"vertebr-emails-nav-count",children:h.count}):null]}),h.hint?p.jsx("span",{className:"vertebr-emails-nav-hint",children:h.hint}):null]})},h.id)})}):null]})}const Qoe=new Set(["custom","promo","custom_discount"]);function eae(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim()}function tae(t){const e=new Set,n=[];for(const r of t){const s=r.input?.preset;if(!(!s||typeof s=="string")&&!(s.type!=="enum"||!s.options?.length))for(const i of s.options)!i||Qoe.has(i)||i.startsWith("library:")||e.has(i)||(e.add(i),n.push({id:i,label:s.optionLabels?.[i]?.trim()||eae(i)}))}return n}function jw(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 nae(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 rae(t){return Array.isArray(t)?t.join(", "):t}function sae(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 iae(t){return t.kind==="order"?!0:!t.subject.trim()||!t.body.trim()?!1:t.kind==="discount"?!!(t.discountCode.trim()&&t.discountOffer.trim()):!0}function oae({templates:t,library:e,products:n,discounts:r=[],canLibrary:s,busy:i,previewResourceId:o,previewTemplateId:l,onPreview:u,onSaveLibrary:d,onDeleteLibrary:h}){const m=C.useMemo(()=>tae(t),[t]),[y,b]=C.useState(null),[v,x]=C.useState(!1),[k,E]=C.useState(null),[M,_]=C.useState("all"),[N,T]=C.useState(null),[A,j]=C.useState(!1),P=!!(y&&e.some(I=>I.id===y.id)),O=C.useMemo(()=>n.map(I=>({id:I.id,label:I.label,secondary:I.priceLabel,imageUrl:I.imageUrl})),[n]),G=C.useCallback(async()=>{if(!y||!u||!o||!l){T(null);return}if(!iae(y)){T(null);return}j(!0);try{const I=await u({resourceId:o,templateId:l,input:sae(y,P)});T(I)}catch{T(null)}finally{j(!1)}},[y,u,o,l,P]);C.useEffect(()=>{const I=window.setTimeout(()=>{G()},280);return()=>window.clearTimeout(I)},[G]);const B=I=>{E(null),b(jw({label:`${I.label} copy`,fromPreset:I.id,kind:nae(I.id)}))},W=I=>{E(null),b(jw({id:I.id,label:I.label,subject:I.subject,body:I.body,productIds:I.productIds??[],discountId:I.discountId,discountCode:I.discountCode??"",discountOffer:I.discountOffer??"",discountExpires:I.discountExpires??"",fromPreset:I.fromPreset,kind:I.kind,eyebrow:I.eyebrow??"",headline:I.headline??"",confirmationLabel:I.confirmationLabel??"",shippingNote:I.shippingNote??"",footer:I.footer??"",signOff:I.signOff??"",createdAt:I.createdAt}))},K=()=>{E(null),b(jw({kind:"promo"}))},Q=async()=>{if(!y||!d)return;const I=y.label.trim(),z=y.subject.trim(),J=y.body.trim();if(!I||!z||!J){E("Label, subject, and body are required.");return}if(y.kind==="discount"&&(!y.discountCode.trim()||!y.discountOffer.trim())){E("Discount templates need a code and offer label.");return}x(!0),E(null);try{const X=new Date().toISOString();await d({id:y.id,label:I,subject:z,body:J,productIds:y.productIds.length?y.productIds:void 0,discountId:y.kind==="discount"&&y.discountId||void 0,discountCode:y.kind==="discount"&&y.discountCode.trim()||void 0,discountOffer:y.kind==="discount"&&y.discountOffer.trim()||void 0,discountExpires:y.kind==="discount"&&y.discountExpires.trim()||void 0,fromPreset:y.fromPreset,kind:y.kind,eyebrow:y.kind==="order"&&y.eyebrow.trim()||void 0,headline:y.kind==="order"&&y.headline.trim()||void 0,confirmationLabel:y.kind==="order"&&y.confirmationLabel.trim()||void 0,shippingNote:y.kind==="order"&&y.shippingNote.trim()||void 0,footer:y.kind==="order"&&y.footer.trim()||void 0,signOff:y.kind==="order"&&y.signOff.trim()||void 0,createdAt:y.createdAt??X,updatedAt:X}),b(null)}catch(X){E(X instanceof Error?X.message:"Save failed")}finally{x(!1)}},ee=async I=>{if(h&&window.confirm(`Delete template “${I.label}”?`)){x(!0),E(null);try{await h(I.id),y?.id===I.id&&b(null)}catch(z){E(z instanceof Error?z.message:"Delete failed")}finally{x(!1)}}},F=i||v||!s||!d;return p.jsx("div",{className:"vertebr-emails-library","data-editing":y?"true":void 0,children:y?p.jsxs("div",{className:"vertebr-emails-library-editor",children:[p.jsxs("header",{children:[p.jsx("h3",{children:P?"Edit template":"Save as custom"}),p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:v,onClick:()=>{b(null),T(null)},children:"Close"})]}),p.jsxs("div",{className:"vertebr-emails-layout",children:[p.jsxs("div",{className:"vertebr-emails-compose",children:[p.jsxs("div",{className:"vertebr-emails-fields",children:[p.jsxs("label",{className:"vertebr-mail-field",children:[p.jsx("span",{children:"Label"}),p.jsx("input",{type:"text",value:y.label,disabled:v,onChange:I=>b(z=>z&&{...z,label:I.target.value})})]}),p.jsx("div",{className:"vertebr-emails-segment",role:"group","aria-label":"Kind",children:[["account","Account"],["promo","Promo"],["discount","Discount"],["order","Order"]].map(([I,z])=>p.jsx("button",{type:"button","data-active":y.kind===I?"true":void 0,disabled:v||y.kind==="order",onClick:()=>b(J=>J&&{...J,kind:I}),children:z},I))}),p.jsxs("label",{className:"vertebr-mail-field",children:[p.jsx("span",{children:"Subject"}),p.jsx("input",{type:"text",value:y.subject,disabled:v,onChange:I=>b(z=>z&&{...z,subject:I.target.value})})]}),p.jsxs("label",{className:"vertebr-mail-field",children:[p.jsx("span",{children:y.kind==="order"?"Intro":"Body"}),p.jsx("textarea",{rows:y.kind==="order"?4:7,value:y.body,disabled:v,onChange:I=>b(z=>z&&{...z,body:I.target.value})})]}),y.kind==="order"?p.jsxs(p.Fragment,{children:[p.jsxs("label",{className:"vertebr-mail-field",children:[p.jsx("span",{children:"Eyebrow"}),p.jsx("input",{type:"text",value:y.eyebrow,disabled:v,onChange:I=>b(z=>z&&{...z,eyebrow:I.target.value})})]}),p.jsxs("label",{className:"vertebr-mail-field",children:[p.jsx("span",{children:"Headline"}),p.jsx("input",{type:"text",value:y.headline,disabled:v,onChange:I=>b(z=>z&&{...z,headline:I.target.value})})]}),p.jsxs("label",{className:"vertebr-mail-field",children:[p.jsx("span",{children:"Confirmation label"}),p.jsx("input",{type:"text",value:y.confirmationLabel,disabled:v,onChange:I=>b(z=>z&&{...z,confirmationLabel:I.target.value})})]}),p.jsxs("label",{className:"vertebr-mail-field",children:[p.jsx("span",{children:"Shipping note"}),p.jsx("textarea",{rows:2,value:y.shippingNote,disabled:v,onChange:I=>b(z=>z&&{...z,shippingNote:I.target.value})})]}),p.jsxs("label",{className:"vertebr-mail-field",children:[p.jsx("span",{children:"Footer"}),p.jsx("textarea",{rows:2,value:y.footer,disabled:v,onChange:I=>b(z=>z&&{...z,footer:I.target.value})})]}),p.jsxs("label",{className:"vertebr-mail-field",children:[p.jsx("span",{children:"Sign-off"}),p.jsx("input",{type:"text",value:y.signOff,disabled:v,onChange:I=>b(z=>z&&{...z,signOff:I.target.value})})]}),p.jsxs("p",{className:"vertebr-mail-compose-hint",children:["Tokens: ","{{confirmationNumber}}",", ","{{email}}",","," ","{{total}}"]})]}):null,y.kind==="discount"?p.jsxs(p.Fragment,{children:[r.length>0?p.jsxs("label",{className:"vertebr-mail-field",children:[p.jsx("span",{children:"Discount"}),p.jsxs("select",{value:y.discountId??"",disabled:v,onChange:I=>{const z=I.target.value,J=r.find(X=>X.id===z);b(X=>X&&{...X,discountId:z||void 0,discountCode:J?.code??X.discountCode,discountOffer:J?.offerLabel??J?.label??X.discountOffer,discountExpires:J?.expiresLabel??X.discountExpires})},children:[p.jsx("option",{value:"",children:"Manual code…"}),r.map(I=>p.jsxs("option",{value:I.id,children:[I.label,I.code?` (${I.code})`:""]},I.id))]})]}):null,p.jsxs("label",{className:"vertebr-mail-field",children:[p.jsx("span",{children:"Discount code"}),p.jsx("input",{type:"text",value:y.discountCode,disabled:v,placeholder:"WELCOME20",onChange:I=>b(z=>z&&{...z,discountCode:I.target.value})})]}),p.jsxs("label",{className:"vertebr-mail-field",children:[p.jsx("span",{children:"Offer label"}),p.jsx("input",{type:"text",value:y.discountOffer,disabled:v,placeholder:"20% off",onChange:I=>b(z=>z&&{...z,discountOffer:I.target.value})})]}),p.jsxs("label",{className:"vertebr-mail-field",children:[p.jsx("span",{children:"Expires (optional)"}),p.jsx("input",{type:"text",value:y.discountExpires,disabled:v,placeholder:"Expires Mar 1",onChange:I=>b(z=>z&&{...z,discountExpires:I.target.value})})]})]}):null,O.length>0?p.jsxs("label",{className:"vertebr-mail-field",children:[p.jsx("span",{children:"Products"}),p.jsx(ty,{options:O,value:y.productIds,disabled:v,placeholder:"Add products with photos…",emptyLabel:"No products",onChange:I=>b(z=>z&&{...z,productIds:I})})]}):null,y.fromPreset?p.jsxs("p",{className:"vertebr-emails-library-meta",children:["From system preset ",p.jsx("code",{children:y.fromPreset})]}):null,k?p.jsx("p",{className:"vertebr-mail-compose-error",children:k}):null]}),p.jsx("div",{className:"vertebr-mail-compose-foot",children:p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",disabled:v||!d,onClick:()=>{Q()},children:v?"Saving…":"Save template"})})]}),p.jsx("div",{className:"vertebr-emails-side",children:p.jsxs("div",{className:"vertebr-mail-preview",children:[p.jsxs("div",{className:"vertebr-mail-preview-meta",children:[p.jsxs("p",{children:[p.jsx("span",{children:"To"}),p.jsx("strong",{children:N?rae(N.to):A?"Updating…":"Sample recipient"})]}),p.jsxs("p",{children:[p.jsx("span",{children:"Subject"}),p.jsx("strong",{children:N?.subject??(A?"Updating…":y.subject||"—")})]})]}),p.jsx("div",{className:"vertebr-mail-preview-stage",children:p.jsx("div",{className:"vertebr-mail-preview-frame",children:N?.html?p.jsx("iframe",{title:"Email preview",sandbox:"",srcDoc:N.html}):N?.text?p.jsx("pre",{children:N.text}):p.jsx("div",{className:"vertebr-mail-preview-empty",children:A?"Rendering host template…":!o||!l?"No sample audience to preview against.":y.kind==="discount"&&(!y.discountCode.trim()||!y.discountOffer.trim())?"Add a discount code and offer to preview.":"Write a subject and body to preview."})})})]})})]})]}):p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"vertebr-emails-subnav",children:[p.jsx(Joe,{size:"sm",ariaLabel:"Templates subsection",value:M,onChange:_,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"}]}),s&&d&&M!=="system"?p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:F,onClick:K,children:"New"}):null]}),p.jsxs("div",{className:"vertebr-emails-library-cols","data-section":M,children:[M!=="saved"?p.jsxs("section",{className:"vertebr-emails-library-section",children:[p.jsxs("header",{children:[p.jsx("h3",{children:"System presets"}),p.jsx("span",{className:"vertebr-count",children:m.length})]}),m.length===0?p.jsx("p",{className:"vertebr-emails-campaigns-empty",children:"No system presets exposed on template inputs."}):p.jsx("ul",{children:m.map(I=>p.jsxs("li",{children:[p.jsxs("div",{children:[p.jsx("strong",{children:I.label}),p.jsx("span",{children:I.id})]}),s&&d?p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:F,onClick:()=>B(I),children:"Duplicate"}):null]},I.id))})]}):null,M!=="system"?p.jsxs("section",{className:"vertebr-emails-library-section",children:[p.jsxs("header",{children:[p.jsx("h3",{children:"Saved templates"}),p.jsx("span",{className:"vertebr-count",children:e.length})]}),s?e.length===0?p.jsx("p",{className:"vertebr-emails-campaigns-empty",children:"No saved templates yet. Duplicate a system preset or create one."}):p.jsx("ul",{children:e.map(I=>p.jsxs("li",{children:[p.jsxs("div",{children:[p.jsx("strong",{children:I.label}),p.jsxs("span",{children:[I.fromPreset?`from ${I.fromPreset}`:"custom",I.kind==="discount"?" · discount":"",I.kind==="order"?" · order":"",I.discountCode?` · ${I.discountCode}`:"",I.productIds?.length?` · ${I.productIds.length} products`:""]}),I.subject?p.jsx("span",{className:"vertebr-emails-campaign-subject",children:I.subject}):null]}),p.jsxs("div",{className:"vertebr-emails-library-actions",children:[p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:F,onClick:()=>W(I),children:"Edit"}),h&&I.kind!=="order"?p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:F,onClick:()=>{ee(I)},children:"Delete"}):null]})]},I.id))}):p.jsx("p",{className:"vertebr-emails-campaigns-empty",children:"Host has not enabled the template library."})]}):null]})]})})}const aae=new Set(["custom","promo","custom_discount"]),lae=new Set(["discount","welcome_offer","flash_sale","custom_discount"]),cae=new Set(["discountId","discountCode","discountOffer","discountExpires"]);function wu(t){return typeof t=="string"?t:String(t??"")}function e1(t){return t.startsWith("library:")}function uae(t){return aae.has(t)||e1(t)}function t1(t,e){if(lae.has(t))return!0;if(!e1(t))return!1;const n=t.slice(8);return e.some(r=>r.id===n&&r.kind==="discount")}function dae(t,e){const n=`${t} ${e.label??""}`;return e.type==="richtext"||/(body|message|html|notes)/i.test(n)}function Ez(t,e){if(!t.preset)return!0;const n=wu(e.preset);return!n||uae(n)}function Tz(t,e,n,r=[]){if(t==="subject"||t==="body")return Ez(e,n);if(cae.has(t)){const s=wu(n.preset);return!(!t1(s,r)||t==="discountId"&&!e.discountId?.options?.length)}return!0}function NO(t,e,n=[]){return Object.entries(t).every(([r,s])=>{if(!Tz(r,t,e,n))return!0;const i=(r==="subject"||r==="body")&&Ez(t,e),o=(r==="discountCode"||r==="discountOffer")&&t1(wu(e.preset),n);return s.required===!1&&!i&&!o?!0:s.type==="enum[]"?s.required===!1?!0:Array.isArray(e[r])&&e[r].length>0:s.type!=="string"&&s.type!=="richtext"&&s.type!=="enum"?!0:!!wu(e[r]).trim()})}function fae(t){return t?Object.fromEntries(Object.entries(t).map(([e,n])=>typeof n=="string"?[e,{type:n,label:e,required:!0}]:[e,n])):{}}function hae(t,e,n,r){const s={...t};if(s.preset?.type==="enum"&&e.length>0){const i=e.map(u=>`library:${u.id}`),o=Object.fromEntries(e.map(u=>[`library:${u.id}`,u.label])),l=[...s.preset.options??[]];for(const u of i)l.includes(u)||l.push(u);s.preset={...s.preset,options:l,optionLabels:{...s.preset.optionLabels??{},...o}}}if(s.productIds&&n&&n.length>0){const i=n.map(l=>l.id),o=Object.fromEntries(n.map(l=>[l.id,l.label]));s.productIds={...s.productIds,type:"enum[]",options:i,optionLabels:{...s.productIds.optionLabels??{},...o},default:Array.isArray(s.productIds.default)?s.productIds.default:[]}}if(s.discountId&&r&&r.length>0){const i=r.map(l=>l.id),o=Object.fromEntries(r.map(l=>[l.id,l.offerLabel?`${l.label}${l.code?` (${l.code})`:""}`:l.label]));s.discountId={...s.discountId,type:"enum",options:i,optionLabels:{...s.discountId.optionLabels??{},...o},required:!1}}return s}function pae(t){const e=KC(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 mae(t,e,n,r){if(!e1(e))return t;const s=e.slice(8),i=n.find(o=>o.id===s);return i?{...t,preset:e,subject:i.subject,body:i.body,...r.productIds?{productIds:i.productIds??[]}:{},...r.discountId?{discountId:i.discountId??""}:{},...r.discountCode?{discountCode:i.discountCode??""}:{},...r.discountOffer?{discountOffer:i.discountOffer??""}:{},...r.discountExpires?{discountExpires:i.discountExpires??""}:{}}:t}function gae(t){return Array.isArray(t)?t.join(", "):t}function yae(t){const e=Date.parse(t);return Number.isFinite(e)?new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(e):t}function bae(){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 vae(t){return Array.isArray(t)?t.map(e=>String(e).trim()).filter(Boolean):[]}function wae({data:t,loading:e,tab:n,onRefresh:r,onLoadRecipients:s,onPreview:i,onSend:o,onSchedule:l,onCancel:u,onSaveLibrary:d,onDeleteLibrary:h}){const m=t.audiences,y=t.library??[],b=t.products??[],v=t.discounts??[],x=t.history??[],[k]=C.useState("compose"),E=n??k,M=C.useMemo(()=>m.map(xe=>({id:xe.id,label:xe.label})),[m]),[_,N]=C.useState(()=>m[0]?[m[0].id]:[]),T=C.useMemo(()=>m.filter(xe=>_.includes(xe.id)),[m,_]),A=C.useMemo(()=>T.length===0?[]:t.templates.filter(xe=>T.every($e=>$e.templates.includes(xe.id))),[t.templates,T]),[j,P]=C.useState(A[0]?.id??""),O=A.find(xe=>xe.id===j)??A[0],G=C.useMemo(()=>hae(fae(O?.input),y,b,v),[v,y,b,O]),B=C.useMemo(()=>pae(G),[G]),[W,K]=C.useState(B),[Q,ee]=C.useState("all"),[F,I]=C.useState([]),[z,J]=C.useState([]),[X,L]=C.useState(!1),[q,ie]=C.useState("now"),[de,Te]=C.useState(bae),[De,je]=C.useState(null),[Ne,oe]=C.useState(!1),[ye,Pe]=C.useState(!1),[Ye,Ke]=C.useState(null),[ut,Xe]=C.useState(null);C.useEffect(()=>{N(xe=>{const $e=xe.filter($=>m.some(V=>V.id===$));return $e.length>0?$e:m[0]?[m[0].id]:[]})},[m]),C.useEffect(()=>{if(!O){P("");return}A.some(xe=>xe.id===j)||P(O.id)},[O,j,A]),C.useEffect(()=>{K(B)},[B]),C.useEffect(()=>{I([])},[_]);const Vt=T.map(xe=>xe.id).join("|");C.useEffect(()=>{if(T.length===0){J([]);return}let xe=!1;return L(!0),Promise.all(T.map(async $e=>(await s($e.id)).map(V=>({...V,resourceId:$e.id,label:V.label?`${V.label} · ${$e.label}`:$e.label})))).then($e=>{if(xe)return;const $=new Set,V=[];for(const U of $e)for(const ae of U){const ce=ae.email.trim().toLowerCase();!ce||$.has(ce)||($.add(ce),V.push({...ae,email:ce}))}V.sort((U,ae)=>U.email.localeCompare(ae.email)),J(V)}).catch($e=>{xe||(J([]),Ke($e instanceof Error?$e.message:"Failed to load emails"))}).finally(()=>{xe||L(!1)}),()=>{xe=!0}},[Vt,s,T]);const un=T[0],qt=T.length>0&&!!O&&(!Object.keys(G).length||NO(G,W,y))&&(Q==="all"||F.length>0)&&(q==="now"||!!de)&&!ye,kn=C.useMemo(()=>{if(Q!=="emails"||F.length===0)return;const xe=z.find($e=>$e.email.trim().toLowerCase()===F[0]?.toLowerCase());return xe?.id??xe?.email??F[0]},[z,Q,F]),dn=C.useMemo(()=>{if(Q==="emails"&&F[0]){const xe=z.find($e=>$e.email.trim().toLowerCase()===F[0]?.toLowerCase());if(xe?.resourceId)return xe.resourceId}return un?.id},[un?.id,z,Q,F]),In=C.useCallback(async()=>{if(E==="compose"){if(!dn||!O){je(null);return}if(Object.keys(G).length&&!NO(G,W,y)){je(null);return}oe(!0),Ke(null);try{const xe=await i({resourceId:dn,templateId:O.id,rowId:kn,input:Object.keys(G).length?W:void 0});je(xe)}catch(xe){je(null),Ke(xe instanceof Error?xe.message:"Preview failed")}finally{oe(!1)}}},[W,i,dn,kn,G,E,O]);C.useEffect(()=>{const xe=window.setTimeout(()=>{In()},280);return()=>window.clearTimeout(xe)},[In]);const Ln=xe=>{const $e=z.find($=>$.email.trim().toLowerCase()===xe.toLowerCase());return $e?.resourceId?[$e.resourceId]:T.map($=>$.id)},Yn=async()=>{if(!(!qt||!O||T.length===0)){Pe(!0),Ke(null),Xe(null);try{const xe=Object.keys(G).length?W:void 0;if(q==="later"){if(!l)throw new Error("Scheduling is not available.");const $e=new Date(de).toISOString();if(Q==="all")for(const $ of T)await l({resourceId:$.id,templateId:O.id,input:xe,audience:{mode:"all"},sendAt:$e});else{const $=new Map;for(const V of F)for(const U of Ln(V)){const ae=$.get(U)??[];ae.push(V),$.set(U,ae)}for(const[V,U]of $)await l({resourceId:V,templateId:O.id,input:xe,audience:{mode:"emails",emails:U},sendAt:$e})}Xe(`Scheduled for ${yae($e)}.`)}else{let $e=0,$=0;if(Q==="all")for(const V of T){const U=await o({resourceId:V.id,templateId:O.id,input:xe,audience:{mode:"all"}});$e+=U.sent,$+=U.failed}else{const V=new Map;for(const U of F)for(const ae of Ln(U)){const ce=V.get(ae)??[];ce.push(U),V.set(ae,ce)}for(const[U,ae]of V){const ce=await o({resourceId:U,templateId:O.id,input:xe,audience:{mode:"emails",emails:ae}});$e+=ce.sent,$+=ce.failed}}Xe($>0?`Sent ${$e}. ${$} failed.`:`Sent ${$e}.`)}await r()}catch(xe){Ke(xe instanceof Error?xe.message:"Request failed")}finally{Pe(!1)}}},ht=async xe=>{if(u){Pe(!0),Ke(null);try{await u(xe),await r()}catch($e){Ke($e instanceof Error?$e.message:"Cancel failed")}finally{Pe(!1)}}},Bn=async xe=>{d&&(await d(xe),await r())},lr=async xe=>{h&&(await h(xe),await r())},vr=Object.entries(G).filter(([xe])=>Tz(xe,G,W,y)),Pn=(xe,$e)=>{K($=>{let V={...$,[xe]:$e};if(xe==="preset"&&typeof $e=="string"){V=mae(V,$e,y,G);const U=$e==="drop_live"||$e==="restock"||$e==="promo"||t1($e,y)||y.some(ce=>`library:${ce.id}`===$e&&(ce.kind==="promo"||(ce.productIds?.length??0)>0)),ae=Array.isArray(V.productIds)?V.productIds:[];U&&ae.length===0&&b[0]&&G.productIds&&(V={...V,productIds:[b[0].id]})}if(xe==="discountId"&&typeof $e=="string"){const U=v.find(ae=>ae.id===$e);U&&(V={...V,discountCode:U.code??V.discountCode??"",discountOffer:U.offerLabel??U.label??V.discountOffer??"",discountExpires:U.expiresLabel??V.discountExpires??""})}return V})};return m.length===0?p.jsxs("div",{className:"vertebr-emails",children:[p.jsx("div",{className:"vertebr-panel-head",children:p.jsx("h2",{children:t.label})}),p.jsxs("div",{className:"vertebr-empty",children:["No mail-enabled resources yet. Opt a resource in with"," ",p.jsx("code",{children:'mail: ["sendEmail"]'}),"."]})]}):p.jsxs("div",{className:"vertebr-emails",children:[p.jsxs("div",{className:"vertebr-panel-head",children:[p.jsx("h2",{children:t.label}),p.jsx("div",{className:"vertebr-panel-head-actions",children:p.jsx("button",{type:"button",className:"vertebr-btn",onClick:()=>{r()},disabled:e||ye,children:e?"Refreshing…":"Refresh"})})]}),E==="compose"?p.jsxs("div",{className:"vertebr-emails-layout",children:[p.jsxs("form",{className:"vertebr-emails-compose",onSubmit:xe=>{xe.preventDefault(),Yn()},children:[p.jsxs("div",{className:"vertebr-emails-fields",children:[p.jsxs("label",{className:"vertebr-mail-field",children:[p.jsx("span",{children:"Audience"}),p.jsx(ty,{options:M,value:_,disabled:ye,placeholder:"Select audiences…",emptyLabel:"No audiences",onChange:xe=>{if(xe.length===0&&m[0]){N([m[0].id]);return}N(xe)}})]}),p.jsxs("div",{className:"vertebr-emails-segment",role:"group","aria-label":"Scope",children:[p.jsx("button",{type:"button","data-active":Q==="all"?"true":void 0,onClick:()=>ee("all"),children:"Entire list"}),p.jsx("button",{type:"button","data-active":Q==="emails"?"true":void 0,onClick:()=>ee("emails"),children:"Specific emails"})]}),Q==="emails"?p.jsxs("label",{className:"vertebr-mail-field",children:[p.jsx("span",{children:"Emails"}),p.jsx(Poe,{options:z,value:F,loading:X,disabled:ye,onChange:I})]}):null,p.jsxs("label",{className:"vertebr-mail-field",children:[p.jsx("span",{children:"Template"}),p.jsx("select",{value:O?.id??"",onChange:xe=>P(xe.target.value),children:A.map(xe=>p.jsx("option",{value:xe.id,children:xe.label},xe.id))})]}),vr.map(([xe,$e])=>{const $=dae(xe,$e);return p.jsxs("label",{className:"vertebr-mail-field",children:[p.jsx("span",{children:$e.label??xe}),$e.type==="enum"?p.jsx(YC,{id:`emails-${xe}`,value:W[xe],field:$e,onChange:V=>Pn(xe,V)}):$e.type==="enum[]"?p.jsx(ty,{options:($e.options??[]).map(V=>{const U=xe==="productIds"?b.find(ae=>ae.id===V):void 0;return{id:V,label:$e.optionLabels?.[V]??V,secondary:U?.priceLabel,imageUrl:U?.imageUrl}}),value:vae(W[xe]),disabled:ye,placeholder:xe==="productIds"?"Add products with photos…":`Select ${$e.label??xe}…`,emptyLabel:"Nothing available",onChange:V=>Pn(xe,V)}):$?p.jsx("textarea",{rows:6,value:wu(W[xe]),onChange:V=>Pn(xe,V.target.value)}):p.jsx("input",{type:"text",value:wu(W[xe]),onChange:V=>Pn(xe,V.target.value)})]},xe)}),p.jsxs("div",{className:"vertebr-emails-segment",role:"group","aria-label":"When",children:[p.jsx("button",{type:"button","data-active":q==="now"?"true":void 0,onClick:()=>ie("now"),children:"Send now"}),p.jsx("button",{type:"button","data-active":q==="later"?"true":void 0,disabled:!t.canSchedule||!l,onClick:()=>ie("later"),children:"Schedule"})]}),q==="later"?p.jsxs("label",{className:"vertebr-mail-field",children:[p.jsx("span",{children:"Send at"}),p.jsx("input",{type:"datetime-local",value:de,onChange:xe=>Te(xe.target.value)})]}):null,Ye?p.jsx("p",{className:"vertebr-mail-compose-error",children:Ye}):null,ut?p.jsx("p",{className:"vertebr-emails-notice",children:ut}):null]}),p.jsx("div",{className:"vertebr-mail-compose-foot",children:p.jsx("button",{type:"submit",className:"vertebr-btn vertebr-btn-primary",disabled:!qt,children:ye?q==="later"?"Scheduling…":"Sending…":q==="later"?"Schedule email":Q==="all"?"Send to list":"Send"})})]}),p.jsx("div",{className:"vertebr-emails-side",children:p.jsxs("div",{className:"vertebr-mail-preview",children:[p.jsxs("div",{className:"vertebr-mail-preview-meta",children:[p.jsxs("p",{children:[p.jsx("span",{children:"To"}),p.jsx("strong",{children:De?gae(De.to):Q==="all"?T.length===0?"—":T.length===1?`Everyone on ${T[0]?.label}`:`Everyone on ${T.length} lists`:F.length>0?F.length===1?F[0]:`${F.length} selected`:"—"})]}),p.jsxs("p",{children:[p.jsx("span",{children:"Subject"}),p.jsx("strong",{children:De?.subject??(Ne?"Updating…":"—")})]})]}),p.jsx("div",{className:"vertebr-mail-preview-stage",children:p.jsx("div",{className:"vertebr-mail-preview-frame",children:De?.html?p.jsx("iframe",{title:"Email preview",sandbox:"",srcDoc:De.html}):De?.text?p.jsx("pre",{children:De.text}):p.jsx("div",{className:"vertebr-mail-preview-empty",children:Ne?"Rendering host template…":"Pick an audience and template to preview."})})})]})})]}):null,E==="templates"?p.jsx(oae,{templates:t.templates,library:y,products:b,discounts:v,canLibrary:t.canLibrary,busy:ye,previewResourceId:t.audiences[0]?.id,previewTemplateId:t.templates.find(xe=>xe.id==="sendEmail")?.id??t.templates[0]?.id,onPreview:i,onSaveLibrary:d?Bn:void 0,onDeleteLibrary:h?lr:void 0}):null,E==="activity"?p.jsx(Xoe,{campaigns:t.campaigns,history:x,canSchedule:t.canSchedule,canHistory:t.canHistory,busy:ye,onCancel:u?ht:void 0}):null]})}function xae(t){return`https://fonts.googleapis.com/css2?family=${encodeURIComponent(t)}:wght@400;600;700&display=swap`}function Nz({open:t,title:e,subtitle:n,family:r,files:s,googleFamily:i,bodyWeight:o,headingWeight:l,onClose:u,onConfirm:d,confirmLabel:h="Use this font"}){const m=C.useId().replace(/:/g,""),y=C.useMemo(()=>s?.length?oD({family:r,files:s}):"",[s,r,e]);if(C.useEffect(()=>{if(!t)return;let x=null;return i&&!s?.length&&(x=document.createElement("link"),x.rel="stylesheet",x.href=xae(i),document.head.appendChild(x)),()=>{x?.remove()}},[t,i,s?.length]),C.useEffect(()=>{if(!t)return;const x=k=>{k.key==="Escape"&&u()};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[t,u]),!t)return null;const b=o??s?.find(x=>x.weight>=400&&x.weight<600)?.weight??s?.[0]?.weight??400,v=l??s?.find(x=>x.weight>=600)?.weight??s?.[s.length-1]?.weight??700;return p.jsxs("div",{className:"vertebr-font-preview-modal-backdrop",onClick:u,children:[y?p.jsx("style",{id:m,dangerouslySetInnerHTML:{__html:y}}):null,p.jsxs("div",{className:"vertebr-font-preview-modal",role:"dialog","aria-modal":"true","aria-labelledby":`${m}-title`,onClick:x=>x.stopPropagation(),children:[p.jsxs("div",{className:"vertebr-font-preview-modal-head",children:[p.jsxs("div",{children:[p.jsx("h3",{id:`${m}-title`,children:e}),n?p.jsx("p",{children:n}):null]}),p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:u,children:"Close"})]}),p.jsx("div",{className:"vertebr-font-preview-modal-body",children:p.jsx(Tm,{family:r,bodyWeight:b,headingWeight:v})}),d?p.jsxs("div",{className:"vertebr-font-preview-modal-actions",children:[p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:u,children:"Cancel"}),p.jsx("button",{type:"button",className:"vertebr-btn",onClick:d,children:h})]}):null]})]})}function Sae({disabled:t,existingFamilies:e,onImport:n}){const[r,s]=C.useState(""),[i,o]=C.useState(null),[l,u]=C.useState(null),[d,h]=C.useState(null),m=C.useMemo(()=>{const b=r.trim().toLowerCase();return b?HM.filter(v=>v.family.toLowerCase().includes(b)||v.category.includes(b)):HM},[r]),y=async b=>{if(!(t||i)){o(b.family),u(null);try{await n({family:b.family,weights:b.weights}),h(null)}catch(v){u(v instanceof Error?v.message:"Import failed")}finally{o(null)}}};return p.jsxs("section",{className:"vertebr-google-fonts",children:[p.jsxs("div",{className:"vertebr-google-fonts-head",children:[p.jsxs("div",{children:[p.jsx("h3",{children:"Google Fonts"}),p.jsx("p",{children:"Browse and add open-source fonts to your library."})]}),p.jsx("input",{type:"search",className:"vertebr-google-fonts-search",placeholder:"Search fonts…",value:r,onChange:b=>s(b.target.value)})]}),l?p.jsx("div",{className:"vertebr-error-inline",children:l}):null,p.jsx("div",{className:"vertebr-google-fonts-grid-scroll",children:p.jsx("div",{className:"vertebr-google-fonts-grid",children:m.map(b=>{const v=e.includes(b.family.toLowerCase());return p.jsxs("article",{className:"vertebr-google-fonts-card",children:[p.jsxs("button",{type:"button",className:"vertebr-google-fonts-preview-btn",onClick:()=>h(b),title:`Preview ${b.family}`,children:[p.jsxs("div",{className:"vertebr-google-fonts-card-copy",children:[p.jsx("strong",{children:b.family}),p.jsx("span",{children:b.category.replace("-"," ")}),p.jsx("span",{children:b.weights.join(", ")})]}),p.jsx("span",{className:"vertebr-font-library-preview-hint",children:"Click to preview"})]}),p.jsx("button",{type:"button",className:"vertebr-btn",disabled:t||v||i===b.family,onClick:()=>{y(b)},children:v?"In library":i===b.family?"Adding…":"Add to library"})]},b.family)})})}),p.jsx(Nz,{open:d!=null,title:d?.family??"Font preview",subtitle:d?`${d.category.replace("-"," ")} · weights ${d.weights.join(", ")}`:void 0,family:d?.family??"",googleFamily:d?.family,onClose:()=>h(null),onConfirm:d&&!e.includes(d.family.toLowerCase())?()=>{y(d)}:void 0,confirmLabel:d&&e.includes(d.family.toLowerCase())?"Already in library":"Add to library"})]})}function kae(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 Cae({label:t="Font Library",data:e,loading:n,onRefresh:r,onUpload:s,onImportGoogle:i,onDelete:o}){const[l,u]=C.useState(null),d={field:"fonts",accept:e.accept,maxBytes:e.maxBytes};return p.jsxs("div",{className:"vertebr-font-library",children:[p.jsx(rI,{items:e.items}),p.jsxs("div",{className:"vertebr-panel-head",children:[p.jsx("h2",{children:t}),p.jsxs("div",{className:"vertebr-font-library-head-actions",children:[p.jsx("span",{className:"vertebr-count",children:e.items.length}),r?p.jsx("button",{type:"button",className:"vertebr-btn",onClick:r,disabled:n,children:n?"Refreshing…":"Refresh"}):null]})]}),p.jsxs("div",{className:"vertebr-font-library-body",children:[e.canImportGoogle&&i?p.jsx(Sae,{disabled:n,onImport:i,existingFamilies:e.items.map(h=>h.family.toLowerCase())}):null,p.jsx(ku,{meta:d,multiple:!0,showOptimizeHint:!1,label:"Drop .woff2 / .woff / .ttf files here or browse to upload",onUpload:async h=>{for(const m of h){const y=m.name.replace(/\.[^.]+$/,""),b=/(?:^|[\s_-])(100|200|300|400|500|600|700|800|900)(?:[\s_-]|$)/i.exec(y),v=y.replace(/(?:^|[\s_-])(100|200|300|400|500|600|700|800|900)(?:[\s_-]|$)/gi," ").replace(/[\s_-]+/g," ").trim();await s([m],{family:v||void 0,weight:b?Number(b[1]):400})}}}),p.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?p.jsx("div",{className:"vertebr-empty",children:"No fonts in the library yet."}):p.jsx("div",{className:"vertebr-font-library-grid",children:e.items.map(h=>p.jsxs("article",{className:"vertebr-font-library-card",children:[p.jsxs("button",{type:"button",className:"vertebr-font-library-preview-btn",onClick:()=>u(h),title:`Preview ${h.label}`,children:[p.jsxs("div",{className:"vertebr-font-library-preview",style:kae(h),children:[p.jsx("span",{className:"vertebr-font-library-ag",children:"Ag"}),p.jsx("p",{children:"The quick brown fox jumps over the lazy dog."})]}),p.jsx("span",{className:"vertebr-font-library-preview-hint",children:"Click to preview"})]}),p.jsxs("div",{className:"vertebr-font-library-meta",children:[p.jsx("strong",{title:h.label,children:h.label}),p.jsxs("span",{children:[h.source==="google"?"Google Fonts":"Upload"," ·"," ",h.files.length," file",h.files.length===1?"":"s"]}),p.jsx("code",{children:h.id})]}),e.canDelete&&o?p.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))})]}),p.jsx(Nz,{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 Eae(t){return t.some(e=>/pdf/i.test(e)||e==="application/*"||e==="*/*")}function Tae(t){return t.length===0||t.some(e=>e.startsWith("image/")||e==="image/*"||e==="*/*")}function Nae({label:t="Gallery",items:e,accept:n,maxBytes:r,canDelete:s,loading:i,onRefresh:o,onUpload:l,onDelete:u}){const d={field:"gallery",accept:n,maxBytes:r},h=Eae(n),m=Tae(n),y=h&&m?"Drop images or PDFs here or browse to add to Files":h?"Drop PDFs here or browse to add to Files":"Drop images here or browse to add to the gallery",b=h&&m?"No files yet.":h?"No documents yet.":"No images in the gallery yet.";return p.jsxs("div",{className:"vertebr-gallery",children:[p.jsxs("div",{className:"vertebr-panel-head",children:[p.jsx("h2",{children:t}),p.jsxs("div",{className:"vertebr-gallery-head-actions",children:[p.jsx("span",{className:"vertebr-count",children:e.length}),o?p.jsx("button",{type:"button",className:"vertebr-btn",onClick:o,disabled:i,children:i?"Refreshing…":"Refresh"}):null]})]}),p.jsxs("div",{className:"vertebr-gallery-body",children:[p.jsx(ku,{meta:d,multiple:!0,showOptimizeHint:m,label:y,onUpload:l}),e.length===0?p.jsx("div",{className:"vertebr-empty",children:b}):p.jsx("div",{className:"vertebr-gallery-grid",children:e.map(v=>{const x=tg(v);return p.jsxs("article",{className:"vertebr-gallery-card",children:[p.jsx("a",{className:x?"vertebr-gallery-thumb vertebr-gallery-thumb-file":"vertebr-gallery-thumb",href:v.url,target:"_blank",rel:"noreferrer",title:v.name??v.url,children:x?p.jsx("span",{className:"vertebr-gallery-file-badge",children:"PDF"}):p.jsx("img",{src:v.url,alt:v.name??"",loading:"lazy"})}),p.jsxs("div",{className:"vertebr-gallery-meta",children:[p.jsx("strong",{title:v.name??v.id,children:v.name??(x?LD(v.url):v.id)}),p.jsx("a",{href:v.url,target:"_blank",rel:"noreferrer",children:v.url.replace(/^https?:\/\//i,"")})]}),s&&u?p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-danger-quiet",onClick:()=>{window.confirm(x?"Delete this document from Files?":"Delete this image from the gallery?")&&u(v.id)},children:"Delete"}):null]},v.id)})})]})]})}const Dw=3;function Mae(t){const e=Math.max(0,...t),n=Math.min(0,...t),r=e-n||1;return{min:n,max:e,span:r}}function _ae(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)),s=n/r;return(s<=1?1:s<=2?2:s<=2.5?2.5:s<=5?5:10)*r}function Aae(t,e){if(e==="usd")return[0,t/2,t];const n=t<=4||t<=10?2:t/4,r=[];for(let s=0;s<t-1e-9;s+=n)r.push(s);return r.push(t),r}function df(t){return t[0]?t.map((n,r)=>`${r===0?"M":"L"} ${n.x} ${n.y}`).join(" "):""}function Rae({series:t,tone:e="neutral"}){if(t.length<2)return null;const n=72,r=28,{min:s,span:i}=Mae(t),o=t.map((d,h)=>({x:h/(t.length-1)*n,y:r-(d-s)/i*(r-2)-1})),l=o[o.length-1],u=l?`${df(o)} L ${l.x} ${r} L 0 ${r} Z`:"";return p.jsxs("svg",{className:"vertebr-sparkline","data-tone":e,viewBox:`0 0 ${n} ${r}`,width:n,height:r,"aria-hidden":"true",children:[u?p.jsx("path",{d:u,fill:"currentColor",opacity:"0.16"}):null,p.jsx("path",{d:df(o),fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round",strokeLinecap:"round"})]})}function Oae(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 jae(){return p.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:p.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function Dae(){return p.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:p.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 Iae({charts:t,value:e,onChange:n}){return p.jsxs(Yy,{value:e,onValueChange:n,children:[p.jsxs(Ky,{className:"vertebr-select-trigger vertebr-chart-series","aria-label":"Chart series",children:[p.jsx("span",{className:"vertebr-select-value",children:p.jsx(Zy,{})}),p.jsx(Xy,{className:"vertebr-select-icon",children:p.jsx(jae,{})})]}),p.jsx(Jy,{children:p.jsx(Qy,{className:"vertebr-select-content",position:"popper",sideOffset:6,children:p.jsx(tb,{className:"vertebr-select-viewport",children:t.map(r=>p.jsxs(nb,{value:r.id,className:"vertebr-select-item",children:[p.jsx(rb,{children:r.label}),p.jsx(sb,{className:"vertebr-select-check",children:p.jsx(Dae,{})})]},r.id))})})})]})}function Lae({charts:t,chartId:e,onChartIdChange:n,compareLabel:r="Previous period"}){const s=t.find(oe=>oe.id===e)??t[0],i=s?.unit,o=C.useMemo(()=>t.filter(oe=>oe.id!==s?.id&&(oe.unit??"count")===(i??"count")),[t,s?.id,i]),l=o.length>0,[u,d]=C.useState("period"),[h,m]=C.useState([]),[y,b]=C.useState(null);if(C.useEffect(()=>{b(null)},[s?.id,u,h.join("|")]),C.useEffect(()=>{!l&&u==="metrics"&&d("period")},[l,u]),C.useEffect(()=>{m(oe=>oe.filter(ye=>o.some(Pe=>Pe.id===ye)))},[o]),!s)return p.jsx("article",{className:"vertebr-chart",children:p.jsx("p",{className:"vertebr-chart-empty",children:"No activity in this window."})});const v=u==="metrics"&&l,x=o.filter(oe=>h.includes(oe.id)).slice(0,Dw-1),k=v?[s,...x]:[s],E=s.points.map(oe=>oe.label),M=960,_=220,N={top:12,right:16,bottom:28,left:52},T=M-N.left-N.right,A=_-N.top-N.bottom,j=k.flatMap(oe=>oe.points.map(ye=>ye.value)),P=v?[]:(s.comparePoints??[]).map(oe=>oe.value),O=!v&&P.length>0,G=_ae(Math.max(0,...j,...P),s.unit),B=(oe,ye)=>N.left+(ye<=1?T/2:oe/(ye-1)*T),W=k.map(oe=>oe.points.map((ye,Pe)=>{const Ye=B(Pe,E.length||oe.points.length),Ke=N.top+A-Math.max(0,ye.value)/G*A;return{x:Ye,y:Ke,value:ye.value,label:ye.label}})),K=W[0]??[],Q=P.map((oe,ye)=>{const Pe=B(ye,E.length||P.length),Ye=N.top+A-Math.max(0,oe)/G*A;return{x:Pe,y:Ye,value:oe,label:s.comparePoints?.[ye]?.label??""}}),ee=Aae(G,s.unit),F=Math.max(1,Math.ceil(K.length/7)),I=s.points.reduce((oe,ye)=>oe+ye.value,0),z=K.length===0||k.every(oe=>oe.points.every(ye=>ye.value===0)),J=y??(K.length>0?K.length-1:null),X=`vb-chart-fill-${s.id}`,L=oe=>Oae(oe,s.unit),q=O&&J!=null?Q[J]:void 0,ie=df(K),de=K[0],Te=K[K.length-1],De=N.top+A,je=!v&&de&&Te?`${ie} L ${Te.x} ${De} L ${de.x} ${De} Z`:"",Ne=oe=>{m(ye=>ye.includes(oe)?ye.filter(Pe=>Pe!==oe):ye.length>=Dw-1?ye:[...ye,oe])};return p.jsxs("article",{className:"vertebr-chart","data-empty":z?"true":void 0,"data-mode":v?"metrics":"period",children:[p.jsxs("div",{className:"vertebr-chart-head",children:[p.jsxs("div",{className:"vertebr-chart-head-start",children:[t.length>1?p.jsx(Iae,{charts:t,value:s.id,onChange:n}):p.jsx("p",{className:"vertebr-chart-kicker",children:s.label}),l?p.jsxs("div",{className:"vertebr-chart-mode",role:"group","aria-label":"Chart mode",children:[p.jsx("button",{type:"button",className:"vertebr-chart-mode-btn","data-active":u==="period"?"true":void 0,onClick:()=>d("period"),children:"vs previous"}),p.jsx("button",{type:"button",className:"vertebr-chart-mode-btn","data-active":u==="metrics"?"true":void 0,onClick:()=>{d("metrics"),m(oe=>oe.length>0?oe:o.slice(0,1).map(ye=>ye.id))},children:"Compare metrics"})]}):null,v?p.jsx("div",{className:"vertebr-chart-metric-toggles",children:o.map(oe=>{const ye=h.includes(oe.id),Pe=!ye&&x.length>=Dw-1;return p.jsx("button",{type:"button",className:"vertebr-chart-metric-toggle","data-on":ye?"true":void 0,disabled:Pe,onClick:()=>Ne(oe.id),children:oe.label},oe.id)})}):O?p.jsxs("p",{className:"vertebr-chart-legend",children:[p.jsxs("span",{children:[p.jsx("i",{"data-series":"current"}),"Current"]}),p.jsxs("span",{children:[p.jsx("i",{"data-series":"previous"}),r]})]}):null,v?p.jsx("p",{className:"vertebr-chart-legend",children:k.map((oe,ye)=>p.jsxs("span",{children:[p.jsx("i",{"data-series":`m${ye}`}),oe.label]},oe.id))}):null]}),p.jsx("p",{className:"vertebr-chart-total",children:v?"—":L(I)})]}),K.length===0?p.jsx("p",{className:"vertebr-chart-empty",children:"No activity in this window."}):p.jsxs("div",{className:"vertebr-chart-plot",children:[p.jsxs("svg",{className:"vertebr-chart-svg",viewBox:`0 0 ${M} ${_}`,role:"img","aria-label":v?k.map(oe=>oe.label).join(" vs "):s.label,onMouseLeave:()=>b(null),onMouseMove:oe=>{const ye=oe.currentTarget.getBoundingClientRect(),Pe=(oe.clientX-ye.left)/ye.width*M;let Ye=0,Ke=1/0;K.forEach((ut,Xe)=>{const Vt=Math.abs(ut.x-Pe);Vt<Ke&&(Ke=Vt,Ye=Xe)}),b(Ye)},children:[p.jsx("defs",{children:p.jsxs("linearGradient",{id:X,x1:"0",y1:"0",x2:"0",y2:"1",children:[p.jsx("stop",{offset:"0%",stopColor:"var(--vb-accent)",stopOpacity:"0.32"}),p.jsx("stop",{offset:"100%",stopColor:"var(--vb-accent)",stopOpacity:"0"})]})}),ee.map((oe,ye)=>{const Pe=N.top+A-oe/G*A;return p.jsxs("g",{children:[p.jsx("line",{className:oe===0?"vertebr-chart-baseline":"vertebr-chart-grid",x1:N.left,x2:M-N.right,y1:Pe,y2:Pe}),p.jsx("text",{className:"vertebr-chart-axis",x:N.left-8,y:Pe+3,textAnchor:"end",children:L(oe)})]},`${oe}-${ye}`)}),je?p.jsx("path",{className:"vertebr-chart-area",d:je,fill:`url(#${X})`}):null,O?p.jsx("path",{className:"vertebr-chart-line-compare",d:df(Q),fill:"none"}):null,W.map((oe,ye)=>p.jsx("path",{className:ye===0&&!v?"vertebr-chart-line":"vertebr-chart-line-metric","data-series":v||ye>0?`m${ye}`:void 0,d:df(oe),fill:"none"},k[ye]?.id??ye)),J!=null?p.jsx("line",{className:"vertebr-chart-crosshair",x1:K[J]?.x,x2:K[J]?.x,y1:N.top,y2:N.top+A}):null,K.map((oe,ye)=>ye%F===0||ye===K.length-1?p.jsx("text",{className:"vertebr-chart-axis",x:oe.x,y:_-8,textAnchor:ye===0?"start":ye===K.length-1?"end":"middle",children:oe.label},`label-${oe.label}-${ye}`):null),W.map((oe,ye)=>oe.map((Pe,Ye)=>J===Ye?p.jsx("circle",{className:ye===0&&!v?"vertebr-chart-dot":"vertebr-chart-dot-metric","data-series":v||ye>0?`m${ye}`:void 0,"data-active":"true",cx:Pe.x,cy:Pe.y,r:ye===0?4.2:3.4},`dot-${k[ye]?.id}-${Ye}`):null)),q?p.jsx("circle",{className:"vertebr-chart-dot-compare",cx:q.x,cy:q.y,r:3.4}):null]}),J!=null&&K[J]?p.jsxs("div",{className:"vertebr-chart-tooltip",style:{left:`${Math.min(88,Math.max(12,K[J].x/M*100))}%`},children:[p.jsx("span",{children:K[J].label}),v?k.map((oe,ye)=>p.jsxs("strong",{className:"vertebr-chart-tooltip-row","data-series":`m${ye}`,children:[oe.label," ",L(oe.points[J]?.value??0)]},oe.id)):p.jsxs(p.Fragment,{children:[p.jsx("strong",{children:L(K[J].value)}),q?p.jsxs("span",{className:"vertebr-chart-tooltip-compare",children:["Prev ",L(q.value),q.label?` · ${q.label}`:""]}):null]})]}):null]})]})}function Pae(t){const e=Math.abs(t),n=e>=10?e.toFixed(0):e.toFixed(1);return t>0?`+${n}%`:t<0?`−${n}%`:"0%"}function $ae(t){return t>0?"up":t<0?"down":"flat"}function MO({value:t}){return t==null?p.jsx("span",{className:"vertebr-metrics-table-empty",children:"—"}):p.jsx("span",{className:"vertebr-metric-delta","data-dir":$ae(t),children:Pae(t)})}function zae(){return p.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:p.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 Bae(){return p.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:p.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function Fae({value:t,onChange:e,disabled:n}){return p.jsxs(Yy,{value:t,onValueChange:r=>e(r),disabled:n,children:[p.jsxs(Ky,{className:"vertebr-select-trigger vertebr-metrics-range","aria-label":"Metrics range",children:[p.jsx("span",{className:"vertebr-select-value",children:p.jsx(Zy,{})}),p.jsx(Xy,{className:"vertebr-select-icon",children:p.jsx(Bae,{})})]}),p.jsx(Jy,{children:p.jsx(Qy,{className:"vertebr-select-content",position:"popper",sideOffset:6,children:p.jsx(tb,{className:"vertebr-select-viewport",children:aD.map(r=>p.jsxs(nb,{value:r.id,className:"vertebr-select-item",children:[p.jsx(rb,{children:r.label}),p.jsx(sb,{className:"vertebr-select-check",children:p.jsx(zae,{})})]},r.id))})})})]})}function Vae({label:t="Overview",windowLabel:e,compareLabel:n,metrics:r,charts:s=[],range:i,onRangeChange:o,onRefresh:l,loading:u}){const d=r.filter(N=>N.featured).slice(0,4),h=d.length>0?d:r.slice(0,4),m=new Set(h.map(N=>N.id)),y=r.filter(N=>!m.has(N.id)),[b,v]=C.useState(!0),x=ib(y.length),k=C.useMemo(()=>new Set(s.map(N=>N.id)),[s]),[E,M]=C.useState(()=>s[0]?.id??""),_=k.has(E)?E:s[0]?.id??"";return p.jsxs("div",{className:"vertebr-metrics",children:[p.jsxs("div",{className:"vertebr-panel-head",children:[p.jsxs("div",{children:[p.jsx("h2",{children:t}),e?p.jsx("p",{className:"vertebr-metrics-window",children:e}):null]}),o||l?p.jsxs("div",{className:"vertebr-panel-head-actions",children:[o&&i?p.jsx(Fae,{value:i,onChange:o,disabled:u}):null,l?p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:l,disabled:u,children:u?"Refreshing…":"Refresh"}):null]}):null]}),r.length===0&&s.length===0?p.jsx("div",{className:"vertebr-empty",children:"No metrics registered yet."}):p.jsxs("div",{className:"vertebr-metrics-body",children:[h.length>0?p.jsx("section",{className:"vertebr-metrics-block",children:p.jsx("div",{className:"vertebr-metrics-kpis",children:h.map(N=>{const T=k.has(N.id);return p.jsxs("article",{className:"vertebr-kpi","data-tone":N.tone??"neutral","data-selectable":T?"true":void 0,"data-active":T&&N.id===_?"true":void 0,role:T?"button":void 0,tabIndex:T?0:void 0,onClick:T?()=>M(N.id):void 0,onKeyDown:T?A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),M(N.id))}:void 0,children:[p.jsxs("div",{className:"vertebr-kpi-top",children:[p.jsx("p",{className:"vertebr-metric-label",children:N.label}),N.series&&N.series.length>1?p.jsx(Rae,{series:N.series,tone:N.tone}):null]}),p.jsx("p",{className:"vertebr-kpi-value",children:N.value}),p.jsxs("div",{className:"vertebr-kpi-foot",children:[N.delta!=null?p.jsx(MO,{value:N.delta}):null,N.hint?p.jsx("span",{className:"vertebr-metric-hint",children:N.hint}):null]})]},N.id)})})}):null,s.length>0&&_?p.jsx("section",{className:"vertebr-metrics-block",children:p.jsx(Lae,{charts:s,chartId:_,onChartIdChange:M,compareLabel:n})}):null,y.length>0?p.jsx("section",{className:"vertebr-metrics-block",children:p.jsxs("div",{className:"vertebr-metrics-table-wrap","data-collapsed":b?void 0:"true",children:[p.jsxs("div",{className:"vertebr-metrics-table-head",children:[p.jsxs("button",{type:"button",className:"vertebr-metrics-table-toggle","aria-expanded":b,onClick:()=>v(N=>!N),children:[p.jsx("p",{className:"vertebr-chart-kicker",children:"Breakdown"}),p.jsx("span",{className:"vertebr-metrics-chevron","aria-hidden":"true"})]}),p.jsx(ab,{canLeft:x.canLeft,canRight:x.canRight,onScroll:N=>{b||v(!0),x.scrollBy(N)}})]}),b?p.jsx(ob,{overflow:x,children:p.jsxs("table",{className:"vertebr-table vertebr-metrics-table",children:[p.jsx("thead",{children:p.jsxs("tr",{children:[p.jsx("th",{children:"Metric"}),p.jsx("th",{children:"Value"}),p.jsx("th",{children:"Change"}),p.jsx("th",{children:"Notes"})]})}),p.jsx("tbody",{children:y.map(N=>p.jsxs("tr",{"data-tone":N.tone??"neutral",children:[p.jsxs("td",{children:[p.jsx("span",{className:"vertebr-metrics-table-label",children:N.label}),N.section?p.jsx("span",{className:"vertebr-metrics-table-section",children:N.section}):null]}),p.jsx("td",{className:"vertebr-metrics-table-value",children:N.value}),p.jsx("td",{children:p.jsx(MO,{value:N.delta})}),p.jsx("td",{className:"vertebr-metrics-table-notes",children:N.hint??"—"})]},N.id))})]})}):null]})}):null]})]})}function fa(t,e){return typeof t=="function"?t(e):t}function cs(t,e){return n=>{e.setState(r=>({...r,[t]:fa(n,r[t])}))}}function lb(t){return t instanceof Function}function Hae(t){return Array.isArray(t)&&t.every(e=>typeof e=="number")}function Uae(t,e){const n=[],r=s=>{s.forEach(i=>{n.push(i);const o=e(i);o!=null&&o.length&&r(o)})};return r(t),n}function rt(t,e,n){let r=[],s;return i=>{let o;n.key&&n.debug&&(o=Date.now());const l=t(i);if(!(l.length!==r.length||l.some((h,m)=>r[m]!==h)))return s;r=l;let d;if(n.key&&n.debug&&(d=Date.now()),s=e(...l),n==null||n.onChange==null||n.onChange(s),n.key&&n.debug&&n!=null&&n.debug()){const h=Math.round((Date.now()-o)*100)/100,m=Math.round((Date.now()-d)*100)/100,y=m/16,b=(v,x)=>{for(v=String(v);v.length<x;)v=" "+v;return v};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*y,120))}deg 100% 31%);`,n?.key)}return s}}function st(t,e,n,r){return{debug:()=>{var s;return(s=t?.debugAll)!=null?s:t[e]},key:!1,onChange:r}}function Wae(t,e,n,r){const s=()=>{var o;return(o=i.getValue())!=null?o:t.options.renderFallbackValue},i={id:`${e.id}_${n.id}`,row:e,column:n,getValue:()=>e.getValue(r),renderValue:s,getContext:rt(()=>[t,n,e,i],(o,l,u,d)=>({table:o,column:l,row:u,cell:d,getValue:d.getValue,renderValue:d.renderValue}),st(t.options,"debugCells"))};return t._features.forEach(o=>{o.createCell==null||o.createCell(i,n,e,t)},{}),i}function qae(t,e,n,r){var s,i;const l={...t._getDefaultColumnDef(),...e},u=l.accessorKey;let d=(s=(i=l.id)!=null?i:u?typeof String.prototype.replaceAll=="function"?u.replaceAll(".","_"):u.replace(/\./g,"_"):void 0)!=null?s:typeof l.header=="string"?l.header:void 0,h;if(l.accessorFn?h=l.accessorFn:u&&(u.includes(".")?h=y=>{let b=y;for(const x of u.split(".")){var v;b=(v=b)==null?void 0:v[x]}return b}:h=y=>y[l.accessorKey]),!d)throw new Error;let m={id:`${String(d)}`,accessorFn:h,parent:r,depth:n,columnDef:l,columns:[],getFlatColumns:rt(()=>[!0],()=>{var y;return[m,...(y=m.columns)==null?void 0:y.flatMap(b=>b.getFlatColumns())]},st(t.options,"debugColumns")),getLeafColumns:rt(()=>[t._getOrderColumnsFn()],y=>{var b;if((b=m.columns)!=null&&b.length){let v=m.columns.flatMap(x=>x.getLeafColumns());return y(v)}return[m]},st(t.options,"debugColumns"))};for(const y of t._features)y.createColumn==null||y.createColumn(m,t);return m}const fr="debugHeaders";function _O(t,e,n){var r;let i={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(i),o},getContext:()=>({table:t,header:i,column:e})};return t._features.forEach(o=>{o.createHeader==null||o.createHeader(i,t)}),i}const Gae={createTable:t=>{t.getHeaderGroups=rt(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,r,s)=>{var i,o;const l=(i=r?.map(m=>n.find(y=>y.id===m)).filter(Boolean))!=null?i:[],u=(o=s?.map(m=>n.find(y=>y.id===m)).filter(Boolean))!=null?o:[],d=n.filter(m=>!(r!=null&&r.includes(m.id))&&!(s!=null&&s.includes(m.id)));return om(e,[...l,...d,...u],t)},st(t.options,fr)),t.getCenterHeaderGroups=rt(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,r,s)=>(n=n.filter(i=>!(r!=null&&r.includes(i.id))&&!(s!=null&&s.includes(i.id))),om(e,n,t,"center")),st(t.options,fr)),t.getLeftHeaderGroups=rt(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left],(e,n,r)=>{var s;const i=(s=r?.map(o=>n.find(l=>l.id===o)).filter(Boolean))!=null?s:[];return om(e,i,t,"left")},st(t.options,fr)),t.getRightHeaderGroups=rt(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.right],(e,n,r)=>{var s;const i=(s=r?.map(o=>n.find(l=>l.id===o)).filter(Boolean))!=null?s:[];return om(e,i,t,"right")},st(t.options,fr)),t.getFooterGroups=rt(()=>[t.getHeaderGroups()],e=>[...e].reverse(),st(t.options,fr)),t.getLeftFooterGroups=rt(()=>[t.getLeftHeaderGroups()],e=>[...e].reverse(),st(t.options,fr)),t.getCenterFooterGroups=rt(()=>[t.getCenterHeaderGroups()],e=>[...e].reverse(),st(t.options,fr)),t.getRightFooterGroups=rt(()=>[t.getRightHeaderGroups()],e=>[...e].reverse(),st(t.options,fr)),t.getFlatHeaders=rt(()=>[t.getHeaderGroups()],e=>e.map(n=>n.headers).flat(),st(t.options,fr)),t.getLeftFlatHeaders=rt(()=>[t.getLeftHeaderGroups()],e=>e.map(n=>n.headers).flat(),st(t.options,fr)),t.getCenterFlatHeaders=rt(()=>[t.getCenterHeaderGroups()],e=>e.map(n=>n.headers).flat(),st(t.options,fr)),t.getRightFlatHeaders=rt(()=>[t.getRightHeaderGroups()],e=>e.map(n=>n.headers).flat(),st(t.options,fr)),t.getCenterLeafHeaders=rt(()=>[t.getCenterFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),st(t.options,fr)),t.getLeftLeafHeaders=rt(()=>[t.getLeftFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),st(t.options,fr)),t.getRightLeafHeaders=rt(()=>[t.getRightFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),st(t.options,fr)),t.getLeafHeaders=rt(()=>[t.getLeftHeaderGroups(),t.getCenterHeaderGroups(),t.getRightHeaderGroups()],(e,n,r)=>{var s,i,o,l,u,d;return[...(s=(i=e[0])==null?void 0:i.headers)!=null?s:[],...(o=(l=n[0])==null?void 0:l.headers)!=null?o:[],...(u=(d=r[0])==null?void 0:d.headers)!=null?u:[]].map(h=>h.getLeafHeaders()).flat()},st(t.options,fr))}};function om(t,e,n,r){var s,i;let o=0;const l=function(y,b){b===void 0&&(b=1),o=Math.max(o,b),y.filter(v=>v.getIsVisible()).forEach(v=>{var x;(x=v.columns)!=null&&x.length&&l(v.columns,b+1)},0)};l(t);let u=[];const d=(y,b)=>{const v={depth:b,id:[r,`${b}`].filter(Boolean).join("_"),headers:[]},x=[];y.forEach(k=>{const E=[...x].reverse()[0],M=k.column.depth===v.depth;let _,N=!1;if(M&&k.column.parent?_=k.column.parent:(_=k.column,N=!0),E&&E?.column===_)E.subHeaders.push(k);else{const T=_O(n,_,{id:[r,b,_.id,k?.id].filter(Boolean).join("_"),isPlaceholder:N,placeholderId:N?`${x.filter(A=>A.column===_).length}`:void 0,depth:b,index:x.length});T.subHeaders.push(k),x.push(T)}v.headers.push(k),k.headerGroup=v}),u.push(v),b>0&&d(x,b-1)},h=e.map((y,b)=>_O(n,y,{depth:o,index:b}));d(h,o-1),u.reverse();const m=y=>y.filter(v=>v.column.getIsVisible()).map(v=>{let x=0,k=0,E=[0];v.subHeaders&&v.subHeaders.length?(E=[],m(v.subHeaders).forEach(_=>{let{colSpan:N,rowSpan:T}=_;x+=N,E.push(T)})):x=1;const M=Math.min(...E);return k=k+M,v.colSpan=x,v.rowSpan=k,{colSpan:x,rowSpan:k}});return m((s=(i=u[0])==null?void 0:i.headers)!=null?s:[]),u}const Yae=(t,e,n,r,s,i,o)=>{let l={id:e,index:r,original:n,depth:s,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:u=>{if(l._valuesCache.hasOwnProperty(u))return l._valuesCache[u];const d=t.getColumn(u);if(d!=null&&d.accessorFn)return l._valuesCache[u]=d.accessorFn(l.original,r),l._valuesCache[u]},getUniqueValues:u=>{if(l._uniqueValuesCache.hasOwnProperty(u))return l._uniqueValuesCache[u];const d=t.getColumn(u);if(d!=null&&d.accessorFn)return d.columnDef.getUniqueValues?(l._uniqueValuesCache[u]=d.columnDef.getUniqueValues(l.original,r),l._uniqueValuesCache[u]):(l._uniqueValuesCache[u]=[l.getValue(u)],l._uniqueValuesCache[u])},renderValue:u=>{var d;return(d=l.getValue(u))!=null?d:t.options.renderFallbackValue},subRows:[],getLeafRows:()=>Uae(l.subRows,u=>u.subRows),getParentRow:()=>l.parentId?t.getRow(l.parentId,!0):void 0,getParentRows:()=>{let u=[],d=l;for(;;){const h=d.getParentRow();if(!h)break;u.push(h),d=h}return u.reverse()},getAllCells:rt(()=>[t.getAllLeafColumns()],u=>u.map(d=>Wae(t,l,d,d.id)),st(t.options,"debugRows")),_getAllCellsByColumnId:rt(()=>[l.getAllCells()],u=>u.reduce((d,h)=>(d[h.column.id]=h,d),{}),st(t.options,"debugRows"))};for(let u=0;u<t._features.length;u++){const d=t._features[u];d==null||d.createRow==null||d.createRow(l,t)}return l},Kae={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()}}},Mz=(t,e,n)=>{var r,s;const i=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((s=t.getValue(e))==null||(s=s.toString())==null||(s=s.toLowerCase())==null)&&s.includes(i))};Mz.autoRemove=t=>Js(t);const _z=(t,e,n)=>{var r;return!!(!((r=t.getValue(e))==null||(r=r.toString())==null)&&r.includes(n))};_z.autoRemove=t=>Js(t);const Az=(t,e,n)=>{var r;return((r=t.getValue(e))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};Az.autoRemove=t=>Js(t);const Rz=(t,e,n)=>{var r;return(r=t.getValue(e))==null?void 0:r.includes(n)};Rz.autoRemove=t=>Js(t);const Oz=(t,e,n)=>!n.some(r=>{var s;return!((s=t.getValue(e))!=null&&s.includes(r))});Oz.autoRemove=t=>Js(t)||!(t!=null&&t.length);const jz=(t,e,n)=>n.some(r=>{var s;return(s=t.getValue(e))==null?void 0:s.includes(r)});jz.autoRemove=t=>Js(t)||!(t!=null&&t.length);const Dz=(t,e,n)=>t.getValue(e)===n;Dz.autoRemove=t=>Js(t);const Iz=(t,e,n)=>t.getValue(e)==n;Iz.autoRemove=t=>Js(t);const n1=(t,e,n)=>{let[r,s]=n;const i=t.getValue(e);return i>=r&&i<=s};n1.resolveFilterValue=t=>{let[e,n]=t,r=typeof e!="number"?parseFloat(e):e,s=typeof n!="number"?parseFloat(n):n,i=e===null||Number.isNaN(r)?-1/0:r,o=n===null||Number.isNaN(s)?1/0:s;if(i>o){const l=i;i=o,o=l}return[i,o]};n1.autoRemove=t=>Js(t)||Js(t[0])&&Js(t[1]);const Zi={includesString:Mz,includesStringSensitive:_z,equalsString:Az,arrIncludes:Rz,arrIncludesAll:Oz,arrIncludesSome:jz,equals:Dz,weakEquals:Iz,inNumberRange:n1};function Js(t){return t==null||t===""}const Zae={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:t=>({columnFilters:[],...t}),getDefaultOptions:t=>({onColumnFiltersChange:cs("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"?Zi.includesString:typeof r=="number"?Zi.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?Zi.equals:Array.isArray(r)?Zi.arrIncludes:Zi.weakEquals},t.getFilterFn=()=>{var n,r;return lb(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:Zi[t.columnDef.filterFn]},t.getCanFilter=()=>{var n,r,s;return((n=t.columnDef.enableColumnFilter)!=null?n:!0)&&((r=e.options.enableColumnFilters)!=null?r:!0)&&((s=e.options.enableFilters)!=null?s:!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(s=>s.id===t.id))!=null?n:-1},t.setFilterValue=n=>{e.setColumnFilters(r=>{const s=t.getFilterFn(),i=r?.find(h=>h.id===t.id),o=fa(n,i?i.value:void 0);if(AO(s,o,t)){var l;return(l=r?.filter(h=>h.id!==t.id))!=null?l:[]}const u={id:t.id,value:o};if(i){var d;return(d=r?.map(h=>h.id===t.id?u:h))!=null?d:[]}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=s=>{var i;return(i=fa(e,s))==null?void 0:i.filter(o=>{const l=n.find(u=>u.id===o.id);if(l){const u=l.getFilterFn();if(AO(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 AO(t,e,n){return(t&&t.autoRemove?t.autoRemove(e,n):!1)||typeof e>"u"||typeof e=="string"&&!e}const Xae=(t,e,n)=>n.reduce((r,s)=>{const i=s.getValue(t);return r+(typeof i=="number"?i:0)},0),Jae=(t,e,n)=>{let r;return n.forEach(s=>{const i=s.getValue(t);i!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}),r},Qae=(t,e,n)=>{let r;return n.forEach(s=>{const i=s.getValue(t);i!=null&&(r<i||r===void 0&&i>=i)&&(r=i)}),r},ele=(t,e,n)=>{let r,s;return n.forEach(i=>{const o=i.getValue(t);o!=null&&(r===void 0?o>=o&&(r=s=o):(r>o&&(r=o),s<o&&(s=o)))}),[r,s]},tle=(t,e)=>{let n=0,r=0;if(e.forEach(s=>{let i=s.getValue(t);i!=null&&(i=+i)>=i&&(++n,r+=i)}),n)return r/n},nle=(t,e)=>{if(!e.length)return;const n=e.map(i=>i.getValue(t));if(!Hae(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),s=n.sort((i,o)=>i-o);return n.length%2!==0?s[r]:(s[r-1]+s[r])/2},rle=(t,e)=>Array.from(new Set(e.map(n=>n.getValue(t))).values()),sle=(t,e)=>new Set(e.map(n=>n.getValue(t))).size,ile=(t,e)=>e.length,Iw={sum:Xae,min:Jae,max:Qae,extent:ele,mean:tle,median:nle,unique:rle,uniqueCount:sle,count:ile},ole={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:cs("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 Iw.sum;if(Object.prototype.toString.call(r)==="[object Date]")return Iw.extent},t.getAggregationFn=()=>{var n,r;if(!t)throw new Error;return lb(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:Iw[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 s;return!t.getIsGrouped()&&!t.getIsPlaceholder()&&!!((s=n.subRows)!=null&&s.length)}}};function ale(t,e,n){if(!(e!=null&&e.length)||!n)return t;const r=t.filter(i=>!e.includes(i.id));return n==="remove"?r:[...e.map(i=>t.find(o=>o.id===i)).filter(Boolean),...r]}const lle={getInitialState:t=>({columnOrder:[],...t}),getDefaultOptions:t=>({onColumnOrderChange:cs("columnOrder",t)}),createColumn:(t,e)=>{t.getIndex=rt(n=>[ff(e,n)],n=>n.findIndex(r=>r.id===t.id),st(e.options,"debugColumns")),t.getIsFirstColumn=n=>{var r;return((r=ff(e,n)[0])==null?void 0:r.id)===t.id},t.getIsLastColumn=n=>{var r;const s=ff(e,n);return((r=s[s.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=rt(()=>[t.getState().columnOrder,t.getState().grouping,t.options.groupedColumnMode],(e,n,r)=>s=>{let i=[];if(!(e!=null&&e.length))i=s;else{const o=[...e],l=[...s];for(;l.length&&o.length;){const u=o.shift(),d=l.findIndex(h=>h.id===u);d>-1&&i.push(l.splice(d,1)[0])}i=[...i,...l]}return ale(i,n,r)},st(t.options,"debugTable"))}},Lw=()=>({left:[],right:[]}),cle={getInitialState:t=>({columnPinning:Lw(),...t}),getDefaultOptions:t=>({onColumnPinningChange:cs("columnPinning",t)}),createColumn:(t,e)=>{t.pin=n=>{const r=t.getLeafColumns().map(s=>s.id).filter(Boolean);e.setColumnPinning(s=>{var i,o;if(n==="right"){var l,u;return{left:((l=s?.left)!=null?l:[]).filter(m=>!(r!=null&&r.includes(m))),right:[...((u=s?.right)!=null?u:[]).filter(m=>!(r!=null&&r.includes(m))),...r]}}if(n==="left"){var d,h;return{left:[...((d=s?.left)!=null?d:[]).filter(m=>!(r!=null&&r.includes(m))),...r],right:((h=s?.right)!=null?h:[]).filter(m=>!(r!=null&&r.includes(m)))}}return{left:((i=s?.left)!=null?i:[]).filter(m=>!(r!=null&&r.includes(m))),right:((o=s?.right)!=null?o:[]).filter(m=>!(r!=null&&r.includes(m)))}})},t.getCanPin=()=>t.getLeafColumns().some(r=>{var s,i,o;return((s=r.columnDef.enablePinning)!=null?s:!0)&&((i=(o=e.options.enableColumnPinning)!=null?o:e.options.enablePinning)!=null?i:!0)}),t.getIsPinned=()=>{const n=t.getLeafColumns().map(l=>l.id),{left:r,right:s}=e.getState().columnPinning,i=n.some(l=>r?.includes(l)),o=n.some(l=>s?.includes(l));return i?"left":o?"right":!1},t.getPinnedIndex=()=>{var n,r;const s=t.getIsPinned();return s?(n=(r=e.getState().columnPinning)==null||(r=r[s])==null?void 0:r.indexOf(t.id))!=null?n:-1:0}},createRow:(t,e)=>{t.getCenterVisibleCells=rt(()=>[t._getAllVisibleCells(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,r,s)=>{const i=[...r??[],...s??[]];return n.filter(o=>!i.includes(o.column.id))},st(e.options,"debugRows")),t.getLeftVisibleCells=rt(()=>[t._getAllVisibleCells(),e.getState().columnPinning.left],(n,r)=>(r??[]).map(i=>n.find(o=>o.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),st(e.options,"debugRows")),t.getRightVisibleCells=rt(()=>[t._getAllVisibleCells(),e.getState().columnPinning.right],(n,r)=>(r??[]).map(i=>n.find(o=>o.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),st(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?Lw():(n=(r=t.initialState)==null?void 0:r.columnPinning)!=null?n:Lw())},t.getIsSomeColumnsPinned=e=>{var n;const r=t.getState().columnPinning;if(!e){var s,i;return!!((s=r.left)!=null&&s.length||(i=r.right)!=null&&i.length)}return!!((n=r[e])!=null&&n.length)},t.getLeftLeafColumns=rt(()=>[t.getAllLeafColumns(),t.getState().columnPinning.left],(e,n)=>(n??[]).map(r=>e.find(s=>s.id===r)).filter(Boolean),st(t.options,"debugColumns")),t.getRightLeafColumns=rt(()=>[t.getAllLeafColumns(),t.getState().columnPinning.right],(e,n)=>(n??[]).map(r=>e.find(s=>s.id===r)).filter(Boolean),st(t.options,"debugColumns")),t.getCenterLeafColumns=rt(()=>[t.getAllLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,r)=>{const s=[...n??[],...r??[]];return e.filter(i=>!s.includes(i.id))},st(t.options,"debugColumns"))}};function ule(t){return t||(typeof document<"u"?document:null)}const am={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Pw=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),dle={getDefaultColumnDef:()=>am,getInitialState:t=>({columnSizing:{},columnSizingInfo:Pw(),...t}),getDefaultOptions:t=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:cs("columnSizing",t),onColumnSizingInfoChange:cs("columnSizingInfo",t)}),createColumn:(t,e)=>{t.getSize=()=>{var n,r,s;const i=e.getState().columnSizing[t.id];return Math.min(Math.max((n=t.columnDef.minSize)!=null?n:am.minSize,(r=i??t.columnDef.size)!=null?r:am.size),(s=t.columnDef.maxSize)!=null?s:am.maxSize)},t.getStart=rt(n=>[n,ff(e,n),e.getState().columnSizing],(n,r)=>r.slice(0,t.getIndex(n)).reduce((s,i)=>s+i.getSize(),0),st(e.options,"debugColumns")),t.getAfter=rt(n=>[n,ff(e,n),e.getState().columnSizing],(n,r)=>r.slice(t.getIndex(n)+1).reduce((s,i)=>s+i.getSize(),0),st(e.options,"debugColumns")),t.resetSize=()=>{e.setColumnSizing(n=>{let{[t.id]:r,...s}=n;return s})},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=s=>{if(s.subHeaders.length)s.subHeaders.forEach(r);else{var i;n+=(i=s.column.getSize())!=null?i: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),s=r?.getCanResize();return i=>{if(!r||!s||(i.persist==null||i.persist(),$w(i)&&i.touches&&i.touches.length>1))return;const o=t.getSize(),l=t?t.getLeafHeaders().map(E=>[E.column.id,E.column.getSize()]):[[r.id,r.getSize()]],u=$w(i)?Math.round(i.touches[0].clientX):i.clientX,d={},h=(E,M)=>{typeof M=="number"&&(e.setColumnSizingInfo(_=>{var N,T;const A=e.options.columnResizeDirection==="rtl"?-1:1,j=(M-((N=_?.startOffset)!=null?N:0))*A,P=Math.max(j/((T=_?.startSize)!=null?T:0),-.999999);return _.columnSizingStart.forEach(O=>{let[G,B]=O;d[G]=Math.round(Math.max(B+B*P,0)*100)/100}),{..._,deltaOffset:j,deltaPercentage:P}}),(e.options.columnResizeMode==="onChange"||E==="end")&&e.setColumnSizing(_=>({..._,...d})))},m=E=>h("move",E),y=E=>{h("end",E),e.setColumnSizingInfo(M=>({...M,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},b=ule(n),v={moveHandler:E=>m(E.clientX),upHandler:E=>{b?.removeEventListener("mousemove",v.moveHandler),b?.removeEventListener("mouseup",v.upHandler),y(E.clientX)}},x={moveHandler:E=>(E.cancelable&&(E.preventDefault(),E.stopPropagation()),m(E.touches[0].clientX),!1),upHandler:E=>{var M;b?.removeEventListener("touchmove",x.moveHandler),b?.removeEventListener("touchend",x.upHandler),E.cancelable&&(E.preventDefault(),E.stopPropagation()),y((M=E.touches[0])==null?void 0:M.clientX)}},k=fle()?{passive:!1}:!1;$w(i)?(b?.addEventListener("touchmove",x.moveHandler,k),b?.addEventListener("touchend",x.upHandler,k)):(b?.addEventListener("mousemove",v.moveHandler,k),b?.addEventListener("mouseup",v.upHandler,k)),e.setColumnSizingInfo(E=>({...E,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?Pw():(n=t.initialState.columnSizingInfo)!=null?n:Pw())},t.getTotalSize=()=>{var e,n;return(e=(n=t.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?e:0},t.getLeftTotalSize=()=>{var e,n;return(e=(n=t.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?e:0},t.getCenterTotalSize=()=>{var e,n;return(e=(n=t.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?e:0},t.getRightTotalSize=()=>{var e,n;return(e=(n=t.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?e:0}}};let lm=null;function fle(){if(typeof lm=="boolean")return lm;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 lm=t,lm}function $w(t){return t.type==="touchstart"}const hle={getInitialState:t=>({columnVisibility:{},...t}),getDefaultOptions:t=>({onColumnVisibilityChange:cs("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 s=t.columns;return(n=s.length?s.some(i=>i.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=rt(()=>[t.getAllCells(),e.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),st(e.options,"debugRows")),t.getVisibleCells=rt(()=>[t.getLeftVisibleCells(),t.getCenterVisibleCells(),t.getRightVisibleCells()],(n,r,s)=>[...n,...r,...s],st(e.options,"debugRows"))},createTable:t=>{const e=(n,r)=>rt(()=>[r(),r().filter(s=>s.getIsVisible()).map(s=>s.id).join("_")],s=>s.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),st(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((s,i)=>({...s,[i.id]:n||!(i.getCanHide!=null&&i.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 ff(t,e){return e?e==="center"?t.getCenterVisibleLeafColumns():e==="left"?t.getLeftVisibleLeafColumns():t.getRightVisibleLeafColumns():t.getVisibleLeafColumns()}const ple={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()}}},mle={getInitialState:t=>({globalFilter:void 0,...t}),getDefaultOptions:t=>({onGlobalFilterChange:cs("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,s,i;return((n=t.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=e.options.enableGlobalFilter)!=null?r:!0)&&((s=e.options.enableFilters)!=null?s:!0)&&((i=e.options.getColumnCanGlobalFilter==null?void 0:e.options.getColumnCanGlobalFilter(t))!=null?i:!0)&&!!t.accessorFn}},createTable:t=>{t.getGlobalAutoFilterFn=()=>Zi.includesString,t.getGlobalFilterFn=()=>{var e,n;const{globalFilterFn:r}=t.options;return lb(r)?r:r==="auto"?t.getGlobalAutoFilterFn():(e=(n=t.options.filterFns)==null?void 0:n[r])!=null?e:Zi[r]},t.setGlobalFilter=e=>{t.options.onGlobalFilterChange==null||t.options.onGlobalFilterChange(e)},t.resetGlobalFilter=e=>{t.setGlobalFilter(e?void 0:t.initialState.globalFilter)}}},gle={getInitialState:t=>({expanded:{},...t}),getDefaultOptions:t=>({onExpandedChange:cs("expanded",t),paginateExpandedRows:!0}),createTable:t=>{let e=!1,n=!1;t._autoResetExpanded=()=>{var r,s;if(!e){t._queue(()=>{e=!0});return}if((r=(s=t.options.autoResetAll)!=null?s: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 s,i;t.setExpanded(r?{}:(s=(i=t.initialState)==null?void 0:i.expanded)!=null?s:{})},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(s=>!s.getIsExpanded()))},t.getExpandedDepth=()=>{let r=0;return(t.getState().expanded===!0?Object.keys(t.getRowModel().rowsById):Object.keys(t.getState().expanded)).forEach(i=>{const o=i.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 s;const i=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=(s=n)!=null?s:!i,!i&&n)return{...o,[t.id]:!0};if(i&&!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,s;return(n=e.options.getRowCanExpand==null?void 0:e.options.getRowCanExpand(t))!=null?n:((r=e.options.enableExpanding)!=null?r:!0)&&!!((s=t.subRows)!=null&&s.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()}}}},MS=0,_S=10,zw=()=>({pageIndex:MS,pageSize:_S}),yle={getInitialState:t=>({...t,pagination:{...zw(),...t?.pagination}}),getDefaultOptions:t=>({onPaginationChange:cs("pagination",t)}),createTable:t=>{let e=!1,n=!1;t._autoResetPageIndex=()=>{var r,s;if(!e){t._queue(()=>{e=!0});return}if((r=(s=t.options.autoResetAll)!=null?s:t.options.autoResetPageIndex)!=null?r:!t.options.manualPagination){if(n)return;n=!0,t._queue(()=>{t.resetPageIndex(),n=!1})}},t.setPagination=r=>{const s=i=>fa(r,i);return t.options.onPaginationChange==null?void 0:t.options.onPaginationChange(s)},t.resetPagination=r=>{var s;t.setPagination(r?zw():(s=t.initialState.pagination)!=null?s:zw())},t.setPageIndex=r=>{t.setPagination(s=>{let i=fa(r,s.pageIndex);const o=typeof t.options.pageCount>"u"||t.options.pageCount===-1?Number.MAX_SAFE_INTEGER:t.options.pageCount-1;return i=Math.max(0,Math.min(i,o)),{...s,pageIndex:i}})},t.resetPageIndex=r=>{var s,i;t.setPageIndex(r?MS:(s=(i=t.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?s:MS)},t.resetPageSize=r=>{var s,i;t.setPageSize(r?_S:(s=(i=t.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?s:_S)},t.setPageSize=r=>{t.setPagination(s=>{const i=Math.max(1,fa(r,s.pageSize)),o=s.pageSize*s.pageIndex,l=Math.floor(o/i);return{...s,pageIndex:l,pageSize:i}})},t.setPageCount=r=>t.setPagination(s=>{var i;let o=fa(r,(i=t.options.pageCount)!=null?i:-1);return typeof o=="number"&&(o=Math.max(-1,o)),{...s,pageCount:o}}),t.getPageOptions=rt(()=>[t.getPageCount()],r=>{let s=[];return r&&r>0&&(s=[...new Array(r)].fill(null).map((i,o)=>o)),s},st(t.options,"debugTable")),t.getCanPreviousPage=()=>t.getState().pagination.pageIndex>0,t.getCanNextPage=()=>{const{pageIndex:r}=t.getState().pagination,s=t.getPageCount();return s===-1?!0:s===0?!1:r<s-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}}},Bw=()=>({top:[],bottom:[]}),ble={getInitialState:t=>({rowPinning:Bw(),...t}),getDefaultOptions:t=>({onRowPinningChange:cs("rowPinning",t)}),createRow:(t,e)=>{t.pin=(n,r,s)=>{const i=r?t.getLeafRows().map(u=>{let{id:d}=u;return d}):[],o=s?t.getParentRows().map(u=>{let{id:d}=u;return d}):[],l=new Set([...o,t.id,...i]);e.setRowPinning(u=>{var d,h;if(n==="bottom"){var m,y;return{top:((m=u?.top)!=null?m:[]).filter(x=>!(l!=null&&l.has(x))),bottom:[...((y=u?.bottom)!=null?y:[]).filter(x=>!(l!=null&&l.has(x))),...Array.from(l)]}}if(n==="top"){var b,v;return{top:[...((b=u?.top)!=null?b:[]).filter(x=>!(l!=null&&l.has(x))),...Array.from(l)],bottom:((v=u?.bottom)!=null?v:[]).filter(x=>!(l!=null&&l.has(x)))}}return{top:((d=u?.top)!=null?d:[]).filter(x=>!(l!=null&&l.has(x))),bottom:((h=u?.bottom)!=null?h:[]).filter(x=>!(l!=null&&l.has(x)))}})},t.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:s}=e.options;return typeof r=="function"?r(t):(n=r??s)!=null?n:!0},t.getIsPinned=()=>{const n=[t.id],{top:r,bottom:s}=e.getState().rowPinning,i=n.some(l=>r?.includes(l)),o=n.some(l=>s?.includes(l));return i?"top":o?"bottom":!1},t.getPinnedIndex=()=>{var n,r;const s=t.getIsPinned();if(!s)return-1;const i=(n=s==="top"?e.getTopRows():e.getBottomRows())==null?void 0:n.map(o=>{let{id:l}=o;return l});return(r=i?.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?Bw():(n=(r=t.initialState)==null?void 0:r.rowPinning)!=null?n:Bw())},t.getIsSomeRowsPinned=e=>{var n;const r=t.getState().rowPinning;if(!e){var s,i;return!!((s=r.top)!=null&&s.length||(i=r.bottom)!=null&&i.length)}return!!((n=r[e])!=null&&n.length)},t._getPinnedRows=(e,n,r)=>{var s;return((s=t.options.keepPinnedRows)==null||s?(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=rt(()=>[t.getRowModel().rows,t.getState().rowPinning.top],(e,n)=>t._getPinnedRows(e,n,"top"),st(t.options,"debugRows")),t.getBottomRows=rt(()=>[t.getRowModel().rows,t.getState().rowPinning.bottom],(e,n)=>t._getPinnedRows(e,n,"bottom"),st(t.options,"debugRows")),t.getCenterRows=rt(()=>[t.getRowModel().rows,t.getState().rowPinning.top,t.getState().rowPinning.bottom],(e,n,r)=>{const s=new Set([...n??[],...r??[]]);return e.filter(i=>!s.has(i.id))},st(t.options,"debugRows"))}},vle={getInitialState:t=>({rowSelection:{},...t}),getDefaultOptions:t=>({onRowSelectionChange:cs("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},s=t.getPreGroupedRowModel().flatRows;return e?s.forEach(i=>{i.getCanSelect()&&(r[i.id]=!0)}):s.forEach(i=>{delete r[i.id]}),r})},t.toggleAllPageRowsSelected=e=>t.setRowSelection(n=>{const r=typeof e<"u"?e:!t.getIsAllPageRowsSelected(),s={...n};return t.getRowModel().rows.forEach(i=>{AS(s,i.id,r,!0,t)}),s}),t.getPreSelectedRowModel=()=>t.getCoreRowModel(),t.getSelectedRowModel=rt(()=>[t.getState().rowSelection,t.getCoreRowModel()],(e,n)=>Object.keys(e).length?Fw(t,n):{rows:[],flatRows:[],rowsById:{}},st(t.options,"debugTable")),t.getFilteredSelectedRowModel=rt(()=>[t.getState().rowSelection,t.getFilteredRowModel()],(e,n)=>Object.keys(e).length?Fw(t,n):{rows:[],flatRows:[],rowsById:{}},st(t.options,"debugTable")),t.getGroupedSelectedRowModel=rt(()=>[t.getState().rowSelection,t.getSortedRowModel()],(e,n)=>Object.keys(e).length?Fw(t,n):{rows:[],flatRows:[],rowsById:{}},st(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(s=>s.getCanSelect()&&!n[s.id])&&(r=!1),r},t.getIsAllPageRowsSelected=()=>{const e=t.getPaginationRowModel().flatRows.filter(s=>s.getCanSelect()),{rowSelection:n}=t.getState();let r=!!e.length;return r&&e.some(s=>!n[s.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 s=t.getIsSelected();e.setRowSelection(i=>{var o;if(n=typeof n<"u"?n:!s,t.getCanSelect()&&s===n)return i;const l={...i};return AS(l,t.id,n,(o=r?.selectChildren)!=null?o:!0,e),l})},t.getIsSelected=()=>{const{rowSelection:n}=e.getState();return r1(t,n)},t.getIsSomeSelected=()=>{const{rowSelection:n}=e.getState();return RS(t,n)==="some"},t.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=e.getState();return RS(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 s;n&&t.toggleSelected((s=r.target)==null?void 0:s.checked)}}}},AS=(t,e,n,r,s)=>{var i;const o=s.getRow(e,!0);n?(o.getCanMultiSelect()||Object.keys(t).forEach(l=>delete t[l]),o.getCanSelect()&&(t[e]=!0)):delete t[e],r&&(i=o.subRows)!=null&&i.length&&o.getCanSelectSubRows()&&o.subRows.forEach(l=>AS(t,l.id,n,r,s))};function Fw(t,e){const n=t.getState().rowSelection,r=[],s={},i=function(o,l){return o.map(u=>{var d;const h=r1(u,n);if(h&&(r.push(u),s[u.id]=u),(d=u.subRows)!=null&&d.length&&(u={...u,subRows:i(u.subRows)}),h)return u}).filter(Boolean)};return{rows:i(e.rows),flatRows:r,rowsById:s}}function r1(t,e){var n;return(n=e[t.id])!=null?n:!1}function RS(t,e,n){var r;if(!((r=t.subRows)!=null&&r.length))return!1;let s=!0,i=!1;return t.subRows.forEach(o=>{if(!(i&&!s)&&(o.getCanSelect()&&(r1(o,e)?i=!0:s=!1),o.subRows&&o.subRows.length)){const l=RS(o,e);l==="all"?i=!0:(l==="some"&&(i=!0),s=!1)}}),s?"all":i?"some":!1}const OS=/([0-9]+)/gm,wle=(t,e,n)=>Lz(Oa(t.getValue(n)).toLowerCase(),Oa(e.getValue(n)).toLowerCase()),xle=(t,e,n)=>Lz(Oa(t.getValue(n)),Oa(e.getValue(n))),Sle=(t,e,n)=>s1(Oa(t.getValue(n)).toLowerCase(),Oa(e.getValue(n)).toLowerCase()),kle=(t,e,n)=>s1(Oa(t.getValue(n)),Oa(e.getValue(n))),Cle=(t,e,n)=>{const r=t.getValue(n),s=e.getValue(n);return r>s?1:r<s?-1:0},Ele=(t,e,n)=>s1(t.getValue(n),e.getValue(n));function s1(t,e){return t===e?0:t>e?1:-1}function Oa(t){return typeof t=="number"?isNaN(t)||t===1/0||t===-1/0?"":String(t):typeof t=="string"?t:""}function Lz(t,e){const n=t.split(OS).filter(Boolean),r=e.split(OS).filter(Boolean);for(;n.length&&r.length;){const s=n.shift(),i=r.shift(),o=parseInt(s,10),l=parseInt(i,10),u=[o,l].sort();if(isNaN(u[0])){if(s>i)return 1;if(i>s)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 Dd={alphanumeric:wle,alphanumericCaseSensitive:xle,text:Sle,textCaseSensitive:kle,datetime:Cle,basic:Ele},Tle={getInitialState:t=>({sorting:[],...t}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:t=>({onSortingChange:cs("sorting",t),isMultiSortEvent:e=>e.shiftKey}),createColumn:(t,e)=>{t.getAutoSortingFn=()=>{const n=e.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const s of n){const i=s?.getValue(t.id);if(Object.prototype.toString.call(i)==="[object Date]")return Dd.datetime;if(typeof i=="string"&&(r=!0,i.split(OS).length>1))return Dd.alphanumeric}return r?Dd.text:Dd.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 lb(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:Dd[t.columnDef.sortingFn]},t.toggleSorting=(n,r)=>{const s=t.getNextSortingOrder(),i=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 d=[],h,m=i?n:s==="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"&&(i||s||(h="remove")),h==="add"){var y;d=[...o,{id:t.id,desc:m}],d.splice(0,d.length-((y=e.options.maxMultiSortColCount)!=null?y:Number.MAX_SAFE_INTEGER))}else h==="toggle"?d=o.map(b=>b.id===t.id?{...b,desc:m}:b):h==="remove"?d=o.filter(b=>b.id!==t.id):d=[{id:t.id,desc:m}];return d})},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,s;const i=t.getFirstSortDir(),o=t.getIsSorted();return o?o!==i&&((r=e.options.enableSortingRemoval)==null||r)&&(!(n&&(s=e.options.enableMultiRemove)!=null)||s)?!1:o==="desc"?"asc":"desc":i},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(s=>s.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(s=>s.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())}},Nle=[Gae,hle,lle,cle,Kae,Zae,ple,mle,Tle,ole,gle,yle,ble,vle,dle];function Mle(t){var e,n;const r=[...Nle,...(e=t._features)!=null?e:[]];let s={_features:r};const i=s._features.reduce((y,b)=>Object.assign(y,b.getDefaultOptions==null?void 0:b.getDefaultOptions(s)),{}),o=y=>s.options.mergeOptions?s.options.mergeOptions(i,y):{...i,...y};let u={...{},...(n=t.initialState)!=null?n:{}};s._features.forEach(y=>{var b;u=(b=y.getInitialState==null?void 0:y.getInitialState(u))!=null?b:u});const d=[];let h=!1;const m={_features:r,options:{...i,...t},initialState:u,_queue:y=>{d.push(y),h||(h=!0,Promise.resolve().then(()=>{for(;d.length;)d.shift()();h=!1}).catch(b=>setTimeout(()=>{throw b})))},reset:()=>{s.setState(s.initialState)},setOptions:y=>{const b=fa(y,s.options);s.options=o(b)},getState:()=>s.options.state,setState:y=>{s.options.onStateChange==null||s.options.onStateChange(y)},_getRowId:(y,b,v)=>{var x;return(x=s.options.getRowId==null?void 0:s.options.getRowId(y,b,v))!=null?x:`${v?[v.id,b].join("."):b}`},getCoreRowModel:()=>(s._getCoreRowModel||(s._getCoreRowModel=s.options.getCoreRowModel(s)),s._getCoreRowModel()),getRowModel:()=>s.getPaginationRowModel(),getRow:(y,b)=>{let v=(b?s.getPrePaginationRowModel():s.getRowModel()).rowsById[y];if(!v&&(v=s.getCoreRowModel().rowsById[y],!v))throw new Error;return v},_getDefaultColumnDef:rt(()=>[s.options.defaultColumn],y=>{var b;return y=(b=y)!=null?b:{},{header:v=>{const x=v.header.column.columnDef;return x.accessorKey?x.accessorKey:x.accessorFn?x.id:null},cell:v=>{var x,k;return(x=(k=v.renderValue())==null||k.toString==null?void 0:k.toString())!=null?x:null},...s._features.reduce((v,x)=>Object.assign(v,x.getDefaultColumnDef==null?void 0:x.getDefaultColumnDef()),{}),...y}},st(t,"debugColumns")),_getColumnDefs:()=>s.options.columns,getAllColumns:rt(()=>[s._getColumnDefs()],y=>{const b=function(v,x,k){return k===void 0&&(k=0),v.map(E=>{const M=qae(s,E,k,x),_=E;return M.columns=_.columns?b(_.columns,M,k+1):[],M})};return b(y)},st(t,"debugColumns")),getAllFlatColumns:rt(()=>[s.getAllColumns()],y=>y.flatMap(b=>b.getFlatColumns()),st(t,"debugColumns")),_getAllFlatColumnsById:rt(()=>[s.getAllFlatColumns()],y=>y.reduce((b,v)=>(b[v.id]=v,b),{}),st(t,"debugColumns")),getAllLeafColumns:rt(()=>[s.getAllColumns(),s._getOrderColumnsFn()],(y,b)=>{let v=y.flatMap(x=>x.getLeafColumns());return b(v)},st(t,"debugColumns")),getColumn:y=>s._getAllFlatColumnsById()[y]};Object.assign(s,m);for(let y=0;y<s._features.length;y++){const b=s._features[y];b==null||b.createTable==null||b.createTable(s)}return s}function _le(){return t=>rt(()=>[t.options.data],e=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(s,i,o){i===void 0&&(i=0);const l=[];for(let d=0;d<s.length;d++){const h=Yae(t,t._getRowId(s[d],d,o),s[d],d,i,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(s[d],d),(u=h.originalSubRows)!=null&&u.length&&(h.subRows=r(h.originalSubRows,i+1,h))}}return l};return n.rows=r(e),n},st(t.options,"debugTable","getRowModel",()=>t._autoResetPageIndex()))}function RO(t,e){return t?Ale(t)?C.createElement(t,e):t:null}function Ale(t){return Rle(t)||typeof t=="function"||Ole(t)}function Rle(t){return typeof t=="function"&&(()=>{const e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}function Ole(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}function jle(t){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...t},[n]=C.useState(()=>({current:Mle(e)})),[r,s]=C.useState(()=>n.current.initialState);return n.current.setOptions(i=>({...i,...t,state:{...r,...t.state},onStateChange:o=>{s(o),t.onStateChange==null||t.onStateChange(o)}})),n.current}function Dle({uploads:t,canCreate:e,fieldLabels:n,onClose:r,onUpload:s,onCreateFromUploads:i}){const o=C.useMemo(()=>Object.keys(t),[t]),[l,u]=C.useState(o[0]??""),[d,h]=C.useState(!!e),[m,y]=C.useState([]),[b,v]=C.useState(null),x=t[l];return C.useEffect(()=>{!o.includes(l)&&o[0]&&u(o[0])},[l,o]),C.useEffect(()=>{const k=M=>{M.key==="Escape"&&r()};window.addEventListener("keydown",k);const E=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",k),document.body.style.overflow=E}},[r]),x?p.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:r,children:p.jsxs("div",{className:"vertebr-modal vertebr-modal-sm",role:"dialog","aria-modal":"true","aria-label":"Bulk image upload",onClick:k=>k.stopPropagation(),children:[p.jsxs("header",{className:"vertebr-modal-head",children:[p.jsxs("div",{className:"vertebr-modal-heading",children:[p.jsx("p",{className:"vertebr-modal-eyebrow",children:"Media"}),p.jsx("h2",{children:"Bulk image upload"})]}),p.jsx("button",{type:"button",className:"vertebr-btn",onClick:r,children:"Close"})]}),p.jsxs("div",{className:"vertebr-modal-body",children:[o.length>1?p.jsxs("label",{className:"vertebr-field",children:[p.jsx("span",{children:"Target field"}),p.jsx("select",{className:"vertebr-native-select",value:l,onChange:k=>{u(k.target.value),y([]),v(null)},children:o.map(k=>p.jsx("option",{value:k,children:n[k]??k},k))})]}):null,e&&i?p.jsxs("label",{className:"vertebr-upload-check",children:[p.jsx("input",{type:"checkbox",checked:d,onChange:k=>h(k.target.checked)}),p.jsx("span",{children:"Create a record for each uploaded image"})]}):null,p.jsx(ku,{meta:x,multiple:!0,onUpload:async k=>{v(`Uploading ${k.length} image${k.length===1?"":"s"}…`);const E=await s(l,k);y(E),d&&i?(v("Creating records…"),await i(l,E),v(`Uploaded ${E.length} and created records.`)):v(`Uploaded ${E.length} image${E.length===1?"":"s"}.`)}}),b?p.jsx("p",{className:"vertebr-upload-status",children:b}):null,m.length>0?p.jsx("ul",{className:"vertebr-upload-results",children:m.map(k=>p.jsxs("li",{children:[p.jsx("img",{src:k.url,alt:""}),p.jsxs("div",{children:[p.jsx("strong",{children:k.name??"Image"}),p.jsx("a",{href:k.url,target:"_blank",rel:"noreferrer",children:k.url})]})]},k.url))}):null]})]})}):null}const Ile=/(url|href|link|src)/i,Lle=/\.(png|jpe?g|gif|webp|svg|avif)(\?|#|$)/i;function Pz(t){return/^https?:\/\//i.test(t)||t.startsWith("//")}function Ple(t){return Pz(t)?Lle.test(t)?!0:/(image|img|media|cdn|photo)/i.test(t):!1}function OO(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 $m({fieldKey:t,field:e,value:n,variant:r="table"}){const s=r==="detail";if(n==null||n==="")return p.jsx("span",{className:"vertebr-cell-empty",children:"—"});const i=e?.type;if(i==="boolean"||typeof n=="boolean"){const u=!!n;return p.jsx("span",{className:"vertebr-badge","data-tone":u?"ok":"neutral",children:$le(t,e,u)})}if(i==="datetime"){const u=OO(n);if(u)return p.jsx("span",{className:"vertebr-cell-datetime",children:u})}if((i==="number"||typeof n=="number")&&typeof n=="number"&&Number.isFinite(n))return wk(t,e)?p.jsx("span",{className:"vertebr-cell-money",children:Sx(n,{asCents:!0})}):tI(t,e)?p.jsx("span",{className:"vertebr-cell-money",children:Sx(n,{asCents:!1})}):p.jsx("span",{className:"vertebr-cell-number",children:new Intl.NumberFormat().format(n)});const o=Em(n);if(o.length>0&&(i==="file[]"||ga(t,e)||o.every(Ple)))return p.jsx(zle,{urls:o,detail:s});if(Array.isArray(n)){if(n.length===0)return p.jsx("span",{className:"vertebr-cell-empty",children:"—"});if(n.every(u=>typeof u=="string"))return p.jsx("div",{className:"vertebr-chip-row",children:n.map(u=>p.jsx("span",{className:"vertebr-chip",title:u,children:u},u))})}if(typeof n=="string")return Ile.test(t)||Pz(n)?p.jsx("a",{className:"vertebr-cell-link",href:n.startsWith("//")?`https:${n}`:n,target:"_blank",rel:"noreferrer",title:n,onClick:u=>u.stopPropagation(),children:s?n:n.replace(/^https?:\/\//i,"")}):!s&&(i==="richtext"||n.length>80)?p.jsx("span",{className:"vertebr-cell-clamp",title:n,children:n}):s&&(i==="richtext"||n.length>80)?p.jsx("p",{className:"vertebr-cell-prose",children:n}):p.jsx("span",{className:"vertebr-cell-text",children:n});const l=OO(n);return l?p.jsx("span",{className:"vertebr-cell-datetime",children:l}):typeof n=="object"?p.jsx("code",{className:"vertebr-cell-json",title:JSON.stringify(n),children:JSON.stringify(n)}):p.jsx("span",{className:"vertebr-cell-text",children:String(n)})}function $le(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 zle({urls:t,detail:e}){if(e)return p.jsx("div",{className:"vertebr-cell-thumbs vertebr-cell-thumbs-detail",children:t.map((s,i)=>p.jsxs("a",{className:"vertebr-cell-media vertebr-cell-media-detail",href:s,target:"_blank",rel:"noreferrer",title:s,onClick:o=>o.stopPropagation(),children:[p.jsx("img",{src:s,alt:"",loading:"lazy"}),p.jsx("span",{className:"vertebr-cell-link",children:s})]},`${s}:${i}`))});const n=t.slice(0,3),r=t.length-n.length;return p.jsxs("div",{className:"vertebr-cell-thumbs",title:t[0],children:[n.map((s,i)=>p.jsx("img",{src:s,alt:"",loading:"lazy"},`${s}:${i}`)),r>0?p.jsxs("span",{className:"vertebr-cell-thumbs-more",children:["+",r]}):null]})}function Ble({title:t,schema:e,value:n,uploads:r,onUpload:s,galleryUpload:i,onListGallery:o,onUploadGallery:l,onClose:u,onCreate:d}){return C.useEffect(()=>{const h=y=>{y.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]),p.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:u,children:p.jsxs("div",{className:"vertebr-modal vertebr-modal-form",role:"dialog","aria-modal":"true","aria-label":t,onClick:h=>h.stopPropagation(),children:[p.jsxs("header",{className:"vertebr-modal-head",children:[p.jsxs("div",{className:"vertebr-modal-heading",children:[p.jsx("p",{className:"vertebr-modal-eyebrow",children:"New record"}),p.jsx("h2",{children:t})]}),p.jsx("div",{className:"vertebr-modal-actions",children:p.jsx("button",{type:"button",className:"vertebr-btn",onClick:u,"aria-label":"Close",children:"Close"})})]}),p.jsx("div",{className:"vertebr-modal-body",children:p.jsx(hh,{variant:"record",schema:e,value:n,uploads:r,onUpload:s,galleryUpload:i,onListGallery:o,onUploadGallery:l,submitLabel:t,onSave:async h=>{await d(h),u()}})})]})})}const Fle=new Set(["custom","promo","custom_discount"]),Vle=new Set(["discount","welcome_offer","flash_sale","custom_discount"]),Hle=new Set(["discountId","discountCode","discountOffer","discountExpires"]);function Ule(t){return Array.isArray(t)?t.join(", "):t}function xu(t){return typeof t=="string"?t:String(t??"")}function Wle(t,e){const n=`${t} ${e.label??""}`;return e.type==="richtext"||/(body|message|html|notes)/i.test(n)}function ny(t,e){if(!t.preset)return!0;const n=xu(e.preset);return!n||Fle.has(n)}function $z(t){return Vle.has(t)}function zz(t,e,n){if(t==="subject"||t==="body")return ny(e,n);if(Hle.has(t)){const r=xu(n.preset);return!(!$z(r)||t==="discountId"&&!e.discountId?.options?.length)}return!0}function jO(t,e){return Object.entries(t).every(([n,r])=>{if(!zz(n,t,e))return!0;const s=(n==="subject"||n==="body")&&ny(t,e),i=(n==="discountCode"||n==="discountOffer")&&$z(xu(e.preset));return r.required===!1&&!s&&!i||r.type!=="string"&&r.type!=="richtext"&&r.type!=="enum"?!0:!!xu(e[n]).trim()})}function DO(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 qle({title:t,count:e,schema:n,submitLabel:r,onClose:s,onPreview:i,onSubmit:o}){const l=C.useMemo(()=>KC(n),[n]),u=C.useMemo(()=>Object.entries(n),[n]),d=u.length>0,[h,m]=C.useState(l),[y,b]=C.useState(null),[v,x]=C.useState(null),[k,E]=C.useState(!1),[M,_]=C.useState(!1),N=!M&&(!d||jO(n,h)),T=u.filter(([P])=>zz(P,n,h)),A=C.useCallback(async P=>{if(d&&!jO(n,P)){b(null),x(null);return}E(!0),x(null);try{const O=await i(P);b(O)}catch(O){b(null),x(DO(O))}finally{E(!1)}},[d,i,n]);C.useEffect(()=>{const P=G=>{G.key==="Escape"&&s()};window.addEventListener("keydown",P);const O=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",P),document.body.style.overflow=O}},[s]),C.useEffect(()=>{if(!d){A({});return}const P=window.setTimeout(()=>{A(h)},280);return()=>window.clearTimeout(P)},[h,d,A]);const j=async()=>{if(N){_(!0);try{await o(d?h:{}),s()}catch(P){x(DO(P))}finally{_(!1)}}};return p.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:s,children:p.jsxs("div",{className:"vertebr-modal vertebr-modal-form vertebr-mail-modal",role:"dialog","aria-modal":"true","aria-label":t,onClick:P=>P.stopPropagation(),children:[p.jsxs("header",{className:"vertebr-modal-head",children:[p.jsxs("div",{className:"vertebr-modal-heading",children:[p.jsx("p",{className:"vertebr-modal-eyebrow",children:e===1?"1 person":`${e} people`}),p.jsx("h2",{children:t})]}),p.jsx("div",{className:"vertebr-modal-actions",children:p.jsx("button",{type:"button",className:"vertebr-btn",onClick:s,"aria-label":"Close",children:"Close"})})]}),p.jsxs("div",{className:"vertebr-mail-layout",children:[p.jsxs("form",{className:"vertebr-mail-compose",onSubmit:P=>{P.preventDefault(),j()},children:[d?p.jsxs("div",{className:"vertebr-mail-fields",children:[T.map(([P,O])=>{const G=Wle(P,O);return p.jsxs("label",{className:"vertebr-mail-field",children:[p.jsx("span",{children:O.label??P}),O.type==="enum"?p.jsx(YC,{id:`mail-${P}`,value:h[P],field:O,onChange:B=>m(W=>({...W,[P]:B}))}):G?p.jsx("textarea",{rows:7,value:xu(h[P]),placeholder:"Plain text — the host template styles it.",onChange:B=>m(W=>({...W,[P]:B.target.value}))}):p.jsx("input",{type:"text",value:xu(h[P]),onChange:B=>m(W=>({...W,[P]:B.target.value}))})]},P)}),n.preset&&!ny(n,h)?p.jsx("p",{className:"vertebr-mail-compose-hint",children:"Preview updates from the selected preset. Switch to Custom to write your own copy."}):null]}):p.jsx("p",{className:"vertebr-mail-compose-note",children:"Host template — Vertebr only delivers it."}),v?p.jsx("p",{className:"vertebr-mail-compose-error",children:v}):null,p.jsx("div",{className:"vertebr-mail-compose-foot",children:p.jsx("button",{type:"submit",className:"vertebr-btn vertebr-btn-primary",disabled:!N,children:M?"Sending…":r})})]}),p.jsxs("div",{className:"vertebr-mail-preview",children:[p.jsxs("div",{className:"vertebr-mail-preview-meta",children:[p.jsxs("p",{children:[p.jsx("span",{children:"To"}),p.jsx("strong",{children:y?Ule(y.to):e===1?"—":`${e} recipients`})]}),p.jsxs("p",{children:[p.jsx("span",{children:"Subject"}),p.jsx("strong",{children:y?.subject??(k?"Updating…":"—")})]})]}),p.jsx("div",{className:"vertebr-mail-preview-stage",children:p.jsx("div",{className:"vertebr-mail-preview-frame",children:y?.html?p.jsx("iframe",{title:"Email preview",sandbox:"",srcDoc:y.html}):y?.text?p.jsx("pre",{children:y.text}):p.jsx("div",{className:"vertebr-mail-preview-empty",children:v??(k?"Rendering host template…":d?n.preset&&ny(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 Gle(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\bcents\b/i,"").trim()}function Yle(t,e){for(const[n,r]of Object.entries(e)){if(typeof r!="string"||!/^https?:\/\//i.test(r))continue;const s=t[n];if(/(image|img|photo|avatar|thumbnail|thumb|cover)/i.test(n)||/(image|img|photo)/i.test(s?.label??"")||/(image|img|media|cdn|photo)/i.test(r))return r}return null}function Kle({schema:t,row:e,title:n,canEdit:r,onClose:s,onEdit:i}){const o=Object.keys(t),l=o.length>0?o.map(d=>[d,e[d]]):Object.entries(e),u=Yle(t,e);return C.useEffect(()=>{const d=m=>{m.key==="Escape"&&s()};window.addEventListener("keydown",d);const h=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",d),document.body.style.overflow=h}},[s]),p.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:s,children:p.jsxs("div",{className:"vertebr-modal",role:"dialog","aria-modal":"true","aria-label":n,onClick:d=>d.stopPropagation(),children:[p.jsxs("header",{className:"vertebr-modal-head",children:[p.jsxs("div",{className:"vertebr-modal-heading",children:[p.jsx("p",{className:"vertebr-modal-eyebrow",children:"Record"}),p.jsx("h2",{children:n})]}),p.jsxs("div",{className:"vertebr-modal-actions",children:[r&&i?p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",onClick:i,children:"Edit"}):null,p.jsx("button",{type:"button",className:"vertebr-btn",onClick:s,"aria-label":"Close",children:"Close"})]})]}),p.jsxs("div",{className:"vertebr-modal-body",children:[u?p.jsx("div",{className:"vertebr-modal-hero",children:p.jsx("img",{src:u,alt:""})}):null,p.jsx("dl",{className:"vertebr-modal-fields",children:l.map(([d,h])=>p.jsxs("div",{className:"vertebr-modal-field",children:[p.jsx("dt",{children:t[d]?.label??Gle(d)}),p.jsx("dd",{children:p.jsx($m,{fieldKey:d,field:t[d],value:h,variant:"detail"})})]},d))})]})]})})}function Vw(t){return!!(t?.input&&Object.keys(t.input).length>0)}function IO(t){return!!t?.mail}function Zle(t,e){const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}function Jr(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 $c(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\bcents\b/i,"").trim()}function LO(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 Xle(t,e){if(!(!t||typeof localStorage>"u"))try{localStorage.setItem(`vertebr:columns:v2:${t}`,JSON.stringify(e))}catch{}}function Jle(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 PO(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 cm(t,e){return t[e]!==!1}function Qle(t){const e={};for(const[n,r]of Object.entries(t))Jle(n,r,t)&&(e[n]=!1);return e}function $O(t,e){const n=Qle(e);if(!t||typeof localStorage>"u")return n;try{const r=localStorage.getItem(`vertebr:columns:v2:${t}`);if(!r)return n;const s=JSON.parse(r);return!s||typeof s!="object"?n:{...n,...s}}catch{return n}}function ece(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 tce(t){return t.replace(/\.[^.]+$/,"").replace(/[_-]+/g," ").replace(/\s+/g," ").trim()}function nce({schema:t,items:e,permissions:n,actions:r={},label:s,uploads:i,rowIdKeys:o=["id","slug","uid","email"],storageKey:l,onUpdate:u,onCreate:d,onDelete:h,onAction:m,onActionDone:y,onPreviewMail:b,collectionActions:v={},onCollectionAction:x,bulkActions:k={},onBulkAction:E,listQuery:M,total:_,loading:N=!1,searchQuery:T="",onSearchChange:A,sort:j=null,onSortChange:P,onUpload:O,galleryUpload:G,onListGallery:B,onUploadGallery:W,initialEditRowId:K,onEditRowIdChange:Q}){const[ee,F]=C.useState(null),[I,z]=C.useState(!1),[J,X]=C.useState(null),[L,q]=C.useState(!1),[ie,de]=C.useState(null),[Te,De]=C.useState(new Set),[je,Ne]=C.useState(T),[oe,ye]=C.useState({}),[Pe,Ye]=C.useState(null),Ke=P?j:Pe,ut=P??Ye,[Xe,Vt]=C.useState(null),[un,qt]=C.useState(null),[kn,dn]=C.useState(null),[In,Ln]=C.useState(()=>$O(l,t)),Yn=ib(`${e.length}:${Object.keys(In).filter(pe=>In[pe]!==!1).join(",")}`),[ht,Bn]=C.useState({}),[lr,vr]=C.useState(!1),Pn=!!(n?.update&&u),xe=!!(n?.create&&d),$e=!!(n?.delete&&h),$=ece(s),V=!!(i&&O&&Object.keys(i).length),U=Object.entries(r),ae=Object.entries(v),ce=Object.entries(k),be=Object.keys(t),Ce=C.useMemo(()=>be.filter(pe=>PO(pe,t[pe])),[be,t]),Ae=!!(m&&U.length>0||E&&ce.length>0),ve=!!(M&&A);C.useEffect(()=>{Ne(T)},[T]),C.useEffect(()=>{if(!ve||!A)return;const pe=window.setTimeout(()=>{je!==T&&A(je)},250);return()=>window.clearTimeout(pe)},[je,T,A,ve]);const Ie=C.useMemo(()=>be.map(pe=>{const ue=t[pe];return ue?Voe(pe,ue.label??$c(pe),ue):null}).filter(pe=>!!pe),[be,t]),Re=C.useMemo(()=>{const pe=ve?e:e.filter(_e=>vu(_e,je)),ue=Object.fromEntries(Ie.map(_e=>[_e.id,Je=>Je[_e.id]]));return pe.filter(_e=>kz(_e,oe,ue))},[e,je,ve,oe,Ie]),Qe=C.useCallback(pe=>{F(pe),Q?.(Jr(pe,o))},[Q,o]),gt=C.useCallback(()=>{F(null),Q?.(null)},[Q]);C.useEffect(()=>{if(!K)return;const pe=e.find(ue=>Jr(ue,o)===K);pe&&F(pe)},[K,e,o]),C.useEffect(()=>{Bn({})},[e]),C.useEffect(()=>{const pe=new Set(e.map(ue=>Jr(ue,o)).filter(ue=>!!ue));De(ue=>{const _e=new Set([...ue].filter(Je=>pe.has(Je)));return _e.size===ue.size?ue:_e})},[e,o]);const Ze=C.useMemo(()=>{let pe=0;for(const[ue,_e]of Object.entries(ht)){const Je=e.find(kt=>Jr(kt,o)===ue);if(!Je){pe+=Object.keys(_e).length;continue}for(const[kt,yt]of Object.entries(_e))cm(Je,kt)!==yt&&(pe+=1)}return pe},[ht,e,o]),_r=C.useCallback((pe,ue,_e)=>{Bn(Je=>{const kt=e.find(Os=>Jr(Os,o)===pe),yt=kt?cm(kt,ue):null,Ur={...Je[pe]??{}};yt===_e?delete Ur[ue]:Ur[ue]=_e;const Rr={...Je};return Object.keys(Ur).length===0?delete Rr[pe]:Rr[pe]=Ur,Rr})},[e,o]),Vr=C.useCallback(async()=>{if(!u||Ze===0)return;vr(!0);const pe=[];try{for(const[ue,_e]of Object.entries(ht)){const Je=e.find(kt=>Jr(kt,o)===ue);if(Je)try{await u(ue,{...Je,..._e})}catch(kt){pe.push(`${ue}: ${kt instanceof Error?kt.message:"Failed"}`)}}Bn({}),pe.length>0&&window.alert(`Saved with ${pe.length} error(s).
330
+
331
+ ${pe.slice(0,8).join(`
332
+ `)}`)}finally{vr(!1)}},[u,Ze,ht,e,o]),wr=C.useCallback(async(pe,ue,_e)=>{if(!m||ue.length===0)return;de(pe);const Je=[];try{for(const kt of ue)try{await m(kt,pe,_e)}catch(yt){Je.push(`${kt}: ${yt instanceof Error?yt.message:"Failed"}`)}await y?.(),De(new Set),Je.length>0&&window.alert(`Finished with ${Je.length} error(s).
333
+
334
+ ${Je.slice(0,8).join(`
335
+ `)}`)}finally{de(null)}},[m,y]),Kn=C.useCallback((pe,ue)=>{const _e=r[pe];if(!_e||ue.length===0||!m)return;if(IO(_e)||Vw(_e)){Vt({actionId:pe,rowIds:ue});return}const Je=ue.length===1?"this person":`${ue.length} people`;window.confirm(`${_e.label} for ${Je}?`)&&wr(pe,ue)},[r,m,wr]),Zn=C.useCallback(async(pe,ue)=>{if(x){de(pe);try{const _e=await x(pe,ue);await y?.(),_e&&typeof _e=="object"&&"message"in _e&&typeof _e.message=="string"?window.alert(_e.message):_e&&typeof _e=="object"&&"result"in _e&&_e.result&&typeof _e.result=="object"&&"message"in _e.result&&typeof _e.result.message=="string"&&window.alert(_e.result.message)}catch(_e){window.alert(_e instanceof Error?_e.message:"Action failed")}finally{de(null)}}},[x,y]),ph=C.useCallback(pe=>{const ue=v[pe];if(!ue||!x)return;if(Vw(ue)){qt(pe);return}const _e=ue.confirm?`${ue.label}?
336
+
337
+ ${ue.confirm}`:`${ue.label}?`;window.confirm(_e)&&Zn(pe)},[v,x,Zn]),So=C.useCallback(async(pe,ue,_e)=>{if(!(!E||ue.length===0)){de(pe);try{await E(pe,ue,_e),await y?.(),De(new Set)}catch(Je){window.alert(Je instanceof Error?Je.message:"Bulk action failed")}finally{de(null),dn(null)}}},[E,y]),Va=C.useCallback((pe,ue)=>{const _e=k[pe];if(!_e||ue.length===0||!E)return;if(Vw(_e)){dn(pe);return}const Je=_e.confirm?`${_e.label} on ${ue.length} row(s)?
338
+
339
+ ${_e.confirm}`:`${_e.label} on ${ue.length} row(s)?`;window.confirm(Je)&&So(pe,ue)},[k,E,So]);C.useEffect(()=>{Ln($O(l,t))},[l]),C.useEffect(()=>{ye({})},[l]),C.useEffect(()=>{Xle(l,In)},[l,In]);const Rs=C.useMemo(()=>be.map(pe=>({id:pe,label:t[pe]?.label??$c(pe)})),[be,t]),Ha=C.useMemo(()=>{const pe=[];if(Ae){const ue=e.map(Je=>Jr(Je,o)).filter(Je=>!!Je),_e=ue.length>0&&ue.every(Je=>Te.has(Je));pe.push({id:"_select",enableHiding:!1,header:()=>p.jsx("input",{type:"checkbox",className:"vertebr-row-check",checked:_e,"aria-label":"Select all",onChange:()=>{De(Je=>ue.every(kt=>Je.has(kt))?new Set:new Set(ue))}}),cell:({row:Je})=>{const kt=Jr(Je.original,o);return kt?p.jsx("input",{type:"checkbox",className:"vertebr-row-check",checked:Te.has(kt),"aria-label":"Select row",onClick:yt=>yt.stopPropagation(),onChange:()=>De(yt=>Zle(yt,kt))}):null},size:44})}return pe.push(...be.length===0?[{id:"raw",header:"Item",cell:({row:ue})=>p.jsx($m,{fieldKey:"raw",value:ue.original})}]:be.map(ue=>{const _e=t[ue],Je=/(image|img|photo|avatar|thumbnail|thumb|cover)/i.test(ue)||/(image|img|photo)/i.test(_e?.label??""),kt=Pn&&PO(ue,_e);return{id:ue,accessorKey:ue,header:()=>{const yt=_e?.label??$c(ue);if(!_e?.sortable)return yt;const Ur=Ke?.field===ue,Rr=_e.type==="datetime"||_e.type==="number"?"desc":"asc";return p.jsx(ZC,{label:yt,active:!!Ur,order:Ur?Ke?.order:void 0,onSort:()=>ut(QC(Ke,ue,Rr))})},meta:{fieldKey:ue,field:_e},cell:({row:yt,getValue:Ur})=>{if(kt){const Rr=Jr(yt.original,o);if(!Rr)return p.jsx($m,{fieldKey:ue,field:_e,value:Ur()});const Os=ht[Rr]?.[ue]??cm(yt.original,ue),ki=ht[Rr]?.[ue]!==void 0&&ht[Rr]?.[ue]!==cm(yt.original,ue);return p.jsx("div",{className:"vertebr-visibility-check","data-dirty":ki?"true":void 0,onClick:Ru=>Ru.stopPropagation(),children:p.jsx(eI,{visible:Os,dirty:ki,label:_e?.label??$c(ue),disabled:lr,onChange:Ru=>_r(Rr,ue,Ru)})})}return p.jsx($m,{fieldKey:ue,field:_e,value:Ur()})},size:kt?88:Je?220:void 0}})),pe.push({id:"_actions",header:()=>p.jsx("span",{className:"vertebr-sr-only",children:"Actions"}),enableHiding:!1,cell:({row:ue})=>{const _e=Jr(ue.original,o);return p.jsxs("div",{className:"vertebr-row-actions",onClick:Je=>Je.stopPropagation(),onKeyDown:Je=>Je.stopPropagation(),children:[p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>X(ue.original),children:"View"}),Pn?p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>Qe(ue.original),children:"Edit"}):null,_e?U.map(([Je,kt])=>p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:ie!=null,onClick:()=>Kn(Je,[_e]),children:kt.label},Je)):null,$e&&_e?p.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?.(_e)},children:"Delete"}):null]})}}),pe},[t,be,e,Te,Ae,Pn,$e,U,ie,Kn,h,o,ht,_r,Ke,ut]),Ua=C.useMemo(()=>Koe(Re,Ke,t),[Re,Ke,t]),Wa=jle({data:Ua,columns:Ha,state:{columnVisibility:In},onColumnVisibilityChange:Ln,getCoreRowModel:_le()}),ko=ee?Jr(ee,o):null,Hr=Object.fromEntries(Object.entries(t).filter(([,pe])=>!pe.readOnly||pe.required).map(([pe,ue])=>[pe,ue.readOnly?{...ue,readOnly:!1}:ue])),bn=Object.fromEntries(Object.entries(Hr).map(([pe,ue])=>[pe,ue.default??(ue.type==="boolean"?!1:ue.type==="number"?void 0:ue.type==="file[]"?[]:"")]));if(ee&&ko&&u){const pe=Object.fromEntries(Object.entries(t).filter(([,_e])=>!_e.readOnly)),ue=LO(ee,o);return p.jsxs("div",{className:"vertebr-resource-edit",children:[p.jsxs("div",{className:"vertebr-resource-edit-head",children:[p.jsxs("div",{className:"vertebr-resource-edit-heading",children:[p.jsx("p",{className:"vertebr-resource-edit-eyebrow",children:"Editing record"}),p.jsx("h2",{children:ue}),p.jsx("p",{className:"vertebr-resource-edit-id",children:ko})]}),p.jsx("button",{type:"button",className:"vertebr-btn",onClick:()=>gt(),children:"Back"})]}),p.jsx(hh,{variant:"record",schema:pe,value:ee,uploads:i,onUpload:O,galleryUpload:G,onListGallery:B,onUploadGallery:W,onSave:async _e=>{await u(ko,_e),gt()}})]})}const Cn=p.jsxs("div",{className:"vertebr-table-toolbar",children:[p.jsxs("div",{className:"vertebr-table-toolbar-start",children:[Ie.length>0||Rs.length>0?p.jsx(Cz,{columns:Ie,selected:oe,onChange:ye,columnVisibility:Rs.length>0?{columns:Rs,visibility:In,onChange:Ln}:void 0}):null,V?p.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-icon",onClick:()=>q(!0),children:[p.jsx(sce,{}),"Bulk upload"]}):null,Ce.length>0&&Ze>0?p.jsxs(p.Fragment,{children:[p.jsxs("span",{className:"vertebr-count",children:[Ze," visibility change",Ze===1?"":"s"]}),p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",disabled:lr,onClick:()=>{Vr()},children:lr?"Saving…":"Save visibility"}),p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:lr,onClick:()=>Bn({}),children:"Discard"})]}):null,ae.map(([pe,ue])=>p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:ie!=null,onClick:()=>ph(pe),children:ue.label},pe)),Ae&&Te.size>0?p.jsxs(p.Fragment,{children:[p.jsxs("span",{className:"vertebr-count",children:[Te.size," selected"]}),U.map(([pe,ue])=>p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:ie!=null,onClick:()=>Kn(pe,[...Te]),children:ue.label},pe)),ce.map(([pe,ue])=>p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:ie!=null,onClick:()=>Va(pe,[...Te]),children:ue.label},`bulk:${pe}`)),p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>De(new Set),children:"Clear"})]}):null]}),p.jsx(ab,{canLeft:Yn.canLeft,canRight:Yn.canRight,onScroll:Yn.scrollBy})]}),us=L&&i&&O?p.jsx(Dle,{uploads:i,canCreate:xe,fieldLabels:Object.fromEntries(Object.keys(i).map(pe=>[pe,t[pe]?.label??$c(pe)])),onClose:()=>q(!1),onUpload:O,onCreateFromUploads:xe&&d?async(pe,ue)=>{for(const _e of ue){const Je=tce(_e.name??"Image");await d({[pe]:_e.url,name:Je,title:Je})}}:void 0}):null,we=I&&d?p.jsx(Ble,{title:$,schema:Hr,value:bn,uploads:i,onUpload:O,galleryUpload:G,onListGallery:B,onUploadGallery:W,onClose:()=>z(!1),onCreate:d}):null,Se=Xe?IO(r[Xe.actionId])&&b?p.jsx(qle,{title:r[Xe.actionId]?.label??"Send email",count:Xe.rowIds.length,schema:im(r[Xe.actionId]?.input??{}),submitLabel:ie?"Sending…":Xe.rowIds.length===1?"Send":`Send to ${Xe.rowIds.length}`,onClose:()=>Vt(null),onPreview:pe=>b(Xe.rowIds[0],Xe.actionId,pe),onSubmit:pe=>wr(Xe.actionId,Xe.rowIds,pe)}):r[Xe.actionId]?.input?p.jsx(Ow,{title:r[Xe.actionId]?.label??"Run action",count:Xe.rowIds.length,schema:im(r[Xe.actionId].input),submitLabel:ie?"Sending…":Xe.rowIds.length===1?r[Xe.actionId]?.label??"Send":`Send to ${Xe.rowIds.length}`,onClose:()=>Vt(null),onSubmit:pe=>wr(Xe.actionId,Xe.rowIds,pe)}):null:null,sn=un&&v[un]?.input?p.jsx(Ow,{title:v[un]?.label??"Run action",eyebrow:"This resource",schema:im(v[un].input),submitLabel:ie?"Working…":"Run",onClose:()=>qt(null),onSubmit:pe=>Zn(un,pe)}):null,vn=kn&&k[kn]?.input?p.jsx(Ow,{title:k[kn]?.label??"Bulk action",eyebrow:`${Te.size} selected`,schema:im(k[kn].input),submitLabel:ie?"Working…":"Run",onClose:()=>dn(null),onSubmit:pe=>So(kn,[...Te],pe)}):null,Ar=p.jsxs("div",{className:"vertebr-panel-head",children:[p.jsx("h2",{children:"Records"}),p.jsxs("div",{className:"vertebr-panel-head-actions",children:[p.jsx(XC,{value:je,onChange:Ne,"aria-label":"Search records"}),xe?p.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-icon",onClick:()=>z(!0),children:[p.jsx(rce,{}),$]}):null,p.jsx("span",{className:"vertebr-count",children:N?"…":_!=null?`${Re.length} of ${_}`:Re.length!==e.length?`${Re.length} of ${e.length}`:Re.length})]})]});return N?p.jsxs("div",{className:"vertebr-resource-body",children:[Ar,p.jsx(wz,{columns:be.map(pe=>({id:pe,label:t[pe]?.label??$c(pe)}))})]}):e.length===0?p.jsxs("div",{className:"vertebr-resource-body",children:[Ar,Ie.length>0||Rs.length>0||V||ae.length>0?Cn:null,p.jsx("div",{className:"vertebr-empty",children:"No rows yet."}),us,we,Se,sn,vn]}):Re.length===0?p.jsxs("div",{className:"vertebr-resource-body",children:[Ar,Ie.length>0||Rs.length>0||V||ae.length>0?Cn:null,p.jsx("div",{className:"vertebr-empty",children:"No matching rows."}),us,we,Se,sn,vn]}):p.jsxs("div",{className:"vertebr-resource-body",children:[Ar,Cn,p.jsx(ob,{overflow:Yn,transitionKey:JSON.stringify(oe),children:p.jsxs("table",{className:"vertebr-table",children:[p.jsx("thead",{children:Wa.getHeaderGroups().map(pe=>p.jsx("tr",{children:pe.headers.map(ue=>p.jsx("th",{className:ue.column.id==="_actions"?"vertebr-col-actions":ue.column.id==="_select"?"vertebr-col-select":void 0,children:ue.isPlaceholder?null:RO(ue.column.columnDef.header,ue.getContext())},ue.id))},pe.id))}),p.jsx("tbody",{children:Wa.getRowModel().rows.map(pe=>p.jsx("tr",{className:"vertebr-table-row-clickable","data-selected":Ae&&Jr(pe.original,o)&&Te.has(Jr(pe.original,o))?"true":void 0,tabIndex:0,onClick:()=>X(pe.original),onKeyDown:ue=>{(ue.key==="Enter"||ue.key===" ")&&(ue.preventDefault(),X(pe.original))},children:pe.getVisibleCells().map(ue=>p.jsx("td",{className:ue.column.id==="_actions"?"vertebr-col-actions":ue.column.id==="_select"?"vertebr-col-select":void 0,children:RO(ue.column.columnDef.cell,ue.getContext())},ue.id))},pe.id))})]})}),J?p.jsx(Kle,{schema:t,row:J,title:LO(J,o),canEdit:Pn,onClose:()=>X(null),onEdit:()=>{Qe(J),X(null)}}):null,Se,sn,vn,us,we]})}function rce(){return p.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:[p.jsx("path",{d:"M12 5v14"}),p.jsx("path",{d:"M5 12h14"})]})}function sce(){return p.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:[p.jsx("path",{d:"M16 5h6"}),p.jsx("path",{d:"M19 2v6"}),p.jsx("rect",{x:"3",y:"7",width:"14",height:"14",rx:"2"}),p.jsx("circle",{cx:"8.5",cy:"12.5",r:"1.5"}),p.jsx("path",{d:"m17 21-4.5-4.5L7 21"})]})}const ice={product:"Products",engagement:"Engagement",sales:"Sales"};function Bz(t){return t?ice[t]??"Add-on":"Add-on"}const oce={product:"Tied to products, variants, and checkout",engagement:"Brand story and feedback on the side",sales:"Promos, urgency, and cart nudges"};function ace(t){return t?oce[t]??"Optional storefront feature":"Optional storefront feature"}const lce=[{id:"desktop",label:"Desktop"},{id:"mobile",label:"Mobile"}],zc=390,Bc=844;function um(t){const e=t.trim()||"/";try{const n=new URL(e,"http://vertebr.local");return`${n.pathname}${n.search}${n.hash}`||"/"}catch{return e.startsWith("/")?e:`/${e}`}}function Fz({previewPath:t,controlId:e,draft:n,relatedDrafts:r,previewKind:s="page"}){const i=C.useRef(null),o=C.useRef(null),l=C.useRef(n),u=C.useRef(r),[d,h]=C.useState(!1),[m,y]=C.useState(!1),[b,v]=C.useState("desktop"),[x,k]=C.useState(1),[E,M]=C.useState(()=>um(t));l.current=n,u.current=r;const _=b==="mobile",N=um(t),T=E!==N;C.useEffect(()=>{M(um(t))},[t]);const A=C.useMemo(()=>nk(E,{controlId:e}),[E,e]),j=C.useCallback(()=>{const O=i.current?.contentWindow,G=l.current;if(!O||!G)return;vf(O,e,G);const B=u.current;if(B)for(const[W,K]of Object.entries(B))vf(O,W,K)},[e]),P=C.useCallback(()=>{const O=i.current?.contentWindow;if(O)try{O.dispatchEvent(new Event("resize"))}catch{}},[]);return C.useEffect(()=>{h(!1),y(!1)},[A]),C.useEffect(()=>rk(O=>{const G=i.current?.contentWindow;!G||O!==G||(h(!0),j())}),[j,A]),C.useEffect(()=>r5((O,G)=>{const B=i.current?.contentWindow;!B||G!==B||M(um(O))}),[]),C.useEffect(()=>{d&&j()},[n,r,d,j]),C.useEffect(()=>{if(!_){k(1);return}const O=o.current;if(!O||typeof ResizeObserver>"u")return;const G=()=>{const W=getComputedStyle(O),K=(Number.parseFloat(W.paddingLeft)||0)+(Number.parseFloat(W.paddingRight)||0),Q=(Number.parseFloat(W.paddingTop)||0)+(Number.parseFloat(W.paddingBottom)||0),ee=Math.max(0,O.clientWidth-K),F=Math.max(0,O.clientHeight-Q),I=Math.min(1,ee/zc,F/Bc);k(Number.isFinite(I)&&I>0?I:1)};G();const B=new ResizeObserver(G);return B.observe(O),()=>B.disconnect()},[_]),C.useEffect(()=>{if(!d)return;const O=window.setTimeout(P,50);return()=>window.clearTimeout(O)},[b,x,d,P]),p.jsxs("div",{className:"vertebr-page-preview","data-preview-kind":s,children:[p.jsxs("div",{className:"vertebr-page-preview-meta",children:[p.jsxs("p",{children:[p.jsx("span",{children:s==="addon"?"Storefront":"Preview"}),p.jsx("strong",{children:E})]}),p.jsxs("p",{children:[p.jsx("span",{children:"Status"}),p.jsx("strong",{children:m?"Unavailable":d?"Connected":"Loading…"})]}),_?p.jsxs("p",{children:[p.jsx("span",{children:"Viewport"}),p.jsxs("strong",{children:[zc,"×",Bc]})]}):null,T?p.jsx("button",{type:"button",className:"vertebr-page-preview-back",onClick:()=>M(N),children:"Back to page"}):null,p.jsx("div",{className:"vertebr-page-preview-viewports",role:"group","aria-label":"Preview viewport",children:lce.map(O=>p.jsx("button",{type:"button","data-active":b===O.id?"true":void 0,onClick:()=>v(O.id),children:O.label},O.id))})]}),p.jsx("div",{ref:o,className:"vertebr-page-preview-stage","data-viewport":b,children:p.jsx("div",{className:"vertebr-page-preview-shell",style:_?{width:zc*x,height:Bc*x}:void 0,children:p.jsx("div",{className:"vertebr-page-preview-frame",style:_?{width:zc,height:Bc,transform:`scale(${x})`,transformOrigin:"top left"}:void 0,children:m?p.jsxs("div",{className:"vertebr-page-preview-empty",children:["Could not load host preview at ",E,"."]}):p.jsx("iframe",{ref:i,title:`Preview ${e}`,src:A,width:_?zc:void 0,height:_?Bc:void 0,style:_?{width:zc,height:Bc}:void 0,onLoad:()=>{h(!0),j(),P()},onError:()=>y(!0)})})})})]})}function cce({client:t,catalog:e,addon:n,configData:r,onConfigSaved:s,galleryPicker:i,fontLibraryPicker:o}){const[l,u]=C.useState(r.value),d=C.useCallback(E=>{u(M=>({...M??r.value,...E}))},[r.value]),h=l??r.value,m=!!h.enabled,y=e5(n.previewPath,n.previewPathRules,h),b=!!y,v=wf(e,"addon.write"),x=C.useMemo(()=>b?{...h,enabled:!0}:h,[h,b]),k=p.jsx(hh,{schema:r.schema,value:r.value,client:t,canWrite:v,onChange:b?d:void 0,onSave:async E=>{const M=await t.setConfig(r.id,E);s(M)},...i,...o});return p.jsxs("div",{className:"vertebr-addon-editor",children:[p.jsxs("div",{className:"vertebr-addon-editor-head","data-category":n.category??"engagement",children:[p.jsxs("div",{className:"vertebr-addon-editor-head-start",children:[p.jsx("span",{className:"vertebr-addon-category","data-category":n.category??"engagement",children:Bz(n.category)}),p.jsxs("span",{className:"vertebr-addon-status","data-enabled":m?"true":"false",children:[p.jsx("span",{className:"vertebr-addon-status-dot","aria-hidden":"true"}),m?"Enabled on storefront":"Disabled"]})]}),y?p.jsxs("div",{className:"vertebr-addon-editor-head-end",children:[p.jsx("span",{className:"vertebr-addon-preview-label",children:"Live preview"}),p.jsx("code",{className:"vertebr-addon-preview-path",children:y})]}):null]}),b&&y?p.jsxs("div",{className:"vertebr-page-editor vertebr-addon-page-editor",children:[p.jsx("div",{className:"vertebr-page-editor-form",children:k}),p.jsx(Fz,{previewPath:y,controlId:r.id,draft:x,previewKind:"addon"})]}):p.jsxs("div",{className:"vertebr-addon-editor-form-only",children:[k,p.jsxs("div",{className:"vertebr-addon-preview-missing",children:[p.jsx("strong",{children:"Live preview unavailable"}),p.jsxs("p",{children:["Register a ",p.jsx("code",{children:"previewPath"})," on this add-on so Vertebr can iframe your storefront while you edit."]})]})]})]})}function uce({addonId:t,previewPath:e,draft:n,label:r}){const s=C.useRef(null),i=C.useRef(n),[o,l]=C.useState(!1),[u,d]=C.useState(!1);i.current=n;const h=C.useMemo(()=>e?nk(e,{controlId:t}):null,[t,e]),m=()=>{const y=s.current?.contentWindow,b=i.current;!y||!b||vf(y,t,b)};return C.useEffect(()=>{l(!1),d(!1)},[h]),C.useEffect(()=>{if(h)return rk(y=>{const b=s.current?.contentWindow;!b||y!==b||(l(!0),m())})},[h]),C.useEffect(()=>{!o||!n||m()},[n,o]),e?p.jsxs("div",{className:"vertebr-addon-thumb","data-ready":o?"true":void 0,"aria-label":r?`Preview ${r}`:`Preview ${t}`,children:[p.jsx("div",{className:"vertebr-addon-thumb-scale",children:u?p.jsx("div",{className:"vertebr-addon-thumb-fallback",children:"Preview unavailable"}):p.jsx("iframe",{ref:s,title:r?`Preview ${r}`:`Preview ${t}`,src:h??void 0,tabIndex:-1,loading:"lazy",onLoad:()=>{l(!0),m()},onError:()=>d(!0)})}),!o&&!u?p.jsx("div",{className:"vertebr-addon-thumb-loading",children:"Loading preview…"}):null]}):p.jsx("div",{className:"vertebr-addon-thumb vertebr-addon-thumb-empty",children:p.jsx("span",{children:"No preview route"})})}const dce=["product","engagement","sales"];function fce(t){const e=new Map;for(const s of t){const i=s.category??"other";e.has(i)||e.set(i,[]),e.get(i).push(s)}const n=[];for(const s of dce){const i=e.get(s);i?.length&&(n.push({category:s,label:Bz(s),hint:ace(s),items:i}),e.delete(s))}const r=e.get("other");return r?.length&&n.push({category:"other",label:"Add-ons",hint:"Optional storefront features",items:r}),n}function hce({children:t}){const e=C.useRef(null),n=C.useRef(null);return C.useEffect(()=>{const r=n.current,s=e.current;if(!r||!s)return;const i=()=>{const l=r.scrollLeft>4,u=r.scrollLeft+r.clientWidth<r.scrollWidth-4;s.classList.toggle("can-scroll-left",l),s.classList.toggle("can-scroll-right",u)};i(),r.addEventListener("scroll",i,{passive:!0});const o=new ResizeObserver(i);return o.observe(r),()=>{r.removeEventListener("scroll",i),o.disconnect()}},[t]),p.jsx("div",{ref:e,className:"vertebr-addon-scroll-wrap",children:p.jsx("div",{ref:n,className:"vertebr-addon-scroll",tabIndex:0,children:t})})}function pce({client:t,catalog:e,onSelectAddon:n}){const r=e.addons??[],[s,i]=C.useState({}),[o,l]=C.useState(!0);C.useEffect(()=>{let h=!1;return(async()=>{l(!0);const m={};await Promise.all(r.map(async y=>{try{const b=await t.getConfig(y.id);m[y.id]={enabled:!!b.value.enabled,value:b.value}}catch{m[y.id]={enabled:!1,value:{}}}})),h||(i(m),l(!1))})(),()=>{h=!0}},[r,t]);const u=C.useMemo(()=>fce(r),[r]),d=C.useMemo(()=>{let h=0;const m={};for(const y of r){const b=y.category??"other";m[b]=(m[b]??0)+1,s[y.id]?.enabled&&(h+=1)}return{total:r.length,enabled:h,products:m.product??0,engagement:m.engagement??0,sales:m.sales??0}},[r,s]);return r.length?p.jsxs("div",{className:"vertebr-addon-overview",children:[p.jsxs("header",{className:"vertebr-addon-overview-toolbar",children:[p.jsx("div",{className:"vertebr-addon-overview-intro",children:p.jsx("p",{children:"Optional storefront features grouped by purpose. Scroll each row to browse, then configure one to edit with a live shop preview."})}),p.jsxs("div",{className:"vertebr-addon-overview-stats","aria-label":"Add-on summary",children:[p.jsxs("div",{className:"vertebr-addon-stat",children:[p.jsx("strong",{children:o?"—":d.enabled}),p.jsx("span",{children:"Enabled"})]}),p.jsxs("div",{className:"vertebr-addon-stat",children:[p.jsx("strong",{children:d.total}),p.jsx("span",{children:"Total"})]}),p.jsxs("div",{className:"vertebr-addon-stat","data-category":"product",children:[p.jsx("strong",{children:d.products}),p.jsx("span",{children:"Products"})]}),p.jsxs("div",{className:"vertebr-addon-stat","data-category":"engagement",children:[p.jsx("strong",{children:d.engagement}),p.jsx("span",{children:"Engagement"})]}),p.jsxs("div",{className:"vertebr-addon-stat","data-category":"sales",children:[p.jsx("strong",{children:d.sales}),p.jsx("span",{children:"Sales"})]})]})]}),u.map(h=>p.jsxs("section",{className:"vertebr-addon-overview-section","data-category":h.category,children:[p.jsxs("div",{className:"vertebr-addon-section-head",children:[p.jsxs("div",{className:"vertebr-addon-section-title",children:[p.jsx("h3",{children:h.label}),p.jsx("p",{children:h.hint})]}),p.jsxs("span",{className:"vertebr-addon-section-count",children:[h.items.length," add-on",h.items.length===1?"":"s"]})]}),p.jsx(hce,{children:h.items.map(m=>{const y=s[m.id],b=y?{...y.value,enabled:!0}:{enabled:!0};return p.jsxs("article",{className:"vertebr-addon-card","data-category":m.category??"engagement",children:[p.jsx(uce,{addonId:m.id,previewPath:m.previewPath,draft:b,label:m.label}),p.jsxs("div",{className:"vertebr-addon-card-body",children:[p.jsxs("div",{className:"vertebr-addon-card-head",children:[p.jsx("h4",{children:m.label}),p.jsx("span",{className:"vertebr-addon-status","data-enabled":o?void 0:y?.enabled?"true":"false",children:o?"…":y?.enabled?"On":"Off"})]}),m.description?p.jsx("p",{children:m.description}):null,p.jsxs("div",{className:"vertebr-addon-card-foot",children:[m.previewPath?p.jsx("span",{className:"vertebr-addon-route",children:m.previewPath}):null,p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",onClick:()=>n(m.id),children:"Configure"})]})]})]},m.id)})})]},h.category))]}):p.jsx("div",{className:"vertebr-addon-overview",children:p.jsx("div",{className:"vertebr-empty",children:"No add-ons registered for this host."})})}const mce=[{id:"at",label:"When",path:"at",type:"datetime"},{id:"actor",label:"Email",path:"actor"},{id:"action",label:"Action",path:"action",filter:{options:["config.set","config.publish","config.revision.save","config.revision.publish","config.revision.restore","addon.publish","resource.create","resource.update","resource.delete","sync.run"],optionLabels:{"config.set":"Config set","config.publish":"Config publish","config.revision.save":"Revision save","config.revision.publish":"Revision publish","config.revision.restore":"Revision restore","addon.publish":"Addon publish","resource.create":"Resource create","resource.update":"Resource update","resource.delete":"Resource delete","sync.run":"Sync run"}}},{id:"target",label:"Target",path:"target"},{id:"summary",label:"Summary",path:"summary"}];function gce(t){const e=new Date(t);return Number.isNaN(e.getTime())?t:e.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function yce(t,e){if(t==null||t==="")return"—";if(e.type==="datetime"||e.path==="at")return gce(String(t));if(e.type==="boolean")return t?"Yes":"No";if(typeof t=="object")try{return JSON.stringify(t)}catch{return String(t)}return String(t)}function Yd(t,e){if(e==="target")return`${t.targetType}${t.targetId?` · ${t.targetId}`:""}`;if(e.startsWith("meta.")){const n=e.slice(5);return t.meta?.[n]}return t[e]}function bce(t){return t.type==="datetime"||t.path==="at"?"datetime":t.type==="number"?"number":"string"}function vce({entry:t,column:e}){const n=Yd(t,e.path),r=yce(n,e);return e.path==="at"||e.type==="datetime"?p.jsx("td",{className:"vertebr-audit-when",children:r}):e.path==="actor"?p.jsx("td",{className:"vertebr-audit-actor",children:r}):e.path==="action"?p.jsx("td",{children:r==="—"?r:p.jsx("code",{className:"vertebr-audit-action",children:r})}):e.path==="target"||e.path==="targetType"?p.jsx("td",{children:p.jsx("span",{className:"vertebr-audit-target",children:r})}):p.jsx("td",{children:r})}function wce({client:t,label:e="Audit",columns:n}){const r=n&&n.length>0?n:mce,[s,i]=C.useState([]),[o,l]=C.useState(!0),[u,d]=C.useState(null),[h,m]=C.useState(""),[y,b]=C.useState({}),[v,x]=C.useState(()=>({field:r.find(T=>T.path==="at")?.id??r[0].id,order:"desc"})),k=ib(s.length);C.useEffect(()=>{let T=!1;return(async()=>{try{l(!0),d(null);const A=await t.listAudit({limit:100,fresh:!0});T||i(A.items)}catch(A){T||d(A instanceof Error?A.message:"Failed to load audit")}finally{T||l(!1)}})(),()=>{T=!0}},[t]);const E=C.useMemo(()=>r.map(T=>Hoe(T.id,T.label,T.filter)).filter(T=>!!T),[r]),M=C.useMemo(()=>Object.fromEntries(E.map(T=>{const A=r.find(j=>j.id===T.id);return[T.id,j=>Yd(j,A?.path??T.id)]})),[E,r]),_=C.useMemo(()=>h.trim()?s.filter(T=>r.some(A=>vu(Yd(T,A.path),h))):s,[s,h,r]),N=C.useMemo(()=>{const T=r.find(P=>P.id===v.field)??r[0],A=_.filter(P=>kz(P,y,M));if(!T)return A;const j=bce(T);return[...A].sort((P,O)=>JC(Yd(P,T.path),Yd(O,T.path),j,v.order))},[_,v,r,y,M]);return p.jsxs("div",{className:"vertebr-audit",children:[p.jsxs("div",{className:"vertebr-panel-head",children:[p.jsx("h2",{children:e}),p.jsxs("div",{className:"vertebr-panel-head-actions",children:[E.length>0?p.jsx(Cz,{columns:E,selected:y,onChange:b}):null,p.jsx(XC,{value:h,onChange:m,"aria-label":"Search audit"}),p.jsx(ab,{canLeft:k.canLeft,canRight:k.canRight,onScroll:k.scrollBy}),p.jsx("span",{className:"vertebr-count",children:o?"…":N.length!==s.length?`${N.length} of ${s.length}`:`${s.length} events`})]})]}),u?p.jsx("div",{className:"vertebr-error",children:u}):null,o&&s.length===0?p.jsx(wz,{columns:r.map(T=>({id:T.id,label:T.label}))}):s.length===0?p.jsx("div",{className:"vertebr-empty",children:"No audit events yet."}):N.length===0?p.jsx("div",{className:"vertebr-empty",children:"No matching events."}):p.jsx(ob,{overflow:k,transitionKey:JSON.stringify(y),children:p.jsxs("table",{className:"vertebr-table vertebr-audit-table",children:[p.jsx("thead",{children:p.jsx("tr",{children:r.map(T=>{const A=T.sortable!==!1,j=v.field===T.id;return A?p.jsx("th",{children:p.jsx(ZC,{label:T.label,active:j,order:j?v.order:void 0,onSort:()=>x(QC(v,T.id,T.type==="datetime"||T.path==="at"?"desc":"asc"))})},T.id):p.jsx("th",{children:T.label},T.id)})})}),p.jsx("tbody",{children:N.map(T=>p.jsx("tr",{children:r.map(A=>p.jsx(vce,{entry:T,column:A},A.id))},T.id))})]})})]})}function xce({environments:t,value:e,onChange:n,excludeId:r,ariaLabel:s="Destination environments",placeholder:i="Select destinations"}){const[o,l]=C.useState(!1),u=C.useRef(null),d=t.filter(y=>y.id!==r),h=d.filter(y=>e.includes(y.id));C.useEffect(()=>{if(!o)return;const y=b=>{u.current?.contains(b.target)||l(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]);const m=y=>{if(e.includes(y)){n(e.filter(b=>b!==y));return}n([...e,y])};return p.jsxs("div",{className:"vertebr-env-multi",ref:u,children:[p.jsxs("button",{type:"button",className:"vertebr-select-trigger vertebr-env-multi-trigger","aria-label":s,"aria-expanded":o,onClick:()=>l(y=>!y),children:[p.jsx("span",{className:"vertebr-env-multi-value",children:h.length===0?p.jsx("span",{className:"vertebr-env-multi-placeholder",children:i}):h.map(y=>p.jsxs("span",{className:"vertebr-env-multi-chip","data-tone":y.tone??"neutral",children:[p.jsx("span",{className:"vertebr-select-dot","data-tone":y.tone??"neutral"}),y.label]},y.id))}),p.jsx("span",{className:"vertebr-select-icon","aria-hidden":"true",children:"▾"})]}),o?p.jsx("div",{className:"vertebr-env-multi-menu",role:"listbox","aria-label":s,children:d.map(y=>{const b=e.includes(y.id);return p.jsxs("label",{className:"vertebr-env-multi-option","data-tone":y.tone??"neutral",children:[p.jsx("input",{type:"checkbox",checked:b,onChange:()=>m(y.id)}),p.jsx("span",{className:"vertebr-select-dot","data-tone":y.tone??"neutral"}),p.jsx("span",{children:y.label})]},y.id)})}):null]})}function zO({environment:t}){return p.jsxs("span",{className:"vertebr-sync-env-badge","data-tone":t.tone??"neutral",children:[p.jsx("span",{className:"vertebr-select-dot","data-tone":t.tone??"neutral"}),p.jsx("span",{children:t.label})]})}function Vz({environments:t,value:e,onChange:n}){const r=t.find(s=>s.id===e);return p.jsxs(Yy,{value:e,onValueChange:n,children:[p.jsxs(Ky,{className:"vertebr-select-trigger","aria-label":"Environment","data-tone":r?.tone??"neutral",children:[p.jsxs("span",{className:"vertebr-select-value",children:[p.jsx("span",{className:"vertebr-select-dot","data-tone":r?.tone??"neutral"}),p.jsx(Zy,{placeholder:"Select environment"})]}),p.jsx(Xy,{className:"vertebr-select-icon",children:p.jsx(Sce,{})})]}),p.jsx(Jy,{children:p.jsx(Qy,{className:"vertebr-select-content",position:"popper",sideOffset:6,children:p.jsx(tb,{className:"vertebr-select-viewport",children:t.map(s=>p.jsxs(nb,{value:s.id,className:"vertebr-select-item","data-tone":s.tone??"neutral",children:[p.jsxs("span",{className:"vertebr-select-value",children:[p.jsx("span",{className:"vertebr-select-dot","data-tone":s.tone??"neutral"}),p.jsx(rb,{children:s.label})]}),s.auth?.required?p.jsx("span",{className:"vertebr-env-lock",children:"auth"}):null,p.jsx(sb,{className:"vertebr-select-check",children:p.jsx(kce,{})})]},s.id))})})})]})}function Sce(){return p.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:p.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function kce(){return p.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:p.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 Hw({title:t,children:e,subdued:n}){return p.jsxs("section",{className:"vertebr-card","data-subdued":n||void 0,children:[t?p.jsx("header",{className:"vertebr-card-head",children:t}):null,p.jsx("div",{className:"vertebr-card-body",children:e})]})}function dm({children:t,tone:e="neutral"}){return p.jsx("span",{className:"vertebr-badge","data-tone":e,children:t})}const fm=390,hm=720;function Cce(t){const e=t.trim()||"/";try{const n=new URL(e,"http://vertebr.local");return`${n.pathname}${n.search}${n.hash}`||"/"}catch{return e.startsWith("/")?e:`/${e}`}}function Ece(t,e,n){const r={};for(const[s,i]of Object.entries(e??{}))r[s]={...i};for(const s of n??[]){const o={...r[s.id]??{enabled:s.envEnabled}};o.enabled===void 0&&(o.enabled=s.envEnabled),s.id==="countdown"&&t==="comingSoon"&&(o.target="comingSoon"),s.id==="countdown"&&t==="product"&&(o.target="product"),s.id==="reviews"&&t==="home"&&(o.showOnHome=!0),s.id==="reviews"&&t==="product"&&(o.showOnProducts=!0),r[s.id]=o}return r}function BO({label:t,previewPath:e,controlId:n,draft:r,relatedDrafts:s,addons:i}){const o=C.useRef(null),l=C.useRef(null),u=C.useRef(r),[d,h]=C.useState(!1),[m,y]=C.useState(!1),[b,v]=C.useState(1),x=C.useMemo(()=>Ece(n,s,i),[n,s,i]),k=C.useRef(x);u.current=r,k.current=x;const E=Cce(e),M=C.useMemo(()=>nk(E,{controlId:n}),[E,n]),_=C.useCallback(()=>{const T=o.current?.contentWindow,A=u.current;if(!(!T||!A)){vf(T,n,A);for(const[j,P]of Object.entries(k.current))vf(T,j,P)}},[n]);C.useEffect(()=>{h(!1),y(!1)},[M]),C.useEffect(()=>rk(T=>{const A=o.current?.contentWindow;!A||T!==A||(h(!0),_())}),[_,M]),C.useEffect(()=>{d&&_()},[r,x,d,_]),C.useEffect(()=>{const T=l.current;if(!T||typeof ResizeObserver>"u")return;const A=()=>{const P=getComputedStyle(T),O=(Number.parseFloat(P.paddingLeft)||0)+(Number.parseFloat(P.paddingRight)||0),G=(Number.parseFloat(P.paddingTop)||0)+(Number.parseFloat(P.paddingBottom)||0),B=Math.max(0,T.clientWidth-O),W=Math.max(0,T.clientHeight-G),K=Math.min(1,B/fm,W/hm);v(Number.isFinite(K)&&K>0?K:1)};A();const j=new ResizeObserver(A);return j.observe(T),()=>j.disconnect()},[]);const N=m?"Unavailable":d?"Connected":"Loading…";return p.jsxs("div",{className:"vertebr-sync-preview-frame",children:[p.jsxs("div",{className:"vertebr-sync-preview-frame-meta",children:[p.jsx("strong",{children:t}),p.jsx("span",{children:E}),p.jsx("span",{"data-status":m?"error":d?"ok":"pending",children:N})]}),i?p.jsx("div",{className:"vertebr-sync-preview-addons","aria-label":"Add-ons in preview",children:i.length===0?p.jsx("span",{className:"vertebr-sync-preview-addons-empty",children:"No add-ons"}):i.map(T=>p.jsxs("span",{className:"vertebr-sync-preview-addon","data-enabled":T.envEnabled?"true":"false",title:T.envEnabled?`${T.label} is enabled in this environment`:`${T.label} is off in this environment`,children:[T.label,p.jsx("em",{children:T.envEnabled?"on":"off"})]},T.id))}):null,p.jsx("div",{ref:l,className:"vertebr-sync-preview-frame-stage",children:p.jsx("div",{className:"vertebr-sync-preview-frame-shell",style:{width:fm*b,height:hm*b},children:p.jsx("div",{className:"vertebr-sync-preview-frame-scaler",style:{width:fm,height:hm,transform:`scale(${b})`,transformOrigin:"top left"},children:m?p.jsxs("div",{className:"vertebr-sync-preview-frame-empty",children:["Could not load preview at ",E,"."]}):p.jsx("iframe",{ref:o,title:`${t} preview`,src:M,width:fm,height:hm,onLoad:()=>{h(!0),_()},onError:()=>y(!0)})})})})]})}function FO(t,e){return t.find(n=>n.id===e)}function Tce(t){const e=t.sync?.targets??[],n=new Map;for(const r of e){const s=r.group??"Content",i=n.get(s)??[];i.push(r),n.set(s,i)}return n}function Nce(t){return t==="error"?"danger":t==="changed"||t==="new"?"warn":t==="unchanged"?"ok":"neutral"}function Mce(t){switch(t){case"changed":return"Changes";case"new":return"New";case"unchanged":return"Match";case"missing":return"Missing";case"skipped":return"Skipped";case"error":return"Error";default:return t}}function VO(t){if(t==null)return"—";if(typeof t=="string")return t.length?t:'""';if(typeof t=="number"||typeof t=="boolean")return String(t);try{return JSON.stringify(t,null,2)}catch{return String(t)}}function _ce({inspect:t,sourceLabel:e,onClose:n}){const r=t.item.changes??[],s=t.item.preview,i=!!s,[o,l]=C.useState(i?"visual":"fields");return p.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:n,children:p.jsxs("div",{className:"vertebr-modal vertebr-sync-diff-modal","data-has-visual":i?"true":void 0,role:"dialog","aria-modal":"true","aria-labelledby":"vertebr-sync-diff-title",onClick:u=>u.stopPropagation(),children:[p.jsxs("header",{className:"vertebr-modal-head vertebr-sync-diff-head",children:[p.jsxs("div",{className:"vertebr-modal-heading",children:[p.jsx("h2",{id:"vertebr-sync-diff-title",children:t.targetLabel}),p.jsxs("p",{className:"vertebr-sync-diff-subtitle",children:[p.jsxs("span",{children:[e," → ",t.destinationLabel]}),t.item.summary?p.jsx("span",{className:"vertebr-sync-diff-meta",children:t.item.summary}):null]})]}),p.jsx("div",{className:"vertebr-modal-actions",children:p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:n,children:"Close"})})]}),i?p.jsxs("div",{className:"vertebr-sync-diff-tabs",role:"tablist","aria-label":"Diff view",children:[p.jsx("button",{type:"button",role:"tab","aria-selected":o==="visual","data-active":o==="visual"?"true":void 0,onClick:()=>l("visual"),children:"Visual"}),p.jsx("button",{type:"button",role:"tab","aria-selected":o==="fields","data-active":o==="fields"?"true":void 0,onClick:()=>l("fields"),children:"Fields"})]}):null,p.jsxs("div",{className:"vertebr-modal-body",children:[t.item.warnings?.length?p.jsx("ul",{className:"vertebr-sync-diff-warnings",children:t.item.warnings.map(u=>p.jsx("li",{children:u},u))}):null,p.jsxs("div",{className:"vertebr-sync-diff-panels","data-tab":o,children:[s?p.jsx("div",{className:"vertebr-sync-diff-panel","data-panel":"visual","data-active":o==="visual"?"true":void 0,role:"tabpanel","aria-hidden":o!=="visual",children:p.jsxs("div",{className:"vertebr-sync-diff-visual",children:[p.jsx(BO,{label:`${t.destinationLabel} (now)`,previewPath:s.previewPath,controlId:s.controlId,draft:s.destDraft,relatedDrafts:s.destRelatedDrafts,addons:s.addons?.map(u=>({id:u.id,label:u.label,envEnabled:u.destEnabled}))}),p.jsx(BO,{label:`${e} (after sync)`,previewPath:s.previewPath,controlId:s.controlId,draft:s.sourceDraft,relatedDrafts:s.sourceRelatedDrafts,addons:s.addons?.map(u=>({id:u.id,label:u.label,envEnabled:u.sourceEnabled}))})]})}):null,p.jsx("div",{className:"vertebr-sync-diff-panel","data-panel":"fields","data-active":o==="fields"?"true":void 0,role:"tabpanel","aria-hidden":o!=="fields",children:r.length===0?p.jsx("p",{className:"vertebr-sync-diff-empty",children:"No field-level preview for this target. The summary still applies when you sync."}):p.jsx("div",{className:"vertebr-sync-diff-table-wrap",children:p.jsxs("table",{className:"vertebr-sync-diff-table",children:[p.jsx("thead",{children:p.jsxs("tr",{children:[p.jsx("th",{scope:"col",children:"Field"}),p.jsxs("th",{scope:"col",children:[t.destinationLabel," (now)"]}),p.jsxs("th",{scope:"col",children:[e," (after sync)"]})]})}),p.jsx("tbody",{children:r.map(u=>p.jsxs("tr",{children:[p.jsx("th",{scope:"row",children:p.jsx("code",{children:u.path})}),p.jsx("td",{children:p.jsx("pre",{children:VO(u.destination)})}),p.jsx("td",{children:p.jsx("pre",{children:VO(u.source)})})]},u.path))})]})})})]})]})]})})}function Ace({client:t,catalog:e}){const n=e.sync,{push:r}=hy(),s=e.environments,[i,o]=C.useState(()=>n?.defaultFrom??e.defaultEnvironment),[l,u]=C.useState(()=>{const ee=n?.defaultTo??[],F=n?.defaultFrom??e.defaultEnvironment;return ee.filter(I=>I!==F)}),[d,h]=C.useState(()=>(n?.targets??[]).filter(ee=>ee.defaultSelected).map(ee=>ee.id)),[m,y]=C.useState(null),[b,v]=C.useState(!1),[x,k]=C.useState(!1),[E,M]=C.useState(null),[_,N]=C.useState(null),T=FO(s,i),A=C.useMemo(()=>l.map(ee=>FO(s,ee)).filter(ee=>!!ee),[s,l]),j=C.useMemo(()=>Tce(e),[e]),P=(n?.targets.length??0)>0,O=C.useMemo(()=>(n?.targets??[]).map(ee=>ee.id),[n?.targets]),G=C.useCallback(async()=>{if(!P||l.length===0||O.length===0){y(null);return}v(!0),M(null);try{const ee=await t.getSyncPlan({from:i,to:l,targets:O});y(ee)}catch(ee){y(null),M(ee instanceof Error?ee.message:"Could not load sync preview")}finally{v(!1)}},[t,i,l,O,P]);C.useEffect(()=>{G()},[G]);const B=ee=>{h(F=>F.includes(ee)?F.filter(I=>I!==ee):[...F,ee])},W=async()=>{if(!P||l.length===0||d.length===0)return;const ee=T?.label??i,F=A.map(X=>X.label).join(", "),I=(n?.targets??[]).filter(X=>d.includes(X.id)).map(X=>X.label).join(", "),z=A.some(X=>X.tone==="danger"),J=[`Copy from ${ee} to ${F}.`,"",`Targets: ${I}`,"","This may overwrite content in the destination environment(s)."];if(z&&J.push("","You are writing to a production environment."),!!window.confirm(J.join(`
340
+ `))){k(!0),M(null);try{const X=await t.runSync({from:i,to:l,targets:d});r(X.message??(X.ok?"Sync complete":"Sync finished with errors"),X.ok?"ok":"danger"),await G()}catch(X){M(X instanceof Error?X.message:"Sync failed"),r(X instanceof Error?X.message:"Sync failed","danger")}finally{k(!1)}}},K=(ee,F)=>m?.destinations.find(I=>I.to===ee)?.targets.find(I=>I.id===F),Q=A.length>0&&d.length>0?`Sync ${d.length} item${d.length===1?"":"s"} to ${A.map(ee=>ee.label).join(", ")}`:"Select destinations and content to sync";return P?p.jsxs("div",{className:"vertebr-sync-page",children:[p.jsxs("div",{className:"vertebr-sync-scroll",children:[p.jsx(Hw,{title:"Direction",children:p.jsxs("div",{className:"vertebr-sync-direction",children:[p.jsxs("div",{className:"vertebr-sync-direction-grid",children:[p.jsxs("label",{className:"vertebr-sync-field",children:[p.jsx("span",{className:"vertebr-sync-field-label",children:"From"}),p.jsx(Vz,{environments:s,value:i,onChange:ee=>{o(ee),u(F=>F.filter(I=>I!==ee))}})]}),p.jsx("div",{className:"vertebr-sync-connector","aria-hidden":"true",children:A.length>0?A.map(ee=>p.jsx("span",{className:"vertebr-sync-connector-arrow",children:"→"},ee.id)):p.jsx("span",{className:"vertebr-sync-connector-arrow",children:"→"})}),p.jsxs("label",{className:"vertebr-sync-field",children:[p.jsx("span",{className:"vertebr-sync-field-label",children:"To"}),p.jsx(xce,{environments:s,value:l,excludeId:i,onChange:u,placeholder:"Select one or more destinations"})]})]}),T&&A.length>0?p.jsx("div",{className:"vertebr-sync-preview","aria-label":"Sync direction",children:p.jsxs("div",{className:"vertebr-sync-preview-flow","data-dest-count":A.length,children:[p.jsxs("div",{className:"vertebr-sync-preview-col vertebr-sync-preview-col-from",children:[p.jsx("span",{className:"vertebr-sync-preview-caption",children:"From"}),p.jsx(zO,{environment:T})]}),p.jsx("div",{className:"vertebr-sync-preview-col vertebr-sync-preview-col-routes",children:A.map((ee,F)=>p.jsxs("div",{className:"vertebr-sync-preview-route",children:[p.jsx("span",{className:"vertebr-sync-preview-arrow","aria-hidden":"true",children:"→"}),p.jsxs("div",{className:"vertebr-sync-preview-col vertebr-sync-preview-col-to",children:[F===0?p.jsx("span",{className:"vertebr-sync-preview-caption",children:"To"}):p.jsx("span",{className:"vertebr-sync-preview-caption","aria-hidden":"true",children:" "}),p.jsx(zO,{environment:ee})]})]},ee.id))})]})}):p.jsx("p",{className:"vertebr-sync-direction-hint",children:"Pick a source environment and one or more destinations to preview changes."})]})}),p.jsxs(Hw,{title:"What to sync",children:[p.jsxs("div",{className:"vertebr-sync-targets-head",children:[p.jsx("p",{className:"vertebr-sync-targets-copy",children:"Review what will change in each destination before syncing."}),p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-sync-refresh",disabled:b||l.length===0,onClick:()=>{G()},children:b?"Refreshing…":"Refresh preview"})]}),[...j.entries()].map(([ee,F])=>p.jsxs("div",{className:"vertebr-sync-target-group",children:[p.jsx("div",{className:"vertebr-sync-target-group-label",children:ee}),p.jsx("ul",{className:"vertebr-sync-target-list",children:F.map(I=>{const z=d.includes(I.id);return p.jsx("li",{children:p.jsxs("div",{className:"vertebr-sync-target-row","data-selected":z||void 0,children:[p.jsxs("button",{type:"button",className:"vertebr-sync-target-toggle",onClick:()=>B(I.id),"aria-pressed":z,children:[p.jsx("span",{className:"vertebr-sync-target-check","aria-hidden":"true",children:z?"✓":""}),p.jsxs("span",{className:"vertebr-sync-target-main",children:[p.jsx("span",{className:"vertebr-sync-target-title",children:I.label}),I.description?p.jsx("span",{className:"vertebr-sync-target-desc",children:I.description}):null]})]}),p.jsx("span",{className:"vertebr-sync-target-badges",children:A.length===0?p.jsx(dm,{children:"Choose destination"}):b?p.jsx(dm,{children:"Previewing…"}):A.map(J=>{const X=K(J.id,I.id);if(!X)return p.jsx(dm,{children:J.label},J.id);const L=(X.status==="changed"||X.status==="new")&&(!!X.changes?.length||!!X.preview);return p.jsxs("span",{className:"vertebr-sync-target-dest",title:X.summary,children:[p.jsxs(dm,{tone:Nce(X.status),children:[J.label,": ",Mce(X.status)]}),p.jsx("span",{className:"vertebr-sync-target-summary",children:X.summary}),L?p.jsx("button",{type:"button",className:"vertebr-sync-diff-btn",onClick:()=>N({targetId:I.id,targetLabel:I.label,destinationId:J.id,destinationLabel:J.label,item:X}),children:X.preview?"View preview":"View diff"}):null]},J.id)})})]})},I.id)})})]},ee))]}),n?.excluded.length?p.jsx(Hw,{title:"Never synced",subdued:!0,children:p.jsx("ul",{className:"vertebr-sync-excluded-list",children:n.excluded.map(ee=>p.jsxs("li",{children:[p.jsx("span",{className:"vertebr-sync-excluded-name",children:ee.label}),p.jsx("span",{className:"vertebr-sync-excluded-reason",children:ee.reason})]},ee.label))})}):null,E?p.jsx("div",{className:"vertebr-banner","data-tone":"danger",children:E}):null]}),p.jsxs("div",{className:"vertebr-savebar vertebr-sync-footer",children:[p.jsx("div",{className:"vertebr-savebar-message",children:Q}),p.jsx("div",{className:"vertebr-savebar-actions",children:p.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-primary vertebr-sync-run-btn",disabled:x||b||l.length===0||d.length===0,onClick:()=>{W()},children:[p.jsx(sk,{}),p.jsx("span",{children:x?"Syncing…":"Sync selected"})]})})]}),_?p.jsx(_ce,{inspect:_,sourceLabel:T?.label??i,onClose:()=>N(null)}):null]}):p.jsx("div",{className:"vertebr-sync-page",children:p.jsx("div",{className:"vertebr-sync-scroll",children:p.jsxs("div",{className:"vertebr-empty-state vertebr-sync-empty",children:[p.jsx("h3",{children:"Sync not configured"}),p.jsxs("p",{children:["This admin has multiple environments but no sync targets yet. Hosts register targets with ",p.jsx("code",{children:"admin.sync()"}),"."]})]})})})}function Rce({client:t,catalog:e,configData:n,isPageSelection:r,previewPath:s,relatedAddons:i=[],onConfigSaved:o,onRefreshConfig:l,onSelectAddon:u,galleryPicker:d,fontLibraryPicker:h}){const[m,y]=C.useState(n.value),[b,v]=C.useState({}),x=!!s,k=wf(e,"config.write"),E=wf(e,"config.publish"),M=!!e.revisionsEnabled||!!n.revisionsEnabled,_=i.map(A=>A.id).join(",");C.useEffect(()=>{y(n.value)},[n.id,n.activeRevisionId,n.value]),C.useEffect(()=>{if(!i.length){v({});return}let A=!1;return(async()=>{const j=await Promise.all(i.map(async P=>{try{const G={...(await t.getConfig(P.id)).value};return n.id==="comingSoon"&&P.id==="countdown"&&(G.target="comingSoon"),n.id==="product"&&P.id==="countdown"&&(G.target="product"),[P.id,G]}catch{return[P.id,{enabled:!1}]}}));A||v(Object.fromEntries(j))})(),()=>{A=!0}},[t,n.id,_,i]);const N=C.useCallback(A=>{y(j=>({...j??n.value,...A}))},[n.value]),T=p.jsx(hh,{schema:n.schema,value:n.value,client:t,canWrite:k,revisionsEnabled:M,canPublish:E&&!!n.draftRevisionId,onPublish:E&&n.draftRevisionId?async()=>{const A=await t.publishRevision(n.id,n.draftRevisionId);o(A),await l?.()}:void 0,onChange:x?N:void 0,onSave:async A=>{const j=await t.setConfig(n.id,A);o(j)},...d,...h});return p.jsxs("div",{className:"vertebr-config-editor",children:[x||r||M?p.jsxs("div",{className:"vertebr-panel-head",children:[p.jsx("h2",{children:r?"Page content":n.label}),p.jsxs("div",{className:"vertebr-panel-head-actions",children:[x||r?p.jsxs("span",{className:"vertebr-count",children:[Object.keys(n.schema).length," fields"]}):null,M?p.jsx(Loe,{client:t,configId:n.id,onPublished:async()=>{await l?.()}}):null]})]}):null,i.length?p.jsxs("div",{className:"vertebr-page-related-addons","aria-label":"Linked add-ons",children:[p.jsx("span",{className:"vertebr-page-related-addons-label",children:"Linked add-ons"}),p.jsx("div",{className:"vertebr-page-related-addons-list",children:i.map(A=>{const j=b[A.id]?.enabled===!0;return p.jsxs("button",{type:"button",className:"vertebr-page-related-addon","data-enabled":j?"true":"false",onClick:()=>u?.(A.id),children:[p.jsx("span",{children:A.label}),p.jsx("em",{children:j?"on":"off"})]},A.id)})})]}):null,x&&s?p.jsxs("div",{className:"vertebr-page-editor",children:[p.jsx("div",{className:"vertebr-page-editor-form",children:T}),p.jsx(Fz,{previewPath:s,controlId:n.id,draft:m??n.value,relatedDrafts:Object.keys(b).length?b:void 0})]}):T]})}function Oce({client:t,catalog:e,selection:n,onSelectionChange:r,authRequired:s,loading:i,isPageSelection:o,metricsData:l,metricsLoading:u,metricsRange:d,onMetricsRangeChange:h,onRefreshMetrics:m,galleryData:y,galleryLoading:b,onRefreshGallery:v,fontLibraryData:x,fontLibraryLoading:k,onRefreshFonts:E,emailsData:M,emailsLoading:_,onRefreshEmails:N,resourceData:T,resourceLoading:A=!1,resourceSearch:j,onResourceSearchChange:P,resourceSort:O=null,onResourceSortChange:G,onRefreshResource:B,onRefreshConfig:W,configData:K,onConfigSaved:Q,galleryPicker:ee,fontLibraryPicker:F}){return e?p.jsx("div",{className:"vertebr-content",children:p.jsxs("section",{className:"vertebr-panel",children:[n?.kind==="overview"?p.jsx(Vae,{label:l?.label??e.metrics?.label,windowLabel:l?.windowLabel,compareLabel:l?.compareLabel,metrics:l?.metrics??[],charts:l?.charts??[],range:d,onRangeChange:h,loading:u,onRefresh:()=>{m()}}):null,n?.kind==="audit"?p.jsx(wce,{client:t,label:e.audit?.label,columns:e.audit?.columns}):null,n?.kind==="sync"?p.jsx(Ace,{client:t,catalog:e}):null,n?.kind==="gallery"&&y?p.jsx(Nae,{label:y.label,items:y.items,accept:y.accept,maxBytes:y.maxBytes,canDelete:y.canDelete,loading:b,onRefresh:()=>{v()},onUpload:async I=>{for(const z of I)await t.uploadGalleryFile(z);await v()},onDelete:y.canDelete?async I=>{await t.deleteGalleryItem(I),await v()}:void 0}):null,n?.kind==="fontLibrary"&&x?p.jsx(Cae,{label:x.label,data:x,loading:k,onRefresh:()=>{E()},onUpload:async(I,z)=>{for(const J of I)await t.uploadFontFile(J,z);await E()},onImportGoogle:x.canImportGoogle?async I=>{await t.importGoogleFont(I),await E()}:void 0,onDelete:x.canDelete?async I=>{await t.deleteFontItem(I),await E()}:void 0}):null,n?.kind==="emails"&&M?p.jsx(wae,{data:M,loading:_,tab:n.tab??"compose",onRefresh:()=>{N()},onLoadRecipients:async I=>{const z=await t.listResource(I,{fresh:!0}),J=new Set,X=[];for(const L of z.items){const q=String(L.email??"").trim().toLowerCase();if(!q.includes("@")||J.has(q))continue;J.add(q);const ie=String(L.id??L.uid??L.slug??q),de=String(L.displayName??L.name??"").trim();X.push({email:q,id:ie,...de?{label:de}:{}})}return X.sort((L,q)=>L.email.localeCompare(q.email)),X},onPreview:I=>t.previewEmails(I),onSend:async I=>{const z=await t.sendEmails(I);return{sent:z.sent,failed:z.failed}},onSchedule:M.canSchedule?async I=>{await t.scheduleEmails(I)}:void 0,onCancel:M.canSchedule?async I=>{await t.cancelEmailCampaign(I)}:void 0,onSaveLibrary:M.canLibrary?async I=>{await t.saveEmailLibraryTemplate(I)}:void 0,onDeleteLibrary:M.canLibrary?async I=>{await t.deleteEmailLibraryTemplate(I)}:void 0}):null,n?.kind==="resource"?(()=>{const I=e.resources.find(X=>X.id===n.id),z=T!=null&&T.id===n.id,J=z?T.schema:I?.schema??{};return!z&&Object.keys(J).length===0?null:p.jsx(nce,{schema:J,items:z?T.items:[],label:z?T.label:I?.label??n.id,listQuery:z?T.listQuery:I?.listQuery,total:z?T.total:void 0,loading:A||!z,searchQuery:j,onSearchChange:P,sort:O,onSortChange:G,initialEditRowId:z&&n.rowId?n.rowId:void 0,onEditRowIdChange:X=>{r?.({kind:"resource",id:n.id,rowId:X??void 0})},permissions:z?T.permissions:{create:!1,update:!1,delete:!1},actions:z?T.actions:{},collectionActions:z?T.collectionActions:{},bulkActions:z?T.bulkActions:{},uploads:z?T.uploads:void 0,storageKey:n.id,onUpdate:z&&T.permissions.update?async(X,L)=>{await t.updateResource(T.id,X,L),await B()}:void 0,onCreate:z&&T.permissions.create?async X=>{await t.createResource(T.id,X),await B()}:void 0,onDelete:z&&T.permissions.delete?async X=>{await t.deleteResource(T.id,X),await B()}:void 0,onAction:z?async(X,L,q)=>{await t.runResourceAction(T.id,X,L,q)}:void 0,onActionDone:B,onPreviewMail:z?async(X,L,q)=>t.previewResourceMail(T.id,X,L,q):void 0,onCollectionAction:z?async(X,L)=>t.runCollectionAction(T.id,X,L):void 0,onBulkAction:z&&T.bulkActions?async(X,L,q)=>{await t.runBulkAction(T.id,X,{rowIds:L,input:q})}:void 0,onUpload:z&&T.uploads?async(X,L)=>{const q=[];for(const ie of L){const de=await t.uploadResourceFile(T.id,X,ie);q.push({url:de.url,name:de.name})}return q}:void 0,...ee})})():null,n?.kind==="addons"?p.jsx(pce,{client:t,catalog:e,onSelectAddon:I=>r?.({kind:"addon",id:I})}):null,n?.kind==="config"&&K?p.jsx(Rce,{client:t,catalog:e,configData:K,isPageSelection:o,previewPath:e.configs.find(I=>I.id===K.id)?.previewPath,relatedAddons:e.configs.find(I=>I.id===K.id)?.relatedAddons,onConfigSaved:Q,onRefreshConfig:W,onSelectAddon:I=>r?.({kind:"addon",id:I}),galleryPicker:ee,fontLibraryPicker:F},K.id):null,n?.kind==="addon"&&K?(()=>{const I=e.addons?.find(z=>z.id===K.id);return I?p.jsx(cce,{client:t,catalog:e,addon:I,configData:K,onConfigSaved:Q,galleryPicker:ee,fontLibraryPicker:F},K.id):null})():null]})}):p.jsx("div",{className:"vertebr-content",children:p.jsx("section",{className:"vertebr-panel",children:p.jsx("div",{className:"vertebr-empty",children:s?"Authenticated access required for this environment.":i?"Loading…":"Unable to load catalog."})})})}function jce({catalogLoaded:t,authRequired:e,selection:n,isPageSelection:r,hasPagePreview:s,selectionDescription:i}){return!t&&e?"Provide an access token to load this environment.":i||(n?.kind==="overview"?"Commerce, growth, and catalog for the selected environment.":n?.kind==="sync"?"Copy selected content between environments.":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"?s?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 Dce({activeLabel:t,catalogLoaded:e,authRequired:n,selection:r,isPageSelection:s,hasPagePreview:i,selectionDescription:o,error:l,breadcrumbs:u}){return p.jsxs("header",{className:"vertebr-header",children:[p.jsxs("div",{children:[u.length>1?p.jsx("ol",{className:"vertebr-breadcrumbs",children:u.map((d,h)=>p.jsx("li",{children:h===u.length-1?p.jsx("strong",{children:d.label}):d.label},`${d.label}-${h}`))}):null,p.jsx("h1",{children:t}),p.jsx("p",{children:jce({catalogLoaded:e,authRequired:n,selection:r,isPageSelection:s,hasPagePreview:i,selectionDescription:o})})]}),l?p.jsx("span",{className:"vertebr-status","data-tone":"danger",children:l}):null]})}function Ice(){const{state:t}=_D();return t.visible?p.jsxs("div",{className:"vertebr-savebar","data-tone":t.tone,children:[p.jsx("div",{className:"vertebr-savebar-message",children:t.saving?"Saving…":t.publishing?"Publishing…":t.message??(t.isDirty?"Unsaved changes":"Saved")}),p.jsxs("div",{className:"vertebr-savebar-actions",children:[t.onDiscard&&t.isDirty?p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:t.saving||t.publishing,onClick:t.onDiscard,children:"Discard"}):null,t.onSave?p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",disabled:t.saving||t.publishing||!t.isDirty,onClick:()=>{t.onSave?.()},children:t.saveLabel??"Save"}):null,t.onPublish?p.jsx("button",{type:"button",className:"vertebr-btn",disabled:t.saving||t.publishing||t.isDirty,title:t.isDirty?"Save draft before publishing":"Publish the current draft to the live storefront",onClick:()=>{t.onPublish?.()},children:t.publishLabel??"Publish"}):null]})]}):null}const HO="https://github.com/yaboijams/vertebr";function Lce({collapsed:t}){return t?p.jsx("div",{className:"vertebr-powered-by","data-collapsed":"true",children:p.jsx("a",{href:HO,target:"_blank",rel:"noopener noreferrer",title:"Powered by Vertebr","aria-label":"Powered by Vertebr",children:"V"})}):p.jsx("div",{className:"vertebr-powered-by",children:p.jsxs("a",{href:HO,target:"_blank",rel:"noopener noreferrer",children:["Powered by ",p.jsx("strong",{children:"Vertebr"})]})})}function Pce({item:t,collapsed:e}){const n=!!t.children?.length,r=t.children?.some(u=>u.active)??!1,s=t.active||r,[i,o]=C.useState(s),l=t.icon??$s({key:t.key,label:t.label,group:t.group});if(C.useEffect(()=>{s&&o(!0)},[s]),!n||e){const u=n?s:t.active;return p.jsxs("button",{type:"button","data-active":u||void 0,title:e?t.label:void 0,onClick:t.onSelect,children:[p.jsx(l,{className:"vertebr-nav-icon"}),p.jsx("span",{className:"vertebr-nav-label-text",children:t.label})]})}return p.jsxs("div",{className:"vertebr-nav-item","data-has-children":"true","data-open":i||void 0,children:[p.jsxs("div",{className:"vertebr-nav-parent",children:[p.jsxs("button",{type:"button",className:"vertebr-nav-parent-label","data-active":s&&!r,"data-section":s||void 0,title:e?t.label:void 0,onClick:()=>{o(!0),t.onSelect()},children:[p.jsx(l,{className:"vertebr-nav-icon"}),p.jsx("span",{className:"vertebr-nav-label-text",children:t.label})]}),e?null:p.jsx("button",{type:"button",className:"vertebr-nav-parent-toggle","aria-label":i?`Collapse ${t.label}`:`Expand ${t.label}`,"aria-expanded":i,onClick:()=>o(u=>!u),children:p.jsx("span",{className:"vertebr-nav-chevron","aria-hidden":"true",children:"▸"})})]}),p.jsx("div",{className:"vertebr-nav-sub-wrap","data-open":i?"true":void 0,children:p.jsx("div",{className:"vertebr-nav-sub-inner",children:p.jsx("div",{className:"vertebr-nav-sub",role:"group",children:t.children.map(u=>p.jsx("button",{type:"button",className:"vertebr-nav-subitem","data-active":u.active,onClick:()=>{o(!0),u.onSelect()},children:u.label},u.key))})})})]})}function $ce({navGroups:t,collapsed:e}){return p.jsxs("aside",{className:"vertebr-sidebar","data-collapsed":e||void 0,children:[p.jsx("div",{className:"vertebr-sidebar-top",children:p.jsx("nav",{className:"vertebr-nav",children:t.map(n=>p.jsxs("div",{className:"vertebr-nav-group",children:[p.jsx("div",{className:"vertebr-nav-label",children:n.label}),n.items.map(r=>p.jsx(Pce,{item:r,collapsed:e},r.key))]},n.label))})}),p.jsx("div",{className:"vertebr-sidebar-bottom",children:p.jsx(Lce,{collapsed:e})})]})}function zce(){const{toasts:t,dismiss:e}=hy();return t.length?p.jsx("div",{className:"vertebr-toast-stack","aria-live":"polite",children:t.map(n=>p.jsxs("div",{className:"vertebr-toast","data-tone":n.tone,role:"status",children:[p.jsx("span",{children:n.message}),p.jsx("button",{type:"button",className:"vertebr-toast-dismiss","aria-label":"Dismiss",onClick:()=>e(n.id),children:"×"})]},n.id))}):null}function Bce({theme:t,onChange:e,compact:n}){return p.jsx("div",{className:"vertebr-theme","data-compact":n?"true":void 0,children:p.jsxs("div",{className:"vertebr-theme-toggle",role:"group","aria-label":"Appearance",children:[p.jsxs("button",{type:"button",className:"vertebr-theme-option","data-active":t==="light","aria-pressed":t==="light","aria-label":"Light",title:"Light",onClick:()=>e("light"),children:[p.jsx(Fce,{}),n?null:"Light"]}),p.jsxs("button",{type:"button",className:"vertebr-theme-option","data-active":t==="dark","aria-pressed":t==="dark","aria-label":"Dark",title:"Dark",onClick:()=>e("dark"),children:[p.jsx(Vce,{}),n?null:"Dark"]})]})})}function Fce(){return p.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:[p.jsx("circle",{cx:"12",cy:"12",r:"4"}),p.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 Vce(){return p.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:p.jsx("path",{d:"M21 14.5A8.5 8.5 0 0 1 9.5 3 7 7 0 1 0 21 14.5z"})})}function Hce(t){return t==="ok"?"OK":t==="warn"?"Warn":"Error"}function Uce(t){if(!t)return null;const e=new Date(t);return Number.isNaN(e.getTime())?t:e.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}function Wce({checks:t,environment:e,onClose:n,onRefresh:r}){const[s,i]=C.useState(!1),[o,l]=C.useState(null);C.useEffect(()=>{const h=y=>{y.key==="Escape"&&n()};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}},[n]);const u=async()=>{if(!(!r||s)){i(!0),l(null);try{await r()}catch(h){l(h instanceof Error?h.message:"Failed to refresh health")}finally{i(!1)}}},d=Uce(t.map(h=>h.checkedAt).find(Boolean));return p.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:n,children:p.jsxs("div",{className:"vertebr-modal vertebr-modal-sm vertebr-health-modal",role:"dialog","aria-modal":"true","aria-label":"System health",onClick:h=>h.stopPropagation(),children:[p.jsxs("header",{className:"vertebr-modal-head",children:[p.jsxs("div",{className:"vertebr-modal-heading",children:[p.jsx("p",{className:"vertebr-modal-eyebrow",children:"Operations"}),p.jsx("h2",{children:"System health"}),e||d?p.jsx("p",{className:"vertebr-health-modal-meta",children:[e?`Env: ${e}`:null,d?`Checked ${d}`:null].filter(Boolean).join(" · ")}):null]}),p.jsxs("div",{className:"vertebr-modal-actions",children:[r?p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:s,onClick:()=>{u()},children:s?"Refreshing…":"Refresh"}):null,p.jsx("button",{type:"button",className:"vertebr-btn",onClick:n,children:"Close"})]})]}),p.jsxs("div",{className:"vertebr-modal-body",children:[o?p.jsx("p",{className:"vertebr-health-modal-error",children:o}):null,t.length===0?p.jsx("p",{className:"vertebr-health-modal-empty",children:"No health checks reported."}):p.jsx("ul",{className:"vertebr-health-list",children:t.map(h=>p.jsxs("li",{className:"vertebr-health-item","data-status":h.status,children:[p.jsxs("div",{className:"vertebr-health-item-top",children:[p.jsxs("span",{className:"vertebr-health-badge","data-status":h.status,children:[p.jsx("span",{className:"vertebr-health-badge-dot","aria-hidden":!0}),Hce(h.status)]}),p.jsx("strong",{className:"vertebr-health-item-label",children:h.label})]}),h.detail?p.jsx("p",{className:"vertebr-health-item-detail",children:h.detail}):null]},h.id))})]})]})})}function qce(t){return t?.length?t.some(e=>e.status==="error")?"error":t.some(e=>e.status==="warn")?"warn":"ok":null}function Gce(t){return t==="ok"?"Healthy":t==="warn"?"Attention":"Degraded"}function Yce({brand:t,brandLogoUrl:e,brandLogoUrlDark:n,hostName:r,hostLogoUrl:s,envList:i,environment:o,onEnvironmentChange:l,authUserLabel:u,onSignOut:d,getAccessToken:h,authViaTokenOnly:m,authRequired:y,token:b,tokenDraft:v,onTokenDraftChange:x,onSaveToken:k,onClearToken:E,theme:M,onThemeChange:_,sidebarCollapsed:N,onToggleSidebar:T,syncEnabled:A,onOpenSync:j,onOpenSearch:P,healthChecks:O,onRefreshHealth:G}){const[B,W]=C.useState(!1),K=qce(O),Q=!h&&!m&&(y||!!b);return p.jsxs(p.Fragment,{children:[p.jsxs("header",{className:"vertebr-topbar",children:[p.jsxs("div",{className:"vertebr-topbar-start",children:[p.jsx("button",{type:"button",className:"vertebr-topbar-toggle","aria-label":N?"Expand sidebar":"Collapse sidebar",onClick:T,children:p.jsx(L5,{})}),p.jsx("div",{className:"vertebr-topbar-brand-wrap",children:r?p.jsxs(p.Fragment,{children:[p.jsxs("span",{className:"vertebr-topbar-host","data-primary":"true",children:[s?p.jsx("img",{className:"vertebr-topbar-host-logo",src:s,alt:""}):null,p.jsx("strong",{className:"vertebr-topbar-host-label",children:r})]}),e?p.jsx("span",{className:"vertebr-topbar-product","data-mark":"true",children:p.jsx("img",{className:"vertebr-topbar-brand-mark",src:M==="light"?e:n??e,alt:t})}):p.jsx("span",{className:"vertebr-topbar-product",children:t})]}):e?p.jsx("span",{className:"vertebr-topbar-brand",children:p.jsx("img",{className:"vertebr-topbar-brand-mark",src:M==="light"?e:n??e,alt:t})}):p.jsx("strong",{className:"vertebr-topbar-brand",children:t})}),i.length>1?p.jsx("div",{className:"vertebr-topbar-env",children:p.jsx(Vz,{environments:i,value:o,onChange:l})}):null]}),p.jsx("div",{className:"vertebr-topbar-center",children:p.jsxs("button",{type:"button",className:"vertebr-topbar-search",onClick:P,children:[p.jsx(lD,{}),p.jsx("span",{children:"Search admin"}),p.jsx("kbd",{children:"⌘K"})]})}),p.jsxs("div",{className:"vertebr-topbar-end",children:[p.jsxs("div",{className:"vertebr-topbar-cluster","aria-label":"Operations",children:[K&&O?.length?p.jsxs("button",{type:"button",className:"vertebr-topbar-health","data-tone":K,"aria-haspopup":"dialog","aria-expanded":B,onClick:()=>W(!0),children:[p.jsx("span",{className:"vertebr-topbar-health-dot","aria-hidden":!0}),p.jsx("span",{className:"vertebr-topbar-health-text",children:Gce(K)})]}):null,A&&j?p.jsxs("button",{type:"button",className:"vertebr-topbar-action",onClick:j,children:[p.jsx(sk,{}),p.jsx("span",{children:"Sync"})]}):null]}),Q?p.jsxs("div",{className:"vertebr-topbar-token",children:[p.jsx("input",{className:"vertebr-auth-input",type:"password",placeholder:"Access token",value:v,onChange:ee=>x(ee.target.value),autoComplete:"off"}),p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:k,children:"Use"}),b?p.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:E,children:"Clear"}):null]}):null,h||d?p.jsxs("div",{className:"vertebr-topbar-account",children:[h&&u?p.jsx("span",{className:"vertebr-topbar-user",title:u,children:u}):null,d?p.jsx("button",{type:"button",className:"vertebr-topbar-signout",onClick:()=>{d()},children:"Sign out"}):null]}):null,p.jsx(Bce,{theme:M,onChange:_,compact:!0})]})]}),B&&O?.length?p.jsx(Wce,{checks:O,environment:o,onClose:()=>W(!1),onRefresh:G}):null]})}function Kce(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"sync":return[...n,{label:"Sync environments"}];case"audit":return[...n,{label:e.audit?.label??"Audit"}];case"addons":return[...n,{label:"Add-ons"}];case"addon":{const r=e.addons?.find(s=>s.id===t.id);return[...n,{label:"Add-ons",href:"/addons"},{label:r?.label??t.id}]}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(i=>i.id===t.id),s=[...n,{label:r?.group??"Products",href:void 0},{label:r?.label??t.id}];return t.rowId&&s.push({label:t.rowId}),s}case"config":{const r=e.configs.find(i=>i.id===t.id),s=r?.group??(r?.section==="page"?"Pages":"Settings");return[...n,{label:s},{label:r?.label??t.id}]}default:return n}}const Zce=new Set(["compose","templates","activity"]);function Xce(t){const e=(t||"/admin/api").replace(/\/$/,"")||"/admin/api";return e.endsWith("/api")?e.slice(0,-4)||"/":e}function Hz(t){return!t||t==="/"?"":t.replace(/\/$/,"")}function Jce(t,e){if(!t)return"/overview";switch(t.kind){case"overview":return"/overview";case"sync":return"/sync";case"audit":return"/audit";case"addons":return"/addons";case"addon":return`/addons/${encodeURIComponent(t.id)}`;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(s=>s.id===t.id)?.section==="page"?"pages":"config"}/${encodeURIComponent(t.id)}`;default:return"/overview"}}function Qce(t,e,n){const r=Hz(t),s=Jce(e,n);return`${r}${s}`||"/"}function eue(t){return t&&Zce.has(t)?t:"compose"}function Uw(t,e,n){const r=Hz(e);let s=t||"/";if(r){if(s===r||s===`${r}/`)return null;(s.startsWith(`${r}/`)||s.startsWith(r))&&(s=s.slice(r.length))}const i=s.replace(/^\//,"").split("/").filter(Boolean);if(i.length===0)return null;const[o,...l]=i;if(o==="overview")return{kind:"overview"};if(o==="sync")return{kind:"sync"};if(o==="audit")return{kind:"audit"};if(o==="addons"){if(!l[0])return{kind:"addons"};const u=decodeURIComponent(l[0]);return n&&!n.addons?.some(d=>d.id===u)?null:{kind:"addon",id:u}}if(o==="gallery")return{kind:"gallery"};if(o==="fonts")return{kind:"fontLibrary"};if(o==="emails")return{kind:"emails",tab:eue(l[0])};if(o==="resources"&&l[0]){const u=decodeURIComponent(l[0]);return n&&!n.resources.some(d=>d.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 d=n.configs.find(h=>h.id===u);if(!d||o==="pages"&&d.section!=="page"||o==="config"&&d.section==="page")return null}return{kind:"config",id:u}}return null}function $r(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 UO(t,e){return t?t.kind==="overview"?e.metrics?t:$r(e):t.kind==="sync"?e.sync?.enabled?t:$r(e):t.kind==="audit"?e.audit?t:$r(e):t.kind==="addons"?e.addons?.length?t:$r(e):t.kind==="addon"?e.addons?.some(n=>n.id===t.id)?t:$r(e):t.kind==="gallery"?e.gallery?t:$r(e):t.kind==="fontLibrary"?e.fontLibrary?t:$r(e):t.kind==="emails"?e.emails?t:$r(e):t.kind==="resource"?e.resources.some(n=>n.id===t.id)?t:$r(e):t.kind==="config"&&e.configs.some(n=>n.id===t.id)?t:$r(e):$r(e)}function tue(t,e){return t===e?!0:!t||!e?t===e:t.kind!==e.kind?!1:t.kind==="overview"||t.kind==="gallery"||t.kind==="fontLibrary"||t.kind==="sync"||t.kind==="audit"||t.kind==="addons"?!0:t.kind==="addon"&&e.kind==="addon"?t.id===e.id: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 nue(t){const e=[],n=new Map;for(const r of t){const s=r.group.trim()||"Resources";n.has(s)||(n.set(s,[]),e.push(s)),n.get(s).push(r)}return e.map(r=>({label:r,items:n.get(r)}))}function Ww(t){try{return localStorage.getItem(t)}catch{return null}}function pm(t,e){try{localStorage.setItem(t,e)}catch{}}function WO(t){try{localStorage.removeItem(t)}catch{}}function qO({apiBase:t="/admin/api",basePath:e,title:n="Control plane",envStorageKey:r="vertebr:env",tokenStorageKey:s="vertebr:token",themeStorageKey:i="vertebr:theme",metricsRangeStorageKey:o="vertebr:metrics-range",getAccessToken:l,authUserLabel:u,onSignOut:d,brandLogoUrl:h,brandLogoUrlDark:m}){const y=e??Xce(t),{theme:b,setTheme:v}=f5(i),[x,k]=C.useState(()=>Ww(r)??""),[E,M]=C.useState(()=>Ww(s)??""),[_,N]=C.useState(E),T=C.useCallback(()=>x,[x]),A=C.useMemo(()=>Qw({apiBase:t,getEnvironment:T,getAccessToken:l??(()=>E||null)}),[t,T,l,E]),[j,P]=C.useState(null),[O,G]=C.useState(null),[B,W]=C.useState(()=>typeof window>"u"?{kind:"overview"}:Uw(window.location.pathname,y,null)??{kind:"overview"}),[K,Q]=C.useState(null),[ee,F]=C.useState(!1),[I,z]=C.useState(""),[J,X]=C.useState(null),[L,q]=C.useState(null),[ie,de]=C.useState(null),[Te,De]=C.useState(!1),[je,Ne]=C.useState(()=>m5(Ww(o))),[oe,ye]=C.useState(null),[Pe,Ye]=C.useState(!1),[Ke,ut]=C.useState(null),[Xe,Vt]=C.useState(!1),[un,qt]=C.useState(null),[kn,dn]=C.useState(!1),[In,Ln]=C.useState(null),[Yn,ht]=C.useState(null),[Bn,lr]=C.useState(!0),[vr,Pn]=C.useState(!1),[xe,$e]=C.useState(!1),$=C.useRef(!0),V=C.useCallback((we,Se,sn=!1)=>{if(typeof window>"u"||!we)return;const vn=Qce(y,we,Se);if(window.location.pathname===vn)return;const Ar=sn?"replaceState":"pushState";window.history[Ar](null,"",vn)},[y]);C.useEffect(()=>{let we=!1;return(async()=>{try{const Se=await A.getBootstrap();if(we)return;P(Se);const sn=Se.environments.map(Ar=>Ar.id),vn=x&&sn.includes(x)&&x||Se.defaultEnvironment;vn!==x&&(k(vn),pm(r,vn))}catch(Se){we||ht(Se instanceof Error?Se.message:"Failed to load bootstrap")}})(),()=>{we=!0}},[A,x,r]),C.useEffect(()=>{if(!j||!x)return;let we=!1;return(async()=>{try{lr(!0),ht(null);const Se=await A.getCatalog();if(we)return;G(Se);const sn=Uw(window.location.pathname,y,Se),vn=UO(sn??$r(Se),Se);$.current=!0,W(vn),V(vn,Se,!0)}catch(Se){we||(G(null),ht(Se instanceof Error?Se.message:"Failed to load catalog"))}finally{we||lr(!1)}})(),()=>{we=!0}},[A,j,x,y,V]),C.useEffect(()=>{if(!(!O||!B)){if($.current){$.current=!1;return}V(B,O,!1)}},[B,O,V]),C.useEffect(()=>{const we=Se=>{(Se.metaKey||Se.ctrlKey)&&Se.key.toLowerCase()==="k"&&(Se.preventDefault(),$e(!0))};return window.addEventListener("keydown",we),()=>window.removeEventListener("keydown",we)},[]),C.useEffect(()=>{const we=()=>{if(!O)return;const Se=Uw(window.location.pathname,y,O),sn=UO(Se??$r(O),O);$.current=!0,W(vn=>tue(vn,sn)?vn:sn)};return window.addEventListener("popstate",we),()=>window.removeEventListener("popstate",we)},[O,y]),C.useEffect(()=>{if(!B||!O)return;let we=!1;return(async()=>{try{if(ht(null),B.kind==="overview"){De(!0);const Se=await A.getMetrics({range:je});we||(de(Se),Q(null),q(null),ye(null),ut(null),qt(null))}else if(B.kind==="gallery"){Ye(!0);const Se=await A.getGallery();we||(ye(Se),Q(null),q(null),de(null),ut(null),qt(null))}else if(B.kind==="fontLibrary"){Vt(!0);const Se=await A.getFonts();we||(ut(Se),Q(null),q(null),de(null),ye(null),qt(null))}else if(B.kind==="emails"){dn(!0);const Se=await A.getEmails();we||(qt(Se),Q(null),q(null),de(null),ye(null),ut(null))}else if(B.kind==="resource"){F(!0);const Se=await A.listResource(B.id,{...I.trim()?{q:I.trim()}:{},...J?{sort:J.field,order:J.order}:{},fresh:!0});we||(Q(Se),q(null),de(null),ye(null),ut(null),qt(null))}else if(B.kind==="sync"||B.kind==="addons"||B.kind==="audit")we||(Q(null),q(null),de(null),ye(null),ut(null),qt(null));else if(B.kind==="config"||B.kind==="addon"){const Se=await A.getConfig(B.id);if(!we&&(q(Se),Q(null),de(null),ye(null),qt(null),O.fontLibrary)){Vt(!0);try{const sn=await A.getFonts();we||ut(sn)}finally{we||Vt(!1)}}}}catch(Se){we||ht(Se instanceof Error?Se.message:"Failed to load panel")}finally{we||(De(!1),Ye(!1),Vt(!1),dn(!1),F(!1))}})(),()=>{we=!0}},[A,B,O,x,je,I,J]);const U=B?.kind==="resource"?B.id:null;C.useEffect(()=>{z(""),X(null)},[U]);const ae=C.useCallback(async()=>{if(!O?.health){Ln(null);return}const we=await A.getHealth({fresh:!0});Ln(we.checks)},[A,O]);C.useEffect(()=>{if(!O?.health){Ln(null);return}let we=!1;return(async()=>{try{const Se=await A.getHealth({fresh:!0});we||Ln(Se.checks)}catch{we||Ln(null)}})(),()=>{we=!0}},[A,O?.health,x]);const ce=C.useCallback(async()=>{if(B?.kind!=="resource")return;const we=await A.listResource(B.id,{...I.trim()?{q:I.trim()}:{},...J?{sort:J.field,order:J.order}:{},fresh:!0});Q(we)},[A,B,I,J]),be=C.useCallback(async()=>{if(B?.kind!=="config"&&B?.kind!=="addon")return;const we=await A.getConfig(B.id,{fresh:!0});q(we)},[A,B]),Ce=C.useCallback(async()=>{De(!0);try{const we=await A.getMetrics({range:je,fresh:!0});de(we)}finally{De(!1)}},[A,je]),Ae=C.useCallback(we=>{Ne(we),pm(o,we)},[o]),ve=C.useCallback(async()=>{Ye(!0);try{const we=await A.getGallery({fresh:!0});ye(we)}finally{Ye(!1)}},[A]),Ie=C.useCallback(async()=>{Vt(!0);try{const we=await A.getFonts({fresh:!0});ut(we)}finally{Vt(!1)}},[A]),Re=C.useCallback(async()=>(await A.getFonts()).items,[A]),Qe=C.useCallback(async()=>{dn(!0);try{const we=await A.getEmails({fresh:!0});qt(we)}finally{dn(!1)}},[A]),gt=C.useCallback(async()=>(await A.getGallery()).items,[A]),Ze=C.useCallback(async we=>{const Se=[];for(const sn of we){const{item:vn}=await A.uploadGalleryFile(sn);Se.push(vn)}return Se},[A]),_r=O?.gallery?{galleryUpload:{accept:O.gallery.accept,maxBytes:O.gallery.maxBytes},onListGallery:gt,onUploadGallery:Ze}:{},Vr=O?.fontLibrary?{fonts:Ke?.items??[],fontsLoading:Xe,onListFonts:Re,onRefreshFonts:Ie}:{},wr=O?.environments??j?.environments??[],Kn=wr.find(we=>we.id===x),Zn=!!Kn?.auth?.required,So=Kn?.auth?.client?.provider==="custom"&&!!l,Va=B?.kind==="config"?O?.configs.find(we=>we.id===B.id):void 0,Rs=Va?.section==="page",Ha=!!Va?.previewPath,Ua=!!O?.sync?.enabled&&wf(O,"sync.run"),Wa=we=>{if(we===x)return;const Se=wr.find(sn=>sn.id===we);Se?.tone==="danger"&&!window.confirm(`Switch to ${Se.label}? Writes will affect this environment.`)||(pm(r,we),k(we),Q(null),z(""),q(null),ye(null),ut(null))},ko=()=>{const we=_.trim();M(we),we?pm(s,we):WO(s)},Hr=()=>{M(""),N(""),WO(s)},bn=C.useMemo(()=>{if(!O)return[];const we=[];O.metrics&&we.push({key:"overview",group:O.metrics.group??"Analytics",label:O.metrics.label,icon:$s({key:"overview",id:O.metrics.id,label:O.metrics.label,group:O.metrics.group,icon:O.metrics.icon}),active:B?.kind==="overview",onSelect:()=>W({kind:"overview"})}),O.audit&&we.push({key:"audit",group:O.audit.group??"Analytics",label:O.audit.label,icon:$s({key:"audit",id:O.audit.id,label:O.audit.label,group:O.audit.group,icon:O.audit.icon}),active:B?.kind==="audit",onSelect:()=>W({kind:"audit"})});for(const Se of O.resources)we.push({key:`resource:${Se.id}`,group:Se.group??"Resources",label:Se.label,icon:$s({key:`resource:${Se.id}`,id:Se.id,label:Se.label,group:Se.group,icon:Se.icon}),active:B?.kind==="resource"&&B.id===Se.id,onSelect:()=>W({kind:"resource",id:Se.id})});if(O.gallery&&we.push({key:"gallery",group:O.gallery.group??"Resources",label:O.gallery.label,icon:$s({key:"gallery",id:O.gallery.id,label:O.gallery.label,group:O.gallery.group,icon:O.gallery.icon}),active:B?.kind==="gallery",onSelect:()=>W({kind:"gallery"})}),O.fontLibrary&&we.push({key:"fonts",group:O.fontLibrary.group??"Resources",label:O.fontLibrary.label,icon:$s({key:"fonts",id:O.fontLibrary.id,label:O.fontLibrary.label,group:O.fontLibrary.group,icon:O.fontLibrary.icon}),active:B?.kind==="fontLibrary",onSelect:()=>W({kind:"fontLibrary"})}),O.emails){const Se=B?.kind==="emails"?B.tab??"compose":null;we.push({key:"emails",group:O.emails.group??"Growth",label:O.emails.label,icon:$s({key:"emails",id:O.emails.id,label:O.emails.label,group:O.emails.group,icon:O.emails.icon}),active:B?.kind==="emails",onSelect:()=>W({kind:"emails",tab:"compose"}),children:[{key:"emails:compose",label:"Compose",active:Se==="compose",onSelect:()=>W({kind:"emails",tab:"compose"})},{key:"emails:templates",label:"Templates",active:Se==="templates",onSelect:()=>W({kind:"emails",tab:"templates"})},{key:"emails:activity",label:"Activity",active:Se==="activity",onSelect:()=>W({kind:"emails",tab:"activity"})}]})}O.addons?.length&&we.push({key:"addons:overview",group:"Add-ons",label:"Browse add-ons",icon:$s({key:"addons:overview",id:"addons",label:"Browse add-ons",group:"Add-ons"}),active:B?.kind==="addons",onSelect:()=>W({kind:"addons"})});for(const Se of O.addons??[])we.push({key:`addon:${Se.id}`,group:Se.group??"Add-ons",label:Se.label,icon:$s({key:`addon:${Se.id}`,id:Se.id,label:Se.label,group:Se.group,category:Se.category,section:"addon",icon:Se.icon}),active:B?.kind==="addon"&&B.id===Se.id,onSelect:()=>W({kind:"addon",id:Se.id})});for(const Se of O.configs){const sn=Se.section==="page"?"Pages":"Config";we.push({key:`config:${Se.id}`,group:Se.group??sn,label:Se.label,icon:$s({key:`config:${Se.id}`,id:Se.id,label:Se.label,group:Se.group,section:Se.section==="page"?"page":"config",icon:Se.icon}),active:B?.kind==="config"&&B.id===Se.id,onSelect:()=>W({kind:"config",id:Se.id})})}return O.sync?.enabled&&wf(O,"sync.run")&&we.push({key:"sync",group:"Settings",label:"Sync environments",icon:$s({key:"sync",id:"sync",label:"Sync environments",group:"Settings"}),active:B?.kind==="sync",onSelect:()=>W({kind:"sync"})}),nue(we)},[O,B]);if(!j&&Bn)return p.jsx("div",{className:"vertebr-loading",children:"Loading Vertebr…"});if(Yn&&!j)return p.jsx("div",{className:"vertebr-error",children:Yn});const Cn=B?.kind==="overview"?O?.metrics?.label??"Overview":B?.kind==="sync"?"Sync environments":B?.kind==="audit"?O?.audit?.label??"Audit":B?.kind==="addons"?"Add-ons":B?.kind==="gallery"?O?.gallery?.label??"Gallery":B?.kind==="fontLibrary"?O?.fontLibrary?.label??"Font Library":B?.kind==="emails"?O?.emails?.label??"Emails":B?.kind==="resource"?O?.resources.find(we=>we.id===B.id)?.label:B?.kind==="config"?O?.configs.find(we=>we.id===B.id)?.label:B?.kind==="addon"?O?.addons?.find(we=>we.id===B.id)?.label:null,us=B?.kind==="addons"?"Preview how optional storefront features look in your shop, then configure each one.":B?.kind==="addon"?O?.addons?.find(we=>we.id===B.id)?.description:void 0;return p.jsx(y6,{children:p.jsx(b6,{children:p.jsxs("div",{className:"vertebr-root","data-env":x,"data-sidebar-collapsed":vr||void 0,children:[p.jsx(Yce,{brand:j?.brand??O?.brand??"Vertebr",brandLogoUrl:h,brandLogoUrlDark:m,hostName:j?.appearance?.hostName??O?.appearance?.hostName,hostLogoUrl:j?.appearance?.hostLogoUrl??O?.appearance?.hostLogoUrl,envList:wr,environment:x,onEnvironmentChange:Wa,authUserLabel:u,onSignOut:d,getAccessToken:l,authViaTokenOnly:So,authRequired:Zn,token:E,tokenDraft:_,onTokenDraftChange:N,onSaveToken:ko,onClearToken:Hr,theme:b,onThemeChange:v,sidebarCollapsed:vr,onToggleSidebar:()=>Pn(we=>!we),syncEnabled:Ua,onOpenSync:()=>W({kind:"sync"}),onOpenSearch:()=>$e(!0),healthChecks:In,onRefreshHealth:O?.health?ae:void 0}),O&&xe?p.jsx(q5,{catalog:O,onClose:()=>$e(!1),onSelect:W}):null,p.jsx($ce,{navGroups:bn,collapsed:vr}),p.jsxs("main",{className:"vertebr-main",children:[p.jsx(Dce,{activeLabel:Cn??(O?"Dashboard":"Sign in"),catalogLoaded:!!O,authRequired:Zn,selection:B,isPageSelection:Rs,hasPagePreview:Ha,selectionDescription:us,error:Yn,breadcrumbs:Kce(B,O)}),p.jsx(Oce,{client:A,catalog:O,selection:B,onSelectionChange:W,authRequired:Zn,loading:Bn,isPageSelection:Rs,metricsData:ie,metricsLoading:Te,metricsRange:je,onMetricsRangeChange:Ae,onRefreshMetrics:Ce,galleryData:oe,galleryLoading:Pe,onRefreshGallery:ve,fontLibraryData:Ke,fontLibraryLoading:Xe,onRefreshFonts:Ie,emailsData:un,emailsLoading:kn,onRefreshEmails:Qe,resourceData:K,resourceLoading:ee,resourceSearch:I,onResourceSearchChange:z,resourceSort:J,onResourceSortChange:X,onRefreshResource:ce,configData:L,onConfigSaved:q,onRefreshConfig:be,galleryPicker:_r,fontLibraryPicker:Vr}),p.jsx(Ice,{})]}),p.jsx(zce,{})]})})})}C.createContext(null);C.createContext(null);const mm="/admin/api",GO="/admin/brand/vertebr-mark.svg",jS="/admin/brand/vertebr-mark-light.svg";function YO({subtitle:t}){return p.jsxs("div",{className:"vertebr-brand",children:[p.jsx("img",{className:"vertebr-brand-mark",src:jS,alt:"Vertebr",width:40,height:40}),p.jsx("span",{children:t})]})}function rue(t){const e=t.environments.map(r=>r.auth?.client).find(r=>r?.provider==="firebase");if(!e||e.provider!=="firebase")return null;const n=_V().length?cj():lj(e.config);return JU(n)}function sue(t){return t.environments.some(e=>e.auth?.client?.provider==="custom")}function iue(){const[t,e]=C.useState(null),[n,r]=C.useState(null),[s,i]=C.useState(null),[o,l]=C.useState(!1),[u,d]=C.useState("idle"),[h,m]=C.useState(""),[y,b]=C.useState(""),[v,x]=C.useState(null),[k,E]=C.useState(!1),M=C.useMemo(()=>Qw({apiBase:mm,getEnvironment:()=>""}),[]);C.useEffect(()=>{let A=!1;return M.getBootstrap().then(j=>{if(A)return;e(j);const P=rue(j);r(P),P||l(!0)}).catch(j=>{A||(x(j instanceof Error?j.message:"Could not load auth"),l(!0))}),()=>{A=!0}},[M]),C.useEffect(()=>{if(n)return FH(n,A=>{i(A),d(A?"checking":"idle"),l(!0)})},[n]),C.useEffect(()=>{if(!t||!s)return;let A=!1;return(async()=>{d("checking");const j=localStorage.getItem("vertebr:env"),P=[...j?[j]:[],...t.environments.map(O=>O.id)].filter((O,G,B)=>B.indexOf(O)===G);for(const O of P)try{await Qw({apiBase:mm,getEnvironment:()=>O,getAccessToken:()=>s.getIdToken()}).getCatalog(),A||(localStorage.setItem("vertebr:env",O),d("allowed"));return}catch{}A||d("denied")})(),()=>{A=!0}},[t,s]);const _=t?.environments.map(A=>A.auth?.client).find(A=>A?.provider==="firebase")?.methods??["email"],N=async A=>{if(A.preventDefault(),!!n){E(!0),x(null);try{await $H(n,h.trim(),y)}catch(j){x(j instanceof Error?j.message:"Sign-in failed")}finally{E(!1)}}},T=async()=>{if(n){E(!0),x(null);try{await aU(n,new Xi)}catch(A){x(A instanceof Error?A.message:"Sign-in failed")}finally{E(!1)}}};return o?t?!n&&sue(t)?p.jsx(qO,{apiBase:mm,title:"Owner control plane",brandLogoUrl:GO,brandLogoUrlDark:jS}):n?s?u==="checking"||u==="idle"?p.jsx("div",{className:"vertebr-loading",children:"Checking admin access…"}):u==="denied"?p.jsx("main",{className:"vertebr-login",children:p.jsxs("section",{className:"vertebr-login-card",children:[p.jsx(YO,{subtitle:"Access denied"}),p.jsxs("div",{children:[p.jsx("h1",{children:"Administrator access required"}),p.jsxs("p",{children:["Signed in as ",s.email??s.uid,", but this account is not approved for any Vertebr environment."]})]}),p.jsx("button",{className:"vertebr-btn",type:"button",onClick:()=>{NM(n)},children:"Sign out"})]})}):p.jsx(qO,{apiBase:mm,title:"Owner control plane",brandLogoUrl:GO,brandLogoUrlDark:jS,getAccessToken:()=>s.getIdToken(),authUserLabel:s.email??s.uid,onSignOut:()=>NM(n)}):p.jsx("main",{className:"vertebr-login",children:p.jsxs("section",{className:"vertebr-login-card",children:[p.jsx(YO,{subtitle:"Admin access"}),p.jsxs("div",{children:[p.jsx("h1",{children:"Sign in"}),p.jsx("p",{children:"Use an approved administrator account. Storefront accounts do not receive dashboard access."})]}),_.includes("email")?p.jsxs("form",{className:"vertebr-login-form",onSubmit:N,children:[p.jsxs("label",{className:"vertebr-field",children:[p.jsx("span",{children:"Email"}),p.jsx("input",{type:"email",autoComplete:"username",required:!0,value:h,onChange:A=>m(A.target.value)})]}),p.jsxs("label",{className:"vertebr-field",children:[p.jsx("span",{children:"Password"}),p.jsx("input",{type:"password",autoComplete:"current-password",required:!0,value:y,onChange:A=>b(A.target.value)})]}),p.jsx("button",{className:"vertebr-btn vertebr-btn-primary",type:"submit",disabled:k,children:k?"Signing in…":"Sign in"})]}):null,_.includes("google")?p.jsx("button",{className:"vertebr-btn",type:"button",disabled:k,onClick:()=>{T()},children:"Continue with Google"}):null,v?p.jsx("p",{className:"vertebr-status","data-tone":"danger",children:v}):null]})}):p.jsx("div",{className:"vertebr-error",children:v??"No browser auth provider is configured."}):p.jsx("div",{className:"vertebr-error",children:v??"Could not load admin bootstrap."}):p.jsx("div",{className:"vertebr-loading",children:"Checking admin session…"})}aF.createRoot(document.getElementById("root")).render(p.jsx(C.StrictMode,{children:p.jsx(iue,{})}));