astro-md-editor 0.0.6 → 0.0.8

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 (53) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/index-CstiJsWh.js +378 -0
  3. package/.output/public/assets/{main-DzXOjsqg.js → main-Cc9C-tdG.js} +1 -1
  4. package/.output/public/assets/styles-DCSwPMSs.css +1 -0
  5. package/.output/server/{__root-CL_tq3ov.mjs → __root-Bv3dTvZ5.mjs} +1 -1
  6. package/.output/server/_libs/@radix-ui/react-dismissable-layer+[...].mjs +210 -0
  7. package/.output/server/_libs/@radix-ui/react-use-callback-ref+[...].mjs +11 -0
  8. package/.output/server/_libs/@radix-ui/react-use-controllable-state+[...].mjs +69 -0
  9. package/.output/server/_libs/@radix-ui/react-use-effect-event+[...].mjs +1 -0
  10. package/.output/server/_libs/@radix-ui/react-use-escape-keydown+[...].mjs +17 -0
  11. package/.output/server/_libs/@radix-ui/react-use-layout-effect+[...].mjs +6 -0
  12. package/.output/server/_libs/ajv.mjs +640 -42
  13. package/.output/server/_libs/aria-hidden.mjs +122 -0
  14. package/.output/server/_libs/base-ui__react.mjs +2548 -2548
  15. package/.output/server/_libs/base-ui__utils.mjs +2 -2
  16. package/.output/server/_libs/cmdk.mjs +315 -0
  17. package/.output/server/_libs/detect-node-es.mjs +1 -0
  18. package/.output/server/_libs/get-nonce.mjs +9 -0
  19. package/.output/server/_libs/lucide-react.mjs +25 -17
  20. package/.output/server/_libs/radix-ui__primitive.mjs +11 -0
  21. package/.output/server/_libs/radix-ui__react-compose-refs.mjs +39 -0
  22. package/.output/server/_libs/radix-ui__react-context.mjs +78 -0
  23. package/.output/server/_libs/radix-ui__react-dialog.mjs +319 -0
  24. package/.output/server/_libs/radix-ui__react-focus-guards.mjs +29 -0
  25. package/.output/server/_libs/radix-ui__react-focus-scope.mjs +206 -0
  26. package/.output/server/_libs/radix-ui__react-id.mjs +14 -0
  27. package/.output/server/_libs/radix-ui__react-portal.mjs +16 -0
  28. package/.output/server/_libs/radix-ui__react-presence.mjs +128 -0
  29. package/.output/server/_libs/radix-ui__react-primitive.mjs +75 -0
  30. package/.output/server/_libs/radix-ui__react-slot.mjs +184 -0
  31. package/.output/server/_libs/react-remove-scroll-bar.mjs +82 -0
  32. package/.output/server/_libs/react-remove-scroll.mjs +328 -0
  33. package/.output/server/_libs/react-style-singleton.mjs +69 -0
  34. package/.output/server/_libs/react.mjs +2 -0
  35. package/.output/server/_libs/tslib.mjs +576 -0
  36. package/.output/server/_libs/use-callback-ref.mjs +66 -0
  37. package/.output/server/_libs/use-sidecar.mjs +106 -0
  38. package/.output/server/_ssr/{ImageAssetBrowser-DNDdTqtf.mjs → ImageAssetBrowser-DuPVChYO.mjs} +2 -2
  39. package/.output/server/_ssr/{collections.server-s12asITg.mjs → collections.server-DjgohZR7.mjs} +2 -1
  40. package/.output/server/_ssr/{file-history.api-oydnxFVV.mjs → file-history.api-JMkTXrYq.mjs} +1 -1
  41. package/.output/server/_ssr/{image-assets.server-Ci2E1_Tm.mjs → image-assets.server-2-0DgxSb.mjs} +1 -1
  42. package/.output/server/_ssr/{image-preview.api-pcN5PQhH.mjs → image-preview.api-V_Q-MBx9.mjs} +2 -2
  43. package/.output/server/_ssr/{index-BjQuGIib.mjs → index-ByW88Uz2.mjs} +3 -2
  44. package/.output/server/_ssr/{index-Bn1uKwTu.mjs → index-C6Fb3DjG.mjs} +806 -408
  45. package/.output/server/_ssr/index.mjs +15 -15
  46. package/.output/server/_ssr/{router-dPC3iVPs.mjs → router-DbnWNAi_.mjs} +2 -2
  47. package/.output/server/{_tanstack-start-manifest_v-Da8tuNDH.mjs → _tanstack-start-manifest_v-BDWWBEf1.mjs} +1 -1
  48. package/.output/server/index.mjs +46 -46
  49. package/LICENSE.md +1 -1
  50. package/package.json +2 -1
  51. package/scripts/bootstrap-collections.mjs +50 -2
  52. package/.output/public/assets/index-UQt6zCrS.js +0 -334
  53. package/.output/public/assets/styles-CezfLgHY.css +0 -1
@@ -0,0 +1,378 @@
1
+ import{r as x,u as ln,R as pl,j as C,a as _m,b as Xn,c as Rn,T as gs,d as yO,w as Ax,e as it,f as Ee,g as Ix,L as Jn,h as me,i as gr,k as yr,t as Hn,l as Nm,m as bO,n as Zy}from"./main-Cc9C-tdG.js";function Dx(t){const e=x.useRef(!0);e.current&&(e.current=!1,t())}const vO=()=>{},ve=typeof document<"u"?x.useLayoutEffect:vO;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 Qd(){return typeof window<"u"}function No(t){return Pm(t)?(t.nodeName||"").toLowerCase():"#document"}function Pt(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function br(t){var e;return(e=(Pm(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Pm(t){return Qd()?t instanceof Node||t instanceof Pt(t).Node:!1}function rt(t){return Qd()?t instanceof Element||t instanceof Pt(t).Element:!1}function xt(t){return Qd()?t instanceof HTMLElement||t instanceof Pt(t).HTMLElement:!1}function yp(t){return!Qd()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Pt(t).ShadowRoot}function Po(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=On(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&o!=="inline"&&o!=="contents"}function wO(t){return/^(table|td|th)$/.test(No(t))}function ef(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const kO=/transform|translate|scale|rotate|perspective|filter/,xO=/paint|layout|strict|content/,Wo=t=>!!t&&t!=="none";let Gf;function $m(t){const e=rt(t)?On(t):t;return Wo(e.transform)||Wo(e.translate)||Wo(e.scale)||Wo(e.rotate)||Wo(e.perspective)||!tf()&&(Wo(e.backdropFilter)||Wo(e.filter))||kO.test(e.willChange||"")||xO.test(e.contain||"")}function SO(t){let e=Br(t);for(;xt(e)&&!zr(e);){if($m(e))return e;if(ef(e))return null;e=Br(e)}return null}function tf(){return Gf==null&&(Gf=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Gf}function zr(t){return/^(html|body|#document)$/.test(No(t))}function On(t){return Pt(t).getComputedStyle(t)}function nf(t){return rt(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Br(t){if(No(t)==="html")return t;const e=t.assignedSlot||t.parentNode||yp(t)&&t.host||br(t);return yp(e)?e.host:e}function zx(t){const e=Br(t);return zr(e)?t.ownerDocument?t.ownerDocument.body:t.body:xt(e)&&Po(e)?e:zx(e)}function ho(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=zx(t),s=o===((r=t.ownerDocument)==null?void 0:r.body),i=Pt(o);if(s){const a=bp(i);return e.concat(i,i.visualViewport||[],Po(o)?o:[],a&&n?ho(a):[])}else return e.concat(o,ho(o,[],n))}function bp(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Bt(t){const e=ln(EO,t).current;return e.next=t,ve(e.effect),e}function EO(t){const e={current:t,next:t,effect:()=>{e.current=e.next}};return e}const Zf=pl[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],CO=Zf&&Zf!==x.useLayoutEffect?Zf:t=>t();function ye(t){const e=ln(TO).current;return e.next=t,CO(e.effect),e.trampoline}function TO(){const t={next:void 0,callback:RO,trampoline:(...e)=>t.callback?.(...e),effect:()=>{t.callback=t.next}};return t}function RO(){}function Xe(t){return t?.ownerDocument||document}const Gi=typeof navigator<"u",Jf=_O(),jx=PO(),Lx=NO(),Am=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),Fx=Jf.platform==="MacIntel"&&Jf.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Jf.platform),MO=Gi&&/apple/i.test(navigator.vendor),vp=Gi&&/android/i.test(jx)||/android/i.test(Lx);Gi&&jx.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const OO=Lx.includes("jsdom/");function _O(){if(!Gi)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 NO(){if(!Gi)return"";const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(({brand:e,version:n})=>`${e}/${n}`).join(" "):navigator.userAgent}function PO(){if(!Gi)return"";const t=navigator.userAgentData;return t?.platform?t.platform:navigator.platform??""}const wp="data-base-ui-focusable",Bx="active",Vx="selected",Wx="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",po="ArrowLeft",mo="ArrowRight",Im="ArrowUp",ml="ArrowDown";function qn(t){let e=t.activeElement;for(;e?.shadowRoot?.activeElement!=null;)e=e.shadowRoot.activeElement;return e}function Ye(t,e){if(!t||!e)return!1;const n=e.getRootNode?.();if(t.contains(e))return!0;if(n&&yp(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Hx(t,e){if(!rt(t))return!1;const n=t;if(e.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,r]of e.entries())if(Ye(r,n))return!r.hasAttribute("data-trigger-disabled");return!1}function Sn(t){return"composedPath"in t?t.composedPath()[0]:t.target}function Bn(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 $O(t){return t.matches("html,body")}function Dm(t){return xt(t)&&t.matches(Wx)}function kp(t){return t?t.getAttribute("role")==="combobox"&&Dm(t):!1}function Ha(t){return t?t.hasAttribute(wp)?t:t.querySelector(`[${wp}]`)||t:null}function ls(t,e,n=!0){return t.filter(o=>o.parentId===e&&(!n||o.context?.open)).flatMap(o=>[o,...ls(t,o.id,n)])}function Jy(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 AO(t){return"nativeEvent"in t}function qx(t){return t.pointerType===""&&t.isTrusted?!0:vp&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function Ux(t){return OO?!1:!vp&&t.width===0&&t.height===0||vp&&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 _i(t,e){const n=["mouse","pen"];return e||n.push("",void 0),n.includes(t)}function Kx(t){const e=t.type;return e==="click"||e==="mousedown"||e==="keydown"||e==="keyup"}const IO=["top","right","bottom","left"],Ni=Math.min,En=Math.max,Pu=Math.round,fi=Math.floor,hr=t=>({x:t,y:t}),DO={left:"right",right:"left",bottom:"top",top:"bottom"};function xp(t,e,n){return En(t,Ni(e,n))}function Vr(t,e){return typeof t=="function"?t(e):t}function gn(t){return t.split("-")[0]}function $o(t){return t.split("-")[1]}function zm(t){return t==="x"?"y":"x"}function jm(t){return t==="y"?"height":"width"}function zn(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function Lm(t){return zm(zn(t))}function zO(t,e,n){n===void 0&&(n=!1);const r=$o(t),o=Lm(t),s=jm(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(i=$u(i)),[i,$u(i)]}function jO(t){const e=$u(t);return[Sp(t),e,Sp(e)]}function Sp(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Xy=["left","right"],Qy=["right","left"],LO=["top","bottom"],FO=["bottom","top"];function BO(t,e,n){switch(t){case"top":case"bottom":return n?e?Qy:Xy:e?Xy:Qy;case"left":case"right":return e?LO:FO;default:return[]}}function VO(t,e,n,r){const o=$o(t);let s=BO(gn(t),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),e&&(s=s.concat(s.map(Sp)))),s}function $u(t){const e=gn(t);return DO[e]+t.slice(e.length)}function WO(t){return{top:0,right:0,bottom:0,left:0,...t}}function Yx(t){return typeof t!="number"?WO(t):{top:t,right:t,bottom:t,left:t}}function Au(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 Il(t,e,n){return Math.floor(t/e)!==n}function yi(t,e){return e<0||e>=t.current.length}function ku(t,e){return Ut(t,{disabledIndices:e})}function Ep(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&&go(t,s,r));return s}function Gx(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 S=f[k];if(S.length===0){k=y==="up"?k-1:k+1;continue}const E=Math.min(w,S.length-1);for(let M=E;M>=0;M-=1){const D=S[M];if(!go(t,D,i))return D}k=y==="up"?k-1:k+1,r&&(k<0?k=f.length-1:k>=f.length&&(k=0))}}if(e.key===Im){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}yi(t,d)&&(d=c)}}if(e.key===ml){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}))),yi(t,d)&&(d=c))}if(n==="both"){const y=fi(c/s);e.key===(o?po:mo)&&(u&&Jt(e),c%s!==s-1?(d=Ut(t,{startingIndex:c,disabledIndices:i}),r&&Il(d,s,y)&&(d=Ut(t,{startingIndex:c-c%s-1,disabledIndices:i}))):r&&(d=Ut(t,{startingIndex:c-c%s-1,disabledIndices:i})),Il(d,s,y)&&(d=c)),e.key===(o?mo:po)&&(u&&Jt(e),c%s!==0?(d=Ut(t,{startingIndex:c,decrement:!0,disabledIndices:i}),r&&Il(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})),Il(d,s,y)&&(d=c));const b=fi(l/s)===y;yi(t,d)&&(r&&b?d=e.key===(o?mo:po)?l:Ut(t,{startingIndex:c-c%s-1,disabledIndices:i}):d=c)}return d}function Zx(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 Jx(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 Xx(t,e){return e.flatMap((n,r)=>t.includes(n)?[r]:[])}function go(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 HO=["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] *)"],Iu=HO.join(","),Qx=typeof Element>"u",Pi=Qx?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Du=!Qx&&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},zu=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]"):zu(e.parentNode));return i},qO=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},e1=function(e,n,r){if(zu(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(Iu));return n&&Pi.call(e,Iu)&&o.unshift(e),o=o.filter(r),o},ju=function(e,n,r){for(var o=[],s=Array.from(e);s.length;){var i=s.shift();if(!zu(i,!1))if(i.tagName==="SLOT"){var a=i.assignedElements(),l=a.length?a:i.children,c=ju(l,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:i,candidates:c})}else{var u=Pi.call(i,Iu);u&&r.filter(i)&&(n||!e.includes(i))&&o.push(i);var d=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),f=!zu(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(d&&f){var h=ju(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},t1=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},n1=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||qO(e))&&!t1(e)?0:e.tabIndex},UO=function(e,n){var r=n1(e);return r<0&&n&&!t1(e)?0:r},KO=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},r1=function(e){return e.tagName==="INPUT"},YO=function(e){return r1(e)&&e.type==="hidden"},GO=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},ZO=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},JO=function(e){if(!e.name)return!0;var n=e.form||Du(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=ZO(o,e.form);return!s||s===e},XO=function(e){return r1(e)&&e.type==="radio"},QO=function(e){return XO(e)&&!JO(e)},e_=function(e){var n,r=e&&Du(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=Du(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},eb=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},t_=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=Pi.call(e,"details>summary:first-of-type"),a=i?e.parentElement:e;if(Pi.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=Du(e);if(c&&!c.shadowRoot&&o(c)===!0)return eb(e);e.assignedSlot?e=e.assignedSlot:!c&&u!==e.ownerDocument?e=u.host:e=c}e=l}if(e_(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return eb(e);return!1},n_=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 Pi.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},Cp=function(e,n){return!(n.disabled||YO(n)||t_(n,e)||GO(n)||n_(n))},Tp=function(e,n){return!(QO(n)||n1(n)<0||!Cp(e,n))},r_=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},o1=function(e){var n=[],r=[];return e.forEach(function(o,s){var i=!!o.scopeParent,a=i?o.scopeParent:o,l=UO(a,i),c=i?o1(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(KO).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},gl=function(e,n){n=n||{};var r;return n.getShadowRoot?r=ju([e],n.includeContainer,{filter:Tp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:r_}):r=e1(e,n.includeContainer,Tp.bind(null,n)),o1(r)},o_=function(e,n){n=n||{};var r;return n.getShadowRoot?r=ju([e],n.includeContainer,{filter:Cp.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=e1(e,n.includeContainer,Cp.bind(null,n)),r},s1=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return Pi.call(e,Iu)===!1?!1:Tp(n,e)};const Zi=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function i1(t,e){const n=gl(t,Zi()),r=n.length;if(r===0)return;const o=qn(Xe(t)),s=n.indexOf(o),i=s===-1?e===1?0:r-1:s+e;return n[i]}function Fm(t){return i1(Xe(t).body,1)||t}function a1(t){return i1(Xe(t).body,-1)||t}function l1(t,e){if(!t)return null;const n=gl(Xe(t).body,Zi()),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 s_(t){return l1(t,1)}function i_(t){return l1(t,-1)}function bi(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!Ye(n,r)}function a_(t){gl(t,Zi()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function tb(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 l_={...pl};let nb=0;function c_(t,e="mui"){const[n,r]=x.useState(t),o=t||n;return x.useEffect(()=>{n==null&&(nb+=1,r(`${e}-${nb}`))},[n,e]),o}const rb=l_.useId;function Ji(t,e){if(rb!==void 0){const n=rb();return t??(e?`${e}-${n}`:n)}return c_(t,e)}function c1(){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 u_{nodesRef={current:[]};events=c1();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 u1=x.createContext(null),d1=x.createContext(null),Ao=()=>x.useContext(u1)?.id||null,_s=t=>{const e=x.useContext(d1);return t??e};function d_(t){const e=Ji(),n=_s(t),r=Ao();return ve(()=>{if(!e)return;const o={id:e,parentId:r};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,e,r]),e}function f_(t){const{children:e,id:n}=t,r=Ao();return C.jsx(u1.Provider,{value:x.useMemo(()=>({id:n,parentId:r}),[n,r]),children:e})}function h_(t){const{children:e,externalTree:n}=t,r=ln(()=>n??new u_).current;return C.jsx(d1.Provider,{value:r,children:e})}function pn(){}const qa=Object.freeze([]),jt=Object.freeze({}),p_=500,m_={style:{transition:"none"}},f1="data-base-ui-click-trigger",g_={fallbackAxisSide:"none"},y_={fallbackAxisSide:"end"},b_={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Eo="none",$i="trigger-press",Cn="trigger-hover",Bm="outside-press",Xf="item-press",v_="close-press",ys="focus-out",h1="escape-key",Qf="list-navigation",w_="cancel-open",p1="imperative-action",k_="window-resize";function He(t,e,n,r){let o=!1,s=!1;const i=r??jt;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 Ua(t){return`data-base-ui-${t}`}function eh(t,e,n){if(n&&!_i(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 Wr(t,e,n,r){const o=ln(m1).current;return S_(o,t,e,n,r)&&g1(o,[t,e,n,r]),o.callback}function x_(t){const e=ln(m1).current;return E_(e,t)&&g1(e,t),e.callback}function m1(){return{callback:null,cleanup:null,refs:[]}}function S_(t,e,n,r,o){return t.refs[0]!==e||t.refs[1]!==n||t.refs[2]!==r||t.refs[3]!==o}function E_(t,e){return t.refs.length!==e.length||t.refs.some((n,r)=>n!==e[r])}function g1(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 y1={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},rf={...y1,position:"fixed",top:0,left:0},b1={...y1,position:"absolute"},Dl=null;class C_{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 zl=new C_;class cr{static create(){return new cr}static request(e){return zl.request(e)}static cancel(e){return zl.cancel(e)}currentId=Dl;request(e){this.cancel(),this.currentId=zl.request(()=>{this.currentId=Dl,e()})}cancel=()=>{this.currentId!==Dl&&(zl.cancel(this.currentId),this.currentId=Dl)};disposeEffect=()=>this.cancel}function of(){const t=ln(cr.create).current;return _m(t.disposeEffect),t}const Ai=x.forwardRef(function(e,n){const[r,o]=x.useState();ve(()=>{MO&&o("button")},[]);const s={tabIndex:0,role:r};return C.jsx("span",{...e,ref:n,style:rf,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})});let ob=0;function Oa(t,e={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=e;r&&cancelAnimationFrame(ob);const s=()=>t?.focus({preventScroll:n});o?s():ob=requestAnimationFrame(s)}const vi={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function sb(t){return t==="inert"?vi.inert:t==="aria-hidden"?vi["aria-hidden"]:vi.none}let jl=new WeakSet,Ll={},th=0;const v1=t=>t&&(t.host||v1(t.parentNode)),T_=(t,e)=>e.map(n=>{if(t.contains(n))return n;const r=v1(n);return t.contains(r)?r:null}).filter(n=>n!=null);function R_(t,e,n,r){const o="data-base-ui-inert",s=r?"inert":n?"aria-hidden":null,i=T_(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(No(p)!=="script")if(a.has(p))f(p);else{const m=s?p.getAttribute(s):null,g=m!==null&&m!=="false",y=sb(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&&jl.add(p),w===1&&p.setAttribute(o,""),!g&&s&&p.setAttribute(s,s==="inert"?"":"true")}})}return th+=1,()=>{c.forEach(h=>{const p=sb(s),g=(p.get(h)||0)-1,y=(u.get(h)||0)-1;p.set(h,g),u.set(h,y),g||(!jl.has(h)&&s&&h.removeAttribute(s),jl.delete(h)),y||h.removeAttribute(o)}),th-=1,th||(vi.inert=new WeakMap,vi["aria-hidden"]=new WeakMap,vi.none=new WeakMap,jl=new WeakSet,Ll={})}}function M_(t,e=!1,n=!1){const r=Xe(t[0]).body;return R_(t.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,e,n)}const O_=parseInt(x.version,10);function Vm(t){return O_>=t}function ib(t){if(!x.isValidElement(t))return null;const e=t,n=e.props;return(Vm(19)?n?.ref:e.ref)??null}function Rp(t,e){if(t&&!e)return t;if(!t&&e)return e;if(t||e)return{...t,...e}}function __(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 N_(t,e){return typeof t=="function"?t(e):t}function P_(t,e){return typeof t=="function"?t(e):t}const _a={};function Xi(t,e,n,r,o){let s={...Mp(t,_a)};return e&&(s=va(s,e)),n&&(s=va(s,n)),r&&(s=va(s,r)),o&&(s=va(s,o)),s}function $_(t){if(t.length===0)return _a;if(t.length===1)return Mp(t[0],_a);let e={...Mp(t[0],_a)};for(let n=1;n<t.length;n+=1)e=va(e,t[n]);return e}function va(t,e){return w1(e)?e(t):A_(t,e)}function A_(t,e){if(!e)return t;for(const n in e){const r=e[n];switch(n){case"style":{t[n]=Rp(t.style,r);break}case"className":{t[n]=k1(t.className,r);break}default:I_(n,r)?t[n]=D_(t[n],r):t[n]=r}}return t}function I_(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 w1(t){return typeof t=="function"}function Mp(t,e){return w1(t)?t(e):t??_a}function D_(t,e){return e?t?n=>{if(z_(n)){const o=n;Op(o);const s=e(o);return o.baseUIHandlerPrevented||t?.(o),s}const r=e(n);return t?.(n),r}:e:t}function Op(t){return t.preventBaseUIHandler=()=>{t.baseUIHandlerPrevented=!0},t}function k1(t,e){return e?t?e+" "+t:e:t}function z_(t){return t!=null&&typeof t=="object"&&"nativeEvent"in t}function at(t,e,n={}){const r=e.render,o=j_(e,n);if(n.enabled===!1)return null;const s=n.state??jt;return F_(t,r,o,s)}function j_(t,e={}){const{className:n,style:r,render:o}=t,{state:s=jt,ref:i,props:a,stateAttributesMapping:l,enabled:c=!0}=e,u=c?N_(n,s):void 0,d=c?P_(r,s):void 0,f=c?__(s,l):jt,h=c?Rp(f,Array.isArray(a)?$_(a):a)??jt:jt;return typeof document<"u"&&(c?Array.isArray(i)?h.ref=x_([h.ref,ib(o),...i]):h.ref=Wr(h.ref,ib(o),i):Wr(null,null)),c?(u!==void 0&&(h.className=k1(h.className,u)),d!==void 0&&(h.style=Rp(h.style,d)),h):jt}const L_=Symbol.for("react.lazy");function F_(t,e,n,r){if(e){if(typeof e=="function")return e(n,r);const o=Xi(n,e.props);o.ref=n.ref;let s=e;return s?.$$typeof===L_&&(s=x.Children.toArray(e)[0]),x.cloneElement(s,o)}if(t&&typeof t=="string")return B_(t,n);throw new Error(en(8))}function B_(t,e){return t==="button"?x.createElement("button",{type:"button",...e,key:e.key}):t==="img"?x.createElement("img",{alt:"",...e,key:e.key}):x.createElement(t,e)}const x1=x.createContext(null),S1=()=>x.useContext(x1),V_=Ua("portal");function W_(t={}){const{ref:e,container:n,componentProps:r=jt,elementProps:o}=t,s=Ji(),a=S1()?.portalNode,[l,c]=x.useState(null),[u,d]=x.useState(null),f=ye(g=>{g!==null&&d(g)}),h=x.useRef(null);ve(()=>{if(n===null){h.current&&(h.current=null,d(null),c(null));return}if(s==null)return;const g=(n&&(Pm(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=at("div",r,{ref:[e,f],props:[{id:s,[V_]:""},o]});return{portalNode:u,portalSubtree:l&&p?Xn.createPortal(p,l):null}}const Wm=x.forwardRef(function(e,n){const{children:r,container:o,className:s,render:i,renderGuards:a,...l}=e,{portalNode:c,portalSubtree:u}=W_({container:o,ref:n,componentProps:e,elementProps:l}),d=x.useRef(null),f=x.useRef(null),h=x.useRef(null),p=x.useRef(null),[m,g]=x.useState(null),y=m?.modal,b=m?.open,w=typeof a=="boolean"?a:!!m&&!m.modal&&m.open&&!!c;x.useEffect(()=>{if(!c||y)return;function v(S){c&&S.relatedTarget&&bi(S)&&(S.type==="focusin"?tb:a_)(c)}return c.addEventListener("focusin",v,!0),c.addEventListener("focusout",v,!0),()=>{c.removeEventListener("focusin",v,!0),c.removeEventListener("focusout",v,!0)}},[c,y]),x.useEffect(()=>{!c||b||tb(c)},[b,c]);const k=x.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:h,afterInsideRef:p,portalNode:c,setFocusManagerState:g}),[c]);return C.jsxs(x.Fragment,{children:[u,C.jsxs(x1.Provider,{value:k,children:[w&&c&&C.jsx(Ai,{"data-type":"outside",ref:d,onFocus:v=>{if(bi(v,c))h.current?.focus();else{const S=m?m.domReference:null;a1(S)?.focus()}}}),w&&c&&C.jsx("span",{"aria-owns":c.id,style:b_}),c&&Xn.createPortal(r,c),w&&c&&C.jsx(Ai,{"data-type":"outside",ref:f,onFocus:v=>{if(bi(v,c))p.current?.focus();else{const S=m?m.domReference:null;Fm(S)?.focus(),m?.closeOnFocusOut&&m?.onOpenChange(!1,He(ys,v.nativeEvent))}}})]})]})});function Nr(t){return t==null?t:"current"in t?t.current:t}function H_(t,e){const n=Pt(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 ab=20;let lo=[];function Hm(){lo=lo.filter(t=>t.deref()?.isConnected)}function q_(t){Hm(),t&&No(t)!=="body"&&(lo.push(new WeakRef(t)),lo.length>ab&&(lo=lo.slice(-ab)))}function nh(){return Hm(),lo[lo.length-1]?.deref()}function U_(t){if(!t)return null;const e=Zi();return s1(t,e)?t:gl(t,e)[0]||t}function K_(t){return!t||!t.isConnected?!1:typeof t.checkVisibility=="function"?t.checkVisibility():On(t).display!=="none"}function lb(t,e){if(!e.current.includes("floating")&&!t.getAttribute("role")?.includes("dialog"))return;const n=Zi(),o=o_(t,n).filter(i=>{const a=i.getAttribute("data-tabindex")||"";return s1(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 qm(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=ye(()=>w.current.floatingContext?.nodeId),v=o===!1,S=kp(g)&&v,E=x.useRef(["content"]),M=Bt(o),D=Bt(s),F=Bt(c),N=_s(h),A=S1(),z=x.useRef(null),B=x.useRef(null),U=x.useRef(!1),J=x.useRef(!1),Y=x.useRef(!1),K=x.useRef(-1),G=x.useRef(""),L=x.useRef(""),W=x.useRef(null),$=x.useRef(null),j=Wr(W,f,A?.beforeInsideRef),R=Wr($,A?.afterInsideRef),P=Rn(),I=Rn(),Z=of(),X=A!=null,_=Ha(y),q=ye((V=_)=>V?gl(V,Zi()):[]),T=ye(V=>{const H=q(V);return E.current.map(()=>H).filter(Boolean).flat()});x.useEffect(()=>{if(r||!a)return;function V(Q){Q.key==="Tab"&&Ye(_,qn(Xe(_)))&&q().length===0&&!S&&Jt(Q)}const H=Xe(_);return H.addEventListener("keydown",V),()=>{H.removeEventListener("keydown",V)}},[r,g,_,a,E,S,q,T]),x.useEffect(()=>{if(r||!m)return;const V=Xe(_);function H(){Y.current=!1}function Q(re){const oe=Sn(re),ne=Ye(y,oe)||Ye(g,oe)||Ye(A?.portalNode,oe);Y.current=!ne,L.current=re.pointerType||"keyboard",oe?.closest(`[${f1}]`)&&(J.current=!0)}function ee(){L.current="keyboard"}return V.addEventListener("pointerdown",Q,!0),V.addEventListener("pointerup",H,!0),V.addEventListener("pointercancel",H,!0),V.addEventListener("keydown",ee,!0),()=>{V.removeEventListener("pointerdown",Q,!0),V.removeEventListener("pointerup",H,!0),V.removeEventListener("pointercancel",H,!0),V.removeEventListener("keydown",ee,!0)}},[r,y,g,_,m,A]),x.useEffect(()=>{if(r||!l)return;const V=Xe(_);function H(){J.current=!0,I.start(0,()=>{J.current=!1})}function Q(le){const te=Sn(le),ge=q().indexOf(te);ge!==-1&&(K.current=ge)}function ee(le){const te=le.relatedTarget,fe=le.currentTarget,ge=Sn(le);queueMicrotask(()=>{const pe=k(),Le=p.context.triggerElements,qe=te?.hasAttribute(Ua("focus-guard"))&&[W.current,$.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,Nr(d),Nr(u)].includes(te),Je=!(Ye(g,te)||Ye(y,te)||Ye(te,y)||Ye(A?.portalNode,te)||te!=null&&Le.hasElement(te)||Le.hasMatchingElement(Me=>Ye(Me,te))||qe||N&&(ls(N.nodesRef.current,pe).find(Me=>Ye(Me.context?.elements.floating,te)||Ye(Me.context?.elements.domReference,te))||Jy(N.nodesRef.current,pe).find(Me=>[Me.context?.elements.floating,Ha(Me.context?.elements.floating)].includes(te)||Me.context?.elements.domReference===te)));if(fe===g&&_&&lb(_,E),i&&fe!==g&&!K_(ge)&&qn(V)===V.body){if(xt(_)&&(_.focus(),i==="popup")){Z.request(()=>{_.focus()});return}const Me=K.current,Oe=q(),ze=Oe[Me]||Oe[Oe.length-1]||_;xt(ze)&&ze.focus()}if(w.current.insideReactTree){w.current.insideReactTree=!1;return}(S||!a)&&te&&Je&&!J.current&&(S||te!==nh())&&(U.current=!0,p.setOpen(!1,He(ys,le)))})}function re(){Y.current||(w.current.insideReactTree=!0,P.start(0,()=>{w.current.insideReactTree=!1}))}const oe=xt(g)?g:null,ne=[];if(!(!y&&!oe))return oe&&(oe.addEventListener("focusout",ee),oe.addEventListener("pointerdown",H),ne.push(()=>{oe.removeEventListener("focusout",ee),oe.removeEventListener("pointerdown",H)})),y&&(y.addEventListener("focusin",Q),y.addEventListener("focusout",ee),A&&(y.addEventListener("focusout",re,!0),ne.push(()=>{y.removeEventListener("focusout",re,!0)})),ne.push(()=>{y.removeEventListener("focusin",Q),y.removeEventListener("focusout",ee)})),()=>{ne.forEach(le=>{le()})}},[r,g,y,_,a,N,A,p,l,i,q,S,k,E,w,P,I,Z,u,d]),x.useEffect(()=>{if(r||!y||!m)return;const V=Array.from(A?.portalNode?.querySelectorAll(`[${Ua("portal")}]`)||[]),Q=(N?Jy(N.nodesRef.current,k()):[]).find(re=>kp(re.context?.elements.domReference||null))?.context?.elements.domReference,ee=[y,Q,...V,z.current,B.current,W.current,$.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,Nr(d),Nr(u),S?g:null].filter(re=>re!=null);return M_(ee,a||S)},[m,r,g,y,a,E,A,S,N,k,u,d]),ve(()=>{if(!m||r||!xt(_))return;const V=Xe(_),H=qn(V);queueMicrotask(()=>{const Q=T(_),ee=M.current,re=typeof ee=="function"?ee(F.current||""):ee;if(re===void 0||re===!1)return;let oe;re===!0||re===null?oe=Q[0]||_:oe=Nr(re),oe=oe||Q[0]||_,!Ye(_,H)&&Oa(oe,{preventScroll:oe===_})})},[r,m,_,v,T,M,F]),ve(()=>{if(r||!_)return;const V=Xe(_),H=qn(V);q_(H);function Q(oe){if(oe.open||(G.current=H_(oe.nativeEvent,L.current)),oe.reason===Cn&&oe.nativeEvent.type==="mouseleave"&&(U.current=!0),oe.reason===Bm)if(oe.nested)U.current=!1;else if(qx(oe.nativeEvent)||Ux(oe.nativeEvent))U.current=!1;else{let ne=!1;document.createElement("div").focus({get preventScroll(){return ne=!0,!1}}),ne?U.current=!1:U.current=!0}}b.on("openchange",Q);const ee=V.createElement("span");ee.setAttribute("tabindex","-1"),ee.setAttribute("aria-hidden","true"),Object.assign(ee.style,rf),X&&g&&g.insertAdjacentElement("afterend",ee);function re(){const oe=D.current;let ne=typeof oe=="function"?oe(G.current):oe;if(ne===void 0||ne===!1)return null;if(ne===null&&(ne=!0),typeof ne=="boolean"){const te=g||nh();return te&&te.isConnected?te:ee}const le=g||nh()||ee;return Nr(ne)||le}return()=>{b.off("openchange",Q);const oe=qn(V),ne=Ye(y,oe)||N&&ls(N.nodesRef.current,k(),!1).some(te=>Ye(te.context?.elements.floating,oe)),le=re();queueMicrotask(()=>{const te=U_(le),fe=typeof D.current!="boolean";D.current&&!U.current&&xt(te)&&(!(!fe&&te!==oe&&oe!==V.body)||ne)&&te.focus({preventScroll:!0}),ee.remove(),U.current=!1})}},[r,y,_,D,w,b,N,X,g,k]),ve(()=>{if(!Am||m||!y)return;const V=qn(Xe(y));!xt(V)||!Dm(V)||Ye(y,V)&&V.blur()},[m,y]),ve(()=>{if(!(r||!A))return A.setFocusManagerState({modal:a,closeOnFocusOut:l,open:m,onOpenChange:p.setOpen,domReference:g}),()=>{A.setFocusManagerState(null)}},[r,A,a,m,p,l,g]),ve(()=>{if(!(r||!_))return lb(_,E),()=>{queueMicrotask(Hm)}},[r,_,E]);const O=!r&&(a?!S:!0)&&(X||a);return C.jsxs(x.Fragment,{children:[O&&C.jsx(Ai,{"data-type":"inside",ref:j,onFocus:V=>{if(a){const H=T();Oa(H[H.length-1])}else A?.portalNode&&(U.current=!1,bi(V,A.portalNode)?Fm(g)?.focus():Nr(d??A.beforeOutsideRef)?.focus())}}),n,O&&C.jsx(Ai,{"data-type":"inside",ref:R,onFocus:V=>{a?Oa(T()[0]):A?.portalNode&&(l&&(U.current=!0),bi(V,A.portalNode)?a1(g)?.focus():Nr(u??A.afterOutsideRef)?.focus())}})]})}function E1(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=$i}=e,d=x.useRef(void 0),f=of(),h=Rn(),p=x.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"||_i(g,!0)&&a)return;const w=r.current.openEvent,k=w?.type,v=n.select("domReferenceElement")!==m.currentTarget,S=b&&v||!(b&&i&&(!(w&&l)||k==="click"||k==="mousedown"));if(Dm(y.target)){const M=He(u,y,y.target);S&&g==="touch"&&c>0?h.start(c,()=>{n.setOpen(!0,M)}):n.setOpen(S,M);return}const E=m.currentTarget;f.request(()=>{const M=He(u,y,E);S&&g==="touch"&&c>0?h.start(c,()=>{n.setOpen(!0,M)}):n.setOpen(S,M)})},onClick(m){if(s==="mousedown-only")return;const g=d.current;if(s==="mousedown"&&g){d.current=void 0;return}if(_i(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)||Kx(b))),v=He(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 x.useMemo(()=>o?{reference:p}:jt,[o,p])}function cb(t,e,n){let{reference:r,floating:o}=t;const s=zn(e),i=Lm(e),a=jm(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($o(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 Y_(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}=Vr(e,t),p=Yx(h),g=a[f?d==="floating"?"reference":"floating":d],y=Au(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=Au(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 G_=50,Z_=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:Y_},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}=cb(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:S}=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},S&&h<G_&&(h++,typeof S=="object"&&(S.placement&&(f=S.placement),S.rects&&(c=S.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:o}):S.rects),{x:u,y:d}=cb(c,f,l)),m=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:p}},J_=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}=Vr(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=gn(o),b=zn(a),w=gn(a)===a,k=await(l.isRTL==null?void 0:l.isRTL(c.floating)),v=f||(w||!m?[$u(a)]:jO(a)),S=p!=="none";!f&&S&&v.push(...VO(a,m,p,k));const E=[a,...v],M=await l.detectOverflow(e,g),D=[];let F=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&D.push(M[y]),d){const B=zO(o,i,k);D.push(M[B[0]],M[B[1]])}if(F=[...F,{placement:o,overflows:D}],!D.every(B=>B<=0)){var N,A;const B=(((N=s.flip)==null?void 0:N.index)||0)+1,U=E[B];if(U&&(!(d==="alignment"?b!==zn(U):!1)||F.every(K=>zn(K.placement)===b?K.overflows[0]>0:!0)))return{data:{index:B,overflows:F},reset:{placement:U}};let J=(A=F.filter(Y=>Y.overflows[0]<=0).sort((Y,K)=>Y.overflows[1]-K.overflows[1])[0])==null?void 0:A.placement;if(!J)switch(h){case"bestFit":{var z;const Y=(z=F.filter(K=>{if(S){const G=zn(K.placement);return G===b||G==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(G=>G>0).reduce((G,L)=>G+L,0)]).sort((K,G)=>K[1]-G[1])[0])==null?void 0:z[0];Y&&(J=Y);break}case"initialPlacement":J=a;break}if(o!==J)return{reset:{placement:J}}}return{}}}};function ub(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function db(t){return IO.some(e=>t[e]>=0)}const X_=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:o="referenceHidden",...s}=Vr(t,e);switch(o){case"referenceHidden":{const i=await r.detectOverflow(e,{...s,elementContext:"reference"}),a=ub(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:db(a)}}}case"escaped":{const i=await r.detectOverflow(e,{...s,altBoundary:!0}),a=ub(i,n.floating);return{data:{escapedOffsets:a,escaped:db(a)}}}default:return{}}}}},C1=new Set(["left","top"]);async function Q_(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=$o(n),l=zn(n)==="y",c=C1.has(i)?-1:1,u=s&&l?-1:1,d=Vr(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 eN=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 Q_(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}}}}},tN=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}=Vr(t,e),u={x:n,y:r},d=await s.detectOverflow(e,c),f=zn(gn(o)),h=zm(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=xp(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=xp(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}}}}}},nN=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}=Vr(t,e),u={x:n,y:r},d=zn(o),f=zm(d);let h=u[f],p=u[d];const m=Vr(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=C1.has(gn(o)),v=s.reference[d]-s.floating[w]+(k&&((y=i.offset)==null?void 0:y[d])||0)+(k?0:g.crossAxis),S=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>S&&(p=S)}return{[f]:h,[d]:p}}}},rN=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}=Vr(t,e),u=await i.detectOverflow(e,c),d=gn(o),f=$o(o),h=zn(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=Ni(m-u[g],b),v=Ni(p-u[y],w),S=!e.middlewareData.shift;let E=k,M=v;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(M=w),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(E=b),S&&!f){const F=En(u.left,0),N=En(u.right,0),A=En(u.top,0),z=En(u.bottom,0);h?M=p-2*(F!==0||N!==0?F+N:En(u.left,u.right)):E=m-2*(A!==0||z!==0?A+z:En(u.top,u.bottom))}await l({...e,availableWidth:M,availableHeight:E});const D=await i.getDimensions(a.floating);return p!==D.width||m!==D.height?{reset:{rects:!0}}:{}}}};function T1(t){const e=On(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=xt(t),s=o?t.offsetWidth:n,i=o?t.offsetHeight:r,a=Pu(n)!==s||Pu(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function Um(t){return rt(t)?t:t.contextElement}function wi(t){const e=Um(t);if(!xt(e))return hr(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:s}=T1(e);let i=(s?Pu(n.width):n.width)/r,a=(s?Pu(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const oN=hr(0);function R1(t){const e=Pt(t);return!tf()||!e.visualViewport?oN:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function sN(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Pt(t)?!1:e}function bs(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),s=Um(t);let i=hr(1);e&&(r?rt(r)&&(i=wi(r)):i=wi(t));const a=sN(s,n,r)?R1(s):hr(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=Pt(s),h=r&&rt(r)?Pt(r):r;let p=f,m=bp(p);for(;m&&r&&h!==p;){const g=wi(m),y=m.getBoundingClientRect(),b=On(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=Pt(m),m=bp(p)}}return Au({width:u,height:d,x:l,y:c})}function sf(t,e){const n=nf(t).scrollLeft;return e?e.left+n:bs(br(t)).left+n}function M1(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-sf(t,n),o=n.top+e.scrollTop;return{x:r,y:o}}function iN(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const s=o==="fixed",i=br(r),a=e?ef(e.floating):!1;if(r===i||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=hr(1);const u=hr(0),d=xt(r);if((d||!d&&!s)&&((No(r)!=="body"||Po(i))&&(l=nf(r)),d)){const h=bs(r);c=wi(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const f=i&&!d&&!s?M1(i,l):hr(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 aN(t){return Array.from(t.getClientRects())}function lN(t){const e=br(t),n=nf(t),r=t.ownerDocument.body,o=En(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=En(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+sf(t);const a=-n.scrollTop;return On(r).direction==="rtl"&&(i+=En(e.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const fb=25;function cN(t,e){const n=Pt(t),r=br(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=tf();(!u||u&&e==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}const c=sf(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<=fb&&(s-=p)}else c<=fb&&(s+=c);return{width:s,height:i,x:a,y:l}}function uN(t,e){const n=bs(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,s=xt(t)?wi(t):hr(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 hb(t,e,n){let r;if(e==="viewport")r=cN(t,n);else if(e==="document")r=lN(br(t));else if(rt(e))r=uN(e,n);else{const o=R1(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return Au(r)}function O1(t,e){const n=Br(t);return n===e||!rt(n)||zr(n)?!1:On(n).position==="fixed"||O1(n,e)}function dN(t,e){const n=e.get(t);if(n)return n;let r=ho(t,[],!1).filter(a=>rt(a)&&No(a)!=="body"),o=null;const s=On(t).position==="fixed";let i=s?Br(t):t;for(;rt(i)&&!zr(i);){const a=On(i),l=$m(i);!l&&a.position==="fixed"&&(o=null),(s?!l&&!o:!l&&a.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Po(i)&&!l&&O1(t,i))?r=r.filter(u=>u!==i):o=a,i=Br(i)}return e.set(t,r),r}function fN(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const i=[...n==="clippingAncestors"?ef(e)?[]:dN(e,this._c):[].concat(n),r],a=hb(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=hb(e,i[f],o);l=En(h.top,l),c=Ni(h.right,c),u=Ni(h.bottom,u),d=En(h.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function hN(t){const{width:e,height:n}=T1(t);return{width:e,height:n}}function pN(t,e,n){const r=xt(e),o=br(e),s=n==="fixed",i=bs(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=hr(0);function c(){l.x=sf(o)}if(r||!r&&!s)if((No(e)!=="body"||Po(o))&&(a=nf(e)),r){const h=bs(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?M1(o,a):hr(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 rh(t){return On(t).position==="static"}function pb(t,e){if(!xt(t)||On(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return br(t)===n&&(n=n.ownerDocument.body),n}function _1(t,e){const n=Pt(t);if(ef(t))return n;if(!xt(t)){let o=Br(t);for(;o&&!zr(o);){if(rt(o)&&!rh(o))return o;o=Br(o)}return n}let r=pb(t,e);for(;r&&wO(r)&&rh(r);)r=pb(r,e);return r&&zr(r)&&rh(r)&&!$m(r)?n:r||SO(t)||n}const mN=async function(t){const e=this.getOffsetParent||_1,n=this.getDimensions,r=await n(t.floating);return{reference:pN(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function gN(t){return On(t).direction==="rtl"}const yN={convertOffsetParentRelativeRectToViewportRelativeRect:iN,getDocumentElement:br,getClippingRect:fN,getOffsetParent:_1,getElementRects:mN,getClientRects:aN,getDimensions:hN,getScale:wi,isElement:rt,isRTL:gN};function N1(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function bN(t,e){let n=null,r;const o=br(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=fi(d),m=fi(o.clientWidth-(u+f)),g=fi(o.clientHeight-(d+h)),y=fi(u),w={rootMargin:-p+"px "+-m+"px "+-g+"px "+-y+"px",threshold:En(0,Ni(1,l))||1};let k=!0;function v(S){const E=S[0].intersectionRatio;if(E!==l){if(!k)return i();E?i(!1,E):r=setTimeout(()=>{i(!1,1e-7)},1e3)}E===1&&!N1(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 mb(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=Um(t),u=o||s?[...c?ho(c):[],...e?ho(e):[]]:[];u.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const d=c&&a?bN(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?bs(t):null;l&&g();function g(){const y=bs(t);m&&!N1(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 vN=eN,wN=tN,kN=J_,xN=rN,SN=X_,EN=nN,CN=(t,e,n)=>{const r=new Map,o={platform:yN,...n},s={...o.platform,_c:r};return Z_(t,e,{...o,platform:s})};var TN=typeof document<"u",RN=function(){},xu=TN?x.useLayoutEffect:RN;function Lu(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(!Lu(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)&&!Lu(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function P1(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function gb(t,e){const n=P1(t);return Math.round(e*n)/n}function oh(t){const e=x.useRef(t);return xu(()=>{e.current=t}),e}function MN(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]=x.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=x.useState(r);Lu(f,r)||h(r);const[p,m]=x.useState(null),[g,y]=x.useState(null),b=x.useCallback(K=>{K!==S.current&&(S.current=K,m(K))},[]),w=x.useCallback(K=>{K!==E.current&&(E.current=K,y(K))},[]),k=s||p,v=i||g,S=x.useRef(null),E=x.useRef(null),M=x.useRef(u),D=l!=null,F=oh(l),N=oh(o),A=oh(c),z=x.useCallback(()=>{if(!S.current||!E.current)return;const K={placement:e,strategy:n,middleware:f};N.current&&(K.platform=N.current),CN(S.current,E.current,K).then(G=>{const L={...G,isPositioned:A.current!==!1};B.current&&!Lu(M.current,L)&&(M.current=L,Xn.flushSync(()=>{d(L)}))})},[f,e,n,N,A]);xu(()=>{c===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,d(K=>({...K,isPositioned:!1})))},[c]);const B=x.useRef(!1);xu(()=>(B.current=!0,()=>{B.current=!1}),[]),xu(()=>{if(k&&(S.current=k),v&&(E.current=v),k&&v){if(F.current)return F.current(k,v,z);z()}},[k,v,z,F,D]);const U=x.useMemo(()=>({reference:S,floating:E,setReference:b,setFloating:w}),[b,w]),J=x.useMemo(()=>({reference:k,floating:v}),[k,v]),Y=x.useMemo(()=>{const K={position:n,left:0,top:0};if(!J.floating)return K;const G=gb(J.floating,u.x),L=gb(J.floating,u.y);return a?{...K,transform:"translate("+G+"px, "+L+"px)",...P1(J.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:G,top:L}},[n,a,J.floating,u.x,u.y]);return x.useMemo(()=>({...u,update:z,refs:U,elements:J,floatingStyles:Y}),[u,z,U,J,Y])}const ON=(t,e)=>{const n=vN(t);return{name:n.name,fn:n.fn,options:[t,e]}},_N=(t,e)=>{const n=wN(t);return{name:n.name,fn:n.fn,options:[t,e]}},NN=(t,e)=>({fn:EN(t).fn,options:[t,e]}),PN=(t,e)=>{const n=kN(t);return{name:n.name,fn:n.fn,options:[t,e]}},$N=(t,e)=>{const n=xN(t);return{name:n.name,fn:n.fn,options:[t,e]}},AN=(t,e)=>{const n=SN(t);return{name:n.name,fn:n.fn,options:[t,e]}},IN={intentional:"onClick",sloppy:"onPointerDown"};function DN(t){return{escapeKey:typeof t=="boolean"?t:t?.escapeKey??!1,outsidePress:typeof t=="boolean"?t:t?.outsidePress??!0}}function Km(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=_s(y),w=ye(typeof d=="function"?d:()=>!1),k=typeof d=="function"?w:d,v=x.useRef(!1),{escapeKey:S,outsidePress:E}=DN(g),M=x.useRef(null),D=Rn(),F=Rn(),N=ye(()=>{F.clear(),l.current.insideReactTree=!1}),A=x.useRef(!1),z=x.useRef(""),B=ye(O=>{z.current=O.pointerType}),U=ye(()=>{const O=z.current,V=O==="pen"||!O?"mouse":O,H=typeof f=="function"?f():f;return typeof H=="string"?H:H[V]}),J=ye(O=>{if(!r||!c||!u||O.key!=="Escape"||A.current)return;const V=l.current.floatingContext?.nodeId,H=b?ls(b.nodesRef.current,V):[];if(!S&&H.length>0){let re=!0;if(H.forEach(oe=>{oe.context?.open&&!oe.context.dataRef.current.__escapeKeyBubbles&&(re=!1)}),!re)return}const Q=AO(O)?O.nativeEvent:O,ee=He(h1,Q);n.setOpen(!1,ee),!S&&!ee.isPropagationAllowed&&O.stopPropagation()}),Y=ye(O=>{const V=U();return V==="intentional"&&O.type!=="click"||V==="sloppy"&&O.type==="click"}),K=ye(()=>{l.current.insideReactTree=!0,F.start(0,N)}),G=ye((O,V=!1)=>{if(Y(O)){N();return}if(l.current.insideReactTree){N();return}if(U()==="intentional"&&V||typeof k=="function"&&!k(O))return;const H=Sn(O),Q=`[${Ua("inert")}]`,ee=Xe(n.select("floatingElement")).querySelectorAll(Q),re=n.context.triggerElements;if(H&&(re.hasElement(H)||re.hasMatchingElement(fe=>Ye(fe,H))))return;let oe=rt(H)?H:null;for(;oe&&!zr(oe);){const fe=Br(oe);if(zr(fe)||!rt(fe))break;oe=fe}if(ee.length&&rt(H)&&!$O(H)&&!Ye(H,n.select("floatingElement"))&&Array.from(ee).every(fe=>!Ye(oe,fe)))return;if(xt(H)&&!("touches"in O)){const fe=zr(H),ge=On(H),pe=/auto|scroll/,Le=fe||pe.test(ge.overflowX),qe=fe||pe.test(ge.overflowY),Je=Le&&H.clientWidth>0&&H.scrollWidth>H.clientWidth,Me=qe&&H.clientHeight>0&&H.scrollHeight>H.clientHeight,Oe=ge.direction==="rtl",ze=Me&&(Oe?O.offsetX<=H.offsetWidth-H.clientWidth:O.offsetX>H.clientWidth),Be=Je&&O.offsetY>H.clientHeight;if(ze||Be)return}const ne=l.current.floatingContext?.nodeId,le=b&&ls(b.nodesRef.current,ne).some(fe=>Bn(O,fe.context?.elements.floating));if(Bn(O,n.select("floatingElement"))||Bn(O,n.select("domReferenceElement"))||le)return;const te=b?ls(b.nodesRef.current,ne):[];if(te.length>0){let fe=!0;if(te.forEach(ge=>{ge.context?.open&&!ge.context.dataRef.current.__outsidePressBubbles&&(fe=!1)}),!fe)return}n.setOpen(!1,He(Bm,O)),N()}),L=ye(O=>{U()!=="sloppy"||O.pointerType==="touch"||!n.select("open")||!c||Bn(O,n.select("floatingElement"))||Bn(O,n.select("domReferenceElement"))||G(O)}),W=ye(O=>{if(U()!=="sloppy"||!n.select("open")||!c||Bn(O,n.select("floatingElement"))||Bn(O,n.select("domReferenceElement")))return;const V=O.touches[0];V&&(M.current={startTime:Date.now(),startX:V.clientX,startY:V.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},D.start(1e3,()=>{M.current&&(M.current.dismissOnTouchEnd=!1,M.current.dismissOnMouseDown=!1)}))}),$=ye(O=>{const V=Sn(O);function H(){W(O),V?.removeEventListener(O.type,H)}V?.addEventListener(O.type,H)}),j=ye(O=>{const V=v.current;if(v.current=!1,D.clear(),O.type==="mousedown"&&M.current&&!M.current.dismissOnMouseDown)return;const H=Sn(O);function Q(){O.type==="pointerdown"?L(O):G(O,V),H?.removeEventListener(O.type,Q)}H?.addEventListener(O.type,Q)}),R=ye(O=>{if(U()!=="sloppy"||!M.current||Bn(O,n.select("floatingElement"))||Bn(O,n.select("domReferenceElement")))return;const V=O.touches[0];if(!V)return;const H=Math.abs(V.clientX-M.current.startX),Q=Math.abs(V.clientY-M.current.startY),ee=Math.sqrt(H*H+Q*Q);ee>5&&(M.current.dismissOnTouchEnd=!0),ee>10&&(G(O),D.clear(),M.current=null)}),P=ye(O=>{const V=Sn(O);function H(){R(O),V?.removeEventListener(O.type,H)}V?.addEventListener(O.type,H)}),I=ye(O=>{U()!=="sloppy"||!M.current||Bn(O,n.select("floatingElement"))||Bn(O,n.select("domReferenceElement"))||(M.current.dismissOnTouchEnd&&G(O),D.clear(),M.current=null)}),Z=ye(O=>{const V=Sn(O);function H(){I(O),V?.removeEventListener(O.type,H)}V?.addEventListener(O.type,H)});x.useEffect(()=>{if(!r||!c)return;l.current.__escapeKeyBubbles=S,l.current.__outsidePressBubbles=E;const O=new gs;function V(oe){n.setOpen(!1,He(Eo,oe))}function H(){O.clear(),A.current=!0}function Q(){O.start(tf()?5:0,()=>{A.current=!1})}const ee=Xe(o);ee.addEventListener("pointerdown",B,!0),u&&(ee.addEventListener("keydown",J),ee.addEventListener("compositionstart",H),ee.addEventListener("compositionend",Q)),k&&(ee.addEventListener("click",j,!0),ee.addEventListener("pointerdown",j,!0),ee.addEventListener("touchstart",$,!0),ee.addEventListener("touchmove",P,!0),ee.addEventListener("touchend",Z,!0),ee.addEventListener("mousedown",j,!0));let re=[];return m&&(rt(i)&&(re=ho(i)),rt(o)&&(re=re.concat(ho(o))),!rt(s)&&s&&s.contextElement&&(re=re.concat(ho(s.contextElement)))),re=re.filter(oe=>oe!==ee.defaultView?.visualViewport),re.forEach(oe=>{oe.addEventListener("scroll",V,{passive:!0})}),()=>{ee.removeEventListener("pointerdown",B,!0),u&&(ee.removeEventListener("keydown",J),ee.removeEventListener("compositionstart",H),ee.removeEventListener("compositionend",Q)),k&&(ee.removeEventListener("click",j,!0),ee.removeEventListener("pointerdown",j,!0),ee.removeEventListener("touchstart",$,!0),ee.removeEventListener("touchmove",P,!0),ee.removeEventListener("touchend",Z,!0),ee.removeEventListener("mousedown",j,!0)),re.forEach(oe=>{oe.removeEventListener("scroll",V)}),O.clear(),v.current=!1}},[l,o,s,i,u,k,r,a,m,c,S,E,J,G,j,L,$,P,Z,B,n]),x.useEffect(N,[k,N]);const X=x.useMemo(()=>({onKeyDown:J,...h&&{[IN[p]]:O=>{n.setOpen(!1,He($i,O.nativeEvent))},...p!=="intentional"&&{onClick(O){n.setOpen(!1,He($i,O.nativeEvent))}}}}),[J,n,h,p]),_=ye(O=>{const V=Sn(O.nativeEvent);!Ye(n.select("floatingElement"),V)||O.button!==0||(v.current=!0)}),q=ye(O=>{!r||!c||O.button!==0||(v.current=!0)}),T=x.useMemo(()=>({onKeyDown:J,onPointerDown:_,onMouseDown:_,onMouseUp:_,onClickCapture:K,onMouseDownCapture(O){K(),q(O)},onPointerDownCapture(O){K(),q(O)},onMouseUpCapture:K,onTouchEndCapture:K,onTouchMoveCapture:K}),[J,_,K,q]);return x.useMemo(()=>c?{reference:X,floating:T,trigger:X}:{},[c,X,T])}var Fu=Symbol("NOT_FOUND");function zN(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function jN(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function LN(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 yb=t=>Array.isArray(t)?t:[t];function FN(t){const e=Array.isArray(t[0])?t[0]:t;return LN(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function BN(t,e){const n=[],{length:r}=t;for(let o=0;o<r;o++)n.push(t[o].apply(null,e));return n}function VN(t){let e;return{get(n){return e&&t(e.key,n)?e.value:Fu},put(n,r){e={key:n,value:r}},getEntries(){return e?[e]:[]},clear(){e=void 0}}}function WN(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 Fu}function o(a,l){r(a)===Fu&&(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 HN=(t,e)=>t===e;function qN(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 UN(t,e){const n=typeof e=="object"?e:{equalityCheck:e},{equalityCheck:r=HN,maxSize:o=1,resultEqualityCheck:s}=n,i=qN(r);let a=0;const l=o<=1?VN(i):WN(o,i);function c(){let u=l.get(arguments);if(u===Fu){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 KN=class{constructor(t){this.value=t}deref(){return this.value}},YN=typeof WeakRef<"u"?WeakRef:KN,GN=0,bb=1;function Fl(){return{s:GN,v:void 0,o:null,p:null}}function $1(t,e={}){let n=Fl();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=Fl(),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=Fl(),p.set(h,a)):a=m}}const c=a;let u;if(a.s===bb)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 YN(u):u}return c.s=bb,c.v=u,u}return i.clearCache=()=>{n=Fl(),i.resetResultsCount()},i.resultsCount=()=>s,i.resetResultsCount=()=>{s=0},i}function A1(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()),zN(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const u={...n,...l},{memoize:d,memoizeOptions:f=[],argsMemoize:h=$1,argsMemoizeOptions:p=[]}=u,m=yb(f),g=yb(p),y=FN(o),b=d(function(){return s++,c.apply(null,arguments)},...m),w=h(function(){i++;const v=BN(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 ZN=A1($1),JN=Object.assign((t,e=ZN)=>{jN(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:()=>JN});A1({memoize:UN,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const we=(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 Ym=yO();const XN=Vm(19),QN=XN?tP:nP;function Ne(t,e,n,r,o){return QN(t,e,n,r,o)}function eP(t,e,n,r,o){const s=x.useCallback(()=>e(t.getSnapshot(),n,r,o),[t,e,n,r,o]);return Ym.useSyncExternalStore(t.subscribe,s,s)}function tP(t,e,n,r,o){return eP(t,e,n,r,o)}function nP(t,e,n,r,o){return Ax.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getSnapshot,s=>e(s,n,r,o))}class I1{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 Ne(this,e,n,r,o)}}class Gm extends I1{constructor(e,n={},r){super(e),this.context=n,this.selectors=r}useSyncedValue(e,n){x.useDebugValue(e),ve(()=>{this.state[e]!==n&&this.set(e,n)},[e,n])}useSyncedValueWithCleanup(e,n){const r=this;ve(()=>(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);ve(()=>{n.update(e)},[n,...r])}useControlledProp(e,n){x.useDebugValue(e);const r=n!==void 0;ve(()=>{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 x.useDebugValue(e),Ne(this,this.selectors[e],n,r,o)}useContextCallback(e,n){x.useDebugValue(e);const r=ye(n??pn);this.context[e]=r}useStateSetter(e){const n=x.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 rP={open:we(t=>t.open),domReferenceElement:we(t=>t.domReferenceElement),referenceElement:we(t=>t.positionReference??t.referenceElement),floatingElement:we(t=>t.floatingElement),floatingId:we(t=>t.floatingId)};class Zm extends Gm{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:c1(),nested:n,noEmit:r,triggerElements:s},rP)}setOpen=(e,n)=>{if((!e||!this.state.open||Kx(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 yl(t,e=!1,n=!1){const[r,o]=x.useState(t&&e?"idle":void 0),[s,i]=x.useState(t);return t&&!s&&(i(!0),o("starting")),!t&&s&&r!=="ending"&&!n&&o("ending"),!t&&!s&&r==="ending"&&o(void 0),ve(()=>{if(!t&&s&&r!=="ending"&&n){const a=cr.request(()=>{o("ending")});return()=>{cr.cancel(a)}}},[t,s,r,n]),ve(()=>{if(!t||e)return;const a=cr.request(()=>{o(void 0)});return()=>{cr.cancel(a)}},[e,t]),ve(()=>{if(!t||!e)return;t&&s&&r!=="idle"&&o("starting");const a=cr.request(()=>{o("idle")});return()=>{cr.cancel(a)}},[e,t,s,o,r]),x.useMemo(()=>({mounted:s,setMounted:i,transitionStatus:r}),[s,r])}let Ka=(function(t){return t.startingStyle="data-starting-style",t.endingStyle="data-ending-style",t})({});const oP={[Ka.startingStyle]:""},sP={[Ka.endingStyle]:""},Qi={transitionStatus(t){return t==="starting"?oP:t==="ending"?sP:null}};function D1(t,e=!1,n=!0){const r=of();return ye((o,s=null)=>{r.cancel();function i(){Xn.flushSync(o)}const a=Nr(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=Ka.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 Io(t){const{enabled:e=!0,open:n,ref:r,onComplete:o}=t,s=ye(o),i=D1(r,n,!1);x.useEffect(()=>{if(!e)return;const a=new AbortController;return i(s,a.signal),()=>{a.abort()}},[e,n,s,i])}function iP(t,e){const n=x.useRef(null),r=x.useRef(null);return x.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 aP(t,e,n,r){const o=n.useState("isMountedByTrigger",t),s=iP(t,n),i=ye(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 ve(()=>{o&&n.update({activeTriggerElement:e.current,...r})},[o,n,e,...Object.values(r)]),{registerTrigger:i,isMountedByThisTrigger:o}}function z1(t){const e=t.useState("open");ve(()=>{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 j1(t,e,n){const{mounted:r,setMounted:o,transitionStatus:s}=yl(t);e.useSyncedValues({mounted:r,transitionStatus:s});const i=ye(()=>{o(!1),e.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),e.context.onOpenChangeComplete?.(!1)}),a=e.useState("preventUnmountingOnClose");return Io({enabled:!a,open:t,ref:e.context.popupRef,onComplete(){t||i()}}),{forceUnmount:i,transitionStatus:s}}class af{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 lP(){return new Zm({open:!1,floatingElement:null,referenceElement:null,triggerElements:new af,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function L1(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:"idle",floatingRootContext:lP(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:jt,inactiveTriggerProps:jt,popupProps:jt}}const Bl=we(t=>t.triggerIdProp??t.activeTriggerId),F1={open:we(t=>t.openProp??t.open),mounted:we(t=>t.mounted),transitionStatus:we(t=>t.transitionStatus),floatingRootContext:we(t=>t.floatingRootContext),preventUnmountingOnClose:we(t=>t.preventUnmountingOnClose),payload:we(t=>t.payload),activeTriggerId:Bl,activeTriggerElement:we(t=>t.mounted?t.activeTriggerElement:null),isTriggerActive:we((t,e)=>e!==void 0&&Bl(t)===e),isOpenedByTrigger:we((t,e)=>e!==void 0&&Bl(t)===e&&t.open),isMountedByTrigger:we((t,e)=>e!==void 0&&Bl(t)===e&&t.mounted),triggerProps:we((t,e)=>e?t.activeTriggerProps:t.inactiveTriggerProps),popupProps:we(t=>t.popupProps),popupElement:we(t=>t.popupElement),positionerElement:we(t=>t.positionerElement)};function B1(t){const{open:e=!1,onOpenChange:n,elements:r={}}=t,o=Ji(),s=Ao()!=null,i=ln(()=>new Zm({open:e,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new af,floatingId:o,nested:s,noEmit:!1})).current;return ve(()=>{const a={open:e,floatingId:o};r.reference!==void 0&&(a.referenceElement=r.reference,a.domReferenceElement=rt(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 cP(t={}){const{nodeId:e,externalTree:n}=t,r=B1(t),o=t.rootContext||r,s={reference:o.useState("referenceElement"),floating:o.useState("floatingElement"),domReference:o.useState("domReferenceElement")},[i,a]=x.useState(null),l=x.useRef(null),c=_s(n);ve(()=>{s.domReference&&(l.current=s.domReference)},[s.domReference]);const u=MN({...t,elements:{...s,...i&&{reference:i}}}),d=x.useCallback(E=>{const M=rt(E)?{getBoundingClientRect:()=>E.getBoundingClientRect(),getClientRects:()=>E.getClientRects(),contextElement:E}:E;a(M),u.refs.setReference(M)},[u.refs]),[f,h]=x.useState(null),[p,m]=x.useState(null);o.useSyncedValue("referenceElement",f),o.useSyncedValue("domReferenceElement",rt(f)?f:null),o.useSyncedValue("floatingElement",p);const g=x.useCallback(E=>{(rt(E)||E===null)&&(l.current=E,h(E)),(rt(u.refs.reference.current)||u.refs.reference.current===null||E!==null&&!rt(E))&&u.refs.setReference(E)},[u.refs,h]),y=x.useCallback(E=>{m(E),u.refs.setFloating(E)},[u.refs]),b=x.useMemo(()=>({...u.refs,setReference:g,setFloating:y,setPositionReference:d,domReference:l}),[u.refs,g,y,d]),w=x.useMemo(()=>({...u.elements,domReference:s.domReference}),[u.elements,s.domReference]),k=o.useState("open"),v=o.useState("floatingId"),S=x.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 ve(()=>{o.context.dataRef.current.floatingContext=S;const E=c?.nodesRef.current.find(M=>M.id===e);E&&(E.context=S)}),x.useMemo(()=>({...u,context:S,refs:b,elements:w,rootStore:o}),[u,b,w,S,o])}function V1(t){const{popupStore:e,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:o}=t,s=Ji(),i=Ao()!=null,a=e.useState("open"),l=e.useState("activeTriggerElement"),c=e.useState(r?"popupElement":"positionerElement"),u=e.context.triggerElements,d=ln(()=>new Zm({open:a,referenceElement:l,floatingElement:c,triggerElements:u,onOpenChange:o,floatingId:s,nested:i,noEmit:n})).current;return ve(()=>{const f={open:a,floatingId:s,referenceElement:l,floatingElement:c};rt(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 _p=Ua("safe-polygon"),uP=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${Wx}`;function dP(t){return t?!!t.closest(uP):!1}class Jm{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 gs,this.restTimeout=new gs,this.handleCloseOptions=void 0}static create(){return new Jm}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}function W1(t){const e=ln(Jm.create).current,n=t.context.dataRef.current;return n.hoverInteractionState||(n.hoverInteractionState=e),_m(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}const fP=new Set(["click","mousedown"]);function hP(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=W1(n),u=_s(),d=Ao(),f=ye(()=>c.interactedInside?!0:i.current.openEvent?fP.has(i.current.openEvent.type):!1),h=ye(()=>{const w=i.current.openEvent?.type;return w?.includes("mouse")&&w!=="mousedown"}),p=ye(w=>Hx(w,n.context.triggerElements)),m=x.useCallback((w,k=!0)=>{const v=pP(l,c.pointerType);v&&!c.handler?c.openChangeTimeout.start(v,()=>n.setOpen(!1,He(Cn,w))):k&&(c.openChangeTimeout.clear(),n.setOpen(!1,He(Cn,w)))},[l,n,c]),g=ye(()=>{c.unbindMouseMove(),c.handler=void 0}),y=ye(()=>{if(c.performedPointerEventsMutation){const w=Xe(o).body;w.style.pointerEvents="",w.removeAttribute(_p),c.performedPointerEventsMutation=!1}}),b=ye(w=>{const k=Sn(w);if(!dP(k)){c.interactedInside=!1;return}c.interactedInside=!0});ve(()=>{r||(c.pointerType=void 0,c.restTimeoutPending=!1,c.interactedInside=!1,g(),y())},[r,c,g,y]),x.useEffect(()=>()=>{g()},[g]),x.useEffect(()=>y,[y]),ve(()=>{if(a&&r&&c.handleCloseOptions?.blockPointerEvents&&h()&&rt(s)&&o){c.performedPointerEventsMutation=!0;const w=Xe(o).body;w.setAttribute(_p,"");const k=s,v=o,S=u?.nodesRef.current.find(E=>E.id===d)?.context?.elements.floating;return S&&(S.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]),x.useEffect(()=>{if(!a)return;function w(E){f()||!i.current.floatingContext||!n.select("open")||p(E.relatedTarget)||(y(),g(),f()||m(E))}function k(E){c.openChangeTimeout.clear(),y(),c.handler?.(E),g()}function v(E){f()||m(E,!1)}const S=o;return S&&(S.addEventListener("mouseleave",w),S.addEventListener("mouseenter",k),S.addEventListener("mouseleave",v),S.addEventListener("pointerdown",b,!0)),()=>{S&&(S.removeEventListener("mouseleave",w),S.removeEventListener("mouseenter",k),S.removeEventListener("mouseleave",v),S.removeEventListener("pointerdown",b,!0))}},[a,o,n,i,f,p,m,y,g,b,c])}function pP(t,e){return e&&!_i(e)?0:typeof t=="function"?t():t}function sh(t){return typeof t=="function"?t():t}const mP={current:null};function gP(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=mP,externalTree:f,isActiveTrigger:h=!0}=e,p=_s(f),m=W1(n),g=Bt(a),y=Bt(i),b=Bt(c),w=Bt(s);h&&(m.handleCloseOptions=g.current?.__options);const k=ye(()=>m.interactedInside?!0:r.current.openEvent?["click","mousedown"].includes(r.current.openEvent.type):!1),v=ye(F=>Hx(F,n.context.triggerElements)),S=x.useCallback((F,N=!0)=>{const A=eh(y.current,"close",m.pointerType);A&&!m.handler?m.openChangeTimeout.start(A,()=>n.setOpen(!1,He(Cn,F))):N&&(m.openChangeTimeout.clear(),n.setOpen(!1,He(Cn,F)))},[y,n,m]),E=ye(()=>{m.unbindMouseMove(),m.handler=void 0}),M=ye(()=>{if(m.performedPointerEventsMutation){const F=Xe(n.select("domReferenceElement")).body;F.style.pointerEvents="",F.removeAttribute(_p),m.performedPointerEventsMutation=!1}});x.useEffect(()=>{if(!s)return;function F(N){N.open||(m.openChangeTimeout.clear(),m.restTimeout.clear(),m.blockMouseMove=!0,m.restTimeoutPending=!1)}return o.on("openchange",F),()=>{o.off("openchange",F)}},[s,o,m]);const D=ye(F=>{if(k()||!r.current.floatingContext||v(F.relatedTarget))return;const N=d.current;g.current?.({...r.current.floatingContext,tree:p,x:F.clientX,y:F.clientY,onClose(){M(),E(),!k()&&N===n.select("domReferenceElement")&&S(F)}})(F)});return x.useEffect(()=>{if(!s)return;const F=d.current??(h?n.select("domReferenceElement"):null);if(!rt(F))return;function N(B){if(m.openChangeTimeout.clear(),m.blockMouseMove=!1,l&&!_i(m.pointerType)||sh(b.current)>0&&!eh(y.current,"open"))return;const U=eh(y.current,"open",m.pointerType),J=n.select("domReferenceElement"),Y=n.context.triggerElements,K=(Y.hasElement(B.target)||Y.hasMatchingElement($=>Ye($,B.target)))&&(!J||!Ye(J,B.target)),G=B.currentTarget??null,L=n.select("open"),W=!L||K;K&&L?n.setOpen(!0,He(Cn,B,G)):U?m.openChangeTimeout.start(U,()=>{W&&n.setOpen(!0,He(Cn,B,G))}):W&&n.setOpen(!0,He(Cn,B,G))}function A(B){if(k()){M();return}m.unbindMouseMove();const U=n.select("domReferenceElement"),J=Xe(U);if(m.restTimeout.clear(),m.restTimeoutPending=!1,v(B.relatedTarget))return;if(g.current&&r.current.floatingContext){n.select("open")||m.openChangeTimeout.clear();const K=d.current;m.handler=g.current({...r.current.floatingContext,tree:p,x:B.clientX,y:B.clientY,onClose(){M(),E(),w.current&&!k()&&K===n.select("domReferenceElement")&&S(B,!0)}});const G=m.handler;G(B),J.addEventListener("mousemove",G),m.unbindMouseMove=()=>{J.removeEventListener("mousemove",G)};return}(m.pointerType!=="touch"||!Ye(n.select("floatingElement"),B.relatedTarget))&&S(B)}function z(B){D(B)}return n.select("open")&&F.addEventListener("mouseleave",z),u&&F.addEventListener("mousemove",N,{once:!0}),F.addEventListener("mouseenter",N),F.addEventListener("mouseleave",A),()=>{F.removeEventListener("mouseleave",z),u&&F.removeEventListener("mousemove",N),F.removeEventListener("mouseenter",N),F.removeEventListener("mouseleave",A)}},[E,M,r,y,S,n,s,g,D,m,h,k,v,l,u,b,d,p,w]),x.useMemo(()=>{if(!s)return;function F(N){m.pointerType=N.pointerType}return{onPointerDown:F,onPointerEnter:F,onMouseMove(N){const{nativeEvent:A}=N,z=N.currentTarget,B=n.select("domReferenceElement"),U=n.context.triggerElements,J=n.select("open"),Y=(U.hasElement(N.target)||U.hasMatchingElement(G=>Ye(G,N.target)))&&(!B||!Ye(B,N.target));if(l&&!_i(m.pointerType)||J&&!Y||sh(b.current)===0||!Y&&m.restTimeoutPending&&N.movementX**2+N.movementY**2<2)return;m.restTimeout.clear();function K(){if(m.restTimeoutPending=!1,k())return;const G=n.select("open");!m.blockMouseMove&&(!G||Y)&&n.setOpen(!0,He(Cn,A,z))}m.pointerType==="touch"?Xn.flushSync(()=>{K()}):Y&&J?K():(m.restTimeoutPending=!0,m.restTimeout.start(sh(b.current),K))}}},[s,m,k,l,n,b])}function lf(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=x.useCallback(c=>Vl(c,t,"reference"),e),i=x.useCallback(c=>Vl(c,t,"floating"),n),a=x.useCallback(c=>Vl(c,t,"item"),r),l=x.useCallback(c=>Vl(c,t,"trigger"),o);return x.useMemo(()=>({getReferenceProps:s,getFloatingProps:i,getItemProps:a,getTriggerProps:l}),[s,i,a,l])}function Vl(t,e,n){const r=new Map,o=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[wp]="");for(const i in t)o&&t&&(i===Bx||i===Vx)||(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&&vb(s,a,o,r)}return vb(s,t,o,r),s}function vb(t,e,n,r){for(const o in e){const s=e[o];n&&(o===Bx||o===Vx)||(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 yP="Escape";function cf(t,e,n){switch(t){case"vertical":return e;case"horizontal":return n;default:return e||n}}function Wl(t,e){return cf(e,t===Im||t===ml,t===po||t===mo)}function ih(t,e,n){return cf(e,t===ml,n?t===po:t===mo)||t==="Enter"||t===" "||t===""}function bP(t,e,n){return cf(e,n?t===po:t===mo,t===ml)}function vP(t,e,n,r){const o=n?t===mo:t===po,s=t===Im;return e==="both"||e==="horizontal"&&r&&r>1?t===yP:cf(e,o,s)}function wP(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:S,cols:E=1,id:M,resetOnPointerLeave:D=!0,externalTree:F}=e,N=Ha(o),A=Bt(N),z=Ao(),B=_s(F);ve(()=>{i.current.orientation=v},[i,v]);const U=kp(s),J=x.useRef(y),Y=x.useRef(d??-1),K=x.useRef(null),G=x.useRef(!0),L=ye(ne=>{c(Y.current===-1?null:Y.current,ne)}),W=x.useRef(L),$=x.useRef(!!o),j=x.useRef(r),R=x.useRef(!1),P=x.useRef(!1),I=Bt(k),Z=Bt(r),X=Bt(d),_=Bt(D),q=ye(()=>{function ne(ge){g?B?.events.emit("virtualfocus",ge):Oa(ge,{sync:R.current,preventScroll:!0})}const le=a.current[Y.current],te=P.current;le&&ne(le),(R.current?ge=>ge():requestAnimationFrame)(()=>{const ge=a.current[Y.current]||le;if(!ge)return;le||ne(ge),O&&(te||!G.current)&&ge.scrollIntoView?.({block:"nearest",inline:"nearest"})})});ve(()=>{u&&(r&&o?(Y.current=d??-1,J.current&&d!=null&&(P.current=!0,L())):$.current&&(Y.current=-1,W.current()))},[u,r,o,d,L]),ve(()=>{if(u){if(!r){R.current=!1;return}if(o)if(l==null){if(R.current=!1,X.current!=null)return;if($.current&&(Y.current=-1,q()),(!j.current||!$.current)&&J.current&&(K.current!=null||J.current===!0&&K.current==null)){let ne=0;const le=()=>{a.current[0]==null?(ne<2&&(ne?requestAnimationFrame:queueMicrotask)(le),ne+=1):(Y.current=K.current==null||ih(K.current,v,m)||p?ku(a):Ep(a),K.current=null,L())};le()}}else yi(a,l)||(Y.current=l,q(),P.current=!1)}},[u,r,o,l,X,p,a,v,m,L,q,I]),ve(()=>{if(!u||o||!B||g||!$.current)return;const ne=B.nodesRef.current,le=ne.find(ge=>ge.id===z)?.context?.elements.floating,te=qn(Xe(o)),fe=ne.some(ge=>ge.context&&Ye(ge.context.elements.floating,te));le&&!fe&&G.current&&le.focus({preventScroll:!0})},[u,o,B,z,g]),ve(()=>{W.current=L,j.current=r,$.current=!!o}),ve(()=>{r||(K.current=null,J.current=y)},[r,y]);const T=l!=null,O=x.useMemo(()=>{function ne(te){if(!Z.current)return;const fe=a.current.indexOf(te.currentTarget);fe!==-1&&Y.current!==fe&&(Y.current=fe,L(te))}return{onFocus(te){R.current=!0,ne(te)},onClick:({currentTarget:te})=>te.focus({preventScroll:!0}),onMouseMove(te){R.current=!0,P.current=!1,b&&ne(te)},onPointerLeave(te){if(!Z.current||!G.current||te.pointerType==="touch")return;R.current=!0;const fe=te.relatedTarget;!b||a.current.includes(fe)||_.current&&(Oa(null,{sync:!0}),Y.current=-1,L(te),g||A.current?.focus({preventScroll:!0}))}}},[Z,A,b,a,L,_,g]),V=x.useCallback(()=>S??B?.nodesRef.current.find(ne=>ne.id===z)?.context?.dataRef?.current.orientation,[z,B,S]),H=ye(ne=>{if(G.current=!1,R.current=!0,ne.which===229||!Z.current&&ne.currentTarget===A.current)return;if(p&&vP(ne.key,v,m,E)){Wl(ne.key,V())||Jt(ne),n.setOpen(!1,He(Qf,ne.nativeEvent)),xt(s)&&(g?B?.events.emit("virtualfocus",s):s.focus());return}const le=Y.current,te=ku(a,k),fe=Ep(a,k);if(U||(ne.key==="Home"&&(Jt(ne),Y.current=te,L(ne)),ne.key==="End"&&(Jt(ne),Y.current=fe,L(ne))),E>1){const ge=Array.from({length:a.current.length},()=>({width:1,height:1})),pe=Zx(ge,E,!1),Le=pe.findIndex(Me=>Me!=null&&!go(a,Me,k)),qe=pe.reduce((Me,Oe,ze)=>Oe!=null&&!go(a,Oe,k)?ze:Me,-1),Je=pe[Gx({current:pe.map(Me=>Me!=null?a.current[Me]:null)},{event:ne,orientation:v,loopFocus:h,rtl:m,cols:E,disabledIndices:Xx([...(typeof k!="function"?k:null)||a.current.map((Me,Oe)=>go(a,Oe,k)?Oe:void 0),void 0],pe),minIndex:Le,maxIndex:qe,prevIndex:Jx(Y.current>fe?te:Y.current,ge,pe,E,ne.key===ml?"bl":ne.key===(m?po:mo)?"tr":"tl"),stopEvent:!0})];if(Je!=null&&(Y.current=Je,L(ne)),v==="both")return}if(Wl(ne.key,v)){if(Jt(ne),r&&!g&&qn(ne.currentTarget.ownerDocument)===ne.currentTarget){Y.current=ih(ne.key,v,m)?te:fe,L(ne);return}ih(ne.key,v,m)?h?le>=fe?f&&le!==a.current.length?Y.current=-1:(R.current=!1,Y.current=te):Y.current=Ut(a,{startingIndex:le,disabledIndices:k}):Y.current=Math.min(fe,Ut(a,{startingIndex:le,disabledIndices:k})):h?le<=te?f&&le!==-1?Y.current=a.current.length:(R.current=!1,Y.current=fe):Y.current=Ut(a,{startingIndex:le,decrement:!0,disabledIndices:k}):Y.current=Math.max(te,Ut(a,{startingIndex:le,decrement:!0,disabledIndices:k})),yi(a,Y.current)&&(Y.current=-1),L(ne)}}),Q=x.useMemo(()=>g&&r&&T&&{"aria-activedescendant":`${M}-${l}`},[g,r,T,M,l]),ee=x.useMemo(()=>({"aria-orientation":v==="both"?void 0:v,...U?{}:Q,onKeyDown(ne){if(ne.key==="Tab"&&ne.shiftKey&&r&&!g){const le=Sn(ne.nativeEvent);if(le&&!Ye(A.current,le))return;Jt(ne),n.setOpen(!1,He(ys,ne.nativeEvent)),xt(s)&&s.focus();return}H(ne)},onPointerMove(){G.current=!0}}),[Q,H,A,v,U,n,r,g,s]),re=x.useMemo(()=>{function ne(te){y==="auto"&&qx(te.nativeEvent)&&(J.current=!g)}function le(te){J.current=y,y==="auto"&&Ux(te.nativeEvent)&&(J.current=!0)}return{onKeyDown(te){const fe=n.select("open");G.current=!1;const ge=te.key.startsWith("Arrow"),pe=bP(te.key,V(),m),Le=Wl(te.key,v),qe=(p?pe:Le)||te.key==="Enter"||te.key.trim()==="";if(g&&fe)return H(te);if(!(!fe&&!w&&ge)){if(qe){const Je=Wl(te.key,V());K.current=p&&Je?null:te.key}if(p){pe&&(Jt(te),fe?(Y.current=ku(a,I.current),L(te)):n.setOpen(!0,He(Qf,te.nativeEvent,te.currentTarget)));return}Le&&(X.current!=null&&(Y.current=X.current),Jt(te),!fe&&w?n.setOpen(!0,He(Qf,te.nativeEvent,te.currentTarget)):H(te),fe&&L(te))}},onFocus(te){n.select("open")&&!g&&(Y.current=-1,L(te))},onPointerDown:le,onPointerEnter:le,onMouseDown:ne,onClick:ne}},[H,I,y,a,p,L,n,w,v,V,m,X,g]),oe=x.useMemo(()=>({...Q,...re}),[Q,re]);return x.useMemo(()=>u?{reference:oe,floating:ee,item:O,trigger:re}:{},[u,oe,ee,re,O])}const kP=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function H1(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=Ji(),c=s?.id||l,u=x.useMemo(()=>Ha(i)?.id||o,[i,o]),d=kP.get(a)??a,h=Ao()!=null,p=x.useMemo(()=>d==="tooltip"||a==="label"?jt:{"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=x.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=x.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=x.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 x.useMemo(()=>({reference:m,floating:g,item:y,trigger:p}),[m,g,p,y])}function xP(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=Rn(),h=x.useRef(""),p=x.useRef(d??i??-1),m=x.useRef(null);ve(()=>{!o&&d!==null||(f.clear(),m.current=null,h.current!==""&&(h.current=""))},[o,d,f]),ve(()=>{o&&h.current===""&&(p.current=d??i??-1)},[o,d,i]);const g=ye(v=>{v?r.current.typing||(r.current.typing=v,l?.(v)):r.current.typing&&(r.current.typing=v,l?.(v))}),y=ye(v=>{function S(A,z,B){const U=z.find(J=>J?.toLocaleLowerCase().indexOf(B.toLocaleLowerCase())===0);return U?A.indexOf(U):-1}const E=s.current;if(h.current.length>0&&h.current[0]!==" "&&(S(E,E,h.current)===-1?g(!1):v.key===" "&&Jt(v)),E==null||v.key.length!==1||v.ctrlKey||v.metaKey||v.altKey)return;o&&v.key!==" "&&(Jt(v),g(!0));const M=h.current==="";M&&(p.current=d??i??-1),E.every(A=>A?A[0]?.toLocaleLowerCase()!==A[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 F=M?d??i??-1:p.current,N=S(E,[...E.slice((F||0)+1),...E.slice(0,(F||0)+1)],h.current);N!==-1?(a?.(N),m.current=N):v.key!==" "&&(h.current="",g(!1))}),b=ye(v=>{const S=v.relatedTarget,E=n.select("domReferenceElement"),M=n.select("floatingElement"),D=Ye(E,S),F=Ye(M,S);D||F||(f.clear(),h.current="",p.current=m.current,g(!1))}),w=x.useMemo(()=>({onKeyDown:y,onBlur:b}),[y,b]),k=x.useMemo(()=>({onKeyDown:y,onKeyUp(v){v.key===" "&&g(!1)},onBlur:b}),[y,b,g]);return x.useMemo(()=>c?{reference:w,floating:k}:{},[c,w,k])}function wb(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 SP(t,e){return t[0]>=e.x&&t[0]<=e.x+e.width&&t[1]>=e.y&&t[1]<=e.y+e.height}function EP(t={}){const{buffer:e=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=t,o=new gs;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:S}=w,E=[v,S],M=Sn(w),D=w.type==="mouseleave",F=Ye(p.floating,M),N=Ye(p.domReference,M),A=p.domReference.getBoundingClientRect(),z=p.floating.getBoundingClientRect(),B=h.split("-")[0],U=d>z.right-z.width/2,J=f>z.bottom-z.height/2,Y=SP(E,A),K=z.width>A.width,G=z.height>A.height,L=(K?A:z).left,W=(K?A:z).right,$=(G?A:z).top,j=(G?A:z).bottom;if(F&&(s=!0,!D))return;if(N&&(s=!1),N&&!D){s=!0;return}if(D&&rt(w.relatedTarget)&&Ye(p.floating,w.relatedTarget)||y&&ls(y.nodesRef.current,g).some(({context:I})=>I?.open))return;if(B==="top"&&f>=A.bottom-1||B==="bottom"&&f<=A.top+1||B==="left"&&d>=A.right-1||B==="right"&&d<=A.left+1)return k();let R=[];switch(B){case"top":R=[[L,A.top+1],[L,z.bottom-1],[W,z.bottom-1],[W,A.top+1]];break;case"bottom":R=[[L,z.top+1],[L,A.bottom-1],[W,A.bottom-1],[W,z.top+1]];break;case"left":R=[[z.right-1,j],[z.right-1,$],[A.left+1,$],[A.left+1,j]];break;case"right":R=[[A.right-1,j],[A.right-1,$],[z.left+1,$],[z.left+1,j]];break}function P([I,Z]){switch(B){case"top":{const X=[K?I+e/2:U?I+e*4:I-e*4,Z+e+1],_=[K?I-e/2:U?I+e*4:I-e*4,Z+e+1],q=[[z.left,U||K?z.bottom-e:z.top],[z.right,U?K?z.bottom-e:z.top:z.bottom-e]];return[X,_,...q]}case"bottom":{const X=[K?I+e/2:U?I+e*4:I-e*4,Z-e],_=[K?I-e/2:U?I+e*4:I-e*4,Z-e],q=[[z.left,U||K?z.top+e:z.bottom],[z.right,U?K?z.top+e:z.bottom:z.top+e]];return[X,_,...q]}case"left":{const X=[I+e+1,G?Z+e/2:J?Z+e*4:Z-e*4],_=[I+e+1,G?Z-e/2:J?Z+e*4:Z-e*4];return[...[[J||G?z.right-e:z.left,z.top],[J?G?z.right-e:z.left:z.right-e,z.bottom]],X,_]}case"right":{const X=[I-e,G?Z+e/2:J?Z+e*4:Z-e*4],_=[I-e,G?Z-e/2:J?Z+e*4:Z-e*4],q=[[J||G?z.left+e:z.right,z.top],[J?G?z.left+e:z.right:z.left+e,z.bottom]];return[X,_,...q]}default:return[]}}if(!wb([v,S],R)){if(s&&!Y)return k();if(!D&&r){const I=c(w.clientX,w.clientY);if(I!==null&&I<.1)return k()}wb([v,S],P([d,f]))?!s&&r&&o.start(40,k):k()}};return u.__options={blockPointerEvents:n},u}let es=(function(t){return t.open="data-open",t.closed="data-closed",t[t.startingStyle=Ka.startingStyle]="startingStyle",t[t.endingStyle=Ka.endingStyle]="endingStyle",t.anchorHidden="data-anchor-hidden",t.side="data-side",t.align="data-align",t})({}),Np=(function(t){return t.popupOpen="data-popup-open",t.pressed="data-pressed",t})({});const CP={[Np.popupOpen]:""},TP={[Np.popupOpen]:"",[Np.pressed]:""},RP={[es.open]:""},MP={[es.closed]:""},OP={[es.anchorHidden]:""},q1={open(t){return t?CP:null}},U1={open(t){return t?TP:null}},ea={open(t){return t?RP:MP},anchorHidden(t){return t?OP:null}};function Ns(t){return Ji(t,"base-ui")}const _P=x.createContext(void 0);function Xm(){return x.useContext(_P)?.direction??"ltr"}const NP=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"}=Vr(t,e)||{};if(c==null)return{};const f=Yx(u),h={x:n,y:r},p=Lm(o),m=jm(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],S=h[p]-s.reference[p],E=d==="real"?await i.getOffsetParent?.(c):a.floating;let M=a.floating[k]||s.floating[m];(!M||!await i.isElement?.(E))&&(M=a.floating[k]||s.floating[m]);const D=v/2-S/2,F=M/2-g[m]/2-1,N=Math.min(f[b],F),A=Math.min(f[w],F),z=N,B=M-g[m]-A,U=M/2-g[m]/2+D,J=xp(z,U,B),Y=!l.arrow&&$o(o)!=null&&U!==J&&s.reference[m]/2-(U<z?N:A)-g[m]/2<0,K=Y?U<z?U-z:U-B:0;return{[p]:h[p]+K,data:{[p]:J,centerOffset:U-J-K,...Y&&{alignmentOffset:K}},reset:Y}}}),PP=(t,e)=>({...NP(t),options:[t,e]}),$P={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 AN().fn(t)).data?.referenceHidden||s}}}},Su={sideX:"left",sideY:"top"},AP={name:"adaptiveOrigin",async fn(t){const{x:e,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:a}=t,l=Pt(o),c=l.getComputedStyle(o);if(!(c.transitionDuration!=="0s"&&c.transitionDuration!==""))return{x:e,y:n,data:Su};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=Xe(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":Su.sideX,y=h==="top"?"bottom":Su.sideY;return{x:p,y:m,data:{sideX:g,sideY:y}}}};function K1(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 kb(t,e,n){const{rects:r,placement:o}=t;return{side:K1(e,gn(o),n),align:$o(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Y1(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,S]=x.useState(null);!p&&v!==null&&S(null);const E=m.side||"flip",M=m.align||"flip",D=m.fallbackAxisSide||"end",F=typeof e=="function"?e:void 0,N=ye(F),A=F?N:e,z=Bt(e),U=Xm()==="rtl",J=v||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":U?"left":"right","inline-start":U?"right":"left"}[r],Y=s==="center"?J:`${J}-${s}`;let K=l;const G=1,L=r==="bottom"?G:0,W=r==="top"?G:0,$=r==="right"?G:0,j=r==="left"?G:0;typeof K=="number"?K={top:K+L,right:K+j,bottom:K+W,left:K+$}:K&&(K={top:(K.top||0)+L,right:(K.right||0)+j,bottom:(K.bottom||0)+W,left:(K.left||0)+$});const R={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:K},P=x.useRef(null),I=Bt(o),Z=Bt(i),q=[ON($e=>{const ce=kb($e,r,U),ie=typeof I.current=="function"?I.current(ce):I.current,he=typeof Z.current=="function"?Z.current(ce):Z.current;return{mainAxis:ie,crossAxis:he,alignmentAxis:he}},[typeof o!="function"?o:0,typeof i!="function"?i:0,U,r])],T=M==="none"&&E!=="shift",O=!T&&(c||g||E==="shift"),V=E==="none"?null:PN({...R,padding:{top:K.top+G,right:K.right+G,bottom:K.bottom+G,left:K.left+G},mainAxis:!g&&E==="flip",crossAxis:M==="flip"?"alignment":!1,fallbackAxisSideDirection:D}),H=T?null:_N($e=>{const ce=Xe($e.elements.floating).documentElement;return{...R,rootBoundary:g?{x:0,y:0,width:ce.clientWidth,height:ce.clientHeight}:void 0,mainAxis:M!=="none",crossAxis:O,limiter:c||g?void 0:NN(ie=>{if(!P.current)return{};const{width:he,height:Se}=P.current.getBoundingClientRect(),De=zn(gn(ie.placement)),ut=De==="y"?he:Se,Ae=De==="y"?K.left+K.right:K.top+K.bottom;return{offset:ut/2+Ae/2}})}},[R,c,g,K,M]);E==="shift"||M==="shift"||s==="center"?q.push(H,V):q.push(V,H),q.push($N({...R,apply({elements:{floating:$e},rects:{reference:ce},availableWidth:ie,availableHeight:he}){const Se=$e.style;Se.setProperty("--available-width",`${ie}px`),Se.setProperty("--available-height",`${he}px`),Se.setProperty("--anchor-width",`${ce.width}px`),Se.setProperty("--anchor-height",`${ce.height}px`)}}),PP(()=>({element:P.current||document.createElement("div"),padding:u,offsetParent:"floating"}),[u]),{name:"transformOrigin",fn($e){const{elements:ce,middlewareData:ie,placement:he,rects:Se,y:De}=$e,ut=gn(he),Ae=zn(ut),wn=P.current,Kr=ie.arrow?.x||0,Yr=ie.arrow?.y||0,xr=wn?.clientWidth||0,Sr=wn?.clientHeight||0,Fe=Kr+xr/2,gt=Yr+Sr/2,dn=Math.abs(ie.shift?.y||0),fn=Se.reference.height/2,Dt=typeof o=="function"?o(kb($e,r,U)):o,Hs=dn>Dt,Gy={top:`${Fe}px calc(100% + ${Dt}px)`,bottom:`${Fe}px ${-Dt}px`,left:`calc(100% + ${Dt}px) ${gt}px`,right:`${-Dt}px ${gt}px`}[ut],gO=`${Fe}px ${Se.reference.y+fn-De}px`;return ce.floating.style.setProperty("--transform-origin",O&&Ae==="y"&&Hs?gO:Gy),{}}},$P,b),ve(()=>{!p&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[p,h]);const Q=x.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<"u",layoutShift:!d&&typeof IntersectionObserver<"u"}),[d]),{refs:ee,elements:re,x:oe,y:ne,middlewareData:le,update:te,placement:fe,context:ge,isPositioned:pe,floatingStyles:Le}=cP({rootContext:h,placement:Y,middleware:q,strategy:n,whileElementsMounted:f?void 0:(...$e)=>mb(...$e,Q),nodeId:y,externalTree:k}),{sideX:qe,sideY:Je}=le.adaptiveOrigin||Su,Me=pe?n:"fixed",Oe=x.useMemo(()=>{const $e=b?{position:Me,[qe]:oe,[Je]:ne}:{position:Me,...Le};return pe||($e.opacity=0),$e},[b,Me,qe,oe,Je,ne,Le,pe]),ze=x.useRef(null);ve(()=>{if(!p)return;const $e=z.current,ce=typeof $e=="function"?$e():$e,he=(xb(ce)?ce.current:ce)||null||null;he!==ze.current&&(ee.setPositionReference(he),ze.current=he)},[p,ee,A,z]),x.useEffect(()=>{if(!p)return;const $e=z.current;typeof $e!="function"&&xb($e)&&$e.current!==ze.current&&(ee.setPositionReference($e.current),ze.current=$e.current)},[p,ee,A,z]),x.useEffect(()=>{if(f&&p&&re.domReference&&re.floating)return mb(re.domReference,re.floating,te,Q)},[f,p,re,te,Q]);const Be=gn(fe),pt=K1(r,Be,U),bt=$o(fe)||"center",mt=!!le.hide?.referenceHidden;ve(()=>{w&&p&&pe&&S(Be)},[w,p,pe,Be]);const ht=x.useMemo(()=>({position:"absolute",top:le.arrow?.y,left:le.arrow?.x}),[le.arrow]),Qe=le.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:Oe,arrowStyles:ht,arrowRef:P,arrowUncentered:Qe,side:pt,align:bt,physicalSide:Be,anchorHidden:mt,refs:ee,context:ge,isPositioned:pe,update:te}),[Oe,ht,P,Qe,pt,bt,Be,mt,ee,ge,pe,te])}function xb(t){return t!=null&&"current"in t}function uf(t){return t==="starting"?m_:jt}function df(t){return Vm(19)?t:t?"true":void 0}function G1(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=G1(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function Z1(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=G1(t))&&(r&&(r+=" "),r+=e);return r}const IP=(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},DP=(t,e)=>({classGroupId:t,validator:e}),J1=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),Bu="-",Sb=[],zP="arbitrary..",jP=t=>{const e=FP(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return LP(i);const a=i.split(Bu),l=a[0]===""&&a.length>1?1:0;return X1(a,l,e)},getConflictingClassGroupIds:(i,a)=>{if(a){const l=r[i],c=n[i];return l?c?IP(c,l):l:c||Sb}return n[i]||Sb}}},X1=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const o=t[e],s=n.nextPart.get(o);if(s){const c=X1(t,e+1,s);if(c)return c}const i=n.validators;if(i===null)return;const a=e===0?t.join(Bu):t.slice(e).join(Bu),l=i.length;for(let c=0;c<l;c++){const u=i[c];if(u.validator(a))return u.classGroupId}},LP=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?zP+r:void 0})(),FP=t=>{const{theme:e,classGroups:n}=t;return BP(n,e)},BP=(t,e)=>{const n=J1();for(const r in t){const o=t[r];Qm(o,n,r,e)}return n},Qm=(t,e,n,r)=>{const o=t.length;for(let s=0;s<o;s++){const i=t[s];VP(i,e,n,r)}},VP=(t,e,n,r)=>{if(typeof t=="string"){WP(t,e,n);return}if(typeof t=="function"){HP(t,e,n,r);return}qP(t,e,n,r)},WP=(t,e,n)=>{const r=t===""?e:Q1(e,t);r.classGroupId=n},HP=(t,e,n,r)=>{if(UP(t)){Qm(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(DP(n,t))},qP=(t,e,n,r)=>{const o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){const[a,l]=o[i];Qm(l,Q1(e,a),n,r)}},Q1=(t,e)=>{let n=t;const r=e.split(Bu),o=r.length;for(let s=0;s<o;s++){const i=r[s];let a=n.nextPart.get(i);a||(a=J1(),n.nextPart.set(i,a)),n=a}return n},UP=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,KP=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)}}},Pp="!",Eb=":",YP=[],Cb=(t,e,n,r,o)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),GP=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===Eb){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(Pp)?(f=d.slice(0,-1),h=!0):d.startsWith(Pp)&&(f=d.slice(1),h=!0);const p=c&&c>l?c-l:void 0;return Cb(s,h,f,p)};if(e){const o=e+Eb,s=r;r=i=>i.startsWith(o)?s(i.slice(o.length)):Cb(YP,!1,i,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},ZP=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}},JP=t=>({cache:KP(t.cacheSize),parseClassName:GP(t),sortModifiers:ZP(t),...jP(t)}),XP=/\s+/,QP=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=e,i=[],a=t.trim().split(XP);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+Pp:b,k=w+y;if(i.indexOf(k)>-1)continue;i.push(k);const v=o(y,g);for(let S=0;S<v.length;++S){const E=v[S];i.push(w+E)}l=u+(l.length>0?" "+l:l)}return l},e$=(...t)=>{let e=0,n,r,o="";for(;e<t.length;)(n=t[e++])&&(r=eS(n))&&(o&&(o+=" "),o+=r);return o},eS=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=eS(t[r]))&&(n&&(n+=" "),n+=e);return n},t$=(t,...e)=>{let n,r,o,s;const i=l=>{const c=e.reduce((u,d)=>d(u),t());return n=JP(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=QP(l,n);return o(l,u),u};return s=i,(...l)=>s(e$(...l))},n$=[],zt=t=>{const e=n=>n[t]||n$;return e.isThemeGetter=!0,e},tS=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,nS=/^\((?:(\w[\w-]*):)?(.+)\)$/i,r$=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,o$=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,s$=/\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$/,i$=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,a$=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,l$=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Gr=t=>r$.test(t),Ke=t=>!!t&&!Number.isNaN(Number(t)),Zr=t=>!!t&&Number.isInteger(Number(t)),ah=t=>t.endsWith("%")&&Ke(t.slice(0,-1)),Er=t=>o$.test(t),rS=()=>!0,c$=t=>s$.test(t)&&!i$.test(t),eg=()=>!1,u$=t=>a$.test(t),d$=t=>l$.test(t),f$=t=>!ke(t)&&!xe(t),h$=t=>Do(t,iS,eg),ke=t=>tS.test(t),Ho=t=>Do(t,aS,c$),Tb=t=>Do(t,k$,Ke),p$=t=>Do(t,cS,rS),m$=t=>Do(t,lS,eg),Rb=t=>Do(t,oS,eg),g$=t=>Do(t,sS,d$),Hl=t=>Do(t,uS,u$),xe=t=>nS.test(t),ia=t=>Ps(t,aS),y$=t=>Ps(t,lS),Mb=t=>Ps(t,oS),b$=t=>Ps(t,iS),v$=t=>Ps(t,sS),ql=t=>Ps(t,uS,!0),w$=t=>Ps(t,cS,!0),Do=(t,e,n)=>{const r=tS.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Ps=(t,e,n=!1)=>{const r=nS.exec(t);return r?r[1]?e(r[1]):n:!1},oS=t=>t==="position"||t==="percentage",sS=t=>t==="image"||t==="url",iS=t=>t==="length"||t==="size"||t==="bg-size",aS=t=>t==="length",k$=t=>t==="number",lS=t=>t==="family-name",cS=t=>t==="number"||t==="weight",uS=t=>t==="shadow",x$=()=>{const t=zt("color"),e=zt("font"),n=zt("text"),r=zt("font-weight"),o=zt("tracking"),s=zt("leading"),i=zt("breakpoint"),a=zt("container"),l=zt("spacing"),c=zt("radius"),u=zt("shadow"),d=zt("inset-shadow"),f=zt("text-shadow"),h=zt("drop-shadow"),p=zt("blur"),m=zt("perspective"),g=zt("aspect"),y=zt("ease"),b=zt("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(),xe,ke],S=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],M=()=>[xe,ke,l],D=()=>[Gr,"full","auto",...M()],F=()=>[Zr,"none","subgrid",xe,ke],N=()=>["auto",{span:["full",Zr,xe,ke]},Zr,xe,ke],A=()=>[Zr,"auto",xe,ke],z=()=>["auto","min","max","fr",xe,ke],B=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],J=()=>["auto",...M()],Y=()=>[Gr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...M()],K=()=>[Gr,"screen","full","dvw","lvw","svw","min","max","fit",...M()],G=()=>[Gr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...M()],L=()=>[t,xe,ke],W=()=>[...k(),Mb,Rb,{position:[xe,ke]}],$=()=>["no-repeat",{repeat:["","x","y","space","round"]}],j=()=>["auto","cover","contain",b$,h$,{size:[xe,ke]}],R=()=>[ah,ia,Ho],P=()=>["","none","full",c,xe,ke],I=()=>["",Ke,ia,Ho],Z=()=>["solid","dashed","dotted","double"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>[Ke,ah,Mb,Rb],q=()=>["","none",p,xe,ke],T=()=>["none",Ke,xe,ke],O=()=>["none",Ke,xe,ke],V=()=>[Ke,xe,ke],H=()=>[Gr,"full",...M()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Er],breakpoint:[Er],color:[rS],container:[Er],"drop-shadow":[Er],ease:["in","out","in-out"],font:[f$],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Er],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Er],shadow:[Er],spacing:["px",Ke],text:[Er],"text-shadow":[Er],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Gr,ke,xe,g]}],container:["container"],columns:[{columns:[Ke,ke,xe,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:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{"inset-s":D(),start:D()}],end:[{"inset-e":D(),end:D()}],"inset-bs":[{"inset-bs":D()}],"inset-be":[{"inset-be":D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[Zr,"auto",xe,ke]}],basis:[{basis:[Gr,"full","auto",a,...M()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ke,Gr,"auto","initial","none",ke]}],grow:[{grow:["",Ke,xe,ke]}],shrink:[{shrink:["",Ke,xe,ke]}],order:[{order:[Zr,"first","last","none",xe,ke]}],"grid-cols":[{"grid-cols":F()}],"col-start-end":[{col:N()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":F()}],"row-start-end":[{row:N()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":z()}],"auto-rows":[{"auto-rows":z()}],gap:[{gap:M()}],"gap-x":[{"gap-x":M()}],"gap-y":[{"gap-y":M()}],"justify-content":[{justify:[...B(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...B()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":B()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:M()}],px:[{px:M()}],py:[{py:M()}],ps:[{ps:M()}],pe:[{pe:M()}],pbs:[{pbs:M()}],pbe:[{pbe:M()}],pt:[{pt:M()}],pr:[{pr:M()}],pb:[{pb:M()}],pl:[{pl:M()}],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":M()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":M()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],"inline-size":[{inline:["auto",...K()]}],"min-inline-size":[{"min-inline":["auto",...K()]}],"max-inline-size":[{"max-inline":["none",...K()]}],"block-size":[{block:["auto",...G()]}],"min-block-size":[{"min-block":["auto",...G()]}],"max-block-size":[{"max-block":["none",...G()]}],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,ia,Ho]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,w$,p$]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ah,ke]}],"font-family":[{font:[y$,m$,e]}],"font-features":[{"font-features":[ke]}],"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,xe,ke]}],"line-clamp":[{"line-clamp":[Ke,"none",xe,Tb]}],leading:[{leading:[s,...M()]}],"list-image":[{"list-image":["none",xe,ke]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",xe,ke]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:L()}],"text-color":[{text:L()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ke,"from-font","auto",xe,Ho]}],"text-decoration-color":[{decoration:L()}],"underline-offset":[{"underline-offset":[Ke,"auto",xe,ke]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",xe,ke]}],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",xe,ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:W()}],"bg-repeat":[{bg:$()}],"bg-size":[{bg:j()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Zr,xe,ke],radial:["",xe,ke],conic:[Zr,xe,ke]},v$,g$]}],"bg-color":[{bg:L()}],"gradient-from-pos":[{from:R()}],"gradient-via-pos":[{via:R()}],"gradient-to-pos":[{to:R()}],"gradient-from":[{from:L()}],"gradient-via":[{via:L()}],"gradient-to":[{to:L()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-bs":[{"border-bs":I()}],"border-w-be":[{"border-be":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":I()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Z(),"hidden","none"]}],"divide-style":[{divide:[...Z(),"hidden","none"]}],"border-color":[{border:L()}],"border-color-x":[{"border-x":L()}],"border-color-y":[{"border-y":L()}],"border-color-s":[{"border-s":L()}],"border-color-e":[{"border-e":L()}],"border-color-bs":[{"border-bs":L()}],"border-color-be":[{"border-be":L()}],"border-color-t":[{"border-t":L()}],"border-color-r":[{"border-r":L()}],"border-color-b":[{"border-b":L()}],"border-color-l":[{"border-l":L()}],"divide-color":[{divide:L()}],"outline-style":[{outline:[...Z(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ke,xe,ke]}],"outline-w":[{outline:["",Ke,ia,Ho]}],"outline-color":[{outline:L()}],shadow:[{shadow:["","none",u,ql,Hl]}],"shadow-color":[{shadow:L()}],"inset-shadow":[{"inset-shadow":["none",d,ql,Hl]}],"inset-shadow-color":[{"inset-shadow":L()}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:L()}],"ring-offset-w":[{"ring-offset":[Ke,Ho]}],"ring-offset-color":[{"ring-offset":L()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":L()}],"text-shadow":[{"text-shadow":["none",f,ql,Hl]}],"text-shadow-color":[{"text-shadow":L()}],opacity:[{opacity:[Ke,xe,ke]}],"mix-blend":[{"mix-blend":[...X(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":X()}],"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":[Ke]}],"mask-image-linear-from-pos":[{"mask-linear-from":_()}],"mask-image-linear-to-pos":[{"mask-linear-to":_()}],"mask-image-linear-from-color":[{"mask-linear-from":L()}],"mask-image-linear-to-color":[{"mask-linear-to":L()}],"mask-image-t-from-pos":[{"mask-t-from":_()}],"mask-image-t-to-pos":[{"mask-t-to":_()}],"mask-image-t-from-color":[{"mask-t-from":L()}],"mask-image-t-to-color":[{"mask-t-to":L()}],"mask-image-r-from-pos":[{"mask-r-from":_()}],"mask-image-r-to-pos":[{"mask-r-to":_()}],"mask-image-r-from-color":[{"mask-r-from":L()}],"mask-image-r-to-color":[{"mask-r-to":L()}],"mask-image-b-from-pos":[{"mask-b-from":_()}],"mask-image-b-to-pos":[{"mask-b-to":_()}],"mask-image-b-from-color":[{"mask-b-from":L()}],"mask-image-b-to-color":[{"mask-b-to":L()}],"mask-image-l-from-pos":[{"mask-l-from":_()}],"mask-image-l-to-pos":[{"mask-l-to":_()}],"mask-image-l-from-color":[{"mask-l-from":L()}],"mask-image-l-to-color":[{"mask-l-to":L()}],"mask-image-x-from-pos":[{"mask-x-from":_()}],"mask-image-x-to-pos":[{"mask-x-to":_()}],"mask-image-x-from-color":[{"mask-x-from":L()}],"mask-image-x-to-color":[{"mask-x-to":L()}],"mask-image-y-from-pos":[{"mask-y-from":_()}],"mask-image-y-to-pos":[{"mask-y-to":_()}],"mask-image-y-from-color":[{"mask-y-from":L()}],"mask-image-y-to-color":[{"mask-y-to":L()}],"mask-image-radial":[{"mask-radial":[xe,ke]}],"mask-image-radial-from-pos":[{"mask-radial-from":_()}],"mask-image-radial-to-pos":[{"mask-radial-to":_()}],"mask-image-radial-from-color":[{"mask-radial-from":L()}],"mask-image-radial-to-color":[{"mask-radial-to":L()}],"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":[Ke]}],"mask-image-conic-from-pos":[{"mask-conic-from":_()}],"mask-image-conic-to-pos":[{"mask-conic-to":_()}],"mask-image-conic-from-color":[{"mask-conic-from":L()}],"mask-image-conic-to-color":[{"mask-conic-to":L()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:W()}],"mask-repeat":[{mask:$()}],"mask-size":[{mask:j()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",xe,ke]}],filter:[{filter:["","none",xe,ke]}],blur:[{blur:q()}],brightness:[{brightness:[Ke,xe,ke]}],contrast:[{contrast:[Ke,xe,ke]}],"drop-shadow":[{"drop-shadow":["","none",h,ql,Hl]}],"drop-shadow-color":[{"drop-shadow":L()}],grayscale:[{grayscale:["",Ke,xe,ke]}],"hue-rotate":[{"hue-rotate":[Ke,xe,ke]}],invert:[{invert:["",Ke,xe,ke]}],saturate:[{saturate:[Ke,xe,ke]}],sepia:[{sepia:["",Ke,xe,ke]}],"backdrop-filter":[{"backdrop-filter":["","none",xe,ke]}],"backdrop-blur":[{"backdrop-blur":q()}],"backdrop-brightness":[{"backdrop-brightness":[Ke,xe,ke]}],"backdrop-contrast":[{"backdrop-contrast":[Ke,xe,ke]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ke,xe,ke]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ke,xe,ke]}],"backdrop-invert":[{"backdrop-invert":["",Ke,xe,ke]}],"backdrop-opacity":[{"backdrop-opacity":[Ke,xe,ke]}],"backdrop-saturate":[{"backdrop-saturate":[Ke,xe,ke]}],"backdrop-sepia":[{"backdrop-sepia":["",Ke,xe,ke]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":M()}],"border-spacing-x":[{"border-spacing-x":M()}],"border-spacing-y":[{"border-spacing-y":M()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",xe,ke]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ke,"initial",xe,ke]}],ease:[{ease:["linear","initial",y,xe,ke]}],delay:[{delay:[Ke,xe,ke]}],animate:[{animate:["none",b,xe,ke]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,xe,ke]}],"perspective-origin":[{"perspective-origin":v()}],rotate:[{rotate:T()}],"rotate-x":[{"rotate-x":T()}],"rotate-y":[{"rotate-y":T()}],"rotate-z":[{"rotate-z":T()}],scale:[{scale:O()}],"scale-x":[{"scale-x":O()}],"scale-y":[{"scale-y":O()}],"scale-z":[{"scale-z":O()}],"scale-3d":["scale-3d"],skew:[{skew:V()}],"skew-x":[{"skew-x":V()}],"skew-y":[{"skew-y":V()}],transform:[{transform:[xe,ke,"","none","gpu","cpu"]}],"transform-origin":[{origin:v()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:H()}],"translate-x":[{"translate-x":H()}],"translate-y":[{"translate-y":H()}],"translate-z":[{"translate-z":H()}],"translate-none":["translate-none"],accent:[{accent:L()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:L()}],"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",xe,ke]}],"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":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mbs":[{"scroll-mbs":M()}],"scroll-mbe":[{"scroll-mbe":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pbs":[{"scroll-pbs":M()}],"scroll-pbe":[{"scroll-pbe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"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",xe,ke]}],fill:[{fill:["none",...L()]}],"stroke-w":[{stroke:[Ke,ia,Ho,Tb]}],stroke:[{stroke:["none",...L()]}],"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"]}},S$=t$(x$);function de(...t){return S$(Z1(t))}const E$=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],C$=it("arrow-up-down",E$);const T$=[["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"}]],R$=it("calendar-days",T$);const M$=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],tg=it("check",M$);const O$=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ng=it("chevron-down",O$);const _$=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],N$=it("chevron-left",_$);const P$=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],$$=it("chevron-right",P$);const A$=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],I$=it("chevron-up",A$);const D$=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],z$=it("clock-3",D$);const j$=[["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"}]],L$=it("code-xml",j$);const F$=[["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"}]],B$=it("heading-1",F$);const V$=[["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"}]],W$=it("heading-2",V$);const H$=[["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"}]],rg=it("image",H$);const q$=[["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"}]],U$=it("laptop-minimal",q$);const K$=[["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"}]],Y$=it("link",K$);const G$=[["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"}]],Z$=it("list-checks",G$);const J$=[["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"}]],X$=it("list-ordered",J$);const Q$=[["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"}]],eA=it("list",Q$);const tA=[["path",{d:"M5 12h14",key:"1ays0h"}]],nA=it("minus",tA);const rA=[["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"}]],oA=it("moon",rA);const sA=[["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"}]],iA=it("panel-left-close",sA);const aA=[["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"}]],lA=it("panel-left-open",aA);const cA=[["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"}]],uA=it("panel-right-close",cA);const dA=[["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"}]],fA=it("panel-right-open",dA);const hA=[["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"}]],pA=it("quote",hA);const mA=[["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"}]],gA=it("save",mA);const yA=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ff=it("search",yA);const bA=[["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"}]],vA=it("sun",bA);const wA=[["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"}]],kA=it("trash-2",wA);const xA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],dS=it("x",xA),fS=x.createContext(void 0);function hS(t=!1){const e=x.useContext(fS);if(e===void 0&&!t)throw new Error(en(16));return e}function SA(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:x.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 $s(t={}){const{disabled:e=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0}=t,s=x.useRef(null),i=hS(!0)!==void 0,a=ye(()=>{const f=s.current;return!!(f?.tagName==="A"&&f?.href)}),{props:l}=SA({focusableWhenDisabled:n,disabled:e,composite:i,tabIndex:r,isNativeButton:o}),c=x.useCallback(()=>{const f=s.current;EA(f)&&i&&e&&l.disabled===void 0&&f.disabled&&(f.disabled=!1)},[e,l.disabled,i]);ve(c,[c]);const u=x.useCallback((f={})=>{const{onClick:h,onMouseDown:p,onKeyUp:m,onKeyDown:g,onPointerDown:y,...b}=f;return Xi({type:o?"button":void 0,onClick(k){if(e){k.preventDefault();return}h?.(k)},onMouseDown(k){e||p?.(k)},onKeyDown(k){if(e||(Op(k),g?.(k)),k.baseUIHandlerPrevented)return;const v=k.target===k.currentTarget&&!o&&!a()&&!e,S=k.key==="Enter",E=k.key===" ";v&&((E||S)&&k.preventDefault(),S&&h?.(k))},onKeyUp(k){e||(Op(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=ye(f=>{s.current=f,c()});return{getButtonProps:u,buttonRef:d}}function EA(t){return xt(t)&&t.tagName==="BUTTON"}const CA=x.forwardRef(function(e,n){const{render:r,className:o,disabled:s=!1,focusableWhenDisabled:i=!1,nativeButton:a=!0,...l}=e,{getButtonProps:c,buttonRef:u}=$s({disabled:s,focusableWhenDisabled:i,native:a});return at("button",e,{state:{disabled:s},ref:[n,u],props:[l,c]})}),Ob=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,_b=Z1,hf=(t,e)=>n=>{var r;if(e?.variants==null)return _b(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=Ob(u)||Ob(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 _b(t,i,l,n?.class,n?.className)},Ii=hf("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 active:translate-y-px 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=Ee.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=de(Ii({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=C.jsx(CA,{"data-slot":"button",className:l,...r}),e[9]=r,e[10]=l,e[11]=c):c=e[11],c}function TA(t,e){const n=getComputedStyle(t),r=parseFloat(n.fontSize);return e*r}function RA(t,e){const n=getComputedStyle(t.ownerDocument.body),r=parseFloat(n.fontSize);return e*r}function MA(t){return t/100*window.innerHeight}function OA(t){return t/100*window.innerWidth}function _A(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 Ul({groupSize:t,panelElement:e,styleProp:n}){let r;const[o,s]=_A(n);switch(s){case"%":{r=o/100*t;break}case"px":{r=o;break}case"rem":{r=RA(e,o);break}case"em":{r=TA(e,o);break}case"vh":{r=MA(o);break}case"vw":{r=OA(o);break}}return r}function mn(t){return parseFloat(t.toFixed(3))}function Di({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 $p(t){const{panels:e}=t,n=Di({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=Ul({groupSize:n,panelElement:o,styleProp:s.collapsedSize});i=mn(u/n*100)}let a;if(s.defaultSize!==void 0){const u=Ul({groupSize:n,panelElement:o,styleProp:s.defaultSize});a=mn(u/n*100)}let l=0;if(s.minSize!==void 0){const u=Ul({groupSize:n,panelElement:o,styleProp:s.minSize});l=mn(u/n*100)}let c=100;if(s.maxSize!==void 0){const u=Ul({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 lt(t,e="Assertion error"){if(!t)throw Error(e)}function Ap(t,e){return Array.from(e).sort(t==="horizontal"?NA:PA)}function NA(t,e){const n=t.element.offsetLeft-e.element.offsetLeft;return n!==0?n:t.element.offsetWidth-e.element.offsetWidth}function PA(t,e){const n=t.element.offsetTop-e.element.offsetTop;return n!==0?n:t.element.offsetHeight-e.element.offsetHeight}function pS(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}function mS(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 $A({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}=mS(r,i),c=t==="horizontal"?a:l;c<s&&(s=c,o=i)}return lt(o,"No rect found"),o}let Kl;function AA(){return Kl===void 0&&(typeof matchMedia=="function"?Kl=!!matchMedia("(pointer:coarse)").matches:Kl=!1),Kl}function gS(t){const{element:e,orientation:n,panels:r,separators:o}=t,s=Ap(n,Array.from(e.children).filter(pS).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 S=h[0],E=$A({orientation:n,rects:[y,b],targetRect:S.element.getBoundingClientRect()});w=[S,E===y?v:k];break}default:{w=h;break}}}else h.length?w=h:w=[n==="horizontal"?new DOMRect(y.right,b.top,b.left-y.right,b.height):new DOMRect(b.left,y.bottom,b.width,b.top-y.bottom)];for(const k of w){let v="width"in k?k:k.element.getBoundingClientRect();const S=AA()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine;if(v.width<S){const M=S-v.width;v=new DOMRect(v.x-M/2,v.y,v.width+M,v.height)}if(v.height<S){const M=S-v.height;v=new DOMRect(v.x,v.y-M/2,v.width,v.height+M)}const E=p<=c||p>u;!a&&!E&&i.push({group:t,groupSize:Di({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 yS=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)}}},dr=new Map;const bS=new yS;function IA(t){dr=new Map(dr),dr.delete(t)}function Nb(t,e){for(const[n]of dr)if(n.id===t)return n}function yo(t,e){for(const[n,r]of dr)if(n.id===t)return r;if(e)throw Error(`Could not find data for Group with id ${t}`)}function As(){return dr}function og(t,e){return bS.addListener("groupChange",n=>{n.group.id===t&&e(n)})}function Hr(t,e){const n=dr.get(t);dr=new Map(dr),dr.set(t,e),bS.emit("groupChange",{group:t,prev:n,next:e})}function DA(t,e,n){let r,o={x:1/0,y:1/0};for(const s of e){const i=mS(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 zA(t){return t!==null&&typeof t=="object"&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function jA(t,e){if(t===e)throw new Error("Cannot compare node with itself");const n={a:Ab(t),b:Ab(e)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();lt(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:$b(Pb(n.a)),b:$b(Pb(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 LA=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function FA(t){const e=getComputedStyle(vS(t)??t).display;return e==="flex"||e==="inline-flex"}function BA(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||FA(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"||LA.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function Pb(t){let e=t.length;for(;e--;){const n=t[e];if(lt(n,"Missing node"),BA(n))return n}return null}function $b(t){return t&&Number(getComputedStyle(t).zIndex)||0}function Ab(t){const e=[];for(;t;)e.push(t),t=vS(t);return e}function vS(t){const{parentNode:e}=t;return zA(e)?e.host:e}function VA(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 WA({groupElement:t,hitRegion:e,pointerEventTarget:n}){if(!pS(n)||n.contains(t)||t.contains(n))return!0;if(jA(n,t)>0){let r=n;for(;r;){if(r.contains(t))return!0;if(VA(r.getBoundingClientRect(),e))return!1;r=r.parentElement}}return!0}function sg(t,e){const n=[];return e.forEach((r,o)=>{if(o.disabled)return;const s=gS(o),i=DA(o.orientation,s,{x:t.clientX,y:t.clientY});i&&i.distance.x<=0&&i.distance.y<=0&&WA({groupElement:o.element,hitRegion:i.hitRegion.rect,pointerEventTarget:t.target})&&n.push(i.hitRegion)}),n}function HA(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 lr(t,e){return on(t,e)?0:t>e?1:-1}function hi({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(lr(r,l)<0)if(s){const c=(o+l)/2;lr(r,c)<0?r=o:r=l}else r=l;return r=Math.min(a,r),r=mn(r),r}function Ya({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;lt(u!=null,"Invalid first pivot index"),lt(d!=null,"Invalid second pivot index");let f=0;switch(s){case"keyboard":{{const m=t<0?d:u,g=n[m];lt(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(lt(k!=null,`Previous layout not found for panel index ${m}`),on(k,y)){const v=w-k;lr(v,Math.abs(t))>0&&(t=t<0?0-v:v)}}}{const m=t<0?u:d,g=n[m];lt(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(lt(k!=null,`Previous layout not found for panel index ${m}`),on(k,w)){const v=k-y;lr(v,Math.abs(t))>0&&(t=t<0?0-v:v)}}}break}default:{const m=t<0?d:u,g=n[m];lt(g,`Panel constraints not found for index ${m}`);const y=a[m],{collapsible:b,collapsedSize:w,minSize:k}=g;if(b&&lr(y,k)<0)if(t>0){const v=k-w,S=v/2,E=y+t;lr(E,k)<0&&(t=lr(t,S)<=0?0:v)}else{const v=k-w,S=100-v/2,E=y-t;lr(E,k)<0&&(t=lr(100+t,S)>0?0:-v)}break}}{const m=t<0?1:-1;let g=t<0?d:u,y=0;for(;;){const w=a[g];lt(w!=null,`Previous layout not found for panel index ${g}`);const k=hi({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];lt(y!=null,`Previous layout not found for panel index ${m}`);const b=y-g,w=hi({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(HA(l,c))return o;{const m=t<0?d:u,g=a[m];lt(g!=null,`Previous layout not found for panel index ${m}`);const y=g+f,b=hi({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];lt(v!=null,`Previous layout not found for panel index ${k}`);const S=v+w,E=hi({overrideDisabledPanels:i,panelConstraints:n[k],prevSize:v,size:S});if(on(v,E)||(w-=E-v,c[k]=E),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 vs(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(e[n]===void 0||lr(t[n],e[n])!==0)return!1;return!0}function ws({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];lt(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];lt(l!=null,`No layout data found for index ${a}`);const c=r[a];lt(c!=null,`No layout data found for index ${a}`);const u=hi({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];lt(l!=null,`No layout data found for index ${a}`);const c=l+s,u=hi({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 wS({groupId:t,panelId:e}){const n=()=>{const a=As();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=Ya({delta:g?l-a:a-l,initialLayout:h,panelConstraints:u,pivotIndices:g?[m-1,m]:[m,m+1],prevLayout:h,trigger:"imperative-api"}),b=ws({layout:y,panelConstraints:u});vs(h,b)||Hr(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=Di({group:c});l=mn(a/u*100);break}case"string":{l=parseFloat(a);break}}i(l)}}}}function Ib(t){if(t.defaultPrevented)return;const e=As();sg(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=wS({groupId:n.group.id,panelId:r.id});s&&o!==void 0&&(s.resize(o),t.preventDefault())}}})}function Eu(t){const e=As();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 kS({groupId:t}){const e=()=>{const n=As();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=ws({layout:n,panelConstraints:o});return r?a:(vs(a,c)||Hr(s,{defaultLayoutDeferred:r,derivedPanelConstraints:o,groupSize:i,layout:c,separatorToPanels:l}),c)}}}function qo(t,e){const n=Eu(t),r=yo(n.id,!0),o=n.separators.find(u=>u.element===t);lt(o,"Matching separator not found");const s=r.separatorToPanels.get(o);lt(s,"Matching panels not found");const i=s.map(u=>n.panels.indexOf(u)),a=kS({groupId:n.id}).getLayout(),l=Ya({delta:e,initialLayout:a,panelConstraints:r.derivedPanelConstraints,pivotIndices:i,prevLayout:a,trigger:"keyboard"}),c=ws({layout:l,panelConstraints:r.derivedPanelConstraints});vs(a,c)||Hr(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Db(t){if(t.defaultPrevented)return;const e=t.currentTarget,n=Eu(e);if(!n.disabled)switch(t.key){case"ArrowDown":{t.preventDefault(),n.orientation==="vertical"&&qo(e,5);break}case"ArrowLeft":{t.preventDefault(),n.orientation==="horizontal"&&qo(e,-5);break}case"ArrowRight":{t.preventDefault(),n.orientation==="horizontal"&&qo(e,5);break}case"ArrowUp":{t.preventDefault(),n.orientation==="vertical"&&qo(e,-5);break}case"End":{t.preventDefault(),qo(e,100);break}case"Enter":{t.preventDefault();const r=Eu(e),o=yo(r.id,!0),{derivedPanelConstraints:s,layout:i,separatorToPanels:a}=o,l=r.separators.find(f=>f.element===e);lt(l,"Matching separator not found");const c=a.get(l);lt(c,"Matching panels not found");const u=c[0],d=s.find(f=>f.panelId===u.id);if(lt(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;qo(e,h-f)}break}case"F6":{t.preventDefault();const r=Eu(e).separators.map(i=>i.element),o=Array.from(r).findIndex(i=>i===t.currentTarget);lt(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(),qo(e,-100);break}}}let ki={cursorFlags:0,state:"inactive"};const ig=new yS;function ks(){return ki}function qA(t){return ig.addListener("change",t)}function UA(t){const e=ki,n={...ki};n.cursorFlags=t,ki=n,ig.emit("change",{prev:e,next:n})}function xi(t){const e=ki;ki=t,ig.emit("change",{prev:e,next:t})}function zb(t){if(t.defaultPrevented||t.pointerType==="mouse"&&t.button>0)return;const e=As(),n=sg(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)}),xi({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:t.clientX,y:t.clientY},state:"active"}),n.length&&t.preventDefault()}const KA=t=>t,lh=()=>{},xS=1,SS=2,ES=4,CS=8,jb=3,Lb=12;let Yl;function Fb(){return Yl===void 0&&(Yl=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Yl=!0)),Yl}function YA({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&&Fb()){const s=(t&xS)!==0,i=(t&SS)!==0,a=(t&ES)!==0,l=(t&CS)!==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 Fb()?r>0&&o>0?"move":r>0?"ew-resize":"ns-resize":r>0&&o>0?"grab":r>0?"col-resize":"row-resize"}}const Bb=new WeakMap;function ag(t){if(t.defaultView===null||t.defaultView===void 0)return;let{prevStyle:e,styleSheet:n}=Bb.get(t)??{};n===void 0&&(n=new t.defaultView.CSSStyleSheet,t.adoptedStyleSheets&&t.adoptedStyleSheets.push(n));const r=ks();switch(r.state){case"active":case"hover":{const o=YA({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}}Bb.set(t,{prevStyle:e,styleSheet:n})}function TS({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:S}=y;if(w&&v&&S){const E=Ya({delta:m,initialLayout:g,panelConstraints:w,pivotIndices:c.panels.map(M=>h.indexOf(M)),prevLayout:v,trigger:"mouse-or-touch"});if(vs(E,v)){if(m!==0&&!p)switch(f){case"horizontal":{a|=m<0?xS:SS;break}case"vertical":{a|=m<0?ES:CS;break}}}else Hr(c.group,{defaultLayoutDeferred:b,derivedPanelConstraints:w,groupSize:k,layout:E,separatorToPanels:S})}});let l=0;e.movementX===0?l|=i&jb:l|=a&jb,e.movementY===0?l|=i&Lb:l|=a&Lb,UA(l),ag(t)}function Vb(t){const e=As(),n=ks();n.state==="active"&&TS({document:t.currentTarget,event:t,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:e,prevCursorFlags:n.cursorFlags})}function Wb(t){if(t.defaultPrevented)return;const e=ks(),n=As();switch(e.state){case"active":{if(t.buttons===0){xi({cursorFlags:0,state:"inactive"}),e.hitRegions.forEach(r=>{const o=yo(r.group.id,!0);Hr(r.group,o)});return}TS({document:t.currentTarget,event:t,hitRegions:e.hitRegions,initialLayoutMap:e.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:e.pointerDownAtPoint,prevCursorFlags:e.cursorFlags});break}default:{const r=sg(t,n);r.length===0?e.state!=="inactive"&&xi({cursorFlags:0,state:"inactive"}):xi({cursorFlags:0,hitRegions:r,state:"hover"}),ag(t.currentTarget);break}}}function Hb(t){t.relatedTarget instanceof HTMLIFrameElement&&ks().state==="hover"&&xi({cursorFlags:0,state:"inactive"})}function qb(t){if(t.defaultPrevented||t.pointerType==="mouse"&&t.button>0)return;const e=ks();e.state==="active"&&(xi({cursorFlags:0,state:"inactive"}),e.hitRegions.length>0&&(ag(t.currentTarget),e.hitRegions.forEach(n=>{const r=yo(n.group.id,!0);Hr(n.group,r)}),t.preventDefault()))}function Ub(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 GA(t,e,n){if(!n[0])return;const r=t.panels.find(l=>l.element===e);if(!r||!r.onResize)return;const o=Di({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 ZA(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 JA({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 XA(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 qs=new Map;function QA(t){let e=!0;lt(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=Di({group:t});if(b===0)return;const w=yo(t.id);if(!w)return;const k=$p(t),v=w.defaultLayoutDeferred?Ub(k):w.layout,S=JA({group:t,nextGroupSize:b,prevGroupSize:w.groupSize,prevLayout:v}),E=ws({layout:S,panelConstraints:k});if(!w.defaultLayoutDeferred&&vs(w.layout,E)&&ZA(w.derivedPanelConstraints,k)&&w.groupSize===b)return;Hr(t,{defaultLayoutDeferred:!1,derivedPanelConstraints:k,groupSize:b,layout:E,separatorToPanels:w.separatorToPanels})}}else GA(t,y,g)}});s.observe(t.element),t.panels.forEach(p=>{lt(!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=Di({group:t}),a=$p(t),l=t.panels.map(({id:p})=>p).join(",");let c=t.mutableState.defaultLayout;c&&(XA(t.panels,c)||(c=void 0));const u=t.mutableState.layouts[l]??c??Ub(a),d=ws({layout:u,panelConstraints:a}),f=t.element.ownerDocument;qs.set(f,(qs.get(f)??0)+1);const h=new Map;return gS(t).forEach(p=>{p.separator&&h.set(p.separator,p.panels)}),Hr(t,{defaultLayoutDeferred:i===0,derivedPanelConstraints:a,groupSize:i,layout:d,separatorToPanels:h}),t.separators.forEach(p=>{lt(!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",Db)}),qs.get(f)===1&&(f.addEventListener("dblclick",Ib,!0),f.addEventListener("pointerdown",zb,!0),f.addEventListener("pointerleave",Vb),f.addEventListener("pointermove",Wb),f.addEventListener("pointerout",Hb),f.addEventListener("pointerup",qb,!0)),function(){e=!1,qs.set(f,Math.max(0,(qs.get(f)??0)-1)),IA(t),t.separators.forEach(p=>{p.element.removeEventListener("keydown",Db)}),qs.get(f)||(f.removeEventListener("dblclick",Ib,!0),f.removeEventListener("pointerdown",zb,!0),f.removeEventListener("pointerleave",Vb),f.removeEventListener("pointermove",Wb),f.removeEventListener("pointerout",Hb),f.removeEventListener("pointerup",qb,!0)),s.disconnect()}}function eI(){const[t,e]=x.useState({}),n=x.useCallback(()=>e({}),[]);return[t,n]}function lg(t){const e=x.useId();return`${t??e}`}const Is=typeof window<"u"?x.useLayoutEffect:x.useEffect;function Na(t){const e=x.useRef(t);return Is(()=>{e.current=t},[t]),x.useCallback((...n)=>e.current?.(...n),[e])}function cg(...t){return Na(e=>{t.forEach(n=>{if(n)switch(typeof n){case"function":{n(e);break}case"object":{n.current=e;break}}})})}function ug(t){const e=x.useRef({...t});return Is(()=>{for(const n in t)e.current[n]=t[n]},[t]),e.current}const RS=x.createContext(null);function tI(t,e){const n=x.useRef({getLayout:()=>({}),setLayout:KA});x.useImperativeHandle(e,()=>n.current,[]),Is(()=>{Object.assign(n.current,kS({groupId:t}))})}function MS({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=x.useRef({onLayoutChange:{},onLayoutChanged:{}}),m=Na(N=>{vs(p.current.onLayoutChange,N)||(p.current.onLayoutChange=N,l?.(N))}),g=Na(N=>{vs(p.current.onLayoutChanged,N)||(p.current.onLayoutChanged=N,c?.(N))}),y=lg(a),b=x.useRef(null),[w,k]=eI(),v=x.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=cg(b,s);tI(y,i);const E=Na((N,A)=>{const z=ks(),B=Nb(N),U=yo(N);if(U){let J=!1;return z.state==="active"&&(J=z.hitRegions.some(Y=>Y.group===B)),{flexGrow:U.layout[A]??1,pointerEvents:J?"none":void 0}}return{flexGrow:n?.[A]??1}}),M=ug({defaultLayout:n,disableCursor:r}),D=x.useMemo(()=>({get disableCursor(){return!!M.disableCursor},getPanelStyles:E,id:y,orientation:u,registerPanel:N=>{const A=v.current;return A.panels=Ap(u,[...A.panels,N]),k(),()=>{A.panels=A.panels.filter(z=>z!==N),k()}},registerSeparator:N=>{const A=v.current;return A.separators=Ap(u,[...A.separators,N]),k(),()=>{A.separators=A.separators.filter(z=>z!==N),k()}},togglePanelDisabled:(N,A)=>{const z=v.current.panels.find(J=>J.id===N);z&&(z.panelConstraints.disabled=A);const B=Nb(y),U=yo(y);B&&U&&Hr(B,{...U,derivedPanelConstraints:$p(B)})},toggleSeparatorDisabled:(N,A)=>{const z=v.current.separators.find(B=>B.id===N);z&&(z.disabled=A)}}),[E,y,k,u,M]),F=x.useRef(null);return Is(()=>{const N=b.current;if(N===null)return;const A=v.current;let z;if(M.defaultLayout!==void 0&&Object.keys(M.defaultLayout).length===A.panels.length){z={};for(const L of A.panels){const W=M.defaultLayout[L.id];W!==void 0&&(z[L.id]=W)}}const B={disabled:!!o,element:N,id:y,mutableState:{defaultLayout:z,disableCursor:!!M.disableCursor,expandedPanelSizes:v.current.lastExpandedPanelSizes,layouts:v.current.layouts},orientation:u,panels:A.panels,resizeTargetMinimumSize:A.resizeTargetMinimumSize,separators:A.separators};F.current=B;const U=QA(B),{defaultLayoutDeferred:J,derivedPanelConstraints:Y,layout:K}=yo(B.id,!0);!J&&Y.length>0&&(m(K),g(K));const G=og(y,L=>{const{defaultLayoutDeferred:W,derivedPanelConstraints:$,layout:j}=L.next;if(W||$.length===0)return;const R=B.panels.map(({id:I})=>I).join(",");B.mutableState.layouts[R]=j,$.forEach(I=>{if(I.collapsible){const{layout:Z}=L.prev??{};if(Z){const X=on(I.collapsedSize,j[I.panelId]),_=on(I.collapsedSize,Z[I.panelId]);X&&!_&&(B.mutableState.expandedPanelSizes[I.panelId]=Z[I.panelId])}}});const P=ks().state!=="active";m(j),P&&g(j)});return()=>{F.current=null,U(),G()}},[o,y,g,m,u,w,M]),x.useEffect(()=>{const N=F.current;N&&(N.mutableState.defaultLayout=n,N.mutableState.disableCursor=!!r)}),C.jsx(RS.Provider,{value:D,children:C.jsx("div",{...h,className:e,"data-group":!0,"data-testid":y,id:y,ref:S,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})})}MS.displayName="Group";function dg(){const t=x.useContext(RS);return lt(t,"Group Context not found; did you render a Panel or Separator outside of a Group?"),t}function nI(t,e){const{id:n}=dg(),r=x.useRef({collapse:lh,expand:lh,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:lh});x.useImperativeHandle(e,()=>r.current,[]),Is(()=>{Object.assign(r.current,wS({groupId:n,panelId:t}))})}function OS({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=lg(l),y=ug({disabled:s}),b=x.useRef(null),w=cg(b,i),{getPanelStyles:k,id:v,orientation:S,registerPanel:E,togglePanelDisabled:M}=dg(),D=d!==null,F=Na((A,z,B)=>{d?.(A,l,B)});Is(()=>{const A=b.current;if(A!==null){const z={element:A,id:g,idIsStable:m,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:D?F:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsible:r,defaultSize:o,disabled:y.disabled,maxSize:c,minSize:u}};return E(z)}},[a,n,r,o,D,g,m,c,u,F,E,y]),x.useEffect(()=>{M(g,!!s)},[s,g,M]),nI(g,f);const N=x.useSyncExternalStore(A=>og(v,A),()=>JSON.stringify(k(v,g)),()=>JSON.stringify(k(v,g)));return C.jsx("div",{...p,"aria-disabled":s||void 0,"data-panel":!0,"data-testid":g,id:g,ref:w,style:{...rI,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...JSON.parse(N)},children:C.jsx("div",{className:e,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...h,touchAction:S==="horizontal"?"pan-y":"pan-x"},children:t})})}OS.displayName="Panel";const rI={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function oI({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=ws({layout:Ya({delta:c-i,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[n],o=ws({layout:Ya({delta:l-i,initialLayout:t,panelConstraints:e,pivotIndices:u,prevLayout:t}),panelConstraints:e})[n]}return{valueControls:n,valueMax:o,valueMin:s,valueNow:i}}function _S({children:t,className:e,disabled:n,elementRef:r,id:o,style:s,...i}){const a=lg(o),l=ug({disabled:n}),[c,u]=x.useState({}),[d,f]=x.useState("inactive"),h=x.useRef(null),p=cg(h,r),{disableCursor:m,id:g,orientation:y,registerSeparator:b,toggleSeparatorDisabled:w}=dg(),k=y==="horizontal"?"vertical":"horizontal";Is(()=>{const S=h.current;if(S!==null){const E={disabled:l.disabled,element:S,id:a},M=b(E),D=qA(N=>{f(N.next.state!=="inactive"&&N.next.hitRegions.some(A=>A.separator===E)?N.next.state:"inactive")}),F=og(g,N=>{const{derivedPanelConstraints:A,layout:z,separatorToPanels:B}=N.next,U=B.get(E);if(U){const J=U[0],Y=U.indexOf(J);u(oI({layout:z,panelConstraints:A,panelId:J.id,panelIndex:Y}))}});return()=>{D(),F(),M()}}},[g,a,b,l]),x.useEffect(()=>{w(a,!!n)},[n,a,w]);let v;return n&&!m&&(v="not-allowed"),C.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})}_S.displayName="Separator";function sI(t){const e=Ee.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=de("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=C.jsx(MS,{"data-slot":"resizable-panel-group",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function ch(t){const e=Ee.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=C.jsx(OS,{"data-slot":"resizable-panel",...n}),e[2]=n,e[3]=r):r=e[3],r}function Kb(t){const e=Ee.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=de("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&&C.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=C.jsx(_S,{"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 Ga({controlled:t,default:e,name:n,state:r="value"}){const{current:o}=x.useRef(t!==void 0),[s,i]=x.useState(e),a=o?t:s,l=x.useCallback(c=>{o||i(c)},[]);return[a,l]}const NS=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function iI(){return x.useContext(NS)}function fg(t){const{children:e,elementsRef:n,labelsRef:r,onMapChange:o}=t,s=ye(o),i=x.useRef(0),a=ln(lI).current,l=ln(aI).current,[c,u]=x.useState(0),d=x.useRef(c),f=ye((y,b)=>{l.set(y,b??null),d.current+=1,u(d.current)}),h=ye(y=>{l.delete(y),d.current+=1,u(d.current)}),p=x.useMemo(()=>{const y=new Map;return Array.from(l.keys()).filter(w=>w.isConnected).sort(cI).forEach((w,k)=>{const v=l.get(w)??{};y.set(w,{...v,index:k})}),y},[l,c]);ve(()=>{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]),ve(()=>{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]),ve(()=>()=>{n.current=[]},[n]),ve(()=>()=>{r&&(r.current=[])},[r]);const m=ye(y=>(a.add(y),()=>{a.delete(y)}));ve(()=>{a.forEach(y=>y(p))},[a,p]);const g=x.useMemo(()=>({register:f,unregister:h,subscribeMapChange:m,elementsRef:n,labelsRef:r,nextIndexRef:i}),[f,h,m,n,r,i]);return C.jsx(NS.Provider,{value:g,children:e})}function aI(){return new Map}function lI(){return new Set}function cI(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 PS=x.createContext(void 0);function hg(){const t=x.useContext(PS);if(t===void 0)throw new Error(en(64));return t}let uI=(function(t){return t.activationDirection="data-activation-direction",t.orientation="data-orientation",t})({});const pg={tabActivationDirection:t=>({[uI.activationDirection]:t})},dI=x.forwardRef(function(e,n){const{className:r,defaultValue:o=0,onValueChange:s,orientation:i="horizontal",render:a,value:l,...c}=e,u=Xm(),d=Object.hasOwn(e,"defaultValue"),f=x.useRef([]),[h,p]=x.useState(()=>new Map),[m,g]=Ga({controlled:l,default:o,name:"Tabs",state:"value"}),y=l!==void 0,[b,w]=x.useState(()=>new Map),[k,v]=x.useState("none"),S=ye((Y,K)=>{s?.(Y,K),!K.isCanceled&&(g(Y),v(K.activationDirection))}),E=ye((Y,K)=>{p(G=>{if(G.get(Y)===K)return G;const L=new Map(G);return L.set(Y,K),L})}),M=ye((Y,K)=>{p(G=>{if(!G.has(Y)||G.get(Y)!==K)return G;const L=new Map(G);return L.delete(Y),L})}),D=x.useCallback(Y=>h.get(Y),[h]),F=x.useCallback(Y=>{for(const K of b.values())if(Y===K?.value)return K?.id},[b]),N=x.useCallback(Y=>{if(Y===void 0)return null;for(const[K,G]of b.entries())if(G!=null&&Y===(G.value??G.index))return K;return null},[b]),A=x.useMemo(()=>({direction:u,getTabElementBySelectedValue:N,getTabIdByPanelValue:F,getTabPanelIdByValue:D,onValueChange:S,orientation:i,registerMountedTabPanel:E,setTabMap:w,unregisterMountedTabPanel:M,tabActivationDirection:k,value:m}),[u,N,F,D,S,i,E,w,M,k,m]),z=x.useMemo(()=>{for(const Y of b.values())if(Y!=null&&Y.value===m)return Y},[b,m]),B=x.useMemo(()=>{for(const Y of b.values())if(Y!=null&&!Y.disabled)return Y.value},[b]);ve(()=>{if(y||b.size===0)return;const Y=z?.disabled,K=z==null&&m!==null;if(d&&Y&&m===o||!Y&&!K)return;const L=B??null;m!==L&&(g(L),v("none"))},[o,B,d,y,z,v,g,b,m]);const J=at("div",e,{state:{orientation:i,tabActivationDirection:k},ref:n,props:c,stateAttributesMapping:pg});return C.jsx(PS.Provider,{value:A,children:C.jsx(fg,{elementsRef:f,children:J})})}),$S="data-composite-item-active";let AS=(function(t){return t[t.None=0]="None",t[t.GuessFromOrder=1]="GuessFromOrder",t})({});function mg(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}=iI(),f=x.useRef(-1),[h,p]=x.useState(s??(o===AS.GuessFromOrder?()=>{if(f.current===-1){const y=d.current;d.current+=1,f.current=y}return f.current}:-1)),m=x.useRef(null),g=x.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 ve(()=>{if(s!=null)return;const y=m.current;if(y)return i(y,n),()=>{a(y)}},[s,i,a,n]),ve(()=>{if(s==null)return l(y=>{const b=m.current?y.get(m.current)?.index:null;b!=null&&p(b)})},[s,l,p]),x.useMemo(()=>({ref:g,index:h}),[h,g])}function fI(t={}){const{highlightItemOnHover:e,highlightedIndex:n,onHighlightedIndexChange:r}=hS(),{ref:o,index:s}=mg(t),i=n===s,a=x.useRef(null),l=Wr(o,a);return{compositeProps:x.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 IS=x.createContext(void 0);function hI(){const t=x.useContext(IS);if(t===void 0)throw new Error(en(65));return t}const pI=x.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}=hg(),{activateOnFocus:h,highlightedTabIndex:p,onTabActivation:m,setHighlightedTabIndex:g,tabsListElement:y}=hI(),b=Ns(a),w=x.useMemo(()=>({disabled:o,id:b,value:i}),[o,b,i]),{compositeProps:k,compositeRef:v,index:S}=fI({metadata:w}),E=i===u,M=x.useRef(!1);ve(()=>{if(M.current){M.current=!1;return}if(!(E&&S>-1&&p!==S))return;const G=y;if(G!=null){const L=qn(Xe(G));if(L&&Ye(G,L))return}o||g(S)},[E,S,p,g,o,y]);const{getButtonProps:D,buttonRef:F}=$s({disabled:o,native:l,focusableWhenDisabled:!0}),N=d(i),A=x.useRef(!1),z=x.useRef(!1);function B(G){E||o||m(i,He(Eo,G.nativeEvent,void 0,{activationDirection:"none"}))}function U(G){E||(S>-1&&!o&&g(S),!o&&h&&(!A.current||A.current&&z.current)&&m(i,He(Eo,G.nativeEvent,void 0,{activationDirection:"none"})))}function J(G){if(E||o)return;A.current=!0;function L(){A.current=!1,z.current=!1}(!G.button||G.button===0)&&(z.current=!0,Xe(G.currentTarget).addEventListener("pointerup",L,{once:!0}))}return at("button",e,{state:{disabled:o,active:E,orientation:f},ref:[n,F,v],props:[k,{role:"tab","aria-controls":N,"aria-selected":E,id:b,onClick:B,onFocus:U,onPointerDown:J,[$S]:E?"":void 0,onKeyDownCapture(){M.current=!0}},c,D]})}),mI=x.createContext(void 0),gI={disableStyleElements:!1};function yI(){return x.useContext(mI)??gI}let bI=(function(t){return t.index="data-index",t.activationDirection="data-activation-direction",t.orientation="data-orientation",t.hidden="data-hidden",t})({});const vI={...pg,...Qi},wI=x.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}=hg(),p=Ns(),m=x.useMemo(()=>({id:p,value:o}),[p,o]),{ref:g,index:y}=mg({metadata:m}),b=o===l,{mounted:w,transitionStatus:k,setMounted:v}=yl(b),S=!w,E=c(o),M={hidden:S,orientation:u,tabActivationDirection:d,transitionStatus:k},D=x.useRef(null),F=at("div",e,{state:M,ref:[n,g,D],props:[{"aria-labelledby":E,hidden:S,id:p,role:"tabpanel",tabIndex:b?0:-1,inert:df(!b),[bI.index]:y},a],stateAttributesMapping:vI});return Io({open:b,ref:D,onComplete(){b||v(!1)}}),ve(()=>{if(!(S&&!i)&&p!=null)return f(o,p),()=>{h(o,p)}},[S,i,o,p,f,h]),i||w?F:null});function kI(t){return t==null||t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true"}const Si="ArrowUp",ts="ArrowDown",Za="ArrowLeft",Ei="ArrowRight",bl="Home",vl="End",DS=new Set([Za,Ei]),xI=new Set([Za,Ei,bl,vl]),zS=new Set([Si,ts]),SI=new Set([Si,ts,bl,vl]),jS=new Set([...DS,...zS]),EI=new Set([...jS,bl,vl]),gg=new Set([Si,ts,Za,Ei,bl,vl]),CI="Shift",TI="Control",RI="Alt",MI="Meta",OI=new Set([CI,TI,RI,MI]);function _I(t){return xt(t)&&t.tagName==="INPUT"}function Yb(t){return!!(_I(t)&&t.selectionStart!=null||xt(t)&&t.tagName==="TEXTAREA")}function Gb(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=Zb(t,e,"left"),c=Gl(t),u=Gl(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=Zb(t,e,"top"),c=Gl(t),u=Gl(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 Zb(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 Gl(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 NI=[];function PI(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=NI}=t,[p,m]=x.useState(0),g=n>1,y=x.useRef(null),b=Wr(y,c),w=x.useRef([]),k=x.useRef(!1),v=a??p,S=ye((D,F=!1)=>{if((l??m)(D),F){const N=w.current[D];Gb(y.current,N,i,s)}}),E=ye(D=>{if(D.size===0||k.current)return;k.current=!0;const F=Array.from(D.keys()),N=F.find(z=>z?.hasAttribute($S))??null,A=N?F.indexOf(N):-1;A!==-1&&S(A),Gb(y.current,N,i,s)}),M=x.useMemo(()=>({"aria-orientation":s==="both"?void 0:s,ref:b,onFocus(D){!y.current||!Yb(D.target)||D.target.setSelectionRange(0,D.target.value.length??0)},onKeyDown(D){const F=u?EI:jS;if(!F.has(D.key)||$I(D,h)||!y.current)return;const A=i==="rtl",z=A?Za:Ei,B={horizontal:z,vertical:ts,both:z}[s],U=A?Ei:Za,J={horizontal:U,vertical:Si,both:U}[s];if(Yb(D.target)&&!kI(D.target)){const j=D.target.selectionStart,R=D.target.selectionEnd,P=D.target.value??"";if(j==null||D.shiftKey||j!==R||D.key!==J&&j<P.length||D.key!==B&&j>0)return}let Y=v;const K=ku(w,f),G=Ep(w,f);if(g){const j=e||Array.from({length:w.current.length},()=>({width:1,height:1})),R=Zx(j,n,o),P=R.findIndex(Z=>Z!=null&&!go(w,Z,f)),I=R.reduce((Z,X,_)=>X!=null&&!go(w,X,f)?_:Z,-1);Y=R[Gx({current:R.map(Z=>Z?w.current[Z]:null)},{event:D,orientation:s,loopFocus:r,cols:n,disabledIndices:Xx([...f||w.current.map((Z,X)=>go(w,X)?X:void 0),void 0],R),minIndex:P,maxIndex:I,prevIndex:Jx(v>G?K:v,j,R,n,D.key===ts?"bl":D.key===Ei?"tr":"tl"),rtl:A})]}const L={horizontal:[z],vertical:[ts],both:[z,ts]}[s],W={horizontal:[U],vertical:[Si],both:[U,Si]}[s],$=g?F:{horizontal:u?xI:DS,vertical:u?SI:zS,both:F}[s];u&&(D.key===bl?Y=K:D.key===vl&&(Y=G)),Y===v&&(L.includes(D.key)||W.includes(D.key))&&(r&&Y===G&&L.includes(D.key)?Y=K:r&&Y===K&&W.includes(D.key)?Y=G:Y=Ut(w,{startingIndex:Y,decrement:W.includes(D.key),disabledIndices:f})),Y!==v&&!yi(w,Y)&&(d&&D.stopPropagation(),$.has(D.key)&&D.preventDefault(),S(Y,!0),queueMicrotask(()=>{w.current[Y]?.focus()}))}}),[n,o,i,f,w,u,v,g,e,r,b,h,S,s,d]);return x.useMemo(()=>({props:M,highlightedIndex:v,onHighlightedIndexChange:S,elementsRef:w,disabledIndices:f,onMapChange:E,relayKeyboardEvent:M.onKeyDown}),[M,v,S,w,f,E])}function $I(t,e){for(const n of OI.values())if(!e.includes(n)&&t.getModifierState(n))return!0;return!1}function AI(t){const{render:e,className:n,refs:r=qa,props:o=qa,state:s=jt,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",...S}=t,E=Xm(),{props:M,highlightedIndex:D,onHighlightedIndexChange:F,elementsRef:N,onMapChange:A,relayKeyboardEvent:z}=PI({itemSizes:d,cols:h,loopFocus:f,dense:u,orientation:c,highlightedIndex:a,onHighlightedIndexChange:l,rootRef:y,stopEventPropagation:g,enableHomeAndEndKeys:p,direction:E,disabledIndices:b,modifierKeys:w}),B=at(v,t,{state:s,ref:r,props:[M,...o,S],stateAttributesMapping:i}),U=x.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:F,highlightItemOnHover:k,relayKeyboardEvent:z}),[D,F,k,z]);return C.jsx(fS.Provider,{value:U,children:C.jsx(fg,{elementsRef:N,onMapChange:J=>{m?.(J),A(J)},children:B})})}const II=x.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}=hg(),[p,m]=x.useState(0),[g,y]=x.useState(null),b=DI(d,u,g,l),w=ye((E,M)=>{if(E!==d){const D=b(E);M.activationDirection=D,c(E,M)}}),k={orientation:u,tabActivationDirection:h},v={"aria-orientation":u==="vertical"?"vertical":void 0,role:"tablist"},S=x.useMemo(()=>({activateOnFocus:r,highlightedTabIndex:p,onTabActivation:w,setHighlightedTabIndex:m,tabsListElement:g,value:d}),[r,p,w,m,g,d]);return C.jsx(IS.Provider,{value:S,children:C.jsx(AI,{render:i,className:o,state:k,refs:[n,y],props:[v,a],stateAttributesMapping:pg,highlightedIndex:p,enableHomeAndEndKeys:!0,loopFocus:s,orientation:u,onHighlightedIndexChange:m,onMapChange:f,disabledIndices:qa})})});function Jb(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 DI(t,e,n,r){const[o,s]=x.useState(null);return ve(()=>{if(t==null||n==null){s(null);return}const i=r(t);if(i==null){s(null);return}const{left:a,top:l}=Jb(i,n);s(e==="horizontal"?a:l)},[e,r,n,t]),x.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}=Jb(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 LS(t){const e=Ee.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=de("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=C.jsx(dI,{"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 zI=hf("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 FS(t){const e=Ee.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=de(zI({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=C.jsx(II,{"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 Vu(t){const e=Ee.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=de("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=C.jsx(pI,{"data-slot":"tabs-trigger",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function Xb(t){const e=Ee.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=de("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=C.jsx(wI,{"data-slot":"tabs-content",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}let Qb={},ev={},tv="";function jI(t){if(typeof document>"u")return!1;const e=Xe(t);return Pt(e).innerWidth-e.documentElement.clientWidth>0}function LI(t){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=Xe(t),r=n.documentElement,o=n.body,s=Po(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 FI(t){const e=Xe(t),n=e.documentElement,r=e.body,o=Po(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 BI(t){const e=Xe(t),n=e.documentElement,r=e.body,o=Pt(n);let s=0,i=0,a=!1;const l=cr.create();if(Am&&(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,Qb={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},tv=n.style.scrollBehavior,ev={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),S=Math.max(0,o.innerHeight-r.clientHeight),E=parseFloat(h.marginTop)+parseFloat(h.marginBottom),M=parseFloat(h.marginLeft)+parseFloat(h.marginRight),D=Po(n)?n:r;if(a=LI(t),a){n.style.scrollbarGutter=g,D.style.overflowY="hidden",D.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:E||S?`calc(100dvh - ${E+S}px)`:"100dvh",width:M||v?`calc(100vw - ${M+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,Qb),Object.assign(r.style,ev),a||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=tv)}function d(){u(),l.request(c)}return c(),o.addEventListener("resize",d),()=>{l.cancel(),u(),typeof o.removeEventListener=="function"&&o.removeEventListener("resize",d)}}class VI{lockCount=0;restore=null;timeoutLock=gs.create();timeoutUnlock=gs.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=Xe(e).documentElement,o=Pt(r).getComputedStyle(r).overflowY;if(o==="hidden"||o==="clip"){this.restore=pn;return}const s=Fx||!jI(e);this.restore=s?FI(e):BI(e)}}const WI=new VI;function yg(t=!0,e=null){ve(()=>{if(t)return WI.acquire(e)},[t,e])}function HI(t){const e=x.useRef(""),n=x.useCallback(o=>{o.defaultPrevented||(e.current=o.pointerType,t(o,o.pointerType))},[t]);return{onClick:x.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 bg(t){const[e,n]=x.useState(null),r=ye((a,l)=>{t||n(l||(Fx?"touch":""))}),o=x.useCallback(()=>{n(null)},[]),{onClick:s,onPointerDown:i}=HI(r);return x.useMemo(()=>({openMethod:e,reset:o,triggerProps:{onClick:s,onPointerDown:i}}),[e,o,s,i])}function qI(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}=bg(o);z1(e);const{forceUnmount:d}=j1(o,e,()=>{u()}),f=ye(F=>{const N=He(F);return N.preventUnmountOnClose=()=>{e.set("preventUnmountingOnClose",!0)},N}),h=x.useCallback(()=>{e.setOpen(!1,f(p1))},[e,f]);x.useImperativeHandle(r,()=>({unmount:d,close:h}),[d,h]);const p=V1({popupStore:e,onOpenChange:e.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[m,g]=x.useState(0),y=m===0,b=H1(p),w=Km(p,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(F){if(!e.context.outsidePressEnabledRef.current||"button"in F&&F.button!==0||"touches"in F&&F.touches.length!==1)return!1;const N=Sn(F);if(y&&!s){const A=N;return i&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===A||e.context.backdropRef.current===A||Ye(A,a)&&!A?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:y});yg(o&&i===!0,a);const{getReferenceProps:k,getFloatingProps:v,getTriggerProps:S}=lf([b,w]);e.useContextCallback("onNestedDialogOpen",F=>{g(F+1)}),e.useContextCallback("onNestedDialogClose",()=>{g(0)}),x.useEffect(()=>(n?.onNestedDialogOpen&&o&&n.onNestedDialogOpen(m),n?.onNestedDialogClose&&!o&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&o&&n.onNestedDialogClose()}),[o,n,m]);const E=x.useMemo(()=>k(c),[k,c]),M=x.useMemo(()=>S(c),[S,c]),D=x.useMemo(()=>v(),[v]);e.useSyncedValues({openMethod:l,activeTriggerProps:E,inactiveTriggerProps:M,popupProps:D,floatingRootContext:p,nestedOpenDialogCount:m})}const BS=x.createContext(void 0);function Ds(t){return x.useContext(BS)}const UI={...F1,modal:we(t=>t.modal),nested:we(t=>t.nested),nestedOpenDialogCount:we(t=>t.nestedOpenDialogCount),disablePointerDismissal:we(t=>t.disablePointerDismissal),openMethod:we(t=>t.openMethod),descriptionElementId:we(t=>t.descriptionElementId),titleElementId:we(t=>t.titleElementId),viewportElement:we(t=>t.viewportElement),role:we(t=>t.role)};class KI extends Gm{constructor(e){super(YI(e),{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new af,onOpenChange:void 0,onOpenChangeComplete:void 0},UI)}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 YI(t={}){return{...L1(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...t}}function GI(t){const{children:e,open:n,defaultOpen:r=!1,onOpenChange:o,onOpenChangeComplete:s,actionsRef:i,handle:a,triggerId:l,defaultTriggerId:c=null}=t,u=Ds(),d=!!u,f=ln(()=>a?.store??new KI({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");qI({store:f,actionsRef:i,parentContext:u?.store.context});const p=x.useMemo(()=>({store:f}),[f]);return C.jsx(BS.Provider,{value:p,children:typeof e=="function"?e({payload:h}):e})}const ZI={...ea,...Qi},JI=x.forwardRef(function(e,n){const{render:r,className:o,forceRender:s=!1,...i}=e,{store:a}=Ds(),l=a.useState("open"),c=a.useState("nested"),u=a.useState("mounted"),d=a.useState("transitionStatus");return at("div",e,{state:{open:l,transitionStatus:d},ref:[a.context.backdropRef,n],stateAttributesMapping:ZI,props:[{role:"presentation",hidden:!u,style:{userSelect:"none",WebkitUserSelect:"none"}},i],enabled:s||!c})}),XI=x.forwardRef(function(e,n){const{render:r,className:o,disabled:s=!1,nativeButton:i=!0,...a}=e,{store:l}=Ds(),c=l.useState("open");function u(p){c&&l.setOpen(!1,He(v_,p.nativeEvent))}const{getButtonProps:d,buttonRef:f}=$s({disabled:s,native:i});return at("button",e,{state:{disabled:s},ref:[n,f],props:[{onClick:u},a,d]})}),QI=x.forwardRef(function(e,n){const{render:r,className:o,id:s,...i}=e,{store:a}=Ds(),l=Ns(s);return a.useSyncedValueWithCleanup("descriptionElementId",l),at("p",e,{ref:n,props:[{id:l},i]})});let eD=(function(t){return t.nestedDialogs="--nested-dialogs",t})({}),tD=(function(t){return t[t.open=es.open]="open",t[t.closed=es.closed]="closed",t[t.startingStyle=es.startingStyle]="startingStyle",t[t.endingStyle=es.endingStyle]="endingStyle",t.nested="data-nested",t.nestedDialogOpen="data-nested-dialog-open",t})({});const VS=x.createContext(void 0);function nD(){const t=x.useContext(VS);if(t===void 0)throw new Error(en(26));return t}const rD={...ea,...Qi,nestedDialogOpen(t){return t?{[tD.nestedDialogOpen]:""}:null}},oD=x.forwardRef(function(e,n){const{className:r,finalFocus:o,initialFocus:s,render:i,...a}=e,{store:l}=Ds(),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");nD(),Io({open:y,ref:l.context.popupRef,onComplete(){y&&l.context.onOpenChangeComplete?.(!0)}});function S(N){return N==="touch"?l.context.popupRef.current:!0}const E=s===void 0?S:s,M=g>0,F=at("div",e,{state:{open:y,nested:m,transitionStatus:k,nestedDialogOpen:M},props:[f,{"aria-labelledby":w??void 0,"aria-describedby":c??void 0,role:v,tabIndex:-1,hidden:!p,onKeyDown(N){gg.has(N.key)&&N.stopPropagation()},style:{[eD.nestedDialogs]:g}},a],ref:[n,l.context.popupRef,l.useStateSetter("popupElement")],stateAttributesMapping:rD});return C.jsx(qm,{context:d,openInteractionType:b,disabled:!p,closeOnFocusOut:!u,initialFocus:E,returnFocus:o,modal:h!==!1,restoreFocus:"popup",children:F})}),vg=x.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 C.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})}),sD=x.forwardRef(function(e,n){const{keepMounted:r=!1,...o}=e,{store:s}=Ds(),i=s.useState("mounted"),a=s.useState("modal"),l=s.useState("open");return i||r?C.jsx(VS.Provider,{value:r,children:C.jsxs(Wm,{ref:n,...o,children:[i&&a===!0&&C.jsx(vg,{ref:s.context.internalBackdropRef,inert:df(!l)}),e.children]})}):null}),iD=x.forwardRef(function(e,n){const{render:r,className:o,id:s,...i}=e,{store:a}=Ds(),l=Ns(s);return a.useSyncedValueWithCleanup("titleElementId",l),at("h2",e,{ref:n,props:[{id:l},i]})});function aD(t){const e=Ee.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=C.jsx(GI,{"data-slot":"alert-dialog",...n}),e[2]=n,e[3]=r):r=e[3],r}function lD(t){const e=Ee.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=C.jsx(sD,{"data-slot":"alert-dialog-portal",...n}),e[2]=n,e[3]=r):r=e[3],r}function cD(t){const e=Ee.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=de("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=C.jsx(JI,{"data-slot":"alert-dialog-overlay",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function uD(t){const e=Ee.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=C.jsx(cD,{}),e[4]=i):i=e[4];let a;e[5]!==n?(a=de("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=C.jsxs(lD,{children:[i,C.jsx(oD,{"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 dD(t){const e=Ee.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=de("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=C.jsx("div",{"data-slot":"alert-dialog-header",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function fD(t){const e=Ee.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=de("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=C.jsx("div",{"data-slot":"alert-dialog-footer",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function hD(t){const e=Ee.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=de("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=C.jsx(iD,{"data-slot":"alert-dialog-title",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function pD(t){const e=Ee.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=de("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=C.jsx(QI,{"data-slot":"alert-dialog-description",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function mD(t){const e=Ee.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=de(n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=C.jsx(yn,{"data-slot":"alert-dialog-action",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function gD(t){const e=Ee.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=de(n),e[5]=n,e[6]=l):l=e[6];let c;e[7]!==a||e[8]!==i?(c=C.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=C.jsx(XI,{"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 yD(t){return at(t.defaultTagName??"div",t,t)}const bD=hf("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 Wu(t){const e=Ee.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=yD,r="span",o=Xi({className:de(bD({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)}var nv=1,vD=.9,wD=.8,kD=.17,uh=.1,dh=.999,xD=.9999,SD=.99,ED=/[\\\/_+.#"@\[\(\{&]/,CD=/[\\\/_+.#"@\[\(\{&]/g,TD=/[\s-]/,WS=/[\s-]/g;function Ip(t,e,n,r,o,s,i){if(s===e.length)return o===t.length?nv:SD;var a=`${o},${s}`;if(i[a]!==void 0)return i[a];for(var l=r.charAt(s),c=n.indexOf(l,o),u=0,d,f,h,p;c>=0;)d=Ip(t,e,n,r,c+1,s+1,i),d>u&&(c===o?d*=nv:ED.test(t.charAt(c-1))?(d*=wD,h=t.slice(o,c-1).match(CD),h&&o>0&&(d*=Math.pow(dh,h.length))):TD.test(t.charAt(c-1))?(d*=vD,p=t.slice(o,c-1).match(WS),p&&o>0&&(d*=Math.pow(dh,p.length))):(d*=kD,o>0&&(d*=Math.pow(dh,c-o))),t.charAt(c)!==e.charAt(s)&&(d*=xD)),(d<uh&&n.charAt(c-1)===r.charAt(s+1)||r.charAt(s+1)===r.charAt(s)&&n.charAt(c-1)!==r.charAt(s))&&(f=Ip(t,e,n,r,c+1,s+2,i),f*uh>d&&(d=f*uh)),d>u&&(u=d),c=n.indexOf(l,c+1);return i[a]=u,u}function rv(t){return t.toLowerCase().replace(WS," ")}function RD(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,Ip(t,e,rv(t),rv(e),0,0,{})}function bo(t,e,{checkForDefaultPrevented:n=!0}={}){return function(o){if(t?.(o),n===!1||!o.defaultPrevented)return e?.(o)}}function ov(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Co(...t){return e=>{let n=!1;const r=t.map(o=>{const s=ov(o,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():ov(t[o],null)}}}}function zs(...t){return x.useCallback(Co(...t),t)}function MD(t,e){const n=x.createContext(e),r=s=>{const{children:i,...a}=s,l=x.useMemo(()=>a,Object.values(a));return C.jsx(n.Provider,{value:l,children:i})};r.displayName=t+"Provider";function o(s){const i=x.useContext(n);if(i)return i;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[r,o]}function OD(t,e=[]){let n=[];function r(s,i){const a=x.createContext(i),l=n.length;n=[...n,i];const c=d=>{const{scope:f,children:h,...p}=d,m=f?.[t]?.[l]||a,g=x.useMemo(()=>p,Object.values(p));return C.jsx(m.Provider,{value:g,children:h})};c.displayName=s+"Provider";function u(d,f){const h=f?.[t]?.[l]||a,p=x.useContext(h);if(p)return p;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const o=()=>{const s=n.map(i=>x.createContext(i));return function(a){const l=a?.[t]||s;return x.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return o.scopeName=t,[r,_D(o,...e)]}function _D(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return x.useMemo(()=>({[`__scope${e.scopeName}`]:i}),[i])}};return n.scopeName=e.scopeName,n}var Ja=globalThis?.document?x.useLayoutEffect:()=>{},ND=pl[" useId ".trim().toString()]||(()=>{}),PD=0;function jr(t){const[e,n]=x.useState(ND());return Ja(()=>{n(r=>r??String(PD++))},[t]),e?`radix-${e}`:""}var $D=pl[" useInsertionEffect ".trim().toString()]||Ja;function AD({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[o,s,i]=ID({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:o;{const u=x.useRef(t!==void 0);x.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const c=x.useCallback(u=>{if(a){const d=DD(u)?u(t):u;d!==t&&i.current?.(d)}else s(u)},[a,t,s,i]);return[l,c]}function ID({defaultProp:t,onChange:e}){const[n,r]=x.useState(t),o=x.useRef(n),s=x.useRef(e);return $D(()=>{s.current=e},[e]),x.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function DD(t){return typeof t=="function"}function HS(t){const e=zD(t),n=x.forwardRef((r,o)=>{const{children:s,...i}=r,a=x.Children.toArray(s),l=a.find(LD);if(l){const c=l.props.children,u=a.map(d=>d===l?x.Children.count(c)>1?x.Children.only(null):x.isValidElement(c)?c.props.children:null:d);return C.jsx(e,{...i,ref:o,children:x.isValidElement(c)?x.cloneElement(c,void 0,u):null})}return C.jsx(e,{...i,ref:o,children:s})});return n.displayName=`${t}.Slot`,n}function zD(t){const e=x.forwardRef((n,r)=>{const{children:o,...s}=n;if(x.isValidElement(o)){const i=BD(o),a=FD(s,o.props);return o.type!==x.Fragment&&(a.ref=r?Co(r,i):i),x.cloneElement(o,a)}return x.Children.count(o)>1?x.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var jD=Symbol("radix.slottable");function LD(t){return x.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===jD}function FD(t,e){const n={...e};for(const r in e){const o=t[r],s=e[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...t,...n}}function BD(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var VD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],qr=VD.reduce((t,e)=>{const n=HS(`Primitive.${e}`),r=x.forwardRef((o,s)=>{const{asChild:i,...a}=o,l=i?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),C.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function WD(t,e){t&&Xn.flushSync(()=>t.dispatchEvent(e))}function Xa(t){const e=x.useRef(t);return x.useEffect(()=>{e.current=t}),x.useMemo(()=>(...n)=>e.current?.(...n),[])}function HD(t,e=globalThis?.document){const n=Xa(t);x.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var qD="DismissableLayer",Dp="dismissableLayer.update",UD="dismissableLayer.pointerDownOutside",KD="dismissableLayer.focusOutside",sv,qS=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),US=x.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...l}=t,c=x.useContext(qS),[u,d]=x.useState(null),f=u?.ownerDocument??globalThis?.document,[,h]=x.useState({}),p=zs(e,E=>d(E)),m=Array.from(c.layers),[g]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(g),b=u?m.indexOf(u):-1,w=c.layersWithOutsidePointerEventsDisabled.size>0,k=b>=y,v=ZD(E=>{const M=E.target,D=[...c.branches].some(F=>F.contains(M));!k||D||(o?.(E),i?.(E),E.defaultPrevented||a?.())},f),S=JD(E=>{const M=E.target;[...c.branches].some(F=>F.contains(M))||(s?.(E),i?.(E),E.defaultPrevented||a?.())},f);return HD(E=>{b===c.layers.size-1&&(r?.(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},f),x.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(sv=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),iv(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=sv)}},[u,f,n,c]),x.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),iv())},[u,c]),x.useEffect(()=>{const E=()=>h({});return document.addEventListener(Dp,E),()=>document.removeEventListener(Dp,E)},[]),C.jsx(qr.div,{...l,ref:p,style:{pointerEvents:w?k?"auto":"none":void 0,...t.style},onFocusCapture:bo(t.onFocusCapture,S.onFocusCapture),onBlurCapture:bo(t.onBlurCapture,S.onBlurCapture),onPointerDownCapture:bo(t.onPointerDownCapture,v.onPointerDownCapture)})});US.displayName=qD;var YD="DismissableLayerBranch",GD=x.forwardRef((t,e)=>{const n=x.useContext(qS),r=x.useRef(null),o=zs(e,r);return x.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),C.jsx(qr.div,{...t,ref:o})});GD.displayName=YD;function ZD(t,e=globalThis?.document){const n=Xa(t),r=x.useRef(!1),o=x.useRef(()=>{});return x.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){KS(UD,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=l,e.addEventListener("click",o.current,{once:!0})):l()}else e.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),e.removeEventListener("pointerdown",s),e.removeEventListener("click",o.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function JD(t,e=globalThis?.document){const n=Xa(t),r=x.useRef(!1);return x.useEffect(()=>{const o=s=>{s.target&&!r.current&&KS(KD,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function iv(){const t=new CustomEvent(Dp);document.dispatchEvent(t)}function KS(t,e,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?WD(o,s):o.dispatchEvent(s)}var fh="focusScope.autoFocusOnMount",hh="focusScope.autoFocusOnUnmount",av={bubbles:!1,cancelable:!0},XD="FocusScope",YS=x.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=t,[a,l]=x.useState(null),c=Xa(o),u=Xa(s),d=x.useRef(null),f=zs(e,m=>l(m)),h=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let m=function(w){if(h.paused||!a)return;const k=w.target;a.contains(k)?d.current=k:to(d.current,{select:!0})},g=function(w){if(h.paused||!a)return;const k=w.relatedTarget;k!==null&&(a.contains(k)||to(d.current,{select:!0}))},y=function(w){if(document.activeElement===document.body)for(const v of w)v.removedNodes.length>0&&to(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",g);const b=new MutationObserver(y);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",g),b.disconnect()}}},[r,a,h.paused]),x.useEffect(()=>{if(a){cv.add(h);const m=document.activeElement;if(!a.contains(m)){const y=new CustomEvent(fh,av);a.addEventListener(fh,c),a.dispatchEvent(y),y.defaultPrevented||(QD(o2(GS(a)),{select:!0}),document.activeElement===m&&to(a))}return()=>{a.removeEventListener(fh,c),setTimeout(()=>{const y=new CustomEvent(hh,av);a.addEventListener(hh,u),a.dispatchEvent(y),y.defaultPrevented||to(m??document.body,{select:!0}),a.removeEventListener(hh,u),cv.remove(h)},0)}}},[a,c,u,h]);const p=x.useCallback(m=>{if(!n&&!r||h.paused)return;const g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(g&&y){const b=m.currentTarget,[w,k]=e2(b);w&&k?!m.shiftKey&&y===k?(m.preventDefault(),n&&to(w,{select:!0})):m.shiftKey&&y===w&&(m.preventDefault(),n&&to(k,{select:!0})):y===b&&m.preventDefault()}},[n,r,h.paused]);return C.jsx(qr.div,{tabIndex:-1,...i,ref:f,onKeyDown:p})});YS.displayName=XD;function QD(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(to(r,{select:e}),document.activeElement!==n)return}function e2(t){const e=GS(t),n=lv(e,t),r=lv(e.reverse(),t);return[n,r]}function GS(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function lv(t,e){for(const n of t)if(!t2(n,{upTo:e}))return n}function t2(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function n2(t){return t instanceof HTMLInputElement&&"select"in t}function to(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&n2(t)&&e&&t.select()}}var cv=r2();function r2(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=uv(t,e),t.unshift(e)},remove(e){t=uv(t,e),t[0]?.resume()}}}function uv(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function o2(t){return t.filter(e=>e.tagName!=="A")}var s2="Portal",ZS=x.forwardRef((t,e)=>{const{container:n,...r}=t,[o,s]=x.useState(!1);Ja(()=>s(!0),[]);const i=n||o&&globalThis?.document?.body;return i?Ix.createPortal(C.jsx(qr.div,{...r,ref:e}),i):null});ZS.displayName=s2;function i2(t,e){return x.useReducer((n,r)=>e[n][r]??n,t)}var pf=t=>{const{present:e,children:n}=t,r=a2(e),o=typeof n=="function"?n({present:r.isPresent}):x.Children.only(n),s=zs(r.ref,l2(o));return typeof n=="function"||r.isPresent?x.cloneElement(o,{ref:s}):null};pf.displayName="Presence";function a2(t){const[e,n]=x.useState(),r=x.useRef(null),o=x.useRef(t),s=x.useRef("none"),i=t?"mounted":"unmounted",[a,l]=i2(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const c=Zl(r.current);s.current=a==="mounted"?c:"none"},[a]),Ja(()=>{const c=r.current,u=o.current;if(u!==t){const f=s.current,h=Zl(c);t?l("MOUNT"):h==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,l]),Ja(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=h=>{const m=Zl(r.current).includes(CSS.escape(h.animationName));if(h.target===e&&m&&(l("ANIMATION_END"),!o.current)){const g=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},f=h=>{h.target===e&&(s.current=Zl(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:x.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function Zl(t){return t?.animationName||"none"}function l2(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var ph=0;function c2(){x.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??dv()),document.body.insertAdjacentElement("beforeend",t[1]??dv()),ph++,()=>{ph===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),ph--}},[])}function dv(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var ur=function(){return ur=Object.assign||function(e){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},ur.apply(this,arguments)};function JS(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n}function u2(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,s;r<o;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}var Cu="right-scroll-bar-position",Tu="width-before-scroll-bar",d2="with-scroll-bars-hidden",f2="--removed-body-scroll-bar-size";function mh(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function h2(t,e){var n=x.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=e,n.facade}var p2=typeof window<"u"?x.useLayoutEffect:x.useEffect,fv=new WeakMap;function m2(t,e){var n=h2(null,function(r){return t.forEach(function(o){return mh(o,r)})});return p2(function(){var r=fv.get(n);if(r){var o=new Set(r),s=new Set(t),i=n.current;o.forEach(function(a){s.has(a)||mh(a,null)}),s.forEach(function(a){o.has(a)||mh(a,i)})}fv.set(n,t)},[t]),n}function g2(t){return t}function y2(t,e){e===void 0&&(e=g2);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(s){var i=e(s,r);return n.push(i),function(){n=n.filter(function(a){return a!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var a=n;n=[],a.forEach(s),i=n}var l=function(){var u=i;i=[],u.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){i.push(u),c()},filter:function(u){return i=i.filter(u),n}}}};return o}function b2(t){t===void 0&&(t={});var e=y2(null);return e.options=ur({async:!0,ssr:!1},t),e}var XS=function(t){var e=t.sideCar,n=JS(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return x.createElement(r,ur({},n))};XS.isSideCarExport=!0;function v2(t,e){return t.useMedium(e),XS}var QS=b2(),gh=function(){},mf=x.forwardRef(function(t,e){var n=x.useRef(null),r=x.useState({onScrollCapture:gh,onWheelCapture:gh,onTouchMoveCapture:gh}),o=r[0],s=r[1],i=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,u=t.enabled,d=t.shards,f=t.sideCar,h=t.noRelative,p=t.noIsolation,m=t.inert,g=t.allowPinchZoom,y=t.as,b=y===void 0?"div":y,w=t.gapMode,k=JS(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),v=f,S=m2([n,e]),E=ur(ur({},k),o);return x.createElement(x.Fragment,null,u&&x.createElement(v,{sideCar:QS,removeScrollBar:c,shards:d,noRelative:h,noIsolation:p,inert:m,setCallbacks:s,allowPinchZoom:!!g,lockRef:n,gapMode:w}),i?x.cloneElement(x.Children.only(a),ur(ur({},E),{ref:S})):x.createElement(b,ur({},E,{className:l,ref:S}),a))});mf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};mf.classNames={fullWidth:Tu,zeroRight:Cu};var w2=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function k2(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=w2();return e&&t.setAttribute("nonce",e),t}function x2(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function S2(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var E2=function(){var t=0,e=null;return{add:function(n){t==0&&(e=k2())&&(x2(e,n),S2(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},C2=function(){var t=E2();return function(e,n){x.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},eE=function(){var t=C2(),e=function(n){var r=n.styles,o=n.dynamic;return t(r,o),null};return e},T2={left:0,top:0,right:0,gap:0},yh=function(t){return parseInt(t||"",10)||0},R2=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],o=e[t==="padding"?"paddingRight":"marginRight"];return[yh(n),yh(r),yh(o)]},M2=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return T2;var e=R2(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},O2=eE(),Ci="data-scroll-locked",_2=function(t,e,n,r){var o=t.left,s=t.top,i=t.right,a=t.gap;return n===void 0&&(n="margin"),`
13
+ .`.concat(d2,` {
14
+ overflow: hidden `).concat(r,`;
15
+ padding-right: `).concat(a,"px ").concat(r,`;
16
+ }
17
+ body[`).concat(Ci,`] {
18
+ overflow: hidden `).concat(r,`;
19
+ overscroll-behavior: contain;
20
+ `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
21
+ padding-left: `.concat(o,`px;
22
+ padding-top: `).concat(s,`px;
23
+ padding-right: `).concat(i,`px;
24
+ margin-left:0;
25
+ margin-top:0;
26
+ margin-right: `).concat(a,"px ").concat(r,`;
27
+ `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
28
+ }
29
+
30
+ .`).concat(Cu,` {
31
+ right: `).concat(a,"px ").concat(r,`;
32
+ }
33
+
34
+ .`).concat(Tu,` {
35
+ margin-right: `).concat(a,"px ").concat(r,`;
36
+ }
37
+
38
+ .`).concat(Cu," .").concat(Cu,` {
39
+ right: 0 `).concat(r,`;
40
+ }
41
+
42
+ .`).concat(Tu," .").concat(Tu,` {
43
+ margin-right: 0 `).concat(r,`;
44
+ }
45
+
46
+ body[`).concat(Ci,`] {
47
+ `).concat(f2,": ").concat(a,`px;
48
+ }
49
+ `)},hv=function(){var t=parseInt(document.body.getAttribute(Ci)||"0",10);return isFinite(t)?t:0},N2=function(){x.useEffect(function(){return document.body.setAttribute(Ci,(hv()+1).toString()),function(){var t=hv()-1;t<=0?document.body.removeAttribute(Ci):document.body.setAttribute(Ci,t.toString())}},[])},P2=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,o=r===void 0?"margin":r;N2();var s=x.useMemo(function(){return M2(o)},[o]);return x.createElement(O2,{styles:_2(s,!e,o,n?"":"!important")})},zp=!1;if(typeof window<"u")try{var Jl=Object.defineProperty({},"passive",{get:function(){return zp=!0,!0}});window.addEventListener("test",Jl,Jl),window.removeEventListener("test",Jl,Jl)}catch{zp=!1}var Us=zp?{passive:!1}:!1,$2=function(t){return t.tagName==="TEXTAREA"},tE=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!$2(t)&&n[e]==="visible")},A2=function(t){return tE(t,"overflowY")},I2=function(t){return tE(t,"overflowX")},pv=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=nE(t,r);if(o){var s=rE(t,r),i=s[1],a=s[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},D2=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},z2=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},nE=function(t,e){return t==="v"?A2(e):I2(e)},rE=function(t,e){return t==="v"?D2(e):z2(e)},j2=function(t,e){return t==="h"&&e==="rtl"?-1:1},L2=function(t,e,n,r,o){var s=j2(t,window.getComputedStyle(e).direction),i=s*r,a=n.target,l=e.contains(a),c=!1,u=i>0,d=0,f=0;do{if(!a)break;var h=rE(t,a),p=h[0],m=h[1],g=h[2],y=m-g-s*p;(p||y)&&nE(t,a)&&(d+=y,f+=p);var b=a.parentNode;a=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(u&&Math.abs(d)<1||!u&&Math.abs(f)<1)&&(c=!0),c},Xl=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},mv=function(t){return[t.deltaX,t.deltaY]},gv=function(t){return t&&"current"in t?t.current:t},F2=function(t,e){return t[0]===e[0]&&t[1]===e[1]},B2=function(t){return`
50
+ .block-interactivity-`.concat(t,` {pointer-events: none;}
51
+ .allow-interactivity-`).concat(t,` {pointer-events: all;}
52
+ `)},V2=0,Ks=[];function W2(t){var e=x.useRef([]),n=x.useRef([0,0]),r=x.useRef(),o=x.useState(V2++)[0],s=x.useState(eE)[0],i=x.useRef(t);x.useEffect(function(){i.current=t},[t]),x.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var m=u2([t.lockRef.current],(t.shards||[]).map(gv),!0).filter(Boolean);return m.forEach(function(g){return g.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var a=x.useCallback(function(m,g){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var y=Xl(m),b=n.current,w="deltaX"in m?m.deltaX:b[0]-y[0],k="deltaY"in m?m.deltaY:b[1]-y[1],v,S=m.target,E=Math.abs(w)>Math.abs(k)?"h":"v";if("touches"in m&&E==="h"&&S.type==="range")return!1;var M=window.getSelection(),D=M&&M.anchorNode,F=D?D===S||D.contains(S):!1;if(F)return!1;var N=pv(E,S);if(!N)return!0;if(N?v=E:(v=E==="v"?"h":"v",N=pv(E,S)),!N)return!1;if(!r.current&&"changedTouches"in m&&(w||k)&&(r.current=v),!v)return!0;var A=r.current||v;return L2(A,g,m,A==="h"?w:k)},[]),l=x.useCallback(function(m){var g=m;if(!(!Ks.length||Ks[Ks.length-1]!==s)){var y="deltaY"in g?mv(g):Xl(g),b=e.current.filter(function(v){return v.name===g.type&&(v.target===g.target||g.target===v.shadowParent)&&F2(v.delta,y)})[0];if(b&&b.should){g.cancelable&&g.preventDefault();return}if(!b){var w=(i.current.shards||[]).map(gv).filter(Boolean).filter(function(v){return v.contains(g.target)}),k=w.length>0?a(g,w[0]):!i.current.noIsolation;k&&g.cancelable&&g.preventDefault()}}},[]),c=x.useCallback(function(m,g,y,b){var w={name:m,delta:g,target:y,should:b,shadowParent:H2(y)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(k){return k!==w})},1)},[]),u=x.useCallback(function(m){n.current=Xl(m),r.current=void 0},[]),d=x.useCallback(function(m){c(m.type,mv(m),m.target,a(m,t.lockRef.current))},[]),f=x.useCallback(function(m){c(m.type,Xl(m),m.target,a(m,t.lockRef.current))},[]);x.useEffect(function(){return Ks.push(s),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,Us),document.addEventListener("touchmove",l,Us),document.addEventListener("touchstart",u,Us),function(){Ks=Ks.filter(function(m){return m!==s}),document.removeEventListener("wheel",l,Us),document.removeEventListener("touchmove",l,Us),document.removeEventListener("touchstart",u,Us)}},[]);var h=t.removeScrollBar,p=t.inert;return x.createElement(x.Fragment,null,p?x.createElement(s,{styles:B2(o)}):null,h?x.createElement(P2,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function H2(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const q2=v2(QS,W2);var oE=x.forwardRef(function(t,e){return x.createElement(mf,ur({},t,{ref:e,sideCar:q2}))});oE.classNames=mf.classNames;var U2=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Ys=new WeakMap,Ql=new WeakMap,ec={},bh=0,sE=function(t){return t&&(t.host||sE(t.parentNode))},K2=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=sE(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},Y2=function(t,e,n,r){var o=K2(e,Array.isArray(t)?t:[t]);ec[n]||(ec[n]=new WeakMap);var s=ec[n],i=[],a=new Set,l=new Set(o),c=function(d){!d||a.has(d)||(a.add(d),c(d.parentNode))};o.forEach(c);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(f){if(a.has(f))u(f);else try{var h=f.getAttribute(r),p=h!==null&&h!=="false",m=(Ys.get(f)||0)+1,g=(s.get(f)||0)+1;Ys.set(f,m),s.set(f,g),i.push(f),m===1&&p&&Ql.set(f,!0),g===1&&f.setAttribute(n,"true"),p||f.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",f,y)}})};return u(e),a.clear(),bh++,function(){i.forEach(function(d){var f=Ys.get(d)-1,h=s.get(d)-1;Ys.set(d,f),s.set(d,h),f||(Ql.has(d)||d.removeAttribute(r),Ql.delete(d)),h||d.removeAttribute(n)}),bh--,bh||(Ys=new WeakMap,Ys=new WeakMap,Ql=new WeakMap,ec={})}},G2=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),o=U2(t);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Y2(r,o,n,"aria-hidden")):function(){return null}},gf="Dialog",[iE]=OD(gf),[Z2,Qn]=iE(gf),aE=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!0}=t,a=x.useRef(null),l=x.useRef(null),[c,u]=AD({prop:r,defaultProp:o??!1,onChange:s,caller:gf});return C.jsx(Z2,{scope:e,triggerRef:a,contentRef:l,contentId:jr(),titleId:jr(),descriptionId:jr(),open:c,onOpenChange:u,onOpenToggle:x.useCallback(()=>u(d=>!d),[u]),modal:i,children:n})};aE.displayName=gf;var lE="DialogTrigger",J2=x.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=Qn(lE,n),s=zs(e,o.triggerRef);return C.jsx(qr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":xg(o.open),...r,ref:s,onClick:bo(t.onClick,o.onOpenToggle)})});J2.displayName=lE;var wg="DialogPortal",[X2,cE]=iE(wg,{forceMount:void 0}),uE=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:o}=t,s=Qn(wg,e);return C.jsx(X2,{scope:e,forceMount:n,children:x.Children.map(r,i=>C.jsx(pf,{present:n||s.open,children:C.jsx(ZS,{asChild:!0,container:o,children:i})}))})};uE.displayName=wg;var Hu="DialogOverlay",dE=x.forwardRef((t,e)=>{const n=cE(Hu,t.__scopeDialog),{forceMount:r=n.forceMount,...o}=t,s=Qn(Hu,t.__scopeDialog);return s.modal?C.jsx(pf,{present:r||s.open,children:C.jsx(ez,{...o,ref:e})}):null});dE.displayName=Hu;var Q2=HS("DialogOverlay.RemoveScroll"),ez=x.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=Qn(Hu,n);return C.jsx(oE,{as:Q2,allowPinchZoom:!0,shards:[o.contentRef],children:C.jsx(qr.div,{"data-state":xg(o.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),xs="DialogContent",fE=x.forwardRef((t,e)=>{const n=cE(xs,t.__scopeDialog),{forceMount:r=n.forceMount,...o}=t,s=Qn(xs,t.__scopeDialog);return C.jsx(pf,{present:r||s.open,children:s.modal?C.jsx(tz,{...o,ref:e}):C.jsx(nz,{...o,ref:e})})});fE.displayName=xs;var tz=x.forwardRef((t,e)=>{const n=Qn(xs,t.__scopeDialog),r=x.useRef(null),o=zs(e,n.contentRef,r);return x.useEffect(()=>{const s=r.current;if(s)return G2(s)},[]),C.jsx(hE,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:bo(t.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:bo(t.onPointerDownOutside,s=>{const i=s.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&s.preventDefault()}),onFocusOutside:bo(t.onFocusOutside,s=>s.preventDefault())})}),nz=x.forwardRef((t,e)=>{const n=Qn(xs,t.__scopeDialog),r=x.useRef(!1),o=x.useRef(!1);return C.jsx(hE,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{t.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||n.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{t.onInteractOutside?.(s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;n.triggerRef.current?.contains(i)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),hE=x.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...i}=t,a=Qn(xs,n),l=x.useRef(null),c=zs(e,l);return c2(),C.jsxs(C.Fragment,{children:[C.jsx(YS,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:C.jsx(US,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":xg(a.open),...i,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),C.jsxs(C.Fragment,{children:[C.jsx(iz,{titleId:a.titleId}),C.jsx(lz,{contentRef:l,descriptionId:a.descriptionId})]})]})}),kg="DialogTitle",rz=x.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=Qn(kg,n);return C.jsx(qr.h2,{id:o.titleId,...r,ref:e})});rz.displayName=kg;var pE="DialogDescription",oz=x.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=Qn(pE,n);return C.jsx(qr.p,{id:o.descriptionId,...r,ref:e})});oz.displayName=pE;var mE="DialogClose",sz=x.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,o=Qn(mE,n);return C.jsx(qr.button,{type:"button",...r,ref:e,onClick:bo(t.onClick,()=>o.onOpenChange(!1))})});sz.displayName=mE;function xg(t){return t?"open":"closed"}var gE="DialogTitleWarning",[BX,yE]=MD(gE,{contentName:xs,titleName:kg,docsSlug:"dialog"}),iz=({titleId:t})=>{const e=yE(gE),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
53
+
54
+ If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
55
+
56
+ For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return x.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},az="DialogDescriptionWarning",lz=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${yE(az).contentName}}.`;return x.useEffect(()=>{const o=t.current?.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},cz=aE,uz=uE,dz=dE,fz=fE,hz=Symbol.for("react.lazy"),qu=pl[" use ".trim().toString()];function pz(t){return typeof t=="object"&&t!==null&&"then"in t}function bE(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===hz&&"_payload"in t&&pz(t._payload)}function mz(t){const e=gz(t),n=x.forwardRef((r,o)=>{let{children:s,...i}=r;bE(s)&&typeof qu=="function"&&(s=qu(s._payload));const a=x.Children.toArray(s),l=a.find(bz);if(l){const c=l.props.children,u=a.map(d=>d===l?x.Children.count(c)>1?x.Children.only(null):x.isValidElement(c)?c.props.children:null:d);return C.jsx(e,{...i,ref:o,children:x.isValidElement(c)?x.cloneElement(c,void 0,u):null})}return C.jsx(e,{...i,ref:o,children:s})});return n.displayName=`${t}.Slot`,n}function gz(t){const e=x.forwardRef((n,r)=>{let{children:o,...s}=n;if(bE(o)&&typeof qu=="function"&&(o=qu(o._payload)),x.isValidElement(o)){const i=wz(o),a=vz(s,o.props);return o.type!==x.Fragment&&(a.ref=r?Co(r,i):i),x.cloneElement(o,a)}return x.Children.count(o)>1?x.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var yz=Symbol("radix.slottable");function bz(t){return x.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===yz}function vz(t,e){const n={...e};for(const r in e){const o=t[r],s=e[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...t,...n}}function wz(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var kz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],zo=kz.reduce((t,e)=>{const n=mz(`Primitive.${e}`),r=x.forwardRef((o,s)=>{const{asChild:i,...a}=o,l=i?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),C.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),aa='[cmdk-group=""]',vh='[cmdk-group-items=""]',xz='[cmdk-group-heading=""]',vE='[cmdk-item=""]',yv=`${vE}:not([aria-disabled="true"])`,jp="cmdk-item-select",si="data-value",Sz=(t,e,n)=>RD(t,e,n),wE=x.createContext(void 0),wl=()=>x.useContext(wE),kE=x.createContext(void 0),Sg=()=>x.useContext(kE),xE=x.createContext(void 0),SE=x.forwardRef((t,e)=>{let n=ii(()=>{var $,j;return{search:"",value:(j=($=t.value)!=null?$:t.defaultValue)!=null?j:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=ii(()=>new Set),o=ii(()=>new Map),s=ii(()=>new Map),i=ii(()=>new Set),a=EE(t),{label:l,children:c,value:u,onValueChange:d,filter:f,shouldFilter:h,loop:p,disablePointerSelection:m=!1,vimBindings:g=!0,...y}=t,b=jr(),w=jr(),k=jr(),v=x.useRef(null),S=Az();Ss(()=>{if(u!==void 0){let $=u.trim();n.current.value=$,E.emit()}},[u]),Ss(()=>{S(6,z)},[]);let E=x.useMemo(()=>({subscribe:$=>(i.current.add($),()=>i.current.delete($)),snapshot:()=>n.current,setState:($,j,R)=>{var P,I,Z,X;if(!Object.is(n.current[$],j)){if(n.current[$]=j,$==="search")A(),F(),S(1,N);else if($==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let _=document.getElementById(k);_?_.focus():(P=document.getElementById(b))==null||P.focus()}if(S(7,()=>{var _;n.current.selectedItemId=(_=B())==null?void 0:_.id,E.emit()}),R||S(5,z),((I=a.current)==null?void 0:I.value)!==void 0){let _=j??"";(X=(Z=a.current).onValueChange)==null||X.call(Z,_);return}}E.emit()}},emit:()=>{i.current.forEach($=>$())}}),[]),M=x.useMemo(()=>({value:($,j,R)=>{var P;j!==((P=s.current.get($))==null?void 0:P.value)&&(s.current.set($,{value:j,keywords:R}),n.current.filtered.items.set($,D(j,R)),S(2,()=>{F(),E.emit()}))},item:($,j)=>(r.current.add($),j&&(o.current.has(j)?o.current.get(j).add($):o.current.set(j,new Set([$]))),S(3,()=>{A(),F(),n.current.value||N(),E.emit()}),()=>{s.current.delete($),r.current.delete($),n.current.filtered.items.delete($);let R=B();S(4,()=>{A(),R?.getAttribute("id")===$&&N(),E.emit()})}),group:$=>(o.current.has($)||o.current.set($,new Set),()=>{s.current.delete($),o.current.delete($)}),filter:()=>a.current.shouldFilter,label:l||t["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:b,inputId:k,labelId:w,listInnerRef:v}),[]);function D($,j){var R,P;let I=(P=(R=a.current)==null?void 0:R.filter)!=null?P:Sz;return $?I($,n.current.search,j):0}function F(){if(!n.current.search||a.current.shouldFilter===!1)return;let $=n.current.filtered.items,j=[];n.current.filtered.groups.forEach(P=>{let I=o.current.get(P),Z=0;I.forEach(X=>{let _=$.get(X);Z=Math.max(_,Z)}),j.push([P,Z])});let R=v.current;U().sort((P,I)=>{var Z,X;let _=P.getAttribute("id"),q=I.getAttribute("id");return((Z=$.get(q))!=null?Z:0)-((X=$.get(_))!=null?X:0)}).forEach(P=>{let I=P.closest(vh);I?I.appendChild(P.parentElement===I?P:P.closest(`${vh} > *`)):R.appendChild(P.parentElement===R?P:P.closest(`${vh} > *`))}),j.sort((P,I)=>I[1]-P[1]).forEach(P=>{var I;let Z=(I=v.current)==null?void 0:I.querySelector(`${aa}[${si}="${encodeURIComponent(P[0])}"]`);Z?.parentElement.appendChild(Z)})}function N(){let $=U().find(R=>R.getAttribute("aria-disabled")!=="true"),j=$?.getAttribute(si);E.setState("value",j||void 0)}function A(){var $,j,R,P;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let I=0;for(let Z of r.current){let X=(j=($=s.current.get(Z))==null?void 0:$.value)!=null?j:"",_=(P=(R=s.current.get(Z))==null?void 0:R.keywords)!=null?P:[],q=D(X,_);n.current.filtered.items.set(Z,q),q>0&&I++}for(let[Z,X]of o.current)for(let _ of X)if(n.current.filtered.items.get(_)>0){n.current.filtered.groups.add(Z);break}n.current.filtered.count=I}function z(){var $,j,R;let P=B();P&&((($=P.parentElement)==null?void 0:$.firstChild)===P&&((R=(j=P.closest(aa))==null?void 0:j.querySelector(xz))==null||R.scrollIntoView({block:"nearest"})),P.scrollIntoView({block:"nearest"}))}function B(){var $;return($=v.current)==null?void 0:$.querySelector(`${vE}[aria-selected="true"]`)}function U(){var $;return Array.from((($=v.current)==null?void 0:$.querySelectorAll(yv))||[])}function J($){let j=U()[$];j&&E.setState("value",j.getAttribute(si))}function Y($){var j;let R=B(),P=U(),I=P.findIndex(X=>X===R),Z=P[I+$];(j=a.current)!=null&&j.loop&&(Z=I+$<0?P[P.length-1]:I+$===P.length?P[0]:P[I+$]),Z&&E.setState("value",Z.getAttribute(si))}function K($){let j=B(),R=j?.closest(aa),P;for(;R&&!P;)R=$>0?Pz(R,aa):$z(R,aa),P=R?.querySelector(yv);P?E.setState("value",P.getAttribute(si)):Y($)}let G=()=>J(U().length-1),L=$=>{$.preventDefault(),$.metaKey?G():$.altKey?K(1):Y(1)},W=$=>{$.preventDefault(),$.metaKey?J(0):$.altKey?K(-1):Y(-1)};return x.createElement(zo.div,{ref:e,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:$=>{var j;(j=y.onKeyDown)==null||j.call(y,$);let R=$.nativeEvent.isComposing||$.keyCode===229;if(!($.defaultPrevented||R))switch($.key){case"n":case"j":{g&&$.ctrlKey&&L($);break}case"ArrowDown":{L($);break}case"p":case"k":{g&&$.ctrlKey&&W($);break}case"ArrowUp":{W($);break}case"Home":{$.preventDefault(),J(0);break}case"End":{$.preventDefault(),G();break}case"Enter":{$.preventDefault();let P=B();if(P){let I=new Event(jp);P.dispatchEvent(I)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:M.inputId,id:M.labelId,style:Dz},l),yf(t,$=>x.createElement(kE.Provider,{value:E},x.createElement(wE.Provider,{value:M},$))))}),Ez=x.forwardRef((t,e)=>{var n,r;let o=jr(),s=x.useRef(null),i=x.useContext(xE),a=wl(),l=EE(t),c=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:i?.forceMount;Ss(()=>{if(!c)return a.item(o,i?.id)},[c]);let u=CE(o,s,[t.value,t.children,s],t.keywords),d=Sg(),f=To(S=>S.value&&S.value===u.current),h=To(S=>c||a.filter()===!1?!0:S.search?S.filtered.items.get(o)>0:!0);x.useEffect(()=>{let S=s.current;if(!(!S||t.disabled))return S.addEventListener(jp,p),()=>S.removeEventListener(jp,p)},[h,t.onSelect,t.disabled]);function p(){var S,E;m(),(E=(S=l.current).onSelect)==null||E.call(S,u.current)}function m(){d.setState("value",u.current,!0)}if(!h)return null;let{disabled:g,value:y,onSelect:b,forceMount:w,keywords:k,...v}=t;return x.createElement(zo.div,{ref:Co(s,e),...v,id:o,"cmdk-item":"",role:"option","aria-disabled":!!g,"aria-selected":!!f,"data-disabled":!!g,"data-selected":!!f,onPointerMove:g||a.getDisablePointerSelection()?void 0:m,onClick:g?void 0:p},t.children)}),Cz=x.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:o,...s}=t,i=jr(),a=x.useRef(null),l=x.useRef(null),c=jr(),u=wl(),d=To(h=>o||u.filter()===!1?!0:h.search?h.filtered.groups.has(i):!0);Ss(()=>u.group(i),[]),CE(i,a,[t.value,t.heading,l]);let f=x.useMemo(()=>({id:i,forceMount:o}),[o]);return x.createElement(zo.div,{ref:Co(a,e),...s,"cmdk-group":"",role:"presentation",hidden:d?void 0:!0},n&&x.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),yf(t,h=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},x.createElement(xE.Provider,{value:f},h))))}),Tz=x.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,o=x.useRef(null),s=To(i=>!i.search);return!n&&!s?null:x.createElement(zo.div,{ref:Co(o,e),...r,"cmdk-separator":"",role:"separator"})}),Rz=x.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,o=t.value!=null,s=Sg(),i=To(c=>c.search),a=To(c=>c.selectedItemId),l=wl();return x.useEffect(()=>{t.value!=null&&s.setState("search",t.value)},[t.value]),x.createElement(zo.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:o?t.value:i,onChange:c=>{o||s.setState("search",c.target.value),n?.(c.target.value)}})}),Mz=x.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...o}=t,s=x.useRef(null),i=x.useRef(null),a=To(c=>c.selectedItemId),l=wl();return x.useEffect(()=>{if(i.current&&s.current){let c=i.current,u=s.current,d,f=new ResizeObserver(()=>{d=requestAnimationFrame(()=>{let h=c.offsetHeight;u.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return f.observe(c),()=>{cancelAnimationFrame(d),f.unobserve(c)}}},[]),x.createElement(zo.div,{ref:Co(s,e),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},yf(t,c=>x.createElement("div",{ref:Co(i,l.listInnerRef),"cmdk-list-sizer":""},c)))}),Oz=x.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:s,container:i,...a}=t;return x.createElement(cz,{open:n,onOpenChange:r},x.createElement(uz,{container:i},x.createElement(dz,{"cmdk-overlay":"",className:o}),x.createElement(fz,{"aria-label":t.label,"cmdk-dialog":"",className:s},x.createElement(SE,{ref:e,...a}))))}),_z=x.forwardRef((t,e)=>To(n=>n.filtered.count===0)?x.createElement(zo.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),Nz=x.forwardRef((t,e)=>{let{progress:n,children:r,label:o="Loading...",...s}=t;return x.createElement(zo.div,{ref:e,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},yf(t,i=>x.createElement("div",{"aria-hidden":!0},i)))}),ta=Object.assign(SE,{List:Mz,Item:Ez,Input:Rz,Group:Cz,Separator:Tz,Dialog:Oz,Empty:_z,Loading:Nz});function Pz(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function $z(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function EE(t){let e=x.useRef(t);return Ss(()=>{e.current=t}),e}var Ss=typeof window>"u"?x.useEffect:x.useLayoutEffect;function ii(t){let e=x.useRef();return e.current===void 0&&(e.current=t()),e}function To(t){let e=Sg(),n=()=>t(e.snapshot());return x.useSyncExternalStore(e.subscribe,n,n)}function CE(t,e,n,r=[]){let o=x.useRef(),s=wl();return Ss(()=>{var i;let a=(()=>{var c;for(let u of n){if(typeof u=="string")return u.trim();if(typeof u=="object"&&"current"in u)return u.current?(c=u.current.textContent)==null?void 0:c.trim():o.current}})(),l=r.map(c=>c.trim());s.value(t,a,l),(i=e.current)==null||i.setAttribute(si,a),o.current=a}),o}var Az=()=>{let[t,e]=x.useState(),n=ii(()=>new Map);return Ss(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,o)=>{n.current.set(r,o),e({})}};function Iz(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function yf({asChild:t,children:e},n){return t&&x.isValidElement(e)?x.cloneElement(Iz(e),{ref:e.ref},n(e.props.children)):n(e)}var Dz={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};let bv=(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 zz={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Eg={valid(t){return t===null?null:t?{[bv.valid]:""}:{[bv.invalid]:""}}},jz=x.createContext({invalid:void 0,name:void 0,validityData:{state:zz,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=jt)=>t,getInputValidationProps:(t=jt)=>t,inputRef:{current:null},commit:async()=>{}}});function na(t=!0){const e=x.useContext(jz);if(e.setValidityData===pn&&!t)throw new Error(en(28));return e}const Lz=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:pn,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Cg(){return x.useContext(Lz)}const Fz=x.createContext({controlId:void 0,registerControlId:pn,labelId:void 0,setLabelId:pn,messageIds:[],setMessageIds:pn,getDescriptionProps:t=>t});function bf(){return x.useContext(Fz)}function Bz(t,e){return{...t,state:{...t.state,valid:!e&&t.state.valid}}}function vf(t={}){const{id:e,implicit:n=!1,controlRef:r}=t,{controlId:o,registerControlId:s}=bf(),i=Ns(e),a=n?o:void 0,l=ln(()=>Symbol("labelable-control")),c=x.useRef(!1),u=x.useRef(e!=null),d=ye(()=>{!c.current||s===pn||(c.current=!1,s(l.current,void 0))});return ve(()=>{if(s===pn)return;let f;if(n){const h=r?.current;rt(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]),x.useEffect(()=>d,[d]),o??i}function Tg(t){const{enabled:e=!0,value:n,id:r,name:o,controlRef:s,commit:i}=t,{formRef:a}=Cg(),{invalid:l,markedDirtyRef:c,validityData:u,setValidityData:d}=na(),f=ye(t.getValue);ve(()=>{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]),ve(()=>{!e||!r||a.current.fields.set(r,{getValue:f,name:o,controlRef:s,validityData:Bz(u,l),validate(h=!0){let p=n;p===void 0&&(p=f()),c.current=!0,h?Xn.flushSync(()=>i(p)):i(p)}})},[i,s,e,a,f,r,l,c,o,u,n]),ve(()=>{const h=a.current.fields;return()=>{r&&h.delete(r)}},[a,r])}const Vz=x.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:S}=na(),E=m||l,M=p??i,D={...h,disabled:E},{labelId:F}=bf(),N=vf({id:s});ve(()=>{const Y=a!=null;S.inputRef.current?.value||Y&&a!==""?k(!0):Y&&a===""&&k(!1)},[S.inputRef,k,a]);const A=x.useRef(null);ve(()=>{d&&A.current===qn(Xe(A.current))&&w(!0)},[d,w]);const[z]=Ga({controlled:a,default:u,name:"FieldControl",state:"value"}),B=a!==void 0,U=B?z:void 0;return Tg({id:N,name:M,commit:S.commit,value:U,getValue:()=>S.inputRef.current?.value,controlRef:S.inputRef}),at("input",e,{ref:[n,A],state:D,props:[{id:N,disabled:E,name:M,ref:S.inputRef,"aria-labelledby":F,autoFocus:d,...B?{value:U}:{defaultValue:u},onChange(Y){const K=Y.currentTarget.value;c?.(K,He(Eo,Y.nativeEvent)),y(K!==b.initialValue),k(K!=="")},onFocus(){w(!0)},onBlur(Y){g(!0),w(!1),v==="onBlur"&&S.commit(Y.currentTarget.value)},onKeyDown(Y){Y.currentTarget.tagName==="INPUT"&&Y.key==="Enter"&&(g(!0),S.commit(Y.currentTarget.value))}},S.getInputValidationProps(),f],stateAttributesMapping:Eg})}),Wz=x.forwardRef(function(e,n){return C.jsx(Vz,{ref:n,...e})});function er(t){const e=Ee.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=de("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=C.jsx(Wz,{type:o,"data-slot":"input",className:s,...r}),e[6]=r,e[7]=s,e[8]=o,e[9]=i):i=e[9],i}function Hz(t){const e=Ee.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=de("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=C.jsx("textarea",{"data-slot":"textarea",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function qz(t){const e=Ee.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=de("group/input-group border-input has-disabled:bg-input/50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 relative flex h-8 w-full min-w-0 items-center rounded-lg border transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-3 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=C.jsx("div",{"data-slot":"input-group",role:"group",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}const Uz=hf("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function Kz(t){const e=Ee.c(11);let n,r,o;e[0]!==t?({className:n,align: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?"inline-start":o;let i;e[4]!==s||e[5]!==n?(i=de(Uz({align:s}),n),e[4]=s,e[5]=n,e[6]=i):i=e[6];let a;return e[7]!==s||e[8]!==r||e[9]!==i?(a=C.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":s,className:i,onClick:Yz,...r}),e[7]=s,e[8]=r,e[9]=i,e[10]=a):a=e[10],a}function Yz(t){t.target.closest("button")||t.currentTarget.parentElement?.querySelector("input")?.focus()}function Gz(t){const e=Ee.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=de("bg-popover text-popover-foreground flex size-full flex-col overflow-hidden rounded-xl! p-1",n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=C.jsx(ta,{"data-slot":"command",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function Zz(t){const e=Ee.c(11);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=de("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",n),e[3]=n,e[4]=o):o=e[4];let s;e[5]!==r||e[6]!==o?(s=C.jsx(ta.Input,{"data-slot":"command-input",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7];let i;e[8]===Symbol.for("react.memo_cache_sentinel")?(i=C.jsx(Kz,{children:C.jsx(ff,{className:"size-4 shrink-0 opacity-50"})}),e[8]=i):i=e[8];let a;return e[9]!==s?(a=C.jsx("div",{"data-slot":"command-input-wrapper",className:"p-1 pb-0",children:C.jsxs(qz,{className:"border-input/30 bg-input/30 h-8! rounded-lg! shadow-none! *:data-[slot=input-group-addon]:pl-2!",children:[s,i]})}),e[9]=s,e[10]=a):a=e[10],a}function Jz(t){const e=Ee.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=de("py-6 text-center text-sm",n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=C.jsx(ta.Empty,{"data-slot":"command-empty",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function vv(t){const e=Ee.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=de("text-foreground **:[[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium",n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=C.jsx(ta.Group,{"data-slot":"command-group",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function Xz(t){const e=Ee.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=de("bg-border -mx-1 h-px",n),e[3]=n,e[4]=o):o=e[4];let s;return e[5]!==r||e[6]!==o?(s=C.jsx(ta.Separator,{"data-slot":"command-separator",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function wh(t){const e=Ee.c(11);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=de("group/command-item data-selected:bg-muted data-selected:text-foreground data-selected:*:[svg]:text-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",r),e[4]=r,e[5]=s):s=e[5];let i;e[6]===Symbol.for("react.memo_cache_sentinel")?(i=C.jsx(tg,{className:"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100"}),e[6]=i):i=e[6];let a;return e[7]!==n||e[8]!==o||e[9]!==s?(a=C.jsxs(ta.Item,{"data-slot":"command-item",className:s,...o,children:[n,i]}),e[7]=n,e[8]=o,e[9]=s,e[10]=a):a=e[10],a}const TE=x.createContext(void 0);function kl(t){const e=x.useContext(TE);if(e===void 0&&!t)throw new Error(en(47));return e}function Qz(){return{...L1(),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 ej={...F1,disabled:we(t=>t.disabled),instantType:we(t=>t.instantType),openMethod:we(t=>t.openMethod),openChangeReason:we(t=>t.openChangeReason),modal:we(t=>t.modal),stickIfOpen:we(t=>t.stickIfOpen),titleElementId:we(t=>t.titleElementId),descriptionElementId:we(t=>t.descriptionElementId),openOnHover:we(t=>t.openOnHover),closeDelay:we(t=>t.closeDelay),hasViewport:we(t=>t.hasViewport)};class Rg extends Gm{constructor(e){const n={...Qz(),...e};n.open&&e?.mounted===void 0&&(n.mounted=!0),super(n,{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),stickIfOpenTimeout:new gs,triggerElements:new af},ej)}setOpen=(e,n)=>{const r=n.reason===Cn,o=n.reason===$i&&n.event.detail===0,s=!e&&(n.reason===h1||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(p_,()=>{this.set("stickIfOpen",!1)}),Xn.flushSync(l)):l(),o||s?this.set("instantType",o?"click":"dismiss"):n.reason===ys?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(e,n){const r=ln(()=>new Rg(n)).current,o=e??r;return _m(r.disposeEffect),o}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function wv({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=Rg.useStore(a?.store,{modal:i,open:r,openProp:n,activeTriggerId:c,triggerIdProp:l});Dx(()=>{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}=bg(d);z1(u);const{forceUnmount:b}=j1(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null}),y()});yg(d&&i===!0&&p!==Cn&&m!=="touch",f),x.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);const w=x.useCallback(U=>{const J=He(U);return J.preventUnmountOnClose=()=>{u.set("preventUnmountingOnClose",!0)},J},[u]),k=x.useCallback(()=>{u.setOpen(!1,w(p1))},[u,w]);x.useImperativeHandle(t.actionsRef,()=>({unmount:b,close:k}),[b,k]);const v=V1({popupStore:u,onOpenChange:u.setOpen}),S=Km(v,{outsidePressEvent:{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),E=H1(v),{getReferenceProps:M,getFloatingProps:D,getTriggerProps:F}=lf([S,E]),N=x.useMemo(()=>M(g),[M,g]),A=x.useMemo(()=>F(g),[F,g]),z=x.useMemo(()=>D(),[D]);u.useSyncedValues({modal:i,openMethod:m,activeTriggerProps:N,inactiveTriggerProps:A,popupProps:z,floatingRootContext:v,nested:Ao()!=null});const B=x.useMemo(()=>({store:u}),[u]);return C.jsx(TE.Provider,{value:B,children:typeof e=="function"?e({payload:h}):e})}function tj(t){return kl(!0)?C.jsx(wv,{props:t}):C.jsx(h_,{children:C.jsx(wv,{props:t})})}const nj=300,rj=x.forwardRef(function(e,n){const{render:r,className:o,disabled:s=!1,nativeButton:i=!0,handle:a,payload:l,openOnHover:c=!1,delay:u=nj,closeDelay:d=0,id:f,...h}=e,p=kl(!0),m=a?.store??p?.store;if(!m)throw new Error(en(74));const g=Ns(f),y=m.useState("isTriggerActive",g),b=m.useState("floatingRootContext"),w=m.useState("isOpenedByTrigger",g),k=x.useRef(null),{registerTrigger:v,isMountedByThisTrigger:S}=aP(g,k,m,{payload:l,disabled:s,openOnHover:c,closeDelay:d}),E=m.useState("openChangeReason"),M=m.useState("stickIfOpen"),D=m.useState("openMethod"),F=gP(b,{enabled:b!=null&&c&&(D!=="touch"||E!==$i),mouseOnly:!0,move:!1,handleClose:EP(),restMs:u,delay:{close:d},triggerElementRef:k,isActiveTrigger:y}),N=E1(b,{enabled:b!=null,stickIfOpen:M}),A=lf([N]),z=m.useState("triggerProps",S),B={disabled:s,open:w},{getButtonProps:U,buttonRef:J}=$s({disabled:s,native:i}),Y=x.useMemo(()=>({open($){return $&&E===$i?U1.open($):q1.open($)}}),[E]),K=at("button",e,{state:B,ref:[J,n,v,k],props:[A.getReferenceProps(),F,z,{[f1]:"",id:g},h,U],stateAttributesMapping:Y}),G=x.useRef(null),L=ye($=>{Xn.flushSync(()=>{m.setOpen(!1,He(ys,$.nativeEvent,$.currentTarget))}),i_(G.current)?.focus()}),W=ye($=>{const j=m.select("positionerElement");if(j&&bi($,j))m.context.beforeContentFocusGuardRef.current?.focus();else{Xn.flushSync(()=>{m.setOpen(!1,He(ys,$.nativeEvent,$.currentTarget))});let R=s_(m.context.triggerFocusTargetRef.current||k.current);for(;R!==null&&Ye(j,R);){const P=R;if(R=Fm(R),R===P)break}R?.focus()}});return y?C.jsxs(x.Fragment,{children:[C.jsx(Ai,{ref:G,onFocus:L}),C.jsx(x.Fragment,{children:K},g),C.jsx(Ai,{ref:m.context.triggerFocusTargetRef,onFocus:W})]}):C.jsx(x.Fragment,{children:K},g)}),RE=x.createContext(void 0);function oj(){const t=x.useContext(RE);if(t===void 0)throw new Error(en(45));return t}const sj=x.forwardRef(function(e,n){const{keepMounted:r=!1,...o}=e,{store:s}=kl();return s.useState("mounted")||r?C.jsx(RE.Provider,{value:r,children:C.jsx(Wm,{ref:n,...o})}):null}),ME=x.createContext(void 0);function ij(){const t=x.useContext(ME);if(!t)throw new Error(en(46));return t}const aj=x.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=y_,...y}=e,{store:b}=kl(),w=oj(),k=d_(),v=b.useState("floatingRootContext"),S=b.useState("mounted"),E=b.useState("open"),M=b.useState("openChangeReason"),D=b.useState("activeTriggerElement"),F=b.useState("modal"),N=b.useState("positionerElement"),A=b.useState("instantType"),z=b.useState("transitionStatus"),B=b.useState("hasViewport"),U=x.useRef(null),J=D1(N,!1,!1),Y=Y1({anchor:s,floatingRootContext:v,positionMethod:i,mounted:S,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:B?AP:void 0}),K=x.useMemo(()=>{const R={};return E||(R.pointerEvents="none"),{role:"presentation",hidden:!S,style:{...Y.positionerStyles,...R}}},[E,S,Y.positionerStyles]),G=x.useMemo(()=>({props:K,...Y}),[K,Y]),L=v.useState("domReferenceElement");ve(()=>{const R=L,P=U.current;if(R&&(U.current=R),P&&R&&R!==P){b.set("instantType",void 0);const I=new AbortController;return J(()=>{b.set("instantType","trigger-change")},I.signal),()=>{I.abort()}}},[L,J,b]);const W={open:E,side:G.side,align:G.align,anchorHidden:G.anchorHidden,instant:A},$=x.useCallback(R=>{b.set("positionerElement",R)},[b]),j=at("div",e,{state:W,props:[G.props,uf(z),y],ref:[n,$],stateAttributesMapping:ea});return C.jsxs(ME.Provider,{value:G,children:[S&&F===!0&&M!==Cn&&C.jsx(vg,{ref:b.context.internalBackdropRef,inert:df(!E),cutout:D}),C.jsx(f_,{id:k,children:j})]})}),lj=x.createContext(void 0);function OE(t){return x.useContext(lj)}const cj={...ea,...Qi},uj=x.forwardRef(function(e,n){const{className:r,render:o,initialFocus:s,finalFocus:i,...a}=e,{store:l}=kl(),c=ij(),u=OE()!=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"),S=l.useState("floatingRootContext");Io({open:d,ref:l.context.popupRef,onComplete(){d&&l.context.onOpenChangeComplete?.(!0)}});const E=l.useState("disabled"),M=l.useState("openOnHover"),D=l.useState("closeDelay");hP(S,{enabled:M&&!E,closeDelay:D});function F(U){return U==="touch"?l.context.popupRef.current:!0}const N=s===void 0?F:s,A={open:d,side:c.side,align:c.align,instant:h,transitionStatus:p},z=x.useCallback(U=>{l.set("popupElement",U)},[l]),B=at("div",e,{state:A,ref:[n,l.context.popupRef,z],props:[m,{"aria-labelledby":g,"aria-describedby":y,onKeyDown(U){u&&gg.has(U.key)&&U.stopPropagation()}},uf(p),a],stateAttributesMapping:cj});return C.jsx(qm,{context:S,openInteractionType:f,modal:b==="trap-focus",disabled:!w||k===Cn,initialFocus:N,returnFocus:i,restoreFocus:"popup",previousFocusableElement:xt(v)?v:void 0,nextFocusableElement:l.context.triggerFocusTargetRef,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:B})});function xl(t){const e=Ee.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=C.jsx(tj,{"data-slot":"popover",...n}),e[2]=n,e[3]=r):r=e[3],r}function Sl(t){const e=Ee.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=C.jsx(rj,{"data-slot":"popover-trigger",...n}),e[2]=n,e[3]=r):r=e[3],r}function El(t){const e=Ee.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=de("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=C.jsx(uj,{"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=C.jsx(sj,{children:C.jsx(aj,{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 _E=x.createContext(null),NE=x.createContext(null);function vr(){const t=x.useContext(_E);if(t===null)throw new Error(en(60));return t}function PE(){const t=x.useContext(NE);if(t===null)throw new Error(en(61));return t}const dj=(t,e)=>Object.is(t,e);function zi(t,e,n){return t==null||e==null?Object.is(t,e):n(t,e)}function fj(t,e,n){return!t||t.length===0?!1:t.some(r=>r===void 0?!1:zi(e,r,n))}function Pa(t,e,n){return!t||t.length===0?-1:t.findIndex(r=>r===void 0?!1:zi(r,e,n))}function hj(t,e,n){return t.filter(r=>!zi(e,r,n))}function Lp(t){if(t==null)return"";if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}function $E(t){return t!=null&&t.length>0&&typeof t[0]=="object"&&t[0]!=null&&"items"in t[0]}function pj(t){if(!Array.isArray(t))return t!=null&&!("null"in t);if($E(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 mj(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 Lp(t)}function ai(t,e){return e&&t!=null?e(t)??"":t&&typeof t=="object"&&"value"in t&&"label"in t?Lp(t.value):Lp(t)}function AE(t,e,n){function r(){return mj(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=$E(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 gj(t,e,n){return t.reduce((r,o,s)=>(s>0&&r.push(", "),r.push(C.jsx(x.Fragment,{children:AE(o,e,n)},s)),r),[])}const _e={id:we(t=>t.id),modal:we(t=>t.modal),multiple:we(t=>t.multiple),items:we(t=>t.items),itemToStringLabel:we(t=>t.itemToStringLabel),itemToStringValue:we(t=>t.itemToStringValue),isItemEqualToValue:we(t=>t.isItemEqualToValue),value:we(t=>t.value),hasSelectedValue:we(t=>{const{value:e,multiple:n,itemToStringValue:r}=t;return e==null?!1:n&&Array.isArray(e)?e.length>0:ai(e,r)!==""}),hasNullItemLabel:we((t,e)=>e?pj(t.items):!1),open:we(t=>t.open),mounted:we(t=>t.mounted),forceMount:we(t=>t.forceMount),transitionStatus:we(t=>t.transitionStatus),openMethod:we(t=>t.openMethod),activeIndex:we(t=>t.activeIndex),selectedIndex:we(t=>t.selectedIndex),isActive:we((t,e)=>t.activeIndex===e),isSelected:we((t,e,n)=>{const r=t.isItemEqualToValue,o=t.value;return t.multiple?Array.isArray(o)&&o.some(s=>zi(n,s,r)):t.selectedIndex===e&&t.selectedIndex!==null?!0:zi(n,o,r)}),isSelectedByFocus:we((t,e)=>t.selectedIndex===e),popupProps:we(t=>t.popupProps),triggerProps:we(t=>t.triggerProps),triggerElement:we(t=>t.triggerElement),positionerElement:we(t=>t.positionerElement),listElement:we(t=>t.listElement),scrollUpArrowVisible:we(t=>t.scrollUpArrowVisible),scrollDownArrowVisible:we(t=>t.scrollDownArrowVisible),hasScrollArrows:we(t=>t.hasScrollArrows)};function IE(t,e){const n=x.useRef(t),r=ye(e);ve(()=>{n.current!==t&&r(n.current)},[t,r]),ve(()=>{n.current=t},[t])}function yj(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=dj,highlightItemOnHover:S=!0,children:E}=t,{clearErrors:M}=Cg(),{setDirty:D,setTouched:F,setFocused:N,shouldValidateOnChange:A,validityData:z,setFilled:B,name:U,disabled:J,validation:Y,validationMode:K}=na(),G=vf({id:e}),L=J||u,W=U??l,[$,j]=Ga({controlled:n,default:b?r??qa:r,name:"Select",state:"value"}),[R,P]=Ga({controlled:s,default:i,name:"Select",state:"open"}),I=x.useRef([]),Z=x.useRef([]),X=x.useRef(null),_=x.useRef(null),q=x.useRef(0),T=x.useRef(null),O=x.useRef([]),V=x.useRef(!1),H=x.useRef(!1),Q=x.useRef(null),ee=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),re=x.useRef(!1),{mounted:oe,setMounted:ne,transitionStatus:le}=yl(R),{openMethod:te,triggerProps:fe,reset:ge}=bg(R),pe=ln(()=>new I1({id:G,modal:h,multiple:b,itemToStringLabel:w,itemToStringValue:k,isItemEqualToValue:v,value:$,open:R,mounted:oe,transitionStatus:le,items:y,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Le=Ne(pe,_e.activeIndex),qe=Ne(pe,_e.selectedIndex),Je=Ne(pe,_e.triggerElement),Me=Ne(pe,_e.positionerElement),Oe=x.useMemo(()=>b&&Array.isArray($)&&$.length===0?"":ai($,k),[b,$,k]),ze=x.useMemo(()=>b&&Array.isArray($)?$.map(Fe=>ai(Fe,k)):ai($,k),[b,$,k]),Be=Bt(pe.state.triggerElement);Tg({id:G,commit:Y.commit,value:$,controlRef:Be,name:W,getValue:()=>ze});const pt=x.useRef($);ve(()=>{$!==pt.current&&pe.set("forceMount",!0)},[pe,$]),ve(()=>{B(b?Array.isArray($)&&$.length>0:$!=null)},[b,$,B]),ve(function(){if(R)return;const gt=O.current;if(b){const fn=Array.isArray($)?$:[];if(fn.length===0){pe.set("selectedIndex",null);return}const Dt=fn[fn.length-1],Hs=Pa(gt,Dt,v);pe.set("selectedIndex",Hs===-1?null:Hs);return}const dn=Pa(gt,$,v);pe.set("selectedIndex",dn===-1?null:dn)},[b,R,$,O,v,pe]),IE($,()=>{M(W),D($!==z.initialValue),A()?Y.commit($):Y.commit($,!0)});const bt=ye((Fe,gt)=>{if(a?.(Fe,gt),!gt.isCanceled&&(P(Fe),!Fe&&(gt.reason===ys||gt.reason===Bm)&&(F(!0),N(!1),K==="onBlur"&&Y.commit($)),!Fe&&pe.state.activeIndex!==null)){const dn=I.current[pe.state.activeIndex];queueMicrotask(()=>{dn?.setAttribute("tabindex","-1")})}}),mt=ye(()=>{ne(!1),pe.set("activeIndex",null),ge(),g?.(!1)});Io({enabled:!p,open:R,ref:X,onComplete(){R||mt()}}),x.useImperativeHandle(p,()=>({unmount:mt}),[mt]);const ht=ye((Fe,gt)=>{o?.(Fe,gt),!gt.isCanceled&&j(Fe)}),Qe=ye(()=>{const Fe=pe.state.listElement||X.current;if(!Fe)return;const gt=Fe.scrollTop,dn=Fe.scrollTop+Fe.clientHeight,fn=gt>1,Dt=dn<Fe.scrollHeight-1;pe.state.scrollUpArrowVisible!==fn&&pe.set("scrollUpArrowVisible",fn),pe.state.scrollDownArrowVisible!==Dt&&pe.set("scrollDownArrowVisible",Dt)}),$e=B1({open:R,onOpenChange:bt,elements:{reference:Je,floating:Me}}),ce=E1($e,{enabled:!d&&!L,event:"mousedown"}),ie=Km($e,{bubbles:!1}),he=wP($e,{enabled:!d&&!L,listRef:I,activeIndex:Le,selectedIndex:qe,disabledIndices:qa,onNavigate(Fe){Fe===null&&!R||pe.set("activeIndex",Fe)},focusItemOnHover:!1}),Se=xP($e,{enabled:!d&&!L&&(R||!b),listRef:Z,activeIndex:Le,selectedIndex:qe,onMatch(Fe){R?pe.set("activeIndex",Fe):ht(O.current[Fe],He("none"))},onTypingChange(Fe){V.current=Fe}}),{getReferenceProps:De,getFloatingProps:ut,getItemProps:Ae}=lf([ce,ie,he,Se]),wn=x.useMemo(()=>Xi(De(),fe,G?{id:G}:jt),[De,fe,G]);Dx(()=>{pe.update({popupProps:ut(),triggerProps:wn})}),ve(()=>{pe.update({id:G,modal:h,multiple:b,value:$,open:R,mounted:oe,transitionStatus:le,popupProps:ut(),triggerProps:wn,items:y,itemToStringLabel:w,itemToStringValue:k,isItemEqualToValue:v,openMethod:te})},[pe,G,h,b,$,R,oe,le,ut,wn,y,w,k,v,te]);const Kr=x.useMemo(()=>({store:pe,name:W,required:f,disabled:L,readOnly:d,multiple:b,itemToStringLabel:w,itemToStringValue:k,highlightItemOnHover:S,setValue:ht,setOpen:bt,listRef:I,popupRef:X,scrollHandlerRef:_,handleScrollArrowVisibility:Qe,scrollArrowsMountedCountRef:q,getItemProps:Ae,events:$e.context.events,valueRef:T,valuesRef:O,labelsRef:Z,typingRef:V,selectionRef:ee,selectedItemTextRef:Q,validation:Y,onOpenChangeComplete:g,keyboardActiveRef:H,alignItemWithTriggerActiveRef:re,initialValueRef:pt}),[pe,W,f,L,d,b,w,k,S,ht,bt,Ae,$e.context.events,Y,g,Qe]),Yr=Wr(m,Y.inputRef),xr=b&&Array.isArray($)&&$.length>0,Sr=x.useMemo(()=>!b||!Array.isArray($)||!W?null:$.map(Fe=>{const gt=ai(Fe,k);return C.jsx("input",{type:"hidden",name:W,value:gt},gt)}),[b,$,W,k]);return C.jsx(_E.Provider,{value:Kr,children:C.jsxs(NE.Provider,{value:$e,children:[E,C.jsx("input",{...Y.getInputValidationProps({onFocus(){pe.state.triggerElement?.focus({focusVisible:!0})},onChange(Fe){if(Fe.nativeEvent.defaultPrevented)return;const gt=Fe.target.value,dn=He(Eo,Fe.nativeEvent);function fn(){if(b)return;const Dt=O.current.find(Hs=>ai(Hs,k).toLowerCase()===gt.toLowerCase());Dt!=null&&(D(Dt!==z.initialValue),ht(Dt,dn),A()&&Y.commit(Dt))}pe.set("forceMount",!0),queueMicrotask(fn)}}),name:b?void 0:W,autoComplete:c,value:Oe,disabled:L,required:f&&!xr,readOnly:d,ref:Yr,style:W?b1:rf,tabIndex:-1,"aria-hidden":!0}),Sr]})})}function bj(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 tc=2,vj=400,kv=200,wj={...U1,...Eg,value:()=>null},kj=x.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}=na(),{labelId:p}=bf(),{store:m,setOpen:g,selectionRef:y,validation:b,readOnly:w,required:k,alignItemWithTriggerActiveRef:v,disabled:S,keyboardActiveRef:E}=vr(),M=h||S||i,D=Ne(m,_e.open),F=Ne(m,_e.value),N=Ne(m,_e.triggerProps),A=Ne(m,_e.positionerElement),z=Ne(m,_e.listElement),B=Ne(m,_e.id),U=Ne(m,_e.hasSelectedValue),J=!U&&D,Y=Ne(m,_e.hasNullItemLabel,J),K=s??B;vf({id:K});const G=Bt(A),L=x.useRef(null),{getButtonProps:W,buttonRef:$}=$s({disabled:M,native:a}),j=ye(O=>{m.set("triggerElement",O)}),R=Wr(n,L,$,j),P=Rn(),I=Rn(),Z=Rn(),X=Rn();x.useEffect(()=>{if(D)return!(U||Y)?Z.start(vj,()=>{y.current.allowUnselectedMouseUp=!0,y.current.allowSelectedMouseUp=!0}):X.start(kv,()=>{y.current.allowUnselectedMouseUp=!0,Z.start(kv,()=>{y.current.allowSelectedMouseUp=!0})}),()=>{Z.clear(),X.clear()};y.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},I.clear()},[D,U,Y,y,I,Z,X]);const _=x.useMemo(()=>z?.id??Ha(A)?.id,[z,A]),q=Xi(N,{id:K,role:"combobox","aria-expanded":D?"true":"false","aria-haspopup":"listbox","aria-controls":D?_:void 0,"aria-labelledby":p,"aria-readonly":w||void 0,"aria-required":k||void 0,tabIndex:M?-1:0,ref:R,onFocus(O){u(!0),D&&v.current&&g(!1,He(Eo,O.nativeEvent)),P.start(0,()=>{m.set("forceMount",!0)})},onBlur(O){Ye(A,O.relatedTarget)||(c(!0),u(!1),d==="onBlur"&&b.commit(F))},onPointerMove(){E.current=!1},onKeyDown(){E.current=!0},onMouseDown(O){if(D)return;const V=Xe(O.currentTarget);function H(Q){if(!L.current)return;const ee=Q.target;if(Ye(L.current,ee)||Ye(G.current,ee)||ee===L.current)return;const re=bj(L.current);Q.clientX>=re.left-tc&&Q.clientX<=re.right+tc&&Q.clientY>=re.top-tc&&Q.clientY<=re.bottom+tc||g(!1,He(w_,Q))}I.start(0,()=>{V.addEventListener("mouseup",H,{once:!0})})}},b.getValidationProps,l,W);q.role="combobox";const T={...f,open:D,disabled:M,value:F,readOnly:w,placeholder:!U};return at("button",e,{ref:[n,L],state:T,stateAttributesMapping:wj,props:q})}),xj={value:()=>null},Sj=x.forwardRef(function(e,n){const{className:r,render:o,children:s,placeholder:i,...a}=e,{store:l,valueRef:c}=vr(),u=Ne(l,_e.value),d=Ne(l,_e.items),f=Ne(l,_e.itemToStringLabel),h=Ne(l,_e.hasSelectedValue),p=!h&&i!=null&&s==null,m=Ne(l,_e.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=gj(u,d,f):y=AE(u,d,f),at("span",e,{state:g,ref:[n,c],props:[{children:y},a],stateAttributesMapping:xj})}),Ej=x.forwardRef(function(e,n){const{className:r,render:o,...s}=e,{store:i}=vr(),l={open:Ne(i,_e.open)};return at("span",e,{state:l,ref:n,props:[{"aria-hidden":!0,children:"▼"},s],stateAttributesMapping:q1})}),Cj=x.createContext(void 0),Tj=x.forwardRef(function(e,n){const{store:r}=vr(),o=Ne(r,_e.mounted),s=Ne(r,_e.forceMount);return o||s?C.jsx(Cj.Provider,{value:!0,children:C.jsx(Wm,{ref:n,...e})}):null}),DE=x.createContext(void 0);function Mg(){const t=x.useContext(DE);if(!t)throw new Error(en(59));return t}function Uu(t,e){t&&Object.assign(t.style,e)}const zE={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Rj={position:"fixed"},Mj=x.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=g_,...b}=e,{store:w,listRef:k,labelsRef:v,alignItemWithTriggerActiveRef:S,selectedItemTextRef:E,valuesRef:M,initialValueRef:D,popupRef:F,setValue:N}=vr(),A=PE(),z=Ne(w,_e.open),B=Ne(w,_e.mounted),U=Ne(w,_e.modal),J=Ne(w,_e.value),Y=Ne(w,_e.openMethod),K=Ne(w,_e.positionerElement),G=Ne(w,_e.triggerElement),L=Ne(w,_e.isItemEqualToValue),W=Ne(w,_e.transitionStatus),$=x.useRef(null),j=x.useRef(null),[R,P]=x.useState(g),I=B&&R&&Y!=="touch";!B&&R!==g&&P(g),ve(()=>{B||(_e.scrollUpArrowVisible(w.state)&&w.set("scrollUpArrowVisible",!1),_e.scrollDownArrowVisible(w.state)&&w.set("scrollDownArrowVisible",!1))},[w,B]),x.useImperativeHandle(S,()=>I),yg((I||U)&&z&&Y!=="touch",G);const Z=Y1({anchor:r,floatingRootContext:A,positionMethod:o,mounted:B,side:a,sideOffset:c,align:l,alignOffset:u,arrowPadding:h,collisionBoundary:d,collisionPadding:f,sticky:p,disableAnchorTracking:m??I,collisionAvoidance:y,keepMounted:!0}),X=I?"none":Z.side,_=I?Rj:Z.positionerStyles,q=x.useMemo(()=>{const re={};return z||(re.pointerEvents="none"),{role:"presentation",hidden:!B,style:{..._,...re}}},[z,B,_]),T={open:z,side:X,align:Z.align,anchorHidden:Z.anchorHidden},O=ye(re=>{w.set("positionerElement",re)}),V=at("div",e,{ref:[n,O],state:T,stateAttributesMapping:ea,props:[q,uf(W),b]}),H=x.useRef(0),Q=ye(re=>{if(re.size===0&&H.current===0||M.current.length===0)return;const oe=H.current;if(H.current=re.size,re.size===oe)return;const ne=He(Eo);if(oe!==0&&!w.state.multiple&&J!==null&&Pa(M.current,J,L)===-1){const te=D.current,ge=te!=null&&Pa(M.current,te,L)!==-1?te:null;N(ge,ne),ge===null&&(w.set("selectedIndex",null),E.current=null)}if(oe!==0&&w.state.multiple&&Array.isArray(J)){const le=fe=>Pa(M.current,fe,L)!==-1,te=J.filter(fe=>le(fe));(te.length!==J.length||te.some(fe=>!fj(J,fe,L)))&&(N(te,ne),te.length===0&&(w.set("selectedIndex",null),E.current=null))}if(z&&I){w.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const le={height:""};Uu(K,le),Uu(F.current,le)}}),ee=x.useMemo(()=>({...Z,side:X,alignItemWithTriggerActive:I,setControlledAlignItemWithTrigger:P,scrollUpArrowRef:$,scrollDownArrowRef:j}),[Z,X,I,P]);return C.jsx(fg,{elementsRef:k,labelsRef:v,onMapChange:Q,children:C.jsxs(DE.Provider,{value:ee,children:[B&&U&&C.jsx(vg,{inert:df(!z),cutout:G}),V]})})});function jE(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 nc="base-ui-disable-scrollbar",Fp={className:nc,getElement(t){return C.jsx("style",{nonce:t,href:nc,precedence:"base-ui:low",children:`.${nc}{scrollbar-width:none}.${nc}::-webkit-scrollbar{display:none}`})}};function kh(t,e=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(e,Math.min(t,n))}const Uo=1,Oj={...ea,...Qi},_j=x.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}=vr(),{side:b,align:w,alignItemWithTriggerActive:k,setControlledAlignItemWithTrigger:v,scrollDownArrowRef:S,scrollUpArrowRef:E}=Mg(),M=OE()!=null,D=PE(),{nonce:F,disableStyleElements:N}=yI(),A=Rn(),z=Ne(a,_e.id),B=Ne(a,_e.open),U=Ne(a,_e.mounted),J=Ne(a,_e.popupProps),Y=Ne(a,_e.transitionStatus),K=Ne(a,_e.triggerElement),G=Ne(a,_e.positionerElement),L=Ne(a,_e.listElement),W=x.useRef(0),$=x.useRef(!1),j=x.useRef(0),R=x.useRef(!1),P=x.useRef({}),I=of(),Z=ye(T=>{if(!G||!l.current||!R.current)return;if($.current||!k){m();return}const O=G.style.top==="0px",V=G.style.bottom==="0px",H=G.getBoundingClientRect().height,Q=Xe(G),ee=getComputedStyle(G),re=parseFloat(ee.marginTop),oe=parseFloat(ee.marginBottom),ne=xv(getComputedStyle(l.current)),le=Math.min(Q.documentElement.clientHeight-re-oe,ne),te=T.scrollTop,fe=Sv(T);let ge=0,pe=null,Le=!1,qe=!1;const Je=Oe=>{G.style.height=`${Oe}px`},Me=(Oe,ze)=>{const Be=kh(Oe,0,le-H);Be>0&&Je(H+Be),T.scrollTop=ze,le-(H+Be)<=Uo&&($.current=!0),m()};if(O){const Oe=fe-te,ze=H+Oe,Be=Math.min(ze,le);if(ge=Be,Oe<=Uo){Me(Oe,fe);return}le-Be>Uo?qe=!0:Le=!0}else if(V){const Oe=te,ze=H+Oe,Be=Math.min(ze,le),pt=ze-le;if(ge=Be,Oe<=Uo){Me(Oe,0);return}le-Be>Uo?pe=0:(Le=!0,te<fe&&(pe=te-(Oe-pt)))}if(ge=Math.ceil(ge),ge!==0&&Je(ge),qe||pe!=null){const Oe=Sv(T),ze=qe?Oe:kh(pe,0,Oe);Math.abs(T.scrollTop-ze)>Uo&&(T.scrollTop=ze)}(Le||ge>=le-Uo)&&($.current=!0),m()});x.useImperativeHandle(g,()=>Z,[Z]),Io({open:B,ref:l,onComplete(){B&&c?.(!0)}});const X={open:B,transitionStatus:Y,side:b,align:w};ve(()=>{!G||!l.current||Object.keys(P.current).length||(P.current={top:G.style.top||"0",left:G.style.left||"0",right:G.style.right,height:G.style.height,bottom:G.style.bottom,minHeight:G.style.minHeight,maxHeight:G.style.maxHeight,marginTop:G.style.marginTop,marginBottom:G.style.marginBottom})},[l,G]),ve(()=>{B||k||(R.current=!1,$.current=!1,W.current=0,j.current=0,Uu(G,P.current))},[B,k,G,l]),ve(()=>{const T=l.current;if(!(!B||!K||!G||!T||a.state.transitionStatus==="ending")){if(!k){R.current=!0,I.request(m),T.style.removeProperty("--transform-origin");return}queueMicrotask(()=>{const O=Nj(T);T.style.removeProperty("--transform-origin");try{const V=getComputedStyle(G),H=getComputedStyle(T),Q=Xe(K),ee=Pt(G),re=K.getBoundingClientRect(),oe=G.getBoundingClientRect(),ne=re.left,le=re.height,te=L||T,fe=te.scrollHeight,ge=parseFloat(H.borderBottomWidth),pe=parseFloat(V.marginTop)||10,Le=parseFloat(V.marginBottom)||10,qe=parseFloat(V.minHeight)||100,Je=xv(H),Me=5,Oe=5,ze=20,Be=Q.documentElement.clientHeight-pe-Le,pt=Q.documentElement.clientWidth,bt=Be-re.bottom+le,mt=f.current,ht=d.current;let Qe,$e=0,ce=0;if(mt&&ht){const Fe=ht.getBoundingClientRect();Qe=mt.getBoundingClientRect();const gt=Fe.left-ne,dn=Qe.left-oe.left,fn=Fe.top-re.top+Fe.height/2,Dt=Qe.top-oe.top+Qe.height/2;$e=gt-dn,ce=Dt-fn}const ie=bt+ce+Le+ge;let he=Math.min(Be,ie);const Se=Be-pe-Le,De=ie-he,ut=Math.max(Me,ne+$e),Ae=pt-Oe,wn=Math.max(0,ut+oe.width-Ae);G.style.left=`${ut-wn}px`,G.style.height=`${he}px`,G.style.maxHeight="auto",G.style.marginTop=`${pe}px`,G.style.marginBottom=`${Le}px`,T.style.height="100%";const Kr=te.scrollHeight-te.clientHeight,Yr=De>=Kr;Yr&&(he=Math.min(Be,oe.height)-(De-Kr));const xr=re.top<ze||re.bottom>Be-ze||he<Math.min(fe,qe),Sr=(ee.visualViewport?.scale??1)!==1&&Am;if(xr||Sr){R.current=!0,Uu(G,P.current),Xn.flushSync(()=>v(!1));return}if(Yr){const Fe=Math.max(0,Be-ie);G.style.top=oe.height>=Se?"0":`${Fe}px`,G.style.height=`${he}px`,te.scrollTop=te.scrollHeight-te.clientHeight,W.current=Math.max(qe,he)}else G.style.bottom="0",W.current=Math.max(qe,he),te.scrollTop=De;if(Qe){const Fe=oe.top,gt=oe.height,dn=Qe.top+Qe.height/2,fn=gt>0?(dn-Fe)/gt*100:50,Dt=kh(fn,0,100);T.style.setProperty("--transform-origin",`50% ${Dt}%`)}(W.current===Be||he>=Je)&&($.current=!0),m(),setTimeout(()=>{R.current=!0})}finally{O()}})}},[a,B,G,K,d,f,l,m,k,v,I,S,E,L]),x.useEffect(()=>{if(!k||!G||!B)return;const T=Pt(G);function O(V){u(!1,He(k_,V))}return T.addEventListener("resize",O),()=>{T.removeEventListener("resize",O)}},[u,k,G,B]);const _={...L?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":p||void 0,id:`${z}-list`},onKeyDown(T){h.current=!0,M&&gg.has(T.key)&&T.stopPropagation()},onMouseMove(){h.current=!1},onPointerLeave(T){if(!y||jE(T)||T.pointerType==="touch")return;const O=T.currentTarget;A.start(0,()=>{a.set("activeIndex",null),O.focus({preventScroll:!0})})},onScroll(T){L||Z(T.currentTarget)},...k&&{style:L?{height:"100%"}:zE}},q=at("div",e,{ref:[n,l],state:X,stateAttributesMapping:Oj,props:[J,_,uf(Y),{className:!L&&k?Fp.className:void 0},i]});return C.jsxs(x.Fragment,{children:[!N&&Fp.getElement(F),C.jsx(qm,{context:D,modal:!1,disabled:!U,returnFocus:s,restoreFocus:!0,children:q})]})});function xv(t){const e=t.maxHeight||"";return e.endsWith("px")&&parseFloat(e)||1/0}function Sv(t){return Math.max(0,t.scrollHeight-t.clientHeight)}const Ev=[["transform","none"],["scale","1"],["translate","0 0"]];function Nj(t){const{style:e}=t,n={};for(const[r,o]of Ev)n[r]=e.getPropertyValue(r),e.setProperty(r,o,"important");return()=>{for(const[r]of Ev){const o=n[r];o?e.setProperty(r,o):e.removeProperty(r)}}}const Pj=x.forwardRef(function(e,n){const{className:r,render:o,...s}=e,{store:i,scrollHandlerRef:a}=vr(),{alignItemWithTriggerActive:l}=Mg(),c=Ne(i,_e.hasScrollArrows),u=Ne(i,_e.openMethod),d=Ne(i,_e.multiple),h={id:`${Ne(i,_e.id)}-list`,role:"listbox","aria-multiselectable":d||void 0,onScroll(m){a.current?.(m.currentTarget)},...l&&{style:zE},className:c&&u!=="touch"?Fp.className:void 0},p=ye(m=>{i.set("listElement",m)});return at("div",e,{ref:[n,p],props:[h,s]})}),LE=x.createContext(void 0);function Og(){const t=x.useContext(LE);if(!t)throw new Error(en(57));return t}const $j=x.memo(x.forwardRef(function(e,n){const{render:r,className:o,value:s=null,label:i,disabled:a=!1,nativeButton:l=!1,...c}=e,u=x.useRef(null),d=mg({label:i,textRef:u,indexGuessBehavior:AS.GuessFromOrder}),{store:f,getItemProps:h,setOpen:p,setValue:m,selectionRef:g,typingRef:y,valuesRef:b,keyboardActiveRef:w,multiple:k,highlightItemOnHover:v}=vr(),S=Rn(),E=Ne(f,_e.isActive,d.index),M=Ne(f,_e.isSelected,d.index,s),D=Ne(f,_e.isSelectedByFocus,d.index),F=Ne(f,_e.isItemEqualToValue),N=d.index,A=N!==-1,z=x.useRef(null),B=Bt(N);ve(()=>{if(!A)return;const I=b.current;return I[N]=s,()=>{delete I[N]}},[A,N,s,b]),ve(()=>{if(!A)return;const I=f.state.value;let Z=I;k&&Array.isArray(I)&&I.length>0&&(Z=I[I.length-1]),Z!==void 0&&zi(s,Z,F)&&f.set("selectedIndex",N)},[A,N,k,F,f,s]);const U={disabled:a,selected:M,highlighted:E},J=h({active:E,selected:M});J.onFocus=void 0,J.id=void 0;const Y=x.useRef(null),K=x.useRef("mouse"),G=x.useRef(!1),{getButtonProps:L,buttonRef:W}=$s({disabled:a,focusableWhenDisabled:!0,native:l});function $(I){const Z=f.state.value;if(k){const X=Array.isArray(Z)?Z:[],_=M?hj(X,s,F):[...X,s];m(_,He(Xf,I))}else m(s,He(Xf,I)),p(!1,He(Xf,I))}const j={role:"option","aria-selected":M,tabIndex:E?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(I){!v||w.current||jE(I)||S.start(0,()=>{f.state.activeIndex===N&&f.set("activeIndex",null)})},onTouchStart(){g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(I){Y.current=I.key,f.set("activeIndex",N)},onClick(I){G.current=!1,!(I.type==="keydown"&&Y.current===null)&&(a||Y.current===" "&&y.current||K.current!=="touch"&&!E||(Y.current=null,$(I.nativeEvent)))},onPointerEnter(I){K.current=I.pointerType},onPointerDown(I){K.current=I.pointerType,G.current=!0},onMouseUp(I){if(a)return;if(G.current){G.current=!1;return}const Z=!g.current.allowSelectedMouseUp&&M,X=!g.current.allowUnselectedMouseUp&&!M;Z||X||K.current!=="touch"&&!E||$(I.nativeEvent)}},R=at("div",e,{ref:[W,n,d.ref,z],state:U,props:[J,j,c,L]}),P=x.useMemo(()=>({selected:M,indexRef:B,textRef:u,selectedByFocus:D,hasRegistered:A}),[M,B,u,D,A]);return C.jsx(LE.Provider,{value:P,children:R})})),Aj=x.forwardRef(function(e,n){const r=e.keepMounted??!1,{selected:o}=Og();return r||o?C.jsx(Ij,{...e,ref:n}):null}),Ij=x.memo(x.forwardRef((t,e)=>{const{render:n,className:r,keepMounted:o,...s}=t,{selected:i}=Og(),a=x.useRef(null),{transitionStatus:l,setMounted:c}=yl(i),d=at("span",t,{ref:[e,a],state:{selected:i,transitionStatus:l},props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:Qi});return Io({open:i,ref:a,onComplete(){i||c(!1)}}),d})),Dj=x.memo(x.forwardRef(function(e,n){const{indexRef:r,textRef:o,selectedByFocus:s,hasRegistered:i}=Og(),{selectedItemTextRef:a}=vr(),{className:l,render:c,...u}=e,d=x.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 at("div",e,{ref:[d,n,o],props:u})})),FE=x.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}=vr(),{side:h,scrollDownArrowRef:p,scrollUpArrowRef:m}=Mg(),g=s==="up"?_e.scrollUpArrowVisible:_e.scrollDownArrowVisible,y=Ne(l,g),b=Ne(l,_e.openMethod),w=y&&b!=="touch",k=Rn(),v=s==="up"?m:p,{transitionStatus:S,setMounted:E}=yl(w);ve(()=>(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]),Io({open:w,ref:v,onComplete(){w||E(!1)}});const F=at("div",e,{ref:[n,v],state:{direction:s,visible:w,side:h,transitionStatus:S},props:[{"aria-hidden":!0,children:s==="up"?"▲":"▼",style:{position:"absolute"},onMouseMove(A){if(A.movementX===0&&A.movementY===0||k.isStarted())return;l.set("activeIndex",null);function z(){const B=l.state.listElement??c.current;if(!B)return;l.set("activeIndex",null),d();const U=B.scrollTop===0,J=Math.round(B.scrollTop+B.clientHeight)>=B.scrollHeight;if(u.current.length===0&&(s==="up"?l.set("scrollUpArrowVisible",!U):l.set("scrollDownArrowVisible",!J)),s==="up"&&U||s==="down"&&J){k.clear();return}if((l.state.listElement||c.current)&&u.current&&u.current.length>0){const K=u.current,G=v.current?.offsetHeight||0;if(s==="up"){let L=0;const W=B.scrollTop+G;for(let j=0;j<K.length;j+=1){const R=K[j];if(R&&R.offsetTop>=W){L=j;break}}const $=Math.max(0,L-1);if($<L){const j=K[$];j&&(B.scrollTop=Math.max(0,j.offsetTop-G))}else B.scrollTop=0}else{let L=K.length-1;const W=B.scrollTop+B.clientHeight-G;for(let j=0;j<K.length;j+=1){const R=K[j];if(R&&R.offsetTop+R.offsetHeight>W){L=Math.max(0,j-1);break}}const $=Math.min(K.length-1,L+1);if($>L){const j=K[$];j&&(B.scrollTop=j.offsetTop+j.offsetHeight-B.clientHeight+G)}else B.scrollTop=B.scrollHeight-B.clientHeight}}k.start(40,z)}k.start(40,z)},onMouseLeave(){k.clear()}},a]});return w||i?F:null}),zj=x.forwardRef(function(e,n){return C.jsx(FE,{...e,ref:n,direction:"down"})}),jj=x.forwardRef(function(e,n){return C.jsx(FE,{...e,ref:n,direction:"up"})}),Lj=x.createContext(void 0),Fj=x.forwardRef(function(e,n){const{className:r,render:o,...s}=e,[i,a]=x.useState(),l=x.useMemo(()=>({labelId:i,setLabelId:a}),[i,a]),c=at("div",e,{ref:n,props:[{role:"group","aria-labelledby":i},s]});return C.jsx(Lj.Provider,{value:l,children:c})}),Ku=yj;function Yu(t){const e=Ee.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=de("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=C.jsx(Fj,{"data-slot":"select-group",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function Gu(t){const e=Ee.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=de("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=C.jsx(Sj,{"data-slot":"select-value",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}function Zu(t){const e=Ee.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=de("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=C.jsx(Ej,{render:C.jsx(ng,{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=C.jsxs(kj,{"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 Ju(t){const e=Ee.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=de("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=C.jsx(Bj,{}),e[11]=g):g=e[11];let y;e[12]!==n?(y=C.jsx(Pj,{children:n}),e[12]=n,e[13]=y):y=e[13];let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=C.jsx(Vj,{}),e[14]=b):b=e[14];let w;e[15]!==p||e[16]!==o||e[17]!==m||e[18]!==y?(w=C.jsxs(_j,{"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=C.jsx(Tj,{children:C.jsx(Mj,{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 wf(t){const e=Ee.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=de("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=C.jsx(Dj,{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=C.jsx(Aj,{render:C.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:C.jsx(tg,{className:"pointer-events-none"})}),e[8]=a):a=e[8];let l;return e[9]!==o||e[10]!==s||e[11]!==i?(l=C.jsxs($j,{"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 Bj(t){const e=Ee.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=de("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=C.jsx(I$,{}),e[5]=s):s=e[5];let i;return e[6]!==r||e[7]!==o?(i=C.jsx(jj,{"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 Vj(t){const e=Ee.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=de("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=C.jsx(ng,{}),e[5]=s):s=e[5];let i;return e[6]!==r||e[7]!==o?(i=C.jsx(zj,{"data-slot":"select-scroll-down-button",className:o,...r,children:s}),e[6]=r,e[7]=o,e[8]=i):i=e[8],i}const kf={kind:"newest"},Wj=[{label:"Newest first",option:{kind:"newest"}},{label:"Oldest first",option:{kind:"oldest"}},{label:"Title A-Z",option:{kind:"titleAsc"}},{label:"Title Z-A",option:{kind:"titleDesc"}}];function Hj(t){const n=t.replaceAll("\\","/").split("/");return n[n.length-1]??t}function qj(t){return t.replace(/\.[^.]+$/,"")}function cs(t){const e=t.data.title;if(typeof e=="string"&&e.trim().length>0)return e.trim();const n=Hj(t.filePath||t.id);return qj(n)}function Cv(t,e){return!t&&!e?0:t?e?new Date(t).getTime()-new Date(e).getTime():-1:1}function Tv(t,e){const n=cs(t).localeCompare(cs(e),void 0,{sensitivity:"base"});return n!==0?n:t.id.localeCompare(e.id,void 0,{sensitivity:"base"})}function Uj(t,e,n,r){const o=t.data[n],s=e.data[n];if(o==null&&s==null)return 0;if(o==null)return 1;if(s==null)return-1;let i=0;if(typeof o=="string"&&typeof s=="string"){const a=Date.parse(o),l=Date.parse(s);!Number.isNaN(a)&&!Number.isNaN(l)?i=a-l:i=o.localeCompare(s,void 0,{sensitivity:"base"})}else typeof o=="number"&&typeof s=="number"?i=o-s:i=String(o).localeCompare(String(s),void 0,{sensitivity:"base"});return r==="desc"?-i:i}function _g(t,e=kf){return t?[...t.files].sort((n,r)=>{switch(e.kind){case"newest":return Cv(r.createdAt,n.createdAt);case"oldest":return Cv(n.createdAt,r.createdAt);case"titleAsc":return Tv(n,r);case"titleDesc":return Tv(r,n);case"frontmatter":return Uj(n,r,e.fieldKey,e.direction)}}):[]}function Kj(t){return t.filter(e=>e.kind==="string"||e.kind==="number"||e.kind==="dateAnyOf"||e.kind==="enum").map(e=>({key:e.key,label:e.key}))}function Bp(t){switch(t.kind){case"newest":case"oldest":case"titleAsc":case"titleDesc":return t.kind;case"frontmatter":return`field:${t.fieldKey}:${t.direction}`}}function BE(t){switch(t){case"newest":return{kind:"newest"};case"oldest":return{kind:"oldest"};case"titleAsc":return{kind:"titleAsc"};case"titleDesc":return{kind:"titleDesc"};default:{const e=t.match(/^field:(.+):(asc|desc)$/);return e?{kind:"frontmatter",fieldKey:e[1],direction:e[2]}:kf}}}function xh(t,e){return t.collection===e.collection&&t.file===e.file}function Yj(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=_g(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 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 Ti extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class VE extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const WE={};function Ro(t){return WE}function HE(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 Vp(t,e){return typeof e=="bigint"?e.toString():e}function Ng(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function Pg(t){return t==null}function $g(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}const Rv=Symbol("evaluating");function st(t,e,n){let r;Object.defineProperty(t,e,{get(){if(r!==Rv)return r===void 0&&(r=Rv,r=n()),r},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function js(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function jo(...t){const e={};for(const n of t){const r=Object.getOwnPropertyDescriptors(n);Object.assign(e,r)}return Object.defineProperties({},e)}function Mv(t){return JSON.stringify(t)}function Gj(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const qE="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Xu(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const Zj=Ng(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function ji(t){if(Xu(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const n=e.prototype;return!(Xu(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function UE(t){return ji(t)?{...t}:Array.isArray(t)?[...t]:t}const Jj=new Set(["string","number","symbol"]);function Li(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Lo(t,e,n){const r=new t._zod.constr(e??t._zod.def);return(!e||n?.parent)&&(r._zod.parent=t),r}function Pe(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 Xj(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function Qj(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=jo(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 js(this,"shape",i),i},checks:[]});return Lo(t,s)}function eL(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=jo(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 js(this,"shape",i),i},checks:[]});return Lo(t,s)}function tL(t,e){if(!ji(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=jo(t._zod.def,{get shape(){const s={...t._zod.def.shape,...e};return js(this,"shape",s),s}});return Lo(t,o)}function nL(t,e){if(!ji(e))throw new Error("Invalid input to safeExtend: expected a plain object");const n=jo(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e};return js(this,"shape",r),r}});return Lo(t,n)}function rL(t,e){const n=jo(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return js(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:[]});return Lo(t,n)}function oL(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=jo(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 js(this,"shape",l),l},checks:[]});return Lo(e,i)}function sL(t,e,n){const r=jo(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 js(this,"shape",s),s}});return Lo(e,r)}function pi(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 mi(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function rc(t){return typeof t=="string"?t:t?.message}function Mo(t,e,n){const r={...t,path:t.path??[]};if(!t.message){const o=rc(t.inst?._zod.def?.error?.(t))??rc(e?.error?.(t))??rc(n.customError?.(t))??rc(n.localeError?.(t))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,e?.reportInput||delete r.input,r}function Ag(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Qa(...t){const[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}const KE=(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,Vp,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},YE=se("$ZodError",KE),GE=se("$ZodError",KE,{Parent:Error});function iL(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 aL(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 Ig=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 Ti;if(i.issues.length){const a=new(o?.Err??t)(i.issues.map(l=>Mo(l,s,Ro())));throw qE(a,o?.callee),a}return i.value},Dg=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=>Mo(l,s,Ro())));throw qE(a,o?.callee),a}return i.value},xf=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 Ti;return s.issues.length?{success:!1,error:new(t??YE)(s.issues.map(i=>Mo(i,o,Ro())))}:{success:!0,data:s.value}},lL=xf(GE),Sf=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=>Mo(i,o,Ro())))}:{success:!0,data:s.value}},cL=Sf(GE),uL=t=>(e,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ig(t)(e,n,o)},dL=t=>(e,n,r)=>Ig(t)(e,n,r),fL=t=>async(e,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Dg(t)(e,n,o)},hL=t=>async(e,n,r)=>Dg(t)(e,n,r),pL=t=>(e,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return xf(t)(e,n,o)},mL=t=>(e,n,r)=>xf(t)(e,n,r),gL=t=>async(e,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Sf(t)(e,n,o)},yL=t=>async(e,n,r)=>Sf(t)(e,n,r),bL=/^[cC][^\s-]{8,}$/,vL=/^[0-9a-z]+$/,wL=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,kL=/^[0-9a-vA-V]{20}$/,xL=/^[A-Za-z0-9]{27}$/,SL=/^[a-zA-Z0-9_-]{21}$/,EL=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,CL=/^([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})$/,Ov=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)$/,TL=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,RL="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ML(){return new RegExp(RL,"u")}const OL=/^(?:(?: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])$/,_L=/^(([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}|:))$/,NL=/^((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])$/,PL=/^(([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])$/,$L=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ZE=/^[A-Za-z0-9_-]*$/,AL=/^\+[1-9]\d{6,14}$/,JE="(?:(?:\\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])))",IL=new RegExp(`^${JE}$`);function XE(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 DL(t){return new RegExp(`^${XE(t)}$`)}function zL(t){const e=XE({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(`^${JE}T(?:${r})$`)}const jL=t=>{const e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},LL=/^-?\d+(?:\.\d+)?$/,FL=/^[^A-Z]*$/,BL=/^[^a-z]*$/,wr=se("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),VL=se("$ZodCheckMaxLength",(t,e)=>{var n;wr.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=Ag(o);r.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),WL=se("$ZodCheckMinLength",(t,e)=>{var n;wr.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=Ag(o);r.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),HL=se("$ZodCheckLengthEquals",(t,e)=>{var n;wr.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=Ag(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})}}),Ef=se("$ZodCheckStringFormat",(t,e)=>{var n,r;wr.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=()=>{})}),qL=se("$ZodCheckRegex",(t,e)=>{Ef.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})}}),UL=se("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=FL),Ef.init(t,e)}),KL=se("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=BL),Ef.init(t,e)}),YL=se("$ZodCheckIncludes",(t,e)=>{wr.init(t,e);const n=Li(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})}}),GL=se("$ZodCheckStartsWith",(t,e)=>{wr.init(t,e);const n=new RegExp(`^${Li(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})}}),ZL=se("$ZodCheckEndsWith",(t,e)=>{wr.init(t,e);const n=new RegExp(`.*${Li(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})}}),JL=se("$ZodCheckOverwrite",(t,e)=>{wr.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class XL{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(`
57
+ `).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(`
58
+ `))}}const QL={major:4,minor:3,patch:6},Mt=se("$ZodType",(t,e)=>{var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=QL;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=pi(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 Ti;if(u||h instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await h,i.issues.length!==f&&(c||(c=pi(i,f)))});else{if(i.issues.length===f)continue;c||(c=pi(i,f))}}return u?u.then(()=>i):i},s=(i,a,l)=>{if(pi(i))return i.aborted=!0,i;const c=o(a,r,l);if(c instanceof Promise){if(l.async===!1)throw new Ti;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 Ti;return l.then(c=>o(c,r,a))}return o(l,r,a)}}st(t,"~standard",()=>({validate:o=>{try{const s=lL(t,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return cL(t,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),zg=se("$ZodString",(t,e)=>{Mt.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??jL(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}}),vt=se("$ZodStringFormat",(t,e)=>{Ef.init(t,e),zg.init(t,e)}),e3=se("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=CL),vt.init(t,e)}),t3=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=Ov(r))}else e.pattern??(e.pattern=Ov());vt.init(t,e)}),n3=se("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=TL),vt.init(t,e)}),r3=se("$ZodURL",(t,e)=>{vt.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})}}}),o3=se("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=ML()),vt.init(t,e)}),s3=se("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=SL),vt.init(t,e)}),i3=se("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=bL),vt.init(t,e)}),a3=se("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=vL),vt.init(t,e)}),l3=se("$ZodULID",(t,e)=>{e.pattern??(e.pattern=wL),vt.init(t,e)}),c3=se("$ZodXID",(t,e)=>{e.pattern??(e.pattern=kL),vt.init(t,e)}),u3=se("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=xL),vt.init(t,e)}),d3=se("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=zL(e)),vt.init(t,e)}),f3=se("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=IL),vt.init(t,e)}),h3=se("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=DL(e)),vt.init(t,e)}),p3=se("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=EL),vt.init(t,e)}),m3=se("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=OL),vt.init(t,e),t._zod.bag.format="ipv4"}),g3=se("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=_L),vt.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})}}}),y3=se("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=NL),vt.init(t,e)}),b3=se("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=PL),vt.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 QE(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const v3=se("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=$L),vt.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=n=>{QE(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function w3(t){if(!ZE.test(t))return!1;const e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return QE(n)}const k3=se("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=ZE),vt.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=n=>{w3(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),x3=se("$ZodE164",(t,e)=>{e.pattern??(e.pattern=AL),vt.init(t,e)});function S3(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 E3=se("$ZodJWT",(t,e)=>{vt.init(t,e),t._zod.check=n=>{S3(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),C3=se("$ZodUnknown",(t,e)=>{Mt.init(t,e),t._zod.parse=n=>n}),T3=se("$ZodNever",(t,e)=>{Mt.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)});function _v(t,e,n){t.issues.length&&e.issues.push(...mi(n,t.issues)),e.value[n]=t.value}const R3=se("$ZodArray",(t,e)=>{Mt.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=>_v(c,n,i))):_v(l,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function Qu(t,e,n,r,o){if(t.issues.length){if(o&&!(n in r))return;e.issues.push(...mi(n,t.issues))}t.value===void 0?n in r&&(e.value[n]=void 0):e.value[n]=t.value}function eC(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=Xj(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}function tC(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=>Qu(h,n,d,e,u))):Qu(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 M3=se("$ZodObject",(t,e)=>{if(Mt.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=Ng(()=>eC(e));st(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=Xu,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=>Qu(g,a,f,c,p))):Qu(m,a,f,c,p)}return s?tC(u,c,a,l,r.value,t):u.length?Promise.all(u).then(()=>a):a}}),O3=se("$ZodObjectJIT",(t,e)=>{M3.init(t,e);const n=t._zod.parse,r=Ng(()=>eC(e)),o=f=>{const h=new XL(["shape","payload","ctx"]),p=r.value,m=w=>{const k=Mv(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=Mv(w),E=f[w]?._zod?.optout==="optional";h.write(`const ${k} = ${m(w)};`),E?h.write(`
59
+ if (${k}.issues.length) {
60
+ if (${v} in input) {
61
+ payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
62
+ ...iss,
63
+ path: iss.path ? [${v}, ...iss.path] : [${v}]
64
+ })));
65
+ }
66
+ }
67
+
68
+ if (${k}.value === undefined) {
69
+ if (${v} in input) {
70
+ newResult[${v}] = undefined;
71
+ }
72
+ } else {
73
+ newResult[${v}] = ${k}.value;
74
+ }
75
+
76
+ `):h.write(`
77
+ if (${k}.issues.length) {
78
+ payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
79
+ ...iss,
80
+ path: iss.path ? [${v}, ...iss.path] : [${v}]
81
+ })));
82
+ }
83
+
84
+ if (${k}.value === undefined) {
85
+ if (${v} in input) {
86
+ newResult[${v}] = undefined;
87
+ }
88
+ } else {
89
+ newResult[${v}] = ${k}.value;
90
+ }
91
+
92
+ `)}h.write("payload.value = newResult;"),h.write("return payload;");const b=h.compile();return(w,k)=>b(f,w,k)};let s;const i=Xu,a=!WE.jitless,c=a&&Zj.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?tC([],p,f,h,d,t):f):n(f,h):(f.issues.push({expected:"object",code:"invalid_type",input:p,inst:t}),f)}});function Nv(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=>!pi(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=>Mo(i,r,Ro())))}),e)}const _3=se("$ZodUnion",(t,e)=>{Mt.init(t,e),st(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),st(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),st(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),st(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=>$g(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=>Nv(l,o,t,s)):Nv(a,o,t,s)}}),N3=se("$ZodIntersection",(t,e)=>{Mt.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])=>Pv(n,l,c)):Pv(n,s,i)}});function Wp(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(ji(t)&&ji(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=Wp(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=Wp(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 Pv(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}),pi(t))return t;const i=Wp(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 P3=se("$ZodRecord",(t,e)=>{Mt.init(t,e),t._zod.parse=(n,r)=>{const o=n.value;if(!ji(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(...mi(c,d.issues)),n.value[c]=d.value})):(u.issues.length&&n.issues.push(...mi(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"&&LL.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=>Mo(d,r,Ro())),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(...mi(a,d.issues)),n.value[l.value]=d.value})):(u.issues.length&&n.issues.push(...mi(a,u.issues)),n.value[l.value]=u.value)}}return s.length?Promise.all(s).then(()=>n):n}}),$3=se("$ZodEnum",(t,e)=>{Mt.init(t,e);const n=HE(e.entries),r=new Set(n);t._zod.values=r,t._zod.pattern=new RegExp(`^(${n.filter(o=>Jj.has(typeof o)).map(o=>typeof o=="string"?Li(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}}),A3=se("$ZodLiteral",(t,e)=>{if(Mt.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"?Li(r):r?Li(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}}),I3=se("$ZodTransform",(t,e)=>{Mt.init(t,e),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new VE(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 Ti;return n.value=o,n}});function $v(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}const nC=se("$ZodOptional",(t,e)=>{Mt.init(t,e),t._zod.optin="optional",t._zod.optout="optional",st(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),st(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${$g(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=>$v(s,n.value)):$v(o,n.value)}return n.value===void 0?n:e.innerType._zod.run(n,r)}}),D3=se("$ZodExactOptional",(t,e)=>{nC.init(t,e),st(t._zod,"values",()=>e.innerType._zod.values),st(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(n,r)=>e.innerType._zod.run(n,r)}),z3=se("$ZodNullable",(t,e)=>{Mt.init(t,e),st(t._zod,"optin",()=>e.innerType._zod.optin),st(t._zod,"optout",()=>e.innerType._zod.optout),st(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${$g(n.source)}|null)$`):void 0}),st(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)}),j3=se("$ZodDefault",(t,e)=>{Mt.init(t,e),t._zod.optin="optional",st(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=>Av(s,e)):Av(o,e)}});function Av(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const L3=se("$ZodPrefault",(t,e)=>{Mt.init(t,e),t._zod.optin="optional",st(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))}),F3=se("$ZodNonOptional",(t,e)=>{Mt.init(t,e),st(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=>Iv(s,t)):Iv(o,t)}});function Iv(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 B3=se("$ZodCatch",(t,e)=>{Mt.init(t,e),st(t._zod,"optin",()=>e.innerType._zod.optin),st(t._zod,"optout",()=>e.innerType._zod.optout),st(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=>Mo(i,r,Ro()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=e.catchValue({...n,error:{issues:o.issues.map(s=>Mo(s,r,Ro()))},input:n.value}),n.issues=[]),n)}}),V3=se("$ZodPipe",(t,e)=>{Mt.init(t,e),st(t._zod,"values",()=>e.in._zod.values),st(t._zod,"optin",()=>e.in._zod.optin),st(t._zod,"optout",()=>e.out._zod.optout),st(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=>oc(i,e.in,r)):oc(s,e.in,r)}const o=e.in._zod.run(n,r);return o instanceof Promise?o.then(s=>oc(s,e.out,r)):oc(o,e.out,r)}});function oc(t,e,n){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},n)}const W3=se("$ZodReadonly",(t,e)=>{Mt.init(t,e),st(t._zod,"propValues",()=>e.innerType._zod.propValues),st(t._zod,"values",()=>e.innerType._zod.values),st(t._zod,"optin",()=>e.innerType?._zod?.optin),st(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(Dv):Dv(o)}});function Dv(t){return t.value=Object.freeze(t.value),t}const H3=se("$ZodCustom",(t,e)=>{wr.init(t,e),Mt.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=>zv(s,n,r,t));zv(o,n,r,t)}});function zv(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(Qa(o))}}var jv;class q3{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 U3(){return new q3}(jv=globalThis).__zod_globalRegistry??(jv.__zod_globalRegistry=U3());const wa=globalThis.__zod_globalRegistry;function K3(t,e){return new t({type:"string",...Pe(e)})}function Y3(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Pe(e)})}function Lv(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Pe(e)})}function G3(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Pe(e)})}function Z3(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Pe(e)})}function J3(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Pe(e)})}function X3(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Pe(e)})}function Q3(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Pe(e)})}function eF(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Pe(e)})}function tF(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Pe(e)})}function nF(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Pe(e)})}function rF(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Pe(e)})}function oF(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Pe(e)})}function sF(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Pe(e)})}function iF(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Pe(e)})}function aF(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Pe(e)})}function lF(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Pe(e)})}function cF(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Pe(e)})}function uF(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Pe(e)})}function dF(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Pe(e)})}function fF(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Pe(e)})}function hF(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Pe(e)})}function pF(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Pe(e)})}function mF(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Pe(e)})}function gF(t,e){return new t({type:"string",format:"date",check:"string_format",...Pe(e)})}function yF(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...Pe(e)})}function bF(t,e){return new t({type:"string",format:"duration",check:"string_format",...Pe(e)})}function vF(t){return new t({type:"unknown"})}function wF(t,e){return new t({type:"never",...Pe(e)})}function rC(t,e){return new VL({check:"max_length",...Pe(e),maximum:t})}function ed(t,e){return new WL({check:"min_length",...Pe(e),minimum:t})}function oC(t,e){return new HL({check:"length_equals",...Pe(e),length:t})}function kF(t,e){return new qL({check:"string_format",format:"regex",...Pe(e),pattern:t})}function xF(t){return new UL({check:"string_format",format:"lowercase",...Pe(t)})}function SF(t){return new KL({check:"string_format",format:"uppercase",...Pe(t)})}function EF(t,e){return new YL({check:"string_format",format:"includes",...Pe(e),includes:t})}function CF(t,e){return new GL({check:"string_format",format:"starts_with",...Pe(e),prefix:t})}function TF(t,e){return new ZL({check:"string_format",format:"ends_with",...Pe(e),suffix:t})}function ra(t){return new JL({check:"overwrite",tx:t})}function RF(t){return ra(e=>e.normalize(t))}function MF(){return ra(t=>t.trim())}function OF(){return ra(t=>t.toLowerCase())}function _F(){return ra(t=>t.toUpperCase())}function NF(){return ra(t=>Gj(t))}function PF(t,e,n){return new t({type:"array",element:e,...Pe(n)})}function $F(t,e,n){return new t({type:"custom",check:"custom",fn:e,...Pe(n)})}function AF(t){const e=IF(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Qa(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(Qa(o))}},t(n.value,n)));return e}function IF(t,e){const n=new wr({check:"custom",...Pe(e)});return n._zod.check=t,n}function sC(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??wa,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 $t(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),$t(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 iC(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>
93
+
94
+ 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 aC(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:td(e,"input",t.processors),output:td(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 DF=(t,e={})=>n=>{const r=sC({...n,processors:e});return $t(t,r),iC(r,t),aC(r,t)},td=(t,e,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=sC({...o??{},target:s,io:e,processors:n});return $t(t,i),iC(i,t),aC(i,t)},zF={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},jF=(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=zF[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}))])}},LF=(t,e,n,r)=>{n.not={}},FF=(t,e,n,r)=>{},BF=(t,e,n,r)=>{const o=t._zod.def,s=HE(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},VF=(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},WF=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},HF=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},qF=(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=$t(s.element,e,{...r,path:[...r.path,"items"]})},UF=(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]=$t(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=$t(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(o.additionalProperties=!1)},KF=(t,e,n,r)=>{const o=t._zod.def,s=o.inclusive===!1,i=o.options.map((a,l)=>$t(a,e,{...r,path:[...r.path,s?"oneOf":"anyOf",l]}));s?n.oneOf=i:n.anyOf=i},YF=(t,e,n,r)=>{const o=t._zod.def,s=$t(o.left,e,{...r,path:[...r.path,"allOf",0]}),i=$t(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},GF=(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=$t(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=$t(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=$t(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)}},ZF=(t,e,n,r)=>{const o=t._zod.def,s=$t(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"}]},JF=(t,e,n,r)=>{const o=t._zod.def;$t(o.innerType,e,r);const s=e.seen.get(t);s.ref=o.innerType},XF=(t,e,n,r)=>{const o=t._zod.def;$t(o.innerType,e,r);const s=e.seen.get(t);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},QF=(t,e,n,r)=>{const o=t._zod.def;$t(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)))},e4=(t,e,n,r)=>{const o=t._zod.def;$t(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},t4=(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;$t(s,e,r);const i=e.seen.get(t);i.ref=s},n4=(t,e,n,r)=>{const o=t._zod.def;$t(o.innerType,e,r);const s=e.seen.get(t);s.ref=o.innerType,n.readOnly=!0},lC=(t,e,n,r)=>{const o=t._zod.def;$t(o.innerType,e,r);const s=e.seen.get(t);s.ref=o.innerType},r4=se("ZodISODateTime",(t,e)=>{d3.init(t,e),St.init(t,e)});function o4(t){return mF(r4,t)}const s4=se("ZodISODate",(t,e)=>{f3.init(t,e),St.init(t,e)});function i4(t){return gF(s4,t)}const a4=se("ZodISOTime",(t,e)=>{h3.init(t,e),St.init(t,e)});function l4(t){return yF(a4,t)}const c4=se("ZodISODuration",(t,e)=>{p3.init(t,e),St.init(t,e)});function u4(t){return bF(c4,t)}const d4=(t,e)=>{YE.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>aL(t,n)},flatten:{value:n=>iL(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,Vp,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,Vp,2)}},isEmpty:{get(){return t.issues.length===0}}})},Fn=se("ZodError",d4,{Parent:Error}),f4=Ig(Fn),h4=Dg(Fn),p4=xf(Fn),m4=Sf(Fn),g4=uL(Fn),y4=dL(Fn),b4=fL(Fn),v4=hL(Fn),w4=pL(Fn),k4=mL(Fn),x4=gL(Fn),S4=yL(Fn),Ot=se("ZodType",(t,e)=>(Mt.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:td(t,"input"),output:td(t,"output")}}),t.toJSONSchema=DF(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...n)=>t.clone(jo(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)=>Lo(t,n,r),t.brand=()=>t,t.register=((n,r)=>(n.add(t,r),t)),t.parse=(n,r)=>f4(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>p4(t,n,r),t.parseAsync=async(n,r)=>h4(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>m4(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>g4(t,n,r),t.decode=(n,r)=>y4(t,n,r),t.encodeAsync=async(n,r)=>b4(t,n,r),t.decodeAsync=async(n,r)=>v4(t,n,r),t.safeEncode=(n,r)=>w4(t,n,r),t.safeDecode=(n,r)=>k4(t,n,r),t.safeEncodeAsync=async(n,r)=>x4(t,n,r),t.safeDecodeAsync=async(n,r)=>S4(t,n,r),t.refine=(n,r)=>t.check(bB(n,r)),t.superRefine=n=>t.check(vB(n)),t.overwrite=n=>t.check(ra(n)),t.optional=()=>Bv(t),t.exactOptional=()=>sB(t),t.nullable=()=>Vv(t),t.nullish=()=>Bv(Vv(t)),t.nonoptional=n=>dB(t,n),t.array=()=>el(t),t.or=n=>Y4([t,n]),t.and=n=>Z4(t,n),t.transform=n=>Wv(t,rB(n)),t.default=n=>lB(t,n),t.prefault=n=>uB(t,n),t.catch=n=>hB(t,n),t.pipe=n=>Wv(t,n),t.readonly=()=>gB(t),t.describe=n=>{const r=t.clone();return wa.add(r,{description:n}),r},Object.defineProperty(t,"description",{get(){return wa.get(t)?.description},configurable:!0}),t.meta=(...n)=>{if(n.length===0)return wa.get(t);const r=t.clone();return wa.add(r,n[0]),r},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=n=>n(t),t)),cC=se("_ZodString",(t,e)=>{zg.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(r,o,s)=>jF(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(kF(...r)),t.includes=(...r)=>t.check(EF(...r)),t.startsWith=(...r)=>t.check(CF(...r)),t.endsWith=(...r)=>t.check(TF(...r)),t.min=(...r)=>t.check(ed(...r)),t.max=(...r)=>t.check(rC(...r)),t.length=(...r)=>t.check(oC(...r)),t.nonempty=(...r)=>t.check(ed(1,...r)),t.lowercase=r=>t.check(xF(r)),t.uppercase=r=>t.check(SF(r)),t.trim=()=>t.check(MF()),t.normalize=(...r)=>t.check(RF(...r)),t.toLowerCase=()=>t.check(OF()),t.toUpperCase=()=>t.check(_F()),t.slugify=()=>t.check(NF())}),E4=se("ZodString",(t,e)=>{zg.init(t,e),cC.init(t,e),t.email=n=>t.check(Y3(C4,n)),t.url=n=>t.check(Q3(T4,n)),t.jwt=n=>t.check(pF(B4,n)),t.emoji=n=>t.check(eF(R4,n)),t.guid=n=>t.check(Lv(Fv,n)),t.uuid=n=>t.check(G3(sc,n)),t.uuidv4=n=>t.check(Z3(sc,n)),t.uuidv6=n=>t.check(J3(sc,n)),t.uuidv7=n=>t.check(X3(sc,n)),t.nanoid=n=>t.check(tF(M4,n)),t.guid=n=>t.check(Lv(Fv,n)),t.cuid=n=>t.check(nF(O4,n)),t.cuid2=n=>t.check(rF(_4,n)),t.ulid=n=>t.check(oF(N4,n)),t.base64=n=>t.check(dF(j4,n)),t.base64url=n=>t.check(fF(L4,n)),t.xid=n=>t.check(sF(P4,n)),t.ksuid=n=>t.check(iF($4,n)),t.ipv4=n=>t.check(aF(A4,n)),t.ipv6=n=>t.check(lF(I4,n)),t.cidrv4=n=>t.check(cF(D4,n)),t.cidrv6=n=>t.check(uF(z4,n)),t.e164=n=>t.check(hF(F4,n)),t.datetime=n=>t.check(o4(n)),t.date=n=>t.check(i4(n)),t.time=n=>t.check(l4(n)),t.duration=n=>t.check(u4(n))});function Ri(t){return K3(E4,t)}const St=se("ZodStringFormat",(t,e)=>{vt.init(t,e),cC.init(t,e)}),C4=se("ZodEmail",(t,e)=>{n3.init(t,e),St.init(t,e)}),Fv=se("ZodGUID",(t,e)=>{e3.init(t,e),St.init(t,e)}),sc=se("ZodUUID",(t,e)=>{t3.init(t,e),St.init(t,e)}),T4=se("ZodURL",(t,e)=>{r3.init(t,e),St.init(t,e)}),R4=se("ZodEmoji",(t,e)=>{o3.init(t,e),St.init(t,e)}),M4=se("ZodNanoID",(t,e)=>{s3.init(t,e),St.init(t,e)}),O4=se("ZodCUID",(t,e)=>{i3.init(t,e),St.init(t,e)}),_4=se("ZodCUID2",(t,e)=>{a3.init(t,e),St.init(t,e)}),N4=se("ZodULID",(t,e)=>{l3.init(t,e),St.init(t,e)}),P4=se("ZodXID",(t,e)=>{c3.init(t,e),St.init(t,e)}),$4=se("ZodKSUID",(t,e)=>{u3.init(t,e),St.init(t,e)}),A4=se("ZodIPv4",(t,e)=>{m3.init(t,e),St.init(t,e)}),I4=se("ZodIPv6",(t,e)=>{g3.init(t,e),St.init(t,e)}),D4=se("ZodCIDRv4",(t,e)=>{y3.init(t,e),St.init(t,e)}),z4=se("ZodCIDRv6",(t,e)=>{b3.init(t,e),St.init(t,e)}),j4=se("ZodBase64",(t,e)=>{v3.init(t,e),St.init(t,e)}),L4=se("ZodBase64URL",(t,e)=>{k3.init(t,e),St.init(t,e)}),F4=se("ZodE164",(t,e)=>{x3.init(t,e),St.init(t,e)}),B4=se("ZodJWT",(t,e)=>{E3.init(t,e),St.init(t,e)}),V4=se("ZodUnknown",(t,e)=>{C3.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(n,r,o)=>FF()});function Hp(){return vF(V4)}const W4=se("ZodNever",(t,e)=>{T3.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(n,r,o)=>LF(t,n,r)});function H4(t){return wF(W4,t)}const q4=se("ZodArray",(t,e)=>{R3.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(n,r,o)=>qF(t,n,r,o),t.element=e.element,t.min=(n,r)=>t.check(ed(n,r)),t.nonempty=n=>t.check(ed(1,n)),t.max=(n,r)=>t.check(rC(n,r)),t.length=(n,r)=>t.check(oC(n,r)),t.unwrap=()=>t.element});function el(t,e){return PF(q4,t,e)}const U4=se("ZodObject",(t,e)=>{O3.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(n,r,o)=>UF(t,n,r,o),st(t,"shape",()=>e.shape),t.keyof=()=>Q4(Object.keys(t._zod.def.shape)),t.catchall=n=>t.clone({...t._zod.def,catchall:n}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Hp()}),t.loose=()=>t.clone({...t._zod.def,catchall:Hp()}),t.strict=()=>t.clone({...t._zod.def,catchall:H4()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=n=>tL(t,n),t.safeExtend=n=>nL(t,n),t.merge=n=>rL(t,n),t.pick=n=>Qj(t,n),t.omit=n=>eL(t,n),t.partial=(...n)=>oL(dC,t,n[0]),t.required=(...n)=>sL(fC,t,n[0])});function uC(t,e){const n={type:"object",shape:t??{},...Pe(e)};return new U4(n)}const K4=se("ZodUnion",(t,e)=>{_3.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(n,r,o)=>KF(t,n,r,o),t.options=e.options});function Y4(t,e){return new K4({type:"union",options:t,...Pe(e)})}const G4=se("ZodIntersection",(t,e)=>{N3.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(n,r,o)=>YF(t,n,r,o)});function Z4(t,e){return new G4({type:"intersection",left:t,right:e})}const J4=se("ZodRecord",(t,e)=>{P3.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(n,r,o)=>GF(t,n,r,o),t.keyType=e.keyType,t.valueType=e.valueType});function X4(t,e,n){return new J4({type:"record",keyType:t,valueType:e,...Pe(n)})}const qp=se("ZodEnum",(t,e)=>{$3.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(r,o,s)=>BF(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 qp({...e,checks:[],...Pe(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 qp({...e,checks:[],...Pe(o),entries:s})}});function Q4(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new qp({type:"enum",entries:n,...Pe(e)})}const eB=se("ZodLiteral",(t,e)=>{A3.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(n,r,o)=>VF(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 tB(t,e){return new eB({type:"literal",values:Array.isArray(t)?t:[t],...Pe(e)})}const nB=se("ZodTransform",(t,e)=>{I3.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(n,r,o)=>HF(t,n),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new VE(t.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Qa(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(Qa(i))}};const o=e.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function rB(t){return new nB({type:"transform",transform:t})}const dC=se("ZodOptional",(t,e)=>{nC.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(n,r,o)=>lC(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function Bv(t){return new dC({type:"optional",innerType:t})}const oB=se("ZodExactOptional",(t,e)=>{D3.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(n,r,o)=>lC(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function sB(t){return new oB({type:"optional",innerType:t})}const iB=se("ZodNullable",(t,e)=>{z3.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(n,r,o)=>ZF(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function Vv(t){return new iB({type:"nullable",innerType:t})}const aB=se("ZodDefault",(t,e)=>{j3.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(n,r,o)=>XF(t,n,r,o),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function lB(t,e){return new aB({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():UE(e)}})}const cB=se("ZodPrefault",(t,e)=>{L3.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(n,r,o)=>QF(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function uB(t,e){return new cB({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():UE(e)}})}const fC=se("ZodNonOptional",(t,e)=>{F3.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(n,r,o)=>JF(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function dB(t,e){return new fC({type:"nonoptional",innerType:t,...Pe(e)})}const fB=se("ZodCatch",(t,e)=>{B3.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(n,r,o)=>e4(t,n,r,o),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function hB(t,e){return new fB({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const pB=se("ZodPipe",(t,e)=>{V3.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(n,r,o)=>t4(t,n,r,o),t.in=e.in,t.out=e.out});function Wv(t,e){return new pB({type:"pipe",in:t,out:e})}const mB=se("ZodReadonly",(t,e)=>{W3.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(n,r,o)=>n4(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function gB(t){return new mB({type:"readonly",innerType:t})}const yB=se("ZodCustom",(t,e)=>{H3.init(t,e),Ot.init(t,e),t._zod.processJSONSchema=(n,r,o)=>WF(t,n)});function bB(t,e={}){return $F(yB,t,e)}function vB(t){return AF(t)}const nd=X4(Ri(),Hp()),wB=uC({type:tB("object"),properties:nd,required:el(Ri()).optional()}).passthrough(),kB=uC({type:Ri().optional(),format:Ri().optional(),enum:el(Ri()).optional(),anyOf:el(nd).optional(),items:nd.optional()}).passthrough(),Hv="#/definitions/";function xB(t){const e=nd.safeParse(t);return e.success?e.data:void 0}function jg(t){const e=kB.safeParse(t);return e.success?e.data:void 0}function qv(t){const e=wB.safeParse(t);return e.success?e.data:void 0}function hC(t){return t.type!=="array"?!1:jg(t.items)?.type==="string"}function SB(t){if(!t.anyOf||t.anyOf.length===0)return!1;let e=!1;for(const n of t.anyOf){const r=jg(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 EB(t){const e=el(Ri()).safeParse(t);return new Set(e.success?e.data:[])}function CB(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"&&hC(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 Lg(t){if(!t)return;const e=qv(t);if(e)return e;const n=typeof t.$ref=="string"?t.$ref:void 0;if(!n?.startsWith(Hv))return;const r=n.slice(Hv.length),o=xB(t.definitions),s=o?o[r]:void 0;return qv(s)}function Fg(t,e){const n=EB(t.required),r=[];for(const[o,s]of Object.entries(t.properties)){if(o==="$schema")continue;const i=jg(s),a=n.has(o);if(!i){r.push({kind:"unsupported",key:o,required:a,reason:"invalid schema node"});continue}const l=CB({key:o,property:i,required:a,fieldUi:e});if(l){r.push(l);continue}if(SB(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(hC(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}const pC="astro-md-editor:sort";function TB(){try{const t=window.localStorage.getItem(pC);if(t)return BE(t)}catch{}return kf}function RB(t){try{window.localStorage.setItem(pC,Bp(t))}catch{}}function MB(t){const e=Ee.c(86),{collections:n,selectedCollectionName:r,selectedFileId:o,onSelectCollection:s,onSelectFile:i,onCreateFile:a,onDeleteFile:l,isCreatingFile:c,deletingFileId:u,schema:d,fieldUi:f}=t,[h,p]=x.useState(null),[m,g]=x.useState(""),[y,b]=x.useState(kf);let w,k;e[0]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{b(TB())},k=[],e[0]=w,e[1]=k):(w=e[0],k=e[1]),x.useEffect(w,k);let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{g("")},e[2]=v):v=e[2];let S;e[3]!==r?(S=[r],e[3]=r,e[4]=S):S=e[4],x.useEffect(v,S);let E;e[5]!==r?(E=ce=>ce.name===r,e[5]=r,e[6]=E):E=e[6];const M=n.find(E),D=_g(M,y),F=m.trim()?D.filter(ce=>{const ie=m.toLowerCase();return cs(ce).toLowerCase().includes(ie)||ce.id.toLowerCase().includes(ie)}):D;let N;if(e[7]!==f||e[8]!==d){e:{if(!d){let he;e[10]===Symbol.for("react.memo_cache_sentinel")?(he=[],e[10]=he):he=e[10],N=he;break e}const ce=Lg(d);if(!ce){let he;e[11]===Symbol.for("react.memo_cache_sentinel")?(he=[],e[11]=he):he=e[11],N=he;break e}const ie=Fg(ce,f);N=Kj(ie)}e[7]=f,e[8]=d,e[9]=N}else N=e[9];const A=N,[z,B]=x.useState(!1);let U;e[12]===Symbol.for("react.memo_cache_sentinel")?(U=ce=>{const ie=BE(ce);b(ie),RB(ie),B(!1)},e[12]=U):U=e[12];const J=U;let Y;e[13]!==y?(Y=Bp(y),e[13]=y,e[14]=Y):Y=e[14];const K=Y,G="flex h-full flex-col gap-3";let L;e[15]!==s?(L=ce=>{ce&&s(ce)},e[15]=s,e[16]=L):L=e[16];let W;e[17]===Symbol.for("react.memo_cache_sentinel")?(W=C.jsx(Zu,{className:"bg-muted/50 focus-visible:ring-ring/35 w-full border-transparent shadow-none focus-visible:border-transparent focus-visible:ring-2",children:C.jsx(Gu,{placeholder:"Select a collection"})}),e[17]=W):W=e[17];let $;e[18]!==n?($=n.map(OB),e[18]=n,e[19]=$):$=e[19];let j;e[20]!==$?(j=C.jsx(Ju,{children:C.jsx(Yu,{children:$})}),e[20]=$,e[21]=j):j=e[21];let R;e[22]!==r||e[23]!==L||e[24]!==j?(R=C.jsxs(Ku,{value:r,onValueChange:L,children:[W,j]}),e[22]=r,e[23]=L,e[24]=j,e[25]=R):R=e[25];let P;e[26]===Symbol.for("react.memo_cache_sentinel")?(P=C.jsx(ff,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2"}),e[26]=P):P=e[26];let I;e[27]===Symbol.for("react.memo_cache_sentinel")?(I=ce=>g(ce.target.value),e[27]=I):I=e[27];let Z;e[28]!==m?(Z=C.jsx(er,{id:"file-search-input",placeholder:"Search files...",value:m,onChange:I,className:"h-7 pr-7 pl-7 text-xs"}),e[28]=m,e[29]=Z):Z=e[29];let X;e[30]===Symbol.for("react.memo_cache_sentinel")?(X=C.jsx(Sl,{className:"text-muted-foreground hover:text-foreground absolute top-1/2 right-0.5 flex size-6 -translate-y-1/2 cursor-pointer items-center justify-center rounded-md","aria-label":"Sort files",children:C.jsx(C$,{className:"size-3.5"})}),e[30]=X):X=e[30];let _,q;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=C.jsx(Zz,{placeholder:"Search sort..."}),q=C.jsx(Jz,{children:"No sort option found."}),e[31]=_,e[32]=q):(_=e[31],q=e[32]);let T;e[33]!==K?(T=Wj.map(ce=>{const ie=Bp(ce.option);return C.jsx(wh,{value:ie,"data-checked":K===ie,onSelect:J,children:ce.label},ie)}),e[33]=K,e[34]=T):T=e[34];let O;e[35]!==T?(O=C.jsx(vv,{heading:"Sort",children:T}),e[35]=T,e[36]=O):O=e[36];let V;e[37]!==K||e[38]!==A?(V=A.length>0?C.jsxs(C.Fragment,{children:[C.jsx(Xz,{}),C.jsx(vv,{heading:"Frontmatter fields",children:A.map(ce=>{const ie=`field:${ce.key}:asc`,he=`field:${ce.key}:desc`;return C.jsxs(x.Fragment,{children:[C.jsxs(wh,{value:ie,"data-checked":K===ie,onSelect:J,children:[ce.label," (asc)"]}),C.jsxs(wh,{value:he,"data-checked":K===he,onSelect:J,children:[ce.label," (desc)"]})]},ce.key)})})]}):null,e[37]=K,e[38]=A,e[39]=V):V=e[39];let H;e[40]!==O||e[41]!==V?(H=C.jsx(El,{align:"end",className:"w-52 p-0",children:C.jsxs(Gz,{children:[_,q,O,V]})}),e[40]=O,e[41]=V,e[42]=H):H=e[42];let Q;e[43]!==z||e[44]!==H?(Q=C.jsxs(xl,{open:z,onOpenChange:B,children:[X,H]}),e[43]=z,e[44]=H,e[45]=Q):Q=e[45];let ee;e[46]!==Z||e[47]!==Q?(ee=C.jsxs("div",{className:"relative",children:[P,Z,Q]}),e[46]=Z,e[47]=Q,e[48]=ee):ee=e[48];const re="bg-background/35 min-h-0 flex-1 overflow-auto rounded-md p-1",oe=F.length===0?C.jsx("p",{className:"text-muted-foreground px-2 py-2 text-sm",children:m.trim()?"No matching files.":"No files in this collection."}):C.jsx("div",{className:"space-y-0.5",children:F.map(ce=>{const ie=ce.id===o,he=cs(ce),Se=ce.id,De=/\.mdx$/i.test(ce.filePath),ut=ce.data.draft===!0,Ae=u===ce.id;return C.jsxs("div",{className:"group/item relative",children:[C.jsx(yn,{type:"button",variant:"ghost",className:de("h-auto w-full justify-start border-0 px-2.5 py-3 pr-9 text-left shadow-none","hover:bg-background/70",ie&&"bg-muted text-foreground hover:bg-muted/55"),onClick:()=>i(ce.id),title:ce.filePath,children:C.jsxs("span",{className:"flex w-full min-w-0 flex-col items-start gap-0.5",children:[C.jsx("span",{className:"w-full truncate text-sm font-normal",children:he}),C.jsxs("span",{className:"flex w-full min-w-0 items-center gap-1.5",children:[C.jsx("span",{className:"text-muted-foreground min-w-0 flex-1 truncate text-xs",children:Se}),De?C.jsx(Wu,{variant:"secondary",className:"bg-muted h-4 border-transparent px-1.5 text-[10px] leading-none",children:"MDX"}):null,ut?C.jsx(Wu,{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]})]})}),C.jsx(yn,{type:"button",size:"icon",variant:"ghost",className:de("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 ${he}`,disabled:Ae,onClick:wn=>{wn.preventDefault(),wn.stopPropagation(),p({id:ce.id,label:he})},children:Ae?C.jsx(Jn,{className:"size-4 animate-spin"}):C.jsx(kA,{className:"size-4"})})]},ce.id)})});let ne;e[49]!==oe?(ne=C.jsx("div",{className:re,children:oe}),e[49]=oe,e[50]=ne):ne=e[50];const le=!M||c;let te;e[51]!==a?(te=async()=>{const ce=window.prompt("Enter slug (e.g. my-new-post)");ce&&await a(ce)},e[51]=a,e[52]=te):te=e[52];let fe;e[53]!==c?(fe=c?C.jsx(Jn,{className:"size-4 animate-spin"}):null,e[53]=c,e[54]=fe):fe=e[54];let ge;e[55]!==le||e[56]!==te||e[57]!==fe?(ge=C.jsxs(yn,{type:"button",variant:"outline",className:"w-full",disabled:le,onClick:te,children:[fe,"New file"]}),e[55]=le,e[56]=te,e[57]=fe,e[58]=ge):ge=e[58];const pe=h!==null;let Le;e[59]===Symbol.for("react.memo_cache_sentinel")?(Le=ce=>{ce||p(null)},e[59]=Le):Le=e[59];let qe;e[60]===Symbol.for("react.memo_cache_sentinel")?(qe=C.jsx(hD,{children:"Delete file?"}),e[60]=qe):qe=e[60];const Je=h?.label;let Me;e[61]!==Je?(Me=C.jsxs(dD,{children:[qe,C.jsxs(pD,{children:['This will permanently delete "',Je,'" from disk.']})]}),e[61]=Je,e[62]=Me):Me=e[62];const Oe=!!u;let ze;e[63]!==Oe?(ze=C.jsx(gD,{disabled:Oe,children:"Cancel"}),e[63]=Oe,e[64]=ze):ze=e[64];const Be=!h||!!u;let pt;e[65]!==h||e[66]!==l?(pt=async()=>{h&&(await l(h.id),p(null))},e[65]=h,e[66]=l,e[67]=pt):pt=e[67];let bt;e[68]!==Be||e[69]!==pt?(bt=C.jsx(mD,{variant:"destructive",disabled:Be,onClick:pt,children:"Delete"}),e[68]=Be,e[69]=pt,e[70]=bt):bt=e[70];let mt;e[71]!==ze||e[72]!==bt?(mt=C.jsxs(fD,{children:[ze,bt]}),e[71]=ze,e[72]=bt,e[73]=mt):mt=e[73];let ht;e[74]!==Me||e[75]!==mt?(ht=C.jsxs(uD,{children:[Me,mt]}),e[74]=Me,e[75]=mt,e[76]=ht):ht=e[76];let Qe;e[77]!==pe||e[78]!==ht?(Qe=C.jsx(aD,{open:pe,onOpenChange:Le,children:ht}),e[77]=pe,e[78]=ht,e[79]=Qe):Qe=e[79];let $e;return e[80]!==R||e[81]!==ee||e[82]!==ne||e[83]!==ge||e[84]!==Qe?($e=C.jsxs("div",{className:G,children:[R,ee,ne,ge,Qe]}),e[80]=R,e[81]=ee,e[82]=ne,e[83]=ge,e[84]=Qe,e[85]=$e):$e=e[85],$e}function OB(t){return C.jsx(wf,{value:t.name,children:t.name},t.name)}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 mC(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=mC(o.content,s.content,n+1);if(i!=null)return i}n+=o.nodeSize}}function gC(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=gC(i.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class ae{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 ae(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 ae(r,o)}cutByIndex(e,n){return e==n?ae.empty:e==0&&n==this.content.length?this:new ae(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 ae(o,s)}addToStart(e){return new ae([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ae(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 mC(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return gC(this,e,n,r)}findIndex(e){if(e==0)return ic(0,e);if(e==this.size)return ic(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?ic(n+1,s):ic(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 ae.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new ae(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ae.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 ae(n||e,r)}static from(e){if(!e)return ae.empty;if(e instanceof ae)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ae([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}ae.empty=new ae([],0);const Sh={index:0,offset:0};function ic(t,e){return Sh.index=t,Sh.offset=e,Sh}function rd(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(!rd(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!rd(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let ft=class Up{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&&rd(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 Up.none;if(e instanceof Up)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};ft.none=[];class od extends Error{}class be{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=bC(this.content,e+this.openStart,n);return r&&new be(r,this.openStart,this.openEnd)}removeBetween(e,n){return new be(yC(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 be.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 be(ae.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 be(e,r,o)}}be.empty=new be(ae.empty,0,0);function yC(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(yC(s.content,e-o-1,n-o-1)))}function bC(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=bC(i.content,e-s-1,n,i);return a&&t.replaceChild(o,i.copy(a))}function _B(t,e,n){if(n.openStart>t.depth)throw new od("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new od("Inconsistent open depths");return vC(t,e,n,0)}function vC(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=vC(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 ds(i,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:i,end:a}=NB(n,t);return ds(s,kC(t,i,a,e,r))}else return ds(s,sd(t,e,r))}function wC(t,e){if(!e.type.compatibleContent(t.type))throw new od("Cannot join "+e.type.name+" onto "+t.type.name)}function Kp(t,e,n){let r=t.node(n);return wC(r,e.node(n)),r}function us(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 $a(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&&(us(t.nodeAfter,r),s++));for(let a=s;a<i;a++)us(o.child(a),r);e&&e.depth==n&&e.textOffset&&us(e.nodeBefore,r)}function ds(t,e){return t.type.checkContent(e),t.copy(e)}function kC(t,e,n,r,o){let s=t.depth>o&&Kp(t,e,o+1),i=r.depth>o&&Kp(n,r,o+1),a=[];return $a(null,t,o,a),s&&i&&e.index(o)==n.index(o)?(wC(s,i),us(ds(s,kC(t,e,n,r,o+1)),a)):(s&&us(ds(s,sd(t,e,o+1)),a),$a(e,n,o,a),i&&us(ds(i,sd(n,r,o+1)),a)),$a(r,null,o,a),new ae(a)}function sd(t,e,n){let r=[];if($a(null,t,n,r),t.depth>n){let o=Kp(t,e,n+1);us(ds(o,sd(t,e,n+1)),r)}return $a(e,null,n,r),new ae(r)}function NB(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(ae.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class tl{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 ft.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 id(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 tl(n,r,s)}static resolveCached(e,n){let r=Uv.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 Uv.set(e,r=new PB);let o=r.elts[r.i]=tl.resolve(e,n);return r.i=(r.i+1)%$B,o}}class PB{constructor(){this.elts=[],this.i=0}}const $B=12,Uv=new WeakMap;class id{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 AB=Object.create(null);let vo=class Yp{constructor(e,n,r,o=ft.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||ae.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&&rd(this.attrs,n||e.defaultAttrs||AB)&&ft.sameSet(this.marks,r||ft.none)}copy(e=null){return e==this.content?this:new Yp(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Yp(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 be.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 be(c,o.depth-i,s.depth-i)}replace(e,n,r){return _B(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 tl.resolveCached(this,e)}resolveNoCache(e){return tl.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()+")"),xC(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=ae.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=ft.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(!ft.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=ae.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,o,r);return s.type.checkAttrs(s.attrs),s}};vo.prototype.text=void 0;class ad extends vo{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):xC(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 ad(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ad(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 xC(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Es{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new IB(e,n);if(r.next==null)return Es.empty;let o=SC(r);r.next&&r.err("Unexpected trailing text");let s=VB(BB(o));return WB(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 ae.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(`
95
+ `)}}Es.empty=new Es(!0);class IB{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 SC(t){let e=[];do e.push(DB(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function DB(t){let e=[];do e.push(zB(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function zB(t){let e=FB(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=jB(t,e);else break;return e}function Kv(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function jB(t,e){let n=Kv(t),r=n;return t.eat(",")&&(t.next!="}"?r=Kv(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function LB(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 FB(t){if(t.eat("(")){let e=SC(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=LB(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 BB(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 EC(t,e){return e-t}function Yv(t,e){let n=[];return r(e),n.sort(EC);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 VB(t){let e=Object.create(null);return n(Yv(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]);Yv(t,l).forEach(u=>{c||o.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new Es(r.indexOf(t.length-1)>-1);for(let i=0;i<o.length;i++){let a=o[i][1].sort(EC);s.next.push({type:o[i][0],next:e[a.join(",")]||n(a)})}return s}}function WB(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 CC(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 TC(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 RC(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 MC(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new qB(t,r,e[r]);return n}let Gv=class OC{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=MC(e,r.attrs),this.defaultAttrs=CC(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==Es.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:TC(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new vo(this,this.computeAttrs(e),ae.from(n),ft.setFrom(r))}createChecked(e=null,n,r){return n=ae.from(n),this.checkContent(n),new vo(this,this.computeAttrs(e),n,ft.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=ae.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(ae.empty,!0);return s?new vo(this,e,n.append(s),ft.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){RC(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:ft.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,i)=>r[s]=new OC(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 HB(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 qB{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?HB(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Cf{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=MC(e,o.attrs),this.excluded=null;let s=CC(this.attrs);this.instance=s?new ft(this,s):null}create(e=null){return!e&&this.instance?this.instance:new ft(this,TC(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((s,i)=>r[s]=new Cf(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){RC(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class _C{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=Gv.compile(this.spec.nodes,this),this.marks=Cf.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]=Es.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?Zv(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==""?[]:Zv(this,i.split(" "))}this.nodeFromJSON=o=>vo.fromJSON(this,o),this.markFromJSON=o=>ft.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 Gv){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 ad(r,r.defaultAttrs,e,ft.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 Zv(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 UB(t){return t.tag!=null}function KB(t){return t.style!=null}class wo{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(UB(o))this.tags.push(o);else if(KB(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 Xv(this,n,!1);return r.addAll(e,ft.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Xv(this,n,!0);return r.addAll(e,ft.none,n.from,n.to),be.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(ZB(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=Qv(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=Qv(i)),i.node||i.ignore||i.mark||(i.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new wo(e,wo.schemaRules(e)))}}const NC={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},YB={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},PC={ol:!0,ul:!0},nl=1,Gp=2,Aa=4;function Jv(t,e,n){return e!=null?(e?nl:0)|(e==="full"?Gp:0):t&&t.whitespace=="pre"?nl|Gp:n&~Aa}class ac{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=ft.none,this.match=s||(i&Aa?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ae.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&nl)){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=ae.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ae.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&&!NC.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Xv{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=Jv(null,n.preserveWhitespace,0)|(r?Aa:0);o?s=new ac(o.type,o.attrs,ft.none,!0,n.topMatch||o.type.contentMatch,i):r?s=new ac(null,null,ft.none,!0,null,i):s=new ac(e.schema.topNodeType,null,ft.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&Gp?"full":this.localPreserveWS||(o.options&nl)>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,`
96
+ `);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;PC.hasOwnProperty(i)&&this.parser.normalizeLists&&GB(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:YB.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(NC.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(`
97
+ `),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=ft.none;for(let a of o.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):e0(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=Jv(e,s,i.options);i.options&Aa&&i.content.length==0&&(a|=Aa);let l=ft.none;return r=r.filter(c=>(i.type?i.type.allowsMarkType(c.type):e0(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new ac(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|=nl)}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 GB(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&PC.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function ZB(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Qv(t){let e={};for(let n in t)e[n]=t[n];return e}function e0(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 Ls{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Eh(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}=Ru(Eh(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&&Ru(Eh(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return Ru(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ls(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=t0(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return t0(e.marks)}}function t0(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Eh(t){return t.document||window.document}const n0=new WeakMap;function JB(t){let e=n0.get(t);return e===void 0&&n0.set(t,e=XB(t)),e}function XB(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 Ru(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=JB(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}=Ru(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 $C=65535,AC=Math.pow(2,16);function QB(t,e){return t+e*AC}function r0(t){return t&$C}function e5(t){return(t-(t&$C))/AC}const IC=1,DC=2,Mu=4,zC=8;class Zp{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&zC)>0}get deletedBefore(){return(this.delInfo&(IC|Mu))>0}get deletedAfter(){return(this.delInfo&(DC|Mu))>0}get deletedAcross(){return(this.delInfo&Mu)>0}}class Tn{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Tn.empty)return Tn.empty}recover(e){let n=0,r=r0(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+e5(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:QB(a/3,e-l),m=e==l?DC:e==d?IC:Mu;return(n<0?e!=l:e!=d)&&(m|=zC),new Zp(h,m,p)}o+=u-c}return r?e+o:new Zp(e+o,0,null)}touches(e,n){let r=0,o=r0(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 Tn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Tn.empty:new Tn(e<0?[0,-e,0]:[0,0,e])}}Tn.empty=new Tn([]);class rl{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 rl(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 rl;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 Zp(e,o,null)}}const Ch=Object.create(null);class tn{getMap(){return Tn.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ch[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 Ch)throw new RangeError("Duplicate use of step JSON ID "+e);return Ch[e]=n,n.prototype.jsonID=e,n}}class Nt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Nt(e,null)}static fail(e){return new Nt(null,e)}static fromReplace(e,n,r,o){try{return Nt.ok(e.replace(n,r,o))}catch(s){if(s instanceof od)return Nt.fail(s.message);throw s}}}function Bg(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let s=t.child(o);s.content.size&&(s=s.copy(Bg(s.content,e,s))),s.isInline&&(s=e(s,n,o)),r.push(s)}return ae.fromArray(r)}class co 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 be(Bg(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 Nt.fromReplace(e,this.from,this.to,s)}invert(){return new Gn(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 co(n.pos,r.pos,this.mark)}merge(e){return e instanceof co&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new co(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 co(n.from,n.to,e.markFromJSON(n.mark))}}tn.jsonID("addMark",co);class Gn 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 be(Bg(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return Nt.fromReplace(e,this.from,this.to,r)}invert(){return new co(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 Gn(n.pos,r.pos,this.mark)}merge(e){return e instanceof Gn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Gn(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 Gn(n.from,n.to,e.markFromJSON(n.mark))}}tn.jsonID("removeMark",Gn);class uo extends tn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Nt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Nt.fromReplace(e,this.pos,this.pos+1,new be(ae.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 uo(this.pos,n.marks[o]);return new uo(this.pos,this.mark)}}return new Cs(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new uo(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 uo(n.pos,e.markFromJSON(n.mark))}}tn.jsonID("addNodeMark",uo);class Cs extends tn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Nt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Nt.fromReplace(e,this.pos,this.pos+1,new be(ae.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new uo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Cs(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 Cs(n.pos,e.markFromJSON(n.mark))}}tn.jsonID("removeNodeMark",Cs);class Ft 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&&Jp(e,this.from,this.to)?Nt.fail("Structure replace would overwrite content"):Nt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Tn([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ft(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 Ft(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ft)||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?be.empty:new be(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ft(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?be.empty:new be(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ft(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 Ft(n.from,n.to,be.fromJSON(e,n.slice),!!n.structure)}}tn.jsonID("replace",Ft);class Vt 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&&(Jp(e,this.from,this.gapFrom)||Jp(e,this.gapTo,this.to)))return Nt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Nt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Nt.fromReplace(e,this.from,this.to,r):Nt.fail("Content does not fit in gap")}getMap(){return new Tn([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 Vt(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 Vt(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 Vt(n.from,n.to,n.gapFrom,n.gapTo,be.fromJSON(e,n.slice),n.insert,!!n.structure)}}tn.jsonID("replaceAround",Vt);function Jp(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 t5(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 Gn(f,h,d[m])));a&&a.to==f?a.to=h:s.push(a=new co(f,h,r))}}),o.forEach(l=>t.step(l)),s.forEach(l=>t.step(l))}function n5(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 Cf){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 Gn(i.from,i.to,i.style)))}function Vg(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 Ft(a,u,be.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new Gn(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 be(ae.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),i.push(new Ft(a+f.index,a+f.index+f[0].length,p))}}a=u}if(!r.validEnd){let l=r.fillBefore(ae.empty,!0);t.replace(a,a,new be(l,0,0))}for(let l=i.length-1;l>=0;l--)t.step(i[l])}function r5(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function oa(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||!r5(i,a,l))break;a&&(o=1),l<i.childCount&&(s=1)}return null}function o5(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=ae.empty,d=0;for(let p=s,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,u=ae.from(r.node(p).copy(u)),d++):l--;let f=ae.empty,h=0;for(let p=s,m=!1;p>n;p--)m||o.after(p+1)<o.end(p)?(m=!0,f=ae.from(o.node(p).copy(f)),h++):c++;t.step(new Vt(l,c,i,a,new be(u.append(f),d,h),u.size-d,!0))}function Wg(t,e,n=null,r=t){let o=s5(t,e),s=o&&i5(r,e);return s?o.map(o0).concat({type:e,attrs:n}).concat(s.map(o0)):null}function o0(t){return{type:t,attrs:null}}function s5(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 i5(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 a5(t,e,n){let r=ae.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=ae.from(n[i].type.create(n[i].attrs,r))}let o=e.start,s=e.end;t.step(new Vt(o,s,o,s,new be(r,0,0),n.length,!0))}function l5(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)&&c5(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&&LC(t,i,a,s),Vg(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 Vt(d,f,d+1,f-1,new be(ae.from(r.create(l,null,i.marks)),0,0),1,!0)),c===!0&&jC(t,i,a,s),!1}})}function jC(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 LC(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(`
98
+ `))}})}function c5(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function u5(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 Vt(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new be(ae.from(i),0,0),1,!0))}function Lr(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 d5(t,e,n=1,r){let o=t.doc.resolve(e),s=ae.empty,i=ae.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){s=ae.from(o.node(a).copy(s));let u=r&&r[c];i=ae.from(u?u.type.create(u.attrs,i):o.node(a).copy(i))}t.step(new Ft(e,e,new be(s.append(i),n,n),!0))}function Fo(t,e){let n=t.resolve(e),r=n.index();return FC(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function f5(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 FC(t,e){return!!(t&&e&&!t.isLeaf&&f5(t,e))}function Tf(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&&FC(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 h5(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);LC(t,u.node(),u.before(),a)}i.inlineContent&&Vg(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 Ft(c,l.map(e+n,-1),be.empty,!0)),r===!0){let u=t.doc.resolve(c);jC(t,u.node(),u.before(),t.steps.length)}return t}function p5(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 BC(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 Rf(t,e,n=e,r=be.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),s=t.resolve(n);return VC(o,s,r)?new Ft(e,n,r):new m5(o,s,r).fit()}function VC(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class m5{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ae.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=ae.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 be(s,i,a);return e>-1?new Vt(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Ft(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=Th(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(ae.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=Th(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new be(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=Th(e,n);if(o.childCount<=1&&n>0){let s=e.size-n<=n+o.size;this.unplaced=new be(ka(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new be(ka(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(WC(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=xa(this.placed,n,ae.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?be.empty:new be(ka(i.content,e-1,1),e-1,h<0?i.openEnd:e-1):new be(ka(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||!Rh(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=Rh(e,n,o,r,s);if(i){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=Rh(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=xa(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=xa(this.placed,this.depth,ae.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ae.empty,!0);n.childCount&&(this.placed=xa(this.placed,this.frontier.length,n))}}function ka(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(ka(t.firstChild.content,e-1,n)))}function xa(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(xa(t.lastChild.content,e-1,n)))}function Th(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function WC(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,WC(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(ae.empty,!0)))),t.copy(r)}function Rh(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&&!g5(n,s.content,i)?a:null}function g5(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function y5(t){return t.spec.defining||t.spec.definingForContent}function b5(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),s=t.doc.resolve(n);if(VC(o,s,r))return t.step(new Ft(e,n,r));let i=qC(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=y5(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 be(HC(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 HC(t,e,n,r,o){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(HC(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(ae.empty,!0))}return t}function v5(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=p5(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new be(ae.from(r),0,0))}function w5(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),s=qC(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 qC(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 Mi 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 Nt.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 Nt.fromReplace(e,this.pos,this.pos+1,new be(ae.from(o),0,n.isLeaf?0:1))}getMap(){return Tn.empty}invert(e){return new Mi(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 Mi(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 Mi(n.pos,n.attr,n.value)}}tn.jsonID("attr",Mi);class ol 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 Nt.ok(r)}getMap(){return Tn.empty}invert(e){return new ol(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 ol(n.attr,n.value)}}tn.jsonID("docAttr",ol);let Fi=class extends Error{};Fi=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Fi.prototype=Object.create(Error.prototype);Fi.prototype.constructor=Fi;Fi.prototype.name="TransformError";class UC{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new rl}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Fi(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=be.empty){let o=Rf(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new be(ae.from(r),0,0))}delete(e,n){return this.replace(e,n,be.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return b5(this,e,n,r),this}replaceRangeWith(e,n,r){return v5(this,e,n,r),this}deleteRange(e,n){return w5(this,e,n),this}lift(e,n){return o5(this,e,n),this}join(e,n=1){return h5(this,e,n),this}wrap(e,n){return a5(this,e,n),this}setBlockType(e,n=e,r,o=null){return l5(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return u5(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new Mi(e,n,r)),this}setDocAttribute(e,n){return this.step(new ol(e,n)),this}addNodeMark(e,n){return this.step(new uo(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 ft)n.isInSet(r.marks)&&this.step(new Cs(e,n));else{let o=r.marks,s,i=[];for(;s=n.isInSet(o);)i.push(new Cs(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 d5(this,e,n,r),this}addMark(e,n,r){return t5(this,e,n,r),this}removeMark(e,n,r){return n5(this,e,n,r),this}clearIncompatible(e,n,r){return Vg(this,e,n,r),this}}const Mh=Object.create(null);class We{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new k5(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=be.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?be.empty:n),a==0&&a0(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),a0(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new Ie(e):li(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?li(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):li(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 li(e,e,0,0,1)||new Mn(e)}static atEnd(e){return li(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=Mh[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 Mh)throw new RangeError("Duplicate use of selection JSON ID "+e);return Mh[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Ie.between(this.$anchor,this.$head).getBookmark()}}We.prototype.visible=!0;class k5{constructor(e,n){this.$from=e,this.$to=n}}let s0=!1;function i0(t){!s0&&!t.parent.inlineContent&&(s0=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Ie extends We{constructor(e,n=e){i0(e),i0(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 We.near(r);let o=e.resolve(n.map(this.anchor));return new Ie(o.parent.inlineContent?o:r,r)}replace(e,n=be.empty){if(super.replace(e,n),n==be.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Ie&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Mf(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 Ie(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=We.findFrom(n,r,!0)||We.findFrom(n,-r,!0);if(s)n=s.$head;else return We.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(We.findFrom(e,-r,!0)||We.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new Ie(e,n)}}We.jsonID("text",Ie);class Mf{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Mf(e.map(this.anchor),e.map(this.head))}resolve(e){return Ie.between(e.resolve(this.anchor),e.resolve(this.head))}}class Re extends We{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?We.near(s):new Re(s)}content(){return new be(ae.from(this.node),0,0)}eq(e){return e instanceof Re&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Hg(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Re(e.resolve(n.anchor))}static create(e,n){return new Re(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Re.prototype.visible=!1;We.jsonID("node",Re);class Hg{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Mf(r,r):new Hg(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Re.isSelectable(r)?new Re(n):We.near(n)}}class Mn extends We{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=be.empty){if(n==be.empty){e.delete(0,e.doc.content.size);let r=We.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 x5}}We.jsonID("all",Mn);const x5={map(){return this},resolve(t){return new Mn(t)}};function li(t,e,n,r,o,s=!1){if(e.inlineContent)return Ie.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&&Re.isSelectable(a))return Re.create(t,n-(o<0?a.nodeSize:0))}else{let l=li(t,a,n+o,o<0?a.childCount:0,o,s);if(l)return l}n+=a.nodeSize*o}return null}function a0(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof Ft||o instanceof Vt))return;let s=t.mapping.maps[r],i;s.forEach((a,l,c,u)=>{i==null&&(i=u)}),t.setSelection(We.near(t.doc.resolve(i),n))}const l0=1,lc=2,c0=4;class S5 extends UC{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|l0)&~lc,this.storedMarks=null,this}get selectionSet(){return(this.updated&l0)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=lc,this}ensureMarks(e){return ft.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&lc)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~lc,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)||ft.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(We.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|=c0,this}get scrolledIntoView(){return(this.updated&c0)>0}}function u0(t,e){return!e||!t?t:t.bind(e)}class Sa{constructor(e,n,r){this.name=e,this.init=u0(n.init,r),this.apply=u0(n.apply,r)}}const E5=[new Sa("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Sa("selection",{init(t,e){return t.selection||We.atStart(e.doc)},apply(t){return t.selection}}),new Sa("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Sa("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Oh{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=E5.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 Sa(r.key,r.spec.state,r))})}}class gi{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 gi(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 S5(this)}static create(e){let n=new Oh(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new gi(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 Oh(this.schema,e.plugins),r=n.fields,o=new gi(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 Oh(e.schema,e.plugins),s=new gi(o);return o.fields.forEach(i=>{if(i.name=="doc")s.doc=vo.fromJSON(e.schema,n.doc);else if(i.name=="selection")s.selection=We.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 KC(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=KC(o,e,{})),n[r]=o}return n}class Et{constructor(e){this.spec=e,this.props={},e.props&&KC(e.props,this,this.props),this.key=e.key?e.key.key:YC("plugin")}getState(e){return e[this.key]}}const _h=Object.create(null);function YC(t){return t in _h?t+"$"+ ++_h[t]:(_h[t]=0,t+"$")}class Lt{constructor(e="key"){this.key=YC(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const qg=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function GC(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const ZC=(t,e,n)=>{let r=GC(t,n);if(!r)return!1;let o=Ug(r);if(!o){let i=r.blockRange(),a=i&&oa(i);return a==null?!1:(e&&e(t.tr.lift(i,a).scrollIntoView()),!0)}let s=o.nodeBefore;if(sT(t,o,e,-1))return!0;if(r.parent.content.size==0&&(Bi(s,"end")||Re.isSelectable(s)))for(let i=r.depth;;i--){let a=Rf(t.doc,r.before(i),r.after(i),be.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(Bi(s,"end")?We.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):Re.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},C5=(t,e,n)=>{let r=GC(t,n);if(!r)return!1;let o=Ug(r);return o?JC(t,o,e):!1},T5=(t,e,n)=>{let r=QC(t,n);if(!r)return!1;let o=Kg(r);return o?JC(t,o,e):!1};function JC(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=Rf(t.doc,s,l,be.empty);if(!c||c.from!=s||c instanceof Ft&&c.slice.size>=l-s)return!1;if(n){let u=t.tr.step(c);u.setSelection(Ie.create(u.doc,s)),n(u.scrollIntoView())}return!0}function Bi(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 XC=(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=Ug(r)}let i=s&&s.nodeBefore;return!i||!Re.isSelectable(i)?!1:(e&&e(t.tr.setSelection(Re.create(t.doc,s.pos-i.nodeSize)).scrollIntoView()),!0)};function Ug(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 QC(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const eT=(t,e,n)=>{let r=QC(t,n);if(!r)return!1;let o=Kg(r);if(!o)return!1;let s=o.nodeAfter;if(sT(t,o,e,1))return!0;if(r.parent.content.size==0&&(Bi(s,"start")||Re.isSelectable(s))){let i=Rf(t.doc,r.before(),r.after(),be.empty);if(i&&i.slice.size<i.to-i.from){if(e){let a=t.tr.step(i);a.setSelection(Bi(s,"start")?We.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):Re.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},tT=(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=Kg(r)}let i=s&&s.nodeAfter;return!i||!Re.isSelectable(i)?!1:(e&&e(t.tr.setSelection(Re.create(t.doc,s.pos)).scrollIntoView()),!0)};function Kg(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 R5=(t,e)=>{let n=t.selection,r=n instanceof Re,o;if(r){if(n.node.isTextblock||!Fo(t.doc,n.from))return!1;o=n.from}else if(o=Tf(t.doc,n.from,-1),o==null)return!1;if(e){let s=t.tr.join(o);r&&s.setSelection(Re.create(s.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},M5=(t,e)=>{let n=t.selection,r;if(n instanceof Re){if(n.node.isTextblock||!Fo(t.doc,n.to))return!1;r=n.to}else if(r=Tf(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},O5=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),s=o&&oa(o);return s==null?!1:(e&&e(t.tr.lift(o,s).scrollIntoView()),!0)},nT=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
99
+ `).scrollIntoView()),!0)};function Yg(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 _5=(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=Yg(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(We.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},rT=(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=Yg(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(Ie.create(a.doc,i+1)),e(a.scrollIntoView())}return!0},oT=(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(Lr(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),o=r&&oa(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function N5(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof Re&&e.selection.node.isBlock)return!r.parentOffset||!Lr(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=Yg(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 Ie||e.selection instanceof Mn)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Lr(u.doc,d,s.length,s);if(f||(s[0]=a?{type:a}:null,f=Lr(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 P5=N5(),$5=(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(Re.create(t.doc,o))),!0)};function A5(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||Fo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function sT(t,e,n,r){let o=e.nodeBefore,s=e.nodeAfter,i,a,l=o.type.spec.isolating||s.type.spec.isolating;if(!l&&A5(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=ae.empty;for(let y=i.length-1;y>=0;y--)p=ae.from(i[y].create(null,p));p=ae.from(o.copy(p));let m=t.tr.step(new Vt(e.pos-1,h,e.pos,h,new be(p,1,0),i.length,!0)),g=m.doc.resolve(h+2*i.length);g.nodeAfter&&g.nodeAfter.type==o.type&&Fo(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&l?null:We.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&oa(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&Bi(s,"start",!0)&&Bi(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=ae.empty;for(let w=p.length-1;w>=0;w--)y=ae.from(p[w].copy(y));let b=t.tr.step(new Vt(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new be(y,p.length,0),0,!0));n(b.scrollIntoView())}return!0}}return!1}function iT(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(Ie.create(e.doc,t<0?o.start(s):o.end(s)))),!0):!1}}const I5=iT(-1),D5=iT(1);function z5(t,e=null){return function(n,r){let{$from:o,$to:s}=n.selection,i=o.blockRange(s),a=i&&Wg(i,t,e);return a?(r&&r(n.tr.wrap(i,a).scrollIntoView()),!0):!1}}function d0(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 Gg(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}Gg(qg,ZC,XC);Gg(qg,eT,tT);Gg(nT,rT,oT,P5);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function j5(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 L5(a,i,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function L5(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 id(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new id(e.$from,i.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let a=Wg(s,n,r,e);return a?(t&&F5(t,e,a,o,n),!0):!1}function F5(t,e,n,r,o){let s=ae.empty;for(let u=n.length-1;u>=0;u--)s=ae.from(n[u].type.create(n[u].attrs,s));t.step(new Vt(e.start-(r?2:0),e.end,e.start,e.end,new be(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&&Lr(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function B5(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?V5(e,n,t,s):W5(e,n,s):!0:!1}}function V5(t,e,n,r){let o=t.tr,s=r.end,i=r.$to.end(r.depth);s<i&&(o.step(new Vt(s-1,i,s,i,new be(ae.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new id(o.doc.resolve(r.$from.pos),o.doc.resolve(i),r.depth));const a=oa(r);if(a==null)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(s,-1)-1);return Fo(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos),e(o.scrollIntoView()),!0}function W5(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?ae.empty:ae.from(o))))return!1;let d=s.pos,f=d+i.nodeSize;return r.step(new Vt(d-(a?1:0),f+(l?1:0),d+1,f-1,new be((a?ae.empty:ae.from(o.copy(ae.empty))).append(l?ae.empty:ae.from(o.copy(ae.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function H5(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=ae.from(c?t.create():null),d=new be(ae.from(t.create(null,ae.from(a.type.create(null,u)))),c?3:1,0),f=s.start,h=s.end;n(e.tr.step(new Vt(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},Vi=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Xp=null;const $r=function(t,e,n){let r=Xp||(Xp=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},q5=function(){Xp=null},Ts=function(t,e,n,r){return n&&(f0(t,e,n,r,-1)||f0(t,e,n,r,1))},U5=/^(img|br|input|textarea|hr)$/i;function f0(t,e,n,r,o){for(var s;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Dn(t))){let i=t.parentNode;if(!i||i.nodeType!=1||Cl(t)||U5.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?Dn(t):0}else return!1}}function Dn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function K5(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=Dn(t)}else if(t.parentNode&&!Cl(t))e=Kt(t),t=t.parentNode;else return null}}function Y5(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&&!Cl(t))e=Kt(t)+1,t=t.parentNode;else return null}}function G5(t,e,n){for(let r=e==0,o=e==Dn(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==Dn(t)}}function Cl(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 Of=function(t){return t.focusNode&&Ts(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Xo(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Z5(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function J5(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Dn(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Dn(r.startContainer),r.startOffset)}}}const pr=typeof navigator<"u"?navigator:null,h0=typeof document<"u"?document:null,Bo=pr&&pr.userAgent||"",Qp=/Edge\/(\d+)/.exec(Bo),aT=/MSIE \d/.exec(Bo),em=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Bo),bn=!!(aT||em||Qp),ko=aT?document.documentMode:em?+em[1]:Qp?+Qp[1]:0,jn=!bn&&/gecko\/(\d+)/i.test(Bo);jn&&+(/Firefox\/(\d+)/.exec(Bo)||[0,0])[1];const tm=!bn&&/Chrome\/(\d+)/.exec(Bo),Gt=!!tm,lT=tm?+tm[1]:0,Qt=!bn&&!!pr&&/Apple Computer/.test(pr.vendor),Wi=Qt&&(/Mobile\/\w+/.test(Bo)||!!pr&&pr.maxTouchPoints>2),In=Wi||(pr?/Mac/.test(pr.platform):!1),cT=pr?/Win/.test(pr.platform):!1,Ar=/Android \d/.test(Bo),Tl=!!h0&&"webkitFontSmoothing"in h0.documentElement.style,X5=Tl?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Q5(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 Cr(t,e){return typeof t=="number"?t:t[e]}function eV(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 p0(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=Vi(i);continue}let a=i,l=a==s.body,c=l?Q5(s):eV(a),u=0,d=0;if(e.top<c.top+Cr(r,"top")?d=-(c.top-e.top+Cr(o,"top")):e.bottom>c.bottom-Cr(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Cr(o,"top")-c.top:e.bottom-c.bottom+Cr(o,"bottom")),e.left<c.left+Cr(r,"left")?u=-(c.left-e.left+Cr(o,"left")):e.right>c.right-Cr(r,"right")&&(u=e.right-c.right+Cr(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:Vi(i)}}function tV(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:uT(t.dom)}}function uT(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Vi(r));return e}function nV({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;dT(n,r==0?0:r-e)}function dT(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 Gs=null;function rV(t){if(t.setActive)return t.setActive();if(Gs)return t.focus(Gs);let e=uT(t);t.focus(Gs==null?{get preventScroll(){return Gs={preventScroll:!0},!0}}:void 0),Gs||(Gs=!1,dT(e,0))}function fT(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=$r(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?oV(n,o):!n||r&&n.nodeType==1?{node:t,offset:s}:fT(n,o)}function oV(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=no(r,1);if(i.top!=i.bottom&&Zg(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 Zg(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function sV(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function iV(t,e,n){let{node:r,offset:o}=fT(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 aV(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 hT(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(Zg(e,c))return hT(i,e,c)}}if((s=(s+1)%r)==o)break}return t}function lV(t,e){let n=t.dom.ownerDocument,r,o=0,s=J5(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(!Zg(e,c)||(i=hT(t.dom,e,c),!i))return null}if(Qt)for(let c=i;r&&c;c=Vi(c))c.draggable&&(r=void 0);if(i=sV(i,e),r){if(jn&&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;Tl&&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=aV(t,r,o,e))}a==null&&(a=iV(t,i,e));let l=t.docView.nearestDesc(i,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function m0(t){return t.top<t.bottom||t.left<t.right}function no(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(m0(r))return r}return Array.prototype.find.call(n,m0)||t.getBoundingClientRect()}const cV=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function pT(t,e,n){let{node:r,offset:o,atom:s}=t.docView.domFromPos(e,n<0?-1:1),i=Tl||jn;if(r.nodeType==3)if(i&&(cV.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let l=no($r(r,o,o),n);if(jn&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=no($r(r,o-1,o-1),-1);if(c.top==l.top){let u=no($r(r,o,o+1),-1);if(u.top!=l.top)return la(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++,la(no($r(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&o&&(n<0||o==Dn(r))){let l=r.childNodes[o-1];if(l.nodeType==1)return Nh(l.getBoundingClientRect(),!1)}if(s==null&&o<Dn(r)){let l=r.childNodes[o];if(l.nodeType==1)return Nh(l.getBoundingClientRect(),!0)}return Nh(r.getBoundingClientRect(),n>=0)}if(s==null&&o&&(n<0||o==Dn(r))){let l=r.childNodes[o-1],c=l.nodeType==3?$r(l,Dn(l)-(i?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return la(no(c,1),!1)}if(s==null&&o<Dn(r)){let l=r.childNodes[o];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?$r(l,0,i?0:1):l.nodeType==1?l:null:null;if(c)return la(no(c,-1),!0)}return la(no(r.nodeType==3?$r(r):r,-n),n>=0)}function la(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 Nh(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 mT(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 uV(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return mT(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=pT(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=$r(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 dV=/[\u0590-\u08ac]/;function fV(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?!dV.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:i:mT(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 g0=null,y0=null,b0=!1;function hV(t,e,n){return g0==e&&y0==n?b0:(g0=e,y0=n,b0=n=="up"||n=="down"?uV(t,e,n):fV(t,e,n))}const Ln=0,v0=1,ns=2,mr=3;class Rl{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 yT){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 gT&&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((jn||Qt)&&e==n){let{node:h,offset:p}=a;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
100
+ `),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(jn&&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)&&Ts(a.node,a.offset,u.anchorNode,u.anchorOffset)&&Ts(l.node,l.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(d&&jn)){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?ns:v0,e==a&&n==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=mr:s.markDirty(e-a,n-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?ns:mr}r=i}this.dirty=ns}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?ns:v0;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class gT extends Rl{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 pV extends Rl{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 Rs extends Rl{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=Ls.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Rs(e,n,i.dom,i.contentDOM||i.dom,i)}parseRule(){return this.dirty&mr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=mr&&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=Rs.create(this.parent,this.mark,!0,r),s=this.children,i=this.size;n<i&&(s=rm(s,n,i,r)),e>0&&(s=rm(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 xo extends Rl{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}=Ls.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=wT(u,r,n),c?l=new mV(e,n,r,o,u,d||null,f,c,s,i+1):n.isText?new _f(e,n,r,o,u,f,s):new xo(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=()=>ae.empty)}return e}matchesNode(e,n,r){return this.dirty==Ln&&e.eq(this.node)&&ld(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 yV(this,i&&i.node,e);wV(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?ft.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==ns)&&(i&&this.protectLocalComposition(e,i),bT(this.contentDOM,this.children,e),Wi&&kV(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof Ie)||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=xV(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 pV(this,s,n,o);e.input.compositionNodes.push(i),this.children=rm(this.children,r,r+o.length,e,i)}update(e,n,r,o){return this.dirty==mr||!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(ld(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=vT(this.dom,this.nodeDOM,nm(this.outerDeco,this.node,n),nm(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 w0(t,e,n,r,o){wT(r,e,t);let s=new xo(void 0,t,e,n,r,r,r,o,0);return s.contentDOM&&s.updateChildren(o,0),s}class _f extends xo{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==mr||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 _f(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=mr)}get domAtom(){return!1}isText(e){return this.node.text==e}}class yT extends Rl{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 mV extends xo{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==mr)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 bT(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=k0(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(a,r);if(i instanceof Rs){let l=r?r.previousSibling:t.lastChild;bT(i.contentDOM,i.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=k0(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const Ia=function(t){t&&(this.nodeName=t)};Ia.prototype=Object.create(null);const rs=[new Ia];function nm(t,e,n){if(t.length==0)return rs;let r=n?rs[0]:new Ia,o=[r];for(let s=0;s<t.length;s++){let i=t[s].type.attrs;if(i){i.nodeName&&o.push(r=new Ia(i.nodeName));for(let a in i){let l=i[a];l!=null&&(n&&o.length==1&&o.push(r=new Ia(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 vT(t,e,n,r){if(n==rs&&r==rs)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=rs[0]),o=l}gV(o,a||rs[0],i)}return o}function gV(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 wT(t,e,n){return vT(t,t,rs,nm(e,n,t.nodeType!=1))}function ld(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 k0(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class yV{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=bV(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=Rs.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==mr&&i.dom==i.contentDOM&&(i.dirty=ns),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 xo){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!=mr&&ld(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=ns,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)||!ld(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let a=xo.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=xo.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 gT(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 Rs;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof _f)||/\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 yT(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 bV(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 Rs)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 vV(t,e){return t.type.side-e.type.side}function wV(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(vV);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 kV(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 xV(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 rm(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 Jg(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(Of(n)){for(l=i;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&Re.isSelectable(d)&&o.parent&&!(d.isInline&&G5(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;c=new Re(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=Xg(t,u,a,d)}return c}function kT(t){return t.editable?t.hasFocus():ST(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Fr(t,e=!1){let n=t.state.selection;if(xT(t,n),!!kT(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Gt){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&Ts(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)EV(t);else{let{anchor:r,head:o}=n,s,i;x0&&!(n instanceof Ie)&&(n.$from.parent.inlineContent||(s=S0(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(i=S0(t,n.to))),t.docView.setSelection(r,o,t,e),x0&&(s&&E0(s),i&&E0(i)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&SV(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const x0=Qt||Gt&&lT<63;function S0(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 Ph(o);if((!o||o.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(o)return Ph(o);if(s)return Ph(s)}}function Ph(t){return t.contentEditable="true",Qt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function E0(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function SV(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(()=>{(!kT(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function EV(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&&ko<=11&&(n.disabled=!0,n.disabled=!1)}function xT(t,e){if(e instanceof Re){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(C0(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else C0(t)}function C0(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Xg(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||Ie.between(e,n,r)}function T0(t){return t.editable&&!t.hasFocus()?!1:ST(t)}function ST(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 CV(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Ts(e.node,e.offset,n.anchorNode,n.anchorOffset)}function om(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&&We.findFrom(s,e)}function ro(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function R0(t,e,n){let r=t.state.selection;if(r instanceof Ie)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 ro(t,new Ie(r.$anchor,i))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=om(t.state,e);return o&&o instanceof Re?ro(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?Re.isSelectable(s)?ro(t,new Re(e<0?t.state.doc.resolve(o.pos-s.nodeSize):o)):Tl?ro(t,new Ie(t.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Re&&r.node.isInline)return ro(t,new Ie(e>0?r.$to:r.$from));{let o=om(t.state,e);return o?ro(t,o):!1}}}function cd(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Da(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Zs(t,e){return e<0?TV(t):RV(t)}function TV(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,s,i=!1;for(jn&&n.nodeType==1&&r<cd(n)&&Da(n.childNodes[r],-1)&&(i=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Da(a,-1))o=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(ET(n))break;{let a=n.previousSibling;for(;a&&Da(a,-1);)o=n.parentNode,s=Kt(a),a=a.previousSibling;if(a)n=a,r=cd(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}i?sm(t,n,r):o&&sm(t,o,s)}function RV(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=cd(n),s,i;for(;;)if(r<o){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Da(a,1))s=n,i=++r;else break}else{if(ET(n))break;{let a=n.nextSibling;for(;a&&Da(a,1);)s=a.parentNode,i=Kt(a)+1,a=a.nextSibling;if(a)n=a,r=0,o=cd(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}s&&sm(t,s,i)}function ET(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function MV(t,e){for(;t&&e==t.childNodes.length&&!Cl(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 OV(t,e){for(;t&&!e&&!Cl(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 sm(t,e,n){if(e.nodeType!=3){let s,i;(i=MV(e,n))?(e=i,n=0):(s=OV(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Of(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&&Fr(t)},50)}function M0(t,e){let n=t.state.doc.resolve(e);if(!(Gt||cT)&&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 O0(t,e,n){let r=t.state.selection;if(r instanceof Ie&&!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=om(t.state,e);if(i&&i instanceof Re)return ro(t,i)}if(!o.parent.inlineContent){let i=e<0?o:s,a=r instanceof Mn?We.near(i,e):We.findFrom(i,e);return a?ro(t,a):!1}return!1}function _0(t,e){if(!(t.state.selection instanceof Ie))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 N0(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function _V(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;N0(t,r,"true"),setTimeout(()=>N0(t,r,"false"),20)}return!1}function NV(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function PV(t,e){let n=e.keyCode,r=NV(e);if(n==8||In&&n==72&&r=="c")return _0(t,-1)||Zs(t,-1);if(n==46&&!e.shiftKey||In&&n==68&&r=="c")return _0(t,1)||Zs(t,1);if(n==13||n==27)return!0;if(n==37||In&&n==66&&r=="c"){let o=n==37?M0(t,t.state.selection.from)=="ltr"?-1:1:-1;return R0(t,o,r)||Zs(t,o)}else if(n==39||In&&n==70&&r=="c"){let o=n==39?M0(t,t.state.selection.from)=="ltr"?1:-1:1;return R0(t,o,r)||Zs(t,o)}else{if(n==38||In&&n==80&&r=="c")return O0(t,-1,r)||Zs(t,-1);if(n==40||In&&n==78&&r=="c")return _V(t)||O0(t,1,r)||Zs(t,1);if(r==(In?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Qg(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")||Ls.fromSchema(t.state.schema),a=_T(),l=a.createElement("div");l.appendChild(i.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=OT[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,`
101
+
102
+ `);return{dom:l,text:f,slice:e}}function CT(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 be(ae.from(t.state.schema.text(e.replace(/\r\n?/g,`
103
+ `))),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=Ls.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=DV(n),Tl&&zV(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")||wo.fromSchema(t.state.schema)).parseSlice(i,{preserveWhitespace:!!(l||u),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!$V.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=jV(P0(a,+u[1],+u[2]),u[4]);else if(a=be.maxOpen(AV(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=P0(a,d,f)}return t.someProp("transformPasted",d=>{a=d(a,t,l)}),a}const $V=/^(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 AV(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&&RT(l,s,a,i[i.length-1],0))i[i.length-1]=c;else{i.length&&(i[i.length-1]=MT(i[i.length-1],s.length));let u=TT(a,l);i.push(u),o=o.matchType(u.type),s=l}}),i)return ae.from(i)}return t}function TT(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,ae.from(t));return t}function RT(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let s=RT(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(ae.from(TT(n,t,o+1))))}}function MT(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,MT(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(ae.empty,!0);return t.copy(n.append(r))}function im(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=im(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(ae.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,i.copy(a))}function P0(t,e,n){return e<t.openStart&&(t=new be(im(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new be(im(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const OT={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 $0=null;function _T(){return $0||($0=document.implementation.createHTMLDocument("title"))}let $h=null;function IV(t){let e=window.trustedTypes;return e?($h||($h=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),$h.createHTML(t)):t}function DV(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=_T().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&OT[r[1].toLowerCase()])&&(t=o.map(s=>"<"+s+">").join("")+t+o.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=IV(t),o)for(let s=0;s<o.length;s++)n=n.querySelector(o[s])||n;return n}function zV(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 jV(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=ae.from(l.create(r[a+1],o)),s++,i++}return new be(o,s,i)}const cn={},un={},LV={touchstart:!0,touchmove:!0};class FV{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 BV(t){for(let e in cn){let n=cn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{WV(t,r)&&!ey(t,r)&&(t.editable||!(r.type in un))&&n(t,r)},LV[e]?{passive:!0}:void 0)}Qt&&t.dom.addEventListener("input",()=>null),am(t)}function fo(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function VV(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 am(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>ey(t,r))})}function ey(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function WV(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 HV(t,e){!ey(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,!PT(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ar&&Gt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Wi&&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,Xo(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||PV(t,n)?n.preventDefault():fo(t,"key")};un.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};un.keypress=(t,e)=>{let n=e;if(PT(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 Ie)||!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 Nf(t){return{left:t.clientX,top:t.clientY}}function qV(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function ty(t,e,n,r,o){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let i=s.depth+1;i>0;i--)if(t.someProp(e,a=>i>s.depth?a(t,n,s.nodeAfter,s.before(i),o,!0):a(t,n,s.node(i),s.before(i),o,!1)))return!0;return!1}function Oi(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function UV(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Re.isSelectable(r)?(Oi(t,new Re(n)),!0):!1}function KV(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof Re&&(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(Re.isSelectable(a)){r&&n.$from.depth>0&&i>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?o=s.before(n.$from.depth):o=s.before(i);break}}return o!=null?(Oi(t,Re.create(t.state.doc,o)),!0):!1}function YV(t,e,n,r,o){return ty(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(o?KV(t,n):UV(t,n))}function GV(t,e,n,r){return ty(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function ZV(t,e,n,r){return ty(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||JV(t,n,r)}function JV(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Oi(t,Ie.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let s=o.depth+1;s>0;s--){let i=s>o.depth?o.nodeAfter:o.node(s),a=o.before(s);if(i.inlineContent)Oi(t,Ie.create(r,a+1,a+1+i.content.size));else if(Re.isSelectable(i))Oi(t,Re.create(r,a));else continue;return!0}}function ny(t){return ud(t)}const NT=In?"metaKey":"ctrlKey";cn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=ny(t),o=Date.now(),s="singleClick";o-t.input.lastClick.time<500&&qV(n,t.input.lastClick)&&!n[NT]&&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(Nf(n));i&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new XV(t,i,n,!!r)):(s=="doubleClick"?GV:ZV)(t,i.pos,i.inside,n)?n.preventDefault():fo(t,"pointer"))};class XV{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[NT],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 Re&&c.from<=i&&c.to>i)&&(this.mightDrag={node:s,pos:i,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&jn&&!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)),fo(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(()=>Fr(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(Nf(e))),this.updateAllowDefault(e),this.allowDefault||!n?fo(this.view,"pointer"):YV(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)?(Oi(this.view,We.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):fo(this.view,"pointer")}move(e){this.updateAllowDefault(e),fo(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(),ny(t),fo(t,"pointer")};cn.touchmove=t=>{t.input.lastTouch=Date.now(),fo(t,"pointer")};cn.contextmenu=t=>ny(t);function PT(t,e){return t.composing?!0:Qt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const QV=Ar?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 Ie&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Gt&&cT&&eW(t)))t.markCursor=t.state.storedMarks||n.marks(),ud(t,!0),t.markCursor=null;else if(ud(t,!e.selection.empty),jn&&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}$T(t,QV)};function eW(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++,$T(t,20))};function $T(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ud(t),e))}function AT(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=nW());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function tW(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=K5(e.focusNode,e.focusOffset),r=Y5(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 nW(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function ud(t,e=!1){if(!(Ar&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),AT(t),e||t.docView&&t.docView.dirty){let n=Jg(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 rW(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 sl=bn&&ko<15||Wi&&X5<604;cn.copy=un.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let s=sl?null:n.clipboardData,i=r.content(),{dom:a,text:l}=Qg(t,i);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):rW(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function oW(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function sW(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?il(t,r.value,null,o,e):il(t,r.textContent,r.innerHTML,o,e)},50)}function il(t,e,n,r,o){let s=CT(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,o,s||be.empty)))return!0;if(!s)return!1;let i=oW(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 IT(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&&!Ar)return;let r=sl?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&il(t,IT(r),r.getData("text/html"),o,n)?n.preventDefault():sW(t,n)};class DT{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const iW=In?"altKey":"ctrlKey";function zT(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[iW]}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(Nf(n)),i;if(!(s&&s.pos>=o.from&&s.pos<=(o instanceof Re?o.to-1:o.to))){if(r&&r.mightDrag)i=Re.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=Re.create(t.state.doc,d.posBefore))}}let a=(i||t.state.selection).content(),{dom:l,text:c,slice:u}=Qg(t,a);(!n.dataTransfer.files.length||!Gt||lT>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(sl?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",sl||n.dataTransfer.setData("text/plain",c),t.dragging=new DT(u,zT(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{aW(t,e,t.dragging)}finally{t.dragging=null}};function aW(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Nf(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=CT(t,IT(e.dataTransfer),sl?null:e.dataTransfer.getData("text/html"),!1,o);let i=!!(n&&zT(t,e));if(t.someProp("handleDrop",h=>h(t,e,s||be.empty,i))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?BC(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&&Re.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new Re(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(Xg(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())&&Fr(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&&Ar&&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,Xo(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 al(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 dd{constructor(e,n){this.toDOM=e,this.spec=n||fs,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 dd&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&al(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class So{constructor(e,n){this.attrs=e,this.spec=n||fs}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 So&&al(this.attrs,e.attrs)&&al(this.spec,e.spec)}static is(e){return e.type instanceof So}destroy(){}}class ry{constructor(e,n){this.attrs=e,this.spec=n||fs}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 ry&&al(this.attrs,e.attrs)&&al(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 dd(n,r))}static inline(e,n,r,o){return new sn(e,n,new So(r,o))}static node(e,n,r,o){return new sn(e,n,new ry(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof So}get widget(){return this.type instanceof dd}}const ci=[],fs={};class kt{constructor(e,n){this.local=e.length?e:ci,this.children=n.length?n:ci}static create(e,n){return n.length?fd(n,e,0,fs):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||fs)}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?lW(this.children,i||[],e,n,r,o,s):i?new kt(i.sort(hs),ci):Zt}add(e,n){return n.length?this==Zt?kt.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=LT(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,fd(u,a,c+1,fs)),s+=3}});let i=jT(s?FT(n):n,-r);for(let a=0;a<i.length;a++)i[a].type.valid(e,i[a])||i.splice(a--,1);return new kt(i.length?this.local.concat(i).sort(hs):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 kt(o,r):Zt}forChild(e,n){if(this==Zt)return this;if(n.isLeaf)return kt.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 So){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 kt(o.sort(hs),ci);return r?new io([a,r]):a}return r||Zt}eq(e){if(this==e)return!0;if(!(e instanceof kt)||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 oy(this.localsInner(e))}localsInner(e){if(this==Zt)return ci;if(e.inlineContent||!this.local.some(So.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof So||n.push(this.local[r]);return n}forEachSet(e){e(this)}}kt.empty=new kt([],[]);kt.removeOverlap=oy;const Zt=kt.empty;class io{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,fs));return io.from(r)}forChild(e,n){if(n.isLeaf)return kt.empty;let r=[];for(let o=0;o<this.members.length;o++){let s=this.members[o].forChild(e,n);s!=Zt&&(s instanceof io?r=r.concat(s.members):r.push(s))}return io.from(r)}eq(e){if(!(e instanceof io)||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?oy(r?n:n.sort(hs)):ci}static from(e){switch(e.length){case 0:return Zt;case 1:return e[0];default:return new io(e.every(n=>n instanceof kt)?e:e.reduce((n,r)=>n.concat(r instanceof kt?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function lW(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=cW(a,t,e,n,o,s,i),u=fd(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 kt(e.sort(hs),a)}function jT(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 cW(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 LT(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 FT(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function fd(t,e,n,r){let o=[],s=!1;e.forEach((a,l)=>{let c=LT(t,a,l+n);if(c){s=!0;let u=fd(c,a,n+l+1,r);u!=Zt&&o.push(l,l+a.nodeSize,u)}});let i=jT(s?FT(t):t,-n).sort(hs);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 kt(i,o):Zt}function hs(t,e){return t.from-e.from||t.to-e.to}function oy(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),A0(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),A0(e,o,r.copy(s.from,r.to)));break}}}return e}function A0(t,e,n){for(;e<t.length&&hs(n,t[e])>0;)e++;t.splice(e,0,n)}function Ah(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Zt&&e.push(r)}),t.cursorWrapper&&e.push(kt.create(t.state.doc,[t.cursorWrapper.deco])),io.from(e)}const uW={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},dW=bn&&ko<=11;let fW=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 hW{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new fW,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&&ko<=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()}),dW&&(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,uW)),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(T0(this.view)){if(this.suppressingSelectionUpdates)return Fr(this.view);if(bn&&ko<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ts(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=Vi(s))n.add(s);for(let s=e.anchorNode;s;s=Vi(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)&&T0(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(jn&&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||gW(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&&Of(r)&&(c=Jg(e))&&c.eq(We.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Fr(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||o)&&(s>-1&&(e.docView.markDirty(s,i),pW(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,yW(e,l)),this.handleDOMChange(s,i,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Fr(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&&ko<=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 I0=new WeakMap,D0=!1;function pW(t){if(!I0.has(t)&&(I0.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=jn,D0)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."),D0=!0}}function z0(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,s=e.endOffset,i=t.domAtPos(t.state.selection.anchor);return Ts(i.node,i.offset,o,s)&&([n,r,o,s]=[o,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:s}}function mW(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return z0(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?z0(t,n):null}function gW(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 yW(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 bW(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}],Of(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")||wo.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:vW,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 vW(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 wW=/^(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 kW(t,e,n,r,o){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let E=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,M=Jg(t,E);if(M&&!t.state.selection.eq(M)){if(Gt&&Ar&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",F=>F(t,Xo(13,"Enter"))))return;let D=t.state.tr.setSelection(M);E=="pointer"?D.setMeta("pointer",!0):E=="key"&&D.scrollIntoView(),s&&D.setMeta("composition",s),t.dispatch(D)}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=bW(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=EW(d.content,c.doc.content,c.from,f,h);if(p&&t.input.domChangeCount++,(Wi&&t.input.lastIOSEnter>Date.now()-225||Ar)&&o.some(E=>E.nodeType==1&&!wW.test(E.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",E=>E(t,Xo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof Ie&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let E=j0(t,t.state.doc,c.sel);if(E&&!E.eq(t.state.selection)){let M=t.state.tr.setSelection(E);s&&M.setMeta("composition",s),t.dispatch(M)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof Ie&&(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&&ko<=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((Wi&&t.input.lastIOSEnter>Date.now()-225&&(!b||o.some(E=>E.nodeName=="DIV"||E.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",E=>E(t,Xo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&SW(u,p.start,p.endA,m,g)&&t.someProp("handleKeyDown",E=>E(t,Xo(8,"Backspace")))){Ar&&Gt&&t.domObserver.suppressSelectionUpdates();return}Gt&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),Ar&&!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(E){return E(t,Xo(13,"Enter"))})},20));let w=p.start,k=p.endA,v=E=>{let M=E||t.state.tr.replace(w,k,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let D=j0(t,M.doc,c.sel);D&&!(Gt&&t.composing&&D.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(D.head==w||D.head==M.mapping.map(k)-1)||bn&&D.empty&&D.head==w)&&M.setSelection(D)}return s&&M.setMeta("composition",s),M.scrollIntoView()},S;if(b)if(m.pos==g.pos){bn&&ko<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Fr(t),20));let E=v(t.state.tr.delete(w,k)),M=u.resolve(p.start).marksAcross(u.resolve(p.endA));M&&E.ensureMarks(M),t.dispatch(E)}else if(p.endA==p.endB&&(S=xW(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let E=v(t.state.tr);S.type=="add"?E.addMark(w,k,S.mark):E.removeMark(w,k,S.mark),t.dispatch(E)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let E=m.parent.textBetween(m.parentOffset,g.parentOffset),M=()=>v(t.state.tr.insertText(E,w,k));t.someProp("handleTextInput",D=>D(t,w,k,E,M))||t.dispatch(M())}else t.dispatch(v());else t.dispatch(v())}function j0(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Xg(t,e.resolve(n.anchor),e.resolve(n.head))}function xW(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(ae.from(c).eq(t))return{mark:a,type:i}}function SW(t,e,n,r,o){if(n-e<=o.pos-r.pos||Ih(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(Ih(s,!0,!0));return!i.parent.isTextblock||i.pos>n||Ih(i,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(i.parent.content)}function Ih(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 EW(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&&L0(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&&L0(t.textBetween(s-1,s+1))&&(s+=l?1:-1),i=s+(i-a),a=s}return{start:s,endA:i,endB:a}}function L0(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 BT{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 FV,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(H0),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=V0(this),B0(this),this.nodeViews=W0(this),this.docView=w0(this.state.doc,F0(this),Ah(this),this.dom,this),this.domObserver=new hW(this,(r,o,s,i)=>kW(this,r,o,s,i)),this.domObserver.start(),BV(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&&am(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(H0),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&&(AT(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=W0(this);TW(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&am(this),this.editable=V0(this),B0(this);let l=Ah(this),c=F0(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&&tV(this);if(i){this.domObserver.stop();let h=d&&(bn||Gt)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&CW(o.selection,e.selection);if(d){let p=Gt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=tW(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=w0(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())&&CV(this))?Fr(this,h):(xT(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&&nV(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 Re){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&p0(this,n.getBoundingClientRect(),e)}else p0(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 DT(e.slice,e.move,o<0?void 0:Re.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&&rV(this.dom),Fr(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 lV(this,e)}coordsAtPos(e,n=1){return pT(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 hV(this,n||this.state,e)}pasteHTML(e,n){return il(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return il(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Qg(this,e)}destroy(){this.docView&&(VV(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ah(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,q5())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return HV(this,e)}domSelectionRange(){let e=this.domSelection();return e?Qt&&this.root.nodeType===11&&Z5(this.dom.ownerDocument)==this.dom&&mW(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}BT.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function F0(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 B0(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 V0(t){return!t.someProp("editable",e=>e(t.state)===!1)}function CW(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 W0(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 TW(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 H0(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 Oo={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:"'"},hd={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},RW=typeof navigator<"u"&&/Mac/.test(navigator.platform),MW=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Yt=0;Yt<10;Yt++)Oo[48+Yt]=Oo[96+Yt]=String(Yt);for(var Yt=1;Yt<=24;Yt++)Oo[Yt+111]="F"+Yt;for(var Yt=65;Yt<=90;Yt++)Oo[Yt]=String.fromCharCode(Yt+32),hd[Yt]=String.fromCharCode(Yt);for(var Dh in Oo)hd.hasOwnProperty(Dh)||(hd[Dh]=Oo[Dh]);function OW(t){var e=RW&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||MW&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?hd:Oo)[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 _W=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),NW=typeof navigator<"u"&&/Win/.test(navigator.platform);function PW(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))_W?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 $W(t){let e=Object.create(null);for(let n in t)e[PW(n)]=t[n];return e}function zh(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 AW(t){return new Et({props:{handleKeyDown:VT(t)}})}function VT(t){let e=$W(t);return function(n,r){let o=OW(r),s,i=e[zh(o,r)];if(i&&i(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=e[zh(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(NW&&r.ctrlKey&&r.altKey)&&(s=Oo[r.keyCode])&&s!=o){let a=e[zh(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var IW=Object.defineProperty,sy=(t,e)=>{for(var n in e)IW(t,n,{get:e[n],enumerable:!0})};function Pf(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 $f=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:Pf({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}},WT={};sy(WT,{blur:()=>DW,clearContent:()=>zW,clearNodes:()=>jW,command:()=>LW,createParagraphNear:()=>FW,cut:()=>BW,deleteCurrentNode:()=>VW,deleteNode:()=>WW,deleteRange:()=>HW,deleteSelection:()=>qW,enter:()=>UW,exitCode:()=>KW,extendMarkRange:()=>YW,first:()=>GW,focus:()=>JW,forEach:()=>XW,insertContent:()=>QW,insertContentAt:()=>nH,joinBackward:()=>sH,joinDown:()=>oH,joinForward:()=>iH,joinItemBackward:()=>aH,joinItemForward:()=>lH,joinTextblockBackward:()=>cH,joinTextblockForward:()=>uH,joinUp:()=>rH,keyboardShortcut:()=>fH,lift:()=>hH,liftEmptyBlock:()=>pH,liftListItem:()=>mH,newlineInCode:()=>gH,resetAttributes:()=>yH,scrollIntoView:()=>bH,selectAll:()=>vH,selectNodeBackward:()=>wH,selectNodeForward:()=>kH,selectParentNode:()=>xH,selectTextblockEnd:()=>SH,selectTextblockStart:()=>EH,setContent:()=>CH,setMark:()=>UH,setMeta:()=>KH,setNode:()=>YH,setNodeSelection:()=>GH,setTextDirection:()=>ZH,setTextSelection:()=>JH,sinkListItem:()=>XH,splitBlock:()=>QH,splitListItem:()=>eq,toggleList:()=>tq,toggleMark:()=>nq,toggleNode:()=>rq,toggleWrap:()=>oq,undoInputRule:()=>sq,unsetAllMarks:()=>iq,unsetMark:()=>aq,unsetTextDirection:()=>lq,updateAttributes:()=>cq,wrapIn:()=>uq,wrapInList:()=>dq});var DW=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),zW=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),jW=()=>({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=oa(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},LW=t=>e=>t(e),FW=()=>({state:t,dispatch:e})=>rT(t,e),BW=(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 Ie(r.doc.resolve(Math.max(i-1,0)))),!0},VW=()=>({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 At(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 WW=t=>({tr:e,state:n,dispatch:r})=>{const o=At(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},HW=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},qW=()=>({state:t,dispatch:e})=>qg(t,e),UW=()=>({commands:t})=>t.keyboardShortcut("Enter"),KW=()=>({state:t,dispatch:e})=>_5(t,e);function iy(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function pd(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:iy(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function HT(t,e,n={}){return t.find(r=>r.type===e&&pd(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function q0(t,e,n={}){return!!HT(t,e,n)}function ay(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),!HT([...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&&q0([...t.parent.child(i-1).marks],e,n);)i-=1,a-=t.parent.child(i).nodeSize;for(;l<t.parent.childCount&&q0([...t.parent.child(l).marks],e,n);)c+=t.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function Ur(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 YW=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const s=Ur(t,r.schema),{doc:i,selection:a}=n,{$from:l,from:c,to:u}=a;if(o){const d=ay(l,s,e);if(d&&d.from<=c&&d.to>=u){const f=Ie.create(i,d.from,d.to);n.setSelection(f)}}return!0},GW=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 qT(t){return t instanceof Ie}function ss(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function UT(t,e=null){if(!e)return null;const n=We.atStart(t),r=We.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const o=n.from,s=r.to;return e==="all"?Ie.create(t,ss(0,o,s),ss(t.content.size,o,s)):Ie.create(t,ss(e,o,s),ss(e,o,s))}function U0(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function md(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function ZW(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var JW=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:s})=>{e={scrollIntoView:!0,...e};const i=()=>{(md()||U0())&&r.dom.focus(),ZW()&&!md()&&!U0()&&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&&!qT(n.state.selection))return i(),!0;const a=UT(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},XW=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),QW=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),KT=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&&KT(r)}return t};function cc(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 KT(n)}function ll(t,e,n){if(t instanceof vo||t instanceof ae)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 ae.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),ll("",e,n)}if(o){if(n.errorOnInvalidContent){let i=!1,a="";const l=new _C({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?wo.fromSchema(l).parseSlice(cc(t),n.parseOptions):wo.fromSchema(l).parse(cc(t),n.parseOptions),n.errorOnInvalidContent&&i)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=wo.fromSchema(e);return n.slice?s.parseSlice(cc(t),n.parseOptions).content:s.parse(cc(t),n.parseOptions)}return ll("",e,n)}function eH(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof Ft||o instanceof Vt))return;const s=t.mapping.maps[r];let i=0;s.forEach((a,l,c,u)=>{i===0&&(i=u)}),t.setSelection(We.near(t.doc.resolve(i),n))}var tH=t=>!("type"in t),nH=(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{ll(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(g){l(g)}try{a=ll(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((tH(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 ae){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&&eH(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},rH=()=>({state:t,dispatch:e})=>R5(t,e),oH=()=>({state:t,dispatch:e})=>M5(t,e),sH=()=>({state:t,dispatch:e})=>ZC(t,e),iH=()=>({state:t,dispatch:e})=>eT(t,e),aH=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Tf(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},lH=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Tf(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},cH=()=>({state:t,dispatch:e})=>C5(t,e),uH=()=>({state:t,dispatch:e})=>T5(t,e);function YT(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function dH(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))md()||YT()?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 fH=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const s=dH(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 _o(t,e,n={}){const{from:r,to:o,empty:s}=t.selection,i=e?At(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=>pd(d.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}var hH=(t,e={})=>({state:n,dispatch:r})=>{const o=At(t,n.schema);return _o(n,o,e)?O5(n,r):!1},pH=()=>({state:t,dispatch:e})=>oT(t,e),mH=t=>({state:e,dispatch:n})=>{const r=At(t,e.schema);return B5(r)(e,n)},gH=()=>({state:t,dispatch:e})=>nT(t,e);function Af(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function K0(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 yH=(t,e)=>({tr:n,state:r,dispatch:o})=>{let s=null,i=null;const a=Af(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(s=At(t,r.schema)),a==="mark"&&(i=Ur(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,K0(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(K0(f.attrs,e))))})})}),l},bH=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),vH=()=>({tr:t,dispatch:e})=>{if(e){const n=new Mn(t.doc);t.setSelection(n)}return!0},wH=()=>({state:t,dispatch:e})=>XC(t,e),kH=()=>({state:t,dispatch:e})=>tT(t,e),xH=()=>({state:t,dispatch:e})=>$5(t,e),SH=()=>({state:t,dispatch:e})=>D5(t,e),EH=()=>({state:t,dispatch:e})=>I5(t,e);function lm(t,e,n={},r={}){return ll(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var CH=(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=lm(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 GT(t,e){const n=Ur(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 ZT(t,e){const n=new UC(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function TH(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 RH(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(o,s)=>{n(o)&&r.push({node:o,pos:s})}),r}function MH(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 If(t){return e=>MH(e.$from,t)}function Ce(t,e,n){return t.config[e]===void 0&&t.parent?Ce(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Ce(t.parent,e,n):null}):t.config[e]}function ly(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=Ce(e,"addExtensions",n);return r?[e,...ly(r())]:e}).flat(10)}function cy(t,e){const n=Ls.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function JT(t){return typeof t=="function"}function tt(t,e=void 0,...n){return JT(t)?e?t.bind(e)(...n):t(...n):t}function OH(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Hi(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 XT(t){const e=[],{nodeExtensions:n,markExtensions:r}=Hi(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=Ce(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=Ce(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 _H(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 Y0(t){const e=[],n=_H(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 Rt(...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([...Y0(r[o]),...Y0(s)]);r[o]=Array.from(a.entries()).map(([l,c])=>`${l}: ${c}`).join("; ")}else r[o]=s}),r},{})}function cl(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)=>Rt(n,r),{})}function NH(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function G0(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):NH(n.getAttribute(i.name));return a==null?s:{...s,[i.name]:a}},{});return{...r,...o}}}}function Z0(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&OH(n)?!1:n!=null))}function J0(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 PH(t,e){var n;const r=XT(t),{nodeExtensions:o,markExtensions:s}=Hi(t),i=(n=o.find(c=>Ce(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=Ce(b,"extendNodeSchema",d);return{...y,...w?w(c):{}}},{}),h=Z0({...f,content:tt(Ce(c,"content",d)),marks:tt(Ce(c,"marks",d)),group:tt(Ce(c,"group",d)),inline:tt(Ce(c,"inline",d)),atom:tt(Ce(c,"atom",d)),selectable:tt(Ce(c,"selectable",d)),draggable:tt(Ce(c,"draggable",d)),code:tt(Ce(c,"code",d)),whitespace:tt(Ce(c,"whitespace",d)),linebreakReplacement:tt(Ce(c,"linebreakReplacement",d)),defining:tt(Ce(c,"defining",d)),isolating:tt(Ce(c,"isolating",d)),attrs:Object.fromEntries(u.map(J0))}),p=tt(Ce(c,"parseHTML",d));p&&(h.parseDOM=p.map(y=>G0(y,u)));const m=Ce(c,"renderHTML",d);m&&(h.toDOM=y=>m({node:y,HTMLAttributes:cl(y,u)}));const g=Ce(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=Ce(y,"extendMarkSchema",d);return{...g,...b?b(c):{}}},{}),h=Z0({...f,inclusive:tt(Ce(c,"inclusive",d)),excludes:tt(Ce(c,"excludes",d)),group:tt(Ce(c,"group",d)),spanning:tt(Ce(c,"spanning",d)),code:tt(Ce(c,"code",d)),attrs:Object.fromEntries(u.map(J0))}),p=tt(Ce(c,"parseHTML",d));p&&(h.parseDOM=p.map(g=>G0(g,u)));const m=Ce(c,"renderHTML",d);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:cl(g,u)})),[c.name,h]}));return new _C({topNode:i,nodes:a,marks:l})}function $H(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function za(t){return t.sort((n,r)=>{const o=Ce(n,"priority")||100,s=Ce(r,"priority")||100;return o>s?-1:o<s?1:0})}function QT(t){const e=za(ly(t)),n=$H(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 eR(t,e,n){const{from:r,to:o}=e,{blockSeparator:s=`
104
+
105
+ `,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 AH(t,e){const n={from:0,to:t.content.size};return eR(t,n,e)}function tR(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function IH(t,e){const n=At(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 nR(t,e){const n=Af(typeof e=="string"?e:e.name,t.schema);return n==="node"?IH(t,e):n==="mark"?GT(t,e):{}}function DH(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 zH(t){const e=DH(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 rR(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}})})}),zH(r)}function uy(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const s=n.resolve(t),i=ay(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 jH=(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 ca(t,e){return e.nodes[t]||e.marks[t]||null}function Ou(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 LH=(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 cm(t,e,n={}){const{empty:r,ranges:o}=t.selection,s=e?Ur(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>pd(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=>pd(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 FH(t,e,n={}){if(!e)return _o(t,null,n)||cm(t,null,n);const r=Af(e,t.schema);return r==="node"?_o(t,e,n):r==="mark"?cm(t,e,n):!1}var BH=(t,e)=>{const{$from:n,$to:r,$anchor:o}=t.selection;if(e){const s=If(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)},VH=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function X0(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Q0(t,e){const{nodeExtensions:n}=Hi(e),r=n.find(i=>i.name===t);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},s=tt(Ce(r,"group",o));return typeof s!="string"?!1:s.split(" ").includes("list")}function Df(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/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&&(Df(s,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function oR(t){return t instanceof Re}var sR=class iR{constructor(e){this.position=e}static fromJSON(e){return new iR(e.position)}toJSON(){return{position:this.position}}};function WH(t,e){const n=e.mapping.mapResult(t.position);return{position:new sR(n.pos),mapResult:n}}function HH(t){return new sR(t)}function qH(t,e,n){var r;const{selection:o}=e;let s=null;if(qT(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 UH=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:s}=n,{empty:i,ranges:a}=s,l=Ur(t,r.schema);if(o)if(i){const c=GT(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 qH(r,n,l)},KH=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),YH=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const s=At(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})=>d0(s,{...i,...e})(n)?!0:a.clearNodes()).command(({state:a})=>d0(s,{...i,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},GH=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,o=ss(t,0,r.content.size),s=Re.create(r,o);e.setSelection(s)}return!0},ZH=(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},JH=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:o,to:s}=typeof t=="number"?{from:t,to:t}:t,i=Ie.atStart(r).from,a=Ie.atEnd(r).to,l=ss(o,i,a),c=ss(s,i,a),u=Ie.create(r,l,c);e.setSelection(u)}return!0},XH=t=>({state:e,dispatch:n})=>{const r=At(t,e.schema);return H5(r)(e,n)};function ew(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 QH=({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=Ou(c,a.node().type.name,a.node().attrs);if(s instanceof Re&&s.node.isBlock)return!a.parentOffset||!Lr(i,a.pos)?!1:(r&&(t&&ew(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:TH(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=Lr(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!p&&Lr(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 Ie&&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&&ew(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return p},eq=(t,e={})=>({tr:n,state:r,dispatch:o,editor:s})=>{var i;const a=At(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=ae.empty;const b=l.index(-1)?1:l.index(-2)?2:3;for(let M=l.depth-b;M>=l.depth-3;M-=1)y=ae.from(l.node(M).copy(y));const w=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,k={...Ou(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(ae.from(a.createAndFill(null,v)||void 0));const S=l.before(l.depth-(b-1));n.replace(S,l.after(-w),new be(y,4-b,0));let E=-1;n.doc.nodesBetween(S,n.doc.content.size,(M,D)=>{if(E>-1)return!1;M.isTextblock&&M.content.size===0&&(E=D+1)}),E>-1&&n.setSelection(Ie.near(n.doc.resolve(E))),n.scrollIntoView()}return!0}const h=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,p={...Ou(f,d.type.name,d.attrs),...e},m={...Ou(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(!Lr(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(S=>w.includes(S.type.name));n.ensureMarks(v)}return!0},jh=(t,e)=>{const n=If(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&&Fo(t.doc,n.pos)&&t.join(n.pos),!0},Lh=(t,e)=>{const n=If(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&&Fo(t.doc,r)&&t.join(r),!0},tq=(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=At(t,i.schema),p=At(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=If(S=>Q0(S.type.name,d))(m);if(w.depth>=1&&v&&w.depth-v.depth<=1){if(v.node.type===h)return c.liftListItem(p);if(Q0(v.node.type.name,d)&&h.validContent(v.node.content)&&a)return l().command(()=>(s.setNodeMarkup(v.pos,h),!0)).command(()=>jh(s,h)).command(()=>Lh(s,h)).run()}return!n||!k||!a?l().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>jh(s,h)).command(()=>Lh(s,h)).run():l().command(()=>{const S=u().wrapInList(h,r),E=k.filter(M=>f.includes(M.type.name));return s.ensureMarks(E),S?!0:c.clearNodes()}).wrapInList(h,r).command(()=>jh(s,h)).command(()=>Lh(s,h)).run()},nq=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:s=!1}=n,i=Ur(t,r.schema);return cm(r,i,e)?o.unsetMark(i,{extendEmptyMarkRange:s}):o.setMark(i,e)},rq=(t,e,n={})=>({state:r,commands:o})=>{const s=At(t,r.schema),i=At(e,r.schema),a=_o(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})},oq=(t,e={})=>({state:n,commands:r})=>{const o=At(t,n.schema);return _o(n,o,e)?r.lift(o):r.wrapIn(o,e)},sq=()=>({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},iq=()=>({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},aq=(t,e={})=>({tr:n,state:r,dispatch:o})=>{var s;const{extendEmptyMarkRange:i=!1}=e,{selection:a}=n,l=Ur(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=ay(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},lq=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},cq=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let s=null,i=null;const a=Af(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(s=At(t,r.schema)),a==="mark"&&(i=Ur(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},uq=(t,e={})=>({state:n,dispatch:r})=>{const o=At(t,n.schema);return z5(o,e)(n,r)},dq=(t,e={})=>({state:n,dispatch:r})=>{const o=At(t,n.schema);return j5(o,e)(n,r)},fq=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={}}},zf=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},hq=(t,e)=>{if(iy(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 uc(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=LH(c)+s;return i.forEach(f=>{if(u)return;const h=hq(d,f.find);if(!h)return;const p=l.state.tr,m=Pf({state:l.state,transaction:p}),g={from:r-(h[0].length-s.length),to:o},{commands:y,chain:b,can:w}=new $f({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 pq(t){const{editor:e,rules:n}=t,r=new Et({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=cy(ae.from(u),i.schema);const{from:d}=l,f=d+u.length;uc({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 uc({editor:e,from:s,to:i,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:s}=o.state.selection;s&&uc({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?uc({editor:e,from:i.pos,to:i.pos,text:`
106
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function mq(t){return Object.prototype.toString.call(t).slice(8,-1)}function dc(t){return mq(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function aR(t,e){const n={...t};return dc(t)&&dc(e)&&Object.keys(e).forEach(r=>{dc(e[r])&&dc(t[r])?n[r]=aR(t[r],e[r]):n[r]=e[r]}),n}var dy=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...tt(Ce(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...tt(Ce(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>aR(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}},Fs=class lR extends dy{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new lR(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 gq(t){return typeof t=="number"}var yq=class{constructor(t){this.find=t.find,this.handler=t.handler}},bq=(t,e,n)=>{if(iy(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 vq(t){const{editor:e,state:n,from:r,to:o,rule:s,pasteEvent:i,dropEvent:a}=t,{commands:l,chain:c,can:u}=new $f({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),S=Math.min(o,p+k);if(v>=S)return;const E=h.isText?h.text||"":h.textBetween(v-p,S-p,void 0,"");bq(E,s.find,i).forEach(D=>{if(D.index===void 0)return;const F=v+D.index+1,N=F+D[0].length,A={from:n.tr.mapping.map(F),to:n.tr.mapping.map(N)},z=s.handler({state:n,range:A,match:D,commands:l,chain:c,can:u,pasteEvent:i,dropEvent:a});d.push(z)})}),d.every(h=>h!==null)}var fc=null,wq=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function kq(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=Pf({state:u,transaction:m});if(!(!vq({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 Et({view(d){const f=p=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(p.target)?d.dom.parentElement:null,r&&(fc=e)},h=()=>{fc&&(fc=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=fc;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=cy(ae.from(v),h.schema);const{from:S}=y,E=S+v.length,M=wq(v);return l({rule:u,state:h,from:S,to:{b:E},pasteEvt:M})}const w=f.doc.content.findDiffStart(h.doc.content),k=f.doc.content.findDiffEnd(h.doc.content);if(!(!gq(w)||!k||w===k.b))return l({rule:u,state:h,from:w,to:k,pasteEvt:i})}}))}var jf=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=QT(t),this.schema=PH(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:ca(e.name,this.schema)},r=Ce(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return za([...this.extensions].reverse()).flatMap(r=>{const o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:ca(r.name,this.schema)},s=[],i=Ce(r,"addKeyboardShortcuts",o);let a={};if(r.type==="mark"&&Ce(r,"exitable",o)&&(a.ArrowRight=()=>Fs.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=AW(a);s.push(l);const c=Ce(r,"addInputRules",o);if(X0(r,t.options.enableInputRules)&&c){const f=c();if(f&&f.length){const h=pq({editor:t,rules:f}),p=Array.isArray(h)?h:[h];s.push(...p)}}const u=Ce(r,"addPasteRules",o);if(X0(r,t.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const h=kq({editor:t,rules:f});s.push(...h)}}const d=Ce(r,"addProseMirrorPlugins",o);if(d){const f=d();s.push(...f)}return s})}get attributes(){return XT(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Hi(this.extensions);return Object.fromEntries(e.filter(n=>!!Ce(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:At(n.name,this.schema)},s=Ce(n,"addNodeView",o);if(!s)return[];const i=s();if(!i)return[];const a=(l,c,u,d,f)=>{const h=cl(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 za([...this.extensions].reverse()).reduceRight((r,o)=>{const s={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:e,type:ca(o.name,this.schema)},i=Ce(o,"dispatchTransaction",s);return i?a=>{i.call(s,{transaction:a,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return za([...this.extensions]).reduce((r,o)=>{const s={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:e,type:ca(o.name,this.schema)},i=Ce(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}=Hi(this.extensions);return Object.fromEntries(e.filter(n=>!!Ce(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:Ur(n.name,this.schema)},s=Ce(n,"addMarkView",o);if(!s)return[];const i=(a,l,c)=>{const u=cl(a,r);return s()({mark:a,view:l,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{Dq(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:ca(e.name,this.schema)};e.type==="mark"&&((n=tt(Ce(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const o=Ce(e,"onBeforeCreate",r),s=Ce(e,"onCreate",r),i=Ce(e,"onUpdate",r),a=Ce(e,"onSelectionUpdate",r),l=Ce(e,"onTransaction",r),c=Ce(e,"onFocus",r),u=Ce(e,"onBlur",r),d=Ce(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)})}};jf.resolve=QT;jf.sort=za;jf.flatten=ly;var xq={};sy(xq,{ClipboardTextSerializer:()=>uR,Commands:()=>dR,Delete:()=>fR,Drop:()=>hR,Editable:()=>pR,FocusEvents:()=>gR,Keymap:()=>yR,Paste:()=>bR,Tabindex:()=>vR,TextDirection:()=>wR,focusEventsPluginKey:()=>mR});var _t=class cR extends dy{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new cR(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},uR=_t.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Et({key:new Lt("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=tR(n);return eR(r,{from:i,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),dR=_t.create({name:"commands",addCommands(){return{...WT}}}),fR=_t.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=ZT(t.before,[t,...e]);rR(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 Gn){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(E=>E.eq(h.mark)),S=(g=u.doc.nodeAt(b))==null?void 0:g.marks.some(E=>E.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:w,to:k},newRange:{from:y,to:b},partial:!!(S||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()}}),hR=_t.create({name:"drop",addProseMirrorPlugins(){return[new Et({key:new Lt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),pR=_t.create({name:"editable",addProseMirrorPlugins(){return[new Et({key:new Lt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),mR=new Lt("focusEvents"),gR=_t.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Et({key:mR,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}}}})]}}),yR=_t.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:We.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 md()||YT()?s:o},addProseMirrorPlugins(){return[new Et({key:new Lt("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=We.atStart(e.doc).from,c=We.atEnd(e.doc).to;if(s||!(i===l&&a===c)||!Df(n.doc))return;const f=n.tr,h=Pf({state:n,transaction:f}),{commands:p}=new $f({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),bR=_t.create({name:"paste",addProseMirrorPlugins(){return[new Et({key:new Lt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),vR=_t.create({name:"tabindex",addProseMirrorPlugins(){return[new Et({key:new Lt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),wR=_t.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Hi(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 Et({key:new Lt("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),Sq=class Ea{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 Ea(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 Ea(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 Ea(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 Ea(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)}},Eq=`.ProseMirror {
107
+ position: relative;
108
+ }
109
+
110
+ .ProseMirror {
111
+ word-wrap: break-word;
112
+ white-space: pre-wrap;
113
+ white-space: break-spaces;
114
+ -webkit-font-variant-ligatures: none;
115
+ font-variant-ligatures: none;
116
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
117
+ }
118
+
119
+ .ProseMirror [contenteditable="false"] {
120
+ white-space: normal;
121
+ }
122
+
123
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
124
+ white-space: pre-wrap;
125
+ }
126
+
127
+ .ProseMirror pre {
128
+ white-space: pre-wrap;
129
+ }
130
+
131
+ img.ProseMirror-separator {
132
+ display: inline !important;
133
+ border: none !important;
134
+ margin: 0 !important;
135
+ width: 0 !important;
136
+ height: 0 !important;
137
+ }
138
+
139
+ .ProseMirror-gapcursor {
140
+ display: none;
141
+ pointer-events: none;
142
+ position: absolute;
143
+ margin: 0;
144
+ }
145
+
146
+ .ProseMirror-gapcursor:after {
147
+ content: "";
148
+ display: block;
149
+ position: absolute;
150
+ top: -2px;
151
+ width: 20px;
152
+ border-top: 1px solid black;
153
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
154
+ }
155
+
156
+ @keyframes ProseMirror-cursor-blink {
157
+ to {
158
+ visibility: hidden;
159
+ }
160
+ }
161
+
162
+ .ProseMirror-hideselection *::selection {
163
+ background: transparent;
164
+ }
165
+
166
+ .ProseMirror-hideselection *::-moz-selection {
167
+ background: transparent;
168
+ }
169
+
170
+ .ProseMirror-hideselection * {
171
+ caret-color: transparent;
172
+ }
173
+
174
+ .ProseMirror-focused .ProseMirror-gapcursor {
175
+ display: block;
176
+ }`;function Cq(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 Tq=class extends fq{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:WH,createMappablePosition:HH},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=UT(n,this.options.autofocus);this.editorState=gi.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=Cq(Eq,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=JT(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?[pR,uR.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:n.blockSeparator}),dR,gR,yR,vR,hR,bR,fR,wR.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 jf(o,this)}createCommandManager(){this.commandManager=new $f({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=lm(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=lm(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 BT(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 nR(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,o=typeof e=="string"?n:e;return FH(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return cy(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
177
+
178
+ `,textSerializers:r={}}=e||{};return AH(this.state.doc,{blockSeparator:n,textSerializers:{...tR(this.schema),...r}})}get isEmpty(){return Df(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 Sq(n,this)}get $doc(){return this.$pos(0)}};function qi(t){return new zf({find:t.find,handler:({state:e,range:n,match:r})=>{const o=tt(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(uy(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 kR(t){return new zf({find:t.find,handler:({state:e,range:n,match:r})=>{const o=tt(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 um(t){return new zf({find:t.find,handler:({state:e,range:n,match:r})=>{const o=e.doc.resolve(n.from),s=tt(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 Ui(t){return new zf({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{const s=tt(t.getAttributes,void 0,r)||{},i=e.tr.delete(n.from,n.to),l=i.doc.resolve(n.from).blockRange(),c=l&&Wg(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&&Fo(i.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&i.join(n.from-1)},undoable:t.undoable})}var Rq=t=>"touches"in t,Mq=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,Rq(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 Oq(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Re){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 _q={};sy(_q,{createAtomBlockMarkdownSpec:()=>Nq,createBlockMarkdownSpec:()=>Pq,createInlineMarkdownSpec:()=>Iq,parseAttributes:()=>fy,parseIndentedBlocks:()=>dm,renderNestedMarkdownContent:()=>py,serializeAttributes:()=>hy});function fy(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 hy(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 Nq(t){const{nodeName:e,name:n,parseAttributes:r=fy,serializeAttributes:o=hy,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 Pq(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=fy,serializeAttributes:s=hy,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 S="";const E=/^:::([\w-]*)(\s.*)?/gm,M=d.slice(v);for(E.lastIndex=0;;){const D=E.exec(M);if(D===null)break;const F=D.index,N=D[1];if(!((p=D[2])!=null&&p.endsWith(":::"))){if(N)k+=1;else if(k-=1,k===0){const A=M.slice(0,F);S=A.trim();const z=d.slice(0,v+F+D[0].length);let B=[];if(S)if(a==="block")for(B=h.blockTokens(A),B.forEach(U=>{U.text&&(!U.tokens||U.tokens.length===0)&&(U.tokens=h.inlineTokens(U.text))});B.length>0;){const U=B[B.length-1];if(U.type==="paragraph"&&(!U.text||U.text.trim()===""))B.pop();else break}else B=h.inlineTokens(S);return{type:e,raw:z,attributes:w,content:S,tokens:B}}}}}},renderMarkdown:(d,f)=>{const h=u(d.attrs||{}),p=s(h),m=p?` {${p}}`:"",g=f.renderChildren(d.content||[],`
179
+
180
+ `);return`:::${c}${m}
181
+
182
+ ${g}
183
+
184
+ :::`}}}function $q(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 Aq(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function Iq(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=$q,serializeAttributes:s=Aq,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 dm(t,e,n){var r,o,s,i;const a=t.split(`
185
+ `),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}
186
+ `;continue}else return}const p=e.extractItemData(h),{indentLevel:m,mainContent:g}=p;c=`${c}${f}
187
+ `;const y=[g];for(u+=1;u<a.length;){const v=a[u];if(v.trim()===""){const E=a.slice(u+1).findIndex(F=>F.trim()!=="");if(E===-1)break;if((((o=(r=a[u+1+E].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:o.length)||0)>m){y.push(v),c=`${c}${v}
188
+ `,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}
189
+ `,u+=1;else break}let b;const w=y.slice(1);if(w.length>0){const v=w.map(S=>S.slice(m+d)).join(`
190
+ `);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 py(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(`
191
+ `).map(f=>f?e.indent(f):"").join(`
192
+ `);l.push(d)}}),l.join(`
193
+ `)}function Dq(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 xR extends dy{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new xR(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 yq({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{const s=tt(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(uy(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:zq,getOwnPropertySymbols:jq}=Object,{hasOwnProperty:Lq}=Object.prototype;function Fh(t,e){return function(r,o,s){return t(r,o,s)&&e(r,o,s)}}function hc(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 Fq(t){return t?.[Symbol.toStringTag]}function tw(t){return zq(t).concat(jq(t))}const Bq=Object.hasOwn||((t,e)=>Lq.call(t,e));function Bs(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const Vq="__v",Wq="__o",Hq="_owner",{getOwnPropertyDescriptor:nw,keys:rw}=Object;function qq(t,e){return t.byteLength===e.byteLength&&gd(new Uint8Array(t),new Uint8Array(e))}function Uq(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 Kq(t,e){return t.byteLength===e.byteLength&&gd(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function Yq(t,e){return Bs(t.getTime(),e.getTime())}function Gq(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function Zq(t,e){return t===e}function ow(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 Jq=Bs;function Xq(t,e,n){const r=rw(t);let o=r.length;if(rw(e).length!==o)return!1;for(;o-- >0;)if(!SR(t,e,n,r[o]))return!1;return!0}function ua(t,e,n){const r=tw(t);let o=r.length;if(tw(e).length!==o)return!1;let s,i,a;for(;o-- >0;)if(s=r[o],!SR(t,e,n,s)||(i=nw(t,s),a=nw(e,s),(i||a)&&(!i||!a||i.configurable!==a.configurable||i.enumerable!==a.enumerable||i.writable!==a.writable)))return!1;return!0}function Qq(t,e){return Bs(t.valueOf(),e.valueOf())}function e6(t,e){return t.source===e.source&&t.flags===e.flags}function sw(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 gd(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 t6(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 SR(t,e,n,r){return(r===Hq||r===Wq||r===Vq)&&(t.$$typeof||e.$$typeof)?!0:Bq(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const n6="[object ArrayBuffer]",r6="[object Arguments]",o6="[object Boolean]",s6="[object DataView]",i6="[object Date]",a6="[object Error]",l6="[object Map]",c6="[object Number]",u6="[object Object]",d6="[object RegExp]",f6="[object Set]",h6="[object String]",p6={"[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},m6="[object URL]",g6=Object.prototype.toString;function y6({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=g6.call(g);if(v===i6)return r(g,y,b);if(v===d6)return u(g,y,b);if(v===l6)return i(g,y,b);if(v===f6)return d(g,y,b);if(v===u6)return typeof g.then!="function"&&typeof y.then!="function"&&l(g,y,b);if(v===m6)return h(g,y,b);if(v===a6)return o(g,y,b);if(v===r6)return l(g,y,b);if(p6[v])return f(g,y,b);if(v===n6)return t(g,y,b);if(v===s6)return n(g,y,b);if(v===o6||v===c6||v===h6)return c(g,y,b);if(p){let S=p[v];if(!S){const E=Fq(g);E&&(S=p[E])}if(S)return S(g,y,b)}return!1}}function b6({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:qq,areArraysEqual:n?ua:Uq,areDataViewsEqual:Kq,areDatesEqual:Yq,areErrorsEqual:Gq,areFunctionsEqual:Zq,areMapsEqual:n?Fh(ow,ua):ow,areNumbersEqual:Jq,areObjectsEqual:n?ua:Xq,arePrimitiveWrappersEqual:Qq,areRegExpsEqual:e6,areSetsEqual:n?Fh(sw,ua):sw,areTypedArraysEqual:n?Fh(gd,ua):gd,areUrlsEqual:t6,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const o=hc(r.areArraysEqual),s=hc(r.areMapsEqual),i=hc(r.areObjectsEqual),a=hc(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:o,areMapsEqual:s,areObjectsEqual:i,areSetsEqual:a})}return r}function v6(t){return function(e,n,r,o,s,i,a){return t(e,n,a)}}function w6({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 k6=Vo();Vo({strict:!0});Vo({circular:!0});Vo({circular:!0,strict:!0});Vo({createInternalComparator:()=>Bs});Vo({strict:!0,createInternalComparator:()=>Bs});Vo({circular:!0,createInternalComparator:()=>Bs});Vo({circular:!0,createInternalComparator:()=>Bs,strict:!0});function Vo(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:o=!1}=t,s=b6(t),i=y6(s),a=n?n(i):v6(i);return w6({circular:e,comparator:i,createState:r,equals:a,strict:o})}var x6=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},S6=({contentComponent:t})=>{const e=Ym.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return C.jsx(C.Fragment,{children:Object.values(e)})};function E6(){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]:Ix.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 C6=class extends me.Component{constructor(t){var e;super(t),this.editorContentRef=me.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=E6(),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 C.jsxs(C.Fragment,{children:[C.jsx("div",{ref:x6(e,this.editorContentRef),...n}),t?.contentComponent&&C.jsx(S6,{contentComponent:t.contentComponent})]})}},T6=x.forwardRef((t,e)=>{const n=me.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return me.createElement(C6,{key:n,innerRef:e,...t})}),ER=me.memo(T6),R6=typeof window<"u"?x.useLayoutEffect:x.useEffect,M6=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 O6(t){var e;const[n]=x.useState(()=>new M6(t.editor)),r=Ax.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:k6);return R6(()=>n.watch(t.editor),[t.editor,n]),x.useDebugValue(r),r}var _6=!1,fm=typeof window>"u",N6=fm||!!(typeof window<"u"&&window.next),P6=class CR{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?fm||N6?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 Tq(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?CR.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 $6(t={},e=[]){const n=x.useRef(t);n.current=t;const[r]=x.useState(()=>new P6(n)),o=Ym.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return x.useDebugValue(o),x.useEffect(r.onRender(e)),O6({editor:o,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&s===0?0:s+1}),o}var TR=x.createContext({editor:null});TR.Consumer;var A6=x.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),I6=()=>x.useContext(A6);me.forwardRef((t,e)=>{const{onDragStart:n}=I6(),r=t.as||"div";return C.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});me.createContext({markViewContentRef:()=>{}});var my=x.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});my.displayName="TiptapContext";var D6=()=>x.useContext(my);function RR({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=x.useMemo(()=>({editor:r}),[r]),s=x.useMemo(()=>({editor:r}),[r]);return C.jsx(TR.Provider,{value:s,children:C.jsx(my.Provider,{value:o,children:n})})}RR.displayName="Tiptap";function MR({...t}){const{editor:e}=D6();return C.jsx(ER,{editor:e,...t})}MR.displayName="Tiptap.Content";Object.assign(RR,{Content:MR});var yd=(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]},z6=/^\s*>\s$/,j6=vn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return yd("blockquote",{...Rt(this.options.HTMLAttributes,t),children:yd("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(`
194
+ `).map(l=>l.trim()===""?n:`${n} ${l}`);r.push(a.join(`
195
+ `))}),r.join(`
196
+ ${n}
197
+ `)},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[Ui({find:z6,type:this.type})]}}),L6=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,F6=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,B6=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,V6=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,W6=Fs.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 yd("strong",{...Rt(this.options.HTMLAttributes,t),children:yd("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[qi({find:L6,type:this.type}),qi({find:B6,type:this.type})]},addPasteRules(){return[Ms({find:F6,type:this.type}),Ms({find:V6,type:this.type})]}}),H6=/(^|[^`])`([^`]+)`(?!`)$/,q6=/(^|[^`])`([^`]+)`(?!`)/g,U6=Fs.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Rt(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[qi({find:H6,type:this.type})]},addPasteRules(){return[Ms({find:q6,type:this.type})]}}),Bh=4,K6=/^```([a-z]+)?[\s\n]$/,Y6=/^~~~([a-z]+)?[\s\n]$/,G6=vn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Bh,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",Rt(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(`
198
+ `):r=`\`\`\`${o}
199
+
200
+ \`\`\``,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:Bh,{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,`
201
+ `,`
202
+ `).split(`
203
+ `).map(p=>a+p).join(`
204
+ `);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:Bh,{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,`
205
+ `,`
206
+ `).split(`
207
+ `);let p=0,m=0;const g=c-u;for(let S=0;S<h.length;S+=1){if(m+h[S].length>=g){p=S;break}m+=h[S].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 S=0;S<p;S+=1)k+=h[S].length+1;return a.delete(k,k+w),c-k<=w&&a.setSelection(Ie.create(a.doc,k)),!0}):t.commands.command(({tr:a})=>{const{from:l,to:c}=o,f=r.doc.textBetween(l,c,`
208
+ `,`
209
+ `).split(`
210
+ `).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(`
211
+ `);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(`
212
+
213
+ `);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(We.near(r.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[um({find:K6,type:this.type,getAttributes:t=>({language:t[1]})}),um({find:Y6,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Et({key:new Lt("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,`
214
+ `));return i.replaceSelectionWith(this.type.create({language:s},l)),i.selection.$from.parent.type!==this.type&&i.setSelection(Ie.near(i.doc.resolve(Math.max(0,i.selection.from-2)))),i.setMeta("paste",!0),t.dispatch(i),!0}}})]}}),Z6=vn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
215
+
216
+ `):""}),J6=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",Rt(this.options.HTMLAttributes,t)]},renderText(){return`
217
+ `},renderMarkdown:()=>`
218
+ `,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()}}}),X6=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]}`,Rt(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=>um({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),Q6=vn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Rt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!Oq(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,o=t();return oR(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(Ie.create(i.doc,l.pos+1)):l.nodeAfter.isBlock?i.setSelection(Re.create(i.doc,l.pos)):i.setSelection(Ie.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(Ie.create(i.doc,c+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[kR({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),e9=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,t9=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,n9=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,r9=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,o9=Fs.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",Rt(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[qi({find:e9,type:this.type}),qi({find:n9,type:this.type})]},addPasteRules(){return[Ms({find:t9,type:this.type}),Ms({find:r9,type:this.type})]}});const s9="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",i9="ελ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",hm="numeric",pm="ascii",mm="alpha",ja="asciinumeric",Ca="alphanumeric",gm="domain",OR="emoji",a9="scheme",l9="slashscheme",Vh="whitespace";function c9(t,e){return t in e||(e[t]=[]),e[t]}function is(t,e,n){e[hm]&&(e[ja]=!0,e[Ca]=!0),e[pm]&&(e[ja]=!0,e[mm]=!0),e[ja]&&(e[Ca]=!0),e[mm]&&(e[Ca]=!0),e[Ca]&&(e[gm]=!0),e[OR]&&(e[gm]=!0);for(const r in e){const o=c9(r,n);o.indexOf(t)<0&&o.push(t)}}function u9(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&&is(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(u9(i.t,r),n);is(s,l,r)}else n&&is(s,n,r);i.t=s}return o.j[t]=i,i}};const Ve=(t,e,n,r,o)=>t.ta(e,n,r,o),Ct=(t,e,n,r,o)=>t.tr(e,n,r,o),iw=(t,e,n,r,o)=>t.ts(e,n,r,o),ue=(t,e,n,r,o)=>t.tt(e,n,r,o),Pr="WORD",ym="UWORD",_R="ASCIINUMERICAL",NR="ALPHANUMERICAL",ul="LOCALHOST",bm="TLD",vm="UTLD",_u="SCHEME",ui="SLASH_SCHEME",gy="NUM",wm="WS",yy="NL",La="OPENBRACE",Fa="CLOSEBRACE",bd="OPENBRACKET",vd="CLOSEBRACKET",wd="OPENPAREN",kd="CLOSEPAREN",xd="OPENANGLEBRACKET",Sd="CLOSEANGLEBRACKET",Ed="FULLWIDTHLEFTPAREN",Cd="FULLWIDTHRIGHTPAREN",Td="LEFTCORNERBRACKET",Rd="RIGHTCORNERBRACKET",Md="LEFTWHITECORNERBRACKET",Od="RIGHTWHITECORNERBRACKET",_d="FULLWIDTHLESSTHAN",Nd="FULLWIDTHGREATERTHAN",Pd="AMPERSAND",$d="APOSTROPHE",Ad="ASTERISK",oo="AT",Id="BACKSLASH",Dd="BACKTICK",zd="CARET",ao="COLON",by="COMMA",jd="DOLLAR",or="DOT",Ld="EQUALS",vy="EXCLAMATION",$n="HYPHEN",Ba="PERCENT",Fd="PIPE",Bd="PLUS",Vd="POUND",Va="QUERY",wy="QUOTE",PR="FULLWIDTHMIDDLEDOT",ky="SEMI",sr="SLASH",Wa="TILDE",Wd="UNDERSCORE",$R="EMOJI",Hd="SYM";var AR=Object.freeze({__proto__:null,ALPHANUMERICAL:NR,AMPERSAND:Pd,APOSTROPHE:$d,ASCIINUMERICAL:_R,ASTERISK:Ad,AT:oo,BACKSLASH:Id,BACKTICK:Dd,CARET:zd,CLOSEANGLEBRACKET:Sd,CLOSEBRACE:Fa,CLOSEBRACKET:vd,CLOSEPAREN:kd,COLON:ao,COMMA:by,DOLLAR:jd,DOT:or,EMOJI:$R,EQUALS:Ld,EXCLAMATION:vy,FULLWIDTHGREATERTHAN:Nd,FULLWIDTHLEFTPAREN:Ed,FULLWIDTHLESSTHAN:_d,FULLWIDTHMIDDLEDOT:PR,FULLWIDTHRIGHTPAREN:Cd,HYPHEN:$n,LEFTCORNERBRACKET:Td,LEFTWHITECORNERBRACKET:Md,LOCALHOST:ul,NL:yy,NUM:gy,OPENANGLEBRACKET:xd,OPENBRACE:La,OPENBRACKET:bd,OPENPAREN:wd,PERCENT:Ba,PIPE:Fd,PLUS:Bd,POUND:Vd,QUERY:Va,QUOTE:wy,RIGHTCORNERBRACKET:Rd,RIGHTWHITECORNERBRACKET:Od,SCHEME:_u,SEMI:ky,SLASH:sr,SLASH_SCHEME:ui,SYM:Hd,TILDE:Wa,TLD:bm,UNDERSCORE:Wd,UTLD:vm,UWORD:ym,WORD:Pr,WS:wm});const Tr=/[a-z]/,da=new RegExp("\\p{L}","u"),Wh=new RegExp("\\p{Emoji}","u"),Rr=/\d/,Hh=/\s/,aw="\r",qh=`
219
+ `,d9="️",f9="‍",Uh="";let pc=null,mc=null;function h9(t=[]){const e={};hn.groups=e;const n=new hn;pc==null&&(pc=lw(s9)),mc==null&&(mc=lw(i9)),ue(n,"'",$d),ue(n,"{",La),ue(n,"}",Fa),ue(n,"[",bd),ue(n,"]",vd),ue(n,"(",wd),ue(n,")",kd),ue(n,"<",xd),ue(n,">",Sd),ue(n,"(",Ed),ue(n,")",Cd),ue(n,"「",Td),ue(n,"」",Rd),ue(n,"『",Md),ue(n,"』",Od),ue(n,"<",_d),ue(n,">",Nd),ue(n,"&",Pd),ue(n,"*",Ad),ue(n,"@",oo),ue(n,"`",Dd),ue(n,"^",zd),ue(n,":",ao),ue(n,",",by),ue(n,"$",jd),ue(n,".",or),ue(n,"=",Ld),ue(n,"!",vy),ue(n,"-",$n),ue(n,"%",Ba),ue(n,"|",Fd),ue(n,"+",Bd),ue(n,"#",Vd),ue(n,"?",Va),ue(n,'"',wy),ue(n,"/",sr),ue(n,";",ky),ue(n,"~",Wa),ue(n,"_",Wd),ue(n,"\\",Id),ue(n,"・",PR);const r=Ct(n,Rr,gy,{[hm]:!0});Ct(r,Rr,r);const o=Ct(r,Tr,_R,{[ja]:!0}),s=Ct(r,da,NR,{[Ca]:!0}),i=Ct(n,Tr,Pr,{[pm]:!0});Ct(i,Rr,o),Ct(i,Tr,i),Ct(o,Rr,o),Ct(o,Tr,o);const a=Ct(n,da,ym,{[mm]:!0});Ct(a,Tr),Ct(a,Rr,s),Ct(a,da,a),Ct(s,Rr,s),Ct(s,Tr),Ct(s,da,s);const l=ue(n,qh,yy,{[Vh]:!0}),c=ue(n,aw,wm,{[Vh]:!0}),u=Ct(n,Hh,wm,{[Vh]:!0});ue(n,Uh,u),ue(c,qh,l),ue(c,Uh,u),Ct(c,Hh,u),ue(u,aw),ue(u,qh),Ct(u,Hh,u),ue(u,Uh,u);const d=Ct(n,Wh,$R,{[OR]:!0});ue(d,"#"),Ct(d,Wh,d),ue(d,d9,d);const f=ue(d,f9);ue(f,"#"),Ct(f,Wh,d);const h=[[Tr,i],[Rr,o]],p=[[Tr,null],[da,a],[Rr,s]];for(let m=0;m<pc.length;m++)Jr(n,pc[m],bm,Pr,h);for(let m=0;m<mc.length;m++)Jr(n,mc[m],vm,ym,p);is(bm,{tld:!0,ascii:!0},e),is(vm,{utld:!0,alpha:!0},e),Jr(n,"file",_u,Pr,h),Jr(n,"mailto",_u,Pr,h),Jr(n,"http",ui,Pr,h),Jr(n,"https",ui,Pr,h),Jr(n,"ftp",ui,Pr,h),Jr(n,"ftps",ui,Pr,h),is(_u,{scheme:!0,ascii:!0},e),is(ui,{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]?{[a9]:!0}:{[l9]:!0};g.indexOf("-")>=0?b[gm]=!0:Tr.test(g)?Rr.test(g)?b[ja]=!0:b[pm]=!0:b[hm]=!0,iw(n,g,g,b)}return iw(n,"localhost",ul,{ascii:!0}),n.jd=new hn(Hd),{start:n,tokens:Object.assign({groups:e},AR)}}function IR(t,e){const n=p9(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 p9(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 Jr(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 lw(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 dl={defaultProtocol:"http",events:null,format:cw,formatHref:cw,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function xy(t,e=null){let n=Object.assign({},dl);t&&(n=Object.assign(n,t instanceof xy?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}xy.prototype={o:dl,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]:dl[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 cw(t){return t}function DR(t,e){this.t="token",this.v=t,this.tk=e}DR.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=dl.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 Lf(t,e){class n extends DR{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 uw=Lf("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),dw=Lf("text"),m9=Lf("nl"),gc=Lf("url",{isLink:!0,toHref(t=dl.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==ul&&t[1].t===ao}}),Nn=t=>new hn(t);function g9({groups:t}){const e=t.domain.concat([Pd,Ad,oo,Id,Dd,zd,jd,Ld,$n,gy,Ba,Fd,Bd,Vd,sr,Hd,Wa,Wd]),n=[$d,ao,by,or,vy,Ba,Va,wy,ky,xd,Sd,La,Fa,vd,bd,wd,kd,Ed,Cd,Td,Rd,Md,Od,_d,Nd],r=[Pd,$d,Ad,Id,Dd,zd,jd,Ld,$n,La,Fa,Ba,Fd,Bd,Vd,Va,sr,Hd,Wa,Wd],o=Nn(),s=ue(o,Wa);Ve(s,r,s),Ve(s,t.domain,s);const i=Nn(),a=Nn(),l=Nn();Ve(o,t.domain,i),Ve(o,t.scheme,a),Ve(o,t.slashscheme,l),Ve(i,r,s),Ve(i,t.domain,i);const c=ue(i,oo);ue(s,oo,c),ue(a,oo,c),ue(l,oo,c);const u=ue(s,or);Ve(u,r,s),Ve(u,t.domain,s);const d=Nn();Ve(c,t.domain,d),Ve(d,t.domain,d);const f=ue(d,or);Ve(f,t.domain,d);const h=Nn(uw);Ve(f,t.tld,h),Ve(f,t.utld,h),ue(c,ul,h);const p=ue(d,$n);ue(p,$n,p),Ve(p,t.domain,d),Ve(h,t.domain,d),ue(h,or,f),ue(h,$n,p);const m=ue(h,ao);Ve(m,t.numeric,uw);const g=ue(i,$n),y=ue(i,or);ue(g,$n,g),Ve(g,t.domain,i),Ve(y,r,s),Ve(y,t.domain,i);const b=Nn(gc);Ve(y,t.tld,b),Ve(y,t.utld,b),Ve(b,t.domain,i),Ve(b,r,s),ue(b,or,y),ue(b,$n,g),ue(b,oo,c);const w=ue(b,ao),k=Nn(gc);Ve(w,t.numeric,k);const v=Nn(gc),S=Nn();Ve(v,e,v),Ve(v,n,S),Ve(S,e,v),Ve(S,n,S),ue(b,sr,v),ue(k,sr,v);const E=ue(a,ao),M=ue(l,ao),D=ue(M,sr),F=ue(D,sr);Ve(a,t.domain,i),ue(a,or,y),ue(a,$n,g),Ve(l,t.domain,i),ue(l,or,y),ue(l,$n,g),Ve(E,t.domain,v),ue(E,sr,v),ue(E,Va,v),Ve(F,t.domain,v),Ve(F,e,v),ue(F,sr,v);const N=[[La,Fa],[bd,vd],[wd,kd],[xd,Sd],[Ed,Cd],[Td,Rd],[Md,Od],[_d,Nd]];for(let A=0;A<N.length;A++){const[z,B]=N[A],U=ue(v,z);ue(S,z,U),ue(U,B,v);const J=Nn(gc);Ve(U,e,J);const Y=Nn();Ve(U,n),Ve(J,e,J),Ve(J,n,Y),Ve(Y,e,J),Ve(Y,n,Y),ue(J,B,v),ue(Y,B,v)}return ue(o,ul,b),ue(o,yy,m9),{start:o,tokens:AR}}function y9(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(Kh(dw,e,i)),i=[]),o-=f,u-=f;const h=d.t,p=n.slice(o-u,o);s.push(Kh(h,e,p))}}return i.length>0&&s.push(Kh(dw,e,i)),s}function Kh(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 b9=typeof console<"u"&&console&&console.warn||(()=>{}),v9="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",yt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function w9(){return hn.groups={},yt.scanner=null,yt.parser=null,yt.tokenQueue=[],yt.pluginQueue=[],yt.customSchemes=[],yt.initialized=!1,yt}function fw(t,e=!1){if(yt.initialized&&b9(`linkifyjs: already initialized - will not register custom scheme "${t}" ${v9}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
220
+ 1. Must only contain digits, lowercase ASCII letters or "-"
221
+ 2. Cannot start or end with "-"
222
+ 3. "-" cannot repeat`);yt.customSchemes.push([t,e])}function k9(){yt.scanner=h9(yt.customSchemes);for(let t=0;t<yt.tokenQueue.length;t++)yt.tokenQueue[t][1]({scanner:yt.scanner});yt.parser=g9(yt.scanner.tokens);for(let t=0;t<yt.pluginQueue.length;t++)yt.pluginQueue[t][1]({scanner:yt.scanner,parser:yt.parser});return yt.initialized=!0,yt}function Sy(t){return yt.initialized||k9(),y9(yt.parser.start,t,IR(yt.scanner.start,t))}Sy.scan=IR;function zR(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 xy(n),o=Sy(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 Ey="[\0-   ᠎ -\u2029  ]",x9=new RegExp(Ey),S9=new RegExp(`${Ey}$`),E9=new RegExp(Ey,"g");function C9(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function T9(t){return new Et({key:new Lt("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=ZT(n.doc,[...e]);if(rR(a).forEach(({newRange:c})=>{const u=RH(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(!S9.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(x9).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=Sy(p).map(y=>y.toObject(t.defaultProtocol));if(!C9(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=>{uy(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 R9(t){return new Et({key:new Lt("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=nR(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 M9(t){return new Et({key:new Lt("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=zR(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 Ko(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(E9,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var jR=Fs.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"){fw(t);return}fw(t.scheme,t.optionalSlashes)})},onDestroy(){w9()},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)=>!!Ko(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=>!!Ko(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=>!!Ko(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Rt(this.options.HTMLAttributes,t),0]:["a",Rt(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=>!!Ko(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=>!!Ko(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=zR(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:i=>!!Ko(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(T9({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Ko(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(R9({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(M9({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),O9=jR,_9=Object.defineProperty,N9=(t,e)=>{for(var n in e)_9(t,n,{get:e[n],enumerable:!0})},P9="listItem",hw="textStyle",pw=/^\s*([-+*])\s$/,LR=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",Rt(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,`
223
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(P9,this.editor.getAttributes(hw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Ui({find:pw,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ui({find:pw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(hw),editor:this.editor})),[t]}}),FR=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",Rt(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)=>py(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)}}}),$9={};N9($9,{findListItemPos:()=>Ml,getNextListDepth:()=>Cy,handleBackspace:()=>km,handleDelete:()=>xm,hasListBefore:()=>BR,hasListItemAfter:()=>A9,hasListItemBefore:()=>VR,listItemHasSubList:()=>WR,nextListIsDeeper:()=>HR,nextListIsHigher:()=>qR});var Ml=(t,e)=>{const{$from:n}=e.selection,r=At(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}},Cy=(t,e)=>{const n=Ml(t,e);if(!n)return!1;const[,r]=jH(e,t,n.$pos.pos+4);return r},BR=(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))},VR=(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)},WR=(t,e,n)=>{if(!n)return!1;const r=At(t,e.schema);let o=!1;return n.descendants(s=>{s.type===r&&(o=!0)}),o},km=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!_o(t.state,e)&&BR(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(!_o(t.state,e)||!VH(t.state))return!1;const r=Ml(e,t.state);if(!r)return!1;const s=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),i=WR(e,t.state,s);return VR(e,t.state)&&!i?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},HR=(t,e)=>{const n=Cy(t,e),r=Ml(t,e);return!r||!n?!1:n>r.depth},qR=(t,e)=>{const n=Cy(t,e),r=Ml(t,e);return!r||!n?!1:n<r.depth},xm=(t,e)=>{if(!_o(t.state,e)||!BH(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:o}=n;return!n.empty&&r.sameParent(o)?!1:HR(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():qR(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},A9=(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)},UR=_t.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&&xm(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&&xm(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&&km(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&&km(t,n,r)&&(e=!0)}),e}}}}),mw=/^(\s*)(\d+)\.\s+(.*)$/,I9=/^\s/;function D9(t){const e=[];let n=0,r=0;for(;n<t.length;){const o=t[n],s=o.match(mw);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(mw))break;if(h.trim()==="")f.push(h),u+=`
224
+ `,d+=1;else if(h.match(I9))f.push(h),u+=`
225
+ ${h.slice(c+2)}`,d+=1;else break}e.push({indent:c,number:parseInt(a,10),content:u.trim(),raw:f.join(`
226
+ `)}),r=d,n=d}return[e,r]}function KR(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(`
227
+ `),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(`
228
+ `).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=KR(f,h,n);c.push({type:"list",ordered:!0,start:f[0].number,items:p,raw:f.map(m=>m.raw).join(`
229
+ `)})}o.push({type:"list_item",raw:i.raw,tokens:c}),s=d}else s+=1}return o}function z9(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 j9="listItem",gw="textStyle",yw=/^(\d+)\.\s$/,YR=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",Rt(this.options.HTMLAttributes,n),0]:["ol",Rt(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?z9(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,`
230
+ `):"",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(`
231
+ `),[s,i]=D9(o);if(s.length===0)return;const a=KR(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(`
232
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(j9,this.editor.getAttributes(gw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ui({find:yw,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=Ui({find:yw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(gw)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),L9=/^\s*(\[([( |x])?\])\s$/,GR=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",Rt(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 py(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=cl(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[Ui({find:L9,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),ZR=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",Rt(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,`
233
+ `):"",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=dm(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=dm(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()}}});_t.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(LR.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(FR.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(UR.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(YR.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(GR.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(ZR.configure(this.options.taskList)),t}});var bw="&nbsp;",F9=" ",B9=vn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Rt(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===bw||r[0].text===F9)?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?bw:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),V9=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,W9=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,H9=Fs.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",Rt(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[qi({find:V9,type:this.type})]},addPasteRules(){return[Ms({find:W9,type:this.type})]}}),q9=vn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),U9=Fs.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",Rt(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 K9(t={}){return new Et({view(e){return new Y9(e,t)}})}class Y9{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=BC(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 Tt extends We{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Tt.valid(r)?new Tt(r):We.near(r)}content(){return be.empty}eq(e){return e instanceof Tt&&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 Tt(e.resolve(n.pos))}getBookmark(){return new Ty(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!G9(e)||!Z9(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&&Tt.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(Tt.valid(l))return l}for(;;){let i=n>0?s.firstChild:s.lastChild;if(!i){if(s.isAtom&&!s.isText&&!Re.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(Tt.valid(a))return a}return null}}}Tt.prototype.visible=!1;Tt.findFrom=Tt.findGapCursorFrom;We.jsonID("gapcursor",Tt);class Ty{constructor(e){this.pos=e}map(e){return new Ty(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Tt.valid(n)?new Tt(n):We.near(n)}}function JR(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function G9(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||JR(o.type))return!0;if(o.inlineContent)return!1}}return!0}function Z9(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||JR(o.type))return!0;if(o.inlineContent)return!1}}return!0}function J9(){return new Et({props:{decorations:tU,createSelectionBetween(t,e,n){return e.pos==n.pos&&Tt.valid(n)?new Tt(n):null},handleClick:Q9,handleKeyDown:X9,handleDOMEvents:{beforeinput:eU}}})}const X9=VT({ArrowLeft:yc("horiz",-1),ArrowRight:yc("horiz",1),ArrowUp:yc("vert",-1),ArrowDown:yc("vert",1)});function yc(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 Ie){if(!s.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=Tt.findGapCursorFrom(a,e,l);return c?(o&&o(r.tr.setSelection(new Tt(c))),!0):!1}}function Q9(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Tt.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&Re.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Tt(r))),!0)}function eU(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Tt))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=ae.empty;for(let i=r.length-1;i>=0;i--)o=ae.from(r[i].createAndFill(null,o));let s=t.state.tr.replace(n.pos,n.pos,new be(o,0,0));return s.setSelection(Ie.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function tU(t){if(!(t.selection instanceof Tt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",kt.create(t.doc,[sn.widget(t.selection.head,e,{key:"gapcursor"})])}var qd=200,Wt=function(){};Wt.prototype.append=function(e){return e.length?(e=Wt.from(e),!this.length&&e||e.length<qd&&this.leafAppend(e)||this.length<qd&&e.leafPrepend(this)||this.appendInner(e)):this};Wt.prototype.prepend=function(e){return e.length?Wt.from(e).append(this):this};Wt.prototype.appendInner=function(e){return new nU(this,e)};Wt.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Wt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Wt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Wt.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)};Wt.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};Wt.from=function(e){return e instanceof Wt?e:e&&e.length?new XR(e):Wt.empty};var XR=(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<=qd)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=qd)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})(Wt);Wt.empty=new XR([]);var nU=(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})(Wt);const rU=500;class Yn{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 ir(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 ir(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 Yn(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 ir(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>sU&&(a=oU(a,c),i-=c),new Yn(a.append(s),i)}remapping(e,n){let r=new rl;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 Yn(this.items.append(e.map(n=>new ir(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 ir(p,m,g))}else r.push(new ir(p))},o);let c=[];for(let f=n;f<i;f++)c.push(new ir(s.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new Yn(u,a);return d.emptyItemCount()>rU&&(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 ir(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 Yn(Wt.from(o.reverse()),s)}}Yn.empty=new Yn(Wt.empty,0);function oU(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}class ir{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 ir(n.getMap().invert(),n,this.selection)}}}class so{constructor(e,n,r,o,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=s}}const sU=20;function iU(t,e,n,r){let o=n.getMeta(ps),s;if(o)return o.historyState;n.getMeta(cU)&&(t=new so(t.done,t.undone,null,0,-1));let i=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(i&&i.getMeta(ps))return i.getMeta(ps).redo?new so(t.done.addTransform(n,void 0,r,Nu(e)),t.undone,vw(n.mapping.maps),t.prevTime,t.prevComposition):new so(t.done,t.undone.addTransform(n,void 0,r,Nu(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||!aU(n,t.prevRanges)),c=i?Yh(t.prevRanges,n.mapping):vw(n.mapping.maps);return new so(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Nu(e)),Yn.empty,c,n.time,a??t.prevComposition)}else return(s=n.getMeta("rebased"))?new so(t.done.rebased(n,s),t.undone.rebased(n,s),Yh(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new so(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Yh(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function aU(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 vw(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 Yh(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 lU(t,e,n){let r=Nu(e),o=ps.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 so(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(i).setMeta(ps,{redo:n,historyState:l})}let Gh=!1,ww=null;function Nu(t){let e=t.plugins;if(ww!=e){Gh=!1,ww=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Gh=!0;break}}return Gh}const ps=new Lt("history"),cU=new Lt("closeHistory");function uU(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Et({key:ps,state:{init(){return new so(Yn.empty,Yn.empty,null,0,-1)},apply(e,n,r){return iU(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?eM:r=="historyRedo"?tM:null;return!o||!e.editable?!1:(n.preventDefault(),o(e.state,e.dispatch))}}}})}function QR(t,e){return(n,r)=>{let o=ps.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let s=lU(o,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const eM=QR(!1,!0),tM=QR(!0,!0);_t.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 Et({key:new Lt("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 dU=_t.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[K9(this.options)]}});_t.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Et({key:new Lt("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=e,s=[];if(!n||!r)return kt.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}))}),kt.create(t,s)}}})]}});var fU=_t.create({name:"gapCursor",addProseMirrorPlugins(){return[J9()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=tt(Ce(t,"allowGapCursor",n)))!=null?e:null}}}),kw="placeholder";function hU(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var pU=_t.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:kw,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${hU(this.options.dataAttribute)}`:`data-${kw}`;return[new Et({key:new Lt("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&&Df(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}),kt.create(e,s)}}})]}});_t.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Et({key:new Lt("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||oR(n.selection)||t.view.dragging?null:kt.create(n.doc,[sn.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function xw({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var mU=_t.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Lt(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 Et({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!xw({node:i,types:r})},apply:(o,s)=>{if(!o.docChanged||o.getMeta("__uniqueIDTransaction"))return s;const i=o.doc.lastChild;return!xw({node:i,types:r})}}})]}}),gU=_t.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>eM(t,e),redo:()=>({state:t,dispatch:e})=>tM(t,e)}},addProseMirrorPlugins(){return[uU(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()}}}),yU=_t.create({name:"starterKit",addExtensions(){var t,e,n,r;const o=[];return this.options.bold!==!1&&o.push(W6.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(j6.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(LR.configure(this.options.bulletList)),this.options.code!==!1&&o.push(U6.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(G6.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(Z6.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(dU.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(fU.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(J6.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(X6.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(gU.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(Q6.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(o9.configure(this.options.italic)),this.options.listItem!==!1&&o.push(FR.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(UR.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&o.push(jR.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(YR.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(B9.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(H9.configure(this.options.strike)),this.options.text!==!1&&o.push(q9.configure(this.options.text)),this.options.underline!==!1&&o.push(U9.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&o.push(mU.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),bU=yU,vU=pU,wU=ZR,kU=GR,xU=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,SU=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",Rt(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 Mq({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[kR({find:xU,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),EU=SU;const Zh=120,CU=gr({method:"POST"}).handler(yr("28b009a83a8070215402885cb1254e3f7ab49160f54c955f55e15fd2119831e7")),TU=gr({method:"POST"}).handler(yr("1f487dcb5d0b909c2785163b904a0ee48e748b32783309e964b4502d83a2e7a7"));function RU({assetId:t,label:e}){const[n,r]=x.useState(),[o,s]=x.useState(!1),i=x.useRef(0);return x.useEffect(()=>{i.current+=1;const a=i.current;let l;return(async()=>{try{s(!1);const c=await TU({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?C.jsx("img",{src:n,alt:e,className:"h-24 w-full rounded-md object-cover"}):C.jsx("div",{className:"bg-muted/55 text-muted-foreground flex h-24 w-full items-center justify-center rounded-md",children:o?C.jsx(rg,{className:"size-5"}):C.jsx(Jn,{className:"size-5 animate-spin"})})}function nM(t){const e=Ee.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]=x.useState(""),[f,h]=x.useState(!1),[p,m]=x.useState();let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[y,b]=x.useState(g),[w,k]=x.useState();let v,S;e[1]!==n||e[2]!==c||e[3]!==w||e[4]!==r?(v=()=>{const F=`${n}::${r}`;if(!c||w===F)return;let N=!1;return h(!0),m(void 0),CU({data:{currentFilePath:n,sourceMode:r}}).then(A=>{N||(b(A),k(F))}).catch(A=>{if(N)return;const z=A instanceof Error?A.message:String(A);m(z),Hn.error(`Unable to load image assets: ${z}`)}).finally(()=>{N||h(!1)}),()=>{N=!0}},S=[n,c,w,r],e[1]=n,e[2]=c,e[3]=w,e[4]=r,e[5]=v,e[6]=S):(v=e[5],S=e[6]),x.useEffect(v,S);let E;if(e[7]!==y||e[8]!==u){const F=u.trim().toLowerCase();E=y.filter(N=>F.length===0?!0:N.displayPath.toLowerCase().includes(F)||N.value.toLowerCase().includes(F)),e[7]=y,e[8]=u,e[9]=E}else E=e[9];const M=E;let D;if(e[10]!==a||e[11]!==p||e[12]!==M||e[13]!==f||e[14]!==l||e[15]!==o||e[16]!==s||e[17]!==u||e[18]!==r){const F=M.slice(0,Zh);let N;e[20]!==a?(N=de("space-y-2",a),e[20]=a,e[21]=N):N=e[21];let A;e[22]!==s||e[23]!==r?(A=s?C.jsxs("div",{className:"bg-muted/50 inline-flex rounded-md p-0.5",children:[C.jsx("button",{type:"button",className:de("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"}),C.jsx("button",{type:"button",className:de("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"})]}):C.jsxs(Wu,{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]=A):A=e[24];let z;e[25]===Symbol.for("react.memo_cache_sentinel")?(z=C.jsx(ff,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2"}),e[25]=z):z=e[25];let B;e[26]===Symbol.for("react.memo_cache_sentinel")?(B=G=>{d(G.target.value)},e[26]=B):B=e[26];let U;e[27]!==u?(U=C.jsxs("div",{className:"relative w-60 max-w-full",children:[z,C.jsx(er,{value:u,onChange:B,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]=U):U=e[28];let J;e[29]!==U||e[30]!==A?(J=C.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[A,U]}),e[29]=U,e[30]=A,e[31]=J):J=e[31];let Y;e[32]!==f?(Y=f?C.jsxs("div",{className:"text-muted-foreground flex h-32 items-center justify-center gap-2 text-sm",children:[C.jsx(Jn,{className:"size-4 animate-spin"}),"Loading assets..."]}):null,e[32]=f,e[33]=Y):Y=e[33];let K;e[34]!==p?(K=p?C.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]=K):K=e[35],D=C.jsxs("div",{className:N,children:[J,Y,K,!f&&!p?C.jsxs(C.Fragment,{children:[C.jsx("div",{className:de("grid grid-cols-3 gap-2 overflow-auto pr-1",l??"max-h-88"),children:F.map(G=>C.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(G.value),Hn.success(`Selected image: ${G.displayPath}`)},title:G.value,children:[C.jsx(RU,{assetId:G.id,label:G.displayPath}),C.jsx("p",{className:"text-foreground/85 truncate text-[11px]",children:G.displayPath})]},G.id))}),M.length===0?C.jsx("p",{className:"text-muted-foreground text-xs",children:"No assets found."}):null,M.length>Zh?C.jsxs("p",{className:"text-muted-foreground text-xs",children:["Showing first ",Zh," assets. Refine search for more."]}):null]}):null]}),e[10]=a,e[11]=p,e[12]=M,e[13]=f,e[14]=l,e[15]=o,e[16]=s,e[17]=u,e[18]=r,e[19]=D}else D=e[19];return D}function rM(t){const e=Ee.c(15),{currentFilePath:n,sourceMode:r,triggerLabel:o,onSelectPath:s}=t,[i,a]=x.useState(!1);let l,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=de(Ii({variant:"outline"}),"h-8 border-dashed text-xs"),c=C.jsx(rg,{className:"size-3.5"}),e[0]=l,e[1]=c):(l=e[0],c=e[1]);let u;e[2]!==o?(u=C.jsxs(Sl,{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=C.jsx(El,{className:"w-136 max-w-[calc(100vw-2rem)] p-3",children:C.jsx(nM,{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=C.jsxs(xl,{open:i,onOpenChange:a,children:[u,f]}),e[11]=i,e[12]=u,e[13]=f,e[14]=h):h=e[14],h}const oM=gr({method:"POST"}).handler(yr("8346edc0b9da2addd68ca674ed9b2030f439d40deb713c45ef88393f5bdb91b9"));function Ry(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Vs=Ry();function sM(t){Vs=t}var Qo={exec:()=>null};function Ze(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 MU=(()=>{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)}}>`)},OU=/^(?:[ \t]*(?:\n|$))+/,_U=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,NU=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ol=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,PU=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,My=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,iM=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,aM=Ze(iM).replace(/bull/g,My).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(),$U=Ze(iM).replace(/bull/g,My).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(),Oy=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,AU=/^[^\n]+/,_y=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,IU=Ze(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",_y).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),DU=Ze(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,My).getRegex(),Ff="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",Ny=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,zU=Ze("^ {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",Ny).replace("tag",Ff).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),lM=Ze(Oy).replace("hr",Ol).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",Ff).getRegex(),jU=Ze(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",lM).getRegex(),Py={blockquote:jU,code:_U,def:IU,fences:NU,heading:PU,hr:Ol,html:zU,lheading:aM,list:DU,newline:OU,paragraph:lM,table:Qo,text:AU},Sw=Ze("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ol).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",Ff).getRegex(),LU={...Py,lheading:$U,table:Sw,paragraph:Ze(Oy).replace("hr",Ol).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Sw).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",Ff).getRegex()},FU={...Py,html:Ze(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ny).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:Qo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ze(Oy).replace("hr",Ol).replace("heading",` *#{1,6} *[^
234
+ ]`).replace("lheading",aM).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},BU=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,VU=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,cM=/^( {2,}|\\)\n(?!\s*$)/,WU=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Bf=/[\p{P}\p{S}]/u,$y=/[\s\p{P}\p{S}]/u,uM=/[^\s\p{P}\p{S}]/u,HU=Ze(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,$y).getRegex(),dM=/(?!~)[\p{P}\p{S}]/u,qU=/(?!~)[\s\p{P}\p{S}]/u,UU=/(?:[^\s\p{P}\p{S}]|~)/u,fM=/(?![*_])[\p{P}\p{S}]/u,KU=/(?![*_])[\s\p{P}\p{S}]/u,YU=/(?:[^\s\p{P}\p{S}]|[*_])/u,GU=Ze(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",MU?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),hM=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ZU=Ze(hM,"u").replace(/punct/g,Bf).getRegex(),JU=Ze(hM,"u").replace(/punct/g,dM).getRegex(),pM="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",XU=Ze(pM,"gu").replace(/notPunctSpace/g,uM).replace(/punctSpace/g,$y).replace(/punct/g,Bf).getRegex(),QU=Ze(pM,"gu").replace(/notPunctSpace/g,UU).replace(/punctSpace/g,qU).replace(/punct/g,dM).getRegex(),e8=Ze("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,uM).replace(/punctSpace/g,$y).replace(/punct/g,Bf).getRegex(),t8=Ze(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,fM).getRegex(),n8="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",r8=Ze(n8,"gu").replace(/notPunctSpace/g,YU).replace(/punctSpace/g,KU).replace(/punct/g,fM).getRegex(),o8=Ze(/\\(punct)/,"gu").replace(/punct/g,Bf).getRegex(),s8=Ze(/^<(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(),i8=Ze(Ny).replace("(?:-->|$)","-->").getRegex(),a8=Ze("^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",i8).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ud=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,l8=Ze(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Ud).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),mM=Ze(/^!?\[(label)\]\[(ref)\]/).replace("label",Ud).replace("ref",_y).getRegex(),gM=Ze(/^!?\[(ref)\](?:\[\])?/).replace("ref",_y).getRegex(),c8=Ze("reflink|nolink(?!\\()","g").replace("reflink",mM).replace("nolink",gM).getRegex(),Ew=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ay={_backpedal:Qo,anyPunctuation:o8,autolink:s8,blockSkip:GU,br:cM,code:VU,del:Qo,delLDelim:Qo,delRDelim:Qo,emStrongLDelim:ZU,emStrongRDelimAst:XU,emStrongRDelimUnd:e8,escape:BU,link:l8,nolink:gM,punctuation:HU,reflink:mM,reflinkSearch:c8,tag:a8,text:WU,url:Qo},u8={...Ay,link:Ze(/^!?\[(label)\]\((.*?)\)/).replace("label",Ud).getRegex(),reflink:Ze(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ud).getRegex()},Sm={...Ay,emStrongRDelimAst:QU,emStrongLDelim:JU,delLDelim:t8,delRDelim:r8,url:Ze(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ew).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:Ze(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ew).getRegex()},d8={...Sm,br:Ze(cM).replace("{2,}","*").getRegex(),text:Ze(Sm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},bc={normal:Py,gfm:LU,pedantic:FU},fa={normal:Ay,gfm:Sm,breaks:d8,pedantic:u8},f8={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Cw=t=>f8[t];function rr(t,e){if(e){if(an.escapeTest.test(t))return t.replace(an.escapeReplace,Cw)}else if(an.escapeTestNoEncode.test(t))return t.replace(an.escapeReplaceNoEncode,Cw);return t}function Tw(t){try{t=encodeURI(t).replace(an.percentDecode,"%")}catch{return null}return t}function Rw(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 ha(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 h8(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 p8(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 Mw(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 m8(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let o=r[1];return e.split(`
235
+ `).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(`
236
+ `)}var Kd=class{options;rules;lexer;constructor(t){this.options=t||Vs}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:ha(n,`
237
+ `)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=m8(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=ha(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:ha(e[0],`
238
+ `)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=ha(e[0],`
239
+ `).split(`
240
+ `),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(`
241
+ `),u=c.replace(this.rules.other.blockquoteSetextReplace,`
242
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
243
+ ${c}`:c,o=o?`${o}
244
+ ${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+`
245
+ `+n.join(`
246
+ `),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+`
247
+ `+n.join(`
248
+ `),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(`
249
+ `);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=p8(e[2].split(`
250
+ `,1)[0],e[1].length),f=t.split(`
251
+ `,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+`
252
+ `,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(`
253
+ `,1)[0],S;if(f=v,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),S=f):S=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(S.search(this.rules.other.nonSpaceChar)>=p||!f.trim())u+=`
254
+ `+S.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+=`
255
+ `+f}h=!f.trim(),c+=v+`
256
+ `,t=t.substring(v.length+1),d=S.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=Rw(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
257
+ `):[],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(Rw(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)===`
258
+ `?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=ha(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=h8(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)),Mw(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 Mw(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}}}},Un=class Em{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Vs,this.options.tokenizer=this.options.tokenizer||new Kd,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:bc.normal,inline:fa.normal};this.options.pedantic?(n.block=bc.pedantic,n.inline=fa.pedantic):this.options.gfm&&(n.block=bc.gfm,this.options.breaks?n.inline=fa.breaks:n.inline=fa.gfm),this.tokenizer.rules=n}static get rules(){return{block:bc,inline:fa}}static lex(e,n){return new Em(n).lex(e)}static lexInline(e,n){return new Em(n).inlineTokens(e)}lex(e){e=e.replace(an.carriageReturn,`
259
+ `),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+=`
260
+ `: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(`
261
+ `)?"":`
262
+ `)+o.raw,i.text+=`
263
+ `+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(`
264
+ `)?"":`
265
+ `)+o.raw,i.text+=`
266
+ `+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(`
267
+ `)?"":`
268
+ `)+o.raw,i.text+=`
269
+ `+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(`
270
+ `)?"":`
271
+ `)+o.raw,i.text+=`
272
+ `+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}},Yd=class{options;parser;constructor(t){this.options=t||Vs}space(t){return""}code({text:t,lang:e,escaped:n}){let r=(e||"").match(an.notSpaceStart)?.[0],o=t.replace(an.endingNewline,"")+`
273
+ `;return r?'<pre><code class="language-'+rr(r)+'">'+(n?o:rr(o,!0))+`</code></pre>
274
+ `:"<pre><code>"+(n?o:rr(o,!0))+`</code></pre>
275
+ `}blockquote({tokens:t}){return`<blockquote>
276
+ ${this.parser.parse(t)}</blockquote>
277
+ `}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
278
+ `}hr(t){return`<hr>
279
+ `}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+`>
280
+ `+r+"</"+o+`>
281
+ `}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
282
+ `}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
283
+ `}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>
284
+ <thead>
285
+ `+e+`</thead>
286
+ `+r+`</table>
287
+ `}tablerow({text:t}){return`<tr>
288
+ ${t}</tr>
289
+ `}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
290
+ `}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>${rr(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=Tw(t);if(o===null)return r;t=o;let s='<a href="'+t+'"';return e&&(s+=' title="'+rr(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=Tw(t);if(o===null)return rr(n);t=o;let s=`<img src="${t}" alt="${rr(n)}"`;return e&&(s+=` title="${rr(e)}"`),s+=">",s}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:rr(t.text)}},Iy=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}},Kn=class Cm{options;renderer;textRenderer;constructor(e){this.options=e||Vs,this.options.renderer=this.options.renderer||new Yd,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Iy}static parse(e,n){return new Cm(n).parse(e)}static parseInline(e,n){return new Cm(n).parseInline(e)}parse(e){let n="";for(let r=0;r<e.length;r++){let o=e[r];if(this.options.extensions?.renderers?.[o.type]){let i=o,a=this.options.extensions.renderers[i.type].call({parser:this},i);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(i.type)){n+=a||"";continue}}let s=o;switch(s.type){case"space":{n+=this.renderer.space(s);break}case"hr":{n+=this.renderer.hr(s);break}case"heading":{n+=this.renderer.heading(s);break}case"code":{n+=this.renderer.code(s);break}case"table":{n+=this.renderer.table(s);break}case"blockquote":{n+=this.renderer.blockquote(s);break}case"list":{n+=this.renderer.list(s);break}case"checkbox":{n+=this.renderer.checkbox(s);break}case"html":{n+=this.renderer.html(s);break}case"def":{n+=this.renderer.def(s);break}case"paragraph":{n+=this.renderer.paragraph(s);break}case"text":{n+=this.renderer.text(s);break}default:{let i='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return n}parseInline(e,n=this.renderer){let r="";for(let o=0;o<e.length;o++){let s=e[o];if(this.options.extensions?.renderers?.[s.type]){let a=this.options.extensions.renderers[s.type].call({parser:this},s);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){r+=a||"";continue}}let i=s;switch(i.type){case"escape":{r+=n.text(i);break}case"html":{r+=n.html(i);break}case"link":{r+=n.link(i);break}case"image":{r+=n.image(i);break}case"checkbox":{r+=n.checkbox(i);break}case"strong":{r+=n.strong(i);break}case"em":{r+=n.em(i);break}case"codespan":{r+=n.codespan(i);break}case"br":{r+=n.br(i);break}case"del":{r+=n.del(i);break}case"text":{r+=n.text(i);break}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}},Ta=class{options;block;constructor(t){this.options=t||Vs}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?Un.lex:Un.lexInline}provideParser(){return this.block?Kn.parse:Kn.parseInline}},g8=class{defaults=Ry();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Kn;Renderer=Yd;TextRenderer=Iy;Lexer=Un;Tokenizer=Kd;Hooks=Ta;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(let r of t)switch(n=n.concat(e.call(this,r)),r.type){case"table":{let o=r;for(let s of o.header)n=n.concat(this.walkTokens(s.tokens,e));for(let s of o.rows)for(let i of s)n=n.concat(this.walkTokens(i.tokens,e));break}case"list":{let o=r;n=n.concat(this.walkTokens(o.items,e));break}default:{let o=r;this.defaults.extensions?.childTokens?.[o.type]?this.defaults.extensions.childTokens[o.type].forEach(s=>{let i=o[s].flat(1/0);n=n.concat(this.walkTokens(i,e))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let s=e.renderers[o.name];s?e.renderers[o.name]=function(...i){let a=o.renderer.apply(this,i);return a===!1&&(a=s.apply(this,i)),a}:e.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[o.level];s?s.unshift(o.tokenizer):e[o.level]=[o.tokenizer],o.start&&(o.level==="block"?e.startBlock?e.startBlock.push(o.start):e.startBlock=[o.start]:o.level==="inline"&&(e.startInline?e.startInline.push(o.start):e.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(e.childTokens[o.name]=o.childTokens)}),r.extensions=e),n.renderer){let o=this.defaults.renderer||new Yd(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 Kd(this.defaults);for(let s in n.tokenizer){if(!(s in o))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let i=s,a=n.tokenizer[i],l=o[i];o[i]=(...c)=>{let u=a.apply(o,c);return u===!1&&(u=l.apply(o,c)),u}}r.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new Ta;for(let s in n.hooks){if(!(s in o))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let i=s,a=n.hooks[i],l=o[i];Ta.passThroughHooks.has(s)?o[i]=c=>{if(this.defaults.async&&Ta.passThroughHooksRespectAsync.has(s))return(async()=>{let d=await a.call(o,c);return l.call(o,d)})();let u=a.call(o,c);return l.call(o,u)}:o[i]=(...c)=>{if(this.defaults.async)return(async()=>{let d=await a.apply(o,c);return d===!1&&(d=await l.apply(o,c)),d})();let u=a.apply(o,c);return u===!1&&(u=l.apply(o,c)),u}}r.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(i){let a=[];return a.push(s.call(this,i)),o&&(a=a.concat(o.call(this,i))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Un.lex(t,e??this.defaults)}parser(t,e){return Kn.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?Un.lex:Un.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?Kn.parse:Kn.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?Un.lex:Un.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?Kn.parse:Kn.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+=`
291
+ Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error occurred:</p><pre>"+rr(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},Os=new g8;function ot(t,e){return Os.parse(t,e)}ot.options=ot.setOptions=function(t){return Os.setOptions(t),ot.defaults=Os.defaults,sM(ot.defaults),ot};ot.getDefaults=Ry;ot.defaults=Vs;ot.use=function(...t){return Os.use(...t),ot.defaults=Os.defaults,sM(ot.defaults),ot};ot.walkTokens=function(t,e){return Os.walkTokens(t,e)};ot.parseInline=Os.parseInline;ot.Parser=Kn;ot.parser=Kn.parse;ot.Renderer=Yd;ot.TextRenderer=Iy;ot.Lexer=Un;ot.lexer=Un.lex;ot.Tokenizer=Kd;ot.Hooks=Ta;ot.parse=ot;ot.options;ot.setOptions;ot.use;ot.walkTokens;ot.parseInline;Kn.parse;Un.lex;var Jh,Ow;function y8(){if(Ow)return Jh;Ow=1;function t(_){for(var q=1;q<arguments.length;q++){var T=arguments[q];for(var O in T)T.hasOwnProperty(O)&&(_[O]=T[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]===`
292
+ `;)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(T){return _.getElementsByTagName(T).length})}var m={};m.paragraph={filter:"p",replacement:function(_){return`
293
+
294
+ `+_+`
295
+
296
+ `}},m.lineBreak={filter:"br",replacement:function(_,q,T){return T.br+`
297
+ `}},m.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(_,q,T){var O=Number(q.nodeName.charAt(1));if(T.headingStyle==="setext"&&O<3){var V=e(O===1?"=":"-",_.length);return`
298
+
299
+ `+_+`
300
+ `+V+`
301
+
302
+ `}else return`
303
+
304
+ `+e("#",O)+" "+_+`
305
+
306
+ `}},m.blockquote={filter:"blockquote",replacement:function(_){return _=o(_).replace(/^/gm,"> "),`
307
+
308
+ `+_+`
309
+
310
+ `}},m.list={filter:["ul","ol"],replacement:function(_,q){var T=q.parentNode;return T.nodeName==="LI"&&T.lastElementChild===q?`
311
+ `+_:`
312
+
313
+ `+_+`
314
+
315
+ `}},m.listItem={filter:"li",replacement:function(_,q,T){var O=T.bulletListMarker+" ",V=q.parentNode;if(V.nodeName==="OL"){var H=V.getAttribute("start"),Q=Array.prototype.indexOf.call(V.children,q);O=(H?Number(H)+Q:Q+1)+". "}var ee=/\n$/.test(_);return _=o(_)+(ee?`
316
+ `:""),_=_.replace(/\n/gm,`
317
+ `+" ".repeat(O.length)),O+_+(q.nextSibling?`
318
+ `:"")}},m.indentedCodeBlock={filter:function(_,q){return q.codeBlockStyle==="indented"&&_.nodeName==="PRE"&&_.firstChild&&_.firstChild.nodeName==="CODE"},replacement:function(_,q,T){return`
319
+
320
+ `+q.firstChild.textContent.replace(/\n/g,`
321
+ `)+`
322
+
323
+ `}},m.fencedCodeBlock={filter:function(_,q){return q.codeBlockStyle==="fenced"&&_.nodeName==="PRE"&&_.firstChild&&_.firstChild.nodeName==="CODE"},replacement:function(_,q,T){for(var O=q.firstChild.getAttribute("class")||"",V=(O.match(/language-(\S+)/)||[null,""])[1],H=q.firstChild.textContent,Q=T.fence.charAt(0),ee=3,re=new RegExp("^"+Q+"{3,}","gm"),oe;oe=re.exec(H);)oe[0].length>=ee&&(ee=oe[0].length+1);var ne=e(Q,ee);return`
324
+
325
+ `+ne+V+`
326
+ `+H.replace(/\n$/,"")+`
327
+ `+ne+`
328
+
329
+ `}},m.horizontalRule={filter:"hr",replacement:function(_,q,T){return`
330
+
331
+ `+T.hr+`
332
+
333
+ `}},m.inlineLink={filter:function(_,q){return q.linkStyle==="inlined"&&_.nodeName==="A"&&_.getAttribute("href")},replacement:function(_,q){var T=q.getAttribute("href");T&&(T=T.replace(/([()])/g,"\\$1"));var O=g(q.getAttribute("title"));return O&&(O=' "'+O.replace(/"/g,'\\"')+'"'),"["+_+"]("+T+O+")"}},m.referenceLink={filter:function(_,q){return q.linkStyle==="referenced"&&_.nodeName==="A"&&_.getAttribute("href")},replacement:function(_,q,T){var O=q.getAttribute("href"),V=g(q.getAttribute("title"));V&&(V=' "'+V+'"');var H,Q;switch(T.linkReferenceStyle){case"collapsed":H="["+_+"][]",Q="["+_+"]: "+O+V;break;case"shortcut":H="["+_+"]",Q="["+_+"]: "+O+V;break;default:var ee=this.references.length+1;H="["+_+"]["+ee+"]",Q="["+ee+"]: "+O+V}return this.references.push(Q),H},references:[],append:function(_){var q="";return this.references.length&&(q=`
334
+
335
+ `+this.references.join(`
336
+ `)+`
337
+
338
+ `,this.references=[]),q}},m.emphasis={filter:["em","i"],replacement:function(_,q,T){return _.trim()?T.emDelimiter+_+T.emDelimiter:""}},m.strong={filter:["strong","b"],replacement:function(_,q,T){return _.trim()?T.strongDelimiter+_+T.strongDelimiter:""}},m.code={filter:function(_){var q=_.previousSibling||_.nextSibling,T=_.parentNode.nodeName==="PRE"&&!q;return _.nodeName==="CODE"&&!T},replacement:function(_){if(!_)return"";_=_.replace(/\r?\n|\r/g," ");for(var q=/^`|^ .*?[^ ].* $|`$/.test(_)?" ":"",T="`",O=_.match(/`+/gm)||[];O.indexOf(T)!==-1;)T=T+"`";return T+q+_+q+T}},m.image={filter:"img",replacement:function(_,q){var T=g(q.getAttribute("alt")),O=q.getAttribute("src")||"",V=g(q.getAttribute("title")),H=V?' "'+V+'"':"";return O?"!["+T+"]("+O+H+")":""}};function g(_){return _?_.replace(/(\n+\s*)+/g,`
339
+ `):""}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,T){for(var O=0;O<_.length;O++){var V=_[O];if(w(V,q,T))return V}}function w(_,q,T){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,T))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function k(_){var q=_.element,T=_.isBlock,O=_.isVoid,V=_.isPre||function(le){return le.nodeName==="PRE"};if(!(!q.firstChild||V(q))){for(var H=null,Q=!1,ee=null,re=S(ee,q,V);re!==q;){if(re.nodeType===3||re.nodeType===4){var oe=re.data.replace(/[ \r\n\t]+/g," ");if((!H||/ $/.test(H.data))&&!Q&&oe[0]===" "&&(oe=oe.substr(1)),!oe){re=v(re);continue}re.data=oe,H=re}else if(re.nodeType===1)T(re)||re.nodeName==="BR"?(H&&(H.data=H.data.replace(/ $/,"")),H=null,Q=!1):O(re)||V(re)?(H=null,Q=!0):H&&(Q=!1);else{re=v(re);continue}var ne=S(ee,re,V);ee=re,re=ne}H&&(H.data=H.data.replace(/ $/,""),H.data||v(H))}}function v(_){var q=_.nextSibling||_.parentNode;return _.parentNode.removeChild(_),q}function S(_,q,T){return _&&_.parentNode===q||T(q)?q.nextSibling||q.parentNode:q.firstChild||q.nextSibling||q.parentNode}var E=typeof window<"u"?window:{};function M(){var _=E.DOMParser,q=!1;try{new _().parseFromString("","text/html")&&(q=!0)}catch{}return q}function D(){var _=function(){};return F()?_.prototype.parseFromString=function(q){var T=new window.ActiveXObject("htmlfile");return T.designMode="on",T.open(),T.write(q),T.close(),T}:_.prototype.parseFromString=function(q){var T=document.implementation.createHTMLDocument("");return T.open(),T.write(q),T.close(),T},_}function F(){var _=!1;try{document.implementation.createHTMLDocument("").open()}catch{E.ActiveXObject&&(_=!0)}return _}var N=M()?E.DOMParser:D();function A(_,q){var T;if(typeof _=="string"){var O=B().parseFromString('<x-turndown id="turndown-root">'+_+"</x-turndown>","text/html");T=O.getElementById("turndown-root")}else T=_.cloneNode(!0);return k({element:T,isBlock:i,isVoid:l,isPre:q.preformattedCode?U:null}),T}var z;function B(){return z=z||new N,z}function U(_){return _.nodeName==="PRE"||_.nodeName==="CODE"}function J(_,q){return _.isBlock=i(_),_.isCode=_.nodeName==="CODE"||_.parentNode.isCode,_.isBlank=Y(_),_.flankingWhitespace=K(_,q),_}function Y(_){return!l(_)&&!d(_)&&/^\s*$/i.test(_.textContent)&&!c(_)&&!f(_)}function K(_,q){if(_.isBlock||q.preformattedCode&&_.isCode)return{leading:"",trailing:""};var T=G(_.textContent);return T.leadingAscii&&L("left",_,q)&&(T.leading=T.leadingNonAscii),T.trailingAscii&&L("right",_,q)&&(T.trailing=T.trailingNonAscii),{leading:T.leading,trailing:T.trailing}}function G(_){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 L(_,q,T){var O,V,H;return _==="left"?(O=q.previousSibling,V=/ $/):(O=q.nextSibling,V=/^ /),O&&(O.nodeType===3?H=V.test(O.nodeValue):T.preformattedCode&&O.nodeName==="CODE"?H=!1:O.nodeType===1&&!i(O)&&(H=V.test(O.textContent))),H}var W=Array.prototype.reduce,$=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function j(_){if(!(this instanceof j))return new j(_);var q={rules:m,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(T,O){return O.isBlock?`
340
+
341
+ `:""},keepReplacement:function(T,O){return O.isBlock?`
342
+
343
+ `+O.outerHTML+`
344
+
345
+ `:O.outerHTML},defaultReplacement:function(T,O){return O.isBlock?`
346
+
347
+ `+T+`
348
+
349
+ `:T}};this.options=t({},q,_),this.rules=new y(this.options)}j.prototype={turndown:function(_){if(!X(_))throw new TypeError(_+" is not a string, or an element/document/fragment node.");if(_==="")return"";var q=R.call(this,new A(_,this.options));return P.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 $.reduce(function(q,T){return q.replace(T[0],T[1])},_)}};function R(_){var q=this;return W.call(_.childNodes,function(T,O){O=new J(O,q.options);var V="";return O.nodeType===3?V=O.isCode?O.nodeValue:q.escape(O.nodeValue):O.nodeType===1&&(V=I.call(q,O)),Z(T,V)},"")}function P(_){var q=this;return this.rules.forEach(function(T){typeof T.append=="function"&&(_=Z(_,T.append(q.options)))}),_.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function I(_){var q=this.rules.forNode(_),T=R.call(this,_),O=_.flankingWhitespace;return(O.leading||O.trailing)&&(T=T.trim()),O.leading+q.replacement(T,_,this.options)+O.trailing}function Z(_,q){var T=r(_),O=n(q),V=Math.max(_.length-T.length,q.length-O.length),H=`
350
+
351
+ `.substring(0,V);return T+H+O}function X(_){return _!=null&&(typeof _=="string"||_.nodeType&&(_.nodeType===1||_.nodeType===9||_.nodeType===11))}return Jh=j,Jh}var b8=y8();const v8=Nm(b8);var _w=/highlight-(?:text|source)-([a-z0-9]+)/;function w8(t){t.addRule("highlightedCodeBlock",{filter:function(e){var n=e.firstChild;return e.nodeName==="DIV"&&_w.test(e.className)&&n&&n.nodeName==="PRE"},replacement:function(e,n,r){var o=n.className||"",s=(o.match(_w)||[null,""])[1];return`
352
+
353
+ `+r.fence+s+`
354
+ `+n.firstChild.textContent+`
355
+ `+r.fence+`
356
+
357
+ `}})}function k8(t){t.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(e){return"~"+e+"~"}})}var x8=Array.prototype.indexOf,S8=Array.prototype.every,Ki={};Ki.tableCell={filter:["th","td"],replacement:function(t,e){return yM(t,e)}};Ki.tableRow={filter:"tr",replacement:function(t,e){var n="",r={left:":--",right:"--:",center:":-:"};if(Dy(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+=yM(s,e.childNodes[o])}return`
358
+ `+t+(n?`
359
+ `+n:"")}};Ki.table={filter:function(t){return t.nodeName==="TABLE"&&Dy(t.rows[0])},replacement:function(t){return t=t.replace(`
360
+
361
+ `,`
362
+ `),`
363
+
364
+ `+t+`
365
+
366
+ `}};Ki.tableSection={filter:["thead","tbody","tfoot"],replacement:function(t){return t}};function Dy(t){var e=t.parentNode;return e.nodeName==="THEAD"||e.firstChild===t&&(e.nodeName==="TABLE"||E8(e))&&S8.call(t.childNodes,function(n){return n.nodeName==="TH"})}function E8(t){var e=t.previousSibling;return t.nodeName==="TBODY"&&(!e||e.nodeName==="THEAD"&&/^\s*$/i.test(e.textContent))}function yM(t,e){var n=x8.call(e.parentNode.childNodes,e),r=" ";return n===0&&(r="| "),r+t+" |"}function C8(t){t.keep(function(n){return n.nodeName==="TABLE"&&!Dy(n.rows[0])});for(var e in Ki)t.addRule(e,Ki[e])}function T8(t){t.addRule("taskListItems",{filter:function(e){return e.type==="checkbox"&&e.parentNode.nodeName==="LI"},replacement:function(e,n){return(n.checked?"[x]":"[ ]")+" "}})}function R8(t){t.use([w8,k8,C8,T8])}const Vf=new v8({headingStyle:"atx",codeBlockStyle:"fenced",bulletListMarker:"-",emDelimiter:"*",strongDelimiter:"**"});Vf.use(R8);Vf.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})`:""}});Vf.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,`
367
+ `);return`
368
+ - [${n?"x":" "}] ${r}
369
+ `}});function Nw(t){const e=ot.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 M8(t){return Vf.turndown(t).replace(/\n{3,}/g,`
370
+
371
+ `).trimEnd()}const O8="image",Gd="data-original-src",_8=EU.extend({addAttributes(){return{...this.parent?.(),originalSrc:{default:null,parseHTML:t=>t.getAttribute(Gd),renderHTML:t=>{const e=t.originalSrc;return typeof e!="string"||e.length===0?{}:{[Gd]:e}}}}}});function N8(t){const e=t.trim().toLowerCase();return!(!e||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:")||e.startsWith("blob:"))}function P8(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 Pn(t){const e=Ee.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=de("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=C.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 Pw=[{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 $8({content:t,onChange:e,currentFilePath:n}){const[r,o]=x.useState(),[s,i]=x.useState(0),[a,l]=x.useState(!1),[c,u]=x.useState("assets"),[d,f]=x.useState("asset"),[h,p]=x.useState(""),m=x.useRef(!1),g=x.useRef(t),y=x.useRef(new Map),b=x.useRef(new Set),w=x.useCallback(N=>{const A=P8(N);o(A),i(0)},[]),k=x.useCallback(N=>{if(!n)return;const A=Array.from(N.view.dom.querySelectorAll("img"));for(const z of A){const U=(z.getAttribute(Gd)??z.getAttribute("src")??"").trim();if(!N8(U))continue;const J=`${n}::${U}`,Y=y.current.get(J);if(Y){z.getAttribute("src")!==Y&&z.setAttribute("src",Y);continue}b.current.has(J)||(b.current.add(J),oM({data:{currentFilePath:n,sourcePath:U}}).then(async K=>{if(!K.ok)throw new Error(`Preview request failed (${K.status})`);const G=await K.blob(),L=URL.createObjectURL(G);y.current.set(J,L);const W=Array.from(N.view.dom.querySelectorAll("img"));for(const $ of W)($.getAttribute(Gd)??$.getAttribute("src")??"").trim()===U&&$.setAttribute("src",L)}).catch(()=>{}).finally(()=>{b.current.delete(J)}))}},[n]),v=$6({immediatelyRender:!1,extensions:[bU.configure({heading:{levels:[1,2,3]}}),O9.configure({openOnClick:!1,linkOnPaste:!0,autolink:!0}),vU.configure({placeholder:"Start writing your article..."}),wU,kU.configure({nested:!0}),_8.configure({inline:!1,allowBase64:!1})],content:Nw(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 A=M8(N.getHTML());A!==g.current&&(g.current=A,e(A))},onSelectionUpdate:({editor:N})=>{w(N)}});x.useEffect(()=>()=>{for(const N of y.current.values())URL.revokeObjectURL(N);y.current.clear(),b.current.clear()},[]),x.useEffect(()=>{for(const N of y.current.values())URL.revokeObjectURL(N);y.current.clear(),b.current.clear()},[n]),x.useEffect(()=>{if(v&&t!==g.current){m.current=!0;try{v.commands.setContent(Nw(t),{emitUpdate:!1}),g.current=t,w(v),k(v)}finally{m.current=!1}}},[k,t,v,w]),x.useEffect(()=>{v&&k(v)},[k,v]);const S=x.useMemo(()=>r?r.query.length===0?Pw:Pw.filter(N=>N.label.toLowerCase().includes(r.query)?!0:N.aliases.some(A=>A.includes(r.query))):[],[r]),E=x.useCallback(N=>{const A=N.trim();!v||A.length===0||(v.chain().focus().setImage({src:A,alt:O8}).run(),p(""),l(!1))},[v]),M=x.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]),D=x.useCallback(()=>{if(!v)return;const N=v.getAttributes("link").href,A=window.prompt("Enter link URL",N??"https://");if(A===null)return;const z=A.trim();if(z.length===0){v.chain().focus().unsetLink().run();return}v.chain().focus().extendMarkRange("link").setLink({href:z}).run()},[v]),F=x.useCallback(N=>{if(!(!r||S.length===0)){if(N.key==="ArrowDown"){N.preventDefault(),i(A=>(A+1)%S.length);return}if(N.key==="ArrowUp"){N.preventDefault(),i(A=>A<=0?S.length-1:A-1);return}if(N.key==="Escape"){N.preventDefault(),o(void 0);return}if(N.key==="Enter"||N.key==="Tab"){N.preventDefault();const A=S[s%S.length];M(A)}}},[M,S,s,r]);return v?C.jsxs("div",{className:"relative flex h-full min-h-0 w-full flex-col overflow-hidden",onKeyDownCapture:F,children:[C.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:[C.jsx(Pn,{label:"Heading 1",active:v.isActive("heading",{level:1}),onClick:()=>v.chain().focus().toggleHeading({level:1}).run(),children:C.jsx(B$,{className:"size-3.5"})}),C.jsx(Pn,{label:"Heading 2",active:v.isActive("heading",{level:2}),onClick:()=>v.chain().focus().toggleHeading({level:2}).run(),children:C.jsx(W$,{className:"size-3.5"})}),C.jsx(Pn,{label:"Bullet list",active:v.isActive("bulletList"),onClick:()=>v.chain().focus().toggleBulletList().run(),children:C.jsx(eA,{className:"size-3.5"})}),C.jsx(Pn,{label:"Numbered list",active:v.isActive("orderedList"),onClick:()=>v.chain().focus().toggleOrderedList().run(),children:C.jsx(X$,{className:"size-3.5"})}),C.jsx(Pn,{label:"Checklist",active:v.isActive("taskList"),onClick:()=>v.chain().focus().toggleTaskList().run(),children:C.jsx(Z$,{className:"size-3.5"})}),C.jsx(Pn,{label:"Quote",active:v.isActive("blockquote"),onClick:()=>v.chain().focus().toggleBlockquote().run(),children:C.jsx(pA,{className:"size-3.5"})}),C.jsx(Pn,{label:"Code block",active:v.isActive("codeBlock"),onClick:()=>v.chain().focus().toggleCodeBlock().run(),children:C.jsx(L$,{className:"size-3.5"})}),C.jsx(Pn,{label:"Divider",onClick:()=>v.chain().focus().setHorizontalRule().run(),children:C.jsx(nA,{className:"size-3.5"})}),C.jsx(Pn,{label:"Bold",active:v.isActive("bold"),onClick:()=>v.chain().focus().toggleBold().run(),children:"B"}),C.jsx(Pn,{label:"Italic",active:v.isActive("italic"),onClick:()=>v.chain().focus().toggleItalic().run(),children:C.jsx("span",{className:"italic",children:"I"})}),C.jsx(Pn,{label:"Inline code",active:v.isActive("code"),onClick:()=>v.chain().focus().toggleCode().run(),children:"</>"}),C.jsx(Pn,{label:"Link",active:v.isActive("link"),onClick:D,children:C.jsx(Y$,{className:"size-3.5"})}),C.jsxs(xl,{open:a,onOpenChange:l,children:[C.jsx(Sl,{className:de("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:C.jsx(rg,{className:"size-3.5"})}),C.jsx(El,{className:"w-xl max-w-[calc(100vw-2rem)] p-3",children:C.jsxs("div",{className:"space-y-2",children:[C.jsxs("div",{className:"bg-muted/50 inline-flex rounded-md p-0.5",children:[C.jsx("button",{type:"button",className:de("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"}),C.jsx("button",{type:"button",className:de("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?C.jsx(nM,{currentFilePath:n,sourceMode:d,onSourceModeChange:f,onSelectPath:E}):C.jsx("p",{className:"text-muted-foreground text-xs",children:"Select a file to browse project assets."}):C.jsxs("div",{className:"space-y-2",children:[C.jsx(er,{value:h,onChange:N=>p(N.target.value),className:"bg-muted/50",placeholder:"Paste image URL or path","aria-label":"Image URL"}),C.jsx("div",{className:"flex justify-end",children:C.jsx(yn,{type:"button",size:"sm",variant:"secondary",onClick:()=>{h.trim().length!==0&&E(h)},children:"Insert image"})})]})]})})]})]}),C.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:C.jsx("div",{className:"mx-auto w-full max-w-3xl px-8 py-6",children:C.jsx(ER,{editor:v})})}),r&&S.length>0?C.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:S.map((N,A)=>C.jsx("button",{type:"button",className:de("w-full rounded-md px-2 py-1.5 text-left text-xs transition-colors",A===s?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/70 hover:text-foreground"),onMouseDown:z=>{z.preventDefault(),M(N)},children:N.label},N.key))}):null,r&&S.length===0?C.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]}):C.jsx("div",{className:"text-muted-foreground px-8 py-6 text-sm",children:"Loading editor..."})}const $w=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},A8=(t=>t?$w(t):$w),I8=t=>t;function D8(t,e=I8){const n=me.useSyncExternalStore(t.subscribe,me.useCallback(()=>e(t.getState()),[t,e]),me.useCallback(()=>e(t.getInitialState()),[t,e]));return me.useDebugValue(n),n}const Aw=t=>{const e=A8(t),n=r=>D8(e,r);return Object.assign(n,e),n},z8=(t=>t?Aw(t):Aw),j8=/^\s*(import|export)\s+/,L8=/<\/?[A-Z][A-Za-z0-9._-]*(\s|>|\/>)/,F8=/<\s*\/?\s*>/,B8=/^\s*\{[\s\S]*\}\s*$/,V8=/^\s*(```|~~~)/;function W8(t){return V8.test(t)}function H8(t){return j8.test(t)}function bM(t){return L8.test(t)||F8.test(t)}function q8(t){const e=t.trim();return e.length<2||bM(e)?!1:B8.test(e)}function U8(t){const e=t.split(/\r?\n/);let n=!1;for(const r of e){if(W8(r)){n=!n;continue}if(!n){if(H8(r))return{supported:!1,reason:"contains MDX import/export statements"};if(bM(r))return{supported:!1,reason:"contains JSX component syntax"};if(q8(r))return{supported:!1,reason:"contains standalone MDX expressions"}}}return{supported:!0}}function Iw(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function vc(t){return JSON.parse(JSON.stringify(t))}function Tm(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(!Tm(t[n],e[n]))return!1;return!0}if(Iw(t)&&Iw(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)||!Tm(t[o],e[o]))return!1;return!0}return!1}function K8(t){const e=t.trim();return e.length>0?e:void 0}function Xh(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}function wc(t,e,n){const r={...t};return n===void 0?delete r[e]:r[e]=n,r}function Js(t){return Tm(t.draft,t.initial)?t.contentDraft!==t.initialContent:!0}function Qh(t){const e=U8(t);return e.supported?{richModeAvailability:"supported",richModeBlockReason:void 0}:{richModeAvailability:"blocked",richModeBlockReason:e.reason}}const dt=z8(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=vc(r),l=Qh(o);return{collectionName:e,fileId:n,draft:a,initial:vc(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=wc(r.draft,e,n);return{draft:o,dirty:Js({draft:o,initial:r.initial,contentDraft:r.contentDraft,initialContent:r.initialContent})}}),setContentDraft:e=>t(n=>({...(()=>{const r=Qh(e);return{...r,editorMode:r.richModeAvailability==="blocked"?"basic":n.editorMode}})(),contentDraft:e,dirty:Js({draft:n.draft,initial:n.initial,contentDraft:e,initialContent:n.initialContent})})),applyRevisionSnapshot:({draft:e,content:n})=>t(r=>{const o=vc(e),s=Qh(n);return{...s,editorMode:s.richModeAvailability==="blocked"?"basic":r.editorMode,draft:o,contentDraft:n,dirty:Js({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:vc(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=K8(n);if(!o)return r;const s=Xh(r.draft[e]);if(s.includes(o))return{chipInputs:{...r.chipInputs,[e]:""}};const i=[...s,o],a=wc(r.draft,e,i);return{draft:a,dirty:Js({draft:a,initial:r.initial,contentDraft:r.contentDraft,initialContent:r.initialContent}),chipInputs:{...r.chipInputs,[e]:""}}}),removeChipValue:(e,n)=>t(r=>{const o=Xh(r.draft[e]);if(n<0||n>=o.length)return r;const s=o.filter((a,l)=>l!==n),i=wc(r.draft,e,s.length>0?s:void 0);return{draft:i,dirty:Js({draft:i,initial:r.initial,contentDraft:r.contentDraft,initialContent:r.initialContent})}}),removeLastChipValue:e=>t(n=>{const r=Xh(n.draft[e]);if(r.length===0)return n;const o=r.slice(0,-1),s=wc(n.draft,e,o.length>0?o:void 0);return{draft:s,dirty:Js({draft:s,initial:n.initial,contentDraft:n.contentDraft,initialContent:n.initialContent})}})}));function Y8(t){const e=Ee.c(12),{currentFilePath:n}=t,r=dt(Q8),o=dt(X8),s=dt(J8),i=dt(Z8),a=dt(G8),l=s==="basic"&&i==="blocked"&&!!a;let c;e[0]!==a||e[1]!==l?(c=l?C.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=C.jsx("div",{className:"flex h-full min-h-0 w-full overflow-hidden",children:s==="rich"&&i==="supported"?C.jsx($8,{content:r,currentFilePath:n,onChange:o}):C.jsx("div",{className:"mx-auto flex h-full min-h-0 w-full max-w-3xl flex-col overflow-hidden",children:C.jsx(Hz,{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=C.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 G8(t){return t.richModeBlockReason}function Z8(t){return t.richModeAvailability}function J8(t){return t.editorMode}function X8(t){return t.setContentDraft}function Q8(t){return t.contentDraft}function e7(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 t7={},Ra={};function as(t,e){try{const r=(t7[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in Ra?Ra[r]:Dw(r,r.split(":"))}catch{if(t in Ra)return Ra[t];const n=t?.match(n7);return n?Dw(t,n.slice(1)):NaN}}const n7=/([+-]\d\d):?(\d\d)?/;function Dw(t,e){const n=+(e[0]||0),r=+(e[1]||0),o=+(e[2]||0)/60;return Ra[t]=n*60+r>0?n*60+r+o:n*60-r-o}class fr extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(as(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)),vM(this),Rm(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new fr(...n,e):new fr(Date.now(),e)}withTimeZone(e){return new fr(+this,e)}getTimezoneOffset(){const e=-as(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),Rm(this),+this}[Symbol.for("constructDateFrom")](e){return new fr(+new Date(e),this.timeZone)}}const zw=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!zw.test(t))return;const e=t.replace(zw,"$1UTC");fr.prototype[e]&&(t.startsWith("get")?fr.prototype[t]=function(){return this.internal[e]()}:(fr.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),r7(this),+this},fr.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),Rm(this),+this}))});function Rm(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-as(t.timeZone,t)*60))}function r7(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()),vM(t)}function vM(t){const e=as(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(-(as(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=as(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=as(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 fr{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} (${e7(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 wM=6048e5,o7=864e5,jw=Symbol.for("constructDateFrom");function It(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&jw in t?t[jw](e):t instanceof Date?new t.constructor(e):new Date(e)}function ct(t,e){return It(e||t,t)}function kM(t,e,n){const r=ct(t,n?.in);return isNaN(e)?It(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function xM(t,e,n){const r=ct(t,n?.in);if(isNaN(e))return It(t,NaN);if(!e)return r;const o=r.getDate(),s=It(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 s7={};function _l(){return s7}function Yi(t,e){const n=_l(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,o=ct(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 fl(t,e){return Yi(t,{...e,weekStartsOn:1})}function SM(t,e){const n=ct(t,e?.in),r=n.getFullYear(),o=It(n,0);o.setFullYear(r+1,0,4),o.setHours(0,0,0,0);const s=fl(o),i=It(n,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const a=fl(i);return n.getTime()>=s.getTime()?r+1:n.getTime()>=a.getTime()?r:r-1}function Lw(t){const e=ct(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 sa(t,...e){const n=It.bind(null,e.find(r=>typeof r=="object"));return e.map(n)}function hl(t,e){const n=ct(t,e?.in);return n.setHours(0,0,0,0),n}function zy(t,e,n){const[r,o]=sa(n?.in,t,e),s=hl(r),i=hl(o),a=+s-Lw(s),l=+i-Lw(i);return Math.round((a-l)/o7)}function i7(t,e){const n=SM(t,e),r=It(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),fl(r)}function a7(t,e,n){return kM(t,e*7,n)}function l7(t,e,n){return xM(t,e*12,n)}function c7(t,e){let n,r=e?.in;return t.forEach(o=>{!r&&typeof o=="object"&&(r=It.bind(null,o));const s=ct(o,r);(!n||n<s||isNaN(+s))&&(n=s)}),It(r,n||NaN)}function u7(t,e){let n,r=e?.in;return t.forEach(o=>{!r&&typeof o=="object"&&(r=It.bind(null,o));const s=ct(o,r);(!n||n>s||isNaN(+s))&&(n=s)}),It(r,n||NaN)}function d7(t,e,n){const[r,o]=sa(n?.in,t,e);return+hl(r)==+hl(o)}function EM(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function f7(t){return!(!EM(t)&&typeof t!="number"||isNaN(+ct(t)))}function CM(t,e,n){const[r,o]=sa(n?.in,t,e),s=r.getFullYear()-o.getFullYear(),i=r.getMonth()-o.getMonth();return s*12+i}function h7(t,e){const n=ct(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function TM(t,e){const[n,r]=sa(t,e.start,e.end);return{start:n,end:r}}function p7(t,e){const{start:n,end:r}=TM(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(It(n,i)),i.setMonth(i.getMonth()+a);return o?l.reverse():l}function m7(t,e){const n=ct(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function g7(t,e){const n=ct(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function RM(t,e){const n=ct(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function y7(t,e){const{start:n,end:r}=TM(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(It(n,i)),i.setFullYear(i.getFullYear()+a);return o?l.reverse():l}function MM(t,e){const n=_l(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,o=ct(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 b7(t,e){return MM(t,{...e,weekStartsOn:1})}const v7={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"}},w7=(t,e,n)=>{let r;const o=v7[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 ep(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const k7={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},x7={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},S7={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},E7={date:ep({formats:k7,defaultWidth:"full"}),time:ep({formats:x7,defaultWidth:"full"}),dateTime:ep({formats:S7,defaultWidth:"full"})},C7={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},T7=(t,e,n,r)=>C7[t];function pa(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 R7={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},M7={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},O7={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"]},_7={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"]},N7={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"}},P7={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"}},$7=(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"},A7={ordinalNumber:$7,era:pa({values:R7,defaultWidth:"wide"}),quarter:pa({values:M7,defaultWidth:"wide",argumentCallback:t=>t-1}),month:pa({values:O7,defaultWidth:"wide"}),day:pa({values:_7,defaultWidth:"wide"}),dayPeriod:pa({values:N7,defaultWidth:"wide",formattingValues:P7,defaultFormattingWidth:"wide"})};function ma(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)?D7(a,d=>d.test(i)):I7(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 I7(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function D7(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function z7(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 j7=/^(\d+)(th|st|nd|rd)?/i,L7=/\d+/i,F7={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},B7={any:[/^b/i,/^(a|c)/i]},V7={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},W7={any:[/1/i,/2/i,/3/i,/4/i]},H7={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},q7={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]},U7={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},K7={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]},Y7={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},G7={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}},Z7={ordinalNumber:z7({matchPattern:j7,parsePattern:L7,valueCallback:t=>parseInt(t,10)}),era:ma({matchPatterns:F7,defaultMatchWidth:"wide",parsePatterns:B7,defaultParseWidth:"any"}),quarter:ma({matchPatterns:V7,defaultMatchWidth:"wide",parsePatterns:W7,defaultParseWidth:"any",valueCallback:t=>t+1}),month:ma({matchPatterns:H7,defaultMatchWidth:"wide",parsePatterns:q7,defaultParseWidth:"any"}),day:ma({matchPatterns:U7,defaultMatchWidth:"wide",parsePatterns:K7,defaultParseWidth:"any"}),dayPeriod:ma({matchPatterns:Y7,defaultMatchWidth:"any",parsePatterns:G7,defaultParseWidth:"any"})},di={code:"en-US",formatDistance:w7,formatLong:E7,formatRelative:T7,localize:A7,match:Z7,options:{weekStartsOn:0,firstWeekContainsDate:1}};function J7(t,e){const n=ct(t,e?.in);return zy(n,RM(n))+1}function jy(t,e){const n=ct(t,e?.in),r=+fl(n)-+i7(n);return Math.round(r/wM)+1}function OM(t,e){const n=ct(t,e?.in),r=n.getFullYear(),o=_l(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,i=It(e?.in||t,0);i.setFullYear(r+1,0,s),i.setHours(0,0,0,0);const a=Yi(i,e),l=It(e?.in||t,0);l.setFullYear(r,0,s),l.setHours(0,0,0,0);const c=Yi(l,e);return+n>=+a?r+1:+n>=+c?r:r-1}function X7(t,e){const n=_l(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,o=OM(t,e),s=It(e?.in||t,0);return s.setFullYear(o,0,r),s.setHours(0,0,0,0),Yi(s,e)}function Ly(t,e){const n=ct(t,e?.in),r=+Yi(n,e)-+X7(n,e);return Math.round(r/wM)+1}function nt(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const Xr={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return nt(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):nt(n+1,2)},d(t,e){return nt(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 nt(t.getHours()%12||12,e.length)},H(t,e){return nt(t.getHours(),e.length)},m(t,e){return nt(t.getMinutes(),e.length)},s(t,e){return nt(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),o=Math.trunc(r*Math.pow(10,n-3));return nt(o,e.length)}},Xs={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Fw={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 Xr.y(t,e)},Y:function(t,e,n,r){const o=OM(t,r),s=o>0?o:1-o;if(e==="YY"){const i=s%100;return nt(i,2)}return e==="Yo"?n.ordinalNumber(s,{unit:"year"}):nt(s,e.length)},R:function(t,e){const n=SM(t);return nt(n,e.length)},u:function(t,e){const n=t.getFullYear();return nt(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 nt(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 nt(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 Xr.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 nt(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=Ly(t,r);return e==="wo"?n.ordinalNumber(o,{unit:"week"}):nt(o,e.length)},I:function(t,e,n){const r=jy(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):nt(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Xr.d(t,e)},D:function(t,e,n){const r=J7(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):nt(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 nt(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 nt(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 nt(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=Xs.noon:r===0?o=Xs.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=Xs.evening:r>=12?o=Xs.afternoon:r>=4?o=Xs.morning:o=Xs.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 Xr.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Xr.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):nt(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):nt(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Xr.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Xr.s(t,e)},S:function(t,e){return Xr.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return Vw(r);case"XXXX":case"XX":return Jo(r);default:return Jo(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return Vw(r);case"xxxx":case"xx":return Jo(r);default:return Jo(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Bw(r,":");default:return"GMT"+Jo(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Bw(r,":");default:return"GMT"+Jo(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return nt(r,e.length)},T:function(t,e,n){return nt(+t,e.length)}};function Bw(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+nt(s,2)}function Vw(t,e){return t%60===0?(t>0?"-":"+")+nt(Math.abs(t)/60,2):Jo(t,e)}function Jo(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),o=nt(Math.trunc(r/60),2),s=nt(r%60,2);return n+o+e+s}const Ww=(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"})}},_M=(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"})}},Q7=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],o=n[2];if(!o)return Ww(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}}",Ww(r,e)).replace("{{time}}",_M(o,e))},eK={p:_M,P:Q7},tK=/^D+$/,nK=/^Y+$/,rK=["D","DD","YY","YYYY"];function oK(t){return tK.test(t)}function sK(t){return nK.test(t)}function iK(t,e,n){const r=aK(t,e,n);if(console.warn(r),rK.includes(t))throw new RangeError(r)}function aK(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 lK=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,cK=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,uK=/^'([^]*?)'?$/,dK=/''/g,fK=/[a-zA-Z]/;function Ma(t,e,n){const r=_l(),o=n?.locale??r.locale??di,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=ct(t,n?.in);if(!f7(a))throw new RangeError("Invalid time value");let l=e.match(cK).map(u=>{const d=u[0];if(d==="p"||d==="P"){const f=eK[d];return f(u,o.formatLong)}return u}).join("").match(lK).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:hK(u)};if(Fw[d])return{isToken:!0,value:u};if(d.match(fK))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&&sK(d)||!n?.useAdditionalDayOfYearTokens&&oK(d))&&iK(d,e,String(t));const f=Fw[d[0]];return f(a,d,o.localize,c)}).join("")}function hK(t){const e=t.match(uK);return e?e[1].replace(dK,"'"):t}function pK(t,e){const n=ct(t,e?.in),r=n.getFullYear(),o=n.getMonth(),s=It(n,0);return s.setFullYear(r,o+1,0),s.setHours(0,0,0,0),s.getDate()}function mK(t,e){return ct(t,e?.in).getMonth()}function gK(t,e){return ct(t,e?.in).getFullYear()}function yK(t,e){return+ct(t)>+ct(e)}function bK(t,e){return+ct(t)<+ct(e)}function vK(t,e,n){const[r,o]=sa(n?.in,t,e);return r.getFullYear()===o.getFullYear()&&r.getMonth()===o.getMonth()}function wK(t,e,n){const[r,o]=sa(n?.in,t,e);return r.getFullYear()===o.getFullYear()}function kK(t,e,n){const r=ct(t,n?.in),o=r.getFullYear(),s=r.getDate(),i=It(t,0);i.setFullYear(o,e,15),i.setHours(0,0,0,0);const a=pK(i);return r.setMonth(e,Math.min(s,a)),r}function xK(t,e,n){const r=ct(t,n?.in);return isNaN(+r)?It(t,NaN):(r.setFullYear(e),r)}const Hw=5,SK=4;function EK(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,o=e.addDays(t,-r+1),s=e.addDays(o,Hw*7-1);return e.getMonth(t)===e.getMonth(s)?Hw:SK}function NM(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 CK(t,e){const n=NM(t,e),r=EK(t,e);return e.addDays(n,r*7-1)}const PM={...di,labels:{labelDayButton:(t,e,n,r)=>{let o;r&&typeof r.format=="function"?o=r.format.bind(r):o=(i,a)=>Ma(i,a,{locale:di,...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)=>Ma(o,s,{locale:di,...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)=>Ma(i,a,{locale:di,...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)=>Ma(o,s,{locale:di,...e}),r(t,"cccc")}}};class _n{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):kM(r,o),this.addMonths=(r,o)=>this.overrides?.addMonths?this.overrides.addMonths(r,o):xM(r,o),this.addWeeks=(r,o)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,o):a7(r,o),this.addYears=(r,o)=>this.overrides?.addYears?this.overrides.addYears(r,o):l7(r,o),this.differenceInCalendarDays=(r,o)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,o):zy(r,o),this.differenceInCalendarMonths=(r,o)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,o):CM(r,o),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):p7(r),this.eachYearOfInterval=r=>{const o=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):y7(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):CK(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):b7(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):h7(r),this.endOfWeek=(r,o)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,o):MM(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):g7(r),this.format=(r,o,s)=>{const i=this.overrides?.format?this.overrides.format(r,o,this.options):Ma(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):jy(r),this.getMonth=(r,o)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):mK(r,this.options),this.getYear=(r,o)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):gK(r,this.options),this.getWeek=(r,o)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):Ly(r,this.options),this.isAfter=(r,o)=>this.overrides?.isAfter?this.overrides.isAfter(r,o):yK(r,o),this.isBefore=(r,o)=>this.overrides?.isBefore?this.overrides.isBefore(r,o):bK(r,o),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):EM(r),this.isSameDay=(r,o)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,o):d7(r,o),this.isSameMonth=(r,o)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,o):vK(r,o),this.isSameYear=(r,o)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,o):wK(r,o),this.max=r=>this.overrides?.max?this.overrides.max(r):c7(r),this.min=r=>this.overrides?.min?this.overrides.min(r):u7(r),this.setMonth=(r,o)=>this.overrides?.setMonth?this.overrides.setMonth(r,o):kK(r,o),this.setYear=(r,o)=>this.overrides?.setYear?this.overrides.setYear(r,o):xK(r,o),this.startOfBroadcastWeek=(r,o)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):NM(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):hl(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):fl(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):m7(r),this.startOfWeek=(r,o)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):Yi(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):RM(r),this.options={locale:PM,...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&&_n.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:o}=this.options,s=n?.code;if(s&&_n.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)}}_n.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 kr=new _n;class $M{constructor(e,n,r=kr){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 TK{constructor(e,n){this.date=e,this.weeks=n}}class RK{constructor(e,n){this.days=n,this.weekNumber=e}}function MK(t){return me.createElement("button",{...t})}function OK(t){return me.createElement("span",{...t})}function _K(t){const{size:e=24,orientation:n="left",className:r}=t;return me.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&me.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&me.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&me.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&me.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function NK(t){const{day:e,modifiers:n,...r}=t;return me.createElement("td",{...r})}function PK(t){const{day:e,modifiers:n,...r}=t,o=me.useRef(null);return me.useEffect(()=>{n.focused&&o.current?.focus()},[n.focused]),me.createElement("button",{ref:o,...r})}var Te;(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"})(Te||(Te={}));var wt;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(wt||(wt={}));var Zn;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(Zn||(Zn={}));var xn;(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"})(xn||(xn={}));function $K(t){const{options:e,className:n,components:r,classNames:o,...s}=t,i=[o[Te.Dropdown],n].join(" "),a=e?.find(({value:l})=>l===s.value);return me.createElement("span",{"data-disabled":s.disabled,className:o[Te.DropdownRoot]},me.createElement(r.Select,{className:i,...s},e?.map(({value:l,label:c,disabled:u})=>me.createElement(r.Option,{key:l,value:l,disabled:u},c))),me.createElement("span",{className:o[Te.CaptionLabel],"aria-hidden":!0},a?.label,me.createElement(r.Chevron,{orientation:"down",size:18,className:o[Te.Chevron]})))}function AK(t){return me.createElement("div",{...t})}function IK(t){return me.createElement("div",{...t})}function DK(t){const{calendarMonth:e,displayIndex:n,...r}=t;return me.createElement("div",{...r},t.children)}function zK(t){const{calendarMonth:e,displayIndex:n,...r}=t;return me.createElement("div",{...r})}function jK(t){return me.createElement("table",{...t})}function LK(t){return me.createElement("div",{...t})}const AM=x.createContext(void 0);function Nl(){const t=x.useContext(AM);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function FK(t){const{components:e}=Nl();return me.createElement(e.Dropdown,{...t})}function BK(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:o,...s}=t,{components:i,classNames:a,labels:{labelPrevious:l,labelNext:c}}=Nl(),u=x.useCallback(f=>{o&&n?.(f)},[o,n]),d=x.useCallback(f=>{r&&e?.(f)},[r,e]);return me.createElement("nav",{...s},me.createElement(i.PreviousMonthButton,{type:"button",className:a[Te.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":l(r),onClick:d},me.createElement(i.Chevron,{disabled:r?void 0:!0,className:a[Te.Chevron],orientation:"left"})),me.createElement(i.NextMonthButton,{type:"button",className:a[Te.NextMonthButton],tabIndex:o?void 0:-1,"aria-disabled":o?void 0:!0,"aria-label":c(o),onClick:u},me.createElement(i.Chevron,{disabled:o?void 0:!0,orientation:"right",className:a[Te.Chevron]})))}function VK(t){const{components:e}=Nl();return me.createElement(e.Button,{...t})}function WK(t){return me.createElement("option",{...t})}function HK(t){const{components:e}=Nl();return me.createElement(e.Button,{...t})}function qK(t){const{rootRef:e,...n}=t;return me.createElement("div",{...n,ref:e})}function UK(t){return me.createElement("select",{...t})}function KK(t){const{week:e,...n}=t;return me.createElement("tr",{...n})}function YK(t){return me.createElement("th",{...t})}function GK(t){return me.createElement("thead",{"aria-hidden":!0},me.createElement("tr",{...t}))}function ZK(t){const{week:e,...n}=t;return me.createElement("th",{...n})}function JK(t){return me.createElement("th",{...t})}function XK(t){return me.createElement("tbody",{...t})}function QK(t){const{components:e}=Nl();return me.createElement(e.Dropdown,{...t})}const eY=Object.freeze(Object.defineProperty({__proto__:null,Button:MK,CaptionLabel:OK,Chevron:_K,Day:NK,DayButton:PK,Dropdown:$K,DropdownNav:AK,Footer:IK,Month:DK,MonthCaption:zK,MonthGrid:jK,Months:LK,MonthsDropdown:FK,Nav:BK,NextMonthButton:VK,Option:WK,PreviousMonthButton:HK,Root:qK,Select:UK,Week:KK,WeekNumber:ZK,WeekNumberHeader:JK,Weekday:YK,Weekdays:GK,Weeks:XK,YearsDropdown:QK},Symbol.toStringTag,{value:"Module"}));function Ir(t,e,n=!1,r=kr){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 Fy(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function Wf(t){return!!(t&&typeof t=="object"&&"from"in t)}function By(t){return!!(t&&typeof t=="object"&&"after"in t)}function Vy(t){return!!(t&&typeof t=="object"&&"before"in t)}function IM(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function DM(t,e){return Array.isArray(t)&&t.every(e.isDate)}function Dr(t,e,n=kr){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(DM(a,n))return a.some(l=>o(t,l));if(Wf(a))return Ir(a,t,!1,n);if(IM(a))return Array.isArray(a.dayOfWeek)?a.dayOfWeek.includes(t.getDay()):a.dayOfWeek===t.getDay();if(Fy(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 By(a)?s(t,a.after)>0:Vy(a)?s(a.before,t)>0:typeof a=="function"?a(t):!1})}function tY(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={[wt.focused]:[],[wt.outside]:[],[wt.disabled]:[],[wt.hidden]:[],[wt.today]:[]},k={};for(const v of t){const{date:S,displayMonth:E}=v,M=!!(E&&!f(S,E)),D=!!(y&&p(S,y)),F=!!(b&&g(S,b)),N=!!(s&&Dr(S,s,o)),A=!!(i&&Dr(S,i,o))||D||F||!c&&!l&&M||c&&l===!1&&M,z=d(S,u);M&&w.outside.push(v),N&&w.disabled.push(v),A&&w.hidden.push(v),z&&w.today.push(v),a&&Object.keys(a).forEach(B=>{const U=a?.[B];U&&Dr(S,U,o)&&(k[B]?k[B].push(v):k[B]=[v])})}return v=>{const S={[wt.focused]:!1,[wt.disabled]:!1,[wt.hidden]:!1,[wt.outside]:!1,[wt.today]:!1},E={};for(const M in w){const D=w[M];S[M]=D.some(F=>F===v)}for(const M in k)E[M]=k[M].some(D=>D===v);return{...S,...E}}}function nY(t,e,n={}){return Object.entries(t).filter(([,o])=>o===!0).reduce((o,[s])=>(n[s]?o.push(n[s]):e[wt[s]]?o.push(e[wt[s]]):e[Zn[s]]&&o.push(e[Zn[s]]),o),[e[Te.Day]])}function rY(t){return{...eY,...t}}function oY(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 Wy(){const t={};for(const e in Te)t[Te[e]]=`rdp-${Te[e]}`;for(const e in wt)t[wt[e]]=`rdp-${wt[e]}`;for(const e in Zn)t[Zn[e]]=`rdp-${Zn[e]}`;for(const e in xn)t[xn[e]]=`rdp-${xn[e]}`;return t}function zM(t,e,n){return(n??new _n(e)).formatMonthYear(t)}const sY=zM;function iY(t,e,n){return(n??new _n(e)).format(t,"d")}function aY(t,e=kr){return e.format(t,"LLLL")}function lY(t,e,n){return(n??new _n(e)).format(t,"cccccc")}function cY(t,e=kr){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function uY(){return""}function jM(t,e=kr){return e.format(t,"yyyy")}const dY=jM,fY=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:zM,formatDay:iY,formatMonthCaption:sY,formatMonthDropdown:aY,formatWeekNumber:cY,formatWeekNumberHeader:uY,formatWeekdayName:lY,formatYearCaption:dY,formatYearDropdown:jM},Symbol.toStringTag,{value:"Module"}));function hY(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...fY,...t}}function Hy(t,e,n,r){let o=(r??new _n(n)).format(t,"PPPP");return e.today&&(o=`Today, ${o}`),e.selected&&(o=`${o}, selected`),o}const pY=Hy;function qy(t,e,n){return(n??new _n(e)).formatMonthYear(t)}const mY=qy;function LM(t,e,n,r){let o=(r??new _n(n)).format(t,"PPPP");return e?.today&&(o=`Today, ${o}`),o}function FM(t){return"Choose the Month"}function BM(){return""}const gY="Go to the Next Month";function VM(t,e){return gY}function WM(t){return"Go to the Previous Month"}function HM(t,e,n){return(n??new _n(e)).format(t,"cccc")}function qM(t,e){return`Week ${t}`}function UM(t){return"Week Number"}function KM(t){return"Choose the Year"}const yY=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:mY,labelDay:pY,labelDayButton:Hy,labelGrid:qy,labelGridcell:LM,labelMonthDropdown:FM,labelNav:BM,labelNext:VM,labelPrevious:WM,labelWeekNumber:qM,labelWeekNumberHeader:UM,labelWeekday:HM,labelYearDropdown:KM},Symbol.toStringTag,{value:"Module"})),Vn=(t,e,n)=>e||(n?typeof n=="function"?n:(...r)=>n:t);function bY(t,e){const n=e.locale?.labels??{};return{...yY,...t??{},labelDayButton:Vn(Hy,t?.labelDayButton,n.labelDayButton),labelMonthDropdown:Vn(FM,t?.labelMonthDropdown,n.labelMonthDropdown),labelNext:Vn(VM,t?.labelNext,n.labelNext),labelPrevious:Vn(WM,t?.labelPrevious,n.labelPrevious),labelWeekNumber:Vn(qM,t?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:Vn(KM,t?.labelYearDropdown,n.labelYearDropdown),labelGrid:Vn(qy,t?.labelGrid,n.labelGrid),labelGridcell:Vn(LM,t?.labelGridcell,n.labelGridcell),labelNav:Vn(BM,t?.labelNav,n.labelNav),labelWeekNumberHeader:Vn(UM,t?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:Vn(HM,t?.labelWeekday,n.labelWeekday)}}function vY(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 wY(t,e={},n={}){let r={...e?.[Te.Day]};return Object.entries(t).filter(([,o])=>o===!0).forEach(([o])=>{r={...r,...n?.[o]}}),r}function kY(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 xY(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 SY(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 Ly(c,{weekStartsOn:l?.weekStartsOn??o,firstWeekContainsDate:l?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1})},getISOWeek:a=>{const l=i(a);return jy(l)},differenceInCalendarDays:(a,l)=>{const c=i(a),u=i(l);return zy(c,u)},differenceInCalendarMonths:(a,l)=>{const c=i(a),u=i(l);return CM(c,u)}}}const Pl=t=>t instanceof HTMLElement?t:null,tp=t=>[...t.querySelectorAll("[data-animated-month]")??[]],EY=t=>Pl(t.querySelector("[data-animated-month]")),np=t=>Pl(t.querySelector("[data-animated-caption]")),rp=t=>Pl(t.querySelector("[data-animated-weeks]")),CY=t=>Pl(t.querySelector("[data-animated-nav]")),TY=t=>Pl(t.querySelector("[data-animated-weekdays]"));function RY(t,e,{classNames:n,months:r,focused:o,dateLib:s}){const i=x.useRef(null),a=x.useRef(r),l=x.useRef(!1);x.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[xn.caption_after_enter]:n[xn.caption_before_enter],h=d?n[xn.weeks_after_enter]:n[xn.weeks_before_enter],p=i.current,m=t.current.cloneNode(!0);if(m instanceof HTMLElement?(tp(m).forEach(w=>{if(!(w instanceof HTMLElement))return;const k=EY(w);k&&w.contains(k)&&w.removeChild(k);const v=np(w);v&&v.classList.remove(f);const S=rp(w);S&&S.classList.remove(h)}),i.current=m):i.current=null,l.current||u||o)return;const g=p instanceof HTMLElement?tp(p):[],y=tp(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=CY(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 S=np(w);S&&S.classList.add(f);const E=rp(w);E&&E.classList.add(h);const M=()=>{l.current=!1,t.current&&(t.current.style.isolation=""),b&&(b.style.zIndex=""),S&&S.classList.remove(f),E&&E.classList.remove(h),w.style.position="",w.style.overflow="",w.contains(v)&&w.removeChild(v)};v.style.pointerEvents="none",v.style.position="absolute",v.style.overflow="hidden",v.setAttribute("aria-hidden","true");const D=TY(v);D&&(D.style.opacity="0");const F=np(v);F&&(F.classList.add(d?n[xn.caption_before_exit]:n[xn.caption_after_exit]),F.addEventListener("animationend",M));const N=rp(v);N&&N.classList.add(d?n[xn.weeks_before_exit]:n[xn.weeks_after_exit]),w.insertBefore(v,w.firstChild)})}})}function MY(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)),S=e&&(l?f(e):i?h(e):m(e)),E=S&&g(v,S)?S:v,M=u(E,k),D=d(s,o)+1,F=[];for(let z=0;z<=M;z++){const B=c(k,z);F.push(B)}const A=(l?35:42)*D;if(a&&F.length<A){const z=A-F.length;for(let B=0;B<z;B++){const U=c(F[F.length-1],1);F.push(U)}}return F}function OY(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 _Y(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 qw(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 NY(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(E=>E>=y&&E<=b),k=n.broadcastCalendar?35:42;if(n.fixedWeeks&&w.length<k){const E=e.filter(M=>{const D=k-w.length;return M>b&&M<=o(b,D)});w.push(...E)}const v=w.reduce((E,M)=>{const D=n.ISOWeek?c(M):u(M),F=E.find(A=>A.weekNumber===D),N=new $M(M,g,r);return F?F.days.push(N):E.push(new RK(D,[N])),E},[]),S=new TK(g,v);return m.push(S),m},[]);return n.reverseMonths?p.reverse():p}function PY(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 $Y(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 AY(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 IY(t){const e=[];return t.reduce((n,r)=>n.concat(r.weeks.slice()),e.slice())}function Hf(t,e){const[n,r]=x.useState(t);return[e===void 0?n:e,r]}function DY(t,e){const[n,r]=PY(t,e),{startOfMonth:o,endOfMonth:s}=e,i=qw(t,n,r,e),[a,l]=Hf(i,t.month?i:void 0);x.useEffect(()=>{const k=qw(t,n,r,e);l(k)},[t.timeZone]);const{months:c,weeks:u,days:d,previousMonth:f,nextMonth:h}=x.useMemo(()=>{const k=_Y(a,r,{numberOfMonths:t.numberOfMonths},e),v=MY(k,t.endMonth?s(t.endMonth):void 0,{ISOWeek:t.ISOWeek,fixedWeeks:t.fixedWeeks,broadcastCalendar:t.broadcastCalendar},e),S=NY(k,v,{broadcastCalendar:t.broadcastCalendar,fixedWeeks:t.fixedWeeks,ISOWeek:t.ISOWeek,reverseMonths:t.reverseMonths},e),E=IY(S),M=OY(S),D=AY(a,n,t,e),F=$Y(a,r,t,e);return{months:S,weeks:E,days:M,previousMonth:D,nextMonth:F}},[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(S=>S.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 ar;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(ar||(ar={}));function Uw(t){return!t[wt.disabled]&&!t[wt.hidden]&&!t[wt.outside]}function zY(t,e,n,r){let o,s=-1;for(const i of t){const a=e(i);Uw(a)&&(a[wt.focused]&&s<ar.FocusedModifier?(o=i,s=ar.FocusedModifier):r?.isEqualTo(i)&&s<ar.LastFocused?(o=i,s=ar.LastFocused):n(i.date)&&s<ar.Selected?(o=i,s=ar.Selected):a[wt.today]&&s<ar.Today&&(o=i,s=ar.Today))}return o||(o=t.find(i=>Uw(e(i)))),o}function jY(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 S={day:c,week:d,month:u,year:f,startOfWeek:E=>l?b(E,i):a?w(E):k(E),endOfWeek:E=>l?h(E):a?p(E):m(E)}[t](n,e==="after"?1:-1);return e==="before"&&r?S=g([r,S]):e==="after"&&o&&(S=y([o,S])),S}function YM(t,e,n,r,o,s,i,a=0){if(a>365)return;const l=jY(t,e,n.date,r,o,s,i),c=!!(s.disabled&&Dr(l,s.disabled,i)),u=!!(s.hidden&&Dr(l,s.hidden,i)),d=l,f=new $M(l,d,i);return!c&&!u?f:YM(t,e,f,r,o,s,i,a+1)}function LY(t,e,n,r,o){const{autoFocus:s}=t,[i,a]=x.useState(),l=zY(e.days,n,r||(()=>!1),i),[c,u]=x.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=YM(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 FY(t,e){const{selected:n,required:r,onSelect:o}=t,[s,i]=Hf(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 BY(t,e,n=0,r=0,o=!1,s=kr){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 VY(t,e,n=kr){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 Kw(t,e,n=kr){return Ir(t,e.from,!1,n)||Ir(t,e.to,!1,n)||Ir(e,t.from,!1,n)||Ir(e,t.to,!1,n)}function WY(t,e,n=kr){const r=Array.isArray(e)?e:[e];if(r.filter(a=>typeof a!="function").some(a=>typeof a=="boolean"?a:n.isDate(a)?Ir(t,a,!1,n):DM(a,n)?a.some(l=>Ir(t,l,!1,n)):Wf(a)?a.from&&a.to?Kw(t,{from:a.from,to:a.to},n):!1:IM(a)?VY(t,a.dayOfWeek,n):Fy(a)?n.isAfter(a.before,a.after)?Kw(t,{from:n.addDays(a.after,1),to:n.addDays(a.before,-1)},n):Dr(t.from,a,n)||Dr(t.to,a,n):By(a)||Vy(a)?Dr(t.from,a,n)||Dr(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 HY(t,e){const{disabled:n,excludeDisabled:r,resetOnSelect:o,selected:s,required:i,onSelect:a}=t,[l,c]=Hf(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,S=!!w&&!!k&&e.isSameDay(w,k)&&e.isSameDay(h,w);o&&(v||!u?.from)?!i&&S?b=void 0:b={from:h,to:void 0}:b=BY(h,u,g,y,i,e)}return r&&n&&b?.from&&b.to&&WY({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&&Ir(u,h,!1,e)}}function qY(t,e){const{selected:n,required:r,onSelect:o}=t,[s,i]=Hf(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 UY(t,e){const n=qY(t,e),r=FY(t,e),o=HY(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 Qs(t,e,n){return An(t,e)}function Yw(t,e,n){return typeof t=="boolean"||typeof t=="function"?t:t instanceof Date?Qs(t,e):Array.isArray(t)?t.map(r=>r instanceof Date?Qs(r,e):r):Wf(t)?{...t,from:t.from?An(t.from,e):t.from,to:t.to?An(t.to,e):t.to}:Fy(t)?{before:Qs(t.before,e),after:Qs(t.after,e)}:By(t)?{after:Qs(t.after,e)}:Vy(t)?{before:Qs(t.before,e)}:t}function op(t,e,n){return t&&(Array.isArray(t)?t.map(r=>Yw(r,e)):Yw(t,e))}function KY(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(ie=>An(ie,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=op(e.disabled,n)),e.hidden!==void 0&&(e.hidden=op(e.hidden,n)),e.modifiers)){const ie={};Object.keys(e.modifiers).forEach(he=>{ie[he]=op(e.modifiers?.[he],n)}),e.modifiers=ie}const{components:r,formatters:o,labels:s,dateLib:i,locale:a,classNames:l}=x.useMemo(()=>{const ie={...PM,...e.locale},he=e.broadcastCalendar?1:e.weekStartsOn,Se=e.noonSafe&&e.timeZone?SY(e.timeZone,{weekStartsOn:he,locale:ie}):void 0,De=e.dateLib&&Se?{...Se,...e.dateLib}:e.dateLib??Se,ut=new _n({locale:ie,weekStartsOn:he,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},De);return{dateLib:ut,components:rY(e.components),formatters:hY(e.formatters),labels:bY(e.labels,ut.options),locale:ie,classNames:{...Wy(),...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:S}=e,{formatCaption:E,formatDay:M,formatMonthDropdown:D,formatWeekNumber:F,formatWeekNumberHeader:N,formatWeekdayName:A,formatYearDropdown:z}=o,B=DY(e,i),{days:U,months:J,navStart:Y,navEnd:K,previousMonth:G,nextMonth:L,goToMonth:W}=B,$=tY(U,e,Y,K,i),{isSelected:j,select:R,selected:P}=UY(e,i)??{},{blur:I,focused:Z,isFocusTarget:X,moveFocus:_,setFocused:q}=LY(e,B,$,j??(()=>!1),i),{labelDayButton:T,labelGridcell:O,labelGrid:V,labelMonthDropdown:H,labelNav:Q,labelPrevious:ee,labelNext:re,labelWeekday:oe,labelWeekNumber:ne,labelWeekNumberHeader:le,labelYearDropdown:te}=s,fe=x.useMemo(()=>kY(i,e.ISOWeek,e.broadcastCalendar,e.today),[i,e.ISOWeek,e.broadcastCalendar,e.today]),ge=u!==void 0||p!==void 0,pe=x.useCallback(()=>{G&&(W(G),k?.(G))},[G,W,k]),Le=x.useCallback(()=>{L&&(W(L),w?.(L))},[W,L,w]),qe=x.useCallback((ie,he)=>Se=>{Se.preventDefault(),Se.stopPropagation(),q(ie),!he.disabled&&(R?.(ie.date,he,Se),p?.(ie.date,he,Se))},[R,p,q]),Je=x.useCallback((ie,he)=>Se=>{q(ie),m?.(ie.date,he,Se)},[m,q]),Me=x.useCallback((ie,he)=>Se=>{I(),h?.(ie.date,he,Se)},[I,h]),Oe=x.useCallback((ie,he)=>Se=>{const De={ArrowLeft:[Se.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[Se.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[Se.shiftKey?"year":"week","after"],ArrowUp:[Se.shiftKey?"year":"week","before"],PageUp:[Se.shiftKey?"year":"month","before"],PageDown:[Se.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(De[Se.key]){Se.preventDefault(),Se.stopPropagation();const[ut,Ae]=De[Se.key];_(ut,Ae)}g?.(ie.date,he,Se)},[_,g,e.dir]),ze=x.useCallback((ie,he)=>Se=>{y?.(ie.date,he,Se)},[y]),Be=x.useCallback((ie,he)=>Se=>{b?.(ie.date,he,Se)},[b]),pt=x.useCallback(ie=>he=>{const Se=Number(he.target.value),De=i.setMonth(i.startOfMonth(ie),Se);W(De)},[i,W]),bt=x.useCallback(ie=>he=>{const Se=Number(he.target.value),De=i.setYear(i.startOfMonth(ie),Se);W(De)},[i,W]),{className:mt,style:ht}=x.useMemo(()=>({className:[l[Te.Root],e.className].filter(Boolean).join(" "),style:{...S?.[Te.Root],...e.style}}),[l,e.className,e.style,S]),Qe=oY(e),$e=x.useRef(null);RY($e,!!e.animate,{classNames:l,months:J,focused:Z,dateLib:i});const ce={dayPickerProps:e,selected:P,select:R,isSelected:j,months:J,nextMonth:L,previousMonth:G,goToMonth:W,getModifiers:$,components:r,classNames:l,styles:S,labels:s,formatters:o};return me.createElement(AM.Provider,{value:ce},me.createElement(r.Root,{rootRef:e.animate?$e:void 0,className:mt,style:ht,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"],...Qe},me.createElement(r.Months,{className:l[Te.Months],style:S?.[Te.Months]},!e.hideNavigation&&!d&&me.createElement(r.Nav,{"data-animated-nav":e.animate?"true":void 0,className:l[Te.Nav],style:S?.[Te.Nav],"aria-label":Q(),onPreviousClick:pe,onNextClick:Le,previousMonth:G,nextMonth:L}),J.map((ie,he)=>me.createElement(r.Month,{"data-animated-month":e.animate?"true":void 0,className:l[Te.Month],style:S?.[Te.Month],key:he,displayIndex:he,calendarMonth:ie},d==="around"&&!e.hideNavigation&&he===0&&me.createElement(r.PreviousMonthButton,{type:"button",className:l[Te.PreviousMonthButton],tabIndex:G?void 0:-1,"aria-disabled":G?void 0:!0,"aria-label":ee(G),onClick:pe,"data-animated-button":e.animate?"true":void 0},me.createElement(r.Chevron,{disabled:G?void 0:!0,className:l[Te.Chevron],orientation:e.dir==="rtl"?"right":"left"})),me.createElement(r.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:l[Te.MonthCaption],style:S?.[Te.MonthCaption],calendarMonth:ie,displayIndex:he},c?.startsWith("dropdown")?me.createElement(r.DropdownNav,{className:l[Te.Dropdowns],style:S?.[Te.Dropdowns]},(()=>{const Se=c==="dropdown"||c==="dropdown-months"?me.createElement(r.MonthsDropdown,{key:"month",className:l[Te.MonthsDropdown],"aria-label":H(),classNames:l,components:r,disabled:!!e.disableNavigation,onChange:pt(ie.date),options:vY(ie.date,Y,K,o,i),style:S?.[Te.Dropdown],value:i.getMonth(ie.date)}):me.createElement("span",{key:"month"},D(ie.date,i)),De=c==="dropdown"||c==="dropdown-years"?me.createElement(r.YearsDropdown,{key:"year",className:l[Te.YearsDropdown],"aria-label":te(i.options),classNames:l,components:r,disabled:!!e.disableNavigation,onChange:bt(ie.date),options:xY(Y,K,o,i,!!e.reverseYears),style:S?.[Te.Dropdown],value:i.getYear(ie.date)}):me.createElement("span",{key:"year"},z(ie.date,i));return i.getMonthYearOrder()==="year-first"?[De,Se]:[Se,De]})(),me.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},E(ie.date,i.options,i))):me.createElement(r.CaptionLabel,{className:l[Te.CaptionLabel],role:"status","aria-live":"polite"},E(ie.date,i.options,i))),d==="around"&&!e.hideNavigation&&he===f-1&&me.createElement(r.NextMonthButton,{type:"button",className:l[Te.NextMonthButton],tabIndex:L?void 0:-1,"aria-disabled":L?void 0:!0,"aria-label":re(L),onClick:Le,"data-animated-button":e.animate?"true":void 0},me.createElement(r.Chevron,{disabled:L?void 0:!0,className:l[Te.Chevron],orientation:e.dir==="rtl"?"left":"right"})),he===f-1&&d==="after"&&!e.hideNavigation&&me.createElement(r.Nav,{"data-animated-nav":e.animate?"true":void 0,className:l[Te.Nav],style:S?.[Te.Nav],"aria-label":Q(),onPreviousClick:pe,onNextClick:Le,previousMonth:G,nextMonth:L}),me.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":V(ie.date,i.options,i)||void 0,className:l[Te.MonthGrid],style:S?.[Te.MonthGrid]},!e.hideWeekdays&&me.createElement(r.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:l[Te.Weekdays],style:S?.[Te.Weekdays]},v&&me.createElement(r.WeekNumberHeader,{"aria-label":le(i.options),className:l[Te.WeekNumberHeader],style:S?.[Te.WeekNumberHeader],scope:"col"},N()),fe.map(Se=>me.createElement(r.Weekday,{"aria-label":oe(Se,i.options,i),className:l[Te.Weekday],key:String(Se),style:S?.[Te.Weekday],scope:"col"},A(Se,i.options,i)))),me.createElement(r.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:l[Te.Weeks],style:S?.[Te.Weeks]},ie.weeks.map(Se=>me.createElement(r.Week,{className:l[Te.Week],key:Se.weekNumber,style:S?.[Te.Week],week:Se},v&&me.createElement(r.WeekNumber,{week:Se,style:S?.[Te.WeekNumber],"aria-label":ne(Se.weekNumber,{locale:a}),className:l[Te.WeekNumber],scope:"row",role:"rowheader"},F(Se.weekNumber,i)),Se.days.map(De=>{const{date:ut}=De,Ae=$(De);if(Ae[wt.focused]=!Ae.hidden&&!!Z?.isEqualTo(De),Ae[Zn.selected]=j?.(ut)||Ae.selected,Wf(P)){const{from:xr,to:Sr}=P;Ae[Zn.range_start]=!!(xr&&Sr&&i.isSameDay(ut,xr)),Ae[Zn.range_end]=!!(xr&&Sr&&i.isSameDay(ut,Sr)),Ae[Zn.range_middle]=Ir(P,ut,!0,i)}const wn=wY(Ae,S,e.modifiersStyles),Kr=nY(Ae,l,e.modifiersClassNames),Yr=!ge&&!Ae.hidden?O(ut,Ae,i.options,i):void 0;return me.createElement(r.Day,{key:`${De.isoDate}_${De.displayMonthId}`,day:De,modifiers:Ae,className:Kr.join(" "),style:wn,role:"gridcell","aria-selected":Ae.selected||void 0,"aria-label":Yr,"data-day":De.isoDate,"data-month":De.outside?De.dateMonthId:void 0,"data-selected":Ae.selected||void 0,"data-disabled":Ae.disabled||void 0,"data-hidden":Ae.hidden||void 0,"data-outside":De.outside||void 0,"data-focused":Ae.focused||void 0,"data-today":Ae.today||void 0},!Ae.hidden&&ge?me.createElement(r.DayButton,{className:l[Te.DayButton],style:S?.[Te.DayButton],type:"button",day:De,modifiers:Ae,disabled:!Ae.focused&&Ae.disabled||void 0,"aria-disabled":Ae.focused&&Ae.disabled||void 0,tabIndex:X(De)?0:-1,"aria-label":T(ut,Ae,i.options,i),onClick:qe(De,Ae),onBlur:Me(De,Ae),onFocus:Je(De,Ae),onKeyDown:Oe(De,Ae),onMouseEnter:ze(De,Ae),onMouseLeave:Be(De,Ae)},M(ut,i.options,i)):!Ae.hidden&&M(De.date,i.options,i))})))))))),e.footer&&me.createElement(r.Footer,{className:l[Te.Footer],style:S?.[Te.Footer],role:"status","aria-live":"polite"},e.footer)))}function YY({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:o="ghost",locale:s,formatters:i,components:a,...l}){const c=Wy();return C.jsx(KY,{showOutsideDays:n,className:de("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:de("w-fit",c.root),months:de("relative flex flex-col gap-4 md:flex-row",c.months),month:de("flex w-full flex-col gap-4",c.month),nav:de("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",c.nav),button_previous:de(Ii({variant:o}),"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",c.button_previous),button_next:de(Ii({variant:o}),"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",c.button_next),month_caption:de("flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",c.month_caption),dropdowns:de("flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",c.dropdowns),dropdown_root:de("relative rounded-(--cell-radius)",c.dropdown_root),dropdown:de("absolute inset-0 bg-popover opacity-0",c.dropdown),caption_label:de("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:de("flex",c.weekdays),weekday:de("flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none",c.weekday),week:de("mt-2 flex w-full",c.week),week_number_header:de("w-(--cell-size) select-none",c.week_number_header),week_number:de("text-[0.8rem] text-muted-foreground select-none",c.week_number),day:de("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:de("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:de("rounded-none",c.range_middle),range_end:de("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:de("rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none",c.today),outside:de("text-muted-foreground aria-selected:text-muted-foreground",c.outside),disabled:de("text-muted-foreground opacity-50",c.disabled),hidden:de("invisible",c.hidden),...e},components:{Root:({className:u,rootRef:d,...f})=>C.jsx("div",{"data-slot":"calendar",ref:d,className:de(u),...f}),Chevron:({className:u,orientation:d,...f})=>d==="left"?C.jsx(N$,{className:de("size-4",u),...f}):d==="right"?C.jsx($$,{className:de("size-4",u),...f}):C.jsx(ng,{className:de("size-4",u),...f}),DayButton:({...u})=>C.jsx(GY,{locale:s,...u}),WeekNumber:({children:u,...d})=>C.jsx("td",{...d,children:C.jsx("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:u})}),...a},...l})}function GY(t){const e=Ee.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=Wy(),l=x.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]),x.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=de("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=C.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 ZY(t){const e=Ee.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=de("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=C.jsx("label",{"data-slot":"label",className:o,...r}),e[5]=r,e[6]=o,e[7]=s):s=e[7],s}const GM=x.createContext(void 0);function JY(){const t=x.useContext(GM);if(t===void 0)throw new Error(en(63));return t}let Gw=(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 ZM={...Eg,checked(t){return t?{[Gw.checked]:""}:{[Gw.unchecked]:""}}},XY=x.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}=Cg(),{state:w,setTouched:k,setDirty:v,validityData:S,setFilled:E,setFocused:M,shouldValidateOnChange:D,validationMode:F,disabled:N,name:A,validation:z}=na(),{labelId:B}=bf(),U=N||h,J=A??l,Y=ye(u),K=x.useRef(null),G=Wr(K,a,z.inputRef),L=x.useRef(null),W=Ns(),$=vf({id:i,implicit:!1,controlRef:L}),j=c?void 0:$,[R,P]=Ga({controlled:r,default:!!s,name:"Switch",state:"checked"});Tg({id:W,commit:z.commit,value:R,controlRef:L,name:J,getValue:()=>R}),ve(()=>{K.current&&E(K.current.checked)},[K,E]),IE(R,()=>{b(J),v(R!==S.initialValue),E(R),D()?z.commit(R):z.commit(R,!0)});const{getButtonProps:I,buttonRef:Z}=$s({disabled:U,native:c}),X={id:c?$:W,role:"switch","aria-checked":R,"aria-readonly":d||void 0,"aria-required":f||void 0,"aria-labelledby":B,onFocus(){U||M(!0)},onBlur(){const O=K.current;!O||U||(k(!0),M(!1),F==="onBlur"&&z.commit(O.checked))},onClick(O){d||U||(O.preventDefault(),K.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:O.shiftKey,ctrlKey:O.ctrlKey,altKey:O.altKey,metaKey:O.metaKey})))}},_=x.useMemo(()=>Xi({checked:R,disabled:U,id:j,name:J,required:f,style:J?b1:rf,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:G,onChange(O){if(O.nativeEvent.defaultPrevented)return;const V=O.target.checked,H=He(Eo,O.nativeEvent);Y?.(V,H),!H.isCanceled&&P(V)},onFocus(){L.current?.focus()}},z.getInputValidationProps,g!==void 0?{value:g}:jt),[R,U,G,j,J,Y,f,P,z,g]),q=x.useMemo(()=>({...w,checked:R,disabled:U,readOnly:d,required:f}),[w,R,U,d,f]),T=at("span",e,{state:q,ref:[n,L,Z],props:[X,z.getValidationProps,y,I],stateAttributesMapping:ZM});return C.jsxs(GM.Provider,{value:q,children:[T,!R&&J&&m!==void 0&&C.jsx("input",{type:"hidden",name:J,value:m}),C.jsx("input",{..._})]})}),QY=x.forwardRef(function(e,n){const{render:r,className:o,...s}=e,{state:i}=na(),a=JY(),l={...i,...a};return at("span",e,{state:l,ref:n,stateAttributesMapping:ZM,props:s})});function eG(t){const e=Ee.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=de("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=C.jsx(QY,{"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=C.jsx(XY,{"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 tG=36,ei=288,nG=8;function rG(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 oG(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 sG(t,e){return`https://api.iconify.design/${encodeURIComponent(t)}/${encodeURIComponent(e)}.svg?width=20&height=20`}function iG(t){return{maskImage:`url("${t}")`,maskRepeat:"no-repeat",maskPosition:"center",maskSize:"contain",WebkitMaskImage:`url("${t}")`,WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center",WebkitMaskSize:"contain"}}const aG=gr({method:"GET"}).handler(yr("3ba1a566c82090c8422dd6ca7258b2e1aed644206364441faf1bd80942f21745")),lG=gr({method:"POST"}).handler(yr("c9dff6ed7373b505d6aeeb84c63f87a0d0c205051d9d817929a5b500e5e79e03")),Qr={},kc=new Map;function cG(){return Qr.data?Promise.resolve(Qr.data):(Qr.promise||(Qr.promise=aG().then(t=>(Qr.data=t,t)).finally(()=>{Qr.promise=void 0})),Qr.promise)}function uG(t){const e=t.trim().toLowerCase(),n=kc.get(e);if(n?.data)return Promise.resolve(n.data);if(n?.promise)return n.promise;const r=lG({data:{prefix:e}}).then(o=>(kc.set(e,{data:o}),o)).finally(()=>{const o=kc.get(e);o&&delete o.promise});return kc.set(e,{data:n?.data,promise:r}),r}function dG(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 fG(t){const e=Ee.c(105),{triggerLabel:n,triggerClassName:r,triggerAriaLabel:o,triggerContent:s,selectedIcon:i,allowedLibraries:a,onSelectIcon:l}=t,[c,u]=x.useState(!1);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[0]=d):d=e[0];const[f,h]=x.useState(d),[p,m]=x.useState(!1),[g,y]=x.useState(),[b,w]=x.useState();let k;e[1]===Symbol.for("react.memo_cache_sentinel")?(k=[],e[1]=k):k=e[1];const[v,S]=x.useState(k),[E,M]=x.useState(!1),[D,F]=x.useState(),[N,A]=x.useState(""),[z,B]=x.useState(0);let U;e[2]!==i?(U=oG(i),e[2]=i,e[3]=U):U=e[3];const J=U;let Y;e[4]!==a?(Y=rG(a),e[4]=a,e[5]=Y):Y=e[5];const K=Y;let G,L;e[6]!==c?(G=()=>{if(!c)return;let ce=!1;return m(!0),y(void 0),cG().then(ie=>{ce||h(ie)}).catch(ie=>{if(ce)return;const he=ie instanceof Error?ie.message:String(ie);y(he),Hn.error(`Unable to load Iconify collections: ${he}`)}).finally(()=>{ce||m(!1)}),()=>{ce=!0}},L=[c],e[6]=c,e[7]=G,e[8]=L):(G=e[7],L=e[8]),x.useEffect(G,L);let W;if(e[9]!==f||e[10]!==K){const ce=K?new Set(K):void 0;W=f.filter(ie=>ce?ce.has(ie.prefix):!0),e[9]=f,e[10]=K,e[11]=W}else W=e[11];const $=W;let j,R;e[12]!==$||e[13]!==J.prefix||e[14]!==b?(j=()=>{if($.length===0){w(void 0);return}if(b&&$.some(ie=>ie.prefix===b))return;const ce=J.prefix?$.find(ie=>ie.prefix===J.prefix):void 0;w(ce?.prefix??$[0].prefix)},R=[$,J.prefix,b],e[12]=$,e[13]=J.prefix,e[14]=b,e[15]=j,e[16]=R):(j=e[15],R=e[16]),x.useEffect(j,R);let P,I;e[17]!==c||e[18]!==b?(P=()=>{if(!c||!b){S([]);return}let ce=!1;return M(!0),F(void 0),S([]),uG(b).then(ie=>{ce||S(ie)}).catch(ie=>{if(ce)return;const he=ie instanceof Error?ie.message:String(ie);F(he),Hn.error(`Unable to load icons for ${b}: ${he}`)}).finally(()=>{ce||M(!1)}),()=>{ce=!0}},I=[c,b],e[17]=c,e[18]=b,e[19]=P,e[20]=I):(P=e[19],I=e[20]),x.useEffect(P,I);let Z;if(e[21]!==v||e[22]!==N){e:{const ce=N.trim().toLowerCase();if(ce.length===0){Z=v;break e}Z=v.filter(ie=>ie.toLowerCase().includes(ce))}e[21]=v,e[22]=N,e[23]=Z}else Z=e[23];const X=Z;let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=()=>{B(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],x.useEffect(_,q);let T;e[28]!==X.length||e[29]!==z?(T=dG({scrollTop:z,viewportHeight:ei,rowHeight:tG,itemCount:X.length,overscan:nG}),e[28]=X.length,e[29]=z,e[30]=T):T=e[30];const O=T,V=J.prefix&&J.name?`${J.prefix}:${J.name}`:void 0;let H;e:{if(!b){H=void 0;break e}let ce;if(e[31]!==$||e[32]!==b){let ie;e[34]!==b?(ie=he=>he.prefix===b,e[34]=b,e[35]=ie):ie=e[35],ce=$.find(ie),e[31]=$,e[32]=b,e[33]=ce}else ce=e[33];H=ce}const Q=H;let ee;e[36]!==r?(ee=de(Ii({variant:"outline"}),"h-8 border-dashed text-xs",r),e[36]=r,e[37]=ee):ee=e[37];const re=s??n??"Pick icon";let oe;e[38]!==ee||e[39]!==re||e[40]!==o?(oe=C.jsx(Sl,{className:ee,"aria-label":o,children:re}),e[38]=ee,e[39]=re,e[40]=o,e[41]=oe):oe=e[41];let ne;e[42]!==p?(ne=p?C.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 px-1 text-xs",children:[C.jsx(Jn,{className:"size-3.5 animate-spin"}),"Loading libraries..."]}):null,e[42]=p,e[43]=ne):ne=e[43];let le;e[44]!==g||e[45]!==p?(le=!p&&g?C.jsx("div",{className:"text-destructive/90 rounded-md px-1 text-xs",children:g}):null,e[44]=g,e[45]=p,e[46]=le):le=e[46];let te;e[47]!==g||e[48]!==p||e[49]!==$?(te=!p&&!g&&$.length===0?C.jsx("p",{className:"text-muted-foreground px-1 text-xs",children:"No icon libraries found."}):null,e[47]=g,e[48]=p,e[49]=$,e[50]=te):te=e[50];let fe;e[51]!==g||e[52]!==p||e[53]!==$||e[54]!==b?(fe=!p&&!g&&$.length>0?C.jsx("div",{className:"overflow-x-auto pb-1",children:C.jsx("div",{className:"flex w-max min-w-full gap-1",children:$.map(ce=>{const ie=ce.prefix===b;return C.jsx("button",{type:"button",className:de("rounded-md px-2 py-1 text-xs whitespace-nowrap transition-colors",ie?"bg-foreground text-background":"bg-muted/55 text-muted-foreground hover:bg-muted/75 hover:text-foreground"),onClick:()=>{w(ce.prefix)},children:ce.prefix},ce.prefix)})})}):null,e[51]=g,e[52]=p,e[53]=$,e[54]=b,e[55]=fe):fe=e[55];const ge=Q?`${Q.name} (${Q.prefix}) · ${Q.total} icons`:"Select a library to browse icons.";let pe;e[56]!==ge?(pe=C.jsx("div",{className:"text-muted-foreground px-1 text-[11px]",children:ge}),e[56]=ge,e[57]=pe):pe=e[57];let Le;e[58]===Symbol.for("react.memo_cache_sentinel")?(Le=C.jsx(ff,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2"}),e[58]=Le):Le=e[58];let qe;e[59]===Symbol.for("react.memo_cache_sentinel")?(qe=ce=>{A(ce.target.value)},e[59]=qe):qe=e[59];const Je=!b;let Me;e[60]!==N||e[61]!==Je?(Me=C.jsxs("div",{className:"relative",children:[Le,C.jsx(er,{value:N,onChange:qe,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:Je})]}),e[60]=N,e[61]=Je,e[62]=Me):Me=e[62];let Oe;e[63]!==b?(Oe=b?null:C.jsx("div",{className:"text-muted-foreground flex items-center justify-center px-2 text-xs",style:{height:ei},children:"Select a library to browse icons."}),e[63]=b,e[64]=Oe):Oe=e[64];let ze;e[65]!==E||e[66]!==b?(ze=b&&E?C.jsxs("div",{className:"text-muted-foreground flex items-center justify-center gap-2 text-xs",style:{height:ei},children:[C.jsx(Jn,{className:"size-3.5 animate-spin"}),"Loading icons..."]}):null,e[65]=E,e[66]=b,e[67]=ze):ze=e[67];let Be;e[68]!==D||e[69]!==E||e[70]!==b?(Be=b&&!E&&D?C.jsx("div",{className:"text-destructive/90 px-2 py-2 text-xs",style:{height:ei},children:D}):null,e[68]=D,e[69]=E,e[70]=b,e[71]=Be):Be=e[71];let pt;e[72]!==X.length||e[73]!==D||e[74]!==E||e[75]!==b?(pt=b&&!E&&!D&&X.length===0?C.jsx("div",{className:"text-muted-foreground flex items-center justify-center px-2 text-xs",style:{height:ei},children:"No icons found."}):null,e[72]=X.length,e[73]=D,e[74]=E,e[75]=b,e[76]=pt):pt=e[76];let bt;e[77]!==X||e[78]!==O||e[79]!==D||e[80]!==E||e[81]!==l||e[82]!==V||e[83]!==b?(bt=b&&!E&&!D&&X.length>0?C.jsx("div",{className:"overflow-auto",style:{height:ei},onScroll:ce=>{B(ce.currentTarget.scrollTop)},children:C.jsx("div",{style:{height:O.totalHeight},children:C.jsx("div",{style:{transform:`translateY(${O.offsetY}px)`},children:X.slice(O.startIndex,O.endIndex).map(ce=>{const ie=`${b}:${ce}`,he=ie===V;return C.jsxs("button",{type:"button",className:de("hover:bg-muted/65 flex h-9 w-full items-center gap-2 px-2 text-left text-xs transition-colors",he?"bg-muted/70":""),onClick:()=>{l(ie),u(!1)},children:[C.jsx("span",{"aria-hidden":"true",className:"text-foreground size-4 shrink-0 bg-current",style:iG(sG(b,ce))}),C.jsx("span",{className:"text-foreground/90 flex-1 truncate",children:ce}),he?C.jsx(tg,{className:"size-3.5 shrink-0"}):null]},ce)})})})}):null,e[77]=X,e[78]=O,e[79]=D,e[80]=E,e[81]=l,e[82]=V,e[83]=b,e[84]=bt):bt=e[84];let mt;e[85]!==Oe||e[86]!==ze||e[87]!==Be||e[88]!==pt||e[89]!==bt?(mt=C.jsxs("div",{className:"border-border/50 rounded-md border",children:[Oe,ze,Be,pt,bt]}),e[85]=Oe,e[86]=ze,e[87]=Be,e[88]=pt,e[89]=bt,e[90]=mt):mt=e[90];let ht;e[91]!==Me||e[92]!==mt?(ht=C.jsxs("div",{className:"space-y-2",children:[Me,mt]}),e[91]=Me,e[92]=mt,e[93]=ht):ht=e[93];let Qe;e[94]!==ne||e[95]!==le||e[96]!==te||e[97]!==fe||e[98]!==pe||e[99]!==ht?(Qe=C.jsx(El,{className:"w-96 max-w-[calc(100vw-2rem)] p-3",children:C.jsxs("div",{className:"space-y-2",children:[ne,le,te,fe,pe,ht]})}),e[94]=ne,e[95]=le,e[96]=te,e[97]=fe,e[98]=pe,e[99]=ht,e[100]=Qe):Qe=e[100];let $e;return e[101]!==c||e[102]!==oe||e[103]!==Qe?($e=C.jsxs(xl,{open:c,onOpenChange:u,children:[oe,Qe]}),e[101]=c,e[102]=oe,e[103]=Qe,e[104]=$e):$e=e[104],$e}function xc(t){return t.toString().padStart(2,"0")}function Zw(t){const e=t.getFullYear(),n=xc(t.getMonth()+1),r=xc(t.getDate()),o=xc(t.getHours()),s=xc(t.getMinutes());return`${e}-${n}-${r}T${o}:${s}`}function hG(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 pG(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())?"":Zw(n)}if(typeof t=="number"){const e=hG(t);return e?Zw(e):""}return""}function mG(t){if(!t)return;const e=new Date(t);if(!Number.isNaN(e.getTime()))return e.toISOString()}const gG=gr({method:"POST"}).handler(yr("dcd3839820feeaed3b1a4f86186dd05c2e7e26ffaacdeaba309f44d121c95ad1")),yG=gr({method:"POST"}).handler(yr("02ba027930daf730cf535415a08fab7365d58edddcc678dbcb19c72f990c25b5"));function JM(t){return JSON.parse(JSON.stringify(t))}function bG(t){return Array.isArray(t)&&t.every(e=>typeof e=="string")}function vG(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 bG(e);case"dateAnyOf":return typeof e=="string"||typeof e=="number"&&Number.isFinite(e)||e===null;case"unsupported":return!1;default:return!1}}function Mm(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 wG(t){const e=Object.keys(t.revisionFrontmatter),n=Mm(t.reason),r=Object.fromEntries(e.map(o=>[o,n]));return{nextDraft:JM(t.currentDraft),appliedKeys:[],skippedKeys:e,reasonBySkippedKey:r}}function kG(t){const e=Lg(t.schema);if(!e)return wG({currentDraft:t.currentDraft,revisionFrontmatter:t.revisionFrontmatter,reason:"schema_unavailable"});const n=Fg(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=JM(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]=Mm(f);continue}if(!vG(d,u)){a.push(c),l[c]=Mm("incompatible_type");continue}s[c]=Array.isArray(u)?[...u]:u,i.push(c)}return{nextDraft:s,appliedKeys:i,skippedKeys:a,reasonBySkippedKey:l}}var Sc={exports:{}},sp={},Mr={},Yo={},ip={},ap={},lp={},Jw;function Zd(){return Jw||(Jw=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})(lp)),lp}var cp={},Xw;function Qw(){return Xw||(Xw=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=Zd();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})(cp)),cp}var ek;function je(){return ek||(ek=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=Zd(),n=Qw();var r=Zd();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=Qw();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,P){return this}}class i extends s{constructor(R,P,I){super(),this.varKind=R,this.name=P,this.rhs=I}render({es5:R,_n:P}){const I=R?n.varKinds.var:this.varKind,Z=this.rhs===void 0?"":` = ${this.rhs}`;return`${I} ${this.name}${Z};`+P}optimizeNames(R,P){if(R[this.name.str])return this.rhs&&(this.rhs=B(this.rhs,R,P)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class a extends s{constructor(R,P,I){super(),this.lhs=R,this.rhs=P,this.sideEffects=I}render({_n:R}){return`${this.lhs} = ${this.rhs};`+R}optimizeNames(R,P){if(!(this.lhs instanceof e.Name&&!R[this.lhs.str]&&!this.sideEffects))return this.rhs=B(this.rhs,R,P),this}get names(){const R=this.lhs instanceof e.Name?{}:{...this.lhs.names};return z(R,this.rhs)}}class l extends a{constructor(R,P,I,Z){super(R,I,Z),this.op=P}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,P){return this.code=B(this.code,R,P),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((P,I)=>P+I.render(R),"")}optimizeNodes(){const{nodes:R}=this;let P=R.length;for(;P--;){const I=R[P].optimizeNodes();Array.isArray(I)?R.splice(P,1,...I):I?R[P]=I:R.splice(P,1)}return R.length>0?this:void 0}optimizeNames(R,P){const{nodes:I}=this;let Z=I.length;for(;Z--;){const X=I[Z];X.optimizeNames(R,P)||(U(R,X.names),I.splice(Z,1))}return I.length>0?this:void 0}get names(){return this.nodes.reduce((R,P)=>A(R,P.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,P){super(P),this.condition=R}render(R){let P=`if(${this.condition})`+super.render(R);return this.else&&(P+="else "+this.else.render(R)),P}optimizeNodes(){super.optimizeNodes();const R=this.condition;if(R===!0)return this.nodes;let P=this.else;if(P){const I=P.optimizeNodes();P=this.else=Array.isArray(I)?new g(I):I}if(P)return R===!1?P instanceof y?P:P.nodes:this.nodes.length?this:new y(J(R),P instanceof y?[P]:P.nodes);if(!(R===!1||!this.nodes.length))return this}optimizeNames(R,P){var I;if(this.else=(I=this.else)===null||I===void 0?void 0:I.optimizeNames(R,P),!!(super.optimizeNames(R,P)||this.else))return this.condition=B(this.condition,R,P),this}get names(){const R=super.names;return z(R,this.condition),this.else&&A(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,P){if(super.optimizeNames(R,P))return this.iteration=B(this.iteration,R,P),this}get names(){return A(super.names,this.iteration.names)}}class k extends b{constructor(R,P,I,Z){super(),this.varKind=R,this.name=P,this.from=I,this.to=Z}render(R){const P=R.es5?n.varKinds.var:this.varKind,{name:I,from:Z,to:X}=this;return`for(${P} ${I}=${Z}; ${I}<${X}; ${I}++)`+super.render(R)}get names(){const R=z(super.names,this.from);return z(R,this.to)}}class v extends b{constructor(R,P,I,Z){super(),this.loop=R,this.varKind=P,this.name=I,this.iterable=Z}render(R){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(R)}optimizeNames(R,P){if(super.optimizeNames(R,P))return this.iterable=B(this.iterable,R,P),this}get names(){return A(super.names,this.iterable.names)}}class S extends p{constructor(R,P,I){super(),this.name=R,this.args=P,this.async=I}render(R){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(R)}}S.kind="func";class E extends h{render(R){return"return "+super.render(R)}}E.kind="return";class M extends p{render(R){let P="try"+super.render(R);return this.catch&&(P+=this.catch.render(R)),this.finally&&(P+=this.finally.render(R)),P}optimizeNodes(){var R,P;return super.optimizeNodes(),(R=this.catch)===null||R===void 0||R.optimizeNodes(),(P=this.finally)===null||P===void 0||P.optimizeNodes(),this}optimizeNames(R,P){var I,Z;return super.optimizeNames(R,P),(I=this.catch)===null||I===void 0||I.optimizeNames(R,P),(Z=this.finally)===null||Z===void 0||Z.optimizeNames(R,P),this}get names(){const R=super.names;return this.catch&&A(R,this.catch.names),this.finally&&A(R,this.finally.names),R}}class D extends p{constructor(R){super(),this.error=R}render(R){return`catch(${this.error})`+super.render(R)}}D.kind="catch";class F extends p{render(R){return"finally"+super.render(R)}}F.kind="finally";class N{constructor(R,P={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...P,_n:P.lines?`
372
+ `:""},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,P){const I=this._extScope.value(R,P);return(this._values[I.prefix]||(this._values[I.prefix]=new Set)).add(I),I}getScopeValue(R,P){return this._extScope.getValue(R,P)}scopeRefs(R){return this._extScope.scopeRefs(R,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(R,P,I,Z){const X=this._scope.toName(P);return I!==void 0&&Z&&(this._constants[X.str]=I),this._leafNode(new i(R,X,I)),X}const(R,P,I){return this._def(n.varKinds.const,R,P,I)}let(R,P,I){return this._def(n.varKinds.let,R,P,I)}var(R,P,I){return this._def(n.varKinds.var,R,P,I)}assign(R,P,I){return this._leafNode(new a(R,P,I))}add(R,P){return this._leafNode(new l(R,t.operators.ADD,P))}code(R){return typeof R=="function"?R():R!==e.nil&&this._leafNode(new f(R)),this}object(...R){const P=["{"];for(const[I,Z]of R)P.length>1&&P.push(","),P.push(I),(I!==Z||this.opts.es5)&&(P.push(":"),(0,e.addCodeArg)(P,Z));return P.push("}"),new e._Code(P)}if(R,P,I){if(this._blockNode(new y(R)),P&&I)this.code(P).else().code(I).endIf();else if(P)this.code(P).endIf();else if(I)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,P){return this._blockNode(R),P&&this.code(P).endFor(),this}for(R,P){return this._for(new w(R),P)}forRange(R,P,I,Z,X=this.opts.es5?n.varKinds.var:n.varKinds.let){const _=this._scope.toName(R);return this._for(new k(X,_,P,I),()=>Z(_))}forOf(R,P,I,Z=n.varKinds.const){const X=this._scope.toName(R);if(this.opts.es5){const _=P instanceof e.Name?P:this.var("_arr",P);return this.forRange("_i",0,(0,e._)`${_}.length`,q=>{this.var(X,(0,e._)`${_}[${q}]`),I(X)})}return this._for(new v("of",Z,X,P),()=>I(X))}forIn(R,P,I,Z=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(R,(0,e._)`Object.keys(${P})`,I);const X=this._scope.toName(R);return this._for(new v("in",Z,X,P),()=>I(X))}endFor(){return this._endBlockNode(b)}label(R){return this._leafNode(new c(R))}break(R){return this._leafNode(new u(R))}return(R){const P=new E;if(this._blockNode(P),this.code(R),P.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(E)}try(R,P,I){if(!P&&!I)throw new Error('CodeGen: "try" without "catch" and "finally"');const Z=new M;if(this._blockNode(Z),this.code(R),P){const X=this.name("e");this._currNode=Z.catch=new D(X),P(X)}return I&&(this._currNode=Z.finally=new F,this.code(I)),this._endBlockNode(D,F)}throw(R){return this._leafNode(new d(R))}block(R,P){return this._blockStarts.push(this._nodes.length),R&&this.code(R).endBlock(P),this}endBlock(R){const P=this._blockStarts.pop();if(P===void 0)throw new Error("CodeGen: not in self-balancing block");const I=this._nodes.length-P;if(I<0||R!==void 0&&I!==R)throw new Error(`CodeGen: wrong number of nodes: ${I} vs ${R} expected`);return this._nodes.length=P,this}func(R,P=e.nil,I,Z){return this._blockNode(new S(R,P,I)),Z&&this.code(Z).endFunc(),this}endFunc(){return this._endBlockNode(S)}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,P){const I=this._currNode;if(I instanceof R||P&&I instanceof P)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${P?`${R.kind}/${P.kind}`:R.kind}"`)}_elseNode(R){const P=this._currNode;if(!(P instanceof y))throw new Error('CodeGen: "else" without "if"');return this._currNode=P.else=R,this}get _root(){return this._nodes[0]}get _currNode(){const R=this._nodes;return R[R.length-1]}set _currNode(R){const P=this._nodes;P[P.length-1]=R}}t.CodeGen=N;function A(j,R){for(const P in R)j[P]=(j[P]||0)+(R[P]||0);return j}function z(j,R){return R instanceof e._CodeOrName?A(j,R.names):j}function B(j,R,P){if(j instanceof e.Name)return I(j);if(!Z(j))return j;return new e._Code(j._items.reduce((X,_)=>(_ instanceof e.Name&&(_=I(_)),_ instanceof e._Code?X.push(..._._items):X.push(_),X),[]));function I(X){const _=P[X.str];return _===void 0||R[X.str]!==1?X:(delete R[X.str],_)}function Z(X){return X instanceof e._Code&&X._items.some(_=>_ instanceof e.Name&&R[_.str]===1&&P[_.str]!==void 0)}}function U(j,R){for(const P in R)j[P]=(j[P]||0)-(R[P]||0)}function J(j){return typeof j=="boolean"||typeof j=="number"||j===null?!j:(0,e._)`!${$(j)}`}t.not=J;const Y=W(t.operators.AND);function K(...j){return j.reduce(Y)}t.and=K;const G=W(t.operators.OR);function L(...j){return j.reduce(G)}t.or=L;function W(j){return(R,P)=>R===e.nil?P:P===e.nil?R:(0,e._)`${$(R)} ${j} ${$(P)}`}function $(j){return j instanceof e.Name?j:(0,e._)`(${j})`}})(ap)),ap}var Ue={},tk;function Ge(){if(tk)return Ue;tk=1,Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.checkStrictMode=Ue.getErrorPath=Ue.Type=Ue.useFunc=Ue.setEvaluated=Ue.evaluatedPropsToName=Ue.mergeEvaluated=Ue.eachItem=Ue.unescapeJsonPointer=Ue.escapeJsonPointer=Ue.escapeFragment=Ue.unescapeFragment=Ue.schemaRefOrVal=Ue.schemaHasRulesButRef=Ue.schemaHasRules=Ue.checkUnknownRules=Ue.alwaysValidSchema=Ue.toHash=void 0;const t=je(),e=Zd();function n(v){const S={};for(const E of v)S[E]=!0;return S}Ue.toHash=n;function r(v,S){return typeof S=="boolean"?S:Object.keys(S).length===0?!0:(o(v,S),!s(S,v.self.RULES.all))}Ue.alwaysValidSchema=r;function o(v,S=v.schema){const{opts:E,self:M}=v;if(!E.strictSchema||typeof S=="boolean")return;const D=M.RULES.keywords;for(const F in S)D[F]||k(v,`unknown keyword: "${F}"`)}Ue.checkUnknownRules=o;function s(v,S){if(typeof v=="boolean")return!v;for(const E in v)if(S[E])return!0;return!1}Ue.schemaHasRules=s;function i(v,S){if(typeof v=="boolean")return!v;for(const E in v)if(E!=="$ref"&&S.all[E])return!0;return!1}Ue.schemaHasRulesButRef=i;function a({topSchemaRef:v,schemaPath:S},E,M,D){if(!D){if(typeof E=="number"||typeof E=="boolean")return E;if(typeof E=="string")return(0,t._)`${E}`}return(0,t._)`${v}${S}${(0,t.getProperty)(M)}`}Ue.schemaRefOrVal=a;function l(v){return d(decodeURIComponent(v))}Ue.unescapeFragment=l;function c(v){return encodeURIComponent(u(v))}Ue.escapeFragment=c;function u(v){return typeof v=="number"?`${v}`:v.replace(/~/g,"~0").replace(/\//g,"~1")}Ue.escapeJsonPointer=u;function d(v){return v.replace(/~1/g,"/").replace(/~0/g,"~")}Ue.unescapeJsonPointer=d;function f(v,S){if(Array.isArray(v))for(const E of v)S(E);else S(v)}Ue.eachItem=f;function h({mergeNames:v,mergeToName:S,mergeValues:E,resultToName:M}){return(D,F,N,A)=>{const z=N===void 0?F:N instanceof t.Name?(F instanceof t.Name?v(D,F,N):S(D,F,N),N):F instanceof t.Name?(S(D,N,F),F):E(F,N);return A===t.Name&&!(z instanceof t.Name)?M(D,z):z}}Ue.mergeEvaluated={props:h({mergeNames:(v,S,E)=>v.if((0,t._)`${E} !== true && ${S} !== undefined`,()=>{v.if((0,t._)`${S} === true`,()=>v.assign(E,!0),()=>v.assign(E,(0,t._)`${E} || {}`).code((0,t._)`Object.assign(${E}, ${S})`))}),mergeToName:(v,S,E)=>v.if((0,t._)`${E} !== true`,()=>{S===!0?v.assign(E,!0):(v.assign(E,(0,t._)`${E} || {}`),m(v,E,S))}),mergeValues:(v,S)=>v===!0?!0:{...v,...S},resultToName:p}),items:h({mergeNames:(v,S,E)=>v.if((0,t._)`${E} !== true && ${S} !== undefined`,()=>v.assign(E,(0,t._)`${S} === true ? true : ${E} > ${S} ? ${E} : ${S}`)),mergeToName:(v,S,E)=>v.if((0,t._)`${E} !== true`,()=>v.assign(E,S===!0?!0:(0,t._)`${E} > ${S} ? ${E} : ${S}`)),mergeValues:(v,S)=>v===!0?!0:Math.max(v,S),resultToName:(v,S)=>v.var("items",S)})};function p(v,S){if(S===!0)return v.var("props",!0);const E=v.var("props",(0,t._)`{}`);return S!==void 0&&m(v,E,S),E}Ue.evaluatedPropsToName=p;function m(v,S,E){Object.keys(E).forEach(M=>v.assign((0,t._)`${S}${(0,t.getProperty)(M)}`,!0))}Ue.setEvaluated=m;const g={};function y(v,S){return v.scopeValue("func",{ref:S,code:g[S.code]||(g[S.code]=new e._Code(S.code))})}Ue.useFunc=y;var b;(function(v){v[v.Num=0]="Num",v[v.Str=1]="Str"})(b||(Ue.Type=b={}));function w(v,S,E){if(v instanceof t.Name){const M=S===b.Num;return E?M?(0,t._)`"[" + ${v} + "]"`:(0,t._)`"['" + ${v} + "']"`:M?(0,t._)`"/" + ${v}`:(0,t._)`"/" + ${v}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return E?(0,t.getProperty)(v).toString():"/"+u(v)}Ue.getErrorPath=w;function k(v,S,E=v.opts.strictSchema){if(E){if(S=`strict mode: ${S}`,E===!0)throw new Error(S);v.self.logger.warn(S)}}return Ue.checkStrictMode=k,Ue}var Ec={},nk;function tr(){if(nk)return Ec;nk=1,Object.defineProperty(Ec,"__esModule",{value:!0});const t=je(),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 Ec.default=e,Ec}var rk;function qf(){return rk||(rk=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=je(),n=Ge(),r=tr();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:S,allErrors:E}=k,M=d(g,y,b);w??(S||E)?l(v,M):c(k,(0,e._)`[${M}]`)}t.reportError=o;function s(g,y=t.keywordError,b){const{it:w}=g,{gen:k,compositeRule:v,allErrors:S}=w,E=d(g,y,b);l(k,E),v||S||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 S=g.name("err");g.forRange("i",k,r.default.errors,E=>{g.const(S,(0,e._)`${r.default.vErrors}[${E}]`),g.if((0,e._)`${S}.instancePath === undefined`,()=>g.assign((0,e._)`${S}.instancePath`,(0,e.strConcat)(r.default.instancePath,v.errorPath))),g.assign((0,e._)`${S}.schemaPath`,(0,e.str)`${v.errSchemaPath}/${y}`),v.opts.verbose&&(g.assign((0,e._)`${S}.schema`,b),g.assign((0,e._)`${S}.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:S,it:E}=g,{opts:M,propertyName:D,topSchemaRef:F,schemaPath:N}=E;w.push([u.keyword,k],[u.params,typeof y=="function"?y(g):y||(0,e._)`{}`]),M.messages&&w.push([u.message,typeof b=="function"?b(g):b]),M.verbose&&w.push([u.schema,S],[u.parentSchema,(0,e._)`${F}${N}`],[r.default.data,v]),D&&w.push([u.propertyName,D])}})(ip)),ip}var ok;function xG(){if(ok)return Yo;ok=1,Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.boolOrEmptySchema=Yo.topBoolOrEmptySchema=void 0;const t=qf(),e=je(),n=tr(),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))}Yo.topBoolOrEmptySchema=o;function s(a,l){const{gen:c,schema:u}=a;u===!1?(c.var(l,!1),i(a)):c.var(l,!0)}Yo.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 Yo}var Ht={},Go={},sk;function XM(){if(sk)return Go;sk=1,Object.defineProperty(Go,"__esModule",{value:!0}),Go.getRules=Go.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)}Go.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 Go.getRules=r,Go}var Or={},ik;function QM(){if(ik)return Or;ik=1,Object.defineProperty(Or,"__esModule",{value:!0}),Or.shouldUseRule=Or.shouldUseGroup=Or.schemaHasRulesForType=void 0;function t({schema:r,self:o},s){const i=o.RULES.types[s];return i&&i!==!0&&e(r,i)}Or.schemaHasRulesForType=t;function e(r,o){return o.rules.some(s=>n(r,s))}Or.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 Or.shouldUseRule=n,Or}var ak;function Jd(){if(ak)return Ht;ak=1,Object.defineProperty(Ht,"__esModule",{value:!0}),Ht.reportTypeError=Ht.checkDataTypes=Ht.checkDataType=Ht.coerceAndCheckDataType=Ht.getJSONTypes=Ht.getSchemaTypes=Ht.DataType=void 0;const t=XM(),e=QM(),n=qf(),r=je(),o=Ge();var s;(function(b){b[b.Correct=0]="Correct",b[b.Wrong=1]="Wrong"})(s||(Ht.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}Ht.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(","))}Ht.getJSONTypes=a;function l(b,w){const{gen:k,data:v,opts:S}=b,E=u(w,S.coerceTypes),M=w.length>0&&!(E.length===0&&w.length===1&&(0,e.schemaHasRulesForType)(b,w[0]));if(M){const D=p(w,v,S.strictNumbers,s.Wrong);k.if(D,()=>{E.length?d(b,w,E):g(b)})}return M}Ht.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:S,opts:E}=b,M=v.let("dataType",(0,r._)`typeof ${S}`),D=v.let("coerced",(0,r._)`undefined`);E.coerceTypes==="array"&&v.if((0,r._)`${M} == 'object' && Array.isArray(${S}) && ${S}.length == 1`,()=>v.assign(S,(0,r._)`${S}[0]`).assign(M,(0,r._)`typeof ${S}`).if(p(w,S,E.strictNumbers),()=>v.assign(D,S))),v.if((0,r._)`${D} !== undefined`);for(const N of k)(c.has(N)||N==="array"&&E.coerceTypes==="array")&&F(N);v.else(),g(b),v.endIf(),v.if((0,r._)`${D} !== undefined`,()=>{v.assign(S,D),f(b,D)});function F(N){switch(N){case"string":v.elseIf((0,r._)`${M} == "number" || ${M} == "boolean"`).assign(D,(0,r._)`"" + ${S}`).elseIf((0,r._)`${S} === null`).assign(D,(0,r._)`""`);return;case"number":v.elseIf((0,r._)`${M} == "boolean" || ${S} === null
373
+ || (${M} == "string" && ${S} && ${S} == +${S})`).assign(D,(0,r._)`+${S}`);return;case"integer":v.elseIf((0,r._)`${M} === "boolean" || ${S} === null
374
+ || (${M} === "string" && ${S} && ${S} == +${S} && !(${S} % 1))`).assign(D,(0,r._)`+${S}`);return;case"boolean":v.elseIf((0,r._)`${S} === "false" || ${S} === 0 || ${S} === null`).assign(D,!1).elseIf((0,r._)`${S} === "true" || ${S} === 1`).assign(D,!0);return;case"null":v.elseIf((0,r._)`${S} === "" || ${S} === 0 || ${S} === false`),v.assign(D,null);return;case"array":v.elseIf((0,r._)`${M} === "string" || ${M} === "number"
375
+ || ${M} === "boolean" || ${S} === null`).assign(D,(0,r._)`[${S}]`)}}}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 S=v===s.Correct?r.operators.EQ:r.operators.NEQ;let E;switch(b){case"null":return(0,r._)`${w} ${S} null`;case"array":E=(0,r._)`Array.isArray(${w})`;break;case"object":E=(0,r._)`${w} && typeof ${w} == "object" && !Array.isArray(${w})`;break;case"integer":E=M((0,r._)`!(${w} % 1) && !isNaN(${w})`);break;case"number":E=M();break;default:return(0,r._)`typeof ${w} ${S} ${b}`}return v===s.Correct?E:(0,r.not)(E);function M(D=r.nil){return(0,r.and)((0,r._)`typeof ${w} == "number"`,D,k?(0,r._)`isFinite(${w})`:r.nil)}}Ht.checkDataType=h;function p(b,w,k,v){if(b.length===1)return h(b[0],w,k,v);let S;const E=(0,o.toHash)(b);if(E.array&&E.object){const M=(0,r._)`typeof ${w} != "object"`;S=E.null?M:(0,r._)`!${w} || ${M}`,delete E.null,delete E.array,delete E.object}else S=r.nil;E.number&&delete E.integer;for(const M in E)S=(0,r.and)(S,h(M,w,k,v));return S}Ht.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)}Ht.reportTypeError=g;function y(b){const{gen:w,data:k,schema:v}=b,S=(0,o.schemaRefOrVal)(b,v,"type");return{gen:w,keyword:"type",data:k,schema:v.type,schemaCode:S,schemaValue:S,parentSchema:v,params:{},it:b}}return Ht}var ga={},lk;function SG(){if(lk)return ga;lk=1,Object.defineProperty(ga,"__esModule",{value:!0}),ga.assignDefaults=void 0;const t=je(),e=Ge();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))}ga.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 ga}var Wn={},et={},ck;function nr(){if(ck)return et;ck=1,Object.defineProperty(et,"__esModule",{value:!0}),et.validateUnion=et.validateArray=et.usePattern=et.callValidateCode=et.schemaProperties=et.allSchemaProperties=et.noPropertyInData=et.propertyInData=et.isOwnProperty=et.hasPropFunc=et.reportMissingProp=et.checkMissingProp=et.checkReportMissingProp=void 0;const t=je(),e=Ge(),n=tr(),r=Ge();function o(b,w){const{gen:k,data:v,it:S}=b;k.if(u(k,v,w,S.opts.ownProperties),()=>{b.setParams({missingProperty:(0,t._)`${w}`},!0),b.error()})}et.checkReportMissingProp=o;function s({gen:b,data:w,it:{opts:k}},v,S){return(0,t.or)(...v.map(E=>(0,t.and)(u(b,w,E,k.ownProperties),(0,t._)`${S} = ${E}`)))}et.checkMissingProp=s;function i(b,w){b.setParams({missingProperty:w},!0),b.error()}et.reportMissingProp=i;function a(b){return b.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}et.hasPropFunc=a;function l(b,w,k){return(0,t._)`${a(b)}.call(${w}, ${k})`}et.isOwnProperty=l;function c(b,w,k,v){const S=(0,t._)`${w}${(0,t.getProperty)(k)} !== undefined`;return v?(0,t._)`${S} && ${l(b,w,k)}`:S}et.propertyInData=c;function u(b,w,k,v){const S=(0,t._)`${w}${(0,t.getProperty)(k)} === undefined`;return v?(0,t.or)(S,(0,t.not)(l(b,w,k))):S}et.noPropertyInData=u;function d(b){return b?Object.keys(b).filter(w=>w!=="__proto__"):[]}et.allSchemaProperties=d;function f(b,w){return d(w).filter(k=>!(0,e.alwaysValidSchema)(b,w[k]))}et.schemaProperties=f;function h({schemaCode:b,data:w,it:{gen:k,topSchemaRef:v,schemaPath:S,errorPath:E},it:M},D,F,N){const A=N?(0,t._)`${b}, ${w}, ${v}${S}`:w,z=[[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,E)],[n.default.parentData,M.parentData],[n.default.parentDataProperty,M.parentDataProperty],[n.default.rootData,n.default.rootData]];M.opts.dynamicRef&&z.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);const B=(0,t._)`${A}, ${k.object(...z)}`;return F!==t.nil?(0,t._)`${D}.call(${F}, ${B})`:(0,t._)`${D}(${B})`}et.callValidateCode=h;const p=(0,t._)`new RegExp`;function m({gen:b,it:{opts:w}},k){const v=w.unicodeRegExp?"u":"",{regExp:S}=w.code,E=S(k,v);return b.scopeValue("pattern",{key:E.toString(),ref:E,code:(0,t._)`${S.code==="new RegExp"?p:(0,r.useFunc)(b,S)}(${k}, ${v})`})}et.usePattern=m;function g(b){const{gen:w,data:k,keyword:v,it:S}=b,E=w.name("valid");if(S.allErrors){const D=w.let("valid",!0);return M(()=>w.assign(D,!1)),D}return w.var(E,!0),M(()=>w.break()),E;function M(D){const F=w.const("len",(0,t._)`${k}.length`);w.forRange("i",0,F,N=>{b.subschema({keyword:v,dataProp:N,dataPropType:e.Type.Num},E),w.if((0,t.not)(E),D)})}}et.validateArray=g;function y(b){const{gen:w,schema:k,keyword:v,it:S}=b;if(!Array.isArray(k))throw new Error("ajv implementation error");if(k.some(F=>(0,e.alwaysValidSchema)(S,F))&&!S.opts.unevaluated)return;const M=w.let("valid",!1),D=w.name("_valid");w.block(()=>k.forEach((F,N)=>{const A=b.subschema({keyword:v,schemaProp:N,compositeRule:!0},D);w.assign(M,(0,t._)`${M} || ${D}`),b.mergeValidEvaluated(A,D)||w.if((0,t.not)(M))})),b.result(M,()=>b.reset(),()=>b.error(!0))}return et.validateUnion=y,et}var uk;function EG(){if(uk)return Wn;uk=1,Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.validateKeywordUsage=Wn.validSchemaType=Wn.funcKeywordCode=Wn.macroKeywordCode=void 0;const t=je(),e=tr(),n=nr(),r=qf();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))}Wn.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,S=c(m,g,v),E=m.let("valid");f.block$data(E,M),f.ok((p=h.valid)!==null&&p!==void 0?p:E);function M(){if(h.errors===!1)N(),h.modifying&&i(f),A(()=>f.error());else{const z=h.async?D():F();h.modifying&&i(f),A(()=>a(f,z))}}function D(){const z=m.let("ruleErrs",null);return m.try(()=>N((0,t._)`await `),B=>m.assign(E,!1).if((0,t._)`${B} instanceof ${k.ValidationError}`,()=>m.assign(z,(0,t._)`${B}.errors`),()=>m.throw(B))),z}function F(){const z=(0,t._)`${S}.errors`;return m.assign(z,null),N(t.nil),z}function N(z=h.async?(0,t._)`await `:t.nil){const B=k.opts.passContext?e.default.this:e.default.self,U=!("compile"in h&&!w||h.schema===!1);m.assign(E,(0,t._)`${z}${(0,n.callValidateCode)(f,S,B,U)}`,h.modifying)}function A(z){var B;m.if((0,t.not)((B=h.valid)!==null&&B!==void 0?B:E),z)}}Wn.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")}Wn.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 Wn.validateKeywordUsage=d,Wn}var _r={},dk;function CG(){if(dk)return _r;dk=1,Object.defineProperty(_r,"__esModule",{value:!0}),_r.extendSubschemaMode=_r.extendSubschemaData=_r.getSubschema=void 0;const t=je(),e=Ge();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')}_r.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]}}_r.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 _r.extendSubschemaMode=o,_r}var nn={},up,fk;function eO(){return fk||(fk=1,up=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}),up}var dp={exports:{}},hk;function TG(){if(hk)return dp.exports;hk=1;var t=dp.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 dp.exports}var pk;function Uf(){if(pk)return nn;pk=1,Object.defineProperty(nn,"__esModule",{value:!0}),nn.getSchemaRefs=nn.resolveUrl=nn.normalizeId=nn._getFullPath=nn.getFullPath=nn.inlineRef=void 0;const t=Ge(),e=eO(),n=TG(),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),S={},E=new Set;return n(m,{allKeys:!0},(F,N,A,z)=>{if(z===void 0)return;const B=v+N;let U=k[z];typeof F[y]=="string"&&(U=J.call(this,F[y])),Y.call(this,F.$anchor),Y.call(this,F.$dynamicAnchor),k[N]=U;function J(K){const G=this.opts.uriResolver.resolve;if(K=d(U?G(U,K):K),E.has(K))throw D(K);E.add(K);let L=this.refs[K];return typeof L=="string"&&(L=this.refs[L]),typeof L=="object"?M(F,L.schema,K):K!==d(B)&&(K[0]==="#"?(M(F,S[K],K),S[K]=F):this.refs[K]=B),K}function Y(K){if(typeof K=="string"){if(!h.test(K))throw new Error(`invalid anchor "${K}"`);J.call(this,`#${K}`)}}}),S;function M(F,N,A){if(N!==void 0&&!e(F,N))throw D(A)}function D(F){return new Error(`reference "${F}" resolves to more than one schema`)}}return nn.getSchemaRefs=p,nn}var mk;function $l(){if(mk)return Mr;mk=1,Object.defineProperty(Mr,"__esModule",{value:!0}),Mr.getData=Mr.KeywordCxt=Mr.validateFunctionCode=void 0;const t=xG(),e=Jd(),n=QM(),r=Jd(),o=SG(),s=EG(),i=CG(),a=je(),l=tr(),c=Uf(),u=Ge(),d=qf();function f(T){if(v(T)&&(E(T),k(T))){g(T);return}h(T,()=>(0,t.topBoolOrEmptySchema)(T))}Mr.validateFunctionCode=f;function h({gen:T,validateName:O,schema:V,schemaEnv:H,opts:Q},ee){Q.code.es5?T.func(O,(0,a._)`${l.default.data}, ${l.default.valCxt}`,H.$async,()=>{T.code((0,a._)`"use strict"; ${b(V,Q)}`),m(T,Q),T.code(ee)}):T.func(O,(0,a._)`${l.default.data}, ${p(Q)}`,H.$async,()=>T.code(b(V,Q)).code(ee))}function p(T){return(0,a._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${T.dynamicRef?(0,a._)`, ${l.default.dynamicAnchors}={}`:a.nil}}={}`}function m(T,O){T.if(l.default.valCxt,()=>{T.var(l.default.instancePath,(0,a._)`${l.default.valCxt}.${l.default.instancePath}`),T.var(l.default.parentData,(0,a._)`${l.default.valCxt}.${l.default.parentData}`),T.var(l.default.parentDataProperty,(0,a._)`${l.default.valCxt}.${l.default.parentDataProperty}`),T.var(l.default.rootData,(0,a._)`${l.default.valCxt}.${l.default.rootData}`),O.dynamicRef&&T.var(l.default.dynamicAnchors,(0,a._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{T.var(l.default.instancePath,(0,a._)`""`),T.var(l.default.parentData,(0,a._)`undefined`),T.var(l.default.parentDataProperty,(0,a._)`undefined`),T.var(l.default.rootData,l.default.data),O.dynamicRef&&T.var(l.default.dynamicAnchors,(0,a._)`{}`)})}function g(T){const{schema:O,opts:V,gen:H}=T;h(T,()=>{V.$comment&&O.$comment&&z(T),F(T),H.let(l.default.vErrors,null),H.let(l.default.errors,0),V.unevaluated&&y(T),M(T),B(T)})}function y(T){const{gen:O,validateName:V}=T;T.evaluated=O.const("evaluated",(0,a._)`${V}.evaluated`),O.if((0,a._)`${T.evaluated}.dynamicProps`,()=>O.assign((0,a._)`${T.evaluated}.props`,(0,a._)`undefined`)),O.if((0,a._)`${T.evaluated}.dynamicItems`,()=>O.assign((0,a._)`${T.evaluated}.items`,(0,a._)`undefined`))}function b(T,O){const V=typeof T=="object"&&T[O.schemaId];return V&&(O.code.source||O.code.process)?(0,a._)`/*# sourceURL=${V} */`:a.nil}function w(T,O){if(v(T)&&(E(T),k(T))){S(T,O);return}(0,t.boolOrEmptySchema)(T,O)}function k({schema:T,self:O}){if(typeof T=="boolean")return!T;for(const V in T)if(O.RULES.all[V])return!0;return!1}function v(T){return typeof T.schema!="boolean"}function S(T,O){const{schema:V,gen:H,opts:Q}=T;Q.$comment&&V.$comment&&z(T),N(T),A(T);const ee=H.const("_errs",l.default.errors);M(T,ee),H.var(O,(0,a._)`${ee} === ${l.default.errors}`)}function E(T){(0,u.checkUnknownRules)(T),D(T)}function M(T,O){if(T.opts.jtd)return J(T,[],!1,O);const V=(0,e.getSchemaTypes)(T.schema),H=(0,e.coerceAndCheckDataType)(T,V);J(T,V,!H,O)}function D(T){const{schema:O,errSchemaPath:V,opts:H,self:Q}=T;O.$ref&&H.ignoreKeywordsWithRef&&(0,u.schemaHasRulesButRef)(O,Q.RULES)&&Q.logger.warn(`$ref: keywords ignored in schema at path "${V}"`)}function F(T){const{schema:O,opts:V}=T;O.default!==void 0&&V.useDefaults&&V.strictSchema&&(0,u.checkStrictMode)(T,"default is ignored in the schema root")}function N(T){const O=T.schema[T.opts.schemaId];O&&(T.baseId=(0,c.resolveUrl)(T.opts.uriResolver,T.baseId,O))}function A(T){if(T.schema.$async&&!T.schemaEnv.$async)throw new Error("async schema in sync schema")}function z({gen:T,schemaEnv:O,schema:V,errSchemaPath:H,opts:Q}){const ee=V.$comment;if(Q.$comment===!0)T.code((0,a._)`${l.default.self}.logger.log(${ee})`);else if(typeof Q.$comment=="function"){const re=(0,a.str)`${H}/$comment`,oe=T.scopeValue("root",{ref:O.root});T.code((0,a._)`${l.default.self}.opts.$comment(${ee}, ${re}, ${oe}.schema)`)}}function B(T){const{gen:O,schemaEnv:V,validateName:H,ValidationError:Q,opts:ee}=T;V.$async?O.if((0,a._)`${l.default.errors} === 0`,()=>O.return(l.default.data),()=>O.throw((0,a._)`new ${Q}(${l.default.vErrors})`)):(O.assign((0,a._)`${H}.errors`,l.default.vErrors),ee.unevaluated&&U(T),O.return((0,a._)`${l.default.errors} === 0`))}function U({gen:T,evaluated:O,props:V,items:H}){V instanceof a.Name&&T.assign((0,a._)`${O}.props`,V),H instanceof a.Name&&T.assign((0,a._)`${O}.items`,H)}function J(T,O,V,H){const{gen:Q,schema:ee,data:re,allErrors:oe,opts:ne,self:le}=T,{RULES:te}=le;if(ee.$ref&&(ne.ignoreKeywordsWithRef||!(0,u.schemaHasRulesButRef)(ee,te))){Q.block(()=>Z(T,"$ref",te.all.$ref.definition));return}ne.jtd||K(T,O),Q.block(()=>{for(const ge of te.rules)fe(ge);fe(te.post)});function fe(ge){(0,n.shouldUseGroup)(ee,ge)&&(ge.type?(Q.if((0,r.checkDataType)(ge.type,re,ne.strictNumbers)),Y(T,ge),O.length===1&&O[0]===ge.type&&V&&(Q.else(),(0,r.reportTypeError)(T)),Q.endIf()):Y(T,ge),oe||Q.if((0,a._)`${l.default.errors} === ${H||0}`))}}function Y(T,O){const{gen:V,schema:H,opts:{useDefaults:Q}}=T;Q&&(0,o.assignDefaults)(T,O.type),V.block(()=>{for(const ee of O.rules)(0,n.shouldUseRule)(H,ee)&&Z(T,ee.keyword,ee.definition,O.type)})}function K(T,O){T.schemaEnv.meta||!T.opts.strictTypes||(G(T,O),T.opts.allowUnionTypes||L(T,O),W(T,T.dataTypes))}function G(T,O){if(O.length){if(!T.dataTypes.length){T.dataTypes=O;return}O.forEach(V=>{j(T.dataTypes,V)||P(T,`type "${V}" not allowed by context "${T.dataTypes.join(",")}"`)}),R(T,O)}}function L(T,O){O.length>1&&!(O.length===2&&O.includes("null"))&&P(T,"use allowUnionTypes to allow union type keyword")}function W(T,O){const V=T.self.RULES.all;for(const H in V){const Q=V[H];if(typeof Q=="object"&&(0,n.shouldUseRule)(T.schema,Q)){const{type:ee}=Q.definition;ee.length&&!ee.some(re=>$(O,re))&&P(T,`missing type "${ee.join(",")}" for keyword "${H}"`)}}}function $(T,O){return T.includes(O)||O==="number"&&T.includes("integer")}function j(T,O){return T.includes(O)||O==="integer"&&T.includes("number")}function R(T,O){const V=[];for(const H of T.dataTypes)j(O,H)?V.push(H):O.includes("integer")&&H==="number"&&V.push("integer");T.dataTypes=V}function P(T,O){const V=T.schemaEnv.baseId+T.errSchemaPath;O+=` at "${V}" (strictTypes)`,(0,u.checkStrictMode)(T,O,T.opts.strictTypes)}class I{constructor(O,V,H){if((0,s.validateKeywordUsage)(O,V,H),this.gen=O.gen,this.allErrors=O.allErrors,this.keyword=H,this.data=O.data,this.schema=O.schema[H],this.$data=V.$data&&O.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,u.schemaRefOrVal)(O,this.schema,H,this.$data),this.schemaType=V.schemaType,this.parentSchema=O.schema,this.params={},this.it=O,this.def=V,this.$data)this.schemaCode=O.gen.const("vSchema",q(this.$data,O));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,V.schemaType,V.allowUndefined))throw new Error(`${H} value must be ${JSON.stringify(V.schemaType)}`);("code"in V?V.trackErrors:V.errors!==!1)&&(this.errsCount=O.gen.const("_errs",l.default.errors))}result(O,V,H){this.failResult((0,a.not)(O),V,H)}failResult(O,V,H){this.gen.if(O),H?H():this.error(),V?(this.gen.else(),V(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(O,V){this.failResult((0,a.not)(O),void 0,V)}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:V}=this;this.fail((0,a._)`${V} !== undefined && (${(0,a.or)(this.invalid$data(),O)})`)}error(O,V,H){if(V){this.setParams(V),this._error(O,H),this.setParams({});return}this._error(O,H)}_error(O,V){(O?d.reportExtraError:d.reportError)(this,this.def.error,V)}$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,V){V?Object.assign(this.params,O):this.params=O}block$data(O,V,H=a.nil){this.gen.block(()=>{this.check$data(O,H),V()})}check$data(O=a.nil,V=a.nil){if(!this.$data)return;const{gen:H,schemaCode:Q,schemaType:ee,def:re}=this;H.if((0,a.or)((0,a._)`${Q} === undefined`,V)),O!==a.nil&&H.assign(O,!0),(ee.length||re.validateSchema)&&(H.elseIf(this.invalid$data()),this.$dataError(),O!==a.nil&&H.assign(O,!1)),H.else()}invalid$data(){const{gen:O,schemaCode:V,schemaType:H,def:Q,it:ee}=this;return(0,a.or)(re(),oe());function re(){if(H.length){if(!(V instanceof a.Name))throw new Error("ajv implementation error");const ne=Array.isArray(H)?H:[H];return(0,a._)`${(0,r.checkDataTypes)(ne,V,ee.opts.strictNumbers,r.DataType.Wrong)}`}return a.nil}function oe(){if(Q.validateSchema){const ne=O.scopeValue("validate$data",{ref:Q.validateSchema});return(0,a._)`!${ne}(${V})`}return a.nil}}subschema(O,V){const H=(0,i.getSubschema)(this.it,O);(0,i.extendSubschemaData)(H,this.it,O),(0,i.extendSubschemaMode)(H,O);const Q={...this.it,...H,items:void 0,props:void 0};return w(Q,V),Q}mergeEvaluated(O,V){const{it:H,gen:Q}=this;H.opts.unevaluated&&(H.props!==!0&&O.props!==void 0&&(H.props=u.mergeEvaluated.props(Q,O.props,H.props,V)),H.items!==!0&&O.items!==void 0&&(H.items=u.mergeEvaluated.items(Q,O.items,H.items,V)))}mergeValidEvaluated(O,V){const{it:H,gen:Q}=this;if(H.opts.unevaluated&&(H.props!==!0||H.items!==!0))return Q.if(V,()=>this.mergeEvaluated(O,a.Name)),!0}}Mr.KeywordCxt=I;function Z(T,O,V,H){const Q=new I(T,V,O);"code"in V?V.code(Q,H):Q.$data&&V.validate?(0,s.funcKeywordCode)(Q,V):"macro"in V?(0,s.macroKeywordCode)(Q,V):(V.compile||V.validate)&&(0,s.funcKeywordCode)(Q,V)}const X=/^\/(?:[^~]|~0|~1)*$/,_=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function q(T,{dataLevel:O,dataNames:V,dataPathArr:H}){let Q,ee;if(T==="")return l.default.rootData;if(T[0]==="/"){if(!X.test(T))throw new Error(`Invalid JSON-pointer: ${T}`);Q=T,ee=l.default.rootData}else{const le=_.exec(T);if(!le)throw new Error(`Invalid JSON-pointer: ${T}`);const te=+le[1];if(Q=le[2],Q==="#"){if(te>=O)throw new Error(ne("property/index",te));return H[O-te]}if(te>O)throw new Error(ne("data",te));if(ee=V[O-te],!Q)return ee}let re=ee;const oe=Q.split("/");for(const le of oe)le&&(ee=(0,a._)`${ee}${(0,a.getProperty)((0,u.unescapeJsonPointer)(le))}`,re=(0,a._)`${re} && ${ee}`);return re;function ne(le,te){return`Cannot access ${le} ${te} levels up, current level is ${O}`}}return Mr.getData=q,Mr}var Cc={},gk;function Kf(){if(gk)return Cc;gk=1,Object.defineProperty(Cc,"__esModule",{value:!0});class t extends Error{constructor(n){super("validation failed"),this.errors=n,this.ajv=this.validation=!0}}return Cc.default=t,Cc}var Tc={},yk;function Al(){if(yk)return Tc;yk=1,Object.defineProperty(Tc,"__esModule",{value:!0});const t=Uf();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 Tc.default=e,Tc}var kn={},bk;function Yf(){if(bk)return kn;bk=1,Object.defineProperty(kn,"__esModule",{value:!0}),kn.resolveSchema=kn.getCompilingSchema=kn.resolveRef=kn.compileSchema=kn.SchemaEnv=void 0;const t=je(),e=Kf(),n=tr(),r=Uf(),o=Ge(),s=$l();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={}}}kn.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,S=new t.CodeGen(this.scope,{es5:w,lines:k,ownProperties:v});let E;g.$async&&(E=S.scopeValue("Error",{ref:e.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));const M=S.scopeName("validate");g.validateName=M;const D={gen:S,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:S.scopeValue("schema",this.opts.code.source===!0?{ref:g.schema,code:(0,t.stringify)(g.schema)}:{ref:g.schema}),validateName:M,ValidationError:E,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 F;try{this._compilations.add(g),(0,s.validateFunctionCode)(D),S.optimize(this.opts.code.optimize);const N=S.toString();F=`${S.scopeRefs(n.default.scope)}return ${N}`,this.opts.code.process&&(F=this.opts.code.process(F,g));const z=new Function(`${n.default.self}`,`${n.default.scope}`,F)(this,this.scope.get());if(this.scope.value(M,{ref:z}),z.errors=null,z.schema=g.schema,z.schemaEnv=g,g.$async&&(z.$async=!0),this.opts.code.source===!0&&(z.source={validateName:M,validateCode:N,scopeValues:S._values}),this.opts.unevaluated){const{props:B,items:U}=D;z.evaluated={props:B instanceof t.Name?void 0:B,items:U instanceof t.Name?void 0:U,dynamicProps:B instanceof t.Name,dynamicItems:U instanceof t.Name},z.source&&(z.source.evaluated=(0,t.stringify)(z.evaluated))}return g.validate=z,g}catch(N){throw delete g.validate,delete g.validateName,F&&this.logger.error("Error compiling schema, function code:",F),N}finally{this._compilations.delete(g)}}kn.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 S=(w=g.localRefs)===null||w===void 0?void 0:w[b],{schemaId:E}=this.opts;S&&(v=new i({schema:S,schemaId:E,root:g,baseId:y}))}if(v!==void 0)return g.refs[b]=c.call(this,v)}kn.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}kn.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),S=this.refs[v]||this.schemas[v];if(typeof S=="string"){const E=h.call(this,g,S);return typeof E?.schema!="object"?void 0:m.call(this,b,E)}if(typeof S?.schema=="object"){if(S.validate||a.call(this,S),v===(0,r.normalizeId)(y)){const{schema:E}=S,{schemaId:M}=this.opts,D=E[M];return D&&(k=(0,r.resolveUrl)(this.opts.uriResolver,k,D)),new i({schema:E,schemaId:M,root:g,baseId:k})}return m.call(this,b,S)}}kn.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 E of g.fragment.slice(1).split("/")){if(typeof b=="boolean")return;const M=b[(0,o.unescapeFragment)(E)];if(M===void 0)return;b=M;const D=typeof b=="object"&&b[this.opts.schemaId];!p.has(E)&&D&&(y=(0,r.resolveUrl)(this.opts.uriResolver,y,D))}let v;if(typeof b!="boolean"&&b.$ref&&!(0,o.schemaHasRulesButRef)(b,this.RULES)){const E=(0,r.resolveUrl)(this.opts.uriResolver,y,b.$ref);v=h.call(this,w,E)}const{schemaId:S}=this.opts;if(v=v||new i({schema:b,schemaId:S,root:w,baseId:y}),v.schema!==v.root.schema)return v}return kn}const RG="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",MG="Meta-schema for $data reference (JSON AnySchema extension proposal)",OG="object",_G=["$data"],NG={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},PG=!1,$G={$id:RG,description:MG,type:OG,required:_G,properties:NG,additionalProperties:PG};var Rc={},ya={exports:{}},fp,vk;function tO(){if(vk)return fp;vk=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 fp={nonSimpleDomain:r,recomposeAuthority:d,normalizeComponentEncoding:u,removeDotSegments:c,isIPv4:e,isUUID:t,normalizeIPv6:a,stringArrayToHexStripped:n},fp}var hp,wk;function AG(){if(wk)return hp;wk=1;const{isUUID:t}=tO(),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 S=String(v.scheme).toLowerCase()==="https";return(v.port===(S?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[S,E]=v.resourceName.split("?");v.path=S&&S!=="/"?S:void 0,v.query=E,v.resourceName=void 0}return v.fragment=void 0,v}function c(v,S){if(!v.path)return v.error="URN can not be parsed",v;const E=v.path.match(e);if(E){const M=S.scheme||v.scheme||"urn";v.nid=E[1].toLowerCase(),v.nss=E[2];const D=`${M}:${S.nid||v.nid}`,F=k(D);v.path=void 0,F&&(v=F.parse(v,S))}else v.error=v.error||"URN can not be parsed.";return v}function u(v,S){if(v.nid===void 0)throw new Error("URN without nid cannot be serialized");const E=S.scheme||v.scheme||"urn",M=v.nid.toLowerCase(),D=`${E}:${S.nid||M}`,F=k(D);F&&(v=F.serialize(v,S));const N=v,A=v.nss;return N.path=`${M||S.nid}:${A}`,S.skipEscape=!0,N}function d(v,S){const E=v;return E.uuid=E.nss,E.nss=void 0,!S.tolerant&&(!E.uuid||!t(E.uuid))&&(E.error=E.error||"UUID is not valid."),E}function f(v){const S=v;return S.nss=(v.uuid||"").toLowerCase(),S}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 hp={wsIsSecure:o,SCHEMES:w,isValidSchemeName:r,getSchemeHandler:k},hp}var kk;function IG(){if(kk)return ya.exports;kk=1;const{normalizeIPv6:t,removeDotSegments:e,recomposeAuthority:n,normalizeComponentEncoding:r,isIPv4:o,nonSimpleDomain:s}=tO(),{SCHEMES:i,getSchemeHandler:a}=AG();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 S=n(b);if(S!==void 0&&(w.reference!=="suffix"&&k.push("//"),k.push(S),b.path&&b.path[0]!=="/"&&k.push("/")),b.path!==void 0){let E=b.path;!w.absolutePath&&(!v||!v.absolutePath)&&(E=e(E)),S===void 0&&E[0]==="/"&&E[1]==="/"&&(E="/%2F"+E.slice(2)),k.push(E)}return b.query!==void 0&&k.push("?",b.query),b.fragment!==void 0&&k.push("#",b.fragment),k.join("")}const h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function p(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 M=t(w.host);w.host=M.host.toLowerCase(),k=M.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 S=a(b.scheme||w.scheme);if(!b.unicodeSupport&&(!S||!S.unicodeSupport)&&w.host&&(b.domainHost||S&&S.domainHost)&&k===!1&&s(w.host))try{w.host=URL.domainToASCII(w.host.toLowerCase())}catch(E){w.error=w.error||"Host's domain name can not be converted to ASCII: "+E}(!S||S&&!S.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)))),S&&S.parse&&S.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 ya.exports=m,ya.exports.default=m,ya.exports.fastUri=m,ya.exports}var xk;function DG(){if(xk)return Rc;xk=1,Object.defineProperty(Rc,"__esModule",{value:!0});const t=IG();return t.code='require("ajv/dist/runtime/uri").default',Rc.default=t,Rc}var Sk;function nO(){return Sk||(Sk=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=$l();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var n=je();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=Kf(),o=Al(),s=XM(),i=Yf(),a=je(),l=Uf(),c=Jd(),u=Ge(),d=$G,f=DG(),h=(L,W)=>new RegExp(L,W);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(L){var W,$,j,R,P,I,Z,X,_,q,T,O,V,H,Q,ee,re,oe,ne,le,te,fe,ge,pe,Le;const qe=L.strict,Je=(W=L.code)===null||W===void 0?void 0:W.optimize,Me=Je===!0||Je===void 0?1:Je||0,Oe=(j=($=L.code)===null||$===void 0?void 0:$.regExp)!==null&&j!==void 0?j:h,ze=(R=L.uriResolver)!==null&&R!==void 0?R:f.default;return{strictSchema:(I=(P=L.strictSchema)!==null&&P!==void 0?P:qe)!==null&&I!==void 0?I:!0,strictNumbers:(X=(Z=L.strictNumbers)!==null&&Z!==void 0?Z:qe)!==null&&X!==void 0?X:!0,strictTypes:(q=(_=L.strictTypes)!==null&&_!==void 0?_:qe)!==null&&q!==void 0?q:"log",strictTuples:(O=(T=L.strictTuples)!==null&&T!==void 0?T:qe)!==null&&O!==void 0?O:"log",strictRequired:(H=(V=L.strictRequired)!==null&&V!==void 0?V:qe)!==null&&H!==void 0?H:!1,code:L.code?{...L.code,optimize:Me,regExp:Oe}:{optimize:Me,regExp:Oe},loopRequired:(Q=L.loopRequired)!==null&&Q!==void 0?Q:b,loopEnum:(ee=L.loopEnum)!==null&&ee!==void 0?ee:b,meta:(re=L.meta)!==null&&re!==void 0?re:!0,messages:(oe=L.messages)!==null&&oe!==void 0?oe:!0,inlineRefs:(ne=L.inlineRefs)!==null&&ne!==void 0?ne:!0,schemaId:(le=L.schemaId)!==null&&le!==void 0?le:"$id",addUsedSchema:(te=L.addUsedSchema)!==null&&te!==void 0?te:!0,validateSchema:(fe=L.validateSchema)!==null&&fe!==void 0?fe:!0,validateFormats:(ge=L.validateFormats)!==null&&ge!==void 0?ge:!0,unicodeRegExp:(pe=L.unicodeRegExp)!==null&&pe!==void 0?pe:!0,int32range:(Le=L.int32range)!==null&&Le!==void 0?Le:!0,uriResolver:ze}}class k{constructor(W={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,W=this.opts={...W,...w(W)};const{es5:$,lines:j}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:m,es5:$,lines:j}),this.logger=A(W.logger);const R=W.validateFormats;W.validateFormats=!1,this.RULES=(0,s.getRules)(),v.call(this,g,W,"NOT SUPPORTED"),v.call(this,y,W,"DEPRECATED","warn"),this._metaOpts=F.call(this),W.formats&&M.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),W.keywords&&D.call(this,W.keywords),typeof W.meta=="object"&&this.addMetaSchema(W.meta),E.call(this),W.validateFormats=R}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:W,meta:$,schemaId:j}=this.opts;let R=d;j==="id"&&(R={...d},R.id=R.$id,delete R.$id),$&&W&&this.addMetaSchema(R,R[j],!1)}defaultMeta(){const{meta:W,schemaId:$}=this.opts;return this.opts.defaultMeta=typeof W=="object"?W[$]||W:void 0}validate(W,$){let j;if(typeof W=="string"){if(j=this.getSchema(W),!j)throw new Error(`no schema with key or ref "${W}"`)}else j=this.compile(W);const R=j($);return"$async"in j||(this.errors=j.errors),R}compile(W,$){const j=this._addSchema(W,$);return j.validate||this._compileSchemaEnv(j)}compileAsync(W,$){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:j}=this.opts;return R.call(this,W,$);async function R(q,T){await P.call(this,q.$schema);const O=this._addSchema(q,T);return O.validate||I.call(this,O)}async function P(q){q&&!this.getSchema(q)&&await R.call(this,{$ref:q},!0)}async function I(q){try{return this._compileSchemaEnv(q)}catch(T){if(!(T instanceof o.default))throw T;return Z.call(this,T),await X.call(this,T.missingSchema),I.call(this,q)}}function Z({missingSchema:q,missingRef:T}){if(this.refs[q])throw new Error(`AnySchema ${q} is loaded but ${T} cannot be resolved`)}async function X(q){const T=await _.call(this,q);this.refs[q]||await P.call(this,T.$schema),this.refs[q]||this.addSchema(T,q,$)}async function _(q){const T=this._loading[q];if(T)return T;try{return await(this._loading[q]=j(q))}finally{delete this._loading[q]}}}addSchema(W,$,j,R=this.opts.validateSchema){if(Array.isArray(W)){for(const I of W)this.addSchema(I,void 0,j,R);return this}let P;if(typeof W=="object"){const{schemaId:I}=this.opts;if(P=W[I],P!==void 0&&typeof P!="string")throw new Error(`schema ${I} must be string`)}return $=(0,l.normalizeId)($||P),this._checkUnique($),this.schemas[$]=this._addSchema(W,j,$,R,!0),this}addMetaSchema(W,$,j=this.opts.validateSchema){return this.addSchema(W,$,!0,j),this}validateSchema(W,$){if(typeof W=="boolean")return!0;let j;if(j=W.$schema,j!==void 0&&typeof j!="string")throw new Error("$schema must be a string");if(j=j||this.opts.defaultMeta||this.defaultMeta(),!j)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const R=this.validate(j,W);if(!R&&$){const P="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(P);else throw new Error(P)}return R}getSchema(W){let $;for(;typeof($=S.call(this,W))=="string";)W=$;if($===void 0){const{schemaId:j}=this.opts,R=new i.SchemaEnv({schema:{},schemaId:j});if($=i.resolveSchema.call(this,R,W),!$)return;this.refs[W]=$}return $.validate||this._compileSchemaEnv($)}removeSchema(W){if(W instanceof RegExp)return this._removeAllSchemas(this.schemas,W),this._removeAllSchemas(this.refs,W),this;switch(typeof W){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const $=S.call(this,W);return typeof $=="object"&&this._cache.delete($.schema),delete this.schemas[W],delete this.refs[W],this}case"object":{const $=W;this._cache.delete($);let j=W[this.opts.schemaId];return j&&(j=(0,l.normalizeId)(j),delete this.schemas[j],delete this.refs[j]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(W){for(const $ of W)this.addKeyword($);return this}addKeyword(W,$){let j;if(typeof W=="string")j=W,typeof $=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),$.keyword=j);else if(typeof W=="object"&&$===void 0){if($=W,j=$.keyword,Array.isArray(j)&&!j.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(B.call(this,j,$),!$)return(0,u.eachItem)(j,P=>U.call(this,P)),this;Y.call(this,$);const R={...$,type:(0,c.getJSONTypes)($.type),schemaType:(0,c.getJSONTypes)($.schemaType)};return(0,u.eachItem)(j,R.type.length===0?P=>U.call(this,P,R):P=>R.type.forEach(I=>U.call(this,P,R,I))),this}getKeyword(W){const $=this.RULES.all[W];return typeof $=="object"?$.definition:!!$}removeKeyword(W){const{RULES:$}=this;delete $.keywords[W],delete $.all[W];for(const j of $.rules){const R=j.rules.findIndex(P=>P.keyword===W);R>=0&&j.rules.splice(R,1)}return this}addFormat(W,$){return typeof $=="string"&&($=new RegExp($)),this.formats[W]=$,this}errorsText(W=this.errors,{separator:$=", ",dataVar:j="data"}={}){return!W||W.length===0?"No errors":W.map(R=>`${j}${R.instancePath} ${R.message}`).reduce((R,P)=>R+$+P)}$dataMetaSchema(W,$){const j=this.RULES.all;W=JSON.parse(JSON.stringify(W));for(const R of $){const P=R.split("/").slice(1);let I=W;for(const Z of P)I=I[Z];for(const Z in j){const X=j[Z];if(typeof X!="object")continue;const{$data:_}=X.definition,q=I[Z];_&&q&&(I[Z]=G(q))}}return W}_removeAllSchemas(W,$){for(const j in W){const R=W[j];(!$||$.test(j))&&(typeof R=="string"?delete W[j]:R&&!R.meta&&(this._cache.delete(R.schema),delete W[j]))}}_addSchema(W,$,j,R=this.opts.validateSchema,P=this.opts.addUsedSchema){let I;const{schemaId:Z}=this.opts;if(typeof W=="object")I=W[Z];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof W!="boolean")throw new Error("schema must be object or boolean")}let X=this._cache.get(W);if(X!==void 0)return X;j=(0,l.normalizeId)(I||j);const _=l.getSchemaRefs.call(this,W,j);return X=new i.SchemaEnv({schema:W,schemaId:Z,meta:$,baseId:j,localRefs:_}),this._cache.set(X.schema,X),P&&!j.startsWith("#")&&(j&&this._checkUnique(j),this.refs[j]=X),R&&this.validateSchema(W,!0),X}_checkUnique(W){if(this.schemas[W]||this.refs[W])throw new Error(`schema with key or id "${W}" already exists`)}_compileSchemaEnv(W){if(W.meta?this._compileMetaSchema(W):i.compileSchema.call(this,W),!W.validate)throw new Error("ajv implementation error");return W.validate}_compileMetaSchema(W){const $=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,W)}finally{this.opts=$}}}k.ValidationError=r.default,k.MissingRefError=o.default,t.default=k;function v(L,W,$,j="error"){for(const R in L){const P=R;P in W&&this.logger[j](`${$}: option ${R}. ${L[P]}`)}}function S(L){return L=(0,l.normalizeId)(L),this.schemas[L]||this.refs[L]}function E(){const L=this.opts.schemas;if(L)if(Array.isArray(L))this.addSchema(L);else for(const W in L)this.addSchema(L[W],W)}function M(){for(const L in this.opts.formats){const W=this.opts.formats[L];W&&this.addFormat(L,W)}}function D(L){if(Array.isArray(L)){this.addVocabulary(L);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const W in L){const $=L[W];$.keyword||($.keyword=W),this.addKeyword($)}}function F(){const L={...this.opts};for(const W of p)delete L[W];return L}const N={log(){},warn(){},error(){}};function A(L){if(L===!1)return N;if(L===void 0)return console;if(L.log&&L.warn&&L.error)return L;throw new Error("logger must implement log, warn and error methods")}const z=/^[a-z_$][a-z0-9_$:-]*$/i;function B(L,W){const{RULES:$}=this;if((0,u.eachItem)(L,j=>{if($.keywords[j])throw new Error(`Keyword ${j} is already defined`);if(!z.test(j))throw new Error(`Keyword ${j} has invalid name`)}),!!W&&W.$data&&!("code"in W||"validate"in W))throw new Error('$data keyword must have "code" or "validate" function')}function U(L,W,$){var j;const R=W?.post;if($&&R)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:P}=this;let I=R?P.post:P.rules.find(({type:X})=>X===$);if(I||(I={type:$,rules:[]},P.rules.push(I)),P.keywords[L]=!0,!W)return;const Z={keyword:L,definition:{...W,type:(0,c.getJSONTypes)(W.type),schemaType:(0,c.getJSONTypes)(W.schemaType)}};W.before?J.call(this,I,Z,W.before):I.rules.push(Z),P.all[L]=Z,(j=W.implements)===null||j===void 0||j.forEach(X=>this.addKeyword(X))}function J(L,W,$){const j=L.rules.findIndex(R=>R.keyword===$);j>=0?L.rules.splice(j,0,W):(L.rules.push(W),this.logger.warn(`rule ${$} is not defined`))}function Y(L){let{metaSchema:W}=L;W!==void 0&&(L.$data&&this.opts.$data&&(W=G(W)),L.validateSchema=this.compile(W,!0))}const K={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function G(L){return{anyOf:[L,K]}}})(sp)),sp}var Mc={},Oc={},_c={},Ek;function zG(){if(Ek)return _c;Ek=1,Object.defineProperty(_c,"__esModule",{value:!0});const t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return _c.default=t,_c}var eo={},Ck;function Uy(){if(Ck)return eo;Ck=1,Object.defineProperty(eo,"__esModule",{value:!0}),eo.callRef=eo.getValidate=void 0;const t=Al(),e=nr(),n=je(),r=tr(),o=Yf(),s=Ge(),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 S(w);function k(){if(p===b)return l(c,m,p,p.$async);const E=u.scopeValue("root",{ref:b});return l(c,(0,n._)`${E}.validate`,b,b.$async)}function v(E){const M=a(c,E);l(c,M,E,E.$async)}function S(E){const M=u.scopeValue("schema",g.code.source===!0?{ref:E,code:(0,n.stringify)(E)}:{ref:E}),D=u.name("valid"),F=c.subschema({schema:E,dataTypes:[],schemaPath:n.nil,topSchemaRef:M,errSchemaPath:d},D);c.mergeEvaluated(F),c.ok(D)}}};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`}eo.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 E=h.let("valid");h.try(()=>{h.code((0,n._)`await ${(0,e.callValidateCode)(c,u,b)}`),S(u),m||h.assign(E,!0)},M=>{h.if((0,n._)`!(${M} instanceof ${p.ValidationError})`,()=>h.throw(M)),v(M),m||h.assign(E,!1)}),c.ok(E)}function k(){c.result((0,e.callValidateCode)(c,u,b),()=>S(u),()=>v(u))}function v(E){const M=(0,n._)`${E}.errors`;h.assign(r.default.vErrors,(0,n._)`${r.default.vErrors} === null ? ${M} : ${r.default.vErrors}.concat(${M})`),h.assign(r.default.errors,(0,n._)`${r.default.vErrors}.length`)}function S(E){var M;if(!p.opts.unevaluated)return;const D=(M=d?.validate)===null||M===void 0?void 0:M.evaluated;if(p.props!==!0)if(D&&!D.dynamicProps)D.props!==void 0&&(p.props=s.mergeEvaluated.props(h,D.props,p.props));else{const F=h.var("props",(0,n._)`${E}.evaluated.props`);p.props=s.mergeEvaluated.props(h,F,p.props,n.Name)}if(p.items!==!0)if(D&&!D.dynamicItems)D.items!==void 0&&(p.items=s.mergeEvaluated.items(h,D.items,p.items));else{const F=h.var("items",(0,n._)`${E}.evaluated.items`);p.items=s.mergeEvaluated.items(h,F,p.items,n.Name)}}}return eo.callRef=l,eo.default=i,eo}var Tk;function rO(){if(Tk)return Oc;Tk=1,Object.defineProperty(Oc,"__esModule",{value:!0});const t=zG(),e=Uy(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,e.default];return Oc.default=n,Oc}var Nc={},Pc={},Rk;function jG(){if(Rk)return Pc;Rk=1,Object.defineProperty(Pc,"__esModule",{value:!0});const t=je(),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 Pc.default=o,Pc}var $c={},Mk;function LG(){if(Mk)return $c;Mk=1,Object.defineProperty($c,"__esModule",{value:!0});const t=je(),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 $c.default=n,$c}var Ac={},Ic={},Ok;function FG(){if(Ok)return Ic;Ok=1,Object.defineProperty(Ic,"__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 Ic.default=t,t.code='require("ajv/dist/runtime/ucs2length").default',Ic}var _k;function BG(){if(_k)return Ac;_k=1,Object.defineProperty(Ac,"__esModule",{value:!0});const t=je(),e=Ge(),n=FG(),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 Ac.default=o,Ac}var Dc={},Nk;function VG(){if(Nk)return Dc;Nk=1,Object.defineProperty(Dc,"__esModule",{value:!0});const t=nr(),e=Ge(),n=je(),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 Dc.default=o,Dc}var zc={},Pk;function WG(){if(Pk)return zc;Pk=1,Object.defineProperty(zc,"__esModule",{value:!0});const t=je(),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 zc.default=n,zc}var jc={},$k;function HG(){if($k)return jc;$k=1,Object.defineProperty(jc,"__esModule",{value:!0});const t=nr(),e=je(),n=Ge(),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,S=`required property "${k}" is not defined at "${v}" (strictRequired)`;(0,n.checkStrictMode)(d,S,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 jc.default=o,jc}var Lc={},Ak;function qG(){if(Ak)return Lc;Ak=1,Object.defineProperty(Lc,"__esModule",{value:!0});const t=je(),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 Lc.default=n,Lc}var Fc={},Bc={},Ik;function Ky(){if(Ik)return Bc;Ik=1,Object.defineProperty(Bc,"__esModule",{value:!0});const t=eO();return t.code='require("ajv/dist/runtime/equal").default',Bc.default=t,Bc}var Dk;function UG(){if(Dk)return Fc;Dk=1,Object.defineProperty(Fc,"__esModule",{value:!0});const t=Jd(),e=je(),n=Ge(),r=Ky(),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 S=a.name("item"),E=(0,t.checkDataTypes)(m,S,h.opts.strictNumbers,t.DataType.Wrong),M=a.const("indices",(0,e._)`{}`);a.for((0,e._)`;${k}--;`,()=>{a.let(S,(0,e._)`${l}[${k}]`),a.if(E,(0,e._)`continue`),m.length>1&&a.if((0,e._)`typeof ${S} == "string"`,(0,e._)`${S} += "_"`),a.if((0,e._)`typeof ${M}[${S}] == "number"`,()=>{a.assign(v,(0,e._)`${M}[${S}]`),i.error(),a.assign(p,!1).break()}).code((0,e._)`${M}[${S}] = ${k}`)})}function w(k,v){const S=(0,n.useFunc)(a,r.default),E=a.name("outer");a.label(E).for((0,e._)`;${k}--;`,()=>a.for((0,e._)`${v} = ${k}; ${v}--;`,()=>a.if((0,e._)`${S}(${l}[${k}], ${l}[${v}])`,()=>{i.error(),a.assign(p,!1).break(E)})))}}};return Fc.default=s,Fc}var Vc={},zk;function KG(){if(zk)return Vc;zk=1,Object.defineProperty(Vc,"__esModule",{value:!0});const t=je(),e=Ge(),n=Ky(),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 Vc.default=o,Vc}var Wc={},jk;function YG(){if(jk)return Wc;jk=1,Object.defineProperty(Wc,"__esModule",{value:!0});const t=je(),e=Ge(),n=Ky(),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 Wc.default=o,Wc}var Lk;function oO(){if(Lk)return Nc;Lk=1,Object.defineProperty(Nc,"__esModule",{value:!0});const t=jG(),e=LG(),n=BG(),r=VG(),o=WG(),s=HG(),i=qG(),a=UG(),l=KG(),c=YG(),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 Nc.default=u,Nc}var Hc={},ti={},Fk;function sO(){if(Fk)return ti;Fk=1,Object.defineProperty(ti,"__esModule",{value:!0}),ti.validateAdditionalItems=void 0;const t=je(),e=Ge(),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 ti.validateAdditionalItems=o,ti.default=r,ti}var qc={},ni={},Bk;function iO(){if(Bk)return ni;Bk=1,Object.defineProperty(ni,"__esModule",{value:!0}),ni.validateTuple=void 0;const t=je(),e=Ge(),n=nr(),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 ni.validateTuple=o,ni.default=r,ni}var Vk;function GG(){if(Vk)return qc;Vk=1,Object.defineProperty(qc,"__esModule",{value:!0});const t=iO(),e={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:n=>(0,t.validateTuple)(n,"items")};return qc.default=e,qc}var Uc={},Wk;function ZG(){if(Wk)return Uc;Wk=1,Object.defineProperty(Uc,"__esModule",{value:!0});const t=je(),e=Ge(),n=nr(),r=sO(),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 Kc={},Hk;function JG(){if(Hk)return Kc;Hk=1,Object.defineProperty(Kc,"__esModule",{value:!0});const t=je(),e=Ge(),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 Kc.default=r,Kc}var pp={},qk;function Yy(){return qk||(qk=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=je(),n=Ge(),r=nr();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},
376
+ missingProperty: ${d},
377
+ depsCount: ${c},
378
+ 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})(pp)),pp}var Yc={},Uk;function XG(){if(Uk)return Yc;Uk=1,Object.defineProperty(Yc,"__esModule",{value:!0});const t=je(),e=Ge(),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 Yc.default=r,Yc}var Gc={},Kk;function aO(){if(Kk)return Gc;Kk=1,Object.defineProperty(Gc,"__esModule",{value:!0});const t=nr(),e=je(),n=tr(),r=Ge(),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,S=>{!m.length&&!g.length?k(S):a.if(b(S),()=>k(S))})}function b(S){let E;if(m.length>8){const M=(0,r.schemaRefOrVal)(f,c.properties,"properties");E=(0,t.isOwnProperty)(a,M,S)}else m.length?E=(0,e.or)(...m.map(M=>(0,e._)`${S} === ${M}`)):E=e.nil;return g.length&&(E=(0,e.or)(E,...g.map(M=>(0,e._)`${(0,t.usePattern)(i,M)}.test(${S})`))),(0,e.not)(E)}function w(S){a.code((0,e._)`delete ${u}[${S}]`)}function k(S){if(p.removeAdditional==="all"||p.removeAdditional&&l===!1){w(S);return}if(l===!1){i.setParams({additionalProperty:S}),i.error(),h||a.break();return}if(typeof l=="object"&&!(0,r.alwaysValidSchema)(f,l)){const E=a.name("valid");p.removeAdditional==="failing"?(v(S,E,!1),a.if((0,e.not)(E),()=>{i.reset(),w(S)})):(v(S,E),h||a.if((0,e.not)(E),()=>a.break()))}}function v(S,E,M){const D={keyword:"additionalProperties",dataProp:S,dataPropType:r.Type.Str};M===!1&&Object.assign(D,{compositeRule:!0,createErrors:!1,allErrors:!1}),i.subschema(D,E)}}};return Gc.default=s,Gc}var Zc={},Yk;function QG(){if(Yk)return Zc;Yk=1,Object.defineProperty(Zc,"__esModule",{value:!0});const t=$l(),e=nr(),n=Ge(),r=aO(),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 Zc.default=o,Zc}var Jc={},Gk;function eZ(){if(Gk)return Jc;Gk=1,Object.defineProperty(Jc,"__esModule",{value:!0});const t=nr(),e=je(),n=Ge(),r=Ge(),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 S=h.includes(k);S||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):!S&&!u.allErrors&&i.if((0,e.not)(m),()=>i.break())})})}}};return Jc.default=o,Jc}var Xc={},Zk;function tZ(){if(Zk)return Xc;Zk=1,Object.defineProperty(Xc,"__esModule",{value:!0});const t=Ge(),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 Xc.default=e,Xc}var Qc={},Jk;function nZ(){if(Jk)return Qc;Jk=1,Object.defineProperty(Qc,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:nr().validateUnion,error:{message:"must match a schema in anyOf"}};return Qc.default=e,Qc}var eu={},Xk;function rZ(){if(Xk)return eu;Xk=1,Object.defineProperty(eu,"__esModule",{value:!0});const t=je(),e=Ge(),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 eu.default=r,eu}var tu={},Qk;function oZ(){if(Qk)return tu;Qk=1,Object.defineProperty(tu,"__esModule",{value:!0});const t=Ge(),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 tu.default=e,tu}var nu={},ex;function sZ(){if(ex)return nu;ex=1,Object.defineProperty(nu,"__esModule",{value:!0});const t=je(),e=Ge(),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 nu.default=r,nu}var ru={},tx;function iZ(){if(tx)return ru;tx=1,Object.defineProperty(ru,"__esModule",{value:!0});const t=Ge(),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 ru.default=e,ru}var nx;function lO(){if(nx)return Hc;nx=1,Object.defineProperty(Hc,"__esModule",{value:!0});const t=sO(),e=GG(),n=iO(),r=ZG(),o=JG(),s=Yy(),i=XG(),a=aO(),l=QG(),c=eZ(),u=tZ(),d=nZ(),f=rZ(),h=oZ(),p=sZ(),m=iZ();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 Hc.default=g,Hc}var ou={},ri={},rx;function cO(){if(rx)return ri;rx=1,Object.defineProperty(ri,"__esModule",{value:!0}),ri.dynamicAnchor=void 0;const t=je(),e=tr(),n=Yf(),r=Uy(),o={keyword:"$dynamicAnchor",schemaType:"string",code:a=>s(a,a.schema)};function s(a,l){const{gen:c,it:u}=a;u.schemaEnv.root.dynamicAnchors[l]=!0;const d=(0,t._)`${e.default.dynamicAnchors}${(0,t.getProperty)(l)}`,f=u.errSchemaPath==="#"?u.validateName:i(a);c.if((0,t._)`!${d}`,()=>c.assign(d,f))}ri.dynamicAnchor=s;function i(a){const{schemaEnv:l,schema:c,self:u}=a.it,{root:d,baseId:f,localRefs:h,meta:p}=l.root,{schemaId:m}=u.opts,g=new n.SchemaEnv({schema:c,schemaId:m,root:d,baseId:f,localRefs:h,meta:p});return n.compileSchema.call(u,g),(0,r.getValidate)(a,g)}return ri.default=o,ri}var oi={},ox;function uO(){if(ox)return oi;ox=1,Object.defineProperty(oi,"__esModule",{value:!0}),oi.dynamicRef=void 0;const t=je(),e=tr(),n=Uy(),r={keyword:"$dynamicRef",schemaType:"string",code:s=>o(s,s.schema)};function o(s,i){const{gen:a,keyword:l,it:c}=s;if(i[0]!=="#")throw new Error(`"${l}" only supports hash fragment reference`);const u=i.slice(1);if(c.allErrors)d();else{const h=a.let("valid",!1);d(h),s.ok(h)}function d(h){if(c.schemaEnv.root.dynamicAnchors[u]){const p=a.let("_v",(0,t._)`${e.default.dynamicAnchors}${(0,t.getProperty)(u)}`);a.if(p,f(p,h),f(c.validateName,h))}else f(c.validateName,h)()}function f(h,p){return p?()=>a.block(()=>{(0,n.callRef)(s,h),a.let(p,!0)}):()=>(0,n.callRef)(s,h)}}return oi.dynamicRef=o,oi.default=r,oi}var su={},sx;function aZ(){if(sx)return su;sx=1,Object.defineProperty(su,"__esModule",{value:!0});const t=cO(),e=Ge(),n={keyword:"$recursiveAnchor",schemaType:"boolean",code(r){r.schema?(0,t.dynamicAnchor)(r,""):(0,e.checkStrictMode)(r.it,"$recursiveAnchor: false is ignored")}};return su.default=n,su}var iu={},ix;function lZ(){if(ix)return iu;ix=1,Object.defineProperty(iu,"__esModule",{value:!0});const t=uO(),e={keyword:"$recursiveRef",schemaType:"string",code:n=>(0,t.dynamicRef)(n,n.schema)};return iu.default=e,iu}var ax;function cZ(){if(ax)return ou;ax=1,Object.defineProperty(ou,"__esModule",{value:!0});const t=cO(),e=uO(),n=aZ(),r=lZ(),o=[t.default,e.default,n.default,r.default];return ou.default=o,ou}var au={},lu={},lx;function uZ(){if(lx)return lu;lx=1,Object.defineProperty(lu,"__esModule",{value:!0});const t=Yy(),e={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:n=>(0,t.validatePropertyDeps)(n)};return lu.default=e,lu}var cu={},cx;function dZ(){if(cx)return cu;cx=1,Object.defineProperty(cu,"__esModule",{value:!0});const t=Yy(),e={keyword:"dependentSchemas",type:"object",schemaType:"object",code:n=>(0,t.validateSchemaDeps)(n)};return cu.default=e,cu}var uu={},ux;function fZ(){if(ux)return uu;ux=1,Object.defineProperty(uu,"__esModule",{value:!0});const t=Ge(),e={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:n,parentSchema:r,it:o}){r.contains===void 0&&(0,t.checkStrictMode)(o,`"${n}" without "contains" is ignored`)}};return uu.default=e,uu}var dx;function hZ(){if(dx)return au;dx=1,Object.defineProperty(au,"__esModule",{value:!0});const t=uZ(),e=dZ(),n=fZ(),r=[t.default,e.default,n.default];return au.default=r,au}var du={},fu={},fx;function pZ(){if(fx)return fu;fx=1,Object.defineProperty(fu,"__esModule",{value:!0});const t=je(),e=Ge(),n=tr(),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:s})=>(0,t._)`{unevaluatedProperty: ${s.unevaluatedProperty}}`},code(s){const{gen:i,schema:a,data:l,errsCount:c,it:u}=s;if(!c)throw new Error("ajv implementation error");const{allErrors:d,props:f}=u;f instanceof t.Name?i.if((0,t._)`${f} !== true`,()=>i.forIn("key",l,g=>i.if(p(f,g),()=>h(g)))):f!==!0&&i.forIn("key",l,g=>f===void 0?h(g):i.if(m(f,g),()=>h(g))),u.props=!0,s.ok((0,t._)`${c} === ${n.default.errors}`);function h(g){if(a===!1){s.setParams({unevaluatedProperty:g}),s.error(),d||i.break();return}if(!(0,e.alwaysValidSchema)(u,a)){const y=i.name("valid");s.subschema({keyword:"unevaluatedProperties",dataProp:g,dataPropType:e.Type.Str},y),d||i.if((0,t.not)(y),()=>i.break())}}function p(g,y){return(0,t._)`!${g} || !${g}[${y}]`}function m(g,y){const b=[];for(const w in g)g[w]===!0&&b.push((0,t._)`${y} !== ${w}`);return(0,t.and)(...b)}}};return fu.default=o,fu}var hu={},hx;function mZ(){if(hx)return hu;hx=1,Object.defineProperty(hu,"__esModule",{value:!0});const t=je(),e=Ge(),r={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:o}})=>(0,t.str)`must NOT have more than ${o} items`,params:({params:{len:o}})=>(0,t._)`{limit: ${o}}`},code(o){const{gen:s,schema:i,data:a,it:l}=o,c=l.items||0;if(c===!0)return;const u=s.const("len",(0,t._)`${a}.length`);if(i===!1)o.setParams({len:c}),o.fail((0,t._)`${u} > ${c}`);else if(typeof i=="object"&&!(0,e.alwaysValidSchema)(l,i)){const f=s.var("valid",(0,t._)`${u} <= ${c}`);s.if((0,t.not)(f),()=>d(f,c)),o.ok(f)}l.items=!0;function d(f,h){s.forRange("i",h,u,p=>{o.subschema({keyword:"unevaluatedItems",dataProp:p,dataPropType:e.Type.Num},f),l.allErrors||s.if((0,t.not)(f),()=>s.break())})}}};return hu.default=r,hu}var px;function gZ(){if(px)return du;px=1,Object.defineProperty(du,"__esModule",{value:!0});const t=pZ(),e=mZ(),n=[t.default,e.default];return du.default=n,du}var pu={},mu={},mx;function yZ(){if(mx)return mu;mx=1,Object.defineProperty(mu,"__esModule",{value:!0});const t=je(),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(),S()));function v(){return d.strictSchema===!1?t.nil:(0,t._)`${c} && !${k}`}function S(){const E=h.$async?(0,t._)`(${b}.async ? await ${k}(${i}) : ${k}(${i}))`:(0,t._)`${k}(${i})`,M=(0,t._)`(typeof ${k} == "function" ? ${E} : ${k}.test(${i}))`;return(0,t._)`${k} && ${k} !== true && ${w} === ${o} && !${M}`}}function g(){const y=p.formats[l];if(!y){v();return}if(y===!0)return;const[b,w,k]=S(y);b===o&&r.pass(E());function v(){if(d.strictSchema===!1){p.logger.warn(M());return}throw new Error(M());function M(){return`unknown format "${l}" ignored in schema at path "${f}"`}}function S(M){const D=M instanceof RegExp?(0,t.regexpCode)(M):d.code.formats?(0,t._)`${d.code.formats}${(0,t.getProperty)(l)}`:void 0,F=s.scopeValue("formats",{key:l,ref:M,code:D});return typeof M=="object"&&!(M instanceof RegExp)?[M.type||"string",M.validate,(0,t._)`${F}.validate`]:["string",M,F]}function E(){if(typeof y=="object"&&!(y instanceof RegExp)&&y.async){if(!h.$async)throw new Error("async format in sync schema");return(0,t._)`await ${k}(${i})`}return typeof w=="function"?(0,t._)`${k}(${i})`:(0,t._)`${k}.test(${i})`}}}};return mu.default=n,mu}var gx;function dO(){if(gx)return pu;gx=1,Object.defineProperty(pu,"__esModule",{value:!0});const e=[yZ().default];return pu.default=e,pu}var Zo={},yx;function fO(){return yx||(yx=1,Object.defineProperty(Zo,"__esModule",{value:!0}),Zo.contentVocabulary=Zo.metadataVocabulary=void 0,Zo.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],Zo.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),Zo}var bx;function bZ(){if(bx)return Mc;bx=1,Object.defineProperty(Mc,"__esModule",{value:!0});const t=rO(),e=oO(),n=lO(),r=cZ(),o=hZ(),s=gZ(),i=dO(),a=fO(),l=[r.default,t.default,e.default,(0,n.default)(!0),i.default,a.metadataVocabulary,a.contentVocabulary,o.default,s.default];return Mc.default=l,Mc}var gu={},ba={},vx;function vZ(){if(vx)return ba;vx=1,Object.defineProperty(ba,"__esModule",{value:!0}),ba.DiscrError=void 0;var t;return(function(e){e.Tag="tag",e.Mapping="mapping"})(t||(ba.DiscrError=t={})),ba}var wx;function hO(){if(wx)return gu;wx=1,Object.defineProperty(gu,"__esModule",{value:!0});const t=je(),e=vZ(),n=Yf(),r=Al(),o=Ge(),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"),S=a.subschema({keyword:"oneOf",schemaProp:k},v);return a.mergeEvaluated(S,t.Name),v}function w(){var k;const v={},S=M(d);let E=!0;for(let N=0;N<h.length;N++){let A=h[N];if(A?.$ref&&!(0,o.schemaHasRulesButRef)(A,f.self.RULES)){const B=A.$ref;if(A=n.resolveRef.call(f.self,f.schemaEnv.root,f.baseId,B),A instanceof n.SchemaEnv&&(A=A.schema),A===void 0)throw new r.default(f.opts.uriResolver,f.baseId,B)}const z=(k=A?.properties)===null||k===void 0?void 0:k[p];if(typeof z!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);E=E&&(S||M(A)),D(z,N)}if(!E)throw new Error(`discriminator: "${p}" must be required`);return v;function M({required:N}){return Array.isArray(N)&&N.includes(p)}function D(N,A){if(N.const)F(N.const,A);else if(N.enum)for(const z of N.enum)F(z,A);else throw new Error(`discriminator: "properties/${p}" must have "const" or "enum"`)}function F(N,A){if(typeof N!="string"||N in v)throw new Error(`discriminator: "${p}" values must be unique strings`);v[N]=A}}}};return gu.default=i,gu}var yu={};const wZ="https://json-schema.org/draft/2020-12/schema",kZ="https://json-schema.org/draft/2020-12/schema",xZ={"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},SZ="meta",EZ="Core and Validation specifications meta-schema",CZ=[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],TZ=["object","boolean"],RZ="This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",MZ={definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}},OZ={$schema:wZ,$id:kZ,$vocabulary:xZ,$dynamicAnchor:SZ,title:EZ,allOf:CZ,type:TZ,$comment:RZ,properties:MZ},_Z="https://json-schema.org/draft/2020-12/schema",NZ="https://json-schema.org/draft/2020-12/meta/applicator",PZ={"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$Z="meta",AZ="Applicator vocabulary meta-schema",IZ=["object","boolean"],DZ={prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},zZ={schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}},jZ={$schema:_Z,$id:NZ,$vocabulary:PZ,$dynamicAnchor:$Z,title:AZ,type:IZ,properties:DZ,$defs:zZ},LZ="https://json-schema.org/draft/2020-12/schema",FZ="https://json-schema.org/draft/2020-12/meta/unevaluated",BZ={"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},VZ="meta",WZ="Unevaluated applicator vocabulary meta-schema",HZ=["object","boolean"],qZ={unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}},UZ={$schema:LZ,$id:FZ,$vocabulary:BZ,$dynamicAnchor:VZ,title:WZ,type:HZ,properties:qZ},KZ="https://json-schema.org/draft/2020-12/schema",YZ="https://json-schema.org/draft/2020-12/meta/content",GZ={"https://json-schema.org/draft/2020-12/vocab/content":!0},ZZ="meta",JZ="Content vocabulary meta-schema",XZ=["object","boolean"],QZ={contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}},eJ={$schema:KZ,$id:YZ,$vocabulary:GZ,$dynamicAnchor:ZZ,title:JZ,type:XZ,properties:QZ},tJ="https://json-schema.org/draft/2020-12/schema",nJ="https://json-schema.org/draft/2020-12/meta/core",rJ={"https://json-schema.org/draft/2020-12/vocab/core":!0},oJ="meta",sJ="Core vocabulary meta-schema",iJ=["object","boolean"],aJ={$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},lJ={anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}},cJ={$schema:tJ,$id:nJ,$vocabulary:rJ,$dynamicAnchor:oJ,title:sJ,type:iJ,properties:aJ,$defs:lJ},uJ="https://json-schema.org/draft/2020-12/schema",dJ="https://json-schema.org/draft/2020-12/meta/format-annotation",fJ={"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},hJ="meta",pJ="Format vocabulary meta-schema for annotation results",mJ=["object","boolean"],gJ={format:{type:"string"}},yJ={$schema:uJ,$id:dJ,$vocabulary:fJ,$dynamicAnchor:hJ,title:pJ,type:mJ,properties:gJ},bJ="https://json-schema.org/draft/2020-12/schema",vJ="https://json-schema.org/draft/2020-12/meta/meta-data",wJ={"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},kJ="meta",xJ="Meta-data vocabulary meta-schema",SJ=["object","boolean"],EJ={title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}},CJ={$schema:bJ,$id:vJ,$vocabulary:wJ,$dynamicAnchor:kJ,title:xJ,type:SJ,properties:EJ},TJ="https://json-schema.org/draft/2020-12/schema",RJ="https://json-schema.org/draft/2020-12/meta/validation",MJ={"https://json-schema.org/draft/2020-12/vocab/validation":!0},OJ="meta",_J="Validation vocabulary meta-schema",NJ=["object","boolean"],PJ={type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$J={nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},AJ={$schema:TJ,$id:RJ,$vocabulary:MJ,$dynamicAnchor:OJ,title:_J,type:NJ,properties:PJ,$defs:$J};var kx;function IJ(){if(kx)return yu;kx=1,Object.defineProperty(yu,"__esModule",{value:!0});const t=OZ,e=jZ,n=UZ,r=eJ,o=cJ,s=yJ,i=CJ,a=AJ,l=["/properties"];function c(u){return[t,e,n,r,o,d(this,s),i,d(this,a)].forEach(f=>this.addMetaSchema(f,void 0,!1)),this;function d(f,h){return u?f.$dataMetaSchema(h,l):h}}return yu.default=c,yu}var xx;function DJ(){return xx||(xx=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.Ajv2020=void 0;const n=nO(),r=bZ(),o=hO(),s=IJ(),i="https://json-schema.org/draft/2020-12/schema";class a extends n.default{constructor(h={}){super({...h,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),r.default.forEach(h=>this.addVocabulary(h)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:h,meta:p}=this.opts;p&&(s.default.call(this,h),this.refs["http://json-schema.org/schema"]=i)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}}e.Ajv2020=a,t.exports=e=a,t.exports.Ajv2020=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var l=$l();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var c=je();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return c._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return c.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return c.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return c.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return c.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return c.CodeGen}});var u=Kf();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return u.default}});var d=Al();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return d.default}})})(Sc,Sc.exports)),Sc.exports}var zJ=DJ();const jJ=Nm(zJ);var bu={exports:{}},mp={},Sx;function LJ(){return Sx||(Sx=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0;function e(N,A){return{validate:N,compare:A}}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:F,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:S},int64:{type:"number",validate:E},float:{type:"number",validate:M},double:{type:"number",validate:M},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 A=r.exec(N);if(!A)return!1;const z=+A[1],B=+A[2],U=+A[3];return B>=1&&B<=12&&U>=1&&U<=(B===2&&n(z)?29:o[B])}function i(N,A){if(N&&A)return N>A?1:N<A?-1:0}const a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function l(N){return function(z){const B=a.exec(z);if(!B)return!1;const U=+B[1],J=+B[2],Y=+B[3],K=B[4],G=B[5]==="-"?-1:1,L=+(B[6]||0),W=+(B[7]||0);if(L>23||W>59||N&&!K)return!1;if(U<=23&&J<=59&&Y<60)return!0;const $=J-W*G,j=U-L*G-($<0?1:0);return(j===23||j===-1)&&($===59||$===-1)&&Y<61}}function c(N,A){if(!(N&&A))return;const z=new Date("2020-01-01T"+N).valueOf(),B=new Date("2020-01-01T"+A).valueOf();if(z&&B)return z-B}function u(N,A){if(!(N&&A))return;const z=a.exec(N),B=a.exec(A);if(z&&B)return N=z[1]+z[2]+z[3],A=B[1]+B[2]+B[3],N>A?1:N<A?-1:0}const d=/t|\s/i;function f(N){const A=l(N);return function(B){const U=B.split(d);return U.length===2&&s(U[0])&&A(U[1])}}function h(N,A){if(!(N&&A))return;const z=new Date(N).valueOf(),B=new Date(A).valueOf();if(z&&B)return z-B}function p(N,A){if(!(N&&A))return;const[z,B]=N.split(d),[U,J]=A.split(d),Y=i(z,U);if(Y!==void 0)return Y||c(B,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 S(N){return Number.isInteger(N)&&N<=v&&N>=k}function E(N){return Number.isInteger(N)}function M(){return!0}const D=/[^\\]\\Z/;function F(N){if(D.test(N))return!1;try{return new RegExp(N),!0}catch{return!1}}})(mp)),mp}var gp={},vu={exports:{}},wu={},Ex;function FJ(){if(Ex)return wu;Ex=1,Object.defineProperty(wu,"__esModule",{value:!0});const t=rO(),e=oO(),n=lO(),r=dO(),o=fO(),s=[t.default,e.default,(0,n.default)(),r.default,o.metadataVocabulary,o.contentVocabulary];return wu.default=s,wu}const BJ="http://json-schema.org/draft-07/schema#",VJ="http://json-schema.org/draft-07/schema#",WJ="Core schema meta-schema",HJ={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:[]}},qJ=["object","boolean"],UJ={$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:"#"}},KJ={$schema:BJ,$id:VJ,title:WJ,definitions:HJ,type:qJ,properties:UJ,default:!0};var Cx;function YJ(){return Cx||(Cx=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=nO(),r=FJ(),o=hO(),s=KJ,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=$l();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=je();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=Kf();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var f=Al();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return f.default}})})(vu,vu.exports)),vu.exports}var Tx;function GJ(){return Tx||(Tx=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;const e=YJ(),n=je(),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})(gp)),gp}var Rx;function ZJ(){return Rx||(Rx=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const n=LJ(),r=GJ(),o=je(),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})(bu,bu.exports)),bu.exports}var JJ=ZJ();const XJ=Nm(JJ),ms="_root",pO=new jJ({allErrors:!0,strict:!1});XJ(pO);const Mx=new WeakMap;function QJ(t){const e=Mx.get(t);if(e)return e;const n=pO.compile(t);return Mx.set(t,n),n}function eX(t){return t.replaceAll("~1","/").replaceAll("~0","~")}function tX(t){if(t.keyword==="required")return(typeof t.params.missingProperty=="string"?t.params.missingProperty:void 0)??ms;const e=t.instancePath.replace(/^\//,"");if(e.length===0)return ms;const n=e.split("/")[0];return n?eX(n):ms}function nX(t){const e=t.message?.trim();return e&&e.length>0?e:"invalid value"}function rX(t){if(!t||t.length===0)return{};const e={};for(const n of t){const r=tX(n),o=nX(n),s=e[r]??[];s.includes(o)||(e[r]=[...s,o])}return e}function oX(t,e){let n;try{n=QJ(t)}catch(o){const s=o instanceof Error?o.message:String(o);return{valid:!1,errors:{[ms]:[`schema compile failed: ${s}`]}}}return{valid:!!n(e),errors:rX(n.errors)}}const Ws="border-transparent bg-muted/50 shadow-none focus-visible:border-transparent focus-visible:ring-2 focus-visible:ring-ring/35",sX=/^#[0-9a-fA-F]{6}$/,iX=50;function aX(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 Ox(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}function lX(t){const e=pG(t);if(!e)return{date:"",time:"00:00"};const[n="",r="00:00"]=e.split("T");return{date:n,time:r}}function Xd(t){return t.toString().padStart(2,"0")}function cX(t){const e=t.getFullYear(),n=Xd(t.getMonth()+1),r=Xd(t.getDate());return`${e}-${n}-${r}`}function _x(t,e){if(t)return mG(`${t}T${e||"00:00"}`)}function Nx(t){return t.trim().toUpperCase()}function uX(t){return sX.test(t)}function dX(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 fX(t){const e=dX(t);if(e)return`https://api.iconify.design/${encodeURIComponent(e.prefix)}/${encodeURIComponent(e.name)}.svg?width=24&height=24`}function hX(t){return{maskImage:`url("${t}")`,maskRepeat:"no-repeat",maskPosition:"center",maskSize:"contain",WebkitMaskImage:`url("${t}")`,WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center",WebkitMaskSize:"contain"}}const pX=Array.from({length:24},(t,e)=>Xd(e)),mX=Array.from({length:60},(t,e)=>Xd(e));function gX(t){const e=t.trim().toLowerCase();return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:")||e.startsWith("blob:")}function yX(t){const e=x.useMemo(()=>t.sourcePaths.map(o=>o.trim()).filter(o=>o.length>0),[t.sourcePaths]),[n,r]=x.useState([]);return x.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(gX(i))return{sourcePath:i,previewUrl:i,loading:!1};try{const a=await oM({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 mO(t){const e=Ee.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=yX(i);if(a.length===0)return null;const l=o===1?"grid-cols-1":"grid-cols-2";let c;e[3]!==l?(c=de("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)=>C.jsxs("div",{className:"bg-muted/50 group relative overflow-hidden rounded-md",children:[h.previewUrl?C.jsx("img",{src:h.previewUrl,alt:h.sourcePath,className:de("w-full object-cover",o===1?"h-44":"h-28")}):h.loading?C.jsx("div",{className:de("text-muted-foreground flex items-center justify-center text-[11px]",o===1?"h-44":"h-28"),children:C.jsx(Jn,{className:"size-3.5 animate-spin"})}):C.jsx("div",{className:de("text-muted-foreground flex items-center justify-center px-2 text-center text-[11px]",o===1?"h-44":"h-28"),children:"Preview unavailable"}),s?C.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:C.jsx(dS,{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=C.jsx("div",{className:c,children:u}),e[12]=c,e[13]=u,e[14]=d):d=e[14],d}function bX(t){const e=Ee.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=C.jsx(er,{id:n,type:"number",className:Ws,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 vX(t){const e=Ee.c(12),{fieldKey:n,value:r,onChange:o,onBlur:s}=t,i=r===!0,a=i?"Enabled":"Disabled";let l;e[0]!==a?(l=C.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=C.jsx(eG,{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=C.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 wX(t){const e=Ee.c(69),{fieldKey:n,value:r,onChange:o,onBlur:s}=t;let i,a;if(e[0]!==r){const{date:$,time:j}=lX(r);i=$,a=j.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 $;e[19]!==u||e[20]!==d||e[21]!==s||e[22]!==o?($=R=>{if(!R){o(void 0),s();return}const P=cX(R);o(_x(P,`${u}:${d}`)),s()},e[19]=u,e[20]=d,e[21]=s,e[22]=o,e[23]=$):$=e[23],p=$;let j;e[24]!==i||e[25]!==s||e[26]!==o?(j=(R,P)=>{o(_x(i,`${R}:${P}`)),s()},e[24]=i,e[25]=s,e[26]=o,e[27]=j):j=e[27],m=j,v="space-y-2",h=xl,f=Sl,e[28]===Symbol.for("react.memo_cache_sentinel")?(y=de(Ii({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=C.jsx(R$,{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 S;e[30]!==f||e[31]!==y||e[32]!==b||e[33]!==w||e[34]!==k?(S=C.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]=S):S=e[35];let E;e[36]!==p||e[37]!==g?(E=C.jsx(El,{className:"w-auto p-0",children:C.jsx(YY,{mode:"single",selected:g,onSelect:p})}),e[36]=p,e[37]=g,e[38]=E):E=e[38];let M;e[39]!==h||e[40]!==E||e[41]!==S?(M=C.jsxs(h,{children:[S,E]}),e[39]=h,e[40]=E,e[41]=S,e[42]=M):M=e[42];let D;e[43]===Symbol.for("react.memo_cache_sentinel")?(D=C.jsx(z$,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2"}),e[43]=D):D=e[43];let F;e[44]!==m||e[45]!==d?(F=$=>{$&&m($,d)},e[44]=m,e[45]=d,e[46]=F):F=e[46];const N=!i;let A;e[47]===Symbol.for("react.memo_cache_sentinel")?(A=C.jsx(Zu,{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:C.jsx(Gu,{placeholder:"HH"})}),e[47]=A):A=e[47];let z;e[48]===Symbol.for("react.memo_cache_sentinel")?(z=C.jsx(Ju,{children:C.jsx(Yu,{children:pX.map(xX)})}),e[48]=z):z=e[48];let B;e[49]!==u||e[50]!==F||e[51]!==N?(B=C.jsxs("div",{className:"relative",children:[D,C.jsxs(Ku,{value:u,onValueChange:F,disabled:N,children:[A,z]})]}),e[49]=u,e[50]=F,e[51]=N,e[52]=B):B=e[52];let U;e[53]!==m||e[54]!==u?(U=$=>{$&&m(u,$)},e[53]=m,e[54]=u,e[55]=U):U=e[55];const J=!i;let Y;e[56]===Symbol.for("react.memo_cache_sentinel")?(Y=C.jsx(Zu,{className:"bg-muted/50 focus-visible:ring-ring/35 w-full border-transparent shadow-none focus-visible:border-transparent focus-visible:ring-2",children:C.jsx(Gu,{placeholder:"MM"})}),e[56]=Y):Y=e[56];let K;e[57]===Symbol.for("react.memo_cache_sentinel")?(K=C.jsx(Ju,{children:C.jsx(Yu,{children:mX.map(kX)})}),e[57]=K):K=e[57];let G;e[58]!==d||e[59]!==U||e[60]!==J?(G=C.jsxs(Ku,{value:d,onValueChange:U,disabled:J,children:[Y,K]}),e[58]=d,e[59]=U,e[60]=J,e[61]=G):G=e[61];let L;e[62]!==B||e[63]!==G?(L=C.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[B,G]}),e[62]=B,e[63]=G,e[64]=L):L=e[64];let W;return e[65]!==M||e[66]!==L||e[67]!==v?(W=C.jsxs("div",{className:v,children:[M,L]}),e[65]=M,e[66]=L,e[67]=v,e[68]=W):W=e[68],W}function kX(t){return C.jsx(wf,{value:t,children:t},`minute-${t}`)}function xX(t){return C.jsx(wf,{value:t,children:t},`hour-${t}`)}function SX(t){const e=Ee.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=C.jsx(Zu,{className:"bg-muted/50 focus-visible:ring-ring/35 w-full border-transparent shadow-none focus-visible:border-transparent focus-visible:ring-2",children:C.jsx(Gu,{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=>C.jsx(wf,{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=C.jsx(Ju,{children:C.jsx(Yu,{children:c})}),e[8]=c,e[9]=u):u=e[9];let d;return e[10]!==i||e[11]!==a||e[12]!==u?(d=C.jsxs(Ku,{value:i,onValueChange:a,children:[l,u]}),e[10]=i,e[11]=a,e[12]=u,e[13]=d):d=e[13],d}function EX(t){const e=Ee.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)=>C.jsxs(Wu,{variant:"secondary",className:"bg-muted gap-1 border-transparent tracking-normal normal-case",children:[w,C.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:C.jsx(dS,{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=C.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=C.jsx(er,{id:n,className:Ws,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=C.jsxs("div",{className:"space-y-2",children:[f,g]}),e[22]=f,e[23]=g,e[24]=y):y=e[24],y}function CX(t){const e=Ee.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=C.jsx(er,{id:n,className:Ws,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?C.jsx(mO,{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=C.jsx(rM,{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=C.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 TX(t){const e=Ee.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(MX).filter(RX),e[0]=s,e[1]=f):f=e[1];const h=f;let p;e[2]!==a?(p=S=>a(S.target.value),e[2]=a,e[3]=p):p=e[3];let m;e[4]!==l||e[5]!==u?(m=S=>{(S.key==="Enter"||S.key===",")&&(S.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=C.jsx(er,{id:n,className:Ws,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=C.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=C.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?C.jsx(mO,{currentFilePath:r,sourcePaths:h,columns:2,onRemoveAt:S=>{c(S),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=C.jsx(rM,{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=C.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 RX(t){return t.length>0}function MX(t){return t.trim()}function OX(t){const e=Ee.c(28),{fieldKey:n,value:r,onChange:o,onBlur:s}=t,i=typeof r=="string"?r:"";let a,l,c;e[0]!==i?(l=Nx(i),a=l.length>0,c=a&&uX(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 S=v.target.value;o(S.length>0?S: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=C.jsx(er,{id:n,className:Ws,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(Nx(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=C.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=C.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?C.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=C.jsxs("div",{className:"space-y-2",children:[b,w]}),e[25]=b,e[26]=w,e[27]=k):k=e[27],k}function _X(t){const e=Ee.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=fX(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=C.jsx(er,{id:n,className:Ws,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=fG,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?C.jsx("span",{"aria-hidden":"true",className:"text-foreground size-3 shrink-0 bg-current",style:hX(y)}):C.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=C.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=C.jsxs("div",{className:f,children:[h,m]}),e[28]=f,e[29]=h,e[30]=m,e[31]=g):g=e[31],g}function Px(t){const e=Ee.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)=>C.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=C.jsx("div",{className:"space-y-1",children:o}),e[5]=o,e[6]=s):s=e[6],s}function NX(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 PX({selectedCollection:t,selectedFile:e}){const n=dt(T=>T.draft),r=dt(T=>T.dirty),o=dt(T=>T.errors),s=dt(T=>T.chipInputs),i=dt(T=>T.setFieldValue),a=dt(T=>T.setFieldTouched),l=dt(T=>T.setValidationErrors),c=dt(T=>T.setChipInput),u=dt(T=>T.addChipValue),d=dt(T=>T.removeChipValue),f=dt(T=>T.removeLastChipValue),h=dt(T=>T.applyRevisionSnapshot),[p,m]=x.useState([]),[g,y]=x.useState(),[b,w]=x.useState(),[k,v]=x.useState(),[S,E]=x.useState(!1),[M,D]=x.useState(!1),[F,N]=x.useState(),[A,z]=x.useState(),[B,U]=x.useState(!1),[J,Y]=x.useState(),[K,G]=x.useState(),[L,W]=x.useState("frontmatter"),$=x.useRef(0),j=x.useRef(0),R=e?.filePath,P=x.useMemo(()=>Lg(t?.schema),[t?.schema]),I=x.useMemo(()=>P?Fg(P,t?.fieldUi):[],[P,t?.fieldUi]),Z=x.useCallback(()=>{if(!t?.schema){l({});return}const T=oX(t.schema,n);l(T.errors)},[t?.schema,n,l]),X=x.useCallback(T=>{a(T),Z()},[Z,a]);x.useEffect(()=>{Z()},[Z]);const _=x.useCallback(async(T,O)=>{if(!R)return;$.current+=1;const V=$.current;O?D(!0):E(!0),v(void 0),G(void 0);try{const H=await gG({data:{filePath:R,limit:iX,cursor:T}});if($.current!==V)return;w(H.unavailableReason),y(H.nextCursor),m(Q=>{if(!O)return H.commits;const ee=new Set(Q.map(oe=>oe.sha)),re=H.commits.filter(oe=>!ee.has(oe.sha));return[...Q,...re]}),O||N(Q=>Q&&H.commits.some(re=>re.sha===Q)?Q:void 0)}catch(H){if($.current!==V)return;const Q=H instanceof Error?H.message:String(H);v(Q)}finally{$.current===V&&(E(!1),D(!1))}},[R]);x.useEffect(()=>{m([]),y(void 0),w(void 0),v(void 0),E(!1),D(!1),N(void 0),z(void 0),Y(void 0),U(!1),G(void 0),R&&_(void 0,!1)},[_,R]),x.useEffect(()=>{if(!R||!F){z(void 0),Y(void 0),U(!1);return}j.current+=1;const T=j.current;U(!0),Y(void 0),z(void 0),yG({data:{filePath:R,commitSha:F}}).then(O=>{j.current===T&&z(O)}).catch(O=>{if(j.current!==T)return;const V=O instanceof Error?O.message:String(O);Y(V)}).finally(()=>{j.current===T&&U(!1)})},[F,R]);const q=x.useCallback(()=>{if(!A||!t||r&&!window.confirm("This file has unsaved changes. Discard changes and apply this revision?"))return;const T=kG({currentDraft:n,revisionFrontmatter:A.frontmatter,schema:t.schema,fieldUi:t.fieldUi});h({draft:T.nextDraft,content:A.content});const O=F?.slice(0,7)??"";G(`Applied ${T.appliedKeys.length} frontmatter field${T.appliedKeys.length===1?"":"s"} and skipped ${T.skippedKeys.length}.`),Hn.success(O?`Applied revision ${O}.`:"Applied selected revision.")},[h,r,n,t,F,A]);return!t||!e?C.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center text-sm",children:"Select a file to edit frontmatter."}):C.jsx("div",{className:"flex h-full min-h-0 flex-col",children:C.jsxs(LS,{value:L,onValueChange:T=>{(T==="frontmatter"||T==="history")&&W(T)},className:"h-full min-h-0 w-full gap-3",children:[C.jsxs(FS,{className:"w-full",children:[C.jsx(Vu,{value:"frontmatter",className:"text-xs",children:"Frontmatter"}),C.jsx(Vu,{value:"history",className:"text-xs",children:"History"})]}),C.jsxs(Xb,{value:"frontmatter",className:"min-h-0 overflow-auto pr-1",children:[P?null:C.jsx("div",{className:"bg-muted/40 text-muted-foreground rounded-md px-3 py-2 text-sm",children:"This collection has no object schema available."}),I.map(T=>{const O=o[T.key],V=aX(T.key),H=n[T.key];return C.jsxs("div",{className:"bg-background/45 space-y-2 rounded-lg px-2.5 py-2.5",children:[C.jsx("div",{className:"flex items-center justify-between gap-2",children:C.jsxs(ZY,{htmlFor:T.key,className:"text-muted-foreground text-xs font-medium tracking-wide",children:[V,T.required?" *":""]})}),T.kind==="string"&&C.jsx(er,{id:T.key,className:Ws,value:typeof H=="string"?H:"",onChange:Q=>{i(T.key,Q.target.value||void 0)},onBlur:()=>X(T.key)}),T.kind==="image"&&C.jsx(CX,{fieldKey:T.key,currentFilePath:e.filePath,sourceMode:T.sourceMode,value:H,onChange:Q=>{i(T.key,Q)},onBlur:()=>X(T.key)}),T.kind==="color"&&C.jsx(OX,{fieldKey:T.key,value:H,onChange:Q=>{i(T.key,Q)},onBlur:()=>X(T.key)}),T.kind==="icon"&&C.jsx(_X,{fieldKey:T.key,value:H,iconLibraries:T.iconLibraries,onChange:Q=>{i(T.key,Q)},onBlur:()=>X(T.key)}),T.kind==="number"&&C.jsx(bX,{fieldKey:T.key,value:H,onChange:Q=>{i(T.key,Q)},onBlur:()=>X(T.key)}),T.kind==="boolean"&&C.jsx(vX,{fieldKey:T.key,value:H,onChange:Q=>{i(T.key,Q)},onBlur:()=>X(T.key)}),T.kind==="enum"&&C.jsx(SX,{fieldKey:T.key,value:H,options:T.options,onChange:Q=>{i(T.key,Q),X(T.key)}}),T.kind==="stringArray"&&C.jsx(EX,{fieldKey:T.key,values:Ox(H),chipInput:s[T.key]??"",onChipInputChange:Q=>{c(T.key,Q)},onAddChip:()=>{u(T.key,s[T.key]??""),X(T.key)},onRemoveChip:Q=>{d(T.key,Q),X(T.key)},onBackspaceEmpty:()=>{f(T.key),X(T.key)},onBlur:()=>X(T.key)}),T.kind==="imageArray"&&C.jsx(TX,{fieldKey:T.key,currentFilePath:e.filePath,sourceMode:T.sourceMode,values:Ox(H),chipInput:s[T.key]??"",onChipInputChange:Q=>{c(T.key,Q)},onAddChip:()=>{u(T.key,s[T.key]??""),X(T.key)},onRemoveChip:Q=>{d(T.key,Q),X(T.key)},onBlur:()=>X(T.key),onSelectAsset:Q=>{u(T.key,Q),X(T.key)}}),T.kind==="dateAnyOf"&&C.jsx(wX,{fieldKey:T.key,value:H,onChange:Q=>{i(T.key,Q)},onBlur:()=>X(T.key)}),T.kind==="unsupported"&&C.jsxs("div",{className:"bg-muted/40 text-muted-foreground rounded-md px-3 py-2 text-sm",children:["Not yet supported: ",T.reason]}),C.jsx(Px,{fieldKey:T.key,errors:O})]},T.key)}),o[ms]?.length?C.jsx(Px,{fieldKey:ms,errors:o[ms]}):null]}),C.jsxs(Xb,{value:"history",className:"min-h-0 space-y-2 overflow-auto pr-1",children:[C.jsx("div",{className:"flex justify-end",children:C.jsx(yn,{type:"button",size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",disabled:S||M||!R,onClick:()=>{_(void 0,!1)},children:"Refresh"})}),b?C.jsx("p",{className:"bg-muted/40 text-muted-foreground rounded-md px-3 py-2 text-xs",children:b}):null,!b&&k?C.jsx("p",{className:"text-destructive/90 rounded-md px-1 py-1 text-xs",children:k}):null,!b&&!k&&S&&p.length===0?C.jsxs("p",{className:"text-muted-foreground flex items-center gap-1.5 px-1 py-1 text-xs",children:[C.jsx(Jn,{className:"size-3.5 animate-spin"}),"Loading history..."]}):null,!b&&!k&&!S&&p.length===0?C.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?C.jsx("div",{className:"divide-border/40 divide-y rounded-md border",children:p.map(T=>{const O=F===T.sha,V=T.message.trim().length>0?T.message:"No commit message";return C.jsxs("div",{className:"px-2.5 py-2",children:[C.jsxs("button",{type:"button",className:"w-full text-left",onClick:()=>{G(void 0),N(H=>H===T.sha?void 0:T.sha)},children:[C.jsx("p",{className:"text-foreground/90 text-xs font-medium",children:V}),C.jsxs("p",{className:"text-muted-foreground mt-0.5 text-[11px]",children:[T.author," ·"," ",NX(T.dateIso)]})]}),O?C.jsxs("div",{className:"mt-2 space-y-2",children:[B?C.jsxs("p",{className:"text-muted-foreground flex items-center gap-1.5 text-xs",children:[C.jsx(Jn,{className:"size-3.5 animate-spin"}),"Loading frontmatter..."]}):null,J?C.jsx("p",{className:"text-destructive/90 text-xs",children:J}):null,!B&&!J&&A?C.jsxs("div",{className:"space-y-2",children:[A.parseWarnings.length>0?C.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:A.parseWarnings[0]}):null,C.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(A.frontmatter).length>0?JSON.stringify(A.frontmatter,null,2):"[No frontmatter]"}),C.jsx(yn,{type:"button",size:"sm",variant:"outline",className:"h-7 w-full text-xs",onClick:q,children:"Apply"}),K?C.jsx("p",{className:"text-muted-foreground text-[11px]",children:K}):null]}):null]}):null]},T.sha)})}):null,g?C.jsx(yn,{type:"button",size:"sm",variant:"outline",className:"h-7 w-full text-xs",disabled:M||S,onClick:()=>{_(g,!0)},children:M?C.jsxs(C.Fragment,{children:[C.jsx(Jn,{className:"size-3.5 animate-spin"}),"Loading..."]}):"Load older revisions"}):null]})]})})}function $X(){if(typeof window>"u")return"auto";const t=window.localStorage.getItem("theme");return t==="light"||t==="dark"||t==="auto"?t:"auto"}function Om(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 AX(){const t=Ee.c(13),[e,n]=x.useState("auto");let r,o;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{const h=$X();n(h),Om(h)},o=[],t[0]=r,t[1]=o):(r=t[0],o=t[1]),x.useEffect(r,o);let s,i;t[2]!==e?(s=()=>{if(e!=="auto")return;const h=window.matchMedia("(prefers-color-scheme: dark)"),p=IX;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]),x.useEffect(s,i);let a;t[5]!==e?(a=function(){const p=e==="light"?"dark":e==="dark"?"auto":"light";n(p),Om(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"?U$:e==="dark"?oA:vA;let d;t[7]!==u?(d=C.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=C.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 IX(){return Om("auto")}const $x="astro-md-editor:editor-mode",DX=gr({method:"POST"}).handler(yr("b1ee42a5714ab9be8f37a4c5fca02ffd6269030b4d3ef663ff002865393e2386")),zX=gr({method:"POST"}).handler(yr("a215cd23c3ee5dbffd561330a77a2b6ed0e0b5b10aac60190e712ffa6067a121")),jX=gr({method:"POST"}).handler(yr("248b908cf72b9979ba134470388db1f63e57871f390fb58a8be8d0757531e84c"));function HX(){const t=bO(),[e,n]=x.useState(t),r=Zy.useSearch(),[o,s]=x.useState(!0),[i,a]=x.useState(!0),[l,c]=x.useState(!1),[u,d]=x.useState(!1),[f,h]=x.useState(),[p,m]=x.useState(),g=x.useRef(null),y=x.useRef(null),b=Zy.useNavigate(),w=dt(I=>I.draft),k=dt(I=>I.contentDraft),v=dt(I=>I.dirty),S=dt(I=>I.editorMode),E=dt(I=>I.setEditorMode),M=dt(I=>I.richModeAvailability),D=dt(I=>I.richModeBlockReason),F=dt(I=>I.loadSelection),N=dt(I=>I.clearSelection),A=dt(I=>I.commitSavedState);x.useEffect(()=>{n(t)},[t]);const{selectedCollection:z,selectedFile:B,normalizedSearch:U}=x.useMemo(()=>Yj(e,r),[e,r]);x.useEffect(()=>{xh(r,U)||b({search:U,replace:!0})},[b,U,r]),x.useEffect(()=>{if(!z||!B){N();return}F({collectionName:z.name,fileId:B.id,data:B.data,content:B.content})},[N,F,z,B]),x.useEffect(()=>{if(!v)return;const I=Z=>{Z.preventDefault(),Z.returnValue=""};return window.addEventListener("beforeunload",I),()=>{window.removeEventListener("beforeunload",I)}},[v]),x.useEffect(()=>{const I=window.localStorage.getItem($x);(I==="basic"||I==="rich")&&E(I)},[E]),x.useEffect(()=>{window.localStorage.setItem($x,S)},[S]);const J=x.useCallback(()=>v?window.confirm("You have unsaved changes. Discard changes and continue?"):!0,[v]),Y=x.useCallback(I=>{const Z=e.find(q=>q.name===I);if(!Z)return;const X=_g(Z).at(0),_={collection:Z.name,file:X?.id};xh(U,_)||J()&&b({search:_})},[J,e,b,U]),K=x.useCallback(I=>{if(!z)return;const Z={collection:z.name,file:I};xh(U,Z)||J()&&b({search:Z})},[J,b,U,z]),G=x.useCallback(()=>{const I=g.current;if(!I){s(Z=>!Z);return}if(I.isCollapsed()){I.expand(),s(!0);return}I.collapse(),s(!1)},[]),L=x.useCallback(()=>{const I=y.current;if(!I){a(Z=>!Z);return}if(I.isCollapsed()){I.expand(),a(!0);return}I.collapse(),a(!1)},[]),W=x.useCallback(()=>{const I=!(g.current?.isCollapsed()??!1),Z=!(y.current?.isCollapsed()??!1);s(X=>X===I?X:I),a(X=>X===Z?X:Z)},[]),$=x.useCallback(async()=>{if(!(!z||!B||!v||l)){c(!0),m(void 0);try{await DX({data:{collectionName:z.name,fileId:B.id,draft:w,content:k}}),A(),Hn.success(`Saved ${cs(B)}.`)}catch(I){const Z=I instanceof Error?I.message:"Unable to save file.";m(Z),Hn.error(Z)}finally{c(!1)}}},[A,k,v,w,l,z,B]),j=x.useCallback(async I=>{if(!z||f)return;const Z=z.files.find(X=>X.id===I);if(Z&&!(v&&B?.id===I&&!window.confirm("This file has unsaved changes. Delete it anyway?"))){h(I),m(void 0);try{await zX({data:{collectionName:z.name,fileId:I}}),n(X=>X.map(_=>_.name!==z.name?_:{..._,files:_.files.filter(q=>q.id!==I)})),Hn.success(`Deleted ${cs(Z)}.`)}catch(X){const _=X instanceof Error?X.message:"Unable to delete file.";Hn.error(_)}finally{h(void 0)}}},[f,v,z,B?.id]),R=x.useCallback(async I=>{if(!(!z||u)){d(!0),m(void 0);try{const Z=await jX({data:{collectionName:z.name,slug:I}}),X=Z.fileId;n(_=>_.map(q=>q.name!==z.name?q:{...q,files:[...q.files,{id:Z.fileId,filePath:Z.filePath,data:{},content:"",createdAt:new Date().toISOString()}]})),await b({search:{collection:z.name,file:Z.fileId}}),Hn.success(`Created ${X}.`)}catch(Z){const X=Z instanceof Error?Z.message:"Unable to create file.";Hn.error(X)}finally{d(!1)}}},[u,b,z]);x.useEffect(()=>{m(void 0)},[z?.name,B?.id]);const P=B?cs(B):"No file selected";return C.jsx("div",{className:"h-svh w-screen overflow-hidden p-2",children:C.jsxs(sI,{orientation:"horizontal",onLayoutChanged:W,defaultLayout:{"editor-left-sidebar":18,"editor-main-panel":64,"editor-right-sidebar":18},children:[C.jsx(ch,{id:"editor-left-sidebar",panelRef:g,collapsible:!0,collapsedSize:0,defaultSize:"18%",minSize:"14%",maxSize:"40%",className:"min-w-0",children:C.jsx("aside",{className:"bg-background/55 flex h-full flex-col overflow-hidden rounded-xl px-2.5 py-3 backdrop-blur-sm",children:C.jsx(MB,{collections:e,selectedCollectionName:z?.name,selectedFileId:B?.id,onSelectCollection:Y,onSelectFile:K,onCreateFile:R,onDeleteFile:j,isCreatingFile:u,deletingFileId:f,schema:z?.schema,fieldUi:z?.fieldUi})})}),C.jsx(Kb,{withHandle:!0,className:de(o?"mx-1 w-2 bg-transparent":"mx-0 w-0",!o&&"pointer-events-none opacity-0")}),C.jsx(ch,{id:"editor-main-panel",minSize:"30%",className:"min-w-0",children:C.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:[C.jsxs("header",{className:"border-border/45 flex items-center justify-between gap-3 border-b pb-2",children:[C.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[C.jsx(yn,{variant:"ghost",size:"icon",onClick:G,"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?C.jsx(iA,{}):C.jsx(lA,{})}),C.jsx(AX,{})]}),C.jsx("p",{className:"text-foreground/85 min-w-0 flex-1 truncate text-center text-sm font-medium",title:B?.id,children:P}),C.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-2",children:[C.jsx(LS,{value:S,onValueChange:I=>{(I==="basic"||I==="rich")&&E(I)},className:"gap-0",children:C.jsxs(FS,{className:"bg-muted/55 h-auto rounded-md p-0.5",children:[C.jsx(Vu,{value:"basic",className:"h-auto rounded-sm px-2 py-1 text-xs font-medium","aria-label":"Use basic editor mode",children:"Basic"}),C.jsx(Vu,{value:"rich",className:"h-auto rounded-sm px-2 py-1 text-xs font-medium",disabled:M==="blocked","aria-label":"Use rich editor mode",title:M==="blocked"?`Rich mode unavailable: ${D??"unsupported syntax detected"}`:"Use rich editor mode",children:"Rich"})]})}),v?C.jsxs(yn,{type:"button",variant:"ghost",size:"sm",onClick:$,disabled:l||!z||!B,className:"border-0",children:[l?C.jsx(Jn,{className:"animate-spin"}):C.jsx(gA,{}),"Save"]}):null,C.jsx(yn,{variant:"ghost",size:"icon",onClick:L,"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?C.jsx(uA,{}):C.jsx(fA,{})})]})]}),p?C.jsx("p",{className:"text-destructive/90 pt-2 text-xs",children:p}):null,C.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden pt-1",children:C.jsx(Y8,{currentFilePath:B?.filePath})})]})}),C.jsx(Kb,{withHandle:!0,className:de(i?"mx-1 w-2 bg-transparent":"mx-0 w-0",!i&&"pointer-events-none opacity-0")}),C.jsx(ch,{id:"editor-right-sidebar",panelRef:y,collapsible:!0,collapsedSize:0,defaultSize:"18%",minSize:"14%",maxSize:"40%",className:"min-w-0",children:C.jsx("aside",{className:"bg-background/55 flex h-full flex-col overflow-hidden rounded-xl px-2.5 py-3 backdrop-blur-sm",children:C.jsx(PX,{selectedCollection:z,selectedFile:B})})})]})})}export{HX as component};