@vertebr/admin 0.3.0 → 0.5.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.
- package/dist/api/catalog.d.ts +59 -0
- package/dist/api/catalog.d.ts.map +1 -0
- package/dist/api/catalog.js +85 -0
- package/dist/api/catalog.js.map +1 -0
- package/dist/api/configs.d.ts +15 -0
- package/dist/api/configs.d.ts.map +1 -0
- package/dist/api/configs.js +43 -0
- package/dist/api/configs.js.map +1 -0
- package/dist/api/emails.d.ts +85 -0
- package/dist/api/emails.d.ts.map +1 -0
- package/dist/api/emails.js +520 -0
- package/dist/api/emails.js.map +1 -0
- package/dist/api/gallery.d.ts +28 -0
- package/dist/api/gallery.d.ts.map +1 -0
- package/dist/api/gallery.js +91 -0
- package/dist/api/gallery.js.map +1 -0
- package/dist/api/metrics.d.ts +22 -0
- package/dist/api/metrics.d.ts.map +1 -0
- package/dist/api/metrics.js +38 -0
- package/dist/api/metrics.js.map +1 -0
- package/dist/api/public.d.ts +22 -0
- package/dist/api/public.d.ts.map +1 -0
- package/dist/api/public.js +69 -0
- package/dist/api/public.js.map +1 -0
- package/dist/api/request.d.ts +26 -0
- package/dist/api/request.d.ts.map +1 -0
- package/dist/api/request.js +38 -0
- package/dist/api/request.js.map +1 -0
- package/dist/api/resources.d.ts +85 -0
- package/dist/api/resources.d.ts.map +1 -0
- package/dist/api/resources.js +263 -0
- package/dist/api/resources.js.map +1 -0
- package/dist/api/routes.d.ts +8 -0
- package/dist/api/routes.d.ts.map +1 -0
- package/dist/api/routes.js +202 -0
- package/dist/api/routes.js.map +1 -0
- package/dist/api/spa.d.ts +2 -0
- package/dist/api/spa.d.ts.map +1 -0
- package/dist/api/spa.js +34 -0
- package/dist/api/spa.js.map +1 -0
- package/dist/connectors/payments/connector.d.ts +30 -0
- package/dist/connectors/payments/connector.d.ts.map +1 -0
- package/dist/connectors/payments/connector.js +226 -0
- package/dist/connectors/payments/connector.js.map +1 -0
- package/dist/connectors/payments/index.d.ts +4 -0
- package/dist/connectors/payments/index.d.ts.map +1 -0
- package/dist/connectors/payments/index.js +10 -0
- package/dist/connectors/payments/index.js.map +1 -0
- package/dist/connectors/payments/stripe.d.ts +99 -0
- package/dist/connectors/payments/stripe.d.ts.map +1 -0
- package/dist/connectors/payments/stripe.js +189 -0
- package/dist/connectors/payments/stripe.js.map +1 -0
- package/dist/connectors/payments/types.d.ts +67 -0
- package/dist/connectors/payments/types.d.ts.map +1 -0
- package/dist/connectors/payments/types.js +16 -0
- package/dist/connectors/payments/types.js.map +1 -0
- package/dist/connectors/stripe.d.ts +19 -0
- package/dist/connectors/stripe.d.ts.map +1 -0
- package/dist/connectors/stripe.js +26 -0
- package/dist/connectors/stripe.js.map +1 -0
- package/dist/constants.d.ts +5 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +8 -0
- package/dist/constants.js.map +1 -0
- package/dist/createAdmin.d.ts +3 -0
- package/dist/createAdmin.d.ts.map +1 -0
- package/dist/createAdmin.js +152 -0
- package/dist/createAdmin.js.map +1 -0
- package/dist/database/connector.d.ts +1 -1
- package/dist/database/connector.d.ts.map +1 -1
- package/dist/database/connector.js +43 -6
- package/dist/database/connector.js.map +1 -1
- package/dist/database/types.d.ts +25 -5
- package/dist/database/types.d.ts.map +1 -1
- package/dist/errors.d.ts +17 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +36 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +9 -229
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -889
- package/dist/index.js.map +1 -1
- package/dist/mail.d.ts +23 -0
- package/dist/mail.d.ts.map +1 -0
- package/dist/mail.js +248 -0
- package/dist/mail.js.map +1 -0
- package/dist/schema.d.ts +8 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/services/environment.d.ts +8 -0
- package/dist/services/environment.d.ts.map +1 -0
- package/dist/services/environment.js +78 -0
- package/dist/services/environment.js.map +1 -0
- package/dist/services/registry.d.ts +6 -0
- package/dist/services/registry.d.ts.map +1 -0
- package/dist/services/registry.js +32 -0
- package/dist/services/registry.js.map +1 -0
- package/dist/services/state.d.ts +25 -0
- package/dist/services/state.d.ts.map +1 -0
- package/dist/services/state.js +3 -0
- package/dist/services/state.js.map +1 -0
- package/dist/types/actions.d.ts +15 -0
- package/dist/types/actions.d.ts.map +1 -0
- package/dist/types/actions.js +3 -0
- package/dist/types/actions.js.map +1 -0
- package/dist/types/admin.d.ts +83 -0
- package/dist/types/admin.d.ts.map +1 -0
- package/dist/types/admin.js +3 -0
- package/dist/types/admin.js.map +1 -0
- package/dist/types/auth.d.ts +67 -0
- package/dist/types/auth.d.ts.map +1 -0
- package/dist/types/auth.js +3 -0
- package/dist/types/auth.js.map +1 -0
- package/dist/types/config.d.ts +39 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +3 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/layout.d.ts +29 -0
- package/dist/types/layout.d.ts.map +1 -0
- package/dist/types/layout.js +3 -0
- package/dist/types/layout.js.map +1 -0
- package/dist/types/mail/catalog.d.ts +104 -0
- package/dist/types/mail/catalog.d.ts.map +1 -0
- package/dist/types/mail/catalog.js +3 -0
- package/dist/types/mail/catalog.js.map +1 -0
- package/dist/types/mail/definition.d.ts +68 -0
- package/dist/types/mail/definition.d.ts.map +1 -0
- package/dist/types/mail/definition.js +3 -0
- package/dist/types/mail/definition.js.map +1 -0
- package/dist/types/mail/index.d.ts +4 -0
- package/dist/types/mail/index.d.ts.map +1 -0
- package/dist/types/mail/index.js +3 -0
- package/dist/types/mail/index.js.map +1 -0
- package/dist/types/mail/message.d.ts +45 -0
- package/dist/types/mail/message.d.ts.map +1 -0
- package/dist/types/mail/message.js +3 -0
- package/dist/types/mail/message.js.map +1 -0
- package/dist/types/metrics.d.ts +46 -0
- package/dist/types/metrics.d.ts.map +1 -0
- package/dist/types/metrics.js +3 -0
- package/dist/types/metrics.js.map +1 -0
- package/dist/types/resource.d.ts +41 -0
- package/dist/types/resource.d.ts.map +1 -0
- package/dist/types/resource.js +3 -0
- package/dist/types/resource.js.map +1 -0
- package/dist/utils/auth.d.ts +4 -0
- package/dist/utils/auth.d.ts.map +1 -0
- package/dist/utils/auth.js +29 -0
- package/dist/utils/auth.js.map +1 -0
- package/dist/utils/config.d.ts +4 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +14 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/http.d.ts +7 -0
- package/dist/utils/http.d.ts.map +1 -0
- package/dist/utils/http.js +61 -0
- package/dist/utils/http.js.map +1 -0
- package/dist/utils/metricsRange.d.ts +34 -0
- package/dist/utils/metricsRange.d.ts.map +1 -0
- package/dist/utils/metricsRange.js +121 -0
- package/dist/utils/metricsRange.js.map +1 -0
- package/dist/utils/sidebar.d.ts +2 -0
- package/dist/utils/sidebar.d.ts.map +1 -0
- package/dist/utils/sidebar.js +8 -0
- package/dist/utils/sidebar.js.map +1 -0
- package/dist/utils/staticDir.d.ts +2 -0
- package/dist/utils/staticDir.d.ts.map +1 -0
- package/dist/utils/staticDir.js +16 -0
- package/dist/utils/staticDir.js.map +1 -0
- package/dist/utils/uploads.d.ts +6 -0
- package/dist/utils/uploads.d.ts.map +1 -0
- package/dist/utils/uploads.js +66 -0
- package/dist/utils/uploads.js.map +1 -0
- package/package.json +1 -1
- package/static/assets/index-DKyVvFeT.js +332 -0
- package/static/assets/index-DUwFg1bw.css +1 -0
- package/static/index.html +2 -2
- package/static/assets/index-BpfDn_4i.css +0 -1
- package/static/assets/index-DAjD2ShU.js +0 -329
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
var fE=t=>{throw TypeError(t)};var hE=(t,e,n)=>e.has(t)||fE("Cannot "+n);var Dn=(t,e,n)=>(hE(t,e,"read from private field"),n?n.call(t):e.get(t)),pE=(t,e,n)=>e.has(t)?fE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),pv=(t,e,n,r)=>(hE(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);function SP(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function AR(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var mv={exports:{}},hu={};var mE;function wP(){if(mE)return hu;mE=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,s){var a=null;if(s!==void 0&&(a=""+s),i.key!==void 0&&(a=""+i.key),"key"in i){s={};for(var c in i)c!=="key"&&(s[c]=i[c])}else s=i;return i=s.ref,{$$typeof:t,type:r,key:a,ref:i!==void 0?i:null,props:s}}return hu.Fragment=e,hu.jsx=n,hu.jsxs=n,hu}var gE;function xP(){return gE||(gE=1,mv.exports=wP()),mv.exports}var E=xP(),gv={exports:{}},Ue={};var yE;function kP(){if(yE)return Ue;yE=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),g=Symbol.iterator;function y(z){return z===null||typeof z!="object"?null:(z=g&&z[g]||z["@@iterator"],typeof z=="function"?z:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,x={};function k(z,K,le){this.props=z,this.context=K,this.refs=x,this.updater=le||b}k.prototype.isReactComponent={},k.prototype.setState=function(z,K){if(typeof z!="object"&&typeof z!="function"&&z!=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,z,K,"setState")},k.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function T(){}T.prototype=k.prototype;function A(z,K,le){this.props=z,this.context=K,this.refs=x,this.updater=le||b}var _=A.prototype=new T;_.constructor=A,w(_,k.prototype),_.isPureReactComponent=!0;var O=Array.isArray;function N(){}var I={H:null,A:null,T:null,S:null},j=Object.prototype.hasOwnProperty;function G(z,K,le){var ve=le.ref;return{$$typeof:t,type:z,key:K,ref:ve!==void 0?ve:null,props:le}}function Y(z,K){return G(z.type,K,z.props)}function ce(z){return typeof z=="object"&&z!==null&&z.$$typeof===t}function X(z){var K={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(le){return K[le]})}var te=/\/+/g;function ie(z,K){return typeof z=="object"&&z!==null&&z.key!=null?X(""+z.key):K.toString(36)}function he(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(N,N):(z.status="pending",z.then(function(K){z.status==="pending"&&(z.status="fulfilled",z.value=K)},function(K){z.status==="pending"&&(z.status="rejected",z.reason=K)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function B(z,K,le,ve,Ae){var de=typeof z;(de==="undefined"||de==="boolean")&&(z=null);var pe=!1;if(z===null)pe=!0;else switch(de){case"bigint":case"string":case"number":pe=!0;break;case"object":switch(z.$$typeof){case t:case e:pe=!0;break;case p:return pe=z._init,B(pe(z._payload),K,le,ve,Ae)}}if(pe)return Ae=Ae(z),pe=ve===""?"."+ie(z,0):ve,O(Ae)?(le="",pe!=null&&(le=pe.replace(te,"$&/")+"/"),B(Ae,K,le,"",function(it){return it})):Ae!=null&&(ce(Ae)&&(Ae=Y(Ae,le+(Ae.key==null||z&&z.key===Ae.key?"":(""+Ae.key).replace(te,"$&/")+"/")+pe)),K.push(Ae)),1;pe=0;var me=ve===""?".":ve+":";if(O(z))for(var Ee=0;Ee<z.length;Ee++)ve=z[Ee],de=me+ie(ve,Ee),pe+=B(ve,K,le,de,Ae);else if(Ee=y(z),typeof Ee=="function")for(z=Ee.call(z),Ee=0;!(ve=z.next()).done;)ve=ve.value,de=me+ie(ve,Ee++),pe+=B(ve,K,le,de,Ae);else if(de==="object"){if(typeof z.then=="function")return B(he(z),K,le,ve,Ae);throw K=String(z),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return pe}function Z(z,K,le){if(z==null)return z;var ve=[],Ae=0;return B(z,ve,"","",function(de){return K.call(le,de,Ae++)}),ve}function se(z){if(z._status===-1){var K=z._result;K=K(),K.then(function(le){(z._status===0||z._status===-1)&&(z._status=1,z._result=le)},function(le){(z._status===0||z._status===-1)&&(z._status=2,z._result=le)}),z._status===-1&&(z._status=0,z._result=K)}if(z._status===1)return z._result.default;throw z._result}var Se=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)},Ce={map:Z,forEach:function(z,K,le){Z(z,function(){K.apply(this,arguments)},le)},count:function(z){var K=0;return Z(z,function(){K++}),K},toArray:function(z){return Z(z,function(K){return K})||[]},only:function(z){if(!ce(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return Ue.Activity=m,Ue.Children=Ce,Ue.Component=k,Ue.Fragment=n,Ue.Profiler=i,Ue.PureComponent=A,Ue.StrictMode=r,Ue.Suspense=u,Ue.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,Ue.__COMPILER_RUNTIME={__proto__:null,c:function(z){return I.H.useMemoCache(z)}},Ue.cache=function(z){return function(){return z.apply(null,arguments)}},Ue.cacheSignal=function(){return null},Ue.cloneElement=function(z,K,le){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var ve=w({},z.props),Ae=z.key;if(K!=null)for(de in K.key!==void 0&&(Ae=""+K.key),K)!j.call(K,de)||de==="key"||de==="__self"||de==="__source"||de==="ref"&&K.ref===void 0||(ve[de]=K[de]);var de=arguments.length-2;if(de===1)ve.children=le;else if(1<de){for(var pe=Array(de),me=0;me<de;me++)pe[me]=arguments[me+2];ve.children=pe}return G(z.type,Ae,ve)},Ue.createContext=function(z){return z={$$typeof:a,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:s,_context:z},z},Ue.createElement=function(z,K,le){var ve,Ae={},de=null;if(K!=null)for(ve in K.key!==void 0&&(de=""+K.key),K)j.call(K,ve)&&ve!=="key"&&ve!=="__self"&&ve!=="__source"&&(Ae[ve]=K[ve]);var pe=arguments.length-2;if(pe===1)Ae.children=le;else if(1<pe){for(var me=Array(pe),Ee=0;Ee<pe;Ee++)me[Ee]=arguments[Ee+2];Ae.children=me}if(z&&z.defaultProps)for(ve in pe=z.defaultProps,pe)Ae[ve]===void 0&&(Ae[ve]=pe[ve]);return G(z,de,Ae)},Ue.createRef=function(){return{current:null}},Ue.forwardRef=function(z){return{$$typeof:c,render:z}},Ue.isValidElement=ce,Ue.lazy=function(z){return{$$typeof:p,_payload:{_status:-1,_result:z},_init:se}},Ue.memo=function(z,K){return{$$typeof:f,type:z,compare:K===void 0?null:K}},Ue.startTransition=function(z){var K=I.T,le={};I.T=le;try{var ve=z(),Ae=I.S;Ae!==null&&Ae(le,ve),typeof ve=="object"&&ve!==null&&typeof ve.then=="function"&&ve.then(N,Se)}catch(de){Se(de)}finally{K!==null&&le.types!==null&&(K.types=le.types),I.T=K}},Ue.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},Ue.use=function(z){return I.H.use(z)},Ue.useActionState=function(z,K,le){return I.H.useActionState(z,K,le)},Ue.useCallback=function(z,K){return I.H.useCallback(z,K)},Ue.useContext=function(z){return I.H.useContext(z)},Ue.useDebugValue=function(){},Ue.useDeferredValue=function(z,K){return I.H.useDeferredValue(z,K)},Ue.useEffect=function(z,K){return I.H.useEffect(z,K)},Ue.useEffectEvent=function(z){return I.H.useEffectEvent(z)},Ue.useId=function(){return I.H.useId()},Ue.useImperativeHandle=function(z,K,le){return I.H.useImperativeHandle(z,K,le)},Ue.useInsertionEffect=function(z,K){return I.H.useInsertionEffect(z,K)},Ue.useLayoutEffect=function(z,K){return I.H.useLayoutEffect(z,K)},Ue.useMemo=function(z,K){return I.H.useMemo(z,K)},Ue.useOptimistic=function(z,K){return I.H.useOptimistic(z,K)},Ue.useReducer=function(z,K,le){return I.H.useReducer(z,K,le)},Ue.useRef=function(z){return I.H.useRef(z)},Ue.useState=function(z){return I.H.useState(z)},Ue.useSyncExternalStore=function(z,K,le){return I.H.useSyncExternalStore(z,K,le)},Ue.useTransition=function(){return I.H.useTransition()},Ue.version="19.2.8",Ue}var vE;function xd(){return vE||(vE=1,gv.exports=kP()),gv.exports}var R=xd();const je=AR(R),kd=SP({__proto__:null,default:je},[R]);var yv={exports:{}},pu={},vv={exports:{}},bv={};var bE;function CP(){return bE||(bE=1,(function(t){function e(B,Z){var se=B.length;B.push(Z);e:for(;0<se;){var Se=se-1>>>1,Ce=B[Se];if(0<i(Ce,Z))B[Se]=Z,B[se]=Ce,se=Se;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var Z=B[0],se=B.pop();if(se!==Z){B[0]=se;e:for(var Se=0,Ce=B.length,z=Ce>>>1;Se<z;){var K=2*(Se+1)-1,le=B[K],ve=K+1,Ae=B[ve];if(0>i(le,se))ve<Ce&&0>i(Ae,le)?(B[Se]=Ae,B[ve]=se,Se=ve):(B[Se]=le,B[K]=se,Se=K);else if(ve<Ce&&0>i(Ae,se))B[Se]=Ae,B[ve]=se,Se=ve;else break e}}return Z}function i(B,Z){var se=B.sortIndex-Z.sortIndex;return se!==0?se:B.id-Z.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,c=a.now();t.unstable_now=function(){return a.now()-c}}var u=[],f=[],p=1,m=null,g=3,y=!1,b=!1,w=!1,x=!1,k=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function _(B){for(var Z=n(f);Z!==null;){if(Z.callback===null)r(f);else if(Z.startTime<=B)r(f),Z.sortIndex=Z.expirationTime,e(u,Z);else break;Z=n(f)}}function O(B){if(w=!1,_(B),!b)if(n(u)!==null)b=!0,N||(N=!0,X());else{var Z=n(f);Z!==null&&he(O,Z.startTime-B)}}var N=!1,I=-1,j=5,G=-1;function Y(){return x?!0:!(t.unstable_now()-G<j)}function ce(){if(x=!1,N){var B=t.unstable_now();G=B;var Z=!0;try{e:{b=!1,w&&(w=!1,T(I),I=-1),y=!0;var se=g;try{t:{for(_(B),m=n(u);m!==null&&!(m.expirationTime>B&&Y());){var Se=m.callback;if(typeof Se=="function"){m.callback=null,g=m.priorityLevel;var Ce=Se(m.expirationTime<=B);if(B=t.unstable_now(),typeof Ce=="function"){m.callback=Ce,_(B),Z=!0;break t}m===n(u)&&r(u),_(B)}else r(u);m=n(u)}if(m!==null)Z=!0;else{var z=n(f);z!==null&&he(O,z.startTime-B),Z=!1}}break e}finally{m=null,g=se,y=!1}Z=void 0}}finally{Z?X():N=!1}}}var X;if(typeof A=="function")X=function(){A(ce)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,ie=te.port2;te.port1.onmessage=ce,X=function(){ie.postMessage(null)}}else X=function(){k(ce,0)};function he(B,Z){I=k(function(){B(t.unstable_now())},Z)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(B){B.callback=null},t.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<B?Math.floor(1e3/B):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_next=function(B){switch(g){case 1:case 2:case 3:var Z=3;break;default:Z=g}var se=g;g=Z;try{return B()}finally{g=se}},t.unstable_requestPaint=function(){x=!0},t.unstable_runWithPriority=function(B,Z){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var se=g;g=B;try{return Z()}finally{g=se}},t.unstable_scheduleCallback=function(B,Z,se){var Se=t.unstable_now();switch(typeof se=="object"&&se!==null?(se=se.delay,se=typeof se=="number"&&0<se?Se+se:Se):se=Se,B){case 1:var Ce=-1;break;case 2:Ce=250;break;case 5:Ce=1073741823;break;case 4:Ce=1e4;break;default:Ce=5e3}return Ce=se+Ce,B={id:p++,callback:Z,priorityLevel:B,startTime:se,expirationTime:Ce,sortIndex:-1},se>Se?(B.sortIndex=se,e(f,B),n(u)===null&&B===n(f)&&(w?(T(I),I=-1):w=!0,he(O,se-Se))):(B.sortIndex=Ce,e(u,B),b||y||(b=!0,N||(N=!0,X()))),B},t.unstable_shouldYield=Y,t.unstable_wrapCallback=function(B){var Z=g;return function(){var se=g;g=Z;try{return B.apply(this,arguments)}finally{g=se}}}})(bv)),bv}var SE;function EP(){return SE||(SE=1,vv.exports=CP()),vv.exports}var Sv={exports:{}},In={};var wE;function TP(){if(wE)return In;wE=1;var t=xd();function e(u){var f="https://react.dev/errors/"+u;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)f+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+u+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(u,f,p){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:m==null?null:""+m,children:u,containerInfo:f,implementation:p}}var a=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(u,f){if(u==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return In.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,In.createPortal=function(u,f){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(e(299));return s(u,f,null,p)},In.flushSync=function(u){var f=a.T,p=r.p;try{if(a.T=null,r.p=2,u)return u()}finally{a.T=f,r.p=p,r.d.f()}},In.preconnect=function(u,f){typeof u=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,r.d.C(u,f))},In.prefetchDNS=function(u){typeof u=="string"&&r.d.D(u)},In.preinit=function(u,f){if(typeof u=="string"&&f&&typeof f.as=="string"){var p=f.as,m=c(p,f.crossOrigin),g=typeof f.integrity=="string"?f.integrity:void 0,y=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;p==="style"?r.d.S(u,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:m,integrity:g,fetchPriority:y}):p==="script"&&r.d.X(u,{crossOrigin:m,integrity:g,fetchPriority:y,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},In.preinitModule=function(u,f){if(typeof u=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var p=c(f.as,f.crossOrigin);r.d.M(u,{crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&r.d.M(u)},In.preload=function(u,f){if(typeof u=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var p=f.as,m=c(p,f.crossOrigin);r.d.L(u,p,{crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},In.preloadModule=function(u,f){if(typeof u=="string")if(f){var p=c(f.as,f.crossOrigin);r.d.m(u,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else r.d.m(u)},In.requestFormReset=function(u){r.d.r(u)},In.unstable_batchedUpdates=function(u,f){return u(f)},In.useFormState=function(u,f,p){return a.H.useFormState(u,f,p)},In.useFormStatus=function(){return a.H.useHostTransitionStatus()},In.version="19.2.8",In}var xE;function RR(){if(xE)return Sv.exports;xE=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Sv.exports=TP(),Sv.exports}var kE;function _P(){if(kE)return pu;kE=1;var t=EP(),e=xd(),n=RR();function r(o){var l="https://react.dev/errors/"+o;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)l+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+o+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function s(o){var l=o,d=o;if(o.alternate)for(;l.return;)l=l.return;else{o=l;do l=o,(l.flags&4098)!==0&&(d=l.return),o=l.return;while(o)}return l.tag===3?d:null}function a(o){if(o.tag===13){var l=o.memoizedState;if(l===null&&(o=o.alternate,o!==null&&(l=o.memoizedState)),l!==null)return l.dehydrated}return null}function c(o){if(o.tag===31){var l=o.memoizedState;if(l===null&&(o=o.alternate,o!==null&&(l=o.memoizedState)),l!==null)return l.dehydrated}return null}function u(o){if(s(o)!==o)throw Error(r(188))}function f(o){var l=o.alternate;if(!l){if(l=s(o),l===null)throw Error(r(188));return l!==o?null:o}for(var d=o,h=l;;){var v=d.return;if(v===null)break;var S=v.alternate;if(S===null){if(h=v.return,h!==null){d=h;continue}break}if(v.child===S.child){for(S=v.child;S;){if(S===d)return u(v),o;if(S===h)return u(v),l;S=S.sibling}throw Error(r(188))}if(d.return!==h.return)d=v,h=S;else{for(var C=!1,M=v.child;M;){if(M===d){C=!0,d=v,h=S;break}if(M===h){C=!0,h=v,d=S;break}M=M.sibling}if(!C){for(M=S.child;M;){if(M===d){C=!0,d=S,h=v;break}if(M===h){C=!0,h=S,d=v;break}M=M.sibling}if(!C)throw Error(r(189))}}if(d.alternate!==h)throw Error(r(190))}if(d.tag!==3)throw Error(r(188));return d.stateNode.current===d?o:l}function p(o){var l=o.tag;if(l===5||l===26||l===27||l===6)return o;for(o=o.child;o!==null;){if(l=p(o),l!==null)return l;o=o.sibling}return null}var m=Object.assign,g=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),A=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),Y=Symbol.for("react.memo_cache_sentinel"),ce=Symbol.iterator;function X(o){return o===null||typeof o!="object"?null:(o=ce&&o[ce]||o["@@iterator"],typeof o=="function"?o:null)}var te=Symbol.for("react.client.reference");function ie(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===te?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case w:return"Fragment";case k:return"Profiler";case x:return"StrictMode";case O:return"Suspense";case N:return"SuspenseList";case G:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case b:return"Portal";case A:return o.displayName||"Context";case T:return(o._context.displayName||"Context")+".Consumer";case _:var l=o.render;return o=o.displayName,o||(o=l.displayName||l.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case I:return l=o.displayName||null,l!==null?l:ie(o.type)||"Memo";case j:l=o._payload,o=o._init;try{return ie(o(l))}catch{}}return null}var he=Array.isArray,B=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pending:!1,data:null,method:null,action:null},Se=[],Ce=-1;function z(o){return{current:o}}function K(o){0>Ce||(o.current=Se[Ce],Se[Ce]=null,Ce--)}function le(o,l){Ce++,Se[Ce]=o.current,o.current=l}var ve=z(null),Ae=z(null),de=z(null),pe=z(null);function me(o,l){switch(le(de,l),le(Ae,o),le(ve,null),l.nodeType){case 9:case 11:o=(o=l.documentElement)&&(o=o.namespaceURI)?L1(o):0;break;default:if(o=l.tagName,l=l.namespaceURI)l=L1(l),o=z1(l,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}K(ve),le(ve,o)}function Ee(){K(ve),K(Ae),K(de)}function it(o){o.memoizedState!==null&&le(pe,o);var l=ve.current,d=z1(l,o.type);l!==d&&(le(Ae,o),le(ve,d))}function Ke(o){Ae.current===o&&(K(ve),K(Ae)),pe.current===o&&(K(pe),cu._currentValue=se)}var Qe,pt;function $t(o){if(Qe===void 0)try{throw Error()}catch(d){var l=d.stack.trim().match(/\n( *(at )?)/);Qe=l&&l[1]||"",pt=-1<d.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+Qe+o+pt}var Wt=!1;function Hr(o,l){if(!o||Wt)return"";Wt=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(l){var ee=function(){throw Error()};if(Object.defineProperty(ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ee,[])}catch(W){var q=W}Reflect.construct(o,[],ee)}else{try{ee.call()}catch(W){q=W}o.call(ee.prototype)}}else{try{throw Error()}catch(W){q=W}(ee=o())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch(W){if(W&&q&&typeof W.stack=="string")return[W.stack,q.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var S=h.DetermineComponentFrameRoot(),C=S[0],M=S[1];if(C&&M){var L=C.split(`
|
|
4
|
-
`),F=M.split(`
|
|
5
|
-
`);for(v=h=0;h<L.length&&!L[h].includes("DetermineComponentFrameRoot");)h++;for(;v<F.length&&!F[v].includes("DetermineComponentFrameRoot");)v++;if(h===L.length||v===F.length)for(h=L.length-1,v=F.length-1;1<=h&&0<=v&&L[h]!==F[v];)v--;for(;1<=h&&0<=v;h--,v--)if(L[h]!==F[v]){if(h!==1||v!==1)do if(h--,v--,0>v||L[h]!==F[v]){var J=`
|
|
6
|
-
`+L[h].replace(" at new "," at ");return o.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",o.displayName)),J}while(1<=h&&0<=v);break}}}finally{Wt=!1,Error.prepareStackTrace=d}return(d=o?o.displayName||o.name:"")?$t(d):""}function Ur(o,l){switch(o.tag){case 26:case 27:case 5:return $t(o.type);case 16:return $t("Lazy");case 13:return o.child!==l&&l!==null?$t("Suspense Fallback"):$t("Suspense");case 19:return $t("SuspenseList");case 0:case 15:return Hr(o.type,!1);case 11:return Hr(o.type.render,!1);case 1:return Hr(o.type,!0);case 31:return $t("Activity");default:return""}}function Fr(o){try{var l="",d=null;do l+=Ur(o,d),d=o,o=o.return;while(o);return l}catch(h){return`
|
|
7
|
-
Error generating stack: `+h.message+`
|
|
8
|
-
`+h.stack}}var ae=Object.prototype.hasOwnProperty,Le=t.unstable_scheduleCallback,It=t.unstable_cancelCallback,Yn=t.unstable_shouldYield,ks=t.unstable_requestPaint,Jt=t.unstable_now,Fd=t.unstable_getCurrentPriorityLevel,qd=t.unstable_ImmediatePriority,Gd=t.unstable_UserBlockingPriority,wc=t.unstable_NormalPriority,gx=t.unstable_LowPriority,xc=t.unstable_IdlePriority,D=t.log,V=t.unstable_setDisableYieldValue,H=null,re=null;function oe(o){if(typeof D=="function"&&V(o),re&&typeof re.setStrictMode=="function")try{re.setStrictMode(H,o)}catch{}}var ge=Math.clz32?Math.clz32:ze,be=Math.log,xe=Math.LN2;function ze(o){return o>>>=0,o===0?32:31-(be(o)/xe|0)|0}var st=256,Pt=262144,Xn=4194304;function Sn(o){var l=o&42;if(l!==0)return l;switch(o&-o){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 o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function ci(o,l,d){var h=o.pendingLanes;if(h===0)return 0;var v=0,S=o.suspendedLanes,C=o.pingedLanes;o=o.warmLanes;var M=h&134217727;return M!==0?(h=M&~S,h!==0?v=Sn(h):(C&=M,C!==0?v=Sn(C):d||(d=M&~o,d!==0&&(v=Sn(d))))):(M=h&~S,M!==0?v=Sn(M):C!==0?v=Sn(C):d||(d=h&~o,d!==0&&(v=Sn(d)))),v===0?0:l!==0&&l!==v&&(l&S)===0&&(S=v&-v,d=l&-l,S>=d||S===32&&(d&4194048)!==0)?l:v}function Bo(o,l){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&l)===0}function $o(o,l){switch(o){case 1:case 2:case 4:case 8:case 64:return l+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 l+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 Wd(){var o=Xn;return Xn<<=1,(Xn&62914560)===0&&(Xn=4194304),o}function Ua(o){for(var l=[],d=0;31>d;d++)l.push(o);return l}function kc(o,l){o.pendingLanes|=l,l!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function l2(o,l,d,h,v,S){var C=o.pendingLanes;o.pendingLanes=d,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=d,o.entangledLanes&=d,o.errorRecoveryDisabledLanes&=d,o.shellSuspendCounter=0;var M=o.entanglements,L=o.expirationTimes,F=o.hiddenUpdates;for(d=C&~d;0<d;){var J=31-ge(d),ee=1<<J;M[J]=0,L[J]=-1;var q=F[J];if(q!==null)for(F[J]=null,J=0;J<q.length;J++){var W=q[J];W!==null&&(W.lane&=-536870913)}d&=~ee}h!==0&&yx(o,h,0),S!==0&&v===0&&o.tag!==0&&(o.suspendedLanes|=S&~(C&~l))}function yx(o,l,d){o.pendingLanes|=l,o.suspendedLanes&=~l;var h=31-ge(l);o.entangledLanes|=l,o.entanglements[h]=o.entanglements[h]|1073741824|d&261930}function vx(o,l){var d=o.entangledLanes|=l;for(o=o.entanglements;d;){var h=31-ge(d),v=1<<h;v&l|o[h]&l&&(o[h]|=l),d&=~v}}function bx(o,l){var d=l&-l;return d=(d&42)!==0?1:rg(d),(d&(o.suspendedLanes|l))!==0?0:d}function rg(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=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:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function ig(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function Sx(){var o=Z.p;return o!==0?o:(o=window.event,o===void 0?32:sE(o.type))}function wx(o,l){var d=Z.p;try{return Z.p=o,l()}finally{Z.p=d}}var Cs=Math.random().toString(36).slice(2),wn="__reactFiber$"+Cs,Jn="__reactProps$"+Cs,Fa="__reactContainer$"+Cs,sg="__reactEvents$"+Cs,c2="__reactListeners$"+Cs,u2="__reactHandles$"+Cs,xx="__reactResources$"+Cs,Cc="__reactMarker$"+Cs;function og(o){delete o[wn],delete o[Jn],delete o[sg],delete o[c2],delete o[u2]}function qa(o){var l=o[wn];if(l)return l;for(var d=o.parentNode;d;){if(l=d[Fa]||d[wn]){if(d=l.alternate,l.child!==null||d!==null&&d.child!==null)for(o=U1(o);o!==null;){if(d=o[wn])return d;o=U1(o)}return l}o=d,d=o.parentNode}return null}function Ga(o){if(o=o[wn]||o[Fa]){var l=o.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return o}return null}function Ec(o){var l=o.tag;if(l===5||l===26||l===27||l===6)return o.stateNode;throw Error(r(33))}function Wa(o){var l=o[xx];return l||(l=o[xx]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function dn(o){o[Cc]=!0}var kx=new Set,Cx={};function Vo(o,l){Ka(o,l),Ka(o+"Capture",l)}function Ka(o,l){for(Cx[o]=l,o=0;o<l.length;o++)kx.add(l[o])}var d2=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]*$"),Ex={},Tx={};function f2(o){return ae.call(Tx,o)?!0:ae.call(Ex,o)?!1:d2.test(o)?Tx[o]=!0:(Ex[o]=!0,!1)}function Kd(o,l,d){if(f2(l))if(d===null)o.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":o.removeAttribute(l);return;case"boolean":var h=l.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){o.removeAttribute(l);return}}o.setAttribute(l,""+d)}}function Zd(o,l,d){if(d===null)o.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(l);return}o.setAttribute(l,""+d)}}function Ai(o,l,d,h){if(h===null)o.removeAttribute(d);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(d);return}o.setAttributeNS(l,d,""+h)}}function kr(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function _x(o){var l=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function h2(o,l,d){var h=Object.getOwnPropertyDescriptor(o.constructor.prototype,l);if(!o.hasOwnProperty(l)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var v=h.get,S=h.set;return Object.defineProperty(o,l,{configurable:!0,get:function(){return v.call(this)},set:function(C){d=""+C,S.call(this,C)}}),Object.defineProperty(o,l,{enumerable:h.enumerable}),{getValue:function(){return d},setValue:function(C){d=""+C},stopTracking:function(){o._valueTracker=null,delete o[l]}}}}function ag(o){if(!o._valueTracker){var l=_x(o)?"checked":"value";o._valueTracker=h2(o,l,""+o[l])}}function Ax(o){if(!o)return!1;var l=o._valueTracker;if(!l)return!0;var d=l.getValue(),h="";return o&&(h=_x(o)?o.checked?"true":"false":o.value),o=h,o!==d?(l.setValue(o),!0):!1}function Yd(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var p2=/[\n"\\]/g;function Cr(o){return o.replace(p2,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function lg(o,l,d,h,v,S,C,M){o.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?o.type=C:o.removeAttribute("type"),l!=null?C==="number"?(l===0&&o.value===""||o.value!=l)&&(o.value=""+kr(l)):o.value!==""+kr(l)&&(o.value=""+kr(l)):C!=="submit"&&C!=="reset"||o.removeAttribute("value"),l!=null?cg(o,C,kr(l)):d!=null?cg(o,C,kr(d)):h!=null&&o.removeAttribute("value"),v==null&&S!=null&&(o.defaultChecked=!!S),v!=null&&(o.checked=v&&typeof v!="function"&&typeof v!="symbol"),M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?o.name=""+kr(M):o.removeAttribute("name")}function Rx(o,l,d,h,v,S,C,M){if(S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(o.type=S),l!=null||d!=null){if(!(S!=="submit"&&S!=="reset"||l!=null)){ag(o);return}d=d!=null?""+kr(d):"",l=l!=null?""+kr(l):d,M||l===o.value||(o.value=l),o.defaultValue=l}h=h??v,h=typeof h!="function"&&typeof h!="symbol"&&!!h,o.checked=M?o.checked:!!h,o.defaultChecked=!!h,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(o.name=C),ag(o)}function cg(o,l,d){l==="number"&&Yd(o.ownerDocument)===o||o.defaultValue===""+d||(o.defaultValue=""+d)}function Za(o,l,d,h){if(o=o.options,l){l={};for(var v=0;v<d.length;v++)l["$"+d[v]]=!0;for(d=0;d<o.length;d++)v=l.hasOwnProperty("$"+o[d].value),o[d].selected!==v&&(o[d].selected=v),v&&h&&(o[d].defaultSelected=!0)}else{for(d=""+kr(d),l=null,v=0;v<o.length;v++){if(o[v].value===d){o[v].selected=!0,h&&(o[v].defaultSelected=!0);return}l!==null||o[v].disabled||(l=o[v])}l!==null&&(l.selected=!0)}}function Mx(o,l,d){if(l!=null&&(l=""+kr(l),l!==o.value&&(o.value=l),d==null)){o.defaultValue!==l&&(o.defaultValue=l);return}o.defaultValue=d!=null?""+kr(d):""}function Ox(o,l,d,h){if(l==null){if(h!=null){if(d!=null)throw Error(r(92));if(he(h)){if(1<h.length)throw Error(r(93));h=h[0]}d=h}d==null&&(d=""),l=d}d=kr(l),o.defaultValue=d,h=o.textContent,h===d&&h!==""&&h!==null&&(o.value=h),ag(o)}function Ya(o,l){if(l){var d=o.firstChild;if(d&&d===o.lastChild&&d.nodeType===3){d.nodeValue=l;return}}o.textContent=l}var m2=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 Nx(o,l,d){var h=l.indexOf("--")===0;d==null||typeof d=="boolean"||d===""?h?o.setProperty(l,""):l==="float"?o.cssFloat="":o[l]="":h?o.setProperty(l,d):typeof d!="number"||d===0||m2.has(l)?l==="float"?o.cssFloat=d:o[l]=(""+d).trim():o[l]=d+"px"}function Dx(o,l,d){if(l!=null&&typeof l!="object")throw Error(r(62));if(o=o.style,d!=null){for(var h in d)!d.hasOwnProperty(h)||l!=null&&l.hasOwnProperty(h)||(h.indexOf("--")===0?o.setProperty(h,""):h==="float"?o.cssFloat="":o[h]="");for(var v in l)h=l[v],l.hasOwnProperty(v)&&d[v]!==h&&Nx(o,v,h)}else for(var S in l)l.hasOwnProperty(S)&&Nx(o,S,l[S])}function ug(o){if(o.indexOf("-")===-1)return!1;switch(o){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 g2=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"]]),y2=/^[\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 Xd(o){return y2.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function Ri(){}var dg=null;function fg(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Xa=null,Ja=null;function Ix(o){var l=Ga(o);if(l&&(o=l.stateNode)){var d=o[Jn]||null;e:switch(o=l.stateNode,l.type){case"input":if(lg(o,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name),l=d.name,d.type==="radio"&&l!=null){for(d=o;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll('input[name="'+Cr(""+l)+'"][type="radio"]'),l=0;l<d.length;l++){var h=d[l];if(h!==o&&h.form===o.form){var v=h[Jn]||null;if(!v)throw Error(r(90));lg(h,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(l=0;l<d.length;l++)h=d[l],h.form===o.form&&Ax(h)}break e;case"textarea":Mx(o,d.value,d.defaultValue);break e;case"select":l=d.value,l!=null&&Za(o,!!d.multiple,l,!1)}}}var hg=!1;function Lx(o,l,d){if(hg)return o(l,d);hg=!0;try{var h=o(l);return h}finally{if(hg=!1,(Xa!==null||Ja!==null)&&(Bf(),Xa&&(l=Xa,o=Ja,Ja=Xa=null,Ix(l),o)))for(l=0;l<o.length;l++)Ix(o[l])}}function Tc(o,l){var d=o.stateNode;if(d===null)return null;var h=d[Jn]||null;if(h===null)return null;d=h[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(o=o.type,h=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!h;break e;default:o=!1}if(o)return null;if(d&&typeof d!="function")throw Error(r(231,l,typeof d));return d}var Mi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),pg=!1;if(Mi)try{var _c={};Object.defineProperty(_c,"passive",{get:function(){pg=!0}}),window.addEventListener("test",_c,_c),window.removeEventListener("test",_c,_c)}catch{pg=!1}var Es=null,mg=null,Jd=null;function zx(){if(Jd)return Jd;var o,l=mg,d=l.length,h,v="value"in Es?Es.value:Es.textContent,S=v.length;for(o=0;o<d&&l[o]===v[o];o++);var C=d-o;for(h=1;h<=C&&l[d-h]===v[S-h];h++);return Jd=v.slice(o,1<h?1-h:void 0)}function Qd(o){var l=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&l===13&&(o=13)):o=l,o===10&&(o=13),32<=o||o===13?o:0}function ef(){return!0}function Px(){return!1}function Qn(o){function l(d,h,v,S,C){this._reactName=d,this._targetInst=v,this.type=h,this.nativeEvent=S,this.target=C,this.currentTarget=null;for(var M in o)o.hasOwnProperty(M)&&(d=o[M],this[M]=d?d(S):S[M]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?ef:Px,this.isPropagationStopped=Px,this}return m(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=ef)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=ef)},persist:function(){},isPersistent:ef}),l}var Ho={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},tf=Qn(Ho),Ac=m({},Ho,{view:0,detail:0}),v2=Qn(Ac),gg,yg,Rc,nf=m({},Ac,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:bg,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==Rc&&(Rc&&o.type==="mousemove"?(gg=o.screenX-Rc.screenX,yg=o.screenY-Rc.screenY):yg=gg=0,Rc=o),gg)},movementY:function(o){return"movementY"in o?o.movementY:yg}}),jx=Qn(nf),b2=m({},nf,{dataTransfer:0}),S2=Qn(b2),w2=m({},Ac,{relatedTarget:0}),vg=Qn(w2),x2=m({},Ho,{animationName:0,elapsedTime:0,pseudoElement:0}),k2=Qn(x2),C2=m({},Ho,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),E2=Qn(C2),T2=m({},Ho,{data:0}),Bx=Qn(T2),_2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},A2={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"},R2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function M2(o){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(o):(o=R2[o])?!!l[o]:!1}function bg(){return M2}var O2=m({},Ac,{key:function(o){if(o.key){var l=_2[o.key]||o.key;if(l!=="Unidentified")return l}return o.type==="keypress"?(o=Qd(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?A2[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:bg,charCode:function(o){return o.type==="keypress"?Qd(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Qd(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),N2=Qn(O2),D2=m({},nf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$x=Qn(D2),I2=m({},Ac,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:bg}),L2=Qn(I2),z2=m({},Ho,{propertyName:0,elapsedTime:0,pseudoElement:0}),P2=Qn(z2),j2=m({},nf,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),B2=Qn(j2),$2=m({},Ho,{newState:0,oldState:0}),V2=Qn($2),H2=[9,13,27,32],Sg=Mi&&"CompositionEvent"in window,Mc=null;Mi&&"documentMode"in document&&(Mc=document.documentMode);var U2=Mi&&"TextEvent"in window&&!Mc,Vx=Mi&&(!Sg||Mc&&8<Mc&&11>=Mc),Hx=" ",Ux=!1;function Fx(o,l){switch(o){case"keyup":return H2.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qx(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Qa=!1;function F2(o,l){switch(o){case"compositionend":return qx(l);case"keypress":return l.which!==32?null:(Ux=!0,Hx);case"textInput":return o=l.data,o===Hx&&Ux?null:o;default:return null}}function q2(o,l){if(Qa)return o==="compositionend"||!Sg&&Fx(o,l)?(o=zx(),Jd=mg=Es=null,Qa=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return Vx&&l.locale!=="ko"?null:l.data;default:return null}}var G2={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 Gx(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l==="input"?!!G2[o.type]:l==="textarea"}function Wx(o,l,d,h){Xa?Ja?Ja.push(h):Ja=[h]:Xa=h,l=Gf(l,"onChange"),0<l.length&&(d=new tf("onChange","change",null,d,h),o.push({event:d,listeners:l}))}var Oc=null,Nc=null;function W2(o){R1(o,0)}function rf(o){var l=Ec(o);if(Ax(l))return o}function Kx(o,l){if(o==="change")return l}var Zx=!1;if(Mi){var wg;if(Mi){var xg="oninput"in document;if(!xg){var Yx=document.createElement("div");Yx.setAttribute("oninput","return;"),xg=typeof Yx.oninput=="function"}wg=xg}else wg=!1;Zx=wg&&(!document.documentMode||9<document.documentMode)}function Xx(){Oc&&(Oc.detachEvent("onpropertychange",Jx),Nc=Oc=null)}function Jx(o){if(o.propertyName==="value"&&rf(Nc)){var l=[];Wx(l,Nc,o,fg(o)),Lx(W2,l)}}function K2(o,l,d){o==="focusin"?(Xx(),Oc=l,Nc=d,Oc.attachEvent("onpropertychange",Jx)):o==="focusout"&&Xx()}function Z2(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return rf(Nc)}function Y2(o,l){if(o==="click")return rf(l)}function X2(o,l){if(o==="input"||o==="change")return rf(l)}function J2(o,l){return o===l&&(o!==0||1/o===1/l)||o!==o&&l!==l}var lr=typeof Object.is=="function"?Object.is:J2;function Dc(o,l){if(lr(o,l))return!0;if(typeof o!="object"||o===null||typeof l!="object"||l===null)return!1;var d=Object.keys(o),h=Object.keys(l);if(d.length!==h.length)return!1;for(h=0;h<d.length;h++){var v=d[h];if(!ae.call(l,v)||!lr(o[v],l[v]))return!1}return!0}function Qx(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function ek(o,l){var d=Qx(o);o=0;for(var h;d;){if(d.nodeType===3){if(h=o+d.textContent.length,o<=l&&h>=l)return{node:d,offset:l-o};o=h}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=Qx(d)}}function tk(o,l){return o&&l?o===l?!0:o&&o.nodeType===3?!1:l&&l.nodeType===3?tk(o,l.parentNode):"contains"in o?o.contains(l):o.compareDocumentPosition?!!(o.compareDocumentPosition(l)&16):!1:!1}function nk(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var l=Yd(o.document);l instanceof o.HTMLIFrameElement;){try{var d=typeof l.contentWindow.location.href=="string"}catch{d=!1}if(d)o=l.contentWindow;else break;l=Yd(o.document)}return l}function kg(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l&&(l==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||l==="textarea"||o.contentEditable==="true")}var Q2=Mi&&"documentMode"in document&&11>=document.documentMode,el=null,Cg=null,Ic=null,Eg=!1;function rk(o,l,d){var h=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Eg||el==null||el!==Yd(h)||(h=el,"selectionStart"in h&&kg(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),Ic&&Dc(Ic,h)||(Ic=h,h=Gf(Cg,"onSelect"),0<h.length&&(l=new tf("onSelect","select",null,l,d),o.push({event:l,listeners:h}),l.target=el)))}function Uo(o,l){var d={};return d[o.toLowerCase()]=l.toLowerCase(),d["Webkit"+o]="webkit"+l,d["Moz"+o]="moz"+l,d}var tl={animationend:Uo("Animation","AnimationEnd"),animationiteration:Uo("Animation","AnimationIteration"),animationstart:Uo("Animation","AnimationStart"),transitionrun:Uo("Transition","TransitionRun"),transitionstart:Uo("Transition","TransitionStart"),transitioncancel:Uo("Transition","TransitionCancel"),transitionend:Uo("Transition","TransitionEnd")},Tg={},ik={};Mi&&(ik=document.createElement("div").style,"AnimationEvent"in window||(delete tl.animationend.animation,delete tl.animationiteration.animation,delete tl.animationstart.animation),"TransitionEvent"in window||delete tl.transitionend.transition);function Fo(o){if(Tg[o])return Tg[o];if(!tl[o])return o;var l=tl[o],d;for(d in l)if(l.hasOwnProperty(d)&&d in ik)return Tg[o]=l[d];return o}var sk=Fo("animationend"),ok=Fo("animationiteration"),ak=Fo("animationstart"),ez=Fo("transitionrun"),tz=Fo("transitionstart"),nz=Fo("transitioncancel"),lk=Fo("transitionend"),ck=new Map,_g="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(" ");_g.push("scrollEnd");function qr(o,l){ck.set(o,l),Vo(l,[o])}var sf=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},Er=[],nl=0,Ag=0;function of(){for(var o=nl,l=Ag=nl=0;l<o;){var d=Er[l];Er[l++]=null;var h=Er[l];Er[l++]=null;var v=Er[l];Er[l++]=null;var S=Er[l];if(Er[l++]=null,h!==null&&v!==null){var C=h.pending;C===null?v.next=v:(v.next=C.next,C.next=v),h.pending=v}S!==0&&uk(d,v,S)}}function af(o,l,d,h){Er[nl++]=o,Er[nl++]=l,Er[nl++]=d,Er[nl++]=h,Ag|=h,o.lanes|=h,o=o.alternate,o!==null&&(o.lanes|=h)}function Rg(o,l,d,h){return af(o,l,d,h),lf(o)}function qo(o,l){return af(o,null,null,l),lf(o)}function uk(o,l,d){o.lanes|=d;var h=o.alternate;h!==null&&(h.lanes|=d);for(var v=!1,S=o.return;S!==null;)S.childLanes|=d,h=S.alternate,h!==null&&(h.childLanes|=d),S.tag===22&&(o=S.stateNode,o===null||o._visibility&1||(v=!0)),o=S,S=S.return;return o.tag===3?(S=o.stateNode,v&&l!==null&&(v=31-ge(d),o=S.hiddenUpdates,h=o[v],h===null?o[v]=[l]:h.push(l),l.lane=d|536870912),S):null}function lf(o){if(50<nu)throw nu=0,jy=null,Error(r(185));for(var l=o.return;l!==null;)o=l,l=o.return;return o.tag===3?o.stateNode:null}var rl={};function rz(o,l,d,h){this.tag=o,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function cr(o,l,d,h){return new rz(o,l,d,h)}function Mg(o){return o=o.prototype,!(!o||!o.isReactComponent)}function Oi(o,l){var d=o.alternate;return d===null?(d=cr(o.tag,l,o.key,o.mode),d.elementType=o.elementType,d.type=o.type,d.stateNode=o.stateNode,d.alternate=o,o.alternate=d):(d.pendingProps=l,d.type=o.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=o.flags&65011712,d.childLanes=o.childLanes,d.lanes=o.lanes,d.child=o.child,d.memoizedProps=o.memoizedProps,d.memoizedState=o.memoizedState,d.updateQueue=o.updateQueue,l=o.dependencies,d.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},d.sibling=o.sibling,d.index=o.index,d.ref=o.ref,d.refCleanup=o.refCleanup,d}function dk(o,l){o.flags&=65011714;var d=o.alternate;return d===null?(o.childLanes=0,o.lanes=l,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=d.childLanes,o.lanes=d.lanes,o.child=d.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=d.memoizedProps,o.memoizedState=d.memoizedState,o.updateQueue=d.updateQueue,o.type=d.type,l=d.dependencies,o.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),o}function cf(o,l,d,h,v,S){var C=0;if(h=o,typeof o=="function")Mg(o)&&(C=1);else if(typeof o=="string")C=lP(o,d,ve.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case G:return o=cr(31,d,l,v),o.elementType=G,o.lanes=S,o;case w:return Go(d.children,v,S,l);case x:C=8,v|=24;break;case k:return o=cr(12,d,l,v|2),o.elementType=k,o.lanes=S,o;case O:return o=cr(13,d,l,v),o.elementType=O,o.lanes=S,o;case N:return o=cr(19,d,l,v),o.elementType=N,o.lanes=S,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case A:C=10;break e;case T:C=9;break e;case _:C=11;break e;case I:C=14;break e;case j:C=16,h=null;break e}C=29,d=Error(r(130,o===null?"null":typeof o,"")),h=null}return l=cr(C,d,l,v),l.elementType=o,l.type=h,l.lanes=S,l}function Go(o,l,d,h){return o=cr(7,o,h,l),o.lanes=d,o}function Og(o,l,d){return o=cr(6,o,null,l),o.lanes=d,o}function fk(o){var l=cr(18,null,null,0);return l.stateNode=o,l}function Ng(o,l,d){return l=cr(4,o.children!==null?o.children:[],o.key,l),l.lanes=d,l.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},l}var hk=new WeakMap;function Tr(o,l){if(typeof o=="object"&&o!==null){var d=hk.get(o);return d!==void 0?d:(l={value:o,source:l,stack:Fr(l)},hk.set(o,l),l)}return{value:o,source:l,stack:Fr(l)}}var il=[],sl=0,uf=null,Lc=0,_r=[],Ar=0,Ts=null,ui=1,di="";function Ni(o,l){il[sl++]=Lc,il[sl++]=uf,uf=o,Lc=l}function pk(o,l,d){_r[Ar++]=ui,_r[Ar++]=di,_r[Ar++]=Ts,Ts=o;var h=ui;o=di;var v=32-ge(h)-1;h&=~(1<<v),d+=1;var S=32-ge(l)+v;if(30<S){var C=v-v%5;S=(h&(1<<C)-1).toString(32),h>>=C,v-=C,ui=1<<32-ge(l)+v|d<<v|h,di=S+o}else ui=1<<S|d<<v|h,di=o}function Dg(o){o.return!==null&&(Ni(o,1),pk(o,1,0))}function Ig(o){for(;o===uf;)uf=il[--sl],il[sl]=null,Lc=il[--sl],il[sl]=null;for(;o===Ts;)Ts=_r[--Ar],_r[Ar]=null,di=_r[--Ar],_r[Ar]=null,ui=_r[--Ar],_r[Ar]=null}function mk(o,l){_r[Ar++]=ui,_r[Ar++]=di,_r[Ar++]=Ts,ui=l.id,di=l.overflow,Ts=o}var xn=null,Mt=null,nt=!1,_s=null,Rr=!1,Lg=Error(r(519));function As(o){var l=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw zc(Tr(l,o)),Lg}function gk(o){var l=o.stateNode,d=o.type,h=o.memoizedProps;switch(l[wn]=o,l[Jn]=h,d){case"dialog":Je("cancel",l),Je("close",l);break;case"iframe":case"object":case"embed":Je("load",l);break;case"video":case"audio":for(d=0;d<iu.length;d++)Je(iu[d],l);break;case"source":Je("error",l);break;case"img":case"image":case"link":Je("error",l),Je("load",l);break;case"details":Je("toggle",l);break;case"input":Je("invalid",l),Rx(l,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":Je("invalid",l);break;case"textarea":Je("invalid",l),Ox(l,h.value,h.defaultValue,h.children)}d=h.children,typeof d!="string"&&typeof d!="number"&&typeof d!="bigint"||l.textContent===""+d||h.suppressHydrationWarning===!0||D1(l.textContent,d)?(h.popover!=null&&(Je("beforetoggle",l),Je("toggle",l)),h.onScroll!=null&&Je("scroll",l),h.onScrollEnd!=null&&Je("scrollend",l),h.onClick!=null&&(l.onclick=Ri),l=!0):l=!1,l||As(o,!0)}function yk(o){for(xn=o.return;xn;)switch(xn.tag){case 5:case 31:case 13:Rr=!1;return;case 27:case 3:Rr=!0;return;default:xn=xn.return}}function ol(o){if(o!==xn)return!1;if(!nt)return yk(o),nt=!0,!1;var l=o.tag,d;if((d=l!==3&&l!==27)&&((d=l===5)&&(d=o.type,d=!(d!=="form"&&d!=="button")||Qy(o.type,o.memoizedProps)),d=!d),d&&Mt&&As(o),yk(o),l===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Mt=H1(o)}else if(l===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Mt=H1(o)}else l===27?(l=Mt,Hs(o.type)?(o=iv,iv=null,Mt=o):Mt=l):Mt=xn?Or(o.stateNode.nextSibling):null;return!0}function Wo(){Mt=xn=null,nt=!1}function zg(){var o=_s;return o!==null&&(rr===null?rr=o:rr.push.apply(rr,o),_s=null),o}function zc(o){_s===null?_s=[o]:_s.push(o)}var Pg=z(null),Ko=null,Di=null;function Rs(o,l,d){le(Pg,l._currentValue),l._currentValue=d}function Ii(o){o._currentValue=Pg.current,K(Pg)}function jg(o,l,d){for(;o!==null;){var h=o.alternate;if((o.childLanes&l)!==l?(o.childLanes|=l,h!==null&&(h.childLanes|=l)):h!==null&&(h.childLanes&l)!==l&&(h.childLanes|=l),o===d)break;o=o.return}}function Bg(o,l,d,h){var v=o.child;for(v!==null&&(v.return=o);v!==null;){var S=v.dependencies;if(S!==null){var C=v.child;S=S.firstContext;e:for(;S!==null;){var M=S;S=v;for(var L=0;L<l.length;L++)if(M.context===l[L]){S.lanes|=d,M=S.alternate,M!==null&&(M.lanes|=d),jg(S.return,d,o),h||(C=null);break e}S=M.next}}else if(v.tag===18){if(C=v.return,C===null)throw Error(r(341));C.lanes|=d,S=C.alternate,S!==null&&(S.lanes|=d),jg(C,d,o),C=null}else C=v.child;if(C!==null)C.return=v;else for(C=v;C!==null;){if(C===o){C=null;break}if(v=C.sibling,v!==null){v.return=C.return,C=v;break}C=C.return}v=C}}function al(o,l,d,h){o=null;for(var v=l,S=!1;v!==null;){if(!S){if((v.flags&524288)!==0)S=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var C=v.alternate;if(C===null)throw Error(r(387));if(C=C.memoizedProps,C!==null){var M=v.type;lr(v.pendingProps.value,C.value)||(o!==null?o.push(M):o=[M])}}else if(v===pe.current){if(C=v.alternate,C===null)throw Error(r(387));C.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(o!==null?o.push(cu):o=[cu])}v=v.return}o!==null&&Bg(l,o,d,h),l.flags|=262144}function df(o){for(o=o.firstContext;o!==null;){if(!lr(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function Zo(o){Ko=o,Di=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function kn(o){return vk(Ko,o)}function ff(o,l){return Ko===null&&Zo(o),vk(o,l)}function vk(o,l){var d=l._currentValue;if(l={context:l,memoizedValue:d,next:null},Di===null){if(o===null)throw Error(r(308));Di=l,o.dependencies={lanes:0,firstContext:l},o.flags|=524288}else Di=Di.next=l;return d}var iz=typeof AbortController<"u"?AbortController:function(){var o=[],l=this.signal={aborted:!1,addEventListener:function(d,h){o.push(h)}};this.abort=function(){l.aborted=!0,o.forEach(function(d){return d()})}},sz=t.unstable_scheduleCallback,oz=t.unstable_NormalPriority,Qt={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function $g(){return{controller:new iz,data:new Map,refCount:0}}function Pc(o){o.refCount--,o.refCount===0&&sz(oz,function(){o.controller.abort()})}var jc=null,Vg=0,ll=0,cl=null;function az(o,l){if(jc===null){var d=jc=[];Vg=0,ll=Fy(),cl={status:"pending",value:void 0,then:function(h){d.push(h)}}}return Vg++,l.then(bk,bk),l}function bk(){if(--Vg===0&&jc!==null){cl!==null&&(cl.status="fulfilled");var o=jc;jc=null,ll=0,cl=null;for(var l=0;l<o.length;l++)(0,o[l])()}}function lz(o,l){var d=[],h={status:"pending",value:null,reason:null,then:function(v){d.push(v)}};return o.then(function(){h.status="fulfilled",h.value=l;for(var v=0;v<d.length;v++)(0,d[v])(l)},function(v){for(h.status="rejected",h.reason=v,v=0;v<d.length;v++)(0,d[v])(void 0)}),h}var Sk=B.S;B.S=function(o,l){r1=Jt(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&az(o,l),Sk!==null&&Sk(o,l)};var Yo=z(null);function Hg(){var o=Yo.current;return o!==null?o:Ct.pooledCache}function hf(o,l){l===null?le(Yo,Yo.current):le(Yo,l.pool)}function wk(){var o=Hg();return o===null?null:{parent:Qt._currentValue,pool:o}}var ul=Error(r(460)),Ug=Error(r(474)),pf=Error(r(542)),mf={then:function(){}};function xk(o){return o=o.status,o==="fulfilled"||o==="rejected"}function kk(o,l,d){switch(d=o[d],d===void 0?o.push(l):d!==l&&(l.then(Ri,Ri),l=d),l.status){case"fulfilled":return l.value;case"rejected":throw o=l.reason,Ek(o),o;default:if(typeof l.status=="string")l.then(Ri,Ri);else{if(o=Ct,o!==null&&100<o.shellSuspendCounter)throw Error(r(482));o=l,o.status="pending",o.then(function(h){if(l.status==="pending"){var v=l;v.status="fulfilled",v.value=h}},function(h){if(l.status==="pending"){var v=l;v.status="rejected",v.reason=h}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw o=l.reason,Ek(o),o}throw Jo=l,ul}}function Xo(o){try{var l=o._init;return l(o._payload)}catch(d){throw d!==null&&typeof d=="object"&&typeof d.then=="function"?(Jo=d,ul):d}}var Jo=null;function Ck(){if(Jo===null)throw Error(r(459));var o=Jo;return Jo=null,o}function Ek(o){if(o===ul||o===pf)throw Error(r(483))}var dl=null,Bc=0;function gf(o){var l=Bc;return Bc+=1,dl===null&&(dl=[]),kk(dl,o,l)}function $c(o,l){l=l.props.ref,o.ref=l!==void 0?l:null}function yf(o,l){throw l.$$typeof===g?Error(r(525)):(o=Object.prototype.toString.call(l),Error(r(31,o==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":o)))}function Tk(o){function l($,P){if(o){var U=$.deletions;U===null?($.deletions=[P],$.flags|=16):U.push(P)}}function d($,P){if(!o)return null;for(;P!==null;)l($,P),P=P.sibling;return null}function h($){for(var P=new Map;$!==null;)$.key!==null?P.set($.key,$):P.set($.index,$),$=$.sibling;return P}function v($,P){return $=Oi($,P),$.index=0,$.sibling=null,$}function S($,P,U){return $.index=U,o?(U=$.alternate,U!==null?(U=U.index,U<P?($.flags|=67108866,P):U):($.flags|=67108866,P)):($.flags|=1048576,P)}function C($){return o&&$.alternate===null&&($.flags|=67108866),$}function M($,P,U,Q){return P===null||P.tag!==6?(P=Og(U,$.mode,Q),P.return=$,P):(P=v(P,U),P.return=$,P)}function L($,P,U,Q){var De=U.type;return De===w?J($,P,U.props.children,Q,U.key):P!==null&&(P.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===j&&Xo(De)===P.type)?(P=v(P,U.props),$c(P,U),P.return=$,P):(P=cf(U.type,U.key,U.props,null,$.mode,Q),$c(P,U),P.return=$,P)}function F($,P,U,Q){return P===null||P.tag!==4||P.stateNode.containerInfo!==U.containerInfo||P.stateNode.implementation!==U.implementation?(P=Ng(U,$.mode,Q),P.return=$,P):(P=v(P,U.children||[]),P.return=$,P)}function J($,P,U,Q,De){return P===null||P.tag!==7?(P=Go(U,$.mode,Q,De),P.return=$,P):(P=v(P,U),P.return=$,P)}function ee($,P,U){if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return P=Og(""+P,$.mode,U),P.return=$,P;if(typeof P=="object"&&P!==null){switch(P.$$typeof){case y:return U=cf(P.type,P.key,P.props,null,$.mode,U),$c(U,P),U.return=$,U;case b:return P=Ng(P,$.mode,U),P.return=$,P;case j:return P=Xo(P),ee($,P,U)}if(he(P)||X(P))return P=Go(P,$.mode,U,null),P.return=$,P;if(typeof P.then=="function")return ee($,gf(P),U);if(P.$$typeof===A)return ee($,ff($,P),U);yf($,P)}return null}function q($,P,U,Q){var De=P!==null?P.key:null;if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return De!==null?null:M($,P,""+U,Q);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case y:return U.key===De?L($,P,U,Q):null;case b:return U.key===De?F($,P,U,Q):null;case j:return U=Xo(U),q($,P,U,Q)}if(he(U)||X(U))return De!==null?null:J($,P,U,Q,null);if(typeof U.then=="function")return q($,P,gf(U),Q);if(U.$$typeof===A)return q($,P,ff($,U),Q);yf($,U)}return null}function W($,P,U,Q,De){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return $=$.get(U)||null,M(P,$,""+Q,De);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case y:return $=$.get(Q.key===null?U:Q.key)||null,L(P,$,Q,De);case b:return $=$.get(Q.key===null?U:Q.key)||null,F(P,$,Q,De);case j:return Q=Xo(Q),W($,P,U,Q,De)}if(he(Q)||X(Q))return $=$.get(U)||null,J(P,$,Q,De,null);if(typeof Q.then=="function")return W($,P,U,gf(Q),De);if(Q.$$typeof===A)return W($,P,U,ff(P,Q),De);yf(P,Q)}return null}function Te($,P,U,Q){for(var De=null,at=null,Me=P,We=P=0,tt=null;Me!==null&&We<U.length;We++){Me.index>We?(tt=Me,Me=null):tt=Me.sibling;var lt=q($,Me,U[We],Q);if(lt===null){Me===null&&(Me=tt);break}o&&Me&<.alternate===null&&l($,Me),P=S(lt,P,We),at===null?De=lt:at.sibling=lt,at=lt,Me=tt}if(We===U.length)return d($,Me),nt&&Ni($,We),De;if(Me===null){for(;We<U.length;We++)Me=ee($,U[We],Q),Me!==null&&(P=S(Me,P,We),at===null?De=Me:at.sibling=Me,at=Me);return nt&&Ni($,We),De}for(Me=h(Me);We<U.length;We++)tt=W(Me,$,We,U[We],Q),tt!==null&&(o&&tt.alternate!==null&&Me.delete(tt.key===null?We:tt.key),P=S(tt,P,We),at===null?De=tt:at.sibling=tt,at=tt);return o&&Me.forEach(function(Ws){return l($,Ws)}),nt&&Ni($,We),De}function Pe($,P,U,Q){if(U==null)throw Error(r(151));for(var De=null,at=null,Me=P,We=P=0,tt=null,lt=U.next();Me!==null&&!lt.done;We++,lt=U.next()){Me.index>We?(tt=Me,Me=null):tt=Me.sibling;var Ws=q($,Me,lt.value,Q);if(Ws===null){Me===null&&(Me=tt);break}o&&Me&&Ws.alternate===null&&l($,Me),P=S(Ws,P,We),at===null?De=Ws:at.sibling=Ws,at=Ws,Me=tt}if(lt.done)return d($,Me),nt&&Ni($,We),De;if(Me===null){for(;!lt.done;We++,lt=U.next())lt=ee($,lt.value,Q),lt!==null&&(P=S(lt,P,We),at===null?De=lt:at.sibling=lt,at=lt);return nt&&Ni($,We),De}for(Me=h(Me);!lt.done;We++,lt=U.next())lt=W(Me,$,We,lt.value,Q),lt!==null&&(o&<.alternate!==null&&Me.delete(lt.key===null?We:lt.key),P=S(lt,P,We),at===null?De=lt:at.sibling=lt,at=lt);return o&&Me.forEach(function(bP){return l($,bP)}),nt&&Ni($,We),De}function wt($,P,U,Q){if(typeof U=="object"&&U!==null&&U.type===w&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case y:e:{for(var De=U.key;P!==null;){if(P.key===De){if(De=U.type,De===w){if(P.tag===7){d($,P.sibling),Q=v(P,U.props.children),Q.return=$,$=Q;break e}}else if(P.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===j&&Xo(De)===P.type){d($,P.sibling),Q=v(P,U.props),$c(Q,U),Q.return=$,$=Q;break e}d($,P);break}else l($,P);P=P.sibling}U.type===w?(Q=Go(U.props.children,$.mode,Q,U.key),Q.return=$,$=Q):(Q=cf(U.type,U.key,U.props,null,$.mode,Q),$c(Q,U),Q.return=$,$=Q)}return C($);case b:e:{for(De=U.key;P!==null;){if(P.key===De)if(P.tag===4&&P.stateNode.containerInfo===U.containerInfo&&P.stateNode.implementation===U.implementation){d($,P.sibling),Q=v(P,U.children||[]),Q.return=$,$=Q;break e}else{d($,P);break}else l($,P);P=P.sibling}Q=Ng(U,$.mode,Q),Q.return=$,$=Q}return C($);case j:return U=Xo(U),wt($,P,U,Q)}if(he(U))return Te($,P,U,Q);if(X(U)){if(De=X(U),typeof De!="function")throw Error(r(150));return U=De.call(U),Pe($,P,U,Q)}if(typeof U.then=="function")return wt($,P,gf(U),Q);if(U.$$typeof===A)return wt($,P,ff($,U),Q);yf($,U)}return typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint"?(U=""+U,P!==null&&P.tag===6?(d($,P.sibling),Q=v(P,U),Q.return=$,$=Q):(d($,P),Q=Og(U,$.mode,Q),Q.return=$,$=Q),C($)):d($,P)}return function($,P,U,Q){try{Bc=0;var De=wt($,P,U,Q);return dl=null,De}catch(Me){if(Me===ul||Me===pf)throw Me;var at=cr(29,Me,null,$.mode);return at.lanes=Q,at.return=$,at}}}var Qo=Tk(!0),_k=Tk(!1),Ms=!1;function Fg(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qg(o,l){o=o.updateQueue,l.updateQueue===o&&(l.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Os(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function Ns(o,l,d){var h=o.updateQueue;if(h===null)return null;if(h=h.shared,(dt&2)!==0){var v=h.pending;return v===null?l.next=l:(l.next=v.next,v.next=l),h.pending=l,l=lf(o),uk(o,null,d),l}return af(o,h,l,d),lf(o)}function Vc(o,l,d){if(l=l.updateQueue,l!==null&&(l=l.shared,(d&4194048)!==0)){var h=l.lanes;h&=o.pendingLanes,d|=h,l.lanes=d,vx(o,d)}}function Gg(o,l){var d=o.updateQueue,h=o.alternate;if(h!==null&&(h=h.updateQueue,d===h)){var v=null,S=null;if(d=d.firstBaseUpdate,d!==null){do{var C={lane:d.lane,tag:d.tag,payload:d.payload,callback:null,next:null};S===null?v=S=C:S=S.next=C,d=d.next}while(d!==null);S===null?v=S=l:S=S.next=l}else v=S=l;d={baseState:h.baseState,firstBaseUpdate:v,lastBaseUpdate:S,shared:h.shared,callbacks:h.callbacks},o.updateQueue=d;return}o=d.lastBaseUpdate,o===null?d.firstBaseUpdate=l:o.next=l,d.lastBaseUpdate=l}var Wg=!1;function Hc(){if(Wg){var o=cl;if(o!==null)throw o}}function Uc(o,l,d,h){Wg=!1;var v=o.updateQueue;Ms=!1;var S=v.firstBaseUpdate,C=v.lastBaseUpdate,M=v.shared.pending;if(M!==null){v.shared.pending=null;var L=M,F=L.next;L.next=null,C===null?S=F:C.next=F,C=L;var J=o.alternate;J!==null&&(J=J.updateQueue,M=J.lastBaseUpdate,M!==C&&(M===null?J.firstBaseUpdate=F:M.next=F,J.lastBaseUpdate=L))}if(S!==null){var ee=v.baseState;C=0,J=F=L=null,M=S;do{var q=M.lane&-536870913,W=q!==M.lane;if(W?(et&q)===q:(h&q)===q){q!==0&&q===ll&&(Wg=!0),J!==null&&(J=J.next={lane:0,tag:M.tag,payload:M.payload,callback:null,next:null});e:{var Te=o,Pe=M;q=l;var wt=d;switch(Pe.tag){case 1:if(Te=Pe.payload,typeof Te=="function"){ee=Te.call(wt,ee,q);break e}ee=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Pe.payload,q=typeof Te=="function"?Te.call(wt,ee,q):Te,q==null)break e;ee=m({},ee,q);break e;case 2:Ms=!0}}q=M.callback,q!==null&&(o.flags|=64,W&&(o.flags|=8192),W=v.callbacks,W===null?v.callbacks=[q]:W.push(q))}else W={lane:q,tag:M.tag,payload:M.payload,callback:M.callback,next:null},J===null?(F=J=W,L=ee):J=J.next=W,C|=q;if(M=M.next,M===null){if(M=v.shared.pending,M===null)break;W=M,M=W.next,W.next=null,v.lastBaseUpdate=W,v.shared.pending=null}}while(!0);J===null&&(L=ee),v.baseState=L,v.firstBaseUpdate=F,v.lastBaseUpdate=J,S===null&&(v.shared.lanes=0),Ps|=C,o.lanes=C,o.memoizedState=ee}}function Ak(o,l){if(typeof o!="function")throw Error(r(191,o));o.call(l)}function Rk(o,l){var d=o.callbacks;if(d!==null)for(o.callbacks=null,o=0;o<d.length;o++)Ak(d[o],l)}var fl=z(null),vf=z(0);function Mk(o,l){o=Ui,le(vf,o),le(fl,l),Ui=o|l.baseLanes}function Kg(){le(vf,Ui),le(fl,fl.current)}function Zg(){Ui=vf.current,K(fl),K(vf)}var ur=z(null),Mr=null;function Ds(o){var l=o.alternate;le(Kt,Kt.current&1),le(ur,o),Mr===null&&(l===null||fl.current!==null||l.memoizedState!==null)&&(Mr=o)}function Yg(o){le(Kt,Kt.current),le(ur,o),Mr===null&&(Mr=o)}function Ok(o){o.tag===22?(le(Kt,Kt.current),le(ur,o),Mr===null&&(Mr=o)):Is()}function Is(){le(Kt,Kt.current),le(ur,ur.current)}function dr(o){K(ur),Mr===o&&(Mr=null),K(Kt)}var Kt=z(0);function bf(o){for(var l=o;l!==null;){if(l.tag===13){var d=l.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||nv(d)||rv(d)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var Li=0,Ge=null,bt=null,en=null,Sf=!1,hl=!1,ea=!1,wf=0,Fc=0,pl=null,cz=0;function Vt(){throw Error(r(321))}function Xg(o,l){if(l===null)return!1;for(var d=0;d<l.length&&d<o.length;d++)if(!lr(o[d],l[d]))return!1;return!0}function Jg(o,l,d,h,v,S){return Li=S,Ge=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,B.H=o===null||o.memoizedState===null?pC:hy,ea=!1,S=d(h,v),ea=!1,hl&&(S=Dk(l,d,h,v)),Nk(o),S}function Nk(o){B.H=Wc;var l=bt!==null&&bt.next!==null;if(Li=0,en=bt=Ge=null,Sf=!1,Fc=0,pl=null,l)throw Error(r(300));o===null||tn||(o=o.dependencies,o!==null&&df(o)&&(tn=!0))}function Dk(o,l,d,h){Ge=o;var v=0;do{if(hl&&(pl=null),Fc=0,hl=!1,25<=v)throw Error(r(301));if(v+=1,en=bt=null,o.updateQueue!=null){var S=o.updateQueue;S.lastEffect=null,S.events=null,S.stores=null,S.memoCache!=null&&(S.memoCache.index=0)}B.H=mC,S=l(d,h)}while(hl);return S}function uz(){var o=B.H,l=o.useState()[0];return l=typeof l.then=="function"?qc(l):l,o=o.useState()[0],(bt!==null?bt.memoizedState:null)!==o&&(Ge.flags|=1024),l}function Qg(){var o=wf!==0;return wf=0,o}function ey(o,l,d){l.updateQueue=o.updateQueue,l.flags&=-2053,o.lanes&=~d}function ty(o){if(Sf){for(o=o.memoizedState;o!==null;){var l=o.queue;l!==null&&(l.pending=null),o=o.next}Sf=!1}Li=0,en=bt=Ge=null,hl=!1,Fc=wf=0,pl=null}function Vn(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return en===null?Ge.memoizedState=en=o:en=en.next=o,en}function Zt(){if(bt===null){var o=Ge.alternate;o=o!==null?o.memoizedState:null}else o=bt.next;var l=en===null?Ge.memoizedState:en.next;if(l!==null)en=l,bt=o;else{if(o===null)throw Ge.alternate===null?Error(r(467)):Error(r(310));bt=o,o={memoizedState:bt.memoizedState,baseState:bt.baseState,baseQueue:bt.baseQueue,queue:bt.queue,next:null},en===null?Ge.memoizedState=en=o:en=en.next=o}return en}function xf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function qc(o){var l=Fc;return Fc+=1,pl===null&&(pl=[]),o=kk(pl,o,l),l=Ge,(en===null?l.memoizedState:en.next)===null&&(l=l.alternate,B.H=l===null||l.memoizedState===null?pC:hy),o}function kf(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return qc(o);if(o.$$typeof===A)return kn(o)}throw Error(r(438,String(o)))}function ny(o){var l=null,d=Ge.updateQueue;if(d!==null&&(l=d.memoCache),l==null){var h=Ge.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(l={data:h.data.map(function(v){return v.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),d===null&&(d=xf(),Ge.updateQueue=d),d.memoCache=l,d=l.data[l.index],d===void 0)for(d=l.data[l.index]=Array(o),h=0;h<o;h++)d[h]=Y;return l.index++,d}function zi(o,l){return typeof l=="function"?l(o):l}function Cf(o){var l=Zt();return ry(l,bt,o)}function ry(o,l,d){var h=o.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=d;var v=o.baseQueue,S=h.pending;if(S!==null){if(v!==null){var C=v.next;v.next=S.next,S.next=C}l.baseQueue=v=S,h.pending=null}if(S=o.baseState,v===null)o.memoizedState=S;else{l=v.next;var M=C=null,L=null,F=l,J=!1;do{var ee=F.lane&-536870913;if(ee!==F.lane?(et&ee)===ee:(Li&ee)===ee){var q=F.revertLane;if(q===0)L!==null&&(L=L.next={lane:0,revertLane:0,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),ee===ll&&(J=!0);else if((Li&q)===q){F=F.next,q===ll&&(J=!0);continue}else ee={lane:0,revertLane:F.revertLane,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},L===null?(M=L=ee,C=S):L=L.next=ee,Ge.lanes|=q,Ps|=q;ee=F.action,ea&&d(S,ee),S=F.hasEagerState?F.eagerState:d(S,ee)}else q={lane:ee,revertLane:F.revertLane,gesture:F.gesture,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},L===null?(M=L=q,C=S):L=L.next=q,Ge.lanes|=ee,Ps|=ee;F=F.next}while(F!==null&&F!==l);if(L===null?C=S:L.next=M,!lr(S,o.memoizedState)&&(tn=!0,J&&(d=cl,d!==null)))throw d;o.memoizedState=S,o.baseState=C,o.baseQueue=L,h.lastRenderedState=S}return v===null&&(h.lanes=0),[o.memoizedState,h.dispatch]}function iy(o){var l=Zt(),d=l.queue;if(d===null)throw Error(r(311));d.lastRenderedReducer=o;var h=d.dispatch,v=d.pending,S=l.memoizedState;if(v!==null){d.pending=null;var C=v=v.next;do S=o(S,C.action),C=C.next;while(C!==v);lr(S,l.memoizedState)||(tn=!0),l.memoizedState=S,l.baseQueue===null&&(l.baseState=S),d.lastRenderedState=S}return[S,h]}function Ik(o,l,d){var h=Ge,v=Zt(),S=nt;if(S){if(d===void 0)throw Error(r(407));d=d()}else d=l();var C=!lr((bt||v).memoizedState,d);if(C&&(v.memoizedState=d,tn=!0),v=v.queue,ay(Pk.bind(null,h,v,o),[o]),v.getSnapshot!==l||C||en!==null&&en.memoizedState.tag&1){if(h.flags|=2048,ml(9,{destroy:void 0},zk.bind(null,h,v,d,l),null),Ct===null)throw Error(r(349));S||(Li&127)!==0||Lk(h,l,d)}return d}function Lk(o,l,d){o.flags|=16384,o={getSnapshot:l,value:d},l=Ge.updateQueue,l===null?(l=xf(),Ge.updateQueue=l,l.stores=[o]):(d=l.stores,d===null?l.stores=[o]:d.push(o))}function zk(o,l,d,h){l.value=d,l.getSnapshot=h,jk(l)&&Bk(o)}function Pk(o,l,d){return d(function(){jk(l)&&Bk(o)})}function jk(o){var l=o.getSnapshot;o=o.value;try{var d=l();return!lr(o,d)}catch{return!0}}function Bk(o){var l=qo(o,2);l!==null&&ir(l,o,2)}function sy(o){var l=Vn();if(typeof o=="function"){var d=o;if(o=d(),ea){oe(!0);try{d()}finally{oe(!1)}}}return l.memoizedState=l.baseState=o,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zi,lastRenderedState:o},l}function $k(o,l,d,h){return o.baseState=d,ry(o,bt,typeof h=="function"?h:zi)}function dz(o,l,d,h,v){if(_f(o))throw Error(r(485));if(o=l.action,o!==null){var S={payload:v,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(C){S.listeners.push(C)}};B.T!==null?d(!0):S.isTransition=!1,h(S),d=l.pending,d===null?(S.next=l.pending=S,Vk(l,S)):(S.next=d.next,l.pending=d.next=S)}}function Vk(o,l){var d=l.action,h=l.payload,v=o.state;if(l.isTransition){var S=B.T,C={};B.T=C;try{var M=d(v,h),L=B.S;L!==null&&L(C,M),Hk(o,l,M)}catch(F){oy(o,l,F)}finally{S!==null&&C.types!==null&&(S.types=C.types),B.T=S}}else try{S=d(v,h),Hk(o,l,S)}catch(F){oy(o,l,F)}}function Hk(o,l,d){d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(function(h){Uk(o,l,h)},function(h){return oy(o,l,h)}):Uk(o,l,d)}function Uk(o,l,d){l.status="fulfilled",l.value=d,Fk(l),o.state=d,l=o.pending,l!==null&&(d=l.next,d===l?o.pending=null:(d=d.next,l.next=d,Vk(o,d)))}function oy(o,l,d){var h=o.pending;if(o.pending=null,h!==null){h=h.next;do l.status="rejected",l.reason=d,Fk(l),l=l.next;while(l!==h)}o.action=null}function Fk(o){o=o.listeners;for(var l=0;l<o.length;l++)(0,o[l])()}function qk(o,l){return l}function Gk(o,l){if(nt){var d=Ct.formState;if(d!==null){e:{var h=Ge;if(nt){if(Mt){t:{for(var v=Mt,S=Rr;v.nodeType!==8;){if(!S){v=null;break t}if(v=Or(v.nextSibling),v===null){v=null;break t}}S=v.data,v=S==="F!"||S==="F"?v:null}if(v){Mt=Or(v.nextSibling),h=v.data==="F!";break e}}As(h)}h=!1}h&&(l=d[0])}}return d=Vn(),d.memoizedState=d.baseState=l,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qk,lastRenderedState:l},d.queue=h,d=dC.bind(null,Ge,h),h.dispatch=d,h=sy(!1),S=fy.bind(null,Ge,!1,h.queue),h=Vn(),v={state:l,dispatch:null,action:o,pending:null},h.queue=v,d=dz.bind(null,Ge,v,S,d),v.dispatch=d,h.memoizedState=o,[l,d,!1]}function Wk(o){var l=Zt();return Kk(l,bt,o)}function Kk(o,l,d){if(l=ry(o,l,qk)[0],o=Cf(zi)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var h=qc(l)}catch(C){throw C===ul?pf:C}else h=l;l=Zt();var v=l.queue,S=v.dispatch;return d!==l.memoizedState&&(Ge.flags|=2048,ml(9,{destroy:void 0},fz.bind(null,v,d),null)),[h,S,o]}function fz(o,l){o.action=l}function Zk(o){var l=Zt(),d=bt;if(d!==null)return Kk(l,d,o);Zt(),l=l.memoizedState,d=Zt();var h=d.queue.dispatch;return d.memoizedState=o,[l,h,!1]}function ml(o,l,d,h){return o={tag:o,create:d,deps:h,inst:l,next:null},l=Ge.updateQueue,l===null&&(l=xf(),Ge.updateQueue=l),d=l.lastEffect,d===null?l.lastEffect=o.next=o:(h=d.next,d.next=o,o.next=h,l.lastEffect=o),o}function Yk(){return Zt().memoizedState}function Ef(o,l,d,h){var v=Vn();Ge.flags|=o,v.memoizedState=ml(1|l,{destroy:void 0},d,h===void 0?null:h)}function Tf(o,l,d,h){var v=Zt();h=h===void 0?null:h;var S=v.memoizedState.inst;bt!==null&&h!==null&&Xg(h,bt.memoizedState.deps)?v.memoizedState=ml(l,S,d,h):(Ge.flags|=o,v.memoizedState=ml(1|l,S,d,h))}function Xk(o,l){Ef(8390656,8,o,l)}function ay(o,l){Tf(2048,8,o,l)}function hz(o){Ge.flags|=4;var l=Ge.updateQueue;if(l===null)l=xf(),Ge.updateQueue=l,l.events=[o];else{var d=l.events;d===null?l.events=[o]:d.push(o)}}function Jk(o){var l=Zt().memoizedState;return hz({ref:l,nextImpl:o}),function(){if((dt&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}function Qk(o,l){return Tf(4,2,o,l)}function eC(o,l){return Tf(4,4,o,l)}function tC(o,l){if(typeof l=="function"){o=o();var d=l(o);return function(){typeof d=="function"?d():l(null)}}if(l!=null)return o=o(),l.current=o,function(){l.current=null}}function nC(o,l,d){d=d!=null?d.concat([o]):null,Tf(4,4,tC.bind(null,l,o),d)}function ly(){}function rC(o,l){var d=Zt();l=l===void 0?null:l;var h=d.memoizedState;return l!==null&&Xg(l,h[1])?h[0]:(d.memoizedState=[o,l],o)}function iC(o,l){var d=Zt();l=l===void 0?null:l;var h=d.memoizedState;if(l!==null&&Xg(l,h[1]))return h[0];if(h=o(),ea){oe(!0);try{o()}finally{oe(!1)}}return d.memoizedState=[h,l],h}function cy(o,l,d){return d===void 0||(Li&1073741824)!==0&&(et&261930)===0?o.memoizedState=l:(o.memoizedState=d,o=s1(),Ge.lanes|=o,Ps|=o,d)}function sC(o,l,d,h){return lr(d,l)?d:fl.current!==null?(o=cy(o,d,h),lr(o,l)||(tn=!0),o):(Li&42)===0||(Li&1073741824)!==0&&(et&261930)===0?(tn=!0,o.memoizedState=d):(o=s1(),Ge.lanes|=o,Ps|=o,l)}function oC(o,l,d,h,v){var S=Z.p;Z.p=S!==0&&8>S?S:8;var C=B.T,M={};B.T=M,fy(o,!1,l,d);try{var L=v(),F=B.S;if(F!==null&&F(M,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var J=lz(L,h);Gc(o,l,J,pr(o))}else Gc(o,l,h,pr(o))}catch(ee){Gc(o,l,{then:function(){},status:"rejected",reason:ee},pr())}finally{Z.p=S,C!==null&&M.types!==null&&(C.types=M.types),B.T=C}}function pz(){}function uy(o,l,d,h){if(o.tag!==5)throw Error(r(476));var v=aC(o).queue;oC(o,v,l,se,d===null?pz:function(){return lC(o),d(h)})}function aC(o){var l=o.memoizedState;if(l!==null)return l;l={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zi,lastRenderedState:se},next:null};var d={};return l.next={memoizedState:d,baseState:d,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zi,lastRenderedState:d},next:null},o.memoizedState=l,o=o.alternate,o!==null&&(o.memoizedState=l),l}function lC(o){var l=aC(o);l.next===null&&(l=o.alternate.memoizedState),Gc(o,l.next.queue,{},pr())}function dy(){return kn(cu)}function cC(){return Zt().memoizedState}function uC(){return Zt().memoizedState}function mz(o){for(var l=o.return;l!==null;){switch(l.tag){case 24:case 3:var d=pr();o=Os(d);var h=Ns(l,o,d);h!==null&&(ir(h,l,d),Vc(h,l,d)),l={cache:$g()},o.payload=l;return}l=l.return}}function gz(o,l,d){var h=pr();d={lane:h,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},_f(o)?fC(l,d):(d=Rg(o,l,d,h),d!==null&&(ir(d,o,h),hC(d,l,h)))}function dC(o,l,d){var h=pr();Gc(o,l,d,h)}function Gc(o,l,d,h){var v={lane:h,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null};if(_f(o))fC(l,v);else{var S=o.alternate;if(o.lanes===0&&(S===null||S.lanes===0)&&(S=l.lastRenderedReducer,S!==null))try{var C=l.lastRenderedState,M=S(C,d);if(v.hasEagerState=!0,v.eagerState=M,lr(M,C))return af(o,l,v,0),Ct===null&&of(),!1}catch{}if(d=Rg(o,l,v,h),d!==null)return ir(d,o,h),hC(d,l,h),!0}return!1}function fy(o,l,d,h){if(h={lane:2,revertLane:Fy(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},_f(o)){if(l)throw Error(r(479))}else l=Rg(o,d,h,2),l!==null&&ir(l,o,2)}function _f(o){var l=o.alternate;return o===Ge||l!==null&&l===Ge}function fC(o,l){hl=Sf=!0;var d=o.pending;d===null?l.next=l:(l.next=d.next,d.next=l),o.pending=l}function hC(o,l,d){if((d&4194048)!==0){var h=l.lanes;h&=o.pendingLanes,d|=h,l.lanes=d,vx(o,d)}}var Wc={readContext:kn,use:kf,useCallback:Vt,useContext:Vt,useEffect:Vt,useImperativeHandle:Vt,useLayoutEffect:Vt,useInsertionEffect:Vt,useMemo:Vt,useReducer:Vt,useRef:Vt,useState:Vt,useDebugValue:Vt,useDeferredValue:Vt,useTransition:Vt,useSyncExternalStore:Vt,useId:Vt,useHostTransitionStatus:Vt,useFormState:Vt,useActionState:Vt,useOptimistic:Vt,useMemoCache:Vt,useCacheRefresh:Vt};Wc.useEffectEvent=Vt;var pC={readContext:kn,use:kf,useCallback:function(o,l){return Vn().memoizedState=[o,l===void 0?null:l],o},useContext:kn,useEffect:Xk,useImperativeHandle:function(o,l,d){d=d!=null?d.concat([o]):null,Ef(4194308,4,tC.bind(null,l,o),d)},useLayoutEffect:function(o,l){return Ef(4194308,4,o,l)},useInsertionEffect:function(o,l){Ef(4,2,o,l)},useMemo:function(o,l){var d=Vn();l=l===void 0?null:l;var h=o();if(ea){oe(!0);try{o()}finally{oe(!1)}}return d.memoizedState=[h,l],h},useReducer:function(o,l,d){var h=Vn();if(d!==void 0){var v=d(l);if(ea){oe(!0);try{d(l)}finally{oe(!1)}}}else v=l;return h.memoizedState=h.baseState=v,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:v},h.queue=o,o=o.dispatch=gz.bind(null,Ge,o),[h.memoizedState,o]},useRef:function(o){var l=Vn();return o={current:o},l.memoizedState=o},useState:function(o){o=sy(o);var l=o.queue,d=dC.bind(null,Ge,l);return l.dispatch=d,[o.memoizedState,d]},useDebugValue:ly,useDeferredValue:function(o,l){var d=Vn();return cy(d,o,l)},useTransition:function(){var o=sy(!1);return o=oC.bind(null,Ge,o.queue,!0,!1),Vn().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,l,d){var h=Ge,v=Vn();if(nt){if(d===void 0)throw Error(r(407));d=d()}else{if(d=l(),Ct===null)throw Error(r(349));(et&127)!==0||Lk(h,l,d)}v.memoizedState=d;var S={value:d,getSnapshot:l};return v.queue=S,Xk(Pk.bind(null,h,S,o),[o]),h.flags|=2048,ml(9,{destroy:void 0},zk.bind(null,h,S,d,l),null),d},useId:function(){var o=Vn(),l=Ct.identifierPrefix;if(nt){var d=di,h=ui;d=(h&~(1<<32-ge(h)-1)).toString(32)+d,l="_"+l+"R_"+d,d=wf++,0<d&&(l+="H"+d.toString(32)),l+="_"}else d=cz++,l="_"+l+"r_"+d.toString(32)+"_";return o.memoizedState=l},useHostTransitionStatus:dy,useFormState:Gk,useActionState:Gk,useOptimistic:function(o){var l=Vn();l.memoizedState=l.baseState=o;var d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=d,l=fy.bind(null,Ge,!0,d),d.dispatch=l,[o,l]},useMemoCache:ny,useCacheRefresh:function(){return Vn().memoizedState=mz.bind(null,Ge)},useEffectEvent:function(o){var l=Vn(),d={impl:o};return l.memoizedState=d,function(){if((dt&2)!==0)throw Error(r(440));return d.impl.apply(void 0,arguments)}}},hy={readContext:kn,use:kf,useCallback:rC,useContext:kn,useEffect:ay,useImperativeHandle:nC,useInsertionEffect:Qk,useLayoutEffect:eC,useMemo:iC,useReducer:Cf,useRef:Yk,useState:function(){return Cf(zi)},useDebugValue:ly,useDeferredValue:function(o,l){var d=Zt();return sC(d,bt.memoizedState,o,l)},useTransition:function(){var o=Cf(zi)[0],l=Zt().memoizedState;return[typeof o=="boolean"?o:qc(o),l]},useSyncExternalStore:Ik,useId:cC,useHostTransitionStatus:dy,useFormState:Wk,useActionState:Wk,useOptimistic:function(o,l){var d=Zt();return $k(d,bt,o,l)},useMemoCache:ny,useCacheRefresh:uC};hy.useEffectEvent=Jk;var mC={readContext:kn,use:kf,useCallback:rC,useContext:kn,useEffect:ay,useImperativeHandle:nC,useInsertionEffect:Qk,useLayoutEffect:eC,useMemo:iC,useReducer:iy,useRef:Yk,useState:function(){return iy(zi)},useDebugValue:ly,useDeferredValue:function(o,l){var d=Zt();return bt===null?cy(d,o,l):sC(d,bt.memoizedState,o,l)},useTransition:function(){var o=iy(zi)[0],l=Zt().memoizedState;return[typeof o=="boolean"?o:qc(o),l]},useSyncExternalStore:Ik,useId:cC,useHostTransitionStatus:dy,useFormState:Zk,useActionState:Zk,useOptimistic:function(o,l){var d=Zt();return bt!==null?$k(d,bt,o,l):(d.baseState=o,[o,d.queue.dispatch])},useMemoCache:ny,useCacheRefresh:uC};mC.useEffectEvent=Jk;function py(o,l,d,h){l=o.memoizedState,d=d(h,l),d=d==null?l:m({},l,d),o.memoizedState=d,o.lanes===0&&(o.updateQueue.baseState=d)}var my={enqueueSetState:function(o,l,d){o=o._reactInternals;var h=pr(),v=Os(h);v.payload=l,d!=null&&(v.callback=d),l=Ns(o,v,h),l!==null&&(ir(l,o,h),Vc(l,o,h))},enqueueReplaceState:function(o,l,d){o=o._reactInternals;var h=pr(),v=Os(h);v.tag=1,v.payload=l,d!=null&&(v.callback=d),l=Ns(o,v,h),l!==null&&(ir(l,o,h),Vc(l,o,h))},enqueueForceUpdate:function(o,l){o=o._reactInternals;var d=pr(),h=Os(d);h.tag=2,l!=null&&(h.callback=l),l=Ns(o,h,d),l!==null&&(ir(l,o,d),Vc(l,o,d))}};function gC(o,l,d,h,v,S,C){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(h,S,C):l.prototype&&l.prototype.isPureReactComponent?!Dc(d,h)||!Dc(v,S):!0}function yC(o,l,d,h){o=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(d,h),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(d,h),l.state!==o&&my.enqueueReplaceState(l,l.state,null)}function ta(o,l){var d=l;if("ref"in l){d={};for(var h in l)h!=="ref"&&(d[h]=l[h])}if(o=o.defaultProps){d===l&&(d=m({},d));for(var v in o)d[v]===void 0&&(d[v]=o[v])}return d}function vC(o){sf(o)}function bC(o){console.error(o)}function SC(o){sf(o)}function Af(o,l){try{var d=o.onUncaughtError;d(l.value,{componentStack:l.stack})}catch(h){setTimeout(function(){throw h})}}function wC(o,l,d){try{var h=o.onCaughtError;h(d.value,{componentStack:d.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function gy(o,l,d){return d=Os(d),d.tag=3,d.payload={element:null},d.callback=function(){Af(o,l)},d}function xC(o){return o=Os(o),o.tag=3,o}function kC(o,l,d,h){var v=d.type.getDerivedStateFromError;if(typeof v=="function"){var S=h.value;o.payload=function(){return v(S)},o.callback=function(){wC(l,d,h)}}var C=d.stateNode;C!==null&&typeof C.componentDidCatch=="function"&&(o.callback=function(){wC(l,d,h),typeof v!="function"&&(js===null?js=new Set([this]):js.add(this));var M=h.stack;this.componentDidCatch(h.value,{componentStack:M!==null?M:""})})}function yz(o,l,d,h,v){if(d.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(l=d.alternate,l!==null&&al(l,d,v,!0),d=ur.current,d!==null){switch(d.tag){case 31:case 13:return Mr===null?$f():d.alternate===null&&Ht===0&&(Ht=3),d.flags&=-257,d.flags|=65536,d.lanes=v,h===mf?d.flags|=16384:(l=d.updateQueue,l===null?d.updateQueue=new Set([h]):l.add(h),Vy(o,h,v)),!1;case 22:return d.flags|=65536,h===mf?d.flags|=16384:(l=d.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([h])},d.updateQueue=l):(d=l.retryQueue,d===null?l.retryQueue=new Set([h]):d.add(h)),Vy(o,h,v)),!1}throw Error(r(435,d.tag))}return Vy(o,h,v),$f(),!1}if(nt)return l=ur.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=v,h!==Lg&&(o=Error(r(422),{cause:h}),zc(Tr(o,d)))):(h!==Lg&&(l=Error(r(423),{cause:h}),zc(Tr(l,d))),o=o.current.alternate,o.flags|=65536,v&=-v,o.lanes|=v,h=Tr(h,d),v=gy(o.stateNode,h,v),Gg(o,v),Ht!==4&&(Ht=2)),!1;var S=Error(r(520),{cause:h});if(S=Tr(S,d),tu===null?tu=[S]:tu.push(S),Ht!==4&&(Ht=2),l===null)return!0;h=Tr(h,d),d=l;do{switch(d.tag){case 3:return d.flags|=65536,o=v&-v,d.lanes|=o,o=gy(d.stateNode,h,o),Gg(d,o),!1;case 1:if(l=d.type,S=d.stateNode,(d.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(js===null||!js.has(S))))return d.flags|=65536,v&=-v,d.lanes|=v,v=xC(v),kC(v,o,d,h),Gg(d,v),!1}d=d.return}while(d!==null);return!1}var yy=Error(r(461)),tn=!1;function Cn(o,l,d,h){l.child=o===null?_k(l,null,d,h):Qo(l,o.child,d,h)}function CC(o,l,d,h,v){d=d.render;var S=l.ref;if("ref"in h){var C={};for(var M in h)M!=="ref"&&(C[M]=h[M])}else C=h;return Zo(l),h=Jg(o,l,d,C,S,v),M=Qg(),o!==null&&!tn?(ey(o,l,v),Pi(o,l,v)):(nt&&M&&Dg(l),l.flags|=1,Cn(o,l,h,v),l.child)}function EC(o,l,d,h,v){if(o===null){var S=d.type;return typeof S=="function"&&!Mg(S)&&S.defaultProps===void 0&&d.compare===null?(l.tag=15,l.type=S,TC(o,l,S,h,v)):(o=cf(d.type,null,h,l,l.mode,v),o.ref=l.ref,o.return=l,l.child=o)}if(S=o.child,!Ey(o,v)){var C=S.memoizedProps;if(d=d.compare,d=d!==null?d:Dc,d(C,h)&&o.ref===l.ref)return Pi(o,l,v)}return l.flags|=1,o=Oi(S,h),o.ref=l.ref,o.return=l,l.child=o}function TC(o,l,d,h,v){if(o!==null){var S=o.memoizedProps;if(Dc(S,h)&&o.ref===l.ref)if(tn=!1,l.pendingProps=h=S,Ey(o,v))(o.flags&131072)!==0&&(tn=!0);else return l.lanes=o.lanes,Pi(o,l,v)}return vy(o,l,d,h,v)}function _C(o,l,d,h){var v=h.children,S=o!==null?o.memoizedState:null;if(o===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((l.flags&128)!==0){if(S=S!==null?S.baseLanes|d:d,o!==null){for(h=l.child=o.child,v=0;h!==null;)v=v|h.lanes|h.childLanes,h=h.sibling;h=v&~S}else h=0,l.child=null;return AC(o,l,S,d,h)}if((d&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},o!==null&&hf(l,S!==null?S.cachePool:null),S!==null?Mk(l,S):Kg(),Ok(l);else return h=l.lanes=536870912,AC(o,l,S!==null?S.baseLanes|d:d,d,h)}else S!==null?(hf(l,S.cachePool),Mk(l,S),Is(),l.memoizedState=null):(o!==null&&hf(l,null),Kg(),Is());return Cn(o,l,v,d),l.child}function Kc(o,l){return o!==null&&o.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function AC(o,l,d,h,v){var S=Hg();return S=S===null?null:{parent:Qt._currentValue,pool:S},l.memoizedState={baseLanes:d,cachePool:S},o!==null&&hf(l,null),Kg(),Ok(l),o!==null&&al(o,l,h,!0),l.childLanes=v,null}function Rf(o,l){return l=Of({mode:l.mode,children:l.children},o.mode),l.ref=o.ref,o.child=l,l.return=o,l}function RC(o,l,d){return Qo(l,o.child,null,d),o=Rf(l,l.pendingProps),o.flags|=2,dr(l),l.memoizedState=null,o}function vz(o,l,d){var h=l.pendingProps,v=(l.flags&128)!==0;if(l.flags&=-129,o===null){if(nt){if(h.mode==="hidden")return o=Rf(l,h),l.lanes=536870912,Kc(null,o);if(Yg(l),(o=Mt)?(o=V1(o,Rr),o=o!==null&&o.data==="&"?o:null,o!==null&&(l.memoizedState={dehydrated:o,treeContext:Ts!==null?{id:ui,overflow:di}:null,retryLane:536870912,hydrationErrors:null},d=fk(o),d.return=l,l.child=d,xn=l,Mt=null)):o=null,o===null)throw As(l);return l.lanes=536870912,null}return Rf(l,h)}var S=o.memoizedState;if(S!==null){var C=S.dehydrated;if(Yg(l),v)if(l.flags&256)l.flags&=-257,l=RC(o,l,d);else if(l.memoizedState!==null)l.child=o.child,l.flags|=128,l=null;else throw Error(r(558));else if(tn||al(o,l,d,!1),v=(d&o.childLanes)!==0,tn||v){if(h=Ct,h!==null&&(C=bx(h,d),C!==0&&C!==S.retryLane))throw S.retryLane=C,qo(o,C),ir(h,o,C),yy;$f(),l=RC(o,l,d)}else o=S.treeContext,Mt=Or(C.nextSibling),xn=l,nt=!0,_s=null,Rr=!1,o!==null&&mk(l,o),l=Rf(l,h),l.flags|=4096;return l}return o=Oi(o.child,{mode:h.mode,children:h.children}),o.ref=l.ref,l.child=o,o.return=l,o}function Mf(o,l){var d=l.ref;if(d===null)o!==null&&o.ref!==null&&(l.flags|=4194816);else{if(typeof d!="function"&&typeof d!="object")throw Error(r(284));(o===null||o.ref!==d)&&(l.flags|=4194816)}}function vy(o,l,d,h,v){return Zo(l),d=Jg(o,l,d,h,void 0,v),h=Qg(),o!==null&&!tn?(ey(o,l,v),Pi(o,l,v)):(nt&&h&&Dg(l),l.flags|=1,Cn(o,l,d,v),l.child)}function MC(o,l,d,h,v,S){return Zo(l),l.updateQueue=null,d=Dk(l,h,d,v),Nk(o),h=Qg(),o!==null&&!tn?(ey(o,l,S),Pi(o,l,S)):(nt&&h&&Dg(l),l.flags|=1,Cn(o,l,d,S),l.child)}function OC(o,l,d,h,v){if(Zo(l),l.stateNode===null){var S=rl,C=d.contextType;typeof C=="object"&&C!==null&&(S=kn(C)),S=new d(h,S),l.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=my,l.stateNode=S,S._reactInternals=l,S=l.stateNode,S.props=h,S.state=l.memoizedState,S.refs={},Fg(l),C=d.contextType,S.context=typeof C=="object"&&C!==null?kn(C):rl,S.state=l.memoizedState,C=d.getDerivedStateFromProps,typeof C=="function"&&(py(l,d,C,h),S.state=l.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(C=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),C!==S.state&&my.enqueueReplaceState(S,S.state,null),Uc(l,h,S,v),Hc(),S.state=l.memoizedState),typeof S.componentDidMount=="function"&&(l.flags|=4194308),h=!0}else if(o===null){S=l.stateNode;var M=l.memoizedProps,L=ta(d,M);S.props=L;var F=S.context,J=d.contextType;C=rl,typeof J=="object"&&J!==null&&(C=kn(J));var ee=d.getDerivedStateFromProps;J=typeof ee=="function"||typeof S.getSnapshotBeforeUpdate=="function",M=l.pendingProps!==M,J||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(M||F!==C)&&yC(l,S,h,C),Ms=!1;var q=l.memoizedState;S.state=q,Uc(l,h,S,v),Hc(),F=l.memoizedState,M||q!==F||Ms?(typeof ee=="function"&&(py(l,d,ee,h),F=l.memoizedState),(L=Ms||gC(l,d,L,h,q,F,C))?(J||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"&&(l.flags|=4194308)):(typeof S.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=h,l.memoizedState=F),S.props=h,S.state=F,S.context=C,h=L):(typeof S.componentDidMount=="function"&&(l.flags|=4194308),h=!1)}else{S=l.stateNode,qg(o,l),C=l.memoizedProps,J=ta(d,C),S.props=J,ee=l.pendingProps,q=S.context,F=d.contextType,L=rl,typeof F=="object"&&F!==null&&(L=kn(F)),M=d.getDerivedStateFromProps,(F=typeof M=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(C!==ee||q!==L)&&yC(l,S,h,L),Ms=!1,q=l.memoizedState,S.state=q,Uc(l,h,S,v),Hc();var W=l.memoizedState;C!==ee||q!==W||Ms||o!==null&&o.dependencies!==null&&df(o.dependencies)?(typeof M=="function"&&(py(l,d,M,h),W=l.memoizedState),(J=Ms||gC(l,d,J,h,q,W,L)||o!==null&&o.dependencies!==null&&df(o.dependencies))?(F||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(h,W,L),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(h,W,L)),typeof S.componentDidUpdate=="function"&&(l.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof S.componentDidUpdate!="function"||C===o.memoizedProps&&q===o.memoizedState||(l.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||C===o.memoizedProps&&q===o.memoizedState||(l.flags|=1024),l.memoizedProps=h,l.memoizedState=W),S.props=h,S.state=W,S.context=L,h=J):(typeof S.componentDidUpdate!="function"||C===o.memoizedProps&&q===o.memoizedState||(l.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||C===o.memoizedProps&&q===o.memoizedState||(l.flags|=1024),h=!1)}return S=h,Mf(o,l),h=(l.flags&128)!==0,S||h?(S=l.stateNode,d=h&&typeof d.getDerivedStateFromError!="function"?null:S.render(),l.flags|=1,o!==null&&h?(l.child=Qo(l,o.child,null,v),l.child=Qo(l,null,d,v)):Cn(o,l,d,v),l.memoizedState=S.state,o=l.child):o=Pi(o,l,v),o}function NC(o,l,d,h){return Wo(),l.flags|=256,Cn(o,l,d,h),l.child}var by={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Sy(o){return{baseLanes:o,cachePool:wk()}}function wy(o,l,d){return o=o!==null?o.childLanes&~d:0,l&&(o|=hr),o}function DC(o,l,d){var h=l.pendingProps,v=!1,S=(l.flags&128)!==0,C;if((C=S)||(C=o!==null&&o.memoizedState===null?!1:(Kt.current&2)!==0),C&&(v=!0,l.flags&=-129),C=(l.flags&32)!==0,l.flags&=-33,o===null){if(nt){if(v?Ds(l):Is(),(o=Mt)?(o=V1(o,Rr),o=o!==null&&o.data!=="&"?o:null,o!==null&&(l.memoizedState={dehydrated:o,treeContext:Ts!==null?{id:ui,overflow:di}:null,retryLane:536870912,hydrationErrors:null},d=fk(o),d.return=l,l.child=d,xn=l,Mt=null)):o=null,o===null)throw As(l);return rv(o)?l.lanes=32:l.lanes=536870912,null}var M=h.children;return h=h.fallback,v?(Is(),v=l.mode,M=Of({mode:"hidden",children:M},v),h=Go(h,v,d,null),M.return=l,h.return=l,M.sibling=h,l.child=M,h=l.child,h.memoizedState=Sy(d),h.childLanes=wy(o,C,d),l.memoizedState=by,Kc(null,h)):(Ds(l),xy(l,M))}var L=o.memoizedState;if(L!==null&&(M=L.dehydrated,M!==null)){if(S)l.flags&256?(Ds(l),l.flags&=-257,l=ky(o,l,d)):l.memoizedState!==null?(Is(),l.child=o.child,l.flags|=128,l=null):(Is(),M=h.fallback,v=l.mode,h=Of({mode:"visible",children:h.children},v),M=Go(M,v,d,null),M.flags|=2,h.return=l,M.return=l,h.sibling=M,l.child=h,Qo(l,o.child,null,d),h=l.child,h.memoizedState=Sy(d),h.childLanes=wy(o,C,d),l.memoizedState=by,l=Kc(null,h));else if(Ds(l),rv(M)){if(C=M.nextSibling&&M.nextSibling.dataset,C)var F=C.dgst;C=F,h=Error(r(419)),h.stack="",h.digest=C,zc({value:h,source:null,stack:null}),l=ky(o,l,d)}else if(tn||al(o,l,d,!1),C=(d&o.childLanes)!==0,tn||C){if(C=Ct,C!==null&&(h=bx(C,d),h!==0&&h!==L.retryLane))throw L.retryLane=h,qo(o,h),ir(C,o,h),yy;nv(M)||$f(),l=ky(o,l,d)}else nv(M)?(l.flags|=192,l.child=o.child,l=null):(o=L.treeContext,Mt=Or(M.nextSibling),xn=l,nt=!0,_s=null,Rr=!1,o!==null&&mk(l,o),l=xy(l,h.children),l.flags|=4096);return l}return v?(Is(),M=h.fallback,v=l.mode,L=o.child,F=L.sibling,h=Oi(L,{mode:"hidden",children:h.children}),h.subtreeFlags=L.subtreeFlags&65011712,F!==null?M=Oi(F,M):(M=Go(M,v,d,null),M.flags|=2),M.return=l,h.return=l,h.sibling=M,l.child=h,Kc(null,h),h=l.child,M=o.child.memoizedState,M===null?M=Sy(d):(v=M.cachePool,v!==null?(L=Qt._currentValue,v=v.parent!==L?{parent:L,pool:L}:v):v=wk(),M={baseLanes:M.baseLanes|d,cachePool:v}),h.memoizedState=M,h.childLanes=wy(o,C,d),l.memoizedState=by,Kc(o.child,h)):(Ds(l),d=o.child,o=d.sibling,d=Oi(d,{mode:"visible",children:h.children}),d.return=l,d.sibling=null,o!==null&&(C=l.deletions,C===null?(l.deletions=[o],l.flags|=16):C.push(o)),l.child=d,l.memoizedState=null,d)}function xy(o,l){return l=Of({mode:"visible",children:l},o.mode),l.return=o,o.child=l}function Of(o,l){return o=cr(22,o,null,l),o.lanes=0,o}function ky(o,l,d){return Qo(l,o.child,null,d),o=xy(l,l.pendingProps.children),o.flags|=2,l.memoizedState=null,o}function IC(o,l,d){o.lanes|=l;var h=o.alternate;h!==null&&(h.lanes|=l),jg(o.return,l,d)}function Cy(o,l,d,h,v,S){var C=o.memoizedState;C===null?o.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:h,tail:d,tailMode:v,treeForkCount:S}:(C.isBackwards=l,C.rendering=null,C.renderingStartTime=0,C.last=h,C.tail=d,C.tailMode=v,C.treeForkCount=S)}function LC(o,l,d){var h=l.pendingProps,v=h.revealOrder,S=h.tail;h=h.children;var C=Kt.current,M=(C&2)!==0;if(M?(C=C&1|2,l.flags|=128):C&=1,le(Kt,C),Cn(o,l,h,d),h=nt?Lc:0,!M&&o!==null&&(o.flags&128)!==0)e:for(o=l.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&IC(o,d,l);else if(o.tag===19)IC(o,d,l);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===l)break e;for(;o.sibling===null;){if(o.return===null||o.return===l)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(v){case"forwards":for(d=l.child,v=null;d!==null;)o=d.alternate,o!==null&&bf(o)===null&&(v=d),d=d.sibling;d=v,d===null?(v=l.child,l.child=null):(v=d.sibling,d.sibling=null),Cy(l,!1,v,d,S,h);break;case"backwards":case"unstable_legacy-backwards":for(d=null,v=l.child,l.child=null;v!==null;){if(o=v.alternate,o!==null&&bf(o)===null){l.child=v;break}o=v.sibling,v.sibling=d,d=v,v=o}Cy(l,!0,d,null,S,h);break;case"together":Cy(l,!1,null,null,void 0,h);break;default:l.memoizedState=null}return l.child}function Pi(o,l,d){if(o!==null&&(l.dependencies=o.dependencies),Ps|=l.lanes,(d&l.childLanes)===0)if(o!==null){if(al(o,l,d,!1),(d&l.childLanes)===0)return null}else return null;if(o!==null&&l.child!==o.child)throw Error(r(153));if(l.child!==null){for(o=l.child,d=Oi(o,o.pendingProps),l.child=d,d.return=l;o.sibling!==null;)o=o.sibling,d=d.sibling=Oi(o,o.pendingProps),d.return=l;d.sibling=null}return l.child}function Ey(o,l){return(o.lanes&l)!==0?!0:(o=o.dependencies,!!(o!==null&&df(o)))}function bz(o,l,d){switch(l.tag){case 3:me(l,l.stateNode.containerInfo),Rs(l,Qt,o.memoizedState.cache),Wo();break;case 27:case 5:it(l);break;case 4:me(l,l.stateNode.containerInfo);break;case 10:Rs(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,Yg(l),null;break;case 13:var h=l.memoizedState;if(h!==null)return h.dehydrated!==null?(Ds(l),l.flags|=128,null):(d&l.child.childLanes)!==0?DC(o,l,d):(Ds(l),o=Pi(o,l,d),o!==null?o.sibling:null);Ds(l);break;case 19:var v=(o.flags&128)!==0;if(h=(d&l.childLanes)!==0,h||(al(o,l,d,!1),h=(d&l.childLanes)!==0),v){if(h)return LC(o,l,d);l.flags|=128}if(v=l.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),le(Kt,Kt.current),h)break;return null;case 22:return l.lanes=0,_C(o,l,d,l.pendingProps);case 24:Rs(l,Qt,o.memoizedState.cache)}return Pi(o,l,d)}function zC(o,l,d){if(o!==null)if(o.memoizedProps!==l.pendingProps)tn=!0;else{if(!Ey(o,d)&&(l.flags&128)===0)return tn=!1,bz(o,l,d);tn=(o.flags&131072)!==0}else tn=!1,nt&&(l.flags&1048576)!==0&&pk(l,Lc,l.index);switch(l.lanes=0,l.tag){case 16:e:{var h=l.pendingProps;if(o=Xo(l.elementType),l.type=o,typeof o=="function")Mg(o)?(h=ta(o,h),l.tag=1,l=OC(null,l,o,h,d)):(l.tag=0,l=vy(null,l,o,h,d));else{if(o!=null){var v=o.$$typeof;if(v===_){l.tag=11,l=CC(null,l,o,h,d);break e}else if(v===I){l.tag=14,l=EC(null,l,o,h,d);break e}}throw l=ie(o)||o,Error(r(306,l,""))}}return l;case 0:return vy(o,l,l.type,l.pendingProps,d);case 1:return h=l.type,v=ta(h,l.pendingProps),OC(o,l,h,v,d);case 3:e:{if(me(l,l.stateNode.containerInfo),o===null)throw Error(r(387));h=l.pendingProps;var S=l.memoizedState;v=S.element,qg(o,l),Uc(l,h,null,d);var C=l.memoizedState;if(h=C.cache,Rs(l,Qt,h),h!==S.cache&&Bg(l,[Qt],d,!0),Hc(),h=C.element,S.isDehydrated)if(S={element:h,isDehydrated:!1,cache:C.cache},l.updateQueue.baseState=S,l.memoizedState=S,l.flags&256){l=NC(o,l,h,d);break e}else if(h!==v){v=Tr(Error(r(424)),l),zc(v),l=NC(o,l,h,d);break e}else for(o=l.stateNode.containerInfo,o.nodeType===9?o=o.body:o=o.nodeName==="HTML"?o.ownerDocument.body:o,Mt=Or(o.firstChild),xn=l,nt=!0,_s=null,Rr=!0,d=_k(l,null,h,d),l.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(Wo(),h===v){l=Pi(o,l,d);break e}Cn(o,l,h,d)}l=l.child}return l;case 26:return Mf(o,l),o===null?(d=W1(l.type,null,l.pendingProps,null))?l.memoizedState=d:nt||(d=l.type,o=l.pendingProps,h=Wf(de.current).createElement(d),h[wn]=l,h[Jn]=o,En(h,d,o),dn(h),l.stateNode=h):l.memoizedState=W1(l.type,o.memoizedProps,l.pendingProps,o.memoizedState),null;case 27:return it(l),o===null&&nt&&(h=l.stateNode=F1(l.type,l.pendingProps,de.current),xn=l,Rr=!0,v=Mt,Hs(l.type)?(iv=v,Mt=Or(h.firstChild)):Mt=v),Cn(o,l,l.pendingProps.children,d),Mf(o,l),o===null&&(l.flags|=4194304),l.child;case 5:return o===null&&nt&&((v=h=Mt)&&(h=Zz(h,l.type,l.pendingProps,Rr),h!==null?(l.stateNode=h,xn=l,Mt=Or(h.firstChild),Rr=!1,v=!0):v=!1),v||As(l)),it(l),v=l.type,S=l.pendingProps,C=o!==null?o.memoizedProps:null,h=S.children,Qy(v,S)?h=null:C!==null&&Qy(v,C)&&(l.flags|=32),l.memoizedState!==null&&(v=Jg(o,l,uz,null,null,d),cu._currentValue=v),Mf(o,l),Cn(o,l,h,d),l.child;case 6:return o===null&&nt&&((o=d=Mt)&&(d=Yz(d,l.pendingProps,Rr),d!==null?(l.stateNode=d,xn=l,Mt=null,o=!0):o=!1),o||As(l)),null;case 13:return DC(o,l,d);case 4:return me(l,l.stateNode.containerInfo),h=l.pendingProps,o===null?l.child=Qo(l,null,h,d):Cn(o,l,h,d),l.child;case 11:return CC(o,l,l.type,l.pendingProps,d);case 7:return Cn(o,l,l.pendingProps,d),l.child;case 8:return Cn(o,l,l.pendingProps.children,d),l.child;case 12:return Cn(o,l,l.pendingProps.children,d),l.child;case 10:return h=l.pendingProps,Rs(l,l.type,h.value),Cn(o,l,h.children,d),l.child;case 9:return v=l.type._context,h=l.pendingProps.children,Zo(l),v=kn(v),h=h(v),l.flags|=1,Cn(o,l,h,d),l.child;case 14:return EC(o,l,l.type,l.pendingProps,d);case 15:return TC(o,l,l.type,l.pendingProps,d);case 19:return LC(o,l,d);case 31:return vz(o,l,d);case 22:return _C(o,l,d,l.pendingProps);case 24:return Zo(l),h=kn(Qt),o===null?(v=Hg(),v===null&&(v=Ct,S=$g(),v.pooledCache=S,S.refCount++,S!==null&&(v.pooledCacheLanes|=d),v=S),l.memoizedState={parent:h,cache:v},Fg(l),Rs(l,Qt,v)):((o.lanes&d)!==0&&(qg(o,l),Uc(l,null,null,d),Hc()),v=o.memoizedState,S=l.memoizedState,v.parent!==h?(v={parent:h,cache:h},l.memoizedState=v,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=v),Rs(l,Qt,h)):(h=S.cache,Rs(l,Qt,h),h!==v.cache&&Bg(l,[Qt],d,!0))),Cn(o,l,l.pendingProps.children,d),l.child;case 29:throw l.pendingProps}throw Error(r(156,l.tag))}function ji(o){o.flags|=4}function Ty(o,l,d,h,v){if((l=(o.mode&32)!==0)&&(l=!1),l){if(o.flags|=16777216,(v&335544128)===v)if(o.stateNode.complete)o.flags|=8192;else if(c1())o.flags|=8192;else throw Jo=mf,Ug}else o.flags&=-16777217}function PC(o,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!J1(l))if(c1())o.flags|=8192;else throw Jo=mf,Ug}function Nf(o,l){l!==null&&(o.flags|=4),o.flags&16384&&(l=o.tag!==22?Wd():536870912,o.lanes|=l,bl|=l)}function Zc(o,l){if(!nt)switch(o.tailMode){case"hidden":l=o.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?o.tail=null:d.sibling=null;break;case"collapsed":d=o.tail;for(var h=null;d!==null;)d.alternate!==null&&(h=d),d=d.sibling;h===null?l||o.tail===null?o.tail=null:o.tail.sibling=null:h.sibling=null}}function Ot(o){var l=o.alternate!==null&&o.alternate.child===o.child,d=0,h=0;if(l)for(var v=o.child;v!==null;)d|=v.lanes|v.childLanes,h|=v.subtreeFlags&65011712,h|=v.flags&65011712,v.return=o,v=v.sibling;else for(v=o.child;v!==null;)d|=v.lanes|v.childLanes,h|=v.subtreeFlags,h|=v.flags,v.return=o,v=v.sibling;return o.subtreeFlags|=h,o.childLanes=d,l}function Sz(o,l,d){var h=l.pendingProps;switch(Ig(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ot(l),null;case 1:return Ot(l),null;case 3:return d=l.stateNode,h=null,o!==null&&(h=o.memoizedState.cache),l.memoizedState.cache!==h&&(l.flags|=2048),Ii(Qt),Ee(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(o===null||o.child===null)&&(ol(l)?ji(l):o===null||o.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,zg())),Ot(l),null;case 26:var v=l.type,S=l.memoizedState;return o===null?(ji(l),S!==null?(Ot(l),PC(l,S)):(Ot(l),Ty(l,v,null,h,d))):S?S!==o.memoizedState?(ji(l),Ot(l),PC(l,S)):(Ot(l),l.flags&=-16777217):(o=o.memoizedProps,o!==h&&ji(l),Ot(l),Ty(l,v,o,h,d)),null;case 27:if(Ke(l),d=de.current,v=l.type,o!==null&&l.stateNode!=null)o.memoizedProps!==h&&ji(l);else{if(!h){if(l.stateNode===null)throw Error(r(166));return Ot(l),null}o=ve.current,ol(l)?gk(l):(o=F1(v,h,d),l.stateNode=o,ji(l))}return Ot(l),null;case 5:if(Ke(l),v=l.type,o!==null&&l.stateNode!=null)o.memoizedProps!==h&&ji(l);else{if(!h){if(l.stateNode===null)throw Error(r(166));return Ot(l),null}if(S=ve.current,ol(l))gk(l);else{var C=Wf(de.current);switch(S){case 1:S=C.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:S=C.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":S=C.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":S=C.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":S=C.createElement("div"),S.innerHTML="<script><\/script>",S=S.removeChild(S.firstChild);break;case"select":S=typeof h.is=="string"?C.createElement("select",{is:h.is}):C.createElement("select"),h.multiple?S.multiple=!0:h.size&&(S.size=h.size);break;default:S=typeof h.is=="string"?C.createElement(v,{is:h.is}):C.createElement(v)}}S[wn]=l,S[Jn]=h;e:for(C=l.child;C!==null;){if(C.tag===5||C.tag===6)S.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===l)break e;for(;C.sibling===null;){if(C.return===null||C.return===l)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}l.stateNode=S;e:switch(En(S,v,h),v){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&ji(l)}}return Ot(l),Ty(l,l.type,o===null?null:o.memoizedProps,l.pendingProps,d),null;case 6:if(o&&l.stateNode!=null)o.memoizedProps!==h&&ji(l);else{if(typeof h!="string"&&l.stateNode===null)throw Error(r(166));if(o=de.current,ol(l)){if(o=l.stateNode,d=l.memoizedProps,h=null,v=xn,v!==null)switch(v.tag){case 27:case 5:h=v.memoizedProps}o[wn]=l,o=!!(o.nodeValue===d||h!==null&&h.suppressHydrationWarning===!0||D1(o.nodeValue,d)),o||As(l,!0)}else o=Wf(o).createTextNode(h),o[wn]=l,l.stateNode=o}return Ot(l),null;case 31:if(d=l.memoizedState,o===null||o.memoizedState!==null){if(h=ol(l),d!==null){if(o===null){if(!h)throw Error(r(318));if(o=l.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[wn]=l}else Wo(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ot(l),o=!1}else d=zg(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=d),o=!0;if(!o)return l.flags&256?(dr(l),l):(dr(l),null);if((l.flags&128)!==0)throw Error(r(558))}return Ot(l),null;case 13:if(h=l.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(v=ol(l),h!==null&&h.dehydrated!==null){if(o===null){if(!v)throw Error(r(318));if(v=l.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(r(317));v[wn]=l}else Wo(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Ot(l),v=!1}else v=zg(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=v),v=!0;if(!v)return l.flags&256?(dr(l),l):(dr(l),null)}return dr(l),(l.flags&128)!==0?(l.lanes=d,l):(d=h!==null,o=o!==null&&o.memoizedState!==null,d&&(h=l.child,v=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(v=h.alternate.memoizedState.cachePool.pool),S=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(S=h.memoizedState.cachePool.pool),S!==v&&(h.flags|=2048)),d!==o&&d&&(l.child.flags|=8192),Nf(l,l.updateQueue),Ot(l),null);case 4:return Ee(),o===null&&Ky(l.stateNode.containerInfo),Ot(l),null;case 10:return Ii(l.type),Ot(l),null;case 19:if(K(Kt),h=l.memoizedState,h===null)return Ot(l),null;if(v=(l.flags&128)!==0,S=h.rendering,S===null)if(v)Zc(h,!1);else{if(Ht!==0||o!==null&&(o.flags&128)!==0)for(o=l.child;o!==null;){if(S=bf(o),S!==null){for(l.flags|=128,Zc(h,!1),o=S.updateQueue,l.updateQueue=o,Nf(l,o),l.subtreeFlags=0,o=d,d=l.child;d!==null;)dk(d,o),d=d.sibling;return le(Kt,Kt.current&1|2),nt&&Ni(l,h.treeForkCount),l.child}o=o.sibling}h.tail!==null&&Jt()>Pf&&(l.flags|=128,v=!0,Zc(h,!1),l.lanes=4194304)}else{if(!v)if(o=bf(S),o!==null){if(l.flags|=128,v=!0,o=o.updateQueue,l.updateQueue=o,Nf(l,o),Zc(h,!0),h.tail===null&&h.tailMode==="hidden"&&!S.alternate&&!nt)return Ot(l),null}else 2*Jt()-h.renderingStartTime>Pf&&d!==536870912&&(l.flags|=128,v=!0,Zc(h,!1),l.lanes=4194304);h.isBackwards?(S.sibling=l.child,l.child=S):(o=h.last,o!==null?o.sibling=S:l.child=S,h.last=S)}return h.tail!==null?(o=h.tail,h.rendering=o,h.tail=o.sibling,h.renderingStartTime=Jt(),o.sibling=null,d=Kt.current,le(Kt,v?d&1|2:d&1),nt&&Ni(l,h.treeForkCount),o):(Ot(l),null);case 22:case 23:return dr(l),Zg(),h=l.memoizedState!==null,o!==null?o.memoizedState!==null!==h&&(l.flags|=8192):h&&(l.flags|=8192),h?(d&536870912)!==0&&(l.flags&128)===0&&(Ot(l),l.subtreeFlags&6&&(l.flags|=8192)):Ot(l),d=l.updateQueue,d!==null&&Nf(l,d.retryQueue),d=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),h=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==d&&(l.flags|=2048),o!==null&&K(Yo),null;case 24:return d=null,o!==null&&(d=o.memoizedState.cache),l.memoizedState.cache!==d&&(l.flags|=2048),Ii(Qt),Ot(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function wz(o,l){switch(Ig(l),l.tag){case 1:return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 3:return Ii(Qt),Ee(),o=l.flags,(o&65536)!==0&&(o&128)===0?(l.flags=o&-65537|128,l):null;case 26:case 27:case 5:return Ke(l),null;case 31:if(l.memoizedState!==null){if(dr(l),l.alternate===null)throw Error(r(340));Wo()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 13:if(dr(l),o=l.memoizedState,o!==null&&o.dehydrated!==null){if(l.alternate===null)throw Error(r(340));Wo()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 19:return K(Kt),null;case 4:return Ee(),null;case 10:return Ii(l.type),null;case 22:case 23:return dr(l),Zg(),o!==null&&K(Yo),o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 24:return Ii(Qt),null;case 25:return null;default:return null}}function jC(o,l){switch(Ig(l),l.tag){case 3:Ii(Qt),Ee();break;case 26:case 27:case 5:Ke(l);break;case 4:Ee();break;case 31:l.memoizedState!==null&&dr(l);break;case 13:dr(l);break;case 19:K(Kt);break;case 10:Ii(l.type);break;case 22:case 23:dr(l),Zg(),o!==null&&K(Yo);break;case 24:Ii(Qt)}}function Yc(o,l){try{var d=l.updateQueue,h=d!==null?d.lastEffect:null;if(h!==null){var v=h.next;d=v;do{if((d.tag&o)===o){h=void 0;var S=d.create,C=d.inst;h=S(),C.destroy=h}d=d.next}while(d!==v)}}catch(M){gt(l,l.return,M)}}function Ls(o,l,d){try{var h=l.updateQueue,v=h!==null?h.lastEffect:null;if(v!==null){var S=v.next;h=S;do{if((h.tag&o)===o){var C=h.inst,M=C.destroy;if(M!==void 0){C.destroy=void 0,v=l;var L=d,F=M;try{F()}catch(J){gt(v,L,J)}}}h=h.next}while(h!==S)}}catch(J){gt(l,l.return,J)}}function BC(o){var l=o.updateQueue;if(l!==null){var d=o.stateNode;try{Rk(l,d)}catch(h){gt(o,o.return,h)}}}function $C(o,l,d){d.props=ta(o.type,o.memoizedProps),d.state=o.memoizedState;try{d.componentWillUnmount()}catch(h){gt(o,l,h)}}function Xc(o,l){try{var d=o.ref;if(d!==null){switch(o.tag){case 26:case 27:case 5:var h=o.stateNode;break;case 30:h=o.stateNode;break;default:h=o.stateNode}typeof d=="function"?o.refCleanup=d(h):d.current=h}}catch(v){gt(o,l,v)}}function fi(o,l){var d=o.ref,h=o.refCleanup;if(d!==null)if(typeof h=="function")try{h()}catch(v){gt(o,l,v)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof d=="function")try{d(null)}catch(v){gt(o,l,v)}else d.current=null}function VC(o){var l=o.type,d=o.memoizedProps,h=o.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":d.autoFocus&&h.focus();break e;case"img":d.src?h.src=d.src:d.srcSet&&(h.srcset=d.srcSet)}}catch(v){gt(o,o.return,v)}}function _y(o,l,d){try{var h=o.stateNode;Uz(h,o.type,d,l),h[Jn]=l}catch(v){gt(o,o.return,v)}}function HC(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Hs(o.type)||o.tag===4}function Ay(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||HC(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Hs(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Ry(o,l,d){var h=o.tag;if(h===5||h===6)o=o.stateNode,l?(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d).insertBefore(o,l):(l=d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,l.appendChild(o),d=d._reactRootContainer,d!=null||l.onclick!==null||(l.onclick=Ri));else if(h!==4&&(h===27&&Hs(o.type)&&(d=o.stateNode,l=null),o=o.child,o!==null))for(Ry(o,l,d),o=o.sibling;o!==null;)Ry(o,l,d),o=o.sibling}function Df(o,l,d){var h=o.tag;if(h===5||h===6)o=o.stateNode,l?d.insertBefore(o,l):d.appendChild(o);else if(h!==4&&(h===27&&Hs(o.type)&&(d=o.stateNode),o=o.child,o!==null))for(Df(o,l,d),o=o.sibling;o!==null;)Df(o,l,d),o=o.sibling}function UC(o){var l=o.stateNode,d=o.memoizedProps;try{for(var h=o.type,v=l.attributes;v.length;)l.removeAttributeNode(v[0]);En(l,h,d),l[wn]=o,l[Jn]=d}catch(S){gt(o,o.return,S)}}var Bi=!1,nn=!1,My=!1,FC=typeof WeakSet=="function"?WeakSet:Set,fn=null;function xz(o,l){if(o=o.containerInfo,Xy=eh,o=nk(o),kg(o)){if("selectionStart"in o)var d={start:o.selectionStart,end:o.selectionEnd};else e:{d=(d=o.ownerDocument)&&d.defaultView||window;var h=d.getSelection&&d.getSelection();if(h&&h.rangeCount!==0){d=h.anchorNode;var v=h.anchorOffset,S=h.focusNode;h=h.focusOffset;try{d.nodeType,S.nodeType}catch{d=null;break e}var C=0,M=-1,L=-1,F=0,J=0,ee=o,q=null;t:for(;;){for(var W;ee!==d||v!==0&&ee.nodeType!==3||(M=C+v),ee!==S||h!==0&&ee.nodeType!==3||(L=C+h),ee.nodeType===3&&(C+=ee.nodeValue.length),(W=ee.firstChild)!==null;)q=ee,ee=W;for(;;){if(ee===o)break t;if(q===d&&++F===v&&(M=C),q===S&&++J===h&&(L=C),(W=ee.nextSibling)!==null)break;ee=q,q=ee.parentNode}ee=W}d=M===-1||L===-1?null:{start:M,end:L}}else d=null}d=d||{start:0,end:0}}else d=null;for(Jy={focusedElem:o,selectionRange:d},eh=!1,fn=l;fn!==null;)if(l=fn,o=l.child,(l.subtreeFlags&1028)!==0&&o!==null)o.return=l,fn=o;else for(;fn!==null;){switch(l=fn,S=l.alternate,o=l.flags,l.tag){case 0:if((o&4)!==0&&(o=l.updateQueue,o=o!==null?o.events:null,o!==null))for(d=0;d<o.length;d++)v=o[d],v.ref.impl=v.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&S!==null){o=void 0,d=l,v=S.memoizedProps,S=S.memoizedState,h=d.stateNode;try{var Te=ta(d.type,v);o=h.getSnapshotBeforeUpdate(Te,S),h.__reactInternalSnapshotBeforeUpdate=o}catch(Pe){gt(d,d.return,Pe)}}break;case 3:if((o&1024)!==0){if(o=l.stateNode.containerInfo,d=o.nodeType,d===9)tv(o);else if(d===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":tv(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(r(163))}if(o=l.sibling,o!==null){o.return=l.return,fn=o;break}fn=l.return}}function qC(o,l,d){var h=d.flags;switch(d.tag){case 0:case 11:case 15:Vi(o,d),h&4&&Yc(5,d);break;case 1:if(Vi(o,d),h&4)if(o=d.stateNode,l===null)try{o.componentDidMount()}catch(C){gt(d,d.return,C)}else{var v=ta(d.type,l.memoizedProps);l=l.memoizedState;try{o.componentDidUpdate(v,l,o.__reactInternalSnapshotBeforeUpdate)}catch(C){gt(d,d.return,C)}}h&64&&BC(d),h&512&&Xc(d,d.return);break;case 3:if(Vi(o,d),h&64&&(o=d.updateQueue,o!==null)){if(l=null,d.child!==null)switch(d.child.tag){case 27:case 5:l=d.child.stateNode;break;case 1:l=d.child.stateNode}try{Rk(o,l)}catch(C){gt(d,d.return,C)}}break;case 27:l===null&&h&4&&UC(d);case 26:case 5:Vi(o,d),l===null&&h&4&&VC(d),h&512&&Xc(d,d.return);break;case 12:Vi(o,d);break;case 31:Vi(o,d),h&4&&KC(o,d);break;case 13:Vi(o,d),h&4&&ZC(o,d),h&64&&(o=d.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(d=Oz.bind(null,d),Xz(o,d))));break;case 22:if(h=d.memoizedState!==null||Bi,!h){l=l!==null&&l.memoizedState!==null||nn,v=Bi;var S=nn;Bi=h,(nn=l)&&!S?Hi(o,d,(d.subtreeFlags&8772)!==0):Vi(o,d),Bi=v,nn=S}break;case 30:break;default:Vi(o,d)}}function GC(o){var l=o.alternate;l!==null&&(o.alternate=null,GC(l)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(l=o.stateNode,l!==null&&og(l)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var Lt=null,er=!1;function $i(o,l,d){for(d=d.child;d!==null;)WC(o,l,d),d=d.sibling}function WC(o,l,d){if(re&&typeof re.onCommitFiberUnmount=="function")try{re.onCommitFiberUnmount(H,d)}catch{}switch(d.tag){case 26:nn||fi(d,l),$i(o,l,d),d.memoizedState?d.memoizedState.count--:d.stateNode&&(d=d.stateNode,d.parentNode.removeChild(d));break;case 27:nn||fi(d,l);var h=Lt,v=er;Hs(d.type)&&(Lt=d.stateNode,er=!1),$i(o,l,d),ou(d.stateNode),Lt=h,er=v;break;case 5:nn||fi(d,l);case 6:if(h=Lt,v=er,Lt=null,$i(o,l,d),Lt=h,er=v,Lt!==null)if(er)try{(Lt.nodeType===9?Lt.body:Lt.nodeName==="HTML"?Lt.ownerDocument.body:Lt).removeChild(d.stateNode)}catch(S){gt(d,l,S)}else try{Lt.removeChild(d.stateNode)}catch(S){gt(d,l,S)}break;case 18:Lt!==null&&(er?(o=Lt,B1(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,d.stateNode),_l(o)):B1(Lt,d.stateNode));break;case 4:h=Lt,v=er,Lt=d.stateNode.containerInfo,er=!0,$i(o,l,d),Lt=h,er=v;break;case 0:case 11:case 14:case 15:Ls(2,d,l),nn||Ls(4,d,l),$i(o,l,d);break;case 1:nn||(fi(d,l),h=d.stateNode,typeof h.componentWillUnmount=="function"&&$C(d,l,h)),$i(o,l,d);break;case 21:$i(o,l,d);break;case 22:nn=(h=nn)||d.memoizedState!==null,$i(o,l,d),nn=h;break;default:$i(o,l,d)}}function KC(o,l){if(l.memoizedState===null&&(o=l.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{_l(o)}catch(d){gt(l,l.return,d)}}}function ZC(o,l){if(l.memoizedState===null&&(o=l.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{_l(o)}catch(d){gt(l,l.return,d)}}function kz(o){switch(o.tag){case 31:case 13:case 19:var l=o.stateNode;return l===null&&(l=o.stateNode=new FC),l;case 22:return o=o.stateNode,l=o._retryCache,l===null&&(l=o._retryCache=new FC),l;default:throw Error(r(435,o.tag))}}function If(o,l){var d=kz(o);l.forEach(function(h){if(!d.has(h)){d.add(h);var v=Nz.bind(null,o,h);h.then(v,v)}})}function tr(o,l){var d=l.deletions;if(d!==null)for(var h=0;h<d.length;h++){var v=d[h],S=o,C=l,M=C;e:for(;M!==null;){switch(M.tag){case 27:if(Hs(M.type)){Lt=M.stateNode,er=!1;break e}break;case 5:Lt=M.stateNode,er=!1;break e;case 3:case 4:Lt=M.stateNode.containerInfo,er=!0;break e}M=M.return}if(Lt===null)throw Error(r(160));WC(S,C,v),Lt=null,er=!1,S=v.alternate,S!==null&&(S.return=null),v.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)YC(l,o),l=l.sibling}var Gr=null;function YC(o,l){var d=o.alternate,h=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:tr(l,o),nr(o),h&4&&(Ls(3,o,o.return),Yc(3,o),Ls(5,o,o.return));break;case 1:tr(l,o),nr(o),h&512&&(nn||d===null||fi(d,d.return)),h&64&&Bi&&(o=o.updateQueue,o!==null&&(h=o.callbacks,h!==null&&(d=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=d===null?h:d.concat(h))));break;case 26:var v=Gr;if(tr(l,o),nr(o),h&512&&(nn||d===null||fi(d,d.return)),h&4){var S=d!==null?d.memoizedState:null;if(h=o.memoizedState,d===null)if(h===null)if(o.stateNode===null){e:{h=o.type,d=o.memoizedProps,v=v.ownerDocument||v;t:switch(h){case"title":S=v.getElementsByTagName("title")[0],(!S||S[Cc]||S[wn]||S.namespaceURI==="http://www.w3.org/2000/svg"||S.hasAttribute("itemprop"))&&(S=v.createElement(h),v.head.insertBefore(S,v.querySelector("head > title"))),En(S,h,d),S[wn]=o,dn(S),h=S;break e;case"link":var C=Y1("link","href",v).get(h+(d.href||""));if(C){for(var M=0;M<C.length;M++)if(S=C[M],S.getAttribute("href")===(d.href==null||d.href===""?null:d.href)&&S.getAttribute("rel")===(d.rel==null?null:d.rel)&&S.getAttribute("title")===(d.title==null?null:d.title)&&S.getAttribute("crossorigin")===(d.crossOrigin==null?null:d.crossOrigin)){C.splice(M,1);break t}}S=v.createElement(h),En(S,h,d),v.head.appendChild(S);break;case"meta":if(C=Y1("meta","content",v).get(h+(d.content||""))){for(M=0;M<C.length;M++)if(S=C[M],S.getAttribute("content")===(d.content==null?null:""+d.content)&&S.getAttribute("name")===(d.name==null?null:d.name)&&S.getAttribute("property")===(d.property==null?null:d.property)&&S.getAttribute("http-equiv")===(d.httpEquiv==null?null:d.httpEquiv)&&S.getAttribute("charset")===(d.charSet==null?null:d.charSet)){C.splice(M,1);break t}}S=v.createElement(h),En(S,h,d),v.head.appendChild(S);break;default:throw Error(r(468,h))}S[wn]=o,dn(S),h=S}o.stateNode=h}else X1(v,o.type,o.stateNode);else o.stateNode=Z1(v,h,o.memoizedProps);else S!==h?(S===null?d.stateNode!==null&&(d=d.stateNode,d.parentNode.removeChild(d)):S.count--,h===null?X1(v,o.type,o.stateNode):Z1(v,h,o.memoizedProps)):h===null&&o.stateNode!==null&&_y(o,o.memoizedProps,d.memoizedProps)}break;case 27:tr(l,o),nr(o),h&512&&(nn||d===null||fi(d,d.return)),d!==null&&h&4&&_y(o,o.memoizedProps,d.memoizedProps);break;case 5:if(tr(l,o),nr(o),h&512&&(nn||d===null||fi(d,d.return)),o.flags&32){v=o.stateNode;try{Ya(v,"")}catch(Te){gt(o,o.return,Te)}}h&4&&o.stateNode!=null&&(v=o.memoizedProps,_y(o,v,d!==null?d.memoizedProps:v)),h&1024&&(My=!0);break;case 6:if(tr(l,o),nr(o),h&4){if(o.stateNode===null)throw Error(r(162));h=o.memoizedProps,d=o.stateNode;try{d.nodeValue=h}catch(Te){gt(o,o.return,Te)}}break;case 3:if(Yf=null,v=Gr,Gr=Kf(l.containerInfo),tr(l,o),Gr=v,nr(o),h&4&&d!==null&&d.memoizedState.isDehydrated)try{_l(l.containerInfo)}catch(Te){gt(o,o.return,Te)}My&&(My=!1,XC(o));break;case 4:h=Gr,Gr=Kf(o.stateNode.containerInfo),tr(l,o),nr(o),Gr=h;break;case 12:tr(l,o),nr(o);break;case 31:tr(l,o),nr(o),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,If(o,h)));break;case 13:tr(l,o),nr(o),o.child.flags&8192&&o.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(zf=Jt()),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,If(o,h)));break;case 22:v=o.memoizedState!==null;var L=d!==null&&d.memoizedState!==null,F=Bi,J=nn;if(Bi=F||v,nn=J||L,tr(l,o),nn=J,Bi=F,nr(o),h&8192)e:for(l=o.stateNode,l._visibility=v?l._visibility&-2:l._visibility|1,v&&(d===null||L||Bi||nn||na(o)),d=null,l=o;;){if(l.tag===5||l.tag===26){if(d===null){L=d=l;try{if(S=L.stateNode,v)C=S.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none";else{M=L.stateNode;var ee=L.memoizedProps.style,q=ee!=null&&ee.hasOwnProperty("display")?ee.display:null;M.style.display=q==null||typeof q=="boolean"?"":(""+q).trim()}}catch(Te){gt(L,L.return,Te)}}}else if(l.tag===6){if(d===null){L=l;try{L.stateNode.nodeValue=v?"":L.memoizedProps}catch(Te){gt(L,L.return,Te)}}}else if(l.tag===18){if(d===null){L=l;try{var W=L.stateNode;v?$1(W,!0):$1(L.stateNode,!1)}catch(Te){gt(L,L.return,Te)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===o)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break e;for(;l.sibling===null;){if(l.return===null||l.return===o)break e;d===l&&(d=null),l=l.return}d===l&&(d=null),l.sibling.return=l.return,l=l.sibling}h&4&&(h=o.updateQueue,h!==null&&(d=h.retryQueue,d!==null&&(h.retryQueue=null,If(o,d))));break;case 19:tr(l,o),nr(o),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,If(o,h)));break;case 30:break;case 21:break;default:tr(l,o),nr(o)}}function nr(o){var l=o.flags;if(l&2){try{for(var d,h=o.return;h!==null;){if(HC(h)){d=h;break}h=h.return}if(d==null)throw Error(r(160));switch(d.tag){case 27:var v=d.stateNode,S=Ay(o);Df(o,S,v);break;case 5:var C=d.stateNode;d.flags&32&&(Ya(C,""),d.flags&=-33);var M=Ay(o);Df(o,M,C);break;case 3:case 4:var L=d.stateNode.containerInfo,F=Ay(o);Ry(o,F,L);break;default:throw Error(r(161))}}catch(J){gt(o,o.return,J)}o.flags&=-3}l&4096&&(o.flags&=-4097)}function XC(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var l=o;XC(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),o=o.sibling}}function Vi(o,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)qC(o,l.alternate,l),l=l.sibling}function na(o){for(o=o.child;o!==null;){var l=o;switch(l.tag){case 0:case 11:case 14:case 15:Ls(4,l,l.return),na(l);break;case 1:fi(l,l.return);var d=l.stateNode;typeof d.componentWillUnmount=="function"&&$C(l,l.return,d),na(l);break;case 27:ou(l.stateNode);case 26:case 5:fi(l,l.return),na(l);break;case 22:l.memoizedState===null&&na(l);break;case 30:na(l);break;default:na(l)}o=o.sibling}}function Hi(o,l,d){for(d=d&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var h=l.alternate,v=o,S=l,C=S.flags;switch(S.tag){case 0:case 11:case 15:Hi(v,S,d),Yc(4,S);break;case 1:if(Hi(v,S,d),h=S,v=h.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(F){gt(h,h.return,F)}if(h=S,v=h.updateQueue,v!==null){var M=h.stateNode;try{var L=v.shared.hiddenCallbacks;if(L!==null)for(v.shared.hiddenCallbacks=null,v=0;v<L.length;v++)Ak(L[v],M)}catch(F){gt(h,h.return,F)}}d&&C&64&&BC(S),Xc(S,S.return);break;case 27:UC(S);case 26:case 5:Hi(v,S,d),d&&h===null&&C&4&&VC(S),Xc(S,S.return);break;case 12:Hi(v,S,d);break;case 31:Hi(v,S,d),d&&C&4&&KC(v,S);break;case 13:Hi(v,S,d),d&&C&4&&ZC(v,S);break;case 22:S.memoizedState===null&&Hi(v,S,d),Xc(S,S.return);break;case 30:break;default:Hi(v,S,d)}l=l.sibling}}function Oy(o,l){var d=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),o=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(o=l.memoizedState.cachePool.pool),o!==d&&(o!=null&&o.refCount++,d!=null&&Pc(d))}function Ny(o,l){o=null,l.alternate!==null&&(o=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==o&&(l.refCount++,o!=null&&Pc(o))}function Wr(o,l,d,h){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)JC(o,l,d,h),l=l.sibling}function JC(o,l,d,h){var v=l.flags;switch(l.tag){case 0:case 11:case 15:Wr(o,l,d,h),v&2048&&Yc(9,l);break;case 1:Wr(o,l,d,h);break;case 3:Wr(o,l,d,h),v&2048&&(o=null,l.alternate!==null&&(o=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==o&&(l.refCount++,o!=null&&Pc(o)));break;case 12:if(v&2048){Wr(o,l,d,h),o=l.stateNode;try{var S=l.memoizedProps,C=S.id,M=S.onPostCommit;typeof M=="function"&&M(C,l.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(L){gt(l,l.return,L)}}else Wr(o,l,d,h);break;case 31:Wr(o,l,d,h);break;case 13:Wr(o,l,d,h);break;case 23:break;case 22:S=l.stateNode,C=l.alternate,l.memoizedState!==null?S._visibility&2?Wr(o,l,d,h):Jc(o,l):S._visibility&2?Wr(o,l,d,h):(S._visibility|=2,gl(o,l,d,h,(l.subtreeFlags&10256)!==0||!1)),v&2048&&Oy(C,l);break;case 24:Wr(o,l,d,h),v&2048&&Ny(l.alternate,l);break;default:Wr(o,l,d,h)}}function gl(o,l,d,h,v){for(v=v&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var S=o,C=l,M=d,L=h,F=C.flags;switch(C.tag){case 0:case 11:case 15:gl(S,C,M,L,v),Yc(8,C);break;case 23:break;case 22:var J=C.stateNode;C.memoizedState!==null?J._visibility&2?gl(S,C,M,L,v):Jc(S,C):(J._visibility|=2,gl(S,C,M,L,v)),v&&F&2048&&Oy(C.alternate,C);break;case 24:gl(S,C,M,L,v),v&&F&2048&&Ny(C.alternate,C);break;default:gl(S,C,M,L,v)}l=l.sibling}}function Jc(o,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var d=o,h=l,v=h.flags;switch(h.tag){case 22:Jc(d,h),v&2048&&Oy(h.alternate,h);break;case 24:Jc(d,h),v&2048&&Ny(h.alternate,h);break;default:Jc(d,h)}l=l.sibling}}var Qc=8192;function yl(o,l,d){if(o.subtreeFlags&Qc)for(o=o.child;o!==null;)QC(o,l,d),o=o.sibling}function QC(o,l,d){switch(o.tag){case 26:yl(o,l,d),o.flags&Qc&&o.memoizedState!==null&&cP(d,Gr,o.memoizedState,o.memoizedProps);break;case 5:yl(o,l,d);break;case 3:case 4:var h=Gr;Gr=Kf(o.stateNode.containerInfo),yl(o,l,d),Gr=h;break;case 22:o.memoizedState===null&&(h=o.alternate,h!==null&&h.memoizedState!==null?(h=Qc,Qc=16777216,yl(o,l,d),Qc=h):yl(o,l,d));break;default:yl(o,l,d)}}function e1(o){var l=o.alternate;if(l!==null&&(o=l.child,o!==null)){l.child=null;do l=o.sibling,o.sibling=null,o=l;while(o!==null)}}function eu(o){var l=o.deletions;if((o.flags&16)!==0){if(l!==null)for(var d=0;d<l.length;d++){var h=l[d];fn=h,n1(h,o)}e1(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)t1(o),o=o.sibling}function t1(o){switch(o.tag){case 0:case 11:case 15:eu(o),o.flags&2048&&Ls(9,o,o.return);break;case 3:eu(o);break;case 12:eu(o);break;case 22:var l=o.stateNode;o.memoizedState!==null&&l._visibility&2&&(o.return===null||o.return.tag!==13)?(l._visibility&=-3,Lf(o)):eu(o);break;default:eu(o)}}function Lf(o){var l=o.deletions;if((o.flags&16)!==0){if(l!==null)for(var d=0;d<l.length;d++){var h=l[d];fn=h,n1(h,o)}e1(o)}for(o=o.child;o!==null;){switch(l=o,l.tag){case 0:case 11:case 15:Ls(8,l,l.return),Lf(l);break;case 22:d=l.stateNode,d._visibility&2&&(d._visibility&=-3,Lf(l));break;default:Lf(l)}o=o.sibling}}function n1(o,l){for(;fn!==null;){var d=fn;switch(d.tag){case 0:case 11:case 15:Ls(8,d,l);break;case 23:case 22:if(d.memoizedState!==null&&d.memoizedState.cachePool!==null){var h=d.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:Pc(d.memoizedState.cache)}if(h=d.child,h!==null)h.return=d,fn=h;else e:for(d=o;fn!==null;){h=fn;var v=h.sibling,S=h.return;if(GC(h),h===d){fn=null;break e}if(v!==null){v.return=S,fn=v;break e}fn=S}}}var Cz={getCacheForType:function(o){var l=kn(Qt),d=l.data.get(o);return d===void 0&&(d=o(),l.data.set(o,d)),d},cacheSignal:function(){return kn(Qt).controller.signal}},Ez=typeof WeakMap=="function"?WeakMap:Map,dt=0,Ct=null,Xe=null,et=0,mt=0,fr=null,zs=!1,vl=!1,Dy=!1,Ui=0,Ht=0,Ps=0,ra=0,Iy=0,hr=0,bl=0,tu=null,rr=null,Ly=!1,zf=0,r1=0,Pf=1/0,jf=null,js=null,un=0,Bs=null,Sl=null,Fi=0,zy=0,Py=null,i1=null,nu=0,jy=null;function pr(){return(dt&2)!==0&&et!==0?et&-et:B.T!==null?Fy():Sx()}function s1(){if(hr===0)if((et&536870912)===0||nt){var o=Pt;Pt<<=1,(Pt&3932160)===0&&(Pt=262144),hr=o}else hr=536870912;return o=ur.current,o!==null&&(o.flags|=32),hr}function ir(o,l,d){(o===Ct&&(mt===2||mt===9)||o.cancelPendingCommit!==null)&&(wl(o,0),$s(o,et,hr,!1)),kc(o,d),((dt&2)===0||o!==Ct)&&(o===Ct&&((dt&2)===0&&(ra|=d),Ht===4&&$s(o,et,hr,!1)),hi(o))}function o1(o,l,d){if((dt&6)!==0)throw Error(r(327));var h=!d&&(l&127)===0&&(l&o.expiredLanes)===0||Bo(o,l),v=h?Az(o,l):$y(o,l,!0),S=h;do{if(v===0){vl&&!h&&$s(o,l,0,!1);break}else{if(d=o.current.alternate,S&&!Tz(d)){v=$y(o,l,!1),S=!1;continue}if(v===2){if(S=l,o.errorRecoveryDisabledLanes&S)var C=0;else C=o.pendingLanes&-536870913,C=C!==0?C:C&536870912?536870912:0;if(C!==0){l=C;e:{var M=o;v=tu;var L=M.current.memoizedState.isDehydrated;if(L&&(wl(M,C).flags|=256),C=$y(M,C,!1),C!==2){if(Dy&&!L){M.errorRecoveryDisabledLanes|=S,ra|=S,v=4;break e}S=rr,rr=v,S!==null&&(rr===null?rr=S:rr.push.apply(rr,S))}v=C}if(S=!1,v!==2)continue}}if(v===1){wl(o,0),$s(o,l,0,!0);break}e:{switch(h=o,S=v,S){case 0:case 1:throw Error(r(345));case 4:if((l&4194048)!==l)break;case 6:$s(h,l,hr,!zs);break e;case 2:rr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((l&62914560)===l&&(v=zf+300-Jt(),10<v)){if($s(h,l,hr,!zs),ci(h,0,!0)!==0)break e;Fi=l,h.timeoutHandle=P1(a1.bind(null,h,d,rr,jf,Ly,l,hr,ra,bl,zs,S,"Throttled",-0,0),v);break e}a1(h,d,rr,jf,Ly,l,hr,ra,bl,zs,S,null,-0,0)}}break}while(!0);hi(o)}function a1(o,l,d,h,v,S,C,M,L,F,J,ee,q,W){if(o.timeoutHandle=-1,ee=l.subtreeFlags,ee&8192||(ee&16785408)===16785408){ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ri},QC(l,S,ee);var Te=(S&62914560)===S?zf-Jt():(S&4194048)===S?r1-Jt():0;if(Te=uP(ee,Te),Te!==null){Fi=S,o.cancelPendingCommit=Te(m1.bind(null,o,l,S,d,h,v,C,M,L,J,ee,null,q,W)),$s(o,S,C,!F);return}}m1(o,l,S,d,h,v,C,M,L)}function Tz(o){for(var l=o;;){var d=l.tag;if((d===0||d===11||d===15)&&l.flags&16384&&(d=l.updateQueue,d!==null&&(d=d.stores,d!==null)))for(var h=0;h<d.length;h++){var v=d[h],S=v.getSnapshot;v=v.value;try{if(!lr(S(),v))return!1}catch{return!1}}if(d=l.child,l.subtreeFlags&16384&&d!==null)d.return=l,l=d;else{if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function $s(o,l,d,h){l&=~Iy,l&=~ra,o.suspendedLanes|=l,o.pingedLanes&=~l,h&&(o.warmLanes|=l),h=o.expirationTimes;for(var v=l;0<v;){var S=31-ge(v),C=1<<S;h[S]=-1,v&=~C}d!==0&&yx(o,d,l)}function Bf(){return(dt&6)===0?(ru(0),!1):!0}function By(){if(Xe!==null){if(mt===0)var o=Xe.return;else o=Xe,Di=Ko=null,ty(o),dl=null,Bc=0,o=Xe;for(;o!==null;)jC(o.alternate,o),o=o.return;Xe=null}}function wl(o,l){var d=o.timeoutHandle;d!==-1&&(o.timeoutHandle=-1,Gz(d)),d=o.cancelPendingCommit,d!==null&&(o.cancelPendingCommit=null,d()),Fi=0,By(),Ct=o,Xe=d=Oi(o.current,null),et=l,mt=0,fr=null,zs=!1,vl=Bo(o,l),Dy=!1,bl=hr=Iy=ra=Ps=Ht=0,rr=tu=null,Ly=!1,(l&8)!==0&&(l|=l&32);var h=o.entangledLanes;if(h!==0)for(o=o.entanglements,h&=l;0<h;){var v=31-ge(h),S=1<<v;l|=o[v],h&=~S}return Ui=l,of(),d}function l1(o,l){Ge=null,B.H=Wc,l===ul||l===pf?(l=Ck(),mt=3):l===Ug?(l=Ck(),mt=4):mt=l===yy?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,fr=l,Xe===null&&(Ht=1,Af(o,Tr(l,o.current)))}function c1(){var o=ur.current;return o===null?!0:(et&4194048)===et?Mr===null:(et&62914560)===et||(et&536870912)!==0?o===Mr:!1}function u1(){var o=B.H;return B.H=Wc,o===null?Wc:o}function d1(){var o=B.A;return B.A=Cz,o}function $f(){Ht=4,zs||(et&4194048)!==et&&ur.current!==null||(vl=!0),(Ps&134217727)===0&&(ra&134217727)===0||Ct===null||$s(Ct,et,hr,!1)}function $y(o,l,d){var h=dt;dt|=2;var v=u1(),S=d1();(Ct!==o||et!==l)&&(jf=null,wl(o,l)),l=!1;var C=Ht;e:do try{if(mt!==0&&Xe!==null){var M=Xe,L=fr;switch(mt){case 8:By(),C=6;break e;case 3:case 2:case 9:case 6:ur.current===null&&(l=!0);var F=mt;if(mt=0,fr=null,xl(o,M,L,F),d&&vl){C=0;break e}break;default:F=mt,mt=0,fr=null,xl(o,M,L,F)}}_z(),C=Ht;break}catch(J){l1(o,J)}while(!0);return l&&o.shellSuspendCounter++,Di=Ko=null,dt=h,B.H=v,B.A=S,Xe===null&&(Ct=null,et=0,of()),C}function _z(){for(;Xe!==null;)f1(Xe)}function Az(o,l){var d=dt;dt|=2;var h=u1(),v=d1();Ct!==o||et!==l?(jf=null,Pf=Jt()+500,wl(o,l)):vl=Bo(o,l);e:do try{if(mt!==0&&Xe!==null){l=Xe;var S=fr;t:switch(mt){case 1:mt=0,fr=null,xl(o,l,S,1);break;case 2:case 9:if(xk(S)){mt=0,fr=null,h1(l);break}l=function(){mt!==2&&mt!==9||Ct!==o||(mt=7),hi(o)},S.then(l,l);break e;case 3:mt=7;break e;case 4:mt=5;break e;case 7:xk(S)?(mt=0,fr=null,h1(l)):(mt=0,fr=null,xl(o,l,S,7));break;case 5:var C=null;switch(Xe.tag){case 26:C=Xe.memoizedState;case 5:case 27:var M=Xe;if(C?J1(C):M.stateNode.complete){mt=0,fr=null;var L=M.sibling;if(L!==null)Xe=L;else{var F=M.return;F!==null?(Xe=F,Vf(F)):Xe=null}break t}}mt=0,fr=null,xl(o,l,S,5);break;case 6:mt=0,fr=null,xl(o,l,S,6);break;case 8:By(),Ht=6;break e;default:throw Error(r(462))}}Rz();break}catch(J){l1(o,J)}while(!0);return Di=Ko=null,B.H=h,B.A=v,dt=d,Xe!==null?0:(Ct=null,et=0,of(),Ht)}function Rz(){for(;Xe!==null&&!Yn();)f1(Xe)}function f1(o){var l=zC(o.alternate,o,Ui);o.memoizedProps=o.pendingProps,l===null?Vf(o):Xe=l}function h1(o){var l=o,d=l.alternate;switch(l.tag){case 15:case 0:l=MC(d,l,l.pendingProps,l.type,void 0,et);break;case 11:l=MC(d,l,l.pendingProps,l.type.render,l.ref,et);break;case 5:ty(l);default:jC(d,l),l=Xe=dk(l,Ui),l=zC(d,l,Ui)}o.memoizedProps=o.pendingProps,l===null?Vf(o):Xe=l}function xl(o,l,d,h){Di=Ko=null,ty(l),dl=null,Bc=0;var v=l.return;try{if(yz(o,v,l,d,et)){Ht=1,Af(o,Tr(d,o.current)),Xe=null;return}}catch(S){if(v!==null)throw Xe=v,S;Ht=1,Af(o,Tr(d,o.current)),Xe=null;return}l.flags&32768?(nt||h===1?o=!0:vl||(et&536870912)!==0?o=!1:(zs=o=!0,(h===2||h===9||h===3||h===6)&&(h=ur.current,h!==null&&h.tag===13&&(h.flags|=16384))),p1(l,o)):Vf(l)}function Vf(o){var l=o;do{if((l.flags&32768)!==0){p1(l,zs);return}o=l.return;var d=Sz(l.alternate,l,Ui);if(d!==null){Xe=d;return}if(l=l.sibling,l!==null){Xe=l;return}Xe=l=o}while(l!==null);Ht===0&&(Ht=5)}function p1(o,l){do{var d=wz(o.alternate,o);if(d!==null){d.flags&=32767,Xe=d;return}if(d=o.return,d!==null&&(d.flags|=32768,d.subtreeFlags=0,d.deletions=null),!l&&(o=o.sibling,o!==null)){Xe=o;return}Xe=o=d}while(o!==null);Ht=6,Xe=null}function m1(o,l,d,h,v,S,C,M,L){o.cancelPendingCommit=null;do Hf();while(un!==0);if((dt&6)!==0)throw Error(r(327));if(l!==null){if(l===o.current)throw Error(r(177));if(S=l.lanes|l.childLanes,S|=Ag,l2(o,d,S,C,M,L),o===Ct&&(Xe=Ct=null,et=0),Sl=l,Bs=o,Fi=d,zy=S,Py=v,i1=h,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,Dz(wc,function(){return S1(),null})):(o.callbackNode=null,o.callbackPriority=0),h=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||h){h=B.T,B.T=null,v=Z.p,Z.p=2,C=dt,dt|=4;try{xz(o,l,d)}finally{dt=C,Z.p=v,B.T=h}}un=1,g1(),y1(),v1()}}function g1(){if(un===1){un=0;var o=Bs,l=Sl,d=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||d){d=B.T,B.T=null;var h=Z.p;Z.p=2;var v=dt;dt|=4;try{YC(l,o);var S=Jy,C=nk(o.containerInfo),M=S.focusedElem,L=S.selectionRange;if(C!==M&&M&&M.ownerDocument&&tk(M.ownerDocument.documentElement,M)){if(L!==null&&kg(M)){var F=L.start,J=L.end;if(J===void 0&&(J=F),"selectionStart"in M)M.selectionStart=F,M.selectionEnd=Math.min(J,M.value.length);else{var ee=M.ownerDocument||document,q=ee&&ee.defaultView||window;if(q.getSelection){var W=q.getSelection(),Te=M.textContent.length,Pe=Math.min(L.start,Te),wt=L.end===void 0?Pe:Math.min(L.end,Te);!W.extend&&Pe>wt&&(C=wt,wt=Pe,Pe=C);var $=ek(M,Pe),P=ek(M,wt);if($&&P&&(W.rangeCount!==1||W.anchorNode!==$.node||W.anchorOffset!==$.offset||W.focusNode!==P.node||W.focusOffset!==P.offset)){var U=ee.createRange();U.setStart($.node,$.offset),W.removeAllRanges(),Pe>wt?(W.addRange(U),W.extend(P.node,P.offset)):(U.setEnd(P.node,P.offset),W.addRange(U))}}}}for(ee=[],W=M;W=W.parentNode;)W.nodeType===1&&ee.push({element:W,left:W.scrollLeft,top:W.scrollTop});for(typeof M.focus=="function"&&M.focus(),M=0;M<ee.length;M++){var Q=ee[M];Q.element.scrollLeft=Q.left,Q.element.scrollTop=Q.top}}eh=!!Xy,Jy=Xy=null}finally{dt=v,Z.p=h,B.T=d}}o.current=l,un=2}}function y1(){if(un===2){un=0;var o=Bs,l=Sl,d=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||d){d=B.T,B.T=null;var h=Z.p;Z.p=2;var v=dt;dt|=4;try{qC(o,l.alternate,l)}finally{dt=v,Z.p=h,B.T=d}}un=3}}function v1(){if(un===4||un===3){un=0,ks();var o=Bs,l=Sl,d=Fi,h=i1;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?un=5:(un=0,Sl=Bs=null,b1(o,o.pendingLanes));var v=o.pendingLanes;if(v===0&&(js=null),ig(d),l=l.stateNode,re&&typeof re.onCommitFiberRoot=="function")try{re.onCommitFiberRoot(H,l,void 0,(l.current.flags&128)===128)}catch{}if(h!==null){l=B.T,v=Z.p,Z.p=2,B.T=null;try{for(var S=o.onRecoverableError,C=0;C<h.length;C++){var M=h[C];S(M.value,{componentStack:M.stack})}}finally{B.T=l,Z.p=v}}(Fi&3)!==0&&Hf(),hi(o),v=o.pendingLanes,(d&261930)!==0&&(v&42)!==0?o===jy?nu++:(nu=0,jy=o):nu=0,ru(0)}}function b1(o,l){(o.pooledCacheLanes&=l)===0&&(l=o.pooledCache,l!=null&&(o.pooledCache=null,Pc(l)))}function Hf(){return g1(),y1(),v1(),S1()}function S1(){if(un!==5)return!1;var o=Bs,l=zy;zy=0;var d=ig(Fi),h=B.T,v=Z.p;try{Z.p=32>d?32:d,B.T=null,d=Py,Py=null;var S=Bs,C=Fi;if(un=0,Sl=Bs=null,Fi=0,(dt&6)!==0)throw Error(r(331));var M=dt;if(dt|=4,t1(S.current),JC(S,S.current,C,d),dt=M,ru(0,!1),re&&typeof re.onPostCommitFiberRoot=="function")try{re.onPostCommitFiberRoot(H,S)}catch{}return!0}finally{Z.p=v,B.T=h,b1(o,l)}}function w1(o,l,d){l=Tr(d,l),l=gy(o.stateNode,l,2),o=Ns(o,l,2),o!==null&&(kc(o,2),hi(o))}function gt(o,l,d){if(o.tag===3)w1(o,o,d);else for(;l!==null;){if(l.tag===3){w1(l,o,d);break}else if(l.tag===1){var h=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(js===null||!js.has(h))){o=Tr(d,o),d=xC(2),h=Ns(l,d,2),h!==null&&(kC(d,h,l,o),kc(h,2),hi(h));break}}l=l.return}}function Vy(o,l,d){var h=o.pingCache;if(h===null){h=o.pingCache=new Ez;var v=new Set;h.set(l,v)}else v=h.get(l),v===void 0&&(v=new Set,h.set(l,v));v.has(d)||(Dy=!0,v.add(d),o=Mz.bind(null,o,l,d),l.then(o,o))}function Mz(o,l,d){var h=o.pingCache;h!==null&&h.delete(l),o.pingedLanes|=o.suspendedLanes&d,o.warmLanes&=~d,Ct===o&&(et&d)===d&&(Ht===4||Ht===3&&(et&62914560)===et&&300>Jt()-zf?(dt&2)===0&&wl(o,0):Iy|=d,bl===et&&(bl=0)),hi(o)}function x1(o,l){l===0&&(l=Wd()),o=qo(o,l),o!==null&&(kc(o,l),hi(o))}function Oz(o){var l=o.memoizedState,d=0;l!==null&&(d=l.retryLane),x1(o,d)}function Nz(o,l){var d=0;switch(o.tag){case 31:case 13:var h=o.stateNode,v=o.memoizedState;v!==null&&(d=v.retryLane);break;case 19:h=o.stateNode;break;case 22:h=o.stateNode._retryCache;break;default:throw Error(r(314))}h!==null&&h.delete(l),x1(o,d)}function Dz(o,l){return Le(o,l)}var Uf=null,kl=null,Hy=!1,Ff=!1,Uy=!1,Vs=0;function hi(o){o!==kl&&o.next===null&&(kl===null?Uf=kl=o:kl=kl.next=o),Ff=!0,Hy||(Hy=!0,Lz())}function ru(o,l){if(!Uy&&Ff){Uy=!0;do for(var d=!1,h=Uf;h!==null;){if(o!==0){var v=h.pendingLanes;if(v===0)var S=0;else{var C=h.suspendedLanes,M=h.pingedLanes;S=(1<<31-ge(42|o)+1)-1,S&=v&~(C&~M),S=S&201326741?S&201326741|1:S?S|2:0}S!==0&&(d=!0,T1(h,S))}else S=et,S=ci(h,h===Ct?S:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(S&3)===0||Bo(h,S)||(d=!0,T1(h,S));h=h.next}while(d);Uy=!1}}function Iz(){k1()}function k1(){Ff=Hy=!1;var o=0;Vs!==0&&qz()&&(o=Vs);for(var l=Jt(),d=null,h=Uf;h!==null;){var v=h.next,S=C1(h,l);S===0?(h.next=null,d===null?Uf=v:d.next=v,v===null&&(kl=d)):(d=h,(o!==0||(S&3)!==0)&&(Ff=!0)),h=v}un!==0&&un!==5||ru(o),Vs!==0&&(Vs=0)}function C1(o,l){for(var d=o.suspendedLanes,h=o.pingedLanes,v=o.expirationTimes,S=o.pendingLanes&-62914561;0<S;){var C=31-ge(S),M=1<<C,L=v[C];L===-1?((M&d)===0||(M&h)!==0)&&(v[C]=$o(M,l)):L<=l&&(o.expiredLanes|=M),S&=~M}if(l=Ct,d=et,d=ci(o,o===l?d:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),h=o.callbackNode,d===0||o===l&&(mt===2||mt===9)||o.cancelPendingCommit!==null)return h!==null&&h!==null&&It(h),o.callbackNode=null,o.callbackPriority=0;if((d&3)===0||Bo(o,d)){if(l=d&-d,l===o.callbackPriority)return l;switch(h!==null&&It(h),ig(d)){case 2:case 8:d=Gd;break;case 32:d=wc;break;case 268435456:d=xc;break;default:d=wc}return h=E1.bind(null,o),d=Le(d,h),o.callbackPriority=l,o.callbackNode=d,l}return h!==null&&h!==null&&It(h),o.callbackPriority=2,o.callbackNode=null,2}function E1(o,l){if(un!==0&&un!==5)return o.callbackNode=null,o.callbackPriority=0,null;var d=o.callbackNode;if(Hf()&&o.callbackNode!==d)return null;var h=et;return h=ci(o,o===Ct?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),h===0?null:(o1(o,h,l),C1(o,Jt()),o.callbackNode!=null&&o.callbackNode===d?E1.bind(null,o):null)}function T1(o,l){if(Hf())return null;o1(o,l,!0)}function Lz(){Wz(function(){(dt&6)!==0?Le(qd,Iz):k1()})}function Fy(){if(Vs===0){var o=ll;o===0&&(o=st,st<<=1,(st&261888)===0&&(st=256)),Vs=o}return Vs}function _1(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Xd(""+o)}function A1(o,l){var d=l.ownerDocument.createElement("input");return d.name=l.name,d.value=l.value,o.id&&d.setAttribute("form",o.id),l.parentNode.insertBefore(d,l),o=new FormData(o),d.parentNode.removeChild(d),o}function zz(o,l,d,h,v){if(l==="submit"&&d&&d.stateNode===v){var S=_1((v[Jn]||null).action),C=h.submitter;C&&(l=(l=C[Jn]||null)?_1(l.formAction):C.getAttribute("formAction"),l!==null&&(S=l,C=null));var M=new tf("action","action",null,h,v);o.push({event:M,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(Vs!==0){var L=C?A1(v,C):new FormData(v);uy(d,{pending:!0,data:L,method:v.method,action:S},null,L)}}else typeof S=="function"&&(M.preventDefault(),L=C?A1(v,C):new FormData(v),uy(d,{pending:!0,data:L,method:v.method,action:S},S,L))},currentTarget:v}]})}}for(var qy=0;qy<_g.length;qy++){var Gy=_g[qy],Pz=Gy.toLowerCase(),jz=Gy[0].toUpperCase()+Gy.slice(1);qr(Pz,"on"+jz)}qr(sk,"onAnimationEnd"),qr(ok,"onAnimationIteration"),qr(ak,"onAnimationStart"),qr("dblclick","onDoubleClick"),qr("focusin","onFocus"),qr("focusout","onBlur"),qr(ez,"onTransitionRun"),qr(tz,"onTransitionStart"),qr(nz,"onTransitionCancel"),qr(lk,"onTransitionEnd"),Ka("onMouseEnter",["mouseout","mouseover"]),Ka("onMouseLeave",["mouseout","mouseover"]),Ka("onPointerEnter",["pointerout","pointerover"]),Ka("onPointerLeave",["pointerout","pointerover"]),Vo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Vo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Vo("onBeforeInput",["compositionend","keypress","textInput","paste"]),Vo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Vo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Vo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var iu="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(" "),Bz=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(iu));function R1(o,l){l=(l&4)!==0;for(var d=0;d<o.length;d++){var h=o[d],v=h.event;h=h.listeners;e:{var S=void 0;if(l)for(var C=h.length-1;0<=C;C--){var M=h[C],L=M.instance,F=M.currentTarget;if(M=M.listener,L!==S&&v.isPropagationStopped())break e;S=M,v.currentTarget=F;try{S(v)}catch(J){sf(J)}v.currentTarget=null,S=L}else for(C=0;C<h.length;C++){if(M=h[C],L=M.instance,F=M.currentTarget,M=M.listener,L!==S&&v.isPropagationStopped())break e;S=M,v.currentTarget=F;try{S(v)}catch(J){sf(J)}v.currentTarget=null,S=L}}}}function Je(o,l){var d=l[sg];d===void 0&&(d=l[sg]=new Set);var h=o+"__bubble";d.has(h)||(M1(l,o,2,!1),d.add(h))}function Wy(o,l,d){var h=0;l&&(h|=4),M1(d,o,h,l)}var qf="_reactListening"+Math.random().toString(36).slice(2);function Ky(o){if(!o[qf]){o[qf]=!0,kx.forEach(function(d){d!=="selectionchange"&&(Bz.has(d)||Wy(d,!1,o),Wy(d,!0,o))});var l=o.nodeType===9?o:o.ownerDocument;l===null||l[qf]||(l[qf]=!0,Wy("selectionchange",!1,l))}}function M1(o,l,d,h){switch(sE(l)){case 2:var v=hP;break;case 8:v=pP;break;default:v=cv}d=v.bind(null,l,d,o),v=void 0,!pg||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(v=!0),h?v!==void 0?o.addEventListener(l,d,{capture:!0,passive:v}):o.addEventListener(l,d,!0):v!==void 0?o.addEventListener(l,d,{passive:v}):o.addEventListener(l,d,!1)}function Zy(o,l,d,h,v){var S=h;if((l&1)===0&&(l&2)===0&&h!==null)e:for(;;){if(h===null)return;var C=h.tag;if(C===3||C===4){var M=h.stateNode.containerInfo;if(M===v)break;if(C===4)for(C=h.return;C!==null;){var L=C.tag;if((L===3||L===4)&&C.stateNode.containerInfo===v)return;C=C.return}for(;M!==null;){if(C=qa(M),C===null)return;if(L=C.tag,L===5||L===6||L===26||L===27){h=S=C;continue e}M=M.parentNode}}h=h.return}Lx(function(){var F=S,J=fg(d),ee=[];e:{var q=ck.get(o);if(q!==void 0){var W=tf,Te=o;switch(o){case"keypress":if(Qd(d)===0)break e;case"keydown":case"keyup":W=N2;break;case"focusin":Te="focus",W=vg;break;case"focusout":Te="blur",W=vg;break;case"beforeblur":case"afterblur":W=vg;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":W=jx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":W=S2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":W=L2;break;case sk:case ok:case ak:W=k2;break;case lk:W=P2;break;case"scroll":case"scrollend":W=v2;break;case"wheel":W=B2;break;case"copy":case"cut":case"paste":W=E2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":W=$x;break;case"toggle":case"beforetoggle":W=V2}var Pe=(l&4)!==0,wt=!Pe&&(o==="scroll"||o==="scrollend"),$=Pe?q!==null?q+"Capture":null:q;Pe=[];for(var P=F,U;P!==null;){var Q=P;if(U=Q.stateNode,Q=Q.tag,Q!==5&&Q!==26&&Q!==27||U===null||$===null||(Q=Tc(P,$),Q!=null&&Pe.push(su(P,Q,U))),wt)break;P=P.return}0<Pe.length&&(q=new W(q,Te,null,d,J),ee.push({event:q,listeners:Pe}))}}if((l&7)===0){e:{if(q=o==="mouseover"||o==="pointerover",W=o==="mouseout"||o==="pointerout",q&&d!==dg&&(Te=d.relatedTarget||d.fromElement)&&(qa(Te)||Te[Fa]))break e;if((W||q)&&(q=J.window===J?J:(q=J.ownerDocument)?q.defaultView||q.parentWindow:window,W?(Te=d.relatedTarget||d.toElement,W=F,Te=Te?qa(Te):null,Te!==null&&(wt=s(Te),Pe=Te.tag,Te!==wt||Pe!==5&&Pe!==27&&Pe!==6)&&(Te=null)):(W=null,Te=F),W!==Te)){if(Pe=jx,Q="onMouseLeave",$="onMouseEnter",P="mouse",(o==="pointerout"||o==="pointerover")&&(Pe=$x,Q="onPointerLeave",$="onPointerEnter",P="pointer"),wt=W==null?q:Ec(W),U=Te==null?q:Ec(Te),q=new Pe(Q,P+"leave",W,d,J),q.target=wt,q.relatedTarget=U,Q=null,qa(J)===F&&(Pe=new Pe($,P+"enter",Te,d,J),Pe.target=U,Pe.relatedTarget=wt,Q=Pe),wt=Q,W&&Te)t:{for(Pe=$z,$=W,P=Te,U=0,Q=$;Q;Q=Pe(Q))U++;Q=0;for(var De=P;De;De=Pe(De))Q++;for(;0<U-Q;)$=Pe($),U--;for(;0<Q-U;)P=Pe(P),Q--;for(;U--;){if($===P||P!==null&&$===P.alternate){Pe=$;break t}$=Pe($),P=Pe(P)}Pe=null}else Pe=null;W!==null&&O1(ee,q,W,Pe,!1),Te!==null&&wt!==null&&O1(ee,wt,Te,Pe,!0)}}e:{if(q=F?Ec(F):window,W=q.nodeName&&q.nodeName.toLowerCase(),W==="select"||W==="input"&&q.type==="file")var at=Kx;else if(Gx(q))if(Zx)at=X2;else{at=Z2;var Me=K2}else W=q.nodeName,!W||W.toLowerCase()!=="input"||q.type!=="checkbox"&&q.type!=="radio"?F&&ug(F.elementType)&&(at=Kx):at=Y2;if(at&&(at=at(o,F))){Wx(ee,at,d,J);break e}Me&&Me(o,q,F),o==="focusout"&&F&&q.type==="number"&&F.memoizedProps.value!=null&&cg(q,"number",q.value)}switch(Me=F?Ec(F):window,o){case"focusin":(Gx(Me)||Me.contentEditable==="true")&&(el=Me,Cg=F,Ic=null);break;case"focusout":Ic=Cg=el=null;break;case"mousedown":Eg=!0;break;case"contextmenu":case"mouseup":case"dragend":Eg=!1,rk(ee,d,J);break;case"selectionchange":if(Q2)break;case"keydown":case"keyup":rk(ee,d,J)}var We;if(Sg)e:{switch(o){case"compositionstart":var tt="onCompositionStart";break e;case"compositionend":tt="onCompositionEnd";break e;case"compositionupdate":tt="onCompositionUpdate";break e}tt=void 0}else Qa?Fx(o,d)&&(tt="onCompositionEnd"):o==="keydown"&&d.keyCode===229&&(tt="onCompositionStart");tt&&(Vx&&d.locale!=="ko"&&(Qa||tt!=="onCompositionStart"?tt==="onCompositionEnd"&&Qa&&(We=zx()):(Es=J,mg="value"in Es?Es.value:Es.textContent,Qa=!0)),Me=Gf(F,tt),0<Me.length&&(tt=new Bx(tt,o,null,d,J),ee.push({event:tt,listeners:Me}),We?tt.data=We:(We=qx(d),We!==null&&(tt.data=We)))),(We=U2?F2(o,d):q2(o,d))&&(tt=Gf(F,"onBeforeInput"),0<tt.length&&(Me=new Bx("onBeforeInput","beforeinput",null,d,J),ee.push({event:Me,listeners:tt}),Me.data=We)),zz(ee,o,F,d,J)}R1(ee,l)})}function su(o,l,d){return{instance:o,listener:l,currentTarget:d}}function Gf(o,l){for(var d=l+"Capture",h=[];o!==null;){var v=o,S=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||S===null||(v=Tc(o,d),v!=null&&h.unshift(su(o,v,S)),v=Tc(o,l),v!=null&&h.push(su(o,v,S))),o.tag===3)return h;o=o.return}return[]}function $z(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function O1(o,l,d,h,v){for(var S=l._reactName,C=[];d!==null&&d!==h;){var M=d,L=M.alternate,F=M.stateNode;if(M=M.tag,L!==null&&L===h)break;M!==5&&M!==26&&M!==27||F===null||(L=F,v?(F=Tc(d,S),F!=null&&C.unshift(su(d,F,L))):v||(F=Tc(d,S),F!=null&&C.push(su(d,F,L)))),d=d.return}C.length!==0&&o.push({event:l,listeners:C})}var Vz=/\r\n?/g,Hz=/\u0000|\uFFFD/g;function N1(o){return(typeof o=="string"?o:""+o).replace(Vz,`
|
|
9
|
-
`).replace(Hz,"")}function D1(o,l){return l=N1(l),N1(o)===l}function St(o,l,d,h,v,S){switch(d){case"children":typeof h=="string"?l==="body"||l==="textarea"&&h===""||Ya(o,h):(typeof h=="number"||typeof h=="bigint")&&l!=="body"&&Ya(o,""+h);break;case"className":Zd(o,"class",h);break;case"tabIndex":Zd(o,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":Zd(o,d,h);break;case"style":Dx(o,h,S);break;case"data":if(l!=="object"){Zd(o,"data",h);break}case"src":case"href":if(h===""&&(l!=="a"||d!=="href")){o.removeAttribute(d);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){o.removeAttribute(d);break}h=Xd(""+h),o.setAttribute(d,h);break;case"action":case"formAction":if(typeof h=="function"){o.setAttribute(d,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof S=="function"&&(d==="formAction"?(l!=="input"&&St(o,l,"name",v.name,v,null),St(o,l,"formEncType",v.formEncType,v,null),St(o,l,"formMethod",v.formMethod,v,null),St(o,l,"formTarget",v.formTarget,v,null)):(St(o,l,"encType",v.encType,v,null),St(o,l,"method",v.method,v,null),St(o,l,"target",v.target,v,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){o.removeAttribute(d);break}h=Xd(""+h),o.setAttribute(d,h);break;case"onClick":h!=null&&(o.onclick=Ri);break;case"onScroll":h!=null&&Je("scroll",o);break;case"onScrollEnd":h!=null&&Je("scrollend",o);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(d=h.__html,d!=null){if(v.children!=null)throw Error(r(60));o.innerHTML=d}}break;case"multiple":o.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":o.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){o.removeAttribute("xlink:href");break}d=Xd(""+h),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(d,""+h):o.removeAttribute(d);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":h&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(d,""):o.removeAttribute(d);break;case"capture":case"download":h===!0?o.setAttribute(d,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(d,h):o.removeAttribute(d);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?o.setAttribute(d,h):o.removeAttribute(d);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?o.removeAttribute(d):o.setAttribute(d,h);break;case"popover":Je("beforetoggle",o),Je("toggle",o),Kd(o,"popover",h);break;case"xlinkActuate":Ai(o,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":Ai(o,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":Ai(o,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":Ai(o,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":Ai(o,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":Ai(o,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":Ai(o,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":Ai(o,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":Ai(o,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":Kd(o,"is",h);break;case"innerText":case"textContent":break;default:(!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")&&(d=g2.get(d)||d,Kd(o,d,h))}}function Yy(o,l,d,h,v,S){switch(d){case"style":Dx(o,h,S);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(d=h.__html,d!=null){if(v.children!=null)throw Error(r(60));o.innerHTML=d}}break;case"children":typeof h=="string"?Ya(o,h):(typeof h=="number"||typeof h=="bigint")&&Ya(o,""+h);break;case"onScroll":h!=null&&Je("scroll",o);break;case"onScrollEnd":h!=null&&Je("scrollend",o);break;case"onClick":h!=null&&(o.onclick=Ri);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Cx.hasOwnProperty(d))e:{if(d[0]==="o"&&d[1]==="n"&&(v=d.endsWith("Capture"),l=d.slice(2,v?d.length-7:void 0),S=o[Jn]||null,S=S!=null?S[d]:null,typeof S=="function"&&o.removeEventListener(l,S,v),typeof h=="function")){typeof S!="function"&&S!==null&&(d in o?o[d]=null:o.hasAttribute(d)&&o.removeAttribute(d)),o.addEventListener(l,h,v);break e}d in o?o[d]=h:h===!0?o.setAttribute(d,""):Kd(o,d,h)}}}function En(o,l,d){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Je("error",o),Je("load",o);var h=!1,v=!1,S;for(S in d)if(d.hasOwnProperty(S)){var C=d[S];if(C!=null)switch(S){case"src":h=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:St(o,l,S,C,d,null)}}v&&St(o,l,"srcSet",d.srcSet,d,null),h&&St(o,l,"src",d.src,d,null);return;case"input":Je("invalid",o);var M=S=C=v=null,L=null,F=null;for(h in d)if(d.hasOwnProperty(h)){var J=d[h];if(J!=null)switch(h){case"name":v=J;break;case"type":C=J;break;case"checked":L=J;break;case"defaultChecked":F=J;break;case"value":S=J;break;case"defaultValue":M=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(137,l));break;default:St(o,l,h,J,d,null)}}Rx(o,S,M,L,F,C,v,!1);return;case"select":Je("invalid",o),h=C=S=null;for(v in d)if(d.hasOwnProperty(v)&&(M=d[v],M!=null))switch(v){case"value":S=M;break;case"defaultValue":C=M;break;case"multiple":h=M;default:St(o,l,v,M,d,null)}l=S,d=C,o.multiple=!!h,l!=null?Za(o,!!h,l,!1):d!=null&&Za(o,!!h,d,!0);return;case"textarea":Je("invalid",o),S=v=h=null;for(C in d)if(d.hasOwnProperty(C)&&(M=d[C],M!=null))switch(C){case"value":h=M;break;case"defaultValue":v=M;break;case"children":S=M;break;case"dangerouslySetInnerHTML":if(M!=null)throw Error(r(91));break;default:St(o,l,C,M,d,null)}Ox(o,h,v,S);return;case"option":for(L in d)d.hasOwnProperty(L)&&(h=d[L],h!=null)&&(L==="selected"?o.selected=h&&typeof h!="function"&&typeof h!="symbol":St(o,l,L,h,d,null));return;case"dialog":Je("beforetoggle",o),Je("toggle",o),Je("cancel",o),Je("close",o);break;case"iframe":case"object":Je("load",o);break;case"video":case"audio":for(h=0;h<iu.length;h++)Je(iu[h],o);break;case"image":Je("error",o),Je("load",o);break;case"details":Je("toggle",o);break;case"embed":case"source":case"link":Je("error",o),Je("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(F in d)if(d.hasOwnProperty(F)&&(h=d[F],h!=null))switch(F){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:St(o,l,F,h,d,null)}return;default:if(ug(l)){for(J in d)d.hasOwnProperty(J)&&(h=d[J],h!==void 0&&Yy(o,l,J,h,d,void 0));return}}for(M in d)d.hasOwnProperty(M)&&(h=d[M],h!=null&&St(o,l,M,h,d,null))}function Uz(o,l,d,h){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,S=null,C=null,M=null,L=null,F=null,J=null;for(W in d){var ee=d[W];if(d.hasOwnProperty(W)&&ee!=null)switch(W){case"checked":break;case"value":break;case"defaultValue":L=ee;default:h.hasOwnProperty(W)||St(o,l,W,null,h,ee)}}for(var q in h){var W=h[q];if(ee=d[q],h.hasOwnProperty(q)&&(W!=null||ee!=null))switch(q){case"type":S=W;break;case"name":v=W;break;case"checked":F=W;break;case"defaultChecked":J=W;break;case"value":C=W;break;case"defaultValue":M=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(r(137,l));break;default:W!==ee&&St(o,l,q,W,h,ee)}}lg(o,C,M,L,F,J,S,v);return;case"select":W=C=M=q=null;for(S in d)if(L=d[S],d.hasOwnProperty(S)&&L!=null)switch(S){case"value":break;case"multiple":W=L;default:h.hasOwnProperty(S)||St(o,l,S,null,h,L)}for(v in h)if(S=h[v],L=d[v],h.hasOwnProperty(v)&&(S!=null||L!=null))switch(v){case"value":q=S;break;case"defaultValue":M=S;break;case"multiple":C=S;default:S!==L&&St(o,l,v,S,h,L)}l=M,d=C,h=W,q!=null?Za(o,!!d,q,!1):!!h!=!!d&&(l!=null?Za(o,!!d,l,!0):Za(o,!!d,d?[]:"",!1));return;case"textarea":W=q=null;for(M in d)if(v=d[M],d.hasOwnProperty(M)&&v!=null&&!h.hasOwnProperty(M))switch(M){case"value":break;case"children":break;default:St(o,l,M,null,h,v)}for(C in h)if(v=h[C],S=d[C],h.hasOwnProperty(C)&&(v!=null||S!=null))switch(C){case"value":q=v;break;case"defaultValue":W=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(r(91));break;default:v!==S&&St(o,l,C,v,h,S)}Mx(o,q,W);return;case"option":for(var Te in d)q=d[Te],d.hasOwnProperty(Te)&&q!=null&&!h.hasOwnProperty(Te)&&(Te==="selected"?o.selected=!1:St(o,l,Te,null,h,q));for(L in h)q=h[L],W=d[L],h.hasOwnProperty(L)&&q!==W&&(q!=null||W!=null)&&(L==="selected"?o.selected=q&&typeof q!="function"&&typeof q!="symbol":St(o,l,L,q,h,W));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 Pe in d)q=d[Pe],d.hasOwnProperty(Pe)&&q!=null&&!h.hasOwnProperty(Pe)&&St(o,l,Pe,null,h,q);for(F in h)if(q=h[F],W=d[F],h.hasOwnProperty(F)&&q!==W&&(q!=null||W!=null))switch(F){case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(r(137,l));break;default:St(o,l,F,q,h,W)}return;default:if(ug(l)){for(var wt in d)q=d[wt],d.hasOwnProperty(wt)&&q!==void 0&&!h.hasOwnProperty(wt)&&Yy(o,l,wt,void 0,h,q);for(J in h)q=h[J],W=d[J],!h.hasOwnProperty(J)||q===W||q===void 0&&W===void 0||Yy(o,l,J,q,h,W);return}}for(var $ in d)q=d[$],d.hasOwnProperty($)&&q!=null&&!h.hasOwnProperty($)&&St(o,l,$,null,h,q);for(ee in h)q=h[ee],W=d[ee],!h.hasOwnProperty(ee)||q===W||q==null&&W==null||St(o,l,ee,q,h,W)}function I1(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Fz(){if(typeof performance.getEntriesByType=="function"){for(var o=0,l=0,d=performance.getEntriesByType("resource"),h=0;h<d.length;h++){var v=d[h],S=v.transferSize,C=v.initiatorType,M=v.duration;if(S&&M&&I1(C)){for(C=0,M=v.responseEnd,h+=1;h<d.length;h++){var L=d[h],F=L.startTime;if(F>M)break;var J=L.transferSize,ee=L.initiatorType;J&&I1(ee)&&(L=L.responseEnd,C+=J*(L<M?1:(M-F)/(L-F)))}if(--h,l+=8*(S+C)/(v.duration/1e3),o++,10<o)break}}if(0<o)return l/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var Xy=null,Jy=null;function Wf(o){return o.nodeType===9?o:o.ownerDocument}function L1(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function z1(o,l){if(o===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&l==="foreignObject"?0:o}function Qy(o,l){return o==="textarea"||o==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var ev=null;function qz(){var o=window.event;return o&&o.type==="popstate"?o===ev?!1:(ev=o,!0):(ev=null,!1)}var P1=typeof setTimeout=="function"?setTimeout:void 0,Gz=typeof clearTimeout=="function"?clearTimeout:void 0,j1=typeof Promise=="function"?Promise:void 0,Wz=typeof queueMicrotask=="function"?queueMicrotask:typeof j1<"u"?function(o){return j1.resolve(null).then(o).catch(Kz)}:P1;function Kz(o){setTimeout(function(){throw o})}function Hs(o){return o==="head"}function B1(o,l){var d=l,h=0;do{var v=d.nextSibling;if(o.removeChild(d),v&&v.nodeType===8)if(d=v.data,d==="/$"||d==="/&"){if(h===0){o.removeChild(v),_l(l);return}h--}else if(d==="$"||d==="$?"||d==="$~"||d==="$!"||d==="&")h++;else if(d==="html")ou(o.ownerDocument.documentElement);else if(d==="head"){d=o.ownerDocument.head,ou(d);for(var S=d.firstChild;S;){var C=S.nextSibling,M=S.nodeName;S[Cc]||M==="SCRIPT"||M==="STYLE"||M==="LINK"&&S.rel.toLowerCase()==="stylesheet"||d.removeChild(S),S=C}}else d==="body"&&ou(o.ownerDocument.body);d=v}while(d);_l(l)}function $1(o,l){var d=o;o=0;do{var h=d.nextSibling;if(d.nodeType===1?l?(d._stashedDisplay=d.style.display,d.style.display="none"):(d.style.display=d._stashedDisplay||"",d.getAttribute("style")===""&&d.removeAttribute("style")):d.nodeType===3&&(l?(d._stashedText=d.nodeValue,d.nodeValue=""):d.nodeValue=d._stashedText||""),h&&h.nodeType===8)if(d=h.data,d==="/$"){if(o===0)break;o--}else d!=="$"&&d!=="$?"&&d!=="$~"&&d!=="$!"||o++;d=h}while(d)}function tv(o){var l=o.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var d=l;switch(l=l.nextSibling,d.nodeName){case"HTML":case"HEAD":case"BODY":tv(d),og(d);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(d.rel.toLowerCase()==="stylesheet")continue}o.removeChild(d)}}function Zz(o,l,d,h){for(;o.nodeType===1;){var v=d;if(o.nodeName.toLowerCase()!==l.toLowerCase()){if(!h&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(h){if(!o[Cc])switch(l){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(S=o.getAttribute("rel"),S==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(S!==v.rel||o.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||o.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||o.getAttribute("title")!==(v.title==null?null:v.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(S=o.getAttribute("src"),(S!==(v.src==null?null:v.src)||o.getAttribute("type")!==(v.type==null?null:v.type)||o.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&S&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(l==="input"&&o.type==="hidden"){var S=v.name==null?null:""+v.name;if(v.type==="hidden"&&o.getAttribute("name")===S)return o}else return o;if(o=Or(o.nextSibling),o===null)break}return null}function Yz(o,l,d){if(l==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!d||(o=Or(o.nextSibling),o===null))return null;return o}function V1(o,l){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!l||(o=Or(o.nextSibling),o===null))return null;return o}function nv(o){return o.data==="$?"||o.data==="$~"}function rv(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function Xz(o,l){var d=o.ownerDocument;if(o.data==="$~")o._reactRetry=l;else if(o.data!=="$?"||d.readyState!=="loading")l();else{var h=function(){l(),d.removeEventListener("DOMContentLoaded",h)};d.addEventListener("DOMContentLoaded",h),o._reactRetry=h}}function Or(o){for(;o!=null;o=o.nextSibling){var l=o.nodeType;if(l===1||l===3)break;if(l===8){if(l=o.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return o}var iv=null;function H1(o){o=o.nextSibling;for(var l=0;o;){if(o.nodeType===8){var d=o.data;if(d==="/$"||d==="/&"){if(l===0)return Or(o.nextSibling);l--}else d!=="$"&&d!=="$!"&&d!=="$?"&&d!=="$~"&&d!=="&"||l++}o=o.nextSibling}return null}function U1(o){o=o.previousSibling;for(var l=0;o;){if(o.nodeType===8){var d=o.data;if(d==="$"||d==="$!"||d==="$?"||d==="$~"||d==="&"){if(l===0)return o;l--}else d!=="/$"&&d!=="/&"||l++}o=o.previousSibling}return null}function F1(o,l,d){switch(l=Wf(d),o){case"html":if(o=l.documentElement,!o)throw Error(r(452));return o;case"head":if(o=l.head,!o)throw Error(r(453));return o;case"body":if(o=l.body,!o)throw Error(r(454));return o;default:throw Error(r(451))}}function ou(o){for(var l=o.attributes;l.length;)o.removeAttributeNode(l[0]);og(o)}var Nr=new Map,q1=new Set;function Kf(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var qi=Z.d;Z.d={f:Jz,r:Qz,D:eP,C:tP,L:nP,m:rP,X:sP,S:iP,M:oP};function Jz(){var o=qi.f(),l=Bf();return o||l}function Qz(o){var l=Ga(o);l!==null&&l.tag===5&&l.type==="form"?lC(l):qi.r(o)}var Cl=typeof document>"u"?null:document;function G1(o,l,d){var h=Cl;if(h&&typeof l=="string"&&l){var v=Cr(l);v='link[rel="'+o+'"][href="'+v+'"]',typeof d=="string"&&(v+='[crossorigin="'+d+'"]'),q1.has(v)||(q1.add(v),o={rel:o,crossOrigin:d,href:l},h.querySelector(v)===null&&(l=h.createElement("link"),En(l,"link",o),dn(l),h.head.appendChild(l)))}}function eP(o){qi.D(o),G1("dns-prefetch",o,null)}function tP(o,l){qi.C(o,l),G1("preconnect",o,l)}function nP(o,l,d){qi.L(o,l,d);var h=Cl;if(h&&o&&l){var v='link[rel="preload"][as="'+Cr(l)+'"]';l==="image"&&d&&d.imageSrcSet?(v+='[imagesrcset="'+Cr(d.imageSrcSet)+'"]',typeof d.imageSizes=="string"&&(v+='[imagesizes="'+Cr(d.imageSizes)+'"]')):v+='[href="'+Cr(o)+'"]';var S=v;switch(l){case"style":S=El(o);break;case"script":S=Tl(o)}Nr.has(S)||(o=m({rel:"preload",href:l==="image"&&d&&d.imageSrcSet?void 0:o,as:l},d),Nr.set(S,o),h.querySelector(v)!==null||l==="style"&&h.querySelector(au(S))||l==="script"&&h.querySelector(lu(S))||(l=h.createElement("link"),En(l,"link",o),dn(l),h.head.appendChild(l)))}}function rP(o,l){qi.m(o,l);var d=Cl;if(d&&o){var h=l&&typeof l.as=="string"?l.as:"script",v='link[rel="modulepreload"][as="'+Cr(h)+'"][href="'+Cr(o)+'"]',S=v;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":S=Tl(o)}if(!Nr.has(S)&&(o=m({rel:"modulepreload",href:o},l),Nr.set(S,o),d.querySelector(v)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(d.querySelector(lu(S)))return}h=d.createElement("link"),En(h,"link",o),dn(h),d.head.appendChild(h)}}}function iP(o,l,d){qi.S(o,l,d);var h=Cl;if(h&&o){var v=Wa(h).hoistableStyles,S=El(o);l=l||"default";var C=v.get(S);if(!C){var M={loading:0,preload:null};if(C=h.querySelector(au(S)))M.loading=5;else{o=m({rel:"stylesheet",href:o,"data-precedence":l},d),(d=Nr.get(S))&&sv(o,d);var L=C=h.createElement("link");dn(L),En(L,"link",o),L._p=new Promise(function(F,J){L.onload=F,L.onerror=J}),L.addEventListener("load",function(){M.loading|=1}),L.addEventListener("error",function(){M.loading|=2}),M.loading|=4,Zf(C,l,h)}C={type:"stylesheet",instance:C,count:1,state:M},v.set(S,C)}}}function sP(o,l){qi.X(o,l);var d=Cl;if(d&&o){var h=Wa(d).hoistableScripts,v=Tl(o),S=h.get(v);S||(S=d.querySelector(lu(v)),S||(o=m({src:o,async:!0},l),(l=Nr.get(v))&&ov(o,l),S=d.createElement("script"),dn(S),En(S,"link",o),d.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},h.set(v,S))}}function oP(o,l){qi.M(o,l);var d=Cl;if(d&&o){var h=Wa(d).hoistableScripts,v=Tl(o),S=h.get(v);S||(S=d.querySelector(lu(v)),S||(o=m({src:o,async:!0,type:"module"},l),(l=Nr.get(v))&&ov(o,l),S=d.createElement("script"),dn(S),En(S,"link",o),d.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},h.set(v,S))}}function W1(o,l,d,h){var v=(v=de.current)?Kf(v):null;if(!v)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof d.precedence=="string"&&typeof d.href=="string"?(l=El(d.href),d=Wa(v).hoistableStyles,h=d.get(l),h||(h={type:"style",instance:null,count:0,state:null},d.set(l,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(d.rel==="stylesheet"&&typeof d.href=="string"&&typeof d.precedence=="string"){o=El(d.href);var S=Wa(v).hoistableStyles,C=S.get(o);if(C||(v=v.ownerDocument||v,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},S.set(o,C),(S=v.querySelector(au(o)))&&!S._p&&(C.instance=S,C.state.loading=5),Nr.has(o)||(d={rel:"preload",as:"style",href:d.href,crossOrigin:d.crossOrigin,integrity:d.integrity,media:d.media,hrefLang:d.hrefLang,referrerPolicy:d.referrerPolicy},Nr.set(o,d),S||aP(v,o,d,C.state))),l&&h===null)throw Error(r(528,""));return C}if(l&&h!==null)throw Error(r(529,""));return null;case"script":return l=d.async,d=d.src,typeof d=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Tl(d),d=Wa(v).hoistableScripts,h=d.get(l),h||(h={type:"script",instance:null,count:0,state:null},d.set(l,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function El(o){return'href="'+Cr(o)+'"'}function au(o){return'link[rel="stylesheet"]['+o+"]"}function K1(o){return m({},o,{"data-precedence":o.precedence,precedence:null})}function aP(o,l,d,h){o.querySelector('link[rel="preload"][as="style"]['+l+"]")?h.loading=1:(l=o.createElement("link"),h.preload=l,l.addEventListener("load",function(){return h.loading|=1}),l.addEventListener("error",function(){return h.loading|=2}),En(l,"link",d),dn(l),o.head.appendChild(l))}function Tl(o){return'[src="'+Cr(o)+'"]'}function lu(o){return"script[async]"+o}function Z1(o,l,d){if(l.count++,l.instance===null)switch(l.type){case"style":var h=o.querySelector('style[data-href~="'+Cr(d.href)+'"]');if(h)return l.instance=h,dn(h),h;var v=m({},d,{"data-href":d.href,"data-precedence":d.precedence,href:null,precedence:null});return h=(o.ownerDocument||o).createElement("style"),dn(h),En(h,"style",v),Zf(h,d.precedence,o),l.instance=h;case"stylesheet":v=El(d.href);var S=o.querySelector(au(v));if(S)return l.state.loading|=4,l.instance=S,dn(S),S;h=K1(d),(v=Nr.get(v))&&sv(h,v),S=(o.ownerDocument||o).createElement("link"),dn(S);var C=S;return C._p=new Promise(function(M,L){C.onload=M,C.onerror=L}),En(S,"link",h),l.state.loading|=4,Zf(S,d.precedence,o),l.instance=S;case"script":return S=Tl(d.src),(v=o.querySelector(lu(S)))?(l.instance=v,dn(v),v):(h=d,(v=Nr.get(S))&&(h=m({},d),ov(h,v)),o=o.ownerDocument||o,v=o.createElement("script"),dn(v),En(v,"link",h),o.head.appendChild(v),l.instance=v);case"void":return null;default:throw Error(r(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(h=l.instance,l.state.loading|=4,Zf(h,d.precedence,o));return l.instance}function Zf(o,l,d){for(var h=d.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=h.length?h[h.length-1]:null,S=v,C=0;C<h.length;C++){var M=h[C];if(M.dataset.precedence===l)S=M;else if(S!==v)break}S?S.parentNode.insertBefore(o,S.nextSibling):(l=d.nodeType===9?d.head:d,l.insertBefore(o,l.firstChild))}function sv(o,l){o.crossOrigin==null&&(o.crossOrigin=l.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=l.referrerPolicy),o.title==null&&(o.title=l.title)}function ov(o,l){o.crossOrigin==null&&(o.crossOrigin=l.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=l.referrerPolicy),o.integrity==null&&(o.integrity=l.integrity)}var Yf=null;function Y1(o,l,d){if(Yf===null){var h=new Map,v=Yf=new Map;v.set(d,h)}else v=Yf,h=v.get(d),h||(h=new Map,v.set(d,h));if(h.has(o))return h;for(h.set(o,null),d=d.getElementsByTagName(o),v=0;v<d.length;v++){var S=d[v];if(!(S[Cc]||S[wn]||o==="link"&&S.getAttribute("rel")==="stylesheet")&&S.namespaceURI!=="http://www.w3.org/2000/svg"){var C=S.getAttribute(l)||"";C=o+C;var M=h.get(C);M?M.push(S):h.set(C,[S])}}return h}function X1(o,l,d){o=o.ownerDocument||o,o.head.insertBefore(d,l==="title"?o.querySelector("head > title"):null)}function lP(o,l,d){if(d===1||l.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;return l.rel==="stylesheet"?(o=l.disabled,typeof l.precedence=="string"&&o==null):!0;case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function J1(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function cP(o,l,d,h){if(d.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(d.state.loading&4)===0){if(d.instance===null){var v=El(h.href),S=l.querySelector(au(v));if(S){l=S._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(o.count++,o=Xf.bind(o),l.then(o,o)),d.state.loading|=4,d.instance=S,dn(S);return}S=l.ownerDocument||l,h=K1(h),(v=Nr.get(v))&&sv(h,v),S=S.createElement("link"),dn(S);var C=S;C._p=new Promise(function(M,L){C.onload=M,C.onerror=L}),En(S,"link",h),d.instance=S}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(d,l),(l=d.state.preload)&&(d.state.loading&3)===0&&(o.count++,d=Xf.bind(o),l.addEventListener("load",d),l.addEventListener("error",d))}}var av=0;function uP(o,l){return o.stylesheets&&o.count===0&&Qf(o,o.stylesheets),0<o.count||0<o.imgCount?function(d){var h=setTimeout(function(){if(o.stylesheets&&Qf(o,o.stylesheets),o.unsuspend){var S=o.unsuspend;o.unsuspend=null,S()}},6e4+l);0<o.imgBytes&&av===0&&(av=62500*Fz());var v=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&Qf(o,o.stylesheets),o.unsuspend)){var S=o.unsuspend;o.unsuspend=null,S()}},(o.imgBytes>av?50:800)+l);return o.unsuspend=d,function(){o.unsuspend=null,clearTimeout(h),clearTimeout(v)}}:null}function Xf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Qf(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Jf=null;function Qf(o,l){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Jf=new Map,l.forEach(dP,o),Jf=null,Xf.call(o))}function dP(o,l){if(!(l.state.loading&4)){var d=Jf.get(o);if(d)var h=d.get(null);else{d=new Map,Jf.set(o,d);for(var v=o.querySelectorAll("link[data-precedence],style[data-precedence]"),S=0;S<v.length;S++){var C=v[S];(C.nodeName==="LINK"||C.getAttribute("media")!=="not all")&&(d.set(C.dataset.precedence,C),h=C)}h&&d.set(null,h)}v=l.instance,C=v.getAttribute("data-precedence"),S=d.get(C)||h,S===h&&d.set(null,v),d.set(C,v),this.count++,h=Xf.bind(this),v.addEventListener("load",h),v.addEventListener("error",h),S?S.parentNode.insertBefore(v,S.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(v,o.firstChild)),l.state.loading|=4}}var cu={$$typeof:A,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function fP(o,l,d,h,v,S,C,M,L){this.tag=1,this.containerInfo=o,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=Ua(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ua(0),this.hiddenUpdates=Ua(null),this.identifierPrefix=h,this.onUncaughtError=v,this.onCaughtError=S,this.onRecoverableError=C,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=L,this.incompleteTransitions=new Map}function Q1(o,l,d,h,v,S,C,M,L,F,J,ee){return o=new fP(o,l,d,C,L,F,J,ee,M),l=1,S===!0&&(l|=24),S=cr(3,null,null,l),o.current=S,S.stateNode=o,l=$g(),l.refCount++,o.pooledCache=l,l.refCount++,S.memoizedState={element:h,isDehydrated:d,cache:l},Fg(S),o}function eE(o){return o?(o=rl,o):rl}function tE(o,l,d,h,v,S){v=eE(v),h.context===null?h.context=v:h.pendingContext=v,h=Os(l),h.payload={element:d},S=S===void 0?null:S,S!==null&&(h.callback=S),d=Ns(o,h,l),d!==null&&(ir(d,o,l),Vc(d,o,l))}function nE(o,l){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var d=o.retryLane;o.retryLane=d!==0&&d<l?d:l}}function lv(o,l){nE(o,l),(o=o.alternate)&&nE(o,l)}function rE(o){if(o.tag===13||o.tag===31){var l=qo(o,67108864);l!==null&&ir(l,o,67108864),lv(o,67108864)}}function iE(o){if(o.tag===13||o.tag===31){var l=pr();l=rg(l);var d=qo(o,l);d!==null&&ir(d,o,l),lv(o,l)}}var eh=!0;function hP(o,l,d,h){var v=B.T;B.T=null;var S=Z.p;try{Z.p=2,cv(o,l,d,h)}finally{Z.p=S,B.T=v}}function pP(o,l,d,h){var v=B.T;B.T=null;var S=Z.p;try{Z.p=8,cv(o,l,d,h)}finally{Z.p=S,B.T=v}}function cv(o,l,d,h){if(eh){var v=uv(h);if(v===null)Zy(o,l,h,th,d),oE(o,h);else if(gP(v,o,l,d,h))h.stopPropagation();else if(oE(o,h),l&4&&-1<mP.indexOf(o)){for(;v!==null;){var S=Ga(v);if(S!==null)switch(S.tag){case 3:if(S=S.stateNode,S.current.memoizedState.isDehydrated){var C=Sn(S.pendingLanes);if(C!==0){var M=S;for(M.pendingLanes|=2,M.entangledLanes|=2;C;){var L=1<<31-ge(C);M.entanglements[1]|=L,C&=~L}hi(S),(dt&6)===0&&(Pf=Jt()+500,ru(0))}}break;case 31:case 13:M=qo(S,2),M!==null&&ir(M,S,2),Bf(),lv(S,2)}if(S=uv(h),S===null&&Zy(o,l,h,th,d),S===v)break;v=S}v!==null&&h.stopPropagation()}else Zy(o,l,h,null,d)}}function uv(o){return o=fg(o),dv(o)}var th=null;function dv(o){if(th=null,o=qa(o),o!==null){var l=s(o);if(l===null)o=null;else{var d=l.tag;if(d===13){if(o=a(l),o!==null)return o;o=null}else if(d===31){if(o=c(l),o!==null)return o;o=null}else if(d===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;o=null}else l!==o&&(o=null)}}return th=o,null}function sE(o){switch(o){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(Fd()){case qd:return 2;case Gd:return 8;case wc:case gx:return 32;case xc:return 268435456;default:return 32}default:return 32}}var fv=!1,Us=null,Fs=null,qs=null,uu=new Map,du=new Map,Gs=[],mP="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 oE(o,l){switch(o){case"focusin":case"focusout":Us=null;break;case"dragenter":case"dragleave":Fs=null;break;case"mouseover":case"mouseout":qs=null;break;case"pointerover":case"pointerout":uu.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":du.delete(l.pointerId)}}function fu(o,l,d,h,v,S){return o===null||o.nativeEvent!==S?(o={blockedOn:l,domEventName:d,eventSystemFlags:h,nativeEvent:S,targetContainers:[v]},l!==null&&(l=Ga(l),l!==null&&rE(l)),o):(o.eventSystemFlags|=h,l=o.targetContainers,v!==null&&l.indexOf(v)===-1&&l.push(v),o)}function gP(o,l,d,h,v){switch(l){case"focusin":return Us=fu(Us,o,l,d,h,v),!0;case"dragenter":return Fs=fu(Fs,o,l,d,h,v),!0;case"mouseover":return qs=fu(qs,o,l,d,h,v),!0;case"pointerover":var S=v.pointerId;return uu.set(S,fu(uu.get(S)||null,o,l,d,h,v)),!0;case"gotpointercapture":return S=v.pointerId,du.set(S,fu(du.get(S)||null,o,l,d,h,v)),!0}return!1}function aE(o){var l=qa(o.target);if(l!==null){var d=s(l);if(d!==null){if(l=d.tag,l===13){if(l=a(d),l!==null){o.blockedOn=l,wx(o.priority,function(){iE(d)});return}}else if(l===31){if(l=c(d),l!==null){o.blockedOn=l,wx(o.priority,function(){iE(d)});return}}else if(l===3&&d.stateNode.current.memoizedState.isDehydrated){o.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}o.blockedOn=null}function nh(o){if(o.blockedOn!==null)return!1;for(var l=o.targetContainers;0<l.length;){var d=uv(o.nativeEvent);if(d===null){d=o.nativeEvent;var h=new d.constructor(d.type,d);dg=h,d.target.dispatchEvent(h),dg=null}else return l=Ga(d),l!==null&&rE(l),o.blockedOn=d,!1;l.shift()}return!0}function lE(o,l,d){nh(o)&&d.delete(l)}function yP(){fv=!1,Us!==null&&nh(Us)&&(Us=null),Fs!==null&&nh(Fs)&&(Fs=null),qs!==null&&nh(qs)&&(qs=null),uu.forEach(lE),du.forEach(lE)}function rh(o,l){o.blockedOn===l&&(o.blockedOn=null,fv||(fv=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,yP)))}var ih=null;function cE(o){ih!==o&&(ih=o,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){ih===o&&(ih=null);for(var l=0;l<o.length;l+=3){var d=o[l],h=o[l+1],v=o[l+2];if(typeof h!="function"){if(dv(h||d)===null)continue;break}var S=Ga(d);S!==null&&(o.splice(l,3),l-=3,uy(S,{pending:!0,data:v,method:d.method,action:h},h,v))}}))}function _l(o){function l(L){return rh(L,o)}Us!==null&&rh(Us,o),Fs!==null&&rh(Fs,o),qs!==null&&rh(qs,o),uu.forEach(l),du.forEach(l);for(var d=0;d<Gs.length;d++){var h=Gs[d];h.blockedOn===o&&(h.blockedOn=null)}for(;0<Gs.length&&(d=Gs[0],d.blockedOn===null);)aE(d),d.blockedOn===null&&Gs.shift();if(d=(o.ownerDocument||o).$$reactFormReplay,d!=null)for(h=0;h<d.length;h+=3){var v=d[h],S=d[h+1],C=v[Jn]||null;if(typeof S=="function")C||cE(d);else if(C){var M=null;if(S&&S.hasAttribute("formAction")){if(v=S,C=S[Jn]||null)M=C.formAction;else if(dv(v)!==null)continue}else M=C.action;typeof M=="function"?d[h+1]=M:(d.splice(h,3),h-=3),cE(d)}}}function uE(){function o(S){S.canIntercept&&S.info==="react-transition"&&S.intercept({handler:function(){return new Promise(function(C){return v=C})},focusReset:"manual",scroll:"manual"})}function l(){v!==null&&(v(),v=null),h||setTimeout(d,20)}function d(){if(!h&&!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 h=!1,v=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(d,100),function(){h=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),v!==null&&(v(),v=null)}}}function hv(o){this._internalRoot=o}sh.prototype.render=hv.prototype.render=function(o){var l=this._internalRoot;if(l===null)throw Error(r(409));var d=l.current,h=pr();tE(d,h,o,l,null,null)},sh.prototype.unmount=hv.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var l=o.containerInfo;tE(o.current,2,null,o,null,null),Bf(),l[Fa]=null}};function sh(o){this._internalRoot=o}sh.prototype.unstable_scheduleHydration=function(o){if(o){var l=Sx();o={blockedOn:null,target:o,priority:l};for(var d=0;d<Gs.length&&l!==0&&l<Gs[d].priority;d++);Gs.splice(d,0,o),d===0&&aE(o)}};var dE=e.version;if(dE!=="19.2.8")throw Error(r(527,dE,"19.2.8"));Z.findDOMNode=function(o){var l=o._reactInternals;if(l===void 0)throw typeof o.render=="function"?Error(r(188)):(o=Object.keys(o).join(","),Error(r(268,o)));return o=f(l),o=o!==null?p(o):null,o=o===null?null:o.stateNode,o};var vP={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var oh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!oh.isDisabled&&oh.supportsFiber)try{H=oh.inject(vP),re=oh}catch{}}return pu.createRoot=function(o,l){if(!i(o))throw Error(r(299));var d=!1,h="",v=vC,S=bC,C=SC;return l!=null&&(l.unstable_strictMode===!0&&(d=!0),l.identifierPrefix!==void 0&&(h=l.identifierPrefix),l.onUncaughtError!==void 0&&(v=l.onUncaughtError),l.onCaughtError!==void 0&&(S=l.onCaughtError),l.onRecoverableError!==void 0&&(C=l.onRecoverableError)),l=Q1(o,1,!1,null,null,d,h,null,v,S,C,uE),o[Fa]=l.current,Ky(o),new hv(l)},pu.hydrateRoot=function(o,l,d){if(!i(o))throw Error(r(299));var h=!1,v="",S=vC,C=bC,M=SC,L=null;return d!=null&&(d.unstable_strictMode===!0&&(h=!0),d.identifierPrefix!==void 0&&(v=d.identifierPrefix),d.onUncaughtError!==void 0&&(S=d.onUncaughtError),d.onCaughtError!==void 0&&(C=d.onCaughtError),d.onRecoverableError!==void 0&&(M=d.onRecoverableError),d.formState!==void 0&&(L=d.formState)),l=Q1(o,1,!0,l,d??null,h,v,L,S,C,M,uE),l.context=eE(null),d=l.current,h=pr(),h=rg(h),v=Os(h),v.callback=null,Ns(d,v,h),d=h,l.current.lanes=d,kc(l,d),hi(l),o[Fa]=l.current,Ky(o),new sh(l)},pu.version="19.2.8",pu}var CE;function AP(){if(CE)return yv.exports;CE=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(),yv.exports=_P(),yv.exports}var RP=AP();const MP=()=>{};var EE={};const MR=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=i&63|128):(i&64512)===55296&&r+1<t.length&&(t.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(t.charCodeAt(++r)&1023),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},OP=function(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=t[n++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){const s=t[n++],a=t[n++],c=t[n++],u=((i&7)<<18|(s&63)<<12|(a&63)<<6|c&63)-65536;e[r++]=String.fromCharCode(55296+(u>>10)),e[r++]=String.fromCharCode(56320+(u&1023))}else{const s=t[n++],a=t[n++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|a&63)}}return e.join("")},OR={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i<t.length;i+=3){const s=t[i],a=i+1<t.length,c=a?t[i+1]:0,u=i+2<t.length,f=u?t[i+2]:0,p=s>>2,m=(s&3)<<4|c>>4;let g=(c&15)<<2|f>>6,y=f&63;u||(y=64,a||(g=64)),r.push(n[p],n[m],n[g],n[y])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(MR(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):OP(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i<t.length;){const s=n[t.charAt(i++)],c=i<t.length?n[t.charAt(i)]:0;++i;const f=i<t.length?n[t.charAt(i)]:64;++i;const m=i<t.length?n[t.charAt(i)]:64;if(++i,s==null||c==null||f==null||m==null)throw new NP;const g=s<<2|c>>4;if(r.push(g),f!==64){const y=c<<4&240|f>>2;if(r.push(y),m!==64){const b=f<<6&192|m;r.push(b)}}}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 NP extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const DP=function(t){const e=MR(t);return OR.encodeByteArray(e,!0)},NR=function(t){return DP(t).replace(/\./g,"")},DR=function(t){try{return OR.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function IP(){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 LP=()=>IP().__FIREBASE_DEFAULTS__,zP=()=>{if(typeof process>"u"||typeof EE>"u")return;const t=EE.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},PP=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&DR(t[1]);return e&&JSON.parse(e)},gS=()=>{try{return MP()||LP()||zP()||PP()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},jP=t=>gS()?.emulatorHosts?.[t],IR=()=>gS()?.config,LR=t=>gS()?.[`_${t}`];class zR{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 Wn(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function BP(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Wn())}function $P(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function VP(){const t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function HP(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function UP(){const t=Wn();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function FP(){try{return typeof indexedDB=="object"}catch{return!1}}function qP(){return new Promise((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{e(i.error?.message||"")}}catch(n){e(n)}})}const GP="FirebaseError";class No extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=GP,Object.setPrototypeOf(this,No.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Cd.prototype.create)}}class Cd{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){const r=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],a=s?WP(s,r):"Error",c=`${this.serviceName}: ${a} (${i}).`;return new No(i,c,r)}}function WP(t,e){try{let n=0,r="";for(;n<t.length;){const i=t.indexOf("{$",n);if(i===-1){r+=t.substring(n);break}const s=t.indexOf("}",i+2);if(s===-1){r+=t.substring(n);break}const a=t.substring(i+2,s),c=e[a];r+=t.substring(n,i)+(c!=null?String(c):`<${a}?>`),n=s+1}return r}catch{return t}}function KP(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function Kl(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const i of n){if(!r.includes(i))return!1;const s=t[i],a=e[i];if(TE(s)&&TE(a)){if(!Kl(s,a))return!1}else if(s!==a)return!1}for(const i of r)if(!n.includes(i))return!1;return!0}function TE(t){return t!==null&&typeof t=="object"}function Ed(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function _u(t){const e={};return t.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[i,s]=r.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Au(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}function ZP(t,e){const n=new YP(t,e);return n.subscribe.bind(n)}class YP{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,r){let i;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");XP(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:r},i.next===void 0&&(i.next=wv),i.error===void 0&&(i.error=wv),i.complete===void 0&&(i.complete=wv);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n<this.observers.length;n++)this.sendOne(n,e)}sendOne(e,n){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function XP(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 wv(){}function Ss(t){return t&&t._delegate?t._delegate:t}function yS(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function JP(t){return(await fetch(t,{credentials:"include"})).ok}class Zl{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 sa="[DEFAULT]";class QP{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 zR;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const i=this.getOrInitializeService({instanceIdentifier:n});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){const n=this.normalizeInstanceIdentifier(e?.identifier),r=e?.optional??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(i){if(r)return null;throw i}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(tj(e))try{this.getOrInitializeService({instanceIdentifier:sa})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(n);try{const s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=sa){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=sa){return this.instances.has(e)}getOptions(e=sa){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:n={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const i=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[s,a]of this.instancesDeferred.entries()){const c=this.normalizeInstanceIdentifier(s);r===c&&a.resolve(i)}return i}onInit(e,n){const r=this.normalizeInstanceIdentifier(n),i=this.onInitCallbacks.get(r)??new Set;i.add(e),this.onInitCallbacks.set(r,i);const s=this.instances.get(r);return s&&e(s,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,n){const r=this.onInitCallbacks.get(n);if(r)for(const i of r)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:ej(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=sa){return this.component?this.component.multipleInstances?e:sa:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function ej(t){return t===sa?void 0:t}function tj(t){return t.instantiationMode==="EAGER"}class nj{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 QP(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}var Et;(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"})(Et||(Et={}));const rj={debug:Et.DEBUG,verbose:Et.VERBOSE,info:Et.INFO,warn:Et.WARN,error:Et.ERROR,silent:Et.SILENT},ij=Et.INFO,sj={[Et.DEBUG]:"log",[Et.VERBOSE]:"log",[Et.INFO]:"info",[Et.WARN]:"warn",[Et.ERROR]:"error"},oj=(t,e,...n)=>{if(e<t.logLevel)return;const r=new Date().toISOString(),i=sj[e];if(i)console[i](`[${r}] ${t.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class PR{constructor(e){this.name=e,this._logLevel=ij,this._logHandler=oj,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in Et))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?rj[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,Et.DEBUG,...e),this._logHandler(this,Et.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,Et.VERBOSE,...e),this._logHandler(this,Et.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,Et.INFO,...e),this._logHandler(this,Et.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,Et.WARN,...e),this._logHandler(this,Et.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,Et.ERROR,...e),this._logHandler(this,Et.ERROR,...e)}}const aj=(t,e)=>e.some(n=>t instanceof n);let _E,AE;function lj(){return _E||(_E=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function cj(){return AE||(AE=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const jR=new WeakMap,Db=new WeakMap,BR=new WeakMap,xv=new WeakMap,vS=new WeakMap;function uj(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",a)},s=()=>{n(po(t.result)),i()},a=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",a)});return e.then(n=>{n instanceof IDBCursor&&jR.set(n,t)}).catch(()=>{}),vS.set(e,t),e}function dj(t){if(Db.has(t))return;const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",a),t.removeEventListener("abort",a)},s=()=>{n(),i()},a=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",a),t.addEventListener("abort",a)});Db.set(t,e)}let Ib={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return Db.get(t);if(e==="objectStoreNames")return t.objectStoreNames||BR.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return po(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 fj(t){Ib=t(Ib)}function hj(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(kv(this),e,...n);return BR.set(r,e.sort?e.sort():[e]),po(r)}:cj().includes(t)?function(...e){return t.apply(kv(this),e),po(jR.get(this))}:function(...e){return po(t.apply(kv(this),e))}}function pj(t){return typeof t=="function"?hj(t):(t instanceof IDBTransaction&&dj(t),aj(t,lj())?new Proxy(t,Ib):t)}function po(t){if(t instanceof IDBRequest)return uj(t);if(xv.has(t))return xv.get(t);const e=pj(t);return e!==t&&(xv.set(t,e),vS.set(e,t)),e}const kv=t=>vS.get(t);function mj(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const a=indexedDB.open(t,e),c=po(a);return r&&a.addEventListener("upgradeneeded",u=>{r(po(a.result),u.oldVersion,u.newVersion,po(a.transaction),u)}),n&&a.addEventListener("blocked",u=>n(u.oldVersion,u.newVersion,u)),c.then(u=>{s&&u.addEventListener("close",()=>s()),i&&u.addEventListener("versionchange",f=>i(f.oldVersion,f.newVersion,f))}).catch(()=>{}),c}const gj=["get","getKey","getAll","getAllKeys","count"],yj=["put","add","delete","clear"],Cv=new Map;function RE(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Cv.get(e))return Cv.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=yj.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||gj.includes(n)))return;const s=async function(a,...c){const u=this.transaction(a,i?"readwrite":"readonly");let f=u.store;return r&&(f=f.index(c.shift())),(await Promise.all([f[n](...c),i&&u.done]))[0]};return Cv.set(e,s),s}fj(t=>({...t,get:(e,n,r)=>RE(e,n)||t.get(e,n,r),has:(e,n)=>!!RE(e,n)||t.has(e,n)}));class vj{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(bj(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function bj(t){return t.getComponent()?.type==="VERSION"}const Lb="@firebase/app",ME="0.16.0";const ms=new PR("@firebase/app"),Sj="@firebase/app-compat",wj="@firebase/analytics-compat",xj="@firebase/analytics",kj="@firebase/app-check-compat",Cj="@firebase/app-check",Ej="@firebase/auth",Tj="@firebase/auth-compat",_j="@firebase/database",Aj="@firebase/data-connect",Rj="@firebase/database-compat",Mj="@firebase/functions",Oj="@firebase/functions-compat",Nj="@firebase/installations",Dj="@firebase/installations-compat",Ij="@firebase/messaging",Lj="@firebase/messaging-compat",zj="@firebase/performance",Pj="@firebase/performance-compat",jj="@firebase/remote-config",Bj="@firebase/remote-config-compat",$j="@firebase/storage",Vj="@firebase/storage-compat",Hj="@firebase/firestore",Uj="@firebase/ai",Fj="@firebase/firestore-compat",qj="firebase",Gj="12.17.0";const zb="[DEFAULT]",Wj={[Lb]:"fire-core",[Sj]:"fire-core-compat",[xj]:"fire-analytics",[wj]:"fire-analytics-compat",[Cj]:"fire-app-check",[kj]:"fire-app-check-compat",[Ej]:"fire-auth",[Tj]:"fire-auth-compat",[_j]:"fire-rtdb",[Aj]:"fire-data-connect",[Rj]:"fire-rtdb-compat",[Mj]:"fire-fn",[Oj]:"fire-fn-compat",[Nj]:"fire-iid",[Dj]:"fire-iid-compat",[Ij]:"fire-fcm",[Lj]:"fire-fcm-compat",[zj]:"fire-perf",[Pj]:"fire-perf-compat",[jj]:"fire-rc",[Bj]:"fire-rc-compat",[$j]:"fire-gcs",[Vj]:"fire-gcs-compat",[Hj]:"fire-fst",[Fj]:"fire-fst-compat",[Uj]:"fire-vertex","fire-js":"fire-js",[qj]:"fire-js-all"};const ed=new Map,Kj=new Map,Pb=new Map;function OE(t,e){try{t.container.addComponent(e)}catch(n){ms.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function td(t){const e=t.name;if(Pb.has(e))return ms.debug(`There were multiple attempts to register component ${e}.`),!1;Pb.set(e,t);for(const n of ed.values())OE(n,t);for(const n of Kj.values())OE(n,t);return!0}function $R(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function Qr(t){return t==null?!1:t.settings!==void 0}const Zj={"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."},ns=new Cd("app","Firebase",Zj);class Yj{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 Zl("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 ns.create("app-deleted",{appName:this._name})}}const Td=Gj;function VR(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r={name:zb,automaticDataCollectionEnabled:!0,...e},i=r.name;if(typeof i!="string"||!i)throw ns.create("bad-app-name",{appName:String(i)});if(n||(n=IR()),!n)throw ns.create("no-options");const s=ed.get(i);if(s)if(Kl(n,s.options)){if(Kl(r,s.config))return s;throw ns.create("duplicate-app",{appName:i,mismatchedParam:"config",oldValue:JSON.stringify(s.config),newValue:JSON.stringify(r)})}else throw ns.create("duplicate-app",{appName:i,mismatchedParam:"options",oldValue:JSON.stringify(s.options),newValue:JSON.stringify(n)});const a=new nj(i);for(const u of Pb.values())a.addComponent(u);const c=new Yj(n,r,a);return ed.set(i,c),c}function HR(t=zb){const e=ed.get(t);if(!e&&t===zb&&IR())return VR();if(!e)throw ns.create("no-app",{appName:t});return e}function Xj(){return Array.from(ed.values())}function $l(t,e,n){let r=Wj[t]??t;n&&(r+=`-${n}`);const i=r.match(/\s|\//),s=e.match(/\s|\//);if(i||s){const a=[`Unable to register library "${r}" with version "${e}":`];i&&a.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&s&&a.push("and"),s&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),ms.warn(a.join(" "));return}td(new Zl(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}const Jj="firebase-heartbeat-database",Qj=1,nd="firebase-heartbeat-store";let Ev=null;function UR(){return Ev||(Ev=mj(Jj,Qj,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(nd)}catch(n){console.warn(n)}}}}).catch(t=>{throw ns.create("idb-open",{originalErrorMessage:t.message})})),Ev}async function eB(t){try{const n=(await UR()).transaction(nd),r=await n.objectStore(nd).get(FR(t));return await n.done,r}catch(e){if(e instanceof No)ms.warn(e.message);else{const n=ns.create("idb-get",{originalErrorMessage:e?.message});ms.warn(n.message)}}}async function NE(t,e){try{const r=(await UR()).transaction(nd,"readwrite");await r.objectStore(nd).put(e,FR(t)),await r.done}catch(n){if(n instanceof No)ms.warn(n.message);else{const r=ns.create("idb-set",{originalErrorMessage:n?.message});ms.warn(r.message)}}}function FR(t){return`${t.name}!${t.options.appId}`}const tB=1024,nB=30;class rB{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new sB(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){try{const n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=DE();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(i=>i.date===r))return;if(this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats.length>nB){const i=oB(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){ms.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";const e=DE(),{heartbeatsToSend:n,unsentEntries:r}=iB(this._heartbeatsCache.heartbeats),i=NR(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(e){return ms.warn(e),""}}}function DE(){return new Date().toISOString().substring(0,10)}function iB(t,e=tB){const n=[];let r=t.slice();for(const i of t){const s=n.find(a=>a.agent===i.agent);if(s){if(s.dates.push(i.date),IE(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),IE(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class sB{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return FP()?qP().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await eB(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return NE(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 NE(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function IE(t){return NR(JSON.stringify({version:2,heartbeats:t})).length}function oB(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 aB(t){td(new Zl("platform-logger",e=>new vj(e),"PRIVATE")),td(new Zl("heartbeat",e=>new rB(e),"PRIVATE")),$l(Lb,ME,t),$l(Lb,ME,"esm2020"),$l("fire-js","")}aB("");var lB="firebase",cB="12.17.1";$l(lB,cB,"app");function qR(){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 uB=qR,GR=new Cd("auth","Firebase",qR());const sp=new PR("@firebase/auth");function WR(t,...e){sp.logLevel<=Et.WARN&&sp.warn(`Auth (${Td}): ${t}`,...e)}function Hh(t,...e){sp.logLevel<=Et.ERROR&&sp.error(`Auth (${Td}): ${t}`,...e)}function $r(t,...e){throw SS(t,...e)}function ii(t,...e){return SS(t,...e)}function bS(t,e,n){const r={...uB(),[e]:n};return new Cd("auth","Firebase",r).create(e,{appName:t.name})}function mo(t){return bS(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function dB(t,e,n){const r=n;if(!(e instanceof r))throw r.name!==e.constructor.name&&$r(t,"argument-error"),bS(t,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function SS(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 GR.create(t,...e)}function Be(t,e,...n){if(!t)throw SS(e,...n)}function rs(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Hh(e),new Error(e)}function gs(t,e){t||rs(e)}function jb(){return typeof self<"u"&&self.location?.href||""}function fB(){return LE()==="http:"||LE()==="https:"}function LE(){return typeof self<"u"&&self.location?.protocol||null}function hB(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(fB()||VP()||"connection"in navigator)?navigator.onLine:!0}function pB(){if(typeof navigator>"u")return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}class _d{constructor(e,n){this.shortDelay=e,this.longDelay=n,gs(n>e,"Short delay should be less than long delay!"),this.isMobile=BP()||HP()}get(){return hB()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function wS(t,e){gs(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}class KR{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;rs("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;rs("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;rs("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const mB={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 gB=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],yB=new _d(3e4,6e4);function La(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function Do(t,e,n,r,i={}){return ZR(t,i,async()=>{let s={},a={};r&&(e==="GET"?a=r:s={body:JSON.stringify(r)});const c=Ed({...a,key:t.config.apiKey}).slice(1),u=await t._getAdditionalHeaders();u["Content-Type"]="application/json",t.languageCode&&(u["X-Firebase-Locale"]=t.languageCode);const f={method:e,headers:u,...s};return $P()||(f.referrerPolicy="strict-origin-when-cross-origin"),t.emulatorConfig&&yS(t.emulatorConfig.host)&&(f.credentials="include"),KR.fetch()(await YR(t,t.config.apiHost,n,c),f)})}async function ZR(t,e,n){t._canInitEmulator=!1;const r={...mB,...e};try{const i=new bB(t),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();const a=await s.json();if("needConfirmation"in a)throw ah(t,"account-exists-with-different-credential",a);if(s.ok&&!("errorMessage"in a))return a;{const c=s.ok?a.errorMessage:a.error.message,[u,f]=c.split(" : ");if(u==="FEDERATED_USER_ID_ALREADY_LINKED")throw ah(t,"credential-already-in-use",a);if(u==="EMAIL_EXISTS")throw ah(t,"email-already-in-use",a);if(u==="USER_DISABLED")throw ah(t,"user-disabled",a);const p=r[u]||u.toLowerCase().replace(/[_\s]+/g,"-");if(f)throw bS(t,p,f);$r(t,p)}}catch(i){if(i instanceof No)throw i;$r(t,"network-request-failed",{message:String(i)})}}async function bm(t,e,n,r,i={}){const s=await Do(t,e,n,r,i);return"mfaPendingCredential"in s&&$r(t,"multi-factor-auth-required",{_serverResponse:s}),s}async function YR(t,e,n,r){const i=`${e}${n}?${r}`,s=t,a=s.config.emulator?wS(t.config,i):`${t.config.apiScheme}://${i}`;return gB.includes(n)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(a).toString():a}function vB(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class bB{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(ii(this.auth,"network-request-failed")),yB.get())})}}function ah(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=ii(t,e,r);return i.customData._tokenResponse=n,i}function zE(t){return t!==void 0&&t.enterprise!==void 0}class SB{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 vB(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 wB(t,e){return Do(t,"GET","/v2/recaptchaConfig",La(t,e))}async function xB(t,e){return Do(t,"POST","/v1/accounts:delete",e)}async function op(t,e){return Do(t,"POST","/v1/accounts:lookup",e)}function ju(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function kB(t,e=!1){const n=Ss(t),r=await n.getIdToken(e),i=xS(r);Be(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");const s=typeof i.firebase=="object"?i.firebase:void 0,a=s?.sign_in_provider;return{claims:i,token:r,authTime:ju(Tv(i.auth_time)),issuedAtTime:ju(Tv(i.iat)),expirationTime:ju(Tv(i.exp)),signInProvider:a||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Tv(t){return Number(t)*1e3}function xS(t){const[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return Hh("JWT malformed, contained fewer than 3 sections"),null;try{const i=DR(n);return i?JSON.parse(i):(Hh("Failed to decode base64 JWT payload"),null)}catch(i){return Hh("Caught error parsing JWT payload as JSON",i?.toString()),null}}function PE(t){const e=xS(t);return Be(e,"internal-error"),Be(typeof e.exp<"u","internal-error"),Be(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function rd(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof No&&CB(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function CB({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}class EB{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 Bb{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ju(this.lastLoginAt),this.creationTime=ju(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function ap(t){const e=t.auth,n=await t.getIdToken(),r=await rd(t,op(e,{idToken:n}));Be(r?.users.length,e,"internal-error");const i=r.users[0];t._notifyReloadListener(i);const s=i.providerUserInfo?.length?XR(i.providerUserInfo):[],a=_B(t.providerData,s),c=t.isAnonymous,u=!(t.email&&i.passwordHash)&&!a?.length,f=c?u:!1,p={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:a,metadata:new Bb(i.createdAt,i.lastLoginAt),isAnonymous:f};Object.assign(t,p)}async function TB(t){const e=Ss(t);await ap(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function _B(t,e){return[...t.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function XR(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 AB(t,e){const n=await ZR(t,{},async()=>{const r=Ed({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=t.config,a=await YR(t,i,"/v1/token",`key=${s}`),c=await t._getAdditionalHeaders();c["Content-Type"]="application/x-www-form-urlencoded";const u={method:"POST",headers:c,body:r};return t.emulatorConfig&&yS(t.emulatorConfig.host)&&(u.credentials="include"),KR.fetch()(a,u)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function RB(t,e){return Do(t,"POST","/v2/accounts:revokeToken",La(t,e))}class Vl{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Be(e.idToken,"internal-error"),Be(typeof e.idToken<"u","internal-error"),Be(typeof e.refreshToken<"u","internal-error");const n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):PE(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){Be(e.length!==0,"internal-error");const n=PE(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(Be(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){const{accessToken:r,refreshToken:i,expiresIn:s}=await AB(e,n);this.updateTokensAndExpiration(r,i,Number(s))}updateTokensAndExpiration(e,n,r){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,n){const{refreshToken:r,accessToken:i,expirationTime:s}=n,a=new Vl;return r&&(Be(typeof r=="string","internal-error",{appName:e}),a.refreshToken=r),i&&(Be(typeof i=="string","internal-error",{appName:e}),a.accessToken=i),s&&(Be(typeof s=="number","internal-error",{appName:e}),a.expirationTime=s),a}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 Vl,this.toJSON())}_performRefresh(){return rs("not implemented")}}function Ks(t,e){Be(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}class ni{constructor({uid:e,auth:n,stsTokenManager:r,...i}){this.providerId="firebase",this.proactiveRefresh=new EB(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new Bb(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const n=await rd(this,this.stsTokenManager.getToken(this.auth,e));return Be(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return kB(this,e)}reload(){return TB(this)}_assign(e){this!==e&&(Be(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 ni({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){Be(!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 ap(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Qr(this.auth.app))return Promise.reject(mo(this.auth));const e=await this.getIdToken();return await rd(this,xB(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){const r=n.displayName??void 0,i=n.email??void 0,s=n.phoneNumber??void 0,a=n.photoURL??void 0,c=n.tenantId??void 0,u=n._redirectEventId??void 0,f=n.createdAt??void 0,p=n.lastLoginAt??void 0,{uid:m,emailVerified:g,isAnonymous:y,providerData:b,stsTokenManager:w}=n;Be(m&&w,e,"internal-error");const x=Vl.fromJSON(this.name,w);Be(typeof m=="string",e,"internal-error"),Ks(r,e.name),Ks(i,e.name),Be(typeof g=="boolean",e,"internal-error"),Be(typeof y=="boolean",e,"internal-error"),Ks(s,e.name),Ks(a,e.name),Ks(c,e.name),Ks(u,e.name),Ks(f,e.name),Ks(p,e.name);const k=new ni({uid:m,auth:e,email:i,emailVerified:g,displayName:r,isAnonymous:y,photoURL:a,phoneNumber:s,tenantId:c,stsTokenManager:x,createdAt:f,lastLoginAt:p});return b&&Array.isArray(b)&&(k.providerData=b.map(T=>({...T}))),u&&(k._redirectEventId=u),k}static async _fromIdTokenResponse(e,n,r=!1){const i=new Vl;i.updateFromServerResponse(n);const s=new ni({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await ap(s),s}static async _fromGetAccountInfoResponse(e,n,r){const i=n.users[0];Be(i.localId!==void 0,"internal-error");const s=i.providerUserInfo!==void 0?XR(i.providerUserInfo):[],a=!(i.email&&i.passwordHash)&&!s?.length,c=new Vl;c.updateFromIdToken(r);const u=new ni({uid:i.localId,auth:e,stsTokenManager:c,isAnonymous:a}),f={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new Bb(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(u,f),u}}const jE=new Map;function is(t){gs(t instanceof Function,"Expected a class definition");let e=jE.get(t);return e?(gs(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,jE.set(t,e),e)}class JR{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){}}JR.type="NONE";const BE=JR;function Uh(t,e,n){return`firebase:${t}:${e}:${n}`}class Hl{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;const{config:i,name:s}=this.auth;this.fullUserKey=Uh(this.userKey,i.apiKey,s),this.fullPersistenceKey=Uh("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){const n=await op(this.auth,{idToken:e}).catch(()=>{});return n?ni._fromGetAccountInfoResponse(this.auth,n,e):null}return ni._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,r="authUser"){if(!n.length)return new Hl(is(BE),e,r);const i=(await Promise.all(n.map(async f=>{if(await f._isAvailable())return f}))).filter(f=>f);let s=i[0]||is(BE);const a=Uh(r,e.config.apiKey,e.name);let c=null;for(const f of n)try{const p=await f._get(a);if(p){let m;if(typeof p=="string"){const g=await op(e,{idToken:p}).catch(()=>{});if(!g)break;m=await ni._fromGetAccountInfoResponse(e,g,p)}else m=ni._fromJSON(e,p);f!==s&&(c=m),s=f;break}}catch{}const u=i.filter(f=>f._shouldAllowMigration);return!s._shouldAllowMigration||!u.length?new Hl(s,e,r):(s=u[0],c&&await s._set(a,c.toJSON()),await Promise.all(n.map(async f=>{if(f!==s)try{await f._remove(a)}catch{}})),new Hl(s,e,r))}}function $E(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(nM(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(QR(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(iM(e))return"Blackberry";if(sM(e))return"Webos";if(eM(e))return"Safari";if((e.includes("chrome/")||tM(e))&&!e.includes("edge/"))return"Chrome";if(rM(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 QR(t=Wn()){return/firefox\//i.test(t)}function eM(t=Wn()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function tM(t=Wn()){return/crios\//i.test(t)}function nM(t=Wn()){return/iemobile/i.test(t)}function rM(t=Wn()){return/android/i.test(t)}function iM(t=Wn()){return/blackberry/i.test(t)}function sM(t=Wn()){return/webos/i.test(t)}function kS(t=Wn()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function MB(t=Wn()){return kS(t)&&!!window.navigator?.standalone}function OB(){return UP()&&document.documentMode===10}function oM(t=Wn()){return kS(t)||rM(t)||sM(t)||iM(t)||/windows phone/i.test(t)||nM(t)}function aM(t,e=[]){let n;switch(t){case"Browser":n=$E(Wn());break;case"Worker":n=`${$E(Wn())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Td}/${r}`}class NB{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const r=s=>new Promise((a,c)=>{try{const u=e(s);a(u)}catch(u){c(u)}});r.onAbort=n,this.queue.push(r);const i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const n=[];try{for(const r of this.queue)await r(e),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(const i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r?.message})}}}async function DB(t,e={}){return Do(t,"GET","/v2/passwordPolicy",La(t,e))}const IB=6;class LB{constructor(e){const n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??IB,n.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=n.maxPasswordLength),n.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=n.containsLowercaseCharacter),n.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=n.containsUppercaseCharacter),n.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=n.containsNumericCharacter),n.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=n.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const n={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,n),this.validatePasswordCharacterOptions(e,n),n.isValid&&(n.isValid=n.meetsMinPasswordLength??!0),n.isValid&&(n.isValid=n.meetsMaxPasswordLength??!0),n.isValid&&(n.isValid=n.containsLowercaseLetter??!0),n.isValid&&(n.isValid=n.containsUppercaseLetter??!0),n.isValid&&(n.isValid=n.containsNumericCharacter??!0),n.isValid&&(n.isValid=n.containsNonAlphanumericCharacter??!0),n}validatePasswordLengthOptions(e,n){const r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let i=0;i<e.length;i++)r=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(n,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}}class zB{constructor(e,n,r,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new VE(this),this.idTokenSubscription=new VE(this),this.beforeStateQueue=new NB(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=GR,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(s=>this._resolvePersistenceManagerAvailable=s)}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=is(n)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await Hl.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=this.currentUser?.uid||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const n=await op(this,{idToken:e}),r=await ni._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(Qr(this.app)){const s=this.app.settings.authIdToken;return s?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(s).then(a,a))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const s=this.redirectUser?._redirectEventId,a=r?._redirectEventId,c=await this.tryRedirectSignIn(e);(!s||s===a)&&c?.user&&(r=c.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(s){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(s))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Be(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 ap(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=pB()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Qr(this.app))return Promise.reject(mo(this));const n=e?Ss(e):null;return n&&Be(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&&Be(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 Qr(this.app)?Promise.reject(mo(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Qr(this.app)?Promise.reject(mo(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(is(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 DB(this),n=new LB(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 Cd("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 RB(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&&is(e)||this._popupRedirectResolver;Be(n,this,"argument-error"),this.redirectPersistenceManager=await Hl.create(this,[is(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===e?this._currentUser:this.redirectUser?._redirectEventId===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,i){if(this._deleted)return()=>{};const s=typeof n=="function"?n:n.next.bind(n);let a=!1;const c=this._isInitialized?Promise.resolve():this._initializationPromise;if(Be(c,this,"internal-error"),c.then(()=>{a||s(this.currentUser)}),typeof n=="function"){const u=e.addObserver(n,r,i);return()=>{a=!0,u()}}else{const u=e.addObserver(n);return()=>{a=!0,u()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return Be(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=aM(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(Qr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&WR(`Error while retrieving App Check token: ${e.error}`),e?.token}}function za(t){return Ss(t)}class VE{constructor(e){this.auth=e,this.observer=null,this.addObserver=ZP(n=>this.observer=n)}get next(){return Be(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let Sm={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function PB(t){Sm=t}function lM(t){return Sm.loadJS(t)}function jB(){return Sm.recaptchaEnterpriseScript}function BB(){return Sm.gapiScript}function $B(t){return`__${t}${Math.floor(Math.random()*1e6)}`}class VB{constructor(){this.enterprise=new HB}ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}}class HB{ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}}const UB="recaptcha-enterprise",cM="NO_RECAPTCHA",HE="onFirebaseAuthREInstanceReady";class no{constructor(e){this.type=UB,this.auth=za(e)}async verify(e="verify",n=!1){async function r(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(a,c)=>{wB(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(u=>{if(u.recaptchaKey===void 0)c(new Error("recaptcha Enterprise site key undefined"));else{const f=new SB(u);return s.tenantId==null?s._agentRecaptchaConfig=f:s._tenantRecaptchaConfigs[s.tenantId]=f,a(f.siteKey)}}).catch(u=>{c(u)})})}function i(s,a,c){const u=window.grecaptcha;zE(u)?u.enterprise.ready(()=>{u.enterprise.execute(s,{action:e}).then(f=>{a(f)}).catch(()=>{a(cM)})}):c(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new VB().execute("siteKey",{action:"verify"}):new Promise((s,a)=>{r(this.auth).then(async c=>{if(!n&&zE(window.grecaptcha)&&no.scriptInjectionDeferred)await no.scriptInjectionDeferred.promise,i(c,s,a);else{if(typeof window>"u"){a(new Error("RecaptchaVerifier is only supported in browser"));return}let u=jB();u.length!==0&&(u+=c+`&onload=${HE}`),no.scriptInjectionDeferred=new zR,window[HE]=()=>{no.scriptInjectionDeferred?.resolve()},lM(u).then(()=>no.scriptInjectionDeferred?.promise).then(()=>{i(c,s,a)}).catch(f=>{a(f)})}}).catch(c=>{a(c)})})}}no.scriptInjectionDeferred=null;async function UE(t,e,n,r=!1,i=!1){const s=new no(t);let a;if(i)a=cM;else try{a=await s.verify(n)}catch{a=await s.verify(n,!0)}const c={...e};if(n==="mfaSmsEnrollment"||n==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in c){const u=c.phoneEnrollmentInfo.phoneNumber,f=c.phoneEnrollmentInfo.recaptchaToken;Object.assign(c,{phoneEnrollmentInfo:{phoneNumber:u,recaptchaToken:f,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in c){const u=c.phoneSignInInfo.recaptchaToken;Object.assign(c,{phoneSignInInfo:{recaptchaToken:u,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return c}return r?Object.assign(c,{captchaResp:a}):Object.assign(c,{captchaResponse:a}),Object.assign(c,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(c,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),c}async function FE(t,e,n,r,i){if(t._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const s=await UE(t,e,n,n==="getOobCode");return r(t,s)}else return r(t,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const a=await UE(t,e,n,n==="getOobCode");return r(t,a)}else return Promise.reject(s)})}function FB(t,e){const n=$R(t,"auth");if(n.isInitialized()){const i=n.getImmediate(),s=n.getOptions();if(Kl(s,e??{}))return i;$r(i,"already-initialized")}return n.initialize({options:e})}function qB(t,e){const n=e?.persistence||[],r=(Array.isArray(n)?n:[n]).map(is);e?.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e?.popupRedirectResolver)}function GB(t,e,n){const r=za(t);Be(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const i=!1,s=uM(e),{host:a,port:c}=WB(e),u=c===null?"":`:${c}`,f={url:`${s}//${a}${u}/`},p=Object.freeze({host:a,port:c,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator){Be(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),Be(Kl(f,r.config.emulator)&&Kl(p,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=f,r.emulatorConfig=p,r.settings.appVerificationDisabledForTesting=!0,yS(a)?JP(`${s}//${a}${u}`):KB()}function uM(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function WB(t){const e=uM(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const s=i[1];return{host:s,port:qE(r.substr(s.length+1))}}else{const[s,a]=r.split(":");return{host:s,port:qE(a)}}}function qE(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}function KB(){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 CS{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return rs("not implemented")}_getIdTokenResponse(e){return rs("not implemented")}_linkToIdToken(e,n){return rs("not implemented")}_getReauthenticationResolver(e){return rs("not implemented")}}async function ZB(t,e){return Do(t,"POST","/v1/accounts:signUp",e)}async function YB(t,e){return bm(t,"POST","/v1/accounts:signInWithPassword",La(t,e))}async function XB(t,e){return bm(t,"POST","/v1/accounts:signInWithEmailLink",La(t,e))}async function JB(t,e){return bm(t,"POST","/v1/accounts:signInWithEmailLink",La(t,e))}class id extends CS{constructor(e,n,r,i=null){super("password",r),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new id(e,n,"password")}static _fromEmailAndCode(e,n,r=null){return new id(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 FE(e,n,"signInWithPassword",YB);case"emailLink":return XB(e,{email:this._email,oobCode:this._password});default:$r(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 FE(e,r,"signUpPassword",ZB);case"emailLink":return JB(e,{idToken:n,email:this._email,oobCode:this._password});default:$r(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function Ul(t,e){return bm(t,"POST","/v1/accounts:signInWithIdp",La(t,e))}const QB="http://localhost";class wa extends CS{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const n=new wa(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):$r("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i,...s}=n;if(!r||!i)return null;const a=new wa(r,i);return a.idToken=s.idToken||void 0,a.accessToken=s.accessToken||void 0,a.secret=s.secret,a.nonce=s.nonce,a.pendingToken=s.pendingToken||null,a}_getIdTokenResponse(e){const n=this.buildRequest();return Ul(e,n)}_linkToIdToken(e,n){const r=this.buildRequest();return r.idToken=n,Ul(e,r)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,Ul(e,n)}buildRequest(){const e={requestUri:QB,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=Ed(n)}return e}}function e$(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 t$(t){const e=_u(Au(t)).link,n=e?_u(Au(e)).deep_link_id:null,r=_u(Au(t)).deep_link_id;return(r?_u(Au(r)).link:null)||r||n||e||t}class ES{constructor(e){const n=_u(Au(e)),r=n.apiKey??null,i=n.oobCode??null,s=e$(n.mode??null);Be(r&&i&&s,"argument-error"),this.apiKey=r,this.operation=s,this.code=i,this.continueUrl=n.continueUrl??null,this.languageCode=n.lang??null,this.tenantId=n.tenantId??null}static parseLink(e){const n=t$(e);try{return new ES(n)}catch{return null}}}class hc{constructor(){this.providerId=hc.PROVIDER_ID}static credential(e,n){return id._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){const r=ES.parseLink(n);return Be(r,"argument-error"),id._fromEmailAndCode(e,r.code,r.tenantId)}}hc.PROVIDER_ID="password";hc.EMAIL_PASSWORD_SIGN_IN_METHOD="password";hc.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class TS{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 Ad extends TS{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class ro extends Ad{constructor(){super("facebook.com")}static credential(e){return wa._fromParams({providerId:ro.PROVIDER_ID,signInMethod:ro.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return ro.credentialFromTaggedObject(e)}static credentialFromError(e){return ro.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return ro.credential(e.oauthAccessToken)}catch{return null}}}ro.FACEBOOK_SIGN_IN_METHOD="facebook.com";ro.PROVIDER_ID="facebook.com";class ts extends Ad{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return wa._fromParams({providerId:ts.PROVIDER_ID,signInMethod:ts.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return ts.credentialFromTaggedObject(e)}static credentialFromError(e){return ts.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return ts.credential(n,r)}catch{return null}}}ts.GOOGLE_SIGN_IN_METHOD="google.com";ts.PROVIDER_ID="google.com";class io extends Ad{constructor(){super("github.com")}static credential(e){return wa._fromParams({providerId:io.PROVIDER_ID,signInMethod:io.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return io.credentialFromTaggedObject(e)}static credentialFromError(e){return io.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return io.credential(e.oauthAccessToken)}catch{return null}}}io.GITHUB_SIGN_IN_METHOD="github.com";io.PROVIDER_ID="github.com";class so extends Ad{constructor(){super("twitter.com")}static credential(e,n){return wa._fromParams({providerId:so.PROVIDER_ID,signInMethod:so.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return so.credentialFromTaggedObject(e)}static credentialFromError(e){return so.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return so.credential(n,r)}catch{return null}}}so.TWITTER_SIGN_IN_METHOD="twitter.com";so.PROVIDER_ID="twitter.com";class Yl{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,i=!1){const s=await ni._fromIdTokenResponse(e,r,i),a=GE(r);return new Yl({user:s,providerId:a,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);const i=GE(r);return new Yl({user:e,providerId:i,_tokenResponse:r,operationType:n})}}function GE(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}class lp extends No{constructor(e,n,r,i){super(n.code,n.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,lp.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,i){return new lp(e,n,r,i)}}function dM(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?lp._fromErrorAndOperation(t,s,e,r):s})}async function n$(t,e,n=!1){const r=await rd(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return Yl._forOperation(t,"link",r)}async function r$(t,e,n=!1){const{auth:r}=t;if(Qr(r.app))return Promise.reject(mo(r));const i="reauthenticate";try{const s=await rd(t,dM(r,i,e,t),n);Be(s.idToken,r,"internal-error");const a=xS(s.idToken);Be(a,r,"internal-error");const{sub:c}=a;return Be(t.uid===c,r,"user-mismatch"),Yl._forOperation(t,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&$r(r,"user-mismatch"),s}}async function fM(t,e,n=!1){if(Qr(t.app))return Promise.reject(mo(t));const r="signIn",i=await dM(t,r,e),s=await Yl._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}async function i$(t,e){return fM(za(t),e)}async function s$(t){const e=za(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}function o$(t,e,n){return Qr(t.app)?Promise.reject(mo(t)):i$(Ss(t),hc.credential(e,n)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&s$(t),r})}function a$(t,e,n,r){return Ss(t).onIdTokenChanged(e,n,r)}function l$(t,e,n){return Ss(t).beforeAuthStateChanged(e,n)}function c$(t,e,n,r){return Ss(t).onAuthStateChanged(e,n,r)}function WE(t){return Ss(t).signOut()}const cp="__sak";class hM{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(cp,"1"),this.storage.removeItem(cp),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 u$=1e3,d$=10;class pM extends hM{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=oM(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),i=this.localCache[n];r!==i&&e(n,i,r)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((a,c,u)=>{this.notifyListeners(a,u)});return}const r=e.key;n?this.detachListener():this.stopPolling();const i=()=>{const a=this.storage.getItem(r);!n&&this.localCache[r]===a||this.notifyListeners(r,a)},s=this.storage.getItem(r);OB()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,d$):i()}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:r}),!0)})},u$)}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]}}pM.type="LOCAL";const f$=pM;class mM extends hM{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}}mM.type="SESSION";const gM=mM;function h$(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}class wm{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;const r=new wm(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const n=e,{eventId:r,eventType:i,data:s}=n.data,a=this.handlersMap[i];if(!a?.size)return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:i});const c=Array.from(a).map(async f=>f(n.origin,s)),u=await h$(c);n.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:u})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}wm.receivers=[];function _S(t="",e=10){let n="";for(let r=0;r<e;r++)n+=Math.floor(Math.random()*10);return t+n}class p${constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,n,r=50){const i=typeof MessageChannel<"u"?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let s,a;return new Promise((c,u)=>{const f=_S("",20);i.port1.start();const p=setTimeout(()=>{u(new Error("unsupported_event"))},r);a={messageChannel:i,onMessage(m){const g=m;if(g.data.eventId===f)switch(g.data.status){case"ack":clearTimeout(p),s=setTimeout(()=>{u(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),c(g.data.response);break;default:clearTimeout(p),clearTimeout(s),u(new Error("invalid_response"));break}}},this.handlers.add(a),i.port1.addEventListener("message",a.onMessage),this.target.postMessage({eventType:e,eventId:f,data:n},[i.port2])}).finally(()=>{a&&this.removeMessageHandler(a)})}}function wi(){return window}function m$(t){wi().location.href=t}function yM(){return typeof wi().WorkerGlobalScope<"u"&&typeof wi().importScripts=="function"}async function g$(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function y$(){return navigator?.serviceWorker?.controller||null}function v$(){return yM()?self:null}const vM="firebaseLocalStorageDb",b$=1,up="firebaseLocalStorage",bM="fbase_key";class Rd{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 xm(t,e){return t.transaction([up],e?"readwrite":"readonly").objectStore(up)}function S$(){const t=indexedDB.deleteDatabase(vM);return new Rd(t).toPromise()}function SM(){const t=indexedDB.open(vM,b$);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const r=t.result;try{r.createObjectStore(up,{keyPath:bM})}catch(i){n(i)}}),t.addEventListener("success",async()=>{const r=t.result;r.objectStoreNames.contains(up)?e(r):(r.close(),await S$(),e(await SM()))})})}async function KE(t,e,n){const r=xm(t,!0).put({[bM]:e,value:n});return new Rd(r).toPromise()}async function w$(t,e){const n=xm(t,!1).get(e),r=await new Rd(n).toPromise();return r===void 0?null:r.value}function ZE(t,e){const n=xm(t,!0).delete(e);return new Rd(n).toPromise()}const x$=800,k$=3;class wM{registerLifecycleListeners(){typeof window<"u"&&typeof window.addEventListener=="function"&&(window.addEventListener("pagehide",this.onPageHide),window.addEventListener("pageshow",this.onPageShow)),typeof document<"u"&&typeof document.addEventListener=="function"&&document.addEventListener("visibilitychange",this.onVisibilityChange)}unregisterLifecycleListeners(){typeof window<"u"&&typeof window.removeEventListener=="function"&&(window.removeEventListener("pagehide",this.onPageHide),window.removeEventListener("pageshow",this.onPageShow)),typeof document<"u"&&typeof document.removeEventListener=="function"&&document.removeEventListener("visibilitychange",this.onVisibilityChange)}constructor(){this.type="LOCAL",this.dbPromise=null,this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.isHiding=!1,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this.onPageHide=()=>{this.isHiding=!0,this.stopPolling(),this.dbPromise&&(this.dbPromise.then(e=>e.close()).catch(()=>{}),this.dbPromise=null)},this.onPageShow=()=>{this.isHiding&&(this.isHiding=!1,Object.keys(this.listeners).length>0&&this.startPolling())},this.onVisibilityChange=()=>{typeof document<"u"&&(document.visibilityState==="hidden"?this.onPageHide():document.visibilityState==="visible"&&this.onPageShow())},this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){if(this.isHiding)throw new Error("Database is closing/hidden");return this.dbPromise?this.dbPromise:(this.dbPromise=SM(),this.dbPromise.catch(()=>{this.dbPromise=null}),this.dbPromise)}async _withRetries(e){let n=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(this.isHiding||n++>k$)throw r;this.dbPromise&&((await this.dbPromise).close(),this.dbPromise=null)}}async initializeServiceWorkerMessaging(){return yM()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=wm._getInstance(v$()),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 g$(),!this.activeServiceWorker)return;this.sender=new p$(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||y$()!==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 KE(e,cp,"1"),await ZE(e,cp)}),!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=>KE(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){const n=await this._withRetries(r=>w$(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>ZE(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){if(this.isHiding)return[];try{const e=await this._withRetries(i=>{const s=xm(i,!1).getAll();return new Rd(s).toPromise()});if(this.isHiding)return[];if(!e)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(e.length!==0)for(const{fbase_key:i,value:s}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(const i of Object.keys(this.localCache))this.localCache[i]&&!r.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}catch(e){return this.isHiding||WR(`Firebase Auth cross-tab polling failed with error: ${e}`),[]}}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),x$)}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())}}wM.type="LOCAL";const C$=wM;new _d(3e4,6e4);function xM(t,e){return e?is(e):(Be(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}class AS extends CS{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Ul(e,this._buildIdpRequest())}_linkToIdToken(e,n){return Ul(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return Ul(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 E$(t){return fM(t.auth,new AS(t),t.bypassAuthState)}function T$(t){const{auth:e,user:n}=t;return Be(n,e,"internal-error"),r$(n,new AS(t),t.bypassAuthState)}async function _$(t){const{auth:e,user:n}=t;return Be(n,e,"internal-error"),n$(n,new AS(t),t.bypassAuthState)}class kM{constructor(e,n,r,i,s=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:n,sessionId:r,postBody:i,tenantId:s,error:a,type:c}=e;if(a){this.reject(a);return}const u={auth:this.auth,requestUri:n,sessionId:r,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(c)(u))}catch(f){this.reject(f)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return E$;case"linkViaPopup":case"linkViaRedirect":return _$;case"reauthViaPopup":case"reauthViaRedirect":return T$;default:$r(this.auth,"internal-error")}}resolve(e){gs(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){gs(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 A$=new _d(2e3,1e4);async function R$(t,e,n){if(Qr(t.app))return Promise.reject(ii(t,"operation-not-supported-in-this-environment"));const r=za(t);dB(t,e,TS);const i=xM(r,n);return new ca(r,"signInViaPopup",e,i).executeNotNull()}class ca extends kM{constructor(e,n,r,i,s){super(e,n,i,s),this.provider=r,this.authWindow=null,this.pollId=null,ca.currentPopupAction&&ca.currentPopupAction.cancel(),ca.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return Be(e,this.auth,"internal-error"),e}async onExecution(){gs(this.filter.length===1,"Popup operations only handle one event");const e=_S();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(ii(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(ii(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,ca.currentPopupAction=null}pollUserCancellation(){const e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(ii(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,A$.get())};e()}}ca.currentPopupAction=null;const M$="pendingRedirect",Fh=new Map;class O$ extends kM{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=Fh.get(this.auth._key());if(!e){try{const r=await N$(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}Fh.set(this.auth._key(),e)}return this.bypassAuthState||Fh.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 N$(t,e){const n=L$(e),r=I$(t);if(!await r._isAvailable())return!1;const i=await r._get(n)==="true";return await r._remove(n),i}function D$(t,e){Fh.set(t._key(),e)}function I$(t){return is(t._redirectPersistence)}function L$(t){return Uh(M$,t.config.apiKey,t.name)}async function z$(t,e,n=!1){if(Qr(t.app))return Promise.reject(mo(t));const r=za(t),i=xM(r,e),a=await new O$(r,i,n).execute();return a&&!n&&(delete a.user._redirectEventId,await r._persistUserIfCurrent(a.user),await r._setRedirectUser(null,e)),a}const P$=600*1e3;class j${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||!B$(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){if(e.error&&!CM(e)){const r=e.error.code?.split("auth/")[1]||"internal-error";n.onError(ii(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>=P$&&this.cachedEventUids.clear(),this.cachedEventUids.has(YE(e))}saveEventToCache(e){this.cachedEventUids.add(YE(e)),this.lastProcessedEventTime=Date.now()}}function YE(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function CM({type:t,error:e}){return t==="unknown"&&e?.code==="auth/no-auth-event"}function B$(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return CM(t);default:return!1}}async function $$(t,e={}){return Do(t,"GET","/v1/projects",e)}const V$=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,H$=/^https?/;async function U$(t){if(t.config.emulator)return;const{authorizedDomains:e}=await $$(t);for(const n of e)try{if(F$(n))return}catch{}$r(t,"unauthorized-domain")}function F$(t){const e=jb(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const a=new URL(t);return a.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&a.hostname===r}if(!H$.test(n))return!1;if(V$.test(t))return r===t;const i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}const q$=new _d(3e4,6e4);function XE(){const t=wi().___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 G$(t){return new Promise((e,n)=>{function r(){XE(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{XE(),n(ii(t,"network-request-failed"))},timeout:q$.get()})}if(wi().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(wi().gapi?.load)r();else{const i=$B("iframefcb");return wi()[i]=()=>{gapi.load?r():n(ii(t,"network-request-failed"))},lM(`${BB()}?onload=${i}`).catch(s=>n(s))}}).catch(e=>{throw qh=null,e})}let qh=null;function W$(t){return qh=qh||G$(t),qh}const K$=new _d(5e3,15e3),Z$="__/auth/iframe",Y$="emulator/auth/iframe",X$={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},J$=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Q$(t){const e=t.config;Be(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?wS(e,Y$):`https://${t.config.authDomain}/${Z$}`,r={apiKey:e.apiKey,appName:t.name,v:Td},i=J$.get(t.config.apiHost);i&&(r.eid=i);const s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${Ed(r).slice(1)}`}async function e3(t){const e=await W$(t),n=wi().gapi;return Be(n,t,"internal-error"),e.open({where:document.body,url:Q$(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:X$,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});const a=ii(t,"network-request-failed"),c=wi().setTimeout(()=>{s(a)},K$.get());function u(){wi().clearTimeout(c),i(r)}r.ping(u).then(u,()=>{s(a)})}))}const t3={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},n3=500,r3=600,i3="_blank",s3="http://localhost";class JE{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function o3(t,e,n,r=n3,i=r3){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString();let c="";const u={...t3,width:r.toString(),height:i.toString(),top:s,left:a},f=Wn().toLowerCase();n&&(c=tM(f)?i3:n),QR(f)&&(e=e||s3,u.scrollbars="yes");const p=Object.entries(u).reduce((g,[y,b])=>`${g}${y}=${b},`,"");if(MB(f)&&c!=="_self")return a3(e||"",c),new JE(null);const m=window.open(e||"",c,p);Be(m,t,"popup-blocked");try{m.focus()}catch{}return new JE(m)}function a3(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 l3="__/auth/handler",c3="emulator/auth/handler",u3=encodeURIComponent("fac");async function QE(t,e,n,r,i,s){Be(t.config.authDomain,t,"auth-domain-config-required"),Be(t.config.apiKey,t,"invalid-api-key");const a={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Td,eventId:i};if(e instanceof TS){e.setDefaultLanguage(t.languageCode),a.providerId=e.providerId||"",KP(e.getCustomParameters())||(a.customParameters=JSON.stringify(e.getCustomParameters()));for(const[p,m]of Object.entries({}))a[p]=m}if(e instanceof Ad){const p=e.getScopes().filter(m=>m!=="");p.length>0&&(a.scopes=p.join(","))}t.tenantId&&(a.tid=t.tenantId);const c=a;for(const p of Object.keys(c))c[p]===void 0&&delete c[p];const u=await t._getAppCheckToken(),f=u?`#${u3}=${encodeURIComponent(u)}`:"";return`${d3(t)}?${Ed(c).slice(1)}${f}`}function d3({config:t}){return t.emulator?wS(t,c3):`https://${t.authDomain}/${l3}`}const _v="webStorageSupport";class f3{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=gM,this._completeRedirectFn=z$,this._overrideRedirectResult=D$}async _openPopup(e,n,r,i){gs(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");const s=await QE(e,n,r,jb(),i);return o3(e,s,_S())}async _openRedirect(e,n,r,i){await this._originValidation(e);const s=await QE(e,n,r,jb(),i);return m$(s),new Promise(()=>{})}_initialize(e){const n=e._key();if(this.eventManagers[n]){const{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(gs(s,"If manager is not set, promise should be"),s)}const r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){const n=await e3(e),r=new j$(e);return n.register("authEvent",i=>(Be(i?.authEvent,e,"invalid-auth-event"),{status:r.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=n,r}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(_v,{type:_v},i=>{const s=i?.[0]?.[_v];s!==void 0&&n(!!s),$r(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=U$(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return oM()||eM()||kS()}}const h3=f3;var eT="@firebase/auth",tT="1.13.4";class p3{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(){Be(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}function m3(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 g3(t){td(new Zl("auth",(e,{options:n})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:a,authDomain:c}=r.options;Be(a&&!a.includes(":"),"invalid-api-key",{appName:r.name});const u={apiKey:a,authDomain:c,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:aM(t)},f=new zB(r,i,s,u);return qB(f,n),f},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),td(new Zl("auth-internal",e=>{const n=za(e.getProvider("auth").getImmediate());return(r=>new p3(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),$l(eT,tT,m3(t)),$l(eT,tT,"esm2020")}const y3=300,v3=LR("authIdTokenMaxAge")||y3;let nT=null;const b3=t=>async e=>{const n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>v3)return;const i=n?.token;nT!==i&&(nT=i,await fetch(t,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function S3(t=HR()){const e=$R(t,"auth");if(e.isInitialized())return e.getImmediate();const n=FB(t,{popupRedirectResolver:h3,persistence:[C$,f$,gM]}),r=LR("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const s=new URL(r,location.origin);if(location.origin===s.origin){const a=b3(s.toString());l$(n,a,()=>a(n.currentUser)),a$(n,c=>a(c))}}const i=jP("auth");return i&&GB(n,`http://${i}`),n}function w3(){return document.getElementsByTagName("head")?.[0]??document}PB({loadJS(t){return new Promise((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=i=>{const s=ii("internal-error");s.customData=i,n(s)},r.type="text/javascript",r.charset="UTF-8",w3().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="});g3("Browser");function x3(t=6e4){const e=new Map,n=new Map;function r(a,c,u){if(!u?.fresh){const p=e.get(a);if(p&&Date.now()-p.at<t)return Promise.resolve(p.value);const m=n.get(a);if(m)return m}const f=c().then(p=>(e.set(a,{value:p,at:Date.now()}),n.delete(a),p)).catch(p=>{throw n.delete(a),p});return n.set(a,f),f}function i(a,c){e.set(a,{value:c,at:Date.now()})}function s(a){if(!a){e.clear(),n.clear();return}for(const c of[...e.keys()])(c===a||c.startsWith(`${a}:`))&&e.delete(c);for(const c of[...n.keys()])(c===a||c.startsWith(`${a}:`))&&n.delete(c)}return{get:r,set:i,invalidate:s}}const k3="x-vertebr-env";async function lh(t,e){const n=await t.arrayBuffer(),r=new Uint8Array(n);let i="";const s=32768;for(let c=0;c<r.length;c+=s)i+=String.fromCharCode(...r.subarray(c,c+s));return{name:e||typeof File<"u"&&t instanceof File&&t.name||"upload",type:t.type||"application/octet-stream",data:btoa(i)}}function $b(t,e){const n=typeof t=="string"?{apiBase:t,getEnvironment:(()=>"")}:t,r=n.apiBase.replace(/\/$/,""),i=x3(n.cacheTtlMs??6e4);async function s(a,c,u){const f=n.getEnvironment().trim(),m=(await n.getAccessToken?.())?.trim(),g=await fetch(`${r}${a}`,{...c,headers:{Accept:"application/json","Content-Type":"application/json",...f?{[k3]:f}:{},...u?.auth!==!1&&m?{Authorization:`Bearer ${m}`}:{},...c?.headers??{}}});if(!g.ok){const y=await g.text();throw new Error(y||`Request failed (${g.status})`)}return await g.json()}return{getBootstrap:a=>i.get("bootstrap",()=>s("/bootstrap",void 0,{auth:!1}),a),getCatalog:a=>i.get("catalog",()=>s(""),a),getMetrics:a=>i.get("metrics",()=>s("/metrics"),a),getPublicControls:a=>i.get("controls",async()=>(await s("/public/controls",void 0,{auth:!1})).configs??{},a),listResource:(a,c)=>i.get(`resource:${a}`,()=>s(`/resources/${encodeURIComponent(a)}`),c),createResource:async(a,c)=>{const u=await s(`/resources/${encodeURIComponent(a)}`,{method:"POST",body:JSON.stringify(c)});return i.invalidate(`resource:${a}`),u},updateResource:async(a,c,u)=>{const f=await s(`/resources/${encodeURIComponent(a)}/${encodeURIComponent(c)}`,{method:"PUT",body:JSON.stringify(u)});return i.invalidate(`resource:${a}`),f},deleteResource:async(a,c)=>{const u=await s(`/resources/${encodeURIComponent(a)}/${encodeURIComponent(c)}`,{method:"DELETE"});return i.invalidate(`resource:${a}`),u},runResourceAction:async(a,c,u,f)=>{const p=await s(`/resources/${encodeURIComponent(a)}/${encodeURIComponent(c)}/actions/${encodeURIComponent(u)}`,{method:"POST",body:JSON.stringify(f??{})});return i.invalidate(`resource:${a}`),p},uploadResourceFile:async(a,c,u,f)=>{const p=await lh(u,f);return s(`/resources/${encodeURIComponent(a)}/uploads/${encodeURIComponent(c)}`,{method:"POST",body:JSON.stringify(p)})},uploadResourceFiles:async(a,c,u)=>{const f={files:await Promise.all(u.map(p=>lh(p)))};return s(`/resources/${encodeURIComponent(a)}/uploads/${encodeURIComponent(c)}/bulk`,{method:"POST",body:JSON.stringify(f)})},getGallery:a=>i.get("gallery",()=>s("/gallery"),a),uploadGalleryFile:async(a,c)=>{const u=await lh(a,c),f=await s("/gallery/upload",{method:"POST",body:JSON.stringify(u)});return i.invalidate("gallery"),f},uploadGalleryFiles:async a=>{const c={files:await Promise.all(a.map(f=>lh(f)))},u=await s("/gallery/upload/bulk",{method:"POST",body:JSON.stringify(c)});return i.invalidate("gallery"),u},deleteGalleryItem:async a=>{const c=await s(`/gallery/${encodeURIComponent(a)}`,{method:"DELETE"});return i.invalidate("gallery"),c},getConfig:(a,c)=>i.get(`config:${a}`,()=>s(`/configs/${encodeURIComponent(a)}`),c),setConfig:async(a,c)=>{const u=await s(`/configs/${encodeURIComponent(a)}`,{method:"PUT",body:JSON.stringify(c)}),f={id:u.id,label:a,schema:{},environment:u.environment,value:u.value};return i.set(`config:${a}`,f),i.invalidate("controls"),f},invalidateCache:a=>i.invalidate(a)}}function RS(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Pa=RS();function EM(t){Pa=t}var Bu={exec:()=>null};function ht(t,e=""){let n=typeof t=="string"?t:t.source;const r={replace:(i,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(Un.caret,"$1"),n=n.replace(i,a),r},getRegex:()=>new RegExp(n,e)};return r}var Un={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")},C3=/^(?:[ \t]*(?:\n|$))+/,E3=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,T3=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Md=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,_3=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,MS=/(?:[*+-]|\d{1,9}[.)])/,TM=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_M=ht(TM).replace(/bull/g,MS).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(),A3=ht(TM).replace(/bull/g,MS).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(),OS=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,R3=/^[^\n]+/,NS=/(?!\s*\])(?:\\.|[^\[\]\\])+/,M3=ht(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",NS).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),O3=ht(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,MS).getRegex(),km="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",DS=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,N3=ht("^ {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",DS).replace("tag",km).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),AM=ht(OS).replace("hr",Md).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",km).getRegex(),D3=ht(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",AM).getRegex(),IS={blockquote:D3,code:E3,def:M3,fences:T3,heading:_3,hr:Md,html:N3,lheading:_M,list:O3,newline:C3,paragraph:AM,table:Bu,text:R3},rT=ht("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Md).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",km).getRegex(),I3={...IS,lheading:A3,table:rT,paragraph:ht(OS).replace("hr",Md).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",rT).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",km).getRegex()},L3={...IS,html:ht(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",DS).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:Bu,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ht(OS).replace("hr",Md).replace("heading",` *#{1,6} *[^
|
|
10
|
-
]`).replace("lheading",_M).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},z3=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,P3=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,RM=/^( {2,}|\\)\n(?!\s*$)/,j3=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Cm=/[\p{P}\p{S}]/u,LS=/[\s\p{P}\p{S}]/u,MM=/[^\s\p{P}\p{S}]/u,B3=ht(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,LS).getRegex(),OM=/(?!~)[\p{P}\p{S}]/u,$3=/(?!~)[\s\p{P}\p{S}]/u,V3=/(?:[^\s\p{P}\p{S}]|~)/u,H3=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,NM=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,U3=ht(NM,"u").replace(/punct/g,Cm).getRegex(),F3=ht(NM,"u").replace(/punct/g,OM).getRegex(),DM="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",q3=ht(DM,"gu").replace(/notPunctSpace/g,MM).replace(/punctSpace/g,LS).replace(/punct/g,Cm).getRegex(),G3=ht(DM,"gu").replace(/notPunctSpace/g,V3).replace(/punctSpace/g,$3).replace(/punct/g,OM).getRegex(),W3=ht("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,MM).replace(/punctSpace/g,LS).replace(/punct/g,Cm).getRegex(),K3=ht(/\\(punct)/,"gu").replace(/punct/g,Cm).getRegex(),Z3=ht(/^<(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(),Y3=ht(DS).replace("(?:-->|$)","-->").getRegex(),X3=ht("^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",Y3).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),dp=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,J3=ht(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",dp).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),IM=ht(/^!?\[(label)\]\[(ref)\]/).replace("label",dp).replace("ref",NS).getRegex(),LM=ht(/^!?\[(ref)\](?:\[\])?/).replace("ref",NS).getRegex(),Q3=ht("reflink|nolink(?!\\()","g").replace("reflink",IM).replace("nolink",LM).getRegex(),zS={_backpedal:Bu,anyPunctuation:K3,autolink:Z3,blockSkip:H3,br:RM,code:P3,del:Bu,emStrongLDelim:U3,emStrongRDelimAst:q3,emStrongRDelimUnd:W3,escape:z3,link:J3,nolink:LM,punctuation:B3,reflink:IM,reflinkSearch:Q3,tag:X3,text:j3,url:Bu},eV={...zS,link:ht(/^!?\[(label)\]\((.*?)\)/).replace("label",dp).getRegex(),reflink:ht(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",dp).getRegex()},Vb={...zS,emStrongRDelimAst:G3,emStrongLDelim:F3,url:ht(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},tV={...Vb,br:ht(RM).replace("{2,}","*").getRegex(),text:ht(Vb.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ch={normal:IS,gfm:I3,pedantic:L3},mu={normal:zS,gfm:Vb,breaks:tV,pedantic:eV},nV={"&":"&","<":"<",">":">",'"':""","'":"'"},iT=t=>nV[t];function pi(t,e){if(e){if(Un.escapeTest.test(t))return t.replace(Un.escapeReplace,iT)}else if(Un.escapeTestNoEncode.test(t))return t.replace(Un.escapeReplaceNoEncode,iT);return t}function sT(t){try{t=encodeURI(t).replace(Un.percentDecode,"%")}catch{return null}return t}function oT(t,e){const n=t.replace(Un.findPipe,(s,a,c)=>{let u=!1,f=a;for(;--f>=0&&c[f]==="\\";)u=!u;return u?"|":" |"}),r=n.split(Un.splitPipe);let i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Un.slashPipe,"|");return r}function gu(t,e,n){const r=t.length;if(r===0)return"";let i=0;for(;i<r&&t.charAt(r-i-1)===e;)i++;return t.slice(0,r-i)}function rV(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 aT(t,e,n,r,i){const s=e.href,a=e.title||null,c=t[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;const u={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:a,text:c,tokens:r.inlineTokens(c)};return r.state.inLink=!1,u}function iV(t,e,n){const r=t.match(n.other.indentCodeCompensation);if(r===null)return e;const i=r[1];return e.split(`
|
|
11
|
-
`).map(s=>{const a=s.match(n.other.beginningSpace);if(a===null)return s;const[c]=a;return c.length>=i.length?s.slice(i.length):s}).join(`
|
|
12
|
-
`)}var fp=class{options;rules;lexer;constructor(t){this.options=t||Pa}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:gu(n,`
|
|
13
|
-
`)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const n=e[0],r=iV(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=gu(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:gu(e[0],`
|
|
14
|
-
`)}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let n=gu(e[0],`
|
|
15
|
-
`).split(`
|
|
16
|
-
`),r="",i="";const s=[];for(;n.length>0;){let a=!1;const c=[];let u;for(u=0;u<n.length;u++)if(this.rules.other.blockquoteStart.test(n[u]))c.push(n[u]),a=!0;else if(!a)c.push(n[u]);else break;n=n.slice(u);const f=c.join(`
|
|
17
|
-
`),p=f.replace(this.rules.other.blockquoteSetextReplace,`
|
|
18
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
19
|
-
${f}`:f,i=i?`${i}
|
|
20
|
-
${p}`:p;const m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,s,!0),this.lexer.state.top=m,n.length===0)break;const g=s.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){const y=g,b=y.raw+`
|
|
21
|
-
`+n.join(`
|
|
22
|
-
`),w=this.blockquote(b);s[s.length-1]=w,r=r.substring(0,r.length-y.raw.length)+w.raw,i=i.substring(0,i.length-y.text.length)+w.text;break}else if(g?.type==="list"){const y=g,b=y.raw+`
|
|
23
|
-
`+n.join(`
|
|
24
|
-
`),w=this.list(b);s[s.length-1]=w,r=r.substring(0,r.length-g.raw.length)+w.raw,i=i.substring(0,i.length-y.raw.length)+w.raw,n=b.substring(s.at(-1).raw.length).split(`
|
|
25
|
-
`);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim();const r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");const s=this.rules.other.listItemRegex(n);let a=!1;for(;t;){let u=!1,f="",p="";if(!(e=s.exec(t))||this.rules.block.hr.test(t))break;f=e[0],t=t.substring(f.length);let m=e[2].split(`
|
|
26
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,k=>" ".repeat(3*k.length)),g=t.split(`
|
|
27
|
-
`,1)[0],y=!m.trim(),b=0;if(this.options.pedantic?(b=2,p=m.trimStart()):y?b=e[1].length+1:(b=e[2].search(this.rules.other.nonSpaceChar),b=b>4?1:b,p=m.slice(b),b+=e[1].length),y&&this.rules.other.blankLine.test(g)&&(f+=g+`
|
|
28
|
-
`,t=t.substring(g.length+1),u=!0),!u){const k=this.rules.other.nextBulletRegex(b),T=this.rules.other.hrRegex(b),A=this.rules.other.fencesBeginRegex(b),_=this.rules.other.headingBeginRegex(b),O=this.rules.other.htmlBeginRegex(b);for(;t;){const N=t.split(`
|
|
29
|
-
`,1)[0];let I;if(g=N,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),I=g):I=g.replace(this.rules.other.tabCharGlobal," "),A.test(g)||_.test(g)||O.test(g)||k.test(g)||T.test(g))break;if(I.search(this.rules.other.nonSpaceChar)>=b||!g.trim())p+=`
|
|
30
|
-
`+I.slice(b);else{if(y||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||A.test(m)||_.test(m)||T.test(m))break;p+=`
|
|
31
|
-
`+g}!y&&!g.trim()&&(y=!0),f+=N+`
|
|
32
|
-
`,t=t.substring(N.length+1),m=I.slice(b)}}i.loose||(a?i.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(a=!0));let w=null,x;this.options.gfm&&(w=this.rules.other.listIsTask.exec(p),w&&(x=w[0]!=="[ ] ",p=p.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:f,task:!!w,checked:x,loose:!1,text:p,tokens:[]}),i.raw+=f}const c=i.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let u=0;u<i.items.length;u++)if(this.lexer.state.top=!1,i.items[u].tokens=this.lexer.blockTokens(i.items[u].text,[]),!i.loose){const f=i.items[u].tokens.filter(m=>m.type==="space"),p=f.length>0&&f.some(m=>this.rules.other.anyLine.test(m.raw));i.loose=p}if(i.loose)for(let u=0;u<i.items.length;u++)i.items[u].loose=!0;return i}}html(t){const e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){const e=this.rules.block.def.exec(t);if(e){const n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:r,title:i}}}table(t){const e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const n=oT(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
33
|
-
`):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(const a of r)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a<n.length;a++)s.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:s.align[a]});for(const a of i)s.rows.push(oT(a,s.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:s.align[u]})));return s}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const n=e[1].charAt(e[1].length-1)===`
|
|
34
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;const s=gu(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{const s=rV(e[2],"()");if(s===-2)return;if(s>-1){const c=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,c).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){const s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),aT(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){const r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[r.toLowerCase()];if(!i){const s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return aT(n,i,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const s=[...r[0]].length-1;let a,c,u=s,f=0;const p=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,e=e.slice(-1*t.length+s);(r=p.exec(e))!=null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(c=[...a].length,r[3]||r[4]){u+=c;continue}else if((r[5]||r[6])&&s%3&&!((s+c)%3)){f+=c;continue}if(u-=c,u>0)continue;c=Math.min(c,c+u+f);const m=[...r[0]][0].length,g=t.slice(0,s+r.index+m+c);if(Math.min(s,c)%2){const b=g.slice(1,-1);return{type:"em",raw:g,text:b,tokens:this.lexer.inlineTokens(b)}}const y=g.slice(2,-2);return{type:"strong",raw:g,text:y,tokens:this.lexer.inlineTokens(y)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," ");const r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){const e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let n,r;if(e[2]==="@")n=e[0],r="mailto:"+n;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);n=e[0],e[1]==="www."?r="http://"+e[0]:r=e[0]}return{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){const e=this.rules.inline.text.exec(t);if(e){const n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},ss=class Hb{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Pa,this.options.tokenizer=this.options.tokenizer||new fp,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:Un,block:ch.normal,inline:mu.normal};this.options.pedantic?(n.block=ch.pedantic,n.inline=mu.pedantic):this.options.gfm&&(n.block=ch.gfm,this.options.breaks?n.inline=mu.breaks:n.inline=mu.gfm),this.tokenizer.rules=n}static get rules(){return{block:ch,inline:mu}}static lex(e,n){return new Hb(n).lex(e)}static lexInline(e,n){return new Hb(n).inlineTokens(e)}lex(e){e=e.replace(Un.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(Un.tabCharGlobal," ").replace(Un.spaceLine,""));e;){let i;if(this.options.extensions?.block?.some(a=>(i=a.call({lexer:this},e,n))?(e=e.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);const a=n.at(-1);i.raw.length===1&&a!==void 0?a.raw+=`
|
|
36
|
-
`:n.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);const a=n.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=`
|
|
37
|
-
`+i.raw,a.text+=`
|
|
38
|
-
`+i.text,this.inlineQueue.at(-1).src=a.text):n.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);const a=n.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=`
|
|
39
|
-
`+i.raw,a.text+=`
|
|
40
|
-
`+i.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title});continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),n.push(i);continue}let s=e;if(this.options.extensions?.startBlock){let a=1/0;const c=e.slice(1);let u;this.options.extensions.startBlock.forEach(f=>{u=f.call({lexer:this},c),typeof u=="number"&&u>=0&&(a=Math.min(a,u))}),a<1/0&&a>=0&&(s=e.substring(0,a+1))}if(this.state.top&&(i=this.tokenizer.paragraph(s))){const a=n.at(-1);r&&a?.type==="paragraph"?(a.raw+=`
|
|
41
|
-
`+i.raw,a.text+=`
|
|
42
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):n.push(i),r=s.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);const a=n.at(-1);a?.type==="text"?(a.raw+=`
|
|
43
|
-
`+i.raw,a.text+=`
|
|
44
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):n.push(i);continue}if(e){const a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){let r=e,i=null;if(this.tokens.links){const c=Object.keys(this.tokens.links);if(c.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)c.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let s=!1,a="";for(;e;){s||(a=""),s=!1;let c;if(this.options.extensions?.inline?.some(f=>(c=f.call({lexer:this},e,n))?(e=e.substring(c.raw.length),n.push(c),!0):!1))continue;if(c=this.tokenizer.escape(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.tag(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.link(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(c.raw.length);const f=n.at(-1);c.type==="text"&&f?.type==="text"?(f.raw+=c.raw,f.text+=c.text):n.push(c);continue}if(c=this.tokenizer.emStrong(e,r,a)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.codespan(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.br(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.del(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.autolink(e)){e=e.substring(c.raw.length),n.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(e))){e=e.substring(c.raw.length),n.push(c);continue}let u=e;if(this.options.extensions?.startInline){let f=1/0;const p=e.slice(1);let m;this.options.extensions.startInline.forEach(g=>{m=g.call({lexer:this},p),typeof m=="number"&&m>=0&&(f=Math.min(f,m))}),f<1/0&&f>=0&&(u=e.substring(0,f+1))}if(c=this.tokenizer.inlineText(u)){e=e.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(a=c.raw.slice(-1)),s=!0;const f=n.at(-1);f?.type==="text"?(f.raw+=c.raw,f.text+=c.text):n.push(c);continue}if(e){const f="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(f);break}else throw new Error(f)}}return n}},sd=class{options;parser;constructor(t){this.options=t||Pa}space(t){return""}code({text:t,lang:e,escaped:n}){const r=(e||"").match(Un.notSpaceStart)?.[0],i=t.replace(Un.endingNewline,"")+`
|
|
45
|
-
`;return r?'<pre><code class="language-'+pi(r)+'">'+(n?i:pi(i,!0))+`</code></pre>
|
|
46
|
-
`:"<pre><code>"+(n?i:pi(i,!0))+`</code></pre>
|
|
47
|
-
`}blockquote({tokens:t}){return`<blockquote>
|
|
48
|
-
${this.parser.parse(t)}</blockquote>
|
|
49
|
-
`}html({text:t}){return t}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
50
|
-
`}hr(t){return`<hr>
|
|
51
|
-
`}list(t){const e=t.ordered,n=t.start;let r="";for(let a=0;a<t.items.length;a++){const c=t.items[a];r+=this.listitem(c)}const i=e?"ol":"ul",s=e&&n!==1?' start="'+n+'"':"";return"<"+i+s+`>
|
|
52
|
-
`+r+"</"+i+`>
|
|
53
|
-
`}listitem(t){let e="";if(t.task){const n=this.checkbox({checked:!!t.checked});t.loose?t.tokens[0]?.type==="paragraph"?(t.tokens[0].text=n+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=n+" "+pi(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):e+=n+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`<li>${e}</li>
|
|
54
|
-
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
55
|
-
`}table(t){let e="",n="";for(let i=0;i<t.header.length;i++)n+=this.tablecell(t.header[i]);e+=this.tablerow({text:n});let r="";for(let i=0;i<t.rows.length;i++){const s=t.rows[i];n="";for(let a=0;a<s.length;a++)n+=this.tablecell(s[a]);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>${pi(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){const r=this.parser.parseInline(n),i=sT(t);if(i===null)return r;t=i;let s='<a href="'+t+'"';return e&&(s+=' title="'+pi(e)+'"'),s+=">"+r+"</a>",s}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));const i=sT(t);if(i===null)return pi(n);t=i;let s=`<img src="${t}" alt="${n}"`;return e&&(s+=` title="${pi(e)}"`),s+=">",s}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:pi(t.text)}},PS=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""}},as=class Ub{options;renderer;textRenderer;constructor(e){this.options=e||Pa,this.options.renderer=this.options.renderer||new sd,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new PS}static parse(e,n){return new Ub(n).parse(e)}static parseInline(e,n){return new Ub(n).parseInline(e)}parse(e,n=!0){let r="";for(let i=0;i<e.length;i++){const s=e[i];if(this.options.extensions?.renderers?.[s.type]){const c=s,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(c.type)){r+=u||"";continue}}const a=s;switch(a.type){case"space":{r+=this.renderer.space(a);continue}case"hr":{r+=this.renderer.hr(a);continue}case"heading":{r+=this.renderer.heading(a);continue}case"code":{r+=this.renderer.code(a);continue}case"table":{r+=this.renderer.table(a);continue}case"blockquote":{r+=this.renderer.blockquote(a);continue}case"list":{r+=this.renderer.list(a);continue}case"html":{r+=this.renderer.html(a);continue}case"paragraph":{r+=this.renderer.paragraph(a);continue}case"text":{let c=a,u=this.renderer.text(c);for(;i+1<e.length&&e[i+1].type==="text";)c=e[++i],u+=`
|
|
63
|
-
`+this.renderer.text(c);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 c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}parseInline(e,n=this.renderer){let r="";for(let i=0;i<e.length;i++){const s=e[i];if(this.options.extensions?.renderers?.[s.type]){const c=this.options.extensions.renderers[s.type].call({parser:this},s);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){r+=c||"";continue}}const a=s;switch(a.type){case"escape":{r+=n.text(a);break}case"html":{r+=n.html(a);break}case"link":{r+=n.link(a);break}case"image":{r+=n.image(a);break}case"strong":{r+=n.strong(a);break}case"em":{r+=n.em(a);break}case"codespan":{r+=n.codespan(a);break}case"br":{r+=n.br(a);break}case"del":{r+=n.del(a);break}case"text":{r+=n.text(a);break}default:{const c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}},Gh=class{options;block;constructor(t){this.options=t||Pa}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?ss.lex:ss.lexInline}provideParser(){return this.block?as.parse:as.parseInline}},zM=class{defaults=RS();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=as;Renderer=sd;TextRenderer=PS;Lexer=ss;Tokenizer=fp;Hooks=Gh;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(const r of t)switch(n=n.concat(e.call(this,r)),r.type){case"table":{const i=r;for(const s of i.header)n=n.concat(this.walkTokens(s.tokens,e));for(const s of i.rows)for(const a of s)n=n.concat(this.walkTokens(a.tokens,e));break}case"list":{const i=r;n=n.concat(this.walkTokens(i.items,e));break}default:{const i=r;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(s=>{const a=i[s].flat(1/0);n=n.concat(this.walkTokens(a,e))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,e)))}}return n}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{const r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const s=e.renderers[i.name];s?e.renderers[i.name]=function(...a){let c=i.renderer.apply(this,a);return c===!1&&(c=s.apply(this,a)),c}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),n.renderer){const i=this.defaults.renderer||new sd(this.defaults);for(const s in n.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;const a=s,c=n.renderer[a],u=i[a];i[a]=(...f)=>{let p=c.apply(i,f);return p===!1&&(p=u.apply(i,f)),p||""}}r.renderer=i}if(n.tokenizer){const i=this.defaults.tokenizer||new fp(this.defaults);for(const s in n.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;const a=s,c=n.tokenizer[a],u=i[a];i[a]=(...f)=>{let p=c.apply(i,f);return p===!1&&(p=u.apply(i,f)),p}}r.tokenizer=i}if(n.hooks){const i=this.defaults.hooks||new Gh;for(const s in n.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;const a=s,c=n.hooks[a],u=i[a];Gh.passThroughHooks.has(s)?i[a]=f=>{if(this.defaults.async)return Promise.resolve(c.call(i,f)).then(m=>u.call(i,m));const p=c.call(i,f);return u.call(i,p)}:i[a]=(...f)=>{let p=c.apply(i,f);return p===!1&&(p=u.apply(i,f)),p}}r.hooks=i}if(n.walkTokens){const i=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(a){let c=[];return c.push(s.call(this,a)),i&&(c=c.concat(i.call(this,a))),c}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return ss.lex(t,e??this.defaults)}parser(t,e){return as.parse(t,e??this.defaults)}parseMarkdown(t){return(n,r)=>{const i={...r},s={...this.defaults,...i},a=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&i.async===!1)return a(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 a(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));s.hooks&&(s.hooks.options=s,s.hooks.block=t);const c=s.hooks?s.hooks.provideLexer():t?ss.lex:ss.lexInline,u=s.hooks?s.hooks.provideParser():t?as.parse:as.parseInline;if(s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(n):n).then(f=>c(f,s)).then(f=>s.hooks?s.hooks.processAllTokens(f):f).then(f=>s.walkTokens?Promise.all(this.walkTokens(f,s.walkTokens)).then(()=>f):f).then(f=>u(f,s)).then(f=>s.hooks?s.hooks.postprocess(f):f).catch(a);try{s.hooks&&(n=s.hooks.preprocess(n));let f=c(n,s);s.hooks&&(f=s.hooks.processAllTokens(f)),s.walkTokens&&this.walkTokens(f,s.walkTokens);let p=u(f,s);return s.hooks&&(p=s.hooks.postprocess(p)),p}catch(f){return a(f)}}}onError(t,e){return n=>{if(n.message+=`
|
|
64
|
-
Please report this to https://github.com/markedjs/marked.`,t){const r="<p>An error occurred:</p><pre>"+pi(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},xa=new zM;function xt(t,e){return xa.parse(t,e)}xt.options=xt.setOptions=function(t){return xa.setOptions(t),xt.defaults=xa.defaults,EM(xt.defaults),xt};xt.getDefaults=RS;xt.defaults=Pa;xt.use=function(...t){return xa.use(...t),xt.defaults=xa.defaults,EM(xt.defaults),xt};xt.walkTokens=function(t,e){return xa.walkTokens(t,e)};xt.parseInline=xa.parseInline;xt.Parser=as;xt.parser=as.parse;xt.Renderer=sd;xt.TextRenderer=PS;xt.Lexer=ss;xt.lexer=ss.lex;xt.Tokenizer=fp;xt.Hooks=Gh;xt.parse=xt;xt.options;xt.setOptions;xt.use;xt.walkTokens;xt.parseInline;as.parse;ss.lex;function yu(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function lT(t){const e=t.trim();return e?e.startsWith("//")?`https:${e}`:/^(https?:|mailto:|\/|#)/i.test(e)?e:null:null}class sV extends sd{html(){return""}link({href:e,title:n,tokens:r}){const i=this.parser.parseInline(r),s=lT(e);if(!s)return i;const a=n?` title="${yu(n)}"`:"";return`<a href="${yu(s)}"${a} rel="noopener noreferrer">${i}</a>`}image({href:e,title:n,text:r}){const i=lT(e);if(!i)return"";const s=n?` title="${yu(n)}"`:"";return`<img src="${yu(i)}" alt="${yu(r)}"${s} loading="lazy" />`}}new zM({gfm:!0,breaks:!1,renderer:new sV});var Od=t=>t.type==="checkbox",Em=t=>t.type==="file",lo=t=>t instanceof Date,An=t=>t==null;const jS=t=>typeof t=="object";var Bt=t=>!An(t)&&!Array.isArray(t)&&jS(t)&&!lo(t),Fb=t=>Bt(t)&&t.target?Od(t.target)?t.target.checked:Em(t.target)?t.target.files:t.target.value:t,PM=(t,e)=>e.split(".").some((n,r,i)=>!isNaN(Number(n))&&t.has(i.slice(0,r).join("."))),jM=t=>{const e=t.constructor&&t.constructor.prototype;return Bt(e)&&e.hasOwnProperty("isPrototypeOf")},Tm=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function jt(t){if(t instanceof Date)return new Date(t);const e=typeof FileList<"u"&&t instanceof FileList;if(Tm&&(t instanceof Blob||e))return t;const n=Array.isArray(t);if(!n&&!(Bt(t)&&jM(t)))return t;const r=n?[]:Object.create(Object.getPrototypeOf(t));for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=jt(t[i]));return r}const Xs={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},ei={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Kr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},BM="root",BS=["__proto__","constructor","prototype"],oV=/^\w*$/;var Nd=t=>oV.test(t),Dt=t=>t===void 0;const aV=/[.[\]'"]/;var _m=t=>t.split(aV).filter(Boolean),ye=(t,e,n)=>{if(!e||!Bt(t))return n;const r=Nd(e)?[e]:_m(e);if(r.some(s=>BS.includes(s)))return n;const i=r.reduce((s,a)=>An(s)?void 0:s[a],t);return Dt(i)||i===t?Dt(t[e])?n:t[e]:i},gr=t=>typeof t=="boolean",Pn=t=>typeof t=="function",ft=(t,e,n)=>{let r=-1;const i=Nd(e)?[e]:_m(e),s=i.length,a=s-1;for(;++r<s;){const c=i[r];let u=n;if(r!==a){const f=t[c];u=Bt(f)||Array.isArray(f)?f:isNaN(+i[r+1])?{}:[]}if(BS.includes(c))return;t[c]=u,t=t[c]}};const $M=je.createContext(null);$M.displayName="HookFormControlContext";const $S=()=>je.useContext($M);var VM=(t,e,n,r=!0)=>{const i={};for(const s in t)Object.defineProperty(i,s,{get:()=>{const a=s;return e._proxyFormState[a]!==ei.all&&(e._proxyFormState[a]=!r||ei.all),n&&(n[a]=!0),t[a]}});return i};const VS=Tm?je.useLayoutEffect:je.useEffect;function lV(t){const e=$S(),{control:n=e,disabled:r,name:i,exact:s}=t||{},[a,c]=je.useState(()=>({...n._formState,defaultValues:n._defaultValues})),u=je.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return VS(()=>n._subscribe({name:i,formState:u.current,exact:s,callback:f=>{!r&&c({...n._formState,...f,defaultValues:n._defaultValues})}}),[i,r,s]),je.useEffect(()=>{u.current.isValid&&n._setValid(!0)},[n]),je.useMemo(()=>VM(a,n,u.current,!1),[a,n])}var Rn=t=>typeof t=="string",qb=(t,e,n,r,i)=>Rn(t)?(r&&e.watch.add(t),ye(n,t,i)):Array.isArray(t)?t.map(s=>(r&&e.watch.add(s),ye(n,s))):(r&&(e.watchAll=!0),n),Gb=t=>An(t)||!jS(t);const cT=(t,e)=>e.length===0&&!Array.isArray(t)&&!jM(t);function yr(t,e,n=new WeakMap){if(t===e)return!0;if(Gb(t)||Gb(e))return Object.is(t,e);if(lo(t)&&lo(e))return Object.is(t.getTime(),e.getTime());const r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;if(cT(t,r)||cT(e,i))return Object.is(t,e);if(!r.length&&Array.isArray(t)!==Array.isArray(e))return!1;const s=n.get(t);if(s&&s.has(e))return!0;if(s)s.add(e);else{const a=new WeakSet;a.add(e),n.set(t,a)}for(const a of r){const c=t[a];if(!(a in e))return!1;if(a!=="ref"){const u=e[a];if(lo(c)&&lo(u)||(Bt(c)||Array.isArray(c))&&(Bt(u)||Array.isArray(u))?!yr(c,u,n):!Object.is(c,u))return!1}}return!0}function HM(t){const e=$S(),{control:n=e,name:r,defaultValue:i,disabled:s,exact:a,compute:c}=t||{},u=je.useRef(i),f=je.useRef(c),p=je.useRef(void 0),m=je.useRef(n),g=je.useRef(r);f.current=c;const[y,b]=je.useState(()=>{const _=n._getWatch(r,u.current);return f.current?f.current(_):_}),w=je.useCallback(_=>{const O=qb(r,n._names,_||n._formValues,!1,u.current);return f.current?f.current(O):O},[n._formValues,n._names,r]),x=je.useCallback(_=>{if(!s){const O=qb(r,n._names,_||n._formValues,!1,u.current);if(f.current){const N=f.current(O);yr(N,p.current)||(b(N),p.current=N)}else b(O)}},[n._formValues,n._names,s,r]);VS(()=>((m.current!==n||!yr(g.current,r))&&(m.current=n,g.current=r,x()),n._subscribe({name:r,formState:{values:!0},exact:a,callback:_=>{x(_.values)}})),[n,a,r,x]),je.useEffect(()=>n._removeUnmounted());const k=m.current!==n,T=g.current,A=je.useMemo(()=>{if(s)return null;const _=!k&&!yr(T,r);return k||_?w():null},[s,k,r,T,w]);return A!==null?A:y}function cV(t){const e=$S(),{name:n,disabled:r,control:i=e,shouldUnregister:s,defaultValue:a,exact:c=!0}=t,u=PM(i._names.array,n),f=je.useMemo(()=>ye(i._formValues,n,ye(i._defaultValues,n,a)),[i,n,a]),p=HM({control:i,name:n,defaultValue:f,exact:c}),m=lV({control:i,name:n,exact:c}),g=je.useRef(t),y=je.useRef(null),b=je.useRef(i.register(n,{...t.rules,value:p,...gr(t.disabled)?{disabled:t.disabled}:{}}));g.current=t;const w=je.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ye(m.errors,n)},isDirty:{enumerable:!0,get:()=>!!ye(m.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!ye(m.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!ye(m.validatingFields,n)},error:{enumerable:!0,get:()=>ye(m.errors,n)}}),[m,n]),x=je.useCallback(_=>{const O=Fb(_);return ye(i._fields,n)||(b.current=i.register(n,{...g.current.rules,value:O})),b.current.onChange({target:{value:Fb(_),name:n},type:Xs.CHANGE})},[n,i]),k=je.useCallback(()=>b.current.onBlur({target:{value:ye(i._formValues,n),name:n},type:Xs.BLUR}),[n,i._formValues]),T=je.useCallback(_=>{_&&(y.current={focus:()=>Pn(_.focus)&&_.focus(),select:()=>Pn(_.select)&&_.select(),setCustomValidity:N=>Pn(_.setCustomValidity)&&_.setCustomValidity(N),reportValidity:()=>Pn(_.reportValidity)&&_.reportValidity()});const O=ye(i._fields,n);O&&O._f&&_&&(O._f.ref=y.current)},[i._fields,n]),A=je.useMemo(()=>({name:n,value:p,...gr(r)||m.disabled?{disabled:m.disabled||r}:{},onChange:x,onBlur:k,ref:T}),[n,r,m.disabled,x,k,T,p]);return je.useEffect(()=>{const _=i._options.shouldUnregister||s;b.current=i.register(n,{...g.current.rules,...gr(g.current.disabled)?{disabled:g.current.disabled}:{}});const O=(N,I)=>{const j=ye(i._fields,N);j&&j._f&&(j._f.mount=I)};if(O(n,!0),_){const N=jt(ye(s?i._defaultValues:i._options.values||i._defaultValues,n,ye(i._options.defaultValues,n,g.current.defaultValue)));ft(i._defaultValues,n,N),Dt(ye(i._formValues,n))&&ft(i._formValues,n,N)}if(!u&&i.register(n),y.current){const N=ye(i._fields,n);N&&N._f&&(N._f.ref=y.current)}return()=>{(u?_&&!i._state.action:_)?i.unregister(n):O(n,!1)}},[n,i,u,s]),je.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),je.useMemo(()=>({field:A,formState:m,fieldState:w}),[A,m,w])}const vu=t=>t.render(cV(t));var uh=t=>({isOnSubmit:!t||t===ei.onSubmit,isOnBlur:t===ei.onBlur,isOnChange:t===ei.onChange,isOnAll:t===ei.all,isOnTouch:t===ei.onTouched}),Av=(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 $u=(t,e,n,r)=>{for(const i of n||Object.keys(t)){if(i==="_f")continue;const s=n?ye(t,i):t[i];if(s){const{_f:a}=s;if(a){if(a.refs&&a.refs[0]&&e(a.refs[0],i)&&!r)return!0;if(a.ref&&e(a.ref,a.name)&&!r)return!0;if($u(s,e))break}else if((Bt(s)||Array.isArray(s))&&$u(s,e))break}}};var uT=(t,e,n)=>{const r=ye(t,n),i=Array.isArray(r)?r:[];return ft(i,BM,e[n]),ft(t,n,i),t},Tn=t=>Bt(t)&&!Object.keys(t).length,hp=t=>{if(!Tm)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},HS=t=>t.type==="radio",pp=t=>t instanceof RegExp,US=(t,e,n,r,i)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:i||!0}}:{};const dT={value:!1,isValid:!1},fT={value:!0,isValid:!0};var UM=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&&!Dt(t[0].attributes.value)?Dt(t[0].value)||t[0].value===""?fT:{value:t[0].value,isValid:!0}:fT:dT}return dT};const hT={isValid:!1,value:null};var FM=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,hT):hT;function pT(t,e,n="validate"){if(Rn(t)||Array.isArray(t)&&t.every(Rn)||gr(t)&&!t)return{type:n,message:Rn(t)?t:"",ref:e}}var Al=t=>Bt(t)&&!pp(t)?t:{value:t,message:""},mT=async(t,e,n,r,i,s)=>{const{ref:a,refs:c,required:u,maxLength:f,minLength:p,min:m,max:g,pattern:y,validate:b,name:w,valueAsNumber:x,mount:k}=t._f,T=ye(n,w);if(!k||e.has(w))return{};const A=c?c[0]:a,_=X=>{if(i&&A.reportValidity){const te=gr(X)?"":X||"";c?c.forEach(ie=>ie.setCustomValidity(te)):A.setCustomValidity(te),A.reportValidity()}},O={},N=HS(a),I=Od(a),j=N||I,G=(x||Em(a))&&Dt(a.value)&&Dt(T)||hp(a)&&a.value===""||T===""||Array.isArray(T)&&!T.length,Y=US.bind(null,w,r,O),ce=(X,te,ie,he=Kr.maxLength,B=Kr.minLength)=>{const Z=X?te:ie;O[w]={type:X?he:B,message:Z,ref:a,...Y(X?he:B,Z)}};if(s?!Array.isArray(T)||!T.length:u&&(!j&&(G||An(T))||gr(T)&&!T||I&&!UM(c).isValid||N&&!FM(c).isValid)){const{value:X,message:te}=Rn(u)?{value:!!u,message:u}:Al(u);if(X&&(O[w]={type:Kr.required,message:te,ref:A,...Y(Kr.required,te)},!r))return _(te),O}if(!G&&(!An(m)||!An(g))){let X,te;const ie=Al(g),he=Al(m);if(!An(T)&&!isNaN(T)){const B=a.valueAsNumber||T&&+T;An(ie.value)||(X=B>ie.value),An(he.value)||(te=B<he.value)}else{const B=a.valueAsDate||new Date(T),Z=Ce=>new Date(new Date().toDateString()+" "+Ce),se=a.type=="time",Se=a.type=="week";Rn(ie.value)&&T&&(X=se?Z(T)>Z(ie.value):Se?T>ie.value:B>new Date(ie.value)),Rn(he.value)&&T&&(te=se?Z(T)<Z(he.value):Se?T<he.value:B<new Date(he.value))}if((X||te)&&(ce(!!X,ie.message,he.message,Kr.max,Kr.min),!r))return _(O[w].message),O}if((f||p)&&!G&&(Rn(T)||s&&Array.isArray(T))){const X=Al(f),te=Al(p),ie=!An(X.value)&&T.length>+X.value,he=!An(te.value)&&T.length<+te.value;if((ie||he)&&(ce(ie,X.message,te.message),!r))return _(O[w].message),O}if(y&&!G&&Rn(T)){const{value:X,message:te}=Al(y);if(pp(X)&&!T.match(X)&&(O[w]={type:Kr.pattern,message:te,ref:a,...Y(Kr.pattern,te)},!r))return _(te),O}if(b){if(Pn(b)){const X=await b(T,n),te=pT(X,A);if(te&&(O[w]={...te,...Y(Kr.validate,te.message)},!r))return _(te.message),O}else if(Bt(b)){let X={};for(const te in b){if(!Tn(X)&&!r)break;const ie=pT(await b[te](T,n),A,te);ie&&(X={...ie,...Y(te,ie.message)},_(ie.message),r&&(O[w]=X))}if(!Tn(X)&&(O[w]={ref:A,...X},!r))return O}}return _(!0),O},Wh=t=>Array.isArray(t)?t:[t],qM=t=>Array.isArray(t)?t.filter(Boolean):[];function uV(t,e){const n=e.length-1;let r=0;for(;r<n;){if(An(t)){t=void 0;break}t=t[e[r]],r++}return t}function dV(t){for(const e in t)if(t.hasOwnProperty(e)&&!Dt(t[e]))return!1;return!0}function Yt(t,e){if(Rn(e)&&Object.prototype.hasOwnProperty.call(t,e))return delete t[e],t;const n=Array.isArray(e)?e:Nd(e)?[e]:_m(e);if(n.some(a=>BS.includes(String(a))))return t;const r=n.length===1?t:uV(t,n),i=n.length-1,s=n[i];return r&&delete r[s],i!==0&&(Bt(r)&&Tn(r)||Array.isArray(r)&&dV(r))&&Yt(t,n.slice(0,-1)),t}const GM=t=>{const e={};for(const n of Object.keys(t))if(jS(t[n])&&t[n]!==null&&!lo(t[n])){const r=GM(t[n]);for(const i of Object.keys(r))e[`${n}.${i}`]=r[i]}else e[n]=t[n];return e},fV=je.createContext(null);fV.displayName="HookFormContext";var gT=()=>{let t=[];return{get observers(){return t},next:i=>{for(const s of t)s.next&&s.next(i)},subscribe:i=>(t.push(i),{unsubscribe:()=>{t=t.filter(s=>s!==i)}}),unsubscribe:()=>{t=[]}}};function WM(t,e){const n={};for(const r in t)if(t.hasOwnProperty(r)){const i=t[r],s=e[r];if(i&&Bt(i)&&s){const a=WM(i,s);Bt(a)&&(n[r]=a)}else t[r]&&(n[r]=s)}return n}var KM=t=>t.type==="select-multiple",hV=t=>HS(t)||Od(t),Rv=t=>hp(t)&&t.isConnected;function yT(t){return Array.isArray(t)||Bt(t)}function ZM(t,e,n="",r=[]){for(const i in t){const s=n?`${n}.${i}`:i,a=t[i];yT(a)&&yT(ye(e,s))?ZM(a,e,s,r):r.push(s)}return r}var pV=t=>{for(const e in t)if(Pn(t[e]))return!0;return!1};function YM(t){return Array.isArray(t)||Bt(t)&&!pV(t)}function XM(t){return!!(t&&"_f"in t)}function JM(t){return Array.isArray(t)?!t.some(e=>!Dt(e)):!Object.keys(t).length}function Wb(t,e){Array.isArray(t)?t[e]=void 0:delete t[e]}function Kb(t,e={},n){for(const r in t){const i=t[r],s=n&&n[r];YM(i)&&(!Array.isArray(i)||!XM(s))?(e[r]=Array.isArray(i)?[]:{},Kb(i,e[r],s),JM(e[r])&&Wb(e,r)):Dt(i)||(e[r]=!0)}return e}function oa(t,e,n,r){n||(n=Kb(e,{},r));for(const i in t){const s=t[i],a=r&&r[i];YM(s)&&(!Array.isArray(s)||!XM(a))?(Dt(e)||Gb(n[i])?n[i]=Kb(s,Array.isArray(s)?[]:{},a):oa(s,An(e)?{}:e[i],n[i],a),JM(n[i])&&Wb(n,i)):yr(s,e[i])?Wb(n,i):n[i]=!0}return n}var QM=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>Dt(t)?t:e?t===""?NaN:t&&+t:n&&Rn(t)?new Date(t):r?r(t):t;function vT(t){const e=t.ref;return Em(e)?e.files:HS(e)?FM(t.refs).value:KM(e)?[...e.selectedOptions].map(({value:n})=>n):Od(e)?UM(t.refs).value:QM(e.value,t)}var mV=(t,e,n,r)=>{const i={};for(const s of t){const a=ye(e,s);a&&ft(i,s,a._f)}return{criteriaMode:n,names:[...t],fields:i,shouldUseNativeValidation:r}},bu=t=>Dt(t)?t:pp(t)?t.source:Bt(t)?pp(t.value)?t.value.source:t.value:t;const bT="AsyncFunction";var gV=t=>{if(!t||!t.validate)return!1;if(Pn(t.validate))return t.validate.constructor.name===bT;if(Bt(t.validate)){for(const e in t.validate)if(t.validate[e].constructor.name===bT)return!0}return!1},yV=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate);function ST(t,e,n){const r=ye(t,n);if(r||Nd(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const s=i.join("."),a=ye(e,s),c=ye(t,s);if(a&&!Array.isArray(a)&&n!==s)return{name:n};if(c&&c.type)return{name:s,error:c};if(c&&c.root&&c.root.type)return{name:`${s}.root`,error:c.root};i.pop()}return{name:n}}var vV=(t,e,n,r)=>{n(t);const i=Object.keys(t).filter(s=>s!=="name");return!i.length||r&&i.length>=Object.keys(e).length||i.find(s=>e[s]===(!r||ei.all))},bV=(t,e,n)=>!t||!e||t===e||Wh(t).some(r=>r&&(n?r===e||r.startsWith(e+"."):r.startsWith(e)||e.startsWith(r))),SV=(t,e,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(e||t):(n?r.isOnBlur:i.isOnBlur)?!t:(n?r.isOnChange:i.isOnChange)?t:!0,wV=(t,e)=>!qM(ye(t,e)).length&&Yt(t,e);const xV={mode:ei.onSubmit,reValidateMode:ei.onChange,shouldFocusError:!0},Mv="form",kV=(t,e)=>{for(const n in t)n in e||delete t[n];Object.assign(t,e)},eO={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function CV(t={}){let e={...xV,...t},n={...jt(eO),isLoading:Pn(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1},r={},i=Bt(e.defaultValues)||Bt(e.values)?jt(e.defaultValues||e.values)||{}:{},s=e.shouldUnregister?{}:jt(i),a={action:!1,mount:!1,watch:!1,keepIsValid:!1},c={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set};const u={},f={};let p=0,m=uh(e.mode),g=uh(e.reValidateMode);const y={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},b={...y};let w={...b};const x={array:gT(),state:gT()};let k=0;const T=e.criteriaMode===ei.all,A=(D,V)=>H=>{clearTimeout(f[D]),f[D]=setTimeout(V,H)},_=async D=>{if(!a.keepIsValid&&!e.disabled&&(b.isValid||w.isValid||D)){const V=++k;let H;e.resolver?(H=Tn((await ie()).errors),V===k&&O()):H=await Z({fields:r,onlyCheckValid:!0,eventType:Xs.VALID}),V===k&&H!==n.isValid&&x.state.next({isValid:H})}},O=(D,V)=>{!e.disabled&&(b.isValidating||b.validatingFields||w.isValidating||w.validatingFields)&&((D||Array.from(c.mount)).forEach(H=>{H&&(V?ft(n.validatingFields,H,V):Yt(n.validatingFields,H))}),x.state.next({validatingFields:n.validatingFields,isValidating:!Tn(n.validatingFields)}))},N=()=>{n.dirtyFields=oa(i,s,void 0,r)},I=(D,V=[],H,re,oe=!0,ge=!0)=>{if(re&&H&&!e.disabled){if(a.action=!0,ge&&Array.isArray(ye(r,D))){const be=H(ye(r,D),re.argA,re.argB);oe&&ft(r,D,be)}if(ge&&Array.isArray(ye(n.errors,D))){const be=H(ye(n.errors,D),re.argA,re.argB);oe&&ft(n.errors,D,be),wV(n.errors,D)}if((b.touchedFields||w.touchedFields)&&ge&&Array.isArray(ye(n.touchedFields,D))){const be=H(ye(n.touchedFields,D),re.argA,re.argB);oe&&ft(n.touchedFields,D,be)}(b.dirtyFields||w.dirtyFields)&&N(),x.state.next({name:D,isDirty:Se(D,V),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else ft(s,D,V)},j=(D,V)=>{ft(n.errors,D,V),n.errors={...n.errors},x.state.next({errors:n.errors})},G=D=>{n.errors=D,x.state.next({errors:n.errors,isValid:!1})},Y=D=>{const V=Nd(D)?[D]:_m(D);let H=s,re=i;for(let oe=0;oe<V.length-1;oe++){const ge=V[oe];if(H=An(H)?H:H[ge],re=An(re)?re:re[ge],H===null&&re!==null)return!0}return!1},ce=(D,V,H,re)=>{const oe=ye(r,D);if(oe){if(Y(D))return;const ge=Dt(ye(s,D)),be=ye(s,D,Dt(H)?ye(i,D):H);Dt(be)||re&&re.defaultChecked||V?ft(s,D,V?be:vT(oe._f)):K(D,be),a.mount&&!a.action&&(_(),ge&&n.isDirty&&(b.isDirty||w.isDirty)&&(Se()||(n.isDirty=!1,x.state.next({...n}))),t.shouldUnregister&&ge&&!Dt(ye(s,D))&&Av(D,c)&&(a.watch=!0))}},X=(D,V,H,re,oe)=>{let ge=!1,be=!1;const xe={name:D};if(!e.disabled||re===!0){if(!H||re){const ze=yr(ye(i,D),V);(b.isDirty||w.isDirty)&&(be=n.isDirty,n.isDirty=xe.isDirty=!ze||Se(),ge=be!==xe.isDirty),be=!!ye(n.dirtyFields,D),ze!==n.isDirty?kV(n.dirtyFields,oa(i,s,void 0,r)):ze?Yt(n.dirtyFields,D):ft(n.dirtyFields,D,!0),xe.dirtyFields=n.dirtyFields,ge=ge||(b.dirtyFields||w.dirtyFields)&&be!==!ze}if(H){const ze=ye(n.touchedFields,D);ze||(ft(n.touchedFields,D,H),xe.touchedFields=n.touchedFields,ge=ge||(b.touchedFields||w.touchedFields)&&ze!==H)}ge&&oe&&x.state.next(xe)}return ge?xe:{}},te=(D,V,H,re)=>{const oe=ye(n.errors,D),ge=(b.isValid||w.isValid)&&gr(V)&&n.isValid!==V;if(e.delayError&&H?(u[D]=A(D,()=>j(D,H)),u[D](e.delayError)):(clearTimeout(f[D]),delete u[D],H?ft(n.errors,D,H):Yt(n.errors,D),n.errors={...n.errors}),(H?!yr(oe,H):oe)||!Tn(re)||ge){const be={...re,...ge&&gr(V)?{isValid:V}:{},errors:n.errors,name:D};n={...n,...be},x.state.next(be)}},ie=async D=>(O(D,!0),await e.resolver(s,e.context,mV(D||c.mount,r,e.criteriaMode,e.shouldUseNativeValidation))),he=async D=>{const{errors:V}=await ie(D);if(O(D),D){for(const H of D){const re=ye(V,H);re?c.array.has(H)&&Bt(re)&&!Object.keys(re).some(oe=>!Number.isNaN(Number(oe)))?uT(n.errors,{[H]:re},H):ft(n.errors,H,re):Yt(n.errors,H)}n.errors={...n.errors}}else n.errors=V;return V},B=async({name:D,eventType:V})=>{if(t.validate){const H=await t.validate({formValues:s,formState:n,name:D,eventType:V});if(Bt(H))for(const re in H){const oe=H[re];oe&&pt(`${Mv}.${re}`,{message:Rn(oe.message)?oe.message:"",type:oe.type||Kr.validate})}else Rn(H)||!H?pt(Mv,{message:H||"",type:Kr.validate}):Qe(Mv);return H}return!0},Z=async({fields:D,onlyCheckValid:V,name:H,eventType:re,context:oe={valid:!0,runRootValidation:!1}})=>{if(t.validate&&(oe.runRootValidation=!0,!await B({name:H,eventType:re})&&(oe.valid=!1,V)))return oe.valid;for(const ge in D){const be=D[ge];if(be){const{_f:xe,...ze}=be;if(xe){const st=c.array.has(xe.name),Pt=be._f&&gV(be._f),Xn=b.validatingFields||b.isValidating||w.validatingFields||w.isValidating;Pt&&Xn&&O([xe.name],!0);const Sn=await mT(be,c.disabled,s,T,e.shouldUseNativeValidation&&!V,st);if(Pt&&Xn&&O([xe.name]),Sn[xe.name]&&(oe.valid=!1,V)||(!V&&(ye(Sn,xe.name)?st?uT(n.errors,Sn,xe.name):ft(n.errors,xe.name,Sn[xe.name]):Yt(n.errors,xe.name)),t.shouldUseNativeValidation&&Sn[xe.name]))break}!Tn(ze)&&await Z({context:oe,onlyCheckValid:V,fields:ze,name:ge,eventType:re})}}return oe.valid},se=()=>{for(const D of c.unMount){const V=ye(r,D);V&&(V._f.refs?V._f.refs.every(H=>!Rv(H)):!Rv(V._f.ref))&&Ur(D)}c.unMount=new Set},Se=(D,V)=>(D&&V&&ft(s,D,V),!yr(a.mount?s:i,i)),Ce=(D,V,H)=>qb(D,c,{...a.mount?s:Dt(V)?i:Rn(D)?{[D]:V}:V},H,V),z=D=>qM(ye(a.mount?s:i,D,e.shouldUnregister?ye(i,D,[]):[])),K=(D,V,H={},re=!1,oe=!1)=>{const ge=ye(r,D);let be=V;if(ge){const xe=ge._f;xe&&(!xe.disabled&&ft(s,D,QM(V,xe)),be=hp(xe.ref)&&An(V)?"":V,KM(xe.ref)?[...xe.ref.options].forEach(ze=>ze.selected=be.includes(ze.value)):xe.refs?Od(xe.ref)?xe.refs.forEach(ze=>{(!ze.defaultChecked||!ze.disabled)&&(Array.isArray(be)?ze.checked=!!be.find(st=>st===ze.value):ze.checked=be===ze.value||!!be)}):xe.refs.forEach(ze=>ze.checked=ze.value===be):Em(xe.ref)?xe.ref.value="":(xe.ref.value=be,!xe.ref.type&&!oe&&x.state.next({name:D,values:re?s:jt(s)})))}(H.shouldDirty||H.shouldTouch)&&X(D,be,H.shouldTouch,H.shouldDirty,!oe),H.shouldValidate&&Ee(D,{delayError:H.delayError})},le=(D,V,H,re=!1,oe=!1)=>{c.array.has(D)&&x.array.next({name:D,values:re?s:jt(s)});for(const ge in V){if(!V.hasOwnProperty(ge))return;const be=V[ge],xe=D+"."+ge,ze=ye(r,xe);(c.array.has(D)||Bt(be)||ze&&!ze._f)&&!lo(be)?le(xe,be,H,re,oe):K(xe,be,H,re,oe)}},ve=(D,V,H,re,oe=!1)=>{const ge=ye(r,D),be=c.array.has(D),xe=re?V:jt(V),ze=ye(s,D),st=yr(ze,xe);if(st||ft(s,D,xe),be)x.array.next({name:D,values:re?s:jt(s)}),(b.isDirty||b.dirtyFields||w.isDirty||w.dirtyFields)&&H.shouldDirty&&(N(),oe||x.state.next({name:D,dirtyFields:n.dirtyFields,isDirty:Se(D,xe)}));else{const Pt=Array.isArray(xe)&&!xe.length||Tn(xe);!ge||ge._f||An(xe)||Pt?K(D,xe,H,re,oe):le(D,xe,H,re,oe)}if(!st&&!oe){const Pt=Av(D,c),Xn=re?s:jt(s);x.state.next({...Pt&&n,name:a.mount||Pt?D:void 0,values:Xn})}},Ae=(D,V,H={})=>ve(D,V,H,!1),de=(D,V={})=>{const H=Pn(D)?D(s):D;if(!yr(s,H)){s={...s,...H};const re=GM(H);for(const oe of c.mount)oe in re&&ve(oe,re[oe],V,!0,!0);x.state.next({...n,name:void 0,type:void 0,...p?{values:s}:{}}),V.shouldValidate&&_()}},pe=async D=>{a.mount=!0;const V=D.target;let H=V.name,re=!0;const oe=ye(r,H),ge=be=>{re=Number.isNaN(be)||lo(be)&&isNaN(be.getTime())||yr(be,ye(s,H,be))};if(oe){let be,xe;const ze=V.type?vT(oe._f):Fb(D),st=D.type===Xs.BLUR||D.type===Xs.FOCUS_OUT,Pt=!yV(oe._f)&&!t.validate&&!e.resolver&&!ye(n.errors,H)&&!oe._f.deps,Xn=Pt||SV(st,ye(n.touchedFields,H),n.isSubmitted,g,m),Sn=Av(H,c,st);if(ft(s,H,ze),st){if(!V||!V.readOnly){oe._f.onBlur&&oe._f.onBlur(D);const $o=u[H];$o&&$o(0)}}else oe._f.onChange&&oe._f.onChange(D);const ci=X(H,ze,st),Bo=!Tn(ci)||Sn;if(!st&&x.state.next({name:H,type:D.type,...p?{values:jt(s)}:{}}),Xn)return(!Pt||!n.isValid)&&(b.isValid||w.isValid)&&(e.mode==="onBlur"?st&&_():st||_()),Bo&&x.state.next({name:H,...Sn?{}:ci});if(!e.resolver&&t.validate&&await B({name:H,eventType:D.type}),!st&&Sn&&x.state.next({...n}),e.resolver){const{errors:$o}=await ie([H]);if(O([H]),ge(ze),!re){!Tn(ci)&&x.state.next(ci);return}const Wd=ST(n.errors,r,H),Ua=ST($o,r,Wd.name||H);be=Ua.error,H=Ua.name,xe=Tn($o)}else O([H],!0),be=(await mT(oe,c.disabled,s,T,e.shouldUseNativeValidation))[H],O([H]),ge(ze),re&&(be?xe=!1:(b.isValid||w.isValid)&&(xe=await Z({fields:r,onlyCheckValid:!0,name:H,eventType:D.type})));re&&(oe._f.deps&&(!Array.isArray(oe._f.deps)||oe._f.deps.length>0)&&Ee(oe._f.deps),te(H,xe,be,ci))}},me=(D,V)=>{if(ye(n.errors,V)&&D.focus)return D.focus(),1},Ee=async(D,V={})=>{let H,re;const oe=Wh(D);if(e.resolver){const ge=await he(Dt(D)?D:oe);H=Tn(ge),re=D?!oe.some(be=>ye(ge,be)):H}else D?(re=(await Promise.all(oe.map(async ge=>{const be=ye(r,ge);return await Z({fields:be&&be._f?{[ge]:be}:be,eventType:Xs.TRIGGER})}))).every(Boolean),!(!re&&!n.isValid)&&_()):re=H=await Z({fields:r,name:D,eventType:Xs.TRIGGER});if(V.delayError&&e.delayError&&Rn(D)){const ge=ye(n.errors,D);ge?(Yt(n.errors,D),u[D]=A(D,()=>j(D,ge)),u[D](e.delayError)):(clearTimeout(f[D]),delete u[D])}return x.state.next({...!Rn(D)||(b.isValid||w.isValid)&&H!==n.isValid?{}:{name:D},...e.resolver||!D?{isValid:H}:{},errors:n.errors}),V.shouldFocus&&!re&&$u(r,me,D?oe:c.mount),re},it=(D,V)=>{let H={...a.mount?s:i};return V&&(H=WM(V.dirtyFields?n.dirtyFields:n.touchedFields,H)),Dt(D)?H:Rn(D)?ye(H,D):D.map(re=>ye(H,re))},Ke=(D,V)=>({invalid:!!ye((V||n).errors,D),isDirty:!!ye((V||n).dirtyFields,D),error:ye((V||n).errors,D),isValidating:!!ye(n.validatingFields,D),isTouched:!!ye((V||n).touchedFields,D)}),Qe=D=>{const V=D?Wh(D):void 0;V?.forEach(H=>Yt(n.errors,H)),V?V.forEach(H=>{x.state.next({name:H,errors:n.errors})}):(n.errors={},x.state.next({errors:n.errors}))},pt=(D,V,H)=>{const re=(ye(r,D,{_f:{}})._f||{}).ref,oe=ye(n.errors,D)||{},{ref:ge,message:be,type:xe,...ze}=oe;ft(n.errors,D,{...ze,...V,ref:re}),x.state.next({name:D,errors:n.errors,isValid:!1}),H&&H.shouldFocus&&re&&re.focus&&re.focus()},$t=(D,V)=>{if(Pn(D)){p++;const{unsubscribe:H}=x.state.subscribe({next:oe=>"values"in oe&&D(oe.values||Ce(void 0,V),oe)});let re=!1;return{unsubscribe:()=>{re||(re=!0,p--,H())}}}return Ce(D,V,!0)},Wt=D=>{var V;const H=!!(!((V=D.formState)===null||V===void 0)&&V.values);H&&p++;const{unsubscribe:re}=x.state.subscribe({next:ge=>{if(bV(D.name,ge.name,D.exact)&&vV(ge,D.formState||b,Gd,D.reRenderRoot)){const be={...s};D.callback({values:be,...n,...ge,defaultValues:i})}}});if(!H)return re;let oe=!1;return()=>{oe||(oe=!0,p--,re())}},Hr=D=>(a.mount=!0,w={...w,...D.formState},Wt({...D,formState:{...y,...D.formState}})),Ur=(D,V={})=>{for(const H of D?Wh(D):c.mount)c.mount.delete(H),c.array.delete(H),V.keepValue||(Yt(r,H),Yt(s,H)),!V.keepError&&Yt(n.errors,H),!V.keepDirty&&Yt(n.dirtyFields,H),!V.keepTouched&&Yt(n.touchedFields,H),!V.keepIsValidating&&Yt(n.validatingFields,H),!e.shouldUnregister&&!V.keepDefaultValue&&Yt(i,H);x.state.next({values:jt(s)}),x.state.next({...n,...V.keepDirty?{isDirty:Se()}:{}}),!V.keepIsValid&&_()},Fr=({disabled:D,name:V})=>{if(gr(D)&&a.mount||D||c.disabled.has(V)){const oe=c.disabled.has(V)!==!!D;D?c.disabled.add(V):c.disabled.delete(V),oe&&a.mount&&!a.action&&_()}},ae=(D,V={})=>{let H=ye(r,D);const re=gr(V.disabled)||gr(e.disabled),oe=!c.registerName.has(D)&&H&&H._f&&!H._f.mount;return ft(r,D,{...H||{},_f:{...H&&H._f?H._f:{ref:{name:D}},name:D,mount:!0,...V}}),c.mount.add(D),H&&!oe?Fr({disabled:gr(V.disabled)?V.disabled:e.disabled,name:D}):ce(D,!0,V.value),{...re?{disabled:V.disabled||e.disabled}:{},...e.progressive?{required:!!V.required,min:bu(V.min),max:bu(V.max),minLength:bu(V.minLength),maxLength:bu(V.maxLength),pattern:bu(V.pattern)}:{},name:D,onChange:pe,onBlur:pe,ref:ge=>{if(ge){c.registerName.add(D),ae(D,V),c.registerName.delete(D),H=ye(r,D);const be=Dt(ge.value)&&ge.querySelectorAll&&ge.querySelectorAll("input,select,textarea")[0]||ge,xe=hV(be),ze=H._f.refs||[];if(xe?ze.find(Pt=>Pt===be):be===H._f.ref)return;const st={...H._f};xe?(st.refs=[...ze.filter(Rv),be,...Array.isArray(ye(i,D))?[{}]:[]],st.ref={type:be.type,name:D}):(st.ref=be,delete st.refs),ft(r,D,{_f:st}),ce(D,!1,void 0,be)}else H=ye(r,D,{}),H._f&&(H._f.mount=!1),(e.shouldUnregister||V.shouldUnregister)&&!(PM(c.array,D)&&a.action)&&c.unMount.add(D)}}},Le=()=>e.shouldFocusError&&!e.shouldUseNativeValidation&&$u(r,me,c.mount),It=D=>{gr(D)&&(x.state.next({disabled:D}),$u(r,(V,H)=>{const re=ye(r,H);re&&(V.disabled=re._f.disabled||D,Array.isArray(re._f.refs)&&re._f.refs.forEach(oe=>{oe.disabled=re._f.disabled||D}))},0,!1))},Yn=(D,V)=>async H=>{let re,oe;H&&(H.preventDefault&&H.preventDefault(),H.persist&&H.persist());let ge=jt(s);if(x.state.next({isSubmitting:!0}),e.resolver){const{errors:be,values:xe}=await ie();O(),n.errors=be,ge=jt(xe)}else await Z({fields:r,eventType:Xs.SUBMIT});if(c.disabled.size)for(const be of c.disabled)Yt(ge,be);if(Yt(n.errors,BM),Tn(n.errors)){x.state.next({errors:{}});try{re=await D(ge,H)}catch(be){oe=be}}else V&&await V({...n.errors},H),Le(),setTimeout(Le);if(x.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Tn(n.errors)&&!oe,submitCount:n.submitCount+1,errors:n.errors}),oe)throw oe;return re},ks=(D,V={})=>{ye(r,D)&&(Dt(V.defaultValue)?Ae(D,jt(ye(i,D))):(Ae(D,V.defaultValue),ft(i,D,jt(V.defaultValue))),V.keepTouched||Yt(n.touchedFields,D),V.keepDirty||(Yt(n.dirtyFields,D),n.isDirty=V.defaultValue?Se(D,jt(ye(i,D))):Se()),V.keepError||(Yt(n.errors,D),b.isValid&&_()),x.state.next({...n}))},Jt=(D,V={})=>{const H=D?jt(D):i,re=jt(H),oe=Tn(D),ge=re,be=r;if(V.keepDefaultValues||(i=H),!V.keepValues){if(V.keepDirtyValues){const xe=new Set([...c.mount,...ZM(oa(i,s,void 0,be),n.dirtyFields)]);for(const ze of Array.from(xe)){const st=ye(n.dirtyFields,ze),Pt=ye(s,ze),Xn=ye(ge,ze);st&&!Dt(Pt)?ft(ge,ze,Pt):!st&&!Dt(Xn)&&Ae(ze,Xn)}}else{if(Tm&&Dt(D))for(const xe of c.mount){const ze=ye(r,xe);if(ze&&ze._f){const st=Array.isArray(ze._f.refs)?ze._f.refs[0]:ze._f.ref;if(hp(st)){const Pt=st.closest("form");if(Pt){Pt.reset();break}}}}if(V.keepFieldsRef)for(const xe of c.mount)Ae(xe,ye(ge,xe));else r={}}if(e.shouldUnregister){if(s=V.keepDefaultValues?jt(i):{},V.keepFieldsRef)for(const xe of c.mount)ft(s,xe,ye(ge,xe))}else s=jt(ge);x.array.next({values:{...ge}}),x.state.next({name:void 0,type:void 0,values:{...ge}})}c={mount:V.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!b.isValid||!!V.keepIsValid||!!V.keepDirtyValues||!e.shouldUnregister&&!Tn(ge),a.watch=!!e.shouldUnregister,a.keepIsValid=!!V.keepIsValid,a.action=!1,V.keepErrors||(n.errors={}),x.state.next({submitCount:V.keepSubmitCount?n.submitCount:0,isDirty:oe?!1:V.keepDirty?n.isDirty:V.keepValues?Se():!!(V.keepDefaultValues&&!yr(D,i)),isSubmitted:V.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:oe?{}:V.keepDirtyValues?V.keepDefaultValues&&s?oa(i,s,void 0,be):n.dirtyFields:V.keepDefaultValues&&D?oa(i,D,void 0,be):V.keepDirty?n.dirtyFields:{},touchedFields:V.keepTouched?n.touchedFields:{},errors:V.keepErrors?n.errors:{},isSubmitSuccessful:V.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},Fd=(D,V)=>Jt(Pn(D)?D(s):D,{...e.resetOptions,...V}),qd=(D,V={})=>{const H=ye(r,D),re=H&&H._f;if(re){const oe=re.refs?re.refs[0]:re.ref;oe.focus&&setTimeout(()=>{oe.focus(),V.shouldSelect&&Pn(oe.select)&&oe.select()})}},Gd=D=>{const{name:V,type:H,values:re,...oe}=D;n={...n,...oe}},xc={control:{register:ae,unregister:Ur,getFieldState:Ke,handleSubmit:Yn,setError:pt,_subscribe:Wt,_runSchema:ie,_updateIsValidating:O,_focusError:Le,_getWatch:Ce,_getDirty:Se,_setValid:_,_setFieldArray:I,_setDisabledField:Fr,_setErrors:G,_getFieldArray:z,_reset:Jt,_resetDefaultValues:()=>Pn(e.defaultValues)&&e.defaultValues().then(D=>{Fd(D,e.resetOptions),x.state.next({isLoading:!1})}),_removeUnmounted:se,_disableForm:It,_subjects:x,_proxyFormState:b,get _fields(){return r},get _formValues(){return s},get _state(){return a},set _state(D){a=D},get _defaultValues(){return i},get _names(){return c},set _names(D){c=D},get _formState(){return n},get _options(){return e},set _options(D){e={...e,...D},m=uh(e.mode),g=uh(e.reValidateMode)}},subscribe:Hr,trigger:Ee,register:ae,handleSubmit:Yn,watch:$t,setValue:Ae,setValues:de,getValues:it,reset:Fd,resetField:ks,resetDefaultValues:(D,V={})=>{if(i=jt(D),!V.keepDirty){const H=oa(i,s,void 0,r);n.dirtyFields=H,n.isDirty=!Tn(H)}V.keepIsValid||_(),x.state.next({...n,defaultValues:i})},clearErrors:Qe,unregister:Ur,setError:pt,setFocus:qd,getFieldState:Ke};return{...xc,formControl:xc}}function EV(t={}){const e=je.useRef(void 0),n=je.useRef(void 0),r=je.useRef(t.formControl),[i,s]=je.useState(()=>({...jt(eO),isLoading:Pn(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1,defaultValues:Pn(t.defaultValues)?void 0:t.defaultValues}));if(!e.current||t.formControl&&r.current!==t.formControl)if(r.current=t.formControl,t.formControl)e.current={...t.formControl,formState:i},t.defaultValues&&!Pn(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:c,...u}=CV(t);e.current={...u,formState:i}}const a=e.current.control;return a._options=t,VS(()=>{const c=a._subscribe({formState:a._proxyFormState,callback:()=>s({...a._formState,defaultValues:a._defaultValues}),reRenderRoot:!0});return s(u=>({...u,isReady:!0})),a._formState.isReady=!0,c},[a]),je.useEffect(()=>a._disableForm(t.disabled),[a,t.disabled]),je.useEffect(()=>{t.mode&&(a._options.mode=t.mode),t.reValidateMode&&(a._options.reValidateMode=t.reValidateMode)},[a,t.mode,t.reValidateMode]),je.useEffect(()=>{t.errors&&(a._setErrors(t.errors),a._focusError())},[a,t.errors]),je.useEffect(()=>{t.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,t.shouldUnregister]),je.useEffect(()=>{if(a._proxyFormState.isDirty){const c=a._getDirty();c!==i.isDirty&&a._subjects.state.next({isDirty:c})}},[a,i.isDirty]),je.useEffect(()=>{var c;t.values&&!yr(t.values,n.current)?(a._reset(t.values,{keepFieldsRef:!0,...a._options.resetOptions}),!((c=a._options.resetOptions)===null||c===void 0)&&c.keepIsValid||a._setValid(),n.current=t.values,s(u=>({...u}))):a._resetDefaultValues()},[a,t.values]),je.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),e.current.formState=je.useMemo(()=>VM(i,a),[a,i]),e.current}const wT=(t,e,n)=>{if(t&&"reportValidity"in t){const r=ye(n,e);t.setCustomValidity(r&&r.message||""),t.reportValidity()}},Zb=(t,e)=>{for(const n in e.fields){const r=e.fields[n];r&&r.ref&&"reportValidity"in r.ref?wT(r.ref,n,t):r&&r.refs&&r.refs.forEach(i=>wT(i,n,t))}},xT=(t,e)=>{e.shouldUseNativeValidation&&Zb(t,e);const n={};for(const r in t){const i=ye(e.fields,r),s=Object.assign(t[r]||{},{ref:i&&i.refs?i.refs[0]:i&&i.ref});if(TV(e.names||Object.keys(t),r)){const a=Object.assign({},ye(n,r));ft(a,"root",s),ft(n,r,a)}else ft(n,r,s)}return n},TV=(t,e)=>{const n=kT(e).replace(/[.*+?^${}()|\\]/g,"\\$&");return t.some(r=>kT(r).match(`^${n}\\.\\d+`))};function kT(t){return t.replace(/[\[\]]/g,"")}function Yb(){return Yb=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},Yb.apply(null,arguments)}function CT(t,e){try{var n=t()}catch(r){return e(r)}return n&&n.then?n.then(void 0,e):n}function _V(t,e){for(var n=Object.create(null);t.length;){var r=t[0],i=r.code,s=r.message,a=r.path.join(".");if(!n[a])if("unionErrors"in r){var c,u,f=r.unionErrors.reduce(function(g,y){return y.errors.length<g.errors.length?y:g}).errors[0];n[a]={message:(c=f?.message)!=null?c:s,type:(u=f?.code)!=null?u:i}}else n[a]={message:s,type:i};if("unionErrors"in r&&r.unionErrors.forEach(function(g){return g.errors.forEach(function(y){return t.push(y)})}),e){var p=n[a].types,m=p&&p[r.code];n[a]=US(a,e,n,i,m?[].concat(m,r.message):r.message)}t.shift()}return n}function AV(t,e){for(var n=Object.create(null),r=function(){var i=t[0],s=i.code,a=i.message,c=i.path.join(".");if(!n[c])if(i.code==="invalid_union"&&i.errors.length>0){var u,f,p=i.errors.reduce(function(y,b){return b.length<y.length?b:y})[0];n[c]={message:(u=p?.message)!=null?u:a,type:(f=p?.code)!=null?f:s}}else n[c]={message:a,type:s};if(i.code==="invalid_union"&&i.errors.forEach(function(y){return y.forEach(function(b){return t.push(Yb({},b,{path:[].concat(i.path,b.path)}))})}),e){var m=n[c].types,g=m&&m[i.code];n[c]=US(c,e,n,s,g?[].concat(g,i.message):i.message)}t.shift()};t.length;)r();return n}function RV(t,e,n){if(n===void 0&&(n={}),(function(r){return"_zod"in r&&typeof r._zod=="object"})(t))return function(r,i,s){try{return Promise.resolve(CT(function(){function a(u){return s.shouldUseNativeValidation&&Zb({},s),{errors:{},values:n.raw?Object.assign({},r):u}}var c=t;return n.mode==="sync"?a(c.parse(r,e)):Promise.resolve(c.parseAsync(r,e)).then(a)},function(a){if((function(c){var u;return!(c==null||(u=c._zod)==null||(u=u.traits)==null||!u.has("$ZodError"))})(a))return{values:{},errors:xT(AV(a.issues,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw a}))}catch(a){return Promise.reject(a)}};if((function(r){return"_def"in r&&typeof r._def=="object"})(t))return function(r,i,s){try{return Promise.resolve(CT(function(){return Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](r,e)).then(function(a){return s.shouldUseNativeValidation&&Zb({},s),{errors:{},values:n.raw?Object.assign({},r):a}})},function(a){if((function(c){return Array.isArray(c?.issues)})(a))return{values:{},errors:xT(_V(a.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw a}))}catch(a){return Promise.reject(a)}};throw new Error("Invalid input: not a Zod schema")}var ut;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const s={};for(const a of i)s[a]=a;return s},t.getValidEnumValues=i=>{const s=t.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),a={};for(const c of s)a[c]=i[c];return t.objectValues(a)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&s.push(a);return s},t.find=(i,s)=>{for(const a of i)if(s(a))return a},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(ut||(ut={}));var ET;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(ET||(ET={}));const Re=ut.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Js=t=>{switch(typeof t){case"undefined":return Re.undefined;case"string":return Re.string;case"number":return Number.isNaN(t)?Re.nan:Re.number;case"boolean":return Re.boolean;case"function":return Re.function;case"bigint":return Re.bigint;case"symbol":return Re.symbol;case"object":return Array.isArray(t)?Re.array:t===null?Re.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Re.promise:typeof Map<"u"&&t instanceof Map?Re.map:typeof Set<"u"&&t instanceof Set?Re.set:typeof Date<"u"&&t instanceof Date?Re.date:Re.object;default:return Re.unknown}},fe=ut.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 ys extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(s){return s.message},r={_errors:[]},i=s=>{for(const a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let c=r,u=0;for(;u<a.path.length;){const f=a.path[u];u===a.path.length-1?(c[f]=c[f]||{_errors:[]},c[f]._errors.push(n(a))):c[f]=c[f]||{_errors:[]},c=c[f],u++}}};return i(this),r}static assert(e){if(!(e instanceof ys))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ut.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const s=i.path[0];n[s]=n[s]||[],n[s].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ys.create=t=>new ys(t);const Xb=(t,e)=>{let n;switch(t.code){case fe.invalid_type:t.received===Re.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case fe.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,ut.jsonStringifyReplacer)}`;break;case fe.unrecognized_keys:n=`Unrecognized key(s) in object: ${ut.joinValues(t.keys,", ")}`;break;case fe.invalid_union:n="Invalid input";break;case fe.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ut.joinValues(t.options)}`;break;case fe.invalid_enum_value:n=`Invalid enum value. Expected ${ut.joinValues(t.options)}, received '${t.received}'`;break;case fe.invalid_arguments:n="Invalid function arguments";break;case fe.invalid_return_type:n="Invalid function return type";break;case fe.invalid_date:n="Invalid date";break;case fe.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}"`:ut.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case fe.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 fe.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 fe.custom:n="Invalid input";break;case fe.invalid_intersection_types:n="Intersection results could not be merged";break;case fe.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case fe.not_finite:n="Number must be finite";break;default:n=e.defaultError,ut.assertNever(t)}return{message:n}};let MV=Xb;function OV(){return MV}const NV=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,s=[...n,...i.path||[]],a={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let c="";const u=r.filter(f=>!!f).slice().reverse();for(const f of u)c=f(a,{data:e,defaultError:c}).message;return{...i,path:s,message:c}};function ke(t,e){const n=OV(),r=NV({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Xb?void 0:Xb].filter(i=>!!i)});t.common.issues.push(r)}class wr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const i of n){if(i.status==="aborted")return Fe;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const i of n){const s=await i.key,a=await i.value;r.push({key:s,value:a})}return wr.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const i of n){const{key:s,value:a}=i;if(s.status==="aborted"||a.status==="aborted")return Fe;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(r[s.value]=a.value)}return{status:e.value,value:r}}}const Fe=Object.freeze({status:"aborted"}),Ru=t=>({status:"dirty",value:t}),Vr=t=>({status:"valid",value:t}),TT=t=>t.status==="aborted",_T=t=>t.status==="dirty",Xl=t=>t.status==="valid",mp=t=>typeof Promise<"u"&&t instanceof Promise;var Oe;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Oe||(Oe={}));class ko{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const AT=(t,e)=>{if(Xl(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 ys(t.common.issues);return this._error=n,this._error}}};function Ye(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(a,c)=>{const{message:u}=t;return a.code==="invalid_enum_value"?{message:u??c.defaultError}:typeof c.data>"u"?{message:u??r??c.defaultError}:a.code!=="invalid_type"?{message:c.defaultError}:{message:u??n??c.defaultError}},description:i}}class ot{get description(){return this._def.description}_getType(e){return Js(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Js(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new wr,ctx:{common:e.parent.common,data:e.data,parsedType:Js(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(mp(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:Js(e)},i=this._parseSync({data:e,path:r.path,parent:r});return AT(r,i)}"~validate"(e){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Js(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:n});return Xl(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=>Xl(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:Js(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(mp(i)?i:Promise.resolve(i));return AT(r,s)}refine(e,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const a=e(i),c=()=>s.addIssue({code:fe.custom,...r(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(c(),!1)):a?!0:(c(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new ec({schema:this,typeName:qe.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 go.create(this,this._def)}nullable(){return tc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xi.create(this)}promise(){return bp.create(this,this._def)}or(e){return yp.create([this,e],this._def)}and(e){return vp.create(this,e,this._def)}transform(e){return new ec({...Ye(this._def),schema:this,typeName:qe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new e0({...Ye(this._def),innerType:this,defaultValue:n,typeName:qe.ZodDefault})}brand(){return new tH({typeName:qe.ZodBranded,type:this,...Ye(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new t0({...Ye(this._def),innerType:this,catchValue:n,typeName:qe.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return FS.create(this,e)}readonly(){return n0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const DV=/^c[^\s-]{8,}$/i,IV=/^[0-9a-z]+$/,LV=/^[0-9A-HJKMNP-TV-Z]{26}$/i,zV=/^[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,PV=/^[a-z0-9_-]{21}$/i,jV=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,BV=/^[-+]?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)?)??$/,$V=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,VV="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ov;const HV=/^(?:(?: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])$/,UV=/^(?:(?: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])$/,FV=/^(([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]))$/,qV=/^(([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])$/,GV=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,WV=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,tO="((\\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])))",KV=new RegExp(`^${tO}$`);function nO(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 ZV(t){return new RegExp(`^${nO(t)}$`)}function YV(t){let e=`${tO}T${nO(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 XV(t,e){return!!((e==="v4"||!e)&&HV.test(t)||(e==="v6"||!e)&&FV.test(t))}function JV(t,e){if(!jV.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function QV(t,e){return!!((e==="v4"||!e)&&UV.test(t)||(e==="v6"||!e)&&qV.test(t))}class co extends ot{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Re.string){const s=this._getOrReturnCtx(e);return ke(s,{code:fe.invalid_type,expected:Re.string,received:s.parsedType}),Fe}const r=new wr;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),ke(i,{code:fe.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),ke(i,{code:fe.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,c=e.data.length<s.value;(a||c)&&(i=this._getOrReturnCtx(e,i),a?ke(i,{code:fe.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&ke(i,{code:fe.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")$V.test(e.data)||(i=this._getOrReturnCtx(e,i),ke(i,{validation:"email",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Ov||(Ov=new RegExp(VV,"u")),Ov.test(e.data)||(i=this._getOrReturnCtx(e,i),ke(i,{validation:"emoji",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")zV.test(e.data)||(i=this._getOrReturnCtx(e,i),ke(i,{validation:"uuid",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")PV.test(e.data)||(i=this._getOrReturnCtx(e,i),ke(i,{validation:"nanoid",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")DV.test(e.data)||(i=this._getOrReturnCtx(e,i),ke(i,{validation:"cuid",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")IV.test(e.data)||(i=this._getOrReturnCtx(e,i),ke(i,{validation:"cuid2",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")LV.test(e.data)||(i=this._getOrReturnCtx(e,i),ke(i,{validation:"ulid",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),ke(i,{validation:"url",code:fe.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),ke(i,{validation:"regex",code:fe.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),ke(i,{code:fe.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),ke(i,{code:fe.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),ke(i,{code:fe.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?YV(s).test(e.data)||(i=this._getOrReturnCtx(e,i),ke(i,{code:fe.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?KV.test(e.data)||(i=this._getOrReturnCtx(e,i),ke(i,{code:fe.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?ZV(s).test(e.data)||(i=this._getOrReturnCtx(e,i),ke(i,{code:fe.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?BV.test(e.data)||(i=this._getOrReturnCtx(e,i),ke(i,{validation:"duration",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?XV(e.data,s.version)||(i=this._getOrReturnCtx(e,i),ke(i,{validation:"ip",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?JV(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),ke(i,{validation:"jwt",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?QV(e.data,s.version)||(i=this._getOrReturnCtx(e,i),ke(i,{validation:"cidr",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?GV.test(e.data)||(i=this._getOrReturnCtx(e,i),ke(i,{validation:"base64",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?WV.test(e.data)||(i=this._getOrReturnCtx(e,i),ke(i,{validation:"base64url",code:fe.invalid_string,message:s.message}),r.dirty()):ut.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:fe.invalid_string,...Oe.errToObj(r)})}_addCheck(e){return new co({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Oe.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Oe.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Oe.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Oe.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Oe.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Oe.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Oe.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Oe.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Oe.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Oe.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Oe.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Oe.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Oe.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,...Oe.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,...Oe.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Oe.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Oe.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...Oe.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Oe.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Oe.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Oe.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Oe.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Oe.errToObj(n)})}nonempty(e){return this.min(1,Oe.errToObj(e))}trim(){return new co({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new co({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new co({...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}}co.create=t=>new co({checks:[],typeName:qe.ZodString,coerce:t?.coerce??!1,...Ye(t)});function eH(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(t.toFixed(i).replace(".","")),a=Number.parseInt(e.toFixed(i).replace(".",""));return s%a/10**i}class Jl extends ot{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)!==Re.number){const s=this._getOrReturnCtx(e);return ke(s,{code:fe.invalid_type,expected:Re.number,received:s.parsedType}),Fe}let r;const i=new wr;for(const s of this._def.checks)s.kind==="int"?ut.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ke(r,{code:fe.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),ke(r,{code:fe.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),ke(r,{code:fe.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?eH(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),ke(r,{code:fe.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),ke(r,{code:fe.not_finite,message:s.message}),i.dirty()):ut.assertNever(s);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Oe.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Oe.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Oe.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Oe.toString(n))}setLimit(e,n,r,i){return new Jl({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Oe.toString(i)}]})}_addCheck(e){return new Jl({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Oe.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Oe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Oe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Oe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Oe.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Oe.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Oe.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Oe.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Oe.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"&&ut.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)}}Jl.create=t=>new Jl({checks:[],typeName:qe.ZodNumber,coerce:t?.coerce||!1,...Ye(t)});class od extends ot{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)!==Re.bigint)return this._getInvalidInput(e);let r;const i=new wr;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),ke(r,{code:fe.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),ke(r,{code:fe.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),ke(r,{code:fe.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):ut.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return ke(n,{code:fe.invalid_type,expected:Re.bigint,received:n.parsedType}),Fe}gte(e,n){return this.setLimit("min",e,!0,Oe.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Oe.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Oe.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Oe.toString(n))}setLimit(e,n,r,i){return new od({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Oe.toString(i)}]})}_addCheck(e){return new od({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Oe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Oe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Oe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Oe.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Oe.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}}od.create=t=>new od({checks:[],typeName:qe.ZodBigInt,coerce:t?.coerce??!1,...Ye(t)});class Jb extends ot{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Re.boolean){const r=this._getOrReturnCtx(e);return ke(r,{code:fe.invalid_type,expected:Re.boolean,received:r.parsedType}),Fe}return Vr(e.data)}}Jb.create=t=>new Jb({typeName:qe.ZodBoolean,coerce:t?.coerce||!1,...Ye(t)});class gp extends ot{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Re.date){const s=this._getOrReturnCtx(e);return ke(s,{code:fe.invalid_type,expected:Re.date,received:s.parsedType}),Fe}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return ke(s,{code:fe.invalid_date}),Fe}const r=new wr;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),ke(i,{code:fe.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),ke(i,{code:fe.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):ut.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new gp({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Oe.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Oe.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}}gp.create=t=>new gp({checks:[],coerce:t?.coerce||!1,typeName:qe.ZodDate,...Ye(t)});class RT extends ot{_parse(e){if(this._getType(e)!==Re.symbol){const r=this._getOrReturnCtx(e);return ke(r,{code:fe.invalid_type,expected:Re.symbol,received:r.parsedType}),Fe}return Vr(e.data)}}RT.create=t=>new RT({typeName:qe.ZodSymbol,...Ye(t)});class MT extends ot{_parse(e){if(this._getType(e)!==Re.undefined){const r=this._getOrReturnCtx(e);return ke(r,{code:fe.invalid_type,expected:Re.undefined,received:r.parsedType}),Fe}return Vr(e.data)}}MT.create=t=>new MT({typeName:qe.ZodUndefined,...Ye(t)});class OT extends ot{_parse(e){if(this._getType(e)!==Re.null){const r=this._getOrReturnCtx(e);return ke(r,{code:fe.invalid_type,expected:Re.null,received:r.parsedType}),Fe}return Vr(e.data)}}OT.create=t=>new OT({typeName:qe.ZodNull,...Ye(t)});class NT extends ot{constructor(){super(...arguments),this._any=!0}_parse(e){return Vr(e.data)}}NT.create=t=>new NT({typeName:qe.ZodAny,...Ye(t)});class DT extends ot{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Vr(e.data)}}DT.create=t=>new DT({typeName:qe.ZodUnknown,...Ye(t)});class Co extends ot{_parse(e){const n=this._getOrReturnCtx(e);return ke(n,{code:fe.invalid_type,expected:Re.never,received:n.parsedType}),Fe}}Co.create=t=>new Co({typeName:qe.ZodNever,...Ye(t)});class IT extends ot{_parse(e){if(this._getType(e)!==Re.undefined){const r=this._getOrReturnCtx(e);return ke(r,{code:fe.invalid_type,expected:Re.void,received:r.parsedType}),Fe}return Vr(e.data)}}IT.create=t=>new IT({typeName:qe.ZodVoid,...Ye(t)});class xi extends ot{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==Re.array)return ke(n,{code:fe.invalid_type,expected:Re.array,received:n.parsedType}),Fe;if(i.exactLength!==null){const a=n.data.length>i.exactLength.value,c=n.data.length<i.exactLength.value;(a||c)&&(ke(n,{code:a?fe.too_big:fe.too_small,minimum:c?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(ke(n,{code:fe.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(ke(n,{code:fe.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,c)=>i.type._parseAsync(new ko(n,a,n.path,c)))).then(a=>wr.mergeArray(r,a));const s=[...n.data].map((a,c)=>i.type._parseSync(new ko(n,a,n.path,c)));return wr.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new xi({...this._def,minLength:{value:e,message:Oe.toString(n)}})}max(e,n){return new xi({...this._def,maxLength:{value:e,message:Oe.toString(n)}})}length(e,n){return new xi({...this._def,exactLength:{value:e,message:Oe.toString(n)}})}nonempty(e){return this.min(1,e)}}xi.create=(t,e)=>new xi({type:t,minLength:null,maxLength:null,exactLength:null,typeName:qe.ZodArray,...Ye(e)});function Ll(t){if(t instanceof sn){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=go.create(Ll(r))}return new sn({...t._def,shape:()=>e})}else return t instanceof xi?new xi({...t._def,type:Ll(t.element)}):t instanceof go?go.create(Ll(t.unwrap())):t instanceof tc?tc.create(Ll(t.unwrap())):t instanceof ka?ka.create(t.items.map(e=>Ll(e))):t}class sn extends ot{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=ut.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Re.object){const f=this._getOrReturnCtx(e);return ke(f,{code:fe.invalid_type,expected:Re.object,received:f.parsedType}),Fe}const{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),c=[];if(!(this._def.catchall instanceof Co&&this._def.unknownKeys==="strip"))for(const f in i.data)a.includes(f)||c.push(f);const u=[];for(const f of a){const p=s[f],m=i.data[f];u.push({key:{status:"valid",value:f},value:p._parse(new ko(i,m,i.path,f)),alwaysSet:f in i.data})}if(this._def.catchall instanceof Co){const f=this._def.unknownKeys;if(f==="passthrough")for(const p of c)u.push({key:{status:"valid",value:p},value:{status:"valid",value:i.data[p]}});else if(f==="strict")c.length>0&&(ke(i,{code:fe.unrecognized_keys,keys:c}),r.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const p of c){const m=i.data[p];u.push({key:{status:"valid",value:p},value:f._parse(new ko(i,m,i.path,p)),alwaysSet:p in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const f=[];for(const p of u){const m=await p.key,g=await p.value;f.push({key:m,value:g,alwaysSet:p.alwaysSet})}return f}).then(f=>wr.mergeObjectSync(r,f)):wr.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(e){return Oe.errToObj,new sn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{const i=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:Oe.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new sn({...this._def,unknownKeys:"strip"})}passthrough(){return new sn({...this._def,unknownKeys:"passthrough"})}extend(e){return new sn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new sn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:qe.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new sn({...this._def,catchall:e})}pick(e){const n={};for(const r of ut.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new sn({...this._def,shape:()=>n})}omit(e){const n={};for(const r of ut.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new sn({...this._def,shape:()=>n})}deepPartial(){return Ll(this)}partial(e){const n={};for(const r of ut.objectKeys(this.shape)){const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new sn({...this._def,shape:()=>n})}required(e){const n={};for(const r of ut.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof go;)s=s._def.innerType;n[r]=s}return new sn({...this._def,shape:()=>n})}keyof(){return rO(ut.objectKeys(this.shape))}}sn.create=(t,e)=>new sn({shape:()=>t,unknownKeys:"strip",catchall:Co.create(),typeName:qe.ZodObject,...Ye(e)});sn.strictCreate=(t,e)=>new sn({shape:()=>t,unknownKeys:"strict",catchall:Co.create(),typeName:qe.ZodObject,...Ye(e)});sn.lazycreate=(t,e)=>new sn({shape:t,unknownKeys:"strip",catchall:Co.create(),typeName:qe.ZodObject,...Ye(e)});class yp extends ot{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function i(s){for(const c of s)if(c.result.status==="valid")return c.result;for(const c of s)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const a=s.map(c=>new ys(c.ctx.common.issues));return ke(n,{code:fe.invalid_union,unionErrors:a}),Fe}if(n.common.async)return Promise.all(r.map(async s=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(i);{let s;const a=[];for(const u of r){const f={...n,common:{...n.common,issues:[]},parent:null},p=u._parseSync({data:n.data,path:n.path,parent:f});if(p.status==="valid")return p;p.status==="dirty"&&!s&&(s={result:p,ctx:f}),f.common.issues.length&&a.push(f.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const c=a.map(u=>new ys(u));return ke(n,{code:fe.invalid_union,unionErrors:c}),Fe}}get options(){return this._def.options}}yp.create=(t,e)=>new yp({options:t,typeName:qe.ZodUnion,...Ye(e)});function Qb(t,e){const n=Js(t),r=Js(e);if(t===e)return{valid:!0,data:t};if(n===Re.object&&r===Re.object){const i=ut.objectKeys(e),s=ut.objectKeys(t).filter(c=>i.indexOf(c)!==-1),a={...t,...e};for(const c of s){const u=Qb(t[c],e[c]);if(!u.valid)return{valid:!1};a[c]=u.data}return{valid:!0,data:a}}else if(n===Re.array&&r===Re.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let s=0;s<t.length;s++){const a=t[s],c=e[s],u=Qb(a,c);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return n===Re.date&&r===Re.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class vp extends ot{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=(s,a)=>{if(TT(s)||TT(a))return Fe;const c=Qb(s.value,a.value);return c.valid?((_T(s)||_T(a))&&n.dirty(),{status:n.value,value:c.data}):(ke(r,{code:fe.invalid_intersection_types}),Fe)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,a])=>i(s,a)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}vp.create=(t,e,n)=>new vp({left:t,right:e,typeName:qe.ZodIntersection,...Ye(n)});class ka extends ot{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Re.array)return ke(r,{code:fe.invalid_type,expected:Re.array,received:r.parsedType}),Fe;if(r.data.length<this._def.items.length)return ke(r,{code:fe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Fe;!this._def.rest&&r.data.length>this._def.items.length&&(ke(r,{code:fe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((a,c)=>{const u=this._def.items[c]||this._def.rest;return u?u._parse(new ko(r,a,r.path,c)):null}).filter(a=>!!a);return r.common.async?Promise.all(s).then(a=>wr.mergeArray(n,a)):wr.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new ka({...this._def,rest:e})}}ka.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ka({items:t,typeName:qe.ZodTuple,rest:null,...Ye(e)})};class LT extends ot{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!==Re.map)return ke(r,{code:fe.invalid_type,expected:Re.map,received:r.parsedType}),Fe;const i=this._def.keyType,s=this._def.valueType,a=[...r.data.entries()].map(([c,u],f)=>({key:i._parse(new ko(r,c,r.path,[f,"key"])),value:s._parse(new ko(r,u,r.path,[f,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const u of a){const f=await u.key,p=await u.value;if(f.status==="aborted"||p.status==="aborted")return Fe;(f.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(f.value,p.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const u of a){const f=u.key,p=u.value;if(f.status==="aborted"||p.status==="aborted")return Fe;(f.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(f.value,p.value)}return{status:n.value,value:c}}}}LT.create=(t,e,n)=>new LT({valueType:e,keyType:t,typeName:qe.ZodMap,...Ye(n)});class ad extends ot{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Re.set)return ke(r,{code:fe.invalid_type,expected:Re.set,received:r.parsedType}),Fe;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(ke(r,{code:fe.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(ke(r,{code:fe.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function a(u){const f=new Set;for(const p of u){if(p.status==="aborted")return Fe;p.status==="dirty"&&n.dirty(),f.add(p.value)}return{status:n.value,value:f}}const c=[...r.data.values()].map((u,f)=>s._parse(new ko(r,u,r.path,f)));return r.common.async?Promise.all(c).then(u=>a(u)):a(c)}min(e,n){return new ad({...this._def,minSize:{value:e,message:Oe.toString(n)}})}max(e,n){return new ad({...this._def,maxSize:{value:e,message:Oe.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}ad.create=(t,e)=>new ad({valueType:t,minSize:null,maxSize:null,typeName:qe.ZodSet,...Ye(e)});class zT extends ot{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})}}zT.create=(t,e)=>new zT({getter:t,typeName:qe.ZodLazy,...Ye(e)});class PT extends ot{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return ke(n,{received:n.data,code:fe.invalid_literal,expected:this._def.value}),Fe}return{status:"valid",value:e.data}}get value(){return this._def.value}}PT.create=(t,e)=>new PT({value:t,typeName:qe.ZodLiteral,...Ye(e)});function rO(t,e){return new Ql({values:t,typeName:qe.ZodEnum,...Ye(e)})}class Ql extends ot{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return ke(n,{expected:ut.joinValues(r),received:n.parsedType,code:fe.invalid_type}),Fe}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 ke(n,{received:n.data,code:fe.invalid_enum_value,options:r}),Fe}return Vr(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 Ql.create(e,{...this._def,...n})}exclude(e,n=this._def){return Ql.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}Ql.create=rO;class jT extends ot{_parse(e){const n=ut.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Re.string&&r.parsedType!==Re.number){const i=ut.objectValues(n);return ke(r,{expected:ut.joinValues(i),received:r.parsedType,code:fe.invalid_type}),Fe}if(this._cache||(this._cache=new Set(ut.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=ut.objectValues(n);return ke(r,{received:r.data,code:fe.invalid_enum_value,options:i}),Fe}return Vr(e.data)}get enum(){return this._def.values}}jT.create=(t,e)=>new jT({values:t,typeName:qe.ZodNativeEnum,...Ye(e)});class bp extends ot{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Re.promise&&n.common.async===!1)return ke(n,{code:fe.invalid_type,expected:Re.promise,received:n.parsedType}),Fe;const r=n.parsedType===Re.promise?n.data:Promise.resolve(n.data);return Vr(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}bp.create=(t,e)=>new bp({type:t,typeName:qe.ZodPromise,...Ye(e)});class ec extends ot{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===qe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:a=>{ke(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const a=i.transform(r.data,s);if(r.common.async)return Promise.resolve(a).then(async c=>{if(n.value==="aborted")return Fe;const u=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return u.status==="aborted"?Fe:u.status==="dirty"||n.value==="dirty"?Ru(u.value):u});{if(n.value==="aborted")return Fe;const c=this._def.schema._parseSync({data:a,path:r.path,parent:r});return c.status==="aborted"?Fe:c.status==="dirty"||n.value==="dirty"?Ru(c.value):c}}if(i.type==="refinement"){const a=c=>{const u=i.refinement(c,s);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Fe:(c.status==="dirty"&&n.dirty(),a(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?Fe:(c.status==="dirty"&&n.dirty(),a(c.value).then(()=>({status:n.value,value:c.value}))))}if(i.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Xl(a))return Fe;const c=i.transform(a.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>Xl(a)?Promise.resolve(i.transform(a.value,s)).then(c=>({status:n.value,value:c})):Fe);ut.assertNever(i)}}ec.create=(t,e,n)=>new ec({schema:t,typeName:qe.ZodEffects,effect:e,...Ye(n)});ec.createWithPreprocess=(t,e,n)=>new ec({schema:e,effect:{type:"preprocess",transform:t},typeName:qe.ZodEffects,...Ye(n)});class go extends ot{_parse(e){return this._getType(e)===Re.undefined?Vr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}go.create=(t,e)=>new go({innerType:t,typeName:qe.ZodOptional,...Ye(e)});class tc extends ot{_parse(e){return this._getType(e)===Re.null?Vr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}tc.create=(t,e)=>new tc({innerType:t,typeName:qe.ZodNullable,...Ye(e)});class e0 extends ot{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===Re.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}e0.create=(t,e)=>new e0({innerType:t,typeName:qe.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ye(e)});class t0 extends ot{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return mp(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ys(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ys(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}t0.create=(t,e)=>new t0({innerType:t,typeName:qe.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ye(e)});class BT extends ot{_parse(e){if(this._getType(e)!==Re.nan){const r=this._getOrReturnCtx(e);return ke(r,{code:fe.invalid_type,expected:Re.nan,received:r.parsedType}),Fe}return{status:"valid",value:e.data}}}BT.create=t=>new BT({typeName:qe.ZodNaN,...Ye(t)});class tH extends ot{_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 FS extends ot{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Fe:s.status==="dirty"?(n.dirty(),Ru(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Fe:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new FS({in:e,out:n,typeName:qe.ZodPipeline})}}class n0 extends ot{_parse(e){const n=this._def.innerType._parse(e),r=i=>(Xl(i)&&(i.value=Object.freeze(i.value)),i);return mp(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}n0.create=(t,e)=>new n0({innerType:t,typeName:qe.ZodReadonly,...Ye(e)});var qe;(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"})(qe||(qe={}));const $T=co.create,nH=Jl.create,rH=Jb.create;Co.create;const iH=xi.create,sH=sn.create;yp.create;vp.create;ka.create;Ql.create;bp.create;go.create;tc.create;const oH=/(description|body|content|summary|bio|copy|caption|details)/i;function iO(t,e){if(e?.type==="richtext")return!0;const n=`${t} ${e?.label??""}`;return oH.test(n)}function VT(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 ld(t){return/^https?:\/\//i.test(t)||t.startsWith("//")}function nc(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 sO(t){if(typeof t=="string"&&ld(t))return{url:t};if(t&&typeof t=="object"&&"url"in t){const e=t.url,n=t.name;if(typeof e=="string"&&ld(e))return{url:e,name:typeof n=="string"?n:void 0}}return null}function aH(t,e){const n=[];for(const[r,i]of Object.entries(t)){if(!nc(r,i))continue;const s=i.label?.trim()||r,a=e?.[r],c=Array.isArray(a)?a:[a];c.forEach((u,f)=>{const p=sO(u);p&&n.push({id:`${r}:${f}`,url:p.url,name:p.name||(c.length>1?`${s} ${f+1}`:s),field:r})})}return n}function HT(t){const e=Array.isArray(t)?t:t==null||t===""?[]:[t],n=[];for(const r of e){const i=sO(r);i&&n.push(i.url)}return n}const UT=["Details","Content","Pricing","Inventory","Media","Status"];function lH(t){const e={};for(const[n,r]of Object.entries(t)){let i;switch(r.type){case"number":i=nH(),r.min!=null&&(i=i.min(r.min)),r.max!=null&&(i=i.max(r.max));break;case"boolean":i=rH();break;case"file[]":i=iH($T());break;default:i=$T()}r.required||(i=i.optional()),e[n]=i}return sH(e)}function oO(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim()}function cH(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function uH(t,e){const n=`${t} ${e?.label??""}`;return/(stock|inventory|qty|quantity)/i.test(n)}function dH(t,e,n){if(e.type==="boolean"||e.type==="richtext"||iO(t,e)||n==="record"&&nc(t,e))return"full"}function fH(t,e){if(e.group?.trim())return e.group.trim();const r=(e.label?.trim()||oO(t)).split(/\s+/).filter(Boolean);return r.length>=2?r[0]:"General"}function hH(t,e){if(e.group?.trim())return e.group.trim();const n=t.toLowerCase(),r=(e.label??"").toLowerCase(),i=`${n} ${r}`;return/(image|img|photo|avatar|thumbnail|thumb|cover|media_url)/i.test(i)?"Media":/(price|cost|cents|amount|msrp)/i.test(i)?"Pricing":/(stock|inventory|qty|quantity)/i.test(i)?"Inventory":e.type==="boolean"||/(^|_)(active|enabled|published|status|visible)(_|$)/i.test(n)||/^(active|enabled|published|status|visible)$/i.test(r)?"Status":e.type==="richtext"||/(description|body|content|summary|bio)/i.test(i)?"Content":"Details"}function pH(t,e,n){const r=e.label?.trim()||oO(t),i=r.replace(new RegExp(`^${cH(n)}\\s+`,"i"),"");if(/^inventory$/i.test(n)){const s=r.replace(/^stock\s+/i,"").trim();if(s&&s!==r)return s}return/^pricing$/i.test(n)&&/cents/i.test(r)?r.replace(/\s*\(cents\)/i,"").trim()||r:i||r}function mH(t,e){if(e!=="record")return t;const n=r=>{const i=UT.indexOf(r);return i===-1?UT.length+1:i};return[...t].sort((r,i)=>n(r.id)-n(i.id))}function gH(t,e){const n=[],r=new Map,i=new Set;for(const a of Object.entries(t)){const[c,u]=a,f=e==="record"?hH(c,u):fH(c,u);u.group?.trim()&&i.add(f),r.has(f)||(r.set(f,[]),n.push(f)),r.get(f).push(a)}if(e==="config")for(const[a,c]of[...r.entries()]){if(c.length>1||i.has(a)||a==="General")continue;r.has("General")||(r.set("General",[]),n.unshift("General")),r.get("General").push(...c),r.delete(a);const u=n.indexOf(a);u>=0&&n.splice(u,1)}const s=n.filter(a=>r.has(a)).map(a=>({id:a,label:a,fields:r.get(a)}));return mH(s,e)}function Sp(t){const e=Array.isArray(t)?t:[t];for(const n of e){if(typeof n=="string"&&ld(n))return n;if(n&&typeof n=="object"&&"url"in n){const r=n.url;if(typeof r=="string"&&ld(r))return r}}return null}function yH(t,e){for(const[n,r]of Object.entries(t))if(nc(n,r)&&Sp(e?.[n]))return n;for(const[n,r]of Object.entries(t))if(nc(n,r))return n;return null}function vH(t){return t.join(",")}function Dd({meta:t,disabled:e,multiple:n=!1,label:r,onUpload:i}){const s=R.useRef(null),[a,c]=R.useState(!1),[u,f]=R.useState(null),[p,m]=R.useState(!1),g=async y=>{if(!y||e||a)return;const b=Array.from(y);if(b.length){c(!0),f(null);try{await i(n?b:b.slice(0,1))}catch(w){f(w instanceof Error?w.message:"Upload failed")}finally{c(!1),s.current&&(s.current.value="")}}};return E.jsxs("div",{className:"vertebr-upload",children:[E.jsxs("div",{className:"vertebr-upload-drop","data-busy":a?"true":void 0,"data-drag":p?"true":void 0,onDragEnter:y=>{y.preventDefault(),m(!0)},onDragOver:y=>{y.preventDefault(),m(!0)},onDragLeave:y=>{y.preventDefault(),m(!1)},onDrop:y=>{y.preventDefault(),m(!1),g(y.dataTransfer.files)},children:[E.jsx("p",{className:"vertebr-upload-copy",children:a?"Uploading…":r??(n?"Drop images here or browse":"Drop an image here or browse")}),E.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:e||a,onClick:()=>s.current?.click(),children:n?"Choose images":"Choose image"}),E.jsx("input",{ref:s,type:"file",accept:vH(t.accept),multiple:n,hidden:!0,onChange:y=>{g(y.target.files)}})]}),u?E.jsx("p",{className:"vertebr-upload-error",role:"alert",children:u}):null]})}var pc=RR();const bH=AR(pc);var SH=Object.defineProperty,qS=(t,e)=>SH(t,"name",{value:e,configurable:!0});function r0(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}qS(r0,"setRef");function aO(...t){return e=>{let n=!1;const r=t.map(i=>{const s=r0(i,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():r0(t[i],null)}}}}qS(aO,"composeRefs");function Xt(...t){return R.useCallback(aO(...t),t)}qS(Xt,"useComposedRefs");var wH=Object.defineProperty,ai=(t,e)=>wH(t,"name",{value:e,configurable:!0});function Ca(t){const e=R.forwardRef((n,r)=>{let{children:i,...s}=n,a=null,c=!1;const u=[];i0(i)&&typeof dh=="function"&&(i=dh(i._payload)),R.Children.forEach(i,g=>{if(dO(g)){c=!0;const y=g;let b="child"in y.props?y.props.child:y.props.children;i0(b)&&typeof dh=="function"&&(b=dh(b._payload)),a=kH(y,b),u.push(a?.props?.children)}else u.push(g)}),a?a=R.cloneElement(a,void 0,u):!c&&R.Children.count(i)===1&&R.isValidElement(i)&&(a=i);const f=a?uO(a):void 0,p=Xt(r,f);if(!a){if(i||i===0)throw new Error(c?TH(t):EH(t));return i}const m=cO(s,a.props??{});return a.type!==R.Fragment&&(m.ref=r?p:f),R.cloneElement(a,m)});return e.displayName=`${t}.Slot`,e}ai(Ca,"createSlot");var lO=Symbol.for("radix.slottable");function xH(t){const e=ai(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=lO,e}ai(xH,"createSlottable");var kH=ai((t,e)=>{if("child"in t.props){const n=t.props.child;return R.isValidElement(n)?R.cloneElement(n,void 0,t.props.children(n.props.children)):null}return R.isValidElement(e)?e:null},"getSlottableElementFromSlottable");function cO(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...c)=>{const u=s(...c);return i(...c),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}ai(cO,"mergeProps");function uO(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)}ai(uO,"getElementRef");function dO(t){return R.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===lO}ai(dO,"isSlottable");var CH=Symbol.for("react.lazy");function i0(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===CH&&"_payload"in t&&fO(t._payload)}ai(i0,"isLazyComponent");function fO(t){return typeof t=="object"&&t!==null&&"then"in t}ai(fO,"isPromiseLike");var EH=ai(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),TH=ai(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),dh=kd[" use ".trim().toString()],_H=Object.defineProperty,AH=(t,e)=>_H(t,"name",{value:e,configurable:!0}),RH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],vn=RH.reduce((t,e)=>{const n=Ca(`Primitive.${e}`),r=R.forwardRef((i,s)=>{const{asChild:a,...c}=i,u=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),E.jsx(u,{...c,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function hO(t,e){t&&pc.flushSync(()=>t.dispatchEvent(e))}AH(hO,"dispatchDiscreteCustomEvent");var MH=Object.defineProperty,OH=(t,e)=>MH(t,"name",{value:e,configurable:!0}),NH=R.forwardRef(OH(function(e,n){return E.jsx(vn.label,{...e,ref:n,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}})},"Label")),FT=NH,DH=Object.defineProperty,mc=(t,e)=>DH(t,"name",{value:e,configurable:!0}),pO=!!(typeof window<"u"&&window.document&&window.document.createElement);function on(t,e,{checkForDefaultPrevented:n=!0}={}){return mc(function(i){if(t?.(i),n===!1||!i||!i.defaultPrevented)return e?.(i)},"handleEvent")}mc(on,"composeEventHandlers");function IH(t){if(!pO)throw new Error("Cannot access window outside of the DOM");return t?.ownerDocument?.defaultView??window}mc(IH,"getOwnerWindow");function s0(t){if(!pO)throw new Error("Cannot access document outside of the DOM");return t?.ownerDocument??document}mc(s0,"getOwnerDocument");function mO(t,e=!1){const{activeElement:n}=s0(t);if(!n?.nodeName)return null;if(gO(n)&&n.contentDocument)return mO(n.contentDocument.body,e);if(e){const r=n.getAttribute("aria-activedescendant");if(r){const i=s0(n).getElementById(r);if(i)return i}}return n}mc(mO,"getActiveElement");function gO(t){return t.tagName==="IFRAME"}mc(gO,"isFrame");var LH=Object.defineProperty,zr=(t,e)=>LH(t,"name",{value:e,configurable:!0});function zH(t,e){const n=R.createContext(e);n.displayName=t+"Context";const r=zr(s=>{const{children:a,...c}=s,u=R.useMemo(()=>c,Object.values(c));return E.jsx(n.Provider,{value:u,children:a})},"Provider");r.displayName=t+"Provider";function i(s,a={}){const{optional:c=!1}=a,u=R.useContext(n);if(u)return u;if(e!==void 0)return e;if(!c)throw new Error(`\`${s}\` must be used within \`${t}\``)}return zr(i,"useContext"),[r,i]}zr(zH,"createContext");function gc(t,e=[]){let n=[];function r(s,a){const c=R.createContext(a);c.displayName=s+"Context";const u=n.length;n=[...n,a];const f=zr(m=>{const{scope:g,children:y,...b}=m,w=g?.[t]?.[u]||c,x=R.useMemo(()=>b,Object.values(b));return E.jsx(w.Provider,{value:x,children:y})},"Provider");f.displayName=s+"Provider";function p(m,g,y={}){const{optional:b=!1}=y,w=g?.[t]?.[u]||c,x=R.useContext(w);if(x)return x;if(a!==void 0)return a;if(!b)throw new Error(`\`${m}\` must be used within \`${s}\``)}return zr(p,"useContext"),[f,p]}zr(r,"createContext");const i=zr(()=>{const s=n.map(a=>R.createContext(a));return zr(function(c){const u=c?.[t]||s;return R.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])},"useScope")},"createScope");return i.scopeName=t,[r,yO(i,...e)]}zr(gc,"createContextScope");function yO(...t){const e=t[0];if(t.length===1)return e;const n=zr(()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return zr(function(s){const a=r.reduce((c,{useScope:u,scopeName:f})=>{const m=u(s)[`__scope${f}`];return{...c,...m}},{});return R.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=e.scopeName,n}zr(yO,"composeContextScopes");var Gn=globalThis?.document?R.useLayoutEffect:()=>{},PH=Object.defineProperty,jH=(t,e)=>PH(t,"name",{value:e,configurable:!0}),qT=kd[" useEffectEvent ".trim().toString()],GT=kd[" useInsertionEffect ".trim().toString()];function vO(t){if(typeof qT=="function")return qT(t);const e=R.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof GT=="function"?GT(()=>{e.current=t}):Gn(()=>{e.current=t}),R.useMemo(()=>((...n)=>e.current?.(...n)),[])}jH(vO,"useEffectEvent");var BH=Object.defineProperty,Id=(t,e)=>BH(t,"name",{value:e,configurable:!0}),$H=kd[" useInsertionEffect ".trim().toString()]||Gn;function wp({prop:t,defaultProp:e,onChange:n=Id(()=>{},"onChange"),caller:r}){const[i,s,a]=bO({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:i,f=R.useCallback(p=>{if(c){const m=SO(p)?p(t):p;m!==t&&a.current?.(m)}else s(p)},[c,t,s,a]);return[u,f]}Id(wp,"useControllableState");function bO({defaultProp:t,onChange:e}){const[n,r]=R.useState(t),i=R.useRef(n),s=R.useRef(e);return $H(()=>{s.current=e},[e]),R.useEffect(()=>{i.current!==n&&(s.current?.(n),i.current=n)},[n,i]),[n,r,s]}Id(bO,"useUncontrolledState");function SO(t){return typeof t=="function"}Id(SO,"isFunction");var WT=Symbol("RADIX:SYNC_STATE");function VH(t,e,n,r){const{prop:i,defaultProp:s,onChange:a,caller:c}=e,u=i!==void 0,f=vO(a),p=[{...n,state:s}];r&&p.push(r);const[m,g]=R.useReducer((x,k)=>{if(k.type===WT)return{...x,state:k.state};const T=t(x,k);return u&&!Object.is(T.state,x.state)&&f(T.state),T},...p),y=m.state,b=R.useRef(y);R.useEffect(()=>{b.current!==y&&(b.current=y,u||f(y))},[y,b,u]);const w=R.useMemo(()=>i!==void 0?{...m,state:i}:m,[m,i]);return R.useEffect(()=>{u&&!Object.is(i,m.state)&&g({type:WT,state:i})},[i,m.state,u]),[w,g]}Id(VH,"useControllableStateReducer");var HH=Object.defineProperty,UH=(t,e)=>HH(t,"name",{value:e,configurable:!0});function GS(t){const[e,n]=R.useState(void 0);return Gn(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let a,c;if("borderBoxSize"in s){const u=s.borderBoxSize,f=Array.isArray(u)?u[0]:u;a=f.inlineSize,c=f.blockSize}else a=t.offsetWidth,c=t.offsetHeight;n({width:a,height:c})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}UH(GS,"useSize");var FH=Object.defineProperty,Eo=(t,e)=>FH(t,"name",{value:e,configurable:!0}),WS="Switch",[qH,FJ]=gc(WS),[GH,KS]=qH(WS);function wO(t){const{__scopeSwitch:e,checked:n,children:r,defaultChecked:i,disabled:s,form:a,name:c,onCheckedChange:u,required:f,value:p="on",internal_do_not_use_render:m}=t,[g,y]=wp({prop:n,defaultProp:i??!1,onChange:u,caller:WS}),[b,w]=R.useState(null),[x,k]=R.useState(null),T=R.useRef(!1),[A,_]=R.useReducer(I=>I+1,0),O=b?!!a||!!b.closest("form"):!0,N={checked:g,setChecked:y,disabled:s,control:b,setControl:w,name:c,form:a,value:p,hasConsumerStoppedPropagationRef:T,userInteractionCount:A,onUserInteraction:_,required:f,defaultChecked:i,isFormControl:O,bubbleInput:x,setBubbleInput:k};return E.jsx(GH,{scope:e,...N,children:xO(m)?m(N):r})}Eo(wO,"SwitchProvider");var WH="SwitchTrigger",KH=R.forwardRef(Eo(function({__scopeSwitch:e,onClick:n,...r},i){const{control:s,form:a,value:c,disabled:u,checked:f,required:p,setControl:m,setChecked:g,hasConsumerStoppedPropagationRef:y,onUserInteraction:b,isFormControl:w,bubbleInput:x}=KS(WH,e),k=Xt(i,m),T=R.useRef(f);return R.useEffect(()=>{const A=a?s?.ownerDocument.getElementById(a):s?.form;if(A instanceof HTMLFormElement){const _=Eo(()=>g(T.current),"reset");return A.addEventListener("reset",_),()=>A.removeEventListener("reset",_)}},[s,a,g]),E.jsx(vn.button,{type:"button",role:"switch","aria-checked":f,"aria-required":p,"data-state":ZS(f),"data-disabled":u?"":void 0,disabled:u,value:c,...r,ref:k,onClick:on(n,A=>{b(),g(_=>!_),x&&w&&(y.current=A.isPropagationStopped(),y.current||A.stopPropagation())})})},"SwitchTrigger")),ZH=R.forwardRef(Eo(function(e,n){const{__scopeSwitch:r,name:i,checked:s,defaultChecked:a,required:c,disabled:u,value:f,onCheckedChange:p,form:m,...g}=e;return E.jsx(wO,{__scopeSwitch:r,checked:s,defaultChecked:a,disabled:u,required:c,onCheckedChange:p,name:i,form:m,value:f,internal_do_not_use_render:({isFormControl:y})=>E.jsxs(E.Fragment,{children:[E.jsx(KH,{...g,ref:n,__scopeSwitch:r}),y&&E.jsx(QH,{__scopeSwitch:r})]})})},"Switch")),YH="SwitchThumb",XH=R.forwardRef(Eo(function(e,n){const{__scopeSwitch:r,...i}=e,s=KS(YH,r);return E.jsx(vn.span,{"data-state":ZS(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:n})},"SwitchThumb")),JH="SwitchBubbleInput",QH=R.forwardRef(Eo(function({__scopeSwitch:e,onClick:n,...r},i){const{control:s,hasConsumerStoppedPropagationRef:a,userInteractionCount:c,checked:u,defaultChecked:f,required:p,disabled:m,name:g,value:y,form:b,bubbleInput:w,setBubbleInput:x}=KS(JH,e),k=Xt(i,x),T=GS(s),A=R.useRef(!1),_=R.useRef(u),O=R.useRef(c);R.useEffect(()=>{const I=w;if(!I)return;const j=window.HTMLInputElement.prototype,Y=Object.getOwnPropertyDescriptor(j,"checked").set,ce=c!==O.current;O.current=c;const X=_.current!==u;_.current=u;const te=!(ce&&a.current);if(X&&Y){A.current=!ce;const ie=new Event("click",{bubbles:te});Y.call(I,u),I.dispatchEvent(ie),A.current=!1}},[w,u,a,c]);const N=R.useRef(u);return E.jsx(vn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??N.current,required:p,disabled:m,name:g,value:y,form:b,...r,tabIndex:-1,ref:k,onClick:on(n,I=>{A.current&&I.stopPropagation()}),style:{...r.style,...T,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function xO(t){return typeof t=="function"}Eo(xO,"isFunction");function ZS(t){return t?"checked":"unchecked"}Eo(ZS,"getState");const eU=/(cents|priceCents|amountCents)/i,KT=/(price|amount|cost|total|msrp)/i;function YS(t,e){return eU.test(t)||/cents/i.test(e?.label??"")}function kO(t,e){return YS(t,e)?!0:KT.test(t)||KT.test(e?.label??"")}function CO(t,e){return e?t/100:t}function tU(t,e){return e?Math.round(t*100):t}function o0(t,e){const n=e?.asCents??!0,r=e?.currency??"USD",i=CO(t,n);try{return new Intl.NumberFormat(void 0,{style:"currency",currency:r,minimumFractionDigits:2,maximumFractionDigits:2}).format(i)}catch{return`$${i.toFixed(2)}`}}function Nv(t,e=!0){return typeof t!="number"||!Number.isFinite(t)?"":CO(t,e).toFixed(2)}function nU(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 tU(r,e)}var Dv={exports:{}},Iv={};var ZT;function rU(){if(ZT)return Iv;ZT=1;var t=xd();function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,a=t.useDebugValue;function c(m,g){var y=g(),b=r({inst:{value:y,getSnapshot:g}}),w=b[0].inst,x=b[1];return s(function(){w.value=y,w.getSnapshot=g,u(w)&&x({inst:w})},[m,y,g]),i(function(){return u(w)&&x({inst:w}),m(function(){u(w)&&x({inst:w})})},[m]),a(y),y}function u(m){var g=m.getSnapshot;m=m.value;try{var y=g();return!n(m,y)}catch{return!0}}function f(m,g){return g()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return Iv.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:p,Iv}var YT;function EO(){return YT||(YT=1,Dv.exports=rU()),Dv.exports}var TO=EO();function _n(t){this.content=t}_n.prototype={constructor:_n,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new _n(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new _n(n)},addToStart:function(t,e){return new _n([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new _n(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new _n(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=_n.from(t),t.size?new _n(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=_n.from(t),t.size?new _n(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=_n.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}};_n.from=function(t){if(t instanceof _n)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new _n(e)};function _O(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){let a=i.text,c=s.text,u=0;for(;a[u]==c[u];u++)n++;return u&&u<a.length&&u<c.length&&MO(a.charCodeAt(u-1))&&RO(a.charCodeAt(u))&&n--,n}if(i.content.size||s.content.size){let a=_O(i.content,s.content,n+1);if(a!=null)return a}n+=i.nodeSize}}function AO(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let a=t.child(--i),c=e.child(--s),u=a.nodeSize;if(a==c){n-=u,r-=u;continue}if(!a.sameMarkup(c))return{a:n,b:r};if(a.isText&&a.text!=c.text){let f=a.text,p=c.text,m=f.length,g=p.length;for(;m>0&&g>0&&f[m-1]==p[g-1];)m--,g--,n--,r--;return m&&g&&m<f.length&&MO(f.charCodeAt(m-1))&&RO(f.charCodeAt(m))&&(n++,r++),{a:n,b:r}}if(a.content.size||c.content.size){let f=AO(a.content,c.content,n-1,r-1);if(f)return f}n-=u,r-=u}}function RO(t){return t>=56320&&t<57344}function MO(t){return t>=55296&&t<56320}class ne{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let a=0,c=0;c<n;a++){let u=this.content[a],f=c+u.nodeSize;if(f>e&&r(u,i+c,s||null,a)!==!1&&u.content.size){let p=c+1;u.nodesBetween(Math.max(0,e-p),Math.min(u.content.size,n-p),r,i+p)}c=f}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",a=!0;return this.nodesBetween(e,n,(c,u)=>{let f=c.isText?c.text.slice(Math.max(e,u)-u,n-u):c.isLeaf?i?typeof i=="function"?i(c):i:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&f||c.isTextblock)&&r&&(a?a=!1:s+=r),s+=f},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new ne(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,a=0;a<n;s++){let c=this.content[s],u=a+c.nodeSize;u>e&&((a<e||u>n)&&(c.isText?c=c.cut(Math.max(0,e-a),Math.min(c.text.length,n-a)):c=c.cut(Math.max(0,e-a-1),Math.min(c.content.size,n-a-1))),r.push(c),i+=c.nodeSize),a=u}return new ne(r,i)}cutByIndex(e,n){return e==n?ne.empty:e==0&&n==this.content.length?this:new ne(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new ne(i,s)}addToStart(e){return new ne([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ne(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return _O(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return AO(this,e,n,r)}findIndex(e){if(e==0)return fh(0,e);if(e==this.size)return fh(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?fh(n+1,s):fh(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return ne.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return ne.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ne.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new ne(n||e,r)}static from(e){if(!e)return ne.empty;if(e instanceof ne)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ne([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}ne.empty=new ne([],0);const Lv={index:0,offset:0};function fh(t,e){return Lv.index=t,Lv.offset=e,Lv}function xp(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(!xp(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!xp(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Tt=class a0{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&xp(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return a0.none;if(e instanceof a0)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};Tt.none=[];class cd extends Error{}class we{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=NO(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new we(r,this.openStart,this.openEnd)}removeBetween(e,n){return new we(OO(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return we.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new we(ne.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new we(e,r,i)}}we.empty=new we(ne.empty,0,0);function OO(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:a,offset:c}=t.findIndex(n);if(i==e||s.isText){if(c!=n&&!t.child(a).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=a)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(OO(s.content,e-i-1,n-i-1)))}function NO(t,e,n,r,i,s){let{index:a,offset:c}=t.findIndex(e),u=t.maybeChild(a);if(c==e||u.isText)return s&&r<=0&&i<=0&&!s.canReplace(a,a,n)?null:t.cut(0,e).append(n).append(t.cut(e));let f=NO(u.content,e-c-1,n,a==0?r-1:0,a==t.childCount-1?i-1:0,u);return f&&t.replaceChild(a,u.copy(f))}function iU(t,e,n){if(n.openStart>t.depth)throw new cd("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new cd("Inconsistent open depths");return DO(t,e,n,0)}function DO(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let a=DO(t,e,n,r+1);return s.copy(s.content.replaceChild(i,a))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let a=t.parent,c=a.content;return ya(a,c.cut(0,t.parentOffset).append(n.content).append(c.cut(e.parentOffset)))}else{let{start:a,end:c}=sU(n,t);return ya(s,LO(t,a,c,e,r))}else return ya(s,kp(t,e,r))}function IO(t,e){if(!e.type.compatibleContent(t.type))throw new cd("Cannot join "+e.type.name+" onto "+t.type.name)}function l0(t,e,n){let r=t.node(n);return IO(r,e.node(n)),r}function ga(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 Vu(t,e,n,r){let i=(e||t).node(n),s=0,a=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(ga(t.nodeAfter,r),s++));for(let c=s;c<a;c++)ga(i.child(c),r);e&&e.depth==n&&e.textOffset&&ga(e.nodeBefore,r)}function ya(t,e){if(!t.type.validContent(e))throw new cd("Invalid content for node "+t.type.name);return t.copy(e)}function LO(t,e,n,r,i){let s=t.depth>i&&l0(t,e,i+1),a=r.depth>i&&l0(n,r,i+1),c=[];return Vu(null,t,i,c),s&&a&&e.index(i)==n.index(i)?(IO(s,a),ga(ya(s,LO(t,e,n,r,i+1)),c)):(s&&ga(ya(s,kp(t,e,i+1)),c),Vu(e,n,i,c),a&&ga(ya(a,kp(n,r,i+1)),c)),Vu(r,null,i,c),new ne(c)}function kp(t,e,n){let r=[];if(Vu(null,t,n,r),t.depth>n){let i=l0(t,e,n+1);ga(ya(i,kp(t,e,n+1)),r)}return Vu(e,null,n,r),new ne(r)}function sU(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(ne.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class ud{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Tt.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let c=r;r=i,i=c}let s=r.marks;for(var a=0;a<s.length;a++)s[a].type.spec.inclusive===!1&&(!i||!s[a].isInSet(i.marks))&&(s=s[a--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Cp(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let a=e;;){let{index:c,offset:u}=a.content.findIndex(s),f=s-u;if(r.push(a,c,i+u),!f||(a=a.child(c),a.isText))break;s=f-1,i+=u+1}return new ud(n,r,s)}static resolveCached(e,n){let r=XT.get(e);if(r)for(let s=0;s<r.elts.length;s++){let a=r.elts[s];if(a.pos==n)return a}else XT.set(e,r=new oU);let i=r.elts[r.i]=ud.resolve(e,n);return r.i=(r.i+1)%aU,i}}class oU{constructor(){this.elts=[],this.i=0}}const aU=12,XT=new WeakMap;class Cp{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 lU=Object.create(null);let yo=class c0{constructor(e,n,r,i=Tt.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||ne.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&xp(this.attrs,n||e.defaultAttrs||lU)&&Tt.sameSet(this.marks,r||Tt.none)}copy(e=null){return e==this.content?this:new c0(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new c0(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return we.empty;let i=this.resolve(e),s=this.resolve(n),a=r?0:i.sharedDepth(n),c=i.start(a),f=i.node(a).content.cut(i.pos-c,s.pos-c);return new we(f,i.depth-a,s.depth-a)}replace(e,n,r){return iU(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return ud.resolveCached(this,e)}resolveNoCache(e){return ud.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),zO(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=ne.empty,i=0,s=r.childCount){let a=this.contentMatchAt(e).matchFragment(r,i,s),c=a&&a.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=i;u<s;u++)if(!this.type.allowsMarks(r.child(u).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),a=s&&s.matchFragment(this.content,n);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Tt.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(!Tt.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=ne.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};yo.prototype.text=void 0;class Ep extends yo{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):zO(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 Ep(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ep(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 zO(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Ea{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new cU(e,n);if(r.next==null)return Ea.empty;let i=PO(r);r.next&&r.err("Unexpected trailing text");let s=gU(mU(i));return yU(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(a,c){let u=a.matchFragment(e,r);if(u&&(!n||u.validEnd))return ne.from(c.map(f=>f.createAndFill()));for(let f=0;f<a.next.length;f++){let{type:p,next:m}=a.next[f];if(!(p.isText||p.hasRequiredAttrs())&&i.indexOf(m)==-1){i.push(m);let g=s(m,c.concat(p));if(g)return g}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let a=[];for(let c=i;c.type;c=c.via)a.push(c.type);return a.reverse()}for(let a=0;a<s.next.length;a++){let{type:c,next:u}=s.next[a];!c.isLeaf&&!c.hasRequiredAttrs()&&!(c.name in n)&&(!i.type||u.validEnd)&&(r.push({match:c.contentMatch,type:c,via:i}),n[c.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let a=0;a<r.next.length;a++)s+=(a?", ":"")+r.next[a].type.name+"->"+e.indexOf(r.next[a].next);return s}).join(`
|
|
65
|
-
`)}}Ea.empty=new Ea(!0);class cU{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 PO(t){let e=[];do e.push(uU(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function uU(t){let e=[];do e.push(dU(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function dU(t){let e=pU(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=fU(t,e);else break;return e}function JT(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function fU(t,e){let n=JT(t),r=n;return t.eat(",")&&(t.next!="}"?r=JT(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function hU(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let a=n[s];a.isInGroup(e)&&i.push(a)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function pU(t){if(t.eat("(")){let e=PO(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=hU(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 mU(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(a,c,u){let f={term:u,to:c};return e[a].push(f),f}function i(a,c){a.forEach(u=>u.to=c)}function s(a,c){if(a.type=="choice")return a.exprs.reduce((u,f)=>u.concat(s(f,c)),[]);if(a.type=="seq")for(let u=0;;u++){let f=s(a.exprs[u],c);if(u==a.exprs.length-1)return f;i(f,c=n())}else if(a.type=="star"){let u=n();return r(c,u),i(s(a.expr,u),u),[r(u)]}else if(a.type=="plus"){let u=n();return i(s(a.expr,c),u),i(s(a.expr,u),u),[r(u)]}else{if(a.type=="opt")return[r(c)].concat(s(a.expr,c));if(a.type=="range"){let u=c;for(let f=0;f<a.min;f++){let p=n();i(s(a.expr,u),p),u=p}if(a.max==-1)i(s(a.expr,u),u);else for(let f=a.min;f<a.max;f++){let p=n();r(u,p),i(s(a.expr,u),p),u=p}return[r(u)]}else{if(a.type=="name")return[r(c,void 0,a.value)];throw new Error("Unknown expr type")}}}}function jO(t,e){return e-t}function QT(t,e){let n=[];return r(e),n.sort(jO);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let a=0;a<s.length;a++){let{term:c,to:u}=s[a];!c&&n.indexOf(u)==-1&&r(u)}}}function gU(t){let e=Object.create(null);return n(QT(t,0));function n(r){let i=[];r.forEach(a=>{t[a].forEach(({term:c,to:u})=>{if(!c)return;let f;for(let p=0;p<i.length;p++)i[p][0]==c&&(f=i[p][1]);QT(t,u).forEach(p=>{f||i.push([c,f=[]]),f.indexOf(p)==-1&&f.push(p)})})});let s=e[r.join(",")]=new Ea(r.indexOf(t.length-1)>-1);for(let a=0;a<i.length;a++){let c=i[a][1].sort(jO);s.next.push({type:i[a][0],next:e[c.join(",")]||n(c)})}return s}}function yU(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,a=[];for(let c=0;c<i.next.length;c++){let{type:u,next:f}=i.next[c];a.push(u.name),s&&!(u.isText||u.hasRequiredAttrs())&&(s=!1),r.indexOf(f)==-1&&r.push(f)}s&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function BO(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 $O(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function VO(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let i in t)t[i].validate&&t[i].validate(e[i])}function HO(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new bU(t,r,e[r]);return n}let e_=class UO{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=HO(e,r.attrs),this.defaultAttrs=BO(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==Ea.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:$O(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new yo(this,this.computeAttrs(e),ne.from(n),Tt.setFrom(r))}createChecked(e=null,n,r){return n=ne.from(n),this.checkContent(n),new yo(this,this.computeAttrs(e),n,Tt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=ne.from(n),n.size){let a=this.contentMatch.fillBefore(n);if(!a)return null;n=a.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(ne.empty,!0);return s?new yo(this,e,n.append(s),Tt.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){VO(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:Tt.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,a)=>r[s]=new UO(s,n,a));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function vU(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class bU{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?vU(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Am{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=HO(e,i.attrs),this.excluded=null;let s=BO(this.attrs);this.instance=s?new Tt(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Tt(this,$O(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,a)=>r[s]=new Am(s,i++,n,a)),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){VO(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class FO{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=_n.from(e.nodes),n.marks=_n.from(e.marks||{}),this.nodes=e_.compile(this.spec.nodes,this),this.marks=Am.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],a=s.spec.content||"",c=s.spec.marks;if(s.contentMatch=r[a]||(r[a]=Ea.parse(a,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=c=="_"?null:c?t_(this,c.split(" ")):c==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],a=s.spec.excludes;s.excluded=a==null?[s]:a==""?[]:t_(this,a.split(" "))}this.nodeFromJSON=i=>yo.fromJSON(this,i),this.markFromJSON=i=>Tt.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof e_){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new Ep(r,r.defaultAttrs,e,Tt.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_(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],a=s;if(s)n.push(s);else for(let c in t.marks){let u=t.marks[c];(i=="_"||u.spec.group&&u.spec.group.split(" ").indexOf(i)>-1)&&n.push(a=u)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function SU(t){return t.tag!=null}function wU(t){return t.style!=null}class us{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(SU(i))this.tags.push(i);else if(wU(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new r_(this,n,!1);return r.addAll(e,Tt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new r_(this,n,!0);return r.addAll(e,Tt.none,n.from,n.to),we.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(CU(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let a=s.getAttrs(e);if(a===!1)continue;s.attrs=a||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let a=this.styles[s],c=a.style;if(!(c.indexOf(e)!=0||a.context&&!r.matchesContext(a.context)||c.length>e.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=n))){if(a.getAttrs){let u=a.getAttrs(n);if(u===!1)continue;a.attrs=u||void 0}return a}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,a=0;for(;a<n.length;a++){let c=n[a];if((c.priority==null?50:c.priority)<s)break}n.splice(a,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(a=>{r(a=i_(a)),a.mark||a.ignore||a.clearMark||(a.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(a=>{r(a=i_(a)),a.node||a.ignore||a.mark||(a.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new us(e,us.schemaRules(e)))}}const qO={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},xU={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},GO={ol:!0,ul:!0},dd=1,u0=2,Hu=4;function n_(t,e,n){return e!=null?(e?dd:0)|(e==="full"?u0:0):t&&t.whitespace=="pre"?dd|u0:n&~Hu}class hh{constructor(e,n,r,i,s,a){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=a,this.content=[],this.activeMarks=Tt.none,this.match=s||(a&Hu?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ne.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&dd)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=ne.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ne.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&&!qO.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class r_{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,a=n_(null,n.preserveWhitespace,0)|(r?Hu:0);i?s=new hh(i.type,i.attrs,Tt.none,!0,n.topMatch||i.type.contentMatch,a):r?s=new hh(null,null,Tt.none,!0,null,a):s=new hh(e.schema.topNodeType,null,Tt.none,!0,null,a),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&u0?"full":this.localPreserveWS||(i.options&dd)>0,{schema:a}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
|
|
66
|
-
`);else if(a.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(a.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let u=0;u<c.length;u++)u&&this.insertNode(a.linebreakReplacement.create(),n,!0),c[u]&&this.insertNode(a.text(c[u]),n,!/\S/.test(c[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 c=i.content[i.content.length-1],u=e.previousSibling;(!c||u&&u.nodeName=="BR"||c.isText&&/[ \t\r\n\u000c]$/.test(c.text))&&(r=r.slice(1))}r&&this.insertNode(a.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),c;GO.hasOwnProperty(a)&&this.parser.normalizeLists&&kU(e);let u=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(c=this.parser.matchTag(e,this,r));e:if(u?u.ignore:xU.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,n);else if(!u||u.skip||u.closeParent){u&&u.closeParent?this.open=Math.max(0,this.open-1):u&&u.skip.nodeType&&(e=u.skip);let f,p=this.needsBlock;if(qO.hasOwnProperty(a))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),f=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let m=u&&u.skip?n:this.readStyles(e,n);m&&this.addAll(e,m),f&&this.sync(s),this.needsBlock=p}else{let f=this.readStyles(e,n);f&&this.addElementByRule(e,u,f,u.consuming===!1?c:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
67
|
-
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],a=r.getPropertyValue(s);if(a)for(let c=void 0;;){let u=this.parser.matchStyle(s,a,this,c);if(!u)break;if(u.ignore)return null;if(u.clearMark?n=n.filter(f=>!u.clearMark(f)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)c=u;else break}}return n}addElementByRule(e,n,r,i){let s,a;if(n.node)if(a=this.parser.schema.nodes[n.node],a.isLeaf)this.insertNode(a.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let u=this.enter(a,n.attrs||null,r,n.preserveWhitespace);u&&(s=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let c=this.top;if(a&&a.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}s&&this.sync(c)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let a=r?e.childNodes[r]:e.firstChild,c=i==null?null:e.childNodes[i];a!=c;a=a.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(a,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let a=this.open,c=0;a>=0;a--){let u=this.nodes[a],f=u.findWrapping(e);if(f&&(!i||i.length>f.length+c)&&(i=f,s=u,!f.length))break;if(u.solid){if(r)break;c+=2}}if(!i)return null;this.sync(s);for(let a=0;a<i.length;a++)n=this.enterInner(i[a],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let a=Tt.none;for(let c of i.concat(e.marks))(s.type?s.type.allowsMarkType(c.type):s_(c.type,e.type))&&(a=c.addToSet(a));return s.content.push(e.mark(a)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let c=n_(e,s,a.options);a.options&Hu&&a.content.length==0&&(c|=Hu);let u=Tt.none;return r=r.filter(f=>(a.type?a.type.allowsMarkType(f.type):s_(f.type,e))?(u=f.addToSet(u),!1):!0),this.nodes.push(new hh(e,n,u,i,null,c)),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|=dd)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),a=(c,u)=>{for(;c>=0;c--){let f=n[c];if(f==""){if(c==n.length-1||c==0)continue;for(;u>=s;u--)if(a(c-1,u))return!0;return!1}else{let p=u>0||u==0&&i?this.nodes[u].type:r&&u>=s?r.node(u-s).type:null;if(!p||p.name!=f&&!p.isInGroup(f))return!1;u--}}return!0};return a(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 kU(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&GO.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function CU(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function i_(t){let e={};for(let n in t)e[n]=t[n];return e}function s_(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],a=c=>{s.push(c);for(let u=0;u<c.edgeCount;u++){let{type:f,next:p}=c.edge(u);if(f==e||s.indexOf(p)<0&&a(p))return!0}};if(a(i.contentMatch))return!0}}class ja{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=ph(n).createDocumentFragment());let i=r,s=[];return e.forEach(a=>{if(s.length||a.marks.length){let c=0,u=0;for(;c<s.length&&u<a.marks.length;){let f=a.marks[u];if(!this.marks[f.type.name]){u++;continue}if(!f.eq(s[c][0])||f.type.spec.spanning===!1)break;c++,u++}for(;c<s.length;)i=s.pop()[1];for(;u<a.marks.length;){let f=a.marks[u++],p=this.serializeMark(f,a.isInline,n);p&&(s.push([f,i]),i.appendChild(p.dom),i=p.contentDOM||p.dom)}}i.appendChild(this.serializeNodeInner(a,n))}),r}serializeNodeInner(e,n){if(e.isText)return ph(n).createTextNode(e.text);let{dom:r,contentDOM:i}=Kh(ph(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Kh(ph(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return typeof n=="string"?{dom:e.createTextNode(n)}:Kh(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ja(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=o_(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return o_(e.marks)}}function o_(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ph(t){return t.document||window.document}const a_=new WeakMap;function EU(t){let e=a_.get(t);return e===void 0&&a_.set(t,e=TU(t)),e}function TU(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function Kh(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=EU(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let a=i.indexOf(" ");a>0&&(n=i.slice(0,a),i=i.slice(a+1));let c,u=n?t.createElementNS(n,i):t.createElement(i),f=e[1],p=1;if(f&&typeof f=="object"&&f.nodeType==null&&!Array.isArray(f)){p=2;for(let m in f)if(f[m]!=null){let g=m.indexOf(" ");g>0?u.setAttributeNS(m.slice(0,g),m.slice(g+1),f[m]):m=="style"&&u.style?u.style.cssText=f[m]:u.setAttribute(m,f[m])}}for(let m=p;m<e.length;m++){let g=e[m];if(g===0){if(m<e.length-1||m>p)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else if(typeof g=="string")u.appendChild(t.createTextNode(g));else{let{dom:y,contentDOM:b}=Kh(t,g,n,r);if(u.appendChild(y),b){if(c)throw new RangeError("Multiple content holes");c=b}}}return{dom:u,contentDOM:c}}const WO=65535,KO=Math.pow(2,16);function _U(t,e){return t+e*KO}function l_(t){return t&WO}function AU(t){return(t-(t&WO))/KO}const ZO=1,YO=2,Zh=4,XO=8;class d0{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&XO)>0}get deletedBefore(){return(this.delInfo&(ZO|Zh))>0}get deletedAfter(){return(this.delInfo&(YO|Zh))>0}get deletedAcross(){return(this.delInfo&Zh)>0}}class vr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&vr.empty)return vr.empty}recover(e){let n=0,r=l_(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+AU(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,a=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let u=this.ranges[c]-(this.inverted?i:0);if(u>e)break;let f=this.ranges[c+s],p=this.ranges[c+a],m=u+f;if(e<=m){let g=f?e==u?-1:e==m?1:n:n,y=u+i+(g<0?0:p);if(r)return y;let b=e==(n<0?u:m)?null:_U(c/3,e-u),w=e==u?YO:e==m?ZO:Zh;return(n<0?e!=u:e!=m)&&(w|=XO),new d0(y,w,b)}i+=p-f}return r?e+i:new d0(e+i,0,null)}touches(e,n){let r=0,i=l_(n),s=this.inverted?2:1,a=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let u=this.ranges[c]-(this.inverted?r:0);if(u>e)break;let f=this.ranges[c+s],p=u+f;if(e<=p&&c==i*3)return!0;r+=this.ranges[c+a]-f}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let a=this.ranges[i],c=a-(this.inverted?s:0),u=a+(this.inverted?0:s),f=this.ranges[i+n],p=this.ranges[i+r];e(c,c+f,u,u+p),s+=p-f}}invert(){return new vr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?vr.empty:new vr(e<0?[0,-e,0]:[0,0,e])}}vr.empty=new vr([]);class fd{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new fd(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new fd;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let a=this._maps[s],c=a.mapResult(e,n);if(c.recover!=null){let u=this.getMirror(s);if(u!=null&&u>s&&u<this.to){s=u,e=this._maps[u].recover(c.recover);continue}}i|=c.delInfo,e=c.pos}return r?e:new d0(e,i,null)}}const zv=Object.create(null);class $n{getMap(){return vr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=zv[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 zv)throw new RangeError("Duplicate use of step JSON ID "+e);return zv[e]=n,n.prototype.jsonID=e,n}}class ln{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new ln(e,null)}static fail(e){return new ln(null,e)}static fromReplace(e,n,r,i){try{return ln.ok(e.replace(n,r,i))}catch(s){if(s instanceof cd)return ln.fail(s.message);throw s}}}function XS(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(XS(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return ne.fromArray(r)}class uo extends $n{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new we(XS(n.content,(a,c)=>!a.isAtom||!c.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),n.openStart,n.openEnd);return ln.fromReplace(e,this.from,this.to,s)}invert(){return new ri(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 uo(n.pos,r.pos,this.mark)}merge(e){return e instanceof uo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new uo(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 uo(n.from,n.to,e.markFromJSON(n.mark))}}$n.jsonID("addMark",uo);class ri extends $n{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new we(XS(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return ln.fromReplace(e,this.from,this.to,r)}invert(){return new uo(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 ri(n.pos,r.pos,this.mark)}merge(e){return e instanceof ri&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ri(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 ri(n.from,n.to,e.markFromJSON(n.mark))}}$n.jsonID("removeMark",ri);class fo extends $n{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ln.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return ln.fromReplace(e,this.pos,this.pos+1,new we(ne.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new fo(this.pos,n.marks[i]);return new fo(this.pos,this.mark)}}return new Ta(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new fo(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 fo(n.pos,e.markFromJSON(n.mark))}}$n.jsonID("addNodeMark",fo);class Ta extends $n{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ln.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return ln.fromReplace(e,this.pos,this.pos+1,new we(ne.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new fo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ta(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 Ta(n.pos,e.markFromJSON(n.mark))}}$n.jsonID("removeNodeMark",Ta);class an extends $n{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&f0(e,this.from,this.to)?ln.fail("Structure replace would overwrite content"):ln.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new vr([this.from,this.to-this.from,this.slice.size])}invert(e){return new an(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&&an.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new an(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof an)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?we.empty:new we(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new an(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?we.empty:new we(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new an(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 an(n.from,n.to,we.fromJSON(e,n.slice),!!n.structure)}}an.MAP_BIAS=1;$n.jsonID("replace",an);class gn extends $n{constructor(e,n,r,i,s,a,c=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=a,this.structure=c}apply(e){if(this.structure&&(f0(e,this.from,this.gapFrom)||f0(e,this.gapTo,this.to)))return ln.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return ln.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?ln.fromReplace(e,this.from,this.to,r):ln.fail("Content does not fit in gap")}getMap(){return new vr([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 gn(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new gn(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new gn(n.from,n.to,n.gapFrom,n.gapTo,we.fromJSON(e,n.slice),n.insert,!!n.structure)}}$n.jsonID("replaceAround",gn);function f0(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let a=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function RU(t,e,n,r){let i=[],s=[],a,c;t.doc.nodesBetween(e,n,(u,f,p)=>{if(!u.isInline)return;let m=u.marks;if(!r.isInSet(m)&&p.type.allowsMarkType(r.type)){let g=Math.max(f,e),y=Math.min(f+u.nodeSize,n),b=r.addToSet(m);for(let w=0;w<m.length;w++)m[w].isInSet(b)||(a&&a.to==g&&a.mark.eq(m[w])?a.to=y:i.push(a=new ri(g,y,m[w])));c&&c.to==g?c.to=y:s.push(c=new uo(g,y,r))}}),i.forEach(u=>t.step(u)),s.forEach(u=>t.step(u))}function MU(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(a,c)=>{if(!a.isInline)return;s++;let u=null;if(r instanceof Am){let f=a.marks,p;for(;p=r.isInSet(f);)(u||(u=[])).push(p),f=p.removeFromSet(f)}else r?r.isInSet(a.marks)&&(u=[r]):u=a.marks;if(u&&u.length){let f=Math.min(c+a.nodeSize,n);for(let p=0;p<u.length;p++){let m=u[p],g;for(let y=0;y<i.length;y++){let b=i[y];b.step==s-1&&m.eq(i[y].style)&&(g=b)}g?(g.to=f,g.step=s):i.push({style:m,from:Math.max(c,e),to:f,step:s})}}}),i.forEach(a=>t.step(new ri(a.from,a.to,a.style)))}function JS(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),a=[],c=e+1;for(let u=0;u<s.childCount;u++){let f=s.child(u),p=c+f.nodeSize,m=r.matchType(f.type);if(!m)a.push(new an(c,p,we.empty));else{r=m;for(let g=0;g<f.marks.length;g++)n.allowsMarkType(f.marks[g].type)||t.step(new ri(c,p,f.marks[g]));if(i&&f.isText&&n.whitespace!="pre"){let g,y=/\r?\n|\r/g,b;for(;g=y.exec(f.text);)b||(b=new we(ne.from(n.schema.text(" ",n.allowedMarks(f.marks))),0,0)),a.push(new an(c+g.index,c+g.index+g[0].length,b))}}c=p}if(!r.validEnd){let u=r.fillBefore(ne.empty,!0);t.replace(c,c,new we(u,0,0))}for(let u=a.length-1;u>=0;u--)t.step(a[u])}function OU(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function yc(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let a=t.$from.node(r),c=t.$from.index(r)+i,u=t.$to.indexAfter(r)-s;if(r<t.depth&&a.canReplace(c,u,n))return r;if(r==0||a.type.spec.isolating||!OU(a,c,u))break;c&&(i=1),u<a.childCount&&(s=1)}return null}function NU(t,e,n){let{$from:r,$to:i,depth:s}=e,a=r.before(s+1),c=i.after(s+1),u=a,f=c,p=ne.empty,m=0;for(let b=s,w=!1;b>n;b--)w||r.index(b)>0?(w=!0,p=ne.from(r.node(b).copy(p)),m++):u--;let g=ne.empty,y=0;for(let b=s,w=!1;b>n;b--)w||i.after(b+1)<i.end(b)?(w=!0,g=ne.from(i.node(b).copy(g)),y++):f++;t.step(new gn(u,f,a,c,new we(p.append(g),m,y),p.size-m,!0))}function QS(t,e,n=null,r=t){let i=DU(t,e),s=i&&IU(r,e);return s?i.map(c_).concat({type:e,attrs:n}).concat(s.map(c_)):null}function c_(t){return{type:t,attrs:null}}function DU(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let a=s.length?s[0]:e;return n.canReplaceWith(r,i,a)?s:null}function IU(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),a=e.contentMatch.findWrapping(s.type);if(!a)return null;let u=(a.length?a[a.length-1]:e).contentMatch;for(let f=r;u&&f<i;f++)u=u.matchType(n.child(f).type);return!u||!u.validEnd?null:a}function LU(t,e,n){let r=ne.empty;for(let a=n.length-1;a>=0;a--){if(r.size){let c=n[a].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=ne.from(n[a].type.create(n[a].attrs,r))}let i=e.start,s=e.end;t.step(new gn(i,s,i,s,new we(r,0,0),n.length,!0))}function zU(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(a,c)=>{let u=typeof i=="function"?i(a):i;if(a.isTextblock&&!a.hasMarkup(r,u)&&PU(t.doc,t.mapping.slice(s).map(c),r)){let f=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",b=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!b?f=!1:!y&&b&&(f=!0)}f===!1&&QO(t,a,c,s),JS(t,t.mapping.slice(s).map(c,1),r,void 0,f===null);let p=t.mapping.slice(s),m=p.map(c,1),g=p.map(c+a.nodeSize,1);return t.step(new gn(m,g,m+1,g-1,new we(ne.from(r.create(u,null,a.marks)),0,0),1,!0)),f===!0&&JO(t,a,c,s),!1}})}function JO(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let a,c=/\r?\n|\r/g;for(;a=c.exec(i.text);){let u=t.mapping.slice(r).map(n+1+s+a.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function QO(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let a=t.mapping.slice(r).map(n+1+s);t.replaceWith(a,a+1,e.type.schema.text(`
|
|
68
|
-
`))}})}function PU(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function jU(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let a=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,a);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new gn(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new we(ne.from(a),0,0),1,!0))}function ds(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,a=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!a.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let f=i.depth-1,p=n-2;f>s;f--,p--){let m=i.node(f),g=i.index(f);if(m.type.spec.isolating)return!1;let y=m.content.cutByIndex(g,m.childCount),b=r&&r[p+1];b&&(y=y.replaceChild(0,b.type.create(b.attrs)));let w=r&&r[p]||m;if(!m.canReplace(g+1,m.childCount)||!w.type.validContent(y))return!1}let c=i.indexAfter(s),u=r&&r[0];return i.node(s).canReplaceWith(c,c,u?u.type:i.node(s+1).type)}function BU(t,e,n=1,r){let i=t.doc.resolve(e),s=ne.empty,a=ne.empty;for(let c=i.depth,u=i.depth-n,f=n-1;c>u;c--,f--){s=ne.from(i.node(c).copy(s));let p=r&&r[f];a=ne.from(p?p.type.create(p.attrs,a):i.node(c).copy(a))}t.step(new an(e,e,new we(s.append(a),n,n),!0))}function Io(t,e){let n=t.resolve(e),r=n.index();return eN(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function $U(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),a=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(a),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function eN(t,e){return!!(t&&e&&!t.isLeaf&&$U(t,e))}function Rm(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,a,c=r.index(i);if(i==r.depth?(s=r.nodeBefore,a=r.nodeAfter):n>0?(s=r.node(i+1),c++,a=r.node(i).maybeChild(c)):(s=r.node(i).maybeChild(c-1),a=r.node(i+1)),s&&!s.isTextblock&&eN(s,a)&&r.node(i).canReplace(c,c+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function VU(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),a=s.node().type;if(i&&a.inlineContent){let p=a.whitespace=="pre",m=!!a.contentMatch.matchType(i);p&&!m?r=!1:!p&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let p=t.doc.resolve(e+n);QO(t,p.node(),p.before(),c)}a.inlineContent&&JS(t,e+n-1,a,s.node().contentMatchAt(s.index()),r==null);let u=t.mapping.slice(c),f=u.map(e-n);if(t.step(new an(f,u.map(e+n,-1),we.empty,!0)),r===!0){let p=t.doc.resolve(f);JO(t,p.node(),p.before(),t.steps.length)}return t}function HU(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function tN(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let a=r.depth;a>=0;a--){let c=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,u=r.index(a)+(c>0?1:0),f=r.node(a),p=!1;if(s==1)p=f.canReplace(u,u,i);else{let m=f.contentMatchAt(u).findWrapping(i.firstChild.type);p=m&&f.canReplaceWith(u,u,m[0])}if(p)return c==0?r.pos:c<0?r.before(a+1):r.after(a+1)}return null}function Mm(t,e,n=e,r=we.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return nN(i,s,r)?new an(e,n,r):new UU(i,s,r).fit()}function nN(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class UU{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ne.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=ne.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let f=this.findFittable();f?this.placeNodes(f):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,a=r.depth,c=i.depth;for(;a&&c&&s.childCount==1;)s=s.firstChild.content,a--,c--;let u=new we(s,a,c);return e>-1?new gn(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new an(r.pos,i.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Pv(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let a=i.firstChild;for(let c=this.depth;c>=0;c--){let{type:u,match:f}=this.frontier[c],p,m=null;if(n==1&&(a?f.matchType(a.type)||(m=f.fillBefore(ne.from(a),!1)):s&&u.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:c,parent:s,inject:m};if(n==2&&a&&(p=f.findWrapping(a.type)))return{sliceDepth:r,frontierDepth:c,parent:s,wrap:p};if(s&&f.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Pv(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new we(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Pv(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new we(Mu(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new we(Mu(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let w=0;w<s.length;w++)this.openFrontierNode(s[w]);let a=this.unplaced,c=r?r.content:a.content,u=a.openStart-e,f=0,p=[],{match:m,type:g}=this.frontier[n];if(i){for(let w=0;w<i.childCount;w++)p.push(i.child(w));m=m.matchFragment(i)}let y=c.size+e-(a.content.size-a.openEnd);for(;f<c.childCount;){let w=c.child(f),x=m.matchType(w.type);if(!x)break;f++,(f>1||u==0||w.content.size)&&(m=x,p.push(rN(w.mark(g.allowedMarks(w.marks)),f==1?u:0,f==c.childCount?y:-1)))}let b=f==c.childCount;b||(y=-1),this.placed=Ou(this.placed,n,ne.from(p)),this.frontier[n].match=m,b&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let w=0,x=c;w<y;w++){let k=x.lastChild;this.frontier.push({type:k.type,match:k.contentMatchAt(k.childCount)}),x=k.content}this.unplaced=b?e==0?we.empty:new we(Mu(a.content,e-1,1),e-1,y<0?a.openEnd:e-1):new we(Mu(a.content,e,f),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!jv(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),a=jv(e,n,i,r,s);if(a){for(let c=n-1;c>=0;c--){let{match:u,type:f}=this.frontier[c],p=jv(e,c,f,u,!0);if(!p||p.childCount)continue e}return{depth:n,fit:a,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Ou(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Ou(this.placed,this.depth,ne.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ne.empty,!0);n.childCount&&(this.placed=Ou(this.placed,this.frontier.length,n))}}function Mu(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Mu(t.firstChild.content,e-1,n)))}function Ou(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Ou(t.lastChild.content,e-1,n)))}function Pv(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function rN(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,rN(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(ne.empty,!0)))),t.copy(r)}function jv(t,e,n,r,i){let s=t.node(e),a=i?t.indexAfter(e):t.index(e);if(a==s.childCount&&!n.compatibleContent(s.type))return null;let c=r.fillBefore(s.content,!0,a);return c&&!FU(n,s.content,a)?c:null}function FU(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function qU(t){return t.spec.defining||t.spec.definingForContent}function GU(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(nN(i,s,r))return t.step(new an(e,n,r));let a=sN(i,s);a[a.length-1]==0&&a.pop();let c=-(i.depth+1);a.unshift(c);for(let g=i.depth,y=i.pos-1;g>0;g--,y--){let b=i.node(g).type.spec;if(b.defining||b.definingAsContext||b.isolating)break;a.indexOf(g)>-1?c=g:i.before(g)==y&&a.splice(1,0,-g)}let u=a.indexOf(c),f=[],p=r.openStart;for(let g=r.content,y=0;;y++){let b=g.firstChild;if(f.push(b),y==r.openStart)break;g=b.content}for(let g=p-1;g>=0;g--){let y=f[g],b=qU(y.type);if(b&&!y.sameMarkup(i.node(Math.abs(c)-1)))p=g;else if(b||!y.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let y=(g+p+1)%(r.openStart+1),b=f[y];if(b)for(let w=0;w<a.length;w++){let x=a[(w+u)%a.length],k=!0;x<0&&(k=!1,x=-x);let T=i.node(x-1),A=i.index(x-1);if(T.canReplaceWith(A,A,b.type,b.marks))return t.replace(i.before(x),k?s.after(x):n,new we(iN(r.content,0,r.openStart,y),y,r.openEnd))}}let m=t.steps.length;for(let g=a.length-1;g>=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let y=a[g];y<0||(e=i.before(y),n=s.after(y))}}function iN(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(iN(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),a=s.fillBefore(t).append(t);t=a.append(s.matchFragment(a).fillBefore(ne.empty,!0))}return t}function WU(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=HU(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new we(ne.from(r),0,0))}function KU(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let a=r.sharedDepth(n),c=!1;for(let u=r.depth;u>a;u--)r.node(u).type.spec.isolating&&(c=!0);for(let u=i.depth;u>a;u--)i.node(u).type.spec.isolating&&(c=!0);if(!c){for(let u=r.depth;u>0&&e==r.start(u);u--)e=r.before(u);for(let u=i.depth;u>0&&n==i.start(u);u--)n=i.before(u);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let s=sN(r,i);for(let a=0;a<s.length;a++){let c=s[a],u=a==s.length-1;if(u&&c==0||r.node(c).type.contentMatch.validEnd)return t.delete(r.start(c),i.end(c));if(c>0&&(u||r.node(c-1).canReplace(r.index(c-1),i.indexAfter(c-1))))return t.delete(r.before(c),i.after(c))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(e-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return t.delete(r.before(a),n);t.delete(e,n)}function sN(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class Fl extends $n{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 ln.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return ln.fromReplace(e,this.pos,this.pos+1,new we(ne.from(i),0,n.isLeaf?0:1))}getMap(){return vr.empty}invert(e){return new Fl(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 Fl(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 Fl(n.pos,n.attr,n.value)}}$n.jsonID("attr",Fl);class hd extends $n{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return ln.ok(r)}getMap(){return vr.empty}invert(e){return new hd(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 hd(n.attr,n.value)}}$n.jsonID("docAttr",hd);let rc=class extends Error{};rc=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};rc.prototype=Object.create(Error.prototype);rc.prototype.constructor=rc;rc.prototype.name="TransformError";class ew{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new fd}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new rc(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,a,c,u)=>{e=Math.min(e,c),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=we.empty){let i=Mm(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new we(ne.from(r),0,0))}delete(e,n){return this.replace(e,n,we.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return GU(this,e,n,r),this}replaceRangeWith(e,n,r){return WU(this,e,n,r),this}deleteRange(e,n){return KU(this,e,n),this}lift(e,n){return NU(this,e,n),this}join(e,n=1){return VU(this,e,n),this}wrap(e,n){return LU(this,e,n),this}setBlockType(e,n=e,r,i=null){return zU(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return jU(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new Fl(e,n,r)),this}setDocAttribute(e,n){return this.step(new hd(e,n)),this}addNodeMark(e,n){return this.step(new fo(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 Tt)n.isInSet(r.marks)&&this.step(new Ta(e,n));else{let i=r.marks,s,a=[];for(;s=n.isInSet(i);)a.push(new Ta(e,s)),i=s.removeFromSet(i);for(let c=a.length-1;c>=0;c--)this.step(a[c])}return this}split(e,n=1,r){return BU(this,e,n,r),this}addMark(e,n,r){return RU(this,e,n,r),this}removeMark(e,n,r){return MU(this,e,n,r),this}clearIncompatible(e,n,r){return JS(this,e,n,r),this}}const Bv=Object.create(null);class $e{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new oN(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=we.empty){let r=n.content.lastChild,i=null;for(let c=0;c<n.openEnd;c++)i=r,r=r.lastChild;let s=e.steps.length,a=this.ranges;for(let c=0;c<a.length;c++){let{$from:u,$to:f}=a[c],p=e.mapping.slice(s);e.replaceRange(p.map(u.pos),p.map(f.pos),c?we.empty:n),c==0&&f_(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:a,$to:c}=i[s],u=e.mapping.slice(r),f=u.map(a.pos),p=u.map(c.pos);s?e.deleteRange(f,p):(e.replaceRangeWith(f,p,n),f_(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new Ne(e):zl(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let a=n<0?zl(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):zl(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(a)return a}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Sr(e.node(0))}static atStart(e){return zl(e,e,0,0,1)||new Sr(e)}static atEnd(e){return zl(e,e,e.content.size,e.childCount,-1)||new Sr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Bv[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 Bv)throw new RangeError("Duplicate use of selection JSON ID "+e);return Bv[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Ne.between(this.$anchor,this.$head).getBookmark()}}$e.prototype.visible=!0;class oN{constructor(e,n){this.$from=e,this.$to=n}}let u_=!1;function d_(t){!u_&&!t.parent.inlineContent&&(u_=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Ne extends $e{constructor(e,n=e){d_(e),d_(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 $e.near(r);let i=e.resolve(n.map(this.anchor));return new Ne(i.parent.inlineContent?i:r,r)}replace(e,n=we.empty){if(super.replace(e,n),n==we.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Ne&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Om(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 Ne(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=$e.findFrom(n,r,!0)||$e.findFrom(n,-r,!0);if(s)n=s.$head;else return $e.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=($e.findFrom(e,-r,!0)||$e.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new Ne(e,n)}}$e.jsonID("text",Ne);class Om{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Om(e.map(this.anchor),e.map(this.head))}resolve(e){return Ne.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ie extends $e{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?$e.near(s):new Ie(s)}content(){return new we(ne.from(this.node),0,0)}eq(e){return e instanceof Ie&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new tw(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ie(e.resolve(n.anchor))}static create(e,n){return new Ie(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ie.prototype.visible=!1;$e.jsonID("node",Ie);class tw{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Om(r,r):new tw(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Ie.isSelectable(r)?new Ie(n):$e.near(n)}}class Sr extends $e{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=we.empty){if(n==we.empty){e.delete(0,e.doc.content.size);let r=$e.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Sr(e)}map(e){return new Sr(e)}eq(e){return e instanceof Sr}getBookmark(){return ZU}}$e.jsonID("all",Sr);const ZU={map(){return this},resolve(t){return new Sr(t)}};function zl(t,e,n,r,i,s=!1){if(e.inlineContent)return Ne.create(t,n);for(let a=r-(i>0?0:1);i>0?a<e.childCount:a>=0;a+=i){let c=e.child(a);if(c.isAtom){if(!s&&Ie.isSelectable(c))return Ie.create(t,n-(i<0?c.nodeSize:0))}else{let u=zl(t,c,n+i,i<0?c.childCount:0,i,s);if(u)return u}n+=c.nodeSize*i}return null}function f_(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof an||i instanceof gn))return;let s=t.mapping.maps[r],a;s.forEach((c,u,f,p)=>{a==null&&(a=p)}),t.setSelection($e.near(t.doc.resolve(a),n))}const h_=1,mh=2,p_=4;class YU extends ew{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|h_)&~mh,this.storedMarks=null,this}get selectionSet(){return(this.updated&h_)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=mh,this}ensureMarks(e){return Tt.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&mh)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~mh,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)||Tt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let a=this.doc.resolve(n);s=r==n?a.marks():a.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection($e.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|=p_,this}get scrolledIntoView(){return(this.updated&p_)>0}}function m_(t,e){return!e||!t?t:t.bind(e)}class Nu{constructor(e,n,r){this.name=e,this.init=m_(n.init,r),this.apply=m_(n.apply,r)}}const XU=[new Nu("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Nu("selection",{init(t,e){return t.selection||$e.atStart(e.doc)},apply(t){return t.selection}}),new Nu("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Nu("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class $v{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=XU.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 Nu(r.key,r.spec.state,r))})}}class ua{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let a=0;a<this.config.plugins.length;a++){let c=this.config.plugins[a];if(c.spec.appendTransaction){let u=i?i[a].n:0,f=i?i[a].state:this,p=u<n.length&&c.spec.appendTransaction.call(c,u?n.slice(u):n,f,r);if(p&&r.filterTransaction(p,a)){if(p.setMeta("appendedTransaction",e),!i){i=[];for(let m=0;m<this.config.plugins.length;m++)i.push(m<a?{state:r,n:n.length}:{state:this,n:0})}n.push(p),r=r.applyInner(p),s=!0}i&&(i[a]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new ua(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new YU(this)}static create(e){let n=new $v(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new ua(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new $v(this.schema,e.plugins),r=n.fields,i=new ua(n);for(let s=0;s<r.length;s++){let a=r[s].name;i[a]=this.hasOwnProperty(a)?this[a]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new $v(e.schema,e.plugins),s=new ua(i);return i.fields.forEach(a=>{if(a.name=="doc")s.doc=yo.fromJSON(e.schema,n.doc);else if(a.name=="selection")s.selection=$e.fromJSON(s.doc,n.selection);else if(a.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let c in r){let u=r[c],f=u.spec.state;if(u.key==a.name&&f&&f.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){s[a.name]=f.fromJSON.call(u,e,n[c],s);return}}s[a.name]=a.init(e,s)}}),s}}function aN(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=aN(i,e,{})),n[r]=i}return n}class Rt{constructor(e){this.spec=e,this.props={},e.props&&aN(e.props,this,this.props),this.key=e.key?e.key.key:lN("plugin")}getState(e){return e[this.key]}}const Vv=Object.create(null);function lN(t){return t in Vv?t+"$"+ ++Vv[t]:(Vv[t]=0,t+"$")}class Gt{constructor(e="key"){this.key=lN(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const cN=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function uN(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const dN=(t,e,n)=>{let r=uN(t,n);if(!r)return!1;let i=nw(r);if(!i){let a=r.blockRange(),c=a&&yc(a);return c==null?!1:(e&&e(t.tr.lift(a,c).scrollIntoView()),!0)}let s=i.nodeBefore;if(SN(t,i,e,-1))return!0;if(r.parent.content.size==0&&(ic(s,"end")||Ie.isSelectable(s)))for(let a=r.depth;;a--){let c=Mm(t.doc,r.before(a),r.after(a),we.empty);if(c&&c.slice.size<c.to-c.from){if(e){let u=t.tr.step(c);u.setSelection(ic(s,"end")?$e.findFrom(u.doc.resolve(u.mapping.map(i.pos,-1)),-1):Ie.create(u.doc,i.pos-s.nodeSize)),e(u.scrollIntoView())}return!0}if(a==1||r.node(a-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},JU=(t,e,n)=>{let r=uN(t,n);if(!r)return!1;let i=nw(r);return i?fN(t,i,e):!1},QU=(t,e,n)=>{let r=pN(t,n);if(!r)return!1;let i=rw(r);return i?fN(t,i,e):!1};function fN(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let p=i.lastChild;if(!p)return!1;i=p}let a=e.nodeAfter,c=a,u=e.pos+1;for(;!c.isTextblock;u++){if(c.type.spec.isolating)return!1;let p=c.firstChild;if(!p)return!1;c=p}let f=Mm(t.doc,s,u,we.empty);if(!f||f.from!=s||f instanceof an&&f.slice.size>=u-s)return!1;if(n){let p=t.tr.step(f);p.setSelection(Ne.create(p.doc,s)),n(p.scrollIntoView())}return!0}function ic(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 hN=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=nw(r)}let a=s&&s.nodeBefore;return!a||!Ie.isSelectable(a)?!1:(e&&e(t.tr.setSelection(Ie.create(t.doc,s.pos-a.nodeSize)).scrollIntoView()),!0)};function nw(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 pN(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const mN=(t,e,n)=>{let r=pN(t,n);if(!r)return!1;let i=rw(r);if(!i)return!1;let s=i.nodeAfter;if(SN(t,i,e,1))return!0;if(r.parent.content.size==0&&(ic(s,"start")||Ie.isSelectable(s))){let a=Mm(t.doc,r.before(),r.after(),we.empty);if(a&&a.slice.size<a.to-a.from){if(e){let c=t.tr.step(a);c.setSelection(ic(s,"start")?$e.findFrom(c.doc.resolve(c.mapping.map(i.pos)),1):Ie.create(c.doc,c.mapping.map(i.pos))),e(c.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},gN=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=rw(r)}let a=s&&s.nodeAfter;return!a||!Ie.isSelectable(a)?!1:(e&&e(t.tr.setSelection(Ie.create(t.doc,s.pos)).scrollIntoView()),!0)};function rw(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 eF=(t,e)=>{let n=t.selection,r=n instanceof Ie,i;if(r){if(n.node.isTextblock||!Io(t.doc,n.from))return!1;i=n.from}else if(i=Rm(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(Ie.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},tF=(t,e)=>{let n=t.selection,r;if(n instanceof Ie){if(n.node.isTextblock||!Io(t.doc,n.to))return!1;r=n.to}else if(r=Rm(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},nF=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&yc(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},yN=(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 iw(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 rF=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),a=iw(i.contentMatchAt(s));if(!a||!i.canReplaceWith(s,s,a))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,a.createAndFill());u.setSelection($e.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},vN=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Sr||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=iw(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let a=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,c=t.tr.insert(a,s.createAndFill());c.setSelection(Ne.create(c.doc,a+1)),e(c.scrollIntoView())}return!0},bN=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(ds(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&yc(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function iF(t){return(e,n)=>{if(e.selection instanceof Ie&&e.selection.node.isBlock){let{$from:y}=e.selection;return!y.parentOffset||!ds(e.doc,y.pos)?!1:(n&&n(e.tr.split(y.pos).scrollIntoView()),!0)}if(!e.selection.$from.depth)return!1;let r=e.tr;!e.selection.empty&&(e.selection instanceof Ne||e.selection instanceof Sr)&&r.deleteSelection();let{$from:i}=r.selection,s=r.steps.length,a=[],c,u,f=!1,p=!1;for(let y=i.depth;;y--)if(i.node(y).isBlock){f=i.end(y)==i.pos+(i.depth-y),p=i.start(y)==i.pos-(i.depth-y),u=iw(i.node(y-1).contentMatchAt(i.indexAfter(y-1))),a.unshift(f&&u?{type:u}:null),c=y;break}else{if(y==1)return!1;a.unshift(null)}let m=i.pos,g=ds(r.doc,m,a.length,a);if(g||(a[0]=u?{type:u}:null,g=ds(r.doc,m,a.length,a)),!g)return!1;if(r.split(m,a.length,a),!f&&p&&i.node(c).type!=u){let y=r.mapping.slice(s),b=y.map(i.before(c)),w=r.doc.resolve(b);u&&i.node(c-1).canReplaceWith(w.index(),w.index()+1,u)&&r.setNodeMarkup(y.map(i.before(c)),u)}return n&&n(r.scrollIntoView()),!0}}const sF=iF(),oF=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(Ie.create(t.doc,i))),!0)};function aF(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Io(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function SN(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,a,c,u=i.type.spec.isolating||s.type.spec.isolating;if(!u&&aF(t,e,n))return!0;let f=!u&&e.parent.canReplace(e.index(),e.index()+1);if(f&&(a=(c=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&c.matchType(a[0]||s.type).validEnd){if(n){let y=e.pos+s.nodeSize,b=ne.empty;for(let k=a.length-1;k>=0;k--)b=ne.from(a[k].create(null,b));b=ne.from(i.copy(b));let w=t.tr.step(new gn(e.pos-1,y,e.pos,y,new we(b,1,0),a.length,!0)),x=w.doc.resolve(y+2*a.length);x.nodeAfter&&x.nodeAfter.type==i.type&&Io(w.doc,x.pos)&&w.join(x.pos),n(w.scrollIntoView())}return!0}let p=s.type.spec.isolating||r>0&&u?null:$e.findFrom(e,1),m=p&&p.$from.blockRange(p.$to),g=m&&yc(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(f&&ic(s,"start",!0)&&ic(i,"end")){let y=i,b=[];for(;b.push(y),!y.isTextblock;)y=y.lastChild;let w=s,x=1;for(;!w.isTextblock;w=w.firstChild)x++;if(y.canReplace(y.childCount,y.childCount,w.content)){if(n){let k=ne.empty;for(let A=b.length-1;A>=0;A--)k=ne.from(b[A].copy(k));let T=t.tr.step(new gn(e.pos-b.length,e.pos+s.nodeSize,e.pos+x,e.pos+s.nodeSize-x,new we(k,b.length,0),0,!0));n(T.scrollIntoView())}return!0}}return!1}function wN(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(Ne.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const lF=wN(-1),cF=wN(1);function uF(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,a=i.blockRange(s),c=a&&QS(a,t,e);return c?(r&&r(n.tr.wrap(a,c).scrollIntoView()),!0):!1}}function g_(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:a},$to:{pos:c}}=n.selection.ranges[s];n.doc.nodesBetween(a,c,(u,f)=>{if(i)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)i=!0;else{let p=n.doc.resolve(f),m=p.index();i=p.parent.canReplaceWith(m,m+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let a=0;a<n.selection.ranges.length;a++){let{$from:{pos:c},$to:{pos:u}}=n.selection.ranges[a];s.setBlockType(c,u,t,e)}r(s.scrollIntoView())}return!0}}function sw(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}sw(cN,dN,hN);sw(cN,mN,gN);sw(yN,vN,bN,sF);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function dF(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,a=i.blockRange(s);if(!a)return!1;let c=r?n.tr:null;return fF(c,a,t,e)?(r&&r(c.scrollIntoView()),!0):!1}}function fF(t,e,n,r=null){let i=!1,s=e,a=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=a.resolve(e.start-2);s=new Cp(u,u,e.depth),e.endIndex<e.parent.childCount&&(e=new Cp(e.$from,a.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let c=QS(s,n,r,e);return c?(t&&hF(t,e,c,i,n),!0):!1}function hF(t,e,n,r,i){let s=ne.empty;for(let p=n.length-1;p>=0;p--)s=ne.from(n[p].type.create(n[p].attrs,s));t.step(new gn(e.start-(r?2:0),e.end,e.start,e.end,new we(s,0,0),n.length,!0));let a=0;for(let p=0;p<n.length;p++)n[p].type==i&&(a=p+1);let c=n.length-a,u=e.start+n.length-(r?2:0),f=e.parent;for(let p=e.startIndex,m=e.endIndex,g=!0;p<m;p++,g=!1)!g&&ds(t.doc,u,c)&&(t.split(u,c),u+=2*c),u+=f.child(p).nodeSize;return t}function pF(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,a=>a.childCount>0&&a.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?mF(e,n,t,s):gF(e,n,s):!0:!1}}function mF(t,e,n,r){let i=t.tr,s=r.end,a=r.$to.end(r.depth);s<a&&(i.step(new gn(s-1,a,s,a,new we(ne.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Cp(i.doc.resolve(r.$from.pos),i.doc.resolve(a),r.depth));const c=yc(r);if(c==null)return!1;i.lift(r,c);let u=i.doc.resolve(i.mapping.map(s,-1)-1);return Io(i.doc,u.pos)&&u.nodeBefore.type==u.nodeAfter.type&&i.join(u.pos),e(i.scrollIntoView()),!0}function gF(t,e,n){let r=t.tr,i=n.parent;for(let y=n.end,b=n.endIndex-1,w=n.startIndex;b>w;b--)y-=i.child(b).nodeSize,r.delete(y-1,y+1);let s=r.doc.resolve(n.start),a=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,u=n.endIndex==i.childCount,f=s.node(-1),p=s.index(-1);if(!f.canReplace(p+(c?0:1),p+1,a.content.append(u?ne.empty:ne.from(i))))return!1;let m=s.pos,g=m+a.nodeSize;return r.step(new gn(m-(c?1:0),g+(u?1:0),m+1,g-1,new we((c?ne.empty:ne.from(i.copy(ne.empty))).append(u?ne.empty:ne.from(i.copy(ne.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function yF(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,f=>f.childCount>0&&f.firstChild.type==t);if(!s)return!1;let a=s.startIndex;if(a==0)return!1;let c=s.parent,u=c.child(a-1);if(u.type!=t)return!1;if(n){let f=u.lastChild&&u.lastChild.type==c.type,p=ne.from(f?t.create():null),m=new we(ne.from(t.create(null,ne.from(c.type.create(null,p)))),f?3:1,0),g=s.start,y=s.end;n(e.tr.step(new gn(g-(f?3:1),y,g,y,m,1,!0)).scrollIntoView())}return!0}}const Mn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},sc=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let h0=null;const Ji=function(t,e,n){let r=h0||(h0=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},vF=function(){h0=null},_a=function(t,e,n,r){return n&&(y_(t,e,n,r,-1)||y_(t,e,n,r,1))},bF=/^(img|br|input|textarea|hr)$/i;function y_(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Pr(t))){let a=t.parentNode;if(!a||a.nodeType!=1||Ld(t)||bF.test(t.nodeName)||t.contentEditable=="false")return!1;e=Mn(t)+(i<0?0:1),t=a}else if(t.nodeType==1){let a=t.childNodes[e+(i<0?-1:0)];if(a.nodeType==1&&a.contentEditable=="false")if(!((s=a.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=a,e=i<0?Pr(t):0}else return!1}}function Pr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function SF(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=Pr(t)}else if(t.parentNode&&!Ld(t))e=Mn(t),t=t.parentNode;else return null}}function wF(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&&!Ld(t))e=Mn(t)+1,t=t.parentNode;else return null}}function xF(t,e,n){for(let r=e==0,i=e==Pr(t);r||i;){if(t==n)return!0;let s=Mn(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Pr(t)}}function Ld(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 Nm=function(t){return t.focusNode&&_a(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function aa(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function kF(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function CF(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Pr(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Pr(r.startContainer),r.startOffset)}}}const ki=typeof navigator<"u"?navigator:null,v_=typeof document<"u"?document:null,Lo=ki&&ki.userAgent||"",p0=/Edge\/(\d+)/.exec(Lo),xN=/MSIE \d/.exec(Lo),m0=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Lo),or=!!(xN||m0||p0),vo=xN?document.documentMode:m0?+m0[1]:p0?+p0[1]:0,jr=!or&&/gecko\/(\d+)/i.test(Lo);jr&&+(/Firefox\/(\d+)/.exec(Lo)||[0,0])[1];const g0=!or&&/Chrome\/(\d+)/.exec(Lo),Nn=!!g0,kN=g0?+g0[1]:0,jn=!or&&!!ki&&/Apple Computer/.test(ki.vendor),oc=jn&&(/Mobile\/\w+/.test(Lo)||!!ki&&ki.maxTouchPoints>2),Lr=oc||(ki?/Mac/.test(ki.platform):!1),CN=ki?/Win/.test(ki.platform):!1,ls=/Android \d/.test(Lo),zd=!!v_&&"webkitFontSmoothing"in v_.documentElement.style,EF=zd?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function TF(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 Gi(t,e){return typeof t=="number"?t:t[e]}function _F(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 b_(t,e,n){if(!y0(e)&&e.left==0)return;let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let a=n||t.dom;a;){if(a.nodeType!=1){a=sc(a);continue}let c=a,u=c==s.body,f=u?TF(s):_F(c),p=0,m=0;if(e.top<f.top+Gi(r,"top")?m=-(f.top-e.top+Gi(i,"top")):e.bottom>f.bottom-Gi(r,"bottom")&&(m=e.bottom-e.top>f.bottom-f.top?e.top+Gi(i,"top")-f.top:e.bottom-f.bottom+Gi(i,"bottom")),e.left<f.left+Gi(r,"left")?p=-(f.left-e.left+Gi(i,"left")):e.right>f.right-Gi(r,"right")&&(p=e.right-f.right+Gi(i,"right")),p||m)if(u)s.defaultView.scrollBy(p,m);else{let y=c.scrollLeft,b=c.scrollTop;m&&(c.scrollTop+=m),p&&(c.scrollLeft+=p);let w=c.scrollLeft-y,x=c.scrollTop-b;e={left:e.left-w,top:e.top-x,right:e.right-w,bottom:e.bottom-x}}let g=u?"fixed":getComputedStyle(a).position;if(/^(fixed|sticky)$/.test(g))break;a=g=="absolute"?a.offsetParent:sc(a)}}function AF(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,a=n+1;a<Math.min(innerHeight,e.bottom);a+=5){let c=t.root.elementFromPoint(s,a);if(!c||c==t.dom||!t.dom.contains(c))continue;let u=c.getBoundingClientRect();if(u.top>=n-20){r=c,i=u.top;break}}return{refDOM:r,refTop:i,stack:EN(t.dom)}}function EN(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=sc(r));return e}function RF({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;TN(n,r==0?0:r-e)}function TN(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Rl=null;function MF(t){if(t.setActive)return t.setActive();if(Rl)return t.focus(Rl);let e=EN(t);t.focus(Rl==null?{get preventScroll(){return Rl={preventScroll:!0},!0}}:void 0),Rl||(Rl=!1,TN(e,0))}function _N(t,e){let n,r=2e8,i,s=0,a=e.top,c=e.top,u,f;for(let p=t.firstChild,m=0;p;p=p.nextSibling,m++){let g;if(p.nodeType==1)g=p.getClientRects();else if(p.nodeType==3)g=Ji(p).getClientRects();else continue;for(let y=0;y<g.length;y++){let b=g[y];if(b.top<=a&&b.bottom>=c){a=Math.max(b.bottom,a),c=Math.min(b.top,c);let w=b.left>e.left?b.left-e.left:b.right<e.left?e.left-b.right:0;if(w<r){n=p,r=w,i=w&&n.nodeType==3?{left:b.right<e.left?b.right:b.left,top:e.top}:e,p.nodeType==1&&w&&(s=m+(e.left>=(b.left+b.right)/2?1:0));continue}}else b.top>e.top&&!u&&b.left<=e.left&&b.right>=e.left&&(u=p,f={left:Math.max(b.left,Math.min(b.right,e.left)),top:b.top});!n&&(e.left>=b.right&&e.top>=b.top||e.left>=b.left&&e.top>=b.bottom)&&(s=m+1)}}return!n&&u&&(n=u,i=f,r=0),n&&n.nodeType==3?OF(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:_N(n,i)}function OF(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let a=Ys(r,1);if(a.top!=a.bottom&&ow(e,a)){i={node:t,offset:s+(e.left>=(a.left+a.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function ow(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function NF(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function DF(t,e,n){let{node:r,offset:i}=_N(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let a=r.getBoundingClientRect();s=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function IF(t,e,n,r){let i=-1;for(let s=e,a=!1;s!=t.dom;){let c=t.docView.nearestDesc(s,!0),u;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((u=c.dom.getBoundingClientRect()).width||u.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!a&&u.left>r.left||u.top>r.top?i=c.posBefore:(!a&&u.right<r.left||u.bottom<r.top)&&(i=c.posAfter),a=!0),!c.contentDOM&&i<0&&!c.node.isText))return(c.node.isBlock?r.top<(u.top+u.bottom)/2:r.left<(u.left+u.right)/2)?c.posBefore:c.posAfter;s=c.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function AN(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let a=t.childNodes[s];if(a.nodeType==1){let c=a.getClientRects();for(let u=0;u<c.length;u++){let f=c[u];if(ow(e,f))return AN(a,e,f)}}if((s=(s+1)%r)==i)break}return t}function LF(t,e){let n=t.dom.ownerDocument,r,i=0,s=CF(n,e.left,e.top);s&&({node:r,offset:i}=s);let a=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),c;if(!a||!t.dom.contains(a.nodeType!=1?a.parentNode:a)){let f=t.dom.getBoundingClientRect();if(!ow(e,f)||(a=AN(t.dom,e,f),!a))return null}if(jn)for(let f=a;r&&f;f=sc(f))f.draggable&&(r=void 0);if(a=NF(a,e),r){if(jr&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let p=r.childNodes[i],m;p.nodeName=="IMG"&&(m=p.getBoundingClientRect()).right<=e.left&&m.bottom>e.top&&i++}let f;zd&&i&&r.nodeType==1&&(f=r.childNodes[i-1]).nodeType==1&&f.contentEditable=="false"&&f.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(c=IF(t,r,i,e))}c==null&&(c=DF(t,a,e));let u=t.docView.nearestDesc(a,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function y0(t){return t.top<t.bottom||t.left<t.right}function Ys(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(y0(r))return r}return Array.prototype.find.call(n,y0)||t.getBoundingClientRect()}const zF=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function RN(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),a=zd||jr;if(r.nodeType==3)if(a&&(zF.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let u=Ys(Ji(r,i,i),n);if(jr&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let f=Ys(Ji(r,i-1,i-1),-1);if(f.top==u.top){let p=Ys(Ji(r,i,i+1),-1);if(p.top!=u.top)return Su(p,p.left<f.left)}}return u}else{let u=i,f=i,p=n<0?1:-1;return n<0&&!i?(f++,p=-1):n>=0&&i==r.nodeValue.length?(u--,p=1):n<0?u--:f++,Su(Ys(Ji(r,u,f),p),p<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Pr(r))){let u=r.childNodes[i-1];if(u.nodeType==1)return Hv(u.getBoundingClientRect(),!1)}if(s==null&&i<Pr(r)){let u=r.childNodes[i];if(u.nodeType==1)return Hv(u.getBoundingClientRect(),!0)}return Hv(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Pr(r))){let u=r.childNodes[i-1],f=u.nodeType==3?Ji(u,Pr(u)-(a?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(f)return Su(Ys(f,1),!1)}if(s==null&&i<Pr(r)){let u=r.childNodes[i];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let f=u?u.nodeType==3?Ji(u,0,a?0:1):u.nodeType==1?u:null:null;if(f)return Su(Ys(f,-1),!0)}return Su(Ys(r.nodeType==3?Ji(r):r,-n),n>=0)}function Su(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 Hv(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 MN(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function PF(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return MN(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let c=t.docView.nearestDesc(s,!0);if(!c)break;if(c.node.isBlock){s=c.contentDOM||c.dom;break}s=c.dom.parentNode}let a=RN(t,i.pos,1);for(let c=s.firstChild;c;c=c.nextSibling){let u;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=Ji(c,0,c.nodeValue.length).getClientRects();else continue;for(let f=0;f<u.length;f++){let p=u[f];if(p.bottom>p.top+1&&(n=="up"?a.top-p.top>(p.bottom-a.top)*2:p.bottom-a.bottom>(a.bottom-p.top)*2))return!1}}return!0})}const jF=/[\u0590-\u08ac]/;function BF(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,a=i==r.parent.content.size,c=t.domSelection();return c?!jF.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?s:a:MN(t,e,()=>{let{focusNode:u,focusOffset:f,anchorNode:p,anchorOffset:m}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let y=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:b,focusOffset:w}=t.domSelectionRange(),x=b&&!y.contains(b.nodeType==1?b:b.parentNode)||u==b&&f==w;try{c.collapse(p,m),u&&(u!=p||f!=m)&&c.extend&&c.extend(u,f)}catch{}return g!=null&&(c.caretBidiLevel=g),x}):r.pos==r.start()||r.pos==r.end()}let S_=null,w_=null,x_=!1;function $F(t,e,n){return S_==e&&w_==n?x_:(S_=e,w_=n,x_=n=="up"||n=="down"?PF(t,e,n):BF(t,e,n))}const Br=0,k_=1,da=2,si=3;class Pd{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Br,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,a;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((a=s.pmViewDesc)&&a.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(a)+a.size:this.posAtStart}else{let s,a;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((a=s.pmViewDesc)&&a.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(a):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>Mn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),a;if(s&&(!n||s.node))if(r&&(a=s.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let a=0;a<i.children.length;a++){let c=i.children[a];if(c.size){i=c;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let a=this.children[r],c=s+a.size;if(c>e||a instanceof NN){i=e-s;break}s=c}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof ON&&s.side>=0;r--);if(n<=0){let s,a=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,a=!1);return s&&n&&a&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Mn(s.dom)+1:0}}else{let s,a=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,a=!1);return s&&a&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?Mn(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let a=r,c=0;;c++){let u=this.children[c],f=a+u.size;if(i==-1&&e<=f){let p=a+u.border;if(e>=p&&n<=f-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,p);e=a;for(let m=c;m>0;m--){let g=this.children[m-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){i=Mn(g.dom)+1;break}e-=g.size}i==-1&&(i=0)}if(i>-1&&(f>n||c==this.children.length-1)){n=f;for(let p=c+1;p<this.children.length;p++){let m=this.children[p];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(-1)){s=Mn(m.dom);break}n+=m.size}s==-1&&(s=this.contentDOM.childNodes.length);break}a=f}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),a=Math.max(e,n);for(let y=0,b=0;y<this.children.length;y++){let w=this.children[y],x=b+w.size;if(s>b&&a<x)return w.setSelection(e-b-w.border,n-b-w.border,r,i);b=x}let c=this.domFromPos(e,e?-1:1),u=n==e?c:this.domFromPos(n,n?-1:1),f=r.root.getSelection(),p=r.domSelectionRange(),m=!1;if((jr||jn)&&e==n){let{node:y,offset:b}=c;if(y.nodeType==3){if(m=!!(b&&y.nodeValue[b-1]==`
|
|
70
|
-
`),m&&b==y.nodeValue.length)for(let w=y,x;w;w=w.parentNode){if(x=w.nextSibling){x.nodeName=="BR"&&(c=u={node:x.parentNode,offset:Mn(x)+1});break}let k=w.pmViewDesc;if(k&&k.node&&k.node.isBlock)break}}else{let w=y.childNodes[b-1];m=w&&(w.nodeName=="BR"||w.contentEditable=="false")}}if(jr&&p.focusNode&&p.focusNode!=u.node&&p.focusNode.nodeType==1){let y=p.focusNode.childNodes[p.focusOffset];y&&y.contentEditable=="false"&&(i=!0)}if(!(i||m&&jn)&&_a(c.node,c.offset,p.anchorNode,p.anchorOffset)&&_a(u.node,u.offset,p.focusNode,p.focusOffset))return;let g=!1;if((f.extend||e==n)&&!(m&&jr)){f.collapse(c.node,c.offset);try{e!=n&&f.extend(u.node,u.offset),g=!0}catch{}}if(!g){if(e>n){let b=c;c=u,u=b}let y=document.createRange();y.setEnd(u.node,u.offset),y.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(y)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],a=r+s.size;if(r==a?e<=a&&n>=r:e<a&&n>r){let c=r+s.border,u=a-s.border;if(e>=c&&n<=u){this.dirty=e==r||n==a?da:k_,e==c&&n==u&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=si:s.markDirty(e-c,n-c);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?da:si}r=a}this.dirty=da}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?da:k_;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class ON extends Pd{constructor(e,n,r,i){let s,a=n.type.toDOM;if(typeof a=="function"&&(a=a(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(a.nodeType!=1){let c=document.createElement("span");c.appendChild(a),a=c}a.contentEditable="false",a.classList.add("ProseMirror-widget")}super(e,[],a,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Br&&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 VF extends Pd{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class bo extends Pd{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],a=s&&s(n,i,r);return(!a||!a.dom)&&(a=ja.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new bo(e,n,a.dom,a.contentDOM||a.dom,a)}parseRule(){return this.dirty&si||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=si&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Br){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Br}}slice(e,n,r){let i=bo.create(this.parent,this.mark,!0,r),s=this.children,a=this.size;n<a&&(s=b0(s,n,a,r)),e>0&&(s=b0(s,0,e,r));for(let c=0;c<s.length;c++)s[c].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class So extends Pd{constructor(e,n,r,i,s,a,c){super(e,[],s,a),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=c}static create(e,n,r,i,s,a){let c=s.nodeViews[n.type.name],u,f=c&&c(n,s,()=>{if(!u)return a;if(u.parent)return u.parent.posBeforeChild(u)},r,i),p=f&&f.dom,m=f&&f.contentDOM;if(n.isText){if(!p)p=document.createTextNode(n.text);else if(p.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else p||({dom:p,contentDOM:m}=ja.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&p.nodeName!="BR"&&(p.hasAttribute("contenteditable")||(p.contentEditable="false"),n.type.spec.draggable&&(p.draggable=!0));let g=p;return p=LN(p,r,n),f?u=new HF(e,n,r,i,p,m||null,g,f):n.isText?new Dm(e,n,r,i,p,g):new So(e,n,r,i,p,m||null,g)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let n={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(n.preserveWhitespace="full"),!this.contentDOM)n.getContent=()=>this.node.content;else if(!this.contentLost)n.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let i=this.children[r];if(this.dom.contains(i.dom.parentNode)){n.contentElement=i.dom.parentNode;break}}if(!n.contentElement){let r=e&&e.find(i=>i.nodeType==1&&e.indexOf(i.parentNode)<0&&this.dom.contains(i));r?n.contentElement=r:n.getContent=()=>ne.empty}}return n}matchesNode(e,n,r){return this.dirty==Br&&e.eq(this.node)&&Tp(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,a=s&&s.pos>-1?s:null,c=s&&s.pos<0,u=new FF(this,a&&a.node,e);WF(this.node,this.innerDeco,(f,p,m)=>{f.spec.marks?u.syncToMarks(f.spec.marks,r,e,p):f.type.side>=0&&!m&&u.syncToMarks(p==this.node.childCount?Tt.none:this.node.child(p).marks,r,e,p),u.placeWidget(f,e,i)},(f,p,m,g)=>{u.syncToMarks(f.marks,r,e,g);let y;u.findNodeMatch(f,p,m,g)||c&&e.state.selection.from>i&&e.state.selection.to<i+f.nodeSize&&(y=u.findIndexWithChild(s.node))>-1&&u.updateNodeAt(f,p,m,y,e)||u.updateNextNode(f,p,m,e,g,i)||u.addNode(f,p,m,e,i),i+=f.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==da)&&(a&&this.protectLocalComposition(e,a),DN(this.contentDOM,this.children,e),oc&&KF(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof Ne)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let a=s.nodeValue,c=ZF(this.node.content,a,r-n,i-n);return c<0?null:{node:s,pos:c,text:a}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let a=new VF(this,s,n,i);e.input.compositionNodes.push(a),this.children=b0(this.children,r,r+i.length,e,a)}update(e,n,r,i){return this.dirty==si||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Br}updateOuterDeco(e){if(Tp(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=IN(this.dom,this.nodeDOM,v0(this.outerDeco,this.node,n),v0(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 C_(t,e,n,r,i){LN(r,e,t);let s=new So(void 0,t,e,n,r,r,r);return s.contentDOM&&s.updateChildren(i,0),s}class Dm extends So{constructor(e,n,r,i,s,a){super(e,n,r,i,s,null,a)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==si||this.dirty!=Br&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Br||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Br,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new Dm(this.parent,i,this.outerDeco,this.innerDeco,s,s)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=si)}get domAtom(){return!1}isText(e){return this.node.text==e}}class NN extends Pd{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Br&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class HF extends So{constructor(e,n,r,i,s,a,c,u){super(e,n,r,i,s,a,c),this.spec=u}update(e,n,r,i){if(this.dirty==si)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function DN(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let a=e[s],c=a.dom;if(c.parentNode==t){for(;c!=r;)r=E_(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(c,r);if(a instanceof bo){let u=r?r.previousSibling:t.lastChild;DN(a.contentDOM,a.children,n),r=u?u.nextSibling:t.firstChild}}for(;r;)r=E_(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Uu=function(t){t&&(this.nodeName=t)};Uu.prototype=Object.create(null);const fa=[new Uu];function v0(t,e,n){if(t.length==0)return fa;let r=n?fa[0]:new Uu,i=[r];for(let s=0;s<t.length;s++){let a=t[s].type.attrs;if(a){a.nodeName&&i.push(r=new Uu(a.nodeName));for(let c in a){let u=a[c];u!=null&&(n&&i.length==1&&i.push(r=new Uu(e.isInline?"span":"div")),c=="class"?r.class=(r.class?r.class+" ":"")+u:c=="style"?r.style=(r.style?r.style+";":"")+u:c!="nodeName"&&(r[c]=u))}}}return i}function IN(t,e,n,r){if(n==fa&&r==fa)return e;let i=e;for(let s=0;s<r.length;s++){let a=r[s],c=n[s];if(s){let u;c&&c.nodeName==a.nodeName&&i!=t&&(u=i.parentNode)&&u.nodeName.toLowerCase()==a.nodeName||(u=document.createElement(a.nodeName),u.pmIsDeco=!0,u.appendChild(i),c=fa[0]),i=u}UF(i,c||fa[0],a)}return i}function UF(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function LN(t,e,n){return IN(t,t,fa,v0(e,n,t.nodeType!=1))}function Tp(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 E_(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class FF{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=qF(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let s=0,a=this.stack.length>>1,c=Math.min(a,e.length);for(;s<c&&(s==a-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<a;)this.destroyRest(),this.top.dirty=Br,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let u=-1,f=this.top.children.length;i<this.preMatch.index&&(f=Math.min(this.index+3,f));for(let p=this.index;p<f;p++){let m=this.top.children[p];if(m.matchesMark(e[a])&&!this.isLocked(m.dom)){u=p;break}}if(u<0&&this.index<this.top.children.length){let p=this.top.children[this.index];p instanceof bo&&p.dirty!=si&&p.mark.type==e[a].type&&p.spec.update&&!this.isLocked(p.dom)&&p.spec.update(e[a])&&(p.mark=e[a],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 p=bo.create(this.top,e[a],n,r);this.top.children.splice(this.index,0,p),this.top=p,this.changed=!0}this.index=0,a++}}findNodeMatch(e,n,r,i){let s=-1,a;if(i>=this.preMatch.index&&(a=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&a.matchesNode(e,n,r))s=this.top.children.indexOf(a,this.index);else for(let c=this.index,u=Math.min(this.top.children.length,c+5);c<u;c++){let f=this.top.children[c];if(f.matchesNode(e,n,r)&&!this.preMatch.matched.has(f)){s=c;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let a=this.top.children[i];return a.dirty==si&&a.dom==a.contentDOM&&(a.dirty=da),a.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,a){for(let c=this.index;c<this.top.children.length;c++){let u=this.top.children[c];if(u instanceof So){let f=this.preMatch.matched.get(u);if(f!=null&&f!=s)return!1;let p=u.dom,m,g=this.isLocked(p)&&!(e.isText&&u.node&&u.node.isText&&u.nodeDOM.nodeValue==e.text&&u.dirty!=si&&Tp(n,u.outerDeco));if(!g&&u.update(e,n,r,i))return this.destroyBetween(this.index,c),u.dom!=p&&(this.changed=!0),this.index++,!0;if(!g&&(m=this.recreateWrapper(u,e,n,r,i,a)))return this.destroyBetween(this.index,c),this.top.children[this.index]=m,m.contentDOM&&(m.dirty=da,m.updateChildren(i,a+1),m.dirty=Br),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,a){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Tp(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let c=So.create(this.top,n,r,i,s,a);if(c.contentDOM){c.children=e.children,e.children=[];for(let u of c.children)u.parent=c}return e.destroy(),c}addNode(e,n,r,i,s){let a=So.create(this.top,e,n,r,i,s);a.contentDOM&&a.updateChildren(i,s+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new ON(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof bo;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Dm)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((jn||Nn)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new NN(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function qF(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,a=[];e:for(;i>0;){let c;for(;;)if(r){let f=n.children[r-1];if(f instanceof bo)n=f,r=f.children.length;else{c=f,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=c.node;if(u){if(u!=t.child(i-1))break;--i,s.set(c,i),a.push(c)}}return{index:i,matched:s,matches:a.reverse()}}function GF(t,e){return t.type.side-e.type.side}function WF(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let f=0;f<t.childCount;f++){let p=t.child(f);r(p,i,e.forChild(s,p),f),s+=p.nodeSize}return}let a=0,c=[],u=null;for(let f=0;;){let p,m;for(;a<i.length&&i[a].to==s;){let x=i[a++];x.widget&&(p?(m||(m=[p])).push(x):p=x)}if(p)if(m){m.sort(GF);for(let x=0;x<m.length;x++)n(m[x],f,!!u)}else n(p,f,!!u);let g,y;if(u)y=-1,g=u,u=null;else if(f<t.childCount)y=f,g=t.child(f++);else break;for(let x=0;x<c.length;x++)c[x].to<=s&&c.splice(x--,1);for(;a<i.length&&i[a].from<=s&&i[a].to>s;)c.push(i[a++]);let b=s+g.nodeSize;if(g.isText){let x=b;a<i.length&&i[a].from<x&&(x=i[a].from);for(let k=0;k<c.length;k++)c[k].to<x&&(x=c[k].to);x<b&&(u=g.cut(x-s),g=g.cut(0,x-s),b=x,y=-1)}else for(;a<i.length&&i[a].to<b;)a++;let w=g.isInline&&!g.isLeaf?c.filter(x=>!x.inline):c.slice();r(g,w,e.forChild(s,g),y),s=b}}function KF(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 ZF(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let a=t.child(i++),c=s;if(s+=a.nodeSize,!a.isText)continue;let u=a.text;for(;i<t.childCount;){let f=t.child(i++);if(s+=f.nodeSize,!f.isText)break;u+=f.text}if(s>=n){if(s>=r&&u.slice(r-e.length-c,r-c)==e)return r-e.length;let f=c<r?u.lastIndexOf(e,r-c-1):-1;if(f>=0&&f+e.length+c>=n)return c+f;if(n==r&&u.length>=r+e.length-c&&u.slice(r-c,r-c+e.length)==e)return r}}return-1}function b0(t,e,n,r,i){let s=[];for(let a=0,c=0;a<t.length;a++){let u=t[a],f=c,p=c+=u.size;f>=n||p<=e?s.push(u):(f<e&&s.push(u.slice(0,e-f,r)),i&&(s.push(i),i=void 0),p>n&&s.push(u.slice(n-f,u.size,r)))}return s}function aw(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,a=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(a<0)return null;let c=r.resolve(a),u,f;if(Nm(n)){for(u=a;i&&!i.node;)i=i.parent;let m=i.node;if(i&&m.isAtom&&Ie.isSelectable(m)&&i.parent&&!(m.isInline&&xF(n.focusNode,n.focusOffset,i.dom))){let g=i.posBefore;f=new Ie(a==g?c:r.resolve(g))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=a,g=a;for(let y=0;y<n.rangeCount;y++){let b=n.getRangeAt(y);m=Math.min(m,t.docView.posFromDOM(b.startContainer,b.startOffset,1)),g=Math.max(g,t.docView.posFromDOM(b.endContainer,b.endOffset,-1))}if(m<0)return null;[u,a]=g==t.state.selection.anchor?[g,m]:[m,g],c=r.resolve(a)}else u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null}let p=r.resolve(u);if(!f){let m=e=="pointer"||t.state.selection.head<c.pos&&!s?1:-1;f=lw(t,p,c,m)}return f}function zN(t){return t.editable?t.hasFocus():jN(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function fs(t,e=!1){let n=t.state.selection;if(PN(t,n),!zN(t))return;let r=t.input.mouseDown;if(!e&&Nn&&r){let i=t.domSelectionRange(),s=t.domObserver.currentSelection;if(i.anchorNode&&s.anchorNode&&_a(i.anchorNode,i.anchorOffset,s.anchorNode,s.anchorOffset)&&r.delaySelUpdate()){t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)XF(t);else{let{anchor:i,head:s}=n,a,c;T_&&!(n instanceof Ne)&&(n.$from.parent.inlineContent||(a=__(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(c=__(t,n.to))),t.docView.setSelection(i,s,t,e),T_&&(a&&A_(a),c&&A_(c)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&YF(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}const T_=jn||Nn&&kN<63;function __(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(jn&&i&&i.contentEditable=="false")return Uv(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Uv(i);if(s)return Uv(s)}}function Uv(t){return t.contentEditable="true",jn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function A_(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function YF(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!zN(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function XF(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Mn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&or&&vo<=11&&(n.disabled=!0,n.disabled=!1)}function PN(t,e){if(e instanceof Ie){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(R_(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else R_(t)}function R_(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function lw(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Ne.between(e,n,r)}function M_(t){return t.editable&&!t.hasFocus()?!1:jN(t)}function jN(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 JF(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return _a(e.node,e.offset,n.anchorNode,n.anchorOffset)}function S0(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&$e.findFrom(s,e)}function Qs(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function O_(t,e,n){let r=t.state.selection;if(r instanceof Ne)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let a=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Qs(t,new Ne(r.$anchor,a))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=S0(t.state,e);return i&&i instanceof Ie?Qs(t,i):!1}else if(!(Lr&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,a;if(!s||s.isText)return!1;let c=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(a=t.docView.descAt(c))&&!a.contentDOM?Ie.isSelectable(s)?Qs(t,new Ie(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):zd?Qs(t,new Ne(t.state.doc.resolve(e<0?c:c+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Ie&&r.node.isInline)return Qs(t,new Ne(e>0?r.$to:r.$from));{let i=S0(t.state,e);return i?Qs(t,i):!1}}}function _p(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Fu(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ml(t,e){return e<0?QF(t):e4(t)}function QF(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,a=!1;for(jr&&n.nodeType==1&&r<_p(n)&&Fu(n.childNodes[r],-1)&&(a=!0);;)if(r>0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(Fu(c,-1))i=n,s=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(BN(n))break;{let c=n.previousSibling;for(;c&&Fu(c,-1);)i=n.parentNode,s=Mn(c),c=c.previousSibling;if(c)n=c,r=_p(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}a?w0(t,n,r):i&&w0(t,i,s)}function e4(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=_p(n),s,a;for(;;)if(r<i){if(n.nodeType!=1)break;let c=n.childNodes[r];if(Fu(c,1))s=n,a=++r;else break}else{if(BN(n))break;{let c=n.nextSibling;for(;c&&Fu(c,1);)s=c.parentNode,a=Mn(c)+1,c=c.nextSibling;if(c)n=c,r=0,i=_p(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&w0(t,s,a)}function BN(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function t4(t,e){for(;t&&e==t.childNodes.length&&!Ld(t);)e=Mn(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 n4(t,e){for(;t&&!e&&!Ld(t);)e=Mn(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 w0(t,e,n){if(e.nodeType!=3){let s,a;(a=t4(e,n))?(e=a,n=0):(s=n4(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Nm(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&fs(t)},50)}function N_(t,e){let n=t.state.doc.resolve(e);if(!(Nn||CN)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),a=(s.top+s.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),a=(s.top+s.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function D_(t,e,n){let r=t.state.selection;if(r instanceof Ne&&!r.empty||n.indexOf("s")>-1||Lr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let a=S0(t.state,e);if(a&&a instanceof Ie)return Qs(t,a)}if(!i.parent.inlineContent){let a=e<0?i:s,c=r instanceof Sr?$e.near(a,e):$e.findFrom(a,e);return c?Qs(t,c):!1}return!1}function I_(t,e){if(!(t.state.selection instanceof Ne))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let a=t.state.tr;return e<0?a.delete(n.pos-s.nodeSize,n.pos):a.delete(n.pos,n.pos+s.nodeSize),t.dispatch(a),!0}return!1}function L_(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function r4(t){if(!jn||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;L_(t,r,"true"),setTimeout(()=>L_(t,r,"false"),20)}return!1}function i4(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function s4(t,e){let n=e.keyCode,r=i4(e);if(n==8||Lr&&n==72&&r=="c")return I_(t,-1)||Ml(t,-1);if(n==46&&!e.shiftKey||Lr&&n==68&&r=="c")return I_(t,1)||Ml(t,1);if(n==13||n==27)return!0;if(n==37||Lr&&n==66&&r=="c"){let i=n==37?N_(t,t.state.selection.from)=="ltr"?-1:1:-1;return O_(t,i,r)||Ml(t,i)}else if(n==39||Lr&&n==70&&r=="c"){let i=n==39?N_(t,t.state.selection.from)=="ltr"?1:-1:1;return O_(t,i,r)||Ml(t,i)}else{if(n==38||Lr&&n==80&&r=="c")return D_(t,-1,r)||Ml(t,-1);if(n==40||Lr&&n==78&&r=="c")return r4(t)||D_(t,1,r)||Ml(t,1);if(r==(Lr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function cw(t,e){t.someProp("transformCopied",y=>{e=y(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let y=r.firstChild;n.push(y.type.name,y.attrs!=y.type.defaultAttrs?y.attrs:null),r=y.content}let a=t.someProp("clipboardSerializer")||ja.fromSchema(t.state.schema),c=qN(),u=c.createElement("div");u.appendChild(a.serializeFragment(r,{document:c}));let f=u.firstChild,p,m=0;for(;f&&f.nodeType==1&&(p=FN[f.nodeName.toLowerCase()]);){for(let y=p.length-1;y>=0;y--){let b=c.createElement(p[y]);for(;u.firstChild;)b.appendChild(u.firstChild);u.appendChild(b),m++}f=u.firstChild}f&&f.nodeType==1&&f.setAttribute("data-pm-slice",`${i} ${s}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",y=>y(e,t))||e.content.textBetween(0,e.content.size,`
|
|
71
|
-
|
|
72
|
-
`);return{dom:u,text:g,slice:e}}function $N(t,e,n,r,i){let s=i.parent.type.spec.code,a,c;if(!n&&!e)return null;let u=!!e&&(r||s||!n);if(u){if(t.someProp("transformPastedText",g=>{e=g(e,s||r,t)}),s)return c=new we(ne.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
73
|
-
`))),0,0),t.someProp("transformPasted",g=>{c=g(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",g=>g(e,i,r,t));if(m)c=m;else{let g=i.marks(),{schema:y}=t.state,b=ja.fromSchema(y);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let x=a.appendChild(document.createElement("p"));w&&x.appendChild(b.serializeNode(y.text(w,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),a=c4(n),zd&&u4(a);let f=a&&a.querySelector("[data-pm-slice]"),p=f&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(f.getAttribute("data-pm-slice")||"");if(p&&p[3])for(let m=+p[3];m>0;m--){let g=a.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;a=g}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||us.fromSchema(t.state.schema)).parseSlice(a,{preserveWhitespace:!!(u||p),context:i,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!o4.test(g.parentNode.nodeName)?{ignore:!0}:null}})),p)c=d4(z_(c,+p[1],+p[2]),p[4]);else if(c=we.maxOpen(a4(c.content,i),!0),c.openStart||c.openEnd){let m=0,g=0;for(let y=c.content.firstChild;m<c.openStart&&!y.type.spec.isolating;m++,y=y.firstChild);for(let y=c.content.lastChild;g<c.openEnd&&!y.type.spec.isolating;g++,y=y.lastChild);c=z_(c,m,g)}return t.someProp("transformPasted",m=>{c=m(c,t,u)}),c}const o4=/^(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 a4(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,a=[];if(t.forEach(c=>{if(!a)return;let u=i.findWrapping(c.type),f;if(!u)return a=null;if(f=a.length&&s.length&&HN(u,s,c,a[a.length-1],0))a[a.length-1]=f;else{a.length&&(a[a.length-1]=UN(a[a.length-1],s.length));let p=VN(c,u);a.push(p),i=i.matchType(p.type),s=u}}),a)return ne.from(a)}return t}function VN(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,ne.from(t));return t}function HN(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=HN(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(ne.from(VN(n,t,i+1))))}}function UN(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,UN(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(ne.empty,!0);return t.copy(n.append(r))}function x0(t,e,n,r,i,s){let a=e<0?t.firstChild:t.lastChild,c=a.content;return t.childCount>1&&(s=0),i<r-1&&(c=x0(c,e,n,r,i+1,s)),i>=n&&(c=e<0?a.contentMatchAt(0).fillBefore(c,s<=i).append(c):c.append(a.contentMatchAt(a.childCount).fillBefore(ne.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(c))}function z_(t,e,n){return e<t.openStart&&(t=new we(x0(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new we(x0(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const FN={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 qN(){return document.implementation.createHTMLDocument("title")}let Fv=null;function l4(t){let e=window.trustedTypes;return e?(Fv||(Fv=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Fv.createHTML(t)):t}function c4(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=qN(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(t),s;if((s=i&&FN[i[1].toLowerCase()])&&(t=s.map(a=>"<"+a+">").join("")+t+s.map(a=>"</"+a+">").reverse().join("")),r.innerHTML=l4(t),s)for(let a=0;a<s.length;a++)r=r.querySelector(s[a])||r;for(let a=0;a<n.styleSheets.length;a++){let c=n.styleSheets[a];for(let u=0;u<c.rules.length;u++){let f=c.rules[u];if(f instanceof CSSStyleRule){let p=r.querySelectorAll(f.selectorText);for(let m=0;m<p.length;m++)p[m].style.cssText+=f.style.cssText}}}return r}function u4(t){let e=t.querySelectorAll(Nn?"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 d4(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:a}=t;for(let c=r.length-2;c>=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;i=ne.from(u.create(r[c+1],i)),s++,a++}return new we(i,s,a)}const Kn={},Zn={},f4={touchstart:!0,touchmove:!0};class h4{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 p4(t){for(let e in Kn){let n=Kn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{g4(t,r)&&!uw(t,r)&&(t.editable||!(r.type in Zn))&&n(t,r)},f4[e]?{passive:!0}:void 0)}jn&&t.dom.addEventListener("input",()=>null),k0(t)}function cs(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function m4(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 k0(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>uw(t,r))})}function uw(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function g4(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 y4(t,e){!uw(t,e)&&Kn[e.type]&&(t.editable||!(e.type in Zn))&&Kn[e.type](t,e)}Zn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!ZN(t)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ls&&Nn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),oc&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,aa(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||s4(t,n)?n.preventDefault():cs(t,"key")};Zn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Zn.keypress=(t,e)=>{let n=e;if(ZN(t)||!n.charCode||n.ctrlKey&&!n.altKey||Lr&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Ne)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",a=>a(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function jd(t){return{left:t.clientX,top:t.clientY}}function v4(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function dw(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let a=s.depth+1;a>0;a--)if(t.someProp(e,c=>a>s.depth?c(t,n,s.nodeAfter,s.before(a),i,!0):c(t,n,s.node(a),s.before(a),i,!1)))return!0;return!1}function Bd(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 b4(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Ie.isSelectable(r)?(Bd(t,new Ie(n)),!0):!1}function S4(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Ie&&(r=n.node);let s=t.state.doc.resolve(e);for(let a=s.depth+1;a>0;a--){let c=a>s.depth?s.nodeAfter:s.node(a);if(Ie.isSelectable(c)){r&&n.$from.depth>0&&a>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(a);break}}return i!=null?(Bd(t,Ie.create(t.state.doc,i)),!0):!1}function w4(t,e,n,r,i){return dw(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?S4(t,n):b4(t,n))}function x4(t,e,n,r){return dw(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function k4(t,e,n,r){return dw(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||C4(t,n,r)}function C4(t,e,n){if(n.button!=0)return!1;let r=GN(t,e,!0),i=t.state.doc;return r?(Bd(t,r),r instanceof Ne&&i.eq(t.state.doc)&&(t.input.mouseDown=new T4(t,r)),!0):!1}function GN(t,e,n){let r=t.state.doc;if(e==-1)return r.inlineContent?Ne.create(r,0,r.content.size):null;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s),c=i.before(s);if(a.inlineContent)return Ne.create(r,c+1,c+1+a.content.size);if(n&&Ie.isSelectable(a))return Ie.create(r,c)}return null}function fw(t){return Ap(t)}const WN=Lr?"metaKey":"ctrlKey";Kn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=fw(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&v4(n,t.input.lastClick)&&!n[WN]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button},t.input.mouseDown&&t.input.mouseDown.done();let a=t.posAtCoords(jd(n));a&&(s=="singleClick"?t.input.mouseDown=new E4(t,a,n,!!r):(s=="doubleClick"?x4:k4)(t,a.pos,a.inside,n)?n.preventDefault():cs(t,"pointer"))};class KN{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 E4 extends KN{constructor(e,n,r,i){super(e),this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[WN],this.allowDefault=r.shiftKey;let s,a;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),a=n.inside;else{let p=e.state.doc.resolve(n.pos);s=p.parent,a=p.depth?p.before():0}const c=i?null:r.target,u=c?e.docView.nearestDesc(c,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:f}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||f instanceof Ie&&f.from<=a&&f.to>a)&&(this.mightDrag={node:s,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&jr&&!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()),cs(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||fs(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(jd(e))),this.updateAllowDefault(e),this.allowDefault||!n?cs(this.view,"pointer"):w4(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||jn&&this.mightDrag&&!this.mightDrag.node.isAtom||Nn&&!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)?(Bd(this.view,$e.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):cs(this.view,"pointer")}move(e){this.updateAllowDefault(e),cs(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 T4 extends KN{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(),cs(this.view,"pointer");let n=this.view.posAtCoords(jd(e)),r=n&&GN(this.view,n.inside,!1);if(!r)return;let{doc:i}=this.view.state,s=this.startSelection,[a,c]=r.from<s.from?[s.to,r.from]:[s.from,r.to];Bd(this.view,Ne.create(i,a,c))}}Kn.touchstart=t=>{t.input.lastTouch=Date.now(),fw(t),cs(t,"pointer")};Kn.touchmove=t=>{t.input.lastTouch=Date.now(),cs(t,"pointer")};Kn.contextmenu=t=>fw(t);function ZN(t,e){return t.composing?!0:jn&&Math.abs(Date.now()-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const _4=ls?5e3:-1;Zn.compositionstart=Zn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Ne&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Nn&&CN&&A4(t)))t.markCursor=t.state.storedMarks||n.marks(),Ap(t,!0),t.markCursor=null;else if(Ap(t,!e.selection.empty),jr&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let a=s<0?i.lastChild:i.childNodes[s-1];if(!a)break;if(a.nodeType==3){let c=t.domSelection();c&&c.collapse(a,a.nodeValue.length);break}else i=a,s=-1}}t.input.composing=!0}YN(t,_4)};function A4(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"}Zn.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++,YN(t,20))};function YN(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Ap(t),e))}function XN(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function R4(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=SF(e.focusNode,e.focusOffset),r=wF(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let a=n.pmViewDesc;if(!(!a||!a.isText(n.nodeValue)))return r}}return n||r}function Ap(t,e=!1){if(!(ls&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),XN(t),e||t.docView&&t.docView.dirty){let n=aw(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 M4(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const pd=or&&vo<15||oc&&EF<604;Kn.copy=Zn.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=pd?null:n.clipboardData,a=r.content(),{dom:c,text:u}=cw(t,a);s?(n.preventDefault(),s.clearData(),s.setData("text/html",c.innerHTML),s.setData("text/plain",u)):M4(t,c),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function O4(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function N4(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?md(t,r.value,null,i,e):md(t,r.textContent,r.innerHTML,i,e)},50)}function md(t,e,n,r,i){let s=$N(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,i,s||we.empty)))return!0;if(!s)return!1;let a=O4(s),c=a?t.state.tr.replaceSelectionWith(a,r):t.state.tr.replaceSelection(s);return t.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function JN(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," "):""}Zn.paste=(t,e)=>{let n=e;if(t.composing&&!ls)return;let r=pd?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&md(t,JN(r),r.getData("text/html"),i,n)?n.preventDefault():N4(t,n)};class QN{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const D4=Lr?"altKey":"ctrlKey";function eD(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[D4]}Kn.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(jd(n)),a;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof Ie?i.to-1:i.to))){if(r&&r.mightDrag)a=Ie.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&&(a=Ie.create(t.state.doc,m.posBefore))}}let c=(a||t.state.selection).content(),{dom:u,text:f,slice:p}=cw(t,c);(!n.dataTransfer.files.length||!Nn||kN>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(pd?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",pd||n.dataTransfer.setData("text/plain",f),t.dragging=new QN(p,eD(t,n),a)};Kn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Zn.dragover=Zn.dragenter=(t,e)=>e.preventDefault();Zn.drop=(t,e)=>{try{I4(t,e,t.dragging)}finally{t.dragging=null}};function I4(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(jd(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",y=>{s=y(s,t,!1)}):s=$N(t,JN(e.dataTransfer),pd?null:e.dataTransfer.getData("text/html"),!1,i);let a=!!(n&&eD(t,e));if(t.someProp("handleDrop",y=>y(t,e,s||we.empty,a))){e.preventDefault();return}if(!s)return;e.preventDefault();let c=s?tN(t.state.doc,i.pos,s):i.pos;c==null&&(c=i.pos);let u=t.state.tr;if(a){let{node:y}=n;y?y.replace(u):u.deleteSelection()}let f=u.mapping.map(c),p=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,m=u.doc;if(p?u.replaceRangeWith(f,f,s.content.firstChild):u.replaceRange(f,f,s),u.doc.eq(m))return;let g=u.doc.resolve(f);if(p&&Ie.isSelectable(s.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new Ie(g));else{let y=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((b,w,x,k)=>y=k),u.setSelection(lw(t,g,u.doc.resolve(y)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}Kn.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())&&fs(t)},20))};Kn.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)};Kn.beforeinput=(t,e)=>{if(ls&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,aa(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Zn)Kn[t]=Zn[t];function gd(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 Rp{constructor(e,n){this.toDOM=e,this.spec=n||va,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:a}=e.mapResult(n.from+i,this.side<0?-1:1);return a?null:new mn(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Rp&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&gd(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class wo{constructor(e,n){this.attrs=e,this.spec=n||va}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,a=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=a?null:new mn(s,a,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof wo&&gd(this.attrs,e.attrs)&&gd(this.spec,e.spec)}static is(e){return e.type instanceof wo}destroy(){}}class hw{constructor(e,n){this.attrs=e,this.spec=n||va}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let a=e.mapResult(n.to+i,-1);return a.deleted||a.pos<=s.pos?null:new mn(s.pos-r,a.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof hw&&gd(this.attrs,e.attrs)&&gd(this.spec,e.spec)}destroy(){}}class mn{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new mn(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 mn(e,e,new Rp(n,r))}static inline(e,n,r,i){return new mn(e,n,new wo(r,i))}static node(e,n,r,i){return new mn(e,n,new hw(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof wo}get widget(){return this.type instanceof Rp}}const Pl=[],va={};class yt{constructor(e,n){this.local=e.length?e:Pl,this.children=n.length?n:Pl}static create(e,n){return n.length?Mp(n,e,0,va):zn}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let a=0;a<this.local.length;a++){let c=this.local[a];c.from<=n&&c.to>=e&&(!s||s(c.spec))&&r.push(c.copy(c.from+i,c.to+i))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<n&&this.children[a+1]>e){let c=this.children[a]+1;this.children[a+2].findInner(e-c,n-c,r,i+c,s)}}map(e,n,r){return this==zn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||va)}mapInner(e,n,r,i,s){let a;for(let c=0;c<this.local.length;c++){let u=this.local[c].map(e,r,i);u&&u.type.valid(n,u)?(a||(a=[])).push(u):s.onRemove&&s.onRemove(this.local[c].spec)}return this.children.length?L4(this.children,a||[],e,n,r,i,s):a?new yt(a.sort(ba),Pl):zn}add(e,n){return n.length?this==zn?yt.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((c,u)=>{let f=u+r,p;if(p=nD(n,c,f)){for(i||(i=this.children.slice());s<i.length&&i[s]<u;)s+=3;i[s]==u?i[s+2]=i[s+2].addInner(c,p,f+1):i.splice(s,0,u,u+c.nodeSize,Mp(p,c,f+1,va)),s+=3}});let a=tD(s?rD(n):n,-r);for(let c=0;c<a.length;c++)a[c].type.valid(e,a[c])||a.splice(c--,1);return new yt(a.length?this.local.concat(a).sort(ba):this.local,i||this.children)}remove(e){return e.length==0||this==zn?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let a,c=r[s]+n,u=r[s+1]+n;for(let p=0,m;p<e.length;p++)(m=e[p])&&m.from>c&&m.to<u&&(e[p]=null,(a||(a=[])).push(m));if(!a)continue;r==this.children&&(r=this.children.slice());let f=r[s+2].removeInner(a,c+1);f!=zn?r[s+2]=f:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,a;s<e.length;s++)if(a=e[s])for(let c=0;c<i.length;c++)i[c].eq(a,n)&&(i==this.local&&(i=this.local.slice()),i.splice(c--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new yt(i,r):zn}forChild(e,n){if(this==zn)return this;if(n.isLeaf)return yt.empty;let r,i;for(let c=0;c<this.children.length;c+=3)if(this.children[c]>=e){this.children[c]==e&&(r=this.children[c+2]);break}let s=e+1,a=s+n.content.size;for(let c=0;c<this.local.length;c++){let u=this.local[c];if(u.from<a&&u.to>s&&u.type instanceof wo){let f=Math.max(s,u.from)-s,p=Math.min(a,u.to)-s;f<p&&(i||(i=[])).push(u.copy(f,p))}}if(i){let c=new yt(i.sort(ba),Pl);return r?new oo([c,r]):c}return r||zn}eq(e){if(this==e)return!0;if(!(e instanceof yt)||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 pw(this.localsInner(e))}localsInner(e){if(this==zn)return Pl;if(e.inlineContent||!this.local.some(wo.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof wo||n.push(this.local[r]);return n}forEachSet(e){e(this)}}yt.empty=new yt([],[]);yt.removeOverlap=pw;const zn=yt.empty;class oo{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,va));return oo.from(r)}forChild(e,n){if(n.isLeaf)return yt.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=zn&&(s instanceof oo?r=r.concat(s.members):r.push(s))}return oo.from(r)}eq(e){if(!(e instanceof oo)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let a=0;a<s.length;a++)n.push(s[a])}}return n?pw(r?n:n.sort(ba)):Pl}static from(e){switch(e.length){case 0:return zn;case 1:return e[0];default:return new oo(e.every(n=>n instanceof yt)?e:e.reduce((n,r)=>n.concat(r instanceof yt?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function L4(t,e,n,r,i,s,a){let c=t.slice();for(let f=0,p=s;f<n.maps.length;f++){let m=0;n.maps[f].forEach((g,y,b,w)=>{let x=w-b-(y-g);for(let k=0;k<c.length;k+=3){let T=c[k+1];if(T<0||g>T+p-m)continue;let A=c[k]+p-m;y>=A?c[k+1]=g<=A?-2:-1:g>=p&&x&&(c[k]+=x,c[k+1]+=x)}m+=x}),p=n.maps[f].map(p,-1)}let u=!1;for(let f=0;f<c.length;f+=3)if(c[f+1]<0){if(c[f+1]==-2){u=!0,c[f+1]=-1;continue}let p=n.map(t[f]+s),m=p-i;if(m<0||m>=r.content.size){u=!0;continue}let g=n.map(t[f+1]+s,-1),y=g-i,{index:b,offset:w}=r.content.findIndex(m),x=r.maybeChild(b);if(x&&w==m&&w+x.nodeSize==y){let k=c[f+2].mapInner(n,x,p+1,t[f]+s+1,a);k!=zn?(c[f]=m,c[f+1]=y,c[f+2]=k):(c[f+1]=-2,u=!0)}else u=!0}if(u){let f=z4(c,t,e,n,i,s,a),p=Mp(f,r,0,a);e=p.local;for(let m=0;m<c.length;m+=3)c[m+1]<0&&(c.splice(m,3),m-=3);for(let m=0,g=0;m<p.children.length;m+=3){let y=p.children[m];for(;g<c.length&&c[g]<y;)g+=3;c.splice(g,0,p.children[m],p.children[m+1],p.children[m+2])}}return new yt(e.sort(ba),c)}function tD(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new mn(i.from+e,i.to+e,i.type))}return n}function z4(t,e,n,r,i,s,a){function c(u,f){for(let p=0;p<u.local.length;p++){let m=u.local[p].map(r,i,f);m?n.push(m):a.onRemove&&a.onRemove(u.local[p].spec)}for(let p=0;p<u.children.length;p+=3)c(u.children[p+2],u.children[p]+f+1)}for(let u=0;u<t.length;u+=3)t[u+1]==-1&&c(t[u+2],e[u]+s+1);return n}function nD(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,a;s<t.length;s++)(a=t[s])&&a.from>n&&a.to<r&&((i||(i=[])).push(a),t[s]=null);return i}function rD(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Mp(t,e,n,r){let i=[],s=!1;e.forEach((c,u)=>{let f=nD(t,c,u+n);if(f){s=!0;let p=Mp(f,c,n+u+1,r);p!=zn&&i.push(u,u+c.nodeSize,p)}});let a=tD(s?rD(t):t,-n).sort(ba);for(let c=0;c<a.length;c++)a[c].type.valid(e,a[c])||(r.onRemove&&r.onRemove(a[c].spec),a.splice(c--,1));return a.length||i.length?new yt(a,i):zn}function ba(t,e){return t.from-e.from||t.to-e.to}function pw(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),P_(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),P_(e,i,r.copy(s.from,r.to)));break}}}return e}function P_(t,e,n){for(;e<t.length&&ba(n,t[e])>0;)e++;t.splice(e,0,n)}function qv(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=zn&&e.push(r)}),t.cursorWrapper&&e.push(yt.create(t.state.doc,[t.cursorWrapper.deco])),oo.from(e)}const P4={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},j4=or&&vo<=11;class B4{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 $4{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new B4,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);or&&vo<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():jn&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),j4&&(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,P4)),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(M_(this.view)){if(this.suppressingSelectionUpdates)return fs(this.view);if(or&&vo<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&_a(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=sc(s))n.add(s);for(let s=e.anchorNode;s;s=sc(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&M_(e)&&!this.ignoreSelectionChange(r),s=-1,a=-1,c=!1,u=[];if(e.editable)for(let p=0;p<n.length;p++){let m=this.registerMutation(n[p],u);m&&(s=s<0?m.from:Math.min(m.from,s),a=a<0?m.to:Math.max(m.to,a),m.typeOver&&(c=!0))}if(u.some(p=>p.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||Nn&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&n.some(p=>p.type=="childList"&&p.removedNodes.length))){for(let p of u)if(p.nodeName=="BR"&&p.parentNode){let m=p.nextSibling;for(;m&&m.nodeType==1;){if(m.contentEditable=="false"){p.parentNode.removeChild(p);break}m=m.firstChild}}}else if(jr&&u.length){let p=u.filter(m=>m.nodeName=="BR");if(p.length==2){let[m,g]=p;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of p){let y=g.parentNode;y&&y.nodeName=="LI"&&(!m||U4(e,m)!=y)&&g.remove()}}}let f=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Nm(r)&&(f=aw(e))&&f.eq($e.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,fs(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,a),V4(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,F4(e,u)),this.handleDOMChange(s,a,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||fs(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 p=0;p<e.addedNodes.length;p++){let m=e.addedNodes[p];n.push(m),m.nodeType==3&&(this.lastChangedTextNode=m)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(or&&vo<=11&&e.addedNodes.length)for(let p=0;p<e.addedNodes.length;p++){let{previousSibling:m,nextSibling:g}=e.addedNodes[p];(!m||Array.prototype.indexOf.call(e.addedNodes,m)<0)&&(i=m),(!g||Array.prototype.indexOf.call(e.addedNodes,g)<0)&&(s=g)}let a=i&&i.parentNode==e.target?Mn(i)+1:0,c=r.localPosFromDOM(e.target,a,-1),u=s&&s.parentNode==e.target?Mn(s):e.target.childNodes.length,f=r.localPosFromDOM(e.target,u,1);return{from:c,to:f}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let j_=new WeakMap,B_=!1;function V4(t){if(!j_.has(t)&&(j_.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=jr,B_)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."),B_=!0}}function $_(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,a=t.domAtPos(t.state.selection.anchor);return _a(a.node,a.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function H4(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return $_(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?$_(t,n):null}function U4(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 F4(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let a=s.nextSibling;for(;a&&a.nodeName!="TD"&&a.nodeName!="TH";)a=a.nextSibling;if(a){let c=a;for(;;){let u=c.firstChild;if(!u||u.nodeType!=1||u.contentEditable=="false"||/^(BR|IMG)$/.test(u.nodeName))break;c=u}c.insertBefore(s,c.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function q4(t,e,n,r){let{node:i,fromOffset:s,toOffset:a,from:c,to:u}=t.docView.parseRange(e,n),f=t.domSelectionRange(),p,m=f.anchorNode;if(m&&t.dom.contains(m.nodeType==1?m:m.parentNode)&&(p=[{node:m,offset:f.anchorOffset}],Nm(f)||p.push({node:f.focusNode,offset:f.focusOffset})),Nn&&t.input.lastKeyCode===8)for(let k=a;k>s;k--){let T=i.childNodes[k-1],A=T.pmViewDesc;if(T.nodeName=="BR"&&!A){a=k;break}if(!A||A.size)break}let g=t.state.doc,y=t.someProp("domParser")||us.fromSchema(t.state.schema),b=g.resolve(c),w=null,x=y.parse(i,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:s,to:a,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:p,ruleFromNode:G4(r),context:b});if(p&&p[0].pos!=null){let k=p[0].pos,T=p[1]&&p[1].pos;T==null&&(T=k),w={anchor:k+c,head:T+c}}return{doc:x,sel:w,from:c,to:u}}const G4=t=>e=>{let n=e.pmViewDesc;if(n)return n.parseRule(t);if(e.nodeName=="BR"&&e.parentNode){if(jn&&/^(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||jn&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},W4=/^(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 K4(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let I=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,j=aw(t,I);if(j&&!t.state.selection.eq(j)){if(Nn&&ls&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",Y=>Y(t,aa(13,"Enter"))))return;let G=t.state.tr.setSelection(j);I=="pointer"?G.setMeta("pointer",!0):I=="key"&&G.scrollIntoView(),s&&G.setMeta("composition",s),t.dispatch(G)}return}let a=t.state.doc.resolve(e),c=a.sharedDepth(n);e=a.before(c+1),n=t.state.doc.resolve(n).after(c+1);let u=t.state.selection,f=q4(t,e,n,i),p=t.state.doc,m=p.slice(f.from,f.to),g,y;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(g=t.state.selection.to,y="end"):(g=t.state.selection.from,y="start"),t.input.lastKeyCode=null;let b=X4(m.content,f.doc.content,f.from,g,y);if(b&&t.input.domChangeCount++,(oc&&t.input.lastIOSEnter>Date.now()-225||ls)&&i.some(I=>I.nodeType==1&&!W4.test(I.nodeName))&&(!b||b.endA>=b.endB)&&t.someProp("handleKeyDown",I=>I(t,aa(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!b)if(r&&u instanceof Ne&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(f.sel&&f.sel.anchor!=f.sel.head))b={start:u.from,endA:u.to,endB:u.to};else{if(f.sel){let I=V_(t,t.state.doc,f.sel);if(I&&!I.eq(t.state.selection)){let j=t.state.tr.setSelection(I);s&&j.setMeta("composition",s),t.dispatch(j)}}return}t.state.selection.from<t.state.selection.to&&b.start==b.endB&&t.state.selection instanceof Ne&&(b.start>t.state.selection.from&&b.start<=t.state.selection.from+2&&t.state.selection.from>=f.from?b.start=t.state.selection.from:b.endA<t.state.selection.to&&b.endA>=t.state.selection.to-2&&t.state.selection.to<=f.to&&(b.endB+=t.state.selection.to-b.endA,b.endA=t.state.selection.to)),or&&vo<=11&&b.endB==b.start+1&&b.endA==b.start&&b.start>f.from&&f.doc.textBetween(b.start-f.from-1,b.start-f.from+1)==" "&&(b.start--,b.endA--,b.endB--);let w=f.doc.resolveNoCache(b.start-f.from),x=f.doc.resolveNoCache(b.endB-f.from),k=p.resolve(b.start),T=w.sameParent(x)&&w.parent.inlineContent&&k.end()>=b.endA;if((oc&&t.input.lastIOSEnter>Date.now()-225&&(!T||i.some(I=>I.nodeName=="DIV"||I.nodeName=="P"))||!T&&w.pos<f.doc.content.size&&(!w.sameParent(x)||!w.parent.inlineContent)&&w.pos<x.pos&&!/\S/.test(f.doc.textBetween(w.pos,x.pos,"","")))&&t.someProp("handleKeyDown",I=>I(t,aa(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>b.start&&Y4(p,b.start,b.endA,w,x)&&t.someProp("handleKeyDown",I=>I(t,aa(8,"Backspace")))){ls&&Nn&&t.domObserver.suppressSelectionUpdates();return}Nn&&b.endB==b.start&&(t.input.lastChromeDelete=Date.now()),ls&&!T&&w.start()!=x.start()&&x.parentOffset==0&&w.depth==x.depth&&f.sel&&f.sel.anchor==f.sel.head&&f.sel.head==b.endA&&(b.endB-=2,x=f.doc.resolveNoCache(b.endB-f.from),setTimeout(()=>{t.someProp("handleKeyDown",function(I){return I(t,aa(13,"Enter"))})},20));let A=b.start,_=b.endA,O=I=>{let j=I||t.state.tr.replace(A,_,f.doc.slice(b.start-f.from,b.endB-f.from));if(f.sel){let G=V_(t,j.doc,f.sel);G&&!(Nn&&t.composing&&G.empty&&(b.start!=b.endB||t.input.lastChromeDelete<Date.now()-100)&&(G.head==A||G.head==j.mapping.map(_)-1)||or&&G.empty&&G.head==A)&&j.setSelection(G)}return s&&j.setMeta("composition",s),j.scrollIntoView()},N;if(T)if(w.pos==x.pos){or&&vo<=11&&w.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>fs(t),20));let I=O(t.state.tr.delete(A,_)),j=p.resolve(b.start).marksAcross(p.resolve(b.endA));j&&I.ensureMarks(j),t.dispatch(I)}else if(b.endA==b.endB&&(N=Z4(w.parent.content.cut(w.parentOffset,x.parentOffset),k.parent.content.cut(k.parentOffset,b.endA-k.start())))){let I=O(t.state.tr);N.type=="add"?I.addMark(A,_,N.mark):I.removeMark(A,_,N.mark),t.dispatch(I)}else if(w.parent.child(w.index()).isText&&w.index()==x.index()-(x.textOffset?0:1)){let I=w.parent.textBetween(w.parentOffset,x.parentOffset),j=()=>O(t.state.tr.insertText(I,A,_));t.someProp("handleTextInput",G=>G(t,A,_,I,j))||t.dispatch(j())}else t.dispatch(O());else t.dispatch(O())}function V_(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:lw(t,e.resolve(n.anchor),e.resolve(n.head))}function Z4(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,a,c,u;for(let p=0;p<r.length;p++)i=r[p].removeFromSet(i);for(let p=0;p<n.length;p++)s=n[p].removeFromSet(s);if(i.length==1&&s.length==0)c=i[0],a="add",u=p=>p.mark(c.addToSet(p.marks));else if(i.length==0&&s.length==1)c=s[0],a="remove",u=p=>p.mark(c.removeFromSet(p.marks));else return null;let f=[];for(let p=0;p<e.childCount;p++)f.push(u(e.child(p)));if(ne.from(f).eq(t))return{mark:c,type:a}}function Y4(t,e,n,r,i){if(n-e<=i.pos-r.pos||Gv(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let c=s.nodeAfter;return c!=null&&n==e+c.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let a=t.resolve(Gv(s,!0,!0));return!a.parent.isTextblock||a.pos>n||Gv(a,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(a.parent.content)}function Gv(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function X4(t,e,n,r,i){let s=t.findDiffStart(e,n),a=n+t.size,c=n+e.size;if(s==null)return null;let{a:u,b:f}=t.findDiffEnd(e,a,c);if(i=="end"){let p=Math.max(0,s-Math.min(u,f));r-=u+p-s}if(u<s&&a<c){let p=r<=s&&r>=u?s-r:0;s-=p,f=s+(f-u),u=s}else if(f<s){let p=r<=s&&r>=f?s-r:0;s-=p,u=s+(u-f),f=s}return{start:s,endA:u,endB:f}}class iD{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 h4,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(G_),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=F_(this),U_(this),this.nodeViews=q_(this),this.docView=C_(this.state.doc,H_(this),qv(this),this.dom,this),this.domObserver=new $4(this,(r,i,s,a)=>K4(this,r,i,s,a)),this.domObserver.start(),p4(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&&k0(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(G_),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,a=!1;e.storedMarks&&this.composing&&(XN(this),a=!0),this.state=e;let c=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let y=q_(this);Q4(y,this.nodeViews)&&(this.nodeViews=y,s=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&k0(this),this.editable=F_(this),U_(this);let u=qv(this),f=H_(this),p=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",m=s||!this.docView.matchesNode(e.doc,f,u);(m||!e.selection.eq(i.selection))&&(a=!0);let g=p=="preserve"&&a&&this.dom.style.overflowAnchor==null&&AF(this);if(a){this.domObserver.stop();let y=m&&(or||Nn)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&J4(i.selection,e.selection);if(m){let w=Nn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=R4(this)),(s||!this.docView.update(e.doc,f,u,this))&&(this.docView.updateOuterDeco(f),this.docView.destroy(),this.docView=C_(e.doc,f,u,this.dom,this)),w&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}let b=this.input.mouseDown;y||!(b&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&JF(this)&&b.delaySelUpdate())?fs(this,y):(PN(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),p=="reset"?this.dom.scrollTop=0:p=="to selection"?this.scrollToSelection():g&&RF(g)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Ie){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&b_(this,n.getBoundingClientRect(),e)}else b_(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new QN(e.slice,e.move,i<0?void 0:Ie.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let a=0;a<this.directPlugins.length;a++){let c=this.directPlugins[a].props[e];if(c!=null&&(i=n?n(c):c))return i}let s=this.state.plugins;if(s)for(let a=0;a<s.length;a++){let c=s[a].props[e];if(c!=null&&(i=n?n(c):c))return i}}hasFocus(){if(or){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&&MF(this.dom),fs(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 LF(this,e)}coordsAtPos(e,n=1){return RN(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return $F(this,n||this.state,e)}pasteHTML(e,n){return md(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return md(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return cw(this,e)}destroy(){this.docView&&(m4(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],qv(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,vF())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return y4(this,e)}domSelectionRange(){let e=this.domSelection();return e?jn&&this.root.nodeType===11&&kF(this.dom.ownerDocument)==this.dom&&H4(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}iD.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function H_(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"),[mn.node(0,t.state.doc.content.size,e)]}function U_(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:mn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function F_(t){return!t.someProp("editable",e=>e(t.state)===!1)}function J4(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 q_(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Q4(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function G_(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 To={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:"'"},Op={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},e6=typeof navigator<"u"&&/Mac/.test(navigator.platform),t6=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var On=0;On<10;On++)To[48+On]=To[96+On]=String(On);for(var On=1;On<=24;On++)To[On+111]="F"+On;for(var On=65;On<=90;On++)To[On]=String.fromCharCode(On+32),Op[On]=String.fromCharCode(On);for(var Wv in To)Op.hasOwnProperty(Wv)||(Op[Wv]=To[Wv]);function n6(t){var e=e6&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||t6&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Op:To)[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 r6=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),i6=typeof navigator<"u"&&/Win/.test(navigator.platform);function s6(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,a;for(let c=0;c<e.length-1;c++){let u=e[c];if(/^(cmd|meta|m)$/i.test(u))a=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))r6?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),a&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function o6(t){let e=Object.create(null);for(let n in t)e[s6(n)]=t[n];return e}function Kv(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 a6(t){return new Rt({props:{handleKeyDown:mw(t)}})}function mw(t){let e=o6(t);return function(n,r){let i=n6(r),s,a=e[Kv(i,r)];if(a&&a(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let c=e[Kv(i,r,!1)];if(c&&c(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(i6&&r.ctrlKey&&r.altKey)&&(s=To[r.keyCode])&&s!=i){let c=e[Kv(s,r)];if(c&&c(n.state,n.dispatch,n))return!0}}return!1}}var l6=Object.defineProperty,gw=(t,e)=>{for(var n in e)l6(t,n,{get:e[n],enumerable:!0})};function Im(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}var Lm=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:i}=n,s=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...f)=>{const p=c(...f)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,a=[],c=!!t,u=t||i.tr,f=()=>(!c&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(u),a.every(m=>m===!0)),p={...Object.fromEntries(Object.entries(n).map(([m,g])=>[m,(...b)=>{const w=this.buildProps(u,e),x=g(...b)(w);return a.push(x),p}])),run:f};return p}createCan(t){const{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([c,u])=>[c,(...f)=>u(...f)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,a={tr:t,editor:r,view:s,state:Im({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([c,u])=>[c,(...f)=>u(...f)(a)]))}};return a}},Zr={};gw(Zr,{blur:()=>c6,clearContent:()=>u6,clearNodes:()=>d6,command:()=>f6,createParagraphNear:()=>h6,cut:()=>p6,deleteCurrentNode:()=>m6,deleteNode:()=>g6,deleteRange:()=>y6,deleteSelection:()=>S6,enter:()=>w6,exitCode:()=>x6,extendMarkRange:()=>k6,first:()=>C6,focus:()=>T6,forEach:()=>_6,insertContent:()=>A6,insertContentAt:()=>M6,insertDefaultBlock:()=>O6,joinBackward:()=>I6,joinDown:()=>D6,joinForward:()=>L6,joinItemBackward:()=>z6,joinItemForward:()=>P6,joinTextblockBackward:()=>j6,joinTextblockForward:()=>B6,joinUp:()=>N6,keyboardShortcut:()=>V6,lift:()=>H6,liftEmptyBlock:()=>U6,liftListItem:()=>F6,newlineInCode:()=>q6,resetAttributes:()=>G6,scrollIntoView:()=>W6,selectAll:()=>K6,selectNodeBackward:()=>Z6,selectNodeForward:()=>Y6,selectParentNode:()=>X6,selectTextblockEnd:()=>J6,selectTextblockStart:()=>Q6,setContent:()=>e5,setMark:()=>b5,setMeta:()=>S5,setNode:()=>w5,setNodeSelection:()=>x5,setTextDirection:()=>k5,setTextSelection:()=>C5,sinkListItem:()=>E5,splitBlock:()=>T5,splitListItem:()=>_5,toggleList:()=>R5,toggleMark:()=>M5,toggleNode:()=>O5,toggleWrap:()=>N5,undoInputRule:()=>D5,unsetAllMarks:()=>I5,unsetMark:()=>L5,unsetTextDirection:()=>z5,updateAttributes:()=>P5,wrapIn:()=>j5,wrapInList:()=>B5});var c6=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),u6=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),d6=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:a})=>{t.doc.nodesBetween(s.pos,a.pos,(c,u)=>{if(c.type.isText)return;const{doc:f,mapping:p}=e,m=f.resolve(p.map(u)),g=f.resolve(p.map(u+c.nodeSize)),y=m.blockRange(g);if(!y)return;const b=yc(y);if(c.type.isTextblock){const{defaultType:w}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(y.start,w)}(b||b===0)&&e.lift(y,b)})}),!0},f6=t=>e=>t(e),h6=()=>({state:t,dispatch:e})=>vN(t,e),p6=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const a=r.mapping.map(e);return r.insert(a,s.content),r.setSelection(new Ne(r.doc.resolve(Math.max(a-1,0)))),!0},m6=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const c=i.before(s),u=i.after(s);t.delete(c,u).scrollIntoView()}return!0}return!1};function cn(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 g6=t=>({tr:e,state:n,dispatch:r})=>{const i=cn(t,n.schema),s=e.selection.$anchor;for(let a=s.depth;a>0;a-=1)if(s.node(a).type===i){if(r){const u=s.before(a),f=s.after(a);e.delete(u,f).scrollIntoView()}return!0}return!1},y6=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},v6=t=>t.content?/^text(\*|\+)/.test(t.content):!1,W_=(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 v6(r)?n==="left"?t.start()-1:t.end()+1:t.pos},b6=(t,e,n)=>{const r=W_(t,n,"left"),i=W_(e,n,"right");return{from:r,to:i}},S6=()=>({state:t,dispatch:e})=>{if(t.selection.empty)return!1;if(e){const n=t.tr,{ranges:r}=t.selection,i=n.steps.length;r.forEach(s=>{const a=n.mapping.slice(i),c=n.doc.resolve(a.map(s.$from.pos)),u=n.doc.resolve(a.map(s.$to.pos)),{from:f,to:p}=b6(c,u,t.schema);n.deleteRange(f,p)}),n.selection.empty||n.setSelection(Ne.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),e(n)}return!0},w6=()=>({commands:t})=>t.keyboardShortcut("Enter"),x6=()=>({state:t,dispatch:e})=>rF(t,e);function yw(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Np(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:yw(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function sD(t,e,n={}){return t.find(r=>r.type===e&&Np(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function K_(t,e,n={}){return!!sD(t,e,n)}function vw(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(f=>f.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(f=>f.type===e))return;if(!n){const f=r.node.marks.find(p=>p.type===e);f&&(n=f.attrs)}if(!sD([...r.node.marks],e,n))return;let s=r.index,a=t.start()+r.offset,c=s+1,u=a+r.node.nodeSize;for(;s>0&&K_([...t.parent.child(s-1).marks],e,n);)s-=1,a-=t.parent.child(s).nodeSize;for(;c<t.parent.childCount&&K_([...t.parent.child(c).marks],e,n);)u+=t.parent.child(c).nodeSize,c+=1;return{from:a,to:u}}function ws(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 k6=(t,e)=>({tr:n,state:r,dispatch:i})=>{const s=ws(t,r.schema),{doc:a,selection:c}=n,{$from:u,from:f,to:p}=c;if(i){const m=vw(u,s,e);if(m&&m.from<=f&&m.to>=p){const g=Ne.create(a,m.from,m.to);n.setSelection(g)}}return!0},C6=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 oD(t){return t instanceof Ne}function ha(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function C0(t,e=null){if(!e)return null;const n=$e.atStart(t),r=$e.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?Ne.create(t,ha(0,i,s),ha(t.content.size,i,s)):Ne.create(t,ha(e,i,s),ha(e,i,s))}function Z_(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function Dp(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function E6(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var T6=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const a=()=>{(Dp()||Z_())&&r.dom.focus(),E6()&&!Dp()&&!Z_()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(s&&t===null&&!oD(n.state.selection))return a(),!0;const c=C0(i.doc,t)||n.state.selection,u=n.state.selection.eq(c);return s&&(u||i.setSelection(c),u&&i.storedMarks&&i.setStoredMarks(i.storedMarks),a()),!0},_6=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),A6=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),aD=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&&aD(r)}return t};function Du(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 aD(n)}function ac(t,e,n){if(t instanceof yo||t instanceof ne)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return ne.fromArray(t.map(c=>e.nodeFromJSON(c)));const a=e.nodeFromJSON(t);return n.errorOnInvalidContent&&a.check(),a}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),ac("",e,n)}if(i){if(n.errorOnInvalidContent){let a=!1,c="";const u=new FO({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:f=>(a=!0,c=typeof f=="string"?f:f.outerHTML,null)}]}})});if(n.slice?us.fromSchema(u).parseSlice(Du(t),n.parseOptions):us.fromSchema(u).parse(Du(t),n.parseOptions),n.errorOnInvalidContent&&a)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const s=us.fromSchema(e);return n.slice?s.parseSlice(Du(t),n.parseOptions).content:s.parse(Du(t),n.parseOptions)}return ac("",e,n)}function lD(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof an||i instanceof gn))return;const s=t.mapping.maps[r];let a=0;s.forEach((c,u,f,p)=>{a===0&&(a=p)}),t.setSelection($e.near(t.doc.resolve(a),n))}var R6=t=>!("type"in t),M6=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var a;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=x=>{s.emit("contentError",{editor:s,error:x,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},f={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{ac(e,s.schema,{parseOptions:f,errorOnInvalidContent:!0})}catch(x){u(x)}try{c=ac(e,s.schema,{parseOptions:f,errorOnInvalidContent:(a=n.errorOnInvalidContent)!=null?a:s.options.enableContentCheck})}catch(x){return u(x),!1}let{from:p,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,y=!0;if((R6(c)?c:[c]).forEach(x=>{x.check(),g=g?x.isText&&x.marks.length===0:!1,y=y?x.isBlock:!1}),p===m&&y){const{parent:x}=r.doc.resolve(p);x.isTextblock&&!x.type.spec.code&&!x.childCount&&(p-=1,m+=1)}let w;if(g){if(Array.isArray(e))w=e.map(x=>x.text||"").join("");else if(e instanceof ne){let x="";e.forEach(k=>{k.text&&(x+=k.text)}),w=x}else typeof e=="object"&&e&&e.text?w=e.text:w=e;r.insertText(w,p,m)}else{w=c;const x=r.doc.resolve(p),k=x.node(),T=x.parentOffset===0,A=k.isText||k.isTextblock,_=k.content.size>0;T&&A&&_&&y&&(p=Math.max(0,p-1)),r.replaceWith(p,m,w)}n.updateSelection&&lD(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:p,text:w}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:p,text:w})}return!0};function cD(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 O6=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{pos:i,attrs:s,content:a,updateSelection:c=!0}=t;let u;typeof i=="number"?u=e.doc.resolve(i):i?u=i:u=e.selection.$from;const f=cD(u.parent.contentMatchAt(u.index()));if(!f)return!1;const p=Object.keys(f.spec.attrs||{}),m=s?Object.fromEntries(Object.entries(s).filter(([y])=>p.includes(y))):{};let g;if(a){const y=ac(a,r.schema);g=f.createAndFill(m,y)}else g=f.createAndFill(m);return g?(n&&(e.insert(u.pos,g),c&&lD(e,e.steps.length-1,-1)),!0):!1},N6=()=>({state:t,dispatch:e})=>eF(t,e),D6=()=>({state:t,dispatch:e})=>tF(t,e),I6=()=>({state:t,dispatch:e})=>dN(t,e),L6=()=>({state:t,dispatch:e})=>mN(t,e),z6=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Rm(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},P6=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Rm(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},j6=()=>({state:t,dispatch:e})=>JU(t,e),B6=()=>({state:t,dispatch:e})=>QU(t,e);function uD(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function $6(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,a;for(let c=0;c<e.length-1;c+=1){const u=e[c];if(/^(cmd|meta|m)$/i.test(u))a=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))Dp()||uD()?a=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${u}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),a&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}var V6=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=$6(t).split(/-(?!$)/),a=s.find(f=>!["Alt","Ctrl","Meta","Shift"].includes(f)),c=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",f=>f(n,c))});return u?.steps.forEach(f=>{const p=f.map(r.mapping);p&&i&&r.maybeStep(p)}),!0};function _o(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,a=e?cn(e,t.schema):null,c=[];t.doc.nodesBetween(r,i,(m,g)=>{if(m.isText)return;const y=Math.max(r,g),b=Math.min(i,g+m.nodeSize);c.push({node:m,from:y,to:b})});const u=i-r,f=c.filter(m=>a?a.name===m.node.type.name:!0).filter(m=>Np(m.node.attrs,n,{strict:!1}));return s?!!f.length:f.reduce((m,g)=>m+g.to-g.from,0)>=u}var H6=(t,e={})=>({state:n,dispatch:r})=>{const i=cn(t,n.schema);return _o(n,i,e)?nF(n,r):!1},U6=()=>({state:t,dispatch:e})=>bN(t,e),F6=t=>({state:e,dispatch:n})=>{const r=cn(t,e.schema);return pF(r)(e,n)},q6=()=>({state:t,dispatch:e})=>yN(t,e);function zm(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Y_(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var G6=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,a=null;const c=zm(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(s=cn(t,r.schema)),c==="mark"&&(a=ws(t,r.schema));let u=!1;return n.selection.ranges.forEach(f=>{r.doc.nodesBetween(f.$from.pos,f.$to.pos,(p,m)=>{s&&s===p.type&&(u=!0,i&&n.setNodeMarkup(m,void 0,Y_(p.attrs,e))),a&&p.marks.length&&p.marks.forEach(g=>{a===g.type&&(u=!0,i&&n.addMark(m,m+p.nodeSize,a.create(Y_(g.attrs,e))))})})}),u},W6=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),K6=()=>({tr:t,dispatch:e})=>{if(e){const n=new Sr(t.doc);t.setSelection(n)}return!0},Z6=()=>({state:t,dispatch:e})=>hN(t,e),Y6=()=>({state:t,dispatch:e})=>gN(t,e),X6=()=>({state:t,dispatch:e})=>oF(t,e),J6=()=>({state:t,dispatch:e})=>cF(t,e),Q6=()=>({state:t,dispatch:e})=>lF(t,e);function E0(t,e,n={},r={}){return ac(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var e5=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:a,commands:c})=>{const{doc:u}=s;if(r.preserveWhitespace!=="full"){const f=E0(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return a&&s.replaceWith(0,u.content.size,f).setMeta("preventUpdate",!n),!0}return a&&s.setMeta("preventUpdate",!n),c.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function dD(t,e){const n=ws(e,t.schema),{from:r,to:i,empty:s}=t.selection,a=[];s?(t.storedMarks&&a.push(...t.storedMarks),a.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,u=>{a.push(...u.marks)});const c=a.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function fD(t,e){const n=new ew(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function t5(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function hD(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 Pm(t){return e=>hD(e.$from,t)}function _e(t,e,n){return t.config[e]===void 0&&t.parent?_e(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?_e(t.parent,e,n):null}):t.config[e]}function jm(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=_e(e,"addExtensions",n);return r?[e,...jm(r())]:e}).flat(10)}function bw(t,e){const n=ja.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function pD(t){return typeof t=="function"}function ct(t,e=void 0,...n){return pD(t)?e?t.bind(e)(...n):t(...n):t}function n5(t={}){return Object.keys(t).length===0&&t.constructor===Object}function lc(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function mD(t){const e=[],{nodeExtensions:n,markExtensions:r}=lc(t),i=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},a=n.filter(f=>f.name!=="text").map(f=>f.name),c=r.map(f=>f.name),u=[...a,...c];return t.forEach(f=>{const p={name:f.name,options:f.options,storage:f.storage,extensions:i},m=_e(f,"addGlobalAttributes",p);if(!m)return;m().forEach(y=>{let b;Array.isArray(y.types)?b=y.types:y.types==="*"?b=u:y.types==="nodes"?b=a:y.types==="marks"?b=c:b=[],b.forEach(w=>{Object.entries(y.attributes).forEach(([x,k])=>{e.push({type:w,name:x,attribute:{...s,...k}})})})})}),i.forEach(f=>{const p={name:f.name,options:f.options,storage:f.storage},m=_e(f,"addAttributes",p);if(!m)return;const g=m();Object.entries(g).forEach(([y,b])=>{const w={...s,...b};typeof w?.default=="function"&&(w.default=w.default()),w?.isRequired&&w?.default===void 0&&delete w.default,e.push({type:f.name,name:y,attribute:w})})}),e}function r5(t){const e=[];let n="",r=!1,i=!1,s=0;const a=t.length;for(let c=0;c<a;c+=1){const u=t[c];if(u==="'"&&!i){r=!r,n+=u;continue}if(u==='"'&&!r){i=!i,n+=u;continue}if(!r&&!i){if(u==="("){s+=1,n+=u;continue}if(u===")"&&s>0){s-=1,n+=u;continue}if(u===";"&&s===0){e.push(n),n="";continue}}n+=u}return n&&e.push(n),e}function X_(t){const e=[],n=r5(t||""),r=n.length;for(let i=0;i<r;i+=1){const s=n[i],a=s.indexOf(":");if(a===-1)continue;const c=s.slice(0,a).trim(),u=s.slice(a+1).trim();c&&u&&e.push([c,u])}return e}function At(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const c=s?String(s).split(" "):[],u=r[i]?r[i].split(" "):[],f=c.filter(p=>!u.includes(p));r[i]=[...u,...f].join(" ")}else if(i==="style"){const c=new Map([...X_(r[i]),...X_(s)]);r[i]=Array.from(c.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else r[i]=s}),r},{})}function cc(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)=>At(n,r),{})}function i5(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function J_(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,a)=>{const c=a.attribute.parseHTML?a.attribute.parseHTML(n):i5(n.getAttribute(a.name));return c==null?s:{...s,[a.name]:c}},{});return{...r,...i}}}}function Q_(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&n5(n)?!1:n!=null))}function eA(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 gD(t,e){var n;const r=mD(t),{nodeExtensions:i,markExtensions:s}=lc(t),a=(n=i.find(f=>_e(f,"topNode")))==null?void 0:n.name,c=Object.fromEntries(i.map(f=>{const p=r.filter(k=>k.type===f.name),m={name:f.name,options:f.options,storage:f.storage,editor:e},g=t.reduce((k,T)=>{const A=_e(T,"extendNodeSchema",m);return{...k,...A?A(f):{}}},{}),y=Q_({...g,content:ct(_e(f,"content",m)),marks:ct(_e(f,"marks",m)),group:ct(_e(f,"group",m)),inline:ct(_e(f,"inline",m)),atom:ct(_e(f,"atom",m)),selectable:ct(_e(f,"selectable",m)),draggable:ct(_e(f,"draggable",m)),code:ct(_e(f,"code",m)),whitespace:ct(_e(f,"whitespace",m)),linebreakReplacement:ct(_e(f,"linebreakReplacement",m)),defining:ct(_e(f,"defining",m)),isolating:ct(_e(f,"isolating",m)),attrs:Object.fromEntries(p.map(eA))}),b=ct(_e(f,"parseHTML",m));b&&(y.parseDOM=b.map(k=>J_(k,p)));const w=_e(f,"renderHTML",m);w&&(y.toDOM=k=>w({node:k,HTMLAttributes:cc(k,p)}));const x=_e(f,"renderText",m);return x&&(y.toText=x),[f.name,y]})),u=Object.fromEntries(s.map(f=>{const p=r.filter(x=>x.type===f.name),m={name:f.name,options:f.options,storage:f.storage,editor:e},g=t.reduce((x,k)=>{const T=_e(k,"extendMarkSchema",m);return{...x,...T?T(f):{}}},{}),y=Q_({...g,inclusive:ct(_e(f,"inclusive",m)),excludes:ct(_e(f,"excludes",m)),group:ct(_e(f,"group",m)),spanning:ct(_e(f,"spanning",m)),code:ct(_e(f,"code",m)),attrs:Object.fromEntries(p.map(eA))}),b=ct(_e(f,"parseHTML",m));b&&(y.parseDOM=b.map(x=>J_(x,p)));const w=_e(f,"renderHTML",m);return w&&(y.toDOM=x=>w({mark:x,HTMLAttributes:cc(x,p)})),[f.name,y]}));return new FO({topNode:a,nodes:c,marks:u})}function s5(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function ql(t){return t.sort((n,r)=>{const i=_e(n,"priority")||100,s=_e(r,"priority")||100;return i>s?-1:i<s?1:0})}function Sw(t){const e=ql(jm(t)),n=s5(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 yD(t,e){const n=Sw(t);return gD(n,e)}function o5(t,e){const n=yD(e),r=Du(t);return us.fromSchema(n).parse(r).toJSON()}function vD(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
|
|
74
|
-
|
|
75
|
-
`,textSerializers:a={}}=n||{};let c="";return t.nodesBetween(r,i,(u,f,p,m)=>{var g;u.isBlock&&f>r&&(c+=s);const y=a?.[u.type.name];if(y)return p&&(c+=y({node:u,pos:f,parent:p,index:m,range:e})),!1;u.isText&&(c+=(g=u?.text)==null?void 0:g.slice(Math.max(r,f)-f,i-f))}),c}function a5(t,e){const n={from:0,to:t.content.size};return vD(t,n,e)}function bD(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function l5(t,e){const n=cn(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,c=>{s.push(c)});const a=s.reverse().find(c=>c.type.name===n.name);return a?{...a.attrs}:{}}function SD(t,e){const n=zm(typeof e=="string"?e:e.name,t.schema);return n==="node"?l5(t,e):n==="mark"?dD(t,e):{}}function c5(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function u5(t){const e=c5(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,a)=>a!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function ww(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const a=[];if(i.ranges.length)i.forEach((c,u)=>{a.push({from:c,to:u})});else{const{from:c,to:u}=n[s];if(c===void 0||u===void 0)return;a.push({from:c,to:u})}a.forEach(({from:c,to:u})=>{const f=e.slice(s).map(c,-1),p=e.slice(s).map(u),m=e.invert().map(f,-1),g=e.invert().map(p);r.push({oldRange:{from:m,to:g},newRange:{from:f,to:p}})})}),u5(r)}function xw(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),a=vw(s,i.type);a&&r.push({mark:i,...a})}):n.nodesBetween(t,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(a=>({from:s,to:s+i.nodeSize,mark:a})))}),r}var d5=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let s=r,a=null;for(;s>0&&a===null;){const c=i.node(s);c?.type.name===e?a=c:s-=1}return[a,s]};function wu(t,e){return e.nodes[t]||e.marks[t]||null}function Yh(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}var f5=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,a,c)=>{var u,f;const p=((f=(u=i.type.spec).toText)==null?void 0:f.call(u,{node:i,pos:s,parent:a,index:c}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?p:p.slice(0,Math.max(0,r-s))}),n};function T0(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?ws(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>s?s.name===m.type.name:!0).find(m=>Np(m.attrs,n,{strict:!1}));let a=0;const c=[];if(i.forEach(({$from:m,$to:g})=>{const y=m.pos,b=g.pos;t.doc.nodesBetween(y,b,(w,x)=>{if(s&&w.inlineContent&&!w.type.allowsMarkType(s))return!1;if(!w.isText&&!w.marks.length)return;const k=Math.max(y,x),T=Math.min(b,x+w.nodeSize),A=T-k;a+=A,c.push(...w.marks.map(_=>({mark:_,from:k,to:T})))})}),a===0)return!1;const u=c.filter(m=>s?s.name===m.mark.type.name:!0).filter(m=>Np(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),f=c.filter(m=>s?m.mark.type!==s&&m.mark.type.excludes(s):!0).reduce((m,g)=>m+g.to-g.from,0);return(u>0?u+f:u)>=a}function h5(t,e,n={}){if(!e)return _o(t,null,n)||T0(t,null,n);const r=zm(e,t.schema);return r==="node"?_o(t,e,n):r==="mark"?T0(t,e,n):!1}var p5=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const s=Pm(c=>c.type.name===e)(t.selection);if(!s)return!1;const a=t.doc.resolve(s.pos+1);return i.pos+1===a.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},m5=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function tA(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Zv(t,e){const{nodeExtensions:n}=lc(e),r=n.find(a=>a.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=ct(_e(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function $d(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return!/\S/.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(s=>{i!==!1&&($d(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function wD(t){return t instanceof Ie}var xD=class kD{constructor(e){this.position=e}static fromJSON(e){return new kD(e.position)}toJSON(){return{position:this.position}}};function g5(t,e){const n=e.mapping.mapResult(t.position);return{position:new xD(n.pos),mapResult:n}}function y5(t){return new xD(t)}function v5(t,e,n){var r;const{selection:i}=e;let s=null;if(oD(i)&&(s=i.$cursor),s){const c=(r=t.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(c)||!c.some(f=>f.type.excludes(n)))}const{ranges:a}=i;return a.some(({$from:c,$to:u})=>{let f=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,u.pos,(p,m,g)=>{if(f)return!1;if(p.isInline){const y=!g||g.type.allowsMarkType(n),b=!!n.isInSet(p.marks)||!p.marks.some(w=>w.type.excludes(n));f=y&&b}return!f}),f})}var b5=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:a,ranges:c}=s,u=ws(t,r.schema);if(i)if(a){const f=dD(r,u);n.addStoredMark(u.create({...f,...e}))}else c.forEach(f=>{const p=f.$from.pos,m=f.$to.pos;r.doc.nodesBetween(p,m,(g,y)=>{const b=Math.max(y,p),w=Math.min(y+g.nodeSize,m);g.marks.find(k=>k.type===u)?g.marks.forEach(k=>{u===k.type&&n.addMark(b,w,u.create({...k.attrs,...e}))}):n.addMark(b,w,u.create(e))})});return v5(r,n,u)},S5=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),w5=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=cn(t,n.schema);let a;return n.selection.$anchor.sameParent(n.selection.$head)&&(a=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:c})=>g_(s,{...a,...e})(n)?!0:c.clearNodes()).command(({state:c})=>g_(s,{...a,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},x5=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=ha(t,0,r.content.size),s=Ie.create(r,i);e.setSelection(s)}return!0},k5=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;let a,c;return typeof e=="number"?(a=e,c=e):e&&"from"in e&&"to"in e?(a=e.from,c=e.to):(a=s.from,c=s.to),i&&n.doc.nodesBetween(a,c,(u,f)=>{u.isText||n.setNodeMarkup(f,void 0,{...u.attrs,dir:t})}),!0},C5=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,a=Ne.atStart(r).from,c=Ne.atEnd(r).to,u=ha(i,a,c),f=ha(s,a,c),p=Ne.create(r,u,f);e.setSelection(p)}return!0},E5=t=>({state:e,dispatch:n})=>{const r=cn(t,e.schema);return yF(r)(e,n)};function nA(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}var T5=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:a}=e,{$from:c,$to:u}=s,f=i.extensionManager.attributes,p=Yh(f,c.node().type.name,c.node().attrs);if(s instanceof Ie&&s.node.isBlock)return!c.parentOffset||!ds(a,c.pos)?!1:(r&&(t&&nA(n,i.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,g=c.depth===0?void 0:cD(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=m&&g?[{type:g,attrs:p}]:void 0,b=ds(e.doc,e.mapping.map(c.pos),1,y);if(!y&&!b&&ds(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(b=!0,y=g?[{type:g,attrs:p}]:void 0),r){if(b&&(s instanceof Ne&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,y),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const w=e.mapping.map(c.before()),x=e.doc.resolve(w);c.node(-1).canReplaceWith(x.index(),x.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&nA(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return b},_5=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var a;const c=cn(t,r.schema),{$from:u,$to:f}=r.selection,p=r.selection.node;if(p&&p.isBlock||u.depth<2||!u.sameParent(f))return!1;const m=u.node(-1);if(m.type!==c)return!1;const g=s.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(i){let k=ne.empty;const T=u.index(-1)?1:u.index(-2)?2:3;for(let j=u.depth-T;j>=u.depth-3;j-=1)k=ne.from(u.node(j).copy(k));const A=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,_={...Yh(g,u.node().type.name,u.node().attrs),...e},O=((a=c.contentMatch.defaultType)==null?void 0:a.createAndFill(_))||void 0;k=k.append(ne.from(c.createAndFill(null,O)||void 0));const N=u.before(u.depth-(T-1));n.replace(N,u.after(-A),new we(k,4-T,0));let I=-1;n.doc.nodesBetween(N,n.doc.content.size,(j,G)=>{if(I>-1)return!1;j.isTextblock&&j.content.size===0&&(I=G+1)}),I>-1&&n.setSelection(Ne.near(n.doc.resolve(I))),n.scrollIntoView()}return!0}const y=f.pos===u.end()?m.contentMatchAt(0).defaultType:null,b={...Yh(g,m.type.name,m.attrs),...e},w={...Yh(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,f.pos);const x=y?[{type:c,attrs:b},{type:y,attrs:w}]:[{type:c,attrs:b}];if(!ds(n.doc,u.pos,2))return!1;if(i){const{selection:k,storedMarks:T}=r,{splittableMarks:A}=s.extensionManager,_=T||k.$to.parentOffset&&k.$from.marks();if(n.split(u.pos,2,x).scrollIntoView(),!_||!i)return!0;const O=_.filter(N=>A.includes(N.type.name));n.ensureMarks(O)}return!0};function rA(t){return!t||t==="1"?null:t}function CD(t,e){return rA(t)===rA(e)}var Yv=(t,e)=>{const n=Pm(a=>a.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return!(n.node.type===i?.type&&Io(t.doc,n.pos))||!CD(n.node.attrs.type,i?.attrs.type)||t.join(n.pos),!0},Xv=(t,e)=>{const n=Pm(a=>a.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return!(n.node.type===i?.type&&Io(t.doc,r))||!CD(n.node.attrs.type,i?.attrs.type)||t.join(r),!0};function A5(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),i=e.resolve(n.nodeSize-1);return Ne.between(r,i)}var R5=(t,e,n,r={})=>({editor:i,tr:s,state:a,dispatch:c,chain:u,commands:f,can:p})=>{const{extensions:m,splittableMarks:g}=i.extensionManager,y=cn(t,a.schema),b=cn(e,a.schema),{selection:w,storedMarks:x}=a,{$from:k,$to:T}=w,A=k.blockRange(T),_=x||w.$to.parentOffset&&w.$from.marks();if(!A)return!1;const O=Pm(te=>Zv(te.type.name,m))(w),N=w.from===0&&w.to===a.doc.content.size,I=a.doc.content.content,j=I.length===1?I[0]:null,G=N&&j&&Zv(j.type.name,m)?{node:j,pos:0}:null,Y=O??G,ce=!!O&&A.depth>=1&&A.depth-O.depth<=1,X=!!G;if((ce||X)&&Y){if(Y.node.type===y)return N&&X?u().command(({tr:te,dispatch:ie})=>{const he=A5(te);return he?(te.setSelection(he),ie&&ie(te),!0):!1}).liftListItem(b).run():f.liftListItem(b);if(Zv(Y.node.type.name,m)&&y.validContent(Y.node.content))return u().command(()=>(s.setNodeMarkup(Y.pos,y),!0)).command(()=>Yv(s,y)).command(()=>Xv(s,y)).run()}return!n||!_||!c?u().command(()=>p().wrapInList(y,r)?!0:f.clearNodes()).wrapInList(y,r).command(()=>Yv(s,y)).command(()=>Xv(s,y)).run():u().command(()=>{const te=p().wrapInList(y,r),ie=_.filter(he=>g.includes(he.type.name));return s.ensureMarks(ie),te?!0:f.clearNodes()}).wrapInList(y,r).command(()=>Yv(s,y)).command(()=>Xv(s,y)).run()},M5=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,a=ws(t,r.schema);return T0(r,a,e)?i.unsetMark(a,{extendEmptyMarkRange:s}):i.setMark(a,e)},O5=(t,e,n={})=>({state:r,commands:i})=>{const s=cn(t,r.schema),a=cn(e,r.schema),c=_o(r,s,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),c?i.setNode(a,u):i.setNode(s,{...u,...n})},N5=(t,e={})=>({state:n,commands:r})=>{const i=cn(t,n.schema);return _o(n,i,e)?r.lift(i):r.wrapIn(i,e)},D5=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const a=t.tr,c=s.transform;for(let u=c.steps.length-1;u>=0;u-=1)a.step(c.steps[u].invert(c.docs[u]));if(s.text){const u=a.doc.resolve(s.from).marks();a.replaceWith(s.from,s.to,t.schema.text(s.text,u))}else a.delete(s.from,s.to)}return!0}}return!1},I5=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{ignoreClearable:i=!1}=t,{selection:s}=e,{empty:a,ranges:c}=s;if(a)return!0;const{nonClearableMarks:u}=r.extensionManager;if(n){const f=Object.values(r.schema.marks).filter(p=>i||!u.includes(p.name));c.forEach(p=>{for(const m of f)e.removeMark(p.$from.pos,p.$to.pos,m)})}return!0},L5=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:a=!1}=e,{selection:c}=n,u=ws(t,r.schema),{$from:f,empty:p,ranges:m}=c;if(!i)return!0;if(p&&a){let{from:g,to:y}=c;const b=(s=f.marks().find(x=>x.type===u))==null?void 0:s.attrs,w=vw(f,u,b);w&&(g=w.from,y=w.to),n.removeMark(g,y,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},z5=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let s,a;return typeof t=="number"?(s=t,a=t):t&&"from"in t&&"to"in t?(s=t.from,a=t.to):(s=i.from,a=i.to),r&&e.doc.nodesBetween(s,a,(c,u)=>{if(c.isText)return;const f={...c.attrs};delete f.dir,e.setNodeMarkup(u,void 0,f)}),!0},P5=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,a=null;const c=zm(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(s=cn(t,r.schema)),c==="mark"&&(a=ws(t,r.schema));let u=!1;return n.selection.ranges.forEach(f=>{const p=f.$from.pos,m=f.$to.pos;let g,y,b,w;n.selection.empty?r.doc.nodesBetween(p,m,(x,k)=>{s&&s===x.type&&(u=!0,b=Math.max(k,p),w=Math.min(k+x.nodeSize,m),g=k,y=x)}):r.doc.nodesBetween(p,m,(x,k)=>{k<p&&s&&s===x.type&&(u=!0,b=Math.max(k,p),w=Math.min(k+x.nodeSize,m),g=k,y=x),k>=p&&k<=m&&(s&&s===x.type&&(u=!0,i&&n.setNodeMarkup(k,void 0,{...x.attrs,...e})),a&&x.marks.length&&x.marks.forEach(T=>{if(a===T.type&&(u=!0,i)){const A=Math.max(k,p),_=Math.min(k+x.nodeSize,m);n.addMark(A,_,a.create({...T.attrs,...e}))}}))}),y&&(g!==void 0&&i&&n.setNodeMarkup(g,void 0,{...y.attrs,...e}),a&&y.marks.length&&y.marks.forEach(x=>{a===x.type&&i&&n.addMark(b,w,a.create({...x.attrs,...e}))}))}),u},j5=(t,e={})=>({state:n,dispatch:r})=>{const i=cn(t,n.schema);return uF(i,e)(n,r)},B5=(t,e={})=>({state:n,dispatch:r})=>{const i=cn(t,n.schema);return dF(i,e)(n,r)},$5=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 uc(t,e){if(t===e)return!0;if(!t||!e)return!1;const n=Object.keys(t),r=Object.keys(e);return n.length!==r.length?!1:n.every(i=>Object.prototype.hasOwnProperty.call(e,i)&&Object.is(t[i],e[i]))}function V5(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Ie){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}function H5(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}function iA(t){return t.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function U5(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function F5(t){return typeof t=="number"}function q5(t){return Object.prototype.toString.call(t).slice(8,-1)}function gh(t){return q5(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}var G5={};gw(G5,{createAtomBlockMarkdownSpec:()=>W5,createBlockMarkdownSpec:()=>K5,createInlineMarkdownSpec:()=>X5,parseAttributes:()=>kw,parseIndentedBlocks:()=>_0,renderNestedMarkdownContent:()=>Ew,serializeAttributes:()=>Cw});function kw(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,f=>(n.push(f),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([\w-]+)/g);if(i){const f=i.map(p=>p.trim().slice(1));e.class=f.join(" ")}const s=r.match(/(?:^|\s)#([\w-]+)/);s&&(e.id=s[1]);const a=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(a)).forEach(([,f,p])=>{var m;const g=parseInt(((m=p.match(/__QUOTED_(\d+)__/))==null?void 0:m[1])||"0",10),y=n[g];y&&(e[f]=y.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(p=>{p.match(/^[a-zA-Z][\w-]*$/)&&(e[p]=!0)}),e}function Cw(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 W5(t){const{nodeName:e,name:n,parseAttributes:r=kw,serializeAttributes:i=Cw,defaultAttributes:s={},requiredAttributes:a=[],allowedAttributes:c}=t,u=n||e,f=p=>{if(!c)return p;const m={};return c.forEach(g=>{g in p&&(m[g]=p[g])}),m};return{parseMarkdown:(p,m)=>{const g={...s,...p.attributes};return m.createNode(e,g,[])},markdownTokenizer:{name:e,level:"block",start(p){var m;const g=new RegExp(`^:::${u}(?:\\s|$)`,"m"),y=(m=p.match(g))==null?void 0:m.index;return y!==void 0?y:-1},tokenize(p,m,g){const y=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),b=p.match(y);if(!b)return;const w=b[1]||"",x=r(w);if(!a.find(T=>!(T in x)))return{type:e,raw:b[0],attributes:x}}},renderMarkdown:p=>{const m=f(p.attrs||{}),g=i(m),y=g?` {${g}}`:"";return`:::${u}${y} :::`}}}function K5(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=kw,serializeAttributes:s=Cw,defaultAttributes:a={},content:c="block",allowedAttributes:u}=t,f=n||e,p=m=>{if(!u)return m;const g={};return u.forEach(y=>{y in m&&(g[y]=m[y])}),g};return{parseMarkdown:(m,g)=>{let y;if(r){const w=r(m);y=typeof w=="string"?[{type:"text",text:w}]:w}else c==="block"?y=g.parseChildren(m.tokens||[]):y=g.parseInline(m.tokens||[]);const b={...a,...m.attributes};return g.createNode(e,b,y)},markdownTokenizer:{name:e,level:"block",start(m){var g;const y=new RegExp(`^:::${f}`,"m"),b=(g=m.match(y))==null?void 0:g.index;return b!==void 0?b:-1},tokenize(m,g,y){var b;const w=new RegExp(`^:::${f}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),x=m.match(w);if(!x)return;const[k,T=""]=x,A=i(T);let _=1;const O=k.length;let N="";const I=/^:::([\w-]*)(\s.*)?/gm,j=m.slice(O);for(I.lastIndex=0;;){const G=I.exec(j);if(G===null)break;const Y=G.index,ce=G[1];if(!((b=G[2])!=null&&b.endsWith(":::"))){if(ce)_+=1;else if(_-=1,_===0){const X=j.slice(0,Y);N=X.trim();const te=m.slice(0,O+Y+G[0].length);let ie=[];if(N)if(c==="block")for(ie=y.blockTokens(X),ie.forEach(he=>{he.text&&(!he.tokens||he.tokens.length===0)&&(he.tokens=y.inlineTokens(he.text))});ie.length>0;){const he=ie[ie.length-1];if(he.type==="paragraph"&&(!he.text||he.text.trim()===""))ie.pop();else break}else ie=y.inlineTokens(N);return{type:e,raw:te,attributes:A,content:N,tokens:ie}}}}}},renderMarkdown:(m,g)=>{const y=p(m.attrs||{}),b=s(y),w=b?` {${b}}`:"",x=g.renderChildren(m.content||[],`
|
|
76
|
-
|
|
77
|
-
`);return`:::${f}${w}
|
|
78
|
-
|
|
79
|
-
${x}
|
|
80
|
-
|
|
81
|
-
:::`}}}function Z5(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,i,s,a]=r;e[i]=s||a,r=n.exec(t)}return e}function Y5(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function X5(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=Z5,serializeAttributes:s=Y5,defaultAttributes:a={},selfClosing:c=!1,allowedAttributes:u}=t,f=n||e,p=g=>{if(!u)return g;const y={};return u.forEach(b=>{const w=typeof b=="string"?b:b.name,x=typeof b=="string"?void 0:b.skipIfDefault;if(w in g){const k=g[w];if(x!==void 0&&k===x)return;y[w]=k}}),y},m=f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(g,y)=>{const b={...a,...g.attributes};if(c)return y.createNode(e,b);const w=r?r(g):g.content||"";return w?y.createNode(e,b,[y.createTextNode(w)]):y.createNode(e,b,[])},markdownTokenizer:{name:e,level:"inline",start(g){const y=c?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),b=g.match(y),w=b?.index;return w!==void 0?w:-1},tokenize(g,y,b){const w=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),x=g.match(w);if(!x)return;let k="",T="";if(c){const[,_]=x;T=_}else{const[,_,O]=x;T=_,k=O||""}const A=i(T.trim());return{type:e,raw:x[0],content:k.trim(),attributes:A}}},renderMarkdown:g=>{let y="";r?y=r(g):g.content&&g.content.length>0&&(y=g.content.filter(k=>k.type==="text").map(k=>k.text).join(""));const b=p(g.attrs||{}),w=s(b),x=w?` ${w}`:"";return c?`[${f}${x}]`:`[${f}${x}]${y}[/${f}]`}}}function _0(t,e,n){var r,i,s,a;const c=t.split(`
|
|
82
|
-
`),u=[];let f="",p=0;const m=e.baseIndentSize||2;for(;p<c.length;){const g=c[p],y=g.match(e.itemPattern);if(!y){if(u.length>0)break;if(g.trim()===""){p+=1,f=`${f}${g}
|
|
83
|
-
`;continue}else return}const b=e.extractItemData(y),{indentLevel:w,mainContent:x}=b;f=`${f}${g}
|
|
84
|
-
`;const k=[x];for(p+=1;p<c.length;){const O=c[p];if(O.trim()===""){const I=c.slice(p+1).findIndex(Y=>Y.trim()!=="");if(I===-1)break;if((((i=(r=c[p+1+I].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>w){k.push(O),f=`${f}${O}
|
|
85
|
-
`,p+=1;continue}else break}if((((a=(s=O.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:a.length)||0)>w)k.push(O),f=`${f}${O}
|
|
86
|
-
`,p+=1;else break}let T;const A=k.slice(1);if(A.length>0){const O=A.map(N=>N.slice(w+m)).join(`
|
|
87
|
-
`);O.trim()&&(e.customNestedParser?T=e.customNestedParser(O):T=n.blockTokens(O))}const _=e.createToken(b,T);u.push(_)}if(u.length!==0)return{items:u,raw:f}}function Ew(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[s,...a]=t.content,c=e.renderChildren([s]);let u=`${i}${c}`;return a&&a.length>0&&a.forEach((f,p)=>{var m,g;const y=(g=(m=e.renderChild)==null?void 0:m.call(e,f,p+1))!=null?g:e.renderChildren([f]);if(y!=null){const b=y.split(`
|
|
88
|
-
`).map(w=>w?e.indent(w):e.indent("")).join(`
|
|
89
|
-
`);u+=f.type==="paragraph"?`
|
|
90
|
-
|
|
91
|
-
${b}`:`
|
|
92
|
-
${b}`}}),u}function sA(t){return typeof t.type=="string"?t.type:t.type.name}function J5(t,e){if(t.length!==e.length)return!1;const n=Array.from({length:e.length},()=>!1);return t.every(r=>{const i=sA(r),s=e.findIndex((a,c)=>!n[c]&&i===sA(a)&&uc(r.attrs,a.attrs));return s===-1?!1:(n[s]=!0,!0)})}function ED(t,e){const n={...t};return gh(t)&&gh(e)&&Object.keys(e).forEach(r=>{gh(e[r])&&gh(t[r])?n[r]=ED(t[r],e[r]):n[r]=e[r]}),n}function Q5(t,e,n={}){const{state:r}=e,{doc:i,tr:s}=r,a=t;i.descendants((c,u)=>{const f=s.mapping.map(u),p=s.mapping.map(u)+c.nodeSize;let m=null;if(c.marks.forEach(y=>{if(y!==a)return!1;m=y}),!m)return;let g=!1;if(Object.keys(n).forEach(y=>{n[y]!==m.attrs[y]&&(g=!0)}),g){const y=t.type.create({...t.attrs,...n});s.removeMark(f,p,t.type),s.addMark(f,p,y)}}),s.docChanged&&e.view.dispatch(s)}var Vd=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},eq=(t,e)=>{if(yw(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 yh(t){var e;const{editor:n,from:r,to:i,text:s,rules:a,plugin:c}=t,{view:u}=n;if(u.composing)return!1;const f=u.state.doc.resolve(r);if(f.parent.type.spec.code||(e=f.nodeBefore||f.nodeAfter)!=null&&e.marks.find(g=>g.type.spec.code))return!1;let p=!1;const m=f5(f)+s;return a.forEach(g=>{if(p)return;const y=eq(m,g.find);if(!y)return;const b=y[0].length-s.length;if(b>0){const N=f.parentOffset-b;if(N<0||f.parent.textBetween(N,f.parentOffset)!==y[0].slice(0,b))return}const w=u.state.tr,x=Im({state:u.state,transaction:w}),k={from:r-(y[0].length-s.length),to:i},{commands:T,chain:A,can:_}=new Lm({editor:n,state:x});g.handler({state:x,range:k,match:y,commands:T,chain:A,can:_})===null||!w.steps.length||(g.undoable&&w.setMeta(c,{transform:w,from:r,to:i,text:s}),u.dispatch(w),p=!0)}),p}function tq(t){const{editor:e,rules:n}=t,r=new Rt({state:{init(){return null},apply(i,s,a){const c=i.getMeta(r);if(c)return c;const u=i.getMeta("applyInputRules");return u&&setTimeout(()=>{let{text:p}=u;typeof p=="string"?p=p:p=bw(ne.from(p),a.schema);const{from:m}=u,g=m+p.length;yh({editor:e,from:m,to:g,text:p,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,a,c){return yh({editor:e,from:s,to:a,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&yh({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:a}=i.state.selection;return a?yh({editor:e,from:a.pos,to:a.pos,text:`
|
|
93
|
-
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var Tw=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{...ct(_e(this,"addOptions",{name:this.name}))}}get storage(){return{...ct(_e(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>ED(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}},Ba=class TD extends Tw{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new TD(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const a=i.marks();if(!!!a.find(f=>f?.type.name===n.name))return!1;const u=a.find(f=>f?.type.name===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},_D=class{constructor(t){this.find=t.find,this.handler=t.handler}},nq=(t,e,n)=>{if(yw(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function rq(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:a,dropEvent:c}=t,{commands:u,chain:f,can:p}=new Lm({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,i,(y,b)=>{var w,x,k,T,A;if((x=(w=y.type)==null?void 0:w.spec)!=null&&x.code||!(y.isText||y.isTextblock||y.isInline))return;const _=(A=(T=(k=y.content)==null?void 0:k.size)!=null?T:y.nodeSize)!=null?A:0,O=Math.max(r,b),N=Math.min(i,b+_);if(O>=N)return;const I=y.isText?y.text||"":y.textBetween(O-b,N-b,void 0,"");nq(I,s.find,a).forEach(G=>{if(G.index===void 0)return;const Y=O+G.index+1,ce=Y+G[0].length,X={from:n.tr.mapping.map(Y),to:n.tr.mapping.map(ce)},te=s.handler({state:n,range:X,match:G,commands:u,chain:f,can:p,pasteEvent:a,dropEvent:c});m.push(te)})}),m.every(y=>y!==null)}var vh=null,iq=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function sq(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const u=({state:p,from:m,to:g,rule:y,pasteEvt:b})=>{const w=p.tr,x=Im({state:p,transaction:w});if(!(!rq({editor:e,state:x,from:Math.max(m-1,0),to:g.b-1,rule:y,pasteEvent:b,dropEvent:c})||!w.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,w}};return n.map(p=>new Rt({view(m){const g=b=>{var w;r=(w=m.dom.parentElement)!=null&&w.contains(b.target)?m.dom.parentElement:null,r&&(vh=e)},y=()=>{vh&&(vh=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",y),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",y)}}},props:{handleDOMEvents:{drop:(m,g)=>{if(s=r===m.dom.parentElement,c=g,!s){const y=vh;y?.isEditable&&setTimeout(()=>{const b=y.state.selection;b&&y.commands.deleteRange({from:b.from,to:b.to})},10)}return!1},paste:(m,g)=>{var y;const b=(y=g.clipboardData)==null?void 0:y.getData("text/html");return a=g,i=!!b?.includes("data-pm-slice"),!1}}},appendTransaction:(m,g,y)=>{const b=m[0],w=b.getMeta("uiEvent")==="paste"&&!i,x=b.getMeta("uiEvent")==="drop"&&!s,k=b.getMeta("applyPasteRules"),T=!!k;if(!w&&!x&&!T)return;if(T){let{text:O}=k;typeof O=="string"?O=O:O=bw(ne.from(O),y.schema);const{from:N}=k,I=N+O.length,j=iq(O);return u({rule:p,state:y,from:N,to:{b:I},pasteEvt:j})}const A=g.doc.content.findDiffStart(y.doc.content),_=g.doc.content.findDiffEnd(y.doc.content);if(!(!F5(A)||!_||A===_.b))return u({rule:p,state:y,from:A,to:_,pasteEvt:a})}}))}var Bm=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=Sw(t),this.schema=gD(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:wu(e.name,this.schema)},r=_e(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return ql([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:wu(r.name,this.schema)},s=[],a=_e(r,"addKeyboardShortcuts",i);let c={};if(r.type==="mark"&&_e(r,"exitable",i)&&(c.ArrowRight=()=>Ba.handleExit({editor:t,mark:r})),a){const g=Object.fromEntries(Object.entries(a()).map(([y,b])=>[y,()=>b({editor:t})]));c={...c,...g}}const u=a6(c);s.push(u);const f=_e(r,"addInputRules",i);if(tA(r,t.options.enableInputRules)&&f){const g=f();if(g&&g.length){const y=tq({editor:t,rules:g}),b=Array.isArray(y)?y:[y];s.push(...b)}}const p=_e(r,"addPasteRules",i);if(tA(r,t.options.enablePasteRules)&&p){const g=p();if(g&&g.length){const y=sq({editor:t,rules:g});s.push(...y)}}const m=_e(r,"addProseMirrorPlugins",i);if(m){const g=m();s.push(...g)}return s})}get attributes(){return mD(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=lc(this.extensions);return Object.fromEntries(e.filter(n=>!!_e(n,"addNodeView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:cn(n.name,this.schema)},s=_e(n,"addNodeView",i);if(!s)return[];const a=s();if(!a)return[];const c=(u,f,p,m,g)=>{const y=cc(u,r);return a({node:u,view:f,getPos:p,decorations:m,innerDecorations:g,editor:t,extension:n,HTMLAttributes:y})};return[n.name,c]}))}dispatchTransaction(t){const{editor:e}=this;return ql([...this.extensions].reverse()).reduceRight((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:wu(i.name,this.schema)},a=_e(i,"dispatchTransaction",s);return a?c=>{a.call(s,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return ql([...this.extensions]).reduce((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:wu(i.name,this.schema)},a=_e(i,"transformPastedHTML",s);return a?(c,u)=>{const f=r(c,u);return a.call(s,f)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=lc(this.extensions);return Object.fromEntries(e.filter(n=>!!_e(n,"addMarkView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ws(n.name,this.schema)},s=_e(n,"addMarkView",i);if(!s)return[];const a=(c,u,f)=>{const p=cc(c,r);return s()({mark:c,view:u,inline:f,editor:t,extension:n,HTMLAttributes:p,updateAttributes:m=>{Q5(c,t,m)}})};return[n.name,a]}))}destroy(){this.extensions.forEach(t=>{let e=t;for(;e.parent;){const n=e.parent;n.child===e&&(n.child=null),e=n}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n,r;const i={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:wu(e.name,this.schema)};e.type==="mark"&&(((n=ct(_e(e,"keepOnSplit",i)))==null||n)&&this.splittableMarks.push(e.name),(r=ct(_e(e,"clearable",i)))==null||r||this.nonClearableMarks.push(e.name));const s=_e(e,"onBeforeCreate",i),a=_e(e,"onCreate",i),c=_e(e,"onUpdate",i),u=_e(e,"onSelectionUpdate",i),f=_e(e,"onTransaction",i),p=_e(e,"onFocus",i),m=_e(e,"onBlur",i),g=_e(e,"onDestroy",i);s&&this.editor.on("beforeCreate",s),a&&this.editor.on("create",a),c&&this.editor.on("update",c),u&&this.editor.on("selectionUpdate",u),f&&this.editor.on("transaction",f),p&&this.editor.on("focus",p),m&&this.editor.on("blur",m),g&&this.editor.on("destroy",g)})}};Bm.resolve=Sw;Bm.sort=ql;Bm.flatten=jm;var oq={};gw(oq,{ClipboardTextSerializer:()=>RD,Commands:()=>MD,Delete:()=>OD,Drop:()=>ND,Editable:()=>DD,FocusEvents:()=>LD,Keymap:()=>zD,Paste:()=>PD,Tabindex:()=>jD,TextDirection:()=>BD,focusEventsPluginKey:()=>ID});var zt=class AD extends Tw{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new AD(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},RD=zt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Rt({key:new Gt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,s=bD(n),{blockSeparator:a}=this.options,c={...a!==void 0?{blockSeparator:a}:{},textSerializers:s};return[...i.ranges].sort((f,p)=>f.$from.pos-p.$from.pos).map(({$from:f,$to:p})=>vD(r,{from:f.pos,to:p.pos},c)).join(a??`
|
|
94
|
-
|
|
95
|
-
`)}}})]}}),MD=zt.create({name:"commands",addCommands(){return{...Zr}}}),OD=zt.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;const s=()=>{var a,c,u,f;if((f=(u=(c=(a=this.editor.options.coreExtensionOptions)==null?void 0:a.delete)==null?void 0:c.filterTransaction)==null?void 0:u.call(c,t))!=null?f:t.getMeta("y-sync$"))return;const p=fD(t.before,[t,...e]);ww(p).forEach(y=>{p.mapping.mapResult(y.oldRange.from).deletedAfter&&p.mapping.mapResult(y.oldRange.to).deletedBefore&&p.before.nodesBetween(y.oldRange.from,y.oldRange.to,(b,w)=>{const x=w+b.nodeSize-2,k=y.oldRange.from<=w&&x<=y.oldRange.to;this.editor.emit("delete",{type:"node",node:b,from:w,to:x,newFrom:p.mapping.map(w),newTo:p.mapping.map(x),deletedRange:y.oldRange,newRange:y.newRange,partial:!k,editor:this.editor,transaction:t,combinedTransform:p})})});const g=p.mapping;p.steps.forEach((y,b)=>{var w,x;if(y instanceof ri){const k=g.slice(b).map(y.from,-1),T=g.slice(b).map(y.to),A=g.invert().map(k,-1),_=g.invert().map(T),O=k>0?(w=p.doc.nodeAt(k-1))==null?void 0:w.marks.some(I=>I.eq(y.mark)):!1,N=(x=p.doc.nodeAt(T))==null?void 0:x.marks.some(I=>I.eq(y.mark));this.editor.emit("delete",{type:"mark",mark:y.mark,from:y.from,to:y.to,deletedRange:{from:A,to:_},newRange:{from:k,to:T},partial:!!(N||O),editor:this.editor,transaction:t,combinedTransform:p})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),ND=zt.create({name:"drop",addProseMirrorPlugins(){return[new Rt({key:new Gt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),DD=zt.create({name:"editable",addProseMirrorPlugins(){return[new Rt({key:new Gt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ID=new Gt("focusEvents"),LD=zt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Rt({key:ID,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}}}})]}}),zD=zt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.command(({tr:c})=>{const{selection:u,doc:f}=c,{empty:p,$anchor:m}=u,{pos:g,parent:y}=m,b=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,w=b.parent.type.spec.isolating,x=m.pos-m.parentOffset,k=w&&b.parent.childCount===1?x===m.pos:$e.atStart(f).from===g;return!p||!y.type.isTextblock||y.textContent.length||!k||k&&m.parent.type.name==="paragraph"?!1:a.clearNodes()}),()=>a.deleteSelection(),()=>a.joinBackward(),()=>a.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:a})=>[()=>a.deleteSelection(),()=>a.deleteCurrentNode(),()=>a.joinForward(),()=>a.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:a})=>[()=>a.newlineInCode(),()=>a.createParagraphNear(),()=>a.liftEmptyBlock(),()=>a.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Dp()||uD()?s:i},addProseMirrorPlugins(){return[new Rt({key:new Gt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(w=>w.getMeta("composition")))return;const r=t.some(w=>w.docChanged)&&!e.doc.eq(n.doc),i=t.some(w=>w.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:a,to:c}=e.selection,u=$e.atStart(e.doc).from,f=$e.atEnd(e.doc).to;if(s||!(a===u&&c===f)||!$d(n.doc))return;const g=n.tr,y=Im({state:n,transaction:g}),{commands:b}=new Lm({editor:this.editor,state:y});if(b.clearNodes(),!!g.steps.length)return g}})]}}),PD=zt.create({name:"paste",addProseMirrorPlugins(){return[new Rt({key:new Gt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),jD=zt.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Rt({key:new Gt("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!=null?t:"0"}}}})]}}),BD=zt.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=lc(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 Rt({key:new Gt("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),aq=class Iu{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Iu(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 Iu(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 Iu(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,a=n.isInline,c=this.pos+r+(s?0:1);if(c<0||c>this.resolvedPos.doc.nodeSize-2)return;const u=this.resolvedPos.doc.resolve(c);if(!i&&!a&&u.depth<=this.depth)return;const f=new Iu(u,this.editor,i,i||a?n:null);i&&(f.actualDepth=this.depth+1),e.push(f)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,a=Object.keys(n);for(let c=0;c<a.length;c+=1){const u=a[c];if(s[u]!==n[u])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(a=>{r&&i.length>0||(a.node.type.name===e&&s.every(u=>n[u]===a.node.attrs[u])&&i.push(a),!(r&&i.length>0)&&(i=i.concat(a.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},lq=`.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
|
-
}`,cq=class extends $5{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:g5,createMappablePosition:y5},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:r,moved:i})=>this.options.onDrop(n,r,i)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),this.on("delete",this.options.onDelete);const e=this.createDoc();if(!this.editorState){const n=C0(e,this.options.autofocus);this.editorState=ua.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=H5(lq,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=pD(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;n=n.filter(a=>!a.key.startsWith(s))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e,n,r;const s=[...this.options.enableCoreExtensions?[DD,RD.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),MD,LD,zD,jD.configure({value:(r=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:r.value}),ND,PD,OD,BD.configure({direction:this.options.textDirection})].filter(a=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[a.name]!==!1:!0):[],...this.options.extensions].filter(a=>["extension","node","mark"].includes(a?.type));this.extensionManager=new Bm(s,this)}createCommandManager(){this.commandManager=new Lm({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=E0(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=E0(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=ua.create({doc:n,schema:this.schema,selection:C0(n,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),this.editorState.doc}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,s=e.transformPastedHTML,a=this.extensionManager.transformPastedHTML(s);this.editorView=new iD(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,transformPastedHTML:a,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const u=this.view.dom;u.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(f=>{var p;return(p=this.capturedTransaction)==null?void 0:p.step(f)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const a=n.findLast(f=>f.getMeta("focus")||f.getMeta("blur")),c=a?.getMeta("focus"),u=a?.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:a}),u&&this.emit("blur",{editor:this,event:u.event,transaction:a}),!(t.getMeta("preventUpdate")||!n.some(f=>f.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return SD(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return h5(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return bw(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
|
|
166
|
-
|
|
167
|
-
`,textSerializers:n={}}=t||{};return a5(this.state.doc,{blockSeparator:e,textSerializers:{...bD(this.schema),...n}})}get isEmpty(){return $d(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 aq(e,this,!1,n)}get $doc(){return this.$pos(0)}};function Aa(t){return new Vd({find:t.find,handler:({state:e,range:n,match:r})=>{const i=ct(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,a=r[r.length-1],c=r[0];if(a){const u=c.search(/\S/),f=n.from+c.indexOf(a),p=f+a.length;if(xw(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(w=>w===t.type&&w!==y.mark.type)).filter(y=>y.to>f).length)return null;p<n.to&&s.delete(p,n.to),f>n.from&&s.delete(n.from+u,f);const g=n.from+u+a.length;s.addMark(n.from+u,g,t.type.create(i||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}function $D(t){return new Vd({find:t.find,handler:({state:e,range:n,match:r})=>{const i=ct(t.getAttributes,void 0,r)||{},{tr:s}=e,a=n.from;let c=n.to;const u=t.type.create(i);if(r[1]){const f=r[0].lastIndexOf(r[1]);let p=a+f;p>c?p=c:c=p+r[1].length;const m=r[0][r[0].length-1];s.insertText(m,a+r[0].length-1),s.replaceWith(p,c,u)}else if(r[0]){const f=t.type.isInline?a:a-1;s.insert(f,t.type.create(i)).delete(s.mapping.map(a),s.mapping.map(c))}s.scrollIntoView()},undoable:t.undoable})}function A0(t){return new Vd({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=ct(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)},undoable:t.undoable})}function dc(t){return new Vd({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=ct(t.getAttributes,void 0,r)||{},a=e.tr.delete(n.from,n.to),u=a.doc.resolve(n.from).blockRange(),f=u&&QS(u,t.type,s);if(!f)return null;if(a.wrap(u,f),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:y}=t.editor.extensionManager,b=g||m.$to.parentOffset&&m.$from.marks();if(b){const w=b.filter(x=>y.includes(x.type.name));a.ensureMarks(w)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(m,s).run()}const p=a.doc.resolve(n.from-1).nodeBefore;p&&p.type===t.type&&Io(a.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,p))&&a.join(n.from-1)},undoable:t.undoable})}var uq=t=>"touches"in t,dq=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=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.clientX-this.startX,f=c.clientY-this.startY;this.handleResize(u,f)},this.handleTouchMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.touches[0];if(!u)return;const f=u.clientX-this.startX,p=u.clientY-this.startY;this.handleResize(f,p)},this.handleMouseUp=()=>{if(!this.isResizing)return;const c=this.element.offsetWidth,u=this.element.offsetHeight;this.onCommit(c,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=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,i,s,a;this.node=t.node,this.editor=t.editor,this.element=t.element,this.element.draggable=!1,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(r=t?.options)!=null&&r.directions&&(this.directions=t.options.directions),(i=t.options)!=null&&i.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(s=t.options)!=null&&s.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(a=t.options)!=null&&a.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!=null?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),i=e.includes("left"),s=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),i&&(t.style.left="0"),s&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,uq(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,t,e),s=this.applyConstraints(r,i,n);this.element.style.width=`${s.width}px`,this.element.style.height=`${s.height}px`,this.onResize&&this.onResize(s.width,s.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,i=this.startHeight;const s=t.includes("right"),a=t.includes("left"),c=t.includes("bottom"),u=t.includes("top");return s?r=this.startWidth+e:a&&(r=this.startWidth-e),c?i=this.startHeight+n:u&&(i=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(s?e:-e)),(t==="top"||t==="bottom")&&(i=this.startHeight+(c?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,t):{width:r,height:i}}applyConstraints(t,e,n){var r,i,s,a;if(!n){let f=Math.max(this.minSize.width,t),p=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(f=Math.min(this.maxSize.width,f)),(i=this.maxSize)!=null&&i.height&&(p=Math.min(this.maxSize.height,p)),{width:f,height:p}}let c=t,u=e;return c<this.minSize.width&&(c=this.minSize.width,u=c/this.aspectRatio),u<this.minSize.height&&(u=this.minSize.height,c=u*this.aspectRatio),(s=this.maxSize)!=null&&s.width&&c>this.maxSize.width&&(c=this.maxSize.width,u=c/this.aspectRatio),(a=this.maxSize)!=null&&a.height&&u>this.maxSize.height&&(u=this.maxSize.height,c=u*this.aspectRatio),{width:c,height:u}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",i=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:i?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}},bn=class VD extends Tw{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new VD(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Ao(t){return new _D({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=ct(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:a}=e,c=r[r.length-1],u=r[0];let f=n.to;if(c){const p=u.search(/\S/),m=n.from+u.indexOf(c),g=m+c.length;if(xw(n.from,n.to,e.doc).filter(w=>w.mark.type.excluded.find(k=>k===t.type&&k!==w.mark.type)).filter(w=>w.to>m).length)return null;g<n.to&&a.delete(g,n.to),m>n.from&&a.delete(n.from+p,m),f=n.from+p+c.length,a.addMark(n.from+p,f,t.type.create(s||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||a.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:fq,getOwnPropertySymbols:hq}=Object,{hasOwnProperty:pq}=Object.prototype;function Jv(t,e){return function(r,i,s){return t(r,i,s)&&e(r,i,s)}}function bh(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);const{cache:s}=i,a=s.get(n),c=s.get(r);if(a&&c)return a===r&&c===n;s.set(n,r),s.set(r,n);const u=t(n,r,i);return s.delete(n),s.delete(r),u}}function mq(t){return t?.[Symbol.toStringTag]}function oA(t){return fq(t).concat(hq(t))}const gq=Object.hasOwn||((t,e)=>pq.call(t,e));function $a(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const yq="__v",vq="__o",bq="_owner",{getOwnPropertyDescriptor:aA,keys:lA}=Object;function Sq(t,e){return t.byteLength===e.byteLength&&Ip(new Uint8Array(t),new Uint8Array(e))}function wq(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 xq(t,e){return t.byteLength===e.byteLength&&Ip(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function kq(t,e){return $a(t.getTime(),e.getTime())}function Cq(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function Eq(t,e){return t===e}function cA(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.entries();let a,c,u=0;for(;(a=s.next())&&!a.done;){const f=e.entries();let p=!1,m=0;for(;(c=f.next())&&!c.done;){if(i[m]){m++;continue}const g=a.value,y=c.value;if(n.equals(g[0],y[0],u,m,t,e,n)&&n.equals(g[1],y[1],g[0],y[0],t,e,n)){p=i[m]=!0;break}m++}if(!p)return!1;u++}return!0}const Tq=$a;function _q(t,e,n){const r=lA(t);let i=r.length;if(lA(e).length!==i)return!1;for(;i-- >0;)if(!HD(t,e,n,r[i]))return!1;return!0}function xu(t,e,n){const r=oA(t);let i=r.length;if(oA(e).length!==i)return!1;let s,a,c;for(;i-- >0;)if(s=r[i],!HD(t,e,n,s)||(a=aA(t,s),c=aA(e,s),(a||c)&&(!a||!c||a.configurable!==c.configurable||a.enumerable!==c.enumerable||a.writable!==c.writable)))return!1;return!0}function Aq(t,e){return $a(t.valueOf(),e.valueOf())}function Rq(t,e){return t.source===e.source&&t.flags===e.flags}function uA(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.values();let a,c;for(;(a=s.next())&&!a.done;){const u=e.values();let f=!1,p=0;for(;(c=u.next())&&!c.done;){if(!i[p]&&n.equals(a.value,c.value,a.value,c.value,t,e,n)){f=i[p]=!0;break}p++}if(!f)return!1}return!0}function Ip(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 Mq(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 HD(t,e,n,r){return(r===bq||r===vq||r===yq)&&(t.$$typeof||e.$$typeof)?!0:gq(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const Oq="[object ArrayBuffer]",Nq="[object Arguments]",Dq="[object Boolean]",Iq="[object DataView]",Lq="[object Date]",zq="[object Error]",Pq="[object Map]",jq="[object Number]",Bq="[object Object]",$q="[object RegExp]",Vq="[object Set]",Hq="[object String]",Uq={"[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},Fq="[object URL]",qq=Object.prototype.toString;function Gq({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:a,areNumbersEqual:c,areObjectsEqual:u,arePrimitiveWrappersEqual:f,areRegExpsEqual:p,areSetsEqual:m,areTypedArraysEqual:g,areUrlsEqual:y,unknownTagComparators:b}){return function(x,k,T){if(x===k)return!0;if(x==null||k==null)return!1;const A=typeof x;if(A!==typeof k)return!1;if(A!=="object")return A==="number"?c(x,k,T):A==="function"?s(x,k,T):!1;const _=x.constructor;if(_!==k.constructor)return!1;if(_===Object)return u(x,k,T);if(Array.isArray(x))return e(x,k,T);if(_===Date)return r(x,k,T);if(_===RegExp)return p(x,k,T);if(_===Map)return a(x,k,T);if(_===Set)return m(x,k,T);const O=qq.call(x);if(O===Lq)return r(x,k,T);if(O===$q)return p(x,k,T);if(O===Pq)return a(x,k,T);if(O===Vq)return m(x,k,T);if(O===Bq)return typeof x.then!="function"&&typeof k.then!="function"&&u(x,k,T);if(O===Fq)return y(x,k,T);if(O===zq)return i(x,k,T);if(O===Nq)return u(x,k,T);if(Uq[O])return g(x,k,T);if(O===Oq)return t(x,k,T);if(O===Iq)return n(x,k,T);if(O===Dq||O===jq||O===Hq)return f(x,k,T);if(b){let N=b[O];if(!N){const I=mq(x);I&&(N=b[I])}if(N)return N(x,k,T)}return!1}}function Wq({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:Sq,areArraysEqual:n?xu:wq,areDataViewsEqual:xq,areDatesEqual:kq,areErrorsEqual:Cq,areFunctionsEqual:Eq,areMapsEqual:n?Jv(cA,xu):cA,areNumbersEqual:Tq,areObjectsEqual:n?xu:_q,arePrimitiveWrappersEqual:Aq,areRegExpsEqual:Rq,areSetsEqual:n?Jv(uA,xu):uA,areTypedArraysEqual:n?Jv(Ip,xu):Ip,areUrlsEqual:Mq,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const i=bh(r.areArraysEqual),s=bh(r.areMapsEqual),a=bh(r.areObjectsEqual),c=bh(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:a,areSetsEqual:c})}return r}function Kq(t){return function(e,n,r,i,s,a,c){return t(e,n,c)}}function Zq({circular:t,comparator:e,createState:n,equals:r,strict:i}){if(n)return function(c,u){const{cache:f=t?new WeakMap:void 0,meta:p}=n();return e(c,u,{cache:f,equals:r,meta:p,strict:i})};if(t)return function(c,u){return e(c,u,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const s={cache:void 0,equals:r,meta:void 0,strict:i};return function(c,u){return e(c,u,s)}}const Yq=zo();zo({strict:!0});zo({circular:!0});zo({circular:!0,strict:!0});zo({createInternalComparator:()=>$a});zo({strict:!0,createInternalComparator:()=>$a});zo({circular:!0,createInternalComparator:()=>$a});zo({circular:!0,createInternalComparator:()=>$a,strict:!0});function zo(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:i=!1}=t,s=Wq(t),a=Gq(s),c=n?n(a):Kq(a);return Zq({circular:e,comparator:a,createState:r,equals:c,strict:i})}var Qv={exports:{}},eb={};var dA;function Xq(){if(dA)return eb;dA=1;var t=xd(),e=EO();function n(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,a=t.useEffect,c=t.useMemo,u=t.useDebugValue;return eb.useSyncExternalStoreWithSelector=function(f,p,m,g,y){var b=s(null);if(b.current===null){var w={hasValue:!1,value:null};b.current=w}else w=b.current;b=c(function(){function k(N){if(!T){if(T=!0,A=N,N=g(N),y!==void 0&&w.hasValue){var I=w.value;if(y(I,N))return _=I}return _=N}if(I=_,r(A,N))return I;var j=g(N);return y!==void 0&&y(I,j)?(A=N,I):(A=N,_=j)}var T=!1,A,_,O=m===void 0?null:m;return[function(){return k(p())},O===null?void 0:function(){return k(O())}]},[p,m,g,y]);var x=i(f,b[0],b[1]);return a(function(){w.hasValue=!0,w.value=x},[x]),u(x),x},eb}var fA;function Jq(){return fA||(fA=1,Qv.exports=Xq()),Qv.exports}var Qq=Jq(),e9=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},t9=({contentComponent:t})=>{const e=TO.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return E.jsx(E.Fragment,{children:Object.values(e)})};function n9(){const t=new Set;let e={},n=!1;const r=()=>{n||!t.size||(n=!0,queueMicrotask(()=>{n=!1,t.forEach(i=>i())}))};return{subscribe(i){return t.add(i),()=>{t.delete(i)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(i,s){e={...e,[i]:bH.createPortal(s.reactElement,s.element,i)},r()},removeRenderer(i){const s={...e};delete s[i],e=s,r()}}}var r9=class extends je.Component{constructor(t){super(t),this.editorContentRef=je.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=n9(),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 E.jsxs(E.Fragment,{children:[E.jsx("div",{ref:e9(e,this.editorContentRef),...n}),t?.contentComponent&&E.jsx(t9,{contentComponent:t.contentComponent})]})}},i9=R.forwardRef((t,e)=>{const n=je.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return je.createElement(r9,{key:n,innerRef:e,...t})}),UD=je.memo(i9),s9=typeof window<"u"?R.useLayoutEffect:R.useEffect,o9=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){let e;const n=i=>{i?.transaction!==void 0&&i.transaction===e||(e=i?.transaction,this.transactionNumber+=1,this.subscribers.forEach(s=>s()))},r=this.editor;return r.on("transaction",n),r.on("update",n),()=>{r.off("transaction",n),r.off("update",n)}}}};function FD(t){var e;const[n]=R.useState(()=>new o9(t.editor)),r=Qq.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:Yq);return s9(()=>n.watch(t.editor),[t.editor,n]),R.useDebugValue(r),r}var a9=!1,qD=typeof window>"u",l9=qD||!!(typeof window<"u"&&window.next),c9=class GD{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 qD?(n&&a9&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):l9&&e===void 0&&(n=!1),n?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)==null?void 0:s.call(i,...r)},onBlur:(...r)=>{var i,s;return(s=(i=this.options.current).onBlur)==null?void 0:s.call(i,...r)},onCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onCreate)==null?void 0:s.call(i,...r)},onDestroy:(...r)=>{var i,s;return(s=(i=this.options.current).onDestroy)==null?void 0:s.call(i,...r)},onFocus:(...r)=>{var i,s;return(s=(i=this.options.current).onFocus)==null?void 0:s.call(i,...r)},onSelectionUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)==null?void 0:s.call(i,...r)},onTransaction:(...r)=>{var i,s;return(s=(i=this.options.current).onTransaction)==null?void 0:s.call(i,...r)},onUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onUpdate)==null?void 0:s.call(i,...r)},onContentError:(...r)=>{var i,s;return(s=(i=this.options.current).onContentError)==null?void 0:s.call(i,...r)},onDrop:(...r)=>{var i,s;return(s=(i=this.options.current).onDrop)==null?void 0:s.call(i,...r)},onPaste:(...r)=>{var i,s;return(s=(i=this.options.current).onPaste)==null?void 0:s.call(i,...r)},onDelete:(...r)=>{var i,s;return(s=(i=this.options.current).onDelete)==null?void 0:s.call(i,...r)},onMount:(...r)=>{var i,s;return(s=(i=this.options.current).onMount)==null?void 0:s.call(i,...r)},onUnmount:(...r)=>{var i,s;return(s=(i=this.options.current).onUnmount)==null?void 0:s.call(i,...r)}};return new cq(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,s)=>{var a;return i===((a=n.extensions)==null?void 0:a[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?GD.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function u9(t={},e=[]){const n=R.useRef(t);n.current=t;const[r]=R.useState(()=>new c9(n)),i=TO.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return R.useDebugValue(i),R.useEffect(r.onRender(e)),FD({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&s===0?0:s+1}),i}var WD=R.createContext({editor:null});WD.Consumer;var d9=R.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),f9=()=>R.useContext(d9);je.forwardRef((t,e)=>{const{onDragStart:n}=f9(),r=t.as||"div";return E.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});je.createContext({markViewContentRef:()=>{}});var _w=R.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});_w.displayName="TiptapContext";var h9=()=>R.useContext(_w);function KD({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=R.useMemo(()=>({editor:n}),[n]),i=R.useMemo(()=>({editor:n}),[n]);return E.jsx(WD.Provider,{value:i,children:E.jsx(_w.Provider,{value:r,children:t})})}KD.displayName="Tiptap";function ZD({...t}){const{editor:e}=h9();return E.jsx(UD,{editor:e,...t})}ZD.displayName="Tiptap.Content";Object.assign(KD,{Content:ZD});var Lp=(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]},p9=(t,e)=>{var n;const{state:r,view:i}=t,{selection:s}=r;if(!s.empty)return!1;const{$from:a}=s;if(a.parentOffset!==0)return!1;const c=a.depth-1;if(c<0)return!1;const u=a.node(c),f=a.index(c);if(f===0)return!1;if(u.type===e)return t.commands.lift(e.name);const p=u.child(f-1);if(p.type!==e||!((n=p.lastChild)!=null&&n.isTextblock))return!1;const m=a.before(),y=m-1-1,{tr:b}=r;return b.delete(m,a.after()).insert(y,a.parent.content),b.setSelection(Ne.create(b.doc,y)),i.dispatch(b.scrollIntoView()),!0},m9=/^\s*>\s$/,g9=bn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Lp("blockquote",{...At(this.options.HTMLAttributes,t),children:Lp("slot",{})})},parseMarkdown:(t,e)=>{var n;const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach((i,s)=>{var a,c;const p=((c=(a=e.renderChild)==null?void 0:a.call(e,i,s))!=null?c:e.renderChildren([i])).split(`
|
|
168
|
-
`).map(m=>m.trim()===""?n:`${n} ${m}`);r.push(p.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:()=>p9(this.editor,this.type)}},addInputRules(){return[dc({find:m9,type:this.type})]}}),y9=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,v9=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,b9=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,S9=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,w9=Ba.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 Lp("strong",{...At(this.options.HTMLAttributes,t),children:Lp("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[Aa({find:y9,type:this.type}),Aa({find:b9,type:this.type})]},addPasteRules(){return[Ao({find:v9,type:this.type}),Ao({find:S9,type:this.type})]}}),x9=t=>{const e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},k9=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},C9=Ba.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",At(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[Aa({find:x9,type:this.type})]},addPasteRules(){return[Ao({find:k9,type:this.type})]}}),tb=4,E9=/^```([a-z]+)?[\s\n]$/,T9=/^~~~([a-z]+)?[\s\n]$/,_9=bn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:tb,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const s=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(a=>a.startsWith(n)).map(a=>a.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",At(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const i=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${i}`,e.renderChildren(t.content),"```"].join(`
|
|
172
|
-
`):r=`\`\`\`${i}
|
|
173
|
-
|
|
174
|
-
\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:tb,{state:r}=t,{selection:i}=r,{$from:s,empty:a}=i;if(s.parent.type!==this.type)return!1;const c=" ".repeat(n);return a?t.commands.insertContent(c):t.commands.command(({tr:u})=>{const{from:f,to:p}=i,y=r.doc.textBetween(f,p,`
|
|
175
|
-
`,`
|
|
176
|
-
`).split(`
|
|
177
|
-
`).map(b=>c+b).join(`
|
|
178
|
-
`);return u.replaceWith(f,p,r.schema.text(y)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:tb,{state:r}=t,{selection:i}=r,{$from:s,empty:a}=i;return s.parent.type!==this.type?!1:a?t.commands.command(({tr:c})=>{var u;const{pos:f}=s,p=s.start(),m=s.end(),y=r.doc.textBetween(p,m,`
|
|
179
|
-
`,`
|
|
180
|
-
`).split(`
|
|
181
|
-
`);let b=0,w=0;const x=f-p;for(let N=0;N<y.length;N+=1){if(w+y[N].length>=x){b=N;break}w+=y[N].length+1}const T=((u=y[b].match(/^ */))==null?void 0:u[0])||"",A=Math.min(T.length,n);if(A===0)return!0;let _=p;for(let N=0;N<b;N+=1)_+=y[N].length+1;return c.delete(_,_+A),f-_<=A&&c.setSelection(Ne.create(c.doc,_)),!0}):t.commands.command(({tr:c})=>{const{from:u,to:f}=i,g=r.doc.textBetween(u,f,`
|
|
182
|
-
`,`
|
|
183
|
-
`).split(`
|
|
184
|
-
`).map(y=>{var b;const w=((b=y.match(/^ */))==null?void 0:b[0])||"",x=Math.min(w.length,n);return y.slice(x)}).join(`
|
|
185
|
-
`);return c.replaceWith(u,f,r.schema.text(g)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,a=r.parent.textContent.endsWith(`
|
|
186
|
-
|
|
187
|
-
`);return!s||!a?!1:t.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:t})=>{if(!this.options.exitOnArrowUp)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||r.parentOffset!==0)return!1;const s=r.before();return s>0?!1:t.commands.insertDefaultBlock({pos:s})},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const c=i.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:f})=>(f.setSelection($e.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[A0({find:E9,type:this.type,getAttributes:t=>({language:t[1]})}),A0({find:T9,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Rt({key:new Gt("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i?.mode;if(!n||!s)return!1;const{tr:a,schema:c}=t.state,u=c.text(n.replace(/\r\n?/g,`
|
|
188
|
-
`));return a.replaceSelectionWith(this.type.create({language:s},u)),a.selection.$from.parent.type!==this.type&&a.setSelection(Ne.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta("paste",!0),t.dispatch(a),!0}}})]}}),A9=bn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
189
|
-
|
|
190
|
-
`):""}),R9=bn.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",At(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
191
|
-
`},renderMarkdown:()=>`
|
|
192
|
-
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:a}=this.options,{splittableMarks:c}=r.extensionManager,u=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:f,dispatch:p})=>{if(p&&u&&a){const m=u.filter(g=>c.includes(g.type.name));f.ensureMarks(m)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),M9=bn.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]}`,At(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,i="#".repeat(r);return t.content?`${i} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>A0({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),O9=bn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",At(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!V5(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,i=t();return wD(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:a,dispatch:c})=>{if(c){const{$to:u}=a.selection,f=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?a.setSelection(Ne.create(a.doc,u.pos+1)):u.nodeAfter.isBlock?a.setSelection(Ie.create(a.doc,u.pos)):a.setSelection(Ne.create(a.doc,u.pos));else{const p=s.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,m=p?.create();m&&(a.insert(f,m),a.setSelection(Ne.create(a.doc,f+1)))}a.scrollIntoView()}return!0}).run()}}},addInputRules(){return[$D({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),N9=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,D9=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,I9=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,L9=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,z9=Ba.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",At(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[Aa({find:N9,type:this.type}),Aa({find:I9,type:this.type})]},addPasteRules(){return[Ao({find:D9,type:this.type}),Ao({find:L9,type:this.type})]}});const P9="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",j9="ελ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",R0="numeric",M0="ascii",O0="alpha",qu="asciinumeric",Lu="alphanumeric",N0="domain",YD="emoji",B9="scheme",$9="slashscheme",nb="whitespace";function V9(t,e){return t in e||(e[t]=[]),e[t]}function pa(t,e,n){e[R0]&&(e[qu]=!0,e[Lu]=!0),e[M0]&&(e[qu]=!0,e[O0]=!0),e[qu]&&(e[Lu]=!0),e[O0]&&(e[Lu]=!0),e[Lu]&&(e[N0]=!0),e[YD]&&(e[N0]=!0);for(const r in e){const i=V9(r,n);i.indexOf(t)<0&&i.push(t)}}function H9(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function sr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}sr.groups={};sr.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||sr.groups;let i;return e&&e.j?i=e:(i=new sr(e),n&&r&&pa(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let a=0;a<s-1;a++)i=i.tt(t[a]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||sr.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let a,c=i.go(t);if(c?(a=new sr,Object.assign(a.j,c.j),a.jr.push.apply(a.jr,c.jr),a.jd=c.jd,a.t=c.t):a=new sr,s){if(r)if(a.t&&typeof a.t=="string"){const u=Object.assign(H9(a.t,r),n);pa(s,u,r)}else n&&pa(s,n,r);a.t=s}return i.j[t]=a,a}};const Ze=(t,e,n,r,i)=>t.ta(e,n,r,i),Ut=(t,e,n,r,i)=>t.tr(e,n,r,i),hA=(t,e,n,r,i)=>t.ts(e,n,r,i),ue=(t,e,n,r,i)=>t.tt(e,n,r,i),Yi="WORD",D0="UWORD",XD="ASCIINUMERICAL",JD="ALPHANUMERICAL",yd="LOCALHOST",I0="TLD",L0="UTLD",Xh="SCHEME",jl="SLASH_SCHEME",Aw="NUM",z0="WS",Rw="NL",Gu="OPENBRACE",Wu="CLOSEBRACE",zp="OPENBRACKET",Pp="CLOSEBRACKET",jp="OPENPAREN",Bp="CLOSEPAREN",$p="OPENANGLEBRACKET",Vp="CLOSEANGLEBRACKET",Hp="FULLWIDTHLEFTPAREN",Up="FULLWIDTHRIGHTPAREN",Fp="LEFTCORNERBRACKET",qp="RIGHTCORNERBRACKET",Gp="LEFTWHITECORNERBRACKET",Wp="RIGHTWHITECORNERBRACKET",Kp="FULLWIDTHLESSTHAN",Zp="FULLWIDTHGREATERTHAN",Yp="AMPERSAND",Xp="APOSTROPHE",Jp="ASTERISK",eo="AT",Qp="BACKSLASH",em="BACKTICK",tm="CARET",ma="COLON",Mw="COMMA",nm="DOLLAR",gi="DOT",rm="EQUALS",Ow="EXCLAMATION",Ir="HYPHEN",Ku="PERCENT",im="PIPE",sm="PLUS",om="POUND",Zu="QUERY",Nw="QUOTE",QD="FULLWIDTHMIDDLEDOT",Dw="SEMI",yi="SLASH",Yu="TILDE",am="UNDERSCORE",eI="EMOJI",lm="SYM";var tI=Object.freeze({__proto__:null,ALPHANUMERICAL:JD,AMPERSAND:Yp,APOSTROPHE:Xp,ASCIINUMERICAL:XD,ASTERISK:Jp,AT:eo,BACKSLASH:Qp,BACKTICK:em,CARET:tm,CLOSEANGLEBRACKET:Vp,CLOSEBRACE:Wu,CLOSEBRACKET:Pp,CLOSEPAREN:Bp,COLON:ma,COMMA:Mw,DOLLAR:nm,DOT:gi,EMOJI:eI,EQUALS:rm,EXCLAMATION:Ow,FULLWIDTHGREATERTHAN:Zp,FULLWIDTHLEFTPAREN:Hp,FULLWIDTHLESSTHAN:Kp,FULLWIDTHMIDDLEDOT:QD,FULLWIDTHRIGHTPAREN:Up,HYPHEN:Ir,LEFTCORNERBRACKET:Fp,LEFTWHITECORNERBRACKET:Gp,LOCALHOST:yd,NL:Rw,NUM:Aw,OPENANGLEBRACKET:$p,OPENBRACE:Gu,OPENBRACKET:zp,OPENPAREN:jp,PERCENT:Ku,PIPE:im,PLUS:sm,POUND:om,QUERY:Zu,QUOTE:Nw,RIGHTCORNERBRACKET:qp,RIGHTWHITECORNERBRACKET:Wp,SCHEME:Xh,SEMI:Dw,SLASH:yi,SLASH_SCHEME:jl,SYM:lm,TILDE:Yu,TLD:I0,UNDERSCORE:am,UTLD:L0,UWORD:D0,WORD:Yi,WS:z0});const Wi=/[a-z]/,ku=new RegExp("\\p{L}","u"),rb=new RegExp("\\p{Emoji}","u"),Ki=/\d/,ib=/\s/,pA="\r",sb=`
|
|
193
|
-
`,U9="️",F9="",ob="";let Sh=null,wh=null;function q9(t=[]){const e={};sr.groups=e;const n=new sr;Sh==null&&(Sh=mA(P9)),wh==null&&(wh=mA(j9)),ue(n,"'",Xp),ue(n,"{",Gu),ue(n,"}",Wu),ue(n,"[",zp),ue(n,"]",Pp),ue(n,"(",jp),ue(n,")",Bp),ue(n,"<",$p),ue(n,">",Vp),ue(n,"(",Hp),ue(n,")",Up),ue(n,"「",Fp),ue(n,"」",qp),ue(n,"『",Gp),ue(n,"』",Wp),ue(n,"<",Kp),ue(n,">",Zp),ue(n,"&",Yp),ue(n,"*",Jp),ue(n,"@",eo),ue(n,"`",em),ue(n,"^",tm),ue(n,":",ma),ue(n,",",Mw),ue(n,"$",nm),ue(n,".",gi),ue(n,"=",rm),ue(n,"!",Ow),ue(n,"-",Ir),ue(n,"%",Ku),ue(n,"|",im),ue(n,"+",sm),ue(n,"#",om),ue(n,"?",Zu),ue(n,'"',Nw),ue(n,"/",yi),ue(n,";",Dw),ue(n,"~",Yu),ue(n,"_",am),ue(n,"\\",Qp),ue(n,"・",QD);const r=Ut(n,Ki,Aw,{[R0]:!0});Ut(r,Ki,r);const i=Ut(r,Wi,XD,{[qu]:!0}),s=Ut(r,ku,JD,{[Lu]:!0}),a=Ut(n,Wi,Yi,{[M0]:!0});Ut(a,Ki,i),Ut(a,Wi,a),Ut(i,Ki,i),Ut(i,Wi,i);const c=Ut(n,ku,D0,{[O0]:!0});Ut(c,Wi),Ut(c,Ki,s),Ut(c,ku,c),Ut(s,Ki,s),Ut(s,Wi),Ut(s,ku,s);const u=ue(n,sb,Rw,{[nb]:!0}),f=ue(n,pA,z0,{[nb]:!0}),p=Ut(n,ib,z0,{[nb]:!0});ue(n,ob,p),ue(f,sb,u),ue(f,ob,p),Ut(f,ib,p),ue(p,pA),ue(p,sb),Ut(p,ib,p),ue(p,ob,p);const m=Ut(n,rb,eI,{[YD]:!0});ue(m,"#"),Ut(m,rb,m),ue(m,U9,m);const g=ue(m,F9);ue(g,"#"),Ut(g,rb,m);const y=[[Wi,a],[Ki,i]],b=[[Wi,null],[ku,c],[Ki,s]];for(let w=0;w<Sh.length;w++)Zs(n,Sh[w],I0,Yi,y);for(let w=0;w<wh.length;w++)Zs(n,wh[w],L0,D0,b);pa(I0,{tld:!0,ascii:!0},e),pa(L0,{utld:!0,alpha:!0},e),Zs(n,"file",Xh,Yi,y),Zs(n,"mailto",Xh,Yi,y),Zs(n,"http",jl,Yi,y),Zs(n,"https",jl,Yi,y),Zs(n,"ftp",jl,Yi,y),Zs(n,"ftps",jl,Yi,y),pa(Xh,{scheme:!0,ascii:!0},e),pa(jl,{slashscheme:!0,ascii:!0},e),t=t.sort((w,x)=>w[0]>x[0]?1:-1);for(let w=0;w<t.length;w++){const x=t[w][0],T=t[w][1]?{[B9]:!0}:{[$9]:!0};x.indexOf("-")>=0?T[N0]=!0:Wi.test(x)?Ki.test(x)?T[qu]=!0:T[M0]=!0:T[R0]=!0,hA(n,x,x,T)}return hA(n,"localhost",yd,{ascii:!0}),n.jd=new sr(lm),{start:n,tokens:Object.assign({groups:e},tI)}}function nI(t,e){const n=G9(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,i=[];let s=0,a=0;for(;a<r;){let c=t,u=null,f=0,p=null,m=-1,g=-1;for(;a<r&&(u=c.go(n[a]));)c=u,c.accepts()?(m=0,g=0,p=c):m>=0&&(m+=n[a].length,g++),f+=n[a].length,s+=n[a].length,a++;s-=m,a-=g,f-=m,i.push({t:p.t,v:e.slice(s-f,s),s:s-f,e:s})}return i}function G9(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),s,a=i<55296||i>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(a),r+=a.length}return e}function Zs(t,e,n,r,i){let s;const a=e.length;for(let c=0;c<a-1;c++){const u=e[c];t.j[u]?s=t.j[u]:(s=new sr(r),s.jr=i.slice(),t.j[u]=s),t=s}return s=new sr(n),s.jr=i.slice(),t.j[e[a-1]]=s,s}function mA(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let s=0;for(;i.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let a=parseInt(t.substring(r,r+s),10);a>0;a--)n.pop();r+=s}else n.push(t[r]),r++}return e}const vd={defaultProtocol:"http",events:null,format:gA,formatHref:gA,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Iw(t,e=null){let n=Object.assign({},vd);t&&(n=Object.assign(n,t instanceof Iw?t.o:t));const r=n.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}Iw.prototype={o:vd,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:vd[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function gA(t){return t}function rI(t,e){this.t="token",this.v=t,this.tk=e}rI.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=vd.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),s=this.toFormattedString(t),a={},c=t.get("className",n,e),u=t.get("target",n,e),f=t.get("rel",n,e),p=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return a.href=r,c&&(a.class=c),u&&(a.target=u),f&&(a.rel=f),p&&Object.assign(a,p),{tagName:i,attributes:a,content:s,eventListeners:m}}};function $m(t,e){class n extends rI{constructor(i,s){super(i,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const W9=$m("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),yA=$m("text"),K9=$m("nl"),xh=$m("url",{isLink:!0,toHref(t=vd.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==yd&&t[1].t===ma}}),Dr=t=>new sr(t);function Z9({groups:t}){const e=t.domain.concat([Yp,Jp,eo,Qp,em,tm,nm,rm,Ir,Aw,Ku,im,sm,om,yi,lm,Yu,am]),n=[Xp,ma,Mw,gi,Ow,Ku,Zu,Nw,Dw,$p,Vp,Gu,Wu,Pp,zp,jp,Bp,Hp,Up,Fp,qp,Gp,Wp,Kp,Zp],r=[Yp,Xp,Jp,Qp,em,tm,nm,rm,Ir,Gu,Wu,Ku,im,sm,om,Zu,yi,lm,Yu,am],i=Dr(),s=ue(i,Yu);Ze(s,r,s),Ze(s,t.domain,s);const a=Dr(),c=Dr(),u=Dr();Ze(i,t.domain,a),Ze(i,t.scheme,c),Ze(i,t.slashscheme,u),Ze(a,r,s),Ze(a,t.domain,a);const f=ue(a,eo);ue(s,eo,f),ue(c,eo,f),ue(u,eo,f);const p=ue(s,gi);Ze(p,r,s),Ze(p,t.domain,s);const m=Dr();Ze(f,t.domain,m),Ze(m,t.domain,m);const g=ue(m,gi);Ze(g,t.domain,m);const y=Dr(W9);Ze(g,t.tld,y),Ze(g,t.utld,y),ue(f,yd,y);const b=ue(m,Ir);ue(b,Ir,b),Ze(b,t.domain,m),Ze(y,t.domain,m),ue(y,gi,g),ue(y,Ir,b);const w=ue(a,Ir),x=ue(a,gi);ue(w,Ir,w),Ze(w,t.domain,a),Ze(x,r,s),Ze(x,t.domain,a);const k=Dr(xh);Ze(x,t.tld,k),Ze(x,t.utld,k),Ze(k,t.domain,a),Ze(k,r,s),ue(k,gi,x),ue(k,Ir,w),ue(k,eo,f);const T=ue(k,ma),A=Dr(xh);Ze(T,t.numeric,A);const _=Dr(xh),O=Dr();Ze(_,e,_),Ze(_,n,O),Ze(O,e,_),Ze(O,n,O),ue(k,yi,_),ue(A,yi,_);const N=ue(c,ma),I=ue(u,ma),j=ue(I,yi),G=ue(j,yi);Ze(c,t.domain,a),ue(c,gi,x),ue(c,Ir,w),Ze(u,t.domain,a),ue(u,gi,x),ue(u,Ir,w),Ze(N,t.domain,_),ue(N,yi,_),ue(N,Zu,_),Ze(G,t.domain,_),Ze(G,e,_),ue(G,yi,_);const Y=[[Gu,Wu],[zp,Pp],[jp,Bp],[$p,Vp],[Hp,Up],[Fp,qp],[Gp,Wp],[Kp,Zp]];for(let ce=0;ce<Y.length;ce++){const[X,te]=Y[ce],ie=ue(_,X);ue(O,X,ie);const he=Dr(xh);Ze(ie,e,he);const B=Dr();Ze(ie,n,B),ue(ie,te,_),Ze(he,e,he),Ze(he,n,B),Ze(B,e,he),Ze(B,n,B),ue(he,te,_),ue(B,te,_)}return ue(i,yd,k),ue(i,Rw,K9),{start:i,tokens:tI}}function Y9(t,e,n){let r=n.length,i=0,s=[],a=[];for(;i<r;){let c=t,u=null,f=null,p=0,m=null,g=-1;for(;i<r&&!(u=c.go(n[i].t));)a.push(n[i++]);for(;i<r&&(f=u||c.go(n[i].t));)u=null,c=f,c.accepts()?(g=0,m=c):g>=0&&g++,i++,p++;if(g<0)i-=p,i<r&&(a.push(n[i]),i++);else{a.length>0&&(s.push(ab(yA,e,a)),a=[]),i-=g,p-=g;const y=m.t,b=n.slice(i-p,i);s.push(ab(y,e,b))}}return a.length>0&&s.push(ab(yA,e,a)),s}function ab(t,e,n){const r=n[0].s,i=n[n.length-1].e,s=e.slice(r,i);return new t(s,n)}const X9=typeof console<"u"&&console&&console.warn||(()=>{}),J9="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Nt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Q9(){return sr.groups={},Nt.scanner=null,Nt.parser=null,Nt.tokenQueue=[],Nt.pluginQueue=[],Nt.customSchemes=[],Nt.initialized=!1,Nt}function vA(t,e=!1){if(Nt.initialized&&X9(`linkifyjs: already initialized - will not register custom scheme "${t}" ${J9}`),!/^[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`);Nt.customSchemes.push([t,e])}function eG(){Nt.scanner=q9(Nt.customSchemes);for(let t=0;t<Nt.tokenQueue.length;t++)Nt.tokenQueue[t][1]({scanner:Nt.scanner});Nt.parser=Z9(Nt.scanner.tokens);for(let t=0;t<Nt.pluginQueue.length;t++)Nt.pluginQueue[t][1]({scanner:Nt.scanner,parser:Nt.parser});return Nt.initialized=!0,Nt}function Lw(t){return Nt.initialized||eG(),Y9(Nt.parser.start,t,nI(Nt.scanner.start,t))}Lw.scan=nI;function iI(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 Iw(n),i=Lw(t),s=[];for(let a=0;a<i.length;a++){const c=i[a];c.isLink&&(!e||c.t===e)&&r.check(c)&&s.push(c.toFormattedObject(r))}return s}var zw="[\0- -\u2029 ]",tG=new RegExp(zw),nG=new RegExp(`${zw}$`),rG=new RegExp(zw,"g");function iG(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function sG(t){return new Rt({key:new Gt("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(f=>f.docChanged)&&!n.doc.eq(r.doc),s=e.some(f=>f.getMeta("preventAutolink"));if(!i||s)return;const{tr:a}=r,c=fD(n.doc,[...e]);if(ww(c).forEach(({newRange:f})=>{const p=t5(r.doc,f,y=>y.isTextblock);let m,g;if(p.length>1)m=p[0],g=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(p.length){const y=r.doc.textBetween(f.from,f.to," "," ");if(!nG.test(y))return;m=p[0],g=r.doc.textBetween(m.pos,f.to,void 0," ")}if(m&&g){const y=g.split(tG).filter(Boolean);if(y.length<=0)return!1;const b=y[y.length-1],w=m.pos+g.lastIndexOf(b);if(!b)return!1;const x=Lw(b).map(k=>k.toObject(t.defaultProtocol));if(!iG(x))return!1;x.filter(k=>k.isLink).map(k=>({...k,from:w+k.start+1,to:w+k.end+1})).filter(k=>r.schema.marks.code?!r.doc.rangeHasMark(k.from,k.to,r.schema.marks.code):!0).filter(k=>t.validate(k.value)).filter(k=>t.shouldAutoLink(k.value)).forEach(k=>{xw(k.from,k.to,r.doc).some(T=>T.mark.type===t.type)||a.addMark(k.from,k.to,t.type.create({href:k.href}))})}}),!!a.steps.length)return a}})}function oG(t){return new Rt({key:new Gt("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let a=null;if(r.target instanceof HTMLAnchorElement)a=r.target;else{const u=r.target;if(!u)return!1;const f=t.editor.view.dom;a=u.closest("a"),a&&!f.contains(a)&&(a=null)}if(!a)return!1;let c=!1;if(t.enableClickSelection&&(c=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const u=SD(e.state,t.type.name),f=(i=a.href)!=null?i:u.href,p=(s=a.target)!=null?s:u.target;f&&(window.open(f,p),c=!0)}return c}}})}var aG=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,lG=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function sI(t,e){let n=0;for(let r=e-1;r>=0&&t[r]==="\\";r-=1)n+=1;return n%2===1}function cG(t,e){let n=0,r=0;for(;r<e;){if(t[r]!=="`"){r+=1;continue}if(n===0&&sI(t,r)){r+=1;continue}let i=0;for(;r<e&&t[r]==="`";)i+=1,r+=1;n===0?n=i:i===n&&(n=0)}return n>0}function oI(t,e,n){var r,i;const[,s,a]=e;return(e.index?t[e.index-1]:void 0)==="!"||sI(t,(r=e.index)!=null?r:0)||cG(t,(i=e.index)!=null?i:0)?!1:!!s.trim()&&n(a)}function aI(t){var e,n;const[r,i,s,,a,c,u]=t,f=(e=a??c)!=null?e:u;return{index:(n=t.index)!=null?n:0,text:r,replaceWith:i,data:{href:s,title:f||null,markdown:!0}}}function uG(t,e){return t.index<e.index+e.text.length&&e.index<t.index+t.text.length}function lI(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 dG(t){const e=Aa({find:n=>{const r=aG.exec(n);return!r||!oI(n,r,t.isAllowedHref)?null:aI(r)},type:t.type,getAttributes:lI});return new Vd({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 fG(t){const e=Ao({find:n=>{var r,i;const s=[];for(const c of n.matchAll(lG))oI(n,c,t.isAllowedHref)&&s.push(aI(c));const a=((i=(r=t.findPlainUrls)==null?void 0:r.call(t,n))!=null?i:[]).filter(c=>!s.some(u=>uG(u,c)));return[...s,...a]},type:t.type,getAttributes:lI});return new _D({find:e.find,handler:n=>{var r;const i=e.handler(n);return i!==null&&n.state.tr.steps.length&&((r=n.match.data)!=null&&r.markdown)&&n.state.tr.setMeta("preventAutolink",!0),i}})}function hG(t){return new Rt({key:new Gt("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:i}=t,{state:s}=e,{selection:a}=s,{empty:c}=a;if(c)return!1;let u="";r.content.forEach(p=>{u+=p.textContent});const f=iI(u,{defaultProtocol:t.defaultProtocol}).find(p=>p.isLink&&p.value===u);return!u||!f||i!==void 0&&!i(f.value)?!1:t.editor.commands.setMark(t.type,{href:f.href})}}})}function Zi(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(rG,"").match(new RegExp(`^(?:(?:${n.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}var pG=Ba.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"){vA(t);return}vA(t.scheme,t.optionalSlashes)})},onDestroy(){Q9()},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)=>!!Zi(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const i=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){var t,e,n;return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:(t=this.options.HTMLAttributes.target)!=null?t:null},rel:{default:(e=this.options.HTMLAttributes.rel)!=null?e:null},class:{default:(n=this.options.HTMLAttributes.class)!=null?n:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Zi(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=>!!Zi(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",At(this.options.HTMLAttributes,t),0]:["a",At(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,i,s;const a=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",c=(s=(i=t.attrs)==null?void 0:i.title)!=null?s:"",u=e.renderChildren(t);return c?`[${u}](${a} "${c}")`:`[${u}](${a})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Zi(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=>!!Zi(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?[dG({type:this.type,isAllowedHref:t=>this.options.isAllowedUri(t,{defaultValidate:e=>!!Zi(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){const t=e=>{const n=[];if(e){const{protocols:r,defaultProtocol:i}=this.options;iI(e).filter(a=>a.isLink&&this.options.isAllowedUri(a.value,{defaultValidate:c=>!!Zi(c,r),protocols:r,defaultProtocol:i})).forEach(a=>{this.options.shouldAutoLink(a.value)&&n.push({text:a.value,data:{href:a.href},index:a.start})})}return n};return this.options.markdownLinks?[fG({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:n=>!!Zi(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:t})]:[Ao({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(sG({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Zi(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(oG({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(hG({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),mG=Object.defineProperty,gG=(t,e)=>{for(var n in e)mG(t,n,{get:e[n],enumerable:!0})},yG="listItem",bA="textStyle",SA=/^\s*([-+*])\s$/,cI=bn.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",At(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(yG,this.editor.getAttributes(bA)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=dc({find:SA,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=dc({find:SA,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(bA),editor:this.editor})),[t]}}),vG=(t,e,n)=>{const{selection:r}=t;if(!r.empty)return null;const{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let s=-1;for(let y=i.depth;y>0;y-=1)if(i.node(y).type.name===e){s=y;break}if(s<0)return null;const a=i.node(s),c=i.index(s);if(c+1>=a.childCount)return null;const u=a.child(c+1);if(!n.includes(u.type.name))return null;const f=t.schema.nodes[e];let p=!1;if(u.forEach(y=>{y.type===f&&y.childCount>1&&(p=!0)}),!p)return null;const m=t.doc.resolve(i.after()).nodeAfter;if(!m||!n.includes(m.type.name))return null;const g=[];return m.forEach(y=>{g.push(y)}),g.length===0?null:{listItemDepth:s,nestedList:m,nestedListPos:i.after(),insertPos:i.after(s),items:g}},bG=(t,e,n,r)=>{const i=vG(t,n,r);if(!i)return!1;const{selection:s}=t,{nestedList:a,nestedListPos:c,insertPos:u,items:f}=i,p=t.tr;p.delete(c,c+a.nodeSize);const m=p.mapping.map(u);return p.insert(m,ne.from(f)),p.setSelection(s.map(p.doc,p.mapping)),e&&e(p),!0},SG=(t,e,n)=>bG(t.state,t.view.dispatch,e,n),uI=(t,e)=>zt.create({name:`${t}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const n=()=>SG(this.editor,t,e);return{Delete:n,"Mod-Delete":n}}}),dI=[[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"]],kh="abcdefghijklmnopqrstuvwxyz",wG="[a-zA-Z]{1,2}",fI=String.raw`\d+|[ivxlcdmIVXLCDM]+|${wG}`;function Vm(t){let e=t,n="";for(const[r,i]of dI)for(;e>=r;)n+=i,e-=r;return n}function Pw(t){return Vm(t).toUpperCase()}function hI(t){const e=t.toLowerCase();let n=0,r=0;for(;n<e.length;){let i=!1;for(const[s,a]of dI)if(e.startsWith(a,n)){r+=s,n+=a.length,i=!0;break}if(!i)return 0}return r}function xG(t){if(!/^[ivxlcdmIVXLCDM]+$/.test(t))return!1;const e=hI(t);return e<=0?!1:(t===t.toLowerCase()?Vm(e):Pw(e))===t}function kG(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 cm(t){if(t<=26)return kh[t-1];const e=Math.floor((t-1)/26)-1,n=(t-1)%26;return e<0?kh[n]:kh[e]+kh[n]}function Hm(t){if(!(!t||/^\d+$/.test(t))){if(xG(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 jw(t){if(/^\d+$/.test(t))return parseInt(t,10);const e=Hm(t);if(e==="i"||e==="I")return hI(t);if(e==="a"||e==="A"){const r=kG(t);return r>0?r:1}const n=parseInt(t,10);return Number.isNaN(n)?1:n}function CG(t,e){if(t==="numeric")return String(e);switch(t){case"a":return cm(e);case"A":return cm(e).toUpperCase();case"i":return Vm(e);case"I":return Pw(e);default:return String(e)}}function EG(t){var e;if(t.length===0)return!1;const n=(e=Hm(t[0]))!=null?e:"numeric",r=jw(t[0]);if(r<1)return!1;for(let i=0;i<t.length;i++){const s=CG(n,r+i);if(t[i]!==s)return!1}return!0}function TG(t){return{type:Hm(t),start:jw(t)}}function _G(t){const{type:e,start:n}=TG(t),r={};return e&&(r.type=e),n!==1&&(r.start=n),r}function AG(t,e,n=". "){const r=e+1;if(!t||t==="1")return`${r}${n}`;switch(t){case"a":return`${cm(r)}${n}`;case"A":return`${cm(r).toUpperCase()}${n}`;case"i":return`${Vm(r)}${n}`;case"I":return`${Pw(r)}${n}`;default:return`${r}${n}`}}function RG(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 MG(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}var pI=bn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",At(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;let i=[];if(t.tokens&&t.tokens.length>0){if(RG(t))return{type:"listItem",content:[{type:"paragraph",content:MG(t.text||"",e)}]};if(t.tokens.some(a=>a.type==="paragraph"))i=r(t.tokens);else{const a=t.tokens[0];if(a&&a.type==="text"&&a.tokens&&a.tokens.length>0){if(i=[{type:"paragraph",content:e.parseInline(a.tokens)}],t.tokens.length>1){const u=t.tokens.slice(1),f=r(u);i.push(...f)}}else i=r(t.tokens)}}return i.length===0&&(i=[{type:"paragraph",content:[]}]),{type:"listItem",content:i}},renderMarkdown:(t,e,n)=>Ew(t,e,r=>{var i,s,a,c;if(r.parentType==="bulletList")return"- ";if(r.parentType==="orderedList"){const u=((s=(i=r.meta)==null?void 0:i.parentAttrs)==null?void 0:s.start)||1,f=(c=(a=r.meta)==null?void 0:a.parentAttrs)==null?void 0:c.type,p=u-1+(r.index||0);return AG(f,p,". ")}return"- "},n),addExtensions(){return[uI(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)}}}),OG={};gG(OG,{findListItemPos:()=>Um,getNextListDepth:()=>Bw,handleBackspace:()=>P0,handleDelete:()=>j0,hasListBefore:()=>mI,hasListItemAfter:()=>NG,hasListItemBefore:()=>DG,listItemHasSubList:()=>IG,nextListIsDeeper:()=>gI,nextListIsHigher:()=>yI});var Um=(t,e)=>{const{$from:n}=e.selection,r=cn(t,e.schema);let i=null,s=n.depth,a=n.pos,c=null;for(;s>0&&c===null;)i=n.node(s),i.type===r?c=s:(s-=1,a-=1);return c===null?null:{$pos:e.doc.resolve(a),depth:c}},Bw=(t,e)=>{const n=Um(t,e);if(!n)return!1;const[,r]=d5(e,t,n.$pos.pos+4);return r},mI=(t,e,n)=>{const{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),s=t.doc.resolve(i).node();return!(!s||!n.includes(s.type.name))},P0=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!_o(t.state,e)&&mI(t.state,e,n)){const{$anchor:r}=t.state.selection,i=t.state.doc.resolve(r.before()-1),s=[];i.node().descendants((u,f)=>{u.type.name===e&&s.push({node:u,pos:f})});const a=s.at(-1);if(!a)return!1;const c=t.state.doc.resolve(i.start()+a.pos+1);return t.chain().cut({from:r.start()-1,to:r.end()+1},c.end()).joinForward().run()}return!_o(t.state,e)||!m5(t.state)?!1:t.chain().liftListItem(e).run()},gI=(t,e)=>{const n=Bw(t,e),r=Um(t,e);return!r||!n?!1:n>r.depth},yI=(t,e)=>{const n=Bw(t,e),r=Um(t,e);return!r||!n?!1:n<r.depth},j0=(t,e)=>{if(!_o(t.state,e)||!p5(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:gI(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():yI(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},NG=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((n=i.nodeAfter)==null?void 0:n.type.name)!==t)},DG=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((n=i.nodeBefore)==null?void 0:n.type.name)!==t)},IG=(t,e,n)=>{if(!n)return!1;const r=cn(t,e.schema);let i=!1;return n.descendants(s=>{s.type===r&&(i=!0)}),i},vI=zt.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&&j0(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&&j0(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&&P0(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&&P0(t,n,r)&&(e=!0)}),e}}}}),B0=new RegExp(`^(\\s*)(${fI})([.)])\\s+(.*)$`),LG=/^\s/,zu={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function zG(t){return B0.test(t.trimStart())}function PG(t){const e=t.trimStart();return zu.bulletItem.test(e)||zG(e)||zu.heading.test(e)||zu.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||zu.codeFence.test(e)}function jG(t){return Object.values(zu).some(e=>e.test(t))}function BG(t){const e=[],n=[];let r=!1;return t.forEach(i=>{if(r){n.push(i);return}if(i.trim()===""){r=!0,n.push(i);return}if(e.length>0&&PG(i)){r=!0,n.push(i);return}e.push(i)}),{paragraphLines:e,blockLines:n}}function $G(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n],s=i.match(B0);if(!s)break;const[,a,c,u,f]=s,p=a.length,m=parseInt(c,10),g=isNaN(m)?Hm(c):void 0,y=isNaN(m)?jw(c):m,b=[f];let w=n+1;const x=[i];let k=!1;for(;w<t.length;){const T=t[w];if(T.match(B0))break;if(T.trim()==="")x.push(T),b.push(""),k=!0,w+=1;else if(T.match(LG)){const _=T.length-T.trimStart().length,O=p+c.length+1;x.push(T),b.push(T.slice(Math.min(_,O))),w+=1}else{if(k||jG(T))break;x.push(T),b.push(T),w+=1}}e.push({indent:p,number:y,type:g,content:b.join(`
|
|
198
|
-
`).trim(),contentLines:b,raw:x.join(`
|
|
199
|
-
`)}),r=w,n=w}return[e,r]}var VG=new RegExp(`^(${fI})([.)])\\s+(.+)$`);function HG(t){const e=t.split(`
|
|
200
|
-
`).filter(s=>s.trim().length>0);if(e.length===0)return null;const n=[];for(const s of e){const a=s.trim().match(VG);if(!a)return null;n.push({marker:a[1],content:a[3]})}const r=n.map(s=>s.marker);return EG(r)?{type:"orderedList",attrs:_G(n[0].marker),content:n.map(s=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:s.content}]}]}))}:null}function bI(t,e,n){const r=[];let i=0;for(;i<t.length;){const s=t[i];if(s.indent===e){const{paragraphLines:a,blockLines:c}=BG(s.contentLines),u=a.join(`
|
|
201
|
-
`).trim(),f=[];u&&f.push({type:"paragraph",raw:u,tokens:n.inlineTokens(u)});const p=c.join(`
|
|
202
|
-
`).trim();if(p){const y=n.blockTokens(p);f.push(...y)}let m=i+1;const g=[];for(;m<t.length&&t[m].indent>e;)g.push(t[m]),m+=1;if(g.length>0){const y=Math.min(...g.map(w=>w.indent)),b=bI(g,y,n);f.push({type:"list",ordered:!0,start:g[0].number,typeMarker:g[0].type,items:b,raw:g.map(w=>w.raw).join(`
|
|
203
|
-
`)})}r.push({type:"list_item",raw:s.raw,tokens:f}),i=m}else i+=1}return r}function UG(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=e.parseChildren([i]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var FG="listItem",wA="textStyle",xA=/^(\d+)\.\s$/;function kA(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 SI=bn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>{const e=t.getAttribute("type");if(e)return e;const n=t.getAttribute("style");if(n){const i=kA(n);if(i)return i}const r=t.querySelector("li");if(r){const i=r.getAttribute("style");if(i){const s=kA(i);if(s)return s}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,type:n,...r}=t,i=At(this.options.HTMLAttributes,r);return e!==1&&(i.start=e),n&&n!=="1"&&(i.type=n),["ol",i,0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.typeMarker,i=t.items?UG(t.items,e):[],s={};return n!==1&&(s.start=n),r&&(s.type=r),Object.keys(s).length>0?{type:"orderedList",attrs:s,content:i}:{type:"orderedList",content:i}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
204
|
-
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(t,e,n)=>{var r,i;const s=t.split(`
|
|
205
|
-
`),[a,c]=$G(s);if(a.length===0)return;const u=bI(a,a[0].indent,n);if(u.length===0)return;const f=((r=a[0])==null?void 0:r.number)||1,p=(i=a[0])==null?void 0:i.type;return{type:"list",ordered:!0,start:f,typeMarker:p,items:u,raw:s.slice(0,c).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(FG,this.editor.getAttributes(wA)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new Rt({props:{handlePaste:(t,e)=>{var n,r;const i=(n=e.clipboardData)==null?void 0:n.getData("text/html");if(i?.trim())return!1;const s=(r=e.clipboardData)==null?void 0:r.getData("text/plain");if(!s)return!1;const a=HG(s);if(!a)return!1;try{const c=t.state.schema.nodeFromJSON(a),u=t.state.tr.replaceSelectionWith(c);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=dc({find:xA,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:t});return(this.options.keepMarks||this.options.keepAttributes)&&(e=dc({find:xA,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:n=>({start:+n[1],...this.editor.getAttributes(wA)}),joinPredicate:t,editor:this.editor})),[e]}}),qG=/^\s*(\[([( |x])?\])\s$/,GG=bn.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",At(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const i=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return Ew(t,e,i)},addExtensions(){return this.options.nested?[uI(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),a=document.createElement("span"),c=document.createElement("input"),u=document.createElement("div"),f=m=>{var g,y;c.ariaLabel=((y=(g=this.options.a11y)==null?void 0:g.checkboxLabel)==null?void 0:y.call(g,m,c.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};f(t),s.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",m=>m.preventDefault()),c.addEventListener("change",m=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:g}=m.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:y})=>{const b=n();if(typeof b!="number")return!1;const w=y.doc.nodeAt(b);return y.setNodeMarkup(b,void 0,{...w?.attrs,checked:g}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,g)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,g])=>{i.setAttribute(m,g)}),i.dataset.checked=t.attrs.checked,c.checked=t.attrs.checked,s.append(c,a),i.append(s,u),Object.entries(e).forEach(([m,g])=>{i.setAttribute(m,g)});let p=new Set(Object.keys(e));return{dom:i,contentDOM:u,update:m=>{if(m.type!==this.type)return!1;i.dataset.checked=m.attrs.checked,c.checked=m.attrs.checked,f(m);const g=r.extensionManager.attributes,y=cc(m,g),b=new Set(Object.keys(y)),w=this.options.HTMLAttributes;return p.forEach(x=>{b.has(x)||(x in w?i.setAttribute(x,w[x]):i.removeAttribute(x))}),Object.entries(y).forEach(([x,k])=>{k==null?x in w?i.setAttribute(x,w[x]):i.removeAttribute(x):i.setAttribute(x,k)}),p=b,!0}}}},addInputRules(){return[dc({find:qG,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),WG=bn.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",At(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
207
|
-
`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=s=>{const a=_0(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c=>({indentLevel:c[1].length,mainContent:c[4],checked:c[3].toLowerCase()==="x"}),createToken:(c,u)=>({type:"taskItem",raw:"",mainContent:c.mainContent,indentLevel:c.indentLevel,checked:c.checked,text:c.mainContent,tokens:n.inlineTokens(c.mainContent),nestedTokens:u}),customNestedParser:r},n);if(a){const c={type:"taskList",raw:a.raw,items:a.items},u=s.slice(a.raw.length);return u.trim()?[c,...n.blockTokens(u)]:[c]}return n.blockTokens(s)},i=_0(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,a)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:n.inlineTokens(s.mainContent),nestedTokens:a}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});zt.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(cI.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(pI.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(vI.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(SI.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(GG.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(WG.configure(this.options.taskList)),t}});var Ch=" ",lb=" ",KG=bn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",At(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===Ch||n[0].text===Ch||n[0].raw===lb||n[0].text===lb)&&r.length===1&&r[0].type==="text"&&(r[0].text===Ch||r[0].text===lb)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{var r,i;if(!t)return"";const s=Array.isArray(t.content)?t.content:[];if(s.length===0){const a=Array.isArray((r=n?.previousNode)==null?void 0:r.content)?n.previousNode.content:[];return((i=n?.previousNode)==null?void 0:i.type)==="paragraph"&&a.length===0?Ch:""}return e.renderChildren(s)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),ZG=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,YG=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,XG=Ba.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",At(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[Aa({find:ZG,type:this.type})]},addPasteRules(){return[Ao({find:YG,type:this.type})]}}),JG=bn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),QG=Ba.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",At(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function e8(t={}){return new Rt({view(e){return new t8(e,t)}})}class t8{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=a=>{this[i](a)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){if(this.cursorPos!=null&&n.doc!=e.state.doc)if(this.lastDragEvent){let r=this.computeTarget(this.lastDragEvent);r==this.cursorPos?this.updateOverlay():this.setCursor(r)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),a=s.width/i.offsetWidth,c=s.height/i.offsetHeight;if(n){let m=e.nodeBefore,g=e.nodeAfter;if(m||g){let y=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(y){let b=y.getBoundingClientRect(),w=m?b.bottom:b.top;m&&g&&(w=(w+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let x=this.width/2*c;r={left:b.left,right:b.right,top:w-x,bottom:w+x}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*a;r={left:m.left-g,right:m.left+g,top:m.top,bottom:m.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let f,p;if(!u||u==document.body&&getComputedStyle(u).position=="static")f=-pageXOffset,p=-pageYOffset;else{let m=u.getBoundingClientRect(),g=m.width/u.offsetWidth,y=m.height/u.offsetHeight;f=m.left-u.scrollLeft*g,p=m.top-u.scrollTop*y}this.element.style.left=(r.left-f)/a+"px",this.element.style.top=(r.top-p)/c+"px",this.element.style.width=(r.right-r.left)/a+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(!n||s)return null;let a=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=tN(this.editorView.state.doc,a,this.editorView.dragging.slice);c!=null&&(a=c)}return a}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 Ft extends $e{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Ft.valid(r)?new Ft(r):$e.near(r)}content(){return we.empty}eq(e){return e instanceof Ft&&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 Ft(e.resolve(n.pos))}getBookmark(){return new $w(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!n8(e)||!r8(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Ft.valid(e))return e;let i=e.pos,s=null;for(let a=e.depth;;a--){let c=e.node(a);if(n>0?e.indexAfter(a)<c.childCount:e.index(a)>0){s=c.child(n>0?e.indexAfter(a):e.index(a)-1);break}else if(a==0)return null;i+=n;let u=e.doc.resolve(i);if(Ft.valid(u))return u}for(;;){let a=n>0?s.firstChild:s.lastChild;if(!a){if(s.isAtom&&!s.isText&&!Ie.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=a,i+=n;let c=e.doc.resolve(i);if(Ft.valid(c))return c}return null}}}Ft.prototype.visible=!1;Ft.findFrom=Ft.findGapCursorFrom;$e.jsonID("gapcursor",Ft);class $w{constructor(e){this.pos=e}map(e){return new $w(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Ft.valid(n)?new Ft(n):$e.near(n)}}function wI(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function n8(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||wI(i.type))return!0;if(i.inlineContent)return!1}}return!0}function r8(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||wI(i.type))return!0;if(i.inlineContent)return!1}}return!0}function i8(){return new Rt({props:{decorations:l8,createSelectionBetween(t,e,n){return e.pos==n.pos&&Ft.valid(n)?new Ft(n):null},handleClick:o8,handleKeyDown:s8,handleDOMEvents:{beforeinput:a8}}})}const s8=mw({ArrowLeft:Eh("horiz",-1),ArrowRight:Eh("horiz",1),ArrowUp:Eh("vert",-1),ArrowDown:Eh("vert",1)});function Eh(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let a=r.selection,c=e>0?a.$to:a.$from,u=a.empty;if(a instanceof Ne){if(!s.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let f=Ft.findGapCursorFrom(c,e,u);return f?(i&&i(r.tr.setSelection(new Ft(f))),!0):!1}}function o8(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Ft.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Ie.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Ft(r))),!0)}function a8(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Ft))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=ne.empty;for(let a=r.length-1;a>=0;a--)i=ne.from(r[a].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new we(i,0,0));return s.setSelection(Ne.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function l8(t){if(!(t.selection instanceof Ft))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",yt.create(t.doc,[mn.widget(t.selection.head,e,{key:"gapcursor"})])}var um=200,yn=function(){};yn.prototype.append=function(e){return e.length?(e=yn.from(e),!this.length&&e||e.length<um&&this.leafAppend(e)||this.length<um&&e.leafPrepend(this)||this.appendInner(e)):this};yn.prototype.prepend=function(e){return e.length?yn.from(e).append(this):this};yn.prototype.appendInner=function(e){return new c8(this,e)};yn.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?yn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};yn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};yn.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)};yn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,a){return i.push(e(s,a))},n,r),i};yn.from=function(e){return e instanceof yn?e:e&&e.length?new xI(e):yn.empty};var xI=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,a,c){for(var u=s;u<a;u++)if(i(this.values[u],c+u)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,a,c){for(var u=s-1;u>=a;u--)if(i(this.values[u],c+u)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=um)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=um)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(yn);yn.empty=new xI([]);var c8=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,a){var c=this.left.length;if(i<c&&this.left.forEachInner(r,i,Math.min(s,c),a)===!1||s>c&&this.right.forEachInner(r,Math.max(i-c,0),Math.min(this.length,s)-c,a+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,a){var c=this.left.length;if(i>c&&this.right.forEachInvertedInner(r,i-c,Math.max(s,c)-c,a+c)===!1||s<c&&this.left.forEachInvertedInner(r,Math.min(i,c),s,a)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(yn);const u8=500;class ti{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let a=e.tr,c,u,f=[],p=[];return this.items.forEach((m,g)=>{if(!m.step){i||(i=this.remapping(r,g+1),s=i.maps.length),s--,p.push(m);return}if(i){p.push(new vi(m.map));let y=m.step.map(i.slice(s)),b;y&&a.maybeStep(y).doc&&(b=a.mapping.maps[a.mapping.maps.length-1],f.push(new vi(b,void 0,void 0,f.length+p.length))),s--,b&&i.appendMap(b,s)}else a.maybeStep(m.step);if(m.selection)return c=i?m.selection.map(i.slice(s)):m.selection,u=new ti(this.items.slice(0,r).append(p.reverse().concat(f)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:a,selection:c}}addTransform(e,n,r,i){let s=[],a=this.eventCount,c=this.items,u=!i&&c.length?c.get(c.length-1):null;for(let p=0;p<e.steps.length;p++){let m=e.steps[p].invert(e.docs[p]),g=new vi(e.mapping.maps[p],m,n),y;(y=u&&u.merge(g))&&(g=y,p?s.pop():c=c.slice(0,c.length-1)),s.push(g),n&&(a++,n=void 0),i||(u=g)}let f=a-r.depth;return f>f8&&(c=d8(c,f),a-=f),new ti(c.append(s),a)}remapping(e,n){let r=new fd;return this.items.forEach((i,s)=>{let a=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,a)},e,n),r}addMaps(e){return this.eventCount==0?this:new ti(this.items.append(e.map(n=>new vi(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,a=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},i);let u=n;this.items.forEach(g=>{let y=s.getMirror(--u);if(y==null)return;a=Math.min(a,y);let b=s.maps[y];if(g.step){let w=e.steps[y].invert(e.docs[y]),x=g.selection&&g.selection.map(s.slice(u+1,y));x&&c++,r.push(new vi(b,w,x))}else r.push(new vi(b))},i);let f=[];for(let g=n;g<a;g++)f.push(new vi(s.maps[g]));let p=this.items.slice(0,i).append(f).append(r),m=new ti(p,c);return m.emptyItemCount()>u8&&(m=m.compress(this.items.length-r.length)),m}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((a,c)=>{if(c>=e)i.push(a),a.selection&&s++;else if(a.step){let u=a.step.map(n.slice(r)),f=u&&u.getMap();if(r--,f&&n.appendMap(f,r),u){let p=a.selection&&a.selection.map(n.slice(r));p&&s++;let m=new vi(f.invert(),u,p),g,y=i.length-1;(g=i.length&&i[y].merge(m))?i[y]=g:i.push(m)}}else a.map&&r--},this.items.length,0),new ti(yn.from(i.reverse()),s)}}ti.empty=new ti(yn.empty,0);function d8(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class vi{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new vi(n.getMap().invert(),n,this.selection)}}}class to{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const f8=20;function h8(t,e,n,r){let i=n.getMeta(Sa),s;if(i)return i.historyState;n.getMeta(g8)&&(t=new to(t.done,t.undone,null,0,-1));let a=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(a&&a.getMeta(Sa))return a.getMeta(Sa).redo?new to(t.done.addTransform(n,void 0,r,Jh(e)),t.undone,CA(n.mapping.maps),t.prevTime,t.prevComposition):new to(t.done,t.undone.addTransform(n,void 0,r,Jh(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),u=t.prevTime==0||!a&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!p8(n,t.prevRanges)),f=a?cb(t.prevRanges,n.mapping):CA(n.mapping.maps);return new to(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,Jh(e)),ti.empty,f,n.time,c??t.prevComposition)}else return(s=n.getMeta("rebased"))?new to(t.done.rebased(n,s),t.undone.rebased(n,s),cb(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new to(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),cb(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function p8(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function CA(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,a)=>e.push(s,a));return e}function cb(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function m8(t,e,n){let r=Jh(e),i=Sa.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let a=s.selection.resolve(s.transform.doc),c=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),u=new to(n?c:s.remaining,n?s.remaining:c,null,0,-1);return s.transform.setSelection(a).setMeta(Sa,{redo:n,historyState:u})}let ub=!1,EA=null;function Jh(t){let e=t.plugins;if(EA!=e){ub=!1,EA=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){ub=!0;break}}return ub}const Sa=new Gt("history"),g8=new Gt("closeHistory");function y8(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Rt({key:Sa,state:{init(){return new to(ti.empty,ti.empty,null,0,-1)},apply(e,n,r){return h8(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?CI:r=="historyRedo"?EI:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function kI(t,e){return(n,r)=>{let i=Sa.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=m8(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const CI=kI(!1,!0),EI=kI(!0,!0);zt.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 Rt({key:new Gt("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit,s=this.options.autoTrim;if(i==null||i===0||s===!1){t=!0;return}const a=this.storage.characters({node:r.doc});if(a>i){const c=a-i,u=0,f=c;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const p=r.tr.deleteRange(u,f);return t=!0,p}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:n.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const c=e.selection.$head.pos,u=s-r,f=c-u,p=c;return e.deleteRange(f,p),!(this.storage.characters({node:e.doc})>r)}})]}});var v8=zt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[e8(this.options)]}});zt.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Rt({key:new Gt("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!n||!r)return yt.create(t,[]);let a=0;this.options.mode==="deepest"&&t.descendants((u,f)=>{if(u.isText)return;if(!(i>=f&&i<=f+u.nodeSize-1))return!1;a+=1});let c=0;return t.descendants((u,f)=>{if(u.isText||!(i>=f&&i<=f+u.nodeSize-1))return!1;if(c+=1,this.options.mode==="deepest"&&a-c>0||this.options.mode==="shallowest"&&c>1)return this.options.mode==="deepest";s.push(mn.node(f,f+u.nodeSize,{class:this.options.className}))}),yt.create(t,s)}}})]}});var b8=zt.create({name:"gapCursor",addProseMirrorPlugins(){return[i8()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=ct(_e(t,"allowGapCursor",n)))!=null?e:null}}}),TI="placeholder",TA=new Gt("tiptap__placeholder");function _I(t){const{editor:e,placeholder:n,dataAttribute:r,pos:i,node:s,isEmptyDoc:a,hasAnchor:c,classes:{emptyNode:u,emptyEditor:f}}=t,p=[u];return a&&p.push(f),mn.node(i,i+s.nodeSize,{class:p.join(" "),[r]:typeof n=="function"?n({editor:e,node:s,pos:i,hasAnchor:c}):n})}function AI(t,e){return typeof t=="function"?t(e):t}function RI({editor:t,options:e,dataAttribute:n,doc:r,selection:i,from:s,to:a}){const{anchor:c}=i,u=[],f=t.isEmpty;return r.nodesBetween(s,a,(p,m)=>{const g=c>=m&&c<=m+p.nodeSize,y=!p.isLeaf&&$d(p);return p.type.isTextblock&&(g||!e.showOnlyCurrent)&&y&&u.push(_I({editor:t,isEmptyDoc:f,dataAttribute:n,hasAnchor:g,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:AI(e.emptyNodeClass,{editor:t,node:p,pos:m,hasAnchor:g})},node:p,pos:m})),e.includeChildren}),u}function MI({editor:t,options:e,dataAttribute:n,doc:r,selection:i}){if(!(t.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:a}=i,c=[],u=t.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const p=r.resolve(a),m=p.depth>0?p.node(1):p.nodeAfter,g=p.depth>0?p.before(1):a;if(m&&m.type.isTextblock&&$d(m)){const y=a>=g&&a<=g+m.nodeSize;c.push(_I({editor:t,isEmptyDoc:u,dataAttribute:n,hasAnchor:y,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:AI(e.emptyNodeClass,{editor:t,node:m,pos:g,hasAnchor:y})},node:m,pos:g}))}}else c.push(...RI({editor:t,options:e,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return yt.create(r,c)}function Xu(t,e){var n;const r=t.resolve(e);if(r.depth===0){const a=(n=r.nodeAfter)!=null?n:r.nodeBefore;if(!a)return{from:e,to:e};const c=r.nodeAfter?e:e-a.nodeSize;return{from:c,to:c+a.nodeSize}}const i=r.before(1),s=r.node(1);return{from:i,to:i+s.nodeSize}}function Ju(t,e){return{from:Math.max(0,e.from-1),to:Math.min(t.content.size,e.to-1)}}function S8(t,e,n){const r=[];return t.forEach((i,s)=>{const a=s,c=a+i.nodeSize,u=a+1,f=c+1;u<n&&f>e&&r.push({from:a,to:c})}),r}function w8(t){if(t.length===0)return[];const e=[...t].sort((r,i)=>r.from-i.from),n=[{...e[0]}];for(let r=1;r<e.length;r+=1){const i=n[n.length-1],s=e[r];s.from<=i.to?i.to=Math.max(i.to,s.to):n.push({...s})}return n}function x8(t,e){const n=S8(t,e.from,e.to);return n.push(Ju(t,Xu(t,e.from))),e.to>e.from?n.push(Ju(t,Xu(t,Math.min(e.to,t.content.size+1)-1))):e.from<t.content.size+1&&n.push(Ju(t,Xu(t,Math.min(e.from+1,t.content.size)))),n}function k8(t,e,n){const r=[];if(t.docChanged){const i=ww(t);for(const s of i)r.push(...x8(n.doc,s.newRange))}return t.selectionSet&&(r.push(Ju(n.doc,Xu(n.doc,t.mapping.map(e.selection.anchor)))),r.push(Ju(n.doc,Xu(n.doc,n.selection.anchor)))),w8(r)}function C8(t,e,n){const r=Math.max(0,Math.min(t,n.content.size)),i=Math.max(r,Math.min(e,n.content.size));return{from:r,to:i}}function E8({decorations:t,ranges:e,editor:n,options:r,dataAttribute:i,doc:s,selection:a}){let c=t;for(const u of e){const{from:f,to:p}=C8(u.from,u.to,s),m=c.find(f,p).filter(y=>y.from>=f&&y.to<=p);m.length&&(c=c.remove(m));const g=RI({editor:n,options:r,dataAttribute:i,doc:s,selection:a,from:f,to:p});g.length&&(c=c.add(s,g))}return c}function T8({editor:t,options:e,dataAttribute:n}){return{init(r,i){const s=MI({editor:t,options:e,dataAttribute:n,doc:i.doc,selection:i.selection});return s??yt.empty},apply(r,i,s,a){if(!r.docChanged&&!r.selectionSet)return i;const c=i.map(r.mapping,r.doc),u=k8(r,s,a);return E8({decorations:c,ranges:u,editor:t,options:e,dataAttribute:n,doc:a.doc,selection:a.selection})}}}function _8(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function A8({editor:t,options:e}){const n=e.dataAttribute?`data-${_8(e.dataAttribute)}`:`data-${TI}`,r=e.showOnlyCurrent&&!e.includeChildren;return new Rt({key:TA,...r?{}:{state:T8({editor:t,options:e,dataAttribute:n})},props:{decorations:r?({doc:i,selection:s})=>MI({editor:t,options:e,dataAttribute:n,doc:i,selection:s}):i=>{var s;return e.showOnlyWhenEditable&&!t.isEditable?yt.empty:(s=TA.getState(i))!=null?s:yt.empty}}})}var R8=zt.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:TI,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[A8({editor:this.editor,options:this.options})]}});function $0(t,e){return!t.selection.empty&&!wD(t.selection)&&e.isEditable}function M8(t,e){return $0(t,e)&&!e.isFocused&&!e.view.dragging}function O8(){var t;(t=window.getSelection())==null||t.removeAllRanges()}function N8(t){t.focus()}zt.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Rt({key:new Gt("selection"),props:{decorations(n){return M8(n,t)?yt.create(n.doc,[mn.inline(n.selection.from,n.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(n){return $0(n.state,t)&&O8(),!1},focus(n){return $0(n.state,t)&&requestAnimationFrame(()=>{!t.isDestroyed&&n.hasFocus()&&N8(n)}),!1}}}})]}});var D8="skipTrailingNode";function _A({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var I8=zt.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Gt(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new Rt({key:e,appendTransaction:(i,s,a)=>{const{doc:c,tr:u,schema:f}=a,p=e.getState(a),m=c.content.size,g=f.nodes[n];if(!i.some(y=>y.getMeta(D8))&&p)return u.insert(m,g.create())},state:{init:(i,s)=>{const a=s.tr.doc.lastChild;return!_A({node:a,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const a=i.doc.lastChild;return!_A({node:a,types:r})}}})]}}),L8=zt.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>CI(t,e),redo:()=>({state:t,dispatch:e})=>EI(t,e)}},addProseMirrorPlugins(){return[y8(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()}}}),z8=zt.create({name:"starterKit",addExtensions(){var t,e,n,r;const i=[];return this.options.bold!==!1&&i.push(w9.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(g9.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(cI.configure(this.options.bulletList)),this.options.code!==!1&&i.push(C9.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(_9.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(A9.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(v8.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(b8.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(R9.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(M9.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(L8.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(O9.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(z9.configure(this.options.italic)),this.options.listItem!==!1&&i.push(pI.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(vI.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&i.push(pG.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(SI.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(KG.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(XG.configure(this.options.strike)),this.options.text!==!1&&i.push(JG.configure(this.options.text)),this.options.underline!==!1&&i.push(QG.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&i.push(I8.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),P8=z8;function Vw(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Va=Vw();function OI(t){Va=t}var la={exec:()=>null};function rt(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(i,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(Fn.caret,"$1"),n=n.replace(i,a),r},getRegex:()=>new RegExp(n,e)};return r}var j8=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Fn={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)}}>`)},B8=/^(?:[ \t]*(?:\n|$))+/,$8=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,V8=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Hd=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,H8=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Hw=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,NI=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,DI=rt(NI).replace(/bull/g,Hw).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(),U8=rt(NI).replace(/bull/g,Hw).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(),Uw=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,F8=/^[^\n]+/,Fw=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,q8=rt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Fw).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),G8=rt(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Hw).getRegex(),Fm="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",qw=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,W8=rt("^ {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",qw).replace("tag",Fm).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),II=rt(Uw).replace("hr",Hd).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",Fm).getRegex(),K8=rt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",II).getRegex(),Gw={blockquote:K8,code:$8,def:q8,fences:V8,heading:H8,hr:Hd,html:W8,lheading:DI,list:G8,newline:B8,paragraph:II,table:la,text:F8},AA=rt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Hd).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",Fm).getRegex(),Z8={...Gw,lheading:U8,table:AA,paragraph:rt(Uw).replace("hr",Hd).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",AA).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",Fm).getRegex()},Y8={...Gw,html:rt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",qw).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:la,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:rt(Uw).replace("hr",Hd).replace("heading",` *#{1,6} *[^
|
|
208
|
-
]`).replace("lheading",DI).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},X8=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,J8=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,LI=/^( {2,}|\\)\n(?!\s*$)/,Q8=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,vc=/[\p{P}\p{S}]/u,qm=/[\s\p{P}\p{S}]/u,Ww=/[^\s\p{P}\p{S}]/u,eW=rt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,qm).getRegex(),zI=/(?!~)[\p{P}\p{S}]/u,tW=/(?!~)[\s\p{P}\p{S}]/u,nW=/(?:[^\s\p{P}\p{S}]|~)/u,rW=rt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",j8?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),PI=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,iW=rt(PI,"u").replace(/punct/g,vc).getRegex(),sW=rt(PI,"u").replace(/punct/g,zI).getRegex(),jI="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",oW=rt(jI,"gu").replace(/notPunctSpace/g,Ww).replace(/punctSpace/g,qm).replace(/punct/g,vc).getRegex(),aW=rt(jI,"gu").replace(/notPunctSpace/g,nW).replace(/punctSpace/g,tW).replace(/punct/g,zI).getRegex(),lW=rt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ww).replace(/punctSpace/g,qm).replace(/punct/g,vc).getRegex(),cW=rt(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,vc).getRegex(),uW="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",dW=rt(uW,"gu").replace(/notPunctSpace/g,Ww).replace(/punctSpace/g,qm).replace(/punct/g,vc).getRegex(),fW=rt(/\\(punct)/,"gu").replace(/punct/g,vc).getRegex(),hW=rt(/^<(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(),pW=rt(qw).replace("(?:-->|$)","-->").getRegex(),mW=rt("^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",pW).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),dm=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,gW=rt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",dm).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),BI=rt(/^!?\[(label)\]\[(ref)\]/).replace("label",dm).replace("ref",Fw).getRegex(),$I=rt(/^!?\[(ref)\](?:\[\])?/).replace("ref",Fw).getRegex(),yW=rt("reflink|nolink(?!\\()","g").replace("reflink",BI).replace("nolink",$I).getRegex(),RA=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Kw={_backpedal:la,anyPunctuation:fW,autolink:hW,blockSkip:rW,br:LI,code:J8,del:la,delLDelim:la,delRDelim:la,emStrongLDelim:iW,emStrongRDelimAst:oW,emStrongRDelimUnd:lW,escape:X8,link:gW,nolink:$I,punctuation:eW,reflink:BI,reflinkSearch:yW,tag:mW,text:Q8,url:la},vW={...Kw,link:rt(/^!?\[(label)\]\((.*?)\)/).replace("label",dm).getRegex(),reflink:rt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",dm).getRegex()},V0={...Kw,emStrongRDelimAst:aW,emStrongLDelim:sW,delLDelim:cW,delRDelim:dW,url:rt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",RA).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:rt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",RA).getRegex()},bW={...V0,br:rt(LI).replace("{2,}","*").getRegex(),text:rt(V0.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Th={normal:Gw,gfm:Z8,pedantic:Y8},Cu={normal:Kw,gfm:V0,breaks:bW,pedantic:vW},SW={"&":"&","<":"<",">":">",'"':""","'":"'"},MA=t=>SW[t];function mi(t,e){if(e){if(Fn.escapeTest.test(t))return t.replace(Fn.escapeReplace,MA)}else if(Fn.escapeTestNoEncode.test(t))return t.replace(Fn.escapeReplaceNoEncode,MA);return t}function OA(t){try{t=encodeURI(t).replace(Fn.percentDecode,"%")}catch{return null}return t}function NA(t,e){let n=t.replace(Fn.findPipe,(s,a,c)=>{let u=!1,f=a;for(;--f>=0&&c[f]==="\\";)u=!u;return u?"|":" |"}),r=n.split(Fn.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Fn.slashPipe,"|");return r}function Eu(t,e,n){let r=t.length;if(r===0)return"";let i=0;for(;i<r&&t.charAt(r-i-1)===e;)i++;return t.slice(0,r-i)}function wW(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 xW(t,e=0){let n=e,r="";for(let i of t)if(i===" "){let s=4-n%4;r+=" ".repeat(s),n+=s}else r+=i,n++;return r}function DA(t,e,n,r,i){let s=e.href,a=e.title||null,c=t[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let u={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:a,text:c,tokens:r.inlineTokens(c)};return r.state.inLink=!1,u}function kW(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(`
|
|
209
|
-
`).map(s=>{let a=s.match(n.other.beginningSpace);if(a===null)return s;let[c]=a;return c.length>=i.length?s.slice(i.length):s}).join(`
|
|
210
|
-
`)}var fm=class{options;rules;lexer;constructor(t){this.options=t||Va}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:Eu(n,`
|
|
211
|
-
`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=kW(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=Eu(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:Eu(e[0],`
|
|
212
|
-
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=Eu(e[0],`
|
|
213
|
-
`).split(`
|
|
214
|
-
`),r="",i="",s=[];for(;n.length>0;){let a=!1,c=[],u;for(u=0;u<n.length;u++)if(this.rules.other.blockquoteStart.test(n[u]))c.push(n[u]),a=!0;else if(!a)c.push(n[u]);else break;n=n.slice(u);let f=c.join(`
|
|
215
|
-
`),p=f.replace(this.rules.other.blockquoteSetextReplace,`
|
|
216
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
217
|
-
${f}`:f,i=i?`${i}
|
|
218
|
-
${p}`:p;let m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,s,!0),this.lexer.state.top=m,n.length===0)break;let g=s.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){let y=g,b=y.raw+`
|
|
219
|
-
`+n.join(`
|
|
220
|
-
`),w=this.blockquote(b);s[s.length-1]=w,r=r.substring(0,r.length-y.raw.length)+w.raw,i=i.substring(0,i.length-y.text.length)+w.text;break}else if(g?.type==="list"){let y=g,b=y.raw+`
|
|
221
|
-
`+n.join(`
|
|
222
|
-
`),w=this.list(b);s[s.length-1]=w,r=r.substring(0,r.length-g.raw.length)+w.raw,i=i.substring(0,i.length-y.raw.length)+w.raw,n=b.substring(s.at(-1).raw.length).split(`
|
|
223
|
-
`);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim(),r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let s=this.rules.other.listItemRegex(n),a=!1;for(;t;){let u=!1,f="",p="";if(!(e=s.exec(t))||this.rules.block.hr.test(t))break;f=e[0],t=t.substring(f.length);let m=xW(e[2].split(`
|
|
224
|
-
`,1)[0],e[1].length),g=t.split(`
|
|
225
|
-
`,1)[0],y=!m.trim(),b=0;if(this.options.pedantic?(b=2,p=m.trimStart()):y?b=e[1].length+1:(b=m.search(this.rules.other.nonSpaceChar),b=b>4?1:b,p=m.slice(b),b+=e[1].length),y&&this.rules.other.blankLine.test(g)&&(f+=g+`
|
|
226
|
-
`,t=t.substring(g.length+1),u=!0),!u){let w=this.rules.other.nextBulletRegex(b),x=this.rules.other.hrRegex(b),k=this.rules.other.fencesBeginRegex(b),T=this.rules.other.headingBeginRegex(b),A=this.rules.other.htmlBeginRegex(b),_=this.rules.other.blockquoteBeginRegex(b);for(;t;){let O=t.split(`
|
|
227
|
-
`,1)[0],N;if(g=O,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),N=g):N=g.replace(this.rules.other.tabCharGlobal," "),k.test(g)||T.test(g)||A.test(g)||_.test(g)||w.test(g)||x.test(g))break;if(N.search(this.rules.other.nonSpaceChar)>=b||!g.trim())p+=`
|
|
228
|
-
`+N.slice(b);else{if(y||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||k.test(m)||T.test(m)||x.test(m))break;p+=`
|
|
229
|
-
`+g}y=!g.trim(),f+=O+`
|
|
230
|
-
`,t=t.substring(O.length+1),m=N.slice(b)}}i.loose||(a?i.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(a=!0)),i.items.push({type:"list_item",raw:f,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),i.raw+=f}let c=i.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let u of i.items){if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),u.task){if(u.text=u.text.replace(this.rules.other.listReplaceTask,""),u.tokens[0]?.type==="text"||u.tokens[0]?.type==="paragraph"){u.tokens[0].raw=u.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),u.tokens[0].text=u.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let p=this.lexer.inlineQueue.length-1;p>=0;p--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[p].src)){this.lexer.inlineQueue[p].src=this.lexer.inlineQueue[p].src.replace(this.rules.other.listReplaceTask,"");break}}let f=this.rules.other.listTaskCheckbox.exec(u.raw);if(f){let p={type:"checkbox",raw:f[0]+" ",checked:f[0]!=="[ ]"};u.checked=p.checked,i.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=p.raw+u.tokens[0].raw,u.tokens[0].text=p.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(p)):u.tokens.unshift({type:"paragraph",raw:p.raw,text:p.raw,tokens:[p]}):u.tokens.unshift(p)}}if(!i.loose){let f=u.tokens.filter(m=>m.type==="space"),p=f.length>0&&f.some(m=>this.rules.other.anyLine.test(m.raw));i.loose=p}}if(i.loose)for(let u of i.items){u.loose=!0;for(let f of u.tokens)f.type==="text"&&(f.type="paragraph")}return i}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:r,title:i}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=NA(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
231
|
-
`):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let a of r)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a<n.length;a++)s.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:s.align[a]});for(let a of i)s.rows.push(NA(a,s.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:s.align[u]})));return s}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let n=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===`
|
|
232
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let s=Eu(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=wW(e[2],"()");if(s===-2)return;if(s>-1){let a=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),DA(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[r.toLowerCase()];if(!i){let s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return DA(n,i,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,s,a,c=i,u=0,f=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,e=e.slice(-1*t.length+i);(r=f.exec(e))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(a=[...s].length,r[3]||r[4]){c+=a;continue}else if((r[5]||r[6])&&i%3&&!((i+a)%3)){u+=a;continue}if(c-=a,c>0)continue;a=Math.min(a,a+c+u);let p=[...r[0]][0].length,m=t.slice(0,i+r.index+p+a);if(Math.min(i,a)%2){let y=m.slice(1,-1);return{type:"em",raw:m,text:y,tokens:this.lexer.inlineTokens(y)}}let g=m.slice(2,-2);return{type:"strong",raw:m,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,n=""){let r=this.rules.inline.delLDelim.exec(t);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,s,a,c=i,u=this.rules.inline.delRDelim;for(u.lastIndex=0,e=e.slice(-1*t.length+i);(r=u.exec(e))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(a=[...s].length,a!==i))continue;if(r[3]||r[4]){c+=a;continue}if(c-=a,c>0)continue;a=Math.min(a,a+c);let f=[...r[0]][0].length,p=t.slice(0,i+r.index+f+a),m=p.slice(i,-i);return{type:"del",raw:p,text:m,tokens:this.lexer.inlineTokens(m)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let n,r;if(e[2]==="@")n=e[0],r="mailto:"+n;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);n=e[0],e[1]==="www."?r="http://"+e[0]:r=e[0]}return{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},Xr=class H0{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Va,this.options.tokenizer=this.options.tokenizer||new fm,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:Fn,block:Th.normal,inline:Cu.normal};this.options.pedantic?(n.block=Th.pedantic,n.inline=Cu.pedantic):this.options.gfm&&(n.block=Th.gfm,this.options.breaks?n.inline=Cu.breaks:n.inline=Cu.gfm),this.tokenizer.rules=n}static get rules(){return{block:Th,inline:Cu}}static lex(e,n){return new H0(n).lex(e)}static lexInline(e,n){return new H0(n).inlineTokens(e)}lex(e){e=e.replace(Fn.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(Fn.tabCharGlobal," ").replace(Fn.spaceLine,""));e;){let i;if(this.options.extensions?.block?.some(a=>(i=a.call({lexer:this},e,n))?(e=e.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let a=n.at(-1);i.raw.length===1&&a!==void 0?a.raw+=`
|
|
234
|
-
`:n.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let a=n.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
235
|
-
`)?"":`
|
|
236
|
-
`)+i.raw,a.text+=`
|
|
237
|
-
`+i.text,this.inlineQueue.at(-1).src=a.text):n.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let a=n.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
238
|
-
`)?"":`
|
|
239
|
-
`)+i.raw,a.text+=`
|
|
240
|
-
`+i.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},n.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),n.push(i);continue}let s=e;if(this.options.extensions?.startBlock){let a=1/0,c=e.slice(1),u;this.options.extensions.startBlock.forEach(f=>{u=f.call({lexer:this},c),typeof u=="number"&&u>=0&&(a=Math.min(a,u))}),a<1/0&&a>=0&&(s=e.substring(0,a+1))}if(this.state.top&&(i=this.tokenizer.paragraph(s))){let a=n.at(-1);r&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
|
|
241
|
-
`)?"":`
|
|
242
|
-
`)+i.raw,a.text+=`
|
|
243
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):n.push(i),r=s.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let a=n.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
|
|
244
|
-
`)?"":`
|
|
245
|
-
`)+i.raw,a.text+=`
|
|
246
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):n.push(i);continue}if(e){let a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){this.tokenizer.lexer=this;let r=e,i=null;if(this.tokens.links){let u=Object.keys(this.tokens.links);if(u.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!==null;)u.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!==null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!==null;)s=i[2]?i[2].length:0,r=r.slice(0,i.index+s)+"["+"a".repeat(i[0].length-s-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let a=!1,c="";for(;e;){a||(c=""),a=!1;let u;if(this.options.extensions?.inline?.some(p=>(u=p.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 p=n.at(-1);u.type==="text"&&p?.type==="text"?(p.raw+=u.raw,p.text+=u.text):n.push(u);continue}if(u=this.tokenizer.emStrong(e,r,c)){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,c)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.autolink(e)){e=e.substring(u.raw.length),n.push(u);continue}if(!this.state.inLink&&(u=this.tokenizer.url(e))){e=e.substring(u.raw.length),n.push(u);continue}let f=e;if(this.options.extensions?.startInline){let p=1/0,m=e.slice(1),g;this.options.extensions.startInline.forEach(y=>{g=y.call({lexer:this},m),typeof g=="number"&&g>=0&&(p=Math.min(p,g))}),p<1/0&&p>=0&&(f=e.substring(0,p+1))}if(u=this.tokenizer.inlineText(f)){e=e.substring(u.raw.length),u.raw.slice(-1)!=="_"&&(c=u.raw.slice(-1)),a=!0;let p=n.at(-1);p?.type==="text"?(p.raw+=u.raw,p.text+=u.text):n.push(u);continue}if(e){let p="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(p);break}else throw new Error(p)}}return n}},hm=class{options;parser;constructor(t){this.options=t||Va}space(t){return""}code({text:t,lang:e,escaped:n}){let r=(e||"").match(Fn.notSpaceStart)?.[0],i=t.replace(Fn.endingNewline,"")+`
|
|
247
|
-
`;return r?'<pre><code class="language-'+mi(r)+'">'+(n?i:mi(i,!0))+`</code></pre>
|
|
248
|
-
`:"<pre><code>"+(n?i:mi(i,!0))+`</code></pre>
|
|
249
|
-
`}blockquote({tokens:t}){return`<blockquote>
|
|
250
|
-
${this.parser.parse(t)}</blockquote>
|
|
251
|
-
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
252
|
-
`}hr(t){return`<hr>
|
|
253
|
-
`}list(t){let e=t.ordered,n=t.start,r="";for(let a=0;a<t.items.length;a++){let c=t.items[a];r+=this.listitem(c)}let i=e?"ol":"ul",s=e&&n!==1?' start="'+n+'"':"";return"<"+i+s+`>
|
|
254
|
-
`+r+"</"+i+`>
|
|
255
|
-
`}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
|
|
256
|
-
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
257
|
-
`}table(t){let e="",n="";for(let i=0;i<t.header.length;i++)n+=this.tablecell(t.header[i]);e+=this.tablerow({text:n});let r="";for(let i=0;i<t.rows.length;i++){let s=t.rows[i];n="";for(let a=0;a<s.length;a++)n+=this.tablecell(s[a]);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>${mi(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let r=this.parser.parseInline(n),i=OA(t);if(i===null)return r;t=i;let s='<a href="'+t+'"';return e&&(s+=' title="'+mi(e)+'"'),s+=">"+r+"</a>",s}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=OA(t);if(i===null)return mi(n);t=i;let s=`<img src="${t}" alt="${mi(n)}"`;return e&&(s+=` title="${mi(e)}"`),s+=">",s}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:mi(t.text)}},Zw=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}},Jr=class U0{options;renderer;textRenderer;constructor(e){this.options=e||Va,this.options.renderer=this.options.renderer||new hm,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Zw}static parse(e,n){return new U0(n).parse(e)}static parseInline(e,n){return new U0(n).parseInline(e)}parse(e){this.renderer.parser=this;let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let a=i,c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){n+=c||"";continue}}let s=i;switch(s.type){case"space":{n+=this.renderer.space(s);break}case"hr":{n+=this.renderer.hr(s);break}case"heading":{n+=this.renderer.heading(s);break}case"code":{n+=this.renderer.code(s);break}case"table":{n+=this.renderer.table(s);break}case"blockquote":{n+=this.renderer.blockquote(s);break}case"list":{n+=this.renderer.list(s);break}case"checkbox":{n+=this.renderer.checkbox(s);break}case"html":{n+=this.renderer.html(s);break}case"def":{n+=this.renderer.def(s);break}case"paragraph":{n+=this.renderer.paragraph(s);break}case"text":{n+=this.renderer.text(s);break}default:{let a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(e,n=this.renderer){this.renderer.parser=this;let r="";for(let i=0;i<e.length;i++){let s=e[i];if(this.options.extensions?.renderers?.[s.type]){let c=this.options.extensions.renderers[s.type].call({parser:this},s);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){r+=c||"";continue}}let a=s;switch(a.type){case"escape":{r+=n.text(a);break}case"html":{r+=n.html(a);break}case"link":{r+=n.link(a);break}case"image":{r+=n.image(a);break}case"checkbox":{r+=n.checkbox(a);break}case"strong":{r+=n.strong(a);break}case"em":{r+=n.em(a);break}case"codespan":{r+=n.codespan(a);break}case"br":{r+=n.br(a);break}case"del":{r+=n.del(a);break}case"text":{r+=n.text(a);break}default:{let c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}},Pu=class{options;block;constructor(t){this.options=t||Va}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?Xr.lex:Xr.lexInline}provideParser(t=this.block){return t?Jr.parse:Jr.parseInline}},CW=class{defaults=Vw();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Jr;Renderer=hm;TextRenderer=Zw;Lexer=Xr;Tokenizer=fm;Hooks=Pu;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(let r of t)switch(n=n.concat(e.call(this,r)),r.type){case"table":{let i=r;for(let s of i.header)n=n.concat(this.walkTokens(s.tokens,e));for(let s of i.rows)for(let a of s)n=n.concat(this.walkTokens(a.tokens,e));break}case"list":{let i=r;n=n.concat(this.walkTokens(i.items,e));break}default:{let i=r;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(s=>{let a=i[s].flat(1/0);n=n.concat(this.walkTokens(a,e))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=e.renderers[i.name];s?e.renderers[i.name]=function(...a){let c=i.renderer.apply(this,a);return c===!1&&(c=s.apply(this,a)),c}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),n.renderer){let i=this.defaults.renderer||new hm(this.defaults);for(let s in n.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let a=s,c=n.renderer[a],u=i[a];i[a]=(...f)=>{let p=c.apply(i,f);return p===!1&&(p=u.apply(i,f)),p||""}}r.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new fm(this.defaults);for(let s in n.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let a=s,c=n.tokenizer[a],u=i[a];i[a]=(...f)=>{let p=c.apply(i,f);return p===!1&&(p=u.apply(i,f)),p}}r.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new Pu;for(let s in n.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let a=s,c=n.hooks[a],u=i[a];Pu.passThroughHooks.has(s)?i[a]=f=>{if(this.defaults.async&&Pu.passThroughHooksRespectAsync.has(s))return(async()=>{let m=await c.call(i,f);return u.call(i,m)})();let p=c.call(i,f);return u.call(i,p)}:i[a]=(...f)=>{if(this.defaults.async)return(async()=>{let m=await c.apply(i,f);return m===!1&&(m=await u.apply(i,f)),m})();let p=c.apply(i,f);return p===!1&&(p=u.apply(i,f)),p}}r.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(a){let c=[];return c.push(s.call(this,a)),i&&(c=c.concat(i.call(this,a))),c}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Xr.lex(t,e??this.defaults)}parser(t,e){return Jr.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let r={...n},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=t),i.async)return(async()=>{let a=i.hooks?await i.hooks.preprocess(e):e,c=await(i.hooks?await i.hooks.provideLexer(t):t?Xr.lex:Xr.lexInline)(a,i),u=i.hooks?await i.hooks.processAllTokens(c):c;i.walkTokens&&await Promise.all(this.walkTokens(u,i.walkTokens));let f=await(i.hooks?await i.hooks.provideParser(t):t?Jr.parse:Jr.parseInline)(u,i);return i.hooks?await i.hooks.postprocess(f):f})().catch(s);try{i.hooks&&(e=i.hooks.preprocess(e));let a=(i.hooks?i.hooks.provideLexer(t):t?Xr.lex:Xr.lexInline)(e,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let c=(i.hooks?i.hooks.provideParser(t):t?Jr.parse:Jr.parseInline)(a,i);return i.hooks&&(c=i.hooks.postprocess(c)),c}catch(a){return s(a)}}}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>"+mi(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},Ra=new CW;function vt(t,e){return Ra.parse(t,e)}vt.options=vt.setOptions=function(t){return Ra.setOptions(t),vt.defaults=Ra.defaults,OI(vt.defaults),vt};vt.getDefaults=Vw;vt.defaults=Va;vt.use=function(...t){return Ra.use(...t),vt.defaults=Ra.defaults,OI(vt.defaults),vt};vt.walkTokens=function(t,e){return Ra.walkTokens(t,e)};vt.parseInline=Ra.parseInline;vt.Parser=Jr;vt.parser=Jr.parse;vt.Renderer=hm;vt.TextRenderer=Zw;vt.Lexer=Xr;vt.lexer=Xr.lex;vt.Tokenizer=fm;vt.Hooks=Pu;vt.parse=vt;vt.options;vt.setOptions;vt.use;vt.walkTokens;vt.parseInline;Jr.parse;Xr.lex;var EW=/\n[^\S\n]*(?:\n[^\S\n]*)+$/;function TW(t){return t.flatMap((e,n)=>{var r;if(e.type==="space"||((r=t[n+1])==null?void 0:r.type)==="space")return[e];const i=(e.raw||"").match(EW);return i?[{...e,raw:(e.raw||"").slice(0,-i[0].length)},{type:"space",raw:i[0]}]:[e]})}function _W(t,e){const r=e.split(`
|
|
266
|
-
`).flatMap(i=>[i,""]).map(i=>`${t}${i}`).join(`
|
|
267
|
-
`);return r.slice(0,r.length-1)}function AW(t,e){const n=[];return Array.from(t.entries()).forEach(([r,i])=>{if(!e){n.push(r);return}(e.marks||[]).find(a=>a.type===r&&uc(a.attrs,i.attrs))||n.push(r)}),n}function RW(t,e){const n=[];return Array.from(e.entries()).forEach(([r,i])=>{const s=t.get(r);(!s||!uc(s.attrs,i.attrs))&&n.push({type:r,mark:i})}),n}function MW(t,e,n,r){const i=!n,s=n&&(!n.marks||n.marks.length===0),a=n&&n.marks&&!r(e,new Map(n.marks.map(u=>[u.type,u]))),c=[];return(i||s||a)&&(n&&n.marks?Array.from(t.entries()).reverse().forEach(([u,f])=>{n.marks.find(m=>m.type===u&&uc(m.attrs,f.attrs))||c.push(u)}):(i||s)&&c.push(...Array.from(t.keys()).reverse())),c}function OW(t,e){let n="";return Array.from(t.keys()).reverse().forEach(r=>{const i=t.get(r),s=e(r,i);s&&(n=s+n)}),t.clear(),n}function NW(t,e,n){let r="";return Array.from(t.entries()).forEach(([i,s])=>{const a=n(i,s);a&&(r+=a),e.set(i,s)}),r}function db(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 _h(t,e){return typeof t!="string"?"json":e}var DW=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"]),IW=/<\/?([a-zA-Z][\w-]*)/g;function LW(t){const e=[];let n;for(;(n=IW.exec(t))!==null;)e.push(n[1].toLowerCase());return e}function zW(t){const e=t.toLowerCase();return e.includes("-")?!1:!DW.has(e)}function PW(t,e){return LW(t).some(r=>zW(r)?!e.has(r):!1)}var jW=class{constructor(t){this.activeParseLexer=null,this.extensionRanks=new Map,this.baseExtensions=[],this.extensions=[],this.codeTypes=new Set,this.schemaParseDomTagsCache=null,this.lastParseResult=null;var e,n,r,i,s;this.markedInstance=(e=t?.marked)!=null?e:vt,this.indentStyle=(r=(n=t?.indentation)==null?void 0:n.style)!=null?r:"space",this.indentSize=(s=(i=t?.indentation)==null?void 0:i.size)!=null?s:2,this.baseExtensions=t?.extensions||[],t?.markedOptions&&typeof this.markedInstance.setOptions=="function"&&this.markedInstance.setOptions(t.markedOptions),this.registry=new Map,this.nodeTypeRegistry=new Map,t?.extensions&&(this.baseExtensions=t.extensions,ql(jm(t.extensions)).forEach(c=>this.registerExtension(c)))}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=ct(_e(t,"code")),i=t.name;r&&this.codeTypes.add(i),this.extensionRanks.has(i)||this.extensionRanks.set(i,this.extensionRanks.size);const s=_e(t,"markdownTokenName")||i,a=_e(t,"parseMarkdown"),c=_e(t,"renderMarkdown"),u=_e(t,"markdownTokenizer"),f=(e=_e(t,"markdownOptions"))!=null?e:null,p=(n=f?.indentsContent)!=null?n:!1,m=f?.htmlReopen,g={tokenName:s,nodeName:i,parseMarkdown:a,renderMarkdown:c,isIndenting:p,htmlReopen:m,tokenizer:u};if(s&&a){const y=this.registry.get(s)||[];y.push(g),this.registry.set(s,y)}if(c){const y=this.nodeTypeRegistry.get(i)||[];y.push(g),this.nodeTypeRegistry.set(i,y)}u&&this.hasMarked()&&this.registerTokenizer(u)}createLexer(){return new this.markedInstance.Lexer(this.markedInstance.defaults)}createTokenizerHelpers(t){return{inlineTokens:e=>t.inlineTokens(e),blockTokens:e=>t.blockTokens(e)}}tokenizeInline(t){var e;return((e=this.activeParseLexer)!=null?e:this.createLexer()).inlineTokens(t)}registerTokenizer(t){if(!this.hasMarked())return;const{name:e,start:n,level:r="inline",tokenize:i}=t,s=this.createTokenizerHelpers.bind(this),a=this.createLexer.bind(this);let c;n?c=typeof n=="function"?n:f=>f.indexOf(n):c=f=>{const p=i(f,[],this.createTokenizerHelpers(this.createLexer()));return p&&p.raw?f.indexOf(p.raw):-1};const u={name:e,level:r,start:c,tokenizer(f,p){const m=this.lexer?s(this.lexer):s(a()),g=i(f,p,m);if(g&&g.type)return{...g,type:g.type||e,raw:g.raw||"",tokens:g.tokens||[]}},childTokens:[]};this.markedInstance.use({extensions:[u]})}getHandlersForToken(t){try{return this.registry.get(t)||[]}catch{return[]}}getHandlerForToken(t){const e=this.getHandlersForToken(t);if(e.length>0)return e[0];const n=this.getHandlersForNodeType(t);return n.length>0?n[0]:void 0}getHandlersForNodeType(t){try{return this.nodeTypeRegistry.get(t)||[]}catch{return[]}}serialize(t){if(!t)return"";const e=this.renderNodes(t,t);return this.isEmptyOutput(e)?"":e}isEmptyOutput(t){return!t||t.trim()===""?!0:t.replace(/ /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?TW(t):t,r=n.reduce((a,c,u)=>(c.type!=="space"&&a.push(u),a),[]);let i=-1,s=0;return n.flatMap((a,c)=>{for(var u;s<r.length&&r[s]<c;)i=r[s],s+=1;if(e&&a.type==="space"){const p=(u=r[s])!=null?u:-1;return this.createImplicitEmptyParagraphsFromSpace(a,i,p)}const f=this.parseToken(a,e);return f===null?[]:Array.isArray(f)?f:[f]})}createImplicitEmptyParagraphsFromSpace(t,e,n){const r=this.countParagraphSeparators(t.raw||"");if(r===0)return[];const s=Math.max(r-(e===-1||n===-1?0:1),0);return Array.from({length:s},()=>({type:"paragraph",content:[]}))}countParagraphSeparators(t){return(t.replace(/\r\n/g,`
|
|
268
|
-
`).match(/\n\n/g)||[]).length}parseToken(t,e=!1){if(!t.type)return null;if(t.type==="list")return this.parseListToken(t);const n=this.getHandlersForToken(t.type),r=this.createParseHelpers();if(n.find(s=>{if(!s.parseMarkdown)return!1;const a=s.parseMarkdown(t,r),c=this.normalizeParseResult(a);return c&&(!Array.isArray(c)||c.length>0)?(this.lastParseResult=c,!0):!1})&&this.lastParseResult){const s=this.lastParseResult;return this.lastParseResult=null,s}return this.parseFallbackToken(t,e)}parseListToken(t){if(!t.items||t.items.length===0)return this.parseTokenWithHandlers(t);const e=t.items.some(c=>db(c).isTask),n=t.items.some(c=>!db(c).isTask);if(!e||!n||this.getHandlersForToken("taskList").length===0)return this.parseTokenWithHandlers(t);const r=[];let i=[],s=null;for(let c=0;c<t.items.length;c+=1){const u=t.items[c],{isTask:f,checked:p,indentLevel:m}=db(u);let g=u;if(f){const w=(u.raw||u.text||"").split(`
|
|
269
|
-
`),x=w[0].match(/^\s*[-+*]\s+\[([ xX])\]\s+(.*)$/),k=x?x[2]:"";let T=[];if(w.length>1&&w.slice(1).join(`
|
|
270
|
-
`).trim()){const _=w.slice(1),O=_.filter(N=>N.trim());if(O.length>0){const N=Math.min(...O.map(G=>G.length-G.trimStart().length)),j=_.map(G=>G.trim()?G.slice(N):"").join(`
|
|
271
|
-
`).trim();j&&(T=this.markedInstance.lexer(`${j}
|
|
272
|
-
`))}}g={type:"taskItem",raw:"",mainContent:k,indentLevel:m,checked:p??!1,text:k,tokens:this.tokenizeInline(k),nestedTokens:T}}const y=f?"taskList":"list";s!==y?(i.length>0&&r.push({type:s,items:i}),i=[g],s=y):i.push(g)}i.length>0&&r.push({type:s,items:i});const a=[];for(let c=0;c<r.length;c+=1){const u=r[c],f={...t,type:u.type,items:u.items},p=this.parseToken(f);p&&(Array.isArray(p)?a.push(...p):a.push(p))}return a.length>0?a:null}parseTokenWithHandlers(t){if(!t.type)return null;const e=this.getHandlersForToken(t.type),n=this.createParseHelpers();if(e.find(i=>{if(!i.parseMarkdown)return!1;const s=i.parseMarkdown(t,n),a=this.normalizeParseResult(s);return a&&(!Array.isArray(a)||a.length>0)?(this.lastParseResult=a,!0):!1})&&this.lastParseResult){const i=this.lastParseResult;return this.lastParseResult=null,i}return this.parseFallbackToken(t)}createParseHelpers(){return{parseInline:t=>this.parseInlineTokens(t),tokenizeInline:t=>this.tokenizeInline(t),parseChildren:t=>this.parseTokens(t),parseBlockChildren:t=>this.parseTokens(t,!0),createTextNode:(t,e)=>({type:"text",text:t,marks:e||void 0}),createNode:(t,e,n)=>{const r={type:t,attrs:e||void 0,content:n||void 0};return(!e||Object.keys(e).length===0)&&delete r.attrs,r},applyMark:(t,e,n)=>({mark:t,content:e,attrs:n&&Object.keys(n).length>0?n:void 0})}}escapeRegex(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}parseInlineTokens(t){var e,n,r,i;const s=[];for(let a=0;a<t.length;a+=1){const c=t[a];if(c.type==="text")s.push({type:"text",text:iA(c.text||"")});else if(c.type==="escape")s.push({type:"text",text:c.text||""});else if(c.type==="html"){const u=((n=(e=c.raw)!=null?e:c.text)!=null?n:"").toString(),f=/^<\/[\s]*[\w-]+/i.test(u),p=u.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!f&&p&&!/\/>$/.test(u)){const g=p[1],y=this.escapeRegex(g),b=new RegExp(`^<\\/\\s*${y}\\b`,"i");let w=-1;const x=[u];for(let k=a+1;k<t.length;k+=1){const T=t[k],A=((i=(r=T.raw)!=null?r:T.text)!=null?i:"").toString();if(x.push(A),T.type==="html"&&b.test(A)){w=k;break}}if(w!==-1){const k=x.join(""),T={type:"html",raw:k,text:k,block:!1},A=this.parseHTMLToken(T);if(A){const _=this.normalizeParseResult(A);Array.isArray(_)?s.push(..._):_&&s.push(_)}a=w;continue}}const m=this.parseHTMLToken(c);if(m){const g=this.normalizeParseResult(m);Array.isArray(g)?s.push(...g):g&&s.push(g)}}else if(c.type){const u=this.getHandlerForToken(c.type);if(u&&u.parseMarkdown){const f=this.createParseHelpers(),p=u.parseMarkdown(c,f);if(this.isMarkResult(p)){const m=this.applyMarkToContent(p.mark,p.content,p.attrs);s.push(...m)}else{const m=this.normalizeParseResult(p);Array.isArray(m)?s.push(...m):m&&s.push(m)}}else c.tokens&&s.push(...this.parseInlineTokens(c.tokens))}}for(let a=s.length-1;a>0;a-=1){const c=s[a],u=s[a-1];if(c.type==="text"&&u.type==="text"){const f=c.marks||[],p=u.marks||[];J5(f,p)&&(u.text=(u.text||"")+(c.text||""),s.splice(a,1))}}return s}applyMarkToContent(t,e,n){return e.map(r=>{if(r.type==="text"){const i=r.marks||[],s=n?{type:t,attrs:n}:{type:t};return{...r,marks:[...i,s]}}return{...r,content:r.content?this.applyMarkToContent(t,r.content,n):void 0}})}isMarkResult(t){return t&&typeof t=="object"&&"mark"in t}normalizeParseResult(t){return t?this.isMarkResult(t)?t.content:t:null}parseFallbackToken(t,e=!1){switch(t.type){case"paragraph":return{type:"paragraph",content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"heading":return{type:"heading",attrs:{level:t.depth||1},content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"text":return{type:"text",text:iA(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=o5(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 PW(t,this.getSchemaParseDomTags())}getSchemaParseDomTags(){if(this.schemaParseDomTagsCache)return this.schemaParseDomTagsCache;const t=new Set;try{const e=yD(this.baseExtensions),n=r=>{const i=r?.parseDOM;Array.isArray(i)&&i.forEach(s=>{if(typeof s?.tag=="string"){const a=s.tag.match(/^[a-zA-Z][\w-]*/);a&&t.add(a[0].toLowerCase())}})};Object.values(e.nodes).forEach(r=>n(r.spec)),Object.values(e.marks).forEach(r=>n(r.spec))}catch{}return this.schemaParseDomTagsCache=t,t}htmlAsLiteralText(t,e){const n=t.replace(/\s+$/,"");return n?e?{type:"paragraph",content:[{type:"text",text:n}]}:{type:"text",text:n}:null}encodeTextForMarkdown(t,e,n){return n?.type!=null&&this.codeTypes.has(n.type)||(e.marks||[]).some(i=>this.codeTypes.has(typeof i=="string"?i:i.type))?t:this.escapeMarkdownSyntax(U5(t))}escapeMarkdownSyntax(t){return t.replace(/([\\`*_[\]~])/g,"\\$1")}renderNodeToMarkdown(t,e,n=0,r=0,i={}){var s;if(t.type==="text")return this.encodeTextForMarkdown(t.text||"",t,e);if(!t.type)return"";const a=this.getHandlerForToken(t.type);if(!a)return"";const c=Array.isArray(e?.content)&&n>0?e.content[n-1]:void 0,u={renderChildren:(m,g)=>{const y=a.isIndenting?r+1:r;return!Array.isArray(m)&&m.content?this.renderNodes(m.content,t,g||"",n,y):this.renderNodes(m,t,g||"",n,y)},renderChild:(m,g)=>{const y=a.isIndenting?r+1:r;return this.renderNodeToMarkdown(m,t,g,y)},indent:m=>this.indentString+m,wrapInBlock:_W},f={index:n,level:r,parentType:e?.type,previousNode:c,meta:{parentAttrs:e?.attrs,...i}};return((s=a.renderMarkdown)==null?void 0:s.call(a,t,u,f))||""}renderNodes(t,e,n="",r=0,i=0){return Array.isArray(t)?this.renderNodesWithMarkBoundaries(t,e,n,i):t.type?this.renderNodeToMarkdown(t,e,r,i):""}renderNodesWithMarkBoundaries(t,e,n="",r=0){const i=[],s=new Map,a=new Set,c=new Map;return t.forEach((u,f)=>{const p=f<t.length-1?t[f+1]:null;if(u.type)if(u.type==="text"){let m=this.encodeTextForMarkdown(u.text||"",u,e);const g=new Map((u.marks||[]).map(O=>[O.type,O])),y=this.getMarksToOpenForSerialization(s,g,p),b=AW(g,p),w=b.filter(O=>s.has(O)),x=w.length>0&&y.length>0;let k="";if(b.length>0&&!x){const O=m.match(/(\s+)$/);O&&(k=O[1],m=m.slice(0,-k.length))}x||b.slice().reverse().forEach(O=>{if(!s.has(O))return;const N=g.get(O),I=this.getMarkClosing(O,N,c.get(O));I&&(m+=I),s.has(O)&&(s.delete(O),c.delete(O))});let T="";if(y.length>0){const O=m.match(/^(\s+)/);O&&(T=O[1],m=m.slice(T.length))}y.forEach(({type:O,mark:N})=>{const I=a.has(O)?"html":"markdown",j=this.getMarkOpening(O,N,I);j&&(m=j+m),c.set(O,I),a.delete(O)}),x||y.slice().reverse().forEach(({type:O,mark:N})=>{s.set(O,N)}),m=T+m;let A;if(x){const O=new Set((p?.marks||[]).map(j=>j.type));y.forEach(({type:j})=>{O.has(j)&&this.getHtmlReopenTags(j)&&a.add(j)});const N=Array.from(s.keys()),I=w.slice().sort((j,G)=>N.indexOf(G)-N.indexOf(j));A=[...y.map(j=>j.type),...I]}else A=MW(s,g,p,this.markSetsEqual.bind(this));let _="";if(A.length>0){const O=m.match(/(\s+)$/);O&&(_=O[1],m=m.slice(0,-_.length))}A.forEach(O=>{var N;const I=(N=s.get(O))!=null?N:g.get(O),j=this.getMarkClosing(O,I,c.get(O));j&&(m+=j),s.delete(O),c.delete(O)}),m+=_,m+=k,i.push(m)}else{const m=new Set((u.marks||[]).map(k=>k.type)),g=new Map,y=new Map;s.forEach((k,T)=>{var A;m.has(T)&&(g.set(T,k),y.set(T,(A=c.get(T))!=null?A:"markdown"))});const b=OW(s,(k,T)=>this.getMarkClosing(k,T,c.get(k)));c.clear();const w=this.renderNodeToMarkdown(u,e,f,r),x=u.type==="hardBreak"?"":NW(g,s,(k,T)=>{var A;const _=(A=y.get(k))!=null?A:"markdown";return c.set(k,_),this.getMarkOpening(k,T,_)});i.push(b+w+x)}}),i.join(n)}getMarkOpening(t,e,n="markdown"){var r;if(n==="html")return((r=this.getHtmlReopenTags(t))==null?void 0:r.open)||"";const i=this.getHandlersForNodeType(t),s=i.length>0?i[0]:void 0;if(!s||!s.renderMarkdown)return"";const a="__TIPTAP_MARKDOWN_PLACEHOLDER__",c={type:t,attrs:e.attrs||{},content:[{type:"text",text:a}]};try{const u=s.renderMarkdown(c,{renderChildren:()=>a,renderChild:()=>a,indent:p=>p,wrapInBlock:(p,m)=>p+m},{index:0,level:0,parentType:"text",meta:{}}),f=u.indexOf(a);return f>=0?u.substring(0,f):""}catch(u){throw new Error(`Failed to get mark opening for ${t}: ${u}`)}}getMarkClosing(t,e,n="markdown"){var r;if(n==="html")return((r=this.getHtmlReopenTags(t))==null?void 0:r.close)||"";const i=this.getHandlersForNodeType(t),s=i.length>0?i[0]:void 0;if(!s||!s.renderMarkdown)return"";const a="__TIPTAP_MARKDOWN_PLACEHOLDER__",c={type:t,attrs:e.attrs||{},content:[{type:"text",text:a}]};try{const u=s.renderMarkdown(c,{renderChildren:()=>a,renderChild:()=>a,indent:m=>m,wrapInBlock:(m,g)=>m+g},{index:0,level:0,parentType:"text",meta:{}}),f=u.indexOf(a),p=f+a.length;return f>=0?u.substring(p):""}catch(u){throw new Error(`Failed to get mark closing for ${t}: ${u}`)}}getHtmlReopenTags(t){const e=this.getHandlersForNodeType(t),n=e.length>0?e[0]:void 0;return n?.htmlReopen}markSetsEqual(t,e){return t.size!==e.size?!1:Array.from(t.entries()).every(([n,r])=>{const i=e.get(n);return i&&uc(r.attrs,i.attrs)})}getMarksToOpenForSerialization(t,e,n){const r=RW(t,e);if(r.length<=1)return r;const i=n?.marks||[],s=(f,p)=>i.some(m=>m.type===f&&uc(m.attrs,p)),a=(f,p)=>{var m,g;const y=(m=this.extensionRanks.get(f.type))!=null?m:Number.MAX_SAFE_INTEGER,b=(g=this.extensionRanks.get(p.type))!=null?g:Number.MAX_SAFE_INTEGER;return y!==b?b-y:f.type.localeCompare(p.type)},c=r.filter(f=>!s(f.type,f.mark.attrs)).sort(a),u=r.filter(f=>s(f.type,f.mark.attrs)).sort(a);return[...c,...u]}},IA=jW,BW=zt.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(t,e)=>{if(!e?.contentType||_h(t,e?.contentType)!=="markdown"||!this.editor.markdown)return Zr.setContent(t,e);const r=this.editor.markdown.parse(t);return Zr.setContent(r,e)},insertContent:(t,e)=>{if(!e?.contentType||_h(t,e?.contentType)!=="markdown"||!this.editor.markdown)return Zr.insertContent(t,e);const r=this.editor.markdown.parse(t);return Zr.insertContent(r,e)},insertContentAt:(t,e,n)=>{if(!n?.contentType||_h(e,n?.contentType)!=="markdown"||!this.editor.markdown)return Zr.insertContentAt(t,e,n);const i=this.editor.markdown.parse(e);return Zr.insertContentAt(t,i,n)}}},addStorage(){return{manager:new IA({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 IA({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||_h(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)}}),$W=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,VW=bn.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",At(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,i,s,a;const c=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",u=(i=(r=t.attrs)==null?void 0:r.alt)!=null?i:"",f=(a=(s=t.attrs)==null?void 0:s.title)!=null?a:"";return f?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize,i=new Set(["src","width","height"]);return({node:s,getPos:a,HTMLAttributes:c,editor:u})=>{const f=document.createElement("img");f.draggable=!1;const p=At(this.options.HTMLAttributes,c);Object.entries(p).forEach(([x,k])=>{if(k!=null)switch(x){case"src":case"width":case"height":break;default:f.setAttribute(x,k);break}}),p.src!==null&&(f.src=p.src);let m={...c};const g=x=>{if(typeof x=="string"&&x!==""){f.getAttribute("src")!==x&&(f.src=x);return}f.hasAttribute("src")&&f.removeAttribute("src"),f.src!==""&&(f.src="")};g(c.src);const y=x=>{if(x.type!==s.type)return!1;const k=u.extensionManager.attributes.filter(A=>A.type===x.type.name),T=cc(x,k);return Object.keys(m).forEach(A=>{!i.has(A)&&!(A in T)&&f.removeAttribute(A)}),Object.entries(T).forEach(([A,_])=>{i.has(A)||(_!=null?f.setAttribute(A,_):f.removeAttribute(A))}),g(T.src),m=T,!0},b=new dq({element:f,editor:u,node:s,getPos:a,onResize:(x,k)=>{f.style.width=`${x}px`,f.style.height=`${k}px`},onCommit:(x,k)=>{const T=a();T!==void 0&&this.editor.chain().setNodeSelection(T).updateAttributes(this.name,{width:x,height:k}).run()},onUpdate:y,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),w=b.dom;return w.style.visibility="hidden",w.style.pointerEvents="none",f.onload=()=>{w.style.visibility="",w.style.pointerEvents=""},b}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[$D({find:$W,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),HW=VW;let F0,q0;if(typeof WeakMap<"u"){let t=new WeakMap;F0=e=>t.get(e),q0=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;F0=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},q0=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var qt=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,a=i+1;for(let c=1;s<this.width&&this.map[e+c]==n;c++)s++;for(let c=1;a<this.height&&this.map[e+this.width*c]==n;c++)a++;return{left:r,top:i,right:s,bottom:a}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:s,bottom:a}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:a==this.height)?null:this.map[r+this.width*(n<0?s-1:a)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:a,right:c,top:u,bottom:f}=this.findCell(e);return{left:Math.min(n,a),top:Math.min(i,u),right:Math.max(r,c),bottom:Math.max(s,f)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,a=this.map[s];n[a]||(n[a]=!0,!(i==t.left&&i&&this.map[s-1]==a||r==t.top&&r&&this.map[s-this.width]==a)&&e.push(a))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let a=e+t*this.width;const c=(t+1)*this.width;for(;a<c&&this.map[a]<i;)a++;return a==c?s-1:this.map[a]}i=s}}static get(t){return F0(t)||q0(t,UW(t))}};function UW(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=FW(t),n=t.childCount,r=[];let i=0,s=null;const a=[];for(let f=0,p=e*n;f<p;f++)r[f]=0;for(let f=0,p=0;f<n;f++){const m=t.child(f);p++;for(let b=0;;b++){for(;i<r.length&&r[i]!=0;)i++;if(b==m.childCount)break;const w=m.child(b),{colspan:x,rowspan:k,colwidth:T}=w.attrs;for(let A=0;A<k;A++){if(A+f>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:p,n:k-A});break}const _=i+A*e;for(let O=0;O<x;O++){r[_+O]==0?r[_+O]=p:(s||(s=[])).push({type:"collision",row:f,pos:p,n:x-O});const N=T&&T[O];if(N){const I=(_+O)%e*2,j=a[I];j==null||j!=N&&a[I+1]==1?(a[I]=N,a[I+1]=1):j==N&&a[I+1]++}}}i+=x,p+=w.nodeSize}const g=(f+1)*e;let y=0;for(;i<g;)r[i++]==0&&y++;y&&(s||(s=[])).push({type:"missing",row:f,n:y}),p++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const c=new qt(e,n,r,s);let u=!1;for(let f=0;!u&&f<a.length;f+=2)a[f]!=null&&a[f+1]<n&&(u=!0);return u&&qW(c,a,t),c}function FW(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let a=0;a<r;a++){const c=t.child(a);for(let u=0;u<c.childCount;u++){const f=c.child(u);a+f.attrs.rowspan>r&&(s+=f.attrs.colspan)}}for(let a=0;a<i.childCount;a++){const c=i.child(a);s+=c.attrs.colspan,c.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function qW(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const a=n.nodeAt(s);if(!a)throw new RangeError(`No cell with offset ${s} found`);let c=null;const u=a.attrs;for(let f=0;f<u.colspan;f++){const p=e[(i+f)%t.width*2];p!=null&&(!u.colwidth||u.colwidth[f]!=p)&&((c||(c=GW(u)))[f]=p)}c&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:c})}}function GW(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Bn(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const ao=new Gt("selectingCells");function Ma(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 WW(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 li(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 Gm(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=Ma(e.$head)||KW(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function KW(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 G0(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function ZW(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Yw(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function VI(t,e,n){const r=t.node(-1),i=qt.get(r),s=t.start(-1),a=i.nextCell(t.pos-s,e,n);return a==null?null:t.node(0).resolve(s+a)}function Oa(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function HI(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function YW(t,e,n){const r=Bn(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var _t=class Xi extends $e{constructor(e,n=e){const r=e.node(-1),i=qt.get(r),s=e.start(-1),a=i.rectBetween(e.pos-s,n.pos-s),c=e.node(0),u=i.cellsInRect(a).filter(p=>p!=n.pos-s);u.unshift(n.pos-s);const f=u.map(p=>{const m=r.nodeAt(p);if(!m)throw new RangeError(`No cell with offset ${p} found`);const g=s+p+1;return new oN(c.resolve(g),c.resolve(g+m.content.size))});super(f[0].$from,f[0].$to,f),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(G0(r)&&G0(i)&&Yw(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Xi.rowSelection(r,i):s&&this.isColSelection()?Xi.colSelection(r,i):new Xi(r,i)}return Ne.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=qt.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},a=[];for(let u=i.top;u<i.bottom;u++){const f=[];for(let p=u*n.width+i.left,m=i.left;m<i.right;m++,p++){const g=n.map[p];if(s[g])continue;s[g]=!0;const y=n.findCell(g);let b=e.nodeAt(g);if(!b)throw new RangeError(`No cell with offset ${g} found`);const w=i.left-y.left,x=y.right-i.right;if(w>0||x>0){let k=b.attrs;if(w>0&&(k=Oa(k,0,w)),x>0&&(k=Oa(k,k.colspan-x,x)),y.left<i.left){if(b=b.type.createAndFill(k),!b)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(k)}`)}else b=b.type.create(k,b.content)}if(y.top<i.top||y.bottom>i.bottom){const k={...b.attrs,rowspan:Math.min(y.bottom,i.bottom)-Math.max(y.top,i.top)};y.top<i.top?b=b.type.createAndFill(k):b=b.type.create(k,b.content)}f.push(b)}a.push(e.child(u).copy(ne.from(f)))}const c=this.isColSelection()&&this.isRowSelection()?e:a;return new we(ne.from(c),1,1)}replace(e,n=we.empty){const r=e.steps.length,i=this.ranges;for(let a=0;a<i.length;a++){const{$from:c,$to:u}=i[a],f=e.mapping.slice(r);e.replace(f.map(c.pos),f.map(u.pos),a?we.empty:n)}const s=$e.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new we(ne.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=qt.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let a=0;a<s.length;a++)e(n.nodeAt(s[a]),i+s[a])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=qt.get(r),s=e.start(-1),a=i.findCell(e.pos-s),c=i.findCell(n.pos-s),u=e.node(0);return a.top<=c.top?(a.top>0&&(e=u.resolve(s+i.map[a.left])),c.bottom<i.height&&(n=u.resolve(s+i.map[i.width*(i.height-1)+c.right-1]))):(c.top>0&&(n=u.resolve(s+i.map[c.left])),a.bottom<i.height&&(e=u.resolve(s+i.map[i.width*(i.height-1)+a.right-1]))),new Xi(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=qt.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const a=i+this.$anchorCell.nodeAfter.attrs.colspan,c=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,c)==n.width}eq(e){return e instanceof Xi&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=qt.get(r),s=e.start(-1),a=i.findCell(e.pos-s),c=i.findCell(n.pos-s),u=e.node(0);return a.left<=c.left?(a.left>0&&(e=u.resolve(s+i.map[a.top*i.width])),c.right<i.width&&(n=u.resolve(s+i.map[i.width*(c.top+1)-1]))):(c.left>0&&(n=u.resolve(s+i.map[c.top*i.width])),a.right<i.width&&(e=u.resolve(s+i.map[i.width*(a.top+1)-1]))),new Xi(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Xi(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Xi(e.resolve(n),e.resolve(r))}getBookmark(){return new XW(this.$anchorCell.pos,this.$headCell.pos)}};_t.prototype.visible=!1;$e.jsonID("cell",_t);var XW=class UI{constructor(e,n){this.anchor=e,this.head=n}map(e){return new UI(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&&Yw(n,r)?new _t(n,r):$e.near(r,1)}};function JW(t){if(!(t.selection instanceof _t))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(mn.node(r,r+n.nodeSize,{class:"selectedCell"}))}),yt.create(t.doc,e)}function QW({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function e7({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function t7(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,a;if(r instanceof Ie&&(a=r.node.type.spec.tableRole)){if(a=="cell"||a=="header_cell")s=_t.create(i,r.from);else if(a=="row"){const c=i.resolve(r.from+1);s=_t.rowSelection(c,c)}else if(!n){const c=qt.get(r.node),u=r.from+1,f=u+c.map[c.width*c.height-1];s=_t.create(i,u+1,f)}}else r instanceof Ne&&QW(r)?s=Ne.create(i,r.from):r instanceof Ne&&e7(r)&&(s=Ne.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const n7=new Gt("fix-tables");function FI(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let a=0,c=0;a<s;a++){const u=e.child(a);for(let f=c,p=Math.min(i,a+3);f<p;f++)if(t.child(f)==u){c=f+1,n+=u.nodeSize;continue e}r(u,n),c<i&&t.child(c).sameMarkup(u)?FI(t.child(c),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function qI(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=r7(t,i,s,n))};return e?e.doc!=t.doc&&FI(e.doc,t.doc,0,r):t.doc.descendants(r),n}function r7(t,e,n,r){const i=qt.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let u=0;u<i.height;u++)s.push(0);for(let u=0;u<i.problems.length;u++){const f=i.problems[u];if(f.type=="collision"){const p=e.nodeAt(f.pos);if(!p)continue;const m=p.attrs;for(let g=0;g<m.rowspan;g++)s[f.row+g]+=f.n;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,Oa(m,m.colspan-f.n,f.n))}else if(f.type=="missing")s[f.row]+=f.n;else if(f.type=="overlong_rowspan"){const p=e.nodeAt(f.pos);if(!p)continue;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,{...p.attrs,rowspan:p.attrs.rowspan-f.n})}else if(f.type=="colwidth mismatch"){const p=e.nodeAt(f.pos);if(!p)continue;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,{...p.attrs,colwidth:f.colwidth})}else if(f.type=="zero_sized"){const p=r.mapping.map(n);r.delete(p,p+e.nodeSize)}}let a,c;for(let u=0;u<s.length;u++)s[u]&&(a==null&&(a=u),c=u);for(let u=0,f=n+1;u<i.height;u++){const p=e.child(u),m=f+p.nodeSize,g=s[u];if(g>0){let y="cell";p.firstChild&&(y=p.firstChild.type.spec.tableRole);const b=[];for(let x=0;x<g;x++){const k=Bn(t.schema)[y].createAndFill();k&&b.push(k)}const w=(u==0||a==u-1)&&c==u?f+1:m-1;r.insert(r.mapping.map(w),b)}f=m}return r.setMeta(n7,{fixTables:!0})}function _i(t){const e=t.selection,n=Gm(t),r=n.node(-1),i=n.start(-1),s=qt.get(r);return{...e instanceof _t?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function GI(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;YW(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let a=0;a<e.height;a++){const c=a*e.width+i;if(i>0&&i<e.width&&e.map[c-1]==e.map[c]){const u=e.map[c],f=r.nodeAt(u);t.setNodeMarkup(t.mapping.map(n+u),null,HI(f.attrs,i-e.colCount(u))),a+=f.attrs.rowspan-1}else{const u=s==null?Bn(r.type.schema).cell:r.nodeAt(e.map[c+s]).type,f=e.positionAt(a,i,r);t.insert(t.mapping.map(n+f),u.createAndFill())}}return t}function i7(t,e){if(!li(t))return!1;if(e){const n=_i(t);e(GI(t.tr,n,n.left))}return!0}function s7(t,e){if(!li(t))return!1;if(e){const n=_i(t);e(GI(t.tr,n,n.right))}return!0}function o7(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let a=0;a<e.height;){const c=a*e.width+i,u=e.map[c],f=n.nodeAt(u),p=f.attrs;if(i>0&&e.map[c-1]==u||i<e.width-1&&e.map[c+1]==u)t.setNodeMarkup(t.mapping.slice(s).map(r+u),null,Oa(p,i-e.colCount(u)));else{const m=t.mapping.slice(s).map(r+u);t.delete(m,m+f.nodeSize)}a+=p.rowspan}}function a7(t,e){if(!li(t))return!1;if(e){const n=_i(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;o7(r,n,i),i!=n.left;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=qt.get(s)}e(r)}return!0}function l7(t,e,n){var r;const i=Bn(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))===null||r===void 0?void 0:r.type)!=i)return!1;return!0}function WI(t,{map:e,tableStart:n,table:r},i){let s=n;for(let f=0;f<i;f++)s+=r.child(f).nodeSize;const a=[];let c=i>0?-1:0;l7(e,r,i+c)&&(c=i==0||i==e.height?null:0);for(let f=0,p=e.width*i;f<e.width;f++,p++)if(i>0&&i<e.height&&e.map[p]==e.map[p-e.width]){const m=e.map[p],g=r.nodeAt(m).attrs;t.setNodeMarkup(n+m,null,{...g,rowspan:g.rowspan+1}),f+=g.colspan-1}else{var u;const m=c==null?Bn(r.type.schema).cell:(u=r.nodeAt(e.map[p+c*e.width]))===null||u===void 0?void 0:u.type,g=m?.createAndFill();g&&a.push(g)}return t.insert(s,Bn(r.type.schema).row.create(null,a)),t}function c7(t,e){if(!li(t))return!1;if(e){const n=_i(t);e(WI(t.tr,n,n.top))}return!0}function u7(t,e){if(!li(t))return!1;if(e){const n=_i(t);e(WI(t.tr,n,n.bottom))}return!0}function d7(t,{map:e,table:n,tableStart:r},i){let s=0;for(let f=0;f<i;f++)s+=n.child(f).nodeSize;const a=s+n.child(i).nodeSize,c=t.mapping.maps.length;t.delete(s+r,a+r);const u=new Set;for(let f=0,p=i*e.width;f<e.width;f++,p++){const m=e.map[p];if(!u.has(m)){if(u.add(m),i>0&&m==e.map[p-e.width]){const g=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g,rowspan:g.rowspan-1}),f+=g.colspan-1}else if(i<e.height&&m==e.map[p+e.width]){const g=n.nodeAt(m),y=g.attrs,b=g.type.create({...y,rowspan:g.attrs.rowspan-1},g.content),w=e.positionAt(i+1,f,n);t.insert(t.mapping.slice(c).map(r+w),b),f+=y.colspan-1}}}}function f7(t,e){if(!li(t))return!1;if(e){const n=_i(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;d7(r,n,i),i!=n.top;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=qt.get(n.table)}e(r)}return!0}function LA(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function h7({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,a=(r.bottom-1)*t+r.left,c=i+(r.right-r.left-1);for(let u=r.top;u<r.bottom;u++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[c]==n[c+1])return!0;s+=t,c+=t}for(let u=r.left;u<r.right;u++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[a]==n[a+t])return!0;i++,a++}return!1}function zA(t,e){const n=t.selection;if(!(n instanceof _t)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=_i(t),{map:i}=r;if(h7(i,r))return!1;if(e){const s=t.tr,a={};let c=ne.empty,u,f;for(let p=r.top;p<r.bottom;p++)for(let m=r.left;m<r.right;m++){const g=i.map[p*i.width+m],y=r.table.nodeAt(g);if(!(a[g]||!y))if(a[g]=!0,u==null)u=g,f=y;else{LA(y)||(c=c.append(y.content));const b=s.mapping.map(g+r.tableStart);s.delete(b,b+y.nodeSize)}}if(u==null||f==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{...HI(f.attrs,f.attrs.colspan,r.right-r.left-f.attrs.colspan),rowspan:r.bottom-r.top}),c.size>0){const p=u+1+f.content.size,m=LA(f)?u+1:p;s.replaceWith(m+r.tableStart,p+r.tableStart,c)}s.setSelection(new _t(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function PA(t,e){const n=Bn(t.schema);return p7(({node:r})=>n[r.type.spec.tableRole])(t,e)}function p7(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof _t){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var a;if(i=WW(r.$from),!i)return!1;s=(a=Ma(r.$from))===null||a===void 0?void 0:a.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let c=i.attrs;const u=[],f=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const p=_i(e),m=e.tr;for(let y=0;y<p.right-p.left;y++)u.push(f?{...c,colwidth:f&&f[y]?[f[y]]:null}:c);let g;for(let y=p.top;y<p.bottom;y++){let b=p.map.positionAt(y,p.left,p.table);y==p.top&&(b+=i.nodeSize);for(let w=p.left,x=0;w<p.right;w++,x++)w==p.left&&y==p.top||m.insert(g=m.mapping.map(b+p.tableStart,1),t({node:i,row:y,col:w}).createAndFill(u[x]))}m.setNodeMarkup(s,t({node:i,row:p.top,col:p.left}),u[0]),r instanceof _t&&m.setSelection(new _t(m.doc.resolve(r.$anchorCell.pos),g?m.doc.resolve(g):void 0)),n(m)}return!0}}function m7(t,e){return function(n,r){if(!li(n))return!1;const i=Gm(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof _t?n.selection.forEachCell((a,c)=>{a.attrs[t]!==e&&s.setNodeMarkup(c,null,{...a.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function g7(t){return function(e,n){if(!li(e))return!1;if(n){const r=Bn(e.schema),i=_i(e),s=e.tr,a=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),c=a.map(u=>i.table.nodeAt(u));for(let u=0;u<a.length;u++)c[u].type==r.header_cell&&s.setNodeMarkup(i.tableStart+a[u],r.cell,c[u].attrs);if(s.steps.length===0)for(let u=0;u<a.length;u++)s.setNodeMarkup(i.tableStart+a[u],r.header_cell,c[u].attrs);n(s)}return!0}}function jA(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function bd(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?g7(t):function(n,r){if(!li(n))return!1;if(r){const i=Bn(n.schema),s=_i(n),a=n.tr,c=jA("row",s,i),u=jA("column",s,i),f=(t==="column"?c:t==="row"&&u)?1:0,p=t=="column"?{left:0,top:f,right:1,bottom:s.map.height}:t=="row"?{left:f,top:0,right:s.map.width,bottom:1}:s,m=t=="column"?u?i.cell:i.header_cell:t=="row"?c?i.cell:i.header_cell:i.cell;s.map.cellsInRect(p).forEach(g=>{const y=g+s.tableStart,b=a.doc.nodeAt(y);b&&a.setNodeMarkup(y,m,b.attrs)}),r(a)}return!0}}bd("row",{useDeprecatedLogic:!0});bd("column",{useDeprecatedLogic:!0});const y7=bd("cell",{useDeprecatedLogic:!0});function v7(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const s=t.node(-1).child(r),a=s.lastChild;if(a)return i-1-a.nodeSize;i-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function BA(t){return function(e,n){if(!li(e))return!1;const r=v7(Gm(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Ne.between(i,ZW(i))).scrollIntoView())}return!0}}function b7(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 Ah(t,e){const n=t.selection;if(!(n instanceof _t))return!1;if(e){const r=t.tr,i=Bn(t.schema).cell.createAndFill().content;n.forEachCell((s,a)=>{s.content.eq(i)||r.replace(r.mapping.map(a+1),r.mapping.map(a+s.nodeSize-1),new we(i,0,0))}),r.docChanged&&e(r)}return!0}function S7(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,a=i.type.schema,c=[];if(s=="row")for(let u=0;u<e.childCount;u++){let f=e.child(u).content;const p=u?0:Math.max(0,n-1),m=u<e.childCount-1?0:Math.max(0,r-1);(p||m)&&(f=W0(Bn(a).row,new we(f,p,m)).content),c.push(f)}else if(s=="cell"||s=="header_cell")c.push(n||r?W0(Bn(a).row,new we(e,n,r)).content:e);else return null;return w7(a,c)}function w7(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let a=s.childCount-1;a>=0;a--){const{rowspan:c,colspan:u}=s.child(a).attrs;for(let f=i;f<i+c;f++)n[f]=(n[f]||0)+u}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(ne.empty),n[i]<r){const s=Bn(t).cell.createAndFill(),a=[];for(let c=n[i];c<r;c++)a.push(s);e[i]=e[i].append(ne.from(a))}return{height:e.length,width:r,rows:e}}function W0(t,e){const n=t.createAndFill();return new ew(n).replace(0,n.content.size,e).doc}function x7({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],a=[];for(let c=0;c<n.length;c++){const u=n[c],f=[];for(let p=s[c]||0,m=0;p<r;m++){let g=u.child(m%u.childCount);p+g.attrs.colspan>r&&(g=g.type.createChecked(Oa(g.attrs,g.attrs.colspan,p+g.attrs.colspan-r),g.content)),f.push(g),p+=g.attrs.colspan;for(let y=1;y<g.attrs.rowspan;y++)s[c+y]=(s[c+y]||0)+g.attrs.colspan}a.push(ne.from(f))}n=a,t=r}if(e!=i){const s=[];for(let a=0,c=0;a<i;a++,c++){const u=[],f=n[c%e];for(let p=0;p<f.childCount;p++){let m=f.child(p);a+m.attrs.rowspan>i&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,i-m.attrs.rowspan)},m.content)),u.push(m)}s.push(ne.from(u))}n=s,e=i}return{width:t,height:e,rows:n}}function k7(t,e,n,r,i,s,a){const c=t.doc.type.schema,u=Bn(c);let f,p;if(i>e.width)for(let m=0,g=0;m<e.height;m++){const y=n.child(m);g+=y.nodeSize;const b=[];let w;y.lastChild==null||y.lastChild.type==u.cell?w=f||(f=u.cell.createAndFill()):w=p||(p=u.header_cell.createAndFill());for(let x=e.width;x<i;x++)b.push(w);t.insert(t.mapping.slice(a).map(g-1+r),b)}if(s>e.height){const m=[];for(let b=0,w=(e.height-1)*e.width;b<Math.max(e.width,i);b++){const x=b>=e.width?!1:n.nodeAt(e.map[w+b]).type==u.header_cell;m.push(x?p||(p=u.header_cell.createAndFill()):f||(f=u.cell.createAndFill()))}const g=u.row.create(null,ne.from(m)),y=[];for(let b=e.height;b<s;b++)y.push(g);t.insert(t.mapping.slice(a).map(r+n.nodeSize-2),y)}return!!(f||p)}function $A(t,e,n,r,i,s,a,c){if(a==0||a==e.height)return!1;let u=!1;for(let f=i;f<s;f++){const p=a*e.width+f,m=e.map[p];if(e.map[p-e.width]==m){u=!0;const g=n.nodeAt(m),{top:y,left:b}=e.findCell(m);t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g.attrs,rowspan:a-y}),t.insert(t.mapping.slice(c).map(e.positionAt(a,b,n)),g.type.createAndFill({...g.attrs,rowspan:y+g.attrs.rowspan-a})),f+=g.attrs.colspan-1}}return u}function VA(t,e,n,r,i,s,a,c){if(a==0||a==e.width)return!1;let u=!1;for(let f=i;f<s;f++){const p=f*e.width+a,m=e.map[p];if(e.map[p-1]==m){u=!0;const g=n.nodeAt(m),y=e.colCount(m),b=t.mapping.slice(c).map(m+r);t.setNodeMarkup(b,null,Oa(g.attrs,a-y,g.attrs.colspan-(a-y))),t.insert(b+g.nodeSize,g.type.createAndFill(Oa(g.attrs,0,a-y))),f+=g.attrs.rowspan-1}}return u}function HA(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let a=qt.get(s);const{top:c,left:u}=r,f=u+i.width,p=c+i.height,m=t.tr;let g=0;function y(){if(s=n?m.doc.nodeAt(n-1):m.doc,!s)throw new Error("No table found");a=qt.get(s),g=m.mapping.maps.length}k7(m,a,s,n,f,p,g)&&y(),$A(m,a,s,n,u,f,c,g)&&y(),$A(m,a,s,n,u,f,p,g)&&y(),VA(m,a,s,n,c,p,u,g)&&y(),VA(m,a,s,n,c,p,f,g)&&y();for(let b=c;b<p;b++){const w=a.positionAt(b,u,s),x=a.positionAt(b,f,s);m.replace(m.mapping.slice(g).map(w+n),m.mapping.slice(g).map(x+n),new we(i.rows[b-c],0,0))}y(),m.setSelection(new _t(m.doc.resolve(n+a.positionAt(c,u,s)),m.doc.resolve(n+a.positionAt(p-1,f-1,s)))),e(m)}const C7=mw({ArrowLeft:Rh("horiz",-1),ArrowRight:Rh("horiz",1),ArrowUp:Rh("vert",-1),ArrowDown:Rh("vert",1),"Shift-ArrowLeft":Mh("horiz",-1),"Shift-ArrowRight":Mh("horiz",1),"Shift-ArrowUp":Mh("vert",-1),"Shift-ArrowDown":Mh("vert",1),Backspace:Ah,"Mod-Backspace":Ah,Delete:Ah,"Mod-Delete":Ah});function Qh(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Rh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof _t)return Qh(n,r,$e.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const a=KI(i,t,e);if(a==null)return!1;if(t=="horiz")return Qh(n,r,$e.near(n.doc.resolve(s.head+e),e));{const c=n.doc.resolve(a),u=VI(c,t,e);let f;return u?f=$e.near(u,1):e<0?f=$e.near(n.doc.resolve(c.before(-1)),-1):f=$e.near(n.doc.resolve(c.after(-1)),1),Qh(n,r,f)}}}function Mh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let a;if(s instanceof _t)a=s;else{const u=KI(i,t,e);if(u==null)return!1;a=new _t(n.doc.resolve(u))}const c=VI(a.$headCell,t,e);return c?Qh(n,r,new _t(a.$anchorCell,c)):!1}}function E7(t,e){const n=t.state.doc,r=Ma(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new _t(r))),!0):!1}function T7(t,e,n){if(!li(t.state))return!1;let r=S7(n);const i=t.state.selection;if(i instanceof _t){r||(r={width:1,height:1,rows:[ne.from(W0(Bn(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),c=qt.get(s).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=x7(r,c.right-c.left,c.bottom-c.top),HA(t.state,t.dispatch,a,c,r),!0}else if(r){const s=Gm(t.state),a=s.start(-1);return HA(t.state,t.dispatch,a,qt.get(s.node(-1)).findCell(s.pos-a),r),!0}else return!1}function _7(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=UA(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof _t)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Ma(t.state.selection.$anchor))!=null&&((n=fb(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(u,f){let p=fb(t,f);const m=ao.getState(t.state)==null;if(!p||!Yw(u,p))if(m)p=u;else return;const g=new _t(u,p);if(m||!t.state.selection.eq(g)){const y=t.state.tr.setSelection(g);m&&y.setMeta(ao,u.pos),t.dispatch(y)}}function a(){t.root.removeEventListener("mouseup",a),t.root.removeEventListener("dragstart",a),t.root.removeEventListener("mousemove",c),ao.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(ao,-1))}function c(u){const f=u,p=ao.getState(t.state);let m;if(p!=null)m=t.state.doc.resolve(p);else if(UA(t,f.target)!=r&&(m=fb(t,e),!m))return a();m&&s(m,f)}t.root.addEventListener("mouseup",a),t.root.addEventListener("dragstart",a),t.root.addEventListener("mousemove",c)}function KI(t,e,n){if(!(t.state.selection instanceof Ne))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const a=r.before(i),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?a:null}}return null}function UA(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function fb(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&Ma(t.state.doc.resolve(r))||Ma(t.state.doc.resolve(i))}var A7=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")),K0(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,K0(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function K0(t,e,n,r,i,s){let a=0,c=!0,u=e.firstChild;const f=t.firstChild;if(f){for(let m=0,g=0;m<f.childCount;m++){const{colspan:y,colwidth:b}=f.child(m).attrs;for(let w=0;w<y;w++,g++){const x=i==g?s:b&&b[w],k=x?x+"px":"";if(a+=x||r,x||(c=!1),u)u.style.width!=k&&(u.style.width=k),u=u.nextSibling;else{const T=document.createElement("col");T.style.width=k,e.appendChild(T)}}}for(;u;){var p;const m=u.nextSibling;(p=u.parentNode)===null||p===void 0||p.removeChild(u),u=m}c?(n.style.width=a+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=a+"px")}}const br=new Gt("tableColumnResizing");function R7({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=A7,lastColumnResizable:i=!0}={}){const s=new Rt({key:br,state:{init(a,c){var u;const f=(u=s.spec)===null||u===void 0||(u=u.props)===null||u===void 0?void 0:u.nodeViews,p=Bn(c.schema).table.name;return r&&f&&(f[p]=(m,g)=>new r(m,n,g)),new M7(-1,!1)},apply(a,c){return c.apply(a)}},props:{attributes:a=>{const c=br.getState(a);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(a,c)=>{O7(a,c,t,i)},mouseleave:a=>{N7(a)},mousedown:(a,c)=>{D7(a,c,e,n)}},decorations:a=>{const c=br.getState(a);if(c&&c.activeHandle>-1)return j7(a,c.activeHandle)},nodeViews:{}}});return s}var M7=class ep{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(br);if(r&&r.setHandle!=null)return new ep(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new ep(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return G0(e.doc.resolve(i))||(i=-1),new ep(i,n.dragging)}return n}};function O7(t,e,n,r){if(!t.editable)return;const i=br.getState(t.state);if(i&&!i.dragging){const s=L7(e.target);let a=-1;if(s){const{left:c,right:u}=s.getBoundingClientRect();e.clientX-c<=n?a=FA(t,e,"left",n):u-e.clientX<=n&&(a=FA(t,e,"right",n))}if(a!=i.activeHandle){if(!r&&a!==-1){const c=t.state.doc.resolve(a),u=c.node(-1),f=qt.get(u),p=c.start(-1);if(f.colCount(c.pos-p)+c.nodeAfter.attrs.colspan-1==f.width-1)return}ZI(t,a)}}}function N7(t){if(!t.editable)return;const e=br.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&ZI(t,-1)}function D7(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,a=br.getState(t.state);if(!a||a.activeHandle==-1||a.dragging)return!1;const c=t.state.doc.nodeAt(a.activeHandle),u=I7(t,a.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(br,{setDragging:{startX:e.clientX,startWidth:u}}));function f(m){s.removeEventListener("mouseup",f),s.removeEventListener("mousemove",p);const g=br.getState(t.state);g?.dragging&&(z7(t,g.activeHandle,qA(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(br,{setDragging:null})))}function p(m){if(!m.which)return f(m);const g=br.getState(t.state);if(g&&g.dragging){const y=qA(g.dragging,m,n);GA(t,g.activeHandle,y,r)}}return GA(t,a.activeHandle,u,r),s.addEventListener("mouseup",f),s.addEventListener("mousemove",p),e.preventDefault(),!0}function I7(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let a=s.node.childNodes[s.offset].offsetWidth,c=n;if(r)for(let u=0;u<n;u++)r[u]&&(a-=r[u],c--);return a/c}function L7(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function FA(t,e,n,r){const i=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:a}=s,c=Ma(t.state.doc.resolve(a));if(!c)return-1;if(n=="right")return c.pos;const u=qt.get(c.node(-1)),f=c.start(-1),p=u.map.indexOf(c.pos-f);return p%u.width==0?-1:f+u.map[p-1]}function qA(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function ZI(t,e){t.dispatch(t.state.tr.setMeta(br,{setHandle:e}))}function z7(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=qt.get(i),a=r.start(-1),c=s.colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1,u=t.state.tr;for(let f=0;f<s.height;f++){const p=f*s.width+c;if(f&&s.map[p]==s.map[p-s.width])continue;const m=s.map[p],g=i.nodeAt(m).attrs,y=g.colspan==1?0:c-s.colCount(m);if(g.colwidth&&g.colwidth[y]==n)continue;const b=g.colwidth?g.colwidth.slice():P7(g.colspan);b[y]=n,u.setNodeMarkup(a+m,null,{...g,colwidth:b})}u.docChanged&&t.dispatch(u)}function GA(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),a=i.start(-1),c=qt.get(s).colCount(i.pos-a)+i.nodeAfter.attrs.colspan-1;let u=t.domAtPos(i.start(-1)).node;for(;u&&u.nodeName!="TABLE";)u=u.parentNode;u&&K0(s,u.firstChild,u,r,c,n)}function P7(t){return Array(t).fill(0)}function j7(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return yt.empty;const s=qt.get(i),a=r.start(-1),c=s.colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1;for(let f=0;f<s.height;f++){const p=c+f*s.width;if((c==s.width-1||s.map[p]!=s.map[p+1])&&(f==0||s.map[p]!=s.map[p-s.width])){var u;const m=s.map[p],g=a+m+i.nodeAt(m).nodeSize-1,y=document.createElement("div");y.className="column-resize-handle",!((u=br.getState(t))===null||u===void 0)&&u.dragging&&n.push(mn.node(a+m,a+m+i.nodeAt(m).nodeSize,{class:"column-resize-dragging"})),n.push(mn.widget(g,y))}}return yt.create(t.doc,n)}function B7({allowTableNodeSelection:t=!1}={}){return new Rt({key:ao,state:{init(){return null},apply(e,n){const r=e.getMeta(ao);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:JW,handleDOMEvents:{mousedown:_7},createSelectionBetween(e){return ao.getState(e.state)!=null?e.state.selection:null},handleTripleClick:E7,handleKeyDown:C7,handlePaste:T7},appendTransaction(e,n,r){return t7(r,qI(r,n),t)}})}function pm(t){return t==="left"||t==="right"||t==="center"?t:null}function $7(t){const e=(t.style.textAlign||"").trim().toLowerCase(),n=(t.getAttribute("align")||"").trim().toLowerCase();return pm(e||n)}function V7(t){return pm(t?.align)}function YI(){return{default:null,parseHTML:t=>$7(t),renderHTML:t=>t.align?{style:`text-align: ${t.align}`}:{}}}function H7(t){var e;const n=t.parentElement,r=t.closest("table");if(!n||!r)return null;const i=Array.from(n.children).indexOf(t),s=(e=r.querySelectorAll("colgroup > col")[i])==null?void 0:e.getAttribute("width");return s?[parseInt(s,10)]:null}function XI(t){const e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):H7(t)}var U7=/[ \t\r\n\f]+/g;function JI(t){var e;return t.children.length>0?!1:((e=t.textContent)!=null?e:"").replace(U7,"")===""}function QI(t){const e=t.createAndFill();if(!e)throw new Error(`[tiptap error]: "${t.name}" has no default content to backfill.`);return e.content}var F7=bn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:XI},align:YI()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getAttrs:t=>JI(t)?{}:!1,getContent:(t,e)=>QI(e.nodes[this.name])},{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",At(this.options.HTMLAttributes,t),0]}}),q7=bn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:XI},align:YI()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getAttrs:t=>JI(t)?{}:!1,getContent:(t,e)=>QI(e.nodes[this.name])},{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",At(this.options.HTMLAttributes,t),0]}}),G7=bn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",At(this.options.HTMLAttributes,t),0]}});function Z0(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function WA(t,e,n,r,i,s){var a;let c=0,u=!0,f=e.firstChild;const p=t.firstChild;if(p!==null)for(let g=0,y=0;g<p.childCount;g+=1){const{colspan:b,colwidth:w}=p.child(g).attrs;for(let x=0;x<b;x+=1,y+=1){const k=i===y?s:w&&w[x],T=k?`${k}px`:"";if(c+=k||r,k||(u=!1),f){if(f.style.width!==T){const[A,_]=Z0(r,k);f.style.setProperty(A,_)}f=f.nextSibling}else{const A=document.createElement("col"),[_,O]=Z0(r,k);A.style.setProperty(_,O),e.appendChild(A)}}}for(;f;){const g=f.nextSibling;(a=f.parentNode)==null||a.removeChild(f),f=g}const m=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);u&&!m?(n.style.width=`${c}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${c}px`)}var W7=class{constructor(t,e,n,r={}){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table"));for(const[i,s]of Object.entries(r))s!=null&&(i==="style"?this.table.style.cssText=String(s):this.table.setAttribute(i,String(s)));t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),WA(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,WA(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 K7(t,e,n,r){let i=0,s=!0;const a=[],c=t.firstChild;if(!c)return{};for(let m=0,g=0;m<c.childCount;m+=1){const{colspan:y,colwidth:b}=c.child(m).attrs;for(let w=0;w<y;w+=1,g+=1){const x=n===g?r:b&&b[w];i+=x||e,x||(s=!1);const[k,T]=Z0(e,x);a.push(["col",{style:`${k}: ${T}`}])}}const u=s?`${i}px`:"",f=s?"":`${i}px`;return{colgroup:["colgroup",{},...a],tableWidth:u,tableMinWidth:f}}function KA(t,e){return t.createAndFill()}function Z7(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 Y7(t,e,n,r,i){const s=Z7(t),a=[],c=[];for(let f=0;f<n;f+=1){const p=KA(s.cell);if(p&&c.push(p),r){const m=KA(s.header_cell);m&&a.push(m)}}const u=[];for(let f=0;f<e;f+=1)u.push(s.row.createChecked(null,r&&f===0?a:c));return s.table.createChecked(null,u)}function X7(t){return t instanceof _t}var Oh=({editor:t})=>{const{selection:e}=t.state;if(!X7(e))return!1;let n=0;const r=hD(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},J7="";function Q7(t){let e="",n=0;for(;n<t.length;){if(t[n]==="\\"&&n+1<t.length){e+=t[n]+t[n+1],n+=2;continue}if(t[n]!=="`"){e+=t[n++];continue}let r=0;for(;n+r<t.length&&t[n+r]==="`";)r+=1;let i=n+r,s=!1;for(;i<t.length;){if(t[i]!=="`"){i+=1;continue}let a=0;for(;i+a<t.length&&t[i+a]==="`";)a+=1;if(a===r){const c=t.slice(n+r,i);e+=t.slice(n,n+r)+c.replace(new RegExp("(?<!\\\\)\\|","g"),"\\|")+t.slice(i,i+r),n=i+r,s=!0;break}i+=a}s||(e+=t.slice(n,n+r),n+=r)}return e}function eK(t){return t.split(`
|
|
273
|
-
`).map(e=>!e.includes("|")||!e.includes("`")?e:Q7(e)).join(`
|
|
274
|
-
`)}function tK(t){return(t||"").replace(/\s+/g," ").trim()}function nK(t,e,n={}){var r;const i=(r=n.cellLineSeparator)!=null?r:J7;if(!t||!t.content||t.content.length===0)return"";const s=[];t.content.forEach(w=>{const x=[];w.content&&w.content.forEach(k=>{let T="";k.content&&Array.isArray(k.content)&&k.content.length>1?T=k.content.map(I=>e.renderChildren(I)).join(i):T=k.content?e.renderChildren(k.content):"";const A=tK(T.split(i).join(`
|
|
275
|
-
`).replace(/[ \t]*\r?\n[ \t]*/g,"<br>")),_=k.type==="tableHeader",O=V7(k.attrs);x.push({text:A,isHeader:_,align:O})}),s.push(x)});const a=s.reduce((w,x)=>Math.max(w,x.length),0);if(a===0)return"";const c=Array.from({length:a}).fill(0);s.forEach(w=>{var x;for(let k=0;k<a;k+=1){const A=(((x=w[k])==null?void 0:x.text)||"").length;A>c[k]&&(c[k]=A),c[k]<3&&(c[k]=3)}});const u=(w,x)=>w+" ".repeat(Math.max(0,x-w.length)),f=s[0],p=f.some(w=>w.isHeader),m=Array.from({length:a}).fill(null);s.forEach(w=>{var x;for(let k=0;k<a;k+=1)!m[k]&&((x=w[k])!=null&&x.align)&&(m[k]=w[k].align)});let g=`
|
|
276
|
-
`;const y=Array.from({length:a}).map((w,x)=>p&&f[x]&&f[x].text||"");return g+=`| ${y.map((w,x)=>u(w,c[x])).join(" | ")} |
|
|
277
|
-
`,g+=`| ${c.map((w,x)=>{const k=Math.max(3,w),T=m[x];return T==="left"?`:${"-".repeat(k)}`:T==="right"?`${"-".repeat(k)}:`:T==="center"?`:${"-".repeat(k)}:`:"-".repeat(k)}).join(" | ")} |
|
|
278
|
-
`,(p?s.slice(1):s).forEach(w=>{g+=`| ${Array.from({length:a}).fill(0).map((x,k)=>u(w[k]&&w[k].text||"",c[k])).join(" | ")} |
|
|
279
|
-
`}),g}var rK=nK,iK=bn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:W7,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:i}=K7(t,this.options.cellMinWidth),s=e.style;function a(){return s||(r?`width: ${r}`:`min-width: ${i}`)}const c=["table",At(this.options.HTMLAttributes,e,{style:a()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},c]:c},parseMarkdown:(t,e)=>{const n=[],r=Array.isArray(t.align)?t.align:[];if(t.header){const i=[];t.header.forEach((s,a)=>{var c;const u=pm((c=r[a])!=null?c:s.align),f=u?{align:u}:{};i.push(e.createNode("tableHeader",f,[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),n.push(e.createNode("tableRow",{},i))}return t.rows&&t.rows.forEach(i=>{const s=[];i.forEach((a,c)=>{var u;const f=pm((u=r[c])!=null?u:a.align),p=f?{align:f}:{};s.push(e.createNode("tableCell",p,[{type:"paragraph",content:e.parseInline(a.tokens)}]))}),n.push(e.createNode("tableRow",{},s))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>rK(t,e),markdownTokenizer:{name:"table",level:"block",start:t=>{const e=t.split(`
|
|
280
|
-
`);if(e.length<2)return-1;const n=e[1];return!/^[ \t|:]*-[ \t|:-]*$/.test(n)||!n.includes("|")?-1:e[0].includes("|")?0:-1},tokenize(t,e,n){const r=t.indexOf(`
|
|
281
|
-
|
|
282
|
-
`),i=r>=0?t.slice(0,r):t,s=i.split(`
|
|
283
|
-
`);if(s.length<2)return;const a=s[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(a)||!a.includes("|"))return;const c=eK(i);if(c===i)return;const f=n.blockTokens(c)[0];if(f?.type!=="table"||!f.raw)return;const p=f.raw.split(`
|
|
284
|
-
`).length,m=t.split(`
|
|
285
|
-
`).slice(0,p).join(`
|
|
286
|
-
`);return{...f,raw:m}}},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const a=Y7(s.schema,t,e,n);if(i){const c=r.selection.from+1;r.replaceSelectionWith(a).scrollIntoView().setSelection(Ne.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>i7(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>s7(t,e),deleteColumn:()=>({state:t,dispatch:e})=>a7(t,e),addRowBefore:()=>({state:t,dispatch:e})=>c7(t,e),addRowAfter:()=>({state:t,dispatch:e})=>u7(t,e),deleteRow:()=>({state:t,dispatch:e})=>f7(t,e),deleteTable:()=>({state:t,dispatch:e})=>b7(t,e),mergeCells:()=>({state:t,dispatch:e})=>zA(t,e),splitCell:()=>({state:t,dispatch:e})=>PA(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>bd("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>bd("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>y7(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>zA(t,e)?!0:PA(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>m7(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>BA(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>BA(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&qI(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=_t.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:Oh,"Mod-Backspace":Oh,Delete:Oh,"Mod-Delete":Oh}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[R7({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],B7({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){const t=this.options.resizable&&this.editor.isEditable,e=this.options.View;return t||!e?null:({node:n,view:r,HTMLAttributes:i})=>{const s=At(this.options.HTMLAttributes,i);return new e(n,this.options.cellMinWidth,r,s)}},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:ct(_e(t,"tableRole",e))}}}),sK=zt.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(iK.configure(this.options.table)),this.options.tableCell!==!1&&t.push(F7.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(q7.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(G7.configure(this.options.tableRow)),t}});function oK({recordImages:t=[],galleryUpload:e,onListGallery:n,onUploadGallery:r,onClose:i,onInsert:s}){const a=!!n,[c,u]=R.useState(t.length?"record":"gallery"),[f,p]=R.useState([]),[m,g]=R.useState(!1),[y,b]=R.useState(null),[w,x]=R.useState({}),[k,T]=R.useState("");R.useEffect(()=>{const Y=X=>{X.key==="Escape"&&i()};window.addEventListener("keydown",Y);const ce=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",Y),document.body.style.overflow=ce}},[i]),R.useEffect(()=>{if(!a)return;let Y=!1;return g(!0),b(null),n().then(ce=>{Y||p(ce)}).catch(ce=>{Y||b(ce instanceof Error?ce.message:"Could not load gallery")}).finally(()=>{Y||g(!1)}),()=>{Y=!0}},[a,n]);const A=R.useMemo(()=>t.map(Y=>({id:`record:${Y.id}`,url:Y.url,name:Y.name,source:"record"})),[t]),_=R.useMemo(()=>f.map(Y=>({id:`gallery:${Y.id}`,url:Y.url,name:Y.name??Y.id,source:"gallery"})),[f]),O=c==="record"?A:_,N=Object.values(w),I=!!(e&&r),j=Y=>{x(ce=>{const X={...ce};return X[Y.id]?delete X[Y.id]:X[Y.id]=Y,X})},G=()=>{const Y=k.trim();if(!Y)return;const ce={id:`url:${Y}`,url:Y,name:"Image",source:"url"};x(X=>({...X,[ce.id]:ce})),T("")};return E.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:i,children:E.jsxs("div",{className:"vertebr-modal",role:"dialog","aria-modal":"true","aria-label":"Insert images",onClick:Y=>Y.stopPropagation(),children:[E.jsxs("header",{className:"vertebr-modal-head",children:[E.jsxs("div",{className:"vertebr-modal-heading",children:[E.jsx("p",{className:"vertebr-modal-eyebrow",children:"Media"}),E.jsx("h2",{children:"Insert images"})]}),E.jsx("button",{type:"button",className:"vertebr-btn",onClick:i,children:"Close"})]}),E.jsxs("div",{className:"vertebr-modal-body vertebr-picker-body",children:[t.length>0&&a?E.jsxs("div",{className:"vertebr-picker-tabs",role:"tablist",children:[E.jsxs("button",{type:"button",role:"tab","aria-selected":c==="record","data-active":c==="record"||void 0,onClick:()=>u("record"),children:["Product photos",E.jsx("span",{children:A.length})]}),E.jsxs("button",{type:"button",role:"tab","aria-selected":c==="gallery","data-active":c==="gallery"||void 0,onClick:()=>u("gallery"),children:["Gallery",E.jsx("span",{children:m?"…":_.length})]})]}):null,c==="gallery"&&I?E.jsx(Dd,{meta:{field:"gallery",accept:e.accept,maxBytes:e.maxBytes},multiple:!0,label:"Drop images to add them to the gallery",onUpload:async Y=>{const ce=await r(Y);p(X=>[...ce,...X]),x(X=>{const te={...X};for(const ie of ce){const he={id:`gallery:${ie.id}`,url:ie.url,name:ie.name??ie.id,source:"gallery"};te[he.id]=he}return te})}}):null,E.jsxs("label",{className:"vertebr-field",children:[E.jsx("span",{children:"Or paste an image URL"}),E.jsxs("div",{className:"vertebr-picker-url",children:[E.jsx("input",{type:"url",value:k,placeholder:"https://",onChange:Y=>T(Y.target.value),onKeyDown:Y=>{Y.key==="Enter"&&(Y.preventDefault(),G())}}),E.jsx("button",{type:"button",className:"vertebr-btn",disabled:!k.trim(),onClick:G,children:"Add"})]})]}),y?E.jsx("p",{className:"vertebr-status","data-tone":"danger",children:y}):null,m&&c==="gallery"?E.jsx("div",{className:"vertebr-empty",children:"Loading gallery…"}):O.length===0?E.jsx("div",{className:"vertebr-empty",children:c==="record"?"No product photos on this record yet.":a?"No images in the gallery yet.":"No gallery is configured. Paste a URL or add product photos."}):E.jsx("div",{className:"vertebr-picker-grid",children:O.map(Y=>{const ce=!!w[Y.id];return E.jsxs("button",{type:"button",className:"vertebr-picker-tile","data-selected":ce||void 0,onClick:()=>j(Y),children:[E.jsx("span",{className:"vertebr-picker-thumb",children:E.jsx("img",{src:Y.url,alt:""})}),E.jsx("span",{className:"vertebr-picker-name",children:Y.name})]},Y.id)})})]}),E.jsxs("footer",{className:"vertebr-picker-foot",children:[E.jsxs("span",{className:"vertebr-picker-count",children:[N.length," selected"]}),E.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",disabled:N.length===0,onClick:()=>s(N),children:["Insert ",N.length||"",N.length===1?" image":" images"]})]})]})})}function ZA(t,e){t&&(typeof t=="function"?t(e):t.current=e)}function Hn({active:t,disabled:e,title:n,onClick:r,children:i}){return E.jsx("button",{type:"button",className:"vertebr-md-btn","data-active":t||void 0,disabled:e,title:n,onMouseDown:s=>s.preventDefault(),onClick:r,children:i})}function aK({id:t,name:e,value:n,readOnly:r,placeholder:i="Write a description…",recordImages:s,galleryUpload:a,onListGallery:c,onUploadGallery:u,onBlur:f,onChange:p,inputRef:m}){const g=typeof n=="string"?n:"",y=R.useRef(p),b=R.useRef(f),w=R.useRef(g),[x,k]=R.useState(!1);y.current=p,b.current=f;const T=u9({immediatelyRender:!1,shouldRerenderOnTransaction:!1,content:g,contentType:"markdown",editable:!r,extensions:[P8.configure({heading:{levels:[2,3]},underline:!1,link:{openOnClick:!1,defaultProtocol:"https"}}),HW.configure({inline:!1,allowBase64:!1}),sK.configure({table:{resizable:!1}}),R8.configure({placeholder:i}),BW.configure({markedOptions:{gfm:!0}})],editorProps:{attributes:{id:t,class:"vertebr-md-content"}},onUpdate:({editor:j})=>{const G=j.getMarkdown();w.current=G,y.current(G)},onBlur:()=>{b.current?.()}});R.useEffect(()=>{if(T)return ZA(m,T.view.dom),()=>ZA(m,null)},[T,m]),R.useEffect(()=>{T&&T.setEditable(!r)},[T,r]),R.useEffect(()=>{if(T&&g!==w.current){if(g===T.getMarkdown()){w.current=g;return}T.commands.setContent(g,{contentType:"markdown",emitUpdate:!1}),w.current=g}},[T,g]);const A=FD({editor:T,selector:({editor:j})=>({bold:j?.isActive("bold")??!1,italic:j?.isActive("italic")??!1,strike:j?.isActive("strike")??!1,code:j?.isActive("code")??!1,codeBlock:j?.isActive("codeBlock")??!1,heading:j?.isActive("heading")??!1,quote:j?.isActive("blockquote")??!1,bullet:j?.isActive("bulletList")??!1,ordered:j?.isActive("orderedList")??!1,table:j?.isActive("table")??!1,link:j?.isActive("link")??!1,stats:VT(j?.getText()??g)})}),_=A?.stats??VT(g),O=r||!T,N=()=>{if(!T||r)return;const j=T.getAttributes("link").href,G=window.prompt("Link URL",typeof j=="string"&&j?j:"https://");if(G!==null){if(!G.trim()){T.chain().focus().extendMarkRange("link").unsetLink().run();return}T.chain().focus().extendMarkRange("link").setLink({href:G.trim()}).run()}},I=j=>{!T||j.length===0||(T.chain().focus().insertContent(j.map(G=>({type:"image",attrs:{src:G.url,alt:G.name}}))).run(),k(!1))};return E.jsxs("div",{className:"vertebr-field-prose",onKeyDown:j=>{(j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="k"&&(j.preventDefault(),N())},children:[e?E.jsx("input",{type:"hidden",name:e,value:g,readOnly:!0}):null,E.jsxs("div",{className:"vertebr-md-toolbar",role:"toolbar","aria-label":"Format",children:[E.jsx(Hn,{active:A?.bold,disabled:O,title:"Bold",onClick:()=>T?.chain().focus().toggleBold().run(),children:E.jsx("span",{className:"vertebr-md-glyph",children:"B"})}),E.jsx(Hn,{active:A?.italic,disabled:O,title:"Italic",onClick:()=>T?.chain().focus().toggleItalic().run(),children:E.jsx("span",{className:"vertebr-md-glyph vertebr-md-italic",children:"I"})}),E.jsx(Hn,{active:A?.strike,disabled:O,title:"Strikethrough",onClick:()=>T?.chain().focus().toggleStrike().run(),children:E.jsx("span",{className:"vertebr-md-glyph vertebr-md-strike",children:"S"})}),E.jsx(Hn,{active:A?.code,disabled:O,title:"Inline code",onClick:()=>T?.chain().focus().toggleCode().run(),children:"</>"}),E.jsx(Hn,{active:A?.codeBlock,disabled:O,title:"Code block",onClick:()=>T?.chain().focus().toggleCodeBlock().run(),children:"{ }"}),E.jsx("span",{className:"vertebr-md-sep","aria-hidden":"true"}),E.jsx(Hn,{active:A?.heading,disabled:O,title:"Heading",onClick:()=>T?.chain().focus().toggleHeading({level:2}).run(),children:"H"}),E.jsx(Hn,{active:A?.quote,disabled:O,title:"Quote",onClick:()=>T?.chain().focus().toggleBlockquote().run(),children:"“"}),E.jsx(Hn,{active:A?.bullet,disabled:O,title:"Bulleted list",onClick:()=>T?.chain().focus().toggleBulletList().run(),children:"•"}),E.jsx(Hn,{active:A?.ordered,disabled:O,title:"Numbered list",onClick:()=>T?.chain().focus().toggleOrderedList().run(),children:"1."}),E.jsx("span",{className:"vertebr-md-sep","aria-hidden":"true"}),E.jsx(Hn,{active:A?.table,disabled:O,title:"Table",onClick:()=>T?.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),children:"Table"}),A?.table?E.jsxs(E.Fragment,{children:[E.jsx(Hn,{disabled:O,title:"Add column",onClick:()=>T?.chain().focus().addColumnAfter().run(),children:"+Col"}),E.jsx(Hn,{disabled:O,title:"Add row",onClick:()=>T?.chain().focus().addRowAfter().run(),children:"+Row"}),E.jsx(Hn,{disabled:O,title:"Delete table",onClick:()=>T?.chain().focus().deleteTable().run(),children:"Del"})]}):null,E.jsx(Hn,{active:A?.link,disabled:O,title:"Link",onClick:N,children:"Link"}),E.jsx(Hn,{disabled:O,title:"Insert images",onClick:()=>k(!0),children:"Image"})]}),E.jsx(UD,{editor:T}),E.jsxs("p",{className:"vertebr-field-prose-meta",children:["Markdown",E.jsx("span",{"aria-hidden":"true",children:" · "}),_.words," ",_.words===1?"word":"words",E.jsx("span",{"aria-hidden":"true",children:" · "}),_.characters," ",_.characters===1?"character":"characters"]}),x?E.jsx(oK,{recordImages:s,galleryUpload:a,onListGallery:c,onUploadGallery:u,onClose:()=>k(!1),onInsert:I}):null]})}function lK({id:t,name:e,value:n,asCents:r=!0,readOnly:i,onBlur:s,onChange:a,inputRef:c}){const[u,f]=R.useState(()=>Nv(n,r));R.useEffect(()=>{f(Nv(n,r))},[n,r]);const p=typeof n=="number"&&Number.isFinite(n)?o0(n,{asCents:r}):null;return E.jsxs("div",{className:"vertebr-field-money",children:[E.jsx("span",{className:"vertebr-field-money-prefix","aria-hidden":"true",children:"$"}),E.jsx("input",{id:t,name:e,ref:c,type:"text",inputMode:"decimal",autoComplete:"off",readOnly:i,value:u,placeholder:"0.00","aria-label":p?`Price ${p}`:"Price",onChange:m=>{const g=m.target.value;f(g),a(nU(g,r))},onBlur:()=>{f(Nv(n,r)),s?.()}})]})}function Y0({fieldKey:t,field:e,groupLabel:n,variant:r,schema:i,watched:s,form:a,uploads:c,onUpload:u,galleryUpload:f,onListGallery:p,onUploadGallery:m,hideImagePreview:g,hideUpload:y}){const b=pH(t,e,n),w=!g&&e.type!=="file[]"&&nc(t,e)&&!!Sp(s?.[t]);return e.type==="boolean"?E.jsxs("div",{className:"vertebr-switch-row",children:[E.jsx(FT,{htmlFor:t,children:b}),E.jsx(vu,{control:a.control,name:t,render:({field:x})=>E.jsx(ZH,{className:"vertebr-switch",id:t,checked:!!x.value,onCheckedChange:x.onChange,children:E.jsx(XH,{className:"vertebr-switch-thumb"})})})]}):E.jsxs("div",{className:"vertebr-field","data-span":dH(t,e,r),"data-kind":nc(t,e)?"image":void 0,children:[E.jsx(FT,{htmlFor:t,children:b}),w?E.jsxs("div",{className:"vertebr-field-media",children:[E.jsx("img",{src:Sp(s[t])??"",alt:""}),E.jsx("input",{id:t,type:"text",readOnly:e.readOnly,...a.register(t)})]}):e.type==="richtext"||iO(t,e)?E.jsx(vu,{control:a.control,name:t,render:({field:x})=>E.jsx(aK,{id:t,name:x.name,inputRef:x.ref,value:typeof x.value=="string"?x.value:"",readOnly:e.readOnly,recordImages:aH(i,s),galleryUpload:f,onListGallery:p,onUploadGallery:m,onBlur:x.onBlur,onChange:x.onChange})}):e.type==="file[]"?E.jsx(vu,{control:a.control,name:t,render:({field:x})=>{const k=HT(x.value);return E.jsx("div",{className:"vertebr-field-files",children:k.length>0?E.jsx("ul",{className:"vertebr-field-files-list",children:k.map(T=>E.jsxs("li",{children:[E.jsx("img",{src:T,alt:""}),E.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>x.onChange(k.filter(A=>A!==T)),children:"Remove"})]},T))}):E.jsx("p",{className:"vertebr-field-files-empty",children:"No photos yet"})})}}):e.type==="number"&&kO(t,e)?E.jsx(vu,{control:a.control,name:t,render:({field:x})=>E.jsx(lK,{id:t,name:x.name,inputRef:x.ref,value:x.value,asCents:YS(t,e)||/^pricing$/i.test(n),readOnly:e.readOnly,onBlur:x.onBlur,onChange:x.onChange})}):e.type==="number"?E.jsx(vu,{control:a.control,name:t,render:({field:x})=>E.jsx("input",{id:t,type:"number",readOnly:e.readOnly,value:typeof x.value=="number"&&Number.isFinite(x.value)?x.value:"",onBlur:x.onBlur,onChange:k=>{const T=k.target.value;x.onChange(T===""?void 0:Number(T))},name:x.name,ref:x.ref})}):E.jsx("input",{id:t,type:"text",readOnly:e.readOnly,...a.register(t)}),!y&&c?.[t]&&u&&!e.readOnly?E.jsx(Dd,{meta:c[t],multiple:e.type==="file[]",onUpload:async x=>{const T=(await u(t,x)).map(A=>A.url).filter(Boolean);if(T.length){if(e.type==="file[]"){a.setValue(t,[...HT(a.getValues(t)),...T],{shouldDirty:!0,shouldTouch:!0});return}a.setValue(t,T[0],{shouldDirty:!0,shouldTouch:!0})}}}):null]})}function eL({form:t,isDirty:e,status:n,tone:r,onDiscard:i}){return E.jsxs("div",{className:"vertebr-actions",children:[E.jsx("button",{className:"vertebr-btn vertebr-btn-primary",type:"submit",disabled:t.formState.isSubmitting||!e,children:t.formState.isSubmitting?"Saving…":"Save changes"}),e?E.jsx("button",{className:"vertebr-btn",type:"button",onClick:i,children:"Discard"}):null,e?E.jsx("span",{className:"vertebr-dirty",children:"Unsaved"}):n?E.jsx("span",{className:"vertebr-status","data-tone":r,children:n}):null,E.jsx("span",{className:"vertebr-actions-spacer"}),E.jsx("span",{className:"vertebr-kbd",children:"⌘S"})]})}function cK({schema:t,groups:e,watched:n,form:r,uploads:i,onUpload:s,galleryUpload:a,onListGallery:c,onUploadGallery:u,onSubmit:f,isDirty:p,status:m,tone:g,onDiscard:y}){const b=yH(t,n),w=b?Sp(n?.[b])??"":"",x=e.filter(A=>/^(Media|Status)$/i.test(A.id)),k=e.filter(A=>!/^(Media|Status)$/i.test(A.id)),T={variant:"record",schema:t,watched:n,form:r,uploads:i,onUpload:s,galleryUpload:a,onListGallery:c,onUploadGallery:u};return E.jsxs("form",{className:"vertebr-form","data-variant":"record",onSubmit:f,children:[E.jsx("div",{className:"vertebr-form-scroll",children:E.jsxs("div",{className:"vertebr-record-layout",children:[E.jsxs("aside",{className:"vertebr-record-aside",children:[E.jsx("div",{className:"vertebr-record-preview",children:w&&ld(w)?E.jsx("img",{src:w,alt:""}):E.jsx("div",{className:"vertebr-record-preview-empty",children:"No image"})}),b&&i?.[b]&&s?E.jsx(Dd,{meta:i[b],label:"Drop a new image or browse",onUpload:async A=>{const[_]=await s(b,A);_?.url&&r.setValue(b,_.url,{shouldDirty:!0,shouldTouch:!0})}}):null,x.map(A=>E.jsxs("div",{className:"vertebr-record-block","data-layout":/^inventory$/i.test(A.id)?"chips":void 0,children:[E.jsx("div",{className:"vertebr-record-block-label",children:A.label}),E.jsx("div",{className:"vertebr-form-fields","data-layout":uH(A.fields[0]?.[0]??"",A.fields[0]?.[1])?"chips":void 0,children:A.fields.map(([_,O])=>E.jsx(Y0,{fieldKey:_,field:O,groupLabel:A.label,hideImagePreview:!0,hideUpload:_===b,...T},_))})]},A.id))]}),E.jsx("div",{className:"vertebr-record-main",children:k.map(A=>{const _=/^inventory$/i.test(A.id);return E.jsxs("div",{className:"vertebr-record-block","data-layout":_?"chips":void 0,children:[E.jsx("div",{className:"vertebr-record-block-label",children:A.label}),E.jsx("div",{className:"vertebr-form-fields","data-layout":_?"chips":void 0,children:A.fields.map(([O,N])=>E.jsx(Y0,{fieldKey:O,field:N,groupLabel:A.label,...T},O))})]},A.id)})})]})}),E.jsx(eL,{form:r,isDirty:p,status:m,tone:g,onDiscard:y})]})}function uK({schema:t,groups:e,watched:n,form:r,uploads:i,onUpload:s,galleryUpload:a,onListGallery:c,onUploadGallery:u,onSubmit:f,isDirty:p,status:m,tone:g,onDiscard:y}){const b=e.length===1;return E.jsxs("form",{className:"vertebr-form","data-variant":"config",onSubmit:f,children:[E.jsx("div",{className:"vertebr-form-scroll",children:e.map(w=>E.jsxs("div",{className:"vertebr-form-section","data-plain":b?"true":void 0,children:[b?null:E.jsxs("div",{className:"vertebr-form-section-head",children:[E.jsx("h3",{children:w.label}),E.jsx("span",{className:"vertebr-form-section-count",children:w.fields.length})]}),E.jsx("div",{className:"vertebr-form-fields",children:w.fields.map(([x,k])=>E.jsx(Y0,{fieldKey:x,field:k,groupLabel:w.label,variant:"config",schema:t,watched:n,form:r,uploads:i,onUpload:s,galleryUpload:a,onListGallery:c,onUploadGallery:u},x))})]},w.id))}),E.jsx(eL,{form:r,isDirty:p,status:m,tone:g,onDiscard:y})]})}function tL({schema:t,value:e,onSave:n,variant:r="config",uploads:i,onUpload:s,galleryUpload:a,onListGallery:c,onUploadGallery:u}){const f=R.useMemo(()=>lH(t),[t]),p=R.useMemo(()=>gH(t,r),[t,r]),[m,g]=R.useState(null),[y,b]=R.useState(),w=EV({resolver:RV(f),defaultValues:e}),x=HM({control:w.control});R.useEffect(()=>{w.reset(e)},[e,w]);const k=w.handleSubmit(async O=>{g("Saving…"),b(void 0);try{await n(O),g("Saved"),b("ok")}catch(N){g(N instanceof Error?N.message:"Save failed"),b("danger")}}),T=w.formState.isDirty;R.useEffect(()=>{const O=N=>{(N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="s"&&(N.preventDefault(),k())};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[k]);const _={schema:t,groups:p,watched:x,form:w,uploads:i,onUpload:s,galleryUpload:a,onListGallery:c,onUploadGallery:u,onSubmit:k,isDirty:T,status:m,tone:y,onDiscard:()=>{w.reset(e),g(null),b(void 0)}};return r==="record"?E.jsx(cK,{..._}):E.jsx(uK,{..._})}var dK=Object.defineProperty,fK=(t,e)=>dK(t,"name",{value:e,configurable:!0});function X0(t,[e,n]){return Math.min(n,Math.max(e,t))}fK(X0,"clamp");var hK=Object.defineProperty,pn=(t,e)=>hK(t,"name",{value:e,configurable:!0});function nL(t){const e=t+"CollectionProvider",[n,r]=gc(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),a=pn(w=>{const{scope:x,children:k}=w,T=R.useRef(null),A=R.useRef(new Map).current;return E.jsx(i,{scope:x,itemMap:A,collectionRef:T,children:k})},"CollectionProvider");a.displayName=e;const c=t+"CollectionSlot",u=Ca(c),f=R.forwardRef((w,x)=>{const{scope:k,children:T}=w,A=s(c,k),_=Xt(x,A.collectionRef);return E.jsx(u,{ref:_,children:T})});f.displayName=c;const p=t+"CollectionItemSlot",m="data-radix-collection-item",g=Ca(p),y=R.forwardRef((w,x)=>{const{scope:k,children:T,...A}=w,_=R.useRef(null),O=Xt(x,_),N=s(p,k);return R.useEffect(()=>(N.itemMap.set(_,{ref:_,...A}),()=>{N.itemMap.delete(_)})),E.jsx(g,{[m]:"",ref:O,children:T})});y.displayName=p;function b(w){const x=s(t+"CollectionConsumer",w);return R.useCallback(()=>{const T=x.collectionRef.current;if(!T)return[];const A=Array.from(T.querySelectorAll(`[${m}]`));return Array.from(x.itemMap.values()).sort((N,I)=>A.indexOf(N.ref.current)-A.indexOf(I.ref.current))},[x.collectionRef,x.itemMap])}return pn(b,"useCollection"),[{Provider:a,Slot:f,ItemSlot:y},b,r]}pn(nL,"createCollection");var YA=new WeakMap,rn,mr,hb=(mr=class extends Map{constructor(n){super(n);pE(this,rn);pv(this,rn,[...super.keys()]),YA.set(this,!0)}set(n,r){return YA.get(this)&&(this.has(n)?Dn(this,rn)[Dn(this,rn).indexOf(n)]=n:Dn(this,rn).push(n)),super.set(n,r),this}insert(n,r,i){const s=this.has(r),a=Dn(this,rn).length,c=Xw(n);let u=c>=0?c:a+c;const f=u<0||u>=a?-1:u;if(f===this.size||s&&f===this.size-1||f===-1)return this.set(r,i),this;const p=this.size+(s?0:1);c<0&&u++;const m=[...Dn(this,rn)];let g,y=!1;for(let b=u;b<p;b++)if(u===b){let w=m[b];m[b]===r&&(w=m[b+1]),s&&this.delete(r),g=this.get(w),this.set(r,i)}else{!y&&m[b-1]===r&&(y=!0);const w=m[y?b:b-1],x=g;g=this.get(w),this.delete(w),this.set(w,x)}return this}with(n,r,i){const s=new mr(this);return s.insert(n,r,i),s}before(n){const r=Dn(this,rn).indexOf(n)-1;if(!(r<0))return this.entryAt(r)}setBefore(n,r,i){const s=Dn(this,rn).indexOf(n);return s===-1?this:this.insert(s,r,i)}after(n){let r=Dn(this,rn).indexOf(n);if(r=r===-1||r===this.size-1?-1:r+1,r!==-1)return this.entryAt(r)}setAfter(n,r,i){const s=Dn(this,rn).indexOf(n);return s===-1?this:this.insert(s+1,r,i)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return pv(this,rn,[]),super.clear()}delete(n){const r=super.delete(n);return r&&Dn(this,rn).splice(Dn(this,rn).indexOf(n),1),r}deleteAt(n){const r=this.keyAt(n);return r!==void 0?this.delete(r):!1}at(n){const r=tp(Dn(this,rn),n);if(r!==void 0)return this.get(r)}entryAt(n){const r=tp(Dn(this,rn),n);if(r!==void 0)return[r,this.get(r)]}indexOf(n){return Dn(this,rn).indexOf(n)}keyAt(n){return tp(Dn(this,rn),n)}from(n,r){const i=this.indexOf(n);if(i===-1)return;let s=i+r;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.at(s)}keyFrom(n,r){const i=this.indexOf(n);if(i===-1)return;let s=i+r;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(n,r){let i=0;for(const s of this){if(Reflect.apply(n,r,[s,i,this]))return s;i++}}findIndex(n,r){let i=0;for(const s of this){if(Reflect.apply(n,r,[s,i,this]))return i;i++}return-1}filter(n,r){const i=[];let s=0;for(const a of this)Reflect.apply(n,r,[a,s,this])&&i.push(a),s++;return new mr(i)}map(n,r){const i=[];let s=0;for(const a of this)i.push([a[0],Reflect.apply(n,r,[a,s,this])]),s++;return new mr(i)}reduce(...n){const[r,i]=n;let s=0,a=i??this.at(0);for(const c of this)s===0&&n.length===1?a=c:a=Reflect.apply(r,this,[a,c,s,this]),s++;return a}reduceRight(...n){const[r,i]=n;let s=i??this.at(-1);for(let a=this.size-1;a>=0;a--){const c=this.at(a);a===this.size-1&&n.length===1?s=c:s=Reflect.apply(r,this,[s,c,a,this])}return s}toSorted(n){const r=[...this.entries()].sort(n);return new mr(r)}toReversed(){const n=new mr;for(let r=this.size-1;r>=0;r--){const i=this.keyAt(r),s=this.get(i);n.set(i,s)}return n}toSpliced(...n){const r=[...this.entries()];return r.splice(...n),new mr(r)}slice(n,r){const i=new mr;let s=this.size-1;if(n===void 0)return i;n<0&&(n=n+this.size),r!==void 0&&r>0&&(s=r-1);for(let a=n;a<=s;a++){const c=this.keyAt(a),u=this.get(c);i.set(c,u)}return i}every(n,r){let i=0;for(const s of this){if(!Reflect.apply(n,r,[s,i,this]))return!1;i++}return!0}some(n,r){let i=0;for(const s of this){if(Reflect.apply(n,r,[s,i,this]))return!0;i++}return!1}},rn=new WeakMap,pn(mr,"OrderedDict"),mr);function tp(t,e){if("at"in Array.prototype)return Array.prototype.at.call(t,e);const n=rL(t,e);return n===-1?void 0:t[n]}pn(tp,"at");function rL(t,e){const n=t.length,r=Xw(e),i=r>=0?r:n+r;return i<0||i>=n?-1:i}pn(rL,"toSafeIndex");function Xw(t){return t!==t||t===0?0:Math.trunc(t)}pn(Xw,"toSafeInteger");function pK(t){const e=t+"CollectionProvider",[n,r]=gc(e),[i,s]=n(e,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new hb,setItemMap:pn(()=>{},"setItemMap")}),a=pn(({state:A,..._})=>A?E.jsx(u,{..._,state:A}):E.jsx(c,{..._}),"CollectionProvider");a.displayName=e;const c=pn(A=>{const _=x();return E.jsx(u,{...A,state:_})},"CollectionInit");c.displayName=e+"Init";const u=pn(A=>{const{scope:_,children:O,state:N}=A,I=R.useRef(null),[j,G]=R.useState(null),Y=Xt(I,G),[ce,X]=N;return R.useEffect(()=>{if(!j)return;const te=oL(()=>{});return te.observe(j,{childList:!0,subtree:!0}),()=>{te.disconnect()}},[j]),E.jsx(i,{scope:_,itemMap:ce,setItemMap:X,collectionRef:Y,collectionRefObject:I,collectionElement:j,children:O})},"CollectionProviderImpl");u.displayName=e+"Impl";const f=t+"CollectionSlot",p=Ca(f),m=R.forwardRef((A,_)=>{const{scope:O,children:N}=A,I=s(f,O),j=Xt(_,I.collectionRef);return E.jsx(p,{ref:j,children:N})});m.displayName=f;const g=t+"CollectionItemSlot",y="data-radix-collection-item",b=Ca(g),w=R.forwardRef((A,_)=>{const{scope:O,children:N,...I}=A,j=R.useRef(null),[G,Y]=R.useState(null),ce=Xt(_,j,Y),X=s(g,O),{setItemMap:te}=X,ie=R.useRef(I);iL(ie.current,I)||(ie.current=I);const he=ie.current;return R.useEffect(()=>{const B=he;return te(Z=>G?Z.has(G)?Z.set(G,{...B,element:G}).toSorted(J0):(Z.set(G,{...B,element:G}),Z.toSorted(J0)):Z),()=>{te(Z=>!G||!Z.has(G)?Z:(Z.delete(G),new hb(Z)))}},[G,he,te]),E.jsx(b,{[y]:"",ref:ce,children:N})});w.displayName=g;function x(){return R.useState(new hb)}pn(x,"useInitCollection");function k(A){const{itemMap:_}=s(t+"CollectionConsumer",A);return _}return pn(k,"useCollection"),[{Provider:a,Slot:m,ItemSlot:w},{createCollectionScope:r,useCollection:k,useInitCollection:x}]}pn(pK,"createCollection");function iL(t,e){if(t===e)return!0;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(e,i)||t[i]!==e[i])return!1;return!0}pn(iL,"shallowEqual");function sL(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}pn(sL,"isElementPreceding");function J0(t,e){return!t[1].element||!e[1].element?0:sL(t[1].element,e[1].element)?-1:1}pn(J0,"sortByDocumentPosition");function oL(t){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){t();return}})}pn(oL,"getChildListObserver");var mK=Object.defineProperty,gK=(t,e)=>mK(t,"name",{value:e,configurable:!0}),yK=R.createContext(void 0);function aL(t){const e=R.useContext(yK);return t||e||"ltr"}gK(aL,"useDirection");var vK=Object.defineProperty,bK=(t,e)=>vK(t,"name",{value:e,configurable:!0});function Ci(t){const e=R.useRef(t);return R.useEffect(()=>{e.current=t}),R.useMemo(()=>((...n)=>e.current?.(...n)),[])}bK(Ci,"useCallbackRef");var SK=Object.defineProperty,hn=(t,e)=>SK(t,"name",{value:e,configurable:!0}),Q0="dismissableLayer.update",wK="dismissableLayer.pointerDownOutside",xK="dismissableLayer.focusOutside",XA,lL=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),kK=R.forwardRef(hn(function(e,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:c,onInteractOutside:u,onDismiss:f,...p}=e,m=R.useContext(lL),[g,y]=R.useState(null),b=g?.ownerDocument??globalThis?.document,[,w]=R.useState({}),x=Xt(n,y),k=Array.from(m.layers),[T]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),A=T?k.indexOf(T):-1,_=g?k.indexOf(g):-1,O=m.layersWithOutsidePointerEventsDisabled.size>0,N=_>=A,I=R.useRef(!1),j=cL(X=>{a?.(X),u?.(X),X.defaultPrevented||f?.()},{ownerDocument:b,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:I,dismissableSurfaces:m.dismissableSurfaces,shouldHandlePointerDownOutside:R.useCallback(X=>{if(!(X instanceof Node))return!1;const te=[...m.branches].some(ie=>ie.contains(X));return N&&!te},[m.branches,N])}),G=uL(X=>{if(i&&I.current)return;const te=X.target;[...m.branches].some(he=>he.contains(te))||(c?.(X),u?.(X),X.defaultPrevented||f?.())},b),Y=g?_===k.length-1:!1,ce=Ci(X=>{X.key==="Escape"&&(s?.(X),!X.defaultPrevented&&f&&(X.preventDefault(),f()))});return R.useEffect(()=>{if(Y)return b.addEventListener("keydown",ce,{capture:!0}),()=>b.removeEventListener("keydown",ce,{capture:!0})},[b,Y,ce]),R.useEffect(()=>{if(g)return r&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(XA=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(g)),m.layers.add(g),eS(),()=>{r&&(m.layersWithOutsidePointerEventsDisabled.delete(g),m.layersWithOutsidePointerEventsDisabled.size===0&&(b.body.style.pointerEvents=XA))}},[g,b,r,m]),R.useEffect(()=>()=>{g&&(m.layers.delete(g),m.layersWithOutsidePointerEventsDisabled.delete(g),eS())},[g,m]),R.useEffect(()=>{const X=hn(()=>w({}),"handleUpdate");return document.addEventListener(Q0,X),()=>document.removeEventListener(Q0,X)},[]),E.jsx(vn.div,{...p,ref:x,style:{pointerEvents:O?N?"auto":"none":void 0,...e.style},onFocusCapture:on(e.onFocusCapture,G.onFocusCapture),onBlurCapture:on(e.onBlurCapture,G.onBlurCapture),onPointerDownCapture:on(e.onPointerDownCapture,j.onPointerDownCapture)})},"DismissableLayer"));function CK(){const t=R.useContext(lL),[e,n]=R.useState(null);return R.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}hn(CK,"useDismissableLayerSurface");var EK=hn(()=>!0,"IS_TRUE");function cL(t,e){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s,shouldHandlePointerDownOutside:a=EK}=e,c=Ci(t),u=R.useRef(!1),f=R.useRef(!1),p=R.useRef(new Map),m=R.useRef(()=>{});return R.useEffect(()=>{function g(){f.current=!1,i.current=!1,p.current.clear()}hn(g,"resetOutsideInteraction");function y(){return Array.from(p.current.values()).some(Boolean)}hn(y,"isOutsideInteractionIntercepted");function b(A){if(!f.current)return;const _=A.target;_ instanceof Node&&[...s].some(N=>N.contains(_))||p.current.set(A.type,!0),A.type==="click"&&window.setTimeout(()=>{f.current&&m.current()},0)}hn(b,"handleInteractionCapture");function w(A){f.current&&p.current.set(A.type,!1)}hn(w,"handleInteractionBubble");const x=hn(A=>{if(A.target&&!u.current){let _=function(){n.removeEventListener("click",m.current);const N=y();g(),N||Jw(wK,c,O,{discrete:!0})};if(hn(_,"handleAndDispatchPointerDownOutsideEvent"),!a(A.target)){n.removeEventListener("click",m.current),g(),u.current=!1;return}const O={originalEvent:A};f.current=!0,i.current=r&&A.button===0,p.current.clear(),!r||A.button!==0?_():(n.removeEventListener("click",m.current),m.current=_,n.addEventListener("click",m.current,{once:!0}))}else n.removeEventListener("click",m.current),g();u.current=!1},"handlePointerDown"),k=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const A of k)n.addEventListener(A,b,!0),n.addEventListener(A,w);const T=window.setTimeout(()=>{n.addEventListener("pointerdown",x)},0);return()=>{window.clearTimeout(T),n.removeEventListener("pointerdown",x),n.removeEventListener("click",m.current);for(const A of k)n.removeEventListener(A,b,!0),n.removeEventListener(A,w)}},[n,c,r,i,s,a]),{onPointerDownCapture:hn(()=>u.current=!0,"onPointerDownCapture")}}hn(cL,"usePointerDownOutside");function uL(t,e=globalThis?.document){const n=Ci(t),r=R.useRef(!1);return R.useEffect(()=>{const i=hn(s=>{s.target&&!r.current&&Jw(xK,n,{originalEvent:s},{discrete:!1})},"handleFocus");return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:hn(()=>r.current=!0,"onFocusCapture"),onBlurCapture:hn(()=>r.current=!1,"onBlurCapture")}}hn(uL,"useFocusOutside");function eS(){const t=new CustomEvent(Q0);document.dispatchEvent(t)}hn(eS,"dispatchUpdate");function Jw(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?hO(i,s):i.dispatchEvent(s)}hn(Jw,"handleAndDispatchCustomEvent");var TK=Object.defineProperty,Qw=(t,e)=>TK(t,"name",{value:e,configurable:!0}),Nh=0,Ol=null;function _K(t){return ex(),t.children}Qw(_K,"FocusGuards");function ex(){R.useEffect(()=>{Ol||(Ol={start:tS(),end:tS()});const{start:t,end:e}=Ol;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),Nh++,()=>{Nh===1&&(Ol?.start.remove(),Ol?.end.remove(),Ol=null),Nh=Math.max(0,Nh-1)}},[])}Qw(ex,"useFocusGuards");function tS(){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}Qw(tS,"createFocusGuard");var AK=Object.defineProperty,qn=(t,e)=>AK(t,"name",{value:e,configurable:!0}),pb="focusScope.autoFocusOnMount",mb="focusScope.autoFocusOnUnmount",JA={bubbles:!1,cancelable:!0},RK=R.forwardRef(qn(function(e,n){const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...c}=e,[u,f]=R.useState(null),p=Ci(s),m=Ci(a),g=R.useRef(null),y=Xt(n,f),b=R.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;R.useEffect(()=>{if(i){let x=function(_){if(b.paused||!u)return;const O=_.target;u.contains(O)?g.current=O:Qi(g.current,{select:!0})},k=function(_){if(b.paused||!u)return;const O=_.relatedTarget;O!==null&&(u.contains(O)||Qi(g.current,{select:!0}))},T=function(_){if(document.activeElement===document.body)for(const N of _)N.removedNodes.length>0&&Qi(u)};qn(x,"handleFocusIn"),qn(k,"handleFocusOut"),qn(T,"handleMutations"),document.addEventListener("focusin",x),document.addEventListener("focusout",k);const A=new MutationObserver(T);return u&&A.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",k),A.disconnect()}}},[i,u,b.paused]),R.useEffect(()=>{if(u){QA.add(b);const x=document.activeElement;if(!u.contains(x)){const T=new CustomEvent(pb,JA);u.addEventListener(pb,p),u.dispatchEvent(T),T.defaultPrevented||(dL(gL(tx(u)),{select:!0}),document.activeElement===x&&Qi(u))}return()=>{u.removeEventListener(pb,p),setTimeout(()=>{const T=new CustomEvent(mb,JA);u.addEventListener(mb,m),u.dispatchEvent(T),T.defaultPrevented||Qi(x??document.body,{select:!0}),u.removeEventListener(mb,m),QA.remove(b)},0)}}},[u,p,m,b]);const w=R.useCallback(x=>{if(!r&&!i||b.paused)return;const k=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,T=document.activeElement;if(k&&T){const A=x.currentTarget,[_,O]=fL(A);_&&O?!x.shiftKey&&T===O?(x.preventDefault(),r&&Qi(_,{select:!0})):x.shiftKey&&T===_&&(x.preventDefault(),r&&Qi(O,{select:!0})):T===A&&x.preventDefault()}},[r,i,b.paused]);return E.jsx(vn.div,{tabIndex:-1,...c,ref:y,onKeyDown:w})},"FocusScope"));function dL(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Qi(r,{select:e}),document.activeElement!==n)return}qn(dL,"focusFirst");function fL(t){const e=tx(t),n=nS(e,t),r=nS(e.reverse(),t);return[n,r]}qn(fL,"getTabbableEdges");function tx(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:qn(r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)e.push(n.currentNode);return e}qn(tx,"getTabbableCandidates");function nS(t,e){const n=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(const r of t)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):hL(r,{upTo:e})))return r}qn(nS,"findVisible");function hL(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}qn(hL,"isHidden");function pL(t){return t instanceof HTMLInputElement&&"select"in t}qn(pL,"isSelectableInput");function Qi(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&pL(t)&&e&&t.select()}}qn(Qi,"focus");var QA=mL();function mL(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=rS(t,e),t.unshift(e)},remove(e){t=rS(t,e),t[0]?.resume()}}}qn(mL,"createFocusScopesStack");function rS(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}qn(rS,"arrayRemove");function gL(t){return t.filter(e=>e.tagName!=="A")}qn(gL,"removeLinks");var MK=Object.defineProperty,OK=(t,e)=>MK(t,"name",{value:e,configurable:!0}),NK=kd[" useId ".trim().toString()]||(()=>{}),DK=0;function nx(t){const[e,n]=R.useState(NK());return Gn(()=>{t||n(r=>r??String(DK++))},[t]),t||(e?`radix-${e}`:"")}OK(nx,"useId");const IK=["top","right","bottom","left"],Ro=Math.min,hs=Math.max,mm=Math.round,Dh=Math.floor,ps=t=>({x:t,y:t}),LK={left:"right",right:"left",bottom:"top",top:"bottom"};function yL(t,e,n){return hs(t,Ro(e,n))}function vs(t,e){return typeof t=="function"?t(e):t}function Mo(t){return t.split("-")[0]}function bc(t){return t.split("-")[1]}function rx(t){return t==="x"?"y":"x"}function ix(t){return t==="y"?"height":"width"}function Si(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function sx(t){return rx(Si(t))}function zK(t,e,n){n===void 0&&(n=!1);const r=bc(t),i=sx(t),s=ix(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(a=gm(a)),[a,gm(a)]}function PK(t){const e=gm(t);return[iS(t),e,iS(e)]}function iS(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const eR=["left","right"],tR=["right","left"],jK=["top","bottom"],BK=["bottom","top"];function $K(t,e,n){switch(t){case"top":case"bottom":return n?e?tR:eR:e?eR:tR;case"left":case"right":return e?jK:BK;default:return[]}}function VK(t,e,n,r){const i=bc(t);let s=$K(Mo(t),n==="start",r);return i&&(s=s.map(a=>a+"-"+i),e&&(s=s.concat(s.map(iS)))),s}function gm(t){const e=Mo(t);return LK[e]+t.slice(e.length)}function HK(t){var e,n,r,i;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(r=t.bottom)!=null?r:0,left:(i=t.left)!=null?i:0}}function vL(t){return typeof t!="number"?HK(t):{top:t,right:t,bottom:t,left:t}}function ym(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function nR(t,e,n){let{reference:r,floating:i}=t;const s=Si(e),a=sx(e),c=ix(a),u=Mo(e),f=s==="y",p=r.x+r.width/2-i.width/2,m=r.y+r.height/2-i.height/2,g=r[c]/2-i[c]/2;let y;switch(u){case"top":y={x:p,y:r.y-i.height};break;case"bottom":y={x:p,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:m};break;case"left":y={x:r.x-i.width,y:m};break;default:y={x:r.x,y:r.y}}const b=bc(e);return b&&(y[a]+=g*(b==="end"?1:-1)*(n&&f?-1:1)),y}async function UK(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:a,elements:c,strategy:u}=t,{boundary:f="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:g=!1,padding:y=0}=vs(e,t),b=vL(y),x=c[g?m==="floating"?"reference":"floating":m],k=ym(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:f,rootBoundary:p,strategy:u})),T=m==="floating"?{x:r,y:i,width:a.floating.width,height:a.floating.height}:a.reference,A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),_=await(s.isElement==null?void 0:s.isElement(A))&&await(s.getScale==null?void 0:s.getScale(A))||{x:1,y:1},O=ym(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:T,offsetParent:A,strategy:u}):T);return{top:(k.top-O.top+b.top)/_.y,bottom:(O.bottom-k.bottom+b.bottom)/_.y,left:(k.left-O.left+b.left)/_.x,right:(O.right-k.right+b.right)/_.x}}const FK=50,qK=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:a}=n,c=a.detectOverflow?a:{...a,detectOverflow:UK},u=await(a.isRTL==null?void 0:a.isRTL(e));let f=await a.getElementRects({reference:t,floating:e,strategy:i}),{x:p,y:m}=nR(f,r,u),g=r,y=0;const b={};for(let w=0;w<s.length;w++){const x=s[w];if(!x)continue;const{name:k,fn:T}=x,{x:A,y:_,data:O,reset:N}=await T({x:p,y:m,initialPlacement:r,placement:g,strategy:i,middlewareData:b,rects:f,platform:c,elements:{reference:t,floating:e}});p=A??p,m=_??m,b[k]={...b[k],...O},N&&y<FK&&(y++,typeof N=="object"&&(N.placement&&(g=N.placement),N.rects&&(f=N.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:i}):N.rects),{x:p,y:m}=nR(f,g,u)),w=-1)}return{x:p,y:m,placement:g,strategy:i,middlewareData:b}},GK=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:a,elements:c,middlewareData:u}=e,{element:f,padding:p=0}=vs(t,e)||{};if(f==null)return{};const m=vL(p),g={x:n,y:r},y=sx(i),b=ix(y),w=await a.getDimensions(f),x=y==="y",k=x?"top":"left",T=x?"bottom":"right",A=x?"clientHeight":"clientWidth",_=s.reference[b]+s.reference[y]-g[y]-s.floating[b],O=g[y]-s.reference[y],N=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let I=N?N[A]:0;(!I||!await(a.isElement==null?void 0:a.isElement(N)))&&(I=c.floating[A]||s.floating[b]);const j=_/2-O/2,G=I/2-w[b]/2-1,Y=Ro(m[k],G),ce=Ro(m[T],G),X=I-w[b]-ce,te=I/2-w[b]/2+j,ie=yL(Y,te,X),he=!u.arrow&&bc(i)!=null&&te!==ie&&s.reference[b]/2-(te<Y?Y:ce)-w[b]/2<0,B=he?te<Y?te-Y:te-X:0;return{[y]:g[y]+B,data:{[y]:ie,centerOffset:te-ie-B,...he&&{alignmentOffset:B}},reset:he}}}),WK=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:a,initialPlacement:c,platform:u,elements:f}=e,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:g,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:w=!0,...x}=vs(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const k=Mo(i),T=Si(c),A=Mo(c)===c,_=await(u.isRTL==null?void 0:u.isRTL(f.floating)),O=g||(A||!w?[gm(c)]:PK(c)),N=b!=="none";!g&&N&&O.push(...VK(c,w,b,_));const I=[c,...O],j=await u.detectOverflow(e,x),G=[];let Y=((r=s.flip)==null?void 0:r.overflows)||[];if(p&&G.push(j[k]),m){const ie=zK(i,a,_);G.push(j[ie[0]],j[ie[1]])}if(Y=[...Y,{placement:i,overflows:G}],!G.every(ie=>ie<=0)){var ce,X;const ie=(((ce=s.flip)==null?void 0:ce.index)||0)+1,he=I[ie];if(he&&(!(m==="alignment"?T!==Si(he):!1)||Y.every(se=>Si(se.placement)===T?se.overflows[0]>0:!0)))return{data:{index:ie,overflows:Y},reset:{placement:he}};let B=(X=Y.filter(Z=>Z.overflows[0]<=0).sort((Z,se)=>Z.overflows[1]-se.overflows[1])[0])==null?void 0:X.placement;if(!B)switch(y){case"bestFit":{var te;const Z=(te=Y.filter(se=>{if(N){const Se=Si(se.placement);return Se===T||Se==="y"}return!0}).map(se=>[se.placement,se.overflows.filter(Se=>Se>0).reduce((Se,Ce)=>Se+Ce,0)]).sort((se,Se)=>se[1]-Se[1])[0])==null?void 0:te[0];Z&&(B=Z);break}case"initialPlacement":B=c;break}if(i!==B)return{reset:{placement:B}}}return{}}}};function rR(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function iR(t){return IK.some(e=>t[e]>=0)}const KK=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...s}=vs(t,e);switch(i){case"referenceHidden":{const a=await r.detectOverflow(e,{...s,elementContext:"reference"}),c=rR(a,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:iR(c)}}}case"escaped":{const a=await r.detectOverflow(e,{...s,altBoundary:!0}),c=rR(a,n.floating);return{data:{escapedOffsets:c,escaped:iR(c)}}}default:return{}}}}},bL=new Set(["left","top"]);async function ZK(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=Mo(n),c=bc(n),u=Si(n)==="y",f=bL.has(a)?-1:1,p=s&&u?-1:1,m=vs(e,t);let{mainAxis:g,crossAxis:y,alignmentAxis:b}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof b=="number"&&(y=c==="end"?b*-1:b),u?{x:y*p,y:g*f}:{x:g*f,y:y*p}}const YK=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:a,middlewareData:c}=e,u=await ZK(e,t);return a===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:s+u.y,data:{...u,placement:a}}}}},XK=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i,platform:s}=e,{mainAxis:a=!0,crossAxis:c=!1,limiter:u={fn:T=>{let{x:A,y:_}=T;return{x:A,y:_}}},...f}=vs(t,e),p={x:n,y:r},m=await s.detectOverflow(e,f),g=Si(i),y=rx(g);let b=p[y],w=p[g];const x=(T,A)=>yL(A+m[T==="y"?"top":"left"],A,A-m[T==="y"?"bottom":"right"]);a&&(b=x(y,b)),c&&(w=x(g,w));const k=u.fn({...e,[y]:b,[g]:w});return{...k,data:{x:k.x-n,y:k.y-r,enabled:{[y]:a,[g]:c}}}}}},JK=function(t){return t===void 0&&(t={}),{options:t,fn(e){var n,r;const{x:i,y:s,placement:a,rects:c,middlewareData:u}=e,{offset:f=0,mainAxis:p=!0,crossAxis:m=!0}=vs(t,e),g={x:i,y:s},y=Si(a),b=rx(y);let w=g[b],x=g[y];const k=vs(f,e),T=typeof k=="number"?{mainAxis:k,crossAxis:0}:{mainAxis:(n=k.mainAxis)!=null?n:0,crossAxis:(r=k.crossAxis)!=null?r:0};if(p){const O=b==="y"?"height":"width",N=c.reference[b]-c.floating[O]+T.mainAxis,I=c.reference[b]+c.reference[O]-T.mainAxis;w<N?w=N:w>I&&(w=I)}if(m){var A,_;const O=b==="y"?"width":"height",N=bL.has(Mo(a)),I=c.reference[y]-c.floating[O]+(N&&((A=u.offset)==null?void 0:A[y])||0)+(N?0:T.crossAxis),j=c.reference[y]+c.reference[O]+(N?0:((_=u.offset)==null?void 0:_[y])||0)-(N?T.crossAxis:0);x<I?x=I:x>j&&(x=j)}return{[b]:w,[y]:x}}}},QK=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:r,platform:i,elements:s}=e,{apply:a=()=>{},...c}=vs(t,e),u=await i.detectOverflow(e,c),f=Mo(n),p=bc(n),m=Si(n)==="y",{width:g,height:y}=r.floating;let b,w;f==="top"||f==="bottom"?(b=f,w=p===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(w=f,b=p==="end"?"top":"bottom");const x=y-u.top-u.bottom,k=g-u.left-u.right,T=Ro(y-u[b],x),A=Ro(g-u[w],k),_=e.middlewareData.shift,O=!_;let N=T,I=A;_!=null&&_.enabled.x&&(I=k),_!=null&&_.enabled.y&&(N=x),O&&!p&&(m?I=g-2*hs(u.left,u.right):N=y-2*hs(u.top,u.bottom)),await a({...e,availableWidth:I,availableHeight:N});const j=await i.getDimensions(s.floating);return g!==j.width||y!==j.height?{reset:{rects:!0}}:{}}}};function Wm(){return typeof window<"u"}function Sc(t){return SL(t)?(t.nodeName||"").toLowerCase():"#document"}function ar(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function xs(t){var e;return(e=(SL(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function SL(t){return Wm()?t instanceof Node||t instanceof ar(t).Node:!1}function Ei(t){return Wm()?t instanceof Element||t instanceof ar(t).Element:!1}function Po(t){return Wm()?t instanceof HTMLElement||t instanceof ar(t).HTMLElement:!1}function sR(t){return!Wm()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ar(t).ShadowRoot}function Km(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=Ti(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&i!=="inline"&&i!=="contents"}function eZ(t){return/^(table|td|th)$/.test(Sc(t))}function Zm(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const tZ=/transform|translate|scale|rotate|perspective|filter/,nZ=/paint|layout|strict|content/,ia=t=>!!t&&t!=="none";let gb;function ox(t){const e=Ei(t)?Ti(t):t;return ia(e.transform)||ia(e.translate)||ia(e.scale)||ia(e.rotate)||ia(e.perspective)||!ax()&&(ia(e.backdropFilter)||ia(e.filter))||tZ.test(e.willChange||"")||nZ.test(e.contain||"")}function rZ(t){let e=Na(t);for(;Po(e)&&!Sd(e);){if(ox(e))return e;if(Zm(e))return null;e=Na(e)}return null}function ax(){return gb==null&&(gb=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),gb}function Sd(t){return/^(html|body|#document)$/.test(Sc(t))}function Ti(t){return ar(t).getComputedStyle(t)}function Ym(t){return Ei(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Na(t){if(Sc(t)==="html")return t;const e=t.assignedSlot||t.parentNode||sR(t)&&t.host||xs(t);return sR(e)?e.host:e}function wL(t){const e=Na(t);return Sd(e)?(t.ownerDocument||t).body:Po(e)&&Km(e)?e:wL(e)}function wd(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=wL(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),a=ar(i);if(s){const c=sS(a);return e.concat(a,a.visualViewport||[],Km(i)?i:[],c&&n?wd(c):[])}else return e.concat(i,wd(i,[],n))}function sS(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function xL(t){const e=Ti(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Po(t),s=i?t.offsetWidth:n,a=i?t.offsetHeight:r,c=mm(n)!==s||mm(r)!==a;return c&&(n=s,r=a),{width:n,height:r,$:c}}function lx(t){return Ei(t)?t:t.contextElement}function Gl(t){const e=lx(t);if(!Po(e))return ps(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=xL(e);let a=(s?mm(n.width):n.width)/r,c=(s?mm(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!c||!Number.isFinite(c))&&(c=1),{x:a,y:c}}const iZ=ps(0);function kL(t){const e=ar(t);return!ax()||!e.visualViewport?iZ:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function sZ(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===ar(t)}function Da(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=lx(t);let a=ps(1);e&&(r?Ei(r)&&(a=Gl(r)):a=Gl(t));const c=sZ(s,n,r)?kL(s):ps(0);let u=(i.left+c.x)/a.x,f=(i.top+c.y)/a.y,p=i.width/a.x,m=i.height/a.y;if(s&&r){const g=ar(s),y=Ei(r)?ar(r):r;let b=g,w=sS(b);for(;w&&y!==b;){const x=Gl(w),k=w.getBoundingClientRect(),T=Ti(w),A=k.left+(w.clientLeft+parseFloat(T.paddingLeft))*x.x,_=k.top+(w.clientTop+parseFloat(T.paddingTop))*x.y;u*=x.x,f*=x.y,p*=x.x,m*=x.y,u+=A,f+=_,b=ar(w),w=sS(b)}}return ym({width:p,height:m,x:u,y:f})}function Xm(t,e){const n=Ym(t).scrollLeft;return e?e.left+n:Da(xs(t)).left+n}function CL(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Xm(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function oZ(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",a=xs(r),c=e?Zm(e.floating):!1;if(r===a||c&&s)return n;let u={scrollLeft:0,scrollTop:0},f=ps(1);const p=ps(0),m=Po(r);if((m||!s)&&((Sc(r)!=="body"||Km(a))&&(u=Ym(r)),m)){const y=Da(r);f=Gl(r),p.x=y.x+r.clientLeft,p.y=y.y+r.clientTop}const g=a&&!m&&!s?CL(a,u):ps(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-u.scrollLeft*f.x+p.x+g.x,y:n.y*f.y-u.scrollTop*f.y+p.y+g.y}}function aZ(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function lZ(t){const e=Ym(t),n=t.ownerDocument.body,r=hs(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=hs(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-e.scrollLeft+Xm(t);const a=-e.scrollTop;return Ti(n).direction==="rtl"&&(s+=hs(t.clientWidth,n.clientWidth)-r),{width:r,height:i,x:s,y:a}}const cZ=25;function uZ(t,e,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",i=ar(t),s=xs(t),a=i.visualViewport;let c=s.clientWidth,u=s.clientHeight,f=0,p=0;if(a){const g=!ax()||e==="fixed";r?g||(f=-a.offsetLeft,p=-a.offsetTop):(c=a.width,u=a.height,g&&(f=a.offsetLeft,p=a.offsetTop))}if(Xm(s)<=0){const g=s.ownerDocument,y=g.body,b=getComputedStyle(y),w=g.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,x=Math.abs(s.clientWidth-y.clientWidth-w),k=getComputedStyle(s).scrollbarGutter==="stable both-edges"?x/2:x;k<=cZ&&(c-=k)}return{width:c,height:u,x:f,y:p}}function dZ(t,e){const n=Da(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=Gl(t),a=t.clientWidth*s.x,c=t.clientHeight*s.y,u=i*s.x,f=r*s.y;return{width:a,height:c,x:u,y:f}}function oR(t,e,n){let r;if(e==="viewport"||e==="layoutViewport")r=uZ(t,n,e);else if(e==="document")r=lZ(xs(t));else if(Ei(e))r=dZ(e,n);else{const i=kL(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return ym(r)}function fZ(t,e){const n=e.get(t);if(n)return n;let r=wd(t,[],!1).filter(c=>Ei(c)&&Sc(c)!=="body"),i=null;const s=Ti(t).position==="fixed";let a=s?Na(t):t;for(;Ei(a)&&!Sd(a);){const c=Ti(a),u=ox(a),f=i?i.position:s?"fixed":"";!u&&(f==="fixed"||f==="absolute"&&c.position==="static")?r=r.filter(m=>m!==a):i=c,a=Na(a)}return e.set(t,r),r}function hZ(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const a=[...n==="clippingAncestors"?Zm(e)?[]:fZ(e,this._c):[].concat(n),r],c=oR(e,a[0],i);let u=c.top,f=c.right,p=c.bottom,m=c.left;for(let g=1;g<a.length;g++){const y=oR(e,a[g],i);u=hs(y.top,u),f=Ro(y.right,f),p=Ro(y.bottom,p),m=hs(y.left,m)}return{width:f-m,height:p-u,x:m,y:u}}function pZ(t){const{width:e,height:n}=xL(t);return{width:e,height:n}}function mZ(t,e,n){const r=Po(e),i=xs(e),s=n==="fixed",a=Da(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const u=ps(0);if((r||!s)&&((Sc(e)!=="body"||Km(i))&&(c=Ym(e)),r)){const g=Da(e,!0,s,e);u.x=g.x+e.clientLeft,u.y=g.y+e.clientTop}!r&&i&&(u.x=Xm(i));const f=i&&!r&&!s?CL(i,c):ps(0),p=a.left+c.scrollLeft-u.x-f.x,m=a.top+c.scrollTop-u.y-f.y;return{x:p,y:m,width:a.width,height:a.height}}function yb(t){return Ti(t).position==="static"}function aR(t,e){if(!Po(t)||Ti(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return xs(t)===n&&(n=n.ownerDocument.body),n}function EL(t,e){const n=ar(t);if(Zm(t))return n;if(!Po(t)){let i=Na(t);for(;i&&!Sd(i);){if(Ei(i)&&!yb(i))return i;i=Na(i)}return n}let r=aR(t,e);for(;r&&eZ(r)&&yb(r);)r=aR(r,e);return r&&Sd(r)&&yb(r)&&!ox(r)?n:r||rZ(t)||n}const gZ=async function(t){const e=this.getOffsetParent||EL,n=this.getDimensions,r=await n(t.floating);return{reference:mZ(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function yZ(t){return Ti(t).direction==="rtl"}const vZ={convertOffsetParentRelativeRectToViewportRelativeRect:oZ,getDocumentElement:xs,getClippingRect:hZ,getOffsetParent:EL,getElementRects:gZ,getClientRects:aZ,getDimensions:pZ,getScale:Gl,isElement:Ei,isRTL:yZ};function TL(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function bZ(t,e,n){let r=null,i;const s=xs(t);function a(){var p;clearTimeout(i),(p=r)==null||p.disconnect(),r=null}function c(p,m){p===void 0&&(p=!1),m===void 0&&(m=1),a();const g=t.getBoundingClientRect(),{left:y,top:b,width:w,height:x}=g;if(p||e(),!w||!x)return;const k=Dh(b),T=Dh(s.clientWidth-(y+w)),A=Dh(s.clientHeight-(b+x)),_=Dh(y),N={rootMargin:-k+"px "+-T+"px "+-A+"px "+-_+"px",threshold:hs(0,Ro(1,m))||1};let I=!0;function j(G){const Y=G[0].intersectionRatio;if(!TL(g,t.getBoundingClientRect()))return c();if(Y!==m){if(!I)return c();Y?c(!1,Y):i=setTimeout(()=>{c(!1,1e-7)},1e3)}I=!1}try{r=new IntersectionObserver(j,{...N,root:s.ownerDocument})}catch{r=new IntersectionObserver(j,N)}r.observe(t)}const u=ar(t),f=()=>c(n);return u.addEventListener("resize",f),c(!0),()=>{u.removeEventListener("resize",f),a()}}function SZ(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=lx(t),p=i||s?[...f?wd(f):[],...e?wd(e):[]]:[];p.forEach(k=>{i&&k.addEventListener("scroll",n),s&&k.addEventListener("resize",n)});const m=f&&c?bZ(f,n,s):null;let g=-1,y=null;a&&(y=new ResizeObserver(k=>{let[T]=k;T&&T.target===f&&y&&e&&(y.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var A;(A=y)==null||A.observe(e)})),n()}),f&&!u&&y.observe(f),e&&y.observe(e));let b,w=u?Da(t):null;u&&x();function x(){const k=Da(t);w&&!TL(w,k)&&n(),w=k,b=requestAnimationFrame(x)}return n(),()=>{var k;p.forEach(T=>{i&&T.removeEventListener("scroll",n),s&&T.removeEventListener("resize",n)}),m?.(),(k=y)==null||k.disconnect(),y=null,u&&cancelAnimationFrame(b)}}const wZ=YK,xZ=XK,kZ=WK,CZ=QK,EZ=KK,lR=GK,TZ=JK,_Z=(t,e,n)=>{const r=new Map,i=n??{},s={...vZ,...i.platform,_c:r};return qK(t,e,{...i,platform:s})};var AZ=typeof document<"u",RZ=function(){},np=AZ?R.useLayoutEffect:RZ;function vm(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!vm(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&t.$$typeof)&&!vm(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function _L(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function cR(t,e){const n=_L(t);return Math.round(e*n)/n}function vb(t){const e=R.useRef(t);return np(()=>{e.current=t}),e}function MZ(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:a}={},transform:c=!0,whileElementsMounted:u,open:f}=t,[p,m]=R.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,y]=R.useState(r);vm(g,r)||y(r);const[b,w]=R.useState(null),[x,k]=R.useState(null),T=R.useCallback(se=>{se!==N.current&&(N.current=se,w(se))},[]),A=R.useCallback(se=>{se!==I.current&&(I.current=se,k(se))},[]),_=s||b,O=a||x,N=R.useRef(null),I=R.useRef(null),j=R.useRef(p),G=u!=null,Y=vb(u),ce=vb(i),X=vb(f),te=R.useCallback(()=>{if(!N.current||!I.current)return;const se={placement:e,strategy:n,middleware:g};ce.current&&(se.platform=ce.current),_Z(N.current,I.current,se).then(Se=>{const Ce={...Se,isPositioned:X.current!==!1};ie.current&&!vm(j.current,Ce)&&(j.current=Ce,pc.flushSync(()=>{m(Ce)}))})},[g,e,n,ce,X]);np(()=>{f===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,m(se=>({...se,isPositioned:!1})))},[f]);const ie=R.useRef(!1);np(()=>(ie.current=!0,()=>{ie.current=!1}),[]),np(()=>{if(_&&(N.current=_),O&&(I.current=O),_&&O){if(Y.current)return Y.current(_,O,te);te()}},[_,O,te,Y,G]);const he=R.useMemo(()=>({reference:N,floating:I,setReference:T,setFloating:A}),[T,A]),B=R.useMemo(()=>({reference:_,floating:O}),[_,O]),Z=R.useMemo(()=>{const se={position:n,left:0,top:0};if(!B.floating)return se;const Se=cR(B.floating,p.x),Ce=cR(B.floating,p.y);return c?{...se,transform:"translate("+Se+"px, "+Ce+"px)",..._L(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Se,top:Ce}},[n,c,B.floating,p.x,p.y]);return R.useMemo(()=>({...p,update:te,refs:he,elements:B,floatingStyles:Z}),[p,te,he,B,Z])}const OZ=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?lR({element:r.current,padding:i}).fn(n):{}:r?lR({element:r,padding:i}).fn(n):{}}}},NZ=(t,e)=>{const n=wZ(t);return{name:n.name,fn:n.fn,options:[t,e]}},DZ=(t,e)=>{const n=xZ(t);return{name:n.name,fn:n.fn,options:[t,e]}},IZ=(t,e)=>({fn:TZ(t).fn,options:[t,e]}),LZ=(t,e)=>{const n=kZ(t);return{name:n.name,fn:n.fn,options:[t,e]}},zZ=(t,e)=>{const n=CZ(t);return{name:n.name,fn:n.fn,options:[t,e]}},PZ=(t,e)=>{const n=EZ(t);return{name:n.name,fn:n.fn,options:[t,e]}},jZ=(t,e)=>{const n=OZ(t);return{name:n.name,fn:n.fn,options:[t,e]}};var BZ=Object.defineProperty,xo=(t,e)=>BZ(t,"name",{value:e,configurable:!0}),AL="Popper",[RL,ML]=gc(AL),[$Z,OL]=RL(AL),VZ=xo(t=>{const{__scopePopper:e,children:n}=t,[r,i]=R.useState(null),[s,a]=R.useState(void 0);return E.jsx($Z,{scope:e,anchor:r,onAnchorChange:i,placementState:s,setPlacementState:a,children:n})},"Popper"),HZ="PopperAnchor",UZ=R.forwardRef(xo(function(e,n){const{__scopePopper:r,virtualRef:i,...s}=e,a=OL(HZ,r),c=R.useRef(null),u=a.onAnchorChange,f=R.useCallback(w=>{c.current=w,w&&u(w)},[u]),p=Xt(n,f),m=R.useRef(null);R.useEffect(()=>{if(!i)return;const w=m.current;m.current=i.current,w!==m.current&&u(m.current)});const g=a.placementState&&Jm(a.placementState),y=g?.[0],b=g?.[1];return i?null:E.jsx(vn.div,{"data-radix-popper-side":y,"data-radix-popper-align":b,...s,ref:p})},"PopperAnchor")),NL="PopperContent",[FZ,GJ]=RL(NL),qZ=R.forwardRef(xo(function(e,n){const{__scopePopper:r,side:i="bottom",sideOffset:s=0,align:a="center",alignOffset:c=0,arrowPadding:u=0,avoidCollisions:f=!0,collisionBoundary:p=[],collisionPadding:m=0,sticky:g="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:w,...x}=e,k=OL(NL,r),[T,A]=R.useState(null),_=Xt(n,A),[O,N]=R.useState(null),I=GS(O),j=I?.width??0,G=I?.height??0,Y=i+(a!=="center"?"-"+a:""),ce=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},X=Array.isArray(p)?p:[p],te=X.length>0,ie={padding:ce,boundary:X.filter(DL),altBoundary:te},{refs:he,floatingStyles:B,placement:Z,isPositioned:se,middlewareData:Se}=MZ({strategy:"fixed",placement:Y,whileElementsMounted:xo((...Ee)=>SZ(...Ee,{animationFrame:b==="always"}),"whileElementsMounted"),elements:{reference:k.anchor},middleware:[NZ({mainAxis:s+G,alignmentAxis:c}),f&&DZ({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?IZ():void 0,...ie}),f&&LZ({...ie}),zZ({...ie,apply:xo(({elements:Ee,rects:it,availableWidth:Ke,availableHeight:Qe})=>{const{width:pt,height:$t}=it.reference,Wt=Ee.floating.style;Wt.setProperty("--radix-popper-available-width",`${Ke}px`),Wt.setProperty("--radix-popper-available-height",`${Qe}px`),Wt.setProperty("--radix-popper-anchor-width",`${pt}px`),Wt.setProperty("--radix-popper-anchor-height",`${$t}px`)},"apply")}),O&&jZ({element:O,padding:u}),GZ({arrowWidth:j,arrowHeight:G}),y&&PZ({strategy:"referenceHidden",...ie,boundary:te?ie.boundary:void 0})]}),Ce=k.setPlacementState;Gn(()=>(Ce(Z),()=>{Ce(void 0)}),[Z,Ce]);const[z,K]=Jm(Z),le=Ci(w);Gn(()=>{se&&le?.()},[se,le]);const ve=Se.arrow?.x,Ae=Se.arrow?.y,de=Se.arrow?.centerOffset!==0,[pe,me]=R.useState();return Gn(()=>{T&&me(window.getComputedStyle(T).zIndex)},[T]),E.jsx("div",{ref:he.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:se?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:pe,"--radix-popper-transform-origin":[Se.transformOrigin?.x,Se.transformOrigin?.y].join(" "),...Se.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:E.jsx(FZ,{scope:r,placedSide:z,placedAlign:K,onArrowChange:N,arrowX:ve,arrowY:Ae,shouldHideArrow:de,children:E.jsx(vn.div,{"data-side":z,"data-align":K,...x,ref:_,style:{...x.style,animation:se?x.style?.animation:"none"}})})})},"PopperContent"));function DL(t){return t!==null}xo(DL,"isNotNull");var GZ=xo(t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:r,middlewareData:i}=e,a=i.arrow?.centerOffset!==0,c=a?0:t.arrowWidth,u=a?0:t.arrowHeight,[f,p]=Jm(n),m={start:"0%",center:"50%",end:"100%"}[p],g=(i.arrow?.x??0)+c/2,y=(i.arrow?.y??0)+u/2;let b="",w="";return f==="bottom"?(b=a?m:`${g}px`,w=`${-u}px`):f==="top"?(b=a?m:`${g}px`,w=`${r.floating.height+u}px`):f==="right"?(b=`${-u}px`,w=a?m:`${y}px`):f==="left"&&(b=`${r.floating.width+u}px`,w=a?m:`${y}px`),{data:{x:b,y:w}}}}),"transformOrigin");function Jm(t){const[e,n="center"]=t.split("-");return[e,n]}xo(Jm,"getSideAndAlignFromPlacement");var WZ=VZ,KZ=UZ,ZZ=qZ,YZ=Object.defineProperty,XZ=(t,e)=>YZ(t,"name",{value:e,configurable:!0}),JZ=R.forwardRef(XZ(function(e,n){const{container:r,...i}=e,[s,a]=R.useState(!1);Gn(()=>a(!0),[]);const c=r||s&&globalThis?.document?.body;return c?pc.createPortal(E.jsx(vn.div,{...i,ref:n}),c):null},"Portal")),QZ=Object.defineProperty,bs=(t,e)=>QZ(t,"name",{value:e,configurable:!0});function IL(t,e){return R.useReducer((n,r)=>e[n][r]??n,t)}bs(IL,"useStateMachine");var eY=bs(t=>{const{present:e,children:n}=t,r=LL(e),i=typeof n=="function"?n({present:r.isPresent}):R.Children.only(n),s=zL(r.ref,PL(i));return typeof n=="function"||r.isPresent?R.cloneElement(i,{ref:s}):null},"Presence");function LL(t){const[e,n]=R.useState(),r=R.useRef(null),i=R.useRef(t),s=R.useRef("none"),a=R.useRef(void 0),c=t?"mounted":"unmounted",[u,f]=IL(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return R.useEffect(()=>{u==="mounted"?(s.current=a.current??Bl(r.current),a.current=void 0):s.current="none"},[u]),Gn(()=>{const p=r.current,m=i.current;if(m!==t){const y=s.current,b=Bl(p);t?(a.current=b,f("MOUNT")):b==="none"||p?.display==="none"?f("UNMOUNT"):f(m&&y!==b?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,f]),Gn(()=>{if(e){let p;const m=e.ownerDocument.defaultView??window,g=bs(b=>{const x=Bl(r.current).includes(CSS.escape(b.animationName));if(b.target===e&&x&&(f("ANIMATION_END"),!i.current)){const k=e.style.animationFillMode;e.style.animationFillMode="forwards",p=m.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=k)})}},"handleAnimationEnd"),y=bs(b=>{b.target===e&&(s.current=Bl(r.current))},"handleAnimationStart");return e.addEventListener("animationstart",y),e.addEventListener("animationcancel",g),e.addEventListener("animationend",g),()=>{m.clearTimeout(p),e.removeEventListener("animationstart",y),e.removeEventListener("animationcancel",g),e.removeEventListener("animationend",g)}}else f("ANIMATION_END")},[e,f]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:R.useCallback(p=>{if(p){const m=getComputedStyle(p);r.current=m,a.current=Bl(m)}else r.current=null;n(p)},[])}}bs(LL,"usePresence");function oS(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}bs(oS,"setRef");function zL(...t){const e=R.useRef(t);return e.current=t,R.useCallback(n=>{const r=e.current;let i=!1;const s=r.map(a=>{const c=oS(a,n);return!i&&typeof c=="function"&&(i=!0),c});if(i)return()=>{for(let a=0;a<s.length;a++){const c=s[a];typeof c=="function"?c():oS(r[a],null)}}},[])}bs(zL,"useStableComposedRefs");function Bl(t){return t?.animationName||"none"}bs(Bl,"getAnimationName");function PL(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)}bs(PL,"getElementRef");var tY=Object.defineProperty,nY=(t,e)=>tY(t,"name",{value:e,configurable:!0});function jL(t){const e=R.useRef({value:t,previous:t});return R.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}nY(jL,"usePrevious");var rY=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"}),iY=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Nl=new WeakMap,Ih=new WeakMap,Lh={},bb=0,BL=function(t){return t&&(t.host||BL(t.parentNode))},sY=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=BL(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})},oY=function(t,e,n,r){var i=sY(e,Array.isArray(t)?t:[t]);Lh[n]||(Lh[n]=new WeakMap);var s=Lh[n],a=[],c=new Set,u=new Set(i),f=function(m){!m||c.has(m)||(c.add(m),f(m.parentNode))};i.forEach(f);var p=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(g){if(c.has(g))p(g);else try{var y=g.getAttribute(r),b=y!==null&&y!=="false",w=(Nl.get(g)||0)+1,x=(s.get(g)||0)+1;Nl.set(g,w),s.set(g,x),a.push(g),w===1&&b&&Ih.set(g,!0),x===1&&g.setAttribute(n,"true"),b||g.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",g,k)}})};return p(e),c.clear(),bb++,function(){a.forEach(function(m){var g=Nl.get(m)-1,y=s.get(m)-1;Nl.set(m,g),s.set(m,y),g||(Ih.has(m)||m.removeAttribute(r),Ih.delete(m)),y||m.removeAttribute(n)}),bb--,bb||(Nl=new WeakMap,Nl=new WeakMap,Ih=new WeakMap,Lh={})}},aY=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=iY(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),oY(r,i,n,"aria-hidden")):function(){return null}},bi=function(){return bi=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},bi.apply(this,arguments)};function $L(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function lY(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}var rp="right-scroll-bar-position",ip="width-before-scroll-bar",cY="with-scroll-bars-hidden",uY="--removed-body-scroll-bar-size";function Sb(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function dY(t,e){var n=R.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=e,n.facade}var fY=typeof window<"u"?R.useLayoutEffect:R.useEffect,uR=new WeakMap;function hY(t,e){var n=dY(null,function(r){return t.forEach(function(i){return Sb(i,r)})});return fY(function(){var r=uR.get(n);if(r){var i=new Set(r),s=new Set(t),a=n.current;i.forEach(function(c){s.has(c)||Sb(c,null)}),s.forEach(function(c){i.has(c)||Sb(c,a)})}uR.set(n,t)},[t]),n}function pY(t){return t}function mY(t,e){e===void 0&&(e=pY);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(s){var a=e(s,r);return n.push(a),function(){n=n.filter(function(c){return c!==a})}},assignSyncMedium:function(s){for(r=!0;n.length;){var a=n;n=[],a.forEach(s)}n={push:function(c){return s(c)},filter:function(){return n}}},assignMedium:function(s){r=!0;var a=[];if(n.length){var c=n;n=[],c.forEach(s),a=n}var u=function(){var p=a;a=[],p.forEach(s)},f=function(){return Promise.resolve().then(u)};f(),n={push:function(p){a.push(p),f()},filter:function(p){return a=a.filter(p),n}}}};return i}function gY(t){t===void 0&&(t={});var e=mY(null);return e.options=bi({async:!0,ssr:!1},t),e}var VL=function(t){var e=t.sideCar,n=$L(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 R.createElement(r,bi({},n))};VL.isSideCarExport=!0;function yY(t,e){return t.useMedium(e),VL}var HL=gY(),wb=function(){},Qm=R.forwardRef(function(t,e){var n=R.useRef(null),r=R.useState({onScrollCapture:wb,onWheelCapture:wb,onTouchMoveCapture:wb}),i=r[0],s=r[1],a=t.forwardProps,c=t.children,u=t.className,f=t.removeScrollBar,p=t.enabled,m=t.shards,g=t.sideCar,y=t.noRelative,b=t.noIsolation,w=t.inert,x=t.allowPinchZoom,k=t.as,T=k===void 0?"div":k,A=t.gapMode,_=$L(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=g,N=hY([n,e]),I=bi(bi({},_),i);return R.createElement(R.Fragment,null,p&&R.createElement(O,{sideCar:HL,removeScrollBar:f,shards:m,noRelative:y,noIsolation:b,inert:w,setCallbacks:s,allowPinchZoom:!!x,lockRef:n,gapMode:A}),a?R.cloneElement(R.Children.only(c),bi(bi({},I),{ref:N})):R.createElement(T,bi({},I,{className:u,ref:N}),c))});Qm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Qm.classNames={fullWidth:ip,zeroRight:rp};var vY=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function bY(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=vY();return e&&t.setAttribute("nonce",e),t}function SY(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function wY(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var xY=function(){var t=0,e=null;return{add:function(n){t==0&&(e=bY())&&(SY(e,n),wY(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},kY=function(){var t=xY();return function(e,n){R.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},UL=function(){var t=kY(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},CY={left:0,top:0,right:0,gap:0},xb=function(t){return parseInt(t||"",10)||0},EY=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[xb(n),xb(r),xb(i)]},TY=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return CY;var e=EY(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])}},_Y=UL(),Wl="data-scroll-locked",AY=function(t,e,n,r){var i=t.left,s=t.top,a=t.right,c=t.gap;return n===void 0&&(n="margin"),`
|
|
287
|
-
.`.concat(cY,` {
|
|
288
|
-
overflow: hidden `).concat(r,`;
|
|
289
|
-
padding-right: `).concat(c,"px ").concat(r,`;
|
|
290
|
-
}
|
|
291
|
-
body[`).concat(Wl,`] {
|
|
292
|
-
overflow: hidden `).concat(r,`;
|
|
293
|
-
overscroll-behavior: contain;
|
|
294
|
-
`).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
295
|
-
padding-left: `.concat(i,`px;
|
|
296
|
-
padding-top: `).concat(s,`px;
|
|
297
|
-
padding-right: `).concat(a,`px;
|
|
298
|
-
margin-left:0;
|
|
299
|
-
margin-top:0;
|
|
300
|
-
margin-right: `).concat(c,"px ").concat(r,`;
|
|
301
|
-
`),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
.`).concat(rp,` {
|
|
305
|
-
right: `).concat(c,"px ").concat(r,`;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
.`).concat(ip,` {
|
|
309
|
-
margin-right: `).concat(c,"px ").concat(r,`;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
.`).concat(rp," .").concat(rp,` {
|
|
313
|
-
right: 0 `).concat(r,`;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
.`).concat(ip," .").concat(ip,` {
|
|
317
|
-
margin-right: 0 `).concat(r,`;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
body[`).concat(Wl,`] {
|
|
321
|
-
`).concat(uY,": ").concat(c,`px;
|
|
322
|
-
}
|
|
323
|
-
`)},dR=function(){var t=parseInt(document.body.getAttribute(Wl)||"0",10);return isFinite(t)?t:0},RY=function(){R.useEffect(function(){return document.body.setAttribute(Wl,(dR()+1).toString()),function(){var t=dR()-1;t<=0?document.body.removeAttribute(Wl):document.body.setAttribute(Wl,t.toString())}},[])},MY=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;RY();var s=R.useMemo(function(){return TY(i)},[i]);return R.createElement(_Y,{styles:AY(s,!e,i,n?"":"!important")})},aS=!1;if(typeof window<"u")try{var zh=Object.defineProperty({},"passive",{get:function(){return aS=!0,!0}});window.addEventListener("test",zh,zh),window.removeEventListener("test",zh,zh)}catch{aS=!1}var Dl=aS?{passive:!1}:!1,OY=function(t){return t.tagName==="TEXTAREA"},FL=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!OY(t)&&n[e]==="visible")},NY=function(t){return FL(t,"overflowY")},DY=function(t){return FL(t,"overflowX")},fR=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=qL(t,r);if(i){var s=GL(t,r),a=s[1],c=s[2];if(a>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},IY=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},LY=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},qL=function(t,e){return t==="v"?NY(e):DY(e)},GL=function(t,e){return t==="v"?IY(e):LY(e)},zY=function(t,e){return t==="h"&&e==="rtl"?-1:1},PY=function(t,e,n,r,i){var s=zY(t,window.getComputedStyle(e).direction),a=s*r,c=n.target,u=e.contains(c),f=!1,p=a>0,m=0,g=0;do{if(!c)break;var y=GL(t,c),b=y[0],w=y[1],x=y[2],k=w-x-s*b;(b||k)&&qL(t,c)&&(m+=k,g+=b);var T=c.parentNode;c=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!u&&c!==document.body||u&&(e.contains(c)||e===c));return(p&&Math.abs(m)<1||!p&&Math.abs(g)<1)&&(f=!0),f},Ph=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},hR=function(t){return[t.deltaX,t.deltaY]},pR=function(t){return t&&"current"in t?t.current:t},jY=function(t,e){return t[0]===e[0]&&t[1]===e[1]},BY=function(t){return`
|
|
324
|
-
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
|
325
|
-
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
|
326
|
-
`)},$Y=0,Il=[];function VY(t){var e=R.useRef([]),n=R.useRef([0,0]),r=R.useRef(),i=R.useState($Y++)[0],s=R.useState(UL)[0],a=R.useRef(t);R.useEffect(function(){a.current=t},[t]),R.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var w=lY([t.lockRef.current],(t.shards||[]).map(pR),!0).filter(Boolean);return w.forEach(function(x){return x.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),w.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var c=R.useCallback(function(w,x){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!a.current.allowPinchZoom;var k=Ph(w),T=n.current,A="deltaX"in w?w.deltaX:T[0]-k[0],_="deltaY"in w?w.deltaY:T[1]-k[1],O,N=w.target,I=Math.abs(A)>Math.abs(_)?"h":"v";if("touches"in w&&I==="h"&&N.type==="range")return!1;var j=window.getSelection(),G=j&&j.anchorNode,Y=G?G===N||G.contains(N):!1;if(Y)return!1;var ce=fR(I,N);if(!ce)return!0;if(ce?O=I:(O=I==="v"?"h":"v",ce=fR(I,N)),!ce)return!1;if(!r.current&&"changedTouches"in w&&(A||_)&&(r.current=O),!O)return!0;var X=r.current||O;return PY(X,x,w,X==="h"?A:_)},[]),u=R.useCallback(function(w){var x=w;if(!(!Il.length||Il[Il.length-1]!==s)){var k="deltaY"in x?hR(x):Ph(x),T=e.current.filter(function(O){return O.name===x.type&&(O.target===x.target||x.target===O.shadowParent)&&jY(O.delta,k)})[0];if(T&&T.should){x.cancelable&&x.preventDefault();return}if(!T){var A=(a.current.shards||[]).map(pR).filter(Boolean).filter(function(O){return O.contains(x.target)}),_=A.length>0?c(x,A[0]):!a.current.noIsolation;_&&x.cancelable&&x.preventDefault()}}},[]),f=R.useCallback(function(w,x,k,T){var A={name:w,delta:x,target:k,should:T,shadowParent:HY(k)};e.current.push(A),setTimeout(function(){e.current=e.current.filter(function(_){return _!==A})},1)},[]),p=R.useCallback(function(w){n.current=Ph(w),r.current=void 0},[]),m=R.useCallback(function(w){f(w.type,hR(w),w.target,c(w,t.lockRef.current))},[]),g=R.useCallback(function(w){f(w.type,Ph(w),w.target,c(w,t.lockRef.current))},[]);R.useEffect(function(){return Il.push(s),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Dl),document.addEventListener("touchmove",u,Dl),document.addEventListener("touchstart",p,Dl),function(){Il=Il.filter(function(w){return w!==s}),document.removeEventListener("wheel",u,Dl),document.removeEventListener("touchmove",u,Dl),document.removeEventListener("touchstart",p,Dl)}},[]);var y=t.removeScrollBar,b=t.inert;return R.createElement(R.Fragment,null,b?R.createElement(s,{styles:BY(i)}):null,y?R.createElement(MY,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function HY(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const UY=yY(HL,VY);var WL=R.forwardRef(function(t,e){return R.createElement(Qm,bi({},t,{ref:e,sideCar:UY}))});WL.classNames=Qm.classNames;var FY=Object.defineProperty,kt=(t,e)=>FY(t,"name",{value:e,configurable:!0}),qY=[" ","Enter","ArrowUp","ArrowDown"],GY=[" ","Enter"],fc="Select",[eg,cx,WY]=nL(fc),[Ha,WJ]=gc(fc,[WY,ML]),ux=ML(),[KY,jo]=Ha(fc),[ZY,YY]=Ha(fc);function KL(t){const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:s,value:a,defaultValue:c,onValueChange:u,dir:f,name:p,autoComplete:m,disabled:g,required:y,form:b,internal_do_not_use_render:w}=t,x=ux(e),[k,T]=R.useState(null),[A,_]=R.useState(null),[O,N]=R.useState(!1),I=aL(f),[j,G]=wp({prop:r,defaultProp:i??!1,onChange:s,caller:fc}),[Y,ce]=wp({prop:a,defaultProp:c,onChange:u,caller:fc}),X=R.useRef(null),te=R.useRef(Y);R.useEffect(()=>{const K=b?k?.ownerDocument.getElementById(b):k?.form;if(K instanceof HTMLFormElement){const le=kt(()=>ce(te.current),"reset");return K.addEventListener("reset",le),()=>K.removeEventListener("reset",le)}},[b,k,ce]);const ie=k?!!b||!!k.closest("form"):!0,[he,B]=R.useState(new Set),Z=nx(),se=Array.from(he).map(K=>K.props.value).join(";"),Se=R.useCallback(K=>{B(le=>new Set(le).add(K))},[]),Ce=R.useCallback(K=>{B(le=>{const ve=new Set(le);return ve.delete(K),ve})},[]),z={required:y,trigger:k,onTriggerChange:T,valueNode:A,onValueNodeChange:_,valueNodeHasChildren:O,onValueNodeHasChildrenChange:N,contentId:Z,value:Y,onValueChange:ce,open:j,onOpenChange:G,dir:I,triggerPointerDownPosRef:X,disabled:g,name:p,autoComplete:m,form:b,nativeOptions:he,nativeSelectKey:se,isFormControl:ie};return E.jsx(WZ,{...x,children:E.jsx(KY,{scope:e,...z,children:E.jsx(eg.Provider,{scope:e,children:E.jsx(ZY,{scope:e,onNativeOptionAdd:Se,onNativeOptionRemove:Ce,children:XL(w)?w(z):n})})})})}kt(KL,"SelectProvider");var XY=kt(t=>{const{__scopeSelect:e,children:n,...r}=t;return E.jsx(KL,{__scopeSelect:e,...r,internal_do_not_use_render:({isFormControl:i})=>E.jsxs(E.Fragment,{children:[n,i?E.jsx(xX,{__scopeSelect:e}):null]})})},"Select"),JY="SelectTrigger",QY=R.forwardRef(kt(function(e,n){const{__scopeSelect:r,disabled:i=!1,...s}=e,a=ux(r),c=jo(JY,r),u=c.disabled||i,f=Xt(n,c.onTriggerChange),p=cx(r),m=R.useRef("touch"),[g,y,b]=dx(x=>{const k=p().filter(_=>!_.disabled),T=k.find(_=>_.value===c.value),A=fx(k,x,T);A!==void 0&&c.onValueChange(A.value)}),w=kt(x=>{u||(c.onOpenChange(!0),b()),x&&(c.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)})},"handleOpen");return E.jsx(KZ,{asChild:!0,...a,children:E.jsx(vn.button,{type:"button",role:"combobox","aria-controls":c.open?c.contentId:void 0,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":Ud(c.value)?"":void 0,...s,ref:f,onClick:on(s.onClick,x=>{x.currentTarget.focus(),m.current!=="mouse"&&w(x)}),onPointerDown:on(s.onPointerDown,x=>{m.current=x.pointerType;const k=x.target;k.hasPointerCapture(x.pointerId)&&k.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&x.pointerType==="mouse"&&(w(x),x.preventDefault())}),onKeyDown:on(s.onKeyDown,x=>{const k=g.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&y(x.key),!(k&&x.key===" ")&&qY.includes(x.key)&&(w(),x.preventDefault())})})})},"SelectTrigger")),eX="SelectValue",tX=R.forwardRef(kt(function(e,n){const{__scopeSelect:r,className:i,style:s,children:a,placeholder:c="",...u}=e,f=jo(eX,r),{onValueNodeHasChildrenChange:p}=f,m=a!==void 0,g=Xt(n,f.onValueNodeChange);Gn(()=>{p(m)},[p,m]);const y=Ud(f.value);return E.jsx(vn.span,{...u,asChild:y?!1:u.asChild,ref:g,style:{pointerEvents:"none"},children:E.jsx(R.Fragment,{children:y?c:a},y?"placeholder":"value")})},"SelectValue")),nX=R.forwardRef(kt(function(e,n){const{__scopeSelect:r,children:i,...s}=e;return E.jsx(vn.span,{"aria-hidden":!0,...s,ref:n,children:i||"▼"})},"SelectIcon")),rX="SelectPortal",[iX,sX]=Ha(rX,{forceMount:void 0}),oX=kt(t=>{const{__scopeSelect:e,forceMount:n,...r}=t;return E.jsx(iX,{scope:t.__scopeSelect,forceMount:n,children:E.jsx(JZ,{asChild:!0,...r})})},"SelectPortal"),Ia="SelectContent",aX=R.forwardRef(kt(function(e,n){const r=sX(Ia,e.__scopeSelect),{forceMount:i=r.forceMount,...s}=e,a=jo(Ia,e.__scopeSelect),[c,u]=R.useState();return Gn(()=>{u(new DocumentFragment)},[]),E.jsx(eY,{present:i||a.open,children:({present:f})=>f?E.jsx(uX,{...s,ref:n}):E.jsx(lX,{...s,fragment:c})})},"SelectContent")),lX=R.forwardRef(kt(function(e,n){const{__scopeSelect:r,children:i,fragment:s}=e;return s?pc.createPortal(E.jsx(ZL,{scope:r,children:E.jsx(eg.Slot,{scope:r,children:E.jsx("div",{ref:n,children:i})})}),s):null},"SelectContentFragment")),Yr=10,[ZL,tg]=Ha(Ia),cX=Ca("SelectContent.RemoveScroll"),uX=R.forwardRef(kt(function(e,n){const{__scopeSelect:r}=e,{position:i="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:c,side:u,sideOffset:f,align:p,alignOffset:m,arrowPadding:g,collisionBoundary:y,collisionPadding:b,sticky:w,hideWhenDetached:x,avoidCollisions:k,...T}=e,A=jo(Ia,r),[_,O]=R.useState(null),[N,I]=R.useState(null),j=Xt(n,O),[G,Y]=R.useState(null),[ce,X]=R.useState(null),te=cx(r),[ie,he]=R.useState(!1),B=R.useRef(!1);R.useEffect(()=>{if(_)return aY(_)},[_]),ex();const Z=R.useCallback(me=>{const[Ee,...it]=te().map(pt=>pt.ref.current),[Ke]=it.slice(-1),Qe=document.activeElement;for(const pt of me)if(pt===Qe||(pt?.scrollIntoView({block:"nearest"}),pt===Ee&&N&&(N.scrollTop=0),pt===Ke&&N&&(N.scrollTop=N.scrollHeight),pt?.focus(),document.activeElement!==Qe))return},[te,N]),se=R.useCallback(()=>Z([G,_]),[Z,G,_]);R.useEffect(()=>{ie&&se()},[ie,se]);const{onOpenChange:Se,triggerPointerDownPosRef:Ce}=A;R.useEffect(()=>{if(_){let me={x:0,y:0};const Ee=kt(Ke=>{me={x:Math.abs(Math.round(Ke.pageX)-(Ce.current?.x??0)),y:Math.abs(Math.round(Ke.pageY)-(Ce.current?.y??0))}},"handlePointerMove"),it=kt(Ke=>{me.x<=10&&me.y<=10?Ke.preventDefault():Ke.composedPath().includes(_)||Se(!1),document.removeEventListener("pointermove",Ee),Ce.current=null},"handlePointerUp");return Ce.current!==null&&(document.addEventListener("pointermove",Ee),document.addEventListener("pointerup",it,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Ee),document.removeEventListener("pointerup",it,{capture:!0})}}},[_,Se,Ce]),R.useEffect(()=>{const me=kt(()=>Se(!1),"close");return window.addEventListener("blur",me),window.addEventListener("resize",me),()=>{window.removeEventListener("blur",me),window.removeEventListener("resize",me)}},[Se]);const[z,K]=dx(me=>{const Ee=te().filter(Qe=>!Qe.disabled),it=Ee.find(Qe=>Qe.ref.current===document.activeElement),Ke=fx(Ee,me,it);Ke&&setTimeout(()=>Ke.ref.current?.focus())}),le=R.useCallback((me,Ee,it)=>{const Ke=!B.current&&!it;(A.value!==void 0&&A.value===Ee||Ke)&&(Y(me),Ke&&(B.current=!0))},[A.value]),ve=R.useCallback(()=>_?.focus(),[_]),Ae=R.useCallback((me,Ee,it)=>{const Ke=!B.current&&!it;(A.value!==void 0&&A.value===Ee||Ke)&&X(me)},[A.value]),de=i==="popper"?mR:dX,pe=de===mR?{side:u,sideOffset:f,align:p,alignOffset:m,arrowPadding:g,collisionBoundary:y,collisionPadding:b,sticky:w,hideWhenDetached:x,avoidCollisions:k}:{};return E.jsx(ZL,{scope:r,content:_,viewport:N,onViewportChange:I,itemRefCallback:le,selectedItem:G,onItemLeave:ve,itemTextRefCallback:Ae,focusSelectedItem:se,selectedItemText:ce,position:i,isPositioned:ie,searchRef:z,children:E.jsx(WL,{as:cX,allowPinchZoom:!0,children:E.jsx(RK,{asChild:!0,trapped:A.open,onMountAutoFocus:me=>{me.preventDefault()},onUnmountAutoFocus:on(s,me=>{A.trigger?.focus({preventScroll:!0}),me.preventDefault()}),children:E.jsx(kK,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:me=>me.preventDefault(),onDismiss:()=>A.onOpenChange(!1),children:E.jsx(de,{role:"listbox",id:A.contentId,"data-state":A.open?"open":"closed",dir:A.dir,onContextMenu:me=>me.preventDefault(),...T,...pe,onPlaced:()=>he(!0),ref:j,style:{display:"flex",flexDirection:"column",outline:"none",...T.style},onKeyDown:on(T.onKeyDown,me=>{const Ee=me.ctrlKey||me.altKey||me.metaKey;if(me.key==="Tab"&&me.preventDefault(),!Ee&&me.key.length===1&&K(me.key),["ArrowUp","ArrowDown","Home","End"].includes(me.key)){let Ke=te().filter(Qe=>!Qe.disabled).map(Qe=>Qe.ref.current);if(["ArrowUp","End"].includes(me.key)&&(Ke=Ke.slice().reverse()),["ArrowUp","ArrowDown"].includes(me.key)){const Qe=me.target,pt=Ke.indexOf(Qe);Ke=Ke.slice(pt+1)}setTimeout(()=>Z(Ke)),me.preventDefault()}})})})})})})},"SelectContentImpl")),dX=R.forwardRef(kt(function(e,n){const{__scopeSelect:r,onPlaced:i,...s}=e,a=jo(Ia,r),c=tg(Ia,r),[u,f]=R.useState(null),[p,m]=R.useState(null),g=Xt(n,m),y=cx(r),b=R.useRef(!1),w=R.useRef(!0),{viewport:x,selectedItem:k,selectedItemText:T,focusSelectedItem:A}=c,_=R.useCallback(()=>{if(a.trigger&&a.valueNode&&u&&p&&x&&k&&T){const j=a.trigger.getBoundingClientRect(),G=p.getBoundingClientRect(),Y=a.valueNode.getBoundingClientRect(),ce=T.getBoundingClientRect();if(a.dir!=="rtl"){const Qe=ce.left-G.left,pt=Y.left-Qe,$t=j.left-pt,Wt=j.width+$t,Hr=Math.max(Wt,G.width),Ur=window.innerWidth-Yr,Fr=X0(pt,[Yr,Math.max(Yr,Ur-Hr)]);u.style.minWidth=Wt+"px",u.style.left=Fr+"px"}else{const Qe=G.right-ce.right,pt=window.innerWidth-Y.right-Qe,$t=window.innerWidth-j.right-pt,Wt=j.width+$t,Hr=Math.max(Wt,G.width),Ur=window.innerWidth-Yr,Fr=X0(pt,[Yr,Math.max(Yr,Ur-Hr)]);u.style.minWidth=Wt+"px",u.style.right=Fr+"px"}const X=y(),te=window.innerHeight-Yr*2,ie=x.scrollHeight,he=window.getComputedStyle(p),B=parseInt(he.borderTopWidth,10),Z=parseInt(he.paddingTop,10),se=parseInt(he.borderBottomWidth,10),Se=parseInt(he.paddingBottom,10),Ce=B+Z+ie+Se+se,z=Math.min(k.offsetHeight*5,Ce),K=window.getComputedStyle(x),le=parseInt(K.paddingTop,10),ve=parseInt(K.paddingBottom,10),Ae=j.top+j.height/2-Yr,de=te-Ae,pe=k.offsetHeight/2,me=k.offsetTop+pe,Ee=B+Z+me,it=Ce-Ee;if(Ee<=Ae){const Qe=X.length>0&&k===X[X.length-1].ref.current;u.style.bottom="0px";const pt=p.clientHeight-x.offsetTop-x.offsetHeight,$t=Math.max(de,pe+(Qe?ve:0)+pt+se),Wt=Ee+$t;u.style.height=Wt+"px"}else{const Qe=X.length>0&&k===X[0].ref.current;u.style.top="0px";const $t=Math.max(Ae,B+x.offsetTop+(Qe?le:0)+pe)+it;u.style.height=$t+"px",x.scrollTop=Ee-Ae+x.offsetTop}u.style.margin=`${Yr}px 0`,u.style.minHeight=z+"px",u.style.maxHeight=te+"px",i?.(),requestAnimationFrame(()=>b.current=!0)}},[y,a.trigger,a.valueNode,u,p,x,k,T,a.dir,i]);Gn(()=>_(),[_]);const[O,N]=R.useState();Gn(()=>{p&&N(window.getComputedStyle(p).zIndex)},[p]);const I=R.useCallback(j=>{j&&w.current===!0&&(_(),A?.(),w.current=!1)},[_,A]);return E.jsx(fX,{scope:r,contentWrapper:u,shouldExpandOnScrollRef:b,onScrollButtonChange:I,children:E.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:O},children:E.jsx(vn.div,{...s,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})},"SelectItemAlignedPosition")),mR=R.forwardRef(kt(function(e,n){const{__scopeSelect:r,align:i="start",collisionPadding:s=Yr,...a}=e,c=ux(r);return E.jsx(ZZ,{...c,...a,ref:n,align:i,collisionPadding:s,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})},"SelectPopperPosition")),[fX,hX]=Ha(Ia,{}),gR="SelectViewport",pX=R.forwardRef(kt(function(e,n){const{__scopeSelect:r,nonce:i,...s}=e,a=tg(gR,r),c=hX(gR,r),u=Xt(n,a.onViewportChange),f=R.useRef(0);return E.jsxs(E.Fragment,{children:[E.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),E.jsx(eg.Slot,{scope:r,children:E.jsx(vn.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:on(s.onScroll,p=>{const m=p.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:y}=c;if(y?.current&&g){const b=Math.abs(f.current-m.scrollTop);if(b>0){const w=window.innerHeight-Yr*2,x=parseFloat(g.style.minHeight),k=parseFloat(g.style.height),T=Math.max(x,k);if(T<w){const A=T+b,_=Math.min(w,A),O=A-_;g.style.height=_+"px",g.style.bottom==="0px"&&(m.scrollTop=O>0?O:0,g.style.justifyContent="flex-end")}}}f.current=m.scrollTop})})})]})},"SelectViewport")),mX="SelectGroup",[KJ,ZJ]=Ha(mX),lS="SelectItem",[gX,YL]=Ha(lS),yX=R.forwardRef(kt(function(e,n){const{__scopeSelect:r,value:i,disabled:s=!1,textValue:a,...c}=e,u=jo(lS,r),f=tg(lS,r),p=u.value===i,[m,g]=R.useState(a??""),[y,b]=R.useState(!1),w=Ci(_=>f.itemRefCallback?.(_,i,s)),x=Xt(n,w),k=nx(),T=R.useRef("touch"),A=kt(()=>{s||(u.onValueChange(i),u.onOpenChange(!1))},"handleSelect");return E.jsx(gX,{scope:r,value:i,disabled:s,textId:k,isSelected:p,onItemTextChange:R.useCallback(_=>{g(O=>O||(_?.textContent??"").trim())},[]),children:E.jsx(eg.ItemSlot,{scope:r,value:i,disabled:s,textValue:m,children:E.jsx(vn.div,{role:"option","aria-labelledby":k,"data-highlighted":y?"":void 0,"aria-selected":p&&y,"data-state":p?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...c,ref:x,onFocus:on(c.onFocus,()=>b(!0)),onBlur:on(c.onBlur,()=>b(!1)),onClick:on(c.onClick,()=>{T.current!=="mouse"&&A()}),onPointerUp:on(c.onPointerUp,()=>{T.current==="mouse"&&A()}),onPointerDown:on(c.onPointerDown,_=>{T.current=_.pointerType}),onPointerMove:on(c.onPointerMove,_=>{T.current=_.pointerType,s?f.onItemLeave?.():T.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:on(c.onPointerLeave,_=>{_.currentTarget===document.activeElement&&f.onItemLeave?.()}),onKeyDown:on(c.onKeyDown,_=>{s||_.target!==_.currentTarget||f.searchRef?.current!==""&&_.key===" "||(GY.includes(_.key)&&A(),_.key===" "&&_.preventDefault())})})})})},"SelectItem")),jh="SelectItemText",vX=R.forwardRef(kt(function(e,n){const{__scopeSelect:r,className:i,style:s,...a}=e,c=jo(jh,r),u=tg(jh,r),f=YL(jh,r),p=YY(jh,r),[m,g]=R.useState(null),y=Ci(A=>u.itemTextRefCallback?.(A,f.value,f.disabled)),b=Xt(n,g,f.onItemTextChange,y),w=m?.textContent,x=R.useMemo(()=>E.jsx("option",{value:f.value,disabled:f.disabled,children:w},f.value),[f.disabled,f.value,w]),{onNativeOptionAdd:k,onNativeOptionRemove:T}=p;return Gn(()=>(k(x),()=>T(x)),[k,T,x]),E.jsxs(E.Fragment,{children:[E.jsx(vn.span,{id:f.textId,...a,ref:b}),f.isSelected&&c.valueNode&&!c.valueNodeHasChildren&&!Ud(c.value)?pc.createPortal(a.children,c.valueNode):null]})},"SelectItemText")),bX="SelectItemIndicator",SX=R.forwardRef(kt(function(e,n){const{__scopeSelect:r,...i}=e;return YL(bX,r).isSelected?E.jsx(vn.span,{"aria-hidden":!0,...i,ref:n}):null},"SelectItemIndicator")),wX="SelectBubbleInput",xX=R.forwardRef(kt(function({__scopeSelect:e,...n},r){const i=jo(wX,e),{value:s,onValueChange:a,required:c,disabled:u,name:f,autoComplete:p,form:m}=i,{nativeOptions:g,nativeSelectKey:y}=i,b=R.useRef(null),w=Xt(r,b),x=s??"",k=jL(x),T=Array.from(g).some(A=>(A.props.value??"")==="");return R.useEffect(()=>{const A=b.current;if(!A)return;const _=window.HTMLSelectElement.prototype,N=Object.getOwnPropertyDescriptor(_,"value").set;if(k!==x&&N){const I=new Event("change",{bubbles:!0});N.call(A,x),A.dispatchEvent(I)}},[k,x]),E.jsxs(vn.select,{"aria-hidden":!0,required:c,tabIndex:-1,name:f,autoComplete:p,disabled:u,form:m,onChange:A=>a(A.target.value),...n,style:{...rY,...n.style},ref:w,defaultValue:x,children:[Ud(s)&&!T?E.jsx("option",{value:""}):null,Array.from(g)]},y)},"SelectBubbleInput"));function XL(t){return typeof t=="function"}kt(XL,"isFunction");function Ud(t){return t===""||t===void 0}kt(Ud,"shouldShowPlaceholder");function dx(t){const e=Ci(t),n=R.useRef(""),r=R.useRef(0),i=R.useCallback(a=>{const c=n.current+a;e(c),kt((function u(f){n.current=f,window.clearTimeout(r.current),f!==""&&(r.current=window.setTimeout(()=>u(""),1e3))}),"updateSearch")(c)},[e]),s=R.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return R.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}kt(dx,"useTypeaheadSearch");function fx(t,e,n){const i=e.length>1&&Array.from(e).every(f=>f===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let a=JL(t,Math.max(s,0));i.length===1&&(a=a.filter(f=>f!==n));const u=a.find(f=>f.textValue.toLowerCase().startsWith(i.toLowerCase()));return u!==n?u:void 0}kt(fx,"findNextItem");function JL(t,e){return t.map((n,r)=>t[(e+r)%t.length])}kt(JL,"wrapArray");function kX({environments:t,value:e,onChange:n}){const r=t.find(i=>i.id===e);return E.jsxs(XY,{value:e,onValueChange:n,children:[E.jsxs(QY,{className:"vertebr-select-trigger","aria-label":"Environment","data-tone":r?.tone??"neutral",children:[E.jsxs("span",{className:"vertebr-select-value",children:[E.jsx("span",{className:"vertebr-select-dot","data-tone":r?.tone??"neutral"}),E.jsx(tX,{placeholder:"Select environment"})]}),E.jsx(nX,{className:"vertebr-select-icon",children:E.jsx(CX,{})})]}),E.jsx(oX,{children:E.jsx(aX,{className:"vertebr-select-content",position:"popper",sideOffset:6,children:E.jsx(pX,{className:"vertebr-select-viewport",children:t.map(i=>E.jsxs(yX,{value:i.id,className:"vertebr-select-item","data-tone":i.tone??"neutral",children:[E.jsxs("span",{className:"vertebr-select-value",children:[E.jsx("span",{className:"vertebr-select-dot","data-tone":i.tone??"neutral"}),E.jsx(vX,{children:i.label})]}),i.auth?.required?E.jsx("span",{className:"vertebr-env-lock",children:"auth"}):null,E.jsx(SX,{className:"vertebr-select-check",children:E.jsx(EX,{})})]},i.id))})})})]})}function CX(){return E.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:E.jsx("path",{d:"M2.5 4.5 6 8l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function EX(){return E.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:E.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 TX({label:t="Gallery",items:e,accept:n,maxBytes:r,canDelete:i,loading:s,onRefresh:a,onUpload:c,onDelete:u}){const f={field:"gallery",accept:n,maxBytes:r};return E.jsxs("div",{className:"vertebr-gallery",children:[E.jsxs("div",{className:"vertebr-panel-head",children:[E.jsx("h2",{children:t}),E.jsxs("div",{className:"vertebr-gallery-head-actions",children:[E.jsx("span",{className:"vertebr-count",children:e.length}),a?E.jsx("button",{type:"button",className:"vertebr-btn",onClick:a,disabled:s,children:s?"Refreshing…":"Refresh"}):null]})]}),E.jsxs("div",{className:"vertebr-gallery-body",children:[E.jsx(Dd,{meta:f,multiple:!0,label:"Drop images here or browse to add to the gallery",onUpload:c}),e.length===0?E.jsx("div",{className:"vertebr-empty",children:"No images in the gallery yet."}):E.jsx("div",{className:"vertebr-gallery-grid",children:e.map(p=>E.jsxs("article",{className:"vertebr-gallery-card",children:[E.jsx("a",{className:"vertebr-gallery-thumb",href:p.url,target:"_blank",rel:"noreferrer",title:p.name??p.url,children:E.jsx("img",{src:p.url,alt:p.name??"",loading:"lazy"})}),E.jsxs("div",{className:"vertebr-gallery-meta",children:[E.jsx("strong",{title:p.name??p.id,children:p.name??p.id}),E.jsx("a",{href:p.url,target:"_blank",rel:"noreferrer",children:p.url.replace(/^https?:\/\//i,"")})]}),i&&u?E.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-danger-quiet",onClick:()=>{window.confirm("Delete this image from the gallery?")&&u(p.id)},children:"Delete"}):null]},p.id))})]})]})}function _X({label:t="Overview",metrics:e,onRefresh:n,loading:r}){return E.jsxs("div",{className:"vertebr-metrics",children:[E.jsxs("div",{className:"vertebr-panel-head",children:[E.jsx("h2",{children:t}),n?E.jsx("button",{type:"button",className:"vertebr-btn",onClick:n,disabled:r,children:r?"Refreshing…":"Refresh"}):null]}),e.length===0?E.jsx("div",{className:"vertebr-empty",children:"No metrics registered yet."}):E.jsx("div",{className:"vertebr-metrics-grid",children:e.map(i=>E.jsxs("article",{className:"vertebr-metric-card","data-tone":i.tone??"neutral",children:[E.jsx("p",{className:"vertebr-metric-label",children:i.label}),E.jsx("p",{className:"vertebr-metric-value",children:i.value}),i.hint?E.jsx("p",{className:"vertebr-metric-hint",children:i.hint}):null]},i.id))})]})}function ho(t,e){return typeof t=="function"?t(e):t}function xr(t,e){return n=>{e.setState(r=>({...r,[t]:ho(n,r[t])}))}}function ng(t){return t instanceof Function}function AX(t){return Array.isArray(t)&&t.every(e=>typeof e=="number")}function RX(t,e){const n=[],r=i=>{i.forEach(s=>{n.push(s);const a=e(s);a!=null&&a.length&&r(a)})};return r(t),n}function Ve(t,e,n){let r=[],i;return s=>{let a;n.key&&n.debug&&(a=Date.now());const c=t(s);if(!(c.length!==r.length||c.some((p,m)=>r[m]!==p)))return i;r=c;let f;if(n.key&&n.debug&&(f=Date.now()),i=e(...c),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){const p=Math.round((Date.now()-a)*100)/100,m=Math.round((Date.now()-f)*100)/100,g=m/16,y=(b,w)=>{for(b=String(b);b.length<w;)b=" "+b;return b};console.info(`%c⏱ ${y(m,5)} /${y(p,5)} ms`,`
|
|
327
|
-
font-size: .6rem;
|
|
328
|
-
font-weight: bold;
|
|
329
|
-
color: hsl(${Math.max(0,Math.min(120-120*g,120))}deg 100% 31%);`,n?.key)}return i}}function He(t,e,n,r){return{debug:()=>{var i;return(i=t?.debugAll)!=null?i:t[e]},key:!1,onChange:r}}function MX(t,e,n,r){const i=()=>{var a;return(a=s.getValue())!=null?a:t.options.renderFallbackValue},s={id:`${e.id}_${n.id}`,row:e,column:n,getValue:()=>e.getValue(r),renderValue:i,getContext:Ve(()=>[t,n,e,s],(a,c,u,f)=>({table:a,column:c,row:u,cell:f,getValue:f.getValue,renderValue:f.renderValue}),He(t.options,"debugCells"))};return t._features.forEach(a=>{a.createCell==null||a.createCell(s,n,e,t)},{}),s}function OX(t,e,n,r){var i,s;const c={...t._getDefaultColumnDef(),...e},u=c.accessorKey;let f=(i=(s=c.id)!=null?s:u?typeof String.prototype.replaceAll=="function"?u.replaceAll(".","_"):u.replace(/\./g,"_"):void 0)!=null?i:typeof c.header=="string"?c.header:void 0,p;if(c.accessorFn?p=c.accessorFn:u&&(u.includes(".")?p=g=>{let y=g;for(const w of u.split(".")){var b;y=(b=y)==null?void 0:b[w]}return y}:p=g=>g[c.accessorKey]),!f)throw new Error;let m={id:`${String(f)}`,accessorFn:p,parent:r,depth:n,columnDef:c,columns:[],getFlatColumns:Ve(()=>[!0],()=>{var g;return[m,...(g=m.columns)==null?void 0:g.flatMap(y=>y.getFlatColumns())]},He(t.options,"debugColumns")),getLeafColumns:Ve(()=>[t._getOrderColumnsFn()],g=>{var y;if((y=m.columns)!=null&&y.length){let b=m.columns.flatMap(w=>w.getLeafColumns());return g(b)}return[m]},He(t.options,"debugColumns"))};for(const g of t._features)g.createColumn==null||g.createColumn(m,t);return m}const Ln="debugHeaders";function yR(t,e,n){var r;let s={id:(r=n.id)!=null?r:e.id,column:e,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const a=[],c=u=>{u.subHeaders&&u.subHeaders.length&&u.subHeaders.map(c),a.push(u)};return c(s),a},getContext:()=>({table:t,header:s,column:e})};return t._features.forEach(a=>{a.createHeader==null||a.createHeader(s,t)}),s}const NX={createTable:t=>{t.getHeaderGroups=Ve(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,r,i)=>{var s,a;const c=(s=r?.map(m=>n.find(g=>g.id===m)).filter(Boolean))!=null?s:[],u=(a=i?.map(m=>n.find(g=>g.id===m)).filter(Boolean))!=null?a:[],f=n.filter(m=>!(r!=null&&r.includes(m.id))&&!(i!=null&&i.includes(m.id)));return Bh(e,[...c,...f,...u],t)},He(t.options,Ln)),t.getCenterHeaderGroups=Ve(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,r,i)=>(n=n.filter(s=>!(r!=null&&r.includes(s.id))&&!(i!=null&&i.includes(s.id))),Bh(e,n,t,"center")),He(t.options,Ln)),t.getLeftHeaderGroups=Ve(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left],(e,n,r)=>{var i;const s=(i=r?.map(a=>n.find(c=>c.id===a)).filter(Boolean))!=null?i:[];return Bh(e,s,t,"left")},He(t.options,Ln)),t.getRightHeaderGroups=Ve(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.right],(e,n,r)=>{var i;const s=(i=r?.map(a=>n.find(c=>c.id===a)).filter(Boolean))!=null?i:[];return Bh(e,s,t,"right")},He(t.options,Ln)),t.getFooterGroups=Ve(()=>[t.getHeaderGroups()],e=>[...e].reverse(),He(t.options,Ln)),t.getLeftFooterGroups=Ve(()=>[t.getLeftHeaderGroups()],e=>[...e].reverse(),He(t.options,Ln)),t.getCenterFooterGroups=Ve(()=>[t.getCenterHeaderGroups()],e=>[...e].reverse(),He(t.options,Ln)),t.getRightFooterGroups=Ve(()=>[t.getRightHeaderGroups()],e=>[...e].reverse(),He(t.options,Ln)),t.getFlatHeaders=Ve(()=>[t.getHeaderGroups()],e=>e.map(n=>n.headers).flat(),He(t.options,Ln)),t.getLeftFlatHeaders=Ve(()=>[t.getLeftHeaderGroups()],e=>e.map(n=>n.headers).flat(),He(t.options,Ln)),t.getCenterFlatHeaders=Ve(()=>[t.getCenterHeaderGroups()],e=>e.map(n=>n.headers).flat(),He(t.options,Ln)),t.getRightFlatHeaders=Ve(()=>[t.getRightHeaderGroups()],e=>e.map(n=>n.headers).flat(),He(t.options,Ln)),t.getCenterLeafHeaders=Ve(()=>[t.getCenterFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),He(t.options,Ln)),t.getLeftLeafHeaders=Ve(()=>[t.getLeftFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),He(t.options,Ln)),t.getRightLeafHeaders=Ve(()=>[t.getRightFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),He(t.options,Ln)),t.getLeafHeaders=Ve(()=>[t.getLeftHeaderGroups(),t.getCenterHeaderGroups(),t.getRightHeaderGroups()],(e,n,r)=>{var i,s,a,c,u,f;return[...(i=(s=e[0])==null?void 0:s.headers)!=null?i:[],...(a=(c=n[0])==null?void 0:c.headers)!=null?a:[],...(u=(f=r[0])==null?void 0:f.headers)!=null?u:[]].map(p=>p.getLeafHeaders()).flat()},He(t.options,Ln))}};function Bh(t,e,n,r){var i,s;let a=0;const c=function(g,y){y===void 0&&(y=1),a=Math.max(a,y),g.filter(b=>b.getIsVisible()).forEach(b=>{var w;(w=b.columns)!=null&&w.length&&c(b.columns,y+1)},0)};c(t);let u=[];const f=(g,y)=>{const b={depth:y,id:[r,`${y}`].filter(Boolean).join("_"),headers:[]},w=[];g.forEach(x=>{const k=[...w].reverse()[0],T=x.column.depth===b.depth;let A,_=!1;if(T&&x.column.parent?A=x.column.parent:(A=x.column,_=!0),k&&k?.column===A)k.subHeaders.push(x);else{const O=yR(n,A,{id:[r,y,A.id,x?.id].filter(Boolean).join("_"),isPlaceholder:_,placeholderId:_?`${w.filter(N=>N.column===A).length}`:void 0,depth:y,index:w.length});O.subHeaders.push(x),w.push(O)}b.headers.push(x),x.headerGroup=b}),u.push(b),y>0&&f(w,y-1)},p=e.map((g,y)=>yR(n,g,{depth:a,index:y}));f(p,a-1),u.reverse();const m=g=>g.filter(b=>b.column.getIsVisible()).map(b=>{let w=0,x=0,k=[0];b.subHeaders&&b.subHeaders.length?(k=[],m(b.subHeaders).forEach(A=>{let{colSpan:_,rowSpan:O}=A;w+=_,k.push(O)})):w=1;const T=Math.min(...k);return x=x+T,b.colSpan=w,b.rowSpan=x,{colSpan:w,rowSpan:x}});return m((i=(s=u[0])==null?void 0:s.headers)!=null?i:[]),u}const DX=(t,e,n,r,i,s,a)=>{let c={id:e,index:r,original:n,depth:i,parentId:a,_valuesCache:{},_uniqueValuesCache:{},getValue:u=>{if(c._valuesCache.hasOwnProperty(u))return c._valuesCache[u];const f=t.getColumn(u);if(f!=null&&f.accessorFn)return c._valuesCache[u]=f.accessorFn(c.original,r),c._valuesCache[u]},getUniqueValues:u=>{if(c._uniqueValuesCache.hasOwnProperty(u))return c._uniqueValuesCache[u];const f=t.getColumn(u);if(f!=null&&f.accessorFn)return f.columnDef.getUniqueValues?(c._uniqueValuesCache[u]=f.columnDef.getUniqueValues(c.original,r),c._uniqueValuesCache[u]):(c._uniqueValuesCache[u]=[c.getValue(u)],c._uniqueValuesCache[u])},renderValue:u=>{var f;return(f=c.getValue(u))!=null?f:t.options.renderFallbackValue},subRows:[],getLeafRows:()=>RX(c.subRows,u=>u.subRows),getParentRow:()=>c.parentId?t.getRow(c.parentId,!0):void 0,getParentRows:()=>{let u=[],f=c;for(;;){const p=f.getParentRow();if(!p)break;u.push(p),f=p}return u.reverse()},getAllCells:Ve(()=>[t.getAllLeafColumns()],u=>u.map(f=>MX(t,c,f,f.id)),He(t.options,"debugRows")),_getAllCellsByColumnId:Ve(()=>[c.getAllCells()],u=>u.reduce((f,p)=>(f[p.column.id]=p,f),{}),He(t.options,"debugRows"))};for(let u=0;u<t._features.length;u++){const f=t._features[u];f==null||f.createRow==null||f.createRow(c,t)}return c},IX={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()}}},QL=(t,e,n)=>{var r,i;const s=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((i=t.getValue(e))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(s))};QL.autoRemove=t=>oi(t);const e2=(t,e,n)=>{var r;return!!(!((r=t.getValue(e))==null||(r=r.toString())==null)&&r.includes(n))};e2.autoRemove=t=>oi(t);const t2=(t,e,n)=>{var r;return((r=t.getValue(e))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};t2.autoRemove=t=>oi(t);const n2=(t,e,n)=>{var r;return(r=t.getValue(e))==null?void 0:r.includes(n)};n2.autoRemove=t=>oi(t);const r2=(t,e,n)=>!n.some(r=>{var i;return!((i=t.getValue(e))!=null&&i.includes(r))});r2.autoRemove=t=>oi(t)||!(t!=null&&t.length);const i2=(t,e,n)=>n.some(r=>{var i;return(i=t.getValue(e))==null?void 0:i.includes(r)});i2.autoRemove=t=>oi(t)||!(t!=null&&t.length);const s2=(t,e,n)=>t.getValue(e)===n;s2.autoRemove=t=>oi(t);const o2=(t,e,n)=>t.getValue(e)==n;o2.autoRemove=t=>oi(t);const hx=(t,e,n)=>{let[r,i]=n;const s=t.getValue(e);return s>=r&&s<=i};hx.resolveFilterValue=t=>{let[e,n]=t,r=typeof e!="number"?parseFloat(e):e,i=typeof n!="number"?parseFloat(n):n,s=e===null||Number.isNaN(r)?-1/0:r,a=n===null||Number.isNaN(i)?1/0:i;if(s>a){const c=s;s=a,a=c}return[s,a]};hx.autoRemove=t=>oi(t)||oi(t[0])&&oi(t[1]);const es={includesString:QL,includesStringSensitive:e2,equalsString:t2,arrIncludes:n2,arrIncludesAll:r2,arrIncludesSome:i2,equals:s2,weakEquals:o2,inNumberRange:hx};function oi(t){return t==null||t===""}const LX={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:t=>({columnFilters:[],...t}),getDefaultOptions:t=>({onColumnFiltersChange:xr("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"?es.includesString:typeof r=="number"?es.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?es.equals:Array.isArray(r)?es.arrIncludes:es.weakEquals},t.getFilterFn=()=>{var n,r;return ng(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:es[t.columnDef.filterFn]},t.getCanFilter=()=>{var n,r,i;return((n=t.columnDef.enableColumnFilter)!=null?n:!0)&&((r=e.options.enableColumnFilters)!=null?r:!0)&&((i=e.options.enableFilters)!=null?i:!0)&&!!t.accessorFn},t.getIsFiltered=()=>t.getFilterIndex()>-1,t.getFilterValue=()=>{var n;return(n=e.getState().columnFilters)==null||(n=n.find(r=>r.id===t.id))==null?void 0:n.value},t.getFilterIndex=()=>{var n,r;return(n=(r=e.getState().columnFilters)==null?void 0:r.findIndex(i=>i.id===t.id))!=null?n:-1},t.setFilterValue=n=>{e.setColumnFilters(r=>{const i=t.getFilterFn(),s=r?.find(p=>p.id===t.id),a=ho(n,s?s.value:void 0);if(vR(i,a,t)){var c;return(c=r?.filter(p=>p.id!==t.id))!=null?c:[]}const u={id:t.id,value:a};if(s){var f;return(f=r?.map(p=>p.id===t.id?u:p))!=null?f:[]}return r!=null&&r.length?[...r,u]:[u]})}},createRow:(t,e)=>{t.columnFilters={},t.columnFiltersMeta={}},createTable:t=>{t.setColumnFilters=e=>{const n=t.getAllLeafColumns(),r=i=>{var s;return(s=ho(e,i))==null?void 0:s.filter(a=>{const c=n.find(u=>u.id===a.id);if(c){const u=c.getFilterFn();if(vR(u,a.value,c))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 vR(t,e,n){return(t&&t.autoRemove?t.autoRemove(e,n):!1)||typeof e>"u"||typeof e=="string"&&!e}const zX=(t,e,n)=>n.reduce((r,i)=>{const s=i.getValue(t);return r+(typeof s=="number"?s:0)},0),PX=(t,e,n)=>{let r;return n.forEach(i=>{const s=i.getValue(t);s!=null&&(r>s||r===void 0&&s>=s)&&(r=s)}),r},jX=(t,e,n)=>{let r;return n.forEach(i=>{const s=i.getValue(t);s!=null&&(r<s||r===void 0&&s>=s)&&(r=s)}),r},BX=(t,e,n)=>{let r,i;return n.forEach(s=>{const a=s.getValue(t);a!=null&&(r===void 0?a>=a&&(r=i=a):(r>a&&(r=a),i<a&&(i=a)))}),[r,i]},$X=(t,e)=>{let n=0,r=0;if(e.forEach(i=>{let s=i.getValue(t);s!=null&&(s=+s)>=s&&(++n,r+=s)}),n)return r/n},VX=(t,e)=>{if(!e.length)return;const n=e.map(s=>s.getValue(t));if(!AX(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),i=n.sort((s,a)=>s-a);return n.length%2!==0?i[r]:(i[r-1]+i[r])/2},HX=(t,e)=>Array.from(new Set(e.map(n=>n.getValue(t))).values()),UX=(t,e)=>new Set(e.map(n=>n.getValue(t))).size,FX=(t,e)=>e.length,kb={sum:zX,min:PX,max:jX,extent:BX,mean:$X,median:VX,unique:HX,uniqueCount:UX,count:FX},qX={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:xr("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 kb.sum;if(Object.prototype.toString.call(r)==="[object Date]")return kb.extent},t.getAggregationFn=()=>{var n,r;if(!t)throw new Error;return ng(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:kb[t.columnDef.aggregationFn]}},createTable:t=>{t.setGrouping=e=>t.options.onGroupingChange==null?void 0:t.options.onGroupingChange(e),t.resetGrouping=e=>{var n,r;t.setGrouping(e?[]:(n=(r=t.initialState)==null?void 0:r.grouping)!=null?n:[])},t.getPreGroupedRowModel=()=>t.getFilteredRowModel(),t.getGroupedRowModel=()=>(!t._getGroupedRowModel&&t.options.getGroupedRowModel&&(t._getGroupedRowModel=t.options.getGroupedRowModel(t)),t.options.manualGrouping||!t._getGroupedRowModel?t.getPreGroupedRowModel():t._getGroupedRowModel())},createRow:(t,e)=>{t.getIsGrouped=()=>!!t.groupingColumnId,t.getGroupingValue=n=>{if(t._groupingValuesCache.hasOwnProperty(n))return t._groupingValuesCache[n];const r=e.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(t._groupingValuesCache[n]=r.columnDef.getGroupingValue(t.original),t._groupingValuesCache[n]):t.getValue(n)},t._groupingValuesCache={}},createCell:(t,e,n,r)=>{t.getIsGrouped=()=>e.getIsGrouped()&&e.id===n.groupingColumnId,t.getIsPlaceholder=()=>!t.getIsGrouped()&&e.getIsGrouped(),t.getIsAggregated=()=>{var i;return!t.getIsGrouped()&&!t.getIsPlaceholder()&&!!((i=n.subRows)!=null&&i.length)}}};function GX(t,e,n){if(!(e!=null&&e.length)||!n)return t;const r=t.filter(s=>!e.includes(s.id));return n==="remove"?r:[...e.map(s=>t.find(a=>a.id===s)).filter(Boolean),...r]}const WX={getInitialState:t=>({columnOrder:[],...t}),getDefaultOptions:t=>({onColumnOrderChange:xr("columnOrder",t)}),createColumn:(t,e)=>{t.getIndex=Ve(n=>[Qu(e,n)],n=>n.findIndex(r=>r.id===t.id),He(e.options,"debugColumns")),t.getIsFirstColumn=n=>{var r;return((r=Qu(e,n)[0])==null?void 0:r.id)===t.id},t.getIsLastColumn=n=>{var r;const i=Qu(e,n);return((r=i[i.length-1])==null?void 0:r.id)===t.id}},createTable:t=>{t.setColumnOrder=e=>t.options.onColumnOrderChange==null?void 0:t.options.onColumnOrderChange(e),t.resetColumnOrder=e=>{var n;t.setColumnOrder(e?[]:(n=t.initialState.columnOrder)!=null?n:[])},t._getOrderColumnsFn=Ve(()=>[t.getState().columnOrder,t.getState().grouping,t.options.groupedColumnMode],(e,n,r)=>i=>{let s=[];if(!(e!=null&&e.length))s=i;else{const a=[...e],c=[...i];for(;c.length&&a.length;){const u=a.shift(),f=c.findIndex(p=>p.id===u);f>-1&&s.push(c.splice(f,1)[0])}s=[...s,...c]}return GX(s,n,r)},He(t.options,"debugTable"))}},Cb=()=>({left:[],right:[]}),KX={getInitialState:t=>({columnPinning:Cb(),...t}),getDefaultOptions:t=>({onColumnPinningChange:xr("columnPinning",t)}),createColumn:(t,e)=>{t.pin=n=>{const r=t.getLeafColumns().map(i=>i.id).filter(Boolean);e.setColumnPinning(i=>{var s,a;if(n==="right"){var c,u;return{left:((c=i?.left)!=null?c:[]).filter(m=>!(r!=null&&r.includes(m))),right:[...((u=i?.right)!=null?u:[]).filter(m=>!(r!=null&&r.includes(m))),...r]}}if(n==="left"){var f,p;return{left:[...((f=i?.left)!=null?f:[]).filter(m=>!(r!=null&&r.includes(m))),...r],right:((p=i?.right)!=null?p:[]).filter(m=>!(r!=null&&r.includes(m)))}}return{left:((s=i?.left)!=null?s:[]).filter(m=>!(r!=null&&r.includes(m))),right:((a=i?.right)!=null?a:[]).filter(m=>!(r!=null&&r.includes(m)))}})},t.getCanPin=()=>t.getLeafColumns().some(r=>{var i,s,a;return((i=r.columnDef.enablePinning)!=null?i:!0)&&((s=(a=e.options.enableColumnPinning)!=null?a:e.options.enablePinning)!=null?s:!0)}),t.getIsPinned=()=>{const n=t.getLeafColumns().map(c=>c.id),{left:r,right:i}=e.getState().columnPinning,s=n.some(c=>r?.includes(c)),a=n.some(c=>i?.includes(c));return s?"left":a?"right":!1},t.getPinnedIndex=()=>{var n,r;const i=t.getIsPinned();return i?(n=(r=e.getState().columnPinning)==null||(r=r[i])==null?void 0:r.indexOf(t.id))!=null?n:-1:0}},createRow:(t,e)=>{t.getCenterVisibleCells=Ve(()=>[t._getAllVisibleCells(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,r,i)=>{const s=[...r??[],...i??[]];return n.filter(a=>!s.includes(a.column.id))},He(e.options,"debugRows")),t.getLeftVisibleCells=Ve(()=>[t._getAllVisibleCells(),e.getState().columnPinning.left],(n,r)=>(r??[]).map(s=>n.find(a=>a.column.id===s)).filter(Boolean).map(s=>({...s,position:"left"})),He(e.options,"debugRows")),t.getRightVisibleCells=Ve(()=>[t._getAllVisibleCells(),e.getState().columnPinning.right],(n,r)=>(r??[]).map(s=>n.find(a=>a.column.id===s)).filter(Boolean).map(s=>({...s,position:"right"})),He(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?Cb():(n=(r=t.initialState)==null?void 0:r.columnPinning)!=null?n:Cb())},t.getIsSomeColumnsPinned=e=>{var n;const r=t.getState().columnPinning;if(!e){var i,s;return!!((i=r.left)!=null&&i.length||(s=r.right)!=null&&s.length)}return!!((n=r[e])!=null&&n.length)},t.getLeftLeafColumns=Ve(()=>[t.getAllLeafColumns(),t.getState().columnPinning.left],(e,n)=>(n??[]).map(r=>e.find(i=>i.id===r)).filter(Boolean),He(t.options,"debugColumns")),t.getRightLeafColumns=Ve(()=>[t.getAllLeafColumns(),t.getState().columnPinning.right],(e,n)=>(n??[]).map(r=>e.find(i=>i.id===r)).filter(Boolean),He(t.options,"debugColumns")),t.getCenterLeafColumns=Ve(()=>[t.getAllLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,r)=>{const i=[...n??[],...r??[]];return e.filter(s=>!i.includes(s.id))},He(t.options,"debugColumns"))}};function ZX(t){return t||(typeof document<"u"?document:null)}const $h={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Eb=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),YX={getDefaultColumnDef:()=>$h,getInitialState:t=>({columnSizing:{},columnSizingInfo:Eb(),...t}),getDefaultOptions:t=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:xr("columnSizing",t),onColumnSizingInfoChange:xr("columnSizingInfo",t)}),createColumn:(t,e)=>{t.getSize=()=>{var n,r,i;const s=e.getState().columnSizing[t.id];return Math.min(Math.max((n=t.columnDef.minSize)!=null?n:$h.minSize,(r=s??t.columnDef.size)!=null?r:$h.size),(i=t.columnDef.maxSize)!=null?i:$h.maxSize)},t.getStart=Ve(n=>[n,Qu(e,n),e.getState().columnSizing],(n,r)=>r.slice(0,t.getIndex(n)).reduce((i,s)=>i+s.getSize(),0),He(e.options,"debugColumns")),t.getAfter=Ve(n=>[n,Qu(e,n),e.getState().columnSizing],(n,r)=>r.slice(t.getIndex(n)+1).reduce((i,s)=>i+s.getSize(),0),He(e.options,"debugColumns")),t.resetSize=()=>{e.setColumnSizing(n=>{let{[t.id]:r,...i}=n;return i})},t.getCanResize=()=>{var n,r;return((n=t.columnDef.enableResizing)!=null?n:!0)&&((r=e.options.enableColumnResizing)!=null?r:!0)},t.getIsResizing=()=>e.getState().columnSizingInfo.isResizingColumn===t.id},createHeader:(t,e)=>{t.getSize=()=>{let n=0;const r=i=>{if(i.subHeaders.length)i.subHeaders.forEach(r);else{var s;n+=(s=i.column.getSize())!=null?s:0}};return r(t),n},t.getStart=()=>{if(t.index>0){const n=t.headerGroup.headers[t.index-1];return n.getStart()+n.getSize()}return 0},t.getResizeHandler=n=>{const r=e.getColumn(t.column.id),i=r?.getCanResize();return s=>{if(!r||!i||(s.persist==null||s.persist(),Tb(s)&&s.touches&&s.touches.length>1))return;const a=t.getSize(),c=t?t.getLeafHeaders().map(k=>[k.column.id,k.column.getSize()]):[[r.id,r.getSize()]],u=Tb(s)?Math.round(s.touches[0].clientX):s.clientX,f={},p=(k,T)=>{typeof T=="number"&&(e.setColumnSizingInfo(A=>{var _,O;const N=e.options.columnResizeDirection==="rtl"?-1:1,I=(T-((_=A?.startOffset)!=null?_:0))*N,j=Math.max(I/((O=A?.startSize)!=null?O:0),-.999999);return A.columnSizingStart.forEach(G=>{let[Y,ce]=G;f[Y]=Math.round(Math.max(ce+ce*j,0)*100)/100}),{...A,deltaOffset:I,deltaPercentage:j}}),(e.options.columnResizeMode==="onChange"||k==="end")&&e.setColumnSizing(A=>({...A,...f})))},m=k=>p("move",k),g=k=>{p("end",k),e.setColumnSizingInfo(T=>({...T,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},y=ZX(n),b={moveHandler:k=>m(k.clientX),upHandler:k=>{y?.removeEventListener("mousemove",b.moveHandler),y?.removeEventListener("mouseup",b.upHandler),g(k.clientX)}},w={moveHandler:k=>(k.cancelable&&(k.preventDefault(),k.stopPropagation()),m(k.touches[0].clientX),!1),upHandler:k=>{var T;y?.removeEventListener("touchmove",w.moveHandler),y?.removeEventListener("touchend",w.upHandler),k.cancelable&&(k.preventDefault(),k.stopPropagation()),g((T=k.touches[0])==null?void 0:T.clientX)}},x=XX()?{passive:!1}:!1;Tb(s)?(y?.addEventListener("touchmove",w.moveHandler,x),y?.addEventListener("touchend",w.upHandler,x)):(y?.addEventListener("mousemove",b.moveHandler,x),y?.addEventListener("mouseup",b.upHandler,x)),e.setColumnSizingInfo(k=>({...k,startOffset:u,startSize:a,deltaOffset:0,deltaPercentage:0,columnSizingStart:c,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?Eb():(n=t.initialState.columnSizingInfo)!=null?n:Eb())},t.getTotalSize=()=>{var e,n;return(e=(n=t.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?e:0},t.getLeftTotalSize=()=>{var e,n;return(e=(n=t.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?e:0},t.getCenterTotalSize=()=>{var e,n;return(e=(n=t.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?e:0},t.getRightTotalSize=()=>{var e,n;return(e=(n=t.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,i)=>r+i.getSize(),0))!=null?e:0}}};let Vh=null;function XX(){if(typeof Vh=="boolean")return Vh;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 Vh=t,Vh}function Tb(t){return t.type==="touchstart"}const JX={getInitialState:t=>({columnVisibility:{},...t}),getDefaultOptions:t=>({onColumnVisibilityChange:xr("columnVisibility",t)}),createColumn:(t,e)=>{t.toggleVisibility=n=>{t.getCanHide()&&e.setColumnVisibility(r=>({...r,[t.id]:n??!t.getIsVisible()}))},t.getIsVisible=()=>{var n,r;const i=t.columns;return(n=i.length?i.some(s=>s.getIsVisible()):(r=e.getState().columnVisibility)==null?void 0:r[t.id])!=null?n:!0},t.getCanHide=()=>{var n,r;return((n=t.columnDef.enableHiding)!=null?n:!0)&&((r=e.options.enableHiding)!=null?r:!0)},t.getToggleVisibilityHandler=()=>n=>{t.toggleVisibility==null||t.toggleVisibility(n.target.checked)}},createRow:(t,e)=>{t._getAllVisibleCells=Ve(()=>[t.getAllCells(),e.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),He(e.options,"debugRows")),t.getVisibleCells=Ve(()=>[t.getLeftVisibleCells(),t.getCenterVisibleCells(),t.getRightVisibleCells()],(n,r,i)=>[...n,...r,...i],He(e.options,"debugRows"))},createTable:t=>{const e=(n,r)=>Ve(()=>[r(),r().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(s=>s.getIsVisible==null?void 0:s.getIsVisible()),He(t.options,"debugColumns"));t.getVisibleFlatColumns=e("getVisibleFlatColumns",()=>t.getAllFlatColumns()),t.getVisibleLeafColumns=e("getVisibleLeafColumns",()=>t.getAllLeafColumns()),t.getLeftVisibleLeafColumns=e("getLeftVisibleLeafColumns",()=>t.getLeftLeafColumns()),t.getRightVisibleLeafColumns=e("getRightVisibleLeafColumns",()=>t.getRightLeafColumns()),t.getCenterVisibleLeafColumns=e("getCenterVisibleLeafColumns",()=>t.getCenterLeafColumns()),t.setColumnVisibility=n=>t.options.onColumnVisibilityChange==null?void 0:t.options.onColumnVisibilityChange(n),t.resetColumnVisibility=n=>{var r;t.setColumnVisibility(n?{}:(r=t.initialState.columnVisibility)!=null?r:{})},t.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!t.getIsAllColumnsVisible(),t.setColumnVisibility(t.getAllLeafColumns().reduce((i,s)=>({...i,[s.id]:n||!(s.getCanHide!=null&&s.getCanHide())}),{}))},t.getIsAllColumnsVisible=()=>!t.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),t.getIsSomeColumnsVisible=()=>t.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),t.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;t.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function Qu(t,e){return e?e==="center"?t.getCenterVisibleLeafColumns():e==="left"?t.getLeftVisibleLeafColumns():t.getRightVisibleLeafColumns():t.getVisibleLeafColumns()}const QX={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()}}},eJ={getInitialState:t=>({globalFilter:void 0,...t}),getDefaultOptions:t=>({onGlobalFilterChange:xr("globalFilter",t),globalFilterFn:"auto",getColumnCanGlobalFilter:e=>{var n;const r=(n=t.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[e.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(t,e)=>{t.getCanGlobalFilter=()=>{var n,r,i,s;return((n=t.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=e.options.enableGlobalFilter)!=null?r:!0)&&((i=e.options.enableFilters)!=null?i:!0)&&((s=e.options.getColumnCanGlobalFilter==null?void 0:e.options.getColumnCanGlobalFilter(t))!=null?s:!0)&&!!t.accessorFn}},createTable:t=>{t.getGlobalAutoFilterFn=()=>es.includesString,t.getGlobalFilterFn=()=>{var e,n;const{globalFilterFn:r}=t.options;return ng(r)?r:r==="auto"?t.getGlobalAutoFilterFn():(e=(n=t.options.filterFns)==null?void 0:n[r])!=null?e:es[r]},t.setGlobalFilter=e=>{t.options.onGlobalFilterChange==null||t.options.onGlobalFilterChange(e)},t.resetGlobalFilter=e=>{t.setGlobalFilter(e?void 0:t.initialState.globalFilter)}}},tJ={getInitialState:t=>({expanded:{},...t}),getDefaultOptions:t=>({onExpandedChange:xr("expanded",t),paginateExpandedRows:!0}),createTable:t=>{let e=!1,n=!1;t._autoResetExpanded=()=>{var r,i;if(!e){t._queue(()=>{e=!0});return}if((r=(i=t.options.autoResetAll)!=null?i:t.options.autoResetExpanded)!=null?r:!t.options.manualExpanding){if(n)return;n=!0,t._queue(()=>{t.resetExpanded(),n=!1})}},t.setExpanded=r=>t.options.onExpandedChange==null?void 0:t.options.onExpandedChange(r),t.toggleAllRowsExpanded=r=>{r??!t.getIsAllRowsExpanded()?t.setExpanded(!0):t.setExpanded({})},t.resetExpanded=r=>{var i,s;t.setExpanded(r?{}:(i=(s=t.initialState)==null?void 0:s.expanded)!=null?i:{})},t.getCanSomeRowsExpand=()=>t.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),t.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),t.toggleAllRowsExpanded()},t.getIsSomeRowsExpanded=()=>{const r=t.getState().expanded;return r===!0||Object.values(r).some(Boolean)},t.getIsAllRowsExpanded=()=>{const r=t.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||t.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},t.getExpandedDepth=()=>{let r=0;return(t.getState().expanded===!0?Object.keys(t.getRowModel().rowsById):Object.keys(t.getState().expanded)).forEach(s=>{const a=s.split(".");r=Math.max(r,a.length)}),r},t.getPreExpandedRowModel=()=>t.getSortedRowModel(),t.getExpandedRowModel=()=>(!t._getExpandedRowModel&&t.options.getExpandedRowModel&&(t._getExpandedRowModel=t.options.getExpandedRowModel(t)),t.options.manualExpanding||!t._getExpandedRowModel?t.getPreExpandedRowModel():t._getExpandedRowModel())},createRow:(t,e)=>{t.toggleExpanded=n=>{e.setExpanded(r=>{var i;const s=r===!0?!0:!!(r!=null&&r[t.id]);let a={};if(r===!0?Object.keys(e.getRowModel().rowsById).forEach(c=>{a[c]=!0}):a=r,n=(i=n)!=null?i:!s,!s&&n)return{...a,[t.id]:!0};if(s&&!n){const{[t.id]:c,...u}=a;return u}return r})},t.getIsExpanded=()=>{var n;const r=e.getState().expanded;return!!((n=e.options.getIsRowExpanded==null?void 0:e.options.getIsRowExpanded(t))!=null?n:r===!0||r?.[t.id])},t.getCanExpand=()=>{var n,r,i;return(n=e.options.getRowCanExpand==null?void 0:e.options.getRowCanExpand(t))!=null?n:((r=e.options.enableExpanding)!=null?r:!0)&&!!((i=t.subRows)!=null&&i.length)},t.getIsAllParentsExpanded=()=>{let n=!0,r=t;for(;n&&r.parentId;)r=e.getRow(r.parentId,!0),n=r.getIsExpanded();return n},t.getToggleExpandedHandler=()=>{const n=t.getCanExpand();return()=>{n&&t.toggleExpanded()}}}},cS=0,uS=10,_b=()=>({pageIndex:cS,pageSize:uS}),nJ={getInitialState:t=>({...t,pagination:{..._b(),...t?.pagination}}),getDefaultOptions:t=>({onPaginationChange:xr("pagination",t)}),createTable:t=>{let e=!1,n=!1;t._autoResetPageIndex=()=>{var r,i;if(!e){t._queue(()=>{e=!0});return}if((r=(i=t.options.autoResetAll)!=null?i:t.options.autoResetPageIndex)!=null?r:!t.options.manualPagination){if(n)return;n=!0,t._queue(()=>{t.resetPageIndex(),n=!1})}},t.setPagination=r=>{const i=s=>ho(r,s);return t.options.onPaginationChange==null?void 0:t.options.onPaginationChange(i)},t.resetPagination=r=>{var i;t.setPagination(r?_b():(i=t.initialState.pagination)!=null?i:_b())},t.setPageIndex=r=>{t.setPagination(i=>{let s=ho(r,i.pageIndex);const a=typeof t.options.pageCount>"u"||t.options.pageCount===-1?Number.MAX_SAFE_INTEGER:t.options.pageCount-1;return s=Math.max(0,Math.min(s,a)),{...i,pageIndex:s}})},t.resetPageIndex=r=>{var i,s;t.setPageIndex(r?cS:(i=(s=t.initialState)==null||(s=s.pagination)==null?void 0:s.pageIndex)!=null?i:cS)},t.resetPageSize=r=>{var i,s;t.setPageSize(r?uS:(i=(s=t.initialState)==null||(s=s.pagination)==null?void 0:s.pageSize)!=null?i:uS)},t.setPageSize=r=>{t.setPagination(i=>{const s=Math.max(1,ho(r,i.pageSize)),a=i.pageSize*i.pageIndex,c=Math.floor(a/s);return{...i,pageIndex:c,pageSize:s}})},t.setPageCount=r=>t.setPagination(i=>{var s;let a=ho(r,(s=t.options.pageCount)!=null?s:-1);return typeof a=="number"&&(a=Math.max(-1,a)),{...i,pageCount:a}}),t.getPageOptions=Ve(()=>[t.getPageCount()],r=>{let i=[];return r&&r>0&&(i=[...new Array(r)].fill(null).map((s,a)=>a)),i},He(t.options,"debugTable")),t.getCanPreviousPage=()=>t.getState().pagination.pageIndex>0,t.getCanNextPage=()=>{const{pageIndex:r}=t.getState().pagination,i=t.getPageCount();return i===-1?!0:i===0?!1:r<i-1},t.previousPage=()=>t.setPageIndex(r=>r-1),t.nextPage=()=>t.setPageIndex(r=>r+1),t.firstPage=()=>t.setPageIndex(0),t.lastPage=()=>t.setPageIndex(t.getPageCount()-1),t.getPrePaginationRowModel=()=>t.getExpandedRowModel(),t.getPaginationRowModel=()=>(!t._getPaginationRowModel&&t.options.getPaginationRowModel&&(t._getPaginationRowModel=t.options.getPaginationRowModel(t)),t.options.manualPagination||!t._getPaginationRowModel?t.getPrePaginationRowModel():t._getPaginationRowModel()),t.getPageCount=()=>{var r;return(r=t.options.pageCount)!=null?r:Math.ceil(t.getRowCount()/t.getState().pagination.pageSize)},t.getRowCount=()=>{var r;return(r=t.options.rowCount)!=null?r:t.getPrePaginationRowModel().rows.length}}},Ab=()=>({top:[],bottom:[]}),rJ={getInitialState:t=>({rowPinning:Ab(),...t}),getDefaultOptions:t=>({onRowPinningChange:xr("rowPinning",t)}),createRow:(t,e)=>{t.pin=(n,r,i)=>{const s=r?t.getLeafRows().map(u=>{let{id:f}=u;return f}):[],a=i?t.getParentRows().map(u=>{let{id:f}=u;return f}):[],c=new Set([...a,t.id,...s]);e.setRowPinning(u=>{var f,p;if(n==="bottom"){var m,g;return{top:((m=u?.top)!=null?m:[]).filter(w=>!(c!=null&&c.has(w))),bottom:[...((g=u?.bottom)!=null?g:[]).filter(w=>!(c!=null&&c.has(w))),...Array.from(c)]}}if(n==="top"){var y,b;return{top:[...((y=u?.top)!=null?y:[]).filter(w=>!(c!=null&&c.has(w))),...Array.from(c)],bottom:((b=u?.bottom)!=null?b:[]).filter(w=>!(c!=null&&c.has(w)))}}return{top:((f=u?.top)!=null?f:[]).filter(w=>!(c!=null&&c.has(w))),bottom:((p=u?.bottom)!=null?p:[]).filter(w=>!(c!=null&&c.has(w)))}})},t.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:i}=e.options;return typeof r=="function"?r(t):(n=r??i)!=null?n:!0},t.getIsPinned=()=>{const n=[t.id],{top:r,bottom:i}=e.getState().rowPinning,s=n.some(c=>r?.includes(c)),a=n.some(c=>i?.includes(c));return s?"top":a?"bottom":!1},t.getPinnedIndex=()=>{var n,r;const i=t.getIsPinned();if(!i)return-1;const s=(n=i==="top"?e.getTopRows():e.getBottomRows())==null?void 0:n.map(a=>{let{id:c}=a;return c});return(r=s?.indexOf(t.id))!=null?r:-1}},createTable:t=>{t.setRowPinning=e=>t.options.onRowPinningChange==null?void 0:t.options.onRowPinningChange(e),t.resetRowPinning=e=>{var n,r;return t.setRowPinning(e?Ab():(n=(r=t.initialState)==null?void 0:r.rowPinning)!=null?n:Ab())},t.getIsSomeRowsPinned=e=>{var n;const r=t.getState().rowPinning;if(!e){var i,s;return!!((i=r.top)!=null&&i.length||(s=r.bottom)!=null&&s.length)}return!!((n=r[e])!=null&&n.length)},t._getPinnedRows=(e,n,r)=>{var i;return((i=t.options.keepPinnedRows)==null||i?(n??[]).map(a=>{const c=t.getRow(a,!0);return c.getIsAllParentsExpanded()?c:null}):(n??[]).map(a=>e.find(c=>c.id===a))).filter(Boolean).map(a=>({...a,position:r}))},t.getTopRows=Ve(()=>[t.getRowModel().rows,t.getState().rowPinning.top],(e,n)=>t._getPinnedRows(e,n,"top"),He(t.options,"debugRows")),t.getBottomRows=Ve(()=>[t.getRowModel().rows,t.getState().rowPinning.bottom],(e,n)=>t._getPinnedRows(e,n,"bottom"),He(t.options,"debugRows")),t.getCenterRows=Ve(()=>[t.getRowModel().rows,t.getState().rowPinning.top,t.getState().rowPinning.bottom],(e,n,r)=>{const i=new Set([...n??[],...r??[]]);return e.filter(s=>!i.has(s.id))},He(t.options,"debugRows"))}},iJ={getInitialState:t=>({rowSelection:{},...t}),getDefaultOptions:t=>({onRowSelectionChange:xr("rowSelection",t),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:t=>{t.setRowSelection=e=>t.options.onRowSelectionChange==null?void 0:t.options.onRowSelectionChange(e),t.resetRowSelection=e=>{var n;return t.setRowSelection(e?{}:(n=t.initialState.rowSelection)!=null?n:{})},t.toggleAllRowsSelected=e=>{t.setRowSelection(n=>{e=typeof e<"u"?e:!t.getIsAllRowsSelected();const r={...n},i=t.getPreGroupedRowModel().flatRows;return e?i.forEach(s=>{s.getCanSelect()&&(r[s.id]=!0)}):i.forEach(s=>{delete r[s.id]}),r})},t.toggleAllPageRowsSelected=e=>t.setRowSelection(n=>{const r=typeof e<"u"?e:!t.getIsAllPageRowsSelected(),i={...n};return t.getRowModel().rows.forEach(s=>{dS(i,s.id,r,!0,t)}),i}),t.getPreSelectedRowModel=()=>t.getCoreRowModel(),t.getSelectedRowModel=Ve(()=>[t.getState().rowSelection,t.getCoreRowModel()],(e,n)=>Object.keys(e).length?Rb(t,n):{rows:[],flatRows:[],rowsById:{}},He(t.options,"debugTable")),t.getFilteredSelectedRowModel=Ve(()=>[t.getState().rowSelection,t.getFilteredRowModel()],(e,n)=>Object.keys(e).length?Rb(t,n):{rows:[],flatRows:[],rowsById:{}},He(t.options,"debugTable")),t.getGroupedSelectedRowModel=Ve(()=>[t.getState().rowSelection,t.getSortedRowModel()],(e,n)=>Object.keys(e).length?Rb(t,n):{rows:[],flatRows:[],rowsById:{}},He(t.options,"debugTable")),t.getIsAllRowsSelected=()=>{const e=t.getFilteredRowModel().flatRows,{rowSelection:n}=t.getState();let r=!!(e.length&&Object.keys(n).length);return r&&e.some(i=>i.getCanSelect()&&!n[i.id])&&(r=!1),r},t.getIsAllPageRowsSelected=()=>{const e=t.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:n}=t.getState();let r=!!e.length;return r&&e.some(i=>!n[i.id])&&(r=!1),r},t.getIsSomeRowsSelected=()=>{var e;const n=Object.keys((e=t.getState().rowSelection)!=null?e:{}).length;return n>0&&n<t.getFilteredRowModel().flatRows.length},t.getIsSomePageRowsSelected=()=>{const e=t.getPaginationRowModel().flatRows;return t.getIsAllPageRowsSelected()?!1:e.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},t.getToggleAllRowsSelectedHandler=()=>e=>{t.toggleAllRowsSelected(e.target.checked)},t.getToggleAllPageRowsSelectedHandler=()=>e=>{t.toggleAllPageRowsSelected(e.target.checked)}},createRow:(t,e)=>{t.toggleSelected=(n,r)=>{const i=t.getIsSelected();e.setRowSelection(s=>{var a;if(n=typeof n<"u"?n:!i,t.getCanSelect()&&i===n)return s;const c={...s};return dS(c,t.id,n,(a=r?.selectChildren)!=null?a:!0,e),c})},t.getIsSelected=()=>{const{rowSelection:n}=e.getState();return px(t,n)},t.getIsSomeSelected=()=>{const{rowSelection:n}=e.getState();return fS(t,n)==="some"},t.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=e.getState();return fS(t,n)==="all"},t.getCanSelect=()=>{var n;return typeof e.options.enableRowSelection=="function"?e.options.enableRowSelection(t):(n=e.options.enableRowSelection)!=null?n:!0},t.getCanSelectSubRows=()=>{var n;return typeof e.options.enableSubRowSelection=="function"?e.options.enableSubRowSelection(t):(n=e.options.enableSubRowSelection)!=null?n:!0},t.getCanMultiSelect=()=>{var n;return typeof e.options.enableMultiRowSelection=="function"?e.options.enableMultiRowSelection(t):(n=e.options.enableMultiRowSelection)!=null?n:!0},t.getToggleSelectedHandler=()=>{const n=t.getCanSelect();return r=>{var i;n&&t.toggleSelected((i=r.target)==null?void 0:i.checked)}}}},dS=(t,e,n,r,i)=>{var s;const a=i.getRow(e,!0);n?(a.getCanMultiSelect()||Object.keys(t).forEach(c=>delete t[c]),a.getCanSelect()&&(t[e]=!0)):delete t[e],r&&(s=a.subRows)!=null&&s.length&&a.getCanSelectSubRows()&&a.subRows.forEach(c=>dS(t,c.id,n,r,i))};function Rb(t,e){const n=t.getState().rowSelection,r=[],i={},s=function(a,c){return a.map(u=>{var f;const p=px(u,n);if(p&&(r.push(u),i[u.id]=u),(f=u.subRows)!=null&&f.length&&(u={...u,subRows:s(u.subRows)}),p)return u}).filter(Boolean)};return{rows:s(e.rows),flatRows:r,rowsById:i}}function px(t,e){var n;return(n=e[t.id])!=null?n:!1}function fS(t,e,n){var r;if(!((r=t.subRows)!=null&&r.length))return!1;let i=!0,s=!1;return t.subRows.forEach(a=>{if(!(s&&!i)&&(a.getCanSelect()&&(px(a,e)?s=!0:i=!1),a.subRows&&a.subRows.length)){const c=fS(a,e);c==="all"?s=!0:(c==="some"&&(s=!0),i=!1)}}),i?"all":s?"some":!1}const hS=/([0-9]+)/gm,sJ=(t,e,n)=>a2(Oo(t.getValue(n)).toLowerCase(),Oo(e.getValue(n)).toLowerCase()),oJ=(t,e,n)=>a2(Oo(t.getValue(n)),Oo(e.getValue(n))),aJ=(t,e,n)=>mx(Oo(t.getValue(n)).toLowerCase(),Oo(e.getValue(n)).toLowerCase()),lJ=(t,e,n)=>mx(Oo(t.getValue(n)),Oo(e.getValue(n))),cJ=(t,e,n)=>{const r=t.getValue(n),i=e.getValue(n);return r>i?1:r<i?-1:0},uJ=(t,e,n)=>mx(t.getValue(n),e.getValue(n));function mx(t,e){return t===e?0:t>e?1:-1}function Oo(t){return typeof t=="number"?isNaN(t)||t===1/0||t===-1/0?"":String(t):typeof t=="string"?t:""}function a2(t,e){const n=t.split(hS).filter(Boolean),r=e.split(hS).filter(Boolean);for(;n.length&&r.length;){const i=n.shift(),s=r.shift(),a=parseInt(i,10),c=parseInt(s,10),u=[a,c].sort();if(isNaN(u[0])){if(i>s)return 1;if(s>i)return-1;continue}if(isNaN(u[1]))return isNaN(a)?-1:1;if(a>c)return 1;if(c>a)return-1}return n.length-r.length}const Tu={alphanumeric:sJ,alphanumericCaseSensitive:oJ,text:aJ,textCaseSensitive:lJ,datetime:cJ,basic:uJ},dJ={getInitialState:t=>({sorting:[],...t}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:t=>({onSortingChange:xr("sorting",t),isMultiSortEvent:e=>e.shiftKey}),createColumn:(t,e)=>{t.getAutoSortingFn=()=>{const n=e.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const i of n){const s=i?.getValue(t.id);if(Object.prototype.toString.call(s)==="[object Date]")return Tu.datetime;if(typeof s=="string"&&(r=!0,s.split(hS).length>1))return Tu.alphanumeric}return r?Tu.text:Tu.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 ng(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:Tu[t.columnDef.sortingFn]},t.toggleSorting=(n,r)=>{const i=t.getNextSortingOrder(),s=typeof n<"u"&&n!==null;e.setSorting(a=>{const c=a?.find(y=>y.id===t.id),u=a?.findIndex(y=>y.id===t.id);let f=[],p,m=s?n:i==="desc";if(a!=null&&a.length&&t.getCanMultiSort()&&r?c?p="toggle":p="add":a!=null&&a.length&&u!==a.length-1?p="replace":c?p="toggle":p="replace",p==="toggle"&&(s||i||(p="remove")),p==="add"){var g;f=[...a,{id:t.id,desc:m}],f.splice(0,f.length-((g=e.options.maxMultiSortColCount)!=null?g:Number.MAX_SAFE_INTEGER))}else p==="toggle"?f=a.map(y=>y.id===t.id?{...y,desc:m}:y):p==="remove"?f=a.filter(y=>y.id!==t.id):f=[{id:t.id,desc:m}];return f})},t.getFirstSortDir=()=>{var n,r;return((n=(r=t.columnDef.sortDescFirst)!=null?r:e.options.sortDescFirst)!=null?n:t.getAutoSortDir()==="desc")?"desc":"asc"},t.getNextSortingOrder=n=>{var r,i;const s=t.getFirstSortDir(),a=t.getIsSorted();return a?a!==s&&((r=e.options.enableSortingRemoval)==null||r)&&(!(n&&(i=e.options.enableMultiRemove)!=null)||i)?!1:a==="desc"?"asc":"desc":s},t.getCanSort=()=>{var n,r;return((n=t.columnDef.enableSorting)!=null?n:!0)&&((r=e.options.enableSorting)!=null?r:!0)&&!!t.accessorFn},t.getCanMultiSort=()=>{var n,r;return(n=(r=t.columnDef.enableMultiSort)!=null?r:e.options.enableMultiSort)!=null?n:!!t.accessorFn},t.getIsSorted=()=>{var n;const r=(n=e.getState().sorting)==null?void 0:n.find(i=>i.id===t.id);return r?r.desc?"desc":"asc":!1},t.getSortIndex=()=>{var n,r;return(n=(r=e.getState().sorting)==null?void 0:r.findIndex(i=>i.id===t.id))!=null?n:-1},t.clearSorting=()=>{e.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==t.id):[])},t.getToggleSortingHandler=()=>{const n=t.getCanSort();return r=>{n&&(r.persist==null||r.persist(),t.toggleSorting==null||t.toggleSorting(void 0,t.getCanMultiSort()?e.options.isMultiSortEvent==null?void 0:e.options.isMultiSortEvent(r):!1))}}},createTable:t=>{t.setSorting=e=>t.options.onSortingChange==null?void 0:t.options.onSortingChange(e),t.resetSorting=e=>{var n,r;t.setSorting(e?[]:(n=(r=t.initialState)==null?void 0:r.sorting)!=null?n:[])},t.getPreSortedRowModel=()=>t.getGroupedRowModel(),t.getSortedRowModel=()=>(!t._getSortedRowModel&&t.options.getSortedRowModel&&(t._getSortedRowModel=t.options.getSortedRowModel(t)),t.options.manualSorting||!t._getSortedRowModel?t.getPreSortedRowModel():t._getSortedRowModel())}},fJ=[NX,JX,WX,KX,IX,LX,QX,eJ,dJ,qX,tJ,nJ,rJ,iJ,YX];function hJ(t){var e,n;const r=[...fJ,...(e=t._features)!=null?e:[]];let i={_features:r};const s=i._features.reduce((g,y)=>Object.assign(g,y.getDefaultOptions==null?void 0:y.getDefaultOptions(i)),{}),a=g=>i.options.mergeOptions?i.options.mergeOptions(s,g):{...s,...g};let u={...{},...(n=t.initialState)!=null?n:{}};i._features.forEach(g=>{var y;u=(y=g.getInitialState==null?void 0:g.getInitialState(u))!=null?y:u});const f=[];let p=!1;const m={_features:r,options:{...s,...t},initialState:u,_queue:g=>{f.push(g),p||(p=!0,Promise.resolve().then(()=>{for(;f.length;)f.shift()();p=!1}).catch(y=>setTimeout(()=>{throw y})))},reset:()=>{i.setState(i.initialState)},setOptions:g=>{const y=ho(g,i.options);i.options=a(y)},getState:()=>i.options.state,setState:g=>{i.options.onStateChange==null||i.options.onStateChange(g)},_getRowId:(g,y,b)=>{var w;return(w=i.options.getRowId==null?void 0:i.options.getRowId(g,y,b))!=null?w:`${b?[b.id,y].join("."):y}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(g,y)=>{let b=(y?i.getPrePaginationRowModel():i.getRowModel()).rowsById[g];if(!b&&(b=i.getCoreRowModel().rowsById[g],!b))throw new Error;return b},_getDefaultColumnDef:Ve(()=>[i.options.defaultColumn],g=>{var y;return g=(y=g)!=null?y:{},{header:b=>{const w=b.header.column.columnDef;return w.accessorKey?w.accessorKey:w.accessorFn?w.id:null},cell:b=>{var w,x;return(w=(x=b.renderValue())==null||x.toString==null?void 0:x.toString())!=null?w:null},...i._features.reduce((b,w)=>Object.assign(b,w.getDefaultColumnDef==null?void 0:w.getDefaultColumnDef()),{}),...g}},He(t,"debugColumns")),_getColumnDefs:()=>i.options.columns,getAllColumns:Ve(()=>[i._getColumnDefs()],g=>{const y=function(b,w,x){return x===void 0&&(x=0),b.map(k=>{const T=OX(i,k,x,w),A=k;return T.columns=A.columns?y(A.columns,T,x+1):[],T})};return y(g)},He(t,"debugColumns")),getAllFlatColumns:Ve(()=>[i.getAllColumns()],g=>g.flatMap(y=>y.getFlatColumns()),He(t,"debugColumns")),_getAllFlatColumnsById:Ve(()=>[i.getAllFlatColumns()],g=>g.reduce((y,b)=>(y[b.id]=b,y),{}),He(t,"debugColumns")),getAllLeafColumns:Ve(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(g,y)=>{let b=g.flatMap(w=>w.getLeafColumns());return y(b)},He(t,"debugColumns")),getColumn:g=>i._getAllFlatColumnsById()[g]};Object.assign(i,m);for(let g=0;g<i._features.length;g++){const y=i._features[g];y==null||y.createTable==null||y.createTable(i)}return i}function pJ(){return t=>Ve(()=>[t.options.data],e=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(i,s,a){s===void 0&&(s=0);const c=[];for(let f=0;f<i.length;f++){const p=DX(t,t._getRowId(i[f],f,a),i[f],f,s,void 0,a?.id);if(n.flatRows.push(p),n.rowsById[p.id]=p,c.push(p),t.options.getSubRows){var u;p.originalSubRows=t.options.getSubRows(i[f],f),(u=p.originalSubRows)!=null&&u.length&&(p.subRows=r(p.originalSubRows,s+1,p))}}return c};return n.rows=r(e),n},He(t.options,"debugTable","getRowModel",()=>t._autoResetPageIndex()))}function bR(t,e){return t?mJ(t)?R.createElement(t,e):t:null}function mJ(t){return gJ(t)||typeof t=="function"||yJ(t)}function gJ(t){return typeof t=="function"&&(()=>{const e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}function yJ(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}function vJ(t){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...t},[n]=R.useState(()=>({current:hJ(e)})),[r,i]=R.useState(()=>n.current.initialState);return n.current.setOptions(s=>({...s,...t,state:{...r,...t.state},onStateChange:a=>{i(a),t.onStateChange==null||t.onStateChange(a)}})),n.current}function bJ({uploads:t,canCreate:e,fieldLabels:n,onClose:r,onUpload:i,onCreateFromUploads:s}){const a=R.useMemo(()=>Object.keys(t),[t]),[c,u]=R.useState(a[0]??""),[f,p]=R.useState(!!e),[m,g]=R.useState([]),[y,b]=R.useState(null),w=t[c];return R.useEffect(()=>{!a.includes(c)&&a[0]&&u(a[0])},[c,a]),R.useEffect(()=>{const x=T=>{T.key==="Escape"&&r()};window.addEventListener("keydown",x);const k=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",x),document.body.style.overflow=k}},[r]),w?E.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:r,children:E.jsxs("div",{className:"vertebr-modal vertebr-modal-sm",role:"dialog","aria-modal":"true","aria-label":"Bulk image upload",onClick:x=>x.stopPropagation(),children:[E.jsxs("header",{className:"vertebr-modal-head",children:[E.jsxs("div",{className:"vertebr-modal-heading",children:[E.jsx("p",{className:"vertebr-modal-eyebrow",children:"Media"}),E.jsx("h2",{children:"Bulk image upload"})]}),E.jsx("button",{type:"button",className:"vertebr-btn",onClick:r,children:"Close"})]}),E.jsxs("div",{className:"vertebr-modal-body",children:[a.length>1?E.jsxs("label",{className:"vertebr-field",children:[E.jsx("span",{children:"Target field"}),E.jsx("select",{className:"vertebr-native-select",value:c,onChange:x=>{u(x.target.value),g([]),b(null)},children:a.map(x=>E.jsx("option",{value:x,children:n[x]??x},x))})]}):null,e&&s?E.jsxs("label",{className:"vertebr-upload-check",children:[E.jsx("input",{type:"checkbox",checked:f,onChange:x=>p(x.target.checked)}),E.jsx("span",{children:"Create a record for each uploaded image"})]}):null,E.jsx(Dd,{meta:w,multiple:!0,onUpload:async x=>{b(`Uploading ${x.length} image${x.length===1?"":"s"}…`);const k=await i(c,x);g(k),f&&s?(b("Creating records…"),await s(c,k),b(`Uploaded ${k.length} and created records.`)):b(`Uploaded ${k.length} image${k.length===1?"":"s"}.`)}}),y?E.jsx("p",{className:"vertebr-upload-status",children:y}):null,m.length>0?E.jsx("ul",{className:"vertebr-upload-results",children:m.map(x=>E.jsxs("li",{children:[E.jsx("img",{src:x.url,alt:""}),E.jsxs("div",{children:[E.jsx("strong",{children:x.name??"Image"}),E.jsx("a",{href:x.url,target:"_blank",rel:"noreferrer",children:x.url})]})]},x.url))}):null]})]})}):null}function SJ({columns:t,visibility:e,onChange:n}){const[r,i]=R.useState(!1),s=R.useRef(null),a=R.useId(),c=t.filter(f=>e[f.id]===!1).length;R.useEffect(()=>{if(!r)return;const f=m=>{s.current?.contains(m.target)||i(!1)},p=m=>{m.key==="Escape"&&i(!1)};return window.addEventListener("mousedown",f),window.addEventListener("keydown",p),()=>{window.removeEventListener("mousedown",f),window.removeEventListener("keydown",p)}},[r]);const u=t.length-c;return E.jsxs("div",{className:"vertebr-col-menu",ref:s,children:[E.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet","aria-expanded":r,"aria-controls":a,onClick:()=>i(f=>!f),children:["Columns",c>0?E.jsx("span",{className:"vertebr-col-menu-count",children:u}):null]}),r?E.jsxs("div",{className:"vertebr-col-menu-panel",id:a,role:"menu",children:[E.jsxs("div",{className:"vertebr-col-menu-head",children:[E.jsx("span",{children:"Visible fields"}),E.jsx("button",{type:"button",className:"vertebr-link-btn",onClick:()=>{const f={};for(const p of t)f[p.id]=!0;n(f)},children:"Show all"})]}),E.jsx("ul",{className:"vertebr-col-menu-list",children:t.map(f=>{const p=e[f.id]!==!1;return E.jsx("li",{children:E.jsxs("label",{className:"vertebr-col-menu-item",children:[E.jsx("input",{type:"checkbox",checked:p,disabled:p&&u<=1,onChange:()=>{const m={...e,[f.id]:!p};n(m)}}),E.jsx("span",{children:f.label})]})},f.id)})})]}):null]})}const wJ=/(image|img|photo|avatar|thumbnail|thumb|cover)/i,SR=/(url|href|link|src)/i,xJ=/\.(png|jpe?g|gif|webp|svg|avif)(\?|#|$)/i;function pS(t){return/^https?:\/\//i.test(t)||t.startsWith("//")}function wR(t){return pS(t)?xJ.test(t)?!0:/(image|img|media|cdn|photo)/i.test(t):!1}function xR(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 mS({fieldKey:t,field:e,value:n,variant:r="table"}){const i=r==="detail";if(n==null||n==="")return E.jsx("span",{className:"vertebr-cell-empty",children:"—"});const s=e?.type;if(s==="boolean"||typeof n=="boolean"){const c=!!n;return E.jsx("span",{className:"vertebr-badge","data-tone":c?"ok":"neutral",children:c?"Active":"Off"})}if(s==="datetime"){const c=xR(n);if(c)return E.jsx("span",{className:"vertebr-cell-datetime",children:c})}if((s==="number"||typeof n=="number")&&typeof n=="number"&&Number.isFinite(n))return YS(t,e)?E.jsx("span",{className:"vertebr-cell-money",children:o0(n,{asCents:!0})}):kO(t,e)?E.jsx("span",{className:"vertebr-cell-money",children:o0(n,{asCents:!1})}):E.jsx("span",{className:"vertebr-cell-number",children:new Intl.NumberFormat().format(n)});if(Array.isArray(n)){if(n.length===0)return E.jsx("span",{className:"vertebr-cell-empty",children:"—"});if(n.every(c=>typeof c=="string"))return E.jsx("div",{className:"vertebr-chip-row",children:n.map(c=>E.jsx("span",{className:"vertebr-chip",children:c},c))})}if(typeof n=="string")return(wJ.test(t)||SR.test(t)&&wR(n)||wR(n))&&pS(n)?E.jsxs("a",{className:i?"vertebr-cell-media vertebr-cell-media-detail":"vertebr-cell-media",href:n,target:"_blank",rel:"noreferrer",title:n,onClick:u=>u.stopPropagation(),children:[E.jsx("img",{src:n,alt:"",loading:"lazy"}),i?E.jsx("span",{className:"vertebr-cell-link",children:n}):E.jsx("span",{className:"vertebr-cell-truncate",children:n})]}):SR.test(t)||pS(n)?E.jsx("a",{className:"vertebr-cell-link",href:n.startsWith("//")?`https:${n}`:n,target:"_blank",rel:"noreferrer",title:n,onClick:u=>u.stopPropagation(),children:i?n:n.replace(/^https?:\/\//i,"")}):!i&&(s==="richtext"||n.length>80)?E.jsx("span",{className:"vertebr-cell-clamp",title:n,children:n}):i&&(s==="richtext"||n.length>80)?E.jsx("p",{className:"vertebr-cell-prose",children:n}):E.jsx("span",{className:"vertebr-cell-text",children:n});const a=xR(n);return a?E.jsx("span",{className:"vertebr-cell-datetime",children:a}):typeof n=="object"?E.jsx("code",{className:"vertebr-cell-json",title:JSON.stringify(n),children:JSON.stringify(n)}):E.jsx("span",{className:"vertebr-cell-text",children:String(n)})}function kJ(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\bcents\b/i,"").trim()}function CJ(t,e){for(const[n,r]of Object.entries(e)){if(typeof r!="string"||!/^https?:\/\//i.test(r))continue;const i=t[n];if(/(image|img|photo|avatar|thumbnail|thumb|cover)/i.test(n)||/(image|img|photo)/i.test(i?.label??"")||/(image|img|media|cdn|photo)/i.test(r))return r}return null}function EJ({schema:t,row:e,title:n,canEdit:r,onClose:i,onEdit:s}){const a=Object.keys(t),c=a.length>0?a.map(f=>[f,e[f]]):Object.entries(e),u=CJ(t,e);return R.useEffect(()=>{const f=m=>{m.key==="Escape"&&i()};window.addEventListener("keydown",f);const p=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",f),document.body.style.overflow=p}},[i]),E.jsx("div",{className:"vertebr-modal-backdrop",role:"presentation",onClick:i,children:E.jsxs("div",{className:"vertebr-modal",role:"dialog","aria-modal":"true","aria-label":n,onClick:f=>f.stopPropagation(),children:[E.jsxs("header",{className:"vertebr-modal-head",children:[E.jsxs("div",{className:"vertebr-modal-heading",children:[E.jsx("p",{className:"vertebr-modal-eyebrow",children:"Record"}),E.jsx("h2",{children:n})]}),E.jsxs("div",{className:"vertebr-modal-actions",children:[r&&s?E.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",onClick:s,children:"Edit"}):null,E.jsx("button",{type:"button",className:"vertebr-btn",onClick:i,"aria-label":"Close",children:"Close"})]})]}),E.jsxs("div",{className:"vertebr-modal-body",children:[u?E.jsx("div",{className:"vertebr-modal-hero",children:E.jsx("img",{src:u,alt:""})}):null,E.jsx("dl",{className:"vertebr-modal-fields",children:c.map(([f,p])=>E.jsxs("div",{className:"vertebr-modal-field",children:[E.jsx("dt",{children:t[f]?.label??kJ(f)}),E.jsx("dd",{children:E.jsx(mS,{fieldKey:f,field:t[f],value:p,variant:"detail"})})]},f))})]})]})})}function kR(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 Mb(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\bcents\b/i,"").trim()}function CR(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 ER(t){if(!t||typeof localStorage>"u")return{};try{const e=localStorage.getItem(`vertebr:columns:${t}`);if(!e)return{};const n=JSON.parse(e);return!n||typeof n!="object"?{}:n}catch{return{}}}function TJ(t,e){if(!(!t||typeof localStorage>"u"))try{localStorage.setItem(`vertebr:columns:${t}`,JSON.stringify(e))}catch{}}function _J(t){return t.replace(/\.[^.]+$/,"").replace(/[_-]+/g," ").replace(/\s+/g," ").trim()}function AJ({schema:t,items:e,permissions:n,actions:r={},uploads:i,rowIdKeys:s=["id","slug","uid","email"],storageKey:a,onUpdate:c,onCreate:u,onDelete:f,onAction:p,onUpload:m,galleryUpload:g,onListGallery:y,onUploadGallery:b}){const[w,x]=R.useState(null),[k,T]=R.useState(null),[A,_]=R.useState(!1),[O,N]=R.useState(null),I=R.useRef(null),[j,G]=R.useState({overflow:!1,canLeft:!1,canRight:!1}),[Y,ce]=R.useState(()=>ER(a)),X=!!(n?.update&&c),te=!!(n?.create&&u),ie=!!(n?.delete&&f),he=!!(i&&m&&Object.keys(i).length),B=Object.entries(r),Z=Object.keys(t);R.useEffect(()=>{ce(ER(a))},[a]),R.useEffect(()=>{TJ(a,Y)},[a,Y]);const se=R.useCallback(()=>{const de=I.current;if(!de){G({overflow:!1,canLeft:!1,canRight:!1});return}const pe=de.scrollWidth>de.clientWidth+2;G({overflow:pe,canLeft:pe&&de.scrollLeft>2,canRight:pe&&de.scrollLeft+de.clientWidth<de.scrollWidth-2})},[]);R.useEffect(()=>{const de=I.current;if(!de)return;se();const pe=()=>se();de.addEventListener("scroll",pe,{passive:!0});const me=new ResizeObserver(se);return me.observe(de),()=>{de.removeEventListener("scroll",pe),me.disconnect()}},[se,e.length,Y]);const Se=de=>{const pe=I.current;if(!pe)return;const me=Math.max(220,Math.round(pe.clientWidth*.55));pe.scrollBy({left:de==="left"?-me:me,behavior:"smooth"})},Ce=R.useMemo(()=>Z.map(de=>({id:de,label:t[de]?.label??Mb(de)})),[Z,t]),z=R.useMemo(()=>{const de=Z.length===0?[{id:"raw",header:"Item",cell:({row:pe})=>E.jsx(mS,{fieldKey:"raw",value:pe.original})}]:Z.map(pe=>{const me=t[pe],Ee=/(image|img|photo|avatar|thumbnail|thumb|cover)/i.test(pe)||/(image|img|photo)/i.test(me?.label??"");return{id:pe,accessorKey:pe,header:me?.label??Mb(pe),meta:{fieldKey:pe,field:me},cell:({getValue:it})=>E.jsx(mS,{fieldKey:pe,field:me,value:it()}),size:Ee?220:void 0}});return de.push({id:"_actions",header:()=>E.jsx("span",{className:"vertebr-sr-only",children:"Actions"}),enableHiding:!1,cell:({row:pe})=>{const me=kR(pe.original,s);return E.jsxs("div",{className:"vertebr-row-actions",onClick:Ee=>Ee.stopPropagation(),onKeyDown:Ee=>Ee.stopPropagation(),children:[E.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>T(pe.original),children:"View"}),X?E.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",onClick:()=>x(pe.original),children:"Edit"}):null,me?B.map(([Ee,it])=>E.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet",disabled:O===`${me}:${Ee}`,onClick:()=>{p&&(N(`${me}:${Ee}`),p(me,Ee).finally(()=>N(null)))},children:it.label},Ee)):null,ie&&me?E.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-danger-quiet",onClick:()=>{window.confirm("Delete this row? This cannot be undone.")&&f?.(me)},children:"Delete"}):null]})}}),de},[t,Z,X,ie,B,O,p,f,s]),K=vJ({data:e,columns:z,state:{columnVisibility:Y},onColumnVisibilityChange:ce,getCoreRowModel:pJ()}),le=w?kR(w,s):null;if(w&&le&&c){const de=Object.fromEntries(Object.entries(t).filter(([,me])=>!me.readOnly)),pe=CR(w,s);return E.jsxs("div",{className:"vertebr-resource-edit",children:[E.jsxs("div",{className:"vertebr-resource-edit-head",children:[E.jsxs("div",{className:"vertebr-resource-edit-heading",children:[E.jsx("p",{className:"vertebr-resource-edit-eyebrow",children:"Editing record"}),E.jsx("h2",{children:pe}),E.jsx("p",{className:"vertebr-resource-edit-id",children:le})]}),E.jsx("button",{type:"button",className:"vertebr-btn",onClick:()=>x(null),children:"Back"})]}),E.jsx(tL,{variant:"record",schema:de,value:w,uploads:i,onUpload:m,galleryUpload:g,onListGallery:y,onUploadGallery:b,onSave:async me=>{await c(le,me),x(null)}})]})}const ve=E.jsxs("div",{className:"vertebr-table-toolbar",children:[E.jsxs("div",{className:"vertebr-table-toolbar-start",children:[Ce.length>0?E.jsx(SJ,{columns:Ce,visibility:Y,onChange:ce}):null,he?E.jsxs("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-icon",onClick:()=>_(!0),children:[E.jsx(OJ,{}),"Bulk upload"]}):null]}),j.overflow?E.jsxs("div",{className:"vertebr-table-scroll-controls",role:"group","aria-label":"Scroll columns",children:[E.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-icon vertebr-table-scroll-btn",disabled:!j.canLeft,onClick:()=>Se("left"),"aria-label":"Scroll columns left",children:E.jsx(RJ,{})}),E.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-quiet vertebr-btn-icon vertebr-table-scroll-btn",disabled:!j.canRight,onClick:()=>Se("right"),"aria-label":"Scroll columns right",children:E.jsx(MJ,{})})]}):null]}),Ae=A&&i&&m?E.jsx(bJ,{uploads:i,canCreate:te,fieldLabels:Object.fromEntries(Object.keys(i).map(de=>[de,t[de]?.label??Mb(de)])),onClose:()=>_(!1),onUpload:m,onCreateFromUploads:te&&u?async(de,pe)=>{for(const me of pe){const Ee=_J(me.name??"Image");await u({[de]:me.url,name:Ee,title:Ee})}}:void 0}):null;return e.length===0?E.jsxs("div",{className:"vertebr-resource-body",children:[E.jsxs("div",{className:"vertebr-panel-head",children:[E.jsx("h2",{children:"Records"}),E.jsx("span",{className:"vertebr-count",children:"0"})]}),he||Ce.length>0?ve:null,E.jsx("div",{className:"vertebr-empty",children:"No rows yet."}),Ae]}):E.jsxs("div",{className:"vertebr-resource-body",children:[E.jsxs("div",{className:"vertebr-panel-head",children:[E.jsx("h2",{children:"Records"}),E.jsx("span",{className:"vertebr-count",children:e.length})]}),ve,E.jsx("div",{className:"vertebr-table-wrap",ref:I,"data-overflow":j.overflow?"true":void 0,"data-overflow-left":j.canLeft?"true":void 0,"data-overflow-right":j.canRight?"true":void 0,children:E.jsxs("table",{className:"vertebr-table",children:[E.jsx("thead",{children:K.getHeaderGroups().map(de=>E.jsx("tr",{children:de.headers.map(pe=>E.jsx("th",{className:pe.column.id==="_actions"?"vertebr-col-actions":void 0,children:pe.isPlaceholder?null:bR(pe.column.columnDef.header,pe.getContext())},pe.id))},de.id))}),E.jsx("tbody",{children:K.getRowModel().rows.map(de=>E.jsx("tr",{className:"vertebr-table-row-clickable",tabIndex:0,onClick:()=>T(de.original),onKeyDown:pe=>{(pe.key==="Enter"||pe.key===" ")&&(pe.preventDefault(),T(de.original))},children:de.getVisibleCells().map(pe=>E.jsx("td",{className:pe.column.id==="_actions"?"vertebr-col-actions":void 0,children:bR(pe.column.columnDef.cell,pe.getContext())},pe.id))},de.id))})]})}),k?E.jsx(EJ,{schema:t,row:k,title:CR(k,s),canEdit:X,onClose:()=>T(null),onEdit:()=>{x(k),T(null)}}):null,Ae]})}function RJ(){return E.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:E.jsx("path",{d:"m15 18-6-6 6-6"})})}function MJ(){return E.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:E.jsx("path",{d:"m9 18 6-6-6-6"})})}function OJ(){return E.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:[E.jsx("path",{d:"M16 5h6"}),E.jsx("path",{d:"M19 2v6"}),E.jsx("rect",{x:"3",y:"7",width:"14",height:"14",rx:"2"}),E.jsx("circle",{cx:"8.5",cy:"12.5",r:"1.5"}),E.jsx("path",{d:"m17 21-4.5-4.5L7 21"})]})}function NJ({theme:t,onChange:e}){return E.jsxs("div",{className:"vertebr-theme",children:[E.jsx("div",{className:"vertebr-nav-label",children:"Appearance"}),E.jsxs("div",{className:"vertebr-theme-toggle",role:"group","aria-label":"Color theme",children:[E.jsxs("button",{type:"button",className:"vertebr-theme-option","data-active":t==="light","aria-pressed":t==="light",onClick:()=>e("light"),children:[E.jsx(DJ,{}),"Light"]}),E.jsxs("button",{type:"button",className:"vertebr-theme-option","data-active":t==="dark","aria-pressed":t==="dark",onClick:()=>e("dark"),children:[E.jsx(IJ,{}),"Dark"]})]})]})}function DJ(){return E.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:[E.jsx("circle",{cx:"12",cy:"12",r:"4"}),E.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 IJ(){return E.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:E.jsx("path",{d:"M21 14.5A8.5 8.5 0 0 1 9.5 3 7 7 0 1 0 21 14.5z"})})}const LJ="vertebr:theme";function zJ(t){try{const e=localStorage.getItem(t);if(e==="light"||e==="dark")return e}catch{}return null}function PJ(t,e){try{localStorage.setItem(t,e)}catch{}}function jJ(t){document.documentElement.setAttribute("data-vb-theme",t)}function BJ(t=LJ){const[e,n]=R.useState(()=>zJ(t)??"dark");R.useEffect(()=>{jJ(e),PJ(t,e)},[e,t]);const r=R.useCallback(s=>{n(s)},[]),i=R.useCallback(()=>{n(s=>s==="dark"?"light":"dark")},[]);return{theme:e,setTheme:r,toggleTheme:i}}function TR(t){try{return localStorage.getItem(t)}catch{return null}}function Ob(t,e){try{localStorage.setItem(t,e)}catch{}}function _R(t){try{localStorage.removeItem(t)}catch{}}function $J({apiBase:t="/admin/api",title:e="Control plane",envStorageKey:n="vertebr:env",tokenStorageKey:r="vertebr:token",themeStorageKey:i="vertebr:theme",getAccessToken:s,authUserLabel:a,onSignOut:c}){const{theme:u,setTheme:f}=BJ(i),[p,m]=R.useState(()=>TR(n)??""),[g,y]=R.useState(()=>TR(r)??""),[b,w]=R.useState(g),x=R.useCallback(()=>p,[p]),k=R.useMemo(()=>$b({apiBase:t,getEnvironment:x,getAccessToken:s??(()=>g||null)}),[t,x,s,g]),[T,A]=R.useState(null),[_,O]=R.useState(null),[N,I]=R.useState({kind:"overview"}),[j,G]=R.useState(null),[Y,ce]=R.useState(null),[X,te]=R.useState(null),[ie,he]=R.useState(!1),[B,Z]=R.useState(null),[se,Se]=R.useState(!1),[Ce,z]=R.useState(null),[K,le]=R.useState(!0);R.useEffect(()=>{let ae=!1;return(async()=>{try{const Le=await k.getBootstrap();if(ae)return;A(Le);const It=Le.environments.map(ks=>ks.id),Yn=p&&It.includes(p)&&p||Le.defaultEnvironment;Yn!==p&&(m(Yn),Ob(n,Yn))}catch(Le){ae||z(Le instanceof Error?Le.message:"Failed to load bootstrap")}})(),()=>{ae=!0}},[k,p,n]),R.useEffect(()=>{if(!T||!p)return;let ae=!1;return(async()=>{try{le(!0),z(null);const Le=await k.getCatalog();if(ae)return;O(Le),I(It=>{if(It?.kind==="overview"||It?.kind==="gallery"&&Le.gallery||It?.kind==="resource"&&Le.resources.some(Jt=>Jt.id===It.id)||It?.kind==="config"&&Le.configs.some(Jt=>Jt.id===It.id))return It;if(Le.metrics)return{kind:"overview"};const Yn=Le.resources[0];if(Yn)return{kind:"resource",id:Yn.id};if(Le.gallery)return{kind:"gallery"};const ks=Le.configs[0];return ks?{kind:"config",id:ks.id}:{kind:"overview"}})}catch(Le){ae||(O(null),z(Le instanceof Error?Le.message:"Failed to load catalog"))}finally{ae||le(!1)}})(),()=>{ae=!0}},[k,T,p]),R.useEffect(()=>{if(!N||!_)return;let ae=!1;return(async()=>{try{if(z(null),N.kind==="overview"){he(!0);const Le=await k.getMetrics();ae||(te(Le),G(null),ce(null),Z(null))}else if(N.kind==="gallery"){Se(!0);const Le=await k.getGallery();ae||(Z(Le),G(null),ce(null),te(null))}else if(N.kind==="resource"){const Le=await k.listResource(N.id);ae||(G(Le),ce(null),te(null),Z(null))}else{const Le=await k.getConfig(N.id);ae||(ce(Le),G(null),te(null),Z(null))}}catch(Le){ae||z(Le instanceof Error?Le.message:"Failed to load panel")}finally{ae||(he(!1),Se(!1))}})(),()=>{ae=!0}},[k,N,_,p]);const ve=R.useCallback(async()=>{if(N?.kind!=="resource")return;const ae=await k.listResource(N.id);G(ae)},[k,N]),Ae=R.useCallback(async()=>{he(!0);try{const ae=await k.getMetrics();te(ae)}finally{he(!1)}},[k]),de=R.useCallback(async()=>{Se(!0);try{const ae=await k.getGallery({fresh:!0});Z(ae)}finally{Se(!1)}},[k]),pe=R.useCallback(async()=>(await k.getGallery()).items,[k]),me=R.useCallback(async ae=>{if(ae.length===1&&ae[0]){const{item:It}=await k.uploadGalleryFile(ae[0]);return[It]}const{items:Le}=await k.uploadGalleryFiles(ae);return Le},[k]),Ee=_?.gallery?{galleryUpload:{accept:_.gallery.accept,maxBytes:_.gallery.maxBytes},onListGallery:pe,onUploadGallery:me}:{},it=_?.environments??T?.environments??[],Ke=it.find(ae=>ae.id===p),Qe=!!Ke?.auth?.required,$t=(N?.kind==="config"?_?.configs.find(ae=>ae.id===N.id):void 0)?.section==="page",Wt=ae=>{if(ae===p)return;const Le=it.find(It=>It.id===ae);Le?.tone==="danger"&&!window.confirm(`Switch to ${Le.label}? Writes will affect this environment.`)||(Ob(n,ae),m(ae),G(null),ce(null),Z(null))},Hr=()=>{const ae=b.trim();y(ae),ae?Ob(r,ae):_R(r)},Ur=()=>{y(""),w(""),_R(r)};if(!T&&K)return E.jsx("div",{className:"vertebr-loading",children:"Loading Vertebr…"});if(Ce&&!T)return E.jsx("div",{className:"vertebr-error",children:Ce});const Fr=N?.kind==="overview"?_?.metrics?.label??"Overview":N?.kind==="gallery"?_?.gallery?.label??"Gallery":N?.kind==="resource"?_?.resources.find(ae=>ae.id===N.id)?.label:N?.kind==="config"?_?.configs.find(ae=>ae.id===N.id)?.label:null;return E.jsxs("div",{className:"vertebr-root","data-env":p,children:[E.jsxs("aside",{className:"vertebr-sidebar",children:[E.jsxs("div",{className:"vertebr-sidebar-top",children:[E.jsxs("div",{className:"vertebr-brand",children:[E.jsx("strong",{children:T?.brand??_?.brand??"Vertebr"}),E.jsx("span",{children:e})]}),it.length>0?E.jsxs("div",{className:"vertebr-env",children:[E.jsx("div",{className:"vertebr-nav-label",children:"Environment"}),E.jsx(kX,{environments:it,value:p,onChange:Wt})]}):null,E.jsxs("nav",{className:"vertebr-nav",children:[_?.metrics?E.jsxs("div",{className:"vertebr-nav-group",children:[E.jsx("div",{className:"vertebr-nav-label",children:"Analytics"}),E.jsx("button",{type:"button","data-active":N?.kind==="overview",onClick:()=>I({kind:"overview"}),children:_.metrics.label})]}):null,_&&(_.resources.length>0||_.gallery)?E.jsxs("div",{className:"vertebr-nav-group",children:[E.jsx("div",{className:"vertebr-nav-label",children:"Resources"}),_.resources.map(ae=>E.jsx("button",{type:"button","data-active":N?.kind==="resource"&&N.id===ae.id,onClick:()=>I({kind:"resource",id:ae.id}),children:ae.label},ae.id)),_.gallery?E.jsx("button",{type:"button","data-active":N?.kind==="gallery",onClick:()=>I({kind:"gallery"}),children:_.gallery.label}):null]}):null,_&&_.configs.some(ae=>(ae.section??"config")!=="page")?E.jsxs("div",{className:"vertebr-nav-group",children:[E.jsx("div",{className:"vertebr-nav-label",children:"Config"}),_.configs.filter(ae=>(ae.section??"config")!=="page").map(ae=>E.jsx("button",{type:"button","data-active":N?.kind==="config"&&N.id===ae.id,onClick:()=>I({kind:"config",id:ae.id}),children:ae.label},ae.id))]}):null,_&&_.configs.some(ae=>ae.section==="page")?E.jsxs("div",{className:"vertebr-nav-group",children:[E.jsx("div",{className:"vertebr-nav-label",children:"Pages"}),_.configs.filter(ae=>ae.section==="page").map(ae=>E.jsx("button",{type:"button","data-active":N?.kind==="config"&&N.id===ae.id,onClick:()=>I({kind:"config",id:ae.id}),children:ae.label},ae.id))]}):null]})]}),E.jsxs("div",{className:"vertebr-sidebar-bottom",children:[s&&a?E.jsxs("div",{className:"vertebr-auth",children:[E.jsx("div",{className:"vertebr-nav-label",children:"Signed in"}),E.jsx("p",{className:"vertebr-auth-hint",children:a}),c?E.jsx("button",{type:"button",className:"vertebr-btn",onClick:()=>{c()},children:"Sign out"}):null]}):null,!s&&(Qe||g)?E.jsxs("div",{className:"vertebr-auth",children:[E.jsx("div",{className:"vertebr-nav-label",children:"Access"}),E.jsx("p",{className:"vertebr-auth-hint",children:Qe?`This environment requires auth${Ke?.auth?.claimKey?` (${Ke.auth.claimKey})`:""}.`:"Optional access token for protected environments."}),E.jsx("input",{className:"vertebr-auth-input",type:"password",placeholder:"Bearer token",value:b,onChange:ae=>w(ae.target.value),autoComplete:"off"}),E.jsxs("div",{className:"vertebr-auth-actions",children:[E.jsx("button",{type:"button",className:"vertebr-btn vertebr-btn-primary",onClick:Hr,children:"Use token"}),g?E.jsx("button",{type:"button",className:"vertebr-btn",onClick:Ur,children:"Clear"}):null]})]}):null,E.jsx(NJ,{theme:u,onChange:f})]})]}),E.jsxs("main",{className:"vertebr-main",children:[E.jsxs("header",{className:"vertebr-header",children:[E.jsxs("div",{children:[E.jsxs("div",{className:"vertebr-heading-row",children:[E.jsx("h1",{children:Fr??(_?"Dashboard":"Sign in")}),Ke?E.jsx("span",{className:"vertebr-env-badge","data-tone":Ke.tone??"neutral",children:Ke.label}):null]}),E.jsx("p",{children:!_&&Qe?"Provide an access token to load this environment.":N?.kind==="overview"?"Live metrics for the selected environment.":N?.kind==="gallery"?"Browse and upload shared media assets.":N?.kind==="resource"?"Manage records scoped to the selected environment.":N?.kind==="config"?$t?"Edit content for this page.":"Owner-managed config for this environment.":"Select a panel."})]}),Ce?E.jsx("span",{className:"vertebr-status","data-tone":"danger",children:Ce}):null]}),E.jsx("div",{className:"vertebr-content",children:_?E.jsxs("section",{className:"vertebr-panel",children:[N?.kind==="overview"?E.jsx(_X,{label:X?.label??_.metrics?.label,metrics:X?.metrics??[],loading:ie,onRefresh:()=>{Ae()}}):null,N?.kind==="gallery"&&B?E.jsx(TX,{label:B.label,items:B.items,accept:B.accept,maxBytes:B.maxBytes,canDelete:B.canDelete,loading:se,onRefresh:()=>{de()},onUpload:async ae=>{ae.length===1&&ae[0]?await k.uploadGalleryFile(ae[0]):await k.uploadGalleryFiles(ae),await de()},onDelete:B.canDelete?async ae=>{await k.deleteGalleryItem(ae),await de()}:void 0}):null,N?.kind==="resource"&&j?E.jsx(AJ,{schema:j.schema,items:j.items,permissions:j.permissions,actions:j.actions,uploads:j.uploads,storageKey:j.id,onUpdate:j.permissions.update?async(ae,Le)=>{await k.updateResource(j.id,ae,Le),await ve()}:void 0,onCreate:j.permissions.create?async ae=>{await k.createResource(j.id,ae),await ve()}:void 0,onDelete:j.permissions.delete?async ae=>{await k.deleteResource(j.id,ae),await ve()}:void 0,onAction:async(ae,Le)=>{await k.runResourceAction(j.id,ae,Le),await ve()},onUpload:j.uploads?async(ae,Le)=>{if(Le.length===1&&Le[0]){const Yn=await k.uploadResourceFile(j.id,ae,Le[0]);return[{url:Yn.url,name:Yn.name}]}return(await k.uploadResourceFiles(j.id,ae,Le)).files}:void 0,...Ee}):null,N?.kind==="config"&&Y?E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"vertebr-panel-head",children:[E.jsx("h2",{children:$t?"Page content":"Settings"}),E.jsxs("span",{className:"vertebr-count",children:[Object.keys(Y.schema).length," fields"]})]}),E.jsx(tL,{schema:Y.schema,value:Y.value,onSave:async ae=>{const Le=await k.setConfig(Y.id,ae);ce({...Y,value:Le.value})},...Ee})]}):null]}):E.jsx("section",{className:"vertebr-panel",children:E.jsx("div",{className:"vertebr-empty",children:Qe?"Authenticated access required for this environment.":K?"Loading…":"Unable to load catalog."})})})]})]})}R.createContext(null);const Nb="/admin/api";function VJ(t){const e=t.environments.map(r=>r.auth?.client).find(r=>r?.provider==="firebase");if(!e)return null;const n=Xj().length?HR():VR(e.config);return S3(n)}function HJ(){const[t,e]=R.useState(null),[n,r]=R.useState(null),[i,s]=R.useState(null),[a,c]=R.useState(!1),[u,f]=R.useState("idle"),[p,m]=R.useState(""),[g,y]=R.useState(""),[b,w]=R.useState(null),[x,k]=R.useState(!1),T=R.useMemo(()=>$b({apiBase:Nb,getEnvironment:()=>""}),[]);R.useEffect(()=>{let N=!1;return T.getBootstrap().then(I=>{if(N)return;e(I);const j=VJ(I);r(j),j||c(!0)}).catch(I=>{N||(w(I instanceof Error?I.message:"Could not load auth"),c(!0))}),()=>{N=!0}},[T]),R.useEffect(()=>{if(n)return c$(n,N=>{s(N),f(N?"checking":"idle"),c(!0)})},[n]),R.useEffect(()=>{if(!t||!i)return;let N=!1;return(async()=>{f("checking");const I=localStorage.getItem("vertebr:env"),j=[...I?[I]:[],...t.environments.map(G=>G.id)].filter((G,Y,ce)=>ce.indexOf(G)===Y);for(const G of j)try{await $b({apiBase:Nb,getEnvironment:()=>G,getAccessToken:()=>i.getIdToken()}).getCatalog(),N||(localStorage.setItem("vertebr:env",G),f("allowed"));return}catch{}N||f("denied")})(),()=>{N=!0}},[t,i]);const A=t?.environments.map(N=>N.auth?.client).find(N=>N?.provider==="firebase")?.methods??["email"],_=async N=>{if(N.preventDefault(),!!n){k(!0),w(null);try{await o$(n,p.trim(),g)}catch(I){w(I instanceof Error?I.message:"Sign-in failed")}finally{k(!1)}}},O=async()=>{if(n){k(!0),w(null);try{await R$(n,new ts)}catch(N){w(N instanceof Error?N.message:"Sign-in failed")}finally{k(!1)}}};return a?!n||!t?E.jsx("div",{className:"vertebr-error",children:b??"No browser auth provider is configured."}):i?u==="checking"||u==="idle"?E.jsx("div",{className:"vertebr-loading",children:"Checking admin access…"}):u==="denied"?E.jsx("main",{className:"vertebr-login",children:E.jsxs("section",{className:"vertebr-login-card",children:[E.jsxs("div",{className:"vertebr-brand",children:[E.jsx("strong",{children:t.brand}),E.jsx("span",{children:"Access denied"})]}),E.jsxs("div",{children:[E.jsx("h1",{children:"Administrator access required"}),E.jsxs("p",{children:["Signed in as ",i.email??i.uid,", but this account is not approved for any Vertebr environment."]})]}),E.jsx("button",{className:"vertebr-btn",type:"button",onClick:()=>{WE(n)},children:"Sign out"})]})}):E.jsx($J,{apiBase:Nb,title:"Owner control plane",getAccessToken:()=>i.getIdToken(),authUserLabel:i.email??i.uid,onSignOut:()=>WE(n)}):E.jsx("main",{className:"vertebr-login",children:E.jsxs("section",{className:"vertebr-login-card",children:[E.jsxs("div",{className:"vertebr-brand",children:[E.jsx("strong",{children:t.brand}),E.jsx("span",{children:"Admin access"})]}),E.jsxs("div",{children:[E.jsx("h1",{children:"Sign in"}),E.jsx("p",{children:"Use an approved administrator account. Storefront accounts do not receive dashboard access."})]}),A.includes("email")?E.jsxs("form",{className:"vertebr-login-form",onSubmit:_,children:[E.jsxs("label",{className:"vertebr-field",children:[E.jsx("span",{children:"Email"}),E.jsx("input",{type:"email",autoComplete:"username",required:!0,value:p,onChange:N=>m(N.target.value)})]}),E.jsxs("label",{className:"vertebr-field",children:[E.jsx("span",{children:"Password"}),E.jsx("input",{type:"password",autoComplete:"current-password",required:!0,value:g,onChange:N=>y(N.target.value)})]}),E.jsx("button",{className:"vertebr-btn vertebr-btn-primary",type:"submit",disabled:x,children:x?"Signing in…":"Sign in"})]}):null,A.includes("google")?E.jsx("button",{className:"vertebr-btn",type:"button",disabled:x,onClick:()=>{O()},children:"Continue with Google"}):null,b?E.jsx("p",{className:"vertebr-status","data-tone":"danger",children:b}):null]})}):E.jsx("div",{className:"vertebr-loading",children:"Checking admin session…"})}RP.createRoot(document.getElementById("root")).render(E.jsx(R.StrictMode,{children:E.jsx(HJ,{})}));
|