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.
Files changed (25) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/index-UQt6zCrS.js +334 -0
  3. package/.output/public/assets/{main-_miJG8oz.js → main-DzXOjsqg.js} +1 -1
  4. package/.output/public/assets/styles-CezfLgHY.css +1 -0
  5. package/.output/server/{__root-C4T8UKZy.mjs → __root-CL_tq3ov.mjs} +1 -1
  6. package/.output/server/_libs/mixmark-io__domino.mjs +16632 -0
  7. package/.output/server/_libs/turndown.mjs +687 -675
  8. package/.output/server/_ssr/IconPickerPopover-fNUx2jAc.mjs +125 -0
  9. package/.output/server/_ssr/{ImageAssetBrowser-DWEdNK_g.mjs → ImageAssetBrowser-DNDdTqtf.mjs} +2 -2
  10. package/.output/server/_ssr/{collections.server-DyZEpKg6.mjs → collections.server-s12asITg.mjs} +24 -1
  11. package/.output/server/_ssr/{file-history.api-BLrUovD8.mjs → file-history.api-oydnxFVV.mjs} +8 -2
  12. package/.output/server/_ssr/{image-assets.server-Dn044pdj.mjs → image-assets.server-Ci2E1_Tm.mjs} +4 -2
  13. package/.output/server/_ssr/{image-preview.api-bqd1erIP.mjs → image-preview.api-pcN5PQhH.mjs} +2 -2
  14. package/.output/server/_ssr/{index-wJDNoCM2.mjs → index-BjQuGIib.mjs} +7 -2
  15. package/.output/server/_ssr/{index-2cOxFkCu.mjs → index-Bn1uKwTu.mjs} +527 -97
  16. package/.output/server/_ssr/index.mjs +17 -11
  17. package/.output/server/_ssr/{router-sxRLAh5a.mjs → router-dPC3iVPs.mjs} +2 -2
  18. package/.output/server/{_tanstack-start-manifest_v-CWdBk-ge.mjs → _tanstack-start-manifest_v-Da8tuNDH.mjs} +1 -1
  19. package/.output/server/index.mjs +50 -50
  20. package/LICENSE.md +21 -0
  21. package/README.md +71 -69
  22. package/package.json +3 -2
  23. package/scripts/bootstrap-collections.mjs +59 -13
  24. package/.output/public/assets/index-DVVq2QjK.js +0 -334
  25. package/.output/public/assets/styles-yeMm8TG7.css +0 -1
@@ -0,0 +1,334 @@
1
+ import{r as E,u as ln,R as Ow,j as M,a as dp,b as cr,c as Tn,T as ss,d as ST,w as Nw,e as lt,f as Me,L as Zn,g as de,h as ET,i as fr,k as hr,t as Hn,l as fp,m as CT,n as Cg}from"./main-DzXOjsqg.js";function _w(t){const e=E.useRef(!0);e.current&&(e.current=!1,t())}const TT=()=>{},ge=typeof document<"u"?E.useLayoutEffect:TT;function en(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 xo(t){return hp(t)?(t.nodeName||"").toLowerCase():"#document"}function Rt(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function pr(t){var e;return(e=(hp(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function hp(t){return ed()?t instanceof Node||t instanceof Rt(t).Node:!1}function tt(t){return ed()?t instanceof Element||t instanceof Rt(t).Element:!1}function yt(t){return ed()?t instanceof HTMLElement||t instanceof Rt(t).HTMLElement:!1}function rh(t){return!ed()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Rt(t).ShadowRoot}function So(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=Rn(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&o!=="inline"&&o!=="contents"}function MT(t){return/^(table|td|th)$/.test(xo(t))}function td(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const RT=/transform|translate|scale|rotate|perspective|filter/,OT=/paint|layout|strict|content/,Io=t=>!!t&&t!=="none";let qd;function pp(t){const e=tt(t)?Rn(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))||RT.test(e.willChange||"")||OT.test(e.contain||"")}function NT(t){let e=zr(t);for(;yt(e)&&!Ir(e);){if(pp(e))return e;if(td(e))return null;e=zr(e)}return null}function nd(){return qd==null&&(qd=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),qd}function Ir(t){return/^(html|body|#document)$/.test(xo(t))}function Rn(t){return Rt(t).getComputedStyle(t)}function rd(t){return tt(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function zr(t){if(xo(t)==="html")return t;const e=t.assignedSlot||t.parentNode||rh(t)&&t.host||pr(t);return rh(e)?e.host:e}function Pw(t){const e=zr(t);return Ir(e)?t.ownerDocument?t.ownerDocument.body:t.body:yt(e)&&So(e)?e:Pw(e)}function io(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=Pw(t),s=o===((r=t.ownerDocument)==null?void 0:r.body),i=Rt(o);if(s){const a=oh(i);return e.concat(i,i.visualViewport||[],So(o)?o:[],a&&n?io(a):[])}else return e.concat(o,io(o,[],n))}function oh(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Ft(t){const e=ln(_T,t).current;return e.next=t,ge(e.effect),e}function _T(t){const e={current:t,next:t,effect:()=>{e.current=e.next}};return e}const Ud=Ow[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],PT=Ud&&Ud!==E.useLayoutEffect?Ud:t=>t();function pe(t){const e=ln(AT).current;return e.next=t,PT(e.effect),e.trampoline}function AT(){const t={next:void 0,callback:IT,trampoline:(...e)=>t.callback?.(...e),effect:()=>{t.callback=t.next}};return t}function IT(){}function Je(t){return t?.ownerDocument||document}const Oi=typeof navigator<"u",Kd=zT(),Aw=jT(),Iw=LT(),mp=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),$w=Kd.platform==="MacIntel"&&Kd.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Kd.platform),$T=Oi&&/apple/i.test(navigator.vendor),sh=Oi&&/android/i.test(Aw)||/android/i.test(Iw);Oi&&Aw.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const DT=Iw.includes("jsdom/");function zT(){if(!Oi)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 LT(){if(!Oi)return"";const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(({brand:e,version:n})=>`${e}/${n}`).join(" "):navigator.userAgent}function jT(){if(!Oi)return"";const t=navigator.userAgentData;return t?.platform?t.platform:navigator.platform??""}const ih="data-base-ui-focusable",Dw="active",zw="selected",Lw="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",ao="ArrowLeft",lo="ArrowRight",gp="ArrowUp",Wa="ArrowDown";function Wn(t){let e=t.activeElement;for(;e?.shadowRoot?.activeElement!=null;)e=e.shadowRoot.activeElement;return e}function He(t,e){if(!t||!e)return!1;const n=e.getRootNode?.();if(t.contains(e))return!0;if(n&&rh(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function jw(t,e){if(!tt(t))return!1;const n=t;if(e.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,r]of e.entries())if(He(r,n))return!r.hasAttribute("data-trigger-disabled");return!1}function xn(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 FT(t){return t.matches("html,body")}function yp(t){return yt(t)&&t.matches(Lw)}function ah(t){return t?t.getAttribute("role")==="combobox"&&yp(t):!1}function xa(t){return t?t.hasAttribute(ih)?t:t.querySelector(`[${ih}]`)||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 Tg(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 Jt(t){t.preventDefault(),t.stopPropagation()}function BT(t){return"nativeEvent"in t}function Fw(t){return t.pointerType===""&&t.isTrusted?!0:sh&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function Bw(t){return DT?!1:!sh&&t.width===0&&t.height===0||sh&&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 ui(t,e){const n=["mouse","pen"];return e||n.push("",void 0),n.includes(t)}function Vw(t){const e=t.type;return e==="click"||e==="mousedown"||e==="keydown"||e==="keyup"}const VT=["top","right","bottom","left"],di=Math.min,Sn=Math.max,$c=Math.round,qs=Math.floor,lr=t=>({x:t,y:t}),HT={left:"right",right:"left",bottom:"top",top:"bottom"};function lh(t,e,n){return Sn(t,di(e,n))}function Lr(t,e){return typeof t=="function"?t(e):t}function gn(t){return t.split("-")[0]}function Eo(t){return t.split("-")[1]}function bp(t){return t==="x"?"y":"x"}function vp(t){return t==="y"?"height":"width"}function Dn(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function wp(t){return bp(Dn(t))}function WT(t,e,n){n===void 0&&(n=!1);const r=Eo(t),o=wp(t),s=vp(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(i=Dc(i)),[i,Dc(i)]}function qT(t){const e=Dc(t);return[ch(t),e,ch(e)]}function ch(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Mg=["left","right"],Rg=["right","left"],UT=["top","bottom"],KT=["bottom","top"];function YT(t,e,n){switch(t){case"top":case"bottom":return n?e?Rg:Mg:e?Mg:Rg;case"left":case"right":return e?UT:KT;default:return[]}}function GT(t,e,n,r){const o=Eo(t);let s=YT(gn(t),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),e&&(s=s.concat(s.map(ch)))),s}function Dc(t){const e=gn(t);return HT[e]+t.slice(e.length)}function ZT(t){return{top:0,right:0,bottom:0,left:0,...t}}function Hw(t){return typeof t!="number"?ZT(t):{top:t,right:t,bottom:t,left:t}}function zc(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 ol(t,e,n){return Math.floor(t/e)!==n}function Zs(t,e){return e<0||e>=t.current.length}function Tc(t,e){return Ut(t,{disabledIndices:e})}function uh(t,e){return Ut(t,{decrement:!0,startingIndex:t.current.length,disabledIndices:e})}function Ut(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&&co(t,s,r));return s}function Ww(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 m=p&&f.length>0&&f.some(y=>y.length!==s);function g(y){if(!m||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 S=Math.min(w,x.length-1);for(let T=S;T>=0;T-=1){const I=x[T];if(!co(t,I,i))return I}k=y==="up"?k-1:k+1,r&&(k<0?k=f.length-1:k>=f.length&&(k=0))}}if(e.key===gp){const y=g("up");if(y!==void 0)u&&Jt(e),d=y;else{if(u&&Jt(e),c===-1)d=l;else if(d=Ut(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}Zs(t,d)&&(d=c)}}if(e.key===Wa){const y=g("down");y!==void 0?(u&&Jt(e),d=y):(u&&Jt(e),c===-1?d=a:(d=Ut(t,{startingIndex:c,amount:s,disabledIndices:i}),r&&c+s>l&&(d=Ut(t,{startingIndex:c%s-s,amount:s,disabledIndices:i}))),Zs(t,d)&&(d=c))}if(n==="both"){const y=qs(c/s);e.key===(o?ao:lo)&&(u&&Jt(e),c%s!==s-1?(d=Ut(t,{startingIndex:c,disabledIndices:i}),r&&ol(d,s,y)&&(d=Ut(t,{startingIndex:c-c%s-1,disabledIndices:i}))):r&&(d=Ut(t,{startingIndex:c-c%s-1,disabledIndices:i})),ol(d,s,y)&&(d=c)),e.key===(o?lo:ao)&&(u&&Jt(e),c%s!==0?(d=Ut(t,{startingIndex:c,decrement:!0,disabledIndices:i}),r&&ol(d,s,y)&&(d=Ut(t,{startingIndex:c+(s-c%s),decrement:!0,disabledIndices:i}))):r&&(d=Ut(t,{startingIndex:c+(s-c%s),decrement:!0,disabledIndices:i})),ol(d,s,y)&&(d=c));const b=qs(l/s)===y;Zs(t,d)&&(r&&b?d=e.key===(o?lo:ao)?l:Ut(t,{startingIndex:c-c%s-1,disabledIndices:i}):d=c)}return d}function qw(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 Uw(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 Kw(t,e){return e.flatMap((n,r)=>t.includes(n)?[r]:[])}function co(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 JT=["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] *)"],Lc=JT.join(","),Yw=typeof Element>"u",fi=Yw?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,jc=!Yw&&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},Fc=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]"):Fc(e.parentNode));return i},XT=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},Gw=function(e,n,r){if(Fc(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(Lc));return n&&fi.call(e,Lc)&&o.unshift(e),o=o.filter(r),o},Bc=function(e,n,r){for(var o=[],s=Array.from(e);s.length;){var i=s.shift();if(!Fc(i,!1))if(i.tagName==="SLOT"){var a=i.assignedElements(),l=a.length?a:i.children,c=Bc(l,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:i,candidates:c})}else{var u=fi.call(i,Lc);u&&r.filter(i)&&(n||!e.includes(i))&&o.push(i);var d=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),f=!Fc(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(d&&f){var h=Bc(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},Zw=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Jw=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||XT(e))&&!Zw(e)?0:e.tabIndex},QT=function(e,n){var r=Jw(e);return r<0&&n&&!Zw(e)?0:r},eM=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},Xw=function(e){return e.tagName==="INPUT"},tM=function(e){return Xw(e)&&e.type==="hidden"},nM=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},rM=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},oM=function(e){if(!e.name)return!0;var n=e.form||jc(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=rM(o,e.form);return!s||s===e},sM=function(e){return Xw(e)&&e.type==="radio"},iM=function(e){return sM(e)&&!oM(e)},aM=function(e){var n,r=e&&jc(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=jc(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},Og=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},lM=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=fi.call(e,"details>summary:first-of-type"),a=i?e.parentElement:e;if(fi.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=jc(e);if(c&&!c.shadowRoot&&o(c)===!0)return Og(e);e.assignedSlot?e=e.assignedSlot:!c&&u!==e.ownerDocument?e=u.host:e=c}e=l}if(aM(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Og(e);return!1},cM=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 fi.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},dh=function(e,n){return!(n.disabled||tM(n)||lM(n,e)||nM(n)||cM(n))},fh=function(e,n){return!(iM(n)||Jw(n)<0||!dh(e,n))},uM=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Qw=function(e){var n=[],r=[];return e.forEach(function(o,s){var i=!!o.scopeParent,a=i?o.scopeParent:o,l=QT(a,i),c=i?Qw(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(eM).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},qa=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Bc([e],n.includeContainer,{filter:fh.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:uM}):r=Gw(e,n.includeContainer,fh.bind(null,n)),Qw(r)},dM=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Bc([e],n.includeContainer,{filter:dh.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=Gw(e,n.includeContainer,dh.bind(null,n)),r},ek=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return fi.call(e,Lc)===!1?!1:fh(n,e)};const Ni=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function tk(t,e){const n=qa(t,Ni()),r=n.length;if(r===0)return;const o=Wn(Je(t)),s=n.indexOf(o),i=s===-1?e===1?0:r-1:s+e;return n[i]}function kp(t){return tk(Je(t).body,1)||t}function nk(t){return tk(Je(t).body,-1)||t}function rk(t,e){if(!t)return null;const n=qa(Je(t).body,Ni()),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 fM(t){return rk(t,1)}function hM(t){return rk(t,-1)}function Js(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!He(n,r)}function pM(t){qa(t,Ni()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Ng(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 mM={...Ow};let _g=0;function gM(t,e="mui"){const[n,r]=E.useState(t),o=t||n;return E.useEffect(()=>{n==null&&(_g+=1,r(`${e}-${_g}`))},[n,e]),o}const Pg=mM.useId;function _i(t,e){if(Pg!==void 0){const n=Pg();return t??(e?`${e}-${n}`:n)}return gM(t,e)}function ok(){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 yM{nodesRef={current:[]};events=ok();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 sk=E.createContext(null),ik=E.createContext(null),Co=()=>E.useContext(sk)?.id||null,ys=t=>{const e=E.useContext(ik);return t??e};function bM(t){const e=_i(),n=ys(t),r=Co();return ge(()=>{if(!e)return;const o={id:e,parentId:r};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,e,r]),e}function vM(t){const{children:e,id:n}=t,r=Co();return M.jsx(sk.Provider,{value:E.useMemo(()=>({id:n,parentId:r}),[n,r]),children:e})}function wM(t){const{children:e,externalTree:n}=t,r=ln(()=>n??new yM).current;return M.jsx(ik.Provider,{value:r,children:e})}function pn(){}const Sa=Object.freeze([]),$t=Object.freeze({}),kM=500,xM={style:{transition:"none"}},ak="data-base-ui-click-trigger",SM={fallbackAxisSide:"none"},EM={fallbackAxisSide:"end"},CM={clipPath:"inset(50%)",position:"fixed",top:0,left:0},yo="none",hi="trigger-press",En="trigger-hover",xp="outside-press",Yd="item-press",TM="close-press",is="focus-out",lk="escape-key",Gd="list-navigation",MM="cancel-open",ck="imperative-action",RM="window-resize";function Fe(t,e,n,r){let o=!1,s=!1;const i=r??$t;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 Ea(t){return`data-base-ui-${t}`}function Zd(t,e,n){if(n&&!ui(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 jr(t,e,n,r){const o=ln(uk).current;return NM(o,t,e,n,r)&&dk(o,[t,e,n,r]),o.callback}function OM(t){const e=ln(uk).current;return _M(e,t)&&dk(e,t),e.callback}function uk(){return{callback:null,cleanup:null,refs:[]}}function NM(t,e,n,r,o){return t.refs[0]!==e||t.refs[1]!==n||t.refs[2]!==r||t.refs[3]!==o}function _M(t,e){return t.refs.length!==e.length||t.refs.some((n,r)=>n!==e[r])}function dk(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 fk={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},od={...fk,position:"fixed",top:0,left:0},hk={...fk,position:"absolute"},sl=null;class PM{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 il=new PM;class sr{static create(){return new sr}static request(e){return il.request(e)}static cancel(e){return il.cancel(e)}currentId=sl;request(e){this.cancel(),this.currentId=il.request(()=>{this.currentId=sl,e()})}cancel=()=>{this.currentId!==sl&&(il.cancel(this.currentId),this.currentId=sl)};disposeEffect=()=>this.cancel}function sd(){const t=ln(sr.create).current;return dp(t.disposeEffect),t}const pi=E.forwardRef(function(e,n){const[r,o]=E.useState();ge(()=>{$T&&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 Ag=0;function aa(t,e={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=e;r&&cancelAnimationFrame(Ag);const s=()=>t?.focus({preventScroll:n});o?s():Ag=requestAnimationFrame(s)}const Xs={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Ig(t){return t==="inert"?Xs.inert:t==="aria-hidden"?Xs["aria-hidden"]:Xs.none}let al=new WeakSet,ll={},Jd=0;const pk=t=>t&&(t.host||pk(t.parentNode)),AM=(t,e)=>e.map(n=>{if(t.contains(n))return n;const r=pk(n);return t.contains(r)?r:null}).filter(n=>n!=null);function IM(t,e,n,r){const o="data-base-ui-inert",s=r?"inert":n?"aria-hidden":null,i=AM(e,t),a=new Set,l=new Set(i),c=[];ll[o]||(ll[o]=new WeakMap);const u=ll[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(xo(p)!=="script")if(a.has(p))f(p);else{const m=s?p.getAttribute(s):null,g=m!==null&&m!=="false",y=Ig(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&&g&&al.add(p),w===1&&p.setAttribute(o,""),!g&&s&&p.setAttribute(s,s==="inert"?"":"true")}})}return Jd+=1,()=>{c.forEach(h=>{const p=Ig(s),g=(p.get(h)||0)-1,y=(u.get(h)||0)-1;p.set(h,g),u.set(h,y),g||(!al.has(h)&&s&&h.removeAttribute(s),al.delete(h)),y||h.removeAttribute(o)}),Jd-=1,Jd||(Xs.inert=new WeakMap,Xs["aria-hidden"]=new WeakMap,Xs.none=new WeakMap,al=new WeakSet,ll={})}}function $M(t,e=!1,n=!1){const r=Je(t[0]).body;return IM(t.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,e,n)}const DM=parseInt(E.version,10);function Sp(t){return DM>=t}function $g(t){if(!E.isValidElement(t))return null;const e=t,n=e.props;return(Sp(19)?n?.ref:e.ref)??null}function hh(t,e){if(t&&!e)return t;if(!t&&e)return e;if(t||e)return{...t,...e}}function zM(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 LM(t,e){return typeof t=="function"?t(e):t}function jM(t,e){return typeof t=="function"?t(e):t}const la={};function Pi(t,e,n,r,o){let s={...ph(t,la)};return e&&(s=Ji(s,e)),n&&(s=Ji(s,n)),r&&(s=Ji(s,r)),o&&(s=Ji(s,o)),s}function FM(t){if(t.length===0)return la;if(t.length===1)return ph(t[0],la);let e={...ph(t[0],la)};for(let n=1;n<t.length;n+=1)e=Ji(e,t[n]);return e}function Ji(t,e){return mk(e)?e(t):BM(t,e)}function BM(t,e){if(!e)return t;for(const n in e){const r=e[n];switch(n){case"style":{t[n]=hh(t.style,r);break}case"className":{t[n]=gk(t.className,r);break}default:VM(n,r)?t[n]=HM(t[n],r):t[n]=r}}return t}function VM(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 mk(t){return typeof t=="function"}function ph(t,e){return mk(t)?t(e):t??la}function HM(t,e){return e?t?n=>{if(WM(n)){const o=n;mh(o);const s=e(o);return o.baseUIHandlerPrevented||t?.(o),s}const r=e(n);return t?.(n),r}:e:t}function mh(t){return t.preventBaseUIHandler=()=>{t.baseUIHandlerPrevented=!0},t}function gk(t,e){return e?t?e+" "+t:e:t}function WM(t){return t!=null&&typeof t=="object"&&"nativeEvent"in t}function ot(t,e,n={}){const r=e.render,o=qM(e,n);if(n.enabled===!1)return null;const s=n.state??$t;return KM(t,r,o,s)}function qM(t,e={}){const{className:n,style:r,render:o}=t,{state:s=$t,ref:i,props:a,stateAttributesMapping:l,enabled:c=!0}=e,u=c?LM(n,s):void 0,d=c?jM(r,s):void 0,f=c?zM(s,l):$t,h=c?hh(f,Array.isArray(a)?FM(a):a)??$t:$t;return typeof document<"u"&&(c?Array.isArray(i)?h.ref=OM([h.ref,$g(o),...i]):h.ref=jr(h.ref,$g(o),i):jr(null,null)),c?(u!==void 0&&(h.className=gk(h.className,u)),d!==void 0&&(h.style=hh(h.style,d)),h):$t}const UM=Symbol.for("react.lazy");function KM(t,e,n,r){if(e){if(typeof e=="function")return e(n,r);const o=Pi(n,e.props);o.ref=n.ref;let s=e;return s?.$$typeof===UM&&(s=E.Children.toArray(e)[0]),E.cloneElement(s,o)}if(t&&typeof t=="string")return YM(t,n);throw new Error(en(8))}function YM(t,e){return t==="button"?E.createElement("button",{type:"button",...e,key:e.key}):t==="img"?E.createElement("img",{alt:"",...e,key:e.key}):E.createElement(t,e)}const yk=E.createContext(null),bk=()=>E.useContext(yk),GM=Ea("portal");function ZM(t={}){const{ref:e,container:n,componentProps:r=$t,elementProps:o}=t,s=_i(),a=bk()?.portalNode,[l,c]=E.useState(null),[u,d]=E.useState(null),f=pe(g=>{g!==null&&d(g)}),h=E.useRef(null);ge(()=>{if(n===null){h.current&&(h.current=null,d(null),c(null));return}if(s==null)return;const g=(n&&(hp(n)?n:n.current))??a??document.body;if(g==null){h.current&&(h.current=null,d(null),c(null));return}h.current!==g&&(h.current=g,d(null),c(g))},[n,a,s]);const p=ot("div",r,{ref:[e,f],props:[{id:s,[GM]:""},o]});return{portalNode:u,portalSubtree:l&&p?cr.createPortal(p,l):null}}const Ep=E.forwardRef(function(e,n){const{children:r,container:o,className:s,render:i,renderGuards:a,...l}=e,{portalNode:c,portalSubtree:u}=ZM({container:o,ref:n,componentProps:e,elementProps:l}),d=E.useRef(null),f=E.useRef(null),h=E.useRef(null),p=E.useRef(null),[m,g]=E.useState(null),y=m?.modal,b=m?.open,w=typeof a=="boolean"?a:!!m&&!m.modal&&m.open&&!!c;E.useEffect(()=>{if(!c||y)return;function v(x){c&&x.relatedTarget&&Js(x)&&(x.type==="focusin"?Ng:pM)(c)}return c.addEventListener("focusin",v,!0),c.addEventListener("focusout",v,!0),()=>{c.removeEventListener("focusin",v,!0),c.removeEventListener("focusout",v,!0)}},[c,y]),E.useEffect(()=>{!c||b||Ng(c)},[b,c]);const k=E.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:h,afterInsideRef:p,portalNode:c,setFocusManagerState:g}),[c]);return M.jsxs(E.Fragment,{children:[u,M.jsxs(yk.Provider,{value:k,children:[w&&c&&M.jsx(pi,{"data-type":"outside",ref:d,onFocus:v=>{if(Js(v,c))h.current?.focus();else{const x=m?m.domReference:null;nk(x)?.focus()}}}),w&&c&&M.jsx("span",{"aria-owns":c.id,style:CM}),c&&cr.createPortal(r,c),w&&c&&M.jsx(pi,{"data-type":"outside",ref:f,onFocus:v=>{if(Js(v,c))p.current?.focus();else{const x=m?m.domReference:null;kp(x)?.focus(),m?.closeOnFocusOut&&m?.onOpenChange(!1,Fe(is,v.nativeEvent))}}})]})]})});function Rr(t){return t==null?t:"current"in t?t.current:t}function JM(t,e){const n=Rt(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 Dg=20;let no=[];function Cp(){no=no.filter(t=>t.deref()?.isConnected)}function XM(t){Cp(),t&&xo(t)!=="body"&&(no.push(new WeakRef(t)),no.length>Dg&&(no=no.slice(-Dg)))}function Xd(){return Cp(),no[no.length-1]?.deref()}function QM(t){if(!t)return null;const e=Ni();return ek(t,e)?t:qa(t,e)[0]||t}function eR(t){return!t||!t.isConnected?!1:typeof t.checkVisibility=="function"?t.checkVisibility():Rn(t).display!=="none"}function zg(t,e){if(!e.current.includes("floating")&&!t.getAttribute("role")?.includes("dialog"))return;const n=Ni(),o=dM(t,n).filter(i=>{const a=i.getAttribute("data-tabindex")||"";return ek(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 Tp(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,m=p.useState("open"),g=p.useState("domReferenceElement"),y=p.useState("floatingElement"),{events:b,dataRef:w}=p.context,k=pe(()=>w.current.floatingContext?.nodeId),v=o===!1,x=ah(g)&&v,S=E.useRef(["content"]),T=Ft(o),I=Ft(s),L=Ft(c),N=ys(h),P=bk(),A=E.useRef(null),j=E.useRef(null),K=E.useRef(!1),J=E.useRef(!1),Y=E.useRef(!1),G=E.useRef(-1),U=E.useRef(""),z=E.useRef(""),B=E.useRef(null),H=E.useRef(null),V=jr(B,f,P?.beforeInsideRef),R=jr(H,P?.afterInsideRef),D=Tn(),$=Tn(),Z=sd(),Q=P!=null,_=xa(y),q=pe((F=_)=>F?qa(F,Ni()):[]),C=pe(F=>{const W=q(F);return S.current.map(()=>W).filter(Boolean).flat()});E.useEffect(()=>{if(r||!a)return;function F(X){X.key==="Tab"&&He(_,Wn(Je(_)))&&q().length===0&&!x&&Jt(X)}const W=Je(_);return W.addEventListener("keydown",F),()=>{W.removeEventListener("keydown",F)}},[r,g,_,a,S,x,q,C]),E.useEffect(()=>{if(r||!m)return;const F=Je(_);function W(){Y.current=!1}function X(ne){const oe=xn(ne),re=He(y,oe)||He(g,oe)||He(P?.portalNode,oe);Y.current=!re,z.current=ne.pointerType||"keyboard",oe?.closest(`[${ak}]`)&&(J.current=!0)}function ee(){z.current="keyboard"}return F.addEventListener("pointerdown",X,!0),F.addEventListener("pointerup",W,!0),F.addEventListener("pointercancel",W,!0),F.addEventListener("keydown",ee,!0),()=>{F.removeEventListener("pointerdown",X,!0),F.removeEventListener("pointerup",W,!0),F.removeEventListener("pointercancel",W,!0),F.removeEventListener("keydown",ee,!0)}},[r,y,g,_,m,P]),E.useEffect(()=>{if(r||!l)return;const F=Je(_);function W(){J.current=!0,$.start(0,()=>{J.current=!1})}function X(ae){const te=xn(ae),ye=q().indexOf(te);ye!==-1&&(G.current=ye)}function ee(ae){const te=ae.relatedTarget,fe=ae.currentTarget,ye=xn(ae);queueMicrotask(()=>{const he=k(),qe=p.context.triggerElements,Ye=te?.hasAttribute(Ea("focus-guard"))&&[B.current,H.current,P?.beforeInsideRef.current,P?.afterInsideRef.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,Rr(d),Rr(u)].includes(te),st=!(He(g,te)||He(y,te)||He(te,y)||He(P?.portalNode,te)||te!=null&&qe.hasElement(te)||qe.hasMatchingElement(Ae=>He(Ae,te))||Ye||N&&(Xo(N.nodesRef.current,he).find(Ae=>He(Ae.context?.elements.floating,te)||He(Ae.context?.elements.domReference,te))||Tg(N.nodesRef.current,he).find(Ae=>[Ae.context?.elements.floating,xa(Ae.context?.elements.floating)].includes(te)||Ae.context?.elements.domReference===te)));if(fe===g&&_&&zg(_,S),i&&fe!==g&&!eR(ye)&&Wn(F)===F.body){if(yt(_)&&(_.focus(),i==="popup")){Z.request(()=>{_.focus()});return}const Ae=G.current,_e=q(),Ue=_e[Ae]||_e[_e.length-1]||_;yt(Ue)&&Ue.focus()}if(w.current.insideReactTree){w.current.insideReactTree=!1;return}(x||!a)&&te&&st&&!J.current&&(x||te!==Xd())&&(K.current=!0,p.setOpen(!1,Fe(is,ae)))})}function ne(){Y.current||(w.current.insideReactTree=!0,D.start(0,()=>{w.current.insideReactTree=!1}))}const oe=yt(g)?g:null,re=[];if(!(!y&&!oe))return oe&&(oe.addEventListener("focusout",ee),oe.addEventListener("pointerdown",W),re.push(()=>{oe.removeEventListener("focusout",ee),oe.removeEventListener("pointerdown",W)})),y&&(y.addEventListener("focusin",X),y.addEventListener("focusout",ee),P&&(y.addEventListener("focusout",ne,!0),re.push(()=>{y.removeEventListener("focusout",ne,!0)})),re.push(()=>{y.removeEventListener("focusin",X),y.removeEventListener("focusout",ee)})),()=>{re.forEach(ae=>{ae()})}},[r,g,y,_,a,N,P,p,l,i,q,x,k,S,w,D,$,Z,u,d]),E.useEffect(()=>{if(r||!y||!m)return;const F=Array.from(P?.portalNode?.querySelectorAll(`[${Ea("portal")}]`)||[]),X=(N?Tg(N.nodesRef.current,k()):[]).find(ne=>ah(ne.context?.elements.domReference||null))?.context?.elements.domReference,ee=[y,X,...F,A.current,j.current,B.current,H.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,Rr(d),Rr(u),x?g:null].filter(ne=>ne!=null);return $M(ee,a||x)},[m,r,g,y,a,S,P,x,N,k,u,d]),ge(()=>{if(!m||r||!yt(_))return;const F=Je(_),W=Wn(F);queueMicrotask(()=>{const X=C(_),ee=T.current,ne=typeof ee=="function"?ee(L.current||""):ee;if(ne===void 0||ne===!1)return;let oe;ne===!0||ne===null?oe=X[0]||_:oe=Rr(ne),oe=oe||X[0]||_,!He(_,W)&&aa(oe,{preventScroll:oe===_})})},[r,m,_,v,C,T,L]),ge(()=>{if(r||!_)return;const F=Je(_),W=Wn(F);XM(W);function X(oe){if(oe.open||(U.current=JM(oe.nativeEvent,z.current)),oe.reason===En&&oe.nativeEvent.type==="mouseleave"&&(K.current=!0),oe.reason===xp)if(oe.nested)K.current=!1;else if(Fw(oe.nativeEvent)||Bw(oe.nativeEvent))K.current=!1;else{let re=!1;document.createElement("div").focus({get preventScroll(){return re=!0,!1}}),re?K.current=!1:K.current=!0}}b.on("openchange",X);const ee=F.createElement("span");ee.setAttribute("tabindex","-1"),ee.setAttribute("aria-hidden","true"),Object.assign(ee.style,od),Q&&g&&g.insertAdjacentElement("afterend",ee);function ne(){const oe=I.current;let re=typeof oe=="function"?oe(U.current):oe;if(re===void 0||re===!1)return null;if(re===null&&(re=!0),typeof re=="boolean"){const te=g||Xd();return te&&te.isConnected?te:ee}const ae=g||Xd()||ee;return Rr(re)||ae}return()=>{b.off("openchange",X);const oe=Wn(F),re=He(y,oe)||N&&Xo(N.nodesRef.current,k(),!1).some(te=>He(te.context?.elements.floating,oe)),ae=ne();queueMicrotask(()=>{const te=QM(ae),fe=typeof I.current!="boolean";I.current&&!K.current&&yt(te)&&(!(!fe&&te!==oe&&oe!==F.body)||re)&&te.focus({preventScroll:!0}),ee.remove(),K.current=!1})}},[r,y,_,I,w,b,N,Q,g,k]),ge(()=>{if(!mp||m||!y)return;const F=Wn(Je(y));!yt(F)||!yp(F)||He(y,F)&&F.blur()},[m,y]),ge(()=>{if(!(r||!P))return P.setFocusManagerState({modal:a,closeOnFocusOut:l,open:m,onOpenChange:p.setOpen,domReference:g}),()=>{P.setFocusManagerState(null)}},[r,P,a,m,p,l,g]),ge(()=>{if(!(r||!_))return zg(_,S),()=>{queueMicrotask(Cp)}},[r,_,S]);const O=!r&&(a?!x:!0)&&(Q||a);return M.jsxs(E.Fragment,{children:[O&&M.jsx(pi,{"data-type":"inside",ref:V,onFocus:F=>{if(a){const W=C();aa(W[W.length-1])}else P?.portalNode&&(K.current=!1,Js(F,P.portalNode)?kp(g)?.focus():Rr(d??P.beforeOutsideRef)?.focus())}}),n,O&&M.jsx(pi,{"data-type":"inside",ref:R,onFocus:F=>{a?aa(C()[0]):P?.portalNode&&(l&&(K.current=!0),Js(F,P.portalNode)?nk(g)?.focus():Rr(u??P.afterOutsideRef)?.focus())}})]})}function vk(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=hi}=e,d=E.useRef(void 0),f=sd(),h=Tn(),p=E.useMemo(()=>({onPointerDown(m){d.current=m.pointerType},onMouseDown(m){const g=d.current,y=m.nativeEvent,b=n.select("open");if(m.button!==0||s==="click"||ui(g,!0)&&a)return;const w=r.current.openEvent,k=w?.type,v=n.select("domReferenceElement")!==m.currentTarget,x=b&&v||!(b&&i&&(!(w&&l)||k==="click"||k==="mousedown"));if(yp(y.target)){const T=Fe(u,y,y.target);x&&g==="touch"&&c>0?h.start(c,()=>{n.setOpen(!0,T)}):n.setOpen(x,T);return}const S=m.currentTarget;f.request(()=>{const T=Fe(u,y,S);x&&g==="touch"&&c>0?h.start(c,()=>{n.setOpen(!0,T)}):n.setOpen(x,T)})},onClick(m){if(s==="mousedown-only")return;const g=d.current;if(s==="mousedown"&&g){d.current=void 0;return}if(ui(g,!0)&&a)return;const y=n.select("open"),b=r.current.openEvent,w=n.select("domReferenceElement")!==m.currentTarget,k=y&&w||!(y&&i&&(!(b&&l)||Vw(b))),v=Fe(u,m.nativeEvent,m.currentTarget);k&&g==="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 E.useMemo(()=>o?{reference:p}:$t,[o,p])}function Lg(t,e,n){let{reference:r,floating:o}=t;const s=Dn(e),i=wp(e),a=vp(i),l=gn(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(Eo(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 tR(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}=Lr(e,t),p=Hw(h),g=a[f?d==="floating"?"reference":"floating":d],y=zc(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(g)))==null||n?g:g.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=zc(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 nR=50,rR=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:tR},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}=Lg(c,r,l),f=r,h=0;const p={};for(let m=0;m<s.length;m++){const g=s[m];if(!g)continue;const{name:y,fn:b}=g,{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<nR&&(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}=Lg(c,f,l)),m=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:p}},oR=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:m=!0,...g}=Lr(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=gn(o),b=Dn(a),w=gn(a)===a,k=await(l.isRTL==null?void 0:l.isRTL(c.floating)),v=f||(w||!m?[Dc(a)]:qT(a)),x=p!=="none";!f&&x&&v.push(...GT(a,m,p,k));const S=[a,...v],T=await l.detectOverflow(e,g),I=[];let L=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&I.push(T[y]),d){const j=WT(o,i,k);I.push(T[j[0]],T[j[1]])}if(L=[...L,{placement:o,overflows:I}],!I.every(j=>j<=0)){var N,P;const j=(((N=s.flip)==null?void 0:N.index)||0)+1,K=S[j];if(K&&(!(d==="alignment"?b!==Dn(K):!1)||L.every(G=>Dn(G.placement)===b?G.overflows[0]>0:!0)))return{data:{index:j,overflows:L},reset:{placement:K}};let J=(P=L.filter(Y=>Y.overflows[0]<=0).sort((Y,G)=>Y.overflows[1]-G.overflows[1])[0])==null?void 0:P.placement;if(!J)switch(h){case"bestFit":{var A;const Y=(A=L.filter(G=>{if(x){const U=Dn(G.placement);return U===b||U==="y"}return!0}).map(G=>[G.placement,G.overflows.filter(U=>U>0).reduce((U,z)=>U+z,0)]).sort((G,U)=>G[1]-U[1])[0])==null?void 0:A[0];Y&&(J=Y);break}case"initialPlacement":J=a;break}if(o!==J)return{reset:{placement:J}}}return{}}}};function jg(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Fg(t){return VT.some(e=>t[e]>=0)}const sR=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:o="referenceHidden",...s}=Lr(t,e);switch(o){case"referenceHidden":{const i=await r.detectOverflow(e,{...s,elementContext:"reference"}),a=jg(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Fg(a)}}}case"escaped":{const i=await r.detectOverflow(e,{...s,altBoundary:!0}),a=jg(i,n.floating);return{data:{escapedOffsets:a,escaped:Fg(a)}}}default:return{}}}}},wk=new Set(["left","top"]);async function iR(t,e){const{placement:n,platform:r,elements:o}=t,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=gn(n),a=Eo(n),l=Dn(n)==="y",c=wk.has(i)?-1:1,u=s&&l?-1:1,d=Lr(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 aR=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 iR(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}}}}},lR=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}=Lr(t,e),u={x:n,y:r},d=await s.detectOverflow(e,c),f=Dn(gn(o)),h=bp(f);let p=u[h],m=u[f];if(i){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",w=p+d[y],k=p-d[b];p=lh(w,p,k)}if(a){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",w=m+d[y],k=m-d[b];m=lh(w,m,k)}const g=l.fn({...e,[h]:p,[f]:m});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[h]:i,[f]:a}}}}}},cR=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}=Lr(t,e),u={x:n,y:r},d=Dn(o),f=bp(d);let h=u[f],p=u[d];const m=Lr(a,e),g=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const w=f==="y"?"height":"width",k=s.reference[f]-s.floating[w]+g.mainAxis,v=s.reference[f]+s.reference[w]-g.mainAxis;h<k?h=k:h>v&&(h=v)}if(c){var y,b;const w=f==="y"?"width":"height",k=wk.has(gn(o)),v=s.reference[d]-s.floating[w]+(k&&((y=i.offset)==null?void 0:y[d])||0)+(k?0:g.crossAxis),x=s.reference[d]+s.reference[w]+(k?0:((b=i.offset)==null?void 0:b[d])||0)-(k?g.crossAxis:0);p<v?p=v:p>x&&(p=x)}return{[f]:h,[d]:p}}}},uR=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}=Lr(t,e),u=await i.detectOverflow(e,c),d=gn(o),f=Eo(o),h=Dn(o)==="y",{width:p,height:m}=s.floating;let g,y;d==="top"||d==="bottom"?(g=d,y=f===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(y=d,g=f==="end"?"top":"bottom");const b=m-u.top-u.bottom,w=p-u.left-u.right,k=di(m-u[g],b),v=di(p-u[y],w),x=!e.middlewareData.shift;let S=k,T=v;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(T=w),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(S=b),x&&!f){const L=Sn(u.left,0),N=Sn(u.right,0),P=Sn(u.top,0),A=Sn(u.bottom,0);h?T=p-2*(L!==0||N!==0?L+N:Sn(u.left,u.right)):S=m-2*(P!==0||A!==0?P+A:Sn(u.top,u.bottom))}await l({...e,availableWidth:T,availableHeight:S});const I=await i.getDimensions(a.floating);return p!==I.width||m!==I.height?{reset:{rects:!0}}:{}}}};function kk(t){const e=Rn(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=yt(t),s=o?t.offsetWidth:n,i=o?t.offsetHeight:r,a=$c(n)!==s||$c(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function Mp(t){return tt(t)?t:t.contextElement}function Qs(t){const e=Mp(t);if(!yt(e))return lr(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:s}=kk(e);let i=(s?$c(n.width):n.width)/r,a=(s?$c(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const dR=lr(0);function xk(t){const e=Rt(t);return!nd()||!e.visualViewport?dR:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function fR(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Rt(t)?!1:e}function as(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),s=Mp(t);let i=lr(1);e&&(r?tt(r)&&(i=Qs(r)):i=Qs(t));const a=fR(s,n,r)?xk(s):lr(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=Rt(s),h=r&&tt(r)?Rt(r):r;let p=f,m=oh(p);for(;m&&r&&h!==p;){const g=Qs(m),y=m.getBoundingClientRect(),b=Rn(m),w=y.left+(m.clientLeft+parseFloat(b.paddingLeft))*g.x,k=y.top+(m.clientTop+parseFloat(b.paddingTop))*g.y;l*=g.x,c*=g.y,u*=g.x,d*=g.y,l+=w,c+=k,p=Rt(m),m=oh(p)}}return zc({width:u,height:d,x:l,y:c})}function id(t,e){const n=rd(t).scrollLeft;return e?e.left+n:as(pr(t)).left+n}function Sk(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 hR(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const s=o==="fixed",i=pr(r),a=e?td(e.floating):!1;if(r===i||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=lr(1);const u=lr(0),d=yt(r);if((d||!d&&!s)&&((xo(r)!=="body"||So(i))&&(l=rd(r)),d)){const h=as(r);c=Qs(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const f=i&&!d&&!s?Sk(i,l):lr(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 pR(t){return Array.from(t.getClientRects())}function mR(t){const e=pr(t),n=rd(t),r=t.ownerDocument.body,o=Sn(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Sn(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+id(t);const a=-n.scrollTop;return Rn(r).direction==="rtl"&&(i+=Sn(e.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const Bg=25;function gR(t,e){const n=Rt(t),r=pr(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<=Bg&&(s-=p)}else c<=Bg&&(s+=c);return{width:s,height:i,x:a,y:l}}function yR(t,e){const n=as(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,s=yt(t)?Qs(t):lr(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 Vg(t,e,n){let r;if(e==="viewport")r=gR(t,n);else if(e==="document")r=mR(pr(t));else if(tt(e))r=yR(e,n);else{const o=xk(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return zc(r)}function Ek(t,e){const n=zr(t);return n===e||!tt(n)||Ir(n)?!1:Rn(n).position==="fixed"||Ek(n,e)}function bR(t,e){const n=e.get(t);if(n)return n;let r=io(t,[],!1).filter(a=>tt(a)&&xo(a)!=="body"),o=null;const s=Rn(t).position==="fixed";let i=s?zr(t):t;for(;tt(i)&&!Ir(i);){const a=Rn(i),l=pp(i);!l&&a.position==="fixed"&&(o=null),(s?!l&&!o:!l&&a.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||So(i)&&!l&&Ek(t,i))?r=r.filter(u=>u!==i):o=a,i=zr(i)}return e.set(t,r),r}function vR(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const i=[...n==="clippingAncestors"?td(e)?[]:bR(e,this._c):[].concat(n),r],a=Vg(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=Vg(e,i[f],o);l=Sn(h.top,l),c=di(h.right,c),u=di(h.bottom,u),d=Sn(h.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function wR(t){const{width:e,height:n}=kk(t);return{width:e,height:n}}function kR(t,e,n){const r=yt(e),o=pr(e),s=n==="fixed",i=as(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=lr(0);function c(){l.x=id(o)}if(r||!r&&!s)if((xo(e)!=="body"||So(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?Sk(o,a):lr(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 Qd(t){return Rn(t).position==="static"}function Hg(t,e){if(!yt(t)||Rn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return pr(t)===n&&(n=n.ownerDocument.body),n}function Ck(t,e){const n=Rt(t);if(td(t))return n;if(!yt(t)){let o=zr(t);for(;o&&!Ir(o);){if(tt(o)&&!Qd(o))return o;o=zr(o)}return n}let r=Hg(t,e);for(;r&&MT(r)&&Qd(r);)r=Hg(r,e);return r&&Ir(r)&&Qd(r)&&!pp(r)?n:r||NT(t)||n}const xR=async function(t){const e=this.getOffsetParent||Ck,n=this.getDimensions,r=await n(t.floating);return{reference:kR(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function SR(t){return Rn(t).direction==="rtl"}const ER={convertOffsetParentRelativeRectToViewportRelativeRect:hR,getDocumentElement:pr,getClippingRect:vR,getOffsetParent:Ck,getElementRects:xR,getClientRects:pR,getDimensions:wR,getScale:Qs,isElement:tt,isRTL:SR};function Tk(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function CR(t,e){let n=null,r;const o=pr(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=qs(d),m=qs(o.clientWidth-(u+f)),g=qs(o.clientHeight-(d+h)),y=qs(u),w={rootMargin:-p+"px "+-m+"px "+-g+"px "+-y+"px",threshold:Sn(0,di(1,l))||1};let k=!0;function v(x){const S=x[0].intersectionRatio;if(S!==l){if(!k)return i();S?i(!1,S):r=setTimeout(()=>{i(!1,1e-7)},1e3)}S===1&&!Tk(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 Wg(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=Mp(t),u=o||s?[...c?io(c):[],...e?io(e):[]]:[];u.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const d=c&&a?CR(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,m=l?as(t):null;l&&g();function g(){const y=as(t);m&&!Tk(m,y)&&n(),m=y,p=requestAnimationFrame(g)}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 TR=aR,MR=lR,RR=oR,OR=uR,NR=sR,_R=cR,PR=(t,e,n)=>{const r=new Map,o={platform:ER,...n},s={...o.platform,_c:r};return rR(t,e,{...o,platform:s})};var AR=typeof document<"u",IR=function(){},Mc=AR?E.useLayoutEffect:IR;function Vc(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(!Vc(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)&&!Vc(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function Mk(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function qg(t,e){const n=Mk(t);return Math.round(e*n)/n}function ef(t){const e=E.useRef(t);return Mc(()=>{e.current=t}),e}function $R(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]=E.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=E.useState(r);Vc(f,r)||h(r);const[p,m]=E.useState(null),[g,y]=E.useState(null),b=E.useCallback(G=>{G!==x.current&&(x.current=G,m(G))},[]),w=E.useCallback(G=>{G!==S.current&&(S.current=G,y(G))},[]),k=s||p,v=i||g,x=E.useRef(null),S=E.useRef(null),T=E.useRef(u),I=l!=null,L=ef(l),N=ef(o),P=ef(c),A=E.useCallback(()=>{if(!x.current||!S.current)return;const G={placement:e,strategy:n,middleware:f};N.current&&(G.platform=N.current),PR(x.current,S.current,G).then(U=>{const z={...U,isPositioned:P.current!==!1};j.current&&!Vc(T.current,z)&&(T.current=z,cr.flushSync(()=>{d(z)}))})},[f,e,n,N,P]);Mc(()=>{c===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(G=>({...G,isPositioned:!1})))},[c]);const j=E.useRef(!1);Mc(()=>(j.current=!0,()=>{j.current=!1}),[]),Mc(()=>{if(k&&(x.current=k),v&&(S.current=v),k&&v){if(L.current)return L.current(k,v,A);A()}},[k,v,A,L,I]);const K=E.useMemo(()=>({reference:x,floating:S,setReference:b,setFloating:w}),[b,w]),J=E.useMemo(()=>({reference:k,floating:v}),[k,v]),Y=E.useMemo(()=>{const G={position:n,left:0,top:0};if(!J.floating)return G;const U=qg(J.floating,u.x),z=qg(J.floating,u.y);return a?{...G,transform:"translate("+U+"px, "+z+"px)",...Mk(J.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:z}},[n,a,J.floating,u.x,u.y]);return E.useMemo(()=>({...u,update:A,refs:K,elements:J,floatingStyles:Y}),[u,A,K,J,Y])}const DR=(t,e)=>{const n=TR(t);return{name:n.name,fn:n.fn,options:[t,e]}},zR=(t,e)=>{const n=MR(t);return{name:n.name,fn:n.fn,options:[t,e]}},LR=(t,e)=>({fn:_R(t).fn,options:[t,e]}),jR=(t,e)=>{const n=RR(t);return{name:n.name,fn:n.fn,options:[t,e]}},FR=(t,e)=>{const n=OR(t);return{name:n.name,fn:n.fn,options:[t,e]}},BR=(t,e)=>{const n=NR(t);return{name:n.name,fn:n.fn,options:[t,e]}},VR={intentional:"onClick",sloppy:"onPointerDown"};function HR(t){return{escapeKey:typeof t=="boolean"?t:t?.escapeKey??!1,outsidePress:typeof t=="boolean"?t:t?.outsidePress??!0}}function Rp(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:m=!1,bubbles:g,externalTree:y}=e,b=ys(y),w=pe(typeof d=="function"?d:()=>!1),k=typeof d=="function"?w:d,v=E.useRef(!1),{escapeKey:x,outsidePress:S}=HR(g),T=E.useRef(null),I=Tn(),L=Tn(),N=pe(()=>{L.clear(),l.current.insideReactTree=!1}),P=E.useRef(!1),A=E.useRef(""),j=pe(O=>{A.current=O.pointerType}),K=pe(()=>{const O=A.current,F=O==="pen"||!O?"mouse":O,W=typeof f=="function"?f():f;return typeof W=="string"?W:W[F]}),J=pe(O=>{if(!r||!c||!u||O.key!=="Escape"||P.current)return;const F=l.current.floatingContext?.nodeId,W=b?Xo(b.nodesRef.current,F):[];if(!x&&W.length>0){let ne=!0;if(W.forEach(oe=>{oe.context?.open&&!oe.context.dataRef.current.__escapeKeyBubbles&&(ne=!1)}),!ne)return}const X=BT(O)?O.nativeEvent:O,ee=Fe(lk,X);n.setOpen(!1,ee),!x&&!ee.isPropagationAllowed&&O.stopPropagation()}),Y=pe(O=>{const F=K();return F==="intentional"&&O.type!=="click"||F==="sloppy"&&O.type==="click"}),G=pe(()=>{l.current.insideReactTree=!0,L.start(0,N)}),U=pe((O,F=!1)=>{if(Y(O)){N();return}if(l.current.insideReactTree){N();return}if(K()==="intentional"&&F||typeof k=="function"&&!k(O))return;const W=xn(O),X=`[${Ea("inert")}]`,ee=Je(n.select("floatingElement")).querySelectorAll(X),ne=n.context.triggerElements;if(W&&(ne.hasElement(W)||ne.hasMatchingElement(fe=>He(fe,W))))return;let oe=tt(W)?W:null;for(;oe&&!Ir(oe);){const fe=zr(oe);if(Ir(fe)||!tt(fe))break;oe=fe}if(ee.length&&tt(W)&&!FT(W)&&!He(W,n.select("floatingElement"))&&Array.from(ee).every(fe=>!He(oe,fe)))return;if(yt(W)&&!("touches"in O)){const fe=Ir(W),ye=Rn(W),he=/auto|scroll/,qe=fe||he.test(ye.overflowX),Ye=fe||he.test(ye.overflowY),st=qe&&W.clientWidth>0&&W.scrollWidth>W.clientWidth,Ae=Ye&&W.clientHeight>0&&W.scrollHeight>W.clientHeight,_e=ye.direction==="rtl",Ue=Ae&&(_e?O.offsetX<=W.offsetWidth-W.clientWidth:O.offsetX>W.clientWidth),Ke=st&&O.offsetY>W.clientHeight;if(Ue||Ke)return}const re=l.current.floatingContext?.nodeId,ae=b&&Xo(b.nodesRef.current,re).some(fe=>Fn(O,fe.context?.elements.floating));if(Fn(O,n.select("floatingElement"))||Fn(O,n.select("domReferenceElement"))||ae)return;const te=b?Xo(b.nodesRef.current,re):[];if(te.length>0){let fe=!0;if(te.forEach(ye=>{ye.context?.open&&!ye.context.dataRef.current.__outsidePressBubbles&&(fe=!1)}),!fe)return}n.setOpen(!1,Fe(xp,O)),N()}),z=pe(O=>{K()!=="sloppy"||O.pointerType==="touch"||!n.select("open")||!c||Fn(O,n.select("floatingElement"))||Fn(O,n.select("domReferenceElement"))||U(O)}),B=pe(O=>{if(K()!=="sloppy"||!n.select("open")||!c||Fn(O,n.select("floatingElement"))||Fn(O,n.select("domReferenceElement")))return;const F=O.touches[0];F&&(T.current={startTime:Date.now(),startX:F.clientX,startY:F.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},I.start(1e3,()=>{T.current&&(T.current.dismissOnTouchEnd=!1,T.current.dismissOnMouseDown=!1)}))}),H=pe(O=>{const F=xn(O);function W(){B(O),F?.removeEventListener(O.type,W)}F?.addEventListener(O.type,W)}),V=pe(O=>{const F=v.current;if(v.current=!1,I.clear(),O.type==="mousedown"&&T.current&&!T.current.dismissOnMouseDown)return;const W=xn(O);function X(){O.type==="pointerdown"?z(O):U(O,F),W?.removeEventListener(O.type,X)}W?.addEventListener(O.type,X)}),R=pe(O=>{if(K()!=="sloppy"||!T.current||Fn(O,n.select("floatingElement"))||Fn(O,n.select("domReferenceElement")))return;const F=O.touches[0];if(!F)return;const W=Math.abs(F.clientX-T.current.startX),X=Math.abs(F.clientY-T.current.startY),ee=Math.sqrt(W*W+X*X);ee>5&&(T.current.dismissOnTouchEnd=!0),ee>10&&(U(O),I.clear(),T.current=null)}),D=pe(O=>{const F=xn(O);function W(){R(O),F?.removeEventListener(O.type,W)}F?.addEventListener(O.type,W)}),$=pe(O=>{K()!=="sloppy"||!T.current||Fn(O,n.select("floatingElement"))||Fn(O,n.select("domReferenceElement"))||(T.current.dismissOnTouchEnd&&U(O),I.clear(),T.current=null)}),Z=pe(O=>{const F=xn(O);function W(){$(O),F?.removeEventListener(O.type,W)}F?.addEventListener(O.type,W)});E.useEffect(()=>{if(!r||!c)return;l.current.__escapeKeyBubbles=x,l.current.__outsidePressBubbles=S;const O=new ss;function F(oe){n.setOpen(!1,Fe(yo,oe))}function W(){O.clear(),P.current=!0}function X(){O.start(nd()?5:0,()=>{P.current=!1})}const ee=Je(o);ee.addEventListener("pointerdown",j,!0),u&&(ee.addEventListener("keydown",J),ee.addEventListener("compositionstart",W),ee.addEventListener("compositionend",X)),k&&(ee.addEventListener("click",V,!0),ee.addEventListener("pointerdown",V,!0),ee.addEventListener("touchstart",H,!0),ee.addEventListener("touchmove",D,!0),ee.addEventListener("touchend",Z,!0),ee.addEventListener("mousedown",V,!0));let ne=[];return m&&(tt(i)&&(ne=io(i)),tt(o)&&(ne=ne.concat(io(o))),!tt(s)&&s&&s.contextElement&&(ne=ne.concat(io(s.contextElement)))),ne=ne.filter(oe=>oe!==ee.defaultView?.visualViewport),ne.forEach(oe=>{oe.addEventListener("scroll",F,{passive:!0})}),()=>{ee.removeEventListener("pointerdown",j,!0),u&&(ee.removeEventListener("keydown",J),ee.removeEventListener("compositionstart",W),ee.removeEventListener("compositionend",X)),k&&(ee.removeEventListener("click",V,!0),ee.removeEventListener("pointerdown",V,!0),ee.removeEventListener("touchstart",H,!0),ee.removeEventListener("touchmove",D,!0),ee.removeEventListener("touchend",Z,!0),ee.removeEventListener("mousedown",V,!0)),ne.forEach(oe=>{oe.removeEventListener("scroll",F)}),O.clear(),v.current=!1}},[l,o,s,i,u,k,r,a,m,c,x,S,J,U,V,z,H,D,Z,j,n]),E.useEffect(N,[k,N]);const Q=E.useMemo(()=>({onKeyDown:J,...h&&{[VR[p]]:O=>{n.setOpen(!1,Fe(hi,O.nativeEvent))},...p!=="intentional"&&{onClick(O){n.setOpen(!1,Fe(hi,O.nativeEvent))}}}}),[J,n,h,p]),_=pe(O=>{const F=xn(O.nativeEvent);!He(n.select("floatingElement"),F)||O.button!==0||(v.current=!0)}),q=pe(O=>{!r||!c||O.button!==0||(v.current=!0)}),C=E.useMemo(()=>({onKeyDown:J,onPointerDown:_,onMouseDown:_,onMouseUp:_,onClickCapture:G,onMouseDownCapture(O){G(),q(O)},onPointerDownCapture(O){G(),q(O)},onMouseUpCapture:G,onTouchEndCapture:G,onTouchMoveCapture:G}),[J,_,G,q]);return E.useMemo(()=>c?{reference:Q,floating:C,trigger:Q}:{},[c,Q,C])}var Hc=Symbol("NOT_FOUND");function WR(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function qR(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function UR(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 Ug=t=>Array.isArray(t)?t:[t];function KR(t){const e=Array.isArray(t[0])?t[0]:t;return UR(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function YR(t,e){const n=[],{length:r}=t;for(let o=0;o<r;o++)n.push(t[o].apply(null,e));return n}function GR(t){let e;return{get(n){return e&&t(e.key,n)?e.value:Hc},put(n,r){e={key:n,value:r}},getEntries(){return e?[e]:[]},clear(){e=void 0}}}function ZR(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 Hc}function o(a,l){r(a)===Hc&&(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 JR=(t,e)=>t===e;function XR(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 QR(t,e){const n=typeof e=="object"?e:{equalityCheck:e},{equalityCheck:r=JR,maxSize:o=1,resultEqualityCheck:s}=n,i=XR(r);let a=0;const l=o<=1?GR(i):ZR(o,i);function c(){let u=l.get(arguments);if(u===Hc){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 eO=class{constructor(t){this.value=t}deref(){return this.value}},tO=typeof WeakRef<"u"?WeakRef:eO,nO=0,Kg=1;function cl(){return{s:nO,v:void 0,o:null,p:null}}function Rk(t,e={}){let n=cl();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 m=p.get(h);m===void 0?(a=cl(),p.set(h,a)):a=m}else{let p=a.p;p===null&&(a.p=p=new Map);const m=p.get(h);m===void 0?(a=cl(),p.set(h,a)):a=m}}const c=a;let u;if(a.s===Kg)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 tO(u):u}return c.s=Kg,c.v=u,u}return i.clearCache=()=>{n=cl(),i.resetResultsCount()},i.resultsCount=()=>s,i.resetResultsCount=()=>{s=0},i}function Ok(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()),WR(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const u={...n,...l},{memoize:d,memoizeOptions:f=[],argsMemoize:h=Rk,argsMemoizeOptions:p=[]}=u,m=Ug(f),g=Ug(p),y=KR(o),b=d(function(){return s++,c.apply(null,arguments)},...m),w=h(function(){i++;const v=YR(y,arguments);return a=b.apply(null,v),a},...g);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 rO=Ok(Rk),oO=Object.assign((t,e=rO)=>{qR(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:()=>oO});Ok({memoize:QR,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const be=(t,e,n,r,o,s,...i)=>{if(i.length>0)throw new Error(en(1));let a;if(t)a=t;else throw new Error("Missing arguments");return a};var Op=ST();const sO=Sp(19),iO=sO?lO:cO;function Oe(t,e,n,r,o){return iO(t,e,n,r,o)}function aO(t,e,n,r,o){const s=E.useCallback(()=>e(t.getSnapshot(),n,r,o),[t,e,n,r,o]);return Op.useSyncExternalStore(t.subscribe,s,s)}function lO(t,e,n,r,o){return aO(t,e,n,r,o)}function cO(t,e,n,r,o){return Nw.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getSnapshot,s=>e(s,n,r,o))}class Nk{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 Oe(this,e,n,r,o)}}class Np extends Nk{constructor(e,n={},r){super(e),this.context=n,this.selectors=r}useSyncedValue(e,n){E.useDebugValue(e),ge(()=>{this.state[e]!==n&&this.set(e,n)},[e,n])}useSyncedValueWithCleanup(e,n){const r=this;ge(()=>(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);ge(()=>{n.update(e)},[n,...r])}useControlledProp(e,n){E.useDebugValue(e);const r=n!==void 0;ge(()=>{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 E.useDebugValue(e),Oe(this,this.selectors[e],n,r,o)}useContextCallback(e,n){E.useDebugValue(e);const r=pe(n??pn);this.context[e]=r}useStateSetter(e){const n=E.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 uO={open:be(t=>t.open),domReferenceElement:be(t=>t.domReferenceElement),referenceElement:be(t=>t.positionReference??t.referenceElement),floatingElement:be(t=>t.floatingElement),floatingId:be(t=>t.floatingId)};class _p extends Np{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:ok(),nested:n,noEmit:r,triggerElements:s},uO)}setOpen=(e,n)=>{if((!e||!this.state.open||Vw(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 Ua(t,e=!1,n=!1){const[r,o]=E.useState(t&&e?"idle":void 0),[s,i]=E.useState(t);return t&&!s&&(i(!0),o("starting")),!t&&s&&r!=="ending"&&!n&&o("ending"),!t&&!s&&r==="ending"&&o(void 0),ge(()=>{if(!t&&s&&r!=="ending"&&n){const a=sr.request(()=>{o("ending")});return()=>{sr.cancel(a)}}},[t,s,r,n]),ge(()=>{if(!t||e)return;const a=sr.request(()=>{o(void 0)});return()=>{sr.cancel(a)}},[e,t]),ge(()=>{if(!t||!e)return;t&&s&&r!=="idle"&&o("starting");const a=sr.request(()=>{o("idle")});return()=>{sr.cancel(a)}},[e,t,s,o,r]),E.useMemo(()=>({mounted:s,setMounted:i,transitionStatus:r}),[s,r])}let Ca=(function(t){return t.startingStyle="data-starting-style",t.endingStyle="data-ending-style",t})({});const dO={[Ca.startingStyle]:""},fO={[Ca.endingStyle]:""},Ai={transitionStatus(t){return t==="starting"?dO:t==="ending"?fO:null}};function _k(t,e=!1,n=!0){const r=sd();return pe((o,s=null)=>{r.cancel();function i(){cr.flushSync(o)}const a=Rr(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=Ca.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 To(t){const{enabled:e=!0,open:n,ref:r,onComplete:o}=t,s=pe(o),i=_k(r,n,!1);E.useEffect(()=>{if(!e)return;const a=new AbortController;return i(s,a.signal),()=>{a.abort()}},[e,n,s,i])}function hO(t,e){const n=E.useRef(null),r=E.useRef(null);return E.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 pO(t,e,n,r){const o=n.useState("isMountedByTrigger",t),s=hO(t,n),i=pe(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 ge(()=>{o&&n.update({activeTriggerElement:e.current,...r})},[o,n,e,...Object.values(r)]),{registerTrigger:i,isMountedByThisTrigger:o}}function Pk(t){const e=t.useState("open");ge(()=>{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 Ak(t,e,n){const{mounted:r,setMounted:o,transitionStatus:s}=Ua(t);e.useSyncedValues({mounted:r,transitionStatus:s});const i=pe(()=>{o(!1),e.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),e.context.onOpenChangeComplete?.(!1)}),a=e.useState("preventUnmountingOnClose");return To({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 mO(){return new _p({open:!1,floatingElement:null,referenceElement:null,triggerElements:new ad,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function Ik(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:"idle",floatingRootContext:mO(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:$t,inactiveTriggerProps:$t,popupProps:$t}}const ul=be(t=>t.triggerIdProp??t.activeTriggerId),$k={open:be(t=>t.openProp??t.open),mounted:be(t=>t.mounted),transitionStatus:be(t=>t.transitionStatus),floatingRootContext:be(t=>t.floatingRootContext),preventUnmountingOnClose:be(t=>t.preventUnmountingOnClose),payload:be(t=>t.payload),activeTriggerId:ul,activeTriggerElement:be(t=>t.mounted?t.activeTriggerElement:null),isTriggerActive:be((t,e)=>e!==void 0&&ul(t)===e),isOpenedByTrigger:be((t,e)=>e!==void 0&&ul(t)===e&&t.open),isMountedByTrigger:be((t,e)=>e!==void 0&&ul(t)===e&&t.mounted),triggerProps:be((t,e)=>e?t.activeTriggerProps:t.inactiveTriggerProps),popupProps:be(t=>t.popupProps),popupElement:be(t=>t.popupElement),positionerElement:be(t=>t.positionerElement)};function Dk(t){const{open:e=!1,onOpenChange:n,elements:r={}}=t,o=_i(),s=Co()!=null,i=ln(()=>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 ge(()=>{const a={open:e,floatingId:o};r.reference!==void 0&&(a.referenceElement=r.reference,a.domReferenceElement=tt(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 gO(t={}){const{nodeId:e,externalTree:n}=t,r=Dk(t),o=t.rootContext||r,s={reference:o.useState("referenceElement"),floating:o.useState("floatingElement"),domReference:o.useState("domReferenceElement")},[i,a]=E.useState(null),l=E.useRef(null),c=ys(n);ge(()=>{s.domReference&&(l.current=s.domReference)},[s.domReference]);const u=$R({...t,elements:{...s,...i&&{reference:i}}}),d=E.useCallback(S=>{const T=tt(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),getClientRects:()=>S.getClientRects(),contextElement:S}:S;a(T),u.refs.setReference(T)},[u.refs]),[f,h]=E.useState(null),[p,m]=E.useState(null);o.useSyncedValue("referenceElement",f),o.useSyncedValue("domReferenceElement",tt(f)?f:null),o.useSyncedValue("floatingElement",p);const g=E.useCallback(S=>{(tt(S)||S===null)&&(l.current=S,h(S)),(tt(u.refs.reference.current)||u.refs.reference.current===null||S!==null&&!tt(S))&&u.refs.setReference(S)},[u.refs,h]),y=E.useCallback(S=>{m(S),u.refs.setFloating(S)},[u.refs]),b=E.useMemo(()=>({...u.refs,setReference:g,setFloating:y,setPositionReference:d,domReference:l}),[u.refs,g,y,d]),w=E.useMemo(()=>({...u.elements,domReference:s.domReference}),[u.elements,s.domReference]),k=o.useState("open"),v=o.useState("floatingId"),x=E.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 ge(()=>{o.context.dataRef.current.floatingContext=x;const S=c?.nodesRef.current.find(T=>T.id===e);S&&(S.context=x)}),E.useMemo(()=>({...u,context:x,refs:b,elements:w,rootStore:o}),[u,b,w,x,o])}function zk(t){const{popupStore:e,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:o}=t,s=_i(),i=Co()!=null,a=e.useState("open"),l=e.useState("activeTriggerElement"),c=e.useState(r?"popupElement":"positionerElement"),u=e.context.triggerElements,d=ln(()=>new _p({open:a,referenceElement:l,floatingElement:c,triggerElements:u,onOpenChange:o,floatingId:s,nested:i,noEmit:n})).current;return ge(()=>{const f={open:a,floatingId:s,referenceElement:l,floatingElement:c};tt(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 gh=Ea("safe-polygon"),yO=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${Lw}`;function bO(t){return t?!!t.closest(yO):!1}class Pp{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 Pp}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}function Lk(t){const e=ln(Pp.create).current,n=t.context.dataRef.current;return n.hoverInteractionState||(n.hoverInteractionState=e),dp(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}const vO=new Set(["click","mousedown"]);function wO(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=Lk(n),u=ys(),d=Co(),f=pe(()=>c.interactedInside?!0:i.current.openEvent?vO.has(i.current.openEvent.type):!1),h=pe(()=>{const w=i.current.openEvent?.type;return w?.includes("mouse")&&w!=="mousedown"}),p=pe(w=>jw(w,n.context.triggerElements)),m=E.useCallback((w,k=!0)=>{const v=kO(l,c.pointerType);v&&!c.handler?c.openChangeTimeout.start(v,()=>n.setOpen(!1,Fe(En,w))):k&&(c.openChangeTimeout.clear(),n.setOpen(!1,Fe(En,w)))},[l,n,c]),g=pe(()=>{c.unbindMouseMove(),c.handler=void 0}),y=pe(()=>{if(c.performedPointerEventsMutation){const w=Je(o).body;w.style.pointerEvents="",w.removeAttribute(gh),c.performedPointerEventsMutation=!1}}),b=pe(w=>{const k=xn(w);if(!bO(k)){c.interactedInside=!1;return}c.interactedInside=!0});ge(()=>{r||(c.pointerType=void 0,c.restTimeoutPending=!1,c.interactedInside=!1,g(),y())},[r,c,g,y]),E.useEffect(()=>()=>{g()},[g]),E.useEffect(()=>y,[y]),ge(()=>{if(a&&r&&c.handleCloseOptions?.blockPointerEvents&&h()&&tt(s)&&o){c.performedPointerEventsMutation=!0;const w=Je(o).body;w.setAttribute(gh,"");const k=s,v=o,x=u?.nodesRef.current.find(S=>S.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]),E.useEffect(()=>{if(!a)return;function w(S){f()||!i.current.floatingContext||!n.select("open")||p(S.relatedTarget)||(y(),g(),f()||m(S))}function k(S){c.openChangeTimeout.clear(),y(),c.handler?.(S),g()}function v(S){f()||m(S,!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,m,y,g,b,c])}function kO(t,e){return e&&!ui(e)?0:typeof t=="function"?t():t}function tf(t){return typeof t=="function"?t():t}const xO={current:null};function SO(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=xO,externalTree:f,isActiveTrigger:h=!0}=e,p=ys(f),m=Lk(n),g=Ft(a),y=Ft(i),b=Ft(c),w=Ft(s);h&&(m.handleCloseOptions=g.current?.__options);const k=pe(()=>m.interactedInside?!0:r.current.openEvent?["click","mousedown"].includes(r.current.openEvent.type):!1),v=pe(L=>jw(L,n.context.triggerElements)),x=E.useCallback((L,N=!0)=>{const P=Zd(y.current,"close",m.pointerType);P&&!m.handler?m.openChangeTimeout.start(P,()=>n.setOpen(!1,Fe(En,L))):N&&(m.openChangeTimeout.clear(),n.setOpen(!1,Fe(En,L)))},[y,n,m]),S=pe(()=>{m.unbindMouseMove(),m.handler=void 0}),T=pe(()=>{if(m.performedPointerEventsMutation){const L=Je(n.select("domReferenceElement")).body;L.style.pointerEvents="",L.removeAttribute(gh),m.performedPointerEventsMutation=!1}});E.useEffect(()=>{if(!s)return;function L(N){N.open||(m.openChangeTimeout.clear(),m.restTimeout.clear(),m.blockMouseMove=!0,m.restTimeoutPending=!1)}return o.on("openchange",L),()=>{o.off("openchange",L)}},[s,o,m]);const I=pe(L=>{if(k()||!r.current.floatingContext||v(L.relatedTarget))return;const N=d.current;g.current?.({...r.current.floatingContext,tree:p,x:L.clientX,y:L.clientY,onClose(){T(),S(),!k()&&N===n.select("domReferenceElement")&&x(L)}})(L)});return E.useEffect(()=>{if(!s)return;const L=d.current??(h?n.select("domReferenceElement"):null);if(!tt(L))return;function N(j){if(m.openChangeTimeout.clear(),m.blockMouseMove=!1,l&&!ui(m.pointerType)||tf(b.current)>0&&!Zd(y.current,"open"))return;const K=Zd(y.current,"open",m.pointerType),J=n.select("domReferenceElement"),Y=n.context.triggerElements,G=(Y.hasElement(j.target)||Y.hasMatchingElement(H=>He(H,j.target)))&&(!J||!He(J,j.target)),U=j.currentTarget??null,z=n.select("open"),B=!z||G;G&&z?n.setOpen(!0,Fe(En,j,U)):K?m.openChangeTimeout.start(K,()=>{B&&n.setOpen(!0,Fe(En,j,U))}):B&&n.setOpen(!0,Fe(En,j,U))}function P(j){if(k()){T();return}m.unbindMouseMove();const K=n.select("domReferenceElement"),J=Je(K);if(m.restTimeout.clear(),m.restTimeoutPending=!1,v(j.relatedTarget))return;if(g.current&&r.current.floatingContext){n.select("open")||m.openChangeTimeout.clear();const G=d.current;m.handler=g.current({...r.current.floatingContext,tree:p,x:j.clientX,y:j.clientY,onClose(){T(),S(),w.current&&!k()&&G===n.select("domReferenceElement")&&x(j,!0)}});const U=m.handler;U(j),J.addEventListener("mousemove",U),m.unbindMouseMove=()=>{J.removeEventListener("mousemove",U)};return}(m.pointerType!=="touch"||!He(n.select("floatingElement"),j.relatedTarget))&&x(j)}function A(j){I(j)}return n.select("open")&&L.addEventListener("mouseleave",A),u&&L.addEventListener("mousemove",N,{once:!0}),L.addEventListener("mouseenter",N),L.addEventListener("mouseleave",P),()=>{L.removeEventListener("mouseleave",A),u&&L.removeEventListener("mousemove",N),L.removeEventListener("mouseenter",N),L.removeEventListener("mouseleave",P)}},[S,T,r,y,x,n,s,g,I,m,h,k,v,l,u,b,d,p,w]),E.useMemo(()=>{if(!s)return;function L(N){m.pointerType=N.pointerType}return{onPointerDown:L,onPointerEnter:L,onMouseMove(N){const{nativeEvent:P}=N,A=N.currentTarget,j=n.select("domReferenceElement"),K=n.context.triggerElements,J=n.select("open"),Y=(K.hasElement(N.target)||K.hasMatchingElement(U=>He(U,N.target)))&&(!j||!He(j,N.target));if(l&&!ui(m.pointerType)||J&&!Y||tf(b.current)===0||!Y&&m.restTimeoutPending&&N.movementX**2+N.movementY**2<2)return;m.restTimeout.clear();function G(){if(m.restTimeoutPending=!1,k())return;const U=n.select("open");!m.blockMouseMove&&(!U||Y)&&n.setOpen(!0,Fe(En,P,A))}m.pointerType==="touch"?cr.flushSync(()=>{G()}):Y&&J?G():(m.restTimeoutPending=!0,m.restTimeout.start(tf(b.current),G))}}},[s,m,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=E.useCallback(c=>dl(c,t,"reference"),e),i=E.useCallback(c=>dl(c,t,"floating"),n),a=E.useCallback(c=>dl(c,t,"item"),r),l=E.useCallback(c=>dl(c,t,"trigger"),o);return E.useMemo(()=>({getReferenceProps:s,getFloatingProps:i,getItemProps:a,getTriggerProps:l}),[s,i,a,l])}function dl(t,e,n){const r=new Map,o=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[ih]="");for(const i in t)o&&t&&(i===Dw||i===zw)||(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&&Yg(s,a,o,r)}return Yg(s,t,o,r),s}function Yg(t,e,n,r){for(const o in e){const s=e[o];n&&(o===Dw||o===zw)||(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 EO="Escape";function cd(t,e,n){switch(t){case"vertical":return e;case"horizontal":return n;default:return e||n}}function fl(t,e){return cd(e,t===gp||t===Wa,t===ao||t===lo)}function nf(t,e,n){return cd(e,t===Wa,n?t===ao:t===lo)||t==="Enter"||t===" "||t===""}function CO(t,e,n){return cd(e,n?t===ao:t===lo,t===Wa)}function TO(t,e,n,r){const o=n?t===lo:t===ao,s=t===gp;return e==="both"||e==="horizontal"&&r&&r>1?t===EO:cd(e,o,s)}function MO(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:m=!1,virtual:g=!1,focusItemOnOpen:y="auto",focusItemOnHover:b=!0,openOnArrowKeyDown:w=!0,disabledIndices:k=void 0,orientation:v="vertical",parentOrientation:x,cols:S=1,id:T,resetOnPointerLeave:I=!0,externalTree:L}=e,N=xa(o),P=Ft(N),A=Co(),j=ys(L);ge(()=>{i.current.orientation=v},[i,v]);const K=ah(s),J=E.useRef(y),Y=E.useRef(d??-1),G=E.useRef(null),U=E.useRef(!0),z=pe(re=>{c(Y.current===-1?null:Y.current,re)}),B=E.useRef(z),H=E.useRef(!!o),V=E.useRef(r),R=E.useRef(!1),D=E.useRef(!1),$=Ft(k),Z=Ft(r),Q=Ft(d),_=Ft(I),q=pe(()=>{function re(ye){g?j?.events.emit("virtualfocus",ye):aa(ye,{sync:R.current,preventScroll:!0})}const ae=a.current[Y.current],te=D.current;ae&&re(ae),(R.current?ye=>ye():requestAnimationFrame)(()=>{const ye=a.current[Y.current]||ae;if(!ye)return;ae||re(ye),O&&(te||!U.current)&&ye.scrollIntoView?.({block:"nearest",inline:"nearest"})})});ge(()=>{u&&(r&&o?(Y.current=d??-1,J.current&&d!=null&&(D.current=!0,z())):H.current&&(Y.current=-1,B.current()))},[u,r,o,d,z]),ge(()=>{if(u){if(!r){R.current=!1;return}if(o)if(l==null){if(R.current=!1,Q.current!=null)return;if(H.current&&(Y.current=-1,q()),(!V.current||!H.current)&&J.current&&(G.current!=null||J.current===!0&&G.current==null)){let re=0;const ae=()=>{a.current[0]==null?(re<2&&(re?requestAnimationFrame:queueMicrotask)(ae),re+=1):(Y.current=G.current==null||nf(G.current,v,m)||p?Tc(a):uh(a),G.current=null,z())};ae()}}else Zs(a,l)||(Y.current=l,q(),D.current=!1)}},[u,r,o,l,Q,p,a,v,m,z,q,$]),ge(()=>{if(!u||o||!j||g||!H.current)return;const re=j.nodesRef.current,ae=re.find(ye=>ye.id===A)?.context?.elements.floating,te=Wn(Je(o)),fe=re.some(ye=>ye.context&&He(ye.context.elements.floating,te));ae&&!fe&&U.current&&ae.focus({preventScroll:!0})},[u,o,j,A,g]),ge(()=>{B.current=z,V.current=r,H.current=!!o}),ge(()=>{r||(G.current=null,J.current=y)},[r,y]);const C=l!=null,O=E.useMemo(()=>{function re(te){if(!Z.current)return;const fe=a.current.indexOf(te.currentTarget);fe!==-1&&Y.current!==fe&&(Y.current=fe,z(te))}return{onFocus(te){R.current=!0,re(te)},onClick:({currentTarget:te})=>te.focus({preventScroll:!0}),onMouseMove(te){R.current=!0,D.current=!1,b&&re(te)},onPointerLeave(te){if(!Z.current||!U.current||te.pointerType==="touch")return;R.current=!0;const fe=te.relatedTarget;!b||a.current.includes(fe)||_.current&&(aa(null,{sync:!0}),Y.current=-1,z(te),g||P.current?.focus({preventScroll:!0}))}}},[Z,P,b,a,z,_,g]),F=E.useCallback(()=>x??j?.nodesRef.current.find(re=>re.id===A)?.context?.dataRef?.current.orientation,[A,j,x]),W=pe(re=>{if(U.current=!1,R.current=!0,re.which===229||!Z.current&&re.currentTarget===P.current)return;if(p&&TO(re.key,v,m,S)){fl(re.key,F())||Jt(re),n.setOpen(!1,Fe(Gd,re.nativeEvent)),yt(s)&&(g?j?.events.emit("virtualfocus",s):s.focus());return}const ae=Y.current,te=Tc(a,k),fe=uh(a,k);if(K||(re.key==="Home"&&(Jt(re),Y.current=te,z(re)),re.key==="End"&&(Jt(re),Y.current=fe,z(re))),S>1){const ye=Array.from({length:a.current.length},()=>({width:1,height:1})),he=qw(ye,S,!1),qe=he.findIndex(Ae=>Ae!=null&&!co(a,Ae,k)),Ye=he.reduce((Ae,_e,Ue)=>_e!=null&&!co(a,_e,k)?Ue:Ae,-1),st=he[Ww({current:he.map(Ae=>Ae!=null?a.current[Ae]:null)},{event:re,orientation:v,loopFocus:h,rtl:m,cols:S,disabledIndices:Kw([...(typeof k!="function"?k:null)||a.current.map((Ae,_e)=>co(a,_e,k)?_e:void 0),void 0],he),minIndex:qe,maxIndex:Ye,prevIndex:Uw(Y.current>fe?te:Y.current,ye,he,S,re.key===Wa?"bl":re.key===(m?ao:lo)?"tr":"tl"),stopEvent:!0})];if(st!=null&&(Y.current=st,z(re)),v==="both")return}if(fl(re.key,v)){if(Jt(re),r&&!g&&Wn(re.currentTarget.ownerDocument)===re.currentTarget){Y.current=nf(re.key,v,m)?te:fe,z(re);return}nf(re.key,v,m)?h?ae>=fe?f&&ae!==a.current.length?Y.current=-1:(R.current=!1,Y.current=te):Y.current=Ut(a,{startingIndex:ae,disabledIndices:k}):Y.current=Math.min(fe,Ut(a,{startingIndex:ae,disabledIndices:k})):h?ae<=te?f&&ae!==-1?Y.current=a.current.length:(R.current=!1,Y.current=fe):Y.current=Ut(a,{startingIndex:ae,decrement:!0,disabledIndices:k}):Y.current=Math.max(te,Ut(a,{startingIndex:ae,decrement:!0,disabledIndices:k})),Zs(a,Y.current)&&(Y.current=-1),z(re)}}),X=E.useMemo(()=>g&&r&&C&&{"aria-activedescendant":`${T}-${l}`},[g,r,C,T,l]),ee=E.useMemo(()=>({"aria-orientation":v==="both"?void 0:v,...K?{}:X,onKeyDown(re){if(re.key==="Tab"&&re.shiftKey&&r&&!g){const ae=xn(re.nativeEvent);if(ae&&!He(P.current,ae))return;Jt(re),n.setOpen(!1,Fe(is,re.nativeEvent)),yt(s)&&s.focus();return}W(re)},onPointerMove(){U.current=!0}}),[X,W,P,v,K,n,r,g,s]),ne=E.useMemo(()=>{function re(te){y==="auto"&&Fw(te.nativeEvent)&&(J.current=!g)}function ae(te){J.current=y,y==="auto"&&Bw(te.nativeEvent)&&(J.current=!0)}return{onKeyDown(te){const fe=n.select("open");U.current=!1;const ye=te.key.startsWith("Arrow"),he=CO(te.key,F(),m),qe=fl(te.key,v),Ye=(p?he:qe)||te.key==="Enter"||te.key.trim()==="";if(g&&fe)return W(te);if(!(!fe&&!w&&ye)){if(Ye){const st=fl(te.key,F());G.current=p&&st?null:te.key}if(p){he&&(Jt(te),fe?(Y.current=Tc(a,$.current),z(te)):n.setOpen(!0,Fe(Gd,te.nativeEvent,te.currentTarget)));return}qe&&(Q.current!=null&&(Y.current=Q.current),Jt(te),!fe&&w?n.setOpen(!0,Fe(Gd,te.nativeEvent,te.currentTarget)):W(te),fe&&z(te))}},onFocus(te){n.select("open")&&!g&&(Y.current=-1,z(te))},onPointerDown:ae,onPointerEnter:ae,onMouseDown:re,onClick:re}},[W,$,y,a,p,z,n,w,v,F,m,Q,g]),oe=E.useMemo(()=>({...X,...ne}),[X,ne]);return E.useMemo(()=>u?{reference:oe,floating:ee,item:O,trigger:ne}:{},[u,oe,ee,ne,O])}const RO=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function jk(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=_i(),c=s?.id||l,u=E.useMemo(()=>xa(i)?.id||o,[i,o]),d=RO.get(a)??a,h=Co()!=null,p=E.useMemo(()=>d==="tooltip"||a==="label"?$t:{"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]),m=E.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]),g=E.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=E.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 E.useMemo(()=>({reference:m,floating:g,item:y,trigger:p}),[m,g,p,y])}function OO(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=Tn(),h=E.useRef(""),p=E.useRef(d??i??-1),m=E.useRef(null);ge(()=>{!o&&d!==null||(f.clear(),m.current=null,h.current!==""&&(h.current=""))},[o,d,f]),ge(()=>{o&&h.current===""&&(p.current=d??i??-1)},[o,d,i]);const g=pe(v=>{v?r.current.typing||(r.current.typing=v,l?.(v)):r.current.typing&&(r.current.typing=v,l?.(v))}),y=pe(v=>{function x(P,A,j){const K=A.find(J=>J?.toLocaleLowerCase().indexOf(j.toLocaleLowerCase())===0);return K?P.indexOf(K):-1}const S=s.current;if(h.current.length>0&&h.current[0]!==" "&&(x(S,S,h.current)===-1?g(!1):v.key===" "&&Jt(v)),S==null||v.key.length!==1||v.ctrlKey||v.metaKey||v.altKey)return;o&&v.key!==" "&&(Jt(v),g(!0));const T=h.current==="";T&&(p.current=d??i??-1),S.every(P=>P?P[0]?.toLocaleLowerCase()!==P[1]?.toLocaleLowerCase():!0)&&h.current===v.key&&(h.current="",p.current=m.current),h.current+=v.key,f.start(u,()=>{h.current="",p.current=m.current,g(!1)});const L=T?d??i??-1:p.current,N=x(S,[...S.slice((L||0)+1),...S.slice(0,(L||0)+1)],h.current);N!==-1?(a?.(N),m.current=N):v.key!==" "&&(h.current="",g(!1))}),b=pe(v=>{const x=v.relatedTarget,S=n.select("domReferenceElement"),T=n.select("floatingElement"),I=He(S,x),L=He(T,x);I||L||(f.clear(),h.current="",p.current=m.current,g(!1))}),w=E.useMemo(()=>({onKeyDown:y,onBlur:b}),[y,b]),k=E.useMemo(()=>({onKeyDown:y,onKeyUp(v){v.key===" "&&g(!1)},onBlur:b}),[y,b,g]);return E.useMemo(()=>c?{reference:w,floating:k}:{},[c,w,k])}function Gg(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 NO(t,e){return t[0]>=e.x&&t[0]<=e.x+e.width&&t[1]>=e.y&&t[1]<=e.y+e.height}function _O(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 m=d-i,g=f-a,b=Math.sqrt(m*m+g*g)/p;return i=d,a=f,l=h,b}const u=({x:d,y:f,placement:h,elements:p,onClose:m,nodeId:g,tree:y})=>function(w){function k(){o.clear(),m()}if(o.clear(),!p.domReference||!p.floating||h==null||d==null||f==null)return;const{clientX:v,clientY:x}=w,S=[v,x],T=xn(w),I=w.type==="mouseleave",L=He(p.floating,T),N=He(p.domReference,T),P=p.domReference.getBoundingClientRect(),A=p.floating.getBoundingClientRect(),j=h.split("-")[0],K=d>A.right-A.width/2,J=f>A.bottom-A.height/2,Y=NO(S,P),G=A.width>P.width,U=A.height>P.height,z=(G?P:A).left,B=(G?P:A).right,H=(U?P:A).top,V=(U?P:A).bottom;if(L&&(s=!0,!I))return;if(N&&(s=!1),N&&!I){s=!0;return}if(I&&tt(w.relatedTarget)&&He(p.floating,w.relatedTarget)||y&&Xo(y.nodesRef.current,g).some(({context:$})=>$?.open))return;if(j==="top"&&f>=P.bottom-1||j==="bottom"&&f<=P.top+1||j==="left"&&d>=P.right-1||j==="right"&&d<=P.left+1)return k();let R=[];switch(j){case"top":R=[[z,P.top+1],[z,A.bottom-1],[B,A.bottom-1],[B,P.top+1]];break;case"bottom":R=[[z,A.top+1],[z,P.bottom-1],[B,P.bottom-1],[B,A.top+1]];break;case"left":R=[[A.right-1,V],[A.right-1,H],[P.left+1,H],[P.left+1,V]];break;case"right":R=[[P.right-1,V],[P.right-1,H],[A.left+1,H],[A.left+1,V]];break}function D([$,Z]){switch(j){case"top":{const Q=[G?$+e/2:K?$+e*4:$-e*4,Z+e+1],_=[G?$-e/2:K?$+e*4:$-e*4,Z+e+1],q=[[A.left,K||G?A.bottom-e:A.top],[A.right,K?G?A.bottom-e:A.top:A.bottom-e]];return[Q,_,...q]}case"bottom":{const Q=[G?$+e/2:K?$+e*4:$-e*4,Z-e],_=[G?$-e/2:K?$+e*4:$-e*4,Z-e],q=[[A.left,K||G?A.top+e:A.bottom],[A.right,K?G?A.top+e:A.bottom:A.top+e]];return[Q,_,...q]}case"left":{const Q=[$+e+1,U?Z+e/2:J?Z+e*4:Z-e*4],_=[$+e+1,U?Z-e/2:J?Z+e*4:Z-e*4];return[...[[J||U?A.right-e:A.left,A.top],[J?U?A.right-e:A.left:A.right-e,A.bottom]],Q,_]}case"right":{const Q=[$-e,U?Z+e/2:J?Z+e*4:Z-e*4],_=[$-e,U?Z-e/2:J?Z+e*4:Z-e*4],q=[[J||U?A.left+e:A.right,A.top],[J?U?A.left+e:A.right:A.left+e,A.bottom]];return[Q,_,...q]}default:return[]}}if(!Gg([v,x],R)){if(s&&!Y)return k();if(!I&&r){const $=c(w.clientX,w.clientY);if($!==null&&$<.1)return k()}Gg([v,x],D([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=Ca.startingStyle]="startingStyle",t[t.endingStyle=Ca.endingStyle]="endingStyle",t.anchorHidden="data-anchor-hidden",t.side="data-side",t.align="data-align",t})({}),yh=(function(t){return t.popupOpen="data-popup-open",t.pressed="data-pressed",t})({});const PO={[yh.popupOpen]:""},AO={[yh.popupOpen]:"",[yh.pressed]:""},IO={[qo.open]:""},$O={[qo.closed]:""},DO={[qo.anchorHidden]:""},Fk={open(t){return t?PO:null}},Bk={open(t){return t?AO:null}},Ii={open(t){return t?IO:$O},anchorHidden(t){return t?DO:null}};function bs(t){return _i(t,"base-ui")}const zO=E.createContext(void 0);function Ap(){return E.useContext(zO)?.direction??"ltr"}const LO=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"}=Lr(t,e)||{};if(c==null)return{};const f=Hw(u),h={x:n,y:r},p=wp(o),m=vp(p),g=await i.getDimensions(c),y=p==="y",b=y?"top":"left",w=y?"bottom":"right",k=y?"clientHeight":"clientWidth",v=s.reference[m]+s.reference[p]-h[p]-s.floating[m],x=h[p]-s.reference[p],S=d==="real"?await i.getOffsetParent?.(c):a.floating;let T=a.floating[k]||s.floating[m];(!T||!await i.isElement?.(S))&&(T=a.floating[k]||s.floating[m]);const I=v/2-x/2,L=T/2-g[m]/2-1,N=Math.min(f[b],L),P=Math.min(f[w],L),A=N,j=T-g[m]-P,K=T/2-g[m]/2+I,J=lh(A,K,j),Y=!l.arrow&&Eo(o)!=null&&K!==J&&s.reference[m]/2-(K<A?N:P)-g[m]/2<0,G=Y?K<A?K-A:K-j:0;return{[p]:h[p]+G,data:{[p]:J,centerOffset:K-J-G,...Y&&{alignmentOffset:G}},reset:Y}}}),jO=(t,e)=>({...LO(t),options:[t,e]}),FO={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 BR().fn(t)).data?.referenceHidden||s}}}},Rc={sideX:"left",sideY:"top"},BO={name:"adaptiveOrigin",async fn(t){const{x:e,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:a}=t,l=Rt(o),c=l.getComputedStyle(o);if(!(c.transitionDuration!=="0s"&&c.transitionDuration!==""))return{x:e,y:n,data:Rc};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=Je(o);f={width:b.documentElement.clientWidth,height:b.documentElement.clientHeight}}else await s.isElement?.(d)&&(f=await s.getDimensions(d));const h=gn(a);let p=e,m=n;h==="left"&&(p=f.width-(e+r.width)),h==="top"&&(m=f.height-(n+r.height));const g=h==="left"?"right":Rc.sideX,y=h==="top"?"bottom":Rc.sideY;return{x:p,y:m,data:{sideX:g,sideY:y}}}};function Vk(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 Zg(t,e,n){const{rects:r,placement:o}=t;return{side:Vk(e,gn(o),n),align:Eo(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Hk(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:m,shiftCrossAxis:g=!1,nodeId:y,adaptiveOrigin:b,lazyFlip:w=!1,externalTree:k}=t,[v,x]=E.useState(null);!p&&v!==null&&x(null);const S=m.side||"flip",T=m.align||"flip",I=m.fallbackAxisSide||"end",L=typeof e=="function"?e:void 0,N=pe(L),P=L?N:e,A=Ft(e),K=Ap()==="rtl",J=v||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":K?"left":"right","inline-start":K?"right":"left"}[r],Y=s==="center"?J:`${J}-${s}`;let G=l;const U=1,z=r==="bottom"?U:0,B=r==="top"?U:0,H=r==="right"?U:0,V=r==="left"?U:0;typeof G=="number"?G={top:G+z,right:G+V,bottom:G+B,left:G+H}:G&&(G={top:(G.top||0)+z,right:(G.right||0)+V,bottom:(G.bottom||0)+B,left:(G.left||0)+H});const R={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:G},D=E.useRef(null),$=Ft(o),Z=Ft(i),q=[DR(De=>{const Se=Zg(De,r,K),ce=typeof $.current=="function"?$.current(Se):$.current,ve=typeof Z.current=="function"?Z.current(Se):Z.current;return{mainAxis:ce,crossAxis:ve,alignmentAxis:ve}},[typeof o!="function"?o:0,typeof i!="function"?i:0,K,r])],C=T==="none"&&S!=="shift",O=!C&&(c||g||S==="shift"),F=S==="none"?null:jR({...R,padding:{top:G.top+U,right:G.right+U,bottom:G.bottom+U,left:G.left+U},mainAxis:!g&&S==="flip",crossAxis:T==="flip"?"alignment":!1,fallbackAxisSideDirection:I}),W=C?null:zR(De=>{const Se=Je(De.elements.floating).documentElement;return{...R,rootBoundary:g?{x:0,y:0,width:Se.clientWidth,height:Se.clientHeight}:void 0,mainAxis:T!=="none",crossAxis:O,limiter:c||g?void 0:LR(ce=>{if(!D.current)return{};const{width:ve,height:xe}=D.current.getBoundingClientRect(),Ie=Dn(gn(ce.placement)),dt=Ie==="y"?ve:xe,$e=Ie==="y"?G.left+G.right:G.top+G.bottom;return{offset:dt/2+$e/2}})}},[R,c,g,G,T]);S==="shift"||T==="shift"||s==="center"?q.push(W,F):q.push(F,W),q.push(FR({...R,apply({elements:{floating:De},rects:{reference:Se},availableWidth:ce,availableHeight:ve}){const xe=De.style;xe.setProperty("--available-width",`${ce}px`),xe.setProperty("--available-height",`${ve}px`),xe.setProperty("--anchor-width",`${Se.width}px`),xe.setProperty("--anchor-height",`${Se.height}px`)}}),jO(()=>({element:D.current||document.createElement("div"),padding:u,offsetParent:"floating"}),[u]),{name:"transformOrigin",fn(De){const{elements:Se,middlewareData:ce,placement:ve,rects:xe,y:Ie}=De,dt=gn(ve),$e=Dn(dt),Xn=D.current,Vr=ce.arrow?.x||0,Hr=ce.arrow?.y||0,vr=Xn?.clientWidth||0,wr=Xn?.clientHeight||0,ze=Vr+vr/2,ft=Hr+wr/2,dn=Math.abs(ce.shift?.y||0),fn=xe.reference.height/2,At=typeof o=="function"?o(Zg(De,r,K)):o,Ns=dn>At,Eg={top:`${ze}px calc(100% + ${At}px)`,bottom:`${ze}px ${-At}px`,left:`calc(100% + ${At}px) ${ft}px`,right:`${-At}px ${ft}px`}[dt],xT=`${ze}px ${xe.reference.y+fn-Ie}px`;return Se.floating.style.setProperty("--transform-origin",O&&$e==="y"&&Ns?xT:Eg),{}}},FO,b),ge(()=>{!p&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[p,h]);const X=E.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<"u",layoutShift:!d&&typeof IntersectionObserver<"u"}),[d]),{refs:ee,elements:ne,x:oe,y:re,middlewareData:ae,update:te,placement:fe,context:ye,isPositioned:he,floatingStyles:qe}=gO({rootContext:h,placement:Y,middleware:q,strategy:n,whileElementsMounted:f?void 0:(...De)=>Wg(...De,X),nodeId:y,externalTree:k}),{sideX:Ye,sideY:st}=ae.adaptiveOrigin||Rc,Ae=he?n:"fixed",_e=E.useMemo(()=>{const De=b?{position:Ae,[Ye]:oe,[st]:re}:{position:Ae,...qe};return he||(De.opacity=0),De},[b,Ae,Ye,oe,st,re,qe,he]),Ue=E.useRef(null);ge(()=>{if(!p)return;const De=A.current,Se=typeof De=="function"?De():De,ve=(Jg(Se)?Se.current:Se)||null||null;ve!==Ue.current&&(ee.setPositionReference(ve),Ue.current=ve)},[p,ee,P,A]),E.useEffect(()=>{if(!p)return;const De=A.current;typeof De!="function"&&Jg(De)&&De.current!==Ue.current&&(ee.setPositionReference(De.current),Ue.current=De.current)},[p,ee,P,A]),E.useEffect(()=>{if(f&&p&&ne.domReference&&ne.floating)return Wg(ne.domReference,ne.floating,te,X)},[f,p,ne,te,X]);const Ke=gn(fe),zt=Vk(r,Ke,K),Ht=Eo(fe)||"center",Lt=!!ae.hide?.referenceHidden;ge(()=>{w&&p&&he&&x(Ke)},[w,p,he,Ke]);const Pt=E.useMemo(()=>({position:"absolute",top:ae.arrow?.y,left:ae.arrow?.x}),[ae.arrow]),wt=ae.arrow?.centerOffset!==0;return E.useMemo(()=>({positionerStyles:_e,arrowStyles:Pt,arrowRef:D,arrowUncentered:wt,side:zt,align:Ht,physicalSide:Ke,anchorHidden:Lt,refs:ee,context:ye,isPositioned:he,update:te}),[_e,Pt,D,wt,zt,Ht,Ke,Lt,ee,ye,he,te])}function Jg(t){return t!=null&&"current"in t}function ud(t){return t==="starting"?xM:$t}function dd(t){return Sp(19)?t:t?"true":void 0}function Wk(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=Wk(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function qk(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=Wk(t))&&(r&&(r+=" "),r+=e);return r}const VO=(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},HO=(t,e)=>({classGroupId:t,validator:e}),Uk=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),Wc="-",Xg=[],WO="arbitrary..",qO=t=>{const e=KO(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return UO(i);const a=i.split(Wc),l=a[0]===""&&a.length>1?1:0;return Kk(a,l,e)},getConflictingClassGroupIds:(i,a)=>{if(a){const l=r[i],c=n[i];return l?c?VO(c,l):l:c||Xg}return n[i]||Xg}}},Kk=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const o=t[e],s=n.nextPart.get(o);if(s){const c=Kk(t,e+1,s);if(c)return c}const i=n.validators;if(i===null)return;const a=e===0?t.join(Wc):t.slice(e).join(Wc),l=i.length;for(let c=0;c<l;c++){const u=i[c];if(u.validator(a))return u.classGroupId}},UO=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?WO+r:void 0})(),KO=t=>{const{theme:e,classGroups:n}=t;return YO(n,e)},YO=(t,e)=>{const n=Uk();for(const r in t){const o=t[r];Ip(o,n,r,e)}return n},Ip=(t,e,n,r)=>{const o=t.length;for(let s=0;s<o;s++){const i=t[s];GO(i,e,n,r)}},GO=(t,e,n,r)=>{if(typeof t=="string"){ZO(t,e,n);return}if(typeof t=="function"){JO(t,e,n,r);return}XO(t,e,n,r)},ZO=(t,e,n)=>{const r=t===""?e:Yk(e,t);r.classGroupId=n},JO=(t,e,n,r)=>{if(QO(t)){Ip(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(HO(n,t))},XO=(t,e,n,r)=>{const o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){const[a,l]=o[i];Ip(l,Yk(e,a),n,r)}},Yk=(t,e)=>{let n=t;const r=e.split(Wc),o=r.length;for(let s=0;s<o;s++){const i=r[s];let a=n.nextPart.get(i);a||(a=Uk(),n.nextPart.set(i,a)),n=a}return n},QO=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,eN=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)}}},bh="!",Qg=":",tN=[],ey=(t,e,n,r,o)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),nN=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 m=0;m<u;m++){const g=o[m];if(i===0&&a===0){if(g===Qg){s.push(o.slice(l,m)),l=m+1;continue}if(g==="/"){c=m;continue}}g==="["?i++:g==="]"?i--:g==="("?a++:g===")"&&a--}const d=s.length===0?o:o.slice(l);let f=d,h=!1;d.endsWith(bh)?(f=d.slice(0,-1),h=!0):d.startsWith(bh)&&(f=d.slice(1),h=!0);const p=c&&c>l?c-l:void 0;return ey(s,h,f,p)};if(e){const o=e+Qg,s=r;r=i=>i.startsWith(o)?s(i.slice(o.length)):ey(tN,!1,i,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},rN=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}},oN=t=>({cache:eN(t.cacheSize),parseClassName:nN(t),sortModifiers:rN(t),...qO(t)}),sN=/\s+/,iN=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=e,i=[],a=t.trim().split(sN);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:m}=n(u);if(d){l=u+(l.length>0?" "+l:l);continue}let g=!!m,y=r(g?p.substring(0,m):p);if(!y){if(!g){l=u+(l.length>0?" "+l:l);continue}if(y=r(p),!y){l=u+(l.length>0?" "+l:l);continue}g=!1}const b=f.length===0?"":f.length===1?f[0]:s(f).join(":"),w=h?b+bh:b,k=w+y;if(i.indexOf(k)>-1)continue;i.push(k);const v=o(y,g);for(let x=0;x<v.length;++x){const S=v[x];i.push(w+S)}l=u+(l.length>0?" "+l:l)}return l},aN=(...t)=>{let e=0,n,r,o="";for(;e<t.length;)(n=t[e++])&&(r=Gk(n))&&(o&&(o+=" "),o+=r);return o},Gk=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=Gk(t[r]))&&(n&&(n+=" "),n+=e);return n},lN=(t,...e)=>{let n,r,o,s;const i=l=>{const c=e.reduce((u,d)=>d(u),t());return n=oN(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=iN(l,n);return o(l,u),u};return s=i,(...l)=>s(aN(...l))},cN=[],It=t=>{const e=n=>n[t]||cN;return e.isThemeGetter=!0,e},Zk=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Jk=/^\((?:(\w[\w-]*):)?(.+)\)$/i,uN=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,dN=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,fN=/\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$/,hN=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,pN=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,mN=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Wr=t=>uN.test(t),Ve=t=>!!t&&!Number.isNaN(Number(t)),qr=t=>!!t&&Number.isInteger(Number(t)),rf=t=>t.endsWith("%")&&Ve(t.slice(0,-1)),kr=t=>dN.test(t),Xk=()=>!0,gN=t=>fN.test(t)&&!hN.test(t),$p=()=>!1,yN=t=>pN.test(t),bN=t=>mN.test(t),vN=t=>!we(t)&&!ke(t),wN=t=>Mo(t,tx,$p),we=t=>Zk.test(t),$o=t=>Mo(t,nx,gN),ty=t=>Mo(t,RN,Ve),kN=t=>Mo(t,ox,Xk),xN=t=>Mo(t,rx,$p),ny=t=>Mo(t,Qk,$p),SN=t=>Mo(t,ex,bN),hl=t=>Mo(t,sx,yN),ke=t=>Jk.test(t),ji=t=>vs(t,nx),EN=t=>vs(t,rx),ry=t=>vs(t,Qk),CN=t=>vs(t,tx),TN=t=>vs(t,ex),pl=t=>vs(t,sx,!0),MN=t=>vs(t,ox,!0),Mo=(t,e,n)=>{const r=Zk.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},vs=(t,e,n=!1)=>{const r=Jk.exec(t);return r?r[1]?e(r[1]):n:!1},Qk=t=>t==="position"||t==="percentage",ex=t=>t==="image"||t==="url",tx=t=>t==="length"||t==="size"||t==="bg-size",nx=t=>t==="length",RN=t=>t==="number",rx=t=>t==="family-name",ox=t=>t==="number"||t==="weight",sx=t=>t==="shadow",ON=()=>{const t=It("color"),e=It("font"),n=It("text"),r=It("font-weight"),o=It("tracking"),s=It("leading"),i=It("breakpoint"),a=It("container"),l=It("spacing"),c=It("radius"),u=It("shadow"),d=It("inset-shadow"),f=It("text-shadow"),h=It("drop-shadow"),p=It("blur"),m=It("perspective"),g=It("aspect"),y=It("ease"),b=It("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(),ke,we],x=()=>["auto","hidden","clip","visible","scroll"],S=()=>["auto","contain","none"],T=()=>[ke,we,l],I=()=>[Wr,"full","auto",...T()],L=()=>[qr,"none","subgrid",ke,we],N=()=>["auto",{span:["full",qr,ke,we]},qr,ke,we],P=()=>[qr,"auto",ke,we],A=()=>["auto","min","max","fr",ke,we],j=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],K=()=>["start","end","center","stretch","center-safe","end-safe"],J=()=>["auto",...T()],Y=()=>[Wr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],G=()=>[Wr,"screen","full","dvw","lvw","svw","min","max","fit",...T()],U=()=>[Wr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...T()],z=()=>[t,ke,we],B=()=>[...k(),ry,ny,{position:[ke,we]}],H=()=>["no-repeat",{repeat:["","x","y","space","round"]}],V=()=>["auto","cover","contain",CN,wN,{size:[ke,we]}],R=()=>[rf,ji,$o],D=()=>["","none","full",c,ke,we],$=()=>["",Ve,ji,$o],Z=()=>["solid","dashed","dotted","double"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>[Ve,rf,ry,ny],q=()=>["","none",p,ke,we],C=()=>["none",Ve,ke,we],O=()=>["none",Ve,ke,we],F=()=>[Ve,ke,we],W=()=>[Wr,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[kr],breakpoint:[kr],color:[Xk],container:[kr],"drop-shadow":[kr],ease:["in","out","in-out"],font:[vN],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[kr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[kr],shadow:[kr],spacing:["px",Ve],text:[kr],"text-shadow":[kr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Wr,we,ke,g]}],container:["container"],columns:[{columns:[Ve,we,ke,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:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{"inset-s":I(),start:I()}],end:[{"inset-e":I(),end:I()}],"inset-bs":[{"inset-bs":I()}],"inset-be":[{"inset-be":I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[qr,"auto",ke,we]}],basis:[{basis:[Wr,"full","auto",a,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ve,Wr,"auto","initial","none",we]}],grow:[{grow:["",Ve,ke,we]}],shrink:[{shrink:["",Ve,ke,we]}],order:[{order:[qr,"first","last","none",ke,we]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:N()}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:N()}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...j(),"normal"]}],"justify-items":[{"justify-items":[...K(),"normal"]}],"justify-self":[{"justify-self":["auto",...K()]}],"align-content":[{content:["normal",...j()]}],"align-items":[{items:[...K(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...K(),{baseline:["","last"]}]}],"place-content":[{"place-content":j()}],"place-items":[{"place-items":[...K(),"baseline"]}],"place-self":[{"place-self":["auto",...K()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pbs:[{pbs:T()}],pbe:[{pbe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:J()}],mx:[{mx:J()}],my:[{my:J()}],ms:[{ms:J()}],me:[{me:J()}],mbs:[{mbs:J()}],mbe:[{mbe:J()}],mt:[{mt:J()}],mr:[{mr:J()}],mb:[{mb:J()}],ml:[{ml:J()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],"inline-size":[{inline:["auto",...G()]}],"min-inline-size":[{"min-inline":["auto",...G()]}],"max-inline-size":[{"max-inline":["none",...G()]}],"block-size":[{block:["auto",...U()]}],"min-block-size":[{"min-block":["auto",...U()]}],"max-block-size":[{"max-block":["none",...U()]}],w:[{w:[a,"screen",...Y()]}],"min-w":[{"min-w":[a,"screen","none",...Y()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[i]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",n,ji,$o]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,MN,kN]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",rf,we]}],"font-family":[{font:[EN,xN,e]}],"font-features":[{"font-features":[we]}],"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,ke,we]}],"line-clamp":[{"line-clamp":[Ve,"none",ke,ty]}],leading:[{leading:[s,...T()]}],"list-image":[{"list-image":["none",ke,we]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ke,we]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:z()}],"text-color":[{text:z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ve,"from-font","auto",ke,$o]}],"text-decoration-color":[{decoration:z()}],"underline-offset":[{"underline-offset":[Ve,"auto",ke,we]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke,we]}],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",ke,we]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:B()}],"bg-repeat":[{bg:H()}],"bg-size":[{bg:V()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},qr,ke,we],radial:["",ke,we],conic:[qr,ke,we]},TN,SN]}],"bg-color":[{bg:z()}],"gradient-from-pos":[{from:R()}],"gradient-via-pos":[{via:R()}],"gradient-to-pos":[{to:R()}],"gradient-from":[{from:z()}],"gradient-via":[{via:z()}],"gradient-to":[{to:z()}],rounded:[{rounded:D()}],"rounded-s":[{"rounded-s":D()}],"rounded-e":[{"rounded-e":D()}],"rounded-t":[{"rounded-t":D()}],"rounded-r":[{"rounded-r":D()}],"rounded-b":[{"rounded-b":D()}],"rounded-l":[{"rounded-l":D()}],"rounded-ss":[{"rounded-ss":D()}],"rounded-se":[{"rounded-se":D()}],"rounded-ee":[{"rounded-ee":D()}],"rounded-es":[{"rounded-es":D()}],"rounded-tl":[{"rounded-tl":D()}],"rounded-tr":[{"rounded-tr":D()}],"rounded-br":[{"rounded-br":D()}],"rounded-bl":[{"rounded-bl":D()}],"border-w":[{border:$()}],"border-w-x":[{"border-x":$()}],"border-w-y":[{"border-y":$()}],"border-w-s":[{"border-s":$()}],"border-w-e":[{"border-e":$()}],"border-w-bs":[{"border-bs":$()}],"border-w-be":[{"border-be":$()}],"border-w-t":[{"border-t":$()}],"border-w-r":[{"border-r":$()}],"border-w-b":[{"border-b":$()}],"border-w-l":[{"border-l":$()}],"divide-x":[{"divide-x":$()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":$()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Z(),"hidden","none"]}],"divide-style":[{divide:[...Z(),"hidden","none"]}],"border-color":[{border:z()}],"border-color-x":[{"border-x":z()}],"border-color-y":[{"border-y":z()}],"border-color-s":[{"border-s":z()}],"border-color-e":[{"border-e":z()}],"border-color-bs":[{"border-bs":z()}],"border-color-be":[{"border-be":z()}],"border-color-t":[{"border-t":z()}],"border-color-r":[{"border-r":z()}],"border-color-b":[{"border-b":z()}],"border-color-l":[{"border-l":z()}],"divide-color":[{divide:z()}],"outline-style":[{outline:[...Z(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ve,ke,we]}],"outline-w":[{outline:["",Ve,ji,$o]}],"outline-color":[{outline:z()}],shadow:[{shadow:["","none",u,pl,hl]}],"shadow-color":[{shadow:z()}],"inset-shadow":[{"inset-shadow":["none",d,pl,hl]}],"inset-shadow-color":[{"inset-shadow":z()}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:z()}],"ring-offset-w":[{"ring-offset":[Ve,$o]}],"ring-offset-color":[{"ring-offset":z()}],"inset-ring-w":[{"inset-ring":$()}],"inset-ring-color":[{"inset-ring":z()}],"text-shadow":[{"text-shadow":["none",f,pl,hl]}],"text-shadow-color":[{"text-shadow":z()}],opacity:[{opacity:[Ve,ke,we]}],"mix-blend":[{"mix-blend":[...Q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Q()}],"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":[Ve]}],"mask-image-linear-from-pos":[{"mask-linear-from":_()}],"mask-image-linear-to-pos":[{"mask-linear-to":_()}],"mask-image-linear-from-color":[{"mask-linear-from":z()}],"mask-image-linear-to-color":[{"mask-linear-to":z()}],"mask-image-t-from-pos":[{"mask-t-from":_()}],"mask-image-t-to-pos":[{"mask-t-to":_()}],"mask-image-t-from-color":[{"mask-t-from":z()}],"mask-image-t-to-color":[{"mask-t-to":z()}],"mask-image-r-from-pos":[{"mask-r-from":_()}],"mask-image-r-to-pos":[{"mask-r-to":_()}],"mask-image-r-from-color":[{"mask-r-from":z()}],"mask-image-r-to-color":[{"mask-r-to":z()}],"mask-image-b-from-pos":[{"mask-b-from":_()}],"mask-image-b-to-pos":[{"mask-b-to":_()}],"mask-image-b-from-color":[{"mask-b-from":z()}],"mask-image-b-to-color":[{"mask-b-to":z()}],"mask-image-l-from-pos":[{"mask-l-from":_()}],"mask-image-l-to-pos":[{"mask-l-to":_()}],"mask-image-l-from-color":[{"mask-l-from":z()}],"mask-image-l-to-color":[{"mask-l-to":z()}],"mask-image-x-from-pos":[{"mask-x-from":_()}],"mask-image-x-to-pos":[{"mask-x-to":_()}],"mask-image-x-from-color":[{"mask-x-from":z()}],"mask-image-x-to-color":[{"mask-x-to":z()}],"mask-image-y-from-pos":[{"mask-y-from":_()}],"mask-image-y-to-pos":[{"mask-y-to":_()}],"mask-image-y-from-color":[{"mask-y-from":z()}],"mask-image-y-to-color":[{"mask-y-to":z()}],"mask-image-radial":[{"mask-radial":[ke,we]}],"mask-image-radial-from-pos":[{"mask-radial-from":_()}],"mask-image-radial-to-pos":[{"mask-radial-to":_()}],"mask-image-radial-from-color":[{"mask-radial-from":z()}],"mask-image-radial-to-color":[{"mask-radial-to":z()}],"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":[Ve]}],"mask-image-conic-from-pos":[{"mask-conic-from":_()}],"mask-image-conic-to-pos":[{"mask-conic-to":_()}],"mask-image-conic-from-color":[{"mask-conic-from":z()}],"mask-image-conic-to-color":[{"mask-conic-to":z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:B()}],"mask-repeat":[{mask:H()}],"mask-size":[{mask:V()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ke,we]}],filter:[{filter:["","none",ke,we]}],blur:[{blur:q()}],brightness:[{brightness:[Ve,ke,we]}],contrast:[{contrast:[Ve,ke,we]}],"drop-shadow":[{"drop-shadow":["","none",h,pl,hl]}],"drop-shadow-color":[{"drop-shadow":z()}],grayscale:[{grayscale:["",Ve,ke,we]}],"hue-rotate":[{"hue-rotate":[Ve,ke,we]}],invert:[{invert:["",Ve,ke,we]}],saturate:[{saturate:[Ve,ke,we]}],sepia:[{sepia:["",Ve,ke,we]}],"backdrop-filter":[{"backdrop-filter":["","none",ke,we]}],"backdrop-blur":[{"backdrop-blur":q()}],"backdrop-brightness":[{"backdrop-brightness":[Ve,ke,we]}],"backdrop-contrast":[{"backdrop-contrast":[Ve,ke,we]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ve,ke,we]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ve,ke,we]}],"backdrop-invert":[{"backdrop-invert":["",Ve,ke,we]}],"backdrop-opacity":[{"backdrop-opacity":[Ve,ke,we]}],"backdrop-saturate":[{"backdrop-saturate":[Ve,ke,we]}],"backdrop-sepia":[{"backdrop-sepia":["",Ve,ke,we]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ke,we]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ve,"initial",ke,we]}],ease:[{ease:["linear","initial",y,ke,we]}],delay:[{delay:[Ve,ke,we]}],animate:[{animate:["none",b,ke,we]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,ke,we]}],"perspective-origin":[{"perspective-origin":v()}],rotate:[{rotate:C()}],"rotate-x":[{"rotate-x":C()}],"rotate-y":[{"rotate-y":C()}],"rotate-z":[{"rotate-z":C()}],scale:[{scale:O()}],"scale-x":[{"scale-x":O()}],"scale-y":[{"scale-y":O()}],"scale-z":[{"scale-z":O()}],"scale-3d":["scale-3d"],skew:[{skew:F()}],"skew-x":[{"skew-x":F()}],"skew-y":[{"skew-y":F()}],transform:[{transform:[ke,we,"","none","gpu","cpu"]}],"transform-origin":[{origin:v()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:W()}],"translate-x":[{"translate-x":W()}],"translate-y":[{"translate-y":W()}],"translate-z":[{"translate-z":W()}],"translate-none":["translate-none"],accent:[{accent:z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:z()}],"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",ke,we]}],"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":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mbs":[{"scroll-mbs":T()}],"scroll-mbe":[{"scroll-mbe":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pbs":[{"scroll-pbs":T()}],"scroll-pbe":[{"scroll-pbe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"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",ke,we]}],fill:[{fill:["none",...z()]}],"stroke-w":[{stroke:[Ve,ji,$o,ty]}],stroke:[{stroke:["none",...z()]}],"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"]}},NN=lN(ON);function ue(...t){return NN(qk(t))}const _N=[["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"}]],PN=lt("calendar-days",_N);const AN=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ix=lt("check",AN);const IN=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Dp=lt("chevron-down",IN);const $N=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],DN=lt("chevron-left",$N);const zN=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],LN=lt("chevron-right",zN);const jN=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],FN=lt("chevron-up",jN);const BN=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],VN=lt("clock-3",BN);const HN=[["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"}]],WN=lt("code-xml",HN);const qN=[["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"}]],UN=lt("heading-1",qN);const KN=[["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"}]],YN=lt("heading-2",KN);const GN=[["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"}]],zp=lt("image",GN);const ZN=[["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"}]],JN=lt("laptop-minimal",ZN);const XN=[["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"}]],QN=lt("link",XN);const e_=[["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"}]],t_=lt("list-checks",e_);const n_=[["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"}]],r_=lt("list-ordered",n_);const o_=[["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"}]],s_=lt("list",o_);const i_=[["path",{d:"M5 12h14",key:"1ays0h"}]],a_=lt("minus",i_);const l_=[["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"}]],c_=lt("moon",l_);const u_=[["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"}]],d_=lt("panel-left-close",u_);const f_=[["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"}]],h_=lt("panel-left-open",f_);const p_=[["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"}]],m_=lt("panel-right-close",p_);const g_=[["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"}]],y_=lt("panel-right-open",g_);const b_=[["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"}]],v_=lt("quote",b_);const w_=[["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"}]],k_=lt("save",w_);const x_=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ax=lt("search",x_);const S_=[["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"}]],E_=lt("sun",S_);const C_=[["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"}]],T_=lt("trash-2",C_);const M_=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],lx=lt("x",M_),cx=E.createContext(void 0);function ux(t=!1){const e=E.useContext(cx);if(e===void 0&&!t)throw new Error(en(16));return e}function R_(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:E.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=E.useRef(null),i=ux(!0)!==void 0,a=pe(()=>{const f=s.current;return!!(f?.tagName==="A"&&f?.href)}),{props:l}=R_({focusableWhenDisabled:n,disabled:e,composite:i,tabIndex:r,isNativeButton:o}),c=E.useCallback(()=>{const f=s.current;O_(f)&&i&&e&&l.disabled===void 0&&f.disabled&&(f.disabled=!1)},[e,l.disabled,i]);ge(c,[c]);const u=E.useCallback((f={})=>{const{onClick:h,onMouseDown:p,onKeyUp:m,onKeyDown:g,onPointerDown:y,...b}=f;return Pi({type:o?"button":void 0,onClick(k){if(e){k.preventDefault();return}h?.(k)},onMouseDown(k){e||p?.(k)},onKeyDown(k){if(e||(mh(k),g?.(k)),k.baseUIHandlerPrevented)return;const v=k.target===k.currentTarget&&!o&&!a()&&!e,x=k.key==="Enter",S=k.key===" ";v&&((S||x)&&k.preventDefault(),x&&h?.(k))},onKeyUp(k){e||(mh(k),m?.(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=pe(f=>{s.current=f,c()});return{getButtonProps:u,buttonRef:d}}function O_(t){return yt(t)&&t.tagName==="BUTTON"}const N_=E.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 ot("button",e,{state:{disabled:s},ref:[n,u],props:[l,c]})}),oy=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,sy=qk,Lp=(t,e)=>n=>{var r;if(e?.variants==null)return sy(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=oy(u)||oy(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[m,g]=p;return Array.isArray(g)?g.includes({...s,...a}[m]):{...s,...a}[m]===g})?[...c,d,f]:c},[]);return sy(t,i,l,n?.class,n?.className)},mi=Lp("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 yn(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(mi({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(N_,{"data-slot":"button",className:l,...r}),e[9]=r,e[10]=l,e[11]=c):c=e[11],c}function __(t,e){const n=getComputedStyle(t),r=parseFloat(n.fontSize);return e*r}function P_(t,e){const n=getComputedStyle(t.ownerDocument.body),r=parseFloat(n.fontSize);return e*r}function A_(t){return t/100*window.innerHeight}function I_(t){return t/100*window.innerWidth}function $_(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 ml({groupSize:t,panelElement:e,styleProp:n}){let r;const[o,s]=$_(n);switch(s){case"%":{r=o/100*t;break}case"px":{r=o;break}case"rem":{r=P_(e,o);break}case"em":{r=__(e,o);break}case"vh":{r=A_(o);break}case"vw":{r=I_(o);break}}return r}function mn(t){return parseFloat(t.toFixed(3))}function gi({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 vh(t){const{panels:e}=t,n=gi({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=ml({groupSize:n,panelElement:o,styleProp:s.collapsedSize});i=mn(u/n*100)}let a;if(s.defaultSize!==void 0){const u=ml({groupSize:n,panelElement:o,styleProp:s.defaultSize});a=mn(u/n*100)}let l=0;if(s.minSize!==void 0){const u=ml({groupSize:n,panelElement:o,styleProp:s.minSize});l=mn(u/n*100)}let c=100;if(s.maxSize!==void 0){const u=ml({groupSize:n,panelElement:o,styleProp:s.maxSize});c=mn(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 it(t,e="Assertion error"){if(!t)throw Error(e)}function wh(t,e){return Array.from(e).sort(t==="horizontal"?D_:z_)}function D_(t,e){const n=t.element.offsetLeft-e.element.offsetLeft;return n!==0?n:t.element.offsetWidth-e.element.offsetWidth}function z_(t,e){const n=t.element.offsetTop-e.element.offsetTop;return n!==0?n:t.element.offsetHeight-e.element.offsetHeight}function dx(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}function fx(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 L_({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}=fx(r,i),c=t==="horizontal"?a:l;c<s&&(s=c,o=i)}return it(o,"No rect found"),o}let gl;function j_(){return gl===void 0&&(typeof matchMedia=="function"?gl=!!matchMedia("(pointer:coarse)").matches:gl=!1),gl}function hx(t){const{element:e,orientation:n,panels:r,separators:o}=t,s=wh(n,Array.from(e.children).filter(dx).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 m of s)m.hasAttribute("data-panel")&&(p++,m.ariaDisabled===null&&(d++,c===-1&&(c=p),u=p))}if(d>1){let p=-1;for(const m of s)if(m.hasAttribute("data-panel")){p++;const g=r.find(y=>y.element===m);if(g){if(f){const y=f.element.getBoundingClientRect(),b=m.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],S=L_({orientation:n,rects:[y,b],targetRect:x.element.getBoundingClientRect()});w=[x,S===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=j_()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine;if(v.width<x){const T=x-v.width;v=new DOMRect(v.x-T/2,v.y,v.width+T,v.height)}if(v.height<x){const T=x-v.height;v=new DOMRect(v.x,v.y-T/2,v.width,v.height+T)}const S=p<=c||p>u;!a&&!S&&i.push({group:t,groupSize:gi({group:t}),panels:[f,g],separator:"width"in k?void 0:k,rect:v}),a=!1}}l=!1,f=g,h=[]}}else if(m.hasAttribute("data-separator")){m.ariaDisabled!==null&&(a=!0);const g=o.find(y=>y.element===m);g?h.push(g):(f=void 0,h=[])}else l=!0}return i}let px=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)}}},ir=new Map;const mx=new px;function F_(t){ir=new Map(ir),ir.delete(t)}function iy(t,e){for(const[n]of ir)if(n.id===t)return n}function uo(t,e){for(const[n,r]of ir)if(n.id===t)return r;if(e)throw Error(`Could not find data for Group with id ${t}`)}function ks(){return ir}function jp(t,e){return mx.addListener("groupChange",n=>{n.group.id===t&&e(n)})}function Fr(t,e){const n=ir.get(t);ir=new Map(ir),ir.set(t,e),mx.emit("groupChange",{group:t,prev:n,next:e})}function B_(t,e,n){let r,o={x:1/0,y:1/0};for(const s of e){const i=fx(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 V_(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function H_(t,e){if(t===e)throw new Error("Cannot compare node with itself");const n={a:cy(t),b:cy(e)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();it(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:ly(ay(n.a)),b:ly(ay(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 W_=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function q_(t){const e=getComputedStyle(gx(t)??t).display;return e==="flex"||e==="inline-flex"}function U_(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||q_(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"||W_.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function ay(t){let e=t.length;for(;e--;){const n=t[e];if(it(n,"Missing node"),U_(n))return n}return null}function ly(t){return t&&Number(getComputedStyle(t).zIndex)||0}function cy(t){const e=[];for(;t;)e.push(t),t=gx(t);return e}function gx(t){const{parentNode:e}=t;return V_(e)?e.host:e}function K_(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 Y_({groupElement:t,hitRegion:e,pointerEventTarget:n}){if(!dx(n)||n.contains(t)||t.contains(n))return!0;if(H_(n,t)>0){let r=n;for(;r;){if(r.contains(t))return!0;if(K_(r.getBoundingClientRect(),e))return!1;r=r.parentElement}}return!0}function Fp(t,e){const n=[];return e.forEach((r,o)=>{if(o.disabled)return;const s=hx(o),i=B_(o.orientation,s,{x:t.clientX,y:t.clientY});i&&i.distance.x<=0&&i.distance.y<=0&&Y_({groupElement:o.element,hitRegion:i.hitRegion.rect,pointerEventTarget:t.target})&&n.push(i.hitRegion)}),n}function G_(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 on(t,e,n=0){return Math.abs(mn(t)-mn(e))<=n}function or(t,e){return on(t,e)?0:t>e?1:-1}function Us({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(or(r,l)<0)if(s){const c=(o+l)/2;or(r,c)<0?r=o:r=l}else r=l;return r=Math.min(a,r),r=mn(r),r}function Ta({delta:t,initialLayout:e,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:s}){if(on(t,0))return e;const i=s==="imperative-api",a=Object.values(e),l=Object.values(o),c=[...a],[u,d]=r;it(u!=null,"Invalid first pivot index"),it(d!=null,"Invalid second pivot index");let f=0;switch(s){case"keyboard":{{const m=t<0?d:u,g=n[m];it(g,`Panel constraints not found for index ${m}`);const{collapsedSize:y=0,collapsible:b,minSize:w=0}=g;if(b){const k=a[m];if(it(k!=null,`Previous layout not found for panel index ${m}`),on(k,y)){const v=w-k;or(v,Math.abs(t))>0&&(t=t<0?0-v:v)}}}{const m=t<0?u:d,g=n[m];it(g,`No panel constraints found for index ${m}`);const{collapsedSize:y=0,collapsible:b,minSize:w=0}=g;if(b){const k=a[m];if(it(k!=null,`Previous layout not found for panel index ${m}`),on(k,w)){const v=k-y;or(v,Math.abs(t))>0&&(t=t<0?0-v:v)}}}break}default:{const m=t<0?d:u,g=n[m];it(g,`Panel constraints not found for index ${m}`);const y=a[m],{collapsible:b,collapsedSize:w,minSize:k}=g;if(b&&or(y,k)<0)if(t>0){const v=k-w,x=v/2,S=y+t;or(S,k)<0&&(t=or(t,x)<=0?0:v)}else{const v=k-w,x=100-v/2,S=y-t;or(S,k)<0&&(t=or(100+t,x)>0?0:-v)}break}}{const m=t<0?1:-1;let g=t<0?d:u,y=0;for(;;){const w=a[g];it(w!=null,`Previous layout not found for panel index ${g}`);const k=Us({overrideDisabledPanels:i,panelConstraints:n[g],prevSize:w,size:100})-w;if(y+=k,g+=m,g<0||g>=n.length)break}const b=Math.min(Math.abs(t),Math.abs(y));t=t<0?0-b:b}{let m=t<0?u:d;for(;m>=0&&m<n.length;){const g=Math.abs(t)-Math.abs(f),y=a[m];it(y!=null,`Previous layout not found for panel index ${m}`);const b=y-g,w=Us({overrideDisabledPanels:i,panelConstraints:n[m],prevSize:y,size:b});if(!on(y,w)&&(f+=y-w,c[m]=w,f.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?m--:m++}}if(G_(l,c))return o;{const m=t<0?d:u,g=a[m];it(g!=null,`Previous layout not found for panel index ${m}`);const y=g+f,b=Us({overrideDisabledPanels:i,panelConstraints:n[m],prevSize:g,size:y});if(c[m]=b,!on(b,y)){let w=y-b,k=t<0?d:u;for(;k>=0&&k<n.length;){const v=c[k];it(v!=null,`Previous layout not found for panel index ${k}`);const x=v+w,S=Us({overrideDisabledPanels:i,panelConstraints:n[k],prevSize:v,size:x});if(on(v,S)||(w-=S-v,c[k]=S),on(w,0))break;t>0?k--:k++}}}const h=Object.values(c).reduce((m,g)=>g+m,0);if(!on(h,100,.1))return o;const p=Object.keys(o);return c.reduce((m,g,y)=>(m[p[y]]=g,m),{})}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||or(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(!on(o,100)&&r.length>0)for(let a=0;a<e.length;a++){const l=r[a];it(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];it(l!=null,`No layout data found for index ${a}`);const c=r[a];it(c!=null,`No layout data found for index ${a}`);const u=Us({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:l,size:c});c!=u&&(s+=c-u,r[a]=u)}if(!on(s,0))for(let a=0;a<e.length;a++){const l=r[a];it(l!=null,`No layout data found for index ${a}`);const c=l+s,u=Us({overrideDisabledPanels:!0,panelConstraints:e[a],prevSize:l,size:c});if(l!==u&&(s-=u-l,r[a]=u,on(s,0)))break}const i=Object.keys(t);return r.reduce((a,l,c)=>(a[i[c]]=l,a),{})}function yx({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(),m=d.panels.findIndex(w=>w.id===e),g=m===d.panels.length-1,y=Ta({delta:g?l-a:a-l,initialLayout:h,panelConstraints:u,pivotIndices:g?[m-1,m]:[m,m+1],prevLayout:h,trigger:"imperative-api"}),b=cs({layout:y,panelConstraints:u});ls(h,b)||Fr(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&&on(l,c)},resize:a=>{if(s()!==a){let l;switch(typeof a){case"number":{const{group:c}=n(),u=gi({group:c});l=mn(a/u*100);break}case"string":{l=parseFloat(a);break}}i(l)}}}}function uy(t){if(t.defaultPrevented)return;const e=ks();Fp(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=yx({groupId:n.group.id,panelId:r.id});s&&o!==void 0&&(s.resize(o),t.preventDefault())}}})}function Oc(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 bx({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)||Fr(s,{defaultLayoutDeferred:r,derivedPanelConstraints:o,groupSize:i,layout:c,separatorToPanels:l}),c)}}}function Do(t,e){const n=Oc(t),r=uo(n.id,!0),o=n.separators.find(u=>u.element===t);it(o,"Matching separator not found");const s=r.separatorToPanels.get(o);it(s,"Matching panels not found");const i=s.map(u=>n.panels.indexOf(u)),a=bx({groupId:n.id}).getLayout(),l=Ta({delta:e,initialLayout:a,panelConstraints:r.derivedPanelConstraints,pivotIndices:i,prevLayout:a,trigger:"keyboard"}),c=cs({layout:l,panelConstraints:r.derivedPanelConstraints});ls(a,c)||Fr(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function dy(t){if(t.defaultPrevented)return;const e=t.currentTarget,n=Oc(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=Oc(e),o=uo(r.id,!0),{derivedPanelConstraints:s,layout:i,separatorToPanels:a}=o,l=r.separators.find(f=>f.element===e);it(l,"Matching separator not found");const c=a.get(l);it(c,"Matching panels not found");const u=c[0],d=s.find(f=>f.panelId===u.id);if(it(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=Oc(e).separators.map(i=>i.element),o=Array.from(r).findIndex(i=>i===t.currentTarget);it(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 ei={cursorFlags:0,state:"inactive"};const Bp=new px;function us(){return ei}function Z_(t){return Bp.addListener("change",t)}function J_(t){const e=ei,n={...ei};n.cursorFlags=t,ei=n,Bp.emit("change",{prev:e,next:n})}function ti(t){const e=ei;ei=t,Bp.emit("change",{prev:e,next:t})}function fy(t){if(t.defaultPrevented||t.pointerType==="mouse"&&t.button>0)return;const e=ks(),n=Fp(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)}),ti({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:t.clientX,y:t.clientY},state:"active"}),n.length&&t.preventDefault()}const X_=t=>t,of=()=>{},vx=1,wx=2,kx=4,xx=8,hy=3,py=12;let yl;function my(){return yl===void 0&&(yl=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(yl=!0)),yl}function Q_({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&&my()){const s=(t&vx)!==0,i=(t&wx)!==0,a=(t&kx)!==0,l=(t&xx)!==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 my()?r>0&&o>0?"move":r>0?"ew-resize":"ns-resize":r>0&&o>0?"grab":r>0?"col-resize":"row-resize"}}const gy=new WeakMap;function Vp(t){if(t.defaultView===null||t.defaultView===void 0)return;let{prevStyle:e,styleSheet:n}=gy.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=Q_({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}}gy.set(t,{prevStyle:e,styleSheet:n})}function Sx({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 m=0;s?f==="horizontal"?m=(e.clientX-s.x)/d*100:m=(e.clientY-s.y)/d*100:f==="horizontal"?m=e.clientX<0?-100:100:m=e.clientY<0?-100:100;const g=r.get(u),y=o.get(u);if(!g||!y)return;const{defaultLayoutDeferred:b,derivedPanelConstraints:w,groupSize:k,layout:v,separatorToPanels:x}=y;if(w&&v&&x){const S=Ta({delta:m,initialLayout:g,panelConstraints:w,pivotIndices:c.panels.map(T=>h.indexOf(T)),prevLayout:v,trigger:"mouse-or-touch"});if(ls(S,v)){if(m!==0&&!p)switch(f){case"horizontal":{a|=m<0?vx:wx;break}case"vertical":{a|=m<0?kx:xx;break}}}else Fr(c.group,{defaultLayoutDeferred:b,derivedPanelConstraints:w,groupSize:k,layout:S,separatorToPanels:x})}});let l=0;e.movementX===0?l|=i&hy:l|=a&hy,e.movementY===0?l|=i&py:l|=a&py,J_(l),Vp(t)}function yy(t){const e=ks(),n=us();n.state==="active"&&Sx({document:t.currentTarget,event:t,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:e,prevCursorFlags:n.cursorFlags})}function by(t){if(t.defaultPrevented)return;const e=us(),n=ks();switch(e.state){case"active":{if(t.buttons===0){ti({cursorFlags:0,state:"inactive"}),e.hitRegions.forEach(r=>{const o=uo(r.group.id,!0);Fr(r.group,o)});return}Sx({document:t.currentTarget,event:t,hitRegions:e.hitRegions,initialLayoutMap:e.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:e.pointerDownAtPoint,prevCursorFlags:e.cursorFlags});break}default:{const r=Fp(t,n);r.length===0?e.state!=="inactive"&&ti({cursorFlags:0,state:"inactive"}):ti({cursorFlags:0,hitRegions:r,state:"hover"}),Vp(t.currentTarget);break}}}function vy(t){t.relatedTarget instanceof HTMLIFrameElement&&us().state==="hover"&&ti({cursorFlags:0,state:"inactive"})}function wy(t){if(t.defaultPrevented||t.pointerType==="mouse"&&t.button>0)return;const e=us();e.state==="active"&&(ti({cursorFlags:0,state:"inactive"}),e.hitRegions.length>0&&(Vp(t.currentTarget),e.hitRegions.forEach(n=>{const r=uo(n.group.id,!0);Fr(n.group,r)}),t.preventDefault()))}function ky(t){let e=0,n=0;const r={};for(const s of t)if(s.defaultSize!==void 0){e++;const i=mn(s.defaultSize);n+=i,r[s.panelId]=i}else r[s.panelId]=void 0;const o=t.length-e;if(o!==0){const s=mn((100-n)/o);for(const i of t)i.defaultSize===void 0&&(r[i.panelId]=s)}return r}function eP(t,e,n){if(!n[0])return;const r=t.panels.find(l=>l.element===e);if(!r||!r.onResize)return;const o=gi({group:t}),s=t.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,i=r.mutableValues.prevSize,a={asPercentage:mn(s/o*100),inPixels:s};r.mutableValues.prevSize=a,r.onResize(a,r.id,i)}function tP(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 nP({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=mn(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]=mn(f/s*c)}else{const d=mn(c/l.length);for(const f of l)u[f]=d}return u}function rP(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 oP(t){let e=!0;it(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 m of p){const{borderBoxSize:g,target:y}=m;if(y===t.element){if(e){const b=gi({group:t});if(b===0)return;const w=uo(t.id);if(!w)return;const k=vh(t),v=w.defaultLayoutDeferred?ky(k):w.layout,x=nP({group:t,nextGroupSize:b,prevGroupSize:w.groupSize,prevLayout:v}),S=cs({layout:x,panelConstraints:k});if(!w.defaultLayoutDeferred&&ls(w.layout,S)&&tP(w.derivedPanelConstraints,k)&&w.groupSize===b)return;Fr(t,{defaultLayoutDeferred:!1,derivedPanelConstraints:k,groupSize:b,layout:S,separatorToPanels:w.separatorToPanels})}}else eP(t,y,g)}});s.observe(t.element),t.panels.forEach(p=>{it(!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=gi({group:t}),a=vh(t),l=t.panels.map(({id:p})=>p).join(",");let c=t.mutableState.defaultLayout;c&&(rP(t.panels,c)||(c=void 0));const u=t.mutableState.layouts[l]??c??ky(a),d=cs({layout:u,panelConstraints:a}),f=t.element.ownerDocument;_s.set(f,(_s.get(f)??0)+1);const h=new Map;return hx(t).forEach(p=>{p.separator&&h.set(p.separator,p.panels)}),Fr(t,{defaultLayoutDeferred:i===0,derivedPanelConstraints:a,groupSize:i,layout:d,separatorToPanels:h}),t.separators.forEach(p=>{it(!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",dy)}),_s.get(f)===1&&(f.addEventListener("dblclick",uy,!0),f.addEventListener("pointerdown",fy,!0),f.addEventListener("pointerleave",yy),f.addEventListener("pointermove",by),f.addEventListener("pointerout",vy),f.addEventListener("pointerup",wy,!0)),function(){e=!1,_s.set(f,Math.max(0,(_s.get(f)??0)-1)),F_(t),t.separators.forEach(p=>{p.element.removeEventListener("keydown",dy)}),_s.get(f)||(f.removeEventListener("dblclick",uy,!0),f.removeEventListener("pointerdown",fy,!0),f.removeEventListener("pointerleave",yy),f.removeEventListener("pointermove",by),f.removeEventListener("pointerout",vy),f.removeEventListener("pointerup",wy,!0)),s.disconnect()}}function sP(){const[t,e]=E.useState({}),n=E.useCallback(()=>e({}),[]);return[t,n]}function Hp(t){const e=E.useId();return`${t??e}`}const xs=typeof window<"u"?E.useLayoutEffect:E.useEffect;function ca(t){const e=E.useRef(t);return xs(()=>{e.current=t},[t]),E.useCallback((...n)=>e.current?.(...n),[e])}function Wp(...t){return ca(e=>{t.forEach(n=>{if(n)switch(typeof n){case"function":{n(e);break}case"object":{n.current=e;break}}})})}function qp(t){const e=E.useRef({...t});return xs(()=>{for(const n in t)e.current[n]=t[n]},[t]),e.current}const Ex=E.createContext(null);function iP(t,e){const n=E.useRef({getLayout:()=>({}),setLayout:X_});E.useImperativeHandle(e,()=>n.current,[]),xs(()=>{Object.assign(n.current,bx({groupId:t}))})}function Cx({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=E.useRef({onLayoutChange:{},onLayoutChanged:{}}),m=ca(N=>{ls(p.current.onLayoutChange,N)||(p.current.onLayoutChange=N,l?.(N))}),g=ca(N=>{ls(p.current.onLayoutChanged,N)||(p.current.onLayoutChanged=N,c?.(N))}),y=Hp(a),b=E.useRef(null),[w,k]=sP(),v=E.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),x=Wp(b,s);iP(y,i);const S=ca((N,P)=>{const A=us(),j=iy(N),K=uo(N);if(K){let J=!1;return A.state==="active"&&(J=A.hitRegions.some(Y=>Y.group===j)),{flexGrow:K.layout[P]??1,pointerEvents:J?"none":void 0}}return{flexGrow:n?.[P]??1}}),T=qp({defaultLayout:n,disableCursor:r}),I=E.useMemo(()=>({get disableCursor(){return!!T.disableCursor},getPanelStyles:S,id:y,orientation:u,registerPanel:N=>{const P=v.current;return P.panels=wh(u,[...P.panels,N]),k(),()=>{P.panels=P.panels.filter(A=>A!==N),k()}},registerSeparator:N=>{const P=v.current;return P.separators=wh(u,[...P.separators,N]),k(),()=>{P.separators=P.separators.filter(A=>A!==N),k()}},togglePanelDisabled:(N,P)=>{const A=v.current.panels.find(J=>J.id===N);A&&(A.panelConstraints.disabled=P);const j=iy(y),K=uo(y);j&&K&&Fr(j,{...K,derivedPanelConstraints:vh(j)})},toggleSeparatorDisabled:(N,P)=>{const A=v.current.separators.find(j=>j.id===N);A&&(A.disabled=P)}}),[S,y,k,u,T]),L=E.useRef(null);return xs(()=>{const N=b.current;if(N===null)return;const P=v.current;let A;if(T.defaultLayout!==void 0&&Object.keys(T.defaultLayout).length===P.panels.length){A={};for(const z of P.panels){const B=T.defaultLayout[z.id];B!==void 0&&(A[z.id]=B)}}const j={disabled:!!o,element:N,id:y,mutableState:{defaultLayout:A,disableCursor:!!T.disableCursor,expandedPanelSizes:v.current.lastExpandedPanelSizes,layouts:v.current.layouts},orientation:u,panels:P.panels,resizeTargetMinimumSize:P.resizeTargetMinimumSize,separators:P.separators};L.current=j;const K=oP(j),{defaultLayoutDeferred:J,derivedPanelConstraints:Y,layout:G}=uo(j.id,!0);!J&&Y.length>0&&(m(G),g(G));const U=jp(y,z=>{const{defaultLayoutDeferred:B,derivedPanelConstraints:H,layout:V}=z.next;if(B||H.length===0)return;const R=j.panels.map(({id:$})=>$).join(",");j.mutableState.layouts[R]=V,H.forEach($=>{if($.collapsible){const{layout:Z}=z.prev??{};if(Z){const Q=on($.collapsedSize,V[$.panelId]),_=on($.collapsedSize,Z[$.panelId]);Q&&!_&&(j.mutableState.expandedPanelSizes[$.panelId]=Z[$.panelId])}}});const D=us().state!=="active";m(V),D&&g(V)});return()=>{L.current=null,K(),U()}},[o,y,g,m,u,w,T]),E.useEffect(()=>{const N=L.current;N&&(N.mutableState.defaultLayout=n,N.mutableState.disableCursor=!!r)}),M.jsx(Ex.Provider,{value:I,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})})}Cx.displayName="Group";function Up(){const t=E.useContext(Ex);return it(t,"Group Context not found; did you render a Panel or Separator outside of a Group?"),t}function aP(t,e){const{id:n}=Up(),r=E.useRef({collapse:of,expand:of,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:of});E.useImperativeHandle(e,()=>r.current,[]),xs(()=>{Object.assign(r.current,yx({groupId:n,panelId:t}))})}function Tx({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 m=!!l,g=Hp(l),y=qp({disabled:s}),b=E.useRef(null),w=Wp(b,i),{getPanelStyles:k,id:v,orientation:x,registerPanel:S,togglePanelDisabled:T}=Up(),I=d!==null,L=ca((P,A,j)=>{d?.(P,l,j)});xs(()=>{const P=b.current;if(P!==null){const A={element:P,id:g,idIsStable:m,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:I?L:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsible:r,defaultSize:o,disabled:y.disabled,maxSize:c,minSize:u}};return S(A)}},[a,n,r,o,I,g,m,c,u,L,S,y]),E.useEffect(()=>{T(g,!!s)},[s,g,T]),aP(g,f);const N=E.useSyncExternalStore(P=>jp(v,P),()=>JSON.stringify(k(v,g)),()=>JSON.stringify(k(v,g)));return M.jsx("div",{...p,"aria-disabled":s||void 0,"data-panel":!0,"data-testid":g,id:g,ref:w,style:{...lP,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...JSON.parse(N)},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})})}Tx.displayName="Panel";const lP={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function cP({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:Ta({delta:c-i,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[n],o=cs({layout:Ta({delta:l-i,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[n]}return{valueControls:n,valueMax:o,valueMin:s,valueNow:i}}function Mx({children:t,className:e,disabled:n,elementRef:r,id:o,style:s,...i}){const a=Hp(o),l=qp({disabled:n}),[c,u]=E.useState({}),[d,f]=E.useState("inactive"),h=E.useRef(null),p=Wp(h,r),{disableCursor:m,id:g,orientation:y,registerSeparator:b,toggleSeparatorDisabled:w}=Up(),k=y==="horizontal"?"vertical":"horizontal";xs(()=>{const x=h.current;if(x!==null){const S={disabled:l.disabled,element:x,id:a},T=b(S),I=Z_(N=>{f(N.next.state!=="inactive"&&N.next.hitRegions.some(P=>P.separator===S)?N.next.state:"inactive")}),L=jp(g,N=>{const{derivedPanelConstraints:P,layout:A,separatorToPanels:j}=N.next,K=j.get(S);if(K){const J=K[0],Y=K.indexOf(J);u(cP({layout:A,panelConstraints:P,panelId:J.id,panelIndex:Y}))}});return()=>{I(),L(),T()}}},[g,a,b,l]),E.useEffect(()=>{w(a,!!n)},[n,a,w]);let v;return n&&!m&&(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})}Mx.displayName="Separator";function uP(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(Cx,{"data-slot":"resizable-panel-group",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function sf(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(Tx,{"data-slot":"resizable-panel",...n}),e[2]=n,e[3]=r):r=e[3],r}function xy(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(Mx,{"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 Ma({controlled:t,default:e,name:n,state:r="value"}){const{current:o}=E.useRef(t!==void 0),[s,i]=E.useState(e),a=o?t:s,l=E.useCallback(c=>{o||i(c)},[]);return[a,l]}const Rx=E.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function dP(){return E.useContext(Rx)}function Kp(t){const{children:e,elementsRef:n,labelsRef:r,onMapChange:o}=t,s=pe(o),i=E.useRef(0),a=ln(hP).current,l=ln(fP).current,[c,u]=E.useState(0),d=E.useRef(c),f=pe((y,b)=>{l.set(y,b??null),d.current+=1,u(d.current)}),h=pe(y=>{l.delete(y),d.current+=1,u(d.current)}),p=E.useMemo(()=>{const y=new Map;return Array.from(l.keys()).filter(w=>w.isConnected).sort(pP).forEach((w,k)=>{const v=l.get(w)??{};y.set(w,{...v,index:k})}),y},[l,c]);ge(()=>{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]),ge(()=>{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]),ge(()=>()=>{n.current=[]},[n]),ge(()=>()=>{r&&(r.current=[])},[r]);const m=pe(y=>(a.add(y),()=>{a.delete(y)}));ge(()=>{a.forEach(y=>y(p))},[a,p]);const g=E.useMemo(()=>({register:f,unregister:h,subscribeMapChange:m,elementsRef:n,labelsRef:r,nextIndexRef:i}),[f,h,m,n,r,i]);return M.jsx(Rx.Provider,{value:g,children:e})}function fP(){return new Map}function hP(){return new Set}function pP(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 Ox=E.createContext(void 0);function Yp(){const t=E.useContext(Ox);if(t===void 0)throw new Error(en(64));return t}let mP=(function(t){return t.activationDirection="data-activation-direction",t.orientation="data-orientation",t})({});const Gp={tabActivationDirection:t=>({[mP.activationDirection]:t})},gP=E.forwardRef(function(e,n){const{className:r,defaultValue:o=0,onValueChange:s,orientation:i="horizontal",render:a,value:l,...c}=e,u=Ap(),d=Object.hasOwn(e,"defaultValue"),f=E.useRef([]),[h,p]=E.useState(()=>new Map),[m,g]=Ma({controlled:l,default:o,name:"Tabs",state:"value"}),y=l!==void 0,[b,w]=E.useState(()=>new Map),[k,v]=E.useState("none"),x=pe((Y,G)=>{s?.(Y,G),!G.isCanceled&&(g(Y),v(G.activationDirection))}),S=pe((Y,G)=>{p(U=>{if(U.get(Y)===G)return U;const z=new Map(U);return z.set(Y,G),z})}),T=pe((Y,G)=>{p(U=>{if(!U.has(Y)||U.get(Y)!==G)return U;const z=new Map(U);return z.delete(Y),z})}),I=E.useCallback(Y=>h.get(Y),[h]),L=E.useCallback(Y=>{for(const G of b.values())if(Y===G?.value)return G?.id},[b]),N=E.useCallback(Y=>{if(Y===void 0)return null;for(const[G,U]of b.entries())if(U!=null&&Y===(U.value??U.index))return G;return null},[b]),P=E.useMemo(()=>({direction:u,getTabElementBySelectedValue:N,getTabIdByPanelValue:L,getTabPanelIdByValue:I,onValueChange:x,orientation:i,registerMountedTabPanel:S,setTabMap:w,unregisterMountedTabPanel:T,tabActivationDirection:k,value:m}),[u,N,L,I,x,i,S,w,T,k,m]),A=E.useMemo(()=>{for(const Y of b.values())if(Y!=null&&Y.value===m)return Y},[b,m]),j=E.useMemo(()=>{for(const Y of b.values())if(Y!=null&&!Y.disabled)return Y.value},[b]);ge(()=>{if(y||b.size===0)return;const Y=A?.disabled,G=A==null&&m!==null;if(d&&Y&&m===o||!Y&&!G)return;const z=j??null;m!==z&&(g(z),v("none"))},[o,j,d,y,A,v,g,b,m]);const J=ot("div",e,{state:{orientation:i,tabActivationDirection:k},ref:n,props:c,stateAttributesMapping:Gp});return M.jsx(Ox.Provider,{value:P,children:M.jsx(Kp,{elementsRef:f,children:J})})}),Nx="data-composite-item-active";let _x=(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}=dP(),f=E.useRef(-1),[h,p]=E.useState(s??(o===_x.GuessFromOrder?()=>{if(f.current===-1){const y=d.current;d.current+=1,f.current=y}return f.current}:-1)),m=E.useRef(null),g=E.useCallback(y=>{if(m.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 ge(()=>{if(s!=null)return;const y=m.current;if(y)return i(y,n),()=>{a(y)}},[s,i,a,n]),ge(()=>{if(s==null)return l(y=>{const b=m.current?y.get(m.current)?.index:null;b!=null&&p(b)})},[s,l,p]),E.useMemo(()=>({ref:g,index:h}),[h,g])}function yP(t={}){const{highlightItemOnHover:e,highlightedIndex:n,onHighlightedIndexChange:r}=ux(),{ref:o,index:s}=Zp(t),i=n===s,a=E.useRef(null),l=jr(o,a);return{compositeProps:E.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 Px=E.createContext(void 0);function bP(){const t=E.useContext(Px);if(t===void 0)throw new Error(en(65));return t}const vP=E.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}=Yp(),{activateOnFocus:h,highlightedTabIndex:p,onTabActivation:m,setHighlightedTabIndex:g,tabsListElement:y}=bP(),b=bs(a),w=E.useMemo(()=>({disabled:o,id:b,value:i}),[o,b,i]),{compositeProps:k,compositeRef:v,index:x}=yP({metadata:w}),S=i===u,T=E.useRef(!1);ge(()=>{if(T.current){T.current=!1;return}if(!(S&&x>-1&&p!==x))return;const U=y;if(U!=null){const z=Wn(Je(U));if(z&&He(U,z))return}o||g(x)},[S,x,p,g,o,y]);const{getButtonProps:I,buttonRef:L}=ws({disabled:o,native:l,focusableWhenDisabled:!0}),N=d(i),P=E.useRef(!1),A=E.useRef(!1);function j(U){S||o||m(i,Fe(yo,U.nativeEvent,void 0,{activationDirection:"none"}))}function K(U){S||(x>-1&&!o&&g(x),!o&&h&&(!P.current||P.current&&A.current)&&m(i,Fe(yo,U.nativeEvent,void 0,{activationDirection:"none"})))}function J(U){if(S||o)return;P.current=!0;function z(){P.current=!1,A.current=!1}(!U.button||U.button===0)&&(A.current=!0,Je(U.currentTarget).addEventListener("pointerup",z,{once:!0}))}return ot("button",e,{state:{disabled:o,active:S,orientation:f},ref:[n,L,v],props:[k,{role:"tab","aria-controls":N,"aria-selected":S,id:b,onClick:j,onFocus:K,onPointerDown:J,[Nx]:S?"":void 0,onKeyDownCapture(){T.current=!0}},c,I]})}),wP=E.createContext(void 0),kP={disableStyleElements:!1};function xP(){return E.useContext(wP)??kP}let SP=(function(t){return t.index="data-index",t.activationDirection="data-activation-direction",t.orientation="data-orientation",t.hidden="data-hidden",t})({});const EP={...Gp,...Ai},CP=E.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}=Yp(),p=bs(),m=E.useMemo(()=>({id:p,value:o}),[p,o]),{ref:g,index:y}=Zp({metadata:m}),b=o===l,{mounted:w,transitionStatus:k,setMounted:v}=Ua(b),x=!w,S=c(o),T={hidden:x,orientation:u,tabActivationDirection:d,transitionStatus:k},I=E.useRef(null),L=ot("div",e,{state:T,ref:[n,g,I],props:[{"aria-labelledby":S,hidden:x,id:p,role:"tabpanel",tabIndex:b?0:-1,inert:dd(!b),[SP.index]:y},a],stateAttributesMapping:EP});return To({open:b,ref:I,onComplete(){b||v(!1)}}),ge(()=>{if(!(x&&!i)&&p!=null)return f(o,p),()=>{h(o,p)}},[x,i,o,p,f,h]),i||w?L:null});function TP(t){return t==null||t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true"}const ni="ArrowUp",Uo="ArrowDown",Ra="ArrowLeft",ri="ArrowRight",Ka="Home",Ya="End",Ax=new Set([Ra,ri]),MP=new Set([Ra,ri,Ka,Ya]),Ix=new Set([ni,Uo]),RP=new Set([ni,Uo,Ka,Ya]),$x=new Set([...Ax,...Ix]),OP=new Set([...$x,Ka,Ya]),Jp=new Set([ni,Uo,Ra,ri,Ka,Ya]),NP="Shift",_P="Control",PP="Alt",AP="Meta",IP=new Set([NP,_P,PP,AP]);function $P(t){return yt(t)&&t.tagName==="INPUT"}function Sy(t){return!!($P(t)&&t.selectionStart!=null||yt(t)&&t.tagName==="TEXTAREA")}function Ey(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=Cy(t,e,"left"),c=bl(t),u=bl(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=Cy(t,e,"top"),c=bl(t),u=bl(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 Cy(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 bl(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 DP=[];function zP(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=DP}=t,[p,m]=E.useState(0),g=n>1,y=E.useRef(null),b=jr(y,c),w=E.useRef([]),k=E.useRef(!1),v=a??p,x=pe((I,L=!1)=>{if((l??m)(I),L){const N=w.current[I];Ey(y.current,N,i,s)}}),S=pe(I=>{if(I.size===0||k.current)return;k.current=!0;const L=Array.from(I.keys()),N=L.find(A=>A?.hasAttribute(Nx))??null,P=N?L.indexOf(N):-1;P!==-1&&x(P),Ey(y.current,N,i,s)}),T=E.useMemo(()=>({"aria-orientation":s==="both"?void 0:s,ref:b,onFocus(I){!y.current||!Sy(I.target)||I.target.setSelectionRange(0,I.target.value.length??0)},onKeyDown(I){const L=u?OP:$x;if(!L.has(I.key)||LP(I,h)||!y.current)return;const P=i==="rtl",A=P?Ra:ri,j={horizontal:A,vertical:Uo,both:A}[s],K=P?ri:Ra,J={horizontal:K,vertical:ni,both:K}[s];if(Sy(I.target)&&!TP(I.target)){const V=I.target.selectionStart,R=I.target.selectionEnd,D=I.target.value??"";if(V==null||I.shiftKey||V!==R||I.key!==J&&V<D.length||I.key!==j&&V>0)return}let Y=v;const G=Tc(w,f),U=uh(w,f);if(g){const V=e||Array.from({length:w.current.length},()=>({width:1,height:1})),R=qw(V,n,o),D=R.findIndex(Z=>Z!=null&&!co(w,Z,f)),$=R.reduce((Z,Q,_)=>Q!=null&&!co(w,Q,f)?_:Z,-1);Y=R[Ww({current:R.map(Z=>Z?w.current[Z]:null)},{event:I,orientation:s,loopFocus:r,cols:n,disabledIndices:Kw([...f||w.current.map((Z,Q)=>co(w,Q)?Q:void 0),void 0],R),minIndex:D,maxIndex:$,prevIndex:Uw(v>U?G:v,V,R,n,I.key===Uo?"bl":I.key===ri?"tr":"tl"),rtl:P})]}const z={horizontal:[A],vertical:[Uo],both:[A,Uo]}[s],B={horizontal:[K],vertical:[ni],both:[K,ni]}[s],H=g?L:{horizontal:u?MP:Ax,vertical:u?RP:Ix,both:L}[s];u&&(I.key===Ka?Y=G:I.key===Ya&&(Y=U)),Y===v&&(z.includes(I.key)||B.includes(I.key))&&(r&&Y===U&&z.includes(I.key)?Y=G:r&&Y===G&&B.includes(I.key)?Y=U:Y=Ut(w,{startingIndex:Y,decrement:B.includes(I.key),disabledIndices:f})),Y!==v&&!Zs(w,Y)&&(d&&I.stopPropagation(),H.has(I.key)&&I.preventDefault(),x(Y,!0),queueMicrotask(()=>{w.current[Y]?.focus()}))}}),[n,o,i,f,w,u,v,g,e,r,b,h,x,s,d]);return E.useMemo(()=>({props:T,highlightedIndex:v,onHighlightedIndexChange:x,elementsRef:w,disabledIndices:f,onMapChange:S,relayKeyboardEvent:T.onKeyDown}),[T,v,x,w,f,S])}function LP(t,e){for(const n of IP.values())if(!e.includes(n)&&t.getModifierState(n))return!0;return!1}function jP(t){const{render:e,className:n,refs:r=Sa,props:o=Sa,state:s=$t,stateAttributesMapping:i,highlightedIndex:a,onHighlightedIndexChange:l,orientation:c,dense:u,itemSizes:d,loopFocus:f,cols:h,enableHomeAndEndKeys:p,onMapChange:m,stopEventPropagation:g=!0,rootRef:y,disabledIndices:b,modifierKeys:w,highlightItemOnHover:k=!1,tag:v="div",...x}=t,S=Ap(),{props:T,highlightedIndex:I,onHighlightedIndexChange:L,elementsRef:N,onMapChange:P,relayKeyboardEvent:A}=zP({itemSizes:d,cols:h,loopFocus:f,dense:u,orientation:c,highlightedIndex:a,onHighlightedIndexChange:l,rootRef:y,stopEventPropagation:g,enableHomeAndEndKeys:p,direction:S,disabledIndices:b,modifierKeys:w}),j=ot(v,t,{state:s,ref:r,props:[T,...o,x],stateAttributesMapping:i}),K=E.useMemo(()=>({highlightedIndex:I,onHighlightedIndexChange:L,highlightItemOnHover:k,relayKeyboardEvent:A}),[I,L,k,A]);return M.jsx(cx.Provider,{value:K,children:M.jsx(Kp,{elementsRef:N,onMapChange:J=>{m?.(J),P(J)},children:j})})}const FP=E.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}=Yp(),[p,m]=E.useState(0),[g,y]=E.useState(null),b=BP(d,u,g,l),w=pe((S,T)=>{if(S!==d){const I=b(S);T.activationDirection=I,c(S,T)}}),k={orientation:u,tabActivationDirection:h},v={"aria-orientation":u==="vertical"?"vertical":void 0,role:"tablist"},x=E.useMemo(()=>({activateOnFocus:r,highlightedTabIndex:p,onTabActivation:w,setHighlightedTabIndex:m,tabsListElement:g,value:d}),[r,p,w,m,g,d]);return M.jsx(Px.Provider,{value:x,children:M.jsx(jP,{render:i,className:o,state:k,refs:[n,y],props:[v,a],stateAttributesMapping:Gp,highlightedIndex:p,enableHomeAndEndKeys:!0,loopFocus:s,orientation:u,onHighlightedIndexChange:m,onMapChange:f,disabledIndices:Sa})})});function Ty(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 BP(t,e,n,r){const[o,s]=E.useState(null);return ge(()=>{if(t==null||n==null){s(null);return}const i=r(t);if(i==null){s(null);return}const{left:a,top:l}=Ty(i,n);s(e==="horizontal"?a:l)},[e,r,n,t]),E.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}=Ty(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 Dx(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(gP,{"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 VP=Lp("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 zx(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(VP({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(FP,{"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 qc(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-foreground/60 hover:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:text-muted-foreground dark:hover:text-foreground 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 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 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:bg-foreground after:absolute 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(vP,{"data-slot":"tabs-trigger",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function My(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(CP,{"data-slot":"tabs-content",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}let Ry={},Oy={},Ny="";function HP(t){if(typeof document>"u")return!1;const e=Je(t);return Rt(e).innerWidth-e.documentElement.clientWidth>0}function WP(t){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=Je(t),r=n.documentElement,o=n.body,s=So(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 qP(t){const e=Je(t),n=e.documentElement,r=e.body,o=So(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 UP(t){const e=Je(t),n=e.documentElement,r=e.body,o=Rt(n);let s=0,i=0,a=!1;const l=sr.create();if(mp&&(o.visualViewport?.scale??1)!==1)return()=>{};function c(){const f=o.getComputedStyle(n),h=o.getComputedStyle(r),g=(f.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,Ry={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Ny=n.style.scrollBehavior,Oy={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),S=parseFloat(h.marginTop)+parseFloat(h.marginBottom),T=parseFloat(h.marginLeft)+parseFloat(h.marginRight),I=So(n)?n:r;if(a=WP(t),a){n.style.scrollbarGutter=g,I.style.overflowY="hidden",I.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:g,overflowY:"hidden",overflowX:"hidden"}),(y||w)&&(n.style.overflowY="scroll"),(b||k)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:S||x?`calc(100dvh - ${S+x}px)`:"100dvh",width:T||v?`calc(100vw - ${T+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,Ry),Object.assign(r.style,Oy),a||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Ny)}function d(){u(),l.request(c)}return c(),o.addEventListener("resize",d),()=>{l.cancel(),u(),typeof o.removeEventListener=="function"&&o.removeEventListener("resize",d)}}class KP{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=Je(e).documentElement,o=Rt(r).getComputedStyle(r).overflowY;if(o==="hidden"||o==="clip"){this.restore=pn;return}const s=$w||!HP(e);this.restore=s?qP(e):UP(e)}}const YP=new KP;function Xp(t=!0,e=null){ge(()=>{if(t)return YP.acquire(e)},[t,e])}function GP(t){const e=E.useRef(""),n=E.useCallback(o=>{o.defaultPrevented||(e.current=o.pointerType,t(o,o.pointerType))},[t]);return{onClick:E.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 Qp(t){const[e,n]=E.useState(null),r=pe((a,l)=>{t||n(l||($w?"touch":""))}),o=E.useCallback(()=>{n(null)},[]),{onClick:s,onPointerDown:i}=GP(r);return E.useMemo(()=>({openMethod:e,reset:o,triggerProps:{onClick:s,onPointerDown:i}}),[e,o,s,i])}function ZP(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}=Qp(o);Pk(e);const{forceUnmount:d}=Ak(o,e,()=>{u()}),f=pe(L=>{const N=Fe(L);return N.preventUnmountOnClose=()=>{e.set("preventUnmountingOnClose",!0)},N}),h=E.useCallback(()=>{e.setOpen(!1,f(ck))},[e,f]);E.useImperativeHandle(r,()=>({unmount:d,close:h}),[d,h]);const p=zk({popupStore:e,onOpenChange:e.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[m,g]=E.useState(0),y=m===0,b=jk(p),w=Rp(p,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(L){if(!e.context.outsidePressEnabledRef.current||"button"in L&&L.button!==0||"touches"in L&&L.touches.length!==1)return!1;const N=xn(L);if(y&&!s){const P=N;return i&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===P||e.context.backdropRef.current===P||He(P,a)&&!P?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:y});Xp(o&&i===!0,a);const{getReferenceProps:k,getFloatingProps:v,getTriggerProps:x}=ld([b,w]);e.useContextCallback("onNestedDialogOpen",L=>{g(L+1)}),e.useContextCallback("onNestedDialogClose",()=>{g(0)}),E.useEffect(()=>(n?.onNestedDialogOpen&&o&&n.onNestedDialogOpen(m),n?.onNestedDialogClose&&!o&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&o&&n.onNestedDialogClose()}),[o,n,m]);const S=E.useMemo(()=>k(c),[k,c]),T=E.useMemo(()=>x(c),[x,c]),I=E.useMemo(()=>v(),[v]);e.useSyncedValues({openMethod:l,activeTriggerProps:S,inactiveTriggerProps:T,popupProps:I,floatingRootContext:p,nestedOpenDialogCount:m})}const Lx=E.createContext(void 0);function Ss(t){return E.useContext(Lx)}const JP={...$k,modal:be(t=>t.modal),nested:be(t=>t.nested),nestedOpenDialogCount:be(t=>t.nestedOpenDialogCount),disablePointerDismissal:be(t=>t.disablePointerDismissal),openMethod:be(t=>t.openMethod),descriptionElementId:be(t=>t.descriptionElementId),titleElementId:be(t=>t.titleElementId),viewportElement:be(t=>t.viewportElement),role:be(t=>t.role)};class XP extends Np{constructor(e){super(QP(e),{popupRef:E.createRef(),backdropRef:E.createRef(),internalBackdropRef:E.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new ad,onOpenChange:void 0,onOpenChangeComplete:void 0},JP)}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 QP(t={}){return{...Ik(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...t}}function eA(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=ln(()=>a?.store??new XP({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");ZP({store:f,actionsRef:i,parentContext:u?.store.context});const p=E.useMemo(()=>({store:f}),[f]);return M.jsx(Lx.Provider,{value:p,children:typeof e=="function"?e({payload:h}):e})}const tA={...Ii,...Ai},nA=E.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 ot("div",e,{state:{open:l,transitionStatus:d},ref:[a.context.backdropRef,n],stateAttributesMapping:tA,props:[{role:"presentation",hidden:!u,style:{userSelect:"none",WebkitUserSelect:"none"}},i],enabled:s||!c})}),rA=E.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,Fe(TM,p.nativeEvent))}const{getButtonProps:d,buttonRef:f}=ws({disabled:s,native:i});return ot("button",e,{state:{disabled:s},ref:[n,f],props:[{onClick:u},a,d]})}),oA=E.forwardRef(function(e,n){const{render:r,className:o,id:s,...i}=e,{store:a}=Ss(),l=bs(s);return a.useSyncedValueWithCleanup("descriptionElementId",l),ot("p",e,{ref:n,props:[{id:l},i]})});let sA=(function(t){return t.nestedDialogs="--nested-dialogs",t})({}),iA=(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 jx=E.createContext(void 0);function aA(){const t=E.useContext(jx);if(t===void 0)throw new Error(en(26));return t}const lA={...Ii,...Ai,nestedDialogOpen(t){return t?{[iA.nestedDialogOpen]:""}:null}},cA=E.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"),m=l.useState("nested"),g=l.useState("nestedOpenDialogCount"),y=l.useState("open"),b=l.useState("openMethod"),w=l.useState("titleElementId"),k=l.useState("transitionStatus"),v=l.useState("role");aA(),To({open:y,ref:l.context.popupRef,onComplete(){y&&l.context.onOpenChangeComplete?.(!0)}});function x(N){return N==="touch"?l.context.popupRef.current:!0}const S=s===void 0?x:s,T=g>0,L=ot("div",e,{state:{open:y,nested:m,transitionStatus:k,nestedDialogOpen:T},props:[f,{"aria-labelledby":w??void 0,"aria-describedby":c??void 0,role:v,tabIndex:-1,hidden:!p,onKeyDown(N){Jp.has(N.key)&&N.stopPropagation()},style:{[sA.nestedDialogs]:g}},a],ref:[n,l.context.popupRef,l.useStateSetter("popupElement")],stateAttributesMapping:lA});return M.jsx(Tp,{context:d,openInteractionType:b,disabled:!p,closeOnFocusOut:!u,initialFocus:S,returnFocus:o,modal:h!==!1,restoreFocus:"popup",children:L})}),em=E.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}})}),uA=E.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(jx.Provider,{value:r,children:M.jsxs(Ep,{ref:n,...o,children:[i&&a===!0&&M.jsx(em,{ref:s.context.internalBackdropRef,inert:dd(!l)}),e.children]})}):null}),dA=E.forwardRef(function(e,n){const{render:r,className:o,id:s,...i}=e,{store:a}=Ss(),l=bs(s);return a.useSyncedValueWithCleanup("titleElementId",l),ot("h2",e,{ref:n,props:[{id:l},i]})});function fA(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(eA,{"data-slot":"alert-dialog",...n}),e[2]=n,e[3]=r):r=e[3],r}function hA(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(uA,{"data-slot":"alert-dialog-portal",...n}),e[2]=n,e[3]=r):r=e[3],r}function pA(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("data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs",n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=M.jsx(nA,{"data-slot":"alert-dialog-overlay",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function mA(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(pA,{}),e[4]=i):i=e[4];let a;e[5]!==n?(a=ue("group/alert-dialog-content bg-background ring-foreground/10 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 fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl p-4 ring-1 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm",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(hA,{children:[i,M.jsx(cA,{"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 gA(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 yA(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("bg-muted/50 -mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t 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 bA(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(dA,{"data-slot":"alert-dialog-title",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function vA(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-muted-foreground *:[a]:hover:text-foreground text-sm text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3",n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=M.jsx(oA,{"data-slot":"alert-dialog-description",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function wA(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(yn,{"data-slot":"alert-dialog-action",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function kA(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(yn,{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(rA,{"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 xA(t){return ot(t.defaultTagName??"div",t,t)}const SA=Lp("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 Uc(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=xA,r="span",o=Pi({className:ue(SA({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 Fx=E.createContext(null),Bx=E.createContext(null);function mr(){const t=E.useContext(Fx);if(t===null)throw new Error(en(60));return t}function Vx(){const t=E.useContext(Bx);if(t===null)throw new Error(en(61));return t}let _y=(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 EA={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},tm={valid(t){return t===null?null:t?{[_y.valid]:""}:{[_y.invalid]:""}}},CA=E.createContext({invalid:void 0,name:void 0,validityData:{state:EA,errors:[],error:"",value:"",initialValue:null},setValidityData:pn,disabled:void 0,touched:!1,setTouched:pn,dirty:!1,setDirty:pn,filled:!1,setFilled:pn,focused:!1,setFocused:pn,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=$t)=>t,getInputValidationProps:(t=$t)=>t,inputRef:{current:null},commit:async()=>{}}});function $i(t=!0){const e=E.useContext(CA);if(e.setValidityData===pn&&!t)throw new Error(en(28));return e}const TA=E.createContext({controlId:void 0,registerControlId:pn,labelId:void 0,setLabelId:pn,messageIds:[],setMessageIds:pn,getDescriptionProps:t=>t});function fd(){return E.useContext(TA)}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=ln(()=>Symbol("labelable-control")),c=E.useRef(!1),u=E.useRef(e!=null),d=pe(()=>{!c.current||s===pn||(c.current=!1,s(l.current,void 0))});return ge(()=>{if(s===pn)return;let f;if(n){const h=r?.current;tt(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]),E.useEffect(()=>d,[d]),o??i}const MA=(t,e)=>Object.is(t,e);function yi(t,e,n){return t==null||e==null?Object.is(t,e):n(t,e)}function RA(t,e,n){return!t||t.length===0?!1:t.some(r=>r===void 0?!1:yi(e,r,n))}function ua(t,e,n){return!t||t.length===0?-1:t.findIndex(r=>r===void 0?!1:yi(r,e,n))}function OA(t,e,n){return t.filter(r=>!yi(e,r,n))}function kh(t){if(t==null)return"";if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}function Hx(t){return t!=null&&t.length>0&&typeof t[0]=="object"&&t[0]!=null&&"items"in t[0]}function NA(t){if(!Array.isArray(t))return t!=null&&!("null"in t);if(Hx(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 _A(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 kh(t)}function Fs(t,e){return e&&t!=null?e(t)??"":t&&typeof t=="object"&&"value"in t&&"label"in t?kh(t.value):kh(t)}function Wx(t,e,n){function r(){return _A(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=Hx(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 PA(t,e,n){return t.reduce((r,o,s)=>(s>0&&r.push(", "),r.push(M.jsx(E.Fragment,{children:Wx(o,e,n)},s)),r),[])}const Re={id:be(t=>t.id),modal:be(t=>t.modal),multiple:be(t=>t.multiple),items:be(t=>t.items),itemToStringLabel:be(t=>t.itemToStringLabel),itemToStringValue:be(t=>t.itemToStringValue),isItemEqualToValue:be(t=>t.isItemEqualToValue),value:be(t=>t.value),hasSelectedValue:be(t=>{const{value:e,multiple:n,itemToStringValue:r}=t;return e==null?!1:n&&Array.isArray(e)?e.length>0:Fs(e,r)!==""}),hasNullItemLabel:be((t,e)=>e?NA(t.items):!1),open:be(t=>t.open),mounted:be(t=>t.mounted),forceMount:be(t=>t.forceMount),transitionStatus:be(t=>t.transitionStatus),openMethod:be(t=>t.openMethod),activeIndex:be(t=>t.activeIndex),selectedIndex:be(t=>t.selectedIndex),isActive:be((t,e)=>t.activeIndex===e),isSelected:be((t,e,n)=>{const r=t.isItemEqualToValue,o=t.value;return t.multiple?Array.isArray(o)&&o.some(s=>yi(n,s,r)):t.selectedIndex===e&&t.selectedIndex!==null?!0:yi(n,o,r)}),isSelectedByFocus:be((t,e)=>t.selectedIndex===e),popupProps:be(t=>t.popupProps),triggerProps:be(t=>t.triggerProps),triggerElement:be(t=>t.triggerElement),positionerElement:be(t=>t.positionerElement),listElement:be(t=>t.listElement),scrollUpArrowVisible:be(t=>t.scrollUpArrowVisible),scrollDownArrowVisible:be(t=>t.scrollDownArrowVisible),hasScrollArrows:be(t=>t.hasScrollArrows)},AA=E.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:pn,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function nm(){return E.useContext(AA)}function IA(t,e){return{...t,state:{...t.state,valid:!e&&t.state.valid}}}function rm(t){const{enabled:e=!0,value:n,id:r,name:o,controlRef:s,commit:i}=t,{formRef:a}=nm(),{invalid:l,markedDirtyRef:c,validityData:u,setValidityData:d}=$i(),f=pe(t.getValue);ge(()=>{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]),ge(()=>{!e||!r||a.current.fields.set(r,{getValue:f,name:o,controlRef:s,validityData:IA(u,l),validate(h=!0){let p=n;p===void 0&&(p=f()),c.current=!0,h?cr.flushSync(()=>i(p)):i(p)}})},[i,s,e,a,f,r,l,c,o,u,n]),ge(()=>{const h=a.current.fields;return()=>{r&&h.delete(r)}},[a,r])}function qx(t,e){const n=E.useRef(t),r=pe(e);ge(()=>{n.current!==t&&r(n.current)},[t,r]),ge(()=>{n.current=t},[t])}function $A(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:m,onOpenChangeComplete:g,items:y,multiple:b=!1,itemToStringLabel:w,itemToStringValue:k,isItemEqualToValue:v=MA,highlightItemOnHover:x=!0,children:S}=t,{clearErrors:T}=nm(),{setDirty:I,setTouched:L,setFocused:N,shouldValidateOnChange:P,validityData:A,setFilled:j,name:K,disabled:J,validation:Y,validationMode:G}=$i(),U=hd({id:e}),z=J||u,B=K??l,[H,V]=Ma({controlled:n,default:b?r??Sa:r,name:"Select",state:"value"}),[R,D]=Ma({controlled:s,default:i,name:"Select",state:"open"}),$=E.useRef([]),Z=E.useRef([]),Q=E.useRef(null),_=E.useRef(null),q=E.useRef(0),C=E.useRef(null),O=E.useRef([]),F=E.useRef(!1),W=E.useRef(!1),X=E.useRef(null),ee=E.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),ne=E.useRef(!1),{mounted:oe,setMounted:re,transitionStatus:ae}=Ua(R),{openMethod:te,triggerProps:fe,reset:ye}=Qp(R),he=ln(()=>new Nk({id:U,modal:h,multiple:b,itemToStringLabel:w,itemToStringValue:k,isItemEqualToValue:v,value:H,open:R,mounted:oe,transitionStatus:ae,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,qe=Oe(he,Re.activeIndex),Ye=Oe(he,Re.selectedIndex),st=Oe(he,Re.triggerElement),Ae=Oe(he,Re.positionerElement),_e=E.useMemo(()=>b&&Array.isArray(H)&&H.length===0?"":Fs(H,k),[b,H,k]),Ue=E.useMemo(()=>b&&Array.isArray(H)?H.map(ze=>Fs(ze,k)):Fs(H,k),[b,H,k]),Ke=Ft(he.state.triggerElement);rm({id:U,commit:Y.commit,value:H,controlRef:Ke,name:B,getValue:()=>Ue});const zt=E.useRef(H);ge(()=>{H!==zt.current&&he.set("forceMount",!0)},[he,H]),ge(()=>{j(b?Array.isArray(H)&&H.length>0:H!=null)},[b,H,j]),ge(function(){if(R)return;const ft=O.current;if(b){const fn=Array.isArray(H)?H:[];if(fn.length===0){he.set("selectedIndex",null);return}const At=fn[fn.length-1],Ns=ua(ft,At,v);he.set("selectedIndex",Ns===-1?null:Ns);return}const dn=ua(ft,H,v);he.set("selectedIndex",dn===-1?null:dn)},[b,R,H,O,v,he]),qx(H,()=>{T(B),I(H!==A.initialValue),P()?Y.commit(H):Y.commit(H,!0)});const Ht=pe((ze,ft)=>{if(a?.(ze,ft),!ft.isCanceled&&(D(ze),!ze&&(ft.reason===is||ft.reason===xp)&&(L(!0),N(!1),G==="onBlur"&&Y.commit(H)),!ze&&he.state.activeIndex!==null)){const dn=$.current[he.state.activeIndex];queueMicrotask(()=>{dn?.setAttribute("tabindex","-1")})}}),Lt=pe(()=>{re(!1),he.set("activeIndex",null),ye(),g?.(!1)});To({enabled:!p,open:R,ref:Q,onComplete(){R||Lt()}}),E.useImperativeHandle(p,()=>({unmount:Lt}),[Lt]);const Pt=pe((ze,ft)=>{o?.(ze,ft),!ft.isCanceled&&V(ze)}),wt=pe(()=>{const ze=he.state.listElement||Q.current;if(!ze)return;const ft=ze.scrollTop,dn=ze.scrollTop+ze.clientHeight,fn=ft>1,At=dn<ze.scrollHeight-1;he.state.scrollUpArrowVisible!==fn&&he.set("scrollUpArrowVisible",fn),he.state.scrollDownArrowVisible!==At&&he.set("scrollDownArrowVisible",At)}),De=Dk({open:R,onOpenChange:Ht,elements:{reference:st,floating:Ae}}),Se=vk(De,{enabled:!d&&!z,event:"mousedown"}),ce=Rp(De,{bubbles:!1}),ve=MO(De,{enabled:!d&&!z,listRef:$,activeIndex:qe,selectedIndex:Ye,disabledIndices:Sa,onNavigate(ze){ze===null&&!R||he.set("activeIndex",ze)},focusItemOnHover:!1}),xe=OO(De,{enabled:!d&&!z&&(R||!b),listRef:Z,activeIndex:qe,selectedIndex:Ye,onMatch(ze){R?he.set("activeIndex",ze):Pt(O.current[ze],Fe("none"))},onTypingChange(ze){F.current=ze}}),{getReferenceProps:Ie,getFloatingProps:dt,getItemProps:$e}=ld([Se,ce,ve,xe]),Xn=E.useMemo(()=>Pi(Ie(),fe,U?{id:U}:$t),[Ie,fe,U]);_w(()=>{he.update({popupProps:dt(),triggerProps:Xn})}),ge(()=>{he.update({id:U,modal:h,multiple:b,value:H,open:R,mounted:oe,transitionStatus:ae,popupProps:dt(),triggerProps:Xn,items:y,itemToStringLabel:w,itemToStringValue:k,isItemEqualToValue:v,openMethod:te})},[he,U,h,b,H,R,oe,ae,dt,Xn,y,w,k,v,te]);const Vr=E.useMemo(()=>({store:he,name:B,required:f,disabled:z,readOnly:d,multiple:b,itemToStringLabel:w,itemToStringValue:k,highlightItemOnHover:x,setValue:Pt,setOpen:Ht,listRef:$,popupRef:Q,scrollHandlerRef:_,handleScrollArrowVisibility:wt,scrollArrowsMountedCountRef:q,getItemProps:$e,events:De.context.events,valueRef:C,valuesRef:O,labelsRef:Z,typingRef:F,selectionRef:ee,selectedItemTextRef:X,validation:Y,onOpenChangeComplete:g,keyboardActiveRef:W,alignItemWithTriggerActiveRef:ne,initialValueRef:zt}),[he,B,f,z,d,b,w,k,x,Pt,Ht,$e,De.context.events,Y,g,wt]),Hr=jr(m,Y.inputRef),vr=b&&Array.isArray(H)&&H.length>0,wr=E.useMemo(()=>!b||!Array.isArray(H)||!B?null:H.map(ze=>{const ft=Fs(ze,k);return M.jsx("input",{type:"hidden",name:B,value:ft},ft)}),[b,H,B,k]);return M.jsx(Fx.Provider,{value:Vr,children:M.jsxs(Bx.Provider,{value:De,children:[S,M.jsx("input",{...Y.getInputValidationProps({onFocus(){he.state.triggerElement?.focus({focusVisible:!0})},onChange(ze){if(ze.nativeEvent.defaultPrevented)return;const ft=ze.target.value,dn=Fe(yo,ze.nativeEvent);function fn(){if(b)return;const At=O.current.find(Ns=>Fs(Ns,k).toLowerCase()===ft.toLowerCase());At!=null&&(I(At!==A.initialValue),Pt(At,dn),P()&&Y.commit(At))}he.set("forceMount",!0),queueMicrotask(fn)}}),name:b?void 0:B,autoComplete:c,value:_e,disabled:z,required:f&&!vr,readOnly:d,ref:Hr,style:B?hk:od,tabIndex:-1,"aria-hidden":!0}),wr]})})}function DA(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 vl=2,zA=400,Py=200,LA={...Bk,...tm,value:()=>null},jA=E.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}=$i(),{labelId:p}=fd(),{store:m,setOpen:g,selectionRef:y,validation:b,readOnly:w,required:k,alignItemWithTriggerActiveRef:v,disabled:x,keyboardActiveRef:S}=mr(),T=h||x||i,I=Oe(m,Re.open),L=Oe(m,Re.value),N=Oe(m,Re.triggerProps),P=Oe(m,Re.positionerElement),A=Oe(m,Re.listElement),j=Oe(m,Re.id),K=Oe(m,Re.hasSelectedValue),J=!K&&I,Y=Oe(m,Re.hasNullItemLabel,J),G=s??j;hd({id:G});const U=Ft(P),z=E.useRef(null),{getButtonProps:B,buttonRef:H}=ws({disabled:T,native:a}),V=pe(O=>{m.set("triggerElement",O)}),R=jr(n,z,H,V),D=Tn(),$=Tn(),Z=Tn(),Q=Tn();E.useEffect(()=>{if(I)return!(K||Y)?Z.start(zA,()=>{y.current.allowUnselectedMouseUp=!0,y.current.allowSelectedMouseUp=!0}):Q.start(Py,()=>{y.current.allowUnselectedMouseUp=!0,Z.start(Py,()=>{y.current.allowSelectedMouseUp=!0})}),()=>{Z.clear(),Q.clear()};y.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},$.clear()},[I,K,Y,y,$,Z,Q]);const _=E.useMemo(()=>A?.id??xa(P)?.id,[A,P]),q=Pi(N,{id:G,role:"combobox","aria-expanded":I?"true":"false","aria-haspopup":"listbox","aria-controls":I?_:void 0,"aria-labelledby":p,"aria-readonly":w||void 0,"aria-required":k||void 0,tabIndex:T?-1:0,ref:R,onFocus(O){u(!0),I&&v.current&&g(!1,Fe(yo,O.nativeEvent)),D.start(0,()=>{m.set("forceMount",!0)})},onBlur(O){He(P,O.relatedTarget)||(c(!0),u(!1),d==="onBlur"&&b.commit(L))},onPointerMove(){S.current=!1},onKeyDown(){S.current=!0},onMouseDown(O){if(I)return;const F=Je(O.currentTarget);function W(X){if(!z.current)return;const ee=X.target;if(He(z.current,ee)||He(U.current,ee)||ee===z.current)return;const ne=DA(z.current);X.clientX>=ne.left-vl&&X.clientX<=ne.right+vl&&X.clientY>=ne.top-vl&&X.clientY<=ne.bottom+vl||g(!1,Fe(MM,X))}$.start(0,()=>{F.addEventListener("mouseup",W,{once:!0})})}},b.getValidationProps,l,B);q.role="combobox";const C={...f,open:I,disabled:T,value:L,readOnly:w,placeholder:!K};return ot("button",e,{ref:[n,z],state:C,stateAttributesMapping:LA,props:q})}),FA={value:()=>null},BA=E.forwardRef(function(e,n){const{className:r,render:o,children:s,placeholder:i,...a}=e,{store:l,valueRef:c}=mr(),u=Oe(l,Re.value),d=Oe(l,Re.items),f=Oe(l,Re.itemToStringLabel),h=Oe(l,Re.hasSelectedValue),p=!h&&i!=null&&s==null,m=Oe(l,Re.hasNullItemLabel,p),g={value:u,placeholder:!h};let y=null;return typeof s=="function"?y=s(u):s!=null?y=s:!h&&i!=null&&!m?y=i:Array.isArray(u)?y=PA(u,d,f):y=Wx(u,d,f),ot("span",e,{state:g,ref:[n,c],props:[{children:y},a],stateAttributesMapping:FA})}),VA=E.forwardRef(function(e,n){const{className:r,render:o,...s}=e,{store:i}=mr(),l={open:Oe(i,Re.open)};return ot("span",e,{state:l,ref:n,props:[{"aria-hidden":!0,children:"▼"},s],stateAttributesMapping:Fk})}),HA=E.createContext(void 0),WA=E.forwardRef(function(e,n){const{store:r}=mr(),o=Oe(r,Re.mounted),s=Oe(r,Re.forceMount);return o||s?M.jsx(HA.Provider,{value:!0,children:M.jsx(Ep,{ref:n,...e})}):null}),Ux=E.createContext(void 0);function om(){const t=E.useContext(Ux);if(!t)throw new Error(en(59));return t}function Kc(t,e){t&&Object.assign(t.style,e)}const Kx={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},qA={position:"fixed"},UA=E.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:m,alignItemWithTrigger:g=!0,collisionAvoidance:y=SM,...b}=e,{store:w,listRef:k,labelsRef:v,alignItemWithTriggerActiveRef:x,selectedItemTextRef:S,valuesRef:T,initialValueRef:I,popupRef:L,setValue:N}=mr(),P=Vx(),A=Oe(w,Re.open),j=Oe(w,Re.mounted),K=Oe(w,Re.modal),J=Oe(w,Re.value),Y=Oe(w,Re.openMethod),G=Oe(w,Re.positionerElement),U=Oe(w,Re.triggerElement),z=Oe(w,Re.isItemEqualToValue),B=Oe(w,Re.transitionStatus),H=E.useRef(null),V=E.useRef(null),[R,D]=E.useState(g),$=j&&R&&Y!=="touch";!j&&R!==g&&D(g),ge(()=>{j||(Re.scrollUpArrowVisible(w.state)&&w.set("scrollUpArrowVisible",!1),Re.scrollDownArrowVisible(w.state)&&w.set("scrollDownArrowVisible",!1))},[w,j]),E.useImperativeHandle(x,()=>$),Xp(($||K)&&A&&Y!=="touch",U);const Z=Hk({anchor:r,floatingRootContext:P,positionMethod:o,mounted:j,side:a,sideOffset:c,align:l,alignOffset:u,arrowPadding:h,collisionBoundary:d,collisionPadding:f,sticky:p,disableAnchorTracking:m??$,collisionAvoidance:y,keepMounted:!0}),Q=$?"none":Z.side,_=$?qA:Z.positionerStyles,q=E.useMemo(()=>{const ne={};return A||(ne.pointerEvents="none"),{role:"presentation",hidden:!j,style:{..._,...ne}}},[A,j,_]),C={open:A,side:Q,align:Z.align,anchorHidden:Z.anchorHidden},O=pe(ne=>{w.set("positionerElement",ne)}),F=ot("div",e,{ref:[n,O],state:C,stateAttributesMapping:Ii,props:[q,ud(B),b]}),W=E.useRef(0),X=pe(ne=>{if(ne.size===0&&W.current===0||T.current.length===0)return;const oe=W.current;if(W.current=ne.size,ne.size===oe)return;const re=Fe(yo);if(oe!==0&&!w.state.multiple&&J!==null&&ua(T.current,J,z)===-1){const te=I.current,ye=te!=null&&ua(T.current,te,z)!==-1?te:null;N(ye,re),ye===null&&(w.set("selectedIndex",null),S.current=null)}if(oe!==0&&w.state.multiple&&Array.isArray(J)){const ae=fe=>ua(T.current,fe,z)!==-1,te=J.filter(fe=>ae(fe));(te.length!==J.length||te.some(fe=>!RA(J,fe,z)))&&(N(te,re),te.length===0&&(w.set("selectedIndex",null),S.current=null))}if(A&&$){w.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ae={height:""};Kc(G,ae),Kc(L.current,ae)}}),ee=E.useMemo(()=>({...Z,side:Q,alignItemWithTriggerActive:$,setControlledAlignItemWithTrigger:D,scrollUpArrowRef:H,scrollDownArrowRef:V}),[Z,Q,$,D]);return M.jsx(Kp,{elementsRef:k,labelsRef:v,onMapChange:X,children:M.jsxs(Ux.Provider,{value:ee,children:[j&&K&&M.jsx(em,{inert:dd(!A),cutout:U}),F]})})});function Yx(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 wl="base-ui-disable-scrollbar",xh={className:wl,getElement(t){return M.jsx("style",{nonce:t,href:wl,precedence:"base-ui:low",children:`.${wl}{scrollbar-width:none}.${wl}::-webkit-scrollbar{display:none}`})}},KA=E.createContext(void 0);function Gx(t){return E.useContext(KA)}function af(t,e=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(e,Math.min(t,n))}const zo=1,YA={...Ii,...Ai},GA=E.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:m,scrollHandlerRef:g,highlightItemOnHover:y}=mr(),{side:b,align:w,alignItemWithTriggerActive:k,setControlledAlignItemWithTrigger:v,scrollDownArrowRef:x,scrollUpArrowRef:S}=om(),T=Gx()!=null,I=Vx(),{nonce:L,disableStyleElements:N}=xP(),P=Tn(),A=Oe(a,Re.id),j=Oe(a,Re.open),K=Oe(a,Re.mounted),J=Oe(a,Re.popupProps),Y=Oe(a,Re.transitionStatus),G=Oe(a,Re.triggerElement),U=Oe(a,Re.positionerElement),z=Oe(a,Re.listElement),B=E.useRef(0),H=E.useRef(!1),V=E.useRef(0),R=E.useRef(!1),D=E.useRef({}),$=sd(),Z=pe(C=>{if(!U||!l.current||!R.current)return;if(H.current||!k){m();return}const O=U.style.top==="0px",F=U.style.bottom==="0px",W=U.getBoundingClientRect().height,X=Je(U),ee=getComputedStyle(U),ne=parseFloat(ee.marginTop),oe=parseFloat(ee.marginBottom),re=Ay(getComputedStyle(l.current)),ae=Math.min(X.documentElement.clientHeight-ne-oe,re),te=C.scrollTop,fe=Iy(C);let ye=0,he=null,qe=!1,Ye=!1;const st=_e=>{U.style.height=`${_e}px`},Ae=(_e,Ue)=>{const Ke=af(_e,0,ae-W);Ke>0&&st(W+Ke),C.scrollTop=Ue,ae-(W+Ke)<=zo&&(H.current=!0),m()};if(O){const _e=fe-te,Ue=W+_e,Ke=Math.min(Ue,ae);if(ye=Ke,_e<=zo){Ae(_e,fe);return}ae-Ke>zo?Ye=!0:qe=!0}else if(F){const _e=te,Ue=W+_e,Ke=Math.min(Ue,ae),zt=Ue-ae;if(ye=Ke,_e<=zo){Ae(_e,0);return}ae-Ke>zo?he=0:(qe=!0,te<fe&&(he=te-(_e-zt)))}if(ye=Math.ceil(ye),ye!==0&&st(ye),Ye||he!=null){const _e=Iy(C),Ue=Ye?_e:af(he,0,_e);Math.abs(C.scrollTop-Ue)>zo&&(C.scrollTop=Ue)}(qe||ye>=ae-zo)&&(H.current=!0),m()});E.useImperativeHandle(g,()=>Z,[Z]),To({open:j,ref:l,onComplete(){j&&c?.(!0)}});const Q={open:j,transitionStatus:Y,side:b,align:w};ge(()=>{!U||!l.current||Object.keys(D.current).length||(D.current={top:U.style.top||"0",left:U.style.left||"0",right:U.style.right,height:U.style.height,bottom:U.style.bottom,minHeight:U.style.minHeight,maxHeight:U.style.maxHeight,marginTop:U.style.marginTop,marginBottom:U.style.marginBottom})},[l,U]),ge(()=>{j||k||(R.current=!1,H.current=!1,B.current=0,V.current=0,Kc(U,D.current))},[j,k,U,l]),ge(()=>{const C=l.current;if(!(!j||!G||!U||!C||a.state.transitionStatus==="ending")){if(!k){R.current=!0,$.request(m),C.style.removeProperty("--transform-origin");return}queueMicrotask(()=>{const O=ZA(C);C.style.removeProperty("--transform-origin");try{const F=getComputedStyle(U),W=getComputedStyle(C),X=Je(G),ee=Rt(U),ne=G.getBoundingClientRect(),oe=U.getBoundingClientRect(),re=ne.left,ae=ne.height,te=z||C,fe=te.scrollHeight,ye=parseFloat(W.borderBottomWidth),he=parseFloat(F.marginTop)||10,qe=parseFloat(F.marginBottom)||10,Ye=parseFloat(F.minHeight)||100,st=Ay(W),Ae=5,_e=5,Ue=20,Ke=X.documentElement.clientHeight-he-qe,zt=X.documentElement.clientWidth,Ht=Ke-ne.bottom+ae,Lt=f.current,Pt=d.current;let wt,De=0,Se=0;if(Lt&&Pt){const ze=Pt.getBoundingClientRect();wt=Lt.getBoundingClientRect();const ft=ze.left-re,dn=wt.left-oe.left,fn=ze.top-ne.top+ze.height/2,At=wt.top-oe.top+wt.height/2;De=ft-dn,Se=At-fn}const ce=Ht+Se+qe+ye;let ve=Math.min(Ke,ce);const xe=Ke-he-qe,Ie=ce-ve,dt=Math.max(Ae,re+De),$e=zt-_e,Xn=Math.max(0,dt+oe.width-$e);U.style.left=`${dt-Xn}px`,U.style.height=`${ve}px`,U.style.maxHeight="auto",U.style.marginTop=`${he}px`,U.style.marginBottom=`${qe}px`,C.style.height="100%";const Vr=te.scrollHeight-te.clientHeight,Hr=Ie>=Vr;Hr&&(ve=Math.min(Ke,oe.height)-(Ie-Vr));const vr=ne.top<Ue||ne.bottom>Ke-Ue||ve<Math.min(fe,Ye),wr=(ee.visualViewport?.scale??1)!==1&&mp;if(vr||wr){R.current=!0,Kc(U,D.current),cr.flushSync(()=>v(!1));return}if(Hr){const ze=Math.max(0,Ke-ce);U.style.top=oe.height>=xe?"0":`${ze}px`,U.style.height=`${ve}px`,te.scrollTop=te.scrollHeight-te.clientHeight,B.current=Math.max(Ye,ve)}else U.style.bottom="0",B.current=Math.max(Ye,ve),te.scrollTop=Ie;if(wt){const ze=oe.top,ft=oe.height,dn=wt.top+wt.height/2,fn=ft>0?(dn-ze)/ft*100:50,At=af(fn,0,100);C.style.setProperty("--transform-origin",`50% ${At}%`)}(B.current===Ke||ve>=st)&&(H.current=!0),m(),setTimeout(()=>{R.current=!0})}finally{O()}})}},[a,j,U,G,d,f,l,m,k,v,$,x,S,z]),E.useEffect(()=>{if(!k||!U||!j)return;const C=Rt(U);function O(F){u(!1,Fe(RM,F))}return C.addEventListener("resize",O),()=>{C.removeEventListener("resize",O)}},[u,k,U,j]);const _={...z?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":p||void 0,id:`${A}-list`},onKeyDown(C){h.current=!0,T&&Jp.has(C.key)&&C.stopPropagation()},onMouseMove(){h.current=!1},onPointerLeave(C){if(!y||Yx(C)||C.pointerType==="touch")return;const O=C.currentTarget;P.start(0,()=>{a.set("activeIndex",null),O.focus({preventScroll:!0})})},onScroll(C){z||Z(C.currentTarget)},...k&&{style:z?{height:"100%"}:Kx}},q=ot("div",e,{ref:[n,l],state:Q,stateAttributesMapping:YA,props:[J,_,ud(Y),{className:!z&&k?xh.className:void 0},i]});return M.jsxs(E.Fragment,{children:[!N&&xh.getElement(L),M.jsx(Tp,{context:I,modal:!1,disabled:!K,returnFocus:s,restoreFocus:!0,children:q})]})});function Ay(t){const e=t.maxHeight||"";return e.endsWith("px")&&parseFloat(e)||1/0}function Iy(t){return Math.max(0,t.scrollHeight-t.clientHeight)}const $y=[["transform","none"],["scale","1"],["translate","0 0"]];function ZA(t){const{style:e}=t,n={};for(const[r,o]of $y)n[r]=e.getPropertyValue(r),e.setProperty(r,o,"important");return()=>{for(const[r]of $y){const o=n[r];o?e.setProperty(r,o):e.removeProperty(r)}}}const JA=E.forwardRef(function(e,n){const{className:r,render:o,...s}=e,{store:i,scrollHandlerRef:a}=mr(),{alignItemWithTriggerActive:l}=om(),c=Oe(i,Re.hasScrollArrows),u=Oe(i,Re.openMethod),d=Oe(i,Re.multiple),h={id:`${Oe(i,Re.id)}-list`,role:"listbox","aria-multiselectable":d||void 0,onScroll(m){a.current?.(m.currentTarget)},...l&&{style:Kx},className:c&&u!=="touch"?xh.className:void 0},p=pe(m=>{i.set("listElement",m)});return ot("div",e,{ref:[n,p],props:[h,s]})}),Zx=E.createContext(void 0);function sm(){const t=E.useContext(Zx);if(!t)throw new Error(en(57));return t}const XA=E.memo(E.forwardRef(function(e,n){const{render:r,className:o,value:s=null,label:i,disabled:a=!1,nativeButton:l=!1,...c}=e,u=E.useRef(null),d=Zp({label:i,textRef:u,indexGuessBehavior:_x.GuessFromOrder}),{store:f,getItemProps:h,setOpen:p,setValue:m,selectionRef:g,typingRef:y,valuesRef:b,keyboardActiveRef:w,multiple:k,highlightItemOnHover:v}=mr(),x=Tn(),S=Oe(f,Re.isActive,d.index),T=Oe(f,Re.isSelected,d.index,s),I=Oe(f,Re.isSelectedByFocus,d.index),L=Oe(f,Re.isItemEqualToValue),N=d.index,P=N!==-1,A=E.useRef(null),j=Ft(N);ge(()=>{if(!P)return;const $=b.current;return $[N]=s,()=>{delete $[N]}},[P,N,s,b]),ge(()=>{if(!P)return;const $=f.state.value;let Z=$;k&&Array.isArray($)&&$.length>0&&(Z=$[$.length-1]),Z!==void 0&&yi(s,Z,L)&&f.set("selectedIndex",N)},[P,N,k,L,f,s]);const K={disabled:a,selected:T,highlighted:S},J=h({active:S,selected:T});J.onFocus=void 0,J.id=void 0;const Y=E.useRef(null),G=E.useRef("mouse"),U=E.useRef(!1),{getButtonProps:z,buttonRef:B}=ws({disabled:a,focusableWhenDisabled:!0,native:l});function H($){const Z=f.state.value;if(k){const Q=Array.isArray(Z)?Z:[],_=T?OA(Q,s,L):[...Q,s];m(_,Fe(Yd,$))}else m(s,Fe(Yd,$)),p(!1,Fe(Yd,$))}const V={role:"option","aria-selected":T,tabIndex:S?0:-1,onFocus(){f.set("activeIndex",N)},onMouseEnter(){!w.current&&f.state.selectedIndex===null&&v&&f.set("activeIndex",N)},onMouseMove(){v&&f.set("activeIndex",N)},onMouseLeave($){!v||w.current||Yx($)||x.start(0,()=>{f.state.activeIndex===N&&f.set("activeIndex",null)})},onTouchStart(){g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown($){Y.current=$.key,f.set("activeIndex",N)},onClick($){U.current=!1,!($.type==="keydown"&&Y.current===null)&&(a||Y.current===" "&&y.current||G.current!=="touch"&&!S||(Y.current=null,H($.nativeEvent)))},onPointerEnter($){G.current=$.pointerType},onPointerDown($){G.current=$.pointerType,U.current=!0},onMouseUp($){if(a)return;if(U.current){U.current=!1;return}const Z=!g.current.allowSelectedMouseUp&&T,Q=!g.current.allowUnselectedMouseUp&&!T;Z||Q||G.current!=="touch"&&!S||H($.nativeEvent)}},R=ot("div",e,{ref:[B,n,d.ref,A],state:K,props:[J,V,c,z]}),D=E.useMemo(()=>({selected:T,indexRef:j,textRef:u,selectedByFocus:I,hasRegistered:P}),[T,j,u,I,P]);return M.jsx(Zx.Provider,{value:D,children:R})})),QA=E.forwardRef(function(e,n){const r=e.keepMounted??!1,{selected:o}=sm();return r||o?M.jsx(eI,{...e,ref:n}):null}),eI=E.memo(E.forwardRef((t,e)=>{const{render:n,className:r,keepMounted:o,...s}=t,{selected:i}=sm(),a=E.useRef(null),{transitionStatus:l,setMounted:c}=Ua(i),d=ot("span",t,{ref:[e,a],state:{selected:i,transitionStatus:l},props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:Ai});return To({open:i,ref:a,onComplete(){i||c(!1)}}),d})),tI=E.memo(E.forwardRef(function(e,n){const{indexRef:r,textRef:o,selectedByFocus:s,hasRegistered:i}=sm(),{selectedItemTextRef:a}=mr(),{className:l,render:c,...u}=e,d=E.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 ot("div",e,{ref:[d,n,o],props:u})})),Jx=E.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}=mr(),{side:h,scrollDownArrowRef:p,scrollUpArrowRef:m}=om(),g=s==="up"?Re.scrollUpArrowVisible:Re.scrollDownArrowVisible,y=Oe(l,g),b=Oe(l,Re.openMethod),w=y&&b!=="touch",k=Tn(),v=s==="up"?m:p,{transitionStatus:x,setMounted:S}=Ua(w);ge(()=>(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]),To({open:w,ref:v,onComplete(){w||S(!1)}});const L=ot("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(P){if(P.movementX===0&&P.movementY===0||k.isStarted())return;l.set("activeIndex",null);function A(){const j=l.state.listElement??c.current;if(!j)return;l.set("activeIndex",null),d();const K=j.scrollTop===0,J=Math.round(j.scrollTop+j.clientHeight)>=j.scrollHeight;if(u.current.length===0&&(s==="up"?l.set("scrollUpArrowVisible",!K):l.set("scrollDownArrowVisible",!J)),s==="up"&&K||s==="down"&&J){k.clear();return}if((l.state.listElement||c.current)&&u.current&&u.current.length>0){const G=u.current,U=v.current?.offsetHeight||0;if(s==="up"){let z=0;const B=j.scrollTop+U;for(let V=0;V<G.length;V+=1){const R=G[V];if(R&&R.offsetTop>=B){z=V;break}}const H=Math.max(0,z-1);if(H<z){const V=G[H];V&&(j.scrollTop=Math.max(0,V.offsetTop-U))}else j.scrollTop=0}else{let z=G.length-1;const B=j.scrollTop+j.clientHeight-U;for(let V=0;V<G.length;V+=1){const R=G[V];if(R&&R.offsetTop+R.offsetHeight>B){z=Math.max(0,V-1);break}}const H=Math.min(G.length-1,z+1);if(H>z){const V=G[H];V&&(j.scrollTop=V.offsetTop+V.offsetHeight-j.clientHeight+U)}else j.scrollTop=j.scrollHeight-j.clientHeight}}k.start(40,A)}k.start(40,A)},onMouseLeave(){k.clear()}},a]});return w||i?L:null}),nI=E.forwardRef(function(e,n){return M.jsx(Jx,{...e,ref:n,direction:"down"})}),rI=E.forwardRef(function(e,n){return M.jsx(Jx,{...e,ref:n,direction:"up"})}),oI=E.createContext(void 0),sI=E.forwardRef(function(e,n){const{className:r,render:o,...s}=e,[i,a]=E.useState(),l=E.useMemo(()=>({labelId:i,setLabelId:a}),[i,a]),c=ot("div",e,{ref:n,props:[{role:"group","aria-labelledby":i},s]});return M.jsx(oI.Provider,{value:l,children:c})}),Yc=$A;function Gc(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(sI,{"data-slot":"select-group",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function Zc(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(BA,{"data-slot":"select-value",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function Jc(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(VA,{render:M.jsx(Dp,{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(jA,{"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 Xc(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 m;e[9]!==r?(m=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]=m):m=e[10];let g;e[11]===Symbol.for("react.memo_cache_sentinel")?(g=M.jsx(iI,{}),e[11]=g):g=e[11];let y;e[12]!==n?(y=M.jsx(JA,{children:n}),e[12]=n,e[13]=y):y=e[13];let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=M.jsx(aI,{}),e[14]=b):b=e[14];let w;e[15]!==p||e[16]!==o||e[17]!==m||e[18]!==y?(w=M.jsxs(GA,{"data-slot":"select-content","data-align-trigger":p,className:m,...o,children:[g,y,b]}),e[15]=p,e[16]=o,e[17]=m,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(WA,{children:M.jsx(UA,{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(tI,{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(QA,{render:M.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:M.jsx(ix,{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(XA,{"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 iI(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(FN,{}),e[5]=s):s=e[5];let i;return e[6]!==r||e[7]!==o?(i=M.jsx(rI,{"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 aI(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(Dp,{}),e[5]=s):s=e[5];let i;return e[6]!==r||e[7]!==o?(i=M.jsx(nI,{"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 lI(t){const n=t.replaceAll("\\","/").split("/");return n[n.length-1]??t}function cI(t){return t.replace(/\.[^.]+$/,"")}function oi(t){const e=t.data.title;if(typeof e=="string"&&e.trim().length>0)return e.trim();const n=lI(t.filePath||t.id);return cI(n)}function im(t){return t?[...t.files].sort((e,n)=>{const r=oi(e).localeCompare(oi(n),void 0,{sensitivity:"base"});return r!==0?r:e.id.localeCompare(n.id,void 0,{sensitivity:"base"})}):[]}function lf(t,e){return t.collection===e.collection&&t.file===e.file}function uI(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=im(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 dI(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]=E.useState(null);let h,p,m,g,y;if(e[0]!==n||e[1]!==u||e[2]!==s||e[3]!==i||e[4]!==r||e[5]!==o){let B;e[11]!==r?(B=Z=>Z.name===r,e[11]=r,e[12]=B):B=e[12],h=n.find(B);const H=im(h);g="flex h-full flex-col gap-3";let V;e[13]!==s?(V=Z=>{Z&&s(Z)},e[13]=s,e[14]=V):V=e[14];let R;e[15]===Symbol.for("react.memo_cache_sentinel")?(R=M.jsx(Jc,{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(Zc,{placeholder:"Select a collection"})}),e[15]=R):R=e[15];let D;e[16]!==n?(D=n.map(fI),e[16]=n,e[17]=D):D=e[17];let $;e[18]!==D?($=M.jsx(Xc,{children:M.jsx(Gc,{children:D})}),e[18]=D,e[19]=$):$=e[19],e[20]!==r||e[21]!==V||e[22]!==$?(y=M.jsxs(Yc,{value:r,onValueChange:V,children:[R,$]}),e[20]=r,e[21]=V,e[22]=$,e[23]=y):y=e[23],p="bg-background/35 min-h-0 flex-1 overflow-auto rounded-md p-1",m=H.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:H.map(Z=>{const Q=Z.id===o,_=oi(Z),q=Z.id,C=/\.mdx$/i.test(Z.filePath),O=Z.data.draft===!0,F=u===Z.id;return M.jsxs("div",{className:"group/item relative",children:[M.jsx(yn,{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",Q&&"bg-muted text-foreground hover:bg-muted/55"),onClick:()=>i(Z.id),title:Z.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:_}),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:q}),C?M.jsx(Uc,{variant:"secondary",className:"bg-muted h-4 border-transparent px-1.5 text-[10px] leading-none",children:"MDX"}):null,O?M.jsx(Uc,{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(yn,{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 ${_}`,disabled:F,onClick:W=>{W.preventDefault(),W.stopPropagation(),f({id:Z.id,label:_})},children:F?M.jsx(Zn,{className:"size-4 animate-spin"}):M.jsx(T_,{className:"size-4"})})]},Z.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]=m,e[9]=g,e[10]=y}else h=e[6],p=e[7],m=e[8],g=e[9],y=e[10];let b;e[24]!==p||e[25]!==m?(b=M.jsx("div",{className:p,children:m}),e[24]=p,e[25]=m,e[26]=b):b=e[26];const w=!h||c;let k;e[27]!==a?(k=async()=>{const B=window.prompt("Enter slug (e.g. my-new-post)");B&&await a(B)},e[27]=a,e[28]=k):k=e[28];let v;e[29]!==c?(v=c?M.jsx(Zn,{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(yn,{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 S=d!==null;let T;e[35]===Symbol.for("react.memo_cache_sentinel")?(T=B=>{B||f(null)},e[35]=T):T=e[35];let I;e[36]===Symbol.for("react.memo_cache_sentinel")?(I=M.jsx(bA,{children:"Delete file?"}),e[36]=I):I=e[36];const L=d?.label;let N;e[37]!==L?(N=M.jsxs(gA,{children:[I,M.jsxs(vA,{children:['This will permanently delete "',L,'" from disk.']})]}),e[37]=L,e[38]=N):N=e[38];const P=!!u;let A;e[39]!==P?(A=M.jsx(kA,{disabled:P,children:"Cancel"}),e[39]=P,e[40]=A):A=e[40];const j=!d||!!u;let K;e[41]!==d||e[42]!==l?(K=async()=>{d&&(await l(d.id),f(null))},e[41]=d,e[42]=l,e[43]=K):K=e[43];let J;e[44]!==j||e[45]!==K?(J=M.jsx(wA,{variant:"destructive",disabled:j,onClick:K,children:"Delete"}),e[44]=j,e[45]=K,e[46]=J):J=e[46];let Y;e[47]!==A||e[48]!==J?(Y=M.jsxs(yA,{children:[A,J]}),e[47]=A,e[48]=J,e[49]=Y):Y=e[49];let G;e[50]!==N||e[51]!==Y?(G=M.jsxs(mA,{children:[N,Y]}),e[50]=N,e[51]=Y,e[52]=G):G=e[52];let U;e[53]!==S||e[54]!==G?(U=M.jsx(fA,{open:S,onOpenChange:T,children:G}),e[53]=S,e[54]=G,e[55]=U):U=e[55];let z;return e[56]!==U||e[57]!==g||e[58]!==y||e[59]!==b||e[60]!==x?(z=M.jsxs("div",{className:g,children:[y,b,x,U]}),e[56]=U,e[57]=g,e[58]=y,e[59]=b,e[60]=x,e[61]=z):z=e[61],z}function fI(t){return M.jsx(pd,{value:t.name,children:t.name},t.name)}function hI(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 qt(t){this.content=t}qt.prototype={constructor:qt,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 qt(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 qt(n)},addToStart:function(t,e){return new qt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new qt(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 qt(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=qt.from(t),t.size?new qt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=qt.from(t),t.size?new qt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=qt.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}};qt.from=function(t){if(t instanceof qt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new qt(e)};function Xx(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=Xx(o.content,s.content,n+1);if(i!=null)return i}n+=o.nodeSize}}function Qx(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=Qx(i.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class ie{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 ie(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 ie(r,o)}cutByIndex(e,n){return e==n?ie.empty:e==0&&n==this.content.length?this:new ie(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 ie(o,s)}addToStart(e){return new ie([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ie(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 Xx(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Qx(this,e,n,r)}findIndex(e){if(e==0)return kl(0,e);if(e==this.size)return kl(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?kl(n+1,s):kl(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 ie.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new ie(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ie.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 ie(n||e,r)}static from(e){if(!e)return ie.empty;if(e instanceof ie)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ie([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}ie.empty=new ie([],0);const cf={index:0,offset:0};function kl(t,e){return cf.index=t,cf.offset=e,cf}function Qc(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(!Qc(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Qc(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let ut=class Sh{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&&Qc(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 Sh.none;if(e instanceof Sh)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};ut.none=[];class eu extends Error{}class me{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=t1(this.content,e+this.openStart,n);return r&&new me(r,this.openStart,this.openEnd)}removeBetween(e,n){return new me(e1(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 me.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 me(ie.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 me(e,r,o)}}me.empty=new me(ie.empty,0,0);function e1(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(e1(s.content,e-o-1,n-o-1)))}function t1(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=t1(i.content,e-s-1,n,i);return a&&t.replaceChild(o,i.copy(a))}function pI(t,e,n){if(n.openStart>t.depth)throw new eu("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new eu("Inconsistent open depths");return n1(t,e,n,0)}function n1(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=n1(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}=mI(n,t);return es(s,o1(t,i,a,e,r))}else return es(s,tu(t,e,r))}function r1(t,e){if(!e.type.compatibleContent(t.type))throw new eu("Cannot join "+e.type.name+" onto "+t.type.name)}function Eh(t,e,n){let r=t.node(n);return r1(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 da(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 o1(t,e,n,r,o){let s=t.depth>o&&Eh(t,e,o+1),i=r.depth>o&&Eh(n,r,o+1),a=[];return da(null,t,o,a),s&&i&&e.index(o)==n.index(o)?(r1(s,i),Qo(es(s,o1(t,e,n,r,o+1)),a)):(s&&Qo(es(s,tu(t,e,o+1)),a),da(e,n,o,a),i&&Qo(es(i,tu(n,r,o+1)),a)),da(r,null,o,a),new ie(a)}function tu(t,e,n){let r=[];if(da(null,t,n,r),t.depth>n){let o=Eh(t,e,n+1);Qo(es(o,tu(t,e,n+1)),r)}return da(e,null,n,r),new ie(r)}function mI(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(ie.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class Oa{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 ut.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 nu(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 Oa(n,r,s)}static resolveCached(e,n){let r=Dy.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 Dy.set(e,r=new gI);let o=r.elts[r.i]=Oa.resolve(e,n);return r.i=(r.i+1)%yI,o}}class gI{constructor(){this.elts=[],this.i=0}}const yI=12,Dy=new WeakMap;class nu{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 bI=Object.create(null);let fo=class Ch{constructor(e,n,r,o=ut.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||ie.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&&Qc(this.attrs,n||e.defaultAttrs||bI)&&ut.sameSet(this.marks,r||ut.none)}copy(e=null){return e==this.content?this:new Ch(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ch(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 me.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 me(c,o.depth-i,s.depth-i)}replace(e,n,r){return pI(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 Oa.resolveCached(this,e)}resolveNoCache(e){return Oa.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()+")"),s1(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=ie.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=ut.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(!ut.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=ie.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,o,r);return s.type.checkAttrs(s.attrs),s}};fo.prototype.text=void 0;class ru extends fo{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):s1(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 ru(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ru(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 s1(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 vI(e,n);if(r.next==null)return ds.empty;let o=i1(r);r.next&&r.err("Unexpected trailing text");let s=TI(CI(o));return MI(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 ie.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 vI{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 i1(t){let e=[];do e.push(wI(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function wI(t){let e=[];do e.push(kI(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function kI(t){let e=EI(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=xI(t,e);else break;return e}function zy(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function xI(t,e){let n=zy(t),r=n;return t.eat(",")&&(t.next!="}"?r=zy(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function SI(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 EI(t){if(t.eat("(")){let e=i1(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=SI(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 CI(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 a1(t,e){return e-t}function Ly(t,e){let n=[];return r(e),n.sort(a1);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 TI(t){let e=Object.create(null);return n(Ly(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]);Ly(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(a1);s.next.push({type:o[i][0],next:e[a.join(",")]||n(a)})}return s}}function MI(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 l1(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 c1(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 u1(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 d1(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new OI(t,r,e[r]);return n}let jy=class f1{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=d1(e,r.attrs),this.defaultAttrs=l1(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:c1(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new fo(this,this.computeAttrs(e),ie.from(n),ut.setFrom(r))}createChecked(e=null,n,r){return n=ie.from(n),this.checkContent(n),new fo(this,this.computeAttrs(e),n,ut.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=ie.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(ie.empty,!0);return s?new fo(this,e,n.append(s),ut.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){u1(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:ut.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,i)=>r[s]=new f1(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 RI(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 OI{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?RI(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=d1(e,o.attrs),this.excluded=null;let s=l1(this.attrs);this.instance=s?new ut(this,s):null}create(e=null){return!e&&this.instance?this.instance:new ut(this,c1(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){u1(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class h1{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=qt.from(e.nodes),n.marks=qt.from(e.marks||{}),this.nodes=jy.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?Fy(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==""?[]:Fy(this,i.split(" "))}this.nodeFromJSON=o=>fo.fromJSON(this,o),this.markFromJSON=o=>ut.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 jy){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 ru(r,r.defaultAttrs,e,ut.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 Fy(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 NI(t){return t.tag!=null}function _I(t){return t.style!=null}class ho{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(NI(o))this.tags.push(o);else if(_I(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 Vy(this,n,!1);return r.addAll(e,ut.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Vy(this,n,!0);return r.addAll(e,ut.none,n.from,n.to),me.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(II(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=Hy(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=Hy(i)),i.node||i.ignore||i.mark||(i.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ho(e,ho.schemaRules(e)))}}const p1={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},PI={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},m1={ol:!0,ul:!0},Na=1,Th=2,fa=4;function By(t,e,n){return e!=null?(e?Na:0)|(e==="full"?Th:0):t&&t.whitespace=="pre"?Na|Th:n&~fa}class xl{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=ut.none,this.match=s||(i&fa?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ie.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&Na)){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=ie.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ie.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&&!p1.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Vy{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=By(null,n.preserveWhitespace,0)|(r?fa:0);o?s=new xl(o.type,o.attrs,ut.none,!0,n.topMatch||o.type.contentMatch,i):r?s=new xl(null,null,ut.none,!0,null,i):s=new xl(e.schema.topNodeType,null,ut.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&Th?"full":this.localPreserveWS||(o.options&Na)>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;m1.hasOwnProperty(i)&&this.parser.normalizeLists&&AI(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:PI.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(p1.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=ut.none;for(let a of o.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):Wy(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=By(e,s,i.options);i.options&fa&&i.content.length==0&&(a|=fa);let l=ut.none;return r=r.filter(c=>(i.type?i.type.allowsMarkType(c.type):Wy(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new xl(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|=Na)}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 AI(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&m1.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function II(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Hy(t){let e={};for(let n in t)e[n]=t[n];return e}function Wy(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=uf(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}=Nc(uf(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&&Nc(uf(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return Nc(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=qy(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return qy(e.marks)}}function qy(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function uf(t){return t.document||window.document}const Uy=new WeakMap;function $I(t){let e=Uy.get(t);return e===void 0&&Uy.set(t,e=DI(t)),e}function DI(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 Nc(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=$I(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}=Nc(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 g1=65535,y1=Math.pow(2,16);function zI(t,e){return t+e*y1}function Ky(t){return t&g1}function LI(t){return(t-(t&g1))/y1}const b1=1,v1=2,_c=4,w1=8;class Mh{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&w1)>0}get deletedBefore(){return(this.delInfo&(b1|_c))>0}get deletedAfter(){return(this.delInfo&(v1|_c))>0}get deletedAcross(){return(this.delInfo&_c)>0}}class Cn{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Cn.empty)return Cn.empty}recover(e){let n=0,r=Ky(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+LI(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:zI(a/3,e-l),m=e==l?v1:e==d?b1:_c;return(n<0?e!=l:e!=d)&&(m|=w1),new Mh(h,m,p)}o+=u-c}return r?e+o:new Mh(e+o,0,null)}touches(e,n){let r=0,o=Ky(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 Cn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Cn.empty:new Cn(e<0?[0,-e,0]:[0,0,e])}}Cn.empty=new Cn([]);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 Mh(e,o,null)}}const df=Object.create(null);class tn{getMap(){return Cn.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=df[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 df)throw new RangeError("Duplicate use of step JSON ID "+e);return df[e]=n,n.prototype.jsonID=e,n}}class Mt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Mt(e,null)}static fail(e){return new Mt(null,e)}static fromReplace(e,n,r,o){try{return Mt.ok(e.replace(n,r,o))}catch(s){if(s instanceof eu)return Mt.fail(s.message);throw s}}}function am(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let s=t.child(o);s.content.size&&(s=s.copy(am(s.content,e,s))),s.isInline&&(s=e(s,n,o)),r.push(s)}return ie.fromArray(r)}class ro extends tn{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 me(am(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 Mt.fromReplace(e,this.from,this.to,s)}invert(){return new Yn(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 ro(n.pos,r.pos,this.mark)}merge(e){return e instanceof ro&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ro(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 ro(n.from,n.to,e.markFromJSON(n.mark))}}tn.jsonID("addMark",ro);class Yn extends tn{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 me(am(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return Mt.fromReplace(e,this.from,this.to,r)}invert(){return new ro(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 Yn(n.pos,r.pos,this.mark)}merge(e){return e instanceof Yn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Yn(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 Yn(n.from,n.to,e.markFromJSON(n.mark))}}tn.jsonID("removeMark",Yn);class oo extends tn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Mt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Mt.fromReplace(e,this.pos,this.pos+1,new me(ie.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 oo(this.pos,n.marks[o]);return new oo(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 oo(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 oo(n.pos,e.markFromJSON(n.mark))}}tn.jsonID("addNodeMark",oo);class fs extends tn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Mt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Mt.fromReplace(e,this.pos,this.pos+1,new me(ie.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new oo(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))}}tn.jsonID("removeNodeMark",fs);class jt extends tn{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&Rh(e,this.from,this.to)?Mt.fail("Structure replace would overwrite content"):Mt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Cn([this.from,this.to-this.from,this.slice.size])}invert(e){return new jt(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 jt(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof jt)||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?me.empty:new me(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new jt(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?me.empty:new me(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new jt(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 jt(n.from,n.to,me.fromJSON(e,n.slice),!!n.structure)}}tn.jsonID("replace",jt);class Bt extends tn{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&&(Rh(e,this.from,this.gapFrom)||Rh(e,this.gapTo,this.to)))return Mt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Mt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Mt.fromReplace(e,this.from,this.to,r):Mt.fail("Content does not fit in gap")}getMap(){return new Cn([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 Bt(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 Bt(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 Bt(n.from,n.to,n.gapFrom,n.gapTo,me.fromJSON(e,n.slice),n.insert,!!n.structure)}}tn.jsonID("replaceAround",Bt);function Rh(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 jI(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 m=0;m<d.length;m++)d[m].isInSet(p)||(i&&i.to==f&&i.mark.eq(d[m])?i.to=h:o.push(i=new Yn(f,h,d[m])));a&&a.to==f?a.to=h:s.push(a=new ro(f,h,r))}}),o.forEach(l=>t.step(l)),s.forEach(l=>t.step(l))}function FI(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 Yn(i.from,i.to,i.style)))}function lm(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 jt(a,u,me.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new Yn(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 me(ie.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),i.push(new jt(a+f.index,a+f.index+f[0].length,p))}}a=u}if(!r.validEnd){let l=r.fillBefore(ie.empty,!0);t.replace(a,a,new me(l,0,0))}for(let l=i.length-1;l>=0;l--)t.step(i[l])}function BI(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Di(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||!BI(i,a,l))break;a&&(o=1),l<i.childCount&&(s=1)}return null}function VI(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=ie.empty,d=0;for(let p=s,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,u=ie.from(r.node(p).copy(u)),d++):l--;let f=ie.empty,h=0;for(let p=s,m=!1;p>n;p--)m||o.after(p+1)<o.end(p)?(m=!0,f=ie.from(o.node(p).copy(f)),h++):c++;t.step(new Bt(l,c,i,a,new me(u.append(f),d,h),u.size-d,!0))}function cm(t,e,n=null,r=t){let o=HI(t,e),s=o&&WI(r,e);return s?o.map(Yy).concat({type:e,attrs:n}).concat(s.map(Yy)):null}function Yy(t){return{type:t,attrs:null}}function HI(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 WI(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 qI(t,e,n){let r=ie.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=ie.from(n[i].type.create(n[i].attrs,r))}let o=e.start,s=e.end;t.step(new Bt(o,s,o,s,new me(r,0,0),n.length,!0))}function UI(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)&&KI(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&&x1(t,i,a,s),lm(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 Bt(d,f,d+1,f-1,new me(ie.from(r.create(l,null,i.marks)),0,0),1,!0)),c===!0&&k1(t,i,a,s),!1}})}function k1(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 x1(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 KI(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function YI(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 Bt(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new me(ie.from(i),0,0),1,!0))}function $r(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 m=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.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 GI(t,e,n=1,r){let o=t.doc.resolve(e),s=ie.empty,i=ie.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){s=ie.from(o.node(a).copy(s));let u=r&&r[c];i=ie.from(u?u.type.create(u.attrs,i):o.node(a).copy(i))}t.step(new jt(e,e,new me(s.append(i),n,n),!0))}function Ro(t,e){let n=t.resolve(e),r=n.index();return S1(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function ZI(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 S1(t,e){return!!(t&&e&&!t.isLeaf&&ZI(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&&S1(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 JI(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);x1(t,u.node(),u.before(),a)}i.inlineContent&&lm(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 jt(c,l.map(e+n,-1),me.empty,!0)),r===!0){let u=t.doc.resolve(c);k1(t,u.node(),u.before(),t.steps.length)}return t}function XI(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 E1(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=me.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),s=t.resolve(n);return C1(o,s,r)?new jt(e,n,r):new QI(o,s,r).fit()}function C1(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class QI{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ie.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=ie.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 me(s,i,a);return e>-1?new Bt(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new jt(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=ff(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(ie.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=ff(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new me(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=ff(e,n);if(o.childCount<=1&&n>0){let s=e.size-n<=n+o.size;this.unplaced=new me(Xi(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new me(Xi(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 m=0;m<s.length;m++)this.openFrontierNode(s[m]);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 m=0;m<o.childCount;m++)u.push(o.child(m));d=d.matchFragment(o)}let h=a.size+e-(i.content.size-i.openEnd);for(;c<a.childCount;){let m=a.child(c),g=d.matchType(m.type);if(!g)break;c++,(c>1||l==0||m.content.size)&&(d=g,u.push(T1(m.mark(f.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?h:-1)))}let p=c==a.childCount;p||(h=-1),this.placed=Qi(this.placed,n,ie.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 m=0,g=a;m<h;m++){let y=g.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),g=y.content}this.unplaced=p?e==0?me.empty:new me(Xi(i.content,e-1,1),e-1,h<0?i.openEnd:e-1):new me(Xi(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||!hf(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=hf(e,n,o,r,s);if(i){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=hf(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=Qi(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=Qi(this.placed,this.depth,ie.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ie.empty,!0);n.childCount&&(this.placed=Qi(this.placed,this.frontier.length,n))}}function Xi(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Xi(t.firstChild.content,e-1,n)))}function Qi(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Qi(t.lastChild.content,e-1,n)))}function ff(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function T1(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,T1(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(ie.empty,!0)))),t.copy(r)}function hf(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&&!e$(n,s.content,i)?a:null}function e$(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function t$(t){return t.spec.defining||t.spec.definingForContent}function n$(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),s=t.doc.resolve(n);if(C1(o,s,r))return t.step(new jt(e,n,r));let i=R1(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=t$(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 m=0;m<i.length;m++){let g=i[(m+l)%i.length],y=!0;g<0&&(y=!1,g=-g);let b=o.node(g-1),w=o.index(g-1);if(b.canReplaceWith(w,w,p.type,p.marks))return t.replace(o.before(g),y?s.after(g):n,new me(M1(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 M1(t,e,n,r,o){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(M1(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(ie.empty,!0))}return t}function r$(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=XI(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new me(ie.from(r),0,0))}function o$(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),s=R1(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 R1(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 si extends tn{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 Mt.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 Mt.fromReplace(e,this.pos,this.pos+1,new me(ie.from(o),0,n.isLeaf?0:1))}getMap(){return Cn.empty}invert(e){return new si(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 si(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 si(n.pos,n.attr,n.value)}}tn.jsonID("attr",si);class Pa extends tn{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 Mt.ok(r)}getMap(){return Cn.empty}invert(e){return new Pa(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 Pa(n.attr,n.value)}}tn.jsonID("docAttr",Pa);let bi=class extends Error{};bi=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};bi.prototype=Object.create(Error.prototype);bi.prototype.constructor=bi;bi.prototype.name="TransformError";class O1{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 bi(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=me.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 me(ie.from(r),0,0))}delete(e,n){return this.replace(e,n,me.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return n$(this,e,n,r),this}replaceRangeWith(e,n,r){return r$(this,e,n,r),this}deleteRange(e,n){return o$(this,e,n),this}lift(e,n){return VI(this,e,n),this}join(e,n=1){return JI(this,e,n),this}wrap(e,n){return qI(this,e,n),this}setBlockType(e,n=e,r,o=null){return UI(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return YI(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new si(e,n,r)),this}setDocAttribute(e,n){return this.step(new Pa(e,n)),this}addNodeMark(e,n){return this.step(new oo(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 ut)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 GI(this,e,n,r),this}addMark(e,n,r){return jI(this,e,n,r),this}removeMark(e,n,r){return FI(this,e,n,r),this}clearIncompatible(e,n,r){return lm(this,e,n,r),this}}const pf=Object.create(null);class je{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new s$(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=me.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?me.empty:n),a==0&&Jy(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),Jy(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new Pe(e):Bs(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?Bs(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Bs(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 Mn(e.node(0))}static atStart(e){return Bs(e,e,0,0,1)||new Mn(e)}static atEnd(e){return Bs(e,e,e.content.size,e.childCount,-1)||new Mn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=pf[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 pf)throw new RangeError("Duplicate use of selection JSON ID "+e);return pf[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Pe.between(this.$anchor,this.$head).getBookmark()}}je.prototype.visible=!0;class s${constructor(e,n){this.$from=e,this.$to=n}}let Gy=!1;function Zy(t){!Gy&&!t.parent.inlineContent&&(Gy=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Pe extends je{constructor(e,n=e){Zy(e),Zy(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 je.near(r);let o=e.resolve(n.map(this.anchor));return new Pe(o.parent.inlineContent?o:r,r)}replace(e,n=me.empty){if(super.replace(e,n),n==me.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Pe&&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 Pe(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=je.findFrom(n,r,!0)||je.findFrom(n,-r,!0);if(s)n=s.$head;else return je.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(je.findFrom(e,-r,!0)||je.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new Pe(e,n)}}je.jsonID("text",Pe);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 Pe.between(e.resolve(this.anchor),e.resolve(this.head))}}class Te extends je{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?je.near(s):new Te(s)}content(){return new me(ie.from(this.node),0,0)}eq(e){return e instanceof Te&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new um(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Te(e.resolve(n.anchor))}static create(e,n){return new Te(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Te.prototype.visible=!1;je.jsonID("node",Te);class um{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new bd(r,r):new um(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Te.isSelectable(r)?new Te(n):je.near(n)}}class Mn extends je{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=me.empty){if(n==me.empty){e.delete(0,e.doc.content.size);let r=je.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Mn(e)}map(e){return new Mn(e)}eq(e){return e instanceof Mn}getBookmark(){return i$}}je.jsonID("all",Mn);const i$={map(){return this},resolve(t){return new Mn(t)}};function Bs(t,e,n,r,o,s=!1){if(e.inlineContent)return Pe.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&&Te.isSelectable(a))return Te.create(t,n-(o<0?a.nodeSize:0))}else{let l=Bs(t,a,n+o,o<0?a.childCount:0,o,s);if(l)return l}n+=a.nodeSize*o}return null}function Jy(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof jt||o instanceof Bt))return;let s=t.mapping.maps[r],i;s.forEach((a,l,c,u)=>{i==null&&(i=u)}),t.setSelection(je.near(t.doc.resolve(i),n))}const Xy=1,Sl=2,Qy=4;class a$ extends O1{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|Xy)&~Sl,this.storedMarks=null,this}get selectionSet(){return(this.updated&Xy)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Sl,this}ensureMarks(e){return ut.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&Sl)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Sl,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)||ut.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(je.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|=Qy,this}get scrolledIntoView(){return(this.updated&Qy)>0}}function eb(t,e){return!e||!t?t:t.bind(e)}class ea{constructor(e,n,r){this.name=e,this.init=eb(n.init,r),this.apply=eb(n.apply,r)}}const l$=[new ea("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new ea("selection",{init(t,e){return t.selection||je.atStart(e.doc)},apply(t){return t.selection}}),new ea("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ea("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class mf{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=l$.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 ea(r.key,r.spec.state,r))})}}class Ks{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 Ks(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 a$(this)}static create(e){let n=new mf(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Ks(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 mf(this.schema,e.plugins),r=n.fields,o=new Ks(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 mf(e.schema,e.plugins),s=new Ks(o);return o.fields.forEach(i=>{if(i.name=="doc")s.doc=fo.fromJSON(e.schema,n.doc);else if(i.name=="selection")s.selection=je.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 N1(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=N1(o,e,{})),n[r]=o}return n}class bt{constructor(e){this.spec=e,this.props={},e.props&&N1(e.props,this,this.props),this.key=e.key?e.key.key:_1("plugin")}getState(e){return e[this.key]}}const gf=Object.create(null);function _1(t){return t in gf?t+"$"+ ++gf[t]:(gf[t]=0,t+"$")}class Dt{constructor(e="key"){this.key=_1(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const dm=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function P1(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const A1=(t,e,n)=>{let r=P1(t,n);if(!r)return!1;let o=fm(r);if(!o){let i=r.blockRange(),a=i&&Di(i);return a==null?!1:(e&&e(t.tr.lift(i,a).scrollIntoView()),!0)}let s=o.nodeBefore;if(V1(t,o,e,-1))return!0;if(r.parent.content.size==0&&(vi(s,"end")||Te.isSelectable(s)))for(let i=r.depth;;i--){let a=yd(t.doc,r.before(i),r.after(i),me.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(vi(s,"end")?je.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):Te.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},c$=(t,e,n)=>{let r=P1(t,n);if(!r)return!1;let o=fm(r);return o?I1(t,o,e):!1},u$=(t,e,n)=>{let r=D1(t,n);if(!r)return!1;let o=hm(r);return o?I1(t,o,e):!1};function I1(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,me.empty);if(!c||c.from!=s||c instanceof jt&&c.slice.size>=l-s)return!1;if(n){let u=t.tr.step(c);u.setSelection(Pe.create(u.doc,s)),n(u.scrollIntoView())}return!0}function vi(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 $1=(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=fm(r)}let i=s&&s.nodeBefore;return!i||!Te.isSelectable(i)?!1:(e&&e(t.tr.setSelection(Te.create(t.doc,s.pos-i.nodeSize)).scrollIntoView()),!0)};function fm(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 D1(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const z1=(t,e,n)=>{let r=D1(t,n);if(!r)return!1;let o=hm(r);if(!o)return!1;let s=o.nodeAfter;if(V1(t,o,e,1))return!0;if(r.parent.content.size==0&&(vi(s,"start")||Te.isSelectable(s))){let i=yd(t.doc,r.before(),r.after(),me.empty);if(i&&i.slice.size<i.to-i.from){if(e){let a=t.tr.step(i);a.setSelection(vi(s,"start")?je.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):Te.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},L1=(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=hm(r)}let i=s&&s.nodeAfter;return!i||!Te.isSelectable(i)?!1:(e&&e(t.tr.setSelection(Te.create(t.doc,s.pos)).scrollIntoView()),!0)};function hm(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 d$=(t,e)=>{let n=t.selection,r=n instanceof Te,o;if(r){if(n.node.isTextblock||!Ro(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(Te.create(s.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},f$=(t,e)=>{let n=t.selection,r;if(n instanceof Te){if(n.node.isTextblock||!Ro(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},h$=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),s=o&&Di(o);return s==null?!1:(e&&e(t.tr.lift(o,s).scrollIntoView()),!0)},j1=(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 pm(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 p$=(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=pm(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(je.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},F1=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof Mn||r.parent.inlineContent||o.parent.inlineContent)return!1;let s=pm(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(Pe.create(a.doc,i+1)),e(a.scrollIntoView())}return!0},B1=(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($r(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Di(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function m$(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof Te&&e.selection.node.isBlock)return!r.parentOffset||!$r(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=pm(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 Pe||e.selection instanceof Mn)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=$r(u.doc,d,s.length,s);if(f||(s[0]=a?{type:a}:null,f=$r(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 g$=m$(),y$=(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(Te.create(t.doc,o))),!0)};function b$(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||Ro(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function V1(t,e,n,r){let o=e.nodeBefore,s=e.nodeAfter,i,a,l=o.type.spec.isolating||s.type.spec.isolating;if(!l&&b$(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=ie.empty;for(let y=i.length-1;y>=0;y--)p=ie.from(i[y].create(null,p));p=ie.from(o.copy(p));let m=t.tr.step(new Bt(e.pos-1,h,e.pos,h,new me(p,1,0),i.length,!0)),g=m.doc.resolve(h+2*i.length);g.nodeAfter&&g.nodeAfter.type==o.type&&Ro(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&l?null:je.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Di(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&vi(s,"start",!0)&&vi(o,"end")){let h=o,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(n){let y=ie.empty;for(let w=p.length-1;w>=0;w--)y=ie.from(p[w].copy(y));let b=t.tr.step(new Bt(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new me(y,p.length,0),0,!0));n(b.scrollIntoView())}return!0}}return!1}function H1(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(Pe.create(e.doc,t<0?o.start(s):o.end(s)))),!0):!1}}const v$=H1(-1),w$=H1(1);function k$(t,e=null){return function(n,r){let{$from:o,$to:s}=n.selection,i=o.blockRange(s),a=i&&cm(i,t,e);return a?(r&&r(n.tr.wrap(i,a).scrollIntoView()),!0):!1}}function tb(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 mm(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}mm(dm,A1,$1);mm(dm,z1,L1);mm(j1,F1,B1,g$);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function x$(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 S$(a,i,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function S$(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 nu(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new nu(e.$from,i.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let a=cm(s,n,r,e);return a?(t&&E$(t,e,a,o,n),!0):!1}function E$(t,e,n,r,o){let s=ie.empty;for(let u=n.length-1;u>=0;u--)s=ie.from(n[u].type.create(n[u].attrs,s));t.step(new Bt(e.start-(r?2:0),e.end,e.start,e.end,new me(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&&$r(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function C$(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?T$(e,n,t,s):M$(e,n,s):!0:!1}}function T$(t,e,n,r){let o=t.tr,s=r.end,i=r.$to.end(r.depth);s<i&&(o.step(new Bt(s-1,i,s,i,new me(ie.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new nu(o.doc.resolve(r.$from.pos),o.doc.resolve(i),r.depth));const a=Di(r);if(a==null)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(s,-1)-1);return Ro(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos),e(o.scrollIntoView()),!0}function M$(t,e,n){let r=t.tr,o=n.parent;for(let h=n.end,p=n.endIndex-1,m=n.startIndex;p>m;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?ie.empty:ie.from(o))))return!1;let d=s.pos,f=d+i.nodeSize;return r.step(new Bt(d-(a?1:0),f+(l?1:0),d+1,f-1,new me((a?ie.empty:ie.from(o.copy(ie.empty))).append(l?ie.empty:ie.from(o.copy(ie.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function R$(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=ie.from(c?t.create():null),d=new me(ie.from(t.create(null,ie.from(a.type.create(null,u)))),c?3:1,0),f=s.start,h=s.end;n(e.tr.step(new Bt(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const Kt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},wi=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Oh=null;const Nr=function(t,e,n){let r=Oh||(Oh=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},O$=function(){Oh=null},hs=function(t,e,n,r){return n&&(nb(t,e,n,r,-1)||nb(t,e,n,r,1))},N$=/^(img|br|input|textarea|hr)$/i;function nb(t,e,n,r,o){for(var s;;){if(t==n&&e==r)return!0;if(e==(o<0?0:$n(t))){let i=t.parentNode;if(!i||i.nodeType!=1||Ga(t)||N$.test(t.nodeName)||t.contentEditable=="false")return!1;e=Kt(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?$n(t):0}else return!1}}function $n(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function _$(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=$n(t)}else if(t.parentNode&&!Ga(t))e=Kt(t),t=t.parentNode;else return null}}function P$(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&&!Ga(t))e=Kt(t)+1,t=t.parentNode;else return null}}function A$(t,e,n){for(let r=e==0,o=e==$n(t);r||o;){if(t==n)return!0;let s=Kt(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,o=o&&s==$n(t)}}function Ga(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 I$(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function $$(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min($n(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min($n(r.startContainer),r.startOffset)}}}const ur=typeof navigator<"u"?navigator:null,rb=typeof document<"u"?document:null,Oo=ur&&ur.userAgent||"",Nh=/Edge\/(\d+)/.exec(Oo),W1=/MSIE \d/.exec(Oo),_h=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Oo),bn=!!(W1||_h||Nh),po=W1?document.documentMode:_h?+_h[1]:Nh?+Nh[1]:0,zn=!bn&&/gecko\/(\d+)/i.test(Oo);zn&&+(/Firefox\/(\d+)/.exec(Oo)||[0,0])[1];const Ph=!bn&&/Chrome\/(\d+)/.exec(Oo),Gt=!!Ph,q1=Ph?+Ph[1]:0,Qt=!bn&&!!ur&&/Apple Computer/.test(ur.vendor),ki=Qt&&(/Mobile\/\w+/.test(Oo)||!!ur&&ur.maxTouchPoints>2),In=ki||(ur?/Mac/.test(ur.platform):!1),U1=ur?/Win/.test(ur.platform):!1,_r=/Android \d/.test(Oo),Za=!!rb&&"webkitFontSmoothing"in rb.documentElement.style,D$=Za?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function z$(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 xr(t,e){return typeof t=="number"?t:t[e]}function L$(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 ob(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=wi(i);continue}let a=i,l=a==s.body,c=l?z$(s):L$(a),u=0,d=0;if(e.top<c.top+xr(r,"top")?d=-(c.top-e.top+xr(o,"top")):e.bottom>c.bottom-xr(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+xr(o,"top")-c.top:e.bottom-c.bottom+xr(o,"bottom")),e.left<c.left+xr(r,"left")?u=-(c.left-e.left+xr(o,"left")):e.right>c.right-xr(r,"right")&&(u=e.right-c.right+xr(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 m=a.scrollLeft-h,g=a.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let f=l?"fixed":getComputedStyle(i).position;if(/^(fixed|sticky)$/.test(f))break;i=f=="absolute"?i.offsetParent:wi(i)}}function j$(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:K1(t.dom)}}function K1(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=wi(r));return e}function F$({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Y1(n,r==0?0:r-e)}function Y1(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 Ps=null;function B$(t){if(t.setActive)return t.setActive();if(Ps)return t.focus(Ps);let e=K1(t);t.focus(Ps==null?{get preventScroll(){return Ps={preventScroll:!0},!0}}:void 0),Ps||(Ps=!1,Y1(e,0))}function G1(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=Nr(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 m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=u,r=m,o=m&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(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?V$(n,o):!n||r&&n.nodeType==1?{node:t,offset:s}:G1(n,o)}function V$(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=Zr(r,1);if(i.top!=i.bottom&&gm(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 gm(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function H$(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function W$(t,e,n){let{node:r,offset:o}=G1(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 q$(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 Z1(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(gm(e,c))return Z1(i,e,c)}}if((s=(s+1)%r)==o)break}return t}function U$(t,e){let n=t.dom.ownerDocument,r,o=0,s=$$(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(!gm(e,c)||(i=Z1(t.dom,e,c),!i))return null}if(Qt)for(let c=i;r&&c;c=wi(c))c.draggable&&(r=void 0);if(i=H$(i,e),r){if(zn&&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=q$(t,r,o,e))}a==null&&(a=W$(t,i,e));let l=t.docView.nearestDesc(i,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function sb(t){return t.top<t.bottom||t.left<t.right}function Zr(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(sb(r))return r}return Array.prototype.find.call(n,sb)||t.getBoundingClientRect()}const K$=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function J1(t,e,n){let{node:r,offset:o,atom:s}=t.docView.domFromPos(e,n<0?-1:1),i=Za||zn;if(r.nodeType==3)if(i&&(K$.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let l=Zr(Nr(r,o,o),n);if(zn&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=Zr(Nr(r,o-1,o-1),-1);if(c.top==l.top){let u=Zr(Nr(r,o,o+1),-1);if(u.top!=l.top)return Fi(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++,Fi(Zr(Nr(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&o&&(n<0||o==$n(r))){let l=r.childNodes[o-1];if(l.nodeType==1)return yf(l.getBoundingClientRect(),!1)}if(s==null&&o<$n(r)){let l=r.childNodes[o];if(l.nodeType==1)return yf(l.getBoundingClientRect(),!0)}return yf(r.getBoundingClientRect(),n>=0)}if(s==null&&o&&(n<0||o==$n(r))){let l=r.childNodes[o-1],c=l.nodeType==3?Nr(l,$n(l)-(i?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Fi(Zr(c,1),!1)}if(s==null&&o<$n(r)){let l=r.childNodes[o];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Nr(l,0,i?0:1):l.nodeType==1?l:null:null;if(c)return Fi(Zr(c,-1),!0)}return Fi(Zr(r.nodeType==3?Nr(r):r,-n),n>=0)}function Fi(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 yf(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 X1(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 Y$(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return X1(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=J1(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=Nr(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 G$=/[\u0590-\u08ac]/;function Z$(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?!G$.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:i:X1(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:m}=t.domSelectionRange(),g=p&&!h.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==m;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),g}):r.pos==r.start()||r.pos==r.end()}let ib=null,ab=null,lb=!1;function J$(t,e,n){return ib==e&&ab==n?lb:(ib=e,ab=n,lb=n=="up"||n=="down"?Y$(t,e,n):Z$(t,e,n))}const Ln=0,cb=1,Ko=2,dr=3;class Ja{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=Ln,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>Kt(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 eS){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 Q1&&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?Kt(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?Kt(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=Kt(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=Kt(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 m=this.children[h],g=p+m.size;if(s>p&&i<g)return m.setSelection(e-p-m.border,n-p-m.border,r,o);p=g}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((zn||Qt)&&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 m=h,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=l={node:g.parentNode,offset:Kt(g)+1});break}let y=m.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let m=h.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(zn&&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&&Qt)&&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&&zn)){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:cb,e==a&&n==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=dr:s.markDirty(e-a,n-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Ko:dr}r=i}this.dirty=Ko}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Ko:cb;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Q1 extends Ja{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==Ln&&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 X$ extends Ja{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 Ja{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&dr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=dr&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Ln){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Ln}}slice(e,n,r){let o=ps.create(this.parent,this.mark,!0,r),s=this.children,i=this.size;n<i&&(s=Ih(s,n,i,r)),e>0&&(s=Ih(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 mo extends Ja{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=rS(u,r,n),c?l=new Q$(e,n,r,o,u,d||null,f,c,s,i+1):n.isText?new wd(e,n,r,o,u,f,s):new mo(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=()=>ie.empty)}return e}matchesNode(e,n,r){return this.dirty==Ln&&e.eq(this.node)&&ou(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 tD(this,i&&i.node,e);oD(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?ut.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),tS(this.contentDOM,this.children,e),ki&&sD(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof Pe)||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=iD(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 X$(this,s,n,o);e.input.compositionNodes.push(i),this.children=Ih(this.children,r,r+o.length,e,i)}update(e,n,r,o){return this.dirty==dr||!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=Ln}updateOuterDeco(e){if(ou(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=nS(this.dom,this.nodeDOM,Ah(this.outerDeco,this.node,n),Ah(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 ub(t,e,n,r,o){rS(r,e,t);let s=new mo(void 0,t,e,n,r,r,r,o,0);return s.contentDOM&&s.updateChildren(o,0),s}class wd extends mo{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==dr||this.dirty!=Ln&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Ln||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=Ln,!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=dr)}get domAtom(){return!1}isText(e){return this.node.text==e}}class eS extends Ja{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Ln&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Q$ extends mo{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==dr)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 tS(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=db(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(a,r);if(i instanceof ps){let l=r?r.previousSibling:t.lastChild;tS(i.contentDOM,i.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=db(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const ha=function(t){t&&(this.nodeName=t)};ha.prototype=Object.create(null);const Yo=[new ha];function Ah(t,e,n){if(t.length==0)return Yo;let r=n?Yo[0]:new ha,o=[r];for(let s=0;s<t.length;s++){let i=t[s].type.attrs;if(i){i.nodeName&&o.push(r=new ha(i.nodeName));for(let a in i){let l=i[a];l!=null&&(n&&o.length==1&&o.push(r=new ha(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 nS(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}eD(o,a||Yo[0],i)}return o}function eD(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 rS(t,e,n){return nS(t,t,Yo,Ah(e,n,t.nodeType!=1))}function ou(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 db(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class tD{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=nD(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=Ln,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==dr&&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 mo){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!=dr&&ou(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=Ln),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)||!ou(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let a=mo.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=mo.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 Q1(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))&&((Qt||Gt)&&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 eS(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 nD(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 rD(t,e){return t.type.side-e.type.side}function oD(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 g=o[i++];g.widget&&(u?(d||(d=[u])).push(g):u=g)}if(u)if(d){d.sort(rD);for(let g=0;g<d.length;g++)n(d[g],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 g=0;g<a.length;g++)a[g].to<=s&&a.splice(g--,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 g=p;i<o.length&&o[i].from<g&&(g=o[i].from);for(let y=0;y<a.length;y++)a[y].to<g&&(g=a[y].to);g<p&&(l=f.cut(g-s),f=f.cut(0,g-s),p=g,h=-1)}else for(;i<o.length&&o[i].to<p;)i++;let m=f.isInline&&!f.isLeaf?a.filter(g=>!g.inline):a.slice();r(f,m,e.forChild(s,f),h),s=p}}function sD(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 iD(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 Ih(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 ym(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&&Te.isSelectable(d)&&o.parent&&!(d.isInline&&A$(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;c=new Te(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=bm(t,u,a,d)}return c}function oS(t){return t.editable?t.hasFocus():iS(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Dr(t,e=!1){let n=t.state.selection;if(sS(t,n),!!oS(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Gt){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)lD(t);else{let{anchor:r,head:o}=n,s,i;fb&&!(n instanceof Pe)&&(n.$from.parent.inlineContent||(s=hb(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(i=hb(t,n.to))),t.docView.setSelection(r,o,t,e),fb&&(s&&pb(s),i&&pb(i)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&aD(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const fb=Qt||Gt&&q1<63;function hb(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(Qt&&o&&o.contentEditable=="false")return bf(o);if((!o||o.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(o)return bf(o);if(s)return bf(s)}}function bf(t){return t.contentEditable="true",Qt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function pb(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function aD(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(()=>{(!oS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function lD(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Kt(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&bn&&po<=11&&(n.disabled=!0,n.disabled=!1)}function sS(t,e){if(e instanceof Te){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(mb(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else mb(t)}function mb(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function bm(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||Pe.between(e,n,r)}function gb(t){return t.editable&&!t.hasFocus()?!1:iS(t)}function iS(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 cD(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 $h(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&&je.findFrom(s,e)}function Jr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function yb(t,e,n){let r=t.state.selection;if(r instanceof Pe)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 Jr(t,new Pe(r.$anchor,i))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=$h(t.state,e);return o&&o instanceof Te?Jr(t,o):!1}else if(!(In&&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?Te.isSelectable(s)?Jr(t,new Te(e<0?t.state.doc.resolve(o.pos-s.nodeSize):o)):Za?Jr(t,new Pe(t.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Te&&r.node.isInline)return Jr(t,new Pe(e>0?r.$to:r.$from));{let o=$h(t.state,e);return o?Jr(t,o):!1}}}function su(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function pa(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function As(t,e){return e<0?uD(t):dD(t)}function uD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,s,i=!1;for(zn&&n.nodeType==1&&r<su(n)&&pa(n.childNodes[r],-1)&&(i=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(pa(a,-1))o=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(aS(n))break;{let a=n.previousSibling;for(;a&&pa(a,-1);)o=n.parentNode,s=Kt(a),a=a.previousSibling;if(a)n=a,r=su(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}i?Dh(t,n,r):o&&Dh(t,o,s)}function dD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=su(n),s,i;for(;;)if(r<o){if(n.nodeType!=1)break;let a=n.childNodes[r];if(pa(a,1))s=n,i=++r;else break}else{if(aS(n))break;{let a=n.nextSibling;for(;a&&pa(a,1);)s=a.parentNode,i=Kt(a)+1,a=a.nextSibling;if(a)n=a,r=0,o=su(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}s&&Dh(t,s,i)}function aS(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function fD(t,e){for(;t&&e==t.childNodes.length&&!Ga(t);)e=Kt(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 hD(t,e){for(;t&&!e&&!Ga(t);)e=Kt(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 Dh(t,e,n){if(e.nodeType!=3){let s,i;(i=fD(e,n))?(e=i,n=0):(s=hD(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&&Dr(t)},50)}function bb(t,e){let n=t.state.doc.resolve(e);if(!(Gt||U1)&&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 vb(t,e,n){let r=t.state.selection;if(r instanceof Pe&&!r.empty||n.indexOf("s")>-1||In&&n.indexOf("m")>-1)return!1;let{$from:o,$to:s}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let i=$h(t.state,e);if(i&&i instanceof Te)return Jr(t,i)}if(!o.parent.inlineContent){let i=e<0?o:s,a=r instanceof Mn?je.near(i,e):je.findFrom(i,e);return a?Jr(t,a):!1}return!1}function wb(t,e){if(!(t.state.selection instanceof Pe))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 kb(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function pD(t){if(!Qt||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;kb(t,r,"true"),setTimeout(()=>kb(t,r,"false"),20)}return!1}function mD(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function gD(t,e){let n=e.keyCode,r=mD(e);if(n==8||In&&n==72&&r=="c")return wb(t,-1)||As(t,-1);if(n==46&&!e.shiftKey||In&&n==68&&r=="c")return wb(t,1)||As(t,1);if(n==13||n==27)return!0;if(n==37||In&&n==66&&r=="c"){let o=n==37?bb(t,t.state.selection.from)=="ltr"?-1:1:-1;return yb(t,o,r)||As(t,o)}else if(n==39||In&&n==70&&r=="c"){let o=n==39?bb(t,t.state.selection.from)=="ltr"?1:-1:1;return yb(t,o,r)||As(t,o)}else{if(n==38||In&&n==80&&r=="c")return vb(t,-1,r)||As(t,-1);if(n==40||In&&n==78&&r=="c")return pD(t)||vb(t,1,r)||As(t,1);if(r==(In?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function vm(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=hS(),l=a.createElement("div");l.appendChild(i.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=fS[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 lS(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 me(ie.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(m=>{let g=i.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),i=wD(n),Za&&kD(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")||ho.fromSchema(t.state.schema)).parseSlice(i,{preserveWhitespace:!!(l||u),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!yD.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=xD(xb(a,+u[1],+u[2]),u[4]);else if(a=me.maxOpen(bD(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=xb(a,d,f)}return t.someProp("transformPasted",d=>{a=d(a,t,l)}),a}const yD=/^(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 bD(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&&uS(l,s,a,i[i.length-1],0))i[i.length-1]=c;else{i.length&&(i[i.length-1]=dS(i[i.length-1],s.length));let u=cS(a,l);i.push(u),o=o.matchType(u.type),s=l}}),i)return ie.from(i)}return t}function cS(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,ie.from(t));return t}function uS(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let s=uS(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(ie.from(cS(n,t,o+1))))}}function dS(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,dS(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(ie.empty,!0);return t.copy(n.append(r))}function zh(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=zh(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(ie.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,i.copy(a))}function xb(t,e,n){return e<t.openStart&&(t=new me(zh(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new me(zh(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const fS={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 Sb=null;function hS(){return Sb||(Sb=document.implementation.createHTMLDocument("title"))}let vf=null;function vD(t){let e=window.trustedTypes;return e?(vf||(vf=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),vf.createHTML(t)):t}function wD(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=hS().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&fS[r[1].toLowerCase()])&&(t=o.map(s=>"<"+s+">").join("")+t+o.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=vD(t),o)for(let s=0;s<o.length;s++)n=n.querySelector(o[s])||n;return n}function kD(t){let e=t.querySelectorAll(Gt?"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 xD(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=ie.from(l.create(r[a+1],o)),s++,i++}return new me(o,s,i)}const cn={},un={},SD={touchstart:!0,touchmove:!0};class ED{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 CD(t){for(let e in cn){let n=cn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{MD(t,r)&&!wm(t,r)&&(t.editable||!(r.type in un))&&n(t,r)},SD[e]?{passive:!0}:void 0)}Qt&&t.dom.addEventListener("input",()=>null),Lh(t)}function so(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function TD(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 Lh(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>wm(t,r))})}function wm(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function MD(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 RD(t,e){!wm(t,e)&&cn[e.type]&&(t.editable||!(e.type in un))&&cn[e.type](t,e)}un.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!mS(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(_r&&Gt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ki&&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))||gD(t,n)?n.preventDefault():so(t,"key")};un.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};un.keypress=(t,e)=>{let n=e;if(mS(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||In&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Pe)||!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 OD(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function km(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 ii(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 ND(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Te.isSelectable(r)?(ii(t,new Te(n)),!0):!1}function _D(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof Te&&(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(Te.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?(ii(t,Te.create(t.state.doc,o)),!0):!1}function PD(t,e,n,r,o){return km(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(o?_D(t,n):ND(t,n))}function AD(t,e,n,r){return km(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function ID(t,e,n,r){return km(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||$D(t,n,r)}function $D(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(ii(t,Pe.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)ii(t,Pe.create(r,a+1,a+1+i.content.size));else if(Te.isSelectable(i))ii(t,Te.create(r,a));else continue;return!0}}function xm(t){return iu(t)}const pS=In?"metaKey":"ctrlKey";cn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=xm(t),o=Date.now(),s="singleClick";o-t.input.lastClick.time<500&&OD(n,t.input.lastClick)&&!n[pS]&&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 DD(t,i,n,!!r)):(s=="doubleClick"?AD:ID)(t,i.pos,i.inside,n)?n.preventDefault():so(t,"pointer"))};class DD{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[pS],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 Te&&c.from<=i&&c.to>i)&&(this.mightDrag={node:s,pos:i,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&zn&&!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)),so(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(()=>Dr(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?so(this.view,"pointer"):PD(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Qt&&this.mightDrag&&!this.mightDrag.node.isAtom||Gt&&!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)?(ii(this.view,je.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):so(this.view,"pointer")}move(e){this.updateAllowDefault(e),so(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)}}cn.touchstart=t=>{t.input.lastTouch=Date.now(),xm(t),so(t,"pointer")};cn.touchmove=t=>{t.input.lastTouch=Date.now(),so(t,"pointer")};cn.contextmenu=t=>xm(t);function mS(t,e){return t.composing?!0:Qt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const zD=_r?5e3:-1;un.compositionstart=un.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Pe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Gt&&U1&&LD(t)))t.markCursor=t.state.storedMarks||n.marks(),iu(t,!0),t.markCursor=null;else if(iu(t,!e.selection.empty),zn&&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}gS(t,zD)};function LD(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"}un.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++,gS(t,20))};function gS(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>iu(t),e))}function yS(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=FD());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function jD(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=_$(e.focusNode,e.focusOffset),r=P$(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 FD(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function iu(t,e=!1){if(!(_r&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),yS(t),e||t.docView&&t.docView.dirty){let n=ym(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 BD(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 Aa=bn&&po<15||ki&&D$<604;cn.copy=un.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let s=Aa?null:n.clipboardData,i=r.content(),{dom:a,text:l}=vm(t,i);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):BD(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function VD(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function HD(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?Ia(t,r.value,null,o,e):Ia(t,r.textContent,r.innerHTML,o,e)},50)}function Ia(t,e,n,r,o){let s=lS(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,o,s||me.empty)))return!0;if(!s)return!1;let i=VD(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 bS(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," "):""}un.paste=(t,e)=>{let n=e;if(t.composing&&!_r)return;let r=Aa?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Ia(t,bS(r),r.getData("text/html"),o,n)?n.preventDefault():HD(t,n)};class vS{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const WD=In?"altKey":"ctrlKey";function wS(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[WD]}cn.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 Te?o.to-1:o.to))){if(r&&r.mightDrag)i=Te.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=Te.create(t.state.doc,d.posBefore))}}let a=(i||t.state.selection).content(),{dom:l,text:c,slice:u}=vm(t,a);(!n.dataTransfer.files.length||!Gt||q1>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Aa?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Aa||n.dataTransfer.setData("text/plain",c),t.dragging=new vS(u,wS(t,n),i)};cn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};un.dragover=un.dragenter=(t,e)=>e.preventDefault();un.drop=(t,e)=>{try{qD(t,e,t.dragging)}finally{t.dragging=null}};function qD(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=lS(t,bS(e.dataTransfer),Aa?null:e.dataTransfer.getData("text/html"),!1,o);let i=!!(n&&wS(t,e));if(t.someProp("handleDrop",h=>h(t,e,s||me.empty,i))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?E1(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&&Te.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new Te(f));else{let h=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((p,m,g,y)=>h=y),l.setSelection(bm(t,f,l.doc.resolve(h)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}cn.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())&&Dr(t)},20))};cn.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)};cn.beforeinput=(t,e)=>{if(Gt&&_r&&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 un)cn[t]=un[t];function $a(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 au{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 sn(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof au&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&$a(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class go{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 sn(s,i,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof go&&$a(this.attrs,e.attrs)&&$a(this.spec,e.spec)}static is(e){return e.type instanceof go}destroy(){}}class Sm{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 sn(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 Sm&&$a(this.attrs,e.attrs)&&$a(this.spec,e.spec)}destroy(){}}class sn{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new sn(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 sn(e,e,new au(n,r))}static inline(e,n,r,o){return new sn(e,n,new go(r,o))}static node(e,n,r,o){return new sn(e,n,new Sm(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof go}get widget(){return this.type instanceof au}}const Vs=[],ts={};class gt{constructor(e,n){this.local=e.length?e:Vs,this.children=n.length?n:Vs}static create(e,n){return n.length?lu(n,e,0,ts):Zt}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==Zt||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?UD(this.children,i||[],e,n,r,o,s):i?new gt(i.sort(ns),Vs):Zt}add(e,n){return n.length?this==Zt?gt.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=xS(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,lu(u,a,c+1,ts)),s+=3}});let i=kS(s?SS(n):n,-r);for(let a=0;a<i.length;a++)i[a].type.valid(e,i[a])||i.splice(a--,1);return new gt(i.length?this.local.concat(i).sort(ns):this.local,o||this.children)}remove(e){return e.length==0||this==Zt?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!=Zt?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 gt(o,r):Zt}forChild(e,n){if(this==Zt)return this;if(n.isLeaf)return gt.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 go){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 gt(o.sort(ns),Vs);return r?new eo([a,r]):a}return r||Zt}eq(e){if(this==e)return!0;if(!(e instanceof gt)||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 Em(this.localsInner(e))}localsInner(e){if(this==Zt)return Vs;if(e.inlineContent||!this.local.some(go.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof go||n.push(this.local[r]);return n}forEachSet(e){e(this)}}gt.empty=new gt([],[]);gt.removeOverlap=Em;const Zt=gt.empty;class eo{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,ts));return eo.from(r)}forChild(e,n){if(n.isLeaf)return gt.empty;let r=[];for(let o=0;o<this.members.length;o++){let s=this.members[o].forChild(e,n);s!=Zt&&(s instanceof eo?r=r.concat(s.members):r.push(s))}return eo.from(r)}eq(e){if(!(e instanceof eo)||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?Em(r?n:n.sort(ns)):Vs}static from(e){switch(e.length){case 0:return Zt;case 1:return e[0];default:return new eo(e.every(n=>n instanceof gt)?e:e.reduce((n,r)=>n.concat(r instanceof gt?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function UD(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,m)=>{let g=m-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&&g&&(a[y]+=g,a[y+1]+=g)}d+=g}),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:m}=r.content.findIndex(d),g=r.maybeChild(p);if(g&&m==d&&m+g.nodeSize==h){let y=a[c+2].mapInner(n,g,u+1,t[c]+s+1,i);y!=Zt?(a[c]=d,a[c+1]=h,a[c+2]=y):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=KD(a,t,e,n,o,s,i),u=lu(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 gt(e.sort(ns),a)}function kS(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 sn(o.from+e,o.to+e,o.type))}return n}function KD(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 xS(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 SS(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function lu(t,e,n,r){let o=[],s=!1;e.forEach((a,l)=>{let c=xS(t,a,l+n);if(c){s=!0;let u=lu(c,a,n+l+1,r);u!=Zt&&o.push(l,l+a.nodeSize,u)}});let i=kS(s?SS(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 gt(i,o):Zt}function ns(t,e){return t.from-e.from||t.to-e.to}function Em(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),Eb(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),Eb(e,o,r.copy(s.from,r.to)));break}}}return e}function Eb(t,e,n){for(;e<t.length&&ns(n,t[e])>0;)e++;t.splice(e,0,n)}function wf(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Zt&&e.push(r)}),t.cursorWrapper&&e.push(gt.create(t.state.doc,[t.cursorWrapper.deco])),eo.from(e)}const YD={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},GD=bn&&po<=11;let ZD=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 JD{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ZD,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]);bn&&po<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():Qt&&e.composing&&r.some(o=>o.type=="childList"&&o.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),GD&&(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,YD)),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(gb(this.view)){if(this.suppressingSelectionUpdates)return Dr(this.view);if(bn&&po<=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=wi(s))n.add(s);for(let s=e.anchorNode;s;s=wi(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)&&gb(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(zn&&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||e2(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=ym(e))&&c.eq(je.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Dr(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||o)&&(s>-1&&(e.docView.markDirty(s,i),XD(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,t2(e,l)),this.handleDOMChange(s,i,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Dr(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(bn&&po<=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?Kt(o)+1:0,a=r.localPosFromDOM(e.target,i,-1),l=s&&s.parentNode==e.target?Kt(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 Cb=new WeakMap,Tb=!1;function XD(t){if(!Cb.has(t)&&(Cb.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=zn,Tb)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."),Tb=!0}}function Mb(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 QD(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return Mb(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?Mb(t,n):null}function e2(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 t2(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 n2(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})),Gt&&t.input.lastKeyCode===8)for(let g=s;g>o;g--){let y=r.childNodes[g-1],b=y.pmViewDesc;if(y.nodeName=="BR"&&!b){s=g;break}if(!b||b.size)break}let d=t.state.doc,f=t.someProp("domParser")||ho.fromSchema(t.state.schema),h=d.resolve(i),p=null,m=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:r2,context:h});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),p={anchor:g+i,head:y+i}}return{doc:m,sel:p,from:i,to:a}}function r2(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Qt&&/^(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||Qt&&/^(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 o2=/^(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 s2(t,e,n,r,o){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let S=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,T=ym(t,S);if(T&&!t.state.selection.eq(T)){if(Gt&&_r&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",L=>L(t,Ho(13,"Enter"))))return;let I=t.state.tr.setSelection(T);S=="pointer"?I.setMeta("pointer",!0):S=="key"&&I.scrollIntoView(),s&&I.setMeta("composition",s),t.dispatch(I)}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=n2(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=l2(d.content,c.doc.content,c.from,f,h);if(p&&t.input.domChangeCount++,(ki&&t.input.lastIOSEnter>Date.now()-225||_r)&&o.some(S=>S.nodeType==1&&!o2.test(S.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",S=>S(t,Ho(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof Pe&&!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 S=Rb(t,t.state.doc,c.sel);if(S&&!S.eq(t.state.selection)){let T=t.state.tr.setSelection(S);s&&T.setMeta("composition",s),t.dispatch(T)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof Pe&&(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)),bn&&po<=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 m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),y=u.resolve(p.start),b=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA;if((ki&&t.input.lastIOSEnter>Date.now()-225&&(!b||o.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!b&&m.pos<c.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(c.doc.textBetween(m.pos,g.pos,"","")))&&t.someProp("handleKeyDown",S=>S(t,Ho(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&a2(u,p.start,p.endA,m,g)&&t.someProp("handleKeyDown",S=>S(t,Ho(8,"Backspace")))){_r&&Gt&&t.domObserver.suppressSelectionUpdates();return}Gt&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),_r&&!b&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(S){return S(t,Ho(13,"Enter"))})},20));let w=p.start,k=p.endA,v=S=>{let T=S||t.state.tr.replace(w,k,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let I=Rb(t,T.doc,c.sel);I&&!(Gt&&t.composing&&I.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(I.head==w||I.head==T.mapping.map(k)-1)||bn&&I.empty&&I.head==w)&&T.setSelection(I)}return s&&T.setMeta("composition",s),T.scrollIntoView()},x;if(b)if(m.pos==g.pos){bn&&po<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Dr(t),20));let S=v(t.state.tr.delete(w,k)),T=u.resolve(p.start).marksAcross(u.resolve(p.endA));T&&S.ensureMarks(T),t.dispatch(S)}else if(p.endA==p.endB&&(x=i2(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let S=v(t.state.tr);x.type=="add"?S.addMark(w,k,x.mark):S.removeMark(w,k,x.mark),t.dispatch(S)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let S=m.parent.textBetween(m.parentOffset,g.parentOffset),T=()=>v(t.state.tr.insertText(S,w,k));t.someProp("handleTextInput",I=>I(t,w,k,S,T))||t.dispatch(T())}else t.dispatch(v());else t.dispatch(v())}function Rb(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:bm(t,e.resolve(n.anchor),e.resolve(n.head))}function i2(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(ie.from(c).eq(t))return{mark:a,type:i}}function a2(t,e,n,r,o){if(n-e<=o.pos-r.pos||kf(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(kf(s,!0,!0));return!i.parent.isTextblock||i.pos>n||kf(i,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(i.parent.content)}function kf(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 l2(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&&Ob(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&&Ob(t.textBetween(s-1,s+1))&&(s+=l?1:-1),i=s+(i-a),a=s}return{start:s,endA:i,endB:a}}function Ob(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 ES{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 ED,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Ib),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=Pb(this),_b(this),this.nodeViews=Ab(this),this.docView=ub(this.state.doc,Nb(this),wf(this),this.dom,this),this.domObserver=new JD(this,(r,o,s,i)=>s2(this,r,o,s,i)),this.domObserver.start(),CD(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&&Lh(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Ib),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&&(yS(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=Ab(this);u2(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Lh(this),this.editable=Pb(this),_b(this);let l=wf(this),c=Nb(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&&j$(this);if(i){this.domObserver.stop();let h=d&&(bn||Gt)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&c2(o.selection,e.selection);if(d){let p=Gt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=jD(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=ub(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())&&cD(this))?Dr(this,h):(sS(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&&F$(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 Te){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&ob(this,n.getBoundingClientRect(),e)}else ob(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 vS(e.slice,e.move,o<0?void 0:Te.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(bn){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&&B$(this.dom),Dr(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 U$(this,e)}coordsAtPos(e,n=1){return J1(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 J$(this,n||this.state,e)}pasteHTML(e,n){return Ia(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Ia(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return vm(this,e)}destroy(){this.docView&&(TD(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],wf(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,O$())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return RD(this,e)}domSelectionRange(){let e=this.domSelection();return e?Qt&&this.root.nodeType===11&&I$(this.dom.ownerDocument)==this.dom&&QD(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}ES.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Nb(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"),[sn.node(0,t.state.doc.content.size,e)]}function _b(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:sn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Pb(t){return!t.someProp("editable",e=>e(t.state)===!1)}function c2(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 Ab(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 u2(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 Ib(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 bo={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:"'"},cu={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},d2=typeof navigator<"u"&&/Mac/.test(navigator.platform),f2=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Yt=0;Yt<10;Yt++)bo[48+Yt]=bo[96+Yt]=String(Yt);for(var Yt=1;Yt<=24;Yt++)bo[Yt+111]="F"+Yt;for(var Yt=65;Yt<=90;Yt++)bo[Yt]=String.fromCharCode(Yt+32),cu[Yt]=String.fromCharCode(Yt);for(var xf in bo)cu.hasOwnProperty(xf)||(cu[xf]=bo[xf]);function h2(t){var e=d2&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||f2&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?cu:bo)[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 p2=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),m2=typeof navigator<"u"&&/Win/.test(navigator.platform);function g2(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))p2?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 y2(t){let e=Object.create(null);for(let n in t)e[g2(n)]=t[n];return e}function Sf(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 b2(t){return new bt({props:{handleKeyDown:CS(t)}})}function CS(t){let e=y2(t);return function(n,r){let o=h2(r),s,i=e[Sf(o,r)];if(i&&i(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=e[Sf(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(m2&&r.ctrlKey&&r.altKey)&&(s=bo[r.keyCode])&&s!=o){let a=e[Sf(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var v2=Object.defineProperty,Cm=(t,e)=>{for(var n in e)v2(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 m=this.buildProps(l,e),g=f(...p)(m);return i.push(g),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}},TS={};Cm(TS,{blur:()=>w2,clearContent:()=>k2,clearNodes:()=>x2,command:()=>S2,createParagraphNear:()=>E2,cut:()=>C2,deleteCurrentNode:()=>T2,deleteNode:()=>M2,deleteRange:()=>R2,deleteSelection:()=>O2,enter:()=>N2,exitCode:()=>_2,extendMarkRange:()=>P2,first:()=>A2,focus:()=>$2,forEach:()=>D2,insertContent:()=>z2,insertContentAt:()=>F2,joinBackward:()=>H2,joinDown:()=>V2,joinForward:()=>W2,joinItemBackward:()=>q2,joinItemForward:()=>U2,joinTextblockBackward:()=>K2,joinTextblockForward:()=>Y2,joinUp:()=>B2,keyboardShortcut:()=>Z2,lift:()=>J2,liftEmptyBlock:()=>X2,liftListItem:()=>Q2,newlineInCode:()=>ez,resetAttributes:()=>tz,scrollIntoView:()=>nz,selectAll:()=>rz,selectNodeBackward:()=>oz,selectNodeForward:()=>sz,selectParentNode:()=>iz,selectTextblockEnd:()=>az,selectTextblockStart:()=>lz,setContent:()=>cz,setMark:()=>Nz,setMeta:()=>_z,setNode:()=>Pz,setNodeSelection:()=>Az,setTextDirection:()=>Iz,setTextSelection:()=>$z,sinkListItem:()=>Dz,splitBlock:()=>zz,splitListItem:()=>Lz,toggleList:()=>jz,toggleMark:()=>Fz,toggleNode:()=>Bz,toggleWrap:()=>Vz,undoInputRule:()=>Hz,unsetAllMarks:()=>Wz,unsetMark:()=>qz,unsetTextDirection:()=>Uz,updateAttributes:()=>Kz,wrapIn:()=>Yz,wrapInList:()=>Gz});var w2=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),k2=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),x2=()=>({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=Di(h);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},S2=t=>e=>t(e),E2=()=>({state:t,dispatch:e})=>F1(t,e),C2=(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 Pe(r.doc.resolve(Math.max(i-1,0)))),!0},T2=()=>({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 Nt(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 M2=t=>({tr:e,state:n,dispatch:r})=>{const o=Nt(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},R2=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},O2=()=>({state:t,dispatch:e})=>dm(t,e),N2=()=>({commands:t})=>t.keyboardShortcut("Enter"),_2=()=>({state:t,dispatch:e})=>p$(t,e);function Tm(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function uu(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:Tm(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function MS(t,e,n={}){return t.find(r=>r.type===e&&uu(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function $b(t,e,n={}){return!!MS(t,e,n)}function Mm(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),!MS([...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&&$b([...t.parent.child(i-1).marks],e,n);)i-=1,a-=t.parent.child(i).nodeSize;for(;l<t.parent.childCount&&$b([...t.parent.child(l).marks],e,n);)c+=t.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function Br(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 P2=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const s=Br(t,r.schema),{doc:i,selection:a}=n,{$from:l,from:c,to:u}=a;if(o){const d=Mm(l,s,e);if(d&&d.from<=c&&d.to>=u){const f=Pe.create(i,d.from,d.to);n.setSelection(f)}}return!0},A2=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 RS(t){return t instanceof Pe}function Go(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function OS(t,e=null){if(!e)return null;const n=je.atStart(t),r=je.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const o=n.from,s=r.to;return e==="all"?Pe.create(t,Go(0,o,s),Go(t.content.size,o,s)):Pe.create(t,Go(e,o,s),Go(e,o,s))}function Db(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function du(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function I2(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var $2=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:s})=>{e={scrollIntoView:!0,...e};const i=()=>{(du()||Db())&&r.dom.focus(),I2()&&!du()&&!Db()&&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&&!RS(n.state.selection))return i(),!0;const a=OS(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},D2=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),z2=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),NS=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&&NS(r)}return t};function El(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 NS(n)}function Da(t,e,n){if(t instanceof fo||t instanceof ie)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 ie.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),Da("",e,n)}if(o){if(n.errorOnInvalidContent){let i=!1,a="";const l=new h1({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?ho.fromSchema(l).parseSlice(El(t),n.parseOptions):ho.fromSchema(l).parse(El(t),n.parseOptions),n.errorOnInvalidContent&&i)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=ho.fromSchema(e);return n.slice?s.parseSlice(El(t),n.parseOptions).content:s.parse(El(t),n.parseOptions)}return Da("",e,n)}function L2(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof jt||o instanceof Bt))return;const s=t.mapping.maps[r];let i=0;s.forEach((a,l,c,u)=>{i===0&&(i=u)}),t.setSelection(je.near(t.doc.resolve(i),n))}var j2=t=>!("type"in t),F2=(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=g=>{s.emit("contentError",{editor:s,error:g,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{Da(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(g){l(g)}try{a=Da(e,s.schema,{parseOptions:c,errorOnInvalidContent:(i=n.errorOnInvalidContent)!=null?i:s.options.enableContentCheck})}catch(g){return l(g),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;if((j2(a)?a:[a]).forEach(g=>{g.check(),f=f?g.isText&&g.marks.length===0:!1,h=h?g.isBlock:!1}),u===d&&h){const{parent:g}=r.doc.resolve(u);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(u-=1,d+=1)}let m;if(f){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof ie){let g="";e.forEach(y=>{y.text&&(g+=y.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,u,d)}else{m=a;const g=r.doc.resolve(u),y=g.node(),b=g.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,m)}n.updateSelection&&L2(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:m})}return!0},B2=()=>({state:t,dispatch:e})=>d$(t,e),V2=()=>({state:t,dispatch:e})=>f$(t,e),H2=()=>({state:t,dispatch:e})=>A1(t,e),W2=()=>({state:t,dispatch:e})=>z1(t,e),q2=()=>({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}},U2=()=>({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}},K2=()=>({state:t,dispatch:e})=>c$(t,e),Y2=()=>({state:t,dispatch:e})=>u$(t,e);function _S(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function G2(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))du()||_S()?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 Z2=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const s=G2(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 vo(t,e,n={}){const{from:r,to:o,empty:s}=t.selection,i=e?Nt(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=>uu(d.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}var J2=(t,e={})=>({state:n,dispatch:r})=>{const o=Nt(t,n.schema);return vo(n,o,e)?h$(n,r):!1},X2=()=>({state:t,dispatch:e})=>B1(t,e),Q2=t=>({state:e,dispatch:n})=>{const r=Nt(t,e.schema);return C$(r)(e,n)},ez=()=>({state:t,dispatch:e})=>j1(t,e);function Ed(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function zb(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 tz=(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=Nt(t,r.schema)),a==="mark"&&(i=Br(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,zb(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(zb(f.attrs,e))))})})}),l},nz=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),rz=()=>({tr:t,dispatch:e})=>{if(e){const n=new Mn(t.doc);t.setSelection(n)}return!0},oz=()=>({state:t,dispatch:e})=>$1(t,e),sz=()=>({state:t,dispatch:e})=>L1(t,e),iz=()=>({state:t,dispatch:e})=>y$(t,e),az=()=>({state:t,dispatch:e})=>w$(t,e),lz=()=>({state:t,dispatch:e})=>v$(t,e);function jh(t,e,n={},r={}){return Da(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var cz=(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=jh(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 PS(t,e){const n=Br(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 AS(t,e){const n=new O1(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function uz(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 dz(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(o,s)=>{n(o)&&r.push({node:o,pos:s})}),r}function fz(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=>fz(e.$from,t)}function Ee(t,e,n){return t.config[e]===void 0&&t.parent?Ee(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Ee(t.parent,e,n):null}):t.config[e]}function Rm(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=Ee(e,"addExtensions",n);return r?[e,...Rm(r())]:e}).flat(10)}function Om(t,e){const n=Es.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function IS(t){return typeof t=="function"}function Qe(t,e=void 0,...n){return IS(t)?e?t.bind(e)(...n):t(...n):t}function hz(t={}){return Object.keys(t).length===0&&t.constructor===Object}function xi(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 $S(t){const e=[],{nodeExtensions:n,markExtensions:r}=xi(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=Ee(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(m=>{Object.entries(h.attributes).forEach(([g,y])=>{e.push({type:m,name:g,attribute:{...s,...y}})})})})}),o.forEach(c=>{const u={name:c.name,options:c.options,storage:c.storage},d=Ee(c,"addAttributes",u);if(!d)return;const f=d();Object.entries(f).forEach(([h,p])=>{const m={...s,...p};typeof m?.default=="function"&&(m.default=m.default()),m?.isRequired&&m?.default===void 0&&delete m.default,e.push({type:c.name,name:h,attribute:m})})}),e}function pz(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 Lb(t){const e=[],n=pz(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 St(...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([...Lb(r[o]),...Lb(s)]);r[o]=Array.from(a.entries()).map(([l,c])=>`${l}: ${c}`).join("; ")}else r[o]=s}),r},{})}function za(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)=>St(n,r),{})}function mz(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function jb(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):mz(n.getAttribute(i.name));return a==null?s:{...s,[i.name]:a}},{});return{...r,...o}}}}function Fb(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&hz(n)?!1:n!=null))}function Bb(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 gz(t,e){var n;const r=$S(t),{nodeExtensions:o,markExtensions:s}=xi(t),i=(n=o.find(c=>Ee(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=Ee(b,"extendNodeSchema",d);return{...y,...w?w(c):{}}},{}),h=Fb({...f,content:Qe(Ee(c,"content",d)),marks:Qe(Ee(c,"marks",d)),group:Qe(Ee(c,"group",d)),inline:Qe(Ee(c,"inline",d)),atom:Qe(Ee(c,"atom",d)),selectable:Qe(Ee(c,"selectable",d)),draggable:Qe(Ee(c,"draggable",d)),code:Qe(Ee(c,"code",d)),whitespace:Qe(Ee(c,"whitespace",d)),linebreakReplacement:Qe(Ee(c,"linebreakReplacement",d)),defining:Qe(Ee(c,"defining",d)),isolating:Qe(Ee(c,"isolating",d)),attrs:Object.fromEntries(u.map(Bb))}),p=Qe(Ee(c,"parseHTML",d));p&&(h.parseDOM=p.map(y=>jb(y,u)));const m=Ee(c,"renderHTML",d);m&&(h.toDOM=y=>m({node:y,HTMLAttributes:za(y,u)}));const g=Ee(c,"renderText",d);return g&&(h.toText=g),[c.name,h]})),l=Object.fromEntries(s.map(c=>{const u=r.filter(g=>g.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=t.reduce((g,y)=>{const b=Ee(y,"extendMarkSchema",d);return{...g,...b?b(c):{}}},{}),h=Fb({...f,inclusive:Qe(Ee(c,"inclusive",d)),excludes:Qe(Ee(c,"excludes",d)),group:Qe(Ee(c,"group",d)),spanning:Qe(Ee(c,"spanning",d)),code:Qe(Ee(c,"code",d)),attrs:Object.fromEntries(u.map(Bb))}),p=Qe(Ee(c,"parseHTML",d));p&&(h.parseDOM=p.map(g=>jb(g,u)));const m=Ee(c,"renderHTML",d);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:za(g,u)})),[c.name,h]}));return new h1({topNode:i,nodes:a,marks:l})}function yz(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function ma(t){return t.sort((n,r)=>{const o=Ee(n,"priority")||100,s=Ee(r,"priority")||100;return o>s?-1:o<s?1:0})}function DS(t){const e=ma(Rm(t)),n=yz(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 zS(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 bz(t,e){const n={from:0,to:t.content.size};return zS(t,n,e)}function LS(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function vz(t,e){const n=Nt(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 jS(t,e){const n=Ed(typeof e=="string"?e:e.name,t.schema);return n==="node"?vz(t,e):n==="mark"?PS(t,e):{}}function wz(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 kz(t){const e=wz(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 FS(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}})})}),kz(r)}function Nm(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const s=n.resolve(t),i=Mm(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 xz=(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 Bi(t,e){return e.nodes[t]||e.marks[t]||null}function Pc(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 Sz=(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 Fh(t,e,n={}){const{empty:r,ranges:o}=t.selection,s=e?Br(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>uu(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,(m,g)=>{if(s&&m.inlineContent&&!m.type.allowsMarkType(s))return!1;if(!m.isText&&!m.marks.length)return;const y=Math.max(h,g),b=Math.min(p,g+m.nodeSize),w=b-y;i+=w,a.push(...m.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=>uu(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 Ez(t,e,n={}){if(!e)return vo(t,null,n)||Fh(t,null,n);const r=Ed(e,t.schema);return r==="node"?vo(t,e,n):r==="mark"?Fh(t,e,n):!1}var Cz=(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)},Tz=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function Vb(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Hb(t,e){const{nodeExtensions:n}=xi(e),r=n.find(i=>i.name===t);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},s=Qe(Ee(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 BS(t){return t instanceof Te}var VS=class HS{constructor(e){this.position=e}static fromJSON(e){return new HS(e.position)}toJSON(){return{position:this.position}}};function Mz(t,e){const n=e.mapping.mapResult(t.position);return{position:new VS(n.pos),mapResult:n}}function Rz(t){return new VS(t)}function Oz(t,e,n){var r;const{selection:o}=e;let s=null;if(RS(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(m=>m.type.excludes(n));c=h&&p}return!c}),c})}var Nz=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:s}=n,{empty:i,ranges:a}=s,l=Br(t,r.schema);if(o)if(i){const c=PS(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),m=Math.min(h+f.nodeSize,d);f.marks.find(y=>y.type===l)?f.marks.forEach(y=>{l===y.type&&n.addMark(p,m,l.create({...y.attrs,...e}))}):n.addMark(p,m,l.create(e))})});return Oz(r,n,l)},_z=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),Pz=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const s=Nt(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})=>tb(s,{...i,...e})(n)?!0:a.clearNodes()).command(({state:a})=>tb(s,{...i,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Az=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,o=Go(t,0,r.content.size),s=Te.create(r,o);e.setSelection(s)}return!0},Iz=(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},$z=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:o,to:s}=typeof t=="number"?{from:t,to:t}:t,i=Pe.atStart(r).from,a=Pe.atEnd(r).to,l=Go(o,i,a),c=Go(s,i,a),u=Pe.create(r,l,c);e.setSelection(u)}return!0},Dz=t=>({state:e,dispatch:n})=>{const r=Nt(t,e.schema);return R$(r)(e,n)};function Wb(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 zz=({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=Pc(c,a.node().type.name,a.node().attrs);if(s instanceof Te&&s.node.isBlock)return!a.parentOffset||!$r(i,a.pos)?!1:(r&&(t&&Wb(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:uz(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=$r(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!p&&$r(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 Pe&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}t&&Wb(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return p},Lz=(t,e={})=>({tr:n,state:r,dispatch:o,editor:s})=>{var i;const a=Nt(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=ie.empty;const b=l.index(-1)?1:l.index(-2)?2:3;for(let T=l.depth-b;T>=l.depth-3;T-=1)y=ie.from(l.node(T).copy(y));const w=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,k={...Pc(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(ie.from(a.createAndFill(null,v)||void 0));const x=l.before(l.depth-(b-1));n.replace(x,l.after(-w),new me(y,4-b,0));let S=-1;n.doc.nodesBetween(x,n.doc.content.size,(T,I)=>{if(S>-1)return!1;T.isTextblock&&T.content.size===0&&(S=I+1)}),S>-1&&n.setSelection(Pe.near(n.doc.resolve(S))),n.scrollIntoView()}return!0}const h=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,p={...Pc(f,d.type.name,d.attrs),...e},m={...Pc(f,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);const g=h?[{type:a,attrs:p},{type:h,attrs:m}]:[{type:a,attrs:p}];if(!$r(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,g).scrollIntoView(),!k||!o)return!0;const v=k.filter(x=>w.includes(x.type.name));n.ensureMarks(v)}return!0},Ef=(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&&Ro(t.doc,n.pos)&&t.join(n.pos),!0},Cf=(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&&Ro(t.doc,r)&&t.join(r),!0},jz=(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=Nt(t,i.schema),p=Nt(e,i.schema),{selection:m,storedMarks:g}=i,{$from:y,$to:b}=m,w=y.blockRange(b),k=g||m.$to.parentOffset&&m.$from.marks();if(!w)return!1;const v=Cd(x=>Hb(x.type.name,d))(m);if(w.depth>=1&&v&&w.depth-v.depth<=1){if(v.node.type===h)return c.liftListItem(p);if(Hb(v.node.type.name,d)&&h.validContent(v.node.content)&&a)return l().command(()=>(s.setNodeMarkup(v.pos,h),!0)).command(()=>Ef(s,h)).command(()=>Cf(s,h)).run()}return!n||!k||!a?l().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>Ef(s,h)).command(()=>Cf(s,h)).run():l().command(()=>{const x=u().wrapInList(h,r),S=k.filter(T=>f.includes(T.type.name));return s.ensureMarks(S),x?!0:c.clearNodes()}).wrapInList(h,r).command(()=>Ef(s,h)).command(()=>Cf(s,h)).run()},Fz=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:s=!1}=n,i=Br(t,r.schema);return Fh(r,i,e)?o.unsetMark(i,{extendEmptyMarkRange:s}):o.setMark(i,e)},Bz=(t,e,n={})=>({state:r,commands:o})=>{const s=Nt(t,r.schema),i=Nt(e,r.schema),a=vo(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})},Vz=(t,e={})=>({state:n,commands:r})=>{const o=Nt(t,n.schema);return vo(n,o,e)?r.lift(o):r.wrapIn(o,e)},Hz=()=>({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},Wz=()=>({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},qz=(t,e={})=>({tr:n,state:r,dispatch:o})=>{var s;const{extendEmptyMarkRange:i=!1}=e,{selection:a}=n,l=Br(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(g=>g.type===l))==null?void 0:s.attrs,m=Mm(c,l,p);m&&(f=m.from,h=m.to),n.removeMark(f,h,l)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},Uz=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},Kz=(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=Nt(t,r.schema)),a==="mark"&&(i=Br(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,m;n.selection.empty?r.doc.nodesBetween(u,d,(g,y)=>{s&&s===g.type&&(l=!0,p=Math.max(y,u),m=Math.min(y+g.nodeSize,d),f=y,h=g)}):r.doc.nodesBetween(u,d,(g,y)=>{y<u&&s&&s===g.type&&(l=!0,p=Math.max(y,u),m=Math.min(y+g.nodeSize,d),f=y,h=g),y>=u&&y<=d&&(s&&s===g.type&&(l=!0,o&&n.setNodeMarkup(y,void 0,{...g.attrs,...e})),i&&g.marks.length&&g.marks.forEach(b=>{if(i===b.type&&(l=!0,o)){const w=Math.max(y,u),k=Math.min(y+g.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(g=>{i===g.type&&o&&n.addMark(p,m,i.create({...g.attrs,...e}))}))}),l},Yz=(t,e={})=>({state:n,dispatch:r})=>{const o=Nt(t,n.schema);return k$(o,e)(n,r)},Gz=(t,e={})=>({state:n,dispatch:r})=>{const o=Nt(t,n.schema);return x$(o,e)(n,r)},Zz=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}},Jz=(t,e)=>{if(Tm(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 Cl(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=Sz(c)+s;return i.forEach(f=>{if(u)return;const h=Jz(d,f.find);if(!h)return;const p=l.state.tr,m=xd({state:l.state,transaction:p}),g={from:r-(h[0].length-s.length),to:o},{commands:y,chain:b,can:w}=new Sd({editor:n,state:m});f.handler({state:m,range:g,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 Xz(t){const{editor:e,rules:n}=t,r=new bt({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=Om(ie.from(u),i.schema);const{from:d}=l,f=d+u.length;Cl({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 Cl({editor:e,from:s,to:i,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:s}=o.state.selection;s&&Cl({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?Cl({editor:e,from:i.pos,to:i.pos,text:`
24
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function Qz(t){return Object.prototype.toString.call(t).slice(8,-1)}function Tl(t){return Qz(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function WS(t,e){const n={...t};return Tl(t)&&Tl(e)&&Object.keys(e).forEach(r=>{Tl(e[r])&&Tl(t[r])?n[r]=WS(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{...Qe(Ee(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Qe(Ee(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>WS(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 qS extends _m{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new qS(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 eL(t){return typeof t=="number"}var tL=class{constructor(t){this.find=t.find,this.handler=t.handler}},nL=(t,e,n)=>{if(Tm(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 rL(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 m,g,y,b,w;if((g=(m=h.type)==null?void 0:m.spec)!=null&&g.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 S=h.isText?h.text||"":h.textBetween(v-p,x-p,void 0,"");nL(S,s.find,i).forEach(I=>{if(I.index===void 0)return;const L=v+I.index+1,N=L+I[0].length,P={from:n.tr.mapping.map(L),to:n.tr.mapping.map(N)},A=s.handler({state:n,range:P,match:I,commands:l,chain:c,can:u,pasteEvent:i,dropEvent:a});d.push(A)})}),d.every(h=>h!==null)}var Ml=null,oL=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function sL(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 m=u.tr,g=xd({state:u,transaction:m});if(!(!rL({editor:e,state:g,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(u=>new bt({view(d){const f=p=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(p.target)?d.dom.parentElement:null,r&&(Ml=e)},h=()=>{Ml&&(Ml=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=Ml;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],m=p.getMeta("uiEvent")==="paste"&&!o,g=p.getMeta("uiEvent")==="drop"&&!s,y=p.getMeta("applyPasteRules"),b=!!y;if(!m&&!g&&!b)return;if(b){let{text:v}=y;typeof v=="string"?v=v:v=Om(ie.from(v),h.schema);const{from:x}=y,S=x+v.length,T=oL(v);return l({rule:u,state:h,from:x,to:{b:S},pasteEvt:T})}const w=f.doc.content.findDiffStart(h.doc.content),k=f.doc.content.findDiffEnd(h.doc.content);if(!(!eL(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=DS(t),this.schema=gz(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:Bi(e.name,this.schema)},r=Ee(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return ma([...this.extensions].reverse()).flatMap(r=>{const o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Bi(r.name,this.schema)},s=[],i=Ee(r,"addKeyboardShortcuts",o);let a={};if(r.type==="mark"&&Ee(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=b2(a);s.push(l);const c=Ee(r,"addInputRules",o);if(Vb(r,t.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=Xz({editor:t,rules:f}),p=Array.isArray(h)?h:[h];s.push(...p)}}const u=Ee(r,"addPasteRules",o);if(Vb(r,t.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=sL({editor:t,rules:f});s.push(...h)}}const d=Ee(r,"addProseMirrorPlugins",o);if(d){const f=d();s.push(...f)}return s})}get attributes(){return $S(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=xi(this.extensions);return Object.fromEntries(e.filter(n=>!!Ee(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:Nt(n.name,this.schema)},s=Ee(n,"addNodeView",o);if(!s)return[];const i=s();if(!i)return[];const a=(l,c,u,d,f)=>{const h=za(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 ma([...this.extensions].reverse()).reduceRight((r,o)=>{const s={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:e,type:Bi(o.name,this.schema)},i=Ee(o,"dispatchTransaction",s);return i?a=>{i.call(s,{transaction:a,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return ma([...this.extensions]).reduce((r,o)=>{const s={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:e,type:Bi(o.name,this.schema)},i=Ee(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}=xi(this.extensions);return Object.fromEntries(e.filter(n=>!!Ee(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:Br(n.name,this.schema)},s=Ee(n,"addMarkView",o);if(!s)return[];const i=(a,l,c)=>{const u=za(a,r);return s()({mark:a,view:l,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{wL(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:Bi(e.name,this.schema)};e.type==="mark"&&((n=Qe(Ee(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const o=Ee(e,"onBeforeCreate",r),s=Ee(e,"onCreate",r),i=Ee(e,"onUpdate",r),a=Ee(e,"onSelectionUpdate",r),l=Ee(e,"onTransaction",r),c=Ee(e,"onFocus",r),u=Ee(e,"onBlur",r),d=Ee(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=DS;Rd.sort=ma;Rd.flatten=Rm;var iL={};Cm(iL,{ClipboardTextSerializer:()=>KS,Commands:()=>YS,Delete:()=>GS,Drop:()=>ZS,Editable:()=>JS,FocusEvents:()=>QS,Keymap:()=>eE,Paste:()=>tE,Tabindex:()=>nE,TextDirection:()=>rE,focusEventsPluginKey:()=>XS});var Et=class US extends _m{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new US(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},KS=Et.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new bt({key:new Dt("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=LS(n);return zS(r,{from:i,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),YS=Et.create({name:"commands",addCommands(){return{...TS}}}),GS=Et.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=AS(t.before,[t,...e]);FS(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,m)=>{const g=m+p.nodeSize-2,y=h.oldRange.from<=m&&g<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:g,newFrom:u.mapping.map(m),newTo:u.mapping.map(g),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 m,g;if(h instanceof Yn){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=(m=u.doc.nodeAt(y-1))==null?void 0:m.marks.some(S=>S.eq(h.mark)),x=(g=u.doc.nodeAt(b))==null?void 0:g.marks.some(S=>S.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()}}),ZS=Et.create({name:"drop",addProseMirrorPlugins(){return[new bt({key:new Dt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),JS=Et.create({name:"editable",addProseMirrorPlugins(){return[new bt({key:new Dt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),XS=new Dt("focusEvents"),QS=Et.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new bt({key:XS,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}}}})]}}),eE=Et.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,m=p.parent.type.spec.isolating,g=d.pos-d.parentOffset,y=m&&p.parent.childCount===1?g===d.pos:je.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 du()||_S()?s:o},addProseMirrorPlugins(){return[new bt({key:new Dt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),o=t.some(m=>m.getMeta("preventClearDocument"));if(!r||o)return;const{empty:s,from:i,to:a}=e.selection,l=je.atStart(e.doc).from,c=je.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}})]}}),tE=Et.create({name:"paste",addProseMirrorPlugins(){return[new bt({key:new Dt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),nE=Et.create({name:"tabindex",addProseMirrorPlugins(){return[new bt({key:new Dt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),rE=Et.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=xi(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 bt({key:new Dt("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),aL=class ta{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 ta(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 ta(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 ta(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 ta(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)}},lL=`.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 cL(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 uL=class extends Zz{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:Mz,createMappablePosition:Rz},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=OS(n,this.options.autofocus);this.editorState=Ks.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=cL(lL,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=IS(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?[JS,KS.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:n.blockSeparator}),YS,QS,eE,nE,ZS,tE,GS,rE.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=jh(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=jh(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 ES(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 jS(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,o=typeof e=="string"?n:e;return Ez(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Om(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
95
+
96
+ `,textSerializers:r={}}=e||{};return bz(this.state.doc,{blockSeparator:n,textSerializers:{...LS(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 aL(n,this)}get $doc(){return this.$pos(0)}};function Si(t){return new Md({find:t.find,handler:({state:e,range:n,match:r})=>{const o=Qe(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(Nm(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===t.type&&m!==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 oE(t){return new Md({find:t.find,handler:({state:e,range:n,match:r})=>{const o=Qe(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 Bh(t){return new Md({find:t.find,handler:({state:e,range:n,match:r})=>{const o=e.doc.resolve(n.from),s=Qe(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 Ei(t){return new Md({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{const s=Qe(t.getAttributes,void 0,r)||{},i=e.tr.delete(n.from,n.to),l=i.doc.resolve(n.from).blockRange(),c=l&&cm(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 m=p.filter(g=>h.includes(g.type.name));i.ensureMarks(m)}}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&&Ro(i.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&i.join(n.from-1)},undoable:t.undoable})}var dL=t=>"touches"in t,fL=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,dL(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 hL(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Te){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 pL={};Cm(pL,{createAtomBlockMarkdownSpec:()=>mL,createBlockMarkdownSpec:()=>gL,createInlineMarkdownSpec:()=>vL,parseAttributes:()=>Pm,parseIndentedBlocks:()=>Vh,renderNestedMarkdownContent:()=>Im,serializeAttributes:()=>Am});function Pm(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 Am(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 mL(t){const{nodeName:e,name:n,parseAttributes:r=Pm,serializeAttributes:o=Am,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 m=p[1]||"",g=r(m);if(!i.find(b=>!(b in g)))return{type:e,raw:p[0],attributes:g}}},renderMarkdown:u=>{const d=c(u.attrs||{}),f=o(d),h=f?` {${f}}`:"";return`:::${l}${h} :::`}}}function gL(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=Pm,serializeAttributes:s=Am,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 m=r(d);h=typeof m=="string"?[{type:"text",text:m}]:m}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 m=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),g=d.match(m);if(!g)return;const[y,b=""]=g,w=o(b);let k=1;const v=y.length;let x="";const S=/^:::([\w-]*)(\s.*)?/gm,T=d.slice(v);for(S.lastIndex=0;;){const I=S.exec(T);if(I===null)break;const L=I.index,N=I[1];if(!((p=I[2])!=null&&p.endsWith(":::"))){if(N)k+=1;else if(k-=1,k===0){const P=T.slice(0,L);x=P.trim();const A=d.slice(0,v+L+I[0].length);let j=[];if(x)if(a==="block")for(j=h.blockTokens(P),j.forEach(K=>{K.text&&(!K.tokens||K.tokens.length===0)&&(K.tokens=h.inlineTokens(K.text))});j.length>0;){const K=j[j.length-1];if(K.type==="paragraph"&&(!K.text||K.text.trim()===""))j.pop();else break}else j=h.inlineTokens(x);return{type:e,raw:A,attributes:w,content:x,tokens:j}}}}}},renderMarkdown:(d,f)=>{const h=u(d.attrs||{}),p=s(h),m=p?` {${p}}`:"",g=f.renderChildren(d.content||[],`
97
+
98
+ `);return`:::${c}${m}
99
+
100
+ ${g}
101
+
102
+ :::`}}}function yL(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 bL(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function vL(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=yL,serializeAttributes:s=bL,defaultAttributes:i={},selfClosing:a=!1,allowedAttributes:l}=t,c=n||e,u=f=>{if(!l)return f;const h={};return l.forEach(p=>{const m=typeof p=="string"?p:p.name,g=typeof p=="string"?void 0:p.skipIfDefault;if(m in f){const y=f[m];if(g!==void 0&&y===g)return;h[m]=y}}),h},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,h)=>{const p={...i,...f.attributes};if(a)return h.createNode(e,p);const m=r?r(f):f.content||"";return m?h.createNode(e,p,[h.createTextNode(m)]):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),m=p?.index;return m!==void 0?m:-1},tokenize(f,h,p){const m=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),g=f.match(m);if(!g)return;let y="",b="";if(a){const[,k]=g;b=k}else{const[,k,v]=g;b=k,y=v||""}const w=o(b.trim());return{type:e,raw:g[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||{}),m=s(p),g=m?` ${m}`:"";return a?`[${c}${g}]`:`[${c}${g}]${h}[/${c}]`}}}function Vh(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:m,mainContent:g}=p;c=`${c}${f}
105
+ `;const y=[g];for(u+=1;u<a.length;){const v=a[u];if(v.trim()===""){const S=a.slice(u+1).findIndex(L=>L.trim()!=="");if(S===-1)break;if((((o=(r=a[u+1+S].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:o.length)||0)>m){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)>m)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(m+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 Im(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 wL(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 vn=class sE extends _m{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new sE(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 tL({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{const s=Qe(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(Nm(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===t.type&&g!==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:kL,getOwnPropertySymbols:xL}=Object,{hasOwnProperty:SL}=Object.prototype;function Tf(t,e){return function(r,o,s){return t(r,o,s)&&e(r,o,s)}}function Rl(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 EL(t){return t?.[Symbol.toStringTag]}function qb(t){return kL(t).concat(xL(t))}const CL=Object.hasOwn||((t,e)=>SL.call(t,e));function Ts(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const TL="__v",ML="__o",RL="_owner",{getOwnPropertyDescriptor:Ub,keys:Kb}=Object;function OL(t,e){return t.byteLength===e.byteLength&&fu(new Uint8Array(t),new Uint8Array(e))}function NL(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 _L(t,e){return t.byteLength===e.byteLength&&fu(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function PL(t,e){return Ts(t.getTime(),e.getTime())}function AL(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function IL(t,e){return t===e}function Yb(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 $L=Ts;function DL(t,e,n){const r=Kb(t);let o=r.length;if(Kb(e).length!==o)return!1;for(;o-- >0;)if(!iE(t,e,n,r[o]))return!1;return!0}function Vi(t,e,n){const r=qb(t);let o=r.length;if(qb(e).length!==o)return!1;let s,i,a;for(;o-- >0;)if(s=r[o],!iE(t,e,n,s)||(i=Ub(t,s),a=Ub(e,s),(i||a)&&(!i||!a||i.configurable!==a.configurable||i.enumerable!==a.enumerable||i.writable!==a.writable)))return!1;return!0}function zL(t,e){return Ts(t.valueOf(),e.valueOf())}function LL(t,e){return t.source===e.source&&t.flags===e.flags}function Gb(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 fu(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 jL(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 iE(t,e,n,r){return(r===RL||r===ML||r===TL)&&(t.$$typeof||e.$$typeof)?!0:CL(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const FL="[object ArrayBuffer]",BL="[object Arguments]",VL="[object Boolean]",HL="[object DataView]",WL="[object Date]",qL="[object Error]",UL="[object Map]",KL="[object Number]",YL="[object Object]",GL="[object RegExp]",ZL="[object Set]",JL="[object String]",XL={"[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},QL="[object URL]",ej=Object.prototype.toString;function tj({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(g,y,b){if(g===y)return!0;if(g==null||y==null)return!1;const w=typeof g;if(w!==typeof y)return!1;if(w!=="object")return w==="number"?a(g,y,b):w==="function"?s(g,y,b):!1;const k=g.constructor;if(k!==y.constructor)return!1;if(k===Object)return l(g,y,b);if(Array.isArray(g))return e(g,y,b);if(k===Date)return r(g,y,b);if(k===RegExp)return u(g,y,b);if(k===Map)return i(g,y,b);if(k===Set)return d(g,y,b);const v=ej.call(g);if(v===WL)return r(g,y,b);if(v===GL)return u(g,y,b);if(v===UL)return i(g,y,b);if(v===ZL)return d(g,y,b);if(v===YL)return typeof g.then!="function"&&typeof y.then!="function"&&l(g,y,b);if(v===QL)return h(g,y,b);if(v===qL)return o(g,y,b);if(v===BL)return l(g,y,b);if(XL[v])return f(g,y,b);if(v===FL)return t(g,y,b);if(v===HL)return n(g,y,b);if(v===VL||v===KL||v===JL)return c(g,y,b);if(p){let x=p[v];if(!x){const S=EL(g);S&&(x=p[S])}if(x)return x(g,y,b)}return!1}}function nj({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:OL,areArraysEqual:n?Vi:NL,areDataViewsEqual:_L,areDatesEqual:PL,areErrorsEqual:AL,areFunctionsEqual:IL,areMapsEqual:n?Tf(Yb,Vi):Yb,areNumbersEqual:$L,areObjectsEqual:n?Vi:DL,arePrimitiveWrappersEqual:zL,areRegExpsEqual:LL,areSetsEqual:n?Tf(Gb,Vi):Gb,areTypedArraysEqual:n?Tf(fu,Vi):fu,areUrlsEqual:jL,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const o=Rl(r.areArraysEqual),s=Rl(r.areMapsEqual),i=Rl(r.areObjectsEqual),a=Rl(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:o,areMapsEqual:s,areObjectsEqual:i,areSetsEqual:a})}return r}function rj(t){return function(e,n,r,o,s,i,a){return t(e,n,a)}}function oj({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 sj=No();No({strict:!0});No({circular:!0});No({circular:!0,strict:!0});No({createInternalComparator:()=>Ts});No({strict:!0,createInternalComparator:()=>Ts});No({circular:!0,createInternalComparator:()=>Ts});No({circular:!0,createInternalComparator:()=>Ts,strict:!0});function No(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:o=!1}=t,s=nj(t),i=tj(s),a=n?n(i):rj(i);return oj({circular:e,comparator:i,createState:r,equals:a,strict:o})}var ij=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},aj=({contentComponent:t})=>{const e=Op.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return M.jsx(M.Fragment,{children:Object.values(e)})};function lj(){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]:ET.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 cj=class extends de.Component{constructor(t){var e;super(t),this.editorContentRef=de.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=lj(),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:ij(e,this.editorContentRef),...n}),t?.contentComponent&&M.jsx(aj,{contentComponent:t.contentComponent})]})}},uj=E.forwardRef((t,e)=>{const n=de.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return de.createElement(cj,{key:n,innerRef:e,...t})}),aE=de.memo(uj),dj=typeof window<"u"?E.useLayoutEffect:E.useEffect,fj=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 hj(t){var e;const[n]=E.useState(()=>new fj(t.editor)),r=Nw.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:sj);return dj(()=>n.watch(t.editor),[t.editor,n]),E.useDebugValue(r),r}var pj=!1,Hh=typeof window>"u",mj=Hh||!!(typeof window<"u"&&window.next),gj=class lE{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?Hh||mj?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 uL(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?lE.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 yj(t={},e=[]){const n=E.useRef(t);n.current=t;const[r]=E.useState(()=>new gj(n)),o=Op.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return E.useDebugValue(o),E.useEffect(r.onRender(e)),hj({editor:o,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&s===0?0:s+1}),o}var cE=E.createContext({editor:null});cE.Consumer;var bj=E.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),vj=()=>E.useContext(bj);de.forwardRef((t,e)=>{const{onDragStart:n}=vj(),r=t.as||"div";return M.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});de.createContext({markViewContentRef:()=>{}});var $m=E.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});$m.displayName="TiptapContext";var wj=()=>E.useContext($m);function uE({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=E.useMemo(()=>({editor:r}),[r]),s=E.useMemo(()=>({editor:r}),[r]);return M.jsx(cE.Provider,{value:s,children:M.jsx($m.Provider,{value:o,children:n})})}uE.displayName="Tiptap";function dE({...t}){const{editor:e}=wj();return M.jsx(aE,{editor:e,...t})}dE.displayName="Tiptap.Content";Object.assign(uE,{Content:dE});var hu=(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]},kj=/^\s*>\s$/,xj=vn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return hu("blockquote",{...St(this.options.HTMLAttributes,t),children:hu("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[Ei({find:kj,type:this.type})]}}),Sj=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Ej=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Cj=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Tj=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Mj=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 hu("strong",{...St(this.options.HTMLAttributes,t),children:hu("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[Si({find:Sj,type:this.type}),Si({find:Cj,type:this.type})]},addPasteRules(){return[ms({find:Ej,type:this.type}),ms({find:Tj,type:this.type})]}}),Rj=/(^|[^`])`([^`]+)`(?!`)$/,Oj=/(^|[^`])`([^`]+)`(?!`)/g,Nj=Cs.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",St(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[Si({find:Rj,type:this.type})]},addPasteRules(){return[ms({find:Oj,type:this.type})]}}),Mf=4,_j=/^```([a-z]+)?[\s\n]$/,Pj=/^~~~([a-z]+)?[\s\n]$/,Aj=vn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Mf,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",St(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:Mf,{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:Mf,{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,m=0;const g=c-u;for(let x=0;x<h.length;x+=1){if(m+h[x].length>=g){p=x;break}m+=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(Pe.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 m=((p=h.match(/^ */))==null?void 0:p[0])||"",g=Math.min(m.length,n);return h.slice(g)}).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(je.near(r.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[Bh({find:_j,type:this.type,getAttributes:t=>({language:t[1]})}),Bh({find:Pj,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new bt({key:new Dt("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(Pe.near(i.doc.resolve(Math.max(0,i.selection.from-2)))),i.setMeta("paste",!0),t.dispatch(i),!0}}})]}}),Ij=vn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
133
+
134
+ `):""}),$j=vn.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",St(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()}}}),Dj=vn.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]}`,St(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=>Bh({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),zj=vn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",St(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!hL(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,o=t();return BS(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(Pe.create(i.doc,l.pos+1)):l.nodeAfter.isBlock?i.setSelection(Te.create(i.doc,l.pos)):i.setSelection(Pe.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(Pe.create(i.doc,c+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[oE({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Lj=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,jj=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Fj=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Bj=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Vj=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",St(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[Si({find:Lj,type:this.type}),Si({find:Fj,type:this.type})]},addPasteRules(){return[ms({find:jj,type:this.type}),ms({find:Bj,type:this.type})]}});const Hj="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Wj="ελ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",Wh="numeric",qh="ascii",Uh="alpha",ga="asciinumeric",na="alphanumeric",Kh="domain",fE="emoji",qj="scheme",Uj="slashscheme",Rf="whitespace";function Kj(t,e){return t in e||(e[t]=[]),e[t]}function Zo(t,e,n){e[Wh]&&(e[ga]=!0,e[na]=!0),e[qh]&&(e[ga]=!0,e[Uh]=!0),e[ga]&&(e[na]=!0),e[Uh]&&(e[na]=!0),e[na]&&(e[Kh]=!0),e[fE]&&(e[Kh]=!0);for(const r in e){const o=Kj(r,n);o.indexOf(t)<0&&o.push(t)}}function Yj(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function hn(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}hn.groups={};hn.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||hn.groups;let o;return e&&e.j?o=e:(o=new hn(e),n&&r&&Zo(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||hn.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 hn,Object.assign(i.j,a.j),i.jr.push.apply(i.jr,a.jr),i.jd=a.jd,i.t=a.t):i=new hn,s){if(r)if(i.t&&typeof i.t=="string"){const l=Object.assign(Yj(i.t,r),n);Zo(s,l,r)}else n&&Zo(s,n,r);i.t=s}return o.j[t]=i,i}};const Le=(t,e,n,r,o)=>t.ta(e,n,r,o),kt=(t,e,n,r,o)=>t.tr(e,n,r,o),Zb=(t,e,n,r,o)=>t.ts(e,n,r,o),le=(t,e,n,r,o)=>t.tt(e,n,r,o),Or="WORD",Yh="UWORD",hE="ASCIINUMERICAL",pE="ALPHANUMERICAL",La="LOCALHOST",Gh="TLD",Zh="UTLD",Ac="SCHEME",Hs="SLASH_SCHEME",Dm="NUM",Jh="WS",zm="NL",ya="OPENBRACE",ba="CLOSEBRACE",pu="OPENBRACKET",mu="CLOSEBRACKET",gu="OPENPAREN",yu="CLOSEPAREN",bu="OPENANGLEBRACKET",vu="CLOSEANGLEBRACKET",wu="FULLWIDTHLEFTPAREN",ku="FULLWIDTHRIGHTPAREN",xu="LEFTCORNERBRACKET",Su="RIGHTCORNERBRACKET",Eu="LEFTWHITECORNERBRACKET",Cu="RIGHTWHITECORNERBRACKET",Tu="FULLWIDTHLESSTHAN",Mu="FULLWIDTHGREATERTHAN",Ru="AMPERSAND",Ou="APOSTROPHE",Nu="ASTERISK",Xr="AT",_u="BACKSLASH",Pu="BACKTICK",Au="CARET",to="COLON",Lm="COMMA",Iu="DOLLAR",er="DOT",$u="EQUALS",jm="EXCLAMATION",Pn="HYPHEN",va="PERCENT",Du="PIPE",zu="PLUS",Lu="POUND",wa="QUERY",Fm="QUOTE",mE="FULLWIDTHMIDDLEDOT",Bm="SEMI",tr="SLASH",ka="TILDE",ju="UNDERSCORE",gE="EMOJI",Fu="SYM";var yE=Object.freeze({__proto__:null,ALPHANUMERICAL:pE,AMPERSAND:Ru,APOSTROPHE:Ou,ASCIINUMERICAL:hE,ASTERISK:Nu,AT:Xr,BACKSLASH:_u,BACKTICK:Pu,CARET:Au,CLOSEANGLEBRACKET:vu,CLOSEBRACE:ba,CLOSEBRACKET:mu,CLOSEPAREN:yu,COLON:to,COMMA:Lm,DOLLAR:Iu,DOT:er,EMOJI:gE,EQUALS:$u,EXCLAMATION:jm,FULLWIDTHGREATERTHAN:Mu,FULLWIDTHLEFTPAREN:wu,FULLWIDTHLESSTHAN:Tu,FULLWIDTHMIDDLEDOT:mE,FULLWIDTHRIGHTPAREN:ku,HYPHEN:Pn,LEFTCORNERBRACKET:xu,LEFTWHITECORNERBRACKET:Eu,LOCALHOST:La,NL:zm,NUM:Dm,OPENANGLEBRACKET:bu,OPENBRACE:ya,OPENBRACKET:pu,OPENPAREN:gu,PERCENT:va,PIPE:Du,PLUS:zu,POUND:Lu,QUERY:wa,QUOTE:Fm,RIGHTCORNERBRACKET:Su,RIGHTWHITECORNERBRACKET:Cu,SCHEME:Ac,SEMI:Bm,SLASH:tr,SLASH_SCHEME:Hs,SYM:Fu,TILDE:ka,TLD:Gh,UNDERSCORE:ju,UTLD:Zh,UWORD:Yh,WORD:Or,WS:Jh});const Sr=/[a-z]/,Hi=new RegExp("\\p{L}","u"),Of=new RegExp("\\p{Emoji}","u"),Er=/\d/,Nf=/\s/,Jb="\r",_f=`
137
+ `,Gj="️",Zj="‍",Pf="";let Ol=null,Nl=null;function Jj(t=[]){const e={};hn.groups=e;const n=new hn;Ol==null&&(Ol=Xb(Hj)),Nl==null&&(Nl=Xb(Wj)),le(n,"'",Ou),le(n,"{",ya),le(n,"}",ba),le(n,"[",pu),le(n,"]",mu),le(n,"(",gu),le(n,")",yu),le(n,"<",bu),le(n,">",vu),le(n,"(",wu),le(n,")",ku),le(n,"「",xu),le(n,"」",Su),le(n,"『",Eu),le(n,"』",Cu),le(n,"<",Tu),le(n,">",Mu),le(n,"&",Ru),le(n,"*",Nu),le(n,"@",Xr),le(n,"`",Pu),le(n,"^",Au),le(n,":",to),le(n,",",Lm),le(n,"$",Iu),le(n,".",er),le(n,"=",$u),le(n,"!",jm),le(n,"-",Pn),le(n,"%",va),le(n,"|",Du),le(n,"+",zu),le(n,"#",Lu),le(n,"?",wa),le(n,'"',Fm),le(n,"/",tr),le(n,";",Bm),le(n,"~",ka),le(n,"_",ju),le(n,"\\",_u),le(n,"・",mE);const r=kt(n,Er,Dm,{[Wh]:!0});kt(r,Er,r);const o=kt(r,Sr,hE,{[ga]:!0}),s=kt(r,Hi,pE,{[na]:!0}),i=kt(n,Sr,Or,{[qh]:!0});kt(i,Er,o),kt(i,Sr,i),kt(o,Er,o),kt(o,Sr,o);const a=kt(n,Hi,Yh,{[Uh]:!0});kt(a,Sr),kt(a,Er,s),kt(a,Hi,a),kt(s,Er,s),kt(s,Sr),kt(s,Hi,s);const l=le(n,_f,zm,{[Rf]:!0}),c=le(n,Jb,Jh,{[Rf]:!0}),u=kt(n,Nf,Jh,{[Rf]:!0});le(n,Pf,u),le(c,_f,l),le(c,Pf,u),kt(c,Nf,u),le(u,Jb),le(u,_f),kt(u,Nf,u),le(u,Pf,u);const d=kt(n,Of,gE,{[fE]:!0});le(d,"#"),kt(d,Of,d),le(d,Gj,d);const f=le(d,Zj);le(f,"#"),kt(f,Of,d);const h=[[Sr,i],[Er,o]],p=[[Sr,null],[Hi,a],[Er,s]];for(let m=0;m<Ol.length;m++)Ur(n,Ol[m],Gh,Or,h);for(let m=0;m<Nl.length;m++)Ur(n,Nl[m],Zh,Yh,p);Zo(Gh,{tld:!0,ascii:!0},e),Zo(Zh,{utld:!0,alpha:!0},e),Ur(n,"file",Ac,Or,h),Ur(n,"mailto",Ac,Or,h),Ur(n,"http",Hs,Or,h),Ur(n,"https",Hs,Or,h),Ur(n,"ftp",Hs,Or,h),Ur(n,"ftps",Hs,Or,h),Zo(Ac,{scheme:!0,ascii:!0},e),Zo(Hs,{slashscheme:!0,ascii:!0},e),t=t.sort((m,g)=>m[0]>g[0]?1:-1);for(let m=0;m<t.length;m++){const g=t[m][0],b=t[m][1]?{[qj]:!0}:{[Uj]:!0};g.indexOf("-")>=0?b[Kh]=!0:Sr.test(g)?Er.test(g)?b[ga]=!0:b[qh]=!0:b[Wh]=!0,Zb(n,g,g,b)}return Zb(n,"localhost",La,{ascii:!0}),n.jd=new hn(Fu),{start:n,tokens:Object.assign({groups:e},yE)}}function bE(t,e){const n=Xj(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 Xj(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 Ur(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 hn(r),s.jr=o.slice(),t.j[l]=s),t=s}return s=new hn(n),s.jr=o.slice(),t.j[e[i-1]]=s,s}function Xb(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 ja={defaultProtocol:"http",events:null,format:Qb,formatHref:Qb,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Vm(t,e=null){let n=Object.assign({},ja);t&&(n=Object.assign(n,t instanceof Vm?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}Vm.prototype={o:ja,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]:ja[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 Qb(t){return t}function vE(t,e){this.t="token",this.v=t,this.tk=e}vE.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=ja.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 vE{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 e0=Od("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),t0=Od("text"),Qj=Od("nl"),_l=Od("url",{isLink:!0,toHref(t=ja.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==La&&t[1].t===to}}),Nn=t=>new hn(t);function e3({groups:t}){const e=t.domain.concat([Ru,Nu,Xr,_u,Pu,Au,Iu,$u,Pn,Dm,va,Du,zu,Lu,tr,Fu,ka,ju]),n=[Ou,to,Lm,er,jm,va,wa,Fm,Bm,bu,vu,ya,ba,mu,pu,gu,yu,wu,ku,xu,Su,Eu,Cu,Tu,Mu],r=[Ru,Ou,Nu,_u,Pu,Au,Iu,$u,Pn,ya,ba,va,Du,zu,Lu,wa,tr,Fu,ka,ju],o=Nn(),s=le(o,ka);Le(s,r,s),Le(s,t.domain,s);const i=Nn(),a=Nn(),l=Nn();Le(o,t.domain,i),Le(o,t.scheme,a),Le(o,t.slashscheme,l),Le(i,r,s),Le(i,t.domain,i);const c=le(i,Xr);le(s,Xr,c),le(a,Xr,c),le(l,Xr,c);const u=le(s,er);Le(u,r,s),Le(u,t.domain,s);const d=Nn();Le(c,t.domain,d),Le(d,t.domain,d);const f=le(d,er);Le(f,t.domain,d);const h=Nn(e0);Le(f,t.tld,h),Le(f,t.utld,h),le(c,La,h);const p=le(d,Pn);le(p,Pn,p),Le(p,t.domain,d),Le(h,t.domain,d),le(h,er,f),le(h,Pn,p);const m=le(h,to);Le(m,t.numeric,e0);const g=le(i,Pn),y=le(i,er);le(g,Pn,g),Le(g,t.domain,i),Le(y,r,s),Le(y,t.domain,i);const b=Nn(_l);Le(y,t.tld,b),Le(y,t.utld,b),Le(b,t.domain,i),Le(b,r,s),le(b,er,y),le(b,Pn,g),le(b,Xr,c);const w=le(b,to),k=Nn(_l);Le(w,t.numeric,k);const v=Nn(_l),x=Nn();Le(v,e,v),Le(v,n,x),Le(x,e,v),Le(x,n,x),le(b,tr,v),le(k,tr,v);const S=le(a,to),T=le(l,to),I=le(T,tr),L=le(I,tr);Le(a,t.domain,i),le(a,er,y),le(a,Pn,g),Le(l,t.domain,i),le(l,er,y),le(l,Pn,g),Le(S,t.domain,v),le(S,tr,v),le(S,wa,v),Le(L,t.domain,v),Le(L,e,v),le(L,tr,v);const N=[[ya,ba],[pu,mu],[gu,yu],[bu,vu],[wu,ku],[xu,Su],[Eu,Cu],[Tu,Mu]];for(let P=0;P<N.length;P++){const[A,j]=N[P],K=le(v,A);le(x,A,K),le(K,j,v);const J=Nn(_l);Le(K,e,J);const Y=Nn();Le(K,n),Le(J,e,J),Le(J,n,Y),Le(Y,e,J),Le(Y,n,Y),le(J,j,v),le(Y,j,v)}return le(o,La,b),le(o,zm,Qj),{start:o,tokens:yE}}function t3(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(Af(t0,e,i)),i=[]),o-=f,u-=f;const h=d.t,p=n.slice(o-u,o);s.push(Af(h,e,p))}}return i.length>0&&s.push(Af(t0,e,i)),s}function Af(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 n3=typeof console<"u"&&console&&console.warn||(()=>{}),r3="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ht={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function o3(){return hn.groups={},ht.scanner=null,ht.parser=null,ht.tokenQueue=[],ht.pluginQueue=[],ht.customSchemes=[],ht.initialized=!1,ht}function n0(t,e=!1){if(ht.initialized&&n3(`linkifyjs: already initialized - will not register custom scheme "${t}" ${r3}`),!/^[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`);ht.customSchemes.push([t,e])}function s3(){ht.scanner=Jj(ht.customSchemes);for(let t=0;t<ht.tokenQueue.length;t++)ht.tokenQueue[t][1]({scanner:ht.scanner});ht.parser=e3(ht.scanner.tokens);for(let t=0;t<ht.pluginQueue.length;t++)ht.pluginQueue[t][1]({scanner:ht.scanner,parser:ht.parser});return ht.initialized=!0,ht}function Hm(t){return ht.initialized||s3(),t3(ht.parser.start,t,bE(ht.scanner.start,t))}Hm.scan=bE;function wE(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 Vm(n),o=Hm(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 Wm="[\0-   ᠎ -\u2029  ]",i3=new RegExp(Wm),a3=new RegExp(`${Wm}$`),l3=new RegExp(Wm,"g");function c3(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function u3(t){return new bt({key:new Dt("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=AS(n.doc,[...e]);if(FS(a).forEach(({newRange:c})=>{const u=dz(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(!a3.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(i3).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],m=d.pos+f.lastIndexOf(p);if(!p)return!1;const g=Hm(p).map(y=>y.toObject(t.defaultProtocol));if(!c3(g))return!1;g.filter(y=>y.isLink).map(y=>({...y,from:m+y.start+1,to:m+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=>{Nm(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 d3(t){return new bt({key:new Dt("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=jS(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 f3(t){return new bt({key:new Dt("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=wE(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(l3,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var kE=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"){n0(t);return}n0(t.scheme,t.optionalSlashes)})},onDestroy(){o3()},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",St(this.options.HTMLAttributes,t),0]:["a",St(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=wE(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(u3({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(d3({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(f3({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),h3=kE,p3=Object.defineProperty,m3=(t,e)=>{for(var n in e)p3(t,n,{get:e[n],enumerable:!0})},g3="listItem",r0="textStyle",o0=/^\s*([-+*])\s$/,xE=vn.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",St(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(g3,this.editor.getAttributes(r0)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Ei({find:o0,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ei({find:o0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(r0),editor:this.editor})),[t]}}),SE=vn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",St(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)=>Im(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)}}}),y3={};m3(y3,{findListItemPos:()=>Xa,getNextListDepth:()=>qm,handleBackspace:()=>Xh,handleDelete:()=>Qh,hasListBefore:()=>EE,hasListItemAfter:()=>b3,hasListItemBefore:()=>CE,listItemHasSubList:()=>TE,nextListIsDeeper:()=>ME,nextListIsHigher:()=>RE});var Xa=(t,e)=>{const{$from:n}=e.selection,r=Nt(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}},qm=(t,e)=>{const n=Xa(t,e);if(!n)return!1;const[,r]=xz(e,t,n.$pos.pos+4);return r},EE=(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))},CE=(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)},TE=(t,e,n)=>{if(!n)return!1;const r=Nt(t,e.schema);let o=!1;return n.descendants(s=>{s.type===r&&(o=!0)}),o},Xh=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!vo(t.state,e)&&EE(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(!vo(t.state,e)||!Tz(t.state))return!1;const r=Xa(e,t.state);if(!r)return!1;const s=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),i=TE(e,t.state,s);return CE(e,t.state)&&!i?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},ME=(t,e)=>{const n=qm(t,e),r=Xa(t,e);return!r||!n?!1:n>r.depth},RE=(t,e)=>{const n=qm(t,e),r=Xa(t,e);return!r||!n?!1:n<r.depth},Qh=(t,e)=>{if(!vo(t.state,e)||!Cz(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:o}=n;return!n.empty&&r.sameParent(o)?!1:ME(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():RE(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},b3=(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)},OE=Et.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&&Qh(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&&Qh(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&&Xh(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&&Xh(t,n,r)&&(e=!0)}),e}}}}),s0=/^(\s*)(\d+)\.\s+(.*)$/,v3=/^\s/;function w3(t){const e=[];let n=0,r=0;for(;n<t.length;){const o=t[n],s=o.match(s0);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(s0))break;if(h.trim()==="")f.push(h),u+=`
142
+ `,d+=1;else if(h.match(v3))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 NE(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(m=>m.indent)),p=NE(f,h,n);c.push({type:"list",ordered:!0,start:f[0].number,items:p,raw:f.map(m=>m.raw).join(`
147
+ `)})}o.push({type:"list_item",raw:i.raw,tokens:c}),s=d}else s+=1}return o}function k3(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 x3="listItem",i0="textStyle",a0=/^(\d+)\.\s$/,_E=vn.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",St(this.options.HTMLAttributes,n),0]:["ol",St(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?k3(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]=w3(o);if(s.length===0)return;const a=NE(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(x3,this.editor.getAttributes(i0)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ei({find:a0,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=Ei({find:a0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(i0)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),S3=/^\s*(\[([( |x])?\])\s$/,PE=vn.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",St(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 Im(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 m=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...m?.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=za(d,f),p=new Set(Object.keys(h)),m=this.options.HTMLAttributes;return u.forEach(g=>{p.has(g)||(g in m?o.setAttribute(g,m[g]):o.removeAttribute(g))}),Object.entries(h).forEach(([g,y])=>{y==null?g in m?o.setAttribute(g,m[g]):o.removeAttribute(g):o.setAttribute(g,y)}),u=p,!0}}}},addInputRules(){return[Ei({find:S3,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),AE=vn.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",St(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=Vh(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=Vh(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()}}});Et.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(xE.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(SE.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(OE.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(_E.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(PE.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(AE.configure(this.options.taskList)),t}});var l0="&nbsp;",E3=" ",C3=vn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",St(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===l0||r[0].text===E3)?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?l0:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),T3=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,M3=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,R3=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",St(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[Si({find:T3,type:this.type})]},addPasteRules(){return[ms({find:M3,type:this.type})]}}),O3=vn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),N3=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",St(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 _3(t={}){return new bt({view(e){return new P3(e,t)}})}class P3{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(),m=d?p.bottom:p.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;r={left:p.left,right:p.right,top:m-g,bottom:m+g}}}}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=E1(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 xt extends je{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return xt.valid(r)?new xt(r):je.near(r)}content(){return me.empty}eq(e){return e instanceof xt&&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 xt(e.resolve(n.pos))}getBookmark(){return new Um(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!A3(e)||!I3(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&&xt.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(xt.valid(l))return l}for(;;){let i=n>0?s.firstChild:s.lastChild;if(!i){if(s.isAtom&&!s.isText&&!Te.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(xt.valid(a))return a}return null}}}xt.prototype.visible=!1;xt.findFrom=xt.findGapCursorFrom;je.jsonID("gapcursor",xt);class Um{constructor(e){this.pos=e}map(e){return new Um(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return xt.valid(n)?new xt(n):je.near(n)}}function IE(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function A3(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||IE(o.type))return!0;if(o.inlineContent)return!1}}return!0}function I3(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||IE(o.type))return!0;if(o.inlineContent)return!1}}return!0}function $3(){return new bt({props:{decorations:j3,createSelectionBetween(t,e,n){return e.pos==n.pos&&xt.valid(n)?new xt(n):null},handleClick:z3,handleKeyDown:D3,handleDOMEvents:{beforeinput:L3}}})}const D3=CS({ArrowLeft:Pl("horiz",-1),ArrowRight:Pl("horiz",1),ArrowUp:Pl("vert",-1),ArrowDown:Pl("vert",1)});function Pl(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 Pe){if(!s.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=xt.findGapCursorFrom(a,e,l);return c?(o&&o(r.tr.setSelection(new xt(c))),!0):!1}}function z3(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!xt.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&Te.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new xt(r))),!0)}function L3(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof xt))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=ie.empty;for(let i=r.length-1;i>=0;i--)o=ie.from(r[i].createAndFill(null,o));let s=t.state.tr.replace(n.pos,n.pos,new me(o,0,0));return s.setSelection(Pe.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function j3(t){if(!(t.selection instanceof xt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",gt.create(t.doc,[sn.widget(t.selection.head,e,{key:"gapcursor"})])}var Bu=200,Vt=function(){};Vt.prototype.append=function(e){return e.length?(e=Vt.from(e),!this.length&&e||e.length<Bu&&this.leafAppend(e)||this.length<Bu&&e.leafPrepend(this)||this.appendInner(e)):this};Vt.prototype.prepend=function(e){return e.length?Vt.from(e).append(this):this};Vt.prototype.appendInner=function(e){return new F3(this,e)};Vt.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Vt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Vt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Vt.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)};Vt.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};Vt.from=function(e){return e instanceof Vt?e:e&&e.length?new $E(e):Vt.empty};var $E=(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<=Bu)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Bu)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})(Vt);Vt.empty=new $E([]);var F3=(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})(Vt);const B3=500;class Kn{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 nr(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 nr(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 Kn(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 nr(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>H3&&(a=V3(a,c),i-=c),new Kn(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 Kn(this.items.append(e.map(n=>new nr(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 m=e.steps[h].invert(e.docs[h]),g=f.selection&&f.selection.map(s.slice(l+1,h));g&&a++,r.push(new nr(p,m,g))}else r.push(new nr(p))},o);let c=[];for(let f=n;f<i;f++)c.push(new nr(s.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new Kn(u,a);return d.emptyItemCount()>B3&&(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 nr(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 Kn(Vt.from(o.reverse()),s)}}Kn.empty=new Kn(Vt.empty,0);function V3(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}class nr{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 nr(n.getMap().invert(),n,this.selection)}}}class Qr{constructor(e,n,r,o,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=s}}const H3=20;function W3(t,e,n,r){let o=n.getMeta(rs),s;if(o)return o.historyState;n.getMeta(K3)&&(t=new Qr(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 Qr(t.done.addTransform(n,void 0,r,Ic(e)),t.undone,c0(n.mapping.maps),t.prevTime,t.prevComposition):new Qr(t.done,t.undone.addTransform(n,void 0,r,Ic(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||!q3(n,t.prevRanges)),c=i?If(t.prevRanges,n.mapping):c0(n.mapping.maps);return new Qr(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Ic(e)),Kn.empty,c,n.time,a??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Qr(t.done.rebased(n,s),t.undone.rebased(n,s),If(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Qr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),If(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function q3(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 c0(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 If(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 U3(t,e,n){let r=Ic(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 Qr(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(i).setMeta(rs,{redo:n,historyState:l})}let $f=!1,u0=null;function Ic(t){let e=t.plugins;if(u0!=e){$f=!1,u0=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){$f=!0;break}}return $f}const rs=new Dt("history"),K3=new Dt("closeHistory");function Y3(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new bt({key:rs,state:{init(){return new Qr(Kn.empty,Kn.empty,null,0,-1)},apply(e,n,r){return W3(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?zE:r=="historyRedo"?LE:null;return!o||!e.editable?!1:(n.preventDefault(),o(e.state,e.dispatch))}}}})}function DE(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=U3(o,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const zE=DE(!1,!0),LE=DE(!0,!0);Et.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 bt({key:new Dt("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 G3=Et.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[_3(this.options)]}});Et.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new bt({key:new Dt("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=e,s=[];if(!n||!r)return gt.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(sn.node(c,c+l.nodeSize,{class:this.options.className}))}),gt.create(t,s)}}})]}});var Z3=Et.create({name:"gapCursor",addProseMirrorPlugins(){return[$3()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Qe(Ee(t,"allowGapCursor",n)))!=null?e:null}}}),d0="placeholder";function J3(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var X3=Et.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:d0,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${J3(this.options.dataAttribute)}`:`data-${d0}`;return[new bt({key:new Dt("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=sn.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}),gt.create(e,s)}}})]}});Et.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new bt({key:new Dt("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||BS(n.selection)||t.view.dragging?null:gt.create(n.doc,[sn.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function f0({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var Q3=Et.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Dt(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 bt({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!f0({node:i,types:r})},apply:(o,s)=>{if(!o.docChanged||o.getMeta("__uniqueIDTransaction"))return s;const i=o.doc.lastChild;return!f0({node:i,types:r})}}})]}}),eF=Et.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>zE(t,e),redo:()=>({state:t,dispatch:e})=>LE(t,e)}},addProseMirrorPlugins(){return[Y3(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()}}}),tF=Et.create({name:"starterKit",addExtensions(){var t,e,n,r;const o=[];return this.options.bold!==!1&&o.push(Mj.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(xj.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(xE.configure(this.options.bulletList)),this.options.code!==!1&&o.push(Nj.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(Aj.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(Ij.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(G3.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(Z3.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push($j.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(Dj.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(eF.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(zj.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(Vj.configure(this.options.italic)),this.options.listItem!==!1&&o.push(SE.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(OE.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&o.push(kE.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(_E.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(C3.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(R3.configure(this.options.strike)),this.options.text!==!1&&o.push(O3.configure(this.options.text)),this.options.underline!==!1&&o.push(N3.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&o.push(Q3.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),nF=tF,rF=X3,oF=AE,sF=PE,iF=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,aF=vn.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",St(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?`![${l}](${a} "${c}")`:`![${l}](${a})`},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 fL({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[oE({find:iF,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),lF=aF;const cF=E.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:m,setTouched:g,setDirty:y,validityData:b,setFocused:w,setFilled:k,validationMode:v,validation:x}=$i(),S=m||l,T=p??i,I={...h,disabled:S},{labelId:L}=fd(),N=hd({id:s});ge(()=>{const Y=a!=null;x.inputRef.current?.value||Y&&a!==""?k(!0):Y&&a===""&&k(!1)},[x.inputRef,k,a]);const P=E.useRef(null);ge(()=>{d&&P.current===Wn(Je(P.current))&&w(!0)},[d,w]);const[A]=Ma({controlled:a,default:u,name:"FieldControl",state:"value"}),j=a!==void 0,K=j?A:void 0;return rm({id:N,name:T,commit:x.commit,value:K,getValue:()=>x.inputRef.current?.value,controlRef:x.inputRef}),ot("input",e,{ref:[n,P],state:I,props:[{id:N,disabled:S,name:T,ref:x.inputRef,"aria-labelledby":L,autoFocus:d,...j?{value:K}:{defaultValue:u},onChange(Y){const G=Y.currentTarget.value;c?.(G,Fe(yo,Y.nativeEvent)),y(G!==b.initialValue),k(G!=="")},onFocus(){w(!0)},onBlur(Y){g(!0),w(!1),v==="onBlur"&&x.commit(Y.currentTarget.value)},onKeyDown(Y){Y.currentTarget.tagName==="INPUT"&&Y.key==="Enter"&&(g(!0),x.commit(Y.currentTarget.value))}},x.getInputValidationProps(),f],stateAttributesMapping:tm})}),uF=E.forwardRef(function(e,n){return M.jsx(cF,{ref:n,...e})});function gr(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(uF,{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 jE=E.createContext(void 0);function Qa(t){const e=E.useContext(jE);if(e===void 0&&!t)throw new Error(en(47));return e}function dF(){return{...Ik(),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 fF={...$k,disabled:be(t=>t.disabled),instantType:be(t=>t.instantType),openMethod:be(t=>t.openMethod),openChangeReason:be(t=>t.openChangeReason),modal:be(t=>t.modal),stickIfOpen:be(t=>t.stickIfOpen),titleElementId:be(t=>t.titleElementId),descriptionElementId:be(t=>t.descriptionElementId),openOnHover:be(t=>t.openOnHover),closeDelay:be(t=>t.closeDelay),hasViewport:be(t=>t.hasViewport)};class Km extends Np{constructor(e){const n={...dF(),...e};n.open&&e?.mounted===void 0&&(n.mounted=!0),super(n,{popupRef:E.createRef(),backdropRef:E.createRef(),internalBackdropRef:E.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:E.createRef(),beforeContentFocusGuardRef:E.createRef(),stickIfOpenTimeout:new ss,triggerElements:new ad},fF)}setOpen=(e,n)=>{const r=n.reason===En,o=n.reason===hi&&n.event.detail===0,s=!e&&(n.reason===lk||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(kM,()=>{this.set("stickIfOpen",!1)}),cr.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=ln(()=>new Km(n)).current,o=e??r;return dp(r.disposeEffect),o}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function h0({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=Km.useStore(a?.store,{modal:i,open:r,openProp:n,activeTriggerId:c,triggerIdProp:l});_w(()=>{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:m,triggerProps:g,reset:y}=Qp(d);Pk(u);const{forceUnmount:b}=Ak(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null}),y()});Xp(d&&i===!0&&p!==En&&m!=="touch",f),E.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);const w=E.useCallback(K=>{const J=Fe(K);return J.preventUnmountOnClose=()=>{u.set("preventUnmountingOnClose",!0)},J},[u]),k=E.useCallback(()=>{u.setOpen(!1,w(ck))},[u,w]);E.useImperativeHandle(t.actionsRef,()=>({unmount:b,close:k}),[b,k]);const v=zk({popupStore:u,onOpenChange:u.setOpen}),x=Rp(v,{outsidePressEvent:{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),S=jk(v),{getReferenceProps:T,getFloatingProps:I,getTriggerProps:L}=ld([x,S]),N=E.useMemo(()=>T(g),[T,g]),P=E.useMemo(()=>L(g),[L,g]),A=E.useMemo(()=>I(),[I]);u.useSyncedValues({modal:i,openMethod:m,activeTriggerProps:N,inactiveTriggerProps:P,popupProps:A,floatingRootContext:v,nested:Co()!=null});const j=E.useMemo(()=>({store:u}),[u]);return M.jsx(jE.Provider,{value:j,children:typeof e=="function"?e({payload:h}):e})}function hF(t){return Qa(!0)?M.jsx(h0,{props:t}):M.jsx(wM,{children:M.jsx(h0,{props:t})})}const pF=300,mF=E.forwardRef(function(e,n){const{render:r,className:o,disabled:s=!1,nativeButton:i=!0,handle:a,payload:l,openOnHover:c=!1,delay:u=pF,closeDelay:d=0,id:f,...h}=e,p=Qa(!0),m=a?.store??p?.store;if(!m)throw new Error(en(74));const g=bs(f),y=m.useState("isTriggerActive",g),b=m.useState("floatingRootContext"),w=m.useState("isOpenedByTrigger",g),k=E.useRef(null),{registerTrigger:v,isMountedByThisTrigger:x}=pO(g,k,m,{payload:l,disabled:s,openOnHover:c,closeDelay:d}),S=m.useState("openChangeReason"),T=m.useState("stickIfOpen"),I=m.useState("openMethod"),L=SO(b,{enabled:b!=null&&c&&(I!=="touch"||S!==hi),mouseOnly:!0,move:!1,handleClose:_O(),restMs:u,delay:{close:d},triggerElementRef:k,isActiveTrigger:y}),N=vk(b,{enabled:b!=null,stickIfOpen:T}),P=ld([N]),A=m.useState("triggerProps",x),j={disabled:s,open:w},{getButtonProps:K,buttonRef:J}=ws({disabled:s,native:i}),Y=E.useMemo(()=>({open(H){return H&&S===hi?Bk.open(H):Fk.open(H)}}),[S]),G=ot("button",e,{state:j,ref:[J,n,v,k],props:[P.getReferenceProps(),L,A,{[ak]:"",id:g},h,K],stateAttributesMapping:Y}),U=E.useRef(null),z=pe(H=>{cr.flushSync(()=>{m.setOpen(!1,Fe(is,H.nativeEvent,H.currentTarget))}),hM(U.current)?.focus()}),B=pe(H=>{const V=m.select("positionerElement");if(V&&Js(H,V))m.context.beforeContentFocusGuardRef.current?.focus();else{cr.flushSync(()=>{m.setOpen(!1,Fe(is,H.nativeEvent,H.currentTarget))});let R=fM(m.context.triggerFocusTargetRef.current||k.current);for(;R!==null&&He(V,R);){const D=R;if(R=kp(R),R===D)break}R?.focus()}});return y?M.jsxs(E.Fragment,{children:[M.jsx(pi,{ref:U,onFocus:z}),M.jsx(E.Fragment,{children:G},g),M.jsx(pi,{ref:m.context.triggerFocusTargetRef,onFocus:B})]}):M.jsx(E.Fragment,{children:G},g)}),FE=E.createContext(void 0);function gF(){const t=E.useContext(FE);if(t===void 0)throw new Error(en(45));return t}const yF=E.forwardRef(function(e,n){const{keepMounted:r=!1,...o}=e,{store:s}=Qa();return s.useState("mounted")||r?M.jsx(FE.Provider,{value:r,children:M.jsx(Ep,{ref:n,...o})}):null}),BE=E.createContext(void 0);function bF(){const t=E.useContext(BE);if(!t)throw new Error(en(46));return t}const vF=E.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:m=!1,collisionAvoidance:g=EM,...y}=e,{store:b}=Qa(),w=gF(),k=bM(),v=b.useState("floatingRootContext"),x=b.useState("mounted"),S=b.useState("open"),T=b.useState("openChangeReason"),I=b.useState("activeTriggerElement"),L=b.useState("modal"),N=b.useState("positionerElement"),P=b.useState("instantType"),A=b.useState("transitionStatus"),j=b.useState("hasViewport"),K=E.useRef(null),J=_k(N,!1,!1),Y=Hk({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:m,keepMounted:w,nodeId:k,collisionAvoidance:g,adaptiveOrigin:j?BO:void 0}),G=E.useMemo(()=>{const R={};return S||(R.pointerEvents="none"),{role:"presentation",hidden:!x,style:{...Y.positionerStyles,...R}}},[S,x,Y.positionerStyles]),U=E.useMemo(()=>({props:G,...Y}),[G,Y]),z=v.useState("domReferenceElement");ge(()=>{const R=z,D=K.current;if(R&&(K.current=R),D&&R&&R!==D){b.set("instantType",void 0);const $=new AbortController;return J(()=>{b.set("instantType","trigger-change")},$.signal),()=>{$.abort()}}},[z,J,b]);const B={open:S,side:U.side,align:U.align,anchorHidden:U.anchorHidden,instant:P},H=E.useCallback(R=>{b.set("positionerElement",R)},[b]),V=ot("div",e,{state:B,props:[U.props,ud(A),y],ref:[n,H],stateAttributesMapping:Ii});return M.jsxs(BE.Provider,{value:U,children:[x&&L===!0&&T!==En&&M.jsx(em,{ref:b.context.internalBackdropRef,inert:dd(!S),cutout:I}),M.jsx(vM,{id:k,children:V})]})}),wF={...Ii,...Ai},kF=E.forwardRef(function(e,n){const{className:r,render:o,initialFocus:s,finalFocus:i,...a}=e,{store:l}=Qa(),c=bF(),u=Gx()!=null,d=l.useState("open"),f=l.useState("openMethod"),h=l.useState("instantType"),p=l.useState("transitionStatus"),m=l.useState("popupProps"),g=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");To({open:d,ref:l.context.popupRef,onComplete(){d&&l.context.onOpenChangeComplete?.(!0)}});const S=l.useState("disabled"),T=l.useState("openOnHover"),I=l.useState("closeDelay");wO(x,{enabled:T&&!S,closeDelay:I});function L(K){return K==="touch"?l.context.popupRef.current:!0}const N=s===void 0?L:s,P={open:d,side:c.side,align:c.align,instant:h,transitionStatus:p},A=E.useCallback(K=>{l.set("popupElement",K)},[l]),j=ot("div",e,{state:P,ref:[n,l.context.popupRef,A],props:[m,{"aria-labelledby":g,"aria-describedby":y,onKeyDown(K){u&&Jp.has(K.key)&&K.stopPropagation()}},ud(p),a],stateAttributesMapping:wF});return M.jsx(Tp,{context:x,openInteractionType:f,modal:b==="trap-focus",disabled:!w||k===En,initialFocus:N,returnFocus:i,restoreFocus:"popup",previousFocusableElement:yt(v)?v:void 0,nextFocusableElement:l.context.triggerFocusTargetRef,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:j})});function Nd(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(hF,{"data-slot":"popover",...n}),e[2]=n,e[3]=r):r=e[3],r}function _d(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(mF,{"data-slot":"popover-trigger",...n}),e[2]=n,e[3]=r):r=e[3],r}function Pd(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(kF,{"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(yF,{children:M.jsx(vF,{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 Df=120,xF=fr({method:"POST"}).handler(hr("28b009a83a8070215402885cb1254e3f7ab49160f54c955f55e15fd2119831e7")),SF=fr({method:"POST"}).handler(hr("1f487dcb5d0b909c2785163b904a0ee48e748b32783309e964b4502d83a2e7a7"));function EF({assetId:t,label:e}){const[n,r]=E.useState(),[o,s]=E.useState(!1),i=E.useRef(0);return E.useEffect(()=>{i.current+=1;const a=i.current;let l;return(async()=>{try{s(!1);const c=await SF({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(zp,{className:"size-5"}):M.jsx(Zn,{className:"size-5 animate-spin"})})}function VE(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]=E.useState(""),[f,h]=E.useState(!1),[p,m]=E.useState();let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[y,b]=E.useState(g),[w,k]=E.useState();let v,x;e[1]!==n||e[2]!==c||e[3]!==w||e[4]!==r?(v=()=>{const L=`${n}::${r}`;if(!c||w===L)return;let N=!1;return h(!0),m(void 0),xF({data:{currentFilePath:n,sourceMode:r}}).then(P=>{N||(b(P),k(L))}).catch(P=>{if(N)return;const A=P instanceof Error?P.message:String(P);m(A),Hn.error(`Unable to load image assets: ${A}`)}).finally(()=>{N||h(!1)}),()=>{N=!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]),E.useEffect(v,x);let S;if(e[7]!==y||e[8]!==u){const L=u.trim().toLowerCase();S=y.filter(N=>L.length===0?!0:N.displayPath.toLowerCase().includes(L)||N.value.toLowerCase().includes(L)),e[7]=y,e[8]=u,e[9]=S}else S=e[9];const T=S;let I;if(e[10]!==a||e[11]!==p||e[12]!==T||e[13]!==f||e[14]!==l||e[15]!==o||e[16]!==s||e[17]!==u||e[18]!==r){const L=T.slice(0,Df);let N;e[20]!==a?(N=ue("space-y-2",a),e[20]=a,e[21]=N):N=e[21];let P;e[22]!==s||e[23]!==r?(P=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(Uc,{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]=P):P=e[24];let A;e[25]===Symbol.for("react.memo_cache_sentinel")?(A=M.jsx(ax,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2"}),e[25]=A):A=e[25];let j;e[26]===Symbol.for("react.memo_cache_sentinel")?(j=U=>{d(U.target.value)},e[26]=j):j=e[26];let K;e[27]!==u?(K=M.jsxs("div",{className:"relative w-60 max-w-full",children:[A,M.jsx(gr,{value:u,onChange:j,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]=K):K=e[28];let J;e[29]!==K||e[30]!==P?(J=M.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[P,K]}),e[29]=K,e[30]=P,e[31]=J):J=e[31];let Y;e[32]!==f?(Y=f?M.jsxs("div",{className:"text-muted-foreground flex h-32 items-center justify-center gap-2 text-sm",children:[M.jsx(Zn,{className:"size-4 animate-spin"}),"Loading assets..."]}):null,e[32]=f,e[33]=Y):Y=e[33];let G;e[34]!==p?(G=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]=G):G=e[35],I=M.jsxs("div",{className:N,children:[J,Y,G,!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:L.map(U=>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(U.value),Hn.success(`Selected image: ${U.displayPath}`)},title:U.value,children:[M.jsx(EF,{assetId:U.id,label:U.displayPath}),M.jsx("p",{className:"text-foreground/85 truncate text-[11px]",children:U.displayPath})]},U.id))}),T.length===0?M.jsx("p",{className:"text-muted-foreground text-xs",children:"No assets found."}):null,T.length>Df?M.jsxs("p",{className:"text-muted-foreground text-xs",children:["Showing first ",Df," assets. Refine search for more."]}):null]}):null]}),e[10]=a,e[11]=p,e[12]=T,e[13]=f,e[14]=l,e[15]=o,e[16]=s,e[17]=u,e[18]=r,e[19]=I}else I=e[19];return I}function HE(t){const e=Me.c(15),{currentFilePath:n,sourceMode:r,triggerLabel:o,onSelectPath:s}=t,[i,a]=E.useState(!1);let l,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=ue(mi({variant:"outline"}),"h-8 border-dashed text-xs"),c=M.jsx(zp,{className:"size-3.5"}),e[0]=l,e[1]=c):(l=e[0],c=e[1]);let u;e[2]!==o?(u=M.jsxs(_d,{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(Pd,{className:"w-136 max-w-[calc(100vw-2rem)] p-3",children:M.jsx(VE,{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(Nd,{open:i,onOpenChange:a,children:[u,f]}),e[11]=i,e[12]=u,e[13]=f,e[14]=h):h=e[14],h}const WE=fr({method:"POST"}).handler(hr("8346edc0b9da2addd68ca674ed9b2030f439d40deb713c45ef88393f5bdb91b9"));function Ym(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ms=Ym();function qE(t){Ms=t}var Wo={exec:()=>null};function Ge(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(an.caret,"$1"),n=n.replace(o,i),r},getRegex:()=>new RegExp(n,e)};return r}var CF=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),an={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)}}>`)},TF=/^(?:[ \t]*(?:\n|$))+/,MF=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,RF=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,el=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,OF=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Gm=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,UE=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,KE=Ge(UE).replace(/bull/g,Gm).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(),NF=Ge(UE).replace(/bull/g,Gm).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(),Zm=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,_F=/^[^\n]+/,Jm=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,PF=Ge(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Jm).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),AF=Ge(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Gm).getRegex(),Ad="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",Xm=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,IF=Ge("^ {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",Xm).replace("tag",Ad).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),YE=Ge(Zm).replace("hr",el).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",Ad).getRegex(),$F=Ge(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",YE).getRegex(),Qm={blockquote:$F,code:MF,def:PF,fences:RF,heading:OF,hr:el,html:IF,lheading:KE,list:AF,newline:TF,paragraph:YE,table:Wo,text:_F},p0=Ge("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",el).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",Ad).getRegex(),DF={...Qm,lheading:NF,table:p0,paragraph:Ge(Zm).replace("hr",el).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",p0).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",Ad).getRegex()},zF={...Qm,html:Ge(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Xm).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:Ge(Zm).replace("hr",el).replace("heading",` *#{1,6} *[^
152
+ ]`).replace("lheading",KE).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},LF=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,jF=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,GE=/^( {2,}|\\)\n(?!\s*$)/,FF=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Id=/[\p{P}\p{S}]/u,eg=/[\s\p{P}\p{S}]/u,ZE=/[^\s\p{P}\p{S}]/u,BF=Ge(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,eg).getRegex(),JE=/(?!~)[\p{P}\p{S}]/u,VF=/(?!~)[\s\p{P}\p{S}]/u,HF=/(?:[^\s\p{P}\p{S}]|~)/u,XE=/(?![*_])[\p{P}\p{S}]/u,WF=/(?![*_])[\s\p{P}\p{S}]/u,qF=/(?:[^\s\p{P}\p{S}]|[*_])/u,UF=Ge(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",CF?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),QE=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,KF=Ge(QE,"u").replace(/punct/g,Id).getRegex(),YF=Ge(QE,"u").replace(/punct/g,JE).getRegex(),eC="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",GF=Ge(eC,"gu").replace(/notPunctSpace/g,ZE).replace(/punctSpace/g,eg).replace(/punct/g,Id).getRegex(),ZF=Ge(eC,"gu").replace(/notPunctSpace/g,HF).replace(/punctSpace/g,VF).replace(/punct/g,JE).getRegex(),JF=Ge("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ZE).replace(/punctSpace/g,eg).replace(/punct/g,Id).getRegex(),XF=Ge(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,XE).getRegex(),QF="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",e4=Ge(QF,"gu").replace(/notPunctSpace/g,qF).replace(/punctSpace/g,WF).replace(/punct/g,XE).getRegex(),t4=Ge(/\\(punct)/,"gu").replace(/punct/g,Id).getRegex(),n4=Ge(/^<(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(),r4=Ge(Xm).replace("(?:-->|$)","-->").getRegex(),o4=Ge("^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",r4).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Vu=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,s4=Ge(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Vu).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),tC=Ge(/^!?\[(label)\]\[(ref)\]/).replace("label",Vu).replace("ref",Jm).getRegex(),nC=Ge(/^!?\[(ref)\](?:\[\])?/).replace("ref",Jm).getRegex(),i4=Ge("reflink|nolink(?!\\()","g").replace("reflink",tC).replace("nolink",nC).getRegex(),m0=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,tg={_backpedal:Wo,anyPunctuation:t4,autolink:n4,blockSkip:UF,br:GE,code:jF,del:Wo,delLDelim:Wo,delRDelim:Wo,emStrongLDelim:KF,emStrongRDelimAst:GF,emStrongRDelimUnd:JF,escape:LF,link:s4,nolink:nC,punctuation:BF,reflink:tC,reflinkSearch:i4,tag:o4,text:FF,url:Wo},a4={...tg,link:Ge(/^!?\[(label)\]\((.*?)\)/).replace("label",Vu).getRegex(),reflink:Ge(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Vu).getRegex()},ep={...tg,emStrongRDelimAst:ZF,emStrongLDelim:YF,delLDelim:XF,delRDelim:e4,url:Ge(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",m0).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:Ge(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",m0).getRegex()},l4={...ep,br:Ge(GE).replace("{2,}","*").getRegex(),text:Ge(ep.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Al={normal:Qm,gfm:DF,pedantic:zF},Wi={normal:tg,gfm:ep,breaks:l4,pedantic:a4},c4={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},g0=t=>c4[t];function Qn(t,e){if(e){if(an.escapeTest.test(t))return t.replace(an.escapeReplace,g0)}else if(an.escapeTestNoEncode.test(t))return t.replace(an.escapeReplaceNoEncode,g0);return t}function y0(t){try{t=encodeURI(t).replace(an.percentDecode,"%")}catch{return null}return t}function b0(t,e){let n=t.replace(an.findPipe,(s,i,a)=>{let l=!1,c=i;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),r=n.split(an.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(an.slashPipe,"|");return r}function qi(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 u4(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 d4(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 v0(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 f4(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 Hu=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:qi(n,`
155
+ `)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=f4(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=qi(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:qi(e[0],`
156
+ `)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=qi(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
+ `),m=this.blockquote(p);s[s.length-1]=m,r=r.substring(0,r.length-h.raw.length)+m.raw,o=o.substring(0,o.length-h.text.length)+m.text;break}else if(f?.type==="list"){let h=f,p=h.raw+`
165
+ `+n.join(`
166
+ `),m=this.list(p);s[s.length-1]=m,r=r.substring(0,r.length-f.raw.length)+m.raw,o=o.substring(0,o.length-h.raw.length)+m.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=d4(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 m=this.rules.other.nextBulletRegex(p),g=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)||m.test(f)||g.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)||g.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=b0(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(b0(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=qi(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=u4(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)),v0(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 v0(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}}}},qn=class tp{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 Hu,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:an,block:Al.normal,inline:Wi.normal};this.options.pedantic?(n.block=Al.pedantic,n.inline=Wi.pedantic):this.options.gfm&&(n.block=Al.gfm,this.options.breaks?n.inline=Wi.breaks:n.inline=Wi.gfm),this.tokenizer.rules=n}static get rules(){return{block:Al,inline:Wi}}static lex(e,n){return new tp(n).lex(e)}static lexInline(e,n){return new tp(n).inlineTokens(e)}lex(e){e=e.replace(an.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(an.tabCharGlobal," ").replace(an.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}},Wu=class{options;parser;constructor(t){this.options=t||Ms}space(t){return""}code({text:t,lang:e,escaped:n}){let r=(e||"").match(an.notSpaceStart)?.[0],o=t.replace(an.endingNewline,"")+`
191
+ `;return r?'<pre><code class="language-'+Qn(r)+'">'+(n?o:Qn(o,!0))+`</code></pre>
192
+ `:"<pre><code>"+(n?o:Qn(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>${Qn(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=y0(t);if(o===null)return r;t=o;let s='<a href="'+t+'"';return e&&(s+=' title="'+Qn(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=y0(t);if(o===null)return Qn(n);t=o;let s=`<img src="${t}" alt="${Qn(n)}"`;return e&&(s+=` title="${Qn(e)}"`),s+=">",s}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Qn(t.text)}},ng=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}},Un=class np{options;renderer;textRenderer;constructor(e){this.options=e||Ms,this.options.renderer=this.options.renderer||new Wu,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ng}static parse(e,n){return new np(n).parse(e)}static parseInline(e,n){return new np(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}},ra=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?qn.lex:qn.lexInline}provideParser(){return this.block?Un.parse:Un.parseInline}},h4=class{defaults=Ym();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Un;Renderer=Wu;TextRenderer=ng;Lexer=qn;Tokenizer=Hu;Hooks=ra;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 Wu(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 Hu(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 ra;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];ra.passThroughHooks.has(s)?o[i]=c=>{if(this.defaults.async&&ra.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 qn.lex(t,e??this.defaults)}parser(t,e){return Un.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?qn.lex:qn.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?Un.parse:Un.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?qn.lex:qn.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?Un.parse:Un.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>"+Qn(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},gs=new h4;function nt(t,e){return gs.parse(t,e)}nt.options=nt.setOptions=function(t){return gs.setOptions(t),nt.defaults=gs.defaults,qE(nt.defaults),nt};nt.getDefaults=Ym;nt.defaults=Ms;nt.use=function(...t){return gs.use(...t),nt.defaults=gs.defaults,qE(nt.defaults),nt};nt.walkTokens=function(t,e){return gs.walkTokens(t,e)};nt.parseInline=gs.parseInline;nt.Parser=Un;nt.parser=Un.parse;nt.Renderer=Wu;nt.TextRenderer=ng;nt.Lexer=qn;nt.lexer=qn.lex;nt.Tokenizer=Hu;nt.Hooks=ra;nt.parse=nt;nt.options;nt.setOptions;nt.use;nt.walkTokens;nt.parseInline;Un.parse;qn.lex;var zf,w0;function p4(){if(w0)return zf;w0=1;function t(_){for(var q=1;q<arguments.length;q++){var C=arguments[q];for(var O in C)C.hasOwnProperty(O)&&(_[O]=C[O])}return _}function e(_,q){return Array(q+1).join(_)}function n(_){return _.replace(/^\n*/,"")}function r(_){for(var q=_.length;q>0&&_[q-1]===`
210
+ `;)q--;return _.substring(0,q)}function o(_){return r(n(_))}var s=["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 i(_){return h(_,s)}var a=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function l(_){return h(_,a)}function c(_){return p(_,a)}var u=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function d(_){return h(_,u)}function f(_){return p(_,u)}function h(_,q){return q.indexOf(_.nodeName)>=0}function p(_,q){return _.getElementsByTagName&&q.some(function(C){return _.getElementsByTagName(C).length})}var m={};m.paragraph={filter:"p",replacement:function(_){return`
211
+
212
+ `+_+`
213
+
214
+ `}},m.lineBreak={filter:"br",replacement:function(_,q,C){return C.br+`
215
+ `}},m.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(_,q,C){var O=Number(q.nodeName.charAt(1));if(C.headingStyle==="setext"&&O<3){var F=e(O===1?"=":"-",_.length);return`
216
+
217
+ `+_+`
218
+ `+F+`
219
+
220
+ `}else return`
221
+
222
+ `+e("#",O)+" "+_+`
223
+
224
+ `}},m.blockquote={filter:"blockquote",replacement:function(_){return _=o(_).replace(/^/gm,"> "),`
225
+
226
+ `+_+`
227
+
228
+ `}},m.list={filter:["ul","ol"],replacement:function(_,q){var C=q.parentNode;return C.nodeName==="LI"&&C.lastElementChild===q?`
229
+ `+_:`
230
+
231
+ `+_+`
232
+
233
+ `}},m.listItem={filter:"li",replacement:function(_,q,C){var O=C.bulletListMarker+" ",F=q.parentNode;if(F.nodeName==="OL"){var W=F.getAttribute("start"),X=Array.prototype.indexOf.call(F.children,q);O=(W?Number(W)+X:X+1)+". "}var ee=/\n$/.test(_);return _=o(_)+(ee?`
234
+ `:""),_=_.replace(/\n/gm,`
235
+ `+" ".repeat(O.length)),O+_+(q.nextSibling?`
236
+ `:"")}},m.indentedCodeBlock={filter:function(_,q){return q.codeBlockStyle==="indented"&&_.nodeName==="PRE"&&_.firstChild&&_.firstChild.nodeName==="CODE"},replacement:function(_,q,C){return`
237
+
238
+ `+q.firstChild.textContent.replace(/\n/g,`
239
+ `)+`
240
+
241
+ `}},m.fencedCodeBlock={filter:function(_,q){return q.codeBlockStyle==="fenced"&&_.nodeName==="PRE"&&_.firstChild&&_.firstChild.nodeName==="CODE"},replacement:function(_,q,C){for(var O=q.firstChild.getAttribute("class")||"",F=(O.match(/language-(\S+)/)||[null,""])[1],W=q.firstChild.textContent,X=C.fence.charAt(0),ee=3,ne=new RegExp("^"+X+"{3,}","gm"),oe;oe=ne.exec(W);)oe[0].length>=ee&&(ee=oe[0].length+1);var re=e(X,ee);return`
242
+
243
+ `+re+F+`
244
+ `+W.replace(/\n$/,"")+`
245
+ `+re+`
246
+
247
+ `}},m.horizontalRule={filter:"hr",replacement:function(_,q,C){return`
248
+
249
+ `+C.hr+`
250
+
251
+ `}},m.inlineLink={filter:function(_,q){return q.linkStyle==="inlined"&&_.nodeName==="A"&&_.getAttribute("href")},replacement:function(_,q){var C=q.getAttribute("href");C&&(C=C.replace(/([()])/g,"\\$1"));var O=g(q.getAttribute("title"));return O&&(O=' "'+O.replace(/"/g,'\\"')+'"'),"["+_+"]("+C+O+")"}},m.referenceLink={filter:function(_,q){return q.linkStyle==="referenced"&&_.nodeName==="A"&&_.getAttribute("href")},replacement:function(_,q,C){var O=q.getAttribute("href"),F=g(q.getAttribute("title"));F&&(F=' "'+F+'"');var W,X;switch(C.linkReferenceStyle){case"collapsed":W="["+_+"][]",X="["+_+"]: "+O+F;break;case"shortcut":W="["+_+"]",X="["+_+"]: "+O+F;break;default:var ee=this.references.length+1;W="["+_+"]["+ee+"]",X="["+ee+"]: "+O+F}return this.references.push(X),W},references:[],append:function(_){var q="";return this.references.length&&(q=`
252
+
253
+ `+this.references.join(`
254
+ `)+`
255
+
256
+ `,this.references=[]),q}},m.emphasis={filter:["em","i"],replacement:function(_,q,C){return _.trim()?C.emDelimiter+_+C.emDelimiter:""}},m.strong={filter:["strong","b"],replacement:function(_,q,C){return _.trim()?C.strongDelimiter+_+C.strongDelimiter:""}},m.code={filter:function(_){var q=_.previousSibling||_.nextSibling,C=_.parentNode.nodeName==="PRE"&&!q;return _.nodeName==="CODE"&&!C},replacement:function(_){if(!_)return"";_=_.replace(/\r?\n|\r/g," ");for(var q=/^`|^ .*?[^ ].* $|`$/.test(_)?" ":"",C="`",O=_.match(/`+/gm)||[];O.indexOf(C)!==-1;)C=C+"`";return C+q+_+q+C}},m.image={filter:"img",replacement:function(_,q){var C=g(q.getAttribute("alt")),O=q.getAttribute("src")||"",F=g(q.getAttribute("title")),W=F?' "'+F+'"':"";return O?"!["+C+"]("+O+W+")":""}};function g(_){return _?_.replace(/(\n+\s*)+/g,`
257
+ `):""}function y(_){this.options=_,this._keep=[],this._remove=[],this.blankRule={replacement:_.blankReplacement},this.keepReplacement=_.keepReplacement,this.defaultRule={replacement:_.defaultReplacement},this.array=[];for(var q in _.rules)this.array.push(_.rules[q])}y.prototype={add:function(_,q){this.array.unshift(q)},keep:function(_){this._keep.unshift({filter:_,replacement:this.keepReplacement})},remove:function(_){this._remove.unshift({filter:_,replacement:function(){return""}})},forNode:function(_){if(_.isBlank)return this.blankRule;var q;return(q=b(this.array,_,this.options))||(q=b(this._keep,_,this.options))||(q=b(this._remove,_,this.options))?q:this.defaultRule},forEach:function(_){for(var q=0;q<this.array.length;q++)_(this.array[q],q)}};function b(_,q,C){for(var O=0;O<_.length;O++){var F=_[O];if(w(F,q,C))return F}}function w(_,q,C){var O=_.filter;if(typeof O=="string"){if(O===q.nodeName.toLowerCase())return!0}else if(Array.isArray(O)){if(O.indexOf(q.nodeName.toLowerCase())>-1)return!0}else if(typeof O=="function"){if(O.call(_,q,C))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function k(_){var q=_.element,C=_.isBlock,O=_.isVoid,F=_.isPre||function(ae){return ae.nodeName==="PRE"};if(!(!q.firstChild||F(q))){for(var W=null,X=!1,ee=null,ne=x(ee,q,F);ne!==q;){if(ne.nodeType===3||ne.nodeType===4){var oe=ne.data.replace(/[ \r\n\t]+/g," ");if((!W||/ $/.test(W.data))&&!X&&oe[0]===" "&&(oe=oe.substr(1)),!oe){ne=v(ne);continue}ne.data=oe,W=ne}else if(ne.nodeType===1)C(ne)||ne.nodeName==="BR"?(W&&(W.data=W.data.replace(/ $/,"")),W=null,X=!1):O(ne)||F(ne)?(W=null,X=!0):W&&(X=!1);else{ne=v(ne);continue}var re=x(ee,ne,F);ee=ne,ne=re}W&&(W.data=W.data.replace(/ $/,""),W.data||v(W))}}function v(_){var q=_.nextSibling||_.parentNode;return _.parentNode.removeChild(_),q}function x(_,q,C){return _&&_.parentNode===q||C(q)?q.nextSibling||q.parentNode:q.firstChild||q.nextSibling||q.parentNode}var S=typeof window<"u"?window:{};function T(){var _=S.DOMParser,q=!1;try{new _().parseFromString("","text/html")&&(q=!0)}catch{}return q}function I(){var _=function(){};return L()?_.prototype.parseFromString=function(q){var C=new window.ActiveXObject("htmlfile");return C.designMode="on",C.open(),C.write(q),C.close(),C}:_.prototype.parseFromString=function(q){var C=document.implementation.createHTMLDocument("");return C.open(),C.write(q),C.close(),C},_}function L(){var _=!1;try{document.implementation.createHTMLDocument("").open()}catch{S.ActiveXObject&&(_=!0)}return _}var N=T()?S.DOMParser:I();function P(_,q){var C;if(typeof _=="string"){var O=j().parseFromString('<x-turndown id="turndown-root">'+_+"</x-turndown>","text/html");C=O.getElementById("turndown-root")}else C=_.cloneNode(!0);return k({element:C,isBlock:i,isVoid:l,isPre:q.preformattedCode?K:null}),C}var A;function j(){return A=A||new N,A}function K(_){return _.nodeName==="PRE"||_.nodeName==="CODE"}function J(_,q){return _.isBlock=i(_),_.isCode=_.nodeName==="CODE"||_.parentNode.isCode,_.isBlank=Y(_),_.flankingWhitespace=G(_,q),_}function Y(_){return!l(_)&&!d(_)&&/^\s*$/i.test(_.textContent)&&!c(_)&&!f(_)}function G(_,q){if(_.isBlock||q.preformattedCode&&_.isCode)return{leading:"",trailing:""};var C=U(_.textContent);return C.leadingAscii&&z("left",_,q)&&(C.leading=C.leadingNonAscii),C.trailingAscii&&z("right",_,q)&&(C.trailing=C.trailingNonAscii),{leading:C.leading,trailing:C.trailing}}function U(_){var q=_.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:q[1],leadingAscii:q[2],leadingNonAscii:q[3],trailing:q[4],trailingNonAscii:q[5],trailingAscii:q[6]}}function z(_,q,C){var O,F,W;return _==="left"?(O=q.previousSibling,F=/ $/):(O=q.nextSibling,F=/^ /),O&&(O.nodeType===3?W=F.test(O.nodeValue):C.preformattedCode&&O.nodeName==="CODE"?W=!1:O.nodeType===1&&!i(O)&&(W=F.test(O.textContent))),W}var B=Array.prototype.reduce,H=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function V(_){if(!(this instanceof V))return new V(_);var q={rules:m,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(C,O){return O.isBlock?`
258
+
259
+ `:""},keepReplacement:function(C,O){return O.isBlock?`
260
+
261
+ `+O.outerHTML+`
262
+
263
+ `:O.outerHTML},defaultReplacement:function(C,O){return O.isBlock?`
264
+
265
+ `+C+`
266
+
267
+ `:C}};this.options=t({},q,_),this.rules=new y(this.options)}V.prototype={turndown:function(_){if(!Q(_))throw new TypeError(_+" is not a string, or an element/document/fragment node.");if(_==="")return"";var q=R.call(this,new P(_,this.options));return D.call(this,q)},use:function(_){if(Array.isArray(_))for(var q=0;q<_.length;q++)this.use(_[q]);else if(typeof _=="function")_(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(_,q){return this.rules.add(_,q),this},keep:function(_){return this.rules.keep(_),this},remove:function(_){return this.rules.remove(_),this},escape:function(_){return H.reduce(function(q,C){return q.replace(C[0],C[1])},_)}};function R(_){var q=this;return B.call(_.childNodes,function(C,O){O=new J(O,q.options);var F="";return O.nodeType===3?F=O.isCode?O.nodeValue:q.escape(O.nodeValue):O.nodeType===1&&(F=$.call(q,O)),Z(C,F)},"")}function D(_){var q=this;return this.rules.forEach(function(C){typeof C.append=="function"&&(_=Z(_,C.append(q.options)))}),_.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function $(_){var q=this.rules.forNode(_),C=R.call(this,_),O=_.flankingWhitespace;return(O.leading||O.trailing)&&(C=C.trim()),O.leading+q.replacement(C,_,this.options)+O.trailing}function Z(_,q){var C=r(_),O=n(q),F=Math.max(_.length-C.length,q.length-O.length),W=`
268
+
269
+ `.substring(0,F);return C+W+O}function Q(_){return _!=null&&(typeof _=="string"||_.nodeType&&(_.nodeType===1||_.nodeType===9||_.nodeType===11))}return zf=V,zf}var m4=p4();const g4=fp(m4);var k0=/highlight-(?:text|source)-([a-z0-9]+)/;function y4(t){t.addRule("highlightedCodeBlock",{filter:function(e){var n=e.firstChild;return e.nodeName==="DIV"&&k0.test(e.className)&&n&&n.nodeName==="PRE"},replacement:function(e,n,r){var o=n.className||"",s=(o.match(k0)||[null,""])[1];return`
270
+
271
+ `+r.fence+s+`
272
+ `+n.firstChild.textContent+`
273
+ `+r.fence+`
274
+
275
+ `}})}function b4(t){t.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(e){return"~"+e+"~"}})}var v4=Array.prototype.indexOf,w4=Array.prototype.every,Ci={};Ci.tableCell={filter:["th","td"],replacement:function(t,e){return rC(t,e)}};Ci.tableRow={filter:"tr",replacement:function(t,e){var n="",r={left:":--",right:"--:",center:":-:"};if(rg(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+=rC(s,e.childNodes[o])}return`
276
+ `+t+(n?`
277
+ `+n:"")}};Ci.table={filter:function(t){return t.nodeName==="TABLE"&&rg(t.rows[0])},replacement:function(t){return t=t.replace(`
278
+
279
+ `,`
280
+ `),`
281
+
282
+ `+t+`
283
+
284
+ `}};Ci.tableSection={filter:["thead","tbody","tfoot"],replacement:function(t){return t}};function rg(t){var e=t.parentNode;return e.nodeName==="THEAD"||e.firstChild===t&&(e.nodeName==="TABLE"||k4(e))&&w4.call(t.childNodes,function(n){return n.nodeName==="TH"})}function k4(t){var e=t.previousSibling;return t.nodeName==="TBODY"&&(!e||e.nodeName==="THEAD"&&/^\s*$/i.test(e.textContent))}function rC(t,e){var n=v4.call(e.parentNode.childNodes,e),r=" ";return n===0&&(r="| "),r+t+" |"}function x4(t){t.keep(function(n){return n.nodeName==="TABLE"&&!rg(n.rows[0])});for(var e in Ci)t.addRule(e,Ci[e])}function S4(t){t.addRule("taskListItems",{filter:function(e){return e.type==="checkbox"&&e.parentNode.nodeName==="LI"},replacement:function(e,n){return(n.checked?"[x]":"[ ]")+" "}})}function E4(t){t.use([y4,b4,x4,S4])}const $d=new g4({headingStyle:"atx",codeBlockStyle:"fenced",bulletListMarker:"-",emDelimiter:"*",strongDelimiter:"**"});$d.use(E4);$d.addRule("imageWithOriginalSource",{filter:"img",replacement:(t,e)=>{const n=e.getAttribute("alt")??"",r=e.getAttribute("data-original-src")??e.getAttribute("src")??"";return r?`![${n}](${r})`:""}});$d.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 x0(t){const e=nt.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,"&quot;");return`<img${r}src=${o}${s}${o} data-original-src="${a}"${i}>`})}function C4(t){return $d.turndown(t).replace(/\n{3,}/g,`
288
+
289
+ `).trimEnd()}const T4="image",qu="data-original-src",M4=lF.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 R4(t){const e=t.trim().toLowerCase();return!(!e||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:")||e.startsWith("blob:"))}function O4(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 _n(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 S0=[{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 N4({content:t,onChange:e,currentFilePath:n}){const[r,o]=E.useState(),[s,i]=E.useState(0),[a,l]=E.useState(!1),[c,u]=E.useState("assets"),[d,f]=E.useState("asset"),[h,p]=E.useState(""),m=E.useRef(!1),g=E.useRef(t),y=E.useRef(new Map),b=E.useRef(new Set),w=E.useCallback(N=>{const P=O4(N);o(P),i(0)},[]),k=E.useCallback(N=>{if(!n)return;const P=Array.from(N.view.dom.querySelectorAll("img"));for(const A of P){const K=(A.getAttribute(qu)??A.getAttribute("src")??"").trim();if(!R4(K))continue;const J=`${n}::${K}`,Y=y.current.get(J);if(Y){A.getAttribute("src")!==Y&&A.setAttribute("src",Y);continue}b.current.has(J)||(b.current.add(J),WE({data:{currentFilePath:n,sourcePath:K}}).then(async G=>{if(!G.ok)throw new Error(`Preview request failed (${G.status})`);const U=await G.blob(),z=URL.createObjectURL(U);y.current.set(J,z);const B=Array.from(N.view.dom.querySelectorAll("img"));for(const H of B)(H.getAttribute(qu)??H.getAttribute("src")??"").trim()===K&&H.setAttribute("src",z)}).catch(()=>{}).finally(()=>{b.current.delete(J)}))}},[n]),v=yj({immediatelyRender:!1,extensions:[nF.configure({heading:{levels:[1,2,3]}}),h3.configure({openOnClick:!1,linkOnPaste:!0,autolink:!0}),rF.configure({placeholder:"Start writing your article..."}),oF,sF.configure({nested:!0}),M4.configure({inline:!1,allowBase64:!1})],content:x0(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:N})=>{if(w(N),k(N),m.current)return;const P=C4(N.getHTML());P!==g.current&&(g.current=P,e(P))},onSelectionUpdate:({editor:N})=>{w(N)}});E.useEffect(()=>()=>{for(const N of y.current.values())URL.revokeObjectURL(N);y.current.clear(),b.current.clear()},[]),E.useEffect(()=>{for(const N of y.current.values())URL.revokeObjectURL(N);y.current.clear(),b.current.clear()},[n]),E.useEffect(()=>{if(v&&t!==g.current){m.current=!0;try{v.commands.setContent(x0(t),{emitUpdate:!1}),g.current=t,w(v),k(v)}finally{m.current=!1}}},[k,t,v,w]),E.useEffect(()=>{v&&k(v)},[k,v]);const x=E.useMemo(()=>r?r.query.length===0?S0:S0.filter(N=>N.label.toLowerCase().includes(r.query)?!0:N.aliases.some(P=>P.includes(r.query))):[],[r]),S=E.useCallback(N=>{const P=N.trim();!v||P.length===0||(v.chain().focus().setImage({src:P,alt:T4}).run(),p(""),l(!1))},[v]),T=E.useCallback(N=>{v&&(r&&v.chain().focus().deleteRange({from:r.from,to:r.to}).run(),N.run(v,{openImagePanel:()=>{l(!0)}}),o(void 0))},[v,r]),I=E.useCallback(()=>{if(!v)return;const N=v.getAttributes("link").href,P=window.prompt("Enter link URL",N??"https://");if(P===null)return;const A=P.trim();if(A.length===0){v.chain().focus().unsetLink().run();return}v.chain().focus().extendMarkRange("link").setLink({href:A}).run()},[v]),L=E.useCallback(N=>{if(!(!r||x.length===0)){if(N.key==="ArrowDown"){N.preventDefault(),i(P=>(P+1)%x.length);return}if(N.key==="ArrowUp"){N.preventDefault(),i(P=>P<=0?x.length-1:P-1);return}if(N.key==="Escape"){N.preventDefault(),o(void 0);return}if(N.key==="Enter"||N.key==="Tab"){N.preventDefault();const P=x[s%x.length];T(P)}}},[T,x,s,r]);return v?M.jsxs("div",{className:"relative flex h-full min-h-0 w-full flex-col overflow-hidden",onKeyDownCapture:L,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(_n,{label:"Heading 1",active:v.isActive("heading",{level:1}),onClick:()=>v.chain().focus().toggleHeading({level:1}).run(),children:M.jsx(UN,{className:"size-3.5"})}),M.jsx(_n,{label:"Heading 2",active:v.isActive("heading",{level:2}),onClick:()=>v.chain().focus().toggleHeading({level:2}).run(),children:M.jsx(YN,{className:"size-3.5"})}),M.jsx(_n,{label:"Bullet list",active:v.isActive("bulletList"),onClick:()=>v.chain().focus().toggleBulletList().run(),children:M.jsx(s_,{className:"size-3.5"})}),M.jsx(_n,{label:"Numbered list",active:v.isActive("orderedList"),onClick:()=>v.chain().focus().toggleOrderedList().run(),children:M.jsx(r_,{className:"size-3.5"})}),M.jsx(_n,{label:"Checklist",active:v.isActive("taskList"),onClick:()=>v.chain().focus().toggleTaskList().run(),children:M.jsx(t_,{className:"size-3.5"})}),M.jsx(_n,{label:"Quote",active:v.isActive("blockquote"),onClick:()=>v.chain().focus().toggleBlockquote().run(),children:M.jsx(v_,{className:"size-3.5"})}),M.jsx(_n,{label:"Code block",active:v.isActive("codeBlock"),onClick:()=>v.chain().focus().toggleCodeBlock().run(),children:M.jsx(WN,{className:"size-3.5"})}),M.jsx(_n,{label:"Divider",onClick:()=>v.chain().focus().setHorizontalRule().run(),children:M.jsx(a_,{className:"size-3.5"})}),M.jsx(_n,{label:"Bold",active:v.isActive("bold"),onClick:()=>v.chain().focus().toggleBold().run(),children:"B"}),M.jsx(_n,{label:"Italic",active:v.isActive("italic"),onClick:()=>v.chain().focus().toggleItalic().run(),children:M.jsx("span",{className:"italic",children:"I"})}),M.jsx(_n,{label:"Inline code",active:v.isActive("code"),onClick:()=>v.chain().focus().toggleCode().run(),children:"</>"}),M.jsx(_n,{label:"Link",active:v.isActive("link"),onClick:I,children:M.jsx(QN,{className:"size-3.5"})}),M.jsxs(Nd,{open:a,onOpenChange:l,children:[M.jsx(_d,{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(zp,{className:"size-3.5"})}),M.jsx(Pd,{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(VE,{currentFilePath:n,sourceMode:d,onSourceModeChange:f,onSelectPath:S}):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(gr,{value:h,onChange:N=>p(N.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(yn,{type:"button",size:"sm",variant:"secondary",onClick:()=>{h.trim().length!==0&&S(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(aE,{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((N,P)=>M.jsx("button",{type:"button",className:ue("w-full rounded-md px-2 py-1.5 text-left text-xs transition-colors",P===s?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/70 hover:text-foreground"),onMouseDown:A=>{A.preventDefault(),T(N)},children:N.label},N.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 E0=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},_4=(t=>t?E0(t):E0),P4=t=>t;function A4(t,e=P4){const n=de.useSyncExternalStore(t.subscribe,de.useCallback(()=>e(t.getState()),[t,e]),de.useCallback(()=>e(t.getInitialState()),[t,e]));return de.useDebugValue(n),n}const C0=t=>{const e=_4(t),n=r=>A4(e,r);return Object.assign(n,e),n},I4=(t=>t?C0(t):C0),$4=/^\s*(import|export)\s+/,D4=/<\/?[A-Z][A-Za-z0-9._-]*(\s|>|\/>)/,z4=/<\s*\/?\s*>/,L4=/^\s*\{[\s\S]*\}\s*$/,j4=/^\s*(```|~~~)/;function F4(t){return j4.test(t)}function B4(t){return $4.test(t)}function oC(t){return D4.test(t)||z4.test(t)}function V4(t){const e=t.trim();return e.length<2||oC(e)?!1:L4.test(e)}function H4(t){const e=t.split(/\r?\n/);let n=!1;for(const r of e){if(F4(r)){n=!n;continue}if(!n){if(B4(r))return{supported:!1,reason:"contains MDX import/export statements"};if(oC(r))return{supported:!1,reason:"contains JSX component syntax"};if(V4(r))return{supported:!1,reason:"contains standalone MDX expressions"}}}return{supported:!0}}function T0(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Il(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(T0(t)&&T0(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 W4(t){const e=t.trim();return e.length>0?e:void 0}function Lf(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}function $l(t,e,n){const r={...t};return n===void 0?delete r[e]:r[e]=n,r}function Is(t){return rp(t.draft,t.initial)?t.contentDraft!==t.initialContent:!0}function jf(t){const e=H4(t);return e.supported?{richModeAvailability:"supported",richModeBlockReason:void 0}:{richModeAvailability:"blocked",richModeBlockReason:e.reason}}const ct=I4(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=Il(r),l=jf(o);return{collectionName:e,fileId:n,draft:a,initial:Il(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=$l(r.draft,e,n);return{draft:o,dirty:Is({draft:o,initial:r.initial,contentDraft:r.contentDraft,initialContent:r.initialContent})}}),setContentDraft:e=>t(n=>({...(()=>{const r=jf(e);return{...r,editorMode:r.richModeAvailability==="blocked"?"basic":n.editorMode}})(),contentDraft:e,dirty:Is({draft:n.draft,initial:n.initial,contentDraft:e,initialContent:n.initialContent})})),applyRevisionSnapshot:({draft:e,content:n})=>t(r=>{const o=Il(e),s=jf(n);return{...s,editorMode:s.richModeAvailability==="blocked"?"basic":r.editorMode,draft:o,contentDraft:n,dirty:Is({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:Il(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=W4(n);if(!o)return r;const s=Lf(r.draft[e]);if(s.includes(o))return{chipInputs:{...r.chipInputs,[e]:""}};const i=[...s,o],a=$l(r.draft,e,i);return{draft:a,dirty:Is({draft:a,initial:r.initial,contentDraft:r.contentDraft,initialContent:r.initialContent}),chipInputs:{...r.chipInputs,[e]:""}}}),removeChipValue:(e,n)=>t(r=>{const o=Lf(r.draft[e]);if(n<0||n>=o.length)return r;const s=o.filter((a,l)=>l!==n),i=$l(r.draft,e,s.length>0?s:void 0);return{draft:i,dirty:Is({draft:i,initial:r.initial,contentDraft:r.contentDraft,initialContent:r.initialContent})}}),removeLastChipValue:e=>t(n=>{const r=Lf(n.draft[e]);if(r.length===0)return n;const o=r.slice(0,-1),s=$l(n.draft,e,o.length>0?o:void 0);return{draft:s,dirty:Is({draft:s,initial:n.initial,contentDraft:n.contentDraft,initialContent:n.initialContent})}})}));function q4(t){const e=Me.c(12),{currentFilePath:n}=t,r=ct(Z4),o=ct(G4),s=ct(Y4),i=ct(K4),a=ct(U4),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(N4,{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(hI,{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 U4(t){return t.richModeBlockReason}function K4(t){return t.richModeAvailability}function Y4(t){return t.editorMode}function G4(t){return t.setContentDraft}function Z4(t){return t.contentDraft}function J4(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 X4={},oa={};function Jo(t,e){try{const r=(X4[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in oa?oa[r]:M0(r,r.split(":"))}catch{if(t in oa)return oa[t];const n=t?.match(Q4);return n?M0(t,n.slice(1)):NaN}}const Q4=/([+-]\d\d):?(\d\d)?/;function M0(t,e){const n=+(e[0]||0),r=+(e[1]||0),o=+(e[2]||0)/60;return oa[t]=n*60+r>0?n*60+r+o:n*60-r-o}class ar 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)),sC(this),op(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new ar(...n,e):new ar(Date.now(),e)}withTimeZone(e){return new ar(+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 ar(+new Date(e),this.timeZone)}}const R0=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!R0.test(t))return;const e=t.replace(R0,"$1UTC");ar.prototype[e]&&(t.startsWith("get")?ar.prototype[t]=function(){return this.internal[e]()}:(ar.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),eB(this),+this},ar.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 eB(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()),sC(t)}function sC(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),m=-new Date(+t).getTimezoneOffset()-h,g=h!==n,y=m-l;if(g&&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 Xt extends ar{static tz(e,...n){return n.length?new Xt(...n,e):new Xt(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} (${J4(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 Xt(+this,e)}[Symbol.for("constructDateFrom")](e){return new Xt(+new Date(e),this.timeZone)}}const iC=6048e5,tB=864e5,O0=Symbol.for("constructDateFrom");function _t(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&O0 in t?t[O0](e):t instanceof Date?new t.constructor(e):new Date(e)}function at(t,e){return _t(e||t,t)}function aC(t,e,n){const r=at(t,n?.in);return isNaN(e)?_t(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function lC(t,e,n){const r=at(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 nB={};function tl(){return nB}function Ti(t,e){const n=tl(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,o=at(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 Fa(t,e){return Ti(t,{...e,weekStartsOn:1})}function cC(t,e){const n=at(t,e?.in),r=n.getFullYear(),o=_t(n,0);o.setFullYear(r+1,0,4),o.setHours(0,0,0,0);const s=Fa(o),i=_t(n,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const a=Fa(i);return n.getTime()>=s.getTime()?r+1:n.getTime()>=a.getTime()?r:r-1}function N0(t){const e=at(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 zi(t,...e){const n=_t.bind(null,e.find(r=>typeof r=="object"));return e.map(n)}function Ba(t,e){const n=at(t,e?.in);return n.setHours(0,0,0,0),n}function og(t,e,n){const[r,o]=zi(n?.in,t,e),s=Ba(r),i=Ba(o),a=+s-N0(s),l=+i-N0(i);return Math.round((a-l)/tB)}function rB(t,e){const n=cC(t,e),r=_t(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Fa(r)}function oB(t,e,n){return aC(t,e*7,n)}function sB(t,e,n){return lC(t,e*12,n)}function iB(t,e){let n,r=e?.in;return t.forEach(o=>{!r&&typeof o=="object"&&(r=_t.bind(null,o));const s=at(o,r);(!n||n<s||isNaN(+s))&&(n=s)}),_t(r,n||NaN)}function aB(t,e){let n,r=e?.in;return t.forEach(o=>{!r&&typeof o=="object"&&(r=_t.bind(null,o));const s=at(o,r);(!n||n>s||isNaN(+s))&&(n=s)}),_t(r,n||NaN)}function lB(t,e,n){const[r,o]=zi(n?.in,t,e);return+Ba(r)==+Ba(o)}function uC(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function cB(t){return!(!uC(t)&&typeof t!="number"||isNaN(+at(t)))}function dC(t,e,n){const[r,o]=zi(n?.in,t,e),s=r.getFullYear()-o.getFullYear(),i=r.getMonth()-o.getMonth();return s*12+i}function uB(t,e){const n=at(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function fC(t,e){const[n,r]=zi(t,e.start,e.end);return{start:n,end:r}}function dB(t,e){const{start:n,end:r}=fC(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 fB(t,e){const n=at(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function hB(t,e){const n=at(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function hC(t,e){const n=at(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function pB(t,e){const{start:n,end:r}=fC(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 pC(t,e){const n=tl(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,o=at(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 mB(t,e){return pC(t,{...e,weekStartsOn:1})}const gB={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"}},yB=(t,e,n)=>{let r;const o=gB[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 Ff(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const bB={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},vB={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},wB={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},kB={date:Ff({formats:bB,defaultWidth:"full"}),time:Ff({formats:vB,defaultWidth:"full"}),dateTime:Ff({formats:wB,defaultWidth:"full"})},xB={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},SB=(t,e,n,r)=>xB[t];function Ui(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 EB={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},CB={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},TB={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"]},MB={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"]},RB={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"}},OB={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"}},NB=(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"},_B={ordinalNumber:NB,era:Ui({values:EB,defaultWidth:"wide"}),quarter:Ui({values:CB,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ui({values:TB,defaultWidth:"wide"}),day:Ui({values:MB,defaultWidth:"wide"}),dayPeriod:Ui({values:RB,defaultWidth:"wide",formattingValues:OB,defaultFormattingWidth:"wide"})};function Ki(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)?AB(a,d=>d.test(i)):PB(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 PB(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function AB(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function IB(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 $B=/^(\d+)(th|st|nd|rd)?/i,DB=/\d+/i,zB={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},LB={any:[/^b/i,/^(a|c)/i]},jB={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},FB={any:[/1/i,/2/i,/3/i,/4/i]},BB={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},VB={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]},HB={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},WB={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]},qB={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},UB={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}},KB={ordinalNumber:IB({matchPattern:$B,parsePattern:DB,valueCallback:t=>parseInt(t,10)}),era:Ki({matchPatterns:zB,defaultMatchWidth:"wide",parsePatterns:LB,defaultParseWidth:"any"}),quarter:Ki({matchPatterns:jB,defaultMatchWidth:"wide",parsePatterns:FB,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Ki({matchPatterns:BB,defaultMatchWidth:"wide",parsePatterns:VB,defaultParseWidth:"any"}),day:Ki({matchPatterns:HB,defaultMatchWidth:"wide",parsePatterns:WB,defaultParseWidth:"any"}),dayPeriod:Ki({matchPatterns:qB,defaultMatchWidth:"any",parsePatterns:UB,defaultParseWidth:"any"})},Ws={code:"en-US",formatDistance:yB,formatLong:kB,formatRelative:SB,localize:_B,match:KB,options:{weekStartsOn:0,firstWeekContainsDate:1}};function YB(t,e){const n=at(t,e?.in);return og(n,hC(n))+1}function sg(t,e){const n=at(t,e?.in),r=+Fa(n)-+rB(n);return Math.round(r/iC)+1}function mC(t,e){const n=at(t,e?.in),r=n.getFullYear(),o=tl(),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=Ti(i,e),l=_t(e?.in||t,0);l.setFullYear(r,0,s),l.setHours(0,0,0,0);const c=Ti(l,e);return+n>=+a?r+1:+n>=+c?r:r-1}function GB(t,e){const n=tl(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,o=mC(t,e),s=_t(e?.in||t,0);return s.setFullYear(o,0,r),s.setHours(0,0,0,0),Ti(s,e)}function ig(t,e){const n=at(t,e?.in),r=+Ti(n,e)-+GB(n,e);return Math.round(r/iC)+1}function et(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const Kr={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return et(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):et(n+1,2)},d(t,e){return et(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 et(t.getHours()%12||12,e.length)},H(t,e){return et(t.getHours(),e.length)},m(t,e){return et(t.getMinutes(),e.length)},s(t,e){return et(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),o=Math.trunc(r*Math.pow(10,n-3));return et(o,e.length)}},$s={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},_0={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 Kr.y(t,e)},Y:function(t,e,n,r){const o=mC(t,r),s=o>0?o:1-o;if(e==="YY"){const i=s%100;return et(i,2)}return e==="Yo"?n.ordinalNumber(s,{unit:"year"}):et(s,e.length)},R:function(t,e){const n=cC(t);return et(n,e.length)},u:function(t,e){const n=t.getFullYear();return et(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 et(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 et(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 Kr.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 et(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=ig(t,r);return e==="wo"?n.ordinalNumber(o,{unit:"week"}):et(o,e.length)},I:function(t,e,n){const r=sg(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):et(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Kr.d(t,e)},D:function(t,e,n){const r=YB(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):et(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 et(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 et(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 et(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=$s.noon:r===0?o=$s.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=$s.evening:r>=12?o=$s.afternoon:r>=4?o=$s.morning:o=$s.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 Kr.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Kr.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):et(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):et(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Kr.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Kr.s(t,e)},S:function(t,e){return Kr.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return A0(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 A0(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"+P0(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"+P0(r,":");default:return"GMT"+Vo(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return et(r,e.length)},T:function(t,e,n){return et(+t,e.length)}};function P0(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+et(s,2)}function A0(t,e){return t%60===0?(t>0?"-":"+")+et(Math.abs(t)/60,2):Vo(t,e)}function Vo(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),o=et(Math.trunc(r/60),2),s=et(r%60,2);return n+o+e+s}const I0=(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"})}},gC=(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"})}},ZB=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],o=n[2];if(!o)return I0(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}}",I0(r,e)).replace("{{time}}",gC(o,e))},JB={p:gC,P:ZB},XB=/^D+$/,QB=/^Y+$/,e5=["D","DD","YY","YYYY"];function t5(t){return XB.test(t)}function n5(t){return QB.test(t)}function r5(t,e,n){const r=o5(t,e,n);if(console.warn(r),e5.includes(t))throw new RangeError(r)}function o5(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 s5=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,i5=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,a5=/^'([^]*?)'?$/,l5=/''/g,c5=/[a-zA-Z]/;function sa(t,e,n){const r=tl(),o=n?.locale??r.locale??Ws,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=at(t,n?.in);if(!cB(a))throw new RangeError("Invalid time value");let l=e.match(i5).map(u=>{const d=u[0];if(d==="p"||d==="P"){const f=JB[d];return f(u,o.formatLong)}return u}).join("").match(s5).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:u5(u)};if(_0[d])return{isToken:!0,value:u};if(d.match(c5))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&&n5(d)||!n?.useAdditionalDayOfYearTokens&&t5(d))&&r5(d,e,String(t));const f=_0[d[0]];return f(a,d,o.localize,c)}).join("")}function u5(t){const e=t.match(a5);return e?e[1].replace(l5,"'"):t}function d5(t,e){const n=at(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 f5(t,e){return at(t,e?.in).getMonth()}function h5(t,e){return at(t,e?.in).getFullYear()}function p5(t,e){return+at(t)>+at(e)}function m5(t,e){return+at(t)<+at(e)}function g5(t,e,n){const[r,o]=zi(n?.in,t,e);return r.getFullYear()===o.getFullYear()&&r.getMonth()===o.getMonth()}function y5(t,e,n){const[r,o]=zi(n?.in,t,e);return r.getFullYear()===o.getFullYear()}function b5(t,e,n){const r=at(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=d5(i);return r.setMonth(e,Math.min(s,a)),r}function v5(t,e,n){const r=at(t,n?.in);return isNaN(+r)?_t(t,NaN):(r.setFullYear(e),r)}const $0=5,w5=4;function k5(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,o=e.addDays(t,-r+1),s=e.addDays(o,$0*7-1);return e.getMonth(t)===e.getMonth(s)?$0:w5}function yC(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 x5(t,e){const n=yC(t,e),r=k5(t,e);return e.addDays(n,r*7-1)}const bC={...Ws,labels:{labelDayButton:(t,e,n,r)=>{let o;r&&typeof r.format=="function"?o=r.format.bind(r):o=(i,a)=>sa(i,a,{locale:Ws,...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)=>sa(o,s,{locale:Ws,...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)=>sa(i,a,{locale:Ws,...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)=>sa(o,s,{locale:Ws,...e}),r(t,"cccc")}}};class On{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Xt.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 Xt(r,o,s,this.options.timeZone):new Date(r,o,s),this.addDays=(r,o)=>this.overrides?.addDays?this.overrides.addDays(r,o):aC(r,o),this.addMonths=(r,o)=>this.overrides?.addMonths?this.overrides.addMonths(r,o):lC(r,o),this.addWeeks=(r,o)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,o):oB(r,o),this.addYears=(r,o)=>this.overrides?.addYears?this.overrides.addYears(r,o):sB(r,o),this.differenceInCalendarDays=(r,o)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,o):og(r,o),this.differenceInCalendarMonths=(r,o)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,o):dC(r,o),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):dB(r),this.eachYearOfInterval=r=>{const o=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):pB(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):x5(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):mB(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):uB(r),this.endOfWeek=(r,o)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,o):pC(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):hB(r),this.format=(r,o,s)=>{const i=this.overrides?.format?this.overrides.format(r,o,this.options):sa(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):sg(r),this.getMonth=(r,o)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):f5(r,this.options),this.getYear=(r,o)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):h5(r,this.options),this.getWeek=(r,o)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):ig(r,this.options),this.isAfter=(r,o)=>this.overrides?.isAfter?this.overrides.isAfter(r,o):p5(r,o),this.isBefore=(r,o)=>this.overrides?.isBefore?this.overrides.isBefore(r,o):m5(r,o),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):uC(r),this.isSameDay=(r,o)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,o):lB(r,o),this.isSameMonth=(r,o)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,o):g5(r,o),this.isSameYear=(r,o)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,o):y5(r,o),this.max=r=>this.overrides?.max?this.overrides.max(r):iB(r),this.min=r=>this.overrides?.min?this.overrides.min(r):aB(r),this.setMonth=(r,o)=>this.overrides?.setMonth?this.overrides.setMonth(r,o):b5(r,o),this.setYear=(r,o)=>this.overrides?.setYear?this.overrides.setYear(r,o):v5(r,o),this.startOfBroadcastWeek=(r,o)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):yC(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):Ba(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):Fa(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):fB(r),this.startOfWeek=(r,o)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):Ti(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):hC(r),this.options={locale:bC,...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&&On.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:o}=this.options,s=n?.code;if(s&&On.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)}}On.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 yr=new On;class vC{constructor(e,n,r=yr){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 S5{constructor(e,n){this.date=e,this.weeks=n}}class E5{constructor(e,n){this.days=n,this.weekNumber=e}}function C5(t){return de.createElement("button",{...t})}function T5(t){return de.createElement("span",{...t})}function M5(t){const{size:e=24,orientation:n="left",className:r}=t;return de.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&de.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&de.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&de.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&de.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function R5(t){const{day:e,modifiers:n,...r}=t;return de.createElement("td",{...r})}function O5(t){const{day:e,modifiers:n,...r}=t,o=de.useRef(null);return de.useEffect(()=>{n.focused&&o.current?.focus()},[n.focused]),de.createElement("button",{ref:o,...r})}var Ce;(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"})(Ce||(Ce={}));var mt;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(mt||(mt={}));var Gn;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(Gn||(Gn={}));var kn;(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"})(kn||(kn={}));function N5(t){const{options:e,className:n,components:r,classNames:o,...s}=t,i=[o[Ce.Dropdown],n].join(" "),a=e?.find(({value:l})=>l===s.value);return de.createElement("span",{"data-disabled":s.disabled,className:o[Ce.DropdownRoot]},de.createElement(r.Select,{className:i,...s},e?.map(({value:l,label:c,disabled:u})=>de.createElement(r.Option,{key:l,value:l,disabled:u},c))),de.createElement("span",{className:o[Ce.CaptionLabel],"aria-hidden":!0},a?.label,de.createElement(r.Chevron,{orientation:"down",size:18,className:o[Ce.Chevron]})))}function _5(t){return de.createElement("div",{...t})}function P5(t){return de.createElement("div",{...t})}function A5(t){const{calendarMonth:e,displayIndex:n,...r}=t;return de.createElement("div",{...r},t.children)}function I5(t){const{calendarMonth:e,displayIndex:n,...r}=t;return de.createElement("div",{...r})}function $5(t){return de.createElement("table",{...t})}function D5(t){return de.createElement("div",{...t})}const wC=E.createContext(void 0);function nl(){const t=E.useContext(wC);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function z5(t){const{components:e}=nl();return de.createElement(e.Dropdown,{...t})}function L5(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:o,...s}=t,{components:i,classNames:a,labels:{labelPrevious:l,labelNext:c}}=nl(),u=E.useCallback(f=>{o&&n?.(f)},[o,n]),d=E.useCallback(f=>{r&&e?.(f)},[r,e]);return de.createElement("nav",{...s},de.createElement(i.PreviousMonthButton,{type:"button",className:a[Ce.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":l(r),onClick:d},de.createElement(i.Chevron,{disabled:r?void 0:!0,className:a[Ce.Chevron],orientation:"left"})),de.createElement(i.NextMonthButton,{type:"button",className:a[Ce.NextMonthButton],tabIndex:o?void 0:-1,"aria-disabled":o?void 0:!0,"aria-label":c(o),onClick:u},de.createElement(i.Chevron,{disabled:o?void 0:!0,orientation:"right",className:a[Ce.Chevron]})))}function j5(t){const{components:e}=nl();return de.createElement(e.Button,{...t})}function F5(t){return de.createElement("option",{...t})}function B5(t){const{components:e}=nl();return de.createElement(e.Button,{...t})}function V5(t){const{rootRef:e,...n}=t;return de.createElement("div",{...n,ref:e})}function H5(t){return de.createElement("select",{...t})}function W5(t){const{week:e,...n}=t;return de.createElement("tr",{...n})}function q5(t){return de.createElement("th",{...t})}function U5(t){return de.createElement("thead",{"aria-hidden":!0},de.createElement("tr",{...t}))}function K5(t){const{week:e,...n}=t;return de.createElement("th",{...n})}function Y5(t){return de.createElement("th",{...t})}function G5(t){return de.createElement("tbody",{...t})}function Z5(t){const{components:e}=nl();return de.createElement(e.Dropdown,{...t})}const J5=Object.freeze(Object.defineProperty({__proto__:null,Button:C5,CaptionLabel:T5,Chevron:M5,Day:R5,DayButton:O5,Dropdown:N5,DropdownNav:_5,Footer:P5,Month:A5,MonthCaption:I5,MonthGrid:$5,Months:D5,MonthsDropdown:z5,Nav:L5,NextMonthButton:j5,Option:F5,PreviousMonthButton:B5,Root:V5,Select:H5,Week:W5,WeekNumber:K5,WeekNumberHeader:Y5,Weekday:q5,Weekdays:U5,Weeks:G5,YearsDropdown:Z5},Symbol.toStringTag,{value:"Module"}));function Pr(t,e,n=!1,r=yr){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 ag(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function Dd(t){return!!(t&&typeof t=="object"&&"from"in t)}function lg(t){return!!(t&&typeof t=="object"&&"after"in t)}function cg(t){return!!(t&&typeof t=="object"&&"before"in t)}function kC(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function xC(t,e){return Array.isArray(t)&&t.every(e.isDate)}function Ar(t,e,n=yr){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(xC(a,n))return a.some(l=>o(t,l));if(Dd(a))return Pr(a,t,!1,n);if(kC(a))return Array.isArray(a.dayOfWeek)?a.dayOfWeek.includes(t.getDay()):a.dayOfWeek===t.getDay();if(ag(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 lg(a)?s(t,a.after)>0:cg(a)?s(a.before,t)>0:typeof a=="function"?a(t):!1})}function X5(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:m,isAfter:g}=o,y=n&&h(n),b=r&&m(r),w={[mt.focused]:[],[mt.outside]:[],[mt.disabled]:[],[mt.hidden]:[],[mt.today]:[]},k={};for(const v of t){const{date:x,displayMonth:S}=v,T=!!(S&&!f(x,S)),I=!!(y&&p(x,y)),L=!!(b&&g(x,b)),N=!!(s&&Ar(x,s,o)),P=!!(i&&Ar(x,i,o))||I||L||!c&&!l&&T||c&&l===!1&&T,A=d(x,u);T&&w.outside.push(v),N&&w.disabled.push(v),P&&w.hidden.push(v),A&&w.today.push(v),a&&Object.keys(a).forEach(j=>{const K=a?.[j];K&&Ar(x,K,o)&&(k[j]?k[j].push(v):k[j]=[v])})}return v=>{const x={[mt.focused]:!1,[mt.disabled]:!1,[mt.hidden]:!1,[mt.outside]:!1,[mt.today]:!1},S={};for(const T in w){const I=w[T];x[T]=I.some(L=>L===v)}for(const T in k)S[T]=k[T].some(I=>I===v);return{...x,...S}}}function Q5(t,e,n={}){return Object.entries(t).filter(([,o])=>o===!0).reduce((o,[s])=>(n[s]?o.push(n[s]):e[mt[s]]?o.push(e[mt[s]]):e[Gn[s]]&&o.push(e[Gn[s]]),o),[e[Ce.Day]])}function eV(t){return{...J5,...t}}function tV(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 ug(){const t={};for(const e in Ce)t[Ce[e]]=`rdp-${Ce[e]}`;for(const e in mt)t[mt[e]]=`rdp-${mt[e]}`;for(const e in Gn)t[Gn[e]]=`rdp-${Gn[e]}`;for(const e in kn)t[kn[e]]=`rdp-${kn[e]}`;return t}function SC(t,e,n){return(n??new On(e)).formatMonthYear(t)}const nV=SC;function rV(t,e,n){return(n??new On(e)).format(t,"d")}function oV(t,e=yr){return e.format(t,"LLLL")}function sV(t,e,n){return(n??new On(e)).format(t,"cccccc")}function iV(t,e=yr){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function aV(){return""}function EC(t,e=yr){return e.format(t,"yyyy")}const lV=EC,cV=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:SC,formatDay:rV,formatMonthCaption:nV,formatMonthDropdown:oV,formatWeekNumber:iV,formatWeekNumberHeader:aV,formatWeekdayName:sV,formatYearCaption:lV,formatYearDropdown:EC},Symbol.toStringTag,{value:"Module"}));function uV(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...cV,...t}}function dg(t,e,n,r){let o=(r??new On(n)).format(t,"PPPP");return e.today&&(o=`Today, ${o}`),e.selected&&(o=`${o}, selected`),o}const dV=dg;function fg(t,e,n){return(n??new On(e)).formatMonthYear(t)}const fV=fg;function CC(t,e,n,r){let o=(r??new On(n)).format(t,"PPPP");return e?.today&&(o=`Today, ${o}`),o}function TC(t){return"Choose the Month"}function MC(){return""}const hV="Go to the Next Month";function RC(t,e){return hV}function OC(t){return"Go to the Previous Month"}function NC(t,e,n){return(n??new On(e)).format(t,"cccc")}function _C(t,e){return`Week ${t}`}function PC(t){return"Week Number"}function AC(t){return"Choose the Year"}const pV=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:fV,labelDay:dV,labelDayButton:dg,labelGrid:fg,labelGridcell:CC,labelMonthDropdown:TC,labelNav:MC,labelNext:RC,labelPrevious:OC,labelWeekNumber:_C,labelWeekNumberHeader:PC,labelWeekday:NC,labelYearDropdown:AC},Symbol.toStringTag,{value:"Module"})),Bn=(t,e,n)=>e||(n?typeof n=="function"?n:(...r)=>n:t);function mV(t,e){const n=e.locale?.labels??{};return{...pV,...t??{},labelDayButton:Bn(dg,t?.labelDayButton,n.labelDayButton),labelMonthDropdown:Bn(TC,t?.labelMonthDropdown,n.labelMonthDropdown),labelNext:Bn(RC,t?.labelNext,n.labelNext),labelPrevious:Bn(OC,t?.labelPrevious,n.labelPrevious),labelWeekNumber:Bn(_C,t?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:Bn(AC,t?.labelYearDropdown,n.labelYearDropdown),labelGrid:Bn(fg,t?.labelGrid,n.labelGrid),labelGridcell:Bn(CC,t?.labelGridcell,n.labelGridcell),labelNav:Bn(MC,t?.labelNav,n.labelNav),labelWeekNumberHeader:Bn(PC,t?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:Bn(NC,t?.labelWeekday,n.labelWeekday)}}function gV(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),m=e&&f<s(e)||n&&f>s(n)||!1;return{value:p,label:h,disabled:m}})}function yV(t,e={},n={}){let r={...e?.[Ce.Day]};return Object.entries(t).filter(([,o])=>o===!0).forEach(([o])=>{r={...r,...n?.[o]}}),r}function bV(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 vV(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 wV(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 Xt(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(Xt.tz(t)),newDate:(a,l,c)=>new Xt(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 Xt(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 Xt(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 Xt(l.getFullYear(),0,1,12,0,0,t);for(;d.getFullYear()<=c.getFullYear();)u.push(new Xt(d,t)),d.setFullYear(d.getFullYear()+1,0,1);return u},getWeek:(a,l)=>{const c=i(a);return ig(c,{weekStartsOn:l?.weekStartsOn??o,firstWeekContainsDate:l?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1})},getISOWeek:a=>{const l=i(a);return sg(l)},differenceInCalendarDays:(a,l)=>{const c=i(a),u=i(l);return og(c,u)},differenceInCalendarMonths:(a,l)=>{const c=i(a),u=i(l);return dC(c,u)}}}const rl=t=>t instanceof HTMLElement?t:null,Bf=t=>[...t.querySelectorAll("[data-animated-month]")??[]],kV=t=>rl(t.querySelector("[data-animated-month]")),Vf=t=>rl(t.querySelector("[data-animated-caption]")),Hf=t=>rl(t.querySelector("[data-animated-weeks]")),xV=t=>rl(t.querySelector("[data-animated-nav]")),SV=t=>rl(t.querySelector("[data-animated-weekdays]"));function EV(t,e,{classNames:n,months:r,focused:o,dateLib:s}){const i=E.useRef(null),a=E.useRef(r),l=E.useRef(!1);E.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[kn.caption_after_enter]:n[kn.caption_before_enter],h=d?n[kn.weeks_after_enter]:n[kn.weeks_before_enter],p=i.current,m=t.current.cloneNode(!0);if(m instanceof HTMLElement?(Bf(m).forEach(w=>{if(!(w instanceof HTMLElement))return;const k=kV(w);k&&w.contains(k)&&w.removeChild(k);const v=Vf(w);v&&v.classList.remove(f);const x=Hf(w);x&&x.classList.remove(h)}),i.current=m):i.current=null,l.current||u||o)return;const g=p instanceof HTMLElement?Bf(p):[],y=Bf(t.current);if(y?.every(b=>b instanceof HTMLElement)&&g&&g.every(b=>b instanceof HTMLElement)){l.current=!0,t.current.style.isolation="isolate";const b=xV(t.current);b&&(b.style.zIndex="1"),y.forEach((w,k)=>{const v=g[k];if(!v)return;w.style.position="relative",w.style.overflow="hidden";const x=Vf(w);x&&x.classList.add(f);const S=Hf(w);S&&S.classList.add(h);const T=()=>{l.current=!1,t.current&&(t.current.style.isolation=""),b&&(b.style.zIndex=""),x&&x.classList.remove(f),S&&S.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 I=SV(v);I&&(I.style.opacity="0");const L=Vf(v);L&&(L.classList.add(d?n[kn.caption_before_exit]:n[kn.caption_after_exit]),L.addEventListener("animationend",T));const N=Hf(v);N&&N.classList.add(d?n[kn.weeks_before_exit]:n[kn.weeks_after_exit]),w.insertBefore(v,w.firstChild)})}})}function CV(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:m,isAfter:g,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)):m(p(s)),x=e&&(l?f(e):i?h(e):m(e)),S=x&&g(v,x)?x:v,T=u(S,k),I=d(s,o)+1,L=[];for(let A=0;A<=T;A++){const j=c(k,A);L.push(j)}const P=(l?35:42)*I;if(a&&L.length<P){const A=P-L.length;for(let j=0;j<A;j++){const K=c(L[L.length-1],1);L.push(K)}}return L}function TV(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 MV(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 D0(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 RV(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((m,g)=>{const y=n.broadcastCalendar?d(g,r):n.ISOWeek?f(g):h(g),b=n.broadcastCalendar?s(g):n.ISOWeek?i(a(g)):l(a(g)),w=e.filter(S=>S>=y&&S<=b),k=n.broadcastCalendar?35:42;if(n.fixedWeeks&&w.length<k){const S=e.filter(T=>{const I=k-w.length;return T>b&&T<=o(b,I)});w.push(...S)}const v=w.reduce((S,T)=>{const I=n.ISOWeek?c(T):u(T),L=S.find(P=>P.weekNumber===I),N=new vC(T,g,r);return L?L.days.push(N):S.push(new E5(I,[N])),S},[]),x=new S5(g,v);return m.push(x),m},[]);return n.reverseMonths?p.reverse():p}function OV(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:m}=t;!n&&p&&(n=p),!n&&f&&(n=e.newDate(f,0,1)),!r&&m&&(r=m),!r&&h&&(r=u(h,11,31));const g=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=i(n):f?n=u(f,0,1):!n&&g&&(n=o(l(t.today??d(),-100))),r?r=a(r):h?r=u(h,11,31):!r&&g&&(r=c(t.today??d())),[n&&s(n),r&&s(r)]}function NV(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 _V(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 PV(t){const e=[];return t.reduce((n,r)=>n.concat(r.weeks.slice()),e.slice())}function zd(t,e){const[n,r]=E.useState(t);return[e===void 0?n:e,r]}function AV(t,e){const[n,r]=OV(t,e),{startOfMonth:o,endOfMonth:s}=e,i=D0(t,n,r,e),[a,l]=zd(i,t.month?i:void 0);E.useEffect(()=>{const k=D0(t,n,r,e);l(k)},[t.timeZone]);const{months:c,weeks:u,days:d,previousMonth:f,nextMonth:h}=E.useMemo(()=>{const k=MV(a,r,{numberOfMonths:t.numberOfMonths},e),v=CV(k,t.endMonth?s(t.endMonth):void 0,{ISOWeek:t.ISOWeek,fixedWeeks:t.fixedWeeks,broadcastCalendar:t.broadcastCalendar},e),x=RV(k,v,{broadcastCalendar:t.broadcastCalendar,fixedWeeks:t.fixedWeeks,ISOWeek:t.ISOWeek,reverseMonths:t.reverseMonths},e),S=PV(x),T=TV(x),I=_V(a,n,t,e),L=NV(a,r,t,e);return{months:x,weeks:S,days:T,previousMonth:I,nextMonth:L}},[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:m}=t,g=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),m?.(v)};return{months:c,weeks:u,days:d,navStart:n,navEnd:r,previousMonth:f,nextMonth:h,goToMonth:y,goToDay:k=>{g(k)||y(k.date)}}}var rr;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(rr||(rr={}));function z0(t){return!t[mt.disabled]&&!t[mt.hidden]&&!t[mt.outside]}function IV(t,e,n,r){let o,s=-1;for(const i of t){const a=e(i);z0(a)&&(a[mt.focused]&&s<rr.FocusedModifier?(o=i,s=rr.FocusedModifier):r?.isEqualTo(i)&&s<rr.LastFocused?(o=i,s=rr.LastFocused):n(i.date)&&s<rr.Selected?(o=i,s=rr.Selected):a[mt.today]&&s<rr.Today&&(o=i,s=rr.Today))}return o||(o=t.find(i=>z0(e(i)))),o}function $V(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:m,max:g,min:y,startOfBroadcastWeek:b,startOfISOWeek:w,startOfWeek:k}=i;let x={day:c,week:d,month:u,year:f,startOfWeek:S=>l?b(S,i):a?w(S):k(S),endOfWeek:S=>l?h(S):a?p(S):m(S)}[t](n,e==="after"?1:-1);return e==="before"&&r?x=g([r,x]):e==="after"&&o&&(x=y([o,x])),x}function IC(t,e,n,r,o,s,i,a=0){if(a>365)return;const l=$V(t,e,n.date,r,o,s,i),c=!!(s.disabled&&Ar(l,s.disabled,i)),u=!!(s.hidden&&Ar(l,s.hidden,i)),d=l,f=new vC(l,d,i);return!c&&!u?f:IC(t,e,f,r,o,s,i,a+1)}function DV(t,e,n,r,o){const{autoFocus:s}=t,[i,a]=E.useState(),l=IV(e.days,n,r||(()=>!1),i),[c,u]=E.useState(s?l:void 0);return{isFocusTarget:m=>!!l?.isEqualTo(m),setFocused:u,focused:c,blur:()=>{a(c),u(void 0)},moveFocus:(m,g)=>{if(!c)return;const y=IC(m,g,c,e.navStart,e.navEnd,t,o);y&&(t.disableNavigation&&!e.days.some(w=>w.isEqualTo(y))||(e.goToDay(y),u(y)))}}}function zV(t,e){const{selected:n,required:r,onSelect:o}=t,[s,i]=zd(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,m)=>{let g=[...a??[]];if(c(h)){if(a?.length===u||r&&a?.length===1)return;g=a?.filter(y=>!l(y,h))}else a?.length===d?g=[h]:g=[...g,h];return o||i(g),o?.(g,h,p,m),g},isSelected:c}}function LV(t,e,n=0,r=0,o=!1,s=yr){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 jV(t,e,n=yr){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 L0(t,e,n=yr){return Pr(t,e.from,!1,n)||Pr(t,e.to,!1,n)||Pr(e,t.from,!1,n)||Pr(e,t.to,!1,n)}function FV(t,e,n=yr){const r=Array.isArray(e)?e:[e];if(r.filter(a=>typeof a!="function").some(a=>typeof a=="boolean"?a:n.isDate(a)?Pr(t,a,!1,n):xC(a,n)?a.some(l=>Pr(t,l,!1,n)):Dd(a)?a.from&&a.to?L0(t,{from:a.from,to:a.to},n):!1:kC(a)?jV(t,a.dayOfWeek,n):ag(a)?n.isAfter(a.before,a.after)?L0(t,{from:n.addDays(a.after,1),to:n.addDays(a.before,-1)},n):Ar(t.from,a,n)||Ar(t.to,a,n):lg(a)||cg(a)?Ar(t.from,a,n)||Ar(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 BV(t,e){const{disabled:n,excludeDisabled:r,resetOnSelect:o,selected:s,required:i,onSelect:a}=t,[l,c]=zd(s,a?s:void 0),u=a?s:l;return{selected:u,select:(h,p,m)=>{const{min:g,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=LV(h,u,g,y,i,e)}return r&&n&&b?.from&&b.to&&FV({from:b.from,to:b.to},n,e)&&(b.from=h,b.to=void 0),a||c(b),a?.(b,h,p,m),b},isSelected:h=>u&&Pr(u,h,!1,e)}}function VV(t,e){const{selected:n,required:r,onSelect:o}=t,[s,i]=zd(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 HV(t,e){const n=VV(t,e),r=zV(t,e),o=BV(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return o;default:return}}function An(t,e){return t instanceof Xt&&t.timeZone===e?t:new Xt(t,e)}function Ds(t,e,n){return An(t,e)}function j0(t,e,n){return typeof t=="boolean"||typeof t=="function"?t:t instanceof Date?Ds(t,e):Array.isArray(t)?t.map(r=>r instanceof Date?Ds(r,e):r):Dd(t)?{...t,from:t.from?An(t.from,e):t.from,to:t.to?An(t.to,e):t.to}:ag(t)?{before:Ds(t.before,e),after:Ds(t.after,e)}:lg(t)?{after:Ds(t.after,e)}:cg(t)?{before:Ds(t.before,e)}:t}function Wf(t,e,n){return t&&(Array.isArray(t)?t.map(r=>j0(r,e)):j0(t,e))}function WV(t){let e=t;const n=e.timeZone;if(n&&(e={...t,timeZone:n},e.today&&(e.today=An(e.today,n)),e.month&&(e.month=An(e.month,n)),e.defaultMonth&&(e.defaultMonth=An(e.defaultMonth,n)),e.startMonth&&(e.startMonth=An(e.startMonth,n)),e.endMonth&&(e.endMonth=An(e.endMonth,n)),e.mode==="single"&&e.selected?e.selected=An(e.selected,n):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(ce=>An(ce,n)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?An(e.selected.from,n):e.selected.from,to:e.selected.to?An(e.selected.to,n):e.selected.to}),e.disabled!==void 0&&(e.disabled=Wf(e.disabled,n)),e.hidden!==void 0&&(e.hidden=Wf(e.hidden,n)),e.modifiers)){const ce={};Object.keys(e.modifiers).forEach(ve=>{ce[ve]=Wf(e.modifiers?.[ve],n)}),e.modifiers=ce}const{components:r,formatters:o,labels:s,dateLib:i,locale:a,classNames:l}=E.useMemo(()=>{const ce={...bC,...e.locale},ve=e.broadcastCalendar?1:e.weekStartsOn,xe=e.noonSafe&&e.timeZone?wV(e.timeZone,{weekStartsOn:ve,locale:ce}):void 0,Ie=e.dateLib&&xe?{...xe,...e.dateLib}:e.dateLib??xe,dt=new On({locale:ce,weekStartsOn:ve,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},Ie);return{dateLib:dt,components:eV(e.components),formatters:uV(e.formatters),labels:mV(e.labels,dt.options),locale:ce,classNames:{...ug(),...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:m,onDayKeyDown:g,onDayMouseEnter:y,onDayMouseLeave:b,onNextClick:w,onPrevClick:k,showWeekNumber:v,styles:x}=e,{formatCaption:S,formatDay:T,formatMonthDropdown:I,formatWeekNumber:L,formatWeekNumberHeader:N,formatWeekdayName:P,formatYearDropdown:A}=o,j=AV(e,i),{days:K,months:J,navStart:Y,navEnd:G,previousMonth:U,nextMonth:z,goToMonth:B}=j,H=X5(K,e,Y,G,i),{isSelected:V,select:R,selected:D}=HV(e,i)??{},{blur:$,focused:Z,isFocusTarget:Q,moveFocus:_,setFocused:q}=DV(e,j,H,V??(()=>!1),i),{labelDayButton:C,labelGridcell:O,labelGrid:F,labelMonthDropdown:W,labelNav:X,labelPrevious:ee,labelNext:ne,labelWeekday:oe,labelWeekNumber:re,labelWeekNumberHeader:ae,labelYearDropdown:te}=s,fe=E.useMemo(()=>bV(i,e.ISOWeek,e.broadcastCalendar,e.today),[i,e.ISOWeek,e.broadcastCalendar,e.today]),ye=u!==void 0||p!==void 0,he=E.useCallback(()=>{U&&(B(U),k?.(U))},[U,B,k]),qe=E.useCallback(()=>{z&&(B(z),w?.(z))},[B,z,w]),Ye=E.useCallback((ce,ve)=>xe=>{xe.preventDefault(),xe.stopPropagation(),q(ce),!ve.disabled&&(R?.(ce.date,ve,xe),p?.(ce.date,ve,xe))},[R,p,q]),st=E.useCallback((ce,ve)=>xe=>{q(ce),m?.(ce.date,ve,xe)},[m,q]),Ae=E.useCallback((ce,ve)=>xe=>{$(),h?.(ce.date,ve,xe)},[$,h]),_e=E.useCallback((ce,ve)=>xe=>{const Ie={ArrowLeft:[xe.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[xe.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[xe.shiftKey?"year":"week","after"],ArrowUp:[xe.shiftKey?"year":"week","before"],PageUp:[xe.shiftKey?"year":"month","before"],PageDown:[xe.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Ie[xe.key]){xe.preventDefault(),xe.stopPropagation();const[dt,$e]=Ie[xe.key];_(dt,$e)}g?.(ce.date,ve,xe)},[_,g,e.dir]),Ue=E.useCallback((ce,ve)=>xe=>{y?.(ce.date,ve,xe)},[y]),Ke=E.useCallback((ce,ve)=>xe=>{b?.(ce.date,ve,xe)},[b]),zt=E.useCallback(ce=>ve=>{const xe=Number(ve.target.value),Ie=i.setMonth(i.startOfMonth(ce),xe);B(Ie)},[i,B]),Ht=E.useCallback(ce=>ve=>{const xe=Number(ve.target.value),Ie=i.setYear(i.startOfMonth(ce),xe);B(Ie)},[i,B]),{className:Lt,style:Pt}=E.useMemo(()=>({className:[l[Ce.Root],e.className].filter(Boolean).join(" "),style:{...x?.[Ce.Root],...e.style}}),[l,e.className,e.style,x]),wt=tV(e),De=E.useRef(null);EV(De,!!e.animate,{classNames:l,months:J,focused:Z,dateLib:i});const Se={dayPickerProps:e,selected:D,select:R,isSelected:V,months:J,nextMonth:z,previousMonth:U,goToMonth:B,getModifiers:H,components:r,classNames:l,styles:x,labels:s,formatters:o};return de.createElement(wC.Provider,{value:Se},de.createElement(r.Root,{rootRef:e.animate?De:void 0,className:Lt,style:Pt,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"],...wt},de.createElement(r.Months,{className:l[Ce.Months],style:x?.[Ce.Months]},!e.hideNavigation&&!d&&de.createElement(r.Nav,{"data-animated-nav":e.animate?"true":void 0,className:l[Ce.Nav],style:x?.[Ce.Nav],"aria-label":X(),onPreviousClick:he,onNextClick:qe,previousMonth:U,nextMonth:z}),J.map((ce,ve)=>de.createElement(r.Month,{"data-animated-month":e.animate?"true":void 0,className:l[Ce.Month],style:x?.[Ce.Month],key:ve,displayIndex:ve,calendarMonth:ce},d==="around"&&!e.hideNavigation&&ve===0&&de.createElement(r.PreviousMonthButton,{type:"button",className:l[Ce.PreviousMonthButton],tabIndex:U?void 0:-1,"aria-disabled":U?void 0:!0,"aria-label":ee(U),onClick:he,"data-animated-button":e.animate?"true":void 0},de.createElement(r.Chevron,{disabled:U?void 0:!0,className:l[Ce.Chevron],orientation:e.dir==="rtl"?"right":"left"})),de.createElement(r.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:l[Ce.MonthCaption],style:x?.[Ce.MonthCaption],calendarMonth:ce,displayIndex:ve},c?.startsWith("dropdown")?de.createElement(r.DropdownNav,{className:l[Ce.Dropdowns],style:x?.[Ce.Dropdowns]},(()=>{const xe=c==="dropdown"||c==="dropdown-months"?de.createElement(r.MonthsDropdown,{key:"month",className:l[Ce.MonthsDropdown],"aria-label":W(),classNames:l,components:r,disabled:!!e.disableNavigation,onChange:zt(ce.date),options:gV(ce.date,Y,G,o,i),style:x?.[Ce.Dropdown],value:i.getMonth(ce.date)}):de.createElement("span",{key:"month"},I(ce.date,i)),Ie=c==="dropdown"||c==="dropdown-years"?de.createElement(r.YearsDropdown,{key:"year",className:l[Ce.YearsDropdown],"aria-label":te(i.options),classNames:l,components:r,disabled:!!e.disableNavigation,onChange:Ht(ce.date),options:vV(Y,G,o,i,!!e.reverseYears),style:x?.[Ce.Dropdown],value:i.getYear(ce.date)}):de.createElement("span",{key:"year"},A(ce.date,i));return i.getMonthYearOrder()==="year-first"?[Ie,xe]:[xe,Ie]})(),de.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"}},S(ce.date,i.options,i))):de.createElement(r.CaptionLabel,{className:l[Ce.CaptionLabel],role:"status","aria-live":"polite"},S(ce.date,i.options,i))),d==="around"&&!e.hideNavigation&&ve===f-1&&de.createElement(r.NextMonthButton,{type:"button",className:l[Ce.NextMonthButton],tabIndex:z?void 0:-1,"aria-disabled":z?void 0:!0,"aria-label":ne(z),onClick:qe,"data-animated-button":e.animate?"true":void 0},de.createElement(r.Chevron,{disabled:z?void 0:!0,className:l[Ce.Chevron],orientation:e.dir==="rtl"?"left":"right"})),ve===f-1&&d==="after"&&!e.hideNavigation&&de.createElement(r.Nav,{"data-animated-nav":e.animate?"true":void 0,className:l[Ce.Nav],style:x?.[Ce.Nav],"aria-label":X(),onPreviousClick:he,onNextClick:qe,previousMonth:U,nextMonth:z}),de.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":F(ce.date,i.options,i)||void 0,className:l[Ce.MonthGrid],style:x?.[Ce.MonthGrid]},!e.hideWeekdays&&de.createElement(r.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:l[Ce.Weekdays],style:x?.[Ce.Weekdays]},v&&de.createElement(r.WeekNumberHeader,{"aria-label":ae(i.options),className:l[Ce.WeekNumberHeader],style:x?.[Ce.WeekNumberHeader],scope:"col"},N()),fe.map(xe=>de.createElement(r.Weekday,{"aria-label":oe(xe,i.options,i),className:l[Ce.Weekday],key:String(xe),style:x?.[Ce.Weekday],scope:"col"},P(xe,i.options,i)))),de.createElement(r.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:l[Ce.Weeks],style:x?.[Ce.Weeks]},ce.weeks.map(xe=>de.createElement(r.Week,{className:l[Ce.Week],key:xe.weekNumber,style:x?.[Ce.Week],week:xe},v&&de.createElement(r.WeekNumber,{week:xe,style:x?.[Ce.WeekNumber],"aria-label":re(xe.weekNumber,{locale:a}),className:l[Ce.WeekNumber],scope:"row",role:"rowheader"},L(xe.weekNumber,i)),xe.days.map(Ie=>{const{date:dt}=Ie,$e=H(Ie);if($e[mt.focused]=!$e.hidden&&!!Z?.isEqualTo(Ie),$e[Gn.selected]=V?.(dt)||$e.selected,Dd(D)){const{from:vr,to:wr}=D;$e[Gn.range_start]=!!(vr&&wr&&i.isSameDay(dt,vr)),$e[Gn.range_end]=!!(vr&&wr&&i.isSameDay(dt,wr)),$e[Gn.range_middle]=Pr(D,dt,!0,i)}const Xn=yV($e,x,e.modifiersStyles),Vr=Q5($e,l,e.modifiersClassNames),Hr=!ye&&!$e.hidden?O(dt,$e,i.options,i):void 0;return de.createElement(r.Day,{key:`${Ie.isoDate}_${Ie.displayMonthId}`,day:Ie,modifiers:$e,className:Vr.join(" "),style:Xn,role:"gridcell","aria-selected":$e.selected||void 0,"aria-label":Hr,"data-day":Ie.isoDate,"data-month":Ie.outside?Ie.dateMonthId:void 0,"data-selected":$e.selected||void 0,"data-disabled":$e.disabled||void 0,"data-hidden":$e.hidden||void 0,"data-outside":Ie.outside||void 0,"data-focused":$e.focused||void 0,"data-today":$e.today||void 0},!$e.hidden&&ye?de.createElement(r.DayButton,{className:l[Ce.DayButton],style:x?.[Ce.DayButton],type:"button",day:Ie,modifiers:$e,disabled:!$e.focused&&$e.disabled||void 0,"aria-disabled":$e.focused&&$e.disabled||void 0,tabIndex:Q(Ie)?0:-1,"aria-label":C(dt,$e,i.options,i),onClick:Ye(Ie,$e),onBlur:Ae(Ie,$e),onFocus:st(Ie,$e),onKeyDown:_e(Ie,$e),onMouseEnter:Ue(Ie,$e),onMouseLeave:Ke(Ie,$e)},T(dt,i.options,i)):!$e.hidden&&T(Ie.date,i.options,i))})))))))),e.footer&&de.createElement(r.Footer,{className:l[Ce.Footer],style:x?.[Ce.Footer],role:"status","aria-live":"polite"},e.footer)))}function qV({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:o="ghost",locale:s,formatters:i,components:a,...l}){const c=ug();return M.jsx(WV,{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(mi({variant:o}),"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",c.button_previous),button_next:ue(mi({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(DN,{className:ue("size-4",u),...f}):d==="right"?M.jsx(LN,{className:ue("size-4",u),...f}):M.jsx(Dp,{className:ue("size-4",u),...f}),DayButton:({...u})=>M.jsx(UV,{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 UV(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=ug(),l=E.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]),E.useEffect(c,u);const d=yn,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 m=s.selected&&!s.range_start&&!s.range_end&&!s.range_middle,g=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]!==m?(k=M.jsx(d,{variant:f,size:h,"data-day":p,"data-selected-single":m,"data-range-start":g,"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]=m,e[20]=k):k=e[20],k}function KV(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 $C=E.createContext(void 0);function YV(){const t=E.useContext($C);if(t===void 0)throw new Error(en(63));return t}let F0=(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 DC={...tm,checked(t){return t?{[F0.checked]:""}:{[F0.unchecked]:""}}},GV=E.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:m,value:g,...y}=e,{clearErrors:b}=nm(),{state:w,setTouched:k,setDirty:v,validityData:x,setFilled:S,setFocused:T,shouldValidateOnChange:I,validationMode:L,disabled:N,name:P,validation:A}=$i(),{labelId:j}=fd(),K=N||h,J=P??l,Y=pe(u),G=E.useRef(null),U=jr(G,a,A.inputRef),z=E.useRef(null),B=bs(),H=hd({id:i,implicit:!1,controlRef:z}),V=c?void 0:H,[R,D]=Ma({controlled:r,default:!!s,name:"Switch",state:"checked"});rm({id:B,commit:A.commit,value:R,controlRef:z,name:J,getValue:()=>R}),ge(()=>{G.current&&S(G.current.checked)},[G,S]),qx(R,()=>{b(J),v(R!==x.initialValue),S(R),I()?A.commit(R):A.commit(R,!0)});const{getButtonProps:$,buttonRef:Z}=ws({disabled:K,native:c}),Q={id:c?H:B,role:"switch","aria-checked":R,"aria-readonly":d||void 0,"aria-required":f||void 0,"aria-labelledby":j,onFocus(){K||T(!0)},onBlur(){const O=G.current;!O||K||(k(!0),T(!1),L==="onBlur"&&A.commit(O.checked))},onClick(O){d||K||(O.preventDefault(),G.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:O.shiftKey,ctrlKey:O.ctrlKey,altKey:O.altKey,metaKey:O.metaKey})))}},_=E.useMemo(()=>Pi({checked:R,disabled:K,id:V,name:J,required:f,style:J?hk:od,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:U,onChange(O){if(O.nativeEvent.defaultPrevented)return;const F=O.target.checked,W=Fe(yo,O.nativeEvent);Y?.(F,W),!W.isCanceled&&D(F)},onFocus(){z.current?.focus()}},A.getInputValidationProps,g!==void 0?{value:g}:$t),[R,K,U,V,J,Y,f,D,A,g]),q=E.useMemo(()=>({...w,checked:R,disabled:K,readOnly:d,required:f}),[w,R,K,d,f]),C=ot("span",e,{state:q,ref:[n,z,Z],props:[Q,A.getValidationProps,y,$],stateAttributesMapping:DC});return M.jsxs($C.Provider,{value:q,children:[C,!R&&J&&m!==void 0&&M.jsx("input",{type:"hidden",name:J,value:m}),M.jsx("input",{..._})]})}),ZV=E.forwardRef(function(e,n){const{render:r,className:o,...s}=e,{state:i}=$i(),a=YV(),l={...i,...a};return ot("span",e,{state:l,ref:n,stateAttributesMapping:DC,props:s})});function JV(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(ZV,{"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(GV,{"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}const XV=36,zs=288,QV=8;function eH(t){if(!Array.isArray(t))return;const e=[...new Set(t.filter(n=>typeof n=="string").map(n=>n.trim().toLowerCase()).filter(n=>n.length>0))];return e.length>0?e:void 0}function tH(t){if(!t)return{};const e=t.trim(),n=e.indexOf(":");if(n<=0||n===e.length-1)return{};const r=e.slice(0,n).toLowerCase(),o=e.slice(n+1);return{prefix:r,name:o}}function nH(t,e){return`https://api.iconify.design/${encodeURIComponent(t)}/${encodeURIComponent(e)}.svg?width=20&height=20`}function rH(t){return{maskImage:`url("${t}")`,maskRepeat:"no-repeat",maskPosition:"center",maskSize:"contain",WebkitMaskImage:`url("${t}")`,WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center",WebkitMaskSize:"contain"}}const oH=fr({method:"GET"}).handler(hr("3ba1a566c82090c8422dd6ca7258b2e1aed644206364441faf1bd80942f21745")),sH=fr({method:"POST"}).handler(hr("c9dff6ed7373b505d6aeeb84c63f87a0d0c205051d9d817929a5b500e5e79e03")),Yr={},Dl=new Map;function iH(){return Yr.data?Promise.resolve(Yr.data):(Yr.promise||(Yr.promise=oH().then(t=>(Yr.data=t,t)).finally(()=>{Yr.promise=void 0})),Yr.promise)}function aH(t){const e=t.trim().toLowerCase(),n=Dl.get(e);if(n?.data)return Promise.resolve(n.data);if(n?.promise)return n.promise;const r=sH({data:{prefix:e}}).then(o=>(Dl.set(e,{data:o}),o)).finally(()=>{const o=Dl.get(e);o&&delete o.promise});return Dl.set(e,{data:n?.data,promise:r}),r}function lH(t){const e=Math.max(0,Math.floor(t.scrollTop/t.rowHeight)-t.overscan),n=Math.ceil(t.viewportHeight/t.rowHeight),r=Math.min(t.itemCount,e+n+t.overscan*2);return{startIndex:e,endIndex:r,offsetY:e*t.rowHeight,totalHeight:t.itemCount*t.rowHeight}}function cH(t){const e=Me.c(105),{triggerLabel:n,triggerClassName:r,triggerAriaLabel:o,triggerContent:s,selectedIcon:i,allowedLibraries:a,onSelectIcon:l}=t,[c,u]=E.useState(!1);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[0]=d):d=e[0];const[f,h]=E.useState(d),[p,m]=E.useState(!1),[g,y]=E.useState(),[b,w]=E.useState();let k;e[1]===Symbol.for("react.memo_cache_sentinel")?(k=[],e[1]=k):k=e[1];const[v,x]=E.useState(k),[S,T]=E.useState(!1),[I,L]=E.useState(),[N,P]=E.useState(""),[A,j]=E.useState(0);let K;e[2]!==i?(K=tH(i),e[2]=i,e[3]=K):K=e[3];const J=K;let Y;e[4]!==a?(Y=eH(a),e[4]=a,e[5]=Y):Y=e[5];const G=Y;let U,z;e[6]!==c?(U=()=>{if(!c)return;let Se=!1;return m(!0),y(void 0),iH().then(ce=>{Se||h(ce)}).catch(ce=>{if(Se)return;const ve=ce instanceof Error?ce.message:String(ce);y(ve),Hn.error(`Unable to load Iconify collections: ${ve}`)}).finally(()=>{Se||m(!1)}),()=>{Se=!0}},z=[c],e[6]=c,e[7]=U,e[8]=z):(U=e[7],z=e[8]),E.useEffect(U,z);let B;if(e[9]!==f||e[10]!==G){const Se=G?new Set(G):void 0;B=f.filter(ce=>Se?Se.has(ce.prefix):!0),e[9]=f,e[10]=G,e[11]=B}else B=e[11];const H=B;let V,R;e[12]!==H||e[13]!==J.prefix||e[14]!==b?(V=()=>{if(H.length===0){w(void 0);return}if(b&&H.some(ce=>ce.prefix===b))return;const Se=J.prefix?H.find(ce=>ce.prefix===J.prefix):void 0;w(Se?.prefix??H[0].prefix)},R=[H,J.prefix,b],e[12]=H,e[13]=J.prefix,e[14]=b,e[15]=V,e[16]=R):(V=e[15],R=e[16]),E.useEffect(V,R);let D,$;e[17]!==c||e[18]!==b?(D=()=>{if(!c||!b){x([]);return}let Se=!1;return T(!0),L(void 0),x([]),aH(b).then(ce=>{Se||x(ce)}).catch(ce=>{if(Se)return;const ve=ce instanceof Error?ce.message:String(ce);L(ve),Hn.error(`Unable to load icons for ${b}: ${ve}`)}).finally(()=>{Se||T(!1)}),()=>{Se=!0}},$=[c,b],e[17]=c,e[18]=b,e[19]=D,e[20]=$):(D=e[19],$=e[20]),E.useEffect(D,$);let Z;if(e[21]!==v||e[22]!==N){e:{const Se=N.trim().toLowerCase();if(Se.length===0){Z=v;break e}Z=v.filter(ce=>ce.toLowerCase().includes(Se))}e[21]=v,e[22]=N,e[23]=Z}else Z=e[23];const Q=Z;let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=()=>{j(0)},e[24]=_):_=e[24];let q;e[25]!==N||e[26]!==b?(q=[N,b],e[25]=N,e[26]=b,e[27]=q):q=e[27],E.useEffect(_,q);let C;e[28]!==Q.length||e[29]!==A?(C=lH({scrollTop:A,viewportHeight:zs,rowHeight:XV,itemCount:Q.length,overscan:QV}),e[28]=Q.length,e[29]=A,e[30]=C):C=e[30];const O=C,F=J.prefix&&J.name?`${J.prefix}:${J.name}`:void 0;let W;e:{if(!b){W=void 0;break e}let Se;if(e[31]!==H||e[32]!==b){let ce;e[34]!==b?(ce=ve=>ve.prefix===b,e[34]=b,e[35]=ce):ce=e[35],Se=H.find(ce),e[31]=H,e[32]=b,e[33]=Se}else Se=e[33];W=Se}const X=W;let ee;e[36]!==r?(ee=ue(mi({variant:"outline"}),"h-8 border-dashed text-xs",r),e[36]=r,e[37]=ee):ee=e[37];const ne=s??n??"Pick icon";let oe;e[38]!==ee||e[39]!==ne||e[40]!==o?(oe=M.jsx(_d,{className:ee,"aria-label":o,children:ne}),e[38]=ee,e[39]=ne,e[40]=o,e[41]=oe):oe=e[41];let re;e[42]!==p?(re=p?M.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 px-1 text-xs",children:[M.jsx(Zn,{className:"size-3.5 animate-spin"}),"Loading libraries..."]}):null,e[42]=p,e[43]=re):re=e[43];let ae;e[44]!==g||e[45]!==p?(ae=!p&&g?M.jsx("div",{className:"text-destructive/90 rounded-md px-1 text-xs",children:g}):null,e[44]=g,e[45]=p,e[46]=ae):ae=e[46];let te;e[47]!==g||e[48]!==p||e[49]!==H?(te=!p&&!g&&H.length===0?M.jsx("p",{className:"text-muted-foreground px-1 text-xs",children:"No icon libraries found."}):null,e[47]=g,e[48]=p,e[49]=H,e[50]=te):te=e[50];let fe;e[51]!==g||e[52]!==p||e[53]!==H||e[54]!==b?(fe=!p&&!g&&H.length>0?M.jsx("div",{className:"overflow-x-auto pb-1",children:M.jsx("div",{className:"flex w-max min-w-full gap-1",children:H.map(Se=>{const ce=Se.prefix===b;return M.jsx("button",{type:"button",className:ue("rounded-md px-2 py-1 text-xs whitespace-nowrap transition-colors",ce?"bg-foreground text-background":"bg-muted/55 text-muted-foreground hover:bg-muted/75 hover:text-foreground"),onClick:()=>{w(Se.prefix)},children:Se.prefix},Se.prefix)})})}):null,e[51]=g,e[52]=p,e[53]=H,e[54]=b,e[55]=fe):fe=e[55];const ye=X?`${X.name} (${X.prefix}) · ${X.total} icons`:"Select a library to browse icons.";let he;e[56]!==ye?(he=M.jsx("div",{className:"text-muted-foreground px-1 text-[11px]",children:ye}),e[56]=ye,e[57]=he):he=e[57];let qe;e[58]===Symbol.for("react.memo_cache_sentinel")?(qe=M.jsx(ax,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2"}),e[58]=qe):qe=e[58];let Ye;e[59]===Symbol.for("react.memo_cache_sentinel")?(Ye=Se=>{P(Se.target.value)},e[59]=Ye):Ye=e[59];const st=!b;let Ae;e[60]!==N||e[61]!==st?(Ae=M.jsxs("div",{className:"relative",children:[qe,M.jsx(gr,{value:N,onChange:Ye,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 icons...","aria-label":"Search icons",disabled:st})]}),e[60]=N,e[61]=st,e[62]=Ae):Ae=e[62];let _e;e[63]!==b?(_e=b?null:M.jsx("div",{className:"text-muted-foreground flex items-center justify-center px-2 text-xs",style:{height:zs},children:"Select a library to browse icons."}),e[63]=b,e[64]=_e):_e=e[64];let Ue;e[65]!==S||e[66]!==b?(Ue=b&&S?M.jsxs("div",{className:"text-muted-foreground flex items-center justify-center gap-2 text-xs",style:{height:zs},children:[M.jsx(Zn,{className:"size-3.5 animate-spin"}),"Loading icons..."]}):null,e[65]=S,e[66]=b,e[67]=Ue):Ue=e[67];let Ke;e[68]!==I||e[69]!==S||e[70]!==b?(Ke=b&&!S&&I?M.jsx("div",{className:"text-destructive/90 px-2 py-2 text-xs",style:{height:zs},children:I}):null,e[68]=I,e[69]=S,e[70]=b,e[71]=Ke):Ke=e[71];let zt;e[72]!==Q.length||e[73]!==I||e[74]!==S||e[75]!==b?(zt=b&&!S&&!I&&Q.length===0?M.jsx("div",{className:"text-muted-foreground flex items-center justify-center px-2 text-xs",style:{height:zs},children:"No icons found."}):null,e[72]=Q.length,e[73]=I,e[74]=S,e[75]=b,e[76]=zt):zt=e[76];let Ht;e[77]!==Q||e[78]!==O||e[79]!==I||e[80]!==S||e[81]!==l||e[82]!==F||e[83]!==b?(Ht=b&&!S&&!I&&Q.length>0?M.jsx("div",{className:"overflow-auto",style:{height:zs},onScroll:Se=>{j(Se.currentTarget.scrollTop)},children:M.jsx("div",{style:{height:O.totalHeight},children:M.jsx("div",{style:{transform:`translateY(${O.offsetY}px)`},children:Q.slice(O.startIndex,O.endIndex).map(Se=>{const ce=`${b}:${Se}`,ve=ce===F;return M.jsxs("button",{type:"button",className:ue("hover:bg-muted/65 flex h-9 w-full items-center gap-2 px-2 text-left text-xs transition-colors",ve?"bg-muted/70":""),onClick:()=>{l(ce),u(!1)},children:[M.jsx("span",{"aria-hidden":"true",className:"text-foreground size-4 shrink-0 bg-current",style:rH(nH(b,Se))}),M.jsx("span",{className:"text-foreground/90 flex-1 truncate",children:Se}),ve?M.jsx(ix,{className:"size-3.5 shrink-0"}):null]},Se)})})})}):null,e[77]=Q,e[78]=O,e[79]=I,e[80]=S,e[81]=l,e[82]=F,e[83]=b,e[84]=Ht):Ht=e[84];let Lt;e[85]!==_e||e[86]!==Ue||e[87]!==Ke||e[88]!==zt||e[89]!==Ht?(Lt=M.jsxs("div",{className:"border-border/50 rounded-md border",children:[_e,Ue,Ke,zt,Ht]}),e[85]=_e,e[86]=Ue,e[87]=Ke,e[88]=zt,e[89]=Ht,e[90]=Lt):Lt=e[90];let Pt;e[91]!==Ae||e[92]!==Lt?(Pt=M.jsxs("div",{className:"space-y-2",children:[Ae,Lt]}),e[91]=Ae,e[92]=Lt,e[93]=Pt):Pt=e[93];let wt;e[94]!==re||e[95]!==ae||e[96]!==te||e[97]!==fe||e[98]!==he||e[99]!==Pt?(wt=M.jsx(Pd,{className:"w-96 max-w-[calc(100vw-2rem)] p-3",children:M.jsxs("div",{className:"space-y-2",children:[re,ae,te,fe,he,Pt]})}),e[94]=re,e[95]=ae,e[96]=te,e[97]=fe,e[98]=he,e[99]=Pt,e[100]=wt):wt=e[100];let De;return e[101]!==c||e[102]!==oe||e[103]!==wt?(De=M.jsxs(Nd,{open:c,onOpenChange:u,children:[oe,wt]}),e[101]=c,e[102]=oe,e[103]=wt,e[104]=De):De=e[104],De}function zl(t){return t.toString().padStart(2,"0")}function B0(t){const e=t.getFullYear(),n=zl(t.getMonth()+1),r=zl(t.getDate()),o=zl(t.getHours()),s=zl(t.getMinutes());return`${e}-${n}-${r}T${o}:${s}`}function uH(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())?"":B0(n)}if(typeof t=="number"){const e=uH(t);return e?B0(e):""}return""}function fH(t){if(!t)return;const e=new Date(t);if(!Number.isNaN(e.getTime()))return e.toISOString()}const hH=fr({method:"POST"}).handler(hr("dcd3839820feeaed3b1a4f86186dd05c2e7e26ffaacdeaba309f44d121c95ad1")),pH=fr({method:"POST"}).handler(hr("02ba027930daf730cf535415a08fab7365d58edddcc678dbcb19c72f990c25b5"));function se(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 ai extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class zC extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const LC={};function wo(t){return LC}function jC(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 hg(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function pg(t){return t==null}function mg(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}const V0=Symbol("evaluating");function rt(t,e,n){let r;Object.defineProperty(t,e,{get(){if(r!==V0)return r===void 0&&(r=V0,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 _o(...t){const e={};for(const n of t){const r=Object.getOwnPropertyDescriptors(n);Object.assign(e,r)}return Object.defineProperties({},e)}function H0(t){return JSON.stringify(t)}function mH(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const FC="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Uu(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const gH=hg(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Mi(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 BC(t){return Mi(t)?{...t}:Array.isArray(t)?[...t]:t}const yH=new Set(["string","number","symbol"]);function Ri(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 Ne(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 bH(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function vH(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=_o(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 wH(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=_o(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 kH(t,e){if(!Mi(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=_o(t._zod.def,{get shape(){const s={...t._zod.def.shape,...e};return Rs(this,"shape",s),s}});return Po(t,o)}function xH(t,e){if(!Mi(e))throw new Error("Invalid input to safeExtend: expected a plain object");const n=_o(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e};return Rs(this,"shape",r),r}});return Po(t,n)}function SH(t,e){const n=_o(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 EH(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=_o(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 CH(t,e,n){const r=_o(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 Ys(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 Gs(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function Ll(t){return typeof t=="string"?t:t?.message}function ko(t,e,n){const r={...t,path:t.path??[]};if(!t.message){const o=Ll(t.inst?._zod.def?.error?.(t))??Ll(e?.error?.(t))??Ll(n.customError?.(t))??Ll(n.localeError?.(t))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,e?.reportInput||delete r.input,r}function gg(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Va(...t){const[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}const VC=(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})},HC=se("$ZodError",VC),WC=se("$ZodError",VC,{Parent:Error});function TH(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 MH(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 yg=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 ai;if(i.issues.length){const a=new(o?.Err??t)(i.issues.map(l=>ko(l,s,wo())));throw FC(a,o?.callee),a}return i.value},bg=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=>ko(l,s,wo())));throw FC(a,o?.callee),a}return i.value},Ld=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 ai;return s.issues.length?{success:!1,error:new(t??HC)(s.issues.map(i=>ko(i,o,wo())))}:{success:!0,data:s.value}},RH=Ld(WC),jd=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=>ko(i,o,wo())))}:{success:!0,data:s.value}},OH=jd(WC),NH=t=>(e,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return yg(t)(e,n,o)},_H=t=>(e,n,r)=>yg(t)(e,n,r),PH=t=>async(e,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return bg(t)(e,n,o)},AH=t=>async(e,n,r)=>bg(t)(e,n,r),IH=t=>(e,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ld(t)(e,n,o)},$H=t=>(e,n,r)=>Ld(t)(e,n,r),DH=t=>async(e,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return jd(t)(e,n,o)},zH=t=>async(e,n,r)=>jd(t)(e,n,r),LH=/^[cC][^\s-]{8,}$/,jH=/^[0-9a-z]+$/,FH=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,BH=/^[0-9a-vA-V]{20}$/,VH=/^[A-Za-z0-9]{27}$/,HH=/^[a-zA-Z0-9_-]{21}$/,WH=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,qH=/^([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})$/,W0=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)$/,UH=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,KH="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function YH(){return new RegExp(KH,"u")}const GH=/^(?:(?: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])$/,ZH=/^(([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}|:))$/,JH=/^((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])$/,XH=/^(([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])$/,QH=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,qC=/^[A-Za-z0-9_-]*$/,eW=/^\+[1-9]\d{6,14}$/,UC="(?:(?:\\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(`^${UC}$`);function KC(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 nW(t){return new RegExp(`^${KC(t)}$`)}function rW(t){const e=KC({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(`^${UC}T(?:${r})$`)}const oW=t=>{const e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},sW=/^-?\d+(?:\.\d+)?$/,iW=/^[^A-Z]*$/,aW=/^[^a-z]*$/,br=se("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),lW=se("$ZodCheckMaxLength",(t,e)=>{var n;br.init(t,e),(n=t._zod.def).when??(n.when=r=>{const o=r.value;return!pg(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=gg(o);r.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),cW=se("$ZodCheckMinLength",(t,e)=>{var n;br.init(t,e),(n=t._zod.def).when??(n.when=r=>{const o=r.value;return!pg(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=gg(o);r.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),uW=se("$ZodCheckLengthEquals",(t,e)=>{var n;br.init(t,e),(n=t._zod.def).when??(n.when=r=>{const o=r.value;return!pg(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=gg(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})}}),Fd=se("$ZodCheckStringFormat",(t,e)=>{var n,r;br.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=se("$ZodCheckRegex",(t,e)=>{Fd.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})}}),fW=se("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=iW),Fd.init(t,e)}),hW=se("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=aW),Fd.init(t,e)}),pW=se("$ZodCheckIncludes",(t,e)=>{br.init(t,e);const n=Ri(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})}}),mW=se("$ZodCheckStartsWith",(t,e)=>{br.init(t,e);const n=new RegExp(`^${Ri(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})}}),gW=se("$ZodCheckEndsWith",(t,e)=>{br.init(t,e);const n=new RegExp(`.*${Ri(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})}}),yW=se("$ZodCheckOverwrite",(t,e)=>{br.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class bW{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 vW={major:4,minor:3,patch:6},Ct=se("$ZodType",(t,e)=>{var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=vW;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=Ys(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 ai;if(u||h instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await h,i.issues.length!==f&&(c||(c=Ys(i,f)))});else{if(i.issues.length===f)continue;c||(c=Ys(i,f))}}return u?u.then(()=>i):i},s=(i,a,l)=>{if(Ys(i))return i.aborted=!0,i;const c=o(a,r,l);if(c instanceof Promise){if(l.async===!1)throw new ai;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 ai;return l.then(c=>o(c,r,a))}return o(l,r,a)}}rt(t,"~standard",()=>({validate:o=>{try{const s=RH(t,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return OH(t,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),vg=se("$ZodString",(t,e)=>{Ct.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}}),pt=se("$ZodStringFormat",(t,e)=>{Fd.init(t,e),vg.init(t,e)}),wW=se("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=qH),pt.init(t,e)}),kW=se("$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=W0(r))}else e.pattern??(e.pattern=W0());pt.init(t,e)}),xW=se("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=UH),pt.init(t,e)}),SW=se("$ZodURL",(t,e)=>{pt.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})}}}),EW=se("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=YH()),pt.init(t,e)}),CW=se("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=HH),pt.init(t,e)}),TW=se("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=LH),pt.init(t,e)}),MW=se("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=jH),pt.init(t,e)}),RW=se("$ZodULID",(t,e)=>{e.pattern??(e.pattern=FH),pt.init(t,e)}),OW=se("$ZodXID",(t,e)=>{e.pattern??(e.pattern=BH),pt.init(t,e)}),NW=se("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=VH),pt.init(t,e)}),_W=se("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=rW(e)),pt.init(t,e)}),PW=se("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=tW),pt.init(t,e)}),AW=se("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=nW(e)),pt.init(t,e)}),IW=se("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=WH),pt.init(t,e)}),$W=se("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=GH),pt.init(t,e),t._zod.bag.format="ipv4"}),DW=se("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=ZH),pt.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})}}}),zW=se("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=JH),pt.init(t,e)}),LW=se("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=XH),pt.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 YC(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const jW=se("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=QH),pt.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=n=>{YC(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function FW(t){if(!qC.test(t))return!1;const e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return YC(n)}const BW=se("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=qC),pt.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=n=>{FW(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),VW=se("$ZodE164",(t,e)=>{e.pattern??(e.pattern=eW),pt.init(t,e)});function HW(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 WW=se("$ZodJWT",(t,e)=>{pt.init(t,e),t._zod.check=n=>{HW(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),qW=se("$ZodUnknown",(t,e)=>{Ct.init(t,e),t._zod.parse=n=>n}),UW=se("$ZodNever",(t,e)=>{Ct.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)});function q0(t,e,n){t.issues.length&&e.issues.push(...Gs(n,t.issues)),e.value[n]=t.value}const KW=se("$ZodArray",(t,e)=>{Ct.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=>q0(c,n,i))):q0(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(...Gs(n,t.issues))}t.value===void 0?n in r&&(e.value[n]=void 0):e.value[n]=t.value}function GC(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=bH(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}function ZC(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 YW=se("$ZodObject",(t,e)=>{if(Ct.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=hg(()=>GC(e));rt(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",m=h._zod.run({value:c[f],issues:[]},l);m instanceof Promise?u.push(m.then(g=>Ku(g,a,f,c,p))):Ku(m,a,f,c,p)}return s?ZC(u,c,a,l,r.value,t):u.length?Promise.all(u).then(()=>a):a}}),GW=se("$ZodObjectJIT",(t,e)=>{YW.init(t,e);const n=t._zod.parse,r=hg(()=>GC(e)),o=f=>{const h=new bW(["shape","payload","ctx"]),p=r.value,m=w=>{const k=H0(w);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};h.write("const input = payload.value;");const g=Object.create(null);let y=0;for(const w of p.keys)g[w]=`key_${y++}`;h.write("const newResult = {};");for(const w of p.keys){const k=g[w],v=H0(w),S=f[w]?._zod?.optout==="optional";h.write(`const ${k} = ${m(w)};`),S?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=!LC.jitless,c=a&&gH.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?ZC([],p,f,h,d,t):f):n(f,h):(f.issues.push({expected:"object",code:"invalid_type",input:p,inst:t}),f)}});function U0(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=>!Ys(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=>ko(i,r,wo())))}),e)}const ZW=se("$ZodUnion",(t,e)=>{Ct.init(t,e),rt(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),rt(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),rt(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),rt(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=>mg(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=>U0(l,o,t,s)):U0(a,o,t,s)}}),JW=se("$ZodIntersection",(t,e)=>{Ct.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])=>K0(n,l,c)):K0(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(Mi(t)&&Mi(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 K0(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}),Ys(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 XW=se("$ZodRecord",(t,e)=>{Ct.init(t,e),t._zod.parse=(n,r)=>{const o=n.value;if(!Mi(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(...Gs(c,d.issues)),n.value[c]=d.value})):(u.issues.length&&n.issues.push(...Gs(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"&&sW.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=>ko(d,r,wo())),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(...Gs(a,d.issues)),n.value[l.value]=d.value})):(u.issues.length&&n.issues.push(...Gs(a,u.issues)),n.value[l.value]=u.value)}}return s.length?Promise.all(s).then(()=>n):n}}),QW=se("$ZodEnum",(t,e)=>{Ct.init(t,e);const n=jC(e.entries),r=new Set(n);t._zod.values=r,t._zod.pattern=new RegExp(`^(${n.filter(o=>yH.has(typeof o)).map(o=>typeof o=="string"?Ri(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}}),eq=se("$ZodLiteral",(t,e)=>{if(Ct.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"?Ri(r):r?Ri(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=se("$ZodTransform",(t,e)=>{Ct.init(t,e),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new zC(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 ai;return n.value=o,n}});function Y0(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}const JC=se("$ZodOptional",(t,e)=>{Ct.init(t,e),t._zod.optin="optional",t._zod.optout="optional",rt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),rt(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${mg(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=>Y0(s,n.value)):Y0(o,n.value)}return n.value===void 0?n:e.innerType._zod.run(n,r)}}),nq=se("$ZodExactOptional",(t,e)=>{JC.init(t,e),rt(t._zod,"values",()=>e.innerType._zod.values),rt(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(n,r)=>e.innerType._zod.run(n,r)}),rq=se("$ZodNullable",(t,e)=>{Ct.init(t,e),rt(t._zod,"optin",()=>e.innerType._zod.optin),rt(t._zod,"optout",()=>e.innerType._zod.optout),rt(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${mg(n.source)}|null)$`):void 0}),rt(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=se("$ZodDefault",(t,e)=>{Ct.init(t,e),t._zod.optin="optional",rt(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=>G0(s,e)):G0(o,e)}});function G0(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const sq=se("$ZodPrefault",(t,e)=>{Ct.init(t,e),t._zod.optin="optional",rt(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))}),iq=se("$ZodNonOptional",(t,e)=>{Ct.init(t,e),rt(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=>Z0(s,t)):Z0(o,t)}});function Z0(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 aq=se("$ZodCatch",(t,e)=>{Ct.init(t,e),rt(t._zod,"optin",()=>e.innerType._zod.optin),rt(t._zod,"optout",()=>e.innerType._zod.optout),rt(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=>ko(i,r,wo()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=e.catchValue({...n,error:{issues:o.issues.map(s=>ko(s,r,wo()))},input:n.value}),n.issues=[]),n)}}),lq=se("$ZodPipe",(t,e)=>{Ct.init(t,e),rt(t._zod,"values",()=>e.in._zod.values),rt(t._zod,"optin",()=>e.in._zod.optin),rt(t._zod,"optout",()=>e.out._zod.optout),rt(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=>jl(i,e.in,r)):jl(s,e.in,r)}const o=e.in._zod.run(n,r);return o instanceof Promise?o.then(s=>jl(s,e.out,r)):jl(o,e.out,r)}});function jl(t,e,n){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},n)}const cq=se("$ZodReadonly",(t,e)=>{Ct.init(t,e),rt(t._zod,"propValues",()=>e.innerType._zod.propValues),rt(t._zod,"values",()=>e.innerType._zod.values),rt(t._zod,"optin",()=>e.innerType?._zod?.optin),rt(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(J0):J0(o)}});function J0(t){return t.value=Object.freeze(t.value),t}const uq=se("$ZodCustom",(t,e)=>{br.init(t,e),Ct.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=>X0(s,n,r,t));X0(o,n,r,t)}});function X0(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(Va(o))}}var Q0;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 fq(){return new dq}(Q0=globalThis).__zod_globalRegistry??(Q0.__zod_globalRegistry=fq());const ia=globalThis.__zod_globalRegistry;function hq(t,e){return new t({type:"string",...Ne(e)})}function pq(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Ne(e)})}function ev(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Ne(e)})}function mq(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Ne(e)})}function gq(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ne(e)})}function yq(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ne(e)})}function bq(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ne(e)})}function vq(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Ne(e)})}function wq(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Ne(e)})}function kq(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ne(e)})}function xq(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Ne(e)})}function Sq(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ne(e)})}function Eq(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Ne(e)})}function Cq(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Ne(e)})}function Tq(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ne(e)})}function Mq(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ne(e)})}function Rq(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ne(e)})}function Oq(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ne(e)})}function Nq(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ne(e)})}function _q(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Ne(e)})}function Pq(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Ne(e)})}function Aq(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Ne(e)})}function Iq(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Ne(e)})}function $q(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ne(e)})}function Dq(t,e){return new t({type:"string",format:"date",check:"string_format",...Ne(e)})}function zq(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...Ne(e)})}function Lq(t,e){return new t({type:"string",format:"duration",check:"string_format",...Ne(e)})}function jq(t){return new t({type:"unknown"})}function Fq(t,e){return new t({type:"never",...Ne(e)})}function XC(t,e){return new lW({check:"max_length",...Ne(e),maximum:t})}function Yu(t,e){return new cW({check:"min_length",...Ne(e),minimum:t})}function QC(t,e){return new uW({check:"length_equals",...Ne(e),length:t})}function Bq(t,e){return new dW({check:"string_format",format:"regex",...Ne(e),pattern:t})}function Vq(t){return new fW({check:"string_format",format:"lowercase",...Ne(t)})}function Hq(t){return new hW({check:"string_format",format:"uppercase",...Ne(t)})}function Wq(t,e){return new pW({check:"string_format",format:"includes",...Ne(e),includes:t})}function qq(t,e){return new mW({check:"string_format",format:"starts_with",...Ne(e),prefix:t})}function Uq(t,e){return new gW({check:"string_format",format:"ends_with",...Ne(e),suffix:t})}function Li(t){return new yW({check:"overwrite",tx:t})}function Kq(t){return Li(e=>e.normalize(t))}function Yq(){return Li(t=>t.trim())}function Gq(){return Li(t=>t.toLowerCase())}function Zq(){return Li(t=>t.toUpperCase())}function Jq(){return Li(t=>mH(t))}function Xq(t,e,n){return new t({type:"array",element:e,...Ne(n)})}function Qq(t,e,n){return new t({type:"custom",check:"custom",fn:e,...Ne(n)})}function e6(t){const e=t6(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Va(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(Va(o))}},t(n.value,n)));return e}function t6(t,e){const n=new br({check:"custom",...Ne(e)});return n._zod.check=t,n}function eT(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??ia,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 Ot(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),Ot(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"&&rn(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 tT(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 nT(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 m in l)m==="$ref"||m==="allOf"||m in c||delete l[m];if(h.$ref&&f.def)for(const m in l)m==="$ref"||m==="allOf"||m in f.def&&JSON.stringify(l[m])===JSON.stringify(f.def[m])&&delete l[m]}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:Gu(e,"input",t.processors),output:Gu(e,"output",t.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function rn(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 rn(r.element,n);if(r.type==="set")return rn(r.valueType,n);if(r.type==="lazy")return rn(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 rn(r.innerType,n);if(r.type==="intersection")return rn(r.left,n)||rn(r.right,n);if(r.type==="record"||r.type==="map")return rn(r.keyType,n)||rn(r.valueType,n);if(r.type==="pipe")return rn(r.in,n)||rn(r.out,n);if(r.type==="object"){for(const o in r.shape)if(rn(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(rn(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(rn(o,n))return!0;return!!(r.rest&&rn(r.rest,n))}return!1}const n6=(t,e={})=>n=>{const r=eT({...n,processors:e});return Ot(t,r),tT(r,t),nT(r,t)},Gu=(t,e,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=eT({...o??{},target:s,io:e,processors:n});return Ot(t,i),tT(i,t),nT(i,t)},r6={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},o6=(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=r6[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}))])}},s6=(t,e,n,r)=>{n.not={}},i6=(t,e,n,r)=>{},a6=(t,e,n,r)=>{const o=t._zod.def,s=jC(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},l6=(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},c6=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},u6=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},d6=(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=Ot(s.element,e,{...r,path:[...r.path,"items"]})},f6=(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]=Ot(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=Ot(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(o.additionalProperties=!1)},h6=(t,e,n,r)=>{const o=t._zod.def,s=o.inclusive===!1,i=o.options.map((a,l)=>Ot(a,e,{...r,path:[...r.path,s?"oneOf":"anyOf",l]}));s?n.oneOf=i:n.anyOf=i},p6=(t,e,n,r)=>{const o=t._zod.def,s=Ot(o.left,e,{...r,path:[...r.path,"allOf",0]}),i=Ot(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},m6=(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=Ot(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=Ot(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Ot(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)}},g6=(t,e,n,r)=>{const o=t._zod.def,s=Ot(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"}]},y6=(t,e,n,r)=>{const o=t._zod.def;Ot(o.innerType,e,r);const s=e.seen.get(t);s.ref=o.innerType},b6=(t,e,n,r)=>{const o=t._zod.def;Ot(o.innerType,e,r);const s=e.seen.get(t);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},v6=(t,e,n,r)=>{const o=t._zod.def;Ot(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)))},w6=(t,e,n,r)=>{const o=t._zod.def;Ot(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},k6=(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;Ot(s,e,r);const i=e.seen.get(t);i.ref=s},x6=(t,e,n,r)=>{const o=t._zod.def;Ot(o.innerType,e,r);const s=e.seen.get(t);s.ref=o.innerType,n.readOnly=!0},rT=(t,e,n,r)=>{const o=t._zod.def;Ot(o.innerType,e,r);const s=e.seen.get(t);s.ref=o.innerType},S6=se("ZodISODateTime",(t,e)=>{_W.init(t,e),vt.init(t,e)});function E6(t){return $q(S6,t)}const C6=se("ZodISODate",(t,e)=>{PW.init(t,e),vt.init(t,e)});function T6(t){return Dq(C6,t)}const M6=se("ZodISOTime",(t,e)=>{AW.init(t,e),vt.init(t,e)});function R6(t){return zq(M6,t)}const O6=se("ZodISODuration",(t,e)=>{IW.init(t,e),vt.init(t,e)});function N6(t){return Lq(O6,t)}const _6=(t,e)=>{HC.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>MH(t,n)},flatten:{value:n=>TH(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}}})},jn=se("ZodError",_6,{Parent:Error}),P6=yg(jn),A6=bg(jn),I6=Ld(jn),$6=jd(jn),D6=NH(jn),z6=_H(jn),L6=PH(jn),j6=AH(jn),F6=IH(jn),B6=$H(jn),V6=DH(jn),H6=zH(jn),Tt=se("ZodType",(t,e)=>(Ct.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:Gu(t,"input"),output:Gu(t,"output")}}),t.toJSONSchema=n6(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...n)=>t.clone(_o(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)=>P6(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>I6(t,n,r),t.parseAsync=async(n,r)=>A6(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>$6(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>D6(t,n,r),t.decode=(n,r)=>z6(t,n,r),t.encodeAsync=async(n,r)=>L6(t,n,r),t.decodeAsync=async(n,r)=>j6(t,n,r),t.safeEncode=(n,r)=>F6(t,n,r),t.safeDecode=(n,r)=>B6(t,n,r),t.safeEncodeAsync=async(n,r)=>V6(t,n,r),t.safeDecodeAsync=async(n,r)=>H6(t,n,r),t.refine=(n,r)=>t.check(L9(n,r)),t.superRefine=n=>t.check(j9(n)),t.overwrite=n=>t.check(Li(n)),t.optional=()=>nv(t),t.exactOptional=()=>C9(t),t.nullable=()=>rv(t),t.nullish=()=>nv(rv(t)),t.nonoptional=n=>_9(t,n),t.array=()=>Ha(t),t.or=n=>p9([t,n]),t.and=n=>g9(t,n),t.transform=n=>ov(t,S9(n)),t.default=n=>R9(t,n),t.prefault=n=>N9(t,n),t.catch=n=>A9(t,n),t.pipe=n=>ov(t,n),t.readonly=()=>D9(t),t.describe=n=>{const r=t.clone();return ia.add(r,{description:n}),r},Object.defineProperty(t,"description",{get(){return ia.get(t)?.description},configurable:!0}),t.meta=(...n)=>{if(n.length===0)return ia.get(t);const r=t.clone();return ia.add(r,n[0]),r},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=n=>n(t),t)),oT=se("_ZodString",(t,e)=>{vg.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(r,o,s)=>o6(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(Bq(...r)),t.includes=(...r)=>t.check(Wq(...r)),t.startsWith=(...r)=>t.check(qq(...r)),t.endsWith=(...r)=>t.check(Uq(...r)),t.min=(...r)=>t.check(Yu(...r)),t.max=(...r)=>t.check(XC(...r)),t.length=(...r)=>t.check(QC(...r)),t.nonempty=(...r)=>t.check(Yu(1,...r)),t.lowercase=r=>t.check(Vq(r)),t.uppercase=r=>t.check(Hq(r)),t.trim=()=>t.check(Yq()),t.normalize=(...r)=>t.check(Kq(...r)),t.toLowerCase=()=>t.check(Gq()),t.toUpperCase=()=>t.check(Zq()),t.slugify=()=>t.check(Jq())}),W6=se("ZodString",(t,e)=>{vg.init(t,e),oT.init(t,e),t.email=n=>t.check(pq(q6,n)),t.url=n=>t.check(vq(U6,n)),t.jwt=n=>t.check(Iq(a9,n)),t.emoji=n=>t.check(wq(K6,n)),t.guid=n=>t.check(ev(tv,n)),t.uuid=n=>t.check(mq(Fl,n)),t.uuidv4=n=>t.check(gq(Fl,n)),t.uuidv6=n=>t.check(yq(Fl,n)),t.uuidv7=n=>t.check(bq(Fl,n)),t.nanoid=n=>t.check(kq(Y6,n)),t.guid=n=>t.check(ev(tv,n)),t.cuid=n=>t.check(xq(G6,n)),t.cuid2=n=>t.check(Sq(Z6,n)),t.ulid=n=>t.check(Eq(J6,n)),t.base64=n=>t.check(_q(o9,n)),t.base64url=n=>t.check(Pq(s9,n)),t.xid=n=>t.check(Cq(X6,n)),t.ksuid=n=>t.check(Tq(Q6,n)),t.ipv4=n=>t.check(Mq(e9,n)),t.ipv6=n=>t.check(Rq(t9,n)),t.cidrv4=n=>t.check(Oq(n9,n)),t.cidrv6=n=>t.check(Nq(r9,n)),t.e164=n=>t.check(Aq(i9,n)),t.datetime=n=>t.check(E6(n)),t.date=n=>t.check(T6(n)),t.time=n=>t.check(R6(n)),t.duration=n=>t.check(N6(n))});function li(t){return hq(W6,t)}const vt=se("ZodStringFormat",(t,e)=>{pt.init(t,e),oT.init(t,e)}),q6=se("ZodEmail",(t,e)=>{xW.init(t,e),vt.init(t,e)}),tv=se("ZodGUID",(t,e)=>{wW.init(t,e),vt.init(t,e)}),Fl=se("ZodUUID",(t,e)=>{kW.init(t,e),vt.init(t,e)}),U6=se("ZodURL",(t,e)=>{SW.init(t,e),vt.init(t,e)}),K6=se("ZodEmoji",(t,e)=>{EW.init(t,e),vt.init(t,e)}),Y6=se("ZodNanoID",(t,e)=>{CW.init(t,e),vt.init(t,e)}),G6=se("ZodCUID",(t,e)=>{TW.init(t,e),vt.init(t,e)}),Z6=se("ZodCUID2",(t,e)=>{MW.init(t,e),vt.init(t,e)}),J6=se("ZodULID",(t,e)=>{RW.init(t,e),vt.init(t,e)}),X6=se("ZodXID",(t,e)=>{OW.init(t,e),vt.init(t,e)}),Q6=se("ZodKSUID",(t,e)=>{NW.init(t,e),vt.init(t,e)}),e9=se("ZodIPv4",(t,e)=>{$W.init(t,e),vt.init(t,e)}),t9=se("ZodIPv6",(t,e)=>{DW.init(t,e),vt.init(t,e)}),n9=se("ZodCIDRv4",(t,e)=>{zW.init(t,e),vt.init(t,e)}),r9=se("ZodCIDRv6",(t,e)=>{LW.init(t,e),vt.init(t,e)}),o9=se("ZodBase64",(t,e)=>{jW.init(t,e),vt.init(t,e)}),s9=se("ZodBase64URL",(t,e)=>{BW.init(t,e),vt.init(t,e)}),i9=se("ZodE164",(t,e)=>{VW.init(t,e),vt.init(t,e)}),a9=se("ZodJWT",(t,e)=>{WW.init(t,e),vt.init(t,e)}),l9=se("ZodUnknown",(t,e)=>{qW.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(n,r,o)=>i6()});function ap(){return jq(l9)}const c9=se("ZodNever",(t,e)=>{UW.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(n,r,o)=>s6(t,n,r)});function u9(t){return Fq(c9,t)}const d9=se("ZodArray",(t,e)=>{KW.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(n,r,o)=>d6(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(XC(n,r)),t.length=(n,r)=>t.check(QC(n,r)),t.unwrap=()=>t.element});function Ha(t,e){return Xq(d9,t,e)}const f9=se("ZodObject",(t,e)=>{GW.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(n,r,o)=>f6(t,n,r,o),rt(t,"shape",()=>e.shape),t.keyof=()=>v9(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:u9()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=n=>kH(t,n),t.safeExtend=n=>xH(t,n),t.merge=n=>SH(t,n),t.pick=n=>vH(t,n),t.omit=n=>wH(t,n),t.partial=(...n)=>EH(iT,t,n[0]),t.required=(...n)=>CH(aT,t,n[0])});function sT(t,e){const n={type:"object",shape:t??{},...Ne(e)};return new f9(n)}const h9=se("ZodUnion",(t,e)=>{ZW.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(n,r,o)=>h6(t,n,r,o),t.options=e.options});function p9(t,e){return new h9({type:"union",options:t,...Ne(e)})}const m9=se("ZodIntersection",(t,e)=>{JW.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(n,r,o)=>p6(t,n,r,o)});function g9(t,e){return new m9({type:"intersection",left:t,right:e})}const y9=se("ZodRecord",(t,e)=>{XW.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(n,r,o)=>m6(t,n,r,o),t.keyType=e.keyType,t.valueType=e.valueType});function b9(t,e,n){return new y9({type:"record",keyType:t,valueType:e,...Ne(n)})}const lp=se("ZodEnum",(t,e)=>{QW.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(r,o,s)=>a6(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:[],...Ne(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:[],...Ne(o),entries:s})}});function v9(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new lp({type:"enum",entries:n,...Ne(e)})}const w9=se("ZodLiteral",(t,e)=>{eq.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(n,r,o)=>l6(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 k9(t,e){return new w9({type:"literal",values:Array.isArray(t)?t:[t],...Ne(e)})}const x9=se("ZodTransform",(t,e)=>{tq.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(n,r,o)=>u6(t,n),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new zC(t.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Va(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(Va(i))}};const o=e.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function S9(t){return new x9({type:"transform",transform:t})}const iT=se("ZodOptional",(t,e)=>{JC.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(n,r,o)=>rT(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function nv(t){return new iT({type:"optional",innerType:t})}const E9=se("ZodExactOptional",(t,e)=>{nq.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(n,r,o)=>rT(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function C9(t){return new E9({type:"optional",innerType:t})}const T9=se("ZodNullable",(t,e)=>{rq.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(n,r,o)=>g6(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function rv(t){return new T9({type:"nullable",innerType:t})}const M9=se("ZodDefault",(t,e)=>{oq.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(n,r,o)=>b6(t,n,r,o),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function R9(t,e){return new M9({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():BC(e)}})}const O9=se("ZodPrefault",(t,e)=>{sq.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(n,r,o)=>v6(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function N9(t,e){return new O9({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():BC(e)}})}const aT=se("ZodNonOptional",(t,e)=>{iq.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(n,r,o)=>y6(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function _9(t,e){return new aT({type:"nonoptional",innerType:t,...Ne(e)})}const P9=se("ZodCatch",(t,e)=>{aq.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(n,r,o)=>w6(t,n,r,o),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function A9(t,e){return new P9({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const I9=se("ZodPipe",(t,e)=>{lq.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(n,r,o)=>k6(t,n,r,o),t.in=e.in,t.out=e.out});function ov(t,e){return new I9({type:"pipe",in:t,out:e})}const $9=se("ZodReadonly",(t,e)=>{cq.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(n,r,o)=>x6(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function D9(t){return new $9({type:"readonly",innerType:t})}const z9=se("ZodCustom",(t,e)=>{uq.init(t,e),Tt.init(t,e),t._zod.processJSONSchema=(n,r,o)=>c6(t,n)});function L9(t,e={}){return Qq(z9,t,e)}function j9(t){return e6(t)}const Zu=b9(li(),ap()),F9=sT({type:k9("object"),properties:Zu,required:Ha(li()).optional()}).passthrough(),B9=sT({type:li().optional(),format:li().optional(),enum:Ha(li()).optional(),anyOf:Ha(Zu).optional(),items:Zu.optional()}).passthrough(),sv="#/definitions/";function V9(t){const e=Zu.safeParse(t);return e.success?e.data:void 0}function wg(t){const e=B9.safeParse(t);return e.success?e.data:void 0}function iv(t){const e=F9.safeParse(t);return e.success?e.data:void 0}function lT(t){return t.type!=="array"?!1:wg(t.items)?.type==="string"}function H9(t){if(!t.anyOf||t.anyOf.length===0)return!1;let e=!1;for(const n of t.anyOf){const r=wg(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 W9(t){const e=Ha(li()).safeParse(t);return new Set(e.success?e.data:[])}function q9(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"&&lT(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};if(e.kind==="icon"&&t.property.type==="string")return{kind:"icon",key:t.key,required:t.required,iconLibraries:e.iconLibraries}}}function cT(t){if(!t)return;const e=iv(t);if(e)return e;const n=typeof t.$ref=="string"?t.$ref:void 0;if(!n?.startsWith(sv))return;const r=n.slice(sv.length),o=V9(t.definitions),s=o?o[r]:void 0;return iv(s)}function uT(t,e){const n=W9(t.required),r=[];for(const[o,s]of Object.entries(t.properties)){if(o==="$schema")continue;const i=wg(s),a=n.has(o);if(!i){r.push({kind:"unsupported",key:o,required:a,reason:"invalid schema node"});continue}const l=q9({key:o,property:i,required:a,fieldUi:e});if(l){r.push(l);continue}if(H9(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(lT(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 dT(t){return JSON.parse(JSON.stringify(t))}function U9(t){return Array.isArray(t)&&t.every(e=>typeof e=="string")}function K9(t,e){switch(t.kind){case"string":case"image":case"color":case"icon":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 U9(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 Y9(t){const e=Object.keys(t.revisionFrontmatter),n=cp(t.reason),r=Object.fromEntries(e.map(o=>[o,n]));return{nextDraft:dT(t.currentDraft),appliedKeys:[],skippedKeys:e,reasonBySkippedKey:r}}function G9(t){const e=cT(t.schema);if(!e)return Y9({currentDraft:t.currentDraft,revisionFrontmatter:t.revisionFrontmatter,reason:"schema_unavailable"});const n=uT(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=dT(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(!K9(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 Bl={exports:{}},qf={},Cr={},jo={},Uf={},Kf={},Yf={},av;function Ju(){return av||(av=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 m(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=m;function g(y){return new r(y.toString())}t.regexpCode=g})(Yf)),Yf}var Gf={},lv;function cv(){return lv||(lv=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 m=this._values[h];if(m){const b=m.get(p);if(b)return b}else m=this._values[h]=new Map;m.set(p,f);const g=this._scope[h]||(this._scope[h]=[]),y=g.length;return g[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 m=c[p];if(!m)continue;const g=d[p]=d[p]||new Map;m.forEach(y=>{if(g.has(y))return;g.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);g.set(y,r.Completed)})}return h}}t.ValueScope=a})(Gf)),Gf}var uv;function We(){return uv||(uv=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=cv();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=cv();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(R,D){return this}}class i extends s{constructor(R,D,$){super(),this.varKind=R,this.name=D,this.rhs=$}render({es5:R,_n:D}){const $=R?n.varKinds.var:this.varKind,Z=this.rhs===void 0?"":` = ${this.rhs}`;return`${$} ${this.name}${Z};`+D}optimizeNames(R,D){if(R[this.name.str])return this.rhs&&(this.rhs=j(this.rhs,R,D)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class a extends s{constructor(R,D,$){super(),this.lhs=R,this.rhs=D,this.sideEffects=$}render({_n:R}){return`${this.lhs} = ${this.rhs};`+R}optimizeNames(R,D){if(!(this.lhs instanceof e.Name&&!R[this.lhs.str]&&!this.sideEffects))return this.rhs=j(this.rhs,R,D),this}get names(){const R=this.lhs instanceof e.Name?{}:{...this.lhs.names};return A(R,this.rhs)}}class l extends a{constructor(R,D,$,Z){super(R,$,Z),this.op=D}render({_n:R}){return`${this.lhs} ${this.op}= ${this.rhs};`+R}}class c extends s{constructor(R){super(),this.label=R,this.names={}}render({_n:R}){return`${this.label}:`+R}}class u extends s{constructor(R){super(),this.label=R,this.names={}}render({_n:R}){return`break${this.label?` ${this.label}`:""};`+R}}class d extends s{constructor(R){super(),this.error=R}render({_n:R}){return`throw ${this.error};`+R}get names(){return this.error.names}}class f extends s{constructor(R){super(),this.code=R}render({_n:R}){return`${this.code};`+R}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(R,D){return this.code=j(this.code,R,D),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class h extends s{constructor(R=[]){super(),this.nodes=R}render(R){return this.nodes.reduce((D,$)=>D+$.render(R),"")}optimizeNodes(){const{nodes:R}=this;let D=R.length;for(;D--;){const $=R[D].optimizeNodes();Array.isArray($)?R.splice(D,1,...$):$?R[D]=$:R.splice(D,1)}return R.length>0?this:void 0}optimizeNames(R,D){const{nodes:$}=this;let Z=$.length;for(;Z--;){const Q=$[Z];Q.optimizeNames(R,D)||(K(R,Q.names),$.splice(Z,1))}return $.length>0?this:void 0}get names(){return this.nodes.reduce((R,D)=>P(R,D.names),{})}}class p extends h{render(R){return"{"+R._n+super.render(R)+"}"+R._n}}class m extends h{}class g extends p{}g.kind="else";class y extends p{constructor(R,D){super(D),this.condition=R}render(R){let D=`if(${this.condition})`+super.render(R);return this.else&&(D+="else "+this.else.render(R)),D}optimizeNodes(){super.optimizeNodes();const R=this.condition;if(R===!0)return this.nodes;let D=this.else;if(D){const $=D.optimizeNodes();D=this.else=Array.isArray($)?new g($):$}if(D)return R===!1?D instanceof y?D:D.nodes:this.nodes.length?this:new y(J(R),D instanceof y?[D]:D.nodes);if(!(R===!1||!this.nodes.length))return this}optimizeNames(R,D){var $;if(this.else=($=this.else)===null||$===void 0?void 0:$.optimizeNames(R,D),!!(super.optimizeNames(R,D)||this.else))return this.condition=j(this.condition,R,D),this}get names(){const R=super.names;return A(R,this.condition),this.else&&P(R,this.else.names),R}}y.kind="if";class b extends p{}b.kind="for";class w extends b{constructor(R){super(),this.iteration=R}render(R){return`for(${this.iteration})`+super.render(R)}optimizeNames(R,D){if(super.optimizeNames(R,D))return this.iteration=j(this.iteration,R,D),this}get names(){return P(super.names,this.iteration.names)}}class k extends b{constructor(R,D,$,Z){super(),this.varKind=R,this.name=D,this.from=$,this.to=Z}render(R){const D=R.es5?n.varKinds.var:this.varKind,{name:$,from:Z,to:Q}=this;return`for(${D} ${$}=${Z}; ${$}<${Q}; ${$}++)`+super.render(R)}get names(){const R=A(super.names,this.from);return A(R,this.to)}}class v extends b{constructor(R,D,$,Z){super(),this.loop=R,this.varKind=D,this.name=$,this.iterable=Z}render(R){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(R)}optimizeNames(R,D){if(super.optimizeNames(R,D))return this.iterable=j(this.iterable,R,D),this}get names(){return P(super.names,this.iterable.names)}}class x extends p{constructor(R,D,$){super(),this.name=R,this.args=D,this.async=$}render(R){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(R)}}x.kind="func";class S extends h{render(R){return"return "+super.render(R)}}S.kind="return";class T extends p{render(R){let D="try"+super.render(R);return this.catch&&(D+=this.catch.render(R)),this.finally&&(D+=this.finally.render(R)),D}optimizeNodes(){var R,D;return super.optimizeNodes(),(R=this.catch)===null||R===void 0||R.optimizeNodes(),(D=this.finally)===null||D===void 0||D.optimizeNodes(),this}optimizeNames(R,D){var $,Z;return super.optimizeNames(R,D),($=this.catch)===null||$===void 0||$.optimizeNames(R,D),(Z=this.finally)===null||Z===void 0||Z.optimizeNames(R,D),this}get names(){const R=super.names;return this.catch&&P(R,this.catch.names),this.finally&&P(R,this.finally.names),R}}class I extends p{constructor(R){super(),this.error=R}render(R){return`catch(${this.error})`+super.render(R)}}I.kind="catch";class L extends p{render(R){return"finally"+super.render(R)}}L.kind="finally";class N{constructor(R,D={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...D,_n:D.lines?`
328
+ `:""},this._extScope=R,this._scope=new n.Scope({parent:R}),this._nodes=[new m]}toString(){return this._root.render(this.opts)}name(R){return this._scope.name(R)}scopeName(R){return this._extScope.name(R)}scopeValue(R,D){const $=this._extScope.value(R,D);return(this._values[$.prefix]||(this._values[$.prefix]=new Set)).add($),$}getScopeValue(R,D){return this._extScope.getValue(R,D)}scopeRefs(R){return this._extScope.scopeRefs(R,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(R,D,$,Z){const Q=this._scope.toName(D);return $!==void 0&&Z&&(this._constants[Q.str]=$),this._leafNode(new i(R,Q,$)),Q}const(R,D,$){return this._def(n.varKinds.const,R,D,$)}let(R,D,$){return this._def(n.varKinds.let,R,D,$)}var(R,D,$){return this._def(n.varKinds.var,R,D,$)}assign(R,D,$){return this._leafNode(new a(R,D,$))}add(R,D){return this._leafNode(new l(R,t.operators.ADD,D))}code(R){return typeof R=="function"?R():R!==e.nil&&this._leafNode(new f(R)),this}object(...R){const D=["{"];for(const[$,Z]of R)D.length>1&&D.push(","),D.push($),($!==Z||this.opts.es5)&&(D.push(":"),(0,e.addCodeArg)(D,Z));return D.push("}"),new e._Code(D)}if(R,D,$){if(this._blockNode(new y(R)),D&&$)this.code(D).else().code($).endIf();else if(D)this.code(D).endIf();else if($)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(R){return this._elseNode(new y(R))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(y,g)}_for(R,D){return this._blockNode(R),D&&this.code(D).endFor(),this}for(R,D){return this._for(new w(R),D)}forRange(R,D,$,Z,Q=this.opts.es5?n.varKinds.var:n.varKinds.let){const _=this._scope.toName(R);return this._for(new k(Q,_,D,$),()=>Z(_))}forOf(R,D,$,Z=n.varKinds.const){const Q=this._scope.toName(R);if(this.opts.es5){const _=D instanceof e.Name?D:this.var("_arr",D);return this.forRange("_i",0,(0,e._)`${_}.length`,q=>{this.var(Q,(0,e._)`${_}[${q}]`),$(Q)})}return this._for(new v("of",Z,Q,D),()=>$(Q))}forIn(R,D,$,Z=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(R,(0,e._)`Object.keys(${D})`,$);const Q=this._scope.toName(R);return this._for(new v("in",Z,Q,D),()=>$(Q))}endFor(){return this._endBlockNode(b)}label(R){return this._leafNode(new c(R))}break(R){return this._leafNode(new u(R))}return(R){const D=new S;if(this._blockNode(D),this.code(R),D.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(S)}try(R,D,$){if(!D&&!$)throw new Error('CodeGen: "try" without "catch" and "finally"');const Z=new T;if(this._blockNode(Z),this.code(R),D){const Q=this.name("e");this._currNode=Z.catch=new I(Q),D(Q)}return $&&(this._currNode=Z.finally=new L,this.code($)),this._endBlockNode(I,L)}throw(R){return this._leafNode(new d(R))}block(R,D){return this._blockStarts.push(this._nodes.length),R&&this.code(R).endBlock(D),this}endBlock(R){const D=this._blockStarts.pop();if(D===void 0)throw new Error("CodeGen: not in self-balancing block");const $=this._nodes.length-D;if($<0||R!==void 0&&$!==R)throw new Error(`CodeGen: wrong number of nodes: ${$} vs ${R} expected`);return this._nodes.length=D,this}func(R,D=e.nil,$,Z){return this._blockNode(new x(R,D,$)),Z&&this.code(Z).endFunc(),this}endFunc(){return this._endBlockNode(x)}optimize(R=1){for(;R-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(R){return this._currNode.nodes.push(R),this}_blockNode(R){this._currNode.nodes.push(R),this._nodes.push(R)}_endBlockNode(R,D){const $=this._currNode;if($ instanceof R||D&&$ instanceof D)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${D?`${R.kind}/${D.kind}`:R.kind}"`)}_elseNode(R){const D=this._currNode;if(!(D instanceof y))throw new Error('CodeGen: "else" without "if"');return this._currNode=D.else=R,this}get _root(){return this._nodes[0]}get _currNode(){const R=this._nodes;return R[R.length-1]}set _currNode(R){const D=this._nodes;D[D.length-1]=R}}t.CodeGen=N;function P(V,R){for(const D in R)V[D]=(V[D]||0)+(R[D]||0);return V}function A(V,R){return R instanceof e._CodeOrName?P(V,R.names):V}function j(V,R,D){if(V instanceof e.Name)return $(V);if(!Z(V))return V;return new e._Code(V._items.reduce((Q,_)=>(_ instanceof e.Name&&(_=$(_)),_ instanceof e._Code?Q.push(..._._items):Q.push(_),Q),[]));function $(Q){const _=D[Q.str];return _===void 0||R[Q.str]!==1?Q:(delete R[Q.str],_)}function Z(Q){return Q instanceof e._Code&&Q._items.some(_=>_ instanceof e.Name&&R[_.str]===1&&D[_.str]!==void 0)}}function K(V,R){for(const D in R)V[D]=(V[D]||0)-(R[D]||0)}function J(V){return typeof V=="boolean"||typeof V=="number"||V===null?!V:(0,e._)`!${H(V)}`}t.not=J;const Y=B(t.operators.AND);function G(...V){return V.reduce(Y)}t.and=G;const U=B(t.operators.OR);function z(...V){return V.reduce(U)}t.or=z;function B(V){return(R,D)=>R===e.nil?D:D===e.nil?R:(0,e._)`${H(R)} ${V} ${H(D)}`}function H(V){return V instanceof e.Name?V:(0,e._)`(${V})`}})(Kf)),Kf}var Be={},dv;function Ze(){if(dv)return Be;dv=1,Object.defineProperty(Be,"__esModule",{value:!0}),Be.checkStrictMode=Be.getErrorPath=Be.Type=Be.useFunc=Be.setEvaluated=Be.evaluatedPropsToName=Be.mergeEvaluated=Be.eachItem=Be.unescapeJsonPointer=Be.escapeJsonPointer=Be.escapeFragment=Be.unescapeFragment=Be.schemaRefOrVal=Be.schemaHasRulesButRef=Be.schemaHasRules=Be.checkUnknownRules=Be.alwaysValidSchema=Be.toHash=void 0;const t=We(),e=Ju();function n(v){const x={};for(const S of v)x[S]=!0;return x}Be.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))}Be.alwaysValidSchema=r;function o(v,x=v.schema){const{opts:S,self:T}=v;if(!S.strictSchema||typeof x=="boolean")return;const I=T.RULES.keywords;for(const L in x)I[L]||k(v,`unknown keyword: "${L}"`)}Be.checkUnknownRules=o;function s(v,x){if(typeof v=="boolean")return!v;for(const S in v)if(x[S])return!0;return!1}Be.schemaHasRules=s;function i(v,x){if(typeof v=="boolean")return!v;for(const S in v)if(S!=="$ref"&&x.all[S])return!0;return!1}Be.schemaHasRulesButRef=i;function a({topSchemaRef:v,schemaPath:x},S,T,I){if(!I){if(typeof S=="number"||typeof S=="boolean")return S;if(typeof S=="string")return(0,t._)`${S}`}return(0,t._)`${v}${x}${(0,t.getProperty)(T)}`}Be.schemaRefOrVal=a;function l(v){return d(decodeURIComponent(v))}Be.unescapeFragment=l;function c(v){return encodeURIComponent(u(v))}Be.escapeFragment=c;function u(v){return typeof v=="number"?`${v}`:v.replace(/~/g,"~0").replace(/\//g,"~1")}Be.escapeJsonPointer=u;function d(v){return v.replace(/~1/g,"/").replace(/~0/g,"~")}Be.unescapeJsonPointer=d;function f(v,x){if(Array.isArray(v))for(const S of v)x(S);else x(v)}Be.eachItem=f;function h({mergeNames:v,mergeToName:x,mergeValues:S,resultToName:T}){return(I,L,N,P)=>{const A=N===void 0?L:N instanceof t.Name?(L instanceof t.Name?v(I,L,N):x(I,L,N),N):L instanceof t.Name?(x(I,N,L),L):S(L,N);return P===t.Name&&!(A instanceof t.Name)?T(I,A):A}}Be.mergeEvaluated={props:h({mergeNames:(v,x,S)=>v.if((0,t._)`${S} !== true && ${x} !== undefined`,()=>{v.if((0,t._)`${x} === true`,()=>v.assign(S,!0),()=>v.assign(S,(0,t._)`${S} || {}`).code((0,t._)`Object.assign(${S}, ${x})`))}),mergeToName:(v,x,S)=>v.if((0,t._)`${S} !== true`,()=>{x===!0?v.assign(S,!0):(v.assign(S,(0,t._)`${S} || {}`),m(v,S,x))}),mergeValues:(v,x)=>v===!0?!0:{...v,...x},resultToName:p}),items:h({mergeNames:(v,x,S)=>v.if((0,t._)`${S} !== true && ${x} !== undefined`,()=>v.assign(S,(0,t._)`${x} === true ? true : ${S} > ${x} ? ${S} : ${x}`)),mergeToName:(v,x,S)=>v.if((0,t._)`${S} !== true`,()=>v.assign(S,x===!0?!0:(0,t._)`${S} > ${x} ? ${S} : ${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 S=v.var("props",(0,t._)`{}`);return x!==void 0&&m(v,S,x),S}Be.evaluatedPropsToName=p;function m(v,x,S){Object.keys(S).forEach(T=>v.assign((0,t._)`${x}${(0,t.getProperty)(T)}`,!0))}Be.setEvaluated=m;const g={};function y(v,x){return v.scopeValue("func",{ref:x,code:g[x.code]||(g[x.code]=new e._Code(x.code))})}Be.useFunc=y;var b;(function(v){v[v.Num=0]="Num",v[v.Str=1]="Str"})(b||(Be.Type=b={}));function w(v,x,S){if(v instanceof t.Name){const T=x===b.Num;return S?T?(0,t._)`"[" + ${v} + "]"`:(0,t._)`"['" + ${v} + "']"`:T?(0,t._)`"/" + ${v}`:(0,t._)`"/" + ${v}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return S?(0,t.getProperty)(v).toString():"/"+u(v)}Be.getErrorPath=w;function k(v,x,S=v.opts.strictSchema){if(S){if(x=`strict mode: ${x}`,S===!0)throw new Error(x);v.self.logger.warn(x)}}return Be.checkStrictMode=k,Be}var Vl={},fv;function Ao(){if(fv)return Vl;fv=1,Object.defineProperty(Vl,"__esModule",{value:!0});const t=We(),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 Vl.default=e,Vl}var hv;function Bd(){return hv||(hv=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=We(),n=Ze(),r=Ao();t.keywordError={message:({keyword:g})=>(0,e.str)`must pass "${g}" keyword validation`},t.keyword$DataError={message:({keyword:g,schemaType:y})=>y?(0,e.str)`"${g}" keyword must be ${y} ($data)`:(0,e.str)`"${g}" keyword is invalid ($data)`};function o(g,y=t.keywordError,b,w){const{it:k}=g,{gen:v,compositeRule:x,allErrors:S}=k,T=d(g,y,b);w??(x||S)?l(v,T):c(k,(0,e._)`[${T}]`)}t.reportError=o;function s(g,y=t.keywordError,b){const{it:w}=g,{gen:k,compositeRule:v,allErrors:x}=w,S=d(g,y,b);l(k,S),v||x||c(w,r.default.vErrors)}t.reportExtraError=s;function i(g,y){g.assign(r.default.errors,y),g.if((0,e._)`${r.default.vErrors} !== null`,()=>g.if(y,()=>g.assign((0,e._)`${r.default.vErrors}.length`,y),()=>g.assign(r.default.vErrors,null)))}t.resetErrorsCount=i;function a({gen:g,keyword:y,schemaValue:b,data:w,errsCount:k,it:v}){if(k===void 0)throw new Error("ajv implementation error");const x=g.name("err");g.forRange("i",k,r.default.errors,S=>{g.const(x,(0,e._)`${r.default.vErrors}[${S}]`),g.if((0,e._)`${x}.instancePath === undefined`,()=>g.assign((0,e._)`${x}.instancePath`,(0,e.strConcat)(r.default.instancePath,v.errorPath))),g.assign((0,e._)`${x}.schemaPath`,(0,e.str)`${v.errSchemaPath}/${y}`),v.opts.verbose&&(g.assign((0,e._)`${x}.schema`,b),g.assign((0,e._)`${x}.data`,w))})}t.extendErrors=a;function l(g,y){const b=g.const("err",y);g.if((0,e._)`${r.default.vErrors} === null`,()=>g.assign(r.default.vErrors,(0,e._)`[${b}]`),(0,e._)`${r.default.vErrors}.push(${b})`),g.code((0,e._)`${r.default.errors}++`)}function c(g,y){const{gen:b,validateName:w,schemaEnv:k}=g;k.$async?b.throw((0,e._)`new ${g.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(g,y,b){const{createErrors:w}=g.it;return w===!1?(0,e._)`{}`:f(g,y,b)}function f(g,y,b={}){const{gen:w,it:k}=g,v=[h(k,b),p(g,b)];return m(g,y,v),w.object(...v)}function h({errorPath:g},{instancePath:y}){const b=y?(0,e.str)`${g}${(0,n.getErrorPath)(y,n.Type.Str)}`:g;return[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,b)]}function p({keyword:g,it:{errSchemaPath:y}},{schemaPath:b,parentSchema:w}){let k=w?y:(0,e.str)`${y}/${g}`;return b&&(k=(0,e.str)`${k}${(0,n.getErrorPath)(b,n.Type.Str)}`),[u.schemaPath,k]}function m(g,{params:y,message:b},w){const{keyword:k,data:v,schemaValue:x,it:S}=g,{opts:T,propertyName:I,topSchemaRef:L,schemaPath:N}=S;w.push([u.keyword,k],[u.params,typeof y=="function"?y(g):y||(0,e._)`{}`]),T.messages&&w.push([u.message,typeof b=="function"?b(g):b]),T.verbose&&w.push([u.schema,x],[u.parentSchema,(0,e._)`${L}${N}`],[r.default.data,v]),I&&w.push([u.propertyName,I])}})(Uf)),Uf}var pv;function Z9(){if(pv)return jo;pv=1,Object.defineProperty(jo,"__esModule",{value:!0}),jo.boolOrEmptySchema=jo.topBoolOrEmptySchema=void 0;const t=Bd(),e=We(),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 Wt={},Fo={},mv;function fT(){if(mv)return Fo;mv=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 Tr={},gv;function hT(){if(gv)return Tr;gv=1,Object.defineProperty(Tr,"__esModule",{value:!0}),Tr.shouldUseRule=Tr.shouldUseGroup=Tr.schemaHasRulesForType=void 0;function t({schema:r,self:o},s){const i=o.RULES.types[s];return i&&i!==!0&&e(r,i)}Tr.schemaHasRulesForType=t;function e(r,o){return o.rules.some(s=>n(r,s))}Tr.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 Tr.shouldUseRule=n,Tr}var yv;function Xu(){if(yv)return Wt;yv=1,Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.reportTypeError=Wt.checkDataTypes=Wt.checkDataType=Wt.coerceAndCheckDataType=Wt.getJSONTypes=Wt.getSchemaTypes=Wt.DataType=void 0;const t=fT(),e=hT(),n=Bd(),r=We(),o=Ze();var s;(function(b){b[b.Correct=0]="Correct",b[b.Wrong=1]="Wrong"})(s||(Wt.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}Wt.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(","))}Wt.getJSONTypes=a;function l(b,w){const{gen:k,data:v,opts:x}=b,S=u(w,x.coerceTypes),T=w.length>0&&!(S.length===0&&w.length===1&&(0,e.schemaHasRulesForType)(b,w[0]));if(T){const I=p(w,v,x.strictNumbers,s.Wrong);k.if(I,()=>{S.length?d(b,w,S):g(b)})}return T}Wt.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:S}=b,T=v.let("dataType",(0,r._)`typeof ${x}`),I=v.let("coerced",(0,r._)`undefined`);S.coerceTypes==="array"&&v.if((0,r._)`${T} == 'object' && Array.isArray(${x}) && ${x}.length == 1`,()=>v.assign(x,(0,r._)`${x}[0]`).assign(T,(0,r._)`typeof ${x}`).if(p(w,x,S.strictNumbers),()=>v.assign(I,x))),v.if((0,r._)`${I} !== undefined`);for(const N of k)(c.has(N)||N==="array"&&S.coerceTypes==="array")&&L(N);v.else(),g(b),v.endIf(),v.if((0,r._)`${I} !== undefined`,()=>{v.assign(x,I),f(b,I)});function L(N){switch(N){case"string":v.elseIf((0,r._)`${T} == "number" || ${T} == "boolean"`).assign(I,(0,r._)`"" + ${x}`).elseIf((0,r._)`${x} === null`).assign(I,(0,r._)`""`);return;case"number":v.elseIf((0,r._)`${T} == "boolean" || ${x} === null
329
+ || (${T} == "string" && ${x} && ${x} == +${x})`).assign(I,(0,r._)`+${x}`);return;case"integer":v.elseIf((0,r._)`${T} === "boolean" || ${x} === null
330
+ || (${T} === "string" && ${x} && ${x} == +${x} && !(${x} % 1))`).assign(I,(0,r._)`+${x}`);return;case"boolean":v.elseIf((0,r._)`${x} === "false" || ${x} === 0 || ${x} === null`).assign(I,!1).elseIf((0,r._)`${x} === "true" || ${x} === 1`).assign(I,!0);return;case"null":v.elseIf((0,r._)`${x} === "" || ${x} === 0 || ${x} === false`),v.assign(I,null);return;case"array":v.elseIf((0,r._)`${T} === "string" || ${T} === "number"
331
+ || ${T} === "boolean" || ${x} === null`).assign(I,(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 S;switch(b){case"null":return(0,r._)`${w} ${x} null`;case"array":S=(0,r._)`Array.isArray(${w})`;break;case"object":S=(0,r._)`${w} && typeof ${w} == "object" && !Array.isArray(${w})`;break;case"integer":S=T((0,r._)`!(${w} % 1) && !isNaN(${w})`);break;case"number":S=T();break;default:return(0,r._)`typeof ${w} ${x} ${b}`}return v===s.Correct?S:(0,r.not)(S);function T(I=r.nil){return(0,r.and)((0,r._)`typeof ${w} == "number"`,I,k?(0,r._)`isFinite(${w})`:r.nil)}}Wt.checkDataType=h;function p(b,w,k,v){if(b.length===1)return h(b[0],w,k,v);let x;const S=(0,o.toHash)(b);if(S.array&&S.object){const T=(0,r._)`typeof ${w} != "object"`;x=S.null?T:(0,r._)`!${w} || ${T}`,delete S.null,delete S.array,delete S.object}else x=r.nil;S.number&&delete S.integer;for(const T in S)x=(0,r.and)(x,h(T,w,k,v));return x}Wt.checkDataTypes=p;const m={message:({schema:b})=>`must be ${b}`,params:({schema:b,schemaValue:w})=>typeof b=="string"?(0,r._)`{type: ${b}}`:(0,r._)`{type: ${w}}`};function g(b){const w=y(b);(0,n.reportError)(w,m)}Wt.reportTypeError=g;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 Wt}var Yi={},bv;function J9(){if(bv)return Yi;bv=1,Object.defineProperty(Yi,"__esModule",{value:!0}),Yi.assignDefaults=void 0;const t=We(),e=Ze();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))}Yi.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 Yi}var Vn={},Xe={},vv;function Jn(){if(vv)return Xe;vv=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.validateUnion=Xe.validateArray=Xe.usePattern=Xe.callValidateCode=Xe.schemaProperties=Xe.allSchemaProperties=Xe.noPropertyInData=Xe.propertyInData=Xe.isOwnProperty=Xe.hasPropFunc=Xe.reportMissingProp=Xe.checkMissingProp=Xe.checkReportMissingProp=void 0;const t=We(),e=Ze(),n=Ao(),r=Ze();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()})}Xe.checkReportMissingProp=o;function s({gen:b,data:w,it:{opts:k}},v,x){return(0,t.or)(...v.map(S=>(0,t.and)(u(b,w,S,k.ownProperties),(0,t._)`${x} = ${S}`)))}Xe.checkMissingProp=s;function i(b,w){b.setParams({missingProperty:w},!0),b.error()}Xe.reportMissingProp=i;function a(b){return b.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}Xe.hasPropFunc=a;function l(b,w,k){return(0,t._)`${a(b)}.call(${w}, ${k})`}Xe.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}Xe.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}Xe.noPropertyInData=u;function d(b){return b?Object.keys(b).filter(w=>w!=="__proto__"):[]}Xe.allSchemaProperties=d;function f(b,w){return d(w).filter(k=>!(0,e.alwaysValidSchema)(b,w[k]))}Xe.schemaProperties=f;function h({schemaCode:b,data:w,it:{gen:k,topSchemaRef:v,schemaPath:x,errorPath:S},it:T},I,L,N){const P=N?(0,t._)`${b}, ${w}, ${v}${x}`:w,A=[[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,S)],[n.default.parentData,T.parentData],[n.default.parentDataProperty,T.parentDataProperty],[n.default.rootData,n.default.rootData]];T.opts.dynamicRef&&A.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);const j=(0,t._)`${P}, ${k.object(...A)}`;return L!==t.nil?(0,t._)`${I}.call(${L}, ${j})`:(0,t._)`${I}(${j})`}Xe.callValidateCode=h;const p=(0,t._)`new RegExp`;function m({gen:b,it:{opts:w}},k){const v=w.unicodeRegExp?"u":"",{regExp:x}=w.code,S=x(k,v);return b.scopeValue("pattern",{key:S.toString(),ref:S,code:(0,t._)`${x.code==="new RegExp"?p:(0,r.useFunc)(b,x)}(${k}, ${v})`})}Xe.usePattern=m;function g(b){const{gen:w,data:k,keyword:v,it:x}=b,S=w.name("valid");if(x.allErrors){const I=w.let("valid",!0);return T(()=>w.assign(I,!1)),I}return w.var(S,!0),T(()=>w.break()),S;function T(I){const L=w.const("len",(0,t._)`${k}.length`);w.forRange("i",0,L,N=>{b.subschema({keyword:v,dataProp:N,dataPropType:e.Type.Num},S),w.if((0,t.not)(S),I)})}}Xe.validateArray=g;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(L=>(0,e.alwaysValidSchema)(x,L))&&!x.opts.unevaluated)return;const T=w.let("valid",!1),I=w.name("_valid");w.block(()=>k.forEach((L,N)=>{const P=b.subschema({keyword:v,schemaProp:N,compositeRule:!0},I);w.assign(T,(0,t._)`${T} || ${I}`),b.mergeValidEvaluated(P,I)||w.if((0,t.not)(T))})),b.result(T,()=>b.reset(),()=>b.error(!0))}return Xe.validateUnion=y,Xe}var wv;function X9(){if(wv)return Vn;wv=1,Object.defineProperty(Vn,"__esModule",{value:!0}),Vn.validateKeywordUsage=Vn.validSchemaType=Vn.funcKeywordCode=Vn.macroKeywordCode=void 0;const t=We(),e=Ao(),n=Jn(),r=Bd();function o(f,h){const{gen:p,keyword:m,schema:g,parentSchema:y,it:b}=f,w=h.macro.call(b.self,g,y,b),k=c(p,m,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}/${m}`,topSchemaRef:k,compositeRule:!0},v),f.pass(v,()=>f.error(!0))}Vn.macroKeywordCode=o;function s(f,h){var p;const{gen:m,keyword:g,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(m,g,v),S=m.let("valid");f.block$data(S,T),f.ok((p=h.valid)!==null&&p!==void 0?p:S);function T(){if(h.errors===!1)N(),h.modifying&&i(f),P(()=>f.error());else{const A=h.async?I():L();h.modifying&&i(f),P(()=>a(f,A))}}function I(){const A=m.let("ruleErrs",null);return m.try(()=>N((0,t._)`await `),j=>m.assign(S,!1).if((0,t._)`${j} instanceof ${k.ValidationError}`,()=>m.assign(A,(0,t._)`${j}.errors`),()=>m.throw(j))),A}function L(){const A=(0,t._)`${x}.errors`;return m.assign(A,null),N(t.nil),A}function N(A=h.async?(0,t._)`await `:t.nil){const j=k.opts.passContext?e.default.this:e.default.self,K=!("compile"in h&&!w||h.schema===!1);m.assign(S,(0,t._)`${A}${(0,n.callValidateCode)(f,x,j,K)}`,h.modifying)}function P(A){var j;m.if((0,t.not)((j=h.valid)!==null&&j!==void 0?j:S),A)}}Vn.funcKeywordCode=s;function i(f){const{gen:h,data:p,it:m}=f;h.if(m.parentData,()=>h.assign(p,(0,t._)`${m.parentData}[${m.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(m=>m==="array"?Array.isArray(f):m==="object"?f&&typeof f=="object"&&!Array.isArray(f):typeof f==m||p&&typeof f>"u")}Vn.validSchemaType=u;function d({schema:f,opts:h,self:p,errSchemaPath:m},g,y){if(Array.isArray(g.keyword)?!g.keyword.includes(y):g.keyword!==y)throw new Error("ajv implementation error");const b=g.dependencies;if(b?.some(w=>!Object.prototype.hasOwnProperty.call(f,w)))throw new Error(`parent schema must have dependencies of ${y}: ${b.join(",")}`);if(g.validateSchema&&!g.validateSchema(f[y])){const k=`keyword "${y}" value is invalid at path "${m}": `+p.errorsText(g.validateSchema.errors);if(h.validateSchema==="log")p.logger.error(k);else throw new Error(k)}}return Vn.validateKeywordUsage=d,Vn}var Mr={},kv;function Q9(){if(kv)return Mr;kv=1,Object.defineProperty(Mr,"__esModule",{value:!0}),Mr.extendSubschemaMode=Mr.extendSubschemaData=Mr.getSubschema=void 0;const t=We(),e=Ze();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')}Mr.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:m,opts:g}=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,g.jsPropertySyntax)}`,s.parentDataProperty=(0,t._)`${a}`,s.dataPathArr=[...m,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]}}Mr.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 Mr.extendSubschemaMode=o,Mr}var nn={},Zf,xv;function pT(){return xv||(xv=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 Jf={exports:{}},Sv;function eU(){if(Sv)return Jf.exports;Sv=1;var t=Jf.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 m=0;m<p.length;m++)e(r,o,s,p[m],a+"/"+h+"/"+m,l,a,h,i,m)}else if(h in t.propsKeywords){if(p&&typeof p=="object")for(var g in p)e(r,o,s,p[g],a+"/"+h+"/"+n(g),l,a,h,i,g)}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 Jf.exports}var Ev;function Vd(){if(Ev)return nn;Ev=1,Object.defineProperty(nn,"__esModule",{value:!0}),nn.getSchemaRefs=nn.resolveUrl=nn.normalizeId=nn._getFullPath=nn.getFullPath=nn.inlineRef=void 0;const t=Ze(),e=pT(),n=eU(),r=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function o(m,g=!0){return typeof m=="boolean"?!0:g===!0?!i(m):g?a(m)<=g:!1}nn.inlineRef=o;const s=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function i(m){for(const g in m){if(s.has(g))return!0;const y=m[g];if(Array.isArray(y)&&y.some(i)||typeof y=="object"&&i(y))return!0}return!1}function a(m){let g=0;for(const y in m){if(y==="$ref")return 1/0;if(g++,!r.has(y)&&(typeof m[y]=="object"&&(0,t.eachItem)(m[y],b=>g+=a(b)),g===1/0))return 1/0}return g}function l(m,g="",y){y!==!1&&(g=d(g));const b=m.parse(g);return c(m,b)}nn.getFullPath=l;function c(m,g){return m.serialize(g).split("#")[0]+"#"}nn._getFullPath=c;const u=/#\/?$/;function d(m){return m?m.replace(u,""):""}nn.normalizeId=d;function f(m,g,y){return y=d(y),m.resolve(g,y)}nn.resolveUrl=f;const h=/^[a-z_][-a-z0-9._]*$/i;function p(m,g){if(typeof m=="boolean")return{};const{schemaId:y,uriResolver:b}=this.opts,w=d(m[y]||g),k={"":w},v=l(b,w,!1),x={},S=new Set;return n(m,{allKeys:!0},(L,N,P,A)=>{if(A===void 0)return;const j=v+N;let K=k[A];typeof L[y]=="string"&&(K=J.call(this,L[y])),Y.call(this,L.$anchor),Y.call(this,L.$dynamicAnchor),k[N]=K;function J(G){const U=this.opts.uriResolver.resolve;if(G=d(K?U(K,G):G),S.has(G))throw I(G);S.add(G);let z=this.refs[G];return typeof z=="string"&&(z=this.refs[z]),typeof z=="object"?T(L,z.schema,G):G!==d(j)&&(G[0]==="#"?(T(L,x[G],G),x[G]=L):this.refs[G]=j),G}function Y(G){if(typeof G=="string"){if(!h.test(G))throw new Error(`invalid anchor "${G}"`);J.call(this,`#${G}`)}}}),x;function T(L,N,P){if(N!==void 0&&!e(L,N))throw I(P)}function I(L){return new Error(`reference "${L}" resolves to more than one schema`)}}return nn.getSchemaRefs=p,nn}var Cv;function Hd(){if(Cv)return Cr;Cv=1,Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.getData=Cr.KeywordCxt=Cr.validateFunctionCode=void 0;const t=Z9(),e=Xu(),n=hT(),r=Xu(),o=J9(),s=X9(),i=Q9(),a=We(),l=Ao(),c=Vd(),u=Ze(),d=Bd();function f(C){if(v(C)&&(S(C),k(C))){g(C);return}h(C,()=>(0,t.topBoolOrEmptySchema)(C))}Cr.validateFunctionCode=f;function h({gen:C,validateName:O,schema:F,schemaEnv:W,opts:X},ee){X.code.es5?C.func(O,(0,a._)`${l.default.data}, ${l.default.valCxt}`,W.$async,()=>{C.code((0,a._)`"use strict"; ${b(F,X)}`),m(C,X),C.code(ee)}):C.func(O,(0,a._)`${l.default.data}, ${p(X)}`,W.$async,()=>C.code(b(F,X)).code(ee))}function p(C){return(0,a._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${C.dynamicRef?(0,a._)`, ${l.default.dynamicAnchors}={}`:a.nil}}={}`}function m(C,O){C.if(l.default.valCxt,()=>{C.var(l.default.instancePath,(0,a._)`${l.default.valCxt}.${l.default.instancePath}`),C.var(l.default.parentData,(0,a._)`${l.default.valCxt}.${l.default.parentData}`),C.var(l.default.parentDataProperty,(0,a._)`${l.default.valCxt}.${l.default.parentDataProperty}`),C.var(l.default.rootData,(0,a._)`${l.default.valCxt}.${l.default.rootData}`),O.dynamicRef&&C.var(l.default.dynamicAnchors,(0,a._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{C.var(l.default.instancePath,(0,a._)`""`),C.var(l.default.parentData,(0,a._)`undefined`),C.var(l.default.parentDataProperty,(0,a._)`undefined`),C.var(l.default.rootData,l.default.data),O.dynamicRef&&C.var(l.default.dynamicAnchors,(0,a._)`{}`)})}function g(C){const{schema:O,opts:F,gen:W}=C;h(C,()=>{F.$comment&&O.$comment&&A(C),L(C),W.let(l.default.vErrors,null),W.let(l.default.errors,0),F.unevaluated&&y(C),T(C),j(C)})}function y(C){const{gen:O,validateName:F}=C;C.evaluated=O.const("evaluated",(0,a._)`${F}.evaluated`),O.if((0,a._)`${C.evaluated}.dynamicProps`,()=>O.assign((0,a._)`${C.evaluated}.props`,(0,a._)`undefined`)),O.if((0,a._)`${C.evaluated}.dynamicItems`,()=>O.assign((0,a._)`${C.evaluated}.items`,(0,a._)`undefined`))}function b(C,O){const F=typeof C=="object"&&C[O.schemaId];return F&&(O.code.source||O.code.process)?(0,a._)`/*# sourceURL=${F} */`:a.nil}function w(C,O){if(v(C)&&(S(C),k(C))){x(C,O);return}(0,t.boolOrEmptySchema)(C,O)}function k({schema:C,self:O}){if(typeof C=="boolean")return!C;for(const F in C)if(O.RULES.all[F])return!0;return!1}function v(C){return typeof C.schema!="boolean"}function x(C,O){const{schema:F,gen:W,opts:X}=C;X.$comment&&F.$comment&&A(C),N(C),P(C);const ee=W.const("_errs",l.default.errors);T(C,ee),W.var(O,(0,a._)`${ee} === ${l.default.errors}`)}function S(C){(0,u.checkUnknownRules)(C),I(C)}function T(C,O){if(C.opts.jtd)return J(C,[],!1,O);const F=(0,e.getSchemaTypes)(C.schema),W=(0,e.coerceAndCheckDataType)(C,F);J(C,F,!W,O)}function I(C){const{schema:O,errSchemaPath:F,opts:W,self:X}=C;O.$ref&&W.ignoreKeywordsWithRef&&(0,u.schemaHasRulesButRef)(O,X.RULES)&&X.logger.warn(`$ref: keywords ignored in schema at path "${F}"`)}function L(C){const{schema:O,opts:F}=C;O.default!==void 0&&F.useDefaults&&F.strictSchema&&(0,u.checkStrictMode)(C,"default is ignored in the schema root")}function N(C){const O=C.schema[C.opts.schemaId];O&&(C.baseId=(0,c.resolveUrl)(C.opts.uriResolver,C.baseId,O))}function P(C){if(C.schema.$async&&!C.schemaEnv.$async)throw new Error("async schema in sync schema")}function A({gen:C,schemaEnv:O,schema:F,errSchemaPath:W,opts:X}){const ee=F.$comment;if(X.$comment===!0)C.code((0,a._)`${l.default.self}.logger.log(${ee})`);else if(typeof X.$comment=="function"){const ne=(0,a.str)`${W}/$comment`,oe=C.scopeValue("root",{ref:O.root});C.code((0,a._)`${l.default.self}.opts.$comment(${ee}, ${ne}, ${oe}.schema)`)}}function j(C){const{gen:O,schemaEnv:F,validateName:W,ValidationError:X,opts:ee}=C;F.$async?O.if((0,a._)`${l.default.errors} === 0`,()=>O.return(l.default.data),()=>O.throw((0,a._)`new ${X}(${l.default.vErrors})`)):(O.assign((0,a._)`${W}.errors`,l.default.vErrors),ee.unevaluated&&K(C),O.return((0,a._)`${l.default.errors} === 0`))}function K({gen:C,evaluated:O,props:F,items:W}){F instanceof a.Name&&C.assign((0,a._)`${O}.props`,F),W instanceof a.Name&&C.assign((0,a._)`${O}.items`,W)}function J(C,O,F,W){const{gen:X,schema:ee,data:ne,allErrors:oe,opts:re,self:ae}=C,{RULES:te}=ae;if(ee.$ref&&(re.ignoreKeywordsWithRef||!(0,u.schemaHasRulesButRef)(ee,te))){X.block(()=>Z(C,"$ref",te.all.$ref.definition));return}re.jtd||G(C,O),X.block(()=>{for(const ye of te.rules)fe(ye);fe(te.post)});function fe(ye){(0,n.shouldUseGroup)(ee,ye)&&(ye.type?(X.if((0,r.checkDataType)(ye.type,ne,re.strictNumbers)),Y(C,ye),O.length===1&&O[0]===ye.type&&F&&(X.else(),(0,r.reportTypeError)(C)),X.endIf()):Y(C,ye),oe||X.if((0,a._)`${l.default.errors} === ${W||0}`))}}function Y(C,O){const{gen:F,schema:W,opts:{useDefaults:X}}=C;X&&(0,o.assignDefaults)(C,O.type),F.block(()=>{for(const ee of O.rules)(0,n.shouldUseRule)(W,ee)&&Z(C,ee.keyword,ee.definition,O.type)})}function G(C,O){C.schemaEnv.meta||!C.opts.strictTypes||(U(C,O),C.opts.allowUnionTypes||z(C,O),B(C,C.dataTypes))}function U(C,O){if(O.length){if(!C.dataTypes.length){C.dataTypes=O;return}O.forEach(F=>{V(C.dataTypes,F)||D(C,`type "${F}" not allowed by context "${C.dataTypes.join(",")}"`)}),R(C,O)}}function z(C,O){O.length>1&&!(O.length===2&&O.includes("null"))&&D(C,"use allowUnionTypes to allow union type keyword")}function B(C,O){const F=C.self.RULES.all;for(const W in F){const X=F[W];if(typeof X=="object"&&(0,n.shouldUseRule)(C.schema,X)){const{type:ee}=X.definition;ee.length&&!ee.some(ne=>H(O,ne))&&D(C,`missing type "${ee.join(",")}" for keyword "${W}"`)}}}function H(C,O){return C.includes(O)||O==="number"&&C.includes("integer")}function V(C,O){return C.includes(O)||O==="integer"&&C.includes("number")}function R(C,O){const F=[];for(const W of C.dataTypes)V(O,W)?F.push(W):O.includes("integer")&&W==="number"&&F.push("integer");C.dataTypes=F}function D(C,O){const F=C.schemaEnv.baseId+C.errSchemaPath;O+=` at "${F}" (strictTypes)`,(0,u.checkStrictMode)(C,O,C.opts.strictTypes)}class ${constructor(O,F,W){if((0,s.validateKeywordUsage)(O,F,W),this.gen=O.gen,this.allErrors=O.allErrors,this.keyword=W,this.data=O.data,this.schema=O.schema[W],this.$data=F.$data&&O.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,u.schemaRefOrVal)(O,this.schema,W,this.$data),this.schemaType=F.schemaType,this.parentSchema=O.schema,this.params={},this.it=O,this.def=F,this.$data)this.schemaCode=O.gen.const("vSchema",q(this.$data,O));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,F.schemaType,F.allowUndefined))throw new Error(`${W} value must be ${JSON.stringify(F.schemaType)}`);("code"in F?F.trackErrors:F.errors!==!1)&&(this.errsCount=O.gen.const("_errs",l.default.errors))}result(O,F,W){this.failResult((0,a.not)(O),F,W)}failResult(O,F,W){this.gen.if(O),W?W():this.error(),F?(this.gen.else(),F(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(O,F){this.failResult((0,a.not)(O),void 0,F)}fail(O){if(O===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(O),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(O){if(!this.$data)return this.fail(O);const{schemaCode:F}=this;this.fail((0,a._)`${F} !== undefined && (${(0,a.or)(this.invalid$data(),O)})`)}error(O,F,W){if(F){this.setParams(F),this._error(O,W),this.setParams({});return}this._error(O,W)}_error(O,F){(O?d.reportExtraError:d.reportError)(this,this.def.error,F)}$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(O){this.allErrors||this.gen.if(O)}setParams(O,F){F?Object.assign(this.params,O):this.params=O}block$data(O,F,W=a.nil){this.gen.block(()=>{this.check$data(O,W),F()})}check$data(O=a.nil,F=a.nil){if(!this.$data)return;const{gen:W,schemaCode:X,schemaType:ee,def:ne}=this;W.if((0,a.or)((0,a._)`${X} === undefined`,F)),O!==a.nil&&W.assign(O,!0),(ee.length||ne.validateSchema)&&(W.elseIf(this.invalid$data()),this.$dataError(),O!==a.nil&&W.assign(O,!1)),W.else()}invalid$data(){const{gen:O,schemaCode:F,schemaType:W,def:X,it:ee}=this;return(0,a.or)(ne(),oe());function ne(){if(W.length){if(!(F instanceof a.Name))throw new Error("ajv implementation error");const re=Array.isArray(W)?W:[W];return(0,a._)`${(0,r.checkDataTypes)(re,F,ee.opts.strictNumbers,r.DataType.Wrong)}`}return a.nil}function oe(){if(X.validateSchema){const re=O.scopeValue("validate$data",{ref:X.validateSchema});return(0,a._)`!${re}(${F})`}return a.nil}}subschema(O,F){const W=(0,i.getSubschema)(this.it,O);(0,i.extendSubschemaData)(W,this.it,O),(0,i.extendSubschemaMode)(W,O);const X={...this.it,...W,items:void 0,props:void 0};return w(X,F),X}mergeEvaluated(O,F){const{it:W,gen:X}=this;W.opts.unevaluated&&(W.props!==!0&&O.props!==void 0&&(W.props=u.mergeEvaluated.props(X,O.props,W.props,F)),W.items!==!0&&O.items!==void 0&&(W.items=u.mergeEvaluated.items(X,O.items,W.items,F)))}mergeValidEvaluated(O,F){const{it:W,gen:X}=this;if(W.opts.unevaluated&&(W.props!==!0||W.items!==!0))return X.if(F,()=>this.mergeEvaluated(O,a.Name)),!0}}Cr.KeywordCxt=$;function Z(C,O,F,W){const X=new $(C,F,O);"code"in F?F.code(X,W):X.$data&&F.validate?(0,s.funcKeywordCode)(X,F):"macro"in F?(0,s.macroKeywordCode)(X,F):(F.compile||F.validate)&&(0,s.funcKeywordCode)(X,F)}const Q=/^\/(?:[^~]|~0|~1)*$/,_=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function q(C,{dataLevel:O,dataNames:F,dataPathArr:W}){let X,ee;if(C==="")return l.default.rootData;if(C[0]==="/"){if(!Q.test(C))throw new Error(`Invalid JSON-pointer: ${C}`);X=C,ee=l.default.rootData}else{const ae=_.exec(C);if(!ae)throw new Error(`Invalid JSON-pointer: ${C}`);const te=+ae[1];if(X=ae[2],X==="#"){if(te>=O)throw new Error(re("property/index",te));return W[O-te]}if(te>O)throw new Error(re("data",te));if(ee=F[O-te],!X)return ee}let ne=ee;const oe=X.split("/");for(const ae of oe)ae&&(ee=(0,a._)`${ee}${(0,a.getProperty)((0,u.unescapeJsonPointer)(ae))}`,ne=(0,a._)`${ne} && ${ee}`);return ne;function re(ae,te){return`Cannot access ${ae} ${te} levels up, current level is ${O}`}}return Cr.getData=q,Cr}var Hl={},Tv;function kg(){if(Tv)return Hl;Tv=1,Object.defineProperty(Hl,"__esModule",{value:!0});class t extends Error{constructor(n){super("validation failed"),this.errors=n,this.ajv=this.validation=!0}}return Hl.default=t,Hl}var Wl={},Mv;function Wd(){if(Mv)return Wl;Mv=1,Object.defineProperty(Wl,"__esModule",{value:!0});const t=Vd();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 Wl.default=e,Wl}var wn={},Rv;function xg(){if(Rv)return wn;Rv=1,Object.defineProperty(wn,"__esModule",{value:!0}),wn.resolveSchema=wn.getCompilingSchema=wn.resolveRef=wn.compileSchema=wn.SchemaEnv=void 0;const t=We(),e=kg(),n=Ao(),r=Vd(),o=Ze(),s=Hd();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={}}}wn.SchemaEnv=i;function a(g){const y=u.call(this,g);if(y)return y;const b=(0,r.getFullPath)(this.opts.uriResolver,g.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 S;g.$async&&(S=x.scopeValue("Error",{ref:e.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));const T=x.scopeName("validate");g.validateName=T;const I={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:g.schema,code:(0,t.stringify)(g.schema)}:{ref:g.schema}),validateName:T,ValidationError:S,schema:g.schema,schemaEnv:g,rootId:b,baseId:g.baseId||b,schemaPath:t.nil,errSchemaPath:g.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this};let L;try{this._compilations.add(g),(0,s.validateFunctionCode)(I),x.optimize(this.opts.code.optimize);const N=x.toString();L=`${x.scopeRefs(n.default.scope)}return ${N}`,this.opts.code.process&&(L=this.opts.code.process(L,g));const A=new Function(`${n.default.self}`,`${n.default.scope}`,L)(this,this.scope.get());if(this.scope.value(T,{ref:A}),A.errors=null,A.schema=g.schema,A.schemaEnv=g,g.$async&&(A.$async=!0),this.opts.code.source===!0&&(A.source={validateName:T,validateCode:N,scopeValues:x._values}),this.opts.unevaluated){const{props:j,items:K}=I;A.evaluated={props:j instanceof t.Name?void 0:j,items:K instanceof t.Name?void 0:K,dynamicProps:j instanceof t.Name,dynamicItems:K instanceof t.Name},A.source&&(A.source.evaluated=(0,t.stringify)(A.evaluated))}return g.validate=A,g}catch(N){throw delete g.validate,delete g.validateName,L&&this.logger.error("Error compiling schema, function code:",L),N}finally{this._compilations.delete(g)}}wn.compileSchema=a;function l(g,y,b){var w;b=(0,r.resolveUrl)(this.opts.uriResolver,y,b);const k=g.refs[b];if(k)return k;let v=f.call(this,g,b);if(v===void 0){const x=(w=g.localRefs)===null||w===void 0?void 0:w[b],{schemaId:S}=this.opts;x&&(v=new i({schema:x,schemaId:S,root:g,baseId:y}))}if(v!==void 0)return g.refs[b]=c.call(this,v)}wn.resolveRef=l;function c(g){return(0,r.inlineRef)(g.schema,this.opts.inlineRefs)?g.schema:g.validate?g:a.call(this,g)}function u(g){for(const y of this._compilations)if(d(y,g))return y}wn.getCompilingSchema=u;function d(g,y){return g.schema===y.schema&&g.root===y.root&&g.baseId===y.baseId}function f(g,y){let b;for(;typeof(b=this.refs[y])=="string";)y=b;return b||this.schemas[y]||h.call(this,g,y)}function h(g,y){const b=this.opts.uriResolver.parse(y),w=(0,r._getFullPath)(this.opts.uriResolver,b);let k=(0,r.getFullPath)(this.opts.uriResolver,g.baseId,void 0);if(Object.keys(g.schema).length>0&&w===k)return m.call(this,b,g);const v=(0,r.normalizeId)(w),x=this.refs[v]||this.schemas[v];if(typeof x=="string"){const S=h.call(this,g,x);return typeof S?.schema!="object"?void 0:m.call(this,b,S)}if(typeof x?.schema=="object"){if(x.validate||a.call(this,x),v===(0,r.normalizeId)(y)){const{schema:S}=x,{schemaId:T}=this.opts,I=S[T];return I&&(k=(0,r.resolveUrl)(this.opts.uriResolver,k,I)),new i({schema:S,schemaId:T,root:g,baseId:k})}return m.call(this,b,x)}}wn.resolveSchema=h;const p=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function m(g,{baseId:y,schema:b,root:w}){var k;if(((k=g.fragment)===null||k===void 0?void 0:k[0])!=="/")return;for(const S of g.fragment.slice(1).split("/")){if(typeof b=="boolean")return;const T=b[(0,o.unescapeFragment)(S)];if(T===void 0)return;b=T;const I=typeof b=="object"&&b[this.opts.schemaId];!p.has(S)&&I&&(y=(0,r.resolveUrl)(this.opts.uriResolver,y,I))}let v;if(typeof b!="boolean"&&b.$ref&&!(0,o.schemaHasRulesButRef)(b,this.RULES)){const S=(0,r.resolveUrl)(this.opts.uriResolver,y,b.$ref);v=h.call(this,w,S)}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 wn}const tU="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",nU="Meta-schema for $data reference (JSON AnySchema extension proposal)",rU="object",oU=["$data"],sU={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},iU=!1,aU={$id:tU,description:nU,type:rU,required:oU,properties:sU,additionalProperties:iU};var ql={},Gi={exports:{}},Xf,Ov;function mT(){if(Ov)return Xf;Ov=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,m=0;for(m=0;m<f.length;m++)if(p=f[m].charCodeAt(0),p!==48){if(!(p>=48&&p<=57||p>=65&&p<=70||p>=97&&p<=102))return"";h+=f[m];break}for(m+=1;m<f.length;m++){if(p=f[m].charCodeAt(0),!(p>=48&&p<=57||p>=65&&p<=70||p>=97&&p<=102))return"";h+=f[m]}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 m=n(f);if(m!=="")h.push(m);else return p.error=!0,!1;f.length=0}return!0}function i(f){let h=0;const p={error:!1,address:"",zone:""},m=[],g=[];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(g,m,p))break;if(++h>7){p.error=!0;break}k>0&&f[k-1]===":"&&(y=!0),m.push(":");continue}else if(v==="%"){if(!w(g,m,p))break;w=o}else{g.push(v);continue}}return g.length&&(w===o?p.zone=g.join(""):b?m.push(g.join("")):m.push(n(g))),p.address=m.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,m=h.address;return h.zone&&(p+="%"+h.zone,m+="%25"+h.zone),{host:p,isIPV6:!0,escapedHost:m}}}function l(f,h){let p=0;for(let m=0;m<f.length;m++)f[m]===h&&p++;return p}function c(f){let h=f;const p=[];let m=-1,g=0;for(;g=h.length;){if(g===1){if(h===".")break;if(h==="/"){p.push("/");break}else{p.push(h);break}}else if(g===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(g===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((m=h.indexOf("/",1))===-1){p.push(h);break}else p.push(h.slice(0,m)),h=h.slice(m)}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 m=a(p);m.isIPV6===!0?p=`[${m.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 Xf={nonSimpleDomain:r,recomposeAuthority:d,normalizeComponentEncoding:u,removeDotSegments:c,isIPv4:e,isUUID:t,normalizeIPv6:a,stringArrayToHexStripped:n},Xf}var Qf,Nv;function lU(){if(Nv)return Qf;Nv=1;const{isUUID:t}=mT(),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,S]=v.resourceName.split("?");v.path=x&&x!=="/"?x:void 0,v.query=S,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 S=v.path.match(e);if(S){const T=x.scheme||v.scheme||"urn";v.nid=S[1].toLowerCase(),v.nss=S[2];const I=`${T}:${x.nid||v.nid}`,L=k(I);v.path=void 0,L&&(v=L.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 S=x.scheme||v.scheme||"urn",T=v.nid.toLowerCase(),I=`${S}:${x.nid||T}`,L=k(I);L&&(v=L.serialize(v,x));const N=v,P=v.nss;return N.path=`${T||x.nid}:${P}`,x.skipEscape=!0,N}function d(v,x){const S=v;return S.uuid=S.nss,S.nss=void 0,!x.tolerant&&(!S.uuid||!t(S.uuid))&&(S.error=S.error||"UUID is not valid."),S}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},m={scheme:"ws",domainHost:!0,parse:a,serialize:l},g={scheme:"wss",domainHost:m.domainHost,parse:m.parse,serialize:m.serialize},w={http:h,https:p,ws:m,wss:g,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 Qf={wsIsSecure:o,SCHEMES:w,isValidSchemeName:r,getSchemeHandler:k},Qf}var _v;function cU(){if(_v)return Gi.exports;_v=1;const{normalizeIPv6:t,removeDotSegments:e,recomposeAuthority:n,normalizeComponentEncoding:r,isIPv4:o,nonSimpleDomain:s}=mT(),{SCHEMES:i,getSchemeHandler:a}=lU();function l(g,y){return typeof g=="string"?g=f(p(g,y),y):typeof g=="object"&&(g=p(f(g,y),y)),g}function c(g,y,b){const w=b?Object.assign({scheme:"null"},b):{scheme:"null"},k=u(p(g,w),p(y,w),w,!0);return w.skipEscape=!0,f(k,w)}function u(g,y,b,w){const k={};return w||(g=p(f(g,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):((g.userinfo!==void 0||g.host!==void 0||g.port!==void 0)&&!g.path?k.path="/"+y.path:g.path?k.path=g.path.slice(0,g.path.lastIndexOf("/")+1)+y.path:k.path=y.path,k.path=e(k.path)),k.query=y.query):(k.path=g.path,y.query!==void 0?k.query=y.query:k.query=g.query),k.userinfo=g.userinfo,k.host=g.host,k.port=g.port),k.scheme=g.scheme),k.fragment=y.fragment,k}function d(g,y,b){return typeof g=="string"?(g=unescape(g),g=f(r(p(g,b),!0),{...b,skipEscape:!0})):typeof g=="object"&&(g=f(r(g,!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})),g.toLowerCase()===y.toLowerCase()}function f(g,y){const b={host:g.host,scheme:g.scheme,userinfo:g.userinfo,port:g.port,path:g.path,query:g.query,nid:g.nid,nss:g.nss,uuid:g.uuid,fragment:g.fragment,reference:g.reference,resourceName:g.resourceName,secure:g.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 S=b.path;!w.absolutePath&&(!v||!v.absolutePath)&&(S=e(S)),x===void 0&&S[0]==="/"&&S[1]==="/"&&(S="/%2F"+S.slice(2)),k.push(S)}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(g,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?g=b.scheme+":"+g:g="//"+g);const v=g.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 T=t(w.host);w.host=T.host.toLowerCase(),k=T.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(S){w.error=w.error||"Host's domain name can not be converted to ASCII: "+S}(!x||x&&!x.skipNormalize)&&(g.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 m={SCHEMES:i,normalize:l,resolve:c,resolveComponent:u,equal:d,serialize:f,parse:p};return Gi.exports=m,Gi.exports.default=m,Gi.exports.fastUri=m,Gi.exports}var Pv;function uU(){if(Pv)return ql;Pv=1,Object.defineProperty(ql,"__esModule",{value:!0});const t=cU();return t.code='require("ajv/dist/runtime/uri").default',ql.default=t,ql}var Av;function dU(){return Av||(Av=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=Hd();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var n=We();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=kg(),o=Wd(),s=fT(),i=xg(),a=We(),l=Vd(),c=Xu(),u=Ze(),d=aU,f=uU(),h=(z,B)=>new RegExp(z,B);h.code="new RegExp";const p=["removeAdditional","useDefaults","coerceTypes"],m=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={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(z){var B,H,V,R,D,$,Z,Q,_,q,C,O,F,W,X,ee,ne,oe,re,ae,te,fe,ye,he,qe;const Ye=z.strict,st=(B=z.code)===null||B===void 0?void 0:B.optimize,Ae=st===!0||st===void 0?1:st||0,_e=(V=(H=z.code)===null||H===void 0?void 0:H.regExp)!==null&&V!==void 0?V:h,Ue=(R=z.uriResolver)!==null&&R!==void 0?R:f.default;return{strictSchema:($=(D=z.strictSchema)!==null&&D!==void 0?D:Ye)!==null&&$!==void 0?$:!0,strictNumbers:(Q=(Z=z.strictNumbers)!==null&&Z!==void 0?Z:Ye)!==null&&Q!==void 0?Q:!0,strictTypes:(q=(_=z.strictTypes)!==null&&_!==void 0?_:Ye)!==null&&q!==void 0?q:"log",strictTuples:(O=(C=z.strictTuples)!==null&&C!==void 0?C:Ye)!==null&&O!==void 0?O:"log",strictRequired:(W=(F=z.strictRequired)!==null&&F!==void 0?F:Ye)!==null&&W!==void 0?W:!1,code:z.code?{...z.code,optimize:Ae,regExp:_e}:{optimize:Ae,regExp:_e},loopRequired:(X=z.loopRequired)!==null&&X!==void 0?X:b,loopEnum:(ee=z.loopEnum)!==null&&ee!==void 0?ee:b,meta:(ne=z.meta)!==null&&ne!==void 0?ne:!0,messages:(oe=z.messages)!==null&&oe!==void 0?oe:!0,inlineRefs:(re=z.inlineRefs)!==null&&re!==void 0?re:!0,schemaId:(ae=z.schemaId)!==null&&ae!==void 0?ae:"$id",addUsedSchema:(te=z.addUsedSchema)!==null&&te!==void 0?te:!0,validateSchema:(fe=z.validateSchema)!==null&&fe!==void 0?fe:!0,validateFormats:(ye=z.validateFormats)!==null&&ye!==void 0?ye:!0,unicodeRegExp:(he=z.unicodeRegExp)!==null&&he!==void 0?he:!0,int32range:(qe=z.int32range)!==null&&qe!==void 0?qe:!0,uriResolver:Ue}}class k{constructor(B={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,B=this.opts={...B,...w(B)};const{es5:H,lines:V}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:m,es5:H,lines:V}),this.logger=P(B.logger);const R=B.validateFormats;B.validateFormats=!1,this.RULES=(0,s.getRules)(),v.call(this,g,B,"NOT SUPPORTED"),v.call(this,y,B,"DEPRECATED","warn"),this._metaOpts=L.call(this),B.formats&&T.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),B.keywords&&I.call(this,B.keywords),typeof B.meta=="object"&&this.addMetaSchema(B.meta),S.call(this),B.validateFormats=R}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:B,meta:H,schemaId:V}=this.opts;let R=d;V==="id"&&(R={...d},R.id=R.$id,delete R.$id),H&&B&&this.addMetaSchema(R,R[V],!1)}defaultMeta(){const{meta:B,schemaId:H}=this.opts;return this.opts.defaultMeta=typeof B=="object"?B[H]||B:void 0}validate(B,H){let V;if(typeof B=="string"){if(V=this.getSchema(B),!V)throw new Error(`no schema with key or ref "${B}"`)}else V=this.compile(B);const R=V(H);return"$async"in V||(this.errors=V.errors),R}compile(B,H){const V=this._addSchema(B,H);return V.validate||this._compileSchemaEnv(V)}compileAsync(B,H){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:V}=this.opts;return R.call(this,B,H);async function R(q,C){await D.call(this,q.$schema);const O=this._addSchema(q,C);return O.validate||$.call(this,O)}async function D(q){q&&!this.getSchema(q)&&await R.call(this,{$ref:q},!0)}async function $(q){try{return this._compileSchemaEnv(q)}catch(C){if(!(C instanceof o.default))throw C;return Z.call(this,C),await Q.call(this,C.missingSchema),$.call(this,q)}}function Z({missingSchema:q,missingRef:C}){if(this.refs[q])throw new Error(`AnySchema ${q} is loaded but ${C} cannot be resolved`)}async function Q(q){const C=await _.call(this,q);this.refs[q]||await D.call(this,C.$schema),this.refs[q]||this.addSchema(C,q,H)}async function _(q){const C=this._loading[q];if(C)return C;try{return await(this._loading[q]=V(q))}finally{delete this._loading[q]}}}addSchema(B,H,V,R=this.opts.validateSchema){if(Array.isArray(B)){for(const $ of B)this.addSchema($,void 0,V,R);return this}let D;if(typeof B=="object"){const{schemaId:$}=this.opts;if(D=B[$],D!==void 0&&typeof D!="string")throw new Error(`schema ${$} must be string`)}return H=(0,l.normalizeId)(H||D),this._checkUnique(H),this.schemas[H]=this._addSchema(B,V,H,R,!0),this}addMetaSchema(B,H,V=this.opts.validateSchema){return this.addSchema(B,H,!0,V),this}validateSchema(B,H){if(typeof B=="boolean")return!0;let V;if(V=B.$schema,V!==void 0&&typeof V!="string")throw new Error("$schema must be a string");if(V=V||this.opts.defaultMeta||this.defaultMeta(),!V)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const R=this.validate(V,B);if(!R&&H){const D="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(D);else throw new Error(D)}return R}getSchema(B){let H;for(;typeof(H=x.call(this,B))=="string";)B=H;if(H===void 0){const{schemaId:V}=this.opts,R=new i.SchemaEnv({schema:{},schemaId:V});if(H=i.resolveSchema.call(this,R,B),!H)return;this.refs[B]=H}return H.validate||this._compileSchemaEnv(H)}removeSchema(B){if(B instanceof RegExp)return this._removeAllSchemas(this.schemas,B),this._removeAllSchemas(this.refs,B),this;switch(typeof B){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const H=x.call(this,B);return typeof H=="object"&&this._cache.delete(H.schema),delete this.schemas[B],delete this.refs[B],this}case"object":{const H=B;this._cache.delete(H);let V=B[this.opts.schemaId];return V&&(V=(0,l.normalizeId)(V),delete this.schemas[V],delete this.refs[V]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(B){for(const H of B)this.addKeyword(H);return this}addKeyword(B,H){let V;if(typeof B=="string")V=B,typeof H=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),H.keyword=V);else if(typeof B=="object"&&H===void 0){if(H=B,V=H.keyword,Array.isArray(V)&&!V.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(j.call(this,V,H),!H)return(0,u.eachItem)(V,D=>K.call(this,D)),this;Y.call(this,H);const R={...H,type:(0,c.getJSONTypes)(H.type),schemaType:(0,c.getJSONTypes)(H.schemaType)};return(0,u.eachItem)(V,R.type.length===0?D=>K.call(this,D,R):D=>R.type.forEach($=>K.call(this,D,R,$))),this}getKeyword(B){const H=this.RULES.all[B];return typeof H=="object"?H.definition:!!H}removeKeyword(B){const{RULES:H}=this;delete H.keywords[B],delete H.all[B];for(const V of H.rules){const R=V.rules.findIndex(D=>D.keyword===B);R>=0&&V.rules.splice(R,1)}return this}addFormat(B,H){return typeof H=="string"&&(H=new RegExp(H)),this.formats[B]=H,this}errorsText(B=this.errors,{separator:H=", ",dataVar:V="data"}={}){return!B||B.length===0?"No errors":B.map(R=>`${V}${R.instancePath} ${R.message}`).reduce((R,D)=>R+H+D)}$dataMetaSchema(B,H){const V=this.RULES.all;B=JSON.parse(JSON.stringify(B));for(const R of H){const D=R.split("/").slice(1);let $=B;for(const Z of D)$=$[Z];for(const Z in V){const Q=V[Z];if(typeof Q!="object")continue;const{$data:_}=Q.definition,q=$[Z];_&&q&&($[Z]=U(q))}}return B}_removeAllSchemas(B,H){for(const V in B){const R=B[V];(!H||H.test(V))&&(typeof R=="string"?delete B[V]:R&&!R.meta&&(this._cache.delete(R.schema),delete B[V]))}}_addSchema(B,H,V,R=this.opts.validateSchema,D=this.opts.addUsedSchema){let $;const{schemaId:Z}=this.opts;if(typeof B=="object")$=B[Z];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof B!="boolean")throw new Error("schema must be object or boolean")}let Q=this._cache.get(B);if(Q!==void 0)return Q;V=(0,l.normalizeId)($||V);const _=l.getSchemaRefs.call(this,B,V);return Q=new i.SchemaEnv({schema:B,schemaId:Z,meta:H,baseId:V,localRefs:_}),this._cache.set(Q.schema,Q),D&&!V.startsWith("#")&&(V&&this._checkUnique(V),this.refs[V]=Q),R&&this.validateSchema(B,!0),Q}_checkUnique(B){if(this.schemas[B]||this.refs[B])throw new Error(`schema with key or id "${B}" already exists`)}_compileSchemaEnv(B){if(B.meta?this._compileMetaSchema(B):i.compileSchema.call(this,B),!B.validate)throw new Error("ajv implementation error");return B.validate}_compileMetaSchema(B){const H=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,B)}finally{this.opts=H}}}k.ValidationError=r.default,k.MissingRefError=o.default,t.default=k;function v(z,B,H,V="error"){for(const R in z){const D=R;D in B&&this.logger[V](`${H}: option ${R}. ${z[D]}`)}}function x(z){return z=(0,l.normalizeId)(z),this.schemas[z]||this.refs[z]}function S(){const z=this.opts.schemas;if(z)if(Array.isArray(z))this.addSchema(z);else for(const B in z)this.addSchema(z[B],B)}function T(){for(const z in this.opts.formats){const B=this.opts.formats[z];B&&this.addFormat(z,B)}}function I(z){if(Array.isArray(z)){this.addVocabulary(z);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const B in z){const H=z[B];H.keyword||(H.keyword=B),this.addKeyword(H)}}function L(){const z={...this.opts};for(const B of p)delete z[B];return z}const N={log(){},warn(){},error(){}};function P(z){if(z===!1)return N;if(z===void 0)return console;if(z.log&&z.warn&&z.error)return z;throw new Error("logger must implement log, warn and error methods")}const A=/^[a-z_$][a-z0-9_$:-]*$/i;function j(z,B){const{RULES:H}=this;if((0,u.eachItem)(z,V=>{if(H.keywords[V])throw new Error(`Keyword ${V} is already defined`);if(!A.test(V))throw new Error(`Keyword ${V} has invalid name`)}),!!B&&B.$data&&!("code"in B||"validate"in B))throw new Error('$data keyword must have "code" or "validate" function')}function K(z,B,H){var V;const R=B?.post;if(H&&R)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:D}=this;let $=R?D.post:D.rules.find(({type:Q})=>Q===H);if($||($={type:H,rules:[]},D.rules.push($)),D.keywords[z]=!0,!B)return;const Z={keyword:z,definition:{...B,type:(0,c.getJSONTypes)(B.type),schemaType:(0,c.getJSONTypes)(B.schemaType)}};B.before?J.call(this,$,Z,B.before):$.rules.push(Z),D.all[z]=Z,(V=B.implements)===null||V===void 0||V.forEach(Q=>this.addKeyword(Q))}function J(z,B,H){const V=z.rules.findIndex(R=>R.keyword===H);V>=0?z.rules.splice(V,0,B):(z.rules.push(B),this.logger.warn(`rule ${H} is not defined`))}function Y(z){let{metaSchema:B}=z;B!==void 0&&(z.$data&&this.opts.$data&&(B=U(B)),z.validateSchema=this.compile(B,!0))}const G={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function U(z){return{anyOf:[z,G]}}})(qf)),qf}var Ul={},Kl={},Yl={},Iv;function fU(){if(Iv)return Yl;Iv=1,Object.defineProperty(Yl,"__esModule",{value:!0});const t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return Yl.default=t,Yl}var Gr={},$v;function hU(){if($v)return Gr;$v=1,Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.callRef=Gr.getValidate=void 0;const t=Wd(),e=Jn(),n=We(),r=Ao(),o=xg(),s=Ze(),i={keyword:"$ref",schemaType:"string",code(c){const{gen:u,schema:d,it:f}=c,{baseId:h,schemaEnv:p,validateName:m,opts:g,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,m,p,p.$async);const S=u.scopeValue("root",{ref:b});return l(c,(0,n._)`${S}.validate`,b,b.$async)}function v(S){const T=a(c,S);l(c,T,S,S.$async)}function x(S){const T=u.scopeValue("schema",g.code.source===!0?{ref:S,code:(0,n.stringify)(S)}:{ref:S}),I=u.name("valid"),L=c.subschema({schema:S,dataTypes:[],schemaPath:n.nil,topSchemaRef:T,errSchemaPath:d},I);c.mergeEvaluated(L),c.ok(I)}}};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`}Gr.getValidate=a;function l(c,u,d,f){const{gen:h,it:p}=c,{allErrors:m,schemaEnv:g,opts:y}=p,b=y.passContext?r.default.this:n.nil;f?w():k();function w(){if(!g.$async)throw new Error("async schema referenced by sync schema");const S=h.let("valid");h.try(()=>{h.code((0,n._)`await ${(0,e.callValidateCode)(c,u,b)}`),x(u),m||h.assign(S,!0)},T=>{h.if((0,n._)`!(${T} instanceof ${p.ValidationError})`,()=>h.throw(T)),v(T),m||h.assign(S,!1)}),c.ok(S)}function k(){c.result((0,e.callValidateCode)(c,u,b),()=>x(u),()=>v(u))}function v(S){const T=(0,n._)`${S}.errors`;h.assign(r.default.vErrors,(0,n._)`${r.default.vErrors} === null ? ${T} : ${r.default.vErrors}.concat(${T})`),h.assign(r.default.errors,(0,n._)`${r.default.vErrors}.length`)}function x(S){var T;if(!p.opts.unevaluated)return;const I=(T=d?.validate)===null||T===void 0?void 0:T.evaluated;if(p.props!==!0)if(I&&!I.dynamicProps)I.props!==void 0&&(p.props=s.mergeEvaluated.props(h,I.props,p.props));else{const L=h.var("props",(0,n._)`${S}.evaluated.props`);p.props=s.mergeEvaluated.props(h,L,p.props,n.Name)}if(p.items!==!0)if(I&&!I.dynamicItems)I.items!==void 0&&(p.items=s.mergeEvaluated.items(h,I.items,p.items));else{const L=h.var("items",(0,n._)`${S}.evaluated.items`);p.items=s.mergeEvaluated.items(h,L,p.items,n.Name)}}}return Gr.callRef=l,Gr.default=i,Gr}var Dv;function pU(){if(Dv)return Kl;Dv=1,Object.defineProperty(Kl,"__esModule",{value:!0});const t=fU(),e=hU(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,e.default];return Kl.default=n,Kl}var Gl={},Zl={},zv;function mU(){if(zv)return Zl;zv=1,Object.defineProperty(Zl,"__esModule",{value:!0});const t=We(),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 Zl.default=o,Zl}var Jl={},Lv;function gU(){if(Lv)return Jl;Lv=1,Object.defineProperty(Jl,"__esModule",{value:!0});const t=We(),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 Jl.default=n,Jl}var Xl={},Ql={},jv;function yU(){if(jv)return Ql;jv=1,Object.defineProperty(Ql,"__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 Ql.default=t,t.code='require("ajv/dist/runtime/ucs2length").default',Ql}var Fv;function bU(){if(Fv)return Xl;Fv=1,Object.defineProperty(Xl,"__esModule",{value:!0});const t=We(),e=Ze(),n=yU(),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 Xl.default=o,Xl}var ec={},Bv;function vU(){if(Bv)return ec;Bv=1,Object.defineProperty(ec,"__esModule",{value:!0});const t=Jn(),e=Ze(),n=We(),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),m=i.let("valid");i.try(()=>i.assign(m,(0,n._)`${p}(${u}, ${f}).test(${a})`),()=>i.assign(m,!1)),s.fail$data((0,n._)`!${m}`)}else{const h=(0,t.usePattern)(s,c);s.fail$data((0,n._)`!${h}.test(${a})`)}}};return ec.default=o,ec}var tc={},Vv;function wU(){if(Vv)return tc;Vv=1,Object.defineProperty(tc,"__esModule",{value:!0});const t=We(),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 tc.default=n,tc}var nc={},Hv;function kU(){if(Hv)return nc;Hv=1,Object.defineProperty(nc,"__esModule",{value:!0});const t=Jn(),e=We(),n=Ze(),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():m(),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,g);else for(const b of a)(0,t.checkReportMissingProp)(s,b)}function m(){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 g(){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 nc.default=o,nc}var rc={},Wv;function xU(){if(Wv)return rc;Wv=1,Object.defineProperty(rc,"__esModule",{value:!0});const t=We(),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 rc.default=n,rc}var oc={},sc={},qv;function Sg(){if(qv)return sc;qv=1,Object.defineProperty(sc,"__esModule",{value:!0});const t=pT();return t.code='require("ajv/dist/runtime/equal").default',sc.default=t,sc}var Uv;function SU(){if(Uv)return oc;Uv=1,Object.defineProperty(oc,"__esModule",{value:!0});const t=Xu(),e=We(),n=Ze(),r=Sg(),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"),m=d.items?(0,t.getSchemaTypes)(d.items):[];i.block$data(p,g,(0,e._)`${f} === false`),i.ok(p);function g(){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 m.length>0&&!m.some(k=>k==="object"||k==="array")}function b(k,v){const x=a.name("item"),S=(0,t.checkDataTypes)(m,x,h.opts.strictNumbers,t.DataType.Wrong),T=a.const("indices",(0,e._)`{}`);a.for((0,e._)`;${k}--;`,()=>{a.let(x,(0,e._)`${l}[${k}]`),a.if(S,(0,e._)`continue`),m.length>1&&a.if((0,e._)`typeof ${x} == "string"`,(0,e._)`${x} += "_"`),a.if((0,e._)`typeof ${T}[${x}] == "number"`,()=>{a.assign(v,(0,e._)`${T}[${x}]`),i.error(),a.assign(p,!1).break()}).code((0,e._)`${T}[${x}] = ${k}`)})}function w(k,v){const x=(0,n.useFunc)(a,r.default),S=a.name("outer");a.label(S).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(S)})))}}};return oc.default=s,oc}var ic={},Kv;function EU(){if(Kv)return ic;Kv=1,Object.defineProperty(ic,"__esModule",{value:!0});const t=We(),e=Ze(),n=Sg(),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 ic.default=o,ic}var ac={},Yv;function CU(){if(Yv)return ac;Yv=1,Object.defineProperty(ac,"__esModule",{value:!0});const t=We(),e=Ze(),n=Sg(),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 m;if(f||l)m=i.let("valid"),s.block$data(m,g);else{if(!Array.isArray(c))throw new Error("ajv implementation error");const b=i.const("vSchema",u);m=(0,t.or)(...c.map((w,k)=>y(b,k)))}s.pass(m);function g(){i.assign(m,!1),i.forOf("v",u,b=>i.if((0,t._)`${p()}(${a}, ${b})`,()=>i.assign(m,!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 ac.default=o,ac}var Gv;function TU(){if(Gv)return Gl;Gv=1,Object.defineProperty(Gl,"__esModule",{value:!0});const t=mU(),e=gU(),n=bU(),r=vU(),o=wU(),s=kU(),i=xU(),a=SU(),l=EU(),c=CU(),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 Gl.default=u,Gl}var lc={},Ls={},Zv;function gT(){if(Zv)return Ls;Zv=1,Object.defineProperty(Ls,"__esModule",{value:!0}),Ls.validateAdditionalItems=void 0;const t=We(),e=Ze(),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,m=>{s.subschema({keyword:u,dataProp:m,dataPropType:e.Type.Num},p),d.allErrors||a.if((0,t.not)(p),()=>a.break())})}}return Ls.validateAdditionalItems=o,Ls.default=r,Ls}var cc={},js={},Jv;function yT(){if(Jv)return js;Jv=1,Object.defineProperty(js,"__esModule",{value:!0}),js.validateTuple=void 0;const t=We(),e=Ze(),n=Jn(),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;m(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((g,y)=>{(0,e.alwaysValidSchema)(f,g)||(l.if((0,t._)`${p} > ${y}`,()=>s.subschema({keyword:d,schemaProp:y,dataProp:y},h)),s.ok(h))});function m(g){const{opts:y,errSchemaPath:b}=f,w=a.length,k=w===g.minItems&&(w===g.maxItems||g[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 js.validateTuple=o,js.default=r,js}var Xv;function MU(){if(Xv)return cc;Xv=1,Object.defineProperty(cc,"__esModule",{value:!0});const t=yT(),e={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:n=>(0,t.validateTuple)(n,"items")};return cc.default=e,cc}var uc={},Qv;function RU(){if(Qv)return uc;Qv=1,Object.defineProperty(uc,"__esModule",{value:!0});const t=We(),e=Ze(),n=Jn(),r=gT(),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 uc.default=s,uc}var dc={},ew;function OU(){if(ew)return dc;ew=1,Object.defineProperty(dc,"__esModule",{value:!0});const t=We(),e=Ze(),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 m=s.name("valid");d===void 0&&u===1?y(m,()=>s.if(m,()=>s.break())):u===0?(s.let(m,!0),d!==void 0&&s.if((0,t._)`${l}.length > 0`,g)):(s.let(m,!1),g()),o.result(m,()=>o.reset());function g(){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(m,!0).break()):(s.if((0,t._)`${w} > ${d}`,()=>s.assign(m,!1).break()),u===1?s.assign(m,!0):s.if((0,t._)`${w} >= ${u}`,()=>s.assign(m,!0)))}}};return dc.default=r,dc}var eh={},tw;function NU(){return tw||(tw=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=We(),n=Ze(),r=Jn();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 m=c[p];if(m.length===0)continue;const g=(0,r.propertyInData)(u,d,p,f.opts.ownProperties);l.setParams({property:p,depsCount:m.length,deps:m.join(", ")}),f.allErrors?u.if(g,()=>{for(const y of m)(0,r.checkReportMissingProp)(l,y)}):(u.if((0,e._)`${g} && (${(0,r.checkMissingProp)(l,m,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 m in c)(0,n.alwaysValidSchema)(h,c[m])||(u.if((0,r.propertyInData)(u,d,m,h.opts.ownProperties),()=>{const g=l.subschema({keyword:f,schemaProp:m},p);l.mergeValidEvaluated(g,p)},()=>u.var(p,!0)),l.ok(p))}t.validateSchemaDeps=a,t.default=o})(eh)),eh}var fc={},nw;function _U(){if(nw)return fc;nw=1,Object.defineProperty(fc,"__esModule",{value:!0});const t=We(),e=Ze(),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 fc.default=r,fc}var hc={},rw;function bT(){if(rw)return hc;rw=1,Object.defineProperty(hc,"__esModule",{value:!0});const t=Jn(),e=We(),n=Ao(),r=Ze(),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 m=(0,t.allSchemaProperties)(c.properties),g=(0,t.allSchemaProperties)(c.patternProperties);y(),i.ok((0,e._)`${d} === ${n.default.errors}`);function y(){a.forIn("key",u,x=>{!m.length&&!g.length?k(x):a.if(b(x),()=>k(x))})}function b(x){let S;if(m.length>8){const T=(0,r.schemaRefOrVal)(f,c.properties,"properties");S=(0,t.isOwnProperty)(a,T,x)}else m.length?S=(0,e.or)(...m.map(T=>(0,e._)`${x} === ${T}`)):S=e.nil;return g.length&&(S=(0,e.or)(S,...g.map(T=>(0,e._)`${(0,t.usePattern)(i,T)}.test(${x})`))),(0,e.not)(S)}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 S=a.name("valid");p.removeAdditional==="failing"?(v(x,S,!1),a.if((0,e.not)(S),()=>{i.reset(),w(x)})):(v(x,S),h||a.if((0,e.not)(S),()=>a.break()))}}function v(x,S,T){const I={keyword:"additionalProperties",dataProp:x,dataPropType:r.Type.Str};T===!1&&Object.assign(I,{compositeRule:!0,createErrors:!1,allErrors:!1}),i.subschema(I,S)}}};return hc.default=s,hc}var pc={},ow;function PU(){if(ow)return pc;ow=1,Object.defineProperty(pc,"__esModule",{value:!0});const t=Hd(),e=Jn(),n=Ze(),r=bT(),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 g of d)u.definedProperties.add(g);u.opts.unevaluated&&d.length&&u.props!==!0&&(u.props=n.mergeEvaluated.props(i,(0,n.toHash)(d),u.props));const f=d.filter(g=>!(0,n.alwaysValidSchema)(u,a[g]));if(f.length===0)return;const h=i.name("valid");for(const g of f)p(g)?m(g):(i.if((0,e.propertyInData)(i,c,g,u.opts.ownProperties)),m(g),u.allErrors||i.else().var(h,!0),i.endIf()),s.it.definedProperties.add(g),s.ok(h);function p(g){return u.opts.useDefaults&&!u.compositeRule&&a[g].default!==void 0}function m(g){s.subschema({keyword:"properties",schemaProp:g,dataProp:g},h)}}};return pc.default=o,pc}var mc={},sw;function AU(){if(sw)return mc;sw=1,Object.defineProperty(mc,"__esModule",{value:!0});const t=Jn(),e=We(),n=Ze(),r=Ze(),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,m=i.name("valid");u.props!==!0&&!(u.props instanceof e.Name)&&(u.props=(0,r.evaluatedPropsToName)(i,u.props));const{props:g}=u;y();function y(){for(const k of f)p&&b(k),u.allErrors?w(k):(i.var(m,!0),w(k),i.if(m))}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},m),u.opts.unevaluated&&g!==!0?i.assign((0,e._)`${g}[${v}]`,!0):!x&&!u.allErrors&&i.if((0,e.not)(m),()=>i.break())})})}}};return mc.default=o,mc}var gc={},iw;function IU(){if(iw)return gc;iw=1,Object.defineProperty(gc,"__esModule",{value:!0});const t=Ze(),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 gc.default=e,gc}var yc={},aw;function $U(){if(aw)return yc;aw=1,Object.defineProperty(yc,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Jn().validateUnion,error:{message:"must match a schema in anyOf"}};return yc.default=e,yc}var bc={},lw;function DU(){if(lw)return bc;lw=1,Object.defineProperty(bc,"__esModule",{value:!0});const t=We(),e=Ze(),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,m)=>{let g;(0,e.alwaysValidSchema)(l,p)?s.var(f,!0):g=o.subschema({keyword:"oneOf",schemaProp:m,compositeRule:!0},f),m>0&&s.if((0,t._)`${f} && ${u}`).assign(u,!1).assign(d,(0,t._)`[${d}, ${m}]`).else(),s.if(f,()=>{s.assign(u,!0),s.assign(d,m),g&&o.mergeEvaluated(g,t.Name)})})}}};return bc.default=r,bc}var vc={},cw;function zU(){if(cw)return vc;cw=1,Object.defineProperty(vc,"__esModule",{value:!0});const t=Ze(),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 vc.default=e,vc}var wc={},uw;function LU(){if(uw)return wc;uw=1,Object.defineProperty(wc,"__esModule",{value:!0});const t=We(),e=Ze(),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 m=i.let("ifClause");s.setParams({ifClause:m}),i.if(f,p("then",m),p("else",m))}else c?i.if(f,p("then")):i.if((0,t.not)(f),p("else"));s.pass(d,()=>s.error(!0));function h(){const m=s.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},f);s.mergeEvaluated(m)}function p(m,g){return()=>{const y=s.subschema({keyword:m},f);i.assign(d,f),s.mergeValidEvaluated(y,d),g?i.assign(g,(0,t._)`${m}`):s.setParams({ifClause:m})}}}};function o(s,i){const a=s.schema[i];return a!==void 0&&!(0,e.alwaysValidSchema)(s,a)}return wc.default=r,wc}var kc={},dw;function jU(){if(dw)return kc;dw=1,Object.defineProperty(kc,"__esModule",{value:!0});const t=Ze(),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 kc.default=e,kc}var fw;function FU(){if(fw)return lc;fw=1,Object.defineProperty(lc,"__esModule",{value:!0});const t=gT(),e=MU(),n=yT(),r=RU(),o=OU(),s=NU(),i=_U(),a=bT(),l=PU(),c=AU(),u=IU(),d=$U(),f=DU(),h=zU(),p=LU(),m=jU();function g(y=!1){const b=[u.default,d.default,f.default,h.default,p.default,m.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 lc.default=g,lc}var xc={},Sc={},hw;function BU(){if(hw)return Sc;hw=1,Object.defineProperty(Sc,"__esModule",{value:!0});const t=We(),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?m():g();function m(){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 S=h.$async?(0,t._)`(${b}.async ? await ${k}(${i}) : ${k}(${i}))`:(0,t._)`${k}(${i})`,T=(0,t._)`(typeof ${k} == "function" ? ${S} : ${k}.test(${i}))`;return(0,t._)`${k} && ${k} !== true && ${w} === ${o} && !${T}`}}function g(){const y=p.formats[l];if(!y){v();return}if(y===!0)return;const[b,w,k]=x(y);b===o&&r.pass(S());function v(){if(d.strictSchema===!1){p.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${l}" ignored in schema at path "${f}"`}}function x(T){const I=T instanceof RegExp?(0,t.regexpCode)(T):d.code.formats?(0,t._)`${d.code.formats}${(0,t.getProperty)(l)}`:void 0,L=s.scopeValue("formats",{key:l,ref:T,code:I});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,t._)`${L}.validate`]:["string",T,L]}function S(){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 Sc.default=n,Sc}var pw;function VU(){if(pw)return xc;pw=1,Object.defineProperty(xc,"__esModule",{value:!0});const e=[BU().default];return xc.default=e,xc}var Bo={},mw;function HU(){return mw||(mw=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 gw;function WU(){if(gw)return Ul;gw=1,Object.defineProperty(Ul,"__esModule",{value:!0});const t=pU(),e=TU(),n=FU(),r=VU(),o=HU(),s=[t.default,e.default,(0,n.default)(),r.default,o.metadataVocabulary,o.contentVocabulary];return Ul.default=s,Ul}var Ec={},Zi={},yw;function qU(){if(yw)return Zi;yw=1,Object.defineProperty(Zi,"__esModule",{value:!0}),Zi.DiscrError=void 0;var t;return(function(e){e.Tag="tag",e.Mapping="mapping"})(t||(Zi.DiscrError=t={})),Zi}var bw;function UU(){if(bw)return Ec;bw=1,Object.defineProperty(Ec,"__esModule",{value:!0});const t=We(),e=qU(),n=xg(),r=Wd(),o=Ze(),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 m=l.let("valid",!1),g=l.const("tag",(0,t._)`${c}${(0,t.getProperty)(p)}`);l.if((0,t._)`typeof ${g} == "string"`,()=>y(),()=>a.error(!1,{discrError:e.DiscrError.Tag,tag:g,tagName:p})),a.ok(m);function y(){const k=w();l.if(!1);for(const v in k)l.elseIf((0,t._)`${g} === ${v}`),l.assign(m,b(k[v]));l.else(),a.error(!1,{discrError:e.DiscrError.Mapping,tag:g,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=T(d);let S=!0;for(let N=0;N<h.length;N++){let P=h[N];if(P?.$ref&&!(0,o.schemaHasRulesButRef)(P,f.self.RULES)){const j=P.$ref;if(P=n.resolveRef.call(f.self,f.schemaEnv.root,f.baseId,j),P instanceof n.SchemaEnv&&(P=P.schema),P===void 0)throw new r.default(f.opts.uriResolver,f.baseId,j)}const A=(k=P?.properties)===null||k===void 0?void 0:k[p];if(typeof A!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);S=S&&(x||T(P)),I(A,N)}if(!S)throw new Error(`discriminator: "${p}" must be required`);return v;function T({required:N}){return Array.isArray(N)&&N.includes(p)}function I(N,P){if(N.const)L(N.const,P);else if(N.enum)for(const A of N.enum)L(A,P);else throw new Error(`discriminator: "properties/${p}" must have "const" or "enum"`)}function L(N,P){if(typeof N!="string"||N in v)throw new Error(`discriminator: "${p}" values must be unique strings`);v[N]=P}}}};return Ec.default=i,Ec}const KU="http://json-schema.org/draft-07/schema#",YU="http://json-schema.org/draft-07/schema#",GU="Core schema meta-schema",ZU={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:[]}},JU=["object","boolean"],XU={$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:"#"}},QU={$schema:KU,$id:YU,title:GU,definitions:ZU,type:JU,properties:XU,default:!0};var vw;function vT(){return vw||(vw=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=dU(),r=WU(),o=UU(),s=QU,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=Hd();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=We();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=kg();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var f=Wd();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return f.default}})})(Bl,Bl.exports)),Bl.exports}var e8=vT();const t8=fp(e8);var Cc={exports:{}},th={},ww;function n8(){return ww||(ww=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0;function e(N,P){return{validate:N,compare:P}}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:L,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:S},float:{type:"number",validate:T},double:{type:"number",validate:T},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(N){return N%4===0&&(N%100!==0||N%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(N){const P=r.exec(N);if(!P)return!1;const A=+P[1],j=+P[2],K=+P[3];return j>=1&&j<=12&&K>=1&&K<=(j===2&&n(A)?29:o[j])}function i(N,P){if(N&&P)return N>P?1:N<P?-1:0}const a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function l(N){return function(A){const j=a.exec(A);if(!j)return!1;const K=+j[1],J=+j[2],Y=+j[3],G=j[4],U=j[5]==="-"?-1:1,z=+(j[6]||0),B=+(j[7]||0);if(z>23||B>59||N&&!G)return!1;if(K<=23&&J<=59&&Y<60)return!0;const H=J-B*U,V=K-z*U-(H<0?1:0);return(V===23||V===-1)&&(H===59||H===-1)&&Y<61}}function c(N,P){if(!(N&&P))return;const A=new Date("2020-01-01T"+N).valueOf(),j=new Date("2020-01-01T"+P).valueOf();if(A&&j)return A-j}function u(N,P){if(!(N&&P))return;const A=a.exec(N),j=a.exec(P);if(A&&j)return N=A[1]+A[2]+A[3],P=j[1]+j[2]+j[3],N>P?1:N<P?-1:0}const d=/t|\s/i;function f(N){const P=l(N);return function(j){const K=j.split(d);return K.length===2&&s(K[0])&&P(K[1])}}function h(N,P){if(!(N&&P))return;const A=new Date(N).valueOf(),j=new Date(P).valueOf();if(A&&j)return A-j}function p(N,P){if(!(N&&P))return;const[A,j]=N.split(d),[K,J]=P.split(d),Y=i(A,K);if(Y!==void 0)return Y||c(j,J)}const m=/\/|:/,g=/^(?:[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(N){return m.test(N)&&g.test(N)}const b=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function w(N){return b.lastIndex=0,b.test(N)}const k=-2147483648,v=2**31-1;function x(N){return Number.isInteger(N)&&N<=v&&N>=k}function S(N){return Number.isInteger(N)}function T(){return!0}const I=/[^\\]\\Z/;function L(N){if(I.test(N))return!1;try{return new RegExp(N),!0}catch{return!1}}})(th)),th}var nh={},kw;function r8(){return kw||(kw=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;const e=vT(),n=We(),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 m=new e.KeywordCxt(f,p.RULES.all.format.definition,"format");m.$data?g():y();function g(){const w=l.scopeValue("formats",{ref:p.formats,code:h.code.formats}),k=l.const("fmt",(0,n._)`${w}[${m.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=m.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})(nh)),nh}var xw;function o8(){return xw||(xw=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const n=n8(),r=r8(),o=We(),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 m of u)c.addFormat(m,d[m])}t.exports=e=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a})(Cc,Cc.exports)),Cc.exports}var s8=o8();const i8=fp(s8),ci="_root",wT=new t8({allErrors:!0,strict:!1});i8(wT);const Sw=new WeakMap;function a8(t){const e=Sw.get(t);if(e)return e;const n=wT.compile(t);return Sw.set(t,n),n}function l8(t){return t.replaceAll("~1","/").replaceAll("~0","~")}function c8(t){if(t.keyword==="required")return(typeof t.params.missingProperty=="string"?t.params.missingProperty:void 0)??ci;const e=t.instancePath.replace(/^\//,"");if(e.length===0)return ci;const n=e.split("/")[0];return n?l8(n):ci}function u8(t){const e=t.message?.trim();return e&&e.length>0?e:"invalid value"}function d8(t){if(!t||t.length===0)return{};const e={};for(const n of t){const r=c8(n),o=u8(n),s=e[r]??[];s.includes(o)||(e[r]=[...s,o])}return e}function f8(t,e){const n=a8(t);return{valid:!!n(e),errors:d8(n.errors)}}const Os="border-transparent bg-muted/50 shadow-none focus-visible:border-transparent focus-visible:ring-2 focus-visible:ring-ring/35",h8=/^#[0-9a-fA-F]{6}$/,p8=50;function m8(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 Ew(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}function g8(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 y8(t){const e=t.getFullYear(),n=Qu(t.getMonth()+1),r=Qu(t.getDate());return`${e}-${n}-${r}`}function Cw(t,e){if(t)return fH(`${t}T${e||"00:00"}`)}function Tw(t){return t.trim().toUpperCase()}function b8(t){return h8.test(t)}function v8(t){const e=t.trim(),n=e.indexOf(":");if(!(n<=0||n===e.length-1))return{prefix:e.slice(0,n).toLowerCase(),name:e.slice(n+1)}}function w8(t){const e=v8(t);if(e)return`https://api.iconify.design/${encodeURIComponent(e.prefix)}/${encodeURIComponent(e.name)}.svg?width=24&height=24`}function k8(t){return{maskImage:`url("${t}")`,maskRepeat:"no-repeat",maskPosition:"center",maskSize:"contain",WebkitMaskImage:`url("${t}")`,WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center",WebkitMaskSize:"contain"}}const x8=Array.from({length:24},(t,e)=>Qu(e)),S8=Array.from({length:60},(t,e)=>Qu(e));function E8(t){const e=t.trim().toLowerCase();return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:")||e.startsWith("blob:")}function C8(t){const e=E.useMemo(()=>t.sourcePaths.map(o=>o.trim()).filter(o=>o.length>0),[t.sourcePaths]),[n,r]=E.useState([]);return E.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(E8(i))return{sourcePath:i,previewUrl:i,loading:!1};try{const a=await WE({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 kT(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=C8(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(Zn,{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 group-hover:opacity-100 hover:opacity-100",onClick:()=>s(p),"aria-label":`Remove image ${h.sourcePath}`,children:M.jsx(lx,{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 T8(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(gr,{id:n,type:"number",className:Os,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 M8(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(JV,{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 R8(t){const e=Me.c(69),{fieldKey:n,value:r,onChange:o,onBlur:s}=t;let i,a;if(e[0]!==r){const{date:H,time:V}=g8(r);i=H,a=V.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,m,g,y,b,w,k,v;if(e[3]!==i||e[4]!==n||e[5]!==u||e[6]!==d||e[7]!==s||e[8]!==o){g=i?new Date(`${i}T00:00:00`):void 0;let H;e[19]!==u||e[20]!==d||e[21]!==s||e[22]!==o?(H=R=>{if(!R){o(void 0),s();return}const D=y8(R);o(Cw(D,`${u}:${d}`)),s()},e[19]=u,e[20]=d,e[21]=s,e[22]=o,e[23]=H):H=e[23],p=H;let V;e[24]!==i||e[25]!==s||e[26]!==o?(V=(R,D)=>{o(Cw(i,`${R}:${D}`)),s()},e[24]=i,e[25]=s,e[26]=o,e[27]=V):V=e[27],m=V,v="space-y-2",h=Nd,f=_d,e[28]===Symbol.for("react.memo_cache_sentinel")?(y=ue(mi({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(PN,{className:"text-muted-foreground size-4"}),e[29]=w):w=e[29],k=g?g.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]=m,e[13]=g,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],m=e[12],g=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 S;e[36]!==p||e[37]!==g?(S=M.jsx(Pd,{className:"w-auto p-0",children:M.jsx(qV,{mode:"single",selected:g,onSelect:p})}),e[36]=p,e[37]=g,e[38]=S):S=e[38];let T;e[39]!==h||e[40]!==S||e[41]!==x?(T=M.jsxs(h,{children:[x,S]}),e[39]=h,e[40]=S,e[41]=x,e[42]=T):T=e[42];let I;e[43]===Symbol.for("react.memo_cache_sentinel")?(I=M.jsx(VN,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2"}),e[43]=I):I=e[43];let L;e[44]!==m||e[45]!==d?(L=H=>{H&&m(H,d)},e[44]=m,e[45]=d,e[46]=L):L=e[46];const N=!i;let P;e[47]===Symbol.for("react.memo_cache_sentinel")?(P=M.jsx(Jc,{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(Zc,{placeholder:"HH"})}),e[47]=P):P=e[47];let A;e[48]===Symbol.for("react.memo_cache_sentinel")?(A=M.jsx(Xc,{children:M.jsx(Gc,{children:x8.map(N8)})}),e[48]=A):A=e[48];let j;e[49]!==u||e[50]!==L||e[51]!==N?(j=M.jsxs("div",{className:"relative",children:[I,M.jsxs(Yc,{value:u,onValueChange:L,disabled:N,children:[P,A]})]}),e[49]=u,e[50]=L,e[51]=N,e[52]=j):j=e[52];let K;e[53]!==m||e[54]!==u?(K=H=>{H&&m(u,H)},e[53]=m,e[54]=u,e[55]=K):K=e[55];const J=!i;let Y;e[56]===Symbol.for("react.memo_cache_sentinel")?(Y=M.jsx(Jc,{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(Zc,{placeholder:"MM"})}),e[56]=Y):Y=e[56];let G;e[57]===Symbol.for("react.memo_cache_sentinel")?(G=M.jsx(Xc,{children:M.jsx(Gc,{children:S8.map(O8)})}),e[57]=G):G=e[57];let U;e[58]!==d||e[59]!==K||e[60]!==J?(U=M.jsxs(Yc,{value:d,onValueChange:K,disabled:J,children:[Y,G]}),e[58]=d,e[59]=K,e[60]=J,e[61]=U):U=e[61];let z;e[62]!==j||e[63]!==U?(z=M.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[j,U]}),e[62]=j,e[63]=U,e[64]=z):z=e[64];let B;return e[65]!==T||e[66]!==z||e[67]!==v?(B=M.jsxs("div",{className:v,children:[T,z]}),e[65]=T,e[66]=z,e[67]=v,e[68]=B):B=e[68],B}function O8(t){return M.jsx(pd,{value:t,children:t},`minute-${t}`)}function N8(t){return M.jsx(pd,{value:t,children:t},`hour-${t}`)}function _8(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(Jc,{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(Zc,{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(Xc,{children:M.jsx(Gc,{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(Yc,{value:i,onValueChange:a,children:[l,u]}),e[10]=i,e[11]=a,e[12]=u,e[13]=d):d=e[13],d}function P8(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(Uc,{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(lx,{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 m=u??"Type and press Enter";let g;e[15]!==o||e[16]!==n||e[17]!==c||e[18]!==h||e[19]!==p||e[20]!==m?(g=M.jsx(gr,{id:n,className:Os,value:o,onChange:h,onKeyDown:p,onBlur:c,placeholder:m}),e[15]=o,e[16]=n,e[17]=c,e[18]=h,e[19]=p,e[20]=m,e[21]=g):g=e[21];let y;return e[22]!==f||e[23]!==g?(y=M.jsxs("div",{className:"space-y-2",children:[f,g]}),e[22]=f,e[23]=g,e[24]=y):y=e[24],y}function A8(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(gr,{id:n,className:Os,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(kT,{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 m;e[17]!==r||e[18]!==o||e[19]!==p?(m=M.jsx(HE,{currentFilePath:r,sourceMode:o,triggerLabel:"Browse assets",onSelectPath:p}),e[17]=r,e[18]=o,e[19]=p,e[20]=m):m=e[20];let g;return e[21]!==f||e[22]!==h||e[23]!==m?(g=M.jsxs("div",{className:"space-y-2",children:[f,h,m]}),e[21]=f,e[22]=h,e[23]=m,e[24]=g):g=e[24],g}function I8(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(D8).filter($8),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 m;e[4]!==l||e[5]!==u?(m=x=>{(x.key==="Enter"||x.key===",")&&(x.preventDefault(),l(),u())},e[4]=l,e[5]=u,e[6]=m):m=e[6];let g;e[7]!==i||e[8]!==n||e[9]!==u||e[10]!==p||e[11]!==m?(g=M.jsx(gr,{id:n,className:Os,value:i,onChange:p,onKeyDown:m,onBlur:u,placeholder:"Type image path and press Enter"}),e[7]=i,e[8]=n,e[9]=u,e[10]=p,e[11]=m,e[12]=g):g=e[12];let y;e[13]!==l||e[14]!==u?(y=M.jsx(yn,{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]!==g||e[17]!==y?(b=M.jsxs("div",{className:"flex gap-2",children:[g,y]}),e[16]=g,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(kT,{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(HE,{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 $8(t){return t.length>0}function D8(t){return t.trim()}function z8(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=Tw(i),a=l.length>0,c=a&&b8(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(gr,{id:n,className:Os,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 m;e[11]!==s||e[12]!==o?(m=v=>{o(Tw(v.target.value)),s()},e[11]=s,e[12]=o,e[13]=m):m=e[13];const g=`${n} color picker`;let y;e[14]!==d||e[15]!==p||e[16]!==m||e[17]!==g?(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:m,"aria-label":g}),e[14]=d,e[15]=p,e[16]=m,e[17]=g,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 L8(t){const e=Me.c(32),{fieldKey:n,value:r,iconLibraries:o,onChange:s,onBlur:i}=t,a=typeof r=="string"?r:"";let l,c,u,d,f,h;if(e[0]!==n||e[1]!==i||e[2]!==s||e[3]!==a){const y=w8(a);f="flex gap-2";let b;e[10]!==s?(b=w=>{const k=w.target.value;s(k.length>0?k:void 0)},e[10]=s,e[11]=b):b=e[11],e[12]!==n||e[13]!==i||e[14]!==a||e[15]!==b?(h=M.jsx(gr,{id:n,className:Os,value:a,onChange:b,onBlur:i,placeholder:"lucide:messages-square"}),e[12]=n,e[13]=i,e[14]=a,e[15]=b,e[16]=h):h=e[16],l=cH,c="border-border/50 bg-muted/45 hover:bg-muted/60 focus-visible:ring-ring/35 size-8 shrink-0 rounded-md border p-0 shadow-none focus-visible:ring-2",u=`${n} icon picker`,d=y?M.jsx("span",{"aria-hidden":"true",className:"text-foreground size-3 shrink-0 bg-current",style:k8(y)}):M.jsx("span",{className:"text-muted-foreground text-[10px] font-medium",children:"icon"}),e[0]=n,e[1]=i,e[2]=s,e[3]=a,e[4]=l,e[5]=c,e[6]=u,e[7]=d,e[8]=f,e[9]=h}else l=e[4],c=e[5],u=e[6],d=e[7],f=e[8],h=e[9];let p;e[17]!==i||e[18]!==s?(p=y=>{s(y),i()},e[17]=i,e[18]=s,e[19]=p):p=e[19];let m;e[20]!==l||e[21]!==o||e[22]!==a||e[23]!==c||e[24]!==u||e[25]!==d||e[26]!==p?(m=M.jsx(l,{triggerClassName:c,triggerAriaLabel:u,triggerContent:d,selectedIcon:a,allowedLibraries:o,onSelectIcon:p}),e[20]=l,e[21]=o,e[22]=a,e[23]=c,e[24]=u,e[25]=d,e[26]=p,e[27]=m):m=e[27];let g;return e[28]!==f||e[29]!==h||e[30]!==m?(g=M.jsxs("div",{className:f,children:[h,m]}),e[28]=f,e[29]=h,e[30]=m,e[31]=g):g=e[31],g}function Mw(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 j8(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 F8({selectedCollection:t,selectedFile:e}){const n=ct(C=>C.draft),r=ct(C=>C.dirty),o=ct(C=>C.errors),s=ct(C=>C.chipInputs),i=ct(C=>C.setFieldValue),a=ct(C=>C.setFieldTouched),l=ct(C=>C.setValidationErrors),c=ct(C=>C.setChipInput),u=ct(C=>C.addChipValue),d=ct(C=>C.removeChipValue),f=ct(C=>C.removeLastChipValue),h=ct(C=>C.applyRevisionSnapshot),[p,m]=E.useState([]),[g,y]=E.useState(),[b,w]=E.useState(),[k,v]=E.useState(),[x,S]=E.useState(!1),[T,I]=E.useState(!1),[L,N]=E.useState(),[P,A]=E.useState(),[j,K]=E.useState(!1),[J,Y]=E.useState(),[G,U]=E.useState(),[z,B]=E.useState("frontmatter"),H=E.useRef(0),V=E.useRef(0),R=e?.filePath,D=E.useMemo(()=>cT(t?.schema),[t?.schema]),$=E.useMemo(()=>D?uT(D,t?.fieldUi):[],[D,t?.fieldUi]),Z=E.useCallback(()=>{if(!t?.schema){l({});return}const C=f8(t.schema,n);l(C.errors)},[t?.schema,n,l]),Q=E.useCallback(C=>{a(C),Z()},[Z,a]);E.useEffect(()=>{Z()},[Z]);const _=E.useCallback(async(C,O)=>{if(!R)return;H.current+=1;const F=H.current;O?I(!0):S(!0),v(void 0),U(void 0);try{const W=await hH({data:{filePath:R,limit:p8,cursor:C}});if(H.current!==F)return;w(W.unavailableReason),y(W.nextCursor),m(X=>{if(!O)return W.commits;const ee=new Set(X.map(oe=>oe.sha)),ne=W.commits.filter(oe=>!ee.has(oe.sha));return[...X,...ne]}),O||N(X=>X&&W.commits.some(ne=>ne.sha===X)?X:void 0)}catch(W){if(H.current!==F)return;const X=W instanceof Error?W.message:String(W);v(X)}finally{H.current===F&&(S(!1),I(!1))}},[R]);E.useEffect(()=>{m([]),y(void 0),w(void 0),v(void 0),S(!1),I(!1),N(void 0),A(void 0),Y(void 0),K(!1),U(void 0),R&&_(void 0,!1)},[_,R]),E.useEffect(()=>{if(!R||!L){A(void 0),Y(void 0),K(!1);return}V.current+=1;const C=V.current;K(!0),Y(void 0),A(void 0),pH({data:{filePath:R,commitSha:L}}).then(O=>{V.current===C&&A(O)}).catch(O=>{if(V.current!==C)return;const F=O instanceof Error?O.message:String(O);Y(F)}).finally(()=>{V.current===C&&K(!1)})},[L,R]);const q=E.useCallback(()=>{if(!P||!t||r&&!window.confirm("This file has unsaved changes. Discard changes and apply this revision?"))return;const C=G9({currentDraft:n,revisionFrontmatter:P.frontmatter,schema:t.schema,fieldUi:t.fieldUi});h({draft:C.nextDraft,content:P.content});const O=L?.slice(0,7)??"";U(`Applied ${C.appliedKeys.length} frontmatter field${C.appliedKeys.length===1?"":"s"} and skipped ${C.skippedKeys.length}.`),Hn.success(O?`Applied revision ${O}.`:"Applied selected revision.")},[h,r,n,t,L,P]);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(Dx,{value:z,onValueChange:C=>{(C==="frontmatter"||C==="history")&&B(C)},className:"h-full min-h-0 w-full gap-3",children:[M.jsxs(zx,{className:"w-full",children:[M.jsx(qc,{value:"frontmatter",className:"text-xs",children:"Frontmatter"}),M.jsx(qc,{value:"history",className:"text-xs",children:"History"})]}),M.jsxs(My,{value:"frontmatter",className:"min-h-0 overflow-auto pr-1",children:[D?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."}),$.map(C=>{const O=o[C.key],F=m8(C.key),W=n[C.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(KV,{htmlFor:C.key,className:"text-muted-foreground text-xs font-medium tracking-wide",children:[F,C.required?" *":""]})}),C.kind==="string"&&M.jsx(gr,{id:C.key,className:Os,value:typeof W=="string"?W:"",onChange:X=>{i(C.key,X.target.value||void 0)},onBlur:()=>Q(C.key)}),C.kind==="image"&&M.jsx(A8,{fieldKey:C.key,currentFilePath:e.filePath,sourceMode:C.sourceMode,value:W,onChange:X=>{i(C.key,X)},onBlur:()=>Q(C.key)}),C.kind==="color"&&M.jsx(z8,{fieldKey:C.key,value:W,onChange:X=>{i(C.key,X)},onBlur:()=>Q(C.key)}),C.kind==="icon"&&M.jsx(L8,{fieldKey:C.key,value:W,iconLibraries:C.iconLibraries,onChange:X=>{i(C.key,X)},onBlur:()=>Q(C.key)}),C.kind==="number"&&M.jsx(T8,{fieldKey:C.key,value:W,onChange:X=>{i(C.key,X)},onBlur:()=>Q(C.key)}),C.kind==="boolean"&&M.jsx(M8,{fieldKey:C.key,value:W,onChange:X=>{i(C.key,X)},onBlur:()=>Q(C.key)}),C.kind==="enum"&&M.jsx(_8,{fieldKey:C.key,value:W,options:C.options,onChange:X=>{i(C.key,X),Q(C.key)}}),C.kind==="stringArray"&&M.jsx(P8,{fieldKey:C.key,values:Ew(W),chipInput:s[C.key]??"",onChipInputChange:X=>{c(C.key,X)},onAddChip:()=>{u(C.key,s[C.key]??""),Q(C.key)},onRemoveChip:X=>{d(C.key,X),Q(C.key)},onBackspaceEmpty:()=>{f(C.key),Q(C.key)},onBlur:()=>Q(C.key)}),C.kind==="imageArray"&&M.jsx(I8,{fieldKey:C.key,currentFilePath:e.filePath,sourceMode:C.sourceMode,values:Ew(W),chipInput:s[C.key]??"",onChipInputChange:X=>{c(C.key,X)},onAddChip:()=>{u(C.key,s[C.key]??""),Q(C.key)},onRemoveChip:X=>{d(C.key,X),Q(C.key)},onBlur:()=>Q(C.key),onSelectAsset:X=>{u(C.key,X),Q(C.key)}}),C.kind==="dateAnyOf"&&M.jsx(R8,{fieldKey:C.key,value:W,onChange:X=>{i(C.key,X)},onBlur:()=>Q(C.key)}),C.kind==="unsupported"&&M.jsxs("div",{className:"bg-muted/40 text-muted-foreground rounded-md px-3 py-2 text-sm",children:["Not yet supported: ",C.reason]}),M.jsx(Mw,{fieldKey:C.key,errors:O})]},C.key)}),o[ci]?.length?M.jsx(Mw,{fieldKey:ci,errors:o[ci]}):null]}),M.jsxs(My,{value:"history",className:"min-h-0 space-y-2 overflow-auto pr-1",children:[M.jsx("div",{className:"flex justify-end",children:M.jsx(yn,{type:"button",size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",disabled:x||T||!R,onClick:()=>{_(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(Zn,{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(C=>{const O=L===C.sha,F=C.message.trim().length>0?C.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:()=>{U(void 0),N(W=>W===C.sha?void 0:C.sha)},children:[M.jsx("p",{className:"text-foreground/90 text-xs font-medium",children:F}),M.jsxs("p",{className:"text-muted-foreground mt-0.5 text-[11px]",children:[C.author," ·"," ",j8(C.dateIso)]})]}),O?M.jsxs("div",{className:"mt-2 space-y-2",children:[j?M.jsxs("p",{className:"text-muted-foreground flex items-center gap-1.5 text-xs",children:[M.jsx(Zn,{className:"size-3.5 animate-spin"}),"Loading frontmatter..."]}):null,J?M.jsx("p",{className:"text-destructive/90 text-xs",children:J}):null,!j&&!J&&P?M.jsxs("div",{className:"space-y-2",children:[P.parseWarnings.length>0?M.jsx("div",{className:"rounded-md bg-amber-100/70 px-2 py-1.5 text-[11px] text-amber-900 dark:bg-amber-900/30 dark:text-amber-200",children:P.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(P.frontmatter).length>0?JSON.stringify(P.frontmatter,null,2):"[No frontmatter]"}),M.jsx(yn,{type:"button",size:"sm",variant:"outline",className:"h-7 w-full text-xs",onClick:q,children:"Apply"}),G?M.jsx("p",{className:"text-muted-foreground text-[11px]",children:G}):null]}):null]}):null]},C.sha)})}):null,g?M.jsx(yn,{type:"button",size:"sm",variant:"outline",className:"h-7 w-full text-xs",disabled:T||x,onClick:()=>{_(g,!0)},children:T?M.jsxs(M.Fragment,{children:[M.jsx(Zn,{className:"size-3.5 animate-spin"}),"Loading..."]}):"Load older revisions"}):null]})]})})}function B8(){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 V8(){const t=Me.c(13),[e,n]=E.useState("auto");let r,o;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{const h=B8();n(h),up(h)},o=[],t[0]=r,t[1]=o):(r=t[0],o=t[1]),E.useEffect(r,o);let s,i;t[2]!==e?(s=()=>{if(e!=="auto")return;const h=window.matchMedia("(prefers-color-scheme: dark)"),p=H8;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]),E.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"?JN:e==="dark"?c_:E_;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 H8(){return up("auto")}const Rw="astro-md-editor:editor-mode",W8=fr({method:"POST"}).handler(hr("b1ee42a5714ab9be8f37a4c5fca02ffd6269030b4d3ef663ff002865393e2386")),q8=fr({method:"POST"}).handler(hr("a215cd23c3ee5dbffd561330a77a2b6ed0e0b5b10aac60190e712ffa6067a121")),U8=fr({method:"POST"}).handler(hr("248b908cf72b9979ba134470388db1f63e57871f390fb58a8be8d0757531e84c"));function J8(){const t=CT(),[e,n]=E.useState(t),r=Cg.useSearch(),[o,s]=E.useState(!0),[i,a]=E.useState(!0),[l,c]=E.useState(!1),[u,d]=E.useState(!1),[f,h]=E.useState(),[p,m]=E.useState(),g=E.useRef(null),y=E.useRef(null),b=Cg.useNavigate(),w=ct($=>$.draft),k=ct($=>$.contentDraft),v=ct($=>$.dirty),x=ct($=>$.editorMode),S=ct($=>$.setEditorMode),T=ct($=>$.richModeAvailability),I=ct($=>$.richModeBlockReason),L=ct($=>$.loadSelection),N=ct($=>$.clearSelection),P=ct($=>$.commitSavedState);E.useEffect(()=>{n(t)},[t]);const{selectedCollection:A,selectedFile:j,normalizedSearch:K}=E.useMemo(()=>uI(e,r),[e,r]);E.useEffect(()=>{lf(r,K)||b({search:K,replace:!0})},[b,K,r]),E.useEffect(()=>{if(!A||!j){N();return}L({collectionName:A.name,fileId:j.id,data:j.data,content:j.content})},[N,L,A,j]),E.useEffect(()=>{if(!v)return;const $=Z=>{Z.preventDefault(),Z.returnValue=""};return window.addEventListener("beforeunload",$),()=>{window.removeEventListener("beforeunload",$)}},[v]),E.useEffect(()=>{const $=window.localStorage.getItem(Rw);($==="basic"||$==="rich")&&S($)},[S]),E.useEffect(()=>{window.localStorage.setItem(Rw,x)},[x]);const J=E.useCallback(()=>v?window.confirm("You have unsaved changes. Discard changes and continue?"):!0,[v]),Y=E.useCallback($=>{const Z=e.find(q=>q.name===$);if(!Z)return;const Q=im(Z).at(0),_={collection:Z.name,file:Q?.id};lf(K,_)||J()&&b({search:_})},[J,e,b,K]),G=E.useCallback($=>{if(!A)return;const Z={collection:A.name,file:$};lf(K,Z)||J()&&b({search:Z})},[J,b,K,A]),U=E.useCallback(()=>{const $=g.current;if(!$){s(Z=>!Z);return}if($.isCollapsed()){$.expand(),s(!0);return}$.collapse(),s(!1)},[]),z=E.useCallback(()=>{const $=y.current;if(!$){a(Z=>!Z);return}if($.isCollapsed()){$.expand(),a(!0);return}$.collapse(),a(!1)},[]),B=E.useCallback(()=>{const $=!(g.current?.isCollapsed()??!1),Z=!(y.current?.isCollapsed()??!1);s(Q=>Q===$?Q:$),a(Q=>Q===Z?Q:Z)},[]),H=E.useCallback(async()=>{if(!(!A||!j||!v||l)){c(!0),m(void 0);try{await W8({data:{collectionName:A.name,fileId:j.id,draft:w,content:k}}),P(),Hn.success(`Saved ${oi(j)}.`)}catch($){const Z=$ instanceof Error?$.message:"Unable to save file.";m(Z),Hn.error(Z)}finally{c(!1)}}},[P,k,v,w,l,A,j]),V=E.useCallback(async $=>{if(!A||f)return;const Z=A.files.find(Q=>Q.id===$);if(Z&&!(v&&j?.id===$&&!window.confirm("This file has unsaved changes. Delete it anyway?"))){h($),m(void 0);try{await q8({data:{collectionName:A.name,fileId:$}}),n(Q=>Q.map(_=>_.name!==A.name?_:{..._,files:_.files.filter(q=>q.id!==$)})),Hn.success(`Deleted ${oi(Z)}.`)}catch(Q){const _=Q instanceof Error?Q.message:"Unable to delete file.";Hn.error(_)}finally{h(void 0)}}},[f,v,A,j?.id]),R=E.useCallback(async $=>{if(!(!A||u)){d(!0),m(void 0);try{const Z=await U8({data:{collectionName:A.name,slug:$}}),Q=Z.fileId;n(_=>_.map(q=>q.name!==A.name?q:{...q,files:[...q.files,{id:Z.fileId,filePath:Z.filePath,data:{},content:""}]})),await b({search:{collection:A.name,file:Z.fileId}}),Hn.success(`Created ${Q}.`)}catch(Z){const Q=Z instanceof Error?Z.message:"Unable to create file.";Hn.error(Q)}finally{d(!1)}}},[u,b,A]);E.useEffect(()=>{m(void 0)},[A?.name,j?.id]);const D=j?oi(j):"No file selected";return M.jsx("div",{className:"h-svh w-screen overflow-hidden p-2",children:M.jsxs(uP,{orientation:"horizontal",onLayoutChanged:B,defaultLayout:{"editor-left-sidebar":18,"editor-main-panel":64,"editor-right-sidebar":18},children:[M.jsx(sf,{id:"editor-left-sidebar",panelRef:g,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(dI,{collections:e,selectedCollectionName:A?.name,selectedFileId:j?.id,onSelectCollection:Y,onSelectFile:G,onCreateFile:R,onDeleteFile:V,isCreatingFile:u,deletingFileId:f})})}),M.jsx(xy,{withHandle:!0,className:ue(o?"mx-1 w-2 bg-transparent":"mx-0 w-0",!o&&"pointer-events-none opacity-0")}),M.jsx(sf,{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(yn,{variant:"ghost",size:"icon",onClick:U,"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(d_,{}):M.jsx(h_,{})}),M.jsx(V8,{})]}),M.jsx("p",{className:"text-foreground/85 min-w-0 flex-1 truncate text-center text-sm font-medium",title:j?.id,children:D}),M.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-2",children:[M.jsx(Dx,{value:x,onValueChange:$=>{($==="basic"||$==="rich")&&S($)},className:"gap-0",children:M.jsxs(zx,{className:"bg-muted/55 h-auto rounded-md p-0.5",children:[M.jsx(qc,{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(qc,{value:"rich",className:"h-auto rounded-sm px-2 py-1 text-xs font-medium",disabled:T==="blocked","aria-label":"Use rich editor mode",title:T==="blocked"?`Rich mode unavailable: ${I??"unsupported syntax detected"}`:"Use rich editor mode",children:"Rich"})]})}),v?M.jsxs(yn,{type:"button",variant:"ghost",size:"sm",onClick:H,disabled:l||!A||!j,className:"border-0",children:[l?M.jsx(Zn,{className:"animate-spin"}):M.jsx(k_,{}),"Save"]}):null,M.jsx(yn,{variant:"ghost",size:"icon",onClick:z,"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(m_,{}):M.jsx(y_,{})})]})]}),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(q4,{currentFilePath:j?.filePath})})]})}),M.jsx(xy,{withHandle:!0,className:ue(i?"mx-1 w-2 bg-transparent":"mx-0 w-0",!i&&"pointer-events-none opacity-0")}),M.jsx(sf,{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(F8,{selectedCollection:A,selectedFile:j})})})]})})}export{J8 as component};