@foris/ai-agent 0.7.1-beta.1 → 0.7.1-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{_baseUniq-DgXUlKKz.js → _baseUniq-D_c7bZcr.js} +1 -1
- package/dist/ai-agent.es.js +1 -1
- package/dist/ai-agent.umd.js +2 -2
- package/dist/{arc-dRLdhpvC.js → arc-Wu0dsAQD.js} +1 -1
- package/dist/architecture-U656AL7Q-BlbJAzdI.js +11 -0
- package/dist/{architectureDiagram-VXUJARFQ-B346Z2M7.js → architectureDiagram-VXUJARFQ-CGExNZV3.js} +6 -6
- package/dist/{blockDiagram-VD42YOAC-Cgs0FJbu.js → blockDiagram-VD42YOAC-D-hjneUG.js} +7 -7
- package/dist/{c4Diagram-YG6GDRKO-DBVWmtyp.js → c4Diagram-YG6GDRKO-BwAuRcl2.js} +3 -3
- package/dist/{channel-Cz-B434b.js → channel-B1_Ce2Yg.js} +1 -1
- package/dist/{chunk-4BX2VUAB-BPxxqzni.js → chunk-4BX2VUAB-CDlBQ27V.js} +1 -1
- package/dist/{chunk-55IACEB6-C8UAY5kX.js → chunk-55IACEB6-Dn85BeOh.js} +1 -1
- package/dist/{chunk-B4BG7PRW-DJmfdyX3.js → chunk-B4BG7PRW-CXUpk3iw.js} +4 -4
- package/dist/{chunk-DI55MBZ5-h9C01Pxw.js → chunk-DI55MBZ5-DB1YB-ft.js} +3 -3
- package/dist/{chunk-FMBD7UC4-C0_hkEix.js → chunk-FMBD7UC4-QeKawObj.js} +1 -1
- package/dist/{chunk-QN33PNHL-Bv4zOqbW.js → chunk-QN33PNHL-CqsxRADU.js} +1 -1
- package/dist/{chunk-QZHKN3VN-BBXHJaw4.js → chunk-QZHKN3VN-BEjdyvs2.js} +1 -1
- package/dist/{chunk-TZMSLE5B-CYyN5LfG.js → chunk-TZMSLE5B-D3aWvksH.js} +1 -1
- package/dist/{classDiagram-2ON5EDUG-BwiqNztm.js → classDiagram-2ON5EDUG-CuYM0l4-.js} +6 -6
- package/dist/{classDiagram-v2-WZHVMYZB-BwiqNztm.js → classDiagram-v2-WZHVMYZB-CuYM0l4-.js} +6 -6
- package/dist/{clone-BeH4hO5_.js → clone-BnCR5QBv.js} +1 -1
- package/dist/{code-block-QI2IAROF-Bs_779OL.js → code-block-QI2IAROF-Bm7cPeE2.js} +1 -1
- package/dist/{cose-bilkent-S5V4N54A-DzcEIQWF.js → cose-bilkent-S5V4N54A-CV9T2raK.js} +2 -2
- package/dist/{dagre-6UL2VRFP-dGu9qEUT.js → dagre-6UL2VRFP-CkGy1SPP.js} +7 -7
- package/dist/{diagram-PSM6KHXK-ClFdS91X.js → diagram-PSM6KHXK-Dz6QTppc.js} +7 -7
- package/dist/{diagram-QEK2KX5R-Dw3jZbmz.js → diagram-QEK2KX5R-DS7wiHqx.js} +6 -6
- package/dist/{diagram-S2PKOQOG-CLlnDl5U.js → diagram-S2PKOQOG-U3PH655h.js} +6 -6
- package/dist/{erDiagram-Q2GNP2WA-BnoCnt_A.js → erDiagram-Q2GNP2WA-BgiguBGO.js} +5 -5
- package/dist/{flowDiagram-NV44I4VS-BdKlLEA8.js → flowDiagram-NV44I4VS-CGnJJWUc.js} +6 -6
- package/dist/{ganttDiagram-JELNMOA3-Dn5TklYE.js → ganttDiagram-JELNMOA3-BZut2_ro.js} +3 -3
- package/dist/gitGraph-F6HP7TQM-rUrF0DJh.js +11 -0
- package/dist/{gitGraphDiagram-NY62KEGX-DqOyO_gE.js → gitGraphDiagram-NY62KEGX-Ko7ejj4P.js} +7 -7
- package/dist/{graph-Bmfcy0Sl.js → graph-gyKNuAoW.js} +2 -2
- package/dist/{index-C-KHcZQ2.js → index-nM9Hb2PH.js} +4 -4
- package/dist/info-NVLQJR56-BtETYYUU.js +11 -0
- package/dist/{infoDiagram-WHAUD3N6-z3WzEU-r.js → infoDiagram-WHAUD3N6-D5_1b0Fb.js} +5 -5
- package/dist/{journeyDiagram-XKPGCS4Q-BxUR6Cqa.js → journeyDiagram-XKPGCS4Q-Bk6cS03S.js} +5 -5
- package/dist/{kanban-definition-3W4ZIXB7-D7FZcoxE.js → kanban-definition-3W4ZIXB7-CO2z9atp.js} +3 -3
- package/dist/{layout-OqeNPdO7.js → layout-CC628tC7.js} +4 -4
- package/dist/{linear-CrPirp2O.js → linear-Ds5BxNS_.js} +1 -1
- package/dist/{mermaid-NA5CF7SZ-BqH1EwOP.js → mermaid-NA5CF7SZ-CeanUKWc.js} +1 -1
- package/dist/{mermaid-parser.core-Bsa0mY-K.js → mermaid-parser.core-BusZ3tY0.js} +10 -10
- package/dist/{mermaid.core-BbyS6MrY.js → mermaid.core-k2xOhYmU.js} +31 -31
- package/dist/{min-PP7peUIE.js → min-CBrz-SV8.js} +2 -2
- package/dist/{mindmap-definition-VGOIOE7T-BS220ypg.js → mindmap-definition-VGOIOE7T-CXPoZUZt.js} +4 -4
- package/dist/packet-BFZMPI3H-BC_UbwOj.js +11 -0
- package/dist/pie-7BOR55EZ-CCxt2Pec.js +11 -0
- package/dist/{pieDiagram-ADFJNKIX-BTYZ1lLr.js → pieDiagram-ADFJNKIX-Dszo87H-.js} +7 -7
- package/dist/{quadrantDiagram-AYHSOK5B-QtH9PfxV.js → quadrantDiagram-AYHSOK5B-DX0ztbXq.js} +3 -3
- package/dist/radar-NHE76QYJ-DBloKqTS.js +11 -0
- package/dist/{requirementDiagram-UZGBJVZJ-DZB3Zlfr.js → requirementDiagram-UZGBJVZJ-Bjq7IlHD.js} +4 -4
- package/dist/{sankeyDiagram-TZEHDZUN-Cnwp6p__.js → sankeyDiagram-TZEHDZUN-Di1wSLyw.js} +2 -2
- package/dist/{sequenceDiagram-WL72ISMW-BkcWI-NS.js → sequenceDiagram-WL72ISMW-DAAtQabY.js} +4 -4
- package/dist/{stateDiagram-FKZM4ZOC-xHy91uT_.js → stateDiagram-FKZM4ZOC-4B4wCz0Q.js} +9 -9
- package/dist/{stateDiagram-v2-4FDKWEC3-DcUoLT4b.js → stateDiagram-v2-4FDKWEC3-DM2c_x-L.js} +5 -5
- package/dist/{timeline-definition-IT6M3QCI-BcUJiAmy.js → timeline-definition-IT6M3QCI-CxOVjHP0.js} +3 -3
- package/dist/treemap-KMMF4GRG-CTrbzZ2L.js +11 -0
- package/dist/{xychartDiagram-PRI3JC2R-BpsBXjbb.js → xychartDiagram-PRI3JC2R-ZZwLndM0.js} +3 -3
- package/package.json +1 -1
- package/dist/architecture-U656AL7Q-Z_eXDnPQ.js +0 -11
- package/dist/gitGraph-F6HP7TQM-7U1XAjjI.js +0 -11
- package/dist/info-NVLQJR56-DhgCJpk8.js +0 -11
- package/dist/packet-BFZMPI3H-Cr8f00VX.js +0 -11
- package/dist/pie-7BOR55EZ-DiduYgYI.js +0 -11
- package/dist/radar-NHE76QYJ-CUbcj3fU.js +0 -11
- package/dist/treemap-KMMF4GRG-BTb_ndOA.js +0 -11
package/dist/ai-agent.umd.js
CHANGED
|
@@ -535,7 +535,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
|
|
|
535
535
|
`)},f5=t=>{let e=!1;for(let a=0;a<t.length;a+=1){let r=t[a];if(r==="\\"||r==="|"){e=!0;break}}if(!e)return t;let n=[];for(let a=0;a<t.length;a+=1){let r=t[a];r==="\\"?n.push("\\\\"):r==="|"?n.push("\\|"):n.push(r)}return n.join("")},bGe=t=>{let{headers:e,rows:n}=t;if(e.length===0)return"";let a=new Array(n.length+2),r=0,i=e.map(s=>f5(s));a[r]=`| ${i.join(" | ")} |`,r+=1;let o=new Array(e.length);for(let s=0;s<e.length;s+=1)o[s]="---";a[r]=`| ${o.join(" | ")} |`,r+=1;for(let s of n)if(s.length<e.length){let l=new Array(e.length);for(let u=0;u<e.length;u+=1)l[u]=u<s.length?f5(s[u]):"";a[r]=`| ${l.join(" | ")} |`,r+=1}else{let l=s.map(u=>f5(u));a[r]=`| ${l.join(" | ")} |`,r+=1}return a.join(`
|
|
536
536
|
`)},yGe=({children:t,className:e,onCopy:n,onError:a,timeout:r=2e3})=>{let[i,o]=be.useState(!1),[s,l]=be.useState(!1),u=be.useRef(null),d=be.useRef(0),{isAnimating:p}=be.useContext(uc),m=async g=>{var h,f;if(typeof window>"u"||!((h=navigator==null?void 0:navigator.clipboard)!=null&&h.write)){a==null||a(new Error("Clipboard API not available"));return}try{let b=(f=u.current)==null?void 0:f.closest('[data-streamdown="table-wrapper"]'),y=b==null?void 0:b.querySelector("table");if(!y){a==null||a(new Error("Table not found"));return}let w=mJ(y),k=g==="csv"?AJ(w):fGe(w),C=new ClipboardItem({"text/plain":new Blob([k],{type:"text/plain"}),"text/html":new Blob([y.outerHTML],{type:"text/html"})});await navigator.clipboard.write([C]),l(!0),o(!1),n==null||n(g),d.current=window.setTimeout(()=>l(!1),r)}catch(b){a==null||a(b)}};be.useEffect(()=>{let g=h=>{u.current&&!u.current.contains(h.target)&&o(!1)};return document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g),window.clearTimeout(d.current)}},[]);let A=s?XZ:eV;return H.jsxs("div",{className:"relative",ref:u,children:[H.jsx("button",{className:xn("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",e),disabled:p,onClick:()=>o(!i),title:"Copy table",type:"button",children:t??H.jsx(A,{size:14})}),i&&H.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[H.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>m("csv"),title:"Copy table as CSV",type:"button",children:"CSV"}),H.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>m("tsv"),title:"Copy table as TSV",type:"button",children:"TSV"})]})]})},wGe=({children:t,className:e,onDownload:n,onError:a})=>{let[r,i]=be.useState(!1),o=be.useRef(null),{isAnimating:s}=be.useContext(uc),l=u=>{var d;try{let p=(d=o.current)==null?void 0:d.closest('[data-streamdown="table-wrapper"]'),m=p==null?void 0:p.querySelector("table");if(!m){a==null||a(new Error("Table not found"));return}let A=mJ(m),g=u==="csv"?AJ(A):bGe(A);Qf(`table.${u==="csv"?"csv":"md"}`,g,u==="csv"?"text/csv":"text/markdown"),i(!1),n==null||n(u)}catch(p){a==null||a(p)}};return be.useEffect(()=>{let u=d=>{o.current&&!o.current.contains(d.target)&&i(!1)};return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[]),H.jsxs("div",{className:"relative",ref:o,children:[H.jsx("button",{className:xn("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",e),disabled:s,onClick:()=>i(!r),title:"Download table",type:"button",children:t??H.jsx(SE,{size:14})}),r&&H.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[H.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>l("csv"),title:"Download table as CSV",type:"button",children:"CSV"}),H.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>l("markdown"),title:"Download table as Markdown",type:"button",children:"Markdown"})]})]})},kGe=({children:t,className:e,showControls:n,...a})=>H.jsxs("div",{className:"my-4 flex flex-col space-y-2","data-streamdown":"table-wrapper",children:[n&&H.jsxs("div",{className:"flex items-center justify-end gap-1",children:[H.jsx(yGe,{}),H.jsx(wGe,{})]}),H.jsx("div",{className:"overflow-x-auto",children:H.jsx("table",{className:xn("w-full border-collapse border border-border",e),"data-streamdown":"table",...a,children:t})})]}),vGe=be.lazy(()=>Promise.resolve().then(()=>pEt).then(t=>({default:t.CodeBlock}))),CGe=be.lazy(()=>Promise.resolve().then(()=>mEt).then(t=>({default:t.Mermaid}))),_Ge=/language-([^\s]+)/;function qE(t,e){if(!(t!=null&&t.position||e!=null&&e.position))return!0;if(!(t!=null&&t.position&&e!=null&&e.position))return!1;let n=t.position.start,a=e.position.start,r=t.position.end,i=e.position.end;return(n==null?void 0:n.line)===(a==null?void 0:a.line)&&(n==null?void 0:n.column)===(a==null?void 0:a.column)&&(r==null?void 0:r.line)===(i==null?void 0:i.line)&&(r==null?void 0:r.column)===(i==null?void 0:i.column)}function dr(t,e){return t.className===e.className&&qE(t.node,e.node)}var b5=(t,e)=>typeof t=="boolean"?t:t[e]!==!1,zE=(t,e)=>{if(typeof t=="boolean")return t;let n=t.mermaid;return n===!1?!1:n===!0||n===void 0?!0:n[e]!==!1},y5=be.memo(({children:t,className:e,node:n,...a})=>H.jsx("ol",{className:xn("list-inside list-decimal whitespace-normal",e),"data-streamdown":"ordered-list",...a,children:t}),(t,e)=>dr(t,e));y5.displayName="MarkdownOl";var gJ=be.memo(({children:t,className:e,node:n,...a})=>H.jsx("li",{className:xn("py-1 [&>p]:inline",e),"data-streamdown":"list-item",...a,children:t}),(t,e)=>t.className===e.className&&qE(t.node,e.node));gJ.displayName="MarkdownLi";var hJ=be.memo(({children:t,className:e,node:n,...a})=>H.jsx("ul",{className:xn("list-inside list-disc whitespace-normal",e),"data-streamdown":"unordered-list",...a,children:t}),(t,e)=>dr(t,e));hJ.displayName="MarkdownUl";var fJ=be.memo(({className:t,node:e,...n})=>H.jsx("hr",{className:xn("my-6 border-border",t),"data-streamdown":"horizontal-rule",...n}),(t,e)=>dr(t,e));fJ.displayName="MarkdownHr";var bJ=be.memo(({children:t,className:e,node:n,...a})=>H.jsx("span",{className:xn("font-semibold",e),"data-streamdown":"strong",...a,children:t}),(t,e)=>dr(t,e));bJ.displayName="MarkdownStrong";var yJ=be.memo(({children:t,className:e,href:n,node:a,...r})=>{let i=n==="streamdown:incomplete-link";return H.jsx("a",{className:xn("wrap-anywhere font-medium text-primary underline",e),"data-incomplete":i,"data-streamdown":"link",href:n,rel:"noreferrer",target:"_blank",...r,children:t})},(t,e)=>dr(t,e)&&t.href===e.href);yJ.displayName="MarkdownA";var wJ=be.memo(({children:t,className:e,node:n,...a})=>H.jsx("h1",{className:xn("mt-6 mb-2 font-semibold text-3xl",e),"data-streamdown":"heading-1",...a,children:t}),(t,e)=>dr(t,e));wJ.displayName="MarkdownH1";var kJ=be.memo(({children:t,className:e,node:n,...a})=>H.jsx("h2",{className:xn("mt-6 mb-2 font-semibold text-2xl",e),"data-streamdown":"heading-2",...a,children:t}),(t,e)=>dr(t,e));kJ.displayName="MarkdownH2";var vJ=be.memo(({children:t,className:e,node:n,...a})=>H.jsx("h3",{className:xn("mt-6 mb-2 font-semibold text-xl",e),"data-streamdown":"heading-3",...a,children:t}),(t,e)=>dr(t,e));vJ.displayName="MarkdownH3";var CJ=be.memo(({children:t,className:e,node:n,...a})=>H.jsx("h4",{className:xn("mt-6 mb-2 font-semibold text-lg",e),"data-streamdown":"heading-4",...a,children:t}),(t,e)=>dr(t,e));CJ.displayName="MarkdownH4";var _J=be.memo(({children:t,className:e,node:n,...a})=>H.jsx("h5",{className:xn("mt-6 mb-2 font-semibold text-base",e),"data-streamdown":"heading-5",...a,children:t}),(t,e)=>dr(t,e));_J.displayName="MarkdownH5";var xJ=be.memo(({children:t,className:e,node:n,...a})=>H.jsx("h6",{className:xn("mt-6 mb-2 font-semibold text-sm",e),"data-streamdown":"heading-6",...a,children:t}),(t,e)=>dr(t,e));xJ.displayName="MarkdownH6";var EJ=be.memo(({children:t,className:e,node:n,...a})=>{let{controls:r}=be.useContext(uc),i=b5(r,"table");return H.jsx(kGe,{className:e,"data-streamdown":"table-wrapper",showControls:i,...a,children:t})},(t,e)=>dr(t,e));EJ.displayName="MarkdownTable";var BJ=be.memo(({children:t,className:e,node:n,...a})=>H.jsx("thead",{className:xn("bg-muted/80",e),"data-streamdown":"table-header",...a,children:t}),(t,e)=>dr(t,e));BJ.displayName="MarkdownThead";var IJ=be.memo(({children:t,className:e,node:n,...a})=>H.jsx("tbody",{className:xn("divide-y divide-border bg-muted/40",e),"data-streamdown":"table-body",...a,children:t}),(t,e)=>dr(t,e));IJ.displayName="MarkdownTbody";var DJ=be.memo(({children:t,className:e,node:n,...a})=>H.jsx("tr",{className:xn("border-border border-b",e),"data-streamdown":"table-row",...a,children:t}),(t,e)=>dr(t,e));DJ.displayName="MarkdownTr";var QJ=be.memo(({children:t,className:e,node:n,...a})=>H.jsx("th",{className:xn("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",e),"data-streamdown":"table-header-cell",...a,children:t}),(t,e)=>dr(t,e));QJ.displayName="MarkdownTh";var SJ=be.memo(({children:t,className:e,node:n,...a})=>H.jsx("td",{className:xn("px-4 py-2 text-sm",e),"data-streamdown":"table-cell",...a,children:t}),(t,e)=>dr(t,e));SJ.displayName="MarkdownTd";var TJ=be.memo(({children:t,className:e,node:n,...a})=>H.jsx("blockquote",{className:xn("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",e),"data-streamdown":"blockquote",...a,children:t}),(t,e)=>dr(t,e));TJ.displayName="MarkdownBlockquote";var FJ=be.memo(({children:t,className:e,node:n,...a})=>H.jsx("sup",{className:xn("text-sm",e),"data-streamdown":"superscript",...a,children:t}),(t,e)=>dr(t,e));FJ.displayName="MarkdownSup";var LJ=be.memo(({children:t,className:e,node:n,...a})=>H.jsx("sub",{className:xn("text-sm",e),"data-streamdown":"subscript",...a,children:t}),(t,e)=>dr(t,e));LJ.displayName="MarkdownSub";var NJ=be.memo(({children:t,className:e,node:n,...a})=>{if("data-footnotes"in a){let r=o=>{var s,l;if(!be.isValidElement(o))return!1;let u=Array.isArray(o.props.children)?o.props.children:[o.props.children],d=!1,p=!1;for(let m of u)if(m){if(typeof m=="string")m.trim()!==""&&(d=!0);else if(be.isValidElement(m))if(((s=m.props)==null?void 0:s["data-footnote-backref"])!==void 0)p=!0;else{let A=Array.isArray(m.props.children)?m.props.children:[m.props.children];for(let g of A){if(typeof g=="string"&&g.trim()!==""){d=!0;break}if(be.isValidElement(g)&&((l=g.props)==null?void 0:l["data-footnote-backref"])===void 0){d=!0;break}}}}return p&&!d},i=Array.isArray(t)?t.map(o=>{if(!be.isValidElement(o))return o;if(o.type===y5){let s=(Array.isArray(o.props.children)?o.props.children:[o.props.children]).filter(l=>!r(l));return s.length===0?null:{...o,props:{...o.props,children:s}}}return o}):t;return(Array.isArray(i)?i.some(o=>o!==null):i!==null)?H.jsx("section",{className:e,...a,children:i}):null}return H.jsx("section",{className:e,...a,children:t})},(t,e)=>dr(t,e));NJ.displayName="MarkdownSection";var xGe=({node:t,className:e,children:n,...a})=>{var r,i,o;let s=((r=t==null?void 0:t.position)==null?void 0:r.start.line)===((i=t==null?void 0:t.position)==null?void 0:i.end.line),{mermaid:l,controls:u}=be.useContext(uc);if(s)return H.jsx("code",{className:xn("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",e),"data-streamdown":"inline-code",...a,children:n});let d=e==null?void 0:e.match(_Ge),p=(o=d==null?void 0:d.at(1))!=null?o:"",m="";if(be.isValidElement(n)&&n.props&&typeof n.props=="object"&&"children"in n.props&&typeof n.props.children=="string"?m=n.props.children:typeof n=="string"&&(m=n),p==="mermaid"){let g=b5(u,"mermaid"),h=zE(u,"download"),f=zE(u,"copy"),b=zE(u,"fullscreen"),y=zE(u,"panZoom");return H.jsx(be.Suspense,{fallback:H.jsx(dJ,{}),children:H.jsxs("div",{className:xn("group relative my-4 h-auto rounded-xl border p-4",e),"data-streamdown":"mermaid-block",children:[g&&(h||f||b)&&H.jsxs("div",{className:"flex items-center justify-end gap-2",children:[h&&H.jsx(mGe,{chart:m,config:l==null?void 0:l.config}),f&&H.jsx(lJ,{code:m}),b&&H.jsx(hGe,{chart:m,config:l==null?void 0:l.config})]}),H.jsx(CGe,{chart:m,config:l==null?void 0:l.config,showControls:y})]})})}let A=b5(u,"code");return H.jsx(be.Suspense,{fallback:H.jsx(dJ,{}),children:H.jsx(vGe,{className:xn("overflow-x-auto border-border border-t",e),code:m,language:p,children:A&&H.jsxs(H.Fragment,{children:[H.jsx(lGe,{code:m,language:p}),H.jsx(lJ,{})]})})})},MJ=be.memo(xGe,(t,e)=>t.className===e.className&&qE(t.node,e.node));MJ.displayName="MarkdownCode";var RJ=be.memo(dGe,(t,e)=>t.className===e.className&&qE(t.node,e.node));RJ.displayName="MarkdownImg";var PJ=be.memo(({children:t,className:e,node:n,...a})=>{var r;let i=(Array.isArray(t)?t:[t]).filter(o=>o!=null&&o!=="");return i.length===1&&be.isValidElement(i[0])&&((r=i[0].props.node)==null?void 0:r.tagName)==="img"?H.jsx(H.Fragment,{children:t}):H.jsx("p",{className:e,...a,children:t})},(t,e)=>dr(t,e));PJ.displayName="MarkdownParagraph";var EGe={ol:y5,li:gJ,ul:hJ,hr:fJ,strong:bJ,a:yJ,h1:wJ,h2:kJ,h3:vJ,h4:CJ,h5:_J,h6:xJ,table:EJ,thead:BJ,tbody:IJ,tr:DJ,th:QJ,td:SJ,blockquote:TJ,code:MJ,img:RJ,pre:({children:t})=>t,sup:FJ,sub:LJ,p:PJ,section:NJ},$J=[],OJ={allowDangerousHtml:!0},HE=new WeakMap,BGe=class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(t){let e=this.keyCache.get(t);if(e)return e;let n=t.rehypePlugins,a=t.remarkPlugins,r=t.remarkRehypeOptions;if(!(n||a||r)){let d="default";return this.keyCache.set(t,d),d}let i=d=>{if(!d||d.length===0)return"";let p="";for(let m=0;m<d.length;m+=1){let A=d[m];if(m>0&&(p+=","),Array.isArray(A)){let[g,h]=A;if(typeof g=="function"){let f=HE.get(g);f||(f=g.name,HE.set(g,f)),p+=f}else p+=String(g);p+=":",p+=JSON.stringify(h)}else if(typeof A=="function"){let g=HE.get(A);g||(g=A.name,HE.set(A,g)),p+=g}else p+=String(A)}return p},o=i(n),s=i(a),l=r?JSON.stringify(r):"",u=`${s}::${o}::${l}`;return this.keyCache.set(t,u),u}get(t){let e=this.generateCacheKey(t),n=this.cache.get(e);return n&&(this.cache.delete(e),this.cache.set(e,n)),n}set(t,e){let n=this.generateCacheKey(t);if(this.cache.size>=this.maxSize){let a=this.cache.keys().next().value;a&&this.cache.delete(a)}this.cache.set(n,e)}clear(){this.cache.clear()}},jJ=new BGe,GJ=t=>{let e=IGe(t),n=t.children||"";return QGe(e.runSync(e.parse(n),n),t)},IGe=t=>{let e=jJ.get(t);if(e)return e;let n=DGe(t);return jJ.set(t,n),n},DGe=t=>{let e=t.rehypePlugins||$J,n=t.remarkPlugins||$J,a=t.remarkRehypeOptions?{...OJ,...t.remarkRehypeOptions}:OJ;return jV().use(vV).use(n).use(QV,a).use(e)},QGe=(t,e)=>dV(t,{Fragment:H.Fragment,components:e.components,ignoreInvalidStyle:!0,jsx:H.jsx,jsxs:H.jsxs,passKeys:!0,passNode:!0}),SGe=/\[\^[^\]\s]{1,200}\](?!:)/,TGe=/\[\^[^\]\s]{1,200}\]:/,FGe=/<\/(\w+)>/,LGe=/<(\w+)[\s>]/,w5=t=>{let e=0;for(;e<t.length&&(t[e]===" "||t[e]===" "||t[e]===`
|
|
537
537
|
`||t[e]==="\r");)e+=1;return e+1<t.length&&t[e]==="$"&&t[e+1]==="$"},NGe=t=>{let e=t.length-1;for(;e>=0&&(t[e]===" "||t[e]===" "||t[e]===`
|
|
538
|
-
`||t[e]==="\r");)e-=1;return e>=1&&t[e]==="$"&&t[e-1]==="$"},k5=t=>{let e=0;for(let n=0;n<t.length-1;n+=1)t[n]==="$"&&t[n+1]==="$"&&(e+=1,n+=1);return e},MGe=t=>{let e=SGe.test(t),n=TGe.test(t);if(e||n)return[t];let a=lc.lex(t,{gfm:!0}),r=[],i=[];for(let o of a){let s=o.raw,l=r.length;if(i.length>0){if(r[l-1]+=s,o.type==="html"){let u=s.match(FGe);if(u){let d=u[1];i.at(-1)===d&&i.pop()}}continue}if(o.type==="html"&&o.block){let u=s.match(LGe);if(u){let d=u[1];s.includes(`</${d}>`)||i.push(d)}}if(s.trim()==="$$"&&l>0){let u=r[l-1],d=w5(u),p=k5(u);if(d&&p%2===1){r[l-1]=u+s;continue}}if(l>0&&NGe(s)){let u=r[l-1],d=w5(u),p=k5(u),m=k5(s);if(d&&p%2===1&&!w5(s)&&m===1){r[l-1]=u+s;continue}}r.push(s)}return r},RGe={raw:ZFe,katex:[oS,{errorColor:"var(--color-muted-foreground)"}],harden:[s9e,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:!0}]},PGe={gfm:[tPe,{}],math:[GS,{singleDollarTextMath:!1}],cjkFriendly:[CLe,{}],cjkFriendlyGfmStrikethrough:[xLe,{}]},$Ge=Object.values(RGe),OGe=Object.values(PGe),jGe={shikiTheme:["github-light","github-dark"],controls:!0,isAnimating:!1,mode:"streaming",mermaid:void 0},uc=be.createContext(jGe),qJ=be.memo(({content:t,shouldParseIncompleteMarkdown:e,...n})=>{let a=be.useMemo(()=>typeof t=="string"&&e?ZPe(t.trim()):t,[t,e]);return H.jsx(GJ,{...n,children:a})},(t,e)=>{if(t.content!==e.content||t.shouldParseIncompleteMarkdown!==e.shouldParseIncompleteMarkdown||t.index!==e.index)return!1;if(t.components!==e.components){let n=Object.keys(t.components||{}),a=Object.keys(e.components||{});if(n.length!==a.length||n.some(r=>{var i,o;return((i=t.components)==null?void 0:i[r])!==((o=e.components)==null?void 0:o[r])}))return!1}return!(t.rehypePlugins!==e.rehypePlugins||t.remarkPlugins!==e.remarkPlugins)});qJ.displayName="Block";var GGe=["github-light","github-dark"],v5=be.memo(({children:t,mode:e="streaming",parseIncompleteMarkdown:n=!0,components:a,rehypePlugins:r=$Ge,remarkPlugins:i=OGe,className:o,shikiTheme:s=GGe,mermaid:l,controls:u=!0,isAnimating:d=!1,BlockComponent:p=qJ,parseMarkdownIntoBlocksFn:m=MGe,...A})=>{let g=be.useId(),[h,f]=be.useTransition(),[b,y]=be.useState([]),w=be.useMemo(()=>m(typeof t=="string"?t:""),[t,m]);be.useEffect(()=>{e==="streaming"?f(()=>{y(w)}):y(w)},[w,e]);let k=e==="streaming"?b:w,C=be.useMemo(()=>k.map((E,I)=>`${g}-${I}`),[k.length,g]),x=be.useMemo(()=>({shikiTheme:s,controls:u,isAnimating:d,mode:e,mermaid:l}),[s,u,d,e,l]),_=be.useMemo(()=>({...EGe,...a}),[a]);return be.useEffect(()=>{if(!(Array.isArray(r)&&r.some(T=>Array.isArray(T)?T[0]===oS:T===oS)))return;let E=!1;if(Array.isArray(i)){let T=i.find(N=>Array.isArray(N)?N[0]===GS:N===GS);T&&Array.isArray(T)&&T[1]&&(E=T[1].singleDollarTextMath===!0)}let I=typeof t=="string"?t:"",Q=I.includes("$$"),D=E&&(/[^$]\$[^$]/.test(I)||/^\$[^$]/.test(I)||/[^$]\$$/.test(I));(Q||D)&&Promise.resolve().then(()=>AEt)},[r,i,t]),e==="static"?H.jsx(uc.Provider,{value:x,children:H.jsx("div",{className:xn("space-y-4 whitespace-normal",o),children:H.jsx(GJ,{components:_,rehypePlugins:r,remarkPlugins:i,...A,children:t})})}):H.jsx(uc.Provider,{value:x,children:H.jsx("div",{className:xn("space-y-4 whitespace-normal",o),children:k.map((E,I)=>H.jsx(p,{components:_,content:E,index:I,rehypePlugins:r,remarkPlugins:i,shouldParseIncompleteMarkdown:n,...A},C[I]))})})},(t,e)=>t.children===e.children&&t.shikiTheme===e.shikiTheme&&t.isAnimating===e.isAnimating&&t.mode===e.mode);v5.displayName="Streamdown";var qGe=({children:t,className:e,minZoom:n=.5,maxZoom:a=3,zoomStep:r=.1,showControls:i=!0,initialZoom:o=1,fullscreen:s=!1})=>{let l=be.useRef(null),u=be.useRef(null),[d,p]=be.useState(o),[m,A]=be.useState({x:0,y:0}),[g,h]=be.useState(!1),[f,b]=be.useState({x:0,y:0}),[y,w]=be.useState({x:0,y:0}),k=be.useCallback(T=>{p(N=>Math.max(n,Math.min(a,N+T)))},[n,a]),C=be.useCallback(()=>{k(r)},[k,r]),x=be.useCallback(()=>{k(-r)},[k,r]),_=be.useCallback(()=>{p(o),A({x:0,y:0})},[o]),E=be.useCallback(T=>{T.preventDefault();let N=T.deltaY>0?-r:r;k(N)},[k,r]),I=be.useCallback(T=>{if(T.button!==0||T.isPrimary===!1)return;h(!0),b({x:T.clientX,y:T.clientY}),w(m);let N=T.currentTarget;N instanceof HTMLElement&&N.setPointerCapture(T.pointerId)},[m]),Q=be.useCallback(T=>{if(!g)return;T.preventDefault();let N=T.clientX-f.x,B=T.clientY-f.y;A({x:y.x+N,y:y.y+B})},[g,f,y]),D=be.useCallback(T=>{h(!1);let N=T.currentTarget;N instanceof HTMLElement&&N.releasePointerCapture(T.pointerId)},[]);return be.useEffect(()=>{let T=l.current;if(T)return T.addEventListener("wheel",E,{passive:!1}),()=>{T.removeEventListener("wheel",E)}},[E]),be.useEffect(()=>{let T=u.current;if(T&&g)return document.body.style.userSelect="none",T.addEventListener("pointermove",Q,{passive:!1}),T.addEventListener("pointerup",D),T.addEventListener("pointercancel",D),()=>{document.body.style.userSelect="",T.removeEventListener("pointermove",Q),T.removeEventListener("pointerup",D),T.removeEventListener("pointercancel",D)}},[g,Q,D]),H.jsxs("div",{className:xn("relative",s?"h-full w-full":"w-full",e),ref:l,style:{cursor:g?"grabbing":"grab"},children:[i&&H.jsxs("div",{className:xn("absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/90 p-1 shadow-sm backdrop-blur-sm",s?"bottom-4 left-4":"bottom-2 left-2"),children:[H.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:d>=a,onClick:C,title:"Zoom in",type:"button",children:H.jsx(o$e,{size:16})}),H.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:d<=n,onClick:x,title:"Zoom out",type:"button",children:H.jsx(s$e,{size:16})}),H.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:_,title:"Reset zoom and pan",type:"button",children:H.jsx(r$e,{size:16})})]}),H.jsx("div",{className:xn("origin-center transition-transform duration-150 ease-out",s&&"flex w-full items-center justify-center"),onPointerDown:I,ref:u,role:"application",style:{transform:`translate(${m.x}px, ${m.y}px) scale(${d})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:t})]})},zJ=({chart:t,className:e,config:n,fullscreen:a=!1,showControls:r=!0})=>{let[i,o]=be.useState(null),[s,l]=be.useState(!0),[u,d]=be.useState(""),[p,m]=be.useState(""),[A,g]=be.useState(0),{mermaid:h}=be.useContext(uc),f=h==null?void 0:h.errorComponent;if(be.useEffect(()=>{(async()=>{try{o(null),l(!0);let y=await pJ(n),w=t.split("").reduce((x,_)=>(x<<5)-x+_.charCodeAt(0)|0,0),k=`mermaid-${Math.abs(w)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:C}=await y.render(k,t);d(C),m(C)}catch(y){if(!(p||u)){let w=y instanceof Error?y.message:"Failed to render Mermaid chart";o(w)}}finally{l(!1)}})()},[t,n,A]),s&&!u&&!p)return H.jsx("div",{className:xn("my-4 flex justify-center p-4",e),children:H.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[H.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-current border-b-2"}),H.jsx("span",{className:"text-sm",children:"Loading diagram..."})]})});if(i&&!u&&!p){let y=()=>g(w=>w+1);return f?H.jsx(f,{chart:t,error:i,retry:y}):H.jsxs("div",{className:xn("rounded-lg border border-red-200 bg-red-50 p-4",e),children:[H.jsxs("p",{className:"font-mono text-red-700 text-sm",children:["Mermaid Error: ",i]}),H.jsxs("details",{className:"mt-2",children:[H.jsx("summary",{className:"cursor-pointer text-red-600 text-xs",children:"Show Code"}),H.jsx("pre",{className:"mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs",children:t})]})]})}let b=u||p;return H.jsx(qGe,{className:xn(a?"h-full w-full overflow-hidden":"my-4 overflow-hidden",e),fullscreen:a,maxZoom:3,minZoom:.5,showControls:r,zoomStep:.1,children:H.jsx("div",{"aria-label":"Mermaid chart",className:xn("flex justify-center",a&&"h-full w-full items-center"),dangerouslySetInnerHTML:{__html:b},role:"img"})})};const zGe=({className:t,from:e,...n})=>H.jsx("div",{className:Tn("message-box group flex w-full max-w-[95%] flex-col gap-2",e==="user"?"is-user ml-auto justify-end":"is-assistant",t),...n}),HGe=({children:t,className:e,...n})=>H.jsx("div",{className:Tn("message-content is-user:dark flex w-fit max-w-full min-w-0 flex-col gap-2 overflow-hidden text-sm","group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground","group-[.is-assistant]:text-foreground",e),...n,children:t});be.createContext(null);const C5=be.memo(({className:t,...e})=>H.jsx(v5,{className:Tn("message-response size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",t),...e}),(t,e)=>t.children===e.children);C5.displayName="MessageResponse";var UE="Collapsible",[UGe,Pgn]=EA(UE),[YGe,_5]=UGe(UE),HJ=_e.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:a,defaultOpen:r,disabled:i,onOpenChange:o,...s}=t,[l,u]=sf({prop:a,defaultProp:r??!1,onChange:o,caller:UE});return H.jsx(YGe,{scope:n,disabled:i,contentId:Ex(),open:l,onOpenToggle:_e.useCallback(()=>u(d=>!d),[u]),children:H.jsx(Yr.div,{"data-state":E5(l),"data-disabled":i?"":void 0,...s,ref:e})})});HJ.displayName=UE;var UJ="CollapsibleTrigger",YJ=_e.forwardRef((t,e)=>{const{__scopeCollapsible:n,...a}=t,r=_5(UJ,n);return H.jsx(Yr.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":E5(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...a,ref:e,onClick:_n(t.onClick,r.onOpenToggle)})});YJ.displayName=UJ;var x5="CollapsibleContent",WJ=_e.forwardRef((t,e)=>{const{forceMount:n,...a}=t,r=_5(x5,t.__scopeCollapsible);return H.jsx(_p,{present:n||r.open,children:({present:i})=>H.jsx(WGe,{...a,ref:e,present:i})})});WJ.displayName=x5;var WGe=_e.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:a,children:r,...i}=t,o=_5(x5,n),[s,l]=_e.useState(a),u=_e.useRef(null),d=Zi(e,u),p=_e.useRef(0),m=p.current,A=_e.useRef(0),g=A.current,h=o.open||s,f=_e.useRef(h),b=_e.useRef(void 0);return _e.useEffect(()=>{const y=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(y)},[]),td(()=>{const y=u.current;if(y){b.current=b.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";const w=y.getBoundingClientRect();p.current=w.height,A.current=w.width,f.current||(y.style.transitionDuration=b.current.transitionDuration,y.style.animationName=b.current.animationName),l(a)}},[o.open,a]),H.jsx(Yr.div,{"data-state":E5(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!h,...i,ref:d,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...t.style},children:h&&r})});function E5(t){return t?"open":"closed"}var KGe=HJ;function B5({...t}){return H.jsx(KGe,{"data-slot":"collapsible",...t})}function I5({...t}){return H.jsx(YJ,{"data-slot":"collapsible-trigger",...t})}function D5({...t}){return H.jsx(WJ,{"data-slot":"collapsible-content",...t})}const KJ=be.createContext({});function ZGe(t){const e=be.useRef(null);return e.current===null&&(e.current=t()),e.current}const ZJ=typeof window<"u",VGe=ZJ?be.useLayoutEffect:be.useEffect,Q5=be.createContext(null);function S5(t,e){t.indexOf(e)===-1&&t.push(e)}function T5(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Zl=(t,e,n)=>n>e?e:n<t?t:n;function VJ(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}var F5={npm_package_dependencies__radix_ui_react_hover_card:"1.1.15",npm_config_legacy_peer_deps:"true",TERM_PROGRAM:"WarpTerminal",NODE:"/Users/diananr/.nvm/versions/node/v22.21.1/bin/node",INIT_CWD:"/Users/diananr/foris/avocado/packages/ai-agent",npm_package_devDependencies_typescript:"5.1.3",npm_package_dependencies_lucide_react:"0.561.0",npm_package_devDependencies_vite:"5.0.12",npm_package_dependencies__radix_ui_react_dialog:"1.1.15",TERM:"xterm-256color",SHELL:"/bin/zsh",npm_package_devDependencies__testing_library_user_event:"14.5.2",npm_package_devDependencies__vitest_ui:"1.2.2",npm_package_dependencies_streamdown:"1.6.10",npm_package_dependencies_postcss:"8.5.6",TURBO_IS_TUI:"true",npm_config_registry:"https://registry.npmjs.org/",npm_package_dependencies__radix_ui_react_select:"2.2.6",npm_package_devDependencies_vite_plugin_static_copy:"1.0.0",npm_package_dependencies_react_dom:"18.3.1",npm_package_devDependencies__testing_library_react:"14.2.0",npm_package_devDependencies__types_react:"18.3.1",npm_package_dependencies_embla_carousel_react:"8.6.0",npm_package_dependencies_ai:"5.0.115",npm_package_dependencies__radix_ui_react_tooltip:"1.2.8",PNPM_SCRIPT_SRC_DIR:"/Users/diananr/foris/avocado/packages/ai-agent",npm_package_exports___import:"./dist/ai-agent.es.js",npm_package_dependencies_use_stick_to_bottom:"1.1.1",npm_package_devDependencies__types_testing_library__jest_dom:"6.0.0",npm_package_dependencies__uiw_react_codemirror:"4.25.4",__CF_USER_TEXT_ENCODING:"0x1F6:0x0:0x0",npm_execpath:"/Users/diananr/Library/pnpm/.tools/pnpm/9.10.0/node_modules/pnpm/bin/pnpm.cjs",npm_package_scripts_coverage:"vitest run --coverage",npm_package_dependencies__radix_ui_react_use_controllable_state:"1.2.2",npm_package_module:"./dist/ai-agent.es.js",npm_config_frozen_lockfile:"",npm_package_devDependencies__types_react_dom:"18.3.1",npm_package_devDependencies_classnames:"2.3.2",npm_package_dependencies_tailwind_merge:"3.4.0",npm_package_dependencies_class_variance_authority:"0.7.1",PATH:"/Users/diananr/foris/avocado/packages/ai-agent/node_modules/.bin:/Users/diananr/Library/pnpm/.tools/pnpm/9.10.0/node_modules/pnpm/dist/node-gyp-bin:/Users/diananr/foris/avocado/node_modules/.bin:/Users/diananr/foris/avocado/node_modules/.bin:/Users/diananr/Library/pnpm/.tools/pnpm/9.10.0/node_modules/pnpm/dist/node-gyp-bin:/Users/diananr/foris/avocado/node_modules/.bin:/Users/diananr/Library/pnpm/.tools/pnpm/9.10.0/bin:/Users/diananr/.antigravity/antigravity/bin:/Users/diananr/.rbenv/shims:/Users/diananr/.rbenv/bin:/Users/diananr/.rbenv/shims:/Users/diananr/.rbenv/bin:/Users/diananr/.rbenv/shims:/Users/diananr/.rbenv/bin:/Users/diananr/.nvm/versions/node/v22.21.1/bin:/Users/diananr/.asdf/installs/erlang/24.3.4/bin:/Users/diananr/.asdf/installs/elixir/1.14.1-otp-24/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/share/dotnet:~/.dotnet/tools:/usr/local/go/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Warp.app/Contents/Resources/bin",npm_package_dependencies__radix_ui_react_progress:"1.1.8",npm_config_auto_install_peers:"true",npm_command:"run-script",npm_package_devDependencies_tailwindcss:"4.1.18",PWD:"/Users/diananr/foris/avocado/packages/ai-agent",npm_package_scripts_test_watch:"vitest --ui",npm_lifecycle_event:"build",npm_package_devDependencies_jsdom:"24.0.0",npm_package_dependencies__tailwindcss_postcss:"4.1.18",npm_package_types:"./dist/index.d.ts",npm_package_name:"@foris/ai-agent",npm_package_devDependencies_sass:"1.62.1",npm_package_devDependencies__vitest_coverage_v8:"1.2.2",npm_package_devDependencies__foris_tsconfig:"workspace:*",npm_package_dependencies_cmdk:"1.1.1",npm_package_scripts_build:"tsc && vite build",npm_package_exports___types:"./dist/index.d.ts",npm_config_node_linker:"hoisted",npm_package_devDependencies_vitest:"1.2.2",npm_package_devDependencies_tw_animate_css:"1.4.0",npm_package_dependencies_motion:"12.23.26",TURBO_HASH:"71919baa31f779fb",npm_package_dependencies_tokenlens:"1.3.1",npm_package_devDependencies__shikijs_transformers:"3.20.0",npm_config_node_gyp:"/Users/diananr/Library/pnpm/.tools/pnpm/9.10.0/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js",npm_package_devDependencies_vite_plugin_dts:"3.7.1",npm_package_dependencies__radix_ui_react_collapsible:"1.1.12",npm_package_main:"./dist/ai-agent.umd.js",npm_package_version:"0.7.1-beta.1",SHLVL:"1",npm_package_type:"module",HOME:"/Users/diananr",npm_package_dependencies_react_markdown:"10.1.0",npm_package_dependencies_nanoid:"5.1.6",npm_package_publishConfig_access:"public",npm_package_dependencies__radix_ui_react_slot:"1.2.4",npm_package_exports___default:"./dist/ai-agent.es.js",npm_lifecycle_script:"tsc && vite build",npm_package_exports___require:"./dist/ai-agent.umd.js",npm_package_dependencies__xyflow_react:"12.10.0",npm_package_devDependencies__vitejs_plugin_react_swc:"3.5.0",npm_package_dependencies_react:"18.3.1",npm_package_dependencies__radix_ui_react_separator:"1.1.8",npm_config_user_agent:"pnpm/9.10.0 npm/? node/v22.21.1 darwin arm64",npm_package_devDependencies__types_node:"20.2.5",npm_package_dependencies_clsx:"2.1.1",npm_package_dependencies__radix_ui_react_dropdown_menu:"2.1.16",npm_package_dependencies__ai_sdk_react:"2.0.117",npm_package_files_0:"dist",npm_package_dependencies_shiki:"3.20.0",npm_package_dependencies__codemirror_lang_json:"6.0.1",npm_node_execpath:"/Users/diananr/.nvm/versions/node/v22.21.1/bin/node",npm_package_devDependencies__testing_library_jest_dom:"6.4.0",npm_package_dependencies__radix_ui_react_scroll_area:"1.2.10",COLORTERM:"truecolor",_:"/Users/diananr/foris/avocado/node_modules/.bin/vite",NODE_ENV:"production"};let fw=()=>{},qA=()=>{};typeof process<"u"&&(F5==null?void 0:F5.NODE_ENV)!=="production"&&(fw=(t,e,n)=>{!t&&typeof console<"u"&&console.warn(VJ(e,n))},qA=(t,e,n)=>{if(!t)throw new Error(VJ(e,n))});const hd={},JJ=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function XJ(t){return typeof t=="object"&&t!==null}const eX=t=>/^0[^.\s]+$/u.test(t);function L5(t){let e;return()=>(e===void 0&&(e=t()),e)}const dc=t=>t,JGe=(t,e)=>n=>e(t(n)),bw=(...t)=>t.reduce(JGe),yw=(t,e,n)=>{const a=e-t;return a===0?1:(n-t)/a};class N5{constructor(){this.subscriptions=[]}add(e){return S5(this.subscriptions,e),()=>T5(this.subscriptions,e)}notify(e,n,a){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,n,a);else for(let i=0;i<r;i++){const o=this.subscriptions[i];o&&o(e,n,a)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Vl=t=>t*1e3,pc=t=>t/1e3;function tX(t,e){return e?t*(1e3/e):0}const nX=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,XGe=1e-7,eqe=12;function tqe(t,e,n,a,r){let i,o,s=0;do o=e+(n-e)/2,i=nX(o,a,r)-t,i>0?n=o:e=o;while(Math.abs(i)>XGe&&++s<eqe);return o}function ww(t,e,n,a){if(t===e&&n===a)return dc;const r=i=>tqe(i,0,1,t,n);return i=>i===0||i===1?i:nX(r(i),e,a)}const aX=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,rX=t=>e=>1-t(1-e),iX=ww(.33,1.53,.69,.99),M5=rX(iX),oX=aX(M5),sX=t=>(t*=2)<1?.5*M5(t):.5*(2-Math.pow(2,-10*(t-1))),R5=t=>1-Math.sin(Math.acos(t)),cX=rX(R5),lX=aX(R5),nqe=ww(.42,0,1,1),aqe=ww(0,0,.58,1),uX=ww(.42,0,.58,1),rqe=t=>Array.isArray(t)&&typeof t[0]!="number",dX=t=>Array.isArray(t)&&typeof t[0]=="number",pX={linear:dc,easeIn:nqe,easeInOut:uX,easeOut:aqe,circIn:R5,circInOut:lX,circOut:cX,backIn:M5,backInOut:oX,backOut:iX,anticipate:sX},iqe=t=>typeof t=="string",mX=t=>{if(dX(t)){qA(t.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,n,a,r]=t;return ww(e,n,a,r)}else if(iqe(t))return qA(pX[t]!==void 0,`Invalid easing type '${t}'`,"invalid-easing-type"),pX[t];return t},YE=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],AX={value:null,addProjectionMetrics:null};function oqe(t,e){let n=new Set,a=new Set,r=!1,i=!1;const o=new WeakSet;let s={delta:0,timestamp:0,isProcessing:!1},l=0;function u(p){o.has(p)&&(d.schedule(p),t()),l++,p(s)}const d={schedule:(p,m=!1,A=!1)=>{const h=A&&r?n:a;return m&&o.add(p),h.has(p)||h.add(p),p},cancel:p=>{a.delete(p),o.delete(p)},process:p=>{if(s=p,r){i=!0;return}r=!0,[n,a]=[a,n],n.forEach(u),e&&AX.value&&AX.value.frameloop[e].push(l),l=0,n.clear(),r=!1,i&&(i=!1,d.process(p))}};return d}const sqe=40;function gX(t,e){let n=!1,a=!0;const r={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=YE.reduce((w,k)=>(w[k]=oqe(i,e?k:void 0),w),{}),{setup:s,read:l,resolveKeyframes:u,preUpdate:d,update:p,preRender:m,render:A,postRender:g}=o,h=()=>{const w=hd.useManualTiming?r.timestamp:performance.now();n=!1,hd.useManualTiming||(r.delta=a?1e3/60:Math.max(Math.min(w-r.timestamp,sqe),1)),r.timestamp=w,r.isProcessing=!0,s.process(r),l.process(r),u.process(r),d.process(r),p.process(r),m.process(r),A.process(r),g.process(r),r.isProcessing=!1,n&&e&&(a=!1,t(h))},f=()=>{n=!0,a=!0,r.isProcessing||t(h)};return{schedule:YE.reduce((w,k)=>{const C=o[k];return w[k]=(x,_=!1,E=!1)=>(n||f(),C.schedule(x,_,E)),w},{}),cancel:w=>{for(let k=0;k<YE.length;k++)o[YE[k]].cancel(w)},state:r,steps:o}}const{schedule:Ma,cancel:Pp,state:Ti,steps:P5}=gX(typeof requestAnimationFrame<"u"?requestAnimationFrame:dc,!0);let WE;function cqe(){WE=void 0}const So={now:()=>(WE===void 0&&So.set(Ti.isProcessing||hd.useManualTiming?Ti.timestamp:performance.now()),WE),set:t=>{WE=t,queueMicrotask(cqe)}},hX=t=>e=>typeof e=="string"&&e.startsWith(t),fX=hX("--"),lqe=hX("var(--"),$5=t=>lqe(t)?uqe.test(t.split("/*")[0].trim()):!1,uqe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function bX(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const Sf={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},kw={...Sf,transform:t=>Zl(0,1,t)},KE={...Sf,default:1},vw=t=>Math.round(t*1e5)/1e5,O5=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function dqe(t){return t==null}const pqe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,j5=(t,e)=>n=>!!(typeof n=="string"&&pqe.test(n)&&n.startsWith(t)||e&&!dqe(n)&&Object.prototype.hasOwnProperty.call(n,e)),yX=(t,e,n)=>a=>{if(typeof a!="string")return a;const[r,i,o,s]=a.match(O5);return{[t]:parseFloat(r),[e]:parseFloat(i),[n]:parseFloat(o),alpha:s!==void 0?parseFloat(s):1}},mqe=t=>Zl(0,255,t),G5={...Sf,transform:t=>Math.round(mqe(t))},zA={test:j5("rgb","red"),parse:yX("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:a=1})=>"rgba("+G5.transform(t)+", "+G5.transform(e)+", "+G5.transform(n)+", "+vw(kw.transform(a))+")"};function Aqe(t){let e="",n="",a="",r="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),a=t.substring(5,7),r=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),a=t.substring(3,4),r=t.substring(4,5),e+=e,n+=n,a+=a,r+=r),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(a,16),alpha:r?parseInt(r,16)/255:1}}const q5={test:j5("#"),parse:Aqe,transform:zA.transform},Cw=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),$p=Cw("deg"),Jl=Cw("%"),Vt=Cw("px"),gqe=Cw("vh"),hqe=Cw("vw"),wX={...Jl,parse:t=>Jl.parse(t)/100,transform:t=>Jl.transform(t*100)},Tf={test:j5("hsl","hue"),parse:yX("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:a=1})=>"hsla("+Math.round(t)+", "+Jl.transform(vw(e))+", "+Jl.transform(vw(n))+", "+vw(kw.transform(a))+")"},Sr={test:t=>zA.test(t)||q5.test(t)||Tf.test(t),parse:t=>zA.test(t)?zA.parse(t):Tf.test(t)?Tf.parse(t):q5.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?zA.transform(t):Tf.transform(t),getAnimatableNone:t=>{const e=Sr.parse(t);return e.alpha=0,Sr.transform(e)}},fqe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function bqe(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(O5))==null?void 0:e.length)||0)+(((n=t.match(fqe))==null?void 0:n.length)||0)>0}const kX="number",vX="color",yqe="var",wqe="var(",CX="${}",kqe=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function _w(t){const e=t.toString(),n=[],a={color:[],number:[],var:[]},r=[];let i=0;const s=e.replace(kqe,l=>(Sr.test(l)?(a.color.push(i),r.push(vX),n.push(Sr.parse(l))):l.startsWith(wqe)?(a.var.push(i),r.push(yqe),n.push(l)):(a.number.push(i),r.push(kX),n.push(parseFloat(l))),++i,CX)).split(CX);return{values:n,split:s,indexes:a,types:r}}function _X(t){return _w(t).values}function xX(t){const{split:e,types:n}=_w(t),a=e.length;return r=>{let i="";for(let o=0;o<a;o++)if(i+=e[o],r[o]!==void 0){const s=n[o];s===kX?i+=vw(r[o]):s===vX?i+=Sr.transform(r[o]):i+=r[o]}return i}}const vqe=t=>typeof t=="number"?0:Sr.test(t)?Sr.getAnimatableNone(t):t;function Cqe(t){const e=_X(t);return xX(t)(e.map(vqe))}const Op={test:bqe,parse:_X,createTransformer:xX,getAnimatableNone:Cqe};function z5(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function _qe({hue:t,saturation:e,lightness:n,alpha:a}){t/=360,e/=100,n/=100;let r=0,i=0,o=0;if(!e)r=i=o=n;else{const s=n<.5?n*(1+e):n+e-n*e,l=2*n-s;r=z5(l,s,t+1/3),i=z5(l,s,t),o=z5(l,s,t-1/3)}return{red:Math.round(r*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:a}}function ZE(t,e){return n=>n>0?e:t}const ir=(t,e,n)=>t+(e-t)*n,H5=(t,e,n)=>{const a=t*t,r=n*(e*e-a)+a;return r<0?0:Math.sqrt(r)},xqe=[q5,zA,Tf],Eqe=t=>xqe.find(e=>e.test(t));function EX(t){const e=Eqe(t);if(fw(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!e)return!1;let n=e.parse(t);return e===Tf&&(n=_qe(n)),n}const BX=(t,e)=>{const n=EX(t),a=EX(e);if(!n||!a)return ZE(t,e);const r={...n};return i=>(r.red=H5(n.red,a.red,i),r.green=H5(n.green,a.green,i),r.blue=H5(n.blue,a.blue,i),r.alpha=ir(n.alpha,a.alpha,i),zA.transform(r))},U5=new Set(["none","hidden"]);function Bqe(t,e){return U5.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function Iqe(t,e){return n=>ir(t,e,n)}function Y5(t){return typeof t=="number"?Iqe:typeof t=="string"?$5(t)?ZE:Sr.test(t)?BX:Sqe:Array.isArray(t)?IX:typeof t=="object"?Sr.test(t)?BX:Dqe:ZE}function IX(t,e){const n=[...t],a=n.length,r=t.map((i,o)=>Y5(i)(i,e[o]));return i=>{for(let o=0;o<a;o++)n[o]=r[o](i);return n}}function Dqe(t,e){const n={...t,...e},a={};for(const r in n)t[r]!==void 0&&e[r]!==void 0&&(a[r]=Y5(t[r])(t[r],e[r]));return r=>{for(const i in a)n[i]=a[i](r);return n}}function Qqe(t,e){const n=[],a={color:0,var:0,number:0};for(let r=0;r<e.values.length;r++){const i=e.types[r],o=t.indexes[i][a[i]],s=t.values[o]??0;n[r]=s,a[i]++}return n}const Sqe=(t,e)=>{const n=Op.createTransformer(e),a=_w(t),r=_w(e);return a.indexes.var.length===r.indexes.var.length&&a.indexes.color.length===r.indexes.color.length&&a.indexes.number.length>=r.indexes.number.length?U5.has(t)&&!r.values.length||U5.has(e)&&!a.values.length?Bqe(t,e):bw(IX(Qqe(a,r),r.values),n):(fw(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),ZE(t,e))};function DX(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?ir(t,e,n):Y5(t)(t,e)}const Tqe=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>Ma.update(e,n),stop:()=>Pp(e),now:()=>Ti.isProcessing?Ti.timestamp:So.now()}},QX=(t,e,n=10)=>{let a="";const r=Math.max(Math.round(e/n),2);for(let i=0;i<r;i++)a+=Math.round(t(i/(r-1))*1e4)/1e4+", ";return`linear(${a.substring(0,a.length-2)})`},VE=2e4;function W5(t){let e=0;const n=50;let a=t.next(e);for(;!a.done&&e<VE;)e+=n,a=t.next(e);return e>=VE?1/0:e}function Fqe(t,e=100,n){const a=n({...t,keyframes:[0,e]}),r=Math.min(W5(a),VE);return{type:"keyframes",ease:i=>a.next(r*i).value/e,duration:pc(r)}}const Lqe=5;function SX(t,e,n){const a=Math.max(e-Lqe,0);return tX(n-t(a),e-a)}const or={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},K5=.001;function Nqe({duration:t=or.duration,bounce:e=or.bounce,velocity:n=or.velocity,mass:a=or.mass}){let r,i;fw(t<=Vl(or.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let o=1-e;o=Zl(or.minDamping,or.maxDamping,o),t=Zl(or.minDuration,or.maxDuration,pc(t)),o<1?(r=u=>{const d=u*o,p=d*t,m=d-n,A=Z5(u,o),g=Math.exp(-p);return K5-m/A*g},i=u=>{const p=u*o*t,m=p*n+n,A=Math.pow(o,2)*Math.pow(u,2)*t,g=Math.exp(-p),h=Z5(Math.pow(u,2),o);return(-r(u)+K5>0?-1:1)*((m-A)*g)/h}):(r=u=>{const d=Math.exp(-u*t),p=(u-n)*t+1;return-K5+d*p},i=u=>{const d=Math.exp(-u*t),p=(n-u)*(t*t);return d*p});const s=5/t,l=Rqe(r,i,s);if(t=Vl(t),isNaN(l))return{stiffness:or.stiffness,damping:or.damping,duration:t};{const u=Math.pow(l,2)*a;return{stiffness:u,damping:o*2*Math.sqrt(a*u),duration:t}}}const Mqe=12;function Rqe(t,e,n){let a=n;for(let r=1;r<Mqe;r++)a=a-t(a)/e(a);return a}function Z5(t,e){return t*Math.sqrt(1-e*e)}const Pqe=["duration","bounce"],$qe=["stiffness","damping","mass"];function TX(t,e){return e.some(n=>t[n]!==void 0)}function Oqe(t){let e={velocity:or.velocity,stiffness:or.stiffness,damping:or.damping,mass:or.mass,isResolvedFromDuration:!1,...t};if(!TX(t,$qe)&&TX(t,Pqe))if(t.visualDuration){const n=t.visualDuration,a=2*Math.PI/(n*1.2),r=a*a,i=2*Zl(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:or.mass,stiffness:r,damping:i}}else{const n=Nqe(t);e={...e,...n,mass:or.mass},e.isResolvedFromDuration=!0}return e}function JE(t=or.visualDuration,e=or.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:a,restDelta:r}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:i},{stiffness:l,damping:u,mass:d,duration:p,velocity:m,isResolvedFromDuration:A}=Oqe({...n,velocity:-pc(n.velocity||0)}),g=m||0,h=u/(2*Math.sqrt(l*d)),f=o-i,b=pc(Math.sqrt(l/d)),y=Math.abs(f)<5;a||(a=y?or.restSpeed.granular:or.restSpeed.default),r||(r=y?or.restDelta.granular:or.restDelta.default);let w;if(h<1){const C=Z5(b,h);w=x=>{const _=Math.exp(-h*b*x);return o-_*((g+h*b*f)/C*Math.sin(C*x)+f*Math.cos(C*x))}}else if(h===1)w=C=>o-Math.exp(-b*C)*(f+(g+b*f)*C);else{const C=b*Math.sqrt(h*h-1);w=x=>{const _=Math.exp(-h*b*x),E=Math.min(C*x,300);return o-_*((g+h*b*f)*Math.sinh(E)+C*f*Math.cosh(E))/C}}const k={calculatedDuration:A&&p||null,next:C=>{const x=w(C);if(A)s.done=C>=p;else{let _=C===0?g:0;h<1&&(_=C===0?Vl(g):SX(w,C,x));const E=Math.abs(_)<=a,I=Math.abs(o-x)<=r;s.done=E&&I}return s.value=s.done?o:x,s},toString:()=>{const C=Math.min(W5(k),VE),x=QX(_=>k.next(C*_).value,C,30);return C+"ms "+x},toTransition:()=>{}};return k}JE.applyToOptions=t=>{const e=Fqe(t,100,JE);return t.ease=e.ease,t.duration=Vl(e.duration),t.type="keyframes",t};function V5({keyframes:t,velocity:e=0,power:n=.8,timeConstant:a=325,bounceDamping:r=10,bounceStiffness:i=500,modifyTarget:o,min:s,max:l,restDelta:u=.5,restSpeed:d}){const p=t[0],m={done:!1,value:p},A=E=>s!==void 0&&E<s||l!==void 0&&E>l,g=E=>s===void 0?l:l===void 0||Math.abs(s-E)<Math.abs(l-E)?s:l;let h=n*e;const f=p+h,b=o===void 0?f:o(f);b!==f&&(h=b-p);const y=E=>-h*Math.exp(-E/a),w=E=>b+y(E),k=E=>{const I=y(E),Q=w(E);m.done=Math.abs(I)<=u,m.value=m.done?b:Q};let C,x;const _=E=>{A(m.value)&&(C=E,x=JE({keyframes:[m.value,g(m.value)],velocity:SX(w,E,m.value),damping:r,stiffness:i,restDelta:u,restSpeed:d}))};return _(0),{calculatedDuration:null,next:E=>{let I=!1;return!x&&C===void 0&&(I=!0,k(E),_(E)),C!==void 0&&E>=C?x.next(E-C):(!I&&k(E),m)}}}function jqe(t,e,n){const a=[],r=n||hd.mix||DX,i=t.length-1;for(let o=0;o<i;o++){let s=r(t[o],t[o+1]);if(e){const l=Array.isArray(e)?e[o]||dc:e;s=bw(l,s)}a.push(s)}return a}function Gqe(t,e,{clamp:n=!0,ease:a,mixer:r}={}){const i=t.length;if(qA(i===e.length,"Both input and output ranges must be the same length","range-length"),i===1)return()=>e[0];if(i===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const s=jqe(e,a,r),l=s.length,u=d=>{if(o&&d<t[0])return e[0];let p=0;if(l>1)for(;p<t.length-2&&!(d<t[p+1]);p++);const m=yw(t[p],t[p+1],d);return s[p](m)};return n?d=>u(Zl(t[0],t[i-1],d)):u}function qqe(t,e){const n=t[t.length-1];for(let a=1;a<=e;a++){const r=yw(0,e,a);t.push(ir(n,1,r))}}function zqe(t){const e=[0];return qqe(e,t.length-1),e}function Hqe(t,e){return t.map(n=>n*e)}function Uqe(t,e){return t.map(()=>e||uX).splice(0,t.length-1)}function xw({duration:t=300,keyframes:e,times:n,ease:a="easeInOut"}){const r=rqe(a)?a.map(mX):mX(a),i={done:!1,value:e[0]},o=Hqe(n&&n.length===e.length?n:zqe(e),t),s=Gqe(o,e,{ease:Array.isArray(r)?r:Uqe(e,r)});return{calculatedDuration:t,next:l=>(i.value=s(l),i.done=l>=t,i)}}const Yqe=t=>t!==null;function J5(t,{repeat:e,repeatType:n="loop"},a,r=1){const i=t.filter(Yqe),s=r<0||e&&n!=="loop"&&e%2===1?0:i.length-1;return!s||a===void 0?i[s]:a}const Wqe={decay:V5,inertia:V5,tween:xw,keyframes:xw,spring:JE};function FX(t){typeof t.type=="string"&&(t.type=Wqe[t.type])}class X5{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const Kqe=t=>t/100;class e7 extends X5{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var a,r;const{motionValue:n}=this.options;n&&n.updatedAt!==So.now()&&this.tick(So.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(r=(a=this.options).onStop)==null||r.call(a))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;FX(e);const{type:n=xw,repeat:a=0,repeatDelay:r=0,repeatType:i,velocity:o=0}=e;let{keyframes:s}=e;const l=n||xw;l!==xw&&typeof s[0]!="number"&&(this.mixKeyframes=bw(Kqe,DX(s[0],s[1])),s=[0,100]);const u=l({...e,keyframes:s});i==="mirror"&&(this.mirroredGenerator=l({...e,keyframes:[...s].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=W5(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+r,this.totalDuration=this.resolvedDuration*(a+1)-r,this.generator=u}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:a,totalDuration:r,mixKeyframes:i,mirroredGenerator:o,resolvedDuration:s,calculatedDuration:l}=this;if(this.startTime===null)return a.next(0);const{delay:u=0,keyframes:d,repeat:p,repeatType:m,repeatDelay:A,type:g,onUpdate:h,finalKeyframe:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const b=this.currentTime-u*(this.playbackSpeed>=0?1:-1),y=this.playbackSpeed>=0?b<0:b>r;this.currentTime=Math.max(b,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let w=this.currentTime,k=a;if(p){const E=Math.min(this.currentTime,r)/s;let I=Math.floor(E),Q=E%1;!Q&&E>=1&&(Q=1),Q===1&&I--,I=Math.min(I,p+1),!!(I%2)&&(m==="reverse"?(Q=1-Q,A&&(Q-=A/s)):m==="mirror"&&(k=o)),w=Zl(0,1,Q)*s}const C=y?{done:!1,value:d[0]}:k.next(w);i&&(C.value=i(C.value));let{done:x}=C;!y&&l!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const _=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&x);return _&&g!==V5&&(C.value=J5(d,this.options,f,this.speed)),h&&h(C.value),_&&this.finish(),C}then(e,n){return this.finished.then(e,n)}get duration(){return pc(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+pc(e)}get time(){return pc(this.currentTime)}set time(e){var n;e=Vl(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(So.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=pc(this.currentTime))}play(){var r,i;if(this.isStopped)return;const{driver:e=Tqe,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),(i=(r=this.options).onPlay)==null||i.call(r);const a=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=a):this.holdTime!==null?this.startTime=a-this.holdTime:this.startTime||(this.startTime=n??a),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(So.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(e=this.options).onComplete)==null||n.call(e)}cancel(){var e,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(e=this.options).onCancel)==null||n.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),e.observe(this)}}function Zqe(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const HA=t=>t*180/Math.PI,t7=t=>{const e=HA(Math.atan2(t[1],t[0]));return n7(e)},Vqe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:t7,rotateZ:t7,skewX:t=>HA(Math.atan(t[1])),skewY:t=>HA(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},n7=t=>(t=t%360,t<0&&(t+=360),t),LX=t7,NX=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),MX=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Jqe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:NX,scaleY:MX,scale:t=>(NX(t)+MX(t))/2,rotateX:t=>n7(HA(Math.atan2(t[6],t[5]))),rotateY:t=>n7(HA(Math.atan2(-t[2],t[0]))),rotateZ:LX,rotate:LX,skewX:t=>HA(Math.atan(t[4])),skewY:t=>HA(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function a7(t){return t.includes("scale")?1:0}function r7(t,e){if(!t||t==="none")return a7(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let a,r;if(n)a=Jqe,r=n;else{const s=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);a=Vqe,r=s}if(!r)return a7(e);const i=a[e],o=r[1].split(",").map(eze);return typeof i=="function"?i(o):o[i]}const Xqe=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return r7(n,e)};function eze(t){return parseFloat(t.trim())}const Ff=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Lf=new Set(Ff),RX=t=>t===Sf||t===Vt,tze=new Set(["x","y","z"]),nze=Ff.filter(t=>!tze.has(t));function aze(t){const e=[];return nze.forEach(n=>{const a=t.getValue(n);a!==void 0&&(e.push([n,a.get()]),a.set(n.startsWith("scale")?1:0))}),e}const jp={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>r7(e,"x"),y:(t,{transform:e})=>r7(e,"y")};jp.translateX=jp.x,jp.translateY=jp.y;const UA=new Set;let i7=!1,o7=!1,s7=!1;function PX(){if(o7){const t=Array.from(UA).filter(a=>a.needsMeasurement),e=new Set(t.map(a=>a.element)),n=new Map;e.forEach(a=>{const r=aze(a);r.length&&(n.set(a,r),a.render())}),t.forEach(a=>a.measureInitialState()),e.forEach(a=>{a.render();const r=n.get(a);r&&r.forEach(([i,o])=>{var s;(s=a.getValue(i))==null||s.set(o)})}),t.forEach(a=>a.measureEndState()),t.forEach(a=>{a.suspendedScrollY!==void 0&&window.scrollTo(0,a.suspendedScrollY)})}o7=!1,i7=!1,UA.forEach(t=>t.complete(s7)),UA.clear()}function $X(){UA.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(o7=!0)})}function rze(){s7=!0,$X(),PX(),s7=!1}class c7{constructor(e,n,a,r,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=a,this.motionValue=r,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(UA.add(this),i7||(i7=!0,Ma.read($X),Ma.resolveKeyframes(PX))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:a,motionValue:r}=this;if(e[0]===null){const i=r==null?void 0:r.get(),o=e[e.length-1];if(i!==void 0)e[0]=i;else if(a&&n){const s=a.readValue(n,o);s!=null&&(e[0]=s)}e[0]===void 0&&(e[0]=o),r&&i===void 0&&r.set(e[0])}Zqe(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),UA.delete(this)}cancel(){this.state==="scheduled"&&(UA.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const ize=t=>t.startsWith("--");function oze(t,e,n){ize(e)?t.style.setProperty(e,n):t.style[e]=n}const sze=L5(()=>window.ScrollTimeline!==void 0),cze={};function lze(t,e){const n=L5(t);return()=>cze[e]??n()}const OX=lze(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Ew=([t,e,n,a])=>`cubic-bezier(${t}, ${e}, ${n}, ${a})`,jX={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ew([0,.65,.55,1]),circOut:Ew([.55,0,1,.45]),backIn:Ew([.31,.01,.66,-.59]),backOut:Ew([.33,1.53,.69,.99])};function GX(t,e){if(t)return typeof t=="function"?OX()?QX(t,e):"ease-out":dX(t)?Ew(t):Array.isArray(t)?t.map(n=>GX(n,e)||jX.easeOut):jX[t]}function uze(t,e,n,{delay:a=0,duration:r=300,repeat:i=0,repeatType:o="loop",ease:s="easeOut",times:l}={},u=void 0){const d={[e]:n};l&&(d.offset=l);const p=GX(s,r);Array.isArray(p)&&(d.easing=p);const m={delay:a,duration:r,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"};return u&&(m.pseudoElement=u),t.animate(d,m)}function qX(t){return typeof t=="function"&&"applyToOptions"in t}function dze({type:t,...e}){return qX(t)&&OX()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class pze extends X5{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:n,name:a,keyframes:r,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:s,onComplete:l}=e;this.isPseudoElement=!!i,this.allowFlatten=o,this.options=e,qA(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const u=dze(e);this.animation=uze(n,a,r,u,i),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const d=J5(r,this.options,s,this.speed);this.updateMotionValue?this.updateMotionValue(d):oze(n,a,d),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,n;(n=(e=this.animation).finish)==null||n.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,n;this.isPseudoElement||(n=(e=this.animation).commitStyles)==null||n.call(e)}get duration(){var n,a;const e=((a=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:a.call(n).duration)||0;return pc(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+pc(e)}get time(){return pc(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Vl(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){var a;return this.allowFlatten&&((a=this.animation.effect)==null||a.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&sze()?(this.animation.timeline=e,dc):n(this)}}const zX={anticipate:sX,backInOut:oX,circInOut:lX};function mze(t){return t in zX}function Aze(t){typeof t.ease=="string"&&mze(t.ease)&&(t.ease=zX[t.ease])}const l7=10;class gze extends pze{constructor(e){Aze(e),FX(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:a,onComplete:r,element:i,...o}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const s=new e7({...o,autoplay:!1}),l=Math.max(l7,So.now()-this.startTime),u=Zl(0,l7,l-l7);n.setWithVelocity(s.sample(Math.max(0,l-u)).value,s.sample(l).value,u),s.stop()}}const HX=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Op.test(t)||t==="0")&&!t.startsWith("url("));function hze(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function fze(t,e,n,a){const r=t[0];if(r===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],o=HX(r,e),s=HX(i,e);return fw(o===s,`You are trying to animate ${e} from "${r}" to "${i}". "${o?i:r}" is not an animatable value.`,"value-not-animatable"),!o||!s?!1:hze(t)||(n==="spring"||qX(n))&&a}function u7(t){t.duration=0,t.type="keyframes"}const bze=new Set(["opacity","clipPath","filter","transform"]),yze=L5(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function wze(t){var d;const{motionValue:e,name:n,repeatDelay:a,repeatType:r,damping:i,type:o}=t;if(!(((d=e==null?void 0:e.owner)==null?void 0:d.current)instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:u}=e.owner.getProps();return yze()&&n&&bze.has(n)&&(n!=="transform"||!u)&&!l&&!a&&r!=="mirror"&&i!==0&&o!=="inertia"}const kze=40;class vze extends X5{constructor({autoplay:e=!0,delay:n=0,type:a="keyframes",repeat:r=0,repeatDelay:i=0,repeatType:o="loop",keyframes:s,name:l,motionValue:u,element:d,...p}){var g;super(),this.stop=()=>{var h,f;this._animation&&(this._animation.stop(),(h=this.stopTimeline)==null||h.call(this)),(f=this.keyframeResolver)==null||f.cancel()},this.createdAt=So.now();const m={autoplay:e,delay:n,type:a,repeat:r,repeatDelay:i,repeatType:o,name:l,motionValue:u,element:d,...p},A=(d==null?void 0:d.KeyframeResolver)||c7;this.keyframeResolver=new A(s,(h,f,b)=>this.onKeyframesResolved(h,f,m,!b),l,u,d),(g=this.keyframeResolver)==null||g.scheduleResolve()}onKeyframesResolved(e,n,a,r){var f,b;this.keyframeResolver=void 0;const{name:i,type:o,velocity:s,delay:l,isHandoff:u,onUpdate:d}=a;this.resolvedAt=So.now(),fze(e,i,o,s)||((hd.instantAnimations||!l)&&(d==null||d(J5(e,a,n))),e[0]=e[e.length-1],u7(a),a.repeat=0);const m={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>kze?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...a,keyframes:e},A=!u&&wze(m),g=(b=(f=m.motionValue)==null?void 0:f.owner)==null?void 0:b.current,h=A?new gze({...m,element:g}):new e7(m);h.finished.then(()=>{this.notifyFinished()}).catch(dc),this.pendingTimeline&&(this.stopTimeline=h.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=h}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),rze()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}function UX(t,e,n,a=0,r=1){const i=Array.from(t).sort((u,d)=>u.sortNodePosition(d)).indexOf(e),o=t.size,s=(o-1)*a;return typeof n=="function"?n(i,o):r===1?i*a:s-i*a}const Cze=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function _ze(t){const e=Cze.exec(t);if(!e)return[,];const[,n,a,r]=e;return[`--${n??a}`,r]}const xze=4;function YX(t,e,n=1){qA(n<=xze,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[a,r]=_ze(t);if(!a)return;const i=window.getComputedStyle(e).getPropertyValue(a);if(i){const o=i.trim();return JJ(o)?parseFloat(o):o}return $5(r)?YX(r,e,n+1):r}const Eze={type:"spring",stiffness:500,damping:25,restSpeed:10},Bze=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Ize={type:"keyframes",duration:.8},Dze={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Qze=(t,{keyframes:e})=>e.length>2?Ize:Lf.has(t)?t.startsWith("scale")?Bze(e[1]):Eze:Dze,Sze=t=>t!==null;function Tze(t,{repeat:e,repeatType:n="loop"},a){const r=t.filter(Sze),i=e&&n!=="loop"&&e%2===1?0:r.length-1;return!i||a===void 0?r[i]:a}function d7(t,e){return(t==null?void 0:t[e])??(t==null?void 0:t.default)??t}function Fze({when:t,delay:e,delayChildren:n,staggerChildren:a,staggerDirection:r,repeat:i,repeatType:o,repeatDelay:s,from:l,elapsed:u,...d}){return!!Object.keys(d).length}const p7=(t,e,n,a={},r,i)=>o=>{const s=d7(a,t)||{},l=s.delay||a.delay||0;let{elapsed:u=0}=a;u=u-Vl(l);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...s,delay:-u,onUpdate:m=>{e.set(m),s.onUpdate&&s.onUpdate(m)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:t,motionValue:e,element:i?void 0:r};Fze(s)||Object.assign(d,Qze(t,d)),d.duration&&(d.duration=Vl(d.duration)),d.repeatDelay&&(d.repeatDelay=Vl(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let p=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(u7(d),d.delay===0&&(p=!0)),(hd.instantAnimations||hd.skipAnimations)&&(p=!0,u7(d),d.delay=0),d.allowFlatten=!s.type&&!s.ease,p&&!i&&e.get()!==void 0){const m=Tze(d.keyframes,s);if(m!==void 0){Ma.update(()=>{d.onUpdate(m),d.onComplete()});return}}return s.isSync?new e7(d):new vze(d)};function WX(t){const e=[{},{}];return t==null||t.values.forEach((n,a)=>{e[0][a]=n.get(),e[1][a]=n.getVelocity()}),e}function m7(t,e,n,a){if(typeof e=="function"){const[r,i]=WX(a);e=e(n!==void 0?n:t.custom,r,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[r,i]=WX(a);e=e(n!==void 0?n:t.custom,r,i)}return e}function Nf(t,e,n){const a=t.getProps();return m7(a,e,n!==void 0?n:a.custom,t)}const KX=new Set(["width","height","top","left","right","bottom",...Ff]),ZX=30,Lze=t=>!isNaN(parseFloat(t));class Nze{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=a=>{var i;const r=So.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(a),this.current!==this.prev&&((i=this.events.change)==null||i.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=So.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Lze(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new N5);const a=this.events[e].add(n);return e==="change"?()=>{a(),Ma.read(()=>{this.events.change.getSize()||this.stop()})}:a}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,a){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-a}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=So.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>ZX)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,ZX);return tX(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,n;(e=this.dependents)==null||e.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Mf(t,e){return new Nze(t,e)}const A7=t=>Array.isArray(t);function Mze(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Mf(n))}function Rze(t){return A7(t)?t[t.length-1]||0:t}function Pze(t,e){const n=Nf(t,e);let{transitionEnd:a={},transition:r={},...i}=n||{};i={...i,...a};for(const o in i){const s=Rze(i[o]);Mze(t,o,s)}}const eo=t=>!!(t&&t.getVelocity);function $ze(t){return!!(eo(t)&&t.add)}function g7(t,e){const n=t.getValue("willChange");if($ze(n))return n.add(e);if(!n&&hd.WillChange){const a=new hd.WillChange("auto");t.addValue("willChange",a),a.add(e)}}function h7(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const VX="data-"+h7("framerAppearId");function JX(t){return t.props[VX]}function Oze({protectedKeys:t,needsAnimating:e},n){const a=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,a}function XX(t,e,{delay:n=0,transitionOverride:a,type:r}={}){let{transition:i=t.getDefaultTransition(),transitionEnd:o,...s}=e;a&&(i=a);const l=[],u=r&&t.animationState&&t.animationState.getState()[r];for(const d in s){const p=t.getValue(d,t.latestValues[d]??null),m=s[d];if(m===void 0||u&&Oze(u,d))continue;const A={delay:n,...d7(i||{},d)},g=p.get();if(g!==void 0&&!p.isAnimating&&!Array.isArray(m)&&m===g&&!A.velocity)continue;let h=!1;if(window.MotionHandoffAnimation){const b=JX(t);if(b){const y=window.MotionHandoffAnimation(b,d,Ma);y!==null&&(A.startTime=y,h=!0)}}g7(t,d),p.start(p7(d,p,m,t.shouldReduceMotion&&KX.has(d)?{type:!1}:A,t,h));const f=p.animation;f&&l.push(f)}return o&&Promise.all(l).then(()=>{Ma.update(()=>{o&&Pze(t,o)})}),l}function f7(t,e,n={}){var l;const a=Nf(t,e,n.type==="exit"?(l=t.presenceContext)==null?void 0:l.custom:void 0);let{transition:r=t.getDefaultTransition()||{}}=a||{};n.transitionOverride&&(r=n.transitionOverride);const i=a?()=>Promise.all(XX(t,a,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:m}=r;return jze(t,e,u,d,p,m,n)}:()=>Promise.resolve(),{when:s}=r;if(s){const[u,d]=s==="beforeChildren"?[i,o]:[o,i];return u().then(()=>d())}else return Promise.all([i(),o(n.delay)])}function jze(t,e,n=0,a=0,r=0,i=1,o){const s=[];for(const l of t.variantChildren)l.notify("AnimationStart",e),s.push(f7(l,e,{...o,delay:n+(typeof a=="function"?0:a)+UX(t.variantChildren,l,a,r,i)}).then(()=>l.notify("AnimationComplete",e)));return Promise.all(s)}function Gze(t,e,n={}){t.notify("AnimationStart",e);let a;if(Array.isArray(e)){const r=e.map(i=>f7(t,i,n));a=Promise.all(r)}else if(typeof e=="string")a=f7(t,e,n);else{const r=typeof e=="function"?Nf(t,e,n.custom):e;a=Promise.all(XX(t,r,n))}return a.then(()=>{t.notify("AnimationComplete",e)})}const qze={test:t=>t==="auto",parse:t=>t},eee=t=>e=>e.test(t),tee=[Sf,Vt,Jl,$p,hqe,gqe,qze],nee=t=>tee.find(eee(t));function zze(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||eX(t):!0}const Hze=new Set(["brightness","contrast","saturate","opacity"]);function Uze(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[a]=n.match(O5)||[];if(!a)return t;const r=n.replace(a,"");let i=Hze.has(e)?1:0;return a!==n&&(i*=100),e+"("+i+r+")"}const Yze=/\b([a-z-]*)\(.*?\)/gu,b7={...Op,getAnimatableNone:t=>{const e=t.match(Yze);return e?e.map(Uze).join(" "):t}},aee={...Sf,transform:Math.round},y7={borderWidth:Vt,borderTopWidth:Vt,borderRightWidth:Vt,borderBottomWidth:Vt,borderLeftWidth:Vt,borderRadius:Vt,radius:Vt,borderTopLeftRadius:Vt,borderTopRightRadius:Vt,borderBottomRightRadius:Vt,borderBottomLeftRadius:Vt,width:Vt,maxWidth:Vt,height:Vt,maxHeight:Vt,top:Vt,right:Vt,bottom:Vt,left:Vt,inset:Vt,insetBlock:Vt,insetBlockStart:Vt,insetBlockEnd:Vt,insetInline:Vt,insetInlineStart:Vt,insetInlineEnd:Vt,padding:Vt,paddingTop:Vt,paddingRight:Vt,paddingBottom:Vt,paddingLeft:Vt,paddingBlock:Vt,paddingBlockStart:Vt,paddingBlockEnd:Vt,paddingInline:Vt,paddingInlineStart:Vt,paddingInlineEnd:Vt,margin:Vt,marginTop:Vt,marginRight:Vt,marginBottom:Vt,marginLeft:Vt,marginBlock:Vt,marginBlockStart:Vt,marginBlockEnd:Vt,marginInline:Vt,marginInlineStart:Vt,marginInlineEnd:Vt,backgroundPositionX:Vt,backgroundPositionY:Vt,...{rotate:$p,rotateX:$p,rotateY:$p,rotateZ:$p,scale:KE,scaleX:KE,scaleY:KE,scaleZ:KE,skew:$p,skewX:$p,skewY:$p,distance:Vt,translateX:Vt,translateY:Vt,translateZ:Vt,x:Vt,y:Vt,z:Vt,perspective:Vt,transformPerspective:Vt,opacity:kw,originX:wX,originY:wX,originZ:Vt},zIndex:aee,fillOpacity:kw,strokeOpacity:kw,numOctaves:aee},Wze={...y7,color:Sr,backgroundColor:Sr,outlineColor:Sr,fill:Sr,stroke:Sr,borderColor:Sr,borderTopColor:Sr,borderRightColor:Sr,borderBottomColor:Sr,borderLeftColor:Sr,filter:b7,WebkitFilter:b7},ree=t=>Wze[t];function iee(t,e){let n=ree(t);return n!==b7&&(n=Op),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Kze=new Set(["auto","none","0"]);function Zze(t,e,n){let a=0,r;for(;a<t.length&&!r;){const i=t[a];typeof i=="string"&&!Kze.has(i)&&_w(i).values.length&&(r=t[a]),a++}if(r&&n)for(const i of e)t[i]=iee(n,r)}class Vze extends c7{constructor(e,n,a,r,i){super(e,n,a,r,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:a}=this;if(!n||!n.current)return;super.readKeyframes();for(let d=0;d<e.length;d++){let p=e[d];if(typeof p=="string"&&(p=p.trim(),$5(p))){const m=YX(p,n.current);m!==void 0&&(e[d]=m),d===e.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!KX.has(a)||e.length!==2)return;const[r,i]=e,o=nee(r),s=nee(i),l=bX(r),u=bX(i);if(l!==u&&jp[a]){this.needsMeasurement=!0;return}if(o!==s)if(RX(o)&&RX(s))for(let d=0;d<e.length;d++){const p=e[d];typeof p=="string"&&(e[d]=parseFloat(p))}else jp[a]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,a=[];for(let r=0;r<e.length;r++)(e[r]===null||zze(e[r]))&&a.push(r);a.length&&Zze(e,a,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:a}=this;if(!e||!e.current)return;a==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=jp[a](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const r=n[n.length-1];r!==void 0&&e.getValue(a,r).jump(r,!1)}measureEndState(){var s;const{element:e,name:n,unresolvedKeyframes:a}=this;if(!e||!e.current)return;const r=e.getValue(n);r&&r.jump(this.measuredOrigin,!1);const i=a.length-1,o=a[i];a[i]=jp[n](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(s=this.removedTransforms)!=null&&s.length&&this.removedTransforms.forEach(([l,u])=>{e.getValue(l).set(u)}),this.resolveNoneKeyframes()}}function Jze(t,e,n){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){const r=document.querySelectorAll(t);return r?Array.from(r):[]}return Array.from(t).filter(a=>a!=null)}const oee=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function Xze(t){return XJ(t)&&"offsetHeight"in t}const{schedule:w7,cancel:jgn}=gX(queueMicrotask,!1),Jc={x:!1,y:!1};function see(){return Jc.x||Jc.y}function eHe(t){return t==="x"||t==="y"?Jc[t]?null:(Jc[t]=!0,()=>{Jc[t]=!1}):Jc.x||Jc.y?null:(Jc.x=Jc.y=!0,()=>{Jc.x=Jc.y=!1})}function cee(t,e){const n=Jze(t),a=new AbortController,r={passive:!0,...e,signal:a.signal};return[n,r,()=>a.abort()]}function lee(t){return!(t.pointerType==="touch"||see())}function tHe(t,e,n={}){const[a,r,i]=cee(t,n),o=s=>{if(!lee(s))return;const{target:l}=s,u=e(l,s);if(typeof u!="function"||!l)return;const d=p=>{lee(p)&&(u(p),l.removeEventListener("pointerleave",d))};l.addEventListener("pointerleave",d,r)};return a.forEach(s=>{s.addEventListener("pointerenter",o,r)}),i}const uee=(t,e)=>e?t===e?!0:uee(t,e.parentElement):!1,k7=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,nHe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function dee(t){return nHe.has(t.tagName)||t.isContentEditable===!0}const XE=new WeakSet;function pee(t){return e=>{e.key==="Enter"&&t(e)}}function v7(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const aHe=(t,e)=>{const n=t.currentTarget;if(!n)return;const a=pee(()=>{if(XE.has(n))return;v7(n,"down");const r=pee(()=>{v7(n,"up")}),i=()=>v7(n,"cancel");n.addEventListener("keyup",r,e),n.addEventListener("blur",i,e)});n.addEventListener("keydown",a,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",a),e)};function mee(t){return k7(t)&&!see()}function rHe(t,e,n={}){const[a,r,i]=cee(t,n),o=s=>{const l=s.currentTarget;if(!mee(s))return;XE.add(l);const u=e(l,s),d=(A,g)=>{window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",m),XE.has(l)&&XE.delete(l),mee(A)&&typeof u=="function"&&u(A,{success:g})},p=A=>{d(A,l===window||l===document||n.useGlobalTarget||uee(l,A.target))},m=A=>{d(A,!1)};window.addEventListener("pointerup",p,r),window.addEventListener("pointercancel",m,r)};return a.forEach(s=>{(n.useGlobalTarget?window:s).addEventListener("pointerdown",o,r),Xze(s)&&(s.addEventListener("focus",u=>aHe(u,r)),!dee(s)&&!s.hasAttribute("tabindex")&&(s.tabIndex=0))}),i}function Aee(t){return XJ(t)&&"ownerSVGElement"in t}function iHe(t){return Aee(t)&&t.tagName==="svg"}const oHe=[...tee,Sr,Op],sHe=t=>oHe.find(eee(t)),gee=()=>({translate:0,scale:1,origin:0,originPoint:0}),Rf=()=>({x:gee(),y:gee()}),hee=()=>({min:0,max:0}),Kr=()=>({x:hee(),y:hee()}),C7={current:null},fee={current:!1},cHe=typeof window<"u";function lHe(){if(fee.current=!0,!!cHe)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>C7.current=t.matches;t.addEventListener("change",e),e()}else C7.current=!1}const uHe=new WeakMap;function eB(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Bw(t){return typeof t=="string"||Array.isArray(t)}const _7=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],x7=["initial",..._7];function tB(t){return eB(t.animate)||x7.some(e=>Bw(t[e]))}function bee(t){return!!(tB(t)||t.variants)}function dHe(t,e,n){for(const a in e){const r=e[a],i=n[a];if(eo(r))t.addValue(a,r);else if(eo(i))t.addValue(a,Mf(r,{owner:t}));else if(i!==r)if(t.hasValue(a)){const o=t.getValue(a);o.liveStyle===!0?o.jump(r):o.hasAnimated||o.set(r)}else{const o=t.getStaticValue(a);t.addValue(a,Mf(o!==void 0?o:r,{owner:t}))}}for(const a in n)e[a]===void 0&&t.removeValue(a);return e}const yee=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let nB={};function wee(t){nB=t}function pHe(){return nB}class mHe{scrapeMotionValuesFromProps(e,n,a){return{}}constructor({parent:e,props:n,presenceContext:a,reducedMotionConfig:r,blockInitialAnimation:i,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=c7,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const m=So.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,Ma.render(this.render,!1,!0))};const{latestValues:l,renderState:u}=o;this.latestValues=l,this.baseTarget={...l},this.initialValues=n.initial?{...l}:{},this.renderState=u,this.parent=e,this.props=n,this.presenceContext=a,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.options=s,this.blockInitialAnimation=!!i,this.isControllingVariants=tB(n),this.isVariantNode=bee(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...p}=this.scrapeMotionValuesFromProps(n,{},this);for(const m in p){const A=p[m];l[m]!==void 0&&eo(A)&&A.set(l[m])}}mount(e){var n;this.current=e,uHe.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((a,r)=>this.bindToMotionValue(r,a)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(fee.current||lHe(),this.shouldReduceMotion=C7.current),(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),Pp(this.notifyUpdate),Pp(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const a=this.features[n];a&&(a.unmount(),a.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const a=Lf.has(e);a&&this.onBindTransform&&this.onBindTransform();const r=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&Ma.preRender(this.notifyUpdate),a&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;typeof window<"u"&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{r(),i&&i(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in nB){const n=nB[e];if(!n)continue;const{isEnabled:a,Feature:r}=n;if(!this.features[e]&&r&&a(this.props)&&(this.features[e]=new r(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Kr()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let a=0;a<yee.length;a++){const r=yee[a];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const i="on"+r,o=e[i];o&&(this.propEventSubscriptions[r]=this.on(r,o))}this.prevMotionValues=dHe(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const a=this.values.get(e);n!==a&&(a&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let a=this.values.get(e);return a===void 0&&n!==void 0&&(a=Mf(n===null?void 0:n,{owner:this}),this.addValue(e,a)),a}readValue(e,n){let a=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return a!=null&&(typeof a=="string"&&(JJ(a)||eX(a))?a=parseFloat(a):!sHe(a)&&Op.test(n)&&(a=iee(e,n)),this.setBaseTarget(e,eo(a)?a.get():a)),eo(a)?a.get():a}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var i;const{initial:n}=this.props;let a;if(typeof n=="string"||typeof n=="object"){const o=m7(this.props,n,(i=this.presenceContext)==null?void 0:i.custom);o&&(a=o[e])}if(n&&a!==void 0)return a;const r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!eo(r)?r:this.initialValues[e]!==void 0&&a===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new N5),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){w7.render(this.render)}}class kee extends mHe{constructor(){super(...arguments),this.KeyframeResolver=Vze}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){const a=e.style;return a?a[n]:void 0}removeValueFromRenderState(e,{vars:n,style:a}){delete n[e],delete a[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;eo(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class Gp{constructor(e){this.isMounted=!1,this.node=e}update(){}}function vee({top:t,left:e,right:n,bottom:a}){return{x:{min:e,max:n},y:{min:t,max:a}}}function AHe({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function gHe(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),a=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:a.y,right:a.x}}function E7(t){return t===void 0||t===1}function B7({scale:t,scaleX:e,scaleY:n}){return!E7(t)||!E7(e)||!E7(n)}function YA(t){return B7(t)||Cee(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Cee(t){return _ee(t.x)||_ee(t.y)}function _ee(t){return t&&t!=="0%"}function aB(t,e,n){const a=t-n,r=e*a;return n+r}function xee(t,e,n,a,r){return r!==void 0&&(t=aB(t,r,a)),aB(t,n,a)+e}function I7(t,e=0,n=1,a,r){t.min=xee(t.min,e,n,a,r),t.max=xee(t.max,e,n,a,r)}function Eee(t,{x:e,y:n}){I7(t.x,e.translate,e.scale,e.originPoint),I7(t.y,n.translate,n.scale,n.originPoint)}const Bee=.999999999999,Iee=1.0000000000001;function hHe(t,e,n,a=!1){const r=n.length;if(!r)return;e.x=e.y=1;let i,o;for(let s=0;s<r;s++){i=n[s],o=i.projectionDelta;const{visualElement:l}=i.options;l&&l.props.style&&l.props.style.display==="contents"||(a&&i.options.layoutScroll&&i.scroll&&i!==i.root&&$f(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,Eee(t,o)),a&&YA(i.latestValues)&&$f(t,i.latestValues))}e.x<Iee&&e.x>Bee&&(e.x=1),e.y<Iee&&e.y>Bee&&(e.y=1)}function Pf(t,e){t.min=t.min+e,t.max=t.max+e}function Dee(t,e,n,a,r=.5){const i=ir(t.min,t.max,r);I7(t,e,n,i,a)}function $f(t,e){Dee(t.x,e.x,e.scaleX,e.scale,e.originX),Dee(t.y,e.y,e.scaleY,e.scale,e.originY)}function Qee(t,e){return vee(gHe(t.getBoundingClientRect(),e))}function fHe(t,e,n){const a=Qee(t,n),{scroll:r}=e;return r&&(Pf(a.x,r.offset.x),Pf(a.y,r.offset.y)),a}const bHe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},yHe=Ff.length;function wHe(t,e,n){let a="",r=!0;for(let i=0;i<yHe;i++){const o=Ff[i],s=t[o];if(s===void 0)continue;let l=!0;if(typeof s=="number"?l=s===(o.startsWith("scale")?1:0):l=parseFloat(s)===0,!l||n){const u=oee(s,y7[o]);if(!l){r=!1;const d=bHe[o]||o;a+=`${d}(${u}) `}n&&(e[o]=u)}}return a=a.trim(),n?a=n(e,r?"":a):r&&(a="none"),a}function D7(t,e,n){const{style:a,vars:r,transformOrigin:i}=t;let o=!1,s=!1;for(const l in e){const u=e[l];if(Lf.has(l)){o=!0;continue}else if(fX(l)){r[l]=u;continue}else{const d=oee(u,y7[l]);l.startsWith("origin")?(s=!0,i[l]=d):a[l]=d}}if(e.transform||(o||n?a.transform=wHe(e,t.transform,n):a.transform&&(a.transform="none")),s){const{originX:l="50%",originY:u="50%",originZ:d=0}=i;a.transformOrigin=`${l} ${u} ${d}`}}function See(t,{style:e,vars:n},a,r){const i=t.style;let o;for(o in e)i[o]=e[o];r==null||r.applyProjectionStyles(i,a);for(o in n)i.setProperty(o,n[o])}function Tee(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Iw={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Vt.test(t))t=parseFloat(t);else return t;const n=Tee(t,e.target.x),a=Tee(t,e.target.y);return`${n}% ${a}%`}},kHe={correct:(t,{treeScale:e,projectionDelta:n})=>{const a=t,r=Op.parse(t);if(r.length>5)return a;const i=Op.createTransformer(t),o=typeof r[0]!="number"?1:0,s=n.x.scale*e.x,l=n.y.scale*e.y;r[0+o]/=s,r[1+o]/=l;const u=ir(s,l,.5);return typeof r[2+o]=="number"&&(r[2+o]/=u),typeof r[3+o]=="number"&&(r[3+o]/=u),i(r)}},Q7={borderRadius:{...Iw,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Iw,borderTopRightRadius:Iw,borderBottomLeftRadius:Iw,borderBottomRightRadius:Iw,boxShadow:kHe};function Fee(t,{layout:e,layoutId:n}){return Lf.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Q7[t]||t==="opacity")}function S7(t,e,n){var o;const a=t.style,r=e==null?void 0:e.style,i={};if(!a)return i;for(const s in a)(eo(a[s])||r&&eo(r[s])||Fee(s,t)||((o=n==null?void 0:n.getValue(s))==null?void 0:o.liveStyle)!==void 0)&&(i[s]=a[s]);return i}function vHe(t){return window.getComputedStyle(t)}class CHe extends kee{constructor(){super(...arguments),this.type="html",this.renderInstance=See}readValueFromInstance(e,n){var a;if(Lf.has(n))return(a=this.projection)!=null&&a.isProjecting?a7(n):Xqe(e,n);{const r=vHe(e),i=(fX(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return Qee(e,n)}build(e,n,a){D7(e,n,a.transformTemplate)}scrapeMotionValuesFromProps(e,n,a){return S7(e,n,a)}}const _He={offset:"stroke-dashoffset",array:"stroke-dasharray"},xHe={offset:"strokeDashoffset",array:"strokeDasharray"};function EHe(t,e,n=1,a=0,r=!0){t.pathLength=1;const i=r?_He:xHe;t[i.offset]=`${-a}`,t[i.array]=`${e} ${n}`}const BHe=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Lee(t,{attrX:e,attrY:n,attrScale:a,pathLength:r,pathSpacing:i=1,pathOffset:o=0,...s},l,u,d){if(D7(t,s,u),l){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:p,style:m}=t;p.transform&&(m.transform=p.transform,delete p.transform),(m.transform||p.transformOrigin)&&(m.transformOrigin=p.transformOrigin??"50% 50%",delete p.transformOrigin),m.transform&&(m.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete p.transformBox);for(const A of BHe)p[A]!==void 0&&(m[A]=p[A],delete p[A]);e!==void 0&&(p.x=e),n!==void 0&&(p.y=n),a!==void 0&&(p.scale=a),r!==void 0&&EHe(p,r,i,o,!1)}const Nee=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),Mee=t=>typeof t=="string"&&t.toLowerCase()==="svg";function IHe(t,e,n,a){See(t,e,void 0,a);for(const r in e.attrs)t.setAttribute(Nee.has(r)?r:h7(r),e.attrs[r])}function Ree(t,e,n){const a=S7(t,e,n);for(const r in t)if(eo(t[r])||eo(e[r])){const i=Ff.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;a[i]=t[r]}return a}class DHe extends kee{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Kr}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Lf.has(n)){const a=ree(n);return a&&a.default||0}return n=Nee.has(n)?n:h7(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,a){return Ree(e,n,a)}build(e,n,a){Lee(e,n,this.isSVGTag,a.transformTemplate,a.style)}renderInstance(e,n,a,r){IHe(e,n,a,r)}mount(e){this.isSVGTag=Mee(e.tagName),super.mount(e)}}const QHe=x7.length;function Pee(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?Pee(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<QHe;n++){const a=x7[n],r=t.props[a];(Bw(r)||r===!1)&&(e[a]=r)}return e}function $ee(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let a=0;a<n;a++)if(e[a]!==t[a])return!1;return!0}const SHe=[..._7].reverse(),THe=_7.length;function FHe(t){return e=>Promise.all(e.map(({animation:n,options:a})=>Gze(t,n,a)))}function LHe(t){let e=FHe(t),n=Oee(),a=!0;const r=l=>(u,d)=>{var m;const p=Nf(t,d,l==="exit"?(m=t.presenceContext)==null?void 0:m.custom:void 0);if(p){const{transition:A,transitionEnd:g,...h}=p;u={...u,...h,...g}}return u};function i(l){e=l(t)}function o(l){const{props:u}=t,d=Pee(t.parent)||{},p=[],m=new Set;let A={},g=1/0;for(let f=0;f<THe;f++){const b=SHe[f],y=n[b],w=u[b]!==void 0?u[b]:d[b],k=Bw(w),C=b===l?y.isActive:null;C===!1&&(g=f);let x=w===d[b]&&w!==u[b]&&k;if(x&&a&&t.manuallyAnimateOnMount&&(x=!1),y.protectedKeys={...A},!y.isActive&&C===null||!w&&!y.prevProp||eB(w)||typeof w=="boolean")continue;const _=NHe(y.prevProp,w);let E=_||b===l&&y.isActive&&!x&&k||f>g&&k,I=!1;const Q=Array.isArray(w)?w:[w];let D=Q.reduce(r(b),{});C===!1&&(D={});const{prevResolvedValues:T={}}=y,N={...T,...D},B=L=>{E=!0,m.has(L)&&(I=!0,m.delete(L)),y.needsAnimating[L]=!0;const F=t.getValue(L);F&&(F.liveStyle=!1)};for(const L in N){const F=D[L],R=T[L];if(A.hasOwnProperty(L))continue;let P=!1;A7(F)&&A7(R)?P=!$ee(F,R):P=F!==R,P?F!=null?B(L):m.add(L):F!==void 0&&m.has(L)?B(L):y.protectedKeys[L]=!0}y.prevProp=w,y.prevResolvedValues=D,y.isActive&&(A={...A,...D}),a&&t.blockInitialAnimation&&(E=!1);const S=x&&_;E&&(!S||I)&&p.push(...Q.map(L=>{const F={type:b};if(typeof L=="string"&&a&&!S&&t.manuallyAnimateOnMount&&t.parent){const{parent:R}=t,P=Nf(R,L);if(R.enteringChildren&&P){const{delayChildren:$}=P.transition||{};F.delay=UX(R.enteringChildren,t,$)}}return{animation:L,options:F}}))}if(m.size){const f={};if(typeof u.initial!="boolean"){const b=Nf(t,Array.isArray(u.initial)?u.initial[0]:u.initial);b&&b.transition&&(f.transition=b.transition)}m.forEach(b=>{const y=t.getBaseTarget(b),w=t.getValue(b);w&&(w.liveStyle=!0),f[b]=y??null}),p.push({animation:f})}let h=!!p.length;return a&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(h=!1),a=!1,h?e(p):Promise.resolve()}function s(l,u){var p;if(n[l].isActive===u)return Promise.resolve();(p=t.variantChildren)==null||p.forEach(m=>{var A;return(A=m.animationState)==null?void 0:A.setActive(l,u)}),n[l].isActive=u;const d=o(l);for(const m in n)n[m].protectedKeys={};return d}return{animateChanges:o,setActive:s,setAnimateFunction:i,getState:()=>n,reset:()=>{n=Oee()}}}function NHe(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!$ee(e,t):!1}function WA(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Oee(){return{animate:WA(!0),whileInView:WA(),whileHover:WA(),whileTap:WA(),whileDrag:WA(),whileFocus:WA(),exit:WA()}}function jee(t,e){t.min=e.min,t.max=e.max}function Xc(t,e){jee(t.x,e.x),jee(t.y,e.y)}function Gee(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const qee=1e-4,MHe=1-qee,RHe=1+qee,zee=.01,PHe=0-zee,$He=0+zee;function To(t){return t.max-t.min}function OHe(t,e,n){return Math.abs(t-e)<=n}function Hee(t,e,n,a=.5){t.origin=a,t.originPoint=ir(e.min,e.max,t.origin),t.scale=To(n)/To(e),t.translate=ir(n.min,n.max,t.origin)-t.originPoint,(t.scale>=MHe&&t.scale<=RHe||isNaN(t.scale))&&(t.scale=1),(t.translate>=PHe&&t.translate<=$He||isNaN(t.translate))&&(t.translate=0)}function Dw(t,e,n,a){Hee(t.x,e.x,n.x,a?a.originX:void 0),Hee(t.y,e.y,n.y,a?a.originY:void 0)}function Uee(t,e,n){t.min=n.min+e.min,t.max=t.min+To(e)}function jHe(t,e,n){Uee(t.x,e.x,n.x),Uee(t.y,e.y,n.y)}function Yee(t,e,n){t.min=e.min-n.min,t.max=t.min+To(e)}function rB(t,e,n){Yee(t.x,e.x,n.x),Yee(t.y,e.y,n.y)}function Wee(t,e,n,a,r){return t-=e,t=aB(t,1/n,a),r!==void 0&&(t=aB(t,1/r,a)),t}function GHe(t,e=0,n=1,a=.5,r,i=t,o=t){if(Jl.test(e)&&(e=parseFloat(e),e=ir(o.min,o.max,e/100)-o.min),typeof e!="number")return;let s=ir(i.min,i.max,a);t===i&&(s-=e),t.min=Wee(t.min,e,n,s,r),t.max=Wee(t.max,e,n,s,r)}function Kee(t,e,[n,a,r],i,o){GHe(t,e[n],e[a],e[r],e.scale,i,o)}const qHe=["x","scaleX","originX"],zHe=["y","scaleY","originY"];function Zee(t,e,n,a){Kee(t.x,e,qHe,n?n.x:void 0,a?a.x:void 0),Kee(t.y,e,zHe,n?n.y:void 0,a?a.y:void 0)}function Vee(t){return t.translate===0&&t.scale===1}function Jee(t){return Vee(t.x)&&Vee(t.y)}function Xee(t,e){return t.min===e.min&&t.max===e.max}function HHe(t,e){return Xee(t.x,e.x)&&Xee(t.y,e.y)}function ete(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function tte(t,e){return ete(t.x,e.x)&&ete(t.y,e.y)}function nte(t){return To(t.x)/To(t.y)}function ate(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function mc(t){return[t("x"),t("y")]}function UHe(t,e,n){let a="";const r=t.x.translate/e.x,i=t.y.translate/e.y,o=(n==null?void 0:n.z)||0;if((r||i||o)&&(a=`translate3d(${r}px, ${i}px, ${o}px) `),(e.x!==1||e.y!==1)&&(a+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:p,rotateY:m,skewX:A,skewY:g}=n;u&&(a=`perspective(${u}px) ${a}`),d&&(a+=`rotate(${d}deg) `),p&&(a+=`rotateX(${p}deg) `),m&&(a+=`rotateY(${m}deg) `),A&&(a+=`skewX(${A}deg) `),g&&(a+=`skewY(${g}deg) `)}const s=t.x.scale*e.x,l=t.y.scale*e.y;return(s!==1||l!==1)&&(a+=`scale(${s}, ${l})`),a||"none"}const rte=["TopLeft","TopRight","BottomLeft","BottomRight"],YHe=rte.length,ite=t=>typeof t=="string"?parseFloat(t):t,ote=t=>typeof t=="number"||Vt.test(t);function WHe(t,e,n,a,r,i){r?(t.opacity=ir(0,n.opacity??1,KHe(a)),t.opacityExit=ir(e.opacity??1,0,ZHe(a))):i&&(t.opacity=ir(e.opacity??1,n.opacity??1,a));for(let o=0;o<YHe;o++){const s=`border${rte[o]}Radius`;let l=ste(e,s),u=ste(n,s);if(l===void 0&&u===void 0)continue;l||(l=0),u||(u=0),l===0||u===0||ote(l)===ote(u)?(t[s]=Math.max(ir(ite(l),ite(u),a),0),(Jl.test(u)||Jl.test(l))&&(t[s]+="%")):t[s]=u}(e.rotate||n.rotate)&&(t.rotate=ir(e.rotate||0,n.rotate||0,a))}function ste(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const KHe=cte(0,.5,cX),ZHe=cte(.5,.95,dc);function cte(t,e,n){return a=>a<t?0:a>e?1:n(yw(t,e,a))}function VHe(t,e,n){const a=eo(t)?t:Mf(t);return a.start(p7("",a,e,n)),a.animation}function Qw(t,e,n,a={passive:!0}){return t.addEventListener(e,n,a),()=>t.removeEventListener(e,n)}const JHe=(t,e)=>t.depth-e.depth;class XHe{constructor(){this.children=[],this.isDirty=!1}add(e){S5(this.children,e),this.isDirty=!0}remove(e){T5(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(JHe),this.isDirty=!1,this.children.forEach(e)}}function eUe(t,e){const n=So.now(),a=({timestamp:r})=>{const i=r-n;i>=e&&(Pp(a),t(i-e))};return Ma.setup(a,!0),()=>Pp(a)}function iB(t){return eo(t)?t.get():t}class tUe{constructor(){this.members=[]}add(e){S5(this.members,e),e.scheduleRender()}remove(e){if(T5(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(r=>e===r);if(n===0)return!1;let a;for(let r=n;r>=0;r--){const i=this.members[r];if(i.isPresent!==!1){a=i;break}}return a?(this.promote(a),!0):!1}promote(e,n){const a=this.lead;if(e!==a&&(this.prevLead=a,this.lead=e,e.show(),a)){a.instance&&a.scheduleRender(),e.scheduleRender(),e.resumeFrom=a,n&&(e.resumeFrom.preserveOpacity=!0),a.snapshot&&(e.snapshot=a.snapshot,e.snapshot.latestValues=a.animationValues||a.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:r}=e.options;r===!1&&a.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:a}=e;n.onExitComplete&&n.onExitComplete(),a&&a.options.onExitComplete&&a.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const oB={hasAnimatedSinceResize:!0,hasEverUpdated:!1},T7=["","X","Y","Z"],nUe=1e3;let aUe=0;function F7(t,e,n,a){const{latestValues:r}=e;r[t]&&(n[t]=r[t],e.setStaticValue(t,0),a&&(a[t]=0))}function lte(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=JX(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Ma,!(r||i))}const{parent:a}=t;a&&!a.hasCheckedOptimisedAppear&<e(a)}function ute({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:a,resetTransform:r}){return class{constructor(o={},s=e==null?void 0:e()){this.id=aUe++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(oUe),this.nodes.forEach(uUe),this.nodes.forEach(dUe),this.nodes.forEach(sUe)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new XHe)}addEventListener(o,s){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new N5),this.eventHandlers.get(o).add(s)}notifyListeners(o,...s){const l=this.eventHandlers.get(o);l&&l.notify(...s)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=Aee(o)&&!iHe(o),this.instance=o;const{layoutId:s,layout:l,visualElement:u}=this.options;if(u&&!u.current&&u.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||s)&&(this.isLayoutDirty=!0),t){let d,p=0;const m=()=>this.root.updateBlockedByResize=!1;Ma.read(()=>{p=window.innerWidth}),t(o,()=>{const A=window.innerWidth;A!==p&&(p=A,this.root.updateBlockedByResize=!0,d&&d(),d=eUe(m,250),oB.hasAnimatedSinceResize&&(oB.hasAnimatedSinceResize=!1,this.nodes.forEach(mte)))})}s&&this.root.registerSharedNode(s,this),this.options.animate!==!1&&u&&(s||l)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:p,hasRelativeLayoutChanged:m,layout:A})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||u.getDefaultTransition()||hUe,{onLayoutAnimationStart:h,onLayoutAnimationComplete:f}=u.getProps(),b=!this.targetLayout||!tte(this.targetLayout,A),y=!p&&m;if(this.options.layoutRoot||this.resumeFrom||y||p&&(b||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const w={...d7(g,"layout"),onPlay:h,onComplete:f};(u.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w),this.setAnimationOrigin(d,y)}else p||mte(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=A})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Pp(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(pUe),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&<e(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const p=this.path[d];p.shouldResetTransform=!0,p.updateScroll("snapshot"),p.options.layoutRoot&&p.willUpdate(!1)}const{layoutId:s,layout:l}=this.options;if(s===void 0&&!l)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(dte);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(pte);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(lUe),this.nodes.forEach(rUe),this.nodes.forEach(iUe)):this.nodes.forEach(pte),this.clearAllSnapshots();const s=So.now();Ti.delta=Zl(0,1e3/60,s-Ti.timestamp),Ti.timestamp=s,Ti.isProcessing=!0,P5.update.process(Ti),P5.preRender.process(Ti),P5.render.process(Ti),Ti.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,w7.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(cUe),this.sharedNodes.forEach(mUe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ma.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ma.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!To(this.snapshot.measuredBox.x)&&!To(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Kr(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:s}=this.options;s&&s.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let s=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(s=!1),s&&this.instance){const l=a(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!r)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,s=this.projectionDelta&&!Jee(this.projectionDelta),l=this.getTransformTemplate(),u=l?l(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&this.instance&&(s||YA(this.latestValues)||d)&&(r(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const s=this.measurePageBox();let l=this.removeElementScroll(s);return o&&(l=this.removeTransform(l)),fUe(l),{animationId:this.root.animationId,measuredBox:s,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:o}=this.options;if(!o)return Kr();const s=o.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(bUe))){const{scroll:d}=this.root;d&&(Pf(s.x,d.offset.x),Pf(s.y,d.offset.y))}return s}removeElementScroll(o){var l;const s=Kr();if(Xc(s,o),(l=this.scroll)!=null&&l.wasRoot)return s;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:p,options:m}=d;d!==this.root&&p&&m.layoutScroll&&(p.wasRoot&&Xc(s,o),Pf(s.x,p.offset.x),Pf(s.y,p.offset.y))}return s}applyTransform(o,s=!1){const l=Kr();Xc(l,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];!s&&d.options.layoutScroll&&d.scroll&&d!==d.root&&$f(l,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),YA(d.latestValues)&&$f(l,d.latestValues)}return YA(this.latestValues)&&$f(l,this.latestValues),l}removeTransform(o){const s=Kr();Xc(s,o);for(let l=0;l<this.path.length;l++){const u=this.path[l];if(!u.instance||!YA(u.latestValues))continue;B7(u.latestValues)&&u.updateSnapshot();const d=Kr(),p=u.measurePageBox();Xc(d,p),Zee(s,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return YA(this.latestValues)&&Zee(s,this.latestValues),s}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ti.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var A;const s=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=s.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=s.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=s.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==s;if(!(o||l&&this.isSharedProjectionDirty||this.isProjectionDirty||(A=this.parent)!=null&&A.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:p}=this.options;if(!this.layout||!(d||p))return;this.resolvedRelativeTargetAt=Ti.timestamp;const m=this.getClosestProjectingParent();m&&this.linkedParentVersion!==m.layoutVersion&&!m.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(m&&m.layout?this.createRelativeTarget(m,this.layout.layoutBox,m.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Kr(),this.targetWithTransforms=Kr()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),jHe(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Xc(this.target,this.layout.layoutBox),Eee(this.target,this.targetDelta)):Xc(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,m&&!!m.resumingFrom==!!this.resumingFrom&&!m.options.layoutScroll&&m.target&&this.animationProgress!==1?this.createRelativeTarget(m,this.target,m.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||B7(this.parent.latestValues)||Cee(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,s,l){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Kr(),this.relativeTargetOrigin=Kr(),rB(this.relativeTargetOrigin,s,l),Xc(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var g;const o=this.getLead(),s=!!this.resumingFrom||this!==o;let l=!0;if((this.isProjectionDirty||(g=this.parent)!=null&&g.isProjectionDirty)&&(l=!1),s&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===Ti.timestamp&&(l=!1),l)return;const{layout:u,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||d))return;Xc(this.layoutCorrected,this.layout.layoutBox);const p=this.treeScale.x,m=this.treeScale.y;hHe(this.layoutCorrected,this.treeScale,this.path,s),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=Kr());const{target:A}=o;if(!A){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Gee(this.prevProjectionDelta.x,this.projectionDelta.x),Gee(this.prevProjectionDelta.y,this.projectionDelta.y)),Dw(this.projectionDelta,this.layoutCorrected,A,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==m||!ate(this.projectionDelta.x,this.prevProjectionDelta.x)||!ate(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",A))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var s;if((s=this.options.visualElement)==null||s.scheduleRender(),o){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Rf(),this.projectionDelta=Rf(),this.projectionDeltaWithTransform=Rf()}setAnimationOrigin(o,s=!1){const l=this.snapshot,u=l?l.latestValues:{},d={...this.latestValues},p=Rf();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!s;const m=Kr(),A=l?l.source:void 0,g=this.layout?this.layout.source:void 0,h=A!==g,f=this.getStack(),b=!f||f.members.length<=1,y=!!(h&&!b&&this.options.crossfade===!0&&!this.path.some(gUe));this.animationProgress=0;let w;this.mixTargetDelta=k=>{const C=k/1e3;Ate(p.x,o.x,C),Ate(p.y,o.y,C),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(rB(m,this.layout.layoutBox,this.relativeParent.layout.layoutBox),AUe(this.relativeTarget,this.relativeTargetOrigin,m,C),w&&HHe(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=Kr()),Xc(w,this.relativeTarget)),h&&(this.animationValues=d,WHe(d,u,this.latestValues,C,y,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=C},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var s,l,u;this.notifyListeners("animationStart"),(s=this.currentAnimation)==null||s.stop(),(u=(l=this.resumingFrom)==null?void 0:l.currentAnimation)==null||u.stop(),this.pendingAnimation&&(Pp(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ma.update(()=>{oB.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Mf(0)),this.currentAnimation=VHe(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),o.onUpdate&&o.onUpdate(d)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(nUe),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:s,target:l,layout:u,latestValues:d}=o;if(!(!s||!l||!u)){if(this!==o&&this.layout&&u&&yte(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||Kr();const p=To(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+p;const m=To(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+m}Xc(s,l),$f(s,d),Dw(this.projectionDeltaWithTransform,this.layoutCorrected,s,d)}}registerSharedNode(o,s){this.sharedNodes.has(o)||this.sharedNodes.set(o,new tUe),this.sharedNodes.get(o).add(s);const u=s.options.initialPromotionConfig;s.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(s):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var s;const{layoutId:o}=this.options;return o?((s=this.getStack())==null?void 0:s.lead)||this:this}getPrevLead(){var s;const{layoutId:o}=this.options;return o?(s=this.getStack())==null?void 0:s.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:s,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),s&&this.setOptions({transition:s})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let s=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(s=!0),!s)return;const u={};l.z&&F7("z",o,u,this.animationValues);for(let d=0;d<T7.length;d++)F7(`rotate${T7[d]}`,o,u,this.animationValues),F7(`skew${T7[d]}`,o,u,this.animationValues);o.render();for(const d in u)o.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);o.scheduleRender()}applyProjectionStyles(o,s){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=iB(s==null?void 0:s.pointerEvents)||"",o.transform=l?l(this.latestValues,""):"none";return}const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=iB(s==null?void 0:s.pointerEvents)||""),this.hasProjected&&!YA(this.latestValues)&&(o.transform=l?l({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let p=UHe(this.projectionDeltaWithTransform,this.treeScale,d);l&&(p=l(d,p)),o.transform=p;const{x:m,y:A}=this.projectionDelta;o.transformOrigin=`${m.origin*100}% ${A.origin*100}% 0`,u.animationValues?o.opacity=u===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:o.opacity=u===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const g in Q7){if(d[g]===void 0)continue;const{correct:h,applyTo:f,isCSSVariable:b}=Q7[g],y=p==="none"?d[g]:h(d[g],u);if(f){const w=f.length;for(let k=0;k<w;k++)o[f[k]]=y}else b?this.options.visualElement.renderState.vars[g]=y:o[g]=y}this.options.layoutId&&(o.pointerEvents=u===this?iB(s==null?void 0:s.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var s;return(s=o.currentAnimation)==null?void 0:s.stop()}),this.root.nodes.forEach(dte),this.root.sharedNodes.clear()}}}function rUe(t){t.updateLayout()}function iUe(t){var n;const e=((n=t.resumeFrom)==null?void 0:n.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:a,measuredBox:r}=t.layout,{animationType:i}=t.options,o=e.source!==t.layout.source;i==="size"?mc(p=>{const m=o?e.measuredBox[p]:e.layoutBox[p],A=To(m);m.min=a[p].min,m.max=m.min+A}):yte(i,e.layoutBox,a)&&mc(p=>{const m=o?e.measuredBox[p]:e.layoutBox[p],A=To(a[p]);m.max=m.min+A,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[p].max=t.relativeTarget[p].min+A)});const s=Rf();Dw(s,a,e.layoutBox);const l=Rf();o?Dw(l,t.applyTransform(r,!0),e.measuredBox):Dw(l,a,e.layoutBox);const u=!Jee(s);let d=!1;if(!t.resumeFrom){const p=t.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:m,layout:A}=p;if(m&&A){const g=Kr();rB(g,e.layoutBox,m.layoutBox);const h=Kr();rB(h,a,A.layoutBox),tte(g,h)||(d=!0),p.options.layoutRoot&&(t.relativeTarget=h,t.relativeTargetOrigin=g,t.relativeParent=p)}}}t.notifyListeners("didUpdate",{layout:a,snapshot:e,delta:l,layoutDelta:s,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(t.isLead()){const{onExitComplete:a}=t.options;a&&a()}t.options.transition=void 0}function oUe(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function sUe(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function cUe(t){t.clearSnapshot()}function dte(t){t.clearMeasurements()}function pte(t){t.isLayoutDirty=!1}function lUe(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function mte(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function uUe(t){t.resolveTargetDelta()}function dUe(t){t.calcProjection()}function pUe(t){t.resetSkewAndRotation()}function mUe(t){t.removeLeadSnapshot()}function Ate(t,e,n){t.translate=ir(e.translate,0,n),t.scale=ir(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function gte(t,e,n,a){t.min=ir(e.min,n.min,a),t.max=ir(e.max,n.max,a)}function AUe(t,e,n,a){gte(t.x,e.x,n.x,a),gte(t.y,e.y,n.y,a)}function gUe(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const hUe={duration:.45,ease:[.4,0,.1,1]},hte=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),fte=hte("applewebkit/")&&!hte("chrome/")?Math.round:dc;function bte(t){t.min=fte(t.min),t.max=fte(t.max)}function fUe(t){bte(t.x),bte(t.y)}function yte(t,e,n){return t==="position"||t==="preserve-aspect"&&!OHe(nte(e),nte(n),.2)}function bUe(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const yUe=ute({attachResizeListener:(t,e)=>Qw(t,"resize",e),measureScroll:()=>{var t,e;return{x:document.documentElement.scrollLeft||((t=document.body)==null?void 0:t.scrollLeft)||0,y:document.documentElement.scrollTop||((e=document.body)==null?void 0:e.scrollTop)||0}},checkIsScrollRoot:()=>!0}),L7={current:void 0},wte=ute({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!L7.current){const t=new yUe({});t.mount(window),t.setOptions({layoutScroll:!0}),L7.current=t}return L7.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),kte=be.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function wUe(t=!0){const e=be.useContext(Q5);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:a,register:r}=e,i=be.useId();be.useEffect(()=>{if(t)return r(i)},[t]);const o=be.useCallback(()=>t&&a&&a(i),[i,a,t]);return!n&&a?[!1,o]:[!0]}const vte=be.createContext({strict:!1}),Cte={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let _te=!1;function kUe(){if(_te)return;const t={};for(const e in Cte)t[e]={isEnabled:n=>Cte[e].some(a=>!!n[a])};wee(t),_te=!0}function xte(){return kUe(),pHe()}function vUe(t){const e=xte();for(const n in t)e[n]={...e[n],...t[n]};wee(e)}const CUe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function sB(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||CUe.has(t)}let Ete=t=>!sB(t);function _Ue(t){typeof t=="function"&&(Ete=e=>e.startsWith("on")?!sB(e):t(e))}try{_Ue(require("@emotion/is-prop-valid").default)}catch{}function xUe(t,e,n){const a={};for(const r in t)r==="values"&&typeof t.values=="object"||(Ete(r)||n===!0&&sB(r)||!e&&!sB(r)||t.draggable&&r.startsWith("onDrag"))&&(a[r]=t[r]);return a}const cB=be.createContext({});function EUe(t,e){if(tB(t)){const{initial:n,animate:a}=t;return{initial:n===!1||Bw(n)?n:void 0,animate:Bw(a)?a:void 0}}return t.inherit!==!1?e:{}}function BUe(t){const{initial:e,animate:n}=EUe(t,be.useContext(cB));return be.useMemo(()=>({initial:e,animate:n}),[Bte(e),Bte(n)])}function Bte(t){return Array.isArray(t)?t.join(" "):t}const N7=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Ite(t,e,n){for(const a in e)!eo(e[a])&&!Fee(a,n)&&(t[a]=e[a])}function IUe({transformTemplate:t},e){return be.useMemo(()=>{const n=N7();return D7(n,e,t),Object.assign({},n.vars,n.style)},[e])}function DUe(t,e){const n=t.style||{},a={};return Ite(a,n,t),Object.assign(a,IUe(t,e)),a}function QUe(t,e){const n={},a=DUe(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=a,n}const Dte=()=>({...N7(),attrs:{}});function SUe(t,e,n,a){const r=be.useMemo(()=>{const i=Dte();return Lee(i,e,Mee(a),t.transformTemplate,t.style),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};Ite(i,t.style,t),r.style={...i,...r.style}}return r}const TUe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function M7(t){return typeof t!="string"||t.includes("-")?!1:!!(TUe.indexOf(t)>-1||/[A-Z]/u.test(t))}function FUe(t,e,n,{latestValues:a},r,i=!1,o){const l=(o??M7(t)?SUe:QUe)(e,a,r,t),u=xUe(e,typeof t=="string",i),d=t!==be.Fragment?{...u,...l,ref:n}:{},{children:p}=e,m=be.useMemo(()=>eo(p)?p.get():p,[p]);return be.createElement(t,{...d,children:m})}function LUe({scrapeMotionValuesFromProps:t,createRenderState:e},n,a,r){return{latestValues:NUe(n,a,r,t),renderState:e()}}function NUe(t,e,n,a){const r={},i=a(t,{});for(const m in i)r[m]=iB(i[m]);let{initial:o,animate:s}=t;const l=tB(t),u=bee(t);e&&u&&!l&&t.inherit!==!1&&(o===void 0&&(o=e.initial),s===void 0&&(s=e.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const p=d?s:o;if(p&&typeof p!="boolean"&&!eB(p)){const m=Array.isArray(p)?p:[p];for(let A=0;A<m.length;A++){const g=m7(t,m[A]);if(g){const{transitionEnd:h,transition:f,...b}=g;for(const y in b){let w=b[y];if(Array.isArray(w)){const k=d?w.length-1:0;w=w[k]}w!==null&&(r[y]=w)}for(const y in h)r[y]=h[y]}}}return r}const Qte=t=>(e,n)=>{const a=be.useContext(cB),r=be.useContext(Q5),i=()=>LUe(t,e,a,r);return n?i():ZGe(i)},MUe=Qte({scrapeMotionValuesFromProps:S7,createRenderState:N7}),RUe=Qte({scrapeMotionValuesFromProps:Ree,createRenderState:Dte}),PUe=Symbol.for("motionComponentSymbol");function $Ue(t,e,n){const a=be.useRef(n);be.useInsertionEffect(()=>{a.current=n});const r=be.useRef(null);return be.useCallback(i=>{var s;i&&((s=t.onMount)==null||s.call(t,i)),e&&(i?e.mount(i):e.unmount());const o=a.current;if(typeof o=="function")if(i){const l=o(i);typeof l=="function"&&(r.current=l)}else r.current?(r.current(),r.current=null):o(i);else o&&(o.current=i)},[e])}const Ste=be.createContext({});function Sw(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function OUe(t,e,n,a,r,i){var f,b;const{visualElement:o}=be.useContext(cB),s=be.useContext(vte),l=be.useContext(Q5),u=be.useContext(kte).reducedMotion,d=be.useRef(null);a=a||s.renderer,!d.current&&a&&(d.current=a(t,{visualState:e,parent:o,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u,isSVG:i}));const p=d.current,m=be.useContext(Ste);p&&!p.projection&&r&&(p.type==="html"||p.type==="svg")&&jUe(d.current,n,r,m);const A=be.useRef(!1);be.useInsertionEffect(()=>{p&&A.current&&p.update(n,l)});const g=n[VX],h=be.useRef(!!g&&!((f=window.MotionHandoffIsComplete)!=null&&f.call(window,g))&&((b=window.MotionHasOptimisedAnimation)==null?void 0:b.call(window,g)));return VGe(()=>{p&&(A.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),p.scheduleRenderMicrotask(),h.current&&p.animationState&&p.animationState.animateChanges())}),be.useEffect(()=>{p&&(!h.current&&p.animationState&&p.animationState.animateChanges(),h.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)==null||y.call(window,g)}),h.current=!1),p.enteringChildren=void 0)}),p}function jUe(t,e,n,a){const{layoutId:r,layout:i,drag:o,dragConstraints:s,layoutScroll:l,layoutRoot:u,layoutCrossfade:d}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Tte(t.parent)),t.projection.setOptions({layoutId:r,layout:i,alwaysMeasureLayout:!!o||s&&Sw(s),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:a,crossfade:d,layoutScroll:l,layoutRoot:u})}function Tte(t){if(t)return t.options.allowProjection!==!1?t.projection:Tte(t.parent)}function R7(t,{forwardMotionProps:e=!1,type:n}={},a,r){a&&vUe(a);const i=n?n==="svg":M7(t),o=i?RUe:MUe;function s(u,d){let p;const m={...be.useContext(kte),...u,layoutId:GUe(u)},{isStatic:A}=m,g=BUe(u),h=o(u,A);if(!A&&ZJ){qUe();const f=zUe(m);p=f.MeasureLayout,g.visualElement=OUe(t,h,m,r,f.ProjectionNode,i)}return H.jsxs(cB.Provider,{value:g,children:[p&&g.visualElement?H.jsx(p,{visualElement:g.visualElement,...m}):null,FUe(t,u,$Ue(h,g.visualElement,d),h,A,e,i)]})}s.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const l=be.forwardRef(s);return l[PUe]=t,l}function GUe({layoutId:t}){const e=be.useContext(KJ).id;return e&&t!==void 0?e+"-"+t:t}function qUe(t,e){be.useContext(vte).strict}function zUe(t){const e=xte(),{drag:n,layout:a}=e;if(!n&&!a)return{};const r={...n,...a};return{MeasureLayout:n!=null&&n.isEnabled(t)||a!=null&&a.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function HUe(t,e){if(typeof Proxy>"u")return R7;const n=new Map,a=(i,o)=>R7(i,o,t,e),r=(i,o)=>a(i,o);return new Proxy(r,{get:(i,o)=>o==="create"?a:(n.has(o)||n.set(o,R7(o,void 0,t,e)),n.get(o))})}const UUe=(t,e)=>e.isSVG??M7(t)?new DHe(e):new CHe(e,{allowProjection:t!==be.Fragment});class YUe extends Gp{constructor(e){super(e),e.animationState||(e.animationState=LHe(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();eB(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let WUe=0;class KUe extends Gp{constructor(){super(...arguments),this.id=WUe++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:a}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===a)return;const r=this.node.animationState.setActive("exit",!e);n&&!e&&r.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const ZUe={animation:{Feature:YUe},exit:{Feature:KUe}};function Tw(t){return{point:{x:t.pageX,y:t.pageY}}}const VUe=t=>e=>k7(e)&&t(e,Tw(e));function Fw(t,e,n,a){return Qw(t,e,VUe(n),a)}const Fte=({current:t})=>t?t.ownerDocument.defaultView:null,Lte=(t,e)=>Math.abs(t-e);function JUe(t,e){const n=Lte(t.x,e.x),a=Lte(t.y,e.y);return Math.sqrt(n**2+a**2)}const Nte=new Set(["auto","scroll"]);class Mte{constructor(e,n,{transformPagePoint:a,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:o=3,element:s}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=A=>{this.handleScroll(A.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const A=$7(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,h=JUe(A.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!h)return;const{point:f}=A,{timestamp:b}=Ti;this.history.push({...f,timestamp:b});const{onStart:y,onMove:w}=this.handlers;g||(y&&y(this.lastMoveEvent,A),this.startEvent=this.lastMoveEvent),w&&w(this.lastMoveEvent,A)},this.handlePointerMove=(A,g)=>{this.lastMoveEvent=A,this.lastMoveEventInfo=P7(g,this.transformPagePoint),Ma.update(this.updatePoint,!0)},this.handlePointerUp=(A,g)=>{this.end();const{onEnd:h,onSessionEnd:f,resumeAnimation:b}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=$7(A.type==="pointercancel"?this.lastMoveEventInfo:P7(g,this.transformPagePoint),this.history);this.startEvent&&h&&h(A,y),f&&f(A,y)},!k7(e))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=a,this.distanceThreshold=o,this.contextWindow=r||window;const l=Tw(e),u=P7(l,this.transformPagePoint),{point:d}=u,{timestamp:p}=Ti;this.history=[{...d,timestamp:p}];const{onSessionStart:m}=n;m&&m(e,$7(u,this.history)),this.removeListeners=bw(Fw(this.contextWindow,"pointermove",this.handlePointerMove),Fw(this.contextWindow,"pointerup",this.handlePointerUp),Fw(this.contextWindow,"pointercancel",this.handlePointerUp)),s&&this.startScrollTracking(s)}startScrollTracking(e){let n=e.parentElement;for(;n;){const a=getComputedStyle(n);(Nte.has(a.overflowX)||Nte.has(a.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const n=this.scrollPositions.get(e);if(!n)return;const a=e===window,r=a?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-n.x,y:r.y-n.y};i.x===0&&i.y===0||(a?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),Ma.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Pp(this.updatePoint)}}function P7(t,e){return e?{point:e(t.point)}:t}function Rte(t,e){return{x:t.x-e.x,y:t.y-e.y}}function $7({point:t},e){return{point:t,delta:Rte(t,Pte(e)),offset:Rte(t,XUe(e)),velocity:eYe(e,.1)}}function XUe(t){return t[0]}function Pte(t){return t[t.length-1]}function eYe(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,a=null;const r=Pte(t);for(;n>=0&&(a=t[n],!(r.timestamp-a.timestamp>Vl(e)));)n--;if(!a)return{x:0,y:0};const i=pc(r.timestamp-a.timestamp);if(i===0)return{x:0,y:0};const o={x:(r.x-a.x)/i,y:(r.y-a.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function tYe(t,{min:e,max:n},a){return e!==void 0&&t<e?t=a?ir(e,t,a.min):Math.max(t,e):n!==void 0&&t>n&&(t=a?ir(n,t,a.max):Math.min(t,n)),t}function $te(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function nYe(t,{top:e,left:n,bottom:a,right:r}){return{x:$te(t.x,n,r),y:$te(t.y,e,a)}}function Ote(t,e){let n=e.min-t.min,a=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,a]=[a,n]),{min:n,max:a}}function aYe(t,e){return{x:Ote(t.x,e.x),y:Ote(t.y,e.y)}}function rYe(t,e){let n=.5;const a=To(t),r=To(e);return r>a?n=yw(e.min,e.max-a,t.min):a>r&&(n=yw(t.min,t.max-r,e.min)),Zl(0,1,n)}function iYe(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const O7=.35;function oYe(t=O7){return t===!1?t=0:t===!0&&(t=O7),{x:jte(t,"left","right"),y:jte(t,"top","bottom")}}function jte(t,e,n){return{min:Gte(t,e),max:Gte(t,n)}}function Gte(t,e){return typeof t=="number"?t:t[e]||0}const sYe=new WeakMap;class cYe{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Kr(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:a}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=p=>{n?(this.stopAnimation(),this.snapToCursor(Tw(p).point)):this.pauseAnimation()},o=(p,m)=>{this.stopAnimation();const{drag:A,dragPropagation:g,onDragStart:h}=this.getProps();if(A&&!g&&(this.openDragLock&&this.openDragLock(),this.openDragLock=eHe(A),!this.openDragLock))return;this.latestPointerEvent=p,this.latestPanInfo=m,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),mc(b=>{let y=this.getAxisMotionValue(b).get()||0;if(Jl.test(y)){const{projection:w}=this.visualElement;if(w&&w.layout){const k=w.layout.layoutBox[b];k&&(y=To(k)*(parseFloat(y)/100))}}this.originPoint[b]=y}),h&&Ma.postRender(()=>h(p,m)),g7(this.visualElement,"transform");const{animationState:f}=this.visualElement;f&&f.setActive("whileDrag",!0)},s=(p,m)=>{this.latestPointerEvent=p,this.latestPanInfo=m;const{dragPropagation:A,dragDirectionLock:g,onDirectionLock:h,onDrag:f}=this.getProps();if(!A&&!this.openDragLock)return;const{offset:b}=m;if(g&&this.currentDirection===null){this.currentDirection=lYe(b),this.currentDirection!==null&&h&&h(this.currentDirection);return}this.updateAxis("x",m.point,b),this.updateAxis("y",m.point,b),this.visualElement.render(),f&&f(p,m)},l=(p,m)=>{this.latestPointerEvent=p,this.latestPanInfo=m,this.stop(p,m),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>mc(p=>{var m;return this.getAnimationState(p)==="paused"&&((m=this.getAxisMotionValue(p).animation)==null?void 0:m.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new Mte(e,{onSessionStart:i,onStart:o,onMove:s,onSessionEnd:l,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:a,contextWindow:Fte(this.visualElement),element:this.visualElement.current})}stop(e,n){const a=e||this.latestPointerEvent,r=n||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!a)return;const{velocity:o}=r;this.startAnimation(o);const{onDragEnd:s}=this.getProps();s&&Ma.postRender(()=>s(a,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:a}=this.getProps();!a&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,n,a){const{drag:r}=this.getProps();if(!a||!lB(e,r,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+a[e];this.constraints&&this.constraints[e]&&(o=tYe(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){var i;const{dragConstraints:e,dragElastic:n}=this.getProps(),a=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(i=this.visualElement.projection)==null?void 0:i.layout,r=this.constraints;e&&Sw(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&a?this.constraints=nYe(a.layoutBox,e):this.constraints=!1,this.elastic=oYe(n),r!==this.constraints&&a&&this.constraints&&!this.hasMutatedConstraints&&mc(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=iYe(a.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Sw(e))return!1;const a=e.current;qA(a!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const i=fHe(a,r.root,this.visualElement.getTransformPagePoint());let o=aYe(r.layout.layoutBox,i);if(n){const s=n(AHe(o));this.hasMutatedConstraints=!!s,s&&(o=vee(s))}return o}startAnimation(e){const{drag:n,dragMomentum:a,dragElastic:r,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:s}=this.getProps(),l=this.constraints||{},u=mc(d=>{if(!lB(d,n,this.currentDirection))return;let p=l&&l[d]||{};o&&(p={min:0,max:0});const m=r?200:1e6,A=r?40:1e7,g={type:"inertia",velocity:a?e[d]:0,bounceStiffness:m,bounceDamping:A,timeConstant:750,restDelta:1,restSpeed:10,...i,...p};return this.startAxisValueAnimation(d,g)});return Promise.all(u).then(s)}startAxisValueAnimation(e,n){const a=this.getAxisMotionValue(e);return g7(this.visualElement,e),a.start(p7(e,a,0,n,this.visualElement,!1))}stopAnimation(){mc(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){mc(e=>{var n;return(n=this.getAxisMotionValue(e).animation)==null?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)==null?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,a=this.visualElement.getProps(),r=a[n];return r||this.visualElement.getValue(e,(a.initial?a.initial[e]:void 0)||0)}snapToCursor(e){mc(n=>{const{drag:a}=this.getProps();if(!lB(n,a,this.currentDirection))return;const{projection:r}=this.visualElement,i=this.getAxisMotionValue(n);if(r&&r.layout){const{min:o,max:s}=r.layout.layoutBox[n],l=i.get()||0;i.set(e[n]-ir(o,s,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:a}=this.visualElement;if(!Sw(n)||!a||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};mc(o=>{const s=this.getAxisMotionValue(o);if(s&&this.constraints!==!1){const l=s.get();r[o]=rYe({min:l,max:l},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",a.root&&a.root.updateScroll(),a.updateLayout(),this.resolveConstraints(),mc(o=>{if(!lB(o,e,null))return;const s=this.getAxisMotionValue(o),{min:l,max:u}=this.constraints[o];s.set(ir(l,u,r[o]))})}addListeners(){if(!this.visualElement.current)return;sYe.set(this.visualElement,this);const e=this.visualElement.current,n=Fw(e,"pointerdown",l=>{const{drag:u,dragListener:d=!0}=this.getProps(),p=l.target,m=p!==e&&dee(p);u&&d&&!m&&this.start(l)}),a=()=>{const{dragConstraints:l}=this.getProps();Sw(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,i=r.addEventListener("measure",a);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),Ma.read(a);const o=Qw(window,"resize",()=>this.scalePositionWithinConstraints()),s=r.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(mc(d=>{const p=this.getAxisMotionValue(d);p&&(this.originPoint[d]+=l[d].translate,p.set(p.get()+l[d].translate))}),this.visualElement.render())});return()=>{o(),n(),i(),s&&s()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:a=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:o=O7,dragMomentum:s=!0}=e;return{...e,drag:n,dragDirectionLock:a,dragPropagation:r,dragConstraints:i,dragElastic:o,dragMomentum:s}}}function lB(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function lYe(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class uYe extends Gp{constructor(e){super(e),this.removeGroupControls=dc,this.removeListeners=dc,this.controls=new cYe(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||dc}update(){const{dragControls:e}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.endPanSession()}}const qte=t=>(e,n)=>{t&&Ma.postRender(()=>t(e,n))};class dYe extends Gp{constructor(){super(...arguments),this.removePointerDownListener=dc}onPointerDown(e){this.session=new Mte(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Fte(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:a,onPanEnd:r}=this.node.getProps();return{onSessionStart:qte(e),onStart:qte(n),onMove:a,onEnd:(i,o)=>{delete this.session,r&&Ma.postRender(()=>r(i,o))}}}mount(){this.removePointerDownListener=Fw(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let j7=!1;class pYe extends be.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:a,layoutId:r}=this.props,{projection:i}=e;i&&(n.group&&n.group.add(i),a&&a.register&&r&&a.register(i),j7&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),oB.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:a,drag:r,isPresent:i}=this.props,{projection:o}=a;return o&&(o.isPresent=i,j7=!0,r||e.layoutDependency!==n||n===void 0||e.isPresent!==i?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||Ma.postRender(()=>{const s=o.getStack();(!s||!s.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),w7.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:a}=this.props,{projection:r}=e;j7=!0,r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),a&&a.deregister&&a.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function zte(t){const[e,n]=wUe(),a=be.useContext(KJ);return H.jsx(pYe,{...t,layoutGroup:a,switchLayoutGroup:be.useContext(Ste),isPresent:e,safeToRemove:n})}const mYe={pan:{Feature:dYe},drag:{Feature:uYe,ProjectionNode:wte,MeasureLayout:zte}};function Hte(t,e,n){const{props:a}=t;t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,i=a[r];i&&Ma.postRender(()=>i(e,Tw(e)))}class AYe extends Gp{mount(){const{current:e}=this.node;e&&(this.unmount=tHe(e,(n,a)=>(Hte(this.node,a,"Start"),r=>Hte(this.node,r,"End"))))}unmount(){}}class gYe extends Gp{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=bw(Qw(this.node.current,"focus",()=>this.onFocus()),Qw(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Ute(t,e,n){const{props:a}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&a.whileTap&&t.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),i=a[r];i&&Ma.postRender(()=>i(e,Tw(e)))}class hYe extends Gp{mount(){const{current:e}=this.node;e&&(this.unmount=rHe(e,(n,a)=>(Ute(this.node,a,"Start"),(r,{success:i})=>Ute(this.node,r,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const G7=new WeakMap,q7=new WeakMap,fYe=t=>{const e=G7.get(t.target);e&&e(t)},bYe=t=>{t.forEach(fYe)};function yYe({root:t,...e}){const n=t||document;q7.has(n)||q7.set(n,{});const a=q7.get(n),r=JSON.stringify(e);return a[r]||(a[r]=new IntersectionObserver(bYe,{root:t,...e})),a[r]}function wYe(t,e,n){const a=yYe(e);return G7.set(t,n),a.observe(t),()=>{G7.delete(t),a.unobserve(t)}}const kYe={some:0,all:1};class vYe extends Gp{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:a,amount:r="some",once:i}=e,o={root:n?n.current:void 0,rootMargin:a,threshold:typeof r=="number"?r:kYe[r]},s=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:p}=this.node.getProps(),m=u?d:p;m&&m(l)};return wYe(this.node.current,o,s)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(CYe(e,n))&&this.startObserver()}unmount(){}}function CYe({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const _Ye={...ZUe,...{inView:{Feature:vYe},tap:{Feature:hYe},focus:{Feature:gYe},hover:{Feature:AYe}},...mYe,...{layout:{ProjectionNode:wte,MeasureLayout:zte}}},xYe=HUe(_Ye,UUe),EYe=({children:t,as:e="p",className:n,duration:a=2,spread:r=2})=>{const i=xYe.create(e),o=be.useMemo(()=>((t==null?void 0:t.length)??0)*r,[t,r]);return H.jsx(i,{animate:{backgroundPosition:"0% center"},className:Tn("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent","[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",n),initial:{backgroundPosition:"100% center"},style:{"--spread":`${o}px`,backgroundImage:"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"},transition:{repeat:Number.POSITIVE_INFINITY,duration:a,ease:"linear"},children:t})},BYe=be.memo(EYe),Yte=be.createContext(null),IYe=()=>{const t=be.useContext(Yte);if(!t)throw new Error("Reasoning components must be used within Reasoning");return t},DYe=1e3,QYe=1e3,Wte=be.memo(({className:t,isStreaming:e=!1,open:n,defaultOpen:a=!0,onOpenChange:r,duration:i,children:o,...s})=>{const[l,u]=sf({prop:n,defaultProp:a,onChange:r}),[d,p]=sf({prop:i,defaultProp:void 0}),[m,A]=be.useState(!1),[g,h]=be.useState(null);be.useEffect(()=>{e?g===null&&h(Date.now()):g!==null&&(p(Math.ceil((Date.now()-g)/QYe)),h(null))},[e,g,p]),be.useEffect(()=>{if(a&&!e&&l&&!m){const b=setTimeout(()=>{u(!1),A(!0)},DYe);return()=>clearTimeout(b)}},[e,l,a,u,m]);const f=b=>{u(b)};return H.jsx(Yte.Provider,{value:{isStreaming:e,isOpen:l,setIsOpen:u,duration:d},children:H.jsx(B5,{className:Tn("not-prose mb-4",t),onOpenChange:f,open:l,...s,children:o})})}),SYe=(t,e)=>t||e===0?H.jsx(BYe,{duration:1,children:"Thinking..."}):e===void 0?H.jsx("p",{children:"Thought for a few seconds"}):H.jsxs("p",{children:["Thought for ",e," seconds"]}),Kte=be.memo(({className:t,children:e,getThinkingMessage:n=SYe,...a})=>{const{isStreaming:r,isOpen:i,duration:o}=IYe();return H.jsx(I5,{className:Tn("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",t),...a,children:e??H.jsxs(H.Fragment,{children:[H.jsx(UQe,{className:"size-4"}),n(r,o),H.jsx(n9,{className:Tn("size-4 transition-transform",i?"rotate-180":"rotate-0")})]})})}),Zte=be.memo(({className:t,children:e,...n})=>H.jsx(D5,{className:Tn("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",t),...n,children:H.jsx(v5,{...n,children:e})}));Wte.displayName="Reasoning",Kte.displayName="ReasoningTrigger",Zte.displayName="ReasoningContent";const TYe=({className:t,...e})=>H.jsx(B5,{className:Tn("not-prose mb-4 text-primary text-xs",t),...e}),FYe=({className:t,count:e,children:n,...a})=>H.jsx(I5,{className:Tn("flex items-center gap-2",t),...a,children:n??H.jsxs(H.Fragment,{children:[H.jsxs("p",{className:"font-medium",children:["Used ",e," sources"]}),H.jsx(n9,{className:"h-4 w-4"})]})}),LYe=({className:t,...e})=>H.jsx(D5,{className:Tn("mt-3 flex w-fit flex-col gap-2","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",t),...e}),NYe=({href:t,title:e,children:n,...a})=>H.jsx("a",{className:"flex items-center gap-2",href:t,rel:"noreferrer",target:"_blank",...a,children:n??H.jsxs(H.Fragment,{children:[H.jsx(HQe,{className:"h-4 w-4"}),H.jsx("span",{className:"block font-medium",children:e})]})}),MYe=kx("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function RYe({className:t,variant:e,asChild:n=!1,...a}){const r=n?gH:"span";return H.jsx(r,{"data-slot":"badge",className:Tn(MYe({variant:e}),t),...a})}let Tr=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function PYe(t){return z7(t)}function z7(t){return Array.isArray(t)?$Ye(t):t instanceof RegExp?t:typeof t=="object"?OYe(t):t}function $Ye(t){let e=[];for(let n=0,a=t.length;n<a;n++)e[n]=z7(t[n]);return e}function OYe(t){let e={};for(let n in t)e[n]=z7(t[n]);return e}function Vte(t,...e){return e.forEach(n=>{for(let a in n)t[a]=n[a]}),t}function Jte(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?Jte(t.substring(0,t.length-1)):t.substr(~e+1)}var H7=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,uB=class{static hasCaptures(t){return t===null?!1:(H7.lastIndex=0,H7.test(t))}static replaceCaptures(t,e,n){return t.replace(H7,(a,r,i,o)=>{let s=n[parseInt(r||i,10)];if(s){let l=e.substring(s.start,s.end);for(;l[0]===".";)l=l.substring(1);switch(o){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return a})}};function Xte(t,e){return t<e?-1:t>e?1:0}function ene(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,a=e.length;if(n===a){for(let r=0;r<n;r++){let i=Xte(t[r],e[r]);if(i!==0)return i}return 0}return n-a}function tne(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function nne(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var ane=class{constructor(t){We(this,"cache",new Map);this.fn=t}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},dB=class{constructor(e,n,a){We(this,"_cachedMatchRoot",new ane(e=>this._root.match(e)));this._colorMap=e,this._defaults=n,this._root=a}static createFromRawTheme(e,n){return this.createFromParsedTheme(qYe(e),n)}static createFromParsedTheme(e,n){return HYe(e,n)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const n=e.scopeName,r=this._cachedMatchRoot.get(n).find(i=>jYe(e.parent,i.parentScopes));return r?new rne(r.fontStyle,r.foreground,r.background):null}},U7=class NQ{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const a of n)e=new NQ(e,a);return e}static from(...e){let n=null;for(let a=0;a<e.length;a++)n=new NQ(n,e[a]);return n}push(e){return new NQ(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let a=this;for(;a&&a!==e;)n.push(a.scopeName),a=a.parent;return a===e?n.reverse():void 0}};function jYe(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let a=e[n],r=!1;if(a===">"){if(n===e.length-1)return!1;a=e[++n],r=!0}for(;t&&!GYe(t.scopeName,a);){if(r)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function GYe(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var rne=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function qYe(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],a=0;for(let r=0,i=e.length;r<i;r++){let o=e[r];if(!o.settings)continue;let s;if(typeof o.scope=="string"){let p=o.scope;p=p.replace(/^[,]+/,""),p=p.replace(/[,]+$/,""),s=p.split(",")}else Array.isArray(o.scope)?s=o.scope:s=[""];let l=-1;if(typeof o.settings.fontStyle=="string"){l=0;let p=o.settings.fontStyle.split(" ");for(let m=0,A=p.length;m<A;m++)switch(p[m]){case"italic":l=l|1;break;case"bold":l=l|2;break;case"underline":l=l|4;break;case"strikethrough":l=l|8;break}}let u=null;typeof o.settings.foreground=="string"&&tne(o.settings.foreground)&&(u=o.settings.foreground);let d=null;typeof o.settings.background=="string"&&tne(o.settings.background)&&(d=o.settings.background);for(let p=0,m=s.length;p<m;p++){let g=s[p].trim().split(" "),h=g[g.length-1],f=null;g.length>1&&(f=g.slice(0,g.length-1),f.reverse()),n[a++]=new zYe(h,f,r,l,u,d)}}return n}var zYe=class{constructor(t,e,n,a,r,i){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=a,this.foreground=r,this.background=i}},to=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(to||{});function HYe(t,e){t.sort((l,u)=>{let d=Xte(l.scope,u.scope);return d!==0||(d=ene(l.parentScopes,u.parentScopes),d!==0)?d:l.index-u.index});let n=0,a="#000000",r="#ffffff";for(;t.length>=1&&t[0].scope==="";){let l=t.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(a=l.foreground),l.background!==null&&(r=l.background)}let i=new UYe(e),o=new rne(n,i.getId(a),i.getId(r)),s=new WYe(new Y7(0,null,-1,0,0),[]);for(let l=0,u=t.length;l<u;l++){let d=t[l];s.insert(0,d.scope,d.parentScopes,d.fontStyle,i.getId(d.foreground),i.getId(d.background))}return new dB(i,o,s)}var UYe=class{constructor(t){We(this,"_isFrozen");We(this,"_lastColorId");We(this,"_id2color");We(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},YYe=Object.freeze([]),Y7=class u8e{constructor(e,n,a,r,i){We(this,"scopeDepth");We(this,"parentScopes");We(this,"fontStyle");We(this,"foreground");We(this,"background");this.scopeDepth=e,this.parentScopes=n||YYe,this.fontStyle=a,this.foreground=r,this.background=i}clone(){return new u8e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let a=0,r=e.length;a<r;a++)n[a]=e[a].clone();return n}acceptOverwrite(e,n,a,r){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),a!==0&&(this.foreground=a),r!==0&&(this.background=r)}},WYe=class oH{constructor(e,n=[],a={}){We(this,"_rulesWithParentScopes");this._mainRule=e,this._children=a,this._rulesWithParentScopes=n}static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let a=0,r=0;for(;e.parentScopes[a]===">"&&a++,n.parentScopes[r]===">"&&r++,!(a>=e.parentScopes.length||r>=n.parentScopes.length);){const i=n.parentScopes[r].length-e.parentScopes[a].length;if(i!==0)return i;a++,r++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let a=e.indexOf("."),r,i;if(a===-1?(r=e,i=""):(r=e.substring(0,a),i=e.substring(a+1)),this._children.hasOwnProperty(r))return this._children[r].match(i)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(oH._cmpBySpecificity),n}insert(e,n,a,r,i,o){if(n===""){this._doInsertHere(e,a,r,i,o);return}let s=n.indexOf("."),l,u;s===-1?(l=n,u=""):(l=n.substring(0,s),u=n.substring(s+1));let d;this._children.hasOwnProperty(l)?d=this._children[l]:(d=new oH(this._mainRule.clone(),Y7.cloneArr(this._rulesWithParentScopes)),this._children[l]=d),d.insert(e+1,u,a,r,i,o)}_doInsertHere(e,n,a,r,i){if(n===null){this._mainRule.acceptOverwrite(e,a,r,i);return}for(let o=0,s=this._rulesWithParentScopes.length;o<s;o++){let l=this._rulesWithParentScopes[o];if(ene(l.parentScopes,n)===0){l.acceptOverwrite(e,a,r,i);return}}a===-1&&(a=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Y7(e,n,a,r,i))}},Of=class Uc{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=Uc.getLanguageId(e),a=Uc.getTokenType(e),r=Uc.getFontStyle(e),i=Uc.getForeground(e),o=Uc.getBackground(e);console.log({languageId:n,tokenType:a,fontStyle:r,foreground:i,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,a,r,i,o,s){let l=Uc.getLanguageId(e),u=Uc.getTokenType(e),d=Uc.containsBalancedBrackets(e)?1:0,p=Uc.getFontStyle(e),m=Uc.getForeground(e),A=Uc.getBackground(e);return n!==0&&(l=n),a!==8&&(u=a),r!==null&&(d=r?1:0),i!==-1&&(p=i),o!==0&&(m=o),s!==0&&(A=s),(l<<0|u<<8|d<<10|p<<11|m<<15|A<<24)>>>0}};function zgn(t){return t}function Hgn(t){return t}function pB(t,e){const n=[],a=KYe(t);let r=a.next();for(;r!==null;){let l=0;if(r.length===2&&r.charAt(1)===":"){switch(r.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=a.next()}let u=o();if(n.push({matcher:u,priority:l}),r!==",")break;r=a.next()}return n;function i(){if(r==="-"){r=a.next();const l=i();return u=>!!l&&!l(u)}if(r==="("){r=a.next();const l=s();return r===")"&&(r=a.next()),l}if(ine(r)){const l=[];do l.push(r),r=a.next();while(ine(r));return u=>e(l,u)}return null}function o(){const l=[];let u=i();for(;u;)l.push(u),u=i();return d=>l.every(p=>p(d))}function s(){const l=[];let u=o();for(;u&&(l.push(u),r==="|"||r===",");){do r=a.next();while(r==="|"||r===",");u=o()}return d=>l.some(p=>p(d))}}function ine(t){return!!t&&!!t.match(/[\w\.:]+/)}function KYe(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const a=n[0];return n=e.exec(t),a}}}function one(t){typeof t.dispose=="function"&&t.dispose()}var Lw=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},ZYe=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},VYe=class{constructor(){We(this,"_references",[]);We(this,"_seenReferenceKeys",new Set);We(this,"visitedRule",new Set)}get references(){return this._references}add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},JYe=class{constructor(t,e){We(this,"seenFullScopeRequests",new Set);We(this,"seenPartialScopeRequests",new Set);We(this,"Q");this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Lw(this.initialScopeName)]}processQueue(){const t=this.Q;this.Q=[];const e=new VYe;for(const n of t)XYe(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof Lw){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function XYe(t,e,n,a){const r=n.lookup(t.scopeName);if(!r){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const i=n.lookup(e);t instanceof Lw?mB({baseGrammar:i,selfGrammar:r},a):W7(t.ruleName,{baseGrammar:i,selfGrammar:r,repository:r.repository},a);const o=n.injections(t.scopeName);if(o)for(const s of o)a.add(new Lw(s))}function W7(t,e,n){if(e.repository&&e.repository[t]){const a=e.repository[t];AB([a],e,n)}}function mB(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&AB(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&AB(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function AB(t,e,n){for(const a of t){if(n.visitedRule.has(a))continue;n.visitedRule.add(a);const r=a.repository?Vte({},e.repository,a.repository):e.repository;Array.isArray(a.patterns)&&AB(a.patterns,{...e,repository:r},n);const i=a.include;if(!i)continue;const o=sne(i);switch(o.kind){case 0:mB({...e,selfGrammar:e.baseGrammar},n);break;case 1:mB(e,n);break;case 2:W7(o.ruleName,{...e,repository:r},n);break;case 3:case 4:const s=o.scopeName===e.selfGrammar.scopeName?e.selfGrammar:o.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(s){const l={baseGrammar:e.baseGrammar,selfGrammar:s,repository:r};o.kind===4?W7(o.ruleName,l,n):mB(l,n)}else o.kind===4?n.add(new ZYe(o.scopeName,o.ruleName)):n.add(new Lw(o.scopeName));break}}}var eWe=class{constructor(){We(this,"kind",0)}},tWe=class{constructor(){We(this,"kind",1)}},nWe=class{constructor(t){We(this,"kind",2);this.ruleName=t}},aWe=class{constructor(t){We(this,"kind",3);this.scopeName=t}},rWe=class{constructor(t,e){We(this,"kind",4);this.scopeName=t,this.ruleName=e}};function sne(t){if(t==="$base")return new eWe;if(t==="$self")return new tWe;const e=t.indexOf("#");if(e===-1)return new aWe(t);if(e===0)return new nWe(t.substring(1));{const n=t.substring(0,e),a=t.substring(e+1);return new rWe(n,a)}}var iWe=/\\(\d+)/,cne=/\\(\d+)/g,oWe=-1,lne=-2;function Ugn(t){return t}function Ygn(t){return t}var Nw=class{constructor(e,n,a,r){We(this,"$location");We(this,"id");We(this,"_nameIsCapturing");We(this,"_name");We(this,"_contentNameIsCapturing");We(this,"_contentName");this.$location=e,this.id=n,this._name=a||null,this._nameIsCapturing=uB.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=uB.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${Jte(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,n){return!this._nameIsCapturing||this._name===null||e===null||n===null?this._name:uB.replaceCaptures(this._name,e,n)}getContentName(e,n){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:uB.replaceCaptures(this._contentName,e,n)}},sWe=class extends Nw{constructor(e,n,a,r,i){super(e,n,a,r);We(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,n){throw new Error("Not supported!")}compile(e,n){throw new Error("Not supported!")}compileAG(e,n,a,r){throw new Error("Not supported!")}},cWe=class extends Nw{constructor(e,n,a,r,i){super(e,n,a,null);We(this,"_match");We(this,"captures");We(this,"_cachedCompiledPatterns");this._match=new Mw(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,n){n.push(this._match)}compile(e,n){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,n,a,r){return this._getCachedCompiledPatterns(e).compileAG(e,a,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Rw,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},une=class extends Nw{constructor(e,n,a,r,i){super(e,n,a,r);We(this,"hasMissingPatterns");We(this,"patterns");We(this,"_cachedCompiledPatterns");this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,n){for(const a of this.patterns)e.getRule(a).collectPatterns(e,n)}compile(e,n){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,n,a,r){return this._getCachedCompiledPatterns(e).compileAG(e,a,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Rw,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},K7=class extends Nw{constructor(e,n,a,r,i,o,s,l,u,d){super(e,n,a,r);We(this,"_begin");We(this,"beginCaptures");We(this,"_end");We(this,"endHasBackReferences");We(this,"endCaptures");We(this,"applyEndPatternLast");We(this,"hasMissingPatterns");We(this,"patterns");We(this,"_cachedCompiledPatterns");this._begin=new Mw(i,this.id),this.beginCaptures=o,this._end=new Mw(s||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=l,this.applyEndPatternLast=u||!1,this.patterns=d.patterns,this.hasMissingPatterns=d.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,n){return this._end.resolveBackReferences(e,n)}collectPatterns(e,n){n.push(this._begin)}compile(e,n){return this._getCachedCompiledPatterns(e,n).compile(e)}compileAG(e,n,a,r){return this._getCachedCompiledPatterns(e,n).compileAG(e,a,r)}_getCachedCompiledPatterns(e,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Rw;for(const a of this.patterns)e.getRule(a).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,n):this._cachedCompiledPatterns.setSource(0,n)),this._cachedCompiledPatterns}},gB=class extends Nw{constructor(e,n,a,r,i,o,s,l,u){super(e,n,a,r);We(this,"_begin");We(this,"beginCaptures");We(this,"whileCaptures");We(this,"_while");We(this,"whileHasBackReferences");We(this,"hasMissingPatterns");We(this,"patterns");We(this,"_cachedCompiledPatterns");We(this,"_cachedCompiledWhilePatterns");this._begin=new Mw(i,this.id),this.beginCaptures=o,this.whileCaptures=l,this._while=new Mw(s,lne),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,n){return this._while.resolveBackReferences(e,n)}collectPatterns(e,n){n.push(this._begin)}compile(e,n){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,n,a,r){return this._getCachedCompiledPatterns(e).compileAG(e,a,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Rw;for(const n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,n){return this._getCachedCompiledWhilePatterns(e,n).compile(e)}compileWhileAG(e,n,a,r){return this._getCachedCompiledWhilePatterns(e,n).compileAG(e,a,r)}_getCachedCompiledWhilePatterns(e,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Rw,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},dne=class _o{static createCaptureRule(e,n,a,r,i){return e.registerRule(o=>new sWe(n,o,a,r,i))}static getCompiledRuleId(e,n,a){return e.id||n.registerRule(r=>{if(e.id=r,e.match)return new cWe(e.$vscodeTextmateLocation,e.id,e.name,e.match,_o._compileCaptures(e.captures,n,a));if(typeof e.begin>"u"){e.repository&&(a=Vte({},a,e.repository));let i=e.patterns;return typeof i>"u"&&e.include&&(i=[{include:e.include}]),new une(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,_o._compilePatterns(i,n,a))}return e.while?new gB(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,_o._compileCaptures(e.beginCaptures||e.captures,n,a),e.while,_o._compileCaptures(e.whileCaptures||e.captures,n,a),_o._compilePatterns(e.patterns,n,a)):new K7(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,_o._compileCaptures(e.beginCaptures||e.captures,n,a),e.end,_o._compileCaptures(e.endCaptures||e.captures,n,a),e.applyEndPatternLast,_o._compilePatterns(e.patterns,n,a))}),e.id}static _compileCaptures(e,n,a){let r=[];if(e){let i=0;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const s=parseInt(o,10);s>i&&(i=s)}for(let o=0;o<=i;o++)r[o]=null;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const s=parseInt(o,10);let l=0;e[o].patterns&&(l=_o.getCompiledRuleId(e[o],n,a)),r[s]=_o.createCaptureRule(n,e[o].$vscodeTextmateLocation,e[o].name,e[o].contentName,l)}}return r}static _compilePatterns(e,n,a){let r=[];if(e)for(let i=0,o=e.length;i<o;i++){const s=e[i];let l=-1;if(s.include){const u=sne(s.include);switch(u.kind){case 0:case 1:l=_o.getCompiledRuleId(a[s.include],n,a);break;case 2:let d=a[u.ruleName];d&&(l=_o.getCompiledRuleId(d,n,a));break;case 3:case 4:const p=u.scopeName,m=u.kind===4?u.ruleName:null,A=n.getExternalGrammar(p,a);if(A)if(m){let g=A.repository[m];g&&(l=_o.getCompiledRuleId(g,n,A.repository))}else l=_o.getCompiledRuleId(A.repository.$self,n,A.repository);break}}else l=_o.getCompiledRuleId(s,n,a);if(l!==-1){const u=n.getRule(l);let d=!1;if((u instanceof une||u instanceof K7||u instanceof gB)&&u.hasMissingPatterns&&u.patterns.length===0&&(d=!0),d)continue;r.push(l)}}return{patterns:r,hasMissingPatterns:(e?e.length:0)!==r.length}}},Mw=class d8e{constructor(e,n){We(this,"source");We(this,"ruleId");We(this,"hasAnchor");We(this,"hasBackReferences");We(this,"_anchorCache");if(e&&typeof e=="string"){const a=e.length;let r=0,i=[],o=!1;for(let s=0;s<a;s++)if(e.charAt(s)==="\\"&&s+1<a){const u=e.charAt(s+1);u==="z"?(i.push(e.substring(r,s)),i.push("$(?!\\n)(?<!\\n)"),r=s+2):(u==="A"||u==="G")&&(o=!0),s++}this.hasAnchor=o,r===0?this.source=e:(i.push(e.substring(r,a)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=iWe.test(this.source):this.hasBackReferences=!1}clone(){return new d8e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let a=n.map(r=>e.substring(r.start,r.end));return cne.lastIndex=0,this.source.replace(cne,(r,i)=>nne(a[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],n=[],a=[],r=[],i,o,s,l;for(i=0,o=this.source.length;i<o;i++)s=this.source.charAt(i),e[i]=s,n[i]=s,a[i]=s,r[i]=s,s==="\\"&&i+1<o&&(l=this.source.charAt(i+1),l==="A"?(e[i+1]="",n[i+1]="",a[i+1]="A",r[i+1]="A"):l==="G"?(e[i+1]="",n[i+1]="G",a[i+1]="",r[i+1]="G"):(e[i+1]=l,n[i+1]=l,a[i+1]=l,r[i+1]=l),i++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:a.join(""),A1_G1:r.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Rw=class{constructor(){We(this,"_items");We(this,"_hasAnchors");We(this,"_cached");We(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new pne(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let a=this._items.map(r=>r.resolveAnchors(e,n));return new pne(t,a,this._items.map(r=>r.ruleId))}},pne=class{constructor(t,e,n){We(this,"scanner");this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
|
|
538
|
+
`||t[e]==="\r");)e-=1;return e>=1&&t[e]==="$"&&t[e-1]==="$"},k5=t=>{let e=0;for(let n=0;n<t.length-1;n+=1)t[n]==="$"&&t[n+1]==="$"&&(e+=1,n+=1);return e},MGe=t=>{let e=SGe.test(t),n=TGe.test(t);if(e||n)return[t];let a=lc.lex(t,{gfm:!0}),r=[],i=[];for(let o of a){let s=o.raw,l=r.length;if(i.length>0){if(r[l-1]+=s,o.type==="html"){let u=s.match(FGe);if(u){let d=u[1];i.at(-1)===d&&i.pop()}}continue}if(o.type==="html"&&o.block){let u=s.match(LGe);if(u){let d=u[1];s.includes(`</${d}>`)||i.push(d)}}if(s.trim()==="$$"&&l>0){let u=r[l-1],d=w5(u),p=k5(u);if(d&&p%2===1){r[l-1]=u+s;continue}}if(l>0&&NGe(s)){let u=r[l-1],d=w5(u),p=k5(u),m=k5(s);if(d&&p%2===1&&!w5(s)&&m===1){r[l-1]=u+s;continue}}r.push(s)}return r},RGe={raw:ZFe,katex:[oS,{errorColor:"var(--color-muted-foreground)"}],harden:[s9e,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:!0}]},PGe={gfm:[tPe,{}],math:[GS,{singleDollarTextMath:!1}],cjkFriendly:[CLe,{}],cjkFriendlyGfmStrikethrough:[xLe,{}]},$Ge=Object.values(RGe),OGe=Object.values(PGe),jGe={shikiTheme:["github-light","github-dark"],controls:!0,isAnimating:!1,mode:"streaming",mermaid:void 0},uc=be.createContext(jGe),qJ=be.memo(({content:t,shouldParseIncompleteMarkdown:e,...n})=>{let a=be.useMemo(()=>typeof t=="string"&&e?ZPe(t.trim()):t,[t,e]);return H.jsx(GJ,{...n,children:a})},(t,e)=>{if(t.content!==e.content||t.shouldParseIncompleteMarkdown!==e.shouldParseIncompleteMarkdown||t.index!==e.index)return!1;if(t.components!==e.components){let n=Object.keys(t.components||{}),a=Object.keys(e.components||{});if(n.length!==a.length||n.some(r=>{var i,o;return((i=t.components)==null?void 0:i[r])!==((o=e.components)==null?void 0:o[r])}))return!1}return!(t.rehypePlugins!==e.rehypePlugins||t.remarkPlugins!==e.remarkPlugins)});qJ.displayName="Block";var GGe=["github-light","github-dark"],v5=be.memo(({children:t,mode:e="streaming",parseIncompleteMarkdown:n=!0,components:a,rehypePlugins:r=$Ge,remarkPlugins:i=OGe,className:o,shikiTheme:s=GGe,mermaid:l,controls:u=!0,isAnimating:d=!1,BlockComponent:p=qJ,parseMarkdownIntoBlocksFn:m=MGe,...A})=>{let g=be.useId(),[h,f]=be.useTransition(),[b,y]=be.useState([]),w=be.useMemo(()=>m(typeof t=="string"?t:""),[t,m]);be.useEffect(()=>{e==="streaming"?f(()=>{y(w)}):y(w)},[w,e]);let k=e==="streaming"?b:w,C=be.useMemo(()=>k.map((E,I)=>`${g}-${I}`),[k.length,g]),x=be.useMemo(()=>({shikiTheme:s,controls:u,isAnimating:d,mode:e,mermaid:l}),[s,u,d,e,l]),_=be.useMemo(()=>({...EGe,...a}),[a]);return be.useEffect(()=>{if(!(Array.isArray(r)&&r.some(T=>Array.isArray(T)?T[0]===oS:T===oS)))return;let E=!1;if(Array.isArray(i)){let T=i.find(N=>Array.isArray(N)?N[0]===GS:N===GS);T&&Array.isArray(T)&&T[1]&&(E=T[1].singleDollarTextMath===!0)}let I=typeof t=="string"?t:"",Q=I.includes("$$"),D=E&&(/[^$]\$[^$]/.test(I)||/^\$[^$]/.test(I)||/[^$]\$$/.test(I));(Q||D)&&Promise.resolve().then(()=>AEt)},[r,i,t]),e==="static"?H.jsx(uc.Provider,{value:x,children:H.jsx("div",{className:xn("space-y-4 whitespace-normal",o),children:H.jsx(GJ,{components:_,rehypePlugins:r,remarkPlugins:i,...A,children:t})})}):H.jsx(uc.Provider,{value:x,children:H.jsx("div",{className:xn("space-y-4 whitespace-normal",o),children:k.map((E,I)=>H.jsx(p,{components:_,content:E,index:I,rehypePlugins:r,remarkPlugins:i,shouldParseIncompleteMarkdown:n,...A},C[I]))})})},(t,e)=>t.children===e.children&&t.shikiTheme===e.shikiTheme&&t.isAnimating===e.isAnimating&&t.mode===e.mode);v5.displayName="Streamdown";var qGe=({children:t,className:e,minZoom:n=.5,maxZoom:a=3,zoomStep:r=.1,showControls:i=!0,initialZoom:o=1,fullscreen:s=!1})=>{let l=be.useRef(null),u=be.useRef(null),[d,p]=be.useState(o),[m,A]=be.useState({x:0,y:0}),[g,h]=be.useState(!1),[f,b]=be.useState({x:0,y:0}),[y,w]=be.useState({x:0,y:0}),k=be.useCallback(T=>{p(N=>Math.max(n,Math.min(a,N+T)))},[n,a]),C=be.useCallback(()=>{k(r)},[k,r]),x=be.useCallback(()=>{k(-r)},[k,r]),_=be.useCallback(()=>{p(o),A({x:0,y:0})},[o]),E=be.useCallback(T=>{T.preventDefault();let N=T.deltaY>0?-r:r;k(N)},[k,r]),I=be.useCallback(T=>{if(T.button!==0||T.isPrimary===!1)return;h(!0),b({x:T.clientX,y:T.clientY}),w(m);let N=T.currentTarget;N instanceof HTMLElement&&N.setPointerCapture(T.pointerId)},[m]),Q=be.useCallback(T=>{if(!g)return;T.preventDefault();let N=T.clientX-f.x,B=T.clientY-f.y;A({x:y.x+N,y:y.y+B})},[g,f,y]),D=be.useCallback(T=>{h(!1);let N=T.currentTarget;N instanceof HTMLElement&&N.releasePointerCapture(T.pointerId)},[]);return be.useEffect(()=>{let T=l.current;if(T)return T.addEventListener("wheel",E,{passive:!1}),()=>{T.removeEventListener("wheel",E)}},[E]),be.useEffect(()=>{let T=u.current;if(T&&g)return document.body.style.userSelect="none",T.addEventListener("pointermove",Q,{passive:!1}),T.addEventListener("pointerup",D),T.addEventListener("pointercancel",D),()=>{document.body.style.userSelect="",T.removeEventListener("pointermove",Q),T.removeEventListener("pointerup",D),T.removeEventListener("pointercancel",D)}},[g,Q,D]),H.jsxs("div",{className:xn("relative",s?"h-full w-full":"w-full",e),ref:l,style:{cursor:g?"grabbing":"grab"},children:[i&&H.jsxs("div",{className:xn("absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/90 p-1 shadow-sm backdrop-blur-sm",s?"bottom-4 left-4":"bottom-2 left-2"),children:[H.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:d>=a,onClick:C,title:"Zoom in",type:"button",children:H.jsx(o$e,{size:16})}),H.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:d<=n,onClick:x,title:"Zoom out",type:"button",children:H.jsx(s$e,{size:16})}),H.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:_,title:"Reset zoom and pan",type:"button",children:H.jsx(r$e,{size:16})})]}),H.jsx("div",{className:xn("origin-center transition-transform duration-150 ease-out",s&&"flex w-full items-center justify-center"),onPointerDown:I,ref:u,role:"application",style:{transform:`translate(${m.x}px, ${m.y}px) scale(${d})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:t})]})},zJ=({chart:t,className:e,config:n,fullscreen:a=!1,showControls:r=!0})=>{let[i,o]=be.useState(null),[s,l]=be.useState(!0),[u,d]=be.useState(""),[p,m]=be.useState(""),[A,g]=be.useState(0),{mermaid:h}=be.useContext(uc),f=h==null?void 0:h.errorComponent;if(be.useEffect(()=>{(async()=>{try{o(null),l(!0);let y=await pJ(n),w=t.split("").reduce((x,_)=>(x<<5)-x+_.charCodeAt(0)|0,0),k=`mermaid-${Math.abs(w)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:C}=await y.render(k,t);d(C),m(C)}catch(y){if(!(p||u)){let w=y instanceof Error?y.message:"Failed to render Mermaid chart";o(w)}}finally{l(!1)}})()},[t,n,A]),s&&!u&&!p)return H.jsx("div",{className:xn("my-4 flex justify-center p-4",e),children:H.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[H.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-current border-b-2"}),H.jsx("span",{className:"text-sm",children:"Loading diagram..."})]})});if(i&&!u&&!p){let y=()=>g(w=>w+1);return f?H.jsx(f,{chart:t,error:i,retry:y}):H.jsxs("div",{className:xn("rounded-lg border border-red-200 bg-red-50 p-4",e),children:[H.jsxs("p",{className:"font-mono text-red-700 text-sm",children:["Mermaid Error: ",i]}),H.jsxs("details",{className:"mt-2",children:[H.jsx("summary",{className:"cursor-pointer text-red-600 text-xs",children:"Show Code"}),H.jsx("pre",{className:"mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs",children:t})]})]})}let b=u||p;return H.jsx(qGe,{className:xn(a?"h-full w-full overflow-hidden":"my-4 overflow-hidden",e),fullscreen:a,maxZoom:3,minZoom:.5,showControls:r,zoomStep:.1,children:H.jsx("div",{"aria-label":"Mermaid chart",className:xn("flex justify-center",a&&"h-full w-full items-center"),dangerouslySetInnerHTML:{__html:b},role:"img"})})};const zGe=({className:t,from:e,...n})=>H.jsx("div",{className:Tn("message-box group flex w-full max-w-[95%] flex-col gap-2",e==="user"?"is-user ml-auto justify-end":"is-assistant",t),...n}),HGe=({children:t,className:e,...n})=>H.jsx("div",{className:Tn("message-content is-user:dark flex w-fit max-w-full min-w-0 flex-col gap-2 overflow-hidden text-sm","group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground","group-[.is-assistant]:text-foreground",e),...n,children:t});be.createContext(null);const C5=be.memo(({className:t,...e})=>H.jsx(v5,{className:Tn("message-response size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",t),...e}),(t,e)=>t.children===e.children);C5.displayName="MessageResponse";var UE="Collapsible",[UGe,Pgn]=EA(UE),[YGe,_5]=UGe(UE),HJ=_e.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:a,defaultOpen:r,disabled:i,onOpenChange:o,...s}=t,[l,u]=sf({prop:a,defaultProp:r??!1,onChange:o,caller:UE});return H.jsx(YGe,{scope:n,disabled:i,contentId:Ex(),open:l,onOpenToggle:_e.useCallback(()=>u(d=>!d),[u]),children:H.jsx(Yr.div,{"data-state":E5(l),"data-disabled":i?"":void 0,...s,ref:e})})});HJ.displayName=UE;var UJ="CollapsibleTrigger",YJ=_e.forwardRef((t,e)=>{const{__scopeCollapsible:n,...a}=t,r=_5(UJ,n);return H.jsx(Yr.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":E5(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...a,ref:e,onClick:_n(t.onClick,r.onOpenToggle)})});YJ.displayName=UJ;var x5="CollapsibleContent",WJ=_e.forwardRef((t,e)=>{const{forceMount:n,...a}=t,r=_5(x5,t.__scopeCollapsible);return H.jsx(_p,{present:n||r.open,children:({present:i})=>H.jsx(WGe,{...a,ref:e,present:i})})});WJ.displayName=x5;var WGe=_e.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:a,children:r,...i}=t,o=_5(x5,n),[s,l]=_e.useState(a),u=_e.useRef(null),d=Zi(e,u),p=_e.useRef(0),m=p.current,A=_e.useRef(0),g=A.current,h=o.open||s,f=_e.useRef(h),b=_e.useRef(void 0);return _e.useEffect(()=>{const y=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(y)},[]),td(()=>{const y=u.current;if(y){b.current=b.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";const w=y.getBoundingClientRect();p.current=w.height,A.current=w.width,f.current||(y.style.transitionDuration=b.current.transitionDuration,y.style.animationName=b.current.animationName),l(a)}},[o.open,a]),H.jsx(Yr.div,{"data-state":E5(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!h,...i,ref:d,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...t.style},children:h&&r})});function E5(t){return t?"open":"closed"}var KGe=HJ;function B5({...t}){return H.jsx(KGe,{"data-slot":"collapsible",...t})}function I5({...t}){return H.jsx(YJ,{"data-slot":"collapsible-trigger",...t})}function D5({...t}){return H.jsx(WJ,{"data-slot":"collapsible-content",...t})}const KJ=be.createContext({});function ZGe(t){const e=be.useRef(null);return e.current===null&&(e.current=t()),e.current}const ZJ=typeof window<"u",VGe=ZJ?be.useLayoutEffect:be.useEffect,Q5=be.createContext(null);function S5(t,e){t.indexOf(e)===-1&&t.push(e)}function T5(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Zl=(t,e,n)=>n>e?e:n<t?t:n;function VJ(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}var F5={npm_package_dependencies__radix_ui_react_hover_card:"1.1.15",npm_config_legacy_peer_deps:"true",TERM_PROGRAM:"WarpTerminal",NODE:"/Users/diananr/.nvm/versions/node/v22.21.1/bin/node",INIT_CWD:"/Users/diananr/foris/avocado/packages/ai-agent",npm_package_devDependencies_typescript:"5.1.3",npm_package_dependencies_lucide_react:"0.561.0",npm_package_devDependencies_vite:"5.0.12",npm_package_dependencies__radix_ui_react_dialog:"1.1.15",TERM:"xterm-256color",SHELL:"/bin/zsh",npm_package_devDependencies__testing_library_user_event:"14.5.2",npm_package_devDependencies__vitest_ui:"1.2.2",npm_package_dependencies_streamdown:"1.6.10",npm_package_dependencies_postcss:"8.5.6",TURBO_IS_TUI:"true",npm_config_registry:"https://registry.npmjs.org/",npm_package_dependencies__radix_ui_react_select:"2.2.6",npm_package_devDependencies_vite_plugin_static_copy:"1.0.0",npm_package_dependencies_react_dom:"18.3.1",npm_package_devDependencies__testing_library_react:"14.2.0",npm_package_devDependencies__types_react:"18.3.1",npm_package_dependencies_embla_carousel_react:"8.6.0",npm_package_dependencies_ai:"5.0.115",npm_package_dependencies__radix_ui_react_tooltip:"1.2.8",PNPM_SCRIPT_SRC_DIR:"/Users/diananr/foris/avocado/packages/ai-agent",npm_package_exports___import:"./dist/ai-agent.es.js",npm_package_dependencies_use_stick_to_bottom:"1.1.1",npm_package_devDependencies__types_testing_library__jest_dom:"6.0.0",npm_package_dependencies__uiw_react_codemirror:"4.25.4",__CF_USER_TEXT_ENCODING:"0x1F6:0x0:0x0",npm_execpath:"/Users/diananr/Library/pnpm/.tools/pnpm/9.10.0/node_modules/pnpm/bin/pnpm.cjs",npm_package_scripts_coverage:"vitest run --coverage",npm_package_dependencies__radix_ui_react_use_controllable_state:"1.2.2",npm_package_module:"./dist/ai-agent.es.js",npm_config_frozen_lockfile:"",npm_package_devDependencies__types_react_dom:"18.3.1",npm_package_devDependencies_classnames:"2.3.2",npm_package_dependencies_tailwind_merge:"3.4.0",npm_package_dependencies_class_variance_authority:"0.7.1",PATH:"/Users/diananr/foris/avocado/packages/ai-agent/node_modules/.bin:/Users/diananr/Library/pnpm/.tools/pnpm/9.10.0/node_modules/pnpm/dist/node-gyp-bin:/Users/diananr/foris/avocado/node_modules/.bin:/Users/diananr/foris/avocado/node_modules/.bin:/Users/diananr/Library/pnpm/.tools/pnpm/9.10.0/node_modules/pnpm/dist/node-gyp-bin:/Users/diananr/foris/avocado/node_modules/.bin:/Users/diananr/Library/pnpm/.tools/pnpm/9.10.0/bin:/Users/diananr/.antigravity/antigravity/bin:/Users/diananr/.rbenv/shims:/Users/diananr/.rbenv/bin:/Users/diananr/.rbenv/shims:/Users/diananr/.rbenv/bin:/Users/diananr/.rbenv/shims:/Users/diananr/.rbenv/bin:/Users/diananr/.nvm/versions/node/v22.21.1/bin:/Users/diananr/.asdf/installs/erlang/24.3.4/bin:/Users/diananr/.asdf/installs/elixir/1.14.1-otp-24/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/share/dotnet:~/.dotnet/tools:/usr/local/go/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Warp.app/Contents/Resources/bin",npm_package_dependencies__radix_ui_react_progress:"1.1.8",npm_config_auto_install_peers:"true",npm_command:"run-script",npm_package_devDependencies_tailwindcss:"4.1.18",PWD:"/Users/diananr/foris/avocado/packages/ai-agent",npm_package_scripts_test_watch:"vitest --ui",npm_lifecycle_event:"build",npm_package_devDependencies_jsdom:"24.0.0",npm_package_dependencies__tailwindcss_postcss:"4.1.18",npm_package_types:"./dist/index.d.ts",npm_package_name:"@foris/ai-agent",npm_package_devDependencies_sass:"1.62.1",npm_package_devDependencies__vitest_coverage_v8:"1.2.2",npm_package_devDependencies__foris_tsconfig:"workspace:*",npm_package_dependencies_cmdk:"1.1.1",npm_package_scripts_build:"tsc && vite build",npm_package_exports___types:"./dist/index.d.ts",npm_config_node_linker:"hoisted",npm_package_devDependencies_vitest:"1.2.2",npm_package_devDependencies_tw_animate_css:"1.4.0",npm_package_dependencies_motion:"12.23.26",TURBO_HASH:"9e39cb8a74939e3f",npm_package_dependencies_tokenlens:"1.3.1",npm_package_devDependencies__shikijs_transformers:"3.20.0",npm_config_node_gyp:"/Users/diananr/Library/pnpm/.tools/pnpm/9.10.0/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js",npm_package_devDependencies_vite_plugin_dts:"3.7.1",npm_package_dependencies__radix_ui_react_collapsible:"1.1.12",npm_package_main:"./dist/ai-agent.umd.js",npm_package_version:"0.7.1-beta.3",SHLVL:"1",npm_package_type:"module",HOME:"/Users/diananr",npm_package_dependencies_react_markdown:"10.1.0",npm_package_dependencies_nanoid:"5.1.6",npm_package_publishConfig_access:"public",npm_package_dependencies__radix_ui_react_slot:"1.2.4",npm_package_exports___default:"./dist/ai-agent.es.js",npm_lifecycle_script:"tsc && vite build",npm_package_exports___require:"./dist/ai-agent.umd.js",npm_package_dependencies__xyflow_react:"12.10.0",npm_package_devDependencies__vitejs_plugin_react_swc:"3.5.0",npm_package_dependencies_react:"18.3.1",npm_package_dependencies__radix_ui_react_separator:"1.1.8",npm_config_user_agent:"pnpm/9.10.0 npm/? node/v22.21.1 darwin arm64",npm_package_devDependencies__types_node:"20.2.5",npm_package_dependencies_clsx:"2.1.1",npm_package_dependencies__radix_ui_react_dropdown_menu:"2.1.16",npm_package_dependencies__ai_sdk_react:"2.0.117",npm_package_files_0:"dist",npm_package_dependencies_shiki:"3.20.0",npm_package_dependencies__codemirror_lang_json:"6.0.1",npm_node_execpath:"/Users/diananr/.nvm/versions/node/v22.21.1/bin/node",npm_package_devDependencies__testing_library_jest_dom:"6.4.0",npm_package_dependencies__radix_ui_react_scroll_area:"1.2.10",COLORTERM:"truecolor",_:"/Users/diananr/foris/avocado/node_modules/.bin/vite",NODE_ENV:"production"};let fw=()=>{},qA=()=>{};typeof process<"u"&&(F5==null?void 0:F5.NODE_ENV)!=="production"&&(fw=(t,e,n)=>{!t&&typeof console<"u"&&console.warn(VJ(e,n))},qA=(t,e,n)=>{if(!t)throw new Error(VJ(e,n))});const hd={},JJ=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function XJ(t){return typeof t=="object"&&t!==null}const eX=t=>/^0[^.\s]+$/u.test(t);function L5(t){let e;return()=>(e===void 0&&(e=t()),e)}const dc=t=>t,JGe=(t,e)=>n=>e(t(n)),bw=(...t)=>t.reduce(JGe),yw=(t,e,n)=>{const a=e-t;return a===0?1:(n-t)/a};class N5{constructor(){this.subscriptions=[]}add(e){return S5(this.subscriptions,e),()=>T5(this.subscriptions,e)}notify(e,n,a){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,n,a);else for(let i=0;i<r;i++){const o=this.subscriptions[i];o&&o(e,n,a)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Vl=t=>t*1e3,pc=t=>t/1e3;function tX(t,e){return e?t*(1e3/e):0}const nX=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,XGe=1e-7,eqe=12;function tqe(t,e,n,a,r){let i,o,s=0;do o=e+(n-e)/2,i=nX(o,a,r)-t,i>0?n=o:e=o;while(Math.abs(i)>XGe&&++s<eqe);return o}function ww(t,e,n,a){if(t===e&&n===a)return dc;const r=i=>tqe(i,0,1,t,n);return i=>i===0||i===1?i:nX(r(i),e,a)}const aX=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,rX=t=>e=>1-t(1-e),iX=ww(.33,1.53,.69,.99),M5=rX(iX),oX=aX(M5),sX=t=>(t*=2)<1?.5*M5(t):.5*(2-Math.pow(2,-10*(t-1))),R5=t=>1-Math.sin(Math.acos(t)),cX=rX(R5),lX=aX(R5),nqe=ww(.42,0,1,1),aqe=ww(0,0,.58,1),uX=ww(.42,0,.58,1),rqe=t=>Array.isArray(t)&&typeof t[0]!="number",dX=t=>Array.isArray(t)&&typeof t[0]=="number",pX={linear:dc,easeIn:nqe,easeInOut:uX,easeOut:aqe,circIn:R5,circInOut:lX,circOut:cX,backIn:M5,backInOut:oX,backOut:iX,anticipate:sX},iqe=t=>typeof t=="string",mX=t=>{if(dX(t)){qA(t.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,n,a,r]=t;return ww(e,n,a,r)}else if(iqe(t))return qA(pX[t]!==void 0,`Invalid easing type '${t}'`,"invalid-easing-type"),pX[t];return t},YE=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],AX={value:null,addProjectionMetrics:null};function oqe(t,e){let n=new Set,a=new Set,r=!1,i=!1;const o=new WeakSet;let s={delta:0,timestamp:0,isProcessing:!1},l=0;function u(p){o.has(p)&&(d.schedule(p),t()),l++,p(s)}const d={schedule:(p,m=!1,A=!1)=>{const h=A&&r?n:a;return m&&o.add(p),h.has(p)||h.add(p),p},cancel:p=>{a.delete(p),o.delete(p)},process:p=>{if(s=p,r){i=!0;return}r=!0,[n,a]=[a,n],n.forEach(u),e&&AX.value&&AX.value.frameloop[e].push(l),l=0,n.clear(),r=!1,i&&(i=!1,d.process(p))}};return d}const sqe=40;function gX(t,e){let n=!1,a=!0;const r={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=YE.reduce((w,k)=>(w[k]=oqe(i,e?k:void 0),w),{}),{setup:s,read:l,resolveKeyframes:u,preUpdate:d,update:p,preRender:m,render:A,postRender:g}=o,h=()=>{const w=hd.useManualTiming?r.timestamp:performance.now();n=!1,hd.useManualTiming||(r.delta=a?1e3/60:Math.max(Math.min(w-r.timestamp,sqe),1)),r.timestamp=w,r.isProcessing=!0,s.process(r),l.process(r),u.process(r),d.process(r),p.process(r),m.process(r),A.process(r),g.process(r),r.isProcessing=!1,n&&e&&(a=!1,t(h))},f=()=>{n=!0,a=!0,r.isProcessing||t(h)};return{schedule:YE.reduce((w,k)=>{const C=o[k];return w[k]=(x,_=!1,E=!1)=>(n||f(),C.schedule(x,_,E)),w},{}),cancel:w=>{for(let k=0;k<YE.length;k++)o[YE[k]].cancel(w)},state:r,steps:o}}const{schedule:Ma,cancel:Pp,state:Ti,steps:P5}=gX(typeof requestAnimationFrame<"u"?requestAnimationFrame:dc,!0);let WE;function cqe(){WE=void 0}const So={now:()=>(WE===void 0&&So.set(Ti.isProcessing||hd.useManualTiming?Ti.timestamp:performance.now()),WE),set:t=>{WE=t,queueMicrotask(cqe)}},hX=t=>e=>typeof e=="string"&&e.startsWith(t),fX=hX("--"),lqe=hX("var(--"),$5=t=>lqe(t)?uqe.test(t.split("/*")[0].trim()):!1,uqe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function bX(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const Sf={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},kw={...Sf,transform:t=>Zl(0,1,t)},KE={...Sf,default:1},vw=t=>Math.round(t*1e5)/1e5,O5=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function dqe(t){return t==null}const pqe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,j5=(t,e)=>n=>!!(typeof n=="string"&&pqe.test(n)&&n.startsWith(t)||e&&!dqe(n)&&Object.prototype.hasOwnProperty.call(n,e)),yX=(t,e,n)=>a=>{if(typeof a!="string")return a;const[r,i,o,s]=a.match(O5);return{[t]:parseFloat(r),[e]:parseFloat(i),[n]:parseFloat(o),alpha:s!==void 0?parseFloat(s):1}},mqe=t=>Zl(0,255,t),G5={...Sf,transform:t=>Math.round(mqe(t))},zA={test:j5("rgb","red"),parse:yX("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:a=1})=>"rgba("+G5.transform(t)+", "+G5.transform(e)+", "+G5.transform(n)+", "+vw(kw.transform(a))+")"};function Aqe(t){let e="",n="",a="",r="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),a=t.substring(5,7),r=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),a=t.substring(3,4),r=t.substring(4,5),e+=e,n+=n,a+=a,r+=r),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(a,16),alpha:r?parseInt(r,16)/255:1}}const q5={test:j5("#"),parse:Aqe,transform:zA.transform},Cw=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),$p=Cw("deg"),Jl=Cw("%"),Vt=Cw("px"),gqe=Cw("vh"),hqe=Cw("vw"),wX={...Jl,parse:t=>Jl.parse(t)/100,transform:t=>Jl.transform(t*100)},Tf={test:j5("hsl","hue"),parse:yX("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:a=1})=>"hsla("+Math.round(t)+", "+Jl.transform(vw(e))+", "+Jl.transform(vw(n))+", "+vw(kw.transform(a))+")"},Sr={test:t=>zA.test(t)||q5.test(t)||Tf.test(t),parse:t=>zA.test(t)?zA.parse(t):Tf.test(t)?Tf.parse(t):q5.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?zA.transform(t):Tf.transform(t),getAnimatableNone:t=>{const e=Sr.parse(t);return e.alpha=0,Sr.transform(e)}},fqe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function bqe(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(O5))==null?void 0:e.length)||0)+(((n=t.match(fqe))==null?void 0:n.length)||0)>0}const kX="number",vX="color",yqe="var",wqe="var(",CX="${}",kqe=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function _w(t){const e=t.toString(),n=[],a={color:[],number:[],var:[]},r=[];let i=0;const s=e.replace(kqe,l=>(Sr.test(l)?(a.color.push(i),r.push(vX),n.push(Sr.parse(l))):l.startsWith(wqe)?(a.var.push(i),r.push(yqe),n.push(l)):(a.number.push(i),r.push(kX),n.push(parseFloat(l))),++i,CX)).split(CX);return{values:n,split:s,indexes:a,types:r}}function _X(t){return _w(t).values}function xX(t){const{split:e,types:n}=_w(t),a=e.length;return r=>{let i="";for(let o=0;o<a;o++)if(i+=e[o],r[o]!==void 0){const s=n[o];s===kX?i+=vw(r[o]):s===vX?i+=Sr.transform(r[o]):i+=r[o]}return i}}const vqe=t=>typeof t=="number"?0:Sr.test(t)?Sr.getAnimatableNone(t):t;function Cqe(t){const e=_X(t);return xX(t)(e.map(vqe))}const Op={test:bqe,parse:_X,createTransformer:xX,getAnimatableNone:Cqe};function z5(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function _qe({hue:t,saturation:e,lightness:n,alpha:a}){t/=360,e/=100,n/=100;let r=0,i=0,o=0;if(!e)r=i=o=n;else{const s=n<.5?n*(1+e):n+e-n*e,l=2*n-s;r=z5(l,s,t+1/3),i=z5(l,s,t),o=z5(l,s,t-1/3)}return{red:Math.round(r*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:a}}function ZE(t,e){return n=>n>0?e:t}const ir=(t,e,n)=>t+(e-t)*n,H5=(t,e,n)=>{const a=t*t,r=n*(e*e-a)+a;return r<0?0:Math.sqrt(r)},xqe=[q5,zA,Tf],Eqe=t=>xqe.find(e=>e.test(t));function EX(t){const e=Eqe(t);if(fw(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!e)return!1;let n=e.parse(t);return e===Tf&&(n=_qe(n)),n}const BX=(t,e)=>{const n=EX(t),a=EX(e);if(!n||!a)return ZE(t,e);const r={...n};return i=>(r.red=H5(n.red,a.red,i),r.green=H5(n.green,a.green,i),r.blue=H5(n.blue,a.blue,i),r.alpha=ir(n.alpha,a.alpha,i),zA.transform(r))},U5=new Set(["none","hidden"]);function Bqe(t,e){return U5.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function Iqe(t,e){return n=>ir(t,e,n)}function Y5(t){return typeof t=="number"?Iqe:typeof t=="string"?$5(t)?ZE:Sr.test(t)?BX:Sqe:Array.isArray(t)?IX:typeof t=="object"?Sr.test(t)?BX:Dqe:ZE}function IX(t,e){const n=[...t],a=n.length,r=t.map((i,o)=>Y5(i)(i,e[o]));return i=>{for(let o=0;o<a;o++)n[o]=r[o](i);return n}}function Dqe(t,e){const n={...t,...e},a={};for(const r in n)t[r]!==void 0&&e[r]!==void 0&&(a[r]=Y5(t[r])(t[r],e[r]));return r=>{for(const i in a)n[i]=a[i](r);return n}}function Qqe(t,e){const n=[],a={color:0,var:0,number:0};for(let r=0;r<e.values.length;r++){const i=e.types[r],o=t.indexes[i][a[i]],s=t.values[o]??0;n[r]=s,a[i]++}return n}const Sqe=(t,e)=>{const n=Op.createTransformer(e),a=_w(t),r=_w(e);return a.indexes.var.length===r.indexes.var.length&&a.indexes.color.length===r.indexes.color.length&&a.indexes.number.length>=r.indexes.number.length?U5.has(t)&&!r.values.length||U5.has(e)&&!a.values.length?Bqe(t,e):bw(IX(Qqe(a,r),r.values),n):(fw(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),ZE(t,e))};function DX(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?ir(t,e,n):Y5(t)(t,e)}const Tqe=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>Ma.update(e,n),stop:()=>Pp(e),now:()=>Ti.isProcessing?Ti.timestamp:So.now()}},QX=(t,e,n=10)=>{let a="";const r=Math.max(Math.round(e/n),2);for(let i=0;i<r;i++)a+=Math.round(t(i/(r-1))*1e4)/1e4+", ";return`linear(${a.substring(0,a.length-2)})`},VE=2e4;function W5(t){let e=0;const n=50;let a=t.next(e);for(;!a.done&&e<VE;)e+=n,a=t.next(e);return e>=VE?1/0:e}function Fqe(t,e=100,n){const a=n({...t,keyframes:[0,e]}),r=Math.min(W5(a),VE);return{type:"keyframes",ease:i=>a.next(r*i).value/e,duration:pc(r)}}const Lqe=5;function SX(t,e,n){const a=Math.max(e-Lqe,0);return tX(n-t(a),e-a)}const or={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},K5=.001;function Nqe({duration:t=or.duration,bounce:e=or.bounce,velocity:n=or.velocity,mass:a=or.mass}){let r,i;fw(t<=Vl(or.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let o=1-e;o=Zl(or.minDamping,or.maxDamping,o),t=Zl(or.minDuration,or.maxDuration,pc(t)),o<1?(r=u=>{const d=u*o,p=d*t,m=d-n,A=Z5(u,o),g=Math.exp(-p);return K5-m/A*g},i=u=>{const p=u*o*t,m=p*n+n,A=Math.pow(o,2)*Math.pow(u,2)*t,g=Math.exp(-p),h=Z5(Math.pow(u,2),o);return(-r(u)+K5>0?-1:1)*((m-A)*g)/h}):(r=u=>{const d=Math.exp(-u*t),p=(u-n)*t+1;return-K5+d*p},i=u=>{const d=Math.exp(-u*t),p=(n-u)*(t*t);return d*p});const s=5/t,l=Rqe(r,i,s);if(t=Vl(t),isNaN(l))return{stiffness:or.stiffness,damping:or.damping,duration:t};{const u=Math.pow(l,2)*a;return{stiffness:u,damping:o*2*Math.sqrt(a*u),duration:t}}}const Mqe=12;function Rqe(t,e,n){let a=n;for(let r=1;r<Mqe;r++)a=a-t(a)/e(a);return a}function Z5(t,e){return t*Math.sqrt(1-e*e)}const Pqe=["duration","bounce"],$qe=["stiffness","damping","mass"];function TX(t,e){return e.some(n=>t[n]!==void 0)}function Oqe(t){let e={velocity:or.velocity,stiffness:or.stiffness,damping:or.damping,mass:or.mass,isResolvedFromDuration:!1,...t};if(!TX(t,$qe)&&TX(t,Pqe))if(t.visualDuration){const n=t.visualDuration,a=2*Math.PI/(n*1.2),r=a*a,i=2*Zl(.05,1,1-(t.bounce||0))*Math.sqrt(r);e={...e,mass:or.mass,stiffness:r,damping:i}}else{const n=Nqe(t);e={...e,...n,mass:or.mass},e.isResolvedFromDuration=!0}return e}function JE(t=or.visualDuration,e=or.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:a,restDelta:r}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:i},{stiffness:l,damping:u,mass:d,duration:p,velocity:m,isResolvedFromDuration:A}=Oqe({...n,velocity:-pc(n.velocity||0)}),g=m||0,h=u/(2*Math.sqrt(l*d)),f=o-i,b=pc(Math.sqrt(l/d)),y=Math.abs(f)<5;a||(a=y?or.restSpeed.granular:or.restSpeed.default),r||(r=y?or.restDelta.granular:or.restDelta.default);let w;if(h<1){const C=Z5(b,h);w=x=>{const _=Math.exp(-h*b*x);return o-_*((g+h*b*f)/C*Math.sin(C*x)+f*Math.cos(C*x))}}else if(h===1)w=C=>o-Math.exp(-b*C)*(f+(g+b*f)*C);else{const C=b*Math.sqrt(h*h-1);w=x=>{const _=Math.exp(-h*b*x),E=Math.min(C*x,300);return o-_*((g+h*b*f)*Math.sinh(E)+C*f*Math.cosh(E))/C}}const k={calculatedDuration:A&&p||null,next:C=>{const x=w(C);if(A)s.done=C>=p;else{let _=C===0?g:0;h<1&&(_=C===0?Vl(g):SX(w,C,x));const E=Math.abs(_)<=a,I=Math.abs(o-x)<=r;s.done=E&&I}return s.value=s.done?o:x,s},toString:()=>{const C=Math.min(W5(k),VE),x=QX(_=>k.next(C*_).value,C,30);return C+"ms "+x},toTransition:()=>{}};return k}JE.applyToOptions=t=>{const e=Fqe(t,100,JE);return t.ease=e.ease,t.duration=Vl(e.duration),t.type="keyframes",t};function V5({keyframes:t,velocity:e=0,power:n=.8,timeConstant:a=325,bounceDamping:r=10,bounceStiffness:i=500,modifyTarget:o,min:s,max:l,restDelta:u=.5,restSpeed:d}){const p=t[0],m={done:!1,value:p},A=E=>s!==void 0&&E<s||l!==void 0&&E>l,g=E=>s===void 0?l:l===void 0||Math.abs(s-E)<Math.abs(l-E)?s:l;let h=n*e;const f=p+h,b=o===void 0?f:o(f);b!==f&&(h=b-p);const y=E=>-h*Math.exp(-E/a),w=E=>b+y(E),k=E=>{const I=y(E),Q=w(E);m.done=Math.abs(I)<=u,m.value=m.done?b:Q};let C,x;const _=E=>{A(m.value)&&(C=E,x=JE({keyframes:[m.value,g(m.value)],velocity:SX(w,E,m.value),damping:r,stiffness:i,restDelta:u,restSpeed:d}))};return _(0),{calculatedDuration:null,next:E=>{let I=!1;return!x&&C===void 0&&(I=!0,k(E),_(E)),C!==void 0&&E>=C?x.next(E-C):(!I&&k(E),m)}}}function jqe(t,e,n){const a=[],r=n||hd.mix||DX,i=t.length-1;for(let o=0;o<i;o++){let s=r(t[o],t[o+1]);if(e){const l=Array.isArray(e)?e[o]||dc:e;s=bw(l,s)}a.push(s)}return a}function Gqe(t,e,{clamp:n=!0,ease:a,mixer:r}={}){const i=t.length;if(qA(i===e.length,"Both input and output ranges must be the same length","range-length"),i===1)return()=>e[0];if(i===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const s=jqe(e,a,r),l=s.length,u=d=>{if(o&&d<t[0])return e[0];let p=0;if(l>1)for(;p<t.length-2&&!(d<t[p+1]);p++);const m=yw(t[p],t[p+1],d);return s[p](m)};return n?d=>u(Zl(t[0],t[i-1],d)):u}function qqe(t,e){const n=t[t.length-1];for(let a=1;a<=e;a++){const r=yw(0,e,a);t.push(ir(n,1,r))}}function zqe(t){const e=[0];return qqe(e,t.length-1),e}function Hqe(t,e){return t.map(n=>n*e)}function Uqe(t,e){return t.map(()=>e||uX).splice(0,t.length-1)}function xw({duration:t=300,keyframes:e,times:n,ease:a="easeInOut"}){const r=rqe(a)?a.map(mX):mX(a),i={done:!1,value:e[0]},o=Hqe(n&&n.length===e.length?n:zqe(e),t),s=Gqe(o,e,{ease:Array.isArray(r)?r:Uqe(e,r)});return{calculatedDuration:t,next:l=>(i.value=s(l),i.done=l>=t,i)}}const Yqe=t=>t!==null;function J5(t,{repeat:e,repeatType:n="loop"},a,r=1){const i=t.filter(Yqe),s=r<0||e&&n!=="loop"&&e%2===1?0:i.length-1;return!s||a===void 0?i[s]:a}const Wqe={decay:V5,inertia:V5,tween:xw,keyframes:xw,spring:JE};function FX(t){typeof t.type=="string"&&(t.type=Wqe[t.type])}class X5{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const Kqe=t=>t/100;class e7 extends X5{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var a,r;const{motionValue:n}=this.options;n&&n.updatedAt!==So.now()&&this.tick(So.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(r=(a=this.options).onStop)==null||r.call(a))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;FX(e);const{type:n=xw,repeat:a=0,repeatDelay:r=0,repeatType:i,velocity:o=0}=e;let{keyframes:s}=e;const l=n||xw;l!==xw&&typeof s[0]!="number"&&(this.mixKeyframes=bw(Kqe,DX(s[0],s[1])),s=[0,100]);const u=l({...e,keyframes:s});i==="mirror"&&(this.mirroredGenerator=l({...e,keyframes:[...s].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=W5(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+r,this.totalDuration=this.resolvedDuration*(a+1)-r,this.generator=u}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:a,totalDuration:r,mixKeyframes:i,mirroredGenerator:o,resolvedDuration:s,calculatedDuration:l}=this;if(this.startTime===null)return a.next(0);const{delay:u=0,keyframes:d,repeat:p,repeatType:m,repeatDelay:A,type:g,onUpdate:h,finalKeyframe:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const b=this.currentTime-u*(this.playbackSpeed>=0?1:-1),y=this.playbackSpeed>=0?b<0:b>r;this.currentTime=Math.max(b,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let w=this.currentTime,k=a;if(p){const E=Math.min(this.currentTime,r)/s;let I=Math.floor(E),Q=E%1;!Q&&E>=1&&(Q=1),Q===1&&I--,I=Math.min(I,p+1),!!(I%2)&&(m==="reverse"?(Q=1-Q,A&&(Q-=A/s)):m==="mirror"&&(k=o)),w=Zl(0,1,Q)*s}const C=y?{done:!1,value:d[0]}:k.next(w);i&&(C.value=i(C.value));let{done:x}=C;!y&&l!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const _=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&x);return _&&g!==V5&&(C.value=J5(d,this.options,f,this.speed)),h&&h(C.value),_&&this.finish(),C}then(e,n){return this.finished.then(e,n)}get duration(){return pc(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+pc(e)}get time(){return pc(this.currentTime)}set time(e){var n;e=Vl(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(So.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=pc(this.currentTime))}play(){var r,i;if(this.isStopped)return;const{driver:e=Tqe,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),(i=(r=this.options).onPlay)==null||i.call(r);const a=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=a):this.holdTime!==null?this.startTime=a-this.holdTime:this.startTime||(this.startTime=n??a),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(So.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(e=this.options).onComplete)==null||n.call(e)}cancel(){var e,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(e=this.options).onCancel)==null||n.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),e.observe(this)}}function Zqe(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const HA=t=>t*180/Math.PI,t7=t=>{const e=HA(Math.atan2(t[1],t[0]));return n7(e)},Vqe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:t7,rotateZ:t7,skewX:t=>HA(Math.atan(t[1])),skewY:t=>HA(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},n7=t=>(t=t%360,t<0&&(t+=360),t),LX=t7,NX=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),MX=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Jqe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:NX,scaleY:MX,scale:t=>(NX(t)+MX(t))/2,rotateX:t=>n7(HA(Math.atan2(t[6],t[5]))),rotateY:t=>n7(HA(Math.atan2(-t[2],t[0]))),rotateZ:LX,rotate:LX,skewX:t=>HA(Math.atan(t[4])),skewY:t=>HA(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function a7(t){return t.includes("scale")?1:0}function r7(t,e){if(!t||t==="none")return a7(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let a,r;if(n)a=Jqe,r=n;else{const s=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);a=Vqe,r=s}if(!r)return a7(e);const i=a[e],o=r[1].split(",").map(eze);return typeof i=="function"?i(o):o[i]}const Xqe=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return r7(n,e)};function eze(t){return parseFloat(t.trim())}const Ff=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Lf=new Set(Ff),RX=t=>t===Sf||t===Vt,tze=new Set(["x","y","z"]),nze=Ff.filter(t=>!tze.has(t));function aze(t){const e=[];return nze.forEach(n=>{const a=t.getValue(n);a!==void 0&&(e.push([n,a.get()]),a.set(n.startsWith("scale")?1:0))}),e}const jp={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>r7(e,"x"),y:(t,{transform:e})=>r7(e,"y")};jp.translateX=jp.x,jp.translateY=jp.y;const UA=new Set;let i7=!1,o7=!1,s7=!1;function PX(){if(o7){const t=Array.from(UA).filter(a=>a.needsMeasurement),e=new Set(t.map(a=>a.element)),n=new Map;e.forEach(a=>{const r=aze(a);r.length&&(n.set(a,r),a.render())}),t.forEach(a=>a.measureInitialState()),e.forEach(a=>{a.render();const r=n.get(a);r&&r.forEach(([i,o])=>{var s;(s=a.getValue(i))==null||s.set(o)})}),t.forEach(a=>a.measureEndState()),t.forEach(a=>{a.suspendedScrollY!==void 0&&window.scrollTo(0,a.suspendedScrollY)})}o7=!1,i7=!1,UA.forEach(t=>t.complete(s7)),UA.clear()}function $X(){UA.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(o7=!0)})}function rze(){s7=!0,$X(),PX(),s7=!1}class c7{constructor(e,n,a,r,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=a,this.motionValue=r,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(UA.add(this),i7||(i7=!0,Ma.read($X),Ma.resolveKeyframes(PX))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:a,motionValue:r}=this;if(e[0]===null){const i=r==null?void 0:r.get(),o=e[e.length-1];if(i!==void 0)e[0]=i;else if(a&&n){const s=a.readValue(n,o);s!=null&&(e[0]=s)}e[0]===void 0&&(e[0]=o),r&&i===void 0&&r.set(e[0])}Zqe(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),UA.delete(this)}cancel(){this.state==="scheduled"&&(UA.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const ize=t=>t.startsWith("--");function oze(t,e,n){ize(e)?t.style.setProperty(e,n):t.style[e]=n}const sze=L5(()=>window.ScrollTimeline!==void 0),cze={};function lze(t,e){const n=L5(t);return()=>cze[e]??n()}const OX=lze(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Ew=([t,e,n,a])=>`cubic-bezier(${t}, ${e}, ${n}, ${a})`,jX={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ew([0,.65,.55,1]),circOut:Ew([.55,0,1,.45]),backIn:Ew([.31,.01,.66,-.59]),backOut:Ew([.33,1.53,.69,.99])};function GX(t,e){if(t)return typeof t=="function"?OX()?QX(t,e):"ease-out":dX(t)?Ew(t):Array.isArray(t)?t.map(n=>GX(n,e)||jX.easeOut):jX[t]}function uze(t,e,n,{delay:a=0,duration:r=300,repeat:i=0,repeatType:o="loop",ease:s="easeOut",times:l}={},u=void 0){const d={[e]:n};l&&(d.offset=l);const p=GX(s,r);Array.isArray(p)&&(d.easing=p);const m={delay:a,duration:r,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"};return u&&(m.pseudoElement=u),t.animate(d,m)}function qX(t){return typeof t=="function"&&"applyToOptions"in t}function dze({type:t,...e}){return qX(t)&&OX()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class pze extends X5{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:n,name:a,keyframes:r,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:s,onComplete:l}=e;this.isPseudoElement=!!i,this.allowFlatten=o,this.options=e,qA(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const u=dze(e);this.animation=uze(n,a,r,u,i),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const d=J5(r,this.options,s,this.speed);this.updateMotionValue?this.updateMotionValue(d):oze(n,a,d),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,n;(n=(e=this.animation).finish)==null||n.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,n;this.isPseudoElement||(n=(e=this.animation).commitStyles)==null||n.call(e)}get duration(){var n,a;const e=((a=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:a.call(n).duration)||0;return pc(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+pc(e)}get time(){return pc(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Vl(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){var a;return this.allowFlatten&&((a=this.animation.effect)==null||a.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&sze()?(this.animation.timeline=e,dc):n(this)}}const zX={anticipate:sX,backInOut:oX,circInOut:lX};function mze(t){return t in zX}function Aze(t){typeof t.ease=="string"&&mze(t.ease)&&(t.ease=zX[t.ease])}const l7=10;class gze extends pze{constructor(e){Aze(e),FX(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:a,onComplete:r,element:i,...o}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const s=new e7({...o,autoplay:!1}),l=Math.max(l7,So.now()-this.startTime),u=Zl(0,l7,l-l7);n.setWithVelocity(s.sample(Math.max(0,l-u)).value,s.sample(l).value,u),s.stop()}}const HX=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Op.test(t)||t==="0")&&!t.startsWith("url("));function hze(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function fze(t,e,n,a){const r=t[0];if(r===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],o=HX(r,e),s=HX(i,e);return fw(o===s,`You are trying to animate ${e} from "${r}" to "${i}". "${o?i:r}" is not an animatable value.`,"value-not-animatable"),!o||!s?!1:hze(t)||(n==="spring"||qX(n))&&a}function u7(t){t.duration=0,t.type="keyframes"}const bze=new Set(["opacity","clipPath","filter","transform"]),yze=L5(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function wze(t){var d;const{motionValue:e,name:n,repeatDelay:a,repeatType:r,damping:i,type:o}=t;if(!(((d=e==null?void 0:e.owner)==null?void 0:d.current)instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:u}=e.owner.getProps();return yze()&&n&&bze.has(n)&&(n!=="transform"||!u)&&!l&&!a&&r!=="mirror"&&i!==0&&o!=="inertia"}const kze=40;class vze extends X5{constructor({autoplay:e=!0,delay:n=0,type:a="keyframes",repeat:r=0,repeatDelay:i=0,repeatType:o="loop",keyframes:s,name:l,motionValue:u,element:d,...p}){var g;super(),this.stop=()=>{var h,f;this._animation&&(this._animation.stop(),(h=this.stopTimeline)==null||h.call(this)),(f=this.keyframeResolver)==null||f.cancel()},this.createdAt=So.now();const m={autoplay:e,delay:n,type:a,repeat:r,repeatDelay:i,repeatType:o,name:l,motionValue:u,element:d,...p},A=(d==null?void 0:d.KeyframeResolver)||c7;this.keyframeResolver=new A(s,(h,f,b)=>this.onKeyframesResolved(h,f,m,!b),l,u,d),(g=this.keyframeResolver)==null||g.scheduleResolve()}onKeyframesResolved(e,n,a,r){var f,b;this.keyframeResolver=void 0;const{name:i,type:o,velocity:s,delay:l,isHandoff:u,onUpdate:d}=a;this.resolvedAt=So.now(),fze(e,i,o,s)||((hd.instantAnimations||!l)&&(d==null||d(J5(e,a,n))),e[0]=e[e.length-1],u7(a),a.repeat=0);const m={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>kze?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...a,keyframes:e},A=!u&&wze(m),g=(b=(f=m.motionValue)==null?void 0:f.owner)==null?void 0:b.current,h=A?new gze({...m,element:g}):new e7(m);h.finished.then(()=>{this.notifyFinished()}).catch(dc),this.pendingTimeline&&(this.stopTimeline=h.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=h}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),rze()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}function UX(t,e,n,a=0,r=1){const i=Array.from(t).sort((u,d)=>u.sortNodePosition(d)).indexOf(e),o=t.size,s=(o-1)*a;return typeof n=="function"?n(i,o):r===1?i*a:s-i*a}const Cze=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function _ze(t){const e=Cze.exec(t);if(!e)return[,];const[,n,a,r]=e;return[`--${n??a}`,r]}const xze=4;function YX(t,e,n=1){qA(n<=xze,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[a,r]=_ze(t);if(!a)return;const i=window.getComputedStyle(e).getPropertyValue(a);if(i){const o=i.trim();return JJ(o)?parseFloat(o):o}return $5(r)?YX(r,e,n+1):r}const Eze={type:"spring",stiffness:500,damping:25,restSpeed:10},Bze=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Ize={type:"keyframes",duration:.8},Dze={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Qze=(t,{keyframes:e})=>e.length>2?Ize:Lf.has(t)?t.startsWith("scale")?Bze(e[1]):Eze:Dze,Sze=t=>t!==null;function Tze(t,{repeat:e,repeatType:n="loop"},a){const r=t.filter(Sze),i=e&&n!=="loop"&&e%2===1?0:r.length-1;return!i||a===void 0?r[i]:a}function d7(t,e){return(t==null?void 0:t[e])??(t==null?void 0:t.default)??t}function Fze({when:t,delay:e,delayChildren:n,staggerChildren:a,staggerDirection:r,repeat:i,repeatType:o,repeatDelay:s,from:l,elapsed:u,...d}){return!!Object.keys(d).length}const p7=(t,e,n,a={},r,i)=>o=>{const s=d7(a,t)||{},l=s.delay||a.delay||0;let{elapsed:u=0}=a;u=u-Vl(l);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...s,delay:-u,onUpdate:m=>{e.set(m),s.onUpdate&&s.onUpdate(m)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:t,motionValue:e,element:i?void 0:r};Fze(s)||Object.assign(d,Qze(t,d)),d.duration&&(d.duration=Vl(d.duration)),d.repeatDelay&&(d.repeatDelay=Vl(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let p=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(u7(d),d.delay===0&&(p=!0)),(hd.instantAnimations||hd.skipAnimations)&&(p=!0,u7(d),d.delay=0),d.allowFlatten=!s.type&&!s.ease,p&&!i&&e.get()!==void 0){const m=Tze(d.keyframes,s);if(m!==void 0){Ma.update(()=>{d.onUpdate(m),d.onComplete()});return}}return s.isSync?new e7(d):new vze(d)};function WX(t){const e=[{},{}];return t==null||t.values.forEach((n,a)=>{e[0][a]=n.get(),e[1][a]=n.getVelocity()}),e}function m7(t,e,n,a){if(typeof e=="function"){const[r,i]=WX(a);e=e(n!==void 0?n:t.custom,r,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[r,i]=WX(a);e=e(n!==void 0?n:t.custom,r,i)}return e}function Nf(t,e,n){const a=t.getProps();return m7(a,e,n!==void 0?n:a.custom,t)}const KX=new Set(["width","height","top","left","right","bottom",...Ff]),ZX=30,Lze=t=>!isNaN(parseFloat(t));class Nze{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=a=>{var i;const r=So.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(a),this.current!==this.prev&&((i=this.events.change)==null||i.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=So.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Lze(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new N5);const a=this.events[e].add(n);return e==="change"?()=>{a(),Ma.read(()=>{this.events.change.getSize()||this.stop()})}:a}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,a){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-a}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=So.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>ZX)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,ZX);return tX(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,n;(e=this.dependents)==null||e.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Mf(t,e){return new Nze(t,e)}const A7=t=>Array.isArray(t);function Mze(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Mf(n))}function Rze(t){return A7(t)?t[t.length-1]||0:t}function Pze(t,e){const n=Nf(t,e);let{transitionEnd:a={},transition:r={},...i}=n||{};i={...i,...a};for(const o in i){const s=Rze(i[o]);Mze(t,o,s)}}const eo=t=>!!(t&&t.getVelocity);function $ze(t){return!!(eo(t)&&t.add)}function g7(t,e){const n=t.getValue("willChange");if($ze(n))return n.add(e);if(!n&&hd.WillChange){const a=new hd.WillChange("auto");t.addValue("willChange",a),a.add(e)}}function h7(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const VX="data-"+h7("framerAppearId");function JX(t){return t.props[VX]}function Oze({protectedKeys:t,needsAnimating:e},n){const a=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,a}function XX(t,e,{delay:n=0,transitionOverride:a,type:r}={}){let{transition:i=t.getDefaultTransition(),transitionEnd:o,...s}=e;a&&(i=a);const l=[],u=r&&t.animationState&&t.animationState.getState()[r];for(const d in s){const p=t.getValue(d,t.latestValues[d]??null),m=s[d];if(m===void 0||u&&Oze(u,d))continue;const A={delay:n,...d7(i||{},d)},g=p.get();if(g!==void 0&&!p.isAnimating&&!Array.isArray(m)&&m===g&&!A.velocity)continue;let h=!1;if(window.MotionHandoffAnimation){const b=JX(t);if(b){const y=window.MotionHandoffAnimation(b,d,Ma);y!==null&&(A.startTime=y,h=!0)}}g7(t,d),p.start(p7(d,p,m,t.shouldReduceMotion&&KX.has(d)?{type:!1}:A,t,h));const f=p.animation;f&&l.push(f)}return o&&Promise.all(l).then(()=>{Ma.update(()=>{o&&Pze(t,o)})}),l}function f7(t,e,n={}){var l;const a=Nf(t,e,n.type==="exit"?(l=t.presenceContext)==null?void 0:l.custom:void 0);let{transition:r=t.getDefaultTransition()||{}}=a||{};n.transitionOverride&&(r=n.transitionOverride);const i=a?()=>Promise.all(XX(t,a,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:m}=r;return jze(t,e,u,d,p,m,n)}:()=>Promise.resolve(),{when:s}=r;if(s){const[u,d]=s==="beforeChildren"?[i,o]:[o,i];return u().then(()=>d())}else return Promise.all([i(),o(n.delay)])}function jze(t,e,n=0,a=0,r=0,i=1,o){const s=[];for(const l of t.variantChildren)l.notify("AnimationStart",e),s.push(f7(l,e,{...o,delay:n+(typeof a=="function"?0:a)+UX(t.variantChildren,l,a,r,i)}).then(()=>l.notify("AnimationComplete",e)));return Promise.all(s)}function Gze(t,e,n={}){t.notify("AnimationStart",e);let a;if(Array.isArray(e)){const r=e.map(i=>f7(t,i,n));a=Promise.all(r)}else if(typeof e=="string")a=f7(t,e,n);else{const r=typeof e=="function"?Nf(t,e,n.custom):e;a=Promise.all(XX(t,r,n))}return a.then(()=>{t.notify("AnimationComplete",e)})}const qze={test:t=>t==="auto",parse:t=>t},eee=t=>e=>e.test(t),tee=[Sf,Vt,Jl,$p,hqe,gqe,qze],nee=t=>tee.find(eee(t));function zze(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||eX(t):!0}const Hze=new Set(["brightness","contrast","saturate","opacity"]);function Uze(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[a]=n.match(O5)||[];if(!a)return t;const r=n.replace(a,"");let i=Hze.has(e)?1:0;return a!==n&&(i*=100),e+"("+i+r+")"}const Yze=/\b([a-z-]*)\(.*?\)/gu,b7={...Op,getAnimatableNone:t=>{const e=t.match(Yze);return e?e.map(Uze).join(" "):t}},aee={...Sf,transform:Math.round},y7={borderWidth:Vt,borderTopWidth:Vt,borderRightWidth:Vt,borderBottomWidth:Vt,borderLeftWidth:Vt,borderRadius:Vt,radius:Vt,borderTopLeftRadius:Vt,borderTopRightRadius:Vt,borderBottomRightRadius:Vt,borderBottomLeftRadius:Vt,width:Vt,maxWidth:Vt,height:Vt,maxHeight:Vt,top:Vt,right:Vt,bottom:Vt,left:Vt,inset:Vt,insetBlock:Vt,insetBlockStart:Vt,insetBlockEnd:Vt,insetInline:Vt,insetInlineStart:Vt,insetInlineEnd:Vt,padding:Vt,paddingTop:Vt,paddingRight:Vt,paddingBottom:Vt,paddingLeft:Vt,paddingBlock:Vt,paddingBlockStart:Vt,paddingBlockEnd:Vt,paddingInline:Vt,paddingInlineStart:Vt,paddingInlineEnd:Vt,margin:Vt,marginTop:Vt,marginRight:Vt,marginBottom:Vt,marginLeft:Vt,marginBlock:Vt,marginBlockStart:Vt,marginBlockEnd:Vt,marginInline:Vt,marginInlineStart:Vt,marginInlineEnd:Vt,backgroundPositionX:Vt,backgroundPositionY:Vt,...{rotate:$p,rotateX:$p,rotateY:$p,rotateZ:$p,scale:KE,scaleX:KE,scaleY:KE,scaleZ:KE,skew:$p,skewX:$p,skewY:$p,distance:Vt,translateX:Vt,translateY:Vt,translateZ:Vt,x:Vt,y:Vt,z:Vt,perspective:Vt,transformPerspective:Vt,opacity:kw,originX:wX,originY:wX,originZ:Vt},zIndex:aee,fillOpacity:kw,strokeOpacity:kw,numOctaves:aee},Wze={...y7,color:Sr,backgroundColor:Sr,outlineColor:Sr,fill:Sr,stroke:Sr,borderColor:Sr,borderTopColor:Sr,borderRightColor:Sr,borderBottomColor:Sr,borderLeftColor:Sr,filter:b7,WebkitFilter:b7},ree=t=>Wze[t];function iee(t,e){let n=ree(t);return n!==b7&&(n=Op),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Kze=new Set(["auto","none","0"]);function Zze(t,e,n){let a=0,r;for(;a<t.length&&!r;){const i=t[a];typeof i=="string"&&!Kze.has(i)&&_w(i).values.length&&(r=t[a]),a++}if(r&&n)for(const i of e)t[i]=iee(n,r)}class Vze extends c7{constructor(e,n,a,r,i){super(e,n,a,r,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:a}=this;if(!n||!n.current)return;super.readKeyframes();for(let d=0;d<e.length;d++){let p=e[d];if(typeof p=="string"&&(p=p.trim(),$5(p))){const m=YX(p,n.current);m!==void 0&&(e[d]=m),d===e.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!KX.has(a)||e.length!==2)return;const[r,i]=e,o=nee(r),s=nee(i),l=bX(r),u=bX(i);if(l!==u&&jp[a]){this.needsMeasurement=!0;return}if(o!==s)if(RX(o)&&RX(s))for(let d=0;d<e.length;d++){const p=e[d];typeof p=="string"&&(e[d]=parseFloat(p))}else jp[a]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,a=[];for(let r=0;r<e.length;r++)(e[r]===null||zze(e[r]))&&a.push(r);a.length&&Zze(e,a,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:a}=this;if(!e||!e.current)return;a==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=jp[a](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const r=n[n.length-1];r!==void 0&&e.getValue(a,r).jump(r,!1)}measureEndState(){var s;const{element:e,name:n,unresolvedKeyframes:a}=this;if(!e||!e.current)return;const r=e.getValue(n);r&&r.jump(this.measuredOrigin,!1);const i=a.length-1,o=a[i];a[i]=jp[n](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(s=this.removedTransforms)!=null&&s.length&&this.removedTransforms.forEach(([l,u])=>{e.getValue(l).set(u)}),this.resolveNoneKeyframes()}}function Jze(t,e,n){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){const r=document.querySelectorAll(t);return r?Array.from(r):[]}return Array.from(t).filter(a=>a!=null)}const oee=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function Xze(t){return XJ(t)&&"offsetHeight"in t}const{schedule:w7,cancel:jgn}=gX(queueMicrotask,!1),Jc={x:!1,y:!1};function see(){return Jc.x||Jc.y}function eHe(t){return t==="x"||t==="y"?Jc[t]?null:(Jc[t]=!0,()=>{Jc[t]=!1}):Jc.x||Jc.y?null:(Jc.x=Jc.y=!0,()=>{Jc.x=Jc.y=!1})}function cee(t,e){const n=Jze(t),a=new AbortController,r={passive:!0,...e,signal:a.signal};return[n,r,()=>a.abort()]}function lee(t){return!(t.pointerType==="touch"||see())}function tHe(t,e,n={}){const[a,r,i]=cee(t,n),o=s=>{if(!lee(s))return;const{target:l}=s,u=e(l,s);if(typeof u!="function"||!l)return;const d=p=>{lee(p)&&(u(p),l.removeEventListener("pointerleave",d))};l.addEventListener("pointerleave",d,r)};return a.forEach(s=>{s.addEventListener("pointerenter",o,r)}),i}const uee=(t,e)=>e?t===e?!0:uee(t,e.parentElement):!1,k7=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,nHe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function dee(t){return nHe.has(t.tagName)||t.isContentEditable===!0}const XE=new WeakSet;function pee(t){return e=>{e.key==="Enter"&&t(e)}}function v7(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const aHe=(t,e)=>{const n=t.currentTarget;if(!n)return;const a=pee(()=>{if(XE.has(n))return;v7(n,"down");const r=pee(()=>{v7(n,"up")}),i=()=>v7(n,"cancel");n.addEventListener("keyup",r,e),n.addEventListener("blur",i,e)});n.addEventListener("keydown",a,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",a),e)};function mee(t){return k7(t)&&!see()}function rHe(t,e,n={}){const[a,r,i]=cee(t,n),o=s=>{const l=s.currentTarget;if(!mee(s))return;XE.add(l);const u=e(l,s),d=(A,g)=>{window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",m),XE.has(l)&&XE.delete(l),mee(A)&&typeof u=="function"&&u(A,{success:g})},p=A=>{d(A,l===window||l===document||n.useGlobalTarget||uee(l,A.target))},m=A=>{d(A,!1)};window.addEventListener("pointerup",p,r),window.addEventListener("pointercancel",m,r)};return a.forEach(s=>{(n.useGlobalTarget?window:s).addEventListener("pointerdown",o,r),Xze(s)&&(s.addEventListener("focus",u=>aHe(u,r)),!dee(s)&&!s.hasAttribute("tabindex")&&(s.tabIndex=0))}),i}function Aee(t){return XJ(t)&&"ownerSVGElement"in t}function iHe(t){return Aee(t)&&t.tagName==="svg"}const oHe=[...tee,Sr,Op],sHe=t=>oHe.find(eee(t)),gee=()=>({translate:0,scale:1,origin:0,originPoint:0}),Rf=()=>({x:gee(),y:gee()}),hee=()=>({min:0,max:0}),Kr=()=>({x:hee(),y:hee()}),C7={current:null},fee={current:!1},cHe=typeof window<"u";function lHe(){if(fee.current=!0,!!cHe)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>C7.current=t.matches;t.addEventListener("change",e),e()}else C7.current=!1}const uHe=new WeakMap;function eB(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Bw(t){return typeof t=="string"||Array.isArray(t)}const _7=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],x7=["initial",..._7];function tB(t){return eB(t.animate)||x7.some(e=>Bw(t[e]))}function bee(t){return!!(tB(t)||t.variants)}function dHe(t,e,n){for(const a in e){const r=e[a],i=n[a];if(eo(r))t.addValue(a,r);else if(eo(i))t.addValue(a,Mf(r,{owner:t}));else if(i!==r)if(t.hasValue(a)){const o=t.getValue(a);o.liveStyle===!0?o.jump(r):o.hasAnimated||o.set(r)}else{const o=t.getStaticValue(a);t.addValue(a,Mf(o!==void 0?o:r,{owner:t}))}}for(const a in n)e[a]===void 0&&t.removeValue(a);return e}const yee=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let nB={};function wee(t){nB=t}function pHe(){return nB}class mHe{scrapeMotionValuesFromProps(e,n,a){return{}}constructor({parent:e,props:n,presenceContext:a,reducedMotionConfig:r,blockInitialAnimation:i,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=c7,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const m=So.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,Ma.render(this.render,!1,!0))};const{latestValues:l,renderState:u}=o;this.latestValues=l,this.baseTarget={...l},this.initialValues=n.initial?{...l}:{},this.renderState=u,this.parent=e,this.props=n,this.presenceContext=a,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.options=s,this.blockInitialAnimation=!!i,this.isControllingVariants=tB(n),this.isVariantNode=bee(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...p}=this.scrapeMotionValuesFromProps(n,{},this);for(const m in p){const A=p[m];l[m]!==void 0&&eo(A)&&A.set(l[m])}}mount(e){var n;this.current=e,uHe.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((a,r)=>this.bindToMotionValue(r,a)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(fee.current||lHe(),this.shouldReduceMotion=C7.current),(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),Pp(this.notifyUpdate),Pp(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const a=this.features[n];a&&(a.unmount(),a.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const a=Lf.has(e);a&&this.onBindTransform&&this.onBindTransform();const r=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&Ma.preRender(this.notifyUpdate),a&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;typeof window<"u"&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{r(),i&&i(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in nB){const n=nB[e];if(!n)continue;const{isEnabled:a,Feature:r}=n;if(!this.features[e]&&r&&a(this.props)&&(this.features[e]=new r(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Kr()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let a=0;a<yee.length;a++){const r=yee[a];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const i="on"+r,o=e[i];o&&(this.propEventSubscriptions[r]=this.on(r,o))}this.prevMotionValues=dHe(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const a=this.values.get(e);n!==a&&(a&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let a=this.values.get(e);return a===void 0&&n!==void 0&&(a=Mf(n===null?void 0:n,{owner:this}),this.addValue(e,a)),a}readValue(e,n){let a=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return a!=null&&(typeof a=="string"&&(JJ(a)||eX(a))?a=parseFloat(a):!sHe(a)&&Op.test(n)&&(a=iee(e,n)),this.setBaseTarget(e,eo(a)?a.get():a)),eo(a)?a.get():a}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var i;const{initial:n}=this.props;let a;if(typeof n=="string"||typeof n=="object"){const o=m7(this.props,n,(i=this.presenceContext)==null?void 0:i.custom);o&&(a=o[e])}if(n&&a!==void 0)return a;const r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!eo(r)?r:this.initialValues[e]!==void 0&&a===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new N5),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){w7.render(this.render)}}class kee extends mHe{constructor(){super(...arguments),this.KeyframeResolver=Vze}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){const a=e.style;return a?a[n]:void 0}removeValueFromRenderState(e,{vars:n,style:a}){delete n[e],delete a[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;eo(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class Gp{constructor(e){this.isMounted=!1,this.node=e}update(){}}function vee({top:t,left:e,right:n,bottom:a}){return{x:{min:e,max:n},y:{min:t,max:a}}}function AHe({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function gHe(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),a=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:a.y,right:a.x}}function E7(t){return t===void 0||t===1}function B7({scale:t,scaleX:e,scaleY:n}){return!E7(t)||!E7(e)||!E7(n)}function YA(t){return B7(t)||Cee(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Cee(t){return _ee(t.x)||_ee(t.y)}function _ee(t){return t&&t!=="0%"}function aB(t,e,n){const a=t-n,r=e*a;return n+r}function xee(t,e,n,a,r){return r!==void 0&&(t=aB(t,r,a)),aB(t,n,a)+e}function I7(t,e=0,n=1,a,r){t.min=xee(t.min,e,n,a,r),t.max=xee(t.max,e,n,a,r)}function Eee(t,{x:e,y:n}){I7(t.x,e.translate,e.scale,e.originPoint),I7(t.y,n.translate,n.scale,n.originPoint)}const Bee=.999999999999,Iee=1.0000000000001;function hHe(t,e,n,a=!1){const r=n.length;if(!r)return;e.x=e.y=1;let i,o;for(let s=0;s<r;s++){i=n[s],o=i.projectionDelta;const{visualElement:l}=i.options;l&&l.props.style&&l.props.style.display==="contents"||(a&&i.options.layoutScroll&&i.scroll&&i!==i.root&&$f(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,Eee(t,o)),a&&YA(i.latestValues)&&$f(t,i.latestValues))}e.x<Iee&&e.x>Bee&&(e.x=1),e.y<Iee&&e.y>Bee&&(e.y=1)}function Pf(t,e){t.min=t.min+e,t.max=t.max+e}function Dee(t,e,n,a,r=.5){const i=ir(t.min,t.max,r);I7(t,e,n,i,a)}function $f(t,e){Dee(t.x,e.x,e.scaleX,e.scale,e.originX),Dee(t.y,e.y,e.scaleY,e.scale,e.originY)}function Qee(t,e){return vee(gHe(t.getBoundingClientRect(),e))}function fHe(t,e,n){const a=Qee(t,n),{scroll:r}=e;return r&&(Pf(a.x,r.offset.x),Pf(a.y,r.offset.y)),a}const bHe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},yHe=Ff.length;function wHe(t,e,n){let a="",r=!0;for(let i=0;i<yHe;i++){const o=Ff[i],s=t[o];if(s===void 0)continue;let l=!0;if(typeof s=="number"?l=s===(o.startsWith("scale")?1:0):l=parseFloat(s)===0,!l||n){const u=oee(s,y7[o]);if(!l){r=!1;const d=bHe[o]||o;a+=`${d}(${u}) `}n&&(e[o]=u)}}return a=a.trim(),n?a=n(e,r?"":a):r&&(a="none"),a}function D7(t,e,n){const{style:a,vars:r,transformOrigin:i}=t;let o=!1,s=!1;for(const l in e){const u=e[l];if(Lf.has(l)){o=!0;continue}else if(fX(l)){r[l]=u;continue}else{const d=oee(u,y7[l]);l.startsWith("origin")?(s=!0,i[l]=d):a[l]=d}}if(e.transform||(o||n?a.transform=wHe(e,t.transform,n):a.transform&&(a.transform="none")),s){const{originX:l="50%",originY:u="50%",originZ:d=0}=i;a.transformOrigin=`${l} ${u} ${d}`}}function See(t,{style:e,vars:n},a,r){const i=t.style;let o;for(o in e)i[o]=e[o];r==null||r.applyProjectionStyles(i,a);for(o in n)i.setProperty(o,n[o])}function Tee(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Iw={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Vt.test(t))t=parseFloat(t);else return t;const n=Tee(t,e.target.x),a=Tee(t,e.target.y);return`${n}% ${a}%`}},kHe={correct:(t,{treeScale:e,projectionDelta:n})=>{const a=t,r=Op.parse(t);if(r.length>5)return a;const i=Op.createTransformer(t),o=typeof r[0]!="number"?1:0,s=n.x.scale*e.x,l=n.y.scale*e.y;r[0+o]/=s,r[1+o]/=l;const u=ir(s,l,.5);return typeof r[2+o]=="number"&&(r[2+o]/=u),typeof r[3+o]=="number"&&(r[3+o]/=u),i(r)}},Q7={borderRadius:{...Iw,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Iw,borderTopRightRadius:Iw,borderBottomLeftRadius:Iw,borderBottomRightRadius:Iw,boxShadow:kHe};function Fee(t,{layout:e,layoutId:n}){return Lf.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Q7[t]||t==="opacity")}function S7(t,e,n){var o;const a=t.style,r=e==null?void 0:e.style,i={};if(!a)return i;for(const s in a)(eo(a[s])||r&&eo(r[s])||Fee(s,t)||((o=n==null?void 0:n.getValue(s))==null?void 0:o.liveStyle)!==void 0)&&(i[s]=a[s]);return i}function vHe(t){return window.getComputedStyle(t)}class CHe extends kee{constructor(){super(...arguments),this.type="html",this.renderInstance=See}readValueFromInstance(e,n){var a;if(Lf.has(n))return(a=this.projection)!=null&&a.isProjecting?a7(n):Xqe(e,n);{const r=vHe(e),i=(fX(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return Qee(e,n)}build(e,n,a){D7(e,n,a.transformTemplate)}scrapeMotionValuesFromProps(e,n,a){return S7(e,n,a)}}const _He={offset:"stroke-dashoffset",array:"stroke-dasharray"},xHe={offset:"strokeDashoffset",array:"strokeDasharray"};function EHe(t,e,n=1,a=0,r=!0){t.pathLength=1;const i=r?_He:xHe;t[i.offset]=`${-a}`,t[i.array]=`${e} ${n}`}const BHe=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Lee(t,{attrX:e,attrY:n,attrScale:a,pathLength:r,pathSpacing:i=1,pathOffset:o=0,...s},l,u,d){if(D7(t,s,u),l){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:p,style:m}=t;p.transform&&(m.transform=p.transform,delete p.transform),(m.transform||p.transformOrigin)&&(m.transformOrigin=p.transformOrigin??"50% 50%",delete p.transformOrigin),m.transform&&(m.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete p.transformBox);for(const A of BHe)p[A]!==void 0&&(m[A]=p[A],delete p[A]);e!==void 0&&(p.x=e),n!==void 0&&(p.y=n),a!==void 0&&(p.scale=a),r!==void 0&&EHe(p,r,i,o,!1)}const Nee=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),Mee=t=>typeof t=="string"&&t.toLowerCase()==="svg";function IHe(t,e,n,a){See(t,e,void 0,a);for(const r in e.attrs)t.setAttribute(Nee.has(r)?r:h7(r),e.attrs[r])}function Ree(t,e,n){const a=S7(t,e,n);for(const r in t)if(eo(t[r])||eo(e[r])){const i=Ff.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;a[i]=t[r]}return a}class DHe extends kee{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Kr}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Lf.has(n)){const a=ree(n);return a&&a.default||0}return n=Nee.has(n)?n:h7(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,a){return Ree(e,n,a)}build(e,n,a){Lee(e,n,this.isSVGTag,a.transformTemplate,a.style)}renderInstance(e,n,a,r){IHe(e,n,a,r)}mount(e){this.isSVGTag=Mee(e.tagName),super.mount(e)}}const QHe=x7.length;function Pee(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?Pee(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<QHe;n++){const a=x7[n],r=t.props[a];(Bw(r)||r===!1)&&(e[a]=r)}return e}function $ee(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let a=0;a<n;a++)if(e[a]!==t[a])return!1;return!0}const SHe=[..._7].reverse(),THe=_7.length;function FHe(t){return e=>Promise.all(e.map(({animation:n,options:a})=>Gze(t,n,a)))}function LHe(t){let e=FHe(t),n=Oee(),a=!0;const r=l=>(u,d)=>{var m;const p=Nf(t,d,l==="exit"?(m=t.presenceContext)==null?void 0:m.custom:void 0);if(p){const{transition:A,transitionEnd:g,...h}=p;u={...u,...h,...g}}return u};function i(l){e=l(t)}function o(l){const{props:u}=t,d=Pee(t.parent)||{},p=[],m=new Set;let A={},g=1/0;for(let f=0;f<THe;f++){const b=SHe[f],y=n[b],w=u[b]!==void 0?u[b]:d[b],k=Bw(w),C=b===l?y.isActive:null;C===!1&&(g=f);let x=w===d[b]&&w!==u[b]&&k;if(x&&a&&t.manuallyAnimateOnMount&&(x=!1),y.protectedKeys={...A},!y.isActive&&C===null||!w&&!y.prevProp||eB(w)||typeof w=="boolean")continue;const _=NHe(y.prevProp,w);let E=_||b===l&&y.isActive&&!x&&k||f>g&&k,I=!1;const Q=Array.isArray(w)?w:[w];let D=Q.reduce(r(b),{});C===!1&&(D={});const{prevResolvedValues:T={}}=y,N={...T,...D},B=L=>{E=!0,m.has(L)&&(I=!0,m.delete(L)),y.needsAnimating[L]=!0;const F=t.getValue(L);F&&(F.liveStyle=!1)};for(const L in N){const F=D[L],R=T[L];if(A.hasOwnProperty(L))continue;let P=!1;A7(F)&&A7(R)?P=!$ee(F,R):P=F!==R,P?F!=null?B(L):m.add(L):F!==void 0&&m.has(L)?B(L):y.protectedKeys[L]=!0}y.prevProp=w,y.prevResolvedValues=D,y.isActive&&(A={...A,...D}),a&&t.blockInitialAnimation&&(E=!1);const S=x&&_;E&&(!S||I)&&p.push(...Q.map(L=>{const F={type:b};if(typeof L=="string"&&a&&!S&&t.manuallyAnimateOnMount&&t.parent){const{parent:R}=t,P=Nf(R,L);if(R.enteringChildren&&P){const{delayChildren:$}=P.transition||{};F.delay=UX(R.enteringChildren,t,$)}}return{animation:L,options:F}}))}if(m.size){const f={};if(typeof u.initial!="boolean"){const b=Nf(t,Array.isArray(u.initial)?u.initial[0]:u.initial);b&&b.transition&&(f.transition=b.transition)}m.forEach(b=>{const y=t.getBaseTarget(b),w=t.getValue(b);w&&(w.liveStyle=!0),f[b]=y??null}),p.push({animation:f})}let h=!!p.length;return a&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(h=!1),a=!1,h?e(p):Promise.resolve()}function s(l,u){var p;if(n[l].isActive===u)return Promise.resolve();(p=t.variantChildren)==null||p.forEach(m=>{var A;return(A=m.animationState)==null?void 0:A.setActive(l,u)}),n[l].isActive=u;const d=o(l);for(const m in n)n[m].protectedKeys={};return d}return{animateChanges:o,setActive:s,setAnimateFunction:i,getState:()=>n,reset:()=>{n=Oee()}}}function NHe(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!$ee(e,t):!1}function WA(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Oee(){return{animate:WA(!0),whileInView:WA(),whileHover:WA(),whileTap:WA(),whileDrag:WA(),whileFocus:WA(),exit:WA()}}function jee(t,e){t.min=e.min,t.max=e.max}function Xc(t,e){jee(t.x,e.x),jee(t.y,e.y)}function Gee(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const qee=1e-4,MHe=1-qee,RHe=1+qee,zee=.01,PHe=0-zee,$He=0+zee;function To(t){return t.max-t.min}function OHe(t,e,n){return Math.abs(t-e)<=n}function Hee(t,e,n,a=.5){t.origin=a,t.originPoint=ir(e.min,e.max,t.origin),t.scale=To(n)/To(e),t.translate=ir(n.min,n.max,t.origin)-t.originPoint,(t.scale>=MHe&&t.scale<=RHe||isNaN(t.scale))&&(t.scale=1),(t.translate>=PHe&&t.translate<=$He||isNaN(t.translate))&&(t.translate=0)}function Dw(t,e,n,a){Hee(t.x,e.x,n.x,a?a.originX:void 0),Hee(t.y,e.y,n.y,a?a.originY:void 0)}function Uee(t,e,n){t.min=n.min+e.min,t.max=t.min+To(e)}function jHe(t,e,n){Uee(t.x,e.x,n.x),Uee(t.y,e.y,n.y)}function Yee(t,e,n){t.min=e.min-n.min,t.max=t.min+To(e)}function rB(t,e,n){Yee(t.x,e.x,n.x),Yee(t.y,e.y,n.y)}function Wee(t,e,n,a,r){return t-=e,t=aB(t,1/n,a),r!==void 0&&(t=aB(t,1/r,a)),t}function GHe(t,e=0,n=1,a=.5,r,i=t,o=t){if(Jl.test(e)&&(e=parseFloat(e),e=ir(o.min,o.max,e/100)-o.min),typeof e!="number")return;let s=ir(i.min,i.max,a);t===i&&(s-=e),t.min=Wee(t.min,e,n,s,r),t.max=Wee(t.max,e,n,s,r)}function Kee(t,e,[n,a,r],i,o){GHe(t,e[n],e[a],e[r],e.scale,i,o)}const qHe=["x","scaleX","originX"],zHe=["y","scaleY","originY"];function Zee(t,e,n,a){Kee(t.x,e,qHe,n?n.x:void 0,a?a.x:void 0),Kee(t.y,e,zHe,n?n.y:void 0,a?a.y:void 0)}function Vee(t){return t.translate===0&&t.scale===1}function Jee(t){return Vee(t.x)&&Vee(t.y)}function Xee(t,e){return t.min===e.min&&t.max===e.max}function HHe(t,e){return Xee(t.x,e.x)&&Xee(t.y,e.y)}function ete(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function tte(t,e){return ete(t.x,e.x)&&ete(t.y,e.y)}function nte(t){return To(t.x)/To(t.y)}function ate(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function mc(t){return[t("x"),t("y")]}function UHe(t,e,n){let a="";const r=t.x.translate/e.x,i=t.y.translate/e.y,o=(n==null?void 0:n.z)||0;if((r||i||o)&&(a=`translate3d(${r}px, ${i}px, ${o}px) `),(e.x!==1||e.y!==1)&&(a+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:p,rotateY:m,skewX:A,skewY:g}=n;u&&(a=`perspective(${u}px) ${a}`),d&&(a+=`rotate(${d}deg) `),p&&(a+=`rotateX(${p}deg) `),m&&(a+=`rotateY(${m}deg) `),A&&(a+=`skewX(${A}deg) `),g&&(a+=`skewY(${g}deg) `)}const s=t.x.scale*e.x,l=t.y.scale*e.y;return(s!==1||l!==1)&&(a+=`scale(${s}, ${l})`),a||"none"}const rte=["TopLeft","TopRight","BottomLeft","BottomRight"],YHe=rte.length,ite=t=>typeof t=="string"?parseFloat(t):t,ote=t=>typeof t=="number"||Vt.test(t);function WHe(t,e,n,a,r,i){r?(t.opacity=ir(0,n.opacity??1,KHe(a)),t.opacityExit=ir(e.opacity??1,0,ZHe(a))):i&&(t.opacity=ir(e.opacity??1,n.opacity??1,a));for(let o=0;o<YHe;o++){const s=`border${rte[o]}Radius`;let l=ste(e,s),u=ste(n,s);if(l===void 0&&u===void 0)continue;l||(l=0),u||(u=0),l===0||u===0||ote(l)===ote(u)?(t[s]=Math.max(ir(ite(l),ite(u),a),0),(Jl.test(u)||Jl.test(l))&&(t[s]+="%")):t[s]=u}(e.rotate||n.rotate)&&(t.rotate=ir(e.rotate||0,n.rotate||0,a))}function ste(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const KHe=cte(0,.5,cX),ZHe=cte(.5,.95,dc);function cte(t,e,n){return a=>a<t?0:a>e?1:n(yw(t,e,a))}function VHe(t,e,n){const a=eo(t)?t:Mf(t);return a.start(p7("",a,e,n)),a.animation}function Qw(t,e,n,a={passive:!0}){return t.addEventListener(e,n,a),()=>t.removeEventListener(e,n)}const JHe=(t,e)=>t.depth-e.depth;class XHe{constructor(){this.children=[],this.isDirty=!1}add(e){S5(this.children,e),this.isDirty=!0}remove(e){T5(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(JHe),this.isDirty=!1,this.children.forEach(e)}}function eUe(t,e){const n=So.now(),a=({timestamp:r})=>{const i=r-n;i>=e&&(Pp(a),t(i-e))};return Ma.setup(a,!0),()=>Pp(a)}function iB(t){return eo(t)?t.get():t}class tUe{constructor(){this.members=[]}add(e){S5(this.members,e),e.scheduleRender()}remove(e){if(T5(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(r=>e===r);if(n===0)return!1;let a;for(let r=n;r>=0;r--){const i=this.members[r];if(i.isPresent!==!1){a=i;break}}return a?(this.promote(a),!0):!1}promote(e,n){const a=this.lead;if(e!==a&&(this.prevLead=a,this.lead=e,e.show(),a)){a.instance&&a.scheduleRender(),e.scheduleRender(),e.resumeFrom=a,n&&(e.resumeFrom.preserveOpacity=!0),a.snapshot&&(e.snapshot=a.snapshot,e.snapshot.latestValues=a.animationValues||a.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:r}=e.options;r===!1&&a.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:a}=e;n.onExitComplete&&n.onExitComplete(),a&&a.options.onExitComplete&&a.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const oB={hasAnimatedSinceResize:!0,hasEverUpdated:!1},T7=["","X","Y","Z"],nUe=1e3;let aUe=0;function F7(t,e,n,a){const{latestValues:r}=e;r[t]&&(n[t]=r[t],e.setStaticValue(t,0),a&&(a[t]=0))}function lte(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=JX(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Ma,!(r||i))}const{parent:a}=t;a&&!a.hasCheckedOptimisedAppear&<e(a)}function ute({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:a,resetTransform:r}){return class{constructor(o={},s=e==null?void 0:e()){this.id=aUe++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(oUe),this.nodes.forEach(uUe),this.nodes.forEach(dUe),this.nodes.forEach(sUe)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new XHe)}addEventListener(o,s){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new N5),this.eventHandlers.get(o).add(s)}notifyListeners(o,...s){const l=this.eventHandlers.get(o);l&&l.notify(...s)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=Aee(o)&&!iHe(o),this.instance=o;const{layoutId:s,layout:l,visualElement:u}=this.options;if(u&&!u.current&&u.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||s)&&(this.isLayoutDirty=!0),t){let d,p=0;const m=()=>this.root.updateBlockedByResize=!1;Ma.read(()=>{p=window.innerWidth}),t(o,()=>{const A=window.innerWidth;A!==p&&(p=A,this.root.updateBlockedByResize=!0,d&&d(),d=eUe(m,250),oB.hasAnimatedSinceResize&&(oB.hasAnimatedSinceResize=!1,this.nodes.forEach(mte)))})}s&&this.root.registerSharedNode(s,this),this.options.animate!==!1&&u&&(s||l)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:p,hasRelativeLayoutChanged:m,layout:A})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||u.getDefaultTransition()||hUe,{onLayoutAnimationStart:h,onLayoutAnimationComplete:f}=u.getProps(),b=!this.targetLayout||!tte(this.targetLayout,A),y=!p&&m;if(this.options.layoutRoot||this.resumeFrom||y||p&&(b||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const w={...d7(g,"layout"),onPlay:h,onComplete:f};(u.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w),this.setAnimationOrigin(d,y)}else p||mte(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=A})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Pp(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(pUe),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&<e(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const p=this.path[d];p.shouldResetTransform=!0,p.updateScroll("snapshot"),p.options.layoutRoot&&p.willUpdate(!1)}const{layoutId:s,layout:l}=this.options;if(s===void 0&&!l)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(dte);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(pte);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(lUe),this.nodes.forEach(rUe),this.nodes.forEach(iUe)):this.nodes.forEach(pte),this.clearAllSnapshots();const s=So.now();Ti.delta=Zl(0,1e3/60,s-Ti.timestamp),Ti.timestamp=s,Ti.isProcessing=!0,P5.update.process(Ti),P5.preRender.process(Ti),P5.render.process(Ti),Ti.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,w7.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(cUe),this.sharedNodes.forEach(mUe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ma.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ma.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!To(this.snapshot.measuredBox.x)&&!To(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Kr(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:s}=this.options;s&&s.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let s=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(s=!1),s&&this.instance){const l=a(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!r)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,s=this.projectionDelta&&!Jee(this.projectionDelta),l=this.getTransformTemplate(),u=l?l(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&this.instance&&(s||YA(this.latestValues)||d)&&(r(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const s=this.measurePageBox();let l=this.removeElementScroll(s);return o&&(l=this.removeTransform(l)),fUe(l),{animationId:this.root.animationId,measuredBox:s,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:o}=this.options;if(!o)return Kr();const s=o.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(bUe))){const{scroll:d}=this.root;d&&(Pf(s.x,d.offset.x),Pf(s.y,d.offset.y))}return s}removeElementScroll(o){var l;const s=Kr();if(Xc(s,o),(l=this.scroll)!=null&&l.wasRoot)return s;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:p,options:m}=d;d!==this.root&&p&&m.layoutScroll&&(p.wasRoot&&Xc(s,o),Pf(s.x,p.offset.x),Pf(s.y,p.offset.y))}return s}applyTransform(o,s=!1){const l=Kr();Xc(l,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];!s&&d.options.layoutScroll&&d.scroll&&d!==d.root&&$f(l,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),YA(d.latestValues)&&$f(l,d.latestValues)}return YA(this.latestValues)&&$f(l,this.latestValues),l}removeTransform(o){const s=Kr();Xc(s,o);for(let l=0;l<this.path.length;l++){const u=this.path[l];if(!u.instance||!YA(u.latestValues))continue;B7(u.latestValues)&&u.updateSnapshot();const d=Kr(),p=u.measurePageBox();Xc(d,p),Zee(s,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return YA(this.latestValues)&&Zee(s,this.latestValues),s}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ti.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var A;const s=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=s.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=s.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=s.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==s;if(!(o||l&&this.isSharedProjectionDirty||this.isProjectionDirty||(A=this.parent)!=null&&A.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:p}=this.options;if(!this.layout||!(d||p))return;this.resolvedRelativeTargetAt=Ti.timestamp;const m=this.getClosestProjectingParent();m&&this.linkedParentVersion!==m.layoutVersion&&!m.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(m&&m.layout?this.createRelativeTarget(m,this.layout.layoutBox,m.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Kr(),this.targetWithTransforms=Kr()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),jHe(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Xc(this.target,this.layout.layoutBox),Eee(this.target,this.targetDelta)):Xc(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,m&&!!m.resumingFrom==!!this.resumingFrom&&!m.options.layoutScroll&&m.target&&this.animationProgress!==1?this.createRelativeTarget(m,this.target,m.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||B7(this.parent.latestValues)||Cee(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,s,l){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Kr(),this.relativeTargetOrigin=Kr(),rB(this.relativeTargetOrigin,s,l),Xc(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var g;const o=this.getLead(),s=!!this.resumingFrom||this!==o;let l=!0;if((this.isProjectionDirty||(g=this.parent)!=null&&g.isProjectionDirty)&&(l=!1),s&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===Ti.timestamp&&(l=!1),l)return;const{layout:u,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||d))return;Xc(this.layoutCorrected,this.layout.layoutBox);const p=this.treeScale.x,m=this.treeScale.y;hHe(this.layoutCorrected,this.treeScale,this.path,s),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=Kr());const{target:A}=o;if(!A){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Gee(this.prevProjectionDelta.x,this.projectionDelta.x),Gee(this.prevProjectionDelta.y,this.projectionDelta.y)),Dw(this.projectionDelta,this.layoutCorrected,A,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==m||!ate(this.projectionDelta.x,this.prevProjectionDelta.x)||!ate(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",A))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var s;if((s=this.options.visualElement)==null||s.scheduleRender(),o){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Rf(),this.projectionDelta=Rf(),this.projectionDeltaWithTransform=Rf()}setAnimationOrigin(o,s=!1){const l=this.snapshot,u=l?l.latestValues:{},d={...this.latestValues},p=Rf();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!s;const m=Kr(),A=l?l.source:void 0,g=this.layout?this.layout.source:void 0,h=A!==g,f=this.getStack(),b=!f||f.members.length<=1,y=!!(h&&!b&&this.options.crossfade===!0&&!this.path.some(gUe));this.animationProgress=0;let w;this.mixTargetDelta=k=>{const C=k/1e3;Ate(p.x,o.x,C),Ate(p.y,o.y,C),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(rB(m,this.layout.layoutBox,this.relativeParent.layout.layoutBox),AUe(this.relativeTarget,this.relativeTargetOrigin,m,C),w&&HHe(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=Kr()),Xc(w,this.relativeTarget)),h&&(this.animationValues=d,WHe(d,u,this.latestValues,C,y,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=C},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var s,l,u;this.notifyListeners("animationStart"),(s=this.currentAnimation)==null||s.stop(),(u=(l=this.resumingFrom)==null?void 0:l.currentAnimation)==null||u.stop(),this.pendingAnimation&&(Pp(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ma.update(()=>{oB.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Mf(0)),this.currentAnimation=VHe(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),o.onUpdate&&o.onUpdate(d)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(nUe),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:s,target:l,layout:u,latestValues:d}=o;if(!(!s||!l||!u)){if(this!==o&&this.layout&&u&&yte(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||Kr();const p=To(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+p;const m=To(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+m}Xc(s,l),$f(s,d),Dw(this.projectionDeltaWithTransform,this.layoutCorrected,s,d)}}registerSharedNode(o,s){this.sharedNodes.has(o)||this.sharedNodes.set(o,new tUe),this.sharedNodes.get(o).add(s);const u=s.options.initialPromotionConfig;s.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(s):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var s;const{layoutId:o}=this.options;return o?((s=this.getStack())==null?void 0:s.lead)||this:this}getPrevLead(){var s;const{layoutId:o}=this.options;return o?(s=this.getStack())==null?void 0:s.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:s,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),s&&this.setOptions({transition:s})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let s=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(s=!0),!s)return;const u={};l.z&&F7("z",o,u,this.animationValues);for(let d=0;d<T7.length;d++)F7(`rotate${T7[d]}`,o,u,this.animationValues),F7(`skew${T7[d]}`,o,u,this.animationValues);o.render();for(const d in u)o.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);o.scheduleRender()}applyProjectionStyles(o,s){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=iB(s==null?void 0:s.pointerEvents)||"",o.transform=l?l(this.latestValues,""):"none";return}const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=iB(s==null?void 0:s.pointerEvents)||""),this.hasProjected&&!YA(this.latestValues)&&(o.transform=l?l({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let p=UHe(this.projectionDeltaWithTransform,this.treeScale,d);l&&(p=l(d,p)),o.transform=p;const{x:m,y:A}=this.projectionDelta;o.transformOrigin=`${m.origin*100}% ${A.origin*100}% 0`,u.animationValues?o.opacity=u===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:o.opacity=u===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const g in Q7){if(d[g]===void 0)continue;const{correct:h,applyTo:f,isCSSVariable:b}=Q7[g],y=p==="none"?d[g]:h(d[g],u);if(f){const w=f.length;for(let k=0;k<w;k++)o[f[k]]=y}else b?this.options.visualElement.renderState.vars[g]=y:o[g]=y}this.options.layoutId&&(o.pointerEvents=u===this?iB(s==null?void 0:s.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var s;return(s=o.currentAnimation)==null?void 0:s.stop()}),this.root.nodes.forEach(dte),this.root.sharedNodes.clear()}}}function rUe(t){t.updateLayout()}function iUe(t){var n;const e=((n=t.resumeFrom)==null?void 0:n.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:a,measuredBox:r}=t.layout,{animationType:i}=t.options,o=e.source!==t.layout.source;i==="size"?mc(p=>{const m=o?e.measuredBox[p]:e.layoutBox[p],A=To(m);m.min=a[p].min,m.max=m.min+A}):yte(i,e.layoutBox,a)&&mc(p=>{const m=o?e.measuredBox[p]:e.layoutBox[p],A=To(a[p]);m.max=m.min+A,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[p].max=t.relativeTarget[p].min+A)});const s=Rf();Dw(s,a,e.layoutBox);const l=Rf();o?Dw(l,t.applyTransform(r,!0),e.measuredBox):Dw(l,a,e.layoutBox);const u=!Jee(s);let d=!1;if(!t.resumeFrom){const p=t.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:m,layout:A}=p;if(m&&A){const g=Kr();rB(g,e.layoutBox,m.layoutBox);const h=Kr();rB(h,a,A.layoutBox),tte(g,h)||(d=!0),p.options.layoutRoot&&(t.relativeTarget=h,t.relativeTargetOrigin=g,t.relativeParent=p)}}}t.notifyListeners("didUpdate",{layout:a,snapshot:e,delta:l,layoutDelta:s,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(t.isLead()){const{onExitComplete:a}=t.options;a&&a()}t.options.transition=void 0}function oUe(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function sUe(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function cUe(t){t.clearSnapshot()}function dte(t){t.clearMeasurements()}function pte(t){t.isLayoutDirty=!1}function lUe(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function mte(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function uUe(t){t.resolveTargetDelta()}function dUe(t){t.calcProjection()}function pUe(t){t.resetSkewAndRotation()}function mUe(t){t.removeLeadSnapshot()}function Ate(t,e,n){t.translate=ir(e.translate,0,n),t.scale=ir(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function gte(t,e,n,a){t.min=ir(e.min,n.min,a),t.max=ir(e.max,n.max,a)}function AUe(t,e,n,a){gte(t.x,e.x,n.x,a),gte(t.y,e.y,n.y,a)}function gUe(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const hUe={duration:.45,ease:[.4,0,.1,1]},hte=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),fte=hte("applewebkit/")&&!hte("chrome/")?Math.round:dc;function bte(t){t.min=fte(t.min),t.max=fte(t.max)}function fUe(t){bte(t.x),bte(t.y)}function yte(t,e,n){return t==="position"||t==="preserve-aspect"&&!OHe(nte(e),nte(n),.2)}function bUe(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const yUe=ute({attachResizeListener:(t,e)=>Qw(t,"resize",e),measureScroll:()=>{var t,e;return{x:document.documentElement.scrollLeft||((t=document.body)==null?void 0:t.scrollLeft)||0,y:document.documentElement.scrollTop||((e=document.body)==null?void 0:e.scrollTop)||0}},checkIsScrollRoot:()=>!0}),L7={current:void 0},wte=ute({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!L7.current){const t=new yUe({});t.mount(window),t.setOptions({layoutScroll:!0}),L7.current=t}return L7.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),kte=be.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function wUe(t=!0){const e=be.useContext(Q5);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:a,register:r}=e,i=be.useId();be.useEffect(()=>{if(t)return r(i)},[t]);const o=be.useCallback(()=>t&&a&&a(i),[i,a,t]);return!n&&a?[!1,o]:[!0]}const vte=be.createContext({strict:!1}),Cte={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let _te=!1;function kUe(){if(_te)return;const t={};for(const e in Cte)t[e]={isEnabled:n=>Cte[e].some(a=>!!n[a])};wee(t),_te=!0}function xte(){return kUe(),pHe()}function vUe(t){const e=xte();for(const n in t)e[n]={...e[n],...t[n]};wee(e)}const CUe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function sB(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||CUe.has(t)}let Ete=t=>!sB(t);function _Ue(t){typeof t=="function"&&(Ete=e=>e.startsWith("on")?!sB(e):t(e))}try{_Ue(require("@emotion/is-prop-valid").default)}catch{}function xUe(t,e,n){const a={};for(const r in t)r==="values"&&typeof t.values=="object"||(Ete(r)||n===!0&&sB(r)||!e&&!sB(r)||t.draggable&&r.startsWith("onDrag"))&&(a[r]=t[r]);return a}const cB=be.createContext({});function EUe(t,e){if(tB(t)){const{initial:n,animate:a}=t;return{initial:n===!1||Bw(n)?n:void 0,animate:Bw(a)?a:void 0}}return t.inherit!==!1?e:{}}function BUe(t){const{initial:e,animate:n}=EUe(t,be.useContext(cB));return be.useMemo(()=>({initial:e,animate:n}),[Bte(e),Bte(n)])}function Bte(t){return Array.isArray(t)?t.join(" "):t}const N7=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Ite(t,e,n){for(const a in e)!eo(e[a])&&!Fee(a,n)&&(t[a]=e[a])}function IUe({transformTemplate:t},e){return be.useMemo(()=>{const n=N7();return D7(n,e,t),Object.assign({},n.vars,n.style)},[e])}function DUe(t,e){const n=t.style||{},a={};return Ite(a,n,t),Object.assign(a,IUe(t,e)),a}function QUe(t,e){const n={},a=DUe(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=a,n}const Dte=()=>({...N7(),attrs:{}});function SUe(t,e,n,a){const r=be.useMemo(()=>{const i=Dte();return Lee(i,e,Mee(a),t.transformTemplate,t.style),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};Ite(i,t.style,t),r.style={...i,...r.style}}return r}const TUe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function M7(t){return typeof t!="string"||t.includes("-")?!1:!!(TUe.indexOf(t)>-1||/[A-Z]/u.test(t))}function FUe(t,e,n,{latestValues:a},r,i=!1,o){const l=(o??M7(t)?SUe:QUe)(e,a,r,t),u=xUe(e,typeof t=="string",i),d=t!==be.Fragment?{...u,...l,ref:n}:{},{children:p}=e,m=be.useMemo(()=>eo(p)?p.get():p,[p]);return be.createElement(t,{...d,children:m})}function LUe({scrapeMotionValuesFromProps:t,createRenderState:e},n,a,r){return{latestValues:NUe(n,a,r,t),renderState:e()}}function NUe(t,e,n,a){const r={},i=a(t,{});for(const m in i)r[m]=iB(i[m]);let{initial:o,animate:s}=t;const l=tB(t),u=bee(t);e&&u&&!l&&t.inherit!==!1&&(o===void 0&&(o=e.initial),s===void 0&&(s=e.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const p=d?s:o;if(p&&typeof p!="boolean"&&!eB(p)){const m=Array.isArray(p)?p:[p];for(let A=0;A<m.length;A++){const g=m7(t,m[A]);if(g){const{transitionEnd:h,transition:f,...b}=g;for(const y in b){let w=b[y];if(Array.isArray(w)){const k=d?w.length-1:0;w=w[k]}w!==null&&(r[y]=w)}for(const y in h)r[y]=h[y]}}}return r}const Qte=t=>(e,n)=>{const a=be.useContext(cB),r=be.useContext(Q5),i=()=>LUe(t,e,a,r);return n?i():ZGe(i)},MUe=Qte({scrapeMotionValuesFromProps:S7,createRenderState:N7}),RUe=Qte({scrapeMotionValuesFromProps:Ree,createRenderState:Dte}),PUe=Symbol.for("motionComponentSymbol");function $Ue(t,e,n){const a=be.useRef(n);be.useInsertionEffect(()=>{a.current=n});const r=be.useRef(null);return be.useCallback(i=>{var s;i&&((s=t.onMount)==null||s.call(t,i)),e&&(i?e.mount(i):e.unmount());const o=a.current;if(typeof o=="function")if(i){const l=o(i);typeof l=="function"&&(r.current=l)}else r.current?(r.current(),r.current=null):o(i);else o&&(o.current=i)},[e])}const Ste=be.createContext({});function Sw(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function OUe(t,e,n,a,r,i){var f,b;const{visualElement:o}=be.useContext(cB),s=be.useContext(vte),l=be.useContext(Q5),u=be.useContext(kte).reducedMotion,d=be.useRef(null);a=a||s.renderer,!d.current&&a&&(d.current=a(t,{visualState:e,parent:o,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u,isSVG:i}));const p=d.current,m=be.useContext(Ste);p&&!p.projection&&r&&(p.type==="html"||p.type==="svg")&&jUe(d.current,n,r,m);const A=be.useRef(!1);be.useInsertionEffect(()=>{p&&A.current&&p.update(n,l)});const g=n[VX],h=be.useRef(!!g&&!((f=window.MotionHandoffIsComplete)!=null&&f.call(window,g))&&((b=window.MotionHasOptimisedAnimation)==null?void 0:b.call(window,g)));return VGe(()=>{p&&(A.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),p.scheduleRenderMicrotask(),h.current&&p.animationState&&p.animationState.animateChanges())}),be.useEffect(()=>{p&&(!h.current&&p.animationState&&p.animationState.animateChanges(),h.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)==null||y.call(window,g)}),h.current=!1),p.enteringChildren=void 0)}),p}function jUe(t,e,n,a){const{layoutId:r,layout:i,drag:o,dragConstraints:s,layoutScroll:l,layoutRoot:u,layoutCrossfade:d}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Tte(t.parent)),t.projection.setOptions({layoutId:r,layout:i,alwaysMeasureLayout:!!o||s&&Sw(s),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:a,crossfade:d,layoutScroll:l,layoutRoot:u})}function Tte(t){if(t)return t.options.allowProjection!==!1?t.projection:Tte(t.parent)}function R7(t,{forwardMotionProps:e=!1,type:n}={},a,r){a&&vUe(a);const i=n?n==="svg":M7(t),o=i?RUe:MUe;function s(u,d){let p;const m={...be.useContext(kte),...u,layoutId:GUe(u)},{isStatic:A}=m,g=BUe(u),h=o(u,A);if(!A&&ZJ){qUe();const f=zUe(m);p=f.MeasureLayout,g.visualElement=OUe(t,h,m,r,f.ProjectionNode,i)}return H.jsxs(cB.Provider,{value:g,children:[p&&g.visualElement?H.jsx(p,{visualElement:g.visualElement,...m}):null,FUe(t,u,$Ue(h,g.visualElement,d),h,A,e,i)]})}s.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const l=be.forwardRef(s);return l[PUe]=t,l}function GUe({layoutId:t}){const e=be.useContext(KJ).id;return e&&t!==void 0?e+"-"+t:t}function qUe(t,e){be.useContext(vte).strict}function zUe(t){const e=xte(),{drag:n,layout:a}=e;if(!n&&!a)return{};const r={...n,...a};return{MeasureLayout:n!=null&&n.isEnabled(t)||a!=null&&a.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function HUe(t,e){if(typeof Proxy>"u")return R7;const n=new Map,a=(i,o)=>R7(i,o,t,e),r=(i,o)=>a(i,o);return new Proxy(r,{get:(i,o)=>o==="create"?a:(n.has(o)||n.set(o,R7(o,void 0,t,e)),n.get(o))})}const UUe=(t,e)=>e.isSVG??M7(t)?new DHe(e):new CHe(e,{allowProjection:t!==be.Fragment});class YUe extends Gp{constructor(e){super(e),e.animationState||(e.animationState=LHe(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();eB(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let WUe=0;class KUe extends Gp{constructor(){super(...arguments),this.id=WUe++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:a}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===a)return;const r=this.node.animationState.setActive("exit",!e);n&&!e&&r.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const ZUe={animation:{Feature:YUe},exit:{Feature:KUe}};function Tw(t){return{point:{x:t.pageX,y:t.pageY}}}const VUe=t=>e=>k7(e)&&t(e,Tw(e));function Fw(t,e,n,a){return Qw(t,e,VUe(n),a)}const Fte=({current:t})=>t?t.ownerDocument.defaultView:null,Lte=(t,e)=>Math.abs(t-e);function JUe(t,e){const n=Lte(t.x,e.x),a=Lte(t.y,e.y);return Math.sqrt(n**2+a**2)}const Nte=new Set(["auto","scroll"]);class Mte{constructor(e,n,{transformPagePoint:a,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:o=3,element:s}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=A=>{this.handleScroll(A.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const A=$7(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,h=JUe(A.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!h)return;const{point:f}=A,{timestamp:b}=Ti;this.history.push({...f,timestamp:b});const{onStart:y,onMove:w}=this.handlers;g||(y&&y(this.lastMoveEvent,A),this.startEvent=this.lastMoveEvent),w&&w(this.lastMoveEvent,A)},this.handlePointerMove=(A,g)=>{this.lastMoveEvent=A,this.lastMoveEventInfo=P7(g,this.transformPagePoint),Ma.update(this.updatePoint,!0)},this.handlePointerUp=(A,g)=>{this.end();const{onEnd:h,onSessionEnd:f,resumeAnimation:b}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=$7(A.type==="pointercancel"?this.lastMoveEventInfo:P7(g,this.transformPagePoint),this.history);this.startEvent&&h&&h(A,y),f&&f(A,y)},!k7(e))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=a,this.distanceThreshold=o,this.contextWindow=r||window;const l=Tw(e),u=P7(l,this.transformPagePoint),{point:d}=u,{timestamp:p}=Ti;this.history=[{...d,timestamp:p}];const{onSessionStart:m}=n;m&&m(e,$7(u,this.history)),this.removeListeners=bw(Fw(this.contextWindow,"pointermove",this.handlePointerMove),Fw(this.contextWindow,"pointerup",this.handlePointerUp),Fw(this.contextWindow,"pointercancel",this.handlePointerUp)),s&&this.startScrollTracking(s)}startScrollTracking(e){let n=e.parentElement;for(;n;){const a=getComputedStyle(n);(Nte.has(a.overflowX)||Nte.has(a.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const n=this.scrollPositions.get(e);if(!n)return;const a=e===window,r=a?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-n.x,y:r.y-n.y};i.x===0&&i.y===0||(a?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),Ma.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Pp(this.updatePoint)}}function P7(t,e){return e?{point:e(t.point)}:t}function Rte(t,e){return{x:t.x-e.x,y:t.y-e.y}}function $7({point:t},e){return{point:t,delta:Rte(t,Pte(e)),offset:Rte(t,XUe(e)),velocity:eYe(e,.1)}}function XUe(t){return t[0]}function Pte(t){return t[t.length-1]}function eYe(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,a=null;const r=Pte(t);for(;n>=0&&(a=t[n],!(r.timestamp-a.timestamp>Vl(e)));)n--;if(!a)return{x:0,y:0};const i=pc(r.timestamp-a.timestamp);if(i===0)return{x:0,y:0};const o={x:(r.x-a.x)/i,y:(r.y-a.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function tYe(t,{min:e,max:n},a){return e!==void 0&&t<e?t=a?ir(e,t,a.min):Math.max(t,e):n!==void 0&&t>n&&(t=a?ir(n,t,a.max):Math.min(t,n)),t}function $te(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function nYe(t,{top:e,left:n,bottom:a,right:r}){return{x:$te(t.x,n,r),y:$te(t.y,e,a)}}function Ote(t,e){let n=e.min-t.min,a=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,a]=[a,n]),{min:n,max:a}}function aYe(t,e){return{x:Ote(t.x,e.x),y:Ote(t.y,e.y)}}function rYe(t,e){let n=.5;const a=To(t),r=To(e);return r>a?n=yw(e.min,e.max-a,t.min):a>r&&(n=yw(t.min,t.max-r,e.min)),Zl(0,1,n)}function iYe(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const O7=.35;function oYe(t=O7){return t===!1?t=0:t===!0&&(t=O7),{x:jte(t,"left","right"),y:jte(t,"top","bottom")}}function jte(t,e,n){return{min:Gte(t,e),max:Gte(t,n)}}function Gte(t,e){return typeof t=="number"?t:t[e]||0}const sYe=new WeakMap;class cYe{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Kr(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:a}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=p=>{n?(this.stopAnimation(),this.snapToCursor(Tw(p).point)):this.pauseAnimation()},o=(p,m)=>{this.stopAnimation();const{drag:A,dragPropagation:g,onDragStart:h}=this.getProps();if(A&&!g&&(this.openDragLock&&this.openDragLock(),this.openDragLock=eHe(A),!this.openDragLock))return;this.latestPointerEvent=p,this.latestPanInfo=m,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),mc(b=>{let y=this.getAxisMotionValue(b).get()||0;if(Jl.test(y)){const{projection:w}=this.visualElement;if(w&&w.layout){const k=w.layout.layoutBox[b];k&&(y=To(k)*(parseFloat(y)/100))}}this.originPoint[b]=y}),h&&Ma.postRender(()=>h(p,m)),g7(this.visualElement,"transform");const{animationState:f}=this.visualElement;f&&f.setActive("whileDrag",!0)},s=(p,m)=>{this.latestPointerEvent=p,this.latestPanInfo=m;const{dragPropagation:A,dragDirectionLock:g,onDirectionLock:h,onDrag:f}=this.getProps();if(!A&&!this.openDragLock)return;const{offset:b}=m;if(g&&this.currentDirection===null){this.currentDirection=lYe(b),this.currentDirection!==null&&h&&h(this.currentDirection);return}this.updateAxis("x",m.point,b),this.updateAxis("y",m.point,b),this.visualElement.render(),f&&f(p,m)},l=(p,m)=>{this.latestPointerEvent=p,this.latestPanInfo=m,this.stop(p,m),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>mc(p=>{var m;return this.getAnimationState(p)==="paused"&&((m=this.getAxisMotionValue(p).animation)==null?void 0:m.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new Mte(e,{onSessionStart:i,onStart:o,onMove:s,onSessionEnd:l,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:a,contextWindow:Fte(this.visualElement),element:this.visualElement.current})}stop(e,n){const a=e||this.latestPointerEvent,r=n||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!a)return;const{velocity:o}=r;this.startAnimation(o);const{onDragEnd:s}=this.getProps();s&&Ma.postRender(()=>s(a,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:a}=this.getProps();!a&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,n,a){const{drag:r}=this.getProps();if(!a||!lB(e,r,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+a[e];this.constraints&&this.constraints[e]&&(o=tYe(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){var i;const{dragConstraints:e,dragElastic:n}=this.getProps(),a=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(i=this.visualElement.projection)==null?void 0:i.layout,r=this.constraints;e&&Sw(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&a?this.constraints=nYe(a.layoutBox,e):this.constraints=!1,this.elastic=oYe(n),r!==this.constraints&&a&&this.constraints&&!this.hasMutatedConstraints&&mc(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=iYe(a.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Sw(e))return!1;const a=e.current;qA(a!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const i=fHe(a,r.root,this.visualElement.getTransformPagePoint());let o=aYe(r.layout.layoutBox,i);if(n){const s=n(AHe(o));this.hasMutatedConstraints=!!s,s&&(o=vee(s))}return o}startAnimation(e){const{drag:n,dragMomentum:a,dragElastic:r,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:s}=this.getProps(),l=this.constraints||{},u=mc(d=>{if(!lB(d,n,this.currentDirection))return;let p=l&&l[d]||{};o&&(p={min:0,max:0});const m=r?200:1e6,A=r?40:1e7,g={type:"inertia",velocity:a?e[d]:0,bounceStiffness:m,bounceDamping:A,timeConstant:750,restDelta:1,restSpeed:10,...i,...p};return this.startAxisValueAnimation(d,g)});return Promise.all(u).then(s)}startAxisValueAnimation(e,n){const a=this.getAxisMotionValue(e);return g7(this.visualElement,e),a.start(p7(e,a,0,n,this.visualElement,!1))}stopAnimation(){mc(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){mc(e=>{var n;return(n=this.getAxisMotionValue(e).animation)==null?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)==null?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,a=this.visualElement.getProps(),r=a[n];return r||this.visualElement.getValue(e,(a.initial?a.initial[e]:void 0)||0)}snapToCursor(e){mc(n=>{const{drag:a}=this.getProps();if(!lB(n,a,this.currentDirection))return;const{projection:r}=this.visualElement,i=this.getAxisMotionValue(n);if(r&&r.layout){const{min:o,max:s}=r.layout.layoutBox[n],l=i.get()||0;i.set(e[n]-ir(o,s,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:a}=this.visualElement;if(!Sw(n)||!a||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};mc(o=>{const s=this.getAxisMotionValue(o);if(s&&this.constraints!==!1){const l=s.get();r[o]=rYe({min:l,max:l},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",a.root&&a.root.updateScroll(),a.updateLayout(),this.resolveConstraints(),mc(o=>{if(!lB(o,e,null))return;const s=this.getAxisMotionValue(o),{min:l,max:u}=this.constraints[o];s.set(ir(l,u,r[o]))})}addListeners(){if(!this.visualElement.current)return;sYe.set(this.visualElement,this);const e=this.visualElement.current,n=Fw(e,"pointerdown",l=>{const{drag:u,dragListener:d=!0}=this.getProps(),p=l.target,m=p!==e&&dee(p);u&&d&&!m&&this.start(l)}),a=()=>{const{dragConstraints:l}=this.getProps();Sw(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,i=r.addEventListener("measure",a);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),Ma.read(a);const o=Qw(window,"resize",()=>this.scalePositionWithinConstraints()),s=r.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(mc(d=>{const p=this.getAxisMotionValue(d);p&&(this.originPoint[d]+=l[d].translate,p.set(p.get()+l[d].translate))}),this.visualElement.render())});return()=>{o(),n(),i(),s&&s()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:a=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:o=O7,dragMomentum:s=!0}=e;return{...e,drag:n,dragDirectionLock:a,dragPropagation:r,dragConstraints:i,dragElastic:o,dragMomentum:s}}}function lB(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function lYe(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class uYe extends Gp{constructor(e){super(e),this.removeGroupControls=dc,this.removeListeners=dc,this.controls=new cYe(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||dc}update(){const{dragControls:e}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.endPanSession()}}const qte=t=>(e,n)=>{t&&Ma.postRender(()=>t(e,n))};class dYe extends Gp{constructor(){super(...arguments),this.removePointerDownListener=dc}onPointerDown(e){this.session=new Mte(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Fte(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:a,onPanEnd:r}=this.node.getProps();return{onSessionStart:qte(e),onStart:qte(n),onMove:a,onEnd:(i,o)=>{delete this.session,r&&Ma.postRender(()=>r(i,o))}}}mount(){this.removePointerDownListener=Fw(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let j7=!1;class pYe extends be.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:a,layoutId:r}=this.props,{projection:i}=e;i&&(n.group&&n.group.add(i),a&&a.register&&r&&a.register(i),j7&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),oB.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:a,drag:r,isPresent:i}=this.props,{projection:o}=a;return o&&(o.isPresent=i,j7=!0,r||e.layoutDependency!==n||n===void 0||e.isPresent!==i?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||Ma.postRender(()=>{const s=o.getStack();(!s||!s.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),w7.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:a}=this.props,{projection:r}=e;j7=!0,r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),a&&a.deregister&&a.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function zte(t){const[e,n]=wUe(),a=be.useContext(KJ);return H.jsx(pYe,{...t,layoutGroup:a,switchLayoutGroup:be.useContext(Ste),isPresent:e,safeToRemove:n})}const mYe={pan:{Feature:dYe},drag:{Feature:uYe,ProjectionNode:wte,MeasureLayout:zte}};function Hte(t,e,n){const{props:a}=t;t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,i=a[r];i&&Ma.postRender(()=>i(e,Tw(e)))}class AYe extends Gp{mount(){const{current:e}=this.node;e&&(this.unmount=tHe(e,(n,a)=>(Hte(this.node,a,"Start"),r=>Hte(this.node,r,"End"))))}unmount(){}}class gYe extends Gp{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=bw(Qw(this.node.current,"focus",()=>this.onFocus()),Qw(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Ute(t,e,n){const{props:a}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&a.whileTap&&t.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),i=a[r];i&&Ma.postRender(()=>i(e,Tw(e)))}class hYe extends Gp{mount(){const{current:e}=this.node;e&&(this.unmount=rHe(e,(n,a)=>(Ute(this.node,a,"Start"),(r,{success:i})=>Ute(this.node,r,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const G7=new WeakMap,q7=new WeakMap,fYe=t=>{const e=G7.get(t.target);e&&e(t)},bYe=t=>{t.forEach(fYe)};function yYe({root:t,...e}){const n=t||document;q7.has(n)||q7.set(n,{});const a=q7.get(n),r=JSON.stringify(e);return a[r]||(a[r]=new IntersectionObserver(bYe,{root:t,...e})),a[r]}function wYe(t,e,n){const a=yYe(e);return G7.set(t,n),a.observe(t),()=>{G7.delete(t),a.unobserve(t)}}const kYe={some:0,all:1};class vYe extends Gp{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:a,amount:r="some",once:i}=e,o={root:n?n.current:void 0,rootMargin:a,threshold:typeof r=="number"?r:kYe[r]},s=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:p}=this.node.getProps(),m=u?d:p;m&&m(l)};return wYe(this.node.current,o,s)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(CYe(e,n))&&this.startObserver()}unmount(){}}function CYe({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const _Ye={...ZUe,...{inView:{Feature:vYe},tap:{Feature:hYe},focus:{Feature:gYe},hover:{Feature:AYe}},...mYe,...{layout:{ProjectionNode:wte,MeasureLayout:zte}}},xYe=HUe(_Ye,UUe),EYe=({children:t,as:e="p",className:n,duration:a=2,spread:r=2})=>{const i=xYe.create(e),o=be.useMemo(()=>((t==null?void 0:t.length)??0)*r,[t,r]);return H.jsx(i,{animate:{backgroundPosition:"0% center"},className:Tn("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent","[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",n),initial:{backgroundPosition:"100% center"},style:{"--spread":`${o}px`,backgroundImage:"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"},transition:{repeat:Number.POSITIVE_INFINITY,duration:a,ease:"linear"},children:t})},BYe=be.memo(EYe),Yte=be.createContext(null),IYe=()=>{const t=be.useContext(Yte);if(!t)throw new Error("Reasoning components must be used within Reasoning");return t},DYe=1e3,QYe=1e3,Wte=be.memo(({className:t,isStreaming:e=!1,open:n,defaultOpen:a=!0,onOpenChange:r,duration:i,children:o,...s})=>{const[l,u]=sf({prop:n,defaultProp:a,onChange:r}),[d,p]=sf({prop:i,defaultProp:void 0}),[m,A]=be.useState(!1),[g,h]=be.useState(null);be.useEffect(()=>{e?g===null&&h(Date.now()):g!==null&&(p(Math.ceil((Date.now()-g)/QYe)),h(null))},[e,g,p]),be.useEffect(()=>{if(a&&!e&&l&&!m){const b=setTimeout(()=>{u(!1),A(!0)},DYe);return()=>clearTimeout(b)}},[e,l,a,u,m]);const f=b=>{u(b)};return H.jsx(Yte.Provider,{value:{isStreaming:e,isOpen:l,setIsOpen:u,duration:d},children:H.jsx(B5,{className:Tn("not-prose mb-4",t),onOpenChange:f,open:l,...s,children:o})})}),SYe=(t,e)=>t||e===0?H.jsx(BYe,{duration:1,children:"Thinking..."}):e===void 0?H.jsx("p",{children:"Thought for a few seconds"}):H.jsxs("p",{children:["Thought for ",e," seconds"]}),Kte=be.memo(({className:t,children:e,getThinkingMessage:n=SYe,...a})=>{const{isStreaming:r,isOpen:i,duration:o}=IYe();return H.jsx(I5,{className:Tn("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",t),...a,children:e??H.jsxs(H.Fragment,{children:[H.jsx(UQe,{className:"size-4"}),n(r,o),H.jsx(n9,{className:Tn("size-4 transition-transform",i?"rotate-180":"rotate-0")})]})})}),Zte=be.memo(({className:t,children:e,...n})=>H.jsx(D5,{className:Tn("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",t),...n,children:H.jsx(v5,{...n,children:e})}));Wte.displayName="Reasoning",Kte.displayName="ReasoningTrigger",Zte.displayName="ReasoningContent";const TYe=({className:t,...e})=>H.jsx(B5,{className:Tn("not-prose mb-4 text-primary text-xs",t),...e}),FYe=({className:t,count:e,children:n,...a})=>H.jsx(I5,{className:Tn("flex items-center gap-2",t),...a,children:n??H.jsxs(H.Fragment,{children:[H.jsxs("p",{className:"font-medium",children:["Used ",e," sources"]}),H.jsx(n9,{className:"h-4 w-4"})]})}),LYe=({className:t,...e})=>H.jsx(D5,{className:Tn("mt-3 flex w-fit flex-col gap-2","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",t),...e}),NYe=({href:t,title:e,children:n,...a})=>H.jsx("a",{className:"flex items-center gap-2",href:t,rel:"noreferrer",target:"_blank",...a,children:n??H.jsxs(H.Fragment,{children:[H.jsx(HQe,{className:"h-4 w-4"}),H.jsx("span",{className:"block font-medium",children:e})]})}),MYe=kx("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function RYe({className:t,variant:e,asChild:n=!1,...a}){const r=n?gH:"span";return H.jsx(r,{"data-slot":"badge",className:Tn(MYe({variant:e}),t),...a})}let Tr=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function PYe(t){return z7(t)}function z7(t){return Array.isArray(t)?$Ye(t):t instanceof RegExp?t:typeof t=="object"?OYe(t):t}function $Ye(t){let e=[];for(let n=0,a=t.length;n<a;n++)e[n]=z7(t[n]);return e}function OYe(t){let e={};for(let n in t)e[n]=z7(t[n]);return e}function Vte(t,...e){return e.forEach(n=>{for(let a in n)t[a]=n[a]}),t}function Jte(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?Jte(t.substring(0,t.length-1)):t.substr(~e+1)}var H7=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,uB=class{static hasCaptures(t){return t===null?!1:(H7.lastIndex=0,H7.test(t))}static replaceCaptures(t,e,n){return t.replace(H7,(a,r,i,o)=>{let s=n[parseInt(r||i,10)];if(s){let l=e.substring(s.start,s.end);for(;l[0]===".";)l=l.substring(1);switch(o){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return a})}};function Xte(t,e){return t<e?-1:t>e?1:0}function ene(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,a=e.length;if(n===a){for(let r=0;r<n;r++){let i=Xte(t[r],e[r]);if(i!==0)return i}return 0}return n-a}function tne(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function nne(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var ane=class{constructor(t){We(this,"cache",new Map);this.fn=t}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},dB=class{constructor(e,n,a){We(this,"_cachedMatchRoot",new ane(e=>this._root.match(e)));this._colorMap=e,this._defaults=n,this._root=a}static createFromRawTheme(e,n){return this.createFromParsedTheme(qYe(e),n)}static createFromParsedTheme(e,n){return HYe(e,n)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const n=e.scopeName,r=this._cachedMatchRoot.get(n).find(i=>jYe(e.parent,i.parentScopes));return r?new rne(r.fontStyle,r.foreground,r.background):null}},U7=class NQ{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const a of n)e=new NQ(e,a);return e}static from(...e){let n=null;for(let a=0;a<e.length;a++)n=new NQ(n,e[a]);return n}push(e){return new NQ(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let a=this;for(;a&&a!==e;)n.push(a.scopeName),a=a.parent;return a===e?n.reverse():void 0}};function jYe(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let a=e[n],r=!1;if(a===">"){if(n===e.length-1)return!1;a=e[++n],r=!0}for(;t&&!GYe(t.scopeName,a);){if(r)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function GYe(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var rne=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function qYe(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],a=0;for(let r=0,i=e.length;r<i;r++){let o=e[r];if(!o.settings)continue;let s;if(typeof o.scope=="string"){let p=o.scope;p=p.replace(/^[,]+/,""),p=p.replace(/[,]+$/,""),s=p.split(",")}else Array.isArray(o.scope)?s=o.scope:s=[""];let l=-1;if(typeof o.settings.fontStyle=="string"){l=0;let p=o.settings.fontStyle.split(" ");for(let m=0,A=p.length;m<A;m++)switch(p[m]){case"italic":l=l|1;break;case"bold":l=l|2;break;case"underline":l=l|4;break;case"strikethrough":l=l|8;break}}let u=null;typeof o.settings.foreground=="string"&&tne(o.settings.foreground)&&(u=o.settings.foreground);let d=null;typeof o.settings.background=="string"&&tne(o.settings.background)&&(d=o.settings.background);for(let p=0,m=s.length;p<m;p++){let g=s[p].trim().split(" "),h=g[g.length-1],f=null;g.length>1&&(f=g.slice(0,g.length-1),f.reverse()),n[a++]=new zYe(h,f,r,l,u,d)}}return n}var zYe=class{constructor(t,e,n,a,r,i){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=a,this.foreground=r,this.background=i}},to=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(to||{});function HYe(t,e){t.sort((l,u)=>{let d=Xte(l.scope,u.scope);return d!==0||(d=ene(l.parentScopes,u.parentScopes),d!==0)?d:l.index-u.index});let n=0,a="#000000",r="#ffffff";for(;t.length>=1&&t[0].scope==="";){let l=t.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(a=l.foreground),l.background!==null&&(r=l.background)}let i=new UYe(e),o=new rne(n,i.getId(a),i.getId(r)),s=new WYe(new Y7(0,null,-1,0,0),[]);for(let l=0,u=t.length;l<u;l++){let d=t[l];s.insert(0,d.scope,d.parentScopes,d.fontStyle,i.getId(d.foreground),i.getId(d.background))}return new dB(i,o,s)}var UYe=class{constructor(t){We(this,"_isFrozen");We(this,"_lastColorId");We(this,"_id2color");We(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},YYe=Object.freeze([]),Y7=class u8e{constructor(e,n,a,r,i){We(this,"scopeDepth");We(this,"parentScopes");We(this,"fontStyle");We(this,"foreground");We(this,"background");this.scopeDepth=e,this.parentScopes=n||YYe,this.fontStyle=a,this.foreground=r,this.background=i}clone(){return new u8e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let a=0,r=e.length;a<r;a++)n[a]=e[a].clone();return n}acceptOverwrite(e,n,a,r){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),a!==0&&(this.foreground=a),r!==0&&(this.background=r)}},WYe=class oH{constructor(e,n=[],a={}){We(this,"_rulesWithParentScopes");this._mainRule=e,this._children=a,this._rulesWithParentScopes=n}static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let a=0,r=0;for(;e.parentScopes[a]===">"&&a++,n.parentScopes[r]===">"&&r++,!(a>=e.parentScopes.length||r>=n.parentScopes.length);){const i=n.parentScopes[r].length-e.parentScopes[a].length;if(i!==0)return i;a++,r++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let a=e.indexOf("."),r,i;if(a===-1?(r=e,i=""):(r=e.substring(0,a),i=e.substring(a+1)),this._children.hasOwnProperty(r))return this._children[r].match(i)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(oH._cmpBySpecificity),n}insert(e,n,a,r,i,o){if(n===""){this._doInsertHere(e,a,r,i,o);return}let s=n.indexOf("."),l,u;s===-1?(l=n,u=""):(l=n.substring(0,s),u=n.substring(s+1));let d;this._children.hasOwnProperty(l)?d=this._children[l]:(d=new oH(this._mainRule.clone(),Y7.cloneArr(this._rulesWithParentScopes)),this._children[l]=d),d.insert(e+1,u,a,r,i,o)}_doInsertHere(e,n,a,r,i){if(n===null){this._mainRule.acceptOverwrite(e,a,r,i);return}for(let o=0,s=this._rulesWithParentScopes.length;o<s;o++){let l=this._rulesWithParentScopes[o];if(ene(l.parentScopes,n)===0){l.acceptOverwrite(e,a,r,i);return}}a===-1&&(a=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Y7(e,n,a,r,i))}},Of=class Uc{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=Uc.getLanguageId(e),a=Uc.getTokenType(e),r=Uc.getFontStyle(e),i=Uc.getForeground(e),o=Uc.getBackground(e);console.log({languageId:n,tokenType:a,fontStyle:r,foreground:i,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,a,r,i,o,s){let l=Uc.getLanguageId(e),u=Uc.getTokenType(e),d=Uc.containsBalancedBrackets(e)?1:0,p=Uc.getFontStyle(e),m=Uc.getForeground(e),A=Uc.getBackground(e);return n!==0&&(l=n),a!==8&&(u=a),r!==null&&(d=r?1:0),i!==-1&&(p=i),o!==0&&(m=o),s!==0&&(A=s),(l<<0|u<<8|d<<10|p<<11|m<<15|A<<24)>>>0}};function zgn(t){return t}function Hgn(t){return t}function pB(t,e){const n=[],a=KYe(t);let r=a.next();for(;r!==null;){let l=0;if(r.length===2&&r.charAt(1)===":"){switch(r.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=a.next()}let u=o();if(n.push({matcher:u,priority:l}),r!==",")break;r=a.next()}return n;function i(){if(r==="-"){r=a.next();const l=i();return u=>!!l&&!l(u)}if(r==="("){r=a.next();const l=s();return r===")"&&(r=a.next()),l}if(ine(r)){const l=[];do l.push(r),r=a.next();while(ine(r));return u=>e(l,u)}return null}function o(){const l=[];let u=i();for(;u;)l.push(u),u=i();return d=>l.every(p=>p(d))}function s(){const l=[];let u=o();for(;u&&(l.push(u),r==="|"||r===",");){do r=a.next();while(r==="|"||r===",");u=o()}return d=>l.some(p=>p(d))}}function ine(t){return!!t&&!!t.match(/[\w\.:]+/)}function KYe(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const a=n[0];return n=e.exec(t),a}}}function one(t){typeof t.dispose=="function"&&t.dispose()}var Lw=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},ZYe=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},VYe=class{constructor(){We(this,"_references",[]);We(this,"_seenReferenceKeys",new Set);We(this,"visitedRule",new Set)}get references(){return this._references}add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},JYe=class{constructor(t,e){We(this,"seenFullScopeRequests",new Set);We(this,"seenPartialScopeRequests",new Set);We(this,"Q");this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Lw(this.initialScopeName)]}processQueue(){const t=this.Q;this.Q=[];const e=new VYe;for(const n of t)XYe(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof Lw){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function XYe(t,e,n,a){const r=n.lookup(t.scopeName);if(!r){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const i=n.lookup(e);t instanceof Lw?mB({baseGrammar:i,selfGrammar:r},a):W7(t.ruleName,{baseGrammar:i,selfGrammar:r,repository:r.repository},a);const o=n.injections(t.scopeName);if(o)for(const s of o)a.add(new Lw(s))}function W7(t,e,n){if(e.repository&&e.repository[t]){const a=e.repository[t];AB([a],e,n)}}function mB(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&AB(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&AB(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function AB(t,e,n){for(const a of t){if(n.visitedRule.has(a))continue;n.visitedRule.add(a);const r=a.repository?Vte({},e.repository,a.repository):e.repository;Array.isArray(a.patterns)&&AB(a.patterns,{...e,repository:r},n);const i=a.include;if(!i)continue;const o=sne(i);switch(o.kind){case 0:mB({...e,selfGrammar:e.baseGrammar},n);break;case 1:mB(e,n);break;case 2:W7(o.ruleName,{...e,repository:r},n);break;case 3:case 4:const s=o.scopeName===e.selfGrammar.scopeName?e.selfGrammar:o.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(s){const l={baseGrammar:e.baseGrammar,selfGrammar:s,repository:r};o.kind===4?W7(o.ruleName,l,n):mB(l,n)}else o.kind===4?n.add(new ZYe(o.scopeName,o.ruleName)):n.add(new Lw(o.scopeName));break}}}var eWe=class{constructor(){We(this,"kind",0)}},tWe=class{constructor(){We(this,"kind",1)}},nWe=class{constructor(t){We(this,"kind",2);this.ruleName=t}},aWe=class{constructor(t){We(this,"kind",3);this.scopeName=t}},rWe=class{constructor(t,e){We(this,"kind",4);this.scopeName=t,this.ruleName=e}};function sne(t){if(t==="$base")return new eWe;if(t==="$self")return new tWe;const e=t.indexOf("#");if(e===-1)return new aWe(t);if(e===0)return new nWe(t.substring(1));{const n=t.substring(0,e),a=t.substring(e+1);return new rWe(n,a)}}var iWe=/\\(\d+)/,cne=/\\(\d+)/g,oWe=-1,lne=-2;function Ugn(t){return t}function Ygn(t){return t}var Nw=class{constructor(e,n,a,r){We(this,"$location");We(this,"id");We(this,"_nameIsCapturing");We(this,"_name");We(this,"_contentNameIsCapturing");We(this,"_contentName");this.$location=e,this.id=n,this._name=a||null,this._nameIsCapturing=uB.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=uB.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${Jte(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,n){return!this._nameIsCapturing||this._name===null||e===null||n===null?this._name:uB.replaceCaptures(this._name,e,n)}getContentName(e,n){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:uB.replaceCaptures(this._contentName,e,n)}},sWe=class extends Nw{constructor(e,n,a,r,i){super(e,n,a,r);We(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,n){throw new Error("Not supported!")}compile(e,n){throw new Error("Not supported!")}compileAG(e,n,a,r){throw new Error("Not supported!")}},cWe=class extends Nw{constructor(e,n,a,r,i){super(e,n,a,null);We(this,"_match");We(this,"captures");We(this,"_cachedCompiledPatterns");this._match=new Mw(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,n){n.push(this._match)}compile(e,n){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,n,a,r){return this._getCachedCompiledPatterns(e).compileAG(e,a,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Rw,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},une=class extends Nw{constructor(e,n,a,r,i){super(e,n,a,r);We(this,"hasMissingPatterns");We(this,"patterns");We(this,"_cachedCompiledPatterns");this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,n){for(const a of this.patterns)e.getRule(a).collectPatterns(e,n)}compile(e,n){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,n,a,r){return this._getCachedCompiledPatterns(e).compileAG(e,a,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Rw,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},K7=class extends Nw{constructor(e,n,a,r,i,o,s,l,u,d){super(e,n,a,r);We(this,"_begin");We(this,"beginCaptures");We(this,"_end");We(this,"endHasBackReferences");We(this,"endCaptures");We(this,"applyEndPatternLast");We(this,"hasMissingPatterns");We(this,"patterns");We(this,"_cachedCompiledPatterns");this._begin=new Mw(i,this.id),this.beginCaptures=o,this._end=new Mw(s||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=l,this.applyEndPatternLast=u||!1,this.patterns=d.patterns,this.hasMissingPatterns=d.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,n){return this._end.resolveBackReferences(e,n)}collectPatterns(e,n){n.push(this._begin)}compile(e,n){return this._getCachedCompiledPatterns(e,n).compile(e)}compileAG(e,n,a,r){return this._getCachedCompiledPatterns(e,n).compileAG(e,a,r)}_getCachedCompiledPatterns(e,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Rw;for(const a of this.patterns)e.getRule(a).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,n):this._cachedCompiledPatterns.setSource(0,n)),this._cachedCompiledPatterns}},gB=class extends Nw{constructor(e,n,a,r,i,o,s,l,u){super(e,n,a,r);We(this,"_begin");We(this,"beginCaptures");We(this,"whileCaptures");We(this,"_while");We(this,"whileHasBackReferences");We(this,"hasMissingPatterns");We(this,"patterns");We(this,"_cachedCompiledPatterns");We(this,"_cachedCompiledWhilePatterns");this._begin=new Mw(i,this.id),this.beginCaptures=o,this.whileCaptures=l,this._while=new Mw(s,lne),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,n){return this._while.resolveBackReferences(e,n)}collectPatterns(e,n){n.push(this._begin)}compile(e,n){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,n,a,r){return this._getCachedCompiledPatterns(e).compileAG(e,a,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Rw;for(const n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,n){return this._getCachedCompiledWhilePatterns(e,n).compile(e)}compileWhileAG(e,n,a,r){return this._getCachedCompiledWhilePatterns(e,n).compileAG(e,a,r)}_getCachedCompiledWhilePatterns(e,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Rw,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},dne=class _o{static createCaptureRule(e,n,a,r,i){return e.registerRule(o=>new sWe(n,o,a,r,i))}static getCompiledRuleId(e,n,a){return e.id||n.registerRule(r=>{if(e.id=r,e.match)return new cWe(e.$vscodeTextmateLocation,e.id,e.name,e.match,_o._compileCaptures(e.captures,n,a));if(typeof e.begin>"u"){e.repository&&(a=Vte({},a,e.repository));let i=e.patterns;return typeof i>"u"&&e.include&&(i=[{include:e.include}]),new une(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,_o._compilePatterns(i,n,a))}return e.while?new gB(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,_o._compileCaptures(e.beginCaptures||e.captures,n,a),e.while,_o._compileCaptures(e.whileCaptures||e.captures,n,a),_o._compilePatterns(e.patterns,n,a)):new K7(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,_o._compileCaptures(e.beginCaptures||e.captures,n,a),e.end,_o._compileCaptures(e.endCaptures||e.captures,n,a),e.applyEndPatternLast,_o._compilePatterns(e.patterns,n,a))}),e.id}static _compileCaptures(e,n,a){let r=[];if(e){let i=0;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const s=parseInt(o,10);s>i&&(i=s)}for(let o=0;o<=i;o++)r[o]=null;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const s=parseInt(o,10);let l=0;e[o].patterns&&(l=_o.getCompiledRuleId(e[o],n,a)),r[s]=_o.createCaptureRule(n,e[o].$vscodeTextmateLocation,e[o].name,e[o].contentName,l)}}return r}static _compilePatterns(e,n,a){let r=[];if(e)for(let i=0,o=e.length;i<o;i++){const s=e[i];let l=-1;if(s.include){const u=sne(s.include);switch(u.kind){case 0:case 1:l=_o.getCompiledRuleId(a[s.include],n,a);break;case 2:let d=a[u.ruleName];d&&(l=_o.getCompiledRuleId(d,n,a));break;case 3:case 4:const p=u.scopeName,m=u.kind===4?u.ruleName:null,A=n.getExternalGrammar(p,a);if(A)if(m){let g=A.repository[m];g&&(l=_o.getCompiledRuleId(g,n,A.repository))}else l=_o.getCompiledRuleId(A.repository.$self,n,A.repository);break}}else l=_o.getCompiledRuleId(s,n,a);if(l!==-1){const u=n.getRule(l);let d=!1;if((u instanceof une||u instanceof K7||u instanceof gB)&&u.hasMissingPatterns&&u.patterns.length===0&&(d=!0),d)continue;r.push(l)}}return{patterns:r,hasMissingPatterns:(e?e.length:0)!==r.length}}},Mw=class d8e{constructor(e,n){We(this,"source");We(this,"ruleId");We(this,"hasAnchor");We(this,"hasBackReferences");We(this,"_anchorCache");if(e&&typeof e=="string"){const a=e.length;let r=0,i=[],o=!1;for(let s=0;s<a;s++)if(e.charAt(s)==="\\"&&s+1<a){const u=e.charAt(s+1);u==="z"?(i.push(e.substring(r,s)),i.push("$(?!\\n)(?<!\\n)"),r=s+2):(u==="A"||u==="G")&&(o=!0),s++}this.hasAnchor=o,r===0?this.source=e:(i.push(e.substring(r,a)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=iWe.test(this.source):this.hasBackReferences=!1}clone(){return new d8e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let a=n.map(r=>e.substring(r.start,r.end));return cne.lastIndex=0,this.source.replace(cne,(r,i)=>nne(a[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],n=[],a=[],r=[],i,o,s,l;for(i=0,o=this.source.length;i<o;i++)s=this.source.charAt(i),e[i]=s,n[i]=s,a[i]=s,r[i]=s,s==="\\"&&i+1<o&&(l=this.source.charAt(i+1),l==="A"?(e[i+1]="",n[i+1]="",a[i+1]="A",r[i+1]="A"):l==="G"?(e[i+1]="",n[i+1]="G",a[i+1]="",r[i+1]="G"):(e[i+1]=l,n[i+1]=l,a[i+1]=l,r[i+1]=l),i++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:a.join(""),A1_G1:r.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Rw=class{constructor(){We(this,"_items");We(this,"_hasAnchors");We(this,"_cached");We(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new pne(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let a=this._items.map(r=>r.resolveAnchors(e,n));return new pne(t,a,this._items.map(r=>r.ruleId))}},pne=class{constructor(t,e,n){We(this,"scanner");this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
|
|
539
539
|
`)}findNextMatchSync(t,e,n){const a=this.scanner.findNextMatchSync(t,e,n);return a?{ruleId:this.rules[a.index],captureIndices:a.captureIndices}:null}},Z7=class{constructor(t,e){this.languageId=t,this.tokenType=e}},lWe=(wA=class{constructor(e,n){We(this,"_defaultAttributes");We(this,"_embeddedLanguagesMatcher");We(this,"_getBasicScopeAttributes",new ane(e=>{const n=this._scopeToLanguage(e),a=this._toStandardTokenType(e);return new Z7(n,a)}));this._defaultAttributes=new Z7(e,8),this._embeddedLanguagesMatcher=new uWe(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?wA._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.match(wA.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}},We(wA,"_NULL_SCOPE_METADATA",new Z7(0,0)),We(wA,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),wA),uWe=class{constructor(t){We(this,"values");We(this,"scopesRegExp");if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);const e=t.map(([n,a])=>nne(n));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;const e=t.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},mne=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function Ane(t,e,n,a,r,i,o,s){const l=e.content.length;let u=!1,d=-1;if(o){const A=dWe(t,e,n,a,r,i);r=A.stack,a=A.linePos,n=A.isFirstLine,d=A.anchorPosition}const p=Date.now();for(;!u;){if(s!==0&&Date.now()-p>s)return new mne(r,!0);m()}return new mne(r,!1);function m(){const A=pWe(t,e,n,a,r,d);if(!A){i.produce(r,l),u=!0;return}const g=A.captureIndices,h=A.matchedRuleId,f=g&&g.length>0?g[0].end>a:!1;if(h===oWe){const b=r.getRule(t);i.produce(r,g[0].start),r=r.withContentNameScopesList(r.nameScopesList),Pw(t,e,n,r,i,b.endCaptures,g),i.produce(r,g[0].end);const y=r;if(r=r.parent,d=y.getAnchorPos(),!f&&y.getEnterPos()===a){r=y,i.produce(r,l),u=!0;return}}else{const b=t.getRule(h);i.produce(r,g[0].start);const y=r,w=b.getName(e.content,g),k=r.contentNameScopesList.pushAttributed(w,t);if(r=r.push(h,a,d,g[0].end===l,null,k,k),b instanceof K7){const C=b;Pw(t,e,n,r,i,C.beginCaptures,g),i.produce(r,g[0].end),d=g[0].end;const x=C.getContentName(e.content,g),_=k.pushAttributed(x,t);if(r=r.withContentNameScopesList(_),C.endHasBackReferences&&(r=r.withEndRule(C.getEndWithResolvedBackReferences(e.content,g))),!f&&y.hasSameRuleAs(r)){r=r.pop(),i.produce(r,l),u=!0;return}}else if(b instanceof gB){const C=b;Pw(t,e,n,r,i,C.beginCaptures,g),i.produce(r,g[0].end),d=g[0].end;const x=C.getContentName(e.content,g),_=k.pushAttributed(x,t);if(r=r.withContentNameScopesList(_),C.whileHasBackReferences&&(r=r.withEndRule(C.getWhileWithResolvedBackReferences(e.content,g))),!f&&y.hasSameRuleAs(r)){r=r.pop(),i.produce(r,l),u=!0;return}}else if(Pw(t,e,n,r,i,b.captures,g),i.produce(r,g[0].end),r=r.pop(),!f){r=r.safePop(),i.produce(r,l),u=!0;return}}g[0].end>a&&(a=g[0].end,n=!1)}}function dWe(t,e,n,a,r,i){let o=r.beginRuleCapturedEOL?0:-1;const s=[];for(let l=r;l;l=l.pop()){const u=l.getRule(t);u instanceof gB&&s.push({rule:u,stack:l})}for(let l=s.pop();l;l=s.pop()){const{ruleScanner:u,findOptions:d}=gWe(l.rule,t,l.stack.endRule,n,a===o),p=u.findNextMatchSync(e,a,d);if(p){if(p.ruleId!==lne){r=l.stack.pop();break}p.captureIndices&&p.captureIndices.length&&(i.produce(l.stack,p.captureIndices[0].start),Pw(t,e,n,l.stack,i,l.rule.whileCaptures,p.captureIndices),i.produce(l.stack,p.captureIndices[0].end),o=p.captureIndices[0].end,p.captureIndices[0].end>a&&(a=p.captureIndices[0].end,n=!1))}else{r=l.stack.pop();break}}return{stack:r,linePos:a,anchorPosition:o,isFirstLine:n}}function pWe(t,e,n,a,r,i){const o=mWe(t,e,n,a,r,i),s=t.getInjections();if(s.length===0)return o;const l=AWe(s,t,e,n,a,r,i);if(!l)return o;if(!o)return l;const u=o.captureIndices[0].start,d=l.captureIndices[0].start;return d<u||l.priorityMatch&&d===u?l:o}function mWe(t,e,n,a,r,i){const o=r.getRule(t),{ruleScanner:s,findOptions:l}=gne(o,t,r.endRule,n,a===i),u=s.findNextMatchSync(e,a,l);return u?{captureIndices:u.captureIndices,matchedRuleId:u.ruleId}:null}function AWe(t,e,n,a,r,i,o){let s=Number.MAX_VALUE,l=null,u,d=0;const p=i.contentNameScopesList.getScopeNames();for(let m=0,A=t.length;m<A;m++){const g=t[m];if(!g.matcher(p))continue;const h=e.getRule(g.ruleId),{ruleScanner:f,findOptions:b}=gne(h,e,null,a,r===o),y=f.findNextMatchSync(n,r,b);if(!y)continue;const w=y.captureIndices[0].start;if(!(w>=s)&&(s=w,l=y.captureIndices,u=y.ruleId,d=g.priority,s===r))break}return l?{priorityMatch:d===-1,captureIndices:l,matchedRuleId:u}:null}function gne(t,e,n,a,r){return{ruleScanner:t.compileAG(e,n,a,r),findOptions:0}}function gWe(t,e,n,a,r){return{ruleScanner:t.compileWhileAG(e,n,a,r),findOptions:0}}function Pw(t,e,n,a,r,i,o){if(i.length===0)return;const s=e.content,l=Math.min(i.length,o.length),u=[],d=o[0].end;for(let p=0;p<l;p++){const m=i[p];if(m===null)continue;const A=o[p];if(A.length===0)continue;if(A.start>d)break;for(;u.length>0&&u[u.length-1].endPos<=A.start;)r.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop();if(u.length>0?r.produceFromScopes(u[u.length-1].scopes,A.start):r.produce(a,A.start),m.retokenizeCapturedWithRuleId){const h=m.getName(s,o),f=a.contentNameScopesList.pushAttributed(h,t),b=m.getContentName(s,o),y=f.pushAttributed(b,t),w=a.push(m.retokenizeCapturedWithRuleId,A.start,-1,!1,null,f,y),k=t.createOnigString(s.substring(0,A.end));Ane(t,k,n&&A.start===0,A.start,w,r,!1,0),one(k);continue}const g=m.getName(s,o);if(g!==null){const f=(u.length>0?u[u.length-1].scopes:a.contentNameScopesList).pushAttributed(g,t);u.push(new hWe(f,A.end))}}for(;u.length>0;)r.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}var hWe=class{constructor(t,e){We(this,"scopes");We(this,"endPos");this.scopes=t,this.endPos=e}};function fWe(t,e,n,a,r,i,o,s){return new yWe(t,e,n,a,r,i,o,s)}function hne(t,e,n,a,r){const i=pB(e,hB),o=dne.getCompiledRuleId(n,a,r.repository);for(const s of i)t.push({debugSelector:e,matcher:s.matcher,ruleId:o,grammar:r,priority:s.priority})}function hB(t,e){if(e.length<t.length)return!1;let n=0;return t.every(a=>{for(let r=n;r<e.length;r++)if(bWe(e[r],a))return n=r+1,!0;return!1})}function bWe(t,e){if(!t)return!1;if(t===e)return!0;const n=e.length;return t.length>n&&t.substr(0,n)===e&&t[n]==="."}var yWe=class{constructor(e,n,a,r,i,o,s,l){We(this,"_rootId");We(this,"_lastRuleId");We(this,"_ruleId2desc");We(this,"_includedGrammars");We(this,"_grammarRepository");We(this,"_grammar");We(this,"_injections");We(this,"_basicScopeAttributesProvider");We(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=o,this._onigLib=l,this._basicScopeAttributesProvider=new lWe(a,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=s,this._grammar=fne(n,null),this._injections=null,this._tokenTypeMatchers=[],i)for(const u of Object.keys(i)){const d=pB(u,hB);for(const p of d)this._tokenTypeMatchers.push({matcher:p.matcher,type:i[u]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:i=>i===this._rootScopeName?this._grammar:this.getExternalGrammar(i),injections:i=>this._grammarRepository.injections(i)},n=[],a=this._rootScopeName,r=e.lookup(a);if(r){const i=r.injections;if(i)for(let s in i)hne(n,s,i[s],this,r);const o=this._grammarRepository.injections(a);o&&o.forEach(s=>{const l=this.getExternalGrammar(s);if(l){const u=l.injectionSelector;u&&hne(n,u,l,this,l)}})}return n.sort((i,o)=>i.priority-o.priority),n}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const n=++this._lastRuleId,a=e(n);return this._ruleId2desc[n]=a,a}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,n){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const a=this._grammarRepository.lookup(e);if(a)return this._includedGrammars[e]=fne(a,n&&n.$base),this._includedGrammars[e]}}tokenizeLine(e,n,a=0){const r=this._tokenize(e,n,!1,a);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,n,a=0){const r=this._tokenize(e,n,!0,a);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,n,a,r){this._rootId===-1&&(this._rootId=dne.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!n||n===V7.NULL){i=!0;const d=this._basicScopeAttributesProvider.getDefaultAttributes(),p=this.themeProvider.getDefaults(),m=Of.set(0,d.languageId,d.tokenType,null,p.fontStyle,p.foregroundId,p.backgroundId),A=this.getRule(this._rootId).getName(null,null);let g;A?g=$w.createRootAndLookUpScopeName(A,m,this):g=$w.createRoot("unknown",m),n=new V7(null,this._rootId,-1,-1,!1,null,g,g)}else i=!1,n.reset();e=e+`
|
|
540
540
|
`;const o=this.createOnigString(e),s=o.content.length,l=new kWe(a,e,this._tokenTypeMatchers,this.balancedBracketSelectors),u=Ane(this,o,i,0,n,l,!0,r);return one(o),{lineLength:s,lineTokens:l,ruleStack:u.stack,stoppedEarly:u.stoppedEarly}}};function fne(t,e){return t=PYe(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=e||t.repository.$self,t}var $w=class Vu{constructor(e,n,a){this.parent=e,this.scopePath=n,this.tokenAttributes=a}static fromExtension(e,n){let a=e,r=(e==null?void 0:e.scopePath)??null;for(const i of n)r=U7.push(r,i.scopeNames),a=new Vu(a,r,i.encodedTokenAttributes);return a}static createRoot(e,n){return new Vu(null,new U7(null,e),n)}static createRootAndLookUpScopeName(e,n,a){const r=a.getMetadataForScope(e),i=new U7(null,e),o=a.themeProvider.themeMatch(i),s=Vu.mergeAttributes(n,r,o);return new Vu(null,i,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return Vu.equals(this,e)}static equals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.scopeName!==n.scopeName||e.tokenAttributes!==n.tokenAttributes)return!1;e=e.parent,n=n.parent}while(!0)}static mergeAttributes(e,n,a){let r=-1,i=0,o=0;return a!==null&&(r=a.fontStyle,i=a.foregroundId,o=a.backgroundId),Of.set(e,n.languageId,n.tokenType,null,r,i,o)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return Vu._pushAttributed(this,e,n);const a=e.split(/ /g);let r=this;for(const i of a)r=Vu._pushAttributed(r,i,n);return r}static _pushAttributed(e,n,a){const r=a.getMetadataForScope(n),i=e.scopePath.push(n),o=a.themeProvider.themeMatch(i),s=Vu.mergeAttributes(e.tokenAttributes,r,o);return new Vu(e,i,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){var r;const n=[];let a=this;for(;a&&a!==e;)n.push({encodedTokenAttributes:a.tokenAttributes,scopeNames:a.scopePath.getExtensionIfDefined(((r=a.parent)==null?void 0:r.scopePath)??null)}),a=a.parent;return a===e?n.reverse():void 0}},V7=(Sl=class{constructor(e,n,a,r,i,o,s,l){We(this,"_stackElementBrand");We(this,"_enterPos");We(this,"_anchorPos");We(this,"depth");this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=s,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=a,this._anchorPos=r}equals(e){return e===null?!1:Sl._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?$w.equals(e.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.depth!==n.depth||e.ruleId!==n.ruleId||e.endRule!==n.endRule)return!1;e=e.parent,n=n.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){Sl._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,a,r,i,o,s){return new Sl(this,e,n,a,r,i,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,n){var a,r;return this.parent&&(n=this.parent._writeString(e,n)),e[n++]=`(${this.ruleId}, ${(a=this.nameScopesList)==null?void 0:a.toString()}, ${(r=this.contentNameScopesList)==null?void 0:r.toString()})`,n}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new Sl(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let n=this;for(;n&&n._enterPos===e._enterPos;){if(n.ruleId===e.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){var e,n,a;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((n=this.nameScopesList)==null?void 0:n.getExtensionIfDefined(((e=this.parent)==null?void 0:e.nameScopesList)??null))??[],contentNameScopesList:((a=this.contentNameScopesList)==null?void 0:a.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(e,n){const a=$w.fromExtension((e==null?void 0:e.nameScopesList)??null,n.nameScopesList);return new Sl(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,a,$w.fromExtension(a,n.contentNameScopesList))}},We(Sl,"NULL",new Sl(null,0,0,0,!1,null,null,null)),Sl),wWe=class{constructor(t,e){We(this,"balancedBracketScopes");We(this,"unbalancedBracketScopes");We(this,"allowAny",!1);this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):pB(n,hB).map(a=>a.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>pB(n,hB).map(a=>a.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(const e of this.unbalancedBracketScopes)if(e(t))return!1;for(const e of this.balancedBracketScopes)if(e(t))return!0;return this.allowAny}},kWe=class{constructor(t,e,n,a){We(this,"_emitBinaryTokens");We(this,"_lineText");We(this,"_tokens");We(this,"_binaryTokens");We(this,"_lastTokenEndIndex");We(this,"_tokenTypeOverrides");this.balancedBracketSelectors=a,this._emitBinaryTokens=t,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){var a;if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let r=(t==null?void 0:t.tokenAttributes)??0,i=!1;if((a=this.balancedBracketSelectors)!=null&&a.matchesAlways&&(i=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=(t==null?void 0:t.getScopeNames())??[];for(const s of this._tokenTypeOverrides)s.matcher(o)&&(r=Of.set(r,0,s.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(o))}if(i&&(r=Of.set(r,0,8,i,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=e;return}const n=(t==null?void 0:t.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:n}),this._lastTokenEndIndex=e}getResult(t,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(t,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let a=0,r=this._binaryTokens.length;a<r;a++)n[a]=this._binaryTokens[a];return n}},vWe=class{constructor(t,e){We(this,"_grammars",new Map);We(this,"_rawGrammars",new Map);We(this,"_injectionGrammars",new Map);We(this,"_theme");this._onigLib=e,this._theme=t}dispose(){for(const t of this._grammars.values())t.dispose()}setTheme(t){this._theme=t}getColorMap(){return this._theme.getColorMap()}addGrammar(t,e){this._rawGrammars.set(t.scopeName,t),e&&this._injectionGrammars.set(t.scopeName,e)}lookup(t){return this._rawGrammars.get(t)}injections(t){return this._injectionGrammars.get(t)}getDefaults(){return this._theme.getDefaults()}themeMatch(t){return this._theme.match(t)}grammarForScopeName(t,e,n,a,r){if(!this._grammars.has(t)){let i=this._rawGrammars.get(t);if(!i)return null;this._grammars.set(t,fWe(t,i,e,n,a,r,this,this._onigLib))}return this._grammars.get(t)}},CWe=class{constructor(e){We(this,"_options");We(this,"_syncRegistry");We(this,"_ensureGrammarCache");this._options=e,this._syncRegistry=new vWe(dB.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,n){this._syncRegistry.setTheme(dB.createFromRawTheme(e,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,n,a){return this.loadGrammarWithConfiguration(e,n,{embeddedLanguages:a})}loadGrammarWithConfiguration(e,n,a){return this._loadGrammar(e,n,a.embeddedLanguages,a.tokenTypes,new wWe(a.balancedBracketSelectors||[],a.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,n,a,r,i){const o=new JYe(this._syncRegistry,e);for(;o.Q.length>0;)o.Q.map(s=>this._loadSingleGrammar(s.scopeName)),o.processQueue();return this._grammarForScopeName(e,n,a,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const n=this._options.loadGrammar(e);if(n){const a=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(n,a)}}addGrammar(e,n=[],a=0,r=null){return this._syncRegistry.addGrammar(e,n),this._grammarForScopeName(e.scopeName,a,r)}_grammarForScopeName(e,n=0,a=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,n,a,r,i)}},J7=V7.NULL;const _We=/["&'<>`]/g,xWe=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,EWe=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,BWe=/[|\\{}()[\]^$+*?.]/g,bne=new WeakMap;function IWe(t,e){if(t=t.replace(e.subset?DWe(e.subset):_We,a),e.subset||e.escapeOnly)return t;return t.replace(xWe,n).replace(EWe,a);function n(r,i,o){return e.format((r.charCodeAt(0)-55296)*1024+r.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),e)}function a(r,i,o){return e.format(r.charCodeAt(0),o.charCodeAt(i+1),e)}}function DWe(t){let e=bne.get(t);return e||(e=QWe(t),bne.set(t,e)),e}function QWe(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(BWe,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const SWe=/[\dA-Fa-f]/;function TWe(t,e,n){const a="&#x"+t.toString(16).toUpperCase();return n&&e&&!SWe.test(String.fromCharCode(e))?a:a+";"}const FWe=/\d/;function LWe(t,e,n){const a="&#"+String(t);return n&&e&&!FWe.test(String.fromCharCode(e))?a:a+";"}const NWe=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],X7={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},MWe=["cent","copy","divide","gt","lt","not","para","times"],yne={}.hasOwnProperty,eT={};let fB;for(fB in X7)yne.call(X7,fB)&&(eT[X7[fB]]=fB);const RWe=/[^\dA-Za-z]/;function PWe(t,e,n,a){const r=String.fromCharCode(t);if(yne.call(eT,r)){const i=eT[r],o="&"+i;return n&&NWe.includes(i)&&!MWe.includes(i)&&(!a||e&&e!==61&&RWe.test(String.fromCharCode(e)))?o:o+";"}return""}function $We(t,e,n){let a=TWe(t,e,n.omitOptionalSemicolons),r;if((n.useNamedReferences||n.useShortestReferences)&&(r=PWe(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const i=LWe(t,e,n.omitOptionalSemicolons);i.length<a.length&&(a=i)}return r&&(!n.useShortestReferences||r.length<a.length)?r:a}function jf(t,e){return IWe(t,Object.assign({format:$We},e))}const OWe=/^>|^->|<!--|-->|--!>|<!-$/g,jWe=[">"],GWe=["<",">"];function qWe(t,e,n,a){return a.settings.bogusComments?"<?"+jf(t.value,Object.assign({},a.settings.characterReferences,{subset:jWe}))+">":"<!--"+t.value.replace(OWe,r)+"-->";function r(i){return jf(i,Object.assign({},a.settings.characterReferences,{subset:GWe}))}}function zWe(t,e,n,a){return"<!"+(a.settings.upperDoctype?"DOCTYPE":"doctype")+(a.settings.tightDoctype?"":" ")+"html>"}const Zr=kne(1),wne=kne(-1),HWe=[];function kne(t){return e;function e(n,a,r){const i=n?n.children:HWe;let o=(a||0)+t,s=i[o];if(!r)for(;s&&TE(s);)o+=t,s=i[o];return s}}const UWe={}.hasOwnProperty;function vne(t){return e;function e(n,a,r){return UWe.call(t,n.tagName)&&t[n.tagName](n,a,r)}}const tT=vne({body:WWe,caption:nT,colgroup:nT,dd:JWe,dt:VWe,head:nT,html:YWe,li:ZWe,optgroup:XWe,option:eKe,p:KWe,rp:Cne,rt:Cne,tbody:nKe,td:_ne,tfoot:aKe,th:_ne,thead:tKe,tr:rKe});function nT(t,e,n){const a=Zr(n,e,!0);return!a||a.type!=="comment"&&!(a.type==="text"&&TE(a.value.charAt(0)))}function YWe(t,e,n){const a=Zr(n,e);return!a||a.type!=="comment"}function WWe(t,e,n){const a=Zr(n,e);return!a||a.type!=="comment"}function KWe(t,e,n){const a=Zr(n,e);return a?a.type==="element"&&(a.tagName==="address"||a.tagName==="article"||a.tagName==="aside"||a.tagName==="blockquote"||a.tagName==="details"||a.tagName==="div"||a.tagName==="dl"||a.tagName==="fieldset"||a.tagName==="figcaption"||a.tagName==="figure"||a.tagName==="footer"||a.tagName==="form"||a.tagName==="h1"||a.tagName==="h2"||a.tagName==="h3"||a.tagName==="h4"||a.tagName==="h5"||a.tagName==="h6"||a.tagName==="header"||a.tagName==="hgroup"||a.tagName==="hr"||a.tagName==="main"||a.tagName==="menu"||a.tagName==="nav"||a.tagName==="ol"||a.tagName==="p"||a.tagName==="pre"||a.tagName==="section"||a.tagName==="table"||a.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function ZWe(t,e,n){const a=Zr(n,e);return!a||a.type==="element"&&a.tagName==="li"}function VWe(t,e,n){const a=Zr(n,e);return!!(a&&a.type==="element"&&(a.tagName==="dt"||a.tagName==="dd"))}function JWe(t,e,n){const a=Zr(n,e);return!a||a.type==="element"&&(a.tagName==="dt"||a.tagName==="dd")}function Cne(t,e,n){const a=Zr(n,e);return!a||a.type==="element"&&(a.tagName==="rp"||a.tagName==="rt")}function XWe(t,e,n){const a=Zr(n,e);return!a||a.type==="element"&&a.tagName==="optgroup"}function eKe(t,e,n){const a=Zr(n,e);return!a||a.type==="element"&&(a.tagName==="option"||a.tagName==="optgroup")}function tKe(t,e,n){const a=Zr(n,e);return!!(a&&a.type==="element"&&(a.tagName==="tbody"||a.tagName==="tfoot"))}function nKe(t,e,n){const a=Zr(n,e);return!a||a.type==="element"&&(a.tagName==="tbody"||a.tagName==="tfoot")}function aKe(t,e,n){return!Zr(n,e)}function rKe(t,e,n){const a=Zr(n,e);return!a||a.type==="element"&&a.tagName==="tr"}function _ne(t,e,n){const a=Zr(n,e);return!a||a.type==="element"&&(a.tagName==="td"||a.tagName==="th")}const iKe=vne({body:cKe,colgroup:lKe,head:sKe,html:oKe,tbody:uKe});function oKe(t){const e=Zr(t,-1);return!e||e.type!=="comment"}function sKe(t){const e=new Set;for(const a of t.children)if(a.type==="element"&&(a.tagName==="base"||a.tagName==="title")){if(e.has(a.tagName))return!1;e.add(a.tagName)}const n=t.children[0];return!n||n.type==="element"}function cKe(t){const e=Zr(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&TE(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function lKe(t,e,n){const a=wne(n,e),r=Zr(t,-1,!0);return n&&a&&a.type==="element"&&a.tagName==="colgroup"&&tT(a,n.children.indexOf(a),n)?!1:!!(r&&r.type==="element"&&r.tagName==="col")}function uKe(t,e,n){const a=wne(n,e),r=Zr(t,-1);return n&&a&&a.type==="element"&&(a.tagName==="thead"||a.tagName==="tbody")&&tT(a,n.children.indexOf(a),n)?!1:!!(r&&r.type==="element"&&r.tagName==="tr")}const bB={name:[[`
|
|
541
541
|
\f\r &/=>`.split(""),`
|
|
@@ -1358,7 +1358,7 @@ clipRule="evenodd"
|
|
|
1358
1358
|
`&&t.lineWrapping&&(a&&(a=lt.single(a.main.anchor-1,a.main.head-1)),n={from:r.from,to:r.to,insert:ea.of([" "])}),n)return ZF(t,n,a,i);if(a&&!a.main.eq(r)){let o=!1,s="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),s=t.inputState.lastSelectionOrigin,s=="select.pointer"&&(a=Moe(t.state.facet(p1).map(l=>l(t)),a))),t.dispatch({selection:a,scrollIntoView:o,userEvent:s}),!0}else return!1}function ZF(t,e,n,a=-1){if($t.ios&&t.inputState.flushIOSKey(e))return!0;let r=t.state.selection.main;if($t.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&t.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&rb(t.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||a==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&rb(t.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&rb(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,s=()=>o||(o=Dit(t,e,n));return t.state.facet(hoe).some(l=>l(t,e.from,e.to,i,s))||t.dispatch(s()),!0}function Dit(t,e,n){let a,r=t.state,i=r.selection.main,o=-1;if(e.from==e.to&&e.from<i.from||e.from>i.to){let l=e.from<i.from?-1:1,u=l<0?i.from:i.to,d=A1(r.facet(p1).map(p=>p(t)),u,l);e.from==d&&(o=d)}if(o>-1)a={changes:e,selection:lt.cursor(e.from+e.insert.length,-1)};else if(e.from>=i.from&&e.to<=i.to&&e.to-e.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let l=i.from<e.from?r.sliceDoc(i.from,e.from):"",u=i.to>e.to?r.sliceDoc(e.to,i.to):"";a=r.replaceSelection(t.state.toText(l+e.insert.sliceString(0,void 0,t.state.lineBreak)+u))}else{let l=r.changes(e),u=n&&n.main.to<=l.newLength?n.main:void 0;if(r.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=i.to&&e.to>=i.to-10){let d=t.state.sliceDoc(e.from,e.to),p,m=n&&Ioe(t,n.main.head);if(m){let h=e.insert.length-(e.to-e.from);p={from:m.from,to:m.to-h}}else p=t.state.doc.lineAt(i.head);let A=i.to-e.to,g=i.to-i.from;a=r.changeByRange(h=>{if(h.from==i.from&&h.to==i.to)return{changes:l,range:u||h.map(l)};let f=h.to-A,b=f-d.length;if(h.to-h.from!=g||t.state.sliceDoc(b,f)!=d||h.to>=p.from&&h.from<=p.to)return{range:h};let y=r.changes({from:b,to:f,insert:e.insert}),w=h.to-i.to;return{changes:y,range:u?lt.range(Math.max(0,u.anchor+w),Math.max(0,u.head+w)):h.map(y)}})}else a={changes:l,selection:u&&r.selection.replaceRange(u)}}let s="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,s+=".compose",t.inputState.compositionFirstChange&&(s+=".start",t.inputState.compositionFirstChange=!1)),r.update(a,{userEvent:s,scrollIntoView:!0})}function $oe(t,e,n,a){let r=Math.min(t.length,e.length),i=0;for(;i<r&&t.charCodeAt(i)==e.charCodeAt(i);)i++;if(i==r&&t.length==e.length)return null;let o=t.length,s=e.length;for(;o>0&&s>0&&t.charCodeAt(o-1)==e.charCodeAt(s-1);)o--,s--;if(a=="end"){let l=Math.max(0,i-Math.min(o,s));n-=o+l-i}if(o<i&&t.length<e.length){let l=n<=i&&n>=o?i-n:0;i-=l,s=i+(s-o),o=i}else if(s<i){let l=n<=i&&n>=s?i-n:0;i-=l,o=i+(o-s),s=i}return{from:i,toA:o,toB:s}}function Qit(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:a,focusNode:r,focusOffset:i}=t.observer.selectionRange;return n&&(e.push(new Roe(n,a)),(r!=n||i!=a)&&e.push(new Roe(r,i))),e}function Sit(t,e){if(t.length==0)return null;let n=t[0].pos,a=t.length==2?t[1].pos:n;return n>-1&&a>-1?lt.single(n+e,a+e):null}class Tit{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,$t.safari&&e.contentDOM.addEventListener("input",()=>null),$t.gecko&&Wit(e.contentDOM.ownerDocument)}handleEvent(e){!Oit(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let a=this.handlers[e];if(a){for(let r of a.observers)r(this.view,n);for(let r of a.handlers){if(n.defaultPrevented)break;if(r(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=Fit(e),a=this.handlers,r=this.view.contentDOM;for(let i in n)if(i!="scroll"){let o=!n[i].handlers.length,s=a[i];s&&o!=!s.handlers.length&&(r.removeEventListener(i,this.handleEvent),s=null),s||r.addEventListener(i,this.handleEvent,{passive:o})}for(let i in a)i!="scroll"&&!n[i]&&r.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Goe.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),$t.android&&$t.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return $t.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=joe.find(a=>a.keyCode==e.keyCode))&&!e.ctrlKey||Lit.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,rb(this.view.contentDOM,n.key,n.keyCode,n instanceof KeyboardEvent?n:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:$t.safari&&!$t.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Ooe(t,e){return(n,a)=>{try{return e.call(t,a,n)}catch(r){us(n.state,r)}}}function Fit(t){let e=Object.create(null);function n(a){return e[a]||(e[a]={observers:[],handlers:[]})}for(let a of t){let r=a.spec,i=r&&r.plugin.domEventHandlers,o=r&&r.plugin.domEventObservers;if(i)for(let s in i){let l=i[s];l&&n(s).handlers.push(Ooe(a.value,l))}if(o)for(let s in o){let l=o[s];l&&n(s).observers.push(Ooe(a.value,l))}}for(let a in al)n(a).handlers.push(al[a]);for(let a in bc)n(a).observers.push(bc[a]);return e}const joe=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Lit="dthko",Goe=[16,17,18,20,91,92,224,225],y2=6;function w2(t){return Math.max(0,t)*.7+8}function Nit(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class Mit{constructor(e,n,a,r){this.view=e,this.startEvent=n,this.style=a,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=zrt(e.contentDOM),this.atoms=e.state.facet(p1).map(o=>o(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Hn.allowMultipleSelections)&&Rit(e,n),this.dragging=$it(e,n)&&Voe(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Nit(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,a=0,r=0,i=0,o=this.view.win.innerWidth,s=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:s}=this.scrollParents.y.getBoundingClientRect());let l=HF(this.view);e.clientX-l.left<=r+y2?n=-w2(r-e.clientX):e.clientX+l.right>=o-y2&&(n=w2(e.clientX-o)),e.clientY-l.top<=i+y2?a=-w2(i-e.clientY):e.clientY+l.bottom>=s-y2&&(a=w2(e.clientY-s)),this.setScrollSpeed(n,a)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,a=Moe(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!a.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:a,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Rit(t,e){let n=t.state.facet(poe);return n.length?n[0](e):$t.mac?e.metaKey:e.ctrlKey}function Pit(t,e){let n=t.state.facet(moe);return n.length?n[0](e):$t.mac?!e.altKey:!e.ctrlKey}function $it(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let a=i1(t.root);if(!a||a.rangeCount==0)return!0;let r=a.getRangeAt(0).getClientRects();for(let i=0;i<r.length;i++){let o=r[i];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function Oit(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,a;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(a=Ca.get(n))&&a.ignoreEvent(e))return!1;return!0}const al=Object.create(null),bc=Object.create(null),qoe=$t.ie&&$t.ie_version<15||$t.ios&&$t.webkit_version<604;function jit(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),zoe(t,n.value)},50)}function k2(t,e,n){for(let a of t.facet(e))n=a(n,t);return n}function zoe(t,e){e=k2(t.state,jF,e);let{state:n}=t,a,r=1,i=n.toText(e),o=i.lines==n.selection.ranges.length;if(VF!=null&&n.selection.ranges.every(l=>l.empty)&&VF==i.toString()){let l=-1;a=n.changeByRange(u=>{let d=n.doc.lineAt(u.from);if(d.from==l)return{range:u};l=d.from;let p=n.toText((o?i.line(r++).text:e)+n.lineBreak);return{changes:{from:d.from,insert:p},range:lt.cursor(u.from+p.length)}})}else o?a=n.changeByRange(l=>{let u=i.line(r++);return{changes:{from:l.from,to:l.to,insert:u.text},range:lt.cursor(l.from+u.length)}}):a=n.replaceSelection(i);t.dispatch(a,{userEvent:"input.paste",scrollIntoView:!0})}bc.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft},al.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1),bc.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},bc.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},al.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let a of t.state.facet(Aoe))if(n=a(t,e),n)break;if(!n&&e.button==0&&(n=zit(t,e)),n){let a=!t.hasFocus;t.inputState.startMouseSelection(new Mit(t,e,n,a)),a&&t.observer.ignore(()=>{Uie(t.contentDOM);let i=t.root.activeElement;i&&!i.contains(t.contentDOM)&&i.blur()});let r=t.inputState.mouseSelection;if(r)return r.start(e),r.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function Hoe(t,e,n,a){if(a==1)return lt.cursor(e,n);if(a==2)return fit(t.state,e,n);{let r=Fr.find(t.docView,e),i=t.state.doc.lineAt(r?r.posAtEnd:e),o=r?r.posAtStart:i.from,s=r?r.posAtEnd:i.to;return s<t.state.doc.length&&s==i.to&&s++,lt.range(o,s)}}let Uoe=(t,e,n)=>e>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function Git(t,e,n,a){let r=Fr.find(t.docView,e);if(!r)return 1;let i=e-r.posAtStart;if(i==0)return 1;if(i==r.length)return-1;let o=r.coordsAt(i,-1);if(o&&Uoe(n,a,o))return-1;let s=r.coordsAt(i,1);return s&&Uoe(n,a,s)?1:o&&o.bottom>=a?-1:1}function Yoe(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:Git(t,n,e.clientX,e.clientY)}}const qit=$t.ie&&$t.ie_version<=11;let Woe=null,Koe=0,Zoe=0;function Voe(t){if(!qit)return t.detail;let e=Woe,n=Zoe;return Woe=t,Zoe=Date.now(),Koe=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Koe+1)%3:1}function zit(t,e){let n=Yoe(t,e),a=Voe(e),r=t.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),r=r.map(i.changes))},get(i,o,s){let l=Yoe(t,i),u,d=Hoe(t,l.pos,l.bias,a);if(n.pos!=l.pos&&!o){let p=Hoe(t,n.pos,n.bias,a),m=Math.min(p.from,d.from),A=Math.max(p.to,d.to);d=m<d.from?lt.range(m,A):lt.range(A,m)}return o?r.replaceRange(r.main.extend(d.from,d.to)):s&&a==1&&r.ranges.length>1&&(u=Hit(r,l.pos))?u:s?r.addRange(d):lt.create([d])}}}function Hit(t,e){for(let n=0;n<t.ranges.length;n++){let{from:a,to:r}=t.ranges[n];if(a<=e&&r>=e)return lt.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}al.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let r=t.docView.nearest(e.target);if(r&&r.isWidget){let i=r.posAtStart,o=i+r.length;(i>=n.to||o<=n.from)&&(n=lt.range(i,o))}}let{inputState:a}=t;return a.mouseSelection&&(a.mouseSelection.dragging=!0),a.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",k2(t.state,GF,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1},al.dragend=t=>(t.inputState.draggedContent=null,!1);function Joe(t,e,n,a){if(n=k2(t.state,jF,n),!n)return;let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,o=a&&i&&Pit(t,e)?{from:i.from,to:i.to}:null,s={from:r,insert:n},l=t.state.changes(o?[o,s]:s);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}al.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let a=Array(n.length),r=0,i=()=>{++r==n.length&&Joe(t,e,a.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o<n.length;o++){let s=new FileReader;s.onerror=i,s.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(s.result)||(a[o]=s.result),i()},s.readAsText(n[o])}return!0}else{let a=e.dataTransfer.getData("Text");if(a)return Joe(t,e,a,!0),!0}return!1},al.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=qoe?null:e.clipboardData;return n?(zoe(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(jit(t),!1)};function Uit(t,e){let n=t.dom.parentNode;if(!n)return;let a=n.appendChild(document.createElement("textarea"));a.style.cssText="position: fixed; left: -10000px; top: 10px",a.value=e,a.focus(),a.selectionEnd=e.length,a.selectionStart=0,setTimeout(()=>{a.remove(),t.focus()},50)}function Yit(t){let e=[],n=[],a=!1;for(let r of t.selection.ranges)r.empty||(e.push(t.sliceDoc(r.from,r.to)),n.push(r));if(!e.length){let r=-1;for(let{from:i}of t.selection.ranges){let o=t.doc.lineAt(i);o.number>r&&(e.push(o.text),n.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),r=o.number}a=!0}return{text:k2(t,GF,e.join(t.lineBreak)),ranges:n,linewise:a}}let VF=null;al.copy=al.cut=(t,e)=>{let{text:n,ranges:a,linewise:r}=Yit(t.state);if(!n&&!r)return!1;VF=r?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:a,scrollIntoView:!0,userEvent:"delete.cut"});let i=qoe?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(Uit(t,n),!1)};const Xoe=ru.define();function ese(t,e){let n=[];for(let a of t.facet(foe)){let r=a(t,e);r&&n.push(r)}return n.length?t.update({effects:n,annotations:Xoe.of(!0)}):null}function tse(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=ese(t.state,e);n?t.dispatch(n):t.update([])}},10)}bc.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),tse(t)},bc.blur=t=>{t.observer.clearSelectionRange(),tse(t)},bc.compositionstart=bc.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))},bc.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,$t.chrome&&$t.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))},bc.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},al.beforeinput=(t,e)=>{var n,a;if(e.inputType=="insertReplacementText"&&t.observer.editContext){let i=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=e.getTargetRanges();if(i&&o.length){let s=o[0],l=t.posAtDOM(s.startContainer,s.startOffset),u=t.posAtDOM(s.endContainer,s.endOffset);return ZF(t,{from:l,to:u,insert:t.state.toText(i)},null),!0}}let r;if($t.chrome&&$t.android&&(r=joe.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let i=((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return $t.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),$t.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>bc.compositionend(t,e),20),!1};const nse=new Set;function Wit(t){nse.has(t)||(nse.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const ase=["pre-wrap","normal","pre-line","break-spaces"];let lb=!1;function rse(){lb=!1}class Kit{constructor(e){this.lineWrapping=e,this.doc=ea.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let a=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(a+=Math.max(0,Math.ceil((n-e-a*this.lineLength*.5)/this.lineLength))),this.lineHeight*a}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return ase.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let a=0;a<e.length;a++){let r=e[a];r<0?a++:this.heightSamples[Math.floor(r*10)]||(n=!0,this.heightSamples[Math.floor(r*10)]=!0)}return n}refresh(e,n,a,r,i,o){let s=ase.indexOf(e)>-1,l=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=n,this.charWidth=a,this.textHeight=r,this.lineLength=i,l){this.heightSamples={};for(let u=0;u<o.length;u++){let d=o[u];d<0?u++:this.heightSamples[Math.floor(d*10)]=!0}}return l}}class Zit{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class cu{constructor(e,n,a,r,i){this.from=e,this.length=n,this.top=a,this.height=r,this._content=i}get type(){return typeof this._content=="number"?Mo.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Jp?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new cu(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var Pa=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(Pa||(Pa={}));const v2=.001;class Ro{constructor(e,n,a=2){this.length=e,this.height=n,this.flags=a}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>v2&&(lb=!0),this.height=e)}replace(e,n,a){return Ro.of(a)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,a,r){let i=this,o=a.doc;for(let s=r.length-1;s>=0;s--){let{fromA:l,toA:u,fromB:d,toB:p}=r[s],m=i.lineAt(l,Pa.ByPosNoHeight,a.setDoc(n),0,0),A=m.to>=u?m:i.lineAt(u,Pa.ByPosNoHeight,a,0,0);for(p+=A.to-u,u=A.to;s>0&&m.from<=r[s-1].toA;)l=r[s-1].fromA,d=r[s-1].fromB,s--,l<m.from&&(m=i.lineAt(l,Pa.ByPosNoHeight,a,0,0));d+=m.from-l,l=m.from;let g=JF.build(a.setDoc(o),e,d,p);i=C2(i,i.replace(l,u,g))}return i.updateHeight(a,0)}static empty(){return new Ps(0,0)}static of(e){if(e.length==1)return e[0];let n=0,a=e.length,r=0,i=0;for(;;)if(n==a)if(r>i*2){let s=e[n-1];s.break?e.splice(--n,1,s.left,null,s.right):e.splice(--n,1,s.left,s.right),a+=1+s.break,r-=s.size}else if(i>r*2){let s=e[a];s.break?e.splice(a,1,s.left,null,s.right):e.splice(a,1,s.left,s.right),a+=2+s.break,i-=s.size}else break;else if(r<i){let s=e[n++];s&&(r+=s.size)}else{let s=e[--a];s&&(i+=s.size)}let o=0;return e[n-1]==null?(o=1,n--):e[n]==null&&(o=1,a++),new Vit(Ro.of(e.slice(0,n)),o,Ro.of(e.slice(a)))}}function C2(t,e){return t==e?t:(t.constructor!=e.constructor&&(lb=!0),e)}Ro.prototype.size=1;class ise extends Ro{constructor(e,n,a){super(e,n),this.deco=a}blockAt(e,n,a,r){return new cu(r,this.length,a,this.height,this.deco||0)}lineAt(e,n,a,r,i){return this.blockAt(0,a,r,i)}forEachLine(e,n,a,r,i,o){e<=i+this.length&&n>=i&&o(this.blockAt(0,a,r,i))}updateHeight(e,n=0,a=!1,r){return r&&r.from<=n&&r.more&&this.setHeight(r.heights[r.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ps extends ise{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,a,r){return new cu(r,this.length,a,this.height,this.breaks)}replace(e,n,a){let r=a[0];return a.length==1&&(r instanceof Ps||r instanceof Mi&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof Mi?r=new Ps(r.length,this.height):r.height=this.height,this.outdated||(r.outdated=!1),r):Ro.of(a)}updateHeight(e,n=0,a=!1,r){return r&&r.from<=n&&r.more?this.setHeight(r.heights[r.index++]):(a||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Mi extends Ro{constructor(e){super(e,0)}heightMetrics(e,n){let a=e.doc.lineAt(n).number,r=e.doc.lineAt(n+this.length).number,i=r-a+1,o,s=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*i);o=l/i,this.length>i+1&&(s=(this.height-l)/(this.length-i-1))}else o=this.height/i;return{firstLine:a,lastLine:r,perLine:o,perChar:s}}blockAt(e,n,a,r){let{firstLine:i,lastLine:o,perLine:s,perChar:l}=this.heightMetrics(n,r);if(n.lineWrapping){let u=r+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-a)/this.height))*this.length)),d=n.doc.lineAt(u),p=s+d.length*l,m=Math.max(a,e-p/2);return new cu(d.from,d.length,m,p,0)}else{let u=Math.max(0,Math.min(o-i,Math.floor((e-a)/s))),{from:d,length:p}=n.doc.line(i+u);return new cu(d,p,a+s*u,s,0)}}lineAt(e,n,a,r,i){if(n==Pa.ByHeight)return this.blockAt(e,a,r,i);if(n==Pa.ByPosNoHeight){let{from:A,to:g}=a.doc.lineAt(e);return new cu(A,g-A,0,0,0)}let{firstLine:o,perLine:s,perChar:l}=this.heightMetrics(a,i),u=a.doc.lineAt(e),d=s+u.length*l,p=u.number-o,m=r+s*p+l*(u.from-i-p);return new cu(u.from,u.length,Math.max(r,Math.min(m,r+this.height-d)),d,0)}forEachLine(e,n,a,r,i,o){e=Math.max(e,i),n=Math.min(n,i+this.length);let{firstLine:s,perLine:l,perChar:u}=this.heightMetrics(a,i);for(let d=e,p=r;d<=n;){let m=a.doc.lineAt(d);if(d==e){let g=m.number-s;p+=l*g+u*(e-i-g)}let A=l+u*m.length;o(new cu(m.from,m.length,p,A,0)),p+=A,d=m.to+1}}replace(e,n,a){let r=this.length-n;if(r>0){let i=a[a.length-1];i instanceof Mi?a[a.length-1]=new Mi(i.length+r):a.push(null,new Mi(r-1))}if(e>0){let i=a[0];i instanceof Mi?a[0]=new Mi(e+i.length):a.unshift(new Mi(e-1),null)}return Ro.of(a)}decomposeLeft(e,n){n.push(new Mi(e-1),null)}decomposeRight(e,n){n.push(null,new Mi(this.length-e-1))}updateHeight(e,n=0,a=!1,r){let i=n+this.length;if(r&&r.from<=n+this.length&&r.more){let o=[],s=Math.max(n,r.from),l=-1;for(r.from>n&&o.push(new Mi(r.from-n-1).updateHeight(e,n));s<=i&&r.more;){let d=e.doc.lineAt(s).length;o.length&&o.push(null);let p=r.heights[r.index++];l==-1?l=p:Math.abs(p-l)>=v2&&(l=-2);let m=new Ps(d,p);m.outdated=!1,o.push(m),s+=d+1}s<=i&&o.push(null,new Mi(i-s).updateHeight(e,s));let u=Ro.of(o);return(l<0||Math.abs(u.height-this.height)>=v2||Math.abs(l-this.heightMetrics(e,n).perLine)>=v2)&&(lb=!0),C2(this,u)}else(a||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Vit extends Ro{constructor(e,n,a){super(e.length+n+a.length,e.height+a.height,n|(e.outdated||a.outdated?2:0)),this.left=e,this.right=a,this.size=e.size+a.size}get break(){return this.flags&1}blockAt(e,n,a,r){let i=a+this.left.height;return e<i?this.left.blockAt(e,n,a,r):this.right.blockAt(e,n,i,r+this.left.length+this.break)}lineAt(e,n,a,r,i){let o=r+this.left.height,s=i+this.left.length+this.break,l=n==Pa.ByHeight?e<o:e<s,u=l?this.left.lineAt(e,n,a,r,i):this.right.lineAt(e,n,a,o,s);if(this.break||(l?u.to<s:u.from>s))return u;let d=n==Pa.ByPosNoHeight?Pa.ByPosNoHeight:Pa.ByPos;return l?u.join(this.right.lineAt(s,d,a,o,s)):this.left.lineAt(s,d,a,r,i).join(u)}forEachLine(e,n,a,r,i,o){let s=r+this.left.height,l=i+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,n,a,r,i,o),n>=l&&this.right.forEachLine(e,n,a,s,l,o);else{let u=this.lineAt(l,Pa.ByPos,a,r,i);e<u.from&&this.left.forEachLine(e,u.from-1,a,r,i,o),u.to>=e&&u.from<=n&&o(u),n>u.to&&this.right.forEachLine(u.to+1,n,a,s,l,o)}}replace(e,n,a){let r=this.left.length+this.break;if(n<r)return this.balanced(this.left.replace(e,n,a),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,n-r,a));let i=[];e>0&&this.decomposeLeft(e,i);let o=i.length;for(let s of a)i.push(s);if(e>0&&ose(i,o-1),n<this.length){let s=i.length;this.decomposeRight(n,i),ose(i,s)}return Ro.of(i)}decomposeLeft(e,n){let a=this.left.length;if(e<=a)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(a++,e>=a&&n.push(null)),e>a&&this.right.decomposeLeft(e-a,n)}decomposeRight(e,n){let a=this.left.length,r=a+this.break;if(e>=r)return this.right.decomposeRight(e-r,n);e<a&&this.left.decomposeRight(e,n),this.break&&e<r&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?Ro.of(this.break?[e,null,n]:[e,n]):(this.left=C2(this.left,e),this.right=C2(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,a=!1,r){let{left:i,right:o}=this,s=n+i.length+this.break,l=null;return r&&r.from<=n+i.length&&r.more?l=i=i.updateHeight(e,n,a,r):i.updateHeight(e,n,a),r&&r.from<=s+o.length&&r.more?l=o=o.updateHeight(e,s,a,r):o.updateHeight(e,s,a),l?this.balanced(i,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function ose(t,e){let n,a;t[e]==null&&(n=t[e-1])instanceof Mi&&(a=t[e+1])instanceof Mi&&t.splice(e-1,3,new Mi(n.length+1+a.length))}const Jit=5;class JF{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let a=Math.min(n,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof Ps?r.length+=a-this.pos:(a>this.pos||!this.isCovered)&&this.nodes.push(new Ps(a-this.pos,-1)),this.writtenTo=a,n>a&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,a){if(e<n||a.heightRelevant){let r=a.widget?a.widget.estimatedHeight:0,i=a.widget?a.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let o=n-e;a.block?this.addBlock(new ise(o,r,a)):(o||i||r>=Jit)&&this.addLineDeco(r,i,o)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Ps(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let a=new Mi(n-e);return this.oracle.doc.lineAt(e).to==n&&(a.flags|=4),a}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ps)return e;let n=new Ps(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,a){let r=this.ensureLine();r.length+=a,r.collapsed+=a,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=n,this.writtenTo=this.pos=this.pos+a}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Ps)&&!this.isCovered?this.nodes.push(new Ps(0,-1)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let a=e;for(let r of this.nodes)r instanceof Ps&&r.updateHeight(this.oracle,a),a+=r?r.length:1;return this.nodes}static build(e,n,a,r){let i=new JF(a,e);return ta.spans(n,a,r,i,0),i.finish(a)}}function Xit(t,e,n){let a=new eot;return ta.compare(t,e,n,a,0),a.changes}class eot{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,a,r){(e<n||a&&a.heightRelevant||r&&r.heightRelevant)&&g2(e,n,this.changes,5)}}function tot(t,e){let n=t.getBoundingClientRect(),a=t.ownerDocument,r=a.defaultView||window,i=Math.max(0,n.left),o=Math.min(r.innerWidth,n.right),s=Math.max(0,n.top),l=Math.min(r.innerHeight,n.bottom);for(let u=t.parentNode;u&&u!=a.body;)if(u.nodeType==1){let d=u,p=window.getComputedStyle(d);if((d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth)&&p.overflow!="visible"){let m=d.getBoundingClientRect();i=Math.max(i,m.left),o=Math.min(o,m.right),s=Math.max(s,m.top),l=Math.min(u==t.parentNode?r.innerHeight:l,m.bottom)}u=p.position=="absolute"||p.position=="fixed"?d.offsetParent:d.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:i-n.left,right:Math.max(i,o)-n.left,top:s-(n.top+e),bottom:Math.max(s,l)-(n.top+e)}}function not(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}function aot(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class XF{constructor(e,n,a,r){this.from=e,this.to=n,this.size=a,this.displaySize=r}static same(e,n){if(e.length!=n.length)return!1;for(let a=0;a<e.length;a++){let r=e[a],i=n[a];if(r.from!=i.from||r.to!=i.to||r.size!=i.size)return!1}return!0}draw(e,n){return ln.replace({widget:new rot(this.displaySize*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class rot extends Cd{constructor(e,n){super(),this.size=e,this.vertical=n}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class sse{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=cse,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Ra.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=e.facet(zF).some(a=>typeof a!="function"&&a.class=="cm-lineWrapping");this.heightOracle=new Kit(n),this.stateDeco=e.facet(d1).filter(a=>typeof a!="function"),this.heightMap=Ro.empty().applyChanges(this.stateDeco,ea.empty,this.heightOracle.setDoc(e.doc),[new fc(0,0,0,e.doc.length)]);for(let a=0;a<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());a++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ln.set(this.lineGaps.map(a=>a.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let a=0;a<=1;a++){let r=a?n.head:n.anchor;if(!e.some(({from:i,to:o})=>r>=i&&r<=o)){let{from:i,to:o}=this.lineBlockAt(r);e.push(new _2(i,o))}}return this.viewports=e.sort((a,r)=>a.from-r.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?cse:new eL(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(h1(e,this.scaler))})}update(e,n=null){this.state=e.state;let a=this.stateDeco;this.stateDeco=this.state.facet(d1).filter(d=>typeof d!="function");let r=e.changedRanges,i=fc.extendWithRanges(r,Xit(a,this.stateDeco,e?e.changes:Xr.empty(this.state.doc.length))),o=this.heightMap.height,s=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);rse(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||lb)&&(e.flags|=2),s?(this.scrollAnchorPos=e.changes.mapPos(s.from,-1),this.scrollAnchorHeight=s.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let l=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.head<l.from||n.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,n));let u=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(u||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(yoe)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,a=window.getComputedStyle(n),r=this.heightOracle,i=a.whiteSpace;this.defaultTextDirection=a.direction=="rtl"?Ra.RTL:Ra.LTR;let o=this.heightOracle.mustRefreshForWrapping(i),s=n.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=s.height;this.contentDOMHeight=s.height,this.mustMeasureContent=!1;let u=0,d=0;if(s.width&&s.height){let{scaleX:k,scaleY:C}=Hie(n,s);(k>.005&&Math.abs(this.scaleX-k)>.005||C>.005&&Math.abs(this.scaleY-C)>.005)&&(this.scaleX=k,this.scaleY=C,u|=16,o=l=!0)}let p=(parseInt(a.paddingTop)||0)*this.scaleY,m=(parseInt(a.paddingBottom)||0)*this.scaleY;(this.paddingTop!=p||this.paddingBottom!=m)&&(this.paddingTop=p,this.paddingBottom=m,u|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,u|=16);let A=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=A&&(this.scrollAnchorHeight=-1,this.scrollTop=A),this.scrolledToBottom=Kie(e.scrollDOM);let g=(this.printing?aot:tot)(n,this.paddingTop),h=g.top-this.pixelViewport.top,f=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let b=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(b!=this.inView&&(this.inView=b,b&&(l=!0)),!this.inView&&!this.scrollTarget&&!not(e.dom))return 0;let y=s.width;if((this.contentDOMWidth!=y||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=s.width,this.editorHeight=e.scrollDOM.clientHeight,u|=16),l){let k=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(k)&&(o=!0),o||r.lineWrapping&&Math.abs(y-this.contentDOMWidth)>r.charWidth){let{lineHeight:C,charWidth:x,textHeight:_}=e.docView.measureTextSize();o=C>0&&r.refresh(i,C,x,_,Math.max(5,y/x),k),o&&(e.docView.minWidth=0,u|=16)}h>0&&f>0?d=Math.max(h,f):h<0&&f<0&&(d=Math.min(h,f)),rse();for(let C of this.viewports){let x=C.from==this.viewport.from?k:e.docView.measureVisibleLineHeights(C);this.heightMap=(o?Ro.empty().applyChanges(this.stateDeco,ea.empty,this.heightOracle,[new fc(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new Zit(C.from,x))}lb&&(u|=2)}let w=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return w&&(u&2&&(u|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),u|=this.updateForViewport()),(u&2||w)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let a=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:o,visibleBottom:s}=this,l=new _2(r.lineAt(o-a*1e3,Pa.ByHeight,i,0,0).from,r.lineAt(s+(1-a)*1e3,Pa.ByHeight,i,0,0).to);if(n){let{head:u}=n.range;if(u<l.from||u>l.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),p=r.lineAt(u,Pa.ByPos,i,0,0),m;n.y=="center"?m=(p.top+p.bottom)/2-d/2:n.y=="start"||n.y=="nearest"&&u<l.from?m=p.top:m=p.bottom-d,l=new _2(r.lineAt(m-1e3/2,Pa.ByHeight,i,0,0).from,r.lineAt(m+d+1e3/2,Pa.ByHeight,i,0,0).to)}}return l}mapViewport(e,n){let a=n.mapPos(e.from,-1),r=n.mapPos(e.to,1);return new _2(this.heightMap.lineAt(a,Pa.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,Pa.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},a=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,Pa.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,Pa.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:s}=this;return(e==0||r<=o-Math.max(10,Math.min(-a,250)))&&(n==this.state.doc.length||i>=s+Math.max(10,Math.min(a,250)))&&r>o-2*1e3&&i<s+2*1e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let a=[];for(let r of e)n.touchesRange(r.from,r.to)||a.push(new XF(n.mapPos(r.from),n.mapPos(r.to),r.size,r.displaySize));return a}ensureLineGaps(e,n){let a=this.heightOracle.lineWrapping,r=a?1e4:2e3,i=r>>1,o=r<<1;if(this.defaultTextDirection!=Ra.LTR&&!a)return[];let s=[],l=(d,p,m,A)=>{if(p-d<i)return;let g=this.state.selection.main,h=[g.from];g.empty||h.push(g.to);for(let b of h)if(b>d&&b<p){l(d,b-10,m,A),l(b+10,p,m,A);return}let f=oot(e,b=>b.from>=m.from&&b.to<=m.to&&Math.abs(b.from-d)<i&&Math.abs(b.to-p)<i&&!h.some(y=>b.from<y&&b.to>y));if(!f){if(p<m.to&&n&&a&&n.visibleRanges.some(w=>w.from<=p&&w.to>=p)){let w=n.moveToLineBoundary(lt.cursor(p),!1,!0).head;w>d&&(p=w)}let b=this.gapSize(m,d,p,A),y=a||b<2e6?b:2e6;f=new XF(d,p,b,y)}s.push(f)},u=d=>{if(d.length<o||d.type!=Mo.Text)return;let p=iot(d.from,d.to,this.stateDeco);if(p.total<o)return;let m=this.scrollTarget?this.scrollTarget.range.head:null,A,g;if(a){let h=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,f,b;if(m!=null){let y=E2(p,m),w=((this.visibleBottom-this.visibleTop)/2+h)/d.height;f=y-w,b=y+w}else f=(this.visibleTop-d.top-h)/d.height,b=(this.visibleBottom-d.top+h)/d.height;A=x2(p,f),g=x2(p,b)}else{let h=p.total*this.heightOracle.charWidth,f=r*this.heightOracle.charWidth,b=0;if(h>2e6)for(let x of e)x.from>=d.from&&x.from<d.to&&x.size!=x.displaySize&&x.from*this.heightOracle.charWidth+b<this.pixelViewport.left&&(b=x.size-x.displaySize);let y=this.pixelViewport.left+b,w=this.pixelViewport.right+b,k,C;if(m!=null){let x=E2(p,m),_=((w-y)/2+f)/h;k=x-_,C=x+_}else k=(y-f)/h,C=(w+f)/h;A=x2(p,k),g=x2(p,C)}A>d.from&&l(d.from,A,d,p),g<d.to&&l(g,d.to,d,p)};for(let d of this.viewportLines)Array.isArray(d.type)?d.type.forEach(u):u(d);return s}gapSize(e,n,a,r){let i=E2(r,a)-E2(r,n);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){XF.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ln.set(e.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let a=[];ta.spans(n,this.viewport.from,this.viewport.to,{span(i,o){a.push({from:i,to:o})},point(){}},20);let r=0;if(a.length!=this.visibleRanges.length)r=12;else for(let i=0;i<a.length&&!(r&8);i++){let o=this.visibleRanges[i],s=a[i];(o.from!=s.from||o.to!=s.to)&&(r|=4,e&&e.mapPos(o.from,-1)==s.from&&e.mapPos(o.to,1)==s.to||(r|=8))}return this.visibleRanges=a,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||h1(this.heightMap.lineAt(e,Pa.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||h1(this.heightMap.lineAt(this.scaler.fromDOM(e),Pa.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return h1(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class _2{constructor(e,n){this.from=e,this.to=n}}function iot(t,e,n){let a=[],r=t,i=0;return ta.spans(n,t,e,{span(){},point(o,s){o>r&&(a.push({from:r,to:o}),i+=o-r),r=s}},20),r<e&&(a.push({from:r,to:e}),i+=e-r),{total:i,ranges:a}}function x2({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let a=Math.floor(t*n);for(let r=0;;r++){let{from:i,to:o}=e[r],s=o-i;if(a<=s)return i+a;a-=s}}function E2(t,e){let n=0;for(let{from:a,to:r}of t.ranges){if(e<=r){n+=e-a;break}n+=r-a}return n/t.total}function oot(t,e){for(let n of t)if(e(n))return n}const cse={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class eL{constructor(e,n,a){let r=0,i=0,o=0;this.viewports=a.map(({from:s,to:l})=>{let u=n.lineAt(s,Pa.ByPos,e,0,0).top,d=n.lineAt(l,Pa.ByPos,e,0,0).bottom;return r+=d-u,{from:s,to:l,top:u,bottom:d,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(n.height-r);for(let s of this.viewports)s.domTop=o+(s.top-i)*this.scale,o=s.domBottom=s.domTop+(s.bottom-s.top),i=s.bottom}toDOM(e){for(let n=0,a=0,r=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||e<i.top)return r+(e-a)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);a=i.bottom,r=i.domBottom}}fromDOM(e){for(let n=0,a=0,r=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||e<i.domTop)return a+(e-r)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);a=i.bottom,r=i.domBottom}}eq(e){return e instanceof eL?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((n,a)=>n.from==e.viewports[a].from&&n.to==e.viewports[a].to):!1}}function h1(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),a=e.toDOM(t.bottom);return new cu(t.from,t.length,n,a-n,Array.isArray(t._content)?t._content.map(r=>h1(r,e)):t._content)}const B2=zt.define({combine:t=>t.join(" ")}),tL=zt.define({combine:t=>t.indexOf(!0)>-1}),nL=Kp.newName(),lse=Kp.newName(),use=Kp.newName(),dse={"&light":"."+lse,"&dark":"."+use};function aL(t,e,n){return new Kp(e,{finish(a){return/&/.test(a)?a.replace(/&\w*/,r=>{if(r=="&")return t;if(!n||!n[r])throw new RangeError(`Unsupported selector: ${r}`);return n[r]}):t+" "+a}})}const sot=aL("."+nL,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},dse),cot={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},rL=$t.ie&&$t.ie_version<=11;class lot{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Hrt,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let a of n)this.queue.push(a);($t.ie&&$t.ie_version<=11||$t.ios&&e.composing)&&n.some(a=>a.type=="childList"&&a.removedNodes.length||a.type=="characterData"&&a.oldValue.length>a.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&$t.android&&e.constructor.EDIT_CONTEXT!==!1&&!($t.chrome&&$t.chrome_version<126)&&(this.editContext=new dot(e),e.state.facet(xd)&&(e.contentDOM.editContext=this.editContext.editContext)),rL&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,a)=>n!=e[a]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:a}=this,r=this.selectionRange;if(a.state.facet(xd)?a.root.activeElement!=this.dom:!p2(this.dom,r))return;let i=r.anchorNode&&a.docView.nearest(r.anchorNode);if(i&&i.ignoreEvent(e)){n||(this.selectionChanged=!1);return}($t.ie&&$t.ie_version<=11||$t.android&&$t.chrome)&&!a.state.selection.main.empty&&r.focusNode&&o1(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=i1(e.root);if(!n)return!1;let a=$t.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&uot(this.view,n)||n;if(!a||this.selectionRange.eq(a))return!1;let r=p2(this.dom,a);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Yrt(this.dom,a)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(a),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let a=this.dom;a;)if(a.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==a?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(a),a=a.assignedSlot||a.parentNode;else if(a.nodeType==11)a=a.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let a of this.scrollTargets)a.removeEventListener("scroll",this.onScroll);for(let a of this.scrollTargets=n)a.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,cot),rL&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),rL&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var a;if(!this.delayedAndroidKey){let r=()=>{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&rb(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((a=this.delayedAndroidKey)===null||a===void 0)&&a.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,a=-1,r=!1;for(let i of e){let o=this.readMutation(i);o&&(o.typeOver&&(r=!0),n==-1?{from:n,to:a}=o:(n=Math.min(o.from,n),a=Math.max(o.to,a)))}return{from:n,to:a,typeOver:r}}readChange(){let{from:e,to:n,typeOver:a}=this.processRecords(),r=this.selectionChanged&&p2(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new Iit(this.view,e,n,a);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let a=this.view.state,r=Poe(this.view,n);return this.view.state==a&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),r}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let a=pse(n,e.previousSibling||e.target.previousSibling,-1),r=pse(n,e.nextSibling||e.target.nextSibling,1);return{from:a?n.posAfter(a):n.posAtStart,to:r?n.posBefore(r):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(xd)!=e.state.facet(xd)&&(e.view.contentDOM.editContext=e.state.facet(xd)?this.editContext.editContext:null))}destroy(){var e,n,a;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(a=this.resizeScroll)===null||a===void 0||a.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function pse(t,e,n){for(;e;){let a=Ca.get(e);if(a&&a.parent==t)return a;let r=e.parentNode;e=r!=t.dom?r:n>0?e.nextSibling:e.previousSibling}return null}function mse(t,e){let n=e.startContainer,a=e.startOffset,r=e.endContainer,i=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor);return o1(o.node,o.offset,r,i)&&([n,a,r,i]=[r,i,n,a]),{anchorNode:n,anchorOffset:a,focusNode:r,focusOffset:i}}function uot(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return mse(t,r)}let n=null;function a(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",a,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",a,!0),n?mse(t,n):null}class dot{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=a=>{let r=e.state.selection.main,{anchor:i,head:o}=r,s=this.toEditorPos(a.updateRangeStart),l=this.toEditorPos(a.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:a.updateRangeStart,editorBase:s,drifted:!1});let u=l-s>a.text.length;s==this.from&&i<this.from?s=i:l==this.to&&i>this.to&&(l=i);let d=$oe(e.state.sliceDoc(s,l),a.text,(u?r.from:r.to)-s,u?"end":null);if(!d){let m=lt.single(this.toEditorPos(a.selectionStart),this.toEditorPos(a.selectionEnd));m.main.eq(r)||e.dispatch({selection:m,userEvent:"select"});return}let p={from:d.from+s,to:d.toA+s,insert:ea.of(a.text.slice(d.from,d.toB).split(`
|
|
1359
1359
|
`))};if(($t.mac||$t.android)&&p.from==o-1&&/^\. ?$/.test(a.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(p={from:s,to:l,insert:ea.of([a.text.replace("."," ")])}),this.pendingContextChange=p,!e.state.readOnly){let m=this.to-this.from+(p.to-p.from+p.insert.length);ZF(e,p,lt.single(this.toEditorPos(a.selectionStart,m),this.toEditorPos(a.selectionEnd,m)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),p.from<p.to&&!p.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,a.updateRangeStart-1),Math.min(n.text.length,a.updateRangeStart+1)))&&this.handlers.compositionend(a)},this.handlers.characterboundsupdate=a=>{let r=[],i=null;for(let o=this.toEditorPos(a.rangeStart),s=this.toEditorPos(a.rangeEnd);o<s;o++){let l=e.coordsForChar(o);i=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||i||new DOMRect,r.push(i)}n.updateCharacterBounds(a.rangeStart,r)},this.handlers.textformatupdate=a=>{let r=[];for(let i of a.getTextFormats()){let o=i.underlineStyle,s=i.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(s)){let l=this.toEditorPos(i.rangeStart),u=this.toEditorPos(i.rangeEnd);if(l<u){let d=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(s)?1:2}px`;r.push(ln.mark({attributes:{style:d}}).range(l,u))}}}e.dispatch({effects:koe.of(ln.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:a}=this.composing;this.composing=null,a&&this.reset(e.state)}};for(let a in this.handlers)n.addEventListener(a,this.handlers[a]);this.measureReq={read:a=>{this.editContext.updateControlBounds(a.contentDOM.getBoundingClientRect());let r=i1(a.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,a=!1,r=this.pendingContextChange;return e.changes.iterChanges((i,o,s,l,u)=>{if(a)return;let d=u.length-(o-i);if(r&&o>=r.to)if(r.from==i&&r.to==o&&r.insert.eq(u)){r=this.pendingContextChange=null,n+=d,this.to+=d;return}else r=null,this.revertPending(e.state);if(i+=n,o+=n,o<=this.from)this.from+=d,this.to+=d;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+u.length>3e4){a=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),u.toString()),this.to+=d}n+=d}),r&&!a&&this.revertPending(e.state),!a}update(e){let n=this.pendingContextChange,a=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(a.from,a.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,a=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),r=this.toContextPos(n.head);(this.editContext.selectionStart!=a||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(a,r)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let a=this.composing;return a&&a.drifted?a.editorBase+(e-a.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Ot{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:a}=e;this.dispatchTransactions=e.dispatchTransactions||a&&(r=>r.forEach(i=>a(i,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Urt(e.parent)||document,this.viewState=new sse(e.state||Hn.create(e)),e.scrollTo&&e.scrollTo.is(f2)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(cb).map(r=>new qF(r));for(let r of this.plugins)r.update(this);this.observer=new lot(this),this.inputState=new Tit(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Boe(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let n=e.length==1&&e[0]instanceof ei?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,a=!1,r,i=this.state;for(let m of e){if(m.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=m.state}if(this.destroyed){this.viewState.state=i;return}let o=this.hasFocus,s=0,l=null;e.some(m=>m.annotation(Xoe))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=ese(i,o),l||(s=1));let u=this.observer.delayedAndroidKey,d=null;if(u?(this.observer.clearDelayedAndroidKey(),d=this.observer.readChange(),(d&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(d=null)):this.observer.clear(),i.facet(Hn.phrases)!=this.state.facet(Hn.phrases))return this.setState(i);r=b2.create(this,i,e),r.flags|=s;let p=this.viewState.scrollTarget;try{this.updateState=2;for(let m of e){if(p&&(p=p.map(m.changes)),m.scrollIntoView){let{main:A}=m.state.selection;p=new sb(A.empty?A:lt.cursor(A.head,A.head>A.anchor?-1:1))}for(let A of m.effects)A.is(f2)&&(p=A.value.clip(this.state))}this.viewState.update(r,p),this.bidiCache=I2.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),n=this.docView.update(r),this.state.facet(m1)!=this.styleModules&&this.mountStyles(),a=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(m=>m.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(B2)!=r.state.facet(B2)&&(this.viewState.mustMeasureContent=!0),(n||a||p||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!r.empty)for(let m of this.state.facet(OF))try{m(r)}catch(A){us(this.state,A,"update listener")}(l||d)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),d&&!Poe(this,d)&&u.force&&rb(this.contentDOM,u.key,u.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let a of this.plugins)a.destroy(this);this.viewState=new sse(e),this.plugins=e.facet(cb).map(a=>new qF(a)),this.pluginMap.clear();for(let a of this.plugins)a.update(this);this.docView.destroy(),this.docView=new Boe(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(cb),a=e.state.facet(cb);if(n!=a){let r=[];for(let i of a){let o=n.indexOf(i);if(o<0)r.push(new qF(i));else{let s=this.plugins[o];s.mustUpdate=e,r.push(s)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=e;for(let r=0;r<this.plugins.length;r++)this.plugins[r].update(this);n!=a&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(a){us(this.state,a,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,a=this.scrollDOM,r=a.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let s=0;;s++){if(o<0)if(Kie(a))i=-1,o=this.viewState.heightMap.height;else{let A=this.viewState.scrollAnchorAt(r);i=A.from,o=A.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(s>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];l&4||([this.measureRequests,u]=[u,this.measureRequests]);let d=u.map(A=>{try{return A.read(this)}catch(g){return us(this.state,g),Ase}}),p=b2.create(this,this.state,[]),m=!1;p.flags|=l,n?n.flags|=l:n=p,this.updateState=2,p.empty||(this.updatePlugins(p),this.inputState.update(p),this.updateAttrs(),m=this.docView.update(p),m&&this.docViewUpdate());for(let A=0;A<u.length;A++)if(d[A]!=Ase)try{let g=u[A];g.write&&g.write(d[A],this)}catch(g){us(this.state,g)}if(m&&this.docView.updateSelection(!0),!p.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let g=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-o;if(g>1||g<-1){r=r+g,a.scrollTop=r/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let s of this.state.facet(OF))s(n)}get themeClasses(){return nL+" "+(this.state.facet(tL)?use:lse)+" "+this.state.facet(B2)}updateAttrs(){let e=gse(this,voe,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(xd)?"true":"false",class:"cm-content",style:`${$t.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),gse(this,zF,n);let a=this.observer.ignore(()=>{let r=LF(this.contentDOM,this.contentAttrs,n),i=LF(this.dom,this.editorAttrs,e);return r||i});return this.editorAttrs=e,this.contentAttrs=n,a}showAnnouncements(e){let n=!0;for(let a of e)for(let r of a.effects)if(r.is(Ot.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(m1);let e=this.state.facet(Ot.cspNonce);Kp.mount(this.root,this.styleModules.concat(sot).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.plugin!=e)&&this.pluginMap.set(e,n=this.plugins.find(a=>a.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,a){return KF(this,e,Noe(this,e,n,a))}moveByGroup(e,n){return KF(this,e,Noe(this,e,n,a=>Cit(this,e.head,a)))}visualLineSide(e,n){let a=this.bidiSpans(e),r=this.textDirectionAt(e.from),i=a[n?a.length-1:0];return lt.cursor(i.side(n,r)+e.from,i.forward(!n,r)?1:-1)}moveToLineBoundary(e,n,a=!0){return vit(this,e,n,a)}moveVertically(e,n,a){return KF(this,e,_it(this,e,n,a))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),Toe(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let a=this.docView.coordsAt(e,n);if(!a||a.left==a.right)return a;let r=this.state.doc.lineAt(e),i=this.bidiSpans(r),o=i[Xp.find(i,e-r.from,-1,n)];return s1(a,o.dir==Ra.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(boe)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>pot)return uoe(e.length);let n=this.textDirectionAt(e.from),a;for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||loe(i.isolates,a=xoe(this,e))))return i.order;a||(a=xoe(this,e));let r=oit(e.text,n,a);return this.bidiCache.push(new I2(e.from,e.to,n,a,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||$t.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Uie(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return f2.of(new sb(typeof e=="number"?lt.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,a=this.viewState.scrollAnchorAt(e);return f2.of(new sb(lt.cursor(a.from),"start","start",a.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return vr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return vr.define(()=>({}),{eventObservers:e})}static theme(e,n){let a=Kp.newName(),r=[B2.of(a),m1.of(aL(`.${a}`,e))];return n&&n.dark&&r.push(tL.of(!0)),r}static baseTheme(e){return ag.lowest(m1.of(aL("."+nL,e,dse)))}static findFromDOM(e){var n;let a=e.querySelector(".cm-content"),r=a&&Ca.get(a)||Ca.get(e);return((n=r==null?void 0:r.rootView)===null||n===void 0?void 0:n.view)||null}}Ot.styleModule=m1,Ot.inputHandler=hoe,Ot.clipboardInputFilter=jF,Ot.clipboardOutputFilter=GF,Ot.scrollHandler=woe,Ot.focusChangeEffect=foe,Ot.perLineTextDirection=boe,Ot.exceptionSink=goe,Ot.updateListener=OF,Ot.editable=xd,Ot.mouseSelectionStyle=Aoe,Ot.dragMovesSelection=moe,Ot.clickAddsSelectionRange=poe,Ot.decorations=d1,Ot.outerDecorations=Coe,Ot.atomicRanges=p1,Ot.bidiIsolatedRanges=_oe,Ot.scrollMargins=Eoe,Ot.darkTheme=tL,Ot.cspNonce=zt.define({combine:t=>t.length?t[0]:""}),Ot.contentAttributes=zF,Ot.editorAttributes=voe,Ot.lineWrapping=Ot.contentAttributes.of({class:"cm-lineWrapping"}),Ot.announce=Bn.define();const pot=4096,Ase={};class I2{constructor(e,n,a,r,i,o){this.from=e,this.to=n,this.dir=a,this.isolates=r,this.fresh=i,this.order=o}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let a=[],r=e.length?e[e.length-1].dir:Ra.LTR;for(let i=Math.max(0,e.length-10);i<e.length;i++){let o=e[i];o.dir==r&&!n.touchesRange(o.from,o.to)&&a.push(new I2(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return a}}function gse(t,e,n){for(let a=t.state.facet(e),r=a.length-1;r>=0;r--){let i=a[r],o=typeof i=="function"?i(t):i;o&&FF(o,n)}return n}const mot=$t.mac?"mac":$t.windows?"win":$t.linux?"linux":"key";function Aot(t,e){const n=t.split(/-(?!$)/);let a=n[n.length-1];a=="Space"&&(a=" ");let r,i,o,s;for(let l=0;l<n.length-1;++l){const u=n[l];if(/^(cmd|meta|m)$/i.test(u))s=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))o=!0;else if(/^mod$/i.test(u))e=="mac"?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(a="Alt-"+a),i&&(a="Ctrl-"+a),s&&(a="Meta-"+a),o&&(a="Shift-"+a),a}function D2(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}const got=ag.default(Ot.domEventHandlers({keydown(t,e){return bse(fse(e.state),t,e,"editor")}})),Q2=zt.define({enables:got}),hse=new WeakMap;function fse(t){let e=t.facet(Q2),n=hse.get(e);return n||hse.set(e,n=bot(e.reduce((a,r)=>a.concat(r),[]))),n}function hot(t,e,n){return bse(fse(t.state),e,t,n)}let em=null;const fot=4e3;function bot(t,e=mot){let n=Object.create(null),a=Object.create(null),r=(o,s)=>{let l=a[o];if(l==null)a[o]=s;else if(l!=s)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},i=(o,s,l,u,d)=>{var p,m;let A=n[o]||(n[o]=Object.create(null)),g=s.split(/ (?!$)/).map(b=>Aot(b,e));for(let b=1;b<g.length;b++){let y=g.slice(0,b).join(" ");r(y,!0),A[y]||(A[y]={preventDefault:!0,stopPropagation:!1,run:[w=>{let k=em={view:w,prefix:y,scope:o};return setTimeout(()=>{em==k&&(em=null)},fot),!0}]})}let h=g.join(" ");r(h,!1);let f=A[h]||(A[h]={preventDefault:!1,stopPropagation:!1,run:((m=(p=A._any)===null||p===void 0?void 0:p.run)===null||m===void 0?void 0:m.slice())||[]});l&&f.run.push(l),u&&(f.preventDefault=!0),d&&(f.stopPropagation=!0)};for(let o of t){let s=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let u of s){let d=n[u]||(n[u]=Object.create(null));d._any||(d._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:p}=o;for(let m in d)d[m].run.push(A=>p(A,iL))}let l=o[e]||o.key;if(l)for(let u of s)i(u,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&i(u,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return n}let iL=null;function bse(t,e,n,a){iL=e;let r=jrt(e),i=ls(r,0),o=nu(i)==r.length&&r!=" ",s="",l=!1,u=!1,d=!1;em&&em.view==n&&em.scope==a&&(s=em.prefix+" ",Goe.indexOf(e.keyCode)<0&&(u=!0,em=null));let p=new Set,m=f=>{if(f){for(let b of f.run)if(!p.has(b)&&(p.add(b),b(n)))return f.stopPropagation&&(d=!0),!0;f.preventDefault&&(f.stopPropagation&&(d=!0),u=!0)}return!1},A=t[a],g,h;return A&&(m(A[s+D2(r,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!($t.windows&&e.ctrlKey&&e.altKey)&&!($t.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(g=Zp[e.keyCode])&&g!=r?(m(A[s+D2(g,e,!0)])||e.shiftKey&&(h=r1[e.keyCode])!=r&&h!=g&&m(A[s+D2(h,e,!1)]))&&(l=!0):o&&e.shiftKey&&m(A[s+D2(r,e,!0)])&&(l=!0),!l&&m(A._any)&&(l=!0)),u&&(l=!0),l&&d&&e.stopPropagation(),iL=null,l}class f1{constructor(e,n,a,r,i){this.className=e,this.left=n,this.top=a,this.width=r,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,a){if(a.empty){let r=e.coordsAtPos(a.head,a.assoc||1);if(!r)return[];let i=yse(e);return[new f1(n,r.left-i.left,r.top-i.top,null,r.bottom-r.top)]}else return yot(e,n,a)}}function yse(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Ra.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function wse(t,e,n,a){let r=t.coordsAtPos(e,n*2);if(!r)return a;let i=t.dom.getBoundingClientRect(),o=(r.top+r.bottom)/2,s=t.posAtCoords({x:i.left+1,y:o}),l=t.posAtCoords({x:i.right-1,y:o});return s==null||l==null?a:{from:Math.max(a.from,Math.min(s,l)),to:Math.min(a.to,Math.max(s,l))}}function yot(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let a=Math.max(n.from,t.viewport.from),r=Math.min(n.to,t.viewport.to),i=t.textDirection==Ra.LTR,o=t.contentDOM,s=o.getBoundingClientRect(),l=yse(t),u=o.querySelector(".cm-line"),d=u&&window.getComputedStyle(u),p=s.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),m=s.right-(d?parseInt(d.paddingRight):0),A=WF(t,a,1),g=WF(t,r,-1),h=A.type==Mo.Text?A:null,f=g.type==Mo.Text?g:null;if(h&&(t.lineWrapping||A.widgetLineBreaks)&&(h=wse(t,a,1,h)),f&&(t.lineWrapping||g.widgetLineBreaks)&&(f=wse(t,r,-1,f)),h&&f&&h.from==f.from&&h.to==f.to)return y(w(n.from,n.to,h));{let C=h?w(n.from,null,h):k(A,!1),x=f?w(null,n.to,f):k(g,!0),_=[];return(h||A).to<(f||g).from-(h&&f?1:0)||A.widgetLineBreaks>1&&C.bottom+t.defaultLineHeight/2<x.top?_.push(b(p,C.bottom,m,x.top)):C.bottom<x.top&&t.elementAtHeight((C.bottom+x.top)/2).type==Mo.Text&&(C.bottom=x.top=(C.bottom+x.top)/2),y(C).concat(_).concat(y(x))}function b(C,x,_,E){return new f1(e,C-l.left,x-l.top,_-C,E-x)}function y({top:C,bottom:x,horizontal:_}){let E=[];for(let I=0;I<_.length;I+=2)E.push(b(_[I],C,_[I+1],x));return E}function w(C,x,_){let E=1e9,I=-1e9,Q=[];function D(B,S,M,L,F){let R=t.coordsAtPos(B,B==_.to?-2:2),P=t.coordsAtPos(M,M==_.from?2:-2);!R||!P||(E=Math.min(R.top,P.top,E),I=Math.max(R.bottom,P.bottom,I),F==Ra.LTR?Q.push(i&&S?p:R.left,i&&L?m:P.right):Q.push(!i&&L?p:P.left,!i&&S?m:R.right))}let T=C??_.from,N=x??_.to;for(let B of t.visibleRanges)if(B.to>T&&B.from<N)for(let S=Math.max(B.from,T),M=Math.min(B.to,N);;){let L=t.state.doc.lineAt(S);for(let F of t.bidiSpans(L)){let R=F.from+L.from,P=F.to+L.from;if(R>=M)break;P>S&&D(Math.max(R,S),C==null&&R<=T,Math.min(P,M),x==null&&P>=N,F.dir)}if(S=L.to+1,S>=M)break}return Q.length==0&&D(T,C==null,N,x==null,t.textDirection),{top:E,bottom:I,horizontal:Q}}function k(C,x){let _=s.top+(x?C.top:C.bottom);return{top:_,bottom:_,horizontal:[]}}}function wot(t,e){return t.constructor==e.constructor&&t.eq(e)}class kot{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(S2)!=e.state.facet(S2)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,a=e.facet(S2);for(;n<a.length&&a[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:n}=this.view;(e!=this.scaleX||n!=this.scaleY)&&(this.scaleX=e,this.scaleY=n,this.dom.style.transform=`scale(${1/e}, ${1/n})`)}draw(e){if(e.length!=this.drawn.length||e.some((n,a)=>!wot(n,this.drawn[a]))){let n=this.dom.firstChild,a=0;for(let r of e)r.update&&n&&r.constructor&&this.drawn[a].constructor&&r.update(n,this.drawn[a])?(n=n.nextSibling,a++):this.dom.insertBefore(r.draw(),n);for(;n;){let r=n.nextSibling;n.remove(),n=r}this.drawn=e,$t.safari&&$t.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const S2=zt.define();function kse(t){return[vr.define(e=>new kot(e,t)),S2.of(t)]}const b1=zt.define({combine(t){return iu(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function vot(t={}){return[b1.of(t),Cot,_ot,xot,yoe.of(!0)]}function vse(t){return t.startState.facet(b1)!=t.state.facet(b1)}const Cot=kse({above:!0,markers(t){let{state:e}=t,n=e.facet(b1),a=[];for(let r of e.selection.ranges){let i=r==e.selection.main;if(r.empty||n.drawRangeCursor){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",s=r.empty?r:lt.cursor(r.head,r.head>r.anchor?-1:1);for(let l of f1.forRange(t,o,s))a.push(l)}}return a},update(t,e){t.transactions.some(a=>a.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=vse(t);return n&&Cse(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){Cse(e.state,t)},class:"cm-cursorLayer"});function Cse(t,e){e.style.animationDuration=t.facet(b1).cursorBlinkRate+"ms"}const _ot=kse({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:f1.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||vse(t)},class:"cm-selectionLayer"}),xot=ag.highest(Ot.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),_se=Bn.define({map(t,e){return t==null?null:e.mapPos(t)}}),y1=Li.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,a)=>a.is(_se)?a.value:n,t)}}),Eot=vr.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(y1);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(y1)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(y1),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let a=t.scrollDOM.getBoundingClientRect();return{left:n.left-a.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-a.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(y1)!=t&&this.view.dispatch({effects:_se.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Bot(){return[y1,Eot]}function xse(t,e,n,a,r){e.lastIndex=0;for(let i=t.iterRange(n,a),o=n,s;!i.next().done;o+=i.value.length)if(!i.lineBreak)for(;s=e.exec(i.value);)r(o+s.index,s)}function Iot(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let a=[];for(let{from:r,to:i}of n)r=Math.max(t.state.doc.lineAt(r).from,r-e),i=Math.min(t.state.doc.lineAt(i).to,i+e),a.length&&a[a.length-1].to>=r?a[a.length-1].to=i:a.push({from:r,to:i});return a}class Dot{constructor(e){const{regexp:n,decoration:a,decorate:r,boundary:i,maxLength:o=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,r)this.addMatch=(s,l,u,d)=>r(d,u,u+s[0].length,s,l);else if(typeof a=="function")this.addMatch=(s,l,u,d)=>{let p=a(s,l,u);p&&d(u,u+s[0].length,p)};else if(a)this.addMatch=(s,l,u,d)=>d(u,u+s[0].length,a);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=o}createDeco(e){let n=new kd,a=n.add.bind(n);for(let{from:r,to:i}of Iot(e,this.maxLength))xse(e.state.doc,this.regexp,r,i,(o,s)=>this.addMatch(s,e,o,a));return n.finish()}updateDeco(e,n){let a=1e9,r=-1;return e.docChanged&&e.changes.iterChanges((i,o,s,l)=>{l>=e.view.viewport.from&&s<=e.view.viewport.to&&(a=Math.min(s,a),r=Math.max(l,r))}),e.viewportMoved||r-a>1e3?this.createDeco(e.view):r>-1?this.updateRange(e.view,n.map(e.changes),a,r):n}updateRange(e,n,a,r){for(let i of e.visibleRanges){let o=Math.max(i.from,a),s=Math.min(i.to,r);if(s>=o){let l=e.state.doc.lineAt(o),u=l.to<s?e.state.doc.lineAt(s):l,d=Math.max(i.from,l.from),p=Math.min(i.to,u.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){d=o;break}for(;s<u.to;s++)if(this.boundary.test(u.text[s-u.from])){p=s;break}}let m=[],A,g=(h,f,b)=>m.push(b.range(h,f));if(l==u)for(this.regexp.lastIndex=d-l.from;(A=this.regexp.exec(l.text))&&A.index<p-l.from;)this.addMatch(A,e,A.index+l.from,g);else xse(e.state.doc,this.regexp,d,p,(h,f)=>this.addMatch(f,e,h,g));n=n.update({filterFrom:d,filterTo:p,filter:(h,f)=>h<d||f>p,add:m})}}return n}}const oL=/x/.unicode!=null?"gu":"g",Qot=new RegExp(`[\0-\b
|
|
1360
1360
|
--\u2028\u2029\uFEFF-]`,oL),Sot={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let sL=null;function Tot(){var t;if(sL==null&&typeof document<"u"&&document.body){let e=document.body.style;sL=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return sL||!1}const T2=zt.define({combine(t){let e=iu(t,{render:null,specialChars:Qot,addSpecialChars:null});return(e.replaceTabs=!Tot())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,oL)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,oL)),e}});function Fot(t={}){return[T2.of(t),Lot()]}let Ese=null;function Lot(){return Ese||(Ese=vr.fromClass(class{constructor(t){this.view=t,this.decorations=ln.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(T2)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new Dot({regexp:t.specialChars,decoration:(e,n,a)=>{let{doc:r}=n.state,i=ls(e[0],0);if(i==9){let o=r.lineAt(a),s=n.state.tabSize,l=nb(o.text,s,a-o.from);return ln.replace({widget:new Pot((s-l%s)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=ln.replace({widget:new Rot(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(T2);t.startState.facet(T2)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const Not="•";function Mot(t){return t>=32?Not:t==10?"":String.fromCharCode(9216+t)}class Rot extends Cd{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=Mot(this.code),a=e.state.phrase("Control character")+" "+(Sot[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,a,n);if(r)return r;let i=document.createElement("span");return i.textContent=n,i.title=a,i.setAttribute("aria-label",a),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class Pot extends Cd{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function $ot(){return jot}const Oot=ln.line({class:"cm-activeLine"}),jot=vr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let a of t.state.selection.ranges){let r=t.lineBlockAt(a.head);r.from>e&&(n.push(Oot.range(r.from)),e=r.from)}return ln.set(n)}},{decorations:t=>t.decorations});class Got extends Cd{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?ab(e.firstChild):[];if(!n.length)return null;let a=window.getComputedStyle(e.parentNode),r=s1(n[0],a.direction!="rtl"),i=parseInt(a.lineHeight);return r.bottom-r.top>i*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+i}:r}ignoreEvent(){return!1}}function qot(t){let e=vr.fromClass(class{constructor(n){this.view=n,this.placeholder=t?ln.set([ln.widget({widget:new Got(t),side:1}).range(0)]):ln.none}get decorations(){return this.view.state.doc.length?ln.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,Ot.contentAttributes.of({"aria-placeholder":t})]:e}const cL=2e3;function zot(t,e,n){let a=Math.min(e.line,n.line),r=Math.max(e.line,n.line),i=[];if(e.off>cL||n.off>cL||e.col<0||n.col<0){let o=Math.min(e.off,n.off),s=Math.max(e.off,n.off);for(let l=a;l<=r;l++){let u=t.doc.line(l);u.length<=s&&i.push(lt.range(u.from+o,u.to+s))}}else{let o=Math.min(e.col,n.col),s=Math.max(e.col,n.col);for(let l=a;l<=r;l++){let u=t.doc.line(l),d=vF(u.text,o,t.tabSize,!0);if(d<0)i.push(lt.cursor(u.to));else{let p=vF(u.text,s,t.tabSize);i.push(lt.range(u.from+d,u.from+p))}}}return i}function Hot(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function Bse(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),a=t.state.doc.lineAt(n),r=n-a.from,i=r>cL?-1:r==a.length?Hot(t,e.clientX):nb(a.text,t.state.tabSize,n-a.from);return{line:a.number,col:i,off:r}}function Uot(t,e){let n=Bse(t,e),a=t.state.selection;return n?{update(r){if(r.docChanged){let i=r.changes.mapPos(r.startState.doc.line(n.line).from),o=r.state.doc.lineAt(i);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},a=a.map(r.changes)}},get(r,i,o){let s=Bse(t,r);if(!s)return a;let l=zot(t.state,n,s);return l.length?o?lt.create(l.concat(a.ranges)):lt.create(l):a}}:null}function Yot(t){let e=n=>n.altKey&&n.button==0;return Ot.mouseSelectionStyle.of((n,a)=>e(a)?Uot(n,a):null)}const Wot={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},Kot={style:"cursor: crosshair"};function Zot(t={}){let[e,n]=Wot[t.key||"Alt"],a=vr.fromClass(class{constructor(r){this.view=r,this.isDown=!1}set(r){this.isDown!=r&&(this.isDown=r,this.view.update([]))}},{eventObservers:{keydown(r){this.set(r.keyCode==e||n(r))},keyup(r){(r.keyCode==e||!n(r))&&this.set(!1)},mousemove(r){this.set(n(r))}}});return[a,Ot.contentAttributes.of(r=>{var i;return!((i=r.plugin(a))===null||i===void 0)&&i.isDown?Kot:null})]}const w1="-10000px";class Ise{constructor(e,n,a,r){this.facet=n,this.createTooltipView=a,this.removeTooltipView=r,this.input=e.state.facet(n),this.tooltips=this.input.filter(o=>o);let i=null;this.tooltipViews=this.tooltips.map(o=>i=a(o,i))}update(e,n){var a;let r=e.state.facet(this.facet),i=r.filter(l=>l);if(r===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],s=n?[]:null;for(let l=0;l<i.length;l++){let u=i[l],d=-1;if(u){for(let p=0;p<this.tooltips.length;p++){let m=this.tooltips[p];m&&m.create==u.create&&(d=p)}if(d<0)o[l]=this.createTooltipView(u,l?o[l-1]:null),s&&(s[l]=!!u.above);else{let p=o[l]=this.tooltipViews[d];s&&(s[l]=n[d]),p.update&&p.update(e)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(a=l.destroy)===null||a===void 0||a.call(l));return n&&(s.forEach((l,u)=>n[u]=l),n.length=s.length),this.input=r,this.tooltips=i,this.tooltipViews=o,!0}}function Vot(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const lL=zt.define({combine:t=>{var e,n,a;return{position:$t.ios?"absolute":((e=t.find(r=>r.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(r=>r.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((a=t.find(r=>r.tooltipSpace))===null||a===void 0?void 0:a.tooltipSpace)||Vot}}}),Dse=new WeakMap,uL=vr.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(lL);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Ise(t,dL,(n,a)=>this.createTooltip(n,a),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,a=t.state.facet(lL);if(a.position!=this.position&&!this.madeAbsolute){this.position=a.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;n=!0}if(a.parent!=this.parent){this.parent&&this.container.remove(),this.parent=a.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),a=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",n.dom.appendChild(r)}return n.dom.style.position=this.position,n.dom.style.top=w1,n.dom.style.left="0px",this.container.insertBefore(n.dom,a),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let a of this.manager.tooltipViews)a.dom.remove(),(t=a.destroy)===null||t===void 0||t.call(a);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if($t.gecko)n=i.offsetParent!=this.container.ownerDocument.body;else if(i.style.top==w1&&i.style.left=="0px"){let o=i.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(t=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let a=this.view.scrollDOM.getBoundingClientRect(),r=HF(this.view);return{visible:{left:a.left+r.left,top:a.top+r.top,right:a.right-r.right,bottom:a.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,o)=>{let s=this.manager.tooltipViews[o];return s.getCoords?s.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(lL).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let s of this.manager.tooltipViews)s.dom.style.position="absolute"}let{visible:n,space:a,scaleX:r,scaleY:i}=t,o=[];for(let s=0;s<this.manager.tooltips.length;s++){let l=this.manager.tooltips[s],u=this.manager.tooltipViews[s],{dom:d}=u,p=t.pos[s],m=t.size[s];if(!p||l.clip!==!1&&(p.bottom<=Math.max(n.top,a.top)||p.top>=Math.min(n.bottom,a.bottom)||p.right<Math.max(n.left,a.left)-.1||p.left>Math.min(n.right,a.right)+.1)){d.style.top=w1;continue}let A=l.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,g=A?7:0,h=m.right-m.left,f=(e=Dse.get(u))!==null&&e!==void 0?e:m.bottom-m.top,b=u.offset||Xot,y=this.view.textDirection==Ra.LTR,w=m.width>a.right-a.left?y?a.left:a.right-m.width:y?Math.max(a.left,Math.min(p.left-(A?14:0)+b.x,a.right-h)):Math.min(Math.max(a.left,p.left-h+(A?14:0)-b.x),a.right-h),k=this.above[s];!l.strictSide&&(k?p.top-f-g-b.y<a.top:p.bottom+f+g+b.y>a.bottom)&&k==a.bottom-p.bottom>p.top-a.top&&(k=this.above[s]=!k);let C=(k?p.top-a.top:a.bottom-p.bottom)-g;if(C<f&&u.resize!==!1){if(C<this.view.defaultLineHeight){d.style.top=w1;continue}Dse.set(u,f),d.style.height=(f=C)/i+"px"}else d.style.height&&(d.style.height="");let x=k?p.top-f-g-b.y:p.bottom+g+b.y,_=w+h;if(u.overlap!==!0)for(let E of o)E.left<_&&E.right>w&&E.top<x+f&&E.bottom>x&&(x=k?E.top-f-2-g:E.bottom+g+2);if(this.position=="absolute"?(d.style.top=(x-t.parent.top)/i+"px",Qse(d,(w-t.parent.left)/r)):(d.style.top=x/i+"px",Qse(d,w/r)),A){let E=p.left+(y?b.x:-b.x)-(w+14-7);A.style.left=E/r+"px"}u.overlap!==!0&&o.push({left:w,top:x,right:_,bottom:x+f}),d.classList.toggle("cm-tooltip-above",k),d.classList.toggle("cm-tooltip-below",!k),u.positioned&&u.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=w1}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Qse(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const Jot=Ot.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Xot={x:0,y:0},dL=zt.define({enables:[uL,Jot]}),F2=zt.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class L2{static create(e){return new L2(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Ise(e,F2,(n,a)=>this.createHostedView(n,a),n=>n.dom.remove())}createHostedView(e,n){let a=e.create(this.view);return a.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(a.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&a.mount&&a.mount(this.view),a}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let a of this.manager.tooltipViews){let r=a[e];if(r!==void 0){if(n===void 0)n=r;else if(n!==r)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const est=dL.compute([F2],t=>{let e=t.facet(F2);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var a;return(a=n.end)!==null&&a!==void 0?a:n.pos})),create:L2.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class tst{constructor(e,n,a,r,i){this.view=e,this.source=n,this.field=a,this.setHover=r,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:n}=this,a=e.docView.nearest(n.target);if(!a)return;let r,i=1;if(a instanceof Vp)r=a.posAtStart;else{if(r=e.posAtCoords(n),r==null)return;let s=e.coordsAtPos(r);if(!s||n.y<s.top||n.y>s.bottom||n.x<s.left-e.defaultCharacterWidth||n.x>s.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(r)).find(d=>d.from<=r&&d.to>=r),u=l&&l.dir==Ra.RTL?-1:1;i=n.x<s.left?-u:u}let o=this.source(e,r,i);if(o!=null&&o.then){let s=this.pending={pos:r};o.then(l=>{this.pending==s&&(this.pending=null,l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])}))},l=>us(e.state,l,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(uL),n=e?e.manager.tooltips.findIndex(a=>a.create==L2.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,a;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:r,tooltip:i}=this;if(r.length&&i&&!nst(i.dom,e)||this.pending){let{pos:o}=r[0]||this.pending,s=(a=(n=r[0])===null||n===void 0?void 0:n.end)!==null&&a!==void 0?a:o;(o==s?this.view.posAtCoords(this.lastMove)!=o:!ast(this.view,o,s,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:a}=this;a&&a.dom.contains(e.relatedTarget)?this.watchTooltipLeave(a.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=a=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(a.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const N2=4;function nst(t,e){let{left:n,right:a,top:r,bottom:i}=t.getBoundingClientRect(),o;if(o=t.querySelector(".cm-tooltip-arrow")){let s=o.getBoundingClientRect();r=Math.min(s.top,r),i=Math.max(s.bottom,i)}return e.clientX>=n-N2&&e.clientX<=a+N2&&e.clientY>=r-N2&&e.clientY<=i+N2}function ast(t,e,n,a,r,i){let o=t.scrollDOM.getBoundingClientRect(),s=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>a||o.right<a||o.top>r||Math.min(o.bottom,s)<r)return!1;let l=t.posAtCoords({x:a,y:r},!1);return l>=e&&l<=n}function rst(t,e={}){let n=Bn.define(),a=Li.define({create(){return[]},update(r,i){if(r.length&&(e.hideOnChange&&(i.docChanged||i.selection)?r=[]:e.hideOn&&(r=r.filter(o=>!e.hideOn(i,o))),i.docChanged)){let o=[];for(let s of r){let l=i.changes.mapPos(s.pos,-1,Lo.TrackDel);if(l!=null){let u=Object.assign(Object.create(null),s);u.pos=l,u.end!=null&&(u.end=i.changes.mapPos(u.end)),o.push(u)}}r=o}for(let o of i.effects)o.is(n)&&(r=o.value),o.is(ist)&&(r=[]);return r},provide:r=>F2.from(r)});return{active:a,extension:[a,vr.define(r=>new tst(r,t,a,n,e.hoverTime||300)),est]}}function Sse(t,e){let n=t.plugin(uL);if(!n)return null;let a=n.manager.tooltips.indexOf(e);return a<0?null:n.manager.tooltipViews[a]}const ist=Bn.define(),Tse=zt.define({combine(t){let e,n;for(let a of t)e=e||a.topContainer,n=n||a.bottomContainer;return{topContainer:e,bottomContainer:n}}});function k1(t,e){let n=t.plugin(Fse),a=n?n.specs.indexOf(e):-1;return a>-1?n.panels[a]:null}const Fse=vr.fromClass(class{constructor(t){this.input=t.state.facet(v1),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(Tse);this.top=new M2(t,!0,e.topContainer),this.bottom=new M2(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(Tse);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new M2(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new M2(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(v1);if(n!=this.input){let a=n.filter(l=>l),r=[],i=[],o=[],s=[];for(let l of a){let u=this.specs.indexOf(l),d;u<0?(d=l(t.view),s.push(d)):(d=this.panels[u],d.update&&d.update(t)),r.push(d),(d.top?i:o).push(d)}this.specs=a,this.panels=r,this.top.sync(i),this.bottom.sync(o);for(let l of s)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let a of this.panels)a.update&&a.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>Ot.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class M2{constructor(e,n,a){this.view=e,this.top=n,this.container=a,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=Lse(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=Lse(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Lse(t){let e=t.nextSibling;return t.remove(),e}const v1=zt.define({enables:Fse});class Ed extends rg{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Ed.prototype.elementClass="",Ed.prototype.toDOM=void 0,Ed.prototype.mapMode=Lo.TrackBefore,Ed.prototype.startSide=Ed.prototype.endSide=-1,Ed.prototype.point=!0;const R2=zt.define(),ost=zt.define(),sst={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>ta.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},C1=zt.define();function cst(t){return[Mse(),C1.of({...sst,...t})]}const Nse=zt.define({combine:t=>t.some(e=>e)});function Mse(t){return[lst]}const lst=vr.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(C1).map(e=>new Pse(t,e)),this.fixed=!t.state.facet(Nse);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,a=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(a<(n.to-n.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Nse)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=ta.iter(this.view.state.facet(R2),this.view.viewport.from),a=[],r=this.gutters.map(i=>new ust(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(a.length&&(a=[]),Array.isArray(i.type)){let o=!0;for(let s of i.type)if(s.type==Mo.Text&&o){pL(n,a,s.from);for(let l of r)l.line(this.view,s,a);o=!1}else if(s.widget)for(let l of r)l.widget(this.view,s)}else if(i.type==Mo.Text){pL(n,a,i.from);for(let o of r)o.line(this.view,i,a)}else if(i.widget)for(let o of r)o.widget(this.view,i);for(let i of r)i.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(C1),n=t.state.facet(C1),a=t.docChanged||t.heightChanged||t.viewportChanged||!ta.eq(t.startState.facet(R2),t.state.facet(R2),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let r of this.gutters)r.update(t)&&(a=!0);else{a=!0;let r=[];for(let i of n){let o=e.indexOf(i);o<0?r.push(new Pse(this.view,i)):(this.gutters[o].update(t),r.push(this.gutters[o]))}for(let i of this.gutters)i.dom.remove(),r.indexOf(i)<0&&i.destroy();for(let i of r)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=r}return a}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>Ot.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let a=n.dom.offsetWidth*e.scaleX,r=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Ra.LTR?{left:a,right:r}:{right:a,left:r}})});function Rse(t){return Array.isArray(t)?t:[t]}function pL(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class ust{constructor(e,n,a){this.gutter=e,this.height=a,this.i=0,this.cursor=ta.iter(e.markers,n.from)}addElement(e,n,a){let{gutter:r}=this,i=(n.top-this.height)/e.scaleY,o=n.height/e.scaleY;if(this.i==r.elements.length){let s=new $se(e,o,i,a);r.elements.push(s),r.dom.appendChild(s.dom)}else r.elements[this.i].update(e,o,i,a);this.height=n.bottom,this.i++}line(e,n,a){let r=[];pL(this.cursor,r,n.from),a.length&&(r=r.concat(a));let i=this.gutter.config.lineMarker(e,n,r);i&&r.unshift(i);let o=this.gutter;r.length==0&&!o.config.renderEmptyElements||this.addElement(e,n,r)}widget(e,n){let a=this.gutter.config.widgetMarker(e,n.widget,n),r=a?[a]:null;for(let i of e.state.facet(ost)){let o=i(e,n.widget,n);o&&(r||(r=[])).push(o)}r&&this.addElement(e,n,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class Pse{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let a in n.domEventHandlers)this.dom.addEventListener(a,r=>{let i=r.target,o;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let l=i.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=r.clientY;let s=e.lineBlockAtHeight(o-e.documentTop);n.domEventHandlers[a](e,s,r)&&r.preventDefault()});this.markers=Rse(n.markers(e)),n.initialSpacer&&(this.spacer=new $se(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=Rse(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],e);r!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[r])}let a=e.view.viewport;return!ta.eq(this.markers,n,a.from,a.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class $se{constructor(e,n,a,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,a,r)}update(e,n,a,r){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=a&&(this.dom.style.marginTop=(this.above=a)?a+"px":""),dst(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,n){let a="cm-gutterElement",r=this.dom.firstChild;for(let i=0,o=0;;){let s=o,l=i<n.length?n[i++]:null,u=!1;if(l){let d=l.elementClass;d&&(a+=" "+d);for(let p=o;p<this.markers.length;p++)if(this.markers[p].compare(l)){s=p,u=!0;break}}else s=this.markers.length;for(;o<s;){let d=this.markers[o++];if(d.toDOM){d.destroy(r);let p=r.nextSibling;r.remove(),r=p}}if(!l)break;l.toDOM&&(u?r=r.nextSibling:this.dom.insertBefore(l.toDOM(e),r)),u&&o++}this.dom.className=a,this.markers=n}destroy(){this.setMarkers(null,[])}}function dst(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].compare(e[n]))return!1;return!0}const pst=zt.define(),mst=zt.define(),ub=zt.define({combine(t){return iu(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,n){let a=Object.assign({},e);for(let r in n){let i=a[r],o=n[r];a[r]=i?(s,l,u)=>i(s,l,u)||o(s,l,u):o}return a}})}});class mL extends Ed{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function AL(t,e){return t.state.facet(ub).formatNumber(e,t.state)}const Ast=C1.compute([ub],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(pst)},lineMarker(e,n,a){return a.some(r=>r.toDOM)?null:new mL(AL(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,a)=>{for(let r of e.state.facet(mst)){let i=r(e,n,a);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(ub)!=e.state.facet(ub),initialSpacer(e){return new mL(AL(e,Ose(e.state.doc.lines)))},updateSpacer(e,n){let a=AL(n.view,Ose(n.view.state.doc.lines));return a==e.number?e:new mL(a)},domEventHandlers:t.facet(ub).domEventHandlers,side:"before"}));function gst(t={}){return[ub.of(t),Mse(),Ast]}function Ose(t){let e=9;for(;e<t;)e=e*10+9;return e}const hst=new class extends Ed{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},fst=R2.compute(["selection"],t=>{let e=[],n=-1;for(let a of t.selection.ranges){let r=t.doc.lineAt(a.head).from;r>n&&(n=r,e.push(hst.range(r)))}return ta.of(e)});function bst(){return fst}const jse=1024;let yst=0,gL=class{constructor(e,n){this.from=e,this.to=n}};class Rn{constructor(e={}){this.id=yst++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=ds.match(e)),n=>{let a=e(n);return a===void 0?null:[this,a]}}}Rn.closedBy=new Rn({deserialize:t=>t.split(" ")}),Rn.openedBy=new Rn({deserialize:t=>t.split(" ")}),Rn.group=new Rn({deserialize:t=>t.split(" ")}),Rn.isolate=new Rn({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),Rn.contextHash=new Rn({perNode:!0}),Rn.lookAhead=new Rn({perNode:!0}),Rn.mounted=new Rn({perNode:!0});class P2{constructor(e,n,a){this.tree=e,this.overlay=n,this.parser=a}static get(e){return e&&e.props&&e.props[Rn.mounted.id]}}const wst=Object.create(null);class ds{constructor(e,n,a,r=0){this.name=e,this.props=n,this.id=a,this.flags=r}static define(e){let n=e.props&&e.props.length?Object.create(null):wst,a=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new ds(e.name||"",n,e.id,a);if(e.props){for(let i of e.props)if(Array.isArray(i)||(i=i(r)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(Rn.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let a in e)for(let r of a.split(" "))n[r]=e[a];return a=>{for(let r=a.prop(Rn.group),i=-1;i<(r?r.length:0);i++){let o=n[i<0?a.name:r[i]];if(o)return o}}}}ds.none=new ds("",Object.create(null),0,8);class hL{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let a of this.types){let r=null;for(let i of e){let o=i(a);if(o){r||(r=Object.assign({},a.props));let s=o[1],l=o[0];l.combine&&l.id in r&&(s=l.combine(r[l.id],s)),r[l.id]=s}}n.push(r?new ds(a.name,r,a.id,a.flags):a)}return new hL(n)}}const $2=new WeakMap,Gse=new WeakMap;var bi;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(bi||(bi={}));class Lr{constructor(e,n,a,r,i){if(this.type=e,this.children=n,this.positions=a,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[o,s]of i)this.props[typeof o=="number"?o:o.id]=s}}toString(){let e=P2.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let a of this.children){let r=a.toString();r&&(n&&(n+=","),n+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new yL(this.topNode,e)}cursorAt(e,n=0,a=0){let r=$2.get(this)||this.topNode,i=new yL(r);return i.moveTo(e,n),$2.set(this,i._tree),i}get topNode(){return new yc(this,0,0,null)}resolve(e,n=0){let a=_1($2.get(this)||this.topNode,e,n,!1);return $2.set(this,a),a}resolveInner(e,n=0){let a=_1(Gse.get(this)||this.topNode,e,n,!0);return Gse.set(this,a),a}resolveStack(e,n=0){return Cst(this,e,n)}iterate(e){let{enter:n,leave:a,from:r=0,to:i=this.length}=e,o=e.mode||0,s=(o&bi.IncludeAnonymous)>0;for(let l=this.cursor(o|bi.IncludeAnonymous);;){let u=!1;if(l.from<=i&&l.to>=r&&(!s&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;u=!0}for(;u&&a&&(s||!l.type.isAnonymous)&&a(l),!l.nextSibling();){if(!l.parent())return;u=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:kL(ds.none,this.children,this.positions,0,this.children.length,0,this.length,(n,a,r)=>new Lr(this.type,n,a,r,this.propValues),e.makeTree||((n,a,r)=>new Lr(ds.none,n,a,r)))}static build(e){return _st(e)}}Lr.empty=new Lr(ds.none,[],[],0);class fL{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new fL(this.buffer,this.index)}}class tm{constructor(e,n,a){this.buffer=e,this.length=n,this.set=a}get type(){return ds.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],a=this.buffer[e+3],r=this.set.types[n],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),e+=4,a==e)return i;let o=[];for(;e<a;)o.push(this.childString(e)),e=this.buffer[e+3];return i+"("+o.join(",")+")"}findChild(e,n,a,r,i){let{buffer:o}=this,s=-1;for(let l=e;l!=n&&!(qse(i,r,o[l+1],o[l+2])&&(s=l,a>0));l=o[l+3]);return s}slice(e,n,a){let r=this.buffer,i=new Uint16Array(n-e),o=0;for(let s=e,l=0;s<n;){i[l++]=r[s++],i[l++]=r[s++]-a;let u=i[l++]=r[s++]-a;i[l++]=r[s++]-e,o=Math.max(o,u)}return new tm(i,o,this.set)}}function qse(t,e,n,a){switch(t){case-2:return n<e;case-1:return a>=e&&n<e;case 0:return n<e&&a>e;case 1:return n<=e&&a>e;case 2:return a>e;case 4:return!0}}function _1(t,e,n,a){for(var r;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let o=!a&&t instanceof yc&&t.index<0?null:t.parent;if(!o)return t;t=o}let i=a?0:bi.IgnoreOverlays;if(a)for(let o=t,s=o.parent;s;o=s,s=o.parent)o instanceof yc&&o.index<0&&((r=s.enter(e,n,i))===null||r===void 0?void 0:r.from)!=o.from&&(t=s);for(;;){let o=t.enter(e,n,i);if(!o)return t;t=o}}class zse{cursor(e=0){return new yL(this,e)}getChild(e,n=null,a=null){let r=Hse(this,e,n,a);return r.length?r[0]:null}getChildren(e,n=null,a=null){return Hse(this,e,n,a)}resolve(e,n=0){return _1(this,e,n,!1)}resolveInner(e,n=0){return _1(this,e,n,!0)}matchContext(e){return bL(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),a=this;for(;n;){let r=n.lastChild;if(!r||r.to!=n.to)break;r.type.isError&&r.from==r.to?(a=n,n=r.prevSibling):n=r}return a}get node(){return this}get next(){return this.parent}}class yc extends zse{constructor(e,n,a,r){super(),this._tree=e,this.from=n,this.index=a,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,a,r,i=0){for(let o=this;;){for(let{children:s,positions:l}=o._tree,u=n>0?s.length:-1;e!=u;e+=n){let d=s[e],p=l[e]+o.from;if(qse(r,a,p,p+d.length)){if(d instanceof tm){if(i&bi.ExcludeBuffers)continue;let m=d.findChild(0,d.buffer.length,n,a-p,r);if(m>-1)return new nm(new kst(o,d,e,p),null,m)}else if(i&bi.IncludeAnonymous||!d.type.isAnonymous||wL(d)){let m;if(!(i&bi.IgnoreMounts)&&(m=P2.get(d))&&!m.overlay)return new yc(m.tree,p,e,o);let A=new yc(d,p,e,o);return i&bi.IncludeAnonymous||!A.type.isAnonymous?A:A.nextChild(n<0?d.children.length-1:0,n,a,r)}}}if(i&bi.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+n:e=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,a=0){let r;if(!(a&bi.IgnoreOverlays)&&(r=P2.get(this._tree))&&r.overlay){let i=e-this.from;for(let{from:o,to:s}of r.overlay)if((n>0?o<=i:o<i)&&(n<0?s>=i:s>i))return new yc(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,a)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Hse(t,e,n,a){let r=t.cursor(),i=[];if(!r.firstChild())return i;if(n!=null){for(let o=!1;!o;)if(o=r.type.is(n),!r.nextSibling())return i}for(;;){if(a!=null&&r.type.is(a))return i;if(r.type.is(e)&&i.push(r.node),!r.nextSibling())return a==null?i:[]}}function bL(t,e,n=e.length-1){for(let a=t;n>=0;a=a.parent){if(!a)return!1;if(!a.type.isAnonymous){if(e[n]&&e[n]!=a.name)return!1;n--}}return!0}class kst{constructor(e,n,a,r){this.parent=e,this.buffer=n,this.index=a,this.start=r}}class nm extends zse{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,a){super(),this.context=e,this._parent=n,this.index=a,this.type=e.buffer.set.types[e.buffer.buffer[a]]}child(e,n,a){let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],e,n-this.context.start,a);return i<0?null:new nm(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,a=0){if(a&bi.ExcludeBuffers)return null;let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return i<0?null:new nm(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new nm(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new nm(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:a}=this.context,r=this.index+4,i=a.buffer[this.index+3];if(i>r){let o=a.buffer[this.index+1];e.push(a.slice(r,i,o)),n.push(0)}return new Lr(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Use(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;i<t.length;i++){let o=t[i];(o.from>n.from||o.to<n.to)&&(n=o,e=i)}let a=n instanceof yc&&n.index<0?null:n.parent,r=t.slice();return a?r[e]=a:r.splice(e,1),new vst(r,n)}class vst{constructor(e,n){this.heads=e,this.node=n}get next(){return Use(this.heads)}}function Cst(t,e,n){let a=t.resolveInner(e,n),r=null;for(let i=a instanceof yc?a:a.context.parent;i;i=i.parent)if(i.index<0){let o=i.parent;(r||(r=[a])).push(o.resolve(e,n)),i=o}else{let o=P2.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let s=new yc(o.tree,o.overlay[0].from+i.from,-1,i);(r||(r=[a])).push(_1(s,e,n,!1))}}return r?Use(r):a}class yL{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof yc)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let a=e._parent;a;a=a._parent)this.stack.unshift(a.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:a,buffer:r}=this.buffer;return this.type=n||r.set.types[r.buffer[e]],this.from=a+r.buffer[e+1],this.to=a+r.buffer[e+2],!0}yield(e){return e?e instanceof yc?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,a){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,a,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,n-this.buffer.start,a);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,a=this.mode){return this.buffer?a&bi.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,a))}parent(){if(!this.buffer)return this.yieldNode(this.mode&bi.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&bi.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,a=this.stack.length-1;if(e<0){let r=a<0?0:this.stack[a]+4;if(this.index!=r)return this.yieldBuf(n.findChild(r,this.index,-1,0,4))}else{let r=n.buffer[this.index+3];if(r<(a<0?n.buffer.length:n.buffer[this.stack[a]+3]))return this.yieldBuf(r)}return a<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,a,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let i=0;i<this.index;i++)if(r.buffer.buffer[i+3]<this.index)return!1;({index:n,parent:a}=r)}else({index:n,_parent:a}=this._tree);for(;a;{index:n,_parent:a}=a)if(n>-1)for(let i=n+e,o=e<0?-1:a._tree.children.length;i!=o;i+=e){let s=a._tree.children[i];if(this.mode&bi.IncludeAnonymous||s instanceof tm||!s.type.isAnonymous||wL(s))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,a=0;if(e&&e.context==this.buffer)e:for(let r=this.index,i=this.stack.length;i>=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;n=o,a=i+1;break e}r=this.stack[--i]}for(let r=a;r<this.stack.length;r++)n=new nm(this.buffer,n,this.stack[r]);return this.bufferNode=new nm(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let a=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){a++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&n&&n(this),r=this.type.isAnonymous,!a)return;if(this.nextSibling())break;this.parent(),a--,r=!0}}}matchContext(e){if(!this.buffer)return bL(this.node.parent,e);let{buffer:n}=this.buffer,{types:a}=n.set;for(let r=e.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return bL(this._tree,e,r);let o=a[n.buffer[this.stack[i]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function wL(t){return t.children.some(e=>e instanceof tm||!e.type.isAnonymous||wL(e))}function _st(t){var e;let{buffer:n,nodeSet:a,maxBufferLength:r=jse,reused:i=[],minRepeatType:o=a.types.length}=t,s=Array.isArray(n)?new fL(n,n.length):n,l=a.types,u=0,d=0;function p(C,x,_,E,I,Q){let{id:D,start:T,end:N,size:B}=s,S=d,M=u;if(B<0)if(s.next(),B==-1){let $=i[D];_.push($),E.push(T-C);return}else if(B==-3){u=D;return}else if(B==-4){d=D;return}else throw new RangeError(`Unrecognized record size: ${B}`);let L=l[D],F,R,P=T-C;if(N-T<=r&&(R=f(s.pos-x,I))){let $=new Uint16Array(R.size-R.skip),q=s.pos-R.size,j=$.length;for(;s.pos>q;)j=b(R.start,$,j);F=new tm($,N-R.start,a),P=R.start-C}else{let $=s.pos-B;s.next();let q=[],j=[],J=D>=o?D:-1,Y=0,ne=N;for(;s.pos>$;)J>=0&&s.id==J&&s.size>=0?(s.end<=ne-r&&(g(q,j,T,Y,s.end,ne,J,S,M),Y=q.length,ne=s.end),s.next()):Q>2500?m(T,$,q,j):p(T,$,q,j,J,Q+1);if(J>=0&&Y>0&&Y<q.length&&g(q,j,T,Y,T,ne,J,S,M),q.reverse(),j.reverse(),J>-1&&Y>0){let ee=A(L,M);F=kL(L,q,j,0,q.length,0,N-T,ee,ee)}else F=h(L,q,j,N-T,S-N,M)}_.push(F),E.push(P)}function m(C,x,_,E){let I=[],Q=0,D=-1;for(;s.pos>x;){let{id:T,start:N,end:B,size:S}=s;if(S>4)s.next();else{if(D>-1&&N<D)break;D<0&&(D=B-r),I.push(T,N,B),Q++,s.next()}}if(Q){let T=new Uint16Array(Q*4),N=I[I.length-2];for(let B=I.length-3,S=0;B>=0;B-=3)T[S++]=I[B],T[S++]=I[B+1]-N,T[S++]=I[B+2]-N,T[S++]=S;_.push(new tm(T,I[2]-N,a)),E.push(N-C)}}function A(C,x){return(_,E,I)=>{let Q=0,D=_.length-1,T,N;if(D>=0&&(T=_[D])instanceof Lr){if(!D&&T.type==C&&T.length==I)return T;(N=T.prop(Rn.lookAhead))&&(Q=E[D]+T.length+N)}return h(C,_,E,I,Q,x)}}function g(C,x,_,E,I,Q,D,T,N){let B=[],S=[];for(;C.length>E;)B.push(C.pop()),S.push(x.pop()+_-I);C.push(h(a.types[D],B,S,Q-I,T-Q,N)),x.push(I-_)}function h(C,x,_,E,I,Q,D){if(Q){let T=[Rn.contextHash,Q];D=D?[T].concat(D):[T]}if(I>25){let T=[Rn.lookAhead,I];D=D?[T].concat(D):[T]}return new Lr(C,x,_,E,D)}function f(C,x){let _=s.fork(),E=0,I=0,Q=0,D=_.end-r,T={size:0,start:0,skip:0};e:for(let N=_.pos-C;_.pos>N;){let B=_.size;if(_.id==x&&B>=0){T.size=E,T.start=I,T.skip=Q,Q+=4,E+=4,_.next();continue}let S=_.pos-B;if(B<0||S<N||_.start<D)break;let M=_.id>=o?4:0,L=_.start;for(_.next();_.pos>S;){if(_.size<0)if(_.size==-3)M+=4;else break e;else _.id>=o&&(M+=4);_.next()}I=L,E+=B,Q+=M}return(x<0||E==C)&&(T.size=E,T.start=I,T.skip=Q),T.size>4?T:void 0}function b(C,x,_){let{id:E,start:I,end:Q,size:D}=s;if(s.next(),D>=0&&E<o){let T=_;if(D>4){let N=s.pos-(D-4);for(;s.pos>N;)_=b(C,x,_)}x[--_]=T,x[--_]=Q-C,x[--_]=I-C,x[--_]=E}else D==-3?u=E:D==-4&&(d=E);return _}let y=[],w=[];for(;s.pos>0;)p(t.start||0,t.bufferStart||0,y,w,-1,0);let k=(e=t.length)!==null&&e!==void 0?e:y.length?w[0]+y[0].length:0;return new Lr(l[t.topID],y.reverse(),w.reverse(),k)}const Yse=new WeakMap;function O2(t,e){if(!t.isAnonymous||e instanceof tm||e.type!=t)return 1;let n=Yse.get(e);if(n==null){n=1;for(let a of e.children){if(a.type!=t||!(a instanceof Lr)){n=1;break}n+=O2(t,a)}Yse.set(e,n)}return n}function kL(t,e,n,a,r,i,o,s,l){let u=0;for(let g=a;g<r;g++)u+=O2(t,e[g]);let d=Math.ceil(u*1.5/8),p=[],m=[];function A(g,h,f,b,y){for(let w=f;w<b;){let k=w,C=h[w],x=O2(t,g[w]);for(w++;w<b;w++){let _=O2(t,g[w]);if(x+_>=d)break;x+=_}if(w==k+1){if(x>d){let _=g[k];A(_.children,_.positions,0,_.children.length,h[k]+y);continue}p.push(g[k])}else{let _=h[w-1]+g[w-1].length-C;p.push(kL(t,g,h,k,w,C,_,null,l))}m.push(C+y-i)}}return A(e,n,a,r,0),(s||l)(p,m,o)}class lg{constructor(e,n,a,r,i=!1,o=!1){this.from=e,this.to=n,this.tree=a,this.offset=r,this.open=(i?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],a=!1){let r=[new lg(0,e.length,e,0,!1,a)];for(let i of n)i.to>e.length&&r.push(i);return r}static applyChanges(e,n,a=128){if(!n.length)return e;let r=[],i=1,o=e.length?e[0]:null;for(let s=0,l=0,u=0;;s++){let d=s<n.length?n[s]:null,p=d?d.fromA:1e9;if(p-l>=a)for(;o&&o.from<p;){let m=o;if(l>=m.from||p<=m.to||u){let A=Math.max(m.from,l)-u,g=Math.min(m.to,p)-u;m=A>=g?null:new lg(A,g,m.tree,m.offset+u,s>0,!!d)}if(m&&r.push(m),o.to>p)break;o=i<e.length?e[i++]:null}if(!d)break;l=d.toA,u=d.toA-d.toB}return r}}let Wse=class{startParse(e,n,a){return typeof e=="string"&&(e=new xst(e)),a=a?a.length?a.map(r=>new gL(r.from,r.to)):[new gL(0,0)]:[new gL(0,e.length)],this.createParse(e,n||[],a)}parse(e,n,a){let r=this.startParse(e,n,a);for(;;){let i=r.advance();if(i)return i}}};class xst{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new Rn({perNode:!0});let Est=0;class wc{constructor(e,n,a,r){this.name=e,this.set=n,this.base=a,this.modified=r,this.id=Est++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let a=typeof e=="string"?e:"?";if(e instanceof wc&&(n=e),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let r=new wc(a,[],null,[]);if(r.set.push(r),n)for(let i of n.set)r.set.push(i);return r}static defineModifier(e){let n=new j2(e);return a=>a.modified.indexOf(n)>-1?a:j2.get(a.base||a,a.modified.concat(n).sort((r,i)=>r.id-i.id))}}let Bst=0;class j2{constructor(e){this.name=e,this.instances=[],this.id=Bst++}static get(e,n){if(!n.length)return e;let a=n[0].instances.find(s=>s.base==e&&Ist(n,s.modified));if(a)return a;let r=[],i=new wc(e.name,r,e,n);for(let s of n)s.instances.push(i);let o=Dst(n);for(let s of e.set)if(!s.modified.length)for(let l of o)r.push(j2.get(s,l));return i}}function Ist(t,e){return t.length==e.length&&t.every((n,a)=>n==e[a])}function Dst(t){let e=[[]];for(let n=0;n<t.length;n++)for(let a=0,r=e.length;a<r;a++)e.push(e[a].concat(t[n]));return e.sort((n,a)=>a.length-n.length)}function Kse(t){let e=Object.create(null);for(let n in t){let a=t[n];Array.isArray(a)||(a=[a]);for(let r of n.split(" "))if(r){let i=[],o=2,s=r;for(let p=0;;){if(s=="..."&&p>0&&p+3==r.length){o=1;break}let m=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!m)throw new RangeError("Invalid path: "+r);if(i.push(m[0]=="*"?"":m[0][0]=='"'?JSON.parse(m[0]):m[0]),p+=m[0].length,p==r.length)break;let A=r[p++];if(p==r.length&&A=="!"){o=0;break}if(A!="/")throw new RangeError("Invalid path: "+r);s=r.slice(p)}let l=i.length-1,u=i[l];if(!u)throw new RangeError("Invalid path: "+r);let d=new x1(a,o,l>0?i.slice(0,l):null);e[u]=d.sort(e[u])}}return Zse.add(e)}const Zse=new Rn({combine(t,e){let n,a,r;for(;t||e;){if(!t||e&&t.depth>=e.depth?(r=e,e=e.next):(r=t,t=t.next),n&&n.mode==r.mode&&!r.context&&!n.context)continue;let i=new x1(r.tags,r.mode,r.context);n?n.next=i:a=i,n=i}return a}});let x1=class{constructor(e,n,a,r){this.tags=e,this.mode=n,this.context=a,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}};x1.empty=new x1([],2,null);function Vse(t,e){let n=Object.create(null);for(let i of t)if(!Array.isArray(i.tag))n[i.tag.id]=i.class;else for(let o of i.tag)n[o.id]=i.class;let{scope:a,all:r=null}=e||{};return{style:i=>{let o=r;for(let s of i)for(let l of s.set){let u=n[l.id];if(u){o=o?o+" "+u:u;break}}return o},scope:a}}function Qst(t,e){let n=null;for(let a of t){let r=a.style(e);r&&(n=n?n+" "+r:r)}return n}function Sst(t,e,n,a=0,r=t.length){let i=new Tst(a,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),a,r,"",i.highlighters),i.flush(r)}class Tst{constructor(e,n,a){this.at=e,this.highlighters=n,this.span=a,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,a,r,i){let{type:o,from:s,to:l}=e;if(s>=a||l<=n)return;o.isTop&&(i=this.highlighters.filter(A=>!A.scope||A.scope(o)));let u=r,d=Fst(e)||x1.empty,p=Qst(i,d.tags);if(p&&(u&&(u+=" "),u+=p,d.mode==1&&(r+=(r?" ":"")+p)),this.startSpan(Math.max(n,s),u),d.opaque)return;let m=e.tree&&e.tree.prop(Rn.mounted);if(m&&m.overlay){let A=e.node.enter(m.overlay[0].from+s,1),g=this.highlighters.filter(f=>!f.scope||f.scope(m.tree.type)),h=e.firstChild();for(let f=0,b=s;;f++){let y=f<m.overlay.length?m.overlay[f]:null,w=y?y.from+s:l,k=Math.max(n,b),C=Math.min(a,w);if(k<C&&h)for(;e.from<C&&(this.highlightRange(e,k,C,r,i),this.startSpan(Math.min(C,e.to),u),!(e.to>=w||!e.nextSibling())););if(!y||w>a)break;b=y.to+s,b>n&&(this.highlightRange(A.cursor(),Math.max(n,y.from+s),Math.min(a,b),"",g),this.startSpan(Math.min(a,b),u))}h&&e.parent()}else if(e.firstChild()){m&&(r="");do if(!(e.to<=n)){if(e.from>=a)break;this.highlightRange(e,n,a,r,i),this.startSpan(Math.min(a,e.to),u)}while(e.nextSibling());e.parent()}}}function Fst(t){let e=t.type.prop(Zse);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ft=wc.define,G2=Ft(),am=Ft(),Jse=Ft(am),Xse=Ft(am),rm=Ft(),q2=Ft(rm),vL=Ft(rm),lu=Ft(),ug=Ft(lu),uu=Ft(),du=Ft(),CL=Ft(),E1=Ft(CL),z2=Ft(),Xe={comment:G2,lineComment:Ft(G2),blockComment:Ft(G2),docComment:Ft(G2),name:am,variableName:Ft(am),typeName:Jse,tagName:Ft(Jse),propertyName:Xse,attributeName:Ft(Xse),className:Ft(am),labelName:Ft(am),namespace:Ft(am),macroName:Ft(am),literal:rm,string:q2,docString:Ft(q2),character:Ft(q2),attributeValue:Ft(q2),number:vL,integer:Ft(vL),float:Ft(vL),bool:Ft(rm),regexp:Ft(rm),escape:Ft(rm),color:Ft(rm),url:Ft(rm),keyword:uu,self:Ft(uu),null:Ft(uu),atom:Ft(uu),unit:Ft(uu),modifier:Ft(uu),operatorKeyword:Ft(uu),controlKeyword:Ft(uu),definitionKeyword:Ft(uu),moduleKeyword:Ft(uu),operator:du,derefOperator:Ft(du),arithmeticOperator:Ft(du),logicOperator:Ft(du),bitwiseOperator:Ft(du),compareOperator:Ft(du),updateOperator:Ft(du),definitionOperator:Ft(du),typeOperator:Ft(du),controlOperator:Ft(du),punctuation:CL,separator:Ft(CL),bracket:E1,angleBracket:Ft(E1),squareBracket:Ft(E1),paren:Ft(E1),brace:Ft(E1),content:lu,heading:ug,heading1:Ft(ug),heading2:Ft(ug),heading3:Ft(ug),heading4:Ft(ug),heading5:Ft(ug),heading6:Ft(ug),contentSeparator:Ft(lu),list:Ft(lu),quote:Ft(lu),emphasis:Ft(lu),strong:Ft(lu),link:Ft(lu),monospace:Ft(lu),strikethrough:Ft(lu),inserted:Ft(),deleted:Ft(),changed:Ft(),invalid:Ft(),meta:z2,documentMeta:Ft(z2),annotation:Ft(z2),processingInstruction:Ft(z2),definition:wc.defineModifier("definition"),constant:wc.defineModifier("constant"),function:wc.defineModifier("function"),standard:wc.defineModifier("standard"),local:wc.defineModifier("local"),special:wc.defineModifier("special")};for(let t in Xe){let e=Xe[t];e instanceof wc&&(e.name=t)}Vse([{tag:Xe.link,class:"tok-link"},{tag:Xe.heading,class:"tok-heading"},{tag:Xe.emphasis,class:"tok-emphasis"},{tag:Xe.strong,class:"tok-strong"},{tag:Xe.keyword,class:"tok-keyword"},{tag:Xe.atom,class:"tok-atom"},{tag:Xe.bool,class:"tok-bool"},{tag:Xe.url,class:"tok-url"},{tag:Xe.labelName,class:"tok-labelName"},{tag:Xe.inserted,class:"tok-inserted"},{tag:Xe.deleted,class:"tok-deleted"},{tag:Xe.literal,class:"tok-literal"},{tag:Xe.string,class:"tok-string"},{tag:Xe.number,class:"tok-number"},{tag:[Xe.regexp,Xe.escape,Xe.special(Xe.string)],class:"tok-string2"},{tag:Xe.variableName,class:"tok-variableName"},{tag:Xe.local(Xe.variableName),class:"tok-variableName tok-local"},{tag:Xe.definition(Xe.variableName),class:"tok-variableName tok-definition"},{tag:Xe.special(Xe.variableName),class:"tok-variableName2"},{tag:Xe.definition(Xe.propertyName),class:"tok-propertyName tok-definition"},{tag:Xe.typeName,class:"tok-typeName"},{tag:Xe.namespace,class:"tok-namespace"},{tag:Xe.className,class:"tok-className"},{tag:Xe.macroName,class:"tok-macroName"},{tag:Xe.propertyName,class:"tok-propertyName"},{tag:Xe.operator,class:"tok-operator"},{tag:Xe.comment,class:"tok-comment"},{tag:Xe.meta,class:"tok-meta"},{tag:Xe.invalid,class:"tok-invalid"},{tag:Xe.punctuation,class:"tok-punctuation"}]);var _L;const db=new Rn;function Lst(t){return zt.define({combine:t?e=>e.concat(t):void 0})}const Nst=new Rn;class rl{constructor(e,n,a=[],r=""){this.data=e,this.name=r,Hn.prototype.hasOwnProperty("tree")||Object.defineProperty(Hn.prototype,"tree",{get(){return ro(this)}}),this.parser=n,this.extension=[im.of(this),Hn.languageData.of((i,o,s)=>{let l=ece(i,o,s),u=l.type.prop(db);if(!u)return[];let d=i.facet(u),p=l.type.prop(Nst);if(p){let m=l.resolve(o-l.from,s);for(let A of p)if(A.test(m,i)){let g=i.facet(A.facet);return A.type=="replace"?g:g.concat(d)}}return d})].concat(a)}isActiveAt(e,n,a=-1){return ece(e,n,a).type.prop(db)==this.data}findRegions(e){let n=e.facet(im);if((n==null?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let a=[],r=(i,o)=>{if(i.prop(db)==this.data){a.push({from:o,to:o+i.length});return}let s=i.prop(Rn.mounted);if(s){if(s.tree.prop(db)==this.data){if(s.overlay)for(let l of s.overlay)a.push({from:l.from+o,to:l.to+o});else a.push({from:o,to:o+i.length});return}else if(s.overlay){let l=a.length;if(r(s.tree,s.overlay[0].from+o),a.length>l)return}}for(let l=0;l<i.children.length;l++){let u=i.children[l];u instanceof Lr&&r(u,i.positions[l]+o)}};return r(ro(e),0),a}get allowsNesting(){return!0}}rl.setState=Bn.define();function ece(t,e,n){let a=t.facet(im),r=ro(t).topNode;if(!a||a.allowsNesting)for(let i=r;i;i=i.enter(e,n,bi.ExcludeBuffers))i.type.isTop&&(r=i);return r}class H2 extends rl{constructor(e,n,a){super(e,n,[],a),this.parser=n}static define(e){let n=Lst(e.languageData);return new H2(n,e.parser.configure({props:[db.add(a=>a.isTop?n:void 0)]}),e.name)}configure(e,n){return new H2(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ro(t){let e=t.field(rl.state,!1);return e?e.tree:Lr.empty}class Mst{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let a=this.cursorPos-this.string.length;return e<a||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-a,n-a)}}let B1=null;class U2{constructor(e,n,a=[],r,i,o,s,l){this.parser=e,this.state=n,this.fragments=a,this.tree=r,this.treeLen=i,this.viewport=o,this.skipped=s,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,n,a){return new U2(e,n,[],Lr.empty,0,a,[],null)}startParse(){return this.parser.startParse(new Mst(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Lr.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var a;if(typeof e=="number"){let r=Date.now()+e;e=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let r=this.parse.advance();if(r)if(this.fragments=this.withoutTempSkipped(lg.addTree(r,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(a=this.parse.stoppedAt)!==null&&a!==void 0?a:this.state.doc.length,this.tree=r,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(lg.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=B1;B1=this;try{return e()}finally{B1=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=tce(e,n.from,n.to);return e}changes(e,n){let{fragments:a,tree:r,treeLen:i,viewport:o,skipped:s}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((u,d,p,m)=>l.push({fromA:u,toA:d,fromB:p,toB:m})),a=lg.applyChanges(a,l),r=Lr.empty,i=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){s=[];for(let u of this.skipped){let d=e.mapPos(u.from,1),p=e.mapPos(u.to,-1);d<p&&s.push({from:d,to:p})}}}return new U2(this.parser,n,a,r,i,o,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let n=this.skipped.length;for(let a=0;a<this.skipped.length;a++){let{from:r,to:i}=this.skipped[a];r<e.to&&i>e.from&&(this.fragments=tce(this.fragments,r,i),this.skipped.splice(a--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends Wse{createParse(n,a,r){let i=r[0].from,o=r[r.length-1].to;return{parsedPos:i,advance(){let l=B1;if(l){for(let u of r)l.tempSkipped.push(u);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new Lr(ds.none,[],[],o-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return B1}}function tce(t,e,n){return lg.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class pb{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),a=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,a)||n.takeTree(),new pb(n)}static init(e){let n=Math.min(3e3,e.doc.length),a=U2.create(e.facet(im).parser,e,{from:0,to:n});return a.work(20,n)||a.takeTree(),new pb(a)}}rl.state=Li.define({create:pb.init,update(t,e){for(let n of e.effects)if(n.is(rl.setState))return n.value;return e.startState.facet(im)!=e.state.facet(im)?pb.init(e.state):t.apply(e)}});let nce=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(nce=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const xL=typeof navigator<"u"&&(!((_L=navigator.scheduling)===null||_L===void 0)&&_L.isInputPending)?()=>navigator.scheduling.isInputPending():null,Rst=vr.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(rl.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(rl.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=nce(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:a,viewport:{to:r}}=this.view,i=a.field(rl.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!xL?Math.max(25,e.timeRemaining()-5):1e9),s=i.context.treeLen<r&&a.doc.length>r+1e3,l=i.context.work(()=>xL&&xL()||Date.now()>o,r+(s?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:rl.setState.of(new pb(i.context))})),this.chunkBudget>0&&!(l&&!s)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>us(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),im=zt.define({combine(t){return t.length?t[0]:null},enables:t=>[rl.state,Rst,Ot.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class Pst{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const $st=zt.define(),Y2=zt.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function W2(t){let e=t.facet(Y2);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function I1(t,e){let n="",a=t.tabSize,r=t.facet(Y2)[0];if(r==" "){for(;e>=a;)n+=" ",e-=a;r=" "}for(let i=0;i<e;i++)n+=r;return n}function EL(t,e){t instanceof Hn&&(t=new K2(t));for(let a of t.state.facet($st)){let r=a(t,e);if(r!==void 0)return r}let n=ro(t.state);return n.length>=e?Ost(t,n,e):null}class K2{constructor(e,n={}){this.state=e,this.options=n,this.unit=W2(e)}lineAt(e,n=1){let a=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return r!=null&&r>=a.from&&r<=a.to?i&&r==e?{text:"",from:e}:(n<0?r<e:r<=e)?{text:a.text.slice(r-a.from),from:r}:{text:a.text.slice(0,r-a.from),from:a.from}:a}textAfterPos(e,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:a,from:r}=this.lineAt(e,n);return a.slice(e-r,Math.min(a.length,e+100-r))}column(e,n=1){let{text:a,from:r}=this.lineAt(e,n),i=this.countColumn(a,e-r),o=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return o>-1&&(i+=o-this.countColumn(a,a.search(/\S|$/))),i}countColumn(e,n=e.length){return nb(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:a,from:r}=this.lineAt(e,n),i=this.options.overrideIndentation;if(i){let o=i(r);if(o>-1)return o}return this.countColumn(a,a.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const ace=new Rn;function Ost(t,e,n){let a=e.resolveStack(n),r=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(r!=a.node){let i=[];for(let o=r;o&&!(o.from<a.node.from||o.to>a.node.to||o.from==a.node.from&&o.type==a.node.type);o=o.parent)i.push(o);for(let o=i.length-1;o>=0;o--)a={node:i[o],next:a}}return rce(a,t,n)}function rce(t,e,n){for(let a=t;a;a=a.next){let r=Gst(a.node);if(r)return r(BL.create(e,n,a))}return 0}function jst(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function Gst(t){let e=t.type.prop(ace);if(e)return e;let n=t.firstChild,a;if(n&&(a=n.type.prop(Rn.closedBy))){let r=t.lastChild,i=r&&a.indexOf(r.name)>-1;return o=>Ust(o,!0,1,void 0,i&&!jst(o)?r.from:void 0)}return t.parent==null?qst:null}function qst(){return 0}class BL extends K2{constructor(e,n,a){super(e.state,e.options),this.base=e,this.pos=n,this.context=a}get node(){return this.context.node}static create(e,n,a){return new BL(e,n,a)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let a=e.resolve(n.from);for(;a.parent&&a.parent.from==a.from;)a=a.parent;if(zst(a,e))break;n=this.state.doc.lineAt(a.from)}return this.lineIndent(n.from)}continue(){return rce(this.context.next,this.base,this.pos)}}function zst(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function Hst(t){let e=t.node,n=e.childAfter(e.from),a=e.lastChild;if(!n)return null;let r=t.options.simulateBreak,i=t.state.doc.lineAt(n.from),o=r==null||r<=i.from?i.to:Math.min(i.to,r);for(let s=n.to;;){let l=e.childAfter(s);if(!l||l==a)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let u=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+u}}s=l.to}}function Ust(t,e,n,a,r){let i=t.textAfter,o=i.match(/^\s*/)[0].length,s=r==t.pos+o,l=Hst(t);return l?s?t.column(l.from):t.column(l.to):t.baseIndent+(s?0:t.unit*n)}function ice({except:t,units:e=1}={}){return n=>{let a=t&&t.test(n.textAfter);return n.baseIndent+(a?0:e*n.unit)}}const Yst=200;function Wst(){return Hn.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:a}=t.newSelection.main,r=n.lineAt(a);if(a>r.from+Yst)return t;let i=n.sliceString(r.from,a);if(!e.some(u=>u.test(i)))return t;let{state:o}=t,s=-1,l=[];for(let{head:u}of o.selection.ranges){let d=o.doc.lineAt(u);if(d.from==s)continue;s=d.from;let p=EL(o,d.from);if(p==null)continue;let m=/^\s*/.exec(d.text)[0],A=I1(o,p);m!=A&&l.push({from:d.from,to:d.from+m.length,insert:A})}return l.length?[t,{changes:l,sequential:!0}]:t})}const Kst=zt.define(),oce=new Rn;function Zst(t){let e=t.firstChild,n=t.lastChild;return e&&e.to<n.from?{from:e.to,to:n.type.isError?t.to:n.from}:null}function Vst(t,e,n){let a=ro(t);if(a.length<n)return null;let r=a.resolveStack(n,1),i=null;for(let o=r;o;o=o.next){let s=o.node;if(s.to<=n||s.from>n)continue;if(i&&s.from<e)break;let l=s.type.prop(oce);if(l&&(s.to<a.length-50||a.length==t.doc.length||!Jst(s))){let u=l(s,t);u&&u.from<=n&&u.from>=e&&u.to>n&&(i=u)}}return i}function Jst(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function Z2(t,e,n){for(let a of t.facet(Kst)){let r=a(t,e,n);if(r)return r}return Vst(t,e,n)}function sce(t,e){let n=e.mapPos(t.from,1),a=e.mapPos(t.to,-1);return n>=a?void 0:{from:n,to:a}}const V2=Bn.define({map:sce}),D1=Bn.define({map:sce});function cce(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(a=>a.from<=n&&a.to>=n)||e.push(t.lineBlockAt(n));return e}const dg=Li.define({create(){return ln.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,a)=>t=lce(t,n,a)),t=t.map(e.changes);for(let n of e.effects)if(n.is(V2)&&!Xst(t,n.value.from,n.value.to)){let{preparePlaceholder:a}=e.state.facet(pce),r=a?ln.replace({widget:new rct(a(e.state,n.value))}):gce;t=t.update({add:[r.range(n.value.from,n.value.to)]})}else n.is(D1)&&(t=t.update({filter:(a,r)=>n.value.from!=a||n.value.to!=r,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=lce(t,e.selection.main.head)),t},provide:t=>Ot.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(a,r)=>{n.push(a,r)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n<t.length;){let a=t[n++],r=t[n++];if(typeof a!="number"||typeof r!="number")throw new RangeError("Invalid JSON for fold state");e.push(gce.range(a,r))}return ln.set(e,!0)}});function lce(t,e,n=e){let a=!1;return t.between(e,n,(r,i)=>{r<n&&i>e&&(a=!0)}),a?t.update({filterFrom:e,filterTo:n,filter:(r,i)=>r>=n||i<=e}):t}function J2(t,e,n){var a;let r=null;return(a=t.field(dg,!1))===null||a===void 0||a.between(e,n,(i,o)=>{(!r||r.from>i)&&(r={from:i,to:o})}),r}function Xst(t,e,n){let a=!1;return t.between(e,e,(r,i)=>{r==e&&i==n&&(a=!0)}),a}function uce(t,e){return t.field(dg,!1)?e:e.concat(Bn.appendConfig.of(mce()))}const ect=t=>{for(let e of cce(t)){let n=Z2(t.state,e.from,e.to);if(n)return t.dispatch({effects:uce(t.state,[V2.of(n),dce(t,n)])}),!0}return!1},tct=t=>{if(!t.state.field(dg,!1))return!1;let e=[];for(let n of cce(t)){let a=J2(t.state,n.from,n.to);a&&e.push(D1.of(a),dce(t,a,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function dce(t,e,n=!0){let a=t.state.doc.lineAt(e.from).number,r=t.state.doc.lineAt(e.to).number;return Ot.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${a} ${t.state.phrase("to")} ${r}.`)}const nct=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:ect},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:tct},{key:"Ctrl-Alt-[",run:t=>{let{state:e}=t,n=[];for(let a=0;a<e.doc.length;){let r=t.lineBlockAt(a),i=Z2(e,r.from,r.to);i&&n.push(V2.of(i)),a=(i?t.lineBlockAt(i.to):r).to+1}return n.length&&t.dispatch({effects:uce(t.state,n)}),!!n.length}},{key:"Ctrl-Alt-]",run:t=>{let e=t.state.field(dg,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(a,r)=>{n.push(D1.of({from:a,to:r}))}),t.dispatch({effects:n}),!0}}],act={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},pce=zt.define({combine(t){return iu(t,act)}});function mce(t){return[dg,sct]}function Ace(t,e){let{state:n}=t,a=n.facet(pce),r=o=>{let s=t.lineBlockAt(t.posAtDOM(o.target)),l=J2(t.state,s.from,s.to);l&&t.dispatch({effects:D1.of(l)}),o.preventDefault()};if(a.placeholderDOM)return a.placeholderDOM(t,r,e);let i=document.createElement("span");return i.textContent=a.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=r,i}const gce=ln.replace({widget:new class extends Cd{toDOM(t){return Ace(t,null)}}});class rct extends Cd{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return Ace(e,this.value)}}const ict={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class IL extends Ed{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function oct(t={}){let e={...ict,...t},n=new IL(e,!0),a=new IL(e,!1),r=vr.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(im)!=o.state.facet(im)||o.startState.field(dg,!1)!=o.state.field(dg,!1)||ro(o.startState)!=ro(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let s=new kd;for(let l of o.viewportLineBlocks){let u=J2(o.state,l.from,l.to)?a:Z2(o.state,l.from,l.to)?n:null;u&&s.add(l.from,l.from,u)}return s.finish()}}),{domEventHandlers:i}=e;return[r,cst({class:"cm-foldGutter",markers(o){var s;return((s=o.plugin(r))===null||s===void 0?void 0:s.markers)||ta.empty},initialSpacer(){return new IL(e,!1)},domEventHandlers:{...i,click:(o,s,l)=>{if(i.click&&i.click(o,s,l))return!0;let u=J2(o.state,s.from,s.to);if(u)return o.dispatch({effects:D1.of(u)}),!0;let d=Z2(o.state,s.from,s.to);return d?(o.dispatch({effects:V2.of(d)}),!0):!1}}}),mce()]}const sct=Ot.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Q1{constructor(e,n){this.specs=e;let a;function r(s){let l=Kp.newName();return(a||(a=Object.create(null)))["."+l]=s,l}const i=typeof n.all=="string"?n.all:n.all?r(n.all):void 0,o=n.scope;this.scope=o instanceof rl?s=>s.prop(db)==o.data:o?s=>s==o:void 0,this.style=Vse(e.map(s=>({tag:s.tag,class:s.class||r(Object.assign({},s,{tag:null}))})),{all:i}).style,this.module=a?new Kp(a):null,this.themeType=n.themeType}static define(e,n){return new Q1(e,n||{})}}const DL=zt.define(),hce=zt.define({combine(t){return t.length?[t[0]]:null}});function QL(t){let e=t.facet(DL);return e.length?e:t.facet(hce)}function fce(t,e){let n=[lct],a;return t instanceof Q1&&(t.module&&n.push(Ot.styleModule.of(t.module)),a=t.themeType),e!=null&&e.fallback?n.push(hce.of(t)):a?n.push(DL.computeN([Ot.darkTheme],r=>r.facet(Ot.darkTheme)==(a=="dark")?[t]:[])):n.push(DL.of(t)),n}class cct{constructor(e){this.markCache=Object.create(null),this.tree=ro(e.state),this.decorations=this.buildDeco(e,QL(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=ro(e.state),a=QL(e.state),r=a!=QL(e.startState),{viewport:i}=e.view,o=e.changes.mapPos(this.decoratedTo,1);n.length<i.to&&!r&&n.type==this.tree.type&&o>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(n!=this.tree||e.viewportChanged||r)&&(this.tree=n,this.decorations=this.buildDeco(e.view,a),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return ln.none;let a=new kd;for(let{from:r,to:i}of e.visibleRanges)Sst(this.tree,n,(o,s,l)=>{a.add(o,s,this.markCache[l]||(this.markCache[l]=ln.mark({class:l})))},r,i);return a.finish()}}const lct=ag.high(vr.fromClass(cct,{decorations:t=>t.decorations})),uct=Q1.define([{tag:Xe.meta,color:"#404740"},{tag:Xe.link,textDecoration:"underline"},{tag:Xe.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Xe.emphasis,fontStyle:"italic"},{tag:Xe.strong,fontWeight:"bold"},{tag:Xe.strikethrough,textDecoration:"line-through"},{tag:Xe.keyword,color:"#708"},{tag:[Xe.atom,Xe.bool,Xe.url,Xe.contentSeparator,Xe.labelName],color:"#219"},{tag:[Xe.literal,Xe.inserted],color:"#164"},{tag:[Xe.string,Xe.deleted],color:"#a11"},{tag:[Xe.regexp,Xe.escape,Xe.special(Xe.string)],color:"#e40"},{tag:Xe.definition(Xe.variableName),color:"#00f"},{tag:Xe.local(Xe.variableName),color:"#30a"},{tag:[Xe.typeName,Xe.namespace],color:"#085"},{tag:Xe.className,color:"#167"},{tag:[Xe.special(Xe.variableName),Xe.macroName],color:"#256"},{tag:Xe.definition(Xe.propertyName),color:"#00c"},{tag:Xe.comment,color:"#940"},{tag:Xe.invalid,color:"#f00"}]),dct=Ot.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),bce=1e4,yce="()[]{}",wce=zt.define({combine(t){return iu(t,{afterCursor:!0,brackets:yce,maxScanDistance:bce,renderMatch:Act})}}),pct=ln.mark({class:"cm-matchingBracket"}),mct=ln.mark({class:"cm-nonmatchingBracket"});function Act(t){let e=[],n=t.matched?pct:mct;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const gct=[Li.define({create(){return ln.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],a=e.state.facet(wce);for(let r of e.state.selection.ranges){if(!r.empty)continue;let i=pu(e.state,r.head,-1,a)||r.head>0&&pu(e.state,r.head-1,1,a)||a.afterCursor&&(pu(e.state,r.head,1,a)||r.head<e.state.doc.length&&pu(e.state,r.head+1,-1,a));i&&(n=n.concat(a.renderMatch(i,e.state)))}return ln.set(n,!0)},provide:t=>Ot.decorations.from(t)}),dct];function hct(t={}){return[wce.of(t),gct]}const fct=new Rn;function SL(t,e,n){let a=t.prop(e<0?Rn.openedBy:Rn.closedBy);if(a)return a;if(t.name.length==1){let r=n.indexOf(t.name);if(r>-1&&r%2==(e<0?1:0))return[n[r+e]]}return null}function TL(t){let e=t.type.prop(fct);return e?e(t.node):t}function pu(t,e,n,a={}){let r=a.maxScanDistance||bce,i=a.brackets||yce,o=ro(t),s=o.resolveInner(e,n);for(let l=s;l;l=l.parent){let u=SL(l.type,n,i);if(u&&l.from<l.to){let d=TL(l);if(d&&(n>0?e>=d.from&&e<d.to:e>d.from&&e<=d.to))return bct(t,e,n,l,d,u,i)}}return yct(t,e,n,o,s.type,r,i)}function bct(t,e,n,a,r,i,o){let s=a.parent,l={from:r.from,to:r.to},u=0,d=s==null?void 0:s.cursor();if(d&&(n<0?d.childBefore(a.from):d.childAfter(a.to)))do if(n<0?d.to<=a.from:d.from>=a.to){if(u==0&&i.indexOf(d.type.name)>-1&&d.from<d.to){let p=TL(d);return{start:l,end:p?{from:p.from,to:p.to}:void 0,matched:!0}}else if(SL(d.type,n,o))u++;else if(SL(d.type,-n,o)){if(u==0){let p=TL(d);return{start:l,end:p&&p.from<p.to?{from:p.from,to:p.to}:void 0,matched:!1}}u--}}while(n<0?d.prevSibling():d.nextSibling());return{start:l,matched:!1}}function yct(t,e,n,a,r,i,o){let s=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=o.indexOf(s);if(l<0||l%2==0!=n>0)return null;let u={from:n<0?e-1:e,to:n>0?e+1:e},d=t.doc.iterRange(e,n>0?t.doc.length:0),p=0;for(let m=0;!d.next().done&&m<=i;){let A=d.value;n<0&&(m+=A.length);let g=e+m*n;for(let h=n>0?0:A.length-1,f=n>0?A.length:-1;h!=f;h+=n){let b=o.indexOf(A[h]);if(!(b<0||a.resolveInner(g+h,1).type!=r))if(b%2==0==n>0)p++;else{if(p==1)return{start:u,end:{from:g+h,to:g+h+1},matched:b>>1==l>>1};p--}}n>0&&(m+=A.length)}return d.done?{start:u,matched:!1}:null}const wct=Object.create(null),kce=[ds.none],vce=[],Cce=Object.create(null),kct=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])kct[t]=vct(wct,e);function FL(t,e){vce.indexOf(t)>-1||(vce.push(t),console.warn(e))}function vct(t,e){let n=[];for(let s of e.split(" ")){let l=[];for(let u of s.split(".")){let d=t[u]||Xe[u];d?typeof d=="function"?l.length?l=l.map(d):FL(u,`Modifier ${u} used at start of tag`):l.length?FL(u,`Tag ${u} used as modifier`):l=Array.isArray(d)?d:[d]:FL(u,`Unknown highlighting tag ${u}`)}for(let u of l)n.push(u)}if(!n.length)return 0;let a=e.replace(/ /g,"_"),r=a+" "+n.map(s=>s.id),i=Cce[r];if(i)return i.id;let o=Cce[r]=ds.define({id:kce.length,name:a,props:[Kse({[a]:n})]});return kce.push(o),o.id}Ra.RTL,Ra.LTR;const Cct=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),a=NL(t.state,n.from);return a.line?_ct(t):a.block?Ect(t):!1};function LL(t,e){return({state:n,dispatch:a})=>{if(n.readOnly)return!1;let r=t(e,n);return r?(a(n.update(r)),!0):!1}}const _ct=LL(Dct,0),xct=LL(_ce,0),Ect=LL((t,e)=>_ce(t,e,Ict(e)),0);function NL(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const S1=50;function Bct(t,{open:e,close:n},a,r){let i=t.sliceDoc(a-S1,a),o=t.sliceDoc(r,r+S1),s=/\s*$/.exec(i)[0].length,l=/^\s*/.exec(o)[0].length,u=i.length-s;if(i.slice(u-e.length,u)==e&&o.slice(l,l+n.length)==n)return{open:{pos:a-s,margin:s&&1},close:{pos:r+l,margin:l&&1}};let d,p;r-a<=2*S1?d=p=t.sliceDoc(a,r):(d=t.sliceDoc(a,a+S1),p=t.sliceDoc(r-S1,r));let m=/^\s*/.exec(d)[0].length,A=/\s*$/.exec(p)[0].length,g=p.length-A-n.length;return d.slice(m,m+e.length)==e&&p.slice(g,g+n.length)==n?{open:{pos:a+m+e.length,margin:/\s/.test(d.charAt(m+e.length))?1:0},close:{pos:r-A-n.length,margin:/\s/.test(p.charAt(g-1))?1:0}}:null}function Ict(t){let e=[];for(let n of t.selection.ranges){let a=t.doc.lineAt(n.from),r=n.to<=a.to?a:t.doc.lineAt(n.to);r.from>a.from&&r.from==n.to&&(r=n.to==a.to+1?a:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>a.from?e[i].to=r.to:e.push({from:a.from+/^\s*/.exec(a.text)[0].length,to:r.to})}return e}function _ce(t,e,n=e.selection.ranges){let a=n.map(i=>NL(e,i.from).block);if(!a.every(i=>i))return null;let r=n.map((i,o)=>Bct(e,a[o],i.from,i.to));if(t!=2&&!r.every(i=>i))return{changes:e.changes(n.map((i,o)=>r[o]?[]:[{from:i.from,insert:a[o].open+" "},{from:i.to,insert:" "+a[o].close}]))};if(t!=1&&r.some(i=>i)){let i=[];for(let o=0,s;o<r.length;o++)if(s=r[o]){let l=a[o],{open:u,close:d}=s;i.push({from:u.pos-l.open.length,to:u.pos+u.margin},{from:d.pos-d.margin,to:d.pos+l.close.length})}return{changes:i}}return null}function Dct(t,e,n=e.selection.ranges){let a=[],r=-1;for(let{from:i,to:o}of n){let s=a.length,l=1e9,u=NL(e,i).line;if(u){for(let d=i;d<=o;){let p=e.doc.lineAt(d);if(p.from>r&&(i==o||o>p.from)){r=p.from;let m=/^\s*/.exec(p.text)[0].length,A=m==p.length,g=p.text.slice(m,m+u.length)==u?m:-1;m<p.text.length&&m<l&&(l=m),a.push({line:p,comment:g,token:u,indent:m,empty:A,single:!1})}d=p.to+1}if(l<1e9)for(let d=s;d<a.length;d++)a[d].indent<a[d].line.text.length&&(a[d].indent=l);a.length==s+1&&(a[s].single=!0)}}if(t!=2&&a.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:s,token:l,indent:u,empty:d,single:p}of a)(p||!d)&&i.push({from:s.from+u,insert:l+" "});let o=e.changes(i);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&a.some(i=>i.comment>=0)){let i=[];for(let{line:o,comment:s,token:l}of a)if(s>=0){let u=o.from+s,d=u+l.length;o.text[d-o.from]==" "&&d++,i.push({from:u,to:d})}return{changes:i}}return null}const ML=ru.define(),Qct=ru.define(),Sct=zt.define(),xce=zt.define({combine(t){return iu(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(a,r)=>e(a,r)||n(a,r)})}}),Ece=Li.define({create(){return mu.empty},update(t,e){let n=e.state.facet(xce),a=e.annotation(ML);if(a){let l=ps.fromTransaction(e,a.selection),u=a.side,d=u==0?t.undone:t.done;return l?d=e3(d,d.length,n.minDepth,l):d=Dce(d,e.startState.selection),new mu(u==0?a.rest:d,u==0?d:a.rest)}let r=e.annotation(Qct);if((r=="full"||r=="before")&&(t=t.isolate()),e.annotation(ei.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=ps.fromTransaction(e),o=e.annotation(ei.time),s=e.annotation(ei.userEvent);return i?t=t.addChanges(i,o,s,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,s,n.newGroupDelay)),(r=="full"||r=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new mu(t.done.map(ps.fromJSON),t.undone.map(ps.fromJSON))}});function Tct(t={}){return[Ece,xce.of(t),Ot.domEventHandlers({beforeinput(e,n){let a=e.inputType=="historyUndo"?Bce:e.inputType=="historyRedo"?RL:null;return a?(e.preventDefault(),a(n)):!1}})]}function X2(t,e){return function({state:n,dispatch:a}){if(!e&&n.readOnly)return!1;let r=n.field(Ece,!1);if(!r)return!1;let i=r.pop(t,n,e);return i?(a(i),!0):!1}}const Bce=X2(0,!1),RL=X2(1,!1),Fct=X2(0,!0),Lct=X2(1,!0);class ps{constructor(e,n,a,r,i){this.changes=e,this.effects=n,this.mapped=a,this.startSelection=r,this.selectionsAfter=i}setSelAfter(e){return new ps(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,a;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(a=this.startSelection)===null||a===void 0?void 0:a.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new ps(e.changes&&Xr.fromJSON(e.changes),[],e.mapped&&au.fromJSON(e.mapped),e.startSelection&<.fromJSON(e.startSelection),e.selectionsAfter.map(lt.fromJSON))}static fromTransaction(e,n){let a=kc;for(let r of e.startState.facet(Sct)){let i=r(e);i.length&&(a=a.concat(i))}return!a.length&&e.changes.empty?null:new ps(e.changes.invert(e.startState.doc),a,void 0,n||e.startState.selection,kc)}static selection(e){return new ps(void 0,kc,void 0,void 0,e)}}function e3(t,e,n,a){let r=e+1>n+20?e-n-1:0,i=t.slice(r,e);return i.push(a),i}function Nct(t,e){let n=[],a=!1;return t.iterChangedRanges((r,i)=>n.push(r,i)),e.iterChangedRanges((r,i,o,s)=>{for(let l=0;l<n.length;){let u=n[l++],d=n[l++];s>=u&&o<=d&&(a=!0)}}),a}function Mct(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,a)=>n.empty!=e.ranges[a].empty).length===0}function Ice(t,e){return t.length?e.length?t.concat(e):t:e}const kc=[],Rct=200;function Dce(t,e){if(t.length){let n=t[t.length-1],a=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Rct));return a.length&&a[a.length-1].eq(e)?t:(a.push(e),e3(t,t.length-1,1e9,n.setSelAfter(a)))}else return[ps.selection([e])]}function Pct(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function PL(t,e){if(!t.length)return t;let n=t.length,a=kc;for(;n;){let r=$ct(t[n-1],e,a);if(r.changes&&!r.changes.empty||r.effects.length){let i=t.slice(0,n);return i[n-1]=r,i}else e=r.mapped,n--,a=r.selectionsAfter}return a.length?[ps.selection(a)]:kc}function $ct(t,e,n){let a=Ice(t.selectionsAfter.length?t.selectionsAfter.map(s=>s.map(e)):kc,n);if(!t.changes)return ps.selection(a);let r=t.changes.map(e),i=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(i):i;return new ps(r,Bn.mapEffects(t.effects,e),o,t.startSelection.map(i),a)}const Oct=/^(input\.type|delete)($|\.)/;class mu{constructor(e,n,a=0,r=void 0){this.done=e,this.undone=n,this.prevTime=a,this.prevUserEvent=r}isolate(){return this.prevTime?new mu(this.done,this.undone):this}addChanges(e,n,a,r,i){let o=this.done,s=o[o.length-1];return s&&s.changes&&!s.changes.empty&&e.changes&&(!a||Oct.test(a))&&(!s.selectionsAfter.length&&n-this.prevTime<r.newGroupDelay&&r.joinToEvent(i,Nct(s.changes,e.changes))||a=="input.type.compose")?o=e3(o,o.length-1,r.minDepth,new ps(e.changes.compose(s.changes),Ice(Bn.mapEffects(e.effects,s.changes),s.effects),s.mapped,s.startSelection,kc)):o=e3(o,o.length,r.minDepth,e),new mu(o,kc,n,a)}addSelection(e,n,a,r){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:kc;return i.length>0&&n-this.prevTime<r&&a==this.prevUserEvent&&a&&/^select($|\.)/.test(a)&&Mct(i[i.length-1],e)?this:new mu(Dce(this.done,e),this.undone,n,a)}addMapping(e){return new mu(PL(this.done,e),PL(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,a){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],o=i.selectionsAfter[0]||n.selection;if(a&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:ML.of({side:e,rest:Pct(r),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let s=r.length==1?kc:r.slice(0,r.length-1);return i.mapped&&(s=PL(s,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:ML.of({side:e,rest:s,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}mu.empty=new mu(kc,kc);const jct=[{key:"Mod-z",run:Bce,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:RL,preventDefault:!0},{linux:"Ctrl-Shift-z",run:RL,preventDefault:!0},{key:"Mod-u",run:Fct,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Lct,preventDefault:!0}];function mb(t,e){return lt.create(t.ranges.map(e),t.mainIndex)}function il(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function ol({state:t,dispatch:e},n){let a=mb(t.selection,n);return a.eq(t.selection,!0)?!1:(e(il(t,a)),!0)}function t3(t,e){return lt.cursor(e?t.to:t.from)}function Qce(t,e){return ol(t,n=>n.empty?t.moveByChar(n,e):t3(n,e))}function io(t){return t.textDirectionAt(t.state.selection.main.head)==Ra.LTR}const Sce=t=>Qce(t,!io(t)),Tce=t=>Qce(t,io(t));function Fce(t,e){return ol(t,n=>n.empty?t.moveByGroup(n,e):t3(n,e))}const Gct=t=>Fce(t,!io(t)),qct=t=>Fce(t,io(t));function zct(t,e,n){if(e.type.prop(n))return!0;let a=e.to-e.from;return a&&(a>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function n3(t,e,n){let a=ro(t).resolveInner(e.head),r=n?Rn.closedBy:Rn.openedBy;for(let l=e.head;;){let u=n?a.childAfter(l):a.childBefore(l);if(!u)break;zct(t,u,r)?a=u:l=n?u.to:u.from}let i=a.type.prop(r),o,s;return i&&(o=n?pu(t,a.from,1):pu(t,a.to,-1))&&o.matched?s=n?o.end.to:o.end.from:s=n?a.to:a.from,lt.cursor(s,n?-1:1)}const Hct=t=>ol(t,e=>n3(t.state,e,!io(t))),Uct=t=>ol(t,e=>n3(t.state,e,io(t)));function Lce(t,e){return ol(t,n=>{if(!n.empty)return t3(n,e);let a=t.moveVertically(n,e);return a.head!=n.head?a:t.moveToLineBoundary(n,e)})}const Nce=t=>Lce(t,!1),Mce=t=>Lce(t,!0);function Rce(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,a=0,r;if(e){for(let i of t.state.facet(Ot.scrollMargins)){let o=i(t);o!=null&&o.top&&(n=Math.max(o==null?void 0:o.top,n)),o!=null&&o.bottom&&(a=Math.max(o==null?void 0:o.bottom,a))}r=t.scrollDOM.clientHeight-n-a}else r=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:a,selfScroll:e,height:Math.max(t.defaultLineHeight,r-5)}}function Pce(t,e){let n=Rce(t),{state:a}=t,r=mb(a.selection,o=>o.empty?t.moveVertically(o,e,n.height):t3(o,e));if(r.eq(a.selection))return!1;let i;if(n.selfScroll){let o=t.coordsAtPos(a.selection.main.head),s=t.scrollDOM.getBoundingClientRect(),l=s.top+n.marginTop,u=s.bottom-n.marginBottom;o&&o.top>l&&o.bottom<u&&(i=Ot.scrollIntoView(r.main.head,{y:"start",yMargin:o.top-l}))}return t.dispatch(il(a,r),{effects:i}),!0}const $ce=t=>Pce(t,!1),$L=t=>Pce(t,!0);function om(t,e,n){let a=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,n);if(r.head==e.head&&r.head!=(n?a.to:a.from)&&(r=t.moveToLineBoundary(e,n,!1)),!n&&r.head==a.from&&a.length){let i=/^\s*/.exec(t.state.sliceDoc(a.from,Math.min(a.from+100,a.to)))[0].length;i&&e.head!=a.from+i&&(r=lt.cursor(a.from+i))}return r}const Yct=t=>ol(t,e=>om(t,e,!0)),Wct=t=>ol(t,e=>om(t,e,!1)),Kct=t=>ol(t,e=>om(t,e,!io(t))),Zct=t=>ol(t,e=>om(t,e,io(t))),Vct=t=>ol(t,e=>lt.cursor(t.lineBlockAt(e.head).from,1)),Jct=t=>ol(t,e=>lt.cursor(t.lineBlockAt(e.head).to,-1));function Xct(t,e,n){let a=!1,r=mb(t.selection,i=>{let o=pu(t,i.head,-1)||pu(t,i.head,1)||i.head>0&&pu(t,i.head-1,1)||i.head<t.doc.length&&pu(t,i.head+1,-1);if(!o||!o.end)return i;a=!0;let s=o.start.from==i.head?o.end.to:o.end.from;return lt.cursor(s)});return a?(e(il(t,r)),!0):!1}const elt=({state:t,dispatch:e})=>Xct(t,e);function vc(t,e){let n=mb(t.state.selection,a=>{let r=e(a);return lt.range(a.anchor,r.head,r.goalColumn,r.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(il(t.state,n)),!0)}function Oce(t,e){return vc(t,n=>t.moveByChar(n,e))}const jce=t=>Oce(t,!io(t)),Gce=t=>Oce(t,io(t));function qce(t,e){return vc(t,n=>t.moveByGroup(n,e))}const tlt=t=>qce(t,!io(t)),nlt=t=>qce(t,io(t)),alt=t=>vc(t,e=>n3(t.state,e,!io(t))),rlt=t=>vc(t,e=>n3(t.state,e,io(t)));function zce(t,e){return vc(t,n=>t.moveVertically(n,e))}const Hce=t=>zce(t,!1),Uce=t=>zce(t,!0);function Yce(t,e){return vc(t,n=>t.moveVertically(n,e,Rce(t).height))}const Wce=t=>Yce(t,!1),Kce=t=>Yce(t,!0),ilt=t=>vc(t,e=>om(t,e,!0)),olt=t=>vc(t,e=>om(t,e,!1)),slt=t=>vc(t,e=>om(t,e,!io(t))),clt=t=>vc(t,e=>om(t,e,io(t))),llt=t=>vc(t,e=>lt.cursor(t.lineBlockAt(e.head).from)),ult=t=>vc(t,e=>lt.cursor(t.lineBlockAt(e.head).to)),Zce=({state:t,dispatch:e})=>(e(il(t,{anchor:0})),!0),Vce=({state:t,dispatch:e})=>(e(il(t,{anchor:t.doc.length})),!0),Jce=({state:t,dispatch:e})=>(e(il(t,{anchor:t.selection.main.anchor,head:0})),!0),Xce=({state:t,dispatch:e})=>(e(il(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),dlt=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),plt=({state:t,dispatch:e})=>{let n=r3(t).map(({from:a,to:r})=>lt.range(a,Math.min(r+1,t.doc.length)));return e(t.update({selection:lt.create(n),userEvent:"select"})),!0},mlt=({state:t,dispatch:e})=>{let n=mb(t.selection,a=>{let r=ro(t),i=r.resolveStack(a.from,1);if(a.empty){let o=r.resolveStack(a.from,-1);o.node.from>=i.node.from&&o.node.to<=i.node.to&&(i=o)}for(let o=i;o;o=o.next){let{node:s}=o;if((s.from<a.from&&s.to>=a.to||s.to>a.to&&s.from<=a.from)&&o.next)return lt.range(s.to,s.from)}return a});return n.eq(t.selection)?!1:(e(il(t,n)),!0)};function ele(t,e){let{state:n}=t,a=n.selection,r=n.selection.ranges.slice();for(let i of n.selection.ranges){let o=n.doc.lineAt(i.head);if(e?o.to<t.state.doc.length:o.from>0)for(let s=i;;){let l=t.moveVertically(s,e);if(l.head<o.from||l.head>o.to){r.some(u=>u.head==l.head)||r.push(l);break}else{if(l.head==s.head)break;s=l}}}return r.length==a.ranges.length?!1:(t.dispatch(il(n,lt.create(r,r.length-1))),!0)}const Alt=t=>ele(t,!1),glt=t=>ele(t,!0),hlt=({state:t,dispatch:e})=>{let n=t.selection,a=null;return n.ranges.length>1?a=lt.create([n.main]):n.main.empty||(a=lt.create([lt.cursor(n.main.head)])),a?(e(il(t,a)),!0):!1};function T1(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:a}=t,r=a.changeByRange(i=>{let{from:o,to:s}=i;if(o==s){let l=e(i);l<o?(n="delete.backward",l=a3(t,l,!1)):l>o&&(n="delete.forward",l=a3(t,l,!0)),o=Math.min(o,l),s=Math.max(s,l)}else o=a3(t,o,!1),s=a3(t,s,!0);return o==s?{range:i}:{changes:{from:o,to:s},range:lt.cursor(o,o<i.head?-1:1)}});return r.changes.empty?!1:(t.dispatch(a.update(r,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?Ot.announce.of(a.phrase("Selection deleted")):void 0})),!0)}function a3(t,e,n){if(t instanceof Ot)for(let a of t.state.facet(Ot.atomicRanges).map(r=>r(t)))a.between(e,e,(r,i)=>{r<e&&i>e&&(e=n?i:r)});return e}const tle=(t,e,n)=>T1(t,a=>{let r=a.from,{state:i}=t,o=i.doc.lineAt(r),s,l;if(n&&!e&&r>o.from&&r<o.from+200&&!/[^ \t]/.test(s=o.text.slice(0,r-o.from))){if(s[s.length-1]==" ")return r-1;let u=nb(s,i.tabSize),d=u%W2(i)||W2(i);for(let p=0;p<d&&s[s.length-1-p]==" ";p++)r--;l=r}else l=Fi(o.text,r-o.from,e,e)+o.from,l==r&&o.number!=(e?i.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,r-o.from))&&(l=Fi(o.text,l-o.from,!1,!1)+o.from);return l}),OL=t=>tle(t,!1,!0),nle=t=>tle(t,!0,!1),ale=(t,e)=>T1(t,n=>{let a=n.head,{state:r}=t,i=r.doc.lineAt(a),o=r.charCategorizer(a);for(let s=null;;){if(a==(e?i.to:i.from)){a==n.head&&i.number!=(e?r.doc.lines:1)&&(a+=e?1:-1);break}let l=Fi(i.text,a-i.from,e)+i.from,u=i.text.slice(Math.min(a,l)-i.from,Math.max(a,l)-i.from),d=o(u);if(s!=null&&d!=s)break;(u!=" "||a!=n.head)&&(s=d),a=l}return a}),rle=t=>ale(t,!1),flt=t=>ale(t,!0),blt=t=>T1(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),ylt=t=>T1(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),wlt=t=>T1(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),klt=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(a=>({changes:{from:a.from,to:a.to,insert:ea.of(["",""])},range:lt.cursor(a.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},vlt=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(a=>{if(!a.empty||a.from==0||a.from==t.doc.length)return{range:a};let r=a.from,i=t.doc.lineAt(r),o=r==i.from?r-1:Fi(i.text,r-i.from,!1)+i.from,s=r==i.to?r+1:Fi(i.text,r-i.from,!0)+i.from;return{changes:{from:o,to:s,insert:t.doc.slice(r,s).append(t.doc.slice(o,r))},range:lt.cursor(s)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function r3(t){let e=[],n=-1;for(let a of t.selection.ranges){let r=t.doc.lineAt(a.from),i=t.doc.lineAt(a.to);if(!a.empty&&a.to==i.from&&(i=t.doc.lineAt(a.to-1)),n>=r.number){let o=e[e.length-1];o.to=i.to,o.ranges.push(a)}else e.push({from:r.from,to:i.to,ranges:[a]});n=i.number+1}return e}function ile(t,e,n){if(t.readOnly)return!1;let a=[],r=[];for(let i of r3(t)){if(n?i.to==t.doc.length:i.from==0)continue;let o=t.doc.lineAt(n?i.to+1:i.from-1),s=o.length+1;if(n){a.push({from:i.to,to:o.to},{from:i.from,insert:o.text+t.lineBreak});for(let l of i.ranges)r.push(lt.range(Math.min(t.doc.length,l.anchor+s),Math.min(t.doc.length,l.head+s)))}else{a.push({from:o.from,to:i.from},{from:i.to,insert:t.lineBreak+o.text});for(let l of i.ranges)r.push(lt.range(l.anchor-s,l.head-s))}}return a.length?(e(t.update({changes:a,scrollIntoView:!0,selection:lt.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Clt=({state:t,dispatch:e})=>ile(t,e,!1),_lt=({state:t,dispatch:e})=>ile(t,e,!0);function ole(t,e,n){if(t.readOnly)return!1;let a=[];for(let r of r3(t))n?a.push({from:r.from,insert:t.doc.slice(r.from,r.to)+t.lineBreak}):a.push({from:r.to,insert:t.lineBreak+t.doc.slice(r.from,r.to)});return e(t.update({changes:a,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const xlt=({state:t,dispatch:e})=>ole(t,e,!1),Elt=({state:t,dispatch:e})=>ole(t,e,!0),Blt=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(r3(e).map(({from:r,to:i})=>(r>0?r--:i<e.doc.length&&i++,{from:r,to:i}))),a=mb(e.selection,r=>{let i;if(t.lineWrapping){let o=t.lineBlockAt(r.head),s=t.coordsAtPos(r.head,r.assoc||1);s&&(i=o.bottom+t.documentTop-s.bottom+t.defaultLineHeight/2)}return t.moveVertically(r,!0,i)}).map(n);return t.dispatch({changes:n,selection:a,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Ilt(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=ro(t).resolveInner(e),a=n.childBefore(e),r=n.childAfter(e),i;return a&&r&&a.to<=e&&r.from>=e&&(i=a.type.prop(Rn.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(a.to).from==t.doc.lineAt(r.from).from&&!/\S/.test(t.sliceDoc(a.to,r.from))?{from:a.to,to:r.from}:null}const sle=cle(!1),Dlt=cle(!0);function cle(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let a=e.changeByRange(r=>{let{from:i,to:o}=r,s=e.doc.lineAt(i),l=!t&&i==o&&Ilt(e,i);t&&(i=o=(o<=s.to?s:e.doc.lineAt(o)).to);let u=new K2(e,{simulateBreak:i,simulateDoubleBreak:!!l}),d=EL(u,i);for(d==null&&(d=nb(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));o<s.to&&/\s/.test(s.text[o-s.from]);)o++;l?{from:i,to:o}=l:i>s.from&&i<s.from+100&&!/\S/.test(s.text.slice(0,i))&&(i=s.from);let p=["",I1(e,d)];return l&&p.push(I1(e,u.lineIndent(s.from,-1))),{changes:{from:i,to:o,insert:ea.of(p)},range:lt.cursor(i+1+p[1].length)}});return n(e.update(a,{scrollIntoView:!0,userEvent:"input"})),!0}}function jL(t,e){let n=-1;return t.changeByRange(a=>{let r=[];for(let o=a.from;o<=a.to;){let s=t.doc.lineAt(o);s.number>n&&(a.empty||a.to>s.from)&&(e(s,r,a),n=s.number),o=s.to+1}let i=t.changes(r);return{changes:r,range:lt.range(i.mapPos(a.anchor,1),i.mapPos(a.head,1))}})}const Qlt=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),a=new K2(t,{overrideIndentation:i=>{let o=n[i];return o??-1}}),r=jL(t,(i,o,s)=>{let l=EL(a,i.from);if(l==null)return;/\S/.test(i.text)||(l=0);let u=/^\s*/.exec(i.text)[0],d=I1(t,l);(u!=d||s.from<i.from+u.length)&&(n[i.from]=l,o.push({from:i.from,to:i.from+u.length,insert:d}))});return r.changes.empty||e(t.update(r,{userEvent:"indent"})),!0},lle=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(jL(t,(n,a)=>{a.push({from:n.from,insert:t.facet(Y2)})}),{userEvent:"input.indent"})),!0),ule=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(jL(t,(n,a)=>{let r=/^\s*/.exec(n.text)[0];if(!r)return;let i=nb(r,t.tabSize),o=0,s=I1(t,Math.max(0,i-W2(t)));for(;o<r.length&&o<s.length&&r.charCodeAt(o)==s.charCodeAt(o);)o++;a.push({from:n.from+o,to:n.from+r.length,insert:s.slice(o)})}),{userEvent:"delete.dedent"})),!0),Slt=t=>(t.setTabFocusMode(),!0),Tlt=[{key:"Ctrl-b",run:Sce,shift:jce,preventDefault:!0},{key:"Ctrl-f",run:Tce,shift:Gce},{key:"Ctrl-p",run:Nce,shift:Hce},{key:"Ctrl-n",run:Mce,shift:Uce},{key:"Ctrl-a",run:Vct,shift:llt},{key:"Ctrl-e",run:Jct,shift:ult},{key:"Ctrl-d",run:nle},{key:"Ctrl-h",run:OL},{key:"Ctrl-k",run:blt},{key:"Ctrl-Alt-h",run:rle},{key:"Ctrl-o",run:klt},{key:"Ctrl-t",run:vlt},{key:"Ctrl-v",run:$L}],Flt=[{key:"ArrowLeft",run:Sce,shift:jce,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Gct,shift:tlt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Kct,shift:slt,preventDefault:!0},{key:"ArrowRight",run:Tce,shift:Gce,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:qct,shift:nlt,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Zct,shift:clt,preventDefault:!0},{key:"ArrowUp",run:Nce,shift:Hce,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Zce,shift:Jce},{mac:"Ctrl-ArrowUp",run:$ce,shift:Wce},{key:"ArrowDown",run:Mce,shift:Uce,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Vce,shift:Xce},{mac:"Ctrl-ArrowDown",run:$L,shift:Kce},{key:"PageUp",run:$ce,shift:Wce},{key:"PageDown",run:$L,shift:Kce},{key:"Home",run:Wct,shift:olt,preventDefault:!0},{key:"Mod-Home",run:Zce,shift:Jce},{key:"End",run:Yct,shift:ilt,preventDefault:!0},{key:"Mod-End",run:Vce,shift:Xce},{key:"Enter",run:sle,shift:sle},{key:"Mod-a",run:dlt},{key:"Backspace",run:OL,shift:OL,preventDefault:!0},{key:"Delete",run:nle,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:rle,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:flt,preventDefault:!0},{mac:"Mod-Backspace",run:ylt,preventDefault:!0},{mac:"Mod-Delete",run:wlt,preventDefault:!0}].concat(Tlt.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),Llt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Hct,shift:alt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Uct,shift:rlt},{key:"Alt-ArrowUp",run:Clt},{key:"Shift-Alt-ArrowUp",run:xlt},{key:"Alt-ArrowDown",run:_lt},{key:"Shift-Alt-ArrowDown",run:Elt},{key:"Mod-Alt-ArrowUp",run:Alt},{key:"Mod-Alt-ArrowDown",run:glt},{key:"Escape",run:hlt},{key:"Mod-Enter",run:Dlt},{key:"Alt-l",mac:"Ctrl-l",run:plt},{key:"Mod-i",run:mlt,preventDefault:!0},{key:"Mod-[",run:ule},{key:"Mod-]",run:lle},{key:"Mod-Alt-\\",run:Qlt},{key:"Shift-Mod-k",run:Blt},{key:"Shift-Mod-\\",run:elt},{key:"Mod-/",run:Cct},{key:"Alt-A",run:xct},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Slt}].concat(Flt),Nlt={key:"Tab",run:lle,shift:ule},dle=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class Ab{constructor(e,n,a=0,r=e.length,i,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(a,r),this.bufferStart=a,this.normalize=i?s=>i(dle(s)):dle,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return ls(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=oF(e),a=this.bufferStart+this.bufferPos;this.bufferPos+=nu(e);let r=this.normalize(n);if(r.length)for(let i=0,o=a;;i++){let s=r.charCodeAt(i),l=this.match(s,o,this.bufferPos+this.bufferStart);if(i==r.length-1){if(l)return this.value=l,this;break}o==a&&i<n.length&&n.charCodeAt(i)==s&&o++}}}match(e,n,a){let r=null;for(let i=0;i<this.matches.length;i+=2){let o=this.matches[i],s=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?r={from:this.matches[i+1],to:a}:(this.matches[i]++,s=!0)),s||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:n,to:a}:this.matches.push(1,n)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}}typeof Symbol<"u"&&(Ab.prototype[Symbol.iterator]=function(){return this});const ple={from:-1,to:-1,match:/.*/.exec("")},GL="gm"+(/x/.unicode==null?"":"u");class mle{constructor(e,n,a,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=ple,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new Ale(e,n,a,r,i);this.re=new RegExp(n,GL+(a!=null&&a.ignoreCase?"i":"")),this.test=a==null?void 0:a.test,this.iter=e.iter();let o=e.lineAt(r);this.curLineStart=o.from,this.matchPos=i3(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let a=this.curLineStart+n.index,r=a+n[0].length;if(this.matchPos=i3(this.text,r+(a==r?1:0)),a==this.curLineStart+this.curLine.length&&this.nextLine(),(a<r||a>this.value.to)&&(!this.test||this.test(a,r,n)))return this.value={from:a,to:r,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const qL=new WeakMap;class gb{constructor(e,n){this.from=e,this.text=n}get to(){return this.from+this.text.length}static get(e,n,a){let r=qL.get(e);if(!r||r.from>=a||r.to<=n){let s=new gb(n,e.sliceString(n,a));return qL.set(e,s),s}if(r.from==n&&r.to==a)return r;let{text:i,from:o}=r;return o>n&&(i=e.sliceString(n,o)+i,o=n),r.to<a&&(i+=e.sliceString(r.to,a)),qL.set(e,new gb(o,i)),new gb(n,i.slice(n-o,a-o))}}class Ale{constructor(e,n,a,r,i){this.text=e,this.to=i,this.done=!1,this.value=ple,this.matchPos=i3(e,r),this.re=new RegExp(n,GL+(a!=null&&a.ignoreCase?"i":"")),this.test=a==null?void 0:a.test,this.flat=gb.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let a=this.flat.from+n.index,r=a+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(a,r,n)))return this.value={from:a,to:r,match:n},this.matchPos=i3(this.text,r+(a==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=gb.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(mle.prototype[Symbol.iterator]=Ale.prototype[Symbol.iterator]=function(){return this});function Mlt(t){try{return new RegExp(t,GL),!0}catch{return!1}}function i3(t,e){if(e>=t.length)return e;let n=t.lineAt(e),a;for(;e<n.to&&(a=n.text.charCodeAt(e-n.from))>=56320&&a<57344;)e++;return e}function zL(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=Ea("input",{class:"cm-textfield",name:"line",value:e}),a=Ea("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),t.dispatch({effects:F1.of(!1)}),t.focus()):i.keyCode==13&&(i.preventDefault(),r())},onsubmit:i=>{i.preventDefault(),r()}},Ea("label",t.state.phrase("Go to line"),": ",n)," ",Ea("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),Ea("button",{name:"close",onclick:()=>{t.dispatch({effects:F1.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function r(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!i)return;let{state:o}=t,s=o.doc.lineAt(o.selection.main.head),[,l,u,d,p]=i,m=d?+d.slice(1):0,A=u?+u:s.number;if(u&&p){let f=A/100;l&&(f=f*(l=="-"?-1:1)+s.number/o.doc.lines),A=Math.round(o.doc.lines*f)}else u&&l&&(A=A*(l=="-"?-1:1)+s.number);let g=o.doc.line(Math.max(1,Math.min(o.doc.lines,A))),h=lt.cursor(g.from+Math.max(0,Math.min(m,g.length)));t.dispatch({effects:[F1.of(!1),Ot.scrollIntoView(h.from,{y:"center"})],selection:h}),t.focus()}return{dom:a}}const F1=Bn.define(),gle=Li.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(F1)&&(t=n.value);return t},provide:t=>v1.from(t,e=>e?zL:null)}),Rlt=t=>{let e=k1(t,zL);if(!e){let n=[F1.of(!0)];t.state.field(gle,!1)==null&&n.push(Bn.appendConfig.of([gle,Plt])),t.dispatch({effects:n}),e=k1(t,zL)}return e&&e.dom.querySelector("input").select(),!0},Plt=Ot.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),$lt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Olt=zt.define({combine(t){return iu(t,$lt,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function jlt(t){return[Ult,Hlt]}const Glt=ln.mark({class:"cm-selectionMatch"}),qlt=ln.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function hle(t,e,n,a){return(n==0||t(e.sliceDoc(n-1,n))!=Wa.Word)&&(a==e.doc.length||t(e.sliceDoc(a,a+1))!=Wa.Word)}function zlt(t,e,n,a){return t(e.sliceDoc(n,n+1))==Wa.Word&&t(e.sliceDoc(a-1,a))==Wa.Word}const Hlt=vr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Olt),{state:n}=t,a=n.selection;if(a.ranges.length>1)return ln.none;let r=a.main,i,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return ln.none;let l=n.wordAt(r.head);if(!l)return ln.none;o=n.charCategorizer(r.head),i=n.sliceDoc(l.from,l.to)}else{let l=r.to-r.from;if(l<e.minSelectionLength||l>200)return ln.none;if(e.wholeWords){if(i=n.sliceDoc(r.from,r.to),o=n.charCategorizer(r.head),!(hle(o,n,r.from,r.to)&&zlt(o,n,r.from,r.to)))return ln.none}else if(i=n.sliceDoc(r.from,r.to),!i)return ln.none}let s=[];for(let l of t.visibleRanges){let u=new Ab(n.doc,i,l.from,l.to);for(;!u.next().done;){let{from:d,to:p}=u.value;if((!o||hle(o,n,d,p))&&(r.empty&&d<=r.from&&p>=r.to?s.push(qlt.range(d,p)):(d>=r.to||p<=r.from)&&s.push(Glt.range(d,p)),s.length>e.maxMatches))return ln.none}}return ln.set(s)}},{decorations:t=>t.decorations}),Ult=Ot.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Ylt=({state:t,dispatch:e})=>{let{selection:n}=t,a=lt.create(n.ranges.map(r=>t.wordAt(r.head)||lt.cursor(r.head)),n.mainIndex);return a.eq(n)?!1:(e(t.update({selection:a})),!0)};function Wlt(t,e){let{main:n,ranges:a}=t.selection,r=t.wordAt(n.head),i=r&&r.from==n.from&&r.to==n.to;for(let o=!1,s=new Ab(t.doc,e,a[a.length-1].to);;)if(s.next(),s.done){if(o)return null;s=new Ab(t.doc,e,0,Math.max(0,a[a.length-1].from-1)),o=!0}else{if(o&&a.some(l=>l.from==s.value.from))continue;if(i){let l=t.wordAt(s.value.from);if(!l||l.from!=s.value.from||l.to!=s.value.to)continue}return s.value}}const Klt=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return Ylt({state:t,dispatch:e});let a=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=a))return!1;let r=Wlt(t,a);return r?(e(t.update({selection:t.selection.addRange(lt.range(r.from,r.to),!1),effects:Ot.scrollIntoView(r.to)})),!0):!1},hb=zt.define({combine(t){return iu(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new sut(e),scrollToMatch:e=>Ot.scrollIntoView(e)})}});class fle{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Mlt(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,a)=>a=="n"?`
|
|
1361
|
-
`:a=="r"?"\r":a=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new Xlt(this):new Vlt(this)}getCursor(e,n=0,a){let r=e.doc?e:Hn.create({doc:e});return a==null&&(a=r.doc.length),this.regexp?bb(this,r,n,a):fb(this,r,n,a)}}class ble{constructor(e){this.spec=e}}function fb(t,e,n,a){return new Ab(e.doc,t.unquoted,n,a,t.caseSensitive?void 0:r=>r.toLowerCase(),t.wholeWord?Zlt(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function Zlt(t,e){return(n,a,r,i)=>((i>n||i+r.length<a)&&(i=Math.max(0,n-2),r=t.sliceString(i,Math.min(t.length,a+2))),(e(o3(r,n-i))!=Wa.Word||e(s3(r,n-i))!=Wa.Word)&&(e(s3(r,a-i))!=Wa.Word||e(o3(r,a-i))!=Wa.Word))}class Vlt extends ble{constructor(e){super(e)}nextMatch(e,n,a){let r=fb(this.spec,e,a,e.doc.length).nextOverlapping();if(r.done){let i=Math.min(e.doc.length,n+this.spec.unquoted.length);r=fb(this.spec,e,0,i).nextOverlapping()}return r.done||r.value.from==n&&r.value.to==a?null:r.value}prevMatchInRange(e,n,a){for(let r=a;;){let i=Math.max(n,r-1e4-this.spec.unquoted.length),o=fb(this.spec,e,i,r),s=null;for(;!o.nextOverlapping().done;)s=o.value;if(s)return s;if(i==n)return null;r-=1e4}}prevMatch(e,n,a){let r=this.prevMatchInRange(e,0,n);return r||(r=this.prevMatchInRange(e,Math.max(0,a-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=n||r.to!=a)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let a=fb(this.spec,e,0,e.doc.length),r=[];for(;!a.next().done;){if(r.length>=n)return null;r.push(a.value)}return r}highlight(e,n,a,r){let i=fb(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(a+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}function bb(t,e,n,a){return new mle(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?Jlt(e.charCategorizer(e.selection.main.head)):void 0},n,a)}function o3(t,e){return t.slice(Fi(t,e,!1),e)}function s3(t,e){return t.slice(e,Fi(t,e))}function Jlt(t){return(e,n,a)=>!a[0].length||(t(o3(a.input,a.index))!=Wa.Word||t(s3(a.input,a.index))!=Wa.Word)&&(t(s3(a.input,a.index+a[0].length))!=Wa.Word||t(o3(a.input,a.index+a[0].length))!=Wa.Word)}class Xlt extends ble{nextMatch(e,n,a){let r=bb(this.spec,e,a,e.doc.length).next();return r.done&&(r=bb(this.spec,e,0,n).next()),r.done?null:r.value}prevMatchInRange(e,n,a){for(let r=1;;r++){let i=Math.max(n,a-r*1e4),o=bb(this.spec,e,i,a),s=null;for(;!o.next().done;)s=o.value;if(s&&(i==n||s.from>i+10))return s;if(i==n)return null}}prevMatch(e,n,a){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,a,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,a)=>{if(a=="&")return e.match[0];if(a=="$")return"$";for(let r=a.length;r>0;r--){let i=+a.slice(0,r);if(i>0&&i<e.match.length)return e.match[i]+a.slice(r)}return n})}matchAll(e,n){let a=bb(this.spec,e,0,e.doc.length),r=[];for(;!a.next().done;){if(r.length>=n)return null;r.push(a.value)}return r}highlight(e,n,a,r){let i=bb(this.spec,e,Math.max(0,n-250),Math.min(a+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}const L1=Bn.define(),HL=Bn.define(),sm=Li.define({create(t){return new UL(WL(t).create(),null)},update(t,e){for(let n of e.effects)n.is(L1)?t=new UL(n.value.create(),t.panel):n.is(HL)&&(t=new UL(t.query,n.value?YL:null));return t},provide:t=>v1.from(t,e=>e.panel)});class UL{constructor(e,n){this.query=e,this.panel=n}}const eut=ln.mark({class:"cm-searchMatch"}),tut=ln.mark({class:"cm-searchMatch cm-searchMatch-selected"}),nut=vr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(sm))}update(t){let e=t.state.field(sm);(e!=t.startState.field(sm)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ln.none;let{view:n}=this,a=new kd;for(let r=0,i=n.visibleRanges,o=i.length;r<o;r++){let{from:s,to:l}=i[r];for(;r<o-1&&l>i[r+1].from-2*250;)l=i[++r].to;t.highlight(n.state,s,l,(u,d)=>{let p=n.state.selection.ranges.some(m=>m.from==u&&m.to==d);a.add(u,d,p?tut:eut)})}return a.finish()}},{decorations:t=>t.decorations});function N1(t){return e=>{let n=e.state.field(sm,!1);return n&&n.query.spec.valid?t(e,n):vle(e)}}const c3=N1((t,{query:e})=>{let{to:n}=t.state.selection.main,a=e.nextMatch(t.state,n,n);if(!a)return!1;let r=lt.single(a.from,a.to),i=t.state.facet(hb);return t.dispatch({selection:r,effects:[KL(t,a),i.scrollToMatch(r.main,t)],userEvent:"select.search"}),kle(t),!0}),l3=N1((t,{query:e})=>{let{state:n}=t,{from:a}=n.selection.main,r=e.prevMatch(n,a,a);if(!r)return!1;let i=lt.single(r.from,r.to),o=t.state.facet(hb);return t.dispatch({selection:i,effects:[KL(t,r),o.scrollToMatch(i.main,t)],userEvent:"select.search"}),kle(t),!0}),aut=N1((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:lt.create(n.map(a=>lt.range(a.from,a.to))),userEvent:"select.search.matches"}),!0)}),rut=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:a,to:r}=n.main,i=[],o=0;for(let s=new Ab(t.doc,t.sliceDoc(a,r));!s.next().done;){if(i.length>1e3)return!1;s.value.from==a&&(o=i.length),i.push(lt.range(s.value.from,s.value.to))}return e(t.update({selection:lt.create(i,o),userEvent:"select.search.matches"})),!0},yle=N1((t,{query:e})=>{let{state:n}=t,{from:a,to:r}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,a,a);if(!i)return!1;let o=i,s=[],l,u,d=[];o.from==a&&o.to==r&&(u=n.toText(e.getReplacement(o)),s.push({from:o.from,to:o.to,insert:u}),o=e.nextMatch(n,o.from,o.to),d.push(Ot.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(a).number)+".")));let p=t.state.changes(s);return o&&(l=lt.single(o.from,o.to).map(p),d.push(KL(t,o)),d.push(n.facet(hb).scrollToMatch(l.main,t))),t.dispatch({changes:p,selection:l,effects:d,userEvent:"input.replace"}),!0}),iut=N1((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(r=>{let{from:i,to:o}=r;return{from:i,to:o,insert:e.getReplacement(r)}});if(!n.length)return!1;let a=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:Ot.announce.of(a),userEvent:"input.replace.all"}),!0});function YL(t){return t.state.facet(hb).createPanel(t)}function WL(t,e){var n,a,r,i,o;let s=t.selection.main,l=s.empty||s.to>s.from+100?"":t.sliceDoc(s.from,s.to);if(e&&!l)return e;let u=t.facet(hb);return new fle({search:((n=e==null?void 0:e.literal)!==null&&n!==void 0?n:u.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(a=e==null?void 0:e.caseSensitive)!==null&&a!==void 0?a:u.caseSensitive,literal:(r=e==null?void 0:e.literal)!==null&&r!==void 0?r:u.literal,regexp:(i=e==null?void 0:e.regexp)!==null&&i!==void 0?i:u.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:u.wholeWord})}function wle(t){let e=k1(t,YL);return e&&e.dom.querySelector("[main-field]")}function kle(t){let e=wle(t);e&&e==t.root.activeElement&&e.select()}const vle=t=>{let e=t.state.field(sm,!1);if(e&&e.panel){let n=wle(t);if(n&&n!=t.root.activeElement){let a=WL(t.state,e.query.spec);a.valid&&t.dispatch({effects:L1.of(a)}),n.focus(),n.select()}}else t.dispatch({effects:[HL.of(!0),e?L1.of(WL(t.state,e.query.spec)):Bn.appendConfig.of(lut)]});return!0},Cle=t=>{let e=t.state.field(sm,!1);if(!e||!e.panel)return!1;let n=k1(t,YL);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:HL.of(!1)}),!0},out=[{key:"Mod-f",run:vle,scope:"editor search-panel"},{key:"F3",run:c3,shift:l3,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:c3,shift:l3,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Cle,scope:"editor search-panel"},{key:"Mod-Shift-l",run:rut},{key:"Mod-Alt-g",run:Rlt},{key:"Mod-d",run:Klt,preventDefault:!0}];class sut{constructor(e){this.view=e;let n=this.query=e.state.field(sm).query.spec;this.commit=this.commit.bind(this),this.searchField=Ea("input",{value:n.search,placeholder:$s(e,"Find"),"aria-label":$s(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ea("input",{value:n.replace,placeholder:$s(e,"Replace"),"aria-label":$s(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ea("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Ea("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Ea("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function a(r,i,o){return Ea("button",{class:"cm-button",name:r,onclick:i,type:"button"},o)}this.dom=Ea("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,a("next",()=>c3(e),[$s(e,"next")]),a("prev",()=>l3(e),[$s(e,"previous")]),a("select",()=>aut(e),[$s(e,"all")]),Ea("label",null,[this.caseField,$s(e,"match case")]),Ea("label",null,[this.reField,$s(e,"regexp")]),Ea("label",null,[this.wordField,$s(e,"by word")]),...e.state.readOnly?[]:[Ea("br"),this.replaceField,a("replace",()=>yle(e),[$s(e,"replace")]),a("replaceAll",()=>iut(e),[$s(e,"replace all")])],Ea("button",{name:"close",onclick:()=>Cle(e),"aria-label":$s(e,"close"),type:"button"},["×"])])}commit(){let e=new fle({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:L1.of(e)}))}keydown(e){hot(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?l3:c3)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),yle(this.view))}update(e){for(let n of e.transactions)for(let a of n.effects)a.is(L1)&&!a.value.eq(this.query)&&this.setQuery(a.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(hb).top}}function $s(t,e){return t.state.phrase(e)}const u3=30,d3=/[\s\.,:;?!]/;function KL(t,{from:e,to:n}){let a=t.state.doc.lineAt(e),r=t.state.doc.lineAt(n).to,i=Math.max(a.from,e-u3),o=Math.min(r,n+u3),s=t.state.sliceDoc(i,o);if(i!=a.from){for(let l=0;l<u3;l++)if(!d3.test(s[l+1])&&d3.test(s[l])){s=s.slice(l);break}}if(o!=r){for(let l=s.length-1;l>s.length-u3;l--)if(!d3.test(s[l-1])&&d3.test(s[l])){s=s.slice(0,l);break}}return Ot.announce.of(`${t.state.phrase("current match")}. ${s} ${t.state.phrase("on line")} ${a.number}.`)}const cut=Ot.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),lut=[sm,ag.low(nut),cut];class _le{constructor(e,n,a,r){this.state=e,this.pos=n,this.explicit=a,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=ro(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),a=Math.max(n.from,this.pos-250),r=n.text.slice(a-n.from,this.pos-n.from),i=r.search(Ble(e,!1));return i<0?null:{from:a+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,a){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),a&&a.onDocChange&&(this.abortOnDocChange=!0))}}function xle(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function uut(t){let e=Object.create(null),n=Object.create(null);for(let{label:r}of t){e[r[0]]=!0;for(let i=1;i<r.length;i++)n[r[i]]=!0}let a=xle(e)+xle(n)+"*$";return[new RegExp("^"+a),new RegExp(a)]}function dut(t){let e=t.map(r=>typeof r=="string"?{label:r}:r),[n,a]=e.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:uut(e);return r=>{let i=r.matchBefore(a);return i||r.explicit?{from:i?i.from:r.pos,options:e,validFor:n}:null}}let Ele=class{constructor(e,n,a,r){this.completion=e,this.source=n,this.match=a,this.score=r}};function pg(t){return t.selection.main.from}function Ble(t,e){var n;let{source:a}=t,r=e&&a[0]!="^",i=a[a.length-1]!="$";return!r&&!i?t:new RegExp(`${r?"^":""}(?:${a})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const Ile=ru.define();function put(t,e,n,a){let{main:r}=t.selection,i=n-r.from,o=a-r.from;return{...t.changeByRange(s=>{if(s!=r&&n!=a&&t.sliceDoc(s.from+i,s.from+o)!=t.sliceDoc(n,a))return{range:s};let l=t.toText(e);return{changes:{from:s.from+i,to:a==r.from?s.to:s.from+o,insert:l},range:lt.cursor(s.from+i+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Dle=new WeakMap;function mut(t){if(!Array.isArray(t))return t;let e=Dle.get(t);return e||Dle.set(t,e=dut(t)),e}const p3=Bn.define(),M1=Bn.define();class Aut{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let a=ls(e,n),r=nu(a);this.chars.push(a);let i=e.slice(n,n+r),o=i.toUpperCase();this.folded.push(ls(o==i?i.toLowerCase():o,0)),n+=r}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:a,any:r,precise:i,byWord:o}=this;if(n.length==1){let y=ls(e,0),w=nu(y),k=w==e.length?0:-100;if(y!=n[0])if(y==a[0])k+=-200;else return null;return this.ret(k,[0,w])}let s=e.indexOf(this.pattern);if(s==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,u=0;if(s<0){for(let y=0,w=Math.min(e.length,200);y<w&&u<l;){let k=ls(e,y);(k==n[u]||k==a[u])&&(r[u++]=y),y+=nu(k)}if(u<l)return null}let d=0,p=0,m=!1,A=0,g=-1,h=-1,f=/[a-z]/.test(e),b=!0;for(let y=0,w=Math.min(e.length,200),k=0;y<w&&p<l;){let C=ls(e,y);s<0&&(d<l&&C==n[d]&&(i[d++]=y),A<l&&(C==n[A]||C==a[A]?(A==0&&(g=y),h=y+1,A++):A=0));let x,_=C<255?C>=48&&C<=57||C>=97&&C<=122?2:C>=65&&C<=90?1:0:(x=oF(C))!=x.toLowerCase()?1:x!=x.toUpperCase()?2:0;(!y||_==1&&f||k==0&&_!=0)&&(n[p]==C||a[p]==C&&(m=!0)?o[p++]=y:o.length&&(b=!1)),k=_,y+=nu(C)}return p==l&&o[0]==0&&b?this.result(-100+(m?-200:0),o,e):A==l&&g==0?this.ret(-200-e.length+(h==e.length?0:-100),[0,h]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):A==l?this.ret(-900-e.length,[g,h]):p==l?this.result(-100+(m?-200:0)+-700+(b?0:-1100),o,e):n.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,n,a){let r=[],i=0;for(let o of n){let s=o+(this.astral?nu(ls(a,o)):1);i&&r[i-1]==o?r[i-1]=s:(r[i++]=o,r[i++]=s)}return this.ret(e-a.length,r)}}class gut{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),a=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return a==null?null:(this.matched=[0,n.length],this.score=a+(e.length==this.pattern.length?0:-100),this)}}const yi=zt.define({combine(t){return iu(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:hut,filterStrict:!1,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>a=>Qle(e(a),n(a)),optionClass:(e,n)=>a=>Qle(e(a),n(a)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function Qle(t,e){return t?e?t+" "+e:t:e}function hut(t,e,n,a,r,i){let o=t.textDirection==Ra.RTL,s=o,l=!1,u="top",d,p,m=e.left-r.left,A=r.right-e.right,g=a.right-a.left,h=a.bottom-a.top;if(s&&m<Math.min(g,A)?s=!1:!s&&A<Math.min(g,m)&&(s=!0),g<=(s?m:A))d=Math.max(r.top,Math.min(n.top,r.bottom-h))-e.top,p=Math.min(400,s?m:A);else{l=!0,p=Math.min(400,(o?e.right:r.right-e.left)-30);let y=r.bottom-e.bottom;y>=h||y>e.top?d=n.bottom-e.top:(u="bottom",d=e.bottom-n.top)}let f=(e.bottom-e.top)/i.offsetHeight,b=(e.right-e.left)/i.offsetWidth;return{style:`${u}: ${d/f}px; max-width: ${p/b}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":s?"left":"right")}}function fut(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let a=document.createElement("div");return a.classList.add("cm-completionIcon"),n.type&&a.classList.add(...n.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),a.setAttribute("aria-hidden","true"),a},position:20}),e.push({render(n,a,r,i){let o=document.createElement("span");o.className="cm-completionLabel";let s=n.displayLabel||n.label,l=0;for(let u=0;u<i.length;){let d=i[u++],p=i[u++];d>l&&o.appendChild(document.createTextNode(s.slice(l,d)));let m=o.appendChild(document.createElement("span"));m.appendChild(document.createTextNode(s.slice(d,p))),m.className="cm-completionMatchedText",l=p}return l<s.length&&o.appendChild(document.createTextNode(s.slice(l))),o},position:50},{render(n){if(!n.detail)return null;let a=document.createElement("span");return a.className="cm-completionDetail",a.textContent=n.detail,a},position:80}),e.sort((n,a)=>n.position-a.position).map(n=>n.render)}function ZL(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let r=Math.floor(e/n);return{from:r*n,to:(r+1)*n}}let a=Math.floor((t-e)/n);return{from:t-(a+1)*n,to:t-a*n}}class but{constructor(e,n,a){this.view=e,this.stateField=n,this.applyCompletion=a,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let r=e.state.field(n),{options:i,selected:o}=r.open,s=e.state.facet(yi);this.optionContent=fut(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=ZL(i.length,o,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:u}=e.state.field(n).open;for(let d=l.target,p;d&&d!=this.dom;d=d.parentNode)if(d.nodeName=="LI"&&(p=/-(\d+)$/.exec(d.id))&&+p[1]<u.length){this.applyCompletion(e,u[+p[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let u=e.state.field(this.stateField,!1);u&&u.tooltip&&e.state.facet(yi).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:M1.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let a=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),a!=r){let{options:i,selected:o,disabled:s}=a.open;(!r.open||r.open.options!=i)&&(this.range=ZL(i.length,o,e.state.facet(yi).maxRenderedOptions),this.showOptions(i,a.id)),this.updateSel(),s!=((n=r.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let a of this.currentClass.split(" "))a&&this.dom.classList.remove(a);for(let a of n.split(" "))a&&this.dom.classList.add(a);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=ZL(n.options.length,n.selected,this.view.state.facet(yi).maxRenderedOptions),this.showOptions(n.options,e.id));let a=this.updateSelectedOption(n.selected);if(a){this.destroyInfo();let{completion:r}=n.options[n.selected],{info:i}=r;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(r);if(!o)return;"then"in o?o.then(s=>{s&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(s,r)}).catch(s=>us(this.view.state,s,"completion info")):(this.addInfoPane(o,r),a.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let a=this.info=document.createElement("div");if(a.className="cm-tooltip cm-completionInfo",a.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)a.appendChild(e),this.infoDestroy=null;else{let{dom:r,destroy:i}=e;a.appendChild(r),this.infoDestroy=i||null}this.dom.appendChild(a),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let a=this.list.firstChild,r=this.range.from;a;a=a.nextSibling,r++)a.nodeName!="LI"||!a.id?r--:r==e?a.hasAttribute("aria-selected")||(a.setAttribute("aria-selected","true"),n=a):a.hasAttribute("aria-selected")&&(a.removeAttribute("aria-selected"),a.removeAttribute("aria-describedby"));return n&&wut(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),a=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let o=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return r.top>Math.min(i.bottom,n.bottom)-10||r.bottom<Math.max(i.top,n.top)+10?null:this.view.state.facet(yi).positionInfo(this.view,n,r,a,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,n,a){const r=document.createElement("ul");r.id=n,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),r.addEventListener("mousedown",o=>{o.target==r&&o.preventDefault()});let i=null;for(let o=a.from;o<a.to;o++){let{completion:s,match:l}=e[o],{section:u}=s;if(u){let m=typeof u=="string"?u:u.name;if(m!=i&&(o>a.from||a.from==0))if(i=m,typeof u!="string"&&u.header)r.appendChild(u.header(u));else{let A=r.appendChild(document.createElement("completion-section"));A.textContent=m}}const d=r.appendChild(document.createElement("li"));d.id=n+"-"+o,d.setAttribute("role","option");let p=this.optionClass(s);p&&(d.className=p);for(let m of this.optionContent){let A=m(s,this.view.state,this.view,l);A&&d.appendChild(A)}}return a.from&&r.classList.add("cm-completionListIncompleteTop"),a.to<e.length&&r.classList.add("cm-completionListIncompleteBottom"),r}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function yut(t,e){return n=>new but(n,t,e)}function wut(t,e){let n=t.getBoundingClientRect(),a=e.getBoundingClientRect(),r=n.height/t.offsetHeight;a.top<n.top?t.scrollTop-=(n.top-a.top)/r:a.bottom>n.bottom&&(t.scrollTop+=(a.bottom-n.bottom)/r)}function Sle(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function kut(t,e){let n=[],a=null,r=null,i=d=>{n.push(d);let{section:p}=d.completion;if(p){a||(a=[]);let m=typeof p=="string"?p:p.name;a.some(A=>A.name==m)||a.push(typeof p=="string"?{name:m}:p)}},o=e.facet(yi);for(let d of t)if(d.hasResult()){let p=d.result.getMatch;if(d.result.filter===!1)for(let m of d.result.options)i(new Ele(m,d.source,p?p(m):[],1e9-n.length));else{let m=e.sliceDoc(d.from,d.to),A,g=o.filterStrict?new gut(m):new Aut(m);for(let h of d.result.options)if(A=g.match(h.label)){let f=h.displayLabel?p?p(h,A.matched):[]:A.matched,b=A.score+(h.boost||0);if(i(new Ele(h,d.source,f,b)),typeof h.section=="object"&&h.section.rank==="dynamic"){let{name:y}=h.section;r||(r=Object.create(null)),r[y]=Math.max(b,r[y]||-1e9)}}}}if(a){let d=Object.create(null),p=0,m=(A,g)=>(A.rank==="dynamic"&&g.rank==="dynamic"?r[g.name]-r[A.name]:0)||(typeof A.rank=="number"?A.rank:1e9)-(typeof g.rank=="number"?g.rank:1e9)||(A.name<g.name?-1:1);for(let A of a.sort(m))p-=1e5,d[A.name]=p;for(let A of n){let{section:g}=A.completion;g&&(A.score+=d[typeof g=="string"?g:g.name])}}let s=[],l=null,u=o.compareCompletions;for(let d of n.sort((p,m)=>m.score-p.score||u(p.completion,m.completion))){let p=d.completion;!l||l.label!=p.label||l.detail!=p.detail||l.type!=null&&p.type!=null&&l.type!=p.type||l.apply!=p.apply||l.boost!=p.boost?s.push(d):Sle(d.completion)>Sle(l)&&(s[s.length-1]=d),l=d.completion}return s}class yb{constructor(e,n,a,r,i,o){this.options=e,this.attrs=n,this.tooltip=a,this.timestamp=r,this.selected=i,this.disabled=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new yb(this.options,Tle(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,a,r,i,o){if(r&&!o&&e.some(u=>u.isPending))return r.setDisabled();let s=kut(e,n);if(!s.length)return r&&e.some(u=>u.isPending)?r.setDisabled():null;let l=n.facet(yi).selectOnOpen?0:-1;if(r&&r.selected!=l&&r.selected!=-1){let u=r.options[r.selected].completion;for(let d=0;d<s.length;d++)if(s[d].completion==u){l=d;break}}return new yb(s,Tle(a,l),{pos:e.reduce((u,d)=>d.hasResult()?Math.min(u,d.from):u,1e8),create:But,above:i.aboveCursor},r?r.timestamp:Date.now(),l,!1)}map(e){return new yb(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new yb(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class m3{constructor(e,n,a){this.active=e,this.id=n,this.open=a}static start(){return new m3(xut,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,a=n.facet(yi),i=(a.override||n.languageDataAt("autocomplete",pg(n)).map(mut)).map(l=>(this.active.find(d=>d.source==l)||new Cc(l,this.active.some(d=>d.state!=0)?1:0)).update(e,a));i.length==this.active.length&&i.every((l,u)=>l==this.active[u])&&(i=this.active);let o=this.open,s=e.effects.some(l=>l.is(VL));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||i.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!vut(i,this.active)||s?o=yb.build(i,n,this.id,o,a,s):o&&o.disabled&&!i.some(l=>l.isPending)&&(o=null),!o&&i.every(l=>!l.isPending)&&i.some(l=>l.hasResult())&&(i=i.map(l=>l.hasResult()?new Cc(l.source,0):l));for(let l of e.effects)l.is(Lle)&&(o=o&&o.setSelected(l.value,this.id));return i==this.active&&o==this.open?this:new m3(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Cut:_ut}}function vut(t,e){if(t==e)return!0;for(let n=0,a=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;a<e.length&&!e[a].hasResult();)a++;let r=n==t.length,i=a==e.length;if(r||i)return r==i;if(t[n++].result!=e[a++].result)return!1}}const Cut={"aria-autocomplete":"list"},_ut={};function Tle(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const xut=[];function Fle(t,e){if(t.isUserEvent("input.complete")){let a=t.annotation(Ile);if(a&&e.activateOnCompletion(a))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Cc{constructor(e,n,a=!1){this.source=e,this.state=n,this.explicit=a}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let a=Fle(e,n),r=this;(a&8||a&16&&this.touches(e))&&(r=new Cc(r.source,0)),a&4&&r.state==0&&(r=new Cc(this.source,1)),r=r.updateFor(e,a);for(let i of e.effects)if(i.is(p3))r=new Cc(r.source,1,i.value);else if(i.is(M1))r=new Cc(r.source,0);else if(i.is(VL))for(let o of i.value)o.source==r.source&&(r=o);return r}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(pg(e.state))}}class wb extends Cc{constructor(e,n,a,r,i,o){super(e,3,n),this.limit=a,this.result=r,this.from=i,this.to=o}hasResult(){return!0}updateFor(e,n){var a;if(!(n&3))return this.map(e.changes);let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let i=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),s=pg(e.state);if(s>o||!r||n&2&&(pg(e.startState)==this.from||s<this.limit))return new Cc(this.source,n&4?1:0);let l=e.changes.mapPos(this.limit);return Eut(r.validFor,e.state,i,o)?new wb(this.source,this.explicit,l,r,i,o):r.update&&(r=r.update(r,i,o,new _le(e.state,s,!1)))?new wb(this.source,this.explicit,l,r,r.from,(a=r.to)!==null&&a!==void 0?a:pg(e.state)):new Cc(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new wb(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Cc(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function Eut(t,e,n,a){if(!t)return!1;let r=e.sliceDoc(n,a);return typeof t=="function"?t(r,n,a,e):Ble(t,!0).test(r)}const VL=Bn.define({map(t,e){return t.map(n=>n.map(e))}}),Lle=Bn.define(),ms=Li.define({create(){return m3.start()},update(t,e){return t.update(e)},provide:t=>[dL.from(t,e=>e.tooltip),Ot.contentAttributes.from(t,e=>e.attrs)]});function JL(t,e){const n=e.completion.apply||e.completion.label;let a=t.state.field(ms).active.find(r=>r.source==e.source);return a instanceof wb?(typeof n=="string"?t.dispatch({...put(t.state,n,a.from,a.to),annotations:Ile.of(e.completion)}):n(t,e.completion,a.from,a.to),!0):!1}const But=yut(ms,JL);function A3(t,e="option"){return n=>{let a=n.state.field(ms,!1);if(!a||!a.open||a.open.disabled||Date.now()-a.open.timestamp<n.state.facet(yi).interactionDelay)return!1;let r=1,i;e=="page"&&(i=Sse(n,a.open.tooltip))&&(r=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:o}=a.open.options,s=a.open.selected>-1?a.open.selected+r*(t?1:-1):t?0:o-1;return s<0?s=e=="page"?0:o-1:s>=o&&(s=e=="page"?o-1:0),n.dispatch({effects:Lle.of(s)}),!0}}const Iut=t=>{let e=t.state.field(ms,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(yi).interactionDelay?!1:JL(t,e.open.options[e.open.selected])},XL=t=>t.state.field(ms,!1)?(t.dispatch({effects:p3.of(!0)}),!0):!1,Dut=t=>{let e=t.state.field(ms,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:M1.of(null)}),!0)};class Qut{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const Sut=50,Tut=1e3,Fut=vr.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(ms).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(ms),n=t.state.facet(yi);if(!t.selectionSet&&!t.docChanged&&t.startState.field(ms)==e)return;let a=t.transactions.some(i=>{let o=Fle(i,n);return o&8||(i.selection||i.docChanged)&&!(o&3)});for(let i=0;i<this.running.length;i++){let o=this.running[i];if(a||o.context.abortOnDocChange&&t.docChanged||o.updates.length+t.transactions.length>Sut&&Date.now()-o.time>Tut){for(let s of o.context.abortListeners)try{s()}catch(l){us(this.view.state,l)}o.context.abortListeners=null,this.running.splice(i--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(o=>o.is(p3)))&&(this.pendingStart=!0);let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(o=>o.active.source==i.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(ms);for(let n of e.active)n.isPending&&!this.running.some(a=>a.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(yi).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=pg(e),a=new _le(e,n,t.explicit,this.view),r=new Qut(t,a);this.running.push(r),Promise.resolve(t.source(a)).then(i=>{r.context.aborted||(r.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:M1.of(null)}),us(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(yi).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(yi),a=this.view.state.field(ms);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let s=pg(i.updates.length?i.updates[0].startState:this.view.state),l=Math.min(s,i.done.from+(i.active.explicit?0:1)),u=new wb(i.active.source,i.active.explicit,l,i.done,i.done.from,(t=i.done.to)!==null&&t!==void 0?t:s);for(let d of i.updates)u=u.update(d,n);if(u.hasResult()){e.push(u);continue}}let o=a.active.find(s=>s.source==i.active.source);if(o&&o.isPending)if(i.done==null){let s=new Cc(i.active.source,0);for(let l of i.updates)s=s.update(l,n);s.isPending||e.push(s)}else this.startQuery(o)}(e.length||a.open&&a.open.disabled)&&this.view.dispatch({effects:VL.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(ms,!1);if(e&&e.tooltip&&this.view.state.facet(yi).closeOnBlur){let n=e.open&&Sse(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:M1.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:p3.of(!1)}),20),this.composing=0}}}),Lut=typeof navigator=="object"&&/Win/.test(navigator.platform),Nut=ag.highest(Ot.domEventHandlers({keydown(t,e){let n=e.state.field(ms,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(Lut&&t.altKey)||t.metaKey)return!1;let a=n.open.options[n.open.selected],r=n.active.find(o=>o.source==a.source),i=a.completion.commitCharacters||r.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&JL(e,a),!1}})),Mut=Ot.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),R1={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},mg=Bn.define({map(t,e){let n=e.mapPos(t,-1,Lo.TrackAfter);return n??void 0}}),eN=new class extends rg{};eN.startSide=1,eN.endSide=-1;const Nle=Li.define({create(){return ta.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:a=>a>=n.from&&a<=n.to})}for(let n of e.effects)n.is(mg)&&(t=t.update({add:[eN.range(n.value,n.value+1)]}));return t}});function Rut(){return[$ut,Nle]}const tN="()[]{}<>«»»«[]{}";function Mle(t){for(let e=0;e<tN.length;e+=2)if(tN.charCodeAt(e)==t)return tN.charAt(e+1);return oF(t<128?t:t+1)}function Rle(t,e){return t.languageDataAt("closeBrackets",e)[0]||R1}const Put=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),$ut=Ot.inputHandler.of((t,e,n,a)=>{if((Put?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let r=t.state.selection.main;if(a.length>2||a.length==2&&nu(ls(a,0))==1||e!=r.from||n!=r.to)return!1;let i=jut(t.state,a);return i?(t.dispatch(i),!0):!1}),Out=[{key:"Backspace",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let a=Rle(t,t.selection.main.head).brackets||R1.brackets,r=null,i=t.changeByRange(o=>{if(o.empty){let s=Gut(t.doc,o.head);for(let l of a)if(l==s&&g3(t.doc,o.head)==Mle(ls(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:lt.cursor(o.head-l.length)}}return{range:r=o}});return r||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!r}}];function jut(t,e){let n=Rle(t,t.selection.main.head),a=n.brackets||R1.brackets;for(let r of a){let i=Mle(ls(r,0));if(e==r)return i==r?Hut(t,r,a.indexOf(r+r+r)>-1,n):qut(t,r,i,n.before||R1.before);if(e==i&&Ple(t,t.selection.main.from))return zut(t,r,i)}return null}function Ple(t,e){let n=!1;return t.field(Nle).between(0,t.doc.length,a=>{a==e&&(n=!0)}),n}function g3(t,e){let n=t.sliceString(e,e+2);return n.slice(0,nu(ls(n,0)))}function Gut(t,e){let n=t.sliceString(e-2,e);return nu(ls(n,0))==n.length?n:n.slice(1)}function qut(t,e,n,a){let r=null,i=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:mg.of(o.to+e.length),range:lt.range(o.anchor+e.length,o.head+e.length)};let s=g3(t.doc,o.head);return!s||/\s/.test(s)||a.indexOf(s)>-1?{changes:{insert:e+n,from:o.head},effects:mg.of(o.head+e.length),range:lt.cursor(o.head+e.length)}:{range:r=o}});return r?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function zut(t,e,n){let a=null,r=t.changeByRange(i=>i.empty&&g3(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:lt.cursor(i.head+n.length)}:a={range:i});return a?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Hut(t,e,n,a){let r=a.stringPrefixes||R1.stringPrefixes,i=null,o=t.changeByRange(s=>{if(!s.empty)return{changes:[{insert:e,from:s.from},{insert:e,from:s.to}],effects:mg.of(s.to+e.length),range:lt.range(s.anchor+e.length,s.head+e.length)};let l=s.head,u=g3(t.doc,l),d;if(u==e){if($le(t,l))return{changes:{insert:e+e,from:l},effects:mg.of(l+e.length),range:lt.cursor(l+e.length)};if(Ple(t,l)){let m=n&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+m.length,insert:m},range:lt.cursor(l+m.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(d=Ole(t,l-2*e.length,r))>-1&&$le(t,d))return{changes:{insert:e+e+e+e,from:l},effects:mg.of(l+e.length),range:lt.cursor(l+e.length)};if(t.charCategorizer(l)(u)!=Wa.Word&&Ole(t,l,r)>-1&&!Uut(t,l,e,r))return{changes:{insert:e+e,from:l},effects:mg.of(l+e.length),range:lt.cursor(l+e.length)}}return{range:i=s}});return i?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function $le(t,e){let n=ro(t).resolveInner(e+1);return n.parent&&n.from==e}function Uut(t,e,n,a){let r=ro(t).resolveInner(e,-1),i=a.reduce((o,s)=>Math.max(o,s.length),0);for(let o=0;o<5;o++){let s=t.sliceDoc(r.from,Math.min(r.to,r.from+n.length+i)),l=s.indexOf(n);if(!l||l>-1&&a.indexOf(s.slice(0,l))>-1){let d=r.firstChild;for(;d&&d.from==r.from&&d.to-d.from>n.length+l;){if(t.sliceDoc(d.to-n.length,d.to)==n)return!1;d=d.firstChild}return!0}let u=r.to==e&&r.parent;if(!u)break;r=u}return!1}function Ole(t,e,n){let a=t.charCategorizer(e);if(a(t.sliceDoc(e-1,e))!=Wa.Word)return e;for(let r of n){let i=e-r.length;if(t.sliceDoc(i,e)==r&&a(t.sliceDoc(i-1,i))!=Wa.Word)return i}return-1}function Yut(t={}){return[Nut,ms,yi.of(t),Fut,Wut,Mut]}const jle=[{key:"Ctrl-Space",run:XL},{mac:"Alt-`",run:XL},{mac:"Alt-i",run:XL},{key:"Escape",run:Dut},{key:"ArrowDown",run:A3(!0)},{key:"ArrowUp",run:A3(!1)},{key:"PageDown",run:A3(!0,"page")},{key:"PageUp",run:A3(!1,"page")},{key:"Enter",run:Iut}],Wut=ag.highest(Q2.computeN([yi],t=>t.facet(yi).defaultKeymap?[jle]:[]));class Gle{constructor(e,n,a){this.from=e,this.to=n,this.diagnostic=a}}class Ag{constructor(e,n,a){this.diagnostics=e,this.panel=n,this.selected=a}static init(e,n,a){let r=a.facet(P1).markerFilter;r&&(e=r(e,a));let i=e.slice().sort((A,g)=>A.from-g.from||A.to-g.to),o=new kd,s=[],l=0,u=a.doc.iter(),d=0,p=a.doc.length;for(let A=0;;){let g=A==i.length?null:i[A];if(!g&&!s.length)break;let h,f;if(s.length)h=l,f=s.reduce((w,k)=>Math.min(w,k.to),g&&g.from>h?g.from:1e8);else{if(h=g.from,h>p)break;f=g.to,s.push(g),A++}for(;A<i.length;){let w=i[A];if(w.from==h&&(w.to>w.from||w.to==h))s.push(w),A++,f=Math.min(w.to,f);else{f=Math.min(w.from,f);break}}f=Math.min(f,p);let b=!1;if(s.some(w=>w.from==h&&(w.to==f||f==p))&&(b=h==f,!b&&f-h<10)){let w=h-(d+u.value.length);w>0&&(u.next(w),d=h);for(let k=h;;){if(k>=f){b=!0;break}if(!u.lineBreak&&d+u.value.length>k)break;k=d+u.value.length,d+=u.value.length,u.next()}}let y=odt(s);if(b)o.add(h,h,ln.widget({widget:new ndt(y),diagnostics:s.slice()}));else{let w=s.reduce((k,C)=>C.markClass?k+" "+C.markClass:k,"");o.add(h,f,ln.mark({class:"cm-lintRange cm-lintRange-"+y+w,diagnostics:s.slice(),inclusiveEnd:s.some(k=>k.to>f)}))}if(l=f,l==p)break;for(let w=0;w<s.length;w++)s[w].to<=l&&s.splice(w--,1)}let m=o.finish();return new Ag(m,n,kb(m))}}function kb(t,e=null,n=0){let a=null;return t.between(n,1e9,(r,i,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!a)a=new Gle(r,i,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(a.diagnostic)<0)return!1;a=new Gle(a.from,i,a.diagnostic)}}),a}function Kut(t,e){let n=e.pos,a=e.end||n,r=t.state.facet(P1).hideOn(t,n,a);if(r!=null)return r;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(qle))||t.changes.touchesRange(i.from,Math.max(i.to,a)))}function Zut(t,e){return t.field(Os,!1)?e:e.concat(Bn.appendConfig.of(sdt))}const qle=Bn.define(),nN=Bn.define(),zle=Bn.define(),Os=Li.define({create(){return new Ag(ln.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),a=null,r=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);a=kb(n,t.selected.diagnostic,i)||kb(n,null,i)}!n.size&&r&&e.state.facet(P1).autoPanel&&(r=null),t=new Ag(n,r,a)}for(let n of e.effects)if(n.is(qle)){let a=e.state.facet(P1).autoPanel?n.value.length?$1.open:null:t.panel;t=Ag.init(n.value,a,e.state)}else n.is(nN)?t=new Ag(t.diagnostics,n.value?$1.open:null,t.selected):n.is(zle)&&(t=new Ag(t.diagnostics,t.panel,n.value));return t},provide:t=>[v1.from(t,e=>e.panel),Ot.decorations.from(t,e=>e.diagnostics)]}),Vut=ln.mark({class:"cm-lintRange cm-lintRange-active"});function Jut(t,e,n){let{diagnostics:a}=t.state.field(Os),r,i=-1,o=-1;a.between(e-(n<0?1:0),e+(n>0?1:0),(l,u,{spec:d})=>{if(e>=l&&e<=u&&(l==u||(e>l||n>0)&&(e<u||n<0)))return r=d.diagnostics,i=l,o=u,!1});let s=t.state.facet(P1).tooltipFilter;return r&&s&&(r=s(r,t.state)),r?{pos:i,end:o,above:t.state.doc.lineAt(i).to<o,create(){return{dom:Xut(t,r)}}}:null}function Xut(t,e){return Ea("ul",{class:"cm-tooltip-lint"},e.map(n=>Wle(t,n,!1)))}const edt=t=>{let e=t.state.field(Os,!1);(!e||!e.panel)&&t.dispatch({effects:Zut(t.state,[nN.of(!0)])});let n=k1(t,$1.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},Hle=t=>{let e=t.state.field(Os,!1);return!e||!e.panel?!1:(t.dispatch({effects:nN.of(!1)}),!0)},tdt=[{key:"Mod-Shift-m",run:edt,preventDefault:!0},{key:"F8",run:t=>{let e=t.state.field(Os,!1);if(!e)return!1;let n=t.state.selection.main,a=e.diagnostics.iter(n.to+1);return!a.value&&(a=e.diagnostics.iter(0),!a.value||a.from==n.from&&a.to==n.to)?!1:(t.dispatch({selection:{anchor:a.from,head:a.to},scrollIntoView:!0}),!0)}}],P1=zt.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...iu(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Ule,tooltipFilter:Ule,needsRefresh:(e,n)=>e?n?a=>e(a)||n(a):e:n,hideOn:(e,n)=>e?n?(a,r,i)=>e(a,r,i)||n(a,r,i):e:n,autoPanel:(e,n)=>e||n})}}});function Ule(t,e){return t?e?(n,a)=>e(t(n,a),a):t:e}function Yle(t){let e=[];if(t)e:for(let{name:n}of t){for(let a=0;a<n.length;a++){let r=n[a];if(/[a-zA-Z]/.test(r)&&!e.some(i=>i.toLowerCase()==r.toLowerCase())){e.push(r);continue e}}e.push("")}return e}function Wle(t,e,n){var a;let r=n?Yle(e.actions):[];return Ea("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Ea("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(a=e.actions)===null||a===void 0?void 0:a.map((i,o)=>{let s=!1,l=A=>{if(A.preventDefault(),s)return;s=!0;let g=kb(t.state.field(Os).diagnostics,e);g&&i.apply(t,g.from,g.to)},{name:u}=i,d=r[o]?u.indexOf(r[o]):-1,p=d<0?u:[u.slice(0,d),Ea("u",u.slice(d,d+1)),u.slice(d+1)],m=i.markClass?" "+i.markClass:"";return Ea("button",{type:"button",class:"cm-diagnosticAction"+m,onclick:l,onmousedown:l,"aria-label":` Action: ${u}${d<0?"":` (access key "${r[o]})"`}.`},p)}),e.source&&Ea("div",{class:"cm-diagnosticSource"},e.source))}class ndt extends Cd{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Ea("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Kle{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Wle(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class $1{constructor(e){this.view=e,this.items=[];let n=r=>{if(r.keyCode==27)Hle(this.view),this.view.focus();else if(r.keyCode==38||r.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(r.keyCode==40||r.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(r.keyCode==36)this.moveSelection(0);else if(r.keyCode==35)this.moveSelection(this.items.length-1);else if(r.keyCode==13)this.view.focus();else if(r.keyCode>=65&&r.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],o=Yle(i.actions);for(let s=0;s<o.length;s++)if(o[s].toUpperCase().charCodeAt(0)==r.keyCode){let l=kb(this.view.state.field(Os).diagnostics,i);l&&i.actions[s].apply(e,l.from,l.to)}}else return;r.preventDefault()},a=r=>{for(let i=0;i<this.items.length;i++)this.items[i].dom.contains(r.target)&&this.moveSelection(i)};this.list=Ea("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:a}),this.dom=Ea("div",{class:"cm-panel-lint"},this.list,Ea("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Hle(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Os).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(Os),a=0,r=!1,i=null,o=new Set;for(e.between(0,this.view.state.doc.length,(s,l,{spec:u})=>{for(let d of u.diagnostics){if(o.has(d))continue;o.add(d);let p=-1,m;for(let A=a;A<this.items.length;A++)if(this.items[A].diagnostic==d){p=A;break}p<0?(m=new Kle(this.view,d),this.items.splice(a,0,m),r=!0):(m=this.items[p],p>a&&(this.items.splice(a,p-a),r=!0)),n&&m.diagnostic==n.diagnostic?m.dom.hasAttribute("aria-selected")||(m.dom.setAttribute("aria-selected","true"),i=m):m.dom.hasAttribute("aria-selected")&&m.dom.removeAttribute("aria-selected"),a++}});a<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new Kle(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:s,panel:l})=>{let u=l.height/this.list.offsetHeight;s.top<l.top?this.list.scrollTop-=(l.top-s.top)/u:s.bottom>l.bottom&&(this.list.scrollTop+=(s.bottom-l.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function n(){let a=e;e=a.nextSibling,a.remove()}for(let a of this.items)if(a.dom.parentNode==this.list){for(;e!=a.dom;)n();e=a.dom.nextSibling}else this.list.insertBefore(a.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(Os),a=kb(n.diagnostics,this.items[e].diagnostic);a&&this.view.dispatch({selection:{anchor:a.from,head:a.to},scrollIntoView:!0,effects:zle.of(a)})}static open(e){return new $1(e)}}function adt(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function h3(t){return adt(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const rdt=Ot.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:h3("#d11")},".cm-lintRange-warning":{backgroundImage:h3("orange")},".cm-lintRange-info":{backgroundImage:h3("#999")},".cm-lintRange-hint":{backgroundImage:h3("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function idt(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function odt(t){let e="hint",n=1;for(let a of t){let r=idt(a.severity);r>n&&(n=r,e=a.severity)}return e}const sdt=[Os,Ot.decorations.compute([Os],t=>{let{selected:e,panel:n}=t.field(Os);return!e||!n||e.from==e.to?ln.none:ln.set([Vut.range(e.from,e.to)])}),rst(Jut,{hideOn:Kut}),rdt];var Zle=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,a=[];e.closeBracketsKeymap!==!1&&(a=a.concat(Out)),e.defaultKeymap!==!1&&(a=a.concat(Llt)),e.searchKeymap!==!1&&(a=a.concat(out)),e.historyKeymap!==!1&&(a=a.concat(jct)),e.foldKeymap!==!1&&(a=a.concat(nct)),e.completionKeymap!==!1&&(a=a.concat(jle)),e.lintKeymap!==!1&&(a=a.concat(tdt));var r=[];return e.lineNumbers!==!1&&r.push(gst()),e.highlightActiveLineGutter!==!1&&r.push(bst()),e.highlightSpecialChars!==!1&&r.push(Fot()),e.history!==!1&&r.push(Tct()),e.foldGutter!==!1&&r.push(oct()),e.drawSelection!==!1&&r.push(vot()),e.dropCursor!==!1&&r.push(Bot()),e.allowMultipleSelections!==!1&&r.push(Hn.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&r.push(Wst()),e.syntaxHighlighting!==!1&&r.push(fce(uct,{fallback:!0})),e.bracketMatching!==!1&&r.push(hct()),e.closeBrackets!==!1&&r.push(Rut()),e.autocompletion!==!1&&r.push(Yut()),e.rectangularSelection!==!1&&r.push(Yot()),n!==!1&&r.push(Zot()),e.highlightActiveLine!==!1&&r.push($ot()),e.highlightSelectionMatches!==!1&&r.push(jlt()),e.tabSize&&typeof e.tabSize=="number"&&r.push(Y2.of(" ".repeat(e.tabSize))),r.concat([Q2.of(a.flat())]).filter(Boolean)};const cdt="#e5c07b",Vle="#e06c75",ldt="#56b6c2",udt="#ffffff",f3="#abb2bf",aN="#7d8799",ddt="#61afef",pdt="#98c379",Jle="#d19a66",mdt="#c678dd",Adt="#21252b",Xle="#2c313a",eue="#282c34",rN="#353a42",gdt="#3E4451",tue="#528bff",hdt=Ot.theme({"&":{color:f3,backgroundColor:eue},".cm-content":{caretColor:tue},".cm-cursor, .cm-dropCursor":{borderLeftColor:tue},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:gdt},".cm-panels":{backgroundColor:Adt,color:f3},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:eue,color:aN,border:"none"},".cm-activeLineGutter":{backgroundColor:Xle},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:rN},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:rN,borderBottomColor:rN},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Xle,color:f3}}},{dark:!0}),fdt=Q1.define([{tag:Xe.keyword,color:mdt},{tag:[Xe.name,Xe.deleted,Xe.character,Xe.propertyName,Xe.macroName],color:Vle},{tag:[Xe.function(Xe.variableName),Xe.labelName],color:ddt},{tag:[Xe.color,Xe.constant(Xe.name),Xe.standard(Xe.name)],color:Jle},{tag:[Xe.definition(Xe.name),Xe.separator],color:f3},{tag:[Xe.typeName,Xe.className,Xe.number,Xe.changed,Xe.annotation,Xe.modifier,Xe.self,Xe.namespace],color:cdt},{tag:[Xe.operator,Xe.operatorKeyword,Xe.url,Xe.escape,Xe.regexp,Xe.link,Xe.special(Xe.string)],color:ldt},{tag:[Xe.meta,Xe.comment],color:aN},{tag:Xe.strong,fontWeight:"bold"},{tag:Xe.emphasis,fontStyle:"italic"},{tag:Xe.strikethrough,textDecoration:"line-through"},{tag:Xe.link,color:aN,textDecoration:"underline"},{tag:Xe.heading,fontWeight:"bold",color:Vle},{tag:[Xe.atom,Xe.bool,Xe.special(Xe.variableName)],color:Jle},{tag:[Xe.processingInstruction,Xe.string,Xe.inserted],color:pdt},{tag:Xe.invalid,color:udt}]),bdt=[hdt,fce(fdt)];var ydt=Ot.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),wdt=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:a=!0,readOnly:r=!1,theme:i="light",placeholder:o="",basicSetup:s=!0}=e,l=[];switch(n&&l.unshift(Q2.of([Nlt])),s&&(typeof s=="boolean"?l.unshift(Zle()):l.unshift(Zle(s))),o&&l.unshift(qot(o)),i){case"light":l.push(ydt);break;case"dark":l.push(bdt);break;case"none":break;default:l.push(i);break}return a===!1&&l.push(Ot.editable.of(!1)),r&&l.push(Hn.readOnly.of(!0)),[...l]},kdt=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class vdt{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(a){console.error("TimeoutLatch callback error:",a)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class nue{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var iN=null,Cdt=()=>typeof window>"u"?new nue:(iN||(iN=new nue),iN),aue=ru.define(),_dt=200,xdt=[];function Edt(t){var{value:e,selection:n,onChange:a,onStatistics:r,onCreateEditor:i,onUpdate:o,extensions:s=xdt,autoFocus:l,theme:u="light",height:d=null,minHeight:p=null,maxHeight:m=null,width:A=null,minWidth:g=null,maxWidth:h=null,placeholder:f="",editable:b=!0,readOnly:y=!1,indentWithTab:w=!0,basicSetup:k=!0,root:C,initialState:x}=t,[_,E]=be.useState(),[I,Q]=be.useState(),[D,T]=be.useState(),N=be.useState(()=>({current:null}))[0],B=be.useState(()=>({current:null}))[0],S=Ot.theme({"&":{height:d,minHeight:p,maxHeight:m,width:A,minWidth:g,maxWidth:h},"& .cm-scroller":{height:"100% !important"}}),M=Ot.updateListener.of(R=>{if(R.docChanged&&typeof a=="function"&&!R.transactions.some(q=>q.annotation(aue))){N.current?N.current.reset():(N.current=new vdt(()=>{if(B.current){var q=B.current;B.current=null,q()}N.current=null},_dt),Cdt().add(N.current));var P=R.state.doc,$=P.toString();a($,R)}r&&r(kdt(R))}),L=wdt({theme:u,editable:b,readOnly:y,placeholder:f,indentWithTab:w,basicSetup:k}),F=[M,S,...L];return o&&typeof o=="function"&&F.push(Ot.updateListener.of(o)),F=F.concat(s),be.useLayoutEffect(()=>{if(_&&!D){var R={doc:e,selection:n,extensions:F},P=x?Hn.fromJSON(x.json,R,x.fields):Hn.create(R);if(T(P),!I){var $=new Ot({state:P,parent:_,root:C});Q($),i&&i($,P)}}return()=>{I&&(T(void 0),Q(void 0))}},[_,D]),be.useEffect(()=>{t.container&&E(t.container)},[t.container]),be.useEffect(()=>()=>{I&&(I.destroy(),Q(void 0)),N.current&&(N.current.cancel(),N.current=null)},[I]),be.useEffect(()=>{l&&I&&I.focus()},[l,I]),be.useEffect(()=>{I&&I.dispatch({effects:Bn.reconfigure.of(F)})},[u,s,d,p,m,A,g,h,f,b,y,w,k,a,o]),be.useEffect(()=>{if(e!==void 0){var R=I?I.state.doc.toString():"";if(I&&e!==R){var P=N.current&&!N.current.isDone,$=()=>{I&&e!==I.state.doc.toString()&&I.dispatch({changes:{from:0,to:I.state.doc.toString().length,insert:e||""},annotations:[aue.of(!0)]})};P?B.current=$:$()}}},[e,I]),{state:D,setState:T,view:I,setView:Q,container:_,setContainer:E}}var Bdt=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],rue=be.forwardRef((t,e)=>{var{className:n,value:a="",selection:r,extensions:i=[],onChange:o,onStatistics:s,onCreateEditor:l,onUpdate:u,autoFocus:d,theme:p="light",height:m,minHeight:A,maxHeight:g,width:h,minWidth:f,maxWidth:b,basicSetup:y,placeholder:w,indentWithTab:k,editable:C,readOnly:x,root:_,initialState:E}=t,I=brt(t,Bdt),Q=be.useRef(null),{state:D,view:T,container:N,setContainer:B}=Edt({root:_,value:a,autoFocus:d,theme:p,height:m,minHeight:A,maxHeight:g,width:h,minWidth:f,maxWidth:b,basicSetup:y,placeholder:w,indentWithTab:k,editable:C,readOnly:x,selection:r,onChange:o,onStatistics:s,onCreateEditor:l,onUpdate:u,extensions:i,initialState:E});be.useImperativeHandle(e,()=>({editor:Q.current,state:D,view:T}),[Q,N,D,T]);var S=be.useCallback(L=>{Q.current=L,B(L)},[B]);if(typeof a!="string")throw new Error("value must be typeof string but got "+typeof a);var M=typeof p=="string"?"cm-theme-"+p:"cm-theme";return H.jsx("div",aF({ref:S,className:""+M+(n?" "+n:"")},I))});rue.displayName="CodeMirror";var iue={npm_package_dependencies__radix_ui_react_hover_card:"1.1.15",npm_config_legacy_peer_deps:"true",TERM_PROGRAM:"WarpTerminal",NODE:"/Users/diananr/.nvm/versions/node/v22.21.1/bin/node",INIT_CWD:"/Users/diananr/foris/avocado/packages/ai-agent",npm_package_devDependencies_typescript:"5.1.3",npm_package_dependencies_lucide_react:"0.561.0",npm_package_devDependencies_vite:"5.0.12",npm_package_dependencies__radix_ui_react_dialog:"1.1.15",TERM:"xterm-256color",SHELL:"/bin/zsh",npm_package_devDependencies__testing_library_user_event:"14.5.2",npm_package_devDependencies__vitest_ui:"1.2.2",npm_package_dependencies_streamdown:"1.6.10",npm_package_dependencies_postcss:"8.5.6",TURBO_IS_TUI:"true",npm_config_registry:"https://registry.npmjs.org/",npm_package_dependencies__radix_ui_react_select:"2.2.6",npm_package_devDependencies_vite_plugin_static_copy:"1.0.0",npm_package_dependencies_react_dom:"18.3.1",npm_package_devDependencies__testing_library_react:"14.2.0",npm_package_devDependencies__types_react:"18.3.1",npm_package_dependencies_embla_carousel_react:"8.6.0",npm_package_dependencies_ai:"5.0.115",npm_package_dependencies__radix_ui_react_tooltip:"1.2.8",PNPM_SCRIPT_SRC_DIR:"/Users/diananr/foris/avocado/packages/ai-agent",npm_package_exports___import:"./dist/ai-agent.es.js",npm_package_dependencies_use_stick_to_bottom:"1.1.1",npm_package_devDependencies__types_testing_library__jest_dom:"6.0.0",npm_package_dependencies__uiw_react_codemirror:"4.25.4",__CF_USER_TEXT_ENCODING:"0x1F6:0x0:0x0",npm_execpath:"/Users/diananr/Library/pnpm/.tools/pnpm/9.10.0/node_modules/pnpm/bin/pnpm.cjs",npm_package_scripts_coverage:"vitest run --coverage",npm_package_dependencies__radix_ui_react_use_controllable_state:"1.2.2",npm_package_module:"./dist/ai-agent.es.js",npm_config_frozen_lockfile:"",npm_package_devDependencies__types_react_dom:"18.3.1",npm_package_devDependencies_classnames:"2.3.2",npm_package_dependencies_tailwind_merge:"3.4.0",npm_package_dependencies_class_variance_authority:"0.7.1",PATH:"/Users/diananr/foris/avocado/packages/ai-agent/node_modules/.bin:/Users/diananr/Library/pnpm/.tools/pnpm/9.10.0/node_modules/pnpm/dist/node-gyp-bin:/Users/diananr/foris/avocado/node_modules/.bin:/Users/diananr/foris/avocado/node_modules/.bin:/Users/diananr/Library/pnpm/.tools/pnpm/9.10.0/node_modules/pnpm/dist/node-gyp-bin:/Users/diananr/foris/avocado/node_modules/.bin:/Users/diananr/Library/pnpm/.tools/pnpm/9.10.0/bin:/Users/diananr/.antigravity/antigravity/bin:/Users/diananr/.rbenv/shims:/Users/diananr/.rbenv/bin:/Users/diananr/.rbenv/shims:/Users/diananr/.rbenv/bin:/Users/diananr/.rbenv/shims:/Users/diananr/.rbenv/bin:/Users/diananr/.nvm/versions/node/v22.21.1/bin:/Users/diananr/.asdf/installs/erlang/24.3.4/bin:/Users/diananr/.asdf/installs/elixir/1.14.1-otp-24/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/share/dotnet:~/.dotnet/tools:/usr/local/go/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Warp.app/Contents/Resources/bin",npm_package_dependencies__radix_ui_react_progress:"1.1.8",npm_config_auto_install_peers:"true",npm_command:"run-script",npm_package_devDependencies_tailwindcss:"4.1.18",PWD:"/Users/diananr/foris/avocado/packages/ai-agent",npm_package_scripts_test_watch:"vitest --ui",npm_lifecycle_event:"build",npm_package_devDependencies_jsdom:"24.0.0",npm_package_dependencies__tailwindcss_postcss:"4.1.18",npm_package_types:"./dist/index.d.ts",npm_package_name:"@foris/ai-agent",npm_package_devDependencies_sass:"1.62.1",npm_package_devDependencies__vitest_coverage_v8:"1.2.2",npm_package_devDependencies__foris_tsconfig:"workspace:*",npm_package_dependencies_cmdk:"1.1.1",npm_package_scripts_build:"tsc && vite build",npm_package_exports___types:"./dist/index.d.ts",npm_config_node_linker:"hoisted",npm_package_devDependencies_vitest:"1.2.2",npm_package_devDependencies_tw_animate_css:"1.4.0",npm_package_dependencies_motion:"12.23.26",TURBO_HASH:"71919baa31f779fb",npm_package_dependencies_tokenlens:"1.3.1",npm_package_devDependencies__shikijs_transformers:"3.20.0",npm_config_node_gyp:"/Users/diananr/Library/pnpm/.tools/pnpm/9.10.0/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js",npm_package_devDependencies_vite_plugin_dts:"3.7.1",npm_package_dependencies__radix_ui_react_collapsible:"1.1.12",npm_package_main:"./dist/ai-agent.umd.js",npm_package_version:"0.7.1-beta.1",SHLVL:"1",npm_package_type:"module",HOME:"/Users/diananr",npm_package_dependencies_react_markdown:"10.1.0",npm_package_dependencies_nanoid:"5.1.6",npm_package_publishConfig_access:"public",npm_package_dependencies__radix_ui_react_slot:"1.2.4",npm_package_exports___default:"./dist/ai-agent.es.js",npm_lifecycle_script:"tsc && vite build",npm_package_exports___require:"./dist/ai-agent.umd.js",npm_package_dependencies__xyflow_react:"12.10.0",npm_package_devDependencies__vitejs_plugin_react_swc:"3.5.0",npm_package_dependencies_react:"18.3.1",npm_package_dependencies__radix_ui_react_separator:"1.1.8",npm_config_user_agent:"pnpm/9.10.0 npm/? node/v22.21.1 darwin arm64",npm_package_devDependencies__types_node:"20.2.5",npm_package_dependencies_clsx:"2.1.1",npm_package_dependencies__radix_ui_react_dropdown_menu:"2.1.16",npm_package_dependencies__ai_sdk_react:"2.0.117",npm_package_files_0:"dist",npm_package_dependencies_shiki:"3.20.0",npm_package_dependencies__codemirror_lang_json:"6.0.1",npm_node_execpath:"/Users/diananr/.nvm/versions/node/v22.21.1/bin/node",npm_package_devDependencies__testing_library_jest_dom:"6.4.0",npm_package_dependencies__radix_ui_react_scroll_area:"1.2.10",COLORTERM:"truecolor",_:"/Users/diananr/foris/avocado/node_modules/.bin/vite",NODE_ENV:"production"};let Idt=class lH{constructor(e,n,a,r,i,o,s,l,u,d=0,p){this.p=e,this.stack=n,this.state=a,this.reducePos=r,this.pos=i,this.score=o,this.buffer=s,this.bufferBase=l,this.curContext=u,this.lookAhead=d,this.parent=p}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,a=0){let r=e.parser.context;return new lH(e,[],n,a,a,0,[],0,r?new oue(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let a=e>>19,r=e&65535,{parser:i}=this.p,o=this.reducePos<this.pos-25;o&&this.setLookAhead(this.pos);let s=i.dynamicPrecedence(r);if(s&&(this.score+=s),a==0){this.pushState(i.getGoto(this.state,r,!0),this.reducePos),r<i.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(r,this.reducePos);return}let l=this.stack.length-(a-1)*3-(e&262144?6:0),u=l?this.stack[l-2]:this.p.ranges[0].from,d=this.reducePos-u;d>=2e3&&!(!((n=this.p.parser.nodeSet.types[r])===null||n===void 0)&&n.isAnonymous)&&(u==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=d):this.p.lastBigReductionSize<d&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=u,this.p.lastBigReductionSize=d));let p=l?this.stack[l-1]:0,m=this.bufferBase+this.buffer.length-p;if(r<i.minRepeatTerm||e&131072){let A=i.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,u,A,m+4,!0)}if(e&262144)this.state=this.stack[l];else{let A=this.stack[l-3];this.state=i.getGoto(A,r,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(r,u)}storeNode(e,n,a,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,s=this.buffer.length;if(s==0&&o.parent&&(s=o.bufferBase-o.parent.bufferBase,o=o.parent),s>0&&o.buffer[s-4]==0&&o.buffer[s-1]>-1){if(n==a)return;if(o.buffer[s-2]>=n){o.buffer[s-2]=a;return}}}if(!i||this.pos==a)this.buffer.push(e,n,a,r);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let s=!1;for(let l=o;l>0&&this.buffer[l-2]>a;l-=4)if(this.buffer[l-1]>=0){s=!0;break}if(s)for(;o>0&&this.buffer[o-2]>a;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,r>4&&(r-=4)}this.buffer[o]=e,this.buffer[o+1]=n,this.buffer[o+2]=a,this.buffer[o+3]=r}}shift(e,n,a,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(n,a),n<=this.p.parser.maxNode&&this.buffer.push(n,a,r,4);else{let i=e,{parser:o}=this.p;(r>this.pos||n<=o.maxNode)&&(this.pos=r,o.stateFlag(i,1)||(this.reducePos=r)),this.pushState(i,a),this.shiftContext(n,a),n<=o.maxNode&&this.buffer.push(n,a,r,4)}}apply(e,n,a,r){e&65536?this.reduce(e):this.shift(e,n,a,r)}useNode(e,n){let a=this.p.reused.length-1;(a<0||this.p.reused[a]!=e)&&(this.p.reused.push(e),a++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(n,r),this.buffer.push(a,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let a=e.buffer.slice(n),r=e.bufferBase+n;for(;e&&r==e.bufferBase;)e=e.parent;return new lH(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,a,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let a=e<=this.p.parser.maxNode;a&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,a?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new Ddt(this);;){let a=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(a==0)return!1;if(!(a&65536))return!0;n.reduce(a)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let r=[];for(let i=0,o;i<n.length;i+=2)(o=n[i+1])!=this.state&&this.p.parser.hasAction(o,e)&&r.push(n[i],o);if(this.stack.length<120)for(let i=0;r.length<8&&i<n.length;i+=2){let o=n[i+1];r.some((s,l)=>l&1&&s==o)||r.push(n[i],o)}n=r}let a=[];for(let r=0;r<n.length&&a.length<4;r+=2){let i=n[r+1];if(i==this.state)continue;let o=this.split();o.pushState(i,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(n[r],this.pos),o.reducePos=this.pos,o.score-=200,a.push(o)}return a}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if(!(n&65536))return!1;if(!e.validAction(this.state,n)){let a=n>>19,r=n&65535,i=this.stack.length-a*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],a=(r,i)=>{if(!n.includes(r))return n.push(r),e.allActions(r,o=>{if(!(o&393216))if(o&65536){let s=(o>>19)-i;if(s>1){let l=o&65535,u=this.stack.length-s*3;if(u>=0&&e.getGoto(this.stack[u],l,!1)>=0)return s<<19|65536|l}}else{let s=a(o,i+1);if(s!=null)return s}})};return a(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new oue(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}};class oue{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class Ddt{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,a=e>>19;a==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(a-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=r}}class b3{constructor(e,n,a){this.stack=e,this.pos=n,this.index=a,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new b3(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new b3(this.stack,this.pos,this.index)}}function y3(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let a=0,r=0;a<t.length;){let i=0;for(;;){let o=t.charCodeAt(a++),s=!1;if(o==126){i=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,s=!0),i+=l,s)break;i*=46}n?n[r++]=i:n=new e(i)}return n}class w3{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const sue=new w3;class Qdt{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=sue,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let a=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<a.from;){if(!r)return null;let o=this.ranges[--r];i-=a.from-o.to,a=o}for(;n<0?i>a.to:i>=a.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];i+=o.from-a.to,a=o}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,a,r;if(n>=0&&n<this.chunk.length)a=this.pos+e,r=this.chunk.charCodeAt(n);else{let i=this.resolveOffset(e,1);if(i==null)return-1;if(a=i,a>=this.chunk2Pos&&a<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(a-this.chunk2Pos);else{let o=this.rangeIndex,s=this.range;for(;s.to<=a;)s=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=a),a+this.chunk2.length>s.to&&(this.chunk2=this.chunk2.slice(0,s.to-a)),r=this.chunk2.charCodeAt(0)}}return a>=this.token.lookAhead&&(this.token.lookAhead=a+1),r}acceptToken(e,n=0){let a=n?this.resolveOffset(n,-1):this.pos;if(a==null||a<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=a}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=sue,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let a="";for(let r of this.ranges){if(r.from>=n)break;r.to>e&&(a+=this.input.read(Math.max(r.from,e),Math.min(r.to,n)))}return a}}class vb{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:a}=n.p;Sdt(this.data,e,n,this.id,a.data,a.tokenPrecTable)}}vb.prototype.contextual=vb.prototype.fallback=vb.prototype.extend=!1,vb.prototype.fallback=vb.prototype.extend=!1;function Sdt(t,e,n,a,r,i){let o=0,s=1<<a,{dialect:l}=n.p.parser;e:for(;s&t[o];){let u=t[o+1];for(let A=o+3;A<u;A+=2)if((t[A+1]&s)>0){let g=t[A];if(l.allows(g)&&(e.token.value==-1||e.token.value==g||Tdt(g,e.token.value,r,i))){e.acceptToken(g);break}}let d=e.next,p=0,m=t[o+2];if(e.next<0&&m>p&&t[u+m*3-3]==65535){o=t[u+m*3-1];continue e}for(;p<m;){let A=p+m>>1,g=u+A+(A<<1),h=t[g],f=t[g+1]||65536;if(d<h)m=A;else if(d>=f)p=A+1;else{o=t[g+2],e.advance();continue e}}break}}function cue(t,e,n){for(let a=e,r;(r=t[a])!=65535;a++)if(r==n)return a-e;return-1}function Tdt(t,e,n,a){let r=cue(n,a,e);return r<0||cue(n,a,t)<r}const js=typeof process<"u"&&iue&&/\bparse\b/.test(iue.LOG);let oN=null;function lue(t,e,n){let a=t.cursor(bi.IncludeAnonymous);for(a.moveTo(e);;)if(!(n<0?a.childBefore(e):a.childAfter(e)))for(;;){if((n<0?a.to<e:a.from>e)&&!a.type.isError)return n<0?Math.max(0,Math.min(a.to-1,e-25)):Math.min(t.length,Math.max(a.from+1,e+25));if(n<0?a.prevSibling():a.nextSibling())break;if(!a.parent())return n<0?0:t.length}}class Fdt{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?lue(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?lue(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let a=this.trees[n],r=this.index[n];if(r==a.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=a.children[r],o=this.start[n]+a.positions[r];if(o>e)return this.nextStart=o,null;if(i instanceof Lr){if(o==e){if(o<this.safeFrom)return null;let s=o+i.length;if(s<=this.safeTo){let l=i.prop(Rn.lookAhead);if(!l||s+l<this.fragment.to)return i}}this.index[n]++,o+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+i.length}}}class Ldt{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(a=>new w3)}getActions(e){let n=0,a=null,{parser:r}=e.p,{tokenizers:i}=r,o=r.stateSlot(e.state,3),s=e.curContext?e.curContext.hash:0,l=0;for(let u=0;u<i.length;u++){if(!(1<<u&o))continue;let d=i[u],p=this.tokens[u];if(!(a&&!d.fallback)&&((d.contextual||p.start!=e.pos||p.mask!=o||p.context!=s)&&(this.updateCachedToken(p,d,e),p.mask=o,p.context=s),p.lookAhead>p.end+25&&(l=Math.max(p.lookAhead,l)),p.value!=0)){let m=n;if(p.extended>-1&&(n=this.addActions(e,p.extended,p.end,n)),n=this.addActions(e,p.value,p.end,n),!d.extend&&(a=p,n>m))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!a&&e.pos==this.stream.end&&(a=new w3,a.value=e.p.parser.eofTerm,a.start=a.end=e.pos,n=this.addActions(e,a.value,a.end,n)),this.mainToken=a,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new w3,{pos:a,p:r}=e;return n.start=a,n.end=Math.min(a+1,r.stream.end),n.value=a==r.stream.end?r.parser.eofTerm:0,n}updateCachedToken(e,n,a){let r=this.stream.clipPos(a.pos);if(n.token(this.stream.reset(r,e),a),e.value>-1){let{parser:i}=a.p;for(let o=0;o<i.specialized.length;o++)if(i.specialized[o]==e.value){let s=i.specializers[o](this.stream.read(e.start,e.end),a);if(s>=0&&a.p.parser.dialect.allows(s>>1)){s&1?e.extended=s>>1:e.value=s>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,n,a,r){for(let i=0;i<r;i+=3)if(this.actions[i]==e)return r;return this.actions[r++]=e,this.actions[r++]=n,this.actions[r++]=a,r}addActions(e,n,a,r){let{state:i}=e,{parser:o}=e.p,{data:s}=o;for(let l=0;l<2;l++)for(let u=o.stateSlot(i,l?2:1);;u+=3){if(s[u]==65535)if(s[u+1]==1)u=Bd(s,u+2);else{r==0&&s[u+1]==2&&(r=this.putAction(Bd(s,u+2),n,a,r));break}s[u]==n&&(r=this.putAction(Bd(s,u+1),n,a,r))}return r}}class Ndt{constructor(e,n,a,r){this.parser=e,this.input=n,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Qdt(n,r),this.tokens=new Ldt(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[Idt.start(this,e.top[0],i)],this.fragments=a.length&&this.stream.end-i>e.bufferLength*4?new Fdt(a,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,a=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let s=e[o];for(;;){if(this.tokens.mainToken=null,s.pos>n)a.push(s);else{if(this.advanceStack(s,a,e))continue;{r||(r=[],i=[]),r.push(s);let l=this.tokens.getMainToken(s);i.push(l.value,l.end)}}break}}if(!a.length){let o=r&&Rdt(r);if(o)return js&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw js&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,a);if(o)return js&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(a.length>o)for(a.sort((s,l)=>l.score-s.score);a.length>o;)a.pop();a.some(s=>s.reducePos>n)&&this.recovering--}else if(a.length>1){e:for(let o=0;o<a.length-1;o++){let s=a[o];for(let l=o+1;l<a.length;l++){let u=a[l];if(s.sameState(u)||s.buffer.length>500&&u.buffer.length>500)if((s.score-u.score||s.buffer.length-u.buffer.length)>0)a.splice(l--,1);else{a.splice(o--,1);continue e}}}a.length>12&&a.splice(12,a.length-12)}this.minStackPos=a[0].pos;for(let o=1;o<a.length;o++)a[o].pos<this.minStackPos&&(this.minStackPos=a[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,n,a){let r=e.pos,{parser:i}=this,o=js?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let u=e.curContext&&e.curContext.tracker.strict,d=u?e.curContext.hash:0;for(let p=this.fragments.nodeAt(r);p;){let m=this.parser.nodeSet.types[p.type.id]==p.type?i.getGoto(e.state,p.type.id):-1;if(m>-1&&p.length&&(!u||(p.prop(Rn.contextHash)||0)==d))return e.useNode(p,m),js&&console.log(o+this.stackID(e)+` (via reuse of ${i.getName(p.type.id)})`),!0;if(!(p instanceof Lr)||p.children.length==0||p.positions[0]>0)break;let A=p.children[0];if(A instanceof Lr&&p.positions[0]==0)p=A;else break}}let s=i.stateSlot(e.state,4);if(s>0)return e.reduce(s),js&&console.log(o+this.stackID(e)+` (via always-reduce ${i.getName(s&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let u=0;u<l.length;){let d=l[u++],p=l[u++],m=l[u++],A=u==l.length||!a,g=A?e:e.split(),h=this.tokens.mainToken;if(g.apply(d,p,h?h.start:g.pos,m),js&&console.log(o+this.stackID(g)+` (via ${d&65536?`reduce of ${i.getName(d&65535)}`:"shift"} for ${i.getName(p)} @ ${r}${g==e?"":", split"})`),A)return!0;g.pos>r?n.push(g):a.push(g)}return!1}advanceFully(e,n){let a=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>a)return uue(e,n),!0}}runRecovery(e,n,a){let r=null,i=!1;for(let o=0;o<e.length;o++){let s=e[o],l=n[o<<1],u=n[(o<<1)+1],d=js?this.stackID(s)+" -> ":"";if(s.deadEnd&&(i||(i=!0,s.restart(),js&&console.log(d+this.stackID(s)+" (restarted)"),this.advanceFully(s,a))))continue;let p=s.split(),m=d;for(let A=0;A<10&&p.forceReduce()&&(js&&console.log(m+this.stackID(p)+" (via force-reduce)"),!this.advanceFully(p,a));A++)js&&(m=this.stackID(p)+" -> ");for(let A of s.recoverByInsert(l))js&&console.log(d+this.stackID(A)+" (via recover-insert)"),this.advanceFully(A,a);this.stream.end>s.pos?(u==s.pos&&(u++,l=0),s.recoverByDelete(l,u),js&&console.log(d+this.stackID(s)+` (via recover-delete ${this.parser.getName(l)})`),uue(s,a)):(!r||r.score<s.score)&&(r=s)}return r}stackToTree(e){return e.close(),Lr.build({buffer:b3.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(oN||(oN=new WeakMap)).get(e);return n||oN.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function uue(t,e){for(let n=0;n<e.length;n++){let a=e[n];if(a.pos==t.pos&&a.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class Mdt{constructor(e,n,a){this.source=e,this.flags=n,this.disabled=a}allows(e){return!this.disabled||this.disabled[e]==0}}class k3 extends Wse{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let s=0;s<e.repeatNodeCount;s++)n.push("");let a=Object.keys(e.topRules).map(s=>e.topRules[s][1]),r=[];for(let s=0;s<n.length;s++)r.push([]);function i(s,l,u){r[s].push([l,l.deserialize(String(u))])}if(e.nodeProps)for(let s of e.nodeProps){let l=s[0];typeof l=="string"&&(l=Rn[l]);for(let u=1;u<s.length;){let d=s[u++];if(d>=0)i(d,l,s[u++]);else{let p=s[u+-d];for(let m=-d;m>0;m--)i(s[u++],l,p);u++}}}this.nodeSet=new hL(n.map((s,l)=>ds.define({name:l>=this.minRepeatTerm?void 0:s,id:l,props:r[l],top:a.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=jse;let o=y3(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let s=0;s<this.specializerSpecs.length;s++)this.specialized[s]=this.specializerSpecs[s].term;this.specializers=this.specializerSpecs.map(due),this.states=y3(e.states,Uint32Array),this.data=y3(e.stateData),this.goto=y3(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(s=>typeof s=="number"?new vb(o,s):s),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,a){let r=new Ndt(this,e,n,a);for(let i of this.wrappers)r=i(r,e,n,a);return r}getGoto(e,n,a=!1){let r=this.goto;if(n>=r[0])return-1;for(let i=r[n+1];;){let o=r[i++],s=o&1,l=r[i++];if(s&&a)return l;for(let u=i+(o>>1);i<u;i++)if(r[i]==e)return l;if(s)return-1}}hasAction(e,n){let a=this.data;for(let r=0;r<2;r++)for(let i=this.stateSlot(e,r?2:1),o;;i+=3){if((o=a[i])==65535)if(a[i+1]==1)o=a[i=Bd(a,i+2)];else{if(a[i+1]==2)return Bd(a,i+2);break}if(o==n||o==0)return Bd(a,i+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,a=>a==n?!0:null)}allActions(e,n){let a=this.stateSlot(e,4),r=a?n(a):void 0;for(let i=this.stateSlot(e,1);r==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Bd(this.data,i+2);else break;r=n(Bd(this.data,i+1))}return r}nextStates(e){let n=[];for(let a=this.stateSlot(e,1);;a+=3){if(this.data[a]==65535)if(this.data[a+1]==1)a=Bd(this.data,a+2);else break;if(!(this.data[a+2]&1)){let r=this.data[a+1];n.some((i,o)=>o&1&&i==r)||n.push(this.data[a],r)}}return n}configure(e){let n=Object.assign(Object.create(k3.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let a=this.topRules[e.top];if(!a)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=a}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(a=>{let r=e.tokenizers.find(i=>i.from==a);return r?r.to:a})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((a,r)=>{let i=e.specializers.find(s=>s.from==a.external);if(!i)return a;let o=Object.assign(Object.assign({},a),{external:i.to});return n.specializers[r]=due(o),o})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),a=n.map(()=>!1);if(e)for(let i of e.split(" ")){let o=n.indexOf(i);o>=0&&(a[o]=!0)}let r=null;for(let i=0;i<n.length;i++)if(!a[i])for(let o=this.dialects[n[i]],s;(s=this.data[o++])!=65535;)(r||(r=new Uint8Array(this.maxTerm+1)))[s]=1;return new Mdt(e,a,r)}static deserialize(e){return new k3(e)}}function Bd(t,e){return t[e]|t[e+1]<<16}function Rdt(t){let e=null;for(let n of t){let a=n.p.stoppedAt;(n.pos==n.p.stream.end||a!=null&&n.pos>a)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function due(t){if(t.external){let e=t.extend?1:0;return(n,a)=>t.external(n,a)<<1|e}return t.get}const Pdt=Kse({String:Xe.string,Number:Xe.number,"True False":Xe.bool,PropertyName:Xe.propertyName,Null:Xe.null,", :":Xe.separator,"[ ]":Xe.squareBracket,"{ }":Xe.brace}),$dt=k3.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[Pdt],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),Odt=H2.define({name:"json",parser:$dt.configure({props:[ace.add({Object:ice({except:/^\s*\}/}),Array:ice({except:/^\s*\]/})}),oce.add({"Object Array":Zst})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function pue(){return new Pst(Odt)}const mue=t=>{const{language:e="json",placeholder:n="Write your code here",value:a="",onChange:r}=t,i={json:pue()};return H.jsx(rue,{value:a,height:"400px",placeholder:n,extensions:[i[e]??pue()],onChange:r,theme:"light",editable:!0})},Ka={promptCodeEditor:"_promptCodeEditor_1b6xt_16",promptCodeEditor_headerContainer:"_promptCodeEditor_headerContainer_1b6xt_23",form:"_form_1b6xt_30",form_label:"_form_label_1b6xt_35",form_field:"_form_field_1b6xt_41",inputWrapper:"_inputWrapper_1b6xt_46",inputIcon:"_inputIcon_1b6xt_52",fieldInput:"_fieldInput_1b6xt_61",buttonSubmit:"_buttonSubmit_1b6xt_76",panel:"_panel_1b6xt_103",slideDown:"_slideDown_1b6xt_1",panel_loading:"_panel_loading_1b6xt_120",loadingSpinner:"_loadingSpinner_1b6xt_123",spin:"_spin_1b6xt_1",loadingText:"_loadingText_1b6xt_132",panel_error:"_panel_error_1b6xt_137",errorText:"_errorText_1b6xt_142",discardButton:"_discardButton_1b6xt_147",panel_response:"_panel_response_1b6xt_157",diffContainer:"_diffContainer_1b6xt_162",diffContainer_label:"_diffContainer_label_1b6xt_167",actions:"_actions_1b6xt_179",actions_discardButton:"_actions_discardButton_1b6xt_184",actions_applyButton:"_actions_applyButton_1b6xt_195",promptCodeEditor_codeContainer:"_promptCodeEditor_codeContainer_1b6xt_205",codeBlockLabel:"_codeBlockLabel_1b6xt_212"},jdt=({value:t,placeholder:e,label:n,loading:a,disabled:r,setValue:i,onSubmit:o})=>{const s=be.useMemo(()=>[e||"Edita esta regla con un prompt...","Describe los cambios que necesitas...","Modifica la configuración sin tocar el código..."],[e]),[l,u]=be.useState(0);return be.useEffect(()=>{if(t!=null&&t.trim()||a||r)return;const d=setInterval(()=>{u(p=>(p+1)%s.length)},3e3);return()=>clearInterval(d)},[t,a,r,s==null?void 0:s.length]),H.jsxs("div",{className:Ka.form,children:[n&&H.jsx("label",{className:Ka.form_label,children:n}),H.jsx("div",{className:Ka.form_field,children:H.jsxs("div",{className:Ka.inputWrapper,children:[H.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:Ka.inputIcon,"aria-hidden":"true",children:[H.jsx("path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"}),H.jsx("path",{d:"M20 2v4"}),H.jsx("path",{d:"M22 4h-4"}),H.jsx("circle",{cx:"4",cy:"20",r:"2"})]}),H.jsx(Qtt,{type:"text",placeholder:s[l],value:t,onChange:d=>i==null?void 0:i(d.target.value),onKeyDown:d=>{d.key==="Enter"&&!d.shiftKey&&(t!=null&&t.trim())&&!a&&!r&&(d.preventDefault(),o==null||o())},className:Ka.fieldInput,disabled:a||r}),H.jsx(ef,{onClick:o,disabled:!(t!=null&&t.trim())||a||r,className:Ka.buttonSubmit,children:"Proponer solución"})]})})]})},Gdt=({requestConfig:t,language:e,disabled:n=!1,inputLabel:a,inputPlaceholder:r="",codeBlockLabel:i,codeBlockValue:o,onCodeChange:s})=>{const[l,u]=be.useState(o),[d,p]=be.useState(""),[m,A]=be.useState(!1),g=be.useRef(null),h=be.useRef(null),{loading:f,response:b,error:y,onSubmit:w}=frt(t),k=()=>{d.trim()&&w({code:l,prompt:d})},C=()=>{b!=null&&b.modifiedCode&&(u(b.modifiedCode),s==null||s(b.modifiedCode),A(!1),p(""))},x=()=>{A(!1)};return be.useEffect(()=>{u(o)},[o]),be.useEffect(()=>{(f||b||y)&&A(!0)},[f,b,y]),be.useEffect(()=>{const _=E=>{g.current&&!g.current.contains(E.target)&&h.current&&!h.current.contains(E.target)&&A(!1)};return m&&document.addEventListener("mousedown",_),()=>{document.removeEventListener("mousedown",_)}},[m]),H.jsxs("section",{className:Ka.promptCodeEditor,children:[H.jsxs("div",{className:Ka.promptCodeEditor_headerContainer,ref:h,children:[H.jsx(jdt,{value:d,loading:f,label:a,disabled:n,placeholder:r,setValue:p,onSubmit:k}),m&&(f||y||b)&&H.jsxs("div",{ref:g,className:Ka.panel,children:[f&&H.jsxs("div",{className:Ka.panel_loading,children:[H.jsx("div",{className:Ka.loadingSpinner}),H.jsx("p",{className:Ka.loadingText,children:"Generando cambios..."})]}),y&&H.jsxs("div",{className:Ka.panel_error,children:[H.jsx("p",{className:Ka.errorText,children:y}),H.jsx(ef,{onClick:x,variant:"outline",size:"sm",className:Ka.discardButton,children:"Cerrar"})]}),b&&!f&&H.jsxs("div",{className:Ka.panel_response,children:[H.jsxs("div",{className:Ka.diffContainer,children:[H.jsx("p",{className:Ka.diffContainer_label,children:"Solución propuesta"}),H.jsx(RB,{code:b.codeWithAnnotations,language:e,showLineNumbers:!0})]}),H.jsxs("div",{className:Ka.actions,children:[H.jsx(ef,{size:"sm",onClick:x,variant:"outline",className:Ka.actions_discardButton,children:"Cancelar"}),H.jsx(ef,{size:"sm",onClick:C,variant:"default",className:Ka.actions_applyButton,children:"Insertar código"})]})]})]})]}),H.jsxs("div",{className:Ka.promptCodeEditor_codeContainer,children:[i&&H.jsx("label",{className:Ka.codeBlockLabel,children:i}),H.jsx(mue,{value:l,onChange:_=>{u(_),s==null||s(_)}})]})]})};var sN={name:"mermaid",version:"11.12.2",description:"Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.",type:"module",module:"./dist/mermaid.core.mjs",types:"./dist/mermaid.d.ts",exports:{".":{types:"./dist/mermaid.d.ts",import:"./dist/mermaid.core.mjs",default:"./dist/mermaid.core.mjs"},"./*":"./*"},keywords:["diagram","markdown","flowchart","sequence diagram","gantt","class diagram","git graph","mindmap","packet diagram","c4 diagram","er diagram","pie chart","pie diagram","quadrant chart","requirement diagram","graph"],scripts:{clean:"rimraf dist",dev:"pnpm -w dev","docs:code":"typedoc src/defaultConfig.ts src/config.ts src/mermaid.ts && prettier --write ./src/docs/config/setup","docs:build":"rimraf ../../docs && pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts","docs:verify":"pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts --verify","docs:pre:vitepress":"pnpm --filter ./src/docs prefetch && rimraf src/vitepress && pnpm docs:code && tsx scripts/docs.cli.mts --vitepress && pnpm --filter ./src/vitepress install --no-frozen-lockfile --ignore-scripts","docs:build:vitepress":"pnpm docs:pre:vitepress && (cd src/vitepress && pnpm run build) && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing","docs:dev":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:dev:docker":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev:docker" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:serve":"pnpm docs:build:vitepress && vitepress serve src/vitepress","docs:spellcheck":'cspell "src/docs/**/*.md"',"docs:release-version":"tsx scripts/update-release-version.mts","docs:verify-version":"tsx scripts/update-release-version.mts --verify","types:build-config":"tsx scripts/create-types-from-json-schema.mts","types:verify-config":"tsx scripts/create-types-from-json-schema.mts --verify",checkCircle:"npx madge --circular ./src",prepublishOnly:"pnpm docs:verify-version"},repository:{type:"git",url:"https://github.com/mermaid-js/mermaid"},author:"Knut Sveidqvist",license:"MIT",standard:{ignore:["**/parser/*.js","dist/**/*.js","cypress/**/*.js"],globals:["page"]},dependencies:{"@braintree/sanitize-url":"^7.1.1","@iconify/utils":"^3.0.1","@mermaid-js/parser":"workspace:^","@types/d3":"^7.4.3",cytoscape:"^3.29.3","cytoscape-cose-bilkent":"^4.1.0","cytoscape-fcose":"^2.2.0",d3:"^7.9.0","d3-sankey":"^0.12.3","dagre-d3-es":"7.0.13",dayjs:"^1.11.18",dompurify:"^3.2.5",katex:"^0.16.22",khroma:"^2.1.0","lodash-es":"^4.17.21",marked:"^16.2.1",roughjs:"^4.6.6",stylis:"^4.3.6","ts-dedent":"^2.2.0",uuid:"^11.1.0"},devDependencies:{"@adobe/jsonschema2md":"^8.0.5","@iconify/types":"^2.0.0","@types/cytoscape":"^3.21.9","@types/cytoscape-fcose":"^2.2.4","@types/d3-sankey":"^0.12.4","@types/d3-scale":"^4.0.9","@types/d3-scale-chromatic":"^3.1.0","@types/d3-selection":"^3.0.11","@types/d3-shape":"^3.1.7","@types/jsdom":"^21.1.7","@types/katex":"^0.16.7","@types/lodash-es":"^4.17.12","@types/micromatch":"^4.0.9","@types/stylis":"^4.2.7","@types/uuid":"^10.0.0",ajv:"^8.17.1",canvas:"^3.1.2",chokidar:"3.6.0",concurrently:"^9.1.2","csstree-validator":"^4.0.1",globby:"^14.1.0",jison:"^0.4.18","js-base64":"^3.7.8",jsdom:"^26.1.0","json-schema-to-typescript":"^15.0.4",micromatch:"^4.0.8","path-browserify":"^1.0.1",prettier:"^3.5.3",remark:"^15.0.1","remark-frontmatter":"^5.0.0","remark-gfm":"^4.0.1",rimraf:"^6.0.1","start-server-and-test":"^2.0.13","type-fest":"^4.35.0",typedoc:"^0.28.12","typedoc-plugin-markdown":"^4.8.1",typescript:"~5.7.3","unist-util-flatmap":"^1.0.0","unist-util-visit":"^5.0.0",vitepress:"^1.6.4","vitepress-plugin-search":"1.0.4-alpha.22"},files:["dist/","README.md"],publishConfig:{access:"public"}},Aue={exports:{}};(function(t,e){(function(n,a){t.exports=a()})(xo,function(){var n=1e3,a=6e4,r=36e5,i="millisecond",o="second",s="minute",l="hour",u="day",d="week",p="month",m="quarter",A="year",g="date",h="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(B){var S=["th","st","nd","rd"],M=B%100;return"["+B+(S[(M-20)%10]||S[M]||S[0])+"]"}},w=function(B,S,M){var L=String(B);return!L||L.length>=S?B:""+Array(S+1-L.length).join(M)+B},k={s:w,z:function(B){var S=-B.utcOffset(),M=Math.abs(S),L=Math.floor(M/60),F=M%60;return(S<=0?"+":"-")+w(L,2,"0")+":"+w(F,2,"0")},m:function B(S,M){if(S.date()<M.date())return-B(M,S);var L=12*(M.year()-S.year())+(M.month()-S.month()),F=S.clone().add(L,p),R=M-F<0,P=S.clone().add(L+(R?-1:1),p);return+(-(L+(M-F)/(R?F-P:P-F))||0)},a:function(B){return B<0?Math.ceil(B)||0:Math.floor(B)},p:function(B){return{M:p,y:A,w:d,d:u,D:g,h:l,m:s,s:o,ms:i,Q:m}[B]||String(B||"").toLowerCase().replace(/s$/,"")},u:function(B){return B===void 0}},C="en",x={};x[C]=y;var _="$isDayjsObject",E=function(B){return B instanceof T||!(!B||!B[_])},I=function B(S,M,L){var F;if(!S)return C;if(typeof S=="string"){var R=S.toLowerCase();x[R]&&(F=R),M&&(x[R]=M,F=R);var P=S.split("-");if(!F&&P.length>1)return B(P[0])}else{var $=S.name;x[$]=S,F=$}return!L&&F&&(C=F),F||!L&&C},Q=function(B,S){if(E(B))return B.clone();var M=typeof S=="object"?S:{};return M.date=B,M.args=arguments,new T(M)},D=k;D.l=I,D.i=E,D.w=function(B,S){return Q(B,{locale:S.$L,utc:S.$u,x:S.$x,$offset:S.$offset})};var T=function(){function B(M){this.$L=I(M.locale,null,!0),this.parse(M),this.$x=this.$x||M.x||{},this[_]=!0}var S=B.prototype;return S.parse=function(M){this.$d=function(L){var F=L.date,R=L.utc;if(F===null)return new Date(NaN);if(D.u(F))return new Date;if(F instanceof Date)return new Date(F);if(typeof F=="string"&&!/Z$/i.test(F)){var P=F.match(f);if(P){var $=P[2]-1||0,q=(P[7]||"0").substring(0,3);return R?new Date(Date.UTC(P[1],$,P[3]||1,P[4]||0,P[5]||0,P[6]||0,q)):new Date(P[1],$,P[3]||1,P[4]||0,P[5]||0,P[6]||0,q)}}return new Date(F)}(M),this.init()},S.init=function(){var M=this.$d;this.$y=M.getFullYear(),this.$M=M.getMonth(),this.$D=M.getDate(),this.$W=M.getDay(),this.$H=M.getHours(),this.$m=M.getMinutes(),this.$s=M.getSeconds(),this.$ms=M.getMilliseconds()},S.$utils=function(){return D},S.isValid=function(){return this.$d.toString()!==h},S.isSame=function(M,L){var F=Q(M);return this.startOf(L)<=F&&F<=this.endOf(L)},S.isAfter=function(M,L){return Q(M)<this.startOf(L)},S.isBefore=function(M,L){return this.endOf(L)<Q(M)},S.$g=function(M,L,F){return D.u(M)?this[L]:this.set(F,M)},S.unix=function(){return Math.floor(this.valueOf()/1e3)},S.valueOf=function(){return this.$d.getTime()},S.startOf=function(M,L){var F=this,R=!!D.u(L)||L,P=D.p(M),$=function(V,te){var Z=D.w(F.$u?Date.UTC(F.$y,te,V):new Date(F.$y,te,V),F);return R?Z:Z.endOf(u)},q=function(V,te){return D.w(F.toDate()[V].apply(F.toDate("s"),(R?[0,0,0,0]:[23,59,59,999]).slice(te)),F)},j=this.$W,J=this.$M,Y=this.$D,ne="set"+(this.$u?"UTC":"");switch(P){case A:return R?$(1,0):$(31,11);case p:return R?$(1,J):$(0,J+1);case d:var ee=this.$locale().weekStart||0,me=(j<ee?j+7:j)-ee;return $(R?Y-me:Y+(6-me),J);case u:case g:return q(ne+"Hours",0);case l:return q(ne+"Minutes",1);case s:return q(ne+"Seconds",2);case o:return q(ne+"Milliseconds",3);default:return this.clone()}},S.endOf=function(M){return this.startOf(M,!1)},S.$set=function(M,L){var F,R=D.p(M),P="set"+(this.$u?"UTC":""),$=(F={},F[u]=P+"Date",F[g]=P+"Date",F[p]=P+"Month",F[A]=P+"FullYear",F[l]=P+"Hours",F[s]=P+"Minutes",F[o]=P+"Seconds",F[i]=P+"Milliseconds",F)[R],q=R===u?this.$D+(L-this.$W):L;if(R===p||R===A){var j=this.clone().set(g,1);j.$d[$](q),j.init(),this.$d=j.set(g,Math.min(this.$D,j.daysInMonth())).$d}else $&&this.$d[$](q);return this.init(),this},S.set=function(M,L){return this.clone().$set(M,L)},S.get=function(M){return this[D.p(M)]()},S.add=function(M,L){var F,R=this;M=Number(M);var P=D.p(L),$=function(J){var Y=Q(R);return D.w(Y.date(Y.date()+Math.round(J*M)),R)};if(P===p)return this.set(p,this.$M+M);if(P===A)return this.set(A,this.$y+M);if(P===u)return $(1);if(P===d)return $(7);var q=(F={},F[s]=a,F[l]=r,F[o]=n,F)[P]||1,j=this.$d.getTime()+M*q;return D.w(j,this)},S.subtract=function(M,L){return this.add(-1*M,L)},S.format=function(M){var L=this,F=this.$locale();if(!this.isValid())return F.invalidDate||h;var R=M||"YYYY-MM-DDTHH:mm:ssZ",P=D.z(this),$=this.$H,q=this.$m,j=this.$M,J=F.weekdays,Y=F.months,ne=F.meridiem,ee=function(te,Z,K,re){return te&&(te[Z]||te(L,R))||K[Z].slice(0,re)},me=function(te){return D.s($%12||12,te,"0")},V=ne||function(te,Z,K){var re=te<12?"AM":"PM";return K?re.toLowerCase():re};return R.replace(b,function(te,Z){return Z||function(K){switch(K){case"YY":return String(L.$y).slice(-2);case"YYYY":return D.s(L.$y,4,"0");case"M":return j+1;case"MM":return D.s(j+1,2,"0");case"MMM":return ee(F.monthsShort,j,Y,3);case"MMMM":return ee(Y,j);case"D":return L.$D;case"DD":return D.s(L.$D,2,"0");case"d":return String(L.$W);case"dd":return ee(F.weekdaysMin,L.$W,J,2);case"ddd":return ee(F.weekdaysShort,L.$W,J,3);case"dddd":return J[L.$W];case"H":return String($);case"HH":return D.s($,2,"0");case"h":return me(1);case"hh":return me(2);case"a":return V($,q,!0);case"A":return V($,q,!1);case"m":return String(q);case"mm":return D.s(q,2,"0");case"s":return String(L.$s);case"ss":return D.s(L.$s,2,"0");case"SSS":return D.s(L.$ms,3,"0");case"Z":return P}return null}(te)||P.replace(":","")})},S.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},S.diff=function(M,L,F){var R,P=this,$=D.p(L),q=Q(M),j=(q.utcOffset()-this.utcOffset())*a,J=this-q,Y=function(){return D.m(P,q)};switch($){case A:R=Y()/12;break;case p:R=Y();break;case m:R=Y()/3;break;case d:R=(J-j)/6048e5;break;case u:R=(J-j)/864e5;break;case l:R=J/r;break;case s:R=J/a;break;case o:R=J/n;break;default:R=J}return F?R:D.a(R)},S.daysInMonth=function(){return this.endOf(p).$D},S.$locale=function(){return x[this.$L]},S.locale=function(M,L){if(!M)return this.$L;var F=this.clone(),R=I(M,L,!0);return R&&(F.$L=R),F},S.clone=function(){return D.w(this.$d,this)},S.toDate=function(){return new Date(this.valueOf())},S.toJSON=function(){return this.isValid()?this.toISOString():null},S.toISOString=function(){return this.$d.toISOString()},S.toString=function(){return this.$d.toUTCString()},B}(),N=T.prototype;return Q.prototype=N,[["$ms",i],["$s",o],["$m",s],["$H",l],["$W",u],["$M",p],["$y",A],["$D",g]].forEach(function(B){N[B[1]]=function(S){return this.$g(S,B[0],B[1])}}),Q.extend=function(B,S){return B.$i||(B(S,T,Q),B.$i=!0),Q},Q.locale=I,Q.isDayjs=E,Q.unix=function(B){return Q(1e3*B)},Q.en=x[C],Q.Ls=x,Q.p={},Q})})(Aue);var qdt=Aue.exports;const wi=Fl(qdt);var gue=Object.defineProperty,v=(t,e)=>gue(t,"name",{value:e,configurable:!0}),v3=(t,e)=>{for(var n in e)gue(t,n,{get:e[n],enumerable:!0})},Id={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},se={trace:v((...t)=>{},"trace"),debug:v((...t)=>{},"debug"),info:v((...t)=>{},"info"),warn:v((...t)=>{},"warn"),error:v((...t)=>{},"error"),fatal:v((...t)=>{},"fatal")},cN=v(function(t="fatal"){let e=Id.fatal;typeof t=="string"?t.toLowerCase()in Id&&(e=Id[t]):typeof t=="number"&&(e=t),se.trace=()=>{},se.debug=()=>{},se.info=()=>{},se.warn=()=>{},se.error=()=>{},se.fatal=()=>{},e<=Id.fatal&&(se.fatal=console.error?console.error.bind(console,_c("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",_c("FATAL"))),e<=Id.error&&(se.error=console.error?console.error.bind(console,_c("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",_c("ERROR"))),e<=Id.warn&&(se.warn=console.warn?console.warn.bind(console,_c("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",_c("WARN"))),e<=Id.info&&(se.info=console.info?console.info.bind(console,_c("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",_c("INFO"))),e<=Id.debug&&(se.debug=console.debug?console.debug.bind(console,_c("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",_c("DEBUG"))),e<=Id.trace&&(se.trace=console.debug?console.debug.bind(console,_c("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",_c("TRACE")))},"setLogLevel"),_c=v(t=>`%c${wi().format("ss.SSS")} : ${t} : `,"format");const C3={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:t=>t>=255?255:t<0?0:t,g:t=>t>=255?255:t<0?0:t,b:t=>t>=255?255:t<0?0:t,h:t=>t%360,s:t=>t>=100?100:t<0?0:t,l:t=>t>=100?100:t<0?0:t,a:t=>t>=1?1:t<0?0:t},toLinear:t=>{const e=t/255;return t>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92},hue2rgb:(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t),hsl2rgb:({h:t,s:e,l:n},a)=>{if(!e)return n*2.55;t/=360,e/=100,n/=100;const r=n<.5?n*(1+e):n+e-n*e,i=2*n-r;switch(a){case"r":return C3.hue2rgb(i,r,t+1/3)*255;case"g":return C3.hue2rgb(i,r,t)*255;case"b":return C3.hue2rgb(i,r,t-1/3)*255}},rgb2hsl:({r:t,g:e,b:n},a)=>{t/=255,e/=255,n/=255;const r=Math.max(t,e,n),i=Math.min(t,e,n),o=(r+i)/2;if(a==="l")return o*100;if(r===i)return 0;const s=r-i,l=o>.5?s/(2-r-i):s/(r+i);if(a==="s")return l*100;switch(r){case t:return((e-n)/s+(e<n?6:0))*60;case e:return((n-t)/s+2)*60;case n:return((t-e)/s+4)*60;default:return-1}}},yn={channel:C3,lang:{clamp:(t,e,n)=>e>n?Math.min(e,Math.max(n,t)):Math.min(n,Math.max(e,t)),round:t=>Math.round(t*1e10)/1e10},unit:{dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}}},cm={};for(let t=0;t<=255;t++)cm[t]=yn.unit.dec2hex(t);const oo={ALL:0,RGB:1,HSL:2};let zdt=class{constructor(){this.type=oo.ALL}get(){return this.type}set(e){if(this.type&&this.type!==e)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=e}reset(){this.type=oo.ALL}is(e){return this.type===e}};class Hdt{constructor(e,n){this.color=n,this.changed=!1,this.data=e,this.type=new zdt}set(e,n){return this.color=n,this.changed=!1,this.data=e,this.type.type=oo.ALL,this}_ensureHSL(){const e=this.data,{h:n,s:a,l:r}=e;n===void 0&&(e.h=yn.channel.rgb2hsl(e,"h")),a===void 0&&(e.s=yn.channel.rgb2hsl(e,"s")),r===void 0&&(e.l=yn.channel.rgb2hsl(e,"l"))}_ensureRGB(){const e=this.data,{r:n,g:a,b:r}=e;n===void 0&&(e.r=yn.channel.hsl2rgb(e,"r")),a===void 0&&(e.g=yn.channel.hsl2rgb(e,"g")),r===void 0&&(e.b=yn.channel.hsl2rgb(e,"b"))}get r(){const e=this.data,n=e.r;return!this.type.is(oo.HSL)&&n!==void 0?n:(this._ensureHSL(),yn.channel.hsl2rgb(e,"r"))}get g(){const e=this.data,n=e.g;return!this.type.is(oo.HSL)&&n!==void 0?n:(this._ensureHSL(),yn.channel.hsl2rgb(e,"g"))}get b(){const e=this.data,n=e.b;return!this.type.is(oo.HSL)&&n!==void 0?n:(this._ensureHSL(),yn.channel.hsl2rgb(e,"b"))}get h(){const e=this.data,n=e.h;return!this.type.is(oo.RGB)&&n!==void 0?n:(this._ensureRGB(),yn.channel.rgb2hsl(e,"h"))}get s(){const e=this.data,n=e.s;return!this.type.is(oo.RGB)&&n!==void 0?n:(this._ensureRGB(),yn.channel.rgb2hsl(e,"s"))}get l(){const e=this.data,n=e.l;return!this.type.is(oo.RGB)&&n!==void 0?n:(this._ensureRGB(),yn.channel.rgb2hsl(e,"l"))}get a(){return this.data.a}set r(e){this.type.set(oo.RGB),this.changed=!0,this.data.r=e}set g(e){this.type.set(oo.RGB),this.changed=!0,this.data.g=e}set b(e){this.type.set(oo.RGB),this.changed=!0,this.data.b=e}set h(e){this.type.set(oo.HSL),this.changed=!0,this.data.h=e}set s(e){this.type.set(oo.HSL),this.changed=!0,this.data.s=e}set l(e){this.type.set(oo.HSL),this.changed=!0,this.data.l=e}set a(e){this.changed=!0,this.data.a=e}}const _3=new Hdt({r:0,g:0,b:0,a:0},"transparent"),Cb={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(t.charCodeAt(0)!==35)return;const e=t.match(Cb.re);if(!e)return;const n=e[1],a=parseInt(n,16),r=n.length,i=r%4===0,o=r>4,s=o?1:17,l=o?8:4,u=i?0:-1,d=o?255:15;return _3.set({r:(a>>l*(u+3)&d)*s,g:(a>>l*(u+2)&d)*s,b:(a>>l*(u+1)&d)*s,a:i?(a&d)*s/255:1},t)},stringify:t=>{const{r:e,g:n,b:a,a:r}=t;return r<1?`#${cm[Math.round(e)]}${cm[Math.round(n)]}${cm[Math.round(a)]}${cm[Math.round(r*255)]}`:`#${cm[Math.round(e)]}${cm[Math.round(n)]}${cm[Math.round(a)]}`}},gg={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:t=>{const e=t.match(gg.hueRe);if(e){const[,n,a]=e;switch(a){case"grad":return yn.channel.clamp.h(parseFloat(n)*.9);case"rad":return yn.channel.clamp.h(parseFloat(n)*180/Math.PI);case"turn":return yn.channel.clamp.h(parseFloat(n)*360)}}return yn.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(e!==104&&e!==72)return;const n=t.match(gg.re);if(!n)return;const[,a,r,i,o,s]=n;return _3.set({h:gg._hue2deg(a),s:yn.channel.clamp.s(parseFloat(r)),l:yn.channel.clamp.l(parseFloat(i)),a:o?yn.channel.clamp.a(s?parseFloat(o)/100:parseFloat(o)):1},t)},stringify:t=>{const{h:e,s:n,l:a,a:r}=t;return r<1?`hsla(${yn.lang.round(e)}, ${yn.lang.round(n)}%, ${yn.lang.round(a)}%, ${r})`:`hsl(${yn.lang.round(e)}, ${yn.lang.round(n)}%, ${yn.lang.round(a)}%)`}},O1={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:t=>{t=t.toLowerCase();const e=O1.colors[t];if(e)return Cb.parse(e)},stringify:t=>{const e=Cb.stringify(t);for(const n in O1.colors)if(O1.colors[n]===e)return n}},j1={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:t=>{const e=t.charCodeAt(0);if(e!==114&&e!==82)return;const n=t.match(j1.re);if(!n)return;const[,a,r,i,o,s,l,u,d]=n;return _3.set({r:yn.channel.clamp.r(r?parseFloat(a)*2.55:parseFloat(a)),g:yn.channel.clamp.g(o?parseFloat(i)*2.55:parseFloat(i)),b:yn.channel.clamp.b(l?parseFloat(s)*2.55:parseFloat(s)),a:u?yn.channel.clamp.a(d?parseFloat(u)/100:parseFloat(u)):1},t)},stringify:t=>{const{r:e,g:n,b:a,a:r}=t;return r<1?`rgba(${yn.lang.round(e)}, ${yn.lang.round(n)}, ${yn.lang.round(a)}, ${yn.lang.round(r)})`:`rgb(${yn.lang.round(e)}, ${yn.lang.round(n)}, ${yn.lang.round(a)})`}},sl={format:{keyword:O1,hex:Cb,rgb:j1,rgba:j1,hsl:gg,hsla:gg},parse:t=>{if(typeof t!="string")return t;const e=Cb.parse(t)||j1.parse(t)||gg.parse(t)||O1.parse(t);if(e)return e;throw new Error(`Unsupported color format: "${t}"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(oo.HSL)||t.data.r===void 0?gg.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?j1.stringify(t):Cb.stringify(t)},hue=(t,e)=>{const n=sl.parse(t);for(const a in e)n[a]=yn.channel.clamp[a](e[a]);return sl.stringify(n)},lm=(t,e,n=0,a=1)=>{if(typeof t!="number")return hue(t,{a:e});const r=_3.set({r:yn.channel.clamp.r(t),g:yn.channel.clamp.g(e),b:yn.channel.clamp.b(n),a:yn.channel.clamp.a(a)});return sl.stringify(r)},lN=(t,e)=>yn.lang.round(sl.parse(t)[e]),Udt=t=>{const{r:e,g:n,b:a}=sl.parse(t),r=.2126*yn.channel.toLinear(e)+.7152*yn.channel.toLinear(n)+.0722*yn.channel.toLinear(a);return yn.lang.round(r)},Ydt=t=>Udt(t)>=.5,um=t=>!Ydt(t),fue=(t,e,n)=>{const a=sl.parse(t),r=a[e],i=yn.channel.clamp[e](r+n);return r!==i&&(a[e]=i),sl.stringify(a)},Yt=(t,e)=>fue(t,"l",e),an=(t,e)=>fue(t,"l",-e),Ge=(t,e)=>{const n=sl.parse(t),a={};for(const r in e)e[r]&&(a[r]=n[r]+e[r]);return hue(t,a)},Wdt=(t,e,n=50)=>{const{r:a,g:r,b:i,a:o}=sl.parse(t),{r:s,g:l,b:u,a:d}=sl.parse(e),p=n/100,m=p*2-1,A=o-d,h=((m*A===-1?m:(m+A)/(1+m*A))+1)/2,f=1-h,b=a*h+s*f,y=r*h+l*f,w=i*h+u*f,k=o*p+d*(1-p);return lm(b,y,w,k)},Lt=(t,e=100)=>{const n=sl.parse(t);return n.r=255-n.r,n.g=255-n.g,n.b=255-n.b,Wdt(n,t,e)};/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:bue,setPrototypeOf:yue,isFrozen:Kdt,getPrototypeOf:Zdt,getOwnPropertyDescriptor:Vdt}=Object;let{freeze:Po,seal:xc,create:uN}=Object,{apply:dN,construct:pN}=typeof Reflect<"u"&&Reflect;Po||(Po=function(e){return e}),xc||(xc=function(e){return e}),dN||(dN=function(e,n){for(var a=arguments.length,r=new Array(a>2?a-2:0),i=2;i<a;i++)r[i-2]=arguments[i];return e.apply(n,r)}),pN||(pN=function(e){for(var n=arguments.length,a=new Array(n>1?n-1:0),r=1;r<n;r++)a[r-1]=arguments[r];return new e(...a)});const x3=Oo(Array.prototype.forEach),Jdt=Oo(Array.prototype.lastIndexOf),wue=Oo(Array.prototype.pop),G1=Oo(Array.prototype.push),Xdt=Oo(Array.prototype.splice),E3=Oo(String.prototype.toLowerCase),mN=Oo(String.prototype.toString),AN=Oo(String.prototype.match),q1=Oo(String.prototype.replace),ept=Oo(String.prototype.indexOf),tpt=Oo(String.prototype.trim),cl=Oo(Object.prototype.hasOwnProperty),$o=Oo(RegExp.prototype.test),z1=npt(TypeError);function Oo(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,a=new Array(n>1?n-1:0),r=1;r<n;r++)a[r-1]=arguments[r];return dN(t,e,a)}}function npt(t){return function(){for(var e=arguments.length,n=new Array(e),a=0;a<e;a++)n[a]=arguments[a];return pN(t,n)}}function Pn(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:E3;yue&&yue(t,null);let a=e.length;for(;a--;){let r=e[a];if(typeof r=="string"){const i=n(r);i!==r&&(Kdt(e)||(e[a]=i),r=i)}t[r]=!0}return t}function apt(t){for(let e=0;e<t.length;e++)cl(t,e)||(t[e]=null);return t}function Au(t){const e=uN(null);for(const[n,a]of bue(t))cl(t,n)&&(Array.isArray(a)?e[n]=apt(a):a&&typeof a=="object"&&a.constructor===Object?e[n]=Au(a):e[n]=a);return e}function H1(t,e){for(;t!==null;){const a=Vdt(t,e);if(a){if(a.get)return Oo(a.get);if(typeof a.value=="function")return Oo(a.value)}t=Zdt(t)}function n(){return null}return n}const kue=Po(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),gN=Po(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),hN=Po(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),rpt=Po(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),fN=Po(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),ipt=Po(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),vue=Po(["#text"]),Cue=Po(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),bN=Po(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),_ue=Po(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),B3=Po(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),opt=xc(/\{\{[\w\W]*|[\w\W]*\}\}/gm),spt=xc(/<%[\w\W]*|[\w\W]*%>/gm),cpt=xc(/\$\{[\w\W]*/gm),lpt=xc(/^data-[\-\w.\u00B7-\uFFFF]+$/),upt=xc(/^aria-[\-\w]+$/),xue=xc(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),dpt=xc(/^(?:\w+script|data):/i),ppt=xc(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Eue=xc(/^html$/i),mpt=xc(/^[a-z][.\w]*(-[.\w]+)+$/i);var Bue=Object.freeze({__proto__:null,ARIA_ATTR:upt,ATTR_WHITESPACE:ppt,CUSTOM_ELEMENT:mpt,DATA_ATTR:lpt,DOCTYPE_NAME:Eue,ERB_EXPR:spt,IS_ALLOWED_URI:xue,IS_SCRIPT_OR_DATA:dpt,MUSTACHE_EXPR:opt,TMPLIT_EXPR:cpt});const U1={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Apt=function(){return typeof window>"u"?null:window},gpt=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let a=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(a=n.getAttribute(r));const i="dompurify"+(a?"#"+a:"");try{return e.createPolicy(i,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Iue=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Due(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Apt();const e=Bt=>Due(Bt);if(e.version="3.3.1",e.removed=[],!t||!t.document||t.document.nodeType!==U1.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const a=n,r=a.currentScript,{DocumentFragment:i,HTMLTemplateElement:o,Node:s,Element:l,NodeFilter:u,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:m,trustedTypes:A}=t,g=l.prototype,h=H1(g,"cloneNode"),f=H1(g,"remove"),b=H1(g,"nextSibling"),y=H1(g,"childNodes"),w=H1(g,"parentNode");if(typeof o=="function"){const Bt=n.createElement("template");Bt.content&&Bt.content.ownerDocument&&(n=Bt.content.ownerDocument)}let k,C="";const{implementation:x,createNodeIterator:_,createDocumentFragment:E,getElementsByTagName:I}=n,{importNode:Q}=a;let D=Iue();e.isSupported=typeof bue=="function"&&typeof w=="function"&&x&&x.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:T,ERB_EXPR:N,TMPLIT_EXPR:B,DATA_ATTR:S,ARIA_ATTR:M,IS_SCRIPT_OR_DATA:L,ATTR_WHITESPACE:F,CUSTOM_ELEMENT:R}=Bue;let{IS_ALLOWED_URI:P}=Bue,$=null;const q=Pn({},[...kue,...gN,...hN,...fN,...vue]);let j=null;const J=Pn({},[...Cue,...bN,..._ue,...B3]);let Y=Object.seal(uN(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ne=null,ee=null;const me=Object.seal(uN(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let V=!0,te=!0,Z=!1,K=!0,re=!1,X=!0,we=!1,ie=!1,Me=!1,W=!1,je=!1,he=!1,Ke=!0,Ze=!1;const Je="user-content-";let Fe=!0,qe=!1,de={},Ce=null;const Re=Pn({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ge=null;const Ne=Pn({},["audio","video","img","source","image","track"]);let ae=null;const pe=Pn({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),G="http://www.w3.org/1998/Math/MathML",le="http://www.w3.org/2000/svg",ce="http://www.w3.org/1999/xhtml";let ye=ce,fe=!1,Be=null;const Le=Pn({},[G,le,ce],mN);let Se=Pn({},["mi","mo","mn","ms","mtext"]),Oe=Pn({},["annotation-xml"]);const ot=Pn({},["title","style","font","a","script"]);let rt=null;const ct=["application/xhtml+xml","text/html"],ut="text/html";let He=null,tt=null;const Et=n.createElement("form"),kt=function(Te){return Te instanceof RegExp||Te instanceof Function},et=function(){let Te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(tt&&tt===Te)){if((!Te||typeof Te!="object")&&(Te={}),Te=Au(Te),rt=ct.indexOf(Te.PARSER_MEDIA_TYPE)===-1?ut:Te.PARSER_MEDIA_TYPE,He=rt==="application/xhtml+xml"?mN:E3,$=cl(Te,"ALLOWED_TAGS")?Pn({},Te.ALLOWED_TAGS,He):q,j=cl(Te,"ALLOWED_ATTR")?Pn({},Te.ALLOWED_ATTR,He):J,Be=cl(Te,"ALLOWED_NAMESPACES")?Pn({},Te.ALLOWED_NAMESPACES,mN):Le,ae=cl(Te,"ADD_URI_SAFE_ATTR")?Pn(Au(pe),Te.ADD_URI_SAFE_ATTR,He):pe,ge=cl(Te,"ADD_DATA_URI_TAGS")?Pn(Au(Ne),Te.ADD_DATA_URI_TAGS,He):Ne,Ce=cl(Te,"FORBID_CONTENTS")?Pn({},Te.FORBID_CONTENTS,He):Re,ne=cl(Te,"FORBID_TAGS")?Pn({},Te.FORBID_TAGS,He):Au({}),ee=cl(Te,"FORBID_ATTR")?Pn({},Te.FORBID_ATTR,He):Au({}),de=cl(Te,"USE_PROFILES")?Te.USE_PROFILES:!1,V=Te.ALLOW_ARIA_ATTR!==!1,te=Te.ALLOW_DATA_ATTR!==!1,Z=Te.ALLOW_UNKNOWN_PROTOCOLS||!1,K=Te.ALLOW_SELF_CLOSE_IN_ATTR!==!1,re=Te.SAFE_FOR_TEMPLATES||!1,X=Te.SAFE_FOR_XML!==!1,we=Te.WHOLE_DOCUMENT||!1,W=Te.RETURN_DOM||!1,je=Te.RETURN_DOM_FRAGMENT||!1,he=Te.RETURN_TRUSTED_TYPE||!1,Me=Te.FORCE_BODY||!1,Ke=Te.SANITIZE_DOM!==!1,Ze=Te.SANITIZE_NAMED_PROPS||!1,Fe=Te.KEEP_CONTENT!==!1,qe=Te.IN_PLACE||!1,P=Te.ALLOWED_URI_REGEXP||xue,ye=Te.NAMESPACE||ce,Se=Te.MATHML_TEXT_INTEGRATION_POINTS||Se,Oe=Te.HTML_INTEGRATION_POINTS||Oe,Y=Te.CUSTOM_ELEMENT_HANDLING||{},Te.CUSTOM_ELEMENT_HANDLING&&kt(Te.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Y.tagNameCheck=Te.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Te.CUSTOM_ELEMENT_HANDLING&&kt(Te.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Y.attributeNameCheck=Te.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Te.CUSTOM_ELEMENT_HANDLING&&typeof Te.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Y.allowCustomizedBuiltInElements=Te.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),re&&(te=!1),je&&(W=!0),de&&($=Pn({},vue),j=[],de.html===!0&&(Pn($,kue),Pn(j,Cue)),de.svg===!0&&(Pn($,gN),Pn(j,bN),Pn(j,B3)),de.svgFilters===!0&&(Pn($,hN),Pn(j,bN),Pn(j,B3)),de.mathMl===!0&&(Pn($,fN),Pn(j,_ue),Pn(j,B3))),Te.ADD_TAGS&&(typeof Te.ADD_TAGS=="function"?me.tagCheck=Te.ADD_TAGS:($===q&&($=Au($)),Pn($,Te.ADD_TAGS,He))),Te.ADD_ATTR&&(typeof Te.ADD_ATTR=="function"?me.attributeCheck=Te.ADD_ATTR:(j===J&&(j=Au(j)),Pn(j,Te.ADD_ATTR,He))),Te.ADD_URI_SAFE_ATTR&&Pn(ae,Te.ADD_URI_SAFE_ATTR,He),Te.FORBID_CONTENTS&&(Ce===Re&&(Ce=Au(Ce)),Pn(Ce,Te.FORBID_CONTENTS,He)),Te.ADD_FORBID_CONTENTS&&(Ce===Re&&(Ce=Au(Ce)),Pn(Ce,Te.ADD_FORBID_CONTENTS,He)),Fe&&($["#text"]=!0),we&&Pn($,["html","head","body"]),$.table&&(Pn($,["tbody"]),delete ne.tbody),Te.TRUSTED_TYPES_POLICY){if(typeof Te.TRUSTED_TYPES_POLICY.createHTML!="function")throw z1('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Te.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw z1('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=Te.TRUSTED_TYPES_POLICY,C=k.createHTML("")}else k===void 0&&(k=gpt(A,r)),k!==null&&typeof C=="string"&&(C=k.createHTML(""));Po&&Po(Te),tt=Te}},jt=Pn({},[...gN,...hN,...rpt]),nt=Pn({},[...fN,...ipt]),gt=function(Te){let pt=w(Te);(!pt||!pt.tagName)&&(pt={namespaceURI:ye,tagName:"template"});const Mt=E3(Te.tagName),zn=E3(pt.tagName);return Be[Te.namespaceURI]?Te.namespaceURI===le?pt.namespaceURI===ce?Mt==="svg":pt.namespaceURI===G?Mt==="svg"&&(zn==="annotation-xml"||Se[zn]):!!jt[Mt]:Te.namespaceURI===G?pt.namespaceURI===ce?Mt==="math":pt.namespaceURI===le?Mt==="math"&&Oe[zn]:!!nt[Mt]:Te.namespaceURI===ce?pt.namespaceURI===le&&!Oe[zn]||pt.namespaceURI===G&&!Se[zn]?!1:!nt[Mt]&&(ot[Mt]||!jt[Mt]):!!(rt==="application/xhtml+xml"&&Be[Te.namespaceURI]):!1},Ct=function(Te){G1(e.removed,{element:Te});try{w(Te).removeChild(Te)}catch{f(Te)}},xt=function(Te,pt){try{G1(e.removed,{attribute:pt.getAttributeNode(Te),from:pt})}catch{G1(e.removed,{attribute:null,from:pt})}if(pt.removeAttribute(Te),Te==="is")if(W||je)try{Ct(pt)}catch{}else try{pt.setAttribute(Te,"")}catch{}},ht=function(Te){let pt=null,Mt=null;if(Me)Te="<remove></remove>"+Te;else{const Zn=AN(Te,/^[\r\n\t ]+/);Mt=Zn&&Zn[0]}rt==="application/xhtml+xml"&&ye===ce&&(Te='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Te+"</body></html>");const zn=k?k.createHTML(Te):Te;if(ye===ce)try{pt=new m().parseFromString(zn,rt)}catch{}if(!pt||!pt.documentElement){pt=x.createDocument(ye,"template",null);try{pt.documentElement.innerHTML=fe?C:zn}catch{}}const Ha=pt.body||pt.documentElement;return Te&&Mt&&Ha.insertBefore(n.createTextNode(Mt),Ha.childNodes[0]||null),ye===ce?I.call(pt,we?"html":"body")[0]:we?pt.documentElement:Ha},Nt=function(Te){return _.call(Te.ownerDocument||Te,Te,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Qn=function(Te){return Te instanceof p&&(typeof Te.nodeName!="string"||typeof Te.textContent!="string"||typeof Te.removeChild!="function"||!(Te.attributes instanceof d)||typeof Te.removeAttribute!="function"||typeof Te.setAttribute!="function"||typeof Te.namespaceURI!="string"||typeof Te.insertBefore!="function"||typeof Te.hasChildNodes!="function")},on=function(Te){return typeof s=="function"&&Te instanceof s};function $n(Bt,Te,pt){x3(Bt,Mt=>{Mt.call(e,Te,pt,tt)})}const ua=function(Te){let pt=null;if($n(D.beforeSanitizeElements,Te,null),Qn(Te))return Ct(Te),!0;const Mt=He(Te.nodeName);if($n(D.uponSanitizeElement,Te,{tagName:Mt,allowedTags:$}),X&&Te.hasChildNodes()&&!on(Te.firstElementChild)&&$o(/<[/\w!]/g,Te.innerHTML)&&$o(/<[/\w!]/g,Te.textContent)||Te.nodeType===U1.progressingInstruction||X&&Te.nodeType===U1.comment&&$o(/<[/\w]/g,Te.data))return Ct(Te),!0;if(!(me.tagCheck instanceof Function&&me.tagCheck(Mt))&&(!$[Mt]||ne[Mt])){if(!ne[Mt]&&hn(Mt)&&(Y.tagNameCheck instanceof RegExp&&$o(Y.tagNameCheck,Mt)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(Mt)))return!1;if(Fe&&!Ce[Mt]){const zn=w(Te)||Te.parentNode,Ha=y(Te)||Te.childNodes;if(Ha&&zn){const Zn=Ha.length;for(let tr=Zn-1;tr>=0;--tr){const Co=h(Ha[tr],!0);Co.__removalCount=(Te.__removalCount||0)+1,zn.insertBefore(Co,b(Te))}}}return Ct(Te),!0}return Te instanceof l&&!gt(Te)||(Mt==="noscript"||Mt==="noembed"||Mt==="noframes")&&$o(/<\/no(script|embed|frames)/i,Te.innerHTML)?(Ct(Te),!0):(re&&Te.nodeType===U1.text&&(pt=Te.textContent,x3([T,N,B],zn=>{pt=q1(pt,zn," ")}),Te.textContent!==pt&&(G1(e.removed,{element:Te.cloneNode()}),Te.textContent=pt)),$n(D.afterSanitizeElements,Te,null),!1)},On=function(Te,pt,Mt){if(Ke&&(pt==="id"||pt==="name")&&(Mt in n||Mt in Et))return!1;if(!(te&&!ee[pt]&&$o(S,pt))){if(!(V&&$o(M,pt))){if(!(me.attributeCheck instanceof Function&&me.attributeCheck(pt,Te))){if(!j[pt]||ee[pt]){if(!(hn(Te)&&(Y.tagNameCheck instanceof RegExp&&$o(Y.tagNameCheck,Te)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(Te))&&(Y.attributeNameCheck instanceof RegExp&&$o(Y.attributeNameCheck,pt)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(pt,Te))||pt==="is"&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&$o(Y.tagNameCheck,Mt)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(Mt))))return!1}else if(!ae[pt]){if(!$o(P,q1(Mt,F,""))){if(!((pt==="src"||pt==="xlink:href"||pt==="href")&&Te!=="script"&&ept(Mt,"data:")===0&&ge[Te])){if(!(Z&&!$o(L,q1(Mt,F,"")))){if(Mt)return!1}}}}}}}return!0},hn=function(Te){return Te!=="annotation-xml"&&AN(Te,R)},Kn=function(Te){$n(D.beforeSanitizeAttributes,Te,null);const{attributes:pt}=Te;if(!pt||Qn(Te))return;const Mt={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:j,forceKeepAttr:void 0};let zn=pt.length;for(;zn--;){const Ha=pt[zn],{name:Zn,namespaceURI:tr,value:Co}=Ha,zr=He(Zn),Hr=Co;let Dt=Zn==="value"?Hr:tpt(Hr);if(Mt.attrName=zr,Mt.attrValue=Dt,Mt.keepAttr=!0,Mt.forceKeepAttr=void 0,$n(D.uponSanitizeAttribute,Te,Mt),Dt=Mt.attrValue,Ze&&(zr==="id"||zr==="name")&&(xt(Zn,Te),Dt=Je+Dt),X&&$o(/((--!?|])>)|<\/(style|title|textarea)/i,Dt)){xt(Zn,Te);continue}if(zr==="attributename"&&AN(Dt,"href")){xt(Zn,Te);continue}if(Mt.forceKeepAttr)continue;if(!Mt.keepAttr){xt(Zn,Te);continue}if(!K&&$o(/\/>/i,Dt)){xt(Zn,Te);continue}re&&x3([T,N,B],vt=>{Dt=q1(Dt,vt," ")});const Rt=He(Te.nodeName);if(!On(Rt,zr,Dt)){xt(Zn,Te);continue}if(k&&typeof A=="object"&&typeof A.getAttributeType=="function"&&!tr)switch(A.getAttributeType(Rt,zr)){case"TrustedHTML":{Dt=k.createHTML(Dt);break}case"TrustedScriptURL":{Dt=k.createScriptURL(Dt);break}}if(Dt!==Hr)try{tr?Te.setAttributeNS(tr,Zn,Dt):Te.setAttribute(Zn,Dt),Qn(Te)?Ct(Te):wue(e.removed)}catch{xt(Zn,Te)}}$n(D.afterSanitizeAttributes,Te,null)},fr=function Bt(Te){let pt=null;const Mt=Nt(Te);for($n(D.beforeSanitizeShadowDOM,Te,null);pt=Mt.nextNode();)$n(D.uponSanitizeShadowNode,pt,null),ua(pt),Kn(pt),pt.content instanceof i&&Bt(pt.content);$n(D.afterSanitizeShadowDOM,Te,null)};return e.sanitize=function(Bt){let Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},pt=null,Mt=null,zn=null,Ha=null;if(fe=!Bt,fe&&(Bt="<!-->"),typeof Bt!="string"&&!on(Bt))if(typeof Bt.toString=="function"){if(Bt=Bt.toString(),typeof Bt!="string")throw z1("dirty is not a string, aborting")}else throw z1("toString is not a function");if(!e.isSupported)return Bt;if(ie||et(Te),e.removed=[],typeof Bt=="string"&&(qe=!1),qe){if(Bt.nodeName){const Co=He(Bt.nodeName);if(!$[Co]||ne[Co])throw z1("root node is forbidden and cannot be sanitized in-place")}}else if(Bt instanceof s)pt=ht("<!---->"),Mt=pt.ownerDocument.importNode(Bt,!0),Mt.nodeType===U1.element&&Mt.nodeName==="BODY"||Mt.nodeName==="HTML"?pt=Mt:pt.appendChild(Mt);else{if(!W&&!re&&!we&&Bt.indexOf("<")===-1)return k&&he?k.createHTML(Bt):Bt;if(pt=ht(Bt),!pt)return W?null:he?C:""}pt&&Me&&Ct(pt.firstChild);const Zn=Nt(qe?Bt:pt);for(;zn=Zn.nextNode();)ua(zn),Kn(zn),zn.content instanceof i&&fr(zn.content);if(qe)return Bt;if(W){if(je)for(Ha=E.call(pt.ownerDocument);pt.firstChild;)Ha.appendChild(pt.firstChild);else Ha=pt;return(j.shadowroot||j.shadowrootmode)&&(Ha=Q.call(a,Ha,!0)),Ha}let tr=we?pt.outerHTML:pt.innerHTML;return we&&$["!doctype"]&&pt.ownerDocument&&pt.ownerDocument.doctype&&pt.ownerDocument.doctype.name&&$o(Eue,pt.ownerDocument.doctype.name)&&(tr="<!DOCTYPE "+pt.ownerDocument.doctype.name+`>
|
|
1361
|
+
`:a=="r"?"\r":a=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new Xlt(this):new Vlt(this)}getCursor(e,n=0,a){let r=e.doc?e:Hn.create({doc:e});return a==null&&(a=r.doc.length),this.regexp?bb(this,r,n,a):fb(this,r,n,a)}}class ble{constructor(e){this.spec=e}}function fb(t,e,n,a){return new Ab(e.doc,t.unquoted,n,a,t.caseSensitive?void 0:r=>r.toLowerCase(),t.wholeWord?Zlt(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function Zlt(t,e){return(n,a,r,i)=>((i>n||i+r.length<a)&&(i=Math.max(0,n-2),r=t.sliceString(i,Math.min(t.length,a+2))),(e(o3(r,n-i))!=Wa.Word||e(s3(r,n-i))!=Wa.Word)&&(e(s3(r,a-i))!=Wa.Word||e(o3(r,a-i))!=Wa.Word))}class Vlt extends ble{constructor(e){super(e)}nextMatch(e,n,a){let r=fb(this.spec,e,a,e.doc.length).nextOverlapping();if(r.done){let i=Math.min(e.doc.length,n+this.spec.unquoted.length);r=fb(this.spec,e,0,i).nextOverlapping()}return r.done||r.value.from==n&&r.value.to==a?null:r.value}prevMatchInRange(e,n,a){for(let r=a;;){let i=Math.max(n,r-1e4-this.spec.unquoted.length),o=fb(this.spec,e,i,r),s=null;for(;!o.nextOverlapping().done;)s=o.value;if(s)return s;if(i==n)return null;r-=1e4}}prevMatch(e,n,a){let r=this.prevMatchInRange(e,0,n);return r||(r=this.prevMatchInRange(e,Math.max(0,a-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=n||r.to!=a)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let a=fb(this.spec,e,0,e.doc.length),r=[];for(;!a.next().done;){if(r.length>=n)return null;r.push(a.value)}return r}highlight(e,n,a,r){let i=fb(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(a+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}function bb(t,e,n,a){return new mle(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?Jlt(e.charCategorizer(e.selection.main.head)):void 0},n,a)}function o3(t,e){return t.slice(Fi(t,e,!1),e)}function s3(t,e){return t.slice(e,Fi(t,e))}function Jlt(t){return(e,n,a)=>!a[0].length||(t(o3(a.input,a.index))!=Wa.Word||t(s3(a.input,a.index))!=Wa.Word)&&(t(s3(a.input,a.index+a[0].length))!=Wa.Word||t(o3(a.input,a.index+a[0].length))!=Wa.Word)}class Xlt extends ble{nextMatch(e,n,a){let r=bb(this.spec,e,a,e.doc.length).next();return r.done&&(r=bb(this.spec,e,0,n).next()),r.done?null:r.value}prevMatchInRange(e,n,a){for(let r=1;;r++){let i=Math.max(n,a-r*1e4),o=bb(this.spec,e,i,a),s=null;for(;!o.next().done;)s=o.value;if(s&&(i==n||s.from>i+10))return s;if(i==n)return null}}prevMatch(e,n,a){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,a,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,a)=>{if(a=="&")return e.match[0];if(a=="$")return"$";for(let r=a.length;r>0;r--){let i=+a.slice(0,r);if(i>0&&i<e.match.length)return e.match[i]+a.slice(r)}return n})}matchAll(e,n){let a=bb(this.spec,e,0,e.doc.length),r=[];for(;!a.next().done;){if(r.length>=n)return null;r.push(a.value)}return r}highlight(e,n,a,r){let i=bb(this.spec,e,Math.max(0,n-250),Math.min(a+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}const L1=Bn.define(),HL=Bn.define(),sm=Li.define({create(t){return new UL(WL(t).create(),null)},update(t,e){for(let n of e.effects)n.is(L1)?t=new UL(n.value.create(),t.panel):n.is(HL)&&(t=new UL(t.query,n.value?YL:null));return t},provide:t=>v1.from(t,e=>e.panel)});class UL{constructor(e,n){this.query=e,this.panel=n}}const eut=ln.mark({class:"cm-searchMatch"}),tut=ln.mark({class:"cm-searchMatch cm-searchMatch-selected"}),nut=vr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(sm))}update(t){let e=t.state.field(sm);(e!=t.startState.field(sm)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ln.none;let{view:n}=this,a=new kd;for(let r=0,i=n.visibleRanges,o=i.length;r<o;r++){let{from:s,to:l}=i[r];for(;r<o-1&&l>i[r+1].from-2*250;)l=i[++r].to;t.highlight(n.state,s,l,(u,d)=>{let p=n.state.selection.ranges.some(m=>m.from==u&&m.to==d);a.add(u,d,p?tut:eut)})}return a.finish()}},{decorations:t=>t.decorations});function N1(t){return e=>{let n=e.state.field(sm,!1);return n&&n.query.spec.valid?t(e,n):vle(e)}}const c3=N1((t,{query:e})=>{let{to:n}=t.state.selection.main,a=e.nextMatch(t.state,n,n);if(!a)return!1;let r=lt.single(a.from,a.to),i=t.state.facet(hb);return t.dispatch({selection:r,effects:[KL(t,a),i.scrollToMatch(r.main,t)],userEvent:"select.search"}),kle(t),!0}),l3=N1((t,{query:e})=>{let{state:n}=t,{from:a}=n.selection.main,r=e.prevMatch(n,a,a);if(!r)return!1;let i=lt.single(r.from,r.to),o=t.state.facet(hb);return t.dispatch({selection:i,effects:[KL(t,r),o.scrollToMatch(i.main,t)],userEvent:"select.search"}),kle(t),!0}),aut=N1((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:lt.create(n.map(a=>lt.range(a.from,a.to))),userEvent:"select.search.matches"}),!0)}),rut=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:a,to:r}=n.main,i=[],o=0;for(let s=new Ab(t.doc,t.sliceDoc(a,r));!s.next().done;){if(i.length>1e3)return!1;s.value.from==a&&(o=i.length),i.push(lt.range(s.value.from,s.value.to))}return e(t.update({selection:lt.create(i,o),userEvent:"select.search.matches"})),!0},yle=N1((t,{query:e})=>{let{state:n}=t,{from:a,to:r}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,a,a);if(!i)return!1;let o=i,s=[],l,u,d=[];o.from==a&&o.to==r&&(u=n.toText(e.getReplacement(o)),s.push({from:o.from,to:o.to,insert:u}),o=e.nextMatch(n,o.from,o.to),d.push(Ot.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(a).number)+".")));let p=t.state.changes(s);return o&&(l=lt.single(o.from,o.to).map(p),d.push(KL(t,o)),d.push(n.facet(hb).scrollToMatch(l.main,t))),t.dispatch({changes:p,selection:l,effects:d,userEvent:"input.replace"}),!0}),iut=N1((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(r=>{let{from:i,to:o}=r;return{from:i,to:o,insert:e.getReplacement(r)}});if(!n.length)return!1;let a=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:Ot.announce.of(a),userEvent:"input.replace.all"}),!0});function YL(t){return t.state.facet(hb).createPanel(t)}function WL(t,e){var n,a,r,i,o;let s=t.selection.main,l=s.empty||s.to>s.from+100?"":t.sliceDoc(s.from,s.to);if(e&&!l)return e;let u=t.facet(hb);return new fle({search:((n=e==null?void 0:e.literal)!==null&&n!==void 0?n:u.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(a=e==null?void 0:e.caseSensitive)!==null&&a!==void 0?a:u.caseSensitive,literal:(r=e==null?void 0:e.literal)!==null&&r!==void 0?r:u.literal,regexp:(i=e==null?void 0:e.regexp)!==null&&i!==void 0?i:u.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:u.wholeWord})}function wle(t){let e=k1(t,YL);return e&&e.dom.querySelector("[main-field]")}function kle(t){let e=wle(t);e&&e==t.root.activeElement&&e.select()}const vle=t=>{let e=t.state.field(sm,!1);if(e&&e.panel){let n=wle(t);if(n&&n!=t.root.activeElement){let a=WL(t.state,e.query.spec);a.valid&&t.dispatch({effects:L1.of(a)}),n.focus(),n.select()}}else t.dispatch({effects:[HL.of(!0),e?L1.of(WL(t.state,e.query.spec)):Bn.appendConfig.of(lut)]});return!0},Cle=t=>{let e=t.state.field(sm,!1);if(!e||!e.panel)return!1;let n=k1(t,YL);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:HL.of(!1)}),!0},out=[{key:"Mod-f",run:vle,scope:"editor search-panel"},{key:"F3",run:c3,shift:l3,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:c3,shift:l3,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Cle,scope:"editor search-panel"},{key:"Mod-Shift-l",run:rut},{key:"Mod-Alt-g",run:Rlt},{key:"Mod-d",run:Klt,preventDefault:!0}];class sut{constructor(e){this.view=e;let n=this.query=e.state.field(sm).query.spec;this.commit=this.commit.bind(this),this.searchField=Ea("input",{value:n.search,placeholder:$s(e,"Find"),"aria-label":$s(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ea("input",{value:n.replace,placeholder:$s(e,"Replace"),"aria-label":$s(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ea("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Ea("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Ea("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function a(r,i,o){return Ea("button",{class:"cm-button",name:r,onclick:i,type:"button"},o)}this.dom=Ea("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,a("next",()=>c3(e),[$s(e,"next")]),a("prev",()=>l3(e),[$s(e,"previous")]),a("select",()=>aut(e),[$s(e,"all")]),Ea("label",null,[this.caseField,$s(e,"match case")]),Ea("label",null,[this.reField,$s(e,"regexp")]),Ea("label",null,[this.wordField,$s(e,"by word")]),...e.state.readOnly?[]:[Ea("br"),this.replaceField,a("replace",()=>yle(e),[$s(e,"replace")]),a("replaceAll",()=>iut(e),[$s(e,"replace all")])],Ea("button",{name:"close",onclick:()=>Cle(e),"aria-label":$s(e,"close"),type:"button"},["×"])])}commit(){let e=new fle({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:L1.of(e)}))}keydown(e){hot(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?l3:c3)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),yle(this.view))}update(e){for(let n of e.transactions)for(let a of n.effects)a.is(L1)&&!a.value.eq(this.query)&&this.setQuery(a.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(hb).top}}function $s(t,e){return t.state.phrase(e)}const u3=30,d3=/[\s\.,:;?!]/;function KL(t,{from:e,to:n}){let a=t.state.doc.lineAt(e),r=t.state.doc.lineAt(n).to,i=Math.max(a.from,e-u3),o=Math.min(r,n+u3),s=t.state.sliceDoc(i,o);if(i!=a.from){for(let l=0;l<u3;l++)if(!d3.test(s[l+1])&&d3.test(s[l])){s=s.slice(l);break}}if(o!=r){for(let l=s.length-1;l>s.length-u3;l--)if(!d3.test(s[l-1])&&d3.test(s[l])){s=s.slice(0,l);break}}return Ot.announce.of(`${t.state.phrase("current match")}. ${s} ${t.state.phrase("on line")} ${a.number}.`)}const cut=Ot.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),lut=[sm,ag.low(nut),cut];class _le{constructor(e,n,a,r){this.state=e,this.pos=n,this.explicit=a,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=ro(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),a=Math.max(n.from,this.pos-250),r=n.text.slice(a-n.from,this.pos-n.from),i=r.search(Ble(e,!1));return i<0?null:{from:a+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,a){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),a&&a.onDocChange&&(this.abortOnDocChange=!0))}}function xle(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function uut(t){let e=Object.create(null),n=Object.create(null);for(let{label:r}of t){e[r[0]]=!0;for(let i=1;i<r.length;i++)n[r[i]]=!0}let a=xle(e)+xle(n)+"*$";return[new RegExp("^"+a),new RegExp(a)]}function dut(t){let e=t.map(r=>typeof r=="string"?{label:r}:r),[n,a]=e.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:uut(e);return r=>{let i=r.matchBefore(a);return i||r.explicit?{from:i?i.from:r.pos,options:e,validFor:n}:null}}let Ele=class{constructor(e,n,a,r){this.completion=e,this.source=n,this.match=a,this.score=r}};function pg(t){return t.selection.main.from}function Ble(t,e){var n;let{source:a}=t,r=e&&a[0]!="^",i=a[a.length-1]!="$";return!r&&!i?t:new RegExp(`${r?"^":""}(?:${a})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const Ile=ru.define();function put(t,e,n,a){let{main:r}=t.selection,i=n-r.from,o=a-r.from;return{...t.changeByRange(s=>{if(s!=r&&n!=a&&t.sliceDoc(s.from+i,s.from+o)!=t.sliceDoc(n,a))return{range:s};let l=t.toText(e);return{changes:{from:s.from+i,to:a==r.from?s.to:s.from+o,insert:l},range:lt.cursor(s.from+i+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Dle=new WeakMap;function mut(t){if(!Array.isArray(t))return t;let e=Dle.get(t);return e||Dle.set(t,e=dut(t)),e}const p3=Bn.define(),M1=Bn.define();class Aut{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let a=ls(e,n),r=nu(a);this.chars.push(a);let i=e.slice(n,n+r),o=i.toUpperCase();this.folded.push(ls(o==i?i.toLowerCase():o,0)),n+=r}this.astral=e.length!=this.chars.length}ret(e,n){return this.score=e,this.matched=n,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:a,any:r,precise:i,byWord:o}=this;if(n.length==1){let y=ls(e,0),w=nu(y),k=w==e.length?0:-100;if(y!=n[0])if(y==a[0])k+=-200;else return null;return this.ret(k,[0,w])}let s=e.indexOf(this.pattern);if(s==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,u=0;if(s<0){for(let y=0,w=Math.min(e.length,200);y<w&&u<l;){let k=ls(e,y);(k==n[u]||k==a[u])&&(r[u++]=y),y+=nu(k)}if(u<l)return null}let d=0,p=0,m=!1,A=0,g=-1,h=-1,f=/[a-z]/.test(e),b=!0;for(let y=0,w=Math.min(e.length,200),k=0;y<w&&p<l;){let C=ls(e,y);s<0&&(d<l&&C==n[d]&&(i[d++]=y),A<l&&(C==n[A]||C==a[A]?(A==0&&(g=y),h=y+1,A++):A=0));let x,_=C<255?C>=48&&C<=57||C>=97&&C<=122?2:C>=65&&C<=90?1:0:(x=oF(C))!=x.toLowerCase()?1:x!=x.toUpperCase()?2:0;(!y||_==1&&f||k==0&&_!=0)&&(n[p]==C||a[p]==C&&(m=!0)?o[p++]=y:o.length&&(b=!1)),k=_,y+=nu(C)}return p==l&&o[0]==0&&b?this.result(-100+(m?-200:0),o,e):A==l&&g==0?this.ret(-200-e.length+(h==e.length?0:-100),[0,h]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):A==l?this.ret(-900-e.length,[g,h]):p==l?this.result(-100+(m?-200:0)+-700+(b?0:-1100),o,e):n.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,n,a){let r=[],i=0;for(let o of n){let s=o+(this.astral?nu(ls(a,o)):1);i&&r[i-1]==o?r[i-1]=s:(r[i++]=o,r[i++]=s)}return this.ret(e-a.length,r)}}class gut{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let n=e.slice(0,this.pattern.length),a=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return a==null?null:(this.matched=[0,n.length],this.score=a+(e.length==this.pattern.length?0:-100),this)}}const yi=zt.define({combine(t){return iu(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:hut,filterStrict:!1,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>a=>Qle(e(a),n(a)),optionClass:(e,n)=>a=>Qle(e(a),n(a)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function Qle(t,e){return t?e?t+" "+e:t:e}function hut(t,e,n,a,r,i){let o=t.textDirection==Ra.RTL,s=o,l=!1,u="top",d,p,m=e.left-r.left,A=r.right-e.right,g=a.right-a.left,h=a.bottom-a.top;if(s&&m<Math.min(g,A)?s=!1:!s&&A<Math.min(g,m)&&(s=!0),g<=(s?m:A))d=Math.max(r.top,Math.min(n.top,r.bottom-h))-e.top,p=Math.min(400,s?m:A);else{l=!0,p=Math.min(400,(o?e.right:r.right-e.left)-30);let y=r.bottom-e.bottom;y>=h||y>e.top?d=n.bottom-e.top:(u="bottom",d=e.bottom-n.top)}let f=(e.bottom-e.top)/i.offsetHeight,b=(e.right-e.left)/i.offsetWidth;return{style:`${u}: ${d/f}px; max-width: ${p/b}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":s?"left":"right")}}function fut(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let a=document.createElement("div");return a.classList.add("cm-completionIcon"),n.type&&a.classList.add(...n.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),a.setAttribute("aria-hidden","true"),a},position:20}),e.push({render(n,a,r,i){let o=document.createElement("span");o.className="cm-completionLabel";let s=n.displayLabel||n.label,l=0;for(let u=0;u<i.length;){let d=i[u++],p=i[u++];d>l&&o.appendChild(document.createTextNode(s.slice(l,d)));let m=o.appendChild(document.createElement("span"));m.appendChild(document.createTextNode(s.slice(d,p))),m.className="cm-completionMatchedText",l=p}return l<s.length&&o.appendChild(document.createTextNode(s.slice(l))),o},position:50},{render(n){if(!n.detail)return null;let a=document.createElement("span");return a.className="cm-completionDetail",a.textContent=n.detail,a},position:80}),e.sort((n,a)=>n.position-a.position).map(n=>n.render)}function ZL(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let r=Math.floor(e/n);return{from:r*n,to:(r+1)*n}}let a=Math.floor((t-e)/n);return{from:t-(a+1)*n,to:t-a*n}}class but{constructor(e,n,a){this.view=e,this.stateField=n,this.applyCompletion=a,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let r=e.state.field(n),{options:i,selected:o}=r.open,s=e.state.facet(yi);this.optionContent=fut(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=ZL(i.length,o,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:u}=e.state.field(n).open;for(let d=l.target,p;d&&d!=this.dom;d=d.parentNode)if(d.nodeName=="LI"&&(p=/-(\d+)$/.exec(d.id))&&+p[1]<u.length){this.applyCompletion(e,u[+p[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let u=e.state.field(this.stateField,!1);u&&u.tooltip&&e.state.facet(yi).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:M1.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let a=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),a!=r){let{options:i,selected:o,disabled:s}=a.open;(!r.open||r.open.options!=i)&&(this.range=ZL(i.length,o,e.state.facet(yi).maxRenderedOptions),this.showOptions(i,a.id)),this.updateSel(),s!=((n=r.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let a of this.currentClass.split(" "))a&&this.dom.classList.remove(a);for(let a of n.split(" "))a&&this.dom.classList.add(a);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=ZL(n.options.length,n.selected,this.view.state.facet(yi).maxRenderedOptions),this.showOptions(n.options,e.id));let a=this.updateSelectedOption(n.selected);if(a){this.destroyInfo();let{completion:r}=n.options[n.selected],{info:i}=r;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(r);if(!o)return;"then"in o?o.then(s=>{s&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(s,r)}).catch(s=>us(this.view.state,s,"completion info")):(this.addInfoPane(o,r),a.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let a=this.info=document.createElement("div");if(a.className="cm-tooltip cm-completionInfo",a.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)a.appendChild(e),this.infoDestroy=null;else{let{dom:r,destroy:i}=e;a.appendChild(r),this.infoDestroy=i||null}this.dom.appendChild(a),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let a=this.list.firstChild,r=this.range.from;a;a=a.nextSibling,r++)a.nodeName!="LI"||!a.id?r--:r==e?a.hasAttribute("aria-selected")||(a.setAttribute("aria-selected","true"),n=a):a.hasAttribute("aria-selected")&&(a.removeAttribute("aria-selected"),a.removeAttribute("aria-describedby"));return n&&wut(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),a=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let o=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return r.top>Math.min(i.bottom,n.bottom)-10||r.bottom<Math.max(i.top,n.top)+10?null:this.view.state.facet(yi).positionInfo(this.view,n,r,a,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,n,a){const r=document.createElement("ul");r.id=n,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),r.addEventListener("mousedown",o=>{o.target==r&&o.preventDefault()});let i=null;for(let o=a.from;o<a.to;o++){let{completion:s,match:l}=e[o],{section:u}=s;if(u){let m=typeof u=="string"?u:u.name;if(m!=i&&(o>a.from||a.from==0))if(i=m,typeof u!="string"&&u.header)r.appendChild(u.header(u));else{let A=r.appendChild(document.createElement("completion-section"));A.textContent=m}}const d=r.appendChild(document.createElement("li"));d.id=n+"-"+o,d.setAttribute("role","option");let p=this.optionClass(s);p&&(d.className=p);for(let m of this.optionContent){let A=m(s,this.view.state,this.view,l);A&&d.appendChild(A)}}return a.from&&r.classList.add("cm-completionListIncompleteTop"),a.to<e.length&&r.classList.add("cm-completionListIncompleteBottom"),r}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function yut(t,e){return n=>new but(n,t,e)}function wut(t,e){let n=t.getBoundingClientRect(),a=e.getBoundingClientRect(),r=n.height/t.offsetHeight;a.top<n.top?t.scrollTop-=(n.top-a.top)/r:a.bottom>n.bottom&&(t.scrollTop+=(a.bottom-n.bottom)/r)}function Sle(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function kut(t,e){let n=[],a=null,r=null,i=d=>{n.push(d);let{section:p}=d.completion;if(p){a||(a=[]);let m=typeof p=="string"?p:p.name;a.some(A=>A.name==m)||a.push(typeof p=="string"?{name:m}:p)}},o=e.facet(yi);for(let d of t)if(d.hasResult()){let p=d.result.getMatch;if(d.result.filter===!1)for(let m of d.result.options)i(new Ele(m,d.source,p?p(m):[],1e9-n.length));else{let m=e.sliceDoc(d.from,d.to),A,g=o.filterStrict?new gut(m):new Aut(m);for(let h of d.result.options)if(A=g.match(h.label)){let f=h.displayLabel?p?p(h,A.matched):[]:A.matched,b=A.score+(h.boost||0);if(i(new Ele(h,d.source,f,b)),typeof h.section=="object"&&h.section.rank==="dynamic"){let{name:y}=h.section;r||(r=Object.create(null)),r[y]=Math.max(b,r[y]||-1e9)}}}}if(a){let d=Object.create(null),p=0,m=(A,g)=>(A.rank==="dynamic"&&g.rank==="dynamic"?r[g.name]-r[A.name]:0)||(typeof A.rank=="number"?A.rank:1e9)-(typeof g.rank=="number"?g.rank:1e9)||(A.name<g.name?-1:1);for(let A of a.sort(m))p-=1e5,d[A.name]=p;for(let A of n){let{section:g}=A.completion;g&&(A.score+=d[typeof g=="string"?g:g.name])}}let s=[],l=null,u=o.compareCompletions;for(let d of n.sort((p,m)=>m.score-p.score||u(p.completion,m.completion))){let p=d.completion;!l||l.label!=p.label||l.detail!=p.detail||l.type!=null&&p.type!=null&&l.type!=p.type||l.apply!=p.apply||l.boost!=p.boost?s.push(d):Sle(d.completion)>Sle(l)&&(s[s.length-1]=d),l=d.completion}return s}class yb{constructor(e,n,a,r,i,o){this.options=e,this.attrs=n,this.tooltip=a,this.timestamp=r,this.selected=i,this.disabled=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new yb(this.options,Tle(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,a,r,i,o){if(r&&!o&&e.some(u=>u.isPending))return r.setDisabled();let s=kut(e,n);if(!s.length)return r&&e.some(u=>u.isPending)?r.setDisabled():null;let l=n.facet(yi).selectOnOpen?0:-1;if(r&&r.selected!=l&&r.selected!=-1){let u=r.options[r.selected].completion;for(let d=0;d<s.length;d++)if(s[d].completion==u){l=d;break}}return new yb(s,Tle(a,l),{pos:e.reduce((u,d)=>d.hasResult()?Math.min(u,d.from):u,1e8),create:But,above:i.aboveCursor},r?r.timestamp:Date.now(),l,!1)}map(e){return new yb(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new yb(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class m3{constructor(e,n,a){this.active=e,this.id=n,this.open=a}static start(){return new m3(xut,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,a=n.facet(yi),i=(a.override||n.languageDataAt("autocomplete",pg(n)).map(mut)).map(l=>(this.active.find(d=>d.source==l)||new Cc(l,this.active.some(d=>d.state!=0)?1:0)).update(e,a));i.length==this.active.length&&i.every((l,u)=>l==this.active[u])&&(i=this.active);let o=this.open,s=e.effects.some(l=>l.is(VL));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||i.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!vut(i,this.active)||s?o=yb.build(i,n,this.id,o,a,s):o&&o.disabled&&!i.some(l=>l.isPending)&&(o=null),!o&&i.every(l=>!l.isPending)&&i.some(l=>l.hasResult())&&(i=i.map(l=>l.hasResult()?new Cc(l.source,0):l));for(let l of e.effects)l.is(Lle)&&(o=o&&o.setSelected(l.value,this.id));return i==this.active&&o==this.open?this:new m3(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Cut:_ut}}function vut(t,e){if(t==e)return!0;for(let n=0,a=0;;){for(;n<t.length&&!t[n].hasResult();)n++;for(;a<e.length&&!e[a].hasResult();)a++;let r=n==t.length,i=a==e.length;if(r||i)return r==i;if(t[n++].result!=e[a++].result)return!1}}const Cut={"aria-autocomplete":"list"},_ut={};function Tle(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const xut=[];function Fle(t,e){if(t.isUserEvent("input.complete")){let a=t.annotation(Ile);if(a&&e.activateOnCompletion(a))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Cc{constructor(e,n,a=!1){this.source=e,this.state=n,this.explicit=a}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let a=Fle(e,n),r=this;(a&8||a&16&&this.touches(e))&&(r=new Cc(r.source,0)),a&4&&r.state==0&&(r=new Cc(this.source,1)),r=r.updateFor(e,a);for(let i of e.effects)if(i.is(p3))r=new Cc(r.source,1,i.value);else if(i.is(M1))r=new Cc(r.source,0);else if(i.is(VL))for(let o of i.value)o.source==r.source&&(r=o);return r}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(pg(e.state))}}class wb extends Cc{constructor(e,n,a,r,i,o){super(e,3,n),this.limit=a,this.result=r,this.from=i,this.to=o}hasResult(){return!0}updateFor(e,n){var a;if(!(n&3))return this.map(e.changes);let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let i=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),s=pg(e.state);if(s>o||!r||n&2&&(pg(e.startState)==this.from||s<this.limit))return new Cc(this.source,n&4?1:0);let l=e.changes.mapPos(this.limit);return Eut(r.validFor,e.state,i,o)?new wb(this.source,this.explicit,l,r,i,o):r.update&&(r=r.update(r,i,o,new _le(e.state,s,!1)))?new wb(this.source,this.explicit,l,r,r.from,(a=r.to)!==null&&a!==void 0?a:pg(e.state)):new Cc(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new wb(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Cc(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function Eut(t,e,n,a){if(!t)return!1;let r=e.sliceDoc(n,a);return typeof t=="function"?t(r,n,a,e):Ble(t,!0).test(r)}const VL=Bn.define({map(t,e){return t.map(n=>n.map(e))}}),Lle=Bn.define(),ms=Li.define({create(){return m3.start()},update(t,e){return t.update(e)},provide:t=>[dL.from(t,e=>e.tooltip),Ot.contentAttributes.from(t,e=>e.attrs)]});function JL(t,e){const n=e.completion.apply||e.completion.label;let a=t.state.field(ms).active.find(r=>r.source==e.source);return a instanceof wb?(typeof n=="string"?t.dispatch({...put(t.state,n,a.from,a.to),annotations:Ile.of(e.completion)}):n(t,e.completion,a.from,a.to),!0):!1}const But=yut(ms,JL);function A3(t,e="option"){return n=>{let a=n.state.field(ms,!1);if(!a||!a.open||a.open.disabled||Date.now()-a.open.timestamp<n.state.facet(yi).interactionDelay)return!1;let r=1,i;e=="page"&&(i=Sse(n,a.open.tooltip))&&(r=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:o}=a.open.options,s=a.open.selected>-1?a.open.selected+r*(t?1:-1):t?0:o-1;return s<0?s=e=="page"?0:o-1:s>=o&&(s=e=="page"?o-1:0),n.dispatch({effects:Lle.of(s)}),!0}}const Iut=t=>{let e=t.state.field(ms,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(yi).interactionDelay?!1:JL(t,e.open.options[e.open.selected])},XL=t=>t.state.field(ms,!1)?(t.dispatch({effects:p3.of(!0)}),!0):!1,Dut=t=>{let e=t.state.field(ms,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:M1.of(null)}),!0)};class Qut{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const Sut=50,Tut=1e3,Fut=vr.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(ms).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(ms),n=t.state.facet(yi);if(!t.selectionSet&&!t.docChanged&&t.startState.field(ms)==e)return;let a=t.transactions.some(i=>{let o=Fle(i,n);return o&8||(i.selection||i.docChanged)&&!(o&3)});for(let i=0;i<this.running.length;i++){let o=this.running[i];if(a||o.context.abortOnDocChange&&t.docChanged||o.updates.length+t.transactions.length>Sut&&Date.now()-o.time>Tut){for(let s of o.context.abortListeners)try{s()}catch(l){us(this.view.state,l)}o.context.abortListeners=null,this.running.splice(i--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(o=>o.is(p3)))&&(this.pendingStart=!0);let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(o=>o.active.source==i.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(ms);for(let n of e.active)n.isPending&&!this.running.some(a=>a.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(yi).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=pg(e),a=new _le(e,n,t.explicit,this.view),r=new Qut(t,a);this.running.push(r),Promise.resolve(t.source(a)).then(i=>{r.context.aborted||(r.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:M1.of(null)}),us(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(yi).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(yi),a=this.view.state.field(ms);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let s=pg(i.updates.length?i.updates[0].startState:this.view.state),l=Math.min(s,i.done.from+(i.active.explicit?0:1)),u=new wb(i.active.source,i.active.explicit,l,i.done,i.done.from,(t=i.done.to)!==null&&t!==void 0?t:s);for(let d of i.updates)u=u.update(d,n);if(u.hasResult()){e.push(u);continue}}let o=a.active.find(s=>s.source==i.active.source);if(o&&o.isPending)if(i.done==null){let s=new Cc(i.active.source,0);for(let l of i.updates)s=s.update(l,n);s.isPending||e.push(s)}else this.startQuery(o)}(e.length||a.open&&a.open.disabled)&&this.view.dispatch({effects:VL.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(ms,!1);if(e&&e.tooltip&&this.view.state.facet(yi).closeOnBlur){let n=e.open&&Sse(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:M1.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:p3.of(!1)}),20),this.composing=0}}}),Lut=typeof navigator=="object"&&/Win/.test(navigator.platform),Nut=ag.highest(Ot.domEventHandlers({keydown(t,e){let n=e.state.field(ms,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(Lut&&t.altKey)||t.metaKey)return!1;let a=n.open.options[n.open.selected],r=n.active.find(o=>o.source==a.source),i=a.completion.commitCharacters||r.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&JL(e,a),!1}})),Mut=Ot.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),R1={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},mg=Bn.define({map(t,e){let n=e.mapPos(t,-1,Lo.TrackAfter);return n??void 0}}),eN=new class extends rg{};eN.startSide=1,eN.endSide=-1;const Nle=Li.define({create(){return ta.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:a=>a>=n.from&&a<=n.to})}for(let n of e.effects)n.is(mg)&&(t=t.update({add:[eN.range(n.value,n.value+1)]}));return t}});function Rut(){return[$ut,Nle]}const tN="()[]{}<>«»»«[]{}";function Mle(t){for(let e=0;e<tN.length;e+=2)if(tN.charCodeAt(e)==t)return tN.charAt(e+1);return oF(t<128?t:t+1)}function Rle(t,e){return t.languageDataAt("closeBrackets",e)[0]||R1}const Put=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),$ut=Ot.inputHandler.of((t,e,n,a)=>{if((Put?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let r=t.state.selection.main;if(a.length>2||a.length==2&&nu(ls(a,0))==1||e!=r.from||n!=r.to)return!1;let i=jut(t.state,a);return i?(t.dispatch(i),!0):!1}),Out=[{key:"Backspace",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let a=Rle(t,t.selection.main.head).brackets||R1.brackets,r=null,i=t.changeByRange(o=>{if(o.empty){let s=Gut(t.doc,o.head);for(let l of a)if(l==s&&g3(t.doc,o.head)==Mle(ls(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:lt.cursor(o.head-l.length)}}return{range:r=o}});return r||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!r}}];function jut(t,e){let n=Rle(t,t.selection.main.head),a=n.brackets||R1.brackets;for(let r of a){let i=Mle(ls(r,0));if(e==r)return i==r?Hut(t,r,a.indexOf(r+r+r)>-1,n):qut(t,r,i,n.before||R1.before);if(e==i&&Ple(t,t.selection.main.from))return zut(t,r,i)}return null}function Ple(t,e){let n=!1;return t.field(Nle).between(0,t.doc.length,a=>{a==e&&(n=!0)}),n}function g3(t,e){let n=t.sliceString(e,e+2);return n.slice(0,nu(ls(n,0)))}function Gut(t,e){let n=t.sliceString(e-2,e);return nu(ls(n,0))==n.length?n:n.slice(1)}function qut(t,e,n,a){let r=null,i=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:mg.of(o.to+e.length),range:lt.range(o.anchor+e.length,o.head+e.length)};let s=g3(t.doc,o.head);return!s||/\s/.test(s)||a.indexOf(s)>-1?{changes:{insert:e+n,from:o.head},effects:mg.of(o.head+e.length),range:lt.cursor(o.head+e.length)}:{range:r=o}});return r?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function zut(t,e,n){let a=null,r=t.changeByRange(i=>i.empty&&g3(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:lt.cursor(i.head+n.length)}:a={range:i});return a?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Hut(t,e,n,a){let r=a.stringPrefixes||R1.stringPrefixes,i=null,o=t.changeByRange(s=>{if(!s.empty)return{changes:[{insert:e,from:s.from},{insert:e,from:s.to}],effects:mg.of(s.to+e.length),range:lt.range(s.anchor+e.length,s.head+e.length)};let l=s.head,u=g3(t.doc,l),d;if(u==e){if($le(t,l))return{changes:{insert:e+e,from:l},effects:mg.of(l+e.length),range:lt.cursor(l+e.length)};if(Ple(t,l)){let m=n&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+m.length,insert:m},range:lt.cursor(l+m.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(d=Ole(t,l-2*e.length,r))>-1&&$le(t,d))return{changes:{insert:e+e+e+e,from:l},effects:mg.of(l+e.length),range:lt.cursor(l+e.length)};if(t.charCategorizer(l)(u)!=Wa.Word&&Ole(t,l,r)>-1&&!Uut(t,l,e,r))return{changes:{insert:e+e,from:l},effects:mg.of(l+e.length),range:lt.cursor(l+e.length)}}return{range:i=s}});return i?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function $le(t,e){let n=ro(t).resolveInner(e+1);return n.parent&&n.from==e}function Uut(t,e,n,a){let r=ro(t).resolveInner(e,-1),i=a.reduce((o,s)=>Math.max(o,s.length),0);for(let o=0;o<5;o++){let s=t.sliceDoc(r.from,Math.min(r.to,r.from+n.length+i)),l=s.indexOf(n);if(!l||l>-1&&a.indexOf(s.slice(0,l))>-1){let d=r.firstChild;for(;d&&d.from==r.from&&d.to-d.from>n.length+l;){if(t.sliceDoc(d.to-n.length,d.to)==n)return!1;d=d.firstChild}return!0}let u=r.to==e&&r.parent;if(!u)break;r=u}return!1}function Ole(t,e,n){let a=t.charCategorizer(e);if(a(t.sliceDoc(e-1,e))!=Wa.Word)return e;for(let r of n){let i=e-r.length;if(t.sliceDoc(i,e)==r&&a(t.sliceDoc(i-1,i))!=Wa.Word)return i}return-1}function Yut(t={}){return[Nut,ms,yi.of(t),Fut,Wut,Mut]}const jle=[{key:"Ctrl-Space",run:XL},{mac:"Alt-`",run:XL},{mac:"Alt-i",run:XL},{key:"Escape",run:Dut},{key:"ArrowDown",run:A3(!0)},{key:"ArrowUp",run:A3(!1)},{key:"PageDown",run:A3(!0,"page")},{key:"PageUp",run:A3(!1,"page")},{key:"Enter",run:Iut}],Wut=ag.highest(Q2.computeN([yi],t=>t.facet(yi).defaultKeymap?[jle]:[]));class Gle{constructor(e,n,a){this.from=e,this.to=n,this.diagnostic=a}}class Ag{constructor(e,n,a){this.diagnostics=e,this.panel=n,this.selected=a}static init(e,n,a){let r=a.facet(P1).markerFilter;r&&(e=r(e,a));let i=e.slice().sort((A,g)=>A.from-g.from||A.to-g.to),o=new kd,s=[],l=0,u=a.doc.iter(),d=0,p=a.doc.length;for(let A=0;;){let g=A==i.length?null:i[A];if(!g&&!s.length)break;let h,f;if(s.length)h=l,f=s.reduce((w,k)=>Math.min(w,k.to),g&&g.from>h?g.from:1e8);else{if(h=g.from,h>p)break;f=g.to,s.push(g),A++}for(;A<i.length;){let w=i[A];if(w.from==h&&(w.to>w.from||w.to==h))s.push(w),A++,f=Math.min(w.to,f);else{f=Math.min(w.from,f);break}}f=Math.min(f,p);let b=!1;if(s.some(w=>w.from==h&&(w.to==f||f==p))&&(b=h==f,!b&&f-h<10)){let w=h-(d+u.value.length);w>0&&(u.next(w),d=h);for(let k=h;;){if(k>=f){b=!0;break}if(!u.lineBreak&&d+u.value.length>k)break;k=d+u.value.length,d+=u.value.length,u.next()}}let y=odt(s);if(b)o.add(h,h,ln.widget({widget:new ndt(y),diagnostics:s.slice()}));else{let w=s.reduce((k,C)=>C.markClass?k+" "+C.markClass:k,"");o.add(h,f,ln.mark({class:"cm-lintRange cm-lintRange-"+y+w,diagnostics:s.slice(),inclusiveEnd:s.some(k=>k.to>f)}))}if(l=f,l==p)break;for(let w=0;w<s.length;w++)s[w].to<=l&&s.splice(w--,1)}let m=o.finish();return new Ag(m,n,kb(m))}}function kb(t,e=null,n=0){let a=null;return t.between(n,1e9,(r,i,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!a)a=new Gle(r,i,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(a.diagnostic)<0)return!1;a=new Gle(a.from,i,a.diagnostic)}}),a}function Kut(t,e){let n=e.pos,a=e.end||n,r=t.state.facet(P1).hideOn(t,n,a);if(r!=null)return r;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(qle))||t.changes.touchesRange(i.from,Math.max(i.to,a)))}function Zut(t,e){return t.field(Os,!1)?e:e.concat(Bn.appendConfig.of(sdt))}const qle=Bn.define(),nN=Bn.define(),zle=Bn.define(),Os=Li.define({create(){return new Ag(ln.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),a=null,r=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);a=kb(n,t.selected.diagnostic,i)||kb(n,null,i)}!n.size&&r&&e.state.facet(P1).autoPanel&&(r=null),t=new Ag(n,r,a)}for(let n of e.effects)if(n.is(qle)){let a=e.state.facet(P1).autoPanel?n.value.length?$1.open:null:t.panel;t=Ag.init(n.value,a,e.state)}else n.is(nN)?t=new Ag(t.diagnostics,n.value?$1.open:null,t.selected):n.is(zle)&&(t=new Ag(t.diagnostics,t.panel,n.value));return t},provide:t=>[v1.from(t,e=>e.panel),Ot.decorations.from(t,e=>e.diagnostics)]}),Vut=ln.mark({class:"cm-lintRange cm-lintRange-active"});function Jut(t,e,n){let{diagnostics:a}=t.state.field(Os),r,i=-1,o=-1;a.between(e-(n<0?1:0),e+(n>0?1:0),(l,u,{spec:d})=>{if(e>=l&&e<=u&&(l==u||(e>l||n>0)&&(e<u||n<0)))return r=d.diagnostics,i=l,o=u,!1});let s=t.state.facet(P1).tooltipFilter;return r&&s&&(r=s(r,t.state)),r?{pos:i,end:o,above:t.state.doc.lineAt(i).to<o,create(){return{dom:Xut(t,r)}}}:null}function Xut(t,e){return Ea("ul",{class:"cm-tooltip-lint"},e.map(n=>Wle(t,n,!1)))}const edt=t=>{let e=t.state.field(Os,!1);(!e||!e.panel)&&t.dispatch({effects:Zut(t.state,[nN.of(!0)])});let n=k1(t,$1.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},Hle=t=>{let e=t.state.field(Os,!1);return!e||!e.panel?!1:(t.dispatch({effects:nN.of(!1)}),!0)},tdt=[{key:"Mod-Shift-m",run:edt,preventDefault:!0},{key:"F8",run:t=>{let e=t.state.field(Os,!1);if(!e)return!1;let n=t.state.selection.main,a=e.diagnostics.iter(n.to+1);return!a.value&&(a=e.diagnostics.iter(0),!a.value||a.from==n.from&&a.to==n.to)?!1:(t.dispatch({selection:{anchor:a.from,head:a.to},scrollIntoView:!0}),!0)}}],P1=zt.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...iu(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Ule,tooltipFilter:Ule,needsRefresh:(e,n)=>e?n?a=>e(a)||n(a):e:n,hideOn:(e,n)=>e?n?(a,r,i)=>e(a,r,i)||n(a,r,i):e:n,autoPanel:(e,n)=>e||n})}}});function Ule(t,e){return t?e?(n,a)=>e(t(n,a),a):t:e}function Yle(t){let e=[];if(t)e:for(let{name:n}of t){for(let a=0;a<n.length;a++){let r=n[a];if(/[a-zA-Z]/.test(r)&&!e.some(i=>i.toLowerCase()==r.toLowerCase())){e.push(r);continue e}}e.push("")}return e}function Wle(t,e,n){var a;let r=n?Yle(e.actions):[];return Ea("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Ea("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(a=e.actions)===null||a===void 0?void 0:a.map((i,o)=>{let s=!1,l=A=>{if(A.preventDefault(),s)return;s=!0;let g=kb(t.state.field(Os).diagnostics,e);g&&i.apply(t,g.from,g.to)},{name:u}=i,d=r[o]?u.indexOf(r[o]):-1,p=d<0?u:[u.slice(0,d),Ea("u",u.slice(d,d+1)),u.slice(d+1)],m=i.markClass?" "+i.markClass:"";return Ea("button",{type:"button",class:"cm-diagnosticAction"+m,onclick:l,onmousedown:l,"aria-label":` Action: ${u}${d<0?"":` (access key "${r[o]})"`}.`},p)}),e.source&&Ea("div",{class:"cm-diagnosticSource"},e.source))}class ndt extends Cd{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Ea("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Kle{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Wle(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class $1{constructor(e){this.view=e,this.items=[];let n=r=>{if(r.keyCode==27)Hle(this.view),this.view.focus();else if(r.keyCode==38||r.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(r.keyCode==40||r.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(r.keyCode==36)this.moveSelection(0);else if(r.keyCode==35)this.moveSelection(this.items.length-1);else if(r.keyCode==13)this.view.focus();else if(r.keyCode>=65&&r.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],o=Yle(i.actions);for(let s=0;s<o.length;s++)if(o[s].toUpperCase().charCodeAt(0)==r.keyCode){let l=kb(this.view.state.field(Os).diagnostics,i);l&&i.actions[s].apply(e,l.from,l.to)}}else return;r.preventDefault()},a=r=>{for(let i=0;i<this.items.length;i++)this.items[i].dom.contains(r.target)&&this.moveSelection(i)};this.list=Ea("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:a}),this.dom=Ea("div",{class:"cm-panel-lint"},this.list,Ea("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Hle(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Os).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(Os),a=0,r=!1,i=null,o=new Set;for(e.between(0,this.view.state.doc.length,(s,l,{spec:u})=>{for(let d of u.diagnostics){if(o.has(d))continue;o.add(d);let p=-1,m;for(let A=a;A<this.items.length;A++)if(this.items[A].diagnostic==d){p=A;break}p<0?(m=new Kle(this.view,d),this.items.splice(a,0,m),r=!0):(m=this.items[p],p>a&&(this.items.splice(a,p-a),r=!0)),n&&m.diagnostic==n.diagnostic?m.dom.hasAttribute("aria-selected")||(m.dom.setAttribute("aria-selected","true"),i=m):m.dom.hasAttribute("aria-selected")&&m.dom.removeAttribute("aria-selected"),a++}});a<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new Kle(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:s,panel:l})=>{let u=l.height/this.list.offsetHeight;s.top<l.top?this.list.scrollTop-=(l.top-s.top)/u:s.bottom>l.bottom&&(this.list.scrollTop+=(s.bottom-l.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function n(){let a=e;e=a.nextSibling,a.remove()}for(let a of this.items)if(a.dom.parentNode==this.list){for(;e!=a.dom;)n();e=a.dom.nextSibling}else this.list.insertBefore(a.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(Os),a=kb(n.diagnostics,this.items[e].diagnostic);a&&this.view.dispatch({selection:{anchor:a.from,head:a.to},scrollIntoView:!0,effects:zle.of(a)})}static open(e){return new $1(e)}}function adt(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function h3(t){return adt(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const rdt=Ot.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:h3("#d11")},".cm-lintRange-warning":{backgroundImage:h3("orange")},".cm-lintRange-info":{backgroundImage:h3("#999")},".cm-lintRange-hint":{backgroundImage:h3("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function idt(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function odt(t){let e="hint",n=1;for(let a of t){let r=idt(a.severity);r>n&&(n=r,e=a.severity)}return e}const sdt=[Os,Ot.decorations.compute([Os],t=>{let{selected:e,panel:n}=t.field(Os);return!e||!n||e.from==e.to?ln.none:ln.set([Vut.range(e.from,e.to)])}),rst(Jut,{hideOn:Kut}),rdt];var Zle=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,a=[];e.closeBracketsKeymap!==!1&&(a=a.concat(Out)),e.defaultKeymap!==!1&&(a=a.concat(Llt)),e.searchKeymap!==!1&&(a=a.concat(out)),e.historyKeymap!==!1&&(a=a.concat(jct)),e.foldKeymap!==!1&&(a=a.concat(nct)),e.completionKeymap!==!1&&(a=a.concat(jle)),e.lintKeymap!==!1&&(a=a.concat(tdt));var r=[];return e.lineNumbers!==!1&&r.push(gst()),e.highlightActiveLineGutter!==!1&&r.push(bst()),e.highlightSpecialChars!==!1&&r.push(Fot()),e.history!==!1&&r.push(Tct()),e.foldGutter!==!1&&r.push(oct()),e.drawSelection!==!1&&r.push(vot()),e.dropCursor!==!1&&r.push(Bot()),e.allowMultipleSelections!==!1&&r.push(Hn.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&r.push(Wst()),e.syntaxHighlighting!==!1&&r.push(fce(uct,{fallback:!0})),e.bracketMatching!==!1&&r.push(hct()),e.closeBrackets!==!1&&r.push(Rut()),e.autocompletion!==!1&&r.push(Yut()),e.rectangularSelection!==!1&&r.push(Yot()),n!==!1&&r.push(Zot()),e.highlightActiveLine!==!1&&r.push($ot()),e.highlightSelectionMatches!==!1&&r.push(jlt()),e.tabSize&&typeof e.tabSize=="number"&&r.push(Y2.of(" ".repeat(e.tabSize))),r.concat([Q2.of(a.flat())]).filter(Boolean)};const cdt="#e5c07b",Vle="#e06c75",ldt="#56b6c2",udt="#ffffff",f3="#abb2bf",aN="#7d8799",ddt="#61afef",pdt="#98c379",Jle="#d19a66",mdt="#c678dd",Adt="#21252b",Xle="#2c313a",eue="#282c34",rN="#353a42",gdt="#3E4451",tue="#528bff",hdt=Ot.theme({"&":{color:f3,backgroundColor:eue},".cm-content":{caretColor:tue},".cm-cursor, .cm-dropCursor":{borderLeftColor:tue},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:gdt},".cm-panels":{backgroundColor:Adt,color:f3},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:eue,color:aN,border:"none"},".cm-activeLineGutter":{backgroundColor:Xle},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:rN},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:rN,borderBottomColor:rN},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Xle,color:f3}}},{dark:!0}),fdt=Q1.define([{tag:Xe.keyword,color:mdt},{tag:[Xe.name,Xe.deleted,Xe.character,Xe.propertyName,Xe.macroName],color:Vle},{tag:[Xe.function(Xe.variableName),Xe.labelName],color:ddt},{tag:[Xe.color,Xe.constant(Xe.name),Xe.standard(Xe.name)],color:Jle},{tag:[Xe.definition(Xe.name),Xe.separator],color:f3},{tag:[Xe.typeName,Xe.className,Xe.number,Xe.changed,Xe.annotation,Xe.modifier,Xe.self,Xe.namespace],color:cdt},{tag:[Xe.operator,Xe.operatorKeyword,Xe.url,Xe.escape,Xe.regexp,Xe.link,Xe.special(Xe.string)],color:ldt},{tag:[Xe.meta,Xe.comment],color:aN},{tag:Xe.strong,fontWeight:"bold"},{tag:Xe.emphasis,fontStyle:"italic"},{tag:Xe.strikethrough,textDecoration:"line-through"},{tag:Xe.link,color:aN,textDecoration:"underline"},{tag:Xe.heading,fontWeight:"bold",color:Vle},{tag:[Xe.atom,Xe.bool,Xe.special(Xe.variableName)],color:Jle},{tag:[Xe.processingInstruction,Xe.string,Xe.inserted],color:pdt},{tag:Xe.invalid,color:udt}]),bdt=[hdt,fce(fdt)];var ydt=Ot.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),wdt=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:a=!0,readOnly:r=!1,theme:i="light",placeholder:o="",basicSetup:s=!0}=e,l=[];switch(n&&l.unshift(Q2.of([Nlt])),s&&(typeof s=="boolean"?l.unshift(Zle()):l.unshift(Zle(s))),o&&l.unshift(qot(o)),i){case"light":l.push(ydt);break;case"dark":l.push(bdt);break;case"none":break;default:l.push(i);break}return a===!1&&l.push(Ot.editable.of(!1)),r&&l.push(Hn.readOnly.of(!0)),[...l]},kdt=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class vdt{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(a){console.error("TimeoutLatch callback error:",a)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class nue{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var iN=null,Cdt=()=>typeof window>"u"?new nue:(iN||(iN=new nue),iN),aue=ru.define(),_dt=200,xdt=[];function Edt(t){var{value:e,selection:n,onChange:a,onStatistics:r,onCreateEditor:i,onUpdate:o,extensions:s=xdt,autoFocus:l,theme:u="light",height:d=null,minHeight:p=null,maxHeight:m=null,width:A=null,minWidth:g=null,maxWidth:h=null,placeholder:f="",editable:b=!0,readOnly:y=!1,indentWithTab:w=!0,basicSetup:k=!0,root:C,initialState:x}=t,[_,E]=be.useState(),[I,Q]=be.useState(),[D,T]=be.useState(),N=be.useState(()=>({current:null}))[0],B=be.useState(()=>({current:null}))[0],S=Ot.theme({"&":{height:d,minHeight:p,maxHeight:m,width:A,minWidth:g,maxWidth:h},"& .cm-scroller":{height:"100% !important"}}),M=Ot.updateListener.of(R=>{if(R.docChanged&&typeof a=="function"&&!R.transactions.some(q=>q.annotation(aue))){N.current?N.current.reset():(N.current=new vdt(()=>{if(B.current){var q=B.current;B.current=null,q()}N.current=null},_dt),Cdt().add(N.current));var P=R.state.doc,$=P.toString();a($,R)}r&&r(kdt(R))}),L=wdt({theme:u,editable:b,readOnly:y,placeholder:f,indentWithTab:w,basicSetup:k}),F=[M,S,...L];return o&&typeof o=="function"&&F.push(Ot.updateListener.of(o)),F=F.concat(s),be.useLayoutEffect(()=>{if(_&&!D){var R={doc:e,selection:n,extensions:F},P=x?Hn.fromJSON(x.json,R,x.fields):Hn.create(R);if(T(P),!I){var $=new Ot({state:P,parent:_,root:C});Q($),i&&i($,P)}}return()=>{I&&(T(void 0),Q(void 0))}},[_,D]),be.useEffect(()=>{t.container&&E(t.container)},[t.container]),be.useEffect(()=>()=>{I&&(I.destroy(),Q(void 0)),N.current&&(N.current.cancel(),N.current=null)},[I]),be.useEffect(()=>{l&&I&&I.focus()},[l,I]),be.useEffect(()=>{I&&I.dispatch({effects:Bn.reconfigure.of(F)})},[u,s,d,p,m,A,g,h,f,b,y,w,k,a,o]),be.useEffect(()=>{if(e!==void 0){var R=I?I.state.doc.toString():"";if(I&&e!==R){var P=N.current&&!N.current.isDone,$=()=>{I&&e!==I.state.doc.toString()&&I.dispatch({changes:{from:0,to:I.state.doc.toString().length,insert:e||""},annotations:[aue.of(!0)]})};P?B.current=$:$()}}},[e,I]),{state:D,setState:T,view:I,setView:Q,container:_,setContainer:E}}var Bdt=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],rue=be.forwardRef((t,e)=>{var{className:n,value:a="",selection:r,extensions:i=[],onChange:o,onStatistics:s,onCreateEditor:l,onUpdate:u,autoFocus:d,theme:p="light",height:m,minHeight:A,maxHeight:g,width:h,minWidth:f,maxWidth:b,basicSetup:y,placeholder:w,indentWithTab:k,editable:C,readOnly:x,root:_,initialState:E}=t,I=brt(t,Bdt),Q=be.useRef(null),{state:D,view:T,container:N,setContainer:B}=Edt({root:_,value:a,autoFocus:d,theme:p,height:m,minHeight:A,maxHeight:g,width:h,minWidth:f,maxWidth:b,basicSetup:y,placeholder:w,indentWithTab:k,editable:C,readOnly:x,selection:r,onChange:o,onStatistics:s,onCreateEditor:l,onUpdate:u,extensions:i,initialState:E});be.useImperativeHandle(e,()=>({editor:Q.current,state:D,view:T}),[Q,N,D,T]);var S=be.useCallback(L=>{Q.current=L,B(L)},[B]);if(typeof a!="string")throw new Error("value must be typeof string but got "+typeof a);var M=typeof p=="string"?"cm-theme-"+p:"cm-theme";return H.jsx("div",aF({ref:S,className:""+M+(n?" "+n:"")},I))});rue.displayName="CodeMirror";var iue={npm_package_dependencies__radix_ui_react_hover_card:"1.1.15",npm_config_legacy_peer_deps:"true",TERM_PROGRAM:"WarpTerminal",NODE:"/Users/diananr/.nvm/versions/node/v22.21.1/bin/node",INIT_CWD:"/Users/diananr/foris/avocado/packages/ai-agent",npm_package_devDependencies_typescript:"5.1.3",npm_package_dependencies_lucide_react:"0.561.0",npm_package_devDependencies_vite:"5.0.12",npm_package_dependencies__radix_ui_react_dialog:"1.1.15",TERM:"xterm-256color",SHELL:"/bin/zsh",npm_package_devDependencies__testing_library_user_event:"14.5.2",npm_package_devDependencies__vitest_ui:"1.2.2",npm_package_dependencies_streamdown:"1.6.10",npm_package_dependencies_postcss:"8.5.6",TURBO_IS_TUI:"true",npm_config_registry:"https://registry.npmjs.org/",npm_package_dependencies__radix_ui_react_select:"2.2.6",npm_package_devDependencies_vite_plugin_static_copy:"1.0.0",npm_package_dependencies_react_dom:"18.3.1",npm_package_devDependencies__testing_library_react:"14.2.0",npm_package_devDependencies__types_react:"18.3.1",npm_package_dependencies_embla_carousel_react:"8.6.0",npm_package_dependencies_ai:"5.0.115",npm_package_dependencies__radix_ui_react_tooltip:"1.2.8",PNPM_SCRIPT_SRC_DIR:"/Users/diananr/foris/avocado/packages/ai-agent",npm_package_exports___import:"./dist/ai-agent.es.js",npm_package_dependencies_use_stick_to_bottom:"1.1.1",npm_package_devDependencies__types_testing_library__jest_dom:"6.0.0",npm_package_dependencies__uiw_react_codemirror:"4.25.4",__CF_USER_TEXT_ENCODING:"0x1F6:0x0:0x0",npm_execpath:"/Users/diananr/Library/pnpm/.tools/pnpm/9.10.0/node_modules/pnpm/bin/pnpm.cjs",npm_package_scripts_coverage:"vitest run --coverage",npm_package_dependencies__radix_ui_react_use_controllable_state:"1.2.2",npm_package_module:"./dist/ai-agent.es.js",npm_config_frozen_lockfile:"",npm_package_devDependencies__types_react_dom:"18.3.1",npm_package_devDependencies_classnames:"2.3.2",npm_package_dependencies_tailwind_merge:"3.4.0",npm_package_dependencies_class_variance_authority:"0.7.1",PATH:"/Users/diananr/foris/avocado/packages/ai-agent/node_modules/.bin:/Users/diananr/Library/pnpm/.tools/pnpm/9.10.0/node_modules/pnpm/dist/node-gyp-bin:/Users/diananr/foris/avocado/node_modules/.bin:/Users/diananr/foris/avocado/node_modules/.bin:/Users/diananr/Library/pnpm/.tools/pnpm/9.10.0/node_modules/pnpm/dist/node-gyp-bin:/Users/diananr/foris/avocado/node_modules/.bin:/Users/diananr/Library/pnpm/.tools/pnpm/9.10.0/bin:/Users/diananr/.antigravity/antigravity/bin:/Users/diananr/.rbenv/shims:/Users/diananr/.rbenv/bin:/Users/diananr/.rbenv/shims:/Users/diananr/.rbenv/bin:/Users/diananr/.rbenv/shims:/Users/diananr/.rbenv/bin:/Users/diananr/.nvm/versions/node/v22.21.1/bin:/Users/diananr/.asdf/installs/erlang/24.3.4/bin:/Users/diananr/.asdf/installs/elixir/1.14.1-otp-24/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/share/dotnet:~/.dotnet/tools:/usr/local/go/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Warp.app/Contents/Resources/bin",npm_package_dependencies__radix_ui_react_progress:"1.1.8",npm_config_auto_install_peers:"true",npm_command:"run-script",npm_package_devDependencies_tailwindcss:"4.1.18",PWD:"/Users/diananr/foris/avocado/packages/ai-agent",npm_package_scripts_test_watch:"vitest --ui",npm_lifecycle_event:"build",npm_package_devDependencies_jsdom:"24.0.0",npm_package_dependencies__tailwindcss_postcss:"4.1.18",npm_package_types:"./dist/index.d.ts",npm_package_name:"@foris/ai-agent",npm_package_devDependencies_sass:"1.62.1",npm_package_devDependencies__vitest_coverage_v8:"1.2.2",npm_package_devDependencies__foris_tsconfig:"workspace:*",npm_package_dependencies_cmdk:"1.1.1",npm_package_scripts_build:"tsc && vite build",npm_package_exports___types:"./dist/index.d.ts",npm_config_node_linker:"hoisted",npm_package_devDependencies_vitest:"1.2.2",npm_package_devDependencies_tw_animate_css:"1.4.0",npm_package_dependencies_motion:"12.23.26",TURBO_HASH:"9e39cb8a74939e3f",npm_package_dependencies_tokenlens:"1.3.1",npm_package_devDependencies__shikijs_transformers:"3.20.0",npm_config_node_gyp:"/Users/diananr/Library/pnpm/.tools/pnpm/9.10.0/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js",npm_package_devDependencies_vite_plugin_dts:"3.7.1",npm_package_dependencies__radix_ui_react_collapsible:"1.1.12",npm_package_main:"./dist/ai-agent.umd.js",npm_package_version:"0.7.1-beta.3",SHLVL:"1",npm_package_type:"module",HOME:"/Users/diananr",npm_package_dependencies_react_markdown:"10.1.0",npm_package_dependencies_nanoid:"5.1.6",npm_package_publishConfig_access:"public",npm_package_dependencies__radix_ui_react_slot:"1.2.4",npm_package_exports___default:"./dist/ai-agent.es.js",npm_lifecycle_script:"tsc && vite build",npm_package_exports___require:"./dist/ai-agent.umd.js",npm_package_dependencies__xyflow_react:"12.10.0",npm_package_devDependencies__vitejs_plugin_react_swc:"3.5.0",npm_package_dependencies_react:"18.3.1",npm_package_dependencies__radix_ui_react_separator:"1.1.8",npm_config_user_agent:"pnpm/9.10.0 npm/? node/v22.21.1 darwin arm64",npm_package_devDependencies__types_node:"20.2.5",npm_package_dependencies_clsx:"2.1.1",npm_package_dependencies__radix_ui_react_dropdown_menu:"2.1.16",npm_package_dependencies__ai_sdk_react:"2.0.117",npm_package_files_0:"dist",npm_package_dependencies_shiki:"3.20.0",npm_package_dependencies__codemirror_lang_json:"6.0.1",npm_node_execpath:"/Users/diananr/.nvm/versions/node/v22.21.1/bin/node",npm_package_devDependencies__testing_library_jest_dom:"6.4.0",npm_package_dependencies__radix_ui_react_scroll_area:"1.2.10",COLORTERM:"truecolor",_:"/Users/diananr/foris/avocado/node_modules/.bin/vite",NODE_ENV:"production"};let Idt=class lH{constructor(e,n,a,r,i,o,s,l,u,d=0,p){this.p=e,this.stack=n,this.state=a,this.reducePos=r,this.pos=i,this.score=o,this.buffer=s,this.bufferBase=l,this.curContext=u,this.lookAhead=d,this.parent=p}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,a=0){let r=e.parser.context;return new lH(e,[],n,a,a,0,[],0,r?new oue(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let a=e>>19,r=e&65535,{parser:i}=this.p,o=this.reducePos<this.pos-25;o&&this.setLookAhead(this.pos);let s=i.dynamicPrecedence(r);if(s&&(this.score+=s),a==0){this.pushState(i.getGoto(this.state,r,!0),this.reducePos),r<i.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(r,this.reducePos);return}let l=this.stack.length-(a-1)*3-(e&262144?6:0),u=l?this.stack[l-2]:this.p.ranges[0].from,d=this.reducePos-u;d>=2e3&&!(!((n=this.p.parser.nodeSet.types[r])===null||n===void 0)&&n.isAnonymous)&&(u==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=d):this.p.lastBigReductionSize<d&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=u,this.p.lastBigReductionSize=d));let p=l?this.stack[l-1]:0,m=this.bufferBase+this.buffer.length-p;if(r<i.minRepeatTerm||e&131072){let A=i.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,u,A,m+4,!0)}if(e&262144)this.state=this.stack[l];else{let A=this.stack[l-3];this.state=i.getGoto(A,r,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(r,u)}storeNode(e,n,a,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,s=this.buffer.length;if(s==0&&o.parent&&(s=o.bufferBase-o.parent.bufferBase,o=o.parent),s>0&&o.buffer[s-4]==0&&o.buffer[s-1]>-1){if(n==a)return;if(o.buffer[s-2]>=n){o.buffer[s-2]=a;return}}}if(!i||this.pos==a)this.buffer.push(e,n,a,r);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let s=!1;for(let l=o;l>0&&this.buffer[l-2]>a;l-=4)if(this.buffer[l-1]>=0){s=!0;break}if(s)for(;o>0&&this.buffer[o-2]>a;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,r>4&&(r-=4)}this.buffer[o]=e,this.buffer[o+1]=n,this.buffer[o+2]=a,this.buffer[o+3]=r}}shift(e,n,a,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(n,a),n<=this.p.parser.maxNode&&this.buffer.push(n,a,r,4);else{let i=e,{parser:o}=this.p;(r>this.pos||n<=o.maxNode)&&(this.pos=r,o.stateFlag(i,1)||(this.reducePos=r)),this.pushState(i,a),this.shiftContext(n,a),n<=o.maxNode&&this.buffer.push(n,a,r,4)}}apply(e,n,a,r){e&65536?this.reduce(e):this.shift(e,n,a,r)}useNode(e,n){let a=this.p.reused.length-1;(a<0||this.p.reused[a]!=e)&&(this.p.reused.push(e),a++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(n,r),this.buffer.push(a,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let a=e.buffer.slice(n),r=e.bufferBase+n;for(;e&&r==e.bufferBase;)e=e.parent;return new lH(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,a,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let a=e<=this.p.parser.maxNode;a&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,a?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new Ddt(this);;){let a=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(a==0)return!1;if(!(a&65536))return!0;n.reduce(a)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let r=[];for(let i=0,o;i<n.length;i+=2)(o=n[i+1])!=this.state&&this.p.parser.hasAction(o,e)&&r.push(n[i],o);if(this.stack.length<120)for(let i=0;r.length<8&&i<n.length;i+=2){let o=n[i+1];r.some((s,l)=>l&1&&s==o)||r.push(n[i],o)}n=r}let a=[];for(let r=0;r<n.length&&a.length<4;r+=2){let i=n[r+1];if(i==this.state)continue;let o=this.split();o.pushState(i,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(n[r],this.pos),o.reducePos=this.pos,o.score-=200,a.push(o)}return a}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if(!(n&65536))return!1;if(!e.validAction(this.state,n)){let a=n>>19,r=n&65535,i=this.stack.length-a*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],a=(r,i)=>{if(!n.includes(r))return n.push(r),e.allActions(r,o=>{if(!(o&393216))if(o&65536){let s=(o>>19)-i;if(s>1){let l=o&65535,u=this.stack.length-s*3;if(u>=0&&e.getGoto(this.stack[u],l,!1)>=0)return s<<19|65536|l}}else{let s=a(o,i+1);if(s!=null)return s}})};return a(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new oue(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}};class oue{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class Ddt{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,a=e>>19;a==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(a-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=r}}class b3{constructor(e,n,a){this.stack=e,this.pos=n,this.index=a,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new b3(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new b3(this.stack,this.pos,this.index)}}function y3(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let a=0,r=0;a<t.length;){let i=0;for(;;){let o=t.charCodeAt(a++),s=!1;if(o==126){i=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,s=!0),i+=l,s)break;i*=46}n?n[r++]=i:n=new e(i)}return n}class w3{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const sue=new w3;class Qdt{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=sue,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let a=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<a.from;){if(!r)return null;let o=this.ranges[--r];i-=a.from-o.to,a=o}for(;n<0?i>a.to:i>=a.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];i+=o.from-a.to,a=o}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,a,r;if(n>=0&&n<this.chunk.length)a=this.pos+e,r=this.chunk.charCodeAt(n);else{let i=this.resolveOffset(e,1);if(i==null)return-1;if(a=i,a>=this.chunk2Pos&&a<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(a-this.chunk2Pos);else{let o=this.rangeIndex,s=this.range;for(;s.to<=a;)s=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=a),a+this.chunk2.length>s.to&&(this.chunk2=this.chunk2.slice(0,s.to-a)),r=this.chunk2.charCodeAt(0)}}return a>=this.token.lookAhead&&(this.token.lookAhead=a+1),r}acceptToken(e,n=0){let a=n?this.resolveOffset(n,-1):this.pos;if(a==null||a<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=a}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=sue,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let a="";for(let r of this.ranges){if(r.from>=n)break;r.to>e&&(a+=this.input.read(Math.max(r.from,e),Math.min(r.to,n)))}return a}}class vb{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:a}=n.p;Sdt(this.data,e,n,this.id,a.data,a.tokenPrecTable)}}vb.prototype.contextual=vb.prototype.fallback=vb.prototype.extend=!1,vb.prototype.fallback=vb.prototype.extend=!1;function Sdt(t,e,n,a,r,i){let o=0,s=1<<a,{dialect:l}=n.p.parser;e:for(;s&t[o];){let u=t[o+1];for(let A=o+3;A<u;A+=2)if((t[A+1]&s)>0){let g=t[A];if(l.allows(g)&&(e.token.value==-1||e.token.value==g||Tdt(g,e.token.value,r,i))){e.acceptToken(g);break}}let d=e.next,p=0,m=t[o+2];if(e.next<0&&m>p&&t[u+m*3-3]==65535){o=t[u+m*3-1];continue e}for(;p<m;){let A=p+m>>1,g=u+A+(A<<1),h=t[g],f=t[g+1]||65536;if(d<h)m=A;else if(d>=f)p=A+1;else{o=t[g+2],e.advance();continue e}}break}}function cue(t,e,n){for(let a=e,r;(r=t[a])!=65535;a++)if(r==n)return a-e;return-1}function Tdt(t,e,n,a){let r=cue(n,a,e);return r<0||cue(n,a,t)<r}const js=typeof process<"u"&&iue&&/\bparse\b/.test(iue.LOG);let oN=null;function lue(t,e,n){let a=t.cursor(bi.IncludeAnonymous);for(a.moveTo(e);;)if(!(n<0?a.childBefore(e):a.childAfter(e)))for(;;){if((n<0?a.to<e:a.from>e)&&!a.type.isError)return n<0?Math.max(0,Math.min(a.to-1,e-25)):Math.min(t.length,Math.max(a.from+1,e+25));if(n<0?a.prevSibling():a.nextSibling())break;if(!a.parent())return n<0?0:t.length}}class Fdt{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?lue(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?lue(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let a=this.trees[n],r=this.index[n];if(r==a.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=a.children[r],o=this.start[n]+a.positions[r];if(o>e)return this.nextStart=o,null;if(i instanceof Lr){if(o==e){if(o<this.safeFrom)return null;let s=o+i.length;if(s<=this.safeTo){let l=i.prop(Rn.lookAhead);if(!l||s+l<this.fragment.to)return i}}this.index[n]++,o+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+i.length}}}class Ldt{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(a=>new w3)}getActions(e){let n=0,a=null,{parser:r}=e.p,{tokenizers:i}=r,o=r.stateSlot(e.state,3),s=e.curContext?e.curContext.hash:0,l=0;for(let u=0;u<i.length;u++){if(!(1<<u&o))continue;let d=i[u],p=this.tokens[u];if(!(a&&!d.fallback)&&((d.contextual||p.start!=e.pos||p.mask!=o||p.context!=s)&&(this.updateCachedToken(p,d,e),p.mask=o,p.context=s),p.lookAhead>p.end+25&&(l=Math.max(p.lookAhead,l)),p.value!=0)){let m=n;if(p.extended>-1&&(n=this.addActions(e,p.extended,p.end,n)),n=this.addActions(e,p.value,p.end,n),!d.extend&&(a=p,n>m))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!a&&e.pos==this.stream.end&&(a=new w3,a.value=e.p.parser.eofTerm,a.start=a.end=e.pos,n=this.addActions(e,a.value,a.end,n)),this.mainToken=a,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new w3,{pos:a,p:r}=e;return n.start=a,n.end=Math.min(a+1,r.stream.end),n.value=a==r.stream.end?r.parser.eofTerm:0,n}updateCachedToken(e,n,a){let r=this.stream.clipPos(a.pos);if(n.token(this.stream.reset(r,e),a),e.value>-1){let{parser:i}=a.p;for(let o=0;o<i.specialized.length;o++)if(i.specialized[o]==e.value){let s=i.specializers[o](this.stream.read(e.start,e.end),a);if(s>=0&&a.p.parser.dialect.allows(s>>1)){s&1?e.extended=s>>1:e.value=s>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,n,a,r){for(let i=0;i<r;i+=3)if(this.actions[i]==e)return r;return this.actions[r++]=e,this.actions[r++]=n,this.actions[r++]=a,r}addActions(e,n,a,r){let{state:i}=e,{parser:o}=e.p,{data:s}=o;for(let l=0;l<2;l++)for(let u=o.stateSlot(i,l?2:1);;u+=3){if(s[u]==65535)if(s[u+1]==1)u=Bd(s,u+2);else{r==0&&s[u+1]==2&&(r=this.putAction(Bd(s,u+2),n,a,r));break}s[u]==n&&(r=this.putAction(Bd(s,u+1),n,a,r))}return r}}class Ndt{constructor(e,n,a,r){this.parser=e,this.input=n,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Qdt(n,r),this.tokens=new Ldt(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[Idt.start(this,e.top[0],i)],this.fragments=a.length&&this.stream.end-i>e.bufferLength*4?new Fdt(a,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,a=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let s=e[o];for(;;){if(this.tokens.mainToken=null,s.pos>n)a.push(s);else{if(this.advanceStack(s,a,e))continue;{r||(r=[],i=[]),r.push(s);let l=this.tokens.getMainToken(s);i.push(l.value,l.end)}}break}}if(!a.length){let o=r&&Rdt(r);if(o)return js&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw js&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,a);if(o)return js&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(a.length>o)for(a.sort((s,l)=>l.score-s.score);a.length>o;)a.pop();a.some(s=>s.reducePos>n)&&this.recovering--}else if(a.length>1){e:for(let o=0;o<a.length-1;o++){let s=a[o];for(let l=o+1;l<a.length;l++){let u=a[l];if(s.sameState(u)||s.buffer.length>500&&u.buffer.length>500)if((s.score-u.score||s.buffer.length-u.buffer.length)>0)a.splice(l--,1);else{a.splice(o--,1);continue e}}}a.length>12&&a.splice(12,a.length-12)}this.minStackPos=a[0].pos;for(let o=1;o<a.length;o++)a[o].pos<this.minStackPos&&(this.minStackPos=a[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,n,a){let r=e.pos,{parser:i}=this,o=js?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let u=e.curContext&&e.curContext.tracker.strict,d=u?e.curContext.hash:0;for(let p=this.fragments.nodeAt(r);p;){let m=this.parser.nodeSet.types[p.type.id]==p.type?i.getGoto(e.state,p.type.id):-1;if(m>-1&&p.length&&(!u||(p.prop(Rn.contextHash)||0)==d))return e.useNode(p,m),js&&console.log(o+this.stackID(e)+` (via reuse of ${i.getName(p.type.id)})`),!0;if(!(p instanceof Lr)||p.children.length==0||p.positions[0]>0)break;let A=p.children[0];if(A instanceof Lr&&p.positions[0]==0)p=A;else break}}let s=i.stateSlot(e.state,4);if(s>0)return e.reduce(s),js&&console.log(o+this.stackID(e)+` (via always-reduce ${i.getName(s&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let u=0;u<l.length;){let d=l[u++],p=l[u++],m=l[u++],A=u==l.length||!a,g=A?e:e.split(),h=this.tokens.mainToken;if(g.apply(d,p,h?h.start:g.pos,m),js&&console.log(o+this.stackID(g)+` (via ${d&65536?`reduce of ${i.getName(d&65535)}`:"shift"} for ${i.getName(p)} @ ${r}${g==e?"":", split"})`),A)return!0;g.pos>r?n.push(g):a.push(g)}return!1}advanceFully(e,n){let a=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>a)return uue(e,n),!0}}runRecovery(e,n,a){let r=null,i=!1;for(let o=0;o<e.length;o++){let s=e[o],l=n[o<<1],u=n[(o<<1)+1],d=js?this.stackID(s)+" -> ":"";if(s.deadEnd&&(i||(i=!0,s.restart(),js&&console.log(d+this.stackID(s)+" (restarted)"),this.advanceFully(s,a))))continue;let p=s.split(),m=d;for(let A=0;A<10&&p.forceReduce()&&(js&&console.log(m+this.stackID(p)+" (via force-reduce)"),!this.advanceFully(p,a));A++)js&&(m=this.stackID(p)+" -> ");for(let A of s.recoverByInsert(l))js&&console.log(d+this.stackID(A)+" (via recover-insert)"),this.advanceFully(A,a);this.stream.end>s.pos?(u==s.pos&&(u++,l=0),s.recoverByDelete(l,u),js&&console.log(d+this.stackID(s)+` (via recover-delete ${this.parser.getName(l)})`),uue(s,a)):(!r||r.score<s.score)&&(r=s)}return r}stackToTree(e){return e.close(),Lr.build({buffer:b3.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(oN||(oN=new WeakMap)).get(e);return n||oN.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function uue(t,e){for(let n=0;n<e.length;n++){let a=e[n];if(a.pos==t.pos&&a.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class Mdt{constructor(e,n,a){this.source=e,this.flags=n,this.disabled=a}allows(e){return!this.disabled||this.disabled[e]==0}}class k3 extends Wse{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let s=0;s<e.repeatNodeCount;s++)n.push("");let a=Object.keys(e.topRules).map(s=>e.topRules[s][1]),r=[];for(let s=0;s<n.length;s++)r.push([]);function i(s,l,u){r[s].push([l,l.deserialize(String(u))])}if(e.nodeProps)for(let s of e.nodeProps){let l=s[0];typeof l=="string"&&(l=Rn[l]);for(let u=1;u<s.length;){let d=s[u++];if(d>=0)i(d,l,s[u++]);else{let p=s[u+-d];for(let m=-d;m>0;m--)i(s[u++],l,p);u++}}}this.nodeSet=new hL(n.map((s,l)=>ds.define({name:l>=this.minRepeatTerm?void 0:s,id:l,props:r[l],top:a.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=jse;let o=y3(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let s=0;s<this.specializerSpecs.length;s++)this.specialized[s]=this.specializerSpecs[s].term;this.specializers=this.specializerSpecs.map(due),this.states=y3(e.states,Uint32Array),this.data=y3(e.stateData),this.goto=y3(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(s=>typeof s=="number"?new vb(o,s):s),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,a){let r=new Ndt(this,e,n,a);for(let i of this.wrappers)r=i(r,e,n,a);return r}getGoto(e,n,a=!1){let r=this.goto;if(n>=r[0])return-1;for(let i=r[n+1];;){let o=r[i++],s=o&1,l=r[i++];if(s&&a)return l;for(let u=i+(o>>1);i<u;i++)if(r[i]==e)return l;if(s)return-1}}hasAction(e,n){let a=this.data;for(let r=0;r<2;r++)for(let i=this.stateSlot(e,r?2:1),o;;i+=3){if((o=a[i])==65535)if(a[i+1]==1)o=a[i=Bd(a,i+2)];else{if(a[i+1]==2)return Bd(a,i+2);break}if(o==n||o==0)return Bd(a,i+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,a=>a==n?!0:null)}allActions(e,n){let a=this.stateSlot(e,4),r=a?n(a):void 0;for(let i=this.stateSlot(e,1);r==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Bd(this.data,i+2);else break;r=n(Bd(this.data,i+1))}return r}nextStates(e){let n=[];for(let a=this.stateSlot(e,1);;a+=3){if(this.data[a]==65535)if(this.data[a+1]==1)a=Bd(this.data,a+2);else break;if(!(this.data[a+2]&1)){let r=this.data[a+1];n.some((i,o)=>o&1&&i==r)||n.push(this.data[a],r)}}return n}configure(e){let n=Object.assign(Object.create(k3.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let a=this.topRules[e.top];if(!a)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=a}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(a=>{let r=e.tokenizers.find(i=>i.from==a);return r?r.to:a})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((a,r)=>{let i=e.specializers.find(s=>s.from==a.external);if(!i)return a;let o=Object.assign(Object.assign({},a),{external:i.to});return n.specializers[r]=due(o),o})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),a=n.map(()=>!1);if(e)for(let i of e.split(" ")){let o=n.indexOf(i);o>=0&&(a[o]=!0)}let r=null;for(let i=0;i<n.length;i++)if(!a[i])for(let o=this.dialects[n[i]],s;(s=this.data[o++])!=65535;)(r||(r=new Uint8Array(this.maxTerm+1)))[s]=1;return new Mdt(e,a,r)}static deserialize(e){return new k3(e)}}function Bd(t,e){return t[e]|t[e+1]<<16}function Rdt(t){let e=null;for(let n of t){let a=n.p.stoppedAt;(n.pos==n.p.stream.end||a!=null&&n.pos>a)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function due(t){if(t.external){let e=t.extend?1:0;return(n,a)=>t.external(n,a)<<1|e}return t.get}const Pdt=Kse({String:Xe.string,Number:Xe.number,"True False":Xe.bool,PropertyName:Xe.propertyName,Null:Xe.null,", :":Xe.separator,"[ ]":Xe.squareBracket,"{ }":Xe.brace}),$dt=k3.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[Pdt],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),Odt=H2.define({name:"json",parser:$dt.configure({props:[ace.add({Object:ice({except:/^\s*\}/}),Array:ice({except:/^\s*\]/})}),oce.add({"Object Array":Zst})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function pue(){return new Pst(Odt)}const mue=t=>{const{language:e="json",placeholder:n="Write your code here",value:a="",onChange:r}=t,i={json:pue()};return H.jsx(rue,{value:a,height:"400px",placeholder:n,extensions:[i[e]??pue()],onChange:r,theme:"light",editable:!0})},Ka={promptCodeEditor:"_promptCodeEditor_1b6xt_16",promptCodeEditor_headerContainer:"_promptCodeEditor_headerContainer_1b6xt_23",form:"_form_1b6xt_30",form_label:"_form_label_1b6xt_35",form_field:"_form_field_1b6xt_41",inputWrapper:"_inputWrapper_1b6xt_46",inputIcon:"_inputIcon_1b6xt_52",fieldInput:"_fieldInput_1b6xt_61",buttonSubmit:"_buttonSubmit_1b6xt_76",panel:"_panel_1b6xt_103",slideDown:"_slideDown_1b6xt_1",panel_loading:"_panel_loading_1b6xt_120",loadingSpinner:"_loadingSpinner_1b6xt_123",spin:"_spin_1b6xt_1",loadingText:"_loadingText_1b6xt_132",panel_error:"_panel_error_1b6xt_137",errorText:"_errorText_1b6xt_142",discardButton:"_discardButton_1b6xt_147",panel_response:"_panel_response_1b6xt_157",diffContainer:"_diffContainer_1b6xt_162",diffContainer_label:"_diffContainer_label_1b6xt_167",actions:"_actions_1b6xt_179",actions_discardButton:"_actions_discardButton_1b6xt_184",actions_applyButton:"_actions_applyButton_1b6xt_195",promptCodeEditor_codeContainer:"_promptCodeEditor_codeContainer_1b6xt_205",codeBlockLabel:"_codeBlockLabel_1b6xt_212"},jdt=({value:t,placeholder:e,label:n,loading:a,disabled:r,setValue:i,onSubmit:o})=>{const s=be.useMemo(()=>[e||"Edita esta regla con un prompt...","Describe los cambios que necesitas...","Modifica la configuración sin tocar el código..."],[e]),[l,u]=be.useState(0);return be.useEffect(()=>{if(t!=null&&t.trim()||a||r)return;const d=setInterval(()=>{u(p=>(p+1)%s.length)},3e3);return()=>clearInterval(d)},[t,a,r,s==null?void 0:s.length]),H.jsxs("div",{className:Ka.form,children:[n&&H.jsx("label",{className:Ka.form_label,children:n}),H.jsx("div",{className:Ka.form_field,children:H.jsxs("div",{className:Ka.inputWrapper,children:[H.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:Ka.inputIcon,"aria-hidden":"true",children:[H.jsx("path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"}),H.jsx("path",{d:"M20 2v4"}),H.jsx("path",{d:"M22 4h-4"}),H.jsx("circle",{cx:"4",cy:"20",r:"2"})]}),H.jsx(Qtt,{type:"text",placeholder:s[l],value:t,onChange:d=>i==null?void 0:i(d.target.value),onKeyDown:d=>{d.key==="Enter"&&!d.shiftKey&&(t!=null&&t.trim())&&!a&&!r&&(d.preventDefault(),o==null||o())},className:Ka.fieldInput,disabled:a||r}),H.jsx(ef,{onClick:o,disabled:!(t!=null&&t.trim())||a||r,className:Ka.buttonSubmit,children:"Proponer solución"})]})})]})},Gdt=({requestConfig:t,language:e,disabled:n=!1,inputLabel:a,inputPlaceholder:r="",codeBlockLabel:i,codeBlockValue:o,onCodeChange:s})=>{const[l,u]=be.useState(o),[d,p]=be.useState(""),[m,A]=be.useState(!1),g=be.useRef(null),h=be.useRef(null),{loading:f,response:b,error:y,onSubmit:w}=frt(t),k=()=>{d.trim()&&w({code:l,prompt:d})},C=()=>{b!=null&&b.modifiedCode&&(u(b.modifiedCode),s==null||s(b.modifiedCode),A(!1),p(""))},x=()=>{A(!1)};return be.useEffect(()=>{u(o)},[o]),be.useEffect(()=>{(f||b||y)&&A(!0)},[f,b,y]),be.useEffect(()=>{const _=E=>{g.current&&!g.current.contains(E.target)&&h.current&&!h.current.contains(E.target)&&A(!1)};return m&&document.addEventListener("mousedown",_),()=>{document.removeEventListener("mousedown",_)}},[m]),H.jsxs("section",{className:Ka.promptCodeEditor,children:[H.jsxs("div",{className:Ka.promptCodeEditor_headerContainer,ref:h,children:[H.jsx(jdt,{value:d,loading:f,label:a,disabled:n,placeholder:r,setValue:p,onSubmit:k}),m&&(f||y||b)&&H.jsxs("div",{ref:g,className:Ka.panel,children:[f&&H.jsxs("div",{className:Ka.panel_loading,children:[H.jsx("div",{className:Ka.loadingSpinner}),H.jsx("p",{className:Ka.loadingText,children:"Generando cambios..."})]}),y&&H.jsxs("div",{className:Ka.panel_error,children:[H.jsx("p",{className:Ka.errorText,children:y}),H.jsx(ef,{onClick:x,variant:"outline",size:"sm",className:Ka.discardButton,children:"Cerrar"})]}),b&&!f&&H.jsxs("div",{className:Ka.panel_response,children:[H.jsxs("div",{className:Ka.diffContainer,children:[H.jsx("p",{className:Ka.diffContainer_label,children:"Solución propuesta"}),H.jsx(RB,{code:b.codeWithAnnotations,language:e,showLineNumbers:!0})]}),H.jsxs("div",{className:Ka.actions,children:[H.jsx(ef,{size:"sm",onClick:x,variant:"outline",className:Ka.actions_discardButton,children:"Cancelar"}),H.jsx(ef,{size:"sm",onClick:C,variant:"default",className:Ka.actions_applyButton,children:"Insertar código"})]})]})]})]}),H.jsxs("div",{className:Ka.promptCodeEditor_codeContainer,children:[i&&H.jsx("label",{className:Ka.codeBlockLabel,children:i}),H.jsx(mue,{value:l,onChange:_=>{u(_),s==null||s(_)}})]})]})};var sN={name:"mermaid",version:"11.12.2",description:"Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.",type:"module",module:"./dist/mermaid.core.mjs",types:"./dist/mermaid.d.ts",exports:{".":{types:"./dist/mermaid.d.ts",import:"./dist/mermaid.core.mjs",default:"./dist/mermaid.core.mjs"},"./*":"./*"},keywords:["diagram","markdown","flowchart","sequence diagram","gantt","class diagram","git graph","mindmap","packet diagram","c4 diagram","er diagram","pie chart","pie diagram","quadrant chart","requirement diagram","graph"],scripts:{clean:"rimraf dist",dev:"pnpm -w dev","docs:code":"typedoc src/defaultConfig.ts src/config.ts src/mermaid.ts && prettier --write ./src/docs/config/setup","docs:build":"rimraf ../../docs && pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts","docs:verify":"pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts --verify","docs:pre:vitepress":"pnpm --filter ./src/docs prefetch && rimraf src/vitepress && pnpm docs:code && tsx scripts/docs.cli.mts --vitepress && pnpm --filter ./src/vitepress install --no-frozen-lockfile --ignore-scripts","docs:build:vitepress":"pnpm docs:pre:vitepress && (cd src/vitepress && pnpm run build) && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing","docs:dev":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:dev:docker":'pnpm docs:pre:vitepress && concurrently "pnpm --filter ./src/vitepress dev:docker" "tsx scripts/docs.cli.mts --watch --vitepress"',"docs:serve":"pnpm docs:build:vitepress && vitepress serve src/vitepress","docs:spellcheck":'cspell "src/docs/**/*.md"',"docs:release-version":"tsx scripts/update-release-version.mts","docs:verify-version":"tsx scripts/update-release-version.mts --verify","types:build-config":"tsx scripts/create-types-from-json-schema.mts","types:verify-config":"tsx scripts/create-types-from-json-schema.mts --verify",checkCircle:"npx madge --circular ./src",prepublishOnly:"pnpm docs:verify-version"},repository:{type:"git",url:"https://github.com/mermaid-js/mermaid"},author:"Knut Sveidqvist",license:"MIT",standard:{ignore:["**/parser/*.js","dist/**/*.js","cypress/**/*.js"],globals:["page"]},dependencies:{"@braintree/sanitize-url":"^7.1.1","@iconify/utils":"^3.0.1","@mermaid-js/parser":"workspace:^","@types/d3":"^7.4.3",cytoscape:"^3.29.3","cytoscape-cose-bilkent":"^4.1.0","cytoscape-fcose":"^2.2.0",d3:"^7.9.0","d3-sankey":"^0.12.3","dagre-d3-es":"7.0.13",dayjs:"^1.11.18",dompurify:"^3.2.5",katex:"^0.16.22",khroma:"^2.1.0","lodash-es":"^4.17.21",marked:"^16.2.1",roughjs:"^4.6.6",stylis:"^4.3.6","ts-dedent":"^2.2.0",uuid:"^11.1.0"},devDependencies:{"@adobe/jsonschema2md":"^8.0.5","@iconify/types":"^2.0.0","@types/cytoscape":"^3.21.9","@types/cytoscape-fcose":"^2.2.4","@types/d3-sankey":"^0.12.4","@types/d3-scale":"^4.0.9","@types/d3-scale-chromatic":"^3.1.0","@types/d3-selection":"^3.0.11","@types/d3-shape":"^3.1.7","@types/jsdom":"^21.1.7","@types/katex":"^0.16.7","@types/lodash-es":"^4.17.12","@types/micromatch":"^4.0.9","@types/stylis":"^4.2.7","@types/uuid":"^10.0.0",ajv:"^8.17.1",canvas:"^3.1.2",chokidar:"3.6.0",concurrently:"^9.1.2","csstree-validator":"^4.0.1",globby:"^14.1.0",jison:"^0.4.18","js-base64":"^3.7.8",jsdom:"^26.1.0","json-schema-to-typescript":"^15.0.4",micromatch:"^4.0.8","path-browserify":"^1.0.1",prettier:"^3.5.3",remark:"^15.0.1","remark-frontmatter":"^5.0.0","remark-gfm":"^4.0.1",rimraf:"^6.0.1","start-server-and-test":"^2.0.13","type-fest":"^4.35.0",typedoc:"^0.28.12","typedoc-plugin-markdown":"^4.8.1",typescript:"~5.7.3","unist-util-flatmap":"^1.0.0","unist-util-visit":"^5.0.0",vitepress:"^1.6.4","vitepress-plugin-search":"1.0.4-alpha.22"},files:["dist/","README.md"],publishConfig:{access:"public"}},Aue={exports:{}};(function(t,e){(function(n,a){t.exports=a()})(xo,function(){var n=1e3,a=6e4,r=36e5,i="millisecond",o="second",s="minute",l="hour",u="day",d="week",p="month",m="quarter",A="year",g="date",h="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(B){var S=["th","st","nd","rd"],M=B%100;return"["+B+(S[(M-20)%10]||S[M]||S[0])+"]"}},w=function(B,S,M){var L=String(B);return!L||L.length>=S?B:""+Array(S+1-L.length).join(M)+B},k={s:w,z:function(B){var S=-B.utcOffset(),M=Math.abs(S),L=Math.floor(M/60),F=M%60;return(S<=0?"+":"-")+w(L,2,"0")+":"+w(F,2,"0")},m:function B(S,M){if(S.date()<M.date())return-B(M,S);var L=12*(M.year()-S.year())+(M.month()-S.month()),F=S.clone().add(L,p),R=M-F<0,P=S.clone().add(L+(R?-1:1),p);return+(-(L+(M-F)/(R?F-P:P-F))||0)},a:function(B){return B<0?Math.ceil(B)||0:Math.floor(B)},p:function(B){return{M:p,y:A,w:d,d:u,D:g,h:l,m:s,s:o,ms:i,Q:m}[B]||String(B||"").toLowerCase().replace(/s$/,"")},u:function(B){return B===void 0}},C="en",x={};x[C]=y;var _="$isDayjsObject",E=function(B){return B instanceof T||!(!B||!B[_])},I=function B(S,M,L){var F;if(!S)return C;if(typeof S=="string"){var R=S.toLowerCase();x[R]&&(F=R),M&&(x[R]=M,F=R);var P=S.split("-");if(!F&&P.length>1)return B(P[0])}else{var $=S.name;x[$]=S,F=$}return!L&&F&&(C=F),F||!L&&C},Q=function(B,S){if(E(B))return B.clone();var M=typeof S=="object"?S:{};return M.date=B,M.args=arguments,new T(M)},D=k;D.l=I,D.i=E,D.w=function(B,S){return Q(B,{locale:S.$L,utc:S.$u,x:S.$x,$offset:S.$offset})};var T=function(){function B(M){this.$L=I(M.locale,null,!0),this.parse(M),this.$x=this.$x||M.x||{},this[_]=!0}var S=B.prototype;return S.parse=function(M){this.$d=function(L){var F=L.date,R=L.utc;if(F===null)return new Date(NaN);if(D.u(F))return new Date;if(F instanceof Date)return new Date(F);if(typeof F=="string"&&!/Z$/i.test(F)){var P=F.match(f);if(P){var $=P[2]-1||0,q=(P[7]||"0").substring(0,3);return R?new Date(Date.UTC(P[1],$,P[3]||1,P[4]||0,P[5]||0,P[6]||0,q)):new Date(P[1],$,P[3]||1,P[4]||0,P[5]||0,P[6]||0,q)}}return new Date(F)}(M),this.init()},S.init=function(){var M=this.$d;this.$y=M.getFullYear(),this.$M=M.getMonth(),this.$D=M.getDate(),this.$W=M.getDay(),this.$H=M.getHours(),this.$m=M.getMinutes(),this.$s=M.getSeconds(),this.$ms=M.getMilliseconds()},S.$utils=function(){return D},S.isValid=function(){return this.$d.toString()!==h},S.isSame=function(M,L){var F=Q(M);return this.startOf(L)<=F&&F<=this.endOf(L)},S.isAfter=function(M,L){return Q(M)<this.startOf(L)},S.isBefore=function(M,L){return this.endOf(L)<Q(M)},S.$g=function(M,L,F){return D.u(M)?this[L]:this.set(F,M)},S.unix=function(){return Math.floor(this.valueOf()/1e3)},S.valueOf=function(){return this.$d.getTime()},S.startOf=function(M,L){var F=this,R=!!D.u(L)||L,P=D.p(M),$=function(V,te){var Z=D.w(F.$u?Date.UTC(F.$y,te,V):new Date(F.$y,te,V),F);return R?Z:Z.endOf(u)},q=function(V,te){return D.w(F.toDate()[V].apply(F.toDate("s"),(R?[0,0,0,0]:[23,59,59,999]).slice(te)),F)},j=this.$W,J=this.$M,Y=this.$D,ne="set"+(this.$u?"UTC":"");switch(P){case A:return R?$(1,0):$(31,11);case p:return R?$(1,J):$(0,J+1);case d:var ee=this.$locale().weekStart||0,me=(j<ee?j+7:j)-ee;return $(R?Y-me:Y+(6-me),J);case u:case g:return q(ne+"Hours",0);case l:return q(ne+"Minutes",1);case s:return q(ne+"Seconds",2);case o:return q(ne+"Milliseconds",3);default:return this.clone()}},S.endOf=function(M){return this.startOf(M,!1)},S.$set=function(M,L){var F,R=D.p(M),P="set"+(this.$u?"UTC":""),$=(F={},F[u]=P+"Date",F[g]=P+"Date",F[p]=P+"Month",F[A]=P+"FullYear",F[l]=P+"Hours",F[s]=P+"Minutes",F[o]=P+"Seconds",F[i]=P+"Milliseconds",F)[R],q=R===u?this.$D+(L-this.$W):L;if(R===p||R===A){var j=this.clone().set(g,1);j.$d[$](q),j.init(),this.$d=j.set(g,Math.min(this.$D,j.daysInMonth())).$d}else $&&this.$d[$](q);return this.init(),this},S.set=function(M,L){return this.clone().$set(M,L)},S.get=function(M){return this[D.p(M)]()},S.add=function(M,L){var F,R=this;M=Number(M);var P=D.p(L),$=function(J){var Y=Q(R);return D.w(Y.date(Y.date()+Math.round(J*M)),R)};if(P===p)return this.set(p,this.$M+M);if(P===A)return this.set(A,this.$y+M);if(P===u)return $(1);if(P===d)return $(7);var q=(F={},F[s]=a,F[l]=r,F[o]=n,F)[P]||1,j=this.$d.getTime()+M*q;return D.w(j,this)},S.subtract=function(M,L){return this.add(-1*M,L)},S.format=function(M){var L=this,F=this.$locale();if(!this.isValid())return F.invalidDate||h;var R=M||"YYYY-MM-DDTHH:mm:ssZ",P=D.z(this),$=this.$H,q=this.$m,j=this.$M,J=F.weekdays,Y=F.months,ne=F.meridiem,ee=function(te,Z,K,re){return te&&(te[Z]||te(L,R))||K[Z].slice(0,re)},me=function(te){return D.s($%12||12,te,"0")},V=ne||function(te,Z,K){var re=te<12?"AM":"PM";return K?re.toLowerCase():re};return R.replace(b,function(te,Z){return Z||function(K){switch(K){case"YY":return String(L.$y).slice(-2);case"YYYY":return D.s(L.$y,4,"0");case"M":return j+1;case"MM":return D.s(j+1,2,"0");case"MMM":return ee(F.monthsShort,j,Y,3);case"MMMM":return ee(Y,j);case"D":return L.$D;case"DD":return D.s(L.$D,2,"0");case"d":return String(L.$W);case"dd":return ee(F.weekdaysMin,L.$W,J,2);case"ddd":return ee(F.weekdaysShort,L.$W,J,3);case"dddd":return J[L.$W];case"H":return String($);case"HH":return D.s($,2,"0");case"h":return me(1);case"hh":return me(2);case"a":return V($,q,!0);case"A":return V($,q,!1);case"m":return String(q);case"mm":return D.s(q,2,"0");case"s":return String(L.$s);case"ss":return D.s(L.$s,2,"0");case"SSS":return D.s(L.$ms,3,"0");case"Z":return P}return null}(te)||P.replace(":","")})},S.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},S.diff=function(M,L,F){var R,P=this,$=D.p(L),q=Q(M),j=(q.utcOffset()-this.utcOffset())*a,J=this-q,Y=function(){return D.m(P,q)};switch($){case A:R=Y()/12;break;case p:R=Y();break;case m:R=Y()/3;break;case d:R=(J-j)/6048e5;break;case u:R=(J-j)/864e5;break;case l:R=J/r;break;case s:R=J/a;break;case o:R=J/n;break;default:R=J}return F?R:D.a(R)},S.daysInMonth=function(){return this.endOf(p).$D},S.$locale=function(){return x[this.$L]},S.locale=function(M,L){if(!M)return this.$L;var F=this.clone(),R=I(M,L,!0);return R&&(F.$L=R),F},S.clone=function(){return D.w(this.$d,this)},S.toDate=function(){return new Date(this.valueOf())},S.toJSON=function(){return this.isValid()?this.toISOString():null},S.toISOString=function(){return this.$d.toISOString()},S.toString=function(){return this.$d.toUTCString()},B}(),N=T.prototype;return Q.prototype=N,[["$ms",i],["$s",o],["$m",s],["$H",l],["$W",u],["$M",p],["$y",A],["$D",g]].forEach(function(B){N[B[1]]=function(S){return this.$g(S,B[0],B[1])}}),Q.extend=function(B,S){return B.$i||(B(S,T,Q),B.$i=!0),Q},Q.locale=I,Q.isDayjs=E,Q.unix=function(B){return Q(1e3*B)},Q.en=x[C],Q.Ls=x,Q.p={},Q})})(Aue);var qdt=Aue.exports;const wi=Fl(qdt);var gue=Object.defineProperty,v=(t,e)=>gue(t,"name",{value:e,configurable:!0}),v3=(t,e)=>{for(var n in e)gue(t,n,{get:e[n],enumerable:!0})},Id={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},se={trace:v((...t)=>{},"trace"),debug:v((...t)=>{},"debug"),info:v((...t)=>{},"info"),warn:v((...t)=>{},"warn"),error:v((...t)=>{},"error"),fatal:v((...t)=>{},"fatal")},cN=v(function(t="fatal"){let e=Id.fatal;typeof t=="string"?t.toLowerCase()in Id&&(e=Id[t]):typeof t=="number"&&(e=t),se.trace=()=>{},se.debug=()=>{},se.info=()=>{},se.warn=()=>{},se.error=()=>{},se.fatal=()=>{},e<=Id.fatal&&(se.fatal=console.error?console.error.bind(console,_c("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",_c("FATAL"))),e<=Id.error&&(se.error=console.error?console.error.bind(console,_c("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",_c("ERROR"))),e<=Id.warn&&(se.warn=console.warn?console.warn.bind(console,_c("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",_c("WARN"))),e<=Id.info&&(se.info=console.info?console.info.bind(console,_c("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",_c("INFO"))),e<=Id.debug&&(se.debug=console.debug?console.debug.bind(console,_c("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",_c("DEBUG"))),e<=Id.trace&&(se.trace=console.debug?console.debug.bind(console,_c("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",_c("TRACE")))},"setLogLevel"),_c=v(t=>`%c${wi().format("ss.SSS")} : ${t} : `,"format");const C3={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:t=>t>=255?255:t<0?0:t,g:t=>t>=255?255:t<0?0:t,b:t=>t>=255?255:t<0?0:t,h:t=>t%360,s:t=>t>=100?100:t<0?0:t,l:t=>t>=100?100:t<0?0:t,a:t=>t>=1?1:t<0?0:t},toLinear:t=>{const e=t/255;return t>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92},hue2rgb:(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t),hsl2rgb:({h:t,s:e,l:n},a)=>{if(!e)return n*2.55;t/=360,e/=100,n/=100;const r=n<.5?n*(1+e):n+e-n*e,i=2*n-r;switch(a){case"r":return C3.hue2rgb(i,r,t+1/3)*255;case"g":return C3.hue2rgb(i,r,t)*255;case"b":return C3.hue2rgb(i,r,t-1/3)*255}},rgb2hsl:({r:t,g:e,b:n},a)=>{t/=255,e/=255,n/=255;const r=Math.max(t,e,n),i=Math.min(t,e,n),o=(r+i)/2;if(a==="l")return o*100;if(r===i)return 0;const s=r-i,l=o>.5?s/(2-r-i):s/(r+i);if(a==="s")return l*100;switch(r){case t:return((e-n)/s+(e<n?6:0))*60;case e:return((n-t)/s+2)*60;case n:return((t-e)/s+4)*60;default:return-1}}},yn={channel:C3,lang:{clamp:(t,e,n)=>e>n?Math.min(e,Math.max(n,t)):Math.min(n,Math.max(e,t)),round:t=>Math.round(t*1e10)/1e10},unit:{dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}}},cm={};for(let t=0;t<=255;t++)cm[t]=yn.unit.dec2hex(t);const oo={ALL:0,RGB:1,HSL:2};let zdt=class{constructor(){this.type=oo.ALL}get(){return this.type}set(e){if(this.type&&this.type!==e)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=e}reset(){this.type=oo.ALL}is(e){return this.type===e}};class Hdt{constructor(e,n){this.color=n,this.changed=!1,this.data=e,this.type=new zdt}set(e,n){return this.color=n,this.changed=!1,this.data=e,this.type.type=oo.ALL,this}_ensureHSL(){const e=this.data,{h:n,s:a,l:r}=e;n===void 0&&(e.h=yn.channel.rgb2hsl(e,"h")),a===void 0&&(e.s=yn.channel.rgb2hsl(e,"s")),r===void 0&&(e.l=yn.channel.rgb2hsl(e,"l"))}_ensureRGB(){const e=this.data,{r:n,g:a,b:r}=e;n===void 0&&(e.r=yn.channel.hsl2rgb(e,"r")),a===void 0&&(e.g=yn.channel.hsl2rgb(e,"g")),r===void 0&&(e.b=yn.channel.hsl2rgb(e,"b"))}get r(){const e=this.data,n=e.r;return!this.type.is(oo.HSL)&&n!==void 0?n:(this._ensureHSL(),yn.channel.hsl2rgb(e,"r"))}get g(){const e=this.data,n=e.g;return!this.type.is(oo.HSL)&&n!==void 0?n:(this._ensureHSL(),yn.channel.hsl2rgb(e,"g"))}get b(){const e=this.data,n=e.b;return!this.type.is(oo.HSL)&&n!==void 0?n:(this._ensureHSL(),yn.channel.hsl2rgb(e,"b"))}get h(){const e=this.data,n=e.h;return!this.type.is(oo.RGB)&&n!==void 0?n:(this._ensureRGB(),yn.channel.rgb2hsl(e,"h"))}get s(){const e=this.data,n=e.s;return!this.type.is(oo.RGB)&&n!==void 0?n:(this._ensureRGB(),yn.channel.rgb2hsl(e,"s"))}get l(){const e=this.data,n=e.l;return!this.type.is(oo.RGB)&&n!==void 0?n:(this._ensureRGB(),yn.channel.rgb2hsl(e,"l"))}get a(){return this.data.a}set r(e){this.type.set(oo.RGB),this.changed=!0,this.data.r=e}set g(e){this.type.set(oo.RGB),this.changed=!0,this.data.g=e}set b(e){this.type.set(oo.RGB),this.changed=!0,this.data.b=e}set h(e){this.type.set(oo.HSL),this.changed=!0,this.data.h=e}set s(e){this.type.set(oo.HSL),this.changed=!0,this.data.s=e}set l(e){this.type.set(oo.HSL),this.changed=!0,this.data.l=e}set a(e){this.changed=!0,this.data.a=e}}const _3=new Hdt({r:0,g:0,b:0,a:0},"transparent"),Cb={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(t.charCodeAt(0)!==35)return;const e=t.match(Cb.re);if(!e)return;const n=e[1],a=parseInt(n,16),r=n.length,i=r%4===0,o=r>4,s=o?1:17,l=o?8:4,u=i?0:-1,d=o?255:15;return _3.set({r:(a>>l*(u+3)&d)*s,g:(a>>l*(u+2)&d)*s,b:(a>>l*(u+1)&d)*s,a:i?(a&d)*s/255:1},t)},stringify:t=>{const{r:e,g:n,b:a,a:r}=t;return r<1?`#${cm[Math.round(e)]}${cm[Math.round(n)]}${cm[Math.round(a)]}${cm[Math.round(r*255)]}`:`#${cm[Math.round(e)]}${cm[Math.round(n)]}${cm[Math.round(a)]}`}},gg={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:t=>{const e=t.match(gg.hueRe);if(e){const[,n,a]=e;switch(a){case"grad":return yn.channel.clamp.h(parseFloat(n)*.9);case"rad":return yn.channel.clamp.h(parseFloat(n)*180/Math.PI);case"turn":return yn.channel.clamp.h(parseFloat(n)*360)}}return yn.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(e!==104&&e!==72)return;const n=t.match(gg.re);if(!n)return;const[,a,r,i,o,s]=n;return _3.set({h:gg._hue2deg(a),s:yn.channel.clamp.s(parseFloat(r)),l:yn.channel.clamp.l(parseFloat(i)),a:o?yn.channel.clamp.a(s?parseFloat(o)/100:parseFloat(o)):1},t)},stringify:t=>{const{h:e,s:n,l:a,a:r}=t;return r<1?`hsla(${yn.lang.round(e)}, ${yn.lang.round(n)}%, ${yn.lang.round(a)}%, ${r})`:`hsl(${yn.lang.round(e)}, ${yn.lang.round(n)}%, ${yn.lang.round(a)}%)`}},O1={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:t=>{t=t.toLowerCase();const e=O1.colors[t];if(e)return Cb.parse(e)},stringify:t=>{const e=Cb.stringify(t);for(const n in O1.colors)if(O1.colors[n]===e)return n}},j1={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:t=>{const e=t.charCodeAt(0);if(e!==114&&e!==82)return;const n=t.match(j1.re);if(!n)return;const[,a,r,i,o,s,l,u,d]=n;return _3.set({r:yn.channel.clamp.r(r?parseFloat(a)*2.55:parseFloat(a)),g:yn.channel.clamp.g(o?parseFloat(i)*2.55:parseFloat(i)),b:yn.channel.clamp.b(l?parseFloat(s)*2.55:parseFloat(s)),a:u?yn.channel.clamp.a(d?parseFloat(u)/100:parseFloat(u)):1},t)},stringify:t=>{const{r:e,g:n,b:a,a:r}=t;return r<1?`rgba(${yn.lang.round(e)}, ${yn.lang.round(n)}, ${yn.lang.round(a)}, ${yn.lang.round(r)})`:`rgb(${yn.lang.round(e)}, ${yn.lang.round(n)}, ${yn.lang.round(a)})`}},sl={format:{keyword:O1,hex:Cb,rgb:j1,rgba:j1,hsl:gg,hsla:gg},parse:t=>{if(typeof t!="string")return t;const e=Cb.parse(t)||j1.parse(t)||gg.parse(t)||O1.parse(t);if(e)return e;throw new Error(`Unsupported color format: "${t}"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(oo.HSL)||t.data.r===void 0?gg.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?j1.stringify(t):Cb.stringify(t)},hue=(t,e)=>{const n=sl.parse(t);for(const a in e)n[a]=yn.channel.clamp[a](e[a]);return sl.stringify(n)},lm=(t,e,n=0,a=1)=>{if(typeof t!="number")return hue(t,{a:e});const r=_3.set({r:yn.channel.clamp.r(t),g:yn.channel.clamp.g(e),b:yn.channel.clamp.b(n),a:yn.channel.clamp.a(a)});return sl.stringify(r)},lN=(t,e)=>yn.lang.round(sl.parse(t)[e]),Udt=t=>{const{r:e,g:n,b:a}=sl.parse(t),r=.2126*yn.channel.toLinear(e)+.7152*yn.channel.toLinear(n)+.0722*yn.channel.toLinear(a);return yn.lang.round(r)},Ydt=t=>Udt(t)>=.5,um=t=>!Ydt(t),fue=(t,e,n)=>{const a=sl.parse(t),r=a[e],i=yn.channel.clamp[e](r+n);return r!==i&&(a[e]=i),sl.stringify(a)},Yt=(t,e)=>fue(t,"l",e),an=(t,e)=>fue(t,"l",-e),Ge=(t,e)=>{const n=sl.parse(t),a={};for(const r in e)e[r]&&(a[r]=n[r]+e[r]);return hue(t,a)},Wdt=(t,e,n=50)=>{const{r:a,g:r,b:i,a:o}=sl.parse(t),{r:s,g:l,b:u,a:d}=sl.parse(e),p=n/100,m=p*2-1,A=o-d,h=((m*A===-1?m:(m+A)/(1+m*A))+1)/2,f=1-h,b=a*h+s*f,y=r*h+l*f,w=i*h+u*f,k=o*p+d*(1-p);return lm(b,y,w,k)},Lt=(t,e=100)=>{const n=sl.parse(t);return n.r=255-n.r,n.g=255-n.g,n.b=255-n.b,Wdt(n,t,e)};/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:bue,setPrototypeOf:yue,isFrozen:Kdt,getPrototypeOf:Zdt,getOwnPropertyDescriptor:Vdt}=Object;let{freeze:Po,seal:xc,create:uN}=Object,{apply:dN,construct:pN}=typeof Reflect<"u"&&Reflect;Po||(Po=function(e){return e}),xc||(xc=function(e){return e}),dN||(dN=function(e,n){for(var a=arguments.length,r=new Array(a>2?a-2:0),i=2;i<a;i++)r[i-2]=arguments[i];return e.apply(n,r)}),pN||(pN=function(e){for(var n=arguments.length,a=new Array(n>1?n-1:0),r=1;r<n;r++)a[r-1]=arguments[r];return new e(...a)});const x3=Oo(Array.prototype.forEach),Jdt=Oo(Array.prototype.lastIndexOf),wue=Oo(Array.prototype.pop),G1=Oo(Array.prototype.push),Xdt=Oo(Array.prototype.splice),E3=Oo(String.prototype.toLowerCase),mN=Oo(String.prototype.toString),AN=Oo(String.prototype.match),q1=Oo(String.prototype.replace),ept=Oo(String.prototype.indexOf),tpt=Oo(String.prototype.trim),cl=Oo(Object.prototype.hasOwnProperty),$o=Oo(RegExp.prototype.test),z1=npt(TypeError);function Oo(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,a=new Array(n>1?n-1:0),r=1;r<n;r++)a[r-1]=arguments[r];return dN(t,e,a)}}function npt(t){return function(){for(var e=arguments.length,n=new Array(e),a=0;a<e;a++)n[a]=arguments[a];return pN(t,n)}}function Pn(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:E3;yue&&yue(t,null);let a=e.length;for(;a--;){let r=e[a];if(typeof r=="string"){const i=n(r);i!==r&&(Kdt(e)||(e[a]=i),r=i)}t[r]=!0}return t}function apt(t){for(let e=0;e<t.length;e++)cl(t,e)||(t[e]=null);return t}function Au(t){const e=uN(null);for(const[n,a]of bue(t))cl(t,n)&&(Array.isArray(a)?e[n]=apt(a):a&&typeof a=="object"&&a.constructor===Object?e[n]=Au(a):e[n]=a);return e}function H1(t,e){for(;t!==null;){const a=Vdt(t,e);if(a){if(a.get)return Oo(a.get);if(typeof a.value=="function")return Oo(a.value)}t=Zdt(t)}function n(){return null}return n}const kue=Po(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),gN=Po(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),hN=Po(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),rpt=Po(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),fN=Po(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),ipt=Po(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),vue=Po(["#text"]),Cue=Po(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),bN=Po(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),_ue=Po(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),B3=Po(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),opt=xc(/\{\{[\w\W]*|[\w\W]*\}\}/gm),spt=xc(/<%[\w\W]*|[\w\W]*%>/gm),cpt=xc(/\$\{[\w\W]*/gm),lpt=xc(/^data-[\-\w.\u00B7-\uFFFF]+$/),upt=xc(/^aria-[\-\w]+$/),xue=xc(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),dpt=xc(/^(?:\w+script|data):/i),ppt=xc(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Eue=xc(/^html$/i),mpt=xc(/^[a-z][.\w]*(-[.\w]+)+$/i);var Bue=Object.freeze({__proto__:null,ARIA_ATTR:upt,ATTR_WHITESPACE:ppt,CUSTOM_ELEMENT:mpt,DATA_ATTR:lpt,DOCTYPE_NAME:Eue,ERB_EXPR:spt,IS_ALLOWED_URI:xue,IS_SCRIPT_OR_DATA:dpt,MUSTACHE_EXPR:opt,TMPLIT_EXPR:cpt});const U1={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Apt=function(){return typeof window>"u"?null:window},gpt=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let a=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(a=n.getAttribute(r));const i="dompurify"+(a?"#"+a:"");try{return e.createPolicy(i,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Iue=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Due(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Apt();const e=Bt=>Due(Bt);if(e.version="3.3.1",e.removed=[],!t||!t.document||t.document.nodeType!==U1.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const a=n,r=a.currentScript,{DocumentFragment:i,HTMLTemplateElement:o,Node:s,Element:l,NodeFilter:u,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:m,trustedTypes:A}=t,g=l.prototype,h=H1(g,"cloneNode"),f=H1(g,"remove"),b=H1(g,"nextSibling"),y=H1(g,"childNodes"),w=H1(g,"parentNode");if(typeof o=="function"){const Bt=n.createElement("template");Bt.content&&Bt.content.ownerDocument&&(n=Bt.content.ownerDocument)}let k,C="";const{implementation:x,createNodeIterator:_,createDocumentFragment:E,getElementsByTagName:I}=n,{importNode:Q}=a;let D=Iue();e.isSupported=typeof bue=="function"&&typeof w=="function"&&x&&x.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:T,ERB_EXPR:N,TMPLIT_EXPR:B,DATA_ATTR:S,ARIA_ATTR:M,IS_SCRIPT_OR_DATA:L,ATTR_WHITESPACE:F,CUSTOM_ELEMENT:R}=Bue;let{IS_ALLOWED_URI:P}=Bue,$=null;const q=Pn({},[...kue,...gN,...hN,...fN,...vue]);let j=null;const J=Pn({},[...Cue,...bN,..._ue,...B3]);let Y=Object.seal(uN(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ne=null,ee=null;const me=Object.seal(uN(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let V=!0,te=!0,Z=!1,K=!0,re=!1,X=!0,we=!1,ie=!1,Me=!1,W=!1,je=!1,he=!1,Ke=!0,Ze=!1;const Je="user-content-";let Fe=!0,qe=!1,de={},Ce=null;const Re=Pn({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ge=null;const Ne=Pn({},["audio","video","img","source","image","track"]);let ae=null;const pe=Pn({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),G="http://www.w3.org/1998/Math/MathML",le="http://www.w3.org/2000/svg",ce="http://www.w3.org/1999/xhtml";let ye=ce,fe=!1,Be=null;const Le=Pn({},[G,le,ce],mN);let Se=Pn({},["mi","mo","mn","ms","mtext"]),Oe=Pn({},["annotation-xml"]);const ot=Pn({},["title","style","font","a","script"]);let rt=null;const ct=["application/xhtml+xml","text/html"],ut="text/html";let He=null,tt=null;const Et=n.createElement("form"),kt=function(Te){return Te instanceof RegExp||Te instanceof Function},et=function(){let Te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(tt&&tt===Te)){if((!Te||typeof Te!="object")&&(Te={}),Te=Au(Te),rt=ct.indexOf(Te.PARSER_MEDIA_TYPE)===-1?ut:Te.PARSER_MEDIA_TYPE,He=rt==="application/xhtml+xml"?mN:E3,$=cl(Te,"ALLOWED_TAGS")?Pn({},Te.ALLOWED_TAGS,He):q,j=cl(Te,"ALLOWED_ATTR")?Pn({},Te.ALLOWED_ATTR,He):J,Be=cl(Te,"ALLOWED_NAMESPACES")?Pn({},Te.ALLOWED_NAMESPACES,mN):Le,ae=cl(Te,"ADD_URI_SAFE_ATTR")?Pn(Au(pe),Te.ADD_URI_SAFE_ATTR,He):pe,ge=cl(Te,"ADD_DATA_URI_TAGS")?Pn(Au(Ne),Te.ADD_DATA_URI_TAGS,He):Ne,Ce=cl(Te,"FORBID_CONTENTS")?Pn({},Te.FORBID_CONTENTS,He):Re,ne=cl(Te,"FORBID_TAGS")?Pn({},Te.FORBID_TAGS,He):Au({}),ee=cl(Te,"FORBID_ATTR")?Pn({},Te.FORBID_ATTR,He):Au({}),de=cl(Te,"USE_PROFILES")?Te.USE_PROFILES:!1,V=Te.ALLOW_ARIA_ATTR!==!1,te=Te.ALLOW_DATA_ATTR!==!1,Z=Te.ALLOW_UNKNOWN_PROTOCOLS||!1,K=Te.ALLOW_SELF_CLOSE_IN_ATTR!==!1,re=Te.SAFE_FOR_TEMPLATES||!1,X=Te.SAFE_FOR_XML!==!1,we=Te.WHOLE_DOCUMENT||!1,W=Te.RETURN_DOM||!1,je=Te.RETURN_DOM_FRAGMENT||!1,he=Te.RETURN_TRUSTED_TYPE||!1,Me=Te.FORCE_BODY||!1,Ke=Te.SANITIZE_DOM!==!1,Ze=Te.SANITIZE_NAMED_PROPS||!1,Fe=Te.KEEP_CONTENT!==!1,qe=Te.IN_PLACE||!1,P=Te.ALLOWED_URI_REGEXP||xue,ye=Te.NAMESPACE||ce,Se=Te.MATHML_TEXT_INTEGRATION_POINTS||Se,Oe=Te.HTML_INTEGRATION_POINTS||Oe,Y=Te.CUSTOM_ELEMENT_HANDLING||{},Te.CUSTOM_ELEMENT_HANDLING&&kt(Te.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Y.tagNameCheck=Te.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Te.CUSTOM_ELEMENT_HANDLING&&kt(Te.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Y.attributeNameCheck=Te.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Te.CUSTOM_ELEMENT_HANDLING&&typeof Te.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Y.allowCustomizedBuiltInElements=Te.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),re&&(te=!1),je&&(W=!0),de&&($=Pn({},vue),j=[],de.html===!0&&(Pn($,kue),Pn(j,Cue)),de.svg===!0&&(Pn($,gN),Pn(j,bN),Pn(j,B3)),de.svgFilters===!0&&(Pn($,hN),Pn(j,bN),Pn(j,B3)),de.mathMl===!0&&(Pn($,fN),Pn(j,_ue),Pn(j,B3))),Te.ADD_TAGS&&(typeof Te.ADD_TAGS=="function"?me.tagCheck=Te.ADD_TAGS:($===q&&($=Au($)),Pn($,Te.ADD_TAGS,He))),Te.ADD_ATTR&&(typeof Te.ADD_ATTR=="function"?me.attributeCheck=Te.ADD_ATTR:(j===J&&(j=Au(j)),Pn(j,Te.ADD_ATTR,He))),Te.ADD_URI_SAFE_ATTR&&Pn(ae,Te.ADD_URI_SAFE_ATTR,He),Te.FORBID_CONTENTS&&(Ce===Re&&(Ce=Au(Ce)),Pn(Ce,Te.FORBID_CONTENTS,He)),Te.ADD_FORBID_CONTENTS&&(Ce===Re&&(Ce=Au(Ce)),Pn(Ce,Te.ADD_FORBID_CONTENTS,He)),Fe&&($["#text"]=!0),we&&Pn($,["html","head","body"]),$.table&&(Pn($,["tbody"]),delete ne.tbody),Te.TRUSTED_TYPES_POLICY){if(typeof Te.TRUSTED_TYPES_POLICY.createHTML!="function")throw z1('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Te.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw z1('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=Te.TRUSTED_TYPES_POLICY,C=k.createHTML("")}else k===void 0&&(k=gpt(A,r)),k!==null&&typeof C=="string"&&(C=k.createHTML(""));Po&&Po(Te),tt=Te}},jt=Pn({},[...gN,...hN,...rpt]),nt=Pn({},[...fN,...ipt]),gt=function(Te){let pt=w(Te);(!pt||!pt.tagName)&&(pt={namespaceURI:ye,tagName:"template"});const Mt=E3(Te.tagName),zn=E3(pt.tagName);return Be[Te.namespaceURI]?Te.namespaceURI===le?pt.namespaceURI===ce?Mt==="svg":pt.namespaceURI===G?Mt==="svg"&&(zn==="annotation-xml"||Se[zn]):!!jt[Mt]:Te.namespaceURI===G?pt.namespaceURI===ce?Mt==="math":pt.namespaceURI===le?Mt==="math"&&Oe[zn]:!!nt[Mt]:Te.namespaceURI===ce?pt.namespaceURI===le&&!Oe[zn]||pt.namespaceURI===G&&!Se[zn]?!1:!nt[Mt]&&(ot[Mt]||!jt[Mt]):!!(rt==="application/xhtml+xml"&&Be[Te.namespaceURI]):!1},Ct=function(Te){G1(e.removed,{element:Te});try{w(Te).removeChild(Te)}catch{f(Te)}},xt=function(Te,pt){try{G1(e.removed,{attribute:pt.getAttributeNode(Te),from:pt})}catch{G1(e.removed,{attribute:null,from:pt})}if(pt.removeAttribute(Te),Te==="is")if(W||je)try{Ct(pt)}catch{}else try{pt.setAttribute(Te,"")}catch{}},ht=function(Te){let pt=null,Mt=null;if(Me)Te="<remove></remove>"+Te;else{const Zn=AN(Te,/^[\r\n\t ]+/);Mt=Zn&&Zn[0]}rt==="application/xhtml+xml"&&ye===ce&&(Te='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Te+"</body></html>");const zn=k?k.createHTML(Te):Te;if(ye===ce)try{pt=new m().parseFromString(zn,rt)}catch{}if(!pt||!pt.documentElement){pt=x.createDocument(ye,"template",null);try{pt.documentElement.innerHTML=fe?C:zn}catch{}}const Ha=pt.body||pt.documentElement;return Te&&Mt&&Ha.insertBefore(n.createTextNode(Mt),Ha.childNodes[0]||null),ye===ce?I.call(pt,we?"html":"body")[0]:we?pt.documentElement:Ha},Nt=function(Te){return _.call(Te.ownerDocument||Te,Te,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Qn=function(Te){return Te instanceof p&&(typeof Te.nodeName!="string"||typeof Te.textContent!="string"||typeof Te.removeChild!="function"||!(Te.attributes instanceof d)||typeof Te.removeAttribute!="function"||typeof Te.setAttribute!="function"||typeof Te.namespaceURI!="string"||typeof Te.insertBefore!="function"||typeof Te.hasChildNodes!="function")},on=function(Te){return typeof s=="function"&&Te instanceof s};function $n(Bt,Te,pt){x3(Bt,Mt=>{Mt.call(e,Te,pt,tt)})}const ua=function(Te){let pt=null;if($n(D.beforeSanitizeElements,Te,null),Qn(Te))return Ct(Te),!0;const Mt=He(Te.nodeName);if($n(D.uponSanitizeElement,Te,{tagName:Mt,allowedTags:$}),X&&Te.hasChildNodes()&&!on(Te.firstElementChild)&&$o(/<[/\w!]/g,Te.innerHTML)&&$o(/<[/\w!]/g,Te.textContent)||Te.nodeType===U1.progressingInstruction||X&&Te.nodeType===U1.comment&&$o(/<[/\w]/g,Te.data))return Ct(Te),!0;if(!(me.tagCheck instanceof Function&&me.tagCheck(Mt))&&(!$[Mt]||ne[Mt])){if(!ne[Mt]&&hn(Mt)&&(Y.tagNameCheck instanceof RegExp&&$o(Y.tagNameCheck,Mt)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(Mt)))return!1;if(Fe&&!Ce[Mt]){const zn=w(Te)||Te.parentNode,Ha=y(Te)||Te.childNodes;if(Ha&&zn){const Zn=Ha.length;for(let tr=Zn-1;tr>=0;--tr){const Co=h(Ha[tr],!0);Co.__removalCount=(Te.__removalCount||0)+1,zn.insertBefore(Co,b(Te))}}}return Ct(Te),!0}return Te instanceof l&&!gt(Te)||(Mt==="noscript"||Mt==="noembed"||Mt==="noframes")&&$o(/<\/no(script|embed|frames)/i,Te.innerHTML)?(Ct(Te),!0):(re&&Te.nodeType===U1.text&&(pt=Te.textContent,x3([T,N,B],zn=>{pt=q1(pt,zn," ")}),Te.textContent!==pt&&(G1(e.removed,{element:Te.cloneNode()}),Te.textContent=pt)),$n(D.afterSanitizeElements,Te,null),!1)},On=function(Te,pt,Mt){if(Ke&&(pt==="id"||pt==="name")&&(Mt in n||Mt in Et))return!1;if(!(te&&!ee[pt]&&$o(S,pt))){if(!(V&&$o(M,pt))){if(!(me.attributeCheck instanceof Function&&me.attributeCheck(pt,Te))){if(!j[pt]||ee[pt]){if(!(hn(Te)&&(Y.tagNameCheck instanceof RegExp&&$o(Y.tagNameCheck,Te)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(Te))&&(Y.attributeNameCheck instanceof RegExp&&$o(Y.attributeNameCheck,pt)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(pt,Te))||pt==="is"&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&$o(Y.tagNameCheck,Mt)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(Mt))))return!1}else if(!ae[pt]){if(!$o(P,q1(Mt,F,""))){if(!((pt==="src"||pt==="xlink:href"||pt==="href")&&Te!=="script"&&ept(Mt,"data:")===0&&ge[Te])){if(!(Z&&!$o(L,q1(Mt,F,"")))){if(Mt)return!1}}}}}}}return!0},hn=function(Te){return Te!=="annotation-xml"&&AN(Te,R)},Kn=function(Te){$n(D.beforeSanitizeAttributes,Te,null);const{attributes:pt}=Te;if(!pt||Qn(Te))return;const Mt={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:j,forceKeepAttr:void 0};let zn=pt.length;for(;zn--;){const Ha=pt[zn],{name:Zn,namespaceURI:tr,value:Co}=Ha,zr=He(Zn),Hr=Co;let Dt=Zn==="value"?Hr:tpt(Hr);if(Mt.attrName=zr,Mt.attrValue=Dt,Mt.keepAttr=!0,Mt.forceKeepAttr=void 0,$n(D.uponSanitizeAttribute,Te,Mt),Dt=Mt.attrValue,Ze&&(zr==="id"||zr==="name")&&(xt(Zn,Te),Dt=Je+Dt),X&&$o(/((--!?|])>)|<\/(style|title|textarea)/i,Dt)){xt(Zn,Te);continue}if(zr==="attributename"&&AN(Dt,"href")){xt(Zn,Te);continue}if(Mt.forceKeepAttr)continue;if(!Mt.keepAttr){xt(Zn,Te);continue}if(!K&&$o(/\/>/i,Dt)){xt(Zn,Te);continue}re&&x3([T,N,B],vt=>{Dt=q1(Dt,vt," ")});const Rt=He(Te.nodeName);if(!On(Rt,zr,Dt)){xt(Zn,Te);continue}if(k&&typeof A=="object"&&typeof A.getAttributeType=="function"&&!tr)switch(A.getAttributeType(Rt,zr)){case"TrustedHTML":{Dt=k.createHTML(Dt);break}case"TrustedScriptURL":{Dt=k.createScriptURL(Dt);break}}if(Dt!==Hr)try{tr?Te.setAttributeNS(tr,Zn,Dt):Te.setAttribute(Zn,Dt),Qn(Te)?Ct(Te):wue(e.removed)}catch{xt(Zn,Te)}}$n(D.afterSanitizeAttributes,Te,null)},fr=function Bt(Te){let pt=null;const Mt=Nt(Te);for($n(D.beforeSanitizeShadowDOM,Te,null);pt=Mt.nextNode();)$n(D.uponSanitizeShadowNode,pt,null),ua(pt),Kn(pt),pt.content instanceof i&&Bt(pt.content);$n(D.afterSanitizeShadowDOM,Te,null)};return e.sanitize=function(Bt){let Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},pt=null,Mt=null,zn=null,Ha=null;if(fe=!Bt,fe&&(Bt="<!-->"),typeof Bt!="string"&&!on(Bt))if(typeof Bt.toString=="function"){if(Bt=Bt.toString(),typeof Bt!="string")throw z1("dirty is not a string, aborting")}else throw z1("toString is not a function");if(!e.isSupported)return Bt;if(ie||et(Te),e.removed=[],typeof Bt=="string"&&(qe=!1),qe){if(Bt.nodeName){const Co=He(Bt.nodeName);if(!$[Co]||ne[Co])throw z1("root node is forbidden and cannot be sanitized in-place")}}else if(Bt instanceof s)pt=ht("<!---->"),Mt=pt.ownerDocument.importNode(Bt,!0),Mt.nodeType===U1.element&&Mt.nodeName==="BODY"||Mt.nodeName==="HTML"?pt=Mt:pt.appendChild(Mt);else{if(!W&&!re&&!we&&Bt.indexOf("<")===-1)return k&&he?k.createHTML(Bt):Bt;if(pt=ht(Bt),!pt)return W?null:he?C:""}pt&&Me&&Ct(pt.firstChild);const Zn=Nt(qe?Bt:pt);for(;zn=Zn.nextNode();)ua(zn),Kn(zn),zn.content instanceof i&&fr(zn.content);if(qe)return Bt;if(W){if(je)for(Ha=E.call(pt.ownerDocument);pt.firstChild;)Ha.appendChild(pt.firstChild);else Ha=pt;return(j.shadowroot||j.shadowrootmode)&&(Ha=Q.call(a,Ha,!0)),Ha}let tr=we?pt.outerHTML:pt.innerHTML;return we&&$["!doctype"]&&pt.ownerDocument&&pt.ownerDocument.doctype&&pt.ownerDocument.doctype.name&&$o(Eue,pt.ownerDocument.doctype.name)&&(tr="<!DOCTYPE "+pt.ownerDocument.doctype.name+`>
|
|
1362
1362
|
`+tr),re&&x3([T,N,B],Co=>{tr=q1(tr,Co," ")}),k&&he?k.createHTML(tr):tr},e.setConfig=function(){let Bt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};et(Bt),ie=!0},e.clearConfig=function(){tt=null,ie=!1},e.isValidAttribute=function(Bt,Te,pt){tt||et({});const Mt=He(Bt),zn=He(Te);return On(Mt,zn,pt)},e.addHook=function(Bt,Te){typeof Te=="function"&&G1(D[Bt],Te)},e.removeHook=function(Bt,Te){if(Te!==void 0){const pt=Jdt(D[Bt],Te);return pt===-1?void 0:Xdt(D[Bt],pt,1)[0]}return wue(D[Bt])},e.removeHooks=function(Bt){D[Bt]=[]},e.removeAllHooks=function(){D=Iue()},e}var _b=Due(),Que=/^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s,Y1=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,hpt=/\s*%%.*\n/gm,Sue=(v_=class extends Error{constructor(e){super(e),this.name="UnknownDiagramError"}},v(v_,"UnknownDiagramError"),v_),hg={},yN=v(function(t,e){t=t.replace(Que,"").replace(Y1,"").replace(hpt,`
|
|
1363
1363
|
`);for(const[n,{detector:a}]of Object.entries(hg))if(a(t,e))return n;throw new Sue(`No diagram type detected matching given configuration for text: ${t}`)},"detectType"),wN=v((...t)=>{for(const{id:e,detector:n,loader:a}of t)Tue(e,n,a)},"registerLazyLoadedDiagrams"),Tue=v((t,e,n)=>{hg[t]&&se.warn(`Detector with key ${t} already exists. Overwriting.`),hg[t]={detector:e,loader:n},se.debug(`Detector with key ${t} added${n?" with loader":""}`)},"addDetector"),fpt=v(t=>hg[t].loader,"getDiagramLoader"),kN=v((t,e,{depth:n=2,clobber:a=!1}={})=>{const r={depth:n,clobber:a};return Array.isArray(e)&&!Array.isArray(t)?(e.forEach(i=>kN(t,i,r)),t):Array.isArray(e)&&Array.isArray(t)?(e.forEach(i=>{t.includes(i)||t.push(i)}),t):t===void 0||n<=0?t!=null&&typeof t=="object"&&typeof e=="object"?Object.assign(t,e):e:(e!==void 0&&typeof t=="object"&&typeof e=="object"&&Object.keys(e).forEach(i=>{typeof e[i]=="object"&&(t[i]===void 0||typeof t[i]=="object")?(t[i]===void 0&&(t[i]=Array.isArray(e[i])?[]:{}),t[i]=kN(t[i],e[i],{depth:n-1,clobber:a})):(a||typeof t[i]!="object"&&typeof e[i]!="object")&&(t[i]=e[i])}),t)},"assignWithDepth"),Cr=kN,I3="#ffffff",D3="#f2f2f2",jo=v((t,e)=>e?Ge(t,{s:-40,l:10}):Ge(t,{s:-40,l:-10}),"mkBorder"),bpt=(C_=class{constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px"}updateColors(){var n,a,r,i,o,s,l,u,d,p,m,A,g,h,f,b,y,w,k,C,x;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||Ge(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||Ge(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||jo(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||jo(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||jo(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||jo(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||Lt(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Lt(this.tertiaryColor),this.lineColor=this.lineColor||Lt(this.background),this.arrowheadColor=this.arrowheadColor||Lt(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?an(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||an(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Lt(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||Yt(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||"navy",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode?(this.rowOdd=this.rowOdd||an(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||an(this.mainBkg,10)):(this.rowOdd=this.rowOdd||Yt(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||Yt(this.mainBkg,5)),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||Ge(this.primaryColor,{h:30}),this.cScale4=this.cScale4||Ge(this.primaryColor,{h:60}),this.cScale5=this.cScale5||Ge(this.primaryColor,{h:90}),this.cScale6=this.cScale6||Ge(this.primaryColor,{h:120}),this.cScale7=this.cScale7||Ge(this.primaryColor,{h:150}),this.cScale8=this.cScale8||Ge(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||Ge(this.primaryColor,{h:270}),this.cScale10=this.cScale10||Ge(this.primaryColor,{h:300}),this.cScale11=this.cScale11||Ge(this.primaryColor,{h:330}),this.darkMode)for(let _=0;_<this.THEME_COLOR_LIMIT;_++)this["cScale"+_]=an(this["cScale"+_],75);else for(let _=0;_<this.THEME_COLOR_LIMIT;_++)this["cScale"+_]=an(this["cScale"+_],25);for(let _=0;_<this.THEME_COLOR_LIMIT;_++)this["cScaleInv"+_]=this["cScaleInv"+_]||Lt(this["cScale"+_]);for(let _=0;_<this.THEME_COLOR_LIMIT;_++)this.darkMode?this["cScalePeer"+_]=this["cScalePeer"+_]||Yt(this["cScale"+_],10):this["cScalePeer"+_]=this["cScalePeer"+_]||an(this["cScale"+_],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let _=0;_<this.THEME_COLOR_LIMIT;_++)this["cScaleLabel"+_]=this["cScaleLabel"+_]||this.scaleLabelColor;const e=this.darkMode?-4:-1;for(let _=0;_<5;_++)this["surface"+_]=this["surface"+_]||Ge(this.mainBkg,{h:180,s:-15,l:e*(5+_*3)}),this["surfacePeer"+_]=this["surfacePeer"+_]||Ge(this.mainBkg,{h:180,s:-15,l:e*(8+_*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||Ge(this.primaryColor,{h:64}),this.fillType3=this.fillType3||Ge(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||Ge(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||Ge(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||Ge(this.primaryColor,{h:128}),this.fillType7=this.fillType7||Ge(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||Ge(this.primaryColor,{l:-10}),this.pie5=this.pie5||Ge(this.secondaryColor,{l:-10}),this.pie6=this.pie6||Ge(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||Ge(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||Ge(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||Ge(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||Ge(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||Ge(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||Ge(this.primaryColor,{h:120,l:-10}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.radar={axisColor:((n=this.radar)==null?void 0:n.axisColor)||this.lineColor,axisStrokeWidth:((a=this.radar)==null?void 0:a.axisStrokeWidth)||2,axisLabelFontSize:((r=this.radar)==null?void 0:r.axisLabelFontSize)||12,curveOpacity:((i=this.radar)==null?void 0:i.curveOpacity)||.5,curveStrokeWidth:((o=this.radar)==null?void 0:o.curveStrokeWidth)||2,graticuleColor:((s=this.radar)==null?void 0:s.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((l=this.radar)==null?void 0:l.graticuleStrokeWidth)||1,graticuleOpacity:((u=this.radar)==null?void 0:u.graticuleOpacity)||.3,legendBoxSize:((d=this.radar)==null?void 0:d.legendBoxSize)||12,legendFontSize:((p=this.radar)==null?void 0:p.legendFontSize)||12},this.archEdgeColor=this.archEdgeColor||"#777",this.archEdgeArrowColor=this.archEdgeArrowColor||"#777",this.archEdgeWidth=this.archEdgeWidth||"3",this.archGroupBorderColor=this.archGroupBorderColor||"#000",this.archGroupBorderWidth=this.archGroupBorderWidth||"2px",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||Ge(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||Ge(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||Ge(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||Ge(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||Ge(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||Ge(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||um(this.quadrant1Fill)?Yt(this.quadrant1Fill):an(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((m=this.xyChart)==null?void 0:m.backgroundColor)||this.background,titleColor:((A=this.xyChart)==null?void 0:A.titleColor)||this.primaryTextColor,xAxisTitleColor:((g=this.xyChart)==null?void 0:g.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((h=this.xyChart)==null?void 0:h.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((f=this.xyChart)==null?void 0:f.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((b=this.xyChart)==null?void 0:b.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((y=this.xyChart)==null?void 0:y.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((w=this.xyChart)==null?void 0:w.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((k=this.xyChart)==null?void 0:k.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((C=this.xyChart)==null?void 0:C.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((x=this.xyChart)==null?void 0:x.plotColorPalette)||"#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?an(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||Ge(this.primaryColor,{h:-30}),this.git4=this.git4||Ge(this.primaryColor,{h:-60}),this.git5=this.git5||Ge(this.primaryColor,{h:-90}),this.git6=this.git6||Ge(this.primaryColor,{h:60}),this.git7=this.git7||Ge(this.primaryColor,{h:120}),this.darkMode?(this.git0=Yt(this.git0,25),this.git1=Yt(this.git1,25),this.git2=Yt(this.git2,25),this.git3=Yt(this.git3,25),this.git4=Yt(this.git4,25),this.git5=Yt(this.git5,25),this.git6=Yt(this.git6,25),this.git7=Yt(this.git7,25)):(this.git0=an(this.git0,25),this.git1=an(this.git1,25),this.git2=an(this.git2,25),this.git3=an(this.git3,25),this.git4=an(this.git4,25),this.git5=an(this.git5,25),this.git6=an(this.git6,25),this.git7=an(this.git7,25)),this.gitInv0=this.gitInv0||Lt(this.git0),this.gitInv1=this.gitInv1||Lt(this.git1),this.gitInv2=this.gitInv2||Lt(this.git2),this.gitInv3=this.gitInv3||Lt(this.git3),this.gitInv4=this.gitInv4||Lt(this.git4),this.gitInv5=this.gitInv5||Lt(this.git5),this.gitInv6=this.gitInv6||Lt(this.git6),this.gitInv7=this.gitInv7||Lt(this.git7),this.branchLabelColor=this.branchLabelColor||(this.darkMode?"black":this.labelTextColor),this.gitBranchLabel0=this.gitBranchLabel0||this.branchLabelColor,this.gitBranchLabel1=this.gitBranchLabel1||this.branchLabelColor,this.gitBranchLabel2=this.gitBranchLabel2||this.branchLabelColor,this.gitBranchLabel3=this.gitBranchLabel3||this.branchLabelColor,this.gitBranchLabel4=this.gitBranchLabel4||this.branchLabelColor,this.gitBranchLabel5=this.gitBranchLabel5||this.branchLabelColor,this.gitBranchLabel6=this.gitBranchLabel6||this.branchLabelColor,this.gitBranchLabel7=this.gitBranchLabel7||this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||I3,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||D3}calculate(e){if(typeof e!="object"){this.updateColors();return}const n=Object.keys(e);n.forEach(a=>{this[a]=e[a]}),this.updateColors(),n.forEach(a=>{this[a]=e[a]})}},v(C_,"Theme"),C_),ypt=v(t=>{const e=new bpt;return e.calculate(t),e},"getThemeVariables"),wpt=(__=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=Yt(this.primaryColor,16),this.tertiaryColor=Ge(this.primaryColor,{h:-160}),this.primaryBorderColor=Lt(this.background),this.secondaryBorderColor=jo(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=jo(this.tertiaryColor,this.darkMode),this.primaryTextColor=Lt(this.primaryColor),this.secondaryTextColor=Lt(this.secondaryColor),this.tertiaryTextColor=Lt(this.tertiaryColor),this.lineColor=Lt(this.background),this.textColor=Lt(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=Yt(Lt("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=lm(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.sectionBkgColor=an("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=an(this.sectionBkgColor,10),this.taskBorderColor=lm(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=lm(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||Yt(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||an(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd"}updateColors(){var e,n,a,r,i,o,s,l,u,d,p,m,A,g,h,f,b,y,w,k,C;this.secondBkg=Yt(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=Yt(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.altSectionBkgColor=this.background,this.taskBkgColor=Yt(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=this.darkTextColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=Ge(this.primaryColor,{h:64}),this.fillType3=Ge(this.secondaryColor,{h:64}),this.fillType4=Ge(this.primaryColor,{h:-64}),this.fillType5=Ge(this.secondaryColor,{h:-64}),this.fillType6=Ge(this.primaryColor,{h:128}),this.fillType7=Ge(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||Ge(this.primaryColor,{h:30}),this.cScale4=this.cScale4||Ge(this.primaryColor,{h:60}),this.cScale5=this.cScale5||Ge(this.primaryColor,{h:90}),this.cScale6=this.cScale6||Ge(this.primaryColor,{h:120}),this.cScale7=this.cScale7||Ge(this.primaryColor,{h:150}),this.cScale8=this.cScale8||Ge(this.primaryColor,{h:210}),this.cScale9=this.cScale9||Ge(this.primaryColor,{h:270}),this.cScale10=this.cScale10||Ge(this.primaryColor,{h:300}),this.cScale11=this.cScale11||Ge(this.primaryColor,{h:330});for(let x=0;x<this.THEME_COLOR_LIMIT;x++)this["cScaleInv"+x]=this["cScaleInv"+x]||Lt(this["cScale"+x]);for(let x=0;x<this.THEME_COLOR_LIMIT;x++)this["cScalePeer"+x]=this["cScalePeer"+x]||Yt(this["cScale"+x],10);for(let x=0;x<5;x++)this["surface"+x]=this["surface"+x]||Ge(this.mainBkg,{h:30,s:-30,l:-(-10+x*4)}),this["surfacePeer"+x]=this["surfacePeer"+x]||Ge(this.mainBkg,{h:30,s:-30,l:-(-7+x*4)});this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor);for(let x=0;x<this.THEME_COLOR_LIMIT;x++)this["cScaleLabel"+x]=this["cScaleLabel"+x]||this.scaleLabelColor;for(let x=0;x<this.THEME_COLOR_LIMIT;x++)this["pie"+x]=this["cScale"+x];this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||Ge(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||Ge(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||Ge(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||Ge(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||Ge(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||Ge(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||um(this.quadrant1Fill)?Yt(this.quadrant1Fill):an(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((e=this.xyChart)==null?void 0:e.backgroundColor)||this.background,titleColor:((n=this.xyChart)==null?void 0:n.titleColor)||this.primaryTextColor,xAxisTitleColor:((a=this.xyChart)==null?void 0:a.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((r=this.xyChart)==null?void 0:r.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((i=this.xyChart)==null?void 0:i.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((o=this.xyChart)==null?void 0:o.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((s=this.xyChart)==null?void 0:s.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((l=this.xyChart)==null?void 0:l.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((u=this.xyChart)==null?void 0:u.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((d=this.xyChart)==null?void 0:d.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((p=this.xyChart)==null?void 0:p.plotColorPalette)||"#3498db,#2ecc71,#e74c3c,#f1c40f,#bdc3c7,#ffffff,#34495e,#9b59b6,#1abc9c,#e67e22"},this.packet={startByteColor:this.primaryTextColor,endByteColor:this.primaryTextColor,labelColor:this.primaryTextColor,titleColor:this.primaryTextColor,blockStrokeColor:this.primaryTextColor,blockFillColor:this.background},this.radar={axisColor:((m=this.radar)==null?void 0:m.axisColor)||this.lineColor,axisStrokeWidth:((A=this.radar)==null?void 0:A.axisStrokeWidth)||2,axisLabelFontSize:((g=this.radar)==null?void 0:g.axisLabelFontSize)||12,curveOpacity:((h=this.radar)==null?void 0:h.curveOpacity)||.5,curveStrokeWidth:((f=this.radar)==null?void 0:f.curveStrokeWidth)||2,graticuleColor:((b=this.radar)==null?void 0:b.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((y=this.radar)==null?void 0:y.graticuleStrokeWidth)||1,graticuleOpacity:((w=this.radar)==null?void 0:w.graticuleOpacity)||.3,legendBoxSize:((k=this.radar)==null?void 0:k.legendBoxSize)||12,legendFontSize:((C=this.radar)==null?void 0:C.legendFontSize)||12},this.classText=this.primaryTextColor,this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?an(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=Yt(this.secondaryColor,20),this.git1=Yt(this.pie2||this.secondaryColor,20),this.git2=Yt(this.pie3||this.tertiaryColor,20),this.git3=Yt(this.pie4||Ge(this.primaryColor,{h:-30}),20),this.git4=Yt(this.pie5||Ge(this.primaryColor,{h:-60}),20),this.git5=Yt(this.pie6||Ge(this.primaryColor,{h:-90}),10),this.git6=Yt(this.pie7||Ge(this.primaryColor,{h:60}),10),this.git7=Yt(this.pie8||Ge(this.primaryColor,{h:120}),20),this.gitInv0=this.gitInv0||Lt(this.git0),this.gitInv1=this.gitInv1||Lt(this.git1),this.gitInv2=this.gitInv2||Lt(this.git2),this.gitInv3=this.gitInv3||Lt(this.git3),this.gitInv4=this.gitInv4||Lt(this.git4),this.gitInv5=this.gitInv5||Lt(this.git5),this.gitInv6=this.gitInv6||Lt(this.git6),this.gitInv7=this.gitInv7||Lt(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||Lt(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||Lt(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Yt(this.background,12),this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||Yt(this.background,2),this.nodeBorder=this.nodeBorder||"#999"}calculate(e){if(typeof e!="object"){this.updateColors();return}const n=Object.keys(e);n.forEach(a=>{this[a]=e[a]}),this.updateColors(),n.forEach(a=>{this[a]=e[a]})}},v(__,"Theme"),__),kpt=v(t=>{const e=new wpt;return e.calculate(t),e},"getThemeVariables"),vpt=(x_=class{constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=Ge(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=Ge(this.primaryColor,{h:-160}),this.primaryBorderColor=jo(this.primaryColor,this.darkMode),this.secondaryBorderColor=jo(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=jo(this.tertiaryColor,this.darkMode),this.primaryTextColor=Lt(this.primaryColor),this.secondaryTextColor=Lt(this.secondaryColor),this.tertiaryTextColor=Lt(this.tertiaryColor),this.lineColor=Lt(this.background),this.textColor=Lt(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.sectionBkgColor=lm(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="navy",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.updateColors()}updateColors(){var e,n,a,r,i,o,s,l,u,d,p,m,A,g,h,f,b,y,w,k,C;this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||Ge(this.primaryColor,{h:30}),this.cScale4=this.cScale4||Ge(this.primaryColor,{h:60}),this.cScale5=this.cScale5||Ge(this.primaryColor,{h:90}),this.cScale6=this.cScale6||Ge(this.primaryColor,{h:120}),this.cScale7=this.cScale7||Ge(this.primaryColor,{h:150}),this.cScale8=this.cScale8||Ge(this.primaryColor,{h:210}),this.cScale9=this.cScale9||Ge(this.primaryColor,{h:270}),this.cScale10=this.cScale10||Ge(this.primaryColor,{h:300}),this.cScale11=this.cScale11||Ge(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||an(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||an(this.tertiaryColor,40);for(let x=0;x<this.THEME_COLOR_LIMIT;x++)this["cScale"+x]=an(this["cScale"+x],10),this["cScalePeer"+x]=this["cScalePeer"+x]||an(this["cScale"+x],25);for(let x=0;x<this.THEME_COLOR_LIMIT;x++)this["cScaleInv"+x]=this["cScaleInv"+x]||Ge(this["cScale"+x],{h:180});for(let x=0;x<5;x++)this["surface"+x]=this["surface"+x]||Ge(this.mainBkg,{h:30,l:-(5+x*5)}),this["surfacePeer"+x]=this["surfacePeer"+x]||Ge(this.mainBkg,{h:30,l:-(7+x*5)});if(this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor,this.labelTextColor!=="calculated"){this.cScaleLabel0=this.cScaleLabel0||Lt(this.labelTextColor),this.cScaleLabel3=this.cScaleLabel3||Lt(this.labelTextColor);for(let x=0;x<this.THEME_COLOR_LIMIT;x++)this["cScaleLabel"+x]=this["cScaleLabel"+x]||this.labelTextColor}this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.textColor,this.edgeLabelBackground=this.labelBackground,this.actorBorder=Yt(this.border1,23),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.signalColor=this.textColor,this.signalTextColor=this.textColor,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.rowOdd=this.rowOdd||Yt(this.primaryColor,75)||"#ffffff",this.rowEven=this.rowEven||Yt(this.primaryColor,1),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=Ge(this.primaryColor,{h:64}),this.fillType3=Ge(this.secondaryColor,{h:64}),this.fillType4=Ge(this.primaryColor,{h:-64}),this.fillType5=Ge(this.secondaryColor,{h:-64}),this.fillType6=Ge(this.primaryColor,{h:128}),this.fillType7=Ge(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||Ge(this.tertiaryColor,{l:-40}),this.pie4=this.pie4||Ge(this.primaryColor,{l:-10}),this.pie5=this.pie5||Ge(this.secondaryColor,{l:-30}),this.pie6=this.pie6||Ge(this.tertiaryColor,{l:-20}),this.pie7=this.pie7||Ge(this.primaryColor,{h:60,l:-20}),this.pie8=this.pie8||Ge(this.primaryColor,{h:-60,l:-40}),this.pie9=this.pie9||Ge(this.primaryColor,{h:120,l:-40}),this.pie10=this.pie10||Ge(this.primaryColor,{h:60,l:-40}),this.pie11=this.pie11||Ge(this.primaryColor,{h:-90,l:-40}),this.pie12=this.pie12||Ge(this.primaryColor,{h:120,l:-30}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||Ge(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||Ge(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||Ge(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||Ge(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||Ge(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||Ge(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||um(this.quadrant1Fill)?Yt(this.quadrant1Fill):an(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.radar={axisColor:((e=this.radar)==null?void 0:e.axisColor)||this.lineColor,axisStrokeWidth:((n=this.radar)==null?void 0:n.axisStrokeWidth)||2,axisLabelFontSize:((a=this.radar)==null?void 0:a.axisLabelFontSize)||12,curveOpacity:((r=this.radar)==null?void 0:r.curveOpacity)||.5,curveStrokeWidth:((i=this.radar)==null?void 0:i.curveStrokeWidth)||2,graticuleColor:((o=this.radar)==null?void 0:o.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((s=this.radar)==null?void 0:s.graticuleStrokeWidth)||1,graticuleOpacity:((l=this.radar)==null?void 0:l.graticuleOpacity)||.3,legendBoxSize:((u=this.radar)==null?void 0:u.legendBoxSize)||12,legendFontSize:((d=this.radar)==null?void 0:d.legendFontSize)||12},this.xyChart={backgroundColor:((p=this.xyChart)==null?void 0:p.backgroundColor)||this.background,titleColor:((m=this.xyChart)==null?void 0:m.titleColor)||this.primaryTextColor,xAxisTitleColor:((A=this.xyChart)==null?void 0:A.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((g=this.xyChart)==null?void 0:g.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((h=this.xyChart)==null?void 0:h.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((f=this.xyChart)==null?void 0:f.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((b=this.xyChart)==null?void 0:b.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((y=this.xyChart)==null?void 0:y.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((w=this.xyChart)==null?void 0:w.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((k=this.xyChart)==null?void 0:k.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((C=this.xyChart)==null?void 0:C.plotColorPalette)||"#ECECFF,#8493A6,#FFC3A0,#DCDDE1,#B8E994,#D1A36F,#C3CDE6,#FFB6C1,#496078,#F8F3E3"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.labelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||Ge(this.primaryColor,{h:-30}),this.git4=this.git4||Ge(this.primaryColor,{h:-60}),this.git5=this.git5||Ge(this.primaryColor,{h:-90}),this.git6=this.git6||Ge(this.primaryColor,{h:60}),this.git7=this.git7||Ge(this.primaryColor,{h:120}),this.darkMode?(this.git0=Yt(this.git0,25),this.git1=Yt(this.git1,25),this.git2=Yt(this.git2,25),this.git3=Yt(this.git3,25),this.git4=Yt(this.git4,25),this.git5=Yt(this.git5,25),this.git6=Yt(this.git6,25),this.git7=Yt(this.git7,25)):(this.git0=an(this.git0,25),this.git1=an(this.git1,25),this.git2=an(this.git2,25),this.git3=an(this.git3,25),this.git4=an(this.git4,25),this.git5=an(this.git5,25),this.git6=an(this.git6,25),this.git7=an(this.git7,25)),this.gitInv0=this.gitInv0||an(Lt(this.git0),25),this.gitInv1=this.gitInv1||Lt(this.git1),this.gitInv2=this.gitInv2||Lt(this.git2),this.gitInv3=this.gitInv3||Lt(this.git3),this.gitInv4=this.gitInv4||Lt(this.git4),this.gitInv5=this.gitInv5||Lt(this.git5),this.gitInv6=this.gitInv6||Lt(this.git6),this.gitInv7=this.gitInv7||Lt(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||Lt(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||Lt(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||I3,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||D3}calculate(e){if(Object.keys(this).forEach(a=>{this[a]==="calculated"&&(this[a]=void 0)}),typeof e!="object"){this.updateColors();return}const n=Object.keys(e);n.forEach(a=>{this[a]=e[a]}),this.updateColors(),n.forEach(a=>{this[a]=e[a]})}},v(x_,"Theme"),x_),Q3=v(t=>{const e=new vpt;return e.calculate(t),e},"getThemeVariables"),Cpt=(E_=class{constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=Yt("#cde498",10),this.primaryBorderColor=jo(this.primaryColor,this.darkMode),this.secondaryBorderColor=jo(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=jo(this.tertiaryColor,this.darkMode),this.primaryTextColor=Lt(this.primaryColor),this.secondaryTextColor=Lt(this.secondaryColor),this.tertiaryTextColor=Lt(this.primaryColor),this.lineColor=Lt(this.background),this.textColor=Lt(this.background),this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){var e,n,a,r,i,o,s,l,u,d,p,m,A,g,h,f,b,y,w,k,C;this.actorBorder=an(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||Ge(this.primaryColor,{h:30}),this.cScale4=this.cScale4||Ge(this.primaryColor,{h:60}),this.cScale5=this.cScale5||Ge(this.primaryColor,{h:90}),this.cScale6=this.cScale6||Ge(this.primaryColor,{h:120}),this.cScale7=this.cScale7||Ge(this.primaryColor,{h:150}),this.cScale8=this.cScale8||Ge(this.primaryColor,{h:210}),this.cScale9=this.cScale9||Ge(this.primaryColor,{h:270}),this.cScale10=this.cScale10||Ge(this.primaryColor,{h:300}),this.cScale11=this.cScale11||Ge(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||an(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||an(this.tertiaryColor,40);for(let x=0;x<this.THEME_COLOR_LIMIT;x++)this["cScale"+x]=an(this["cScale"+x],10),this["cScalePeer"+x]=this["cScalePeer"+x]||an(this["cScale"+x],25);for(let x=0;x<this.THEME_COLOR_LIMIT;x++)this["cScaleInv"+x]=this["cScaleInv"+x]||Ge(this["cScale"+x],{h:180});this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor;for(let x=0;x<this.THEME_COLOR_LIMIT;x++)this["cScaleLabel"+x]=this["cScaleLabel"+x]||this.scaleLabelColor;for(let x=0;x<5;x++)this["surface"+x]=this["surface"+x]||Ge(this.mainBkg,{h:30,s:-30,l:-(5+x*5)}),this["surfacePeer"+x]=this["surfacePeer"+x]||Ge(this.mainBkg,{h:30,s:-30,l:-(8+x*5)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.taskBorderColor=this.border1,this.taskTextColor=this.taskTextLightColor,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.rowOdd=this.rowOdd||Yt(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||Yt(this.mainBkg,20),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor=this.lineColor,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=Ge(this.primaryColor,{h:64}),this.fillType3=Ge(this.secondaryColor,{h:64}),this.fillType4=Ge(this.primaryColor,{h:-64}),this.fillType5=Ge(this.secondaryColor,{h:-64}),this.fillType6=Ge(this.primaryColor,{h:128}),this.fillType7=Ge(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||this.tertiaryColor,this.pie4=this.pie4||Ge(this.primaryColor,{l:-30}),this.pie5=this.pie5||Ge(this.secondaryColor,{l:-30}),this.pie6=this.pie6||Ge(this.tertiaryColor,{h:40,l:-40}),this.pie7=this.pie7||Ge(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||Ge(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||Ge(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||Ge(this.primaryColor,{h:60,l:-50}),this.pie11=this.pie11||Ge(this.primaryColor,{h:-60,l:-50}),this.pie12=this.pie12||Ge(this.primaryColor,{h:120,l:-50}),this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||Ge(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||Ge(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||Ge(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||Ge(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||Ge(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||Ge(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||um(this.quadrant1Fill)?Yt(this.quadrant1Fill):an(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.packet={startByteColor:this.primaryTextColor,endByteColor:this.primaryTextColor,labelColor:this.primaryTextColor,titleColor:this.primaryTextColor,blockStrokeColor:this.primaryTextColor,blockFillColor:this.mainBkg},this.radar={axisColor:((e=this.radar)==null?void 0:e.axisColor)||this.lineColor,axisStrokeWidth:((n=this.radar)==null?void 0:n.axisStrokeWidth)||2,axisLabelFontSize:((a=this.radar)==null?void 0:a.axisLabelFontSize)||12,curveOpacity:((r=this.radar)==null?void 0:r.curveOpacity)||.5,curveStrokeWidth:((i=this.radar)==null?void 0:i.curveStrokeWidth)||2,graticuleColor:((o=this.radar)==null?void 0:o.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((s=this.radar)==null?void 0:s.graticuleStrokeWidth)||1,graticuleOpacity:((l=this.radar)==null?void 0:l.graticuleOpacity)||.3,legendBoxSize:((u=this.radar)==null?void 0:u.legendBoxSize)||12,legendFontSize:((d=this.radar)==null?void 0:d.legendFontSize)||12},this.xyChart={backgroundColor:((p=this.xyChart)==null?void 0:p.backgroundColor)||this.background,titleColor:((m=this.xyChart)==null?void 0:m.titleColor)||this.primaryTextColor,xAxisTitleColor:((A=this.xyChart)==null?void 0:A.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((g=this.xyChart)==null?void 0:g.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((h=this.xyChart)==null?void 0:h.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((f=this.xyChart)==null?void 0:f.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((b=this.xyChart)==null?void 0:b.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((y=this.xyChart)==null?void 0:y.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((w=this.xyChart)==null?void 0:w.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((k=this.xyChart)==null?void 0:k.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((C=this.xyChart)==null?void 0:C.plotColorPalette)||"#CDE498,#FF6B6B,#A0D2DB,#D7BDE2,#F0F0F0,#FFC3A0,#7FD8BE,#FF9A8B,#FAF3E0,#FFF176"},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=this.git0||this.primaryColor,this.git1=this.git1||this.secondaryColor,this.git2=this.git2||this.tertiaryColor,this.git3=this.git3||Ge(this.primaryColor,{h:-30}),this.git4=this.git4||Ge(this.primaryColor,{h:-60}),this.git5=this.git5||Ge(this.primaryColor,{h:-90}),this.git6=this.git6||Ge(this.primaryColor,{h:60}),this.git7=this.git7||Ge(this.primaryColor,{h:120}),this.darkMode?(this.git0=Yt(this.git0,25),this.git1=Yt(this.git1,25),this.git2=Yt(this.git2,25),this.git3=Yt(this.git3,25),this.git4=Yt(this.git4,25),this.git5=Yt(this.git5,25),this.git6=Yt(this.git6,25),this.git7=Yt(this.git7,25)):(this.git0=an(this.git0,25),this.git1=an(this.git1,25),this.git2=an(this.git2,25),this.git3=an(this.git3,25),this.git4=an(this.git4,25),this.git5=an(this.git5,25),this.git6=an(this.git6,25),this.git7=an(this.git7,25)),this.gitInv0=this.gitInv0||Lt(this.git0),this.gitInv1=this.gitInv1||Lt(this.git1),this.gitInv2=this.gitInv2||Lt(this.git2),this.gitInv3=this.gitInv3||Lt(this.git3),this.gitInv4=this.gitInv4||Lt(this.git4),this.gitInv5=this.gitInv5||Lt(this.git5),this.gitInv6=this.gitInv6||Lt(this.git6),this.gitInv7=this.gitInv7||Lt(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||Lt(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||Lt(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||I3,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||D3}calculate(e){if(typeof e!="object"){this.updateColors();return}const n=Object.keys(e);n.forEach(a=>{this[a]=e[a]}),this.updateColors(),n.forEach(a=>{this[a]=e[a]})}},v(E_,"Theme"),E_),_pt=v(t=>{const e=new Cpt;return e.calculate(t),e},"getThemeVariables"),xpt=(B_=class{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=Yt(this.contrast,55),this.background="#ffffff",this.tertiaryColor=Ge(this.primaryColor,{h:-160}),this.primaryBorderColor=jo(this.primaryColor,this.darkMode),this.secondaryBorderColor=jo(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=jo(this.tertiaryColor,this.darkMode),this.primaryTextColor=Lt(this.primaryColor),this.secondaryTextColor=Lt(this.secondaryColor),this.tertiaryTextColor=Lt(this.tertiaryColor),this.lineColor=Lt(this.background),this.textColor=Lt(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||Yt(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){var e,n,a,r,i,o,s,l,u,d,p,m,A,g,h,f,b,y,w,k,C;this.secondBkg=Yt(this.contrast,55),this.border2=this.contrast,this.actorBorder=Yt(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let x=0;x<this.THEME_COLOR_LIMIT;x++)this["cScaleInv"+x]=this["cScaleInv"+x]||Lt(this["cScale"+x]);for(let x=0;x<this.THEME_COLOR_LIMIT;x++)this.darkMode?this["cScalePeer"+x]=this["cScalePeer"+x]||Yt(this["cScale"+x],10):this["cScalePeer"+x]=this["cScalePeer"+x]||an(this["cScale"+x],10);this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor),this.cScaleLabel0=this.cScaleLabel0||this.cScale1,this.cScaleLabel2=this.cScaleLabel2||this.cScale1;for(let x=0;x<this.THEME_COLOR_LIMIT;x++)this["cScaleLabel"+x]=this["cScaleLabel"+x]||this.scaleLabelColor;for(let x=0;x<5;x++)this["surface"+x]=this["surface"+x]||Ge(this.mainBkg,{l:-(5+x*5)}),this["surfacePeer"+x]=this["surfacePeer"+x]||Ge(this.mainBkg,{l:-(8+x*5)});this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.titleColor=this.text,this.sectionBkgColor=Yt(this.contrast,30),this.sectionBkgColor2=Yt(this.contrast,30),this.taskBorderColor=an(this.contrast,10),this.taskBkgColor=this.contrast,this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor=this.text,this.taskTextOutsideColor=this.taskTextDarkColor,this.activeTaskBorderColor=this.taskBorderColor,this.activeTaskBkgColor=this.mainBkg,this.gridColor=Yt(this.border1,30),this.doneTaskBkgColor=this.done,this.doneTaskBorderColor=this.lineColor,this.critBkgColor=this.critical,this.critBorderColor=an(this.critBkgColor,10),this.todayLineColor=this.critBkgColor,this.vertLineColor=this.critBkgColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||"#000",this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f4f4f4",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.stateBorder=this.stateBorder||"#000",this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#222",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.classText=this.primaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=Ge(this.primaryColor,{h:64}),this.fillType3=Ge(this.secondaryColor,{h:64}),this.fillType4=Ge(this.primaryColor,{h:-64}),this.fillType5=Ge(this.secondaryColor,{h:-64}),this.fillType6=Ge(this.primaryColor,{h:128}),this.fillType7=Ge(this.secondaryColor,{h:128});for(let x=0;x<this.THEME_COLOR_LIMIT;x++)this["pie"+x]=this["cScale"+x];this.pie12=this.pie0,this.pieTitleTextSize=this.pieTitleTextSize||"25px",this.pieTitleTextColor=this.pieTitleTextColor||this.taskTextDarkColor,this.pieSectionTextSize=this.pieSectionTextSize||"17px",this.pieSectionTextColor=this.pieSectionTextColor||this.textColor,this.pieLegendTextSize=this.pieLegendTextSize||"17px",this.pieLegendTextColor=this.pieLegendTextColor||this.taskTextDarkColor,this.pieStrokeColor=this.pieStrokeColor||"black",this.pieStrokeWidth=this.pieStrokeWidth||"2px",this.pieOuterStrokeWidth=this.pieOuterStrokeWidth||"2px",this.pieOuterStrokeColor=this.pieOuterStrokeColor||"black",this.pieOpacity=this.pieOpacity||"0.7",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||Ge(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||Ge(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||Ge(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||Ge(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||Ge(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||Ge(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||um(this.quadrant1Fill)?Yt(this.quadrant1Fill):an(this.quadrant1Fill),this.quadrantPointTextFill=this.quadrantPointTextFill||this.primaryTextColor,this.quadrantXAxisTextFill=this.quadrantXAxisTextFill||this.primaryTextColor,this.quadrantYAxisTextFill=this.quadrantYAxisTextFill||this.primaryTextColor,this.quadrantInternalBorderStrokeFill=this.quadrantInternalBorderStrokeFill||this.primaryBorderColor,this.quadrantExternalBorderStrokeFill=this.quadrantExternalBorderStrokeFill||this.primaryBorderColor,this.quadrantTitleFill=this.quadrantTitleFill||this.primaryTextColor,this.xyChart={backgroundColor:((e=this.xyChart)==null?void 0:e.backgroundColor)||this.background,titleColor:((n=this.xyChart)==null?void 0:n.titleColor)||this.primaryTextColor,xAxisTitleColor:((a=this.xyChart)==null?void 0:a.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((r=this.xyChart)==null?void 0:r.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((i=this.xyChart)==null?void 0:i.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((o=this.xyChart)==null?void 0:o.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((s=this.xyChart)==null?void 0:s.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((l=this.xyChart)==null?void 0:l.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((u=this.xyChart)==null?void 0:u.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((d=this.xyChart)==null?void 0:d.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((p=this.xyChart)==null?void 0:p.plotColorPalette)||"#EEE,#6BB8E4,#8ACB88,#C7ACD6,#E8DCC2,#FFB2A8,#FFF380,#7E8D91,#FFD8B1,#FAF3E0"},this.radar={axisColor:((m=this.radar)==null?void 0:m.axisColor)||this.lineColor,axisStrokeWidth:((A=this.radar)==null?void 0:A.axisStrokeWidth)||2,axisLabelFontSize:((g=this.radar)==null?void 0:g.axisLabelFontSize)||12,curveOpacity:((h=this.radar)==null?void 0:h.curveOpacity)||.5,curveStrokeWidth:((f=this.radar)==null?void 0:f.curveStrokeWidth)||2,graticuleColor:((b=this.radar)==null?void 0:b.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((y=this.radar)==null?void 0:y.graticuleStrokeWidth)||1,graticuleOpacity:((w=this.radar)==null?void 0:w.graticuleOpacity)||.3,legendBoxSize:((k=this.radar)==null?void 0:k.legendBoxSize)||12,legendFontSize:((C=this.radar)==null?void 0:C.legendFontSize)||12},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=an(this.pie1,25)||this.primaryColor,this.git1=this.pie2||this.secondaryColor,this.git2=this.pie3||this.tertiaryColor,this.git3=this.pie4||Ge(this.primaryColor,{h:-30}),this.git4=this.pie5||Ge(this.primaryColor,{h:-60}),this.git5=this.pie6||Ge(this.primaryColor,{h:-90}),this.git6=this.pie7||Ge(this.primaryColor,{h:60}),this.git7=this.pie8||Ge(this.primaryColor,{h:120}),this.gitInv0=this.gitInv0||Lt(this.git0),this.gitInv1=this.gitInv1||Lt(this.git1),this.gitInv2=this.gitInv2||Lt(this.git2),this.gitInv3=this.gitInv3||Lt(this.git3),this.gitInv4=this.gitInv4||Lt(this.git4),this.gitInv5=this.gitInv5||Lt(this.git5),this.gitInv6=this.gitInv6||Lt(this.git6),this.gitInv7=this.gitInv7||Lt(this.git7),this.branchLabelColor=this.branchLabelColor||this.labelTextColor,this.gitBranchLabel0=this.branchLabelColor,this.gitBranchLabel1="white",this.gitBranchLabel2=this.branchLabelColor,this.gitBranchLabel3="white",this.gitBranchLabel4=this.branchLabelColor,this.gitBranchLabel5=this.branchLabelColor,this.gitBranchLabel6=this.branchLabelColor,this.gitBranchLabel7=this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||I3,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||D3}calculate(e){if(typeof e!="object"){this.updateColors();return}const n=Object.keys(e);n.forEach(a=>{this[a]=e[a]}),this.updateColors(),n.forEach(a=>{this[a]=e[a]})}},v(B_,"Theme"),B_),Ept=v(t=>{const e=new xpt;return e.calculate(t),e},"getThemeVariables"),Dd={base:{getThemeVariables:ypt},dark:{getThemeVariables:kpt},default:{getThemeVariables:Q3},forest:{getThemeVariables:_pt},neutral:{getThemeVariables:Ept}},gu={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:!0,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showTitle:!0,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:""},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},Fue={...gu,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:Dd.default.getThemeVariables(),sequence:{...gu.sequence,messageFont:v(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:v(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:v(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1},gantt:{...gu.gantt,tickInterval:void 0,useWidth:void 0},c4:{...gu.c4,useWidth:void 0,personFont:v(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...gu.flowchart,inheritDir:!1},external_personFont:v(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:v(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:v(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:v(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:v(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:v(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:v(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:v(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:v(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:v(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:v(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:v(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:v(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:v(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:v(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:v(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:v(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:v(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:v(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:v(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:v(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...gu.pie,useWidth:984},xyChart:{...gu.xyChart,useWidth:void 0},requirement:{...gu.requirement,useWidth:void 0},packet:{...gu.packet},radar:{...gu.radar},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","}},Lue=v((t,e="")=>Object.keys(t).reduce((n,a)=>Array.isArray(t[a])?n:typeof t[a]=="object"&&t[a]!==null?[...n,e+a,...Lue(t[a],"")]:[...n,e+a],[]),"keyify"),Bpt=new Set(Lue(Fue,"")),Un=Fue,S3=v(t=>{if(se.debug("sanitizeDirective called with",t),!(typeof t!="object"||t==null)){if(Array.isArray(t)){t.forEach(e=>S3(e));return}for(const e of Object.keys(t)){if(se.debug("Checking key",e),e.startsWith("__")||e.includes("proto")||e.includes("constr")||!Bpt.has(e)||t[e]==null){se.debug("sanitize deleting key: ",e),delete t[e];continue}if(typeof t[e]=="object"){se.debug("sanitizing object",e),S3(t[e]);continue}const n=["themeCSS","fontFamily","altFontFamily"];for(const a of n)e.includes(a)&&(se.debug("sanitizing css option",e),t[e]=Ipt(t[e]))}if(t.themeVariables)for(const e of Object.keys(t.themeVariables)){const n=t.themeVariables[e];n!=null&&n.match&&!n.match(/^[\d "#%(),.;A-Za-z]+$/)&&(t.themeVariables[e]="")}se.debug("After sanitization",t)}},"sanitizeDirective"),Ipt=v(t=>{let e=0,n=0;for(const a of t){if(e<n)return"{ /* ERROR: Unbalanced CSS */ }";a==="{"?e++:a==="}"&&n++}return e!==n?"{ /* ERROR: Unbalanced CSS */ }":t},"sanitizeCss"),xb=Object.freeze(Un),As=Cr({},xb),T3,fg=[],W1=Cr({},xb),F3=v((t,e)=>{let n=Cr({},t),a={};for(const r of e)Rue(r),a=Cr(a,r);if(n=Cr(n,a),a.theme&&a.theme in Dd){const r=Cr({},T3),i=Cr(r.themeVariables||{},a.themeVariables);n.theme&&n.theme in Dd&&(n.themeVariables=Dd[n.theme].getThemeVariables(i))}return W1=n,$ue(W1),W1},"updateCurrentConfig"),Dpt=v(t=>(As=Cr({},xb),As=Cr(As,t),t.theme&&Dd[t.theme]&&(As.themeVariables=Dd[t.theme].getThemeVariables(t.themeVariables)),F3(As,fg),As),"setSiteConfig"),Qpt=v(t=>{T3=Cr({},t)},"saveConfigFromInitialize"),Spt=v(t=>(As=Cr(As,t),F3(As,fg),As),"updateSiteConfig"),Nue=v(()=>Cr({},As),"getSiteConfig"),Mue=v(t=>($ue(t),Cr(W1,t),Vn()),"setConfig"),Vn=v(()=>Cr({},W1),"getConfig"),Rue=v(t=>{t&&(["secure",...As.secure??[]].forEach(e=>{Object.hasOwn(t,e)&&(se.debug(`Denied attempt to modify a secure key ${e}`,t[e]),delete t[e])}),Object.keys(t).forEach(e=>{e.startsWith("__")&&delete t[e]}),Object.keys(t).forEach(e=>{typeof t[e]=="string"&&(t[e].includes("<")||t[e].includes(">")||t[e].includes("url(data:"))&&delete t[e],typeof t[e]=="object"&&Rue(t[e])}))},"sanitize"),Tpt=v(t=>{var e;S3(t),t.fontFamily&&!((e=t.themeVariables)!=null&&e.fontFamily)&&(t.themeVariables={...t.themeVariables,fontFamily:t.fontFamily}),fg.push(t),F3(As,fg)},"addDirective"),L3=v((t=As)=>{fg=[],F3(t,fg)},"reset"),Fpt={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead."},Pue={},Lpt=v(t=>{Pue[t]||(se.warn(Fpt[t]),Pue[t]=!0)},"issueWarning"),$ue=v(t=>{t&&(t.lazyLoadedDiagrams||t.loadExternalDiagramsAtStartup)&&Lpt("LAZY_LOAD_DEPRECATED")},"checkConfig"),Npt=v(()=>{let t={};T3&&(t=Cr(t,T3));for(const e of fg)t=Cr(t,e);return t},"getUserDefinedConfig"),Eb=/<br\s*\/?>/gi,Mpt=v(t=>t?que(t).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),Rpt=(()=>{let t=!1;return()=>{t||(Oue(),t=!0)}})();function Oue(){const t="data-temp-href-target";_b.addHook("beforeSanitizeAttributes",e=>{e.tagName==="A"&&e.hasAttribute("target")&&e.setAttribute(t,e.getAttribute("target")??"")}),_b.addHook("afterSanitizeAttributes",e=>{e.tagName==="A"&&e.hasAttribute(t)&&(e.setAttribute("target",e.getAttribute(t)??""),e.removeAttribute(t),e.getAttribute("target")==="_blank"&&e.setAttribute("rel","noopener"))})}v(Oue,"setupDompurifyHooks");var jue=v(t=>(Rpt(),_b.sanitize(t)),"removeScript"),Gue=v((t,e)=>{var n;if(((n=e.flowchart)==null?void 0:n.htmlLabels)!==!1){const a=e.securityLevel;a==="antiscript"||a==="strict"?t=jue(t):a!=="loose"&&(t=que(t),t=t.replace(/</g,"<").replace(/>/g,">"),t=t.replace(/=/g,"="),t=jpt(t))}return t},"sanitizeMore"),Yn=v((t,e)=>t&&(e.dompurifyConfig?t=_b.sanitize(Gue(t,e),e.dompurifyConfig).toString():t=_b.sanitize(Gue(t,e),{FORBID_TAGS:["style"]}).toString(),t),"sanitizeText"),Ppt=v((t,e)=>typeof t=="string"?Yn(t,e):t.flat().map(n=>Yn(n,e)),"sanitizeTextOrArray"),$pt=v(t=>Eb.test(t),"hasBreaks"),Opt=v(t=>t.split(Eb),"splitBreaks"),jpt=v(t=>t.replace(/#br#/g,"<br/>"),"placeholderToBreak"),que=v(t=>t.replace(Eb,"#br#"),"breakToPlaceholder"),N3=v(t=>{let e="";return t&&(e=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,e=CSS.escape(e)),e},"getUrl"),ba=v(t=>!(t===!1||["false","null","0"].includes(String(t).trim().toLowerCase())),"evaluate"),Gpt=v(function(...t){const e=t.filter(n=>!isNaN(n));return Math.max(...e)},"getMax"),qpt=v(function(...t){const e=t.filter(n=>!isNaN(n));return Math.min(...e)},"getMin"),dm=v(function(t){const e=t.split(/(,)/),n=[];for(let a=0;a<e.length;a++){let r=e[a];if(r===","&&a>0&&a+1<e.length){const i=e[a-1],o=e[a+1];zpt(i,o)&&(r=i+","+o,a++,n.pop())}n.push(Hpt(r))}return n.join("")},"parseGenericTypes"),vN=v((t,e)=>Math.max(0,t.split(e).length-1),"countOccurrence"),zpt=v((t,e)=>{const n=vN(t,"~"),a=vN(e,"~");return n===1&&a===1},"shouldCombineSets"),Hpt=v(t=>{const e=vN(t,"~");let n=!1;if(e<=1)return t;e%2!==0&&t.startsWith("~")&&(t=t.substring(1),n=!0);const a=[...t];let r=a.indexOf("~"),i=a.lastIndexOf("~");for(;r!==-1&&i!==-1&&r!==i;)a[r]="<",a[i]=">",r=a.indexOf("~"),i=a.lastIndexOf("~");return n&&a.unshift("~"),a.join("")},"processSet"),zue=v(()=>window.MathMLElement!==void 0,"isMathMLSupported"),CN=/\$\$(.*)\$\$/g,pr=v(t=>{var e;return(((e=t.match(CN))==null?void 0:e.length)??0)>0},"hasKatex"),K1=v(async(t,e)=>{const n=document.createElement("div");n.innerHTML=await Z1(t,e),n.id="katex-temp",n.style.visibility="hidden",n.style.position="absolute",n.style.top="0";const a=document.querySelector("body");a==null||a.insertAdjacentElement("beforeend",n);const r={width:n.clientWidth,height:n.clientHeight};return n.remove(),r},"calculateMathMLDimensions"),Upt=v(async(t,e)=>{if(!pr(t))return t;if(!(zue()||e.legacyMathML||e.forceLegacyMathML))return t.replace(CN,"MathML is unsupported in this environment.");{const{default:n}=await Promise.resolve().then(()=>O5e),a=e.forceLegacyMathML||!zue()&&e.legacyMathML?"htmlAndMathml":"mathml";return t.split(Eb).map(r=>pr(r)?`<div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">${r}</div>`:`<div>${r}</div>`).join("").replace(CN,(r,i)=>n.renderToString(i,{throwOnError:!0,displayMode:!0,output:a}).replace(/\n/g," ").replace(/<annotation.*<\/annotation>/g,""))}},"renderKatexUnsanitized"),Z1=v(async(t,e)=>Yn(await Upt(t,e),e),"renderKatexSanitized"),yt={getRows:Mpt,sanitizeText:Yn,sanitizeTextOrArray:Ppt,hasBreaks:$pt,splitBreaks:Opt,lineBreakRegex:Eb,removeScript:jue,getUrl:N3,evaluate:ba,getMax:Gpt,getMin:qpt},Ypt=v(function(t,e){for(let n of e)t.attr(n[0],n[1])},"d3Attrs"),Wpt=v(function(t,e,n){let a=new Map;return n?(a.set("width","100%"),a.set("style",`max-width: ${e}px;`)):(a.set("height",t),a.set("width",e)),a},"calculateSvgSizeAttrs"),Go=v(function(t,e,n,a){const r=Wpt(e,n,a);Ypt(t,r)},"configureSvgSize"),V1=v(function(t,e,n,a){const r=e.node().getBBox(),i=r.width,o=r.height;se.info(`SVG bounds: ${i}x${o}`,r);let s=0,l=0;se.info(`Graph bounds: ${s}x${l}`,t),s=i+n*2,l=o+n*2,se.info(`Calculated bounds: ${s}x${l}`),Go(e,l,s,a);const u=`${r.x-n} ${r.y-n} ${r.width+2*n} ${r.height+2*n}`;e.attr("viewBox",u)},"setupGraphViewbox"),M3={},Kpt=v((t,e,n)=>{let a="";return t in M3&&M3[t]?a=M3[t](n):se.warn(`No theme found for ${t}`),` & {
|
|
1364
1364
|
font-family: ${n.fontFamily};
|