astro-md-editor 0.0.3 → 0.0.5
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/.output/nitro.json +1 -1
- package/.output/public/assets/index-UQt6zCrS.js +334 -0
- package/.output/public/assets/{main-_miJG8oz.js → main-DzXOjsqg.js} +1 -1
- package/.output/public/assets/styles-CezfLgHY.css +1 -0
- package/.output/server/{__root-C4T8UKZy.mjs → __root-CL_tq3ov.mjs} +1 -1
- package/.output/server/_libs/mixmark-io__domino.mjs +16632 -0
- package/.output/server/_libs/turndown.mjs +687 -675
- package/.output/server/_ssr/IconPickerPopover-fNUx2jAc.mjs +125 -0
- package/.output/server/_ssr/{ImageAssetBrowser-DWEdNK_g.mjs → ImageAssetBrowser-DNDdTqtf.mjs} +2 -2
- package/.output/server/_ssr/{collections.server-DyZEpKg6.mjs → collections.server-s12asITg.mjs} +24 -1
- package/.output/server/_ssr/{file-history.api-BLrUovD8.mjs → file-history.api-oydnxFVV.mjs} +8 -2
- package/.output/server/_ssr/{image-assets.server-Dn044pdj.mjs → image-assets.server-Ci2E1_Tm.mjs} +4 -2
- package/.output/server/_ssr/{image-preview.api-bqd1erIP.mjs → image-preview.api-pcN5PQhH.mjs} +2 -2
- package/.output/server/_ssr/{index-wJDNoCM2.mjs → index-BjQuGIib.mjs} +7 -2
- package/.output/server/_ssr/{index-2cOxFkCu.mjs → index-Bn1uKwTu.mjs} +527 -97
- package/.output/server/_ssr/index.mjs +17 -11
- package/.output/server/_ssr/{router-sxRLAh5a.mjs → router-dPC3iVPs.mjs} +2 -2
- package/.output/server/{_tanstack-start-manifest_v-CWdBk-ge.mjs → _tanstack-start-manifest_v-Da8tuNDH.mjs} +1 -1
- package/.output/server/index.mjs +50 -50
- package/LICENSE.md +21 -0
- package/README.md +71 -69
- package/package.json +3 -2
- package/scripts/bootstrap-collections.mjs +59 -13
- package/.output/public/assets/index-DVVq2QjK.js +0 -334
- package/.output/public/assets/styles-yeMm8TG7.css +0 -1
|
@@ -1,334 +0,0 @@
|
|
|
1
|
-
import{r as S,u as on,R as $w,j as M,a as dp,b as lr,c as Sn,T as ss,d as LT,w as Dw,e as it,f as Me,L as Nr,g as ce,h as jT,i as vo,k as wo,t as Mr,l as zw,m as FT,n as _g}from"./main-_miJG8oz.js";function Lw(t){const e=S.useRef(!0);e.current&&(e.current=!1,t())}const BT=()=>{},me=typeof document<"u"?S.useLayoutEffect:BT;function Zt(t,...e){const n=new URL("https://base-ui.com/production-error");return n.searchParams.set("code",t.toString()),e.forEach(r=>n.searchParams.append("args[]",r)),`Base UI error #${t}; visit ${n} for the full message.`}function ed(){return typeof window<"u"}function ko(t){return fp(t)?(t.nodeName||"").toLowerCase():"#document"}function Mt(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function dr(t){var e;return(e=(fp(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function fp(t){return ed()?t instanceof Node||t instanceof Mt(t).Node:!1}function et(t){return ed()?t instanceof Element||t instanceof Mt(t).Element:!1}function gt(t){return ed()?t instanceof HTMLElement||t instanceof Mt(t).HTMLElement:!1}function nh(t){return!ed()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Mt(t).ShadowRoot}function xo(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=Cn(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&o!=="inline"&&o!=="contents"}function VT(t){return/^(table|td|th)$/.test(ko(t))}function td(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const HT=/transform|translate|scale|rotate|perspective|filter/,WT=/paint|layout|strict|content/,Io=t=>!!t&&t!=="none";let Vd;function hp(t){const e=et(t)?Cn(t):t;return Io(e.transform)||Io(e.translate)||Io(e.scale)||Io(e.rotate)||Io(e.perspective)||!nd()&&(Io(e.backdropFilter)||Io(e.filter))||HT.test(e.willChange||"")||WT.test(e.contain||"")}function qT(t){let e=$r(t);for(;gt(e)&&!Pr(e);){if(hp(e))return e;if(td(e))return null;e=$r(e)}return null}function nd(){return Vd==null&&(Vd=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Vd}function Pr(t){return/^(html|body|#document)$/.test(ko(t))}function Cn(t){return Mt(t).getComputedStyle(t)}function rd(t){return et(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function $r(t){if(ko(t)==="html")return t;const e=t.assignedSlot||t.parentNode||nh(t)&&t.host||dr(t);return nh(e)?e.host:e}function jw(t){const e=$r(t);return Pr(e)?t.ownerDocument?t.ownerDocument.body:t.body:gt(e)&&xo(e)?e:jw(e)}function ro(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=jw(t),s=o===((r=t.ownerDocument)==null?void 0:r.body),i=Mt(o);if(s){const a=rh(i);return e.concat(i,i.visualViewport||[],xo(o)?o:[],a&&n?ro(a):[])}else return e.concat(o,ro(o,[],n))}function rh(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Dt(t){const e=on(UT,t).current;return e.next=t,me(e.effect),e}function UT(t){const e={current:t,next:t,effect:()=>{e.current=e.next}};return e}const Hd=$w[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],KT=Hd&&Hd!==S.useLayoutEffect?Hd:t=>t();function de(t){const e=on(YT).current;return e.next=t,KT(e.effect),e.trampoline}function YT(){const t={next:void 0,callback:ZT,trampoline:(...e)=>t.callback?.(...e),effect:()=>{t.callback=t.next}};return t}function ZT(){}function Ke(t){return t?.ownerDocument||document}const Ti=typeof navigator<"u",Wd=XT(),Fw=eM(),Bw=QT(),pp=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),Vw=Wd.platform==="MacIntel"&&Wd.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Wd.platform),GT=Ti&&/apple/i.test(navigator.vendor),oh=Ti&&/android/i.test(Fw)||/android/i.test(Bw);Ti&&Fw.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const JT=Bw.includes("jsdom/");function XT(){if(!Ti)return{platform:"",maxTouchPoints:-1};const t=navigator.userAgentData;return t?.platform?{platform:t.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function QT(){if(!Ti)return"";const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(({brand:e,version:n})=>`${e}/${n}`).join(" "):navigator.userAgent}function eM(){if(!Ti)return"";const t=navigator.userAgentData;return t?.platform?t.platform:navigator.platform??""}const sh="data-base-ui-focusable",Hw="active",Ww="selected",qw="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",oo="ArrowLeft",so="ArrowRight",mp="ArrowUp",Ha="ArrowDown";function Hn(t){let e=t.activeElement;for(;e?.shadowRoot?.activeElement!=null;)e=e.shadowRoot.activeElement;return e}function Fe(t,e){if(!t||!e)return!1;const n=e.getRootNode?.();if(t.contains(e))return!0;if(n&&nh(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Uw(t,e){if(!et(t))return!1;const n=t;if(e.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,r]of e.entries())if(Fe(r,n))return!r.hasAttribute("data-trigger-disabled");return!1}function vn(t){return"composedPath"in t?t.composedPath()[0]:t.target}function Fn(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function tM(t){return t.matches("html,body")}function gp(t){return gt(t)&&t.matches(qw)}function ih(t){return t?t.getAttribute("role")==="combobox"&&gp(t):!1}function wa(t){return t?t.hasAttribute(sh)?t:t.querySelector(`[${sh}]`)||t:null}function Xo(t,e,n=!0){return t.filter(o=>o.parentId===e&&(!n||o.context?.open)).flatMap(o=>[o,...Xo(t,o.id,n)])}function Ng(t,e){let n=[],r=t.find(o=>o.id===e)?.parentId;for(;r;){const o=t.find(s=>s.id===r);r=o?.parentId,o&&(n=n.concat(o))}return n}function Ut(t){t.preventDefault(),t.stopPropagation()}function nM(t){return"nativeEvent"in t}function Kw(t){return t.pointerType===""&&t.isTrusted?!0:oh&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function Yw(t){return JT?!1:!oh&&t.width===0&&t.height===0||oh&&t.width===1&&t.height===1&&t.pressure===0&&t.detail===0&&t.pointerType==="mouse"||t.width<1&&t.height<1&&t.pressure===0&&t.detail===0&&t.pointerType==="touch"}function li(t,e){const n=["mouse","pen"];return e||n.push("",void 0),n.includes(t)}function Zw(t){const e=t.type;return e==="click"||e==="mousedown"||e==="keydown"||e==="keyup"}const rM=["top","right","bottom","left"],ci=Math.min,wn=Math.max,Ac=Math.round,Hs=Math.floor,ar=t=>({x:t,y:t}),oM={left:"right",right:"left",bottom:"top",top:"bottom"};function ah(t,e,n){return wn(t,ci(e,n))}function Dr(t,e){return typeof t=="function"?t(e):t}function hn(t){return t.split("-")[0]}function So(t){return t.split("-")[1]}function yp(t){return t==="x"?"y":"x"}function bp(t){return t==="y"?"height":"width"}function In(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function vp(t){return yp(In(t))}function sM(t,e,n){n===void 0&&(n=!1);const r=So(t),o=vp(t),s=bp(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(i=Ic(i)),[i,Ic(i)]}function iM(t){const e=Ic(t);return[lh(t),e,lh(e)]}function lh(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Pg=["left","right"],Ag=["right","left"],aM=["top","bottom"],lM=["bottom","top"];function cM(t,e,n){switch(t){case"top":case"bottom":return n?e?Ag:Pg:e?Pg:Ag;case"left":case"right":return e?aM:lM;default:return[]}}function uM(t,e,n,r){const o=So(t);let s=cM(hn(t),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),e&&(s=s.concat(s.map(lh)))),s}function Ic(t){const e=hn(t);return oM[e]+t.slice(e.length)}function dM(t){return{top:0,right:0,bottom:0,left:0,...t}}function Gw(t){return typeof t!="number"?dM(t):{top:t,right:t,bottom:t,left:t}}function $c(t){const{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}function rl(t,e,n){return Math.floor(t/e)!==n}function Ys(t,e){return e<0||e>=t.current.length}function Ec(t,e){return Bt(t,{disabledIndices:e})}function ch(t,e){return Bt(t,{decrement:!0,startingIndex:t.current.length,disabledIndices:e})}function Bt(t,{startingIndex:e=-1,decrement:n=!1,disabledIndices:r,amount:o=1}={}){let s=e;do s+=n?-o:o;while(s>=0&&s<=t.current.length-1&&io(t,s,r));return s}function Jw(t,{event:e,orientation:n,loopFocus:r,rtl:o,cols:s,disabledIndices:i,minIndex:a,maxIndex:l,prevIndex:c,stopEvent:u=!1}){let d=c;const f=[],h={};let p=!1;{let y=null,b=-1;t.current.forEach((w,k)=>{if(w==null)return;const v=w.closest('[role="row"]');v&&(p=!0),(v!==y||b===-1)&&(y=v,b+=1,f[b]=[]),f[b].push(k),h[k]=b})}const g=p&&f.length>0&&f.some(y=>y.length!==s);function m(y){if(!g||c===-1)return;const b=h[c];if(b==null)return;const w=f[b].indexOf(c);let k=y==="up"?b-1:b+1;r&&(k<0?k=f.length-1:k>=f.length&&(k=0));const v=new Set;for(;k>=0&&k<f.length&&!v.has(k);){v.add(k);const x=f[k];if(x.length===0){k=y==="up"?k-1:k+1;continue}const E=Math.min(w,x.length-1);for(let C=E;C>=0;C-=1){const A=x[C];if(!io(t,A,i))return A}k=y==="up"?k-1:k+1,r&&(k<0?k=f.length-1:k>=f.length&&(k=0))}}if(e.key===mp){const y=m("up");if(y!==void 0)u&&Ut(e),d=y;else{if(u&&Ut(e),c===-1)d=l;else if(d=Bt(t,{startingIndex:d,amount:s,decrement:!0,disabledIndices:i}),r&&(c-s<a||d<0)){const b=c%s,w=l%s,k=l-(w-b);w===b?d=l:d=w>b?k:k-s}Ys(t,d)&&(d=c)}}if(e.key===Ha){const y=m("down");y!==void 0?(u&&Ut(e),d=y):(u&&Ut(e),c===-1?d=a:(d=Bt(t,{startingIndex:c,amount:s,disabledIndices:i}),r&&c+s>l&&(d=Bt(t,{startingIndex:c%s-s,amount:s,disabledIndices:i}))),Ys(t,d)&&(d=c))}if(n==="both"){const y=Hs(c/s);e.key===(o?oo:so)&&(u&&Ut(e),c%s!==s-1?(d=Bt(t,{startingIndex:c,disabledIndices:i}),r&&rl(d,s,y)&&(d=Bt(t,{startingIndex:c-c%s-1,disabledIndices:i}))):r&&(d=Bt(t,{startingIndex:c-c%s-1,disabledIndices:i})),rl(d,s,y)&&(d=c)),e.key===(o?so:oo)&&(u&&Ut(e),c%s!==0?(d=Bt(t,{startingIndex:c,decrement:!0,disabledIndices:i}),r&&rl(d,s,y)&&(d=Bt(t,{startingIndex:c+(s-c%s),decrement:!0,disabledIndices:i}))):r&&(d=Bt(t,{startingIndex:c+(s-c%s),decrement:!0,disabledIndices:i})),rl(d,s,y)&&(d=c));const b=Hs(l/s)===y;Ys(t,d)&&(r&&b?d=e.key===(o?so:oo)?l:Bt(t,{startingIndex:c-c%s-1,disabledIndices:i}):d=c)}return d}function Xw(t,e,n){const r=[];let o=0;return t.forEach(({width:s,height:i},a)=>{let l=!1;for(n&&(o=0);!l;){const c=[];for(let u=0;u<s;u+=1)for(let d=0;d<i;d+=1)c.push(o+u+d*e);o%e+s<=e&&c.every(u=>r[u]==null)?(c.forEach(u=>{r[u]=a}),l=!0):o+=1}}),[...r]}function Qw(t,e,n,r,o){if(t===-1)return-1;const s=n.indexOf(t),i=e[t];switch(o){case"tl":return s;case"tr":return i?s+i.width-1:s;case"bl":return i?s+(i.height-1)*r:s;case"br":return n.lastIndexOf(t);default:return-1}}function ek(t,e){return e.flatMap((n,r)=>t.includes(n)?[r]:[])}function io(t,e,n){if(typeof n=="function")return n(e);if(n)return n.includes(e);const r=t.current[e];return r?r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true":!1}var fM=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],Dc=fM.join(","),tk=typeof Element>"u",ui=tk?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,zc=!tk&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},Lc=function(e,n){var r;n===void 0&&(n=!0);var o=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),s=o===""||o==="true",i=s||n&&e&&(typeof e.closest=="function"?e.closest("[inert]"):Lc(e.parentNode));return i},hM=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},nk=function(e,n,r){if(Lc(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(Dc));return n&&ui.call(e,Dc)&&o.unshift(e),o=o.filter(r),o},jc=function(e,n,r){for(var o=[],s=Array.from(e);s.length;){var i=s.shift();if(!Lc(i,!1))if(i.tagName==="SLOT"){var a=i.assignedElements(),l=a.length?a:i.children,c=jc(l,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:i,candidates:c})}else{var u=ui.call(i,Dc);u&&r.filter(i)&&(n||!e.includes(i))&&o.push(i);var d=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),f=!Lc(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(d&&f){var h=jc(d===!0?i.children:d.children,!0,r);r.flatten?o.push.apply(o,h):o.push({scopeParent:i,candidates:h})}else s.unshift.apply(s,i.children)}}return o},rk=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},ok=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||hM(e))&&!rk(e)?0:e.tabIndex},pM=function(e,n){var r=ok(e);return r<0&&n&&!rk(e)?0:r},mM=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},sk=function(e){return e.tagName==="INPUT"},gM=function(e){return sk(e)&&e.type==="hidden"},yM=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},bM=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},vM=function(e){if(!e.name)return!0;var n=e.form||zc(e),r=function(a){return n.querySelectorAll('input[type="radio"][name="'+a+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(e.name));else try{o=r(e.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=bM(o,e.form);return!s||s===e},wM=function(e){return sk(e)&&e.type==="radio"},kM=function(e){return wM(e)&&!vM(e)},xM=function(e){var n,r=e&&zc(e),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==e){var i,a,l;for(s=!!((i=o)!==null&&i!==void 0&&(a=i.ownerDocument)!==null&&a!==void 0&&a.contains(o)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!s&&o;){var c,u,d;r=zc(o),o=(c=r)===null||c===void 0?void 0:c.host,s=!!((u=o)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return s},Ig=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},SM=function(e,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var s=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(e).visibility==="hidden")return!0;var i=ui.call(e,"details>summary:first-of-type"),a=i?e.parentElement:e;if(ui.call(a,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var l=e;e;){var c=e.parentElement,u=zc(e);if(c&&!c.shadowRoot&&o(c)===!0)return Ig(e);e.assignedSlot?e=e.assignedSlot:!c&&u!==e.ownerDocument?e=u.host:e=c}e=l}if(xM(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Ig(e);return!1},EM=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return ui.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},uh=function(e,n){return!(n.disabled||gM(n)||SM(n,e)||yM(n)||EM(n))},dh=function(e,n){return!(kM(n)||ok(n)<0||!uh(e,n))},CM=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},ik=function(e){var n=[],r=[];return e.forEach(function(o,s){var i=!!o.scopeParent,a=i?o.scopeParent:o,l=pM(a,i),c=i?ik(o.candidates):a;l===0?i?n.push.apply(n,c):n.push(a):r.push({documentOrder:s,tabIndex:l,item:o,isScope:i,content:c})}),r.sort(mM).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},Wa=function(e,n){n=n||{};var r;return n.getShadowRoot?r=jc([e],n.includeContainer,{filter:dh.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:CM}):r=nk(e,n.includeContainer,dh.bind(null,n)),ik(r)},TM=function(e,n){n=n||{};var r;return n.getShadowRoot?r=jc([e],n.includeContainer,{filter:uh.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=nk(e,n.includeContainer,uh.bind(null,n)),r},ak=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return ui.call(e,Dc)===!1?!1:dh(n,e)};const Mi=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function lk(t,e){const n=Wa(t,Mi()),r=n.length;if(r===0)return;const o=Hn(Ke(t)),s=n.indexOf(o),i=s===-1?e===1?0:r-1:s+e;return n[i]}function wp(t){return lk(Ke(t).body,1)||t}function ck(t){return lk(Ke(t).body,-1)||t}function uk(t,e){if(!t)return null;const n=Wa(Ke(t).body,Mi()),r=n.length;if(r===0)return null;const o=n.indexOf(t);if(o===-1)return null;const s=(o+e+r)%r;return n[s]}function MM(t){return uk(t,1)}function RM(t){return uk(t,-1)}function Zs(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!Fe(n,r)}function OM(t){Wa(t,Mi()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function $g(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const _M={...$w};let Dg=0;function NM(t,e="mui"){const[n,r]=S.useState(t),o=t||n;return S.useEffect(()=>{n==null&&(Dg+=1,r(`${e}-${Dg}`))},[n,e]),o}const zg=_M.useId;function Ri(t,e){if(zg!==void 0){const n=zg();return t??(e?`${e}-${n}`:n)}return NM(t,e)}function dk(){const t=new Map;return{emit(e,n){t.get(e)?.forEach(r=>r(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){t.get(e)?.delete(n)}}}class PM{nodesRef={current:[]};events=dk();addNode(e){this.nodesRef.current.push(e)}removeNode(e){const n=this.nodesRef.current.findIndex(r=>r===e);n!==-1&&this.nodesRef.current.splice(n,1)}}const fk=S.createContext(null),hk=S.createContext(null),Eo=()=>S.useContext(fk)?.id||null,ys=t=>{const e=S.useContext(hk);return t??e};function AM(t){const e=Ri(),n=ys(t),r=Eo();return me(()=>{if(!e)return;const o={id:e,parentId:r};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,e,r]),e}function IM(t){const{children:e,id:n}=t,r=Eo();return M.jsx(fk.Provider,{value:S.useMemo(()=>({id:n,parentId:r}),[n,r]),children:e})}function $M(t){const{children:e,externalTree:n}=t,r=on(()=>n??new PM).current;return M.jsx(hk.Provider,{value:r,children:e})}function dn(){}const ka=Object.freeze([]),At=Object.freeze({}),DM=500,zM={style:{transition:"none"}},pk="data-base-ui-click-trigger",LM={fallbackAxisSide:"none"},jM={fallbackAxisSide:"end"},FM={clipPath:"inset(50%)",position:"fixed",top:0,left:0},po="none",di="trigger-press",kn="trigger-hover",kp="outside-press",qd="item-press",BM="close-press",is="focus-out",mk="escape-key",Ud="list-navigation",VM="cancel-open",gk="imperative-action",HM="window-resize";function De(t,e,n,r){let o=!1,s=!1;const i=r??At;return{reason:t,event:e??new Event("base-ui"),cancel(){o=!0},allowPropagation(){s=!0},get isCanceled(){return o},get isPropagationAllowed(){return s},trigger:n,...i}}function xa(t){return`data-base-ui-${t}`}function Kd(t,e,n){if(n&&!li(n))return 0;if(typeof t=="number")return t;if(typeof t=="function"){const r=t();return typeof r=="number"?r:r?.[e]}return t?.[e]}function zr(t,e,n,r){const o=on(yk).current;return qM(o,t,e,n,r)&&bk(o,[t,e,n,r]),o.callback}function WM(t){const e=on(yk).current;return UM(e,t)&&bk(e,t),e.callback}function yk(){return{callback:null,cleanup:null,refs:[]}}function qM(t,e,n,r,o){return t.refs[0]!==e||t.refs[1]!==n||t.refs[2]!==r||t.refs[3]!==o}function UM(t,e){return t.refs.length!==e.length||t.refs.some((n,r)=>n!==e[r])}function bk(t,e){if(t.refs=e,e.every(n=>n==null)){t.callback=null;return}t.callback=n=>{if(t.cleanup&&(t.cleanup(),t.cleanup=null),n!=null){const r=Array(e.length).fill(null);for(let o=0;o<e.length;o+=1){const s=e[o];if(s!=null)switch(typeof s){case"function":{const i=s(n);typeof i=="function"&&(r[o]=i);break}case"object":{s.current=n;break}}}t.cleanup=()=>{for(let o=0;o<e.length;o+=1){const s=e[o];if(s!=null)switch(typeof s){case"function":{const i=r[o];typeof i=="function"?i():s(null);break}case"object":{s.current=null;break}}}}}}}const vk={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},od={...vk,position:"fixed",top:0,left:0},wk={...vk,position:"absolute"},ol=null;class KM{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let o=0;o<n.length;o+=1)n[o]?.(e)};request(e){const n=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(e){const n=e-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const sl=new KM;class or{static create(){return new or}static request(e){return sl.request(e)}static cancel(e){return sl.cancel(e)}currentId=ol;request(e){this.cancel(),this.currentId=sl.request(()=>{this.currentId=ol,e()})}cancel=()=>{this.currentId!==ol&&(sl.cancel(this.currentId),this.currentId=ol)};disposeEffect=()=>this.cancel}function sd(){const t=on(or.create).current;return dp(t.disposeEffect),t}const fi=S.forwardRef(function(e,n){const[r,o]=S.useState();me(()=>{GT&&o("button")},[]);const s={tabIndex:0,role:r};return M.jsx("span",{...e,ref:n,style:od,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})});let Lg=0;function sa(t,e={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=e;r&&cancelAnimationFrame(Lg);const s=()=>t?.focus({preventScroll:n});o?s():Lg=requestAnimationFrame(s)}const Gs={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function jg(t){return t==="inert"?Gs.inert:t==="aria-hidden"?Gs["aria-hidden"]:Gs.none}let il=new WeakSet,al={},Yd=0;const kk=t=>t&&(t.host||kk(t.parentNode)),YM=(t,e)=>e.map(n=>{if(t.contains(n))return n;const r=kk(n);return t.contains(r)?r:null}).filter(n=>n!=null);function ZM(t,e,n,r){const o="data-base-ui-inert",s=r?"inert":n?"aria-hidden":null,i=YM(e,t),a=new Set,l=new Set(i),c=[];al[o]||(al[o]=new WeakMap);const u=al[o];i.forEach(d),f(e),a.clear();function d(h){!h||a.has(h)||(a.add(h),h.parentNode&&d(h.parentNode))}function f(h){!h||l.has(h)||[].forEach.call(h.children,p=>{if(ko(p)!=="script")if(a.has(p))f(p);else{const g=s?p.getAttribute(s):null,m=g!==null&&g!=="false",y=jg(s),b=(y.get(p)||0)+1,w=(u.get(p)||0)+1;y.set(p,b),u.set(p,w),c.push(p),b===1&&m&&il.add(p),w===1&&p.setAttribute(o,""),!m&&s&&p.setAttribute(s,s==="inert"?"":"true")}})}return Yd+=1,()=>{c.forEach(h=>{const p=jg(s),m=(p.get(h)||0)-1,y=(u.get(h)||0)-1;p.set(h,m),u.set(h,y),m||(!il.has(h)&&s&&h.removeAttribute(s),il.delete(h)),y||h.removeAttribute(o)}),Yd-=1,Yd||(Gs.inert=new WeakMap,Gs["aria-hidden"]=new WeakMap,Gs.none=new WeakMap,il=new WeakSet,al={})}}function GM(t,e=!1,n=!1){const r=Ke(t[0]).body;return ZM(t.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,e,n)}const JM=parseInt(S.version,10);function xp(t){return JM>=t}function Fg(t){if(!S.isValidElement(t))return null;const e=t,n=e.props;return(xp(19)?n?.ref:e.ref)??null}function fh(t,e){if(t&&!e)return t;if(!t&&e)return e;if(t||e)return{...t,...e}}function XM(t,e){const n={};for(const r in t){const o=t[r];if(e?.hasOwnProperty(r)){const s=e[r](o);s!=null&&Object.assign(n,s);continue}o===!0?n[`data-${r.toLowerCase()}`]="":o&&(n[`data-${r.toLowerCase()}`]=o.toString())}return n}function QM(t,e){return typeof t=="function"?t(e):t}function eR(t,e){return typeof t=="function"?t(e):t}const ia={};function Oi(t,e,n,r,o){let s={...hh(t,ia)};return e&&(s=Zi(s,e)),n&&(s=Zi(s,n)),r&&(s=Zi(s,r)),o&&(s=Zi(s,o)),s}function tR(t){if(t.length===0)return ia;if(t.length===1)return hh(t[0],ia);let e={...hh(t[0],ia)};for(let n=1;n<t.length;n+=1)e=Zi(e,t[n]);return e}function Zi(t,e){return xk(e)?e(t):nR(t,e)}function nR(t,e){if(!e)return t;for(const n in e){const r=e[n];switch(n){case"style":{t[n]=fh(t.style,r);break}case"className":{t[n]=Sk(t.className,r);break}default:rR(n,r)?t[n]=oR(t[n],r):t[n]=r}}return t}function rR(t,e){const n=t.charCodeAt(0),r=t.charCodeAt(1),o=t.charCodeAt(2);return n===111&&r===110&&o>=65&&o<=90&&(typeof e=="function"||typeof e>"u")}function xk(t){return typeof t=="function"}function hh(t,e){return xk(t)?t(e):t??ia}function oR(t,e){return e?t?n=>{if(sR(n)){const o=n;ph(o);const s=e(o);return o.baseUIHandlerPrevented||t?.(o),s}const r=e(n);return t?.(n),r}:e:t}function ph(t){return t.preventBaseUIHandler=()=>{t.baseUIHandlerPrevented=!0},t}function Sk(t,e){return e?t?e+" "+t:e:t}function sR(t){return t!=null&&typeof t=="object"&&"nativeEvent"in t}function rt(t,e,n={}){const r=e.render,o=iR(e,n);if(n.enabled===!1)return null;const s=n.state??At;return lR(t,r,o,s)}function iR(t,e={}){const{className:n,style:r,render:o}=t,{state:s=At,ref:i,props:a,stateAttributesMapping:l,enabled:c=!0}=e,u=c?QM(n,s):void 0,d=c?eR(r,s):void 0,f=c?XM(s,l):At,h=c?fh(f,Array.isArray(a)?tR(a):a)??At:At;return typeof document<"u"&&(c?Array.isArray(i)?h.ref=WM([h.ref,Fg(o),...i]):h.ref=zr(h.ref,Fg(o),i):zr(null,null)),c?(u!==void 0&&(h.className=Sk(h.className,u)),d!==void 0&&(h.style=fh(h.style,d)),h):At}const aR=Symbol.for("react.lazy");function lR(t,e,n,r){if(e){if(typeof e=="function")return e(n,r);const o=Oi(n,e.props);o.ref=n.ref;let s=e;return s?.$$typeof===aR&&(s=S.Children.toArray(e)[0]),S.cloneElement(s,o)}if(t&&typeof t=="string")return cR(t,n);throw new Error(Zt(8))}function cR(t,e){return t==="button"?S.createElement("button",{type:"button",...e,key:e.key}):t==="img"?S.createElement("img",{alt:"",...e,key:e.key}):S.createElement(t,e)}const Ek=S.createContext(null),Ck=()=>S.useContext(Ek),uR=xa("portal");function dR(t={}){const{ref:e,container:n,componentProps:r=At,elementProps:o}=t,s=Ri(),a=Ck()?.portalNode,[l,c]=S.useState(null),[u,d]=S.useState(null),f=de(m=>{m!==null&&d(m)}),h=S.useRef(null);me(()=>{if(n===null){h.current&&(h.current=null,d(null),c(null));return}if(s==null)return;const m=(n&&(fp(n)?n:n.current))??a??document.body;if(m==null){h.current&&(h.current=null,d(null),c(null));return}h.current!==m&&(h.current=m,d(null),c(m))},[n,a,s]);const p=rt("div",r,{ref:[e,f],props:[{id:s,[uR]:""},o]});return{portalNode:u,portalSubtree:l&&p?lr.createPortal(p,l):null}}const Sp=S.forwardRef(function(e,n){const{children:r,container:o,className:s,render:i,renderGuards:a,...l}=e,{portalNode:c,portalSubtree:u}=dR({container:o,ref:n,componentProps:e,elementProps:l}),d=S.useRef(null),f=S.useRef(null),h=S.useRef(null),p=S.useRef(null),[g,m]=S.useState(null),y=g?.modal,b=g?.open,w=typeof a=="boolean"?a:!!g&&!g.modal&&g.open&&!!c;S.useEffect(()=>{if(!c||y)return;function v(x){c&&x.relatedTarget&&Zs(x)&&(x.type==="focusin"?$g:OM)(c)}return c.addEventListener("focusin",v,!0),c.addEventListener("focusout",v,!0),()=>{c.removeEventListener("focusin",v,!0),c.removeEventListener("focusout",v,!0)}},[c,y]),S.useEffect(()=>{!c||b||$g(c)},[b,c]);const k=S.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:h,afterInsideRef:p,portalNode:c,setFocusManagerState:m}),[c]);return M.jsxs(S.Fragment,{children:[u,M.jsxs(Ek.Provider,{value:k,children:[w&&c&&M.jsx(fi,{"data-type":"outside",ref:d,onFocus:v=>{if(Zs(v,c))h.current?.focus();else{const x=g?g.domReference:null;ck(x)?.focus()}}}),w&&c&&M.jsx("span",{"aria-owns":c.id,style:FM}),c&&lr.createPortal(r,c),w&&c&&M.jsx(fi,{"data-type":"outside",ref:f,onFocus:v=>{if(Zs(v,c))p.current?.focus();else{const x=g?g.domReference:null;wp(x)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,De(is,v.nativeEvent))}}})]})]})});function Er(t){return t==null?t:"current"in t?t.current:t}function fR(t,e){const n=Mt(t.target);return t instanceof n.KeyboardEvent?"keyboard":t instanceof n.FocusEvent?e||"keyboard":"pointerType"in t?t.pointerType||"keyboard":"touches"in t?"touch":t instanceof n.MouseEvent?e||(t.detail===0?"keyboard":"mouse"):""}const Bg=20;let Qr=[];function Ep(){Qr=Qr.filter(t=>t.deref()?.isConnected)}function hR(t){Ep(),t&&ko(t)!=="body"&&(Qr.push(new WeakRef(t)),Qr.length>Bg&&(Qr=Qr.slice(-Bg)))}function Zd(){return Ep(),Qr[Qr.length-1]?.deref()}function pR(t){if(!t)return null;const e=Mi();return ak(t,e)?t:Wa(t,e)[0]||t}function mR(t){return!t||!t.isConnected?!1:typeof t.checkVisibility=="function"?t.checkVisibility():Cn(t).display!=="none"}function Vg(t,e){if(!e.current.includes("floating")&&!t.getAttribute("role")?.includes("dialog"))return;const n=Mi(),o=TM(t,n).filter(i=>{const a=i.getAttribute("data-tabindex")||"";return ak(i,n)||i.hasAttribute("data-tabindex")&&!a.startsWith("-")}),s=t.getAttribute("tabindex");e.current.includes("floating")||o.length===0?s!=="0"&&t.setAttribute("tabindex","0"):(s!=="-1"||t.hasAttribute("data-tabindex")&&t.getAttribute("data-tabindex")!=="-1")&&(t.setAttribute("tabindex","-1"),t.setAttribute("data-tabindex","-1"))}function Cp(t){const{context:e,children:n,disabled:r=!1,initialFocus:o=!0,returnFocus:s=!0,restoreFocus:i=!1,modal:a=!0,closeOnFocusOut:l=!0,openInteractionType:c="",nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:h}=t,p="rootStore"in e?e.rootStore:e,g=p.useState("open"),m=p.useState("domReferenceElement"),y=p.useState("floatingElement"),{events:b,dataRef:w}=p.context,k=de(()=>w.current.floatingContext?.nodeId),v=o===!1,x=ih(m)&&v,E=S.useRef(["content"]),C=Dt(o),A=Dt(s),z=Dt(c),R=ys(h),_=Ck(),N=S.useRef(null),L=S.useRef(null),H=S.useRef(!1),Z=S.useRef(!1),W=S.useRef(!1),q=S.useRef(-1),V=S.useRef(""),D=S.useRef(""),j=S.useRef(null),B=S.useRef(null),F=zr(j,f,_?.beforeInsideRef),T=zr(B,_?.afterInsideRef),$=Sn(),I=Sn(),Y=sd(),G=_!=null,X=wa(y),se=de((U=X)=>U?Wa(U,Mi()):[]),O=de(U=>{const K=se(U);return E.current.map(()=>K).filter(Boolean).flat()});S.useEffect(()=>{if(r||!a)return;function U(J){J.key==="Tab"&&Fe(X,Hn(Ke(X)))&&se().length===0&&!x&&Ut(J)}const K=Ke(X);return K.addEventListener("keydown",U),()=>{K.removeEventListener("keydown",U)}},[r,m,X,a,E,x,se,O]),S.useEffect(()=>{if(r||!g)return;const U=Ke(X);function K(){W.current=!1}function J(ie){const oe=vn(ie),ne=Fe(y,oe)||Fe(m,oe)||Fe(_?.portalNode,oe);W.current=!ne,D.current=ie.pointerType||"keyboard",oe?.closest(`[${pk}]`)&&(Z.current=!0)}function ee(){D.current="keyboard"}return U.addEventListener("pointerdown",J,!0),U.addEventListener("pointerup",K,!0),U.addEventListener("pointercancel",K,!0),U.addEventListener("keydown",ee,!0),()=>{U.removeEventListener("pointerdown",J,!0),U.removeEventListener("pointerup",K,!0),U.removeEventListener("pointercancel",K,!0),U.removeEventListener("keydown",ee,!0)}},[r,y,m,X,g,_]),S.useEffect(()=>{if(r||!l)return;const U=Ke(X);function K(){Z.current=!0,I.start(0,()=>{Z.current=!1})}function J(le){const Q=vn(le),ye=se().indexOf(Q);ye!==-1&&(q.current=ye)}function ee(le){const Q=le.relatedTarget,fe=le.currentTarget,ye=vn(le);queueMicrotask(()=>{const he=k(),Ue=p.context.triggerElements,Ze=Q?.hasAttribute(xa("focus-guard"))&&[j.current,B.current,_?.beforeInsideRef.current,_?.afterInsideRef.current,_?.beforeOutsideRef.current,_?.afterOutsideRef.current,Er(d),Er(u)].includes(Q),ft=!(Fe(m,Q)||Fe(y,Q)||Fe(Q,y)||Fe(_?.portalNode,Q)||Q!=null&&Ue.hasElement(Q)||Ue.hasMatchingElement(Ve=>Fe(Ve,Q))||Ze||R&&(Xo(R.nodesRef.current,he).find(Ve=>Fe(Ve.context?.elements.floating,Q)||Fe(Ve.context?.elements.domReference,Q))||Ng(R.nodesRef.current,he).find(Ve=>[Ve.context?.elements.floating,wa(Ve.context?.elements.floating)].includes(Q)||Ve.context?.elements.domReference===Q)));if(fe===m&&X&&Vg(X,E),i&&fe!==m&&!mR(ye)&&Hn(U)===U.body){if(gt(X)&&(X.focus(),i==="popup")){Y.request(()=>{X.focus()});return}const Ve=q.current,ze=se(),Ye=ze[Ve]||ze[ze.length-1]||X;gt(Ye)&&Ye.focus()}if(w.current.insideReactTree){w.current.insideReactTree=!1;return}(x||!a)&&Q&&ft&&!Z.current&&(x||Q!==Zd())&&(H.current=!0,p.setOpen(!1,De(is,le)))})}function ie(){W.current||(w.current.insideReactTree=!0,$.start(0,()=>{w.current.insideReactTree=!1}))}const oe=gt(m)?m:null,ne=[];if(!(!y&&!oe))return oe&&(oe.addEventListener("focusout",ee),oe.addEventListener("pointerdown",K),ne.push(()=>{oe.removeEventListener("focusout",ee),oe.removeEventListener("pointerdown",K)})),y&&(y.addEventListener("focusin",J),y.addEventListener("focusout",ee),_&&(y.addEventListener("focusout",ie,!0),ne.push(()=>{y.removeEventListener("focusout",ie,!0)})),ne.push(()=>{y.removeEventListener("focusin",J),y.removeEventListener("focusout",ee)})),()=>{ne.forEach(le=>{le()})}},[r,m,y,X,a,R,_,p,l,i,se,x,k,E,w,$,I,Y,u,d]),S.useEffect(()=>{if(r||!y||!g)return;const U=Array.from(_?.portalNode?.querySelectorAll(`[${xa("portal")}]`)||[]),J=(R?Ng(R.nodesRef.current,k()):[]).find(ie=>ih(ie.context?.elements.domReference||null))?.context?.elements.domReference,ee=[y,J,...U,N.current,L.current,j.current,B.current,_?.beforeOutsideRef.current,_?.afterOutsideRef.current,Er(d),Er(u),x?m:null].filter(ie=>ie!=null);return GM(ee,a||x)},[g,r,m,y,a,E,_,x,R,k,u,d]),me(()=>{if(!g||r||!gt(X))return;const U=Ke(X),K=Hn(U);queueMicrotask(()=>{const J=O(X),ee=C.current,ie=typeof ee=="function"?ee(z.current||""):ee;if(ie===void 0||ie===!1)return;let oe;ie===!0||ie===null?oe=J[0]||X:oe=Er(ie),oe=oe||J[0]||X,!Fe(X,K)&&sa(oe,{preventScroll:oe===X})})},[r,g,X,v,O,C,z]),me(()=>{if(r||!X)return;const U=Ke(X),K=Hn(U);hR(K);function J(oe){if(oe.open||(V.current=fR(oe.nativeEvent,D.current)),oe.reason===kn&&oe.nativeEvent.type==="mouseleave"&&(H.current=!0),oe.reason===kp)if(oe.nested)H.current=!1;else if(Kw(oe.nativeEvent)||Yw(oe.nativeEvent))H.current=!1;else{let ne=!1;document.createElement("div").focus({get preventScroll(){return ne=!0,!1}}),ne?H.current=!1:H.current=!0}}b.on("openchange",J);const ee=U.createElement("span");ee.setAttribute("tabindex","-1"),ee.setAttribute("aria-hidden","true"),Object.assign(ee.style,od),G&&m&&m.insertAdjacentElement("afterend",ee);function ie(){const oe=A.current;let ne=typeof oe=="function"?oe(V.current):oe;if(ne===void 0||ne===!1)return null;if(ne===null&&(ne=!0),typeof ne=="boolean"){const Q=m||Zd();return Q&&Q.isConnected?Q:ee}const le=m||Zd()||ee;return Er(ne)||le}return()=>{b.off("openchange",J);const oe=Hn(U),ne=Fe(y,oe)||R&&Xo(R.nodesRef.current,k(),!1).some(Q=>Fe(Q.context?.elements.floating,oe)),le=ie();queueMicrotask(()=>{const Q=pR(le),fe=typeof A.current!="boolean";A.current&&!H.current&>(Q)&&(!(!fe&&Q!==oe&&oe!==U.body)||ne)&&Q.focus({preventScroll:!0}),ee.remove(),H.current=!1})}},[r,y,X,A,w,b,R,G,m,k]),me(()=>{if(!pp||g||!y)return;const U=Hn(Ke(y));!gt(U)||!gp(U)||Fe(y,U)&&U.blur()},[g,y]),me(()=>{if(!(r||!_))return _.setFocusManagerState({modal:a,closeOnFocusOut:l,open:g,onOpenChange:p.setOpen,domReference:m}),()=>{_.setFocusManagerState(null)}},[r,_,a,g,p,l,m]),me(()=>{if(!(r||!X))return Vg(X,E),()=>{queueMicrotask(Ep)}},[r,X,E]);const P=!r&&(a?!x:!0)&&(G||a);return M.jsxs(S.Fragment,{children:[P&&M.jsx(fi,{"data-type":"inside",ref:F,onFocus:U=>{if(a){const K=O();sa(K[K.length-1])}else _?.portalNode&&(H.current=!1,Zs(U,_.portalNode)?wp(m)?.focus():Er(d??_.beforeOutsideRef)?.focus())}}),n,P&&M.jsx(fi,{"data-type":"inside",ref:T,onFocus:U=>{a?sa(O()[0]):_?.portalNode&&(l&&(H.current=!0),Zs(U,_.portalNode)?ck(m)?.focus():Er(u??_.afterOutsideRef)?.focus())}})]})}function Tk(t,e={}){const n="rootStore"in t?t.rootStore:t,r=n.context.dataRef,{enabled:o=!0,event:s="click",toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:l=!0,touchOpenDelay:c=0,reason:u=di}=e,d=S.useRef(void 0),f=sd(),h=Sn(),p=S.useMemo(()=>({onPointerDown(g){d.current=g.pointerType},onMouseDown(g){const m=d.current,y=g.nativeEvent,b=n.select("open");if(g.button!==0||s==="click"||li(m,!0)&&a)return;const w=r.current.openEvent,k=w?.type,v=n.select("domReferenceElement")!==g.currentTarget,x=b&&v||!(b&&i&&(!(w&&l)||k==="click"||k==="mousedown"));if(gp(y.target)){const C=De(u,y,y.target);x&&m==="touch"&&c>0?h.start(c,()=>{n.setOpen(!0,C)}):n.setOpen(x,C);return}const E=g.currentTarget;f.request(()=>{const C=De(u,y,E);x&&m==="touch"&&c>0?h.start(c,()=>{n.setOpen(!0,C)}):n.setOpen(x,C)})},onClick(g){if(s==="mousedown-only")return;const m=d.current;if(s==="mousedown"&&m){d.current=void 0;return}if(li(m,!0)&&a)return;const y=n.select("open"),b=r.current.openEvent,w=n.select("domReferenceElement")!==g.currentTarget,k=y&&w||!(y&&i&&(!(b&&l)||Zw(b))),v=De(u,g.nativeEvent,g.currentTarget);k&&m==="touch"&&c>0?h.start(c,()=>{n.setOpen(!0,v)}):n.setOpen(k,v)},onKeyDown(){d.current=void 0}}),[r,s,a,n,l,i,f,h,c,u]);return S.useMemo(()=>o?{reference:p}:At,[o,p])}function Hg(t,e,n){let{reference:r,floating:o}=t;const s=In(e),i=vp(e),a=bp(i),l=hn(e),c=s==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[a]/2-o[a]/2;let h;switch(l){case"top":h={x:u,y:r.y-o.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-o.width,y:d};break;default:h={x:r.x,y:r.y}}switch(So(e)){case"start":h[i]-=f*(n&&c?-1:1);break;case"end":h[i]+=f*(n&&c?-1:1);break}return h}async function gR(t,e){var n;e===void 0&&(e={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=Dr(e,t),p=Gw(h),m=a[f?d==="floating"?"reference":"floating":d],y=$c(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(m)))==null||n?m:m.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),b=d==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),k=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},v=$c(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:w,strategy:l}):b);return{top:(y.top-v.top+p.top)/k.y,bottom:(v.bottom-y.bottom+p.bottom)/k.y,left:(y.left-v.left+p.left)/k.x,right:(v.right-y.right+p.right)/k.x}}const yR=50,bR=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:gR},l=await(i.isRTL==null?void 0:i.isRTL(e));let c=await i.getElementRects({reference:t,floating:e,strategy:o}),{x:u,y:d}=Hg(c,r,l),f=r,h=0;const p={};for(let g=0;g<s.length;g++){const m=s[g];if(!m)continue;const{name:y,fn:b}=m,{x:w,y:k,data:v,reset:x}=await b({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:a,elements:{reference:t,floating:e}});u=w??u,d=k??d,p[y]={...p[y],...v},x&&h<yR&&(h++,typeof x=="object"&&(x.placement&&(f=x.placement),x.rects&&(c=x.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:o}):x.rects),{x:u,y:d}=Hg(c,f,l)),g=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:p}},vR=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...m}=Dr(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=hn(o),b=In(a),w=hn(a)===a,k=await(l.isRTL==null?void 0:l.isRTL(c.floating)),v=f||(w||!g?[Ic(a)]:iM(a)),x=p!=="none";!f&&x&&v.push(...uM(a,g,p,k));const E=[a,...v],C=await l.detectOverflow(e,m),A=[];let z=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&A.push(C[y]),d){const L=sM(o,i,k);A.push(C[L[0]],C[L[1]])}if(z=[...z,{placement:o,overflows:A}],!A.every(L=>L<=0)){var R,_;const L=(((R=s.flip)==null?void 0:R.index)||0)+1,H=E[L];if(H&&(!(d==="alignment"?b!==In(H):!1)||z.every(q=>In(q.placement)===b?q.overflows[0]>0:!0)))return{data:{index:L,overflows:z},reset:{placement:H}};let Z=(_=z.filter(W=>W.overflows[0]<=0).sort((W,q)=>W.overflows[1]-q.overflows[1])[0])==null?void 0:_.placement;if(!Z)switch(h){case"bestFit":{var N;const W=(N=z.filter(q=>{if(x){const V=In(q.placement);return V===b||V==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(V=>V>0).reduce((V,D)=>V+D,0)]).sort((q,V)=>q[1]-V[1])[0])==null?void 0:N[0];W&&(Z=W);break}case"initialPlacement":Z=a;break}if(o!==Z)return{reset:{placement:Z}}}return{}}}};function Wg(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function qg(t){return rM.some(e=>t[e]>=0)}const wR=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:o="referenceHidden",...s}=Dr(t,e);switch(o){case"referenceHidden":{const i=await r.detectOverflow(e,{...s,elementContext:"reference"}),a=Wg(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:qg(a)}}}case"escaped":{const i=await r.detectOverflow(e,{...s,altBoundary:!0}),a=Wg(i,n.floating);return{data:{escapedOffsets:a,escaped:qg(a)}}}default:return{}}}}},Mk=new Set(["left","top"]);async function kR(t,e){const{placement:n,platform:r,elements:o}=t,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=hn(n),a=So(n),l=In(n)==="y",c=Mk.has(i)?-1:1,u=s&&l?-1:1,d=Dr(e,t);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),l?{x:h*u,y:f*c}:{x:f*c,y:h*u}}const xR=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=e,l=await kR(e,t);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:s+l.y,data:{...l,placement:i}}}}},SR=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o,platform:s}=e,{mainAxis:i=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x:b,y:w}=y;return{x:b,y:w}}},...c}=Dr(t,e),u={x:n,y:r},d=await s.detectOverflow(e,c),f=In(hn(o)),h=yp(f);let p=u[h],g=u[f];if(i){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",w=p+d[y],k=p-d[b];p=ah(w,p,k)}if(a){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",w=g+d[y],k=g-d[b];g=ah(w,g,k)}const m=l.fn({...e,[h]:p,[f]:g});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:i,[f]:a}}}}}},ER=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Dr(t,e),u={x:n,y:r},d=In(o),f=yp(d);let h=u[f],p=u[d];const g=Dr(a,e),m=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const w=f==="y"?"height":"width",k=s.reference[f]-s.floating[w]+m.mainAxis,v=s.reference[f]+s.reference[w]-m.mainAxis;h<k?h=k:h>v&&(h=v)}if(c){var y,b;const w=f==="y"?"width":"height",k=Mk.has(hn(o)),v=s.reference[d]-s.floating[w]+(k&&((y=i.offset)==null?void 0:y[d])||0)+(k?0:m.crossAxis),x=s.reference[d]+s.reference[w]+(k?0:((b=i.offset)==null?void 0:b[d])||0)-(k?m.crossAxis:0);p<v?p=v:p>x&&(p=x)}return{[f]:h,[d]:p}}}},CR=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:o,rects:s,platform:i,elements:a}=e,{apply:l=()=>{},...c}=Dr(t,e),u=await i.detectOverflow(e,c),d=hn(o),f=So(o),h=In(o)==="y",{width:p,height:g}=s.floating;let m,y;d==="top"||d==="bottom"?(m=d,y=f===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(y=d,m=f==="end"?"top":"bottom");const b=g-u.top-u.bottom,w=p-u.left-u.right,k=ci(g-u[m],b),v=ci(p-u[y],w),x=!e.middlewareData.shift;let E=k,C=v;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(C=w),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(E=b),x&&!f){const z=wn(u.left,0),R=wn(u.right,0),_=wn(u.top,0),N=wn(u.bottom,0);h?C=p-2*(z!==0||R!==0?z+R:wn(u.left,u.right)):E=g-2*(_!==0||N!==0?_+N:wn(u.top,u.bottom))}await l({...e,availableWidth:C,availableHeight:E});const A=await i.getDimensions(a.floating);return p!==A.width||g!==A.height?{reset:{rects:!0}}:{}}}};function Rk(t){const e=Cn(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=gt(t),s=o?t.offsetWidth:n,i=o?t.offsetHeight:r,a=Ac(n)!==s||Ac(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function Tp(t){return et(t)?t:t.contextElement}function Js(t){const e=Tp(t);if(!gt(e))return ar(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:s}=Rk(e);let i=(s?Ac(n.width):n.width)/r,a=(s?Ac(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const TR=ar(0);function Ok(t){const e=Mt(t);return!nd()||!e.visualViewport?TR:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function MR(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Mt(t)?!1:e}function as(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),s=Tp(t);let i=ar(1);e&&(r?et(r)&&(i=Js(r)):i=Js(t));const a=MR(s,n,r)?Ok(s):ar(0);let l=(o.left+a.x)/i.x,c=(o.top+a.y)/i.y,u=o.width/i.x,d=o.height/i.y;if(s){const f=Mt(s),h=r&&et(r)?Mt(r):r;let p=f,g=rh(p);for(;g&&r&&h!==p;){const m=Js(g),y=g.getBoundingClientRect(),b=Cn(g),w=y.left+(g.clientLeft+parseFloat(b.paddingLeft))*m.x,k=y.top+(g.clientTop+parseFloat(b.paddingTop))*m.y;l*=m.x,c*=m.y,u*=m.x,d*=m.y,l+=w,c+=k,p=Mt(g),g=rh(p)}}return $c({width:u,height:d,x:l,y:c})}function id(t,e){const n=rd(t).scrollLeft;return e?e.left+n:as(dr(t)).left+n}function _k(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-id(t,n),o=n.top+e.scrollTop;return{x:r,y:o}}function RR(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const s=o==="fixed",i=dr(r),a=e?td(e.floating):!1;if(r===i||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=ar(1);const u=ar(0),d=gt(r);if((d||!d&&!s)&&((ko(r)!=="body"||xo(i))&&(l=rd(r)),d)){const h=as(r);c=Js(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const f=i&&!d&&!s?_k(i,l):ar(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}}function OR(t){return Array.from(t.getClientRects())}function _R(t){const e=dr(t),n=rd(t),r=t.ownerDocument.body,o=wn(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=wn(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+id(t);const a=-n.scrollTop;return Cn(r).direction==="rtl"&&(i+=wn(e.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const Ug=25;function NR(t,e){const n=Mt(t),r=dr(t),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,l=0;if(o){s=o.width,i=o.height;const u=nd();(!u||u&&e==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}const c=id(r);if(c<=0){const u=r.ownerDocument,d=u.body,f=getComputedStyle(d),h=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-d.clientWidth-h);p<=Ug&&(s-=p)}else c<=Ug&&(s+=c);return{width:s,height:i,x:a,y:l}}function PR(t,e){const n=as(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,s=gt(t)?Js(t):ar(1),i=t.clientWidth*s.x,a=t.clientHeight*s.y,l=o*s.x,c=r*s.y;return{width:i,height:a,x:l,y:c}}function Kg(t,e,n){let r;if(e==="viewport")r=NR(t,n);else if(e==="document")r=_R(dr(t));else if(et(e))r=PR(e,n);else{const o=Ok(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return $c(r)}function Nk(t,e){const n=$r(t);return n===e||!et(n)||Pr(n)?!1:Cn(n).position==="fixed"||Nk(n,e)}function AR(t,e){const n=e.get(t);if(n)return n;let r=ro(t,[],!1).filter(a=>et(a)&&ko(a)!=="body"),o=null;const s=Cn(t).position==="fixed";let i=s?$r(t):t;for(;et(i)&&!Pr(i);){const a=Cn(i),l=hp(i);!l&&a.position==="fixed"&&(o=null),(s?!l&&!o:!l&&a.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||xo(i)&&!l&&Nk(t,i))?r=r.filter(u=>u!==i):o=a,i=$r(i)}return e.set(t,r),r}function IR(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const i=[...n==="clippingAncestors"?td(e)?[]:AR(e,this._c):[].concat(n),r],a=Kg(e,i[0],o);let l=a.top,c=a.right,u=a.bottom,d=a.left;for(let f=1;f<i.length;f++){const h=Kg(e,i[f],o);l=wn(h.top,l),c=ci(h.right,c),u=ci(h.bottom,u),d=wn(h.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function $R(t){const{width:e,height:n}=Rk(t);return{width:e,height:n}}function DR(t,e,n){const r=gt(e),o=dr(e),s=n==="fixed",i=as(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=ar(0);function c(){l.x=id(o)}if(r||!r&&!s)if((ko(e)!=="body"||xo(o))&&(a=rd(e)),r){const h=as(e,!0,s,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else o&&c();s&&!r&&o&&c();const u=o&&!r&&!s?_k(o,a):ar(0),d=i.left+a.scrollLeft-l.x-u.x,f=i.top+a.scrollTop-l.y-u.y;return{x:d,y:f,width:i.width,height:i.height}}function Gd(t){return Cn(t).position==="static"}function Yg(t,e){if(!gt(t)||Cn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return dr(t)===n&&(n=n.ownerDocument.body),n}function Pk(t,e){const n=Mt(t);if(td(t))return n;if(!gt(t)){let o=$r(t);for(;o&&!Pr(o);){if(et(o)&&!Gd(o))return o;o=$r(o)}return n}let r=Yg(t,e);for(;r&&VT(r)&&Gd(r);)r=Yg(r,e);return r&&Pr(r)&&Gd(r)&&!hp(r)?n:r||qT(t)||n}const zR=async function(t){const e=this.getOffsetParent||Pk,n=this.getDimensions,r=await n(t.floating);return{reference:DR(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function LR(t){return Cn(t).direction==="rtl"}const jR={convertOffsetParentRelativeRectToViewportRelativeRect:RR,getDocumentElement:dr,getClippingRect:IR,getOffsetParent:Pk,getElementRects:zR,getClientRects:OR,getDimensions:$R,getScale:Js,isElement:et,isRTL:LR};function Ak(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function FR(t,e){let n=null,r;const o=dr(t);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const c=t.getBoundingClientRect(),{left:u,top:d,width:f,height:h}=c;if(a||e(),!f||!h)return;const p=Hs(d),g=Hs(o.clientWidth-(u+f)),m=Hs(o.clientHeight-(d+h)),y=Hs(u),w={rootMargin:-p+"px "+-g+"px "+-m+"px "+-y+"px",threshold:wn(0,ci(1,l))||1};let k=!0;function v(x){const E=x[0].intersectionRatio;if(E!==l){if(!k)return i();E?i(!1,E):r=setTimeout(()=>{i(!1,1e-7)},1e3)}E===1&&!Ak(c,t.getBoundingClientRect())&&i(),k=!1}try{n=new IntersectionObserver(v,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(v,w)}n.observe(t)}return i(!0),s}function Zg(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Tp(t),u=o||s?[...c?ro(c):[],...e?ro(e):[]]:[];u.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const d=c&&a?FR(c,n):null;let f=-1,h=null;i&&(h=new ResizeObserver(y=>{let[b]=y;b&&b.target===c&&h&&e&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(e)})),n()}),c&&!l&&h.observe(c),e&&h.observe(e));let p,g=l?as(t):null;l&&m();function m(){const y=as(t);g&&!Ak(g,y)&&n(),g=y,p=requestAnimationFrame(m)}return n(),()=>{var y;u.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),d?.(),(y=h)==null||y.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const BR=xR,VR=SR,HR=vR,WR=CR,qR=wR,UR=ER,KR=(t,e,n)=>{const r=new Map,o={platform:jR,...n},s={...o.platform,_c:r};return bR(t,e,{...o,platform:s})};var YR=typeof document<"u",ZR=function(){},Cc=YR?S.useLayoutEffect:ZR;function Fc(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,o;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(!Fc(t[r],e[r]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&t.$$typeof)&&!Fc(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function Ik(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Gg(t,e){const n=Ik(t);return Math.round(e*n)/n}function Jd(t){const e=S.useRef(t);return Cc(()=>{e.current=t}),e}function GR(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:l,open:c}=t,[u,d]=S.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=S.useState(r);Fc(f,r)||h(r);const[p,g]=S.useState(null),[m,y]=S.useState(null),b=S.useCallback(q=>{q!==x.current&&(x.current=q,g(q))},[]),w=S.useCallback(q=>{q!==E.current&&(E.current=q,y(q))},[]),k=s||p,v=i||m,x=S.useRef(null),E=S.useRef(null),C=S.useRef(u),A=l!=null,z=Jd(l),R=Jd(o),_=Jd(c),N=S.useCallback(()=>{if(!x.current||!E.current)return;const q={placement:e,strategy:n,middleware:f};R.current&&(q.platform=R.current),KR(x.current,E.current,q).then(V=>{const D={...V,isPositioned:_.current!==!1};L.current&&!Fc(C.current,D)&&(C.current=D,lr.flushSync(()=>{d(D)}))})},[f,e,n,R,_]);Cc(()=>{c===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,d(q=>({...q,isPositioned:!1})))},[c]);const L=S.useRef(!1);Cc(()=>(L.current=!0,()=>{L.current=!1}),[]),Cc(()=>{if(k&&(x.current=k),v&&(E.current=v),k&&v){if(z.current)return z.current(k,v,N);N()}},[k,v,N,z,A]);const H=S.useMemo(()=>({reference:x,floating:E,setReference:b,setFloating:w}),[b,w]),Z=S.useMemo(()=>({reference:k,floating:v}),[k,v]),W=S.useMemo(()=>{const q={position:n,left:0,top:0};if(!Z.floating)return q;const V=Gg(Z.floating,u.x),D=Gg(Z.floating,u.y);return a?{...q,transform:"translate("+V+"px, "+D+"px)",...Ik(Z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:V,top:D}},[n,a,Z.floating,u.x,u.y]);return S.useMemo(()=>({...u,update:N,refs:H,elements:Z,floatingStyles:W}),[u,N,H,Z,W])}const JR=(t,e)=>{const n=BR(t);return{name:n.name,fn:n.fn,options:[t,e]}},XR=(t,e)=>{const n=VR(t);return{name:n.name,fn:n.fn,options:[t,e]}},QR=(t,e)=>({fn:UR(t).fn,options:[t,e]}),eO=(t,e)=>{const n=HR(t);return{name:n.name,fn:n.fn,options:[t,e]}},tO=(t,e)=>{const n=WR(t);return{name:n.name,fn:n.fn,options:[t,e]}},nO=(t,e)=>{const n=qR(t);return{name:n.name,fn:n.fn,options:[t,e]}},rO={intentional:"onClick",sloppy:"onPointerDown"};function oO(t){return{escapeKey:typeof t=="boolean"?t:t?.escapeKey??!1,outsidePress:typeof t=="boolean"?t:t?.outsidePress??!0}}function Mp(t,e={}){const n="rootStore"in t?t.rootStore:t,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("referenceElement"),i=n.useState("domReferenceElement"),{onOpenChange:a,dataRef:l}=n.context,{enabled:c=!0,escapeKey:u=!0,outsidePress:d=!0,outsidePressEvent:f="sloppy",referencePress:h=!1,referencePressEvent:p="sloppy",ancestorScroll:g=!1,bubbles:m,externalTree:y}=e,b=ys(y),w=de(typeof d=="function"?d:()=>!1),k=typeof d=="function"?w:d,v=S.useRef(!1),{escapeKey:x,outsidePress:E}=oO(m),C=S.useRef(null),A=Sn(),z=Sn(),R=de(()=>{z.clear(),l.current.insideReactTree=!1}),_=S.useRef(!1),N=S.useRef(""),L=de(P=>{N.current=P.pointerType}),H=de(()=>{const P=N.current,U=P==="pen"||!P?"mouse":P,K=typeof f=="function"?f():f;return typeof K=="string"?K:K[U]}),Z=de(P=>{if(!r||!c||!u||P.key!=="Escape"||_.current)return;const U=l.current.floatingContext?.nodeId,K=b?Xo(b.nodesRef.current,U):[];if(!x&&K.length>0){let ie=!0;if(K.forEach(oe=>{oe.context?.open&&!oe.context.dataRef.current.__escapeKeyBubbles&&(ie=!1)}),!ie)return}const J=nM(P)?P.nativeEvent:P,ee=De(mk,J);n.setOpen(!1,ee),!x&&!ee.isPropagationAllowed&&P.stopPropagation()}),W=de(P=>{const U=H();return U==="intentional"&&P.type!=="click"||U==="sloppy"&&P.type==="click"}),q=de(()=>{l.current.insideReactTree=!0,z.start(0,R)}),V=de((P,U=!1)=>{if(W(P)){R();return}if(l.current.insideReactTree){R();return}if(H()==="intentional"&&U||typeof k=="function"&&!k(P))return;const K=vn(P),J=`[${xa("inert")}]`,ee=Ke(n.select("floatingElement")).querySelectorAll(J),ie=n.context.triggerElements;if(K&&(ie.hasElement(K)||ie.hasMatchingElement(fe=>Fe(fe,K))))return;let oe=et(K)?K:null;for(;oe&&!Pr(oe);){const fe=$r(oe);if(Pr(fe)||!et(fe))break;oe=fe}if(ee.length&&et(K)&&!tM(K)&&!Fe(K,n.select("floatingElement"))&&Array.from(ee).every(fe=>!Fe(oe,fe)))return;if(gt(K)&&!("touches"in P)){const fe=Pr(K),ye=Cn(K),he=/auto|scroll/,Ue=fe||he.test(ye.overflowX),Ze=fe||he.test(ye.overflowY),ft=Ue&&K.clientWidth>0&&K.scrollWidth>K.clientWidth,Ve=Ze&&K.clientHeight>0&&K.scrollHeight>K.clientHeight,ze=ye.direction==="rtl",Ye=Ve&&(ze?P.offsetX<=K.offsetWidth-K.clientWidth:P.offsetX>K.clientWidth),Ge=ft&&P.offsetY>K.clientHeight;if(Ye||Ge)return}const ne=l.current.floatingContext?.nodeId,le=b&&Xo(b.nodesRef.current,ne).some(fe=>Fn(P,fe.context?.elements.floating));if(Fn(P,n.select("floatingElement"))||Fn(P,n.select("domReferenceElement"))||le)return;const Q=b?Xo(b.nodesRef.current,ne):[];if(Q.length>0){let fe=!0;if(Q.forEach(ye=>{ye.context?.open&&!ye.context.dataRef.current.__outsidePressBubbles&&(fe=!1)}),!fe)return}n.setOpen(!1,De(kp,P)),R()}),D=de(P=>{H()!=="sloppy"||P.pointerType==="touch"||!n.select("open")||!c||Fn(P,n.select("floatingElement"))||Fn(P,n.select("domReferenceElement"))||V(P)}),j=de(P=>{if(H()!=="sloppy"||!n.select("open")||!c||Fn(P,n.select("floatingElement"))||Fn(P,n.select("domReferenceElement")))return;const U=P.touches[0];U&&(C.current={startTime:Date.now(),startX:U.clientX,startY:U.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},A.start(1e3,()=>{C.current&&(C.current.dismissOnTouchEnd=!1,C.current.dismissOnMouseDown=!1)}))}),B=de(P=>{const U=vn(P);function K(){j(P),U?.removeEventListener(P.type,K)}U?.addEventListener(P.type,K)}),F=de(P=>{const U=v.current;if(v.current=!1,A.clear(),P.type==="mousedown"&&C.current&&!C.current.dismissOnMouseDown)return;const K=vn(P);function J(){P.type==="pointerdown"?D(P):V(P,U),K?.removeEventListener(P.type,J)}K?.addEventListener(P.type,J)}),T=de(P=>{if(H()!=="sloppy"||!C.current||Fn(P,n.select("floatingElement"))||Fn(P,n.select("domReferenceElement")))return;const U=P.touches[0];if(!U)return;const K=Math.abs(U.clientX-C.current.startX),J=Math.abs(U.clientY-C.current.startY),ee=Math.sqrt(K*K+J*J);ee>5&&(C.current.dismissOnTouchEnd=!0),ee>10&&(V(P),A.clear(),C.current=null)}),$=de(P=>{const U=vn(P);function K(){T(P),U?.removeEventListener(P.type,K)}U?.addEventListener(P.type,K)}),I=de(P=>{H()!=="sloppy"||!C.current||Fn(P,n.select("floatingElement"))||Fn(P,n.select("domReferenceElement"))||(C.current.dismissOnTouchEnd&&V(P),A.clear(),C.current=null)}),Y=de(P=>{const U=vn(P);function K(){I(P),U?.removeEventListener(P.type,K)}U?.addEventListener(P.type,K)});S.useEffect(()=>{if(!r||!c)return;l.current.__escapeKeyBubbles=x,l.current.__outsidePressBubbles=E;const P=new ss;function U(oe){n.setOpen(!1,De(po,oe))}function K(){P.clear(),_.current=!0}function J(){P.start(nd()?5:0,()=>{_.current=!1})}const ee=Ke(o);ee.addEventListener("pointerdown",L,!0),u&&(ee.addEventListener("keydown",Z),ee.addEventListener("compositionstart",K),ee.addEventListener("compositionend",J)),k&&(ee.addEventListener("click",F,!0),ee.addEventListener("pointerdown",F,!0),ee.addEventListener("touchstart",B,!0),ee.addEventListener("touchmove",$,!0),ee.addEventListener("touchend",Y,!0),ee.addEventListener("mousedown",F,!0));let ie=[];return g&&(et(i)&&(ie=ro(i)),et(o)&&(ie=ie.concat(ro(o))),!et(s)&&s&&s.contextElement&&(ie=ie.concat(ro(s.contextElement)))),ie=ie.filter(oe=>oe!==ee.defaultView?.visualViewport),ie.forEach(oe=>{oe.addEventListener("scroll",U,{passive:!0})}),()=>{ee.removeEventListener("pointerdown",L,!0),u&&(ee.removeEventListener("keydown",Z),ee.removeEventListener("compositionstart",K),ee.removeEventListener("compositionend",J)),k&&(ee.removeEventListener("click",F,!0),ee.removeEventListener("pointerdown",F,!0),ee.removeEventListener("touchstart",B,!0),ee.removeEventListener("touchmove",$,!0),ee.removeEventListener("touchend",Y,!0),ee.removeEventListener("mousedown",F,!0)),ie.forEach(oe=>{oe.removeEventListener("scroll",U)}),P.clear(),v.current=!1}},[l,o,s,i,u,k,r,a,g,c,x,E,Z,V,F,D,B,$,Y,L,n]),S.useEffect(R,[k,R]);const G=S.useMemo(()=>({onKeyDown:Z,...h&&{[rO[p]]:P=>{n.setOpen(!1,De(di,P.nativeEvent))},...p!=="intentional"&&{onClick(P){n.setOpen(!1,De(di,P.nativeEvent))}}}}),[Z,n,h,p]),X=de(P=>{const U=vn(P.nativeEvent);!Fe(n.select("floatingElement"),U)||P.button!==0||(v.current=!0)}),se=de(P=>{!r||!c||P.button!==0||(v.current=!0)}),O=S.useMemo(()=>({onKeyDown:Z,onPointerDown:X,onMouseDown:X,onMouseUp:X,onClickCapture:q,onMouseDownCapture(P){q(),se(P)},onPointerDownCapture(P){q(),se(P)},onMouseUpCapture:q,onTouchEndCapture:q,onTouchMoveCapture:q}),[Z,X,q,se]);return S.useMemo(()=>c?{reference:G,floating:O,trigger:G}:{},[c,G,O])}var Bc=Symbol("NOT_FOUND");function sO(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function iO(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function aO(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var Jg=t=>Array.isArray(t)?t:[t];function lO(t){const e=Array.isArray(t[0])?t[0]:t;return aO(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function cO(t,e){const n=[],{length:r}=t;for(let o=0;o<r;o++)n.push(t[o].apply(null,e));return n}function uO(t){let e;return{get(n){return e&&t(e.key,n)?e.value:Bc},put(n,r){e={key:n,value:r}},getEntries(){return e?[e]:[]},clear(){e=void 0}}}function dO(t,e){let n=[];function r(a){const l=n.findIndex(c=>e(a,c.key));if(l>-1){const c=n[l];return l>0&&(n.splice(l,1),n.unshift(c)),c.value}return Bc}function o(a,l){r(a)===Bc&&(n.unshift({key:a,value:l}),n.length>t&&n.pop())}function s(){return n}function i(){n=[]}return{get:r,put:o,getEntries:s,clear:i}}var fO=(t,e)=>t===e;function hO(t){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;const{length:o}=n;for(let s=0;s<o;s++)if(!t(n[s],r[s]))return!1;return!0}}function pO(t,e){const n=typeof e=="object"?e:{equalityCheck:e},{equalityCheck:r=fO,maxSize:o=1,resultEqualityCheck:s}=n,i=hO(r);let a=0;const l=o<=1?uO(i):dO(o,i);function c(){let u=l.get(arguments);if(u===Bc){if(u=t.apply(null,arguments),a++,s){const f=l.getEntries().find(h=>s(h.value,u));f&&(u=f.value,a!==0&&a--)}l.put(arguments,u)}return u}return c.clearCache=()=>{l.clear(),c.resetResultsCount()},c.resultsCount=()=>a,c.resetResultsCount=()=>{a=0},c}var mO=class{constructor(t){this.value=t}deref(){return this.value}},gO=typeof WeakRef<"u"?WeakRef:mO,yO=0,Xg=1;function ll(){return{s:yO,v:void 0,o:null,p:null}}function $k(t,e={}){let n=ll();const{resultEqualityCheck:r}=e;let o,s=0;function i(){let a=n;const{length:l}=arguments;for(let d=0,f=l;d<f;d++){const h=arguments[d];if(typeof h=="function"||typeof h=="object"&&h!==null){let p=a.o;p===null&&(a.o=p=new WeakMap);const g=p.get(h);g===void 0?(a=ll(),p.set(h,a)):a=g}else{let p=a.p;p===null&&(a.p=p=new Map);const g=p.get(h);g===void 0?(a=ll(),p.set(h,a)):a=g}}const c=a;let u;if(a.s===Xg)u=a.v;else if(u=t.apply(null,arguments),s++,r){const d=o?.deref?.()??o;d!=null&&r(d,u)&&(u=d,s!==0&&s--),o=typeof u=="object"&&u!==null||typeof u=="function"?new gO(u):u}return c.s=Xg,c.v=u,u}return i.clearCache=()=>{n=ll(),i.resetResultsCount()},i.resultsCount=()=>s,i.resetResultsCount=()=>{s=0},i}function Dk(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...o)=>{let s=0,i=0,a,l={},c=o.pop();typeof c=="object"&&(l=c,c=o.pop()),sO(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const u={...n,...l},{memoize:d,memoizeOptions:f=[],argsMemoize:h=$k,argsMemoizeOptions:p=[]}=u,g=Jg(f),m=Jg(p),y=lO(o),b=d(function(){return s++,c.apply(null,arguments)},...g),w=h(function(){i++;const v=cO(y,arguments);return a=b.apply(null,v),a},...m);return Object.assign(w,{resultFunc:c,memoizedResultFunc:b,dependencies:y,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:d,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var bO=Dk($k),vO=Object.assign((t,e=bO)=>{iO(t,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`);const n=Object.keys(t),r=n.map(s=>t[s]);return e(r,(...s)=>s.reduce((i,a,l)=>(i[n[l]]=a,i),{}))},{withTypes:()=>vO});Dk({memoize:pO,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const ge=(t,e,n,r,o,s,...i)=>{if(i.length>0)throw new Error(Zt(1));let a;if(t)a=t;else throw new Error("Missing arguments");return a};var Rp=LT();const wO=xp(19),kO=wO?SO:EO;function Re(t,e,n,r,o){return kO(t,e,n,r,o)}function xO(t,e,n,r,o){const s=S.useCallback(()=>e(t.getSnapshot(),n,r,o),[t,e,n,r,o]);return Rp.useSyncExternalStore(t.subscribe,s,s)}function SO(t,e,n,r,o){return xO(t,e,n,r,o)}function EO(t,e,n,r,o){return Dw.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getSnapshot,s=>e(s,n,r,o))}class zk{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(e)}}update(e){for(const n in e)if(!Object.is(this.state[n],e[n])){this.setState({...this.state,...e});return}}set(e,n){Object.is(this.state[e],n)||this.setState({...this.state,[e]:n})}notifyAll(){const e={...this.state};this.setState(e)}use(e,n,r,o){return Re(this,e,n,r,o)}}class Op extends zk{constructor(e,n={},r){super(e),this.context=n,this.selectors=r}useSyncedValue(e,n){S.useDebugValue(e),me(()=>{this.state[e]!==n&&this.set(e,n)},[e,n])}useSyncedValueWithCleanup(e,n){const r=this;me(()=>(r.state[e]!==n&&r.set(e,n),()=>{r.set(e,void 0)}),[r,e,n])}useSyncedValues(e){const n=this,r=Object.values(e);me(()=>{n.update(e)},[n,...r])}useControlledProp(e,n){S.useDebugValue(e);const r=n!==void 0;me(()=>{r&&!Object.is(this.state[e],n)&&super.setState({...this.state,[e]:n})},[e,n,r])}select(e,n,r,o){const s=this.selectors[e];return s(this.state,n,r,o)}useState(e,n,r,o){return S.useDebugValue(e),Re(this,this.selectors[e],n,r,o)}useContextCallback(e,n){S.useDebugValue(e);const r=de(n??dn);this.context[e]=r}useStateSetter(e){const n=S.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(e,r)}),n.current}observe(e,n){let r;typeof e=="function"?r=e:r=this.selectors[e];let o=r(this.state);return n(o,o,this),this.subscribe(s=>{const i=r(s);if(!Object.is(o,i)){const a=o;o=i,n(i,a,this)}})}}const CO={open:ge(t=>t.open),domReferenceElement:ge(t=>t.domReferenceElement),referenceElement:ge(t=>t.positionReference??t.referenceElement),floatingElement:ge(t=>t.floatingElement),floatingId:ge(t=>t.floatingId)};class _p extends Op{constructor(e){const{nested:n,noEmit:r,onOpenChange:o,triggerElements:s,...i}=e;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:dk(),nested:n,noEmit:r,triggerElements:s},CO)}setOpen=(e,n)=>{if((!e||!this.state.open||Zw(n.event))&&(this.context.dataRef.current.openEvent=e?n.event:void 0),!this.context.noEmit){const r={open:e,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)}this.context.onOpenChange?.(e,n)}}function qa(t,e=!1,n=!1){const[r,o]=S.useState(t&&e?"idle":void 0),[s,i]=S.useState(t);return t&&!s&&(i(!0),o("starting")),!t&&s&&r!=="ending"&&!n&&o("ending"),!t&&!s&&r==="ending"&&o(void 0),me(()=>{if(!t&&s&&r!=="ending"&&n){const a=or.request(()=>{o("ending")});return()=>{or.cancel(a)}}},[t,s,r,n]),me(()=>{if(!t||e)return;const a=or.request(()=>{o(void 0)});return()=>{or.cancel(a)}},[e,t]),me(()=>{if(!t||!e)return;t&&s&&r!=="idle"&&o("starting");const a=or.request(()=>{o("idle")});return()=>{or.cancel(a)}},[e,t,s,o,r]),S.useMemo(()=>({mounted:s,setMounted:i,transitionStatus:r}),[s,r])}let Sa=(function(t){return t.startingStyle="data-starting-style",t.endingStyle="data-ending-style",t})({});const TO={[Sa.startingStyle]:""},MO={[Sa.endingStyle]:""},_i={transitionStatus(t){return t==="starting"?TO:t==="ending"?MO:null}};function Lk(t,e=!1,n=!0){const r=sd();return de((o,s=null)=>{r.cancel();function i(){lr.flushSync(o)}const a=Er(t);if(a==null)return;const l=a;if(typeof l.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED)o();else{let c=function(){const d=Sa.startingStyle;if(!l.hasAttribute(d)){r.request(u);return}const f=new MutationObserver(()=>{l.hasAttribute(d)||(f.disconnect(),u())});f.observe(l,{attributes:!0,attributeFilter:[d]}),s?.addEventListener("abort",()=>f.disconnect(),{once:!0})},u=function(){Promise.all(l.getAnimations().map(d=>d.finished)).then(()=>{s?.aborted||i()}).catch(()=>{const d=l.getAnimations();if(n){if(s?.aborted)return;i()}else d.length>0&&d.some(f=>f.pending||f.playState!=="finished")&&u()})};if(e){c();return}r.request(u)}})}function Co(t){const{enabled:e=!0,open:n,ref:r,onComplete:o}=t,s=de(o),i=Lk(r,n,!1);S.useEffect(()=>{if(!e)return;const a=new AbortController;return i(s,a.signal),()=>{a.abort()}},[e,n,s,i])}function RO(t,e){const n=S.useRef(null),r=S.useRef(null);return S.useCallback(o=>{if(t!==void 0){if(n.current!==null){const s=n.current,i=r.current,a=e.context.triggerElements.getById(s);i&&a===i&&e.context.triggerElements.delete(s),n.current=null,r.current=null}o!==null&&(n.current=t,r.current=o,e.context.triggerElements.add(t,o))}},[e,t])}function OO(t,e,n,r){const o=n.useState("isMountedByTrigger",t),s=RO(t,n),i=de(a=>{if(s(a),!a||!n.select("open"))return;const l=n.select("activeTriggerId");if(l===t){n.update({activeTriggerElement:a,...r});return}l==null&&n.update({activeTriggerId:t,activeTriggerElement:a,...r})});return me(()=>{o&&n.update({activeTriggerElement:e.current,...r})},[o,n,e,...Object.values(r)]),{registerTrigger:i,isMountedByThisTrigger:o}}function jk(t){const e=t.useState("open");me(()=>{if(e&&!t.select("activeTriggerId")&&t.context.triggerElements.size===1){const n=t.context.triggerElements.entries().next();if(!n.done){const[r,o]=n.value;t.update({activeTriggerId:r,activeTriggerElement:o})}}},[e,t])}function Fk(t,e,n){const{mounted:r,setMounted:o,transitionStatus:s}=qa(t);e.useSyncedValues({mounted:r,transitionStatus:s});const i=de(()=>{o(!1),e.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),e.context.onOpenChangeComplete?.(!1)}),a=e.useState("preventUnmountingOnClose");return Co({enabled:!a,open:t,ref:e.context.popupRef,onComplete(){t||i()}}),{forceUnmount:i,transitionStatus:s}}class ad{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,n){const r=this.idMap.get(e);r!==n&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(n),this.idMap.set(e,n))}delete(e){const n=this.idMap.get(e);n&&(this.elementsSet.delete(n),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(const n of this.elementsSet)if(e(n))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function _O(){return new _p({open:!1,floatingElement:null,referenceElement:null,triggerElements:new ad,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function Bk(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:"idle",floatingRootContext:_O(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:At,inactiveTriggerProps:At,popupProps:At}}const cl=ge(t=>t.triggerIdProp??t.activeTriggerId),Vk={open:ge(t=>t.openProp??t.open),mounted:ge(t=>t.mounted),transitionStatus:ge(t=>t.transitionStatus),floatingRootContext:ge(t=>t.floatingRootContext),preventUnmountingOnClose:ge(t=>t.preventUnmountingOnClose),payload:ge(t=>t.payload),activeTriggerId:cl,activeTriggerElement:ge(t=>t.mounted?t.activeTriggerElement:null),isTriggerActive:ge((t,e)=>e!==void 0&&cl(t)===e),isOpenedByTrigger:ge((t,e)=>e!==void 0&&cl(t)===e&&t.open),isMountedByTrigger:ge((t,e)=>e!==void 0&&cl(t)===e&&t.mounted),triggerProps:ge((t,e)=>e?t.activeTriggerProps:t.inactiveTriggerProps),popupProps:ge(t=>t.popupProps),popupElement:ge(t=>t.popupElement),positionerElement:ge(t=>t.positionerElement)};function Hk(t){const{open:e=!1,onOpenChange:n,elements:r={}}=t,o=Ri(),s=Eo()!=null,i=on(()=>new _p({open:e,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new ad,floatingId:o,nested:s,noEmit:!1})).current;return me(()=>{const a={open:e,floatingId:o};r.reference!==void 0&&(a.referenceElement=r.reference,a.domReferenceElement=et(r.reference)?r.reference:null),r.floating!==void 0&&(a.floatingElement=r.floating),i.update(a)},[e,o,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i.context.noEmit=!1,i}function NO(t={}){const{nodeId:e,externalTree:n}=t,r=Hk(t),o=t.rootContext||r,s={reference:o.useState("referenceElement"),floating:o.useState("floatingElement"),domReference:o.useState("domReferenceElement")},[i,a]=S.useState(null),l=S.useRef(null),c=ys(n);me(()=>{s.domReference&&(l.current=s.domReference)},[s.domReference]);const u=GR({...t,elements:{...s,...i&&{reference:i}}}),d=S.useCallback(E=>{const C=et(E)?{getBoundingClientRect:()=>E.getBoundingClientRect(),getClientRects:()=>E.getClientRects(),contextElement:E}:E;a(C),u.refs.setReference(C)},[u.refs]),[f,h]=S.useState(null),[p,g]=S.useState(null);o.useSyncedValue("referenceElement",f),o.useSyncedValue("domReferenceElement",et(f)?f:null),o.useSyncedValue("floatingElement",p);const m=S.useCallback(E=>{(et(E)||E===null)&&(l.current=E,h(E)),(et(u.refs.reference.current)||u.refs.reference.current===null||E!==null&&!et(E))&&u.refs.setReference(E)},[u.refs,h]),y=S.useCallback(E=>{g(E),u.refs.setFloating(E)},[u.refs]),b=S.useMemo(()=>({...u.refs,setReference:m,setFloating:y,setPositionReference:d,domReference:l}),[u.refs,m,y,d]),w=S.useMemo(()=>({...u.elements,domReference:s.domReference}),[u.elements,s.domReference]),k=o.useState("open"),v=o.useState("floatingId"),x=S.useMemo(()=>({...u,dataRef:o.context.dataRef,open:k,onOpenChange:o.setOpen,events:o.context.events,floatingId:v,refs:b,elements:w,nodeId:e,rootStore:o}),[u,b,w,e,o,k,v]);return me(()=>{o.context.dataRef.current.floatingContext=x;const E=c?.nodesRef.current.find(C=>C.id===e);E&&(E.context=x)}),S.useMemo(()=>({...u,context:x,refs:b,elements:w,rootStore:o}),[u,b,w,x,o])}function Wk(t){const{popupStore:e,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:o}=t,s=Ri(),i=Eo()!=null,a=e.useState("open"),l=e.useState("activeTriggerElement"),c=e.useState(r?"popupElement":"positionerElement"),u=e.context.triggerElements,d=on(()=>new _p({open:a,referenceElement:l,floatingElement:c,triggerElements:u,onOpenChange:o,floatingId:s,nested:i,noEmit:n})).current;return me(()=>{const f={open:a,floatingId:s,referenceElement:l,floatingElement:c};et(l)&&(f.domReferenceElement=l),d.state.positionReference===d.state.referenceElement&&(f.positionReference=l),d.update(f)},[a,s,l,c,d]),d.context.onOpenChange=o,d.context.nested=i,d.context.noEmit=n,d}const mh=xa("safe-polygon"),PO=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${qw}`;function AO(t){return t?!!t.closest(PO):!1}class Np{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.unbindMouseMove=()=>{},this.restTimeoutPending=!1,this.openChangeTimeout=new ss,this.restTimeout=new ss,this.handleCloseOptions=void 0}static create(){return new Np}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}function qk(t){const e=on(Np.create).current,n=t.context.dataRef.current;return n.hoverInteractionState||(n.hoverInteractionState=e),dp(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}const IO=new Set(["click","mousedown"]);function $O(t,e={}){const n="rootStore"in t?t.rootStore:t,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:a=!0,closeDelay:l=0}=e,c=qk(n),u=ys(),d=Eo(),f=de(()=>c.interactedInside?!0:i.current.openEvent?IO.has(i.current.openEvent.type):!1),h=de(()=>{const w=i.current.openEvent?.type;return w?.includes("mouse")&&w!=="mousedown"}),p=de(w=>Uw(w,n.context.triggerElements)),g=S.useCallback((w,k=!0)=>{const v=DO(l,c.pointerType);v&&!c.handler?c.openChangeTimeout.start(v,()=>n.setOpen(!1,De(kn,w))):k&&(c.openChangeTimeout.clear(),n.setOpen(!1,De(kn,w)))},[l,n,c]),m=de(()=>{c.unbindMouseMove(),c.handler=void 0}),y=de(()=>{if(c.performedPointerEventsMutation){const w=Ke(o).body;w.style.pointerEvents="",w.removeAttribute(mh),c.performedPointerEventsMutation=!1}}),b=de(w=>{const k=vn(w);if(!AO(k)){c.interactedInside=!1;return}c.interactedInside=!0});me(()=>{r||(c.pointerType=void 0,c.restTimeoutPending=!1,c.interactedInside=!1,m(),y())},[r,c,m,y]),S.useEffect(()=>()=>{m()},[m]),S.useEffect(()=>y,[y]),me(()=>{if(a&&r&&c.handleCloseOptions?.blockPointerEvents&&h()&&et(s)&&o){c.performedPointerEventsMutation=!0;const w=Ke(o).body;w.setAttribute(mh,"");const k=s,v=o,x=u?.nodesRef.current.find(E=>E.id===d)?.context?.elements.floating;return x&&(x.style.pointerEvents=""),w.style.pointerEvents="none",k.style.pointerEvents="auto",v.style.pointerEvents="auto",()=>{w.style.pointerEvents="",k.style.pointerEvents="",v.style.pointerEvents=""}}},[a,r,s,o,c,h,u,d]),S.useEffect(()=>{if(!a)return;function w(E){f()||!i.current.floatingContext||!n.select("open")||p(E.relatedTarget)||(y(),m(),f()||g(E))}function k(E){c.openChangeTimeout.clear(),y(),c.handler?.(E),m()}function v(E){f()||g(E,!1)}const x=o;return x&&(x.addEventListener("mouseleave",w),x.addEventListener("mouseenter",k),x.addEventListener("mouseleave",v),x.addEventListener("pointerdown",b,!0)),()=>{x&&(x.removeEventListener("mouseleave",w),x.removeEventListener("mouseenter",k),x.removeEventListener("mouseleave",v),x.removeEventListener("pointerdown",b,!0))}},[a,o,n,i,f,p,g,y,m,b,c])}function DO(t,e){return e&&!li(e)?0:typeof t=="function"?t():t}function Xd(t){return typeof t=="function"?t():t}const zO={current:null};function LO(t,e={}){const n="rootStore"in t?t.rootStore:t,{dataRef:r,events:o}=n.context,{enabled:s=!0,delay:i=0,handleClose:a=null,mouseOnly:l=!1,restMs:c=0,move:u=!0,triggerElementRef:d=zO,externalTree:f,isActiveTrigger:h=!0}=e,p=ys(f),g=qk(n),m=Dt(a),y=Dt(i),b=Dt(c),w=Dt(s);h&&(g.handleCloseOptions=m.current?.__options);const k=de(()=>g.interactedInside?!0:r.current.openEvent?["click","mousedown"].includes(r.current.openEvent.type):!1),v=de(z=>Uw(z,n.context.triggerElements)),x=S.useCallback((z,R=!0)=>{const _=Kd(y.current,"close",g.pointerType);_&&!g.handler?g.openChangeTimeout.start(_,()=>n.setOpen(!1,De(kn,z))):R&&(g.openChangeTimeout.clear(),n.setOpen(!1,De(kn,z)))},[y,n,g]),E=de(()=>{g.unbindMouseMove(),g.handler=void 0}),C=de(()=>{if(g.performedPointerEventsMutation){const z=Ke(n.select("domReferenceElement")).body;z.style.pointerEvents="",z.removeAttribute(mh),g.performedPointerEventsMutation=!1}});S.useEffect(()=>{if(!s)return;function z(R){R.open||(g.openChangeTimeout.clear(),g.restTimeout.clear(),g.blockMouseMove=!0,g.restTimeoutPending=!1)}return o.on("openchange",z),()=>{o.off("openchange",z)}},[s,o,g]);const A=de(z=>{if(k()||!r.current.floatingContext||v(z.relatedTarget))return;const R=d.current;m.current?.({...r.current.floatingContext,tree:p,x:z.clientX,y:z.clientY,onClose(){C(),E(),!k()&&R===n.select("domReferenceElement")&&x(z)}})(z)});return S.useEffect(()=>{if(!s)return;const z=d.current??(h?n.select("domReferenceElement"):null);if(!et(z))return;function R(L){if(g.openChangeTimeout.clear(),g.blockMouseMove=!1,l&&!li(g.pointerType)||Xd(b.current)>0&&!Kd(y.current,"open"))return;const H=Kd(y.current,"open",g.pointerType),Z=n.select("domReferenceElement"),W=n.context.triggerElements,q=(W.hasElement(L.target)||W.hasMatchingElement(B=>Fe(B,L.target)))&&(!Z||!Fe(Z,L.target)),V=L.currentTarget??null,D=n.select("open"),j=!D||q;q&&D?n.setOpen(!0,De(kn,L,V)):H?g.openChangeTimeout.start(H,()=>{j&&n.setOpen(!0,De(kn,L,V))}):j&&n.setOpen(!0,De(kn,L,V))}function _(L){if(k()){C();return}g.unbindMouseMove();const H=n.select("domReferenceElement"),Z=Ke(H);if(g.restTimeout.clear(),g.restTimeoutPending=!1,v(L.relatedTarget))return;if(m.current&&r.current.floatingContext){n.select("open")||g.openChangeTimeout.clear();const q=d.current;g.handler=m.current({...r.current.floatingContext,tree:p,x:L.clientX,y:L.clientY,onClose(){C(),E(),w.current&&!k()&&q===n.select("domReferenceElement")&&x(L,!0)}});const V=g.handler;V(L),Z.addEventListener("mousemove",V),g.unbindMouseMove=()=>{Z.removeEventListener("mousemove",V)};return}(g.pointerType!=="touch"||!Fe(n.select("floatingElement"),L.relatedTarget))&&x(L)}function N(L){A(L)}return n.select("open")&&z.addEventListener("mouseleave",N),u&&z.addEventListener("mousemove",R,{once:!0}),z.addEventListener("mouseenter",R),z.addEventListener("mouseleave",_),()=>{z.removeEventListener("mouseleave",N),u&&z.removeEventListener("mousemove",R),z.removeEventListener("mouseenter",R),z.removeEventListener("mouseleave",_)}},[E,C,r,y,x,n,s,m,A,g,h,k,v,l,u,b,d,p,w]),S.useMemo(()=>{if(!s)return;function z(R){g.pointerType=R.pointerType}return{onPointerDown:z,onPointerEnter:z,onMouseMove(R){const{nativeEvent:_}=R,N=R.currentTarget,L=n.select("domReferenceElement"),H=n.context.triggerElements,Z=n.select("open"),W=(H.hasElement(R.target)||H.hasMatchingElement(V=>Fe(V,R.target)))&&(!L||!Fe(L,R.target));if(l&&!li(g.pointerType)||Z&&!W||Xd(b.current)===0||!W&&g.restTimeoutPending&&R.movementX**2+R.movementY**2<2)return;g.restTimeout.clear();function q(){if(g.restTimeoutPending=!1,k())return;const V=n.select("open");!g.blockMouseMove&&(!V||W)&&n.setOpen(!0,De(kn,_,N))}g.pointerType==="touch"?lr.flushSync(()=>{q()}):W&&Z?q():(g.restTimeoutPending=!0,g.restTimeout.start(Xd(b.current),q))}}},[s,g,k,l,n,b])}function ld(t=[]){const e=t.map(c=>c?.reference),n=t.map(c=>c?.floating),r=t.map(c=>c?.item),o=t.map(c=>c?.trigger),s=S.useCallback(c=>ul(c,t,"reference"),e),i=S.useCallback(c=>ul(c,t,"floating"),n),a=S.useCallback(c=>ul(c,t,"item"),r),l=S.useCallback(c=>ul(c,t,"trigger"),o);return S.useMemo(()=>({getReferenceProps:s,getFloatingProps:i,getItemProps:a,getTriggerProps:l}),[s,i,a,l])}function ul(t,e,n){const r=new Map,o=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[sh]="");for(const i in t)o&&t&&(i===Hw||i===Ww)||(s[i]=t[i]);for(let i=0;i<e.length;i+=1){let a;const l=e[i]?.[n];typeof l=="function"?a=t?l(t):null:a=l,a&&Qg(s,a,o,r)}return Qg(s,t,o,r),s}function Qg(t,e,n,r){for(const o in e){const s=e[o];n&&(o===Hw||o===Ww)||(o.startsWith("on")?(r.has(o)||r.set(o,[]),typeof s=="function"&&(r.get(o)?.push(s),t[o]=(...i)=>r.get(o)?.map(a=>a(...i)).find(a=>a!==void 0))):t[o]=s)}}const jO="Escape";function cd(t,e,n){switch(t){case"vertical":return e;case"horizontal":return n;default:return e||n}}function dl(t,e){return cd(e,t===mp||t===Ha,t===oo||t===so)}function Qd(t,e,n){return cd(e,t===Ha,n?t===oo:t===so)||t==="Enter"||t===" "||t===""}function FO(t,e,n){return cd(e,n?t===oo:t===so,t===Ha)}function BO(t,e,n,r){const o=n?t===so:t===oo,s=t===mp;return e==="both"||e==="horizontal"&&r&&r>1?t===jO:cd(e,o,s)}function VO(t,e){const n="rootStore"in t?t.rootStore:t,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),i=n.context.dataRef,{listRef:a,activeIndex:l,onNavigate:c=()=>{},enabled:u=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:h=!1,nested:p=!1,rtl:g=!1,virtual:m=!1,focusItemOnOpen:y="auto",focusItemOnHover:b=!0,openOnArrowKeyDown:w=!0,disabledIndices:k=void 0,orientation:v="vertical",parentOrientation:x,cols:E=1,id:C,resetOnPointerLeave:A=!0,externalTree:z}=e,R=wa(o),_=Dt(R),N=Eo(),L=ys(z);me(()=>{i.current.orientation=v},[i,v]);const H=ih(s),Z=S.useRef(y),W=S.useRef(d??-1),q=S.useRef(null),V=S.useRef(!0),D=de(ne=>{c(W.current===-1?null:W.current,ne)}),j=S.useRef(D),B=S.useRef(!!o),F=S.useRef(r),T=S.useRef(!1),$=S.useRef(!1),I=Dt(k),Y=Dt(r),G=Dt(d),X=Dt(A),se=de(()=>{function ne(ye){m?L?.events.emit("virtualfocus",ye):sa(ye,{sync:T.current,preventScroll:!0})}const le=a.current[W.current],Q=$.current;le&&ne(le),(T.current?ye=>ye():requestAnimationFrame)(()=>{const ye=a.current[W.current]||le;if(!ye)return;le||ne(ye),P&&(Q||!V.current)&&ye.scrollIntoView?.({block:"nearest",inline:"nearest"})})});me(()=>{u&&(r&&o?(W.current=d??-1,Z.current&&d!=null&&($.current=!0,D())):B.current&&(W.current=-1,j.current()))},[u,r,o,d,D]),me(()=>{if(u){if(!r){T.current=!1;return}if(o)if(l==null){if(T.current=!1,G.current!=null)return;if(B.current&&(W.current=-1,se()),(!F.current||!B.current)&&Z.current&&(q.current!=null||Z.current===!0&&q.current==null)){let ne=0;const le=()=>{a.current[0]==null?(ne<2&&(ne?requestAnimationFrame:queueMicrotask)(le),ne+=1):(W.current=q.current==null||Qd(q.current,v,g)||p?Ec(a):ch(a),q.current=null,D())};le()}}else Ys(a,l)||(W.current=l,se(),$.current=!1)}},[u,r,o,l,G,p,a,v,g,D,se,I]),me(()=>{if(!u||o||!L||m||!B.current)return;const ne=L.nodesRef.current,le=ne.find(ye=>ye.id===N)?.context?.elements.floating,Q=Hn(Ke(o)),fe=ne.some(ye=>ye.context&&Fe(ye.context.elements.floating,Q));le&&!fe&&V.current&&le.focus({preventScroll:!0})},[u,o,L,N,m]),me(()=>{j.current=D,F.current=r,B.current=!!o}),me(()=>{r||(q.current=null,Z.current=y)},[r,y]);const O=l!=null,P=S.useMemo(()=>{function ne(Q){if(!Y.current)return;const fe=a.current.indexOf(Q.currentTarget);fe!==-1&&W.current!==fe&&(W.current=fe,D(Q))}return{onFocus(Q){T.current=!0,ne(Q)},onClick:({currentTarget:Q})=>Q.focus({preventScroll:!0}),onMouseMove(Q){T.current=!0,$.current=!1,b&&ne(Q)},onPointerLeave(Q){if(!Y.current||!V.current||Q.pointerType==="touch")return;T.current=!0;const fe=Q.relatedTarget;!b||a.current.includes(fe)||X.current&&(sa(null,{sync:!0}),W.current=-1,D(Q),m||_.current?.focus({preventScroll:!0}))}}},[Y,_,b,a,D,X,m]),U=S.useCallback(()=>x??L?.nodesRef.current.find(ne=>ne.id===N)?.context?.dataRef?.current.orientation,[N,L,x]),K=de(ne=>{if(V.current=!1,T.current=!0,ne.which===229||!Y.current&&ne.currentTarget===_.current)return;if(p&&BO(ne.key,v,g,E)){dl(ne.key,U())||Ut(ne),n.setOpen(!1,De(Ud,ne.nativeEvent)),gt(s)&&(m?L?.events.emit("virtualfocus",s):s.focus());return}const le=W.current,Q=Ec(a,k),fe=ch(a,k);if(H||(ne.key==="Home"&&(Ut(ne),W.current=Q,D(ne)),ne.key==="End"&&(Ut(ne),W.current=fe,D(ne))),E>1){const ye=Array.from({length:a.current.length},()=>({width:1,height:1})),he=Xw(ye,E,!1),Ue=he.findIndex(Ve=>Ve!=null&&!io(a,Ve,k)),Ze=he.reduce((Ve,ze,Ye)=>ze!=null&&!io(a,ze,k)?Ye:Ve,-1),ft=he[Jw({current:he.map(Ve=>Ve!=null?a.current[Ve]:null)},{event:ne,orientation:v,loopFocus:h,rtl:g,cols:E,disabledIndices:ek([...(typeof k!="function"?k:null)||a.current.map((Ve,ze)=>io(a,ze,k)?ze:void 0),void 0],he),minIndex:Ue,maxIndex:Ze,prevIndex:Qw(W.current>fe?Q:W.current,ye,he,E,ne.key===Ha?"bl":ne.key===(g?oo:so)?"tr":"tl"),stopEvent:!0})];if(ft!=null&&(W.current=ft,D(ne)),v==="both")return}if(dl(ne.key,v)){if(Ut(ne),r&&!m&&Hn(ne.currentTarget.ownerDocument)===ne.currentTarget){W.current=Qd(ne.key,v,g)?Q:fe,D(ne);return}Qd(ne.key,v,g)?h?le>=fe?f&&le!==a.current.length?W.current=-1:(T.current=!1,W.current=Q):W.current=Bt(a,{startingIndex:le,disabledIndices:k}):W.current=Math.min(fe,Bt(a,{startingIndex:le,disabledIndices:k})):h?le<=Q?f&&le!==-1?W.current=a.current.length:(T.current=!1,W.current=fe):W.current=Bt(a,{startingIndex:le,decrement:!0,disabledIndices:k}):W.current=Math.max(Q,Bt(a,{startingIndex:le,decrement:!0,disabledIndices:k})),Ys(a,W.current)&&(W.current=-1),D(ne)}}),J=S.useMemo(()=>m&&r&&O&&{"aria-activedescendant":`${C}-${l}`},[m,r,O,C,l]),ee=S.useMemo(()=>({"aria-orientation":v==="both"?void 0:v,...H?{}:J,onKeyDown(ne){if(ne.key==="Tab"&&ne.shiftKey&&r&&!m){const le=vn(ne.nativeEvent);if(le&&!Fe(_.current,le))return;Ut(ne),n.setOpen(!1,De(is,ne.nativeEvent)),gt(s)&&s.focus();return}K(ne)},onPointerMove(){V.current=!0}}),[J,K,_,v,H,n,r,m,s]),ie=S.useMemo(()=>{function ne(Q){y==="auto"&&Kw(Q.nativeEvent)&&(Z.current=!m)}function le(Q){Z.current=y,y==="auto"&&Yw(Q.nativeEvent)&&(Z.current=!0)}return{onKeyDown(Q){const fe=n.select("open");V.current=!1;const ye=Q.key.startsWith("Arrow"),he=FO(Q.key,U(),g),Ue=dl(Q.key,v),Ze=(p?he:Ue)||Q.key==="Enter"||Q.key.trim()==="";if(m&&fe)return K(Q);if(!(!fe&&!w&&ye)){if(Ze){const ft=dl(Q.key,U());q.current=p&&ft?null:Q.key}if(p){he&&(Ut(Q),fe?(W.current=Ec(a,I.current),D(Q)):n.setOpen(!0,De(Ud,Q.nativeEvent,Q.currentTarget)));return}Ue&&(G.current!=null&&(W.current=G.current),Ut(Q),!fe&&w?n.setOpen(!0,De(Ud,Q.nativeEvent,Q.currentTarget)):K(Q),fe&&D(Q))}},onFocus(Q){n.select("open")&&!m&&(W.current=-1,D(Q))},onPointerDown:le,onPointerEnter:le,onMouseDown:ne,onClick:ne}},[K,I,y,a,p,D,n,w,v,U,g,G,m]),oe=S.useMemo(()=>({...J,...ie}),[J,ie]);return S.useMemo(()=>u?{reference:oe,floating:ee,item:P,trigger:ie}:{},[u,oe,ee,ie,P])}const HO=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Uk(t,e={}){const n="rootStore"in t?t.rootStore:t,r=n.useState("open"),o=n.useState("floatingId"),s=n.useState("domReferenceElement"),i=n.useState("floatingElement"),{role:a="dialog"}=e,l=Ri(),c=s?.id||l,u=S.useMemo(()=>wa(i)?.id||o,[i,o]),d=HO.get(a)??a,h=Eo()!=null,p=S.useMemo(()=>d==="tooltip"||a==="label"?At:{"aria-haspopup":d==="alertdialog"?"dialog":d,"aria-expanded":"false",...d==="listbox"&&{role:"combobox"},...d==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[d,h,a]),g=S.useMemo(()=>d==="tooltip"||a==="label"?{[`aria-${a==="label"?"labelledby":"describedby"}`]:r?u:void 0}:{...p,"aria-expanded":r?"true":"false","aria-controls":r?u:void 0,...d==="menu"&&{id:c}},[d,u,r,c,a,p]),m=S.useMemo(()=>{const b={id:u,...d&&{role:d}};return d==="tooltip"||a==="label"?b:{...b,...d==="menu"&&{"aria-labelledby":c}}},[d,u,c,a]),y=S.useCallback(({active:b,selected:w})=>{const k={role:"option",...b&&{id:`${u}-fui-option`}};switch(a){case"select":case"combobox":return{...k,"aria-selected":w}}return{}},[u,a]);return S.useMemo(()=>({reference:g,floating:m,item:y,trigger:p}),[g,m,p,y])}function WO(t,e){const n="rootStore"in t?t.rootStore:t,r=n.context.dataRef,o=n.useState("open"),{listRef:s,activeIndex:i,onMatch:a,onTypingChange:l,enabled:c=!0,resetMs:u=750,selectedIndex:d=null}=e,f=Sn(),h=S.useRef(""),p=S.useRef(d??i??-1),g=S.useRef(null);me(()=>{!o&&d!==null||(f.clear(),g.current=null,h.current!==""&&(h.current=""))},[o,d,f]),me(()=>{o&&h.current===""&&(p.current=d??i??-1)},[o,d,i]);const m=de(v=>{v?r.current.typing||(r.current.typing=v,l?.(v)):r.current.typing&&(r.current.typing=v,l?.(v))}),y=de(v=>{function x(_,N,L){const H=N.find(Z=>Z?.toLocaleLowerCase().indexOf(L.toLocaleLowerCase())===0);return H?_.indexOf(H):-1}const E=s.current;if(h.current.length>0&&h.current[0]!==" "&&(x(E,E,h.current)===-1?m(!1):v.key===" "&&Ut(v)),E==null||v.key.length!==1||v.ctrlKey||v.metaKey||v.altKey)return;o&&v.key!==" "&&(Ut(v),m(!0));const C=h.current==="";C&&(p.current=d??i??-1),E.every(_=>_?_[0]?.toLocaleLowerCase()!==_[1]?.toLocaleLowerCase():!0)&&h.current===v.key&&(h.current="",p.current=g.current),h.current+=v.key,f.start(u,()=>{h.current="",p.current=g.current,m(!1)});const z=C?d??i??-1:p.current,R=x(E,[...E.slice((z||0)+1),...E.slice(0,(z||0)+1)],h.current);R!==-1?(a?.(R),g.current=R):v.key!==" "&&(h.current="",m(!1))}),b=de(v=>{const x=v.relatedTarget,E=n.select("domReferenceElement"),C=n.select("floatingElement"),A=Fe(E,x),z=Fe(C,x);A||z||(f.clear(),h.current="",p.current=g.current,m(!1))}),w=S.useMemo(()=>({onKeyDown:y,onBlur:b}),[y,b]),k=S.useMemo(()=>({onKeyDown:y,onKeyUp(v){v.key===" "&&m(!1)},onBlur:b}),[y,b,m]);return S.useMemo(()=>c?{reference:w,floating:k}:{},[c,w,k])}function ey(t,e){const[n,r]=t;let o=!1;const s=e.length;for(let i=0,a=s-1;i<s;a=i++){const[l,c]=e[i]||[0,0],[u,d]=e[a]||[0,0];c>=r!=d>=r&&n<=(u-l)*(r-c)/(d-c)+l&&(o=!o)}return o}function qO(t,e){return t[0]>=e.x&&t[0]<=e.x+e.width&&t[1]>=e.y&&t[1]<=e.y+e.height}function UO(t={}){const{buffer:e=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=t,o=new ss;let s=!1,i=null,a=null,l=typeof performance<"u"?performance.now():0;function c(d,f){const h=performance.now(),p=h-l;if(i===null||a===null||p===0)return i=d,a=f,l=h,null;const g=d-i,m=f-a,b=Math.sqrt(g*g+m*m)/p;return i=d,a=f,l=h,b}const u=({x:d,y:f,placement:h,elements:p,onClose:g,nodeId:m,tree:y})=>function(w){function k(){o.clear(),g()}if(o.clear(),!p.domReference||!p.floating||h==null||d==null||f==null)return;const{clientX:v,clientY:x}=w,E=[v,x],C=vn(w),A=w.type==="mouseleave",z=Fe(p.floating,C),R=Fe(p.domReference,C),_=p.domReference.getBoundingClientRect(),N=p.floating.getBoundingClientRect(),L=h.split("-")[0],H=d>N.right-N.width/2,Z=f>N.bottom-N.height/2,W=qO(E,_),q=N.width>_.width,V=N.height>_.height,D=(q?_:N).left,j=(q?_:N).right,B=(V?_:N).top,F=(V?_:N).bottom;if(z&&(s=!0,!A))return;if(R&&(s=!1),R&&!A){s=!0;return}if(A&&et(w.relatedTarget)&&Fe(p.floating,w.relatedTarget)||y&&Xo(y.nodesRef.current,m).some(({context:I})=>I?.open))return;if(L==="top"&&f>=_.bottom-1||L==="bottom"&&f<=_.top+1||L==="left"&&d>=_.right-1||L==="right"&&d<=_.left+1)return k();let T=[];switch(L){case"top":T=[[D,_.top+1],[D,N.bottom-1],[j,N.bottom-1],[j,_.top+1]];break;case"bottom":T=[[D,N.top+1],[D,_.bottom-1],[j,_.bottom-1],[j,N.top+1]];break;case"left":T=[[N.right-1,F],[N.right-1,B],[_.left+1,B],[_.left+1,F]];break;case"right":T=[[_.right-1,F],[_.right-1,B],[N.left+1,B],[N.left+1,F]];break}function $([I,Y]){switch(L){case"top":{const G=[q?I+e/2:H?I+e*4:I-e*4,Y+e+1],X=[q?I-e/2:H?I+e*4:I-e*4,Y+e+1],se=[[N.left,H||q?N.bottom-e:N.top],[N.right,H?q?N.bottom-e:N.top:N.bottom-e]];return[G,X,...se]}case"bottom":{const G=[q?I+e/2:H?I+e*4:I-e*4,Y-e],X=[q?I-e/2:H?I+e*4:I-e*4,Y-e],se=[[N.left,H||q?N.top+e:N.bottom],[N.right,H?q?N.top+e:N.bottom:N.top+e]];return[G,X,...se]}case"left":{const G=[I+e+1,V?Y+e/2:Z?Y+e*4:Y-e*4],X=[I+e+1,V?Y-e/2:Z?Y+e*4:Y-e*4];return[...[[Z||V?N.right-e:N.left,N.top],[Z?V?N.right-e:N.left:N.right-e,N.bottom]],G,X]}case"right":{const G=[I-e,V?Y+e/2:Z?Y+e*4:Y-e*4],X=[I-e,V?Y-e/2:Z?Y+e*4:Y-e*4],se=[[Z||V?N.left+e:N.right,N.top],[Z?V?N.left+e:N.right:N.left+e,N.bottom]];return[G,X,...se]}default:return[]}}if(!ey([v,x],T)){if(s&&!W)return k();if(!A&&r){const I=c(w.clientX,w.clientY);if(I!==null&&I<.1)return k()}ey([v,x],$([d,f]))?!s&&r&&o.start(40,k):k()}};return u.__options={blockPointerEvents:n},u}let qo=(function(t){return t.open="data-open",t.closed="data-closed",t[t.startingStyle=Sa.startingStyle]="startingStyle",t[t.endingStyle=Sa.endingStyle]="endingStyle",t.anchorHidden="data-anchor-hidden",t.side="data-side",t.align="data-align",t})({}),gh=(function(t){return t.popupOpen="data-popup-open",t.pressed="data-pressed",t})({});const KO={[gh.popupOpen]:""},YO={[gh.popupOpen]:"",[gh.pressed]:""},ZO={[qo.open]:""},GO={[qo.closed]:""},JO={[qo.anchorHidden]:""},Kk={open(t){return t?KO:null}},Yk={open(t){return t?YO:null}},Ni={open(t){return t?ZO:GO},anchorHidden(t){return t?JO:null}};function bs(t){return Ri(t,"base-ui")}const XO=S.createContext(void 0);function Pp(){return S.useContext(XO)?.direction??"ltr"}const QO=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:l}=e,{element:c,padding:u=0,offsetParent:d="real"}=Dr(t,e)||{};if(c==null)return{};const f=Gw(u),h={x:n,y:r},p=vp(o),g=bp(p),m=await i.getDimensions(c),y=p==="y",b=y?"top":"left",w=y?"bottom":"right",k=y?"clientHeight":"clientWidth",v=s.reference[g]+s.reference[p]-h[p]-s.floating[g],x=h[p]-s.reference[p],E=d==="real"?await i.getOffsetParent?.(c):a.floating;let C=a.floating[k]||s.floating[g];(!C||!await i.isElement?.(E))&&(C=a.floating[k]||s.floating[g]);const A=v/2-x/2,z=C/2-m[g]/2-1,R=Math.min(f[b],z),_=Math.min(f[w],z),N=R,L=C-m[g]-_,H=C/2-m[g]/2+A,Z=ah(N,H,L),W=!l.arrow&&So(o)!=null&&H!==Z&&s.reference[g]/2-(H<N?R:_)-m[g]/2<0,q=W?H<N?H-N:H-L:0;return{[p]:h[p]+q,data:{[p]:Z,centerOffset:H-Z-q,...W&&{alignmentOffset:q}},reset:W}}}),e_=(t,e)=>({...QO(t),options:[t,e]}),t_={name:"hide",async fn(t){const{width:e,height:n,x:r,y:o}=t.rects.reference,s=e===0&&n===0&&r===0&&o===0;return{data:{referenceHidden:(await nO().fn(t)).data?.referenceHidden||s}}}},Tc={sideX:"left",sideY:"top"},n_={name:"adaptiveOrigin",async fn(t){const{x:e,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:a}=t,l=Mt(o),c=l.getComputedStyle(o);if(!(c.transitionDuration!=="0s"&&c.transitionDuration!==""))return{x:e,y:n,data:Tc};const d=await s.getOffsetParent?.(o);let f={width:0,height:0};if(i==="fixed"&&l?.visualViewport)f={width:l.visualViewport.width,height:l.visualViewport.height};else if(d===l){const b=Ke(o);f={width:b.documentElement.clientWidth,height:b.documentElement.clientHeight}}else await s.isElement?.(d)&&(f=await s.getDimensions(d));const h=hn(a);let p=e,g=n;h==="left"&&(p=f.width-(e+r.width)),h==="top"&&(g=f.height-(n+r.height));const m=h==="left"?"right":Tc.sideX,y=h==="top"?"bottom":Tc.sideY;return{x:p,y:g,data:{sideX:m,sideY:y}}}};function Zk(t,e,n){const r=t==="inline-start"||t==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[e]}function ty(t,e,n){const{rects:r,placement:o}=t;return{side:Zk(e,hn(o),n),align:So(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Gk(t){const{anchor:e,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,collisionBoundary:a,collisionPadding:l=5,sticky:c=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:f=!1,floatingRootContext:h,mounted:p,collisionAvoidance:g,shiftCrossAxis:m=!1,nodeId:y,adaptiveOrigin:b,lazyFlip:w=!1,externalTree:k}=t,[v,x]=S.useState(null);!p&&v!==null&&x(null);const E=g.side||"flip",C=g.align||"flip",A=g.fallbackAxisSide||"end",z=typeof e=="function"?e:void 0,R=de(z),_=z?R:e,N=Dt(e),H=Pp()==="rtl",Z=v||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":H?"left":"right","inline-start":H?"right":"left"}[r],W=s==="center"?Z:`${Z}-${s}`;let q=l;const V=1,D=r==="bottom"?V:0,j=r==="top"?V:0,B=r==="right"?V:0,F=r==="left"?V:0;typeof q=="number"?q={top:q+D,right:q+F,bottom:q+j,left:q+B}:q&&(q={top:(q.top||0)+D,right:(q.right||0)+F,bottom:(q.bottom||0)+j,left:(q.left||0)+B});const T={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:q},$=S.useRef(null),I=Dt(o),Y=Dt(i),se=[JR(He=>{const kt=ty(He,r,H),ke=typeof I.current=="function"?I.current(kt):I.current,Ee=typeof Y.current=="function"?Y.current(kt):Y.current;return{mainAxis:ke,crossAxis:Ee,alignmentAxis:Ee}},[typeof o!="function"?o:0,typeof i!="function"?i:0,H,r])],O=C==="none"&&E!=="shift",P=!O&&(c||m||E==="shift"),U=E==="none"?null:eO({...T,padding:{top:q.top+V,right:q.right+V,bottom:q.bottom+V,left:q.left+V},mainAxis:!m&&E==="flip",crossAxis:C==="flip"?"alignment":!1,fallbackAxisSideDirection:A}),K=O?null:XR(He=>{const kt=Ke(He.elements.floating).documentElement;return{...T,rootBoundary:m?{x:0,y:0,width:kt.clientWidth,height:kt.clientHeight}:void 0,mainAxis:C!=="none",crossAxis:P,limiter:c||m?void 0:QR(ke=>{if(!$.current)return{};const{width:Ee,height:we}=$.current.getBoundingClientRect(),Ne=In(hn(ke.placement)),ct=Ne==="y"?Ee:we,Pe=Ne==="y"?q.left+q.right:q.top+q.bottom;return{offset:ct/2+Pe/2}})}},[T,c,m,q,C]);E==="shift"||C==="shift"||s==="center"?se.push(K,U):se.push(U,K),se.push(tO({...T,apply({elements:{floating:He},rects:{reference:kt},availableWidth:ke,availableHeight:Ee}){const we=He.style;we.setProperty("--available-width",`${ke}px`),we.setProperty("--available-height",`${Ee}px`),we.setProperty("--anchor-width",`${kt.width}px`),we.setProperty("--anchor-height",`${kt.height}px`)}}),e_(()=>({element:$.current||document.createElement("div"),padding:u,offsetParent:"floating"}),[u]),{name:"transformOrigin",fn(He){const{elements:kt,middlewareData:ke,placement:Ee,rects:we,y:Ne}=He,ct=hn(Ee),Pe=In(ct),Jn=$.current,Fr=ke.arrow?.x||0,Br=ke.arrow?.y||0,mr=Jn?.clientWidth||0,gr=Jn?.clientHeight||0,Ae=Fr+mr/2,ut=Br+gr/2,ln=Math.abs(ke.shift?.y||0),cn=we.reference.height/2,Nt=typeof o=="function"?o(ty(He,r,H)):o,Os=ln>Nt,Og={top:`${Ae}px calc(100% + ${Nt}px)`,bottom:`${Ae}px ${-Nt}px`,left:`calc(100% + ${Nt}px) ${ut}px`,right:`${-Nt}px ${ut}px`}[ct],zT=`${Ae}px ${we.reference.y+cn-Ne}px`;return kt.floating.style.setProperty("--transform-origin",P&&Pe==="y"&&Os?zT:Og),{}}},t_,b),me(()=>{!p&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[p,h]);const J=S.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<"u",layoutShift:!d&&typeof IntersectionObserver<"u"}),[d]),{refs:ee,elements:ie,x:oe,y:ne,middlewareData:le,update:Q,placement:fe,context:ye,isPositioned:he,floatingStyles:Ue}=NO({rootContext:h,placement:W,middleware:se,strategy:n,whileElementsMounted:f?void 0:(...He)=>Zg(...He,J),nodeId:y,externalTree:k}),{sideX:Ze,sideY:ft}=le.adaptiveOrigin||Tc,Ve=he?n:"fixed",ze=S.useMemo(()=>{const He=b?{position:Ve,[Ze]:oe,[ft]:ne}:{position:Ve,...Ue};return he||(He.opacity=0),He},[b,Ve,Ze,oe,ft,ne,Ue,he]),Ye=S.useRef(null);me(()=>{if(!p)return;const He=N.current,kt=typeof He=="function"?He():He,Ee=(ny(kt)?kt.current:kt)||null||null;Ee!==Ye.current&&(ee.setPositionReference(Ee),Ye.current=Ee)},[p,ee,_,N]),S.useEffect(()=>{if(!p)return;const He=N.current;typeof He!="function"&&ny(He)&&He.current!==Ye.current&&(ee.setPositionReference(He.current),Ye.current=He.current)},[p,ee,_,N]),S.useEffect(()=>{if(f&&p&&ie.domReference&&ie.floating)return Zg(ie.domReference,ie.floating,Q,J)},[f,p,ie,Q,J]);const Ge=hn(fe),Ln=Zk(r,Ge,H),Gn=So(fe)||"center",jn=!!le.hide?.referenceHidden;me(()=>{w&&p&&he&&x(Ge)},[w,p,he,Ge]);const Mn=S.useMemo(()=>({position:"absolute",top:le.arrow?.y,left:le.arrow?.x}),[le.arrow]),Xt=le.arrow?.centerOffset!==0;return S.useMemo(()=>({positionerStyles:ze,arrowStyles:Mn,arrowRef:$,arrowUncentered:Xt,side:Ln,align:Gn,physicalSide:Ge,anchorHidden:jn,refs:ee,context:ye,isPositioned:he,update:Q}),[ze,Mn,$,Xt,Ln,Gn,Ge,jn,ee,ye,he,Q])}function ny(t){return t!=null&&"current"in t}function ud(t){return t==="starting"?zM:At}function dd(t){return xp(19)?t:t?"true":void 0}function Jk(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(n=Jk(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function Xk(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=Jk(t))&&(r&&(r+=" "),r+=e);return r}const r_=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r<t.length;r++)n[r]=t[r];for(let r=0;r<e.length;r++)n[t.length+r]=e[r];return n},o_=(t,e)=>({classGroupId:t,validator:e}),Qk=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),Vc="-",ry=[],s_="arbitrary..",i_=t=>{const e=l_(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return a_(i);const a=i.split(Vc),l=a[0]===""&&a.length>1?1:0;return ex(a,l,e)},getConflictingClassGroupIds:(i,a)=>{if(a){const l=r[i],c=n[i];return l?c?r_(c,l):l:c||ry}return n[i]||ry}}},ex=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const o=t[e],s=n.nextPart.get(o);if(s){const c=ex(t,e+1,s);if(c)return c}const i=n.validators;if(i===null)return;const a=e===0?t.join(Vc):t.slice(e).join(Vc),l=i.length;for(let c=0;c<l;c++){const u=i[c];if(u.validator(a))return u.classGroupId}},a_=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?s_+r:void 0})(),l_=t=>{const{theme:e,classGroups:n}=t;return c_(n,e)},c_=(t,e)=>{const n=Qk();for(const r in t){const o=t[r];Ap(o,n,r,e)}return n},Ap=(t,e,n,r)=>{const o=t.length;for(let s=0;s<o;s++){const i=t[s];u_(i,e,n,r)}},u_=(t,e,n,r)=>{if(typeof t=="string"){d_(t,e,n);return}if(typeof t=="function"){f_(t,e,n,r);return}h_(t,e,n,r)},d_=(t,e,n)=>{const r=t===""?e:tx(e,t);r.classGroupId=n},f_=(t,e,n,r)=>{if(p_(t)){Ap(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(o_(n,t))},h_=(t,e,n,r)=>{const o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){const[a,l]=o[i];Ap(l,tx(e,a),n,r)}},tx=(t,e)=>{let n=t;const r=e.split(Vc),o=r.length;for(let s=0;s<o;s++){const i=r[s];let a=n.nextPart.get(i);a||(a=Qk(),n.nextPart.set(i,a)),n=a}return n},p_=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,m_=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const o=(s,i)=>{n[s]=i,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(s){let i=n[s];if(i!==void 0)return i;if((i=r[s])!==void 0)return o(s,i),i},set(s,i){s in n?n[s]=i:o(s,i)}}},yh="!",oy=":",g_=[],sy=(t,e,n,r,o)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),y_=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=o=>{const s=[];let i=0,a=0,l=0,c;const u=o.length;for(let g=0;g<u;g++){const m=o[g];if(i===0&&a===0){if(m===oy){s.push(o.slice(l,g)),l=g+1;continue}if(m==="/"){c=g;continue}}m==="["?i++:m==="]"?i--:m==="("?a++:m===")"&&a--}const d=s.length===0?o:o.slice(l);let f=d,h=!1;d.endsWith(yh)?(f=d.slice(0,-1),h=!0):d.startsWith(yh)&&(f=d.slice(1),h=!0);const p=c&&c>l?c-l:void 0;return sy(s,h,f,p)};if(e){const o=e+oy,s=r;r=i=>i.startsWith(o)?s(i.slice(o.length)):sy(g_,!1,i,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},b_=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let s=0;s<n.length;s++){const i=n[s],a=i[0]==="[",l=e.has(i);a||l?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(i)):o.push(i)}return o.length>0&&(o.sort(),r.push(...o)),r}},v_=t=>({cache:m_(t.cacheSize),parseClassName:y_(t),sortModifiers:b_(t),...i_(t)}),w_=/\s+/,k_=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=e,i=[],a=t.trim().split(w_);let l="";for(let c=a.length-1;c>=0;c-=1){const u=a[c],{isExternal:d,modifiers:f,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:g}=n(u);if(d){l=u+(l.length>0?" "+l:l);continue}let m=!!g,y=r(m?p.substring(0,g):p);if(!y){if(!m){l=u+(l.length>0?" "+l:l);continue}if(y=r(p),!y){l=u+(l.length>0?" "+l:l);continue}m=!1}const b=f.length===0?"":f.length===1?f[0]:s(f).join(":"),w=h?b+yh:b,k=w+y;if(i.indexOf(k)>-1)continue;i.push(k);const v=o(y,m);for(let x=0;x<v.length;++x){const E=v[x];i.push(w+E)}l=u+(l.length>0?" "+l:l)}return l},x_=(...t)=>{let e=0,n,r,o="";for(;e<t.length;)(n=t[e++])&&(r=nx(n))&&(o&&(o+=" "),o+=r);return o},nx=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=nx(t[r]))&&(n&&(n+=" "),n+=e);return n},S_=(t,...e)=>{let n,r,o,s;const i=l=>{const c=e.reduce((u,d)=>d(u),t());return n=v_(c),r=n.cache.get,o=n.cache.set,s=a,a(l)},a=l=>{const c=r(l);if(c)return c;const u=k_(l,n);return o(l,u),u};return s=i,(...l)=>s(x_(...l))},E_=[],Pt=t=>{const e=n=>n[t]||E_;return e.isThemeGetter=!0,e},rx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ox=/^\((?:(\w[\w-]*):)?(.+)\)$/i,C_=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,T_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,M_=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,R_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,O_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,__=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Vr=t=>C_.test(t),je=t=>!!t&&!Number.isNaN(Number(t)),Hr=t=>!!t&&Number.isInteger(Number(t)),ef=t=>t.endsWith("%")&&je(t.slice(0,-1)),yr=t=>T_.test(t),sx=()=>!0,N_=t=>M_.test(t)&&!R_.test(t),Ip=()=>!1,P_=t=>O_.test(t),A_=t=>__.test(t),I_=t=>!be(t)&&!ve(t),$_=t=>To(t,lx,Ip),be=t=>rx.test(t),$o=t=>To(t,cx,N_),iy=t=>To(t,H_,je),D_=t=>To(t,dx,sx),z_=t=>To(t,ux,Ip),ay=t=>To(t,ix,Ip),L_=t=>To(t,ax,A_),fl=t=>To(t,fx,P_),ve=t=>ox.test(t),zi=t=>vs(t,cx),j_=t=>vs(t,ux),ly=t=>vs(t,ix),F_=t=>vs(t,lx),B_=t=>vs(t,ax),hl=t=>vs(t,fx,!0),V_=t=>vs(t,dx,!0),To=(t,e,n)=>{const r=rx.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},vs=(t,e,n=!1)=>{const r=ox.exec(t);return r?r[1]?e(r[1]):n:!1},ix=t=>t==="position"||t==="percentage",ax=t=>t==="image"||t==="url",lx=t=>t==="length"||t==="size"||t==="bg-size",cx=t=>t==="length",H_=t=>t==="number",ux=t=>t==="family-name",dx=t=>t==="number"||t==="weight",fx=t=>t==="shadow",W_=()=>{const t=Pt("color"),e=Pt("font"),n=Pt("text"),r=Pt("font-weight"),o=Pt("tracking"),s=Pt("leading"),i=Pt("breakpoint"),a=Pt("container"),l=Pt("spacing"),c=Pt("radius"),u=Pt("shadow"),d=Pt("inset-shadow"),f=Pt("text-shadow"),h=Pt("drop-shadow"),p=Pt("blur"),g=Pt("perspective"),m=Pt("aspect"),y=Pt("ease"),b=Pt("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],v=()=>[...k(),ve,be],x=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],C=()=>[ve,be,l],A=()=>[Vr,"full","auto",...C()],z=()=>[Hr,"none","subgrid",ve,be],R=()=>["auto",{span:["full",Hr,ve,be]},Hr,ve,be],_=()=>[Hr,"auto",ve,be],N=()=>["auto","min","max","fr",ve,be],L=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],Z=()=>["auto",...C()],W=()=>[Vr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...C()],q=()=>[Vr,"screen","full","dvw","lvw","svw","min","max","fit",...C()],V=()=>[Vr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...C()],D=()=>[t,ve,be],j=()=>[...k(),ly,ay,{position:[ve,be]}],B=()=>["no-repeat",{repeat:["","x","y","space","round"]}],F=()=>["auto","cover","contain",F_,$_,{size:[ve,be]}],T=()=>[ef,zi,$o],$=()=>["","none","full",c,ve,be],I=()=>["",je,zi,$o],Y=()=>["solid","dashed","dotted","double"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>[je,ef,ly,ay],se=()=>["","none",p,ve,be],O=()=>["none",je,ve,be],P=()=>["none",je,ve,be],U=()=>[je,ve,be],K=()=>[Vr,"full",...C()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[yr],breakpoint:[yr],color:[sx],container:[yr],"drop-shadow":[yr],ease:["in","out","in-out"],font:[I_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[yr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[yr],shadow:[yr],spacing:["px",je],text:[yr],"text-shadow":[yr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Vr,be,ve,m]}],container:["container"],columns:[{columns:[je,be,ve,a]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:v()}],overflow:[{overflow:x()}],"overflow-x":[{"overflow-x":x()}],"overflow-y":[{"overflow-y":x()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{"inset-s":A(),start:A()}],end:[{"inset-e":A(),end:A()}],"inset-bs":[{"inset-bs":A()}],"inset-be":[{"inset-be":A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[Hr,"auto",ve,be]}],basis:[{basis:[Vr,"full","auto",a,...C()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[je,Vr,"auto","initial","none",be]}],grow:[{grow:["",je,ve,be]}],shrink:[{shrink:["",je,ve,be]}],order:[{order:[Hr,"first","last","none",ve,be]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:R()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:R()}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":N()}],"auto-rows":[{"auto-rows":N()}],gap:[{gap:C()}],"gap-x":[{"gap-x":C()}],"gap-y":[{"gap-y":C()}],"justify-content":[{justify:[...L(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...L()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":L()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:C()}],px:[{px:C()}],py:[{py:C()}],ps:[{ps:C()}],pe:[{pe:C()}],pbs:[{pbs:C()}],pbe:[{pbe:C()}],pt:[{pt:C()}],pr:[{pr:C()}],pb:[{pb:C()}],pl:[{pl:C()}],m:[{m:Z()}],mx:[{mx:Z()}],my:[{my:Z()}],ms:[{ms:Z()}],me:[{me:Z()}],mbs:[{mbs:Z()}],mbe:[{mbe:Z()}],mt:[{mt:Z()}],mr:[{mr:Z()}],mb:[{mb:Z()}],ml:[{ml:Z()}],"space-x":[{"space-x":C()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":C()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],"inline-size":[{inline:["auto",...q()]}],"min-inline-size":[{"min-inline":["auto",...q()]}],"max-inline-size":[{"max-inline":["none",...q()]}],"block-size":[{block:["auto",...V()]}],"min-block-size":[{"min-block":["auto",...V()]}],"max-block-size":[{"max-block":["none",...V()]}],w:[{w:[a,"screen",...W()]}],"min-w":[{"min-w":[a,"screen","none",...W()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[i]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",n,zi,$o]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,V_,D_]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ef,be]}],"font-family":[{font:[j_,z_,e]}],"font-features":[{"font-features":[be]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ve,be]}],"line-clamp":[{"line-clamp":[je,"none",ve,iy]}],leading:[{leading:[s,...C()]}],"list-image":[{"list-image":["none",ve,be]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ve,be]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:[je,"from-font","auto",ve,$o]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[je,"auto",ve,be]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:C()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ve,be]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ve,be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:j()}],"bg-repeat":[{bg:B()}],"bg-size":[{bg:F()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Hr,ve,be],radial:["",ve,be],conic:[Hr,ve,be]},B_,L_]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:T()}],"gradient-via-pos":[{via:T()}],"gradient-to-pos":[{to:T()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-bs":[{"border-bs":I()}],"border-w-be":[{"border-be":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":I()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Y(),"hidden","none"]}],"divide-style":[{divide:[...Y(),"hidden","none"]}],"border-color":[{border:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-bs":[{"border-bs":D()}],"border-color-be":[{"border-be":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...Y(),"none","hidden"]}],"outline-offset":[{"outline-offset":[je,ve,be]}],"outline-w":[{outline:["",je,zi,$o]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",u,hl,fl]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",d,hl,fl]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[je,$o]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",f,hl,fl]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[je,ve,be]}],"mix-blend":[{"mix-blend":[...G(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":G()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[je]}],"mask-image-linear-from-pos":[{"mask-linear-from":X()}],"mask-image-linear-to-pos":[{"mask-linear-to":X()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":X()}],"mask-image-t-to-pos":[{"mask-t-to":X()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":X()}],"mask-image-r-to-pos":[{"mask-r-to":X()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":X()}],"mask-image-b-to-pos":[{"mask-b-to":X()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":X()}],"mask-image-l-to-pos":[{"mask-l-to":X()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":X()}],"mask-image-x-to-pos":[{"mask-x-to":X()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":X()}],"mask-image-y-to-pos":[{"mask-y-to":X()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[ve,be]}],"mask-image-radial-from-pos":[{"mask-radial-from":X()}],"mask-image-radial-to-pos":[{"mask-radial-to":X()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[je]}],"mask-image-conic-from-pos":[{"mask-conic-from":X()}],"mask-image-conic-to-pos":[{"mask-conic-to":X()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:j()}],"mask-repeat":[{mask:B()}],"mask-size":[{mask:F()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ve,be]}],filter:[{filter:["","none",ve,be]}],blur:[{blur:se()}],brightness:[{brightness:[je,ve,be]}],contrast:[{contrast:[je,ve,be]}],"drop-shadow":[{"drop-shadow":["","none",h,hl,fl]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",je,ve,be]}],"hue-rotate":[{"hue-rotate":[je,ve,be]}],invert:[{invert:["",je,ve,be]}],saturate:[{saturate:[je,ve,be]}],sepia:[{sepia:["",je,ve,be]}],"backdrop-filter":[{"backdrop-filter":["","none",ve,be]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[je,ve,be]}],"backdrop-contrast":[{"backdrop-contrast":[je,ve,be]}],"backdrop-grayscale":[{"backdrop-grayscale":["",je,ve,be]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[je,ve,be]}],"backdrop-invert":[{"backdrop-invert":["",je,ve,be]}],"backdrop-opacity":[{"backdrop-opacity":[je,ve,be]}],"backdrop-saturate":[{"backdrop-saturate":[je,ve,be]}],"backdrop-sepia":[{"backdrop-sepia":["",je,ve,be]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":C()}],"border-spacing-x":[{"border-spacing-x":C()}],"border-spacing-y":[{"border-spacing-y":C()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ve,be]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[je,"initial",ve,be]}],ease:[{ease:["linear","initial",y,ve,be]}],delay:[{delay:[je,ve,be]}],animate:[{animate:["none",b,ve,be]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,ve,be]}],"perspective-origin":[{"perspective-origin":v()}],rotate:[{rotate:O()}],"rotate-x":[{"rotate-x":O()}],"rotate-y":[{"rotate-y":O()}],"rotate-z":[{"rotate-z":O()}],scale:[{scale:P()}],"scale-x":[{"scale-x":P()}],"scale-y":[{"scale-y":P()}],"scale-z":[{"scale-z":P()}],"scale-3d":["scale-3d"],skew:[{skew:U()}],"skew-x":[{"skew-x":U()}],"skew-y":[{"skew-y":U()}],transform:[{transform:[ve,be,"","none","gpu","cpu"]}],"transform-origin":[{origin:v()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:K()}],"translate-x":[{"translate-x":K()}],"translate-y":[{"translate-y":K()}],"translate-z":[{"translate-z":K()}],"translate-none":["translate-none"],accent:[{accent:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ve,be]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mbs":[{"scroll-mbs":C()}],"scroll-mbe":[{"scroll-mbe":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pbs":[{"scroll-pbs":C()}],"scroll-pbe":[{"scroll-pbe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ve,be]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[je,zi,$o,iy]}],stroke:[{stroke:["none",...D()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},q_=S_(W_);function ue(...t){return q_(Xk(t))}const U_=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],K_=it("calendar-days",U_);const Y_=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Z_=it("check",Y_);const G_=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],$p=it("chevron-down",G_);const J_=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],X_=it("chevron-left",J_);const Q_=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],eN=it("chevron-right",Q_);const tN=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],nN=it("chevron-up",tN);const rN=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],oN=it("clock-3",rN);const sN=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],iN=it("code-xml",sN);const aN=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],lN=it("heading-1",aN);const cN=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],uN=it("heading-2",cN);const dN=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Dp=it("image",dN);const fN=[["rect",{width:"18",height:"12",x:"3",y:"4",rx:"2",ry:"2",key:"1qhy41"}],["line",{x1:"2",x2:"22",y1:"20",y2:"20",key:"ni3hll"}]],hN=it("laptop-minimal",fN);const pN=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],mN=it("link",pN);const gN=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],yN=it("list-checks",gN);const bN=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],vN=it("list-ordered",bN);const wN=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],kN=it("list",wN);const xN=[["path",{d:"M5 12h14",key:"1ays0h"}]],SN=it("minus",xN);const EN=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],CN=it("moon",EN);const TN=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],MN=it("panel-left-close",TN);const RN=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],ON=it("panel-left-open",RN);const _N=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],NN=it("panel-right-close",_N);const PN=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],AN=it("panel-right-open",PN);const IN=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],$N=it("quote",IN);const DN=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],zN=it("save",DN);const LN=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],jN=it("search",LN);const FN=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],BN=it("sun",FN);const VN=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],HN=it("trash-2",VN);const WN=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],hx=it("x",WN),px=S.createContext(void 0);function mx(t=!1){const e=S.useContext(px);if(e===void 0&&!t)throw new Error(Zt(16));return e}function qN(t){const{focusableWhenDisabled:e,disabled:n,composite:r=!1,tabIndex:o=0,isNativeButton:s}=t,i=r&&e!==!1,a=r&&e===!1;return{props:S.useMemo(()=>{const c={onKeyDown(u){n&&e&&u.key!=="Tab"&&u.preventDefault()}};return r||(c.tabIndex=o,!s&&n&&(c.tabIndex=e?o:-1)),(s&&(e||i)||!s&&n)&&(c["aria-disabled"]=n),s&&(!e||a)&&(c.disabled=n),c},[r,n,e,i,a,s,o])}}function ws(t={}){const{disabled:e=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0}=t,s=S.useRef(null),i=mx(!0)!==void 0,a=de(()=>{const f=s.current;return!!(f?.tagName==="A"&&f?.href)}),{props:l}=qN({focusableWhenDisabled:n,disabled:e,composite:i,tabIndex:r,isNativeButton:o}),c=S.useCallback(()=>{const f=s.current;UN(f)&&i&&e&&l.disabled===void 0&&f.disabled&&(f.disabled=!1)},[e,l.disabled,i]);me(c,[c]);const u=S.useCallback((f={})=>{const{onClick:h,onMouseDown:p,onKeyUp:g,onKeyDown:m,onPointerDown:y,...b}=f;return Oi({type:o?"button":void 0,onClick(k){if(e){k.preventDefault();return}h?.(k)},onMouseDown(k){e||p?.(k)},onKeyDown(k){if(e||(ph(k),m?.(k)),k.baseUIHandlerPrevented)return;const v=k.target===k.currentTarget&&!o&&!a()&&!e,x=k.key==="Enter",E=k.key===" ";v&&((E||x)&&k.preventDefault(),x&&h?.(k))},onKeyUp(k){e||(ph(k),g?.(k)),!k.baseUIHandlerPrevented&&k.target===k.currentTarget&&!o&&!e&&k.key===" "&&h?.(k)},onPointerDown(k){if(e){k.preventDefault();return}y?.(k)}},o?void 0:{role:"button"},l,b)},[e,l,o,a]),d=de(f=>{s.current=f,c()});return{getButtonProps:u,buttonRef:d}}function UN(t){return gt(t)&&t.tagName==="BUTTON"}const KN=S.forwardRef(function(e,n){const{render:r,className:o,disabled:s=!1,focusableWhenDisabled:i=!1,nativeButton:a=!0,...l}=e,{getButtonProps:c,buttonRef:u}=ws({disabled:s,focusableWhenDisabled:i,native:a});return rt("button",e,{state:{disabled:s},ref:[n,u],props:[l,c]})}),cy=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,uy=Xk,zp=(t,e)=>n=>{var r;if(e?.variants==null)return uy(t,n?.class,n?.className);const{variants:o,defaultVariants:s}=e,i=Object.keys(o).map(c=>{const u=n?.[c],d=s?.[c];if(u===null)return null;const f=cy(u)||cy(d);return o[c][f]}),a=n&&Object.entries(n).reduce((c,u)=>{let[d,f]=u;return f===void 0||(c[d]=f),c},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:f,...h}=u;return Object.entries(h).every(p=>{let[g,m]=p;return Array.isArray(m)?m.includes({...s,...a}[g]):{...s,...a}[g]===m})?[...c,d,f]:c},[]);return uy(t,i,l,n?.class,n?.className)},Ea=zp("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function pn(t){const e=Me.c(12);let n,r,o,s;e[0]!==t?({className:n,variant:o,size:s,...r}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=s):(n=e[1],r=e[2],o=e[3],s=e[4]);const i=o===void 0?"default":o,a=s===void 0?"default":s;let l;e[5]!==n||e[6]!==a||e[7]!==i?(l=ue(Ea({variant:i,size:a,className:n})),e[5]=n,e[6]=a,e[7]=i,e[8]=l):l=e[8];let c;return e[9]!==r||e[10]!==l?(c=M.jsx(KN,{"data-slot":"button",className:l,...r}),e[9]=r,e[10]=l,e[11]=c):c=e[11],c}function YN(t,e){const n=getComputedStyle(t),r=parseFloat(n.fontSize);return e*r}function ZN(t,e){const n=getComputedStyle(t.ownerDocument.body),r=parseFloat(n.fontSize);return e*r}function GN(t){return t/100*window.innerHeight}function JN(t){return t/100*window.innerWidth}function XN(t){switch(typeof t){case"number":return[t,"px"];case"string":{const e=parseFloat(t);return t.endsWith("%")?[e,"%"]:t.endsWith("px")?[e,"px"]:t.endsWith("rem")?[e,"rem"]:t.endsWith("em")?[e,"em"]:t.endsWith("vh")?[e,"vh"]:t.endsWith("vw")?[e,"vw"]:[e,"%"]}}}function pl({groupSize:t,panelElement:e,styleProp:n}){let r;const[o,s]=XN(n);switch(s){case"%":{r=o/100*t;break}case"px":{r=o;break}case"rem":{r=ZN(e,o);break}case"em":{r=YN(e,o);break}case"vh":{r=GN(o);break}case"vw":{r=JN(o);break}}return r}function fn(t){return parseFloat(t.toFixed(3))}function hi({group:t}){const{orientation:e,panels:n}=t;return n.reduce((r,o)=>(r+=e==="horizontal"?o.element.offsetWidth:o.element.offsetHeight,r),0)}function bh(t){const{panels:e}=t,n=hi({group:t});return n===0?e.map(r=>({groupResizeBehavior:r.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:r.panelConstraints.disabled,minSize:0,maxSize:100,panelId:r.id})):e.map(r=>{const{element:o,panelConstraints:s}=r;let i=0;if(s.collapsedSize!==void 0){const u=pl({groupSize:n,panelElement:o,styleProp:s.collapsedSize});i=fn(u/n*100)}let a;if(s.defaultSize!==void 0){const u=pl({groupSize:n,panelElement:o,styleProp:s.defaultSize});a=fn(u/n*100)}let l=0;if(s.minSize!==void 0){const u=pl({groupSize:n,panelElement:o,styleProp:s.minSize});l=fn(u/n*100)}let c=100;if(s.maxSize!==void 0){const u=pl({groupSize:n,panelElement:o,styleProp:s.maxSize});c=fn(u/n*100)}return{groupResizeBehavior:s.groupResizeBehavior,collapsedSize:i,collapsible:s.collapsible===!0,defaultSize:a,disabled:s.disabled,minSize:l,maxSize:c,panelId:r.id}})}function ot(t,e="Assertion error"){if(!t)throw Error(e)}function vh(t,e){return Array.from(e).sort(t==="horizontal"?QN:eP)}function QN(t,e){const n=t.element.offsetLeft-e.element.offsetLeft;return n!==0?n:t.element.offsetWidth-e.element.offsetWidth}function eP(t,e){const n=t.element.offsetTop-e.element.offsetTop;return n!==0?n:t.element.offsetHeight-e.element.offsetHeight}function gx(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}function yx(t,e){return{x:t.x>=e.left&&t.x<=e.right?0:Math.min(Math.abs(t.x-e.left),Math.abs(t.x-e.right)),y:t.y>=e.top&&t.y<=e.bottom?0:Math.min(Math.abs(t.y-e.top),Math.abs(t.y-e.bottom))}}function tP({orientation:t,rects:e,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let o,s=Number.MAX_VALUE;for(const i of e){const{x:a,y:l}=yx(r,i),c=t==="horizontal"?a:l;c<s&&(s=c,o=i)}return ot(o,"No rect found"),o}let ml;function nP(){return ml===void 0&&(typeof matchMedia=="function"?ml=!!matchMedia("(pointer:coarse)").matches:ml=!1),ml}function bx(t){const{element:e,orientation:n,panels:r,separators:o}=t,s=vh(n,Array.from(e.children).filter(gx).map(p=>({element:p}))).map(({element:p})=>p),i=[];let a=!1,l=!1,c=-1,u=-1,d=0,f,h=[];{let p=-1;for(const g of s)g.hasAttribute("data-panel")&&(p++,g.ariaDisabled===null&&(d++,c===-1&&(c=p),u=p))}if(d>1){let p=-1;for(const g of s)if(g.hasAttribute("data-panel")){p++;const m=r.find(y=>y.element===g);if(m){if(f){const y=f.element.getBoundingClientRect(),b=g.getBoundingClientRect();let w;if(l){const k=n==="horizontal"?new DOMRect(y.right,y.top,0,y.height):new DOMRect(y.left,y.bottom,y.width,0),v=n==="horizontal"?new DOMRect(b.left,b.top,0,b.height):new DOMRect(b.left,b.top,b.width,0);switch(h.length){case 0:{w=[k,v];break}case 1:{const x=h[0],E=tP({orientation:n,rects:[y,b],targetRect:x.element.getBoundingClientRect()});w=[x,E===y?v:k];break}default:{w=h;break}}}else h.length?w=h:w=[n==="horizontal"?new DOMRect(y.right,b.top,b.left-y.right,b.height):new DOMRect(b.left,y.bottom,b.width,b.top-y.bottom)];for(const k of w){let v="width"in k?k:k.element.getBoundingClientRect();const x=nP()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine;if(v.width<x){const C=x-v.width;v=new DOMRect(v.x-C/2,v.y,v.width+C,v.height)}if(v.height<x){const C=x-v.height;v=new DOMRect(v.x,v.y-C/2,v.width,v.height+C)}const E=p<=c||p>u;!a&&!E&&i.push({group:t,groupSize:hi({group:t}),panels:[f,m],separator:"width"in k?void 0:k,rect:v}),a=!1}}l=!1,f=m,h=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(a=!0);const m=o.find(y=>y.element===g);m?h.push(m):(f=void 0,h=[])}else l=!0}return i}let vx=class{#e={};addListener(e,n){const r=this.#e[e];return r===void 0?this.#e[e]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(e,n)}}emit(e,n){const r=this.#e[e];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let o=!1,s=null;const i=Array.from(r);for(let a=0;a<i.length;a++){const l=i[a];try{l.call(null,n)}catch(c){s===null&&(o=!0,s=c)}}if(o)throw s}}removeAllListeners(){this.#e={}}removeListener(e,n){const r=this.#e[e];if(r!==void 0){const o=r.indexOf(n);o>=0&&r.splice(o,1)}}},sr=new Map;const wx=new vx;function rP(t){sr=new Map(sr),sr.delete(t)}function dy(t,e){for(const[n]of sr)if(n.id===t)return n}function ao(t,e){for(const[n,r]of sr)if(n.id===t)return r;if(e)throw Error(`Could not find data for Group with id ${t}`)}function ks(){return sr}function Lp(t,e){return wx.addListener("groupChange",n=>{n.group.id===t&&e(n)})}function Lr(t,e){const n=sr.get(t);sr=new Map(sr),sr.set(t,e),wx.emit("groupChange",{group:t,prev:n,next:e})}function oP(t,e,n){let r,o={x:1/0,y:1/0};for(const s of e){const i=yx(n,s.rect);switch(t){case"horizontal":{i.x<=o.x&&(r=s,o=i);break}case"vertical":{i.y<=o.y&&(r=s,o=i);break}}}return r?{distance:o,hitRegion:r}:void 0}function sP(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function iP(t,e){if(t===e)throw new Error("Cannot compare node with itself");const n={a:py(t),b:py(e)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();ot(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:hy(fy(n.a)),b:hy(fy(n.b))};if(o.a===o.b){const s=r.childNodes,i={a:n.a.at(-1),b:n.b.at(-1)};let a=s.length;for(;a--;){const l=s[a];if(l===i.a)return 1;if(l===i.b)return-1}}return Math.sign(o.a-o.b)}const aP=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function lP(t){const e=getComputedStyle(kx(t)??t).display;return e==="flex"||e==="inline-flex"}function cP(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||lP(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||aP.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function fy(t){let e=t.length;for(;e--;){const n=t[e];if(ot(n,"Missing node"),cP(n))return n}return null}function hy(t){return t&&Number(getComputedStyle(t).zIndex)||0}function py(t){const e=[];for(;t;)e.push(t),t=kx(t);return e}function kx(t){const{parentNode:e}=t;return sP(e)?e.host:e}function uP(t,e){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function dP({groupElement:t,hitRegion:e,pointerEventTarget:n}){if(!gx(n)||n.contains(t)||t.contains(n))return!0;if(iP(n,t)>0){let r=n;for(;r;){if(r.contains(t))return!0;if(uP(r.getBoundingClientRect(),e))return!1;r=r.parentElement}}return!0}function jp(t,e){const n=[];return e.forEach((r,o)=>{if(o.disabled)return;const s=bx(o),i=oP(o.orientation,s,{x:t.clientX,y:t.clientY});i&&i.distance.x<=0&&i.distance.y<=0&&dP({groupElement:o.element,hitRegion:i.hitRegion.rect,pointerEventTarget:t.target})&&n.push(i.hitRegion)}),n}function fP(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n])return!1;return!0}function tn(t,e,n=0){return Math.abs(fn(t)-fn(e))<=n}function rr(t,e){return tn(t,e)?0:t>e?1:-1}function Ws({overrideDisabledPanels:t,panelConstraints:e,prevSize:n,size:r}){const{collapsedSize:o=0,collapsible:s,disabled:i,maxSize:a=100,minSize:l=0}=e;if(i&&!t)return n;if(rr(r,l)<0)if(s){const c=(o+l)/2;rr(r,c)<0?r=o:r=l}else r=l;return r=Math.min(a,r),r=fn(r),r}function Ca({delta:t,initialLayout:e,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:s}){if(tn(t,0))return e;const i=s==="imperative-api",a=Object.values(e),l=Object.values(o),c=[...a],[u,d]=r;ot(u!=null,"Invalid first pivot index"),ot(d!=null,"Invalid second pivot index");let f=0;switch(s){case"keyboard":{{const g=t<0?d:u,m=n[g];ot(m,`Panel constraints not found for index ${g}`);const{collapsedSize:y=0,collapsible:b,minSize:w=0}=m;if(b){const k=a[g];if(ot(k!=null,`Previous layout not found for panel index ${g}`),tn(k,y)){const v=w-k;rr(v,Math.abs(t))>0&&(t=t<0?0-v:v)}}}{const g=t<0?u:d,m=n[g];ot(m,`No panel constraints found for index ${g}`);const{collapsedSize:y=0,collapsible:b,minSize:w=0}=m;if(b){const k=a[g];if(ot(k!=null,`Previous layout not found for panel index ${g}`),tn(k,w)){const v=k-y;rr(v,Math.abs(t))>0&&(t=t<0?0-v:v)}}}break}default:{const g=t<0?d:u,m=n[g];ot(m,`Panel constraints not found for index ${g}`);const y=a[g],{collapsible:b,collapsedSize:w,minSize:k}=m;if(b&&rr(y,k)<0)if(t>0){const v=k-w,x=v/2,E=y+t;rr(E,k)<0&&(t=rr(t,x)<=0?0:v)}else{const v=k-w,x=100-v/2,E=y-t;rr(E,k)<0&&(t=rr(100+t,x)>0?0:-v)}break}}{const g=t<0?1:-1;let m=t<0?d:u,y=0;for(;;){const w=a[m];ot(w!=null,`Previous layout not found for panel index ${m}`);const k=Ws({overrideDisabledPanels:i,panelConstraints:n[m],prevSize:w,size:100})-w;if(y+=k,m+=g,m<0||m>=n.length)break}const b=Math.min(Math.abs(t),Math.abs(y));t=t<0?0-b:b}{let g=t<0?u:d;for(;g>=0&&g<n.length;){const m=Math.abs(t)-Math.abs(f),y=a[g];ot(y!=null,`Previous layout not found for panel index ${g}`);const b=y-m,w=Ws({overrideDisabledPanels:i,panelConstraints:n[g],prevSize:y,size:b});if(!tn(y,w)&&(f+=y-w,c[g]=w,f.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?g--:g++}}if(fP(l,c))return o;{const g=t<0?d:u,m=a[g];ot(m!=null,`Previous layout not found for panel index ${g}`);const y=m+f,b=Ws({overrideDisabledPanels:i,panelConstraints:n[g],prevSize:m,size:y});if(c[g]=b,!tn(b,y)){let w=y-b,k=t<0?d:u;for(;k>=0&&k<n.length;){const v=c[k];ot(v!=null,`Previous layout not found for panel index ${k}`);const x=v+w,E=Ws({overrideDisabledPanels:i,panelConstraints:n[k],prevSize:v,size:x});if(tn(v,E)||(w-=E-v,c[k]=E),tn(w,0))break;t>0?k--:k++}}}const h=Object.values(c).reduce((g,m)=>m+g,0);if(!tn(h,100,.1))return o;const p=Object.keys(o);return c.reduce((g,m,y)=>(g[p[y]]=m,g),{})}function ls(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(e[n]===void 0||rr(t[n],e[n])!==0)return!1;return!0}function cs({layout:t,panelConstraints:e}){const n=Object.values(t),r=[...n],o=r.reduce((a,l)=>a+l,0);if(r.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${r.map(a=>`${a}%`).join(", ")}`);if(!tn(o,100)&&r.length>0)for(let a=0;a<e.length;a++){const l=r[a];ot(l!=null,`No layout data found for index ${a}`);const c=100/o*l;r[a]=c}let s=0;for(let a=0;a<e.length;a++){const l=n[a];ot(l!=null,`No layout data found for index ${a}`);const c=r[a];ot(c!=null,`No layout data found for index ${a}`);const u=Ws({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:l,size:c});c!=u&&(s+=c-u,r[a]=u)}if(!tn(s,0))for(let a=0;a<e.length;a++){const l=r[a];ot(l!=null,`No layout data found for index ${a}`);const c=l+s,u=Ws({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:l,size:c});if(l!==u&&(s-=u-l,r[a]=u,tn(s,0)))break}const i=Object.keys(t);return r.reduce((a,l,c)=>(a[i[c]]=l,a),{})}function xx({groupId:t,panelId:e}){const n=()=>{const a=ks();for(const[l,{defaultLayoutDeferred:c,derivedPanelConstraints:u,layout:d,groupSize:f,separatorToPanels:h}]of a)if(l.id===t)return{defaultLayoutDeferred:c,derivedPanelConstraints:u,group:l,groupSize:f,layout:d,separatorToPanels:h};throw Error(`Group ${t} not found`)},r=()=>{const a=n().derivedPanelConstraints.find(l=>l.panelId===e);if(a!==void 0)return a;throw Error(`Panel constraints not found for Panel ${e}`)},o=()=>{const a=n().group.panels.find(l=>l.id===e);if(a!==void 0)return a;throw Error(`Layout not found for Panel ${e}`)},s=()=>{const a=n().layout[e];if(a!==void 0)return a;throw Error(`Layout not found for Panel ${e}`)},i=a=>{const l=s();if(a===l)return;const{defaultLayoutDeferred:c,derivedPanelConstraints:u,group:d,groupSize:f,layout:h,separatorToPanels:p}=n(),g=d.panels.findIndex(w=>w.id===e),m=g===d.panels.length-1,y=Ca({delta:m?l-a:a-l,initialLayout:h,panelConstraints:u,pivotIndices:m?[g-1,g]:[g,g+1],prevLayout:h,trigger:"imperative-api"}),b=cs({layout:y,panelConstraints:u});ls(h,b)||Lr(d,{defaultLayoutDeferred:c,derivedPanelConstraints:u,groupSize:f,layout:b,separatorToPanels:p})};return{collapse:()=>{const{collapsible:a,collapsedSize:l}=r(),{mutableValues:c}=o(),u=s();a&&u!==l&&(c.expandToSize=u,i(l))},expand:()=>{const{collapsible:a,collapsedSize:l,minSize:c}=r(),{mutableValues:u}=o(),d=s();if(a&&d===l){let f=u.expandToSize??c;f===0&&(f=1),i(f)}},getSize:()=>{const{group:a}=n(),l=s(),{element:c}=o(),u=a.orientation==="horizontal"?c.offsetWidth:c.offsetHeight;return{asPercentage:l,inPixels:u}},isCollapsed:()=>{const{collapsible:a,collapsedSize:l}=r(),c=s();return a&&tn(l,c)},resize:a=>{if(s()!==a){let l;switch(typeof a){case"number":{const{group:c}=n(),u=hi({group:c});l=fn(a/u*100);break}case"string":{l=parseFloat(a);break}}i(l)}}}}function my(t){if(t.defaultPrevented)return;const e=ks();jp(t,e).forEach(n=>{if(n.separator){const r=n.panels.find(o=>o.panelConstraints.defaultSize!==void 0);if(r){const o=r.panelConstraints.defaultSize,s=xx({groupId:n.group.id,panelId:r.id});s&&o!==void 0&&(s.resize(o),t.preventDefault())}}})}function Mc(t){const e=ks();for(const[n]of e)if(n.separators.some(r=>r.element===t))return n;throw Error("Could not find parent Group for separator element")}function Sx({groupId:t}){const e=()=>{const n=ks();for(const[r,o]of n)if(r.id===t)return{group:r,...o};throw Error(`Could not find Group with id "${t}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=e();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:o,group:s,groupSize:i,layout:a,separatorToPanels:l}=e(),c=cs({layout:n,panelConstraints:o});return r?a:(ls(a,c)||Lr(s,{defaultLayoutDeferred:r,derivedPanelConstraints:o,groupSize:i,layout:c,separatorToPanels:l}),c)}}}function Do(t,e){const n=Mc(t),r=ao(n.id,!0),o=n.separators.find(u=>u.element===t);ot(o,"Matching separator not found");const s=r.separatorToPanels.get(o);ot(s,"Matching panels not found");const i=s.map(u=>n.panels.indexOf(u)),a=Sx({groupId:n.id}).getLayout(),l=Ca({delta:e,initialLayout:a,panelConstraints:r.derivedPanelConstraints,pivotIndices:i,prevLayout:a,trigger:"keyboard"}),c=cs({layout:l,panelConstraints:r.derivedPanelConstraints});ls(a,c)||Lr(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function gy(t){if(t.defaultPrevented)return;const e=t.currentTarget,n=Mc(e);if(!n.disabled)switch(t.key){case"ArrowDown":{t.preventDefault(),n.orientation==="vertical"&&Do(e,5);break}case"ArrowLeft":{t.preventDefault(),n.orientation==="horizontal"&&Do(e,-5);break}case"ArrowRight":{t.preventDefault(),n.orientation==="horizontal"&&Do(e,5);break}case"ArrowUp":{t.preventDefault(),n.orientation==="vertical"&&Do(e,-5);break}case"End":{t.preventDefault(),Do(e,100);break}case"Enter":{t.preventDefault();const r=Mc(e),o=ao(r.id,!0),{derivedPanelConstraints:s,layout:i,separatorToPanels:a}=o,l=r.separators.find(f=>f.element===e);ot(l,"Matching separator not found");const c=a.get(l);ot(c,"Matching panels not found");const u=c[0],d=s.find(f=>f.panelId===u.id);if(ot(d,"Panel metadata not found"),d.collapsible){const f=i[u.id],h=d.collapsedSize===f?r.mutableState.expandedPanelSizes[u.id]??d.minSize:d.collapsedSize;Do(e,h-f)}break}case"F6":{t.preventDefault();const r=Mc(e).separators.map(i=>i.element),o=Array.from(r).findIndex(i=>i===t.currentTarget);ot(o!==null,"Index not found");const s=t.shiftKey?o>0?o-1:r.length-1:o+1<r.length?o+1:0;r[s].focus();break}case"Home":{t.preventDefault(),Do(e,-100);break}}}let Xs={cursorFlags:0,state:"inactive"};const Fp=new vx;function us(){return Xs}function hP(t){return Fp.addListener("change",t)}function pP(t){const e=Xs,n={...Xs};n.cursorFlags=t,Xs=n,Fp.emit("change",{prev:e,next:n})}function Qs(t){const e=Xs;Xs=t,Fp.emit("change",{prev:e,next:t})}function yy(t){if(t.defaultPrevented||t.pointerType==="mouse"&&t.button>0)return;const e=ks(),n=jp(t,e),r=new Map;let o=!1;n.forEach(s=>{s.separator&&(o||(o=!0,s.separator.element.focus()));const i=e.get(s.group);i&&r.set(s.group,i.layout)}),Qs({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:t.clientX,y:t.clientY},state:"active"}),n.length&&t.preventDefault()}const mP=t=>t,tf=()=>{},Ex=1,Cx=2,Tx=4,Mx=8,by=3,vy=12;let gl;function wy(){return gl===void 0&&(gl=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(gl=!0)),gl}function gP({cursorFlags:t,groups:e,state:n}){let r=0,o=0;switch(n){case"active":case"hover":e.forEach(s=>{if(!s.mutableState.disableCursor)switch(s.orientation){case"horizontal":{r++;break}case"vertical":{o++;break}}})}if(!(r===0&&o===0)){switch(n){case"active":{if(t&&wy()){const s=(t&Ex)!==0,i=(t&Cx)!==0,a=(t&Tx)!==0,l=(t&Mx)!==0;if(s)return a?"se-resize":l?"ne-resize":"e-resize";if(i)return a?"sw-resize":l?"nw-resize":"w-resize";if(a)return"s-resize";if(l)return"n-resize"}break}}return wy()?r>0&&o>0?"move":r>0?"ew-resize":"ns-resize":r>0&&o>0?"grab":r>0?"col-resize":"row-resize"}}const ky=new WeakMap;function Bp(t){if(t.defaultView===null||t.defaultView===void 0)return;let{prevStyle:e,styleSheet:n}=ky.get(t)??{};n===void 0&&(n=new t.defaultView.CSSStyleSheet,t.adoptedStyleSheets&&t.adoptedStyleSheets.push(n));const r=us();switch(r.state){case"active":case"hover":{const o=gP({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(i=>i.group),state:r.state}),s=`*, *:hover {cursor: ${o} !important; }`;if(e===s)return;e=s,o?n.cssRules.length===0?n.insertRule(s):n.replaceSync(s):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{e=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}ky.set(t,{prevStyle:e,styleSheet:n})}function Rx({document:t,event:e,hitRegions:n,initialLayoutMap:r,mountedGroups:o,pointerDownAtPoint:s,prevCursorFlags:i}){let a=0;n.forEach(c=>{const{group:u,groupSize:d}=c,{orientation:f,panels:h}=u,{disableCursor:p}=u.mutableState;let g=0;s?f==="horizontal"?g=(e.clientX-s.x)/d*100:g=(e.clientY-s.y)/d*100:f==="horizontal"?g=e.clientX<0?-100:100:g=e.clientY<0?-100:100;const m=r.get(u),y=o.get(u);if(!m||!y)return;const{defaultLayoutDeferred:b,derivedPanelConstraints:w,groupSize:k,layout:v,separatorToPanels:x}=y;if(w&&v&&x){const E=Ca({delta:g,initialLayout:m,panelConstraints:w,pivotIndices:c.panels.map(C=>h.indexOf(C)),prevLayout:v,trigger:"mouse-or-touch"});if(ls(E,v)){if(g!==0&&!p)switch(f){case"horizontal":{a|=g<0?Ex:Cx;break}case"vertical":{a|=g<0?Tx:Mx;break}}}else Lr(c.group,{defaultLayoutDeferred:b,derivedPanelConstraints:w,groupSize:k,layout:E,separatorToPanels:x})}});let l=0;e.movementX===0?l|=i&by:l|=a&by,e.movementY===0?l|=i&vy:l|=a&vy,pP(l),Bp(t)}function xy(t){const e=ks(),n=us();n.state==="active"&&Rx({document:t.currentTarget,event:t,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:e,prevCursorFlags:n.cursorFlags})}function Sy(t){if(t.defaultPrevented)return;const e=us(),n=ks();switch(e.state){case"active":{if(t.buttons===0){Qs({cursorFlags:0,state:"inactive"}),e.hitRegions.forEach(r=>{const o=ao(r.group.id,!0);Lr(r.group,o)});return}Rx({document:t.currentTarget,event:t,hitRegions:e.hitRegions,initialLayoutMap:e.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:e.pointerDownAtPoint,prevCursorFlags:e.cursorFlags});break}default:{const r=jp(t,n);r.length===0?e.state!=="inactive"&&Qs({cursorFlags:0,state:"inactive"}):Qs({cursorFlags:0,hitRegions:r,state:"hover"}),Bp(t.currentTarget);break}}}function Ey(t){t.relatedTarget instanceof HTMLIFrameElement&&us().state==="hover"&&Qs({cursorFlags:0,state:"inactive"})}function Cy(t){if(t.defaultPrevented||t.pointerType==="mouse"&&t.button>0)return;const e=us();e.state==="active"&&(Qs({cursorFlags:0,state:"inactive"}),e.hitRegions.length>0&&(Bp(t.currentTarget),e.hitRegions.forEach(n=>{const r=ao(n.group.id,!0);Lr(n.group,r)}),t.preventDefault()))}function Ty(t){let e=0,n=0;const r={};for(const s of t)if(s.defaultSize!==void 0){e++;const i=fn(s.defaultSize);n+=i,r[s.panelId]=i}else r[s.panelId]=void 0;const o=t.length-e;if(o!==0){const s=fn((100-n)/o);for(const i of t)i.defaultSize===void 0&&(r[i.panelId]=s)}return r}function yP(t,e,n){if(!n[0])return;const r=t.panels.find(l=>l.element===e);if(!r||!r.onResize)return;const o=hi({group:t}),s=t.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,i=r.mutableValues.prevSize,a={asPercentage:fn(s/o*100),inPixels:s};r.mutableValues.prevSize=a,r.onResize(a,r.id,i)}function bP(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function vP({group:t,nextGroupSize:e,prevGroupSize:n,prevLayout:r}){if(n<=0||e<=0||n===e)return r;let o=0,s=0,i=!1;const a=new Map,l=[];for(const d of t.panels){const f=r[d.id]??0;if(d.panelConstraints.groupResizeBehavior==="preserve-pixel-size"){i=!0;const h=f/100*n,p=fn(h/e*100);a.set(d.id,p),o+=p}else l.push(d.id),s+=f}if(!i||l.length===0)return r;const c=100-o,u={...r};if(a.forEach((d,f)=>{u[f]=d}),s>0)for(const d of l){const f=r[d]??0;u[d]=fn(f/s*c)}else{const d=fn(c/l.length);for(const f of l)u[f]=d}return u}function wP(t,e){const n=t.map(o=>o.id),r=Object.keys(e);if(n.length!==r.length)return!1;for(const o of n)if(!r.includes(o))return!1;return!0}const _s=new Map;function kP(t){let e=!0;ot(t.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=t.element.ownerDocument.defaultView.ResizeObserver,r=new Set,o=new Set,s=new n(p=>{for(const g of p){const{borderBoxSize:m,target:y}=g;if(y===t.element){if(e){const b=hi({group:t});if(b===0)return;const w=ao(t.id);if(!w)return;const k=bh(t),v=w.defaultLayoutDeferred?Ty(k):w.layout,x=vP({group:t,nextGroupSize:b,prevGroupSize:w.groupSize,prevLayout:v}),E=cs({layout:x,panelConstraints:k});if(!w.defaultLayoutDeferred&&ls(w.layout,E)&&bP(w.derivedPanelConstraints,k)&&w.groupSize===b)return;Lr(t,{defaultLayoutDeferred:!1,derivedPanelConstraints:k,groupSize:b,layout:E,separatorToPanels:w.separatorToPanels})}}else yP(t,y,m)}});s.observe(t.element),t.panels.forEach(p=>{ot(!r.has(p.id),`Panel ids must be unique; id "${p.id}" was used more than once`),r.add(p.id),p.onResize&&s.observe(p.element)});const i=hi({group:t}),a=bh(t),l=t.panels.map(({id:p})=>p).join(",");let c=t.mutableState.defaultLayout;c&&(wP(t.panels,c)||(c=void 0));const u=t.mutableState.layouts[l]??c??Ty(a),d=cs({layout:u,panelConstraints:a}),f=t.element.ownerDocument;_s.set(f,(_s.get(f)??0)+1);const h=new Map;return bx(t).forEach(p=>{p.separator&&h.set(p.separator,p.panels)}),Lr(t,{defaultLayoutDeferred:i===0,derivedPanelConstraints:a,groupSize:i,layout:d,separatorToPanels:h}),t.separators.forEach(p=>{ot(!o.has(p.id),`Separator ids must be unique; id "${p.id}" was used more than once`),o.add(p.id),p.element.addEventListener("keydown",gy)}),_s.get(f)===1&&(f.addEventListener("dblclick",my,!0),f.addEventListener("pointerdown",yy,!0),f.addEventListener("pointerleave",xy),f.addEventListener("pointermove",Sy),f.addEventListener("pointerout",Ey),f.addEventListener("pointerup",Cy,!0)),function(){e=!1,_s.set(f,Math.max(0,(_s.get(f)??0)-1)),rP(t),t.separators.forEach(p=>{p.element.removeEventListener("keydown",gy)}),_s.get(f)||(f.removeEventListener("dblclick",my,!0),f.removeEventListener("pointerdown",yy,!0),f.removeEventListener("pointerleave",xy),f.removeEventListener("pointermove",Sy),f.removeEventListener("pointerout",Ey),f.removeEventListener("pointerup",Cy,!0)),s.disconnect()}}function xP(){const[t,e]=S.useState({}),n=S.useCallback(()=>e({}),[]);return[t,n]}function Vp(t){const e=S.useId();return`${t??e}`}const xs=typeof window<"u"?S.useLayoutEffect:S.useEffect;function aa(t){const e=S.useRef(t);return xs(()=>{e.current=t},[t]),S.useCallback((...n)=>e.current?.(...n),[e])}function Hp(...t){return aa(e=>{t.forEach(n=>{if(n)switch(typeof n){case"function":{n(e);break}case"object":{n.current=e;break}}})})}function Wp(t){const e=S.useRef({...t});return xs(()=>{for(const n in t)e.current[n]=t[n]},[t]),e.current}const Ox=S.createContext(null);function SP(t,e){const n=S.useRef({getLayout:()=>({}),setLayout:mP});S.useImperativeHandle(e,()=>n.current,[]),xs(()=>{Object.assign(n.current,Sx({groupId:t}))})}function _x({children:t,className:e,defaultLayout:n,disableCursor:r,disabled:o,elementRef:s,groupRef:i,id:a,onLayoutChange:l,onLayoutChanged:c,orientation:u="horizontal",resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...h}){const p=S.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=aa(R=>{ls(p.current.onLayoutChange,R)||(p.current.onLayoutChange=R,l?.(R))}),m=aa(R=>{ls(p.current.onLayoutChanged,R)||(p.current.onLayoutChanged=R,c?.(R))}),y=Vp(a),b=S.useRef(null),[w,k]=xP(),v=S.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),x=Hp(b,s);SP(y,i);const E=aa((R,_)=>{const N=us(),L=dy(R),H=ao(R);if(H){let Z=!1;return N.state==="active"&&(Z=N.hitRegions.some(W=>W.group===L)),{flexGrow:H.layout[_]??1,pointerEvents:Z?"none":void 0}}return{flexGrow:n?.[_]??1}}),C=Wp({defaultLayout:n,disableCursor:r}),A=S.useMemo(()=>({get disableCursor(){return!!C.disableCursor},getPanelStyles:E,id:y,orientation:u,registerPanel:R=>{const _=v.current;return _.panels=vh(u,[..._.panels,R]),k(),()=>{_.panels=_.panels.filter(N=>N!==R),k()}},registerSeparator:R=>{const _=v.current;return _.separators=vh(u,[..._.separators,R]),k(),()=>{_.separators=_.separators.filter(N=>N!==R),k()}},togglePanelDisabled:(R,_)=>{const N=v.current.panels.find(Z=>Z.id===R);N&&(N.panelConstraints.disabled=_);const L=dy(y),H=ao(y);L&&H&&Lr(L,{...H,derivedPanelConstraints:bh(L)})},toggleSeparatorDisabled:(R,_)=>{const N=v.current.separators.find(L=>L.id===R);N&&(N.disabled=_)}}),[E,y,k,u,C]),z=S.useRef(null);return xs(()=>{const R=b.current;if(R===null)return;const _=v.current;let N;if(C.defaultLayout!==void 0&&Object.keys(C.defaultLayout).length===_.panels.length){N={};for(const D of _.panels){const j=C.defaultLayout[D.id];j!==void 0&&(N[D.id]=j)}}const L={disabled:!!o,element:R,id:y,mutableState:{defaultLayout:N,disableCursor:!!C.disableCursor,expandedPanelSizes:v.current.lastExpandedPanelSizes,layouts:v.current.layouts},orientation:u,panels:_.panels,resizeTargetMinimumSize:_.resizeTargetMinimumSize,separators:_.separators};z.current=L;const H=kP(L),{defaultLayoutDeferred:Z,derivedPanelConstraints:W,layout:q}=ao(L.id,!0);!Z&&W.length>0&&(g(q),m(q));const V=Lp(y,D=>{const{defaultLayoutDeferred:j,derivedPanelConstraints:B,layout:F}=D.next;if(j||B.length===0)return;const T=L.panels.map(({id:I})=>I).join(",");L.mutableState.layouts[T]=F,B.forEach(I=>{if(I.collapsible){const{layout:Y}=D.prev??{};if(Y){const G=tn(I.collapsedSize,F[I.panelId]),X=tn(I.collapsedSize,Y[I.panelId]);G&&!X&&(L.mutableState.expandedPanelSizes[I.panelId]=Y[I.panelId])}}});const $=us().state!=="active";g(F),$&&m(F)});return()=>{z.current=null,H(),V()}},[o,y,m,g,u,w,C]),S.useEffect(()=>{const R=z.current;R&&(R.mutableState.defaultLayout=n,R.mutableState.disableCursor=!!r)}),M.jsx(Ox.Provider,{value:A,children:M.jsx("div",{...h,className:e,"data-group":!0,"data-testid":y,id:y,ref:x,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:u==="horizontal"?"pan-y":"pan-x"},children:t})})}_x.displayName="Group";function qp(){const t=S.useContext(Ox);return ot(t,"Group Context not found; did you render a Panel or Separator outside of a Group?"),t}function EP(t,e){const{id:n}=qp(),r=S.useRef({collapse:tf,expand:tf,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:tf});S.useImperativeHandle(e,()=>r.current,[]),xs(()=>{Object.assign(r.current,xx({groupId:n,panelId:t}))})}function Nx({children:t,className:e,collapsedSize:n="0%",collapsible:r=!1,defaultSize:o,disabled:s,elementRef:i,groupResizeBehavior:a="preserve-relative-size",id:l,maxSize:c="100%",minSize:u="0%",onResize:d,panelRef:f,style:h,...p}){const g=!!l,m=Vp(l),y=Wp({disabled:s}),b=S.useRef(null),w=Hp(b,i),{getPanelStyles:k,id:v,orientation:x,registerPanel:E,togglePanelDisabled:C}=qp(),A=d!==null,z=aa((_,N,L)=>{d?.(_,l,L)});xs(()=>{const _=b.current;if(_!==null){const N={element:_,id:m,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:A?z:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsible:r,defaultSize:o,disabled:y.disabled,maxSize:c,minSize:u}};return E(N)}},[a,n,r,o,A,m,g,c,u,z,E,y]),S.useEffect(()=>{C(m,!!s)},[s,m,C]),EP(m,f);const R=S.useSyncExternalStore(_=>Lp(v,_),()=>JSON.stringify(k(v,m)),()=>JSON.stringify(k(v,m)));return M.jsx("div",{...p,"aria-disabled":s||void 0,"data-panel":!0,"data-testid":m,id:m,ref:w,style:{...CP,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...JSON.parse(R)},children:M.jsx("div",{className:e,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...h,touchAction:x==="horizontal"?"pan-y":"pan-x"},children:t})})}Nx.displayName="Panel";const CP={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function TP({layout:t,panelConstraints:e,panelId:n,panelIndex:r}){let o,s;const i=t[n],a=e.find(l=>l.panelId===n);if(a){const l=a.maxSize,c=a.collapsible?a.collapsedSize:a.minSize,u=[r,r+1];s=cs({layout:Ca({delta:c-i,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[n],o=cs({layout:Ca({delta:l-i,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[n]}return{valueControls:n,valueMax:o,valueMin:s,valueNow:i}}function Px({children:t,className:e,disabled:n,elementRef:r,id:o,style:s,...i}){const a=Vp(o),l=Wp({disabled:n}),[c,u]=S.useState({}),[d,f]=S.useState("inactive"),h=S.useRef(null),p=Hp(h,r),{disableCursor:g,id:m,orientation:y,registerSeparator:b,toggleSeparatorDisabled:w}=qp(),k=y==="horizontal"?"vertical":"horizontal";xs(()=>{const x=h.current;if(x!==null){const E={disabled:l.disabled,element:x,id:a},C=b(E),A=hP(R=>{f(R.next.state!=="inactive"&&R.next.hitRegions.some(_=>_.separator===E)?R.next.state:"inactive")}),z=Lp(m,R=>{const{derivedPanelConstraints:_,layout:N,separatorToPanels:L}=R.next,H=L.get(E);if(H){const Z=H[0],W=H.indexOf(Z);u(TP({layout:N,panelConstraints:_,panelId:Z.id,panelIndex:W}))}});return()=>{A(),z(),C()}}},[m,a,b,l]),S.useEffect(()=>{w(a,!!n)},[n,a,w]);let v;return n&&!g&&(v="not-allowed"),M.jsx("div",{...i,"aria-controls":c.valueControls,"aria-disabled":n||void 0,"aria-orientation":k,"aria-valuemax":c.valueMax,"aria-valuemin":c.valueMin,"aria-valuenow":c.valueNow,children:t,className:e,"data-separator":n?"disabled":d,"data-testid":a,id:a,ref:p,role:"separator",style:{flexBasis:"auto",cursor:v,...s,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}Px.displayName="Separator";function MP(t){const e=Me.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let o;e[3]!==n?(o=ue("flex h-full w-full aria-[orientation=vertical]:flex-col",n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=M.jsx(_x,{"data-slot":"resizable-panel-group",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function nf(t){const e=Me.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=M.jsx(Nx,{"data-slot":"resizable-panel",...n}),e[2]=n,e[3]=r):r=e[3],r}function My(t){const e=Me.c(12);let n,r,o;e[0]!==t?({withHandle:o,className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o):(n=e[1],r=e[2],o=e[3]);let s;e[4]!==n?(s=ue("group/resize-handle bg-border ring-offset-background focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",n),e[4]=n,e[5]=s):s=e[5];let i;e[6]!==o?(i=o&&M.jsx("div",{className:"bg-border z-10 flex h-6 w-1 shrink-0 rounded-lg opacity-0 transition-opacity duration-150 group-hover/resize-handle:opacity-100 group-focus-visible/resize-handle:opacity-100"}),e[6]=o,e[7]=i):i=e[7];let a;return e[8]!==r||e[9]!==s||e[10]!==i?(a=M.jsx(Px,{"data-slot":"resizable-handle",className:s,...r,children:i}),e[8]=r,e[9]=s,e[10]=i,e[11]=a):a=e[11],a}function Ta({controlled:t,default:e,name:n,state:r="value"}){const{current:o}=S.useRef(t!==void 0),[s,i]=S.useState(e),a=o?t:s,l=S.useCallback(c=>{o||i(c)},[]);return[a,l]}const Ax=S.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function RP(){return S.useContext(Ax)}function Up(t){const{children:e,elementsRef:n,labelsRef:r,onMapChange:o}=t,s=de(o),i=S.useRef(0),a=on(_P).current,l=on(OP).current,[c,u]=S.useState(0),d=S.useRef(c),f=de((y,b)=>{l.set(y,b??null),d.current+=1,u(d.current)}),h=de(y=>{l.delete(y),d.current+=1,u(d.current)}),p=S.useMemo(()=>{const y=new Map;return Array.from(l.keys()).filter(w=>w.isConnected).sort(NP).forEach((w,k)=>{const v=l.get(w)??{};y.set(w,{...v,index:k})}),y},[l,c]);me(()=>{if(typeof MutationObserver!="function"||p.size===0)return;const y=new MutationObserver(b=>{const w=new Set,k=v=>w.has(v)?w.delete(v):w.add(v);b.forEach(v=>{v.removedNodes.forEach(k),v.addedNodes.forEach(k)}),w.size===0&&(d.current+=1,u(d.current))});return p.forEach((b,w)=>{w.parentElement&&y.observe(w.parentElement,{childList:!0})}),()=>{y.disconnect()}},[p]),me(()=>{d.current===c&&(n.current.length!==p.size&&(n.current.length=p.size),r&&r.current.length!==p.size&&(r.current.length=p.size),i.current=p.size),s(p)},[s,p,n,r,c]),me(()=>()=>{n.current=[]},[n]),me(()=>()=>{r&&(r.current=[])},[r]);const g=de(y=>(a.add(y),()=>{a.delete(y)}));me(()=>{a.forEach(y=>y(p))},[a,p]);const m=S.useMemo(()=>({register:f,unregister:h,subscribeMapChange:g,elementsRef:n,labelsRef:r,nextIndexRef:i}),[f,h,g,n,r,i]);return M.jsx(Ax.Provider,{value:m,children:e})}function OP(){return new Map}function _P(){return new Set}function NP(t,e){const n=t.compareDocumentPosition(e);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Ix=S.createContext(void 0);function Kp(){const t=S.useContext(Ix);if(t===void 0)throw new Error(Zt(64));return t}let PP=(function(t){return t.activationDirection="data-activation-direction",t.orientation="data-orientation",t})({});const Yp={tabActivationDirection:t=>({[PP.activationDirection]:t})},AP=S.forwardRef(function(e,n){const{className:r,defaultValue:o=0,onValueChange:s,orientation:i="horizontal",render:a,value:l,...c}=e,u=Pp(),d=Object.hasOwn(e,"defaultValue"),f=S.useRef([]),[h,p]=S.useState(()=>new Map),[g,m]=Ta({controlled:l,default:o,name:"Tabs",state:"value"}),y=l!==void 0,[b,w]=S.useState(()=>new Map),[k,v]=S.useState("none"),x=de((W,q)=>{s?.(W,q),!q.isCanceled&&(m(W),v(q.activationDirection))}),E=de((W,q)=>{p(V=>{if(V.get(W)===q)return V;const D=new Map(V);return D.set(W,q),D})}),C=de((W,q)=>{p(V=>{if(!V.has(W)||V.get(W)!==q)return V;const D=new Map(V);return D.delete(W),D})}),A=S.useCallback(W=>h.get(W),[h]),z=S.useCallback(W=>{for(const q of b.values())if(W===q?.value)return q?.id},[b]),R=S.useCallback(W=>{if(W===void 0)return null;for(const[q,V]of b.entries())if(V!=null&&W===(V.value??V.index))return q;return null},[b]),_=S.useMemo(()=>({direction:u,getTabElementBySelectedValue:R,getTabIdByPanelValue:z,getTabPanelIdByValue:A,onValueChange:x,orientation:i,registerMountedTabPanel:E,setTabMap:w,unregisterMountedTabPanel:C,tabActivationDirection:k,value:g}),[u,R,z,A,x,i,E,w,C,k,g]),N=S.useMemo(()=>{for(const W of b.values())if(W!=null&&W.value===g)return W},[b,g]),L=S.useMemo(()=>{for(const W of b.values())if(W!=null&&!W.disabled)return W.value},[b]);me(()=>{if(y||b.size===0)return;const W=N?.disabled,q=N==null&&g!==null;if(d&&W&&g===o||!W&&!q)return;const D=L??null;g!==D&&(m(D),v("none"))},[o,L,d,y,N,v,m,b,g]);const Z=rt("div",e,{state:{orientation:i,tabActivationDirection:k},ref:n,props:c,stateAttributesMapping:Yp});return M.jsx(Ix.Provider,{value:_,children:M.jsx(Up,{elementsRef:f,children:Z})})}),$x="data-composite-item-active";let Dx=(function(t){return t[t.None=0]="None",t[t.GuessFromOrder=1]="GuessFromOrder",t})({});function Zp(t={}){const{label:e,metadata:n,textRef:r,indexGuessBehavior:o,index:s}=t,{register:i,unregister:a,subscribeMapChange:l,elementsRef:c,labelsRef:u,nextIndexRef:d}=RP(),f=S.useRef(-1),[h,p]=S.useState(s??(o===Dx.GuessFromOrder?()=>{if(f.current===-1){const y=d.current;d.current+=1,f.current=y}return f.current}:-1)),g=S.useRef(null),m=S.useCallback(y=>{if(g.current=y,h!==-1&&y!==null&&(c.current[h]=y,u)){const b=e!==void 0;u.current[h]=b?e:r?.current?.textContent??y.textContent}},[h,c,u,e,r]);return me(()=>{if(s!=null)return;const y=g.current;if(y)return i(y,n),()=>{a(y)}},[s,i,a,n]),me(()=>{if(s==null)return l(y=>{const b=g.current?y.get(g.current)?.index:null;b!=null&&p(b)})},[s,l,p]),S.useMemo(()=>({ref:m,index:h}),[h,m])}function IP(t={}){const{highlightItemOnHover:e,highlightedIndex:n,onHighlightedIndexChange:r}=mx(),{ref:o,index:s}=Zp(t),i=n===s,a=S.useRef(null),l=zr(o,a);return{compositeProps:S.useMemo(()=>({tabIndex:i?0:-1,onFocus(){r(s)},onMouseMove(){const u=a.current;if(!e||!u)return;const d=u.hasAttribute("disabled")||u.ariaDisabled==="true";!i&&!d&&u.focus()}}),[i,r,s,e]),compositeRef:l,index:s}}const zx=S.createContext(void 0);function $P(){const t=S.useContext(zx);if(t===void 0)throw new Error(Zt(65));return t}const DP=S.forwardRef(function(e,n){const{className:r,disabled:o=!1,render:s,value:i,id:a,nativeButton:l=!0,...c}=e,{value:u,getTabPanelIdByValue:d,orientation:f}=Kp(),{activateOnFocus:h,highlightedTabIndex:p,onTabActivation:g,setHighlightedTabIndex:m,tabsListElement:y}=$P(),b=bs(a),w=S.useMemo(()=>({disabled:o,id:b,value:i}),[o,b,i]),{compositeProps:k,compositeRef:v,index:x}=IP({metadata:w}),E=i===u,C=S.useRef(!1);me(()=>{if(C.current){C.current=!1;return}if(!(E&&x>-1&&p!==x))return;const V=y;if(V!=null){const D=Hn(Ke(V));if(D&&Fe(V,D))return}o||m(x)},[E,x,p,m,o,y]);const{getButtonProps:A,buttonRef:z}=ws({disabled:o,native:l,focusableWhenDisabled:!0}),R=d(i),_=S.useRef(!1),N=S.useRef(!1);function L(V){E||o||g(i,De(po,V.nativeEvent,void 0,{activationDirection:"none"}))}function H(V){E||(x>-1&&!o&&m(x),!o&&h&&(!_.current||_.current&&N.current)&&g(i,De(po,V.nativeEvent,void 0,{activationDirection:"none"})))}function Z(V){if(E||o)return;_.current=!0;function D(){_.current=!1,N.current=!1}(!V.button||V.button===0)&&(N.current=!0,Ke(V.currentTarget).addEventListener("pointerup",D,{once:!0}))}return rt("button",e,{state:{disabled:o,active:E,orientation:f},ref:[n,z,v],props:[k,{role:"tab","aria-controls":R,"aria-selected":E,id:b,onClick:L,onFocus:H,onPointerDown:Z,[$x]:E?"":void 0,onKeyDownCapture(){C.current=!0}},c,A]})}),zP=S.createContext(void 0),LP={disableStyleElements:!1};function jP(){return S.useContext(zP)??LP}let FP=(function(t){return t.index="data-index",t.activationDirection="data-activation-direction",t.orientation="data-orientation",t.hidden="data-hidden",t})({});const BP={...Yp,..._i},VP=S.forwardRef(function(e,n){const{className:r,value:o,render:s,keepMounted:i=!1,...a}=e,{value:l,getTabIdByPanelValue:c,orientation:u,tabActivationDirection:d,registerMountedTabPanel:f,unregisterMountedTabPanel:h}=Kp(),p=bs(),g=S.useMemo(()=>({id:p,value:o}),[p,o]),{ref:m,index:y}=Zp({metadata:g}),b=o===l,{mounted:w,transitionStatus:k,setMounted:v}=qa(b),x=!w,E=c(o),C={hidden:x,orientation:u,tabActivationDirection:d,transitionStatus:k},A=S.useRef(null),z=rt("div",e,{state:C,ref:[n,m,A],props:[{"aria-labelledby":E,hidden:x,id:p,role:"tabpanel",tabIndex:b?0:-1,inert:dd(!b),[FP.index]:y},a],stateAttributesMapping:BP});return Co({open:b,ref:A,onComplete(){b||v(!1)}}),me(()=>{if(!(x&&!i)&&p!=null)return f(o,p),()=>{h(o,p)}},[x,i,o,p,f,h]),i||w?z:null});function HP(t){return t==null||t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true"}const ei="ArrowUp",Uo="ArrowDown",Ma="ArrowLeft",ti="ArrowRight",Ua="Home",Ka="End",Lx=new Set([Ma,ti]),WP=new Set([Ma,ti,Ua,Ka]),jx=new Set([ei,Uo]),qP=new Set([ei,Uo,Ua,Ka]),Fx=new Set([...Lx,...jx]),UP=new Set([...Fx,Ua,Ka]),Gp=new Set([ei,Uo,Ma,ti,Ua,Ka]),KP="Shift",YP="Control",ZP="Alt",GP="Meta",JP=new Set([KP,YP,ZP,GP]);function XP(t){return gt(t)&&t.tagName==="INPUT"}function Ry(t){return!!(XP(t)&&t.selectionStart!=null||gt(t)&&t.tagName==="TEXTAREA")}function Oy(t,e,n,r){if(!t||!e||!e.scrollTo)return;let o=t.scrollLeft,s=t.scrollTop;const i=t.clientWidth<t.scrollWidth,a=t.clientHeight<t.scrollHeight;if(i&&r!=="vertical"){const l=_y(t,e,"left"),c=yl(t),u=yl(e);n==="ltr"&&(l+e.offsetWidth+u.scrollMarginRight>t.scrollLeft+t.clientWidth-c.scrollPaddingRight?o=l+e.offsetWidth+u.scrollMarginRight-t.clientWidth+c.scrollPaddingRight:l-u.scrollMarginLeft<t.scrollLeft+c.scrollPaddingLeft&&(o=l-u.scrollMarginLeft-c.scrollPaddingLeft)),n==="rtl"&&(l-u.scrollMarginRight<t.scrollLeft+c.scrollPaddingLeft?o=l-u.scrollMarginLeft-c.scrollPaddingLeft:l+e.offsetWidth+u.scrollMarginRight>t.scrollLeft+t.clientWidth-c.scrollPaddingRight&&(o=l+e.offsetWidth+u.scrollMarginRight-t.clientWidth+c.scrollPaddingRight))}if(a&&r!=="horizontal"){const l=_y(t,e,"top"),c=yl(t),u=yl(e);l-u.scrollMarginTop<t.scrollTop+c.scrollPaddingTop?s=l-u.scrollMarginTop-c.scrollPaddingTop:l+e.offsetHeight+u.scrollMarginBottom>t.scrollTop+t.clientHeight-c.scrollPaddingBottom&&(s=l+e.offsetHeight+u.scrollMarginBottom-t.clientHeight+c.scrollPaddingBottom)}t.scrollTo({left:o,top:s,behavior:"auto"})}function _y(t,e,n){const r=n==="left"?"offsetLeft":"offsetTop";let o=0;for(;e.offsetParent&&(o+=e[r],e.offsetParent!==t);)e=e.offsetParent;return o}function yl(t){const e=getComputedStyle(t);return{scrollMarginTop:parseFloat(e.scrollMarginTop)||0,scrollMarginRight:parseFloat(e.scrollMarginRight)||0,scrollMarginBottom:parseFloat(e.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(e.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(e.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(e.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(e.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(e.scrollPaddingLeft)||0}}const QP=[];function eA(t){const{itemSizes:e,cols:n=1,loopFocus:r=!0,dense:o=!1,orientation:s="both",direction:i,highlightedIndex:a,onHighlightedIndexChange:l,rootRef:c,enableHomeAndEndKeys:u=!1,stopEventPropagation:d=!1,disabledIndices:f,modifierKeys:h=QP}=t,[p,g]=S.useState(0),m=n>1,y=S.useRef(null),b=zr(y,c),w=S.useRef([]),k=S.useRef(!1),v=a??p,x=de((A,z=!1)=>{if((l??g)(A),z){const R=w.current[A];Oy(y.current,R,i,s)}}),E=de(A=>{if(A.size===0||k.current)return;k.current=!0;const z=Array.from(A.keys()),R=z.find(N=>N?.hasAttribute($x))??null,_=R?z.indexOf(R):-1;_!==-1&&x(_),Oy(y.current,R,i,s)}),C=S.useMemo(()=>({"aria-orientation":s==="both"?void 0:s,ref:b,onFocus(A){!y.current||!Ry(A.target)||A.target.setSelectionRange(0,A.target.value.length??0)},onKeyDown(A){const z=u?UP:Fx;if(!z.has(A.key)||tA(A,h)||!y.current)return;const _=i==="rtl",N=_?Ma:ti,L={horizontal:N,vertical:Uo,both:N}[s],H=_?ti:Ma,Z={horizontal:H,vertical:ei,both:H}[s];if(Ry(A.target)&&!HP(A.target)){const F=A.target.selectionStart,T=A.target.selectionEnd,$=A.target.value??"";if(F==null||A.shiftKey||F!==T||A.key!==Z&&F<$.length||A.key!==L&&F>0)return}let W=v;const q=Ec(w,f),V=ch(w,f);if(m){const F=e||Array.from({length:w.current.length},()=>({width:1,height:1})),T=Xw(F,n,o),$=T.findIndex(Y=>Y!=null&&!io(w,Y,f)),I=T.reduce((Y,G,X)=>G!=null&&!io(w,G,f)?X:Y,-1);W=T[Jw({current:T.map(Y=>Y?w.current[Y]:null)},{event:A,orientation:s,loopFocus:r,cols:n,disabledIndices:ek([...f||w.current.map((Y,G)=>io(w,G)?G:void 0),void 0],T),minIndex:$,maxIndex:I,prevIndex:Qw(v>V?q:v,F,T,n,A.key===Uo?"bl":A.key===ti?"tr":"tl"),rtl:_})]}const D={horizontal:[N],vertical:[Uo],both:[N,Uo]}[s],j={horizontal:[H],vertical:[ei],both:[H,ei]}[s],B=m?z:{horizontal:u?WP:Lx,vertical:u?qP:jx,both:z}[s];u&&(A.key===Ua?W=q:A.key===Ka&&(W=V)),W===v&&(D.includes(A.key)||j.includes(A.key))&&(r&&W===V&&D.includes(A.key)?W=q:r&&W===q&&j.includes(A.key)?W=V:W=Bt(w,{startingIndex:W,decrement:j.includes(A.key),disabledIndices:f})),W!==v&&!Ys(w,W)&&(d&&A.stopPropagation(),B.has(A.key)&&A.preventDefault(),x(W,!0),queueMicrotask(()=>{w.current[W]?.focus()}))}}),[n,o,i,f,w,u,v,m,e,r,b,h,x,s,d]);return S.useMemo(()=>({props:C,highlightedIndex:v,onHighlightedIndexChange:x,elementsRef:w,disabledIndices:f,onMapChange:E,relayKeyboardEvent:C.onKeyDown}),[C,v,x,w,f,E])}function tA(t,e){for(const n of JP.values())if(!e.includes(n)&&t.getModifierState(n))return!0;return!1}function nA(t){const{render:e,className:n,refs:r=ka,props:o=ka,state:s=At,stateAttributesMapping:i,highlightedIndex:a,onHighlightedIndexChange:l,orientation:c,dense:u,itemSizes:d,loopFocus:f,cols:h,enableHomeAndEndKeys:p,onMapChange:g,stopEventPropagation:m=!0,rootRef:y,disabledIndices:b,modifierKeys:w,highlightItemOnHover:k=!1,tag:v="div",...x}=t,E=Pp(),{props:C,highlightedIndex:A,onHighlightedIndexChange:z,elementsRef:R,onMapChange:_,relayKeyboardEvent:N}=eA({itemSizes:d,cols:h,loopFocus:f,dense:u,orientation:c,highlightedIndex:a,onHighlightedIndexChange:l,rootRef:y,stopEventPropagation:m,enableHomeAndEndKeys:p,direction:E,disabledIndices:b,modifierKeys:w}),L=rt(v,t,{state:s,ref:r,props:[C,...o,x],stateAttributesMapping:i}),H=S.useMemo(()=>({highlightedIndex:A,onHighlightedIndexChange:z,highlightItemOnHover:k,relayKeyboardEvent:N}),[A,z,k,N]);return M.jsx(px.Provider,{value:H,children:M.jsx(Up,{elementsRef:R,onMapChange:Z=>{g?.(Z),_(Z)},children:L})})}const rA=S.forwardRef(function(e,n){const{activateOnFocus:r=!1,className:o,loopFocus:s=!0,render:i,...a}=e,{getTabElementBySelectedValue:l,onValueChange:c,orientation:u,value:d,setTabMap:f,tabActivationDirection:h}=Kp(),[p,g]=S.useState(0),[m,y]=S.useState(null),b=oA(d,u,m,l),w=de((E,C)=>{if(E!==d){const A=b(E);C.activationDirection=A,c(E,C)}}),k={orientation:u,tabActivationDirection:h},v={"aria-orientation":u==="vertical"?"vertical":void 0,role:"tablist"},x=S.useMemo(()=>({activateOnFocus:r,highlightedTabIndex:p,onTabActivation:w,setHighlightedTabIndex:g,tabsListElement:m,value:d}),[r,p,w,g,m,d]);return M.jsx(zx.Provider,{value:x,children:M.jsx(nA,{render:i,className:o,state:k,refs:[n,y],props:[v,a],stateAttributesMapping:Yp,highlightedIndex:p,enableHomeAndEndKeys:!0,loopFocus:s,orientation:u,onHighlightedIndexChange:g,onMapChange:f,disabledIndices:ka})})});function Ny(t,e){const{left:n,top:r}=t.getBoundingClientRect(),{left:o,top:s}=e.getBoundingClientRect(),i=n-o,a=r-s;return{left:i,top:a}}function oA(t,e,n,r){const[o,s]=S.useState(null);return me(()=>{if(t==null||n==null){s(null);return}const i=r(t);if(i==null){s(null);return}const{left:a,top:l}=Ny(i,n);s(e==="horizontal"?a:l)},[e,r,n,t]),S.useCallback(i=>{if(i===t)return"none";if(i==null)return s(null),"none";if(i!=null&&n!=null){const a=r(i);if(a!=null){const{left:l,top:c}=Ny(a,n);if(o==null)return s(e==="horizontal"?l:c),"none";if(e==="horizontal"){if(l<o)return s(l),"left";if(l>o)return s(l),"right"}else{if(c<o)return s(c),"up";if(c>o)return s(c),"down"}}}return"none"},[r,e,o,n,t])}function Bx(t){const e=Me.c(10);let n,r,o;e[0]!==t?({className:n,orientation:o,...r}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o):(n=e[1],r=e[2],o=e[3]);const s=o===void 0?"horizontal":o;let i;e[4]!==n?(i=ue("group/tabs flex gap-2 data-horizontal:flex-col",n),e[4]=n,e[5]=i):i=e[5];let a;return e[6]!==s||e[7]!==r||e[8]!==i?(a=M.jsx(AP,{"data-slot":"tabs","data-orientation":s,className:i,...r}),e[6]=s,e[7]=r,e[8]=i,e[9]=a):a=e[9],a}const sA=zp("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted dark:bg-muted/30",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Vx(t){const e=Me.c(11);let n,r,o;e[0]!==t?({className:n,variant:o,...r}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o):(n=e[1],r=e[2],o=e[3]);const s=o===void 0?"default":o;let i;e[4]!==n||e[5]!==s?(i=ue(sA({variant:s}),n),e[4]=n,e[5]=s,e[6]=i):i=e[6];let a;return e[7]!==r||e[8]!==i||e[9]!==s?(a=M.jsx(rA,{"data-slot":"tabs-list","data-variant":s,className:i,...r}),e[7]=r,e[8]=i,e[9]=s,e[10]=a):a=e[10],a}function Hc(t){const e=Me.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let o;e[3]!==n?(o=ue("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=M.jsx(DP,{"data-slot":"tabs-trigger",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function Py(t){const e=Me.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let o;e[3]!==n?(o=ue("flex-1 text-sm outline-none",n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=M.jsx(VP,{"data-slot":"tabs-content",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}let Ay={},Iy={},$y="";function iA(t){if(typeof document>"u")return!1;const e=Ke(t);return Mt(e).innerWidth-e.documentElement.clientWidth>0}function aA(t){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=Ke(t),r=n.documentElement,o=n.body,s=xo(r)?r:o,i=s.style.overflowY,a=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",s.style.overflowY="scroll";const l=s.offsetWidth;s.style.overflowY="hidden";const c=s.offsetWidth;return s.style.overflowY=i,r.style.scrollbarGutter=a,l===c}function lA(t){const e=Ke(t),n=e.documentElement,r=e.body,o=xo(n)?n:r,s={overflowY:o.style.overflowY,overflowX:o.style.overflowX};return Object.assign(o.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(o.style,s)}}function cA(t){const e=Ke(t),n=e.documentElement,r=e.body,o=Mt(n);let s=0,i=0,a=!1;const l=or.create();if(pp&&(o.visualViewport?.scale??1)!==1)return()=>{};function c(){const f=o.getComputedStyle(n),h=o.getComputedStyle(r),m=(f.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,Ay={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},$y=n.style.scrollBehavior,Iy={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const y=n.scrollHeight>n.clientHeight,b=n.scrollWidth>n.clientWidth,w=f.overflowY==="scroll"||h.overflowY==="scroll",k=f.overflowX==="scroll"||h.overflowX==="scroll",v=Math.max(0,o.innerWidth-r.clientWidth),x=Math.max(0,o.innerHeight-r.clientHeight),E=parseFloat(h.marginTop)+parseFloat(h.marginBottom),C=parseFloat(h.marginLeft)+parseFloat(h.marginRight),A=xo(n)?n:r;if(a=aA(t),a){n.style.scrollbarGutter=m,A.style.overflowY="hidden",A.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:m,overflowY:"hidden",overflowX:"hidden"}),(y||w)&&(n.style.overflowY="scroll"),(b||k)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:E||x?`calc(100dvh - ${E+x}px)`:"100dvh",width:C||v?`calc(100vw - ${C+v}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=s,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function u(){Object.assign(n.style,Ay),Object.assign(r.style,Iy),a||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=$y)}function d(){u(),l.request(c)}return c(),o.addEventListener("resize",d),()=>{l.cancel(),u(),typeof o.removeEventListener=="function"&&o.removeEventListener("resize",d)}}class uA{lockCount=0;restore=null;timeoutLock=ss.create();timeoutUnlock=ss.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;const r=Ke(e).documentElement,o=Mt(r).getComputedStyle(r).overflowY;if(o==="hidden"||o==="clip"){this.restore=dn;return}const s=Vw||!iA(e);this.restore=s?lA(e):cA(e)}}const dA=new uA;function Jp(t=!0,e=null){me(()=>{if(t)return dA.acquire(e)},[t,e])}function fA(t){const e=S.useRef(""),n=S.useCallback(o=>{o.defaultPrevented||(e.current=o.pointerType,t(o,o.pointerType))},[t]);return{onClick:S.useCallback(o=>{if(o.detail===0){t(o,"keyboard");return}"pointerType"in o?t(o,o.pointerType):t(o,e.current),e.current=""},[t]),onPointerDown:n}}function Xp(t){const[e,n]=S.useState(null),r=de((a,l)=>{t||n(l||(Vw?"touch":""))}),o=S.useCallback(()=>{n(null)},[]),{onClick:s,onPointerDown:i}=fA(r);return S.useMemo(()=>({openMethod:e,reset:o,triggerProps:{onClick:s,onPointerDown:i}}),[e,o,s,i])}function hA(t){const{store:e,parentContext:n,actionsRef:r}=t,o=e.useState("open"),s=e.useState("disablePointerDismissal"),i=e.useState("modal"),a=e.useState("popupElement"),{openMethod:l,triggerProps:c,reset:u}=Xp(o);jk(e);const{forceUnmount:d}=Fk(o,e,()=>{u()}),f=de(z=>{const R=De(z);return R.preventUnmountOnClose=()=>{e.set("preventUnmountingOnClose",!0)},R}),h=S.useCallback(()=>{e.setOpen(!1,f(gk))},[e,f]);S.useImperativeHandle(r,()=>({unmount:d,close:h}),[d,h]);const p=Wk({popupStore:e,onOpenChange:e.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[g,m]=S.useState(0),y=g===0,b=Uk(p),w=Mp(p,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(z){if(!e.context.outsidePressEnabledRef.current||"button"in z&&z.button!==0||"touches"in z&&z.touches.length!==1)return!1;const R=vn(z);if(y&&!s){const _=R;return i&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===_||e.context.backdropRef.current===_||Fe(_,a)&&!_?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:y});Jp(o&&i===!0,a);const{getReferenceProps:k,getFloatingProps:v,getTriggerProps:x}=ld([b,w]);e.useContextCallback("onNestedDialogOpen",z=>{m(z+1)}),e.useContextCallback("onNestedDialogClose",()=>{m(0)}),S.useEffect(()=>(n?.onNestedDialogOpen&&o&&n.onNestedDialogOpen(g),n?.onNestedDialogClose&&!o&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&o&&n.onNestedDialogClose()}),[o,n,g]);const E=S.useMemo(()=>k(c),[k,c]),C=S.useMemo(()=>x(c),[x,c]),A=S.useMemo(()=>v(),[v]);e.useSyncedValues({openMethod:l,activeTriggerProps:E,inactiveTriggerProps:C,popupProps:A,floatingRootContext:p,nestedOpenDialogCount:g})}const Hx=S.createContext(void 0);function Ss(t){return S.useContext(Hx)}const pA={...Vk,modal:ge(t=>t.modal),nested:ge(t=>t.nested),nestedOpenDialogCount:ge(t=>t.nestedOpenDialogCount),disablePointerDismissal:ge(t=>t.disablePointerDismissal),openMethod:ge(t=>t.openMethod),descriptionElementId:ge(t=>t.descriptionElementId),titleElementId:ge(t=>t.titleElementId),viewportElement:ge(t=>t.viewportElement),role:ge(t=>t.role)};class mA extends Op{constructor(e){super(gA(e),{popupRef:S.createRef(),backdropRef:S.createRef(),internalBackdropRef:S.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new ad,onOpenChange:void 0,onOpenChangeComplete:void 0},pA)}setOpen=(e,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!e&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,n),n.isCanceled)return;const r={open:e,nativeEvent:n.event,reason:n.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",r);const o={open:e},s=n.trigger?.id??null;(s||e)&&(o.activeTriggerId=s,o.activeTriggerElement=n.trigger??null),this.update(o)}}function gA(t={}){return{...Bk(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...t}}function yA(t){const{children:e,open:n,defaultOpen:r=!1,onOpenChange:o,onOpenChangeComplete:s,actionsRef:i,handle:a,triggerId:l,defaultTriggerId:c=null}=t,u=Ss(),d=!!u,f=on(()=>a?.store??new mA({open:r,openProp:n,activeTriggerId:c,triggerIdProp:l,modal:!0,disablePointerDismissal:!0,nested:d,role:"alertdialog"})).current;f.useControlledProp("openProp",n),f.useControlledProp("triggerIdProp",l),f.useSyncedValue("nested",d),f.useContextCallback("onOpenChange",o),f.useContextCallback("onOpenChangeComplete",s);const h=f.useState("payload");hA({store:f,actionsRef:i,parentContext:u?.store.context});const p=S.useMemo(()=>({store:f}),[f]);return M.jsx(Hx.Provider,{value:p,children:typeof e=="function"?e({payload:h}):e})}const bA={...Ni,..._i},vA=S.forwardRef(function(e,n){const{render:r,className:o,forceRender:s=!1,...i}=e,{store:a}=Ss(),l=a.useState("open"),c=a.useState("nested"),u=a.useState("mounted"),d=a.useState("transitionStatus");return rt("div",e,{state:{open:l,transitionStatus:d},ref:[a.context.backdropRef,n],stateAttributesMapping:bA,props:[{role:"presentation",hidden:!u,style:{userSelect:"none",WebkitUserSelect:"none"}},i],enabled:s||!c})}),wA=S.forwardRef(function(e,n){const{render:r,className:o,disabled:s=!1,nativeButton:i=!0,...a}=e,{store:l}=Ss(),c=l.useState("open");function u(p){c&&l.setOpen(!1,De(BM,p.nativeEvent))}const{getButtonProps:d,buttonRef:f}=ws({disabled:s,native:i});return rt("button",e,{state:{disabled:s},ref:[n,f],props:[{onClick:u},a,d]})}),kA=S.forwardRef(function(e,n){const{render:r,className:o,id:s,...i}=e,{store:a}=Ss(),l=bs(s);return a.useSyncedValueWithCleanup("descriptionElementId",l),rt("p",e,{ref:n,props:[{id:l},i]})});let xA=(function(t){return t.nestedDialogs="--nested-dialogs",t})({}),SA=(function(t){return t[t.open=qo.open]="open",t[t.closed=qo.closed]="closed",t[t.startingStyle=qo.startingStyle]="startingStyle",t[t.endingStyle=qo.endingStyle]="endingStyle",t.nested="data-nested",t.nestedDialogOpen="data-nested-dialog-open",t})({});const Wx=S.createContext(void 0);function EA(){const t=S.useContext(Wx);if(t===void 0)throw new Error(Zt(26));return t}const CA={...Ni,..._i,nestedDialogOpen(t){return t?{[SA.nestedDialogOpen]:""}:null}},TA=S.forwardRef(function(e,n){const{className:r,finalFocus:o,initialFocus:s,render:i,...a}=e,{store:l}=Ss(),c=l.useState("descriptionElementId"),u=l.useState("disablePointerDismissal"),d=l.useState("floatingRootContext"),f=l.useState("popupProps"),h=l.useState("modal"),p=l.useState("mounted"),g=l.useState("nested"),m=l.useState("nestedOpenDialogCount"),y=l.useState("open"),b=l.useState("openMethod"),w=l.useState("titleElementId"),k=l.useState("transitionStatus"),v=l.useState("role");EA(),Co({open:y,ref:l.context.popupRef,onComplete(){y&&l.context.onOpenChangeComplete?.(!0)}});function x(R){return R==="touch"?l.context.popupRef.current:!0}const E=s===void 0?x:s,C=m>0,z=rt("div",e,{state:{open:y,nested:g,transitionStatus:k,nestedDialogOpen:C},props:[f,{"aria-labelledby":w??void 0,"aria-describedby":c??void 0,role:v,tabIndex:-1,hidden:!p,onKeyDown(R){Gp.has(R.key)&&R.stopPropagation()},style:{[xA.nestedDialogs]:m}},a],ref:[n,l.context.popupRef,l.useStateSetter("popupElement")],stateAttributesMapping:CA});return M.jsx(Cp,{context:d,openInteractionType:b,disabled:!p,closeOnFocusOut:!u,initialFocus:E,returnFocus:o,modal:h!==!1,restoreFocus:"popup",children:z})}),Qp=S.forwardRef(function(e,n){const{cutout:r,...o}=e;let s;if(r){const i=r?.getBoundingClientRect();s=`polygon(
|
|
2
|
-
0% 0%,
|
|
3
|
-
100% 0%,
|
|
4
|
-
100% 100%,
|
|
5
|
-
0% 100%,
|
|
6
|
-
0% 0%,
|
|
7
|
-
${i.left}px ${i.top}px,
|
|
8
|
-
${i.left}px ${i.bottom}px,
|
|
9
|
-
${i.right}px ${i.bottom}px,
|
|
10
|
-
${i.right}px ${i.top}px,
|
|
11
|
-
${i.left}px ${i.top}px
|
|
12
|
-
)`}return M.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})}),MA=S.forwardRef(function(e,n){const{keepMounted:r=!1,...o}=e,{store:s}=Ss(),i=s.useState("mounted"),a=s.useState("modal"),l=s.useState("open");return i||r?M.jsx(Wx.Provider,{value:r,children:M.jsxs(Sp,{ref:n,...o,children:[i&&a===!0&&M.jsx(Qp,{ref:s.context.internalBackdropRef,inert:dd(!l)}),e.children]})}):null}),RA=S.forwardRef(function(e,n){const{render:r,className:o,id:s,...i}=e,{store:a}=Ss(),l=bs(s);return a.useSyncedValueWithCleanup("titleElementId",l),rt("h2",e,{ref:n,props:[{id:l},i]})});function OA(t){const e=Me.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=M.jsx(yA,{"data-slot":"alert-dialog",...n}),e[2]=n,e[3]=r):r=e[3],r}function _A(t){const e=Me.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=M.jsx(MA,{"data-slot":"alert-dialog-portal",...n}),e[2]=n,e[3]=r):r=e[3],r}function NA(t){const e=Me.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let o;e[3]!==n?(o=ue("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=M.jsx(vA,{"data-slot":"alert-dialog-overlay",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function PA(t){const e=Me.c(11);let n,r,o;e[0]!==t?({className:n,size:o,...r}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o):(n=e[1],r=e[2],o=e[3]);const s=o===void 0?"default":o;let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=M.jsx(NA,{}),e[4]=i):i=e[4];let a;e[5]!==n?(a=ue("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-background p-4 ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",n),e[5]=n,e[6]=a):a=e[6];let l;return e[7]!==r||e[8]!==s||e[9]!==a?(l=M.jsxs(_A,{children:[i,M.jsx(TA,{"data-slot":"alert-dialog-content","data-size":s,className:a,...r})]}),e[7]=r,e[8]=s,e[9]=a,e[10]=l):l=e[10],l}function AA(t){const e=Me.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let o;e[3]!==n?(o=ue("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=M.jsx("div",{"data-slot":"alert-dialog-header",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function IA(t){const e=Me.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let o;e[3]!==n?(o=ue("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=M.jsx("div",{"data-slot":"alert-dialog-footer",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function $A(t){const e=Me.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let o;e[3]!==n?(o=ue("text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=M.jsx(RA,{"data-slot":"alert-dialog-title",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function DA(t){const e=Me.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let o;e[3]!==n?(o=ue("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=M.jsx(kA,{"data-slot":"alert-dialog-description",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function zA(t){const e=Me.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let o;e[3]!==n?(o=ue(n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=M.jsx(pn,{"data-slot":"alert-dialog-action",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function LA(t){const e=Me.c(14);let n,r,o,s;e[0]!==t?({className:n,variant:o,size:s,...r}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=s):(n=e[1],r=e[2],o=e[3],s=e[4]);const i=o===void 0?"outline":o,a=s===void 0?"default":s;let l;e[5]!==n?(l=ue(n),e[5]=n,e[6]=l):l=e[6];let c;e[7]!==a||e[8]!==i?(c=M.jsx(pn,{variant:i,size:a}),e[7]=a,e[8]=i,e[9]=c):c=e[9];let u;return e[10]!==r||e[11]!==l||e[12]!==c?(u=M.jsx(wA,{"data-slot":"alert-dialog-cancel",className:l,render:c,...r}),e[10]=r,e[11]=l,e[12]=c,e[13]=u):u=e[13],u}function jA(t){return rt(t.defaultTagName??"div",t,t)}const FA=zp("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function Wc(t){const e=Me.c(13);let n,r,o,s,i;if(e[0]!==t){const{className:c,variant:u,render:d,...f}=t;n=d,i=u===void 0?"default":u,s=jA,r="span",o=Oi({className:ue(FA({variant:i}),c)},f),e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=s,e[5]=i}else n=e[1],r=e[2],o=e[3],s=e[4],i=e[5];let a;e[6]!==i?(a={slot:"badge",variant:i},e[6]=i,e[7]=a):a=e[7];let l;return e[8]!==n||e[9]!==r||e[10]!==o||e[11]!==a?(l={defaultTagName:r,props:o,render:n,state:a},e[8]=n,e[9]=r,e[10]=o,e[11]=a,e[12]=l):l=e[12],s(l)}const qx=S.createContext(null),Ux=S.createContext(null);function fr(){const t=S.useContext(qx);if(t===null)throw new Error(Zt(60));return t}function Kx(){const t=S.useContext(Ux);if(t===null)throw new Error(Zt(61));return t}let Dy=(function(t){return t.disabled="data-disabled",t.valid="data-valid",t.invalid="data-invalid",t.touched="data-touched",t.dirty="data-dirty",t.filled="data-filled",t.focused="data-focused",t})({});const BA={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},em={valid(t){return t===null?null:t?{[Dy.valid]:""}:{[Dy.invalid]:""}}},VA=S.createContext({invalid:void 0,name:void 0,validityData:{state:BA,errors:[],error:"",value:"",initialValue:null},setValidityData:dn,disabled:void 0,touched:!1,setTouched:dn,dirty:!1,setDirty:dn,filled:!1,setFilled:dn,focused:!1,setFocused:dn,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(t=At)=>t,getInputValidationProps:(t=At)=>t,inputRef:{current:null},commit:async()=>{}}});function Pi(t=!0){const e=S.useContext(VA);if(e.setValidityData===dn&&!t)throw new Error(Zt(28));return e}const HA=S.createContext({controlId:void 0,registerControlId:dn,labelId:void 0,setLabelId:dn,messageIds:[],setMessageIds:dn,getDescriptionProps:t=>t});function fd(){return S.useContext(HA)}function hd(t={}){const{id:e,implicit:n=!1,controlRef:r}=t,{controlId:o,registerControlId:s}=fd(),i=bs(e),a=n?o:void 0,l=on(()=>Symbol("labelable-control")),c=S.useRef(!1),u=S.useRef(e!=null),d=de(()=>{!c.current||s===dn||(c.current=!1,s(l.current,void 0))});return me(()=>{if(s===dn)return;let f;if(n){const h=r?.current;et(h)&&h.closest("label")!=null?f=e??null:f=a??i}else if(e!=null)u.current=!0,f=e;else if(u.current)f=i;else{d();return}if(f===void 0){d();return}c.current=!0,s(l.current,f)},[e,r,a,s,n,i,l,d]),S.useEffect(()=>d,[d]),o??i}const WA=(t,e)=>Object.is(t,e);function pi(t,e,n){return t==null||e==null?Object.is(t,e):n(t,e)}function qA(t,e,n){return!t||t.length===0?!1:t.some(r=>r===void 0?!1:pi(e,r,n))}function la(t,e,n){return!t||t.length===0?-1:t.findIndex(r=>r===void 0?!1:pi(r,e,n))}function UA(t,e,n){return t.filter(r=>!pi(e,r,n))}function wh(t){if(t==null)return"";if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}function Yx(t){return t!=null&&t.length>0&&typeof t[0]=="object"&&t[0]!=null&&"items"in t[0]}function KA(t){if(!Array.isArray(t))return t!=null&&!("null"in t);if(Yx(t)){for(const e of t)for(const n of e.items)if(n&&n.value==null&&n.label!=null)return!0;return!1}for(const e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function YA(t,e){if(e&&t!=null)return e(t)??"";if(t&&typeof t=="object"){if("label"in t&&t.label!=null)return String(t.label);if("value"in t)return String(t.value)}return wh(t)}function Ls(t,e){return e&&t!=null?e(t)??"":t&&typeof t=="object"&&"value"in t&&"label"in t?wh(t.value):wh(t)}function Zx(t,e,n){function r(){return YA(t,n)}if(n&&t!=null)return n(t);if(t&&typeof t=="object"&&"label"in t&&t.label!=null)return t.label;if(e&&!Array.isArray(e))return e[t]??r();if(Array.isArray(e)){const o=Yx(e)?e.flatMap(s=>s.items):e;if(t==null||typeof t!="object"){const s=o.find(i=>i.value===t);return s&&s.label!=null?s.label:r()}if("value"in t){const s=o.find(i=>i&&i.value===t.value);if(s&&s.label!=null)return s.label}}return r()}function ZA(t,e,n){return t.reduce((r,o,s)=>(s>0&&r.push(", "),r.push(M.jsx(S.Fragment,{children:Zx(o,e,n)},s)),r),[])}const Te={id:ge(t=>t.id),modal:ge(t=>t.modal),multiple:ge(t=>t.multiple),items:ge(t=>t.items),itemToStringLabel:ge(t=>t.itemToStringLabel),itemToStringValue:ge(t=>t.itemToStringValue),isItemEqualToValue:ge(t=>t.isItemEqualToValue),value:ge(t=>t.value),hasSelectedValue:ge(t=>{const{value:e,multiple:n,itemToStringValue:r}=t;return e==null?!1:n&&Array.isArray(e)?e.length>0:Ls(e,r)!==""}),hasNullItemLabel:ge((t,e)=>e?KA(t.items):!1),open:ge(t=>t.open),mounted:ge(t=>t.mounted),forceMount:ge(t=>t.forceMount),transitionStatus:ge(t=>t.transitionStatus),openMethod:ge(t=>t.openMethod),activeIndex:ge(t=>t.activeIndex),selectedIndex:ge(t=>t.selectedIndex),isActive:ge((t,e)=>t.activeIndex===e),isSelected:ge((t,e,n)=>{const r=t.isItemEqualToValue,o=t.value;return t.multiple?Array.isArray(o)&&o.some(s=>pi(n,s,r)):t.selectedIndex===e&&t.selectedIndex!==null?!0:pi(n,o,r)}),isSelectedByFocus:ge((t,e)=>t.selectedIndex===e),popupProps:ge(t=>t.popupProps),triggerProps:ge(t=>t.triggerProps),triggerElement:ge(t=>t.triggerElement),positionerElement:ge(t=>t.positionerElement),listElement:ge(t=>t.listElement),scrollUpArrowVisible:ge(t=>t.scrollUpArrowVisible),scrollDownArrowVisible:ge(t=>t.scrollDownArrowVisible),hasScrollArrows:ge(t=>t.hasScrollArrows)},GA=S.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:dn,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function tm(){return S.useContext(GA)}function JA(t,e){return{...t,state:{...t.state,valid:!e&&t.state.valid}}}function nm(t){const{enabled:e=!0,value:n,id:r,name:o,controlRef:s,commit:i}=t,{formRef:a}=tm(),{invalid:l,markedDirtyRef:c,validityData:u,setValidityData:d}=Pi(),f=de(t.getValue);me(()=>{if(!e)return;let h=n;h===void 0&&(h=f()),u.initialValue===null&&h!==null&&d(p=>({...p,initialValue:h}))},[e,d,n,u.initialValue,f]),me(()=>{!e||!r||a.current.fields.set(r,{getValue:f,name:o,controlRef:s,validityData:JA(u,l),validate(h=!0){let p=n;p===void 0&&(p=f()),c.current=!0,h?lr.flushSync(()=>i(p)):i(p)}})},[i,s,e,a,f,r,l,c,o,u,n]),me(()=>{const h=a.current.fields;return()=>{r&&h.delete(r)}},[a,r])}function Gx(t,e){const n=S.useRef(t),r=de(e);me(()=>{n.current!==t&&r(n.current)},[t,r]),me(()=>{n.current=t},[t])}function XA(t){const{id:e,value:n,defaultValue:r=null,onValueChange:o,open:s,defaultOpen:i=!1,onOpenChange:a,name:l,autoComplete:c,disabled:u=!1,readOnly:d=!1,required:f=!1,modal:h=!0,actionsRef:p,inputRef:g,onOpenChangeComplete:m,items:y,multiple:b=!1,itemToStringLabel:w,itemToStringValue:k,isItemEqualToValue:v=WA,highlightItemOnHover:x=!0,children:E}=t,{clearErrors:C}=tm(),{setDirty:A,setTouched:z,setFocused:R,shouldValidateOnChange:_,validityData:N,setFilled:L,name:H,disabled:Z,validation:W,validationMode:q}=Pi(),V=hd({id:e}),D=Z||u,j=H??l,[B,F]=Ta({controlled:n,default:b?r??ka:r,name:"Select",state:"value"}),[T,$]=Ta({controlled:s,default:i,name:"Select",state:"open"}),I=S.useRef([]),Y=S.useRef([]),G=S.useRef(null),X=S.useRef(null),se=S.useRef(0),O=S.useRef(null),P=S.useRef([]),U=S.useRef(!1),K=S.useRef(!1),J=S.useRef(null),ee=S.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),ie=S.useRef(!1),{mounted:oe,setMounted:ne,transitionStatus:le}=qa(T),{openMethod:Q,triggerProps:fe,reset:ye}=Xp(T),he=on(()=>new zk({id:V,modal:h,multiple:b,itemToStringLabel:w,itemToStringValue:k,isItemEqualToValue:v,value:B,open:T,mounted:oe,transitionStatus:le,items:y,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Ue=Re(he,Te.activeIndex),Ze=Re(he,Te.selectedIndex),ft=Re(he,Te.triggerElement),Ve=Re(he,Te.positionerElement),ze=S.useMemo(()=>b&&Array.isArray(B)&&B.length===0?"":Ls(B,k),[b,B,k]),Ye=S.useMemo(()=>b&&Array.isArray(B)?B.map(Ae=>Ls(Ae,k)):Ls(B,k),[b,B,k]),Ge=Dt(he.state.triggerElement);nm({id:V,commit:W.commit,value:B,controlRef:Ge,name:j,getValue:()=>Ye});const Ln=S.useRef(B);me(()=>{B!==Ln.current&&he.set("forceMount",!0)},[he,B]),me(()=>{L(b?Array.isArray(B)&&B.length>0:B!=null)},[b,B,L]),me(function(){if(T)return;const ut=P.current;if(b){const cn=Array.isArray(B)?B:[];if(cn.length===0){he.set("selectedIndex",null);return}const Nt=cn[cn.length-1],Os=la(ut,Nt,v);he.set("selectedIndex",Os===-1?null:Os);return}const ln=la(ut,B,v);he.set("selectedIndex",ln===-1?null:ln)},[b,T,B,P,v,he]),Gx(B,()=>{C(j),A(B!==N.initialValue),_()?W.commit(B):W.commit(B,!0)});const Gn=de((Ae,ut)=>{if(a?.(Ae,ut),!ut.isCanceled&&($(Ae),!Ae&&(ut.reason===is||ut.reason===kp)&&(z(!0),R(!1),q==="onBlur"&&W.commit(B)),!Ae&&he.state.activeIndex!==null)){const ln=I.current[he.state.activeIndex];queueMicrotask(()=>{ln?.setAttribute("tabindex","-1")})}}),jn=de(()=>{ne(!1),he.set("activeIndex",null),ye(),m?.(!1)});Co({enabled:!p,open:T,ref:G,onComplete(){T||jn()}}),S.useImperativeHandle(p,()=>({unmount:jn}),[jn]);const Mn=de((Ae,ut)=>{o?.(Ae,ut),!ut.isCanceled&&F(Ae)}),Xt=de(()=>{const Ae=he.state.listElement||G.current;if(!Ae)return;const ut=Ae.scrollTop,ln=Ae.scrollTop+Ae.clientHeight,cn=ut>1,Nt=ln<Ae.scrollHeight-1;he.state.scrollUpArrowVisible!==cn&&he.set("scrollUpArrowVisible",cn),he.state.scrollDownArrowVisible!==Nt&&he.set("scrollDownArrowVisible",Nt)}),He=Hk({open:T,onOpenChange:Gn,elements:{reference:ft,floating:Ve}}),kt=Tk(He,{enabled:!d&&!D,event:"mousedown"}),ke=Mp(He,{bubbles:!1}),Ee=VO(He,{enabled:!d&&!D,listRef:I,activeIndex:Ue,selectedIndex:Ze,disabledIndices:ka,onNavigate(Ae){Ae===null&&!T||he.set("activeIndex",Ae)},focusItemOnHover:!1}),we=WO(He,{enabled:!d&&!D&&(T||!b),listRef:Y,activeIndex:Ue,selectedIndex:Ze,onMatch(Ae){T?he.set("activeIndex",Ae):Mn(P.current[Ae],De("none"))},onTypingChange(Ae){U.current=Ae}}),{getReferenceProps:Ne,getFloatingProps:ct,getItemProps:Pe}=ld([kt,ke,Ee,we]),Jn=S.useMemo(()=>Oi(Ne(),fe,V?{id:V}:At),[Ne,fe,V]);Lw(()=>{he.update({popupProps:ct(),triggerProps:Jn})}),me(()=>{he.update({id:V,modal:h,multiple:b,value:B,open:T,mounted:oe,transitionStatus:le,popupProps:ct(),triggerProps:Jn,items:y,itemToStringLabel:w,itemToStringValue:k,isItemEqualToValue:v,openMethod:Q})},[he,V,h,b,B,T,oe,le,ct,Jn,y,w,k,v,Q]);const Fr=S.useMemo(()=>({store:he,name:j,required:f,disabled:D,readOnly:d,multiple:b,itemToStringLabel:w,itemToStringValue:k,highlightItemOnHover:x,setValue:Mn,setOpen:Gn,listRef:I,popupRef:G,scrollHandlerRef:X,handleScrollArrowVisibility:Xt,scrollArrowsMountedCountRef:se,getItemProps:Pe,events:He.context.events,valueRef:O,valuesRef:P,labelsRef:Y,typingRef:U,selectionRef:ee,selectedItemTextRef:J,validation:W,onOpenChangeComplete:m,keyboardActiveRef:K,alignItemWithTriggerActiveRef:ie,initialValueRef:Ln}),[he,j,f,D,d,b,w,k,x,Mn,Gn,Pe,He.context.events,W,m,Xt]),Br=zr(g,W.inputRef),mr=b&&Array.isArray(B)&&B.length>0,gr=S.useMemo(()=>!b||!Array.isArray(B)||!j?null:B.map(Ae=>{const ut=Ls(Ae,k);return M.jsx("input",{type:"hidden",name:j,value:ut},ut)}),[b,B,j,k]);return M.jsx(qx.Provider,{value:Fr,children:M.jsxs(Ux.Provider,{value:He,children:[E,M.jsx("input",{...W.getInputValidationProps({onFocus(){he.state.triggerElement?.focus({focusVisible:!0})},onChange(Ae){if(Ae.nativeEvent.defaultPrevented)return;const ut=Ae.target.value,ln=De(po,Ae.nativeEvent);function cn(){if(b)return;const Nt=P.current.find(Os=>Ls(Os,k).toLowerCase()===ut.toLowerCase());Nt!=null&&(A(Nt!==N.initialValue),Mn(Nt,ln),_()&&W.commit(Nt))}he.set("forceMount",!0),queueMicrotask(cn)}}),name:b?void 0:j,autoComplete:c,value:ze,disabled:D,required:f&&!mr,readOnly:d,ref:Br,style:j?wk:od,tabIndex:-1,"aria-hidden":!0}),gr]})})}function QA(t){const e=t.getBoundingClientRect(),n=window.getComputedStyle(t,"::before"),r=window.getComputedStyle(t,"::after");if(!(n.content!=="none"||r.content!=="none"))return e;const s=parseFloat(n.width)||0,i=parseFloat(n.height)||0,a=parseFloat(r.width)||0,l=parseFloat(r.height)||0,c=Math.max(e.width,s,a),u=Math.max(e.height,i,l),d=c-e.width,f=u-e.height;return{left:e.left-d/2,right:e.right+d/2,top:e.top-f/2,bottom:e.bottom+f/2}}const bl=2,eI=400,zy=200,tI={...Yk,...em,value:()=>null},nI=S.forwardRef(function(e,n){const{render:r,className:o,id:s,disabled:i=!1,nativeButton:a=!0,...l}=e,{setTouched:c,setFocused:u,validationMode:d,state:f,disabled:h}=Pi(),{labelId:p}=fd(),{store:g,setOpen:m,selectionRef:y,validation:b,readOnly:w,required:k,alignItemWithTriggerActiveRef:v,disabled:x,keyboardActiveRef:E}=fr(),C=h||x||i,A=Re(g,Te.open),z=Re(g,Te.value),R=Re(g,Te.triggerProps),_=Re(g,Te.positionerElement),N=Re(g,Te.listElement),L=Re(g,Te.id),H=Re(g,Te.hasSelectedValue),Z=!H&&A,W=Re(g,Te.hasNullItemLabel,Z),q=s??L;hd({id:q});const V=Dt(_),D=S.useRef(null),{getButtonProps:j,buttonRef:B}=ws({disabled:C,native:a}),F=de(P=>{g.set("triggerElement",P)}),T=zr(n,D,B,F),$=Sn(),I=Sn(),Y=Sn(),G=Sn();S.useEffect(()=>{if(A)return!(H||W)?Y.start(eI,()=>{y.current.allowUnselectedMouseUp=!0,y.current.allowSelectedMouseUp=!0}):G.start(zy,()=>{y.current.allowUnselectedMouseUp=!0,Y.start(zy,()=>{y.current.allowSelectedMouseUp=!0})}),()=>{Y.clear(),G.clear()};y.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},I.clear()},[A,H,W,y,I,Y,G]);const X=S.useMemo(()=>N?.id??wa(_)?.id,[N,_]),se=Oi(R,{id:q,role:"combobox","aria-expanded":A?"true":"false","aria-haspopup":"listbox","aria-controls":A?X:void 0,"aria-labelledby":p,"aria-readonly":w||void 0,"aria-required":k||void 0,tabIndex:C?-1:0,ref:T,onFocus(P){u(!0),A&&v.current&&m(!1,De(po,P.nativeEvent)),$.start(0,()=>{g.set("forceMount",!0)})},onBlur(P){Fe(_,P.relatedTarget)||(c(!0),u(!1),d==="onBlur"&&b.commit(z))},onPointerMove(){E.current=!1},onKeyDown(){E.current=!0},onMouseDown(P){if(A)return;const U=Ke(P.currentTarget);function K(J){if(!D.current)return;const ee=J.target;if(Fe(D.current,ee)||Fe(V.current,ee)||ee===D.current)return;const ie=QA(D.current);J.clientX>=ie.left-bl&&J.clientX<=ie.right+bl&&J.clientY>=ie.top-bl&&J.clientY<=ie.bottom+bl||m(!1,De(VM,J))}I.start(0,()=>{U.addEventListener("mouseup",K,{once:!0})})}},b.getValidationProps,l,j);se.role="combobox";const O={...f,open:A,disabled:C,value:z,readOnly:w,placeholder:!H};return rt("button",e,{ref:[n,D],state:O,stateAttributesMapping:tI,props:se})}),rI={value:()=>null},oI=S.forwardRef(function(e,n){const{className:r,render:o,children:s,placeholder:i,...a}=e,{store:l,valueRef:c}=fr(),u=Re(l,Te.value),d=Re(l,Te.items),f=Re(l,Te.itemToStringLabel),h=Re(l,Te.hasSelectedValue),p=!h&&i!=null&&s==null,g=Re(l,Te.hasNullItemLabel,p),m={value:u,placeholder:!h};let y=null;return typeof s=="function"?y=s(u):s!=null?y=s:!h&&i!=null&&!g?y=i:Array.isArray(u)?y=ZA(u,d,f):y=Zx(u,d,f),rt("span",e,{state:m,ref:[n,c],props:[{children:y},a],stateAttributesMapping:rI})}),sI=S.forwardRef(function(e,n){const{className:r,render:o,...s}=e,{store:i}=fr(),l={open:Re(i,Te.open)};return rt("span",e,{state:l,ref:n,props:[{"aria-hidden":!0,children:"▼"},s],stateAttributesMapping:Kk})}),iI=S.createContext(void 0),aI=S.forwardRef(function(e,n){const{store:r}=fr(),o=Re(r,Te.mounted),s=Re(r,Te.forceMount);return o||s?M.jsx(iI.Provider,{value:!0,children:M.jsx(Sp,{ref:n,...e})}):null}),Jx=S.createContext(void 0);function rm(){const t=S.useContext(Jx);if(!t)throw new Error(Zt(59));return t}function qc(t,e){t&&Object.assign(t.style,e)}const Xx={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},lI={position:"fixed"},cI=S.forwardRef(function(e,n){const{anchor:r,positionMethod:o="absolute",className:s,render:i,side:a="bottom",align:l="center",sideOffset:c=0,alignOffset:u=0,collisionBoundary:d="clipping-ancestors",collisionPadding:f,arrowPadding:h=5,sticky:p=!1,disableAnchorTracking:g,alignItemWithTrigger:m=!0,collisionAvoidance:y=LM,...b}=e,{store:w,listRef:k,labelsRef:v,alignItemWithTriggerActiveRef:x,selectedItemTextRef:E,valuesRef:C,initialValueRef:A,popupRef:z,setValue:R}=fr(),_=Kx(),N=Re(w,Te.open),L=Re(w,Te.mounted),H=Re(w,Te.modal),Z=Re(w,Te.value),W=Re(w,Te.openMethod),q=Re(w,Te.positionerElement),V=Re(w,Te.triggerElement),D=Re(w,Te.isItemEqualToValue),j=Re(w,Te.transitionStatus),B=S.useRef(null),F=S.useRef(null),[T,$]=S.useState(m),I=L&&T&&W!=="touch";!L&&T!==m&&$(m),me(()=>{L||(Te.scrollUpArrowVisible(w.state)&&w.set("scrollUpArrowVisible",!1),Te.scrollDownArrowVisible(w.state)&&w.set("scrollDownArrowVisible",!1))},[w,L]),S.useImperativeHandle(x,()=>I),Jp((I||H)&&N&&W!=="touch",V);const Y=Gk({anchor:r,floatingRootContext:_,positionMethod:o,mounted:L,side:a,sideOffset:c,align:l,alignOffset:u,arrowPadding:h,collisionBoundary:d,collisionPadding:f,sticky:p,disableAnchorTracking:g??I,collisionAvoidance:y,keepMounted:!0}),G=I?"none":Y.side,X=I?lI:Y.positionerStyles,se=S.useMemo(()=>{const ie={};return N||(ie.pointerEvents="none"),{role:"presentation",hidden:!L,style:{...X,...ie}}},[N,L,X]),O={open:N,side:G,align:Y.align,anchorHidden:Y.anchorHidden},P=de(ie=>{w.set("positionerElement",ie)}),U=rt("div",e,{ref:[n,P],state:O,stateAttributesMapping:Ni,props:[se,ud(j),b]}),K=S.useRef(0),J=de(ie=>{if(ie.size===0&&K.current===0||C.current.length===0)return;const oe=K.current;if(K.current=ie.size,ie.size===oe)return;const ne=De(po);if(oe!==0&&!w.state.multiple&&Z!==null&&la(C.current,Z,D)===-1){const Q=A.current,ye=Q!=null&&la(C.current,Q,D)!==-1?Q:null;R(ye,ne),ye===null&&(w.set("selectedIndex",null),E.current=null)}if(oe!==0&&w.state.multiple&&Array.isArray(Z)){const le=fe=>la(C.current,fe,D)!==-1,Q=Z.filter(fe=>le(fe));(Q.length!==Z.length||Q.some(fe=>!qA(Z,fe,D)))&&(R(Q,ne),Q.length===0&&(w.set("selectedIndex",null),E.current=null))}if(N&&I){w.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const le={height:""};qc(q,le),qc(z.current,le)}}),ee=S.useMemo(()=>({...Y,side:G,alignItemWithTriggerActive:I,setControlledAlignItemWithTrigger:$,scrollUpArrowRef:B,scrollDownArrowRef:F}),[Y,G,I,$]);return M.jsx(Up,{elementsRef:k,labelsRef:v,onMapChange:J,children:M.jsxs(Jx.Provider,{value:ee,children:[L&&H&&M.jsx(Qp,{inert:dd(!N),cutout:V}),U]})})});function Qx(t){const e=t.currentTarget.getBoundingClientRect();return e.top+1<=t.clientY&&t.clientY<=e.bottom-1&&e.left+1<=t.clientX&&t.clientX<=e.right-1}const vl="base-ui-disable-scrollbar",kh={className:vl,getElement(t){return M.jsx("style",{nonce:t,href:vl,precedence:"base-ui:low",children:`.${vl}{scrollbar-width:none}.${vl}::-webkit-scrollbar{display:none}`})}},uI=S.createContext(void 0);function e1(t){return S.useContext(uI)}function rf(t,e=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(e,Math.min(t,n))}const zo=1,dI={...Ni,..._i},fI=S.forwardRef(function(e,n){const{render:r,className:o,finalFocus:s,...i}=e,{store:a,popupRef:l,onOpenChangeComplete:c,setOpen:u,valueRef:d,selectedItemTextRef:f,keyboardActiveRef:h,multiple:p,handleScrollArrowVisibility:g,scrollHandlerRef:m,highlightItemOnHover:y}=fr(),{side:b,align:w,alignItemWithTriggerActive:k,setControlledAlignItemWithTrigger:v,scrollDownArrowRef:x,scrollUpArrowRef:E}=rm(),C=e1()!=null,A=Kx(),{nonce:z,disableStyleElements:R}=jP(),_=Sn(),N=Re(a,Te.id),L=Re(a,Te.open),H=Re(a,Te.mounted),Z=Re(a,Te.popupProps),W=Re(a,Te.transitionStatus),q=Re(a,Te.triggerElement),V=Re(a,Te.positionerElement),D=Re(a,Te.listElement),j=S.useRef(0),B=S.useRef(!1),F=S.useRef(0),T=S.useRef(!1),$=S.useRef({}),I=sd(),Y=de(O=>{if(!V||!l.current||!T.current)return;if(B.current||!k){g();return}const P=V.style.top==="0px",U=V.style.bottom==="0px",K=V.getBoundingClientRect().height,J=Ke(V),ee=getComputedStyle(V),ie=parseFloat(ee.marginTop),oe=parseFloat(ee.marginBottom),ne=Ly(getComputedStyle(l.current)),le=Math.min(J.documentElement.clientHeight-ie-oe,ne),Q=O.scrollTop,fe=jy(O);let ye=0,he=null,Ue=!1,Ze=!1;const ft=ze=>{V.style.height=`${ze}px`},Ve=(ze,Ye)=>{const Ge=rf(ze,0,le-K);Ge>0&&ft(K+Ge),O.scrollTop=Ye,le-(K+Ge)<=zo&&(B.current=!0),g()};if(P){const ze=fe-Q,Ye=K+ze,Ge=Math.min(Ye,le);if(ye=Ge,ze<=zo){Ve(ze,fe);return}le-Ge>zo?Ze=!0:Ue=!0}else if(U){const ze=Q,Ye=K+ze,Ge=Math.min(Ye,le),Ln=Ye-le;if(ye=Ge,ze<=zo){Ve(ze,0);return}le-Ge>zo?he=0:(Ue=!0,Q<fe&&(he=Q-(ze-Ln)))}if(ye=Math.ceil(ye),ye!==0&&ft(ye),Ze||he!=null){const ze=jy(O),Ye=Ze?ze:rf(he,0,ze);Math.abs(O.scrollTop-Ye)>zo&&(O.scrollTop=Ye)}(Ue||ye>=le-zo)&&(B.current=!0),g()});S.useImperativeHandle(m,()=>Y,[Y]),Co({open:L,ref:l,onComplete(){L&&c?.(!0)}});const G={open:L,transitionStatus:W,side:b,align:w};me(()=>{!V||!l.current||Object.keys($.current).length||($.current={top:V.style.top||"0",left:V.style.left||"0",right:V.style.right,height:V.style.height,bottom:V.style.bottom,minHeight:V.style.minHeight,maxHeight:V.style.maxHeight,marginTop:V.style.marginTop,marginBottom:V.style.marginBottom})},[l,V]),me(()=>{L||k||(T.current=!1,B.current=!1,j.current=0,F.current=0,qc(V,$.current))},[L,k,V,l]),me(()=>{const O=l.current;if(!(!L||!q||!V||!O||a.state.transitionStatus==="ending")){if(!k){T.current=!0,I.request(g),O.style.removeProperty("--transform-origin");return}queueMicrotask(()=>{const P=hI(O);O.style.removeProperty("--transform-origin");try{const U=getComputedStyle(V),K=getComputedStyle(O),J=Ke(q),ee=Mt(V),ie=q.getBoundingClientRect(),oe=V.getBoundingClientRect(),ne=ie.left,le=ie.height,Q=D||O,fe=Q.scrollHeight,ye=parseFloat(K.borderBottomWidth),he=parseFloat(U.marginTop)||10,Ue=parseFloat(U.marginBottom)||10,Ze=parseFloat(U.minHeight)||100,ft=Ly(K),Ve=5,ze=5,Ye=20,Ge=J.documentElement.clientHeight-he-Ue,Ln=J.documentElement.clientWidth,Gn=Ge-ie.bottom+le,jn=f.current,Mn=d.current;let Xt,He=0,kt=0;if(jn&&Mn){const Ae=Mn.getBoundingClientRect();Xt=jn.getBoundingClientRect();const ut=Ae.left-ne,ln=Xt.left-oe.left,cn=Ae.top-ie.top+Ae.height/2,Nt=Xt.top-oe.top+Xt.height/2;He=ut-ln,kt=Nt-cn}const ke=Gn+kt+Ue+ye;let Ee=Math.min(Ge,ke);const we=Ge-he-Ue,Ne=ke-Ee,ct=Math.max(Ve,ne+He),Pe=Ln-ze,Jn=Math.max(0,ct+oe.width-Pe);V.style.left=`${ct-Jn}px`,V.style.height=`${Ee}px`,V.style.maxHeight="auto",V.style.marginTop=`${he}px`,V.style.marginBottom=`${Ue}px`,O.style.height="100%";const Fr=Q.scrollHeight-Q.clientHeight,Br=Ne>=Fr;Br&&(Ee=Math.min(Ge,oe.height)-(Ne-Fr));const mr=ie.top<Ye||ie.bottom>Ge-Ye||Ee<Math.min(fe,Ze),gr=(ee.visualViewport?.scale??1)!==1&&pp;if(mr||gr){T.current=!0,qc(V,$.current),lr.flushSync(()=>v(!1));return}if(Br){const Ae=Math.max(0,Ge-ke);V.style.top=oe.height>=we?"0":`${Ae}px`,V.style.height=`${Ee}px`,Q.scrollTop=Q.scrollHeight-Q.clientHeight,j.current=Math.max(Ze,Ee)}else V.style.bottom="0",j.current=Math.max(Ze,Ee),Q.scrollTop=Ne;if(Xt){const Ae=oe.top,ut=oe.height,ln=Xt.top+Xt.height/2,cn=ut>0?(ln-Ae)/ut*100:50,Nt=rf(cn,0,100);O.style.setProperty("--transform-origin",`50% ${Nt}%`)}(j.current===Ge||Ee>=ft)&&(B.current=!0),g(),setTimeout(()=>{T.current=!0})}finally{P()}})}},[a,L,V,q,d,f,l,g,k,v,I,x,E,D]),S.useEffect(()=>{if(!k||!V||!L)return;const O=Mt(V);function P(U){u(!1,De(HM,U))}return O.addEventListener("resize",P),()=>{O.removeEventListener("resize",P)}},[u,k,V,L]);const X={...D?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":p||void 0,id:`${N}-list`},onKeyDown(O){h.current=!0,C&&Gp.has(O.key)&&O.stopPropagation()},onMouseMove(){h.current=!1},onPointerLeave(O){if(!y||Qx(O)||O.pointerType==="touch")return;const P=O.currentTarget;_.start(0,()=>{a.set("activeIndex",null),P.focus({preventScroll:!0})})},onScroll(O){D||Y(O.currentTarget)},...k&&{style:D?{height:"100%"}:Xx}},se=rt("div",e,{ref:[n,l],state:G,stateAttributesMapping:dI,props:[Z,X,ud(W),{className:!D&&k?kh.className:void 0},i]});return M.jsxs(S.Fragment,{children:[!R&&kh.getElement(z),M.jsx(Cp,{context:A,modal:!1,disabled:!H,returnFocus:s,restoreFocus:!0,children:se})]})});function Ly(t){const e=t.maxHeight||"";return e.endsWith("px")&&parseFloat(e)||1/0}function jy(t){return Math.max(0,t.scrollHeight-t.clientHeight)}const Fy=[["transform","none"],["scale","1"],["translate","0 0"]];function hI(t){const{style:e}=t,n={};for(const[r,o]of Fy)n[r]=e.getPropertyValue(r),e.setProperty(r,o,"important");return()=>{for(const[r]of Fy){const o=n[r];o?e.setProperty(r,o):e.removeProperty(r)}}}const pI=S.forwardRef(function(e,n){const{className:r,render:o,...s}=e,{store:i,scrollHandlerRef:a}=fr(),{alignItemWithTriggerActive:l}=rm(),c=Re(i,Te.hasScrollArrows),u=Re(i,Te.openMethod),d=Re(i,Te.multiple),h={id:`${Re(i,Te.id)}-list`,role:"listbox","aria-multiselectable":d||void 0,onScroll(g){a.current?.(g.currentTarget)},...l&&{style:Xx},className:c&&u!=="touch"?kh.className:void 0},p=de(g=>{i.set("listElement",g)});return rt("div",e,{ref:[n,p],props:[h,s]})}),t1=S.createContext(void 0);function om(){const t=S.useContext(t1);if(!t)throw new Error(Zt(57));return t}const mI=S.memo(S.forwardRef(function(e,n){const{render:r,className:o,value:s=null,label:i,disabled:a=!1,nativeButton:l=!1,...c}=e,u=S.useRef(null),d=Zp({label:i,textRef:u,indexGuessBehavior:Dx.GuessFromOrder}),{store:f,getItemProps:h,setOpen:p,setValue:g,selectionRef:m,typingRef:y,valuesRef:b,keyboardActiveRef:w,multiple:k,highlightItemOnHover:v}=fr(),x=Sn(),E=Re(f,Te.isActive,d.index),C=Re(f,Te.isSelected,d.index,s),A=Re(f,Te.isSelectedByFocus,d.index),z=Re(f,Te.isItemEqualToValue),R=d.index,_=R!==-1,N=S.useRef(null),L=Dt(R);me(()=>{if(!_)return;const I=b.current;return I[R]=s,()=>{delete I[R]}},[_,R,s,b]),me(()=>{if(!_)return;const I=f.state.value;let Y=I;k&&Array.isArray(I)&&I.length>0&&(Y=I[I.length-1]),Y!==void 0&&pi(s,Y,z)&&f.set("selectedIndex",R)},[_,R,k,z,f,s]);const H={disabled:a,selected:C,highlighted:E},Z=h({active:E,selected:C});Z.onFocus=void 0,Z.id=void 0;const W=S.useRef(null),q=S.useRef("mouse"),V=S.useRef(!1),{getButtonProps:D,buttonRef:j}=ws({disabled:a,focusableWhenDisabled:!0,native:l});function B(I){const Y=f.state.value;if(k){const G=Array.isArray(Y)?Y:[],X=C?UA(G,s,z):[...G,s];g(X,De(qd,I))}else g(s,De(qd,I)),p(!1,De(qd,I))}const F={role:"option","aria-selected":C,tabIndex:E?0:-1,onFocus(){f.set("activeIndex",R)},onMouseEnter(){!w.current&&f.state.selectedIndex===null&&v&&f.set("activeIndex",R)},onMouseMove(){v&&f.set("activeIndex",R)},onMouseLeave(I){!v||w.current||Qx(I)||x.start(0,()=>{f.state.activeIndex===R&&f.set("activeIndex",null)})},onTouchStart(){m.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(I){W.current=I.key,f.set("activeIndex",R)},onClick(I){V.current=!1,!(I.type==="keydown"&&W.current===null)&&(a||W.current===" "&&y.current||q.current!=="touch"&&!E||(W.current=null,B(I.nativeEvent)))},onPointerEnter(I){q.current=I.pointerType},onPointerDown(I){q.current=I.pointerType,V.current=!0},onMouseUp(I){if(a)return;if(V.current){V.current=!1;return}const Y=!m.current.allowSelectedMouseUp&&C,G=!m.current.allowUnselectedMouseUp&&!C;Y||G||q.current!=="touch"&&!E||B(I.nativeEvent)}},T=rt("div",e,{ref:[j,n,d.ref,N],state:H,props:[Z,F,c,D]}),$=S.useMemo(()=>({selected:C,indexRef:L,textRef:u,selectedByFocus:A,hasRegistered:_}),[C,L,u,A,_]);return M.jsx(t1.Provider,{value:$,children:T})})),gI=S.forwardRef(function(e,n){const r=e.keepMounted??!1,{selected:o}=om();return r||o?M.jsx(yI,{...e,ref:n}):null}),yI=S.memo(S.forwardRef((t,e)=>{const{render:n,className:r,keepMounted:o,...s}=t,{selected:i}=om(),a=S.useRef(null),{transitionStatus:l,setMounted:c}=qa(i),d=rt("span",t,{ref:[e,a],state:{selected:i,transitionStatus:l},props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:_i});return Co({open:i,ref:a,onComplete(){i||c(!1)}}),d})),bI=S.memo(S.forwardRef(function(e,n){const{indexRef:r,textRef:o,selectedByFocus:s,hasRegistered:i}=om(),{selectedItemTextRef:a}=fr(),{className:l,render:c,...u}=e,d=S.useCallback(h=>{if(!h||!i)return;const p=a.current===null||!a.current.isConnected;(s||p&&r.current===0)&&(a.current=h)},[a,r,s,i]);return rt("div",e,{ref:[d,n,o],props:u})})),n1=S.forwardRef(function(e,n){const{render:r,className:o,direction:s,keepMounted:i=!1,...a}=e,{store:l,popupRef:c,listRef:u,handleScrollArrowVisibility:d,scrollArrowsMountedCountRef:f}=fr(),{side:h,scrollDownArrowRef:p,scrollUpArrowRef:g}=rm(),m=s==="up"?Te.scrollUpArrowVisible:Te.scrollDownArrowVisible,y=Re(l,m),b=Re(l,Te.openMethod),w=y&&b!=="touch",k=Sn(),v=s==="up"?g:p,{transitionStatus:x,setMounted:E}=qa(w);me(()=>(f.current+=1,l.state.hasScrollArrows||l.set("hasScrollArrows",!0),()=>{f.current=Math.max(0,f.current-1),f.current===0&&l.state.hasScrollArrows&&l.set("hasScrollArrows",!1)}),[l,f]),Co({open:w,ref:v,onComplete(){w||E(!1)}});const z=rt("div",e,{ref:[n,v],state:{direction:s,visible:w,side:h,transitionStatus:x},props:[{"aria-hidden":!0,children:s==="up"?"▲":"▼",style:{position:"absolute"},onMouseMove(_){if(_.movementX===0&&_.movementY===0||k.isStarted())return;l.set("activeIndex",null);function N(){const L=l.state.listElement??c.current;if(!L)return;l.set("activeIndex",null),d();const H=L.scrollTop===0,Z=Math.round(L.scrollTop+L.clientHeight)>=L.scrollHeight;if(u.current.length===0&&(s==="up"?l.set("scrollUpArrowVisible",!H):l.set("scrollDownArrowVisible",!Z)),s==="up"&&H||s==="down"&&Z){k.clear();return}if((l.state.listElement||c.current)&&u.current&&u.current.length>0){const q=u.current,V=v.current?.offsetHeight||0;if(s==="up"){let D=0;const j=L.scrollTop+V;for(let F=0;F<q.length;F+=1){const T=q[F];if(T&&T.offsetTop>=j){D=F;break}}const B=Math.max(0,D-1);if(B<D){const F=q[B];F&&(L.scrollTop=Math.max(0,F.offsetTop-V))}else L.scrollTop=0}else{let D=q.length-1;const j=L.scrollTop+L.clientHeight-V;for(let F=0;F<q.length;F+=1){const T=q[F];if(T&&T.offsetTop+T.offsetHeight>j){D=Math.max(0,F-1);break}}const B=Math.min(q.length-1,D+1);if(B>D){const F=q[B];F&&(L.scrollTop=F.offsetTop+F.offsetHeight-L.clientHeight+V)}else L.scrollTop=L.scrollHeight-L.clientHeight}}k.start(40,N)}k.start(40,N)},onMouseLeave(){k.clear()}},a]});return w||i?z:null}),vI=S.forwardRef(function(e,n){return M.jsx(n1,{...e,ref:n,direction:"down"})}),wI=S.forwardRef(function(e,n){return M.jsx(n1,{...e,ref:n,direction:"up"})}),kI=S.createContext(void 0),xI=S.forwardRef(function(e,n){const{className:r,render:o,...s}=e,[i,a]=S.useState(),l=S.useMemo(()=>({labelId:i,setLabelId:a}),[i,a]),c=rt("div",e,{ref:n,props:[{role:"group","aria-labelledby":i},s]});return M.jsx(kI.Provider,{value:l,children:c})}),Uc=XA;function Kc(t){const e=Me.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let o;e[3]!==n?(o=ue("scroll-my-1 p-1",n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=M.jsx(xI,{"data-slot":"select-group",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function Yc(t){const e=Me.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let o;e[3]!==n?(o=ue("flex flex-1 text-left",n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=M.jsx(oI,{"data-slot":"select-value",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function Zc(t){const e=Me.c(13);let n,r,o,s;e[0]!==t?({className:r,size:s,children:n,...o}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=s):(n=e[1],r=e[2],o=e[3],s=e[4]);const i=s===void 0?"default":s;let a;e[5]!==r?(a=ue("border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 flex w-fit items-center justify-between gap-1.5 rounded-lg border bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",r),e[5]=r,e[6]=a):a=e[6];let l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=M.jsx(sI,{render:M.jsx($p,{className:"text-muted-foreground pointer-events-none size-4"})}),e[7]=l):l=e[7];let c;return e[8]!==n||e[9]!==o||e[10]!==i||e[11]!==a?(c=M.jsxs(nI,{"data-slot":"select-trigger","data-size":i,className:a,...o,children:[n,l]}),e[8]=n,e[9]=o,e[10]=i,e[11]=a,e[12]=c):c=e[12],c}function Gc(t){const e=Me.c(27);let n,r,o,s,i,a,l,c;e[0]!==t?({className:r,children:n,side:s,sideOffset:i,align:a,alignOffset:l,alignItemWithTrigger:c,...o}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=s,e[5]=i,e[6]=a,e[7]=l,e[8]=c):(n=e[1],r=e[2],o=e[3],s=e[4],i=e[5],a=e[6],l=e[7],c=e[8]);const u=s===void 0?"bottom":s,d=i===void 0?4:i,f=a===void 0?"center":a,h=l===void 0?0:l,p=c===void 0?!0:c;let g;e[9]!==r?(g=ue("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg shadow-md ring-1 duration-100 data-[align-trigger=true]:animate-none",r),e[9]=r,e[10]=g):g=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=M.jsx(SI,{}),e[11]=m):m=e[11];let y;e[12]!==n?(y=M.jsx(pI,{children:n}),e[12]=n,e[13]=y):y=e[13];let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=M.jsx(EI,{}),e[14]=b):b=e[14];let w;e[15]!==p||e[16]!==o||e[17]!==g||e[18]!==y?(w=M.jsxs(fI,{"data-slot":"select-content","data-align-trigger":p,className:g,...o,children:[m,y,b]}),e[15]=p,e[16]=o,e[17]=g,e[18]=y,e[19]=w):w=e[19];let k;return e[20]!==f||e[21]!==p||e[22]!==h||e[23]!==u||e[24]!==d||e[25]!==w?(k=M.jsx(aI,{children:M.jsx(cI,{side:u,sideOffset:d,align:f,alignOffset:h,alignItemWithTrigger:p,className:"isolate z-50",children:w})}),e[20]=f,e[21]=p,e[22]=h,e[23]=u,e[24]=d,e[25]=w,e[26]=k):k=e[26],k}function pd(t){const e=Me.c(13);let n,r,o;e[0]!==t?({className:r,children:n,...o}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o):(n=e[1],r=e[2],o=e[3]);let s;e[4]!==r?(s=ue("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",r),e[4]=r,e[5]=s):s=e[5];let i;e[6]!==n?(i=M.jsx(bI,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:n}),e[6]=n,e[7]=i):i=e[7];let a;e[8]===Symbol.for("react.memo_cache_sentinel")?(a=M.jsx(gI,{render:M.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:M.jsx(Z_,{className:"pointer-events-none"})}),e[8]=a):a=e[8];let l;return e[9]!==o||e[10]!==s||e[11]!==i?(l=M.jsxs(mI,{"data-slot":"select-item",className:s,...o,children:[i,a]}),e[9]=o,e[10]=s,e[11]=i,e[12]=l):l=e[12],l}function SI(t){const e=Me.c(9);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let o;e[3]!==n?(o=ue("bg-popover top-0 z-10 flex w-full cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",n),e[3]=n,e[4]=o):o=e[4];let s;e[5]===Symbol.for("react.memo_cache_sentinel")?(s=M.jsx(nN,{}),e[5]=s):s=e[5];let i;return e[6]!==r||e[7]!==o?(i=M.jsx(wI,{"data-slot":"select-scroll-up-button",className:o,...r,children:s}),e[6]=r,e[7]=o,e[8]=i):i=e[8],i}function EI(t){const e=Me.c(9);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let o;e[3]!==n?(o=ue("bg-popover bottom-0 z-10 flex w-full cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",n),e[3]=n,e[4]=o):o=e[4];let s;e[5]===Symbol.for("react.memo_cache_sentinel")?(s=M.jsx($p,{}),e[5]=s):s=e[5];let i;return e[6]!==r||e[7]!==o?(i=M.jsx(vI,{"data-slot":"select-scroll-down-button",className:o,...r,children:s}),e[6]=r,e[7]=o,e[8]=i):i=e[8],i}function CI(t){const n=t.replaceAll("\\","/").split("/");return n[n.length-1]??t}function TI(t){return t.replace(/\.[^.]+$/,"")}function ni(t){const e=t.data.title;if(typeof e=="string"&&e.trim().length>0)return e.trim();const n=CI(t.filePath||t.id);return TI(n)}function sm(t){return t?[...t.files].sort((e,n)=>{const r=ni(e).localeCompare(ni(n),void 0,{sensitivity:"base"});return r!==0?r:e.id.localeCompare(n.id,void 0,{sensitivity:"base"})}):[]}function of(t,e){return t.collection===e.collection&&t.file===e.file}function MI(t,e){if(t.length===0)return{selectedCollection:void 0,selectedFile:void 0,normalizedSearch:{}};const r=t.find(l=>l.name===e.collection)??t[0],o=sm(r),s=o.find(l=>l.id===e.file),i=o.at(0),a=s??i;return{selectedCollection:r,selectedFile:a,normalizedSearch:{collection:r.name,file:a?a.id:void 0}}}function RI(t){const e=Me.c(62),{collections:n,selectedCollectionName:r,selectedFileId:o,onSelectCollection:s,onSelectFile:i,onCreateFile:a,onDeleteFile:l,isCreatingFile:c,deletingFileId:u}=t,[d,f]=S.useState(null);let h,p,g,m,y;if(e[0]!==n||e[1]!==u||e[2]!==s||e[3]!==i||e[4]!==r||e[5]!==o){let j;e[11]!==r?(j=Y=>Y.name===r,e[11]=r,e[12]=j):j=e[12],h=n.find(j);const B=sm(h);m="flex h-full flex-col gap-3";let F;e[13]!==s?(F=Y=>{Y&&s(Y)},e[13]=s,e[14]=F):F=e[14];let T;e[15]===Symbol.for("react.memo_cache_sentinel")?(T=M.jsx(Zc,{className:"bg-muted/50 focus-visible:ring-ring/35 w-full border-transparent shadow-none focus-visible:border-transparent focus-visible:ring-2",children:M.jsx(Yc,{placeholder:"Select a collection"})}),e[15]=T):T=e[15];let $;e[16]!==n?($=n.map(OI),e[16]=n,e[17]=$):$=e[17];let I;e[18]!==$?(I=M.jsx(Gc,{children:M.jsx(Kc,{children:$})}),e[18]=$,e[19]=I):I=e[19],e[20]!==r||e[21]!==F||e[22]!==I?(y=M.jsxs(Uc,{value:r,onValueChange:F,children:[T,I]}),e[20]=r,e[21]=F,e[22]=I,e[23]=y):y=e[23],p="bg-background/35 min-h-0 flex-1 overflow-auto rounded-md p-1",g=B.length===0?M.jsx("p",{className:"text-muted-foreground px-2 py-2 text-sm",children:"No files in this collection."}):M.jsx("div",{className:"space-y-0.5",children:B.map(Y=>{const G=Y.id===o,X=ni(Y),se=Y.id,O=/\.mdx$/i.test(Y.filePath),P=Y.data.draft===!0,U=u===Y.id;return M.jsxs("div",{className:"group/item relative",children:[M.jsx(pn,{type:"button",variant:"ghost",className:ue("h-auto w-full justify-start border-0 px-2.5 py-3 pr-9 text-left shadow-none","hover:bg-background/70",G&&"bg-muted text-foreground hover:bg-muted/55"),onClick:()=>i(Y.id),title:Y.filePath,children:M.jsxs("span",{className:"flex w-full min-w-0 flex-col items-start gap-0.5",children:[M.jsx("span",{className:"w-full truncate text-sm font-normal",children:X}),M.jsxs("span",{className:"flex w-full min-w-0 items-center gap-1.5",children:[M.jsx("span",{className:"text-muted-foreground min-w-0 flex-1 truncate text-xs",children:se}),O?M.jsx(Wc,{variant:"secondary",className:"bg-muted h-4 border-transparent px-1.5 text-[10px] leading-none",children:"MDX"}):null,P?M.jsx(Wc,{variant:"outline",className:"h-4 border-transparent bg-amber-100 px-1.5 text-[10px] leading-none text-amber-900 dark:bg-amber-900/40 dark:text-amber-200",children:"Draft"}):null]})]})}),M.jsx(pn,{type:"button",size:"icon",variant:"ghost",className:ue("absolute top-2 right-1.5 size-7 border-0 opacity-0 transition-opacity","group-hover/item:opacity-100 focus-visible:opacity-100","text-muted-foreground hover:text-destructive"),"aria-label":`Delete ${X}`,disabled:U,onClick:K=>{K.preventDefault(),K.stopPropagation(),f({id:Y.id,label:X})},children:U?M.jsx(Nr,{className:"size-4 animate-spin"}):M.jsx(HN,{className:"size-4"})})]},Y.id)})}),e[0]=n,e[1]=u,e[2]=s,e[3]=i,e[4]=r,e[5]=o,e[6]=h,e[7]=p,e[8]=g,e[9]=m,e[10]=y}else h=e[6],p=e[7],g=e[8],m=e[9],y=e[10];let b;e[24]!==p||e[25]!==g?(b=M.jsx("div",{className:p,children:g}),e[24]=p,e[25]=g,e[26]=b):b=e[26];const w=!h||c;let k;e[27]!==a?(k=async()=>{const j=window.prompt("Enter slug (e.g. my-new-post)");j&&await a(j)},e[27]=a,e[28]=k):k=e[28];let v;e[29]!==c?(v=c?M.jsx(Nr,{className:"size-4 animate-spin"}):null,e[29]=c,e[30]=v):v=e[30];let x;e[31]!==w||e[32]!==k||e[33]!==v?(x=M.jsxs(pn,{type:"button",variant:"outline",className:"w-full",disabled:w,onClick:k,children:[v,"New file"]}),e[31]=w,e[32]=k,e[33]=v,e[34]=x):x=e[34];const E=d!==null;let C;e[35]===Symbol.for("react.memo_cache_sentinel")?(C=j=>{j||f(null)},e[35]=C):C=e[35];let A;e[36]===Symbol.for("react.memo_cache_sentinel")?(A=M.jsx($A,{children:"Delete file?"}),e[36]=A):A=e[36];const z=d?.label;let R;e[37]!==z?(R=M.jsxs(AA,{children:[A,M.jsxs(DA,{children:['This will permanently delete "',z,'" from disk.']})]}),e[37]=z,e[38]=R):R=e[38];const _=!!u;let N;e[39]!==_?(N=M.jsx(LA,{disabled:_,children:"Cancel"}),e[39]=_,e[40]=N):N=e[40];const L=!d||!!u;let H;e[41]!==d||e[42]!==l?(H=async()=>{d&&(await l(d.id),f(null))},e[41]=d,e[42]=l,e[43]=H):H=e[43];let Z;e[44]!==L||e[45]!==H?(Z=M.jsx(zA,{variant:"destructive",disabled:L,onClick:H,children:"Delete"}),e[44]=L,e[45]=H,e[46]=Z):Z=e[46];let W;e[47]!==N||e[48]!==Z?(W=M.jsxs(IA,{children:[N,Z]}),e[47]=N,e[48]=Z,e[49]=W):W=e[49];let q;e[50]!==R||e[51]!==W?(q=M.jsxs(PA,{children:[R,W]}),e[50]=R,e[51]=W,e[52]=q):q=e[52];let V;e[53]!==E||e[54]!==q?(V=M.jsx(OA,{open:E,onOpenChange:C,children:q}),e[53]=E,e[54]=q,e[55]=V):V=e[55];let D;return e[56]!==V||e[57]!==m||e[58]!==y||e[59]!==b||e[60]!==x?(D=M.jsxs("div",{className:m,children:[y,b,x,V]}),e[56]=V,e[57]=m,e[58]=y,e[59]=b,e[60]=x,e[61]=D):D=e[61],D}function OI(t){return M.jsx(pd,{value:t.name,children:t.name},t.name)}function _I(t){const e=Me.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let o;e[3]!==n?(o=ue("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 disabled:bg-input/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 flex field-sizing-content min-h-16 w-full rounded-lg border bg-transparent px-2.5 py-2 text-base transition-colors outline-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm",n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=M.jsx("textarea",{"data-slot":"textarea",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function Ft(t){this.content=t}Ft.prototype={constructor:Ft,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,o=r.find(t),s=r.content.slice();return o==-1?s.push(n||t,e):(s[o+1]=e,n&&(s[o]=n)),new Ft(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 Ft(n)},addToStart:function(t,e){return new Ft([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ft(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),s=r.find(t);return o.splice(s==-1?o.length:s,0,e,n),new Ft(o)},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=Ft.from(t),t.size?new Ft(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ft.from(t),t.size?new Ft(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ft.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}};Ft.from=function(t){if(t instanceof Ft)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ft(e)};function r1(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),s=e.child(r);if(o==s){n+=o.nodeSize;continue}if(!o.sameMarkup(s))return n;if(o.isText&&o.text!=s.text){for(let i=0;o.text[i]==s.text[i];i++)n++;return n}if(o.content.size||s.content.size){let i=r1(o.content,s.content,n+1);if(i!=null)return i}n+=o.nodeSize}}function o1(t,e,n,r){for(let o=t.childCount,s=e.childCount;;){if(o==0||s==0)return o==s?null:{a:n,b:r};let i=t.child(--o),a=e.child(--s),l=i.nodeSize;if(i==a){n-=l,r-=l;continue}if(!i.sameMarkup(a))return{a:n,b:r};if(i.isText&&i.text!=a.text){let c=0,u=Math.min(i.text.length,a.text.length);for(;c<u&&i.text[i.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(i.content.size||a.content.size){let c=o1(i.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class re{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,o=0,s){for(let i=0,a=0;a<n;i++){let l=this.content[i],c=a+l.nodeSize;if(c>e&&r(l,o+a,s||null,i)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,o+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let s="",i=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(i?i=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)o.push(e.content[s]);return new re(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let s=0,i=0;i<n;s++){let a=this.content[s],l=i+a.nodeSize;l>e&&((i<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-i),Math.min(a.text.length,n-i)):a=a.cut(Math.max(0,e-i-1),Math.min(a.content.size,n-i-1))),r.push(a),o+=a.nodeSize),i=l}return new re(r,o)}cutByIndex(e,n){return e==n?re.empty:e==0&&n==this.content.length?this:new re(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new re(o,s)}addToStart(e){return new re([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new re(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 o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return r1(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return o1(this,e,n,r)}findIndex(e){if(e==0)return wl(0,e);if(e==this.size)return wl(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 o=this.child(n),s=r+o.nodeSize;if(s>=e)return s==e?wl(n+1,s):wl(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 re.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new re(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return re.empty;let n,r=0;for(let o=0;o<e.length;o++){let s=e[o];r+=s.nodeSize,o&&s.isText&&e[o-1].sameMarkup(s)?(n||(n=e.slice(0,o)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new re(n||e,r)}static from(e){if(!e)return re.empty;if(e instanceof re)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new re([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}re.empty=new re([],0);const sf={index:0,offset:0};function wl(t,e){return sf.index=t,sf.offset=e,sf}function Jc(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(!Jc(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Jc(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let lt=class xh{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let s=e[o];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,o));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),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&&Jc(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 o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}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 xh.none;if(e instanceof xh)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};lt.none=[];class Xc extends Error{}class pe{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=i1(this.content,e+this.openStart,n);return r&&new pe(r,this.openStart,this.openEnd)}removeBetween(e,n){return new pe(s1(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 pe.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new pe(re.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=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)o++;return new pe(e,r,o)}}pe.empty=new pe(re.empty,0,0);function s1(t,e,n){let{index:r,offset:o}=t.findIndex(e),s=t.maybeChild(r),{index:i,offset:a}=t.findIndex(n);if(o==e||s.isText){if(a!=n&&!t.child(i).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=i)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(s1(s.content,e-o-1,n-o-1)))}function i1(t,e,n,r){let{index:o,offset:s}=t.findIndex(e),i=t.maybeChild(o);if(s==e||i.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=i1(i.content,e-s-1,n,i);return a&&t.replaceChild(o,i.copy(a))}function NI(t,e,n){if(n.openStart>t.depth)throw new Xc("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Xc("Inconsistent open depths");return a1(t,e,n,0)}function a1(t,e,n,r){let o=t.index(r),s=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let i=a1(t,e,n,r+1);return s.copy(s.content.replaceChild(o,i))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let i=t.parent,a=i.content;return es(i,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:i,end:a}=PI(n,t);return es(s,c1(t,i,a,e,r))}else return es(s,Qc(t,e,r))}function l1(t,e){if(!e.type.compatibleContent(t.type))throw new Xc("Cannot join "+e.type.name+" onto "+t.type.name)}function Sh(t,e,n){let r=t.node(n);return l1(r,e.node(n)),r}function Qo(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 ca(t,e,n,r){let o=(e||t).node(n),s=0,i=e?e.index(n):o.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(Qo(t.nodeAfter,r),s++));for(let a=s;a<i;a++)Qo(o.child(a),r);e&&e.depth==n&&e.textOffset&&Qo(e.nodeBefore,r)}function es(t,e){return t.type.checkContent(e),t.copy(e)}function c1(t,e,n,r,o){let s=t.depth>o&&Sh(t,e,o+1),i=r.depth>o&&Sh(n,r,o+1),a=[];return ca(null,t,o,a),s&&i&&e.index(o)==n.index(o)?(l1(s,i),Qo(es(s,c1(t,e,n,r,o+1)),a)):(s&&Qo(es(s,Qc(t,e,o+1)),a),ca(e,n,o,a),i&&Qo(es(i,Qc(n,r,o+1)),a)),ca(r,null,o,a),new re(a)}function Qc(t,e,n){let r=[];if(ca(null,t,n,r),t.depth>n){let o=Sh(t,e,n+1);Qo(es(o,Qc(t,e,n+1)),r)}return ca(e,null,n,r),new re(r)}function PI(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)o=e.node(s).copy(re.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class Ra{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],o=e.child(n);return r?e.child(n).cut(r):o}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],o=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)o+=r.child(s).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return lt.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let a=r;r=o,o=a}let s=r.marks;for(var i=0;i<s.length;i++)s[i].type.spec.inclusive===!1&&(!o||!s[i].isInSet(o.marks))&&(s=s[i--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!o||!r[s].isInSet(o.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 eu(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=[],o=0,s=n;for(let i=e;;){let{index:a,offset:l}=i.content.findIndex(s),c=s-l;if(r.push(i,a,o+l),!c||(i=i.child(a),i.isText))break;s=c-1,o+=l+1}return new Ra(n,r,s)}static resolveCached(e,n){let r=By.get(e);if(r)for(let s=0;s<r.elts.length;s++){let i=r.elts[s];if(i.pos==n)return i}else By.set(e,r=new AI);let o=r.elts[r.i]=Ra.resolve(e,n);return r.i=(r.i+1)%II,o}}class AI{constructor(){this.elts=[],this.i=0}}const II=12,By=new WeakMap;class eu{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 $I=Object.create(null);let lo=class Eh{constructor(e,n,r,o=lt.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||re.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,o=0){this.content.nodesBetween(e,n,r,o,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,o){return this.content.textBetween(e,n,r,o)}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&&Jc(this.attrs,n||e.defaultAttrs||$I)&<.sameSet(this.marks,r||lt.none)}copy(e=null){return e==this.content?this:new Eh(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Eh(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 pe.empty;let o=this.resolve(e),s=this.resolve(n),i=r?0:o.sharedDepth(n),a=o.start(i),c=o.node(i).content.cut(o.pos-a,s.pos-a);return new pe(c,o.depth-i,s.depth-i)}replace(e,n,r){return NI(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+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 o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return Ra.resolveCached(this,e)}resolveNoCache(e){return Ra.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(o=!0),!o)),o}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()+")"),u1(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=re.empty,o=0,s=r.childCount){let i=this.contentMatchAt(e).matchFragment(r,o,s),a=i&&i.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=o;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let s=this.contentMatchAt(e).matchType(r),i=s&&s.matchFragment(this.content,n);return i?i.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=lt.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(!lt.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 o=re.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,o,r);return s.type.checkAttrs(s.attrs),s}};lo.prototype.text=void 0;class tu extends lo{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):u1(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 tu(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new tu(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 u1(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class ds{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new DI(e,n);if(r.next==null)return ds.empty;let o=d1(r);r.next&&r.err("Unexpected trailing text");let s=HI(VI(o));return WI(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 o=this;for(let s=n;o&&s<r;s++)o=o.matchType(e.child(s).type);return o}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 o=[this];function s(i,a){let l=i.matchFragment(e,r);if(l&&(!n||l.validEnd))return re.from(a.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:u,next:d}=i.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=s(d,a.concat(u));if(f)return f}}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 o=r.shift(),s=o.match;if(s.matchType(e)){let i=[];for(let a=o;a.type;a=a.via)i.push(a.type);return i.reverse()}for(let i=0;i<s.next.length;i++){let{type:a,next:l}=s.next[i];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!o.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let s=o+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)s+=(i?", ":"")+r.next[i].type.name+"->"+e.indexOf(r.next[i].next);return s}).join(`
|
|
13
|
-
`)}}ds.empty=new ds(!0);class DI{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 d1(t){let e=[];do e.push(zI(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function zI(t){let e=[];do e.push(LI(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function LI(t){let e=BI(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=jI(t,e);else break;return e}function Vy(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function jI(t,e){let n=Vy(t),r=n;return t.eat(",")&&(t.next!="}"?r=Vy(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function FI(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let s in n){let i=n[s];i.isInGroup(e)&&o.push(i)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function BI(t){if(t.eat("(")){let e=d1(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=FI(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 VI(t){let e=[[]];return o(s(t,0),n()),e;function n(){return e.push([])-1}function r(i,a,l){let c={term:l,to:a};return e[i].push(c),c}function o(i,a){i.forEach(l=>l.to=a)}function s(i,a){if(i.type=="choice")return i.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(i.type=="seq")for(let l=0;;l++){let c=s(i.exprs[l],a);if(l==i.exprs.length-1)return c;o(c,a=n())}else if(i.type=="star"){let l=n();return r(a,l),o(s(i.expr,l),l),[r(l)]}else if(i.type=="plus"){let l=n();return o(s(i.expr,a),l),o(s(i.expr,l),l),[r(l)]}else{if(i.type=="opt")return[r(a)].concat(s(i.expr,a));if(i.type=="range"){let l=a;for(let c=0;c<i.min;c++){let u=n();o(s(i.expr,l),u),l=u}if(i.max==-1)o(s(i.expr,l),l);else for(let c=i.min;c<i.max;c++){let u=n();r(l,u),o(s(i.expr,l),u),l=u}return[r(l)]}else{if(i.type=="name")return[r(a,void 0,i.value)];throw new Error("Unknown expr type")}}}}function f1(t,e){return e-t}function Hy(t,e){let n=[];return r(e),n.sort(f1);function r(o){let s=t[o];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(o);for(let i=0;i<s.length;i++){let{term:a,to:l}=s[i];!a&&n.indexOf(l)==-1&&r(l)}}}function HI(t){let e=Object.create(null);return n(Hy(t,0));function n(r){let o=[];r.forEach(i=>{t[i].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<o.length;u++)o[u][0]==a&&(c=o[u][1]);Hy(t,l).forEach(u=>{c||o.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new ds(r.indexOf(t.length-1)>-1);for(let i=0;i<o.length;i++){let a=o[i][1].sort(f1);s.next.push({type:o[i][0],next:e[a.join(",")]||n(a)})}return s}}function WI(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],s=!o.validEnd,i=[];for(let a=0;a<o.next.length;a++){let{type:l,next:c}=o.next[a];i.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function h1(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 p1(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let s=t[r];if(s.hasDefault)o=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function m1(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in t){let s=t[o];s.validate&&s.validate(e[o])}}function g1(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new UI(t,r,e[r]);return n}let Wy=class y1{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=g1(e,r.attrs),this.defaultAttrs=h1(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==ds.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:p1(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new lo(this,this.computeAttrs(e),re.from(n),lt.setFrom(r))}createChecked(e=null,n,r){return n=re.from(n),this.checkContent(n),new lo(this,this.computeAttrs(e),n,lt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=re.from(n),n.size){let i=this.contentMatch.fillBefore(n);if(!i)return null;n=i.append(n)}let o=this.contentMatch.matchFragment(n),s=o&&o.fillBefore(re.empty,!0);return s?new lo(this,e,n.append(s),lt.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){m1(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:lt.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,i)=>r[s]=new y1(s,n,i));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");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 qI(t,e,n){let r=n.split("|");return o=>{let s=o===null?"null":typeof o;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class UI{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?qI(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class md{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=g1(e,o.attrs),this.excluded=null;let s=h1(this.attrs);this.instance=s?new lt(this,s):null}create(e=null){return!e&&this.instance?this.instance:new lt(this,p1(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((s,i)=>r[s]=new md(s,o++,n,i)),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){m1(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class b1{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=Ft.from(e.nodes),n.marks=Ft.from(e.marks||{}),this.nodes=Wy.compile(this.spec.nodes,this),this.marks=md.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let s=this.nodes[o],i=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[i]||(r[i]=ds.parse(i,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?qy(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let o in this.marks){let s=this.marks[o],i=s.spec.excludes;s.excluded=i==null?[s]:i==""?[]:qy(this,i.split(" "))}this.nodeFromJSON=o=>lo.fromJSON(this,o),this.markFromJSON=o=>lt.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Wy){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,o)}text(e,n){let r=this.nodes.text;return new tu(r,r.defaultAttrs,e,lt.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 qy(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],s=t.marks[o],i=s;if(s)n.push(s);else for(let a in t.marks){let l=t.marks[a];(o=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(i=l)}if(!i)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function KI(t){return t.tag!=null}function YI(t){return t.style!=null}class co{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(KI(o))this.tags.push(o);else if(YI(o)){let s=/[^=]*/.exec(o.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let s=e.nodes[o.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new Ky(this,n,!1);return r.addAll(e,lt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Ky(this,n,!0);return r.addAll(e,lt.none,n.from,n.to),pe.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let s=this.tags[o];if(JI(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let i=s.getAttrs(e);if(i===!1)continue;s.attrs=i||void 0}return s}}}matchStyle(e,n,r,o){for(let s=o?this.styles.indexOf(o)+1:0;s<this.styles.length;s++){let i=this.styles[s],a=i.style;if(!(a.indexOf(e)!=0||i.context&&!r.matchesContext(i.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(i.getAttrs){let l=i.getAttrs(n);if(l===!1)continue;i.attrs=l||void 0}return i}}}static schemaRules(e){let n=[];function r(o){let s=o.priority==null?50:o.priority,i=0;for(;i<n.length;i++){let a=n[i];if((a.priority==null?50:a.priority)<s)break}n.splice(i,0,o)}for(let o in e.marks){let s=e.marks[o].spec.parseDOM;s&&s.forEach(i=>{r(i=Yy(i)),i.mark||i.ignore||i.clearMark||(i.mark=o)})}for(let o in e.nodes){let s=e.nodes[o].spec.parseDOM;s&&s.forEach(i=>{r(i=Yy(i)),i.node||i.ignore||i.mark||(i.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new co(e,co.schemaRules(e)))}}const v1={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},ZI={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},w1={ol:!0,ul:!0},Oa=1,Ch=2,ua=4;function Uy(t,e,n){return e!=null?(e?Oa:0)|(e==="full"?Ch:0):t&&t.whitespace=="pre"?Oa|Ch:n&~ua}class kl{constructor(e,n,r,o,s,i){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=i,this.content=[],this.activeMarks=lt.none,this.match=s||(i&ua?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(re.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Oa)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-o[0].length))}}let n=re.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(re.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&&!v1.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ky{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,s,i=Uy(null,n.preserveWhitespace,0)|(r?ua:0);o?s=new kl(o.type,o.attrs,lt.none,!0,n.topMatch||o.type.contentMatch,i):r?s=new kl(null,null,lt.none,!0,null,i):s=new kl(e.schema.topNodeType,null,lt.none,!0,null,i),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,o=this.top,s=o.options&Ch?"full":this.localPreserveWS||(o.options&Oa)>0,{schema:i}=this.parser;if(s==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
|
|
14
|
-
`);else if(i.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(i.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(i.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(i.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=o.content[o.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(i.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i=e.nodeName.toLowerCase(),a;w1.hasOwnProperty(i)&&this.parser.normalizeLists&&GI(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:ZI.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(v1.hasOwnProperty(i))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(s),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=o}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
15
|
-
`),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 o=0;o<this.parser.matchedStyles.length;o++){let s=this.parser.matchedStyles[o],i=r.getPropertyValue(s);if(i)for(let a=void 0;;){let l=this.parser.matchStyle(s,i,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,o){let s,i;if(n.node)if(i=this.parser.schema.nodes[n.node],i.isLeaf)this.insertNode(i.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(i,n.attrs||null,r,n.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(i&&i.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,n,r,o){let s=r||0;for(let i=r?e.childNodes[r]:e.firstChild,a=o==null?null:e.childNodes[o];i!=a;i=i.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(i,n);this.findAtPoint(e,s)}findPlace(e,n,r){let o,s;for(let i=this.open,a=0;i>=0;i--){let l=this.nodes[i],c=l.findWrapping(e);if(c&&(!o||o.length>c.length+a)&&(o=c,s=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!o)return null;this.sync(s);for(let i=0;i<o.length;i++)n=this.enterInner(o[i],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 o=this.findPlace(e,n,r);if(o){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let i=lt.none;for(let a of o.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):Zy(a.type,e.type))&&(i=a.addToSet(i));return s.content.push(e.mark(i)),!0}return!1}enter(e,n,r,o){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,o)),s}enterInner(e,n,r,o=!1,s){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let a=Uy(e,s,i.options);i.options&ua&&i.content.length==0&&(a|=ua);let l=lt.none;return r=r.filter(c=>(i.type?i.type.allowsMarkType(c.type):Zy(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new kl(e,n,l,o,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Oa)}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 o=r.length-1;o>=0;o--)e+=r[o].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 o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].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,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(o?0:1),i=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=s;l--)if(i(a-1,l))return!0;return!1}else{let u=l>0||l==0&&o?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return i(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 GI(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&w1.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function JI(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Yy(t){let e={};for(let n in t)e[n]=t[n];return e}function Zy(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let s=[],i=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||s.indexOf(u)<0&&i(u))return!0}};if(i(o.contentMatch))return!0}}class Es{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=af(n).createDocumentFragment());let o=r,s=[];return e.forEach(i=>{if(s.length||i.marks.length){let a=0,l=0;for(;a<s.length&&l<i.marks.length;){let c=i.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)o=s.pop()[1];for(;l<i.marks.length;){let c=i.marks[l++],u=this.serializeMark(c,i.isInline,n);u&&(s.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(i,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:o}=Rc(af(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let s=this.serializeMark(e.marks[o],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&Rc(af(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return Rc(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Es(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Gy(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Gy(e.marks)}}function Gy(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function af(t){return t.document||window.document}const Jy=new WeakMap;function XI(t){let e=Jy.get(t);return e===void 0&&Jy.set(t,e=QI(t)),e}function QI(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 o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function Rc(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],s;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=XI(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 i=o.indexOf(" ");i>0&&(n=o.slice(0,i),o=o.slice(i+1));let a,l=n?t.createElementNS(n,o):t.createElement(o),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:p}=Rc(t,f,n,r);if(l.appendChild(h),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const k1=65535,x1=Math.pow(2,16);function e$(t,e){return t+e*x1}function Xy(t){return t&k1}function t$(t){return(t-(t&k1))/x1}const S1=1,E1=2,Oc=4,C1=8;class Th{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&C1)>0}get deletedBefore(){return(this.delInfo&(S1|Oc))>0}get deletedAfter(){return(this.delInfo&(E1|Oc))>0}get deletedAcross(){return(this.delInfo&Oc)>0}}class xn{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&xn.empty)return xn.empty}recover(e){let n=0,r=Xy(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+t$(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 o=0,s=this.inverted?2:1,i=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?o:0);if(l>e)break;let c=this.ranges[a+s],u=this.ranges[a+i],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:n:n,h=l+o+(f<0?0:u);if(r)return h;let p=e==(n<0?l:d)?null:e$(a/3,e-l),g=e==l?E1:e==d?S1:Oc;return(n<0?e!=l:e!=d)&&(g|=C1),new Th(h,g,p)}o+=u-c}return r?e+o:new Th(e+o,0,null)}touches(e,n){let r=0,o=Xy(n),s=this.inverted?2:1,i=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+s],u=l+c;if(e<=u&&a==o*3)return!0;r+=this.ranges[a+i]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,s=0;o<this.ranges.length;o+=3){let i=this.ranges[o],a=i-(this.inverted?s:0),l=i+(this.inverted?0:s),c=this.ranges[o+n],u=this.ranges[o+r];e(a,a+c,l,l+u),s+=u-c}}invert(){return new xn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?xn.empty:new xn(e<0?[0,-e,0]:[0,0,e])}}xn.empty=new xn([]);class _a{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new _a(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 o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o: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 o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new _a;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 o=0;for(let s=this.from;s<this.to;s++){let i=this._maps[s],a=i.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}o|=a.delInfo,e=a.pos}return r?e:new Th(e,o,null)}}const lf=Object.create(null);class Gt{getMap(){return xn.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=lf[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 lf)throw new RangeError("Duplicate use of step JSON ID "+e);return lf[e]=n,n.prototype.jsonID=e,n}}class Tt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Tt(e,null)}static fail(e){return new Tt(null,e)}static fromReplace(e,n,r,o){try{return Tt.ok(e.replace(n,r,o))}catch(s){if(s instanceof Xc)return Tt.fail(s.message);throw s}}}function im(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let s=t.child(o);s.content.size&&(s=s.copy(im(s.content,e,s))),s.isInline&&(s=e(s,n,o)),r.push(s)}return re.fromArray(r)}class eo extends Gt{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),o=r.node(r.sharedDepth(this.to)),s=new pe(im(n.content,(i,a)=>!i.isAtom||!a.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),o),n.openStart,n.openEnd);return Tt.fromReplace(e,this.from,this.to,s)}invert(){return new Kn(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 eo(n.pos,r.pos,this.mark)}merge(e){return e instanceof eo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new eo(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 eo(n.from,n.to,e.markFromJSON(n.mark))}}Gt.jsonID("addMark",eo);class Kn extends Gt{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 pe(im(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return Tt.fromReplace(e,this.from,this.to,r)}invert(){return new eo(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 Kn(n.pos,r.pos,this.mark)}merge(e){return e instanceof Kn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Kn(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 Kn(n.from,n.to,e.markFromJSON(n.mark))}}Gt.jsonID("removeMark",Kn);class to extends Gt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Tt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Tt.fromReplace(e,this.pos,this.pos+1,new pe(re.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 o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new to(this.pos,n.marks[o]);return new to(this.pos,this.mark)}}return new fs(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new to(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 to(n.pos,e.markFromJSON(n.mark))}}Gt.jsonID("addNodeMark",to);class fs extends Gt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Tt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Tt.fromReplace(e,this.pos,this.pos+1,new pe(re.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new to(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new fs(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 fs(n.pos,e.markFromJSON(n.mark))}}Gt.jsonID("removeNodeMark",fs);class $t extends Gt{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&Mh(e,this.from,this.to)?Tt.fail("Structure replace would overwrite content"):Tt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new xn([this.from,this.to-this.from,this.slice.size])}invert(e){return new $t(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new $t(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof $t)||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?pe.empty:new pe(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new $t(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?pe.empty:new pe(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new $t(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 $t(n.from,n.to,pe.fromJSON(e,n.slice),!!n.structure)}}Gt.jsonID("replace",$t);class zt extends Gt{constructor(e,n,r,o,s,i,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=s,this.insert=i,this.structure=a}apply(e){if(this.structure&&(Mh(e,this.from,this.gapFrom)||Mh(e,this.gapTo,this.to)))return Tt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Tt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Tt.fromReplace(e,this.from,this.to,r):Tt.fail("Content does not fit in gap")}getMap(){return new xn([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 zt(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),o=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||o<n.pos||s>r.pos?null:new zt(n.pos,r.pos,o,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 zt(n.from,n.to,n.gapFrom,n.gapTo,pe.fromJSON(e,n.slice),n.insert,!!n.structure)}}Gt.jsonID("replaceAround",zt);function Mh(t,e,n){let r=t.resolve(e),o=n-e,s=r.depth;for(;o>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,o--;if(o>0){let i=r.node(s).maybeChild(r.indexAfter(s));for(;o>0;){if(!i||i.isLeaf)return!0;i=i.firstChild,o--}}return!1}function n$(t,e,n,r){let o=[],s=[],i,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+l.nodeSize,n),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(i&&i.to==f&&i.mark.eq(d[g])?i.to=h:o.push(i=new Kn(f,h,d[g])));a&&a.to==f?a.to=h:s.push(a=new eo(f,h,r))}}),o.forEach(l=>t.step(l)),s.forEach(l=>t.step(l))}function r$(t,e,n,r){let o=[],s=0;t.doc.nodesBetween(e,n,(i,a)=>{if(!i.isInline)return;s++;let l=null;if(r instanceof md){let c=i.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(i.marks)&&(l=[r]):l=i.marks;if(l&&l.length){let c=Math.min(a+i.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],f;for(let h=0;h<o.length;h++){let p=o[h];p.step==s-1&&d.eq(o[h].style)&&(f=p)}f?(f.to=c,f.step=s):o.push({style:d,from:Math.max(a,e),to:c,step:s})}}}),o.forEach(i=>t.step(new Kn(i.from,i.to,i.style)))}function am(t,e,n,r=n.contentMatch,o=!0){let s=t.doc.nodeAt(e),i=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)i.push(new $t(a,u,pe.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new Kn(a,u,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new pe(re.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),i.push(new $t(a+f.index,a+f.index+f[0].length,p))}}a=u}if(!r.validEnd){let l=r.fillBefore(re.empty,!0);t.replace(a,a,new pe(l,0,0))}for(let l=i.length-1;l>=0;l--)t.step(i[l])}function o$(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ai(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,o=0,s=0;;--r){let i=t.$from.node(r),a=t.$from.index(r)+o,l=t.$to.indexAfter(r)-s;if(r<t.depth&&i.canReplace(a,l,n))return r;if(r==0||i.type.spec.isolating||!o$(i,a,l))break;a&&(o=1),l<i.childCount&&(s=1)}return null}function s$(t,e,n){let{$from:r,$to:o,depth:s}=e,i=r.before(s+1),a=o.after(s+1),l=i,c=a,u=re.empty,d=0;for(let p=s,g=!1;p>n;p--)g||r.index(p)>0?(g=!0,u=re.from(r.node(p).copy(u)),d++):l--;let f=re.empty,h=0;for(let p=s,g=!1;p>n;p--)g||o.after(p+1)<o.end(p)?(g=!0,f=re.from(o.node(p).copy(f)),h++):c++;t.step(new zt(l,c,i,a,new pe(u.append(f),d,h),u.size-d,!0))}function lm(t,e,n=null,r=t){let o=i$(t,e),s=o&&a$(r,e);return s?o.map(Qy).concat({type:e,attrs:n}).concat(s.map(Qy)):null}function Qy(t){return{type:t,attrs:null}}function i$(t,e){let{parent:n,startIndex:r,endIndex:o}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let i=s.length?s[0]:e;return n.canReplaceWith(r,o,i)?s:null}function a$(t,e){let{parent:n,startIndex:r,endIndex:o}=t,s=n.child(r),i=e.contentMatch.findWrapping(s.type);if(!i)return null;let l=(i.length?i[i.length-1]:e).contentMatch;for(let c=r;l&&c<o;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:i}function l$(t,e,n){let r=re.empty;for(let i=n.length-1;i>=0;i--){if(r.size){let a=n[i].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=re.from(n[i].type.create(n[i].attrs,r))}let o=e.start,s=e.end;t.step(new zt(o,s,o,s,new pe(r,0,0),n.length,!0))}function c$(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(i,a)=>{let l=typeof o=="function"?o(i):o;if(i.isTextblock&&!i.hasMarkup(r,l)&&u$(t.doc,t.mapping.slice(s).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&M1(t,i,a,s),am(t,t.mapping.slice(s).map(a,1),r,void 0,c===null);let u=t.mapping.slice(s),d=u.map(a,1),f=u.map(a+i.nodeSize,1);return t.step(new zt(d,f,d+1,f-1,new pe(re.from(r.create(l,null,i.marks)),0,0),1,!0)),c===!0&&T1(t,i,a,s),!1}})}function T1(t,e,n,r){e.forEach((o,s)=>{if(o.isText){let i,a=/\r?\n|\r/g;for(;i=a.exec(o.text);){let l=t.mapping.slice(r).map(n+1+s+i.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function M1(t,e,n,r){e.forEach((o,s)=>{if(o.type==o.type.schema.linebreakReplacement){let i=t.mapping.slice(r).map(n+1+s);t.replaceWith(i,i+1,e.type.schema.text(`
|
|
16
|
-
`))}})}function u$(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function d$(t,e,n,r,o){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let i=n.create(r,null,o||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,i);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new zt(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new pe(re.from(i),0,0),1,!0))}function Ar(t,e,n=1,r){let o=t.resolve(e),s=o.depth-n,i=r&&r[r.length-1]||o.parent;if(s<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!i.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>s;c--,u--){let d=o.node(c),f=o.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let g=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!g.type.validContent(h))return!1}let a=o.indexAfter(s),l=r&&r[0];return o.node(s).canReplaceWith(a,a,l?l.type:o.node(s+1).type)}function f$(t,e,n=1,r){let o=t.doc.resolve(e),s=re.empty,i=re.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){s=re.from(o.node(a).copy(s));let u=r&&r[c];i=re.from(u?u.type.create(u.attrs,i):o.node(a).copy(i))}t.step(new $t(e,e,new pe(s.append(i),n,n),!0))}function Mo(t,e){let n=t.resolve(e),r=n.index();return R1(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function h$(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let s=e.child(o),i=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(i),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function R1(t,e){return!!(t&&e&&!t.isLeaf&&h$(t,e))}function gd(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let s,i,a=r.index(o);if(o==r.depth?(s=r.nodeBefore,i=r.nodeAfter):n>0?(s=r.node(o+1),a++,i=r.node(o).maybeChild(a)):(s=r.node(o).maybeChild(a-1),i=r.node(o+1)),s&&!s.isTextblock&&R1(s,i)&&r.node(o).canReplace(a,a+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function p$(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,s=t.doc.resolve(e-n),i=s.node().type;if(o&&i.inlineContent){let u=i.whitespace=="pre",d=!!i.contentMatch.matchType(o);u&&!d?r=!1:!u&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);M1(t,u.node(),u.before(),a)}i.inlineContent&&am(t,e+n-1,i,s.node().contentMatchAt(s.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new $t(c,l.map(e+n,-1),pe.empty,!0)),r===!0){let u=t.doc.resolve(c);T1(t,u.node(),u.before(),t.steps.length)}return t}function m$(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 o=r.depth-1;o>=0;o--){let s=r.index(o);if(r.node(o).canReplaceWith(s,s,n))return r.before(o+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let s=r.indexAfter(o);if(r.node(o).canReplaceWith(s,s,n))return r.after(o+1);if(s<r.node(o).childCount)return null}return null}function O1(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let s=0;s<n.openStart;s++)o=o.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let i=r.depth;i>=0;i--){let a=i==r.depth?0:r.pos<=(r.start(i+1)+r.end(i+1))/2?-1:1,l=r.index(i)+(a>0?1:0),c=r.node(i),u=!1;if(s==1)u=c.canReplace(l,l,o);else{let d=c.contentMatchAt(l).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(i+1):r.after(i+1)}return null}function yd(t,e,n=e,r=pe.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),s=t.resolve(n);return _1(o,s,r)?new $t(e,n,r):new g$(o,s,r).fit()}function _1(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class g${constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=re.empty;for(let o=0;o<=e.depth;o++){let s=e.node(o);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=re.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let s=this.placed,i=r.depth,a=o.depth;for(;i&&a&&s.childCount==1;)s=s.firstChild.content,i--,a--;let l=new pe(s,i,a);return e>-1?new zt(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new $t(r.pos,o.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(o=0),s.type.spec.isolating&&o<=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 o,s=null;r?(s=cf(this.unplaced.content,r-1).firstChild,o=s.content):o=this.unplaced.content;let i=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(i?c.matchType(i.type)||(d=c.fillBefore(re.from(i),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:d};if(n==2&&i&&(u=c.findWrapping(i.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=cf(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new pe(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=cf(e,n);if(o.childCount<=1&&n>0){let s=e.size-n<=n+o.size;this.unplaced=new pe(Gi(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new pe(Gi(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let g=0;g<s.length;g++)this.openFrontierNode(s[g]);let i=this.unplaced,a=r?r.content:i.content,l=i.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(o){for(let g=0;g<o.childCount;g++)u.push(o.child(g));d=d.matchFragment(o)}let h=a.size+e-(i.content.size-i.openEnd);for(;c<a.childCount;){let g=a.child(c),m=d.matchType(g.type);if(!m)break;c++,(c>1||l==0||g.content.size)&&(d=m,u.push(N1(g.mark(f.allowedMarks(g.marks)),c==1?l:0,c==a.childCount?h:-1)))}let p=c==a.childCount;p||(h=-1),this.placed=Ji(this.placed,n,re.from(u)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,m=a;g<h;g++){let y=m.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),m=y.content}this.unplaced=p?e==0?pe.empty:new pe(Gi(i.content,e-1,1),e-1,h<0?i.openEnd:e-1):new pe(Gi(i.content,e,c),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!uf(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,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),i=uf(e,n,o,r,s);if(i){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=uf(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:i,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=Ji(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),s=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,s)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Ji(this.placed,this.depth,re.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(re.empty,!0);n.childCount&&(this.placed=Ji(this.placed,this.frontier.length,n))}}function Gi(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Gi(t.firstChild.content,e-1,n)))}function Ji(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Ji(t.lastChild.content,e-1,n)))}function cf(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function N1(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,N1(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(re.empty,!0)))),t.copy(r)}function uf(t,e,n,r,o){let s=t.node(e),i=o?t.indexAfter(e):t.index(e);if(i==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,i);return a&&!y$(n,s.content,i)?a:null}function y$(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function b$(t){return t.spec.defining||t.spec.definingForContent}function v$(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),s=t.doc.resolve(n);if(_1(o,s,r))return t.step(new $t(e,n,r));let i=A1(o,s);i[i.length-1]==0&&i.pop();let a=-(o.depth+1);i.unshift(a);for(let f=o.depth,h=o.pos-1;f>0;f--,h--){let p=o.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;i.indexOf(f)>-1?a=f:o.before(f)==h&&i.splice(1,0,-f)}let l=i.indexOf(a),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=b$(h.type);if(p&&!h.sameMarkup(o.node(Math.abs(a)-1)))u=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),p=c[h];if(p)for(let g=0;g<i.length;g++){let m=i[(g+l)%i.length],y=!0;m<0&&(y=!1,m=-m);let b=o.node(m-1),w=o.index(m-1);if(b.canReplaceWith(w,w,p.type,p.marks))return t.replace(o.before(m),y?s.after(m):n,new pe(P1(r.content,0,r.openStart,h),h,r.openEnd))}}let d=t.steps.length;for(let f=i.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=i[f];h<0||(e=o.before(h),n=s.after(h))}}function P1(t,e,n,r,o){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(P1(s.content,e+1,n,r,s)))}if(e>r){let s=o.contentMatchAt(0),i=s.fillBefore(t).append(t);t=i.append(s.matchFragment(i).fillBefore(re.empty,!0))}return t}function w$(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=m$(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new pe(re.from(r),0,0))}function k$(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),s=A1(r,o);for(let i=0;i<s.length;i++){let a=s[i],l=i==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),o.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return t.delete(r.before(a),o.after(a))}for(let i=1;i<=r.depth&&i<=o.depth;i++)if(e-r.start(i)==r.depth-i&&n>r.end(i)&&o.end(i)-n!=o.depth-i&&r.start(i-1)==o.start(i-1)&&r.node(i-1).canReplace(r.index(i-1),o.index(i-1)))return t.delete(r.before(i),n);t.delete(e,n)}function A1(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let s=t.start(o);if(s<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(s==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==s-1)&&n.push(o)}return n}class ri extends Gt{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 Tt.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 o=n.type.create(r,null,n.marks);return Tt.fromReplace(e,this.pos,this.pos+1,new pe(re.from(o),0,n.isLeaf?0:1))}getMap(){return xn.empty}invert(e){return new ri(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 ri(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 ri(n.pos,n.attr,n.value)}}Gt.jsonID("attr",ri);class Na extends Gt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Tt.ok(r)}getMap(){return xn.empty}invert(e){return new Na(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 Na(n.attr,n.value)}}Gt.jsonID("docAttr",Na);let mi=class extends Error{};mi=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};mi.prototype=Object.create(Error.prototype);mi.prototype.constructor=mi;mi.prototype.name="TransformError";class I1{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new _a}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new mi(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 o=this.mapping.maps[r];r&&(e=o.map(e,1),n=o.map(n,-1)),o.forEach((s,i,a,l)=>{e=Math.min(e,a),n=Math.max(n,l)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=pe.empty){let o=yd(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new pe(re.from(r),0,0))}delete(e,n){return this.replace(e,n,pe.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return v$(this,e,n,r),this}replaceRangeWith(e,n,r){return w$(this,e,n,r),this}deleteRange(e,n){return k$(this,e,n),this}lift(e,n){return s$(this,e,n),this}join(e,n=1){return p$(this,e,n),this}wrap(e,n){return l$(this,e,n),this}setBlockType(e,n=e,r,o=null){return c$(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return d$(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new ri(e,n,r)),this}setDocAttribute(e,n){return this.step(new Na(e,n)),this}addNodeMark(e,n){return this.step(new to(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 lt)n.isInSet(r.marks)&&this.step(new fs(e,n));else{let o=r.marks,s,i=[];for(;s=n.isInSet(o);)i.push(new fs(e,s)),o=s.removeFromSet(o);for(let a=i.length-1;a>=0;a--)this.step(i[a])}return this}split(e,n=1,r){return f$(this,e,n,r),this}addMark(e,n,r){return n$(this,e,n,r),this}removeMark(e,n,r){return r$(this,e,n,r),this}clearIncompatible(e,n,r){return am(this,e,n,r),this}}const df=Object.create(null);class $e{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new x$(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=pe.empty){let r=n.content.lastChild,o=null;for(let a=0;a<n.openEnd;a++)o=r,r=r.lastChild;let s=e.steps.length,i=this.ranges;for(let a=0;a<i.length;a++){let{$from:l,$to:c}=i[a],u=e.mapping.slice(s);e.replaceRange(u.map(l.pos),u.map(c.pos),a?pe.empty:n),a==0&&nb(e,s,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:i,$to:a}=o[s],l=e.mapping.slice(r),c=l.map(i.pos),u=l.map(a.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),nb(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new _e(e):js(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let s=e.depth-1;s>=0;s--){let i=n<0?js(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):js(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(i)return i}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new En(e.node(0))}static atStart(e){return js(e,e,0,0,1)||new En(e)}static atEnd(e){return js(e,e,e.content.size,e.childCount,-1)||new En(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=df[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 df)throw new RangeError("Duplicate use of selection JSON ID "+e);return df[e]=n,n.prototype.jsonID=e,n}getBookmark(){return _e.between(this.$anchor,this.$head).getBookmark()}}$e.prototype.visible=!0;class x${constructor(e,n){this.$from=e,this.$to=n}}let eb=!1;function tb(t){!eb&&!t.parent.inlineContent&&(eb=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class _e extends $e{constructor(e,n=e){tb(e),tb(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 o=e.resolve(n.map(this.anchor));return new _e(o.parent.inlineContent?o:r,r)}replace(e,n=pe.empty){if(super.replace(e,n),n==pe.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof _e&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new bd(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new _e(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=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||(o==0?e=n:(e=($e.findFrom(e,-r,!0)||$e.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new _e(e,n)}}$e.jsonID("text",_e);class bd{constructor(e,n){this.anchor=e,this.head=n}map(e){return new bd(e.map(this.anchor),e.map(this.head))}resolve(e){return _e.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ce 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:o}=n.mapResult(this.anchor),s=e.resolve(o);return r?$e.near(s):new Ce(s)}content(){return new pe(re.from(this.node),0,0)}eq(e){return e instanceof Ce&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new cm(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ce(e.resolve(n.anchor))}static create(e,n){return new Ce(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ce.prototype.visible=!1;$e.jsonID("node",Ce);class cm{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new bd(r,r):new cm(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Ce.isSelectable(r)?new Ce(n):$e.near(n)}}class En extends $e{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=pe.empty){if(n==pe.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 En(e)}map(e){return new En(e)}eq(e){return e instanceof En}getBookmark(){return S$}}$e.jsonID("all",En);const S$={map(){return this},resolve(t){return new En(t)}};function js(t,e,n,r,o,s=!1){if(e.inlineContent)return _e.create(t,n);for(let i=r-(o>0?0:1);o>0?i<e.childCount:i>=0;i+=o){let a=e.child(i);if(a.isAtom){if(!s&&Ce.isSelectable(a))return Ce.create(t,n-(o<0?a.nodeSize:0))}else{let l=js(t,a,n+o,o<0?a.childCount:0,o,s);if(l)return l}n+=a.nodeSize*o}return null}function nb(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof $t||o instanceof zt))return;let s=t.mapping.maps[r],i;s.forEach((a,l,c,u)=>{i==null&&(i=u)}),t.setSelection($e.near(t.doc.resolve(i),n))}const rb=1,xl=2,ob=4;class E$ extends I1{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|rb)&~xl,this.storedMarks=null,this}get selectionSet(){return(this.updated&rb)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=xl,this}ensureMarks(e){return lt.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&xl)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~xl,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)||lt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let i=this.doc.resolve(n);s=r==n?i.marks():i.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.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|=ob,this}get scrolledIntoView(){return(this.updated&ob)>0}}function sb(t,e){return!e||!t?t:t.bind(e)}class Xi{constructor(e,n,r){this.name=e,this.init=sb(n.init,r),this.apply=sb(n.apply,r)}}const C$=[new Xi("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Xi("selection",{init(t,e){return t.selection||$e.atStart(e.doc)},apply(t){return t.selection}}),new Xi("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Xi("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class ff{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=C$.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 Xi(r.key,r.spec.state,r))})}}class qs{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 o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let s=!1;for(let i=0;i<this.config.plugins.length;i++){let a=this.config.plugins[i];if(a.spec.appendTransaction){let l=o?o[i].n:0,c=o?o[i].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,i)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<i?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),s=!0}o&&(o[i]={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 qs(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let s=r[o];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new E$(this)}static create(e){let n=new ff(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new qs(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new ff(this.schema,e.plugins),r=n.fields,o=new qs(n);for(let s=0;s<r.length;s++){let i=r[s].name;o[i]=this.hasOwnProperty(i)?this[i]:r[s].init(e,o)}return o}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 o=e[r],s=o.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(o,this[o.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 o=new ff(e.schema,e.plugins),s=new qs(o);return o.fields.forEach(i=>{if(i.name=="doc")s.doc=lo.fromJSON(e.schema,n.doc);else if(i.name=="selection")s.selection=$e.fromJSON(s.doc,n.selection);else if(i.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==i.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){s[i.name]=c.fromJSON.call(l,e,n[a],s);return}}s[i.name]=i.init(e,s)}}),s}}function $1(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=$1(o,e,{})),n[r]=o}return n}class yt{constructor(e){this.spec=e,this.props={},e.props&&$1(e.props,this,this.props),this.key=e.key?e.key.key:D1("plugin")}getState(e){return e[this.key]}}const hf=Object.create(null);function D1(t){return t in hf?t+"$"+ ++hf[t]:(hf[t]=0,t+"$")}class It{constructor(e="key"){this.key=D1(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const um=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function z1(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const L1=(t,e,n)=>{let r=z1(t,n);if(!r)return!1;let o=dm(r);if(!o){let i=r.blockRange(),a=i&&Ai(i);return a==null?!1:(e&&e(t.tr.lift(i,a).scrollIntoView()),!0)}let s=o.nodeBefore;if(K1(t,o,e,-1))return!0;if(r.parent.content.size==0&&(gi(s,"end")||Ce.isSelectable(s)))for(let i=r.depth;;i--){let a=yd(t.doc,r.before(i),r.after(i),pe.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(gi(s,"end")?$e.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):Ce.create(l.doc,o.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(i==1||r.node(i-1).childCount>1)break}return s.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-s.nodeSize,o.pos).scrollIntoView()),!0):!1},T$=(t,e,n)=>{let r=z1(t,n);if(!r)return!1;let o=dm(r);return o?j1(t,o,e):!1},M$=(t,e,n)=>{let r=B1(t,n);if(!r)return!1;let o=fm(r);return o?j1(t,o,e):!1};function j1(t,e,n){let r=e.nodeBefore,o=r,s=e.pos-1;for(;!o.isTextblock;s--){if(o.type.spec.isolating)return!1;let u=o.lastChild;if(!u)return!1;o=u}let i=e.nodeAfter,a=i,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=yd(t.doc,s,l,pe.empty);if(!c||c.from!=s||c instanceof $t&&c.slice.size>=l-s)return!1;if(n){let u=t.tr.step(c);u.setSelection(_e.create(u.doc,s)),n(u.scrollIntoView())}return!0}function gi(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 F1=(t,e,n)=>{let{$head:r,empty:o}=t.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=dm(r)}let i=s&&s.nodeBefore;return!i||!Ce.isSelectable(i)?!1:(e&&e(t.tr.setSelection(Ce.create(t.doc,s.pos-i.nodeSize)).scrollIntoView()),!0)};function dm(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 B1(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const V1=(t,e,n)=>{let r=B1(t,n);if(!r)return!1;let o=fm(r);if(!o)return!1;let s=o.nodeAfter;if(K1(t,o,e,1))return!0;if(r.parent.content.size==0&&(gi(s,"start")||Ce.isSelectable(s))){let i=yd(t.doc,r.before(),r.after(),pe.empty);if(i&&i.slice.size<i.to-i.from){if(e){let a=t.tr.step(i);a.setSelection(gi(s,"start")?$e.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):Ce.create(a.doc,a.mapping.map(o.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+s.nodeSize).scrollIntoView()),!0):!1},H1=(t,e,n)=>{let{$head:r,empty:o}=t.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=fm(r)}let i=s&&s.nodeAfter;return!i||!Ce.isSelectable(i)?!1:(e&&e(t.tr.setSelection(Ce.create(t.doc,s.pos)).scrollIntoView()),!0)};function fm(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 R$=(t,e)=>{let n=t.selection,r=n instanceof Ce,o;if(r){if(n.node.isTextblock||!Mo(t.doc,n.from))return!1;o=n.from}else if(o=gd(t.doc,n.from,-1),o==null)return!1;if(e){let s=t.tr.join(o);r&&s.setSelection(Ce.create(s.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},O$=(t,e)=>{let n=t.selection,r;if(n instanceof Ce){if(n.node.isTextblock||!Mo(t.doc,n.to))return!1;r=n.to}else if(r=gd(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},_$=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),s=o&&Ai(o);return s==null?!1:(e&&e(t.tr.lift(o,s).scrollIntoView()),!0)},W1=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
17
|
-
`).scrollIntoView()),!0)};function hm(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 N$=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),s=n.indexAfter(-1),i=hm(o.contentMatchAt(s));if(!i||!o.canReplaceWith(s,s,i))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,i.createAndFill());l.setSelection($e.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},q1=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof En||r.parent.inlineContent||o.parent.inlineContent)return!1;let s=hm(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let i=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=t.tr.insert(i,s.createAndFill());a.setSelection(_e.create(a.doc,i+1)),e(a.scrollIntoView())}return!0},U1=(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(Ar(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Ai(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function P$(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof Ce&&e.selection.node.isBlock)return!r.parentOffset||!Ar(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],i,a,l=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){l=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),a=hm(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),s.unshift(l&&a?{type:a}:null),i=h;break}else{if(h==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof _e||e.selection instanceof En)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Ar(u.doc,d,s.length,s);if(f||(s[0]=a?{type:a}:null,f=Ar(u.doc,d,s.length,s)),!f)return!1;if(u.split(d,s.length,s),!l&&c&&r.node(i).type!=a){let h=u.mapping.map(r.before(i)),p=u.doc.resolve(h);a&&r.node(i-1).canReplaceWith(p.index(),p.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(i)),a)}return n&&n(u.scrollIntoView()),!0}}const A$=P$(),I$=(t,e)=>{let{$from:n,to:r}=t.selection,o,s=n.sharedDepth(r);return s==0?!1:(o=n.before(s),e&&e(t.tr.setSelection(Ce.create(t.doc,o))),!0)};function $$(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,s=e.index();return!r||!o||!r.type.compatibleContent(o.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)||!(o.isTextblock||Mo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function K1(t,e,n,r){let o=e.nodeBefore,s=e.nodeAfter,i,a,l=o.type.spec.isolating||s.type.spec.isolating;if(!l&&$$(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(i=(a=o.contentMatchAt(o.childCount)).findWrapping(s.type))&&a.matchType(i[0]||s.type).validEnd){if(n){let h=e.pos+s.nodeSize,p=re.empty;for(let y=i.length-1;y>=0;y--)p=re.from(i[y].create(null,p));p=re.from(o.copy(p));let g=t.tr.step(new zt(e.pos-1,h,e.pos,h,new pe(p,1,0),i.length,!0)),m=g.doc.resolve(h+2*i.length);m.nodeAfter&&m.nodeAfter.type==o.type&&Mo(g.doc,m.pos)&&g.join(m.pos),n(g.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&l?null:$e.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Ai(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&gi(s,"start",!0)&&gi(o,"end")){let h=o,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let g=s,m=1;for(;!g.isTextblock;g=g.firstChild)m++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(n){let y=re.empty;for(let w=p.length-1;w>=0;w--)y=re.from(p[w].copy(y));let b=t.tr.step(new zt(e.pos-p.length,e.pos+s.nodeSize,e.pos+m,e.pos+s.nodeSize-m,new pe(y,p.length,0),0,!0));n(b.scrollIntoView())}return!0}}return!1}function Y1(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,s=o.depth;for(;o.node(s).isInline;){if(!s)return!1;s--}return o.node(s).isTextblock?(n&&n(e.tr.setSelection(_e.create(e.doc,t<0?o.start(s):o.end(s)))),!0):!1}}const D$=Y1(-1),z$=Y1(1);function L$(t,e=null){return function(n,r){let{$from:o,$to:s}=n.selection,i=o.blockRange(s),a=i&&lm(i,t,e);return a?(r&&r(n.tr.wrap(i,a).scrollIntoView()),!0):!1}}function ib(t,e=null){return function(n,r){let o=!1;for(let s=0;s<n.selection.ranges.length&&!o;s++){let{$from:{pos:i},$to:{pos:a}}=n.selection.ranges[s];n.doc.nodesBetween(i,a,(l,c)=>{if(o)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)o=!0;else{let u=n.doc.resolve(c),d=u.index();o=u.parent.canReplaceWith(d,d+1,t)}})}if(!o)return!1;if(r){let s=n.tr;for(let i=0;i<n.selection.ranges.length;i++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[i];s.setBlockType(a,l,t,e)}r(s.scrollIntoView())}return!0}}function pm(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}pm(um,L1,F1);pm(um,V1,H1);pm(W1,q1,U1,A$);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function j$(t,e=null){return function(n,r){let{$from:o,$to:s}=n.selection,i=o.blockRange(s);if(!i)return!1;let a=r?n.tr:null;return F$(a,i,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function F$(t,e,n,r=null){let o=!1,s=e,i=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 l=i.resolve(e.start-2);s=new eu(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new eu(e.$from,i.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let a=lm(s,n,r,e);return a?(t&&B$(t,e,a,o,n),!0):!1}function B$(t,e,n,r,o){let s=re.empty;for(let u=n.length-1;u>=0;u--)s=re.from(n[u].type.create(n[u].attrs,s));t.step(new zt(e.start-(r?2:0),e.end,e.start,e.end,new pe(s,0,0),n.length,!0));let i=0;for(let u=0;u<n.length;u++)n[u].type==o&&(i=u+1);let a=n.length-i,l=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&Ar(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function V$(t){return function(e,n){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,i=>i.childCount>0&&i.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?H$(e,n,t,s):W$(e,n,s):!0:!1}}function H$(t,e,n,r){let o=t.tr,s=r.end,i=r.$to.end(r.depth);s<i&&(o.step(new zt(s-1,i,s,i,new pe(re.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new eu(o.doc.resolve(r.$from.pos),o.doc.resolve(i),r.depth));const a=Ai(r);if(a==null)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(s,-1)-1);return Mo(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos),e(o.scrollIntoView()),!0}function W$(t,e,n){let r=t.tr,o=n.parent;for(let h=n.end,p=n.endIndex-1,g=n.startIndex;p>g;p--)h-=o.child(p).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(n.start),i=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==o.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(a?0:1),u+1,i.content.append(l?re.empty:re.from(o))))return!1;let d=s.pos,f=d+i.nodeSize;return r.step(new zt(d-(a?1:0),f+(l?1:0),d+1,f-1,new pe((a?re.empty:re.from(o.copy(re.empty))).append(l?re.empty:re.from(o.copy(re.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function q$(t){return function(e,n){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==t);if(!s)return!1;let i=s.startIndex;if(i==0)return!1;let a=s.parent,l=a.child(i-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=re.from(c?t.create():null),d=new pe(re.from(t.create(null,re.from(a.type.create(null,u)))),c?3:1,0),f=s.start,h=s.end;n(e.tr.step(new zt(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const Vt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},yi=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Rh=null;const Tr=function(t,e,n){let r=Rh||(Rh=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},U$=function(){Rh=null},hs=function(t,e,n,r){return n&&(ab(t,e,n,r,-1)||ab(t,e,n,r,1))},K$=/^(img|br|input|textarea|hr)$/i;function ab(t,e,n,r,o){for(var s;;){if(t==n&&e==r)return!0;if(e==(o<0?0:An(t))){let i=t.parentNode;if(!i||i.nodeType!=1||Ya(t)||K$.test(t.nodeName)||t.contentEditable=="false")return!1;e=Vt(t)+(o<0?0:1),t=i}else if(t.nodeType==1){let i=t.childNodes[e+(o<0?-1:0)];if(i.nodeType==1&&i.contentEditable=="false")if(!((s=i.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=o;else return!1;else t=i,e=o<0?An(t):0}else return!1}}function An(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Y$(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=An(t)}else if(t.parentNode&&!Ya(t))e=Vt(t),t=t.parentNode;else return null}}function Z$(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&&!Ya(t))e=Vt(t)+1,t=t.parentNode;else return null}}function G$(t,e,n){for(let r=e==0,o=e==An(t);r||o;){if(t==n)return!0;let s=Vt(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,o=o&&s==An(t)}}function Ya(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 vd=function(t){return t.focusNode&&hs(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Ho(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function J$(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function X$(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(An(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(An(r.startContainer),r.startOffset)}}}const cr=typeof navigator<"u"?navigator:null,lb=typeof document<"u"?document:null,Ro=cr&&cr.userAgent||"",Oh=/Edge\/(\d+)/.exec(Ro),Z1=/MSIE \d/.exec(Ro),_h=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ro),mn=!!(Z1||_h||Oh),uo=Z1?document.documentMode:_h?+_h[1]:Oh?+Oh[1]:0,$n=!mn&&/gecko\/(\d+)/i.test(Ro);$n&&+(/Firefox\/(\d+)/.exec(Ro)||[0,0])[1];const Nh=!mn&&/Chrome\/(\d+)/.exec(Ro),Wt=!!Nh,G1=Nh?+Nh[1]:0,Yt=!mn&&!!cr&&/Apple Computer/.test(cr.vendor),bi=Yt&&(/Mobile\/\w+/.test(Ro)||!!cr&&cr.maxTouchPoints>2),Pn=bi||(cr?/Mac/.test(cr.platform):!1),J1=cr?/Win/.test(cr.platform):!1,Rr=/Android \d/.test(Ro),Za=!!lb&&"webkitFontSmoothing"in lb.documentElement.style,Q$=Za?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function eD(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 br(t,e){return typeof t=="number"?t:t[e]}function tD(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 cb(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let i=n||t.dom;i;){if(i.nodeType!=1){i=yi(i);continue}let a=i,l=a==s.body,c=l?eD(s):tD(a),u=0,d=0;if(e.top<c.top+br(r,"top")?d=-(c.top-e.top+br(o,"top")):e.bottom>c.bottom-br(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+br(o,"top")-c.top:e.bottom-c.bottom+br(o,"bottom")),e.left<c.left+br(r,"left")?u=-(c.left-e.left+br(o,"left")):e.right>c.right-br(r,"right")&&(u=e.right-c.right+br(o,"right")),u||d)if(l)s.defaultView.scrollBy(u,d);else{let h=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let g=a.scrollLeft-h,m=a.scrollTop-p;e={left:e.left-g,top:e.top-m,right:e.right-g,bottom:e.bottom-m}}let f=l?"fixed":getComputedStyle(i).position;if(/^(fixed|sticky)$/.test(f))break;i=f=="absolute"?i.offsetParent:yi(i)}}function nD(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let s=(e.left+e.right)/2,i=n+1;i<Math.min(innerHeight,e.bottom);i+=5){let a=t.root.elementFromPoint(s,i);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,o=l.top;break}}return{refDOM:r,refTop:o,stack:X1(t.dom)}}function X1(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=yi(r));return e}function rD({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Q1(n,r==0?0:r-e)}function Q1(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:s}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Ns=null;function oD(t){if(t.setActive)return t.setActive();if(Ns)return t.focus(Ns);let e=X1(t);t.focus(Ns==null?{get preventScroll(){return Ns={preventScroll:!0},!0}}:void 0),Ns||(Ns=!1,Q1(e,0))}function eS(t,e){let n,r=2e8,o,s=0,i=e.top,a=e.top,l,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=Tr(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=i&&p.bottom>=a){i=Math.max(p.bottom,i),a=Math.min(p.top,a);let g=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(g<r){n=u,r=g,o=g&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&g&&(s=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=d+1)}}return!n&&l&&(n=l,o=c,r=0),n&&n.nodeType==3?sD(n,o):!n||r&&n.nodeType==1?{node:t,offset:s}:eS(n,o)}function sD(t,e){let n=t.nodeValue.length,r=document.createRange(),o;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let i=Kr(r,1);if(i.top!=i.bottom&&mm(e,i)){o={node:t,offset:s+(e.left>=(i.left+i.right)/2?1:0)};break}}return r.detach(),o||{node:t,offset:0}}function mm(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function iD(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function aD(t,e,n){let{node:r,offset:o}=eS(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let i=r.getBoundingClientRect();s=i.left!=i.right&&n.left>(i.left+i.right)/2?1:-1}return t.docView.posFromDOM(r,o,s)}function lD(t,e,n,r){let o=-1;for(let s=e,i=!1;s!=t.dom;){let a=t.docView.nearestDesc(s,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!i&&l.left>r.left||l.top>r.top?o=a.posBefore:(!i&&l.right<r.left||l.bottom<r.top)&&(o=a.posAfter),i=!0),!a.contentDOM&&o<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function tS(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=o;;){let i=t.childNodes[s];if(i.nodeType==1){let a=i.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(mm(e,c))return tS(i,e,c)}}if((s=(s+1)%r)==o)break}return t}function cD(t,e){let n=t.dom.ownerDocument,r,o=0,s=X$(n,e.left,e.top);s&&({node:r,offset:o}=s);let i=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!i||!t.dom.contains(i.nodeType!=1?i.parentNode:i)){let c=t.dom.getBoundingClientRect();if(!mm(e,c)||(i=tS(t.dom,e,c),!i))return null}if(Yt)for(let c=i;r&&c;c=yi(c))c.draggable&&(r=void 0);if(i=iD(i,e),r){if($n&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&o++}let c;Za&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(a=lD(t,r,o,e))}a==null&&(a=aD(t,i,e));let l=t.docView.nearestDesc(i,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function ub(t){return t.top<t.bottom||t.left<t.right}function Kr(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(ub(r))return r}return Array.prototype.find.call(n,ub)||t.getBoundingClientRect()}const uD=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function nS(t,e,n){let{node:r,offset:o,atom:s}=t.docView.domFromPos(e,n<0?-1:1),i=Za||$n;if(r.nodeType==3)if(i&&(uD.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let l=Kr(Tr(r,o,o),n);if($n&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=Kr(Tr(r,o-1,o-1),-1);if(c.top==l.top){let u=Kr(Tr(r,o,o+1),-1);if(u.top!=l.top)return Li(u,u.left<c.left)}}return l}else{let l=o,c=o,u=n<0?1:-1;return n<0&&!o?(c++,u=-1):n>=0&&o==r.nodeValue.length?(l--,u=1):n<0?l--:c++,Li(Kr(Tr(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&o&&(n<0||o==An(r))){let l=r.childNodes[o-1];if(l.nodeType==1)return pf(l.getBoundingClientRect(),!1)}if(s==null&&o<An(r)){let l=r.childNodes[o];if(l.nodeType==1)return pf(l.getBoundingClientRect(),!0)}return pf(r.getBoundingClientRect(),n>=0)}if(s==null&&o&&(n<0||o==An(r))){let l=r.childNodes[o-1],c=l.nodeType==3?Tr(l,An(l)-(i?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Li(Kr(c,1),!1)}if(s==null&&o<An(r)){let l=r.childNodes[o];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Tr(l,0,i?0:1):l.nodeType==1?l:null:null;if(c)return Li(Kr(c,-1),!0)}return Li(Kr(r.nodeType==3?Tr(r):r,-n),n>=0)}function Li(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 pf(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 rS(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function dD(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return rS(t,e,()=>{let{node:s}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let i=nS(t,o.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Tr(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?i.top-u.top>(u.bottom-i.top)*2:u.bottom-i.bottom>(i.bottom-u.top)*2))return!1}}return!0})}const fD=/[\u0590-\u08ac]/;function hD(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,s=!o,i=o==r.parent.content.size,a=t.domSelection();return a?!fD.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:i:rS(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:g}=t.domSelectionRange(),m=p&&!h.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==g;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),m}):r.pos==r.start()||r.pos==r.end()}let db=null,fb=null,hb=!1;function pD(t,e,n){return db==e&&fb==n?hb:(db=e,fb=n,hb=n=="up"||n=="down"?dD(t,e,n):hD(t,e,n))}const Dn=0,pb=1,Ko=2,ur=3;class Ga{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=Dn,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let o=this.children[n];if(o==e)return r;r+=o.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,i;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((i=s.pmViewDesc)&&i.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(i)+i.size:this.posAtStart}else{let s,i;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((i=s.pmViewDesc)&&i.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(i):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>Vt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!1;break}if(s.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!0;break}if(s.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let s=this.getDesc(o),i;if(s&&(!n||s.node))if(r&&(i=s.nodeDOM)&&!(i.nodeType==1?i.contains(e.nodeType==1?e:e.parentNode):i==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 o=e;o;o=o.parentNode){let s=this.getDesc(o);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],s=r+o.size;if(r==e&&s!=r){for(;!o.border&&o.children.length;)for(let i=0;i<o.children.length;i++){let a=o.children[i];if(a.size){o=a;break}}return o}if(e<s)return o.descAt(e-r-o.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let s=0;r<this.children.length;r++){let i=this.children[r],a=s+i.size;if(a>e||i instanceof sS){o=e-s;break}s=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof oS&&s.side>=0;r--);if(n<=0){let s,i=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,i=!1);return s&&n&&i&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Vt(s.dom)+1:0}}else{let s,i=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,i=!1);return s&&i&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?Vt(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 o=-1,s=-1;for(let i=r,a=0;;a++){let l=this.children[a],c=i+l.size;if(o==-1&&e<=c){let u=i+l.border;if(e>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=i;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=Vt(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=Vt(d.dom);break}n+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}i=c}return{node:this.contentDOM,from:e,to:n,fromOffset:o,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,o=!1){let s=Math.min(e,n),i=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let g=this.children[h],m=p+g.size;if(s>p&&i<m)return g.setSelection(e-p-g.border,n-p-g.border,r,o);p=m}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if(($n||Yt)&&e==n){let{node:h,offset:p}=a;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
|
|
18
|
-
`),d&&p==h.nodeValue.length)for(let g=h,m;g;g=g.parentNode){if(m=g.nextSibling){m.nodeName=="BR"&&(a=l={node:m.parentNode,offset:Vt(m)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=h.childNodes[p-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if($n&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(o=!0)}if(!(o||d&&Yt)&&hs(a.node,a.offset,u.anchorNode,u.anchorOffset)&&hs(l.node,l.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(d&&$n)){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(e>n){let p=a;a=l,l=p}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(h)}}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,o=0;o<this.children.length;o++){let s=this.children[o],i=r+s.size;if(r==i?e<=i&&n>=r:e<i&&n>r){let a=r+s.border,l=i-s.border;if(e>=a&&n<=l){this.dirty=e==r||n==i?Ko:pb,e==a&&n==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=ur:s.markDirty(e-a,n-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Ko:ur}r=i}this.dirty=Ko}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Ko:pb;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class oS extends Ga{constructor(e,n,r,o){let s,i=n.type.toDOM;if(typeof i=="function"&&(i=i(r,()=>{if(!s)return o;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(i.nodeType!=1){let a=document.createElement("span");a.appendChild(i),i=a}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Dn&&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 mD extends Ga{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}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 ps extends Ga{constructor(e,n,r,o,s){super(e,[],r,o),this.mark=n,this.spec=s}static create(e,n,r,o){let s=o.nodeViews[n.type.name],i=s&&s(n,o,r);return(!i||!i.dom)&&(i=Es.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ps(e,n,i.dom,i.contentDOM||i.dom,i)}parseRule(){return this.dirty&ur||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ur&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Dn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Dn}}slice(e,n,r){let o=ps.create(this.parent,this.mark,!0,r),s=this.children,i=this.size;n<i&&(s=Ah(s,n,i,r)),e>0&&(s=Ah(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=o;return o.children=s,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class fo extends Ga{constructor(e,n,r,o,s,i,a,l,c){super(e,[],s,i),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=a}static create(e,n,r,o,s,i){let a=s.nodeViews[n.type.name],l,c=a&&a(n,s,()=>{if(!l)return i;if(l.parent)return l.parent.posBeforeChild(l)},r,o),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=Es.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=lS(u,r,n),c?l=new gD(e,n,r,o,u,d||null,f,c,s,i+1):n.isText?new wd(e,n,r,o,u,f,s):new fo(e,n,r,o,u,d||null,f,s,i+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>re.empty)}return e}matchesNode(e,n,r){return this.dirty==Dn&&e.eq(this.node)&&nu(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,o=n,s=e.composing?this.localCompositionInfo(e,n):null,i=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new bD(this,i&&i.node,e);kD(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e,u):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?lt.none:this.node.child(u).marks,r,e,u),l.placeWidget(c,e,o)},(c,u,d,f)=>{l.syncToMarks(c.marks,r,e,f);let h;l.findNodeMatch(c,u,d,f)||a&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(h=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(c,u,d,h,e)||l.updateNextNode(c,u,d,e,f,o)||l.addNode(c,u,d,e,o),o+=c.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Ko)&&(i&&this.protectLocalComposition(e,i),iS(this.contentDOM,this.children,e),bi&&xD(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof _e)||r<n||o>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 i=s.nodeValue,a=SD(this.node.content,i,r-n,o-n);return a<0?null:{node:s,pos:a,text:i}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){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 i=new mD(this,s,n,o);e.input.compositionNodes.push(i),this.children=Ah(this.children,r,r+o.length,e,i)}update(e,n,r,o){return this.dirty==ur||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Dn}updateOuterDeco(e){if(nu(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=aS(this.dom,this.nodeDOM,Ph(this.outerDeco,this.node,n),Ph(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 mb(t,e,n,r,o){lS(r,e,t);let s=new fo(void 0,t,e,n,r,r,r,o,0);return s.contentDOM&&s.updateChildren(o,0),s}class wd extends fo{constructor(e,n,r,o,s,i,a){super(e,n,r,o,s,null,i,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,o){return this.dirty==ur||this.dirty!=Dn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Dn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=Dn,!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 o=this.node.cut(e,n),s=document.createTextNode(o.text);return new wd(this.parent,o,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=ur)}get domAtom(){return!1}isText(e){return this.node.text==e}}class sS extends Ga{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Dn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class gD extends fo{constructor(e,n,r,o,s,i,a,l,c,u){super(e,n,r,o,s,i,a,c,u),this.spec=l}update(e,n,r,o){if(this.dirty==ur)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,o),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,o)}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 iS(t,e,n){let r=t.firstChild,o=!1;for(let s=0;s<e.length;s++){let i=e[s],a=i.dom;if(a.parentNode==t){for(;a!=r;)r=gb(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(a,r);if(i instanceof ps){let l=r?r.previousSibling:t.lastChild;iS(i.contentDOM,i.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=gb(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const da=function(t){t&&(this.nodeName=t)};da.prototype=Object.create(null);const Yo=[new da];function Ph(t,e,n){if(t.length==0)return Yo;let r=n?Yo[0]:new da,o=[r];for(let s=0;s<t.length;s++){let i=t[s].type.attrs;if(i){i.nodeName&&o.push(r=new da(i.nodeName));for(let a in i){let l=i[a];l!=null&&(n&&o.length==1&&o.push(r=new da(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return o}function aS(t,e,n,r){if(n==Yo&&r==Yo)return e;let o=e;for(let s=0;s<r.length;s++){let i=r[s],a=n[s];if(s){let l;a&&a.nodeName==i.nodeName&&o!=t&&(l=o.parentNode)&&l.nodeName.toLowerCase()==i.nodeName||(l=document.createElement(i.nodeName),l.pmIsDeco=!0,l.appendChild(o),a=Yo[0]),o=l}yD(o,a||Yo[0],i)}return o}function yD(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):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)o.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<o.length;s++)r.indexOf(o[s])==-1&&t.classList.add(o[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)t.style.removeProperty(o[1])}n.style&&(t.style.cssText+=n.style)}}function lS(t,e,n){return aS(t,t,Yo,Ph(e,n,t.nodeType!=1))}function nu(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 gb(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class bD{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=vD(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,o){let s=0,i=this.stack.length>>1,a=Math.min(i,e.length);for(;s<a&&(s==i-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<i;)this.destroyRest(),this.top.dirty=Dn,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let l=-1,c=this.top.children.length;o<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[i])&&!this.isLocked(d.dom)){l=u;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let u=ps.create(this.top,e[i],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,r,o){let s=-1,i;if(o>=this.preMatch.index&&(i=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&i.matchesNode(e,n,r))s=this.top.children.indexOf(i,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,o,s){let i=this.top.children[o];return i.dirty==ur&&i.dom==i.contentDOM&&(i.dirty=Ko),i.update(e,n,r,s)?(this.destroyBetween(this.index,o),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 o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=n}}updateNextNode(e,n,r,o,s,i){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof fo){let c=this.preMatch.matched.get(l);if(c!=null&&c!=s)return!1;let u=l.dom,d,f=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=ur&&nu(n,l.outerDeco));if(!f&&l.update(e,n,r,o))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(l,e,n,r,o,i)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Ko,d.updateChildren(o,i+1),d.dirty=Dn),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,s,i){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!nu(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let a=fo.create(this.top,n,r,o,s,i);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,o,s){let i=fo.create(this.top,e,n,r,o,s);i.contentDOM&&i.updateChildren(o,s+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let s=new oS(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 ps;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof wd)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Yt||Wt)&&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 o=new sS(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function vD(t,e){let n=e,r=n.children.length,o=t.childCount,s=new Map,i=[];e:for(;o>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof ps)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(o-1))break;--o,s.set(a,o),i.push(a)}}return{index:o,matched:s,matches:i.reverse()}}function wD(t,e){return t.type.side-e.type.side}function kD(t,e,n,r){let o=e.locals(t),s=0;if(o.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,o,e.forChild(s,u),c),s+=u.nodeSize}return}let i=0,a=[],l=null;for(let c=0;;){let u,d;for(;i<o.length&&o[i].to==s;){let m=o[i++];m.widget&&(u?(d||(d=[u])).push(m):u=m)}if(u)if(d){d.sort(wD);for(let m=0;m<d.length;m++)n(d[m],c,!!l)}else n(u,c,!!l);let f,h;if(l)h=-1,f=l,l=null;else if(c<t.childCount)h=c,f=t.child(c++);else break;for(let m=0;m<a.length;m++)a[m].to<=s&&a.splice(m--,1);for(;i<o.length&&o[i].from<=s&&o[i].to>s;)a.push(o[i++]);let p=s+f.nodeSize;if(f.isText){let m=p;i<o.length&&o[i].from<m&&(m=o[i].from);for(let y=0;y<a.length;y++)a[y].to<m&&(m=a[y].to);m<p&&(l=f.cut(m-s),f=f.cut(0,m-s),p=m,h=-1)}else for(;i<o.length&&o[i].to<p;)i++;let g=f.isInline&&!f.isLeaf?a.filter(m=>!m.inline):a.slice();r(f,g,e.forChild(s,f),h),s=p}}function xD(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 SD(t,e,n,r){for(let o=0,s=0;o<t.childCount&&s<=r;){let i=t.child(o++),a=s;if(s+=i.nodeSize,!i.isText)continue;let l=i.text;for(;o<t.childCount;){let c=t.child(o++);if(s+=c.nodeSize,!c.isText)break;l+=c.text}if(s>=n){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function Ah(t,e,n,r,o){let s=[];for(let i=0,a=0;i<t.length;i++){let l=t[i],c=a,u=a+=l.size;c>=n||u<=e?s.push(l):(c<e&&s.push(l.slice(0,e-c,r)),o&&(s.push(o),o=void 0),u>n&&s.push(l.slice(n-c,l.size,r)))}return s}function gm(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),s=o&&o.size==0,i=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(i<0)return null;let a=r.resolve(i),l,c;if(vd(n)){for(l=i;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&Ce.isSelectable(d)&&o.parent&&!(d.isInline&&G$(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;c=new Ce(i==f?a:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=i,f=i;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[l,i]=f==t.state.selection.anchor?[f,d]:[d,f],a=r.resolve(i)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=e=="pointer"||t.state.selection.head<a.pos&&!s?1:-1;c=ym(t,u,a,d)}return c}function cS(t){return t.editable?t.hasFocus():dS(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Ir(t,e=!1){let n=t.state.selection;if(uS(t,n),!!cS(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Wt){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&hs(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)CD(t);else{let{anchor:r,head:o}=n,s,i;yb&&!(n instanceof _e)&&(n.$from.parent.inlineContent||(s=bb(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(i=bb(t,n.to))),t.docView.setSelection(r,o,t,e),yb&&(s&&vb(s),i&&vb(i)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&ED(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const yb=Yt||Wt&&G1<63;function bb(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Yt&&o&&o.contentEditable=="false")return mf(o);if((!o||o.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(o)return mf(o);if(s)return mf(s)}}function mf(t){return t.contentEditable="true",Yt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function vb(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function ED(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!cS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function CD(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Vt(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&mn&&uo<=11&&(n.disabled=!0,n.disabled=!1)}function uS(t,e){if(e instanceof Ce){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(wb(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else wb(t)}function wb(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function ym(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||_e.between(e,n,r)}function kb(t){return t.editable&&!t.hasFocus()?!1:dS(t)}function dS(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 TD(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return hs(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Ih(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),s=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return s&&$e.findFrom(s,e)}function Yr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function xb(t,e,n){let r=t.state.selection;if(r instanceof _e)if(n.indexOf("s")>-1){let{$head:o}=r,s=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let i=t.state.doc.resolve(o.pos+s.nodeSize*(e<0?-1:1));return Yr(t,new _e(r.$anchor,i))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=Ih(t.state,e);return o&&o instanceof Ce?Yr(t,o):!1}else if(!(Pn&&n.indexOf("m")>-1)){let o=r.$head,s=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,i;if(!s||s.isText)return!1;let a=e<0?o.pos-s.nodeSize:o.pos;return s.isAtom||(i=t.docView.descAt(a))&&!i.contentDOM?Ce.isSelectable(s)?Yr(t,new Ce(e<0?t.state.doc.resolve(o.pos-s.nodeSize):o)):Za?Yr(t,new _e(t.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Ce&&r.node.isInline)return Yr(t,new _e(e>0?r.$to:r.$from));{let o=Ih(t.state,e);return o?Yr(t,o):!1}}}function ru(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function fa(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ps(t,e){return e<0?MD(t):RD(t)}function MD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,s,i=!1;for($n&&n.nodeType==1&&r<ru(n)&&fa(n.childNodes[r],-1)&&(i=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(fa(a,-1))o=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(fS(n))break;{let a=n.previousSibling;for(;a&&fa(a,-1);)o=n.parentNode,s=Vt(a),a=a.previousSibling;if(a)n=a,r=ru(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}i?$h(t,n,r):o&&$h(t,o,s)}function RD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=ru(n),s,i;for(;;)if(r<o){if(n.nodeType!=1)break;let a=n.childNodes[r];if(fa(a,1))s=n,i=++r;else break}else{if(fS(n))break;{let a=n.nextSibling;for(;a&&fa(a,1);)s=a.parentNode,i=Vt(a)+1,a=a.nextSibling;if(a)n=a,r=0,o=ru(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}s&&$h(t,s,i)}function fS(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function OD(t,e){for(;t&&e==t.childNodes.length&&!Ya(t);)e=Vt(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 _D(t,e){for(;t&&!e&&!Ya(t);)e=Vt(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 $h(t,e,n){if(e.nodeType!=3){let s,i;(i=OD(e,n))?(e=i,n=0):(s=_D(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(vd(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:o}=t;setTimeout(()=>{t.state==o&&Ir(t)},50)}function Sb(t,e){let n=t.state.doc.resolve(e);if(!(Wt||J1)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),i=(s.top+s.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(s.left-o.left)>1)return s.left<o.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),i=(s.top+s.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(s.left-o.left)>1)return s.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Eb(t,e,n){let r=t.state.selection;if(r instanceof _e&&!r.empty||n.indexOf("s")>-1||Pn&&n.indexOf("m")>-1)return!1;let{$from:o,$to:s}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let i=Ih(t.state,e);if(i&&i instanceof Ce)return Yr(t,i)}if(!o.parent.inlineContent){let i=e<0?o:s,a=r instanceof En?$e.near(i,e):$e.findFrom(i,e);return a?Yr(t,a):!1}return!1}function Cb(t,e){if(!(t.state.selection instanceof _e))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)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 i=t.state.tr;return e<0?i.delete(n.pos-s.nodeSize,n.pos):i.delete(n.pos,n.pos+s.nodeSize),t.dispatch(i),!0}return!1}function Tb(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function ND(t){if(!Yt||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;Tb(t,r,"true"),setTimeout(()=>Tb(t,r,"false"),20)}return!1}function PD(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function AD(t,e){let n=e.keyCode,r=PD(e);if(n==8||Pn&&n==72&&r=="c")return Cb(t,-1)||Ps(t,-1);if(n==46&&!e.shiftKey||Pn&&n==68&&r=="c")return Cb(t,1)||Ps(t,1);if(n==13||n==27)return!0;if(n==37||Pn&&n==66&&r=="c"){let o=n==37?Sb(t,t.state.selection.from)=="ltr"?-1:1:-1;return xb(t,o,r)||Ps(t,o)}else if(n==39||Pn&&n==70&&r=="c"){let o=n==39?Sb(t,t.state.selection.from)=="ltr"?1:-1:1;return xb(t,o,r)||Ps(t,o)}else{if(n==38||Pn&&n==80&&r=="c")return Eb(t,-1,r)||Ps(t,-1);if(n==40||Pn&&n==78&&r=="c")return ND(t)||Eb(t,1,r)||Ps(t,1);if(r==(Pn?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function bm(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:o,openEnd:s}=e;for(;o>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,s--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let i=t.someProp("clipboardSerializer")||Es.fromSchema(t.state.schema),a=bS(),l=a.createElement("div");l.appendChild(i.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=yS[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=a.createElement(u[h]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
|
|
19
|
-
|
|
20
|
-
`);return{dom:l,text:f,slice:e}}function hS(t,e,n,r,o){let s=o.parent.type.spec.code,i,a;if(!n&&!e)return null;let l=!!e&&(r||s||!n);if(l){if(t.someProp("transformPastedText",f=>{e=f(e,s||r,t)}),s)return a=new pe(re.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
21
|
-
`))),0,0),t.someProp("transformPasted",f=>{a=f(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",f=>f(e,o,r,t));if(d)a=d;else{let f=o.marks(),{schema:h}=t.state,p=Es.fromSchema(h);i=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=i.appendChild(document.createElement("p"));g&&m.appendChild(p.serializeNode(h.text(g,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),i=zD(n),Za&&LD(i);let c=i&&i.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=i.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;i=f}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||co.fromSchema(t.state.schema)).parseSlice(i,{preserveWhitespace:!!(l||u),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!ID.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=jD(Mb(a,+u[1],+u[2]),u[4]);else if(a=pe.maxOpen($D(a.content,o),!0),a.openStart||a.openEnd){let d=0,f=0;for(let h=a.content.firstChild;d<a.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=a.content.lastChild;f<a.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);a=Mb(a,d,f)}return t.someProp("transformPasted",d=>{a=d(a,t,l)}),a}const ID=/^(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 $D(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),s,i=[];if(t.forEach(a=>{if(!i)return;let l=o.findWrapping(a.type),c;if(!l)return i=null;if(c=i.length&&s.length&&mS(l,s,a,i[i.length-1],0))i[i.length-1]=c;else{i.length&&(i[i.length-1]=gS(i[i.length-1],s.length));let u=pS(a,l);i.push(u),o=o.matchType(u.type),s=l}}),i)return re.from(i)}return t}function pS(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,re.from(t));return t}function mS(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let s=mS(t,e,n,r.lastChild,o+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(re.from(pS(n,t,o+1))))}}function gS(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,gS(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(re.empty,!0);return t.copy(n.append(r))}function Dh(t,e,n,r,o,s){let i=e<0?t.firstChild:t.lastChild,a=i.content;return t.childCount>1&&(s=0),o<r-1&&(a=Dh(a,e,n,r,o+1,s)),o>=n&&(a=e<0?i.contentMatchAt(0).fillBefore(a,s<=o).append(a):a.append(i.contentMatchAt(i.childCount).fillBefore(re.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,i.copy(a))}function Mb(t,e,n){return e<t.openStart&&(t=new pe(Dh(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new pe(Dh(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const yS={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Rb=null;function bS(){return Rb||(Rb=document.implementation.createHTMLDocument("title"))}let gf=null;function DD(t){let e=window.trustedTypes;return e?(gf||(gf=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),gf.createHTML(t)):t}function zD(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=bS().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&yS[r[1].toLowerCase()])&&(t=o.map(s=>"<"+s+">").join("")+t+o.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=DD(t),o)for(let s=0;s<o.length;s++)n=n.querySelector(o[s])||n;return n}function LD(t){let e=t.querySelectorAll(Wt?"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 jD(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:o,openStart:s,openEnd:i}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;o=re.from(l.create(r[a+1],o)),s++,i++}return new pe(o,s,i)}const sn={},an={},FD={touchstart:!0,touchmove:!0};class BD{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 VD(t){for(let e in sn){let n=sn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{WD(t,r)&&!vm(t,r)&&(t.editable||!(r.type in an))&&n(t,r)},FD[e]?{passive:!0}:void 0)}Yt&&t.dom.addEventListener("input",()=>null),zh(t)}function no(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function HD(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function zh(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>vm(t,r))})}function vm(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function WD(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 qD(t,e){!vm(t,e)&&sn[e.type]&&(t.editable||!(e.type in an))&&sn[e.type](t,e)}an.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!wS(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Rr&&Wt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),bi&&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",o=>o(t,Ho(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||AD(t,n)?n.preventDefault():no(t,"key")};an.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};an.keypress=(t,e)=>{let n=e;if(wS(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Pn&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof _e)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",i=>i(t,r.$from.pos,r.$to.pos,o,s))&&t.dispatch(s()),n.preventDefault()}};function kd(t){return{left:t.clientX,top:t.clientY}}function UD(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function wm(t,e,n,r,o){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let i=s.depth+1;i>0;i--)if(t.someProp(e,a=>i>s.depth?a(t,n,s.nodeAfter,s.before(i),o,!0):a(t,n,s.node(i),s.before(i),o,!1)))return!0;return!1}function oi(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 KD(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Ce.isSelectable(r)?(oi(t,new Ce(n)),!0):!1}function YD(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof Ce&&(r=n.node);let s=t.state.doc.resolve(e);for(let i=s.depth+1;i>0;i--){let a=i>s.depth?s.nodeAfter:s.node(i);if(Ce.isSelectable(a)){r&&n.$from.depth>0&&i>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?o=s.before(n.$from.depth):o=s.before(i);break}}return o!=null?(oi(t,Ce.create(t.state.doc,o)),!0):!1}function ZD(t,e,n,r,o){return wm(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(o?YD(t,n):KD(t,n))}function GD(t,e,n,r){return wm(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function JD(t,e,n,r){return wm(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||XD(t,n,r)}function XD(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(oi(t,_e.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let s=o.depth+1;s>0;s--){let i=s>o.depth?o.nodeAfter:o.node(s),a=o.before(s);if(i.inlineContent)oi(t,_e.create(r,a+1,a+1+i.content.size));else if(Ce.isSelectable(i))oi(t,Ce.create(r,a));else continue;return!0}}function km(t){return ou(t)}const vS=Pn?"metaKey":"ctrlKey";sn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=km(t),o=Date.now(),s="singleClick";o-t.input.lastClick.time<500&&UD(n,t.input.lastClick)&&!n[vS]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:s,button:n.button};let i=t.posAtCoords(kd(n));i&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new QD(t,i,n,!!r)):(s=="doubleClick"?GD:JD)(t,i.pos,i.inside,n)?n.preventDefault():no(t,"pointer"))};class QD{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[vS],this.allowDefault=r.shiftKey;let s,i;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),i=n.inside;else{let u=e.state.doc.resolve(n.pos);s=u.parent,i=u.depth?u.before():0}const a=o?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof Ce&&c.from<=i&&c.to>i)&&(this.mightDrag={node:s,pos:i,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&$n&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),no(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Ir(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(kd(e))),this.updateAllowDefault(e),this.allowDefault||!n?no(this.view,"pointer"):ZD(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Yt&&this.mightDrag&&!this.mightDrag.node.isAtom||Wt&&!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)?(oi(this.view,$e.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):no(this.view,"pointer")}move(e){this.updateAllowDefault(e),no(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}sn.touchstart=t=>{t.input.lastTouch=Date.now(),km(t),no(t,"pointer")};sn.touchmove=t=>{t.input.lastTouch=Date.now(),no(t,"pointer")};sn.contextmenu=t=>km(t);function wS(t,e){return t.composing?!0:Yt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const e2=Rr?5e3:-1;an.compositionstart=an.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof _e&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Wt&&J1&&t2(t)))t.markCursor=t.state.storedMarks||n.marks(),ou(t,!0),t.markCursor=null;else if(ou(t,!e.selection.empty),$n&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,s=r.focusOffset;o&&o.nodeType==1&&s!=0;){let i=s<0?o.lastChild:o.childNodes[s-1];if(!i)break;if(i.nodeType==3){let a=t.domSelection();a&&a.collapse(i,i.nodeValue.length);break}else o=i,s=-1}}t.input.composing=!0}kS(t,e2)};function t2(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"}an.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,kS(t,20))};function kS(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ou(t),e))}function xS(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=r2());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function n2(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=Y$(e.focusNode,e.focusOffset),r=Z$(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let i=n.pmViewDesc;if(!(!i||!i.isText(n.nodeValue)))return r}}return n||r}function r2(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function ou(t,e=!1){if(!(Rr&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),xS(t),e||t.docView&&t.docView.dirty){let n=gm(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 o2(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(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Pa=mn&&uo<15||bi&&Q$<604;sn.copy=an.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let s=Pa?null:n.clipboardData,i=r.content(),{dom:a,text:l}=bm(t,i);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):o2(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function s2(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function i2(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 o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Aa(t,r.value,null,o,e):Aa(t,r.textContent,r.innerHTML,o,e)},50)}function Aa(t,e,n,r,o){let s=hS(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,o,s||pe.empty)))return!0;if(!s)return!1;let i=s2(s),a=i?t.state.tr.replaceSelectionWith(i,r):t.state.tr.replaceSelection(s);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function SS(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," "):""}an.paste=(t,e)=>{let n=e;if(t.composing&&!Rr)return;let r=Pa?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Aa(t,SS(r),r.getData("text/html"),o,n)?n.preventDefault():i2(t,n)};class ES{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const a2=Pn?"altKey":"ctrlKey";function CS(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[a2]}sn.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,s=o.empty?null:t.posAtCoords(kd(n)),i;if(!(s&&s.pos>=o.from&&s.pos<=(o instanceof Ce?o.to-1:o.to))){if(r&&r.mightDrag)i=Ce.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(i=Ce.create(t.state.doc,d.posBefore))}}let a=(i||t.state.selection).content(),{dom:l,text:c,slice:u}=bm(t,a);(!n.dataTransfer.files.length||!Wt||G1>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Pa?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Pa||n.dataTransfer.setData("text/plain",c),t.dragging=new ES(u,CS(t,n),i)};sn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};an.dragover=an.dragenter=(t,e)=>e.preventDefault();an.drop=(t,e)=>{try{l2(t,e,t.dragging)}finally{t.dragging=null}};function l2(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(kd(e));if(!r)return;let o=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",h=>{s=h(s,t,!1)}):s=hS(t,SS(e.dataTransfer),Pa?null:e.dataTransfer.getData("text/html"),!1,o);let i=!!(n&&CS(t,e));if(t.someProp("handleDrop",h=>h(t,e,s||pe.empty,i))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?O1(t.state.doc,o.pos,s):o.pos;a==null&&(a=o.pos);let l=t.state.tr;if(i){let{node:h}=n;h?h.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,s.content.firstChild):l.replaceRange(c,c,s),l.doc.eq(d))return;let f=l.doc.resolve(c);if(u&&Ce.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new Ce(f));else{let h=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((p,g,m,y)=>h=y),l.setSelection(ym(t,f,l.doc.resolve(h)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}sn.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())&&Ir(t)},20))};sn.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)};sn.beforeinput=(t,e)=>{if(Wt&&Rr&&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,Ho(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in an)sn[t]=an[t];function Ia(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 su{constructor(e,n){this.toDOM=e,this.spec=n||ts,this.side=this.spec.side||0}map(e,n,r,o){let{pos:s,deleted:i}=e.mapResult(n.from+o,this.side<0?-1:1);return i?null:new nn(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof su&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ia(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ho{constructor(e,n){this.attrs=e,this.spec=n||ts}map(e,n,r,o){let s=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,i=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return s>=i?null:new nn(s,i,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof ho&&Ia(this.attrs,e.attrs)&&Ia(this.spec,e.spec)}static is(e){return e.type instanceof ho}destroy(){}}class xm{constructor(e,n){this.attrs=e,this.spec=n||ts}map(e,n,r,o){let s=e.mapResult(n.from+o,1);if(s.deleted)return null;let i=e.mapResult(n.to+o,-1);return i.deleted||i.pos<=s.pos?null:new nn(s.pos-r,i.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),s;return o==n.from&&!(s=e.child(r)).isText&&o+s.nodeSize==n.to}eq(e){return this==e||e instanceof xm&&Ia(this.attrs,e.attrs)&&Ia(this.spec,e.spec)}destroy(){}}class nn{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new nn(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 nn(e,e,new su(n,r))}static inline(e,n,r,o){return new nn(e,n,new ho(r,o))}static node(e,n,r,o){return new nn(e,n,new xm(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof ho}get widget(){return this.type instanceof su}}const Fs=[],ts={};class mt{constructor(e,n){this.local=e.length?e:Fs,this.children=n.length?n:Fs}static create(e,n){return n.length?iu(n,e,0,ts):qt}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,s){for(let i=0;i<this.local.length;i++){let a=this.local[i];a.from<=n&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<n&&this.children[i+1]>e){let a=this.children[i]+1;this.children[i+2].findInner(e-a,n-a,r,o+a,s)}}map(e,n,r){return this==qt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||ts)}mapInner(e,n,r,o,s){let i;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,o);l&&l.type.valid(n,l)?(i||(i=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?c2(this.children,i||[],e,n,r,o,s):i?new mt(i.sort(ns),Fs):qt}add(e,n){return n.length?this==qt?mt.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,s=0;e.forEach((a,l)=>{let c=l+r,u;if(u=MS(n,a,c)){for(o||(o=this.children.slice());s<o.length&&o[s]<l;)s+=3;o[s]==l?o[s+2]=o[s+2].addInner(a,u,c+1):o.splice(s,0,l,l+a.nodeSize,iu(u,a,c+1,ts)),s+=3}});let i=TS(s?RS(n):n,-r);for(let a=0;a<i.length;a++)i[a].type.valid(e,i[a])||i.splice(a--,1);return new mt(i.length?this.local.concat(i).sort(ns):this.local,o||this.children)}remove(e){return e.length==0||this==qt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let s=0;s<r.length;s+=3){let i,a=r[s]+n,l=r[s+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(i||(i=[])).push(d));if(!i)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(i,a+1);c!=qt?r[s+2]=c:(r.splice(s,3),s-=3)}if(o.length){for(let s=0,i;s<e.length;s++)if(i=e[s])for(let a=0;a<o.length;a++)o[a].eq(i,n)&&(o==this.local&&(o=this.local.slice()),o.splice(a--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new mt(o,r):qt}forChild(e,n){if(this==qt)return this;if(n.isLeaf)return mt.empty;let r,o;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,i=s+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<i&&l.to>s&&l.type instanceof ho){let c=Math.max(s,l.from)-s,u=Math.min(i,l.to)-s;c<u&&(o||(o=[])).push(l.copy(c,u))}}if(o){let a=new mt(o.sort(ns),Fs);return r?new Jr([a,r]):a}return r||qt}eq(e){if(this==e)return!0;if(!(e instanceof mt)||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 Sm(this.localsInner(e))}localsInner(e){if(this==qt)return Fs;if(e.inlineContent||!this.local.some(ho.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ho||n.push(this.local[r]);return n}forEachSet(e){e(this)}}mt.empty=new mt([],[]);mt.removeOverlap=Sm;const qt=mt.empty;class Jr{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,ts));return Jr.from(r)}forChild(e,n){if(n.isLeaf)return mt.empty;let r=[];for(let o=0;o<this.members.length;o++){let s=this.members[o].forChild(e,n);s!=qt&&(s instanceof Jr?r=r.concat(s.members):r.push(s))}return Jr.from(r)}eq(e){if(!(e instanceof Jr)||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 o=0;o<this.members.length;o++){let s=this.members[o].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let i=0;i<s.length;i++)n.push(s[i])}}return n?Sm(r?n:n.sort(ns)):Fs}static from(e){switch(e.length){case 0:return qt;case 1:return e[0];default:return new Jr(e.every(n=>n instanceof mt)?e:e.reduce((n,r)=>n.concat(r instanceof mt?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function c2(t,e,n,r,o,s,i){let a=t.slice();for(let c=0,u=s;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,p,g)=>{let m=g-p-(h-f);for(let y=0;y<a.length;y+=3){let b=a[y+1];if(b<0||f>b+u-d)continue;let w=a[y]+u-d;h>=w?a[y+1]=f<=w?-2:-1:f>=u&&m&&(a[y]+=m,a[y+1]+=m)}d+=m}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(t[c]+s),d=u-o;if(d<0||d>=r.content.size){l=!0;continue}let f=n.map(t[c+1]+s,-1),h=f-o,{index:p,offset:g}=r.content.findIndex(d),m=r.maybeChild(p);if(m&&g==d&&g+m.nodeSize==h){let y=a[c+2].mapInner(n,m,u+1,t[c]+s+1,i);y!=qt?(a[c]=d,a[c+1]=h,a[c+2]=y):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=u2(a,t,e,n,o,s,i),u=iu(c,r,0,i);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<a.length&&a[f]<h;)f+=3;a.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new mt(e.sort(ns),a)}function TS(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new nn(o.from+e,o.to+e,o.type))}return n}function u2(t,e,n,r,o,s,i){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,o,c);d?n.push(d):i.onRemove&&i.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+s+1);return n}function MS(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let s=0,i;s<t.length;s++)(i=t[s])&&i.from>n&&i.to<r&&((o||(o=[])).push(i),t[s]=null);return o}function RS(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function iu(t,e,n,r){let o=[],s=!1;e.forEach((a,l)=>{let c=MS(t,a,l+n);if(c){s=!0;let u=iu(c,a,n+l+1,r);u!=qt&&o.push(l,l+a.nodeSize,u)}});let i=TS(s?RS(t):t,-n).sort(ns);for(let a=0;a<i.length;a++)i[a].type.valid(e,i[a])||(r.onRemove&&r.onRemove(i[a].spec),i.splice(a--,1));return i.length||o.length?new mt(i,o):qt}function ns(t,e){return t.from-e.from||t.to-e.to}function Sm(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let s=e[o];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[o]=s.copy(s.from,r.to),Ob(e,o+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),Ob(e,o,r.copy(s.from,r.to)));break}}}return e}function Ob(t,e,n){for(;e<t.length&&ns(n,t[e])>0;)e++;t.splice(e,0,n)}function yf(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=qt&&e.push(r)}),t.cursorWrapper&&e.push(mt.create(t.state.doc,[t.cursorWrapper.deco])),Jr.from(e)}const d2={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},f2=mn&&uo<=11;let h2=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}};class p2{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new h2,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);mn&&uo<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():Yt&&e.composing&&r.some(o=>o.type=="childList"&&o.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),f2&&(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,d2)),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(kb(this.view)){if(this.suppressingSelectionUpdates)return Ir(this.view);if(mn&&uo<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&hs(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=yi(s))n.add(s);for(let s=e.anchorNode;s;s=yi(s))if(n.has(s)){r=s;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.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(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&kb(e)&&!this.ignoreSelectionChange(r),s=-1,i=-1,a=!1,l=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(s=s<0?d.from:Math.min(d.from,s),i=i<0?d.to:Math.max(d.to,i),d.typeOver&&(a=!0))}if(l.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of l)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;d&&d.nodeType==1&&d.contentEditable=="false"&&u.parentNode.removeChild(u)}}else if($n&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||y2(e,d)!=h)&&f.remove()}}}let c=null;s<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&vd(r)&&(c=gm(e))&&c.eq($e.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Ir(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||o)&&(s>-1&&(e.docView.markDirty(s,i),m2(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,b2(e,l)),this.handleDOMChange(s,i,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ir(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,s=e.nextSibling;if(mn&&uo<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let i=o&&o.parentNode==e.target?Vt(o)+1:0,a=r.localPosFromDOM(e.target,i,-1),l=s&&s.parentNode==e.target?Vt(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let _b=new WeakMap,Nb=!1;function m2(t){if(!_b.has(t)&&(_b.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=$n,Nb)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."),Nb=!0}}function Pb(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,s=e.endOffset,i=t.domAtPos(t.state.selection.anchor);return hs(i.node,i.offset,o,s)&&([n,r,o,s]=[o,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:s}}function g2(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return Pb(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Pb(t,n):null}function y2(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 b2(t,e){var n;let{focusNode:r,focusOffset:o}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let i=s.nextSibling;for(;i&&i.nodeName!="TD"&&i.nodeName!="TH";)i=i.nextSibling;if(i){let a=i;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(s,a.firstChild),r==s&&t.domSelection().collapse(s,o)}else s.parentNode.removeChild(s)}}function v2(t,e,n){let{node:r,fromOffset:o,toOffset:s,from:i,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,u=l.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],vd(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Wt&&t.input.lastKeyCode===8)for(let m=s;m>o;m--){let y=r.childNodes[m-1],b=y.pmViewDesc;if(y.nodeName=="BR"&&!b){s=m;break}if(!b||b.size)break}let d=t.state.doc,f=t.someProp("domParser")||co.fromSchema(t.state.schema),h=d.resolve(i),p=null,g=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:o,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:w2,context:h});if(c&&c[0].pos!=null){let m=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=m),p={anchor:m+i,head:y+i}}return{doc:g,sel:p,from:i,to:a}}function w2(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Yt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Yt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const k2=/^(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 x2(t,e,n,r,o){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let E=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,C=gm(t,E);if(C&&!t.state.selection.eq(C)){if(Wt&&Rr&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",z=>z(t,Ho(13,"Enter"))))return;let A=t.state.tr.setSelection(C);E=="pointer"?A.setMeta("pointer",!0):E=="key"&&A.scrollIntoView(),s&&A.setMeta("composition",s),t.dispatch(A)}return}let i=t.state.doc.resolve(e),a=i.sharedDepth(n);e=i.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=v2(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=C2(d.content,c.doc.content,c.from,f,h);if(p&&t.input.domChangeCount++,(bi&&t.input.lastIOSEnter>Date.now()-225||Rr)&&o.some(E=>E.nodeType==1&&!k2.test(E.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",E=>E(t,Ho(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof _e&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let E=Ab(t,t.state.doc,c.sel);if(E&&!E.eq(t.state.selection)){let C=t.state.tr.setSelection(E);s&&C.setMeta("composition",s),t.dispatch(C)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof _e&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),mn&&uo<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" "&&(p.start--,p.endA--,p.endB--);let g=c.doc.resolveNoCache(p.start-c.from),m=c.doc.resolveNoCache(p.endB-c.from),y=u.resolve(p.start),b=g.sameParent(m)&&g.parent.inlineContent&&y.end()>=p.endA;if((bi&&t.input.lastIOSEnter>Date.now()-225&&(!b||o.some(E=>E.nodeName=="DIV"||E.nodeName=="P"))||!b&&g.pos<c.doc.content.size&&(!g.sameParent(m)||!g.parent.inlineContent)&&g.pos<m.pos&&!/\S/.test(c.doc.textBetween(g.pos,m.pos,"","")))&&t.someProp("handleKeyDown",E=>E(t,Ho(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&E2(u,p.start,p.endA,g,m)&&t.someProp("handleKeyDown",E=>E(t,Ho(8,"Backspace")))){Rr&&Wt&&t.domObserver.suppressSelectionUpdates();return}Wt&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),Rr&&!b&&g.start()!=m.start()&&m.parentOffset==0&&g.depth==m.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,m=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(E){return E(t,Ho(13,"Enter"))})},20));let w=p.start,k=p.endA,v=E=>{let C=E||t.state.tr.replace(w,k,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let A=Ab(t,C.doc,c.sel);A&&!(Wt&&t.composing&&A.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(A.head==w||A.head==C.mapping.map(k)-1)||mn&&A.empty&&A.head==w)&&C.setSelection(A)}return s&&C.setMeta("composition",s),C.scrollIntoView()},x;if(b)if(g.pos==m.pos){mn&&uo<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ir(t),20));let E=v(t.state.tr.delete(w,k)),C=u.resolve(p.start).marksAcross(u.resolve(p.endA));C&&E.ensureMarks(C),t.dispatch(E)}else if(p.endA==p.endB&&(x=S2(g.parent.content.cut(g.parentOffset,m.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let E=v(t.state.tr);x.type=="add"?E.addMark(w,k,x.mark):E.removeMark(w,k,x.mark),t.dispatch(E)}else if(g.parent.child(g.index()).isText&&g.index()==m.index()-(m.textOffset?0:1)){let E=g.parent.textBetween(g.parentOffset,m.parentOffset),C=()=>v(t.state.tr.insertText(E,w,k));t.someProp("handleTextInput",A=>A(t,w,k,E,C))||t.dispatch(C())}else t.dispatch(v());else t.dispatch(v())}function Ab(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:ym(t,e.resolve(n.anchor),e.resolve(n.head))}function S2(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,s=r,i,a,l;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)s=n[u].removeFromSet(s);if(o.length==1&&s.length==0)a=o[0],i="add",l=u=>u.mark(a.addToSet(u.marks));else if(o.length==0&&s.length==1)a=s[0],i="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(re.from(c).eq(t))return{mark:a,type:i}}function E2(t,e,n,r,o){if(n-e<=o.pos-r.pos||bf(r,!0,!1)<o.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&n==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let i=t.resolve(bf(s,!0,!0));return!i.parent.isTextblock||i.pos>n||bf(i,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(i.parent.content)}function bf(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,o++}return o}function C2(t,e,n,r,o){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:i,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let l=Math.max(0,s-Math.min(i,a));r-=i+l-s}if(i<s&&t.size<e.size){let l=r<=s&&r>=i?s-r:0;s-=l,s&&s<e.size&&Ib(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-i),i=s}else if(a<s){let l=r<=s&&r>=a?s-r:0;s-=l,s&&s<t.size&&Ib(t.textBetween(s-1,s+1))&&(s+=l?1:-1),i=s+(i-a),a=s}return{start:s,endA:i,endB:a}}function Ib(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class OS{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 BD,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(jb),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=zb(this),Db(this),this.nodeViews=Lb(this),this.docView=mb(this.state.doc,$b(this),yf(this),this.dom,this),this.domObserver=new p2(this,(r,o,s,i)=>x2(this,r,o,s,i)),this.domObserver.start(),VD(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&&zh(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(jb),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 o=this.state,s=!1,i=!1;e.storedMarks&&this.composing&&(xS(this),i=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=Lb(this);M2(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&zh(this),this.editable=zb(this),Db(this);let l=yf(this),c=$b(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(o.selection))&&(i=!0);let f=u=="preserve"&&i&&this.dom.style.overflowAnchor==null&&nD(this);if(i){this.domObserver.stop();let h=d&&(mn||Wt)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&T2(o.selection,e.selection);if(d){let p=Wt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=n2(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=mb(e.doc,c,l,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&TD(this))?Ir(this,h):(uS(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&rD(f)}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 Ce){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&cb(this,n.getBoundingClientRect(),e)}else cb(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,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(o=s)}this.dragging=new ES(e.slice,e.move,o<0?void 0:Ce.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let i=0;i<this.directPlugins.length;i++){let a=this.directPlugins[i].props[e];if(a!=null&&(o=n?n(a):a))return o}let s=this.state.plugins;if(s)for(let i=0;i<s.length;i++){let a=s[i].props[e];if(a!=null&&(o=n?n(a):a))return o}}hasFocus(){if(mn){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&&oD(this.dom),Ir(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 cD(this,e)}coordsAtPos(e,n=1){return nS(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 o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return pD(this,n||this.state,e)}pasteHTML(e,n){return Aa(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Aa(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return bm(this,e)}destroy(){this.docView&&(HD(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],yf(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,U$())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return qD(this,e)}domSelectionRange(){let e=this.domSelection();return e?Yt&&this.root.nodeType===11&&J$(this.dom.ownerDocument)==this.dom&&g2(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}OS.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function $b(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"),[nn.node(0,t.state.doc.content.size,e)]}function Db(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:nn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function zb(t){return!t.someProp("editable",e=>e(t.state)===!1)}function T2(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 Lb(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function M2(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function jb(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 mo={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:"'"},au={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},R2=typeof navigator<"u"&&/Mac/.test(navigator.platform),O2=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ht=0;Ht<10;Ht++)mo[48+Ht]=mo[96+Ht]=String(Ht);for(var Ht=1;Ht<=24;Ht++)mo[Ht+111]="F"+Ht;for(var Ht=65;Ht<=90;Ht++)mo[Ht]=String.fromCharCode(Ht+32),au[Ht]=String.fromCharCode(Ht);for(var vf in mo)au.hasOwnProperty(vf)||(au[vf]=mo[vf]);function _2(t){var e=R2&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||O2&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?au:mo)[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 N2=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),P2=typeof navigator<"u"&&/Win/.test(navigator.platform);function A2(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,s,i;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))o=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))N2?i=!0:o=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),i&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function I2(t){let e=Object.create(null);for(let n in t)e[A2(n)]=t[n];return e}function wf(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 $2(t){return new yt({props:{handleKeyDown:_S(t)}})}function _S(t){let e=I2(t);return function(n,r){let o=_2(r),s,i=e[wf(o,r)];if(i&&i(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=e[wf(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(P2&&r.ctrlKey&&r.altKey)&&(s=mo[r.keyCode])&&s!=o){let a=e[wf(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var D2=Object.defineProperty,Em=(t,e)=>{for(var n in e)D2(t,n,{get:e[n],enumerable:!0})};function xd(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=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 o},get tr(){return r=n.selection,o=n.doc,s=n.storedMarks,n}}}var Sd=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:o}=n,s=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([i,a])=>[i,(...c)=>{const u=a(...c)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(o),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:s}=r,i=[],a=!!t,l=t||o.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(l),i.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...p)=>{const g=this.buildProps(l,e),m=f(...p)(g);return i.push(m),u}])),run:c};return u}createCan(t){const{rawCommands:e,state:n}=this,r=!1,o=t||n.tr,s=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:s}=r,i={tr:t,editor:r,view:s,state:xd({state:o,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...c)=>l(...c)(i)]))}};return i}},NS={};Em(NS,{blur:()=>z2,clearContent:()=>L2,clearNodes:()=>j2,command:()=>F2,createParagraphNear:()=>B2,cut:()=>V2,deleteCurrentNode:()=>H2,deleteNode:()=>W2,deleteRange:()=>q2,deleteSelection:()=>U2,enter:()=>K2,exitCode:()=>Y2,extendMarkRange:()=>Z2,first:()=>G2,focus:()=>X2,forEach:()=>Q2,insertContent:()=>ez,insertContentAt:()=>rz,joinBackward:()=>iz,joinDown:()=>sz,joinForward:()=>az,joinItemBackward:()=>lz,joinItemForward:()=>cz,joinTextblockBackward:()=>uz,joinTextblockForward:()=>dz,joinUp:()=>oz,keyboardShortcut:()=>hz,lift:()=>pz,liftEmptyBlock:()=>mz,liftListItem:()=>gz,newlineInCode:()=>yz,resetAttributes:()=>bz,scrollIntoView:()=>vz,selectAll:()=>wz,selectNodeBackward:()=>kz,selectNodeForward:()=>xz,selectParentNode:()=>Sz,selectTextblockEnd:()=>Ez,selectTextblockStart:()=>Cz,setContent:()=>Tz,setMark:()=>Kz,setMeta:()=>Yz,setNode:()=>Zz,setNodeSelection:()=>Gz,setTextDirection:()=>Jz,setTextSelection:()=>Xz,sinkListItem:()=>Qz,splitBlock:()=>eL,splitListItem:()=>tL,toggleList:()=>nL,toggleMark:()=>rL,toggleNode:()=>oL,toggleWrap:()=>sL,undoInputRule:()=>iL,unsetAllMarks:()=>aL,unsetMark:()=>lL,unsetTextDirection:()=>cL,updateAttributes:()=>uL,wrapIn:()=>dL,wrapInList:()=>fL});var z2=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),L2=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),j2=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:s,$to:i})=>{t.doc.nodesBetween(s.pos,i.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),f=c.resolve(u.map(l+a.nodeSize)),h=d.blockRange(f);if(!h)return;const p=Ai(h);if(a.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,g)}(p||p===0)&&e.lift(h,p)})}),!0},F2=t=>e=>t(e),B2=()=>({state:t,dispatch:e})=>q1(t,e),V2=(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,s=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const i=r.mapping.map(e);return r.insert(i,s.content),r.setSelection(new _e(r.doc.resolve(Math.max(i-1,0)))),!0},H2=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const o=t.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===r.type){if(e){const a=o.before(s),l=o.after(s);t.delete(a,l).scrollIntoView()}return!0}return!1};function Ot(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 W2=t=>({tr:e,state:n,dispatch:r})=>{const o=Ot(t,n.schema),s=e.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===o){if(r){const l=s.before(i),c=s.after(i);e.delete(l,c).scrollIntoView()}return!0}return!1},q2=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},U2=()=>({state:t,dispatch:e})=>um(t,e),K2=()=>({commands:t})=>t.keyboardShortcut("Enter"),Y2=()=>({state:t,dispatch:e})=>N$(t,e);function Cm(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function lu(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:Cm(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function PS(t,e,n={}){return t.find(r=>r.type===e&&lu(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function Fb(t,e,n={}){return!!PS(t,e,n)}function Tm(t,e,n){var r;if(!t||!e)return;let o=t.parent.childAfter(t.parentOffset);if((!o.node||!o.node.marks.some(u=>u.type===e))&&(o=t.parent.childBefore(t.parentOffset)),!o.node||!o.node.marks.some(u=>u.type===e)||(n=n||((r=o.node.marks[0])==null?void 0:r.attrs),!PS([...o.node.marks],e,n)))return;let i=o.index,a=t.start()+o.offset,l=i+1,c=a+o.node.nodeSize;for(;i>0&&Fb([...t.parent.child(i-1).marks],e,n);)i-=1,a-=t.parent.child(i).nodeSize;for(;l<t.parent.childCount&&Fb([...t.parent.child(l).marks],e,n);)c+=t.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function jr(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 Z2=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const s=jr(t,r.schema),{doc:i,selection:a}=n,{$from:l,from:c,to:u}=a;if(o){const d=Tm(l,s,e);if(d&&d.from<=c&&d.to>=u){const f=_e.create(i,d.from,d.to);n.setSelection(f)}}return!0},G2=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 AS(t){return t instanceof _e}function Zo(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function IS(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 o=n.from,s=r.to;return e==="all"?_e.create(t,Zo(0,o,s),Zo(t.content.size,o,s)):_e.create(t,Zo(e,o,s),Zo(e,o,s))}function Bb(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function cu(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function J2(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var X2=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:s})=>{e={scrollIntoView:!0,...e};const i=()=>{(cu()||Bb())&&r.dom.focus(),J2()&&!cu()&&!Bb()&&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&&!AS(n.state.selection))return i(),!0;const a=IS(o.doc,t)||n.state.selection,l=n.state.selection.eq(a);return s&&(l||o.setSelection(a),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),i()),!0},Q2=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),ez=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),$S=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&&$S(r)}return t};function Sl(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 $S(n)}function $a(t,e,n){if(t instanceof lo||t instanceof re)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return re.fromArray(t.map(a=>e.nodeFromJSON(a)));const i=e.nodeFromJSON(t);return n.errorOnInvalidContent&&i.check(),i}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),$a("",e,n)}if(o){if(n.errorOnInvalidContent){let i=!1,a="";const l=new b1({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:c=>(i=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?co.fromSchema(l).parseSlice(Sl(t),n.parseOptions):co.fromSchema(l).parse(Sl(t),n.parseOptions),n.errorOnInvalidContent&&i)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=co.fromSchema(e);return n.slice?s.parseSlice(Sl(t),n.parseOptions).content:s.parse(Sl(t),n.parseOptions)}return $a("",e,n)}function tz(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof $t||o instanceof zt))return;const s=t.mapping.maps[r];let i=0;s.forEach((a,l,c,u)=>{i===0&&(i=u)}),t.setSelection($e.near(t.doc.resolve(i),n))}var nz=t=>!("type"in t),rz=(t,e,n)=>({tr:r,dispatch:o,editor:s})=>{var i;if(o){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=m=>{s.emit("contentError",{editor:s,error:m,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{$a(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(m){l(m)}try{a=$a(e,s.schema,{parseOptions:c,errorOnInvalidContent:(i=n.errorOnInvalidContent)!=null?i:s.options.enableContentCheck})}catch(m){return l(m),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;if((nz(a)?a:[a]).forEach(m=>{m.check(),f=f?m.isText&&m.marks.length===0:!1,h=h?m.isBlock:!1}),u===d&&h){const{parent:m}=r.doc.resolve(u);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(u-=1,d+=1)}let g;if(f){if(Array.isArray(e))g=e.map(m=>m.text||"").join("");else if(e instanceof re){let m="";e.forEach(y=>{y.text&&(m+=y.text)}),g=m}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,u,d)}else{g=a;const m=r.doc.resolve(u),y=m.node(),b=m.parentOffset===0,w=y.isText||y.isTextblock,k=y.content.size>0;b&&w&&k&&(u=Math.max(0,u-1)),r.replaceWith(u,d,g)}n.updateSelection&&tz(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0},oz=()=>({state:t,dispatch:e})=>R$(t,e),sz=()=>({state:t,dispatch:e})=>O$(t,e),iz=()=>({state:t,dispatch:e})=>L1(t,e),az=()=>({state:t,dispatch:e})=>V1(t,e),lz=()=>({state:t,dispatch:e,tr:n})=>{try{const r=gd(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},cz=()=>({state:t,dispatch:e,tr:n})=>{try{const r=gd(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},uz=()=>({state:t,dispatch:e})=>T$(t,e),dz=()=>({state:t,dispatch:e})=>M$(t,e);function DS(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function fz(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,o,s,i;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))o=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))cu()||DS()?i=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),i&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}var hz=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const s=fz(t).split(/-(?!$)/),i=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:i==="Space"?" ":i,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,a))});return l?.steps.forEach(c=>{const u=c.map(r.mapping);u&&o&&r.maybeStep(u)}),!0};function go(t,e,n={}){const{from:r,to:o,empty:s}=t.selection,i=e?Ot(e,t.schema):null,a=[];t.doc.nodesBetween(r,o,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(o,f+d.nodeSize);a.push({node:d,from:h,to:p})});const l=o-r,c=a.filter(d=>i?i.name===d.node.type.name:!0).filter(d=>lu(d.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}var pz=(t,e={})=>({state:n,dispatch:r})=>{const o=Ot(t,n.schema);return go(n,o,e)?_$(n,r):!1},mz=()=>({state:t,dispatch:e})=>U1(t,e),gz=t=>({state:e,dispatch:n})=>{const r=Ot(t,e.schema);return V$(r)(e,n)},yz=()=>({state:t,dispatch:e})=>W1(t,e);function Ed(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Vb(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}var bz=(t,e)=>({tr:n,state:r,dispatch:o})=>{let s=null,i=null;const a=Ed(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(s=Ot(t,r.schema)),a==="mark"&&(i=jr(t,r.schema));let l=!1;return n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{s&&s===u.type&&(l=!0,o&&n.setNodeMarkup(d,void 0,Vb(u.attrs,e))),i&&u.marks.length&&u.marks.forEach(f=>{i===f.type&&(l=!0,o&&n.addMark(d,d+u.nodeSize,i.create(Vb(f.attrs,e))))})})}),l},vz=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),wz=()=>({tr:t,dispatch:e})=>{if(e){const n=new En(t.doc);t.setSelection(n)}return!0},kz=()=>({state:t,dispatch:e})=>F1(t,e),xz=()=>({state:t,dispatch:e})=>H1(t,e),Sz=()=>({state:t,dispatch:e})=>I$(t,e),Ez=()=>({state:t,dispatch:e})=>z$(t,e),Cz=()=>({state:t,dispatch:e})=>D$(t,e);function Lh(t,e,n={},r={}){return $a(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var Tz=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:s,dispatch:i,commands:a})=>{const{doc:l}=s;if(r.preserveWhitespace!=="full"){const c=Lh(t,o.schema,r,{errorOnInvalidContent:e??o.options.enableContentCheck});return i&&s.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!n),!0}return i&&s.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??o.options.enableContentCheck})};function zS(t,e){const n=jr(e,t.schema),{from:r,to:o,empty:s}=t.selection,i=[];s?(t.storedMarks&&i.push(...t.storedMarks),i.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,l=>{i.push(...l.marks)});const a=i.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function LS(t,e){const n=new I1(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function Mz(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}function Rz(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(o,s)=>{n(o)&&r.push({node:o,pos:s})}),r}function Oz(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 Cd(t){return e=>Oz(e.$from,t)}function xe(t,e,n){return t.config[e]===void 0&&t.parent?xe(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?xe(t.parent,e,n):null}):t.config[e]}function Mm(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=xe(e,"addExtensions",n);return r?[e,...Mm(r())]:e}).flat(10)}function Rm(t,e){const n=Es.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function jS(t){return typeof t=="function"}function Xe(t,e=void 0,...n){return jS(t)?e?t.bind(e)(...n):t(...n):t}function _z(t={}){return Object.keys(t).length===0&&t.constructor===Object}function vi(t){const e=t.filter(o=>o.type==="extension"),n=t.filter(o=>o.type==="node"),r=t.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function FS(t){const e=[],{nodeExtensions:n,markExtensions:r}=vi(t),o=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},i=n.filter(c=>c.name!=="text").map(c=>c.name),a=r.map(c=>c.name),l=[...i,...a];return t.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage,extensions:o},d=xe(c,"addGlobalAttributes",u);if(!d)return;d().forEach(h=>{let p;Array.isArray(h.types)?p=h.types:h.types==="*"?p=l:h.types==="nodes"?p=i:h.types==="marks"?p=a:p=[],p.forEach(g=>{Object.entries(h.attributes).forEach(([m,y])=>{e.push({type:g,name:m,attribute:{...s,...y}})})})})}),o.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage},d=xe(c,"addAttributes",u);if(!d)return;const f=d();Object.entries(f).forEach(([h,p])=>{const g={...s,...p};typeof g?.default=="function"&&(g.default=g.default()),g?.isRequired&&g?.default===void 0&&delete g.default,e.push({type:c.name,name:h,attribute:g})})}),e}function Nz(t){const e=[];let n="",r=!1,o=!1,s=0;const i=t.length;for(let a=0;a<i;a+=1){const l=t[a];if(l==="'"&&!o){r=!r,n+=l;continue}if(l==='"'&&!r){o=!o,n+=l;continue}if(!r&&!o){if(l==="("){s+=1,n+=l;continue}if(l===")"&&s>0){s-=1,n+=l;continue}if(l===";"&&s===0){e.push(n),n="";continue}}n+=l}return n&&e.push(n),e}function Hb(t){const e=[],n=Nz(t||""),r=n.length;for(let o=0;o<r;o+=1){const s=n[o],i=s.indexOf(":");if(i===-1)continue;const a=s.slice(0,i).trim(),l=s.slice(i+1).trim();a&&l&&e.push([a,l])}return e}function xt(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([o,s])=>{if(!r[o]){r[o]=s;return}if(o==="class"){const a=s?String(s).split(" "):[],l=r[o]?r[o].split(" "):[],c=a.filter(u=>!l.includes(u));r[o]=[...l,...c].join(" ")}else if(o==="style"){const a=new Map([...Hb(r[o]),...Hb(s)]);r[o]=Array.from(a.entries()).map(([l,c])=>`${l}: ${c}`).join("; ")}else r[o]=s}),r},{})}function Da(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)=>xt(n,r),{})}function Pz(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Wb(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 o=e.reduce((s,i)=>{const a=i.attribute.parseHTML?i.attribute.parseHTML(n):Pz(n.getAttribute(i.name));return a==null?s:{...s,[i.name]:a}},{});return{...r,...o}}}}function qb(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&_z(n)?!1:n!=null))}function Ub(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 Az(t,e){var n;const r=FS(t),{nodeExtensions:o,markExtensions:s}=vi(t),i=(n=o.find(c=>xe(c,"topNode")))==null?void 0:n.name,a=Object.fromEntries(o.map(c=>{const u=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((y,b)=>{const w=xe(b,"extendNodeSchema",d);return{...y,...w?w(c):{}}},{}),h=qb({...f,content:Xe(xe(c,"content",d)),marks:Xe(xe(c,"marks",d)),group:Xe(xe(c,"group",d)),inline:Xe(xe(c,"inline",d)),atom:Xe(xe(c,"atom",d)),selectable:Xe(xe(c,"selectable",d)),draggable:Xe(xe(c,"draggable",d)),code:Xe(xe(c,"code",d)),whitespace:Xe(xe(c,"whitespace",d)),linebreakReplacement:Xe(xe(c,"linebreakReplacement",d)),defining:Xe(xe(c,"defining",d)),isolating:Xe(xe(c,"isolating",d)),attrs:Object.fromEntries(u.map(Ub))}),p=Xe(xe(c,"parseHTML",d));p&&(h.parseDOM=p.map(y=>Wb(y,u)));const g=xe(c,"renderHTML",d);g&&(h.toDOM=y=>g({node:y,HTMLAttributes:Da(y,u)}));const m=xe(c,"renderText",d);return m&&(h.toText=m),[c.name,h]})),l=Object.fromEntries(s.map(c=>{const u=r.filter(m=>m.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((m,y)=>{const b=xe(y,"extendMarkSchema",d);return{...m,...b?b(c):{}}},{}),h=qb({...f,inclusive:Xe(xe(c,"inclusive",d)),excludes:Xe(xe(c,"excludes",d)),group:Xe(xe(c,"group",d)),spanning:Xe(xe(c,"spanning",d)),code:Xe(xe(c,"code",d)),attrs:Object.fromEntries(u.map(Ub))}),p=Xe(xe(c,"parseHTML",d));p&&(h.parseDOM=p.map(m=>Wb(m,u)));const g=xe(c,"renderHTML",d);return g&&(h.toDOM=m=>g({mark:m,HTMLAttributes:Da(m,u)})),[c.name,h]}));return new b1({topNode:i,nodes:a,marks:l})}function Iz(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function ha(t){return t.sort((n,r)=>{const o=xe(n,"priority")||100,s=xe(r,"priority")||100;return o>s?-1:o<s?1:0})}function BS(t){const e=ha(Mm(t)),n=Iz(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 VS(t,e,n){const{from:r,to:o}=e,{blockSeparator:s=`
|
|
22
|
-
|
|
23
|
-
`,textSerializers:i={}}=n||{};let a="";return t.nodesBetween(r,o,(l,c,u,d)=>{var f;l.isBlock&&c>r&&(a+=s);const h=i?.[l.type.name];if(h)return u&&(a+=h({node:l,pos:c,parent:u,index:d,range:e})),!1;l.isText&&(a+=(f=l?.text)==null?void 0:f.slice(Math.max(r,c)-c,o-c))}),a}function $z(t,e){const n={from:0,to:t.content.size};return VS(t,n,e)}function HS(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function Dz(t,e){const n=Ot(e,t.schema),{from:r,to:o}=t.selection,s=[];t.doc.nodesBetween(r,o,a=>{s.push(a)});const i=s.reverse().find(a=>a.type.name===n.name);return i?{...i.attrs}:{}}function WS(t,e){const n=Ed(typeof e=="string"?e:e.name,t.schema);return n==="node"?Dz(t,e):n==="mark"?zS(t,e):{}}function zz(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function Lz(t){const e=zz(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,i)=>i!==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 qS(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,s)=>{const i=[];if(o.ranges.length)o.forEach((a,l)=>{i.push({from:a,to:l})});else{const{from:a,to:l}=n[s];if(a===void 0||l===void 0)return;i.push({from:a,to:l})}i.forEach(({from:a,to:l})=>{const c=e.slice(s).map(a,-1),u=e.slice(s).map(l),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),Lz(r)}function Om(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const s=n.resolve(t),i=Tm(s,o.type);i&&r.push({mark:o,...i})}):n.nodesBetween(t,e,(o,s)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(i=>({from:s,to:s+o.nodeSize,mark:i})))}),r}var jz=(t,e,n,r=20)=>{const o=t.doc.resolve(n);let s=r,i=null;for(;s>0&&i===null;){const a=o.node(s);a?.type.name===e?i=a:s-=1}return[i,s]};function ji(t,e){return e.nodes[t]||e.marks[t]||null}function _c(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=t.find(s=>s.type===e&&s.name===r);return o?o.attribute.keepOnSplit:!1}))}var Fz=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,s,i,a)=>{var l,c;const u=((c=(l=o.type.spec).toText)==null?void 0:c.call(l,{node:o,pos:s,parent:i,index:a}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?u:u.slice(0,Math.max(0,r-s))}),n};function jh(t,e,n={}){const{empty:r,ranges:o}=t.selection,s=e?jr(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>lu(d.attrs,n,{strict:!1}));let i=0;const a=[];if(o.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;t.doc.nodesBetween(h,p,(g,m)=>{if(s&&g.inlineContent&&!g.type.allowsMarkType(s))return!1;if(!g.isText&&!g.marks.length)return;const y=Math.max(h,m),b=Math.min(p,m+g.nodeSize),w=b-y;i+=w,a.push(...g.marks.map(k=>({mark:k,from:y,to:b})))})}),i===0)return!1;const l=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>lu(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+c:l)>=i}function Bz(t,e,n={}){if(!e)return go(t,null,n)||jh(t,null,n);const r=Ed(e,t.schema);return r==="node"?go(t,e,n):r==="mark"?jh(t,e,n):!1}var Vz=(t,e)=>{const{$from:n,$to:r,$anchor:o}=t.selection;if(e){const s=Cd(a=>a.type.name===e)(t.selection);if(!s)return!1;const i=t.doc.resolve(s.pos+1);return o.pos+1===i.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},Hz=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function Kb(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Yb(t,e){const{nodeExtensions:n}=vi(e),r=n.find(i=>i.name===t);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},s=Xe(xe(r,"group",o));return typeof s!="string"?!1:s.split(" ").includes("list")}function Td(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.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 o=!0;return t.content.forEach(s=>{o!==!1&&(Td(s,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function US(t){return t instanceof Ce}var KS=class YS{constructor(e){this.position=e}static fromJSON(e){return new YS(e.position)}toJSON(){return{position:this.position}}};function Wz(t,e){const n=e.mapping.mapResult(t.position);return{position:new KS(n.pos),mapResult:n}}function qz(t){return new KS(t)}function Uz(t,e,n){var r;const{selection:o}=e;let s=null;if(AS(o)&&(s=o.$cursor),s){const a=(r=t.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(c=>c.type.excludes(n)))}const{ranges:i}=o;return i.some(({$from:a,$to:l})=>{let c=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(n));c=h&&p}return!c}),c})}var Kz=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:s}=n,{empty:i,ranges:a}=s,l=jr(t,r.schema);if(o)if(i){const c=zS(r,l);n.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{const p=Math.max(h,u),g=Math.min(h+f.nodeSize,d);f.marks.find(y=>y.type===l)?f.marks.forEach(y=>{l===y.type&&n.addMark(p,g,l.create({...y.attrs,...e}))}):n.addMark(p,g,l.create(e))})});return Uz(r,n,l)},Yz=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),Zz=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const s=Ot(t,n.schema);let i;return n.selection.$anchor.sameParent(n.selection.$head)&&(i=n.selection.$anchor.parent.attrs),s.isTextblock?o().command(({commands:a})=>ib(s,{...i,...e})(n)?!0:a.clearNodes()).command(({state:a})=>ib(s,{...i,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Gz=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,o=Zo(t,0,r.content.size),s=Ce.create(r,o);e.setSelection(s)}return!0},Jz=(t,e)=>({tr:n,state:r,dispatch:o})=>{const{selection:s}=r;let i,a;return typeof e=="number"?(i=e,a=e):e&&"from"in e&&"to"in e?(i=e.from,a=e.to):(i=s.from,a=s.to),o&&n.doc.nodesBetween(i,a,(l,c)=>{l.isText||n.setNodeMarkup(c,void 0,{...l.attrs,dir:t})}),!0},Xz=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:o,to:s}=typeof t=="number"?{from:t,to:t}:t,i=_e.atStart(r).from,a=_e.atEnd(r).to,l=Zo(o,i,a),c=Zo(s,i,a),u=_e.create(r,l,c);e.setSelection(u)}return!0},Qz=t=>({state:e,dispatch:n})=>{const r=Ot(t,e.schema);return q$(r)(e,n)};function Zb(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(o=>e?.includes(o.type.name));t.tr.ensureMarks(r)}}var eL=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:s,doc:i}=e,{$from:a,$to:l}=s,c=o.extensionManager.attributes,u=_c(c,a.node().type.name,a.node().attrs);if(s instanceof Ce&&s.node.isBlock)return!a.parentOffset||!Ar(i,a.pos)?!1:(r&&(t&&Zb(n,o.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:Mz(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=Ar(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!p&&Ar(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(s instanceof _e&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const g=e.mapping.map(a.before()),m=e.doc.resolve(g);a.node(-1).canReplaceWith(m.index(),m.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}t&&Zb(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return p},tL=(t,e={})=>({tr:n,state:r,dispatch:o,editor:s})=>{var i;const a=Ot(t,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const f=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(o){let y=re.empty;const b=l.index(-1)?1:l.index(-2)?2:3;for(let C=l.depth-b;C>=l.depth-3;C-=1)y=re.from(l.node(C).copy(y));const w=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,k={..._c(f,l.node().type.name,l.node().attrs),...e},v=((i=a.contentMatch.defaultType)==null?void 0:i.createAndFill(k))||void 0;y=y.append(re.from(a.createAndFill(null,v)||void 0));const x=l.before(l.depth-(b-1));n.replace(x,l.after(-w),new pe(y,4-b,0));let E=-1;n.doc.nodesBetween(x,n.doc.content.size,(C,A)=>{if(E>-1)return!1;C.isTextblock&&C.content.size===0&&(E=A+1)}),E>-1&&n.setSelection(_e.near(n.doc.resolve(E))),n.scrollIntoView()}return!0}const h=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,p={..._c(f,d.type.name,d.attrs),...e},g={..._c(f,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);const m=h?[{type:a,attrs:p},{type:h,attrs:g}]:[{type:a,attrs:p}];if(!Ar(n.doc,l.pos,2))return!1;if(o){const{selection:y,storedMarks:b}=r,{splittableMarks:w}=s.extensionManager,k=b||y.$to.parentOffset&&y.$from.marks();if(n.split(l.pos,2,m).scrollIntoView(),!k||!o)return!0;const v=k.filter(x=>w.includes(x.type.name));n.ensureMarks(v)}return!0},kf=(t,e)=>{const n=Cd(i=>i.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 o=t.doc.nodeAt(r);return n.node.type===o?.type&&Mo(t.doc,n.pos)&&t.join(n.pos),!0},xf=(t,e)=>{const n=Cd(i=>i.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 o=t.doc.nodeAt(r);return n.node.type===o?.type&&Mo(t.doc,r)&&t.join(r),!0},nL=(t,e,n,r={})=>({editor:o,tr:s,state:i,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=o.extensionManager,h=Ot(t,i.schema),p=Ot(e,i.schema),{selection:g,storedMarks:m}=i,{$from:y,$to:b}=g,w=y.blockRange(b),k=m||g.$to.parentOffset&&g.$from.marks();if(!w)return!1;const v=Cd(x=>Yb(x.type.name,d))(g);if(w.depth>=1&&v&&w.depth-v.depth<=1){if(v.node.type===h)return c.liftListItem(p);if(Yb(v.node.type.name,d)&&h.validContent(v.node.content)&&a)return l().command(()=>(s.setNodeMarkup(v.pos,h),!0)).command(()=>kf(s,h)).command(()=>xf(s,h)).run()}return!n||!k||!a?l().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>kf(s,h)).command(()=>xf(s,h)).run():l().command(()=>{const x=u().wrapInList(h,r),E=k.filter(C=>f.includes(C.type.name));return s.ensureMarks(E),x?!0:c.clearNodes()}).wrapInList(h,r).command(()=>kf(s,h)).command(()=>xf(s,h)).run()},rL=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:s=!1}=n,i=jr(t,r.schema);return jh(r,i,e)?o.unsetMark(i,{extendEmptyMarkRange:s}):o.setMark(i,e)},oL=(t,e,n={})=>({state:r,commands:o})=>{const s=Ot(t,r.schema),i=Ot(e,r.schema),a=go(r,s,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?o.setNode(i,l):o.setNode(s,{...l,...n})},sL=(t,e={})=>({state:n,commands:r})=>{const o=Ot(t,n.schema);return go(n,o,e)?r.lift(o):r.wrapIn(o,e)},iL=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let s;if(o.spec.isInputRules&&(s=o.getState(t))){if(e){const i=t.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)i.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=i.doc.resolve(s.from).marks();i.replaceWith(s.from,s.to,t.schema.text(s.text,l))}else i.delete(s.from,s.to)}return!0}}return!1},aL=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},lL=(t,e={})=>({tr:n,state:r,dispatch:o})=>{var s;const{extendEmptyMarkRange:i=!1}=e,{selection:a}=n,l=jr(t,r.schema),{$from:c,empty:u,ranges:d}=a;if(!o)return!0;if(u&&i){let{from:f,to:h}=a;const p=(s=c.marks().find(m=>m.type===l))==null?void 0:s.attrs,g=Tm(c,l,p);g&&(f=g.from,h=g.to),n.removeMark(f,h,l)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},cL=t=>({tr:e,state:n,dispatch:r})=>{const{selection:o}=n;let s,i;return typeof t=="number"?(s=t,i=t):t&&"from"in t&&"to"in t?(s=t.from,i=t.to):(s=o.from,i=o.to),r&&e.doc.nodesBetween(s,i,(a,l)=>{if(a.isText)return;const c={...a.attrs};delete c.dir,e.setNodeMarkup(l,void 0,c)}),!0},uL=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let s=null,i=null;const a=Ed(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(s=Ot(t,r.schema)),a==="mark"&&(i=jr(t,r.schema));let l=!1;return n.selection.ranges.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;let f,h,p,g;n.selection.empty?r.doc.nodesBetween(u,d,(m,y)=>{s&&s===m.type&&(l=!0,p=Math.max(y,u),g=Math.min(y+m.nodeSize,d),f=y,h=m)}):r.doc.nodesBetween(u,d,(m,y)=>{y<u&&s&&s===m.type&&(l=!0,p=Math.max(y,u),g=Math.min(y+m.nodeSize,d),f=y,h=m),y>=u&&y<=d&&(s&&s===m.type&&(l=!0,o&&n.setNodeMarkup(y,void 0,{...m.attrs,...e})),i&&m.marks.length&&m.marks.forEach(b=>{if(i===b.type&&(l=!0,o)){const w=Math.max(y,u),k=Math.min(y+m.nodeSize,d);n.addMark(w,k,i.create({...b.attrs,...e}))}}))}),h&&(f!==void 0&&o&&n.setNodeMarkup(f,void 0,{...h.attrs,...e}),i&&h.marks.length&&h.marks.forEach(m=>{i===m.type&&o&&n.addMark(p,g,i.create({...m.attrs,...e}))}))}),l},dL=(t,e={})=>({state:n,dispatch:r})=>{const o=Ot(t,n.schema);return L$(o,e)(n,r)},fL=(t,e={})=>({state:n,dispatch:r})=>{const o=Ot(t,n.schema);return j$(o,e)(n,r)},hL=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={}}},Md=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},pL=(t,e)=>{if(Cm(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 El(t){var e;const{editor:n,from:r,to:o,text:s,rules:i,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=Fz(c)+s;return i.forEach(f=>{if(u)return;const h=pL(d,f.find);if(!h)return;const p=l.state.tr,g=xd({state:l.state,transaction:p}),m={from:r-(h[0].length-s.length),to:o},{commands:y,chain:b,can:w}=new Sd({editor:n,state:g});f.handler({state:g,range:m,match:h,commands:y,chain:b,can:w})===null||!p.steps.length||(f.undoable&&p.setMeta(a,{transform:p,from:r,to:o,text:s}),l.dispatch(p),u=!0)}),u}function mL(t){const{editor:e,rules:n}=t,r=new yt({state:{init(){return null},apply(o,s,i){const a=o.getMeta(r);if(a)return a;const l=o.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=Rm(re.from(u),i.schema);const{from:d}=l,f=d+u.length;El({editor:e,from:d,to:f,text:u,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:s}},props:{handleTextInput(o,s,i,a){return El({editor:e,from:s,to:i,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:s}=o.state.selection;s&&El({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,s){if(s.key!=="Enter")return!1;const{$cursor:i}=o.state.selection;return i?El({editor:e,from:i.pos,to:i.pos,text:`
|
|
24
|
-
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function gL(t){return Object.prototype.toString.call(t).slice(8,-1)}function Cl(t){return gL(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function ZS(t,e){const n={...t};return Cl(t)&&Cl(e)&&Object.keys(e).forEach(r=>{Cl(e[r])&&Cl(t[r])?n[r]=ZS(t[r],e[r]):n[r]=e[r]}),n}var _m=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{...Xe(xe(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Xe(xe(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>ZS(this.options,t)});return e.name=this.name,e.parent=this.parent,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}},Cs=class GS extends _m{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new GS(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const i=o.marks();if(!!!i.find(c=>c?.type.name===n.name))return!1;const l=i.find(c=>c?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",o.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)}};function yL(t){return typeof t=="number"}var bL=class{constructor(t){this.find=t.find,this.handler=t.handler}},vL=(t,e,n)=>{if(Cm(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(o=>{const s=[o.text];return s.index=o.index,s.input=t,s.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(o.replaceWith)),s}):[]};function wL(t){const{editor:e,state:n,from:r,to:o,rule:s,pasteEvent:i,dropEvent:a}=t,{commands:l,chain:c,can:u}=new Sd({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,o,(h,p)=>{var g,m,y,b,w;if((m=(g=h.type)==null?void 0:g.spec)!=null&&m.code||!(h.isText||h.isTextblock||h.isInline))return;const k=(w=(b=(y=h.content)==null?void 0:y.size)!=null?b:h.nodeSize)!=null?w:0,v=Math.max(r,p),x=Math.min(o,p+k);if(v>=x)return;const E=h.isText?h.text||"":h.textBetween(v-p,x-p,void 0,"");vL(E,s.find,i).forEach(A=>{if(A.index===void 0)return;const z=v+A.index+1,R=z+A[0].length,_={from:n.tr.mapping.map(z),to:n.tr.mapping.map(R)},N=s.handler({state:n,range:_,match:A,commands:l,chain:c,can:u,pasteEvent:i,dropEvent:a});d.push(N)})}),d.every(h=>h!==null)}var Tl=null,kL=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function xL(t){const{editor:e,rules:n}=t;let r=null,o=!1,s=!1,i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const g=u.tr,m=xd({state:u,transaction:g});if(!(!wL({editor:e,state:m,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:a})||!g.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(u=>new yt({view(d){const f=p=>{var g;r=(g=d.dom.parentElement)!=null&&g.contains(p.target)?d.dom.parentElement:null,r&&(Tl=e)},h=()=>{Tl&&(Tl=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(s=r===d.dom.parentElement,a=f,!s){const h=Tl;h?.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)==null?void 0:h.getData("text/html");return i=f,o=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],g=p.getMeta("uiEvent")==="paste"&&!o,m=p.getMeta("uiEvent")==="drop"&&!s,y=p.getMeta("applyPasteRules"),b=!!y;if(!g&&!m&&!b)return;if(b){let{text:v}=y;typeof v=="string"?v=v:v=Rm(re.from(v),h.schema);const{from:x}=y,E=x+v.length,C=kL(v);return l({rule:u,state:h,from:x,to:{b:E},pasteEvt:C})}const w=f.doc.content.findDiffStart(h.doc.content),k=f.doc.content.findDiffEnd(h.doc.content);if(!(!yL(w)||!k||w===k.b))return l({rule:u,state:h,from:w,to:k,pasteEvt:i})}}))}var Rd=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=BS(t),this.schema=Az(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:ji(e.name,this.schema)},r=xe(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return ha([...this.extensions].reverse()).flatMap(r=>{const o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:ji(r.name,this.schema)},s=[],i=xe(r,"addKeyboardShortcuts",o);let a={};if(r.type==="mark"&&xe(r,"exitable",o)&&(a.ArrowRight=()=>Cs.handleExit({editor:t,mark:r})),i){const f=Object.fromEntries(Object.entries(i()).map(([h,p])=>[h,()=>p({editor:t})]));a={...a,...f}}const l=$2(a);s.push(l);const c=xe(r,"addInputRules",o);if(Kb(r,t.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=mL({editor:t,rules:f}),p=Array.isArray(h)?h:[h];s.push(...p)}}const u=xe(r,"addPasteRules",o);if(Kb(r,t.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=xL({editor:t,rules:f});s.push(...h)}}const d=xe(r,"addProseMirrorPlugins",o);if(d){const f=d();s.push(...f)}return s})}get attributes(){return FS(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=vi(this.extensions);return Object.fromEntries(e.filter(n=>!!xe(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ot(n.name,this.schema)},s=xe(n,"addNodeView",o);if(!s)return[];const i=s();if(!i)return[];const a=(l,c,u,d,f)=>{const h=Da(l,r);return i({node:l,view:c,getPos:u,decorations:d,innerDecorations:f,editor:t,extension:n,HTMLAttributes:h})};return[n.name,a]}))}dispatchTransaction(t){const{editor:e}=this;return ha([...this.extensions].reverse()).reduceRight((r,o)=>{const s={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:e,type:ji(o.name,this.schema)},i=xe(o,"dispatchTransaction",s);return i?a=>{i.call(s,{transaction:a,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return ha([...this.extensions]).reduce((r,o)=>{const s={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:e,type:ji(o.name,this.schema)},i=xe(o,"transformPastedHTML",s);return i?(a,l)=>{const c=r(a,l);return i.call(s,c)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=vi(this.extensions);return Object.fromEntries(e.filter(n=>!!xe(n,"addMarkView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:jr(n.name,this.schema)},s=xe(n,"addMarkView",o);if(!s)return[];const i=(a,l,c)=>{const u=Da(a,r);return s()({mark:a,view:l,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{zL(a,t,d)}})};return[n.name,i]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ji(e.name,this.schema)};e.type==="mark"&&((n=Xe(xe(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const o=xe(e,"onBeforeCreate",r),s=xe(e,"onCreate",r),i=xe(e,"onUpdate",r),a=xe(e,"onSelectionUpdate",r),l=xe(e,"onTransaction",r),c=xe(e,"onFocus",r),u=xe(e,"onBlur",r),d=xe(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),s&&this.editor.on("create",s),i&&this.editor.on("update",i),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};Rd.resolve=BS;Rd.sort=ha;Rd.flatten=Mm;var SL={};Em(SL,{ClipboardTextSerializer:()=>XS,Commands:()=>QS,Delete:()=>eE,Drop:()=>tE,Editable:()=>nE,FocusEvents:()=>oE,Keymap:()=>sE,Paste:()=>iE,Tabindex:()=>aE,TextDirection:()=>lE,focusEventsPluginKey:()=>rE});var St=class JS extends _m{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new JS(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},XS=St.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new yt({key:new It("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:s}=o,i=Math.min(...s.map(u=>u.$from.pos)),a=Math.max(...s.map(u=>u.$to.pos)),l=HS(n);return VS(r,{from:i,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),QS=St.create({name:"commands",addCommands(){return{...NS}}}),eE=St.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,o;const s=()=>{var i,a,l,c;if((c=(l=(a=(i=this.editor.options.coreExtensionOptions)==null?void 0:i.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,t))!=null?c:t.getMeta("y-sync$"))return;const u=LS(t.before,[t,...e]);qS(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(p,g)=>{const m=g+p.nodeSize-2,y=h.oldRange.from<=g&&m<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:g,to:m,newFrom:u.mapping.map(g),newTo:u.mapping.map(m),deletedRange:h.oldRange,newRange:h.newRange,partial:!y,editor:this.editor,transaction:t,combinedTransform:u})})});const f=u.mapping;u.steps.forEach((h,p)=>{var g,m;if(h instanceof Kn){const y=f.slice(p).map(h.from,-1),b=f.slice(p).map(h.to),w=f.invert().map(y,-1),k=f.invert().map(b),v=(g=u.doc.nodeAt(y-1))==null?void 0:g.marks.some(E=>E.eq(h.mark)),x=(m=u.doc.nodeAt(b))==null?void 0:m.marks.some(E=>E.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:w,to:k},newRange:{from:y,to:b},partial:!!(x||v),editor:this.editor,transaction:t,combinedTransform:u})}})};(o=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||o?setTimeout(s,0):s()}}),tE=St.create({name:"drop",addProseMirrorPlugins(){return[new yt({key:new It("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),nE=St.create({name:"editable",addProseMirrorPlugins(){return[new yt({key:new It("editable"),props:{editable:()=>this.editor.options.editable}})]}}),rE=new It("focusEvents"),oE=St.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new yt({key:rE,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}}}})]}}),sE=St.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,g=p.parent.type.spec.isolating,m=d.pos-d.parentOffset,y=g&&p.parent.childCount===1?m===d.pos:$e.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.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()},o={...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 cu()||DS()?s:o},addProseMirrorPlugins(){return[new yt({key:new It("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(g=>g.getMeta("composition")))return;const r=t.some(g=>g.docChanged)&&!e.doc.eq(n.doc),o=t.some(g=>g.getMeta("preventClearDocument"));if(!r||o)return;const{empty:s,from:i,to:a}=e.selection,l=$e.atStart(e.doc).from,c=$e.atEnd(e.doc).to;if(s||!(i===l&&a===c)||!Td(n.doc))return;const f=n.tr,h=xd({state:n,transaction:f}),{commands:p}=new Sd({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),iE=St.create({name:"paste",addProseMirrorPlugins(){return[new yt({key:new It("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),aE=St.create({name:"tabindex",addProseMirrorPlugins(){return[new yt({key:new It("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),lE=St.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=vi(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 yt({key:new It("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),EL=class Qi{constructor(e,n,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=o}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 Qi(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 Qi(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 Qi(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,i=n.isInline,a=this.pos+r+(s?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!o&&!i&&l.depth<=this.depth)return;const c=new Qi(l,this.editor,o,o||i?n:null);o&&(c.actualDepth=this.depth+1),e.push(c)}),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,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(n).length>0){const s=o.node.attrs,i=Object.keys(n);for(let a=0;a<i.length;a+=1){const l=i[a];if(s[l]!==n[l])break}}else r=o;o=o.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const s=Object.keys(n);return this.children.forEach(i=>{r&&o.length>0||(i.node.type.name===e&&s.every(l=>n[l]===i.node.attrs[l])&&o.push(i),!(r&&o.length>0)&&(o=o.concat(i.querySelectorAll(e,n,r))))}),o}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},CL=`.ProseMirror {
|
|
25
|
-
position: relative;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.ProseMirror {
|
|
29
|
-
word-wrap: break-word;
|
|
30
|
-
white-space: pre-wrap;
|
|
31
|
-
white-space: break-spaces;
|
|
32
|
-
-webkit-font-variant-ligatures: none;
|
|
33
|
-
font-variant-ligatures: none;
|
|
34
|
-
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.ProseMirror [contenteditable="false"] {
|
|
38
|
-
white-space: normal;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
42
|
-
white-space: pre-wrap;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.ProseMirror pre {
|
|
46
|
-
white-space: pre-wrap;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
img.ProseMirror-separator {
|
|
50
|
-
display: inline !important;
|
|
51
|
-
border: none !important;
|
|
52
|
-
margin: 0 !important;
|
|
53
|
-
width: 0 !important;
|
|
54
|
-
height: 0 !important;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.ProseMirror-gapcursor {
|
|
58
|
-
display: none;
|
|
59
|
-
pointer-events: none;
|
|
60
|
-
position: absolute;
|
|
61
|
-
margin: 0;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.ProseMirror-gapcursor:after {
|
|
65
|
-
content: "";
|
|
66
|
-
display: block;
|
|
67
|
-
position: absolute;
|
|
68
|
-
top: -2px;
|
|
69
|
-
width: 20px;
|
|
70
|
-
border-top: 1px solid black;
|
|
71
|
-
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
@keyframes ProseMirror-cursor-blink {
|
|
75
|
-
to {
|
|
76
|
-
visibility: hidden;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.ProseMirror-hideselection *::selection {
|
|
81
|
-
background: transparent;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.ProseMirror-hideselection *::-moz-selection {
|
|
85
|
-
background: transparent;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.ProseMirror-hideselection * {
|
|
89
|
-
caret-color: transparent;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
93
|
-
display: block;
|
|
94
|
-
}`;function TL(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute("data-tiptap-style",""),o.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(o),o}var ML=class extends hL{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!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:o})=>{throw o},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Wz,createMappablePosition:qz},this.setOptions(e),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:o,slice:s,moved:i})=>this.options.onDrop(o,s,i)),this.on("paste",({event:o,slice:s})=>this.options.onPaste(o,s)),this.on("delete",this.options.onDelete);const n=this.createDoc(),r=IS(n,this.options.autofocus);this.editorState=qs.create({doc:n,schema:this.schema,selection:r||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){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(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=TL(CL,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,n)=>{if(this.editorView)return this.editorView[n];if(n==="state")return this.editorState;if(n in e)return Reflect.get(e,n);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${n}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,n){const r=jS(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],o=this.state.reconfigure({plugins:r});return this.view.updateState(o),o}unregisterPlugin(e){if(this.isDestroyed)return;const n=this.state.plugins;let r=n;if([].concat(e).forEach(s=>{const i=typeof s=="string"?`${s}$`:s.key;r=r.filter(a=>!a.key.startsWith(i))}),n.length===r.length)return;const o=this.state.reconfigure({plugins:r});return this.view.updateState(o),o}createExtensionManager(){var e,n;const o=[...this.options.enableCoreExtensions?[nE,XS.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:n.blockSeparator}),QS,oE,sE,aE,tE,iE,eE,lE.configure({direction:this.options.textDirection})].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s?.type));this.extensionManager=new Rd(o,this)}createCommandManager(){this.commandManager=new Sd({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Lh(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(n){if(!(n instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(n.message))throw n;this.emit("contentError",{editor:this,error:n,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()}}),e=Lh(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:n,enableExtensionDispatchTransaction:r}=this.options,o=n.dispatchTransaction||this.dispatchTransaction.bind(this),s=r?this.extensionManager.dispatchTransaction(o):o,i=n.transformPastedHTML,a=this.extensionManager.transformPastedHTML(i);this.editorView=new OS(e,{...n,attributes:{role:"textbox",...n?.attributes},dispatchTransaction:s,transformPastedHTML:a,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),this.prependClass(),this.injectCSS();const c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(u=>{var d;return(d=this.capturedTransaction)==null?void 0:d.step(u)});return}const{state:n,transactions:r}=this.state.applyTransaction(e),o=!this.state.selection.eq(n.selection),s=r.includes(e),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),!s)return;this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:r.slice(1)}),o&&this.emit("selectionUpdate",{editor:this,transaction:e});const a=r.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),l=a?.getMeta("focus"),c=a?.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:a}),c&&this.emit("blur",{editor:this,event:c.event,transaction:a}),!(e.getMeta("preventUpdate")||!r.some(u=>u.docChanged)||i.doc.eq(n.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:r.slice(1)})}getAttributes(e){return WS(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,o=typeof e=="string"?n:e;return Bz(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Rm(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
|
|
95
|
-
|
|
96
|
-
`,textSerializers:r={}}=e||{};return $z(this.state.doc,{blockSeparator:n,textSerializers:{...HS(this.schema),...r}})}get isEmpty(){return Td(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,n;return(n=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?n:!0}$node(e,n){var r;return((r=this.$doc)==null?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)==null?void 0:r.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new EL(n,this)}get $doc(){return this.$pos(0)}};function wi(t){return new Md({find:t.find,handler:({state:e,range:n,match:r})=>{const o=Xe(t.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:s}=e,i=r[r.length-1],a=r[0];if(i){const l=a.search(/\S/),c=n.from+a.indexOf(i),u=c+i.length;if(Om(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===t.type&&g!==h.mark.type)).filter(h=>h.to>c).length)return null;u<n.to&&s.delete(u,n.to),c>n.from&&s.delete(n.from+l,c);const f=n.from+l+i.length;s.addMark(n.from+l,f,t.type.create(o||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}function cE(t){return new Md({find:t.find,handler:({state:e,range:n,match:r})=>{const o=Xe(t.getAttributes,void 0,r)||{},{tr:s}=e,i=n.from;let a=n.to;const l=t.type.create(o);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=i+c;u>a?u=a:a=u+r[1].length;const d=r[0][r[0].length-1];s.insertText(d,i+r[0].length-1),s.replaceWith(u,a,l)}else if(r[0]){const c=t.type.isInline?i:i-1;s.insert(c,t.type.create(o)).delete(s.mapping.map(i),s.mapping.map(a))}s.scrollIntoView()},undoable:t.undoable})}function Fh(t){return new Md({find:t.find,handler:({state:e,range:n,match:r})=>{const o=e.doc.resolve(n.from),s=Xe(t.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.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 ki(t){return new Md({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{const s=Xe(t.getAttributes,void 0,r)||{},i=e.tr.delete(n.from,n.to),l=i.doc.resolve(n.from).blockRange(),c=l&&lm(l,t.type,s);if(!c)return null;if(i.wrap(l,c),t.keepMarks&&t.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const g=p.filter(m=>h.includes(m.type.name));i.ensureMarks(g)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(d,s).run()}const u=i.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&Mo(i.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&i.join(n.from-1)},undoable:t.undoable})}var RL=t=>"touches"in t,OL=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=a=>{if(!this.isResizing||!this.activeHandle)return;const l=a.clientX-this.startX,c=a.clientY-this.startY;this.handleResize(l,c)},this.handleTouchMove=a=>{if(!this.isResizing||!this.activeHandle)return;const l=a.touches[0];if(!l)return;const c=l.clientX-this.startX,u=l.clientY-this.startY;this.handleResize(c,u)},this.handleMouseUp=()=>{if(!this.isResizing)return;const a=this.element.offsetWidth,l=this.element.offsetHeight;this.onCommit(a,l),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=a=>{a.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=a=>{a.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,o,s,i;this.node=t.node,this.editor=t.editor,this.element=t.element,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),(o=t.options)!=null&&o.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||""}),(i=t.options)!=null&&i.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="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"),o=e.includes("left"),s=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),o&&(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,RL(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:o}=this.calculateNewDimensions(this.activeHandle,t,e),s=this.applyConstraints(r,o,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,o=this.startHeight;const s=t.includes("right"),i=t.includes("left"),a=t.includes("bottom"),l=t.includes("top");return s?r=this.startWidth+e:i&&(r=this.startWidth-e),a?o=this.startHeight+n:l&&(o=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(s?e:-e)),(t==="top"||t==="bottom")&&(o=this.startHeight+(a?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,o,t):{width:r,height:o}}applyConstraints(t,e,n){var r,o,s,i;if(!n){let c=Math.max(this.minSize.width,t),u=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(c=Math.min(this.maxSize.width,c)),(o=this.maxSize)!=null&&o.height&&(u=Math.min(this.maxSize.height,u)),{width:c,height:u}}let a=t,l=e;return a<this.minSize.width&&(a=this.minSize.width,l=a/this.aspectRatio),l<this.minSize.height&&(l=this.minSize.height,a=l*this.aspectRatio),(s=this.maxSize)!=null&&s.width&&a>this.maxSize.width&&(a=this.maxSize.width,l=a/this.aspectRatio),(i=this.maxSize)!=null&&i.height&&l>this.maxSize.height&&(l=this.maxSize.height,a=l*this.aspectRatio),{width:a,height:l}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",o=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:o?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function _L(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Ce){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let o=r.depth;for(;o>=0;){const s=r.index(o);if(r.node(o).contentMatchAt(s).matchType(e))return!0;o-=1}return!1}var NL={};Em(NL,{createAtomBlockMarkdownSpec:()=>PL,createBlockMarkdownSpec:()=>AL,createInlineMarkdownSpec:()=>DL,parseAttributes:()=>Nm,parseIndentedBlocks:()=>Bh,renderNestedMarkdownContent:()=>Am,serializeAttributes:()=>Pm});function Nm(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const c=o.map(u=>u.trim().slice(1));e.class=c.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const i=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(i)).forEach(([,c,u])=>{var d;const f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=n[f];h&&(e[c]=h.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function Pm(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 PL(t){const{nodeName:e,name:n,parseAttributes:r=Nm,serializeAttributes:o=Pm,defaultAttributes:s={},requiredAttributes:i=[],allowedAttributes:a}=t,l=n||e,c=u=>{if(!a)return u;const d={};return a.forEach(f=>{f in u&&(d[f]=u[f])}),d};return{parseMarkdown:(u,d)=>{const f={...s,...u.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const f=new RegExp(`^:::${l}(?:\\s|$)`,"m"),h=(d=u.match(f))==null?void 0:d.index;return h!==void 0?h:-1},tokenize(u,d,f){const h=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=u.match(h);if(!p)return;const g=p[1]||"",m=r(g);if(!i.find(b=>!(b in m)))return{type:e,raw:p[0],attributes:m}}},renderMarkdown:u=>{const d=c(u.attrs||{}),f=o(d),h=f?` {${f}}`:"";return`:::${l}${h} :::`}}}function AL(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=Nm,serializeAttributes:s=Pm,defaultAttributes:i={},content:a="block",allowedAttributes:l}=t,c=n||e,u=d=>{if(!l)return d;const f={};return l.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{let h;if(r){const g=r(d);h=typeof g=="string"?[{type:"text",text:g}]:g}else a==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);const p={...i,...d.attributes};return f.createNode(e,p,h)},markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${c}`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){var p;const g=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),m=d.match(g);if(!m)return;const[y,b=""]=m,w=o(b);let k=1;const v=y.length;let x="";const E=/^:::([\w-]*)(\s.*)?/gm,C=d.slice(v);for(E.lastIndex=0;;){const A=E.exec(C);if(A===null)break;const z=A.index,R=A[1];if(!((p=A[2])!=null&&p.endsWith(":::"))){if(R)k+=1;else if(k-=1,k===0){const _=C.slice(0,z);x=_.trim();const N=d.slice(0,v+z+A[0].length);let L=[];if(x)if(a==="block")for(L=h.blockTokens(_),L.forEach(H=>{H.text&&(!H.tokens||H.tokens.length===0)&&(H.tokens=h.inlineTokens(H.text))});L.length>0;){const H=L[L.length-1];if(H.type==="paragraph"&&(!H.text||H.text.trim()===""))L.pop();else break}else L=h.inlineTokens(x);return{type:e,raw:N,attributes:w,content:x,tokens:L}}}}}},renderMarkdown:(d,f)=>{const h=u(d.attrs||{}),p=s(h),g=p?` {${p}}`:"",m=f.renderChildren(d.content||[],`
|
|
97
|
-
|
|
98
|
-
`);return`:::${c}${g}
|
|
99
|
-
|
|
100
|
-
${m}
|
|
101
|
-
|
|
102
|
-
:::`}}}function IL(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,o,s,i]=r;e[o]=s||i,r=n.exec(t)}return e}function $L(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function DL(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=IL,serializeAttributes:s=$L,defaultAttributes:i={},selfClosing:a=!1,allowedAttributes:l}=t,c=n||e,u=f=>{if(!l)return f;const h={};return l.forEach(p=>{const g=typeof p=="string"?p:p.name,m=typeof p=="string"?void 0:p.skipIfDefault;if(g in f){const y=f[g];if(m!==void 0&&y===m)return;h[g]=y}}),h},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,h)=>{const p={...i,...f.attributes};if(a)return h.createNode(e,p);const g=r?r(f):f.content||"";return g?h.createNode(e,p,[h.createTextNode(g)]):h.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(f){const h=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),p=f.match(h),g=p?.index;return g!==void 0?g:-1},tokenize(f,h,p){const g=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),m=f.match(g);if(!m)return;let y="",b="";if(a){const[,k]=m;b=k}else{const[,k,v]=m;b=k,y=v||""}const w=o(b.trim());return{type:e,raw:m[0],content:y.trim(),attributes:w}}},renderMarkdown:f=>{let h="";r?h=r(f):f.content&&f.content.length>0&&(h=f.content.filter(y=>y.type==="text").map(y=>y.text).join(""));const p=u(f.attrs||{}),g=s(p),m=g?` ${g}`:"";return a?`[${c}${m}]`:`[${c}${m}]${h}[/${c}]`}}}function Bh(t,e,n){var r,o,s,i;const a=t.split(`
|
|
103
|
-
`),l=[];let c="",u=0;const d=e.baseIndentSize||2;for(;u<a.length;){const f=a[u],h=f.match(e.itemPattern);if(!h){if(l.length>0)break;if(f.trim()===""){u+=1,c=`${c}${f}
|
|
104
|
-
`;continue}else return}const p=e.extractItemData(h),{indentLevel:g,mainContent:m}=p;c=`${c}${f}
|
|
105
|
-
`;const y=[m];for(u+=1;u<a.length;){const v=a[u];if(v.trim()===""){const E=a.slice(u+1).findIndex(z=>z.trim()!=="");if(E===-1)break;if((((o=(r=a[u+1+E].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:o.length)||0)>g){y.push(v),c=`${c}${v}
|
|
106
|
-
`,u+=1;continue}else break}if((((i=(s=v.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:i.length)||0)>g)y.push(v),c=`${c}${v}
|
|
107
|
-
`,u+=1;else break}let b;const w=y.slice(1);if(w.length>0){const v=w.map(x=>x.slice(g+d)).join(`
|
|
108
|
-
`);v.trim()&&(e.customNestedParser?b=e.customNestedParser(v):b=n.blockTokens(v))}const k=e.createToken(p,b);l.push(k)}if(l.length!==0)return{items:l,raw:c}}function Am(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const o=typeof n=="function"?n(r):n,[s,...i]=t.content,a=e.renderChildren([s]),l=[`${o}${a}`];return i&&i.length>0&&i.forEach(c=>{const u=e.renderChildren([c]);if(u){const d=u.split(`
|
|
109
|
-
`).map(f=>f?e.indent(f):"").join(`
|
|
110
|
-
`);l.push(d)}}),l.join(`
|
|
111
|
-
`)}function zL(t,e,n={}){const{state:r}=e,{doc:o,tr:s}=r,i=t;o.descendants((a,l)=>{const c=s.mapping.map(l),u=s.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(h=>{if(h!==i)return!1;d=h}),!d)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==d.attrs[h]&&(f=!0)}),f){const h=t.type.create({...t.attrs,...n});s.removeMark(c,u,t.type),s.addMark(c,u,h)}}),s.docChanged&&e.view.dispatch(s)}var gn=class uE extends _m{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new uE(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function ms(t){return new bL({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{const s=Xe(t.getAttributes,void 0,r,o);if(s===!1||s===null)return null;const{tr:i}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const u=l.search(/\S/),d=n.from+l.indexOf(a),f=d+a.length;if(Om(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(m=>m===t.type&&m!==p.mark.type)).filter(p=>p.to>d).length)return null;f<n.to&&i.delete(f,n.to),d>n.from&&i.delete(n.from+u,d),c=n.from+u+a.length,i.addMark(n.from+u,c,t.type.create(s||{})),i.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:LL,getOwnPropertySymbols:jL}=Object,{hasOwnProperty:FL}=Object.prototype;function Sf(t,e){return function(r,o,s){return t(r,o,s)&&e(r,o,s)}}function Ml(t){return function(n,r,o){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,o);const{cache:s}=o,i=s.get(n),a=s.get(r);if(i&&a)return i===r&&a===n;s.set(n,r),s.set(r,n);const l=t(n,r,o);return s.delete(n),s.delete(r),l}}function BL(t){return t?.[Symbol.toStringTag]}function Gb(t){return LL(t).concat(jL(t))}const VL=Object.hasOwn||((t,e)=>FL.call(t,e));function Ts(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const HL="__v",WL="__o",qL="_owner",{getOwnPropertyDescriptor:Jb,keys:Xb}=Object;function UL(t,e){return t.byteLength===e.byteLength&&uu(new Uint8Array(t),new Uint8Array(e))}function KL(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 YL(t,e){return t.byteLength===e.byteLength&&uu(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function ZL(t,e){return Ts(t.getTime(),e.getTime())}function GL(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function JL(t,e){return t===e}function Qb(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const o=new Array(r),s=t.entries();let i,a,l=0;for(;(i=s.next())&&!i.done;){const c=e.entries();let u=!1,d=0;for(;(a=c.next())&&!a.done;){if(o[d]){d++;continue}const f=i.value,h=a.value;if(n.equals(f[0],h[0],l,d,t,e,n)&&n.equals(f[1],h[1],f[0],h[0],t,e,n)){u=o[d]=!0;break}d++}if(!u)return!1;l++}return!0}const XL=Ts;function QL(t,e,n){const r=Xb(t);let o=r.length;if(Xb(e).length!==o)return!1;for(;o-- >0;)if(!dE(t,e,n,r[o]))return!1;return!0}function Fi(t,e,n){const r=Gb(t);let o=r.length;if(Gb(e).length!==o)return!1;let s,i,a;for(;o-- >0;)if(s=r[o],!dE(t,e,n,s)||(i=Jb(t,s),a=Jb(e,s),(i||a)&&(!i||!a||i.configurable!==a.configurable||i.enumerable!==a.enumerable||i.writable!==a.writable)))return!1;return!0}function ej(t,e){return Ts(t.valueOf(),e.valueOf())}function tj(t,e){return t.source===e.source&&t.flags===e.flags}function e0(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const o=new Array(r),s=t.values();let i,a;for(;(i=s.next())&&!i.done;){const l=e.values();let c=!1,u=0;for(;(a=l.next())&&!a.done;){if(!o[u]&&n.equals(i.value,a.value,i.value,a.value,t,e,n)){c=o[u]=!0;break}u++}if(!c)return!1}return!0}function uu(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 nj(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 dE(t,e,n,r){return(r===qL||r===WL||r===HL)&&(t.$$typeof||e.$$typeof)?!0:VL(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const rj="[object ArrayBuffer]",oj="[object Arguments]",sj="[object Boolean]",ij="[object DataView]",aj="[object Date]",lj="[object Error]",cj="[object Map]",uj="[object Number]",dj="[object Object]",fj="[object RegExp]",hj="[object Set]",pj="[object String]",mj={"[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},gj="[object URL]",yj=Object.prototype.toString;function bj({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:o,areFunctionsEqual:s,areMapsEqual:i,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:p}){return function(m,y,b){if(m===y)return!0;if(m==null||y==null)return!1;const w=typeof m;if(w!==typeof y)return!1;if(w!=="object")return w==="number"?a(m,y,b):w==="function"?s(m,y,b):!1;const k=m.constructor;if(k!==y.constructor)return!1;if(k===Object)return l(m,y,b);if(Array.isArray(m))return e(m,y,b);if(k===Date)return r(m,y,b);if(k===RegExp)return u(m,y,b);if(k===Map)return i(m,y,b);if(k===Set)return d(m,y,b);const v=yj.call(m);if(v===aj)return r(m,y,b);if(v===fj)return u(m,y,b);if(v===cj)return i(m,y,b);if(v===hj)return d(m,y,b);if(v===dj)return typeof m.then!="function"&&typeof y.then!="function"&&l(m,y,b);if(v===gj)return h(m,y,b);if(v===lj)return o(m,y,b);if(v===oj)return l(m,y,b);if(mj[v])return f(m,y,b);if(v===rj)return t(m,y,b);if(v===ij)return n(m,y,b);if(v===sj||v===uj||v===pj)return c(m,y,b);if(p){let x=p[v];if(!x){const E=BL(m);E&&(x=p[E])}if(x)return x(m,y,b)}return!1}}function vj({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:UL,areArraysEqual:n?Fi:KL,areDataViewsEqual:YL,areDatesEqual:ZL,areErrorsEqual:GL,areFunctionsEqual:JL,areMapsEqual:n?Sf(Qb,Fi):Qb,areNumbersEqual:XL,areObjectsEqual:n?Fi:QL,arePrimitiveWrappersEqual:ej,areRegExpsEqual:tj,areSetsEqual:n?Sf(e0,Fi):e0,areTypedArraysEqual:n?Sf(uu,Fi):uu,areUrlsEqual:nj,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const o=Ml(r.areArraysEqual),s=Ml(r.areMapsEqual),i=Ml(r.areObjectsEqual),a=Ml(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:o,areMapsEqual:s,areObjectsEqual:i,areSetsEqual:a})}return r}function wj(t){return function(e,n,r,o,s,i,a){return t(e,n,a)}}function kj({circular:t,comparator:e,createState:n,equals:r,strict:o}){if(n)return function(a,l){const{cache:c=t?new WeakMap:void 0,meta:u}=n();return e(a,l,{cache:c,equals:r,meta:u,strict:o})};if(t)return function(a,l){return e(a,l,{cache:new WeakMap,equals:r,meta:void 0,strict:o})};const s={cache:void 0,equals:r,meta:void 0,strict:o};return function(a,l){return e(a,l,s)}}const xj=Oo();Oo({strict:!0});Oo({circular:!0});Oo({circular:!0,strict:!0});Oo({createInternalComparator:()=>Ts});Oo({strict:!0,createInternalComparator:()=>Ts});Oo({circular:!0,createInternalComparator:()=>Ts});Oo({circular:!0,createInternalComparator:()=>Ts,strict:!0});function Oo(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:o=!1}=t,s=vj(t),i=bj(s),a=n?n(i):wj(i);return kj({circular:e,comparator:i,createState:r,equals:a,strict:o})}var Sj=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},Ej=({contentComponent:t})=>{const e=Rp.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return M.jsx(M.Fragment,{children:Object.values(e)})};function Cj(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:jT.createPortal(r.reactElement,r.element,n)},t.forEach(o=>o())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(o=>o())}}}var Tj=class extends ce.Component{constructor(t){var e;super(t),this.editorContentRef=ce.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}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=Cj(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),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 M.jsxs(M.Fragment,{children:[M.jsx("div",{ref:Sj(e,this.editorContentRef),...n}),t?.contentComponent&&M.jsx(Ej,{contentComponent:t.contentComponent})]})}},Mj=S.forwardRef((t,e)=>{const n=ce.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return ce.createElement(Tj,{key:n,innerRef:e,...t})}),fE=ce.memo(Mj),Rj=typeof window<"u"?S.useLayoutEffect:S.useEffect,Oj=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){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function _j(t){var e;const[n]=S.useState(()=>new Oj(t.editor)),r=Dw.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:xj);return Rj(()=>n.watch(t.editor),[t.editor,n]),S.useDebugValue(r),r}var Nj=!1,Vh=typeof window>"u",Pj=Vh||!!(typeof window<"u"&&window.next),Aj=class hE{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(){return this.options.current.immediatelyRender===void 0?Vh||Pj?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var o,s;return(s=(o=this.options.current).onBeforeCreate)==null?void 0:s.call(o,...r)},onBlur:(...r)=>{var o,s;return(s=(o=this.options.current).onBlur)==null?void 0:s.call(o,...r)},onCreate:(...r)=>{var o,s;return(s=(o=this.options.current).onCreate)==null?void 0:s.call(o,...r)},onDestroy:(...r)=>{var o,s;return(s=(o=this.options.current).onDestroy)==null?void 0:s.call(o,...r)},onFocus:(...r)=>{var o,s;return(s=(o=this.options.current).onFocus)==null?void 0:s.call(o,...r)},onSelectionUpdate:(...r)=>{var o,s;return(s=(o=this.options.current).onSelectionUpdate)==null?void 0:s.call(o,...r)},onTransaction:(...r)=>{var o,s;return(s=(o=this.options.current).onTransaction)==null?void 0:s.call(o,...r)},onUpdate:(...r)=>{var o,s;return(s=(o=this.options.current).onUpdate)==null?void 0:s.call(o,...r)},onContentError:(...r)=>{var o,s;return(s=(o=this.options.current).onContentError)==null?void 0:s.call(o,...r)},onDrop:(...r)=>{var o,s;return(s=(o=this.options.current).onDrop)==null?void 0:s.call(o,...r)},onPaste:(...r)=>{var o,s;return(s=(o=this.options.current).onPaste)==null?void 0:s.call(o,...r)},onDelete:(...r)=>{var o,s;return(s=(o=this.options.current).onDelete)==null?void 0:s.call(o,...r)}};return new ML(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((o,s)=>{var i;return o===((i=n.extensions)==null?void 0:i[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?hE.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,o)=>r===e[o]))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 Ij(t={},e=[]){const n=S.useRef(t);n.current=t;const[r]=S.useState(()=>new Aj(n)),o=Rp.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return S.useDebugValue(o),S.useEffect(r.onRender(e)),_j({editor:o,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&s===0?0:s+1}),o}var pE=S.createContext({editor:null});pE.Consumer;var $j=S.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Dj=()=>S.useContext($j);ce.forwardRef((t,e)=>{const{onDragStart:n}=Dj(),r=t.as||"div";return M.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});ce.createContext({markViewContentRef:()=>{}});var Im=S.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Im.displayName="TiptapContext";var zj=()=>S.useContext(Im);function mE({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const o=S.useMemo(()=>({editor:r}),[r]),s=S.useMemo(()=>({editor:r}),[r]);return M.jsx(pE.Provider,{value:s,children:M.jsx(Im.Provider,{value:o,children:n})})}mE.displayName="Tiptap";function gE({...t}){const{editor:e}=zj();return M.jsx(fE,{editor:e,...t})}gE.displayName="Tiptap.Content";Object.assign(mE,{Content:gE});var du=(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]},Lj=/^\s*>\s$/,jj=gn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return du("blockquote",{...xt(this.options.HTMLAttributes,t),children:du("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(o=>{const a=e.renderChildren([o]).split(`
|
|
112
|
-
`).map(l=>l.trim()===""?n:`${n} ${l}`);r.push(a.join(`
|
|
113
|
-
`))}),r.join(`
|
|
114
|
-
${n}
|
|
115
|
-
`)},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()}},addInputRules(){return[ki({find:Lj,type:this.type})]}}),Fj=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Bj=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Vj=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Hj=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Wj=Cs.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 du("strong",{...xt(this.options.HTMLAttributes,t),children:du("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),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[wi({find:Fj,type:this.type}),wi({find:Vj,type:this.type})]},addPasteRules(){return[ms({find:Bj,type:this.type}),ms({find:Hj,type:this.type})]}}),qj=/(^|[^`])`([^`]+)`(?!`)$/,Uj=/(^|[^`])`([^`]+)`(?!`)/g,Kj=Cs.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",xt(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[wi({find:qj,type:this.type})]},addPasteRules(){return[ms({find:Uj,type:this.type})]}}),Ef=4,Yj=/^```([a-z]+)?[\s\n]$/,Zj=/^~~~([a-z]+)?[\s\n]$/,Gj=gn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Ef,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(i=>i.startsWith(n)).map(i=>i.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",xt(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 o=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${o}`,e.renderChildren(t.content),"```"].join(`
|
|
116
|
-
`):r=`\`\`\`${o}
|
|
117
|
-
|
|
118
|
-
\`\`\``,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:Ef,{state:r}=t,{selection:o}=r,{$from:s,empty:i}=o;if(s.parent.type!==this.type)return!1;const a=" ".repeat(n);return i?t.commands.insertContent(a):t.commands.command(({tr:l})=>{const{from:c,to:u}=o,h=r.doc.textBetween(c,u,`
|
|
119
|
-
`,`
|
|
120
|
-
`).split(`
|
|
121
|
-
`).map(p=>a+p).join(`
|
|
122
|
-
`);return l.replaceWith(c,u,r.schema.text(h)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Ef,{state:r}=t,{selection:o}=r,{$from:s,empty:i}=o;return s.parent.type!==this.type?!1:i?t.commands.command(({tr:a})=>{var l;const{pos:c}=s,u=s.start(),d=s.end(),h=r.doc.textBetween(u,d,`
|
|
123
|
-
`,`
|
|
124
|
-
`).split(`
|
|
125
|
-
`);let p=0,g=0;const m=c-u;for(let x=0;x<h.length;x+=1){if(g+h[x].length>=m){p=x;break}g+=h[x].length+1}const b=((l=h[p].match(/^ */))==null?void 0:l[0])||"",w=Math.min(b.length,n);if(w===0)return!0;let k=u;for(let x=0;x<p;x+=1)k+=h[x].length+1;return a.delete(k,k+w),c-k<=w&&a.setSelection(_e.create(a.doc,k)),!0}):t.commands.command(({tr:a})=>{const{from:l,to:c}=o,f=r.doc.textBetween(l,c,`
|
|
126
|
-
`,`
|
|
127
|
-
`).split(`
|
|
128
|
-
`).map(h=>{var p;const g=((p=h.match(/^ */))==null?void 0:p[0])||"",m=Math.min(g.length,n);return h.slice(m)}).join(`
|
|
129
|
-
`);return a.replaceWith(l,c,r.schema.text(f)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,i=r.parent.textContent.endsWith(`
|
|
130
|
-
|
|
131
|
-
`);return!s||!i?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:o,empty:s}=n;if(!s||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;const a=o.after();return a===void 0?!1:r.nodeAt(a)?t.commands.command(({tr:c})=>(c.setSelection($e.near(r.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[Fh({find:Yj,type:this.type,getAttributes:t=>({language:t[1]})}),Fh({find:Zj,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new yt({key:new It("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"),o=r?JSON.parse(r):void 0,s=o?.mode;if(!n||!s)return!1;const{tr:i,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,`
|
|
132
|
-
`));return i.replaceSelectionWith(this.type.create({language:s},l)),i.selection.$from.parent.type!==this.type&&i.setSelection(_e.near(i.doc.resolve(Math.max(0,i.selection.from-2)))),i.setMeta("paste",!0),t.dispatch(i),!0}}})]}}),Jj=gn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
133
|
-
|
|
134
|
-
`):""}),Xj=gn.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",xt(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
135
|
-
`},renderMarkdown:()=>`
|
|
136
|
-
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:o,storedMarks:s}=n;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:a}=r.extensionManager,l=s||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&i){const d=l.filter(f=>a.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Qj=gn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,xt(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,o="#".repeat(r);return t.content?`${o} ${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=>Fh({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),eF=gn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",xt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!_L(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,o=t();return US(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:s,tr:i,dispatch:a})=>{if(a){const{$to:l}=i.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?i.setSelection(_e.create(i.doc,l.pos+1)):l.nodeAfter.isBlock?i.setSelection(Ce.create(i.doc,l.pos)):i.setSelection(_e.create(i.doc,l.pos));else{const u=s.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,d=u?.create();d&&(i.insert(c,d),i.setSelection(_e.create(i.doc,c+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[cE({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),tF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,nF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,rF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,oF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,sF=Cs.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",xt(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||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[wi({find:tF,type:this.type}),wi({find:rF,type:this.type})]},addPasteRules(){return[ms({find:nF,type:this.type}),ms({find:oF,type:this.type})]}});const iF="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",aF="ελ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",Hh="numeric",Wh="ascii",qh="alpha",pa="asciinumeric",ea="alphanumeric",Uh="domain",yE="emoji",lF="scheme",cF="slashscheme",Cf="whitespace";function uF(t,e){return t in e||(e[t]=[]),e[t]}function Go(t,e,n){e[Hh]&&(e[pa]=!0,e[ea]=!0),e[Wh]&&(e[pa]=!0,e[qh]=!0),e[pa]&&(e[ea]=!0),e[qh]&&(e[ea]=!0),e[ea]&&(e[Uh]=!0),e[yE]&&(e[Uh]=!0);for(const r in e){const o=uF(r,n);o.indexOf(t)<0&&o.push(t)}}function dF(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function un(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}un.groups={};un.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 o=e.jr[r][0],s=e.jr[r][1];if(s&&o.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 o=0;o<t.length;o++)this.tt(t[o],e,n,r)},tr(t,e,n,r){r=r||un.groups;let o;return e&&e.j?o=e:(o=new un(e),n&&r&&Go(e,n,r)),this.jr.push([t,o]),o},ts(t,e,n,r){let o=this;const s=t.length;if(!s)return o;for(let i=0;i<s-1;i++)o=o.tt(t[i]);return o.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||un.groups;const o=this;if(e&&e.j)return o.j[t]=e,e;const s=e;let i,a=o.go(t);if(a?(i=new un,Object.assign(i.j,a.j),i.jr.push.apply(i.jr,a.jr),i.jd=a.jd,i.t=a.t):i=new un,s){if(r)if(i.t&&typeof i.t=="string"){const l=Object.assign(dF(i.t,r),n);Go(s,l,r)}else n&&Go(s,n,r);i.t=s}return o.j[t]=i,i}};const Ie=(t,e,n,r,o)=>t.ta(e,n,r,o),vt=(t,e,n,r,o)=>t.tr(e,n,r,o),t0=(t,e,n,r,o)=>t.ts(e,n,r,o),ae=(t,e,n,r,o)=>t.tt(e,n,r,o),Cr="WORD",Kh="UWORD",bE="ASCIINUMERICAL",vE="ALPHANUMERICAL",za="LOCALHOST",Yh="TLD",Zh="UTLD",Nc="SCHEME",Bs="SLASH_SCHEME",$m="NUM",Gh="WS",Dm="NL",ma="OPENBRACE",ga="CLOSEBRACE",fu="OPENBRACKET",hu="CLOSEBRACKET",pu="OPENPAREN",mu="CLOSEPAREN",gu="OPENANGLEBRACKET",yu="CLOSEANGLEBRACKET",bu="FULLWIDTHLEFTPAREN",vu="FULLWIDTHRIGHTPAREN",wu="LEFTCORNERBRACKET",ku="RIGHTCORNERBRACKET",xu="LEFTWHITECORNERBRACKET",Su="RIGHTWHITECORNERBRACKET",Eu="FULLWIDTHLESSTHAN",Cu="FULLWIDTHGREATERTHAN",Tu="AMPERSAND",Mu="APOSTROPHE",Ru="ASTERISK",Zr="AT",Ou="BACKSLASH",_u="BACKTICK",Nu="CARET",Xr="COLON",zm="COMMA",Pu="DOLLAR",Qn="DOT",Au="EQUALS",Lm="EXCLAMATION",_n="HYPHEN",ya="PERCENT",Iu="PIPE",$u="PLUS",Du="POUND",ba="QUERY",jm="QUOTE",wE="FULLWIDTHMIDDLEDOT",Fm="SEMI",er="SLASH",va="TILDE",zu="UNDERSCORE",kE="EMOJI",Lu="SYM";var xE=Object.freeze({__proto__:null,ALPHANUMERICAL:vE,AMPERSAND:Tu,APOSTROPHE:Mu,ASCIINUMERICAL:bE,ASTERISK:Ru,AT:Zr,BACKSLASH:Ou,BACKTICK:_u,CARET:Nu,CLOSEANGLEBRACKET:yu,CLOSEBRACE:ga,CLOSEBRACKET:hu,CLOSEPAREN:mu,COLON:Xr,COMMA:zm,DOLLAR:Pu,DOT:Qn,EMOJI:kE,EQUALS:Au,EXCLAMATION:Lm,FULLWIDTHGREATERTHAN:Cu,FULLWIDTHLEFTPAREN:bu,FULLWIDTHLESSTHAN:Eu,FULLWIDTHMIDDLEDOT:wE,FULLWIDTHRIGHTPAREN:vu,HYPHEN:_n,LEFTCORNERBRACKET:wu,LEFTWHITECORNERBRACKET:xu,LOCALHOST:za,NL:Dm,NUM:$m,OPENANGLEBRACKET:gu,OPENBRACE:ma,OPENBRACKET:fu,OPENPAREN:pu,PERCENT:ya,PIPE:Iu,PLUS:$u,POUND:Du,QUERY:ba,QUOTE:jm,RIGHTCORNERBRACKET:ku,RIGHTWHITECORNERBRACKET:Su,SCHEME:Nc,SEMI:Fm,SLASH:er,SLASH_SCHEME:Bs,SYM:Lu,TILDE:va,TLD:Yh,UNDERSCORE:zu,UTLD:Zh,UWORD:Kh,WORD:Cr,WS:Gh});const vr=/[a-z]/,Bi=new RegExp("\\p{L}","u"),Tf=new RegExp("\\p{Emoji}","u"),wr=/\d/,Mf=/\s/,n0="\r",Rf=`
|
|
137
|
-
`,fF="️",hF="",Of="";let Rl=null,Ol=null;function pF(t=[]){const e={};un.groups=e;const n=new un;Rl==null&&(Rl=r0(iF)),Ol==null&&(Ol=r0(aF)),ae(n,"'",Mu),ae(n,"{",ma),ae(n,"}",ga),ae(n,"[",fu),ae(n,"]",hu),ae(n,"(",pu),ae(n,")",mu),ae(n,"<",gu),ae(n,">",yu),ae(n,"(",bu),ae(n,")",vu),ae(n,"「",wu),ae(n,"」",ku),ae(n,"『",xu),ae(n,"』",Su),ae(n,"<",Eu),ae(n,">",Cu),ae(n,"&",Tu),ae(n,"*",Ru),ae(n,"@",Zr),ae(n,"`",_u),ae(n,"^",Nu),ae(n,":",Xr),ae(n,",",zm),ae(n,"$",Pu),ae(n,".",Qn),ae(n,"=",Au),ae(n,"!",Lm),ae(n,"-",_n),ae(n,"%",ya),ae(n,"|",Iu),ae(n,"+",$u),ae(n,"#",Du),ae(n,"?",ba),ae(n,'"',jm),ae(n,"/",er),ae(n,";",Fm),ae(n,"~",va),ae(n,"_",zu),ae(n,"\\",Ou),ae(n,"・",wE);const r=vt(n,wr,$m,{[Hh]:!0});vt(r,wr,r);const o=vt(r,vr,bE,{[pa]:!0}),s=vt(r,Bi,vE,{[ea]:!0}),i=vt(n,vr,Cr,{[Wh]:!0});vt(i,wr,o),vt(i,vr,i),vt(o,wr,o),vt(o,vr,o);const a=vt(n,Bi,Kh,{[qh]:!0});vt(a,vr),vt(a,wr,s),vt(a,Bi,a),vt(s,wr,s),vt(s,vr),vt(s,Bi,s);const l=ae(n,Rf,Dm,{[Cf]:!0}),c=ae(n,n0,Gh,{[Cf]:!0}),u=vt(n,Mf,Gh,{[Cf]:!0});ae(n,Of,u),ae(c,Rf,l),ae(c,Of,u),vt(c,Mf,u),ae(u,n0),ae(u,Rf),vt(u,Mf,u),ae(u,Of,u);const d=vt(n,Tf,kE,{[yE]:!0});ae(d,"#"),vt(d,Tf,d),ae(d,fF,d);const f=ae(d,hF);ae(f,"#"),vt(f,Tf,d);const h=[[vr,i],[wr,o]],p=[[vr,null],[Bi,a],[wr,s]];for(let g=0;g<Rl.length;g++)Wr(n,Rl[g],Yh,Cr,h);for(let g=0;g<Ol.length;g++)Wr(n,Ol[g],Zh,Kh,p);Go(Yh,{tld:!0,ascii:!0},e),Go(Zh,{utld:!0,alpha:!0},e),Wr(n,"file",Nc,Cr,h),Wr(n,"mailto",Nc,Cr,h),Wr(n,"http",Bs,Cr,h),Wr(n,"https",Bs,Cr,h),Wr(n,"ftp",Bs,Cr,h),Wr(n,"ftps",Bs,Cr,h),Go(Nc,{scheme:!0,ascii:!0},e),Go(Bs,{slashscheme:!0,ascii:!0},e),t=t.sort((g,m)=>g[0]>m[0]?1:-1);for(let g=0;g<t.length;g++){const m=t[g][0],b=t[g][1]?{[lF]:!0}:{[cF]:!0};m.indexOf("-")>=0?b[Uh]=!0:vr.test(m)?wr.test(m)?b[pa]=!0:b[Wh]=!0:b[Hh]=!0,t0(n,m,m,b)}return t0(n,"localhost",za,{ascii:!0}),n.jd=new un(Lu),{start:n,tokens:Object.assign({groups:e},xE)}}function SE(t,e){const n=mF(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,o=[];let s=0,i=0;for(;i<r;){let a=t,l=null,c=0,u=null,d=-1,f=-1;for(;i<r&&(l=a.go(n[i]));)a=l,a.accepts()?(d=0,f=0,u=a):d>=0&&(d+=n[i].length,f++),c+=n[i].length,s+=n[i].length,i++;s-=d,i-=f,c-=d,o.push({t:u.t,v:e.slice(s-c,s),s:s-c,e:s})}return o}function mF(t){const e=[],n=t.length;let r=0;for(;r<n;){let o=t.charCodeAt(r),s,i=o<55296||o>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(i),r+=i.length}return e}function Wr(t,e,n,r,o){let s;const i=e.length;for(let a=0;a<i-1;a++){const l=e[a];t.j[l]?s=t.j[l]:(s=new un(r),s.jr=o.slice(),t.j[l]=s),t=s}return s=new un(n),s.jr=o.slice(),t.j[e[i-1]]=s,s}function r0(t){const e=[],n=[];let r=0,o="0123456789";for(;r<t.length;){let s=0;for(;o.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let i=parseInt(t.substring(r,r+s),10);i>0;i--)n.pop();r+=s}else n.push(t[r]),r++}return e}const La={defaultProtocol:"http",events:null,format:o0,formatHref:o0,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Bm(t,e=null){let n=Object.assign({},La);t&&(n=Object.assign(n,t instanceof Bm?t.o:t));const r=n.ignoreTags,o=[];for(let s=0;s<r.length;s++)o.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}Bm.prototype={o:La,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:La[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},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 o0(t){return t}function EE(t,e){this.t="token",this.v=t,this.tk=e}EE.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=La.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),o=t.get("tagName",n,e),s=this.toFormattedString(t),i={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return i.href=r,a&&(i.class=a),l&&(i.target=l),c&&(i.rel=c),u&&Object.assign(i,u),{tagName:o,attributes:i,content:s,eventListeners:d}}};function Od(t,e){class n extends EE{constructor(o,s){super(o,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const s0=Od("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),i0=Od("text"),gF=Od("nl"),_l=Od("url",{isLink:!0,toHref(t=La.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==za&&t[1].t===Xr}}),Rn=t=>new un(t);function yF({groups:t}){const e=t.domain.concat([Tu,Ru,Zr,Ou,_u,Nu,Pu,Au,_n,$m,ya,Iu,$u,Du,er,Lu,va,zu]),n=[Mu,Xr,zm,Qn,Lm,ya,ba,jm,Fm,gu,yu,ma,ga,hu,fu,pu,mu,bu,vu,wu,ku,xu,Su,Eu,Cu],r=[Tu,Mu,Ru,Ou,_u,Nu,Pu,Au,_n,ma,ga,ya,Iu,$u,Du,ba,er,Lu,va,zu],o=Rn(),s=ae(o,va);Ie(s,r,s),Ie(s,t.domain,s);const i=Rn(),a=Rn(),l=Rn();Ie(o,t.domain,i),Ie(o,t.scheme,a),Ie(o,t.slashscheme,l),Ie(i,r,s),Ie(i,t.domain,i);const c=ae(i,Zr);ae(s,Zr,c),ae(a,Zr,c),ae(l,Zr,c);const u=ae(s,Qn);Ie(u,r,s),Ie(u,t.domain,s);const d=Rn();Ie(c,t.domain,d),Ie(d,t.domain,d);const f=ae(d,Qn);Ie(f,t.domain,d);const h=Rn(s0);Ie(f,t.tld,h),Ie(f,t.utld,h),ae(c,za,h);const p=ae(d,_n);ae(p,_n,p),Ie(p,t.domain,d),Ie(h,t.domain,d),ae(h,Qn,f),ae(h,_n,p);const g=ae(h,Xr);Ie(g,t.numeric,s0);const m=ae(i,_n),y=ae(i,Qn);ae(m,_n,m),Ie(m,t.domain,i),Ie(y,r,s),Ie(y,t.domain,i);const b=Rn(_l);Ie(y,t.tld,b),Ie(y,t.utld,b),Ie(b,t.domain,i),Ie(b,r,s),ae(b,Qn,y),ae(b,_n,m),ae(b,Zr,c);const w=ae(b,Xr),k=Rn(_l);Ie(w,t.numeric,k);const v=Rn(_l),x=Rn();Ie(v,e,v),Ie(v,n,x),Ie(x,e,v),Ie(x,n,x),ae(b,er,v),ae(k,er,v);const E=ae(a,Xr),C=ae(l,Xr),A=ae(C,er),z=ae(A,er);Ie(a,t.domain,i),ae(a,Qn,y),ae(a,_n,m),Ie(l,t.domain,i),ae(l,Qn,y),ae(l,_n,m),Ie(E,t.domain,v),ae(E,er,v),ae(E,ba,v),Ie(z,t.domain,v),Ie(z,e,v),ae(z,er,v);const R=[[ma,ga],[fu,hu],[pu,mu],[gu,yu],[bu,vu],[wu,ku],[xu,Su],[Eu,Cu]];for(let _=0;_<R.length;_++){const[N,L]=R[_],H=ae(v,N);ae(x,N,H),ae(H,L,v);const Z=Rn(_l);Ie(H,e,Z);const W=Rn();Ie(H,n),Ie(Z,e,Z),Ie(Z,n,W),Ie(W,e,Z),Ie(W,n,W),ae(Z,L,v),ae(W,L,v)}return ae(o,za,b),ae(o,Dm,gF),{start:o,tokens:xE}}function bF(t,e,n){let r=n.length,o=0,s=[],i=[];for(;o<r;){let a=t,l=null,c=null,u=0,d=null,f=-1;for(;o<r&&!(l=a.go(n[o].t));)i.push(n[o++]);for(;o<r&&(c=l||a.go(n[o].t));)l=null,a=c,a.accepts()?(f=0,d=a):f>=0&&f++,o++,u++;if(f<0)o-=u,o<r&&(i.push(n[o]),o++);else{i.length>0&&(s.push(_f(i0,e,i)),i=[]),o-=f,u-=f;const h=d.t,p=n.slice(o-u,o);s.push(_f(h,e,p))}}return i.length>0&&s.push(_f(i0,e,i)),s}function _f(t,e,n){const r=n[0].s,o=n[n.length-1].e,s=e.slice(r,o);return new t(s,n)}const vF=typeof console<"u"&&console&&console.warn||(()=>{}),wF="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",dt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function kF(){return un.groups={},dt.scanner=null,dt.parser=null,dt.tokenQueue=[],dt.pluginQueue=[],dt.customSchemes=[],dt.initialized=!1,dt}function a0(t,e=!1){if(dt.initialized&&vF(`linkifyjs: already initialized - will not register custom scheme "${t}" ${wF}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
138
|
-
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
139
|
-
2. Cannot start or end with "-"
|
|
140
|
-
3. "-" cannot repeat`);dt.customSchemes.push([t,e])}function xF(){dt.scanner=pF(dt.customSchemes);for(let t=0;t<dt.tokenQueue.length;t++)dt.tokenQueue[t][1]({scanner:dt.scanner});dt.parser=yF(dt.scanner.tokens);for(let t=0;t<dt.pluginQueue.length;t++)dt.pluginQueue[t][1]({scanner:dt.scanner,parser:dt.parser});return dt.initialized=!0,dt}function Vm(t){return dt.initialized||xF(),bF(dt.parser.start,t,SE(dt.scanner.start,t))}Vm.scan=SE;function CE(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 Bm(n),o=Vm(t),s=[];for(let i=0;i<o.length;i++){const a=o[i];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}var Hm="[\0- -\u2029 ]",SF=new RegExp(Hm),EF=new RegExp(`${Hm}$`),CF=new RegExp(Hm,"g");function TF(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function MF(t){return new yt({key:new It("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!o||s)return;const{tr:i}=r,a=LS(n.doc,[...e]);if(qS(a).forEach(({newRange:c})=>{const u=Rz(r.doc,c,h=>h.isTextblock);let d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!EF.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(SF).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],g=d.pos+f.lastIndexOf(p);if(!p)return!1;const m=Vm(p).map(y=>y.toObject(t.defaultProtocol));if(!TF(m))return!1;m.filter(y=>y.isLink).map(y=>({...y,from:g+y.start+1,to:g+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>t.validate(y.value)).filter(y=>t.shouldAutoLink(y.value)).forEach(y=>{Om(y.from,y.to,r.doc).some(b=>b.mark.type===t.type)||i.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!i.steps.length)return i}})}function RF(t){return new yt({key:new It("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,s;if(r.button!==0||!e.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{const l=r.target;if(!l)return!1;const c=t.editor.view.dom;i=l.closest("a"),i&&!c.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(t.enableClickSelection&&(a=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const l=WS(e.state,t.type.name),c=(o=i.href)!=null?o:l.href,u=(s=i.target)!=null?s:l.target;c&&(window.open(c,u),a=!0)}return a}}})}function OF(t){return new yt({key:new It("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:o}=t,{state:s}=e,{selection:i}=s,{empty:a}=i;if(a)return!1;let l="";r.content.forEach(u=>{l+=u.textContent});const c=CE(l,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===l);return!l||!c||o!==void 0&&!o(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function Lo(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(CF,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var TE=Cs.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"){a0(t);return}a0(t.scheme,t.optionalSlashes)})},onDestroy(){kF()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Lo(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 o=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(o)||!/\./.test(o))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Lo(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=>!!Lo(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",xt(this.options.HTMLAttributes,t),0]:["a",xt(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,o,s;const i=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",a=(s=(o=t.attrs)==null?void 0:o.title)!=null?s:"",l=e.renderChildren(t);return a?`[${l}](${i} "${a}")`:`[${l}](${i})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Lo(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=>!!Lo(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()}},addPasteRules(){return[ms({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=CE(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:i=>!!Lo(i,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(MF({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Lo(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(RF({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(OF({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),_F=TE,NF=Object.defineProperty,PF=(t,e)=>{for(var n in e)NF(t,n,{get:e[n],enumerable:!0})},AF="listItem",l0="textStyle",c0=/^\s*([-+*])\s$/,ME=gn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",xt(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,`
|
|
141
|
-
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(AF,this.editor.getAttributes(l0)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=ki({find:c0,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ki({find:c0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(l0),editor:this.editor})),[t]}}),RE=gn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",xt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(o=>o.type==="paragraph"))n=e.parseChildren(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const i=t.tokens.slice(1),a=e.parseChildren(i);n.push(...a)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>Am(t,e,r=>{var o,s;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((s=(o=r.meta)==null?void 0:o.parentAttrs)==null?void 0:s.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),IF={};PF(IF,{findListItemPos:()=>Ja,getNextListDepth:()=>Wm,handleBackspace:()=>Jh,handleDelete:()=>Xh,hasListBefore:()=>OE,hasListItemAfter:()=>$F,hasListItemBefore:()=>_E,listItemHasSubList:()=>NE,nextListIsDeeper:()=>PE,nextListIsHigher:()=>AE});var Ja=(t,e)=>{const{$from:n}=e.selection,r=Ot(t,e.schema);let o=null,s=n.depth,i=n.pos,a=null;for(;s>0&&a===null;)o=n.node(s),o.type===r?a=s:(s-=1,i-=1);return a===null?null:{$pos:e.doc.resolve(i),depth:a}},Wm=(t,e)=>{const n=Ja(t,e);if(!n)return!1;const[,r]=jz(e,t,n.$pos.pos+4);return r},OE=(t,e,n)=>{const{$anchor:r}=t.selection,o=Math.max(0,r.pos-2),s=t.doc.resolve(o).node();return!(!s||!n.includes(s.type.name))},_E=(t,e)=>{var n;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-2);return!(o.index()===0||((n=o.nodeBefore)==null?void 0:n.type.name)!==t)},NE=(t,e,n)=>{if(!n)return!1;const r=Ot(t,e.schema);let o=!1;return n.descendants(s=>{s.type===r&&(o=!0)}),o},Jh=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!go(t.state,e)&&OE(t.state,e,n)){const{$anchor:a}=t.state.selection,l=t.state.doc.resolve(a.before()-1),c=[];l.node().descendants((f,h)=>{f.type.name===e&&c.push({node:f,pos:h})});const u=c.at(-1);if(!u)return!1;const d=t.state.doc.resolve(l.start()+u.pos+1);return t.chain().cut({from:a.start()-1,to:a.end()+1},d.end()).joinForward().run()}if(!go(t.state,e)||!Hz(t.state))return!1;const r=Ja(e,t.state);if(!r)return!1;const s=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),i=NE(e,t.state,s);return _E(e,t.state)&&!i?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},PE=(t,e)=>{const n=Wm(t,e),r=Ja(t,e);return!r||!n?!1:n>r.depth},AE=(t,e)=>{const n=Wm(t,e),r=Ja(t,e);return!r||!n?!1:n<r.depth},Xh=(t,e)=>{if(!go(t.state,e)||!Vz(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:o}=n;return!n.empty&&r.sameParent(o)?!1:PE(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():AE(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},$F=(t,e)=>{var n;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-r.parentOffset-2);return!(o.index()===o.parent.childCount-1||((n=o.nodeAfter)==null?void 0:n.type.name)!==t)},IE=St.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&&Xh(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&&Xh(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&&Jh(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&&Jh(t,n,r)&&(e=!0)}),e}}}}),u0=/^(\s*)(\d+)\.\s+(.*)$/,DF=/^\s/;function zF(t){const e=[];let n=0,r=0;for(;n<t.length;){const o=t[n],s=o.match(u0);if(!s)break;const[,i,a,l]=s,c=i.length;let u=l,d=n+1;const f=[o];for(;d<t.length;){const h=t[d];if(h.match(u0))break;if(h.trim()==="")f.push(h),u+=`
|
|
142
|
-
`,d+=1;else if(h.match(DF))f.push(h),u+=`
|
|
143
|
-
${h.slice(c+2)}`,d+=1;else break}e.push({indent:c,number:parseInt(a,10),content:u.trim(),raw:f.join(`
|
|
144
|
-
`)}),r=d,n=d}return[e,r]}function $E(t,e,n){var r;const o=[];let s=0;for(;s<t.length;){const i=t[s];if(i.indent===e){const a=i.content.split(`
|
|
145
|
-
`),l=((r=a[0])==null?void 0:r.trim())||"",c=[];l&&c.push({type:"paragraph",raw:l,tokens:n.inlineTokens(l)});const u=a.slice(1).join(`
|
|
146
|
-
`).trim();if(u){const h=n.blockTokens(u);c.push(...h)}let d=s+1;const f=[];for(;d<t.length&&t[d].indent>e;)f.push(t[d]),d+=1;if(f.length>0){const h=Math.min(...f.map(g=>g.indent)),p=$E(f,h,n);c.push({type:"list",ordered:!0,start:f[0].number,items:p,raw:f.map(g=>g.raw).join(`
|
|
147
|
-
`)})}o.push({type:"list_item",raw:i.raw,tokens:c}),s=d}else s+=1}return o}function LF(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(o=>{if(o.type==="paragraph"||o.type==="list"||o.type==="blockquote"||o.type==="code")r.push(...e.parseChildren([o]));else if(o.type==="text"&&o.tokens){const s=e.parseChildren([o]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([o]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var jF="listItem",d0="textStyle",f0=/^(\d+)\.\s$/,DE=gn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",xt(this.options.HTMLAttributes,n),0]:["ol",xt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?LF(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
148
|
-
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e?.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const o=t.split(`
|
|
149
|
-
`),[s,i]=zF(o);if(s.length===0)return;const a=$E(s,0,n);return a.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:a,raw:o.slice(0,i).join(`
|
|
150
|
-
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(jF,this.editor.getAttributes(d0)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=ki({find:f0,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ki({find:f0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(d0)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),FF=/^\s*(\[([( |x])?\])\s$/,zE=gn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",xt(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 o=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return Am(t,e,o)},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 o=document.createElement("li"),s=document.createElement("label"),i=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=d=>{var f,h;a.ariaLabel=((h=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:h.call(f,d,a.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};c(t),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",d=>d.preventDefault()),a.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const p=n();if(typeof p!="number")return!1;const g=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...g?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{o.setAttribute(d,f)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,s.append(a,i),o.append(s,l),Object.entries(e).forEach(([d,f])=>{o.setAttribute(d,f)});let u=new Set(Object.keys(e));return{dom:o,contentDOM:l,update:d=>{if(d.type!==this.type)return!1;o.dataset.checked=d.attrs.checked,a.checked=d.attrs.checked,c(d);const f=r.extensionManager.attributes,h=Da(d,f),p=new Set(Object.keys(h)),g=this.options.HTMLAttributes;return u.forEach(m=>{p.has(m)||(m in g?o.setAttribute(m,g[m]):o.removeAttribute(m))}),Object.entries(h).forEach(([m,y])=>{y==null?m in g?o.setAttribute(m,g[m]):o.removeAttribute(m):o.setAttribute(m,y)}),u=p,!0}}}},addInputRules(){return[ki({find:FF,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),LE=gn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",xt(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,`
|
|
151
|
-
`):"",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 i=Bh(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},n);return i?[{type:"taskList",raw:i.raw,items:i.items}]:n.blockTokens(s)},o=Bh(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,i)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:n.inlineTokens(s.mainContent),nestedTokens:i}),customNestedParser:r},n);if(o)return{type:"taskList",raw:o.raw,items:o.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()}}});St.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(ME.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(RE.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(IE.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(DE.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(zE.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(LE.configure(this.options.taskList)),t}});var h0=" ",BF=" ",VF=gn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",xt(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 r.length===1&&r[0].type==="text"&&(r[0].text===h0||r[0].text===BF)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?h0:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),HF=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,WF=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,qF=Cs.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",xt(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[wi({find:HF,type:this.type})]},addPasteRules(){return[ms({find:WF,type:this.type})]}}),UF=gn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),KF=Cs.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",xt(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 o=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!o)return;const s=o[2].trim();return{type:"underline",raw:o[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 YF(t={}){return new yt({view(e){return new ZF(e,t)}})}class ZF{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,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(o=>{let s=i=>{this[o](i)};return e.dom.addEventListener(o,s),{name:o,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,o=this.editorView.dom,s=o.getBoundingClientRect(),i=s.width/o.offsetWidth,a=s.height/o.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),g=d?p.bottom:p.top;d&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let m=this.width/2*a;r={left:p.left,right:p.right,top:g-m,bottom:g+m}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*i;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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 c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),f=d.width/l.offsetWidth,h=d.height/l.offsetHeight;c=d.left-l.scrollLeft*f,u=d.top-l.scrollTop*h}this.element.style.left=(r.left-c)/i+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/i+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,s=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!s){let i=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=O1(this.editorView.state.doc,i,this.editorView.dragging.slice);a!=null&&(i=a)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class wt extends $e{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return wt.valid(r)?new wt(r):$e.near(r)}content(){return pe.empty}eq(e){return e instanceof wt&&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 wt(e.resolve(n.pos))}getBookmark(){return new qm(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!GF(e)||!JF(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&wt.valid(e))return e;let o=e.pos,s=null;for(let i=e.depth;;i--){let a=e.node(i);if(n>0?e.indexAfter(i)<a.childCount:e.index(i)>0){s=a.child(n>0?e.indexAfter(i):e.index(i)-1);break}else if(i==0)return null;o+=n;let l=e.doc.resolve(o);if(wt.valid(l))return l}for(;;){let i=n>0?s.firstChild:s.lastChild;if(!i){if(s.isAtom&&!s.isText&&!Ce.isSelectable(s)){e=e.doc.resolve(o+s.nodeSize*n),r=!1;continue e}break}s=i,o+=n;let a=e.doc.resolve(o);if(wt.valid(a))return a}return null}}}wt.prototype.visible=!1;wt.findFrom=wt.findGapCursorFrom;$e.jsonID("gapcursor",wt);class qm{constructor(e){this.pos=e}map(e){return new qm(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return wt.valid(n)?new wt(n):$e.near(n)}}function jE(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function GF(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 o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||jE(o.type))return!0;if(o.inlineContent)return!1}}return!0}function JF(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 o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||jE(o.type))return!0;if(o.inlineContent)return!1}}return!0}function XF(){return new yt({props:{decorations:n3,createSelectionBetween(t,e,n){return e.pos==n.pos&&wt.valid(n)?new wt(n):null},handleClick:e3,handleKeyDown:QF,handleDOMEvents:{beforeinput:t3}}})}const QF=_S({ArrowLeft:Nl("horiz",-1),ArrowRight:Nl("horiz",1),ArrowUp:Nl("vert",-1),ArrowDown:Nl("vert",1)});function Nl(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,s){let i=r.selection,a=e>0?i.$to:i.$from,l=i.empty;if(i instanceof _e){if(!s.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=wt.findGapCursorFrom(a,e,l);return c?(o&&o(r.tr.setSelection(new wt(c))),!0):!1}}function e3(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!wt.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&Ce.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new wt(r))),!0)}function t3(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof wt))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 o=re.empty;for(let i=r.length-1;i>=0;i--)o=re.from(r[i].createAndFill(null,o));let s=t.state.tr.replace(n.pos,n.pos,new pe(o,0,0));return s.setSelection(_e.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function n3(t){if(!(t.selection instanceof wt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",mt.create(t.doc,[nn.widget(t.selection.head,e,{key:"gapcursor"})])}var ju=200,Lt=function(){};Lt.prototype.append=function(e){return e.length?(e=Lt.from(e),!this.length&&e||e.length<ju&&this.leafAppend(e)||this.length<ju&&e.leafPrepend(this)||this.appendInner(e)):this};Lt.prototype.prepend=function(e){return e.length?Lt.from(e).append(this):this};Lt.prototype.appendInner=function(e){return new r3(this,e)};Lt.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Lt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Lt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Lt.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)};Lt.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(s,i){return o.push(e(s,i))},n,r),o};Lt.from=function(e){return e instanceof Lt?e:e&&e.length?new FE(e):Lt.empty};var FE=(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(o,s){return o==0&&s==this.length?this:new e(this.values.slice(o,s))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,s,i,a){for(var l=s;l<i;l++)if(o(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(o,s,i,a){for(var l=s-1;l>=i;l--)if(o(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=ju)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=ju)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Lt);Lt.empty=new FE([]);var r3=(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,o,s,i){var a=this.left.length;if(o<a&&this.left.forEachInner(r,o,Math.min(s,a),i)===!1||s>a&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,s)-a,i+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,s,i){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(s,a)-a,i+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(o,a),s,i)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var s=this.left.length;return o<=s?this.left.slice(r,o):r>=s?this.right.slice(r-s,o-s):this.left.slice(r,s).append(this.right.slice(0,o-s))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,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})(Lt);const o3=500;class Un{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 o,s;n&&(o=this.remapping(r,this.items.length),s=o.maps.length);let i=e.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),s=o.maps.length),s--,u.push(d);return}if(o){u.push(new tr(d.map));let h=d.step.map(o.slice(s)),p;h&&i.maybeStep(h).doc&&(p=i.mapping.maps[i.mapping.maps.length-1],c.push(new tr(p,void 0,void 0,c.length+u.length))),s--,p&&o.appendMap(p,s)}else i.maybeStep(d.step);if(d.selection)return a=o?d.selection.map(o.slice(s)):d.selection,l=new Un(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:i,selection:a}}addTransform(e,n,r,o){let s=[],i=this.eventCount,a=this.items,l=!o&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new tr(e.mapping.maps[u],d,n),h;(h=l&&l.merge(f))&&(f=h,u?s.pop():a=a.slice(0,a.length-1)),s.push(f),n&&(i++,n=void 0),o||(l=f)}let c=i-r.depth;return c>i3&&(a=s3(a,c),i-=c),new Un(a.append(s),i)}remapping(e,n){let r=new _a;return this.items.forEach((o,s)=>{let i=o.mirrorOffset!=null&&s-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,i)},e,n),r}addMaps(e){return this.eventCount==0?this:new Un(this.items.append(e.map(n=>new tr(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),s=e.mapping,i=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},o);let l=n;this.items.forEach(f=>{let h=s.getMirror(--l);if(h==null)return;i=Math.min(i,h);let p=s.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),m=f.selection&&f.selection.map(s.slice(l+1,h));m&&a++,r.push(new tr(p,g,m))}else r.push(new tr(p))},o);let c=[];for(let f=n;f<i;f++)c.push(new tr(s.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new Un(u,a);return d.emptyItemCount()>o3&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],s=0;return this.items.forEach((i,a)=>{if(a>=e)o.push(i),i.selection&&s++;else if(i.step){let l=i.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=i.selection&&i.selection.map(n.slice(r));u&&s++;let d=new tr(c.invert(),l,u),f,h=o.length-1;(f=o.length&&o[h].merge(d))?o[h]=f:o.push(d)}}else i.map&&r--},this.items.length,0),new Un(Lt.from(o.reverse()),s)}}Un.empty=new Un(Lt.empty,0);function s3(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}class tr{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new tr(n.getMap().invert(),n,this.selection)}}}class Gr{constructor(e,n,r,o,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=s}}const i3=20;function a3(t,e,n,r){let o=n.getMeta(rs),s;if(o)return o.historyState;n.getMeta(u3)&&(t=new Gr(t.done,t.undone,null,0,-1));let i=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(i&&i.getMeta(rs))return i.getMeta(rs).redo?new Gr(t.done.addTransform(n,void 0,r,Pc(e)),t.undone,p0(n.mapping.maps),t.prevTime,t.prevComposition):new Gr(t.done,t.undone.addTransform(n,void 0,r,Pc(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!i&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!l3(n,t.prevRanges)),c=i?Nf(t.prevRanges,n.mapping):p0(n.mapping.maps);return new Gr(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Pc(e)),Un.empty,c,n.time,a??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Gr(t.done.rebased(n,s),t.undone.rebased(n,s),Nf(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Gr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Nf(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function l3(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&o>=e[s]&&(n=!0)}),n}function p0(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,s,i)=>e.push(s,i));return e}function Nf(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),s=e.map(t[r+1],-1);o<=s&&n.push(o,s)}return n}function c3(t,e,n){let r=Pc(e),o=rs.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let i=s.selection.resolve(s.transform.doc),a=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),o,r),l=new Gr(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(i).setMeta(rs,{redo:n,historyState:l})}let Pf=!1,m0=null;function Pc(t){let e=t.plugins;if(m0!=e){Pf=!1,m0=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Pf=!0;break}}return Pf}const rs=new It("history"),u3=new It("closeHistory");function d3(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new yt({key:rs,state:{init(){return new Gr(Un.empty,Un.empty,null,0,-1)},apply(e,n,r){return a3(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?VE:r=="historyRedo"?HE:null;return!o||!e.editable?!1:(n.preventDefault(),o(e.state,e.dispatch))}}}})}function BE(t,e){return(n,r)=>{let o=rs.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let s=c3(o,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const VE=BE(!1,!0),HE=BE(!0,!0);St.create({name:"characterCount",addOptions(){return{limit:null,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 yt({key:new It("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const o=this.options.limit;if(o==null||o===0){t=!0;return}const s=this.storage.characters({node:r.doc});if(s>o){const i=s-o,a=0,l=i;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(a,l);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:n.doc}),s=this.storage.characters({node:e.doc});if(s<=r||o>r&&s>r&&s<=o)return!0;if(o>r&&s>r&&s>o||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=s-r,c=a-l,u=a;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var f3=St.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[YF(this.options)]}});St.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new yt({key:new It("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=e,s=[];if(!n||!r)return mt.create(t,[]);let i=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(l.isText)return;if(!(o>=c&&o<=c+l.nodeSize-1))return!1;i+=1});let a=0;return t.descendants((l,c)=>{if(l.isText||!(o>=c&&o<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&i-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(nn.node(c,c+l.nodeSize,{class:this.options.className}))}),mt.create(t,s)}}})]}});var h3=St.create({name:"gapCursor",addProseMirrorPlugins(){return[XF()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Xe(xe(t,"allowGapCursor",n)))!=null?e:null}}}),g0="placeholder";function p3(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var m3=St.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:g0,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${p3(this.options.dataAttribute)}`:`data-${g0}`;return[new yt({key:new It("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=n,s=[];if(!r)return null;const i=this.editor.isEmpty;return e.descendants((a,l)=>{const c=o>=l&&o<=l+a.nodeSize,u=!a.isLeaf&&Td(a);if((c||!this.options.showOnlyCurrent)&&u){const d=[this.options.emptyNodeClass];i&&d.push(this.options.emptyEditorClass);const f=nn.node(l,l+a.nodeSize,{class:d.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:a,pos:l,hasAnchor:c}):this.options.placeholder});s.push(f)}return this.options.includeChildren}),mt.create(e,s)}}})]}});St.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new yt({key:new It("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||US(n.selection)||t.view.dragging?null:mt.create(n.doc,[nn.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function y0({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var g3=St.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new It(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(([,o])=>o).filter(o=>(this.options.notAfter||[]).concat(n).includes(o.name));return[new yt({key:e,appendTransaction:(o,s,i)=>{const{doc:a,tr:l,schema:c}=i,u=e.getState(i),d=a.content.size,f=c.nodes[n];if(u)return l.insert(d,f.create())},state:{init:(o,s)=>{const i=s.tr.doc.lastChild;return!y0({node:i,types:r})},apply:(o,s)=>{if(!o.docChanged||o.getMeta("__uniqueIDTransaction"))return s;const i=o.doc.lastChild;return!y0({node:i,types:r})}}})]}}),y3=St.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>VE(t,e),redo:()=>({state:t,dispatch:e})=>HE(t,e)}},addProseMirrorPlugins(){return[d3(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()}}}),b3=St.create({name:"starterKit",addExtensions(){var t,e,n,r;const o=[];return this.options.bold!==!1&&o.push(Wj.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(jj.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(ME.configure(this.options.bulletList)),this.options.code!==!1&&o.push(Kj.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(Gj.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(Jj.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(f3.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(h3.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(Xj.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(Qj.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(y3.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(eF.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(sF.configure(this.options.italic)),this.options.listItem!==!1&&o.push(RE.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(IE.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&o.push(TE.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(DE.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(VF.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(qF.configure(this.options.strike)),this.options.text!==!1&&o.push(UF.configure(this.options.text)),this.options.underline!==!1&&o.push(KF.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&o.push(g3.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),v3=b3,w3=m3,k3=LE,x3=zE,S3=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,E3=gn.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",xt(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,o,s,i;const a=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",l=(o=(r=t.attrs)==null?void 0:r.alt)!=null?o:"",c=(i=(s=t.attrs)==null?void 0:s.title)!=null?i:"";return c?``:``},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;return({node:o,getPos:s,HTMLAttributes:i,editor:a})=>{const l=document.createElement("img");Object.entries(i).forEach(([d,f])=>{if(f!=null)switch(d){case"width":case"height":break;default:l.setAttribute(d,f);break}}),l.src=i.src;const c=new OL({element:l,editor:a,node:o,getPos:s,onResize:(d,f)=>{l.style.width=`${d}px`,l.style.height=`${f}px`},onCommit:(d,f)=>{const h=s();h!==void 0&&this.editor.chain().setNodeSelection(h).updateAttributes(this.name,{width:d,height:f}).run()},onUpdate:(d,f,h)=>d.type===o.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),u=c.dom;return u.style.visibility="hidden",u.style.pointerEvents="none",l.onload=()=>{u.style.visibility="",u.style.pointerEvents=""},c}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[cE({find:S3,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),C3=E3;const T3=S.forwardRef(function(e,n){const{render:r,className:o,id:s,name:i,value:a,disabled:l=!1,onValueChange:c,defaultValue:u,autoFocus:d=!1,...f}=e,{state:h,name:p,disabled:g,setTouched:m,setDirty:y,validityData:b,setFocused:w,setFilled:k,validationMode:v,validation:x}=Pi(),E=g||l,C=p??i,A={...h,disabled:E},{labelId:z}=fd(),R=hd({id:s});me(()=>{const W=a!=null;x.inputRef.current?.value||W&&a!==""?k(!0):W&&a===""&&k(!1)},[x.inputRef,k,a]);const _=S.useRef(null);me(()=>{d&&_.current===Hn(Ke(_.current))&&w(!0)},[d,w]);const[N]=Ta({controlled:a,default:u,name:"FieldControl",state:"value"}),L=a!==void 0,H=L?N:void 0;return nm({id:R,name:C,commit:x.commit,value:H,getValue:()=>x.inputRef.current?.value,controlRef:x.inputRef}),rt("input",e,{ref:[n,_],state:A,props:[{id:R,disabled:E,name:C,ref:x.inputRef,"aria-labelledby":z,autoFocus:d,...L?{value:H}:{defaultValue:u},onChange(W){const q=W.currentTarget.value;c?.(q,De(po,W.nativeEvent)),y(q!==b.initialValue),k(q!=="")},onFocus(){w(!0)},onBlur(W){m(!0),w(!1),v==="onBlur"&&x.commit(W.currentTarget.value)},onKeyDown(W){W.currentTarget.tagName==="INPUT"&&W.key==="Enter"&&(m(!0),x.commit(W.currentTarget.value))}},x.getInputValidationProps(),f],stateAttributesMapping:em})}),M3=S.forwardRef(function(e,n){return M.jsx(T3,{ref:n,...e})});function _o(t){const e=Me.c(10);let n,r,o;e[0]!==t?({className:n,type:o,...r}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o):(n=e[1],r=e[2],o=e[3]);let s;e[4]!==n?(s=ue("border-input file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 disabled:bg-input/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 h-8 w-full min-w-0 rounded-lg border bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-3 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm",n),e[4]=n,e[5]=s):s=e[5];let i;return e[6]!==r||e[7]!==s||e[8]!==o?(i=M.jsx(M3,{type:o,"data-slot":"input",className:s,...r}),e[6]=r,e[7]=s,e[8]=o,e[9]=i):i=e[9],i}const WE=S.createContext(void 0);function Xa(t){const e=S.useContext(WE);if(e===void 0&&!t)throw new Error(Zt(47));return e}function R3(){return{...Bk(),disabled:!1,modal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const O3={...Vk,disabled:ge(t=>t.disabled),instantType:ge(t=>t.instantType),openMethod:ge(t=>t.openMethod),openChangeReason:ge(t=>t.openChangeReason),modal:ge(t=>t.modal),stickIfOpen:ge(t=>t.stickIfOpen),titleElementId:ge(t=>t.titleElementId),descriptionElementId:ge(t=>t.descriptionElementId),openOnHover:ge(t=>t.openOnHover),closeDelay:ge(t=>t.closeDelay),hasViewport:ge(t=>t.hasViewport)};class Um extends Op{constructor(e){const n={...R3(),...e};n.open&&e?.mounted===void 0&&(n.mounted=!0),super(n,{popupRef:S.createRef(),backdropRef:S.createRef(),internalBackdropRef:S.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:S.createRef(),beforeContentFocusGuardRef:S.createRef(),stickIfOpenTimeout:new ss,triggerElements:new ad},O3)}setOpen=(e,n)=>{const r=n.reason===kn,o=n.reason===di&&n.event.detail===0,s=!e&&(n.reason===mk||n.reason==null);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(e,n),n.isCanceled)return;const i={open:e,nativeEvent:n.event,reason:n.reason,nested:this.state.nested,triggerElement:n.trigger};this.state.floatingRootContext.context.events?.emit("openchange",i);const l=()=>{const c={open:e,openChangeReason:n.reason},u=n.trigger?.id??null;(u||e)&&(c.activeTriggerId=u,c.activeTriggerElement=n.trigger??null),this.update(c)};r?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(DM,()=>{this.set("stickIfOpen",!1)}),lr.flushSync(l)):l(),o||s?this.set("instantType",o?"click":"dismiss"):n.reason===is?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(e,n){const r=on(()=>new Um(n)).current,o=e??r;return dp(r.disposeEffect),o}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function b0({props:t}){const{children:e,open:n,defaultOpen:r=!1,onOpenChange:o,onOpenChangeComplete:s,modal:i=!1,handle:a,triggerId:l,defaultTriggerId:c=null}=t,u=Um.useStore(a?.store,{modal:i,open:r,openProp:n,activeTriggerId:c,triggerIdProp:l});Lw(()=>{n===void 0&&u.state.open===!1&&r===!0&&u.update({open:!0,activeTriggerId:c})}),u.useControlledProp("openProp",n),u.useControlledProp("triggerIdProp",l);const d=u.useState("open"),f=u.useState("positionerElement"),h=u.useState("payload"),p=u.useState("openChangeReason");u.useContextCallback("onOpenChange",o),u.useContextCallback("onOpenChangeComplete",s);const{openMethod:g,triggerProps:m,reset:y}=Xp(d);jk(u);const{forceUnmount:b}=Fk(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null}),y()});Jp(d&&i===!0&&p!==kn&&g!=="touch",f),S.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);const w=S.useCallback(H=>{const Z=De(H);return Z.preventUnmountOnClose=()=>{u.set("preventUnmountingOnClose",!0)},Z},[u]),k=S.useCallback(()=>{u.setOpen(!1,w(gk))},[u,w]);S.useImperativeHandle(t.actionsRef,()=>({unmount:b,close:k}),[b,k]);const v=Wk({popupStore:u,onOpenChange:u.setOpen}),x=Mp(v,{outsidePressEvent:{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),E=Uk(v),{getReferenceProps:C,getFloatingProps:A,getTriggerProps:z}=ld([x,E]),R=S.useMemo(()=>C(m),[C,m]),_=S.useMemo(()=>z(m),[z,m]),N=S.useMemo(()=>A(),[A]);u.useSyncedValues({modal:i,openMethod:g,activeTriggerProps:R,inactiveTriggerProps:_,popupProps:N,floatingRootContext:v,nested:Eo()!=null});const L=S.useMemo(()=>({store:u}),[u]);return M.jsx(WE.Provider,{value:L,children:typeof e=="function"?e({payload:h}):e})}function _3(t){return Xa(!0)?M.jsx(b0,{props:t}):M.jsx($M,{children:M.jsx(b0,{props:t})})}const N3=300,P3=S.forwardRef(function(e,n){const{render:r,className:o,disabled:s=!1,nativeButton:i=!0,handle:a,payload:l,openOnHover:c=!1,delay:u=N3,closeDelay:d=0,id:f,...h}=e,p=Xa(!0),g=a?.store??p?.store;if(!g)throw new Error(Zt(74));const m=bs(f),y=g.useState("isTriggerActive",m),b=g.useState("floatingRootContext"),w=g.useState("isOpenedByTrigger",m),k=S.useRef(null),{registerTrigger:v,isMountedByThisTrigger:x}=OO(m,k,g,{payload:l,disabled:s,openOnHover:c,closeDelay:d}),E=g.useState("openChangeReason"),C=g.useState("stickIfOpen"),A=g.useState("openMethod"),z=LO(b,{enabled:b!=null&&c&&(A!=="touch"||E!==di),mouseOnly:!0,move:!1,handleClose:UO(),restMs:u,delay:{close:d},triggerElementRef:k,isActiveTrigger:y}),R=Tk(b,{enabled:b!=null,stickIfOpen:C}),_=ld([R]),N=g.useState("triggerProps",x),L={disabled:s,open:w},{getButtonProps:H,buttonRef:Z}=ws({disabled:s,native:i}),W=S.useMemo(()=>({open(B){return B&&E===di?Yk.open(B):Kk.open(B)}}),[E]),q=rt("button",e,{state:L,ref:[Z,n,v,k],props:[_.getReferenceProps(),z,N,{[pk]:"",id:m},h,H],stateAttributesMapping:W}),V=S.useRef(null),D=de(B=>{lr.flushSync(()=>{g.setOpen(!1,De(is,B.nativeEvent,B.currentTarget))}),RM(V.current)?.focus()}),j=de(B=>{const F=g.select("positionerElement");if(F&&Zs(B,F))g.context.beforeContentFocusGuardRef.current?.focus();else{lr.flushSync(()=>{g.setOpen(!1,De(is,B.nativeEvent,B.currentTarget))});let T=MM(g.context.triggerFocusTargetRef.current||k.current);for(;T!==null&&Fe(F,T);){const $=T;if(T=wp(T),T===$)break}T?.focus()}});return y?M.jsxs(S.Fragment,{children:[M.jsx(fi,{ref:V,onFocus:D}),M.jsx(S.Fragment,{children:q},m),M.jsx(fi,{ref:g.context.triggerFocusTargetRef,onFocus:j})]}):M.jsx(S.Fragment,{children:q},m)}),qE=S.createContext(void 0);function A3(){const t=S.useContext(qE);if(t===void 0)throw new Error(Zt(45));return t}const I3=S.forwardRef(function(e,n){const{keepMounted:r=!1,...o}=e,{store:s}=Xa();return s.useState("mounted")||r?M.jsx(qE.Provider,{value:r,children:M.jsx(Sp,{ref:n,...o})}):null}),UE=S.createContext(void 0);function $3(){const t=S.useContext(UE);if(!t)throw new Error(Zt(46));return t}const D3=S.forwardRef(function(e,n){const{render:r,className:o,anchor:s,positionMethod:i="absolute",side:a="bottom",align:l="center",sideOffset:c=0,alignOffset:u=0,collisionBoundary:d="clipping-ancestors",collisionPadding:f=5,arrowPadding:h=5,sticky:p=!1,disableAnchorTracking:g=!1,collisionAvoidance:m=jM,...y}=e,{store:b}=Xa(),w=A3(),k=AM(),v=b.useState("floatingRootContext"),x=b.useState("mounted"),E=b.useState("open"),C=b.useState("openChangeReason"),A=b.useState("activeTriggerElement"),z=b.useState("modal"),R=b.useState("positionerElement"),_=b.useState("instantType"),N=b.useState("transitionStatus"),L=b.useState("hasViewport"),H=S.useRef(null),Z=Lk(R,!1,!1),W=Gk({anchor:s,floatingRootContext:v,positionMethod:i,mounted:x,side:a,sideOffset:c,align:l,alignOffset:u,arrowPadding:h,collisionBoundary:d,collisionPadding:f,sticky:p,disableAnchorTracking:g,keepMounted:w,nodeId:k,collisionAvoidance:m,adaptiveOrigin:L?n_:void 0}),q=S.useMemo(()=>{const T={};return E||(T.pointerEvents="none"),{role:"presentation",hidden:!x,style:{...W.positionerStyles,...T}}},[E,x,W.positionerStyles]),V=S.useMemo(()=>({props:q,...W}),[q,W]),D=v.useState("domReferenceElement");me(()=>{const T=D,$=H.current;if(T&&(H.current=T),$&&T&&T!==$){b.set("instantType",void 0);const I=new AbortController;return Z(()=>{b.set("instantType","trigger-change")},I.signal),()=>{I.abort()}}},[D,Z,b]);const j={open:E,side:V.side,align:V.align,anchorHidden:V.anchorHidden,instant:_},B=S.useCallback(T=>{b.set("positionerElement",T)},[b]),F=rt("div",e,{state:j,props:[V.props,ud(N),y],ref:[n,B],stateAttributesMapping:Ni});return M.jsxs(UE.Provider,{value:V,children:[x&&z===!0&&C!==kn&&M.jsx(Qp,{ref:b.context.internalBackdropRef,inert:dd(!E),cutout:A}),M.jsx(IM,{id:k,children:F})]})}),z3={...Ni,..._i},L3=S.forwardRef(function(e,n){const{className:r,render:o,initialFocus:s,finalFocus:i,...a}=e,{store:l}=Xa(),c=$3(),u=e1()!=null,d=l.useState("open"),f=l.useState("openMethod"),h=l.useState("instantType"),p=l.useState("transitionStatus"),g=l.useState("popupProps"),m=l.useState("titleElementId"),y=l.useState("descriptionElementId"),b=l.useState("modal"),w=l.useState("mounted"),k=l.useState("openChangeReason"),v=l.useState("activeTriggerElement"),x=l.useState("floatingRootContext");Co({open:d,ref:l.context.popupRef,onComplete(){d&&l.context.onOpenChangeComplete?.(!0)}});const E=l.useState("disabled"),C=l.useState("openOnHover"),A=l.useState("closeDelay");$O(x,{enabled:C&&!E,closeDelay:A});function z(H){return H==="touch"?l.context.popupRef.current:!0}const R=s===void 0?z:s,_={open:d,side:c.side,align:c.align,instant:h,transitionStatus:p},N=S.useCallback(H=>{l.set("popupElement",H)},[l]),L=rt("div",e,{state:_,ref:[n,l.context.popupRef,N],props:[g,{"aria-labelledby":m,"aria-describedby":y,onKeyDown(H){u&&Gp.has(H.key)&&H.stopPropagation()}},ud(p),a],stateAttributesMapping:z3});return M.jsx(Cp,{context:x,openInteractionType:f,modal:b==="trap-focus",disabled:!w||k===kn,initialFocus:R,returnFocus:i,restoreFocus:"popup",previousFocusableElement:gt(v)?v:void 0,nextFocusableElement:l.context.triggerFocusTargetRef,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:L})});function Km(t){const e=Me.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=M.jsx(_3,{"data-slot":"popover",...n}),e[2]=n,e[3]=r):r=e[3],r}function Ym(t){const e=Me.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=M.jsx(P3,{"data-slot":"popover-trigger",...n}),e[2]=n,e[3]=r):r=e[3],r}function Zm(t){const e=Me.c(18);let n,r,o,s,i,a;e[0]!==t?({className:n,align:o,alignOffset:s,side:i,sideOffset:a,...r}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=s,e[5]=i,e[6]=a):(n=e[1],r=e[2],o=e[3],s=e[4],i=e[5],a=e[6]);const l=o===void 0?"center":o,c=s===void 0?0:s,u=i===void 0?"bottom":i,d=a===void 0?4:a;let f;e[7]!==n?(f=ue("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg p-2.5 text-sm shadow-md ring-1 outline-hidden duration-100",n),e[7]=n,e[8]=f):f=e[8];let h;e[9]!==r||e[10]!==f?(h=M.jsx(L3,{"data-slot":"popover-content",className:f,...r}),e[9]=r,e[10]=f,e[11]=h):h=e[11];let p;return e[12]!==l||e[13]!==c||e[14]!==u||e[15]!==d||e[16]!==h?(p=M.jsx(I3,{children:M.jsx(D3,{align:l,alignOffset:c,side:u,sideOffset:d,className:"isolate z-50",children:h})}),e[12]=l,e[13]=c,e[14]=u,e[15]=d,e[16]=h,e[17]=p):p=e[17],p}const Af=120,j3=vo({method:"POST"}).handler(wo("28b009a83a8070215402885cb1254e3f7ab49160f54c955f55e15fd2119831e7")),F3=vo({method:"POST"}).handler(wo("1f487dcb5d0b909c2785163b904a0ee48e748b32783309e964b4502d83a2e7a7"));function B3({assetId:t,label:e}){const[n,r]=S.useState(),[o,s]=S.useState(!1),i=S.useRef(0);return S.useEffect(()=>{i.current+=1;const a=i.current;let l;return(async()=>{try{s(!1);const c=await F3({data:{assetId:t}});if(!c.ok)throw new Error(`Preview request failed (${c.status})`);const u=await c.blob();if(i.current!==a)return;l=URL.createObjectURL(u),r(l)}catch{if(i.current!==a)return;s(!0),r(void 0)}})(),()=>{i.current+=1,l&&URL.revokeObjectURL(l)}},[t]),n?M.jsx("img",{src:n,alt:e,className:"h-24 w-full rounded-md object-cover"}):M.jsx("div",{className:"bg-muted/55 text-muted-foreground flex h-24 w-full items-center justify-center rounded-md",children:o?M.jsx(Dp,{className:"size-5"}):M.jsx(Nr,{className:"size-5 animate-spin"})})}function KE(t){const e=Me.c(36),{currentFilePath:n,sourceMode:r,onSelectPath:o,onSourceModeChange:s,enabled:i,className:a,maxHeightClassName:l}=t,c=i===void 0?!0:i,[u,d]=S.useState(""),[f,h]=S.useState(!1),[p,g]=S.useState();let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=[],e[0]=m):m=e[0];const[y,b]=S.useState(m),[w,k]=S.useState();let v,x;e[1]!==n||e[2]!==c||e[3]!==w||e[4]!==r?(v=()=>{const z=`${n}::${r}`;if(!c||w===z)return;let R=!1;return h(!0),g(void 0),j3({data:{currentFilePath:n,sourceMode:r}}).then(_=>{R||(b(_),k(z))}).catch(_=>{if(R)return;const N=_ instanceof Error?_.message:String(_);g(N),Mr.error(`Unable to load image assets: ${N}`)}).finally(()=>{R||h(!1)}),()=>{R=!0}},x=[n,c,w,r],e[1]=n,e[2]=c,e[3]=w,e[4]=r,e[5]=v,e[6]=x):(v=e[5],x=e[6]),S.useEffect(v,x);let E;if(e[7]!==y||e[8]!==u){const z=u.trim().toLowerCase();E=y.filter(R=>z.length===0?!0:R.displayPath.toLowerCase().includes(z)||R.value.toLowerCase().includes(z)),e[7]=y,e[8]=u,e[9]=E}else E=e[9];const C=E;let A;if(e[10]!==a||e[11]!==p||e[12]!==C||e[13]!==f||e[14]!==l||e[15]!==o||e[16]!==s||e[17]!==u||e[18]!==r){const z=C.slice(0,Af);let R;e[20]!==a?(R=ue("space-y-2",a),e[20]=a,e[21]=R):R=e[21];let _;e[22]!==s||e[23]!==r?(_=s?M.jsxs("div",{className:"bg-muted/50 inline-flex rounded-md p-0.5",children:[M.jsx("button",{type:"button",className:ue("rounded-sm px-2 py-1 text-[11px] font-medium transition-colors",r==="asset"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>s("asset"),children:"src"}),M.jsx("button",{type:"button",className:ue("rounded-sm px-2 py-1 text-[11px] font-medium transition-colors",r==="public"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>s("public"),children:"public"})]}):M.jsxs(Wc,{variant:"secondary",className:"bg-muted text-foreground/75 rounded-md border-transparent text-[11px] normal-case",children:["source: ",r==="public"?"public":"src"]}),e[22]=s,e[23]=r,e[24]=_):_=e[24];let N;e[25]===Symbol.for("react.memo_cache_sentinel")?(N=M.jsx(jN,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2"}),e[25]=N):N=e[25];let L;e[26]===Symbol.for("react.memo_cache_sentinel")?(L=V=>{d(V.target.value)},e[26]=L):L=e[26];let H;e[27]!==u?(H=M.jsxs("div",{className:"relative w-60 max-w-full",children:[N,M.jsx(_o,{value:u,onChange:L,className:"bg-muted/50 focus-visible:ring-ring/35 h-8 border-transparent pl-8 text-xs shadow-none focus-visible:border-transparent focus-visible:ring-2",placeholder:"Search assets...","aria-label":"Search assets"})]}),e[27]=u,e[28]=H):H=e[28];let Z;e[29]!==H||e[30]!==_?(Z=M.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[_,H]}),e[29]=H,e[30]=_,e[31]=Z):Z=e[31];let W;e[32]!==f?(W=f?M.jsxs("div",{className:"text-muted-foreground flex h-32 items-center justify-center gap-2 text-sm",children:[M.jsx(Nr,{className:"size-4 animate-spin"}),"Loading assets..."]}):null,e[32]=f,e[33]=W):W=e[33];let q;e[34]!==p?(q=p?M.jsx("div",{className:"text-destructive rounded-md bg-red-500/10 px-3 py-2 text-xs",children:p}):null,e[34]=p,e[35]=q):q=e[35],A=M.jsxs("div",{className:R,children:[Z,W,q,!f&&!p?M.jsxs(M.Fragment,{children:[M.jsx("div",{className:ue("grid grid-cols-3 gap-2 overflow-auto pr-1",l??"max-h-88"),children:z.map(V=>M.jsxs("button",{type:"button",className:"border-border/40 hover:border-ring/35 bg-muted/25 hover:bg-muted/35 space-y-1.5 rounded-lg border p-1.5 text-left transition-colors",onClick:()=>{o(V.value),Mr.success(`Selected image: ${V.displayPath}`)},title:V.value,children:[M.jsx(B3,{assetId:V.id,label:V.displayPath}),M.jsx("p",{className:"text-foreground/85 truncate text-[11px]",children:V.displayPath})]},V.id))}),C.length===0?M.jsx("p",{className:"text-muted-foreground text-xs",children:"No assets found."}):null,C.length>Af?M.jsxs("p",{className:"text-muted-foreground text-xs",children:["Showing first ",Af," assets. Refine search for more."]}):null]}):null]}),e[10]=a,e[11]=p,e[12]=C,e[13]=f,e[14]=l,e[15]=o,e[16]=s,e[17]=u,e[18]=r,e[19]=A}else A=e[19];return A}function YE(t){const e=Me.c(15),{currentFilePath:n,sourceMode:r,triggerLabel:o,onSelectPath:s}=t,[i,a]=S.useState(!1);let l,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=ue(Ea({variant:"outline"}),"h-8 border-dashed text-xs"),c=M.jsx(Dp,{className:"size-3.5"}),e[0]=l,e[1]=c):(l=e[0],c=e[1]);let u;e[2]!==o?(u=M.jsxs(Ym,{className:l,children:[c,o]}),e[2]=o,e[3]=u):u=e[3];let d;e[4]!==s?(d=p=>{s(p),a(!1)},e[4]=s,e[5]=d):d=e[5];let f;e[6]!==n||e[7]!==i||e[8]!==r||e[9]!==d?(f=M.jsx(Zm,{className:"w-136 max-w-[calc(100vw-2rem)] p-3",children:M.jsx(KE,{enabled:i,currentFilePath:n,sourceMode:r,onSelectPath:d})}),e[6]=n,e[7]=i,e[8]=r,e[9]=d,e[10]=f):f=e[10];let h;return e[11]!==i||e[12]!==u||e[13]!==f?(h=M.jsxs(Km,{open:i,onOpenChange:a,children:[u,f]}),e[11]=i,e[12]=u,e[13]=f,e[14]=h):h=e[14],h}const ZE=vo({method:"POST"}).handler(wo("8346edc0b9da2addd68ca674ed9b2030f439d40deb713c45ef88393f5bdb91b9"));function Gm(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ms=Gm();function GE(t){Ms=t}var Wo={exec:()=>null};function We(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(o,s)=>{let i=typeof s=="string"?s:s.source;return i=i.replace(rn.caret,"$1"),n=n.replace(o,i),r},getRegex:()=>new RegExp(n,e)};return r}var V3=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),rn={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)}}>`)},H3=/^(?:[ \t]*(?:\n|$))+/,W3=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,q3=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Qa=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,U3=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Jm=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,JE=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,XE=We(JE).replace(/bull/g,Jm).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(),K3=We(JE).replace(/bull/g,Jm).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(),Xm=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Y3=/^[^\n]+/,Qm=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Z3=We(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Qm).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),G3=We(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Jm).getRegex(),_d="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",eg=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,J3=We("^ {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",eg).replace("tag",_d).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),QE=We(Xm).replace("hr",Qa).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",_d).getRegex(),X3=We(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",QE).getRegex(),tg={blockquote:X3,code:W3,def:Z3,fences:q3,heading:U3,hr:Qa,html:J3,lheading:XE,list:G3,newline:H3,paragraph:QE,table:Wo,text:Y3},v0=We("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Qa).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",_d).getRegex(),Q3={...tg,lheading:K3,table:v0,paragraph:We(Xm).replace("hr",Qa).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",v0).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",_d).getRegex()},eB={...tg,html:We(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",eg).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:Wo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:We(Xm).replace("hr",Qa).replace("heading",` *#{1,6} *[^
|
|
152
|
-
]`).replace("lheading",XE).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},tB=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,nB=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,eC=/^( {2,}|\\)\n(?!\s*$)/,rB=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Nd=/[\p{P}\p{S}]/u,ng=/[\s\p{P}\p{S}]/u,tC=/[^\s\p{P}\p{S}]/u,oB=We(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ng).getRegex(),nC=/(?!~)[\p{P}\p{S}]/u,sB=/(?!~)[\s\p{P}\p{S}]/u,iB=/(?:[^\s\p{P}\p{S}]|~)/u,rC=/(?![*_])[\p{P}\p{S}]/u,aB=/(?![*_])[\s\p{P}\p{S}]/u,lB=/(?:[^\s\p{P}\p{S}]|[*_])/u,cB=We(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",V3?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),oC=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,uB=We(oC,"u").replace(/punct/g,Nd).getRegex(),dB=We(oC,"u").replace(/punct/g,nC).getRegex(),sC="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",fB=We(sC,"gu").replace(/notPunctSpace/g,tC).replace(/punctSpace/g,ng).replace(/punct/g,Nd).getRegex(),hB=We(sC,"gu").replace(/notPunctSpace/g,iB).replace(/punctSpace/g,sB).replace(/punct/g,nC).getRegex(),pB=We("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,tC).replace(/punctSpace/g,ng).replace(/punct/g,Nd).getRegex(),mB=We(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,rC).getRegex(),gB="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",yB=We(gB,"gu").replace(/notPunctSpace/g,lB).replace(/punctSpace/g,aB).replace(/punct/g,rC).getRegex(),bB=We(/\\(punct)/,"gu").replace(/punct/g,Nd).getRegex(),vB=We(/^<(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(),wB=We(eg).replace("(?:-->|$)","-->").getRegex(),kB=We("^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",wB).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Fu=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,xB=We(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Fu).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),iC=We(/^!?\[(label)\]\[(ref)\]/).replace("label",Fu).replace("ref",Qm).getRegex(),aC=We(/^!?\[(ref)\](?:\[\])?/).replace("ref",Qm).getRegex(),SB=We("reflink|nolink(?!\\()","g").replace("reflink",iC).replace("nolink",aC).getRegex(),w0=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,rg={_backpedal:Wo,anyPunctuation:bB,autolink:vB,blockSkip:cB,br:eC,code:nB,del:Wo,delLDelim:Wo,delRDelim:Wo,emStrongLDelim:uB,emStrongRDelimAst:fB,emStrongRDelimUnd:pB,escape:tB,link:xB,nolink:aC,punctuation:oB,reflink:iC,reflinkSearch:SB,tag:kB,text:rB,url:Wo},EB={...rg,link:We(/^!?\[(label)\]\((.*?)\)/).replace("label",Fu).getRegex(),reflink:We(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Fu).getRegex()},Qh={...rg,emStrongRDelimAst:hB,emStrongLDelim:dB,delLDelim:mB,delRDelim:yB,url:We(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",w0).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:We(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",w0).getRegex()},CB={...Qh,br:We(eC).replace("{2,}","*").getRegex(),text:We(Qh.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Pl={normal:tg,gfm:Q3,pedantic:eB},Vi={normal:rg,gfm:Qh,breaks:CB,pedantic:EB},TB={"&":"&","<":"<",">":">",'"':""","'":"'"},k0=t=>TB[t];function Xn(t,e){if(e){if(rn.escapeTest.test(t))return t.replace(rn.escapeReplace,k0)}else if(rn.escapeTestNoEncode.test(t))return t.replace(rn.escapeReplaceNoEncode,k0);return t}function x0(t){try{t=encodeURI(t).replace(rn.percentDecode,"%")}catch{return null}return t}function S0(t,e){let n=t.replace(rn.findPipe,(s,i,a)=>{let l=!1,c=i;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),r=n.split(rn.splitPipe),o=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(;o<r.length;o++)r[o]=r[o].trim().replace(rn.slashPipe,"|");return r}function Hi(t,e,n){let r=t.length;if(r===0)return"";let o=0;for(;o<r&&t.charAt(r-o-1)===e;)o++;return t.slice(0,r-o)}function MB(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 RB(t,e=0){let n=e,r="";for(let o of t)if(o===" "){let s=4-n%4;r+=" ".repeat(s),n+=s}else r+=o,n++;return r}function E0(t,e,n,r,o){let s=e.href,i=e.title||null,a=t[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:i,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}function OB(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let o=r[1];return e.split(`
|
|
153
|
-
`).map(s=>{let i=s.match(n.other.beginningSpace);if(i===null)return s;let[a]=i;return a.length>=o.length?s.slice(o.length):s}).join(`
|
|
154
|
-
`)}var Bu=class{options;rules;lexer;constructor(t){this.options=t||Ms}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:Hi(n,`
|
|
155
|
-
`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=OB(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=Hi(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:Hi(e[0],`
|
|
156
|
-
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=Hi(e[0],`
|
|
157
|
-
`).split(`
|
|
158
|
-
`),r="",o="",s=[];for(;n.length>0;){let i=!1,a=[],l;for(l=0;l<n.length;l++)if(this.rules.other.blockquoteStart.test(n[l]))a.push(n[l]),i=!0;else if(!i)a.push(n[l]);else break;n=n.slice(l);let c=a.join(`
|
|
159
|
-
`),u=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
160
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
161
|
-
${c}`:c,o=o?`${o}
|
|
162
|
-
${u}`:u;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,s,!0),this.lexer.state.top=d,n.length===0)break;let f=s.at(-1);if(f?.type==="code")break;if(f?.type==="blockquote"){let h=f,p=h.raw+`
|
|
163
|
-
`+n.join(`
|
|
164
|
-
`),g=this.blockquote(p);s[s.length-1]=g,r=r.substring(0,r.length-h.raw.length)+g.raw,o=o.substring(0,o.length-h.text.length)+g.text;break}else if(f?.type==="list"){let h=f,p=h.raw+`
|
|
165
|
-
`+n.join(`
|
|
166
|
-
`),g=this.list(p);s[s.length-1]=g,r=r.substring(0,r.length-f.raw.length)+g.raw,o=o.substring(0,o.length-h.raw.length)+g.raw,n=p.substring(s.at(-1).raw.length).split(`
|
|
167
|
-
`);continue}}return{type:"blockquote",raw:r,tokens:s,text:o}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim(),r=n.length>1,o={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),i=!1;for(;t;){let l=!1,c="",u="";if(!(e=s.exec(t))||this.rules.block.hr.test(t))break;c=e[0],t=t.substring(c.length);let d=RB(e[2].split(`
|
|
168
|
-
`,1)[0],e[1].length),f=t.split(`
|
|
169
|
-
`,1)[0],h=!d.trim(),p=0;if(this.options.pedantic?(p=2,u=d.trimStart()):h?p=e[1].length+1:(p=d.search(this.rules.other.nonSpaceChar),p=p>4?1:p,u=d.slice(p),p+=e[1].length),h&&this.rules.other.blankLine.test(f)&&(c+=f+`
|
|
170
|
-
`,t=t.substring(f.length+1),l=!0),!l){let g=this.rules.other.nextBulletRegex(p),m=this.rules.other.hrRegex(p),y=this.rules.other.fencesBeginRegex(p),b=this.rules.other.headingBeginRegex(p),w=this.rules.other.htmlBeginRegex(p),k=this.rules.other.blockquoteBeginRegex(p);for(;t;){let v=t.split(`
|
|
171
|
-
`,1)[0],x;if(f=v,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),x=f):x=f.replace(this.rules.other.tabCharGlobal," "),y.test(f)||b.test(f)||w.test(f)||k.test(f)||g.test(f)||m.test(f))break;if(x.search(this.rules.other.nonSpaceChar)>=p||!f.trim())u+=`
|
|
172
|
-
`+x.slice(p);else{if(h||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||y.test(d)||b.test(d)||m.test(d))break;u+=`
|
|
173
|
-
`+f}h=!f.trim(),c+=v+`
|
|
174
|
-
`,t=t.substring(v.length+1),d=x.slice(p)}}o.loose||(i?o.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(i=!0)),o.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),o.raw+=c}let a=o.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let l of o.items){if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),l.task){if(l.text=l.text.replace(this.rules.other.listReplaceTask,""),l.tokens[0]?.type==="text"||l.tokens[0]?.type==="paragraph"){l.tokens[0].raw=l.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),l.tokens[0].text=l.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}}let c=this.rules.other.listTaskCheckbox.exec(l.raw);if(c){let u={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};l.checked=u.checked,o.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=u.raw+l.tokens[0].raw,l.tokens[0].text=u.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(u)):l.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):l.tokens.unshift(u)}}if(!o.loose){let c=l.tokens.filter(d=>d.type==="space"),u=c.length>0&&c.some(d=>this.rules.other.anyLine.test(d.raw));o.loose=u}}if(o.loose)for(let l of o.items){l.loose=!0;for(let c of l.tokens)c.type==="text"&&(c.type="paragraph")}return o}}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"):"",o=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:o}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=S0(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
175
|
-
`):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let i of r)this.rules.other.tableAlignRight.test(i)?s.align.push("right"):this.rules.other.tableAlignCenter.test(i)?s.align.push("center"):this.rules.other.tableAlignLeft.test(i)?s.align.push("left"):s.align.push(null);for(let i=0;i<n.length;i++)s.header.push({text:n[i],tokens:this.lexer.inline(n[i]),header:!0,align:s.align[i]});for(let i of o)s.rows.push(S0(i,s.header.length).map((a,l)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:s.align[l]})));return s}}lheading(t){let 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){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===`
|
|
176
|
-
`?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=Hi(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=MB(e[2],"()");if(s===-2)return;if(s>-1){let i=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,i).trim(),e[3]=""}}let r=e[2],o="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],o=s[3])}else o=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)),E0(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.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," "),o=e[r.toLowerCase()];if(!o){let s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return E0(n,o,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))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,s,i,a=o,l=0,c=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*t.length+o);(r=c.exec(e))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(i=[...s].length,r[3]||r[4]){a+=i;continue}else if((r[5]||r[6])&&o%3&&!((o+i)%3)){l+=i;continue}if(a-=i,a>0)continue;i=Math.min(i,i+a+l);let u=[...r[0]][0].length,d=t.slice(0,o+r.index+u+i);if(Math.min(o,i)%2){let h=d.slice(1,-1);return{type:"em",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}let f=d.slice(2,-2);return{type:"strong",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}}}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),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&o&&(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 o=[...r[0]].length-1,s,i,a=o,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*t.length+o);(r=l.exec(e))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(i=[...s].length,i!==o))continue;if(r[3]||r[4]){a+=i;continue}if(a-=i,a>0)continue;i=Math.min(i,i+a);let c=[...r[0]][0].length,u=t.slice(0,o+r.index+c+i),d=u.slice(o,-o);return{type:"del",raw:u,text:d,tokens:this.lexer.inlineTokens(d)}}}}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 o;do o=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(o!==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}}}},Wn=class ep{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ms,this.options.tokenizer=this.options.tokenizer||new Bu,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:rn,block:Pl.normal,inline:Vi.normal};this.options.pedantic?(n.block=Pl.pedantic,n.inline=Vi.pedantic):this.options.gfm&&(n.block=Pl.gfm,this.options.breaks?n.inline=Vi.breaks:n.inline=Vi.gfm),this.tokenizer.rules=n}static get rules(){return{block:Pl,inline:Vi}}static lex(e,n){return new ep(n).lex(e)}static lexInline(e,n){return new ep(n).inlineTokens(e)}lex(e){e=e.replace(rn.carriageReturn,`
|
|
177
|
-
`),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.options.pedantic&&(e=e.replace(rn.tabCharGlobal," ").replace(rn.spaceLine,""));e;){let o;if(this.options.extensions?.block?.some(i=>(o=i.call({lexer:this},e,n))?(e=e.substring(o.raw.length),n.push(o),!0):!1))continue;if(o=this.tokenizer.space(e)){e=e.substring(o.raw.length);let i=n.at(-1);o.raw.length===1&&i!==void 0?i.raw+=`
|
|
178
|
-
`:n.push(o);continue}if(o=this.tokenizer.code(e)){e=e.substring(o.raw.length);let i=n.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
|
|
179
|
-
`)?"":`
|
|
180
|
-
`)+o.raw,i.text+=`
|
|
181
|
-
`+o.text,this.inlineQueue.at(-1).src=i.text):n.push(o);continue}if(o=this.tokenizer.fences(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.heading(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.hr(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.blockquote(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.list(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.html(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.def(e)){e=e.substring(o.raw.length);let i=n.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
|
|
182
|
-
`)?"":`
|
|
183
|
-
`)+o.raw,i.text+=`
|
|
184
|
-
`+o.raw,this.inlineQueue.at(-1).src=i.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title},n.push(o));continue}if(o=this.tokenizer.table(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.lheading(e)){e=e.substring(o.raw.length),n.push(o);continue}let s=e;if(this.options.extensions?.startBlock){let i=1/0,a=e.slice(1),l;this.options.extensions.startBlock.forEach(c=>{l=c.call({lexer:this},a),typeof l=="number"&&l>=0&&(i=Math.min(i,l))}),i<1/0&&i>=0&&(s=e.substring(0,i+1))}if(this.state.top&&(o=this.tokenizer.paragraph(s))){let i=n.at(-1);r&&i?.type==="paragraph"?(i.raw+=(i.raw.endsWith(`
|
|
185
|
-
`)?"":`
|
|
186
|
-
`)+o.raw,i.text+=`
|
|
187
|
-
`+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):n.push(o),r=s.length!==e.length,e=e.substring(o.raw.length);continue}if(o=this.tokenizer.text(e)){e=e.substring(o.raw.length);let i=n.at(-1);i?.type==="text"?(i.raw+=(i.raw.endsWith(`
|
|
188
|
-
`)?"":`
|
|
189
|
-
`)+o.raw,i.text+=`
|
|
190
|
-
`+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):n.push(o);continue}if(e){let i="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(i);break}else throw new Error(i)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){let r=e,o=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)l.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,o.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(o=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)s=o[2]?o[2].length:0,r=r.slice(0,o.index+s)+"["+"a".repeat(o[0].length-s-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let i=!1,a="";for(;e;){i||(a=""),i=!1;let l;if(this.options.extensions?.inline?.some(u=>(l=u.call({lexer:this},e,n))?(e=e.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let u=n.at(-1);l.type==="text"&&u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):n.push(l);continue}if(l=this.tokenizer.emStrong(e,r,a)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.del(e,r,a)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),n.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),n.push(l);continue}let c=e;if(this.options.extensions?.startInline){let u=1/0,d=e.slice(1),f;this.options.extensions.startInline.forEach(h=>{f=h.call({lexer:this},d),typeof f=="number"&&f>=0&&(u=Math.min(u,f))}),u<1/0&&u>=0&&(c=e.substring(0,u+1))}if(l=this.tokenizer.inlineText(c)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(a=l.raw.slice(-1)),i=!0;let u=n.at(-1);u?.type==="text"?(u.raw+=l.raw,u.text+=l.text):n.push(l);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return n}},Vu=class{options;parser;constructor(t){this.options=t||Ms}space(t){return""}code({text:t,lang:e,escaped:n}){let r=(e||"").match(rn.notSpaceStart)?.[0],o=t.replace(rn.endingNewline,"")+`
|
|
191
|
-
`;return r?'<pre><code class="language-'+Xn(r)+'">'+(n?o:Xn(o,!0))+`</code></pre>
|
|
192
|
-
`:"<pre><code>"+(n?o:Xn(o,!0))+`</code></pre>
|
|
193
|
-
`}blockquote({tokens:t}){return`<blockquote>
|
|
194
|
-
${this.parser.parse(t)}</blockquote>
|
|
195
|
-
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
196
|
-
`}hr(t){return`<hr>
|
|
197
|
-
`}list(t){let e=t.ordered,n=t.start,r="";for(let i=0;i<t.items.length;i++){let a=t.items[i];r+=this.listitem(a)}let o=e?"ol":"ul",s=e&&n!==1?' start="'+n+'"':"";return"<"+o+s+`>
|
|
198
|
-
`+r+"</"+o+`>
|
|
199
|
-
`}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
|
|
200
|
-
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
201
|
-
`}table(t){let e="",n="";for(let o=0;o<t.header.length;o++)n+=this.tablecell(t.header[o]);e+=this.tablerow({text:n});let r="";for(let o=0;o<t.rows.length;o++){let s=t.rows[o];n="";for(let i=0;i<s.length;i++)n+=this.tablecell(s[i]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
|
|
202
|
-
<thead>
|
|
203
|
-
`+e+`</thead>
|
|
204
|
-
`+r+`</table>
|
|
205
|
-
`}tablerow({text:t}){return`<tr>
|
|
206
|
-
${t}</tr>
|
|
207
|
-
`}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
208
|
-
`}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>${Xn(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),o=x0(t);if(o===null)return r;t=o;let s='<a href="'+t+'"';return e&&(s+=' title="'+Xn(e)+'"'),s+=">"+r+"</a>",s}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let o=x0(t);if(o===null)return Xn(n);t=o;let s=`<img src="${t}" alt="${Xn(n)}"`;return e&&(s+=` title="${Xn(e)}"`),s+=">",s}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Xn(t.text)}},og=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}},qn=class tp{options;renderer;textRenderer;constructor(e){this.options=e||Ms,this.options.renderer=this.options.renderer||new Vu,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new og}static parse(e,n){return new tp(n).parse(e)}static parseInline(e,n){return new tp(n).parseInline(e)}parse(e){let n="";for(let r=0;r<e.length;r++){let o=e[r];if(this.options.extensions?.renderers?.[o.type]){let i=o,a=this.options.extensions.renderers[i.type].call({parser:this},i);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(i.type)){n+=a||"";continue}}let s=o;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 i='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return n}parseInline(e,n=this.renderer){let r="";for(let o=0;o<e.length;o++){let s=e[o];if(this.options.extensions?.renderers?.[s.type]){let a=this.options.extensions.renderers[s.type].call({parser:this},s);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){r+=a||"";continue}}let i=s;switch(i.type){case"escape":{r+=n.text(i);break}case"html":{r+=n.html(i);break}case"link":{r+=n.link(i);break}case"image":{r+=n.image(i);break}case"checkbox":{r+=n.checkbox(i);break}case"strong":{r+=n.strong(i);break}case"em":{r+=n.em(i);break}case"codespan":{r+=n.codespan(i);break}case"br":{r+=n.br(i);break}case"del":{r+=n.del(i);break}case"text":{r+=n.text(i);break}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}},ta=class{options;block;constructor(t){this.options=t||Ms}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(){return this.block?Wn.lex:Wn.lexInline}provideParser(){return this.block?qn.parse:qn.parseInline}},_B=class{defaults=Gm();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=qn;Renderer=Vu;TextRenderer=og;Lexer=Wn;Tokenizer=Bu;Hooks=ta;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 o=r;for(let s of o.header)n=n.concat(this.walkTokens(s.tokens,e));for(let s of o.rows)for(let i of s)n=n.concat(this.walkTokens(i.tokens,e));break}case"list":{let o=r;n=n.concat(this.walkTokens(o.items,e));break}default:{let o=r;this.defaults.extensions?.childTokens?.[o.type]?this.defaults.extensions.childTokens[o.type].forEach(s=>{let i=o[s].flat(1/0);n=n.concat(this.walkTokens(i,e))}):o.tokens&&(n=n.concat(this.walkTokens(o.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(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let s=e.renderers[o.name];s?e.renderers[o.name]=function(...i){let a=o.renderer.apply(this,i);return a===!1&&(a=s.apply(this,i)),a}:e.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[o.level];s?s.unshift(o.tokenizer):e[o.level]=[o.tokenizer],o.start&&(o.level==="block"?e.startBlock?e.startBlock.push(o.start):e.startBlock=[o.start]:o.level==="inline"&&(e.startInline?e.startInline.push(o.start):e.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(e.childTokens[o.name]=o.childTokens)}),r.extensions=e),n.renderer){let o=this.defaults.renderer||new Vu(this.defaults);for(let s in n.renderer){if(!(s in o))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let i=s,a=n.renderer[i],l=o[i];o[i]=(...c)=>{let u=a.apply(o,c);return u===!1&&(u=l.apply(o,c)),u||""}}r.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new Bu(this.defaults);for(let s in n.tokenizer){if(!(s in o))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let i=s,a=n.tokenizer[i],l=o[i];o[i]=(...c)=>{let u=a.apply(o,c);return u===!1&&(u=l.apply(o,c)),u}}r.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new ta;for(let s in n.hooks){if(!(s in o))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let i=s,a=n.hooks[i],l=o[i];ta.passThroughHooks.has(s)?o[i]=c=>{if(this.defaults.async&&ta.passThroughHooksRespectAsync.has(s))return(async()=>{let d=await a.call(o,c);return l.call(o,d)})();let u=a.call(o,c);return l.call(o,u)}:o[i]=(...c)=>{if(this.defaults.async)return(async()=>{let d=await a.apply(o,c);return d===!1&&(d=await l.apply(o,c)),d})();let u=a.apply(o,c);return u===!1&&(u=l.apply(o,c)),u}}r.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(i){let a=[];return a.push(s.call(this,i)),o&&(a=a.concat(o.call(this,i))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Wn.lex(t,e??this.defaults)}parser(t,e){return qn.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let r={...n},o={...this.defaults,...r},s=this.onError(!!o.silent,!!o.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(o.hooks&&(o.hooks.options=o,o.hooks.block=t),o.async)return(async()=>{let i=o.hooks?await o.hooks.preprocess(e):e,a=await(o.hooks?await o.hooks.provideLexer():t?Wn.lex:Wn.lexInline)(i,o),l=o.hooks?await o.hooks.processAllTokens(a):a;o.walkTokens&&await Promise.all(this.walkTokens(l,o.walkTokens));let c=await(o.hooks?await o.hooks.provideParser():t?qn.parse:qn.parseInline)(l,o);return o.hooks?await o.hooks.postprocess(c):c})().catch(s);try{o.hooks&&(e=o.hooks.preprocess(e));let i=(o.hooks?o.hooks.provideLexer():t?Wn.lex:Wn.lexInline)(e,o);o.hooks&&(i=o.hooks.processAllTokens(i)),o.walkTokens&&this.walkTokens(i,o.walkTokens);let a=(o.hooks?o.hooks.provideParser():t?qn.parse:qn.parseInline)(i,o);return o.hooks&&(a=o.hooks.postprocess(a)),a}catch(i){return s(i)}}}onError(t,e){return n=>{if(n.message+=`
|
|
209
|
-
Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error occurred:</p><pre>"+Xn(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},gs=new _B;function tt(t,e){return gs.parse(t,e)}tt.options=tt.setOptions=function(t){return gs.setOptions(t),tt.defaults=gs.defaults,GE(tt.defaults),tt};tt.getDefaults=Gm;tt.defaults=Ms;tt.use=function(...t){return gs.use(...t),tt.defaults=gs.defaults,GE(tt.defaults),tt};tt.walkTokens=function(t,e){return gs.walkTokens(t,e)};tt.parseInline=gs.parseInline;tt.Parser=qn;tt.parser=qn.parse;tt.Renderer=Vu;tt.TextRenderer=og;tt.Lexer=Wn;tt.lexer=Wn.lex;tt.Tokenizer=Bu;tt.Hooks=ta;tt.parse=tt;tt.options;tt.setOptions;tt.use;tt.walkTokens;tt.parseInline;qn.parse;Wn.lex;function NB(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])}return t}function np(t,e){return Array(e+1).join(t)}function lC(t){return t.replace(/^\n*/,"")}function cC(t){for(var e=t.length;e>0&&t[e-1]===`
|
|
210
|
-
`;)e--;return t.substring(0,e)}function uC(t){return cC(lC(t))}var PB=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function sg(t){return ig(t,PB)}var dC=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function fC(t){return ig(t,dC)}function AB(t){return pC(t,dC)}var hC=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function IB(t){return ig(t,hC)}function $B(t){return pC(t,hC)}function ig(t,e){return e.indexOf(t.nodeName)>=0}function pC(t,e){return t.getElementsByTagName&&e.some(function(n){return t.getElementsByTagName(n).length})}var Jt={};Jt.paragraph={filter:"p",replacement:function(t){return`
|
|
211
|
-
|
|
212
|
-
`+t+`
|
|
213
|
-
|
|
214
|
-
`}};Jt.lineBreak={filter:"br",replacement:function(t,e,n){return n.br+`
|
|
215
|
-
`}};Jt.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(t,e,n){var r=Number(e.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){var o=np(r===1?"=":"-",t.length);return`
|
|
216
|
-
|
|
217
|
-
`+t+`
|
|
218
|
-
`+o+`
|
|
219
|
-
|
|
220
|
-
`}else return`
|
|
221
|
-
|
|
222
|
-
`+np("#",r)+" "+t+`
|
|
223
|
-
|
|
224
|
-
`}};Jt.blockquote={filter:"blockquote",replacement:function(t){return t=uC(t).replace(/^/gm,"> "),`
|
|
225
|
-
|
|
226
|
-
`+t+`
|
|
227
|
-
|
|
228
|
-
`}};Jt.list={filter:["ul","ol"],replacement:function(t,e){var n=e.parentNode;return n.nodeName==="LI"&&n.lastElementChild===e?`
|
|
229
|
-
`+t:`
|
|
230
|
-
|
|
231
|
-
`+t+`
|
|
232
|
-
|
|
233
|
-
`}};Jt.listItem={filter:"li",replacement:function(t,e,n){var r=n.bulletListMarker+" ",o=e.parentNode;if(o.nodeName==="OL"){var s=o.getAttribute("start"),i=Array.prototype.indexOf.call(o.children,e);r=(s?Number(s)+i:i+1)+". "}var a=/\n$/.test(t);return t=uC(t)+(a?`
|
|
234
|
-
`:""),t=t.replace(/\n/gm,`
|
|
235
|
-
`+" ".repeat(r.length)),r+t+(e.nextSibling?`
|
|
236
|
-
`:"")}};Jt.indentedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="indented"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,n){return`
|
|
237
|
-
|
|
238
|
-
`+e.firstChild.textContent.replace(/\n/g,`
|
|
239
|
-
`)+`
|
|
240
|
-
|
|
241
|
-
`}};Jt.fencedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="fenced"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,n){for(var r=e.firstChild.getAttribute("class")||"",o=(r.match(/language-(\S+)/)||[null,""])[1],s=e.firstChild.textContent,i=n.fence.charAt(0),a=3,l=new RegExp("^"+i+"{3,}","gm"),c;c=l.exec(s);)c[0].length>=a&&(a=c[0].length+1);var u=np(i,a);return`
|
|
242
|
-
|
|
243
|
-
`+u+o+`
|
|
244
|
-
`+s.replace(/\n$/,"")+`
|
|
245
|
-
`+u+`
|
|
246
|
-
|
|
247
|
-
`}};Jt.horizontalRule={filter:"hr",replacement:function(t,e,n){return`
|
|
248
|
-
|
|
249
|
-
`+n.hr+`
|
|
250
|
-
|
|
251
|
-
`}};Jt.inlineLink={filter:function(t,e){return e.linkStyle==="inlined"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e){var n=e.getAttribute("href");n&&(n=n.replace(/([()])/g,"\\$1"));var r=Hu(e.getAttribute("title"));return r&&(r=' "'+r.replace(/"/g,'\\"')+'"'),"["+t+"]("+n+r+")"}};Jt.referenceLink={filter:function(t,e){return e.linkStyle==="referenced"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e,n){var r=e.getAttribute("href"),o=Hu(e.getAttribute("title"));o&&(o=' "'+o+'"');var s,i;switch(n.linkReferenceStyle){case"collapsed":s="["+t+"][]",i="["+t+"]: "+r+o;break;case"shortcut":s="["+t+"]",i="["+t+"]: "+r+o;break;default:var a=this.references.length+1;s="["+t+"]["+a+"]",i="["+a+"]: "+r+o}return this.references.push(i),s},references:[],append:function(t){var e="";return this.references.length&&(e=`
|
|
252
|
-
|
|
253
|
-
`+this.references.join(`
|
|
254
|
-
`)+`
|
|
255
|
-
|
|
256
|
-
`,this.references=[]),e}};Jt.emphasis={filter:["em","i"],replacement:function(t,e,n){return t.trim()?n.emDelimiter+t+n.emDelimiter:""}};Jt.strong={filter:["strong","b"],replacement:function(t,e,n){return t.trim()?n.strongDelimiter+t+n.strongDelimiter:""}};Jt.code={filter:function(t){var e=t.previousSibling||t.nextSibling,n=t.parentNode.nodeName==="PRE"&&!e;return t.nodeName==="CODE"&&!n},replacement:function(t){if(!t)return"";t=t.replace(/\r?\n|\r/g," ");for(var e=/^`|^ .*?[^ ].* $|`$/.test(t)?" ":"",n="`",r=t.match(/`+/gm)||[];r.indexOf(n)!==-1;)n=n+"`";return n+e+t+e+n}};Jt.image={filter:"img",replacement:function(t,e){var n=Hu(e.getAttribute("alt")),r=e.getAttribute("src")||"",o=Hu(e.getAttribute("title")),s=o?' "'+o+'"':"";return r?"":""}};function Hu(t){return t?t.replace(/(\n+\s*)+/g,`
|
|
257
|
-
`):""}function mC(t){this.options=t,this._keep=[],this._remove=[],this.blankRule={replacement:t.blankReplacement},this.keepReplacement=t.keepReplacement,this.defaultRule={replacement:t.defaultReplacement},this.array=[];for(var e in t.rules)this.array.push(t.rules[e])}mC.prototype={add:function(t,e){this.array.unshift(e)},keep:function(t){this._keep.unshift({filter:t,replacement:this.keepReplacement})},remove:function(t){this._remove.unshift({filter:t,replacement:function(){return""}})},forNode:function(t){if(t.isBlank)return this.blankRule;var e;return(e=If(this.array,t,this.options))||(e=If(this._keep,t,this.options))||(e=If(this._remove,t,this.options))?e:this.defaultRule},forEach:function(t){for(var e=0;e<this.array.length;e++)t(this.array[e],e)}};function If(t,e,n){for(var r=0;r<t.length;r++){var o=t[r];if(DB(o,e,n))return o}}function DB(t,e,n){var r=t.filter;if(typeof r=="string"){if(r===e.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(e.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(t,e,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function zB(t){var e=t.element,n=t.isBlock,r=t.isVoid,o=t.isPre||function(d){return d.nodeName==="PRE"};if(!(!e.firstChild||o(e))){for(var s=null,i=!1,a=null,l=C0(a,e,o);l!==e;){if(l.nodeType===3||l.nodeType===4){var c=l.data.replace(/[ \r\n\t]+/g," ");if((!s||/ $/.test(s.data))&&!i&&c[0]===" "&&(c=c.substr(1)),!c){l=$f(l);continue}l.data=c,s=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(s&&(s.data=s.data.replace(/ $/,"")),s=null,i=!1):r(l)||o(l)?(s=null,i=!0):s&&(i=!1);else{l=$f(l);continue}var u=C0(a,l,o);a=l,l=u}s&&(s.data=s.data.replace(/ $/,""),s.data||$f(s))}}function $f(t){var e=t.nextSibling||t.parentNode;return t.parentNode.removeChild(t),e}function C0(t,e,n){return t&&t.parentNode===e||n(e)?e.nextSibling||e.parentNode:e.firstChild||e.nextSibling||e.parentNode}var ag=typeof window<"u"?window:{};function LB(){var t=ag.DOMParser,e=!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}function jB(){var t=function(){};return FB()?t.prototype.parseFromString=function(e){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(e),n.close(),n}:t.prototype.parseFromString=function(e){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(e),n.close(),n},t}function FB(){var t=!1;try{document.implementation.createHTMLDocument("").open()}catch{ag.ActiveXObject&&(t=!0)}return t}var BB=LB()?ag.DOMParser:jB();function VB(t,e){var n;if(typeof t=="string"){var r=HB().parseFromString('<x-turndown id="turndown-root">'+t+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=t.cloneNode(!0);return zB({element:n,isBlock:sg,isVoid:fC,isPre:e.preformattedCode?WB:null}),n}var Df;function HB(){return Df=Df||new BB,Df}function WB(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}function qB(t,e){return t.isBlock=sg(t),t.isCode=t.nodeName==="CODE"||t.parentNode.isCode,t.isBlank=UB(t),t.flankingWhitespace=KB(t,e),t}function UB(t){return!fC(t)&&!IB(t)&&/^\s*$/i.test(t.textContent)&&!AB(t)&&!$B(t)}function KB(t,e){if(t.isBlock||e.preformattedCode&&t.isCode)return{leading:"",trailing:""};var n=YB(t.textContent);return n.leadingAscii&&T0("left",t,e)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&T0("right",t,e)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function YB(t){var e=t.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:e[1],leadingAscii:e[2],leadingNonAscii:e[3],trailing:e[4],trailingNonAscii:e[5],trailingAscii:e[6]}}function T0(t,e,n){var r,o,s;return t==="left"?(r=e.previousSibling,o=/ $/):(r=e.nextSibling,o=/^ /),r&&(r.nodeType===3?s=o.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?s=!1:r.nodeType===1&&!sg(r)&&(s=o.test(r.textContent))),s}var ZB=Array.prototype.reduce,GB=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Wu(t){if(!(this instanceof Wu))return new Wu(t);var e={rules:Jt,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
|
|
258
|
-
|
|
259
|
-
`:""},keepReplacement:function(n,r){return r.isBlock?`
|
|
260
|
-
|
|
261
|
-
`+r.outerHTML+`
|
|
262
|
-
|
|
263
|
-
`:r.outerHTML},defaultReplacement:function(n,r){return r.isBlock?`
|
|
264
|
-
|
|
265
|
-
`+n+`
|
|
266
|
-
|
|
267
|
-
`:n}};this.options=NB({},e,t),this.rules=new mC(this.options)}Wu.prototype={turndown:function(t){if(!QB(t))throw new TypeError(t+" is not a string, or an element/document/fragment node.");if(t==="")return"";var e=gC.call(this,new VB(t,this.options));return JB.call(this,e)},use:function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)this.use(t[e]);else if(typeof t=="function")t(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(t,e){return this.rules.add(t,e),this},keep:function(t){return this.rules.keep(t),this},remove:function(t){return this.rules.remove(t),this},escape:function(t){return GB.reduce(function(e,n){return e.replace(n[0],n[1])},t)}};function gC(t){var e=this;return ZB.call(t.childNodes,function(n,r){r=new qB(r,e.options);var o="";return r.nodeType===3?o=r.isCode?r.nodeValue:e.escape(r.nodeValue):r.nodeType===1&&(o=XB.call(e,r)),yC(n,o)},"")}function JB(t){var e=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(t=yC(t,n.append(e.options)))}),t.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function XB(t){var e=this.rules.forNode(t),n=gC.call(this,t),r=t.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+e.replacement(n,t,this.options)+r.trailing}function yC(t,e){var n=cC(t),r=lC(e),o=Math.max(t.length-n.length,e.length-r.length),s=`
|
|
268
|
-
|
|
269
|
-
`.substring(0,o);return n+s+r}function QB(t){return t!=null&&(typeof t=="string"||t.nodeType&&(t.nodeType===1||t.nodeType===9||t.nodeType===11))}var M0=/highlight-(?:text|source)-([a-z0-9]+)/;function e4(t){t.addRule("highlightedCodeBlock",{filter:function(e){var n=e.firstChild;return e.nodeName==="DIV"&&M0.test(e.className)&&n&&n.nodeName==="PRE"},replacement:function(e,n,r){var o=n.className||"",s=(o.match(M0)||[null,""])[1];return`
|
|
270
|
-
|
|
271
|
-
`+r.fence+s+`
|
|
272
|
-
`+n.firstChild.textContent+`
|
|
273
|
-
`+r.fence+`
|
|
274
|
-
|
|
275
|
-
`}})}function t4(t){t.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(e){return"~"+e+"~"}})}var n4=Array.prototype.indexOf,r4=Array.prototype.every,xi={};xi.tableCell={filter:["th","td"],replacement:function(t,e){return bC(t,e)}};xi.tableRow={filter:"tr",replacement:function(t,e){var n="",r={left:":--",right:"--:",center:":-:"};if(lg(e))for(var o=0;o<e.childNodes.length;o++){var s="---",i=(e.childNodes[o].getAttribute("align")||"").toLowerCase();i&&(s=r[i]||s),n+=bC(s,e.childNodes[o])}return`
|
|
276
|
-
`+t+(n?`
|
|
277
|
-
`+n:"")}};xi.table={filter:function(t){return t.nodeName==="TABLE"&&lg(t.rows[0])},replacement:function(t){return t=t.replace(`
|
|
278
|
-
|
|
279
|
-
`,`
|
|
280
|
-
`),`
|
|
281
|
-
|
|
282
|
-
`+t+`
|
|
283
|
-
|
|
284
|
-
`}};xi.tableSection={filter:["thead","tbody","tfoot"],replacement:function(t){return t}};function lg(t){var e=t.parentNode;return e.nodeName==="THEAD"||e.firstChild===t&&(e.nodeName==="TABLE"||o4(e))&&r4.call(t.childNodes,function(n){return n.nodeName==="TH"})}function o4(t){var e=t.previousSibling;return t.nodeName==="TBODY"&&(!e||e.nodeName==="THEAD"&&/^\s*$/i.test(e.textContent))}function bC(t,e){var n=n4.call(e.parentNode.childNodes,e),r=" ";return n===0&&(r="| "),r+t+" |"}function s4(t){t.keep(function(n){return n.nodeName==="TABLE"&&!lg(n.rows[0])});for(var e in xi)t.addRule(e,xi[e])}function i4(t){t.addRule("taskListItems",{filter:function(e){return e.type==="checkbox"&&e.parentNode.nodeName==="LI"},replacement:function(e,n){return(n.checked?"[x]":"[ ]")+" "}})}function a4(t){t.use([e4,t4,s4,i4])}const Pd=new Wu({headingStyle:"atx",codeBlockStyle:"fenced",bulletListMarker:"-",emDelimiter:"*",strongDelimiter:"**"});Pd.use(a4);Pd.addRule("imageWithOriginalSource",{filter:"img",replacement:(t,e)=>{const n=e.getAttribute("alt")??"",r=e.getAttribute("data-original-src")??e.getAttribute("src")??"";return r?``:""}});Pd.addRule("tiptapTaskItem",{filter:t=>t.nodeName==="LI"&&t.getAttribute("data-type")==="taskItem",replacement:(t,e)=>{const n=e.getAttribute("data-checked")==="true",r=t.trim().replace(/\n/g,`
|
|
285
|
-
`);return`
|
|
286
|
-
- [${n?"x":" "}] ${r}
|
|
287
|
-
`}});function R0(t){const e=tt.parse(t,{gfm:!0,breaks:!1});return typeof e!="string"?"":e.replace(/<img\b([^>]*?)\bsrc=(["'])([^"']+)\2([^>]*)>/gi,(n,r,o,s,i)=>{if(/data-original-src=/i.test(n))return n;const a=String(s).replace(/"/g,""");return`<img${r}src=${o}${s}${o} data-original-src="${a}"${i}>`})}function l4(t){return Pd.turndown(t).replace(/\n{3,}/g,`
|
|
288
|
-
|
|
289
|
-
`).trimEnd()}const c4="image",qu="data-original-src",u4=C3.extend({addAttributes(){return{...this.parent?.(),originalSrc:{default:null,parseHTML:t=>t.getAttribute(qu),renderHTML:t=>{const e=t.originalSrc;return typeof e!="string"||e.length===0?{}:{[qu]:e}}}}}});function d4(t){const e=t.trim().toLowerCase();return!(!e||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:")||e.startsWith("blob:"))}function f4(t){const{selection:e}=t.state;if(!e.empty)return;const{$from:n,from:r}=e;if(n.parent.type.name!=="paragraph")return;const o=n.parent.textBetween(0,n.parentOffset,void 0,"");if(o.startsWith("/")&&!o.includes(" "))return{query:o.slice(1).trim().toLowerCase(),from:r-o.length,to:r}}function On(t){const e=Me.c(7),{active:n,label:r,onClick:o,children:s}=t,i=n?"border-ring/40 bg-background text-foreground shadow-sm":"text-muted-foreground hover:bg-muted/55 hover:text-foreground border-transparent";let a;e[0]!==i?(a=ue("inline-flex h-7 items-center justify-center rounded-md border px-2 text-xs transition-colors",i),e[0]=i,e[1]=a):a=e[1];let l;return e[2]!==s||e[3]!==r||e[4]!==o||e[5]!==a?(l=M.jsx("button",{type:"button","aria-label":r,title:r,onClick:o,className:a,children:s}),e[2]=s,e[3]=r,e[4]=o,e[5]=a,e[6]=l):l=e[6],l}const O0=[{key:"h1",label:"Heading 1",aliases:["title","heading"],run:t=>{t.chain().focus().toggleHeading({level:1}).run()}},{key:"h2",label:"Heading 2",aliases:["heading"],run:t=>{t.chain().focus().toggleHeading({level:2}).run()}},{key:"bullet-list",label:"Bullet List",aliases:["list","ul"],run:t=>{t.chain().focus().toggleBulletList().run()}},{key:"ordered-list",label:"Numbered List",aliases:["list","ol"],run:t=>{t.chain().focus().toggleOrderedList().run()}},{key:"task-list",label:"Checklist",aliases:["todo","tasks"],run:t=>{t.chain().focus().toggleTaskList().run()}},{key:"blockquote",label:"Quote",aliases:["quote"],run:t=>{t.chain().focus().toggleBlockquote().run()}},{key:"code-block",label:"Code Block",aliases:["code","snippet"],run:t=>{t.chain().focus().toggleCodeBlock().run()}},{key:"divider",label:"Divider",aliases:["hr","line"],run:t=>{t.chain().focus().setHorizontalRule().run()}},{key:"image",label:"Image",aliases:["photo","media"],run:(t,e)=>{e.openImagePanel()}}];function h4({content:t,onChange:e,currentFilePath:n}){const[r,o]=S.useState(),[s,i]=S.useState(0),[a,l]=S.useState(!1),[c,u]=S.useState("assets"),[d,f]=S.useState("asset"),[h,p]=S.useState(""),g=S.useRef(!1),m=S.useRef(t),y=S.useRef(new Map),b=S.useRef(new Set),w=S.useCallback(R=>{const _=f4(R);o(_),i(0)},[]),k=S.useCallback(R=>{if(!n)return;const _=Array.from(R.view.dom.querySelectorAll("img"));for(const N of _){const H=(N.getAttribute(qu)??N.getAttribute("src")??"").trim();if(!d4(H))continue;const Z=`${n}::${H}`,W=y.current.get(Z);if(W){N.getAttribute("src")!==W&&N.setAttribute("src",W);continue}b.current.has(Z)||(b.current.add(Z),ZE({data:{currentFilePath:n,sourcePath:H}}).then(async q=>{if(!q.ok)throw new Error(`Preview request failed (${q.status})`);const V=await q.blob(),D=URL.createObjectURL(V);y.current.set(Z,D);const j=Array.from(R.view.dom.querySelectorAll("img"));for(const B of j)(B.getAttribute(qu)??B.getAttribute("src")??"").trim()===H&&B.setAttribute("src",D)}).catch(()=>{}).finally(()=>{b.current.delete(Z)}))}},[n]),v=Ij({immediatelyRender:!1,extensions:[v3.configure({heading:{levels:[1,2,3]}}),_F.configure({openOnClick:!1,linkOnPaste:!0,autolink:!0}),w3.configure({placeholder:"Start writing your article..."}),k3,x3.configure({nested:!0}),u4.configure({inline:!1,allowBase64:!1})],content:R0(t),editorProps:{attributes:{class:"focus:outline-none min-h-full [&_a]:text-primary [&_a]:underline [&_blockquote]:border-l [&_blockquote]:border-border/70 [&_blockquote]:pl-4 [&_code]:bg-muted/65 [&_code]:rounded-sm [&_code]:px-1 [&_code]:py-0.5 [&_h1]:mb-3 [&_h1]:mt-6 [&_h1]:text-[1.95rem] [&_h1]:font-semibold [&_h2]:mb-2 [&_h2]:mt-5 [&_h2]:text-[1.45rem] [&_h2]:font-semibold [&_h3]:mb-2 [&_h3]:mt-4 [&_h3]:text-[1.15rem] [&_h3]:font-semibold [&_hr]:my-6 [&_hr]:border-border/70 [&_li[data-checked=true]>p]:line-through [&_ol]:list-decimal [&_ol]:pl-6 [&_p]:my-3 [&_pre]:bg-muted/70 [&_pre]:rounded-lg [&_pre]:p-3 [&_ul]:list-disc [&_ul]:pl-6 [&_ul[data-type=taskList]]:list-none [&_ul[data-type=taskList]]:pl-0"}},onUpdate:({editor:R})=>{if(w(R),k(R),g.current)return;const _=l4(R.getHTML());_!==m.current&&(m.current=_,e(_))},onSelectionUpdate:({editor:R})=>{w(R)}});S.useEffect(()=>()=>{for(const R of y.current.values())URL.revokeObjectURL(R);y.current.clear(),b.current.clear()},[]),S.useEffect(()=>{for(const R of y.current.values())URL.revokeObjectURL(R);y.current.clear(),b.current.clear()},[n]),S.useEffect(()=>{if(v&&t!==m.current){g.current=!0;try{v.commands.setContent(R0(t),{emitUpdate:!1}),m.current=t,w(v),k(v)}finally{g.current=!1}}},[k,t,v,w]),S.useEffect(()=>{v&&k(v)},[k,v]);const x=S.useMemo(()=>r?r.query.length===0?O0:O0.filter(R=>R.label.toLowerCase().includes(r.query)?!0:R.aliases.some(_=>_.includes(r.query))):[],[r]),E=S.useCallback(R=>{const _=R.trim();!v||_.length===0||(v.chain().focus().setImage({src:_,alt:c4}).run(),p(""),l(!1))},[v]),C=S.useCallback(R=>{v&&(r&&v.chain().focus().deleteRange({from:r.from,to:r.to}).run(),R.run(v,{openImagePanel:()=>{l(!0)}}),o(void 0))},[v,r]),A=S.useCallback(()=>{if(!v)return;const R=v.getAttributes("link").href,_=window.prompt("Enter link URL",R??"https://");if(_===null)return;const N=_.trim();if(N.length===0){v.chain().focus().unsetLink().run();return}v.chain().focus().extendMarkRange("link").setLink({href:N}).run()},[v]),z=S.useCallback(R=>{if(!(!r||x.length===0)){if(R.key==="ArrowDown"){R.preventDefault(),i(_=>(_+1)%x.length);return}if(R.key==="ArrowUp"){R.preventDefault(),i(_=>_<=0?x.length-1:_-1);return}if(R.key==="Escape"){R.preventDefault(),o(void 0);return}if(R.key==="Enter"||R.key==="Tab"){R.preventDefault();const _=x[s%x.length];C(_)}}},[C,x,s,r]);return v?M.jsxs("div",{className:"relative flex h-full min-h-0 w-full flex-col overflow-hidden",onKeyDownCapture:z,children:[M.jsxs("div",{className:"border-border/45 bg-background/70 sticky top-0 z-20 flex flex-wrap items-center gap-1 rounded-lg border px-2 py-1.5 backdrop-blur",children:[M.jsx(On,{label:"Heading 1",active:v.isActive("heading",{level:1}),onClick:()=>v.chain().focus().toggleHeading({level:1}).run(),children:M.jsx(lN,{className:"size-3.5"})}),M.jsx(On,{label:"Heading 2",active:v.isActive("heading",{level:2}),onClick:()=>v.chain().focus().toggleHeading({level:2}).run(),children:M.jsx(uN,{className:"size-3.5"})}),M.jsx(On,{label:"Bullet list",active:v.isActive("bulletList"),onClick:()=>v.chain().focus().toggleBulletList().run(),children:M.jsx(kN,{className:"size-3.5"})}),M.jsx(On,{label:"Numbered list",active:v.isActive("orderedList"),onClick:()=>v.chain().focus().toggleOrderedList().run(),children:M.jsx(vN,{className:"size-3.5"})}),M.jsx(On,{label:"Checklist",active:v.isActive("taskList"),onClick:()=>v.chain().focus().toggleTaskList().run(),children:M.jsx(yN,{className:"size-3.5"})}),M.jsx(On,{label:"Quote",active:v.isActive("blockquote"),onClick:()=>v.chain().focus().toggleBlockquote().run(),children:M.jsx($N,{className:"size-3.5"})}),M.jsx(On,{label:"Code block",active:v.isActive("codeBlock"),onClick:()=>v.chain().focus().toggleCodeBlock().run(),children:M.jsx(iN,{className:"size-3.5"})}),M.jsx(On,{label:"Divider",onClick:()=>v.chain().focus().setHorizontalRule().run(),children:M.jsx(SN,{className:"size-3.5"})}),M.jsx(On,{label:"Bold",active:v.isActive("bold"),onClick:()=>v.chain().focus().toggleBold().run(),children:"B"}),M.jsx(On,{label:"Italic",active:v.isActive("italic"),onClick:()=>v.chain().focus().toggleItalic().run(),children:M.jsx("span",{className:"italic",children:"I"})}),M.jsx(On,{label:"Inline code",active:v.isActive("code"),onClick:()=>v.chain().focus().toggleCode().run(),children:"</>"}),M.jsx(On,{label:"Link",active:v.isActive("link"),onClick:A,children:M.jsx(mN,{className:"size-3.5"})}),M.jsxs(Km,{open:a,onOpenChange:l,children:[M.jsx(Ym,{className:ue("inline-flex h-7 items-center justify-center rounded-md border px-2 text-xs transition-colors","text-muted-foreground hover:bg-muted/55 hover:text-foreground border-transparent"),"aria-label":"Insert image",title:"Insert image",children:M.jsx(Dp,{className:"size-3.5"})}),M.jsx(Zm,{className:"w-xl max-w-[calc(100vw-2rem)] p-3",children:M.jsxs("div",{className:"space-y-2",children:[M.jsxs("div",{className:"bg-muted/50 inline-flex rounded-md p-0.5",children:[M.jsx("button",{type:"button",className:ue("rounded-sm px-2 py-1 text-[11px] font-medium transition-colors",c==="assets"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>u("assets"),children:"Assets"}),M.jsx("button",{type:"button",className:ue("rounded-sm px-2 py-1 text-[11px] font-medium transition-colors",c==="url"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>u("url"),children:"URL"})]}),c==="assets"?n?M.jsx(KE,{currentFilePath:n,sourceMode:d,onSourceModeChange:f,onSelectPath:E}):M.jsx("p",{className:"text-muted-foreground text-xs",children:"Select a file to browse project assets."}):M.jsxs("div",{className:"space-y-2",children:[M.jsx(_o,{value:h,onChange:R=>p(R.target.value),className:"bg-muted/50",placeholder:"Paste image URL or path","aria-label":"Image URL"}),M.jsx("div",{className:"flex justify-end",children:M.jsx(pn,{type:"button",size:"sm",variant:"secondary",onClick:()=>{h.trim().length!==0&&E(h)},children:"Insert image"})})]})]})})]})]}),M.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:M.jsx("div",{className:"mx-auto w-full max-w-3xl px-8 py-6",children:M.jsx(fE,{editor:v})})}),r&&x.length>0?M.jsx("div",{className:"border-border/45 bg-background/90 absolute top-14 left-8 z-30 w-64 rounded-lg border p-1 shadow-xl backdrop-blur-sm",children:x.map((R,_)=>M.jsx("button",{type:"button",className:ue("w-full rounded-md px-2 py-1.5 text-left text-xs transition-colors",_===s?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/70 hover:text-foreground"),onMouseDown:N=>{N.preventDefault(),C(R)},children:R.label},R.key))}):null,r&&x.length===0?M.jsx("div",{className:"text-muted-foreground border-border/45 bg-background/90 absolute top-14 left-8 z-30 rounded-lg border px-2 py-1 text-xs shadow-xl backdrop-blur-sm",children:"No slash commands found."}):null]}):M.jsx("div",{className:"text-muted-foreground px-8 py-6 text-sm",children:"Loading editor..."})}const _0=t=>{let e;const n=new Set,r=(c,u)=>{const d=typeof c=="function"?c(e):c;if(!Object.is(d,e)){const f=e;e=u??(typeof d!="object"||d===null)?d:Object.assign({},e,d),n.forEach(h=>h(e,f))}},o=()=>e,a={setState:r,getState:o,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=e=t(r,o,a);return a},p4=(t=>t?_0(t):_0),m4=t=>t;function g4(t,e=m4){const n=ce.useSyncExternalStore(t.subscribe,ce.useCallback(()=>e(t.getState()),[t,e]),ce.useCallback(()=>e(t.getInitialState()),[t,e]));return ce.useDebugValue(n),n}const N0=t=>{const e=p4(t),n=r=>g4(e,r);return Object.assign(n,e),n},y4=(t=>t?N0(t):N0),b4=/^\s*(import|export)\s+/,v4=/<\/?[A-Z][A-Za-z0-9._-]*(\s|>|\/>)/,w4=/<\s*\/?\s*>/,k4=/^\s*\{[\s\S]*\}\s*$/,x4=/^\s*(```|~~~)/;function S4(t){return x4.test(t)}function E4(t){return b4.test(t)}function vC(t){return v4.test(t)||w4.test(t)}function C4(t){const e=t.trim();return e.length<2||vC(e)?!1:k4.test(e)}function T4(t){const e=t.split(/\r?\n/);let n=!1;for(const r of e){if(S4(r)){n=!n;continue}if(!n){if(E4(r))return{supported:!1,reason:"contains MDX import/export statements"};if(vC(r))return{supported:!1,reason:"contains JSX component syntax"};if(C4(r))return{supported:!1,reason:"contains standalone MDX expressions"}}}return{supported:!0}}function P0(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Al(t){return JSON.parse(JSON.stringify(t))}function rp(t,e){if(Object.is(t,e))return!0;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n+=1)if(!rp(t[n],e[n]))return!1;return!0}if(P0(t)&&P0(e)){const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||!rp(t[o],e[o]))return!1;return!0}return!1}function M4(t){const e=t.trim();return e.length>0?e:void 0}function zf(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}function Il(t,e,n){const r={...t};return n===void 0?delete r[e]:r[e]=n,r}function As(t){return rp(t.draft,t.initial)?t.contentDraft!==t.initialContent:!0}function Lf(t){const e=T4(t);return e.supported?{richModeAvailability:"supported",richModeBlockReason:void 0}:{richModeAvailability:"blocked",richModeBlockReason:e.reason}}const at=y4(t=>({collectionName:void 0,fileId:void 0,draft:{},initial:{},contentDraft:"",initialContent:"",editorMode:"basic",richModeAvailability:"supported",richModeBlockReason:void 0,dirty:!1,touched:{},errors:{},chipInputs:{},validationRequested:!1,loadSelection:({collectionName:e,fileId:n,data:r,content:o})=>t(s=>{if(s.collectionName===e&&s.fileId===n)return s;const a=Al(r),l=Lf(o);return{collectionName:e,fileId:n,draft:a,initial:Al(a),contentDraft:o,initialContent:o,editorMode:l.richModeAvailability==="blocked"?"basic":s.editorMode,...l,dirty:!1,touched:{},errors:{},chipInputs:{},validationRequested:!1}}),clearSelection:()=>t({collectionName:void 0,fileId:void 0,draft:{},initial:{},contentDraft:"",initialContent:"",richModeAvailability:"supported",richModeBlockReason:void 0,dirty:!1,touched:{},errors:{},chipInputs:{},validationRequested:!1}),setFieldValue:(e,n)=>t(r=>{const o=Il(r.draft,e,n);return{draft:o,dirty:As({draft:o,initial:r.initial,contentDraft:r.contentDraft,initialContent:r.initialContent})}}),setContentDraft:e=>t(n=>({...(()=>{const r=Lf(e);return{...r,editorMode:r.richModeAvailability==="blocked"?"basic":n.editorMode}})(),contentDraft:e,dirty:As({draft:n.draft,initial:n.initial,contentDraft:e,initialContent:n.initialContent})})),applyRevisionSnapshot:({draft:e,content:n})=>t(r=>{const o=Al(e),s=Lf(n);return{...s,editorMode:s.richModeAvailability==="blocked"?"basic":r.editorMode,draft:o,contentDraft:n,dirty:As({draft:o,initial:r.initial,contentDraft:n,initialContent:r.initialContent}),touched:{},errors:{},chipInputs:{},validationRequested:!1}}),setEditorMode:e=>t(n=>e==="rich"&&n.richModeAvailability==="blocked"||n.editorMode===e?n:{editorMode:e}),commitSavedState:()=>t(e=>({initial:Al(e.draft),initialContent:e.contentDraft,dirty:!1,touched:{},errors:{},validationRequested:!1})),setFieldTouched:e=>t(n=>({touched:{...n.touched,[e]:!0}})),setValidationRequested:()=>t({validationRequested:!0}),setValidationErrors:e=>t({errors:e}),setChipInput:(e,n)=>t(r=>({chipInputs:{...r.chipInputs,[e]:n}})),addChipValue:(e,n)=>t(r=>{const o=M4(n);if(!o)return r;const s=zf(r.draft[e]);if(s.includes(o))return{chipInputs:{...r.chipInputs,[e]:""}};const i=[...s,o],a=Il(r.draft,e,i);return{draft:a,dirty:As({draft:a,initial:r.initial,contentDraft:r.contentDraft,initialContent:r.initialContent}),chipInputs:{...r.chipInputs,[e]:""}}}),removeChipValue:(e,n)=>t(r=>{const o=zf(r.draft[e]);if(n<0||n>=o.length)return r;const s=o.filter((a,l)=>l!==n),i=Il(r.draft,e,s.length>0?s:void 0);return{draft:i,dirty:As({draft:i,initial:r.initial,contentDraft:r.contentDraft,initialContent:r.initialContent})}}),removeLastChipValue:e=>t(n=>{const r=zf(n.draft[e]);if(r.length===0)return n;const o=r.slice(0,-1),s=Il(n.draft,e,o.length>0?o:void 0);return{draft:s,dirty:As({draft:s,initial:n.initial,contentDraft:n.contentDraft,initialContent:n.initialContent})}})}));function R4(t){const e=Me.c(12),{currentFilePath:n}=t,r=at(A4),o=at(P4),s=at(N4),i=at(_4),a=at(O4),l=s==="basic"&&i==="blocked"&&!!a;let c;e[0]!==a||e[1]!==l?(c=l?M.jsxs("div",{className:"text-muted-foreground border-border/40 mx-auto mb-2 w-full max-w-3xl rounded-md border border-dashed px-3 py-2 text-xs",children:["Rich mode is unavailable for this file because it"," ",a,"."]}):null,e[0]=a,e[1]=l,e[2]=c):c=e[2];let u;e[3]!==r||e[4]!==n||e[5]!==s||e[6]!==i||e[7]!==o?(u=M.jsx("div",{className:"flex h-full min-h-0 w-full overflow-hidden",children:s==="rich"&&i==="supported"?M.jsx(h4,{content:r,currentFilePath:n,onChange:o}):M.jsx("div",{className:"mx-auto flex h-full min-h-0 w-full max-w-3xl flex-col overflow-hidden",children:M.jsx(_I,{id:"editor-content",className:"placeholder:text-muted-foreground/65 field-sizing-fixed h-full min-h-0 flex-1 resize-none overflow-auto rounded-none border-0 bg-transparent! px-8 py-6 text-[16px] leading-8 shadow-none focus-visible:border-transparent focus-visible:ring-0",value:r,onChange:f=>{o(f.target.value)},placeholder:"Start writing your article..."})})}),e[3]=r,e[4]=n,e[5]=s,e[6]=i,e[7]=o,e[8]=u):u=e[8];let d;return e[9]!==c||e[10]!==u?(d=M.jsxs("div",{className:"flex h-full min-h-0 w-full flex-col overflow-hidden",children:[c,u]}),e[9]=c,e[10]=u,e[11]=d):d=e[11],d}function O4(t){return t.richModeBlockReason}function _4(t){return t.richModeAvailability}function N4(t){return t.editorMode}function P4(t){return t.setContentDraft}function A4(t){return t.contentDraft}function I4(t,e,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:n}).format(e).split(/\s/g).slice(2).join(" ")}const $4={},na={};function Jo(t,e){try{const r=($4[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in na?na[r]:A0(r,r.split(":"))}catch{if(t in na)return na[t];const n=t?.match(D4);return n?A0(t,n.slice(1)):NaN}}const D4=/([+-]\d\d):?(\d\d)?/;function A0(t,e){const n=+(e[0]||0),r=+(e[1]||0),o=+(e[2]||0)/60;return na[t]=n*60+r>0?n*60+r+o:n*60-r-o}class ir extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Jo(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),wC(this),op(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new ir(...n,e):new ir(Date.now(),e)}withTimeZone(e){return new ir(+this,e)}getTimezoneOffset(){const e=-Jo(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),op(this),+this}[Symbol.for("constructDateFrom")](e){return new ir(+new Date(e),this.timeZone)}}const I0=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!I0.test(t))return;const e=t.replace(I0,"$1UTC");ir.prototype[e]&&(t.startsWith("get")?ir.prototype[t]=function(){return this.internal[e]()}:(ir.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),z4(this),+this},ir.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),op(this),+this}))});function op(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-Jo(t.timeZone,t)*60))}function z4(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),wC(t)}function wC(t){const e=Jo(t.timeZone,t),n=e>0?Math.floor(e):Math.ceil(e),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const o=-new Date(+t).getTimezoneOffset(),s=-new Date(+r).getTimezoneOffset(),i=o-s,a=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();i&&a&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+i);const l=o-n;l&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+l);const c=new Date(+t);c.setUTCSeconds(0);const u=o>0?c.getSeconds():(c.getSeconds()-60)%60,d=Math.round(-(Jo(t.timeZone,t)*60))%60;(d||u)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+d),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+d+u));const f=Jo(t.timeZone,t),h=f>0?Math.floor(f):Math.ceil(f),g=-new Date(+t).getTimezoneOffset()-h,m=h!==n,y=g-l;if(m&&y){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+y);const b=Jo(t.timeZone,t),w=b>0?Math.floor(b):Math.ceil(b),k=h-w;k&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+k),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+k))}}class Kt extends ir{static tz(e,...n){return n.length?new Kt(...n,e):new Kt(Date.now(),e)}toISOString(){const[e,n,r]=this.tzComponents(),o=`${e}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+o}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,n,r,o]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${r} ${n} ${o}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[n,r,o]=this.tzComponents();return`${e} GMT${n}${r}${o} (${I4(this.timeZone,this)})`}toLocaleString(e,n){return Date.prototype.toLocaleString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(e,n){return Date.prototype.toLocaleDateString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(e,n){return Date.prototype.toLocaleTimeString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),n=e>0?"-":"+",r=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),o=String(Math.abs(e)%60).padStart(2,"0");return[n,r,o]}withTimeZone(e){return new Kt(+this,e)}[Symbol.for("constructDateFrom")](e){return new Kt(+new Date(e),this.timeZone)}}const kC=6048e5,L4=864e5,$0=Symbol.for("constructDateFrom");function _t(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&$0 in t?t[$0](e):t instanceof Date?new t.constructor(e):new Date(e)}function st(t,e){return _t(e||t,t)}function xC(t,e,n){const r=st(t,n?.in);return isNaN(e)?_t(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function SC(t,e,n){const r=st(t,n?.in);if(isNaN(e))return _t(t,NaN);if(!e)return r;const o=r.getDate(),s=_t(t,r.getTime());s.setMonth(r.getMonth()+e+1,0);const i=s.getDate();return o>=i?s:(r.setFullYear(s.getFullYear(),s.getMonth(),o),r)}let j4={};function el(){return j4}function Si(t,e){const n=el(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,o=st(t,e?.in),s=o.getDay(),i=(s<r?7:0)+s-r;return o.setDate(o.getDate()-i),o.setHours(0,0,0,0),o}function ja(t,e){return Si(t,{...e,weekStartsOn:1})}function EC(t,e){const n=st(t,e?.in),r=n.getFullYear(),o=_t(n,0);o.setFullYear(r+1,0,4),o.setHours(0,0,0,0);const s=ja(o),i=_t(n,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const a=ja(i);return n.getTime()>=s.getTime()?r+1:n.getTime()>=a.getTime()?r:r-1}function D0(t){const e=st(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Ii(t,...e){const n=_t.bind(null,e.find(r=>typeof r=="object"));return e.map(n)}function Fa(t,e){const n=st(t,e?.in);return n.setHours(0,0,0,0),n}function cg(t,e,n){const[r,o]=Ii(n?.in,t,e),s=Fa(r),i=Fa(o),a=+s-D0(s),l=+i-D0(i);return Math.round((a-l)/L4)}function F4(t,e){const n=EC(t,e),r=_t(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),ja(r)}function B4(t,e,n){return xC(t,e*7,n)}function V4(t,e,n){return SC(t,e*12,n)}function H4(t,e){let n,r=e?.in;return t.forEach(o=>{!r&&typeof o=="object"&&(r=_t.bind(null,o));const s=st(o,r);(!n||n<s||isNaN(+s))&&(n=s)}),_t(r,n||NaN)}function W4(t,e){let n,r=e?.in;return t.forEach(o=>{!r&&typeof o=="object"&&(r=_t.bind(null,o));const s=st(o,r);(!n||n>s||isNaN(+s))&&(n=s)}),_t(r,n||NaN)}function q4(t,e,n){const[r,o]=Ii(n?.in,t,e);return+Fa(r)==+Fa(o)}function CC(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function U4(t){return!(!CC(t)&&typeof t!="number"||isNaN(+st(t)))}function TC(t,e,n){const[r,o]=Ii(n?.in,t,e),s=r.getFullYear()-o.getFullYear(),i=r.getMonth()-o.getMonth();return s*12+i}function K4(t,e){const n=st(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function MC(t,e){const[n,r]=Ii(t,e.start,e.end);return{start:n,end:r}}function Y4(t,e){const{start:n,end:r}=MC(e?.in,t);let o=+n>+r;const s=o?+n:+r,i=o?r:n;i.setHours(0,0,0,0),i.setDate(1);let a=1;const l=[];for(;+i<=s;)l.push(_t(n,i)),i.setMonth(i.getMonth()+a);return o?l.reverse():l}function Z4(t,e){const n=st(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function G4(t,e){const n=st(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function RC(t,e){const n=st(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function J4(t,e){const{start:n,end:r}=MC(e?.in,t);let o=+n>+r;const s=o?+n:+r,i=o?r:n;i.setHours(0,0,0,0),i.setMonth(0,1);let a=1;const l=[];for(;+i<=s;)l.push(_t(n,i)),i.setFullYear(i.getFullYear()+a);return o?l.reverse():l}function OC(t,e){const n=el(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,o=st(t,e?.in),s=o.getDay(),i=(s<r?-7:0)+6-(s-r);return o.setDate(o.getDate()+i),o.setHours(23,59,59,999),o}function X4(t,e){return OC(t,{...e,weekStartsOn:1})}const Q4={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},e5=(t,e,n)=>{let r;const o=Q4[t];return typeof o=="string"?r=o:e===1?r=o.one:r=o.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function jf(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const t5={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},n5={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},r5={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},o5={date:jf({formats:t5,defaultWidth:"full"}),time:jf({formats:n5,defaultWidth:"full"}),dateTime:jf({formats:r5,defaultWidth:"full"})},s5={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},i5=(t,e,n,r)=>s5[t];function Wi(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let o;if(r==="formatting"&&t.formattingValues){const i=t.defaultFormattingWidth||t.defaultWidth,a=n?.width?String(n.width):i;o=t.formattingValues[a]||t.formattingValues[i]}else{const i=t.defaultWidth,a=n?.width?String(n.width):t.defaultWidth;o=t.values[a]||t.values[i]}const s=t.argumentCallback?t.argumentCallback(e):e;return o[s]}}const a5={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},l5={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},c5={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},u5={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},d5={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},f5={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},h5=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},p5={ordinalNumber:h5,era:Wi({values:a5,defaultWidth:"wide"}),quarter:Wi({values:l5,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Wi({values:c5,defaultWidth:"wide"}),day:Wi({values:u5,defaultWidth:"wide"}),dayPeriod:Wi({values:d5,defaultWidth:"wide",formattingValues:f5,defaultFormattingWidth:"wide"})};function qi(t){return(e,n={})=>{const r=n.width,o=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],s=e.match(o);if(!s)return null;const i=s[0],a=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(a)?g5(a,d=>d.test(i)):m5(a,d=>d.test(i));let c;c=t.valueCallback?t.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const u=e.slice(i.length);return{value:c,rest:u}}}function m5(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function g5(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function y5(t){return(e,n={})=>{const r=e.match(t.matchPattern);if(!r)return null;const o=r[0],s=e.match(t.parsePattern);if(!s)return null;let i=t.valueCallback?t.valueCallback(s[0]):s[0];i=n.valueCallback?n.valueCallback(i):i;const a=e.slice(o.length);return{value:i,rest:a}}}const b5=/^(\d+)(th|st|nd|rd)?/i,v5=/\d+/i,w5={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},k5={any:[/^b/i,/^(a|c)/i]},x5={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},S5={any:[/1/i,/2/i,/3/i,/4/i]},E5={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},C5={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},T5={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},M5={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},R5={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},O5={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},_5={ordinalNumber:y5({matchPattern:b5,parsePattern:v5,valueCallback:t=>parseInt(t,10)}),era:qi({matchPatterns:w5,defaultMatchWidth:"wide",parsePatterns:k5,defaultParseWidth:"any"}),quarter:qi({matchPatterns:x5,defaultMatchWidth:"wide",parsePatterns:S5,defaultParseWidth:"any",valueCallback:t=>t+1}),month:qi({matchPatterns:E5,defaultMatchWidth:"wide",parsePatterns:C5,defaultParseWidth:"any"}),day:qi({matchPatterns:T5,defaultMatchWidth:"wide",parsePatterns:M5,defaultParseWidth:"any"}),dayPeriod:qi({matchPatterns:R5,defaultMatchWidth:"any",parsePatterns:O5,defaultParseWidth:"any"})},Vs={code:"en-US",formatDistance:e5,formatLong:o5,formatRelative:i5,localize:p5,match:_5,options:{weekStartsOn:0,firstWeekContainsDate:1}};function N5(t,e){const n=st(t,e?.in);return cg(n,RC(n))+1}function ug(t,e){const n=st(t,e?.in),r=+ja(n)-+F4(n);return Math.round(r/kC)+1}function _C(t,e){const n=st(t,e?.in),r=n.getFullYear(),o=el(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,i=_t(e?.in||t,0);i.setFullYear(r+1,0,s),i.setHours(0,0,0,0);const a=Si(i,e),l=_t(e?.in||t,0);l.setFullYear(r,0,s),l.setHours(0,0,0,0);const c=Si(l,e);return+n>=+a?r+1:+n>=+c?r:r-1}function P5(t,e){const n=el(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,o=_C(t,e),s=_t(e?.in||t,0);return s.setFullYear(o,0,r),s.setHours(0,0,0,0),Si(s,e)}function dg(t,e){const n=st(t,e?.in),r=+Si(n,e)-+P5(n,e);return Math.round(r/kC)+1}function Qe(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const qr={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return Qe(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):Qe(n+1,2)},d(t,e){return Qe(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(t,e){return Qe(t.getHours()%12||12,e.length)},H(t,e){return Qe(t.getHours(),e.length)},m(t,e){return Qe(t.getMinutes(),e.length)},s(t,e){return Qe(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),o=Math.trunc(r*Math.pow(10,n-3));return Qe(o,e.length)}},Is={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},z0={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),o=r>0?r:1-r;return n.ordinalNumber(o,{unit:"year"})}return qr.y(t,e)},Y:function(t,e,n,r){const o=_C(t,r),s=o>0?o:1-o;if(e==="YY"){const i=s%100;return Qe(i,2)}return e==="Yo"?n.ordinalNumber(s,{unit:"year"}):Qe(s,e.length)},R:function(t,e){const n=EC(t);return Qe(n,e.length)},u:function(t,e){const n=t.getFullYear();return Qe(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return Qe(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return Qe(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return qr.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return Qe(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const o=dg(t,r);return e==="wo"?n.ordinalNumber(o,{unit:"week"}):Qe(o,e.length)},I:function(t,e,n){const r=ug(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):Qe(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):qr.d(t,e)},D:function(t,e,n){const r=N5(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Qe(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const o=t.getDay(),s=(o-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return Qe(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const o=t.getDay(),s=(o-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return Qe(s,e.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(o,{width:"narrow",context:"standalone"});case"cccccc":return n.day(o,{width:"short",context:"standalone"});default:return n.day(o,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),o=r===0?7:r;switch(e){case"i":return String(o);case"ii":return Qe(o,e.length);case"io":return n.ordinalNumber(o,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const o=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let o;switch(r===12?o=Is.noon:r===0?o=Is.midnight:o=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let o;switch(r>=17?o=Is.evening:r>=12?o=Is.afternoon:r>=4?o=Is.morning:o=Is.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return qr.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):qr.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Qe(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):Qe(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):qr.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):qr.s(t,e)},S:function(t,e){return qr.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return j0(r);case"XXXX":case"XX":return Vo(r);default:return Vo(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return j0(r);case"xxxx":case"xx":return Vo(r);default:return Vo(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+L0(r,":");default:return"GMT"+Vo(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+L0(r,":");default:return"GMT"+Vo(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return Qe(r,e.length)},T:function(t,e,n){return Qe(+t,e.length)}};function L0(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),o=Math.trunc(r/60),s=r%60;return s===0?n+String(o):n+String(o)+e+Qe(s,2)}function j0(t,e){return t%60===0?(t>0?"-":"+")+Qe(Math.abs(t)/60,2):Vo(t,e)}function Vo(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),o=Qe(Math.trunc(r/60),2),s=Qe(r%60,2);return n+o+e+s}const F0=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},NC=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},A5=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],o=n[2];if(!o)return F0(t,e);let s;switch(r){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",F0(r,e)).replace("{{time}}",NC(o,e))},I5={p:NC,P:A5},$5=/^D+$/,D5=/^Y+$/,z5=["D","DD","YY","YYYY"];function L5(t){return $5.test(t)}function j5(t){return D5.test(t)}function F5(t,e,n){const r=B5(t,e,n);if(console.warn(r),z5.includes(t))throw new RangeError(r)}function B5(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const V5=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,H5=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,W5=/^'([^]*?)'?$/,q5=/''/g,U5=/[a-zA-Z]/;function ra(t,e,n){const r=el(),o=n?.locale??r.locale??Vs,s=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=st(t,n?.in);if(!U4(a))throw new RangeError("Invalid time value");let l=e.match(H5).map(u=>{const d=u[0];if(d==="p"||d==="P"){const f=I5[d];return f(u,o.formatLong)}return u}).join("").match(V5).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:K5(u)};if(z0[d])return{isToken:!0,value:u};if(d.match(U5))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:u}});o.localize.preprocessor&&(l=o.localize.preprocessor(a,l));const c={firstWeekContainsDate:s,weekStartsOn:i,locale:o};return l.map(u=>{if(!u.isToken)return u.value;const d=u.value;(!n?.useAdditionalWeekYearTokens&&j5(d)||!n?.useAdditionalDayOfYearTokens&&L5(d))&&F5(d,e,String(t));const f=z0[d[0]];return f(a,d,o.localize,c)}).join("")}function K5(t){const e=t.match(W5);return e?e[1].replace(q5,"'"):t}function Y5(t,e){const n=st(t,e?.in),r=n.getFullYear(),o=n.getMonth(),s=_t(n,0);return s.setFullYear(r,o+1,0),s.setHours(0,0,0,0),s.getDate()}function Z5(t,e){return st(t,e?.in).getMonth()}function G5(t,e){return st(t,e?.in).getFullYear()}function J5(t,e){return+st(t)>+st(e)}function X5(t,e){return+st(t)<+st(e)}function Q5(t,e,n){const[r,o]=Ii(n?.in,t,e);return r.getFullYear()===o.getFullYear()&&r.getMonth()===o.getMonth()}function eV(t,e,n){const[r,o]=Ii(n?.in,t,e);return r.getFullYear()===o.getFullYear()}function tV(t,e,n){const r=st(t,n?.in),o=r.getFullYear(),s=r.getDate(),i=_t(t,0);i.setFullYear(o,e,15),i.setHours(0,0,0,0);const a=Y5(i);return r.setMonth(e,Math.min(s,a)),r}function nV(t,e,n){const r=st(t,n?.in);return isNaN(+r)?_t(t,NaN):(r.setFullYear(e),r)}const B0=5,rV=4;function oV(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,o=e.addDays(t,-r+1),s=e.addDays(o,B0*7-1);return e.getMonth(t)===e.getMonth(s)?B0:rV}function PC(t,e){const n=e.startOfMonth(t),r=n.getDay();return r===1?n:r===0?e.addDays(n,-6):e.addDays(n,-1*(r-1))}function sV(t,e){const n=PC(t,e),r=oV(t,e);return e.addDays(n,r*7-1)}const AC={...Vs,labels:{labelDayButton:(t,e,n,r)=>{let o;r&&typeof r.format=="function"?o=r.format.bind(r):o=(i,a)=>ra(i,a,{locale:Vs,...n});let s=o(t,"PPPP");return e.today&&(s=`Today, ${s}`),e.selected&&(s=`${s}, selected`),s},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:t=>`Week ${t}`,labelYearDropdown:"Choose the Year",labelGrid:(t,e,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(o,s)=>ra(o,s,{locale:Vs,...e}),r(t,"LLLL yyyy")},labelGridcell:(t,e,n,r)=>{let o;r&&typeof r.format=="function"?o=r.format.bind(r):o=(i,a)=>ra(i,a,{locale:Vs,...n});let s=o(t,"PPPP");return e?.today&&(s=`Today, ${s}`),s},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(t,e,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(o,s)=>ra(o,s,{locale:Vs,...e}),r(t,"cccc")}}};class Tn{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Kt.tz(this.options.timeZone):new this.Date,this.newDate=(r,o,s)=>this.overrides?.newDate?this.overrides.newDate(r,o,s):this.options.timeZone?new Kt(r,o,s,this.options.timeZone):new Date(r,o,s),this.addDays=(r,o)=>this.overrides?.addDays?this.overrides.addDays(r,o):xC(r,o),this.addMonths=(r,o)=>this.overrides?.addMonths?this.overrides.addMonths(r,o):SC(r,o),this.addWeeks=(r,o)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,o):B4(r,o),this.addYears=(r,o)=>this.overrides?.addYears?this.overrides.addYears(r,o):V4(r,o),this.differenceInCalendarDays=(r,o)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,o):cg(r,o),this.differenceInCalendarMonths=(r,o)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,o):TC(r,o),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Y4(r),this.eachYearOfInterval=r=>{const o=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):J4(r),s=new Set(o.map(a=>this.getYear(a)));if(s.size===o.length)return o;const i=[];return s.forEach(a=>{i.push(new Date(a,0,1))}),i},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):sV(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):X4(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):K4(r),this.endOfWeek=(r,o)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,o):OC(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):G4(r),this.format=(r,o,s)=>{const i=this.overrides?.format?this.overrides.format(r,o,this.options):ra(r,o,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(i):i},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):ug(r),this.getMonth=(r,o)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):Z5(r,this.options),this.getYear=(r,o)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):G5(r,this.options),this.getWeek=(r,o)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):dg(r,this.options),this.isAfter=(r,o)=>this.overrides?.isAfter?this.overrides.isAfter(r,o):J5(r,o),this.isBefore=(r,o)=>this.overrides?.isBefore?this.overrides.isBefore(r,o):X5(r,o),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):CC(r),this.isSameDay=(r,o)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,o):q4(r,o),this.isSameMonth=(r,o)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,o):Q5(r,o),this.isSameYear=(r,o)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,o):eV(r,o),this.max=r=>this.overrides?.max?this.overrides.max(r):H4(r),this.min=r=>this.overrides?.min?this.overrides.min(r):W4(r),this.setMonth=(r,o)=>this.overrides?.setMonth?this.overrides.setMonth(r,o):tV(r,o),this.setYear=(r,o)=>this.overrides?.setYear?this.overrides.setYear(r,o):nV(r,o),this.startOfBroadcastWeek=(r,o)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):PC(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):Fa(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):ja(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):Z4(r),this.startOfWeek=(r,o)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):Si(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):RC(r),this.options={locale:AC,...e},this.overrides=n}getDigitMap(){const{numerals:e="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:e}),r={};for(let o=0;o<10;o++)r[o.toString()]=n.format(o);return r}replaceDigits(e){const n=this.getDigitMap();return e.replace(/\d/g,r=>n[r]||r)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&Tn.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:o}=this.options,s=n?.code;if(s&&Tn.yearFirstLocales.has(s))try{return new Intl.DateTimeFormat(s,{month:"long",year:"numeric",timeZone:r,numberingSystem:o}).format(e)}catch{}const i=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,i)}}Tn.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const hr=new Tn;class IC{constructor(e,n,r=hr){this.date=e,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(e,n)),this.dateLib=r,this.isoDate=r.format(e,"yyyy-MM-dd"),this.displayMonthId=r.format(n,"yyyy-MM"),this.dateMonthId=r.format(e,"yyyy-MM")}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class iV{constructor(e,n){this.date=e,this.weeks=n}}class aV{constructor(e,n){this.days=n,this.weekNumber=e}}function lV(t){return ce.createElement("button",{...t})}function cV(t){return ce.createElement("span",{...t})}function uV(t){const{size:e=24,orientation:n="left",className:r}=t;return ce.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&ce.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&ce.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&ce.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&ce.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function dV(t){const{day:e,modifiers:n,...r}=t;return ce.createElement("td",{...r})}function fV(t){const{day:e,modifiers:n,...r}=t,o=ce.useRef(null);return ce.useEffect(()=>{n.focused&&o.current?.focus()},[n.focused]),ce.createElement("button",{ref:o,...r})}var Se;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})(Se||(Se={}));var pt;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(pt||(pt={}));var Yn;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(Yn||(Yn={}));var bn;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(bn||(bn={}));function hV(t){const{options:e,className:n,components:r,classNames:o,...s}=t,i=[o[Se.Dropdown],n].join(" "),a=e?.find(({value:l})=>l===s.value);return ce.createElement("span",{"data-disabled":s.disabled,className:o[Se.DropdownRoot]},ce.createElement(r.Select,{className:i,...s},e?.map(({value:l,label:c,disabled:u})=>ce.createElement(r.Option,{key:l,value:l,disabled:u},c))),ce.createElement("span",{className:o[Se.CaptionLabel],"aria-hidden":!0},a?.label,ce.createElement(r.Chevron,{orientation:"down",size:18,className:o[Se.Chevron]})))}function pV(t){return ce.createElement("div",{...t})}function mV(t){return ce.createElement("div",{...t})}function gV(t){const{calendarMonth:e,displayIndex:n,...r}=t;return ce.createElement("div",{...r},t.children)}function yV(t){const{calendarMonth:e,displayIndex:n,...r}=t;return ce.createElement("div",{...r})}function bV(t){return ce.createElement("table",{...t})}function vV(t){return ce.createElement("div",{...t})}const $C=S.createContext(void 0);function tl(){const t=S.useContext($C);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function wV(t){const{components:e}=tl();return ce.createElement(e.Dropdown,{...t})}function kV(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:o,...s}=t,{components:i,classNames:a,labels:{labelPrevious:l,labelNext:c}}=tl(),u=S.useCallback(f=>{o&&n?.(f)},[o,n]),d=S.useCallback(f=>{r&&e?.(f)},[r,e]);return ce.createElement("nav",{...s},ce.createElement(i.PreviousMonthButton,{type:"button",className:a[Se.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":l(r),onClick:d},ce.createElement(i.Chevron,{disabled:r?void 0:!0,className:a[Se.Chevron],orientation:"left"})),ce.createElement(i.NextMonthButton,{type:"button",className:a[Se.NextMonthButton],tabIndex:o?void 0:-1,"aria-disabled":o?void 0:!0,"aria-label":c(o),onClick:u},ce.createElement(i.Chevron,{disabled:o?void 0:!0,orientation:"right",className:a[Se.Chevron]})))}function xV(t){const{components:e}=tl();return ce.createElement(e.Button,{...t})}function SV(t){return ce.createElement("option",{...t})}function EV(t){const{components:e}=tl();return ce.createElement(e.Button,{...t})}function CV(t){const{rootRef:e,...n}=t;return ce.createElement("div",{...n,ref:e})}function TV(t){return ce.createElement("select",{...t})}function MV(t){const{week:e,...n}=t;return ce.createElement("tr",{...n})}function RV(t){return ce.createElement("th",{...t})}function OV(t){return ce.createElement("thead",{"aria-hidden":!0},ce.createElement("tr",{...t}))}function _V(t){const{week:e,...n}=t;return ce.createElement("th",{...n})}function NV(t){return ce.createElement("th",{...t})}function PV(t){return ce.createElement("tbody",{...t})}function AV(t){const{components:e}=tl();return ce.createElement(e.Dropdown,{...t})}const IV=Object.freeze(Object.defineProperty({__proto__:null,Button:lV,CaptionLabel:cV,Chevron:uV,Day:dV,DayButton:fV,Dropdown:hV,DropdownNav:pV,Footer:mV,Month:gV,MonthCaption:yV,MonthGrid:bV,Months:vV,MonthsDropdown:wV,Nav:kV,NextMonthButton:xV,Option:SV,PreviousMonthButton:EV,Root:CV,Select:TV,Week:MV,WeekNumber:_V,WeekNumberHeader:NV,Weekday:RV,Weekdays:OV,Weeks:PV,YearsDropdown:AV},Symbol.toStringTag,{value:"Module"}));function Or(t,e,n=!1,r=hr){let{from:o,to:s}=t;const{differenceInCalendarDays:i,isSameDay:a}=r;return o&&s?(i(s,o)<0&&([o,s]=[s,o]),i(e,o)>=(n?1:0)&&i(s,e)>=(n?1:0)):!n&&s?a(s,e):!n&&o?a(o,e):!1}function fg(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function Ad(t){return!!(t&&typeof t=="object"&&"from"in t)}function hg(t){return!!(t&&typeof t=="object"&&"after"in t)}function pg(t){return!!(t&&typeof t=="object"&&"before"in t)}function DC(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function zC(t,e){return Array.isArray(t)&&t.every(e.isDate)}function _r(t,e,n=hr){const r=Array.isArray(e)?e:[e],{isSameDay:o,differenceInCalendarDays:s,isAfter:i}=n;return r.some(a=>{if(typeof a=="boolean")return a;if(n.isDate(a))return o(t,a);if(zC(a,n))return a.some(l=>o(t,l));if(Ad(a))return Or(a,t,!1,n);if(DC(a))return Array.isArray(a.dayOfWeek)?a.dayOfWeek.includes(t.getDay()):a.dayOfWeek===t.getDay();if(fg(a)){const l=s(a.before,t),c=s(a.after,t),u=l>0,d=c<0;return i(a.before,a.after)?d&&u:u||d}return hg(a)?s(t,a.after)>0:pg(a)?s(a.before,t)>0:typeof a=="function"?a(t):!1})}function $V(t,e,n,r,o){const{disabled:s,hidden:i,modifiers:a,showOutsideDays:l,broadcastCalendar:c,today:u=o.today()}=e,{isSameDay:d,isSameMonth:f,startOfMonth:h,isBefore:p,endOfMonth:g,isAfter:m}=o,y=n&&h(n),b=r&&g(r),w={[pt.focused]:[],[pt.outside]:[],[pt.disabled]:[],[pt.hidden]:[],[pt.today]:[]},k={};for(const v of t){const{date:x,displayMonth:E}=v,C=!!(E&&!f(x,E)),A=!!(y&&p(x,y)),z=!!(b&&m(x,b)),R=!!(s&&_r(x,s,o)),_=!!(i&&_r(x,i,o))||A||z||!c&&!l&&C||c&&l===!1&&C,N=d(x,u);C&&w.outside.push(v),R&&w.disabled.push(v),_&&w.hidden.push(v),N&&w.today.push(v),a&&Object.keys(a).forEach(L=>{const H=a?.[L];H&&_r(x,H,o)&&(k[L]?k[L].push(v):k[L]=[v])})}return v=>{const x={[pt.focused]:!1,[pt.disabled]:!1,[pt.hidden]:!1,[pt.outside]:!1,[pt.today]:!1},E={};for(const C in w){const A=w[C];x[C]=A.some(z=>z===v)}for(const C in k)E[C]=k[C].some(A=>A===v);return{...x,...E}}}function DV(t,e,n={}){return Object.entries(t).filter(([,o])=>o===!0).reduce((o,[s])=>(n[s]?o.push(n[s]):e[pt[s]]?o.push(e[pt[s]]):e[Yn[s]]&&o.push(e[Yn[s]]),o),[e[Se.Day]])}function zV(t){return{...IV,...t}}function LV(t){const e={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([n,r])=>{n.startsWith("data-")&&(e[n]=r)}),e}function mg(){const t={};for(const e in Se)t[Se[e]]=`rdp-${Se[e]}`;for(const e in pt)t[pt[e]]=`rdp-${pt[e]}`;for(const e in Yn)t[Yn[e]]=`rdp-${Yn[e]}`;for(const e in bn)t[bn[e]]=`rdp-${bn[e]}`;return t}function LC(t,e,n){return(n??new Tn(e)).formatMonthYear(t)}const jV=LC;function FV(t,e,n){return(n??new Tn(e)).format(t,"d")}function BV(t,e=hr){return e.format(t,"LLLL")}function VV(t,e,n){return(n??new Tn(e)).format(t,"cccccc")}function HV(t,e=hr){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function WV(){return""}function jC(t,e=hr){return e.format(t,"yyyy")}const qV=jC,UV=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:LC,formatDay:FV,formatMonthCaption:jV,formatMonthDropdown:BV,formatWeekNumber:HV,formatWeekNumberHeader:WV,formatWeekdayName:VV,formatYearCaption:qV,formatYearDropdown:jC},Symbol.toStringTag,{value:"Module"}));function KV(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...UV,...t}}function gg(t,e,n,r){let o=(r??new Tn(n)).format(t,"PPPP");return e.today&&(o=`Today, ${o}`),e.selected&&(o=`${o}, selected`),o}const YV=gg;function yg(t,e,n){return(n??new Tn(e)).formatMonthYear(t)}const ZV=yg;function FC(t,e,n,r){let o=(r??new Tn(n)).format(t,"PPPP");return e?.today&&(o=`Today, ${o}`),o}function BC(t){return"Choose the Month"}function VC(){return""}const GV="Go to the Next Month";function HC(t,e){return GV}function WC(t){return"Go to the Previous Month"}function qC(t,e,n){return(n??new Tn(e)).format(t,"cccc")}function UC(t,e){return`Week ${t}`}function KC(t){return"Week Number"}function YC(t){return"Choose the Year"}const JV=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:ZV,labelDay:YV,labelDayButton:gg,labelGrid:yg,labelGridcell:FC,labelMonthDropdown:BC,labelNav:VC,labelNext:HC,labelPrevious:WC,labelWeekNumber:UC,labelWeekNumberHeader:KC,labelWeekday:qC,labelYearDropdown:YC},Symbol.toStringTag,{value:"Module"})),Bn=(t,e,n)=>e||(n?typeof n=="function"?n:(...r)=>n:t);function XV(t,e){const n=e.locale?.labels??{};return{...JV,...t??{},labelDayButton:Bn(gg,t?.labelDayButton,n.labelDayButton),labelMonthDropdown:Bn(BC,t?.labelMonthDropdown,n.labelMonthDropdown),labelNext:Bn(HC,t?.labelNext,n.labelNext),labelPrevious:Bn(WC,t?.labelPrevious,n.labelPrevious),labelWeekNumber:Bn(UC,t?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:Bn(YC,t?.labelYearDropdown,n.labelYearDropdown),labelGrid:Bn(yg,t?.labelGrid,n.labelGrid),labelGridcell:Bn(FC,t?.labelGridcell,n.labelGridcell),labelNav:Bn(VC,t?.labelNav,n.labelNav),labelWeekNumberHeader:Bn(KC,t?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:Bn(qC,t?.labelWeekday,n.labelWeekday)}}function QV(t,e,n,r,o){const{startOfMonth:s,startOfYear:i,endOfYear:a,eachMonthOfInterval:l,getMonth:c}=o;return l({start:i(t),end:a(t)}).map(f=>{const h=r.formatMonthDropdown(f,o),p=c(f),g=e&&f<s(e)||n&&f>s(n)||!1;return{value:p,label:h,disabled:g}})}function eH(t,e={},n={}){let r={...e?.[Se.Day]};return Object.entries(t).filter(([,o])=>o===!0).forEach(([o])=>{r={...r,...n?.[o]}}),r}function tH(t,e,n,r){const o=r??t.today(),s=n?t.startOfBroadcastWeek(o,t):e?t.startOfISOWeek(o):t.startOfWeek(o),i=[];for(let a=0;a<7;a++){const l=t.addDays(s,a);i.push(l)}return i}function nH(t,e,n,r,o=!1){if(!t||!e)return;const{startOfYear:s,endOfYear:i,eachYearOfInterval:a,getYear:l}=r,c=s(t),u=i(e),d=a({start:c,end:u});return o&&d.reverse(),d.map(f=>{const h=n.formatYearDropdown(f,r);return{value:l(f),label:h,disabled:!1}})}function rH(t,e={}){const{weekStartsOn:n,locale:r}=e,o=n??r?.options?.weekStartsOn??0,s=a=>{const l=typeof a=="number"||typeof a=="string"?new Date(a):a;return new Kt(l.getFullYear(),l.getMonth(),l.getDate(),12,0,0,t)},i=a=>{const l=s(a);return new Date(l.getFullYear(),l.getMonth(),l.getDate(),0,0,0,0)};return{today:()=>s(Kt.tz(t)),newDate:(a,l,c)=>new Kt(a,l,c,12,0,0,t),startOfDay:a=>s(a),startOfWeek:(a,l)=>{const c=s(a),u=l?.weekStartsOn??o,d=(c.getDay()-u+7)%7;return c.setDate(c.getDate()-d),c},startOfISOWeek:a=>{const l=s(a),c=(l.getDay()-1+7)%7;return l.setDate(l.getDate()-c),l},startOfMonth:a=>{const l=s(a);return l.setDate(1),l},startOfYear:a=>{const l=s(a);return l.setMonth(0,1),l},endOfWeek:(a,l)=>{const c=s(a),f=(((l?.weekStartsOn??o)+6)%7-c.getDay()+7)%7;return c.setDate(c.getDate()+f),c},endOfISOWeek:a=>{const l=s(a),c=(7-l.getDay())%7;return l.setDate(l.getDate()+c),l},endOfMonth:a=>{const l=s(a);return l.setMonth(l.getMonth()+1,0),l},endOfYear:a=>{const l=s(a);return l.setMonth(11,31),l},eachMonthOfInterval:a=>{const l=s(a.start),c=s(a.end),u=[],d=new Kt(l.getFullYear(),l.getMonth(),1,12,0,0,t),f=c.getFullYear()*12+c.getMonth();for(;d.getFullYear()*12+d.getMonth()<=f;)u.push(new Kt(d,t)),d.setMonth(d.getMonth()+1,1);return u},addDays:(a,l)=>{const c=s(a);return c.setDate(c.getDate()+l),c},addWeeks:(a,l)=>{const c=s(a);return c.setDate(c.getDate()+l*7),c},addMonths:(a,l)=>{const c=s(a);return c.setMonth(c.getMonth()+l),c},addYears:(a,l)=>{const c=s(a);return c.setFullYear(c.getFullYear()+l),c},eachYearOfInterval:a=>{const l=s(a.start),c=s(a.end),u=[],d=new Kt(l.getFullYear(),0,1,12,0,0,t);for(;d.getFullYear()<=c.getFullYear();)u.push(new Kt(d,t)),d.setFullYear(d.getFullYear()+1,0,1);return u},getWeek:(a,l)=>{const c=i(a);return dg(c,{weekStartsOn:l?.weekStartsOn??o,firstWeekContainsDate:l?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1})},getISOWeek:a=>{const l=i(a);return ug(l)},differenceInCalendarDays:(a,l)=>{const c=i(a),u=i(l);return cg(c,u)},differenceInCalendarMonths:(a,l)=>{const c=i(a),u=i(l);return TC(c,u)}}}const nl=t=>t instanceof HTMLElement?t:null,Ff=t=>[...t.querySelectorAll("[data-animated-month]")??[]],oH=t=>nl(t.querySelector("[data-animated-month]")),Bf=t=>nl(t.querySelector("[data-animated-caption]")),Vf=t=>nl(t.querySelector("[data-animated-weeks]")),sH=t=>nl(t.querySelector("[data-animated-nav]")),iH=t=>nl(t.querySelector("[data-animated-weekdays]"));function aH(t,e,{classNames:n,months:r,focused:o,dateLib:s}){const i=S.useRef(null),a=S.useRef(r),l=S.useRef(!1);S.useLayoutEffect(()=>{const c=a.current;if(a.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||c.length===0||r.length!==c.length)return;const u=s.isSameMonth(r[0].date,c[0].date),d=s.isAfter(r[0].date,c[0].date),f=d?n[bn.caption_after_enter]:n[bn.caption_before_enter],h=d?n[bn.weeks_after_enter]:n[bn.weeks_before_enter],p=i.current,g=t.current.cloneNode(!0);if(g instanceof HTMLElement?(Ff(g).forEach(w=>{if(!(w instanceof HTMLElement))return;const k=oH(w);k&&w.contains(k)&&w.removeChild(k);const v=Bf(w);v&&v.classList.remove(f);const x=Vf(w);x&&x.classList.remove(h)}),i.current=g):i.current=null,l.current||u||o)return;const m=p instanceof HTMLElement?Ff(p):[],y=Ff(t.current);if(y?.every(b=>b instanceof HTMLElement)&&m&&m.every(b=>b instanceof HTMLElement)){l.current=!0,t.current.style.isolation="isolate";const b=sH(t.current);b&&(b.style.zIndex="1"),y.forEach((w,k)=>{const v=m[k];if(!v)return;w.style.position="relative",w.style.overflow="hidden";const x=Bf(w);x&&x.classList.add(f);const E=Vf(w);E&&E.classList.add(h);const C=()=>{l.current=!1,t.current&&(t.current.style.isolation=""),b&&(b.style.zIndex=""),x&&x.classList.remove(f),E&&E.classList.remove(h),w.style.position="",w.style.overflow="",w.contains(v)&&w.removeChild(v)};v.style.pointerEvents="none",v.style.position="absolute",v.style.overflow="hidden",v.setAttribute("aria-hidden","true");const A=iH(v);A&&(A.style.opacity="0");const z=Bf(v);z&&(z.classList.add(d?n[bn.caption_before_exit]:n[bn.caption_after_exit]),z.addEventListener("animationend",C));const R=Vf(v);R&&R.classList.add(d?n[bn.weeks_before_exit]:n[bn.weeks_after_exit]),w.insertBefore(v,w.firstChild)})}})}function lH(t,e,n,r){const o=t[0],s=t[t.length-1],{ISOWeek:i,fixedWeeks:a,broadcastCalendar:l}=n??{},{addDays:c,differenceInCalendarDays:u,differenceInCalendarMonths:d,endOfBroadcastWeek:f,endOfISOWeek:h,endOfMonth:p,endOfWeek:g,isAfter:m,startOfBroadcastWeek:y,startOfISOWeek:b,startOfWeek:w}=r,k=l?y(o,r):i?b(o):w(o),v=l?f(s):i?h(p(s)):g(p(s)),x=e&&(l?f(e):i?h(e):g(e)),E=x&&m(v,x)?x:v,C=u(E,k),A=d(s,o)+1,z=[];for(let N=0;N<=C;N++){const L=c(k,N);z.push(L)}const _=(l?35:42)*A;if(a&&z.length<_){const N=_-z.length;for(let L=0;L<N;L++){const H=c(z[z.length-1],1);z.push(H)}}return z}function cH(t){const e=[];return t.reduce((n,r)=>{const o=r.weeks.reduce((s,i)=>s.concat(i.days.slice()),e.slice());return n.concat(o.slice())},e.slice())}function uH(t,e,n,r){const{numberOfMonths:o=1}=n,s=[];for(let i=0;i<o;i++){const a=r.addMonths(t,i);if(e&&a>e)break;s.push(a)}return s}function V0(t,e,n,r){const{month:o,defaultMonth:s,today:i=r.today(),numberOfMonths:a=1}=t;let l=o||s||i;const{differenceInCalendarMonths:c,addMonths:u,startOfMonth:d}=r;if(n&&c(n,l)<a-1){const f=-1*(a-1);l=u(n,f)}return e&&c(l,e)<0&&(l=e),d(l)}function dH(t,e,n,r){const{addDays:o,endOfBroadcastWeek:s,endOfISOWeek:i,endOfMonth:a,endOfWeek:l,getISOWeek:c,getWeek:u,startOfBroadcastWeek:d,startOfISOWeek:f,startOfWeek:h}=r,p=t.reduce((g,m)=>{const y=n.broadcastCalendar?d(m,r):n.ISOWeek?f(m):h(m),b=n.broadcastCalendar?s(m):n.ISOWeek?i(a(m)):l(a(m)),w=e.filter(E=>E>=y&&E<=b),k=n.broadcastCalendar?35:42;if(n.fixedWeeks&&w.length<k){const E=e.filter(C=>{const A=k-w.length;return C>b&&C<=o(b,A)});w.push(...E)}const v=w.reduce((E,C)=>{const A=n.ISOWeek?c(C):u(C),z=E.find(_=>_.weekNumber===A),R=new IC(C,m,r);return z?z.days.push(R):E.push(new aV(A,[R])),E},[]),x=new iV(m,v);return g.push(x),g},[]);return n.reverseMonths?p.reverse():p}function fH(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:o,startOfDay:s,startOfMonth:i,endOfMonth:a,addYears:l,endOfYear:c,newDate:u,today:d}=e,{fromYear:f,toYear:h,fromMonth:p,toMonth:g}=t;!n&&p&&(n=p),!n&&f&&(n=e.newDate(f,0,1)),!r&&g&&(r=g),!r&&h&&(r=u(h,11,31));const m=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=i(n):f?n=u(f,0,1):!n&&m&&(n=o(l(t.today??d(),-100))),r?r=a(r):h?r=u(h,11,31):!r&&m&&(r=c(t.today??d())),[n&&s(n),r&&s(r)]}function hH(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:s=1}=n,{startOfMonth:i,addMonths:a,differenceInCalendarMonths:l}=r,c=o?s:1,u=i(t);if(!e)return a(u,c);if(!(l(e,t)<s))return a(u,c)}function pH(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:s}=n,{startOfMonth:i,addMonths:a,differenceInCalendarMonths:l}=r,c=o?s??1:1,u=i(t);if(!e)return a(u,-c);if(!(l(u,e)<=0))return a(u,-c)}function mH(t){const e=[];return t.reduce((n,r)=>n.concat(r.weeks.slice()),e.slice())}function Id(t,e){const[n,r]=S.useState(t);return[e===void 0?n:e,r]}function gH(t,e){const[n,r]=fH(t,e),{startOfMonth:o,endOfMonth:s}=e,i=V0(t,n,r,e),[a,l]=Id(i,t.month?i:void 0);S.useEffect(()=>{const k=V0(t,n,r,e);l(k)},[t.timeZone]);const{months:c,weeks:u,days:d,previousMonth:f,nextMonth:h}=S.useMemo(()=>{const k=uH(a,r,{numberOfMonths:t.numberOfMonths},e),v=lH(k,t.endMonth?s(t.endMonth):void 0,{ISOWeek:t.ISOWeek,fixedWeeks:t.fixedWeeks,broadcastCalendar:t.broadcastCalendar},e),x=dH(k,v,{broadcastCalendar:t.broadcastCalendar,fixedWeeks:t.fixedWeeks,ISOWeek:t.ISOWeek,reverseMonths:t.reverseMonths},e),E=mH(x),C=cH(x),A=pH(a,n,t,e),z=hH(a,r,t,e);return{months:x,weeks:E,days:C,previousMonth:A,nextMonth:z}},[e,a.getTime(),r?.getTime(),n?.getTime(),t.disableNavigation,t.broadcastCalendar,t.endMonth?.getTime(),t.fixedWeeks,t.ISOWeek,t.numberOfMonths,t.pagedNavigation,t.reverseMonths]),{disableNavigation:p,onMonthChange:g}=t,m=k=>u.some(v=>v.days.some(x=>x.isEqualTo(k))),y=k=>{if(p)return;let v=o(k);n&&v<o(n)&&(v=o(n)),r&&v>o(r)&&(v=o(r)),l(v),g?.(v)};return{months:c,weeks:u,days:d,navStart:n,navEnd:r,previousMonth:f,nextMonth:h,goToMonth:y,goToDay:k=>{m(k)||y(k.date)}}}var nr;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(nr||(nr={}));function H0(t){return!t[pt.disabled]&&!t[pt.hidden]&&!t[pt.outside]}function yH(t,e,n,r){let o,s=-1;for(const i of t){const a=e(i);H0(a)&&(a[pt.focused]&&s<nr.FocusedModifier?(o=i,s=nr.FocusedModifier):r?.isEqualTo(i)&&s<nr.LastFocused?(o=i,s=nr.LastFocused):n(i.date)&&s<nr.Selected?(o=i,s=nr.Selected):a[pt.today]&&s<nr.Today&&(o=i,s=nr.Today))}return o||(o=t.find(i=>H0(e(i)))),o}function bH(t,e,n,r,o,s,i){const{ISOWeek:a,broadcastCalendar:l}=s,{addDays:c,addMonths:u,addWeeks:d,addYears:f,endOfBroadcastWeek:h,endOfISOWeek:p,endOfWeek:g,max:m,min:y,startOfBroadcastWeek:b,startOfISOWeek:w,startOfWeek:k}=i;let x={day:c,week:d,month:u,year:f,startOfWeek:E=>l?b(E,i):a?w(E):k(E),endOfWeek:E=>l?h(E):a?p(E):g(E)}[t](n,e==="after"?1:-1);return e==="before"&&r?x=m([r,x]):e==="after"&&o&&(x=y([o,x])),x}function ZC(t,e,n,r,o,s,i,a=0){if(a>365)return;const l=bH(t,e,n.date,r,o,s,i),c=!!(s.disabled&&_r(l,s.disabled,i)),u=!!(s.hidden&&_r(l,s.hidden,i)),d=l,f=new IC(l,d,i);return!c&&!u?f:ZC(t,e,f,r,o,s,i,a+1)}function vH(t,e,n,r,o){const{autoFocus:s}=t,[i,a]=S.useState(),l=yH(e.days,n,r||(()=>!1),i),[c,u]=S.useState(s?l:void 0);return{isFocusTarget:g=>!!l?.isEqualTo(g),setFocused:u,focused:c,blur:()=>{a(c),u(void 0)},moveFocus:(g,m)=>{if(!c)return;const y=ZC(g,m,c,e.navStart,e.navEnd,t,o);y&&(t.disableNavigation&&!e.days.some(w=>w.isEqualTo(y))||(e.goToDay(y),u(y)))}}}function wH(t,e){const{selected:n,required:r,onSelect:o}=t,[s,i]=Id(n,o?n:void 0),a=o?n:s,{isSameDay:l}=e,c=h=>a?.some(p=>l(p,h))??!1,{min:u,max:d}=t;return{selected:a,select:(h,p,g)=>{let m=[...a??[]];if(c(h)){if(a?.length===u||r&&a?.length===1)return;m=a?.filter(y=>!l(y,h))}else a?.length===d?m=[h]:m=[...m,h];return o||i(m),o?.(m,h,p,g),m},isSelected:c}}function kH(t,e,n=0,r=0,o=!1,s=hr){const{from:i,to:a}=e||{},{isSameDay:l,isAfter:c,isBefore:u}=s;let d;if(!i&&!a)d={from:t,to:n>0?void 0:t};else if(i&&!a)l(i,t)?n===0?d={from:i,to:t}:o?d={from:i,to:void 0}:d=void 0:u(t,i)?d={from:t,to:i}:d={from:i,to:t};else if(i&&a)if(l(i,t)&&l(a,t))o?d={from:i,to:a}:d=void 0;else if(l(i,t))d={from:i,to:n>0?void 0:t};else if(l(a,t))d={from:t,to:n>0?void 0:t};else if(u(t,i))d={from:t,to:a};else if(c(t,i))d={from:i,to:t};else if(c(t,a))d={from:i,to:t};else throw new Error("Invalid range");if(d?.from&&d?.to){const f=s.differenceInCalendarDays(d.to,d.from);r>0&&f>r?d={from:t,to:void 0}:n>1&&f<n&&(d={from:t,to:void 0})}return d}function xH(t,e,n=hr){const r=Array.isArray(e)?e:[e];let o=t.from;const s=n.differenceInCalendarDays(t.to,t.from),i=Math.min(s,6);for(let a=0;a<=i;a++){if(r.includes(o.getDay()))return!0;o=n.addDays(o,1)}return!1}function W0(t,e,n=hr){return Or(t,e.from,!1,n)||Or(t,e.to,!1,n)||Or(e,t.from,!1,n)||Or(e,t.to,!1,n)}function SH(t,e,n=hr){const r=Array.isArray(e)?e:[e];if(r.filter(a=>typeof a!="function").some(a=>typeof a=="boolean"?a:n.isDate(a)?Or(t,a,!1,n):zC(a,n)?a.some(l=>Or(t,l,!1,n)):Ad(a)?a.from&&a.to?W0(t,{from:a.from,to:a.to},n):!1:DC(a)?xH(t,a.dayOfWeek,n):fg(a)?n.isAfter(a.before,a.after)?W0(t,{from:n.addDays(a.after,1),to:n.addDays(a.before,-1)},n):_r(t.from,a,n)||_r(t.to,a,n):hg(a)||pg(a)?_r(t.from,a,n)||_r(t.to,a,n):!1))return!0;const i=r.filter(a=>typeof a=="function");if(i.length){let a=t.from;const l=n.differenceInCalendarDays(t.to,t.from);for(let c=0;c<=l;c++){if(i.some(u=>u(a)))return!0;a=n.addDays(a,1)}}return!1}function EH(t,e){const{disabled:n,excludeDisabled:r,resetOnSelect:o,selected:s,required:i,onSelect:a}=t,[l,c]=Id(s,a?s:void 0),u=a?s:l;return{selected:u,select:(h,p,g)=>{const{min:m,max:y}=t;let b;if(h){const w=u?.from,k=u?.to,v=!!w&&!!k,x=!!w&&!!k&&e.isSameDay(w,k)&&e.isSameDay(h,w);o&&(v||!u?.from)?!i&&x?b=void 0:b={from:h,to:void 0}:b=kH(h,u,m,y,i,e)}return r&&n&&b?.from&&b.to&&SH({from:b.from,to:b.to},n,e)&&(b.from=h,b.to=void 0),a||c(b),a?.(b,h,p,g),b},isSelected:h=>u&&Or(u,h,!1,e)}}function CH(t,e){const{selected:n,required:r,onSelect:o}=t,[s,i]=Id(n,o?n:void 0),a=o?n:s,{isSameDay:l}=e;return{selected:a,select:(d,f,h)=>{let p=d;return!r&&a&&a&&l(d,a)&&(p=void 0),o||i(p),o?.(p,d,f,h),p},isSelected:d=>a?l(a,d):!1}}function TH(t,e){const n=CH(t,e),r=wH(t,e),o=EH(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return o;default:return}}function Nn(t,e){return t instanceof Kt&&t.timeZone===e?t:new Kt(t,e)}function $s(t,e,n){return Nn(t,e)}function q0(t,e,n){return typeof t=="boolean"||typeof t=="function"?t:t instanceof Date?$s(t,e):Array.isArray(t)?t.map(r=>r instanceof Date?$s(r,e):r):Ad(t)?{...t,from:t.from?Nn(t.from,e):t.from,to:t.to?Nn(t.to,e):t.to}:fg(t)?{before:$s(t.before,e),after:$s(t.after,e)}:hg(t)?{after:$s(t.after,e)}:pg(t)?{before:$s(t.before,e)}:t}function Hf(t,e,n){return t&&(Array.isArray(t)?t.map(r=>q0(r,e)):q0(t,e))}function MH(t){let e=t;const n=e.timeZone;if(n&&(e={...t,timeZone:n},e.today&&(e.today=Nn(e.today,n)),e.month&&(e.month=Nn(e.month,n)),e.defaultMonth&&(e.defaultMonth=Nn(e.defaultMonth,n)),e.startMonth&&(e.startMonth=Nn(e.startMonth,n)),e.endMonth&&(e.endMonth=Nn(e.endMonth,n)),e.mode==="single"&&e.selected?e.selected=Nn(e.selected,n):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(ke=>Nn(ke,n)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?Nn(e.selected.from,n):e.selected.from,to:e.selected.to?Nn(e.selected.to,n):e.selected.to}),e.disabled!==void 0&&(e.disabled=Hf(e.disabled,n)),e.hidden!==void 0&&(e.hidden=Hf(e.hidden,n)),e.modifiers)){const ke={};Object.keys(e.modifiers).forEach(Ee=>{ke[Ee]=Hf(e.modifiers?.[Ee],n)}),e.modifiers=ke}const{components:r,formatters:o,labels:s,dateLib:i,locale:a,classNames:l}=S.useMemo(()=>{const ke={...AC,...e.locale},Ee=e.broadcastCalendar?1:e.weekStartsOn,we=e.noonSafe&&e.timeZone?rH(e.timeZone,{weekStartsOn:Ee,locale:ke}):void 0,Ne=e.dateLib&&we?{...we,...e.dateLib}:e.dateLib??we,ct=new Tn({locale:ke,weekStartsOn:Ee,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},Ne);return{dateLib:ct,components:zV(e.components),formatters:KV(e.formatters),labels:XV(e.labels,ct.options),locale:ke,classNames:{...mg(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.noonSafe,e.components,e.formatters,e.labels,e.classNames]);e.today||(e={...e,today:i.today()});const{captionLayout:c,mode:u,navLayout:d,numberOfMonths:f=1,onDayBlur:h,onDayClick:p,onDayFocus:g,onDayKeyDown:m,onDayMouseEnter:y,onDayMouseLeave:b,onNextClick:w,onPrevClick:k,showWeekNumber:v,styles:x}=e,{formatCaption:E,formatDay:C,formatMonthDropdown:A,formatWeekNumber:z,formatWeekNumberHeader:R,formatWeekdayName:_,formatYearDropdown:N}=o,L=gH(e,i),{days:H,months:Z,navStart:W,navEnd:q,previousMonth:V,nextMonth:D,goToMonth:j}=L,B=$V(H,e,W,q,i),{isSelected:F,select:T,selected:$}=TH(e,i)??{},{blur:I,focused:Y,isFocusTarget:G,moveFocus:X,setFocused:se}=vH(e,L,B,F??(()=>!1),i),{labelDayButton:O,labelGridcell:P,labelGrid:U,labelMonthDropdown:K,labelNav:J,labelPrevious:ee,labelNext:ie,labelWeekday:oe,labelWeekNumber:ne,labelWeekNumberHeader:le,labelYearDropdown:Q}=s,fe=S.useMemo(()=>tH(i,e.ISOWeek,e.broadcastCalendar,e.today),[i,e.ISOWeek,e.broadcastCalendar,e.today]),ye=u!==void 0||p!==void 0,he=S.useCallback(()=>{V&&(j(V),k?.(V))},[V,j,k]),Ue=S.useCallback(()=>{D&&(j(D),w?.(D))},[j,D,w]),Ze=S.useCallback((ke,Ee)=>we=>{we.preventDefault(),we.stopPropagation(),se(ke),!Ee.disabled&&(T?.(ke.date,Ee,we),p?.(ke.date,Ee,we))},[T,p,se]),ft=S.useCallback((ke,Ee)=>we=>{se(ke),g?.(ke.date,Ee,we)},[g,se]),Ve=S.useCallback((ke,Ee)=>we=>{I(),h?.(ke.date,Ee,we)},[I,h]),ze=S.useCallback((ke,Ee)=>we=>{const Ne={ArrowLeft:[we.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[we.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[we.shiftKey?"year":"week","after"],ArrowUp:[we.shiftKey?"year":"week","before"],PageUp:[we.shiftKey?"year":"month","before"],PageDown:[we.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Ne[we.key]){we.preventDefault(),we.stopPropagation();const[ct,Pe]=Ne[we.key];X(ct,Pe)}m?.(ke.date,Ee,we)},[X,m,e.dir]),Ye=S.useCallback((ke,Ee)=>we=>{y?.(ke.date,Ee,we)},[y]),Ge=S.useCallback((ke,Ee)=>we=>{b?.(ke.date,Ee,we)},[b]),Ln=S.useCallback(ke=>Ee=>{const we=Number(Ee.target.value),Ne=i.setMonth(i.startOfMonth(ke),we);j(Ne)},[i,j]),Gn=S.useCallback(ke=>Ee=>{const we=Number(Ee.target.value),Ne=i.setYear(i.startOfMonth(ke),we);j(Ne)},[i,j]),{className:jn,style:Mn}=S.useMemo(()=>({className:[l[Se.Root],e.className].filter(Boolean).join(" "),style:{...x?.[Se.Root],...e.style}}),[l,e.className,e.style,x]),Xt=LV(e),He=S.useRef(null);aH(He,!!e.animate,{classNames:l,months:Z,focused:Y,dateLib:i});const kt={dayPickerProps:e,selected:$,select:T,isSelected:F,months:Z,nextMonth:D,previousMonth:V,goToMonth:j,getModifiers:B,components:r,classNames:l,styles:x,labels:s,formatters:o};return ce.createElement($C.Provider,{value:kt},ce.createElement(r.Root,{rootRef:e.animate?He:void 0,className:jn,style:Mn,dir:e.dir,id:e.id,lang:e.lang??a.code,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...Xt},ce.createElement(r.Months,{className:l[Se.Months],style:x?.[Se.Months]},!e.hideNavigation&&!d&&ce.createElement(r.Nav,{"data-animated-nav":e.animate?"true":void 0,className:l[Se.Nav],style:x?.[Se.Nav],"aria-label":J(),onPreviousClick:he,onNextClick:Ue,previousMonth:V,nextMonth:D}),Z.map((ke,Ee)=>ce.createElement(r.Month,{"data-animated-month":e.animate?"true":void 0,className:l[Se.Month],style:x?.[Se.Month],key:Ee,displayIndex:Ee,calendarMonth:ke},d==="around"&&!e.hideNavigation&&Ee===0&&ce.createElement(r.PreviousMonthButton,{type:"button",className:l[Se.PreviousMonthButton],tabIndex:V?void 0:-1,"aria-disabled":V?void 0:!0,"aria-label":ee(V),onClick:he,"data-animated-button":e.animate?"true":void 0},ce.createElement(r.Chevron,{disabled:V?void 0:!0,className:l[Se.Chevron],orientation:e.dir==="rtl"?"right":"left"})),ce.createElement(r.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:l[Se.MonthCaption],style:x?.[Se.MonthCaption],calendarMonth:ke,displayIndex:Ee},c?.startsWith("dropdown")?ce.createElement(r.DropdownNav,{className:l[Se.Dropdowns],style:x?.[Se.Dropdowns]},(()=>{const we=c==="dropdown"||c==="dropdown-months"?ce.createElement(r.MonthsDropdown,{key:"month",className:l[Se.MonthsDropdown],"aria-label":K(),classNames:l,components:r,disabled:!!e.disableNavigation,onChange:Ln(ke.date),options:QV(ke.date,W,q,o,i),style:x?.[Se.Dropdown],value:i.getMonth(ke.date)}):ce.createElement("span",{key:"month"},A(ke.date,i)),Ne=c==="dropdown"||c==="dropdown-years"?ce.createElement(r.YearsDropdown,{key:"year",className:l[Se.YearsDropdown],"aria-label":Q(i.options),classNames:l,components:r,disabled:!!e.disableNavigation,onChange:Gn(ke.date),options:nH(W,q,o,i,!!e.reverseYears),style:x?.[Se.Dropdown],value:i.getYear(ke.date)}):ce.createElement("span",{key:"year"},N(ke.date,i));return i.getMonthYearOrder()==="year-first"?[Ne,we]:[we,Ne]})(),ce.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},E(ke.date,i.options,i))):ce.createElement(r.CaptionLabel,{className:l[Se.CaptionLabel],role:"status","aria-live":"polite"},E(ke.date,i.options,i))),d==="around"&&!e.hideNavigation&&Ee===f-1&&ce.createElement(r.NextMonthButton,{type:"button",className:l[Se.NextMonthButton],tabIndex:D?void 0:-1,"aria-disabled":D?void 0:!0,"aria-label":ie(D),onClick:Ue,"data-animated-button":e.animate?"true":void 0},ce.createElement(r.Chevron,{disabled:D?void 0:!0,className:l[Se.Chevron],orientation:e.dir==="rtl"?"left":"right"})),Ee===f-1&&d==="after"&&!e.hideNavigation&&ce.createElement(r.Nav,{"data-animated-nav":e.animate?"true":void 0,className:l[Se.Nav],style:x?.[Se.Nav],"aria-label":J(),onPreviousClick:he,onNextClick:Ue,previousMonth:V,nextMonth:D}),ce.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":U(ke.date,i.options,i)||void 0,className:l[Se.MonthGrid],style:x?.[Se.MonthGrid]},!e.hideWeekdays&&ce.createElement(r.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:l[Se.Weekdays],style:x?.[Se.Weekdays]},v&&ce.createElement(r.WeekNumberHeader,{"aria-label":le(i.options),className:l[Se.WeekNumberHeader],style:x?.[Se.WeekNumberHeader],scope:"col"},R()),fe.map(we=>ce.createElement(r.Weekday,{"aria-label":oe(we,i.options,i),className:l[Se.Weekday],key:String(we),style:x?.[Se.Weekday],scope:"col"},_(we,i.options,i)))),ce.createElement(r.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:l[Se.Weeks],style:x?.[Se.Weeks]},ke.weeks.map(we=>ce.createElement(r.Week,{className:l[Se.Week],key:we.weekNumber,style:x?.[Se.Week],week:we},v&&ce.createElement(r.WeekNumber,{week:we,style:x?.[Se.WeekNumber],"aria-label":ne(we.weekNumber,{locale:a}),className:l[Se.WeekNumber],scope:"row",role:"rowheader"},z(we.weekNumber,i)),we.days.map(Ne=>{const{date:ct}=Ne,Pe=B(Ne);if(Pe[pt.focused]=!Pe.hidden&&!!Y?.isEqualTo(Ne),Pe[Yn.selected]=F?.(ct)||Pe.selected,Ad($)){const{from:mr,to:gr}=$;Pe[Yn.range_start]=!!(mr&&gr&&i.isSameDay(ct,mr)),Pe[Yn.range_end]=!!(mr&&gr&&i.isSameDay(ct,gr)),Pe[Yn.range_middle]=Or($,ct,!0,i)}const Jn=eH(Pe,x,e.modifiersStyles),Fr=DV(Pe,l,e.modifiersClassNames),Br=!ye&&!Pe.hidden?P(ct,Pe,i.options,i):void 0;return ce.createElement(r.Day,{key:`${Ne.isoDate}_${Ne.displayMonthId}`,day:Ne,modifiers:Pe,className:Fr.join(" "),style:Jn,role:"gridcell","aria-selected":Pe.selected||void 0,"aria-label":Br,"data-day":Ne.isoDate,"data-month":Ne.outside?Ne.dateMonthId:void 0,"data-selected":Pe.selected||void 0,"data-disabled":Pe.disabled||void 0,"data-hidden":Pe.hidden||void 0,"data-outside":Ne.outside||void 0,"data-focused":Pe.focused||void 0,"data-today":Pe.today||void 0},!Pe.hidden&&ye?ce.createElement(r.DayButton,{className:l[Se.DayButton],style:x?.[Se.DayButton],type:"button",day:Ne,modifiers:Pe,disabled:!Pe.focused&&Pe.disabled||void 0,"aria-disabled":Pe.focused&&Pe.disabled||void 0,tabIndex:G(Ne)?0:-1,"aria-label":O(ct,Pe,i.options,i),onClick:Ze(Ne,Pe),onBlur:Ve(Ne,Pe),onFocus:ft(Ne,Pe),onKeyDown:ze(Ne,Pe),onMouseEnter:Ye(Ne,Pe),onMouseLeave:Ge(Ne,Pe)},C(ct,i.options,i)):!Pe.hidden&&C(Ne.date,i.options,i))})))))))),e.footer&&ce.createElement(r.Footer,{className:l[Se.Footer],style:x?.[Se.Footer],role:"status","aria-live":"polite"},e.footer)))}function RH({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:o="ghost",locale:s,formatters:i,components:a,...l}){const c=mg();return M.jsx(MH,{showOutsideDays:n,className:ue("group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,t),captionLayout:r,locale:s,formatters:{formatMonthDropdown:u=>u.toLocaleString(s?.code,{month:"short"}),...i},classNames:{root:ue("w-fit",c.root),months:ue("relative flex flex-col gap-4 md:flex-row",c.months),month:ue("flex w-full flex-col gap-4",c.month),nav:ue("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",c.nav),button_previous:ue(Ea({variant:o}),"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",c.button_previous),button_next:ue(Ea({variant:o}),"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",c.button_next),month_caption:ue("flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",c.month_caption),dropdowns:ue("flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",c.dropdowns),dropdown_root:ue("relative rounded-(--cell-radius)",c.dropdown_root),dropdown:ue("absolute inset-0 bg-popover opacity-0",c.dropdown),caption_label:ue("font-medium select-none",r==="label"?"text-sm":"flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",c.caption_label),table:"w-full border-collapse",weekdays:ue("flex",c.weekdays),weekday:ue("flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none",c.weekday),week:ue("mt-2 flex w-full",c.week),week_number_header:ue("w-(--cell-size) select-none",c.week_number_header),week_number:ue("text-[0.8rem] text-muted-foreground select-none",c.week_number),day:ue("group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)",l.showWeekNumber?"[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)":"[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)",c.day),range_start:ue("relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted",c.range_start),range_middle:ue("rounded-none",c.range_middle),range_end:ue("relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted",c.range_end),today:ue("rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none",c.today),outside:ue("text-muted-foreground aria-selected:text-muted-foreground",c.outside),disabled:ue("text-muted-foreground opacity-50",c.disabled),hidden:ue("invisible",c.hidden),...e},components:{Root:({className:u,rootRef:d,...f})=>M.jsx("div",{"data-slot":"calendar",ref:d,className:ue(u),...f}),Chevron:({className:u,orientation:d,...f})=>d==="left"?M.jsx(X_,{className:ue("size-4",u),...f}):d==="right"?M.jsx(eN,{className:ue("size-4",u),...f}):M.jsx($p,{className:ue("size-4",u),...f}),DayButton:({...u})=>M.jsx(OH,{locale:s,...u}),WeekNumber:({children:u,...d})=>M.jsx("td",{...d,children:M.jsx("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:u})}),...a},...l})}function OH(t){const e=Me.c(21);let n,r,o,s,i;e[0]!==t?({className:n,day:r,modifiers:s,locale:o,...i}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=s,e[5]=i):(n=e[1],r=e[2],o=e[3],s=e[4],i=e[5]);const a=mg(),l=S.useRef(null);let c,u;e[6]!==s.focused?(c=()=>{s.focused&&l.current?.focus()},u=[s.focused],e[6]=s.focused,e[7]=c,e[8]=u):(c=e[7],u=e[8]),S.useEffect(c,u);const d=pn,f="ghost",h="icon";let p;e[9]!==r.date||e[10]!==o?.code?(p=r.date.toLocaleDateString(o?.code),e[9]=r.date,e[10]=o?.code,e[11]=p):p=e[11];const g=s.selected&&!s.range_start&&!s.range_end&&!s.range_middle,m=s.range_start,y=s.range_end,b=s.range_middle,w=ue("group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) [&>span]:text-xs [&>span]:opacity-70",a.day,n);let k;return e[12]!==d||e[13]!==s.range_end||e[14]!==s.range_middle||e[15]!==s.range_start||e[16]!==i||e[17]!==w||e[18]!==p||e[19]!==g?(k=M.jsx(d,{variant:f,size:h,"data-day":p,"data-selected-single":g,"data-range-start":m,"data-range-end":y,"data-range-middle":b,className:w,...i}),e[12]=d,e[13]=s.range_end,e[14]=s.range_middle,e[15]=s.range_start,e[16]=i,e[17]=w,e[18]=p,e[19]=g,e[20]=k):k=e[20],k}function _H(t){const e=Me.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let o;e[3]!==n?(o=ue("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=M.jsx("label",{"data-slot":"label",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}const GC=S.createContext(void 0);function NH(){const t=S.useContext(GC);if(t===void 0)throw new Error(Zt(63));return t}let U0=(function(t){return t.checked="data-checked",t.unchecked="data-unchecked",t.disabled="data-disabled",t.readonly="data-readonly",t.required="data-required",t.valid="data-valid",t.invalid="data-invalid",t.touched="data-touched",t.dirty="data-dirty",t.filled="data-filled",t.focused="data-focused",t})({});const JC={...em,checked(t){return t?{[U0.checked]:""}:{[U0.unchecked]:""}}},PH=S.forwardRef(function(e,n){const{checked:r,className:o,defaultChecked:s,id:i,inputRef:a,name:l,nativeButton:c=!1,onCheckedChange:u,readOnly:d=!1,required:f=!1,disabled:h=!1,render:p,uncheckedValue:g,value:m,...y}=e,{clearErrors:b}=tm(),{state:w,setTouched:k,setDirty:v,validityData:x,setFilled:E,setFocused:C,shouldValidateOnChange:A,validationMode:z,disabled:R,name:_,validation:N}=Pi(),{labelId:L}=fd(),H=R||h,Z=_??l,W=de(u),q=S.useRef(null),V=zr(q,a,N.inputRef),D=S.useRef(null),j=bs(),B=hd({id:i,implicit:!1,controlRef:D}),F=c?void 0:B,[T,$]=Ta({controlled:r,default:!!s,name:"Switch",state:"checked"});nm({id:j,commit:N.commit,value:T,controlRef:D,name:Z,getValue:()=>T}),me(()=>{q.current&&E(q.current.checked)},[q,E]),Gx(T,()=>{b(Z),v(T!==x.initialValue),E(T),A()?N.commit(T):N.commit(T,!0)});const{getButtonProps:I,buttonRef:Y}=ws({disabled:H,native:c}),G={id:c?B:j,role:"switch","aria-checked":T,"aria-readonly":d||void 0,"aria-required":f||void 0,"aria-labelledby":L,onFocus(){H||C(!0)},onBlur(){const P=q.current;!P||H||(k(!0),C(!1),z==="onBlur"&&N.commit(P.checked))},onClick(P){d||H||(P.preventDefault(),q.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:P.shiftKey,ctrlKey:P.ctrlKey,altKey:P.altKey,metaKey:P.metaKey})))}},X=S.useMemo(()=>Oi({checked:T,disabled:H,id:F,name:Z,required:f,style:Z?wk:od,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:V,onChange(P){if(P.nativeEvent.defaultPrevented)return;const U=P.target.checked,K=De(po,P.nativeEvent);W?.(U,K),!K.isCanceled&&$(U)},onFocus(){D.current?.focus()}},N.getInputValidationProps,m!==void 0?{value:m}:At),[T,H,V,F,Z,W,f,$,N,m]),se=S.useMemo(()=>({...w,checked:T,disabled:H,readOnly:d,required:f}),[w,T,H,d,f]),O=rt("span",e,{state:se,ref:[n,D,Y],props:[G,N.getValidationProps,y,I],stateAttributesMapping:JC});return M.jsxs(GC.Provider,{value:se,children:[O,!T&&Z&&g!==void 0&&M.jsx("input",{type:"hidden",name:Z,value:g}),M.jsx("input",{...X})]})}),AH=S.forwardRef(function(e,n){const{render:r,className:o,...s}=e,{state:i}=Pi(),a=NH(),l={...i,...a};return rt("span",e,{state:l,ref:n,stateAttributesMapping:JC,props:s})});function IH(t){const e=Me.c(11);let n,r,o;e[0]!==t?({className:n,size:o,...r}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o):(n=e[1],r=e[2],o=e[3]);const s=o===void 0?"default":o;let i;e[4]!==n?(i=ue("peer group/switch focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 aria-invalid:ring-3 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px]",n),e[4]=n,e[5]=i):i=e[5];let a;e[6]===Symbol.for("react.memo_cache_sentinel")?(a=M.jsx(AH,{"data-slot":"switch-thumb",className:"bg-background dark:data-checked:bg-primary-foreground dark:data-unchecked:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0"}),e[6]=a):a=e[6];let l;return e[7]!==r||e[8]!==s||e[9]!==i?(l=M.jsx(PH,{"data-slot":"switch","data-size":s,className:i,...r,children:a}),e[7]=r,e[8]=s,e[9]=i,e[10]=l):l=e[10],l}function $l(t){return t.toString().padStart(2,"0")}function K0(t){const e=t.getFullYear(),n=$l(t.getMonth()+1),r=$l(t.getDate()),o=$l(t.getHours()),s=$l(t.getMinutes());return`${e}-${n}-${r}T${o}:${s}`}function $H(t){if(!Number.isFinite(t))return;const e=Math.abs(t)<1e12?t*1e3:t,n=new Date(e);if(!Number.isNaN(n.getTime()))return n}function DH(t){if(typeof t=="string"){const e=t.trim();if(e.length===0)return"";if(/^\d{4}-\d{2}-\d{2}$/.test(e))return`${e}T00:00`;const n=new Date(e);return Number.isNaN(n.getTime())?"":K0(n)}if(typeof t=="number"){const e=$H(t);return e?K0(e):""}return""}function zH(t){if(!t)return;const e=new Date(t);if(!Number.isNaN(e.getTime()))return e.toISOString()}const LH=vo({method:"POST"}).handler(wo("dcd3839820feeaed3b1a4f86186dd05c2e7e26ffaacdeaba309f44d121c95ad1")),jH=vo({method:"POST"}).handler(wo("02ba027930daf730cf535415a08fab7365d58edddcc678dbcb19c72f990c25b5"));function te(t,e,n){function r(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,l);const c=i.prototype,u=Object.keys(c);for(let d=0;d<u.length;d++){const f=u[d];f in a||(a[f]=c[f].bind(a))}}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:t});function i(a){var l;const c=n?.Parent?new s:this;r(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const u of c._zod.deferred)u();return c}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(i,"name",{value:t}),i}class si extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class XC extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const QC={};function yo(t){return QC}function eT(t){const e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,o])=>e.indexOf(+r)===-1).map(([r,o])=>o)}function sp(t,e){return typeof e=="bigint"?e.toString():e}function bg(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function vg(t){return t==null}function wg(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}const Y0=Symbol("evaluating");function nt(t,e,n){let r;Object.defineProperty(t,e,{get(){if(r!==Y0)return r===void 0&&(r=Y0,r=n()),r},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function Rs(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function No(...t){const e={};for(const n of t){const r=Object.getOwnPropertyDescriptors(n);Object.assign(e,r)}return Object.defineProperties({},e)}function Z0(t){return JSON.stringify(t)}function FH(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const tT="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Uu(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const BH=bg(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Ei(t){if(Uu(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const n=e.prototype;return!(Uu(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function nT(t){return Ei(t)?{...t}:Array.isArray(t)?[...t]:t}const VH=new Set(["string","number","symbol"]);function Ci(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Po(t,e,n){const r=new t._zod.constr(e??t._zod.def);return(!e||n?.parent)&&(r._zod.parent=t),r}function Oe(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function HH(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function WH(t,e){const n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=No(t._zod.def,{get shape(){const i={};for(const a in e){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(i[a]=n.shape[a])}return Rs(this,"shape",i),i},checks:[]});return Po(t,s)}function qH(t,e){const n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=No(t._zod.def,{get shape(){const i={...t._zod.def.shape};for(const a in e){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete i[a]}return Rs(this,"shape",i),i},checks:[]});return Po(t,s)}function UH(t,e){if(!Ei(e))throw new Error("Invalid input to extend: expected a plain object");const n=t._zod.def.checks;if(n&&n.length>0){const s=t._zod.def.shape;for(const i in e)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=No(t._zod.def,{get shape(){const s={...t._zod.def.shape,...e};return Rs(this,"shape",s),s}});return Po(t,o)}function KH(t,e){if(!Ei(e))throw new Error("Invalid input to safeExtend: expected a plain object");const n=No(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e};return Rs(this,"shape",r),r}});return Po(t,n)}function YH(t,e){const n=No(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return Rs(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:[]});return Po(t,n)}function ZH(t,e,n){const o=e._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=No(e._zod.def,{get shape(){const a=e._zod.def.shape,l={...a};if(n)for(const c in n){if(!(c in a))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(l[c]=t?new t({type:"optional",innerType:a[c]}):a[c])}else for(const c in a)l[c]=t?new t({type:"optional",innerType:a[c]}):a[c];return Rs(this,"shape",l),l},checks:[]});return Po(e,i)}function GH(t,e,n){const r=No(e._zod.def,{get shape(){const o=e._zod.def.shape,s={...o};if(n)for(const i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new t({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new t({type:"nonoptional",innerType:o[i]});return Rs(this,"shape",s),s}});return Po(e,r)}function Us(t,e=0){if(t.aborted===!0)return!0;for(let n=e;n<t.issues.length;n++)if(t.issues[n]?.continue!==!0)return!0;return!1}function Ks(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function Dl(t){return typeof t=="string"?t:t?.message}function bo(t,e,n){const r={...t,path:t.path??[]};if(!t.message){const o=Dl(t.inst?._zod.def?.error?.(t))??Dl(e?.error?.(t))??Dl(n.customError?.(t))??Dl(n.localeError?.(t))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,e?.reportInput||delete r.input,r}function kg(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Ba(...t){const[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}const rT=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,sp,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},oT=te("$ZodError",rT),sT=te("$ZodError",rT,{Parent:Error});function JH(t,e=n=>n.message){const n={},r=[];for(const o of t.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(e(o))):r.push(e(o));return{formErrors:r,fieldErrors:n}}function XH(t,e=n=>n.message){const n={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>r({issues:i}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(e(s));else{let i=n,a=0;for(;a<s.path.length;){const l=s.path[a];a===s.path.length-1?(i[l]=i[l]||{_errors:[]},i[l]._errors.push(e(s))):i[l]=i[l]||{_errors:[]},i=i[l],a++}}};return r(t),n}const xg=t=>(e,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},i=e._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new si;if(i.issues.length){const a=new(o?.Err??t)(i.issues.map(l=>bo(l,s,yo())));throw tT(a,o?.callee),a}return i.value},Sg=t=>async(e,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=e._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(o?.Err??t)(i.issues.map(l=>bo(l,s,yo())));throw tT(a,o?.callee),a}return i.value},$d=t=>(e,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=e._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new si;return s.issues.length?{success:!1,error:new(t??oT)(s.issues.map(i=>bo(i,o,yo())))}:{success:!0,data:s.value}},QH=$d(sT),Dd=t=>async(e,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=e._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(i=>bo(i,o,yo())))}:{success:!0,data:s.value}},eW=Dd(sT),tW=t=>(e,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return xg(t)(e,n,o)},nW=t=>(e,n,r)=>xg(t)(e,n,r),rW=t=>async(e,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Sg(t)(e,n,o)},oW=t=>async(e,n,r)=>Sg(t)(e,n,r),sW=t=>(e,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return $d(t)(e,n,o)},iW=t=>(e,n,r)=>$d(t)(e,n,r),aW=t=>async(e,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Dd(t)(e,n,o)},lW=t=>async(e,n,r)=>Dd(t)(e,n,r),cW=/^[cC][^\s-]{8,}$/,uW=/^[0-9a-z]+$/,dW=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,fW=/^[0-9a-vA-V]{20}$/,hW=/^[A-Za-z0-9]{27}$/,pW=/^[a-zA-Z0-9_-]{21}$/,mW=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,gW=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,G0=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,yW=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,bW="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function vW(){return new RegExp(bW,"u")}const wW=/^(?:(?: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])$/,kW=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,xW=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,SW=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,EW=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,iT=/^[A-Za-z0-9_-]*$/,CW=/^\+[1-9]\d{6,14}$/,aT="(?:(?:\\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])))",TW=new RegExp(`^${aT}$`);function lT(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function MW(t){return new RegExp(`^${lT(t)}$`)}function RW(t){const e=lT({precision:t.precision}),n=["Z"];t.local&&n.push(""),t.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${e}(?:${n.join("|")})`;return new RegExp(`^${aT}T(?:${r})$`)}const OW=t=>{const e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},_W=/^-?\d+(?:\.\d+)?$/,NW=/^[^A-Z]*$/,PW=/^[^a-z]*$/,pr=te("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),AW=te("$ZodCheckMaxLength",(t,e)=>{var n;pr.init(t,e),(n=t._zod.def).when??(n.when=r=>{const o=r.value;return!vg(o)&&o.length!==void 0}),t._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const o=r.value;if(o.length<=e.maximum)return;const i=kg(o);r.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),IW=te("$ZodCheckMinLength",(t,e)=>{var n;pr.init(t,e),(n=t._zod.def).when??(n.when=r=>{const o=r.value;return!vg(o)&&o.length!==void 0}),t._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const o=r.value;if(o.length>=e.minimum)return;const i=kg(o);r.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),$W=te("$ZodCheckLengthEquals",(t,e)=>{var n;pr.init(t,e),(n=t._zod.def).when??(n.when=r=>{const o=r.value;return!vg(o)&&o.length!==void 0}),t._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=r=>{const o=r.value,s=o.length;if(s===e.length)return;const i=kg(o),a=s>e.length;r.issues.push({origin:i,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:t,continue:!e.abort})}}),zd=te("$ZodCheckStringFormat",(t,e)=>{var n,r;pr.init(t,e),t._zod.onattach.push(o=>{const s=o._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(n=t._zod).check??(n.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(r=t._zod).check??(r.check=()=>{})}),DW=te("$ZodCheckRegex",(t,e)=>{zd.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),zW=te("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=NW),zd.init(t,e)}),LW=te("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=PW),zd.init(t,e)}),jW=te("$ZodCheckIncludes",(t,e)=>{pr.init(t,e);const n=Ci(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${n}`:n);e.pattern=r,t._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),FW=te("$ZodCheckStartsWith",(t,e)=>{pr.init(t,e);const n=new RegExp(`^${Ci(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:t,continue:!e.abort})}}),BW=te("$ZodCheckEndsWith",(t,e)=>{pr.init(t,e);const n=new RegExp(`.*${Ci(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:t,continue:!e.abort})}}),VW=te("$ZodCheckOverwrite",(t,e)=>{pr.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class HW{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
|
|
290
|
-
`).filter(i=>i),o=Math.min(...r.map(i=>i.length-i.trimStart().length)),s=r.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const e=Function,n=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new e(...n,o.join(`
|
|
291
|
-
`))}}const WW={major:4,minor:3,patch:6},Et=te("$ZodType",(t,e)=>{var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=WW;const r=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&r.unshift(t);for(const o of r)for(const s of o._zod.onattach)s(t);if(r.length===0)(n=t._zod).deferred??(n.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{const o=(i,a,l)=>{let c=Us(i),u;for(const d of a){if(d._zod.def.when){if(!d._zod.def.when(i))continue}else if(c)continue;const f=i.issues.length,h=d._zod.check(i);if(h instanceof Promise&&l?.async===!1)throw new si;if(u||h instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await h,i.issues.length!==f&&(c||(c=Us(i,f)))});else{if(i.issues.length===f)continue;c||(c=Us(i,f))}}return u?u.then(()=>i):i},s=(i,a,l)=>{if(Us(i))return i.aborted=!0,i;const c=o(a,r,l);if(c instanceof Promise){if(l.async===!1)throw new si;return c.then(u=>t._zod.parse(u,l))}return t._zod.parse(c,l)};t._zod.run=(i,a)=>{if(a.skipChecks)return t._zod.parse(i,a);if(a.direction==="backward"){const c=t._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return c instanceof Promise?c.then(u=>s(u,i,a)):s(c,i,a)}const l=t._zod.parse(i,a);if(l instanceof Promise){if(a.async===!1)throw new si;return l.then(c=>o(c,r,a))}return o(l,r,a)}}nt(t,"~standard",()=>({validate:o=>{try{const s=QH(t,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return eW(t,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Eg=te("$ZodString",(t,e)=>{Et.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??OW(t._zod.bag),t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:t}),n}}),ht=te("$ZodStringFormat",(t,e)=>{zd.init(t,e),Eg.init(t,e)}),qW=te("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=gW),ht.init(t,e)}),UW=te("$ZodUUID",(t,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=G0(r))}else e.pattern??(e.pattern=G0());ht.init(t,e)}),KW=te("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=yW),ht.init(t,e)}),YW=te("$ZodURL",(t,e)=>{ht.init(t,e),t._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:n.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort})),e.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort})}}}),ZW=te("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=vW()),ht.init(t,e)}),GW=te("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=pW),ht.init(t,e)}),JW=te("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=cW),ht.init(t,e)}),XW=te("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=uW),ht.init(t,e)}),QW=te("$ZodULID",(t,e)=>{e.pattern??(e.pattern=dW),ht.init(t,e)}),eq=te("$ZodXID",(t,e)=>{e.pattern??(e.pattern=fW),ht.init(t,e)}),tq=te("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=hW),ht.init(t,e)}),nq=te("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=RW(e)),ht.init(t,e)}),rq=te("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=TW),ht.init(t,e)}),oq=te("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=MW(e)),ht.init(t,e)}),sq=te("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=mW),ht.init(t,e)}),iq=te("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=wW),ht.init(t,e),t._zod.bag.format="ipv4"}),aq=te("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=kW),ht.init(t,e),t._zod.bag.format="ipv6",t._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort})}}}),lq=te("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=xW),ht.init(t,e)}),cq=te("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=SW),ht.init(t,e),t._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,s]=r;if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort})}}});function cT(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const uq=te("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=EW),ht.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=n=>{cT(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function dq(t){if(!iT.test(t))return!1;const e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return cT(n)}const fq=te("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=iT),ht.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=n=>{dq(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),hq=te("$ZodE164",(t,e)=>{e.pattern??(e.pattern=CW),ht.init(t,e)});function pq(t,e=null){try{const n=t.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}const mq=te("$ZodJWT",(t,e)=>{ht.init(t,e),t._zod.check=n=>{pq(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),gq=te("$ZodUnknown",(t,e)=>{Et.init(t,e),t._zod.parse=n=>n}),yq=te("$ZodNever",(t,e)=>{Et.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)});function J0(t,e,n){t.issues.length&&e.issues.push(...Ks(n,t.issues)),e.value[n]=t.value}const bq=te("$ZodArray",(t,e)=>{Et.init(t,e),t._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),n;n.value=Array(o.length);const s=[];for(let i=0;i<o.length;i++){const a=o[i],l=e.element._zod.run({value:a,issues:[]},r);l instanceof Promise?s.push(l.then(c=>J0(c,n,i))):J0(l,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function Ku(t,e,n,r,o){if(t.issues.length){if(o&&!(n in r))return;e.issues.push(...Ks(n,t.issues))}t.value===void 0?n in r&&(e.value[n]=void 0):e.value[n]=t.value}function uT(t){const e=Object.keys(t.shape);for(const r of e)if(!t.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=HH(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}function dT(t,e,n,r,o,s){const i=[],a=o.keySet,l=o.catchall._zod,c=l.def.type,u=l.optout==="optional";for(const d in e){if(a.has(d))continue;if(c==="never"){i.push(d);continue}const f=l.run({value:e[d],issues:[]},r);f instanceof Promise?t.push(f.then(h=>Ku(h,n,d,e,u))):Ku(f,n,d,e,u)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:e,inst:s}),t.length?Promise.all(t).then(()=>n):n}const vq=te("$ZodObject",(t,e)=>{if(Et.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){const a=e.shape;Object.defineProperty(e,"shape",{get:()=>{const l={...a};return Object.defineProperty(e,"shape",{value:l}),l}})}const r=bg(()=>uT(e));nt(t._zod,"propValues",()=>{const a=e.shape,l={};for(const c in a){const u=a[c]._zod;if(u.values){l[c]??(l[c]=new Set);for(const d of u.values)l[c].add(d)}}return l});const o=Uu,s=e.catchall;let i;t._zod.parse=(a,l)=>{i??(i=r.value);const c=a.value;if(!o(c))return a.issues.push({expected:"object",code:"invalid_type",input:c,inst:t}),a;a.value={};const u=[],d=i.shape;for(const f of i.keys){const h=d[f],p=h._zod.optout==="optional",g=h._zod.run({value:c[f],issues:[]},l);g instanceof Promise?u.push(g.then(m=>Ku(m,a,f,c,p))):Ku(g,a,f,c,p)}return s?dT(u,c,a,l,r.value,t):u.length?Promise.all(u).then(()=>a):a}}),wq=te("$ZodObjectJIT",(t,e)=>{vq.init(t,e);const n=t._zod.parse,r=bg(()=>uT(e)),o=f=>{const h=new HW(["shape","payload","ctx"]),p=r.value,g=w=>{const k=Z0(w);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};h.write("const input = payload.value;");const m=Object.create(null);let y=0;for(const w of p.keys)m[w]=`key_${y++}`;h.write("const newResult = {};");for(const w of p.keys){const k=m[w],v=Z0(w),E=f[w]?._zod?.optout==="optional";h.write(`const ${k} = ${g(w)};`),E?h.write(`
|
|
292
|
-
if (${k}.issues.length) {
|
|
293
|
-
if (${v} in input) {
|
|
294
|
-
payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
|
|
295
|
-
...iss,
|
|
296
|
-
path: iss.path ? [${v}, ...iss.path] : [${v}]
|
|
297
|
-
})));
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
if (${k}.value === undefined) {
|
|
302
|
-
if (${v} in input) {
|
|
303
|
-
newResult[${v}] = undefined;
|
|
304
|
-
}
|
|
305
|
-
} else {
|
|
306
|
-
newResult[${v}] = ${k}.value;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
`):h.write(`
|
|
310
|
-
if (${k}.issues.length) {
|
|
311
|
-
payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
|
|
312
|
-
...iss,
|
|
313
|
-
path: iss.path ? [${v}, ...iss.path] : [${v}]
|
|
314
|
-
})));
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
if (${k}.value === undefined) {
|
|
318
|
-
if (${v} in input) {
|
|
319
|
-
newResult[${v}] = undefined;
|
|
320
|
-
}
|
|
321
|
-
} else {
|
|
322
|
-
newResult[${v}] = ${k}.value;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
`)}h.write("payload.value = newResult;"),h.write("return payload;");const b=h.compile();return(w,k)=>b(f,w,k)};let s;const i=Uu,a=!QC.jitless,c=a&&BH.value,u=e.catchall;let d;t._zod.parse=(f,h)=>{d??(d=r.value);const p=f.value;return i(p)?a&&c&&h?.async===!1&&h.jitless!==!0?(s||(s=o(e.shape)),f=s(f,h),u?dT([],p,f,h,d,t):f):n(f,h):(f.issues.push({expected:"object",code:"invalid_type",input:p,inst:t}),f)}});function X0(t,e,n,r){for(const s of t)if(s.issues.length===0)return e.value=s.value,e;const o=t.filter(s=>!Us(s));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(s=>s.issues.map(i=>bo(i,r,yo())))}),e)}const kq=te("$ZodUnion",(t,e)=>{Et.init(t,e),nt(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),nt(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),nt(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),nt(t._zod,"pattern",()=>{if(e.options.every(o=>o._zod.pattern)){const o=e.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>wg(s.source)).join("|")})$`)}});const n=e.options.length===1,r=e.options[0]._zod.run;t._zod.parse=(o,s)=>{if(n)return r(o,s);let i=!1;const a=[];for(const l of e.options){const c=l._zod.run({value:o.value,issues:[]},s);if(c instanceof Promise)a.push(c),i=!0;else{if(c.issues.length===0)return c;a.push(c)}}return i?Promise.all(a).then(l=>X0(l,o,t,s)):X0(a,o,t,s)}}),xq=te("$ZodIntersection",(t,e)=>{Et.init(t,e),t._zod.parse=(n,r)=>{const o=n.value,s=e.left._zod.run({value:o,issues:[]},r),i=e.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([l,c])=>Q0(n,l,c)):Q0(n,s,i)}});function ip(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Ei(t)&&Ei(e)){const n=Object.keys(e),r=Object.keys(t).filter(s=>n.indexOf(s)!==-1),o={...t,...e};for(const s of r){const i=ip(t[s],e[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<t.length;r++){const o=t[r],s=e[r],i=ip(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Q0(t,e,n){const r=new Map;let o;for(const a of e.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else t.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else t.issues.push(a);const s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&o&&t.issues.push({...o,keys:s}),Us(t))return t;const i=ip(e.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return t.value=i.data,t}const Sq=te("$ZodRecord",(t,e)=>{Et.init(t,e),t._zod.parse=(n,r)=>{const o=n.value;if(!Ei(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),n;const s=[],i=e.keyType._zod.values;if(i){n.value={};const a=new Set;for(const c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){a.add(typeof c=="number"?c.toString():c);const u=e.valueType._zod.run({value:o[c],issues:[]},r);u instanceof Promise?s.push(u.then(d=>{d.issues.length&&n.issues.push(...Ks(c,d.issues)),n.value[c]=d.value})):(u.issues.length&&n.issues.push(...Ks(c,u.issues)),n.value[c]=u.value)}let l;for(const c in o)a.has(c)||(l=l??[],l.push(c));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:l})}else{n.value={};for(const a of Reflect.ownKeys(o)){if(a==="__proto__")continue;let l=e.keyType._zod.run({value:a,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&_W.test(a)&&l.issues.length){const d=e.keyType._zod.run({value:Number(a),issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(l=d)}if(l.issues.length){e.mode==="loose"?n.value[a]=o[a]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(d=>bo(d,r,yo())),input:a,path:[a],inst:t});continue}const u=e.valueType._zod.run({value:o[a],issues:[]},r);u instanceof Promise?s.push(u.then(d=>{d.issues.length&&n.issues.push(...Ks(a,d.issues)),n.value[l.value]=d.value})):(u.issues.length&&n.issues.push(...Ks(a,u.issues)),n.value[l.value]=u.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Eq=te("$ZodEnum",(t,e)=>{Et.init(t,e);const n=eT(e.entries),r=new Set(n);t._zod.values=r,t._zod.pattern=new RegExp(`^(${n.filter(o=>VH.has(typeof o)).map(o=>typeof o=="string"?Ci(o):o.toString()).join("|")})$`),t._zod.parse=(o,s)=>{const i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:n,input:i,inst:t}),o}}),Cq=te("$ZodLiteral",(t,e)=>{if(Et.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(e.values);t._zod.values=n,t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Ci(r):r?Ci(r.toString()):String(r)).join("|")})$`),t._zod.parse=(r,o)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:e.values,input:s,inst:t}),r}}),Tq=te("$ZodTransform",(t,e)=>{Et.init(t,e),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new XC(t.constructor.name);const o=e.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(n.value=i,n));if(o instanceof Promise)throw new si;return n.value=o,n}});function ev(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}const fT=te("$ZodOptional",(t,e)=>{Et.init(t,e),t._zod.optin="optional",t._zod.optout="optional",nt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),nt(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${wg(n.source)})?$`):void 0}),t._zod.parse=(n,r)=>{if(e.innerType._zod.optin==="optional"){const o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>ev(s,n.value)):ev(o,n.value)}return n.value===void 0?n:e.innerType._zod.run(n,r)}}),Mq=te("$ZodExactOptional",(t,e)=>{fT.init(t,e),nt(t._zod,"values",()=>e.innerType._zod.values),nt(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(n,r)=>e.innerType._zod.run(n,r)}),Rq=te("$ZodNullable",(t,e)=>{Et.init(t,e),nt(t._zod,"optin",()=>e.innerType._zod.optin),nt(t._zod,"optout",()=>e.innerType._zod.optout),nt(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${wg(n.source)}|null)$`):void 0}),nt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(n,r)=>n.value===null?n:e.innerType._zod.run(n,r)}),Oq=te("$ZodDefault",(t,e)=>{Et.init(t,e),t._zod.optin="optional",nt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);if(n.value===void 0)return n.value=e.defaultValue,n;const o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>tv(s,e)):tv(o,e)}});function tv(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const _q=te("$ZodPrefault",(t,e)=>{Et.init(t,e),t._zod.optin="optional",nt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=e.defaultValue),e.innerType._zod.run(n,r))}),Nq=te("$ZodNonOptional",(t,e)=>{Et.init(t,e),nt(t._zod,"values",()=>{const n=e.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),t._zod.parse=(n,r)=>{const o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>nv(s,t)):nv(o,t)}});function nv(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const Pq=te("$ZodCatch",(t,e)=>{Et.init(t,e),nt(t._zod,"optin",()=>e.innerType._zod.optin),nt(t._zod,"optout",()=>e.innerType._zod.optout),nt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=e.catchValue({...n,error:{issues:s.issues.map(i=>bo(i,r,yo()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=e.catchValue({...n,error:{issues:o.issues.map(s=>bo(s,r,yo()))},input:n.value}),n.issues=[]),n)}}),Aq=te("$ZodPipe",(t,e)=>{Et.init(t,e),nt(t._zod,"values",()=>e.in._zod.values),nt(t._zod,"optin",()=>e.in._zod.optin),nt(t._zod,"optout",()=>e.out._zod.optout),nt(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=e.out._zod.run(n,r);return s instanceof Promise?s.then(i=>zl(i,e.in,r)):zl(s,e.in,r)}const o=e.in._zod.run(n,r);return o instanceof Promise?o.then(s=>zl(s,e.out,r)):zl(o,e.out,r)}});function zl(t,e,n){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},n)}const Iq=te("$ZodReadonly",(t,e)=>{Et.init(t,e),nt(t._zod,"propValues",()=>e.innerType._zod.propValues),nt(t._zod,"values",()=>e.innerType._zod.values),nt(t._zod,"optin",()=>e.innerType?._zod?.optin),nt(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(rv):rv(o)}});function rv(t){return t.value=Object.freeze(t.value),t}const $q=te("$ZodCustom",(t,e)=>{pr.init(t,e),Et.init(t,e),t._zod.parse=(n,r)=>n,t._zod.check=n=>{const r=n.value,o=e.fn(r);if(o instanceof Promise)return o.then(s=>ov(s,n,r,t));ov(o,n,r,t)}});function ov(t,e,n,r){if(!t){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),e.issues.push(Ba(o))}}var sv;class Dq{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){const r=n[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const n=this._map.get(e);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){const n=e._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function zq(){return new Dq}(sv=globalThis).__zod_globalRegistry??(sv.__zod_globalRegistry=zq());const oa=globalThis.__zod_globalRegistry;function Lq(t,e){return new t({type:"string",...Oe(e)})}function jq(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Oe(e)})}function iv(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Oe(e)})}function Fq(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Oe(e)})}function Bq(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Oe(e)})}function Vq(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Oe(e)})}function Hq(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Oe(e)})}function Wq(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Oe(e)})}function qq(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Oe(e)})}function Uq(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Oe(e)})}function Kq(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Oe(e)})}function Yq(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Oe(e)})}function Zq(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Oe(e)})}function Gq(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Oe(e)})}function Jq(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Oe(e)})}function Xq(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Oe(e)})}function Qq(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Oe(e)})}function eU(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Oe(e)})}function tU(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Oe(e)})}function nU(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Oe(e)})}function rU(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Oe(e)})}function oU(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Oe(e)})}function sU(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Oe(e)})}function iU(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Oe(e)})}function aU(t,e){return new t({type:"string",format:"date",check:"string_format",...Oe(e)})}function lU(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...Oe(e)})}function cU(t,e){return new t({type:"string",format:"duration",check:"string_format",...Oe(e)})}function uU(t){return new t({type:"unknown"})}function dU(t,e){return new t({type:"never",...Oe(e)})}function hT(t,e){return new AW({check:"max_length",...Oe(e),maximum:t})}function Yu(t,e){return new IW({check:"min_length",...Oe(e),minimum:t})}function pT(t,e){return new $W({check:"length_equals",...Oe(e),length:t})}function fU(t,e){return new DW({check:"string_format",format:"regex",...Oe(e),pattern:t})}function hU(t){return new zW({check:"string_format",format:"lowercase",...Oe(t)})}function pU(t){return new LW({check:"string_format",format:"uppercase",...Oe(t)})}function mU(t,e){return new jW({check:"string_format",format:"includes",...Oe(e),includes:t})}function gU(t,e){return new FW({check:"string_format",format:"starts_with",...Oe(e),prefix:t})}function yU(t,e){return new BW({check:"string_format",format:"ends_with",...Oe(e),suffix:t})}function $i(t){return new VW({check:"overwrite",tx:t})}function bU(t){return $i(e=>e.normalize(t))}function vU(){return $i(t=>t.trim())}function wU(){return $i(t=>t.toLowerCase())}function kU(){return $i(t=>t.toUpperCase())}function xU(){return $i(t=>FH(t))}function SU(t,e,n){return new t({type:"array",element:e,...Oe(n)})}function EU(t,e,n){return new t({type:"custom",check:"custom",fn:e,...Oe(n)})}function CU(t){const e=TU(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Ba(r,n.value,e._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),n.issues.push(Ba(o))}},t(n.value,n)));return e}function TU(t,e){const n=new pr({check:"custom",...Oe(e)});return n._zod.check=t,n}function mT(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??oa,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function Rt(t,e,n={path:[],schemaPath:[]}){var r;const o=t._zod.def,s=e.seen.get(t);if(s)return s.count++,n.schemaPath.includes(t)&&(s.cycle=n.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};e.seen.set(t,i);const a=t._zod.toJSONSchema?.();if(a)i.schema=a;else{const u={...n,schemaPath:[...n.schemaPath,t],path:n.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,i.schema,u);else{const f=i.schema,h=e.processors[o.type];if(!h)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);h(t,e,f,u)}const d=t._zod.parent;d&&(i.ref||(i.ref=d),Rt(d,e,u),e.seen.get(d).isParent=!0)}const l=e.metadataRegistry.get(t);return l&&Object.assign(i.schema,l),e.io==="input"&&en(t)&&(delete i.schema.examples,delete i.schema.default),e.io==="input"&&i.schema._prefault&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,e.seen.get(t).schema}function gT(t,e){const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const i of t.seen.entries()){const a=t.metadataRegistry.get(i[0])?.id;if(a){const l=r.get(a);if(l&&l!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,i[0])}}const o=i=>{const a=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const d=t.external.registry.get(i[0])?.id,f=t.external.uri??(p=>p);if(d)return{ref:f(d)};const h=i[1].defId??i[1].schema.id??`schema${t.counter++}`;return i[1].defId=h,{defId:h,ref:`${f("__shared")}#/${a}/${h}`}}if(i[1]===n)return{ref:"#"};const c=`#/${a}/`,u=i[1].schema.id??`__schema${t.counter++}`;return{defId:u,ref:c+u}},s=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:l,defId:c}=o(i);a.def={...a.schema},c&&(a.defId=c);const u=a.schema;for(const d in u)delete u[d];u.$ref=l};if(t.cycles==="throw")for(const i of t.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
326
|
-
|
|
327
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of t.seen.entries()){const a=i[1];if(e===i[0]){s(i);continue}if(t.external){const c=t.external.registry.get(i[0])?.id;if(e!==i[0]&&c){s(i);continue}}if(t.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&t.reused==="ref"){s(i);continue}}}function yT(t,e){const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=i=>{const a=t.seen.get(i);if(a.ref===null)return;const l=a.def??a.schema,c={...l},u=a.ref;if(a.ref=null,u){r(u);const f=t.seen.get(u),h=f.schema;if(h.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(h)):Object.assign(l,h),Object.assign(l,c),i._zod.parent===u)for(const g in l)g==="$ref"||g==="allOf"||g in c||delete l[g];if(h.$ref&&f.def)for(const g in l)g==="$ref"||g==="allOf"||g in f.def&&JSON.stringify(l[g])===JSON.stringify(f.def[g])&&delete l[g]}const d=i._zod.parent;if(d&&d!==u){r(d);const f=t.seen.get(d);if(f?.schema.$ref&&(l.$ref=f.schema.$ref,f.def))for(const h in l)h==="$ref"||h==="allOf"||h in f.def&&JSON.stringify(l[h])===JSON.stringify(f.def[h])&&delete l[h]}t.override({zodSchema:i,jsonSchema:l,path:a.path??[]})};for(const i of[...t.seen.entries()].reverse())r(i[0]);const o={};if(t.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){const i=t.external.registry.get(e)?.id;if(!i)throw new Error("Schema is missing an `id` property");o.$id=t.external.uri(i)}Object.assign(o,n.def??n.schema);const s=t.external?.defs??{};for(const i of t.seen.entries()){const a=i[1];a.def&&a.defId&&(s[a.defId]=a.def)}t.external||Object.keys(s).length>0&&(t.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const i=JSON.parse(JSON.stringify(o));return Object.defineProperty(i,"~standard",{value:{...e["~standard"],jsonSchema:{input:Zu(e,"input",t.processors),output:Zu(e,"output",t.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function en(t,e){const n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);const r=t._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return en(r.element,n);if(r.type==="set")return en(r.valueType,n);if(r.type==="lazy")return en(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return en(r.innerType,n);if(r.type==="intersection")return en(r.left,n)||en(r.right,n);if(r.type==="record"||r.type==="map")return en(r.keyType,n)||en(r.valueType,n);if(r.type==="pipe")return en(r.in,n)||en(r.out,n);if(r.type==="object"){for(const o in r.shape)if(en(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(en(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(en(o,n))return!0;return!!(r.rest&&en(r.rest,n))}return!1}const MU=(t,e={})=>n=>{const r=mT({...n,processors:e});return Rt(t,r),gT(r,t),yT(r,t)},Zu=(t,e,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=mT({...o??{},target:s,io:e,processors:n});return Rt(t,i),gT(i,t),yT(i,t)},RU={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},OU=(t,e,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:i,format:a,patterns:l,contentEncoding:c}=t._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=RU[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),c&&(o.contentEncoding=c),l&&l.size>0){const u=[...l];u.length===1?o.pattern=u[0].source:u.length>1&&(o.allOf=[...u.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},_U=(t,e,n,r)=>{n.not={}},NU=(t,e,n,r)=>{},PU=(t,e,n,r)=>{const o=t._zod.def,s=eT(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},AU=(t,e,n,r)=>{const o=t._zod.def,s=[];for(const i of o.values)if(i===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){const i=s[0];n.type=i===null?"null":typeof i,e.target==="draft-04"||e.target==="openapi-3.0"?n.enum=[i]:n.const=i}else s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),s.every(i=>typeof i=="boolean")&&(n.type="boolean"),s.every(i=>i===null)&&(n.type="null"),n.enum=s},IU=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},$U=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},DU=(t,e,n,r)=>{const o=n,s=t._zod.def,{minimum:i,maximum:a}=t._zod.bag;typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=Rt(s.element,e,{...r,path:[...r.path,"items"]})},zU=(t,e,n,r)=>{const o=n,s=t._zod.def;o.type="object",o.properties={};const i=s.shape;for(const c in i)o.properties[c]=Rt(i[c],e,{...r,path:[...r.path,"properties",c]});const a=new Set(Object.keys(i)),l=new Set([...a].filter(c=>{const u=s.shape[c]._zod;return e.io==="input"?u.optin===void 0:u.optout===void 0}));l.size>0&&(o.required=Array.from(l)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=Rt(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(o.additionalProperties=!1)},LU=(t,e,n,r)=>{const o=t._zod.def,s=o.inclusive===!1,i=o.options.map((a,l)=>Rt(a,e,{...r,path:[...r.path,s?"oneOf":"anyOf",l]}));s?n.oneOf=i:n.anyOf=i},jU=(t,e,n,r)=>{const o=t._zod.def,s=Rt(o.left,e,{...r,path:[...r.path,"allOf",0]}),i=Rt(o.right,e,{...r,path:[...r.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,l=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];n.allOf=l},FU=(t,e,n,r)=>{const o=n,s=t._zod.def;o.type="object";const i=s.keyType,l=i._zod.bag?.patterns;if(s.mode==="loose"&&l&&l.size>0){const u=Rt(s.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const d of l)o.patternProperties[d.source]=u}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(o.propertyNames=Rt(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Rt(s.valueType,e,{...r,path:[...r.path,"additionalProperties"]});const c=i._zod.values;if(c){const u=[...c].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(o.required=u)}},BU=(t,e,n,r)=>{const o=t._zod.def,s=Rt(o.innerType,e,r),i=e.seen.get(t);e.target==="openapi-3.0"?(i.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},VU=(t,e,n,r)=>{const o=t._zod.def;Rt(o.innerType,e,r);const s=e.seen.get(t);s.ref=o.innerType},HU=(t,e,n,r)=>{const o=t._zod.def;Rt(o.innerType,e,r);const s=e.seen.get(t);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},WU=(t,e,n,r)=>{const o=t._zod.def;Rt(o.innerType,e,r);const s=e.seen.get(t);s.ref=o.innerType,e.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},qU=(t,e,n,r)=>{const o=t._zod.def;Rt(o.innerType,e,r);const s=e.seen.get(t);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},UU=(t,e,n,r)=>{const o=t._zod.def,s=e.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Rt(s,e,r);const i=e.seen.get(t);i.ref=s},KU=(t,e,n,r)=>{const o=t._zod.def;Rt(o.innerType,e,r);const s=e.seen.get(t);s.ref=o.innerType,n.readOnly=!0},bT=(t,e,n,r)=>{const o=t._zod.def;Rt(o.innerType,e,r);const s=e.seen.get(t);s.ref=o.innerType},YU=te("ZodISODateTime",(t,e)=>{nq.init(t,e),bt.init(t,e)});function ZU(t){return iU(YU,t)}const GU=te("ZodISODate",(t,e)=>{rq.init(t,e),bt.init(t,e)});function JU(t){return aU(GU,t)}const XU=te("ZodISOTime",(t,e)=>{oq.init(t,e),bt.init(t,e)});function QU(t){return lU(XU,t)}const e9=te("ZodISODuration",(t,e)=>{sq.init(t,e),bt.init(t,e)});function t9(t){return cU(e9,t)}const n9=(t,e)=>{oT.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>XH(t,n)},flatten:{value:n=>JH(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,sp,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,sp,2)}},isEmpty:{get(){return t.issues.length===0}}})},zn=te("ZodError",n9,{Parent:Error}),r9=xg(zn),o9=Sg(zn),s9=$d(zn),i9=Dd(zn),a9=tW(zn),l9=nW(zn),c9=rW(zn),u9=oW(zn),d9=sW(zn),f9=iW(zn),h9=aW(zn),p9=lW(zn),Ct=te("ZodType",(t,e)=>(Et.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:Zu(t,"input"),output:Zu(t,"output")}}),t.toJSONSchema=MU(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...n)=>t.clone(No(e,{checks:[...e.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),t.with=t.check,t.clone=(n,r)=>Po(t,n,r),t.brand=()=>t,t.register=((n,r)=>(n.add(t,r),t)),t.parse=(n,r)=>r9(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>s9(t,n,r),t.parseAsync=async(n,r)=>o9(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>i9(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>a9(t,n,r),t.decode=(n,r)=>l9(t,n,r),t.encodeAsync=async(n,r)=>c9(t,n,r),t.decodeAsync=async(n,r)=>u9(t,n,r),t.safeEncode=(n,r)=>d9(t,n,r),t.safeDecode=(n,r)=>f9(t,n,r),t.safeEncodeAsync=async(n,r)=>h9(t,n,r),t.safeDecodeAsync=async(n,r)=>p9(t,n,r),t.refine=(n,r)=>t.check(c6(n,r)),t.superRefine=n=>t.check(u6(n)),t.overwrite=n=>t.check($i(n)),t.optional=()=>lv(t),t.exactOptional=()=>G9(t),t.nullable=()=>cv(t),t.nullish=()=>lv(cv(t)),t.nonoptional=n=>n6(t,n),t.array=()=>Va(t),t.or=n=>j9([t,n]),t.and=n=>B9(t,n),t.transform=n=>uv(t,Y9(n)),t.default=n=>Q9(t,n),t.prefault=n=>t6(t,n),t.catch=n=>o6(t,n),t.pipe=n=>uv(t,n),t.readonly=()=>a6(t),t.describe=n=>{const r=t.clone();return oa.add(r,{description:n}),r},Object.defineProperty(t,"description",{get(){return oa.get(t)?.description},configurable:!0}),t.meta=(...n)=>{if(n.length===0)return oa.get(t);const r=t.clone();return oa.add(r,n[0]),r},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=n=>n(t),t)),vT=te("_ZodString",(t,e)=>{Eg.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(r,o,s)=>OU(t,r,o);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,t.regex=(...r)=>t.check(fU(...r)),t.includes=(...r)=>t.check(mU(...r)),t.startsWith=(...r)=>t.check(gU(...r)),t.endsWith=(...r)=>t.check(yU(...r)),t.min=(...r)=>t.check(Yu(...r)),t.max=(...r)=>t.check(hT(...r)),t.length=(...r)=>t.check(pT(...r)),t.nonempty=(...r)=>t.check(Yu(1,...r)),t.lowercase=r=>t.check(hU(r)),t.uppercase=r=>t.check(pU(r)),t.trim=()=>t.check(vU()),t.normalize=(...r)=>t.check(bU(...r)),t.toLowerCase=()=>t.check(wU()),t.toUpperCase=()=>t.check(kU()),t.slugify=()=>t.check(xU())}),m9=te("ZodString",(t,e)=>{Eg.init(t,e),vT.init(t,e),t.email=n=>t.check(jq(g9,n)),t.url=n=>t.check(Wq(y9,n)),t.jwt=n=>t.check(sU(P9,n)),t.emoji=n=>t.check(qq(b9,n)),t.guid=n=>t.check(iv(av,n)),t.uuid=n=>t.check(Fq(Ll,n)),t.uuidv4=n=>t.check(Bq(Ll,n)),t.uuidv6=n=>t.check(Vq(Ll,n)),t.uuidv7=n=>t.check(Hq(Ll,n)),t.nanoid=n=>t.check(Uq(v9,n)),t.guid=n=>t.check(iv(av,n)),t.cuid=n=>t.check(Kq(w9,n)),t.cuid2=n=>t.check(Yq(k9,n)),t.ulid=n=>t.check(Zq(x9,n)),t.base64=n=>t.check(nU(O9,n)),t.base64url=n=>t.check(rU(_9,n)),t.xid=n=>t.check(Gq(S9,n)),t.ksuid=n=>t.check(Jq(E9,n)),t.ipv4=n=>t.check(Xq(C9,n)),t.ipv6=n=>t.check(Qq(T9,n)),t.cidrv4=n=>t.check(eU(M9,n)),t.cidrv6=n=>t.check(tU(R9,n)),t.e164=n=>t.check(oU(N9,n)),t.datetime=n=>t.check(ZU(n)),t.date=n=>t.check(JU(n)),t.time=n=>t.check(QU(n)),t.duration=n=>t.check(t9(n))});function ii(t){return Lq(m9,t)}const bt=te("ZodStringFormat",(t,e)=>{ht.init(t,e),vT.init(t,e)}),g9=te("ZodEmail",(t,e)=>{KW.init(t,e),bt.init(t,e)}),av=te("ZodGUID",(t,e)=>{qW.init(t,e),bt.init(t,e)}),Ll=te("ZodUUID",(t,e)=>{UW.init(t,e),bt.init(t,e)}),y9=te("ZodURL",(t,e)=>{YW.init(t,e),bt.init(t,e)}),b9=te("ZodEmoji",(t,e)=>{ZW.init(t,e),bt.init(t,e)}),v9=te("ZodNanoID",(t,e)=>{GW.init(t,e),bt.init(t,e)}),w9=te("ZodCUID",(t,e)=>{JW.init(t,e),bt.init(t,e)}),k9=te("ZodCUID2",(t,e)=>{XW.init(t,e),bt.init(t,e)}),x9=te("ZodULID",(t,e)=>{QW.init(t,e),bt.init(t,e)}),S9=te("ZodXID",(t,e)=>{eq.init(t,e),bt.init(t,e)}),E9=te("ZodKSUID",(t,e)=>{tq.init(t,e),bt.init(t,e)}),C9=te("ZodIPv4",(t,e)=>{iq.init(t,e),bt.init(t,e)}),T9=te("ZodIPv6",(t,e)=>{aq.init(t,e),bt.init(t,e)}),M9=te("ZodCIDRv4",(t,e)=>{lq.init(t,e),bt.init(t,e)}),R9=te("ZodCIDRv6",(t,e)=>{cq.init(t,e),bt.init(t,e)}),O9=te("ZodBase64",(t,e)=>{uq.init(t,e),bt.init(t,e)}),_9=te("ZodBase64URL",(t,e)=>{fq.init(t,e),bt.init(t,e)}),N9=te("ZodE164",(t,e)=>{hq.init(t,e),bt.init(t,e)}),P9=te("ZodJWT",(t,e)=>{mq.init(t,e),bt.init(t,e)}),A9=te("ZodUnknown",(t,e)=>{gq.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(n,r,o)=>NU()});function ap(){return uU(A9)}const I9=te("ZodNever",(t,e)=>{yq.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(n,r,o)=>_U(t,n,r)});function $9(t){return dU(I9,t)}const D9=te("ZodArray",(t,e)=>{bq.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(n,r,o)=>DU(t,n,r,o),t.element=e.element,t.min=(n,r)=>t.check(Yu(n,r)),t.nonempty=n=>t.check(Yu(1,n)),t.max=(n,r)=>t.check(hT(n,r)),t.length=(n,r)=>t.check(pT(n,r)),t.unwrap=()=>t.element});function Va(t,e){return SU(D9,t,e)}const z9=te("ZodObject",(t,e)=>{wq.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(n,r,o)=>zU(t,n,r,o),nt(t,"shape",()=>e.shape),t.keyof=()=>W9(Object.keys(t._zod.def.shape)),t.catchall=n=>t.clone({...t._zod.def,catchall:n}),t.passthrough=()=>t.clone({...t._zod.def,catchall:ap()}),t.loose=()=>t.clone({...t._zod.def,catchall:ap()}),t.strict=()=>t.clone({...t._zod.def,catchall:$9()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=n=>UH(t,n),t.safeExtend=n=>KH(t,n),t.merge=n=>YH(t,n),t.pick=n=>WH(t,n),t.omit=n=>qH(t,n),t.partial=(...n)=>ZH(kT,t,n[0]),t.required=(...n)=>GH(xT,t,n[0])});function wT(t,e){const n={type:"object",shape:t??{},...Oe(e)};return new z9(n)}const L9=te("ZodUnion",(t,e)=>{kq.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(n,r,o)=>LU(t,n,r,o),t.options=e.options});function j9(t,e){return new L9({type:"union",options:t,...Oe(e)})}const F9=te("ZodIntersection",(t,e)=>{xq.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(n,r,o)=>jU(t,n,r,o)});function B9(t,e){return new F9({type:"intersection",left:t,right:e})}const V9=te("ZodRecord",(t,e)=>{Sq.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(n,r,o)=>FU(t,n,r,o),t.keyType=e.keyType,t.valueType=e.valueType});function H9(t,e,n){return new V9({type:"record",keyType:t,valueType:e,...Oe(n)})}const lp=te("ZodEnum",(t,e)=>{Eq.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(r,o,s)=>PU(t,r,o),t.enum=e.entries,t.options=Object.values(e.entries);const n=new Set(Object.keys(e.entries));t.extract=(r,o)=>{const s={};for(const i of r)if(n.has(i))s[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new lp({...e,checks:[],...Oe(o),entries:s})},t.exclude=(r,o)=>{const s={...e.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new lp({...e,checks:[],...Oe(o),entries:s})}});function W9(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new lp({type:"enum",entries:n,...Oe(e)})}const q9=te("ZodLiteral",(t,e)=>{Cq.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(n,r,o)=>AU(t,n,r),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function U9(t,e){return new q9({type:"literal",values:Array.isArray(t)?t:[t],...Oe(e)})}const K9=te("ZodTransform",(t,e)=>{Tq.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(n,r,o)=>$U(t,n),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new XC(t.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Ba(s,n.value,e));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=t),n.issues.push(Ba(i))}};const o=e.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function Y9(t){return new K9({type:"transform",transform:t})}const kT=te("ZodOptional",(t,e)=>{fT.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(n,r,o)=>bT(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function lv(t){return new kT({type:"optional",innerType:t})}const Z9=te("ZodExactOptional",(t,e)=>{Mq.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(n,r,o)=>bT(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function G9(t){return new Z9({type:"optional",innerType:t})}const J9=te("ZodNullable",(t,e)=>{Rq.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(n,r,o)=>BU(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function cv(t){return new J9({type:"nullable",innerType:t})}const X9=te("ZodDefault",(t,e)=>{Oq.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(n,r,o)=>HU(t,n,r,o),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Q9(t,e){return new X9({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():nT(e)}})}const e6=te("ZodPrefault",(t,e)=>{_q.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(n,r,o)=>WU(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function t6(t,e){return new e6({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():nT(e)}})}const xT=te("ZodNonOptional",(t,e)=>{Nq.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(n,r,o)=>VU(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function n6(t,e){return new xT({type:"nonoptional",innerType:t,...Oe(e)})}const r6=te("ZodCatch",(t,e)=>{Pq.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(n,r,o)=>qU(t,n,r,o),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function o6(t,e){return new r6({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const s6=te("ZodPipe",(t,e)=>{Aq.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(n,r,o)=>UU(t,n,r,o),t.in=e.in,t.out=e.out});function uv(t,e){return new s6({type:"pipe",in:t,out:e})}const i6=te("ZodReadonly",(t,e)=>{Iq.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(n,r,o)=>KU(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function a6(t){return new i6({type:"readonly",innerType:t})}const l6=te("ZodCustom",(t,e)=>{$q.init(t,e),Ct.init(t,e),t._zod.processJSONSchema=(n,r,o)=>IU(t,n)});function c6(t,e={}){return EU(l6,t,e)}function u6(t){return CU(t)}const Gu=H9(ii(),ap()),d6=wT({type:U9("object"),properties:Gu,required:Va(ii()).optional()}).passthrough(),f6=wT({type:ii().optional(),format:ii().optional(),enum:Va(ii()).optional(),anyOf:Va(Gu).optional(),items:Gu.optional()}).passthrough(),dv="#/definitions/";function h6(t){const e=Gu.safeParse(t);return e.success?e.data:void 0}function Cg(t){const e=f6.safeParse(t);return e.success?e.data:void 0}function fv(t){const e=d6.safeParse(t);return e.success?e.data:void 0}function ST(t){return t.type!=="array"?!1:Cg(t.items)?.type==="string"}function p6(t){if(!t.anyOf||t.anyOf.length===0)return!1;let e=!1;for(const n of t.anyOf){const r=Cg(n);if(!r)return!1;if(r.type==="string"&&(r.format==="date"||r.format==="date-time")){e=!0;continue}if((r.type==="integer"||r.type==="number")&&r.format==="unix-time"){e=!0;continue}if(r.type!=="null")return!1}return e}function m6(t){const e=Va(ii()).safeParse(t);return new Set(e.success?e.data:[])}function g6(t){const e=t.fieldUi?.[t.key];if(e){if(e.kind==="image"&&t.property.type==="string")return{kind:"image",key:t.key,required:t.required,sourceMode:e.mode};if(e.kind==="imageArray"&&ST(t.property))return{kind:"imageArray",key:t.key,required:t.required,sourceMode:e.mode};if(e.kind==="color"&&t.property.type==="string")return{kind:"color",key:t.key,required:t.required}}}function ET(t){if(!t)return;const e=fv(t);if(e)return e;const n=typeof t.$ref=="string"?t.$ref:void 0;if(!n?.startsWith(dv))return;const r=n.slice(dv.length),o=h6(t.definitions),s=o?o[r]:void 0;return fv(s)}function CT(t,e){const n=m6(t.required),r=[];for(const[o,s]of Object.entries(t.properties)){if(o==="$schema")continue;const i=Cg(s),a=n.has(o);if(!i){r.push({kind:"unsupported",key:o,required:a,reason:"invalid schema node"});continue}const l=g6({key:o,property:i,required:a,fieldUi:e});if(l){r.push(l);continue}if(p6(i)){r.push({kind:"dateAnyOf",key:o,required:a});continue}if(i.type==="string"&&(i.format==="date"||i.format==="date-time")){r.push({kind:"dateAnyOf",key:o,required:a});continue}if((i.type==="number"||i.type==="integer")&&i.format==="unix-time"){r.push({kind:"dateAnyOf",key:o,required:a});continue}const c=i.enum;if(c&&c.length>0){r.push({kind:"enum",key:o,required:a,options:c});continue}if(i.type==="string"){r.push({kind:"string",key:o,required:a});continue}if(i.type==="boolean"){r.push({kind:"boolean",key:o,required:a});continue}if(i.type==="number"||i.type==="integer"){r.push({kind:"number",key:o,required:a});continue}if(ST(i)){r.push({kind:"stringArray",key:o,required:a});continue}if(i.type==="array"){r.push({kind:"unsupported",key:o,required:a,reason:"array items are not string"});continue}r.push({kind:"unsupported",key:o,required:a,reason:"schema type not supported"})}return r}function TT(t){return JSON.parse(JSON.stringify(t))}function y6(t){return Array.isArray(t)&&t.every(e=>typeof e=="string")}function b6(t,e){switch(t.kind){case"string":case"image":case"color":return typeof e=="string";case"number":return typeof e=="number"&&Number.isFinite(e);case"boolean":return typeof e=="boolean";case"enum":return typeof e=="string"&&t.options.includes(e);case"stringArray":case"imageArray":return y6(e);case"dateAnyOf":return typeof e=="string"||typeof e=="number"&&Number.isFinite(e)||e===null;case"unsupported":return!1;default:return!1}}function cp(t){switch(t){case"schema_unavailable":return"schema unavailable";case"not_in_schema":return"not in schema";case"unsupported_field":return"unsupported field type";case"incompatible_type":return"incompatible value type";default:return"not applied"}}function v6(t){const e=Object.keys(t.revisionFrontmatter),n=cp(t.reason),r=Object.fromEntries(e.map(o=>[o,n]));return{nextDraft:TT(t.currentDraft),appliedKeys:[],skippedKeys:e,reasonBySkippedKey:r}}function w6(t){const e=ET(t.schema);if(!e)return v6({currentDraft:t.currentDraft,revisionFrontmatter:t.revisionFrontmatter,reason:"schema_unavailable"});const n=CT(e,t.fieldUi),r=new Map,o=new Map;for(const c of n)r.set(c.key,c),c.kind!=="unsupported"&&o.set(c.key,c);const s=TT(t.currentDraft),i=[],a=[],l={};for(const[c,u]of Object.entries(t.revisionFrontmatter)){const d=o.get(c);if(!d){a.push(c);const f=r.has(c)?"unsupported_field":"not_in_schema";l[c]=cp(f);continue}if(!b6(d,u)){a.push(c),l[c]=cp("incompatible_type");continue}s[c]=Array.isArray(u)?[...u]:u,i.push(c)}return{nextDraft:s,appliedKeys:i,skippedKeys:a,reasonBySkippedKey:l}}var jl={exports:{}},Wf={},kr={},jo={},qf={},Uf={},Kf={},hv;function Ju(){return hv||(hv=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class e{}t._CodeOrName=e,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends e{constructor(b){if(super(),!t.IDENTIFIER.test(b))throw new Error("CodeGen: name must be a valid identifier");this.str=b}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=n;class r extends e{constructor(b){super(),this._items=typeof b=="string"?[b]:b}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const b=this._items[0];return b===""||b==='""'}get str(){var b;return(b=this._str)!==null&&b!==void 0?b:this._str=this._items.reduce((w,k)=>`${w}${k}`,"")}get names(){var b;return(b=this._names)!==null&&b!==void 0?b:this._names=this._items.reduce((w,k)=>(k instanceof n&&(w[k.str]=(w[k.str]||0)+1),w),{})}}t._Code=r,t.nil=new r("");function o(y,...b){const w=[y[0]];let k=0;for(;k<b.length;)a(w,b[k]),w.push(y[++k]);return new r(w)}t._=o;const s=new r("+");function i(y,...b){const w=[h(y[0])];let k=0;for(;k<b.length;)w.push(s),a(w,b[k]),w.push(s,h(y[++k]));return l(w),new r(w)}t.str=i;function a(y,b){b instanceof r?y.push(...b._items):b instanceof n?y.push(b):y.push(d(b))}t.addCodeArg=a;function l(y){let b=1;for(;b<y.length-1;){if(y[b]===s){const w=c(y[b-1],y[b+1]);if(w!==void 0){y.splice(b-1,3,w);continue}y[b++]="+"}b++}}function c(y,b){if(b==='""')return y;if(y==='""')return b;if(typeof y=="string")return b instanceof n||y[y.length-1]!=='"'?void 0:typeof b!="string"?`${y.slice(0,-1)}${b}"`:b[0]==='"'?y.slice(0,-1)+b.slice(1):void 0;if(typeof b=="string"&&b[0]==='"'&&!(y instanceof n))return`"${y}${b.slice(1)}`}function u(y,b){return b.emptyStr()?y:y.emptyStr()?b:i`${y}${b}`}t.strConcat=u;function d(y){return typeof y=="number"||typeof y=="boolean"||y===null?y:h(Array.isArray(y)?y.join(","):y)}function f(y){return new r(h(y))}t.stringify=f;function h(y){return JSON.stringify(y).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=h;function p(y){return typeof y=="string"&&t.IDENTIFIER.test(y)?new r(`.${y}`):o`[${y}]`}t.getProperty=p;function g(y){if(typeof y=="string"&&t.IDENTIFIER.test(y))return new r(`${y}`);throw new Error(`CodeGen: invalid export name: ${y}, use explicit $id name mapping`)}t.getEsmExportName=g;function m(y){return new r(y.toString())}t.regexpCode=m})(Kf)),Kf}var Yf={},pv;function mv(){return pv||(pv=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=Ju();class n extends Error{constructor(c){super(`CodeGen: "code" for ${c} not defined`),this.value=c.value}}var r;(function(l){l[l.Started=0]="Started",l[l.Completed=1]="Completed"})(r||(t.UsedValueState=r={})),t.varKinds={const:new e.Name("const"),let:new e.Name("let"),var:new e.Name("var")};class o{constructor({prefixes:c,parent:u}={}){this._names={},this._prefixes=c,this._parent=u}toName(c){return c instanceof e.Name?c:this.name(c)}name(c){return new e.Name(this._newName(c))}_newName(c){const u=this._names[c]||this._nameGroup(c);return`${c}${u.index++}`}_nameGroup(c){var u,d;if(!((d=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||d===void 0)&&d.has(c)||this._prefixes&&!this._prefixes.has(c))throw new Error(`CodeGen: prefix "${c}" is not allowed in this scope`);return this._names[c]={prefix:c,index:0}}}t.Scope=o;class s extends e.Name{constructor(c,u){super(u),this.prefix=c}setValue(c,{property:u,itemIndex:d}){this.value=c,this.scopePath=(0,e._)`.${new e.Name(u)}[${d}]`}}t.ValueScopeName=s;const i=(0,e._)`\n`;class a extends o{constructor(c){super(c),this._values={},this._scope=c.scope,this.opts={...c,_n:c.lines?i:e.nil}}get(){return this._scope}name(c){return new s(c,this._newName(c))}value(c,u){var d;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const f=this.toName(c),{prefix:h}=f,p=(d=u.key)!==null&&d!==void 0?d:u.ref;let g=this._values[h];if(g){const b=g.get(p);if(b)return b}else g=this._values[h]=new Map;g.set(p,f);const m=this._scope[h]||(this._scope[h]=[]),y=m.length;return m[y]=u.ref,f.setValue(u,{property:h,itemIndex:y}),f}getValue(c,u){const d=this._values[c];if(d)return d.get(u)}scopeRefs(c,u=this._values){return this._reduceValues(u,d=>{if(d.scopePath===void 0)throw new Error(`CodeGen: name "${d}" has no value`);return(0,e._)`${c}${d.scopePath}`})}scopeCode(c=this._values,u,d){return this._reduceValues(c,f=>{if(f.value===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return f.value.code},u,d)}_reduceValues(c,u,d={},f){let h=e.nil;for(const p in c){const g=c[p];if(!g)continue;const m=d[p]=d[p]||new Map;g.forEach(y=>{if(m.has(y))return;m.set(y,r.Started);let b=u(y);if(b){const w=this.opts.es5?t.varKinds.var:t.varKinds.const;h=(0,e._)`${h}${w} ${y} = ${b};${this.opts._n}`}else if(b=f?.(y))h=(0,e._)`${h}${b}${this.opts._n}`;else throw new n(y);m.set(y,r.Completed)})}return h}}t.ValueScope=a})(Yf)),Yf}var gv;function Be(){return gv||(gv=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const e=Ju(),n=mv();var r=Ju();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}});var o=mv();Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),t.operators={GT:new e._Code(">"),GTE:new e._Code(">="),LT:new e._Code("<"),LTE:new e._Code("<="),EQ:new e._Code("==="),NEQ:new e._Code("!=="),NOT:new e._Code("!"),OR:new e._Code("||"),AND:new e._Code("&&"),ADD:new e._Code("+")};class s{optimizeNodes(){return this}optimizeNames(T,$){return this}}class i extends s{constructor(T,$,I){super(),this.varKind=T,this.name=$,this.rhs=I}render({es5:T,_n:$}){const I=T?n.varKinds.var:this.varKind,Y=this.rhs===void 0?"":` = ${this.rhs}`;return`${I} ${this.name}${Y};`+$}optimizeNames(T,$){if(T[this.name.str])return this.rhs&&(this.rhs=L(this.rhs,T,$)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class a extends s{constructor(T,$,I){super(),this.lhs=T,this.rhs=$,this.sideEffects=I}render({_n:T}){return`${this.lhs} = ${this.rhs};`+T}optimizeNames(T,$){if(!(this.lhs instanceof e.Name&&!T[this.lhs.str]&&!this.sideEffects))return this.rhs=L(this.rhs,T,$),this}get names(){const T=this.lhs instanceof e.Name?{}:{...this.lhs.names};return N(T,this.rhs)}}class l extends a{constructor(T,$,I,Y){super(T,I,Y),this.op=$}render({_n:T}){return`${this.lhs} ${this.op}= ${this.rhs};`+T}}class c extends s{constructor(T){super(),this.label=T,this.names={}}render({_n:T}){return`${this.label}:`+T}}class u extends s{constructor(T){super(),this.label=T,this.names={}}render({_n:T}){return`break${this.label?` ${this.label}`:""};`+T}}class d extends s{constructor(T){super(),this.error=T}render({_n:T}){return`throw ${this.error};`+T}get names(){return this.error.names}}class f extends s{constructor(T){super(),this.code=T}render({_n:T}){return`${this.code};`+T}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(T,$){return this.code=L(this.code,T,$),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class h extends s{constructor(T=[]){super(),this.nodes=T}render(T){return this.nodes.reduce(($,I)=>$+I.render(T),"")}optimizeNodes(){const{nodes:T}=this;let $=T.length;for(;$--;){const I=T[$].optimizeNodes();Array.isArray(I)?T.splice($,1,...I):I?T[$]=I:T.splice($,1)}return T.length>0?this:void 0}optimizeNames(T,$){const{nodes:I}=this;let Y=I.length;for(;Y--;){const G=I[Y];G.optimizeNames(T,$)||(H(T,G.names),I.splice(Y,1))}return I.length>0?this:void 0}get names(){return this.nodes.reduce((T,$)=>_(T,$.names),{})}}class p extends h{render(T){return"{"+T._n+super.render(T)+"}"+T._n}}class g extends h{}class m extends p{}m.kind="else";class y extends p{constructor(T,$){super($),this.condition=T}render(T){let $=`if(${this.condition})`+super.render(T);return this.else&&($+="else "+this.else.render(T)),$}optimizeNodes(){super.optimizeNodes();const T=this.condition;if(T===!0)return this.nodes;let $=this.else;if($){const I=$.optimizeNodes();$=this.else=Array.isArray(I)?new m(I):I}if($)return T===!1?$ instanceof y?$:$.nodes:this.nodes.length?this:new y(Z(T),$ instanceof y?[$]:$.nodes);if(!(T===!1||!this.nodes.length))return this}optimizeNames(T,$){var I;if(this.else=(I=this.else)===null||I===void 0?void 0:I.optimizeNames(T,$),!!(super.optimizeNames(T,$)||this.else))return this.condition=L(this.condition,T,$),this}get names(){const T=super.names;return N(T,this.condition),this.else&&_(T,this.else.names),T}}y.kind="if";class b extends p{}b.kind="for";class w extends b{constructor(T){super(),this.iteration=T}render(T){return`for(${this.iteration})`+super.render(T)}optimizeNames(T,$){if(super.optimizeNames(T,$))return this.iteration=L(this.iteration,T,$),this}get names(){return _(super.names,this.iteration.names)}}class k extends b{constructor(T,$,I,Y){super(),this.varKind=T,this.name=$,this.from=I,this.to=Y}render(T){const $=T.es5?n.varKinds.var:this.varKind,{name:I,from:Y,to:G}=this;return`for(${$} ${I}=${Y}; ${I}<${G}; ${I}++)`+super.render(T)}get names(){const T=N(super.names,this.from);return N(T,this.to)}}class v extends b{constructor(T,$,I,Y){super(),this.loop=T,this.varKind=$,this.name=I,this.iterable=Y}render(T){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(T)}optimizeNames(T,$){if(super.optimizeNames(T,$))return this.iterable=L(this.iterable,T,$),this}get names(){return _(super.names,this.iterable.names)}}class x extends p{constructor(T,$,I){super(),this.name=T,this.args=$,this.async=I}render(T){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(T)}}x.kind="func";class E extends h{render(T){return"return "+super.render(T)}}E.kind="return";class C extends p{render(T){let $="try"+super.render(T);return this.catch&&($+=this.catch.render(T)),this.finally&&($+=this.finally.render(T)),$}optimizeNodes(){var T,$;return super.optimizeNodes(),(T=this.catch)===null||T===void 0||T.optimizeNodes(),($=this.finally)===null||$===void 0||$.optimizeNodes(),this}optimizeNames(T,$){var I,Y;return super.optimizeNames(T,$),(I=this.catch)===null||I===void 0||I.optimizeNames(T,$),(Y=this.finally)===null||Y===void 0||Y.optimizeNames(T,$),this}get names(){const T=super.names;return this.catch&&_(T,this.catch.names),this.finally&&_(T,this.finally.names),T}}class A extends p{constructor(T){super(),this.error=T}render(T){return`catch(${this.error})`+super.render(T)}}A.kind="catch";class z extends p{render(T){return"finally"+super.render(T)}}z.kind="finally";class R{constructor(T,$={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...$,_n:$.lines?`
|
|
328
|
-
`:""},this._extScope=T,this._scope=new n.Scope({parent:T}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name(T){return this._scope.name(T)}scopeName(T){return this._extScope.name(T)}scopeValue(T,$){const I=this._extScope.value(T,$);return(this._values[I.prefix]||(this._values[I.prefix]=new Set)).add(I),I}getScopeValue(T,$){return this._extScope.getValue(T,$)}scopeRefs(T){return this._extScope.scopeRefs(T,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(T,$,I,Y){const G=this._scope.toName($);return I!==void 0&&Y&&(this._constants[G.str]=I),this._leafNode(new i(T,G,I)),G}const(T,$,I){return this._def(n.varKinds.const,T,$,I)}let(T,$,I){return this._def(n.varKinds.let,T,$,I)}var(T,$,I){return this._def(n.varKinds.var,T,$,I)}assign(T,$,I){return this._leafNode(new a(T,$,I))}add(T,$){return this._leafNode(new l(T,t.operators.ADD,$))}code(T){return typeof T=="function"?T():T!==e.nil&&this._leafNode(new f(T)),this}object(...T){const $=["{"];for(const[I,Y]of T)$.length>1&&$.push(","),$.push(I),(I!==Y||this.opts.es5)&&($.push(":"),(0,e.addCodeArg)($,Y));return $.push("}"),new e._Code($)}if(T,$,I){if(this._blockNode(new y(T)),$&&I)this.code($).else().code(I).endIf();else if($)this.code($).endIf();else if(I)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(T){return this._elseNode(new y(T))}else(){return this._elseNode(new m)}endIf(){return this._endBlockNode(y,m)}_for(T,$){return this._blockNode(T),$&&this.code($).endFor(),this}for(T,$){return this._for(new w(T),$)}forRange(T,$,I,Y,G=this.opts.es5?n.varKinds.var:n.varKinds.let){const X=this._scope.toName(T);return this._for(new k(G,X,$,I),()=>Y(X))}forOf(T,$,I,Y=n.varKinds.const){const G=this._scope.toName(T);if(this.opts.es5){const X=$ instanceof e.Name?$:this.var("_arr",$);return this.forRange("_i",0,(0,e._)`${X}.length`,se=>{this.var(G,(0,e._)`${X}[${se}]`),I(G)})}return this._for(new v("of",Y,G,$),()=>I(G))}forIn(T,$,I,Y=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(T,(0,e._)`Object.keys(${$})`,I);const G=this._scope.toName(T);return this._for(new v("in",Y,G,$),()=>I(G))}endFor(){return this._endBlockNode(b)}label(T){return this._leafNode(new c(T))}break(T){return this._leafNode(new u(T))}return(T){const $=new E;if(this._blockNode($),this.code(T),$.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(E)}try(T,$,I){if(!$&&!I)throw new Error('CodeGen: "try" without "catch" and "finally"');const Y=new C;if(this._blockNode(Y),this.code(T),$){const G=this.name("e");this._currNode=Y.catch=new A(G),$(G)}return I&&(this._currNode=Y.finally=new z,this.code(I)),this._endBlockNode(A,z)}throw(T){return this._leafNode(new d(T))}block(T,$){return this._blockStarts.push(this._nodes.length),T&&this.code(T).endBlock($),this}endBlock(T){const $=this._blockStarts.pop();if($===void 0)throw new Error("CodeGen: not in self-balancing block");const I=this._nodes.length-$;if(I<0||T!==void 0&&I!==T)throw new Error(`CodeGen: wrong number of nodes: ${I} vs ${T} expected`);return this._nodes.length=$,this}func(T,$=e.nil,I,Y){return this._blockNode(new x(T,$,I)),Y&&this.code(Y).endFunc(),this}endFunc(){return this._endBlockNode(x)}optimize(T=1){for(;T-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(T){return this._currNode.nodes.push(T),this}_blockNode(T){this._currNode.nodes.push(T),this._nodes.push(T)}_endBlockNode(T,$){const I=this._currNode;if(I instanceof T||$&&I instanceof $)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${$?`${T.kind}/${$.kind}`:T.kind}"`)}_elseNode(T){const $=this._currNode;if(!($ instanceof y))throw new Error('CodeGen: "else" without "if"');return this._currNode=$.else=T,this}get _root(){return this._nodes[0]}get _currNode(){const T=this._nodes;return T[T.length-1]}set _currNode(T){const $=this._nodes;$[$.length-1]=T}}t.CodeGen=R;function _(F,T){for(const $ in T)F[$]=(F[$]||0)+(T[$]||0);return F}function N(F,T){return T instanceof e._CodeOrName?_(F,T.names):F}function L(F,T,$){if(F instanceof e.Name)return I(F);if(!Y(F))return F;return new e._Code(F._items.reduce((G,X)=>(X instanceof e.Name&&(X=I(X)),X instanceof e._Code?G.push(...X._items):G.push(X),G),[]));function I(G){const X=$[G.str];return X===void 0||T[G.str]!==1?G:(delete T[G.str],X)}function Y(G){return G instanceof e._Code&&G._items.some(X=>X instanceof e.Name&&T[X.str]===1&&$[X.str]!==void 0)}}function H(F,T){for(const $ in T)F[$]=(F[$]||0)-(T[$]||0)}function Z(F){return typeof F=="boolean"||typeof F=="number"||F===null?!F:(0,e._)`!${B(F)}`}t.not=Z;const W=j(t.operators.AND);function q(...F){return F.reduce(W)}t.and=q;const V=j(t.operators.OR);function D(...F){return F.reduce(V)}t.or=D;function j(F){return(T,$)=>T===e.nil?$:$===e.nil?T:(0,e._)`${B(T)} ${F} ${B($)}`}function B(F){return F instanceof e.Name?F:(0,e._)`(${F})`}})(Uf)),Uf}var Le={},yv;function qe(){if(yv)return Le;yv=1,Object.defineProperty(Le,"__esModule",{value:!0}),Le.checkStrictMode=Le.getErrorPath=Le.Type=Le.useFunc=Le.setEvaluated=Le.evaluatedPropsToName=Le.mergeEvaluated=Le.eachItem=Le.unescapeJsonPointer=Le.escapeJsonPointer=Le.escapeFragment=Le.unescapeFragment=Le.schemaRefOrVal=Le.schemaHasRulesButRef=Le.schemaHasRules=Le.checkUnknownRules=Le.alwaysValidSchema=Le.toHash=void 0;const t=Be(),e=Ju();function n(v){const x={};for(const E of v)x[E]=!0;return x}Le.toHash=n;function r(v,x){return typeof x=="boolean"?x:Object.keys(x).length===0?!0:(o(v,x),!s(x,v.self.RULES.all))}Le.alwaysValidSchema=r;function o(v,x=v.schema){const{opts:E,self:C}=v;if(!E.strictSchema||typeof x=="boolean")return;const A=C.RULES.keywords;for(const z in x)A[z]||k(v,`unknown keyword: "${z}"`)}Le.checkUnknownRules=o;function s(v,x){if(typeof v=="boolean")return!v;for(const E in v)if(x[E])return!0;return!1}Le.schemaHasRules=s;function i(v,x){if(typeof v=="boolean")return!v;for(const E in v)if(E!=="$ref"&&x.all[E])return!0;return!1}Le.schemaHasRulesButRef=i;function a({topSchemaRef:v,schemaPath:x},E,C,A){if(!A){if(typeof E=="number"||typeof E=="boolean")return E;if(typeof E=="string")return(0,t._)`${E}`}return(0,t._)`${v}${x}${(0,t.getProperty)(C)}`}Le.schemaRefOrVal=a;function l(v){return d(decodeURIComponent(v))}Le.unescapeFragment=l;function c(v){return encodeURIComponent(u(v))}Le.escapeFragment=c;function u(v){return typeof v=="number"?`${v}`:v.replace(/~/g,"~0").replace(/\//g,"~1")}Le.escapeJsonPointer=u;function d(v){return v.replace(/~1/g,"/").replace(/~0/g,"~")}Le.unescapeJsonPointer=d;function f(v,x){if(Array.isArray(v))for(const E of v)x(E);else x(v)}Le.eachItem=f;function h({mergeNames:v,mergeToName:x,mergeValues:E,resultToName:C}){return(A,z,R,_)=>{const N=R===void 0?z:R instanceof t.Name?(z instanceof t.Name?v(A,z,R):x(A,z,R),R):z instanceof t.Name?(x(A,R,z),z):E(z,R);return _===t.Name&&!(N instanceof t.Name)?C(A,N):N}}Le.mergeEvaluated={props:h({mergeNames:(v,x,E)=>v.if((0,t._)`${E} !== true && ${x} !== undefined`,()=>{v.if((0,t._)`${x} === true`,()=>v.assign(E,!0),()=>v.assign(E,(0,t._)`${E} || {}`).code((0,t._)`Object.assign(${E}, ${x})`))}),mergeToName:(v,x,E)=>v.if((0,t._)`${E} !== true`,()=>{x===!0?v.assign(E,!0):(v.assign(E,(0,t._)`${E} || {}`),g(v,E,x))}),mergeValues:(v,x)=>v===!0?!0:{...v,...x},resultToName:p}),items:h({mergeNames:(v,x,E)=>v.if((0,t._)`${E} !== true && ${x} !== undefined`,()=>v.assign(E,(0,t._)`${x} === true ? true : ${E} > ${x} ? ${E} : ${x}`)),mergeToName:(v,x,E)=>v.if((0,t._)`${E} !== true`,()=>v.assign(E,x===!0?!0:(0,t._)`${E} > ${x} ? ${E} : ${x}`)),mergeValues:(v,x)=>v===!0?!0:Math.max(v,x),resultToName:(v,x)=>v.var("items",x)})};function p(v,x){if(x===!0)return v.var("props",!0);const E=v.var("props",(0,t._)`{}`);return x!==void 0&&g(v,E,x),E}Le.evaluatedPropsToName=p;function g(v,x,E){Object.keys(E).forEach(C=>v.assign((0,t._)`${x}${(0,t.getProperty)(C)}`,!0))}Le.setEvaluated=g;const m={};function y(v,x){return v.scopeValue("func",{ref:x,code:m[x.code]||(m[x.code]=new e._Code(x.code))})}Le.useFunc=y;var b;(function(v){v[v.Num=0]="Num",v[v.Str=1]="Str"})(b||(Le.Type=b={}));function w(v,x,E){if(v instanceof t.Name){const C=x===b.Num;return E?C?(0,t._)`"[" + ${v} + "]"`:(0,t._)`"['" + ${v} + "']"`:C?(0,t._)`"/" + ${v}`:(0,t._)`"/" + ${v}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return E?(0,t.getProperty)(v).toString():"/"+u(v)}Le.getErrorPath=w;function k(v,x,E=v.opts.strictSchema){if(E){if(x=`strict mode: ${x}`,E===!0)throw new Error(x);v.self.logger.warn(x)}}return Le.checkStrictMode=k,Le}var Fl={},bv;function Ao(){if(bv)return Fl;bv=1,Object.defineProperty(Fl,"__esModule",{value:!0});const t=Be(),e={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};return Fl.default=e,Fl}var vv;function Ld(){return vv||(vv=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const e=Be(),n=qe(),r=Ao();t.keywordError={message:({keyword:m})=>(0,e.str)`must pass "${m}" keyword validation`},t.keyword$DataError={message:({keyword:m,schemaType:y})=>y?(0,e.str)`"${m}" keyword must be ${y} ($data)`:(0,e.str)`"${m}" keyword is invalid ($data)`};function o(m,y=t.keywordError,b,w){const{it:k}=m,{gen:v,compositeRule:x,allErrors:E}=k,C=d(m,y,b);w??(x||E)?l(v,C):c(k,(0,e._)`[${C}]`)}t.reportError=o;function s(m,y=t.keywordError,b){const{it:w}=m,{gen:k,compositeRule:v,allErrors:x}=w,E=d(m,y,b);l(k,E),v||x||c(w,r.default.vErrors)}t.reportExtraError=s;function i(m,y){m.assign(r.default.errors,y),m.if((0,e._)`${r.default.vErrors} !== null`,()=>m.if(y,()=>m.assign((0,e._)`${r.default.vErrors}.length`,y),()=>m.assign(r.default.vErrors,null)))}t.resetErrorsCount=i;function a({gen:m,keyword:y,schemaValue:b,data:w,errsCount:k,it:v}){if(k===void 0)throw new Error("ajv implementation error");const x=m.name("err");m.forRange("i",k,r.default.errors,E=>{m.const(x,(0,e._)`${r.default.vErrors}[${E}]`),m.if((0,e._)`${x}.instancePath === undefined`,()=>m.assign((0,e._)`${x}.instancePath`,(0,e.strConcat)(r.default.instancePath,v.errorPath))),m.assign((0,e._)`${x}.schemaPath`,(0,e.str)`${v.errSchemaPath}/${y}`),v.opts.verbose&&(m.assign((0,e._)`${x}.schema`,b),m.assign((0,e._)`${x}.data`,w))})}t.extendErrors=a;function l(m,y){const b=m.const("err",y);m.if((0,e._)`${r.default.vErrors} === null`,()=>m.assign(r.default.vErrors,(0,e._)`[${b}]`),(0,e._)`${r.default.vErrors}.push(${b})`),m.code((0,e._)`${r.default.errors}++`)}function c(m,y){const{gen:b,validateName:w,schemaEnv:k}=m;k.$async?b.throw((0,e._)`new ${m.ValidationError}(${y})`):(b.assign((0,e._)`${w}.errors`,y),b.return(!1))}const u={keyword:new e.Name("keyword"),schemaPath:new e.Name("schemaPath"),params:new e.Name("params"),propertyName:new e.Name("propertyName"),message:new e.Name("message"),schema:new e.Name("schema"),parentSchema:new e.Name("parentSchema")};function d(m,y,b){const{createErrors:w}=m.it;return w===!1?(0,e._)`{}`:f(m,y,b)}function f(m,y,b={}){const{gen:w,it:k}=m,v=[h(k,b),p(m,b)];return g(m,y,v),w.object(...v)}function h({errorPath:m},{instancePath:y}){const b=y?(0,e.str)`${m}${(0,n.getErrorPath)(y,n.Type.Str)}`:m;return[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,b)]}function p({keyword:m,it:{errSchemaPath:y}},{schemaPath:b,parentSchema:w}){let k=w?y:(0,e.str)`${y}/${m}`;return b&&(k=(0,e.str)`${k}${(0,n.getErrorPath)(b,n.Type.Str)}`),[u.schemaPath,k]}function g(m,{params:y,message:b},w){const{keyword:k,data:v,schemaValue:x,it:E}=m,{opts:C,propertyName:A,topSchemaRef:z,schemaPath:R}=E;w.push([u.keyword,k],[u.params,typeof y=="function"?y(m):y||(0,e._)`{}`]),C.messages&&w.push([u.message,typeof b=="function"?b(m):b]),C.verbose&&w.push([u.schema,x],[u.parentSchema,(0,e._)`${z}${R}`],[r.default.data,v]),A&&w.push([u.propertyName,A])}})(qf)),qf}var wv;function k6(){if(wv)return jo;wv=1,Object.defineProperty(jo,"__esModule",{value:!0}),jo.boolOrEmptySchema=jo.topBoolOrEmptySchema=void 0;const t=Ld(),e=Be(),n=Ao(),r={message:"boolean schema is false"};function o(a){const{gen:l,schema:c,validateName:u}=a;c===!1?i(a,!1):typeof c=="object"&&c.$async===!0?l.return(n.default.data):(l.assign((0,e._)`${u}.errors`,null),l.return(!0))}jo.topBoolOrEmptySchema=o;function s(a,l){const{gen:c,schema:u}=a;u===!1?(c.var(l,!1),i(a)):c.var(l,!0)}jo.boolOrEmptySchema=s;function i(a,l){const{gen:c,data:u}=a,d={gen:c,keyword:"false schema",data:u,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:a};(0,t.reportError)(d,r,void 0,l)}return jo}var jt={},Fo={},kv;function MT(){if(kv)return Fo;kv=1,Object.defineProperty(Fo,"__esModule",{value:!0}),Fo.getRules=Fo.isJSONType=void 0;const t=["string","number","integer","boolean","null","object","array"],e=new Set(t);function n(o){return typeof o=="string"&&e.has(o)}Fo.isJSONType=n;function r(){const o={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...o,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},o.number,o.string,o.array,o.object],post:{rules:[]},all:{},keywords:{}}}return Fo.getRules=r,Fo}var xr={},xv;function RT(){if(xv)return xr;xv=1,Object.defineProperty(xr,"__esModule",{value:!0}),xr.shouldUseRule=xr.shouldUseGroup=xr.schemaHasRulesForType=void 0;function t({schema:r,self:o},s){const i=o.RULES.types[s];return i&&i!==!0&&e(r,i)}xr.schemaHasRulesForType=t;function e(r,o){return o.rules.some(s=>n(r,s))}xr.shouldUseGroup=e;function n(r,o){var s;return r[o.keyword]!==void 0||((s=o.definition.implements)===null||s===void 0?void 0:s.some(i=>r[i]!==void 0))}return xr.shouldUseRule=n,xr}var Sv;function Xu(){if(Sv)return jt;Sv=1,Object.defineProperty(jt,"__esModule",{value:!0}),jt.reportTypeError=jt.checkDataTypes=jt.checkDataType=jt.coerceAndCheckDataType=jt.getJSONTypes=jt.getSchemaTypes=jt.DataType=void 0;const t=MT(),e=RT(),n=Ld(),r=Be(),o=qe();var s;(function(b){b[b.Correct=0]="Correct",b[b.Wrong=1]="Wrong"})(s||(jt.DataType=s={}));function i(b){const w=a(b.type);if(w.includes("null")){if(b.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!w.length&&b.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');b.nullable===!0&&w.push("null")}return w}jt.getSchemaTypes=i;function a(b){const w=Array.isArray(b)?b:b?[b]:[];if(w.every(t.isJSONType))return w;throw new Error("type must be JSONType or JSONType[]: "+w.join(","))}jt.getJSONTypes=a;function l(b,w){const{gen:k,data:v,opts:x}=b,E=u(w,x.coerceTypes),C=w.length>0&&!(E.length===0&&w.length===1&&(0,e.schemaHasRulesForType)(b,w[0]));if(C){const A=p(w,v,x.strictNumbers,s.Wrong);k.if(A,()=>{E.length?d(b,w,E):m(b)})}return C}jt.coerceAndCheckDataType=l;const c=new Set(["string","number","integer","boolean","null"]);function u(b,w){return w?b.filter(k=>c.has(k)||w==="array"&&k==="array"):[]}function d(b,w,k){const{gen:v,data:x,opts:E}=b,C=v.let("dataType",(0,r._)`typeof ${x}`),A=v.let("coerced",(0,r._)`undefined`);E.coerceTypes==="array"&&v.if((0,r._)`${C} == 'object' && Array.isArray(${x}) && ${x}.length == 1`,()=>v.assign(x,(0,r._)`${x}[0]`).assign(C,(0,r._)`typeof ${x}`).if(p(w,x,E.strictNumbers),()=>v.assign(A,x))),v.if((0,r._)`${A} !== undefined`);for(const R of k)(c.has(R)||R==="array"&&E.coerceTypes==="array")&&z(R);v.else(),m(b),v.endIf(),v.if((0,r._)`${A} !== undefined`,()=>{v.assign(x,A),f(b,A)});function z(R){switch(R){case"string":v.elseIf((0,r._)`${C} == "number" || ${C} == "boolean"`).assign(A,(0,r._)`"" + ${x}`).elseIf((0,r._)`${x} === null`).assign(A,(0,r._)`""`);return;case"number":v.elseIf((0,r._)`${C} == "boolean" || ${x} === null
|
|
329
|
-
|| (${C} == "string" && ${x} && ${x} == +${x})`).assign(A,(0,r._)`+${x}`);return;case"integer":v.elseIf((0,r._)`${C} === "boolean" || ${x} === null
|
|
330
|
-
|| (${C} === "string" && ${x} && ${x} == +${x} && !(${x} % 1))`).assign(A,(0,r._)`+${x}`);return;case"boolean":v.elseIf((0,r._)`${x} === "false" || ${x} === 0 || ${x} === null`).assign(A,!1).elseIf((0,r._)`${x} === "true" || ${x} === 1`).assign(A,!0);return;case"null":v.elseIf((0,r._)`${x} === "" || ${x} === 0 || ${x} === false`),v.assign(A,null);return;case"array":v.elseIf((0,r._)`${C} === "string" || ${C} === "number"
|
|
331
|
-
|| ${C} === "boolean" || ${x} === null`).assign(A,(0,r._)`[${x}]`)}}}function f({gen:b,parentData:w,parentDataProperty:k},v){b.if((0,r._)`${w} !== undefined`,()=>b.assign((0,r._)`${w}[${k}]`,v))}function h(b,w,k,v=s.Correct){const x=v===s.Correct?r.operators.EQ:r.operators.NEQ;let E;switch(b){case"null":return(0,r._)`${w} ${x} null`;case"array":E=(0,r._)`Array.isArray(${w})`;break;case"object":E=(0,r._)`${w} && typeof ${w} == "object" && !Array.isArray(${w})`;break;case"integer":E=C((0,r._)`!(${w} % 1) && !isNaN(${w})`);break;case"number":E=C();break;default:return(0,r._)`typeof ${w} ${x} ${b}`}return v===s.Correct?E:(0,r.not)(E);function C(A=r.nil){return(0,r.and)((0,r._)`typeof ${w} == "number"`,A,k?(0,r._)`isFinite(${w})`:r.nil)}}jt.checkDataType=h;function p(b,w,k,v){if(b.length===1)return h(b[0],w,k,v);let x;const E=(0,o.toHash)(b);if(E.array&&E.object){const C=(0,r._)`typeof ${w} != "object"`;x=E.null?C:(0,r._)`!${w} || ${C}`,delete E.null,delete E.array,delete E.object}else x=r.nil;E.number&&delete E.integer;for(const C in E)x=(0,r.and)(x,h(C,w,k,v));return x}jt.checkDataTypes=p;const g={message:({schema:b})=>`must be ${b}`,params:({schema:b,schemaValue:w})=>typeof b=="string"?(0,r._)`{type: ${b}}`:(0,r._)`{type: ${w}}`};function m(b){const w=y(b);(0,n.reportError)(w,g)}jt.reportTypeError=m;function y(b){const{gen:w,data:k,schema:v}=b,x=(0,o.schemaRefOrVal)(b,v,"type");return{gen:w,keyword:"type",data:k,schema:v.type,schemaCode:x,schemaValue:x,parentSchema:v,params:{},it:b}}return jt}var Ui={},Ev;function x6(){if(Ev)return Ui;Ev=1,Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.assignDefaults=void 0;const t=Be(),e=qe();function n(o,s){const{properties:i,items:a}=o.schema;if(s==="object"&&i)for(const l in i)r(o,l,i[l].default);else s==="array"&&Array.isArray(a)&&a.forEach((l,c)=>r(o,c,l.default))}Ui.assignDefaults=n;function r(o,s,i){const{gen:a,compositeRule:l,data:c,opts:u}=o;if(i===void 0)return;const d=(0,t._)`${c}${(0,t.getProperty)(s)}`;if(l){(0,e.checkStrictMode)(o,`default is ignored for: ${d}`);return}let f=(0,t._)`${d} === undefined`;u.useDefaults==="empty"&&(f=(0,t._)`${f} || ${d} === null || ${d} === ""`),a.if(f,(0,t._)`${d} = ${(0,t.stringify)(i)}`)}return Ui}var Vn={},Je={},Cv;function Zn(){if(Cv)return Je;Cv=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.validateUnion=Je.validateArray=Je.usePattern=Je.callValidateCode=Je.schemaProperties=Je.allSchemaProperties=Je.noPropertyInData=Je.propertyInData=Je.isOwnProperty=Je.hasPropFunc=Je.reportMissingProp=Je.checkMissingProp=Je.checkReportMissingProp=void 0;const t=Be(),e=qe(),n=Ao(),r=qe();function o(b,w){const{gen:k,data:v,it:x}=b;k.if(u(k,v,w,x.opts.ownProperties),()=>{b.setParams({missingProperty:(0,t._)`${w}`},!0),b.error()})}Je.checkReportMissingProp=o;function s({gen:b,data:w,it:{opts:k}},v,x){return(0,t.or)(...v.map(E=>(0,t.and)(u(b,w,E,k.ownProperties),(0,t._)`${x} = ${E}`)))}Je.checkMissingProp=s;function i(b,w){b.setParams({missingProperty:w},!0),b.error()}Je.reportMissingProp=i;function a(b){return b.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}Je.hasPropFunc=a;function l(b,w,k){return(0,t._)`${a(b)}.call(${w}, ${k})`}Je.isOwnProperty=l;function c(b,w,k,v){const x=(0,t._)`${w}${(0,t.getProperty)(k)} !== undefined`;return v?(0,t._)`${x} && ${l(b,w,k)}`:x}Je.propertyInData=c;function u(b,w,k,v){const x=(0,t._)`${w}${(0,t.getProperty)(k)} === undefined`;return v?(0,t.or)(x,(0,t.not)(l(b,w,k))):x}Je.noPropertyInData=u;function d(b){return b?Object.keys(b).filter(w=>w!=="__proto__"):[]}Je.allSchemaProperties=d;function f(b,w){return d(w).filter(k=>!(0,e.alwaysValidSchema)(b,w[k]))}Je.schemaProperties=f;function h({schemaCode:b,data:w,it:{gen:k,topSchemaRef:v,schemaPath:x,errorPath:E},it:C},A,z,R){const _=R?(0,t._)`${b}, ${w}, ${v}${x}`:w,N=[[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,E)],[n.default.parentData,C.parentData],[n.default.parentDataProperty,C.parentDataProperty],[n.default.rootData,n.default.rootData]];C.opts.dynamicRef&&N.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);const L=(0,t._)`${_}, ${k.object(...N)}`;return z!==t.nil?(0,t._)`${A}.call(${z}, ${L})`:(0,t._)`${A}(${L})`}Je.callValidateCode=h;const p=(0,t._)`new RegExp`;function g({gen:b,it:{opts:w}},k){const v=w.unicodeRegExp?"u":"",{regExp:x}=w.code,E=x(k,v);return b.scopeValue("pattern",{key:E.toString(),ref:E,code:(0,t._)`${x.code==="new RegExp"?p:(0,r.useFunc)(b,x)}(${k}, ${v})`})}Je.usePattern=g;function m(b){const{gen:w,data:k,keyword:v,it:x}=b,E=w.name("valid");if(x.allErrors){const A=w.let("valid",!0);return C(()=>w.assign(A,!1)),A}return w.var(E,!0),C(()=>w.break()),E;function C(A){const z=w.const("len",(0,t._)`${k}.length`);w.forRange("i",0,z,R=>{b.subschema({keyword:v,dataProp:R,dataPropType:e.Type.Num},E),w.if((0,t.not)(E),A)})}}Je.validateArray=m;function y(b){const{gen:w,schema:k,keyword:v,it:x}=b;if(!Array.isArray(k))throw new Error("ajv implementation error");if(k.some(z=>(0,e.alwaysValidSchema)(x,z))&&!x.opts.unevaluated)return;const C=w.let("valid",!1),A=w.name("_valid");w.block(()=>k.forEach((z,R)=>{const _=b.subschema({keyword:v,schemaProp:R,compositeRule:!0},A);w.assign(C,(0,t._)`${C} || ${A}`),b.mergeValidEvaluated(_,A)||w.if((0,t.not)(C))})),b.result(C,()=>b.reset(),()=>b.error(!0))}return Je.validateUnion=y,Je}var Tv;function S6(){if(Tv)return Vn;Tv=1,Object.defineProperty(Vn,"__esModule",{value:!0}),Vn.validateKeywordUsage=Vn.validSchemaType=Vn.funcKeywordCode=Vn.macroKeywordCode=void 0;const t=Be(),e=Ao(),n=Zn(),r=Ld();function o(f,h){const{gen:p,keyword:g,schema:m,parentSchema:y,it:b}=f,w=h.macro.call(b.self,m,y,b),k=c(p,g,w);b.opts.validateSchema!==!1&&b.self.validateSchema(w,!0);const v=p.name("valid");f.subschema({schema:w,schemaPath:t.nil,errSchemaPath:`${b.errSchemaPath}/${g}`,topSchemaRef:k,compositeRule:!0},v),f.pass(v,()=>f.error(!0))}Vn.macroKeywordCode=o;function s(f,h){var p;const{gen:g,keyword:m,schema:y,parentSchema:b,$data:w,it:k}=f;l(k,h);const v=!w&&h.compile?h.compile.call(k.self,y,b,k):h.validate,x=c(g,m,v),E=g.let("valid");f.block$data(E,C),f.ok((p=h.valid)!==null&&p!==void 0?p:E);function C(){if(h.errors===!1)R(),h.modifying&&i(f),_(()=>f.error());else{const N=h.async?A():z();h.modifying&&i(f),_(()=>a(f,N))}}function A(){const N=g.let("ruleErrs",null);return g.try(()=>R((0,t._)`await `),L=>g.assign(E,!1).if((0,t._)`${L} instanceof ${k.ValidationError}`,()=>g.assign(N,(0,t._)`${L}.errors`),()=>g.throw(L))),N}function z(){const N=(0,t._)`${x}.errors`;return g.assign(N,null),R(t.nil),N}function R(N=h.async?(0,t._)`await `:t.nil){const L=k.opts.passContext?e.default.this:e.default.self,H=!("compile"in h&&!w||h.schema===!1);g.assign(E,(0,t._)`${N}${(0,n.callValidateCode)(f,x,L,H)}`,h.modifying)}function _(N){var L;g.if((0,t.not)((L=h.valid)!==null&&L!==void 0?L:E),N)}}Vn.funcKeywordCode=s;function i(f){const{gen:h,data:p,it:g}=f;h.if(g.parentData,()=>h.assign(p,(0,t._)`${g.parentData}[${g.parentDataProperty}]`))}function a(f,h){const{gen:p}=f;p.if((0,t._)`Array.isArray(${h})`,()=>{p.assign(e.default.vErrors,(0,t._)`${e.default.vErrors} === null ? ${h} : ${e.default.vErrors}.concat(${h})`).assign(e.default.errors,(0,t._)`${e.default.vErrors}.length`),(0,r.extendErrors)(f)},()=>f.error())}function l({schemaEnv:f},h){if(h.async&&!f.$async)throw new Error("async keyword in sync schema")}function c(f,h,p){if(p===void 0)throw new Error(`keyword "${h}" failed to compile`);return f.scopeValue("keyword",typeof p=="function"?{ref:p}:{ref:p,code:(0,t.stringify)(p)})}function u(f,h,p=!1){return!h.length||h.some(g=>g==="array"?Array.isArray(f):g==="object"?f&&typeof f=="object"&&!Array.isArray(f):typeof f==g||p&&typeof f>"u")}Vn.validSchemaType=u;function d({schema:f,opts:h,self:p,errSchemaPath:g},m,y){if(Array.isArray(m.keyword)?!m.keyword.includes(y):m.keyword!==y)throw new Error("ajv implementation error");const b=m.dependencies;if(b?.some(w=>!Object.prototype.hasOwnProperty.call(f,w)))throw new Error(`parent schema must have dependencies of ${y}: ${b.join(",")}`);if(m.validateSchema&&!m.validateSchema(f[y])){const k=`keyword "${y}" value is invalid at path "${g}": `+p.errorsText(m.validateSchema.errors);if(h.validateSchema==="log")p.logger.error(k);else throw new Error(k)}}return Vn.validateKeywordUsage=d,Vn}var Sr={},Mv;function E6(){if(Mv)return Sr;Mv=1,Object.defineProperty(Sr,"__esModule",{value:!0}),Sr.extendSubschemaMode=Sr.extendSubschemaData=Sr.getSubschema=void 0;const t=Be(),e=qe();function n(s,{keyword:i,schemaProp:a,schema:l,schemaPath:c,errSchemaPath:u,topSchemaRef:d}){if(i!==void 0&&l!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(i!==void 0){const f=s.schema[i];return a===void 0?{schema:f,schemaPath:(0,t._)`${s.schemaPath}${(0,t.getProperty)(i)}`,errSchemaPath:`${s.errSchemaPath}/${i}`}:{schema:f[a],schemaPath:(0,t._)`${s.schemaPath}${(0,t.getProperty)(i)}${(0,t.getProperty)(a)}`,errSchemaPath:`${s.errSchemaPath}/${i}/${(0,e.escapeFragment)(a)}`}}if(l!==void 0){if(c===void 0||u===void 0||d===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:l,schemaPath:c,topSchemaRef:d,errSchemaPath:u}}throw new Error('either "keyword" or "schema" must be passed')}Sr.getSubschema=n;function r(s,i,{dataProp:a,dataPropType:l,data:c,dataTypes:u,propertyName:d}){if(c!==void 0&&a!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:f}=i;if(a!==void 0){const{errorPath:p,dataPathArr:g,opts:m}=i,y=f.let("data",(0,t._)`${i.data}${(0,t.getProperty)(a)}`,!0);h(y),s.errorPath=(0,t.str)`${p}${(0,e.getErrorPath)(a,l,m.jsPropertySyntax)}`,s.parentDataProperty=(0,t._)`${a}`,s.dataPathArr=[...g,s.parentDataProperty]}if(c!==void 0){const p=c instanceof t.Name?c:f.let("data",c,!0);h(p),d!==void 0&&(s.propertyName=d)}u&&(s.dataTypes=u);function h(p){s.data=p,s.dataLevel=i.dataLevel+1,s.dataTypes=[],i.definedProperties=new Set,s.parentData=i.data,s.dataNames=[...i.dataNames,p]}}Sr.extendSubschemaData=r;function o(s,{jtdDiscriminator:i,jtdMetadata:a,compositeRule:l,createErrors:c,allErrors:u}){l!==void 0&&(s.compositeRule=l),c!==void 0&&(s.createErrors=c),u!==void 0&&(s.allErrors=u),s.jtdDiscriminator=i,s.jtdMetadata=a}return Sr.extendSubschemaMode=o,Sr}var Qt={},Zf,Rv;function OT(){return Rv||(Rv=1,Zf=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,o,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!t(e[o],n[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[o]))return!1;for(o=r;o--!==0;){var i=s[o];if(!t(e[i],n[i]))return!1}return!0}return e!==e&&n!==n}),Zf}var Gf={exports:{}},Ov;function C6(){if(Ov)return Gf.exports;Ov=1;var t=Gf.exports=function(r,o,s){typeof o=="function"&&(s=o,o={}),s=o.cb||s;var i=typeof s=="function"?s:s.pre||function(){},a=s.post||function(){};e(o,i,a,r,"",r)};t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function e(r,o,s,i,a,l,c,u,d,f){if(i&&typeof i=="object"&&!Array.isArray(i)){o(i,a,l,c,u,d,f);for(var h in i){var p=i[h];if(Array.isArray(p)){if(h in t.arrayKeywords)for(var g=0;g<p.length;g++)e(r,o,s,p[g],a+"/"+h+"/"+g,l,a,h,i,g)}else if(h in t.propsKeywords){if(p&&typeof p=="object")for(var m in p)e(r,o,s,p[m],a+"/"+h+"/"+n(m),l,a,h,i,m)}else(h in t.keywords||r.allKeys&&!(h in t.skipKeywords))&&e(r,o,s,p,a+"/"+h,l,a,h,i)}s(i,a,l,c,u,d,f)}}function n(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}return Gf.exports}var _v;function jd(){if(_v)return Qt;_v=1,Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.getSchemaRefs=Qt.resolveUrl=Qt.normalizeId=Qt._getFullPath=Qt.getFullPath=Qt.inlineRef=void 0;const t=qe(),e=OT(),n=C6(),r=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function o(g,m=!0){return typeof g=="boolean"?!0:m===!0?!i(g):m?a(g)<=m:!1}Qt.inlineRef=o;const s=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function i(g){for(const m in g){if(s.has(m))return!0;const y=g[m];if(Array.isArray(y)&&y.some(i)||typeof y=="object"&&i(y))return!0}return!1}function a(g){let m=0;for(const y in g){if(y==="$ref")return 1/0;if(m++,!r.has(y)&&(typeof g[y]=="object"&&(0,t.eachItem)(g[y],b=>m+=a(b)),m===1/0))return 1/0}return m}function l(g,m="",y){y!==!1&&(m=d(m));const b=g.parse(m);return c(g,b)}Qt.getFullPath=l;function c(g,m){return g.serialize(m).split("#")[0]+"#"}Qt._getFullPath=c;const u=/#\/?$/;function d(g){return g?g.replace(u,""):""}Qt.normalizeId=d;function f(g,m,y){return y=d(y),g.resolve(m,y)}Qt.resolveUrl=f;const h=/^[a-z_][-a-z0-9._]*$/i;function p(g,m){if(typeof g=="boolean")return{};const{schemaId:y,uriResolver:b}=this.opts,w=d(g[y]||m),k={"":w},v=l(b,w,!1),x={},E=new Set;return n(g,{allKeys:!0},(z,R,_,N)=>{if(N===void 0)return;const L=v+R;let H=k[N];typeof z[y]=="string"&&(H=Z.call(this,z[y])),W.call(this,z.$anchor),W.call(this,z.$dynamicAnchor),k[R]=H;function Z(q){const V=this.opts.uriResolver.resolve;if(q=d(H?V(H,q):q),E.has(q))throw A(q);E.add(q);let D=this.refs[q];return typeof D=="string"&&(D=this.refs[D]),typeof D=="object"?C(z,D.schema,q):q!==d(L)&&(q[0]==="#"?(C(z,x[q],q),x[q]=z):this.refs[q]=L),q}function W(q){if(typeof q=="string"){if(!h.test(q))throw new Error(`invalid anchor "${q}"`);Z.call(this,`#${q}`)}}}),x;function C(z,R,_){if(R!==void 0&&!e(z,R))throw A(_)}function A(z){return new Error(`reference "${z}" resolves to more than one schema`)}}return Qt.getSchemaRefs=p,Qt}var Nv;function Fd(){if(Nv)return kr;Nv=1,Object.defineProperty(kr,"__esModule",{value:!0}),kr.getData=kr.KeywordCxt=kr.validateFunctionCode=void 0;const t=k6(),e=Xu(),n=RT(),r=Xu(),o=x6(),s=S6(),i=E6(),a=Be(),l=Ao(),c=jd(),u=qe(),d=Ld();function f(O){if(v(O)&&(E(O),k(O))){m(O);return}h(O,()=>(0,t.topBoolOrEmptySchema)(O))}kr.validateFunctionCode=f;function h({gen:O,validateName:P,schema:U,schemaEnv:K,opts:J},ee){J.code.es5?O.func(P,(0,a._)`${l.default.data}, ${l.default.valCxt}`,K.$async,()=>{O.code((0,a._)`"use strict"; ${b(U,J)}`),g(O,J),O.code(ee)}):O.func(P,(0,a._)`${l.default.data}, ${p(J)}`,K.$async,()=>O.code(b(U,J)).code(ee))}function p(O){return(0,a._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${O.dynamicRef?(0,a._)`, ${l.default.dynamicAnchors}={}`:a.nil}}={}`}function g(O,P){O.if(l.default.valCxt,()=>{O.var(l.default.instancePath,(0,a._)`${l.default.valCxt}.${l.default.instancePath}`),O.var(l.default.parentData,(0,a._)`${l.default.valCxt}.${l.default.parentData}`),O.var(l.default.parentDataProperty,(0,a._)`${l.default.valCxt}.${l.default.parentDataProperty}`),O.var(l.default.rootData,(0,a._)`${l.default.valCxt}.${l.default.rootData}`),P.dynamicRef&&O.var(l.default.dynamicAnchors,(0,a._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{O.var(l.default.instancePath,(0,a._)`""`),O.var(l.default.parentData,(0,a._)`undefined`),O.var(l.default.parentDataProperty,(0,a._)`undefined`),O.var(l.default.rootData,l.default.data),P.dynamicRef&&O.var(l.default.dynamicAnchors,(0,a._)`{}`)})}function m(O){const{schema:P,opts:U,gen:K}=O;h(O,()=>{U.$comment&&P.$comment&&N(O),z(O),K.let(l.default.vErrors,null),K.let(l.default.errors,0),U.unevaluated&&y(O),C(O),L(O)})}function y(O){const{gen:P,validateName:U}=O;O.evaluated=P.const("evaluated",(0,a._)`${U}.evaluated`),P.if((0,a._)`${O.evaluated}.dynamicProps`,()=>P.assign((0,a._)`${O.evaluated}.props`,(0,a._)`undefined`)),P.if((0,a._)`${O.evaluated}.dynamicItems`,()=>P.assign((0,a._)`${O.evaluated}.items`,(0,a._)`undefined`))}function b(O,P){const U=typeof O=="object"&&O[P.schemaId];return U&&(P.code.source||P.code.process)?(0,a._)`/*# sourceURL=${U} */`:a.nil}function w(O,P){if(v(O)&&(E(O),k(O))){x(O,P);return}(0,t.boolOrEmptySchema)(O,P)}function k({schema:O,self:P}){if(typeof O=="boolean")return!O;for(const U in O)if(P.RULES.all[U])return!0;return!1}function v(O){return typeof O.schema!="boolean"}function x(O,P){const{schema:U,gen:K,opts:J}=O;J.$comment&&U.$comment&&N(O),R(O),_(O);const ee=K.const("_errs",l.default.errors);C(O,ee),K.var(P,(0,a._)`${ee} === ${l.default.errors}`)}function E(O){(0,u.checkUnknownRules)(O),A(O)}function C(O,P){if(O.opts.jtd)return Z(O,[],!1,P);const U=(0,e.getSchemaTypes)(O.schema),K=(0,e.coerceAndCheckDataType)(O,U);Z(O,U,!K,P)}function A(O){const{schema:P,errSchemaPath:U,opts:K,self:J}=O;P.$ref&&K.ignoreKeywordsWithRef&&(0,u.schemaHasRulesButRef)(P,J.RULES)&&J.logger.warn(`$ref: keywords ignored in schema at path "${U}"`)}function z(O){const{schema:P,opts:U}=O;P.default!==void 0&&U.useDefaults&&U.strictSchema&&(0,u.checkStrictMode)(O,"default is ignored in the schema root")}function R(O){const P=O.schema[O.opts.schemaId];P&&(O.baseId=(0,c.resolveUrl)(O.opts.uriResolver,O.baseId,P))}function _(O){if(O.schema.$async&&!O.schemaEnv.$async)throw new Error("async schema in sync schema")}function N({gen:O,schemaEnv:P,schema:U,errSchemaPath:K,opts:J}){const ee=U.$comment;if(J.$comment===!0)O.code((0,a._)`${l.default.self}.logger.log(${ee})`);else if(typeof J.$comment=="function"){const ie=(0,a.str)`${K}/$comment`,oe=O.scopeValue("root",{ref:P.root});O.code((0,a._)`${l.default.self}.opts.$comment(${ee}, ${ie}, ${oe}.schema)`)}}function L(O){const{gen:P,schemaEnv:U,validateName:K,ValidationError:J,opts:ee}=O;U.$async?P.if((0,a._)`${l.default.errors} === 0`,()=>P.return(l.default.data),()=>P.throw((0,a._)`new ${J}(${l.default.vErrors})`)):(P.assign((0,a._)`${K}.errors`,l.default.vErrors),ee.unevaluated&&H(O),P.return((0,a._)`${l.default.errors} === 0`))}function H({gen:O,evaluated:P,props:U,items:K}){U instanceof a.Name&&O.assign((0,a._)`${P}.props`,U),K instanceof a.Name&&O.assign((0,a._)`${P}.items`,K)}function Z(O,P,U,K){const{gen:J,schema:ee,data:ie,allErrors:oe,opts:ne,self:le}=O,{RULES:Q}=le;if(ee.$ref&&(ne.ignoreKeywordsWithRef||!(0,u.schemaHasRulesButRef)(ee,Q))){J.block(()=>Y(O,"$ref",Q.all.$ref.definition));return}ne.jtd||q(O,P),J.block(()=>{for(const ye of Q.rules)fe(ye);fe(Q.post)});function fe(ye){(0,n.shouldUseGroup)(ee,ye)&&(ye.type?(J.if((0,r.checkDataType)(ye.type,ie,ne.strictNumbers)),W(O,ye),P.length===1&&P[0]===ye.type&&U&&(J.else(),(0,r.reportTypeError)(O)),J.endIf()):W(O,ye),oe||J.if((0,a._)`${l.default.errors} === ${K||0}`))}}function W(O,P){const{gen:U,schema:K,opts:{useDefaults:J}}=O;J&&(0,o.assignDefaults)(O,P.type),U.block(()=>{for(const ee of P.rules)(0,n.shouldUseRule)(K,ee)&&Y(O,ee.keyword,ee.definition,P.type)})}function q(O,P){O.schemaEnv.meta||!O.opts.strictTypes||(V(O,P),O.opts.allowUnionTypes||D(O,P),j(O,O.dataTypes))}function V(O,P){if(P.length){if(!O.dataTypes.length){O.dataTypes=P;return}P.forEach(U=>{F(O.dataTypes,U)||$(O,`type "${U}" not allowed by context "${O.dataTypes.join(",")}"`)}),T(O,P)}}function D(O,P){P.length>1&&!(P.length===2&&P.includes("null"))&&$(O,"use allowUnionTypes to allow union type keyword")}function j(O,P){const U=O.self.RULES.all;for(const K in U){const J=U[K];if(typeof J=="object"&&(0,n.shouldUseRule)(O.schema,J)){const{type:ee}=J.definition;ee.length&&!ee.some(ie=>B(P,ie))&&$(O,`missing type "${ee.join(",")}" for keyword "${K}"`)}}}function B(O,P){return O.includes(P)||P==="number"&&O.includes("integer")}function F(O,P){return O.includes(P)||P==="integer"&&O.includes("number")}function T(O,P){const U=[];for(const K of O.dataTypes)F(P,K)?U.push(K):P.includes("integer")&&K==="number"&&U.push("integer");O.dataTypes=U}function $(O,P){const U=O.schemaEnv.baseId+O.errSchemaPath;P+=` at "${U}" (strictTypes)`,(0,u.checkStrictMode)(O,P,O.opts.strictTypes)}class I{constructor(P,U,K){if((0,s.validateKeywordUsage)(P,U,K),this.gen=P.gen,this.allErrors=P.allErrors,this.keyword=K,this.data=P.data,this.schema=P.schema[K],this.$data=U.$data&&P.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,u.schemaRefOrVal)(P,this.schema,K,this.$data),this.schemaType=U.schemaType,this.parentSchema=P.schema,this.params={},this.it=P,this.def=U,this.$data)this.schemaCode=P.gen.const("vSchema",se(this.$data,P));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,U.schemaType,U.allowUndefined))throw new Error(`${K} value must be ${JSON.stringify(U.schemaType)}`);("code"in U?U.trackErrors:U.errors!==!1)&&(this.errsCount=P.gen.const("_errs",l.default.errors))}result(P,U,K){this.failResult((0,a.not)(P),U,K)}failResult(P,U,K){this.gen.if(P),K?K():this.error(),U?(this.gen.else(),U(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(P,U){this.failResult((0,a.not)(P),void 0,U)}fail(P){if(P===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(P),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(P){if(!this.$data)return this.fail(P);const{schemaCode:U}=this;this.fail((0,a._)`${U} !== undefined && (${(0,a.or)(this.invalid$data(),P)})`)}error(P,U,K){if(U){this.setParams(U),this._error(P,K),this.setParams({});return}this._error(P,K)}_error(P,U){(P?d.reportExtraError:d.reportError)(this,this.def.error,U)}$dataError(){(0,d.reportError)(this,this.def.$dataError||d.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,d.resetErrorsCount)(this.gen,this.errsCount)}ok(P){this.allErrors||this.gen.if(P)}setParams(P,U){U?Object.assign(this.params,P):this.params=P}block$data(P,U,K=a.nil){this.gen.block(()=>{this.check$data(P,K),U()})}check$data(P=a.nil,U=a.nil){if(!this.$data)return;const{gen:K,schemaCode:J,schemaType:ee,def:ie}=this;K.if((0,a.or)((0,a._)`${J} === undefined`,U)),P!==a.nil&&K.assign(P,!0),(ee.length||ie.validateSchema)&&(K.elseIf(this.invalid$data()),this.$dataError(),P!==a.nil&&K.assign(P,!1)),K.else()}invalid$data(){const{gen:P,schemaCode:U,schemaType:K,def:J,it:ee}=this;return(0,a.or)(ie(),oe());function ie(){if(K.length){if(!(U instanceof a.Name))throw new Error("ajv implementation error");const ne=Array.isArray(K)?K:[K];return(0,a._)`${(0,r.checkDataTypes)(ne,U,ee.opts.strictNumbers,r.DataType.Wrong)}`}return a.nil}function oe(){if(J.validateSchema){const ne=P.scopeValue("validate$data",{ref:J.validateSchema});return(0,a._)`!${ne}(${U})`}return a.nil}}subschema(P,U){const K=(0,i.getSubschema)(this.it,P);(0,i.extendSubschemaData)(K,this.it,P),(0,i.extendSubschemaMode)(K,P);const J={...this.it,...K,items:void 0,props:void 0};return w(J,U),J}mergeEvaluated(P,U){const{it:K,gen:J}=this;K.opts.unevaluated&&(K.props!==!0&&P.props!==void 0&&(K.props=u.mergeEvaluated.props(J,P.props,K.props,U)),K.items!==!0&&P.items!==void 0&&(K.items=u.mergeEvaluated.items(J,P.items,K.items,U)))}mergeValidEvaluated(P,U){const{it:K,gen:J}=this;if(K.opts.unevaluated&&(K.props!==!0||K.items!==!0))return J.if(U,()=>this.mergeEvaluated(P,a.Name)),!0}}kr.KeywordCxt=I;function Y(O,P,U,K){const J=new I(O,U,P);"code"in U?U.code(J,K):J.$data&&U.validate?(0,s.funcKeywordCode)(J,U):"macro"in U?(0,s.macroKeywordCode)(J,U):(U.compile||U.validate)&&(0,s.funcKeywordCode)(J,U)}const G=/^\/(?:[^~]|~0|~1)*$/,X=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function se(O,{dataLevel:P,dataNames:U,dataPathArr:K}){let J,ee;if(O==="")return l.default.rootData;if(O[0]==="/"){if(!G.test(O))throw new Error(`Invalid JSON-pointer: ${O}`);J=O,ee=l.default.rootData}else{const le=X.exec(O);if(!le)throw new Error(`Invalid JSON-pointer: ${O}`);const Q=+le[1];if(J=le[2],J==="#"){if(Q>=P)throw new Error(ne("property/index",Q));return K[P-Q]}if(Q>P)throw new Error(ne("data",Q));if(ee=U[P-Q],!J)return ee}let ie=ee;const oe=J.split("/");for(const le of oe)le&&(ee=(0,a._)`${ee}${(0,a.getProperty)((0,u.unescapeJsonPointer)(le))}`,ie=(0,a._)`${ie} && ${ee}`);return ie;function ne(le,Q){return`Cannot access ${le} ${Q} levels up, current level is ${P}`}}return kr.getData=se,kr}var Bl={},Pv;function Tg(){if(Pv)return Bl;Pv=1,Object.defineProperty(Bl,"__esModule",{value:!0});class t extends Error{constructor(n){super("validation failed"),this.errors=n,this.ajv=this.validation=!0}}return Bl.default=t,Bl}var Vl={},Av;function Bd(){if(Av)return Vl;Av=1,Object.defineProperty(Vl,"__esModule",{value:!0});const t=jd();class e extends Error{constructor(r,o,s,i){super(i||`can't resolve reference ${s} from id ${o}`),this.missingRef=(0,t.resolveUrl)(r,o,s),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(r,this.missingRef))}}return Vl.default=e,Vl}var yn={},Iv;function Mg(){if(Iv)return yn;Iv=1,Object.defineProperty(yn,"__esModule",{value:!0}),yn.resolveSchema=yn.getCompilingSchema=yn.resolveRef=yn.compileSchema=yn.SchemaEnv=void 0;const t=Be(),e=Tg(),n=Ao(),r=jd(),o=qe(),s=Fd();class i{constructor(y){var b;this.refs={},this.dynamicAnchors={};let w;typeof y.schema=="object"&&(w=y.schema),this.schema=y.schema,this.schemaId=y.schemaId,this.root=y.root||this,this.baseId=(b=y.baseId)!==null&&b!==void 0?b:(0,r.normalizeId)(w?.[y.schemaId||"$id"]),this.schemaPath=y.schemaPath,this.localRefs=y.localRefs,this.meta=y.meta,this.$async=w?.$async,this.refs={}}}yn.SchemaEnv=i;function a(m){const y=u.call(this,m);if(y)return y;const b=(0,r.getFullPath)(this.opts.uriResolver,m.root.baseId),{es5:w,lines:k}=this.opts.code,{ownProperties:v}=this.opts,x=new t.CodeGen(this.scope,{es5:w,lines:k,ownProperties:v});let E;m.$async&&(E=x.scopeValue("Error",{ref:e.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));const C=x.scopeName("validate");m.validateName=C;const A={gen:x,allErrors:this.opts.allErrors,data:n.default.data,parentData:n.default.parentData,parentDataProperty:n.default.parentDataProperty,dataNames:[n.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:x.scopeValue("schema",this.opts.code.source===!0?{ref:m.schema,code:(0,t.stringify)(m.schema)}:{ref:m.schema}),validateName:C,ValidationError:E,schema:m.schema,schemaEnv:m,rootId:b,baseId:m.baseId||b,schemaPath:t.nil,errSchemaPath:m.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this};let z;try{this._compilations.add(m),(0,s.validateFunctionCode)(A),x.optimize(this.opts.code.optimize);const R=x.toString();z=`${x.scopeRefs(n.default.scope)}return ${R}`,this.opts.code.process&&(z=this.opts.code.process(z,m));const N=new Function(`${n.default.self}`,`${n.default.scope}`,z)(this,this.scope.get());if(this.scope.value(C,{ref:N}),N.errors=null,N.schema=m.schema,N.schemaEnv=m,m.$async&&(N.$async=!0),this.opts.code.source===!0&&(N.source={validateName:C,validateCode:R,scopeValues:x._values}),this.opts.unevaluated){const{props:L,items:H}=A;N.evaluated={props:L instanceof t.Name?void 0:L,items:H instanceof t.Name?void 0:H,dynamicProps:L instanceof t.Name,dynamicItems:H instanceof t.Name},N.source&&(N.source.evaluated=(0,t.stringify)(N.evaluated))}return m.validate=N,m}catch(R){throw delete m.validate,delete m.validateName,z&&this.logger.error("Error compiling schema, function code:",z),R}finally{this._compilations.delete(m)}}yn.compileSchema=a;function l(m,y,b){var w;b=(0,r.resolveUrl)(this.opts.uriResolver,y,b);const k=m.refs[b];if(k)return k;let v=f.call(this,m,b);if(v===void 0){const x=(w=m.localRefs)===null||w===void 0?void 0:w[b],{schemaId:E}=this.opts;x&&(v=new i({schema:x,schemaId:E,root:m,baseId:y}))}if(v!==void 0)return m.refs[b]=c.call(this,v)}yn.resolveRef=l;function c(m){return(0,r.inlineRef)(m.schema,this.opts.inlineRefs)?m.schema:m.validate?m:a.call(this,m)}function u(m){for(const y of this._compilations)if(d(y,m))return y}yn.getCompilingSchema=u;function d(m,y){return m.schema===y.schema&&m.root===y.root&&m.baseId===y.baseId}function f(m,y){let b;for(;typeof(b=this.refs[y])=="string";)y=b;return b||this.schemas[y]||h.call(this,m,y)}function h(m,y){const b=this.opts.uriResolver.parse(y),w=(0,r._getFullPath)(this.opts.uriResolver,b);let k=(0,r.getFullPath)(this.opts.uriResolver,m.baseId,void 0);if(Object.keys(m.schema).length>0&&w===k)return g.call(this,b,m);const v=(0,r.normalizeId)(w),x=this.refs[v]||this.schemas[v];if(typeof x=="string"){const E=h.call(this,m,x);return typeof E?.schema!="object"?void 0:g.call(this,b,E)}if(typeof x?.schema=="object"){if(x.validate||a.call(this,x),v===(0,r.normalizeId)(y)){const{schema:E}=x,{schemaId:C}=this.opts,A=E[C];return A&&(k=(0,r.resolveUrl)(this.opts.uriResolver,k,A)),new i({schema:E,schemaId:C,root:m,baseId:k})}return g.call(this,b,x)}}yn.resolveSchema=h;const p=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function g(m,{baseId:y,schema:b,root:w}){var k;if(((k=m.fragment)===null||k===void 0?void 0:k[0])!=="/")return;for(const E of m.fragment.slice(1).split("/")){if(typeof b=="boolean")return;const C=b[(0,o.unescapeFragment)(E)];if(C===void 0)return;b=C;const A=typeof b=="object"&&b[this.opts.schemaId];!p.has(E)&&A&&(y=(0,r.resolveUrl)(this.opts.uriResolver,y,A))}let v;if(typeof b!="boolean"&&b.$ref&&!(0,o.schemaHasRulesButRef)(b,this.RULES)){const E=(0,r.resolveUrl)(this.opts.uriResolver,y,b.$ref);v=h.call(this,w,E)}const{schemaId:x}=this.opts;if(v=v||new i({schema:b,schemaId:x,root:w,baseId:y}),v.schema!==v.root.schema)return v}return yn}const T6="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",M6="Meta-schema for $data reference (JSON AnySchema extension proposal)",R6="object",O6=["$data"],_6={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},N6=!1,P6={$id:T6,description:M6,type:R6,required:O6,properties:_6,additionalProperties:N6};var Hl={},Ki={exports:{}},Jf,$v;function _T(){if($v)return Jf;$v=1;const t=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),e=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function n(f){let h="",p=0,g=0;for(g=0;g<f.length;g++)if(p=f[g].charCodeAt(0),p!==48){if(!(p>=48&&p<=57||p>=65&&p<=70||p>=97&&p<=102))return"";h+=f[g];break}for(g+=1;g<f.length;g++){if(p=f[g].charCodeAt(0),!(p>=48&&p<=57||p>=65&&p<=70||p>=97&&p<=102))return"";h+=f[g]}return h}const r=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function o(f){return f.length=0,!0}function s(f,h,p){if(f.length){const g=n(f);if(g!=="")h.push(g);else return p.error=!0,!1;f.length=0}return!0}function i(f){let h=0;const p={error:!1,address:"",zone:""},g=[],m=[];let y=!1,b=!1,w=s;for(let k=0;k<f.length;k++){const v=f[k];if(!(v==="["||v==="]"))if(v===":"){if(y===!0&&(b=!0),!w(m,g,p))break;if(++h>7){p.error=!0;break}k>0&&f[k-1]===":"&&(y=!0),g.push(":");continue}else if(v==="%"){if(!w(m,g,p))break;w=o}else{m.push(v);continue}}return m.length&&(w===o?p.zone=m.join(""):b?g.push(m.join("")):g.push(n(m))),p.address=g.join(""),p}function a(f){if(l(f,":")<2)return{host:f,isIPV6:!1};const h=i(f);if(h.error)return{host:f,isIPV6:!1};{let p=h.address,g=h.address;return h.zone&&(p+="%"+h.zone,g+="%25"+h.zone),{host:p,isIPV6:!0,escapedHost:g}}}function l(f,h){let p=0;for(let g=0;g<f.length;g++)f[g]===h&&p++;return p}function c(f){let h=f;const p=[];let g=-1,m=0;for(;m=h.length;){if(m===1){if(h===".")break;if(h==="/"){p.push("/");break}else{p.push(h);break}}else if(m===2){if(h[0]==="."){if(h[1]===".")break;if(h[1]==="/"){h=h.slice(2);continue}}else if(h[0]==="/"&&(h[1]==="."||h[1]==="/")){p.push("/");break}}else if(m===3&&h==="/.."){p.length!==0&&p.pop(),p.push("/");break}if(h[0]==="."){if(h[1]==="."){if(h[2]==="/"){h=h.slice(3);continue}}else if(h[1]==="/"){h=h.slice(2);continue}}else if(h[0]==="/"&&h[1]==="."){if(h[2]==="/"){h=h.slice(2);continue}else if(h[2]==="."&&h[3]==="/"){h=h.slice(3),p.length!==0&&p.pop();continue}}if((g=h.indexOf("/",1))===-1){p.push(h);break}else p.push(h.slice(0,g)),h=h.slice(g)}return p.join("")}function u(f,h){const p=h!==!0?escape:unescape;return f.scheme!==void 0&&(f.scheme=p(f.scheme)),f.userinfo!==void 0&&(f.userinfo=p(f.userinfo)),f.host!==void 0&&(f.host=p(f.host)),f.path!==void 0&&(f.path=p(f.path)),f.query!==void 0&&(f.query=p(f.query)),f.fragment!==void 0&&(f.fragment=p(f.fragment)),f}function d(f){const h=[];if(f.userinfo!==void 0&&(h.push(f.userinfo),h.push("@")),f.host!==void 0){let p=unescape(f.host);if(!e(p)){const g=a(p);g.isIPV6===!0?p=`[${g.escapedHost}]`:p=f.host}h.push(p)}return(typeof f.port=="number"||typeof f.port=="string")&&(h.push(":"),h.push(String(f.port))),h.length?h.join(""):void 0}return Jf={nonSimpleDomain:r,recomposeAuthority:d,normalizeComponentEncoding:u,removeDotSegments:c,isIPv4:e,isUUID:t,normalizeIPv6:a,stringArrayToHexStripped:n},Jf}var Xf,Dv;function A6(){if(Dv)return Xf;Dv=1;const{isUUID:t}=_T(),e=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function r(v){return n.indexOf(v)!==-1}function o(v){return v.secure===!0?!0:v.secure===!1?!1:v.scheme?v.scheme.length===3&&(v.scheme[0]==="w"||v.scheme[0]==="W")&&(v.scheme[1]==="s"||v.scheme[1]==="S")&&(v.scheme[2]==="s"||v.scheme[2]==="S"):!1}function s(v){return v.host||(v.error=v.error||"HTTP URIs must have a host."),v}function i(v){const x=String(v.scheme).toLowerCase()==="https";return(v.port===(x?443:80)||v.port==="")&&(v.port=void 0),v.path||(v.path="/"),v}function a(v){return v.secure=o(v),v.resourceName=(v.path||"/")+(v.query?"?"+v.query:""),v.path=void 0,v.query=void 0,v}function l(v){if((v.port===(o(v)?443:80)||v.port==="")&&(v.port=void 0),typeof v.secure=="boolean"&&(v.scheme=v.secure?"wss":"ws",v.secure=void 0),v.resourceName){const[x,E]=v.resourceName.split("?");v.path=x&&x!=="/"?x:void 0,v.query=E,v.resourceName=void 0}return v.fragment=void 0,v}function c(v,x){if(!v.path)return v.error="URN can not be parsed",v;const E=v.path.match(e);if(E){const C=x.scheme||v.scheme||"urn";v.nid=E[1].toLowerCase(),v.nss=E[2];const A=`${C}:${x.nid||v.nid}`,z=k(A);v.path=void 0,z&&(v=z.parse(v,x))}else v.error=v.error||"URN can not be parsed.";return v}function u(v,x){if(v.nid===void 0)throw new Error("URN without nid cannot be serialized");const E=x.scheme||v.scheme||"urn",C=v.nid.toLowerCase(),A=`${E}:${x.nid||C}`,z=k(A);z&&(v=z.serialize(v,x));const R=v,_=v.nss;return R.path=`${C||x.nid}:${_}`,x.skipEscape=!0,R}function d(v,x){const E=v;return E.uuid=E.nss,E.nss=void 0,!x.tolerant&&(!E.uuid||!t(E.uuid))&&(E.error=E.error||"UUID is not valid."),E}function f(v){const x=v;return x.nss=(v.uuid||"").toLowerCase(),x}const h={scheme:"http",domainHost:!0,parse:s,serialize:i},p={scheme:"https",domainHost:h.domainHost,parse:s,serialize:i},g={scheme:"ws",domainHost:!0,parse:a,serialize:l},m={scheme:"wss",domainHost:g.domainHost,parse:g.parse,serialize:g.serialize},w={http:h,https:p,ws:g,wss:m,urn:{scheme:"urn",parse:c,serialize:u,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:d,serialize:f,skipNormalize:!0}};Object.setPrototypeOf(w,null);function k(v){return v&&(w[v]||w[v.toLowerCase()])||void 0}return Xf={wsIsSecure:o,SCHEMES:w,isValidSchemeName:r,getSchemeHandler:k},Xf}var zv;function I6(){if(zv)return Ki.exports;zv=1;const{normalizeIPv6:t,removeDotSegments:e,recomposeAuthority:n,normalizeComponentEncoding:r,isIPv4:o,nonSimpleDomain:s}=_T(),{SCHEMES:i,getSchemeHandler:a}=A6();function l(m,y){return typeof m=="string"?m=f(p(m,y),y):typeof m=="object"&&(m=p(f(m,y),y)),m}function c(m,y,b){const w=b?Object.assign({scheme:"null"},b):{scheme:"null"},k=u(p(m,w),p(y,w),w,!0);return w.skipEscape=!0,f(k,w)}function u(m,y,b,w){const k={};return w||(m=p(f(m,b),b),y=p(f(y,b),b)),b=b||{},!b.tolerant&&y.scheme?(k.scheme=y.scheme,k.userinfo=y.userinfo,k.host=y.host,k.port=y.port,k.path=e(y.path||""),k.query=y.query):(y.userinfo!==void 0||y.host!==void 0||y.port!==void 0?(k.userinfo=y.userinfo,k.host=y.host,k.port=y.port,k.path=e(y.path||""),k.query=y.query):(y.path?(y.path[0]==="/"?k.path=e(y.path):((m.userinfo!==void 0||m.host!==void 0||m.port!==void 0)&&!m.path?k.path="/"+y.path:m.path?k.path=m.path.slice(0,m.path.lastIndexOf("/")+1)+y.path:k.path=y.path,k.path=e(k.path)),k.query=y.query):(k.path=m.path,y.query!==void 0?k.query=y.query:k.query=m.query),k.userinfo=m.userinfo,k.host=m.host,k.port=m.port),k.scheme=m.scheme),k.fragment=y.fragment,k}function d(m,y,b){return typeof m=="string"?(m=unescape(m),m=f(r(p(m,b),!0),{...b,skipEscape:!0})):typeof m=="object"&&(m=f(r(m,!0),{...b,skipEscape:!0})),typeof y=="string"?(y=unescape(y),y=f(r(p(y,b),!0),{...b,skipEscape:!0})):typeof y=="object"&&(y=f(r(y,!0),{...b,skipEscape:!0})),m.toLowerCase()===y.toLowerCase()}function f(m,y){const b={host:m.host,scheme:m.scheme,userinfo:m.userinfo,port:m.port,path:m.path,query:m.query,nid:m.nid,nss:m.nss,uuid:m.uuid,fragment:m.fragment,reference:m.reference,resourceName:m.resourceName,secure:m.secure,error:""},w=Object.assign({},y),k=[],v=a(w.scheme||b.scheme);v&&v.serialize&&v.serialize(b,w),b.path!==void 0&&(w.skipEscape?b.path=unescape(b.path):(b.path=escape(b.path),b.scheme!==void 0&&(b.path=b.path.split("%3A").join(":")))),w.reference!=="suffix"&&b.scheme&&k.push(b.scheme,":");const x=n(b);if(x!==void 0&&(w.reference!=="suffix"&&k.push("//"),k.push(x),b.path&&b.path[0]!=="/"&&k.push("/")),b.path!==void 0){let E=b.path;!w.absolutePath&&(!v||!v.absolutePath)&&(E=e(E)),x===void 0&&E[0]==="/"&&E[1]==="/"&&(E="/%2F"+E.slice(2)),k.push(E)}return b.query!==void 0&&k.push("?",b.query),b.fragment!==void 0&&k.push("#",b.fragment),k.join("")}const h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function p(m,y){const b=Object.assign({},y),w={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let k=!1;b.reference==="suffix"&&(b.scheme?m=b.scheme+":"+m:m="//"+m);const v=m.match(h);if(v){if(w.scheme=v[1],w.userinfo=v[3],w.host=v[4],w.port=parseInt(v[5],10),w.path=v[6]||"",w.query=v[7],w.fragment=v[8],isNaN(w.port)&&(w.port=v[5]),w.host)if(o(w.host)===!1){const C=t(w.host);w.host=C.host.toLowerCase(),k=C.isIPV6}else k=!0;w.scheme===void 0&&w.userinfo===void 0&&w.host===void 0&&w.port===void 0&&w.query===void 0&&!w.path?w.reference="same-document":w.scheme===void 0?w.reference="relative":w.fragment===void 0?w.reference="absolute":w.reference="uri",b.reference&&b.reference!=="suffix"&&b.reference!==w.reference&&(w.error=w.error||"URI is not a "+b.reference+" reference.");const x=a(b.scheme||w.scheme);if(!b.unicodeSupport&&(!x||!x.unicodeSupport)&&w.host&&(b.domainHost||x&&x.domainHost)&&k===!1&&s(w.host))try{w.host=URL.domainToASCII(w.host.toLowerCase())}catch(E){w.error=w.error||"Host's domain name can not be converted to ASCII: "+E}(!x||x&&!x.skipNormalize)&&(m.indexOf("%")!==-1&&(w.scheme!==void 0&&(w.scheme=unescape(w.scheme)),w.host!==void 0&&(w.host=unescape(w.host))),w.path&&(w.path=escape(unescape(w.path))),w.fragment&&(w.fragment=encodeURI(decodeURIComponent(w.fragment)))),x&&x.parse&&x.parse(w,b)}else w.error=w.error||"URI can not be parsed.";return w}const g={SCHEMES:i,normalize:l,resolve:c,resolveComponent:u,equal:d,serialize:f,parse:p};return Ki.exports=g,Ki.exports.default=g,Ki.exports.fastUri=g,Ki.exports}var Lv;function $6(){if(Lv)return Hl;Lv=1,Object.defineProperty(Hl,"__esModule",{value:!0});const t=I6();return t.code='require("ajv/dist/runtime/uri").default',Hl.default=t,Hl}var jv;function D6(){return jv||(jv=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var e=Fd();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var n=Be();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return n.CodeGen}});const r=Tg(),o=Bd(),s=MT(),i=Mg(),a=Be(),l=jd(),c=Xu(),u=qe(),d=P6,f=$6(),h=(D,j)=>new RegExp(D,j);h.code="new RegExp";const p=["removeAdditional","useDefaults","coerceTypes"],g=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),m={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},y={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},b=200;function w(D){var j,B,F,T,$,I,Y,G,X,se,O,P,U,K,J,ee,ie,oe,ne,le,Q,fe,ye,he,Ue;const Ze=D.strict,ft=(j=D.code)===null||j===void 0?void 0:j.optimize,Ve=ft===!0||ft===void 0?1:ft||0,ze=(F=(B=D.code)===null||B===void 0?void 0:B.regExp)!==null&&F!==void 0?F:h,Ye=(T=D.uriResolver)!==null&&T!==void 0?T:f.default;return{strictSchema:(I=($=D.strictSchema)!==null&&$!==void 0?$:Ze)!==null&&I!==void 0?I:!0,strictNumbers:(G=(Y=D.strictNumbers)!==null&&Y!==void 0?Y:Ze)!==null&&G!==void 0?G:!0,strictTypes:(se=(X=D.strictTypes)!==null&&X!==void 0?X:Ze)!==null&&se!==void 0?se:"log",strictTuples:(P=(O=D.strictTuples)!==null&&O!==void 0?O:Ze)!==null&&P!==void 0?P:"log",strictRequired:(K=(U=D.strictRequired)!==null&&U!==void 0?U:Ze)!==null&&K!==void 0?K:!1,code:D.code?{...D.code,optimize:Ve,regExp:ze}:{optimize:Ve,regExp:ze},loopRequired:(J=D.loopRequired)!==null&&J!==void 0?J:b,loopEnum:(ee=D.loopEnum)!==null&&ee!==void 0?ee:b,meta:(ie=D.meta)!==null&&ie!==void 0?ie:!0,messages:(oe=D.messages)!==null&&oe!==void 0?oe:!0,inlineRefs:(ne=D.inlineRefs)!==null&&ne!==void 0?ne:!0,schemaId:(le=D.schemaId)!==null&&le!==void 0?le:"$id",addUsedSchema:(Q=D.addUsedSchema)!==null&&Q!==void 0?Q:!0,validateSchema:(fe=D.validateSchema)!==null&&fe!==void 0?fe:!0,validateFormats:(ye=D.validateFormats)!==null&&ye!==void 0?ye:!0,unicodeRegExp:(he=D.unicodeRegExp)!==null&&he!==void 0?he:!0,int32range:(Ue=D.int32range)!==null&&Ue!==void 0?Ue:!0,uriResolver:Ye}}class k{constructor(j={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,j=this.opts={...j,...w(j)};const{es5:B,lines:F}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:g,es5:B,lines:F}),this.logger=_(j.logger);const T=j.validateFormats;j.validateFormats=!1,this.RULES=(0,s.getRules)(),v.call(this,m,j,"NOT SUPPORTED"),v.call(this,y,j,"DEPRECATED","warn"),this._metaOpts=z.call(this),j.formats&&C.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),j.keywords&&A.call(this,j.keywords),typeof j.meta=="object"&&this.addMetaSchema(j.meta),E.call(this),j.validateFormats=T}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:j,meta:B,schemaId:F}=this.opts;let T=d;F==="id"&&(T={...d},T.id=T.$id,delete T.$id),B&&j&&this.addMetaSchema(T,T[F],!1)}defaultMeta(){const{meta:j,schemaId:B}=this.opts;return this.opts.defaultMeta=typeof j=="object"?j[B]||j:void 0}validate(j,B){let F;if(typeof j=="string"){if(F=this.getSchema(j),!F)throw new Error(`no schema with key or ref "${j}"`)}else F=this.compile(j);const T=F(B);return"$async"in F||(this.errors=F.errors),T}compile(j,B){const F=this._addSchema(j,B);return F.validate||this._compileSchemaEnv(F)}compileAsync(j,B){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:F}=this.opts;return T.call(this,j,B);async function T(se,O){await $.call(this,se.$schema);const P=this._addSchema(se,O);return P.validate||I.call(this,P)}async function $(se){se&&!this.getSchema(se)&&await T.call(this,{$ref:se},!0)}async function I(se){try{return this._compileSchemaEnv(se)}catch(O){if(!(O instanceof o.default))throw O;return Y.call(this,O),await G.call(this,O.missingSchema),I.call(this,se)}}function Y({missingSchema:se,missingRef:O}){if(this.refs[se])throw new Error(`AnySchema ${se} is loaded but ${O} cannot be resolved`)}async function G(se){const O=await X.call(this,se);this.refs[se]||await $.call(this,O.$schema),this.refs[se]||this.addSchema(O,se,B)}async function X(se){const O=this._loading[se];if(O)return O;try{return await(this._loading[se]=F(se))}finally{delete this._loading[se]}}}addSchema(j,B,F,T=this.opts.validateSchema){if(Array.isArray(j)){for(const I of j)this.addSchema(I,void 0,F,T);return this}let $;if(typeof j=="object"){const{schemaId:I}=this.opts;if($=j[I],$!==void 0&&typeof $!="string")throw new Error(`schema ${I} must be string`)}return B=(0,l.normalizeId)(B||$),this._checkUnique(B),this.schemas[B]=this._addSchema(j,F,B,T,!0),this}addMetaSchema(j,B,F=this.opts.validateSchema){return this.addSchema(j,B,!0,F),this}validateSchema(j,B){if(typeof j=="boolean")return!0;let F;if(F=j.$schema,F!==void 0&&typeof F!="string")throw new Error("$schema must be a string");if(F=F||this.opts.defaultMeta||this.defaultMeta(),!F)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const T=this.validate(F,j);if(!T&&B){const $="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error($);else throw new Error($)}return T}getSchema(j){let B;for(;typeof(B=x.call(this,j))=="string";)j=B;if(B===void 0){const{schemaId:F}=this.opts,T=new i.SchemaEnv({schema:{},schemaId:F});if(B=i.resolveSchema.call(this,T,j),!B)return;this.refs[j]=B}return B.validate||this._compileSchemaEnv(B)}removeSchema(j){if(j instanceof RegExp)return this._removeAllSchemas(this.schemas,j),this._removeAllSchemas(this.refs,j),this;switch(typeof j){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const B=x.call(this,j);return typeof B=="object"&&this._cache.delete(B.schema),delete this.schemas[j],delete this.refs[j],this}case"object":{const B=j;this._cache.delete(B);let F=j[this.opts.schemaId];return F&&(F=(0,l.normalizeId)(F),delete this.schemas[F],delete this.refs[F]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(j){for(const B of j)this.addKeyword(B);return this}addKeyword(j,B){let F;if(typeof j=="string")F=j,typeof B=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),B.keyword=F);else if(typeof j=="object"&&B===void 0){if(B=j,F=B.keyword,Array.isArray(F)&&!F.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(L.call(this,F,B),!B)return(0,u.eachItem)(F,$=>H.call(this,$)),this;W.call(this,B);const T={...B,type:(0,c.getJSONTypes)(B.type),schemaType:(0,c.getJSONTypes)(B.schemaType)};return(0,u.eachItem)(F,T.type.length===0?$=>H.call(this,$,T):$=>T.type.forEach(I=>H.call(this,$,T,I))),this}getKeyword(j){const B=this.RULES.all[j];return typeof B=="object"?B.definition:!!B}removeKeyword(j){const{RULES:B}=this;delete B.keywords[j],delete B.all[j];for(const F of B.rules){const T=F.rules.findIndex($=>$.keyword===j);T>=0&&F.rules.splice(T,1)}return this}addFormat(j,B){return typeof B=="string"&&(B=new RegExp(B)),this.formats[j]=B,this}errorsText(j=this.errors,{separator:B=", ",dataVar:F="data"}={}){return!j||j.length===0?"No errors":j.map(T=>`${F}${T.instancePath} ${T.message}`).reduce((T,$)=>T+B+$)}$dataMetaSchema(j,B){const F=this.RULES.all;j=JSON.parse(JSON.stringify(j));for(const T of B){const $=T.split("/").slice(1);let I=j;for(const Y of $)I=I[Y];for(const Y in F){const G=F[Y];if(typeof G!="object")continue;const{$data:X}=G.definition,se=I[Y];X&&se&&(I[Y]=V(se))}}return j}_removeAllSchemas(j,B){for(const F in j){const T=j[F];(!B||B.test(F))&&(typeof T=="string"?delete j[F]:T&&!T.meta&&(this._cache.delete(T.schema),delete j[F]))}}_addSchema(j,B,F,T=this.opts.validateSchema,$=this.opts.addUsedSchema){let I;const{schemaId:Y}=this.opts;if(typeof j=="object")I=j[Y];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof j!="boolean")throw new Error("schema must be object or boolean")}let G=this._cache.get(j);if(G!==void 0)return G;F=(0,l.normalizeId)(I||F);const X=l.getSchemaRefs.call(this,j,F);return G=new i.SchemaEnv({schema:j,schemaId:Y,meta:B,baseId:F,localRefs:X}),this._cache.set(G.schema,G),$&&!F.startsWith("#")&&(F&&this._checkUnique(F),this.refs[F]=G),T&&this.validateSchema(j,!0),G}_checkUnique(j){if(this.schemas[j]||this.refs[j])throw new Error(`schema with key or id "${j}" already exists`)}_compileSchemaEnv(j){if(j.meta?this._compileMetaSchema(j):i.compileSchema.call(this,j),!j.validate)throw new Error("ajv implementation error");return j.validate}_compileMetaSchema(j){const B=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,j)}finally{this.opts=B}}}k.ValidationError=r.default,k.MissingRefError=o.default,t.default=k;function v(D,j,B,F="error"){for(const T in D){const $=T;$ in j&&this.logger[F](`${B}: option ${T}. ${D[$]}`)}}function x(D){return D=(0,l.normalizeId)(D),this.schemas[D]||this.refs[D]}function E(){const D=this.opts.schemas;if(D)if(Array.isArray(D))this.addSchema(D);else for(const j in D)this.addSchema(D[j],j)}function C(){for(const D in this.opts.formats){const j=this.opts.formats[D];j&&this.addFormat(D,j)}}function A(D){if(Array.isArray(D)){this.addVocabulary(D);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const j in D){const B=D[j];B.keyword||(B.keyword=j),this.addKeyword(B)}}function z(){const D={...this.opts};for(const j of p)delete D[j];return D}const R={log(){},warn(){},error(){}};function _(D){if(D===!1)return R;if(D===void 0)return console;if(D.log&&D.warn&&D.error)return D;throw new Error("logger must implement log, warn and error methods")}const N=/^[a-z_$][a-z0-9_$:-]*$/i;function L(D,j){const{RULES:B}=this;if((0,u.eachItem)(D,F=>{if(B.keywords[F])throw new Error(`Keyword ${F} is already defined`);if(!N.test(F))throw new Error(`Keyword ${F} has invalid name`)}),!!j&&j.$data&&!("code"in j||"validate"in j))throw new Error('$data keyword must have "code" or "validate" function')}function H(D,j,B){var F;const T=j?.post;if(B&&T)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:$}=this;let I=T?$.post:$.rules.find(({type:G})=>G===B);if(I||(I={type:B,rules:[]},$.rules.push(I)),$.keywords[D]=!0,!j)return;const Y={keyword:D,definition:{...j,type:(0,c.getJSONTypes)(j.type),schemaType:(0,c.getJSONTypes)(j.schemaType)}};j.before?Z.call(this,I,Y,j.before):I.rules.push(Y),$.all[D]=Y,(F=j.implements)===null||F===void 0||F.forEach(G=>this.addKeyword(G))}function Z(D,j,B){const F=D.rules.findIndex(T=>T.keyword===B);F>=0?D.rules.splice(F,0,j):(D.rules.push(j),this.logger.warn(`rule ${B} is not defined`))}function W(D){let{metaSchema:j}=D;j!==void 0&&(D.$data&&this.opts.$data&&(j=V(j)),D.validateSchema=this.compile(j,!0))}const q={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function V(D){return{anyOf:[D,q]}}})(Wf)),Wf}var Wl={},ql={},Ul={},Fv;function z6(){if(Fv)return Ul;Fv=1,Object.defineProperty(Ul,"__esModule",{value:!0});const t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return Ul.default=t,Ul}var Ur={},Bv;function L6(){if(Bv)return Ur;Bv=1,Object.defineProperty(Ur,"__esModule",{value:!0}),Ur.callRef=Ur.getValidate=void 0;const t=Bd(),e=Zn(),n=Be(),r=Ao(),o=Mg(),s=qe(),i={keyword:"$ref",schemaType:"string",code(c){const{gen:u,schema:d,it:f}=c,{baseId:h,schemaEnv:p,validateName:g,opts:m,self:y}=f,{root:b}=p;if((d==="#"||d==="#/")&&h===b.baseId)return k();const w=o.resolveRef.call(y,b,h,d);if(w===void 0)throw new t.default(f.opts.uriResolver,h,d);if(w instanceof o.SchemaEnv)return v(w);return x(w);function k(){if(p===b)return l(c,g,p,p.$async);const E=u.scopeValue("root",{ref:b});return l(c,(0,n._)`${E}.validate`,b,b.$async)}function v(E){const C=a(c,E);l(c,C,E,E.$async)}function x(E){const C=u.scopeValue("schema",m.code.source===!0?{ref:E,code:(0,n.stringify)(E)}:{ref:E}),A=u.name("valid"),z=c.subschema({schema:E,dataTypes:[],schemaPath:n.nil,topSchemaRef:C,errSchemaPath:d},A);c.mergeEvaluated(z),c.ok(A)}}};function a(c,u){const{gen:d}=c;return u.validate?d.scopeValue("validate",{ref:u.validate}):(0,n._)`${d.scopeValue("wrapper",{ref:u})}.validate`}Ur.getValidate=a;function l(c,u,d,f){const{gen:h,it:p}=c,{allErrors:g,schemaEnv:m,opts:y}=p,b=y.passContext?r.default.this:n.nil;f?w():k();function w(){if(!m.$async)throw new Error("async schema referenced by sync schema");const E=h.let("valid");h.try(()=>{h.code((0,n._)`await ${(0,e.callValidateCode)(c,u,b)}`),x(u),g||h.assign(E,!0)},C=>{h.if((0,n._)`!(${C} instanceof ${p.ValidationError})`,()=>h.throw(C)),v(C),g||h.assign(E,!1)}),c.ok(E)}function k(){c.result((0,e.callValidateCode)(c,u,b),()=>x(u),()=>v(u))}function v(E){const C=(0,n._)`${E}.errors`;h.assign(r.default.vErrors,(0,n._)`${r.default.vErrors} === null ? ${C} : ${r.default.vErrors}.concat(${C})`),h.assign(r.default.errors,(0,n._)`${r.default.vErrors}.length`)}function x(E){var C;if(!p.opts.unevaluated)return;const A=(C=d?.validate)===null||C===void 0?void 0:C.evaluated;if(p.props!==!0)if(A&&!A.dynamicProps)A.props!==void 0&&(p.props=s.mergeEvaluated.props(h,A.props,p.props));else{const z=h.var("props",(0,n._)`${E}.evaluated.props`);p.props=s.mergeEvaluated.props(h,z,p.props,n.Name)}if(p.items!==!0)if(A&&!A.dynamicItems)A.items!==void 0&&(p.items=s.mergeEvaluated.items(h,A.items,p.items));else{const z=h.var("items",(0,n._)`${E}.evaluated.items`);p.items=s.mergeEvaluated.items(h,z,p.items,n.Name)}}}return Ur.callRef=l,Ur.default=i,Ur}var Vv;function j6(){if(Vv)return ql;Vv=1,Object.defineProperty(ql,"__esModule",{value:!0});const t=z6(),e=L6(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,e.default];return ql.default=n,ql}var Kl={},Yl={},Hv;function F6(){if(Hv)return Yl;Hv=1,Object.defineProperty(Yl,"__esModule",{value:!0});const t=Be(),e=t.operators,n={maximum:{okStr:"<=",ok:e.LTE,fail:e.GT},minimum:{okStr:">=",ok:e.GTE,fail:e.LT},exclusiveMaximum:{okStr:"<",ok:e.LT,fail:e.GTE},exclusiveMinimum:{okStr:">",ok:e.GT,fail:e.LTE}},r={message:({keyword:s,schemaCode:i})=>(0,t.str)`must be ${n[s].okStr} ${i}`,params:({keyword:s,schemaCode:i})=>(0,t._)`{comparison: ${n[s].okStr}, limit: ${i}}`},o={keyword:Object.keys(n),type:"number",schemaType:"number",$data:!0,error:r,code(s){const{keyword:i,data:a,schemaCode:l}=s;s.fail$data((0,t._)`${a} ${n[i].fail} ${l} || isNaN(${a})`)}};return Yl.default=o,Yl}var Zl={},Wv;function B6(){if(Wv)return Zl;Wv=1,Object.defineProperty(Zl,"__esModule",{value:!0});const t=Be(),n={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:r})=>(0,t.str)`must be multiple of ${r}`,params:({schemaCode:r})=>(0,t._)`{multipleOf: ${r}}`},code(r){const{gen:o,data:s,schemaCode:i,it:a}=r,l=a.opts.multipleOfPrecision,c=o.let("res"),u=l?(0,t._)`Math.abs(Math.round(${c}) - ${c}) > 1e-${l}`:(0,t._)`${c} !== parseInt(${c})`;r.fail$data((0,t._)`(${i} === 0 || (${c} = ${s}/${i}, ${u}))`)}};return Zl.default=n,Zl}var Gl={},Jl={},qv;function V6(){if(qv)return Jl;qv=1,Object.defineProperty(Jl,"__esModule",{value:!0});function t(e){const n=e.length;let r=0,o=0,s;for(;o<n;)r++,s=e.charCodeAt(o++),s>=55296&&s<=56319&&o<n&&(s=e.charCodeAt(o),(s&64512)===56320&&o++);return r}return Jl.default=t,t.code='require("ajv/dist/runtime/ucs2length").default',Jl}var Uv;function H6(){if(Uv)return Gl;Uv=1,Object.defineProperty(Gl,"__esModule",{value:!0});const t=Be(),e=qe(),n=V6(),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:s,schemaCode:i}){const a=s==="maxLength"?"more":"fewer";return(0,t.str)`must NOT have ${a} than ${i} characters`},params:({schemaCode:s})=>(0,t._)`{limit: ${s}}`},code(s){const{keyword:i,data:a,schemaCode:l,it:c}=s,u=i==="maxLength"?t.operators.GT:t.operators.LT,d=c.opts.unicode===!1?(0,t._)`${a}.length`:(0,t._)`${(0,e.useFunc)(s.gen,n.default)}(${a})`;s.fail$data((0,t._)`${d} ${u} ${l}`)}};return Gl.default=o,Gl}var Xl={},Kv;function W6(){if(Kv)return Xl;Kv=1,Object.defineProperty(Xl,"__esModule",{value:!0});const t=Zn(),e=qe(),n=Be(),o={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:s})=>(0,n.str)`must match pattern "${s}"`,params:({schemaCode:s})=>(0,n._)`{pattern: ${s}}`},code(s){const{gen:i,data:a,$data:l,schema:c,schemaCode:u,it:d}=s,f=d.opts.unicodeRegExp?"u":"";if(l){const{regExp:h}=d.opts.code,p=h.code==="new RegExp"?(0,n._)`new RegExp`:(0,e.useFunc)(i,h),g=i.let("valid");i.try(()=>i.assign(g,(0,n._)`${p}(${u}, ${f}).test(${a})`),()=>i.assign(g,!1)),s.fail$data((0,n._)`!${g}`)}else{const h=(0,t.usePattern)(s,c);s.fail$data((0,n._)`!${h}.test(${a})`)}}};return Xl.default=o,Xl}var Ql={},Yv;function q6(){if(Yv)return Ql;Yv=1,Object.defineProperty(Ql,"__esModule",{value:!0});const t=Be(),n={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:r,schemaCode:o}){const s=r==="maxProperties"?"more":"fewer";return(0,t.str)`must NOT have ${s} than ${o} properties`},params:({schemaCode:r})=>(0,t._)`{limit: ${r}}`},code(r){const{keyword:o,data:s,schemaCode:i}=r,a=o==="maxProperties"?t.operators.GT:t.operators.LT;r.fail$data((0,t._)`Object.keys(${s}).length ${a} ${i}`)}};return Ql.default=n,Ql}var ec={},Zv;function U6(){if(Zv)return ec;Zv=1,Object.defineProperty(ec,"__esModule",{value:!0});const t=Zn(),e=Be(),n=qe(),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:s}})=>(0,e.str)`must have required property '${s}'`,params:({params:{missingProperty:s}})=>(0,e._)`{missingProperty: ${s}}`},code(s){const{gen:i,schema:a,schemaCode:l,data:c,$data:u,it:d}=s,{opts:f}=d;if(!u&&a.length===0)return;const h=a.length>=f.loopRequired;if(d.allErrors?p():g(),f.strictRequired){const b=s.parentSchema.properties,{definedProperties:w}=s.it;for(const k of a)if(b?.[k]===void 0&&!w.has(k)){const v=d.schemaEnv.baseId+d.errSchemaPath,x=`required property "${k}" is not defined at "${v}" (strictRequired)`;(0,n.checkStrictMode)(d,x,d.opts.strictRequired)}}function p(){if(h||u)s.block$data(e.nil,m);else for(const b of a)(0,t.checkReportMissingProp)(s,b)}function g(){const b=i.let("missing");if(h||u){const w=i.let("valid",!0);s.block$data(w,()=>y(b,w)),s.ok(w)}else i.if((0,t.checkMissingProp)(s,a,b)),(0,t.reportMissingProp)(s,b),i.else()}function m(){i.forOf("prop",l,b=>{s.setParams({missingProperty:b}),i.if((0,t.noPropertyInData)(i,c,b,f.ownProperties),()=>s.error())})}function y(b,w){s.setParams({missingProperty:b}),i.forOf(b,l,()=>{i.assign(w,(0,t.propertyInData)(i,c,b,f.ownProperties)),i.if((0,e.not)(w),()=>{s.error(),i.break()})},e.nil)}}};return ec.default=o,ec}var tc={},Gv;function K6(){if(Gv)return tc;Gv=1,Object.defineProperty(tc,"__esModule",{value:!0});const t=Be(),n={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:r,schemaCode:o}){const s=r==="maxItems"?"more":"fewer";return(0,t.str)`must NOT have ${s} than ${o} items`},params:({schemaCode:r})=>(0,t._)`{limit: ${r}}`},code(r){const{keyword:o,data:s,schemaCode:i}=r,a=o==="maxItems"?t.operators.GT:t.operators.LT;r.fail$data((0,t._)`${s}.length ${a} ${i}`)}};return tc.default=n,tc}var nc={},rc={},Jv;function Rg(){if(Jv)return rc;Jv=1,Object.defineProperty(rc,"__esModule",{value:!0});const t=OT();return t.code='require("ajv/dist/runtime/equal").default',rc.default=t,rc}var Xv;function Y6(){if(Xv)return nc;Xv=1,Object.defineProperty(nc,"__esModule",{value:!0});const t=Xu(),e=Be(),n=qe(),r=Rg(),s={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i,j:a}})=>(0,e.str)`must NOT have duplicate items (items ## ${a} and ${i} are identical)`,params:({params:{i,j:a}})=>(0,e._)`{i: ${i}, j: ${a}}`},code(i){const{gen:a,data:l,$data:c,schema:u,parentSchema:d,schemaCode:f,it:h}=i;if(!c&&!u)return;const p=a.let("valid"),g=d.items?(0,t.getSchemaTypes)(d.items):[];i.block$data(p,m,(0,e._)`${f} === false`),i.ok(p);function m(){const k=a.let("i",(0,e._)`${l}.length`),v=a.let("j");i.setParams({i:k,j:v}),a.assign(p,!0),a.if((0,e._)`${k} > 1`,()=>(y()?b:w)(k,v))}function y(){return g.length>0&&!g.some(k=>k==="object"||k==="array")}function b(k,v){const x=a.name("item"),E=(0,t.checkDataTypes)(g,x,h.opts.strictNumbers,t.DataType.Wrong),C=a.const("indices",(0,e._)`{}`);a.for((0,e._)`;${k}--;`,()=>{a.let(x,(0,e._)`${l}[${k}]`),a.if(E,(0,e._)`continue`),g.length>1&&a.if((0,e._)`typeof ${x} == "string"`,(0,e._)`${x} += "_"`),a.if((0,e._)`typeof ${C}[${x}] == "number"`,()=>{a.assign(v,(0,e._)`${C}[${x}]`),i.error(),a.assign(p,!1).break()}).code((0,e._)`${C}[${x}] = ${k}`)})}function w(k,v){const x=(0,n.useFunc)(a,r.default),E=a.name("outer");a.label(E).for((0,e._)`;${k}--;`,()=>a.for((0,e._)`${v} = ${k}; ${v}--;`,()=>a.if((0,e._)`${x}(${l}[${k}], ${l}[${v}])`,()=>{i.error(),a.assign(p,!1).break(E)})))}}};return nc.default=s,nc}var oc={},Qv;function Z6(){if(Qv)return oc;Qv=1,Object.defineProperty(oc,"__esModule",{value:!0});const t=Be(),e=qe(),n=Rg(),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:s})=>(0,t._)`{allowedValue: ${s}}`},code(s){const{gen:i,data:a,$data:l,schemaCode:c,schema:u}=s;l||u&&typeof u=="object"?s.fail$data((0,t._)`!${(0,e.useFunc)(i,n.default)}(${a}, ${c})`):s.fail((0,t._)`${u} !== ${a}`)}};return oc.default=o,oc}var sc={},ew;function G6(){if(ew)return sc;ew=1,Object.defineProperty(sc,"__esModule",{value:!0});const t=Be(),e=qe(),n=Rg(),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:s})=>(0,t._)`{allowedValues: ${s}}`},code(s){const{gen:i,data:a,$data:l,schema:c,schemaCode:u,it:d}=s;if(!l&&c.length===0)throw new Error("enum must have non-empty array");const f=c.length>=d.opts.loopEnum;let h;const p=()=>h??(h=(0,e.useFunc)(i,n.default));let g;if(f||l)g=i.let("valid"),s.block$data(g,m);else{if(!Array.isArray(c))throw new Error("ajv implementation error");const b=i.const("vSchema",u);g=(0,t.or)(...c.map((w,k)=>y(b,k)))}s.pass(g);function m(){i.assign(g,!1),i.forOf("v",u,b=>i.if((0,t._)`${p()}(${a}, ${b})`,()=>i.assign(g,!0).break()))}function y(b,w){const k=c[w];return typeof k=="object"&&k!==null?(0,t._)`${p()}(${a}, ${b}[${w}])`:(0,t._)`${a} === ${k}`}}};return sc.default=o,sc}var tw;function J6(){if(tw)return Kl;tw=1,Object.defineProperty(Kl,"__esModule",{value:!0});const t=F6(),e=B6(),n=H6(),r=W6(),o=q6(),s=U6(),i=K6(),a=Y6(),l=Z6(),c=G6(),u=[t.default,e.default,n.default,r.default,o.default,s.default,i.default,a.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},l.default,c.default];return Kl.default=u,Kl}var ic={},Ds={},nw;function NT(){if(nw)return Ds;nw=1,Object.defineProperty(Ds,"__esModule",{value:!0}),Ds.validateAdditionalItems=void 0;const t=Be(),e=qe(),r={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:s}})=>(0,t.str)`must NOT have more than ${s} items`,params:({params:{len:s}})=>(0,t._)`{limit: ${s}}`},code(s){const{parentSchema:i,it:a}=s,{items:l}=i;if(!Array.isArray(l)){(0,e.checkStrictMode)(a,'"additionalItems" is ignored when "items" is not an array of schemas');return}o(s,l)}};function o(s,i){const{gen:a,schema:l,data:c,keyword:u,it:d}=s;d.items=!0;const f=a.const("len",(0,t._)`${c}.length`);if(l===!1)s.setParams({len:i.length}),s.pass((0,t._)`${f} <= ${i.length}`);else if(typeof l=="object"&&!(0,e.alwaysValidSchema)(d,l)){const p=a.var("valid",(0,t._)`${f} <= ${i.length}`);a.if((0,t.not)(p),()=>h(p)),s.ok(p)}function h(p){a.forRange("i",i.length,f,g=>{s.subschema({keyword:u,dataProp:g,dataPropType:e.Type.Num},p),d.allErrors||a.if((0,t.not)(p),()=>a.break())})}}return Ds.validateAdditionalItems=o,Ds.default=r,Ds}var ac={},zs={},rw;function PT(){if(rw)return zs;rw=1,Object.defineProperty(zs,"__esModule",{value:!0}),zs.validateTuple=void 0;const t=Be(),e=qe(),n=Zn(),r={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(s){const{schema:i,it:a}=s;if(Array.isArray(i))return o(s,"additionalItems",i);a.items=!0,!(0,e.alwaysValidSchema)(a,i)&&s.ok((0,n.validateArray)(s))}};function o(s,i,a=s.schema){const{gen:l,parentSchema:c,data:u,keyword:d,it:f}=s;g(c),f.opts.unevaluated&&a.length&&f.items!==!0&&(f.items=e.mergeEvaluated.items(l,a.length,f.items));const h=l.name("valid"),p=l.const("len",(0,t._)`${u}.length`);a.forEach((m,y)=>{(0,e.alwaysValidSchema)(f,m)||(l.if((0,t._)`${p} > ${y}`,()=>s.subschema({keyword:d,schemaProp:y,dataProp:y},h)),s.ok(h))});function g(m){const{opts:y,errSchemaPath:b}=f,w=a.length,k=w===m.minItems&&(w===m.maxItems||m[i]===!1);if(y.strictTuples&&!k){const v=`"${d}" is ${w}-tuple, but minItems or maxItems/${i} are not specified or different at path "${b}"`;(0,e.checkStrictMode)(f,v,y.strictTuples)}}}return zs.validateTuple=o,zs.default=r,zs}var ow;function X6(){if(ow)return ac;ow=1,Object.defineProperty(ac,"__esModule",{value:!0});const t=PT(),e={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:n=>(0,t.validateTuple)(n,"items")};return ac.default=e,ac}var lc={},sw;function Q6(){if(sw)return lc;sw=1,Object.defineProperty(lc,"__esModule",{value:!0});const t=Be(),e=qe(),n=Zn(),r=NT(),s={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:i}})=>(0,t.str)`must NOT have more than ${i} items`,params:({params:{len:i}})=>(0,t._)`{limit: ${i}}`},code(i){const{schema:a,parentSchema:l,it:c}=i,{prefixItems:u}=l;c.items=!0,!(0,e.alwaysValidSchema)(c,a)&&(u?(0,r.validateAdditionalItems)(i,u):i.ok((0,n.validateArray)(i)))}};return lc.default=s,lc}var cc={},iw;function eK(){if(iw)return cc;iw=1,Object.defineProperty(cc,"__esModule",{value:!0});const t=Be(),e=qe(),r={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:o,max:s}})=>s===void 0?(0,t.str)`must contain at least ${o} valid item(s)`:(0,t.str)`must contain at least ${o} and no more than ${s} valid item(s)`,params:({params:{min:o,max:s}})=>s===void 0?(0,t._)`{minContains: ${o}}`:(0,t._)`{minContains: ${o}, maxContains: ${s}}`},code(o){const{gen:s,schema:i,parentSchema:a,data:l,it:c}=o;let u,d;const{minContains:f,maxContains:h}=a;c.opts.next?(u=f===void 0?1:f,d=h):u=1;const p=s.const("len",(0,t._)`${l}.length`);if(o.setParams({min:u,max:d}),d===void 0&&u===0){(0,e.checkStrictMode)(c,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(d!==void 0&&u>d){(0,e.checkStrictMode)(c,'"minContains" > "maxContains" is always invalid'),o.fail();return}if((0,e.alwaysValidSchema)(c,i)){let w=(0,t._)`${p} >= ${u}`;d!==void 0&&(w=(0,t._)`${w} && ${p} <= ${d}`),o.pass(w);return}c.items=!0;const g=s.name("valid");d===void 0&&u===1?y(g,()=>s.if(g,()=>s.break())):u===0?(s.let(g,!0),d!==void 0&&s.if((0,t._)`${l}.length > 0`,m)):(s.let(g,!1),m()),o.result(g,()=>o.reset());function m(){const w=s.name("_valid"),k=s.let("count",0);y(w,()=>s.if(w,()=>b(k)))}function y(w,k){s.forRange("i",0,p,v=>{o.subschema({keyword:"contains",dataProp:v,dataPropType:e.Type.Num,compositeRule:!0},w),k()})}function b(w){s.code((0,t._)`${w}++`),d===void 0?s.if((0,t._)`${w} >= ${u}`,()=>s.assign(g,!0).break()):(s.if((0,t._)`${w} > ${d}`,()=>s.assign(g,!1).break()),u===1?s.assign(g,!0):s.if((0,t._)`${w} >= ${u}`,()=>s.assign(g,!0)))}}};return cc.default=r,cc}var Qf={},aw;function tK(){return aw||(aw=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=Be(),n=qe(),r=Zn();t.error={message:({params:{property:l,depsCount:c,deps:u}})=>{const d=c===1?"property":"properties";return(0,e.str)`must have ${d} ${u} when property ${l} is present`},params:({params:{property:l,depsCount:c,deps:u,missingProperty:d}})=>(0,e._)`{property: ${l},
|
|
332
|
-
missingProperty: ${d},
|
|
333
|
-
depsCount: ${c},
|
|
334
|
-
deps: ${u}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(l){const[c,u]=s(l);i(l,c),a(l,u)}};function s({schema:l}){const c={},u={};for(const d in l){if(d==="__proto__")continue;const f=Array.isArray(l[d])?c:u;f[d]=l[d]}return[c,u]}function i(l,c=l.schema){const{gen:u,data:d,it:f}=l;if(Object.keys(c).length===0)return;const h=u.let("missing");for(const p in c){const g=c[p];if(g.length===0)continue;const m=(0,r.propertyInData)(u,d,p,f.opts.ownProperties);l.setParams({property:p,depsCount:g.length,deps:g.join(", ")}),f.allErrors?u.if(m,()=>{for(const y of g)(0,r.checkReportMissingProp)(l,y)}):(u.if((0,e._)`${m} && (${(0,r.checkMissingProp)(l,g,h)})`),(0,r.reportMissingProp)(l,h),u.else())}}t.validatePropertyDeps=i;function a(l,c=l.schema){const{gen:u,data:d,keyword:f,it:h}=l,p=u.name("valid");for(const g in c)(0,n.alwaysValidSchema)(h,c[g])||(u.if((0,r.propertyInData)(u,d,g,h.opts.ownProperties),()=>{const m=l.subschema({keyword:f,schemaProp:g},p);l.mergeValidEvaluated(m,p)},()=>u.var(p,!0)),l.ok(p))}t.validateSchemaDeps=a,t.default=o})(Qf)),Qf}var uc={},lw;function nK(){if(lw)return uc;lw=1,Object.defineProperty(uc,"__esModule",{value:!0});const t=Be(),e=qe(),r={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:o})=>(0,t._)`{propertyName: ${o.propertyName}}`},code(o){const{gen:s,schema:i,data:a,it:l}=o;if((0,e.alwaysValidSchema)(l,i))return;const c=s.name("valid");s.forIn("key",a,u=>{o.setParams({propertyName:u}),o.subschema({keyword:"propertyNames",data:u,dataTypes:["string"],propertyName:u,compositeRule:!0},c),s.if((0,t.not)(c),()=>{o.error(!0),l.allErrors||s.break()})}),o.ok(c)}};return uc.default=r,uc}var dc={},cw;function AT(){if(cw)return dc;cw=1,Object.defineProperty(dc,"__esModule",{value:!0});const t=Zn(),e=Be(),n=Ao(),r=qe(),s={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:i})=>(0,e._)`{additionalProperty: ${i.additionalProperty}}`},code(i){const{gen:a,schema:l,parentSchema:c,data:u,errsCount:d,it:f}=i;if(!d)throw new Error("ajv implementation error");const{allErrors:h,opts:p}=f;if(f.props=!0,p.removeAdditional!=="all"&&(0,r.alwaysValidSchema)(f,l))return;const g=(0,t.allSchemaProperties)(c.properties),m=(0,t.allSchemaProperties)(c.patternProperties);y(),i.ok((0,e._)`${d} === ${n.default.errors}`);function y(){a.forIn("key",u,x=>{!g.length&&!m.length?k(x):a.if(b(x),()=>k(x))})}function b(x){let E;if(g.length>8){const C=(0,r.schemaRefOrVal)(f,c.properties,"properties");E=(0,t.isOwnProperty)(a,C,x)}else g.length?E=(0,e.or)(...g.map(C=>(0,e._)`${x} === ${C}`)):E=e.nil;return m.length&&(E=(0,e.or)(E,...m.map(C=>(0,e._)`${(0,t.usePattern)(i,C)}.test(${x})`))),(0,e.not)(E)}function w(x){a.code((0,e._)`delete ${u}[${x}]`)}function k(x){if(p.removeAdditional==="all"||p.removeAdditional&&l===!1){w(x);return}if(l===!1){i.setParams({additionalProperty:x}),i.error(),h||a.break();return}if(typeof l=="object"&&!(0,r.alwaysValidSchema)(f,l)){const E=a.name("valid");p.removeAdditional==="failing"?(v(x,E,!1),a.if((0,e.not)(E),()=>{i.reset(),w(x)})):(v(x,E),h||a.if((0,e.not)(E),()=>a.break()))}}function v(x,E,C){const A={keyword:"additionalProperties",dataProp:x,dataPropType:r.Type.Str};C===!1&&Object.assign(A,{compositeRule:!0,createErrors:!1,allErrors:!1}),i.subschema(A,E)}}};return dc.default=s,dc}var fc={},uw;function rK(){if(uw)return fc;uw=1,Object.defineProperty(fc,"__esModule",{value:!0});const t=Fd(),e=Zn(),n=qe(),r=AT(),o={keyword:"properties",type:"object",schemaType:"object",code(s){const{gen:i,schema:a,parentSchema:l,data:c,it:u}=s;u.opts.removeAdditional==="all"&&l.additionalProperties===void 0&&r.default.code(new t.KeywordCxt(u,r.default,"additionalProperties"));const d=(0,e.allSchemaProperties)(a);for(const m of d)u.definedProperties.add(m);u.opts.unevaluated&&d.length&&u.props!==!0&&(u.props=n.mergeEvaluated.props(i,(0,n.toHash)(d),u.props));const f=d.filter(m=>!(0,n.alwaysValidSchema)(u,a[m]));if(f.length===0)return;const h=i.name("valid");for(const m of f)p(m)?g(m):(i.if((0,e.propertyInData)(i,c,m,u.opts.ownProperties)),g(m),u.allErrors||i.else().var(h,!0),i.endIf()),s.it.definedProperties.add(m),s.ok(h);function p(m){return u.opts.useDefaults&&!u.compositeRule&&a[m].default!==void 0}function g(m){s.subschema({keyword:"properties",schemaProp:m,dataProp:m},h)}}};return fc.default=o,fc}var hc={},dw;function oK(){if(dw)return hc;dw=1,Object.defineProperty(hc,"__esModule",{value:!0});const t=Zn(),e=Be(),n=qe(),r=qe(),o={keyword:"patternProperties",type:"object",schemaType:"object",code(s){const{gen:i,schema:a,data:l,parentSchema:c,it:u}=s,{opts:d}=u,f=(0,t.allSchemaProperties)(a),h=f.filter(k=>(0,n.alwaysValidSchema)(u,a[k]));if(f.length===0||h.length===f.length&&(!u.opts.unevaluated||u.props===!0))return;const p=d.strictSchema&&!d.allowMatchingProperties&&c.properties,g=i.name("valid");u.props!==!0&&!(u.props instanceof e.Name)&&(u.props=(0,r.evaluatedPropsToName)(i,u.props));const{props:m}=u;y();function y(){for(const k of f)p&&b(k),u.allErrors?w(k):(i.var(g,!0),w(k),i.if(g))}function b(k){for(const v in p)new RegExp(k).test(v)&&(0,n.checkStrictMode)(u,`property ${v} matches pattern ${k} (use allowMatchingProperties)`)}function w(k){i.forIn("key",l,v=>{i.if((0,e._)`${(0,t.usePattern)(s,k)}.test(${v})`,()=>{const x=h.includes(k);x||s.subschema({keyword:"patternProperties",schemaProp:k,dataProp:v,dataPropType:r.Type.Str},g),u.opts.unevaluated&&m!==!0?i.assign((0,e._)`${m}[${v}]`,!0):!x&&!u.allErrors&&i.if((0,e.not)(g),()=>i.break())})})}}};return hc.default=o,hc}var pc={},fw;function sK(){if(fw)return pc;fw=1,Object.defineProperty(pc,"__esModule",{value:!0});const t=qe(),e={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(n){const{gen:r,schema:o,it:s}=n;if((0,t.alwaysValidSchema)(s,o)){n.fail();return}const i=r.name("valid");n.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),n.failResult(i,()=>n.reset(),()=>n.error())},error:{message:"must NOT be valid"}};return pc.default=e,pc}var mc={},hw;function iK(){if(hw)return mc;hw=1,Object.defineProperty(mc,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Zn().validateUnion,error:{message:"must match a schema in anyOf"}};return mc.default=e,mc}var gc={},pw;function aK(){if(pw)return gc;pw=1,Object.defineProperty(gc,"__esModule",{value:!0});const t=Be(),e=qe(),r={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:o})=>(0,t._)`{passingSchemas: ${o.passing}}`},code(o){const{gen:s,schema:i,parentSchema:a,it:l}=o;if(!Array.isArray(i))throw new Error("ajv implementation error");if(l.opts.discriminator&&a.discriminator)return;const c=i,u=s.let("valid",!1),d=s.let("passing",null),f=s.name("_valid");o.setParams({passing:d}),s.block(h),o.result(u,()=>o.reset(),()=>o.error(!0));function h(){c.forEach((p,g)=>{let m;(0,e.alwaysValidSchema)(l,p)?s.var(f,!0):m=o.subschema({keyword:"oneOf",schemaProp:g,compositeRule:!0},f),g>0&&s.if((0,t._)`${f} && ${u}`).assign(u,!1).assign(d,(0,t._)`[${d}, ${g}]`).else(),s.if(f,()=>{s.assign(u,!0),s.assign(d,g),m&&o.mergeEvaluated(m,t.Name)})})}}};return gc.default=r,gc}var yc={},mw;function lK(){if(mw)return yc;mw=1,Object.defineProperty(yc,"__esModule",{value:!0});const t=qe(),e={keyword:"allOf",schemaType:"array",code(n){const{gen:r,schema:o,it:s}=n;if(!Array.isArray(o))throw new Error("ajv implementation error");const i=r.name("valid");o.forEach((a,l)=>{if((0,t.alwaysValidSchema)(s,a))return;const c=n.subschema({keyword:"allOf",schemaProp:l},i);n.ok(i),n.mergeEvaluated(c)})}};return yc.default=e,yc}var bc={},gw;function cK(){if(gw)return bc;gw=1,Object.defineProperty(bc,"__esModule",{value:!0});const t=Be(),e=qe(),r={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:s})=>(0,t.str)`must match "${s.ifClause}" schema`,params:({params:s})=>(0,t._)`{failingKeyword: ${s.ifClause}}`},code(s){const{gen:i,parentSchema:a,it:l}=s;a.then===void 0&&a.else===void 0&&(0,e.checkStrictMode)(l,'"if" without "then" and "else" is ignored');const c=o(l,"then"),u=o(l,"else");if(!c&&!u)return;const d=i.let("valid",!0),f=i.name("_valid");if(h(),s.reset(),c&&u){const g=i.let("ifClause");s.setParams({ifClause:g}),i.if(f,p("then",g),p("else",g))}else c?i.if(f,p("then")):i.if((0,t.not)(f),p("else"));s.pass(d,()=>s.error(!0));function h(){const g=s.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},f);s.mergeEvaluated(g)}function p(g,m){return()=>{const y=s.subschema({keyword:g},f);i.assign(d,f),s.mergeValidEvaluated(y,d),m?i.assign(m,(0,t._)`${g}`):s.setParams({ifClause:g})}}}};function o(s,i){const a=s.schema[i];return a!==void 0&&!(0,e.alwaysValidSchema)(s,a)}return bc.default=r,bc}var vc={},yw;function uK(){if(yw)return vc;yw=1,Object.defineProperty(vc,"__esModule",{value:!0});const t=qe(),e={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:n,parentSchema:r,it:o}){r.if===void 0&&(0,t.checkStrictMode)(o,`"${n}" without "if" is ignored`)}};return vc.default=e,vc}var bw;function dK(){if(bw)return ic;bw=1,Object.defineProperty(ic,"__esModule",{value:!0});const t=NT(),e=X6(),n=PT(),r=Q6(),o=eK(),s=tK(),i=nK(),a=AT(),l=rK(),c=oK(),u=sK(),d=iK(),f=aK(),h=lK(),p=cK(),g=uK();function m(y=!1){const b=[u.default,d.default,f.default,h.default,p.default,g.default,i.default,a.default,s.default,l.default,c.default];return y?b.push(e.default,r.default):b.push(t.default,n.default),b.push(o.default),b}return ic.default=m,ic}var wc={},kc={},vw;function fK(){if(vw)return kc;vw=1,Object.defineProperty(kc,"__esModule",{value:!0});const t=Be(),n={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:r})=>(0,t.str)`must match format "${r}"`,params:({schemaCode:r})=>(0,t._)`{format: ${r}}`},code(r,o){const{gen:s,data:i,$data:a,schema:l,schemaCode:c,it:u}=r,{opts:d,errSchemaPath:f,schemaEnv:h,self:p}=u;if(!d.validateFormats)return;a?g():m();function g(){const y=s.scopeValue("formats",{ref:p.formats,code:d.code.formats}),b=s.const("fDef",(0,t._)`${y}[${c}]`),w=s.let("fType"),k=s.let("format");s.if((0,t._)`typeof ${b} == "object" && !(${b} instanceof RegExp)`,()=>s.assign(w,(0,t._)`${b}.type || "string"`).assign(k,(0,t._)`${b}.validate`),()=>s.assign(w,(0,t._)`"string"`).assign(k,b)),r.fail$data((0,t.or)(v(),x()));function v(){return d.strictSchema===!1?t.nil:(0,t._)`${c} && !${k}`}function x(){const E=h.$async?(0,t._)`(${b}.async ? await ${k}(${i}) : ${k}(${i}))`:(0,t._)`${k}(${i})`,C=(0,t._)`(typeof ${k} == "function" ? ${E} : ${k}.test(${i}))`;return(0,t._)`${k} && ${k} !== true && ${w} === ${o} && !${C}`}}function m(){const y=p.formats[l];if(!y){v();return}if(y===!0)return;const[b,w,k]=x(y);b===o&&r.pass(E());function v(){if(d.strictSchema===!1){p.logger.warn(C());return}throw new Error(C());function C(){return`unknown format "${l}" ignored in schema at path "${f}"`}}function x(C){const A=C instanceof RegExp?(0,t.regexpCode)(C):d.code.formats?(0,t._)`${d.code.formats}${(0,t.getProperty)(l)}`:void 0,z=s.scopeValue("formats",{key:l,ref:C,code:A});return typeof C=="object"&&!(C instanceof RegExp)?[C.type||"string",C.validate,(0,t._)`${z}.validate`]:["string",C,z]}function E(){if(typeof y=="object"&&!(y instanceof RegExp)&&y.async){if(!h.$async)throw new Error("async format in sync schema");return(0,t._)`await ${k}(${i})`}return typeof w=="function"?(0,t._)`${k}(${i})`:(0,t._)`${k}.test(${i})`}}}};return kc.default=n,kc}var ww;function hK(){if(ww)return wc;ww=1,Object.defineProperty(wc,"__esModule",{value:!0});const e=[fK().default];return wc.default=e,wc}var Bo={},kw;function pK(){return kw||(kw=1,Object.defineProperty(Bo,"__esModule",{value:!0}),Bo.contentVocabulary=Bo.metadataVocabulary=void 0,Bo.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],Bo.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),Bo}var xw;function mK(){if(xw)return Wl;xw=1,Object.defineProperty(Wl,"__esModule",{value:!0});const t=j6(),e=J6(),n=dK(),r=hK(),o=pK(),s=[t.default,e.default,(0,n.default)(),r.default,o.metadataVocabulary,o.contentVocabulary];return Wl.default=s,Wl}var xc={},Yi={},Sw;function gK(){if(Sw)return Yi;Sw=1,Object.defineProperty(Yi,"__esModule",{value:!0}),Yi.DiscrError=void 0;var t;return(function(e){e.Tag="tag",e.Mapping="mapping"})(t||(Yi.DiscrError=t={})),Yi}var Ew;function yK(){if(Ew)return xc;Ew=1,Object.defineProperty(xc,"__esModule",{value:!0});const t=Be(),e=gK(),n=Mg(),r=Bd(),o=qe(),i={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:a,tagName:l}})=>a===e.DiscrError.Tag?`tag "${l}" must be string`:`value of tag "${l}" must be in oneOf`,params:({params:{discrError:a,tag:l,tagName:c}})=>(0,t._)`{error: ${a}, tag: ${c}, tagValue: ${l}}`},code(a){const{gen:l,data:c,schema:u,parentSchema:d,it:f}=a,{oneOf:h}=d;if(!f.opts.discriminator)throw new Error("discriminator: requires discriminator option");const p=u.propertyName;if(typeof p!="string")throw new Error("discriminator: requires propertyName");if(u.mapping)throw new Error("discriminator: mapping is not supported");if(!h)throw new Error("discriminator: requires oneOf keyword");const g=l.let("valid",!1),m=l.const("tag",(0,t._)`${c}${(0,t.getProperty)(p)}`);l.if((0,t._)`typeof ${m} == "string"`,()=>y(),()=>a.error(!1,{discrError:e.DiscrError.Tag,tag:m,tagName:p})),a.ok(g);function y(){const k=w();l.if(!1);for(const v in k)l.elseIf((0,t._)`${m} === ${v}`),l.assign(g,b(k[v]));l.else(),a.error(!1,{discrError:e.DiscrError.Mapping,tag:m,tagName:p}),l.endIf()}function b(k){const v=l.name("valid"),x=a.subschema({keyword:"oneOf",schemaProp:k},v);return a.mergeEvaluated(x,t.Name),v}function w(){var k;const v={},x=C(d);let E=!0;for(let R=0;R<h.length;R++){let _=h[R];if(_?.$ref&&!(0,o.schemaHasRulesButRef)(_,f.self.RULES)){const L=_.$ref;if(_=n.resolveRef.call(f.self,f.schemaEnv.root,f.baseId,L),_ instanceof n.SchemaEnv&&(_=_.schema),_===void 0)throw new r.default(f.opts.uriResolver,f.baseId,L)}const N=(k=_?.properties)===null||k===void 0?void 0:k[p];if(typeof N!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);E=E&&(x||C(_)),A(N,R)}if(!E)throw new Error(`discriminator: "${p}" must be required`);return v;function C({required:R}){return Array.isArray(R)&&R.includes(p)}function A(R,_){if(R.const)z(R.const,_);else if(R.enum)for(const N of R.enum)z(N,_);else throw new Error(`discriminator: "properties/${p}" must have "const" or "enum"`)}function z(R,_){if(typeof R!="string"||R in v)throw new Error(`discriminator: "${p}" values must be unique strings`);v[R]=_}}}};return xc.default=i,xc}const bK="http://json-schema.org/draft-07/schema#",vK="http://json-schema.org/draft-07/schema#",wK="Core schema meta-schema",kK={schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},xK=["object","boolean"],SK={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},EK={$schema:bK,$id:vK,title:wK,definitions:kK,type:xK,properties:SK,default:!0};var Cw;function IT(){return Cw||(Cw=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;const n=D6(),r=mK(),o=yK(),s=EK,i=["/properties"],a="http://json-schema.org/draft-07/schema";class l extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(p=>this.addVocabulary(p)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const p=this.opts.$data?this.$dataMetaSchema(s,i):s;this.addMetaSchema(p,a,!1),this.refs["http://json-schema.org/schema"]=a}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}}e.Ajv=l,t.exports=e=l,t.exports.Ajv=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var c=Fd();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=Be();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=Tg();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var f=Bd();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return f.default}})})(jl,jl.exports)),jl.exports}var CK=IT();const TK=zw(CK);var Sc={exports:{}},eh={},Tw;function MK(){return Tw||(Tw=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0;function e(R,_){return{validate:R,compare:_}}t.fullFormats={date:e(s,i),time:e(l(!0),c),"date-time":e(f(!0),h),"iso-time":e(l(),u),"iso-date-time":e(f(),p),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:y,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:z,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:w,int32:{type:"number",validate:x},int64:{type:"number",validate:E},float:{type:"number",validate:C},double:{type:"number",validate:C},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:e(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,i),time:e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,c),"date-time":e(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,h),"iso-time":e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":e(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,p),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);function n(R){return R%4===0&&(R%100!==0||R%400===0)}const r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,o=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(R){const _=r.exec(R);if(!_)return!1;const N=+_[1],L=+_[2],H=+_[3];return L>=1&&L<=12&&H>=1&&H<=(L===2&&n(N)?29:o[L])}function i(R,_){if(R&&_)return R>_?1:R<_?-1:0}const a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function l(R){return function(N){const L=a.exec(N);if(!L)return!1;const H=+L[1],Z=+L[2],W=+L[3],q=L[4],V=L[5]==="-"?-1:1,D=+(L[6]||0),j=+(L[7]||0);if(D>23||j>59||R&&!q)return!1;if(H<=23&&Z<=59&&W<60)return!0;const B=Z-j*V,F=H-D*V-(B<0?1:0);return(F===23||F===-1)&&(B===59||B===-1)&&W<61}}function c(R,_){if(!(R&&_))return;const N=new Date("2020-01-01T"+R).valueOf(),L=new Date("2020-01-01T"+_).valueOf();if(N&&L)return N-L}function u(R,_){if(!(R&&_))return;const N=a.exec(R),L=a.exec(_);if(N&&L)return R=N[1]+N[2]+N[3],_=L[1]+L[2]+L[3],R>_?1:R<_?-1:0}const d=/t|\s/i;function f(R){const _=l(R);return function(L){const H=L.split(d);return H.length===2&&s(H[0])&&_(H[1])}}function h(R,_){if(!(R&&_))return;const N=new Date(R).valueOf(),L=new Date(_).valueOf();if(N&&L)return N-L}function p(R,_){if(!(R&&_))return;const[N,L]=R.split(d),[H,Z]=_.split(d),W=i(N,H);if(W!==void 0)return W||c(L,Z)}const g=/\/|:/,m=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function y(R){return g.test(R)&&m.test(R)}const b=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function w(R){return b.lastIndex=0,b.test(R)}const k=-2147483648,v=2**31-1;function x(R){return Number.isInteger(R)&&R<=v&&R>=k}function E(R){return Number.isInteger(R)}function C(){return!0}const A=/[^\\]\\Z/;function z(R){if(A.test(R))return!1;try{return new RegExp(R),!0}catch{return!1}}})(eh)),eh}var th={},Mw;function RK(){return Mw||(Mw=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;const e=IT(),n=Be(),r=n.operators,o={formatMaximum:{okStr:"<=",ok:r.LTE,fail:r.GT},formatMinimum:{okStr:">=",ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},s={message:({keyword:a,schemaCode:l})=>(0,n.str)`should be ${o[a].okStr} ${l}`,params:({keyword:a,schemaCode:l})=>(0,n._)`{comparison: ${o[a].okStr}, limit: ${l}}`};t.formatLimitDefinition={keyword:Object.keys(o),type:"string",schemaType:"string",$data:!0,error:s,code(a){const{gen:l,data:c,schemaCode:u,keyword:d,it:f}=a,{opts:h,self:p}=f;if(!h.validateFormats)return;const g=new e.KeywordCxt(f,p.RULES.all.format.definition,"format");g.$data?m():y();function m(){const w=l.scopeValue("formats",{ref:p.formats,code:h.code.formats}),k=l.const("fmt",(0,n._)`${w}[${g.schemaCode}]`);a.fail$data((0,n.or)((0,n._)`typeof ${k} != "object"`,(0,n._)`${k} instanceof RegExp`,(0,n._)`typeof ${k}.compare != "function"`,b(k)))}function y(){const w=g.schema,k=p.formats[w];if(!k||k===!0)return;if(typeof k!="object"||k instanceof RegExp||typeof k.compare!="function")throw new Error(`"${d}": format "${w}" does not define "compare" function`);const v=l.scopeValue("formats",{key:w,ref:k,code:h.code.formats?(0,n._)`${h.code.formats}${(0,n.getProperty)(w)}`:void 0});a.fail$data(b(v))}function b(w){return(0,n._)`${w}.compare(${c}, ${u}) ${o[d].fail} 0`}},dependencies:["format"]};const i=a=>(a.addKeyword(t.formatLimitDefinition),a);t.default=i})(th)),th}var Rw;function OK(){return Rw||(Rw=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const n=MK(),r=RK(),o=Be(),s=new o.Name("fullFormats"),i=new o.Name("fastFormats"),a=(c,u={keywords:!0})=>{if(Array.isArray(u))return l(c,u,n.fullFormats,s),c;const[d,f]=u.mode==="fast"?[n.fastFormats,i]:[n.fullFormats,s],h=u.formats||n.formatNames;return l(c,h,d,f),u.keywords&&(0,r.default)(c),c};a.get=(c,u="full")=>{const f=(u==="fast"?n.fastFormats:n.fullFormats)[c];if(!f)throw new Error(`Unknown format "${c}"`);return f};function l(c,u,d,f){var h,p;(h=(p=c.opts.code).formats)!==null&&h!==void 0||(p.formats=(0,o._)`require("ajv-formats/dist/formats").${f}`);for(const g of u)c.addFormat(g,d[g])}t.exports=e=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a})(Sc,Sc.exports)),Sc.exports}var _K=OK();const NK=zw(_K),ai="_root",$T=new TK({allErrors:!0,strict:!1});NK($T);const Ow=new WeakMap;function PK(t){const e=Ow.get(t);if(e)return e;const n=$T.compile(t);return Ow.set(t,n),n}function AK(t){return t.replaceAll("~1","/").replaceAll("~0","~")}function IK(t){if(t.keyword==="required")return(typeof t.params.missingProperty=="string"?t.params.missingProperty:void 0)??ai;const e=t.instancePath.replace(/^\//,"");if(e.length===0)return ai;const n=e.split("/")[0];return n?AK(n):ai}function $K(t){const e=t.message?.trim();return e&&e.length>0?e:"invalid value"}function DK(t){if(!t||t.length===0)return{};const e={};for(const n of t){const r=IK(n),o=$K(n),s=e[r]??[];s.includes(o)||(e[r]=[...s,o])}return e}function zK(t,e){const n=PK(t);return{valid:!!n(e),errors:DK(n.errors)}}const Di="border-transparent bg-muted/50 shadow-none focus-visible:border-transparent focus-visible:ring-2 focus-visible:ring-ring/35",LK=/^#[0-9a-fA-F]{6}$/,jK=50;function FK(t){const e=t.replace(/[_-]+/g," ").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\s+/g," ").trim();return e.length===0?t:e.split(" ").map(n=>n===n.toUpperCase()&&n.length>1?n:n[0]?n[0].toUpperCase()+n.slice(1).toLowerCase():n).join(" ")}function _w(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}function BK(t){const e=DH(t);if(!e)return{date:"",time:"00:00"};const[n="",r="00:00"]=e.split("T");return{date:n,time:r}}function Qu(t){return t.toString().padStart(2,"0")}function VK(t){const e=t.getFullYear(),n=Qu(t.getMonth()+1),r=Qu(t.getDate());return`${e}-${n}-${r}`}function Nw(t,e){if(t)return zH(`${t}T${e||"00:00"}`)}function Pw(t){return t.trim().toUpperCase()}function HK(t){return LK.test(t)}const WK=Array.from({length:24},(t,e)=>Qu(e)),qK=Array.from({length:60},(t,e)=>Qu(e));function UK(t){const e=t.trim().toLowerCase();return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:")||e.startsWith("blob:")}function KK(t){const e=S.useMemo(()=>t.sourcePaths.map(o=>o.trim()).filter(o=>o.length>0),[t.sourcePaths]),[n,r]=S.useState([]);return S.useEffect(()=>{if(e.length===0){r([]);return}let o=!1;const s=[];return r(e.map(i=>({sourcePath:i,loading:!0}))),Promise.all(e.map(async i=>{if(UK(i))return{sourcePath:i,previewUrl:i,loading:!1};try{const a=await ZE({data:{currentFilePath:t.currentFilePath,sourcePath:i}});if(!a.ok)throw new Error(`Preview request failed (${a.status})`);const l=await a.blob(),c=URL.createObjectURL(l);return s.push(c),{sourcePath:i,previewUrl:c,loading:!1}}catch(a){const l=a instanceof Error?a.message:"Preview unavailable";return{sourcePath:i,loading:!1,error:l}}})).then(i=>{o||r(i)}).catch(()=>{o||r([])}),()=>{o=!0;for(const i of s)URL.revokeObjectURL(i)}},[e,t.currentFilePath]),n}function DT(t){const e=Me.c(15),{currentFilePath:n,sourcePaths:r,columns:o,onRemoveAt:s}=t;let i;e[0]!==n||e[1]!==r?(i={currentFilePath:n,sourcePaths:r},e[0]=n,e[1]=r,e[2]=i):i=e[2];const a=KK(i);if(a.length===0)return null;const l=o===1?"grid-cols-1":"grid-cols-2";let c;e[3]!==l?(c=ue("grid gap-2",l),e[3]=l,e[4]=c):c=e[4];let u;if(e[5]!==o||e[6]!==a||e[7]!==s){let f;e[9]!==o||e[10]!==s?(f=(h,p)=>M.jsxs("div",{className:"bg-muted/50 group relative overflow-hidden rounded-md",children:[h.previewUrl?M.jsx("img",{src:h.previewUrl,alt:h.sourcePath,className:ue("w-full object-cover",o===1?"h-44":"h-28")}):h.loading?M.jsx("div",{className:ue("text-muted-foreground flex items-center justify-center text-[11px]",o===1?"h-44":"h-28"),children:M.jsx(Nr,{className:"size-3.5 animate-spin"})}):M.jsx("div",{className:ue("text-muted-foreground flex items-center justify-center px-2 text-center text-[11px]",o===1?"h-44":"h-28"),children:"Preview unavailable"}),s?M.jsx("button",{type:"button",className:"bg-background/85 text-foreground absolute top-2 right-2 inline-flex size-6 items-center justify-center rounded-full opacity-0 shadow-sm transition-opacity hover:opacity-100 group-hover:opacity-100",onClick:()=>s(p),"aria-label":`Remove image ${h.sourcePath}`,children:M.jsx(hx,{className:"size-3.5"})}):null]},`${h.sourcePath}-${p}`),e[9]=o,e[10]=s,e[11]=f):f=e[11],u=a.map(f),e[5]=o,e[6]=a,e[7]=s,e[8]=u}else u=e[8];let d;return e[12]!==c||e[13]!==u?(d=M.jsx("div",{className:c,children:u}),e[12]=c,e[13]=u,e[14]=d):d=e[14],d}function YK(t){const e=Me.c(7),{fieldKey:n,value:r,onChange:o,onBlur:s}=t,i=typeof r=="number"||typeof r=="string"?String(r):"";let a;e[0]!==o?(a=c=>{const u=c.target.value;if(u.trim()===""){o(void 0);return}const d=Number(u);o(Number.isFinite(d)?d:u)},e[0]=o,e[1]=a):a=e[1];let l;return e[2]!==n||e[3]!==s||e[4]!==i||e[5]!==a?(l=M.jsx(_o,{id:n,type:"number",className:Di,value:i,onChange:a,onBlur:s}),e[2]=n,e[3]=s,e[4]=i,e[5]=a,e[6]=l):l=e[6],l}function ZK(t){const e=Me.c(12),{fieldKey:n,value:r,onChange:o,onBlur:s}=t,i=r===!0,a=i?"Enabled":"Disabled";let l;e[0]!==a?(l=M.jsx("span",{className:"text-muted-foreground text-sm",children:a}),e[0]=a,e[1]=l):l=e[1];let c;e[2]!==o?(c=f=>o(f),e[2]=o,e[3]=c):c=e[3];let u;e[4]!==n||e[5]!==i||e[6]!==s||e[7]!==c?(u=M.jsx(IH,{id:n,checked:i,onCheckedChange:c,onBlur:s,"aria-label":n}),e[4]=n,e[5]=i,e[6]=s,e[7]=c,e[8]=u):u=e[8];let d;return e[9]!==l||e[10]!==u?(d=M.jsxs("div",{className:"bg-muted/50 flex h-9 items-center justify-between rounded-md px-3",children:[l,u]}),e[9]=l,e[10]=u,e[11]=d):d=e[11],d}function GK(t){const e=Me.c(69),{fieldKey:n,value:r,onChange:o,onBlur:s}=t;let i,a;if(e[0]!==r){const{date:B,time:F}=BK(r);i=B,a=F.split(":"),e[0]=r,e[1]=i,e[2]=a}else i=e[1],a=e[2];const[l,c]=a,u=l===void 0?"00":l,d=c===void 0?"00":c;let f,h,p,g,m,y,b,w,k,v;if(e[3]!==i||e[4]!==n||e[5]!==u||e[6]!==d||e[7]!==s||e[8]!==o){m=i?new Date(`${i}T00:00:00`):void 0;let B;e[19]!==u||e[20]!==d||e[21]!==s||e[22]!==o?(B=T=>{if(!T){o(void 0),s();return}const $=VK(T);o(Nw($,`${u}:${d}`)),s()},e[19]=u,e[20]=d,e[21]=s,e[22]=o,e[23]=B):B=e[23],p=B;let F;e[24]!==i||e[25]!==s||e[26]!==o?(F=(T,$)=>{o(Nw(i,`${T}:${$}`)),s()},e[24]=i,e[25]=s,e[26]=o,e[27]=F):F=e[27],g=F,v="space-y-2",h=Km,f=Ym,e[28]===Symbol.for("react.memo_cache_sentinel")?(y=ue(Ea({variant:"ghost"}),"bg-muted/50 hover:bg-muted/65 h-9 w-full justify-start border-0 px-3 text-sm font-normal shadow-none"),e[28]=y):y=e[28],b=`${n} date`,e[29]===Symbol.for("react.memo_cache_sentinel")?(w=M.jsx(K_,{className:"text-muted-foreground size-4"}),e[29]=w):w=e[29],k=m?m.toLocaleDateString(void 0,{month:"short",day:"2-digit",year:"numeric"}):"Pick a date",e[3]=i,e[4]=n,e[5]=u,e[6]=d,e[7]=s,e[8]=o,e[9]=f,e[10]=h,e[11]=p,e[12]=g,e[13]=m,e[14]=y,e[15]=b,e[16]=w,e[17]=k,e[18]=v}else f=e[9],h=e[10],p=e[11],g=e[12],m=e[13],y=e[14],b=e[15],w=e[16],k=e[17],v=e[18];let x;e[30]!==f||e[31]!==y||e[32]!==b||e[33]!==w||e[34]!==k?(x=M.jsxs(f,{className:y,"aria-label":b,children:[w,k]}),e[30]=f,e[31]=y,e[32]=b,e[33]=w,e[34]=k,e[35]=x):x=e[35];let E;e[36]!==p||e[37]!==m?(E=M.jsx(Zm,{className:"w-auto p-0",children:M.jsx(RH,{mode:"single",selected:m,onSelect:p})}),e[36]=p,e[37]=m,e[38]=E):E=e[38];let C;e[39]!==h||e[40]!==E||e[41]!==x?(C=M.jsxs(h,{children:[x,E]}),e[39]=h,e[40]=E,e[41]=x,e[42]=C):C=e[42];let A;e[43]===Symbol.for("react.memo_cache_sentinel")?(A=M.jsx(oN,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2"}),e[43]=A):A=e[43];let z;e[44]!==g||e[45]!==d?(z=B=>{B&&g(B,d)},e[44]=g,e[45]=d,e[46]=z):z=e[46];const R=!i;let _;e[47]===Symbol.for("react.memo_cache_sentinel")?(_=M.jsx(Zc,{className:"bg-muted/50 focus-visible:ring-ring/35 w-full border-transparent pl-8 shadow-none focus-visible:border-transparent focus-visible:ring-2",children:M.jsx(Yc,{placeholder:"HH"})}),e[47]=_):_=e[47];let N;e[48]===Symbol.for("react.memo_cache_sentinel")?(N=M.jsx(Gc,{children:M.jsx(Kc,{children:WK.map(XK)})}),e[48]=N):N=e[48];let L;e[49]!==u||e[50]!==z||e[51]!==R?(L=M.jsxs("div",{className:"relative",children:[A,M.jsxs(Uc,{value:u,onValueChange:z,disabled:R,children:[_,N]})]}),e[49]=u,e[50]=z,e[51]=R,e[52]=L):L=e[52];let H;e[53]!==g||e[54]!==u?(H=B=>{B&&g(u,B)},e[53]=g,e[54]=u,e[55]=H):H=e[55];const Z=!i;let W;e[56]===Symbol.for("react.memo_cache_sentinel")?(W=M.jsx(Zc,{className:"bg-muted/50 focus-visible:ring-ring/35 w-full border-transparent shadow-none focus-visible:border-transparent focus-visible:ring-2",children:M.jsx(Yc,{placeholder:"MM"})}),e[56]=W):W=e[56];let q;e[57]===Symbol.for("react.memo_cache_sentinel")?(q=M.jsx(Gc,{children:M.jsx(Kc,{children:qK.map(JK)})}),e[57]=q):q=e[57];let V;e[58]!==d||e[59]!==H||e[60]!==Z?(V=M.jsxs(Uc,{value:d,onValueChange:H,disabled:Z,children:[W,q]}),e[58]=d,e[59]=H,e[60]=Z,e[61]=V):V=e[61];let D;e[62]!==L||e[63]!==V?(D=M.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[L,V]}),e[62]=L,e[63]=V,e[64]=D):D=e[64];let j;return e[65]!==C||e[66]!==D||e[67]!==v?(j=M.jsxs("div",{className:v,children:[C,D]}),e[65]=C,e[66]=D,e[67]=v,e[68]=j):j=e[68],j}function JK(t){return M.jsx(pd,{value:t,children:t},`minute-${t}`)}function XK(t){return M.jsx(pd,{value:t,children:t},`hour-${t}`)}function QK(t){const e=Me.c(14),{fieldKey:n,value:r,options:o,onChange:s}=t,i=typeof r=="string"?r:void 0;let a;e[0]!==s?(a=f=>{f&&s(f)},e[0]=s,e[1]=a):a=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=M.jsx(Zc,{className:"bg-muted/50 focus-visible:ring-ring/35 w-full border-transparent shadow-none focus-visible:border-transparent focus-visible:ring-2",children:M.jsx(Yc,{placeholder:"Select a value"})}),e[2]=l):l=e[2];let c;if(e[3]!==n||e[4]!==o){let f;e[6]!==n?(f=h=>M.jsx(pd,{value:h,children:h},`${n}-${h}`),e[6]=n,e[7]=f):f=e[7],c=o.map(f),e[3]=n,e[4]=o,e[5]=c}else c=e[5];let u;e[8]!==c?(u=M.jsx(Gc,{children:M.jsx(Kc,{children:c})}),e[8]=c,e[9]=u):u=e[9];let d;return e[10]!==i||e[11]!==a||e[12]!==u?(d=M.jsxs(Uc,{value:i,onValueChange:a,children:[l,u]}),e[10]=i,e[11]=a,e[12]=u,e[13]=d):d=e[13],d}function e8(t){const e=Me.c(25),{fieldKey:n,values:r,chipInput:o,onChipInputChange:s,onAddChip:i,onRemoveChip:a,onBackspaceEmpty:l,onBlur:c,placeholder:u}=t;let d;if(e[0]!==n||e[1]!==a||e[2]!==r){let b;e[4]!==n||e[5]!==a?(b=(w,k)=>M.jsxs(Wc,{variant:"secondary",className:"bg-muted gap-1 border-transparent tracking-normal normal-case",children:[w,M.jsx("button",{type:"button",className:"text-muted-foreground hover:bg-accent hover:text-foreground inline-flex size-4 items-center justify-center rounded-full",onClick:()=>a(k),"aria-label":`Remove ${w}`,children:M.jsx(hx,{className:"size-3"})})]},`${n}-${w}-${k}`),e[4]=n,e[5]=a,e[6]=b):b=e[6],d=r.map(b),e[0]=n,e[1]=a,e[2]=r,e[3]=d}else d=e[3];let f;e[7]!==d?(f=M.jsx("div",{className:"flex flex-wrap gap-1.5",children:d}),e[7]=d,e[8]=f):f=e[8];let h;e[9]!==s?(h=b=>s(b.target.value),e[9]=s,e[10]=h):h=e[10];let p;e[11]!==o||e[12]!==i||e[13]!==l?(p=b=>{if(b.key==="Enter"||b.key===","){b.preventDefault(),i();return}b.key==="Backspace"&&o.trim().length===0&&(b.preventDefault(),l())},e[11]=o,e[12]=i,e[13]=l,e[14]=p):p=e[14];const g=u??"Type and press Enter";let m;e[15]!==o||e[16]!==n||e[17]!==c||e[18]!==h||e[19]!==p||e[20]!==g?(m=M.jsx(_o,{id:n,className:Di,value:o,onChange:h,onKeyDown:p,onBlur:c,placeholder:g}),e[15]=o,e[16]=n,e[17]=c,e[18]=h,e[19]=p,e[20]=g,e[21]=m):m=e[21];let y;return e[22]!==f||e[23]!==m?(y=M.jsxs("div",{className:"space-y-2",children:[f,m]}),e[22]=f,e[23]=m,e[24]=y):y=e[24],y}function t8(t){const e=Me.c(25),{fieldKey:n,currentFilePath:r,sourceMode:o,value:s,onChange:i,onBlur:a}=t;let l;e[0]!==s?(l=typeof s=="string"?s.trim():"",e[0]=s,e[1]=l):l=e[1];const c=l,u=typeof s=="string"?s:"";let d;e[2]!==i?(d=y=>{i(y.target.value||void 0)},e[2]=i,e[3]=d):d=e[3];let f;e[4]!==n||e[5]!==a||e[6]!==u||e[7]!==d?(f=M.jsx(_o,{id:n,className:Di,value:u,onChange:d,onBlur:a}),e[4]=n,e[5]=a,e[6]=u,e[7]=d,e[8]=f):f=e[8];let h;e[9]!==r||e[10]!==a||e[11]!==i||e[12]!==c?(h=c?M.jsx(DT,{currentFilePath:r,sourcePaths:[c],columns:1,onRemoveAt:()=>{i(void 0),a()}}):null,e[9]=r,e[10]=a,e[11]=i,e[12]=c,e[13]=h):h=e[13];let p;e[14]!==a||e[15]!==i?(p=y=>{i(y),a()},e[14]=a,e[15]=i,e[16]=p):p=e[16];let g;e[17]!==r||e[18]!==o||e[19]!==p?(g=M.jsx(YE,{currentFilePath:r,sourceMode:o,triggerLabel:"Browse assets",onSelectPath:p}),e[17]=r,e[18]=o,e[19]=p,e[20]=g):g=e[20];let m;return e[21]!==f||e[22]!==h||e[23]!==g?(m=M.jsxs("div",{className:"space-y-2",children:[f,h,g]}),e[21]=f,e[22]=h,e[23]=g,e[24]=m):m=e[24],m}function n8(t){const e=Me.c(32),{fieldKey:n,currentFilePath:r,sourceMode:o,values:s,chipInput:i,onChipInputChange:a,onAddChip:l,onRemoveChip:c,onBlur:u,onSelectAsset:d}=t;let f;e[0]!==s?(f=s.map(o8).filter(r8),e[0]=s,e[1]=f):f=e[1];const h=f;let p;e[2]!==a?(p=x=>a(x.target.value),e[2]=a,e[3]=p):p=e[3];let g;e[4]!==l||e[5]!==u?(g=x=>{(x.key==="Enter"||x.key===",")&&(x.preventDefault(),l(),u())},e[4]=l,e[5]=u,e[6]=g):g=e[6];let m;e[7]!==i||e[8]!==n||e[9]!==u||e[10]!==p||e[11]!==g?(m=M.jsx(_o,{id:n,className:Di,value:i,onChange:p,onKeyDown:g,onBlur:u,placeholder:"Type image path and press Enter"}),e[7]=i,e[8]=n,e[9]=u,e[10]=p,e[11]=g,e[12]=m):m=e[12];let y;e[13]!==l||e[14]!==u?(y=M.jsx(pn,{type:"button",size:"sm",variant:"secondary",className:"h-9",onClick:()=>{l(),u()},children:"Add"}),e[13]=l,e[14]=u,e[15]=y):y=e[15];let b;e[16]!==m||e[17]!==y?(b=M.jsxs("div",{className:"flex gap-2",children:[m,y]}),e[16]=m,e[17]=y,e[18]=b):b=e[18];let w;e[19]!==r||e[20]!==h||e[21]!==u||e[22]!==c?(w=h.length>0?M.jsx(DT,{currentFilePath:r,sourcePaths:h,columns:2,onRemoveAt:x=>{c(x),u()}}):null,e[19]=r,e[20]=h,e[21]=u,e[22]=c,e[23]=w):w=e[23];let k;e[24]!==r||e[25]!==d||e[26]!==o?(k=M.jsx(YE,{currentFilePath:r,sourceMode:o,triggerLabel:"Add from assets",onSelectPath:d}),e[24]=r,e[25]=d,e[26]=o,e[27]=k):k=e[27];let v;return e[28]!==b||e[29]!==w||e[30]!==k?(v=M.jsxs("div",{className:"space-y-2",children:[b,w,k]}),e[28]=b,e[29]=w,e[30]=k,e[31]=v):v=e[31],v}function r8(t){return t.length>0}function o8(t){return t.trim()}function s8(t){const e=Me.c(28),{fieldKey:n,value:r,onChange:o,onBlur:s}=t,i=typeof r=="string"?r:"";let a,l,c;e[0]!==i?(l=Pw(i),a=l.length>0,c=a&&HK(l),e[0]=i,e[1]=a,e[2]=l,e[3]=c):(a=e[1],l=e[2],c=e[3]);const u=c,d=u?l:"#000000";let f;e[4]!==o?(f=v=>{const x=v.target.value;o(x.length>0?x:void 0)},e[4]=o,e[5]=f):f=e[5];let h;e[6]!==n||e[7]!==s||e[8]!==i||e[9]!==f?(h=M.jsx(_o,{id:n,className:Di,value:i,onChange:f,onBlur:s,placeholder:"#RRGGBB"}),e[6]=n,e[7]=s,e[8]=i,e[9]=f,e[10]=h):h=e[10];const p=`${n}-picker`;let g;e[11]!==s||e[12]!==o?(g=v=>{o(Pw(v.target.value)),s()},e[11]=s,e[12]=o,e[13]=g):g=e[13];const m=`${n} color picker`;let y;e[14]!==d||e[15]!==p||e[16]!==g||e[17]!==m?(y=M.jsx("input",{id:p,type:"color",className:"border-border/50 h-9 w-12 cursor-pointer rounded-md border bg-transparent p-1",value:d,onChange:g,"aria-label":m}),e[14]=d,e[15]=p,e[16]=g,e[17]=m,e[18]=y):y=e[18];let b;e[19]!==h||e[20]!==y?(b=M.jsxs("div",{className:"flex gap-2",children:[h,y]}),e[19]=h,e[20]=y,e[21]=b):b=e[21];let w;e[22]!==u||e[23]!==a?(w=a&&!u?M.jsx("p",{className:"text-destructive/85 text-xs",children:"Use a hex color in #RRGGBB format."}):null,e[22]=u,e[23]=a,e[24]=w):w=e[24];let k;return e[25]!==b||e[26]!==w?(k=M.jsxs("div",{className:"space-y-2",children:[b,w]}),e[25]=b,e[26]=w,e[27]=k):k=e[27],k}function Aw(t){const e=Me.c(7),{fieldKey:n,errors:r}=t;if(!r||r.length===0)return null;let o;if(e[0]!==r||e[1]!==n){let i;e[3]!==n?(i=(a,l)=>M.jsx("p",{className:"text-destructive/85 text-xs",children:a},`${n}-error-${l}`),e[3]=n,e[4]=i):i=e[4],o=r.map(i),e[0]=r,e[1]=n,e[2]=o}else o=e[2];let s;return e[5]!==o?(s=M.jsx("div",{className:"space-y-1",children:o}),e[5]=o,e[6]=s):s=e[6],s}function i8(t){const e=new Date(t);return Number.isNaN(e.getTime())?t:e.toLocaleString(void 0,{month:"short",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})}function a8({selectedCollection:t,selectedFile:e}){const n=at(O=>O.draft),r=at(O=>O.dirty),o=at(O=>O.errors),s=at(O=>O.chipInputs),i=at(O=>O.setFieldValue),a=at(O=>O.setFieldTouched),l=at(O=>O.setValidationErrors),c=at(O=>O.setChipInput),u=at(O=>O.addChipValue),d=at(O=>O.removeChipValue),f=at(O=>O.removeLastChipValue),h=at(O=>O.applyRevisionSnapshot),[p,g]=S.useState([]),[m,y]=S.useState(),[b,w]=S.useState(),[k,v]=S.useState(),[x,E]=S.useState(!1),[C,A]=S.useState(!1),[z,R]=S.useState(),[_,N]=S.useState(),[L,H]=S.useState(!1),[Z,W]=S.useState(),[q,V]=S.useState(),[D,j]=S.useState("frontmatter"),B=S.useRef(0),F=S.useRef(0),T=e?.filePath,$=S.useMemo(()=>ET(t?.schema),[t?.schema]),I=S.useMemo(()=>$?CT($,t?.fieldUi):[],[$,t?.fieldUi]),Y=S.useCallback(()=>{if(!t?.schema){l({});return}const O=zK(t.schema,n);l(O.errors)},[t?.schema,n,l]),G=S.useCallback(O=>{a(O),Y()},[Y,a]);S.useEffect(()=>{Y()},[Y]);const X=S.useCallback(async(O,P)=>{if(!T)return;B.current+=1;const U=B.current;P?A(!0):E(!0),v(void 0),V(void 0);try{const K=await LH({data:{filePath:T,limit:jK,cursor:O}});if(B.current!==U)return;w(K.unavailableReason),y(K.nextCursor),g(J=>{if(!P)return K.commits;const ee=new Set(J.map(oe=>oe.sha)),ie=K.commits.filter(oe=>!ee.has(oe.sha));return[...J,...ie]}),P||R(J=>J&&K.commits.some(ie=>ie.sha===J)?J:void 0)}catch(K){if(B.current!==U)return;const J=K instanceof Error?K.message:String(K);v(J)}finally{B.current===U&&(E(!1),A(!1))}},[T]);S.useEffect(()=>{g([]),y(void 0),w(void 0),v(void 0),E(!1),A(!1),R(void 0),N(void 0),W(void 0),H(!1),V(void 0),T&&X(void 0,!1)},[X,T]),S.useEffect(()=>{if(!T||!z){N(void 0),W(void 0),H(!1);return}F.current+=1;const O=F.current;H(!0),W(void 0),N(void 0),jH({data:{filePath:T,commitSha:z}}).then(P=>{F.current===O&&N(P)}).catch(P=>{if(F.current!==O)return;const U=P instanceof Error?P.message:String(P);W(U)}).finally(()=>{F.current===O&&H(!1)})},[z,T]);const se=S.useCallback(()=>{if(!_||!t||r&&!window.confirm("This file has unsaved changes. Discard changes and apply this revision?"))return;const O=w6({currentDraft:n,revisionFrontmatter:_.frontmatter,schema:t.schema,fieldUi:t.fieldUi});h({draft:O.nextDraft,content:_.content});const P=z?.slice(0,7)??"";V(`Applied ${O.appliedKeys.length} frontmatter field${O.appliedKeys.length===1?"":"s"} and skipped ${O.skippedKeys.length}.`),Mr.success(P?`Applied revision ${P}.`:"Applied selected revision.")},[h,r,n,t,z,_]);return!t||!e?M.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center text-sm",children:"Select a file to edit frontmatter."}):M.jsx("div",{className:"flex h-full min-h-0 flex-col",children:M.jsxs(Bx,{value:D,onValueChange:O=>{(O==="frontmatter"||O==="history")&&j(O)},className:"h-full min-h-0 gap-3 w-full",children:[M.jsxs(Vx,{className:"w-full",children:[M.jsx(Hc,{value:"frontmatter",className:"text-xs",children:"Frontmatter"}),M.jsx(Hc,{value:"history",className:"text-xs",children:"History"})]}),M.jsxs(Py,{value:"frontmatter",className:"min-h-0 overflow-auto pr-1",children:[$?null:M.jsx("div",{className:"bg-muted/40 text-muted-foreground rounded-md px-3 py-2 text-sm",children:"This collection has no object schema available."}),I.map(O=>{const P=o[O.key],U=FK(O.key),K=n[O.key];return M.jsxs("div",{className:"bg-background/45 space-y-2 rounded-lg px-2.5 py-2.5",children:[M.jsx("div",{className:"flex items-center justify-between gap-2",children:M.jsxs(_H,{htmlFor:O.key,className:"text-muted-foreground text-xs font-medium tracking-wide",children:[U,O.required?" *":""]})}),O.kind==="string"&&M.jsx(_o,{id:O.key,className:Di,value:typeof K=="string"?K:"",onChange:J=>{i(O.key,J.target.value||void 0)},onBlur:()=>G(O.key)}),O.kind==="image"&&M.jsx(t8,{fieldKey:O.key,currentFilePath:e.filePath,sourceMode:O.sourceMode,value:K,onChange:J=>{i(O.key,J)},onBlur:()=>G(O.key)}),O.kind==="color"&&M.jsx(s8,{fieldKey:O.key,value:K,onChange:J=>{i(O.key,J)},onBlur:()=>G(O.key)}),O.kind==="number"&&M.jsx(YK,{fieldKey:O.key,value:K,onChange:J=>{i(O.key,J)},onBlur:()=>G(O.key)}),O.kind==="boolean"&&M.jsx(ZK,{fieldKey:O.key,value:K,onChange:J=>{i(O.key,J)},onBlur:()=>G(O.key)}),O.kind==="enum"&&M.jsx(QK,{fieldKey:O.key,value:K,options:O.options,onChange:J=>{i(O.key,J),G(O.key)}}),O.kind==="stringArray"&&M.jsx(e8,{fieldKey:O.key,values:_w(K),chipInput:s[O.key]??"",onChipInputChange:J=>{c(O.key,J)},onAddChip:()=>{u(O.key,s[O.key]??""),G(O.key)},onRemoveChip:J=>{d(O.key,J),G(O.key)},onBackspaceEmpty:()=>{f(O.key),G(O.key)},onBlur:()=>G(O.key)}),O.kind==="imageArray"&&M.jsx(n8,{fieldKey:O.key,currentFilePath:e.filePath,sourceMode:O.sourceMode,values:_w(K),chipInput:s[O.key]??"",onChipInputChange:J=>{c(O.key,J)},onAddChip:()=>{u(O.key,s[O.key]??""),G(O.key)},onRemoveChip:J=>{d(O.key,J),G(O.key)},onBlur:()=>G(O.key),onSelectAsset:J=>{u(O.key,J),G(O.key)}}),O.kind==="dateAnyOf"&&M.jsx(GK,{fieldKey:O.key,value:K,onChange:J=>{i(O.key,J)},onBlur:()=>G(O.key)}),O.kind==="unsupported"&&M.jsxs("div",{className:"bg-muted/40 text-muted-foreground rounded-md px-3 py-2 text-sm",children:["Not yet supported: ",O.reason]}),M.jsx(Aw,{fieldKey:O.key,errors:P})]},O.key)}),o[ai]?.length?M.jsx(Aw,{fieldKey:ai,errors:o[ai]}):null]}),M.jsxs(Py,{value:"history",className:"min-h-0 space-y-2 overflow-auto pr-1",children:[M.jsx("div",{className:"flex justify-end",children:M.jsx(pn,{type:"button",size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",disabled:x||C||!T,onClick:()=>{X(void 0,!1)},children:"Refresh"})}),b?M.jsx("p",{className:"bg-muted/40 text-muted-foreground rounded-md px-3 py-2 text-xs",children:b}):null,!b&&k?M.jsx("p",{className:"text-destructive/90 rounded-md px-1 py-1 text-xs",children:k}):null,!b&&!k&&x&&p.length===0?M.jsxs("p",{className:"text-muted-foreground flex items-center gap-1.5 px-1 py-1 text-xs",children:[M.jsx(Nr,{className:"size-3.5 animate-spin"}),"Loading history..."]}):null,!b&&!k&&!x&&p.length===0?M.jsx("p",{className:"text-muted-foreground rounded-md px-1 py-1 text-xs",children:"No Git history found for this file."}):null,!b&&p.length>0?M.jsx("div",{className:"divide-border/40 divide-y rounded-md border",children:p.map(O=>{const P=z===O.sha,U=O.message.trim().length>0?O.message:"No commit message";return M.jsxs("div",{className:"px-2.5 py-2",children:[M.jsxs("button",{type:"button",className:"w-full text-left",onClick:()=>{V(void 0),R(K=>K===O.sha?void 0:O.sha)},children:[M.jsx("p",{className:"text-foreground/90 text-xs font-medium",children:U}),M.jsxs("p",{className:"text-muted-foreground mt-0.5 text-[11px]",children:[O.author," · ",i8(O.dateIso)]})]}),P?M.jsxs("div",{className:"mt-2 space-y-2",children:[L?M.jsxs("p",{className:"text-muted-foreground flex items-center gap-1.5 text-xs",children:[M.jsx(Nr,{className:"size-3.5 animate-spin"}),"Loading frontmatter..."]}):null,Z?M.jsx("p",{className:"text-destructive/90 text-xs",children:Z}):null,!L&&!Z&&_?M.jsxs("div",{className:"space-y-2",children:[_.parseWarnings.length>0?M.jsx("div",{className:"bg-amber-100/70 text-amber-900 dark:bg-amber-900/30 dark:text-amber-200 rounded-md px-2 py-1.5 text-[11px]",children:_.parseWarnings[0]}):null,M.jsx("pre",{className:"bg-muted/55 max-h-40 overflow-auto rounded-md px-2 py-1.5 text-[11px] leading-relaxed whitespace-pre-wrap",children:Object.keys(_.frontmatter).length>0?JSON.stringify(_.frontmatter,null,2):"[No frontmatter]"}),M.jsx(pn,{type:"button",size:"sm",variant:"outline",className:"h-7 w-full text-xs",onClick:se,children:"Apply"}),q?M.jsx("p",{className:"text-muted-foreground text-[11px]",children:q}):null]}):null]}):null]},O.sha)})}):null,m?M.jsx(pn,{type:"button",size:"sm",variant:"outline",className:"h-7 w-full text-xs",disabled:C||x,onClick:()=>{X(m,!0)},children:C?M.jsxs(M.Fragment,{children:[M.jsx(Nr,{className:"size-3.5 animate-spin"}),"Loading..."]}):"Load older revisions"}):null]})]})})}function l8(){if(typeof window>"u")return"auto";const t=window.localStorage.getItem("theme");return t==="light"||t==="dark"||t==="auto"?t:"auto"}function up(t){const e=window.matchMedia("(prefers-color-scheme: dark)").matches,n=t==="auto"?e?"dark":"light":t;document.documentElement.classList.remove("light","dark"),document.documentElement.classList.add(n),t==="auto"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",t),document.documentElement.style.colorScheme=n}function c8(){const t=Me.c(13),[e,n]=S.useState("auto");let r,o;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{const h=l8();n(h),up(h)},o=[],t[0]=r,t[1]=o):(r=t[0],o=t[1]),S.useEffect(r,o);let s,i;t[2]!==e?(s=()=>{if(e!=="auto")return;const h=window.matchMedia("(prefers-color-scheme: dark)"),p=u8;return h.addEventListener("change",p),()=>{h.removeEventListener("change",p)}},i=[e],t[2]=e,t[3]=s,t[4]=i):(s=t[3],i=t[4]),S.useEffect(s,i);let a;t[5]!==e?(a=function(){const p=e==="light"?"dark":e==="dark"?"auto":"light";n(p),up(p),window.localStorage.setItem("theme",p)},t[5]=e,t[6]=a):a=t[6];const l=a,c=e==="auto"?"Theme mode: auto (system). Click to switch to light mode.":`Theme mode: ${e}. Click to switch mode.`,u=e==="auto"?hN:e==="dark"?CN:BN;let d;t[7]!==u?(d=M.jsx(u,{className:"size-4"}),t[7]=u,t[8]=d):d=t[8];let f;return t[9]!==c||t[10]!==d||t[11]!==l?(f=M.jsx("button",{type:"button",onClick:l,"aria-label":c,title:c,className:"text-muted-foreground hover:bg-background/65 hover:text-foreground focus-visible:ring-ring/35 inline-flex size-8 items-center justify-center rounded-md border-0 transition focus-visible:ring-2 focus-visible:outline-none",children:d}),t[9]=c,t[10]=d,t[11]=l,t[12]=f):f=t[12],f}function u8(){return up("auto")}const Iw="astro-md-editor:editor-mode",d8=vo({method:"POST"}).handler(wo("b1ee42a5714ab9be8f37a4c5fca02ffd6269030b4d3ef663ff002865393e2386")),f8=vo({method:"POST"}).handler(wo("a215cd23c3ee5dbffd561330a77a2b6ed0e0b5b10aac60190e712ffa6067a121")),h8=vo({method:"POST"}).handler(wo("248b908cf72b9979ba134470388db1f63e57871f390fb58a8be8d0757531e84c"));function b8(){const t=FT(),[e,n]=S.useState(t),r=_g.useSearch(),[o,s]=S.useState(!0),[i,a]=S.useState(!0),[l,c]=S.useState(!1),[u,d]=S.useState(!1),[f,h]=S.useState(),[p,g]=S.useState(),m=S.useRef(null),y=S.useRef(null),b=_g.useNavigate(),w=at(I=>I.draft),k=at(I=>I.contentDraft),v=at(I=>I.dirty),x=at(I=>I.editorMode),E=at(I=>I.setEditorMode),C=at(I=>I.richModeAvailability),A=at(I=>I.richModeBlockReason),z=at(I=>I.loadSelection),R=at(I=>I.clearSelection),_=at(I=>I.commitSavedState);S.useEffect(()=>{n(t)},[t]);const{selectedCollection:N,selectedFile:L,normalizedSearch:H}=S.useMemo(()=>MI(e,r),[e,r]);S.useEffect(()=>{of(r,H)||b({search:H,replace:!0})},[b,H,r]),S.useEffect(()=>{if(!N||!L){R();return}z({collectionName:N.name,fileId:L.id,data:L.data,content:L.content})},[R,z,N,L]),S.useEffect(()=>{if(!v)return;const I=Y=>{Y.preventDefault(),Y.returnValue=""};return window.addEventListener("beforeunload",I),()=>{window.removeEventListener("beforeunload",I)}},[v]),S.useEffect(()=>{const I=window.localStorage.getItem(Iw);(I==="basic"||I==="rich")&&E(I)},[E]),S.useEffect(()=>{window.localStorage.setItem(Iw,x)},[x]);const Z=S.useCallback(()=>v?window.confirm("You have unsaved changes. Discard changes and continue?"):!0,[v]),W=S.useCallback(I=>{const Y=e.find(se=>se.name===I);if(!Y)return;const G=sm(Y).at(0),X={collection:Y.name,file:G?.id};of(H,X)||Z()&&b({search:X})},[Z,e,b,H]),q=S.useCallback(I=>{if(!N)return;const Y={collection:N.name,file:I};of(H,Y)||Z()&&b({search:Y})},[Z,b,H,N]),V=S.useCallback(()=>{const I=m.current;if(!I){s(Y=>!Y);return}if(I.isCollapsed()){I.expand(),s(!0);return}I.collapse(),s(!1)},[]),D=S.useCallback(()=>{const I=y.current;if(!I){a(Y=>!Y);return}if(I.isCollapsed()){I.expand(),a(!0);return}I.collapse(),a(!1)},[]),j=S.useCallback(()=>{const I=!(m.current?.isCollapsed()??!1),Y=!(y.current?.isCollapsed()??!1);s(G=>G===I?G:I),a(G=>G===Y?G:Y)},[]),B=S.useCallback(async()=>{if(!(!N||!L||!v||l)){c(!0),g(void 0);try{await d8({data:{collectionName:N.name,fileId:L.id,draft:w,content:k}}),_(),Mr.success(`Saved ${ni(L)}.`)}catch(I){const Y=I instanceof Error?I.message:"Unable to save file.";g(Y),Mr.error(Y)}finally{c(!1)}}},[_,k,v,w,l,N,L]),F=S.useCallback(async I=>{if(!N||f)return;const Y=N.files.find(G=>G.id===I);if(Y&&!(v&&L?.id===I&&!window.confirm("This file has unsaved changes. Delete it anyway?"))){h(I),g(void 0);try{await f8({data:{collectionName:N.name,fileId:I}}),n(G=>G.map(X=>X.name!==N.name?X:{...X,files:X.files.filter(se=>se.id!==I)})),Mr.success(`Deleted ${ni(Y)}.`)}catch(G){const X=G instanceof Error?G.message:"Unable to delete file.";Mr.error(X)}finally{h(void 0)}}},[f,v,N,L?.id]),T=S.useCallback(async I=>{if(!(!N||u)){d(!0),g(void 0);try{const Y=await h8({data:{collectionName:N.name,slug:I}}),G=Y.fileId;n(X=>X.map(se=>se.name!==N.name?se:{...se,files:[...se.files,{id:Y.fileId,filePath:Y.filePath,data:{},content:""}]})),await b({search:{collection:N.name,file:Y.fileId}}),Mr.success(`Created ${G}.`)}catch(Y){const G=Y instanceof Error?Y.message:"Unable to create file.";Mr.error(G)}finally{d(!1)}}},[u,b,N]);S.useEffect(()=>{g(void 0)},[N?.name,L?.id]);const $=L?ni(L):"No file selected";return M.jsx("div",{className:"h-svh w-screen overflow-hidden p-2",children:M.jsxs(MP,{orientation:"horizontal",onLayoutChanged:j,defaultLayout:{"editor-left-sidebar":18,"editor-main-panel":64,"editor-right-sidebar":18},children:[M.jsx(nf,{id:"editor-left-sidebar",panelRef:m,collapsible:!0,collapsedSize:0,defaultSize:"18%",minSize:"14%",maxSize:"40%",className:"min-w-0",children:M.jsx("aside",{className:"bg-background/55 flex h-full flex-col overflow-hidden rounded-xl px-2.5 py-3 backdrop-blur-sm",children:M.jsx(RI,{collections:e,selectedCollectionName:N?.name,selectedFileId:L?.id,onSelectCollection:W,onSelectFile:q,onCreateFile:T,onDeleteFile:F,isCreatingFile:u,deletingFileId:f})})}),M.jsx(My,{withHandle:!0,className:ue(o?"mx-1 w-2 bg-transparent":"mx-0 w-0",!o&&"pointer-events-none opacity-0")}),M.jsx(nf,{id:"editor-main-panel",minSize:"30%",className:"min-w-0",children:M.jsxs("main",{className:"bg-background/75 flex h-full w-full min-w-0 flex-1 flex-col overflow-hidden rounded-xl px-3 py-2 backdrop-blur-sm",children:[M.jsxs("header",{className:"border-border/45 flex items-center justify-between gap-3 border-b pb-2",children:[M.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[M.jsx(pn,{variant:"ghost",size:"icon",onClick:V,"aria-label":o?"Hide left sidebar":"Show left sidebar",className:"text-muted-foreground hover:bg-background/65 hover:text-foreground size-8 border-0",children:o?M.jsx(MN,{}):M.jsx(ON,{})}),M.jsx(c8,{})]}),M.jsx("p",{className:"text-foreground/85 min-w-0 flex-1 truncate text-center text-sm font-medium",title:L?.id,children:$}),M.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-2",children:[M.jsx(Bx,{value:x,onValueChange:I=>{(I==="basic"||I==="rich")&&E(I)},className:"gap-0",children:M.jsxs(Vx,{className:"bg-muted/55 h-auto rounded-md p-0.5",children:[M.jsx(Hc,{value:"basic",className:"h-auto rounded-sm px-2 py-1 text-xs font-medium","aria-label":"Use basic editor mode",children:"Basic"}),M.jsx(Hc,{value:"rich",className:"h-auto rounded-sm px-2 py-1 text-xs font-medium",disabled:C==="blocked","aria-label":"Use rich editor mode",title:C==="blocked"?`Rich mode unavailable: ${A??"unsupported syntax detected"}`:"Use rich editor mode",children:"Rich"})]})}),v?M.jsxs(pn,{type:"button",variant:"ghost",size:"sm",onClick:B,disabled:l||!N||!L,className:"border-0",children:[l?M.jsx(Nr,{className:"animate-spin"}):M.jsx(zN,{}),"Save"]}):null,M.jsx(pn,{variant:"ghost",size:"icon",onClick:D,"aria-label":i?"Hide right sidebar":"Show right sidebar",className:"text-muted-foreground hover:bg-background/65 hover:text-foreground size-8 border-0",children:i?M.jsx(NN,{}):M.jsx(AN,{})})]})]}),p?M.jsx("p",{className:"text-destructive/90 pt-2 text-xs",children:p}):null,M.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden pt-1",children:M.jsx(R4,{currentFilePath:L?.filePath})})]})}),M.jsx(My,{withHandle:!0,className:ue(i?"mx-1 w-2 bg-transparent":"mx-0 w-0",!i&&"pointer-events-none opacity-0")}),M.jsx(nf,{id:"editor-right-sidebar",panelRef:y,collapsible:!0,collapsedSize:0,defaultSize:"18%",minSize:"14%",maxSize:"40%",className:"min-w-0",children:M.jsx("aside",{className:"bg-background/55 flex h-full flex-col overflow-hidden rounded-xl px-2.5 py-3 backdrop-blur-sm",children:M.jsx(a8,{selectedCollection:N,selectedFile:L})})})]})})}export{b8 as component};
|